Merge commit 'snapshot-start' into stable
authorIan Beckwith <ianb@erislabs.net>
Wed, 16 Feb 2011 23:15:21 +0000 (23:15 +0000)
committerIan Beckwith <ianb@erislabs.net>
Wed, 16 Feb 2011 23:15:21 +0000 (23:15 +0000)
272 files changed:
ChangeLog
NEWS
build-aux/config.guess
build-aux/config.sub
build-aux/texinfo.tex
doc/posix-functions/fdopendir.texi
doc/posix-functions/iswalnum.texi
doc/posix-functions/iswalpha.texi
doc/posix-functions/iswblank.texi
doc/posix-functions/iswcntrl.texi
doc/posix-functions/iswctype.texi
doc/posix-functions/iswdigit.texi
doc/posix-functions/iswgraph.texi
doc/posix-functions/iswlower.texi
doc/posix-functions/iswprint.texi
doc/posix-functions/iswpunct.texi
doc/posix-functions/iswspace.texi
doc/posix-functions/iswupper.texi
doc/posix-functions/iswxdigit.texi
doc/posix-functions/strerror_r.texi
doc/posix-functions/towctrans.texi
doc/posix-functions/towlower.texi
doc/posix-functions/towupper.texi
doc/posix-functions/unsetenv.texi
doc/posix-functions/wcpcpy.texi
doc/posix-functions/wcpncpy.texi
doc/posix-functions/wcscasecmp.texi
doc/posix-functions/wcscat.texi
doc/posix-functions/wcschr.texi
doc/posix-functions/wcscmp.texi
doc/posix-functions/wcscoll.texi
doc/posix-functions/wcscpy.texi
doc/posix-functions/wcscspn.texi
doc/posix-functions/wcsdup.texi
doc/posix-functions/wcslen.texi
doc/posix-functions/wcsncasecmp.texi
doc/posix-functions/wcsncat.texi
doc/posix-functions/wcsncmp.texi
doc/posix-functions/wcsncpy.texi
doc/posix-functions/wcsnlen.texi
doc/posix-functions/wcspbrk.texi
doc/posix-functions/wcsrchr.texi
doc/posix-functions/wcsspn.texi
doc/posix-functions/wcsstr.texi
doc/posix-functions/wcstok.texi
doc/posix-functions/wcswidth.texi
doc/posix-functions/wcsxfrm.texi
doc/posix-functions/wctrans.texi
doc/posix-functions/wctype.texi
doc/posix-functions/wmemchr.texi
doc/posix-functions/wmemcmp.texi
doc/posix-functions/wmemcpy.texi
doc/posix-functions/wmemmove.texi
doc/posix-functions/wmemset.texi
doc/posix-headers/wctype.texi
gnulib-tool
lib/di-set.c [new file with mode: 0644]
lib/di-set.h [new file with mode: 0644]
lib/flock.c
lib/getloadavg.c
lib/getopt.in.h
lib/ino-map.c [new file with mode: 0644]
lib/ino-map.h [new file with mode: 0644]
lib/inttypes.in.h
lib/iswctype-impl.h [new file with mode: 0644]
lib/iswctype.c [new file with mode: 0644]
lib/langinfo.in.h
lib/math.in.h
lib/mbsnrtowcs-impl.h [new file with mode: 0644]
lib/mbsnrtowcs.c
lib/mbsrtowcs-impl.h [new file with mode: 0644]
lib/mbsrtowcs.c
lib/netdb.in.h
lib/openat-die.c
lib/poll.in.h
lib/printf-args.h
lib/printf-parse.c
lib/printf-parse.h
lib/pthread.in.h
lib/sched.in.h
lib/se-selinux.in.h
lib/search.in.h
lib/signal.in.h
lib/spawn.in.h
lib/stdint.in.h
lib/stdio.in.h
lib/stdlib.in.h
lib/strerror_r.c
lib/sys_socket.in.h
lib/sys_stat.in.h
lib/sys_time.in.h
lib/sys_times.in.h
lib/sys_utsname.in.h
lib/time.in.h
lib/towctrans-impl.h [new file with mode: 0644]
lib/towctrans.c [new file with mode: 0644]
lib/unistd.in.h
lib/vasnprintf.c
lib/wchar.in.h
lib/wcpcpy-impl.h [new file with mode: 0644]
lib/wcpcpy.c [new file with mode: 0644]
lib/wcpncpy-impl.h [new file with mode: 0644]
lib/wcpncpy.c [new file with mode: 0644]
lib/wcscasecmp-impl.h [new file with mode: 0644]
lib/wcscasecmp.c [new file with mode: 0644]
lib/wcscat-impl.h [new file with mode: 0644]
lib/wcscat.c [new file with mode: 0644]
lib/wcschr-impl.h [new file with mode: 0644]
lib/wcschr.c [new file with mode: 0644]
lib/wcscmp-impl.h [new file with mode: 0644]
lib/wcscmp.c [new file with mode: 0644]
lib/wcscoll-impl.h [new file with mode: 0644]
lib/wcscoll.c [new file with mode: 0644]
lib/wcscpy-impl.h [new file with mode: 0644]
lib/wcscpy.c [new file with mode: 0644]
lib/wcscspn-impl.h [new file with mode: 0644]
lib/wcscspn.c [new file with mode: 0644]
lib/wcsdup-impl.h [new file with mode: 0644]
lib/wcsdup.c [new file with mode: 0644]
lib/wcslen-impl.h [new file with mode: 0644]
lib/wcslen.c [new file with mode: 0644]
lib/wcsncasecmp-impl.h [new file with mode: 0644]
lib/wcsncasecmp.c [new file with mode: 0644]
lib/wcsncat-impl.h [new file with mode: 0644]
lib/wcsncat.c [new file with mode: 0644]
lib/wcsncmp-impl.h [new file with mode: 0644]
lib/wcsncmp.c [new file with mode: 0644]
lib/wcsncpy-impl.h [new file with mode: 0644]
lib/wcsncpy.c [new file with mode: 0644]
lib/wcsnlen-impl.h [new file with mode: 0644]
lib/wcsnlen.c [new file with mode: 0644]
lib/wcsnrtombs-impl.h [new file with mode: 0644]
lib/wcsnrtombs.c
lib/wcspbrk-impl.h [new file with mode: 0644]
lib/wcspbrk.c [new file with mode: 0644]
lib/wcsrchr-impl.h [new file with mode: 0644]
lib/wcsrchr.c [new file with mode: 0644]
lib/wcsrtombs-impl.h [new file with mode: 0644]
lib/wcsrtombs.c
lib/wcsspn-impl.h [new file with mode: 0644]
lib/wcsspn.c [new file with mode: 0644]
lib/wcsstr-impl.h [new file with mode: 0644]
lib/wcsstr.c [new file with mode: 0644]
lib/wcstok-impl.h [new file with mode: 0644]
lib/wcstok.c [new file with mode: 0644]
lib/wcswidth-impl.h [new file with mode: 0644]
lib/wcswidth.c [new file with mode: 0644]
lib/wcsxfrm-impl.h [new file with mode: 0644]
lib/wcsxfrm.c [new file with mode: 0644]
lib/wctrans-impl.h [new file with mode: 0644]
lib/wctrans.c [new file with mode: 0644]
lib/wctype-impl.h [new file with mode: 0644]
lib/wctype.c [new file with mode: 0644]
lib/wctype.in.h
lib/wmemchr-impl.h [new file with mode: 0644]
lib/wmemchr.c [new file with mode: 0644]
lib/wmemcmp-impl.h [new file with mode: 0644]
lib/wmemcmp.c [new file with mode: 0644]
lib/wmemcpy-impl.h [new file with mode: 0644]
lib/wmemcpy.c [new file with mode: 0644]
lib/wmemmove-impl.h [new file with mode: 0644]
lib/wmemmove.c [new file with mode: 0644]
lib/wmemset-impl.h [new file with mode: 0644]
lib/wmemset.c [new file with mode: 0644]
m4/fdopendir.m4
m4/iswblank.m4 [new file with mode: 0644]
m4/iswctype.m4 [new file with mode: 0644]
m4/random_r.m4
m4/setenv.m4
m4/stdbool.m4
m4/stdlib_h.m4
m4/strerror_r.m4
m4/towctrans.m4 [new file with mode: 0644]
m4/wchar_h.m4
m4/wcpcpy.m4 [new file with mode: 0644]
m4/wcpncpy.m4 [new file with mode: 0644]
m4/wcscasecmp.m4 [new file with mode: 0644]
m4/wcscat.m4 [new file with mode: 0644]
m4/wcschr.m4 [new file with mode: 0644]
m4/wcscmp.m4 [new file with mode: 0644]
m4/wcscoll.m4 [new file with mode: 0644]
m4/wcscpy.m4 [new file with mode: 0644]
m4/wcscspn.m4 [new file with mode: 0644]
m4/wcsdup.m4 [new file with mode: 0644]
m4/wcslen.m4 [new file with mode: 0644]
m4/wcsncasecmp.m4 [new file with mode: 0644]
m4/wcsncat.m4 [new file with mode: 0644]
m4/wcsncmp.m4 [new file with mode: 0644]
m4/wcsncpy.m4 [new file with mode: 0644]
m4/wcsnlen.m4 [new file with mode: 0644]
m4/wcspbrk.m4 [new file with mode: 0644]
m4/wcsrchr.m4 [new file with mode: 0644]
m4/wcsspn.m4 [new file with mode: 0644]
m4/wcsstr.m4 [new file with mode: 0644]
m4/wcstok.m4 [new file with mode: 0644]
m4/wcswidth.m4 [new file with mode: 0644]
m4/wcsxfrm.m4 [new file with mode: 0644]
m4/wctrans.m4 [new file with mode: 0644]
m4/wctype.m4 [new file with mode: 0644]
m4/wctype_h.m4
m4/wmemchr.m4 [new file with mode: 0644]
m4/wmemcmp.m4 [new file with mode: 0644]
m4/wmemcpy.m4 [new file with mode: 0644]
m4/wmemmove.m4 [new file with mode: 0644]
m4/wmemset.m4 [new file with mode: 0644]
modules/di-set [new file with mode: 0644]
modules/di-set-tests [new file with mode: 0644]
modules/fnmatch
modules/getloadavg
modules/ino-map [new file with mode: 0644]
modules/ino-map-tests [new file with mode: 0644]
modules/iswblank [new file with mode: 0644]
modules/iswblank-tests [new file with mode: 0644]
modules/iswctype [new file with mode: 0644]
modules/math
modules/mbchar
modules/mbsnrtowcs
modules/mbsrtowcs
modules/mbswidth
modules/quotearg
modules/regex
modules/stdlib
modules/towctrans [new file with mode: 0644]
modules/unistd
modules/wchar
modules/wcpcpy [new file with mode: 0644]
modules/wcpncpy [new file with mode: 0644]
modules/wcscasecmp [new file with mode: 0644]
modules/wcscat [new file with mode: 0644]
modules/wcschr [new file with mode: 0644]
modules/wcscmp [new file with mode: 0644]
modules/wcscoll [new file with mode: 0644]
modules/wcscpy [new file with mode: 0644]
modules/wcscspn [new file with mode: 0644]
modules/wcsdup [new file with mode: 0644]
modules/wcslen [new file with mode: 0644]
modules/wcsncasecmp [new file with mode: 0644]
modules/wcsncat [new file with mode: 0644]
modules/wcsncmp [new file with mode: 0644]
modules/wcsncpy [new file with mode: 0644]
modules/wcsnlen [new file with mode: 0644]
modules/wcsnrtombs
modules/wcspbrk [new file with mode: 0644]
modules/wcsrchr [new file with mode: 0644]
modules/wcsrtombs
modules/wcsspn [new file with mode: 0644]
modules/wcsstr [new file with mode: 0644]
modules/wcstok [new file with mode: 0644]
modules/wcswidth [new file with mode: 0644]
modules/wcsxfrm [new file with mode: 0644]
modules/wctrans [new file with mode: 0644]
modules/wctype
modules/wctype-c++-tests [deleted file]
modules/wctype-h [new file with mode: 0644]
modules/wctype-h-c++-tests [new file with mode: 0644]
modules/wctype-h-tests [new file with mode: 0644]
modules/wctype-tests [deleted file]
modules/wcwidth
modules/wmemchr [new file with mode: 0644]
modules/wmemcmp [new file with mode: 0644]
modules/wmemcpy [new file with mode: 0644]
modules/wmemmove [new file with mode: 0644]
modules/wmemset [new file with mode: 0644]
tests/test-di-set.c [new file with mode: 0644]
tests/test-ino-map.c [new file with mode: 0644]
tests/test-iswblank.c [new file with mode: 0644]
tests/test-strerror_r.c
tests/test-wchar-c++.cc
tests/test-wctype-c++.cc [deleted file]
tests/test-wctype-h-c++.cc [new file with mode: 0644]
tests/test-wctype-h.c [new file with mode: 0644]
tests/test-wctype.c [deleted file]

index b025454..172b167 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,788 @@
+2011-02-09  Bruno Haible  <bruno@clisp.org>
+
+       gnulib-tool: Make copyright notice adjustment more robust.
+       * gnulib-tool (func_import): In sed_transform_main_lib_file,
+       sed_transform_build_aux_file, sed_transform_testsrelated_lib_file,
+       allow a line break to occur after "GNU" in "GNU [Lesser] General Public
+       License".
+       Reported by Glenn Morris <rgm@gnu.org> via Paul Eggert.
+
+2011-02-06  Bruno Haible  <bruno@clisp.org>
+
+       New module 'towctrans'.
+       * modules/towctrans: New file.
+       * lib/wctype.in.h (towctrans): New declaration.
+       * lib/towctrans.c: New file.
+       * lib/towctrans-impl.h: New file.
+       * m4/towctrans.m4: New file.
+       * m4/wctype_h.m4 (gl_WCTYPE_H): Test whether towctrans is declared.
+       (gl_WCTYPE_H_DEFAULTS): Initialize GNULIB_TOWCTRANS.
+       * modules/wctype-h (Makefile.am): Substitute GNULIB_TOWCTRANS.
+       * tests/test-wctype-h-c++.cc: Test the declaration of towctrans.
+       * doc/posix-functions/towctrans.texi: Mention the new module.
+
+2011-02-06  Bruno Haible  <bruno@clisp.org>
+
+       New module 'wctrans'.
+       * modules/wctrans: New file.
+       * lib/wctype.in.h (wctrans): New declaration.
+       * lib/wctrans.c: New file.
+       * lib/wctrans-impl.h: New file.
+       * m4/wctrans.m4: New file.
+       * m4/wctype_h.m4 (gl_WCTYPE_H): Test whether wctrans is declared.
+       (gl_WCTYPE_H_DEFAULTS): Initialize GNULIB_WCTRANS.
+       * modules/wctype-h (Makefile.am): Substitute GNULIB_WCTRANS.
+       * tests/test-wctype-h-c++.cc: Test the declaration of wctrans.
+       * doc/posix-functions/wctrans.texi: Mention the new module.
+
+2011-02-06  Bruno Haible  <bruno@clisp.org>
+
+       New module 'iswctype'.
+       * modules/iswctype: New file.
+       * lib/wctype.in.h (iswctype): New declaration.
+       * lib/iswctype.c: New file.
+       * lib/iswctype-impl.h: New file.
+       * m4/iswctype.m4: New file.
+       * m4/wctype_h.m4 (gl_WCTYPE_H): Test whether iswctype is declared.
+       (gl_WCTYPE_H_DEFAULTS): Initialize GNULIB_ISWCTYPE.
+       * modules/wctype-h (Makefile.am): Substitute GNULIB_ISWCTYPE.
+       * tests/test-wctype-h-c++.cc: Test the declaration of iswctype.
+       * doc/posix-functions/iswctype.texi: Mention the new module and the
+       HP-UX 11.00 problem.
+
+2011-02-06  Bruno Haible  <bruno@clisp.org>
+
+       New module 'wctype'.
+       * modules/wctype: Change to represent the wctype() substitute.
+       * lib/wctype.in.h (wctype): New declaration.
+       * lib/wctype.c: New file.
+       * lib/wctype-impl.h: New file.
+       * m4/wctype.m4: New file.
+       * m4/wctype_h.m4 (gl_WCTYPE_H): Test whether wctype is declared.
+       (gl_WCTYPE_H_DEFAULTS): Initialize GNULIB_WCTYPE.
+       * modules/wctype-h (Makefile.am): Substitute GNULIB_WCTYPE.
+       * tests/test-wctype-h-c++.cc: Test the declaration of wctype.
+       * doc/posix-functions/wctype.texi: Mention the new module and the
+       HP-UX 11.00 problem.
+
+2011-02-06  Bruno Haible  <bruno@clisp.org>
+
+       wctype-h: Ensure wctype_t and wctrans_t are defined.
+       * lib/wctype.in.h (wctype_t, wctrans_t): New type declarations.
+       * m4/wctype_h.m4 (gl_WCTYPE_H): Determine HAVE_WCTYPE_T, HAVE_WCTRANS_T.
+       (gl_WCTYPE_H_DEFAULTS): Initialize HAVE_WCTYPE_T, HAVE_WCTRANS_T.
+       * modules/wctype-h (Makefile.am): Substitute HAVE_WCTYPE_T,
+       HAVE_WCTRANS_T.
+       * tests/test-wctype-h.c: Check that wctype_t and wctrans_t are defined.
+
+2011-02-09  Paul Eggert  <eggert@cs.ucla.edu>
+
+       flock: fix license typo
+
+       * lib/flock.c: Fix typo in license.  One of the "Lesser"s was
+       omitted.
+
+2011-02-08  Bruno Haible  <bruno@clisp.org>
+
+       Split large sed scripts, for HP-UX sed.
+       * modules/math (Makefile.am): Split sed scripts around 50 sed commands,
+       to avoid HP-UX limit of 99 commands, in the near future.
+       * modules/stdlib (Makefile.am): Likewise.
+       * modules/unistd (Makefile.am): Likewise.
+       * modules/wchar (Makefile.am): Likewise.
+       Reported by Albert Chin <bug-gnulib@mlists.thewrittenword.com>.
+       Suggestion by Ralf Wildenhues <Ralf.Wildenhues@gmx.de> in
+       <http://lists.gnu.org/archive/html/bug-gnulib/2010-01/msg00216.html>.
+
+2011-02-08  Paul Eggert  <eggert@cs.ucla.edu>
+           Bruno Haible  <bruno@clisp.org>
+
+       stdlib: improve random_r modularization
+       * lib/stdlib.in.h: Encapsulate all the stuff having to do with
+       random_r inside "#if @GNULIB_RANDOM_R@", so that it's clearer that
+       you also need the random_r module to get this material right.
+       * m4/random_r.m4 (gl_FUNC_RANDOM_R): Move check for random.h here ...
+       * m4/stdlib_h.m4 (gl_STDLIB_H): ... from here.
+       (gl_STDLIB_H_DEFAULTS): Default HAVE_RANDOM_H to 1, and AC_SUBST it.
+
+2011-02-08  Paul Eggert  <eggert@cs.ucla.edu>
+
+       stdlib: don't depend on stdint
+       * lib/stdlib.in.h: Don't include <stdint.h> merely because
+       GNULIB_POSIXCHECK is defined.  GNULIB_POSIXCHECK seems to
+       be independent of whether stdint.h is needed.
+       * m4/random_r.m4 (gl_FUNC_RANDOM_R): Check for struct random_data
+       here, instead of ...
+       * m4/stdlib_h.m4 (gl_STDLIB_H): ... here.  Applications that need
+       struct random_data should be using the random_r module, not just
+       the stdlib module (which wouldn't make sense: what package needs
+       just struct random_data without also needing random_r?).
+       * modules/stdlib (Depends-on): Remove stdint.
+
+       getloadavg: don't depend on c-strtod, cloexec, fcntl-safer
+       See the thread rooted at
+       <http://lists.gnu.org/archive/html/bug-gnulib/2011-02/msg00090.html>.
+       * lib/getloadavg.c: Do not include c-strtod.h, cloexec.h, or fcntl--.h.
+       Include <fcntl.h> only if (defined __linux__ || defined __CYGWIN__
+       || defined SUNOS_5 || (defined LOAD_AVE_TYPE && !  defined
+       __VMS)); previously it was always included (via fcntl--.h).
+       (getloadavg): Do not use c_strtod.  Instead, approximate it by
+       hand; this is good enough for load averages.  Also, do not use
+       set_cloexec_flag; instead, use the O_CLOEXEC and F_DUPFD_CLOEXEC
+       flags directly if available and don't bother otherwise.  (Packages
+       that need the extra reliability should use the modules that define
+       these flags on older platforms that lack them.)
+       * modules/getloadavg (Depends-on): Remove c-strtod, cloexec,
+       fcntl-safer.
+
+2011-02-08  Jim Meyering  <meyering@redhat.com>
+
+       di-set.h, ino-map.h: add multiple-inclusion guard
+       Technically, the guard is required only for ino-map.h, due to its
+       INO_MAP_INSERT_FAILURE definition, but do both for consistency.
+       * lib/di-set.h: Add file-spanning #ifndef _GL_DI_SET_H.
+       * lib/ino-map.h: Likewise.
+
+2011-02-06  Bruno Haible  <bruno@clisp.org>
+
+       iswblank: Ensure declaration on glibc systems.
+       * m4/iswblank.m4 (gl_FUNC_ISWBLANK): Require gl_USE_SYSTEM_EXTENSIONS.
+       * modules/iswblank (Dependencies): Add 'extensions'.
+       * doc/posix-functions/iswblank.texi: Document the glibc problem.
+
+2011-02-06  Bruno Haible  <bruno@clisp.org>
+
+       New module 'iswblank'.
+       * lib/wctype.in.h (iswblank): Don't declare if GNULIB_ISWBLANK is 0.
+       * modules/iswblank: New file.
+       * modules/wctype-h (Files): Remove lib/iswblank.c.
+       (Makefile.am): Substitute GNULIB_ISWBLANK.
+       * m4/iswblank.m4: New file, partially extracted from m4/wctype_h.m4.
+       * m4/wctype_h.m4 (gl_WCTYPE_MODULE_INDICATOR): New macro.
+       (gl_WCTYPE_H_DEFAULTS): New macro.
+       (gl_WCTYPE_H): Require it. Remove iswblank related code.
+       * modules/iswblank-tests: New file.
+       * tests/test-iswblank.c: New file, extraced from tests/test-wctype-h.c.
+       * tests/test-wctype-h.c (main): Remove iswblank tests.
+       * tests/test-wctype-h-c++.cc: Guard the signature test of iswblank.
+       * doc/posix-functions/iswblank.texi: Mention module 'iswblank' instead
+       of 'wctype-h'.
+       * NEWS: Mention the change.
+       * modules/mbchar (Depends-on): Add iswblank.
+
+2011-02-08  Bruno Haible  <bruno@clisp.org>
+
+       di-set tests: Refactor.
+       * tests/test-di-set.c: Include di-set.h early. Include macros.h. Drop
+       unnecessary includes.
+       (ASSERT): Remove macro.
+       (main): Make C90 compliant by avoiding variable declaration after
+       statement.
+       * modules/di-set-tests (Files): Add tests/macros.h.
+
+2011-02-08  Bruno Haible  <bruno@clisp.org>
+
+       ino-map tests: Refactor.
+       * tests/test-ino-map.c: Include ino-map.h early. Include macros.h. Drop
+       unnecessary includes.
+       (ASSERT): Remove macro.
+       (main): Make C90 compliant by avoiding variable declaration after
+       statement.
+       * modules/ino-map-tests (Files): Add tests/macros.h.
+
+2011-02-08  Jim Meyering  <meyering@redhat.com>
+
+       di-set: add "const" to a cast
+       * lib/di-set.c (di_set_insert): Cast hash_insert0 argument to
+       "(void const *)", not "(void *)".  Spotted by Bruno Haible.
+
+2011-02-06  Bruno Haible  <bruno@clisp.org>
+
+       Rename module 'wctype' to 'wctype-h'.
+       * modules/wctype-h: Renamed from modules/wctype.
+       * modules/wctype: Simplyfy to a redirection to 'wctype-h'.
+       * modules/wctype-h-tests: Renamed from modules/wctype-tests.
+       (Files, Depends-on, Makefile.am): Update.
+       * modules/wctype-h-c++-tests: Renamed from modules/wctype-c++-tests.
+       (Files, Makefile.am): Update.
+       * tests/test-wctype-h.c: Renamed from tests/test-wctype.c.
+       * tests/test-wctype-h-c++.cc: Renamed from tests/test-wctype-c++.cc.
+       * doc/posix-headers/wctype.texi: Update.
+       * doc/posix-functions/iswalnum.texi: Update.
+       * doc/posix-functions/iswalpha.texi: Update.
+       * doc/posix-functions/iswblank.texi: Update.
+       * doc/posix-functions/iswcntrl.texi: Update.
+       * doc/posix-functions/iswdigit.texi: Update.
+       * doc/posix-functions/iswgraph.texi: Update.
+       * doc/posix-functions/iswlower.texi: Update.
+       * doc/posix-functions/iswprint.texi: Update.
+       * doc/posix-functions/iswpunct.texi: Update.
+       * doc/posix-functions/iswspace.texi: Update.
+       * doc/posix-functions/iswupper.texi: Update.
+       * doc/posix-functions/iswxdigit.texi: Update.
+       * doc/posix-functions/towlower.texi: Update.
+       * doc/posix-functions/towupper.texi: Update.
+       * NEWS: Mention the change.
+       * modules/fnmatch (Dependencies): Add wctype-h, remove wctype.
+       * modules/mbchar (Dependencies): Likewise.
+       * modules/mbswidth (Dependencies): Likewise.
+       * modules/quotearg (Dependencies): Likewise.
+       * modules/regex (Dependencies): Likewise.
+       * modules/wcscasecmp (Dependencies): Likewise.
+       * modules/wcsncasecmp (Dependencies): Likewise.
+       * modules/wcwidth (Dependencies): Likewise.
+
+2011-02-06  Bruno Haible  <bruno@clisp.org>
+
+       New module 'wcswidth'.
+       * modules/wcswidth: New file.
+       * lib/wchar.in.h (wcswidth): New declaration.
+       * lib/wcswidth.c: New file.
+       * lib/wcswidth-impl.h: New file, from libutf8 with modifications.
+       * m4/wcswidth.m4: New file.
+       * m4/wchar_h.m4 (gl_WCHAR_H): Test whether wcswidth is declared.
+       (gl_WCHAR_H_DEFAULTS): Initialize GNULIB_WCSWIDTH, HAVE_WCSWIDTH,
+       REPLACE_WCSWIDTH.
+       * modules/wchar (Makefile.am): Substitute GNULIB_WCSWIDTH,
+       HAVE_WCSWIDTH, REPLACE_WCSWIDTH.
+       * tests/test-wchar-c++.cc: Test the declaration of wcswidth.
+       * doc/posix-functions/wcswidth.texi: Mention the new module.
+
+2011-02-06  Bruno Haible  <bruno@clisp.org>
+
+       New module 'wcstok'.
+       * modules/wcstok: New file.
+       * lib/wchar.in.h (wcstok): New declaration.
+       * lib/wcstok.c: New file.
+       * lib/wcstok-impl.h: New file, from libutf8 with modifications.
+       * m4/wcstok.m4: New file.
+       * m4/wchar_h.m4 (gl_WCHAR_H): Test whether wcstok is declared.
+       (gl_WCHAR_H_DEFAULTS): Initialize GNULIB_WCSTOK, HAVE_WCSTOK.
+       * modules/wchar (Makefile.am): Substitute GNULIB_WCSTOK, HAVE_WCSTOK.
+       * tests/test-wchar-c++.cc: Test the declaration of wcstok.
+       * doc/posix-functions/wcstok.texi: Mention the new module.
+
+2011-02-06  Bruno Haible  <bruno@clisp.org>
+
+       New module 'wcsstr'.
+       * modules/wcsstr: New file.
+       * lib/wchar.in.h (wcsstr): New declaration.
+       * lib/wcsstr.c: New file.
+       * lib/wcsstr-impl.h: New file, from libutf8 with modifications.
+       * m4/wcsstr.m4: New file.
+       * m4/wchar_h.m4 (gl_WCHAR_H): Test whether wcsstr is declared.
+       (gl_WCHAR_H_DEFAULTS): Initialize GNULIB_WCSSTR, HAVE_WCSSTR.
+       * modules/wchar (Makefile.am): Substitute GNULIB_WCSSTR, HAVE_WCSSTR.
+       * tests/test-wchar-c++.cc: Test the declaration of wcsstr.
+       * doc/posix-functions/wcsstr.texi: Mention the new module.
+
+2011-02-06  Bruno Haible  <bruno@clisp.org>
+
+       New module 'wcspbrk'.
+       * modules/wcspbrk: New file.
+       * lib/wchar.in.h (wcspbrk): New declaration.
+       * lib/wcspbrk.c: New file.
+       * lib/wcspbrk-impl.h: New file, from libutf8 with modifications.
+       * m4/wcspbrk.m4: New file.
+       * m4/wchar_h.m4 (gl_WCHAR_H): Test whether wcspbrk is declared.
+       (gl_WCHAR_H_DEFAULTS): Initialize GNULIB_WCSPBRK, HAVE_WCSPBRK.
+       * modules/wchar (Makefile.am): Substitute GNULIB_WCSPBRK, HAVE_WCSPBRK.
+       * tests/test-wchar-c++.cc: Test the declaration of wcspbrk.
+       * doc/posix-functions/wcspbrk.texi: Mention the new module.
+
+2011-02-06  Bruno Haible  <bruno@clisp.org>
+
+       New module 'wcsspn'.
+       * modules/wcsspn: New file.
+       * lib/wchar.in.h (wcsspn): New declaration.
+       * lib/wcsspn.c: New file.
+       * lib/wcsspn-impl.h: New file, from libutf8 with modifications.
+       * m4/wcsspn.m4: New file.
+       * m4/wchar_h.m4 (gl_WCHAR_H): Test whether wcsspn is declared.
+       (gl_WCHAR_H_DEFAULTS): Initialize GNULIB_WCSSPN, HAVE_WCSSPN.
+       * modules/wchar (Makefile.am): Substitute GNULIB_WCSSPN, HAVE_WCSSPN.
+       * tests/test-wchar-c++.cc: Test the declaration of wcsspn.
+       * doc/posix-functions/wcsspn.texi: Mention the new module.
+
+2011-02-06  Bruno Haible  <bruno@clisp.org>
+
+       New module 'wcscspn'.
+       * modules/wcscspn: New file.
+       * lib/wchar.in.h (wcscspn): New declaration.
+       * lib/wcscspn.c: New file.
+       * lib/wcscspn-impl.h: New file, from libutf8 with modifications.
+       * m4/wcscspn.m4: New file.
+       * m4/wchar_h.m4 (gl_WCHAR_H): Test whether wcscspn is declared.
+       (gl_WCHAR_H_DEFAULTS): Initialize GNULIB_WCSCSPN, HAVE_WCSCSPN.
+       * modules/wchar (Makefile.am): Substitute GNULIB_WCSCSPN, HAVE_WCSCSPN.
+       * tests/test-wchar-c++.cc: Test the declaration of wcscspn.
+       * doc/posix-functions/wcscspn.texi: Mention the new module.
+
+2011-02-06  Bruno Haible  <bruno@clisp.org>
+
+       New module 'wcsrchr'.
+       * modules/wcsrchr: New file.
+       * lib/wchar.in.h (wcsrchr): New declaration.
+       * lib/wcsrchr.c: New file.
+       * lib/wcsrchr-impl.h: New file, from libutf8 with modifications.
+       * m4/wcsrchr.m4: New file.
+       * m4/wchar_h.m4 (gl_WCHAR_H): Test whether wcsrchr is declared.
+       (gl_WCHAR_H_DEFAULTS): Initialize GNULIB_WCSRCHR, HAVE_WCSRCHR.
+       * modules/wchar (Makefile.am): Substitute GNULIB_WCSRCHR, HAVE_WCSRCHR.
+       * tests/test-wchar-c++.cc: Test the declaration of wcsrchr.
+       * doc/posix-functions/wcsrchr.texi: Mention the new module.
+
+2011-02-06  Bruno Haible  <bruno@clisp.org>
+
+       New module 'wcschr'.
+       * modules/wcschr: New file.
+       * lib/wchar.in.h (wcschr): New declaration.
+       * lib/wcschr.c: New file.
+       * lib/wcschr-impl.h: New file, from libutf8 with modifications.
+       * m4/wcschr.m4: New file.
+       * m4/wchar_h.m4 (gl_WCHAR_H): Test whether wcschr is declared.
+       (gl_WCHAR_H_DEFAULTS): Initialize GNULIB_WCSCHR, HAVE_WCSCHR.
+       * modules/wchar (Makefile.am): Substitute GNULIB_WCSCHR, HAVE_WCSCHR.
+       * tests/test-wchar-c++.cc: Test the declaration of wcschr.
+       * doc/posix-functions/wcschr.texi: Mention the new module.
+
+2011-02-06  Bruno Haible  <bruno@clisp.org>
+
+       New module 'wcsdup'.
+       * modules/wcsdup: New file.
+       * lib/wchar.in.h (wcsdup): New declaration.
+       * lib/wcsdup.c: New file.
+       * lib/wcsdup-impl.h: New file, from libutf8 with modifications.
+       * m4/wcsdup.m4: New file.
+       * m4/wchar_h.m4 (gl_WCHAR_H): Test whether wcsdup is declared.
+       (gl_WCHAR_H_DEFAULTS): Initialize GNULIB_WCSDUP, HAVE_WCSDUP.
+       * modules/wchar (Makefile.am): Substitute GNULIB_WCSDUP, HAVE_WCSDUP.
+       * tests/test-wchar-c++.cc: Test the declaration of wcsdup.
+       * doc/posix-functions/wcsdup.texi: Mention the new module.
+
+2011-02-06  Bruno Haible  <bruno@clisp.org>
+
+       New module 'wcsxfrm'.
+       * modules/wcsxfrm: New file.
+       * lib/wchar.in.h (wcsxfrm): New declaration.
+       * lib/wcsxfrm.c: New file.
+       * lib/wcsxfrm-impl.h: New file.
+       * m4/wcsxfrm.m4: New file.
+       * m4/wchar_h.m4 (gl_WCHAR_H): Test whether wcsxfrm is declared.
+       (gl_WCHAR_H_DEFAULTS): Initialize GNULIB_WCSXFRM, HAVE_WCSXFRM.
+       * modules/wchar (Makefile.am): Substitute GNULIB_WCSXFRM, HAVE_WCSXFRM.
+       * tests/test-wchar-c++.cc: Test the declaration of wcsxfrm.
+       * doc/posix-functions/wcsxfrm.texi: Mention the new module.
+
+2011-02-06  Bruno Haible  <bruno@clisp.org>
+
+       New module 'wcscoll'.
+       * modules/wcscoll: New file.
+       * lib/wchar.in.h (wcscoll): New declaration.
+       * lib/wcscoll.c: New file.
+       * lib/wcscoll-impl.h: New file.
+       * m4/wcscoll.m4: New file.
+       * m4/wchar_h.m4 (gl_WCHAR_H): Test whether wcscoll is declared.
+       (gl_WCHAR_H_DEFAULTS): Initialize GNULIB_WCSCOLL, HAVE_WCSCOLL.
+       * modules/wchar (Makefile.am): Substitute GNULIB_WCSCOLL, HAVE_WCSCOLL.
+       * tests/test-wchar-c++.cc: Test the declaration of wcscoll.
+       * doc/posix-functions/wcscoll.texi: Mention the new module.
+
+2011-02-06  Bruno Haible  <bruno@clisp.org>
+
+       New module 'wcsncasecmp'.
+       * modules/wcsncasecmp: New file.
+       * lib/wchar.in.h (wcsncasecmp): New declaration.
+       * lib/wcsncasecmp.c: New file.
+       * lib/wcsncasecmp-impl.h: New file, from libutf8 with modifications.
+       * m4/wcsncasecmp.m4: New file.
+       * m4/wchar_h.m4 (gl_WCHAR_H): Test whether wcsncasecmp is declared.
+       (gl_WCHAR_H_DEFAULTS): Initialize GNULIB_WCSNCASECMP, HAVE_WCSNCASECMP.
+       * modules/wchar (Makefile.am): Substitute GNULIB_WCSNCASECMP,
+       HAVE_WCSNCASECMP.
+       * tests/test-wchar-c++.cc: Test the declaration of wcsncasecmp.
+       * doc/posix-functions/wcsncasecmp.texi: Mention the new module.
+
+2011-02-06  Bruno Haible  <bruno@clisp.org>
+
+       New module 'wcscasecmp'.
+       * modules/wcscasecmp: New file.
+       * lib/wchar.in.h (wcscasecmp): New declaration.
+       * lib/wcscasecmp.c: New file.
+       * lib/wcscasecmp-impl.h: New file, from libutf8 with modifications.
+       * m4/wcscasecmp.m4: New file.
+       * m4/wchar_h.m4 (gl_WCHAR_H): Test whether wcscasecmp is declared.
+       (gl_WCHAR_H_DEFAULTS): Initialize GNULIB_WCSCASECMP, HAVE_WCSCASECMP.
+       * modules/wchar (Makefile.am): Substitute GNULIB_WCSCASECMP,
+       HAVE_WCSCASECMP.
+       * tests/test-wchar-c++.cc: Test the declaration of wcscasecmp.
+       * doc/posix-functions/wcscasecmp.texi: Mention the new module.
+
+2011-02-05  Bruno Haible  <bruno@clisp.org>
+
+       New module 'wcsncmp'.
+       * modules/wcsncmp: New file.
+       * lib/wchar.in.h (wcsncmp): New declaration.
+       * lib/wcsncmp.c: New file.
+       * lib/wcsncmp-impl.h: New file, from libutf8 with modifications.
+       * m4/wcsncmp.m4: New file.
+       * m4/wchar_h.m4 (gl_WCHAR_H): Test whether wcsncmp is declared.
+       (gl_WCHAR_H_DEFAULTS): Initialize GNULIB_WCSNCMP, HAVE_WCSNCMP.
+       * modules/wchar (Makefile.am): Substitute GNULIB_WCSNCMP, HAVE_WCSNCMP.
+       * tests/test-wchar-c++.cc: Test the declaration of wcsncmp.
+       * doc/posix-functions/wcsncmp.texi: Mention the new module.
+
+2011-02-05  Bruno Haible  <bruno@clisp.org>
+
+       New module 'wcscmp'.
+       * modules/wcscmp: New file.
+       * lib/wchar.in.h (wcscmp): New declaration.
+       * lib/wcscmp.c: New file.
+       * lib/wcscmp-impl.h: New file, from libutf8 with modifications.
+       * m4/wcscmp.m4: New file.
+       * m4/wchar_h.m4 (gl_WCHAR_H): Test whether wcscmp is declared.
+       (gl_WCHAR_H_DEFAULTS): Initialize GNULIB_WCSCMP, HAVE_WCSCMP.
+       * modules/wchar (Makefile.am): Substitute GNULIB_WCSCMP, HAVE_WCSCMP.
+       * tests/test-wchar-c++.cc: Test the declaration of wcscmp.
+       * doc/posix-functions/wcscmp.texi: Mention the new module.
+
+2011-02-05  Bruno Haible  <bruno@clisp.org>
+
+       New module 'wcsncat'.
+       * modules/wcsncat: New file.
+       * lib/wchar.in.h (wcsncat): New declaration.
+       * lib/wcsncat.c: New file.
+       * lib/wcsncat-impl.h: New file, from libutf8 with modifications.
+       * m4/wcsncat.m4: New file.
+       * m4/wchar_h.m4 (gl_WCHAR_H): Test whether wcsncat is declared.
+       (gl_WCHAR_H_DEFAULTS): Initialize GNULIB_WCSNCAT, HAVE_WCSNCAT.
+       * modules/wchar (Makefile.am): Substitute GNULIB_WCSNCAT, HAVE_WCSNCAT.
+       * tests/test-wchar-c++.cc: Test the declaration of wcsncat.
+       * doc/posix-functions/wcsncat.texi: Mention the new module.
+
+2011-02-05  Bruno Haible  <bruno@clisp.org>
+
+       New module 'wcscat'.
+       * modules/wcscat: New file.
+       * lib/wchar.in.h (wcscat): New declaration.
+       * lib/wcscat.c: New file.
+       * lib/wcscat-impl.h: New file, from libutf8 with modifications.
+       * m4/wcscat.m4: New file.
+       * m4/wchar_h.m4 (gl_WCHAR_H): Test whether wcscat is declared.
+       (gl_WCHAR_H_DEFAULTS): Initialize GNULIB_WCSCAT, HAVE_WCSCAT.
+       * modules/wchar (Makefile.am): Substitute GNULIB_WCSCAT, HAVE_WCSCAT.
+       * tests/test-wchar-c++.cc: Test the declaration of wcscat.
+       * doc/posix-functions/wcscat.texi: Mention the new module.
+
+2011-02-05  Bruno Haible  <bruno@clisp.org>
+
+       New module 'wcpncpy'.
+       * modules/wcpncpy: New file.
+       * lib/wchar.in.h (wcpncpy): New declaration.
+       * lib/wcpncpy.c: New file.
+       * lib/wcpncpy-impl.h: New file, from libutf8 with modifications.
+       * m4/wcpncpy.m4: New file.
+       * m4/wchar_h.m4 (gl_WCHAR_H): Test whether wcpncpy is declared.
+       (gl_WCHAR_H_DEFAULTS): Initialize GNULIB_WCPNCPY, HAVE_WCPNCPY.
+       * modules/wchar (Makefile.am): Substitute GNULIB_WCPNCPY, HAVE_WCPNCPY.
+       * tests/test-wchar-c++.cc: Test the declaration of wcpncpy.
+       * doc/posix-functions/wcpncpy.texi: Mention the new module.
+
+2011-02-05  Bruno Haible  <bruno@clisp.org>
+
+       New module 'wcsncpy'.
+       * modules/wcsncpy: New file.
+       * lib/wchar.in.h (wcsncpy): New declaration.
+       * lib/wcsncpy.c: New file.
+       * lib/wcsncpy-impl.h: New file, from libutf8 with modifications.
+       * m4/wcsncpy.m4: New file.
+       * m4/wchar_h.m4 (gl_WCHAR_H): Test whether wcsncpy is declared.
+       (gl_WCHAR_H_DEFAULTS): Initialize GNULIB_WCSNCPY, HAVE_WCSNCPY.
+       * modules/wchar (Makefile.am): Substitute GNULIB_WCSNCPY, HAVE_WCSNCPY.
+       * tests/test-wchar-c++.cc: Test the declaration of wcsncpy.
+       * doc/posix-functions/wcsncpy.texi: Mention the new module.
+
+2011-02-05  Bruno Haible  <bruno@clisp.org>
+
+       New module 'wcpcpy'.
+       * modules/wcpcpy: New file.
+       * lib/wchar.in.h (wcpcpy): New declaration.
+       * lib/wcpcpy.c: New file.
+       * lib/wcpcpy-impl.h: New file, from libutf8 with modifications.
+       * m4/wcpcpy.m4: New file.
+       * m4/wchar_h.m4 (gl_WCHAR_H): Test whether wcpcpy is declared.
+       (gl_WCHAR_H_DEFAULTS): Initialize GNULIB_WCPCPY, HAVE_WCPCPY.
+       * modules/wchar (Makefile.am): Substitute GNULIB_WCPCPY, HAVE_WCPCPY.
+       * tests/test-wchar-c++.cc: Test the declaration of wcpcpy.
+       * doc/posix-functions/wcpcpy.texi: Mention the new module.
+
+2011-02-05  Bruno Haible  <bruno@clisp.org>
+
+       New module 'wcscpy'.
+       * modules/wcscpy: New file.
+       * lib/wchar.in.h (wcscpy): New declaration.
+       * lib/wcscpy.c: New file.
+       * lib/wcscpy-impl.h: New file, from libutf8 with modifications.
+       * m4/wcscpy.m4: New file.
+       * m4/wchar_h.m4 (gl_WCHAR_H): Test whether wcscpy is declared.
+       (gl_WCHAR_H_DEFAULTS): Initialize GNULIB_WCSCPY, HAVE_WCSCPY.
+       * modules/wchar (Makefile.am): Substitute GNULIB_WCSCPY, HAVE_WCSCPY.
+       * tests/test-wchar-c++.cc: Test the declaration of wcscpy.
+       * doc/posix-functions/wcscpy.texi: Mention the new module.
+
+2011-02-05  Bruno Haible  <bruno@clisp.org>
+
+       New module 'wcsnlen'.
+       * modules/wcsnlen: New file.
+       * lib/wchar.in.h (wcsnlen): New declaration.
+       * lib/wcsnlen.c: New file.
+       * lib/wcsnlen-impl.h: New file, from libutf8 with modifications.
+       * m4/wcsnlen.m4: New file.
+       * m4/wchar_h.m4 (gl_WCHAR_H): Test whether wcsnlen is declared.
+       (gl_WCHAR_H_DEFAULTS): Initialize GNULIB_WCSNLEN, HAVE_WCSNLEN.
+       * modules/wchar (Makefile.am): Substitute GNULIB_WCSNLEN, HAVE_WCSNLEN.
+       * tests/test-wchar-c++.cc: Test the declaration of wcsnlen.
+       * doc/posix-functions/wcsnlen.texi: Mention the new module.
+
+2011-02-05  Bruno Haible  <bruno@clisp.org>
+
+       New module 'wcslen'.
+       * modules/wcslen: New file.
+       * lib/wchar.in.h (wcslen): New declaration.
+       * lib/wcslen.c: New file.
+       * lib/wcslen-impl.h: New file, from libutf8 with modifications.
+       * m4/wcslen.m4: New file.
+       * m4/wchar_h.m4 (gl_WCHAR_H): Test whether wcslen is declared.
+       (gl_WCHAR_H_DEFAULTS): Initialize GNULIB_WCSLEN, HAVE_WCSLEN.
+       * modules/wchar (Makefile.am): Substitute GNULIB_WCSLEN, HAVE_WCSLEN.
+       * tests/test-wchar-c++.cc: Test the declaration of wcslen.
+       * doc/posix-functions/wcslen.texi: Mention the new module.
+
+2011-02-05  Bruno Haible  <bruno@clisp.org>
+
+       New module 'wmemset'.
+       * modules/wmemset: New file.
+       * lib/wchar.in.h (wmemset): New declaration.
+       * lib/wmemset.c: New file.
+       * lib/wmemset-impl.h: New file, from libutf8 with modifications.
+       * m4/wmemset.m4: New file.
+       * m4/wchar_h.m4 (gl_WCHAR_H): Test whether wmemset is declared.
+       (gl_WCHAR_H_DEFAULTS): Initialize GNULIB_WMEMSET, HAVE_WMEMSET.
+       * modules/wchar (Makefile.am): Substitute GNULIB_WMEMSET, HAVE_WMEMSET.
+       * tests/test-wchar-c++.cc: Test the declaration of wmemset.
+       * doc/posix-functions/wmemset.texi: Mention the new module.
+
+2011-02-05  Bruno Haible  <bruno@clisp.org>
+
+       New module 'wmemmove'.
+       * modules/wmemmove: New file.
+       * lib/wchar.in.h (wmemmove): New declaration.
+       * lib/wmemmove.c: New file.
+       * lib/wmemmove-impl.h: New file, from libutf8 with modifications.
+       * m4/wmemmove.m4: New file.
+       * m4/wchar_h.m4 (gl_WCHAR_H): Test whether wmemmove is declared.
+       (gl_WCHAR_H_DEFAULTS): Initialize GNULIB_WMEMMOVE, HAVE_WMEMMOVE.
+       * modules/wchar (Makefile.am): Substitute GNULIB_WMEMMOVE,
+       HAVE_WMEMMOVE.
+       * tests/test-wchar-c++.cc: Test the declaration of wmemmove.
+       * doc/posix-functions/wmemmove.texi: Mention the new module.
+
+2011-02-05  Bruno Haible  <bruno@clisp.org>
+
+       New module 'wmemcpy'.
+       * modules/wmemcpy: New file.
+       * lib/wchar.in.h (wmemcpy): New declaration.
+       * lib/wmemcpy.c: New file.
+       * lib/wmemcpy-impl.h: New file, from libutf8 with modifications.
+       * m4/wmemcpy.m4: New file.
+       * m4/wchar_h.m4 (gl_WCHAR_H): Test whether wmemcpy is declared.
+       (gl_WCHAR_H_DEFAULTS): Initialize GNULIB_WMEMCPY, HAVE_WMEMCPY.
+       * modules/wchar (Makefile.am): Substitute GNULIB_WMEMCPY, HAVE_WMEMCPY.
+       * tests/test-wchar-c++.cc: Test the declaration of wmemcpy.
+       * doc/posix-functions/wmemcpy.texi: Mention the new module.
+
+2011-02-05  Bruno Haible  <bruno@clisp.org>
+
+       New module 'wmemcmp'.
+       * modules/wmemcmp: New file.
+       * lib/wchar.in.h (wmemcmp): New declaration.
+       * lib/wmemcmp.c: New file.
+       * lib/wmemcmp-impl.h: New file, from libutf8 with modifications.
+       * m4/wmemcmp.m4: New file.
+       * m4/wchar_h.m4 (gl_WCHAR_H): Test whether wmemcmp is declared.
+       (gl_WCHAR_H_DEFAULTS): Initialize GNULIB_WMEMCMP, HAVE_WMEMCMP.
+       * modules/wchar (Makefile.am): Substitute GNULIB_WMEMCMP, HAVE_WMEMCMP.
+       * tests/test-wchar-c++.cc: Test the declaration of wmemcmp.
+       * doc/posix-functions/wmemcmp.texi: Mention the new module.
+
+2011-02-07  Jim Meyering  <meyering@redhat.com>
+
+       di-set, ino-map: new modules, from coreutils
+       * lib/di-set.c: New file.
+       * lib/di-set.h: Likewise.
+       * lib/ino-map.c: Likewise.
+       * lib/ino-map.h: Likewise.
+       * modules/di-set: Likewise.
+       * modules/di-set-tests: Likewise.
+       * modules/ino-map: Likewise.
+       * modules/ino-map-tests: Likewise.
+       * tests/test-di-set.c: Likewise.
+       * tests/test-ino-map.c: Likewise.
+
+2011-02-06  Paul Eggert  <eggert@cs.ucla.edu>
+
+       getloadavg: merge minor changes from Emacs
+
+       * lib/getloadavg.c (getloadavg_initialized): More-accurate comment.
+       (getloadavg): Use memset, not bzero.
+
+       2008-07-25  Chong Yidong  <cyd@stupidchicken.com>
+       * lib/getloadavg.c (nl): Rename to name_list to avoid ncurses.h
+       clash (bug#86).
+
+2010-11-14  Bruno Haible  <bruno@clisp.org>
+
+       Allow multiple gnulib generated replacements to coexist.
+       * lib/getopt.in.h (struct option): Avoid identical redefinition.
+       * lib/inttypes.in.h (imaxdiv_t): Likewise.
+       * lib/langinfo.in.h (nl_item): Likewise.
+       * lib/math.in.h (_NaN, NAN): Likewise.
+       * lib/netdb.in.h (struct addrinfo): Likewise.
+       * lib/poll.in.h (struct pollfd, nfds_t): Likewise.
+       * lib/pthread.in.h (pthread_t, pthread_attr_t, pthread_barrier_t,
+       pthread_barrierattr_t, pthread_cond_t, pthread_condattr_t,
+       pthread_key_t, pthread_mutex_t, pthread_mutexattr_t, pthread_once_t,
+       pthread_rwlock_t, pthread_rwlockattr_t, pthread_cond_destroy,
+       pthread_cond_init, pthread_cond_signal, pthread_cond_wait,
+       pthread_create, pthread_exit, pthread_join, pthread_mutexattr_destroy,
+       pthread_mutexattr_init, pthread_mutexattr_settype,
+       pthread_mutex_destroy, pthread_mutex_init, pthread_mutex_lock,
+       pthread_mutex_trylock, pthread_mutex_unlock, pthread_spinlock_t,
+       pthread_spin_init, pthread_spin_destroy, pthread_spin_lock,
+       pthread_spin_trylock, pthread_spin_unlock): Likewise.
+       * lib/sched.in.h (struct sched_param): Likewise.
+       * lib/se-selinux.in.h (security_class_t, security_context_t,
+       is_selinux_enabled, getcon, freecon, getfscreatecon, setfscreatecon,
+       matchpathcon, getfilecon, lgetfilecon, fgetfilecon, setfilecon,
+       lsetfilecon, fsetfilecon, security_check_context,
+       security_check_context_raw, setexeccon, matchpathcon_init_prefix):
+       Likewise.
+       * lib/search.in.h (VISIT, _gl_search_compar_fn, _gl_search_action_fn):
+       Likewise.
+       * lib/signal.in.h (sig_atomic_t, sigset_t, verify_NSIG_constraint,
+       _gl_function_taking_int_returning_void_t, union sigval,
+       struct siginfo_t, siginfo_t, struct sigaction): Likewise.
+       * lib/spawn.in.h (posix_spawnattr_t, posix_spawn_file_actions_t,
+       verify_POSIX_SPAWN_USEVFORK_no_overlap): Likewise.
+       * lib/stdint.in.h (gl_int8_t, gl_uint8_t, gl_int16_t, gl_uint16_t,
+       gl_int32_t, gl_uint32_t, gl_int64_t, gl_uint64_t, int_least8_t,
+       uint_least8_t, int_least16_t, uint_least16_t, int_least32_t,
+       uint_least32_t, int_least64_t, uint_least64_t, gl_int_fast8_t,
+       gl_uint_fast8_t, gl_int_fast16_t, gl_uint_fast16_t, gl_int_fast32_t,
+       gl_uint_fast32_t, int_fast64_t, uint_fast64_t, gl_intptr_t,
+       gl_uintptr_t, intmax_t, uintmax_t, _verify_intmax_size): Likewise.
+       * lib/stdio.in.h (rpl_fseek, rpl_ftell): Likewise.
+       * lib/sys_socket.in.h (sa_family_t, struct sockaddr_storage,
+       socklen_t, rpl_fd_isset): Likewise.
+       * lib/sys_stat.in.h (rpl_mkdir): Likewise.
+       * lib/sys_time.in.h (struct timeval): Likewise.
+       * lib/sys_times.in.h (struct tms): Likewise.
+       * lib/sys_utsname.in.h (struct utsname):
+       * lib/time.in.h (struct timespec, __time_t_must_be_integral): Likewise.
+       * lib/unistd.in.h (getpagesize): Likewise.
+       * lib/wchar.in.h (mbstate_t): Likewise.
+       * lib/wctype.in.h (iswalnum, iswalpha, iswblank, iswcntrl, iswdigit,
+       iswgraph, iswlower, iswprint, iswpunct, iswspace, iswupper, iswxdigit,
+       towlower, towupper): Likewise.
+       Reported by Sam Steingold <sds@gnu.org>.
+
+2011-02-05  Eric Blake  <eblake@redhat.com>
+
+       unsetenv: work around Haiku issues
+       * m4/setenv.m4 (gl_FUNC_UNSETENV): Also detect Haiku issue.
+       * doc/posix-functions/unsetenv.texi (unsetenv): Document it.
+
+2010-12-30  Bruce Korb  <bkorb@gnu.org>
+
+       libposix: avoid calling error() within libposix
+       * lib/openat-die.c: remove error module stuff when GNULIB_LIBPOSIX
+       is defined.
+
+2011-02-05  Eric Blake  <eblake@redhat.com>
+
+       strerror_r-posix: port to cygwin
+       * lib/strerror_r.c (strerror_r) [__CYGWIN__]: Add cygwin
+       implementation.
+       * m4/strerror_r.m4 (gl_FUNC_STRERROR_R): Adjust comment.
+       * tests/test-strerror_r.c (main): Fix test.
+       * doc/posix-functions/strerror_r.texi (strerror_r): Document the
+       issue.
+
+2011-02-05  Bruno Haible  <bruno@clisp.org>
+
+       New module 'wmemchr'.
+       * modules/wmemchr: New file.
+       * lib/wchar.in.h (wmemchr): New declaration.
+       * lib/wmemchr.c: New file.
+       * lib/wmemchr-impl.h: New file, from libutf8 with modifications.
+       * m4/wmemchr.m4: New file.
+       * m4/wchar_h.m4 (gl_WCHAR_H): Test whether wmemchr is declared.
+       (gl_WCHAR_H_DEFAULTS): Initialize GNULIB_WMEMCHR, HAVE_WMEMCHR.
+       * modules/wchar (Makefile.am): Substitute GNULIB_WMEMCHR, HAVE_WMEMCHR.
+       * tests/test-wchar-c++.cc: Test the declaration of wmemchr.
+       * doc/posix-functions/wmemchr.texi: Mention the new module.
+
+2011-02-04  Eric Blake  <eblake@redhat.com>
+
+       fdopendir: detect FreeBSD bug
+       * m4/fdopendir.m4 (gl_FUNC_FDOPENDIR): Detect bug.
+       * doc/posix-functions/fdopendir.texi (fdopendir): Document it.
+
+2011-02-04  Paul Eggert  <eggert@cs.ucla.edu>
+
+       stdbool: do not define HAVE_STDBOOL_H
+       * m4/stdbool.m4 (AC_CHECK_HEADER_STDBOOL): Renamed from
+       AC_HEADER_STDBOOL.  All uses changed.  Do not define
+       HAVE_STDBOOL_H, as gnulib does not need this.  This change is
+       imported from the latest Autoconf git.  It was motivated by Emacs,
+       which uses gnulib but does not need HAVE_STDBOOL_H.
+
+2011-02-04  Bruno Haible  <bruno@clisp.org>
+
+       wcsnrtombs: Prepare for new module wwcsnrtombs.
+       * lib/wcsnrtombs-impl.h: New file, extracted from lib/wcsnrtombs.c.
+       * lib/wcsnrtombs.c: Include it.
+       * modules/wcsnrtombs (Files): Add lib/wcsnrtombs-impl.h.
+
+       wcsrtombs: Prepare for new module wwcsrtombs.
+       * lib/wcsrtombs-impl.h: New file, extracted from lib/wcsrtombs.c.
+       * lib/wcsrtombs.c: Include it.
+       * modules/wcsrtombs (Files): Add lib/wcsrtombs-impl.h.
+
+       mbsnrtowcs: Prepare for new module mbsnrtowwcs.
+       * lib/mbsnrtowcs-impl.h: New file, extracted from lib/mbsnrtowcs.c.
+       * lib/mbsnrtowcs.c: Include it.
+       * modules/mbsnrtowcs (Files): Add lib/mbsnrtowcs-impl.h.
+
+       mbsrtowcs: Prepare for new module mbsrtowwcs.
+       * lib/mbsrtowcs-impl.h: New file, extracted from lib/mbsrtowcs.c.
+       * lib/mbsrtowcs.c: Include it.
+       * modules/mbsrtowcs (Files): Add lib/mbsrtowcs-impl.h.
+
+2011-02-04  Bruno Haible  <bruno@clisp.org>
+
+       vasnprintf: Reduce use of malloc for small format strings.
+       * lib/printf-args.h (N_DIRECT_ALLOC_ARGUMENTS): New macro.
+       (arguments): Add room for the first 7 arguments.
+       * lib/printf-parse.h (N_DIRECT_ALLOC_DIRECTIVES): New macro.
+       (char_directives, u8_directives, u16_directives, u32_directives): Add
+       room for the first 7 directives.
+       * lib/printf-parse.c: Include <string.h>.
+       (PRINTF_PARSE): Change memory handling code so that it uses the first
+       7 preallocated elements in an 'arguments' or 'DIRECTIVES' struct.
+       * lib/vasnprintf.c (VASNPRINTF): Update memory handling code.
+       Reported by Pádraig Brady <P@draigbrady.com>.
+
 2011-01-31  Eric Blake  <eblake@redhat.com>
 
        dup2: work around Haiku bug
        indirectly on xalloc.  This change causes the openat substitute
        to fall back on save_cwd when memory is tight, and for save_cwd to
        fail instead of dying when memory is tight, but that's good enough.
+       Problem and initial idea for fix reported by Bastien Roucaries in
+       <http://lists.gnu.org/archive/html/bug-gnulib/2011-01/msg00170.html>.
 
        * lib/openat-proc.c: Include stdlib.h (for malloc), not
        xalloc.h (for xmalloc).
diff --git a/NEWS b/NEWS
index 40fa082..13197f7 100644 (file)
--- a/NEWS
+++ b/NEWS
@@ -12,6 +12,12 @@ User visible incompatible changes
 
 Date        Modules         Changes
 
+2011-02-08  wctype-h        This module no longer provides the iswblank()
+                            function. If you need this function, you now need
+                            to request the 'iswblank' module.
+
+2011-02-07  wctype          This module is renamed to wctype-h.
+
 2011-01-18  multiarch       This no longer #defines AA_APPLE_UNIVERSAL_BUILD;
                             instead, use the shell var APPLE_UNIVERSAL_BUILD.
 
index 78553c4..187cd54 100755 (executable)
@@ -4,7 +4,7 @@
 #   2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010,
 #   2011 Free Software Foundation, Inc.
 
-timestamp='2011-01-23'
+timestamp='2011-02-02'
 
 # 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
@@ -181,7 +181,7 @@ case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in
                fi
                ;;
            *)
-               os=netbsd
+               os=netbsd
                ;;
        esac
        # The OS release
@@ -224,7 +224,7 @@ case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in
                UNAME_RELEASE=`/usr/sbin/sizer -v | awk '{print $3}'`
                ;;
        *5.*)
-               UNAME_RELEASE=`/usr/sbin/sizer -v | awk '{print $4}'`
+               UNAME_RELEASE=`/usr/sbin/sizer -v | awk '{print $4}'`
                ;;
        esac
        # According to Compaq, /usr/sbin/psrinfo has been available on
@@ -299,7 +299,7 @@ case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in
        echo s390-ibm-zvmoe
        exit ;;
     *:OS400:*:*)
-        echo powerpc-ibm-os400
+       echo powerpc-ibm-os400
        exit ;;
     arm:RISC*:1.[012]*:*|arm:riscix:1.[012]*:*)
        echo arm-acorn-riscix${UNAME_RELEASE}
@@ -398,23 +398,23 @@ case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in
     # MiNT.  But MiNT is downward compatible to TOS, so this should
     # be no problem.
     atarist[e]:*MiNT:*:* | atarist[e]:*mint:*:* | atarist[e]:*TOS:*:*)
-        echo m68k-atari-mint${UNAME_RELEASE}
+       echo m68k-atari-mint${UNAME_RELEASE}
        exit ;;
     atari*:*MiNT:*:* | atari*:*mint:*:* | atarist[e]:*TOS:*:*)
        echo m68k-atari-mint${UNAME_RELEASE}
-        exit ;;
+       exit ;;
     *falcon*:*MiNT:*:* | *falcon*:*mint:*:* | *falcon*:*TOS:*:*)
-        echo m68k-atari-mint${UNAME_RELEASE}
+       echo m68k-atari-mint${UNAME_RELEASE}
        exit ;;
     milan*:*MiNT:*:* | milan*:*mint:*:* | *milan*:*TOS:*:*)
-        echo m68k-milan-mint${UNAME_RELEASE}
-        exit ;;
+       echo m68k-milan-mint${UNAME_RELEASE}
+       exit ;;
     hades*:*MiNT:*:* | hades*:*mint:*:* | *hades*:*TOS:*:*)
-        echo m68k-hades-mint${UNAME_RELEASE}
-        exit ;;
+       echo m68k-hades-mint${UNAME_RELEASE}
+       exit ;;
     *:*MiNT:*:* | *:*mint:*:* | *:*TOS:*:*)
-        echo m68k-unknown-mint${UNAME_RELEASE}
-        exit ;;
+       echo m68k-unknown-mint${UNAME_RELEASE}
+       exit ;;
     m68k:machten:*:*)
        echo m68k-apple-machten${UNAME_RELEASE}
        exit ;;
@@ -484,8 +484,8 @@ EOF
        echo m88k-motorola-sysv3
        exit ;;
     AViiON:dgux:*:*)
-        # DG/UX returns AViiON for all architectures
-        UNAME_PROCESSOR=`/usr/bin/uname -p`
+       # DG/UX returns AViiON for all architectures
+       UNAME_PROCESSOR=`/usr/bin/uname -p`
        if [ $UNAME_PROCESSOR = mc88100 ] || [ $UNAME_PROCESSOR = mc88110 ]
        then
            if [ ${TARGET_BINARY_INTERFACE}x = m88kdguxelfx ] || \
@@ -498,7 +498,7 @@ EOF
        else
            echo i586-dg-dgux${UNAME_RELEASE}
        fi
-       exit ;;
+       exit ;;
     M88*:DolphinOS:*:*)        # DolphinOS (SVR3)
        echo m88k-dolphin-sysv3
        exit ;;
@@ -598,52 +598,52 @@ EOF
            9000/[678][0-9][0-9])
                if [ -x /usr/bin/getconf ]; then
                    sc_cpu_version=`/usr/bin/getconf SC_CPU_VERSION 2>/dev/null`
-                    sc_kernel_bits=`/usr/bin/getconf SC_KERNEL_BITS 2>/dev/null`
-                    case "${sc_cpu_version}" in
-                      523) HP_ARCH="hppa1.0" ;; # CPU_PA_RISC1_0
-                      528) HP_ARCH="hppa1.1" ;; # CPU_PA_RISC1_1
-                      532)                      # CPU_PA_RISC2_0
-                        case "${sc_kernel_bits}" in
-                          32) HP_ARCH="hppa2.0n" ;;
-                          64) HP_ARCH="hppa2.0w" ;;
+                   sc_kernel_bits=`/usr/bin/getconf SC_KERNEL_BITS 2>/dev/null`
+                   case "${sc_cpu_version}" in
+                     523) HP_ARCH="hppa1.0" ;; # CPU_PA_RISC1_0
+                     528) HP_ARCH="hppa1.1" ;; # CPU_PA_RISC1_1
+                     532)                      # CPU_PA_RISC2_0
+                       case "${sc_kernel_bits}" in
+                         32) HP_ARCH="hppa2.0n" ;;
+                         64) HP_ARCH="hppa2.0w" ;;
                          '') HP_ARCH="hppa2.0" ;;   # HP-UX 10.20
-                        esac ;;
-                    esac
+                       esac ;;
+                   esac
                fi
                if [ "${HP_ARCH}" = "" ]; then
                    eval $set_cc_for_build
-                   sed 's/^              //' << EOF >$dummy.c
+                   sed 's/^            //' << EOF >$dummy.c
 
-              #define _HPUX_SOURCE
-              #include <stdlib.h>
-              #include <unistd.h>
+               #define _HPUX_SOURCE
+               #include <stdlib.h>
+               #include <unistd.h>
 
-              int main ()
-              {
-              #if defined(_SC_KERNEL_BITS)
-                  long bits = sysconf(_SC_KERNEL_BITS);
-              #endif
-                  long cpu  = sysconf (_SC_CPU_VERSION);
+               int main ()
+               {
+               #if defined(_SC_KERNEL_BITS)
+                   long bits = sysconf(_SC_KERNEL_BITS);
+               #endif
+                   long cpu  = sysconf (_SC_CPU_VERSION);
 
-                  switch (cpu)
-               {
-               case CPU_PA_RISC1_0: puts ("hppa1.0"); break;
-               case CPU_PA_RISC1_1: puts ("hppa1.1"); break;
-               case CPU_PA_RISC2_0:
-              #if defined(_SC_KERNEL_BITS)
-                   switch (bits)
-                       {
-                       case 64: puts ("hppa2.0w"); break;
-                       case 32: puts ("hppa2.0n"); break;
-                       default: puts ("hppa2.0"); break;
-                       } break;
-              #else  /* !defined(_SC_KERNEL_BITS) */
-                   puts ("hppa2.0"); break;
-              #endif
-               default: puts ("hppa1.0"); break;
-               }
-                  exit (0);
-              }
+                   switch (cpu)
+                       {
+                       case CPU_PA_RISC1_0: puts ("hppa1.0"); break;
+                       case CPU_PA_RISC1_1: puts ("hppa1.1"); break;
+                       case CPU_PA_RISC2_0:
+               #if defined(_SC_KERNEL_BITS)
+                           switch (bits)
+                               {
+                               case 64: puts ("hppa2.0w"); break;
+                               case 32: puts ("hppa2.0n"); break;
+                               default: puts ("hppa2.0"); break;
+                               } break;
+               #else  /* !defined(_SC_KERNEL_BITS) */
+                           puts ("hppa2.0"); break;
+               #endif
+                       default: puts ("hppa1.0"); break;
+                       }
+                   exit (0);
+               }
 EOF
                    (CCOPTS= $CC_FOR_BUILD -o $dummy $dummy.c 2>/dev/null) && HP_ARCH=`$dummy`
                    test -z "$HP_ARCH" && HP_ARCH=hppa
@@ -734,22 +734,22 @@ EOF
        exit ;;
     C1*:ConvexOS:*:* | convex:ConvexOS:C1*:*)
        echo c1-convex-bsd
-        exit ;;
+       exit ;;
     C2*:ConvexOS:*:* | convex:ConvexOS:C2*:*)
        if getsysinfo -f scalar_acc
        then echo c32-convex-bsd
        else echo c2-convex-bsd
        fi
-        exit ;;
+       exit ;;
     C34*:ConvexOS:*:* | convex:ConvexOS:C34*:*)
        echo c34-convex-bsd
-        exit ;;
+       exit ;;
     C38*:ConvexOS:*:* | convex:ConvexOS:C38*:*)
        echo c38-convex-bsd
-        exit ;;
+       exit ;;
     C4*:ConvexOS:*:* | convex:ConvexOS:C4*:*)
        echo c4-convex-bsd
-        exit ;;
+       exit ;;
     CRAY*Y-MP:*:*:*)
        echo ymp-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/'
        exit ;;
@@ -773,14 +773,14 @@ EOF
        exit ;;
     F30[01]:UNIX_System_V:*:* | F700:UNIX_System_V:*:*)
        FUJITSU_PROC=`uname -m | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'`
-        FUJITSU_SYS=`uname -p | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/\///'`
-        FUJITSU_REL=`echo ${UNAME_RELEASE} | sed -e 's/ /_/'`
-        echo "${FUJITSU_PROC}-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}"
-        exit ;;
+       FUJITSU_SYS=`uname -p | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/\///'`
+       FUJITSU_REL=`echo ${UNAME_RELEASE} | sed -e 's/ /_/'`
+       echo "${FUJITSU_PROC}-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}"
+       exit ;;
     5000:UNIX_System_V:4.*:*)
-        FUJITSU_SYS=`uname -p | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/\///'`
-        FUJITSU_REL=`echo ${UNAME_RELEASE} | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/ /_/'`
-        echo "sparc-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}"
+       FUJITSU_SYS=`uname -p | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/\///'`
+       FUJITSU_REL=`echo ${UNAME_RELEASE} | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/ /_/'`
+       echo "sparc-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}"
        exit ;;
     i*86:BSD/386:*:* | i*86:BSD/OS:*:* | *:Ascend\ Embedded/OS:*:*)
        echo ${UNAME_MACHINE}-pc-bsdi${UNAME_RELEASE}
@@ -808,14 +808,14 @@ EOF
        echo ${UNAME_MACHINE}-pc-mingw32
        exit ;;
     i*:windows32*:*)
-       # uname -m includes "-pc" on this system.
-       echo ${UNAME_MACHINE}-mingw32
+       # uname -m includes "-pc" on this system.
+       echo ${UNAME_MACHINE}-mingw32
        exit ;;
     i*:PW*:*)
        echo ${UNAME_MACHINE}-pc-pw32
        exit ;;
     *:Interix*:*)
-       case ${UNAME_MACHINE} in
+       case ${UNAME_MACHINE} in
            x86)
                echo i586-pc-interix${UNAME_RELEASE}
                exit ;;
@@ -870,7 +870,7 @@ EOF
          EV6)   UNAME_MACHINE=alphaev6 ;;
          EV67)  UNAME_MACHINE=alphaev67 ;;
          EV68*) UNAME_MACHINE=alphaev68 ;;
-        esac
+       esac
        objdump --private-headers /bin/sh | grep -q ld.so.1
        if test "$?" = 0 ; then LIBC="libc1" ; else LIBC="" ; fi
        echo ${UNAME_MACHINE}-unknown-linux-gnu${LIBC}
@@ -895,7 +895,7 @@ EOF
        echo crisv32-axis-linux-gnu
        exit ;;
     frv:Linux:*:*)
-       echo frv-unknown-linux-gnu
+       echo frv-unknown-linux-gnu
        exit ;;
     i*86:Linux:*:*)
        LIBC=gnu
@@ -963,7 +963,7 @@ EOF
        echo ${UNAME_MACHINE}-ibm-linux
        exit ;;
     sh64*:Linux:*:*)
-       echo ${UNAME_MACHINE}-unknown-linux-gnu
+       echo ${UNAME_MACHINE}-unknown-linux-gnu
        exit ;;
     sh*:Linux:*:*)
        echo ${UNAME_MACHINE}-unknown-linux-gnu
@@ -981,7 +981,7 @@ EOF
        echo x86_64-unknown-linux-gnu
        exit ;;
     xtensa*:Linux:*:*)
-       echo ${UNAME_MACHINE}-unknown-linux-gnu
+       echo ${UNAME_MACHINE}-unknown-linux-gnu
        exit ;;
     i*86:DYNIX/ptx:4*:*)
        # ptx 4.0 does uname -s correctly, with DYNIX/ptx in there.
@@ -990,11 +990,11 @@ EOF
        echo i386-sequent-sysv4
        exit ;;
     i*86:UNIX_SV:4.2MP:2.*)
-        # Unixware is an offshoot of SVR4, but it has its own version
-        # number series starting with 2...
-        # I am not positive that other SVR4 systems won't match this,
+       # Unixware is an offshoot of SVR4, but it has its own version
+       # number series starting with 2...
+       # I am not positive that other SVR4 systems won't match this,
        # I just have to hope.  -- rms.
-        # Use sysv4.2uw... so that sysv4* matches it.
+       # Use sysv4.2uw... so that sysv4* matches it.
        echo ${UNAME_MACHINE}-pc-sysv4.2uw${UNAME_VERSION}
        exit ;;
     i*86:OS/2:*:*)
@@ -1026,7 +1026,7 @@ EOF
        fi
        exit ;;
     i*86:*:5:[678]*)
-       # UnixWare 7.x, OpenUNIX and OpenServer 6.
+       # UnixWare 7.x, OpenUNIX and OpenServer 6.
        case `/bin/uname -X | grep "^Machine"` in
            *486*)           UNAME_MACHINE=i486 ;;
            *Pentium)        UNAME_MACHINE=i586 ;;
@@ -1054,13 +1054,13 @@ EOF
        exit ;;
     pc:*:*:*)
        # Left here for compatibility:
-        # uname -m prints for DJGPP always 'pc', but it prints nothing about
-        # the processor, so we play safe by assuming i586.
+       # uname -m prints for DJGPP always 'pc', but it prints nothing about
+       # the processor, so we play safe by assuming i586.
        # Note: whatever this is, it MUST be the same as what config.sub
        # prints for the "djgpp" host, or else GDB configury will decide that
        # this is a cross-build.
        echo i586-pc-msdosdjgpp
-        exit ;;
+       exit ;;
     Intel:Mach:3*:*)
        echo i386-pc-mach3
        exit ;;
@@ -1095,8 +1095,8 @@ EOF
        /bin/uname -p 2>/dev/null | /bin/grep entium >/dev/null \
          && { echo i586-ncr-sysv4.3${OS_REL}; exit; } ;;
     3[34]??:*:4.0:* | 3[34]??,*:*:4.0:*)
-        /bin/uname -p 2>/dev/null | grep 86 >/dev/null \
-          && { echo i486-ncr-sysv4; exit; } ;;
+       /bin/uname -p 2>/dev/null | grep 86 >/dev/null \
+         && { echo i486-ncr-sysv4; exit; } ;;
     NCR*:*:4.2:* | MPRAS*:*:4.2:*)
        OS_REL='.3'
        test -r /etc/.relid \
@@ -1139,10 +1139,10 @@ EOF
                echo ns32k-sni-sysv
        fi
        exit ;;
-    PENTIUM:*:4.0*:*) # Unisys `ClearPath HMP IX 4000' SVR4/MP effort
-                      # says <Richard.M.Bartel@ccMail.Census.GOV>
-        echo i586-unisys-sysv4
-        exit ;;
+    PENTIUM:*:4.0*:*)  # Unisys `ClearPath HMP IX 4000' SVR4/MP effort
+                       # says <Richard.M.Bartel@ccMail.Census.GOV>
+       echo i586-unisys-sysv4
+       exit ;;
     *:UNIX_System_V:4*:FTX*)
        # From Gerald Hewes <hewes@openmarket.com>.
        # How about differentiating between stratus architectures? -djm
@@ -1168,11 +1168,11 @@ EOF
        exit ;;
     R[34]000:*System_V*:*:* | R4000:UNIX_SYSV:*:* | R*000:UNIX_SV:*:*)
        if [ -d /usr/nec ]; then
-               echo mips-nec-sysv${UNAME_RELEASE}
+               echo mips-nec-sysv${UNAME_RELEASE}
        else
-               echo mips-unknown-sysv${UNAME_RELEASE}
+               echo mips-unknown-sysv${UNAME_RELEASE}
        fi
-        exit ;;
+       exit ;;
     BeBox:BeOS:*:*)    # BeOS running on hardware made by Be, PPC only.
        echo powerpc-be-beos
        exit ;;
@@ -1285,13 +1285,13 @@ EOF
        echo pdp10-unknown-its
        exit ;;
     SEI:*:*:SEIUX)
-        echo mips-sei-seiux${UNAME_RELEASE}
+       echo mips-sei-seiux${UNAME_RELEASE}
        exit ;;
     *:DragonFly:*:*)
        echo ${UNAME_MACHINE}-unknown-dragonfly`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'`
        exit ;;
     *:*VMS:*:*)
-       UNAME_MACHINE=`(uname -p) 2>/dev/null`
+       UNAME_MACHINE=`(uname -p) 2>/dev/null`
        case "${UNAME_MACHINE}" in
            A*) echo alpha-dec-vms ; exit ;;
            I*) echo ia64-dec-vms ; exit ;;
@@ -1331,11 +1331,11 @@ main ()
 #include <sys/param.h>
   printf ("m68k-sony-newsos%s\n",
 #ifdef NEWSOS4
-          "4"
+       "4"
 #else
-         ""
+       ""
 #endif
-         ); exit (0);
+       ); exit (0);
 #endif
 #endif
 
index 2d81696..83da356 100755 (executable)
@@ -4,7 +4,7 @@
 #   2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010,
 #   2011 Free Software Foundation, Inc.
 
-timestamp='2011-01-01'
+timestamp='2011-02-02'
 
 # This file is (in principle) common to ALL GNU software.
 # The presence of a machine in this file suggests that SOME GNU software
@@ -158,8 +158,8 @@ case $os in
                os=
                basic_machine=$1
                ;;
-        -bluegene*)
-               os=-cnk
+       -bluegene*)
+               os=-cnk
                ;;
        -sim | -cisco | -oki | -wec | -winbond)
                os=
@@ -175,10 +175,10 @@ case $os in
                os=-chorusos
                basic_machine=$1
                ;;
-       -chorusrdb)
-               os=-chorusrdb
+       -chorusrdb)
+               os=-chorusrdb
                basic_machine=$1
-               ;;
+               ;;
        -hiux*)
                os=-hiuxwe2
                ;;
@@ -424,7 +424,7 @@ case $basic_machine in
                basic_machine=a29k-amd
                os=-udi
                ;;
-       abacus)
+       abacus)
                basic_machine=abacus-unknown
                ;;
        adobe68k)
@@ -507,7 +507,7 @@ case $basic_machine in
                basic_machine=c90-cray
                os=-unicos
                ;;
-        cegcc)
+       cegcc)
                basic_machine=arm-unknown
                os=-cegcc
                ;;
@@ -755,7 +755,7 @@ case $basic_machine in
                basic_machine=ns32k-utek
                os=-sysv
                ;;
-        microblaze)
+       microblaze)
                basic_machine=microblaze-xilinx
                ;;
        mingw32)
@@ -862,10 +862,10 @@ case $basic_machine in
        np1)
                basic_machine=np1-gould
                ;;
-        neo-tandem)
+       neo-tandem)
                basic_machine=neo-tandem
                ;;
-        nse-tandem)
+       nse-tandem)
                basic_machine=nse-tandem
                ;;
        nsr-tandem)
@@ -1102,8 +1102,8 @@ case $basic_machine in
                basic_machine=t90-cray
                os=-unicos
                ;;
-        # This must be matched before tile*.
-        tilegx*)
+       # This must be matched before tile*.
+       tilegx*)
                basic_machine=tilegx-unknown
                os=-linux-gnu
                ;;
@@ -1275,11 +1275,11 @@ esac
 if [ x"$os" != x"" ]
 then
 case $os in
-        # First match some system type aliases
-        # that might get confused with valid system types.
+       # First match some system type aliases
+       # that might get confused with valid system types.
        # -solaris* is a basic system type, with this one exception.
-        -auroraux)
-               os=-auroraux
+       -auroraux)
+               os=-auroraux
                ;;
        -solaris1 | -solaris1.*)
                os=`echo $os | sed -e 's|solaris1|sunos4|'`
@@ -1364,7 +1364,7 @@ case $os in
        -opened*)
                os=-openedition
                ;;
-        -os400*)
+       -os400*)
                os=-os400
                ;;
        -wince*)
@@ -1413,7 +1413,7 @@ case $os in
        -sinix*)
                os=-sysv4
                ;;
-        -tpf*)
+       -tpf*)
                os=-tpf
                ;;
        -triton*)
@@ -1458,8 +1458,8 @@ case $os in
        -dicos*)
                os=-dicos
                ;;
-        -nacl*)
-               ;;
+       -nacl*)
+               ;;
        -none)
                ;;
        *)
@@ -1482,10 +1482,10 @@ else
 # system, and we'll never get to this point.
 
 case $basic_machine in
-        score-*)
+       score-*)
                os=-elf
                ;;
-        spu-*)
+       spu-*)
                os=-elf
                ;;
        *-acorn)
@@ -1497,8 +1497,8 @@ case $basic_machine in
        arm*-semi)
                os=-aout
                ;;
-        c4x-* | tic4x-*)
-               os=-coff
+       c4x-* | tic4x-*)
+               os=-coff
                ;;
        tic54x-*)
                os=-coff
@@ -1534,7 +1534,7 @@ case $basic_machine in
        m68*-cisco)
                os=-aout
                ;;
-        mep-*)
+       mep-*)
                os=-elf
                ;;
        mips*-cisco)
@@ -1561,7 +1561,7 @@ case $basic_machine in
        *-ibm)
                os=-aix
                ;;
-       *-knuth)
+       *-knuth)
                os=-mmixware
                ;;
        *-wec)
index 94d7188..1fe8a18 100644 (file)
@@ -3,7 +3,7 @@
 % Load plain if necessary, i.e., if running under initex.
 \expandafter\ifx\csname fmtname\endcsname\relax\input plain\fi
 %
-\def\texinfoversion{2011-02-01.10}
+\def\texinfoversion{2011-02-07.16}
 %
 % Copyright 1985, 1986, 1988, 1990, 1991, 1992, 1993, 1994, 1995,
 % 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006,
@@ -8360,7 +8360,7 @@ directory should work if nowhere else does.}
   \gdef^^b9{$^1$}
   \gdef^^ba{\ordm}
   %
-  \gdef^^bb{\guilletright}
+  \gdef^^bb{\guillemetright}
   \gdef^^bc{$1\over4$}
   \gdef^^bd{$1\over2$}
   \gdef^^be{$3\over4$}
index 92f0a43..8b8a51e 100644 (file)
@@ -23,6 +23,10 @@ FreeBSD 7.3.
 This function does not reject non-directory file descriptors on some
 platforms:
 GNU/Hurd.
+@item
+This function mistakenly closes non-directory file descriptors on some
+platforms:
+FreeBSD 8.1.
 @end itemize
 
 Portability problems not fixed by Gnulib:
index 20612f4..154999d 100644 (file)
@@ -4,7 +4,7 @@
 
 POSIX specification:@* @url{http://www.opengroup.org/onlinepubs/9699919799/functions/iswalnum.html}
 
-Gnulib module: wctype
+Gnulib module: wctype-h
 
 Portability problems fixed by Gnulib:
 @itemize
index 7d69c2b..5046f3b 100644 (file)
@@ -4,7 +4,7 @@
 
 POSIX specification:@* @url{http://www.opengroup.org/onlinepubs/9699919799/functions/iswalpha.html}
 
-Gnulib module: wctype
+Gnulib module: wctype-h
 
 Portability problems fixed by Gnulib:
 @itemize
index 453558e..b36e69f 100644 (file)
@@ -4,7 +4,7 @@
 
 POSIX specification:@* @url{http://www.opengroup.org/onlinepubs/9699919799/functions/iswblank.html}
 
-Gnulib module: wctype
+Gnulib module: iswblank
 
 Portability problems fixed by Gnulib:
 @itemize
@@ -15,6 +15,9 @@ AIX 4.3.2, IRIX 6.5, OSF/1 5.1, Solaris 9, mingw.
 This function is declared but not defined on some platforms:
 IRIX 6.5.30.
 @item
+This function is not declared (without @code{-D_GNU_SOURCE}) on some platforms:
+glibc 2.8.
+@item
 This function returns 0 for all possible arguments on some platforms:
 Linux libc5.
 @end itemize
index a1f8932..8b0b127 100644 (file)
@@ -4,7 +4,7 @@
 
 POSIX specification:@* @url{http://www.opengroup.org/onlinepubs/9699919799/functions/iswcntrl.html}
 
-Gnulib module: wctype
+Gnulib module: wctype-h
 
 Portability problems fixed by Gnulib:
 @itemize
index 5691b1d..144df4a 100644 (file)
@@ -4,18 +4,22 @@
 
 POSIX specification:@* @url{http://www.opengroup.org/onlinepubs/9699919799/functions/iswctype.html}
 
-Gnulib module: ---
+Gnulib module: iswctype
 
 Portability problems fixed by Gnulib:
 @itemize
+@item
+This function is missing on some platforms:
+IRIX 5.3, Solaris 2.5.1.
+@item
+This function is declared in @code{<wchar.h>}, not in @code{<wctype.h>}, on
+some platforms:
+HP-UX 11.00.
 @end itemize
 
 Portability problems not fixed by Gnulib:
 @itemize
 @item
-This function is missing on some platforms:
-IRIX 5.3, Solaris 2.5.1.
-@item
 On AIX and Windows platforms, @code{wchar_t} is a 16-bit type and therefore cannot
 accommodate all Unicode characters.
 @end itemize
index 74b0d28..c216949 100644 (file)
@@ -4,7 +4,7 @@
 
 POSIX specification:@* @url{http://www.opengroup.org/onlinepubs/9699919799/functions/iswdigit.html}
 
-Gnulib module: wctype
+Gnulib module: wctype-h
 
 Portability problems fixed by Gnulib:
 @itemize
index 00e1fdb..8dd966a 100644 (file)
@@ -4,7 +4,7 @@
 
 POSIX specification:@* @url{http://www.opengroup.org/onlinepubs/9699919799/functions/iswgraph.html}
 
-Gnulib module: wctype
+Gnulib module: wctype-h
 
 Portability problems fixed by Gnulib:
 @itemize
index ba8d545..0b21d11 100644 (file)
@@ -4,7 +4,7 @@
 
 POSIX specification:@* @url{http://www.opengroup.org/onlinepubs/9699919799/functions/iswlower.html}
 
-Gnulib module: wctype
+Gnulib module: wctype-h
 
 Portability problems fixed by Gnulib:
 @itemize
index f6ade82..dc7236b 100644 (file)
@@ -4,7 +4,7 @@
 
 POSIX specification:@* @url{http://www.opengroup.org/onlinepubs/9699919799/functions/iswprint.html}
 
-Gnulib module: wctype
+Gnulib module: wctype-h
 
 Portability problems fixed by Gnulib:
 @itemize
index 6d1bca0..af9ea53 100644 (file)
@@ -4,7 +4,7 @@
 
 POSIX specification:@* @url{http://www.opengroup.org/onlinepubs/9699919799/functions/iswpunct.html}
 
-Gnulib module: wctype
+Gnulib module: wctype-h
 
 Portability problems fixed by Gnulib:
 @itemize
index 9a73e2f..fed4e41 100644 (file)
@@ -4,7 +4,7 @@
 
 POSIX specification:@* @url{http://www.opengroup.org/onlinepubs/9699919799/functions/iswspace.html}
 
-Gnulib module: wctype
+Gnulib module: wctype-h
 
 Portability problems fixed by Gnulib:
 @itemize
index 9965410..d518345 100644 (file)
@@ -4,7 +4,7 @@
 
 POSIX specification:@* @url{http://www.opengroup.org/onlinepubs/9699919799/functions/iswupper.html}
 
-Gnulib module: wctype
+Gnulib module: wctype-h
 
 Portability problems fixed by Gnulib:
 @itemize
index d3105ed..0fa4f78 100644 (file)
@@ -4,7 +4,7 @@
 
 POSIX specification:@* @url{http://www.opengroup.org/onlinepubs/9699919799/functions/iswxdigit.html}
 
-Gnulib module: wctype
+Gnulib module: wctype-h
 
 Portability problems fixed by Gnulib:
 @itemize
index 383b6cb..bf43164 100644 (file)
@@ -12,7 +12,8 @@ Portability problems fixed by Gnulib:
 This function is missing on some platforms:
 NetBSD 3.0, HP-UX 11.23, IRIX 6.5, Solaris 9, mingw.
 @item
-glibc has an incompatible version of this function.  The POSIX compliant code
+glibc and Cygwin have an incompatible version of this function.  The
+POSIX compliant code
 @smallexample
 char *s = (strerror_r (err, buf, buflen) == 0 ? buf : NULL);
 @end smallexample
index 5449f7f..d99c6ad 100644 (file)
@@ -4,18 +4,18 @@
 
 POSIX specification:@* @url{http://www.opengroup.org/onlinepubs/9699919799/functions/towctrans.html}
 
-Gnulib module: ---
+Gnulib module: towctrans
 
 Portability problems fixed by Gnulib:
 @itemize
+@item
+This function is missing on some platforms:
+HP-UX 11.00, IRIX 6.5, Solaris 2.5.1, mingw, Interix 3.5.
 @end itemize
 
 Portability problems not fixed by Gnulib:
 @itemize
 @item
-This function is missing on some platforms:
-HP-UX 11.00, IRIX 6.5, Solaris 2.5.1, mingw, Interix 3.5.
-@item
 On AIX and Windows platforms, @code{wchar_t} is a 16-bit type and therefore cannot
 accommodate all Unicode characters.
 @end itemize
index 2b658aa..a2282d1 100644 (file)
@@ -4,7 +4,7 @@
 
 POSIX specification:@* @url{http://www.opengroup.org/onlinepubs/9699919799/functions/towlower.html}
 
-Gnulib module: wctype
+Gnulib module: wctype-h
 
 Portability problems fixed by Gnulib:
 @itemize
index 2a3b3b5..5bb4a15 100644 (file)
@@ -4,7 +4,7 @@
 
 POSIX specification:@* @url{http://www.opengroup.org/onlinepubs/9699919799/functions/towupper.html}
 
-Gnulib module: wctype
+Gnulib module: wctype-h
 
 Portability problems fixed by Gnulib:
 @itemize
index 160ef83..2c43b1e 100644 (file)
@@ -25,7 +25,7 @@ FreeBSD 6.0, NetBSD 1.6, OpenBSD 4.7.
 @item
 This function removes only the first value association for the given
 environment variable, not all of them, on some platforms:
-Solaris 11 2010-11.
+Solaris 11 2010-11, Haiku.
 @end itemize
 
 Portability problems not fixed by Gnulib:
index 97a21b3..30b59be 100644 (file)
@@ -4,19 +4,19 @@
 
 POSIX specification:@* @url{http://www.opengroup.org/onlinepubs/9699919799/functions/wcpcpy.html}
 
-Gnulib module: ---
+Gnulib module: wcpcpy
 
 Portability problems fixed by Gnulib:
 @itemize
+@item
+This function is missing on some platforms:
+MacOS X 10.5, FreeBSD 6.0, NetBSD 5.0, OpenBSD 3.8, AIX 4.3.2, HP-UX 11,
+IRIX 6.5, OSF/1 5.1, Solaris 10, Cygwin 1.5.x, mingw, Interix 3.5, BeOS.
 @end itemize
 
 Portability problems not fixed by Gnulib:
 @itemize
 @item
-This function is missing on some platforms:
-MacOS X 10.5, FreeBSD 6.0, NetBSD 5.0, OpenBSD 3.8, AIX 4.3.2, HP-UX
-11, IRIX 6.5, OSF/1 5.1, Solaris 10, Cygwin 1.5.x, mingw, Interix 3.5, BeOS.
-@item
 On AIX and Windows platforms, @code{wchar_t} is a 16-bit type and therefore cannot
 accommodate all Unicode characters.
 @end itemize
index 29daa11..0d8e644 100644 (file)
@@ -4,19 +4,19 @@
 
 POSIX specification:@* @url{http://www.opengroup.org/onlinepubs/9699919799/functions/wcpncpy.html}
 
-Gnulib module: ---
+Gnulib module: wcpncpy
 
 Portability problems fixed by Gnulib:
 @itemize
+@item
+This function is missing on some platforms:
+MacOS X 10.5, FreeBSD 6.0, NetBSD 5.0, OpenBSD 3.8, AIX 4.3.2, HP-UX 11,
+IRIX 6.5, OSF/1 5.1, Solaris 10, Cygwin 1.5.x, mingw, Interix 3.5, BeOS.
 @end itemize
 
 Portability problems not fixed by Gnulib:
 @itemize
 @item
-This function is missing on some platforms:
-MacOS X 10.5, FreeBSD 6.0, NetBSD 5.0, OpenBSD 3.8, AIX 4.3.2, HP-UX
-11, IRIX 6.5, OSF/1 5.1, Solaris 10, Cygwin 1.5.x, mingw, Interix 3.5, BeOS.
-@item
 On AIX and Windows platforms, @code{wchar_t} is a 16-bit type and therefore cannot
 accommodate all Unicode characters.
 @end itemize
index 221a32d..2b18a9a 100644 (file)
@@ -4,19 +4,19 @@
 
 POSIX specification:@* @url{http://www.opengroup.org/onlinepubs/9699919799/functions/wcscasecmp.html}
 
-Gnulib module: ---
+Gnulib module: wcscasecmp
 
 Portability problems fixed by Gnulib:
 @itemize
+@item
+This function is missing on some platforms:
+MacOS X 10.5, FreeBSD 6.0, NetBSD 3.0, OpenBSD 3.8, AIX 4.3.2, HP-UX 11,
+IRIX 6.5, OSF/1 5.1, Solaris 10, Cygwin 1.5.x, mingw.
 @end itemize
 
 Portability problems not fixed by Gnulib:
 @itemize
 @item
-This function is missing on some platforms:
-MacOS X 10.5, FreeBSD 6.0, NetBSD 3.0, OpenBSD 3.8, AIX 4.3.2, HP-UX
-11, IRIX 6.5, OSF/1 5.1, Solaris 10, Cygwin 1.5.x, mingw.
-@item
 On AIX and Windows platforms, @code{wchar_t} is a 16-bit type and therefore cannot
 accommodate all Unicode characters.
 @end itemize
index bf266a6..d0ac072 100644 (file)
@@ -4,18 +4,18 @@
 
 POSIX specification:@* @url{http://www.opengroup.org/onlinepubs/9699919799/functions/wcscat.html}
 
-Gnulib module: ---
+Gnulib module: wcscat
 
 Portability problems fixed by Gnulib:
 @itemize
+@item
+This function is missing on some platforms:
+IRIX 5.3, Solaris 2.5.1.
 @end itemize
 
 Portability problems not fixed by Gnulib:
 @itemize
 @item
-This function is missing on some platforms:
-IRIX 5.3, Solaris 2.5.1.
-@item
 On AIX and Windows platforms, @code{wchar_t} is a 16-bit type and therefore cannot
 accommodate all Unicode characters.
 @end itemize
index 3744e24..3480cc4 100644 (file)
@@ -4,18 +4,18 @@
 
 POSIX specification:@* @url{http://www.opengroup.org/onlinepubs/9699919799/functions/wcschr.html}
 
-Gnulib module: ---
+Gnulib module: wcschr
 
 Portability problems fixed by Gnulib:
 @itemize
+@item
+This function is missing on some platforms:
+IRIX 5.3, Solaris 2.5.1.
 @end itemize
 
 Portability problems not fixed by Gnulib:
 @itemize
 @item
-This function is missing on some platforms:
-IRIX 5.3, Solaris 2.5.1.
-@item
 On AIX and Windows platforms, @code{wchar_t} is a 16-bit type and therefore cannot
 accommodate all Unicode characters.
 @end itemize
index bdaa99e..9766b9d 100644 (file)
@@ -4,18 +4,18 @@
 
 POSIX specification:@* @url{http://www.opengroup.org/onlinepubs/9699919799/functions/wcscmp.html}
 
-Gnulib module: ---
+Gnulib module: wcscmp
 
 Portability problems fixed by Gnulib:
 @itemize
+@item
+This function is missing on some platforms:
+IRIX 5.3, Solaris 2.5.1.
 @end itemize
 
 Portability problems not fixed by Gnulib:
 @itemize
 @item
-This function is missing on some platforms:
-IRIX 5.3, Solaris 2.5.1.
-@item
 On AIX and Windows platforms, @code{wchar_t} is a 16-bit type and therefore cannot
 accommodate all Unicode characters.
 @end itemize
index 7a35ba1..7317a9d 100644 (file)
@@ -4,18 +4,18 @@
 
 POSIX specification:@* @url{http://www.opengroup.org/onlinepubs/9699919799/functions/wcscoll.html}
 
-Gnulib module: ---
+Gnulib module: wcscoll
 
 Portability problems fixed by Gnulib:
 @itemize
+@item
+This function is missing on some platforms:
+IRIX 5.3, Solaris 2.5.1.
 @end itemize
 
 Portability problems not fixed by Gnulib:
 @itemize
 @item
-This function is missing on some platforms:
-IRIX 5.3, Solaris 2.5.1.
-@item
 On AIX and Windows platforms, @code{wchar_t} is a 16-bit type and therefore cannot
 accommodate all Unicode characters.
 @end itemize
index dd09883..fbac143 100644 (file)
@@ -4,18 +4,18 @@
 
 POSIX specification:@* @url{http://www.opengroup.org/onlinepubs/9699919799/functions/wcscpy.html}
 
-Gnulib module: ---
+Gnulib module: wcscpy
 
 Portability problems fixed by Gnulib:
 @itemize
+@item
+This function is missing on some platforms:
+IRIX 5.3, Solaris 2.5.1.
 @end itemize
 
 Portability problems not fixed by Gnulib:
 @itemize
 @item
-This function is missing on some platforms:
-IRIX 5.3, Solaris 2.5.1.
-@item
 On AIX and Windows platforms, @code{wchar_t} is a 16-bit type and therefore cannot
 accommodate all Unicode characters.
 @end itemize
index 14828e1..32c1c20 100644 (file)
@@ -4,18 +4,18 @@
 
 POSIX specification:@* @url{http://www.opengroup.org/onlinepubs/9699919799/functions/wcscspn.html}
 
-Gnulib module: ---
+Gnulib module: wcscspn
 
 Portability problems fixed by Gnulib:
 @itemize
+@item
+This function is missing on some platforms:
+IRIX 5.3, Solaris 2.5.1.
 @end itemize
 
 Portability problems not fixed by Gnulib:
 @itemize
 @item
-This function is missing on some platforms:
-IRIX 5.3, Solaris 2.5.1.
-@item
 On AIX and Windows platforms, @code{wchar_t} is a 16-bit type and therefore cannot
 accommodate all Unicode characters.
 @end itemize
index db92892..884549b 100644 (file)
@@ -4,19 +4,19 @@
 
 POSIX specification:@* @url{http://www.opengroup.org/onlinepubs/9699919799/functions/wcsdup.html}
 
-Gnulib module: ---
+Gnulib module: wcsdup
 
 Portability problems fixed by Gnulib:
 @itemize
+@item
+This function is missing on some platforms:
+MacOS X 10.5, FreeBSD 6.0, NetBSD 3.0, OpenBSD 3.8, AIX 4.3.2, HP-UX 11,
+IRIX 6.5, OSF/1 5.1, Solaris 10, Cygwin 1.5.x, BeOS.
 @end itemize
 
 Portability problems not fixed by Gnulib:
 @itemize
 @item
-This function is missing on some platforms:
-MacOS X 10.5, FreeBSD 6.0, NetBSD 3.0, OpenBSD 3.8, AIX 4.3.2, HP-UX
-11, IRIX 6.5, OSF/1 5.1, Solaris 10, Cygwin 1.5.x, BeOS.
-@item
 On AIX and Windows platforms, @code{wchar_t} is a 16-bit type and therefore cannot
 accommodate all Unicode characters.
 @end itemize
index ece5722..0099911 100644 (file)
@@ -4,18 +4,18 @@
 
 POSIX specification:@* @url{http://www.opengroup.org/onlinepubs/9699919799/functions/wcslen.html}
 
-Gnulib module: ---
+Gnulib module: wcslen
 
 Portability problems fixed by Gnulib:
 @itemize
+@item
+This function is missing on some platforms:
+IRIX 5.3, Solaris 2.5.1.
 @end itemize
 
 Portability problems not fixed by Gnulib:
 @itemize
 @item
-This function is missing on some platforms:
-IRIX 5.3, Solaris 2.5.1.
-@item
 On AIX and Windows platforms, @code{wchar_t} is a 16-bit type and therefore cannot
 accommodate all Unicode characters.
 @end itemize
index cfc5f76..0c841b5 100644 (file)
@@ -4,19 +4,19 @@
 
 POSIX specification:@* @url{http://www.opengroup.org/onlinepubs/9699919799/functions/wcsncasecmp.html}
 
-Gnulib module: ---
+Gnulib module: wcsncasecmp
 
 Portability problems fixed by Gnulib:
 @itemize
+@item
+This function is missing on some platforms:
+MacOS X 10.5, FreeBSD 6.0, NetBSD 3.0, OpenBSD 3.8, AIX 4.3.2, HP-UX 11,
+IRIX 6.5, OSF/1 5.1, Solaris 10, Cygwin 1.5.x, mingw, BeOS.
 @end itemize
 
 Portability problems not fixed by Gnulib:
 @itemize
 @item
-This function is missing on some platforms:
-MacOS X 10.5, FreeBSD 6.0, NetBSD 3.0, OpenBSD 3.8, AIX 4.3.2, HP-UX
-11, IRIX 6.5, OSF/1 5.1, Solaris 10, Cygwin 1.5.x, mingw, BeOS.
-@item
 On AIX and Windows platforms, @code{wchar_t} is a 16-bit type and therefore cannot
 accommodate all Unicode characters.
 @end itemize
index 11a9149..c80c27a 100644 (file)
@@ -4,18 +4,18 @@
 
 POSIX specification:@* @url{http://www.opengroup.org/onlinepubs/9699919799/functions/wcsncat.html}
 
-Gnulib module: ---
+Gnulib module: wcsncat
 
 Portability problems fixed by Gnulib:
 @itemize
+@item
+This function is missing on some platforms:
+IRIX 5.3, Solaris 2.5.1.
 @end itemize
 
 Portability problems not fixed by Gnulib:
 @itemize
 @item
-This function is missing on some platforms:
-IRIX 5.3, Solaris 2.5.1.
-@item
 On AIX and Windows platforms, @code{wchar_t} is a 16-bit type and therefore cannot
 accommodate all Unicode characters.
 @end itemize
index 5da4e6f..d8c8318 100644 (file)
@@ -4,18 +4,18 @@
 
 POSIX specification:@* @url{http://www.opengroup.org/onlinepubs/9699919799/functions/wcsncmp.html}
 
-Gnulib module: ---
+Gnulib module: wcsncmp
 
 Portability problems fixed by Gnulib:
 @itemize
+@item
+This function is missing on some platforms:
+IRIX 5.3, Solaris 2.5.1.
 @end itemize
 
 Portability problems not fixed by Gnulib:
 @itemize
 @item
-This function is missing on some platforms:
-IRIX 5.3, Solaris 2.5.1.
-@item
 On AIX and Windows platforms, @code{wchar_t} is a 16-bit type and therefore cannot
 accommodate all Unicode characters.
 @end itemize
index b26346c..4a6794a 100644 (file)
@@ -4,18 +4,18 @@
 
 POSIX specification:@* @url{http://www.opengroup.org/onlinepubs/9699919799/functions/wcsncpy.html}
 
-Gnulib module: ---
+Gnulib module: wcsncpy
 
 Portability problems fixed by Gnulib:
 @itemize
+@item
+This function is missing on some platforms:
+IRIX 5.3, Solaris 2.5.1.
 @end itemize
 
 Portability problems not fixed by Gnulib:
 @itemize
 @item
-This function is missing on some platforms:
-IRIX 5.3, Solaris 2.5.1.
-@item
 On AIX and Windows platforms, @code{wchar_t} is a 16-bit type and therefore cannot
 accommodate all Unicode characters.
 @end itemize
index 36752dc..c08df2c 100644 (file)
@@ -4,19 +4,19 @@
 
 POSIX specification:@* @url{http://www.opengroup.org/onlinepubs/9699919799/functions/wcsnlen.html}
 
-Gnulib module: ---
+Gnulib module: wcsnlen
 
 Portability problems fixed by Gnulib:
 @itemize
+@item
+This function is missing on some platforms:
+MacOS X 10.5, FreeBSD 6.0, NetBSD 5.0, OpenBSD 3.8, AIX 4.3.2, HP-UX 11,
+IRIX 6.5, OSF/1 5.1, Solaris 10, Cygwin 1.5.x, mingw, Interix 3.5, BeOS.
 @end itemize
 
 Portability problems not fixed by Gnulib:
 @itemize
 @item
-This function is missing on some platforms:
-MacOS X 10.5, FreeBSD 6.0, NetBSD 5.0, OpenBSD 3.8, AIX 4.3.2, HP-UX
-11, IRIX 6.5, OSF/1 5.1, Solaris 10, Cygwin 1.5.x, mingw, Interix 3.5, BeOS.
-@item
 On AIX and Windows platforms, @code{wchar_t} is a 16-bit type and therefore cannot
 accommodate all Unicode characters.
 @end itemize
index 006e55c..17f6d62 100644 (file)
@@ -4,18 +4,18 @@
 
 POSIX specification:@* @url{http://www.opengroup.org/onlinepubs/9699919799/functions/wcspbrk.html}
 
-Gnulib module: ---
+Gnulib module: wcspbrk
 
 Portability problems fixed by Gnulib:
 @itemize
+@item
+This function is missing on some platforms:
+IRIX 5.3, Solaris 2.5.1.
 @end itemize
 
 Portability problems not fixed by Gnulib:
 @itemize
 @item
-This function is missing on some platforms:
-IRIX 5.3, Solaris 2.5.1.
-@item
 On AIX and Windows platforms, @code{wchar_t} is a 16-bit type and therefore cannot
 accommodate all Unicode characters.
 @end itemize
index cf4f122..a052d19 100644 (file)
@@ -4,18 +4,18 @@
 
 POSIX specification:@* @url{http://www.opengroup.org/onlinepubs/9699919799/functions/wcsrchr.html}
 
-Gnulib module: ---
+Gnulib module: wcsrchr
 
 Portability problems fixed by Gnulib:
 @itemize
+@item
+This function is missing on some platforms:
+IRIX 5.3, Solaris 2.5.1.
 @end itemize
 
 Portability problems not fixed by Gnulib:
 @itemize
 @item
-This function is missing on some platforms:
-IRIX 5.3, Solaris 2.5.1.
-@item
 On AIX and Windows platforms, @code{wchar_t} is a 16-bit type and therefore cannot
 accommodate all Unicode characters.
 @end itemize
index f4feb2d..d4f1601 100644 (file)
@@ -4,18 +4,18 @@
 
 POSIX specification:@* @url{http://www.opengroup.org/onlinepubs/9699919799/functions/wcsspn.html}
 
-Gnulib module: ---
+Gnulib module: wcsspn
 
 Portability problems fixed by Gnulib:
 @itemize
+@item
+This function is missing on some platforms:
+IRIX 5.3, Solaris 2.5.1.
 @end itemize
 
 Portability problems not fixed by Gnulib:
 @itemize
 @item
-This function is missing on some platforms:
-IRIX 5.3, Solaris 2.5.1.
-@item
 On AIX and Windows platforms, @code{wchar_t} is a 16-bit type and therefore cannot
 accommodate all Unicode characters.
 @end itemize
index 7c00495..e01daaf 100644 (file)
@@ -4,18 +4,18 @@
 
 POSIX specification:@* @url{http://www.opengroup.org/onlinepubs/9699919799/functions/wcsstr.html}
 
-Gnulib module: ---
+Gnulib module: wcsstr
 
 Portability problems fixed by Gnulib:
 @itemize
+@item
+This function is missing on some platforms:
+HP-UX 11.00, IRIX 5.3, Solaris 2.6.
 @end itemize
 
 Portability problems not fixed by Gnulib:
 @itemize
 @item
-This function is missing on some platforms:
-HP-UX 11.00, IRIX 5.3, Solaris 2.6.
-@item
 On AIX and Windows platforms, @code{wchar_t} is a 16-bit type and therefore cannot
 accommodate all Unicode characters.
 @end itemize
index 2d9c69f..d19fb43 100644 (file)
@@ -4,18 +4,18 @@
 
 POSIX specification:@* @url{http://www.opengroup.org/onlinepubs/9699919799/functions/wcstok.html}
 
-Gnulib module: ---
+Gnulib module: wcstok
 
 Portability problems fixed by Gnulib:
 @itemize
+@item
+This function is missing on some platforms:
+IRIX 5.3, Solaris 2.5.1, Cygwin 1.5.x.
 @end itemize
 
 Portability problems not fixed by Gnulib:
 @itemize
 @item
-This function is missing on some platforms:
-IRIX 5.3, Solaris 2.5.1, Cygwin 1.5.x.
-@item
 On AIX and Windows platforms, @code{wchar_t} is a 16-bit type and therefore cannot
 accommodate all Unicode characters.
 @end itemize
index 27d0e8d..cb61a9a 100644 (file)
@@ -4,18 +4,22 @@
 
 POSIX specification:@* @url{http://www.opengroup.org/onlinepubs/9699919799/functions/wcswidth.html}
 
-Gnulib module: ---
+Gnulib module: wcswidth
 
 Portability problems fixed by Gnulib:
 @itemize
+@item
+This function is missing on some platforms:
+OpenBSD 3.8, IRIX 5.3, Solaris 2.5.1, mingw, BeOS.
+@item
+This function handles combining characters in UTF-8 locales incorrectly on some
+platforms:
+MacOS X 10.3.
 @end itemize
 
 Portability problems not fixed by Gnulib:
 @itemize
 @item
-This function is missing on some platforms:
-OpenBSD 3.8, IRIX 5.3, Solaris 2.5.1, mingw, BeOS.
-@item
 On AIX and Windows platforms, @code{wchar_t} is a 16-bit type and therefore cannot
 accommodate all Unicode characters.
 @end itemize
index 2984458..fe5116d 100644 (file)
@@ -4,18 +4,18 @@
 
 POSIX specification:@* @url{http://www.opengroup.org/onlinepubs/9699919799/functions/wcsxfrm.html}
 
-Gnulib module: ---
+Gnulib module: wcsxfrm
 
 Portability problems fixed by Gnulib:
 @itemize
+@item
+This function is missing on some platforms:
+IRIX 5.3, Solaris 2.5.1, Cygwin 1.5.x.
 @end itemize
 
 Portability problems not fixed by Gnulib:
 @itemize
 @item
-This function is missing on some platforms:
-IRIX 5.3, Solaris 2.5.1, Cygwin 1.5.x.
-@item
 On AIX and Windows platforms, @code{wchar_t} is a 16-bit type and therefore cannot
 accommodate all Unicode characters.
 @end itemize
index 4d054ad..a2143e7 100644 (file)
@@ -4,18 +4,18 @@
 
 POSIX specification:@* @url{http://www.opengroup.org/onlinepubs/9699919799/functions/wctrans.html}
 
-Gnulib module: ---
+Gnulib module: wctrans
 
 Portability problems fixed by Gnulib:
 @itemize
+@item
+This function is missing on some platforms:
+HP-UX 11.00, IRIX 6.5, Solaris 2.5.1, mingw, Interix 3.5.
 @end itemize
 
 Portability problems not fixed by Gnulib:
 @itemize
 @item
-This function is missing on some platforms:
-HP-UX 11.00, IRIX 6.5, Solaris 2.5.1, mingw, Interix 3.5.
-@item
 On AIX and Windows platforms, @code{wchar_t} is a 16-bit type and therefore cannot
 accommodate all Unicode characters.
 @end itemize
index 570b0e4..bb52bed 100644 (file)
@@ -4,18 +4,22 @@
 
 POSIX specification:@* @url{http://www.opengroup.org/onlinepubs/9699919799/functions/wctype.html}
 
-Gnulib module: ---
+Gnulib module: wctype
 
 Portability problems fixed by Gnulib:
 @itemize
+@item
+This function is missing on some platforms:
+IRIX 5.3, Solaris 2.5.1.
+@item
+This function is declared in @code{<wchar.h>}, not in @code{<wctype.h>}, on
+some platforms:
+HP-UX 11.00.
 @end itemize
 
 Portability problems not fixed by Gnulib:
 @itemize
 @item
-This function is missing on some platforms:
-IRIX 5.3, Solaris 2.5.1, mingw.
-@item
 On AIX and Windows platforms, @code{wchar_t} is a 16-bit type and therefore cannot
 accommodate all Unicode characters.
 @end itemize
index 3e85559..ea8ca54 100644 (file)
@@ -4,18 +4,18 @@
 
 POSIX specification:@* @url{http://www.opengroup.org/onlinepubs/9699919799/functions/wmemchr.html}
 
-Gnulib module: ---
+Gnulib module: wmemchr
 
 Portability problems fixed by Gnulib:
 @itemize
+@item
+This function is missing on some platforms:
+HP-UX 11.00, IRIX 6.5, Solaris 2.6, Interix 3.5.
 @end itemize
 
 Portability problems not fixed by Gnulib:
 @itemize
 @item
-This function is missing on some platforms:
-HP-UX 11.00, IRIX 6.5, Solaris 2.6, Interix 3.5.
-@item
 On AIX and Windows platforms, @code{wchar_t} is a 16-bit type and therefore cannot
 accommodate all Unicode characters.
 @end itemize
index 9fc0a54..d243dbb 100644 (file)
@@ -4,18 +4,18 @@
 
 POSIX specification:@* @url{http://www.opengroup.org/onlinepubs/9699919799/functions/wmemcmp.html}
 
-Gnulib module: ---
+Gnulib module: wmemcmp
 
 Portability problems fixed by Gnulib:
 @itemize
+@item
+This function is missing on some platforms:
+HP-UX 11.00, IRIX 6.5, Solaris 2.6, Interix 3.5.
 @end itemize
 
 Portability problems not fixed by Gnulib:
 @itemize
 @item
-This function is missing on some platforms:
-HP-UX 11.00, IRIX 6.5, Solaris 2.6, Interix 3.5.
-@item
 On AIX and Windows platforms, @code{wchar_t} is a 16-bit type and therefore cannot
 accommodate all Unicode characters.
 @end itemize
index 8e548c1..7066c98 100644 (file)
@@ -4,18 +4,18 @@
 
 POSIX specification:@* @url{http://www.opengroup.org/onlinepubs/9699919799/functions/wmemcpy.html}
 
-Gnulib module: ---
+Gnulib module: wmemcpy
 
 Portability problems fixed by Gnulib:
 @itemize
+@item
+This function is missing on some platforms:
+HP-UX 11.00, IRIX 6.5, Solaris 2.6, Interix 3.5.
 @end itemize
 
 Portability problems not fixed by Gnulib:
 @itemize
 @item
-This function is missing on some platforms:
-HP-UX 11.00, IRIX 6.5, Solaris 2.6, Interix 3.5.
-@item
 On AIX and Windows platforms, @code{wchar_t} is a 16-bit type and therefore cannot
 accommodate all Unicode characters.
 @end itemize
index fe6a7c5..ae4a08e 100644 (file)
@@ -4,18 +4,18 @@
 
 POSIX specification:@* @url{http://www.opengroup.org/onlinepubs/9699919799/functions/wmemmove.html}
 
-Gnulib module: ---
+Gnulib module: wmemmove
 
 Portability problems fixed by Gnulib:
 @itemize
+@item
+This function is missing on some platforms:
+HP-UX 11.00, IRIX 6.5, Solaris 2.6, Interix 3.5.
 @end itemize
 
 Portability problems not fixed by Gnulib:
 @itemize
 @item
-This function is missing on some platforms:
-HP-UX 11.00, IRIX 6.5, Solaris 2.6, Interix 3.5.
-@item
 On AIX and Windows platforms, @code{wchar_t} is a 16-bit type and therefore cannot
 accommodate all Unicode characters.
 @end itemize
index c267218..ac7425d 100644 (file)
@@ -4,18 +4,18 @@
 
 POSIX specification:@* @url{http://www.opengroup.org/onlinepubs/9699919799/functions/wmemset.html}
 
-Gnulib module: ---
+Gnulib module: wmemset
 
 Portability problems fixed by Gnulib:
 @itemize
+@item
+This function is missing on some platforms:
+HP-UX 11.00, IRIX 6.5, Solaris 2.6, Interix 3.5.
 @end itemize
 
 Portability problems not fixed by Gnulib:
 @itemize
 @item
-This function is missing on some platforms:
-HP-UX 11.00, IRIX 6.5, Solaris 2.6, Interix 3.5.
-@item
 On AIX and Windows platforms, @code{wchar_t} is a 16-bit type and therefore cannot
 accommodate all Unicode characters.
 @end itemize
index dd1f9a3..13c5014 100644 (file)
@@ -3,7 +3,7 @@
 
 POSIX specification:@* @url{http://www.opengroup.org/onlinepubs/9699919799/basedefs/wctype.h.html}
 
-Gnulib module: wctype
+Gnulib module: wctype-h
 
 Portability problems fixed by Gnulib:
 @itemize
index 9375f97..3cf697f 100755 (executable)
@@ -3855,11 +3855,16 @@ s,^\(.................................................[^ ]*\) *,
         yes | 3)
           sed_transform_main_lib_file=$sed_transform_main_lib_file'
             s/GNU General/GNU Lesser General/g
+            s/General Public License/Lesser General Public License/g
+            s/Lesser Lesser General Public License/Lesser General Public License/g
           '
           ;;
         2)
           sed_transform_main_lib_file=$sed_transform_main_lib_file'
             s/GNU General/GNU Lesser General/g
+            s/General Public License/Lesser General Public License/g
+            s/Lesser Lesser General Public License/Lesser General Public License/g
+
             s/version [23]\([ ,]\)/version 2.1\1/g
           '
           ;;
@@ -3869,7 +3874,11 @@ s,^\(.................................................[^ ]*\) *,
       # Update license.
       sed_transform_main_lib_file=$sed_transform_main_lib_file'
         s/GNU Lesser General/GNU General/g
+        s/Lesser General Public License/General Public License/g
+
         s/GNU Library General/GNU General/g
+        s/Library General Public License/General Public License/g
+
         s/version 2\(.1\)\{0,1\}\([ ,]\)/version 3\2/g
       '
     fi
@@ -3881,7 +3890,11 @@ s,^\(.................................................[^ ]*\) *,
     # Update license.
     sed_transform_build_aux_file=$sed_transform_build_aux_file'
       s/GNU Lesser General/GNU General/g
+      s/Lesser General Public License/General Public License/g
+
       s/GNU Library General/GNU General/g
+      s/Library General Public License/General Public License/g
+
       s/version 2\(.1\)\{0,1\}\([ ,]\)/version 3\2/g
     '
   fi
@@ -3892,7 +3905,11 @@ s,^\(.................................................[^ ]*\) *,
     # Update license.
     sed_transform_testsrelated_lib_file=$sed_transform_testsrelated_lib_file'
       s/GNU Lesser General/GNU General/g
+      s/Lesser General Public License/General Public License/g
+
       s/GNU Library General/GNU General/g
+      s/Library General Public License/General Public License/g
+
       s/version 2\(.1\)\{0,1\}\([ ,]\)/version 3\2/g
     '
   fi
diff --git a/lib/di-set.c b/lib/di-set.c
new file mode 100644 (file)
index 0000000..4730e75
--- /dev/null
@@ -0,0 +1,259 @@
+/* Set operations for device-inode pairs stored in a space-efficient manner.
+
+   Copyright 2009-2011 Free Software Foundation, Inc.
+
+   This program is free software: you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation; either version 3 of the License, or
+   (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
+
+/* written by Paul Eggert and Jim Meyering */
+
+#include <config.h>
+#include "di-set.h"
+
+#include "hash.h"
+#include "ino-map.h"
+
+#include <limits.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 size_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);
+  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_insert0 (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);
+}
diff --git a/lib/di-set.h b/lib/di-set.h
new file mode 100644 (file)
index 0000000..318e9ae
--- /dev/null
@@ -0,0 +1,19 @@
+#ifndef _GL_DI_SET_H
+# define _GL_DI_SET_H
+
+# include <sys/types.h>
+
+# undef _ATTRIBUTE_NONNULL_
+# if __GNUC__ == 3 && __GNUC_MINOR__ >= 3 || 3 < __GNUC__
+#  define _ATTRIBUTE_NONNULL_(m) __attribute__ ((__nonnull__ (m)))
+# else
+#  define _ATTRIBUTE_NONNULL_(m)
+# endif
+
+struct di_set *di_set_alloc (void);
+int di_set_insert (struct di_set *, dev_t, ino_t) _ATTRIBUTE_NONNULL_ (1);
+void di_set_free (struct di_set *) _ATTRIBUTE_NONNULL_ (1);
+int di_set_lookup (struct di_set *dis, dev_t dev, ino_t ino)
+  _ATTRIBUTE_NONNULL_ (1);
+
+#endif
index 7db5663..bdec6d4 100644 (file)
@@ -18,7 +18,7 @@
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
    Lesser General Public License for more details.
 
-   You should have received a copy of the GNU General Public License
+   You should have received a copy of the GNU Lesser General Public License
    along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
 
 #include <config.h>
index c652ef8..96a6aa4 100644 (file)
 #  include <sys/param.h>
 # endif
 
-# include "c-strtod.h"
-# include "cloexec.h"
 # include "intprops.h"
 
 /* The existing Emacs configuration files define a macro called
 #    endif /* NLIST_STRUCT */
 
 #    ifdef SUNOS_5
-#     include <fcntl.h>
 #     include <kvm.h>
 #     include <kstat.h>
 #    endif
 #  include <sys/dg_sys_info.h>
 # endif
 
-# include "fcntl--.h"
+# if (defined __linux__ || 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.  */
 
@@ -482,13 +482,13 @@ static struct dg_sys_info_load_info load_info;  /* what-a-mouthful! */
 # if !defined (HAVE_LIBKSTAT) && defined (LOAD_AVE_TYPE)
 /* File descriptor open to /dev/kmem or VMS load ave driver.  */
 static int channel;
-/* True iff channel is valid.  */
+/* 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__
-static struct nlist nl[2];
+static struct nlist name_list[2];
 #  endif
 
 #  ifdef SUNOS_5
@@ -618,19 +618,30 @@ getloadavg (double loadavg[], int nelem)
 
   for (elem = 0; elem < nelem; elem++)
     {
-      char *endptr;
-      double d;
+      double numerator = 0;
+      double denominator = 1;
+      bool have_digit = false;
+
+      while (*ptr == ' ')
+        ptr++;
 
-      errno = 0;
-      d = c_strtod (ptr, &endptr);
-      if (ptr == endptr || (d == 0 && errno != 0))
+      /* Finish if this number is missing, and report an error if all
+         were missing.  */
+      if (! ('0' <= *ptr && *ptr <= '9'))
         {
           if (elem == 0)
             return -1;
           break;
         }
-      loadavg[elem] = d;
-      ptr = endptr;
+
+      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;
@@ -732,7 +743,7 @@ getloadavg (double loadavg[], int nelem)
       for (i = 0; i < conf.config_maxclass; ++i)
         {
           struct class_stats stats;
-          bzero ((char *) &stats, sizeof stats);
+          memset (&stats, 0, sizeof stats);
 
           desc.sd_type = CPUTYPE_CLASS;
           desc.sd_objid = i;
@@ -899,32 +910,32 @@ getloadavg (double loadavg[], int nelem)
     {
 #  ifndef sgi
 #   if ! defined NLIST_STRUCT || ! defined N_NAME_POINTER
-      strcpy (nl[0].n_name, LDAV_SYMBOL);
-      strcpy (nl[1].n_name, "");
+      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
-      nl[0].n_un.n_name = LDAV_SYMBOL;
-      nl[1].n_un.n_name = 0;
+      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 */
-      nl[0].n_name = LDAV_SYMBOL;
-      nl[1].n_name = 0;
+      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) && !defined (ps2))
-          nlist (KERNEL_FILE, nl)
+          nlist (KERNEL_FILE, name_list)
 #    else  /* _AIX */
-          knlist (nl, 1, sizeof (nl[0]))
+          knlist (name_list, 1, sizeof (name_list[0]))
 #    endif
           >= 0)
-          /* Omit "&& nl[0].n_type != 0 " -- it breaks on Sun386i.  */
+          /* Omit "&& name_list[0].n_type != 0 " -- it breaks on Sun386i.  */
           {
 #    ifdef FIXUP_KERNEL_SYMBOL_ADDR
-            FIXUP_KERNEL_SYMBOL_ADDR (nl);
+            FIXUP_KERNEL_SYMBOL_ADDR (name_list);
 #    endif
-            offset = nl[0].n_value;
+            offset = name_list[0].n_value;
           }
 #   endif /* !SUNOS_5 */
 #  else  /* sgi */
@@ -940,13 +951,27 @@ getloadavg (double loadavg[], int nelem)
   if (!getloadavg_initialized)
     {
 #  ifndef SUNOS_5
-      channel = open ("/dev/kmem", O_RDONLY);
-      if (channel >= 0)
+      /* Set the channel to close on exec, so it does not
+         litter any child's descriptor table.  */
+#   ifndef O_CLOEXEC
+#    define O_CLOEXEC 0
+#   endif
+      int fd = open ("/dev/kmem", O_RDONLY | O_CLOEXEC);
+      if (0 <= fd)
         {
-          /* Set the channel to close on exec, so it does not
-             litter any child's descriptor table.  */
-          set_cloexec_flag (channel, true);
-          getloadavg_initialized = true;
+#   if F_DUPFD_CLOEXEC
+          if (fd <= STDERR_FILENO)
+            {
+              int fd1 = fcntl (fd, F_DUPFD_CLOEXEC, STDERR_FILENO + 1);
+              close (fd);
+              fd = fd1;
+            }
+#   endif
+          if (0 <= fd)
+            {
+              channel = fd;
+              getloadavg_initialized = true;
+            }
         }
 #  else /* SUNOS_5 */
       /* We pass 0 for the kernel, corefile, and swapfile names
@@ -955,8 +980,8 @@ getloadavg (double loadavg[], int nelem)
       if (kd != 0)
         {
           /* nlist the currently running kernel.  */
-          kvm_nlist (kd, nl);
-          offset = nl[0].n_value;
+          kvm_nlist (kd, name_list);
+          offset = name_list[0].n_value;
           getloadavg_initialized = true;
         }
 #  endif /* SUNOS_5 */
index 9b0a9a5..82e2937 100644 (file)
@@ -181,6 +181,7 @@ extern int optopt;
    one).  For long options that have a zero `flag' field, `getopt'
    returns the contents of the `val' field.  */
 
+# if !GNULIB_defined_struct_option
 struct option
 {
   const char *name;
@@ -190,6 +191,8 @@ struct option
   int *flag;
   int val;
 };
+#  define GNULIB_defined_struct_option 1
+# endif
 
 /* Names for the values of the `has_arg' field of `struct option'.  */
 
diff --git a/lib/ino-map.c b/lib/ino-map.c
new file mode 100644 (file)
index 0000000..9133a19
--- /dev/null
@@ -0,0 +1,164 @@
+/* Map an ino_t inode number to a small integer.
+
+   Copyright 2009-2011 Free Software Foundation, Inc.
+
+   This program is free software: you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation; either version 3 of the License, or
+   (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
+
+/* written by Paul Eggert and Jim Meyering */
+
+#include <config.h>
+#include "ino-map.h"
+
+#include "hash.h"
+#include "verify.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.  */
+      verify (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;
+}
diff --git a/lib/ino-map.h b/lib/ino-map.h
new file mode 100644 (file)
index 0000000..e060af0
--- /dev/null
@@ -0,0 +1,19 @@
+#ifndef _GL_INO_MAP_H
+# define _GL_INO_MAP_H
+
+# include <sys/types.h>
+
+# undef _ATTRIBUTE_NONNULL_
+# if __GNUC__ == 3 && __GNUC_MINOR__ >= 3 || 3 < __GNUC__
+#  define _ATTRIBUTE_NONNULL_(m) __attribute__ ((__nonnull__ (m)))
+# else
+#  define _ATTRIBUTE_NONNULL_(m)
+# endif
+
+# define INO_MAP_INSERT_FAILURE ((size_t) -1)
+
+struct ino_map *ino_map_alloc (size_t);
+void ino_map_free (struct ino_map *) _ATTRIBUTE_NONNULL_ (1);
+size_t ino_map_insert (struct ino_map *, ino_t) _ATTRIBUTE_NONNULL_ (1);
+
+#endif
index 2f8fd14..6a8f46d 100644 (file)
@@ -1060,7 +1060,10 @@ _GL_WARN_ON_USE (imaxabs, "imaxabs is unportable - "
 
 #if @GNULIB_IMAXDIV@
 # if !@HAVE_DECL_IMAXDIV@
+#  if !GNULIB_defined_imaxdiv_t
 typedef struct { intmax_t quot; intmax_t rem; } imaxdiv_t;
+#   define GNULIB_defined_imaxdiv_t 1
+#  endif
 extern imaxdiv_t imaxdiv (intmax_t, intmax_t);
 # endif
 #elif defined GNULIB_POSIXCHECK
diff --git a/lib/iswctype-impl.h b/lib/iswctype-impl.h
new file mode 100644 (file)
index 0000000..8a88d6f
--- /dev/null
@@ -0,0 +1,22 @@
+/* Test whether a wide character has a given property.
+   Copyright (C) 2011 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 <http://www.gnu.org/licenses/>.  */
+
+int
+iswctype (wint_t wc, wctype_t desc)
+{
+  return ((int (*) (wint_t)) desc) (wc);
+}
diff --git a/lib/iswctype.c b/lib/iswctype.c
new file mode 100644 (file)
index 0000000..6f4c362
--- /dev/null
@@ -0,0 +1,23 @@
+/* Test whether a wide character has a given property.
+   Copyright (C) 2011 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 <http://www.gnu.org/licenses/>.  */
+
+#include <config.h>
+
+/* Specification.  */
+#include <wctype.h>
+
+#include "iswctype-impl.h"
index de37b89..8a49512 100644 (file)
 /* 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
index 0c76dc6..9ac38ba 100644 (file)
@@ -73,18 +73,21 @@ _GL_WARN_ON_USE (rpl_ ## func ## l, #func " is unportable - "       \
    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@
-# undef NAN
+# if !GNULIB_defined_NAN
+#  undef NAN
   /* The Compaq (ex-DEC) C 6.4 compiler chokes on the expression 0.0 / 0.0.  */
-# ifdef __DECC
+#  ifdef __DECC
 static float
 _NaN ()
 {
   static float zero = 0.0f;
   return zero / zero;
 }
-#  define NAN (_NaN())
-# else
-#  define NAN (0.0f / 0.0f)
+#   define NAN (_NaN())
+#  else
+#   define NAN (0.0f / 0.0f)
+#  endif
+#  define GNULIB_defined_NAN 1
 # endif
 #endif
 
diff --git a/lib/mbsnrtowcs-impl.h b/lib/mbsnrtowcs-impl.h
new file mode 100644 (file)
index 0000000..719f56b
--- /dev/null
@@ -0,0 +1,124 @@
+/* Convert string to wide string.
+   Copyright (C) 2008-2011 Free Software Foundation, Inc.
+   Written by Bruno Haible <bruno@clisp.org>, 2008.
+
+   This program is free software: you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation; either version 3 of the License, or
+   (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
+
+size_t
+mbsnrtowcs (wchar_t *dest, const char **srcp, size_t srclen, size_t len, mbstate_t *ps)
+{
+  if (ps == NULL)
+    ps = &_gl_mbsrtowcs_state;
+  {
+    const char *src = *srcp;
+
+    if (dest != NULL)
+      {
+        wchar_t *destptr = dest;
+
+        for (; srclen > 0 && len > 0; destptr++, len--)
+          {
+            size_t src_avail;
+            size_t ret;
+
+            /* An optimized variant of
+               src_avail = strnlen1 (src, MIN (srclen, MB_LEN_MAX));  */
+            if (srclen == 1 || src[0] == '\0')
+              src_avail = 1;
+            else if (srclen == 2 || src[1] == '\0')
+              src_avail = 2;
+            else if (srclen == 3 || src[2] == '\0')
+              src_avail = 3;
+            else if (MB_LEN_MAX <= 4 || srclen == 4 || src[3] == '\0')
+              src_avail = 4;
+            else
+              src_avail = 4 + strnlen1 (src + 4, MIN (srclen, 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;
+              }
+            src += ret;
+            srclen -= 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 (; srclen > 0; totalcount++)
+          {
+            size_t src_avail;
+            size_t ret;
+
+            /* An optimized variant of
+               src_avail = strnlen1 (src, MIN (srclen, MB_LEN_MAX));  */
+            if (srclen == 1 || src[0] == '\0')
+              src_avail = 1;
+            else if (srclen == 2 || src[1] == '\0')
+              src_avail = 2;
+            else if (srclen == 3 || src[2] == '\0')
+              src_avail = 3;
+            else if (MB_LEN_MAX <= 4 || srclen == 4 || src[3] == '\0')
+              src_avail = 4;
+            else
+              src_avail = 4 + strnlen1 (src + 4, MIN (srclen, 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;
+            srclen -= ret;
+          }
+
+        return totalcount;
+      }
+
+   bad_input:
+    *srcp = src;
+   bad_input2:
+    errno = EILSEQ;
+    return (size_t)(-1);
+  }
+}
index 0b6d5b4..c37c8f7 100644 (file)
 
 extern mbstate_t _gl_mbsrtowcs_state;
 
-size_t
-mbsnrtowcs (wchar_t *dest, const char **srcp, size_t srclen, size_t len, mbstate_t *ps)
-{
-  if (ps == NULL)
-    ps = &_gl_mbsrtowcs_state;
-  {
-    const char *src = *srcp;
-
-    if (dest != NULL)
-      {
-        wchar_t *destptr = dest;
-
-        for (; srclen > 0 && len > 0; destptr++, len--)
-          {
-            size_t src_avail;
-            size_t ret;
-
-            /* An optimized variant of
-               src_avail = strnlen1 (src, MIN (srclen, MB_LEN_MAX));  */
-            if (srclen == 1 || src[0] == '\0')
-              src_avail = 1;
-            else if (srclen == 2 || src[1] == '\0')
-              src_avail = 2;
-            else if (srclen == 3 || src[2] == '\0')
-              src_avail = 3;
-            else if (MB_LEN_MAX <= 4 || srclen == 4 || src[3] == '\0')
-              src_avail = 4;
-            else
-              src_avail = 4 + strnlen1 (src + 4, MIN (srclen, 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;
-              }
-            src += ret;
-            srclen -= 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 (; srclen > 0; totalcount++)
-          {
-            size_t src_avail;
-            size_t ret;
-
-            /* An optimized variant of
-               src_avail = strnlen1 (src, MIN (srclen, MB_LEN_MAX));  */
-            if (srclen == 1 || src[0] == '\0')
-              src_avail = 1;
-            else if (srclen == 2 || src[1] == '\0')
-              src_avail = 2;
-            else if (srclen == 3 || src[2] == '\0')
-              src_avail = 3;
-            else if (MB_LEN_MAX <= 4 || srclen == 4 || src[3] == '\0')
-              src_avail = 4;
-            else
-              src_avail = 4 + strnlen1 (src + 4, MIN (srclen, 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;
-            srclen -= ret;
-          }
-
-        return totalcount;
-      }
-
-   bad_input:
-    *srcp = src;
-   bad_input2:
-    errno = EILSEQ;
-    return (size_t)(-1);
-  }
-}
+#include "mbsnrtowcs-impl.h"
diff --git a/lib/mbsrtowcs-impl.h b/lib/mbsrtowcs-impl.h
new file mode 100644 (file)
index 0000000..e78bbfb
--- /dev/null
@@ -0,0 +1,122 @@
+/* Convert string to wide string.
+   Copyright (C) 2008-2011 Free Software Foundation, Inc.
+   Written by Bruno Haible <bruno@clisp.org>, 2008.
+
+   This program is free software: you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation; either version 3 of the License, or
+   (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
+
+size_t
+mbsrtowcs (wchar_t *dest, const char **srcp, size_t len, mbstate_t *ps)
+{
+  if (ps == NULL)
+    ps = &_gl_mbsrtowcs_state;
+  {
+    const char *src = *srcp;
+
+    if (dest != NULL)
+      {
+        wchar_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;
+              }
+            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);
+  }
+}
index 59cbbdb..69e6dff 100644 (file)
 
 extern mbstate_t _gl_mbsrtowcs_state;
 
-size_t
-mbsrtowcs (wchar_t *dest, const char **srcp, size_t len, mbstate_t *ps)
-{
-  if (ps == NULL)
-    ps = &_gl_mbsrtowcs_state;
-  {
-    const char *src = *srcp;
-
-    if (dest != NULL)
-      {
-        wchar_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;
-              }
-            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);
-  }
-}
+#include "mbsrtowcs-impl.h"
index e1bc246..cdf07f2 100644 (file)
@@ -51,6 +51,7 @@
 
 # if !@HAVE_STRUCT_ADDRINFO@
 
+#  if !GNULIB_defined_struct_addrinfo
 /* Structure to contain information about address of a service provider.  */
 struct addrinfo
 {
@@ -63,6 +64,8 @@ struct addrinfo
   char *ai_canonname;           /* Canonical name for service location.  */
   struct addrinfo *ai_next;     /* Pointer to next in list.  */
 };
+#   define GNULIB_defined_struct_addrinfo 1
+#  endif
 # endif
 
 /* Possible values for `ai_flags' field in `addrinfo' structure.  */
index 0db20b9..b10e627 100644 (file)
 
 #include <stdlib.h>
 
+#ifndef GNULIB_LIBPOSIX
 #include "error.h"
+#endif
+
 #include "exitfail.h"
 
 #include "gettext.h"
 void
 openat_save_fail (int errnum)
 {
+#ifndef GNULIB_LIBPOSIX
   error (exit_failure, errnum,
          _("unable to record current working directory"));
-
+#endif
   /* The `noreturn' attribute cannot be applied to error, since it returns
      when its first argument is 0.  To help compilers understand that this
      function does not return, call abort.  Also, the abort is a
@@ -48,8 +52,10 @@ openat_save_fail (int errnum)
 void
 openat_restore_fail (int errnum)
 {
+#ifndef GNULIB_LIBPOSIX
   error (exit_failure, errnum,
          _("failed to return to initial working directory"));
+#endif
 
   /* As above.  */
   abort ();
index 5bd2a98..91add38 100644 (file)
@@ -54,6 +54,8 @@
 # define POLLWRNORM  0x0100
 # define POLLWRBAND  0x0200
 
+# if !GNULIB_defined_poll_types
+
 struct pollfd
 {
   int fd;                       /* which file descriptor to poll */
@@ -63,6 +65,9 @@ struct pollfd
 
 typedef unsigned long nfds_t;
 
+#  define GNULIB_defined_poll_types 1
+# endif
+
 /* Define INFTIM only if doing so conforms to POSIX.  */
 # if !defined (_POSIX_C_SOURCE) && !defined (_XOPEN_SOURCE)
 #  define INFTIM (-1)
index cf9bb81..e03eb6e 100644 (file)
@@ -1,5 +1,5 @@
 /* Decomposed printf argument list.
-   Copyright (C) 1999, 2002-2003, 2006-2007, 2009-2011 Free Software
+   Copyright (C) 1999, 2002-2003, 2006-2007, 2011 Free Software
    Foundation, Inc.
 
    This program is free software; you can redistribute it and/or modify
@@ -136,10 +136,14 @@ typedef struct
 }
 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;
 
index e44a8b2..c4e1d37 100644 (file)
@@ -63,6 +63,9 @@
 /* malloc(), realloc(), free().  */
 #include <stdlib.h>
 
+/* memcpy().  */
+#include <string.h>
+
 /* errno.  */
 #include <errno.h>
 
@@ -80,23 +83,20 @@ STATIC
 int
 PRINTF_PARSE (const CHAR_T *format, DIRECTIVES *d, arguments *a)
 {
-  const CHAR_T *cp = format;            /* pointer into format */
+  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 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 = 1;
-  d->dir = (DIRECTIVE *) malloc (d_allocated * sizeof (DIRECTIVE));
-  if (d->dir == NULL)
-    /* Out of memory.  */
-    goto out_of_memory_1;
+  d_allocated = N_DIRECT_ALLOC_DIRECTIVES;
+  d->dir = d->direct_alloc_dir;
 
   a->count = 0;
-  a_allocated = 0;
-  a->arg = NULL;
+  a_allocated = N_DIRECT_ALLOC_ARGUMENTS;
+  a->arg = a->direct_alloc_arg;
 
 #define REGISTER_ARG(_index_,_type_) \
   {                                                                     \
@@ -113,12 +113,14 @@ PRINTF_PARSE (const CHAR_T *format, DIRECTIVES *d, arguments *a)
         if (size_overflow_p (memory_size))                              \
           /* Overflow, would lead to out of memory.  */                 \
           goto out_of_memory;                                           \
-        memory = (argument *) (a->arg                                   \
+        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)                                               \
@@ -588,10 +590,14 @@ PRINTF_PARSE (const CHAR_T *format, DIRECTIVES *d, arguments *a)
               if (size_overflow_p (memory_size))
                 /* Overflow, would lead to out of memory.  */
                 goto out_of_memory;
-              memory = (DIRECTIVE *) realloc (d->dir, memory_size);
+              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;
             }
         }
@@ -610,19 +616,18 @@ PRINTF_PARSE (const CHAR_T *format, DIRECTIVES *d, arguments *a)
   return 0;
 
 error:
-  if (a->arg)
+  if (a->arg != a->direct_alloc_arg)
     free (a->arg);
-  if (d->dir)
+  if (d->dir != d->direct_alloc_dir)
     free (d->dir);
   errno = EINVAL;
   return -1;
 
 out_of_memory:
-  if (a->arg)
+  if (a->arg != a->direct_alloc_arg)
     free (a->arg);
-  if (d->dir)
+  if (d->dir != d->direct_alloc_dir)
     free (d->dir);
-out_of_memory_1:
   errno = ENOMEM;
   return -1;
 }
index bb16df2..c819f94 100644 (file)
@@ -1,5 +1,5 @@
 /* Parse printf format string.
-   Copyright (C) 1999, 2002-2003, 2005, 2007, 2009-2011 Free Software
+   Copyright (C) 1999, 2002-2003, 2005, 2007, 2010-2011 Free Software
    Foundation, Inc.
 
    This program is free software; you can redistribute it and/or modify
@@ -47,6 +47,9 @@
 /* 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
 {
@@ -71,6 +74,7 @@ typedef struct
   char_directive *dir;
   size_t max_width_length;
   size_t max_precision_length;
+  char_directive direct_alloc_dir[N_DIRECT_ALLOC_DIRECTIVES];
 }
 char_directives;
 
@@ -100,6 +104,7 @@ typedef struct
   u8_directive *dir;
   size_t max_width_length;
   size_t max_precision_length;
+  u8_directive direct_alloc_dir[N_DIRECT_ALLOC_DIRECTIVES];
 }
 u8_directives;
 
@@ -127,6 +132,7 @@ typedef struct
   u16_directive *dir;
   size_t max_width_length;
   size_t max_precision_length;
+  u16_directive direct_alloc_dir[N_DIRECT_ALLOC_DIRECTIVES];
 }
 u16_directives;
 
@@ -154,6 +160,7 @@ typedef struct
   u32_directive *dir;
   size_t max_width_length;
   size_t max_precision_length;
+  u32_directive direct_alloc_dir[N_DIRECT_ALLOC_DIRECTIVES];
 }
 u32_directives;
 
index a3669a5..da7bd4e 100644 (file)
@@ -40,6 +40,7 @@
 #include <time.h>
 
 #if ! @HAVE_PTHREAD_T@
+# if !GNULIB_defined_pthread_types
  typedef int pthread_t;
  typedef int pthread_attr_t;
  typedef int pthread_barrier_t;
@@ -52,6 +53,8 @@
  typedef int pthread_once_t;
  typedef int pthread_rwlock_t;
  typedef int pthread_rwlockattr_t;
+#  define GNULIB_defined_pthread_types 1
+# endif
 #endif
 
 #ifndef PTHREAD_COND_INITIALIZER
 
 #if ! @HAVE_PTHREAD_T@
 
+# if !GNULIB_defined_pthread_functions
+
 /* Provide substitutes for the thread functions that should work
    adequately on a single-threaded implementation, where
    pthread_create always fails.  The goal is to let programs compile
@@ -217,10 +222,15 @@ pthread_mutex_unlock (pthread_mutex_t *mutex)
   return 0;
 }
 
+#  define GNULIB_defined_pthread_functions 1
+# endif
+
 #endif
 
 #if ! @HAVE_PTHREAD_SPINLOCK_T@
 
+# if !GNULIB_defined_pthread_spinlock_t
+
 /* Approximate spinlocks with mutexes.  */
 
 typedef pthread_mutex_t pthread_spinlock_t;
@@ -254,6 +264,10 @@ pthread_spin_unlock (pthread_spinlock_t *lock)
 {
   return pthread_mutex_unlock (lock);
 }
+
+#  define GNULIB_defined_pthread_spinlock_t 1
+# endif
+
 #endif
 
 #endif /* _GL_PTHREAD_H_ */
index 7725e97..8a1135f 100644 (file)
 
 #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
 
index 3aadaa5..39f5881 100644 (file)
 
 /* The definition of _GL_UNUSED_PARAMETER is copied here.  */
 
+#  if !GNULIB_defined_security_types
+
 typedef unsigned short security_class_t;
-#  define security_context_t char*
-#  define is_selinux_enabled() 0
+#   define security_context_t char*
+#   define is_selinux_enabled() 0
 
 static inline int getcon (security_context_t *con _GL_UNUSED_PARAMETER)
   { errno = ENOTSUP; return -1; }
@@ -88,5 +90,8 @@ static inline int matchpathcon_init_prefix
      char const *prefix _GL_UNUSED_PARAMETER)
   { errno = ENOTSUP; return -1; }
 
+#   define GNULIB_defined_security_types 1
+#  endif
+
 # endif
 #endif /* _GL_SELINUX_SELINUX_H */
index 75a9edf..53f3bbd 100644 (file)
@@ -53,6 +53,7 @@
    for details.  */
 
 # if !@HAVE_TSEARCH@
+#  if !GNULIB_defined_search_types
 typedef enum
 {
   preorder,
@@ -61,13 +62,18 @@ typedef enum
   leaf
 }
 VISIT;
+#   define GNULIB_defined_search_types 1
+#  endif
 # endif
 
 # ifdef __cplusplus
 extern "C" {
 # endif
+# if !GNULIB_defined_search_fn_types
 typedef int (*_gl_search_compar_fn) (const void *, const void *);
 typedef void (*_gl_search_action_fn) (const void *, VISIT, int);
+#  define GNULIB_defined_search_fn_types 1
+# endif
 # ifdef __cplusplus
 }
 # endif
index 8e23e66..7a6d6ee 100644 (file)
    '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
+#  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
 
 
@@ -89,7 +95,10 @@ typedef unsigned int sigset_t;
 #  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
 
@@ -184,7 +193,10 @@ _GL_CXXALIASWARN (sigprocmask);
 # 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
@@ -258,6 +270,9 @@ _GL_WARN_ON_USE (sigprocmask, "sigprocmask is unportable - "
 # if !@HAVE_SIGACTION@
 
 #  if !@HAVE_SIGINFO_T@
+
+#   if !GNULIB_defined_siginfo_types
+
 /* Present to allow compilation, but unsupported by gnulib.  */
 union sigval
 {
@@ -279,11 +294,17 @@ struct siginfo_t
   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
@@ -299,12 +320,15 @@ struct sigaction
   /* Not all POSIX flags are supported.  */
   int sa_flags;
 };
-#  define sa_handler _sa_func._sa_handler
-#  define sa_sigaction _sa_func._sa_sigaction
+#   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 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));
index 3036340..a145946 100644 (file)
@@ -83,6 +83,7 @@
 # define posix_spawnattr_t rpl_posix_spawnattr_t
 #endif
 #if @REPLACE_POSIX_SPAWN@ || !@HAVE_POSIX_SPAWNATTR_T@
+# if !GNULIB_defined_posix_spawnattr_t
 typedef struct
 {
   short int _flags;
@@ -93,6 +94,8 @@ typedef struct
   int _policy;
   int __pad[16];
 } posix_spawnattr_t;
+#  define GNULIB_defined_posix_spawnattr_t 1
+# endif
 #endif
 
 
@@ -102,6 +105,7 @@ typedef struct
 # define posix_spawn_file_actions_t rpl_posix_spawn_file_actions_t
 #endif
 #if @REPLACE_POSIX_SPAWN@ || !@HAVE_POSIX_SPAWN_FILE_ACTIONS_T@
+# if !GNULIB_defined_posix_spawn_file_actions_t
 typedef struct
 {
   int _allocated;
@@ -109,6 +113,8 @@ typedef struct
   struct __spawn_action *_actions;
   int __pad[16];
 } posix_spawn_file_actions_t;
+#  define GNULIB_defined_posix_spawn_file_actions_t 1
+# endif
 #endif
 
 
@@ -146,6 +152,7 @@ typedef struct
     | POSIX_SPAWN_SETSCHEDULER                                            \
     | (POSIX_SPAWN_SETSCHEDULER > 0 ? POSIX_SPAWN_SETSCHEDULER - 1 : 0))  \
    + 1)
+#if !GNULIB_defined_verify_POSIX_SPAWN_USEVFORK_no_overlap
 typedef int verify_POSIX_SPAWN_USEVFORK_no_overlap
             [(((POSIX_SPAWN_RESETIDS | POSIX_SPAWN_SETPGROUP
                 | POSIX_SPAWN_SETSIGDEF | POSIX_SPAWN_SETSIGMASK
@@ -153,6 +160,8 @@ typedef int verify_POSIX_SPAWN_USEVFORK_no_overlap
                & POSIX_SPAWN_USEVFORK)
               == 0)
              ? 1 : -1];
+# define GNULIB_defined_verify_POSIX_SPAWN_USEVFORK_no_overlap 1
+#endif
 
 
 #if @GNULIB_POSIX_SPAWN@
index 309e089..c48be52 100644 (file)
         warnings in the signed case.  */ \
      ((((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
@@ -296,6 +298,9 @@ typedef unsigned long int gl_uintmax_t;
 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 */
 
 #if ! defined __cplusplus || defined __STDC_LIMIT_MACROS
index f61a572..59e1713 100644 (file)
@@ -367,17 +367,20 @@ _GL_CXXALIASWARN (fseeko);
    /* Provide an fseek function that is consistent with fseeko.  */
    /* In order to avoid that fseek gets defined as a macro here, the
       developer can request the 'fseek' module.  */
-#  undef fseek
-#  define fseek rpl_fseek
+#  if !GNULIB_defined_fseek_function
+#   undef fseek
+#   define fseek rpl_fseek
 static inline int _GL_ARG_NONNULL ((1))
 rpl_fseek (FILE *fp, long offset, int whence)
 {
-#  if @REPLACE_FSEEKO@
+#   if @REPLACE_FSEEKO@
   return rpl_fseeko (fp, offset, whence);
-#  else
+#   else
   return fseeko (fp, offset, whence);
-#  endif
+#   endif
 }
+#   define GNULIB_defined_fseek_function 1
+#  endif
 # endif
 #elif defined GNULIB_POSIXCHECK
 # define _GL_FSEEK_WARN /* Category 1, above.  */
@@ -442,17 +445,20 @@ _GL_CXXALIASWARN (ftello);
    /* Provide an ftell function that is consistent with ftello.  */
    /* In order to avoid that ftell gets defined as a macro here, the
       developer can request the 'ftell' module.  */
-#  undef ftell
-#  define ftell rpl_ftell
+#  if !GNULIB_defined_ftell_function
+#   undef ftell
+#   define ftell rpl_ftell
 static inline long _GL_ARG_NONNULL ((1))
 rpl_ftell (FILE *f)
 {
-#  if @REPLACE_FTELLO@
+#   if @REPLACE_FTELLO@
   return rpl_ftello (f);
-#  else
+#   else
   return ftello (f);
-#  endif
+#   endif
 }
+#   define GNULIB_defined_ftell_function 1
+#  endif
 # endif
 #elif defined GNULIB_POSIXCHECK
 # define _GL_FTELL_WARN /* Category 1, above.  */
index a9b284c..6e69a27 100644 (file)
 # include <sys/loadavg.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 always.  */
-#if @HAVE_RANDOM_H@
-# include <random.h>
-#endif
+   from <stdlib.h> if _REENTRANT is defined.  Include it whenever we need
+   'struct random_data'.  */
+# if @HAVE_RANDOM_H@
+#  include <random.h>
+# endif
 
-#if !@HAVE_STRUCT_RANDOM_DATA@ || (@GNULIB_RANDOM_R@ && !@HAVE_RANDOM_R@) \
-    || defined GNULIB_POSIXCHECK
-# include <stdint.h>
-#endif
+# if !@HAVE_STRUCT_RANDOM_DATA@ || !@HAVE_RANDOM_R@
+#  include <stdint.h>
+# endif
 
-#if !@HAVE_STRUCT_RANDOM_DATA@
+# 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
+#  if !GNULIB_defined_struct_random_data
 struct random_data
 {
   int32_t *fptr;                /* Front pointer.  */
@@ -74,7 +76,8 @@ struct random_data
   int rand_sep;                 /* Distance between front and rear.  */
   int32_t *end_ptr;             /* Pointer behind state table.  */
 };
-#  define GNULIB_defined_struct_random_data 1
+#   define GNULIB_defined_struct_random_data 1
+#  endif
 # endif
 #endif
 
index 57a7e8f..1fa52d9 100644 (file)
@@ -27,7 +27,7 @@
 #if HAVE_DECL_STRERROR_R && !(__GLIBC__ >= 2 || defined __UCLIBC__) && !EXTEND_STRERROR_R
 
 /* The system's strerror_r function is OK, except that its third argument
-   is 'int', not 'size_t'.  */
+   is 'int', not 'size_t', or its return type is wrong.  */
 
 # include <limits.h>
 
@@ -61,6 +61,11 @@ strerror_r (int errnum, char *buf, size_t buflen)
     else
       ret = strerror_r (errnum, buf, buflen);
   }
+# elif defined __CYGWIN__
+  /* Cygwin only provides the glibc interface, is thread-safe, and
+     always succeeds (although it may truncate). */
+  strerror_r (errnum, buf, buflen);
+  ret = 0;
 # else
   ret = strerror_r (errnum, buf, buflen);
 # endif
index 0275638..55f36ef 100644 (file)
 /* The definition of _GL_WARN_ON_USE is copied here.  */
 
 #if !@HAVE_SA_FAMILY_T@
+# if !GNULIB_defined_sa_family_t
 typedef unsigned short  sa_family_t;
+#  define GNULIB_defined_sa_family_t 1
+# endif
 #endif
 
 #if @HAVE_STRUCT_SOCKADDR_STORAGE@
@@ -89,12 +92,16 @@ typedef unsigned short  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
 
 #if @HAVE_SYS_SOCKET_H@
@@ -159,7 +166,10 @@ struct sockaddr_storage
 #  include <sys/types.h>
 #  include <io.h>
 
+#  if !GNULIB_defined_socklen_t
 typedef int socklen_t;
+#   define GNULIB_defined_socklen_t 1
+#  endif
 
 # endif
 
@@ -167,6 +177,8 @@ typedef int socklen_t;
 
 #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 inline int
@@ -183,6 +195,9 @@ rpl_fd_isset (SOCKET fd, fd_set * set)
   return 0;
 }
 
+#  define GNULIB_defined_rpl_fd_isset 1
+# endif
+
 # undef FD_ISSET
 # define FD_ISSET(fd, set) rpl_fd_isset(fd, set)
 
index 3f1a7e4..2853287 100644 (file)
@@ -461,11 +461,14 @@ _GL_CXXALIAS_RPL (mkdir, int, (char const *name, mode_t mode));
    which are included above.  */
 # if (defined _WIN32 || defined __WIN32__) && ! defined __CYGWIN__
 
+#  if !GNULIB_defined_rpl_mkdir
 static inline 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)
 #   define mkdir rpl_mkdir
index 884de94..d11a53a 100644 (file)
@@ -51,11 +51,16 @@ extern "C" {
 # endif
 
 # if ! @HAVE_STRUCT_TIMEVAL@
+
+#  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
index 73e13ea..7b66140 100644 (file)
@@ -48,6 +48,7 @@ extern "C" {
 # endif
 
 # if !@HAVE_STRUCT_TMS@
+#  if !GNULIB_defined_struct_tms
   /* Structure describing CPU time used by a process and its children.  */
   struct tms
   {
@@ -57,6 +58,8 @@ extern "C" {
     clock_t tms_cutime;         /* User CPU time of dead children.  */
     clock_t tms_cstime;         /* System CPU time of dead children.  */
   };
+#   define GNULIB_defined_struct_tms 1
+#  endif
 # endif
 
 # if @GNULIB_TIMES@
index b203e0e..a8c8d29 100644 (file)
@@ -57,6 +57,7 @@ extern "C" {
 #  define _UTSNAME_MACHINE_LENGTH _UTSNAME_LENGTH
 # endif
 
+# if !GNULIB_defined_struct_utsname
 /* Structure describing the system and machine.  */
 struct utsname
   {
@@ -73,6 +74,9 @@ struct utsname
     /* 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@ */
 
 
index 3ddd52c..54e7f42 100644 (file)
 extern "C" {
 #   endif
 
-#   undef timespec
-#   define timespec rpl_timespec
+#   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
 }
@@ -84,6 +87,7 @@ struct timespec
 #  endif
 # endif
 
+# if !GNULIB_defined_struct_time_t_must_be_integral
 /* Per http://austingroupbugs.net/view.php?id=327, POSIX requires
    time_t to be an integer type, even though C99 permits floating
    point.  We don't know of any implementation that uses floating
@@ -92,6 +96,8 @@ struct timespec
 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
 
 /* Sleep for at least RQTP seconds unless interrupted,  If interrupted,
    return -1 and store the remaining time into RMTP.  See
diff --git a/lib/towctrans-impl.h b/lib/towctrans-impl.h
new file mode 100644 (file)
index 0000000..9e640fe
--- /dev/null
@@ -0,0 +1,22 @@
+/* Convert a wide character using a case mapping.
+   Copyright (C) 2011 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 <http://www.gnu.org/licenses/>.  */
+
+wint_t
+towctrans (wint_t wc, wctrans_t desc)
+{
+  return ((wint_t (*) (wint_t)) desc) (wc);
+}
diff --git a/lib/towctrans.c b/lib/towctrans.c
new file mode 100644 (file)
index 0000000..3bf42ad
--- /dev/null
@@ -0,0 +1,23 @@
+/* Convert a wide character using a case mapping.
+   Copyright (C) 2011 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 <http://www.gnu.org/licenses/>.  */
+
+#include <config.h>
+
+/* Specification.  */
+#include <wctype.h>
+
+#include "towctrans-impl.h"
index 71e4fa8..156e864 100644 (file)
@@ -796,11 +796,14 @@ _GL_CXXALIAS_RPL (getpagesize, int, (void));
 #    if !(defined __cplusplus && defined GNULIB_NAMESPACE)
 #     define getpagesize() _gl_getpagesize ()
 #    else
+#     if !GNULIB_defined_getpagesize_function
 static inline int
 getpagesize ()
 {
   return _gl_getpagesize ();
 }
+#      define GNULIB_defined_getpagesize_function 1
+#     endif
 #    endif
 #   endif
 #  endif
index 13b60c4..8f07308 100644 (file)
@@ -1753,8 +1753,9 @@ VASNPRINTF (DCHAR_T *resultbuf, size_t *lengthp,
     return NULL;
 
 #define CLEANUP() \
-  free (d.dir);                                                         \
-  if (a.arg)                                                            \
+  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)
index df41338..e2010a8 100644 (file)
    On IRIX 6.5, sizeof (mbstate_t) == 1, which is not sufficient for
    implementing mbrtowc for encodings like UTF-8.  */
 #if !(@HAVE_MBSINIT@ && @HAVE_MBRTOWC@) || @REPLACE_MBSTATE_T@
+# if !GNULIB_defined_mbstate_t
 typedef int rpl_mbstate_t;
-# undef mbstate_t
-# define mbstate_t rpl_mbstate_t
-# define GNULIB_defined_mbstate_t 1
+#  undef mbstate_t
+#  define mbstate_t rpl_mbstate_t
+#  define GNULIB_defined_mbstate_t 1
+# endif
 #endif
 
 
@@ -428,6 +430,493 @@ _GL_WARN_ON_USE (wcwidth, "wcwidth is unportable - "
 #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));
+# endif
+_GL_CXXALIAS_SYS (wmemchr, wchar_t *, (const wchar_t *s, wchar_t c, size_t n));
+_GL_CXXALIASWARN (wmemchr);
+#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 !@HAVE_WMEMCMP@
+_GL_FUNCDECL_SYS (wmemcmp, int,
+                  (const wchar_t *s1, const wchar_t *s2, size_t n));
+# endif
+_GL_CXXALIAS_SYS (wmemcmp, int,
+                  (const wchar_t *s1, const wchar_t *s2, size_t n));
+_GL_CXXALIASWARN (wmemcmp);
+#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 *dest, const wchar_t *src, size_t n));
+# endif
+_GL_CXXALIAS_SYS (wmemcpy, wchar_t *,
+                  (wchar_t *dest, const wchar_t *src, size_t n));
+_GL_CXXALIASWARN (wmemcpy);
+#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));
+_GL_CXXALIASWARN (wmemmove);
+#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
+
+
+/* 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));
+_GL_CXXALIASWARN (wmemset);
+#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));
+# endif
+_GL_CXXALIAS_SYS (wcslen, size_t, (const wchar_t *s));
+_GL_CXXALIASWARN (wcslen);
+#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@
+# if !@HAVE_WCSNLEN@
+_GL_FUNCDECL_SYS (wcsnlen, size_t, (const wchar_t *s, size_t maxlen));
+# 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 *dest, const wchar_t *src));
+# endif
+_GL_CXXALIAS_SYS (wcscpy, wchar_t *, (wchar_t *dest, const wchar_t *src));
+_GL_CXXALIASWARN (wcscpy);
+#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@
+# if !@HAVE_WCPCPY@
+_GL_FUNCDECL_SYS (wcpcpy, wchar_t *, (wchar_t *dest, const wchar_t *src));
+# endif
+_GL_CXXALIAS_SYS (wcpcpy, wchar_t *, (wchar_t *dest, const wchar_t *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 *dest, const wchar_t *src, size_t n));
+# endif
+_GL_CXXALIAS_SYS (wcsncpy, wchar_t *,
+                  (wchar_t *dest, const wchar_t *src, size_t n));
+_GL_CXXALIASWARN (wcsncpy);
+#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@
+# if !@HAVE_WCPNCPY@
+_GL_FUNCDECL_SYS (wcpncpy, wchar_t *,
+                  (wchar_t *dest, const wchar_t *src, size_t n));
+# endif
+_GL_CXXALIAS_SYS (wcpncpy, wchar_t *,
+                  (wchar_t *dest, const wchar_t *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 *dest, const wchar_t *src));
+# endif
+_GL_CXXALIAS_SYS (wcscat, wchar_t *, (wchar_t *dest, const wchar_t *src));
+_GL_CXXALIASWARN (wcscat);
+#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 *dest, const wchar_t *src, size_t n));
+# endif
+_GL_CXXALIAS_SYS (wcsncat, wchar_t *,
+                  (wchar_t *dest, const wchar_t *src, size_t n));
+_GL_CXXALIASWARN (wcsncat);
+#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 !@HAVE_WCSCMP@
+_GL_FUNCDECL_SYS (wcscmp, int, (const wchar_t *s1, const wchar_t *s2));
+# endif
+_GL_CXXALIAS_SYS (wcscmp, int, (const wchar_t *s1, const wchar_t *s2));
+_GL_CXXALIASWARN (wcscmp);
+#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 !@HAVE_WCSNCMP@
+_GL_FUNCDECL_SYS (wcsncmp, int,
+                  (const wchar_t *s1, const wchar_t *s2, size_t n));
+# endif
+_GL_CXXALIAS_SYS (wcsncmp, int,
+                  (const wchar_t *s1, const wchar_t *s2, size_t n));
+_GL_CXXALIASWARN (wcsncmp);
+#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@
+# if !@HAVE_WCSCASECMP@
+_GL_FUNCDECL_SYS (wcscasecmp, int, (const wchar_t *s1, const wchar_t *s2));
+# 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@
+# if !@HAVE_WCSNCASECMP@
+_GL_FUNCDECL_SYS (wcsncasecmp, int,
+                  (const wchar_t *s1, const wchar_t *s2, size_t n));
+# 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));
+_GL_CXXALIASWARN (wcscoll);
+#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 *s1, const wchar_t *s2, size_t n));
+# endif
+_GL_CXXALIAS_SYS (wcsxfrm, size_t, (wchar_t *s1, const wchar_t *s2, size_t n));
+_GL_CXXALIASWARN (wcsxfrm);
+#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 !@HAVE_WCSDUP@
+_GL_FUNCDECL_SYS (wcsdup, wchar_t *, (const wchar_t *s));
+# endif
+_GL_CXXALIAS_SYS (wcsdup, wchar_t *, (const wchar_t *s));
+_GL_CXXALIASWARN (wcsdup);
+#elif 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
+#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));
+# endif
+_GL_CXXALIAS_SYS (wcschr, wchar_t *, (const wchar_t *wcs, wchar_t wc));
+_GL_CXXALIASWARN (wcschr);
+#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));
+# endif
+_GL_CXXALIAS_SYS (wcsrchr, wchar_t *, (const wchar_t *wcs, wchar_t wc));
+_GL_CXXALIASWARN (wcsrchr);
+#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 segmet 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));
+# endif
+_GL_CXXALIAS_SYS (wcscspn, size_t, (const wchar_t *wcs, const wchar_t *reject));
+_GL_CXXALIASWARN (wcscspn);
+#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 segmet 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));
+# endif
+_GL_CXXALIAS_SYS (wcsspn, size_t, (const wchar_t *wcs, const wchar_t *accept));
+_GL_CXXALIASWARN (wcsspn);
+#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));
+# endif
+_GL_CXXALIAS_SYS (wcspbrk, wchar_t *,
+                  (const wchar_t *wcs, const wchar_t *accept));
+_GL_CXXALIASWARN (wcspbrk);
+#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 !@HAVE_WCSSTR@
+_GL_FUNCDECL_SYS (wcsstr, wchar_t *,
+                  (const wchar_t *haystack, const wchar_t *needle));
+# endif
+_GL_CXXALIAS_SYS (wcsstr, wchar_t *,
+                  (const wchar_t *haystack, const wchar_t *needle));
+_GL_CXXALIASWARN (wcsstr);
+#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 !@HAVE_WCSTOK@
+_GL_FUNCDECL_SYS (wcstok, wchar_t *,
+                  (wchar_t *wcs, const wchar_t *delim, wchar_t **ptr));
+# endif
+_GL_CXXALIAS_SYS (wcstok, wchar_t *,
+                  (wchar_t *wcs, const wchar_t *delim, wchar_t **ptr));
+_GL_CXXALIASWARN (wcstok);
+#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_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));
+#  endif
+_GL_CXXALIAS_SYS (wcswidth, int, (const wchar_t *s, size_t n));
+# endif
+_GL_CXXALIASWARN (wcswidth);
+#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
+
+
 #endif /* _GL_WCHAR_H */
 #endif /* _GL_WCHAR_H */
 #endif
diff --git a/lib/wcpcpy-impl.h b/lib/wcpcpy-impl.h
new file mode 100644 (file)
index 0000000..f7f0f7d
--- /dev/null
@@ -0,0 +1,24 @@
+/* Copy a wide string.
+   Copyright (C) 1999, 2011 Free Software Foundation, Inc.
+   Written by Bruno Haible <bruno@clisp.org>, 1999.
+
+   This program is free software: you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation; either version 3 of the License, or
+   (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
+
+wchar_t *
+wcpcpy (wchar_t *dest, const wchar_t *src)
+{
+  for (; (*dest = *src) != (wchar_t)'\0'; src++, dest++)
+    ;
+  return dest;
+}
diff --git a/lib/wcpcpy.c b/lib/wcpcpy.c
new file mode 100644 (file)
index 0000000..fdc29fc
--- /dev/null
@@ -0,0 +1,23 @@
+/* Copy a wide string.
+   Copyright (C) 2011 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 <http://www.gnu.org/licenses/>.  */
+
+#include <config.h>
+
+/* Specification.  */
+#include <wchar.h>
+
+#include "wcpcpy-impl.h"
diff --git a/lib/wcpncpy-impl.h b/lib/wcpncpy-impl.h
new file mode 100644 (file)
index 0000000..bdb290f
--- /dev/null
@@ -0,0 +1,30 @@
+/* Copy a size-bounded wide string.
+   Copyright (C) 1999, 2011 Free Software Foundation, Inc.
+   Written by Bruno Haible <bruno@clisp.org>, 1999.
+
+   This program is free software: you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation; either version 3 of the License, or
+   (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
+
+wchar_t *
+wcpncpy (wchar_t *dest, const wchar_t *src, size_t n)
+{
+  for (; n > 0 && (*dest = *src) != (wchar_t)'\0'; src++, dest++, n--)
+    ;
+
+  /* This behavior is rarely useful, but it is here for consistency with
+     wcsncpy.  */
+  for (; n > 0; n--)
+    *dest++ = (wchar_t)'\0';
+
+  return dest-1;
+}
diff --git a/lib/wcpncpy.c b/lib/wcpncpy.c
new file mode 100644 (file)
index 0000000..287eec7
--- /dev/null
@@ -0,0 +1,23 @@
+/* Copy a size-bounded wide string.
+   Copyright (C) 2011 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 <http://www.gnu.org/licenses/>.  */
+
+#include <config.h>
+
+/* Specification.  */
+#include <wchar.h>
+
+#include "wcpncpy-impl.h"
diff --git a/lib/wcscasecmp-impl.h b/lib/wcscasecmp-impl.h
new file mode 100644 (file)
index 0000000..8c716fa
--- /dev/null
@@ -0,0 +1,32 @@
+/* Compare two wide strings ignoring case.
+   Copyright (C) 1999, 2011 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 <http://www.gnu.org/licenses/>.  */
+
+int
+wcscasecmp (const wchar_t *s1, const wchar_t *s2)
+{
+  for (;;)
+    {
+      wchar_t wc1 = towlower (*s1++);
+      wchar_t wc2 = towlower (*s2++);
+      if (wc1 != (wchar_t)'\0' && wc1 == wc2)
+        continue;
+      /* Note that wc1 and wc2 each have at most 31 bits.  */
+      return (int)wc1 - (int)wc2;
+             /* > 0 if wc1 > wc2, < 0 if wc1 < wc2,
+                = 0 if wc1 and wc2 are both '\0'.  */
+    }
+}
diff --git a/lib/wcscasecmp.c b/lib/wcscasecmp.c
new file mode 100644 (file)
index 0000000..f3796e0
--- /dev/null
@@ -0,0 +1,25 @@
+/* Compare two wide strings ignoring case.
+   Copyright (C) 2011 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 <http://www.gnu.org/licenses/>.  */
+
+#include <config.h>
+
+/* Specification.  */
+#include <wchar.h>
+
+#include <wctype.h>
+
+#include "wcscasecmp-impl.h"
diff --git a/lib/wcscat-impl.h b/lib/wcscat-impl.h
new file mode 100644 (file)
index 0000000..7f92c56
--- /dev/null
@@ -0,0 +1,26 @@
+/* Concatenate two wide strings.
+   Copyright (C) 1999, 2011 Free Software Foundation, Inc.
+   Written by Bruno Haible <bruno@clisp.org>, 1999.
+
+   This program is free software: you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation; either version 3 of the License, or
+   (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
+
+wchar_t *
+wcscat (wchar_t *dest, const wchar_t *src)
+{
+  wchar_t *destptr = dest + wcslen (dest);
+
+  for (; (*destptr = *src) != (wchar_t)'\0'; src++, destptr++)
+    ;
+  return dest;
+}
diff --git a/lib/wcscat.c b/lib/wcscat.c
new file mode 100644 (file)
index 0000000..f0894f7
--- /dev/null
@@ -0,0 +1,23 @@
+/* Concatenate two wide strings.
+   Copyright (C) 2011 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 <http://www.gnu.org/licenses/>.  */
+
+#include <config.h>
+
+/* Specification.  */
+#include <wchar.h>
+
+#include "wcscat-impl.h"
diff --git a/lib/wcschr-impl.h b/lib/wcschr-impl.h
new file mode 100644 (file)
index 0000000..2d146d3
--- /dev/null
@@ -0,0 +1,32 @@
+/* Search wide string for a wide character.
+   Copyright (C) 1999, 2011 Free Software Foundation, Inc.
+   Written by Bruno Haible <bruno@clisp.org>, 1999.
+
+   This program is free software: you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation; either version 3 of the License, or
+   (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
+
+wchar_t *
+wcschr (const wchar_t *wcs, wchar_t wc)
+{
+  for (;; wcs++)
+    {
+      if (*wcs == wc)
+        break;
+      if (*wcs == (wchar_t)'\0')
+        goto notfound;
+    }
+  return (wchar_t *) wcs;
+
+ notfound:
+  return NULL;
+}
diff --git a/lib/wcschr.c b/lib/wcschr.c
new file mode 100644 (file)
index 0000000..988b897
--- /dev/null
@@ -0,0 +1,23 @@
+/* Search wide string for a wide character.
+   Copyright (C) 2011 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 <http://www.gnu.org/licenses/>.  */
+
+#include <config.h>
+
+/* Specification.  */
+#include <wchar.h>
+
+#include "wcschr-impl.h"
diff --git a/lib/wcscmp-impl.h b/lib/wcscmp-impl.h
new file mode 100644 (file)
index 0000000..1c384c6
--- /dev/null
@@ -0,0 +1,32 @@
+/* Compare two wide strings.
+   Copyright (C) 1999, 2011 Free Software Foundation, Inc.
+   Written by Bruno Haible <bruno@clisp.org>, 1999.
+
+   This program is free software: you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation; either version 3 of the License, or
+   (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
+
+int
+wcscmp (const wchar_t *s1, const wchar_t *s2)
+{
+  for (;;)
+    {
+      wchar_t wc1 = *s1++;
+      wchar_t wc2 = *s2++;
+      if (wc1 != (wchar_t)'\0' && wc1 == wc2)
+        continue;
+      /* Note that wc1 and wc2 each have at most 31 bits.  */
+      return (int)wc1 - (int)wc2;
+             /* > 0 if wc1 > wc2, < 0 if wc1 < wc2,
+                = 0 if wc1 and wc2 are both '\0'.  */
+    }
+}
diff --git a/lib/wcscmp.c b/lib/wcscmp.c
new file mode 100644 (file)
index 0000000..9a73a25
--- /dev/null
@@ -0,0 +1,23 @@
+/* Compare two wide strings.
+   Copyright (C) 2011 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 <http://www.gnu.org/licenses/>.  */
+
+#include <config.h>
+
+/* Specification.  */
+#include <wchar.h>
+
+#include "wcscmp-impl.h"
diff --git a/lib/wcscoll-impl.h b/lib/wcscoll-impl.h
new file mode 100644 (file)
index 0000000..01adcc3
--- /dev/null
@@ -0,0 +1,111 @@
+/* Compare two wide strings using the current locale.
+   Copyright (C) 2011 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 <http://www.gnu.org/licenses/>.  */
+
+int
+wcscoll (const wchar_t *s1, const wchar_t *s2)
+{
+  char mbbuf1[1024];
+  char mbbuf2[1024];
+  char *mbs1;
+  char *mbs2;
+
+  {
+    int saved_errno = errno;
+
+    /* Convert s1 to a multibyte string, trying to avoid malloc().  */
+    {
+      size_t ret;
+
+      ret = wcstombs (mbbuf1, s1, sizeof (mbbuf1));
+      if (ret == (size_t)-1)
+        goto failed1;
+      if (ret < sizeof (mbbuf1))
+        mbs1 = mbbuf1;
+      else
+        {
+          size_t need = wcstombs (NULL, s1, 0);
+          if (need == (size_t)-1)
+            goto failed1;
+          mbs1 = (char *) malloc (need + 1);
+          if (mbs1 == NULL)
+            goto out_of_memory1;
+          ret = wcstombs (mbs1, s1, need + 1);
+          if (ret != need)
+            abort ();
+        }
+    }
+
+    /* Convert s2 to a multibyte string, trying to avoid malloc().  */
+    {
+      size_t ret;
+
+      ret = wcstombs (mbbuf2, s2, sizeof (mbbuf2));
+      if (ret == (size_t)-1)
+        goto failed2;
+      if (ret < sizeof (mbbuf2))
+        mbs2 = mbbuf2;
+      else
+        {
+          size_t need = wcstombs (NULL, s2, 0);
+          if (need == (size_t)-1)
+            goto failed2;
+          mbs2 = (char *) malloc (need + 1);
+          if (mbs2 == NULL)
+            goto out_of_memory2;
+          ret = wcstombs (mbs2, s2, need + 1);
+          if (ret != need)
+            abort ();
+        }
+    }
+
+    /* No error so far.  */
+    errno = saved_errno;
+  }
+
+  /* Compare the two multibyte strings.  */
+  {
+    int result = strcoll (mbs1, mbs2);
+
+    if (mbs1 != mbbuf1)
+      {
+        int saved_errno = errno;
+        free (mbs1);
+        errno = saved_errno;
+      }
+    if (mbs2 != mbbuf2)
+      {
+        int saved_errno = errno;
+        free (mbs2);
+        errno = saved_errno;
+      }
+    return result;
+  }
+
+ out_of_memory2:
+  if (mbs1 != mbbuf1)
+    free (mbs1);
+ out_of_memory1:
+  errno = ENOMEM;
+  return 0;
+
+ failed2:
+  if (mbs1 != mbbuf1)
+    free (mbs1);
+ failed1:
+  errno = EILSEQ;
+  return 0;
+}
diff --git a/lib/wcscoll.c b/lib/wcscoll.c
new file mode 100644 (file)
index 0000000..4605c5b
--- /dev/null
@@ -0,0 +1,27 @@
+/* Compare two wide strings using the current locale.
+   Copyright (C) 2011 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 <http://www.gnu.org/licenses/>.  */
+
+#include <config.h>
+
+/* Specification.  */
+#include <wchar.h>
+
+#include <errno.h>
+#include <stdlib.h>
+#include <string.h>
+
+#include "wcscoll-impl.h"
diff --git a/lib/wcscpy-impl.h b/lib/wcscpy-impl.h
new file mode 100644 (file)
index 0000000..cdc4bcc
--- /dev/null
@@ -0,0 +1,26 @@
+/* Copy a wide string.
+   Copyright (C) 1999, 2011 Free Software Foundation, Inc.
+   Written by Bruno Haible <bruno@clisp.org>, 1999.
+
+   This program is free software: you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation; either version 3 of the License, or
+   (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
+
+wchar_t *
+wcscpy (wchar_t *dest, const wchar_t *src)
+{
+  wchar_t *destptr = dest;
+
+  for (; (*destptr = *src) != (wchar_t)'\0'; src++, destptr++)
+    ;
+  return dest;
+}
diff --git a/lib/wcscpy.c b/lib/wcscpy.c
new file mode 100644 (file)
index 0000000..136a493
--- /dev/null
@@ -0,0 +1,23 @@
+/* Copy a wide string.
+   Copyright (C) 2011 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 <http://www.gnu.org/licenses/>.  */
+
+#include <config.h>
+
+/* Specification.  */
+#include <wchar.h>
+
+#include "wcscpy-impl.h"
diff --git a/lib/wcscspn-impl.h b/lib/wcscspn-impl.h
new file mode 100644 (file)
index 0000000..0c6452f
--- /dev/null
@@ -0,0 +1,47 @@
+/* Search a wide string for any of a set of wide characters.
+   Copyright (C) 1999, 2011 Free Software Foundation, Inc.
+   Written by Bruno Haible <bruno@clisp.org>, 1999.
+
+   This program is free software: you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation; either version 3 of the License, or
+   (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
+
+size_t
+wcscspn (const wchar_t *wcs, const wchar_t *reject)
+{
+  /* Optimize two cases.  */
+  if (reject[0] == (wchar_t)'\0')
+    return wcslen (wcs);
+
+  if (reject[1] == (wchar_t)'\0')
+    {
+      wchar_t wc = reject[0];
+      const wchar_t *ptr = wcs;
+      for (; *ptr != (wchar_t)'\0'; ptr++)
+        {
+          if (*ptr == wc)
+            break;
+        }
+      return ptr - wcs;
+    }
+
+  /* General case.  */
+  {
+    const wchar_t *ptr = wcs;
+    for (; *ptr != (wchar_t)'\0'; ptr++)
+      {
+        if (wcschr (reject, *ptr))
+          break;
+      }
+    return ptr - wcs;
+  }
+}
diff --git a/lib/wcscspn.c b/lib/wcscspn.c
new file mode 100644 (file)
index 0000000..3a2f33a
--- /dev/null
@@ -0,0 +1,23 @@
+/* Search a wide string for any of a set of wide characters.
+   Copyright (C) 2011 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 <http://www.gnu.org/licenses/>.  */
+
+#include <config.h>
+
+/* Specification.  */
+#include <wchar.h>
+
+#include "wcscspn-impl.h"
diff --git a/lib/wcsdup-impl.h b/lib/wcsdup-impl.h
new file mode 100644 (file)
index 0000000..f721ca1
--- /dev/null
@@ -0,0 +1,29 @@
+/* Duplicate a wide string.
+   Copyright (C) 1999, 2011 Free Software Foundation, Inc.
+   Written by Bruno Haible <bruno@clisp.org>, 1999.
+
+   This program is free software: you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation; either version 3 of the License, or
+   (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
+
+wchar_t *
+wcsdup (const wchar_t *s)
+{
+  size_t n = wcslen (s) + 1;
+  wchar_t *copy = (wchar_t *) malloc (n * sizeof (wchar_t));
+  if (copy != NULL)
+    return wmemcpy (copy, s, n);
+  else
+    /* The glibc documentation does not say that errno should be set to ENOMEM
+       here.  */
+    return NULL;
+}
diff --git a/lib/wcsdup.c b/lib/wcsdup.c
new file mode 100644 (file)
index 0000000..b55e630
--- /dev/null
@@ -0,0 +1,25 @@
+/* Duplicate a wide string.
+   Copyright (C) 2011 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 <http://www.gnu.org/licenses/>.  */
+
+#include <config.h>
+
+/* Specification.  */
+#include <wchar.h>
+
+#include <stdlib.h>
+
+#include "wcsdup-impl.h"
diff --git a/lib/wcslen-impl.h b/lib/wcslen-impl.h
new file mode 100644 (file)
index 0000000..6dbe927
--- /dev/null
@@ -0,0 +1,26 @@
+/* Determine the length of a wide string.
+   Copyright (C) 1999, 2011 Free Software Foundation, Inc.
+   Written by Bruno Haible <bruno@clisp.org>, 1999.
+
+   This program is free software: you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation; either version 3 of the License, or
+   (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
+
+size_t
+wcslen (const wchar_t *s)
+{
+  const wchar_t *ptr;
+
+  for (ptr = s; *ptr != (wchar_t)'\0'; ptr++)
+    ;
+  return ptr - s;
+}
diff --git a/lib/wcslen.c b/lib/wcslen.c
new file mode 100644 (file)
index 0000000..23132dd
--- /dev/null
@@ -0,0 +1,23 @@
+/* Determine the length of a wide string.
+   Copyright (C) 2011 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 <http://www.gnu.org/licenses/>.  */
+
+#include <config.h>
+
+/* Specification.  */
+#include <wchar.h>
+
+#include "wcslen-impl.h"
diff --git a/lib/wcsncasecmp-impl.h b/lib/wcsncasecmp-impl.h
new file mode 100644 (file)
index 0000000..234f27a
--- /dev/null
@@ -0,0 +1,36 @@
+/* Compare two wide strings ignoring case.
+   Copyright (C) 1999, 2011 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 <http://www.gnu.org/licenses/>.  */
+
+int
+wcsncasecmp (const wchar_t *s1, const wchar_t *s2, size_t n)
+{
+  for (; n > 0;)
+    {
+      wchar_t wc1 = towlower (*s1++);
+      wchar_t wc2 = towlower (*s2++);
+      if (wc1 != (wchar_t)'\0' && wc1 == wc2)
+        {
+          n--;
+          continue;
+        }
+      /* Note that wc1 and wc2 each have at most 31 bits.  */
+      return (int)wc1 - (int)wc2;
+             /* > 0 if wc1 > wc2, < 0 if wc1 < wc2,
+                = 0 if wc1 and wc2 are both '\0'.  */
+    }
+  return 0;
+}
diff --git a/lib/wcsncasecmp.c b/lib/wcsncasecmp.c
new file mode 100644 (file)
index 0000000..d2fafdd
--- /dev/null
@@ -0,0 +1,25 @@
+/* Compare two wide strings ignoring case.
+   Copyright (C) 2011 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 <http://www.gnu.org/licenses/>.  */
+
+#include <config.h>
+
+/* Specification.  */
+#include <wchar.h>
+
+#include <wctype.h>
+
+#include "wcsncasecmp-impl.h"
diff --git a/lib/wcsncat-impl.h b/lib/wcsncat-impl.h
new file mode 100644 (file)
index 0000000..23b7c83
--- /dev/null
@@ -0,0 +1,28 @@
+/* Append part of a wide string to a wide string.
+   Copyright (C) 1999, 2011 Free Software Foundation, Inc.
+   Written by Bruno Haible <bruno@clisp.org>, 1999.
+
+   This program is free software: you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation; either version 3 of the License, or
+   (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
+
+wchar_t *
+wcsncat (wchar_t *dest, const wchar_t *src, size_t n)
+{
+  wchar_t *destptr = dest + wcslen (dest);
+
+  for (; n > 0 && (*destptr = *src) != (wchar_t)'\0'; src++, destptr++, n--)
+    ;
+  if (n == 0)
+    *destptr = (wchar_t)'\0';
+  return dest;
+}
diff --git a/lib/wcsncat.c b/lib/wcsncat.c
new file mode 100644 (file)
index 0000000..855fbee
--- /dev/null
@@ -0,0 +1,23 @@
+/* Append part of a wide string to a wide string.
+   Copyright (C) 2011 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 <http://www.gnu.org/licenses/>.  */
+
+#include <config.h>
+
+/* Specification.  */
+#include <wchar.h>
+
+#include "wcsncat-impl.h"
diff --git a/lib/wcsncmp-impl.h b/lib/wcsncmp-impl.h
new file mode 100644 (file)
index 0000000..72f8c63
--- /dev/null
@@ -0,0 +1,36 @@
+/* Compare two wide strings.
+   Copyright (C) 1999, 2011 Free Software Foundation, Inc.
+   Written by Bruno Haible <bruno@clisp.org>, 1999.
+
+   This program is free software: you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation; either version 3 of the License, or
+   (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
+
+int
+wcsncmp (const wchar_t *s1, const wchar_t *s2, size_t n)
+{
+  for (; n > 0;)
+    {
+      wchar_t wc1 = *s1++;
+      wchar_t wc2 = *s2++;
+      if (wc1 != (wchar_t)'\0' && wc1 == wc2)
+        {
+          n--;
+          continue;
+        }
+      /* Note that wc1 and wc2 each have at most 31 bits.  */
+      return (int)wc1 - (int)wc2;
+             /* > 0 if wc1 > wc2, < 0 if wc1 < wc2,
+                = 0 if wc1 and wc2 are both '\0'.  */
+    }
+  return 0;
+}
diff --git a/lib/wcsncmp.c b/lib/wcsncmp.c
new file mode 100644 (file)
index 0000000..b2bfa8e
--- /dev/null
@@ -0,0 +1,23 @@
+/* Compare two wide strings.
+   Copyright (C) 2011 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 <http://www.gnu.org/licenses/>.  */
+
+#include <config.h>
+
+/* Specification.  */
+#include <wchar.h>
+
+#include "wcsncmp-impl.h"
diff --git a/lib/wcsncpy-impl.h b/lib/wcsncpy-impl.h
new file mode 100644 (file)
index 0000000..63925bb
--- /dev/null
@@ -0,0 +1,32 @@
+/* Copy a size-bounded wide string.
+   Copyright (C) 1999, 2011 Free Software Foundation, Inc.
+   Written by Bruno Haible <bruno@clisp.org>, 1999.
+
+   This program is free software: you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation; either version 3 of the License, or
+   (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
+
+wchar_t *
+wcsncpy (wchar_t *dest, const wchar_t *src, size_t n)
+{
+  wchar_t *destptr = dest;
+
+  for (; n > 0 && (*destptr = *src) != (wchar_t)'\0'; src++, destptr++, n--)
+    ;
+
+  /* This behavior is rarely useful, but it is specified by the ISO C
+     standard.  */
+  for (; n > 0; n--)
+    *destptr++ = (wchar_t)'\0';
+
+  return dest;
+}
diff --git a/lib/wcsncpy.c b/lib/wcsncpy.c
new file mode 100644 (file)
index 0000000..e97e40b
--- /dev/null
@@ -0,0 +1,23 @@
+/* Copy a size-bounded wide string.
+   Copyright (C) 2011 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 <http://www.gnu.org/licenses/>.  */
+
+#include <config.h>
+
+/* Specification.  */
+#include <wchar.h>
+
+#include "wcsncpy-impl.h"
diff --git a/lib/wcsnlen-impl.h b/lib/wcsnlen-impl.h
new file mode 100644 (file)
index 0000000..6cf4d07
--- /dev/null
@@ -0,0 +1,26 @@
+/* Determine the length of a size-bounded wide string.
+   Copyright (C) 1999, 2011 Free Software Foundation, Inc.
+   Written by Bruno Haible <bruno@clisp.org>, 1999.
+
+   This program is free software: you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation; either version 3 of the License, or
+   (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
+
+size_t
+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;
+}
diff --git a/lib/wcsnlen.c b/lib/wcsnlen.c
new file mode 100644 (file)
index 0000000..1232c1f
--- /dev/null
@@ -0,0 +1,23 @@
+/* Determine the length of a size-bounded wide string.
+   Copyright (C) 2011 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 <http://www.gnu.org/licenses/>.  */
+
+#include <config.h>
+
+/* Specification.  */
+#include <wchar.h>
+
+#include "wcsnlen-impl.h"
diff --git a/lib/wcsnrtombs-impl.h b/lib/wcsnrtombs-impl.h
new file mode 100644 (file)
index 0000000..5ba63cc
--- /dev/null
@@ -0,0 +1,90 @@
+/* Convert wide string to string.
+   Copyright (C) 2008-2011 Free Software Foundation, Inc.
+   Written by Bruno Haible <bruno@clisp.org>, 2008.
+
+   This program is free software: you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation; either version 3 of the License, or
+   (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
+
+size_t
+wcsnrtombs (char *dest, const wchar_t **srcp, size_t srclen, size_t len, mbstate_t *ps)
+{
+  if (ps == NULL)
+    ps = &_gl_wcsrtombs_state;
+  {
+    const wchar_t *src = *srcp;
+    size_t cur_max = MB_CUR_MAX;
+    char buf[64];
+
+    if (!(cur_max <= sizeof (buf)))
+      abort ();
+
+    if (dest != NULL)
+      {
+        char *destptr = dest;
+
+        for (; srclen > 0 && len > 0; src++, srclen--)
+          {
+            wchar_t wc = *src;
+            size_t ret = wcrtomb (len >= cur_max ? destptr : buf, wc, ps);
+
+            if (ret == (size_t)(-1))
+              goto bad_input;
+            if (!(ret <= cur_max))
+              abort ();
+            if (len < ret)
+              break;
+            if (len < cur_max)
+              memcpy (destptr, buf, ret);
+            if (wc == 0)
+              {
+                src = NULL;
+                /* Here mbsinit (ps).  */
+                break;
+              }
+            destptr += ret;
+            len -= 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 (; srclen > 0; src++, srclen--)
+          {
+            wchar_t wc = *src;
+            size_t ret = wcrtomb (buf, wc, &state);
+
+            if (ret == (size_t)(-1))
+              goto bad_input2;
+            if (wc == 0)
+              {
+                /* Here mbsinit (&state).  */
+                break;
+              }
+            totalcount += ret;
+          }
+        return totalcount;
+      }
+
+   bad_input:
+    *srcp = src;
+   bad_input2:
+    errno = EILSEQ;
+    return (size_t)(-1);
+  }
+}
index 0e0750b..a92207c 100644 (file)
 
 extern mbstate_t _gl_wcsrtombs_state;
 
-size_t
-wcsnrtombs (char *dest, const wchar_t **srcp, size_t srclen, size_t len, mbstate_t *ps)
-{
-  if (ps == NULL)
-    ps = &_gl_wcsrtombs_state;
-  {
-    const wchar_t *src = *srcp;
-    size_t cur_max = MB_CUR_MAX;
-    char buf[64];
-
-    if (!(cur_max <= sizeof (buf)))
-      abort ();
-
-    if (dest != NULL)
-      {
-        char *destptr = dest;
-
-        for (; srclen > 0 && len > 0; src++, srclen--)
-          {
-            wchar_t wc = *src;
-            size_t ret = wcrtomb (len >= cur_max ? destptr : buf, wc, ps);
-
-            if (ret == (size_t)(-1))
-              goto bad_input;
-            if (!(ret <= cur_max))
-              abort ();
-            if (len < ret)
-              break;
-            if (len < cur_max)
-              memcpy (destptr, buf, ret);
-            if (wc == 0)
-              {
-                src = NULL;
-                /* Here mbsinit (ps).  */
-                break;
-              }
-            destptr += ret;
-            len -= 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 (; srclen > 0; src++, srclen--)
-          {
-            wchar_t wc = *src;
-            size_t ret = wcrtomb (buf, wc, &state);
-
-            if (ret == (size_t)(-1))
-              goto bad_input2;
-            if (wc == 0)
-              {
-                /* Here mbsinit (&state).  */
-                break;
-              }
-            totalcount += ret;
-          }
-        return totalcount;
-      }
-
-   bad_input:
-    *srcp = src;
-   bad_input2:
-    errno = EILSEQ;
-    return (size_t)(-1);
-  }
-}
+#include "wcsnrtombs-impl.h"
diff --git a/lib/wcspbrk-impl.h b/lib/wcspbrk-impl.h
new file mode 100644 (file)
index 0000000..3862e7a
--- /dev/null
@@ -0,0 +1,47 @@
+/* Search a wide string for any of a set of wide characters.
+   Copyright (C) 1999, 2011 Free Software Foundation, Inc.
+   Written by Bruno Haible <bruno@clisp.org>, 1999.
+
+   This program is free software: you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation; either version 3 of the License, or
+   (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
+
+wchar_t *
+wcspbrk (const wchar_t *wcs, const wchar_t *accept)
+{
+  /* Optimize two cases.  */
+  if (accept[0] == (wchar_t)'\0')
+    return NULL;
+
+  if (accept[1] == (wchar_t)'\0')
+    {
+      wchar_t wc = accept[0];
+      const wchar_t *ptr = wcs;
+      for (; *ptr != (wchar_t)'\0'; ptr++)
+        {
+          if (*ptr == wc)
+            return (wchar_t *) ptr;
+        }
+      return NULL;
+    }
+
+  /* General case.  */
+  {
+    const wchar_t *ptr = wcs;
+    for (; *ptr != (wchar_t)'\0'; ptr++)
+      {
+        if (wcschr (accept, *ptr))
+          return (wchar_t *) ptr;
+      }
+    return NULL;
+  }
+}
diff --git a/lib/wcspbrk.c b/lib/wcspbrk.c
new file mode 100644 (file)
index 0000000..2ed7602
--- /dev/null
@@ -0,0 +1,23 @@
+/* Search a wide string for any of a set of wide characters.
+   Copyright (C) 2011 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 <http://www.gnu.org/licenses/>.  */
+
+#include <config.h>
+
+/* Specification.  */
+#include <wchar.h>
+
+#include "wcspbrk-impl.h"
diff --git a/lib/wcsrchr-impl.h b/lib/wcsrchr-impl.h
new file mode 100644 (file)
index 0000000..db3ba06
--- /dev/null
@@ -0,0 +1,33 @@
+/* Search wide string for a wide character.
+   Copyright (C) 1999, 2011 Free Software Foundation, Inc.
+   Written by Bruno Haible <bruno@clisp.org>, 1999.
+
+   This program is free software: you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation; either version 3 of the License, or
+   (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
+
+wchar_t *
+wcsrchr (const wchar_t *wcs, wchar_t wc)
+{
+  /* Calling wcslen and then searching from the other end would cause more
+     memory accesses.  Avoid that, at the cost of a few more comparisons.  */
+  wchar_t *result = NULL;
+
+  for (;; wcs++)
+    {
+      if (*wcs == wc)
+        result = (wchar_t *) wcs;
+      if (*wcs == (wchar_t)'\0')
+        break;
+    }
+  return result;
+}
diff --git a/lib/wcsrchr.c b/lib/wcsrchr.c
new file mode 100644 (file)
index 0000000..a717801
--- /dev/null
@@ -0,0 +1,23 @@
+/* Search wide string for a wide character.
+   Copyright (C) 2011 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 <http://www.gnu.org/licenses/>.  */
+
+#include <config.h>
+
+/* Specification.  */
+#include <wchar.h>
+
+#include "wcsrchr-impl.h"
diff --git a/lib/wcsrtombs-impl.h b/lib/wcsrtombs-impl.h
new file mode 100644 (file)
index 0000000..a0a522e
--- /dev/null
@@ -0,0 +1,90 @@
+/* Convert wide string to string.
+   Copyright (C) 2008, 2010-2011 Free Software Foundation, Inc.
+   Written by Bruno Haible <bruno@clisp.org>, 2008.
+
+   This program is free software: you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation; either version 3 of the License, or
+   (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
+
+size_t
+wcsrtombs (char *dest, const wchar_t **srcp, size_t len, mbstate_t *ps)
+{
+  if (ps == NULL)
+    ps = &_gl_wcsrtombs_state;
+  {
+    const wchar_t *src = *srcp;
+    size_t cur_max = MB_CUR_MAX;
+    char buf[64];
+
+    if (!(cur_max <= sizeof (buf)))
+      abort ();
+
+    if (dest != NULL)
+      {
+        char *destptr = dest;
+
+        for (; len > 0; src++)
+          {
+            wchar_t wc = *src;
+            size_t ret = wcrtomb (len >= cur_max ? destptr : buf, wc, ps);
+
+            if (ret == (size_t)(-1))
+              goto bad_input;
+            if (!(ret <= cur_max))
+              abort ();
+            if (len < ret)
+              break;
+            if (len < cur_max)
+              memcpy (destptr, buf, ret);
+            if (wc == 0)
+              {
+                src = NULL;
+                /* Here mbsinit (ps).  */
+                break;
+              }
+            destptr += ret;
+            len -= 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 (;; src++)
+          {
+            wchar_t wc = *src;
+            size_t ret = wcrtomb (buf, wc, &state);
+
+            if (ret == (size_t)(-1))
+              goto bad_input2;
+            if (wc == 0)
+              {
+                /* Here mbsinit (&state).  */
+                break;
+              }
+            totalcount += ret;
+          }
+        return totalcount;
+      }
+
+   bad_input:
+    *srcp = src;
+   bad_input2:
+    errno = EILSEQ;
+    return (size_t)(-1);
+  }
+}
index be88e31..72423b5 100644 (file)
@@ -51,78 +51,6 @@ rpl_wcsrtombs (char *dest, const wchar_t **srcp, size_t len, mbstate_t *ps)
 # include <stdlib.h>
 # include <string.h>
 
-size_t
-wcsrtombs (char *dest, const wchar_t **srcp, size_t len, mbstate_t *ps)
-{
-  if (ps == NULL)
-    ps = &_gl_wcsrtombs_state;
-  {
-    const wchar_t *src = *srcp;
-    size_t cur_max = MB_CUR_MAX;
-    char buf[64];
-
-    if (!(cur_max <= sizeof (buf)))
-      abort ();
-
-    if (dest != NULL)
-      {
-        char *destptr = dest;
-
-        for (; len > 0; src++)
-          {
-            wchar_t wc = *src;
-            size_t ret = wcrtomb (len >= cur_max ? destptr : buf, wc, ps);
-
-            if (ret == (size_t)(-1))
-              goto bad_input;
-            if (!(ret <= cur_max))
-              abort ();
-            if (len < ret)
-              break;
-            if (len < cur_max)
-              memcpy (destptr, buf, ret);
-            if (wc == 0)
-              {
-                src = NULL;
-                /* Here mbsinit (ps).  */
-                break;
-              }
-            destptr += ret;
-            len -= 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 (;; src++)
-          {
-            wchar_t wc = *src;
-            size_t ret = wcrtomb (buf, wc, &state);
-
-            if (ret == (size_t)(-1))
-              goto bad_input2;
-            if (wc == 0)
-              {
-                /* Here mbsinit (&state).  */
-                break;
-              }
-            totalcount += ret;
-          }
-        return totalcount;
-      }
-
-   bad_input:
-    *srcp = src;
-   bad_input2:
-    errno = EILSEQ;
-    return (size_t)(-1);
-  }
-}
+# include "wcsrtombs-impl.h"
 
 #endif
diff --git a/lib/wcsspn-impl.h b/lib/wcsspn-impl.h
new file mode 100644 (file)
index 0000000..5d13b92
--- /dev/null
@@ -0,0 +1,47 @@
+/* Advance in a wide string, skipping any of a set of wide characters.
+   Copyright (C) 1999, 2011 Free Software Foundation, Inc.
+   Written by Bruno Haible <bruno@clisp.org>, 1999.
+
+   This program is free software: you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation; either version 3 of the License, or
+   (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
+
+size_t
+wcsspn (const wchar_t *wcs, const wchar_t *accept)
+{
+  /* Optimize two cases.  */
+  if (accept[0] == (wchar_t)'\0')
+    return 0;
+
+  if (accept[1] == (wchar_t)'\0')
+    {
+      wchar_t wc = accept[0];
+      const wchar_t *ptr = wcs;
+      for (; *ptr != (wchar_t)'\0'; ptr++)
+        {
+          if (*ptr != wc)
+            break;
+        }
+      return ptr - wcs;
+    }
+
+  /* General case.  */
+  {
+    const wchar_t *ptr = wcs;
+    for (; *ptr != (wchar_t)'\0'; ptr++)
+      {
+        if (!wcschr (accept, *ptr))
+          break;
+      }
+    return ptr - wcs;
+  }
+}
diff --git a/lib/wcsspn.c b/lib/wcsspn.c
new file mode 100644 (file)
index 0000000..1cabf8d
--- /dev/null
@@ -0,0 +1,23 @@
+/* Advance in a wide string, skipping any of a set of wide characters.
+   Copyright (C) 2011 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 <http://www.gnu.org/licenses/>.  */
+
+#include <config.h>
+
+/* Specification.  */
+#include <wchar.h>
+
+#include "wcsspn-impl.h"
diff --git a/lib/wcsstr-impl.h b/lib/wcsstr-impl.h
new file mode 100644 (file)
index 0000000..f3fb3fb
--- /dev/null
@@ -0,0 +1,51 @@
+/* Locate a substring in a wide string.
+   Copyright (C) 1999, 2011 Free Software Foundation, Inc.
+   Written by Bruno Haible <bruno@clisp.org>, 1999.
+
+   This program is free software: you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation; either version 3 of the License, or
+   (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
+
+wchar_t *
+wcsstr (const wchar_t *haystack, const wchar_t *needle)
+{
+  wchar_t n = needle[0];
+
+  /* Is needle empty?  */
+  if (n == (wchar_t)'\0')
+    return (wchar_t *) haystack;
+
+  /* Is needle nearly empty?  */
+  if (needle[1] == (wchar_t)'\0')
+    return wcschr (haystack, n);
+
+  /* Search for needle's first character.  */
+  for (; *haystack != (wchar_t)'\0'; haystack++)
+    {
+      if (*haystack == n)
+        {
+          /* Compare with needle's remaining characters.  */
+          const wchar_t *hptr = haystack + 1;
+          const wchar_t *nptr = needle + 1;
+          for (;;)
+            {
+              if (*hptr != *nptr)
+                break;
+              hptr++; nptr++;
+              if (*nptr == (wchar_t)'\0')
+                return (wchar_t *) haystack;
+            }
+        }
+    }
+
+  return NULL;
+}
diff --git a/lib/wcsstr.c b/lib/wcsstr.c
new file mode 100644 (file)
index 0000000..3a63447
--- /dev/null
@@ -0,0 +1,23 @@
+/* Locate a substring in a wide string.
+   Copyright (C) 2011 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 <http://www.gnu.org/licenses/>.  */
+
+#include <config.h>
+
+/* Specification.  */
+#include <wchar.h>
+
+#include "wcsstr-impl.h"
diff --git a/lib/wcstok-impl.h b/lib/wcstok-impl.h
new file mode 100644 (file)
index 0000000..afb9046
--- /dev/null
@@ -0,0 +1,50 @@
+/* Split a wide string into tokens.
+   Copyright (C) 1999, 2011 Free Software Foundation, Inc.
+   Written by Bruno Haible <bruno@clisp.org>, 1999.
+
+   This program is free software: you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation; either version 3 of the License, or
+   (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
+
+wchar_t *
+wcstok (wchar_t *wcs, const wchar_t *delim, wchar_t **ptr)
+{
+  if (wcs == NULL)
+    {
+      wcs = *ptr;
+      if (wcs == NULL)
+        return NULL; /* reminder that end of token sequence has been reached */
+    }
+
+  /* Skip leading delimiters.  */
+  wcs += wcsspn (wcs, delim);
+
+  /* Found a token?  */
+  if (*wcs == (wchar_t)'\0')
+    {
+      *ptr = NULL;
+      return NULL;
+    }
+  /* Move past the token.  */
+  {
+    wchar_t *token_end = wcspbrk (wcs, delim);
+    if (token_end)
+      {
+        /* NUL-terminate the token.  */
+        *token_end = (wchar_t)'\0';
+        *ptr = token_end + 1;
+      }
+    else
+      *ptr = NULL;
+  }
+  return wcs;
+}
diff --git a/lib/wcstok.c b/lib/wcstok.c
new file mode 100644 (file)
index 0000000..e61a3ff
--- /dev/null
@@ -0,0 +1,23 @@
+/* Split a wide string into tokens.
+   Copyright (C) 2011 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 <http://www.gnu.org/licenses/>.  */
+
+#include <config.h>
+
+/* Specification.  */
+#include <wchar.h>
+
+#include "wcstok-impl.h"
diff --git a/lib/wcswidth-impl.h b/lib/wcswidth-impl.h
new file mode 100644 (file)
index 0000000..dc1a60c
--- /dev/null
@@ -0,0 +1,38 @@
+/* Determine number of screen columns needed for a size-bounded wide string.
+   Copyright (C) 1999, 2011 Free Software Foundation, Inc.
+   Written by Bruno Haible <bruno@clisp.org>, 1999.
+
+   This program is free software: you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation; either version 3 of the License, or
+   (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
+
+int
+wcswidth (const wchar_t *s, size_t n)
+{
+  int count = 0;
+  for (; n > 0; s++, n--)
+    {
+      wchar_t c = *s;
+      if (c == (wchar_t)'\0')
+        break;
+      {
+        int width = wcwidth (c);
+        if (width < 0)
+          goto found_nonprinting;
+        count += width;
+      }
+    }
+  return count;
+
+ found_nonprinting:
+  return -1;
+}
diff --git a/lib/wcswidth.c b/lib/wcswidth.c
new file mode 100644 (file)
index 0000000..3133c84
--- /dev/null
@@ -0,0 +1,23 @@
+/* Determine number of screen columns needed for a size-bounded wide string.
+   Copyright (C) 2011 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 <http://www.gnu.org/licenses/>.  */
+
+#include <config.h>
+
+/* Specification.  */
+#include <wchar.h>
+
+#include "wcswidth-impl.h"
diff --git a/lib/wcsxfrm-impl.h b/lib/wcsxfrm-impl.h
new file mode 100644 (file)
index 0000000..ba91402
--- /dev/null
@@ -0,0 +1,96 @@
+/* Transform wide string for comparison using the current locale.
+   Copyright (C) 2011 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 <http://www.gnu.org/licenses/>.  */
+
+size_t
+wcsxfrm (wchar_t *s1, const wchar_t *s2, size_t n)
+{
+  char mbbuf2[1024];
+  char *mbs2;
+
+  {
+    int saved_errno = errno;
+    size_t result;
+
+    /* Convert s2 to a multibyte string, trying to avoid malloc().  */
+    {
+      size_t ret;
+
+      ret = wcstombs (mbbuf2, s2, sizeof (mbbuf2));
+      if (ret == (size_t)-1)
+        goto failed;
+      if (ret < sizeof (mbbuf2))
+        mbs2 = mbbuf2;
+      else
+        {
+          size_t need = wcstombs (NULL, s2, 0);
+          if (need == (size_t)-1)
+            goto failed;
+          mbs2 = (char *) malloc (need + 1);
+          if (mbs2 == NULL)
+            goto out_of_memory;
+          ret = wcstombs (mbs2, s2, need + 1);
+          if (ret != need)
+            abort ();
+        }
+    }
+
+    /* Transform the multibyte string.  */
+    errno = 0;
+    result = strxfrm ((char *)s1, mbs2, n);
+    if (errno != 0)
+      {
+        /* An error occurred.  */
+        if (mbs2 != mbbuf2)
+          {
+            saved_errno = errno;
+            free (mbs2);
+            errno = saved_errno;
+          }
+        return 0;
+      }
+
+    if (result < n)
+      {
+        /* Convert the result by mapping char[] -> wchar_t[].
+           Since strcmp() compares the elements as 'unsigned char' values,
+           whereas wcscmp() compares the elements as 'wchar_t' values, we need
+           to map 1 'unsigned char' to 1 'wchar_t'.  (We could also map 2
+           consecutive 'unsigned char' values to 1 'wchar_t' value, but this is
+           not needed.  */
+        wchar_t *wcp = s1 + n;
+        char *cp = (char *)s1 + n;
+
+        while (wcp > s1)
+          *--wcp = (wchar_t) (unsigned char) *--cp;
+      }
+
+    if (mbs2 != mbbuf2)
+      free (mbs2);
+
+    /* No error.  */
+    errno = saved_errno;
+    return result;
+  }
+
+ out_of_memory:
+  errno = ENOMEM;
+  return 0;
+
+ failed:
+  errno = EILSEQ;
+  return 0;
+}
diff --git a/lib/wcsxfrm.c b/lib/wcsxfrm.c
new file mode 100644 (file)
index 0000000..7815a0f
--- /dev/null
@@ -0,0 +1,27 @@
+/* Transform wide string for comparison using the current locale.
+   Copyright (C) 2011 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 <http://www.gnu.org/licenses/>.  */
+
+#include <config.h>
+
+/* Specification.  */
+#include <wchar.h>
+
+#include <errno.h>
+#include <stdlib.h>
+#include <string.h>
+
+#include "wcsxfrm-impl.h"
diff --git a/lib/wctrans-impl.h b/lib/wctrans-impl.h
new file mode 100644 (file)
index 0000000..d099f8b
--- /dev/null
@@ -0,0 +1,37 @@
+/* Get descriptor for a wide character case conversion.
+   Copyright (C) 2011 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 <http://www.gnu.org/licenses/>.  */
+
+wctrans_t
+wctrans (const char *name)
+{
+  if (name[0] == 't'
+      && name[1] == 'o')
+    switch (name[2])
+      {
+      case 'l':
+        if (strcmp (name + 3, "ower") == 0)
+          return (wctrans_t) towlower;
+        break;
+      case 'u':
+        if (strcmp (name + 3, "pper") == 0)
+          return (wctrans_t) towupper;
+        break;
+      default:
+        break;
+      }
+  return NULL;
+}
diff --git a/lib/wctrans.c b/lib/wctrans.c
new file mode 100644 (file)
index 0000000..1ce6d6f
--- /dev/null
@@ -0,0 +1,25 @@
+/* Get descriptor for a wide character case conversion.
+   Copyright (C) 2011 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 <http://www.gnu.org/licenses/>.  */
+
+#include <config.h>
+
+/* Specification.  */
+#include <wctype.h>
+
+#include <string.h>
+
+#include "wctrans-impl.h"
diff --git a/lib/wctype-impl.h b/lib/wctype-impl.h
new file mode 100644 (file)
index 0000000..e2c3222
--- /dev/null
@@ -0,0 +1,96 @@
+/* Get descriptor for a wide character property.
+   Copyright (C) 2011 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 <http://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;
+}
diff --git a/lib/wctype.c b/lib/wctype.c
new file mode 100644 (file)
index 0000000..968b36f
--- /dev/null
@@ -0,0 +1,25 @@
+/* Get descriptor for a wide character property.
+   Copyright (C) 2011 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 <http://www.gnu.org/licenses/>.  */
+
+#include <config.h>
+
+/* Specification.  */
+#include <wctype.h>
+
+#include <string.h>
+
+#include "wctype-impl.h"
index 4910511..feef37d 100644 (file)
 #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.
    Assume all 11 functions (all isw* except iswblank) are implemented the
    same way, or not at all.  */
-#if ! @HAVE_ISWCNTRL@ || @REPLACE_ISWCNTRL@
+# if ! @HAVE_ISWCNTRL@ || @REPLACE_ISWCNTRL@
 
 /* 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
+#  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
-#   define towlower rpl_towlower
-#   define towupper rpl_towupper
+#  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
+#    define towlower rpl_towlower
+#    define towupper rpl_towupper
+#   endif
 #  endif
-# endif
 
 static inline int
-# if @REPLACE_ISWCNTRL@
+#  if @REPLACE_ISWCNTRL@
 rpl_iswalnum
-# else
+#  else
 iswalnum
-# endif
+#  endif
          (wint_t wc)
 {
   return ((wc >= '0' && wc <= '9')
@@ -131,88 +133,88 @@ iswalnum
 }
 
 static inline int
-# if @REPLACE_ISWCNTRL@
+#  if @REPLACE_ISWCNTRL@
 rpl_iswalpha
-# else
+#  else
 iswalpha
-# endif
+#  endif
          (wint_t wc)
 {
   return (wc & ~0x20) >= 'A' && (wc & ~0x20) <= 'Z';
 }
 
 static inline int
-# if @REPLACE_ISWCNTRL@
+#  if @REPLACE_ISWCNTRL@
 rpl_iswblank
-# else
+#  else
 iswblank
-# endif
+#  endif
          (wint_t wc)
 {
   return wc == ' ' || wc == '\t';
 }
 
 static inline int
-# if @REPLACE_ISWCNTRL@
+#  if @REPLACE_ISWCNTRL@
 rpl_iswcntrl
-# else
+#  else
 iswcntrl
-# endif
+#  endif
         (wint_t wc)
 {
   return (wc & ~0x1f) == 0 || wc == 0x7f;
 }
 
 static inline int
-# if @REPLACE_ISWCNTRL@
+#  if @REPLACE_ISWCNTRL@
 rpl_iswdigit
-# else
+#  else
 iswdigit
-# endif
+#  endif
          (wint_t wc)
 {
   return wc >= '0' && wc <= '9';
 }
 
 static inline int
-# if @REPLACE_ISWCNTRL@
+#  if @REPLACE_ISWCNTRL@
 rpl_iswgraph
-# else
+#  else
 iswgraph
-# endif
+#  endif
          (wint_t wc)
 {
   return wc >= '!' && wc <= '~';
 }
 
 static inline int
-# if @REPLACE_ISWCNTRL@
+#  if @REPLACE_ISWCNTRL@
 rpl_iswlower
-# else
+#  else
 iswlower
-# endif
+#  endif
          (wint_t wc)
 {
   return wc >= 'a' && wc <= 'z';
 }
 
 static inline int
-# if @REPLACE_ISWCNTRL@
+#  if @REPLACE_ISWCNTRL@
 rpl_iswprint
-# else
+#  else
 iswprint
-# endif
+#  endif
          (wint_t wc)
 {
   return wc >= ' ' && wc <= '~';
 }
 
 static inline int
-# if @REPLACE_ISWCNTRL@
+#  if @REPLACE_ISWCNTRL@
 rpl_iswpunct
-# else
+#  else
 iswpunct
-# endif
+#  endif
          (wint_t wc)
 {
   return (wc >= '!' && wc <= '~'
@@ -221,11 +223,11 @@ iswpunct
 }
 
 static inline int
-# if @REPLACE_ISWCNTRL@
+#  if @REPLACE_ISWCNTRL@
 rpl_iswspace
-# else
+#  else
 iswspace
-# endif
+#  endif
          (wint_t wc)
 {
   return (wc == ' ' || wc == '\t'
@@ -233,22 +235,22 @@ iswspace
 }
 
 static inline int
-# if @REPLACE_ISWCNTRL@
+#  if @REPLACE_ISWCNTRL@
 rpl_iswupper
-# else
+#  else
 iswupper
-# endif
+#  endif
          (wint_t wc)
 {
   return wc >= 'A' && wc <= 'Z';
 }
 
 static inline int
-# if @REPLACE_ISWCNTRL@
+#  if @REPLACE_ISWCNTRL@
 rpl_iswxdigit
-# else
+#  else
 iswxdigit
-# endif
+#  endif
           (wint_t wc)
 {
   return ((wc >= '0' && wc <= '9')
@@ -256,42 +258,42 @@ iswxdigit
 }
 
 static inline wint_t
-# if @REPLACE_ISWCNTRL@
+#  if @REPLACE_ISWCNTRL@
 rpl_towlower
-# else
+#  else
 towlower
-# endif
+#  endif
          (wint_t wc)
 {
   return (wc >= 'A' && wc <= 'Z' ? wc - 'A' + 'a' : wc);
 }
 
 static inline wint_t
-# if @REPLACE_ISWCNTRL@
+#  if @REPLACE_ISWCNTRL@
 rpl_towupper
-# else
+#  else
 towupper
-# endif
+#  endif
          (wint_t wc)
 {
   return (wc >= 'a' && wc <= 'z' ? wc - 'a' + 'A' : wc);
 }
 
-#elif ! @HAVE_ISWBLANK@ || @REPLACE_ISWBLANK@
+# elif @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
+#  if @REPLACE_ISWBLANK@
+#   if !(defined __cplusplus && defined GNULIB_NAMESPACE)
+#    define iswblank rpl_iswblank
+#   endif
 _GL_FUNCDECL_RPL (iswblank, int, (wint_t wc));
-# else
+#  else
 _GL_FUNCDECL_SYS (iswblank, int, (wint_t wc));
-# endif
+#  endif
 
-#endif
+# endif
 
-#if defined __MINGW32__
+# if defined __MINGW32__
 
 /* 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
@@ -311,25 +313,27 @@ rpl_towlower (wint_t wc)
 {
   return (wint_t) (wchar_t) towlower (wc);
 }
-# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
-#  define towlower rpl_towlower
-# endif
+#  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
+#   define towlower rpl_towlower
+#  endif
 
 static 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
+#  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
+#   define towupper rpl_towupper
+#  endif
 
-#endif /* __MINGW32__ */
+# endif /* __MINGW32__ */
+
+# define GNULIB_defined_wctype_functions 1
+#endif
 
 #if @REPLACE_ISWCNTRL@
 _GL_CXXALIAS_RPL (iswalnum, int, (wint_t wc));
 _GL_CXXALIAS_RPL (iswalpha, int, (wint_t wc));
-_GL_CXXALIAS_RPL (iswblank, int, (wint_t wc));
 _GL_CXXALIAS_RPL (iswcntrl, int, (wint_t wc));
 _GL_CXXALIAS_RPL (iswdigit, int, (wint_t wc));
 _GL_CXXALIAS_RPL (iswgraph, int, (wint_t wc));
@@ -342,11 +346,6 @@ _GL_CXXALIAS_RPL (iswxdigit, int, (wint_t wc));
 #else
 _GL_CXXALIAS_SYS (iswalnum, int, (wint_t wc));
 _GL_CXXALIAS_SYS (iswalpha, int, (wint_t wc));
-# if @REPLACE_ISWBLANK@
-_GL_CXXALIAS_RPL (iswblank, int, (wint_t wc));
-# else
-_GL_CXXALIAS_SYS (iswblank, int, (wint_t wc));
-# endif
 _GL_CXXALIAS_SYS (iswcntrl, int, (wint_t wc));
 _GL_CXXALIAS_SYS (iswdigit, int, (wint_t wc));
 _GL_CXXALIAS_SYS (iswgraph, int, (wint_t wc));
@@ -359,7 +358,6 @@ _GL_CXXALIAS_SYS (iswxdigit, int, (wint_t wc));
 #endif
 _GL_CXXALIASWARN (iswalnum);
 _GL_CXXALIASWARN (iswalpha);
-_GL_CXXALIASWARN (iswblank);
 _GL_CXXALIASWARN (iswcntrl);
 _GL_CXXALIASWARN (iswdigit);
 _GL_CXXALIASWARN (iswgraph);
@@ -370,6 +368,54 @@ _GL_CXXALIASWARN (iswspace);
 _GL_CXXALIASWARN (iswupper);
 _GL_CXXALIASWARN (iswxdigit);
 
+#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
+_GL_CXXALIASWARN (iswblank);
+#endif
+
+#if !@HAVE_WCTYPE_T@
+# if !GNULIB_defined_wctype_t
+typedef void * wctype_t;
+#  define GNULIB_defined_wctype_t 1
+# endif
+#endif
+
+/* Get a descriptor for a wide character property.  */
+#if @GNULIB_WCTYPE@
+# if !@HAVE_WCTYPE_T@
+_GL_FUNCDECL_SYS (wctype, wctype_t, (const char *name));
+# endif
+_GL_CXXALIAS_SYS (wctype, wctype_t, (const char *name));
+_GL_CXXALIASWARN (wctype);
+#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 !@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));
+_GL_CXXALIASWARN (iswctype);
+#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_ISWCNTRL@ || defined __MINGW32__
 _GL_CXXALIAS_RPL (towlower, wint_t, (wint_t wc));
 _GL_CXXALIAS_RPL (towupper, wint_t, (wint_t wc));
@@ -380,6 +426,45 @@ _GL_CXXALIAS_SYS (towupper, wint_t, (wint_t wc));
 _GL_CXXALIASWARN (towlower);
 _GL_CXXALIASWARN (towupper);
 
+#if !@HAVE_WCTRANS_T@
+# if !GNULIB_defined_wctrans_t
+typedef void * wctrans_t;
+#  define GNULIB_defined_wctrans_t 1
+# endif
+#endif
+
+/* Get a descriptor for a wide character case conversion.  */
+#if @GNULIB_WCTRANS@
+# if !@HAVE_WCTRANS_T@
+_GL_FUNCDECL_SYS (wctrans, wctrans_t, (const char *name));
+# endif
+_GL_CXXALIAS_SYS (wctrans, wctrans_t, (const char *name));
+_GL_CXXALIASWARN (wctrans);
+#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 !@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));
+_GL_CXXALIASWARN (towctrans);
+#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
+
 
 #endif /* _GL_WCTYPE_H */
 #endif /* _GL_WCTYPE_H */
diff --git a/lib/wmemchr-impl.h b/lib/wmemchr-impl.h
new file mode 100644 (file)
index 0000000..92fd7fd
--- /dev/null
@@ -0,0 +1,27 @@
+/* Search wide character array for a wide character.
+   Copyright (C) 1999, 2011 Free Software Foundation, Inc.
+   Written by Bruno Haible <bruno@clisp.org>, 1999.
+
+   This program is free software: you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation; either version 3 of the License, or
+   (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program.  If not, see <http://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;
+}
diff --git a/lib/wmemchr.c b/lib/wmemchr.c
new file mode 100644 (file)
index 0000000..53c891c
--- /dev/null
@@ -0,0 +1,23 @@
+/* Search wide character array for a wide character.
+   Copyright (C) 2011 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 <http://www.gnu.org/licenses/>.  */
+
+#include <config.h>
+
+/* Specification.  */
+#include <wchar.h>
+
+#include "wmemchr-impl.h"
diff --git a/lib/wmemcmp-impl.h b/lib/wmemcmp-impl.h
new file mode 100644 (file)
index 0000000..b677771
--- /dev/null
@@ -0,0 +1,35 @@
+/* Compare wide character arrays.
+   Copyright (C) 1999, 2011 Free Software Foundation, Inc.
+   Written by Bruno Haible <bruno@clisp.org>, 1999.
+
+   This program is free software: you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation; either version 3 of the License, or
+   (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
+
+int
+wmemcmp (const wchar_t *s1, const wchar_t *s2, size_t n)
+{
+  for (; n > 0;)
+    {
+      wchar_t wc1 = *s1++;
+      wchar_t wc2 = *s2++;
+      if (wc1 == wc2)
+        {
+          n--;
+          continue;
+        }
+      /* Note that wc1 and wc2 each have at most 31 bits.  */
+      return (int)wc1 - (int)wc2;
+             /* > 0 if wc1 > wc2, < 0 if wc1 < wc2.  */
+    }
+  return 0;
+}
diff --git a/lib/wmemcmp.c b/lib/wmemcmp.c
new file mode 100644 (file)
index 0000000..f5a30af
--- /dev/null
@@ -0,0 +1,23 @@
+/* Compare wide character arrays.
+   Copyright (C) 2011 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 <http://www.gnu.org/licenses/>.  */
+
+#include <config.h>
+
+/* Specification.  */
+#include <wchar.h>
+
+#include "wmemcmp-impl.h"
diff --git a/lib/wmemcpy-impl.h b/lib/wmemcpy-impl.h
new file mode 100644 (file)
index 0000000..6802e76
--- /dev/null
@@ -0,0 +1,26 @@
+/* Copy wide character array.
+   Copyright (C) 1999, 2011 Free Software Foundation, Inc.
+   Written by Bruno Haible <bruno@clisp.org>, 1999.
+
+   This program is free software: you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation; either version 3 of the License, or
+   (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
+
+wchar_t *
+wmemcpy (wchar_t *dest, const wchar_t *src, size_t n)
+{
+  wchar_t *destptr = dest;
+
+  for (; n > 0; n--)
+    *destptr++ = *src++;
+  return dest;
+}
diff --git a/lib/wmemcpy.c b/lib/wmemcpy.c
new file mode 100644 (file)
index 0000000..0142497
--- /dev/null
@@ -0,0 +1,23 @@
+/* Copy wide character array.
+   Copyright (C) 2011 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 <http://www.gnu.org/licenses/>.  */
+
+#include <config.h>
+
+/* Specification.  */
+#include <wchar.h>
+
+#include "wmemcpy-impl.h"
diff --git a/lib/wmemmove-impl.h b/lib/wmemmove-impl.h
new file mode 100644 (file)
index 0000000..4ecdcbe
--- /dev/null
@@ -0,0 +1,36 @@
+/* Copy wide character array.
+   Copyright (C) 1999, 2011 Free Software Foundation, Inc.
+   Written by Bruno Haible <bruno@clisp.org>, 1999.
+
+   This program is free software: you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation; either version 3 of the License, or
+   (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
+
+wchar_t *
+wmemmove (wchar_t *dest, const wchar_t *src, size_t n)
+{
+  if (dest < src)
+    {
+      wchar_t *destptr = dest;
+      const wchar_t *srcptr = src;
+      for (; n > 0; n--)
+        *destptr++ = *srcptr++;
+    }
+  else if (dest > src)
+    {
+      wchar_t *destptr = dest + n - 1;
+      const wchar_t *srcptr = src + n - 1;
+      for (; n > 0; n--)
+        *destptr-- = *srcptr--;
+    }
+  return dest;
+}
diff --git a/lib/wmemmove.c b/lib/wmemmove.c
new file mode 100644 (file)
index 0000000..3edaa0c
--- /dev/null
@@ -0,0 +1,23 @@
+/* Copy wide character array.
+   Copyright (C) 2011 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 <http://www.gnu.org/licenses/>.  */
+
+#include <config.h>
+
+/* Specification.  */
+#include <wchar.h>
+
+#include "wmemmove-impl.h"
diff --git a/lib/wmemset-impl.h b/lib/wmemset-impl.h
new file mode 100644 (file)
index 0000000..30b586a
--- /dev/null
@@ -0,0 +1,26 @@
+/* Fill wide character array.
+   Copyright (C) 1999, 2011 Free Software Foundation, Inc.
+   Written by Bruno Haible <bruno@clisp.org>, 1999.
+
+   This program is free software: you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation; either version 3 of the License, or
+   (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
+
+wchar_t *
+wmemset (wchar_t *s, wchar_t c, size_t n)
+{
+  wchar_t *ptr = s;
+
+  for (; n > 0; n--)
+    *ptr++ = c;
+  return s;
+}
diff --git a/lib/wmemset.c b/lib/wmemset.c
new file mode 100644 (file)
index 0000000..15450f5
--- /dev/null
@@ -0,0 +1,23 @@
+/* Fill wide character array.
+   Copyright (C) 2011 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 <http://www.gnu.org/licenses/>.  */
+
+#include <config.h>
+
+/* Specification.  */
+#include <wchar.h>
+
+#include "wmemset-impl.h"
index 7ce0b5a..f192a62 100644 (file)
@@ -1,4 +1,4 @@
-# serial 4
+# serial 5
 # See if we need to provide fdopendir.
 
 dnl Copyright (C) 2009-2011 Free Software Foundation, Inc.
@@ -27,12 +27,16 @@ AC_DEFUN([gl_FUNC_FDOPENDIR],
       [AC_RUN_IFELSE([AC_LANG_PROGRAM([[
 #include <dirent.h>
 #include <fcntl.h>
+#include <unistd.h>
 #if !HAVE_DECL_FDOPENDIR
 extern DIR *fdopendir (int);
 #endif
-]], [int fd = open ("conftest.c", O_RDONLY);
-     if (fd < 0) return 2;
-     return !!fdopendir (fd);])],
+]], [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],
          [gl_cv_func_fdopendir_works="guessing no"])])
diff --git a/m4/iswblank.m4 b/m4/iswblank.m4
new file mode 100644 (file)
index 0000000..38641ff
--- /dev/null
@@ -0,0 +1,31 @@
+# iswblank.m4 serial 2
+dnl Copyright (C) 2011 Free Software Foundation, Inc.
+dnl This file is free software; the Free 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])
+  AC_CHECK_FUNCS_ONCE([iswblank])
+  AC_CHECK_DECLS_ONCE([iswblank])
+  if test $ac_cv_func_iswblank = no; then
+    HAVE_ISWBLANK=0
+    if test $ac_cv_have_decl_iswblank = yes; 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.
+      AC_LIBOBJ([iswblank])
+    fi
+  fi
+
+])
diff --git a/m4/iswctype.m4 b/m4/iswctype.m4
new file mode 100644 (file)
index 0000000..2f0120f
--- /dev/null
@@ -0,0 +1,14 @@
+# iswctype.m4 serial 1
+dnl Copyright (C) 2011 Free Software Foundation, Inc.
+dnl This file is free software; the Free 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])
+  if test $HAVE_WCTYPE_T = 0; then
+    AC_LIBOBJ([iswctype])
+  fi
+])
index 8dd24f0..cbe445d 100644 (file)
@@ -1,4 +1,4 @@
-# serial 1
+# serial 3
 dnl Copyright (C) 2008-2011 Free Software Foundation, Inc.
 dnl This file is free software; the Free Software Foundation
 dnl gives unlimited permission to copy and/or distribute it,
@@ -7,6 +7,20 @@ 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_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
+    ]])
+
   AC_CHECK_FUNCS([random_r])
   if test $ac_cv_func_random_r = no; then
     HAVE_RANDOM_R=0
index c5c8061..ba619b0 100644 (file)
@@ -1,4 +1,4 @@
-# setenv.m4 serial 20
+# setenv.m4 serial 21
 dnl Copyright (C) 2001-2004, 2006-2011 Free Software Foundation, Inc.
 dnl This file is free software; the Free Software Foundation
 dnl gives unlimited permission to copy and/or distribute it,
@@ -97,20 +97,30 @@ int unsetenv();
     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;
       ]], [[
-       char entry[] = "b=2";
+       char entry1[] = "a=1";
+       char entry2[] = "b=2";
+       char *env[] = { entry1, entry2, NULL };
        if (putenv ((char *) "a=1")) return 1;
-       if (putenv (entry)) return 2;
-       entry[0] = 'a';
+       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],
       [gl_cv_func_unsetenv_works="guessing no"])])
index df10486..838cf0f 100644 (file)
@@ -5,13 +5,13 @@ dnl This file is free software; the Free Software Foundation
 dnl gives unlimited permission to copy and/or distribute it,
 dnl with or without modifications, as long as this notice is preserved.
 
-#serial 3
+#serial 4
 
 # Prepare for substituting <stdbool.h> if it is not supported.
 
 AC_DEFUN([AM_STDBOOL_H],
 [
-  AC_REQUIRE([AC_HEADER_STDBOOL])
+  AC_REQUIRE([AC_CHECK_HEADER_STDBOOL])
 
   # Define two additional variables used in the Makefile substitution.
 
@@ -33,11 +33,9 @@ AC_DEFUN([AM_STDBOOL_H],
 # AM_STDBOOL_H will be renamed to gl_STDBOOL_H in the future.
 AC_DEFUN([gl_STDBOOL_H], [AM_STDBOOL_H])
 
-# This version of the macro is needed in autoconf <= 2.67.  Autoconf has
-# it built in since 2.60, but we want the tweaks from the 2.68 version
-# to avoid rejecting xlc and clang due to relying on extensions.
+# This version of the macro is needed in autoconf <= 2.68.
 
-AC_DEFUN([AC_HEADER_STDBOOL],
+AC_DEFUN([AC_CHECK_HEADER_STDBOOL],
   [AC_CACHE_CHECK([for stdbool.h that conforms to C99],
      [ac_cv_header_stdbool_h],
      [AC_COMPILE_IFELSE(
@@ -98,6 +96,4 @@ AC_DEFUN([AC_HEADER_STDBOOL],
         [ac_cv_header_stdbool_h=yes],
         [ac_cv_header_stdbool_h=no])])
    AC_CHECK_TYPES([_Bool])
-   if test $ac_cv_header_stdbool_h = yes; then
-     AC_DEFINE([HAVE_STDBOOL_H], [1], [Define to 1 if stdbool.h conforms to C99.])
-   fi])
+])
index a71468f..d28b552 100644 (file)
@@ -1,4 +1,4 @@
-# stdlib_h.m4 serial 34
+# stdlib_h.m4 serial 36
 dnl Copyright (C) 2007-2011 Free Software Foundation, Inc.
 dnl This file is free software; the Free Software Foundation
 dnl gives unlimited permission to copy and/or distribute it,
@@ -8,20 +8,6 @@ AC_DEFUN([gl_STDLIB_H],
 [
   AC_REQUIRE([gl_STDLIB_H_DEFAULTS])
   gl_NEXT_HEADERS([stdlib.h])
-  AC_CHECK_HEADERS([random.h], [], [], [AC_INCLUDES_DEFAULT])
-  if test $ac_cv_header_random_h = yes; then
-    HAVE_RANDOM_H=1
-  else
-    HAVE_RANDOM_H=0
-  fi
-  AC_SUBST([HAVE_RANDOM_H])
-  AC_CHECK_TYPES([struct random_data],
-    [], [HAVE_STRUCT_RANDOM_DATA=0],
-    [[#include <stdlib.h>
-      #if HAVE_RANDOM_H
-      # include <random.h>
-      #endif
-    ]])
 
   dnl Check for declarations of anything we want to poison if the
   dnl corresponding gnulib module is not in use, and which is not
@@ -89,6 +75,7 @@ AC_DEFUN([gl_STDLIB_H_DEFAULTS],
   HAVE_MKSTEMP=1;            AC_SUBST([HAVE_MKSTEMP])
   HAVE_MKSTEMPS=1;           AC_SUBST([HAVE_MKSTEMPS])
   HAVE_PTSNAME=1;            AC_SUBST([HAVE_PTSNAME])
+  HAVE_RANDOM_H=1;           AC_SUBST([HAVE_RANDOM_H])
   HAVE_RANDOM_R=1;           AC_SUBST([HAVE_RANDOM_R])
   HAVE_REALPATH=1;           AC_SUBST([HAVE_REALPATH])
   HAVE_RPMATCH=1;            AC_SUBST([HAVE_RPMATCH])
index 3897da6..1883458 100644 (file)
@@ -24,7 +24,7 @@ AC_DEFUN([gl_FUNC_STRERROR_R],
   if test $ac_cv_func_strerror_r = yes; then
     if test -z "$ERRNO_H"; then
       dnl The POSIX prototype is:  int strerror_r (int, char *, size_t);
-      dnl glibc's prototype:       char *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],
diff --git a/m4/towctrans.m4 b/m4/towctrans.m4
new file mode 100644 (file)
index 0000000..2c6c298
--- /dev/null
@@ -0,0 +1,14 @@
+# towctrans.m4 serial 1
+dnl Copyright (C) 2011 Free Software Foundation, Inc.
+dnl This file is free software; the Free 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_TOWCTRANS],
+[
+  AC_REQUIRE([gl_WCTYPE_H_DEFAULTS])
+  AC_REQUIRE([gl_WCTYPE_H])
+  if test $HAVE_WCTRANS_T = 0; then
+    AC_LIBOBJ([towctrans])
+  fi
+])
index e8adf89..6255ff3 100644 (file)
@@ -7,7 +7,7 @@ dnl with or without modifications, as long as this notice is preserved.
 
 dnl Written by Eric Blake.
 
-# wchar_h.m4 serial 37
+# wchar_h.m4 serial 38
 
 AC_DEFUN([gl_WCHAR_H],
 [
@@ -48,8 +48,13 @@ AC_DEFUN([gl_WCHAR_H],
 # include <time.h>
 #endif
 #include <wchar.h>
-    ]], [btowc wctob mbsinit mbrtowc mbrlen mbsrtowcs mbsnrtowcs wcrtomb
-    wcsrtombs wcsnrtombs wcwidth])
+    ]],
+    [btowc wctob mbsinit mbrtowc mbrlen mbsrtowcs mbsnrtowcs wcrtomb
+     wcsrtombs wcsnrtombs wcwidth wmemchr wmemcmp wmemcpy wmemmove wmemset
+     wcslen wcsnlen wcscpy wcpcpy wcsncpy wcpncpy wcscat wcsncat wcscmp
+     wcsncmp wcscasecmp wcsncasecmp wcscoll wcsxfrm wcsdup wcschr wcsrchr
+     wcscspn wcsspn wcspbrk wcsstr wcstok wcswidth
+    ])
 ])
 
 dnl Check whether <wchar.h> is usable at all.
@@ -132,17 +137,45 @@ AC_DEFUN([gl_WCHAR_MODULE_INDICATOR],
 
 AC_DEFUN([gl_WCHAR_H_DEFAULTS],
 [
-  GNULIB_BTOWC=0;      AC_SUBST([GNULIB_BTOWC])
-  GNULIB_WCTOB=0;      AC_SUBST([GNULIB_WCTOB])
-  GNULIB_MBSINIT=0;    AC_SUBST([GNULIB_MBSINIT])
-  GNULIB_MBRTOWC=0;    AC_SUBST([GNULIB_MBRTOWC])
-  GNULIB_MBRLEN=0;     AC_SUBST([GNULIB_MBRLEN])
-  GNULIB_MBSRTOWCS=0;  AC_SUBST([GNULIB_MBSRTOWCS])
-  GNULIB_MBSNRTOWCS=0; AC_SUBST([GNULIB_MBSNRTOWCS])
-  GNULIB_WCRTOMB=0;    AC_SUBST([GNULIB_WCRTOMB])
-  GNULIB_WCSRTOMBS=0;  AC_SUBST([GNULIB_WCSRTOMBS])
-  GNULIB_WCSNRTOMBS=0; AC_SUBST([GNULIB_WCSNRTOMBS])
-  GNULIB_WCWIDTH=0;    AC_SUBST([GNULIB_WCWIDTH])
+  GNULIB_BTOWC=0;       AC_SUBST([GNULIB_BTOWC])
+  GNULIB_WCTOB=0;       AC_SUBST([GNULIB_WCTOB])
+  GNULIB_MBSINIT=0;     AC_SUBST([GNULIB_MBSINIT])
+  GNULIB_MBRTOWC=0;     AC_SUBST([GNULIB_MBRTOWC])
+  GNULIB_MBRLEN=0;      AC_SUBST([GNULIB_MBRLEN])
+  GNULIB_MBSRTOWCS=0;   AC_SUBST([GNULIB_MBSRTOWCS])
+  GNULIB_MBSNRTOWCS=0;  AC_SUBST([GNULIB_MBSNRTOWCS])
+  GNULIB_WCRTOMB=0;     AC_SUBST([GNULIB_WCRTOMB])
+  GNULIB_WCSRTOMBS=0;   AC_SUBST([GNULIB_WCSRTOMBS])
+  GNULIB_WCSNRTOMBS=0;  AC_SUBST([GNULIB_WCSNRTOMBS])
+  GNULIB_WCWIDTH=0;     AC_SUBST([GNULIB_WCWIDTH])
+  GNULIB_WMEMCHR=0;     AC_SUBST([GNULIB_WMEMCHR])
+  GNULIB_WMEMCMP=0;     AC_SUBST([GNULIB_WMEMCMP])
+  GNULIB_WMEMCPY=0;     AC_SUBST([GNULIB_WMEMCPY])
+  GNULIB_WMEMMOVE=0;    AC_SUBST([GNULIB_WMEMMOVE])
+  GNULIB_WMEMSET=0;     AC_SUBST([GNULIB_WMEMSET])
+  GNULIB_WCSLEN=0;      AC_SUBST([GNULIB_WCSLEN])
+  GNULIB_WCSNLEN=0;     AC_SUBST([GNULIB_WCSNLEN])
+  GNULIB_WCSCPY=0;      AC_SUBST([GNULIB_WCSCPY])
+  GNULIB_WCPCPY=0;      AC_SUBST([GNULIB_WCPCPY])
+  GNULIB_WCSNCPY=0;     AC_SUBST([GNULIB_WCSNCPY])
+  GNULIB_WCPNCPY=0;     AC_SUBST([GNULIB_WCPNCPY])
+  GNULIB_WCSCAT=0;      AC_SUBST([GNULIB_WCSCAT])
+  GNULIB_WCSNCAT=0;     AC_SUBST([GNULIB_WCSNCAT])
+  GNULIB_WCSCMP=0;      AC_SUBST([GNULIB_WCSCMP])
+  GNULIB_WCSNCMP=0;     AC_SUBST([GNULIB_WCSNCMP])
+  GNULIB_WCSCASECMP=0;  AC_SUBST([GNULIB_WCSCASECMP])
+  GNULIB_WCSNCASECMP=0; AC_SUBST([GNULIB_WCSNCASECMP])
+  GNULIB_WCSCOLL=0;     AC_SUBST([GNULIB_WCSCOLL])
+  GNULIB_WCSXFRM=0;     AC_SUBST([GNULIB_WCSXFRM])
+  GNULIB_WCSDUP=0;      AC_SUBST([GNULIB_WCSDUP])
+  GNULIB_WCSCHR=0;      AC_SUBST([GNULIB_WCSCHR])
+  GNULIB_WCSRCHR=0;     AC_SUBST([GNULIB_WCSRCHR])
+  GNULIB_WCSCSPN=0;     AC_SUBST([GNULIB_WCSCSPN])
+  GNULIB_WCSSPN=0;      AC_SUBST([GNULIB_WCSSPN])
+  GNULIB_WCSPBRK=0;     AC_SUBST([GNULIB_WCSPBRK])
+  GNULIB_WCSSTR=0;      AC_SUBST([GNULIB_WCSSTR])
+  GNULIB_WCSTOK=0;      AC_SUBST([GNULIB_WCSTOK])
+  GNULIB_WCSWIDTH=0;    AC_SUBST([GNULIB_WCSWIDTH])
   dnl Assume proper GNU behavior unless another module says otherwise.
   HAVE_BTOWC=1;         AC_SUBST([HAVE_BTOWC])
   HAVE_MBSINIT=1;       AC_SUBST([HAVE_MBSINIT])
@@ -153,6 +186,34 @@ AC_DEFUN([gl_WCHAR_H_DEFAULTS],
   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_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_DECL_WCTOB=1;    AC_SUBST([HAVE_DECL_WCTOB])
   HAVE_DECL_WCWIDTH=1;  AC_SUBST([HAVE_DECL_WCWIDTH])
   REPLACE_MBSTATE_T=0;  AC_SUBST([REPLACE_MBSTATE_T])
@@ -167,4 +228,5 @@ AC_DEFUN([gl_WCHAR_H_DEFAULTS],
   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])
 ])
diff --git a/m4/wcpcpy.m4 b/m4/wcpcpy.m4
new file mode 100644 (file)
index 0000000..5ffe1a1
--- /dev/null
@@ -0,0 +1,15 @@
+# wcpcpy.m4 serial 1
+dnl Copyright (C) 2011 Free Software Foundation, Inc.
+dnl This file is free software; the Free 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_WCPCPY],
+[
+  AC_REQUIRE([gl_WCHAR_H_DEFAULTS])
+  AC_CHECK_FUNCS_ONCE([wcpcpy])
+  if test $ac_cv_func_wcpcpy = no; then
+    HAVE_WCPCPY=0
+    AC_LIBOBJ([wcpcpy])
+  fi
+])
diff --git a/m4/wcpncpy.m4 b/m4/wcpncpy.m4
new file mode 100644 (file)
index 0000000..939e880
--- /dev/null
@@ -0,0 +1,15 @@
+# wcpncpy.m4 serial 1
+dnl Copyright (C) 2011 Free Software Foundation, Inc.
+dnl This file is free software; the Free 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_WCPNCPY],
+[
+  AC_REQUIRE([gl_WCHAR_H_DEFAULTS])
+  AC_CHECK_FUNCS_ONCE([wcpncpy])
+  if test $ac_cv_func_wcpncpy = no; then
+    HAVE_WCPNCPY=0
+    AC_LIBOBJ([wcpncpy])
+  fi
+])
diff --git a/m4/wcscasecmp.m4 b/m4/wcscasecmp.m4
new file mode 100644 (file)
index 0000000..8013813
--- /dev/null
@@ -0,0 +1,15 @@
+# wcscasecmp.m4 serial 1
+dnl Copyright (C) 2011 Free Software Foundation, Inc.
+dnl This file is free software; the Free 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_WCSCASECMP],
+[
+  AC_REQUIRE([gl_WCHAR_H_DEFAULTS])
+  AC_CHECK_FUNCS_ONCE([wcscasecmp])
+  if test $ac_cv_func_wcscasecmp = no; then
+    HAVE_WCSCASECMP=0
+    AC_LIBOBJ([wcscasecmp])
+  fi
+])
diff --git a/m4/wcscat.m4 b/m4/wcscat.m4
new file mode 100644 (file)
index 0000000..44602d1
--- /dev/null
@@ -0,0 +1,15 @@
+# wcscat.m4 serial 1
+dnl Copyright (C) 2011 Free Software Foundation, Inc.
+dnl This file is free software; the Free 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_WCSCAT],
+[
+  AC_REQUIRE([gl_WCHAR_H_DEFAULTS])
+  AC_CHECK_FUNCS_ONCE([wcscat])
+  if test $ac_cv_func_wcscat = no; then
+    HAVE_WCSCAT=0
+    AC_LIBOBJ([wcscat])
+  fi
+])
diff --git a/m4/wcschr.m4 b/m4/wcschr.m4
new file mode 100644 (file)
index 0000000..1813a06
--- /dev/null
@@ -0,0 +1,15 @@
+# wcschr.m4 serial 1
+dnl Copyright (C) 2011 Free Software Foundation, Inc.
+dnl This file is free software; the Free 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_WCSCHR],
+[
+  AC_REQUIRE([gl_WCHAR_H_DEFAULTS])
+  AC_CHECK_FUNCS_ONCE([wcschr])
+  if test $ac_cv_func_wcschr = no; then
+    HAVE_WCSCHR=0
+    AC_LIBOBJ([wcschr])
+  fi
+])
diff --git a/m4/wcscmp.m4 b/m4/wcscmp.m4
new file mode 100644 (file)
index 0000000..376965f
--- /dev/null
@@ -0,0 +1,15 @@
+# wcscmp.m4 serial 1
+dnl Copyright (C) 2011 Free Software Foundation, Inc.
+dnl This file is free software; the Free 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_WCSCMP],
+[
+  AC_REQUIRE([gl_WCHAR_H_DEFAULTS])
+  AC_CHECK_FUNCS_ONCE([wcscmp])
+  if test $ac_cv_func_wcscmp = no; then
+    HAVE_WCSCMP=0
+    AC_LIBOBJ([wcscmp])
+  fi
+])
diff --git a/m4/wcscoll.m4 b/m4/wcscoll.m4
new file mode 100644 (file)
index 0000000..8a39a69
--- /dev/null
@@ -0,0 +1,15 @@
+# wcscoll.m4 serial 1
+dnl Copyright (C) 2011 Free Software Foundation, Inc.
+dnl This file is free software; the Free 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_WCSCOLL],
+[
+  AC_REQUIRE([gl_WCHAR_H_DEFAULTS])
+  AC_CHECK_FUNCS_ONCE([wcscoll])
+  if test $ac_cv_func_wcscoll = no; then
+    HAVE_WCSCOLL=0
+    AC_LIBOBJ([wcscoll])
+  fi
+])
diff --git a/m4/wcscpy.m4 b/m4/wcscpy.m4
new file mode 100644 (file)
index 0000000..dcd845b
--- /dev/null
@@ -0,0 +1,15 @@
+# wcscpy.m4 serial 1
+dnl Copyright (C) 2011 Free Software Foundation, Inc.
+dnl This file is free software; the Free 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_WCSCPY],
+[
+  AC_REQUIRE([gl_WCHAR_H_DEFAULTS])
+  AC_CHECK_FUNCS_ONCE([wcscpy])
+  if test $ac_cv_func_wcscpy = no; then
+    HAVE_WCSCPY=0
+    AC_LIBOBJ([wcscpy])
+  fi
+])
diff --git a/m4/wcscspn.m4 b/m4/wcscspn.m4
new file mode 100644 (file)
index 0000000..f6761fa
--- /dev/null
@@ -0,0 +1,15 @@
+# wcscspn.m4 serial 1
+dnl Copyright (C) 2011 Free Software Foundation, Inc.
+dnl This file is free software; the Free 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_WCSCSPN],
+[
+  AC_REQUIRE([gl_WCHAR_H_DEFAULTS])
+  AC_CHECK_FUNCS_ONCE([wcscspn])
+  if test $ac_cv_func_wcscspn = no; then
+    HAVE_WCSCSPN=0
+    AC_LIBOBJ([wcscspn])
+  fi
+])
diff --git a/m4/wcsdup.m4 b/m4/wcsdup.m4
new file mode 100644 (file)
index 0000000..f3a35df
--- /dev/null
@@ -0,0 +1,15 @@
+# wcsdup.m4 serial 1
+dnl Copyright (C) 2011 Free Software Foundation, Inc.
+dnl This file is free software; the Free 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_WCSDUP],
+[
+  AC_REQUIRE([gl_WCHAR_H_DEFAULTS])
+  AC_CHECK_FUNCS_ONCE([wcsdup])
+  if test $ac_cv_func_wcsdup = no; then
+    HAVE_WCSDUP=0
+    AC_LIBOBJ([wcsdup])
+  fi
+])
diff --git a/m4/wcslen.m4 b/m4/wcslen.m4
new file mode 100644 (file)
index 0000000..1f74aaf
--- /dev/null
@@ -0,0 +1,15 @@
+# wcslen.m4 serial 1
+dnl Copyright (C) 2011 Free Software Foundation, Inc.
+dnl This file is free software; the Free 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_WCSLEN],
+[
+  AC_REQUIRE([gl_WCHAR_H_DEFAULTS])
+  AC_CHECK_FUNCS_ONCE([wcslen])
+  if test $ac_cv_func_wcslen = no; then
+    HAVE_WCSLEN=0
+    AC_LIBOBJ([wcslen])
+  fi
+])
diff --git a/m4/wcsncasecmp.m4 b/m4/wcsncasecmp.m4
new file mode 100644 (file)
index 0000000..a7c4682
--- /dev/null
@@ -0,0 +1,15 @@
+# wcsncasecmp.m4 serial 1
+dnl Copyright (C) 2011 Free Software Foundation, Inc.
+dnl This file is free software; the Free 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_WCSNCASECMP],
+[
+  AC_REQUIRE([gl_WCHAR_H_DEFAULTS])
+  AC_CHECK_FUNCS_ONCE([wcsncasecmp])
+  if test $ac_cv_func_wcsncasecmp = no; then
+    HAVE_WCSNCASECMP=0
+    AC_LIBOBJ([wcsncasecmp])
+  fi
+])
diff --git a/m4/wcsncat.m4 b/m4/wcsncat.m4
new file mode 100644 (file)
index 0000000..2407529
--- /dev/null
@@ -0,0 +1,15 @@
+# wcsncat.m4 serial 1
+dnl Copyright (C) 2011 Free Software Foundation, Inc.
+dnl This file is free software; the Free 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_WCSNCAT],
+[
+  AC_REQUIRE([gl_WCHAR_H_DEFAULTS])
+  AC_CHECK_FUNCS_ONCE([wcsncat])
+  if test $ac_cv_func_wcsncat = no; then
+    HAVE_WCSNCAT=0
+    AC_LIBOBJ([wcsncat])
+  fi
+])
diff --git a/m4/wcsncmp.m4 b/m4/wcsncmp.m4
new file mode 100644 (file)
index 0000000..73544df
--- /dev/null
@@ -0,0 +1,15 @@
+# wcsncmp.m4 serial 1
+dnl Copyright (C) 2011 Free Software Foundation, Inc.
+dnl This file is free software; the Free 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_WCSNCMP],
+[
+  AC_REQUIRE([gl_WCHAR_H_DEFAULTS])
+  AC_CHECK_FUNCS_ONCE([wcsncmp])
+  if test $ac_cv_func_wcsncmp = no; then
+    HAVE_WCSNCMP=0
+    AC_LIBOBJ([wcsncmp])
+  fi
+])
diff --git a/m4/wcsncpy.m4 b/m4/wcsncpy.m4
new file mode 100644 (file)
index 0000000..a284b47
--- /dev/null
@@ -0,0 +1,15 @@
+# wcsncpy.m4 serial 1
+dnl Copyright (C) 2011 Free Software Foundation, Inc.
+dnl This file is free software; the Free 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_WCSNCPY],
+[
+  AC_REQUIRE([gl_WCHAR_H_DEFAULTS])
+  AC_CHECK_FUNCS_ONCE([wcsncpy])
+  if test $ac_cv_func_wcsncpy = no; then
+    HAVE_WCSNCPY=0
+    AC_LIBOBJ([wcsncpy])
+  fi
+])
diff --git a/m4/wcsnlen.m4 b/m4/wcsnlen.m4
new file mode 100644 (file)
index 0000000..dfa62e6
--- /dev/null
@@ -0,0 +1,15 @@
+# wcsnlen.m4 serial 1
+dnl Copyright (C) 2011 Free Software Foundation, Inc.
+dnl This file is free software; the Free 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_WCSNLEN],
+[
+  AC_REQUIRE([gl_WCHAR_H_DEFAULTS])
+  AC_CHECK_FUNCS_ONCE([wcsnlen])
+  if test $ac_cv_func_wcsnlen = no; then
+    HAVE_WCSNLEN=0
+    AC_LIBOBJ([wcsnlen])
+  fi
+])
diff --git a/m4/wcspbrk.m4 b/m4/wcspbrk.m4
new file mode 100644 (file)
index 0000000..cb6c0f8
--- /dev/null
@@ -0,0 +1,15 @@
+# wcspbrk.m4 serial 1
+dnl Copyright (C) 2011 Free Software Foundation, Inc.
+dnl This file is free software; the Free 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_WCSPBRK],
+[
+  AC_REQUIRE([gl_WCHAR_H_DEFAULTS])
+  AC_CHECK_FUNCS_ONCE([wcspbrk])
+  if test $ac_cv_func_wcspbrk = no; then
+    HAVE_WCSPBRK=0
+    AC_LIBOBJ([wcspbrk])
+  fi
+])
diff --git a/m4/wcsrchr.m4 b/m4/wcsrchr.m4
new file mode 100644 (file)
index 0000000..06c446e
--- /dev/null
@@ -0,0 +1,15 @@
+# wcsrchr.m4 serial 1
+dnl Copyright (C) 2011 Free Software Foundation, Inc.
+dnl This file is free software; the Free 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_WCSRCHR],
+[
+  AC_REQUIRE([gl_WCHAR_H_DEFAULTS])
+  AC_CHECK_FUNCS_ONCE([wcsrchr])
+  if test $ac_cv_func_wcsrchr = no; then
+    HAVE_WCSRCHR=0
+    AC_LIBOBJ([wcsrchr])
+  fi
+])
diff --git a/m4/wcsspn.m4 b/m4/wcsspn.m4
new file mode 100644 (file)
index 0000000..1225adc
--- /dev/null
@@ -0,0 +1,15 @@
+# wcsspn.m4 serial 1
+dnl Copyright (C) 2011 Free Software Foundation, Inc.
+dnl This file is free software; the Free 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_WCSSPN],
+[
+  AC_REQUIRE([gl_WCHAR_H_DEFAULTS])
+  AC_CHECK_FUNCS_ONCE([wcsspn])
+  if test $ac_cv_func_wcsspn = no; then
+    HAVE_WCSSPN=0
+    AC_LIBOBJ([wcsspn])
+  fi
+])
diff --git a/m4/wcsstr.m4 b/m4/wcsstr.m4
new file mode 100644 (file)
index 0000000..3ac2caf
--- /dev/null
@@ -0,0 +1,15 @@
+# wcsstr.m4 serial 1
+dnl Copyright (C) 2011 Free Software Foundation, Inc.
+dnl This file is free software; the Free 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_WCSSTR],
+[
+  AC_REQUIRE([gl_WCHAR_H_DEFAULTS])
+  AC_CHECK_FUNCS_ONCE([wcsstr])
+  if test $ac_cv_func_wcsstr = no; then
+    HAVE_WCSSTR=0
+    AC_LIBOBJ([wcsstr])
+  fi
+])
diff --git a/m4/wcstok.m4 b/m4/wcstok.m4
new file mode 100644 (file)
index 0000000..4c91c4f
--- /dev/null
@@ -0,0 +1,15 @@
+# wcstok.m4 serial 1
+dnl Copyright (C) 2011 Free Software Foundation, Inc.
+dnl This file is free software; the Free 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_WCSTOK],
+[
+  AC_REQUIRE([gl_WCHAR_H_DEFAULTS])
+  AC_CHECK_FUNCS_ONCE([wcstok])
+  if test $ac_cv_func_wcstok = no; then
+    HAVE_WCSTOK=0
+    AC_LIBOBJ([wcstok])
+  fi
+])
diff --git a/m4/wcswidth.m4 b/m4/wcswidth.m4
new file mode 100644 (file)
index 0000000..80ccf3f
--- /dev/null
@@ -0,0 +1,24 @@
+# wcswidth.m4 serial 1
+dnl Copyright (C) 2011 Free Software Foundation, Inc.
+dnl This file is free software; the Free 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_WCSWIDTH],
+[
+  AC_REQUIRE([gl_WCHAR_H_DEFAULTS])
+  AC_REQUIRE([gl_FUNC_WCWIDTH])
+  AC_CHECK_FUNCS_ONCE([wcswidth])
+  if test $ac_cv_func_wcswidth = no; then
+    HAVE_WCSWIDTH=0
+  else
+    if test $REPLACE_WCWIDTH = 1; then
+      dnl If wcwidth needed to be replaced, wcswidth needs to be replaced
+      dnl as well.
+      REPLACE_WCSWIDTH=1
+    fi
+  fi
+  if test $HAVE_WCSWIDTH = 0 || test $REPLACE_WCSWIDTH = 1; then
+    AC_LIBOBJ([wcswidth])
+  fi
+])
diff --git a/m4/wcsxfrm.m4 b/m4/wcsxfrm.m4
new file mode 100644 (file)
index 0000000..2fd6ec1
--- /dev/null
@@ -0,0 +1,15 @@
+# wcsxfrm.m4 serial 1
+dnl Copyright (C) 2011 Free Software Foundation, Inc.
+dnl This file is free software; the Free 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_WCSXFRM],
+[
+  AC_REQUIRE([gl_WCHAR_H_DEFAULTS])
+  AC_CHECK_FUNCS_ONCE([wcsxfrm])
+  if test $ac_cv_func_wcsxfrm = no; then
+    HAVE_WCSXFRM=0
+    AC_LIBOBJ([wcsxfrm])
+  fi
+])
diff --git a/m4/wctrans.m4 b/m4/wctrans.m4
new file mode 100644 (file)
index 0000000..f09b3fc
--- /dev/null
@@ -0,0 +1,14 @@
+# wctrans.m4 serial 1
+dnl Copyright (C) 2011 Free Software Foundation, Inc.
+dnl This file is free software; the Free 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_WCTRANS],
+[
+  AC_REQUIRE([gl_WCTYPE_H_DEFAULTS])
+  AC_REQUIRE([gl_WCTYPE_H])
+  if test $HAVE_WCTRANS_T = 0; then
+    AC_LIBOBJ([wctrans])
+  fi
+])
diff --git a/m4/wctype.m4 b/m4/wctype.m4
new file mode 100644 (file)
index 0000000..93c50d3
--- /dev/null
@@ -0,0 +1,14 @@
+# wctype.m4 serial 1
+dnl Copyright (C) 2011 Free Software Foundation, Inc.
+dnl This file is free software; the Free 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_WCTYPE],
+[
+  AC_REQUIRE([gl_WCTYPE_H_DEFAULTS])
+  AC_REQUIRE([gl_WCTYPE_H])
+  if test $HAVE_WCTYPE_T = 0; then
+    AC_LIBOBJ([wctype])
+  fi
+])
index d2b37ce..ef9fb04 100644 (file)
@@ -1,4 +1,4 @@
-# wctype_h.m4 serial 12
+# wctype_h.m4 serial 14
 
 dnl A placeholder for ISO C99 <wctype.h>, for platforms that lack it.
 
@@ -11,6 +11,7 @@ dnl Written by Paul Eggert.
 
 AC_DEFUN([gl_WCTYPE_H],
 [
+  AC_REQUIRE([gl_WCTYPE_H_DEFAULTS])
   AC_REQUIRE([AC_PROG_CC])
   AC_REQUIRE([AC_CANONICAL_HOST])
   AC_CHECK_FUNCS_ONCE([iswcntrl])
@@ -20,21 +21,6 @@ AC_DEFUN([gl_WCTYPE_H],
     HAVE_ISWCNTRL=0
   fi
   AC_SUBST([HAVE_ISWCNTRL])
-  AC_CHECK_FUNCS_ONCE([iswblank])
-  AC_CHECK_DECLS_ONCE([iswblank])
-  if test $ac_cv_func_iswblank = yes; then
-    HAVE_ISWBLANK=1
-    REPLACE_ISWBLANK=0
-  else
-    HAVE_ISWBLANK=0
-    if test $ac_cv_have_decl_iswblank = yes; then
-      REPLACE_ISWBLANK=1
-    else
-      REPLACE_ISWBLANK=0
-    fi
-  fi
-  AC_SUBST([HAVE_ISWBLANK])
-  AC_SUBST([REPLACE_ISWBLANK])
 
   AC_REQUIRE([AC_C_INLINE])
 
@@ -91,10 +77,98 @@ AC_DEFUN([gl_WCTYPE_H],
   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.
-      AC_LIBOBJ([iswblank])
-    fi
   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(
+          [[/* Tru64 with Desktop Toolkit C has a bug: <stdio.h> must be
+               included before <wchar.h>.
+               BSD/OS 4.0.1 has a bug: <stddef.h>, <stdio.h> and <time.h>
+               must be included before <wchar.h>.  */
+            #include <stddef.h>
+            #include <stdio.h>
+            #include <time.h>
+            #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(
+          [[/* Tru64 with Desktop Toolkit C has a bug: <stdio.h> must be
+               included before <wchar.h>.
+               BSD/OS 4.0.1 has a bug: <stddef.h>, <stdio.h> and <time.h>
+               must be included before <wchar.h>.  */
+            #include <stddef.h>
+            #include <stdio.h>
+            #include <time.h>
+            #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([[
+/* Tru64 with Desktop Toolkit C has a bug: <stdio.h> must be included before
+   <wchar.h>.
+   BSD/OS 4.0.1 has a bug: <stddef.h>, <stdio.h> and <time.h> must be
+   included before <wchar.h>.  */
+#if !(defined __GLIBC__ && !defined __UCLIBC__)
+# include <stddef.h>
+# include <stdio.h>
+# include <time.h>
+# include <wchar.h>
+#endif
+#include <wctype.h>
+    ]],
+    [wctype iswctype wctrans towctrans
+    ])
+])
+
+AC_DEFUN([gl_WCTYPE_MODULE_INDICATOR],
+[
+  dnl Use AC_REQUIRE here, so that the default settings are expanded once only.
+  AC_REQUIRE([gl_WCTYPE_H_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])
+])
+
+AC_DEFUN([gl_WCTYPE_H_DEFAULTS],
+[
+  GNULIB_ISWBLANK=0;    AC_SUBST([GNULIB_ISWBLANK])
+  GNULIB_WCTYPE=0;      AC_SUBST([GNULIB_WCTYPE])
+  GNULIB_ISWCTYPE=0;    AC_SUBST([GNULIB_ISWCTYPE])
+  GNULIB_WCTRANS=0;     AC_SUBST([GNULIB_WCTRANS])
+  GNULIB_TOWCTRANS=0;   AC_SUBST([GNULIB_TOWCTRANS])
+  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])
 ])
diff --git a/m4/wmemchr.m4 b/m4/wmemchr.m4
new file mode 100644 (file)
index 0000000..b2a2052
--- /dev/null
@@ -0,0 +1,15 @@
+# wmemchr.m4 serial 1
+dnl Copyright (C) 2011 Free Software Foundation, Inc.
+dnl This file is free software; the Free 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])
+  AC_CHECK_FUNCS_ONCE([wmemchr])
+  if test $ac_cv_func_wmemchr = no; then
+    HAVE_WMEMCHR=0
+    AC_LIBOBJ([wmemchr])
+  fi
+])
diff --git a/m4/wmemcmp.m4 b/m4/wmemcmp.m4
new file mode 100644 (file)
index 0000000..99e9a2a
--- /dev/null
@@ -0,0 +1,15 @@
+# wmemcmp.m4 serial 1
+dnl Copyright (C) 2011 Free Software Foundation, Inc.
+dnl This file is free software; the Free 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_WMEMCMP],
+[
+  AC_REQUIRE([gl_WCHAR_H_DEFAULTS])
+  AC_CHECK_FUNCS_ONCE([wmemcmp])
+  if test $ac_cv_func_wmemcmp = no; then
+    HAVE_WMEMCMP=0
+    AC_LIBOBJ([wmemcmp])
+  fi
+])
diff --git a/m4/wmemcpy.m4 b/m4/wmemcpy.m4
new file mode 100644 (file)
index 0000000..60af038
--- /dev/null
@@ -0,0 +1,15 @@
+# wmemcpy.m4 serial 1
+dnl Copyright (C) 2011 Free Software Foundation, Inc.
+dnl This file is free software; the Free 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_WMEMCPY],
+[
+  AC_REQUIRE([gl_WCHAR_H_DEFAULTS])
+  AC_CHECK_FUNCS_ONCE([wmemcpy])
+  if test $ac_cv_func_wmemcpy = no; then
+    HAVE_WMEMCPY=0
+    AC_LIBOBJ([wmemcpy])
+  fi
+])
diff --git a/m4/wmemmove.m4 b/m4/wmemmove.m4
new file mode 100644 (file)
index 0000000..2b4daad
--- /dev/null
@@ -0,0 +1,15 @@
+# wmemmove.m4 serial 1
+dnl Copyright (C) 2011 Free Software Foundation, Inc.
+dnl This file is free software; the Free 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_WMEMMOVE],
+[
+  AC_REQUIRE([gl_WCHAR_H_DEFAULTS])
+  AC_CHECK_FUNCS_ONCE([wmemmove])
+  if test $ac_cv_func_wmemmove = no; then
+    HAVE_WMEMMOVE=0
+    AC_LIBOBJ([wmemmove])
+  fi
+])
diff --git a/m4/wmemset.m4 b/m4/wmemset.m4
new file mode 100644 (file)
index 0000000..1e960e3
--- /dev/null
@@ -0,0 +1,15 @@
+# wmemset.m4 serial 1
+dnl Copyright (C) 2011 Free Software Foundation, Inc.
+dnl This file is free software; the Free 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_WMEMSET],
+[
+  AC_REQUIRE([gl_WCHAR_H_DEFAULTS])
+  AC_CHECK_FUNCS_ONCE([wmemset])
+  if test $ac_cv_func_wmemset = no; then
+    HAVE_WMEMSET=0
+    AC_LIBOBJ([wmemset])
+  fi
+])
diff --git a/modules/di-set b/modules/di-set
new file mode 100644 (file)
index 0000000..562db14
--- /dev/null
@@ -0,0 +1,24 @@
+Description:
+manipulate sets of device-inode pairs efficiently
+
+Files:
+lib/di-set.c
+lib/di-set.h
+
+Depends-on:
+ino-map
+hash
+
+configure.ac:
+
+Makefile.am:
+lib_SOURCES += di-set.c di-set.h
+
+Include:
+"di-set.h"
+
+License
+GPL
+
+Maintainer:
+Jim Meyering
diff --git a/modules/di-set-tests b/modules/di-set-tests
new file mode 100644 (file)
index 0000000..22bd7c1
--- /dev/null
@@ -0,0 +1,11 @@
+Files:
+tests/test-di-set.c
+tests/macros.h
+
+Depends-on:
+
+configure.ac:
+
+Makefile.am:
+TESTS += test-di-set
+check_PROGRAMS += test-di-set
index 6849b4d..bf7158f 100644 (file)
@@ -14,7 +14,7 @@ extensions
 alloca
 stdbool
 wchar
-wctype
+wctype-h
 memchr
 memcmp
 mbsrtowcs
index 7865b8f..fcbce4f 100644 (file)
@@ -6,10 +6,7 @@ lib/getloadavg.c
 m4/getloadavg.m4
 
 Depends-on:
-c-strtod
-cloexec
 extensions
-fcntl-safer
 intprops
 stdbool
 stdlib
diff --git a/modules/ino-map b/modules/ino-map
new file mode 100644 (file)
index 0000000..06ee51d
--- /dev/null
@@ -0,0 +1,24 @@
+Description:
+maintain a mapping of ino_t numbers to small integers
+
+Files:
+lib/ino-map.c
+lib/ino-map.h
+
+Depends-on:
+hash
+verify
+
+configure.ac:
+
+Makefile.am:
+lib_SOURCES += ino-map.c ino-map.h
+
+Include:
+"ino-map.h"
+
+License
+GPL
+
+Maintainer:
+Jim Meyering
diff --git a/modules/ino-map-tests b/modules/ino-map-tests
new file mode 100644 (file)
index 0000000..349b994
--- /dev/null
@@ -0,0 +1,11 @@
+Files:
+tests/test-ino-map.c
+tests/macros.h
+
+Depends-on:
+
+configure.ac:
+
+Makefile.am:
+TESTS += test-ino-map
+check_PROGRAMS += test-ino-map
diff --git a/modules/iswblank b/modules/iswblank
new file mode 100644 (file)
index 0000000..972107e
--- /dev/null
@@ -0,0 +1,25 @@
+Description:
+iswblank() function: test wide character for being blank.
+
+Files:
+lib/iswblank.c
+m4/iswblank.m4
+
+Depends-on:
+wctype-h
+extensions
+
+configure.ac:
+gl_FUNC_ISWBLANK
+gl_WCTYPE_MODULE_INDICATOR([iswblank])
+
+Makefile.am:
+
+Include:
+<wctype.h>
+
+License:
+LGPLv2+
+
+Maintainer:
+Bruno Haible
diff --git a/modules/iswblank-tests b/modules/iswblank-tests
new file mode 100644 (file)
index 0000000..cf2b5b6
--- /dev/null
@@ -0,0 +1,12 @@
+Files:
+tests/test-iswblank.c
+tests/macros.h
+
+Depends-on:
+wctype-h-c++-tests
+
+configure.ac:
+
+Makefile.am:
+TESTS += test-iswblank
+check_PROGRAMS += test-iswblank
diff --git a/modules/iswctype b/modules/iswctype
new file mode 100644 (file)
index 0000000..7054eaa
--- /dev/null
@@ -0,0 +1,31 @@
+Description:
+iswctype() function: test whether a wide character has a given property.
+
+Status:
+obsolete
+
+Notice:
+This module is obsolete.
+
+Files:
+lib/iswctype.c
+lib/iswctype-impl.h
+m4/iswctype.m4
+
+Depends-on:
+wctype-h
+
+configure.ac:
+gl_FUNC_ISWCTYPE
+gl_WCTYPE_MODULE_INDICATOR([iswctype])
+
+Makefile.am:
+
+Include:
+<wctype.h>
+
+License:
+LGPL
+
+Maintainer:
+Bruno Haible
index 7ac78ac..bcf08c7 100644 (file)
@@ -58,7 +58,8 @@ math.h: math.in.h $(CXXDEFS_H) $(ARG_NONNULL_H) $(WARN_ON_USE_H)
              -e 's|@''GNULIB_TRUNC''@|$(GNULIB_TRUNC)|g' \
              -e 's|@''GNULIB_TRUNCF''@|$(GNULIB_TRUNCF)|g' \
              -e 's|@''GNULIB_TRUNCL''@|$(GNULIB_TRUNCL)|g' \
-             -e 's|@''HAVE_ACOSL''@|$(HAVE_ACOSL)|g' \
+             < $(srcdir)/math.in.h | \
+         sed -e 's|@''HAVE_ACOSL''@|$(HAVE_ACOSL)|g' \
              -e 's|@''HAVE_ASINL''@|$(HAVE_ASINL)|g' \
              -e 's|@''HAVE_ATANL''@|$(HAVE_ATANL)|g' \
              -e 's|@''HAVE_COSL''@|$(HAVE_COSL)|g' \
@@ -92,7 +93,8 @@ math.h: math.in.h $(CXXDEFS_H) $(ARG_NONNULL_H) $(WARN_ON_USE_H)
              -e 's|@''HAVE_DECL_TRUNC''@|$(HAVE_DECL_TRUNC)|g' \
              -e 's|@''HAVE_DECL_TRUNCF''@|$(HAVE_DECL_TRUNCF)|g' \
              -e 's|@''HAVE_DECL_TRUNCL''@|$(HAVE_DECL_TRUNCL)|g' \
-             -e 's|@''REPLACE_CEIL''@|$(REPLACE_CEIL)|g' \
+         | \
+         sed -e 's|@''REPLACE_CEIL''@|$(REPLACE_CEIL)|g' \
              -e 's|@''REPLACE_CEILF''@|$(REPLACE_CEILF)|g' \
              -e 's|@''REPLACE_CEILL''@|$(REPLACE_CEILL)|g' \
              -e 's|@''REPLACE_FLOOR''@|$(REPLACE_FLOOR)|g' \
@@ -116,8 +118,7 @@ math.h: math.in.h $(CXXDEFS_H) $(ARG_NONNULL_H) $(WARN_ON_USE_H)
              -e 's|@''REPLACE_TRUNCL''@|$(REPLACE_TRUNCL)|g' \
              -e '/definitions of _GL_FUNCDECL_RPL/r $(CXXDEFS_H)' \
              -e '/definition of _GL_ARG_NONNULL/r $(ARG_NONNULL_H)' \
-             -e '/definition of _GL_WARN_ON_USE/r $(WARN_ON_USE_H)' \
-             < $(srcdir)/math.in.h; \
+             -e '/definition of _GL_WARN_ON_USE/r $(WARN_ON_USE_H)'; \
        } > $@-t && \
        mv $@-t $@
 MOSTLYCLEANFILES += math.h math.h-t
index b5e222a..2ff5907 100644 (file)
@@ -10,7 +10,8 @@ Depends-on:
 extensions
 stdbool
 wchar
-wctype
+wctype-h
+iswblank
 wcwidth
 memcmp
 
index 30ffcad..e8975b8 100644 (file)
@@ -3,6 +3,7 @@ mbsnrtowcs() function: convert string to wide string.
 
 Files:
 lib/mbsnrtowcs.c
+lib/mbsnrtowcs-impl.h
 lib/mbsrtowcs-state.c
 m4/mbsnrtowcs.m4
 m4/mbstate_t.m4
index 948763a..973b695 100644 (file)
@@ -3,6 +3,7 @@ mbsrtowcs() function: convert string to wide string.
 
 Files:
 lib/mbsrtowcs.c
+lib/mbsrtowcs-impl.h
 lib/mbsrtowcs-state.c
 m4/mbsrtowcs.m4
 m4/mbstate_t.m4
index 330748d..a7301ab 100644 (file)
@@ -10,7 +10,7 @@ m4/mbswidth.m4
 
 Depends-on:
 wchar
-wctype
+wctype-h
 mbrtowc
 mbsinit
 wcwidth
index 732ce39..f62b2c0 100644 (file)
@@ -17,7 +17,7 @@ memcmp
 quotearg-simple
 stdbool
 wchar
-wctype
+wctype-h
 xalloc
 
 configure.ac:
index cbfecdd..6a8f4c2 100644 (file)
@@ -28,7 +28,7 @@ stdint
 ssize_t
 wchar
 wcrtomb
-wctype
+wctype-h
 
 configure.ac:
 gl_REGEX
index 273095e..7d7e769 100644 (file)
@@ -10,7 +10,6 @@ arg-nonnull
 c++defs
 include_next
 stddef
-stdint
 unistd
 warn-on-use
 
@@ -55,7 +54,8 @@ stdlib.h: stdlib.in.h $(CXXDEFS_H) $(ARG_NONNULL_H) $(WARN_ON_USE_H)
              -e 's|@''GNULIB_SYSTEM_POSIX''@|$(GNULIB_SYSTEM_POSIX)|g' \
              -e 's|@''GNULIB_UNLOCKPT''@|$(GNULIB_UNLOCKPT)|g' \
              -e 's|@''GNULIB_UNSETENV''@|$(GNULIB_UNSETENV)|g' \
-             -e 's|@''HAVE__EXIT''@|$(HAVE__EXIT)|g' \
+             < $(srcdir)/stdlib.in.h | \
+         sed -e 's|@''HAVE__EXIT''@|$(HAVE__EXIT)|g' \
              -e 's|@''HAVE_ATOLL''@|$(HAVE_ATOLL)|g' \
              -e 's|@''HAVE_CANONICALIZE_FILE_NAME''@|$(HAVE_CANONICALIZE_FILE_NAME)|g' \
              -e 's|@''HAVE_DECL_GETLOADAVG''@|$(HAVE_DECL_GETLOADAVG)|g' \
@@ -91,8 +91,7 @@ stdlib.h: stdlib.in.h $(CXXDEFS_H) $(ARG_NONNULL_H) $(WARN_ON_USE_H)
              -e 's|@''REPLACE_UNSETENV''@|$(REPLACE_UNSETENV)|g' \
              -e '/definitions of _GL_FUNCDECL_RPL/r $(CXXDEFS_H)' \
              -e '/definition of _GL_ARG_NONNULL/r $(ARG_NONNULL_H)' \
-             -e '/definition of _GL_WARN_ON_USE/r $(WARN_ON_USE_H)' \
-             < $(srcdir)/stdlib.in.h; \
+             -e '/definition of _GL_WARN_ON_USE/r $(WARN_ON_USE_H)'; \
        } > $@-t && \
        mv $@-t $@
 MOSTLYCLEANFILES += stdlib.h stdlib.h-t
diff --git a/modules/towctrans b/modules/towctrans
new file mode 100644 (file)
index 0000000..3ad100d
--- /dev/null
@@ -0,0 +1,25 @@
+Description:
+towctrans() function: convert a wide character using a case mapping.
+
+Files:
+lib/towctrans.c
+lib/towctrans-impl.h
+m4/towctrans.m4
+
+Depends-on:
+wctype-h
+
+configure.ac:
+gl_FUNC_TOWCTRANS
+gl_WCTYPE_MODULE_INDICATOR([towctrans])
+
+Makefile.am:
+
+Include:
+<wctype.h>
+
+License:
+LGPL
+
+Maintainer:
+Bruno Haible
index df0870e..fbff100 100644 (file)
@@ -107,7 +107,8 @@ unistd.h: unistd.in.h $(CXXDEFS_H) $(ARG_NONNULL_H) $(WARN_ON_USE_H)
              -e 's|@''HAVE_DECL_TTYNAME_R''@|$(HAVE_DECL_TTYNAME_R)|g' \
              -e 's|@''HAVE_OS_H''@|$(HAVE_OS_H)|g' \
              -e 's|@''HAVE_SYS_PARAM_H''@|$(HAVE_SYS_PARAM_H)|g' \
-             -e 's|@''REPLACE_CHOWN''@|$(REPLACE_CHOWN)|g' \
+         | \
+         sed -e 's|@''REPLACE_CHOWN''@|$(REPLACE_CHOWN)|g' \
              -e 's|@''REPLACE_CLOSE''@|$(REPLACE_CLOSE)|g' \
              -e 's|@''REPLACE_DUP''@|$(REPLACE_DUP)|g' \
              -e 's|@''REPLACE_DUP2''@|$(REPLACE_DUP2)|g' \
index f67737d..06ee6ab 100644 (file)
@@ -41,7 +41,36 @@ wchar.h: wchar.in.h $(CXXDEFS_H) $(ARG_NONNULL_H) $(WARN_ON_USE_H)
              -e 's|@''GNULIB_WCSRTOMBS''@|$(GNULIB_WCSRTOMBS)|g' \
              -e 's|@''GNULIB_WCSNRTOMBS''@|$(GNULIB_WCSNRTOMBS)|g' \
              -e 's|@''GNULIB_WCWIDTH''@|$(GNULIB_WCWIDTH)|g' \
-             -e 's|@''HAVE_WINT_T''@|$(HAVE_WINT_T)|g' \
+             -e 's|@''GNULIB_WMEMCHR''@|$(GNULIB_WMEMCHR)|g' \
+             -e 's|@''GNULIB_WMEMCMP''@|$(GNULIB_WMEMCMP)|g' \
+             -e 's|@''GNULIB_WMEMCPY''@|$(GNULIB_WMEMCPY)|g' \
+             -e 's|@''GNULIB_WMEMMOVE''@|$(GNULIB_WMEMMOVE)|g' \
+             -e 's|@''GNULIB_WMEMSET''@|$(GNULIB_WMEMSET)|g' \
+             -e 's|@''GNULIB_WCSLEN''@|$(GNULIB_WCSLEN)|g' \
+             -e 's|@''GNULIB_WCSNLEN''@|$(GNULIB_WCSNLEN)|g' \
+             -e 's|@''GNULIB_WCSCPY''@|$(GNULIB_WCSCPY)|g' \
+             -e 's|@''GNULIB_WCPCPY''@|$(GNULIB_WCPCPY)|g' \
+             -e 's|@''GNULIB_WCSNCPY''@|$(GNULIB_WCSNCPY)|g' \
+             -e 's|@''GNULIB_WCPNCPY''@|$(GNULIB_WCPNCPY)|g' \
+             -e 's|@''GNULIB_WCSCAT''@|$(GNULIB_WCSCAT)|g' \
+             -e 's|@''GNULIB_WCSNCAT''@|$(GNULIB_WCSNCAT)|g' \
+             -e 's|@''GNULIB_WCSCMP''@|$(GNULIB_WCSCMP)|g' \
+             -e 's|@''GNULIB_WCSNCMP''@|$(GNULIB_WCSNCMP)|g' \
+             -e 's|@''GNULIB_WCSCASECMP''@|$(GNULIB_WCSCASECMP)|g' \
+             -e 's|@''GNULIB_WCSNCASECMP''@|$(GNULIB_WCSNCASECMP)|g' \
+             -e 's|@''GNULIB_WCSCOLL''@|$(GNULIB_WCSCOLL)|g' \
+             -e 's|@''GNULIB_WCSXFRM''@|$(GNULIB_WCSXFRM)|g' \
+             -e 's|@''GNULIB_WCSDUP''@|$(GNULIB_WCSDUP)|g' \
+             -e 's|@''GNULIB_WCSCHR''@|$(GNULIB_WCSCHR)|g' \
+             -e 's|@''GNULIB_WCSRCHR''@|$(GNULIB_WCSRCHR)|g' \
+             -e 's|@''GNULIB_WCSCSPN''@|$(GNULIB_WCSCSPN)|g' \
+             -e 's|@''GNULIB_WCSSPN''@|$(GNULIB_WCSSPN)|g' \
+             -e 's|@''GNULIB_WCSPBRK''@|$(GNULIB_WCSPBRK)|g' \
+             -e 's|@''GNULIB_WCSSTR''@|$(GNULIB_WCSSTR)|g' \
+             -e 's|@''GNULIB_WCSTOK''@|$(GNULIB_WCSTOK)|g' \
+             -e 's|@''GNULIB_WCSWIDTH''@|$(GNULIB_WCSWIDTH)|g' \
+             < $(srcdir)/wchar.in.h | \
+         sed -e 's|@''HAVE_WINT_T''@|$(HAVE_WINT_T)|g' \
              -e 's|@''HAVE_BTOWC''@|$(HAVE_BTOWC)|g' \
              -e 's|@''HAVE_MBSINIT''@|$(HAVE_MBSINIT)|g' \
              -e 's|@''HAVE_MBRTOWC''@|$(HAVE_MBRTOWC)|g' \
@@ -51,9 +80,38 @@ wchar.h: wchar.in.h $(CXXDEFS_H) $(ARG_NONNULL_H) $(WARN_ON_USE_H)
              -e 's|@''HAVE_WCRTOMB''@|$(HAVE_WCRTOMB)|g' \
              -e 's|@''HAVE_WCSRTOMBS''@|$(HAVE_WCSRTOMBS)|g' \
              -e 's|@''HAVE_WCSNRTOMBS''@|$(HAVE_WCSNRTOMBS)|g' \
+             -e 's|@''HAVE_WMEMCHR''@|$(HAVE_WMEMCHR)|g' \
+             -e 's|@''HAVE_WMEMCMP''@|$(HAVE_WMEMCMP)|g' \
+             -e 's|@''HAVE_WMEMCPY''@|$(HAVE_WMEMCPY)|g' \
+             -e 's|@''HAVE_WMEMMOVE''@|$(HAVE_WMEMMOVE)|g' \
+             -e 's|@''HAVE_WMEMSET''@|$(HAVE_WMEMSET)|g' \
+             -e 's|@''HAVE_WCSLEN''@|$(HAVE_WCSLEN)|g' \
+             -e 's|@''HAVE_WCSNLEN''@|$(HAVE_WCSNLEN)|g' \
+             -e 's|@''HAVE_WCSCPY''@|$(HAVE_WCSCPY)|g' \
+             -e 's|@''HAVE_WCPCPY''@|$(HAVE_WCPCPY)|g' \
+             -e 's|@''HAVE_WCSNCPY''@|$(HAVE_WCSNCPY)|g' \
+             -e 's|@''HAVE_WCPNCPY''@|$(HAVE_WCPNCPY)|g' \
+             -e 's|@''HAVE_WCSCAT''@|$(HAVE_WCSCAT)|g' \
+             -e 's|@''HAVE_WCSNCAT''@|$(HAVE_WCSNCAT)|g' \
+             -e 's|@''HAVE_WCSCMP''@|$(HAVE_WCSCMP)|g' \
+             -e 's|@''HAVE_WCSNCMP''@|$(HAVE_WCSNCMP)|g' \
+             -e 's|@''HAVE_WCSCASECMP''@|$(HAVE_WCSCASECMP)|g' \
+             -e 's|@''HAVE_WCSNCASECMP''@|$(HAVE_WCSNCASECMP)|g' \
+             -e 's|@''HAVE_WCSCOLL''@|$(HAVE_WCSCOLL)|g' \
+             -e 's|@''HAVE_WCSXFRM''@|$(HAVE_WCSXFRM)|g' \
+             -e 's|@''HAVE_WCSDUP''@|$(HAVE_WCSDUP)|g' \
+             -e 's|@''HAVE_WCSCHR''@|$(HAVE_WCSCHR)|g' \
+             -e 's|@''HAVE_WCSRCHR''@|$(HAVE_WCSRCHR)|g' \
+             -e 's|@''HAVE_WCSCSPN''@|$(HAVE_WCSCSPN)|g' \
+             -e 's|@''HAVE_WCSSPN''@|$(HAVE_WCSSPN)|g' \
+             -e 's|@''HAVE_WCSPBRK''@|$(HAVE_WCSPBRK)|g' \
+             -e 's|@''HAVE_WCSSTR''@|$(HAVE_WCSSTR)|g' \
+             -e 's|@''HAVE_WCSTOK''@|$(HAVE_WCSTOK)|g' \
+             -e 's|@''HAVE_WCSWIDTH''@|$(HAVE_WCSWIDTH)|g' \
              -e 's|@''HAVE_DECL_WCTOB''@|$(HAVE_DECL_WCTOB)|g' \
              -e 's|@''HAVE_DECL_WCWIDTH''@|$(HAVE_DECL_WCWIDTH)|g' \
-             -e 's|@''REPLACE_MBSTATE_T''@|$(REPLACE_MBSTATE_T)|g' \
+         | \
+         sed -e 's|@''REPLACE_MBSTATE_T''@|$(REPLACE_MBSTATE_T)|g' \
              -e 's|@''REPLACE_BTOWC''@|$(REPLACE_BTOWC)|g' \
              -e 's|@''REPLACE_WCTOB''@|$(REPLACE_WCTOB)|g' \
              -e 's|@''REPLACE_MBSINIT''@|$(REPLACE_MBSINIT)|g' \
@@ -65,10 +123,10 @@ wchar.h: wchar.in.h $(CXXDEFS_H) $(ARG_NONNULL_H) $(WARN_ON_USE_H)
              -e 's|@''REPLACE_WCSRTOMBS''@|$(REPLACE_WCSRTOMBS)|g' \
              -e 's|@''REPLACE_WCSNRTOMBS''@|$(REPLACE_WCSNRTOMBS)|g' \
              -e 's|@''REPLACE_WCWIDTH''@|$(REPLACE_WCWIDTH)|g' \
+             -e 's|@''REPLACE_WCSWIDTH''@|$(REPLACE_WCSWIDTH)|g' \
              -e '/definitions of _GL_FUNCDECL_RPL/r $(CXXDEFS_H)' \
              -e '/definition of _GL_ARG_NONNULL/r $(ARG_NONNULL_H)' \
-             -e '/definition of _GL_WARN_ON_USE/r $(WARN_ON_USE_H)' \
-           < $(srcdir)/wchar.in.h; \
+             -e '/definition of _GL_WARN_ON_USE/r $(WARN_ON_USE_H)'; \
        } > $@-t && \
        mv $@-t $@
 MOSTLYCLEANFILES += wchar.h wchar.h-t
diff --git a/modules/wcpcpy b/modules/wcpcpy
new file mode 100644 (file)
index 0000000..50ec8c3
--- /dev/null
@@ -0,0 +1,31 @@
+Description:
+wcpcpy() function: copy a wide string.
+
+Status:
+obsolete
+
+Notice:
+This module is obsolete.
+
+Files:
+lib/wcpcpy.c
+lib/wcpcpy-impl.h
+m4/wcpcpy.m4
+
+Depends-on:
+wchar
+
+configure.ac:
+gl_FUNC_WCPCPY
+gl_WCHAR_MODULE_INDICATOR([wcpcpy])
+
+Makefile.am:
+
+Include:
+<wchar.h>
+
+License:
+LGPL
+
+Maintainer:
+Bruno Haible
diff --git a/modules/wcpncpy b/modules/wcpncpy
new file mode 100644 (file)
index 0000000..2ba35a2
--- /dev/null
@@ -0,0 +1,25 @@
+Description:
+wcpncpy() function: copy a size-bounded wide string.
+
+Files:
+lib/wcpncpy.c
+lib/wcpncpy-impl.h
+m4/wcpncpy.m4
+
+Depends-on:
+wchar
+
+configure.ac:
+gl_FUNC_WCPNCPY
+gl_WCHAR_MODULE_INDICATOR([wcpncpy])
+
+Makefile.am:
+
+Include:
+<wchar.h>
+
+License:
+LGPL
+
+Maintainer:
+Bruno Haible
diff --git a/modules/wcscasecmp b/modules/wcscasecmp
new file mode 100644 (file)
index 0000000..18c549c
--- /dev/null
@@ -0,0 +1,26 @@
+Description:
+wcscasecmp() function: compare two wide strings ignoring case.
+
+Files:
+lib/wcscasecmp.c
+lib/wcscasecmp-impl.h
+m4/wcscasecmp.m4
+
+Depends-on:
+wchar
+wctype-h
+
+configure.ac:
+gl_FUNC_WCSCASECMP
+gl_WCHAR_MODULE_INDICATOR([wcscasecmp])
+
+Makefile.am:
+
+Include:
+<wchar.h>
+
+License:
+LGPL
+
+Maintainer:
+Bruno Haible
diff --git a/modules/wcscat b/modules/wcscat
new file mode 100644 (file)
index 0000000..bba014e
--- /dev/null
@@ -0,0 +1,31 @@
+Description:
+wcscat() function: concatenate two wide strings.
+
+Status:
+obsolete
+
+Notice:
+This module is obsolete.
+
+Files:
+lib/wcscat.c
+lib/wcscat-impl.h
+m4/wcscat.m4
+
+Depends-on:
+wchar
+
+configure.ac:
+gl_FUNC_WCSCAT
+gl_WCHAR_MODULE_INDICATOR([wcscat])
+
+Makefile.am:
+
+Include:
+<wchar.h>
+
+License:
+LGPL
+
+Maintainer:
+Bruno Haible
diff --git a/modules/wcschr b/modules/wcschr
new file mode 100644 (file)
index 0000000..a84a91a
--- /dev/null
@@ -0,0 +1,31 @@
+Description:
+wcschr() function: search wide string for a wide character.
+
+Status:
+obsolete
+
+Notice:
+This module is obsolete.
+
+Files:
+lib/wcschr.c
+lib/wcschr-impl.h
+m4/wcschr.m4
+
+Depends-on:
+wchar
+
+configure.ac:
+gl_FUNC_WCSCHR
+gl_WCHAR_MODULE_INDICATOR([wcschr])
+
+Makefile.am:
+
+Include:
+<wchar.h>
+
+License:
+LGPL
+
+Maintainer:
+Bruno Haible
diff --git a/modules/wcscmp b/modules/wcscmp
new file mode 100644 (file)
index 0000000..27c1621
--- /dev/null
@@ -0,0 +1,31 @@
+Description:
+wcscmp() function: compare two wide strings.
+
+Status:
+obsolete
+
+Notice:
+This module is obsolete.
+
+Files:
+lib/wcscmp.c
+lib/wcscmp-impl.h
+m4/wcscmp.m4
+
+Depends-on:
+wchar
+
+configure.ac:
+gl_FUNC_WCSCMP
+gl_WCHAR_MODULE_INDICATOR([wcscmp])
+
+Makefile.am:
+
+Include:
+<wchar.h>
+
+License:
+LGPL
+
+Maintainer:
+Bruno Haible
diff --git a/modules/wcscoll b/modules/wcscoll
new file mode 100644 (file)
index 0000000..d5c4836
--- /dev/null
@@ -0,0 +1,31 @@
+Description:
+wcscoll() function: compare two wide strings using the current locale.
+
+Status:
+obsolete
+
+Notice:
+This module is obsolete.
+
+Files:
+lib/wcscoll.c
+lib/wcscoll-impl.h
+m4/wcscoll.m4
+
+Depends-on:
+wchar
+
+configure.ac:
+gl_FUNC_WCSCOLL
+gl_WCHAR_MODULE_INDICATOR([wcscoll])
+
+Makefile.am:
+
+Include:
+<wchar.h>
+
+License:
+LGPL
+
+Maintainer:
+Bruno Haible
diff --git a/modules/wcscpy b/modules/wcscpy
new file mode 100644 (file)
index 0000000..89e30c1
--- /dev/null
@@ -0,0 +1,31 @@
+Description:
+wcscpy() function: copy a wide string.
+
+Status:
+obsolete
+
+Notice:
+This module is obsolete.
+
+Files:
+lib/wcscpy.c
+lib/wcscpy-impl.h
+m4/wcscpy.m4
+
+Depends-on:
+wchar
+
+configure.ac:
+gl_FUNC_WCSCPY
+gl_WCHAR_MODULE_INDICATOR([wcscpy])
+
+Makefile.am:
+
+Include:
+<wchar.h>
+
+License:
+LGPL
+
+Maintainer:
+Bruno Haible
diff --git a/modules/wcscspn b/modules/wcscspn
new file mode 100644 (file)
index 0000000..2034b81
--- /dev/null
@@ -0,0 +1,33 @@
+Description:
+wcscspn() function: search a wide string for any of a set of wide characters.
+
+Status:
+obsolete
+
+Notice:
+This module is obsolete.
+
+Files:
+lib/wcscspn.c
+lib/wcscspn-impl.h
+m4/wcscspn.m4
+
+Depends-on:
+wchar
+wcslen
+wcschr
+
+configure.ac:
+gl_FUNC_WCSCSPN
+gl_WCHAR_MODULE_INDICATOR([wcscspn])
+
+Makefile.am:
+
+Include:
+<wchar.h>
+
+License:
+LGPL
+
+Maintainer:
+Bruno Haible
diff --git a/modules/wcsdup b/modules/wcsdup
new file mode 100644 (file)
index 0000000..7e3cd66
--- /dev/null
@@ -0,0 +1,27 @@
+Description:
+wcsdup() function: duplicate a wide string.
+
+Files:
+lib/wcsdup.c
+lib/wcsdup-impl.h
+m4/wcsdup.m4
+
+Depends-on:
+wchar
+wcslen
+wmemcpy
+
+configure.ac:
+gl_FUNC_WCSDUP
+gl_WCHAR_MODULE_INDICATOR([wcsdup])
+
+Makefile.am:
+
+Include:
+<wchar.h>
+
+License:
+LGPL
+
+Maintainer:
+Bruno Haible
diff --git a/modules/wcslen b/modules/wcslen
new file mode 100644 (file)
index 0000000..2dc00a6
--- /dev/null
@@ -0,0 +1,31 @@
+Description:
+wcslen() function: determine the length of a wide string.
+
+Status:
+obsolete
+
+Notice:
+This module is obsolete.
+
+Files:
+lib/wcslen.c
+lib/wcslen-impl.h
+m4/wcslen.m4
+
+Depends-on:
+wchar
+
+configure.ac:
+gl_FUNC_WCSLEN
+gl_WCHAR_MODULE_INDICATOR([wcslen])
+
+Makefile.am:
+
+Include:
+<wchar.h>
+
+License:
+LGPL
+
+Maintainer:
+Bruno Haible
diff --git a/modules/wcsncasecmp b/modules/wcsncasecmp
new file mode 100644 (file)
index 0000000..88f3619
--- /dev/null
@@ -0,0 +1,26 @@
+Description:
+wcsncasecmp() function: compare two wide strings ignoring case.
+
+Files:
+lib/wcsncasecmp.c
+lib/wcsncasecmp-impl.h
+m4/wcsncasecmp.m4
+
+Depends-on:
+wchar
+wctype-h
+
+configure.ac:
+gl_FUNC_WCSNCASECMP
+gl_WCHAR_MODULE_INDICATOR([wcsncasecmp])
+
+Makefile.am:
+
+Include:
+<wchar.h>
+
+License:
+LGPL
+
+Maintainer:
+Bruno Haible
diff --git a/modules/wcsncat b/modules/wcsncat
new file mode 100644 (file)
index 0000000..0bdc510
--- /dev/null
@@ -0,0 +1,31 @@
+Description:
+wcsncat() function: append part of a wide string to a wide string.
+
+Status:
+obsolete
+
+Notice:
+This module is obsolete.
+
+Files:
+lib/wcsncat.c
+lib/wcsncat-impl.h
+m4/wcsncat.m4
+
+Depends-on:
+wchar
+
+configure.ac:
+gl_FUNC_WCSNCAT
+gl_WCHAR_MODULE_INDICATOR([wcsncat])
+
+Makefile.am:
+
+Include:
+<wchar.h>
+
+License:
+LGPL
+
+Maintainer:
+Bruno Haible
diff --git a/modules/wcsncmp b/modules/wcsncmp
new file mode 100644 (file)
index 0000000..1b19a53
--- /dev/null
@@ -0,0 +1,31 @@
+Description:
+wcsncmp() function: compare two wide strings.
+
+Status:
+obsolete
+
+Notice:
+This module is obsolete.
+
+Files:
+lib/wcsncmp.c
+lib/wcsncmp-impl.h
+m4/wcsncmp.m4
+
+Depends-on:
+wchar
+
+configure.ac:
+gl_FUNC_WCSNCMP
+gl_WCHAR_MODULE_INDICATOR([wcsncmp])
+
+Makefile.am:
+
+Include:
+<wchar.h>
+
+License:
+LGPL
+
+Maintainer:
+Bruno Haible
diff --git a/modules/wcsncpy b/modules/wcsncpy
new file mode 100644 (file)
index 0000000..e1c4996
--- /dev/null
@@ -0,0 +1,31 @@
+Description:
+wcsncpy() function: copy a size-bounded wide string.
+
+Status:
+obsolete
+
+Notice:
+This module is obsolete.
+
+Files:
+lib/wcsncpy.c
+lib/wcsncpy-impl.h
+m4/wcsncpy.m4
+
+Depends-on:
+wchar
+
+configure.ac:
+gl_FUNC_WCSNCPY
+gl_WCHAR_MODULE_INDICATOR([wcsncpy])
+
+Makefile.am:
+
+Include:
+<wchar.h>
+
+License:
+LGPL
+
+Maintainer:
+Bruno Haible
diff --git a/modules/wcsnlen b/modules/wcsnlen
new file mode 100644 (file)
index 0000000..7ae8d88
--- /dev/null
@@ -0,0 +1,25 @@
+Description:
+wcsnlen() function: determine the length of a size-bounded wide string.
+
+Files:
+lib/wcsnlen.c
+lib/wcsnlen-impl.h
+m4/wcsnlen.m4
+
+Depends-on:
+wchar
+
+configure.ac:
+gl_FUNC_WCSNLEN
+gl_WCHAR_MODULE_INDICATOR([wcsnlen])
+
+Makefile.am:
+
+Include:
+<wchar.h>
+
+License:
+LGPL
+
+Maintainer:
+Bruno Haible
index 2ee1be3..e8e975a 100644 (file)
@@ -3,6 +3,7 @@ wcsnrtombs() function: convert wide string to string.
 
 Files:
 lib/wcsnrtombs.c
+lib/wcsnrtombs-impl.h
 lib/wcsrtombs-state.c
 m4/wcsnrtombs.m4
 m4/mbrtowc.m4
diff --git a/modules/wcspbrk b/modules/wcspbrk
new file mode 100644 (file)
index 0000000..a5b34f5
--- /dev/null
@@ -0,0 +1,32 @@
+Description:
+wcspbrk() function: search a wide string for any of a set of wide characters.
+
+Status:
+obsolete
+
+Notice:
+This module is obsolete.
+
+Files:
+lib/wcspbrk.c
+lib/wcspbrk-impl.h
+m4/wcspbrk.m4
+
+Depends-on:
+wchar
+wcschr
+
+configure.ac:
+gl_FUNC_WCSPBRK
+gl_WCHAR_MODULE_INDICATOR([wcspbrk])
+
+Makefile.am:
+
+Include:
+<wchar.h>
+
+License:
+LGPL
+
+Maintainer:
+Bruno Haible
diff --git a/modules/wcsrchr b/modules/wcsrchr
new file mode 100644 (file)
index 0000000..903abba
--- /dev/null
@@ -0,0 +1,31 @@
+Description:
+wcsrchr() function: search wide string for a wide character.
+
+Status:
+obsolete
+
+Notice:
+This module is obsolete.
+
+Files:
+lib/wcsrchr.c
+lib/wcsrchr-impl.h
+m4/wcsrchr.m4
+
+Depends-on:
+wchar
+
+configure.ac:
+gl_FUNC_WCSRCHR
+gl_WCHAR_MODULE_INDICATOR([wcsrchr])
+
+Makefile.am:
+
+Include:
+<wchar.h>
+
+License:
+LGPL
+
+Maintainer:
+Bruno Haible
index 876f369..235b06b 100644 (file)
@@ -3,6 +3,7 @@ wcsrtombs() function: convert wide string to string.
 
 Files:
 lib/wcsrtombs.c
+lib/wcsrtombs-impl.h
 lib/wcsrtombs-state.c
 m4/wcsrtombs.m4
 m4/mbrtowc.m4
diff --git a/modules/wcsspn b/modules/wcsspn
new file mode 100644 (file)
index 0000000..3ecd53b
--- /dev/null
@@ -0,0 +1,32 @@
+Description:
+wcsspn() function: advance in a wide string, skipping any of a set of wide characters.
+
+Status:
+obsolete
+
+Notice:
+This module is obsolete.
+
+Files:
+lib/wcsspn.c
+lib/wcsspn-impl.h
+m4/wcsspn.m4
+
+Depends-on:
+wchar
+wcschr
+
+configure.ac:
+gl_FUNC_WCSSPN
+gl_WCHAR_MODULE_INDICATOR([wcsspn])
+
+Makefile.am:
+
+Include:
+<wchar.h>
+
+License:
+LGPL
+
+Maintainer:
+Bruno Haible
diff --git a/modules/wcsstr b/modules/wcsstr
new file mode 100644 (file)
index 0000000..22a2fb7
--- /dev/null
@@ -0,0 +1,26 @@
+Description:
+wcsstr() function: locate a substring in a wide string.
+
+Files:
+lib/wcsstr.c
+lib/wcsstr-impl.h
+m4/wcsstr.m4
+
+Depends-on:
+wchar
+wcschr
+
+configure.ac:
+gl_FUNC_WCSSTR
+gl_WCHAR_MODULE_INDICATOR([wcsstr])
+
+Makefile.am:
+
+Include:
+<wchar.h>
+
+License:
+LGPL
+
+Maintainer:
+Bruno Haible
diff --git a/modules/wcstok b/modules/wcstok
new file mode 100644 (file)
index 0000000..6f92b05
--- /dev/null
@@ -0,0 +1,27 @@
+Description:
+wcstok() function: split a wide string into tokens.
+
+Files:
+lib/wcstok.c
+lib/wcstok-impl.h
+m4/wcstok.m4
+
+Depends-on:
+wchar
+wcsspn
+wcspbrk
+
+configure.ac:
+gl_FUNC_WCSTOK
+gl_WCHAR_MODULE_INDICATOR([wcstok])
+
+Makefile.am:
+
+Include:
+<wchar.h>
+
+License:
+LGPL
+
+Maintainer:
+Bruno Haible
diff --git a/modules/wcswidth b/modules/wcswidth
new file mode 100644 (file)
index 0000000..2b748eb
--- /dev/null
@@ -0,0 +1,27 @@
+Description:
+wcswidth() function: determine number of screen columns needed for a
+size-bounded wide string.
+
+Files:
+lib/wcswidth.c
+lib/wcswidth-impl.h
+m4/wcswidth.m4
+
+Depends-on:
+wchar
+wcwidth
+
+configure.ac:
+gl_FUNC_WCSWIDTH
+gl_WCHAR_MODULE_INDICATOR([wcswidth])
+
+Makefile.am:
+
+Include:
+<wchar.h>
+
+License:
+LGPL
+
+Maintainer:
+Bruno Haible
diff --git a/modules/wcsxfrm b/modules/wcsxfrm
new file mode 100644 (file)
index 0000000..c5a1ee9
--- /dev/null
@@ -0,0 +1,26 @@
+Description:
+wcsxfrm() function: transform wide string for comparison using the current
+locale.
+
+Files:
+lib/wcsxfrm.c
+lib/wcsxfrm-impl.h
+m4/wcsxfrm.m4
+
+Depends-on:
+wchar
+
+configure.ac:
+gl_FUNC_WCSXFRM
+gl_WCHAR_MODULE_INDICATOR([wcsxfrm])
+
+Makefile.am:
+
+Include:
+<wchar.h>
+
+License:
+LGPL
+
+Maintainer:
+Bruno Haible
diff --git a/modules/wctrans b/modules/wctrans
new file mode 100644 (file)
index 0000000..c1eaeaa
--- /dev/null
@@ -0,0 +1,25 @@
+Description:
+wctrans() function: get descriptor for a wide character case conversion.
+
+Files:
+lib/wctrans.c
+lib/wctrans-impl.h
+m4/wctrans.m4
+
+Depends-on:
+wctype-h
+
+configure.ac:
+gl_FUNC_WCTRANS
+gl_WCTYPE_MODULE_INDICATOR([wctrans])
+
+Makefile.am:
+
+Include:
+<wctype.h>
+
+License:
+LGPL
+
+Maintainer:
+Bruno Haible
index 99dbe44..d248164 100644 (file)
@@ -1,50 +1,32 @@
 Description:
-A <wctype.h> that conforms better to C99.
+wctype() function: get descriptor for a wide character property.
+
+Status:
+obsolete
+
+Notice:
+This module is obsolete.
 
 Files:
-lib/wctype.in.h
-lib/iswblank.c
-m4/wctype_h.m4
-m4/wint_t.m4
+lib/wctype.c
+lib/wctype-impl.h
+m4/wctype.m4
 
 Depends-on:
-include_next
-c++defs
-warn-on-use
+wctype-h
+iswblank
 
 configure.ac:
-gl_WCTYPE_H
+gl_FUNC_WCTYPE
+gl_WCTYPE_MODULE_INDICATOR([wctype])
 
 Makefile.am:
-BUILT_SOURCES += wctype.h
-
-# We need the following in order to create <wctype.h> when the system
-# doesn't have one that works with the given compiler.
-wctype.h: wctype.in.h $(CXXDEFS_H) $(WARN_ON_USE_H)
-       $(AM_V_GEN)rm -f $@-t $@ && \
-       { echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */'; \
-         sed -e 's/@''HAVE_WCTYPE_H''@/$(HAVE_WCTYPE_H)/g' \
-             -e 's|@''INCLUDE_NEXT''@|$(INCLUDE_NEXT)|g' \
-             -e 's|@''PRAGMA_SYSTEM_HEADER''@|@PRAGMA_SYSTEM_HEADER@|g' \
-             -e 's|@''PRAGMA_COLUMNS''@|@PRAGMA_COLUMNS@|g' \
-             -e 's|@''NEXT_WCTYPE_H''@|$(NEXT_WCTYPE_H)|g' \
-             -e 's/@''HAVE_ISWBLANK''@/$(HAVE_ISWBLANK)/g' \
-             -e 's/@''HAVE_ISWCNTRL''@/$(HAVE_ISWCNTRL)/g' \
-             -e 's/@''HAVE_WINT_T''@/$(HAVE_WINT_T)/g' \
-             -e 's/@''REPLACE_ISWBLANK''@/$(REPLACE_ISWBLANK)/g' \
-             -e 's/@''REPLACE_ISWCNTRL''@/$(REPLACE_ISWCNTRL)/g' \
-             -e '/definitions of _GL_FUNCDECL_RPL/r $(CXXDEFS_H)' \
-             -e '/definition of _GL_WARN_ON_USE/r $(WARN_ON_USE_H)' \
-             < $(srcdir)/wctype.in.h; \
-       } > $@-t && \
-       mv $@-t $@
-MOSTLYCLEANFILES += wctype.h wctype.h-t
 
 Include:
 <wctype.h>
 
 License:
-LGPLv2+
+LGPL
 
 Maintainer:
-all
+Bruno Haible
diff --git a/modules/wctype-c++-tests b/modules/wctype-c++-tests
deleted file mode 100644 (file)
index 3f794dd..0000000
+++ /dev/null
@@ -1,19 +0,0 @@
-Files:
-tests/test-wctype-c++.cc
-tests/signature.h
-
-Status:
-c++-test
-
-Depends-on:
-ansi-c++-opt
-
-configure.ac:
-
-Makefile.am:
-if ANSICXX
-TESTS += test-wctype-c++
-check_PROGRAMS += test-wctype-c++
-test_wctype_c___SOURCES = test-wctype-c++.cc
-test_wctype_c___LDADD = $(LDADD) $(LIBINTL) $(LIB_NANOSLEEP) $(LIB_EACCESS)
-endif
diff --git a/modules/wctype-h b/modules/wctype-h
new file mode 100644 (file)
index 0000000..f0d7989
--- /dev/null
@@ -0,0 +1,56 @@
+Description:
+A <wctype.h> that conforms better to C99.
+
+Files:
+lib/wctype.in.h
+m4/wctype_h.m4
+m4/wint_t.m4
+
+Depends-on:
+include_next
+c++defs
+warn-on-use
+
+configure.ac:
+gl_WCTYPE_H
+
+Makefile.am:
+BUILT_SOURCES += wctype.h
+
+# We need the following in order to create <wctype.h> when the system
+# doesn't have one that works with the given compiler.
+wctype.h: wctype.in.h $(CXXDEFS_H) $(WARN_ON_USE_H)
+       $(AM_V_GEN)rm -f $@-t $@ && \
+       { echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */'; \
+         sed -e 's/@''HAVE_WCTYPE_H''@/$(HAVE_WCTYPE_H)/g' \
+             -e 's|@''INCLUDE_NEXT''@|$(INCLUDE_NEXT)|g' \
+             -e 's|@''PRAGMA_SYSTEM_HEADER''@|@PRAGMA_SYSTEM_HEADER@|g' \
+             -e 's|@''PRAGMA_COLUMNS''@|@PRAGMA_COLUMNS@|g' \
+             -e 's|@''NEXT_WCTYPE_H''@|$(NEXT_WCTYPE_H)|g' \
+             -e 's/@''GNULIB_ISWBLANK''@/$(GNULIB_ISWBLANK)/g' \
+             -e 's/@''GNULIB_WCTYPE''@/$(GNULIB_WCTYPE)/g' \
+             -e 's/@''GNULIB_ISWCTYPE''@/$(GNULIB_ISWCTYPE)/g' \
+             -e 's/@''GNULIB_WCTRANS''@/$(GNULIB_WCTRANS)/g' \
+             -e 's/@''GNULIB_TOWCTRANS''@/$(GNULIB_TOWCTRANS)/g' \
+             -e 's/@''HAVE_ISWBLANK''@/$(HAVE_ISWBLANK)/g' \
+             -e 's/@''HAVE_ISWCNTRL''@/$(HAVE_ISWCNTRL)/g' \
+             -e 's/@''HAVE_WCTYPE_T''@/$(HAVE_WCTYPE_T)/g' \
+             -e 's/@''HAVE_WCTRANS_T''@/$(HAVE_WCTRANS_T)/g' \
+             -e 's/@''HAVE_WINT_T''@/$(HAVE_WINT_T)/g' \
+             -e 's/@''REPLACE_ISWBLANK''@/$(REPLACE_ISWBLANK)/g' \
+             -e 's/@''REPLACE_ISWCNTRL''@/$(REPLACE_ISWCNTRL)/g' \
+             -e '/definitions of _GL_FUNCDECL_RPL/r $(CXXDEFS_H)' \
+             -e '/definition of _GL_WARN_ON_USE/r $(WARN_ON_USE_H)' \
+             < $(srcdir)/wctype.in.h; \
+       } > $@-t && \
+       mv $@-t $@
+MOSTLYCLEANFILES += wctype.h wctype.h-t
+
+Include:
+<wctype.h>
+
+License:
+LGPLv2+
+
+Maintainer:
+all
diff --git a/modules/wctype-h-c++-tests b/modules/wctype-h-c++-tests
new file mode 100644 (file)
index 0000000..2b22df4
--- /dev/null
@@ -0,0 +1,19 @@
+Files:
+tests/test-wctype-h-c++.cc
+tests/signature.h
+
+Status:
+c++-test
+
+Depends-on:
+ansi-c++-opt
+
+configure.ac:
+
+Makefile.am:
+if ANSICXX
+TESTS += test-wctype-h-c++
+check_PROGRAMS += test-wctype-h-c++
+test_wctype_h_c___SOURCES = test-wctype-h-c++.cc
+test_wctype_h_c___LDADD = $(LDADD) $(LIBINTL) $(LIB_NANOSLEEP) $(LIB_EACCESS)
+endif
diff --git a/modules/wctype-h-tests b/modules/wctype-h-tests
new file mode 100644 (file)
index 0000000..5cce746
--- /dev/null
@@ -0,0 +1,12 @@
+Files:
+tests/test-wctype-h.c
+tests/macros.h
+
+Depends-on:
+wctype-h-c++-tests
+
+configure.ac:
+
+Makefile.am:
+TESTS += test-wctype-h
+check_PROGRAMS += test-wctype-h
diff --git a/modules/wctype-tests b/modules/wctype-tests
deleted file mode 100644 (file)
index 41b1b0d..0000000
+++ /dev/null
@@ -1,12 +0,0 @@
-Files:
-tests/test-wctype.c
-tests/macros.h
-
-Depends-on:
-wctype-c++-tests
-
-configure.ac:
-
-Makefile.am:
-TESTS += test-wctype
-check_PROGRAMS += test-wctype
index fe410f1..e4a9460 100644 (file)
@@ -10,7 +10,7 @@ m4/wint_t.m4
 Depends-on:
 extensions
 wchar
-wctype
+wctype-h
 localcharset
 streq
 uniwidth/width
diff --git a/modules/wmemchr b/modules/wmemchr
new file mode 100644 (file)
index 0000000..e50e62d
--- /dev/null
@@ -0,0 +1,25 @@
+Description:
+wmemchr() function: search wide character array for a wide character.
+
+Files:
+lib/wmemchr.c
+lib/wmemchr-impl.h
+m4/wmemchr.m4
+
+Depends-on:
+wchar
+
+configure.ac:
+gl_FUNC_WMEMCHR
+gl_WCHAR_MODULE_INDICATOR([wmemchr])
+
+Makefile.am:
+
+Include:
+<wchar.h>
+
+License:
+LGPL
+
+Maintainer:
+Bruno Haible
diff --git a/modules/wmemcmp b/modules/wmemcmp
new file mode 100644 (file)
index 0000000..21e724a
--- /dev/null
@@ -0,0 +1,25 @@
+Description:
+wmemcmp() function: compare wide character arrays.
+
+Files:
+lib/wmemcmp.c
+lib/wmemcmp-impl.h
+m4/wmemcmp.m4
+
+Depends-on:
+wchar
+
+configure.ac:
+gl_FUNC_WMEMCMP
+gl_WCHAR_MODULE_INDICATOR([wmemcmp])
+
+Makefile.am:
+
+Include:
+<wchar.h>
+
+License:
+LGPL
+
+Maintainer:
+Bruno Haible
diff --git a/modules/wmemcpy b/modules/wmemcpy
new file mode 100644 (file)
index 0000000..4e15fa6
--- /dev/null
@@ -0,0 +1,25 @@
+Description:
+wmemcpy() function: copy wide character array.
+
+Files:
+lib/wmemcpy.c
+lib/wmemcpy-impl.h
+m4/wmemcpy.m4
+
+Depends-on:
+wchar
+
+configure.ac:
+gl_FUNC_WMEMCPY
+gl_WCHAR_MODULE_INDICATOR([wmemcpy])
+
+Makefile.am:
+
+Include:
+<wchar.h>
+
+License:
+LGPL
+
+Maintainer:
+Bruno Haible
diff --git a/modules/wmemmove b/modules/wmemmove
new file mode 100644 (file)
index 0000000..ac03e77
--- /dev/null
@@ -0,0 +1,25 @@
+Description:
+wmemmove() function: copy wide character array.
+
+Files:
+lib/wmemmove.c
+lib/wmemmove-impl.h
+m4/wmemmove.m4
+
+Depends-on:
+wchar
+
+configure.ac:
+gl_FUNC_WMEMMOVE
+gl_WCHAR_MODULE_INDICATOR([wmemmove])
+
+Makefile.am:
+
+Include:
+<wchar.h>
+
+License:
+LGPL
+
+Maintainer:
+Bruno Haible
diff --git a/modules/wmemset b/modules/wmemset
new file mode 100644 (file)
index 0000000..4a551da
--- /dev/null
@@ -0,0 +1,25 @@
+Description:
+wmemset() function: fill wide character array.
+
+Files:
+lib/wmemset.c
+lib/wmemset-impl.h
+m4/wmemset.m4
+
+Depends-on:
+wchar
+
+configure.ac:
+gl_FUNC_WMEMSET
+gl_WCHAR_MODULE_INDICATOR([wmemset])
+
+Makefile.am:
+
+Include:
+<wchar.h>
+
+License:
+LGPL
+
+Maintainer:
+Bruno Haible
diff --git a/tests/test-di-set.c b/tests/test-di-set.c
new file mode 100644 (file)
index 0000000..f3ea690
--- /dev/null
@@ -0,0 +1,53 @@
+/* Test the di-set module.
+   Copyright (C) 2010-2011 Free Software Foundation, Inc.
+
+   This program is free software: you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation; either version 3 of the License, or
+   (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
+
+/* Written by Jim Meyering.  */
+
+#include <config.h>
+
+#include "di-set.h"
+
+#include "macros.h"
+
+int
+main (void)
+{
+  struct di_set *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;
+}
diff --git a/tests/test-ino-map.c b/tests/test-ino-map.c
new file mode 100644 (file)
index 0000000..ef25971
--- /dev/null
@@ -0,0 +1,50 @@
+/* Test the ino-map module.
+   Copyright (C) 2010-2011 Free Software Foundation, Inc.
+
+   This program is free software: you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation; either version 3 of the License, or
+   (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
+
+/* Written by Jim Meyering.  */
+
+#include <config.h>
+
+#include "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;
+}
diff --git a/tests/test-iswblank.c b/tests/test-iswblank.c
new file mode 100644 (file)
index 0000000..5ed4f89
--- /dev/null
@@ -0,0 +1,35 @@
+/* Test of iswblank() function.
+   Copyright (C) 2007-2011 Free Software Foundation, Inc.
+
+   This program is free software: you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation; either version 3 of the License, or
+   (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
+
+#include <config.h>
+
+#include <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));
+
+  return 0;
+}
index 2e25d8e..b2fdaf9 100644 (file)
@@ -74,8 +74,8 @@ main (void)
         if (ret == 0)
           {
             /* Truncated result.  POSIX allows this, and it actually
-               happens on AIX 6.1.  */
-            ASSERT (strcmp (buf, "BADFACE") != 0);
+               happens on AIX 6.1 and Cygwin.  */
+            ASSERT ((strcmp (buf, "BADFACE") == 0) == (i == 0));
           }
         else
           {
index 502de29..9b28e31 100644 (file)
@@ -75,6 +75,142 @@ SIGNATURE_CHECK (GNULIB_NAMESPACE::wcsnrtombs, size_t,
 SIGNATURE_CHECK (GNULIB_NAMESPACE::wcwidth, int, (wchar_t));
 #endif
 
+#if GNULIB_TEST_WMEMCHR
+SIGNATURE_CHECK (GNULIB_NAMESPACE::wmemchr, wchar_t *,
+                 (const wchar_t *, wchar_t, size_t));
+#endif
+
+#if GNULIB_TEST_WMEMCMP
+SIGNATURE_CHECK (GNULIB_NAMESPACE::wmemcmp, int,
+                 (const wchar_t *, const wchar_t *, size_t));
+#endif
+
+#if GNULIB_TEST_WMEMCPY
+SIGNATURE_CHECK (GNULIB_NAMESPACE::wmemcpy, wchar_t *,
+                 (wchar_t *, const wchar_t *, size_t));
+#endif
+
+#if GNULIB_TEST_WMEMMOVE
+SIGNATURE_CHECK (GNULIB_NAMESPACE::wmemmove, wchar_t *,
+                 (wchar_t *, const wchar_t *, size_t));
+#endif
+
+#if GNULIB_TEST_WMEMSET
+SIGNATURE_CHECK (GNULIB_NAMESPACE::wmemset, wchar_t *,
+                 (wchar_t *, wchar_t, size_t));
+#endif
+
+#if GNULIB_TEST_WCSLEN
+SIGNATURE_CHECK (GNULIB_NAMESPACE::wcslen, size_t, (const wchar_t *));
+#endif
+
+#if GNULIB_TEST_WCSNLEN
+SIGNATURE_CHECK (GNULIB_NAMESPACE::wcsnlen, size_t, (const wchar_t *, size_t));
+#endif
+
+#if GNULIB_TEST_WCSCPY
+SIGNATURE_CHECK (GNULIB_NAMESPACE::wcscpy, wchar_t *,
+                 (wchar_t *, const wchar_t *));
+#endif
+
+#if GNULIB_TEST_WCPCPY
+SIGNATURE_CHECK (GNULIB_NAMESPACE::wcpcpy, wchar_t *,
+                 (wchar_t *, const wchar_t *));
+#endif
+
+#if GNULIB_TEST_WCSNCPY
+SIGNATURE_CHECK (GNULIB_NAMESPACE::wcsncpy, wchar_t *,
+                 (wchar_t *, const wchar_t *, size_t));
+#endif
+
+#if GNULIB_TEST_WCPNCPY
+SIGNATURE_CHECK (GNULIB_NAMESPACE::wcpncpy, wchar_t *,
+                 (wchar_t *, const wchar_t *, size_t));
+#endif
+
+#if GNULIB_TEST_WCSCAT
+SIGNATURE_CHECK (GNULIB_NAMESPACE::wcscat, wchar_t *,
+                 (wchar_t *, const wchar_t *));
+#endif
+
+#if GNULIB_TEST_WCSNCAT
+SIGNATURE_CHECK (GNULIB_NAMESPACE::wcsncat, wchar_t *,
+                 (wchar_t *, const wchar_t *, size_t));
+#endif
+
+#if GNULIB_TEST_WCSCMP
+SIGNATURE_CHECK (GNULIB_NAMESPACE::wcscmp, int,
+                 (const wchar_t *, const wchar_t *));
+#endif
+
+#if GNULIB_TEST_WCSNCMP
+SIGNATURE_CHECK (GNULIB_NAMESPACE::wcsncmp, int,
+                 (const wchar_t *, const wchar_t *, size_t));
+#endif
+
+#if GNULIB_TEST_WCSCASECMP
+SIGNATURE_CHECK (GNULIB_NAMESPACE::wcscasecmp, int,
+                 (const wchar_t *, const wchar_t *));
+#endif
+
+#if GNULIB_TEST_WCSNCASECMP
+SIGNATURE_CHECK (GNULIB_NAMESPACE::wcsncasecmp, int,
+                 (const wchar_t *, const wchar_t *, size_t));
+#endif
+
+#if GNULIB_TEST_WCSCOLL
+SIGNATURE_CHECK (GNULIB_NAMESPACE::wcscoll, int,
+                 (const wchar_t *, const wchar_t *));
+#endif
+
+#if GNULIB_TEST_WCSXFRM
+SIGNATURE_CHECK (GNULIB_NAMESPACE::wcsxfrm, size_t,
+                 (wchar_t *, const wchar_t *, size_t));
+#endif
+
+#if GNULIB_TEST_WCSDUP
+SIGNATURE_CHECK (GNULIB_NAMESPACE::wcsdup, wchar_t *, (const wchar_t *));
+#endif
+
+#if GNULIB_TEST_WCSCHR
+SIGNATURE_CHECK (GNULIB_NAMESPACE::wcschr, wchar_t *,
+                 (const wchar_t *, wchar_t));
+#endif
+
+#if GNULIB_TEST_WCSRCHR
+SIGNATURE_CHECK (GNULIB_NAMESPACE::wcsrchr, wchar_t *,
+                 (const wchar_t *, wchar_t));
+#endif
+
+#if GNULIB_TEST_WCSCSPN
+SIGNATURE_CHECK (GNULIB_NAMESPACE::wcscspn, size_t,
+                 (const wchar_t *, const wchar_t *));
+#endif
+
+#if GNULIB_TEST_WCSSPN
+SIGNATURE_CHECK (GNULIB_NAMESPACE::wcsspn, size_t,
+                 (const wchar_t *, const wchar_t *));
+#endif
+
+#if GNULIB_TEST_WCSPBRK
+SIGNATURE_CHECK (GNULIB_NAMESPACE::wcspbrk, wchar_t *,
+                 (const wchar_t *, const wchar_t *));
+#endif
+
+#if GNULIB_TEST_WCSSTR
+SIGNATURE_CHECK (GNULIB_NAMESPACE::wcsstr, wchar_t *,
+                 (const wchar_t *, const wchar_t *));
+#endif
+
+#if GNULIB_TEST_WCSTOK
+SIGNATURE_CHECK (GNULIB_NAMESPACE::wcstok, wchar_t *,
+                 (wchar_t *, const wchar_t *, wchar_t **));
+#endif
+
+#if GNULIB_TEST_WCSWIDTH
+SIGNATURE_CHECK (GNULIB_NAMESPACE::wcswidth, int, (const wchar_t *, size_t));
+#endif
+
 
 int
 main ()
diff --git a/tests/test-wctype-c++.cc b/tests/test-wctype-c++.cc
deleted file mode 100644 (file)
index 63c7799..0000000
+++ /dev/null
@@ -1,47 +0,0 @@
-/* Test of <wctype.h> substitute in C++ mode.
-   Copyright (C) 2010-2011 Free Software Foundation, Inc.
-
-   This program is free software: you can redistribute it and/or modify
-   it under the terms of the GNU General Public License as published by
-   the Free Software Foundation; either version 3 of the License, or
-   (at your option) any later version.
-
-   This program is distributed in the hope that it will be useful,
-   but WITHOUT ANY WARRANTY; without even the implied warranty of
-   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-   GNU General Public License for more details.
-
-   You should have received a copy of the GNU General Public License
-   along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
-
-/* Written by Bruno Haible <bruno@clisp.org>, 2010.  */
-
-#define GNULIB_NAMESPACE gnulib
-#include <config.h>
-
-#include <wctype.h>
-
-#include "signature.h"
-
-
-SIGNATURE_CHECK (GNULIB_NAMESPACE::iswalnum, int, (wint_t));
-SIGNATURE_CHECK (GNULIB_NAMESPACE::iswalpha, int, (wint_t));
-SIGNATURE_CHECK (GNULIB_NAMESPACE::iswblank, int, (wint_t));
-SIGNATURE_CHECK (GNULIB_NAMESPACE::iswcntrl, int, (wint_t));
-SIGNATURE_CHECK (GNULIB_NAMESPACE::iswdigit, int, (wint_t));
-SIGNATURE_CHECK (GNULIB_NAMESPACE::iswgraph, int, (wint_t));
-SIGNATURE_CHECK (GNULIB_NAMESPACE::iswlower, int, (wint_t));
-SIGNATURE_CHECK (GNULIB_NAMESPACE::iswprint, int, (wint_t));
-SIGNATURE_CHECK (GNULIB_NAMESPACE::iswpunct, int, (wint_t));
-SIGNATURE_CHECK (GNULIB_NAMESPACE::iswspace, int, (wint_t));
-SIGNATURE_CHECK (GNULIB_NAMESPACE::iswupper, int, (wint_t));
-SIGNATURE_CHECK (GNULIB_NAMESPACE::iswxdigit, int, (wint_t));
-
-SIGNATURE_CHECK (GNULIB_NAMESPACE::towlower, wint_t, (wint_t));
-SIGNATURE_CHECK (GNULIB_NAMESPACE::towupper, wint_t, (wint_t));
-
-
-int
-main ()
-{
-}
diff --git a/tests/test-wctype-h-c++.cc b/tests/test-wctype-h-c++.cc
new file mode 100644 (file)
index 0000000..7208382
--- /dev/null
@@ -0,0 +1,65 @@
+/* Test of <wctype.h> substitute in C++ mode.
+   Copyright (C) 2010-2011 Free Software Foundation, Inc.
+
+   This program is free software: you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation; either version 3 of the License, or
+   (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
+
+/* Written by Bruno Haible <bruno@clisp.org>, 2010.  */
+
+#define GNULIB_NAMESPACE gnulib
+#include <config.h>
+
+#include <wctype.h>
+
+#include "signature.h"
+
+
+SIGNATURE_CHECK (GNULIB_NAMESPACE::iswalnum, int, (wint_t));
+SIGNATURE_CHECK (GNULIB_NAMESPACE::iswalpha, int, (wint_t));
+#if GNULIB_TEST_ISWBLANK
+SIGNATURE_CHECK (GNULIB_NAMESPACE::iswblank, int, (wint_t));
+#endif
+SIGNATURE_CHECK (GNULIB_NAMESPACE::iswcntrl, int, (wint_t));
+SIGNATURE_CHECK (GNULIB_NAMESPACE::iswdigit, int, (wint_t));
+SIGNATURE_CHECK (GNULIB_NAMESPACE::iswgraph, int, (wint_t));
+SIGNATURE_CHECK (GNULIB_NAMESPACE::iswlower, int, (wint_t));
+SIGNATURE_CHECK (GNULIB_NAMESPACE::iswprint, int, (wint_t));
+SIGNATURE_CHECK (GNULIB_NAMESPACE::iswpunct, int, (wint_t));
+SIGNATURE_CHECK (GNULIB_NAMESPACE::iswspace, int, (wint_t));
+SIGNATURE_CHECK (GNULIB_NAMESPACE::iswupper, int, (wint_t));
+SIGNATURE_CHECK (GNULIB_NAMESPACE::iswxdigit, int, (wint_t));
+
+#if GNULIB_TEST_WCTYPE
+SIGNATURE_CHECK (GNULIB_NAMESPACE::wctype, wctype_t, (const char *));
+#endif
+
+#if GNULIB_TEST_ISWCTYPE
+SIGNATURE_CHECK (GNULIB_NAMESPACE::iswctype, int, (wint_t, wctype_t));
+#endif
+
+SIGNATURE_CHECK (GNULIB_NAMESPACE::towlower, wint_t, (wint_t));
+SIGNATURE_CHECK (GNULIB_NAMESPACE::towupper, wint_t, (wint_t));
+
+#if GNULIB_TEST_WCTRANS
+SIGNATURE_CHECK (GNULIB_NAMESPACE::wctrans, wctrans_t, (const char *));
+#endif
+
+#if GNULIB_TEST_TOWCTRANS
+SIGNATURE_CHECK (GNULIB_NAMESPACE::towctrans, wint_t, (wint_t, wctrans_t));
+#endif
+
+
+int
+main ()
+{
+}
diff --git a/tests/test-wctype-h.c b/tests/test-wctype-h.c
new file mode 100644 (file)
index 0000000..aed3b77
--- /dev/null
@@ -0,0 +1,74 @@
+/* Test of <wctype.h> substitute.
+   Copyright (C) 2007-2011 Free Software Foundation, Inc.
+
+   This program is free software: you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation; either version 3 of the License, or
+   (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
+
+/* Written by Bruno Haible <bruno@clisp.org>, 2007.  */
+
+#include <config.h>
+
+#include <wctype.h>
+
+#include "macros.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;
+
+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));
+
+  /* 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;
+}
diff --git a/tests/test-wctype.c b/tests/test-wctype.c
deleted file mode 100644 (file)
index b4da264..0000000
+++ /dev/null
@@ -1,70 +0,0 @@
-/* Test of <wctype.h> substitute.
-   Copyright (C) 2007-2011 Free Software Foundation, Inc.
-
-   This program is free software: you can redistribute it and/or modify
-   it under the terms of the GNU General Public License as published by
-   the Free Software Foundation; either version 3 of the License, or
-   (at your option) any later version.
-
-   This program is distributed in the hope that it will be useful,
-   but WITHOUT ANY WARRANTY; without even the implied warranty of
-   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-   GNU General Public License for more details.
-
-   You should have received a copy of the GNU General Public License
-   along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
-
-/* Written by Bruno Haible <bruno@clisp.org>, 2007.  */
-
-#include <config.h>
-
-#include <wctype.h>
-
-#include "macros.h"
-
-/* Check that the type wint_t is defined.  */
-wint_t a = 'x';
-/* Check that WEOF is defined.  */
-wint_t e = WEOF;
-
-int
-main (void)
-{
-  /* Check that the isw* functions exist as functions or as macros.  */
-  (void) iswalnum (0);
-  (void) iswalpha (0);
-  (void) iswblank (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 (!iswblank (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));
-
-  /* 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;
-}