cvs-cvs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Cvs-cvs] ccvs/lib .cvsignore ChangeLog Makefile.am Makef...


From: Derek Robert Price
Subject: [Cvs-cvs] ccvs/lib .cvsignore ChangeLog Makefile.am Makef...
Date: Wed, 22 Aug 2007 12:48:50 +0000

CVSROOT:        /cvsroot/cvs
Module name:    ccvs
Changes by:     Derek Robert Price <dprice>     07/08/22 12:48:49

Modified files:
        lib            : .cvsignore ChangeLog Makefile.am 
                         Makefile.gnulib Makefile.in __fpending.h 
                         alloca_.h asprintf.c at-func.c base64.c 
                         canon-host.c canonicalize.c canonicalize.h 
                         chdir-long.c chown.c closeout.c closeout.h 
                         dirname.h dup-safer.c dup2.c error.c exitfail.c 
                         fcntl_.h filenamecat.c filenamecat.h fnmatch.c 
                         fnmatch_.h fnmatch_loop.c ftruncate.c 
                         gai_strerror.c getaddrinfo.c getcwd.c getdate.c 
                         getdate.h getdate.y getdelim.c getline.c 
                         getlogin_r.c getndelim2.c getopt_.h 
                         getpagesize.h getpass.c gettext.h gettime.c 
                         gettimeofday.c glob-libc.h glob.c glob_.h 
                         inttypes_.h lchown.c lstat.c mbchar.c mbchar.h 
                         mbuiter.h mempcpy.c memrchr.c mkstemp.c 
                         mktime.c nanosleep.c openat-priv.h openat.c 
                         openat.h printf-args.c printf-args.h 
                         printf-parse.c printf-parse.h quotearg.c 
                         quotearg.h readlink.c regcomp.c regex.h 
                         regex_internal.c regex_internal.h regexec.c 
                         setenv.c setenv.h snprintf.c stat-macros.h 
                         stdbool_.h stdint_.h strcasecmp.c strdup.c 
                         strerror.c strftime.c strncasecmp.c strndup.c 
                         strnlen.c strnlen1.c strtoimax.c strtol.c 
                         tempname.c time_r.c timespec.h vasnprintf.c 
                         vasnprintf.h vasprintf.c xalloc.h xgetcwd.c 
                         xmalloc.c xreadlink.c xreadlink.h xstrndup.c 
                         yesno.c 
Added files:
        lib            : canonicalize-lgpl.c config.charset dirent_.h 
                         dirfd.c dirfd.h fchdir.c fchownat.c float+.h 
                         float_.h fstatat.c localcharset.c 
                         localcharset.h malloca.c malloca.h 
                         malloca.valgrind mbslen.c mbsstr.c 
                         mreadlink-with-size.c mreadlink.h netinet_in_.h 
                         openat-proc.c ref-add.sin ref-del.sin stdio_.h 
                         stdlib_.h streq.h string_.h sys_socket_.h 
                         sys_stat_.h sys_time_.h tempname.h time_.h 
                         unistd_.h unitypes.h uniwidth.h wchar_.h 
                         wctype_.h wcwidth.c 
        lib/uniwidth   : .cvsignore cjk.h width.c 
Removed files:
        lib            : allocsa.c allocsa.h allocsa.valgrind exit.h 
                         getcwd.h getlogin_r.h lchown.h mempcpy.h 
                         memrchr.h mkstemp.h snprintf.h socket_.h 
                         stat_.h strcase.h strdup.h strndup.h strnlen.h 
                         strstr.c strstr.h time_r.h vasprintf.h 
                         wcwidth.h 

Log message:
        * .cvsignore: Add new generated files.
        * Makefile.am: Import automated changes from...
        * Makefile.gnulib: ...here.
        * __fpending.h, alloca_.h, asprintf.c, at-func.c, base64.c,
        canon-host.c, canonicalize.c, canonicalize.h, chdir-long.c, chown.c,
        closeout.c, closeout.h, dirname.h, dup-safer.c, dup2.c, error.c,
        exitfail.c, fcntl_.h, filenamecat.c, filenamecat.h, fnmatch.c,
        fnmatch_.h, fnmatch_loop.c, ftruncate.c, gai_strerror.c,
        getaddrinfo.c, getcwd.c, getdate.c, getdate.h, getdate.y, getdelim.c,
        getline.c, getlogin_r.c, getndelim2.c, getopt_.h, getpagesize.h,
        getpass.c, gettext.h, gettime.c, gettimeofday.c, glob-libc.h, glob.c,
        glob_.h, inttypes_.h, lchown.c, lstat.c, mbchar.c, mbchar.h,
        mempcpy.c, memrchr.c, mkstemp.c, mbuiter.h, mktime.c, nanosleep.c,
        openat-priv.h, openat.c, openat.h, printf-args.c, printf-args.h,
        printf-parse.c, printf-parse.h, quotearg.c, quotearg.h, readlink.c,
        regcomp.c, regex.h, regex_internal.c, regex_internal.h, regexec.c,
        setenv.c, setenv.h, snprintf.c, stat-macros.h, stdbool_.h, stdint_.h,
        strcasecmp.c, strdup.c, strerror.c, strftime.c, strncasecmp.c,
        strndup.c, strnlen.c, strnlen1.c, strtoimax.c, strtol.c, tempname.c,
        time_r.c, timespec.h, vasnprintf.c, vasnprintf.h, vasprintf.c,
        xalloc.h, xgetcwd.c, xmalloc.c, xreadlink.c, xreadlink.h, xstrndup.c,
        yesno.c: Update from GNULIB.
        * allocsa.c, allocsa.h, allocsa.valgrind: Update from GNULIB renamed
        these to...
        * malloca.c, malloca.h, malloca.valgrind: ...here.
        * strstr.c: GNULIB update renamed to...
        * mbsstr.c: ...this.
        * exit.h, mkstemp.h: GNULIB update removed in favor of...
        * stdlib_.h: ...including (generated) <stdlib.h> instead.
        * getcwd.h, getlogin_r.h, lchown.h: GNULIB update removed in favor
        of...
        * unistd_.h: ...including (generated) <unistd.h> instead.
        * mempcpy.h, memrchr.h, strcase.h, strdup.h, strndup.h, strnlen.h,
        strstr.h: GNULIB update removed in favor of...
        * string_.h: ...including (generated) <string.h> instead.
        * snprintf.h, vasprintf.h: GNULIB update removed in favor of...
        * stdio_.h: ...including (generated) <stdio.h> instead.
        * socket_.h, stat_.h: Renamed by GNULIB update to...
        * time_r.h:: GNULIB update removed in favor of...
        * time_.h: ...including (generated) <time.h> instead.
        * wcwidth.h: GNULIB update removed in favor of...
        * wchar_.h: ...including (generated) <wchar.h> instead.
        * sys_socket_.h, sys_stat_.h, canonicalize-lgpl.c, config.charset,
        dirent_.h, dirfd.c, dirfd.h, fchdir.c, fchownat.c, float+.h, float_.h,
        fstatat.c, localcharset.c, localcharset.h, mbslen.c,
        mreadlink-with-size.c, mreadlink.h, netinet_in_.h, openat-proc.c,
        ref-add.sin, ref-del.sin, streq.h, sys_time_.h, tempname.h,
        unitypes.h, uniwidth.h, wctype_.h, wcwidth.c, uniwidth/.cvsignore,
        uniwidth/cjk.h, uniwidth/width.c: New files from GNULIB.

CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/ccvs/lib/.cvsignore?cvsroot=cvs&r1=1.15&r2=1.16
http://cvs.savannah.gnu.org/viewcvs/ccvs/lib/ChangeLog?cvsroot=cvs&r1=1.549&r2=1.550
http://cvs.savannah.gnu.org/viewcvs/ccvs/lib/Makefile.am?cvsroot=cvs&r1=1.123&r2=1.124
http://cvs.savannah.gnu.org/viewcvs/ccvs/lib/Makefile.gnulib?cvsroot=cvs&r1=1.86&r2=1.87
http://cvs.savannah.gnu.org/viewcvs/ccvs/lib/Makefile.in?cvsroot=cvs&r1=1.226&r2=1.227
http://cvs.savannah.gnu.org/viewcvs/ccvs/lib/__fpending.h?cvsroot=cvs&r1=1.3&r2=1.4
http://cvs.savannah.gnu.org/viewcvs/ccvs/lib/alloca_.h?cvsroot=cvs&r1=1.6&r2=1.7
http://cvs.savannah.gnu.org/viewcvs/ccvs/lib/asprintf.c?cvsroot=cvs&r1=1.3&r2=1.4
http://cvs.savannah.gnu.org/viewcvs/ccvs/lib/at-func.c?cvsroot=cvs&r1=1.1&r2=1.2
http://cvs.savannah.gnu.org/viewcvs/ccvs/lib/base64.c?cvsroot=cvs&r1=1.5&r2=1.6
http://cvs.savannah.gnu.org/viewcvs/ccvs/lib/canon-host.c?cvsroot=cvs&r1=1.5&r2=1.6
http://cvs.savannah.gnu.org/viewcvs/ccvs/lib/canonicalize.c?cvsroot=cvs&r1=1.4&r2=1.5
http://cvs.savannah.gnu.org/viewcvs/ccvs/lib/canonicalize.h?cvsroot=cvs&r1=1.2&r2=1.3
http://cvs.savannah.gnu.org/viewcvs/ccvs/lib/chdir-long.c?cvsroot=cvs&r1=1.7&r2=1.8
http://cvs.savannah.gnu.org/viewcvs/ccvs/lib/chown.c?cvsroot=cvs&r1=1.2&r2=1.3
http://cvs.savannah.gnu.org/viewcvs/ccvs/lib/closeout.c?cvsroot=cvs&r1=1.6&r2=1.7
http://cvs.savannah.gnu.org/viewcvs/ccvs/lib/closeout.h?cvsroot=cvs&r1=1.2&r2=1.3
http://cvs.savannah.gnu.org/viewcvs/ccvs/lib/dirname.h?cvsroot=cvs&r1=1.5&r2=1.6
http://cvs.savannah.gnu.org/viewcvs/ccvs/lib/dup-safer.c?cvsroot=cvs&r1=1.6&r2=1.7
http://cvs.savannah.gnu.org/viewcvs/ccvs/lib/dup2.c?cvsroot=cvs&r1=1.7&r2=1.8
http://cvs.savannah.gnu.org/viewcvs/ccvs/lib/error.c?cvsroot=cvs&r1=1.11&r2=1.12
http://cvs.savannah.gnu.org/viewcvs/ccvs/lib/exitfail.c?cvsroot=cvs&r1=1.5&r2=1.6
http://cvs.savannah.gnu.org/viewcvs/ccvs/lib/fcntl_.h?cvsroot=cvs&r1=1.1&r2=1.2
http://cvs.savannah.gnu.org/viewcvs/ccvs/lib/filenamecat.c?cvsroot=cvs&r1=1.4&r2=1.5
http://cvs.savannah.gnu.org/viewcvs/ccvs/lib/filenamecat.h?cvsroot=cvs&r1=1.1&r2=1.2
http://cvs.savannah.gnu.org/viewcvs/ccvs/lib/fnmatch.c?cvsroot=cvs&r1=1.17&r2=1.18
http://cvs.savannah.gnu.org/viewcvs/ccvs/lib/fnmatch_.h?cvsroot=cvs&r1=1.3&r2=1.4
http://cvs.savannah.gnu.org/viewcvs/ccvs/lib/fnmatch_loop.c?cvsroot=cvs&r1=1.7&r2=1.8
http://cvs.savannah.gnu.org/viewcvs/ccvs/lib/ftruncate.c?cvsroot=cvs&r1=1.5&r2=1.6
http://cvs.savannah.gnu.org/viewcvs/ccvs/lib/gai_strerror.c?cvsroot=cvs&r1=1.4&r2=1.5
http://cvs.savannah.gnu.org/viewcvs/ccvs/lib/getaddrinfo.c?cvsroot=cvs&r1=1.15&r2=1.16
http://cvs.savannah.gnu.org/viewcvs/ccvs/lib/getcwd.c?cvsroot=cvs&r1=1.12&r2=1.13
http://cvs.savannah.gnu.org/viewcvs/ccvs/lib/getdate.c?cvsroot=cvs&r1=1.48&r2=1.49
http://cvs.savannah.gnu.org/viewcvs/ccvs/lib/getdate.h?cvsroot=cvs&r1=1.3&r2=1.4
http://cvs.savannah.gnu.org/viewcvs/ccvs/lib/getdate.y?cvsroot=cvs&r1=1.39&r2=1.40
http://cvs.savannah.gnu.org/viewcvs/ccvs/lib/getdelim.c?cvsroot=cvs&r1=1.7&r2=1.8
http://cvs.savannah.gnu.org/viewcvs/ccvs/lib/getline.c?cvsroot=cvs&r1=1.19&r2=1.20
http://cvs.savannah.gnu.org/viewcvs/ccvs/lib/getlogin_r.c?cvsroot=cvs&r1=1.6&r2=1.7
http://cvs.savannah.gnu.org/viewcvs/ccvs/lib/getndelim2.c?cvsroot=cvs&r1=1.11&r2=1.12
http://cvs.savannah.gnu.org/viewcvs/ccvs/lib/getopt_.h?cvsroot=cvs&r1=1.5&r2=1.6
http://cvs.savannah.gnu.org/viewcvs/ccvs/lib/getpagesize.h?cvsroot=cvs&r1=1.7&r2=1.8
http://cvs.savannah.gnu.org/viewcvs/ccvs/lib/getpass.c?cvsroot=cvs&r1=1.13&r2=1.14
http://cvs.savannah.gnu.org/viewcvs/ccvs/lib/gettext.h?cvsroot=cvs&r1=1.6&r2=1.7
http://cvs.savannah.gnu.org/viewcvs/ccvs/lib/gettime.c?cvsroot=cvs&r1=1.6&r2=1.7
http://cvs.savannah.gnu.org/viewcvs/ccvs/lib/gettimeofday.c?cvsroot=cvs&r1=1.4&r2=1.5
http://cvs.savannah.gnu.org/viewcvs/ccvs/lib/glob-libc.h?cvsroot=cvs&r1=1.2&r2=1.3
http://cvs.savannah.gnu.org/viewcvs/ccvs/lib/glob.c?cvsroot=cvs&r1=1.23&r2=1.24
http://cvs.savannah.gnu.org/viewcvs/ccvs/lib/glob_.h?cvsroot=cvs&r1=1.18&r2=1.19
http://cvs.savannah.gnu.org/viewcvs/ccvs/lib/inttypes_.h?cvsroot=cvs&r1=1.1&r2=1.2
http://cvs.savannah.gnu.org/viewcvs/ccvs/lib/lchown.c?cvsroot=cvs&r1=1.2&r2=1.3
http://cvs.savannah.gnu.org/viewcvs/ccvs/lib/lstat.c?cvsroot=cvs&r1=1.7&r2=1.8
http://cvs.savannah.gnu.org/viewcvs/ccvs/lib/mbchar.c?cvsroot=cvs&r1=1.2&r2=1.3
http://cvs.savannah.gnu.org/viewcvs/ccvs/lib/mbchar.h?cvsroot=cvs&r1=1.4&r2=1.5
http://cvs.savannah.gnu.org/viewcvs/ccvs/lib/mbuiter.h?cvsroot=cvs&r1=1.3&r2=1.4
http://cvs.savannah.gnu.org/viewcvs/ccvs/lib/mempcpy.c?cvsroot=cvs&r1=1.2&r2=1.3
http://cvs.savannah.gnu.org/viewcvs/ccvs/lib/memrchr.c?cvsroot=cvs&r1=1.3&r2=1.4
http://cvs.savannah.gnu.org/viewcvs/ccvs/lib/mkstemp.c?cvsroot=cvs&r1=1.6&r2=1.7
http://cvs.savannah.gnu.org/viewcvs/ccvs/lib/mktime.c?cvsroot=cvs&r1=1.13&r2=1.14
http://cvs.savannah.gnu.org/viewcvs/ccvs/lib/nanosleep.c?cvsroot=cvs&r1=1.10&r2=1.11
http://cvs.savannah.gnu.org/viewcvs/ccvs/lib/openat-priv.h?cvsroot=cvs&r1=1.2&r2=1.3
http://cvs.savannah.gnu.org/viewcvs/ccvs/lib/openat.c?cvsroot=cvs&r1=1.9&r2=1.10
http://cvs.savannah.gnu.org/viewcvs/ccvs/lib/openat.h?cvsroot=cvs&r1=1.8&r2=1.9
http://cvs.savannah.gnu.org/viewcvs/ccvs/lib/printf-args.c?cvsroot=cvs&r1=1.5&r2=1.6
http://cvs.savannah.gnu.org/viewcvs/ccvs/lib/printf-args.h?cvsroot=cvs&r1=1.2&r2=1.3
http://cvs.savannah.gnu.org/viewcvs/ccvs/lib/printf-parse.c?cvsroot=cvs&r1=1.3&r2=1.4
http://cvs.savannah.gnu.org/viewcvs/ccvs/lib/printf-parse.h?cvsroot=cvs&r1=1.2&r2=1.3
http://cvs.savannah.gnu.org/viewcvs/ccvs/lib/quotearg.c?cvsroot=cvs&r1=1.7&r2=1.8
http://cvs.savannah.gnu.org/viewcvs/ccvs/lib/quotearg.h?cvsroot=cvs&r1=1.2&r2=1.3
http://cvs.savannah.gnu.org/viewcvs/ccvs/lib/readlink.c?cvsroot=cvs&r1=1.6&r2=1.7
http://cvs.savannah.gnu.org/viewcvs/ccvs/lib/regcomp.c?cvsroot=cvs&r1=1.9&r2=1.10
http://cvs.savannah.gnu.org/viewcvs/ccvs/lib/regex.h?cvsroot=cvs&r1=1.14&r2=1.15
http://cvs.savannah.gnu.org/viewcvs/ccvs/lib/regex_internal.c?cvsroot=cvs&r1=1.10&r2=1.11
http://cvs.savannah.gnu.org/viewcvs/ccvs/lib/regex_internal.h?cvsroot=cvs&r1=1.14&r2=1.15
http://cvs.savannah.gnu.org/viewcvs/ccvs/lib/regexec.c?cvsroot=cvs&r1=1.9&r2=1.10
http://cvs.savannah.gnu.org/viewcvs/ccvs/lib/setenv.c?cvsroot=cvs&r1=1.7&r2=1.8
http://cvs.savannah.gnu.org/viewcvs/ccvs/lib/setenv.h?cvsroot=cvs&r1=1.3&r2=1.4
http://cvs.savannah.gnu.org/viewcvs/ccvs/lib/snprintf.c?cvsroot=cvs&r1=1.3&r2=1.4
http://cvs.savannah.gnu.org/viewcvs/ccvs/lib/stat-macros.h?cvsroot=cvs&r1=1.3&r2=1.4
http://cvs.savannah.gnu.org/viewcvs/ccvs/lib/stdbool_.h?cvsroot=cvs&r1=1.4&r2=1.5
http://cvs.savannah.gnu.org/viewcvs/ccvs/lib/stdint_.h?cvsroot=cvs&r1=1.23&r2=1.24
http://cvs.savannah.gnu.org/viewcvs/ccvs/lib/strcasecmp.c?cvsroot=cvs&r1=1.5&r2=1.6
http://cvs.savannah.gnu.org/viewcvs/ccvs/lib/strdup.c?cvsroot=cvs&r1=1.6&r2=1.7
http://cvs.savannah.gnu.org/viewcvs/ccvs/lib/strerror.c?cvsroot=cvs&r1=1.8&r2=1.9
http://cvs.savannah.gnu.org/viewcvs/ccvs/lib/strftime.c?cvsroot=cvs&r1=1.14&r2=1.15
http://cvs.savannah.gnu.org/viewcvs/ccvs/lib/strncasecmp.c?cvsroot=cvs&r1=1.5&r2=1.6
http://cvs.savannah.gnu.org/viewcvs/ccvs/lib/strndup.c?cvsroot=cvs&r1=1.2&r2=1.3
http://cvs.savannah.gnu.org/viewcvs/ccvs/lib/strnlen.c?cvsroot=cvs&r1=1.2&r2=1.3
http://cvs.savannah.gnu.org/viewcvs/ccvs/lib/strnlen1.c?cvsroot=cvs&r1=1.4&r2=1.5
http://cvs.savannah.gnu.org/viewcvs/ccvs/lib/strtoimax.c?cvsroot=cvs&r1=1.6&r2=1.7
http://cvs.savannah.gnu.org/viewcvs/ccvs/lib/strtol.c?cvsroot=cvs&r1=1.9&r2=1.10
http://cvs.savannah.gnu.org/viewcvs/ccvs/lib/tempname.c?cvsroot=cvs&r1=1.11&r2=1.12
http://cvs.savannah.gnu.org/viewcvs/ccvs/lib/time_r.c?cvsroot=cvs&r1=1.6&r2=1.7
http://cvs.savannah.gnu.org/viewcvs/ccvs/lib/timespec.h?cvsroot=cvs&r1=1.5&r2=1.6
http://cvs.savannah.gnu.org/viewcvs/ccvs/lib/vasnprintf.c?cvsroot=cvs&r1=1.7&r2=1.8
http://cvs.savannah.gnu.org/viewcvs/ccvs/lib/vasnprintf.h?cvsroot=cvs&r1=1.3&r2=1.4
http://cvs.savannah.gnu.org/viewcvs/ccvs/lib/vasprintf.c?cvsroot=cvs&r1=1.15&r2=1.16
http://cvs.savannah.gnu.org/viewcvs/ccvs/lib/xalloc.h?cvsroot=cvs&r1=1.3&r2=1.4
http://cvs.savannah.gnu.org/viewcvs/ccvs/lib/xgetcwd.c?cvsroot=cvs&r1=1.6&r2=1.7
http://cvs.savannah.gnu.org/viewcvs/ccvs/lib/xmalloc.c?cvsroot=cvs&r1=1.6&r2=1.7
http://cvs.savannah.gnu.org/viewcvs/ccvs/lib/xreadlink.c?cvsroot=cvs&r1=1.6&r2=1.7
http://cvs.savannah.gnu.org/viewcvs/ccvs/lib/xreadlink.h?cvsroot=cvs&r1=1.2&r2=1.3
http://cvs.savannah.gnu.org/viewcvs/ccvs/lib/xstrndup.c?cvsroot=cvs&r1=1.1&r2=1.2
http://cvs.savannah.gnu.org/viewcvs/ccvs/lib/yesno.c?cvsroot=cvs&r1=1.9&r2=1.10
http://cvs.savannah.gnu.org/viewcvs/ccvs/lib/canonicalize-lgpl.c?cvsroot=cvs&rev=1.1
http://cvs.savannah.gnu.org/viewcvs/ccvs/lib/config.charset?cvsroot=cvs&rev=1.1
http://cvs.savannah.gnu.org/viewcvs/ccvs/lib/dirent_.h?cvsroot=cvs&rev=1.1
http://cvs.savannah.gnu.org/viewcvs/ccvs/lib/dirfd.c?cvsroot=cvs&rev=1.1
http://cvs.savannah.gnu.org/viewcvs/ccvs/lib/dirfd.h?cvsroot=cvs&rev=1.1
http://cvs.savannah.gnu.org/viewcvs/ccvs/lib/fchdir.c?cvsroot=cvs&rev=1.1
http://cvs.savannah.gnu.org/viewcvs/ccvs/lib/fchownat.c?cvsroot=cvs&rev=1.1
http://cvs.savannah.gnu.org/viewcvs/ccvs/lib/float%43.h?cvsroot=cvs&rev=1.1
http://cvs.savannah.gnu.org/viewcvs/ccvs/lib/float_.h?cvsroot=cvs&rev=1.1
http://cvs.savannah.gnu.org/viewcvs/ccvs/lib/fstatat.c?cvsroot=cvs&rev=1.1
http://cvs.savannah.gnu.org/viewcvs/ccvs/lib/localcharset.c?cvsroot=cvs&rev=1.1
http://cvs.savannah.gnu.org/viewcvs/ccvs/lib/localcharset.h?cvsroot=cvs&rev=1.1
http://cvs.savannah.gnu.org/viewcvs/ccvs/lib/malloca.c?cvsroot=cvs&rev=1.1
http://cvs.savannah.gnu.org/viewcvs/ccvs/lib/malloca.h?cvsroot=cvs&rev=1.1
http://cvs.savannah.gnu.org/viewcvs/ccvs/lib/malloca.valgrind?cvsroot=cvs&rev=1.1
http://cvs.savannah.gnu.org/viewcvs/ccvs/lib/mbslen.c?cvsroot=cvs&rev=1.1
http://cvs.savannah.gnu.org/viewcvs/ccvs/lib/mbsstr.c?cvsroot=cvs&rev=1.1
http://cvs.savannah.gnu.org/viewcvs/ccvs/lib/mreadlink-with-size.c?cvsroot=cvs&rev=1.1
http://cvs.savannah.gnu.org/viewcvs/ccvs/lib/mreadlink.h?cvsroot=cvs&rev=1.1
http://cvs.savannah.gnu.org/viewcvs/ccvs/lib/netinet_in_.h?cvsroot=cvs&rev=1.1
http://cvs.savannah.gnu.org/viewcvs/ccvs/lib/openat-proc.c?cvsroot=cvs&rev=1.1
http://cvs.savannah.gnu.org/viewcvs/ccvs/lib/ref-add.sin?cvsroot=cvs&rev=1.1
http://cvs.savannah.gnu.org/viewcvs/ccvs/lib/ref-del.sin?cvsroot=cvs&rev=1.1
http://cvs.savannah.gnu.org/viewcvs/ccvs/lib/stdio_.h?cvsroot=cvs&rev=1.1
http://cvs.savannah.gnu.org/viewcvs/ccvs/lib/stdlib_.h?cvsroot=cvs&rev=1.1
http://cvs.savannah.gnu.org/viewcvs/ccvs/lib/streq.h?cvsroot=cvs&rev=1.1
http://cvs.savannah.gnu.org/viewcvs/ccvs/lib/string_.h?cvsroot=cvs&rev=1.1
http://cvs.savannah.gnu.org/viewcvs/ccvs/lib/sys_socket_.h?cvsroot=cvs&rev=1.1
http://cvs.savannah.gnu.org/viewcvs/ccvs/lib/sys_stat_.h?cvsroot=cvs&rev=1.1
http://cvs.savannah.gnu.org/viewcvs/ccvs/lib/sys_time_.h?cvsroot=cvs&rev=1.1
http://cvs.savannah.gnu.org/viewcvs/ccvs/lib/tempname.h?cvsroot=cvs&rev=1.1
http://cvs.savannah.gnu.org/viewcvs/ccvs/lib/time_.h?cvsroot=cvs&rev=1.1
http://cvs.savannah.gnu.org/viewcvs/ccvs/lib/unistd_.h?cvsroot=cvs&rev=1.1
http://cvs.savannah.gnu.org/viewcvs/ccvs/lib/unitypes.h?cvsroot=cvs&rev=1.1
http://cvs.savannah.gnu.org/viewcvs/ccvs/lib/uniwidth.h?cvsroot=cvs&rev=1.1
http://cvs.savannah.gnu.org/viewcvs/ccvs/lib/wchar_.h?cvsroot=cvs&rev=1.1
http://cvs.savannah.gnu.org/viewcvs/ccvs/lib/wctype_.h?cvsroot=cvs&rev=1.1
http://cvs.savannah.gnu.org/viewcvs/ccvs/lib/wcwidth.c?cvsroot=cvs&rev=1.1
http://cvs.savannah.gnu.org/viewcvs/ccvs/lib/allocsa.c?cvsroot=cvs&r1=1.3&r2=0
http://cvs.savannah.gnu.org/viewcvs/ccvs/lib/allocsa.h?cvsroot=cvs&r1=1.5&r2=0
http://cvs.savannah.gnu.org/viewcvs/ccvs/lib/allocsa.valgrind?cvsroot=cvs&r1=1.1&r2=0
http://cvs.savannah.gnu.org/viewcvs/ccvs/lib/exit.h?cvsroot=cvs&r1=1.3&r2=0
http://cvs.savannah.gnu.org/viewcvs/ccvs/lib/getcwd.h?cvsroot=cvs&r1=1.4&r2=0
http://cvs.savannah.gnu.org/viewcvs/ccvs/lib/getlogin_r.h?cvsroot=cvs&r1=1.5&r2=0
http://cvs.savannah.gnu.org/viewcvs/ccvs/lib/lchown.h?cvsroot=cvs&r1=1.1&r2=0
http://cvs.savannah.gnu.org/viewcvs/ccvs/lib/mempcpy.h?cvsroot=cvs&r1=1.2&r2=0
http://cvs.savannah.gnu.org/viewcvs/ccvs/lib/memrchr.h?cvsroot=cvs&r1=1.2&r2=0
http://cvs.savannah.gnu.org/viewcvs/ccvs/lib/mkstemp.h?cvsroot=cvs&r1=1.1&r2=0
http://cvs.savannah.gnu.org/viewcvs/ccvs/lib/snprintf.h?cvsroot=cvs&r1=1.1&r2=0
http://cvs.savannah.gnu.org/viewcvs/ccvs/lib/socket_.h?cvsroot=cvs&r1=1.3&r2=0
http://cvs.savannah.gnu.org/viewcvs/ccvs/lib/stat_.h?cvsroot=cvs&r1=1.4&r2=0
http://cvs.savannah.gnu.org/viewcvs/ccvs/lib/strcase.h?cvsroot=cvs&r1=1.3&r2=0
http://cvs.savannah.gnu.org/viewcvs/ccvs/lib/strdup.h?cvsroot=cvs&r1=1.2&r2=0
http://cvs.savannah.gnu.org/viewcvs/ccvs/lib/strndup.h?cvsroot=cvs&r1=1.1&r2=0
http://cvs.savannah.gnu.org/viewcvs/ccvs/lib/strnlen.h?cvsroot=cvs&r1=1.1&r2=0
http://cvs.savannah.gnu.org/viewcvs/ccvs/lib/strstr.c?cvsroot=cvs&r1=1.6&r2=0
http://cvs.savannah.gnu.org/viewcvs/ccvs/lib/strstr.h?cvsroot=cvs&r1=1.4&r2=0
http://cvs.savannah.gnu.org/viewcvs/ccvs/lib/time_r.h?cvsroot=cvs&r1=1.4&r2=0
http://cvs.savannah.gnu.org/viewcvs/ccvs/lib/vasprintf.h?cvsroot=cvs&r1=1.3&r2=0
http://cvs.savannah.gnu.org/viewcvs/ccvs/lib/wcwidth.h?cvsroot=cvs&r1=1.2&r2=0
http://cvs.savannah.gnu.org/viewcvs/ccvs/lib/uniwidth/.cvsignore?cvsroot=cvs&rev=1.1
http://cvs.savannah.gnu.org/viewcvs/ccvs/lib/uniwidth/cjk.h?cvsroot=cvs&rev=1.1
http://cvs.savannah.gnu.org/viewcvs/ccvs/lib/uniwidth/width.c?cvsroot=cvs&rev=1.1

Patches:
Index: .cvsignore
===================================================================
RCS file: /cvsroot/cvs/ccvs/lib/.cvsignore,v
retrieving revision 1.15
retrieving revision 1.16
diff -u -b -r1.15 -r1.16
--- .cvsignore  6 Sep 2006 15:35:50 -0000       1.15
+++ .cvsignore  22 Aug 2007 12:48:37 -0000      1.16
@@ -13,8 +13,17 @@
 glob.h
 getopt.h
 inttypes.h
-stat.h
 stdbool.h
 stdint.h
+stdio.h
+stdlib.h
+string.h
+sys
+time.h
+unistd.h
 getdate
 getdate.log
+charset.alias
+configmake.h
+ref-add.sed
+ref-del.sed

Index: ChangeLog
===================================================================
RCS file: /cvsroot/cvs/ccvs/lib/ChangeLog,v
retrieving revision 1.549
retrieving revision 1.550
diff -u -b -r1.549 -r1.550
--- ChangeLog   22 Sep 2006 17:54:39 -0000      1.549
+++ ChangeLog   22 Aug 2007 12:48:37 -0000      1.550
@@ -1,3 +1,55 @@
+2007-08-22  Derek Price  <address@hidden>
+
+       * .cvsignore: Add new generated files.
+       * Makefile.am: Import automated changes from...
+       * Makefile.gnulib: ...here.
+       * __fpending.h, alloca_.h, asprintf.c, at-func.c, base64.c,
+       canon-host.c, canonicalize.c, canonicalize.h, chdir-long.c, chown.c,
+       closeout.c, closeout.h, dirname.h, dup-safer.c, dup2.c, error.c,
+       exitfail.c, fcntl_.h, filenamecat.c, filenamecat.h, fnmatch.c,
+       fnmatch_.h, fnmatch_loop.c, ftruncate.c, gai_strerror.c,
+       getaddrinfo.c, getcwd.c, getdate.c, getdate.h, getdate.y, getdelim.c,
+       getline.c, getlogin_r.c, getndelim2.c, getopt_.h, getpagesize.h,
+       getpass.c, gettext.h, gettime.c, gettimeofday.c, glob-libc.h, glob.c,
+       glob_.h, inttypes_.h, lchown.c, lstat.c, mbchar.c, mbchar.h,
+       mempcpy.c, memrchr.c, mkstemp.c, mbuiter.h, mktime.c, nanosleep.c,
+       openat-priv.h, openat.c, openat.h, printf-args.c, printf-args.h,
+       printf-parse.c, printf-parse.h, quotearg.c, quotearg.h, readlink.c,
+       regcomp.c, regex.h, regex_internal.c, regex_internal.h, regexec.c,
+       setenv.c, setenv.h, snprintf.c, stat-macros.h, stdbool_.h, stdint_.h,
+       strcasecmp.c, strdup.c, strerror.c, strftime.c, strncasecmp.c,
+       strndup.c, strnlen.c, strnlen1.c, strtoimax.c, strtol.c, tempname.c,
+       time_r.c, timespec.h, vasnprintf.c, vasnprintf.h, vasprintf.c,
+       xalloc.h, xgetcwd.c, xmalloc.c, xreadlink.c, xreadlink.h, xstrndup.c,
+       yesno.c: Update from GNULIB.
+       * allocsa.c, allocsa.h, allocsa.valgrind: Update from GNULIB renamed
+       these to...
+       * malloca.c, malloca.h, malloca.valgrind: ...here.
+       * strstr.c: GNULIB update renamed to...
+       * mbsstr.c: ...this.
+       * exit.h, mkstemp.h: GNULIB update removed in favor of...
+       * stdlib_.h: ...including (generated) <stdlib.h> instead.
+       * getcwd.h, getlogin_r.h, lchown.h: GNULIB update removed in favor
+       of...
+       * unistd_.h: ...including (generated) <unistd.h> instead.
+       * mempcpy.h, memrchr.h, strcase.h, strdup.h, strndup.h, strnlen.h,
+       strstr.h: GNULIB update removed in favor of...
+       * string_.h: ...including (generated) <string.h> instead.
+       * snprintf.h, vasprintf.h: GNULIB update removed in favor of...
+       * stdio_.h: ...including (generated) <stdio.h> instead.
+       * socket_.h, stat_.h: Renamed by GNULIB update to...
+       * time_r.h:: GNULIB update removed in favor of...
+       * time_.h: ...including (generated) <time.h> instead.
+       * wcwidth.h: GNULIB update removed in favor of...
+       * wchar_.h: ...including (generated) <wchar.h> instead.
+       * sys_socket_.h, sys_stat_.h, canonicalize-lgpl.c, config.charset,
+       dirent_.h, dirfd.c, dirfd.h, fchdir.c, fchownat.c, float+.h, float_.h,
+       fstatat.c, localcharset.c, localcharset.h, mbslen.c,
+       mreadlink-with-size.c, mreadlink.h, netinet_in_.h, openat-proc.c,
+       ref-add.sin, ref-del.sin, streq.h, sys_time_.h, tempname.h,
+       unitypes.h, uniwidth.h, wctype_.h, wcwidth.c, uniwidth/.cvsignore,
+       uniwidth/cjk.h, uniwidth/width.c: New files from GNULIB.
+
 2006-09-22  Mark D. Baushke  <address@hidden>
 
        * pagealign_alloc.c, pagealign_alloc.h: Removed as no longer

Index: Makefile.am
===================================================================
RCS file: /cvsroot/cvs/ccvs/lib/Makefile.am,v
retrieving revision 1.123
retrieving revision 1.124
diff -u -b -r1.123 -r1.124
--- Makefile.am 22 Sep 2006 17:54:39 -0000      1.123
+++ Makefile.am 22 Aug 2007 12:48:37 -0000      1.124
@@ -1,9 +1,10 @@
 ## Process this file with automake to produce Makefile.in.
 # Makefile for library files used by GNU CVS.
 #
-# Copyright (C) 1986-2006 The Free Software Foundation, Inc.
+# Copyright (C) 1986-2007 The Free Software Foundation, Inc.
 #
-# Portions Copyright (C) 1998-2005 Derek Price, Ximbiot <http://ximbiot.com>,
+# Portions Copyright (C) 1998-2007 Derek Price,
+#                                 Ximbiot LLC <http://ximbiot.com>,
 #                                  and others.
 
 # This program is free software; you can redistribute it and/or modify
@@ -16,6 +17,9 @@
 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 # GNU General Public License for more details.
 
+## These Automake options are specified by gnulib-tool's generated Makefile.am
+AUTOMAKE_OPTIONS = 1.5 gnits subdir-objects
+
 noinst_LIBRARIES = libcvs.a
 
 # Should look into unifying regular expression matching in CVS
@@ -31,16 +35,21 @@
 ## these files from configure.in, automake automatically knows about many of
 ## the *.c files in this directory.
 libcvs_a_LIBADD = \
-       @LIBOBJS@
+       @LIBOBJS@ \
+       $(gl_LIBOBJS)
+libcvs_a_DEPENDENCIES = \
+       $(gl_LIBOBJS)
 
 
 
 ## Zero some variables so Automake will allow us to use += on them.
 BUILT_SOURCES =
+CLEANFILES =
 MOSTLYCLEANFILES =
 MOSTLYCLEANDIRS =
 DISTCLEANFILES =
 MAINTAINERCLEANFILES =
+SUFFIXES =
 
 AM_CPPFLAGS =
 
@@ -57,32 +66,46 @@
        libcvs.mak \
        test-getdate.sh
 
+noinst_LIBRARIES += libcvs.a
+
+EXTRA_libcvs_a_SOURCES =
+
+## begin gnulib module absolute-header
+
+# Use this preprocessor expression to decide whether #include_next works.
+# Do not rely on a 'configure'-time test for this, since the expression
+# might appear in an installed header, which is used by some other compiler.
+HAVE_INCLUDE_NEXT = (__GNUC__ || 60000000 <= __DECC_VER)
+
+## end   gnulib module absolute-header
+
 ## begin gnulib module alloca
 
 
+EXTRA_DIST += alloca.c
+
+EXTRA_libcvs_a_SOURCES += alloca.c
+
 libcvs_a_LIBADD += @ALLOCA@
+libcvs_a_DEPENDENCIES += @ALLOCA@
 ## end   gnulib module alloca
 
 ## begin gnulib module alloca-opt
 
 BUILT_SOURCES += $(ALLOCA_H)
-EXTRA_DIST += alloca_.h
 
 # We need the following in order to create <alloca.h> when the system
 # doesn't have one that works with the given compiler.
 alloca.h: alloca_.h
-       cp -f $(srcdir)/alloca_.h address@hidden
+       { echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */'; \
+         cat $(srcdir)/alloca_.h; \
+       } > address@hidden
        mv -f address@hidden $@
 MOSTLYCLEANFILES += alloca.h alloca.h-t
 
-## end   gnulib module alloca-opt
-
-## begin gnulib module allocsa
-
-libcvs_a_SOURCES += allocsa.h allocsa.c
-EXTRA_DIST += allocsa.valgrind
+EXTRA_DIST += alloca_.h
 
-## end   gnulib module allocsa
+## end   gnulib module alloca-opt
 
 ## begin gnulib module arpa_inet
 
@@ -91,15 +114,26 @@
 # We need the following in order to create <arpa/inet.h> when the system
 # doesn't have one.
 arpa/inet.h:
-       test -d arpa || mkdir arpa
+       @MKDIR_P@ arpa
        rm -f address@hidden $@
-       echo '#include <sys/socket.h>' >address@hidden
+       { echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */'; \
+         echo '#include <sys/socket.h>'; \
+       } > address@hidden
        mv address@hidden $@
 MOSTLYCLEANFILES += arpa/inet.h arpa/inet.h-t
 MOSTLYCLEANDIRS += arpa
 
 ## end   gnulib module arpa_inet
 
+## begin gnulib module atexit
+
+
+EXTRA_DIST += atexit.c
+
+EXTRA_libcvs_a_SOURCES += atexit.c
+
+## end   gnulib module atexit
+
 ## begin gnulib module base64
 
 libcvs_a_SOURCES += base64.h base64.c
@@ -108,129 +142,326 @@
 
 ## begin gnulib module canon-host
 
-EXTRA_DIST += canon-host.h
+
+EXTRA_DIST += canon-host.c canon-host.h
+
+EXTRA_libcvs_a_SOURCES += canon-host.c
 
 ## end   gnulib module canon-host
 
 ## begin gnulib module canonicalize
 
-EXTRA_DIST += canonicalize.h
+
+EXTRA_DIST += canonicalize.c canonicalize.h pathmax.h
+
+EXTRA_libcvs_a_SOURCES += canonicalize.c
 
 ## end   gnulib module canonicalize
 
+## begin gnulib module canonicalize-lgpl
+
+
+EXTRA_DIST += canonicalize-lgpl.c canonicalize.h
+
+EXTRA_libcvs_a_SOURCES += canonicalize-lgpl.c
+
+## end   gnulib module canonicalize-lgpl
+
 ## begin gnulib module chdir-long
 
-EXTRA_DIST += chdir-long.h
+
+EXTRA_DIST += chdir-long.c chdir-long.h
+
+EXTRA_libcvs_a_SOURCES += chdir-long.c
 
 ## end   gnulib module chdir-long
 
+## begin gnulib module chown
+
+
+EXTRA_DIST += chown.c fchown-stub.c
+
+EXTRA_libcvs_a_SOURCES += chown.c fchown-stub.c
+
+## end   gnulib module chown
+
 ## begin gnulib module close-stream
 
-EXTRA_DIST += close-stream.h
+
+EXTRA_DIST += close-stream.c close-stream.h
+
+EXTRA_libcvs_a_SOURCES += close-stream.c
 
 ## end   gnulib module close-stream
 
 ## begin gnulib module closeout
 
-EXTRA_DIST += closeout.h
+
+EXTRA_DIST += closeout.c closeout.h
+
+EXTRA_libcvs_a_SOURCES += closeout.c
 
 ## end   gnulib module closeout
 
+## begin gnulib module configmake
+
+# Retrieve values of the variables through 'configure' followed by
+# 'make', not directly through 'configure', so that a user who
+# sets some of these variables consistently on the 'make' command
+# line gets correct results.
+#
+# One advantage of this approach, compared to the classical
+# approach of adding -DLIBDIR=\"$(libdir)\" etc. to AM_CPPFLAGS,
+# is that it protects against the use of undefined variables.
+# If, say, $(libdir) is not set in the Makefile, LIBDIR is not
+# defined by this module, and code using LIBDIR gives a
+# compilation error.
+#
+# Another advantage is that 'make' output is shorter.
+#
+# Listed in the same order as the GNU makefile conventions.
+# The Automake-defined pkg* macros are appended, in the order
+# listed in the Automake 1.10a+ documentation.
+configmake.h: Makefile
+       rm -f address@hidden $@
+       { echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */'; \
+         echo '#define PREFIX "$(prefix)"'; \
+         echo '#define EXEC_PREFIX "$(exec_prefix)"'; \
+         echo '#define BINDIR "$(bindir)"'; \
+         echo '#define SBINDIR "$(sbindir)"'; \
+         echo '#define LIBEXECDIR "$(libexecdir)"'; \
+         echo '#define DATAROOTDIR "$(datarootdir)"'; \
+         echo '#define DATADIR "$(datadir)"'; \
+         echo '#define SYSCONFDIR "$(sysconfdir)"'; \
+         echo '#define SHAREDSTATEDIR "$(sharedstatedir)"'; \
+         echo '#define LOCALSTATEDIR "$(localstatedir)"'; \
+         echo '#define INCLUDEDIR "$(includedir)"'; \
+         echo '#define OLDINCLUDEDIR "$(oldincludedir)"'; \
+         echo '#define DOCDIR "$(docdir)"'; \
+         echo '#define INFODIR "$(infodir)"'; \
+         echo '#define HTMLDIR "$(htmldir)"'; \
+         echo '#define DVIDIR "$(dvidir)"'; \
+         echo '#define PDFDIR "$(pdfdir)"'; \
+         echo '#define PSDIR "$(psdir)"'; \
+         echo '#define LIBDIR "$(libdir)"'; \
+         echo '#define LISPDIR "$(lispdir)"'; \
+         echo '#define LOCALEDIR "$(localedir)"'; \
+         echo '#define MANDIR "$(mandir)"'; \
+         echo '#define MANEXT "$(manext)"'; \
+         echo '#define PKGDATADIR "$(pkgdatadir)"'; \
+         echo '#define PKGINCLUDEDIR "$(pkgincludedir)"'; \
+         echo '#define PKGLIBDIR "$(pkglibdir)"'; \
+         echo '#define PKGLIBEXECDIR "$(pkglibexecdir)"'; \
+       } | sed '/""/d' > address@hidden
+       mv address@hidden $@
+BUILT_SOURCES += configmake.h
+CLEANFILES += configmake.h configmake.h-t
+
+## end   gnulib module configmake
+
+## begin gnulib module crypto/md5
+
+
+EXTRA_DIST += md5.c md5.h
+
+EXTRA_libcvs_a_SOURCES += md5.c
+
+## end   gnulib module crypto/md5
+
 ## begin gnulib module cycle-check
 
-EXTRA_DIST += cycle-check.h
+
+EXTRA_DIST += cycle-check.c cycle-check.h
+
+EXTRA_libcvs_a_SOURCES += cycle-check.c
 
 ## end   gnulib module cycle-check
 
 ## begin gnulib module dev-ino
 
+
 EXTRA_DIST += dev-ino.h
 
 ## end   gnulib module dev-ino
 
+## begin gnulib module dirfd
+
+
+EXTRA_DIST += dirfd.c dirfd.h
+
+EXTRA_libcvs_a_SOURCES += dirfd.c
+
+## end   gnulib module dirfd
+
 ## begin gnulib module dirname
 
-EXTRA_DIST += dirname.h
+
+EXTRA_DIST += basename.c dirname.c dirname.h stripslash.c
+
+EXTRA_libcvs_a_SOURCES += basename.c dirname.c stripslash.c
 
 ## end   gnulib module dirname
 
+## begin gnulib module dup2
+
+
+EXTRA_DIST += dup2.c
+
+EXTRA_libcvs_a_SOURCES += dup2.c
+
+## end   gnulib module dup2
+
 ## For GNULIB's error module.
 ##
 ## This module isn't fully imported since GNULIB's error.c would conflict with
 ## src/error.c (which knows how to send error messages over the network).  We
 ## don't compile error.c into libcvs on purpose.  It can get compiled later as
 ## part of the getdate test program,
-libcvs_a_SOURCES += error.h
-
-## begin gnulib module exit
+EXTRA_DIST += error.h
 
-libcvs_a_SOURCES += exit.h
+## begin gnulib module exitfail
 
-## end   gnulib module exit
 
-## begin gnulib module exitfail
+EXTRA_DIST += exitfail.c exitfail.h
 
-EXTRA_DIST += exitfail.h
+EXTRA_libcvs_a_SOURCES += exitfail.c
 
 ## end   gnulib module exitfail
 
+## begin gnulib module fchdir
+
+BUILT_SOURCES += $(DIRENT_H)
+
+# We need the following in order to create <dirent.h> when the system
+# doesn't have one that works with the given compiler.
+dirent.h: dirent_.h
+       rm -f address@hidden $@
+       { echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */'; \
+         sed -e 's|@''INCLUDE_NEXT''@|$(INCLUDE_NEXT)|g' \
+             -e 's|@''NEXT_DIRENT_H''@|$(NEXT_DIRENT_H)|g' \
+             -e 's|@''REPLACE_FCHDIR''@|$(REPLACE_FCHDIR)|g' \
+             < $(srcdir)/dirent_.h; \
+       } > address@hidden
+       mv address@hidden $@
+MOSTLYCLEANFILES += dirent.h dirent.h-t
+
+EXTRA_DIST += dirent_.h fchdir.c
+
+EXTRA_libcvs_a_SOURCES += fchdir.c
+
+## end   gnulib module fchdir
+
 ## begin gnulib module fcntl
 
 BUILT_SOURCES += $(FCNTL_H)
-EXTRA_DIST += fcntl_.h
 
 # We need the following in order to create <fcntl.h> when the system
 # doesn't have one that works with the given compiler.
 fcntl.h: fcntl_.h
        rm -f address@hidden $@
-       sed -e 's|@''ABSOLUTE_FCNTL_H''@|$(ABSOLUTE_FCNTL_H)|g' \
-           < $(srcdir)/fcntl_.h > address@hidden
+       { echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */'; \
+         sed -e 's/@''INCLUDE_NEXT''@/$(INCLUDE_NEXT)/g' \
+             -e 's|@''NEXT_FCNTL_H''@|$(NEXT_FCNTL_H)|g' \
+             < $(srcdir)/fcntl_.h; \
+       } > address@hidden
        mv address@hidden $@
 MOSTLYCLEANFILES += fcntl.h fcntl.h-t
 
+EXTRA_DIST += fcntl_.h
+
 ## end   gnulib module fcntl
 
 ## begin gnulib module fcntl-safer
 
-EXTRA_DIST += fcntl-safer.h fcntl--.h
+
+EXTRA_DIST += creat-safer.c fcntl--.h fcntl-safer.h open-safer.c
+
+EXTRA_libcvs_a_SOURCES += creat-safer.c open-safer.c
 
 ## end   gnulib module fcntl-safer
 
 ## begin gnulib module filenamecat
 
-EXTRA_DIST += filenamecat.h
+
+EXTRA_DIST += filenamecat.c filenamecat.h
+
+EXTRA_libcvs_a_SOURCES += filenamecat.c
 
 ## end   gnulib module filenamecat
 
+## begin gnulib module float
+
+BUILT_SOURCES += $(FLOAT_H)
+
+# We need the following in order to create <float.h> when the system
+# doesn't have one that works with the given compiler.
+float.h: float_.h
+       rm -f address@hidden $@
+       { echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */' && \
+         sed -e 's/@''INCLUDE_NEXT''@/$(INCLUDE_NEXT)/g' \
+             -e 's|@''NEXT_FLOAT_H''@|$(NEXT_FLOAT_H)|g' \
+             < $(srcdir)/float_.h; \
+       } > address@hidden
+       mv address@hidden $@
+MOSTLYCLEANFILES += float.h float.h-t
+
+EXTRA_DIST += float_.h
+
+## end   gnulib module float
+
 ## begin gnulib module fnmatch
 
 BUILT_SOURCES += $(FNMATCH_H)
-EXTRA_DIST += fnmatch_.h fnmatch_loop.c
 
 # We need the following in order to create <fnmatch.h> when the system
 # doesn't have one that supports the required API.
 fnmatch.h: fnmatch_.h
        cp -f $(srcdir)/fnmatch_.h address@hidden
+       { echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */'; \
+         cat $(srcdir)/fnmatch_.h; \
+       } > address@hidden
        mv -f address@hidden $@
 MOSTLYCLEANFILES += fnmatch.h fnmatch.h-t
 
+EXTRA_DIST += fnmatch.c fnmatch_.h fnmatch_loop.c
+
+EXTRA_libcvs_a_SOURCES += fnmatch.c fnmatch_loop.c
+
 ## end   gnulib module fnmatch
 
 ## begin gnulib module fpending
 
-EXTRA_DIST += __fpending.h
+
+EXTRA_DIST += __fpending.c __fpending.h
+
+EXTRA_libcvs_a_SOURCES += __fpending.c
 
 ## end   gnulib module fpending
 
+## begin gnulib module ftruncate
+
+
+EXTRA_DIST += ftruncate.c
+
+EXTRA_libcvs_a_SOURCES += ftruncate.c
+
+## end   gnulib module ftruncate
+
 ## begin gnulib module getaddrinfo
 
-libcvs_a_SOURCES += getaddrinfo.h
+
+EXTRA_DIST += gai_strerror.c getaddrinfo.c getaddrinfo.h
+
+EXTRA_libcvs_a_SOURCES += gai_strerror.c getaddrinfo.c
 
 ## end   gnulib module getaddrinfo
 
 ## begin gnulib module getcwd
 
-EXTRA_DIST += getcwd.h
+
+EXTRA_DIST += getcwd.c
+
+EXTRA_libcvs_a_SOURCES += getcwd.c
 
 ## end   gnulib module getcwd
 
@@ -258,31 +489,54 @@
 libcvs_a_SOURCES += getdate.y
 BUILT_SOURCES += getdate.c
 MAINTAINERCLEANFILES += getdate.c
-EXTRA_DIST += getdate.c getdate.h
+EXTRA_DIST += getdate.c
+
+EXTRA_DIST += getdate.h
 
 ## end   gnulib module getdate
 
 ## begin gnulib module getdelim
 
-EXTRA_DIST += getdelim.h
+
+EXTRA_DIST += getdelim.c getdelim.h
+
+EXTRA_libcvs_a_SOURCES += getdelim.c
 
 ## end   gnulib module getdelim
 
+## begin gnulib module gethostname
+
+
+EXTRA_DIST += gethostname.c
+
+EXTRA_libcvs_a_SOURCES += gethostname.c
+
+## end   gnulib module gethostname
+
 ## begin gnulib module getline
 
-EXTRA_DIST += getline.h
+
+EXTRA_DIST += getline.c getline.h
+
+EXTRA_libcvs_a_SOURCES += getline.c
 
 ## end   gnulib module getline
 
 ## begin gnulib module getlogin_r
 
-EXTRA_DIST += getlogin_r.h
+
+EXTRA_DIST += getlogin_r.c
+
+EXTRA_libcvs_a_SOURCES += getlogin_r.c
 
 ## end   gnulib module getlogin_r
 
 ## begin gnulib module getndelim2
 
-EXTRA_DIST += getndelim2.h getndelim2.c
+
+EXTRA_DIST += getndelim2.c getndelim2.h
+
+EXTRA_libcvs_a_SOURCES += getndelim2.c
 
 ## end   gnulib module getndelim2
 
@@ -295,26 +549,35 @@
 ## begin gnulib module getopt
 
 BUILT_SOURCES += $(GETOPT_H)
-EXTRA_DIST += getopt_.h getopt_int.h
 
 # We need the following in order to create <getopt.h> when the system
 # doesn't have one that works with the given compiler.
 getopt.h: getopt_.h
-       cp -f $(srcdir)/getopt_.h address@hidden
+       { echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */'; \
+         cat $(srcdir)/getopt_.h; \
+       } > address@hidden
        mv -f address@hidden $@
 MOSTLYCLEANFILES += getopt.h getopt.h-t
 
+EXTRA_DIST += getopt.c getopt1.c getopt_.h getopt_int.h
+
+EXTRA_libcvs_a_SOURCES += getopt.c getopt1.c
+
 ## end   gnulib module getopt
 
 ## begin gnulib module getpagesize
 
+
 EXTRA_DIST += getpagesize.h
 
 ## end   gnulib module getpagesize
 
 ## begin gnulib module getpass-gnu
 
-EXTRA_DIST += getpass.h
+
+EXTRA_DIST += getpass.c getpass.h
+
+EXTRA_libcvs_a_SOURCES += getpass.c
 
 ## end   gnulib module getpass-gnu
 
@@ -330,6 +593,8 @@
 # "gettextize --intl".
 AM_CPPFLAGS += -I$(top_builddir)/intl
 
+EXTRA_DIST += $(top_srcdir)/build-aux/config.rpath
+
 ## end   gnulib module gettext
 
 ## begin gnulib module gettext-h
@@ -338,29 +603,64 @@
 
 ## end   gnulib module gettext-h
 
+## begin gnulib module gettime
+
+
+EXTRA_DIST += gettime.c
+
+EXTRA_libcvs_a_SOURCES += gettime.c
+
+## end   gnulib module gettime
+
+## begin gnulib module gettimeofday
+
+
+EXTRA_DIST += gettimeofday.c
+
+EXTRA_libcvs_a_SOURCES += gettimeofday.c
+
+## end   gnulib module gettimeofday
+
 ## begin gnulib module glob
 
 BUILT_SOURCES += $(GLOB_H)
-EXTRA_DIST += glob_.h glob-libc.h
 
 # We need the following in order to create <glob.h> when the system
 # doesn't have one that works with the given compiler.
 all-local $(libcvs_a_OBJECTS): $(GLOB_H)
 glob.h: glob_.h
-       cp -f $(srcdir)/glob_.h address@hidden
+       { echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */'; \
+         sed -e 's|@''HAVE_SYS_CDEFS_H''@|$(HAVE_SYS_CDEFS_H)|g' \
+             < $(srcdir)/glob_.h; \
+       } > address@hidden
        mv -f address@hidden $@
 MOSTLYCLEANFILES += glob.h glob.h-t
 
+EXTRA_DIST += glob-libc.h glob.c glob_.h
+
+EXTRA_libcvs_a_SOURCES += glob.c
+
 ## end   gnulib module glob
 
+## begin gnulib module havelib
+
+
+EXTRA_DIST += $(top_srcdir)/build-aux/config.rpath
+
+## end   gnulib module havelib
+
 ## begin gnulib module inet_ntop
 
-libcvs_a_SOURCES += inet_ntop.h
+
+EXTRA_DIST += inet_ntop.c inet_ntop.h
+
+EXTRA_libcvs_a_SOURCES += inet_ntop.c
 
 ## end   gnulib module inet_ntop
 
 ## begin gnulib module intprops
 
+
 EXTRA_DIST += intprops.h
 
 ## end   gnulib module intprops
@@ -368,66 +668,197 @@
 ## begin gnulib module inttypes
 
 BUILT_SOURCES += $(INTTYPES_H)
-EXTRA_DIST += inttypes_.h
 
 # We need the following in order to create <inttypes.h> when the system
 # doesn't have one that works with the given compiler.
 inttypes.h: inttypes_.h
        rm -f address@hidden $@
+       { echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */'; \
        sed -e 's/@''HAVE_INTTYPES_H''@/$(HAVE_INTTYPES_H)/g' \
-           -e 's|@''ABSOLUTE_INTTYPES_H''@|$(ABSOLUTE_INTTYPES_H)|g' \
+             -e 's/@''INCLUDE_NEXT''@/$(INCLUDE_NEXT)/g' \
+             -e 's|@''NEXT_INTTYPES_H''@|$(NEXT_INTTYPES_H)|g' \
            -e 's/@''PRI_MACROS_BROKEN''@/$(PRI_MACROS_BROKEN)/g' \
            -e 's/@''HAVE_LONG_LONG_INT''@/$(HAVE_LONG_LONG_INT)/g' \
+             -e 
's/@''HAVE_UNSIGNED_LONG_LONG_INT''@/$(HAVE_UNSIGNED_LONG_LONG_INT)/g' \
            -e 's/@''PRIPTR_PREFIX''@/$(PRIPTR_PREFIX)/g' \
+             -e 's/@''GNULIB_IMAXABS''@/$(GNULIB_IMAXABS)/g' \
+             -e 's/@''GNULIB_IMAXDIV''@/$(GNULIB_IMAXDIV)/g' \
+             -e 's/@''GNULIB_STRTOIMAX''@/$(GNULIB_STRTOIMAX)/g' \
+             -e 's/@''GNULIB_STRTOUMAX''@/$(GNULIB_STRTOUMAX)/g' \
            -e 's/@''HAVE_DECL_IMAXABS''@/$(HAVE_DECL_IMAXABS)/g' \
            -e 's/@''HAVE_DECL_IMAXDIV''@/$(HAVE_DECL_IMAXDIV)/g' \
            -e 's/@''HAVE_DECL_STRTOIMAX''@/$(HAVE_DECL_STRTOIMAX)/g' \
            -e 's/@''HAVE_DECL_STRTOUMAX''@/$(HAVE_DECL_STRTOUMAX)/g' \
-           < $(srcdir)/inttypes_.h > address@hidden
+             -e '/definition of GL_LINK_WARNING/r $(LINK_WARNING_H)' \
+             < $(srcdir)/inttypes_.h; \
+       } > address@hidden
        mv address@hidden $@
 MOSTLYCLEANFILES += inttypes.h inttypes.h-t
 
+EXTRA_DIST += inttypes_.h
+
 ## end   gnulib module inttypes
 
 ## begin gnulib module lchown
 
-EXTRA_DIST += lchown.h
+
+EXTRA_DIST += lchown.c
+
+EXTRA_libcvs_a_SOURCES += lchown.c
 
 ## end   gnulib module lchown
 
+## begin gnulib module link-warning
+
+LINK_WARNING_H=$(top_srcdir)/build-aux/link-warning.h
+
+EXTRA_DIST += $(top_srcdir)/build-aux/link-warning.h
+
+## end   gnulib module link-warning
+
+## begin gnulib module localcharset
+
+libcvs_a_SOURCES += localcharset.h localcharset.c
+
+# We need the following in order to install a simple file in $(libdir)
+# which is shared with other installed packages. We use a list of referencing
+# packages so that "make uninstall" will remove the file if and only if it
+# is not used by another installed package.
+# On systems with glibc-2.1 or newer, the file is redundant, therefore we
+# avoid installing it.
+
+all-local: charset.alias ref-add.sed ref-del.sed
+
+charset_alias = $(DESTDIR)$(libdir)/charset.alias
+charset_tmp = $(DESTDIR)$(libdir)/charset.tmp
+install-exec-local: all-local
+       test $(GLIBC21) != no || $(mkinstalldirs) $(DESTDIR)$(libdir)
+       if test -f $(charset_alias); then \
+         sed -f ref-add.sed $(charset_alias) > $(charset_tmp) ; \
+         $(INSTALL_DATA) $(charset_tmp) $(charset_alias) ; \
+         rm -f $(charset_tmp) ; \
+       else \
+         if test $(GLIBC21) = no; then \
+           sed -f ref-add.sed charset.alias > $(charset_tmp) ; \
+           $(INSTALL_DATA) $(charset_tmp) $(charset_alias) ; \
+           rm -f $(charset_tmp) ; \
+         fi ; \
+       fi
+
+uninstall-local: all-local
+       if test -f $(charset_alias); then \
+         sed -f ref-del.sed $(charset_alias) > $(charset_tmp); \
+         if grep '^# Packages using this file: $$' $(charset_tmp) \
+             > /dev/null; then \
+           rm -f $(charset_alias); \
+         else \
+           $(INSTALL_DATA) $(charset_tmp) $(charset_alias); \
+         fi; \
+         rm -f $(charset_tmp); \
+       fi
+
+charset.alias: config.charset
+       rm -f t-$@ $@
+       $(SHELL) $(srcdir)/config.charset '$(host)' > t-$@
+       mv t-$@ $@
+
+SUFFIXES += .sed .sin
+.sin.sed:
+       rm -f t-$@ $@
+       sed -e '/^#/d' -e 's/@''PACKAGE''@/$(PACKAGE)/g' $< > t-$@
+       mv t-$@ $@
+
+CLEANFILES += charset.alias ref-add.sed ref-del.sed
+
+EXTRA_DIST += config.charset ref-add.sin ref-del.sin
+
+## end   gnulib module localcharset
+
 ## begin gnulib module lstat
 
-EXTRA_DIST += lstat.h
+
+EXTRA_DIST += lstat.c lstat.h
+
+EXTRA_libcvs_a_SOURCES += lstat.c
 
 ## end   gnulib module lstat
 
+## begin gnulib module malloc
+
+
+EXTRA_DIST += malloc.c
+
+EXTRA_libcvs_a_SOURCES += malloc.c
+
+## end   gnulib module malloc
+
+## begin gnulib module malloca
+
+libcvs_a_SOURCES += malloca.c
+
+EXTRA_DIST += malloca.h malloca.valgrind
+
+## end   gnulib module malloca
+
 ## begin gnulib module mbchar
 
-libcvs_a_SOURCES += mbchar.h
+libcvs_a_SOURCES += mbchar.c
+
+EXTRA_DIST += mbchar.h
 
 ## end   gnulib module mbchar
 
+## begin gnulib module mbslen
+
+libcvs_a_SOURCES += mbslen.c
+
+## end   gnulib module mbslen
+
+## begin gnulib module mbsstr
+
+libcvs_a_SOURCES += mbsstr.c
+
+## end   gnulib module mbsstr
+
 ## begin gnulib module mbuiter
 
 libcvs_a_SOURCES += mbuiter.h
 
 ## end   gnulib module mbuiter
 
-## begin gnulib module md5
+## begin gnulib module memchr
+
+
+EXTRA_DIST += memchr.c
 
-libcvs_a_SOURCES += md5.h
+EXTRA_libcvs_a_SOURCES += memchr.c
 
-## end   gnulib module md5
+## end   gnulib module memchr
+
+## begin gnulib module memmove
+
+
+EXTRA_DIST += memmove.c
+
+EXTRA_libcvs_a_SOURCES += memmove.c
+
+## end   gnulib module memmove
 
 ## begin gnulib module mempcpy
 
-EXTRA_DIST += mempcpy.h
+
+EXTRA_DIST += mempcpy.c
+
+EXTRA_libcvs_a_SOURCES += mempcpy.c
 
 ## end   gnulib module mempcpy
 
 ## begin gnulib module memrchr
 
-EXTRA_DIST += memrchr.h
+
+EXTRA_DIST += memrchr.c
+
+EXTRA_libcvs_a_SOURCES += memrchr.c
 
 ## end   gnulib module memrchr
 
@@ -437,12 +868,50 @@
 
 ## end   gnulib module minmax
 
+## begin gnulib module mkdir
+
+
+EXTRA_DIST += mkdir.c
+
+EXTRA_libcvs_a_SOURCES += mkdir.c
+
+## end   gnulib module mkdir
+
 ## begin gnulib module mkstemp
 
-EXTRA_DIST += mkstemp.h
+
+EXTRA_DIST += mkstemp.c
+
+EXTRA_libcvs_a_SOURCES += mkstemp.c
 
 ## end   gnulib module mkstemp
 
+## begin gnulib module mktime
+
+
+EXTRA_DIST += mktime.c
+
+EXTRA_libcvs_a_SOURCES += mktime.c
+
+## end   gnulib module mktime
+
+## begin gnulib module mreadlink-with-size
+
+libcvs_a_SOURCES += mreadlink-with-size.c
+
+EXTRA_DIST += mreadlink.h
+
+## end   gnulib module mreadlink-with-size
+
+## begin gnulib module nanosleep
+
+
+EXTRA_DIST += nanosleep.c
+
+EXTRA_libcvs_a_SOURCES += nanosleep.c
+
+## end   gnulib module nanosleep
+
 ## begin gnulib module netinet_in
 
 BUILT_SOURCES += $(NETINET_IN_H)
@@ -450,54 +919,120 @@
 # We need the following in order to create <netinet/in.h> when the system
 # doesn't have one.
 netinet/in.h:
-       test -d netinet || mkdir netinet
+       @MKDIR_P@ netinet
        rm -f address@hidden $@
-       echo '#include <sys/socket.h>' >address@hidden
+       { echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */'; \
+         sed -e 's/@''INCLUDE_NEXT''@/$(INCLUDE_NEXT)/g' \
+             -e 's|@''NEXT_NETINET_IN_H''@|$(NEXT_NETINET_IN_H)|g' \
+             -e 's|@''HAVE_NETINET_IN_H''@|$(HAVE_NETINET_IN_H)|g' \
+             < $(srcdir)/netinet_in_.h; \
+       } > address@hidden
        mv address@hidden $@
 MOSTLYCLEANFILES += netinet/in.h netinet/in.h-t
 MOSTLYCLEANDIRS += netinet
 
+EXTRA_DIST += netinet_in_.h
+
 ## end   gnulib module netinet_in
 
 ## begin gnulib module openat
 
-EXTRA_DIST += at-func.c openat.h openat-priv.h
+
+EXTRA_DIST += at-func.c fchmodat.c fchownat.c fstatat.c mkdirat.c 
openat-priv.h openat-proc.c openat.c openat.h
+
+EXTRA_libcvs_a_SOURCES += at-func.c fchmodat.c fchownat.c fstatat.c mkdirat.c 
openat-proc.c openat.c
 
 ## end   gnulib module openat
 
+## begin gnulib module openat-die
+
+libcvs_a_SOURCES += openat-die.c
+
+## end   gnulib module openat-die
+
 ## begin gnulib module pathmax
 
+
 EXTRA_DIST += pathmax.h
 
 ## end   gnulib module pathmax
 
 ## begin gnulib module quotearg
 
-EXTRA_DIST += quotearg.h
+
+EXTRA_DIST += quotearg.c quotearg.h
+
+EXTRA_libcvs_a_SOURCES += quotearg.c
 
 ## end   gnulib module quotearg
 
+## begin gnulib module readlink
+
+
+EXTRA_DIST += readlink.c
+
+EXTRA_libcvs_a_SOURCES += readlink.c
+
+## end   gnulib module readlink
+
+## begin gnulib module realloc
+
+
+EXTRA_DIST += realloc.c
+
+EXTRA_libcvs_a_SOURCES += realloc.c
+
+## end   gnulib module realloc
+
 ## begin gnulib module regex
 
-EXTRA_DIST += regcomp.c regex.h regex_internal.c regex_internal.h regexec.c
+
+EXTRA_DIST += regcomp.c regex.c regex.h regex_internal.c regex_internal.h 
regexec.c
+
+EXTRA_libcvs_a_SOURCES += regcomp.c regex.c regex_internal.c regexec.c
 
 ## end   gnulib module regex
 
+## begin gnulib module rename
+
+
+EXTRA_DIST += rename.c
+
+EXTRA_libcvs_a_SOURCES += rename.c
+
+## end   gnulib module rename
+
+## begin gnulib module rpmatch
+
+
+EXTRA_DIST += rpmatch.c
+
+EXTRA_libcvs_a_SOURCES += rpmatch.c
+
+## end   gnulib module rpmatch
+
 ## begin gnulib module same-inode
 
+
 EXTRA_DIST += same-inode.h
 
 ## end   gnulib module same-inode
 
 ## begin gnulib module save-cwd
 
-EXTRA_DIST += save-cwd.h
+
+EXTRA_DIST += save-cwd.c save-cwd.h
+
+EXTRA_libcvs_a_SOURCES += save-cwd.c
 
 ## end   gnulib module save-cwd
 
 ## begin gnulib module setenv
 
-libcvs_a_SOURCES += setenv.h
+
+EXTRA_DIST += setenv.c setenv.h unsetenv.c
+
+EXTRA_libcvs_a_SOURCES += setenv.c unsetenv.c
 
 ## end   gnulib module setenv
 
@@ -509,12 +1044,16 @@
 
 ## begin gnulib module snprintf
 
-libcvs_a_SOURCES += snprintf.h
+
+EXTRA_DIST += snprintf.c
+
+EXTRA_libcvs_a_SOURCES += snprintf.c
 
 ## end   gnulib module snprintf
 
 ## begin gnulib module stat-macros
 
+
 EXTRA_DIST += stat-macros.h
 
 ## end   gnulib module stat-macros
@@ -522,36 +1061,39 @@
 ## begin gnulib module stdbool
 
 BUILT_SOURCES += $(STDBOOL_H)
-EXTRA_DIST += stdbool_.h
 
 # We need the following in order to create <stdbool.h> when the system
 # doesn't have one that works.
 stdbool.h: stdbool_.h
        rm -f address@hidden $@
-       sed -e 's/@''HAVE__BOOL''@/$(HAVE__BOOL)/g' \
-               < $(srcdir)/stdbool_.h > address@hidden
+       { echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */'; \
+         sed -e 's/@''HAVE__BOOL''@/$(HAVE__BOOL)/g' < $(srcdir)/stdbool_.h; \
+       } > address@hidden
        mv address@hidden $@
 MOSTLYCLEANFILES += stdbool.h stdbool.h-t
 
+EXTRA_DIST += stdbool_.h
+
 ## end   gnulib module stdbool
 
 ## begin gnulib module stdint
 
 BUILT_SOURCES += $(STDINT_H)
-EXTRA_DIST += stdint_.h
 
 # We need the following in order to create <stdint.h> when the system
 # doesn't have one that works with the given compiler.
 stdint.h: stdint_.h
        rm -f address@hidden $@
-       sed -e 's/@''HAVE_WCHAR_H''@/$(HAVE_WCHAR_H)/g' \
-           -e 's/@''HAVE_STDINT_H''@/$(HAVE_STDINT_H)/g' \
-           -e 's|@''ABSOLUTE_STDINT_H''@|$(ABSOLUTE_STDINT_H)|g' \
+       { echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */'; \
+         sed -e 's/@''HAVE_STDINT_H''@/$(HAVE_STDINT_H)/g' \
+             -e 's/@''INCLUDE_NEXT''@/$(INCLUDE_NEXT)/g' \
+             -e 's|@''NEXT_STDINT_H''@|$(NEXT_STDINT_H)|g' \
            -e 's/@''HAVE_SYS_TYPES_H''@/$(HAVE_SYS_TYPES_H)/g' \
            -e 's/@''HAVE_INTTYPES_H''@/$(HAVE_INTTYPES_H)/g' \
            -e 's/@''HAVE_SYS_INTTYPES_H''@/$(HAVE_SYS_INTTYPES_H)/g' \
            -e 's/@''HAVE_SYS_BITYPES_H''@/$(HAVE_SYS_BITYPES_H)/g' \
            -e 's/@''HAVE_LONG_LONG_INT''@/$(HAVE_LONG_LONG_INT)/g' \
+             -e 
's/@''HAVE_UNSIGNED_LONG_LONG_INT''@/$(HAVE_UNSIGNED_LONG_LONG_INT)/g' \
            -e 's/@''BITSIZEOF_PTRDIFF_T''@/$(BITSIZEOF_PTRDIFF_T)/g' \
            -e 's/@''PTRDIFF_T_SUFFIX''@/$(PTRDIFF_T_SUFFIX)/g' \
            -e 's/@''BITSIZEOF_SIG_ATOMIC_T''@/$(BITSIZEOF_SIG_ATOMIC_T)/g' \
@@ -565,39 +1107,216 @@
            -e 's/@''BITSIZEOF_WINT_T''@/$(BITSIZEOF_WINT_T)/g' \
            -e 's/@''HAVE_SIGNED_WINT_T''@/$(HAVE_SIGNED_WINT_T)/g' \
            -e 's/@''WINT_T_SUFFIX''@/$(WINT_T_SUFFIX)/g' \
-           < $(srcdir)/stdint_.h > address@hidden
+             < $(srcdir)/stdint_.h; \
+       } > address@hidden
        mv address@hidden $@
 MOSTLYCLEANFILES += stdint.h stdint.h-t
 
+EXTRA_DIST += stdint_.h
+
 ## end   gnulib module stdint
 
+## begin gnulib module stdio
+
+BUILT_SOURCES += stdio.h
+
+# We need the following in order to create <stdio.h> when the system
+# doesn't have one that works with the given compiler.
+stdio.h: stdio_.h
+       rm -f address@hidden $@
+       { echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */' && \
+         sed -e 's/@''INCLUDE_NEXT''@/$(INCLUDE_NEXT)/g' \
+             -e 's|@''NEXT_STDIO_H''@|$(NEXT_STDIO_H)|g' \
+             -e 's|@''GNULIB_FPRINTF_POSIX''@|$(GNULIB_FPRINTF_POSIX)|g' \
+             -e 's|@''GNULIB_PRINTF_POSIX''@|$(GNULIB_PRINTF_POSIX)|g' \
+             -e 's|@''GNULIB_SNPRINTF''@|$(GNULIB_SNPRINTF)|g' \
+             -e 's|@''GNULIB_SPRINTF_POSIX''@|$(GNULIB_SPRINTF_POSIX)|g' \
+             -e 's|@''GNULIB_VFPRINTF_POSIX''@|$(GNULIB_VFPRINTF_POSIX)|g' \
+             -e 's|@''GNULIB_VPRINTF_POSIX''@|$(GNULIB_VPRINTF_POSIX)|g' \
+             -e 's|@''GNULIB_VSNPRINTF''@|$(GNULIB_VSNPRINTF)|g' \
+             -e 's|@''GNULIB_VSPRINTF_POSIX''@|$(GNULIB_VSPRINTF_POSIX)|g' \
+             -e 's|@''GNULIB_VASPRINTF''@|$(GNULIB_VASPRINTF)|g' \
+             -e 's|@''GNULIB_FSEEK''@|$(GNULIB_FSEEK)|g' \
+             -e 's|@''GNULIB_FSEEKO''@|$(GNULIB_FSEEKO)|g' \
+             -e 's|@''GNULIB_FTELL''@|$(GNULIB_FTELL)|g' \
+             -e 's|@''GNULIB_FTELLO''@|$(GNULIB_FTELLO)|g' \
+             -e 's|@''GNULIB_FFLUSH''@|$(GNULIB_FFLUSH)|g' \
+             -e 's|@''REPLACE_FPRINTF''@|$(REPLACE_FPRINTF)|g' \
+             -e 's|@''REPLACE_VFPRINTF''@|$(REPLACE_VFPRINTF)|g' \
+             -e 's|@''REPLACE_PRINTF''@|$(REPLACE_PRINTF)|g' \
+             -e 's|@''REPLACE_VPRINTF''@|$(REPLACE_VPRINTF)|g' \
+             -e 's|@''REPLACE_SNPRINTF''@|$(REPLACE_SNPRINTF)|g' \
+             -e 's|@''HAVE_DECL_SNPRINTF''@|$(HAVE_DECL_SNPRINTF)|g' \
+             -e 's|@''REPLACE_VSNPRINTF''@|$(REPLACE_VSNPRINTF)|g' \
+             -e 's|@''HAVE_DECL_VSNPRINTF''@|$(HAVE_DECL_VSNPRINTF)|g' \
+             -e 's|@''REPLACE_SPRINTF''@|$(REPLACE_SPRINTF)|g' \
+             -e 's|@''REPLACE_VSPRINTF''@|$(REPLACE_VSPRINTF)|g' \
+             -e 's|@''HAVE_VASPRINTF''@|$(HAVE_VASPRINTF)|g' \
+             -e 's|@''REPLACE_VASPRINTF''@|$(REPLACE_VASPRINTF)|g' \
+             -e 's|@''REPLACE_FSEEKO''@|$(REPLACE_FSEEKO)|g' \
+             -e 's|@''REPLACE_FSEEK''@|$(REPLACE_FSEEK)|g' \
+             -e 's|@''REPLACE_FTELLO''@|$(REPLACE_FTELLO)|g' \
+             -e 's|@''REPLACE_FTELL''@|$(REPLACE_FTELL)|g' \
+             -e 's|@''REPLACE_FFLUSH''@|$(REPLACE_FFLUSH)|g' \
+             -e '/definition of GL_LINK_WARNING/r $(LINK_WARNING_H)' \
+             < $(srcdir)/stdio_.h; \
+       } > address@hidden
+       mv address@hidden $@
+MOSTLYCLEANFILES += stdio.h stdio.h-t
+
+EXTRA_DIST += stdio_.h
+
+## end   gnulib module stdio
+
+## begin gnulib module stdlib
+
+BUILT_SOURCES += stdlib.h
+
+# We need the following in order to create <stdlib.h> when the system
+# doesn't have one that works with the given compiler.
+stdlib.h: stdlib_.h
+       rm -f address@hidden $@
+       { echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */' && \
+         sed -e 's/@''INCLUDE_NEXT''@/$(INCLUDE_NEXT)/g' \
+             -e 's|@''NEXT_STDLIB_H''@|$(NEXT_STDLIB_H)|g' \
+             -e 's|@''GNULIB_GETSUBOPT''@|$(GNULIB_GETSUBOPT)|g' \
+             -e 's|@''GNULIB_MKDTEMP''@|$(GNULIB_MKDTEMP)|g' \
+             -e 's|@''GNULIB_MKSTEMP''@|$(GNULIB_MKSTEMP)|g' \
+             -e 's|@''HAVE_GETSUBOPT''@|$(HAVE_GETSUBOPT)|g' \
+             -e 's|@''HAVE_MKDTEMP''@|$(HAVE_MKDTEMP)|g' \
+             -e 's|@''REPLACE_MKSTEMP''@|$(REPLACE_MKSTEMP)|g' \
+             -e '/definition of GL_LINK_WARNING/r $(LINK_WARNING_H)' \
+             < $(srcdir)/stdlib_.h; \
+       } > address@hidden
+       mv address@hidden $@
+MOSTLYCLEANFILES += stdlib.h stdlib.h-t
+
+EXTRA_DIST += stdlib_.h
+
+## end   gnulib module stdlib
+
 ## begin gnulib module strcase
 
-libcvs_a_SOURCES += strcase.h
+
+EXTRA_DIST += strcasecmp.c strncasecmp.c
+
+EXTRA_libcvs_a_SOURCES += strcasecmp.c strncasecmp.c
 
 ## end   gnulib module strcase
 
 ## begin gnulib module strdup
 
-EXTRA_DIST += strdup.h
+
+EXTRA_DIST += strdup.c
+
+EXTRA_libcvs_a_SOURCES += strdup.c
 
 ## end   gnulib module strdup
 
+## begin gnulib module streq
+
+
+EXTRA_DIST += streq.h
+
+## end   gnulib module streq
+
+## begin gnulib module strerror
+
+
+EXTRA_DIST += strerror.c
+
+EXTRA_libcvs_a_SOURCES += strerror.c
+
+## end   gnulib module strerror
+
 ## begin gnulib module strftime
 
-EXTRA_DIST += strftime.h
+
+EXTRA_DIST += strftime.c strftime.h
+
+EXTRA_libcvs_a_SOURCES += strftime.c
 
 ## end   gnulib module strftime
 
+## begin gnulib module string
+
+BUILT_SOURCES += string.h
+
+# We need the following in order to create <string.h> when the system
+# doesn't have one that works with the given compiler.
+string.h: string_.h
+       rm -f address@hidden $@
+       { echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */' && \
+         sed -e 's/@''INCLUDE_NEXT''@/$(INCLUDE_NEXT)/g' \
+             -e 's|@''NEXT_STRING_H''@|$(NEXT_STRING_H)|g' \
+             -e 's|@''GNULIB_MBSLEN''@|$(GNULIB_MBSLEN)|g' \
+             -e 's|@''GNULIB_MBSNLEN''@|$(GNULIB_MBSNLEN)|g' \
+             -e 's|@''GNULIB_MBSCHR''@|$(GNULIB_MBSCHR)|g' \
+             -e 's|@''GNULIB_MBSRCHR''@|$(GNULIB_MBSRCHR)|g' \
+             -e 's|@''GNULIB_MBSSTR''@|$(GNULIB_MBSSTR)|g' \
+             -e 's|@''GNULIB_MBSCASECMP''@|$(GNULIB_MBSCASECMP)|g' \
+             -e 's|@''GNULIB_MBSNCASECMP''@|$(GNULIB_MBSNCASECMP)|g' \
+             -e 's|@''GNULIB_MBSPCASECMP''@|$(GNULIB_MBSPCASECMP)|g' \
+             -e 's|@''GNULIB_MBSCASESTR''@|$(GNULIB_MBSCASESTR)|g' \
+             -e 's|@''GNULIB_MBSCSPN''@|$(GNULIB_MBSCSPN)|g' \
+             -e 's|@''GNULIB_MBSPBRK''@|$(GNULIB_MBSPBRK)|g' \
+             -e 's|@''GNULIB_MBSSPN''@|$(GNULIB_MBSSPN)|g' \
+             -e 's|@''GNULIB_MBSSEP''@|$(GNULIB_MBSSEP)|g' \
+             -e 's|@''GNULIB_MBSTOK_R''@|$(GNULIB_MBSTOK_R)|g' \
+             -e 's|@''GNULIB_MEMMEM''@|$(GNULIB_MEMMEM)|g' \
+             -e 's|@''GNULIB_MEMPCPY''@|$(GNULIB_MEMPCPY)|g' \
+             -e 's|@''GNULIB_MEMRCHR''@|$(GNULIB_MEMRCHR)|g' \
+             -e 's|@''GNULIB_STPCPY''@|$(GNULIB_STPCPY)|g' \
+             -e 's|@''GNULIB_STPNCPY''@|$(GNULIB_STPNCPY)|g' \
+             -e 's|@''GNULIB_STRCHRNUL''@|$(GNULIB_STRCHRNUL)|g' \
+             -e 's|@''GNULIB_STRDUP''@|$(GNULIB_STRDUP)|g' \
+             -e 's|@''GNULIB_STRNDUP''@|$(GNULIB_STRNDUP)|g' \
+             -e 's|@''GNULIB_STRNLEN''@|$(GNULIB_STRNLEN)|g' \
+             -e 's|@''GNULIB_STRPBRK''@|$(GNULIB_STRPBRK)|g' \
+             -e 's|@''GNULIB_STRSEP''@|$(GNULIB_STRSEP)|g' \
+             -e 's|@''GNULIB_STRCASESTR''@|$(GNULIB_STRCASESTR)|g' \
+             -e 's|@''GNULIB_STRTOK_R''@|$(GNULIB_STRTOK_R)|g' \
+             -e 's|@''HAVE_DECL_MEMMEM''@|$(HAVE_DECL_MEMMEM)|g' \
+             -e 's|@''HAVE_MEMPCPY''@|$(HAVE_MEMPCPY)|g' \
+             -e 's|@''HAVE_DECL_MEMRCHR''@|$(HAVE_DECL_MEMRCHR)|g' \
+             -e 's|@''HAVE_STPCPY''@|$(HAVE_STPCPY)|g' \
+             -e 's|@''HAVE_STPNCPY''@|$(HAVE_STPNCPY)|g' \
+             -e 's|@''HAVE_STRCASECMP''@|$(HAVE_STRCASECMP)|g' \
+             -e 's|@''HAVE_DECL_STRNCASECMP''@|$(HAVE_DECL_STRNCASECMP)|g' \
+             -e 's|@''HAVE_STRCHRNUL''@|$(HAVE_STRCHRNUL)|g' \
+             -e 's|@''HAVE_DECL_STRDUP''@|$(HAVE_DECL_STRDUP)|g' \
+             -e 's|@''HAVE_STRNDUP''@|$(HAVE_STRNDUP)|g' \
+             -e 's|@''HAVE_DECL_STRNDUP''@|$(HAVE_DECL_STRNDUP)|g' \
+             -e 's|@''HAVE_DECL_STRNLEN''@|$(HAVE_DECL_STRNLEN)|g' \
+             -e 's|@''HAVE_STRPBRK''@|$(HAVE_STRPBRK)|g' \
+             -e 's|@''HAVE_STRSEP''@|$(HAVE_STRSEP)|g' \
+             -e 's|@''HAVE_STRCASESTR''@|$(HAVE_STRCASESTR)|g' \
+             -e 's|@''HAVE_DECL_STRTOK_R''@|$(HAVE_DECL_STRTOK_R)|g' \
+             -e '/definition of GL_LINK_WARNING/r $(LINK_WARNING_H)' \
+             < $(srcdir)/string_.h; \
+       } > address@hidden
+       mv address@hidden $@
+MOSTLYCLEANFILES += string.h string.h-t
+
+EXTRA_DIST += string_.h
+
+## end   gnulib module string
+
 ## begin gnulib module strndup
 
-EXTRA_DIST += strndup.h
+
+EXTRA_DIST += strndup.c
+
+EXTRA_libcvs_a_SOURCES += strndup.c
 
 ## end   gnulib module strndup
 
 ## begin gnulib module strnlen
 
-EXTRA_DIST += strnlen.h
+
+EXTRA_DIST += strnlen.c
+
+EXTRA_libcvs_a_SOURCES += strnlen.c
 
 ## end   gnulib module strnlen
 
@@ -607,91 +1326,278 @@
 
 ## end   gnulib module strnlen1
 
-## begin gnulib module strstr
+## begin gnulib module strtoimax
 
-libcvs_a_SOURCES += strstr.h
 
-## end   gnulib module strstr
+EXTRA_DIST += strtoimax.c
+
+EXTRA_libcvs_a_SOURCES += strtoimax.c
+
+## end   gnulib module strtoimax
+
+## begin gnulib module strtol
+
+
+EXTRA_DIST += strtol.c
+
+EXTRA_libcvs_a_SOURCES += strtol.c
+
+## end   gnulib module strtol
+
+## begin gnulib module strtoll
+
+
+EXTRA_DIST += strtoll.c
+
+EXTRA_libcvs_a_SOURCES += strtoll.c
+
+## end   gnulib module strtoll
+
+## begin gnulib module strtoul
+
+
+EXTRA_DIST += strtoul.c
+
+EXTRA_libcvs_a_SOURCES += strtoul.c
+
+## end   gnulib module strtoul
+
+## begin gnulib module strtoull
+
+
+EXTRA_DIST += strtoull.c
+
+EXTRA_libcvs_a_SOURCES += strtoull.c
+
+## end   gnulib module strtoull
+
+## begin gnulib module strtoumax
+
+
+EXTRA_DIST += strtoumax.c
+
+EXTRA_libcvs_a_SOURCES += strtoumax.c
+
+## end   gnulib module strtoumax
 
 ## begin gnulib module sys_socket
 
 BUILT_SOURCES += $(SYS_SOCKET_H)
-EXTRA_DIST += socket_.h
 
 # We need the following in order to create <sys/socket.h> when the system
 # doesn't have one that works with the given compiler.
-sys/socket.h: socket_.h
-       test -d sys || mkdir sys
-       cp -f $(srcdir)/socket_.h address@hidden
+sys/socket.h: sys_socket_.h
+       @MKDIR_P@ sys
+       { echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */'; \
+         sed -e 's/@''INCLUDE_NEXT''@/$(INCLUDE_NEXT)/g' \
+             -e 's|@''NEXT_SYS_SOCKET_H''@|$(NEXT_SYS_SOCKET_H)|g' \
+             -e 's|@''HAVE_SYS_SOCKET_H''@|$(HAVE_SYS_SOCKET_H)|g' \
+             -e 's|@''HAVE_WINSOCK2_H''@|$(HAVE_WINSOCK2_H)|g' \
+             -e 's|@''HAVE_WS2TCPIP_H''@|$(HAVE_WS2TCPIP_H)|g' \
+             < $(srcdir)/sys_socket_.h; \
+       } > address@hidden
        mv -f address@hidden $@
 MOSTLYCLEANFILES += sys/socket.h sys/socket.h-t
 MOSTLYCLEANDIRS += sys
 
+EXTRA_DIST += sys_socket_.h
+
 ## end   gnulib module sys_socket
 
 ## begin gnulib module sys_stat
 
 BUILT_SOURCES += $(SYS_STAT_H)
-EXTRA_DIST += stat_.h
 
 # We need the following in order to create <sys/stat.h> when the system
 # has one that is incomplete.
-sys/stat.h: stat_.h
-       test -d sys || mkdir sys
+sys/stat.h: sys_stat_.h
+       @MKDIR_P@ sys
        rm -f address@hidden $@
-       sed -e 's|@''ABSOLUTE_SYS_STAT_H''@|$(ABSOLUTE_SYS_STAT_H)|g' \
-           < $(srcdir)/stat_.h > address@hidden
+       { echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */'; \
+         sed -e 's/@''INCLUDE_NEXT''@/$(INCLUDE_NEXT)/g' \
+             -e 's|@''NEXT_SYS_STAT_H''@|$(NEXT_SYS_STAT_H)|g' \
+             -e 's|@''HAVE_IO_H''@|$(HAVE_IO_H)|g' \
+             -e 's|@''HAVE_LSTAT''@|$(HAVE_LSTAT)|g' \
+             -e 's|@''HAVE_DECL_MKDIR''@|$(HAVE_DECL_MKDIR)|g' \
+             < $(srcdir)/sys_stat_.h; \
+       } > address@hidden
        mv address@hidden $@
 MOSTLYCLEANFILES += sys/stat.h sys/stat.h-t
 MOSTLYCLEANDIRS += sys
 
+EXTRA_DIST += sys_stat_.h
+
 ## end   gnulib module sys_stat
 
+## begin gnulib module sys_time
+
+BUILT_SOURCES += $(SYS_TIME_H)
+
+# We need the following in order to create <sys/time.h> when the system
+# doesn't have one that works with the given compiler.
+sys/time.h: sys_time_.h
+       @MKDIR_P@ sys
+       rm -f address@hidden $@
+       { echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */'; \
+         sed -e 's/@''HAVE_SYS_TIME_H''@/$(HAVE_SYS_TIME_H)/g' \
+             -e 's/@''INCLUDE_NEXT''@/$(INCLUDE_NEXT)/g' \
+             -e 's|@''NEXT_SYS_TIME_H''@|$(NEXT_SYS_TIME_H)|g' \
+             -e 's/@''REPLACE_GETTIMEOFDAY''@/$(REPLACE_GETTIMEOFDAY)/g' \
+             -e 's/@''HAVE_STRUCT_TIMEVAL''@/$(HAVE_STRUCT_TIMEVAL)/g' \
+             < $(srcdir)/sys_time_.h; \
+       } > address@hidden
+       mv address@hidden $@
+MOSTLYCLEANFILES += sys/time.h sys/time.h-t
+
+EXTRA_DIST += sys_time_.h
+
+## end   gnulib module sys_time
+
+## begin gnulib module tempname
+
+
+EXTRA_DIST += tempname.c tempname.h
+
+EXTRA_libcvs_a_SOURCES += tempname.c
+
+## end   gnulib module tempname
+
+## begin gnulib module time
+
+BUILT_SOURCES += time.h
+
+# We need the following in order to create <time.h> when the system
+# doesn't have one that works with the given compiler.
+time.h: time_.h
+       rm -f address@hidden $@
+       { echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */' && \
+         sed -e 's/@''INCLUDE_NEXT''@/$(INCLUDE_NEXT)/g' \
+             -e 's|@NEXT_TIME_H''@|$(NEXT_TIME_H)|g' \
+             -e 's|@REPLACE_LOCALTIME_R''@|$(REPLACE_LOCALTIME_R)|g' \
+             -e 's|@REPLACE_NANOSLEEP''@|$(REPLACE_NANOSLEEP)|g' \
+             -e 's|@REPLACE_STRPTIME''@|$(REPLACE_STRPTIME)|g' \
+             -e 's|@REPLACE_TIMEGM''@|$(REPLACE_TIMEGM)|g' \
+             -e 
's|@SYS_TIME_H_DEFINES_STRUCT_TIMESPEC''@|$(SYS_TIME_H_DEFINES_STRUCT_TIMESPEC)|g'
 \
+             -e 
's|@TIME_H_DEFINES_STRUCT_TIMESPEC''@|$(TIME_H_DEFINES_STRUCT_TIMESPEC)|g' \
+             < $(srcdir)/time_.h; \
+       } > address@hidden
+       mv address@hidden $@
+MOSTLYCLEANFILES += time.h time.h-t
+
+EXTRA_DIST += time_.h
+
+## end   gnulib module time
+
 ## begin gnulib module time_r
 
-EXTRA_DIST += time_r.h
+
+EXTRA_DIST += time_r.c
+
+EXTRA_libcvs_a_SOURCES += time_r.c
 
 ## end   gnulib module time_r
 
 ## begin gnulib module timespec
 
+
 EXTRA_DIST += timespec.h
 
 ## end   gnulib module timespec
 
 ## begin gnulib module unistd
 
-BUILT_SOURCES += $(UNISTD_H)
+BUILT_SOURCES += unistd.h
 
 # We need the following in order to create an empty placeholder for
 # <unistd.h> when the system doesn't have one.
-unistd.h:
-       echo '/* Empty placeholder for address@hidden  */' >$@
-MOSTLYCLEANFILES += unistd.h
+unistd.h: unistd_.h
+       rm -f address@hidden $@
+       { echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */'; \
+         sed -e 's|@''HAVE_UNISTD_H''@|$(HAVE_UNISTD_H)|g' \
+             -e 's/@''INCLUDE_NEXT''@/$(INCLUDE_NEXT)/g' \
+             -e 's|@''NEXT_UNISTD_H''@|$(NEXT_UNISTD_H)|g' \
+             -e 's|@''GNULIB_CHOWN''@|$(GNULIB_CHOWN)|g' \
+             -e 's|@''GNULIB_DUP2''@|$(GNULIB_DUP2)|g' \
+             -e 's|@''GNULIB_FCHDIR''@|$(GNULIB_FCHDIR)|g' \
+             -e 's|@''GNULIB_FTRUNCATE''@|$(GNULIB_FTRUNCATE)|g' \
+             -e 's|@''GNULIB_GETCWD''@|$(GNULIB_GETCWD)|g' \
+             -e 's|@''GNULIB_GETLOGIN_R''@|$(GNULIB_GETLOGIN_R)|g' \
+             -e 's|@''GNULIB_LCHOWN''@|$(GNULIB_LCHOWN)|g' \
+             -e 's|@''GNULIB_LSEEK''@|$(GNULIB_LSEEK)|g' \
+             -e 's|@''GNULIB_READLINK''@|$(GNULIB_READLINK)|g' \
+             -e 's|@''GNULIB_SLEEP''@|$(GNULIB_SLEEP)|g' \
+             -e 's|@''HAVE_DUP2''@|$(HAVE_DUP2)|g' \
+             -e 's|@''HAVE_FTRUNCATE''@|$(HAVE_FTRUNCATE)|g' \
+             -e 's|@''HAVE_READLINK''@|$(HAVE_READLINK)|g' \
+             -e 's|@''HAVE_SLEEP''@|$(HAVE_SLEEP)|g' \
+             -e 's|@''HAVE_DECL_GETLOGIN_R''@|$(HAVE_DECL_GETLOGIN_R)|g' \
+             -e 's|@''REPLACE_CHOWN''@|$(REPLACE_CHOWN)|g' \
+             -e 's|@''REPLACE_FCHDIR''@|$(REPLACE_FCHDIR)|g' \
+             -e 's|@''REPLACE_GETCWD''@|$(REPLACE_GETCWD)|g' \
+             -e 's|@''REPLACE_LCHOWN''@|$(REPLACE_LCHOWN)|g' \
+             -e 's|@''REPLACE_LSEEK''@|$(REPLACE_LSEEK)|g' \
+             < $(srcdir)/unistd_.h; \
+       } > address@hidden
+       mv address@hidden $@
+MOSTLYCLEANFILES += unistd.h unistd.h-t
+
+EXTRA_DIST += unistd_.h
 
 ## end   gnulib module unistd
 
 ## begin gnulib module unistd-safer
 
-EXTRA_DIST += unistd-safer.h unistd--.h
+
+EXTRA_DIST += dup-safer.c fd-safer.c pipe-safer.c unistd--.h unistd-safer.h
+
+EXTRA_libcvs_a_SOURCES += dup-safer.c fd-safer.c pipe-safer.c
 
 ## end   gnulib module unistd-safer
 
+## begin gnulib module unitypes
+
+
+EXTRA_DIST += unitypes.h
+
+## end   gnulib module unitypes
+
+## begin gnulib module uniwidth/base
+
+
+EXTRA_DIST += localcharset.h uniwidth.h
+
+## end   gnulib module uniwidth/base
+
+## begin gnulib module uniwidth/width
+
+libcvs_a_SOURCES += uniwidth/width.c
+
+EXTRA_DIST += uniwidth/cjk.h
+
+## end   gnulib module uniwidth/width
+
 ## begin gnulib module unlocked-io
 
+
 EXTRA_DIST += unlocked-io.h
 
 ## end   gnulib module unlocked-io
 
 ## begin gnulib module vasnprintf
 
-libcvs_a_SOURCES += printf-args.h printf-parse.h vasnprintf.h
+
+EXTRA_DIST += asnprintf.c float+.h printf-args.c printf-args.h printf-parse.c 
printf-parse.h vasnprintf.c vasnprintf.h
+
+EXTRA_libcvs_a_SOURCES += asnprintf.c printf-args.c printf-parse.c vasnprintf.c
 
 ## end   gnulib module vasnprintf
 
 ## begin gnulib module vasprintf
 
-libcvs_a_SOURCES += vasprintf.h
+
+EXTRA_DIST += asprintf.c vasprintf.c
+
+EXTRA_libcvs_a_SOURCES += asprintf.c vasprintf.c
 
 ## end   gnulib module vasprintf
 
@@ -701,15 +1607,69 @@
 
 ## end   gnulib module verify
 
+## begin gnulib module wchar
+
+BUILT_SOURCES += $(WCHAR_H)
+
+# We need the following in order to create <wchar.h> when the system
+# version does not work standalone.
+wchar.h: wchar_.h
+       rm -f address@hidden $@
+       { echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */'; \
+         sed -e 's/@''INCLUDE_NEXT''@/$(INCLUDE_NEXT)/g' \
+             -e 's|@''NEXT_WCHAR_H''@|$(NEXT_WCHAR_H)|g' \
+             -e 's/@''HAVE_WCHAR_H''@/$(HAVE_WCHAR_H)/g' \
+             -e 's|@''GNULIB_WCWIDTH''@|$(GNULIB_WCWIDTH)|g' \
+             -e 's|@''HAVE_DECL_WCWIDTH''@|$(HAVE_DECL_WCWIDTH)|g' \
+             -e 's|@''REPLACE_WCWIDTH''@|$(REPLACE_WCWIDTH)|g' \
+             -e '/definition of GL_LINK_WARNING/r $(LINK_WARNING_H)' \
+           < $(srcdir)/wchar_.h; \
+       } > address@hidden
+       mv address@hidden $@
+MOSTLYCLEANFILES += wchar.h wchar.h-t
+
+EXTRA_DIST += wchar_.h
+
+## end   gnulib module wchar
+
+## begin gnulib module wctype
+
+BUILT_SOURCES += $(WCTYPE_H)
+
+# We need the following in order to create <wctype.h> when the system
+# doesn't have one that works with the given compiler.
+wctype.h: wctype_.h
+       rm -f address@hidden $@
+       { 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|@''NEXT_WCTYPE_H''@|$(NEXT_WCTYPE_H)|g' \
+             -e 's/@''HAVE_ISWCNTRL''@/$(HAVE_ISWCNTRL)/g' \
+             -e 's/@''HAVE_WINT_T''@/$(HAVE_WINT_T)/g' \
+             < $(srcdir)/wctype_.h; \
+       } > address@hidden
+       mv address@hidden $@
+MOSTLYCLEANFILES += wctype.h wctype.h-t
+
+EXTRA_DIST += wctype_.h
+
+## end   gnulib module wctype
+
 ## begin gnulib module wcwidth
 
-libcvs_a_SOURCES += wcwidth.h
+
+EXTRA_DIST += wcwidth.c
+
+EXTRA_libcvs_a_SOURCES += wcwidth.c
 
 ## end   gnulib module wcwidth
 
 ## begin gnulib module xalloc
 
-EXTRA_DIST += xalloc.h
+
+EXTRA_DIST += xalloc.h xmalloc.c
+
+EXTRA_libcvs_a_SOURCES += xmalloc.c
 
 ## end   gnulib module xalloc
 
@@ -721,7 +1681,10 @@
 
 ## begin gnulib module xgetcwd
 
-EXTRA_DIST += xgetcwd.h
+
+EXTRA_DIST += xgetcwd.c xgetcwd.h
+
+EXTRA_libcvs_a_SOURCES += xgetcwd.c
 
 ## end   gnulib module xgetcwd
 
@@ -733,6 +1696,8 @@
 
 ## begin gnulib module xreadlink
 
+libcvs_a_SOURCES += xreadlink.c
+
 EXTRA_DIST += xreadlink.h
 
 ## end   gnulib module xreadlink
@@ -751,18 +1716,21 @@
 
 ## begin gnulib module yesno
 
-EXTRA_DIST += yesno.h
+
+EXTRA_DIST += yesno.c yesno.h
+
+EXTRA_libcvs_a_SOURCES += yesno.c
 
 ## end   gnulib module yesno
 
 
 mostlyclean-local:
-       @test -z "$(MOSTLYCLEANDIRS)" || \
-         for dir in $(MOSTLYCLEANDIRS); do \
-           if test -d $$dir; then \
+       @for dir in '' $(MOSTLYCLEANDIRS); do \
+         if test -n "$$dir" && test -d $$dir; then \
              echo "rmdir $$dir"; rmdir $$dir; \
            fi; \
-         done
+       done; \
+       :
 
 # Until Automake gets its act together
 distclean-local:

Index: Makefile.gnulib
===================================================================
RCS file: /cvsroot/cvs/ccvs/lib/Makefile.gnulib,v
retrieving revision 1.86
retrieving revision 1.87
diff -u -b -r1.86 -r1.87
--- Makefile.gnulib     22 Sep 2006 17:54:39 -0000      1.86
+++ Makefile.gnulib     22 Aug 2007 12:48:37 -0000      1.87
@@ -1,5 +1,6 @@
+## DO NOT EDIT! GENERATED AUTOMATICALLY!
 ## Process this file with automake to produce Makefile.in.
-# Copyright (C) 2004-2006 Free Software Foundation, Inc.
+# Copyright (C) 2004-2007 Free Software Foundation, Inc.
 #
 # This file is free software, distributed under the terms of the GNU
 # General Public License.  As a special exception to the GNU General
@@ -8,15 +9,13 @@
 # the same distribution terms as the rest of that program.
 #
 # Generated by gnulib-tool.
-# Reproduce by: gnulib-tool --import --dir=. --lib=libcvs --source-base=lib 
--m4-base=m4 --doc-base=doc --aux-dir=build-aux --no-libtool --macro-prefix=gl 
allocsa atexit base64 canon-host canonicalize closeout dirname dup2 error exit 
exitfail extensions fnmatch fnmatch-posix ftruncate getdate gethostname getline 
getlogin_r getndelim2 getnline getopt getpagesize getpass-gnu gettext gettime 
gettimeofday glob inttypes lstat malloc md5 memmove minmax mkdir mkstemp mktime 
nanosleep pathmax quotearg readlink realloc regex rename save-cwd setenv 
stat-macros stdbool stdint strcase strdup strerror strftime strstr strtoul 
strtoumax time_r timespec tzset unlocked-io vasnprintf vasprintf xalloc-die 
xgethostname xreadlink xsize yesno
+# Reproduce by: gnulib-tool --import --dir=. --lib=libcvs --source-base=lib 
--m4-base=m4 --doc-base=doc --aux-dir=build-aux --no-libtool --macro-prefix=gl 
atexit base64 canon-host canonicalize closeout crypto/md5 dirname dup2 error 
exit exitfail extensions fnmatch fnmatch-posix ftruncate getdate gethostname 
getline getlogin_r getndelim2 getnline getopt getpagesize getpass-gnu gettext 
gettime gettimeofday glob inttypes longdouble lstat malloc mbsstr memmove 
minmax mkdir mkstemp mktime nanosleep pathmax quotearg readlink realloc regex 
rename save-cwd setenv stat-macros stdbool stdint strcase strdup strerror 
strftime strtoul strtoumax time_r timespec tzset unlocked-io vasnprintf 
vasprintf xalloc-die xgethostname xreadlink xsize yesno
 
-AUTOMAKE_OPTIONS = 1.5 gnits no-dependencies
+AUTOMAKE_OPTIONS = 1.5 gnits subdir-objects
 
-noinst_LIBRARIES = libcvs.a
-
-libcvs_a_SOURCES =
-libcvs_a_LIBADD = $(LIBOBJS)
 noinst_HEADERS =
+noinst_LIBRARIES =
+noinst_LTLIBRARIES =
 EXTRA_DIST =
 BUILT_SOURCES =
 SUFFIXES =
@@ -28,32 +27,49 @@
 
 AM_CPPFLAGS =
 
+noinst_LIBRARIES += libcvs.a
+
+libcvs_a_SOURCES =
+libcvs_a_LIBADD = $(gl_LIBOBJS)
+libcvs_a_DEPENDENCIES = $(gl_LIBOBJS)
+EXTRA_libcvs_a_SOURCES =
+
+## begin gnulib module absolute-header
+
+# Use this preprocessor expression to decide whether #include_next works.
+# Do not rely on a 'configure'-time test for this, since the expression
+# might appear in an installed header, which is used by some other compiler.
+HAVE_INCLUDE_NEXT = (__GNUC__ || 60000000 <= __DECC_VER)
+
+## end   gnulib module absolute-header
+
 ## begin gnulib module alloca
 
 
+EXTRA_DIST += alloca.c
+
+EXTRA_libcvs_a_SOURCES += alloca.c
+
 libcvs_a_LIBADD += @ALLOCA@
+libcvs_a_DEPENDENCIES += @ALLOCA@
 ## end   gnulib module alloca
 
 ## begin gnulib module alloca-opt
 
 BUILT_SOURCES += $(ALLOCA_H)
-EXTRA_DIST += alloca_.h
 
 # We need the following in order to create <alloca.h> when the system
 # doesn't have one that works with the given compiler.
 alloca.h: alloca_.h
-       cp -f $(srcdir)/alloca_.h address@hidden
+       { echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */'; \
+         cat $(srcdir)/alloca_.h; \
+       } > address@hidden
        mv -f address@hidden $@
 MOSTLYCLEANFILES += alloca.h alloca.h-t
 
-## end   gnulib module alloca-opt
-
-## begin gnulib module allocsa
-
-libcvs_a_SOURCES += allocsa.h allocsa.c
-EXTRA_DIST += allocsa.valgrind
+EXTRA_DIST += alloca_.h
 
-## end   gnulib module allocsa
+## end   gnulib module alloca-opt
 
 ## begin gnulib module arpa_inet
 
@@ -62,15 +78,26 @@
 # We need the following in order to create <arpa/inet.h> when the system
 # doesn't have one.
 arpa/inet.h:
-       test -d arpa || mkdir arpa
+       @MKDIR_P@ arpa
        rm -f address@hidden $@
-       echo '#include <sys/socket.h>' >address@hidden
+       { echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */'; \
+         echo '#include <sys/socket.h>'; \
+       } > address@hidden
        mv address@hidden $@
 MOSTLYCLEANFILES += arpa/inet.h arpa/inet.h-t
 MOSTLYCLEANDIRS += arpa
 
 ## end   gnulib module arpa_inet
 
+## begin gnulib module atexit
+
+
+EXTRA_DIST += atexit.c
+
+EXTRA_libcvs_a_SOURCES += atexit.c
+
+## end   gnulib module atexit
+
 ## begin gnulib module base64
 
 libcvs_a_SOURCES += base64.h base64.c
@@ -79,121 +106,326 @@
 
 ## begin gnulib module canon-host
 
-EXTRA_DIST += canon-host.h
+
+EXTRA_DIST += canon-host.c canon-host.h
+
+EXTRA_libcvs_a_SOURCES += canon-host.c
 
 ## end   gnulib module canon-host
 
 ## begin gnulib module canonicalize
 
-EXTRA_DIST += canonicalize.h
+
+EXTRA_DIST += canonicalize.c canonicalize.h pathmax.h
+
+EXTRA_libcvs_a_SOURCES += canonicalize.c
 
 ## end   gnulib module canonicalize
 
+## begin gnulib module canonicalize-lgpl
+
+
+EXTRA_DIST += canonicalize-lgpl.c canonicalize.h
+
+EXTRA_libcvs_a_SOURCES += canonicalize-lgpl.c
+
+## end   gnulib module canonicalize-lgpl
+
 ## begin gnulib module chdir-long
 
-EXTRA_DIST += chdir-long.h
+
+EXTRA_DIST += chdir-long.c chdir-long.h
+
+EXTRA_libcvs_a_SOURCES += chdir-long.c
 
 ## end   gnulib module chdir-long
 
+## begin gnulib module chown
+
+
+EXTRA_DIST += chown.c fchown-stub.c
+
+EXTRA_libcvs_a_SOURCES += chown.c fchown-stub.c
+
+## end   gnulib module chown
+
 ## begin gnulib module close-stream
 
-EXTRA_DIST += close-stream.h
+
+EXTRA_DIST += close-stream.c close-stream.h
+
+EXTRA_libcvs_a_SOURCES += close-stream.c
 
 ## end   gnulib module close-stream
 
 ## begin gnulib module closeout
 
-EXTRA_DIST += closeout.h
+
+EXTRA_DIST += closeout.c closeout.h
+
+EXTRA_libcvs_a_SOURCES += closeout.c
 
 ## end   gnulib module closeout
 
+## begin gnulib module configmake
+
+# Retrieve values of the variables through 'configure' followed by
+# 'make', not directly through 'configure', so that a user who
+# sets some of these variables consistently on the 'make' command
+# line gets correct results.
+#
+# One advantage of this approach, compared to the classical
+# approach of adding -DLIBDIR=\"$(libdir)\" etc. to AM_CPPFLAGS,
+# is that it protects against the use of undefined variables.
+# If, say, $(libdir) is not set in the Makefile, LIBDIR is not
+# defined by this module, and code using LIBDIR gives a
+# compilation error.
+#
+# Another advantage is that 'make' output is shorter.
+#
+# Listed in the same order as the GNU makefile conventions.
+# The Automake-defined pkg* macros are appended, in the order
+# listed in the Automake 1.10a+ documentation.
+configmake.h: Makefile
+       rm -f address@hidden $@
+       { echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */'; \
+         echo '#define PREFIX "$(prefix)"'; \
+         echo '#define EXEC_PREFIX "$(exec_prefix)"'; \
+         echo '#define BINDIR "$(bindir)"'; \
+         echo '#define SBINDIR "$(sbindir)"'; \
+         echo '#define LIBEXECDIR "$(libexecdir)"'; \
+         echo '#define DATAROOTDIR "$(datarootdir)"'; \
+         echo '#define DATADIR "$(datadir)"'; \
+         echo '#define SYSCONFDIR "$(sysconfdir)"'; \
+         echo '#define SHAREDSTATEDIR "$(sharedstatedir)"'; \
+         echo '#define LOCALSTATEDIR "$(localstatedir)"'; \
+         echo '#define INCLUDEDIR "$(includedir)"'; \
+         echo '#define OLDINCLUDEDIR "$(oldincludedir)"'; \
+         echo '#define DOCDIR "$(docdir)"'; \
+         echo '#define INFODIR "$(infodir)"'; \
+         echo '#define HTMLDIR "$(htmldir)"'; \
+         echo '#define DVIDIR "$(dvidir)"'; \
+         echo '#define PDFDIR "$(pdfdir)"'; \
+         echo '#define PSDIR "$(psdir)"'; \
+         echo '#define LIBDIR "$(libdir)"'; \
+         echo '#define LISPDIR "$(lispdir)"'; \
+         echo '#define LOCALEDIR "$(localedir)"'; \
+         echo '#define MANDIR "$(mandir)"'; \
+         echo '#define MANEXT "$(manext)"'; \
+         echo '#define PKGDATADIR "$(pkgdatadir)"'; \
+         echo '#define PKGINCLUDEDIR "$(pkgincludedir)"'; \
+         echo '#define PKGLIBDIR "$(pkglibdir)"'; \
+         echo '#define PKGLIBEXECDIR "$(pkglibexecdir)"'; \
+       } | sed '/""/d' > address@hidden
+       mv address@hidden $@
+BUILT_SOURCES += configmake.h
+CLEANFILES += configmake.h configmake.h-t
+
+## end   gnulib module configmake
+
+## begin gnulib module crypto/md5
+
+
+EXTRA_DIST += md5.c md5.h
+
+EXTRA_libcvs_a_SOURCES += md5.c
+
+## end   gnulib module crypto/md5
+
 ## begin gnulib module cycle-check
 
-EXTRA_DIST += cycle-check.h
+
+EXTRA_DIST += cycle-check.c cycle-check.h
+
+EXTRA_libcvs_a_SOURCES += cycle-check.c
 
 ## end   gnulib module cycle-check
 
 ## begin gnulib module dev-ino
 
+
 EXTRA_DIST += dev-ino.h
 
 ## end   gnulib module dev-ino
 
+## begin gnulib module dirfd
+
+
+EXTRA_DIST += dirfd.c dirfd.h
+
+EXTRA_libcvs_a_SOURCES += dirfd.c
+
+## end   gnulib module dirfd
+
 ## begin gnulib module dirname
 
-EXTRA_DIST += dirname.h
+
+EXTRA_DIST += basename.c dirname.c dirname.h stripslash.c
+
+EXTRA_libcvs_a_SOURCES += basename.c dirname.c stripslash.c
 
 ## end   gnulib module dirname
 
-## begin gnulib module exit
+## begin gnulib module dup2
+
 
-libcvs_a_SOURCES += exit.h
+EXTRA_DIST += dup2.c
 
-## end   gnulib module exit
+EXTRA_libcvs_a_SOURCES += dup2.c
+
+## end   gnulib module dup2
+
+## begin gnulib module error
+
+
+EXTRA_DIST += error.c error.h
+
+EXTRA_libcvs_a_SOURCES += error.c
+
+## end   gnulib module error
 
 ## begin gnulib module exitfail
 
-EXTRA_DIST += exitfail.h
+
+EXTRA_DIST += exitfail.c exitfail.h
+
+EXTRA_libcvs_a_SOURCES += exitfail.c
 
 ## end   gnulib module exitfail
 
+## begin gnulib module fchdir
+
+BUILT_SOURCES += $(DIRENT_H)
+
+# We need the following in order to create <dirent.h> when the system
+# doesn't have one that works with the given compiler.
+dirent.h: dirent_.h
+       rm -f address@hidden $@
+       { echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */'; \
+         sed -e 's|@''INCLUDE_NEXT''@|$(INCLUDE_NEXT)|g' \
+             -e 's|@''NEXT_DIRENT_H''@|$(NEXT_DIRENT_H)|g' \
+             -e 's|@''REPLACE_FCHDIR''@|$(REPLACE_FCHDIR)|g' \
+             < $(srcdir)/dirent_.h; \
+       } > address@hidden
+       mv address@hidden $@
+MOSTLYCLEANFILES += dirent.h dirent.h-t
+
+EXTRA_DIST += dirent_.h fchdir.c
+
+EXTRA_libcvs_a_SOURCES += fchdir.c
+
+## end   gnulib module fchdir
+
 ## begin gnulib module fcntl
 
 BUILT_SOURCES += $(FCNTL_H)
-EXTRA_DIST += fcntl_.h
 
 # We need the following in order to create <fcntl.h> when the system
 # doesn't have one that works with the given compiler.
 fcntl.h: fcntl_.h
        rm -f address@hidden $@
-       sed -e 's|@''ABSOLUTE_FCNTL_H''@|$(ABSOLUTE_FCNTL_H)|g' \
-           < $(srcdir)/fcntl_.h > address@hidden
+       { echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */'; \
+         sed -e 's/@''INCLUDE_NEXT''@/$(INCLUDE_NEXT)/g' \
+             -e 's|@''NEXT_FCNTL_H''@|$(NEXT_FCNTL_H)|g' \
+             < $(srcdir)/fcntl_.h; \
+       } > address@hidden
        mv address@hidden $@
 MOSTLYCLEANFILES += fcntl.h fcntl.h-t
 
+EXTRA_DIST += fcntl_.h
+
 ## end   gnulib module fcntl
 
 ## begin gnulib module fcntl-safer
 
-EXTRA_DIST += fcntl-safer.h fcntl--.h
+
+EXTRA_DIST += creat-safer.c fcntl--.h fcntl-safer.h open-safer.c
+
+EXTRA_libcvs_a_SOURCES += creat-safer.c open-safer.c
 
 ## end   gnulib module fcntl-safer
 
 ## begin gnulib module filenamecat
 
-EXTRA_DIST += filenamecat.h
+
+EXTRA_DIST += filenamecat.c filenamecat.h
+
+EXTRA_libcvs_a_SOURCES += filenamecat.c
 
 ## end   gnulib module filenamecat
 
+## begin gnulib module float
+
+BUILT_SOURCES += $(FLOAT_H)
+
+# We need the following in order to create <float.h> when the system
+# doesn't have one that works with the given compiler.
+float.h: float_.h
+       rm -f address@hidden $@
+       { echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */' && \
+         sed -e 's/@''INCLUDE_NEXT''@/$(INCLUDE_NEXT)/g' \
+             -e 's|@''NEXT_FLOAT_H''@|$(NEXT_FLOAT_H)|g' \
+             < $(srcdir)/float_.h; \
+       } > address@hidden
+       mv address@hidden $@
+MOSTLYCLEANFILES += float.h float.h-t
+
+EXTRA_DIST += float_.h
+
+## end   gnulib module float
+
 ## begin gnulib module fnmatch
 
 BUILT_SOURCES += $(FNMATCH_H)
-EXTRA_DIST += fnmatch_.h fnmatch_loop.c
 
 # We need the following in order to create <fnmatch.h> when the system
 # doesn't have one that supports the required API.
 fnmatch.h: fnmatch_.h
-       cp -f $(srcdir)/fnmatch_.h address@hidden
+       { echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */'; \
+         cat $(srcdir)/fnmatch_.h; \
+       } > address@hidden
        mv -f address@hidden $@
 MOSTLYCLEANFILES += fnmatch.h fnmatch.h-t
 
+EXTRA_DIST += fnmatch.c fnmatch_.h fnmatch_loop.c
+
+EXTRA_libcvs_a_SOURCES += fnmatch.c fnmatch_loop.c
+
 ## end   gnulib module fnmatch
 
 ## begin gnulib module fpending
 
-EXTRA_DIST += __fpending.h
+
+EXTRA_DIST += __fpending.c __fpending.h
+
+EXTRA_libcvs_a_SOURCES += __fpending.c
 
 ## end   gnulib module fpending
 
+## begin gnulib module ftruncate
+
+
+EXTRA_DIST += ftruncate.c
+
+EXTRA_libcvs_a_SOURCES += ftruncate.c
+
+## end   gnulib module ftruncate
+
 ## begin gnulib module getaddrinfo
 
-libcvs_a_SOURCES += getaddrinfo.h
+
+EXTRA_DIST += gai_strerror.c getaddrinfo.c getaddrinfo.h
+
+EXTRA_libcvs_a_SOURCES += gai_strerror.c getaddrinfo.c
 
 ## end   gnulib module getaddrinfo
 
 ## begin gnulib module getcwd
 
-EXTRA_DIST += getcwd.h
+
+EXTRA_DIST += getcwd.c
+
+EXTRA_libcvs_a_SOURCES += getcwd.c
 
 ## end   gnulib module getcwd
 
@@ -202,31 +434,54 @@
 libcvs_a_SOURCES += getdate.y
 BUILT_SOURCES += getdate.c
 MAINTAINERCLEANFILES += getdate.c
-EXTRA_DIST += getdate.c getdate.h
+EXTRA_DIST += getdate.c
+
+EXTRA_DIST += getdate.h
 
 ## end   gnulib module getdate
 
 ## begin gnulib module getdelim
 
-EXTRA_DIST += getdelim.h
+
+EXTRA_DIST += getdelim.c getdelim.h
+
+EXTRA_libcvs_a_SOURCES += getdelim.c
 
 ## end   gnulib module getdelim
 
+## begin gnulib module gethostname
+
+
+EXTRA_DIST += gethostname.c
+
+EXTRA_libcvs_a_SOURCES += gethostname.c
+
+## end   gnulib module gethostname
+
 ## begin gnulib module getline
 
-EXTRA_DIST += getline.h
+
+EXTRA_DIST += getline.c getline.h
+
+EXTRA_libcvs_a_SOURCES += getline.c
 
 ## end   gnulib module getline
 
 ## begin gnulib module getlogin_r
 
-EXTRA_DIST += getlogin_r.h
+
+EXTRA_DIST += getlogin_r.c
+
+EXTRA_libcvs_a_SOURCES += getlogin_r.c
 
 ## end   gnulib module getlogin_r
 
 ## begin gnulib module getndelim2
 
-EXTRA_DIST += getndelim2.h getndelim2.c
+
+EXTRA_DIST += getndelim2.c getndelim2.h
+
+EXTRA_libcvs_a_SOURCES += getndelim2.c
 
 ## end   gnulib module getndelim2
 
@@ -239,26 +494,35 @@
 ## begin gnulib module getopt
 
 BUILT_SOURCES += $(GETOPT_H)
-EXTRA_DIST += getopt_.h getopt_int.h
 
 # We need the following in order to create <getopt.h> when the system
 # doesn't have one that works with the given compiler.
 getopt.h: getopt_.h
-       cp -f $(srcdir)/getopt_.h address@hidden
+       { echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */'; \
+         cat $(srcdir)/getopt_.h; \
+       } > address@hidden
        mv -f address@hidden $@
 MOSTLYCLEANFILES += getopt.h getopt.h-t
 
+EXTRA_DIST += getopt.c getopt1.c getopt_.h getopt_int.h
+
+EXTRA_libcvs_a_SOURCES += getopt.c getopt1.c
+
 ## end   gnulib module getopt
 
 ## begin gnulib module getpagesize
 
+
 EXTRA_DIST += getpagesize.h
 
 ## end   gnulib module getpagesize
 
 ## begin gnulib module getpass-gnu
 
-EXTRA_DIST += getpass.h
+
+EXTRA_DIST += getpass.c getpass.h
+
+EXTRA_libcvs_a_SOURCES += getpass.c
 
 ## end   gnulib module getpass-gnu
 
@@ -274,6 +538,8 @@
 # "gettextize --intl".
 AM_CPPFLAGS += -I$(top_builddir)/intl
 
+EXTRA_DIST += $(top_srcdir)/build-aux/config.rpath
+
 ## end   gnulib module gettext
 
 ## begin gnulib module gettext-h
@@ -282,28 +548,63 @@
 
 ## end   gnulib module gettext-h
 
+## begin gnulib module gettime
+
+
+EXTRA_DIST += gettime.c
+
+EXTRA_libcvs_a_SOURCES += gettime.c
+
+## end   gnulib module gettime
+
+## begin gnulib module gettimeofday
+
+
+EXTRA_DIST += gettimeofday.c
+
+EXTRA_libcvs_a_SOURCES += gettimeofday.c
+
+## end   gnulib module gettimeofday
+
 ## begin gnulib module glob
 
 BUILT_SOURCES += $(GLOB_H)
-EXTRA_DIST += glob_.h glob-libc.h
 
 # We need the following in order to create <glob.h> when the system
 # doesn't have one that works with the given compiler.
 glob.h: glob_.h
-       cp -f $(srcdir)/glob_.h address@hidden
+       { echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */'; \
+         sed -e 's|@''HAVE_SYS_CDEFS_H''@|$(HAVE_SYS_CDEFS_H)|g' \
+             < $(srcdir)/glob_.h; \
+       } > address@hidden
        mv -f address@hidden $@
 MOSTLYCLEANFILES += glob.h glob.h-t
 
+EXTRA_DIST += glob-libc.h glob.c glob_.h
+
+EXTRA_libcvs_a_SOURCES += glob.c
+
 ## end   gnulib module glob
 
+## begin gnulib module havelib
+
+
+EXTRA_DIST += $(top_srcdir)/build-aux/config.rpath
+
+## end   gnulib module havelib
+
 ## begin gnulib module inet_ntop
 
-libcvs_a_SOURCES += inet_ntop.h
+
+EXTRA_DIST += inet_ntop.c inet_ntop.h
+
+EXTRA_libcvs_a_SOURCES += inet_ntop.c
 
 ## end   gnulib module inet_ntop
 
 ## begin gnulib module intprops
 
+
 EXTRA_DIST += intprops.h
 
 ## end   gnulib module intprops
@@ -311,66 +612,197 @@
 ## begin gnulib module inttypes
 
 BUILT_SOURCES += $(INTTYPES_H)
-EXTRA_DIST += inttypes_.h
 
 # We need the following in order to create <inttypes.h> when the system
 # doesn't have one that works with the given compiler.
 inttypes.h: inttypes_.h
        rm -f address@hidden $@
+       { echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */'; \
        sed -e 's/@''HAVE_INTTYPES_H''@/$(HAVE_INTTYPES_H)/g' \
-           -e 's|@''ABSOLUTE_INTTYPES_H''@|$(ABSOLUTE_INTTYPES_H)|g' \
+             -e 's/@''INCLUDE_NEXT''@/$(INCLUDE_NEXT)/g' \
+             -e 's|@''NEXT_INTTYPES_H''@|$(NEXT_INTTYPES_H)|g' \
            -e 's/@''PRI_MACROS_BROKEN''@/$(PRI_MACROS_BROKEN)/g' \
            -e 's/@''HAVE_LONG_LONG_INT''@/$(HAVE_LONG_LONG_INT)/g' \
+             -e 
's/@''HAVE_UNSIGNED_LONG_LONG_INT''@/$(HAVE_UNSIGNED_LONG_LONG_INT)/g' \
            -e 's/@''PRIPTR_PREFIX''@/$(PRIPTR_PREFIX)/g' \
+             -e 's/@''GNULIB_IMAXABS''@/$(GNULIB_IMAXABS)/g' \
+             -e 's/@''GNULIB_IMAXDIV''@/$(GNULIB_IMAXDIV)/g' \
+             -e 's/@''GNULIB_STRTOIMAX''@/$(GNULIB_STRTOIMAX)/g' \
+             -e 's/@''GNULIB_STRTOUMAX''@/$(GNULIB_STRTOUMAX)/g' \
            -e 's/@''HAVE_DECL_IMAXABS''@/$(HAVE_DECL_IMAXABS)/g' \
            -e 's/@''HAVE_DECL_IMAXDIV''@/$(HAVE_DECL_IMAXDIV)/g' \
            -e 's/@''HAVE_DECL_STRTOIMAX''@/$(HAVE_DECL_STRTOIMAX)/g' \
            -e 's/@''HAVE_DECL_STRTOUMAX''@/$(HAVE_DECL_STRTOUMAX)/g' \
-           < $(srcdir)/inttypes_.h > address@hidden
+             -e '/definition of GL_LINK_WARNING/r $(LINK_WARNING_H)' \
+             < $(srcdir)/inttypes_.h; \
+       } > address@hidden
        mv address@hidden $@
 MOSTLYCLEANFILES += inttypes.h inttypes.h-t
 
+EXTRA_DIST += inttypes_.h
+
 ## end   gnulib module inttypes
 
 ## begin gnulib module lchown
 
-EXTRA_DIST += lchown.h
+
+EXTRA_DIST += lchown.c
+
+EXTRA_libcvs_a_SOURCES += lchown.c
 
 ## end   gnulib module lchown
 
+## begin gnulib module link-warning
+
+LINK_WARNING_H=$(top_srcdir)/build-aux/link-warning.h
+
+EXTRA_DIST += $(top_srcdir)/build-aux/link-warning.h
+
+## end   gnulib module link-warning
+
+## begin gnulib module localcharset
+
+libcvs_a_SOURCES += localcharset.h localcharset.c
+
+# We need the following in order to install a simple file in $(libdir)
+# which is shared with other installed packages. We use a list of referencing
+# packages so that "make uninstall" will remove the file if and only if it
+# is not used by another installed package.
+# On systems with glibc-2.1 or newer, the file is redundant, therefore we
+# avoid installing it.
+
+all-local: charset.alias ref-add.sed ref-del.sed
+
+charset_alias = $(DESTDIR)$(libdir)/charset.alias
+charset_tmp = $(DESTDIR)$(libdir)/charset.tmp
+install-exec-local: all-local
+       test $(GLIBC21) != no || $(mkinstalldirs) $(DESTDIR)$(libdir)
+       if test -f $(charset_alias); then \
+         sed -f ref-add.sed $(charset_alias) > $(charset_tmp) ; \
+         $(INSTALL_DATA) $(charset_tmp) $(charset_alias) ; \
+         rm -f $(charset_tmp) ; \
+       else \
+         if test $(GLIBC21) = no; then \
+           sed -f ref-add.sed charset.alias > $(charset_tmp) ; \
+           $(INSTALL_DATA) $(charset_tmp) $(charset_alias) ; \
+           rm -f $(charset_tmp) ; \
+         fi ; \
+       fi
+
+uninstall-local: all-local
+       if test -f $(charset_alias); then \
+         sed -f ref-del.sed $(charset_alias) > $(charset_tmp); \
+         if grep '^# Packages using this file: $$' $(charset_tmp) \
+             > /dev/null; then \
+           rm -f $(charset_alias); \
+         else \
+           $(INSTALL_DATA) $(charset_tmp) $(charset_alias); \
+         fi; \
+         rm -f $(charset_tmp); \
+       fi
+
+charset.alias: config.charset
+       rm -f t-$@ $@
+       $(SHELL) $(srcdir)/config.charset '$(host)' > t-$@
+       mv t-$@ $@
+
+SUFFIXES += .sed .sin
+.sin.sed:
+       rm -f t-$@ $@
+       sed -e '/^#/d' -e 's/@''PACKAGE''@/$(PACKAGE)/g' $< > t-$@
+       mv t-$@ $@
+
+CLEANFILES += charset.alias ref-add.sed ref-del.sed
+
+EXTRA_DIST += config.charset ref-add.sin ref-del.sin
+
+## end   gnulib module localcharset
+
 ## begin gnulib module lstat
 
-EXTRA_DIST += lstat.h
+
+EXTRA_DIST += lstat.c lstat.h
+
+EXTRA_libcvs_a_SOURCES += lstat.c
 
 ## end   gnulib module lstat
 
+## begin gnulib module malloc
+
+
+EXTRA_DIST += malloc.c
+
+EXTRA_libcvs_a_SOURCES += malloc.c
+
+## end   gnulib module malloc
+
+## begin gnulib module malloca
+
+libcvs_a_SOURCES += malloca.c
+
+EXTRA_DIST += malloca.h malloca.valgrind
+
+## end   gnulib module malloca
+
 ## begin gnulib module mbchar
 
-libcvs_a_SOURCES += mbchar.h
+libcvs_a_SOURCES += mbchar.c
+
+EXTRA_DIST += mbchar.h
 
 ## end   gnulib module mbchar
 
+## begin gnulib module mbslen
+
+libcvs_a_SOURCES += mbslen.c
+
+## end   gnulib module mbslen
+
+## begin gnulib module mbsstr
+
+libcvs_a_SOURCES += mbsstr.c
+
+## end   gnulib module mbsstr
+
 ## begin gnulib module mbuiter
 
 libcvs_a_SOURCES += mbuiter.h
 
 ## end   gnulib module mbuiter
 
-## begin gnulib module md5
+## begin gnulib module memchr
+
+
+EXTRA_DIST += memchr.c
+
+EXTRA_libcvs_a_SOURCES += memchr.c
+
+## end   gnulib module memchr
+
+## begin gnulib module memmove
+
+
+EXTRA_DIST += memmove.c
 
-libcvs_a_SOURCES += md5.h
+EXTRA_libcvs_a_SOURCES += memmove.c
 
-## end   gnulib module md5
+## end   gnulib module memmove
 
 ## begin gnulib module mempcpy
 
-EXTRA_DIST += mempcpy.h
+
+EXTRA_DIST += mempcpy.c
+
+EXTRA_libcvs_a_SOURCES += mempcpy.c
 
 ## end   gnulib module mempcpy
 
 ## begin gnulib module memrchr
 
-EXTRA_DIST += memrchr.h
+
+EXTRA_DIST += memrchr.c
+
+EXTRA_libcvs_a_SOURCES += memrchr.c
 
 ## end   gnulib module memrchr
 
@@ -380,12 +812,50 @@
 
 ## end   gnulib module minmax
 
+## begin gnulib module mkdir
+
+
+EXTRA_DIST += mkdir.c
+
+EXTRA_libcvs_a_SOURCES += mkdir.c
+
+## end   gnulib module mkdir
+
 ## begin gnulib module mkstemp
 
-EXTRA_DIST += mkstemp.h
+
+EXTRA_DIST += mkstemp.c
+
+EXTRA_libcvs_a_SOURCES += mkstemp.c
 
 ## end   gnulib module mkstemp
 
+## begin gnulib module mktime
+
+
+EXTRA_DIST += mktime.c
+
+EXTRA_libcvs_a_SOURCES += mktime.c
+
+## end   gnulib module mktime
+
+## begin gnulib module mreadlink-with-size
+
+libcvs_a_SOURCES += mreadlink-with-size.c
+
+EXTRA_DIST += mreadlink.h
+
+## end   gnulib module mreadlink-with-size
+
+## begin gnulib module nanosleep
+
+
+EXTRA_DIST += nanosleep.c
+
+EXTRA_libcvs_a_SOURCES += nanosleep.c
+
+## end   gnulib module nanosleep
+
 ## begin gnulib module netinet_in
 
 BUILT_SOURCES += $(NETINET_IN_H)
@@ -393,54 +863,120 @@
 # We need the following in order to create <netinet/in.h> when the system
 # doesn't have one.
 netinet/in.h:
-       test -d netinet || mkdir netinet
+       @MKDIR_P@ netinet
        rm -f address@hidden $@
-       echo '#include <sys/socket.h>' >address@hidden
+       { echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */'; \
+         sed -e 's/@''INCLUDE_NEXT''@/$(INCLUDE_NEXT)/g' \
+             -e 's|@''NEXT_NETINET_IN_H''@|$(NEXT_NETINET_IN_H)|g' \
+             -e 's|@''HAVE_NETINET_IN_H''@|$(HAVE_NETINET_IN_H)|g' \
+             < $(srcdir)/netinet_in_.h; \
+       } > address@hidden
        mv address@hidden $@
 MOSTLYCLEANFILES += netinet/in.h netinet/in.h-t
 MOSTLYCLEANDIRS += netinet
 
+EXTRA_DIST += netinet_in_.h
+
 ## end   gnulib module netinet_in
 
 ## begin gnulib module openat
 
-EXTRA_DIST += at-func.c openat.h openat-priv.h
+
+EXTRA_DIST += at-func.c fchmodat.c fchownat.c fstatat.c mkdirat.c 
openat-priv.h openat-proc.c openat.c openat.h
+
+EXTRA_libcvs_a_SOURCES += at-func.c fchmodat.c fchownat.c fstatat.c mkdirat.c 
openat-proc.c openat.c
 
 ## end   gnulib module openat
 
+## begin gnulib module openat-die
+
+libcvs_a_SOURCES += openat-die.c
+
+## end   gnulib module openat-die
+
 ## begin gnulib module pathmax
 
+
 EXTRA_DIST += pathmax.h
 
 ## end   gnulib module pathmax
 
 ## begin gnulib module quotearg
 
-EXTRA_DIST += quotearg.h
+
+EXTRA_DIST += quotearg.c quotearg.h
+
+EXTRA_libcvs_a_SOURCES += quotearg.c
 
 ## end   gnulib module quotearg
 
+## begin gnulib module readlink
+
+
+EXTRA_DIST += readlink.c
+
+EXTRA_libcvs_a_SOURCES += readlink.c
+
+## end   gnulib module readlink
+
+## begin gnulib module realloc
+
+
+EXTRA_DIST += realloc.c
+
+EXTRA_libcvs_a_SOURCES += realloc.c
+
+## end   gnulib module realloc
+
 ## begin gnulib module regex
 
-EXTRA_DIST += regcomp.c regex.h regex_internal.c regex_internal.h regexec.c
+
+EXTRA_DIST += regcomp.c regex.c regex.h regex_internal.c regex_internal.h 
regexec.c
+
+EXTRA_libcvs_a_SOURCES += regcomp.c regex.c regex_internal.c regexec.c
 
 ## end   gnulib module regex
 
+## begin gnulib module rename
+
+
+EXTRA_DIST += rename.c
+
+EXTRA_libcvs_a_SOURCES += rename.c
+
+## end   gnulib module rename
+
+## begin gnulib module rpmatch
+
+
+EXTRA_DIST += rpmatch.c
+
+EXTRA_libcvs_a_SOURCES += rpmatch.c
+
+## end   gnulib module rpmatch
+
 ## begin gnulib module same-inode
 
+
 EXTRA_DIST += same-inode.h
 
 ## end   gnulib module same-inode
 
 ## begin gnulib module save-cwd
 
-EXTRA_DIST += save-cwd.h
+
+EXTRA_DIST += save-cwd.c save-cwd.h
+
+EXTRA_libcvs_a_SOURCES += save-cwd.c
 
 ## end   gnulib module save-cwd
 
 ## begin gnulib module setenv
 
-libcvs_a_SOURCES += setenv.h
+
+EXTRA_DIST += setenv.c setenv.h unsetenv.c
+
+EXTRA_libcvs_a_SOURCES += setenv.c unsetenv.c
 
 ## end   gnulib module setenv
 
@@ -452,12 +988,16 @@
 
 ## begin gnulib module snprintf
 
-libcvs_a_SOURCES += snprintf.h
+
+EXTRA_DIST += snprintf.c
+
+EXTRA_libcvs_a_SOURCES += snprintf.c
 
 ## end   gnulib module snprintf
 
 ## begin gnulib module stat-macros
 
+
 EXTRA_DIST += stat-macros.h
 
 ## end   gnulib module stat-macros
@@ -465,35 +1005,39 @@
 ## begin gnulib module stdbool
 
 BUILT_SOURCES += $(STDBOOL_H)
-EXTRA_DIST += stdbool_.h
 
 # We need the following in order to create <stdbool.h> when the system
 # doesn't have one that works.
 stdbool.h: stdbool_.h
        rm -f address@hidden $@
-       sed -e 's/@''HAVE__BOOL''@/$(HAVE__BOOL)/g' < $(srcdir)/stdbool_.h > 
address@hidden
+       { echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */'; \
+         sed -e 's/@''HAVE__BOOL''@/$(HAVE__BOOL)/g' < $(srcdir)/stdbool_.h; \
+       } > address@hidden
        mv address@hidden $@
 MOSTLYCLEANFILES += stdbool.h stdbool.h-t
 
+EXTRA_DIST += stdbool_.h
+
 ## end   gnulib module stdbool
 
 ## begin gnulib module stdint
 
 BUILT_SOURCES += $(STDINT_H)
-EXTRA_DIST += stdint_.h
 
 # We need the following in order to create <stdint.h> when the system
 # doesn't have one that works with the given compiler.
 stdint.h: stdint_.h
        rm -f address@hidden $@
-       sed -e 's/@''HAVE_WCHAR_H''@/$(HAVE_WCHAR_H)/g' \
-           -e 's/@''HAVE_STDINT_H''@/$(HAVE_STDINT_H)/g' \
-           -e 's|@''ABSOLUTE_STDINT_H''@|$(ABSOLUTE_STDINT_H)|g' \
+       { echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */'; \
+         sed -e 's/@''HAVE_STDINT_H''@/$(HAVE_STDINT_H)/g' \
+             -e 's/@''INCLUDE_NEXT''@/$(INCLUDE_NEXT)/g' \
+             -e 's|@''NEXT_STDINT_H''@|$(NEXT_STDINT_H)|g' \
            -e 's/@''HAVE_SYS_TYPES_H''@/$(HAVE_SYS_TYPES_H)/g' \
            -e 's/@''HAVE_INTTYPES_H''@/$(HAVE_INTTYPES_H)/g' \
            -e 's/@''HAVE_SYS_INTTYPES_H''@/$(HAVE_SYS_INTTYPES_H)/g' \
            -e 's/@''HAVE_SYS_BITYPES_H''@/$(HAVE_SYS_BITYPES_H)/g' \
            -e 's/@''HAVE_LONG_LONG_INT''@/$(HAVE_LONG_LONG_INT)/g' \
+             -e 
's/@''HAVE_UNSIGNED_LONG_LONG_INT''@/$(HAVE_UNSIGNED_LONG_LONG_INT)/g' \
            -e 's/@''BITSIZEOF_PTRDIFF_T''@/$(BITSIZEOF_PTRDIFF_T)/g' \
            -e 's/@''PTRDIFF_T_SUFFIX''@/$(PTRDIFF_T_SUFFIX)/g' \
            -e 's/@''BITSIZEOF_SIG_ATOMIC_T''@/$(BITSIZEOF_SIG_ATOMIC_T)/g' \
@@ -507,39 +1051,216 @@
            -e 's/@''BITSIZEOF_WINT_T''@/$(BITSIZEOF_WINT_T)/g' \
            -e 's/@''HAVE_SIGNED_WINT_T''@/$(HAVE_SIGNED_WINT_T)/g' \
            -e 's/@''WINT_T_SUFFIX''@/$(WINT_T_SUFFIX)/g' \
-           < $(srcdir)/stdint_.h > address@hidden
+             < $(srcdir)/stdint_.h; \
+       } > address@hidden
        mv address@hidden $@
 MOSTLYCLEANFILES += stdint.h stdint.h-t
 
+EXTRA_DIST += stdint_.h
+
 ## end   gnulib module stdint
 
+## begin gnulib module stdio
+
+BUILT_SOURCES += stdio.h
+
+# We need the following in order to create <stdio.h> when the system
+# doesn't have one that works with the given compiler.
+stdio.h: stdio_.h
+       rm -f address@hidden $@
+       { echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */' && \
+         sed -e 's/@''INCLUDE_NEXT''@/$(INCLUDE_NEXT)/g' \
+             -e 's|@''NEXT_STDIO_H''@|$(NEXT_STDIO_H)|g' \
+             -e 's|@''GNULIB_FPRINTF_POSIX''@|$(GNULIB_FPRINTF_POSIX)|g' \
+             -e 's|@''GNULIB_PRINTF_POSIX''@|$(GNULIB_PRINTF_POSIX)|g' \
+             -e 's|@''GNULIB_SNPRINTF''@|$(GNULIB_SNPRINTF)|g' \
+             -e 's|@''GNULIB_SPRINTF_POSIX''@|$(GNULIB_SPRINTF_POSIX)|g' \
+             -e 's|@''GNULIB_VFPRINTF_POSIX''@|$(GNULIB_VFPRINTF_POSIX)|g' \
+             -e 's|@''GNULIB_VPRINTF_POSIX''@|$(GNULIB_VPRINTF_POSIX)|g' \
+             -e 's|@''GNULIB_VSNPRINTF''@|$(GNULIB_VSNPRINTF)|g' \
+             -e 's|@''GNULIB_VSPRINTF_POSIX''@|$(GNULIB_VSPRINTF_POSIX)|g' \
+             -e 's|@''GNULIB_VASPRINTF''@|$(GNULIB_VASPRINTF)|g' \
+             -e 's|@''GNULIB_FSEEK''@|$(GNULIB_FSEEK)|g' \
+             -e 's|@''GNULIB_FSEEKO''@|$(GNULIB_FSEEKO)|g' \
+             -e 's|@''GNULIB_FTELL''@|$(GNULIB_FTELL)|g' \
+             -e 's|@''GNULIB_FTELLO''@|$(GNULIB_FTELLO)|g' \
+             -e 's|@''GNULIB_FFLUSH''@|$(GNULIB_FFLUSH)|g' \
+             -e 's|@''REPLACE_FPRINTF''@|$(REPLACE_FPRINTF)|g' \
+             -e 's|@''REPLACE_VFPRINTF''@|$(REPLACE_VFPRINTF)|g' \
+             -e 's|@''REPLACE_PRINTF''@|$(REPLACE_PRINTF)|g' \
+             -e 's|@''REPLACE_VPRINTF''@|$(REPLACE_VPRINTF)|g' \
+             -e 's|@''REPLACE_SNPRINTF''@|$(REPLACE_SNPRINTF)|g' \
+             -e 's|@''HAVE_DECL_SNPRINTF''@|$(HAVE_DECL_SNPRINTF)|g' \
+             -e 's|@''REPLACE_VSNPRINTF''@|$(REPLACE_VSNPRINTF)|g' \
+             -e 's|@''HAVE_DECL_VSNPRINTF''@|$(HAVE_DECL_VSNPRINTF)|g' \
+             -e 's|@''REPLACE_SPRINTF''@|$(REPLACE_SPRINTF)|g' \
+             -e 's|@''REPLACE_VSPRINTF''@|$(REPLACE_VSPRINTF)|g' \
+             -e 's|@''HAVE_VASPRINTF''@|$(HAVE_VASPRINTF)|g' \
+             -e 's|@''REPLACE_VASPRINTF''@|$(REPLACE_VASPRINTF)|g' \
+             -e 's|@''REPLACE_FSEEKO''@|$(REPLACE_FSEEKO)|g' \
+             -e 's|@''REPLACE_FSEEK''@|$(REPLACE_FSEEK)|g' \
+             -e 's|@''REPLACE_FTELLO''@|$(REPLACE_FTELLO)|g' \
+             -e 's|@''REPLACE_FTELL''@|$(REPLACE_FTELL)|g' \
+             -e 's|@''REPLACE_FFLUSH''@|$(REPLACE_FFLUSH)|g' \
+             -e '/definition of GL_LINK_WARNING/r $(LINK_WARNING_H)' \
+             < $(srcdir)/stdio_.h; \
+       } > address@hidden
+       mv address@hidden $@
+MOSTLYCLEANFILES += stdio.h stdio.h-t
+
+EXTRA_DIST += stdio_.h
+
+## end   gnulib module stdio
+
+## begin gnulib module stdlib
+
+BUILT_SOURCES += stdlib.h
+
+# We need the following in order to create <stdlib.h> when the system
+# doesn't have one that works with the given compiler.
+stdlib.h: stdlib_.h
+       rm -f address@hidden $@
+       { echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */' && \
+         sed -e 's/@''INCLUDE_NEXT''@/$(INCLUDE_NEXT)/g' \
+             -e 's|@''NEXT_STDLIB_H''@|$(NEXT_STDLIB_H)|g' \
+             -e 's|@''GNULIB_GETSUBOPT''@|$(GNULIB_GETSUBOPT)|g' \
+             -e 's|@''GNULIB_MKDTEMP''@|$(GNULIB_MKDTEMP)|g' \
+             -e 's|@''GNULIB_MKSTEMP''@|$(GNULIB_MKSTEMP)|g' \
+             -e 's|@''HAVE_GETSUBOPT''@|$(HAVE_GETSUBOPT)|g' \
+             -e 's|@''HAVE_MKDTEMP''@|$(HAVE_MKDTEMP)|g' \
+             -e 's|@''REPLACE_MKSTEMP''@|$(REPLACE_MKSTEMP)|g' \
+             -e '/definition of GL_LINK_WARNING/r $(LINK_WARNING_H)' \
+             < $(srcdir)/stdlib_.h; \
+       } > address@hidden
+       mv address@hidden $@
+MOSTLYCLEANFILES += stdlib.h stdlib.h-t
+
+EXTRA_DIST += stdlib_.h
+
+## end   gnulib module stdlib
+
 ## begin gnulib module strcase
 
-libcvs_a_SOURCES += strcase.h
+
+EXTRA_DIST += strcasecmp.c strncasecmp.c
+
+EXTRA_libcvs_a_SOURCES += strcasecmp.c strncasecmp.c
 
 ## end   gnulib module strcase
 
 ## begin gnulib module strdup
 
-EXTRA_DIST += strdup.h
+
+EXTRA_DIST += strdup.c
+
+EXTRA_libcvs_a_SOURCES += strdup.c
 
 ## end   gnulib module strdup
 
+## begin gnulib module streq
+
+
+EXTRA_DIST += streq.h
+
+## end   gnulib module streq
+
+## begin gnulib module strerror
+
+
+EXTRA_DIST += strerror.c
+
+EXTRA_libcvs_a_SOURCES += strerror.c
+
+## end   gnulib module strerror
+
 ## begin gnulib module strftime
 
-EXTRA_DIST += strftime.h
+
+EXTRA_DIST += strftime.c strftime.h
+
+EXTRA_libcvs_a_SOURCES += strftime.c
 
 ## end   gnulib module strftime
 
+## begin gnulib module string
+
+BUILT_SOURCES += string.h
+
+# We need the following in order to create <string.h> when the system
+# doesn't have one that works with the given compiler.
+string.h: string_.h
+       rm -f address@hidden $@
+       { echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */' && \
+         sed -e 's/@''INCLUDE_NEXT''@/$(INCLUDE_NEXT)/g' \
+             -e 's|@''NEXT_STRING_H''@|$(NEXT_STRING_H)|g' \
+             -e 's|@''GNULIB_MBSLEN''@|$(GNULIB_MBSLEN)|g' \
+             -e 's|@''GNULIB_MBSNLEN''@|$(GNULIB_MBSNLEN)|g' \
+             -e 's|@''GNULIB_MBSCHR''@|$(GNULIB_MBSCHR)|g' \
+             -e 's|@''GNULIB_MBSRCHR''@|$(GNULIB_MBSRCHR)|g' \
+             -e 's|@''GNULIB_MBSSTR''@|$(GNULIB_MBSSTR)|g' \
+             -e 's|@''GNULIB_MBSCASECMP''@|$(GNULIB_MBSCASECMP)|g' \
+             -e 's|@''GNULIB_MBSNCASECMP''@|$(GNULIB_MBSNCASECMP)|g' \
+             -e 's|@''GNULIB_MBSPCASECMP''@|$(GNULIB_MBSPCASECMP)|g' \
+             -e 's|@''GNULIB_MBSCASESTR''@|$(GNULIB_MBSCASESTR)|g' \
+             -e 's|@''GNULIB_MBSCSPN''@|$(GNULIB_MBSCSPN)|g' \
+             -e 's|@''GNULIB_MBSPBRK''@|$(GNULIB_MBSPBRK)|g' \
+             -e 's|@''GNULIB_MBSSPN''@|$(GNULIB_MBSSPN)|g' \
+             -e 's|@''GNULIB_MBSSEP''@|$(GNULIB_MBSSEP)|g' \
+             -e 's|@''GNULIB_MBSTOK_R''@|$(GNULIB_MBSTOK_R)|g' \
+             -e 's|@''GNULIB_MEMMEM''@|$(GNULIB_MEMMEM)|g' \
+             -e 's|@''GNULIB_MEMPCPY''@|$(GNULIB_MEMPCPY)|g' \
+             -e 's|@''GNULIB_MEMRCHR''@|$(GNULIB_MEMRCHR)|g' \
+             -e 's|@''GNULIB_STPCPY''@|$(GNULIB_STPCPY)|g' \
+             -e 's|@''GNULIB_STPNCPY''@|$(GNULIB_STPNCPY)|g' \
+             -e 's|@''GNULIB_STRCHRNUL''@|$(GNULIB_STRCHRNUL)|g' \
+             -e 's|@''GNULIB_STRDUP''@|$(GNULIB_STRDUP)|g' \
+             -e 's|@''GNULIB_STRNDUP''@|$(GNULIB_STRNDUP)|g' \
+             -e 's|@''GNULIB_STRNLEN''@|$(GNULIB_STRNLEN)|g' \
+             -e 's|@''GNULIB_STRPBRK''@|$(GNULIB_STRPBRK)|g' \
+             -e 's|@''GNULIB_STRSEP''@|$(GNULIB_STRSEP)|g' \
+             -e 's|@''GNULIB_STRCASESTR''@|$(GNULIB_STRCASESTR)|g' \
+             -e 's|@''GNULIB_STRTOK_R''@|$(GNULIB_STRTOK_R)|g' \
+             -e 's|@''HAVE_DECL_MEMMEM''@|$(HAVE_DECL_MEMMEM)|g' \
+             -e 's|@''HAVE_MEMPCPY''@|$(HAVE_MEMPCPY)|g' \
+             -e 's|@''HAVE_DECL_MEMRCHR''@|$(HAVE_DECL_MEMRCHR)|g' \
+             -e 's|@''HAVE_STPCPY''@|$(HAVE_STPCPY)|g' \
+             -e 's|@''HAVE_STPNCPY''@|$(HAVE_STPNCPY)|g' \
+             -e 's|@''HAVE_STRCASECMP''@|$(HAVE_STRCASECMP)|g' \
+             -e 's|@''HAVE_DECL_STRNCASECMP''@|$(HAVE_DECL_STRNCASECMP)|g' \
+             -e 's|@''HAVE_STRCHRNUL''@|$(HAVE_STRCHRNUL)|g' \
+             -e 's|@''HAVE_DECL_STRDUP''@|$(HAVE_DECL_STRDUP)|g' \
+             -e 's|@''HAVE_STRNDUP''@|$(HAVE_STRNDUP)|g' \
+             -e 's|@''HAVE_DECL_STRNDUP''@|$(HAVE_DECL_STRNDUP)|g' \
+             -e 's|@''HAVE_DECL_STRNLEN''@|$(HAVE_DECL_STRNLEN)|g' \
+             -e 's|@''HAVE_STRPBRK''@|$(HAVE_STRPBRK)|g' \
+             -e 's|@''HAVE_STRSEP''@|$(HAVE_STRSEP)|g' \
+             -e 's|@''HAVE_STRCASESTR''@|$(HAVE_STRCASESTR)|g' \
+             -e 's|@''HAVE_DECL_STRTOK_R''@|$(HAVE_DECL_STRTOK_R)|g' \
+             -e '/definition of GL_LINK_WARNING/r $(LINK_WARNING_H)' \
+             < $(srcdir)/string_.h; \
+       } > address@hidden
+       mv address@hidden $@
+MOSTLYCLEANFILES += string.h string.h-t
+
+EXTRA_DIST += string_.h
+
+## end   gnulib module string
+
 ## begin gnulib module strndup
 
-EXTRA_DIST += strndup.h
+
+EXTRA_DIST += strndup.c
+
+EXTRA_libcvs_a_SOURCES += strndup.c
 
 ## end   gnulib module strndup
 
 ## begin gnulib module strnlen
 
-EXTRA_DIST += strnlen.h
+
+EXTRA_DIST += strnlen.c
+
+EXTRA_libcvs_a_SOURCES += strnlen.c
 
 ## end   gnulib module strnlen
 
@@ -549,91 +1270,278 @@
 
 ## end   gnulib module strnlen1
 
-## begin gnulib module strstr
+## begin gnulib module strtoimax
+
+
+EXTRA_DIST += strtoimax.c
+
+EXTRA_libcvs_a_SOURCES += strtoimax.c
+
+## end   gnulib module strtoimax
+
+## begin gnulib module strtol
+
+
+EXTRA_DIST += strtol.c
+
+EXTRA_libcvs_a_SOURCES += strtol.c
+
+## end   gnulib module strtol
+
+## begin gnulib module strtoll
+
+
+EXTRA_DIST += strtoll.c
+
+EXTRA_libcvs_a_SOURCES += strtoll.c
+
+## end   gnulib module strtoll
+
+## begin gnulib module strtoul
+
+
+EXTRA_DIST += strtoul.c
+
+EXTRA_libcvs_a_SOURCES += strtoul.c
+
+## end   gnulib module strtoul
+
+## begin gnulib module strtoull
+
+
+EXTRA_DIST += strtoull.c
+
+EXTRA_libcvs_a_SOURCES += strtoull.c
+
+## end   gnulib module strtoull
 
-libcvs_a_SOURCES += strstr.h
+## begin gnulib module strtoumax
 
-## end   gnulib module strstr
+
+EXTRA_DIST += strtoumax.c
+
+EXTRA_libcvs_a_SOURCES += strtoumax.c
+
+## end   gnulib module strtoumax
 
 ## begin gnulib module sys_socket
 
 BUILT_SOURCES += $(SYS_SOCKET_H)
-EXTRA_DIST += socket_.h
 
 # We need the following in order to create <sys/socket.h> when the system
 # doesn't have one that works with the given compiler.
-sys/socket.h: socket_.h
-       test -d sys || mkdir sys
-       cp -f $(srcdir)/socket_.h address@hidden
+sys/socket.h: sys_socket_.h
+       @MKDIR_P@ sys
+       { echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */'; \
+         sed -e 's/@''INCLUDE_NEXT''@/$(INCLUDE_NEXT)/g' \
+             -e 's|@''NEXT_SYS_SOCKET_H''@|$(NEXT_SYS_SOCKET_H)|g' \
+             -e 's|@''HAVE_SYS_SOCKET_H''@|$(HAVE_SYS_SOCKET_H)|g' \
+             -e 's|@''HAVE_WINSOCK2_H''@|$(HAVE_WINSOCK2_H)|g' \
+             -e 's|@''HAVE_WS2TCPIP_H''@|$(HAVE_WS2TCPIP_H)|g' \
+             < $(srcdir)/sys_socket_.h; \
+       } > address@hidden
        mv -f address@hidden $@
 MOSTLYCLEANFILES += sys/socket.h sys/socket.h-t
 MOSTLYCLEANDIRS += sys
 
+EXTRA_DIST += sys_socket_.h
+
 ## end   gnulib module sys_socket
 
 ## begin gnulib module sys_stat
 
 BUILT_SOURCES += $(SYS_STAT_H)
-EXTRA_DIST += stat_.h
 
 # We need the following in order to create <sys/stat.h> when the system
 # has one that is incomplete.
-sys/stat.h: stat_.h
-       test -d sys || mkdir sys
+sys/stat.h: sys_stat_.h
+       @MKDIR_P@ sys
        rm -f address@hidden $@
-       sed -e 's|@''ABSOLUTE_SYS_STAT_H''@|$(ABSOLUTE_SYS_STAT_H)|g' \
-           < $(srcdir)/stat_.h > address@hidden
+       { echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */'; \
+         sed -e 's/@''INCLUDE_NEXT''@/$(INCLUDE_NEXT)/g' \
+             -e 's|@''NEXT_SYS_STAT_H''@|$(NEXT_SYS_STAT_H)|g' \
+             -e 's|@''HAVE_IO_H''@|$(HAVE_IO_H)|g' \
+             -e 's|@''HAVE_LSTAT''@|$(HAVE_LSTAT)|g' \
+             -e 's|@''HAVE_DECL_MKDIR''@|$(HAVE_DECL_MKDIR)|g' \
+             < $(srcdir)/sys_stat_.h; \
+       } > address@hidden
        mv address@hidden $@
 MOSTLYCLEANFILES += sys/stat.h sys/stat.h-t
 MOSTLYCLEANDIRS += sys
 
+EXTRA_DIST += sys_stat_.h
+
 ## end   gnulib module sys_stat
 
+## begin gnulib module sys_time
+
+BUILT_SOURCES += $(SYS_TIME_H)
+
+# We need the following in order to create <sys/time.h> when the system
+# doesn't have one that works with the given compiler.
+sys/time.h: sys_time_.h
+       @MKDIR_P@ sys
+       rm -f address@hidden $@
+       { echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */'; \
+         sed -e 's/@''HAVE_SYS_TIME_H''@/$(HAVE_SYS_TIME_H)/g' \
+             -e 's/@''INCLUDE_NEXT''@/$(INCLUDE_NEXT)/g' \
+             -e 's|@''NEXT_SYS_TIME_H''@|$(NEXT_SYS_TIME_H)|g' \
+             -e 's/@''REPLACE_GETTIMEOFDAY''@/$(REPLACE_GETTIMEOFDAY)/g' \
+             -e 's/@''HAVE_STRUCT_TIMEVAL''@/$(HAVE_STRUCT_TIMEVAL)/g' \
+             < $(srcdir)/sys_time_.h; \
+       } > address@hidden
+       mv address@hidden $@
+MOSTLYCLEANFILES += sys/time.h sys/time.h-t
+
+EXTRA_DIST += sys_time_.h
+
+## end   gnulib module sys_time
+
+## begin gnulib module tempname
+
+
+EXTRA_DIST += tempname.c tempname.h
+
+EXTRA_libcvs_a_SOURCES += tempname.c
+
+## end   gnulib module tempname
+
+## begin gnulib module time
+
+BUILT_SOURCES += time.h
+
+# We need the following in order to create <time.h> when the system
+# doesn't have one that works with the given compiler.
+time.h: time_.h
+       rm -f address@hidden $@
+       { echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */' && \
+         sed -e 's/@''INCLUDE_NEXT''@/$(INCLUDE_NEXT)/g' \
+             -e 's|@NEXT_TIME_H''@|$(NEXT_TIME_H)|g' \
+             -e 's|@REPLACE_LOCALTIME_R''@|$(REPLACE_LOCALTIME_R)|g' \
+             -e 's|@REPLACE_NANOSLEEP''@|$(REPLACE_NANOSLEEP)|g' \
+             -e 's|@REPLACE_STRPTIME''@|$(REPLACE_STRPTIME)|g' \
+             -e 's|@REPLACE_TIMEGM''@|$(REPLACE_TIMEGM)|g' \
+             -e 
's|@SYS_TIME_H_DEFINES_STRUCT_TIMESPEC''@|$(SYS_TIME_H_DEFINES_STRUCT_TIMESPEC)|g'
 \
+             -e 
's|@TIME_H_DEFINES_STRUCT_TIMESPEC''@|$(TIME_H_DEFINES_STRUCT_TIMESPEC)|g' \
+             < $(srcdir)/time_.h; \
+       } > address@hidden
+       mv address@hidden $@
+MOSTLYCLEANFILES += time.h time.h-t
+
+EXTRA_DIST += time_.h
+
+## end   gnulib module time
+
 ## begin gnulib module time_r
 
-EXTRA_DIST += time_r.h
+
+EXTRA_DIST += time_r.c
+
+EXTRA_libcvs_a_SOURCES += time_r.c
 
 ## end   gnulib module time_r
 
 ## begin gnulib module timespec
 
+
 EXTRA_DIST += timespec.h
 
 ## end   gnulib module timespec
 
 ## begin gnulib module unistd
 
-BUILT_SOURCES += $(UNISTD_H)
+BUILT_SOURCES += unistd.h
 
 # We need the following in order to create an empty placeholder for
 # <unistd.h> when the system doesn't have one.
-unistd.h:
-       echo '/* Empty placeholder for address@hidden  */' >$@
-MOSTLYCLEANFILES += unistd.h
+unistd.h: unistd_.h
+       rm -f address@hidden $@
+       { echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */'; \
+         sed -e 's|@''HAVE_UNISTD_H''@|$(HAVE_UNISTD_H)|g' \
+             -e 's/@''INCLUDE_NEXT''@/$(INCLUDE_NEXT)/g' \
+             -e 's|@''NEXT_UNISTD_H''@|$(NEXT_UNISTD_H)|g' \
+             -e 's|@''GNULIB_CHOWN''@|$(GNULIB_CHOWN)|g' \
+             -e 's|@''GNULIB_DUP2''@|$(GNULIB_DUP2)|g' \
+             -e 's|@''GNULIB_FCHDIR''@|$(GNULIB_FCHDIR)|g' \
+             -e 's|@''GNULIB_FTRUNCATE''@|$(GNULIB_FTRUNCATE)|g' \
+             -e 's|@''GNULIB_GETCWD''@|$(GNULIB_GETCWD)|g' \
+             -e 's|@''GNULIB_GETLOGIN_R''@|$(GNULIB_GETLOGIN_R)|g' \
+             -e 's|@''GNULIB_LCHOWN''@|$(GNULIB_LCHOWN)|g' \
+             -e 's|@''GNULIB_LSEEK''@|$(GNULIB_LSEEK)|g' \
+             -e 's|@''GNULIB_READLINK''@|$(GNULIB_READLINK)|g' \
+             -e 's|@''GNULIB_SLEEP''@|$(GNULIB_SLEEP)|g' \
+             -e 's|@''HAVE_DUP2''@|$(HAVE_DUP2)|g' \
+             -e 's|@''HAVE_FTRUNCATE''@|$(HAVE_FTRUNCATE)|g' \
+             -e 's|@''HAVE_READLINK''@|$(HAVE_READLINK)|g' \
+             -e 's|@''HAVE_SLEEP''@|$(HAVE_SLEEP)|g' \
+             -e 's|@''HAVE_DECL_GETLOGIN_R''@|$(HAVE_DECL_GETLOGIN_R)|g' \
+             -e 's|@''REPLACE_CHOWN''@|$(REPLACE_CHOWN)|g' \
+             -e 's|@''REPLACE_FCHDIR''@|$(REPLACE_FCHDIR)|g' \
+             -e 's|@''REPLACE_GETCWD''@|$(REPLACE_GETCWD)|g' \
+             -e 's|@''REPLACE_LCHOWN''@|$(REPLACE_LCHOWN)|g' \
+             -e 's|@''REPLACE_LSEEK''@|$(REPLACE_LSEEK)|g' \
+             < $(srcdir)/unistd_.h; \
+       } > address@hidden
+       mv address@hidden $@
+MOSTLYCLEANFILES += unistd.h unistd.h-t
+
+EXTRA_DIST += unistd_.h
 
 ## end   gnulib module unistd
 
 ## begin gnulib module unistd-safer
 
-EXTRA_DIST += unistd-safer.h unistd--.h
+
+EXTRA_DIST += dup-safer.c fd-safer.c pipe-safer.c unistd--.h unistd-safer.h
+
+EXTRA_libcvs_a_SOURCES += dup-safer.c fd-safer.c pipe-safer.c
 
 ## end   gnulib module unistd-safer
 
+## begin gnulib module unitypes
+
+
+EXTRA_DIST += unitypes.h
+
+## end   gnulib module unitypes
+
+## begin gnulib module uniwidth/base
+
+
+EXTRA_DIST += localcharset.h uniwidth.h
+
+## end   gnulib module uniwidth/base
+
+## begin gnulib module uniwidth/width
+
+libcvs_a_SOURCES += uniwidth/width.c
+
+EXTRA_DIST += uniwidth/cjk.h
+
+## end   gnulib module uniwidth/width
+
 ## begin gnulib module unlocked-io
 
+
 EXTRA_DIST += unlocked-io.h
 
 ## end   gnulib module unlocked-io
 
 ## begin gnulib module vasnprintf
 
-libcvs_a_SOURCES += printf-args.h printf-parse.h vasnprintf.h
+
+EXTRA_DIST += asnprintf.c float+.h printf-args.c printf-args.h printf-parse.c 
printf-parse.h vasnprintf.c vasnprintf.h
+
+EXTRA_libcvs_a_SOURCES += asnprintf.c printf-args.c printf-parse.c vasnprintf.c
 
 ## end   gnulib module vasnprintf
 
 ## begin gnulib module vasprintf
 
-libcvs_a_SOURCES += vasprintf.h
+
+EXTRA_DIST += asprintf.c vasprintf.c
+
+EXTRA_libcvs_a_SOURCES += asprintf.c vasprintf.c
 
 ## end   gnulib module vasprintf
 
@@ -643,15 +1551,69 @@
 
 ## end   gnulib module verify
 
+## begin gnulib module wchar
+
+BUILT_SOURCES += $(WCHAR_H)
+
+# We need the following in order to create <wchar.h> when the system
+# version does not work standalone.
+wchar.h: wchar_.h
+       rm -f address@hidden $@
+       { echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */'; \
+         sed -e 's/@''INCLUDE_NEXT''@/$(INCLUDE_NEXT)/g' \
+             -e 's|@''NEXT_WCHAR_H''@|$(NEXT_WCHAR_H)|g' \
+             -e 's/@''HAVE_WCHAR_H''@/$(HAVE_WCHAR_H)/g' \
+             -e 's|@''GNULIB_WCWIDTH''@|$(GNULIB_WCWIDTH)|g' \
+             -e 's|@''HAVE_DECL_WCWIDTH''@|$(HAVE_DECL_WCWIDTH)|g' \
+             -e 's|@''REPLACE_WCWIDTH''@|$(REPLACE_WCWIDTH)|g' \
+             -e '/definition of GL_LINK_WARNING/r $(LINK_WARNING_H)' \
+           < $(srcdir)/wchar_.h; \
+       } > address@hidden
+       mv address@hidden $@
+MOSTLYCLEANFILES += wchar.h wchar.h-t
+
+EXTRA_DIST += wchar_.h
+
+## end   gnulib module wchar
+
+## begin gnulib module wctype
+
+BUILT_SOURCES += $(WCTYPE_H)
+
+# We need the following in order to create <wctype.h> when the system
+# doesn't have one that works with the given compiler.
+wctype.h: wctype_.h
+       rm -f address@hidden $@
+       { 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|@''NEXT_WCTYPE_H''@|$(NEXT_WCTYPE_H)|g' \
+             -e 's/@''HAVE_ISWCNTRL''@/$(HAVE_ISWCNTRL)/g' \
+             -e 's/@''HAVE_WINT_T''@/$(HAVE_WINT_T)/g' \
+             < $(srcdir)/wctype_.h; \
+       } > address@hidden
+       mv address@hidden $@
+MOSTLYCLEANFILES += wctype.h wctype.h-t
+
+EXTRA_DIST += wctype_.h
+
+## end   gnulib module wctype
+
 ## begin gnulib module wcwidth
 
-libcvs_a_SOURCES += wcwidth.h
+
+EXTRA_DIST += wcwidth.c
+
+EXTRA_libcvs_a_SOURCES += wcwidth.c
 
 ## end   gnulib module wcwidth
 
 ## begin gnulib module xalloc
 
-EXTRA_DIST += xalloc.h
+
+EXTRA_DIST += xalloc.h xmalloc.c
+
+EXTRA_libcvs_a_SOURCES += xmalloc.c
 
 ## end   gnulib module xalloc
 
@@ -663,7 +1625,10 @@
 
 ## begin gnulib module xgetcwd
 
-EXTRA_DIST += xgetcwd.h
+
+EXTRA_DIST += xgetcwd.c xgetcwd.h
+
+EXTRA_libcvs_a_SOURCES += xgetcwd.c
 
 ## end   gnulib module xgetcwd
 
@@ -675,6 +1640,8 @@
 
 ## begin gnulib module xreadlink
 
+libcvs_a_SOURCES += xreadlink.c
+
 EXTRA_DIST += xreadlink.h
 
 ## end   gnulib module xreadlink
@@ -693,15 +1660,18 @@
 
 ## begin gnulib module yesno
 
-EXTRA_DIST += yesno.h
+
+EXTRA_DIST += yesno.c yesno.h
+
+EXTRA_libcvs_a_SOURCES += yesno.c
 
 ## end   gnulib module yesno
 
 
 mostlyclean-local: mostlyclean-generic
-       @test -z "$(MOSTLYCLEANDIRS)" || \
-         for dir in $(MOSTLYCLEANDIRS); do \
-           if test -d $$dir; then \
+       @for dir in '' $(MOSTLYCLEANDIRS); do \
+         if test -n "$$dir" && test -d $$dir; then \
              echo "rmdir $$dir"; rmdir $$dir; \
            fi; \
-         done
+       done; \
+       :

Index: Makefile.in
===================================================================
RCS file: /cvsroot/cvs/ccvs/lib/Makefile.in,v
retrieving revision 1.226
retrieving revision 1.227
diff -u -b -r1.226 -r1.227
--- Makefile.in 21 Aug 2007 22:37:43 -0000      1.226
+++ Makefile.in 22 Aug 2007 12:48:37 -0000      1.227
@@ -16,9 +16,10 @@
 
 # Makefile for library files used by GNU CVS.
 #
-# Copyright (C) 1986-2006 The Free Software Foundation, Inc.
+# Copyright (C) 1986-2007 The Free Software Foundation, Inc.
 #
-# Portions Copyright (C) 1998-2005 Derek Price, Ximbiot <http://ximbiot.com>,
+# Portions Copyright (C) 1998-2007 Derek Price,
+#                                 Ximbiot LLC <http://ximbiot.com>,
 #                                  and others.
 
 # This program is free software; you can redistribute it and/or modify
@@ -52,34 +53,17 @@
 check_PROGRAMS = getdate$(EXEEXT)
 subdir = lib
 DIST_COMMON = README $(srcdir)/Makefile.am $(srcdir)/Makefile.in \
-       ChangeLog __fpending.c alloca.c asnprintf.c asprintf.c \
-       atexit.c basename.c canon-host.c canonicalize.c chdir-long.c \
-       chown.c close-stream.c closeout.c creat-safer.c cycle-check.c \
-       dirname.c dup-safer.c dup2.c exitfail.c fchmodat.c \
-       fchown-stub.c fd-safer.c filenamecat.c fncase.c fnmatch.c \
-       fseeko.c ftello.c ftruncate.c gai_strerror.c getaddrinfo.c \
-       getcwd.c getdate.c getdelim.c gethostname.c getline.c \
-       getlogin_r.c getndelim2.c getopt.c getopt1.c getpass.c \
-       gettime.c gettimeofday.c glob.c inet_ntop.c lchown.c lstat.c \
-       malloc.c mbchar.c md5.c memchr.c memmove.c mempcpy.c memrchr.c \
-       mkdir.c mkdirat.c mkstemp.c mktime.c nanosleep.c open-safer.c \
-       openat-die.c openat.c pipe-safer.c printf-args.c \
-       printf-parse.c quotearg.c readlink.c realloc.c regex.c \
-       rename.c rpmatch.c save-cwd.c setenv.c snprintf.c strcasecmp.c \
-       strdup.c strerror.c strftime.c stripslash.c strncasecmp.c \
-       strndup.c strnlen.c strstr.c strtoimax.c strtol.c strtoll.c \
-       strtoul.c strtoull.c strtoumax.c sunos57-select.c tempname.c \
-       time_r.c unsetenv.c vasnprintf.c vasprintf.c waitpid.c \
-       xgetcwd.c xmalloc.c xreadlink.c yesno.c
+       ChangeLog alloca.c fncase.c fseeko.c ftello.c getdate.c \
+       sunos57-select.c waitpid.c
 ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
-am__aclocal_m4_deps = $(top_srcdir)/m4/absolute-header.m4 \
-       $(top_srcdir)/m4/acx_extract_cpp_defn.m4 \
+am__aclocal_m4_deps = $(top_srcdir)/m4/acx_extract_cpp_defn.m4 \
        $(top_srcdir)/m4/acx_with_external_zlib.m4 \
        $(top_srcdir)/m4/acx_with_gssapi.m4 $(top_srcdir)/m4/alloca.m4 \
-       $(top_srcdir)/m4/allocsa.m4 $(top_srcdir)/m4/arpa_inet_h.m4 \
+       $(top_srcdir)/m4/arpa_inet_h.m4 \
        $(top_srcdir)/m4/asx_version_compare.m4 \
        $(top_srcdir)/m4/atexit.m4 $(top_srcdir)/m4/base64.m4 \
        $(top_srcdir)/m4/bison.m4 $(top_srcdir)/m4/canon-host.m4 \
+       $(top_srcdir)/m4/canonicalize-lgpl.m4 \
        $(top_srcdir)/m4/canonicalize.m4 \
        $(top_srcdir)/m4/chdir-long.m4 $(top_srcdir)/m4/chown.m4 \
        $(top_srcdir)/m4/clock_time.m4 \
@@ -87,15 +71,16 @@
        $(top_srcdir)/m4/codeset.m4 \
        $(top_srcdir)/m4/cvs_func_printf_ptr.m4 \
        $(top_srcdir)/m4/cycle-check.m4 $(top_srcdir)/m4/d-ino.m4 \
-       $(top_srcdir)/m4/d-type.m4 $(top_srcdir)/m4/dirname.m4 \
-       $(top_srcdir)/m4/dos.m4 $(top_srcdir)/m4/double-slash-root.m4 \
-       $(top_srcdir)/m4/dup2.m4 $(top_srcdir)/m4/eealloc.m4 \
-       $(top_srcdir)/m4/eoverflow.m4 $(top_srcdir)/m4/error.m4 \
-       $(top_srcdir)/m4/exitfail.m4 $(top_srcdir)/m4/extensions.m4 \
+       $(top_srcdir)/m4/d-type.m4 $(top_srcdir)/m4/dirfd.m4 \
+       $(top_srcdir)/m4/dirname.m4 $(top_srcdir)/m4/dos.m4 \
+       $(top_srcdir)/m4/double-slash-root.m4 $(top_srcdir)/m4/dup2.m4 \
+       $(top_srcdir)/m4/eealloc.m4 $(top_srcdir)/m4/eoverflow.m4 \
+       $(top_srcdir)/m4/error.m4 $(top_srcdir)/m4/exitfail.m4 \
+       $(top_srcdir)/m4/extensions.m4 $(top_srcdir)/m4/fchdir.m4 \
        $(top_srcdir)/m4/fcntl-safer.m4 $(top_srcdir)/m4/fcntl_h.m4 \
-       $(top_srcdir)/m4/filenamecat.m4 $(top_srcdir)/m4/fnmatch.m4 \
-       $(top_srcdir)/m4/fpending.m4 $(top_srcdir)/m4/ftruncate.m4 \
-       $(top_srcdir)/m4/getaddrinfo.m4 \
+       $(top_srcdir)/m4/filenamecat.m4 $(top_srcdir)/m4/float_h.m4 \
+       $(top_srcdir)/m4/fnmatch.m4 $(top_srcdir)/m4/fpending.m4 \
+       $(top_srcdir)/m4/ftruncate.m4 $(top_srcdir)/m4/getaddrinfo.m4 \
        $(top_srcdir)/m4/getcwd-abort-bug.m4 \
        $(top_srcdir)/m4/getcwd-path-max.m4 $(top_srcdir)/m4/getcwd.m4 \
        $(top_srcdir)/m4/getdate.m4 $(top_srcdir)/m4/getdelim.m4 \
@@ -104,51 +89,56 @@
        $(top_srcdir)/m4/getnline.m4 $(top_srcdir)/m4/getopt.m4 \
        $(top_srcdir)/m4/getpagesize.m4 $(top_srcdir)/m4/getpass.m4 \
        $(top_srcdir)/m4/gettext.m4 $(top_srcdir)/m4/gettime.m4 \
-       $(top_srcdir)/m4/gettimeofday.m4 $(top_srcdir)/m4/glob.m4 \
+       $(top_srcdir)/m4/gettimeofday.m4 $(top_srcdir)/m4/glibc21.m4 \
+       $(top_srcdir)/m4/glob.m4 $(top_srcdir)/m4/gnulib-common.m4 \
        $(top_srcdir)/m4/gnulib-comp.m4 $(top_srcdir)/m4/iconv.m4 \
-       $(top_srcdir)/m4/inet_ntop.m4 $(top_srcdir)/m4/intmax_t.m4 \
-       $(top_srcdir)/m4/inttypes-pri.m4 $(top_srcdir)/m4/inttypes.m4 \
-       $(top_srcdir)/m4/inttypes_h.m4 $(top_srcdir)/m4/lchown.m4 \
-       $(top_srcdir)/m4/lib-ld.m4 $(top_srcdir)/m4/lib-link.m4 \
-       $(top_srcdir)/m4/lib-prefix.m4 $(top_srcdir)/m4/lock.m4 \
-       $(top_srcdir)/m4/longdouble.m4 $(top_srcdir)/m4/longlong.m4 \
-       $(top_srcdir)/m4/lstat.m4 $(top_srcdir)/m4/mbchar.m4 \
-       $(top_srcdir)/m4/mbiter.m4 $(top_srcdir)/m4/mbrtowc.m4 \
-       $(top_srcdir)/m4/mbstate_t.m4 $(top_srcdir)/m4/md5.m4 \
-       $(top_srcdir)/m4/memchr.m4 $(top_srcdir)/m4/memmove.m4 \
-       $(top_srcdir)/m4/mempcpy.m4 $(top_srcdir)/m4/memrchr.m4 \
-       $(top_srcdir)/m4/minmax.m4 $(top_srcdir)/m4/mkdir-slash.m4 \
-       $(top_srcdir)/m4/mkstemp.m4 $(top_srcdir)/m4/mktime.m4 \
-       $(top_srcdir)/m4/nanosleep.m4 $(top_srcdir)/m4/netinet_in_h.m4 \
-       $(top_srcdir)/m4/nls.m4 $(top_srcdir)/m4/openat.m4 \
-       $(top_srcdir)/m4/pathmax.m4 $(top_srcdir)/m4/po.m4 \
-       $(top_srcdir)/m4/progtest.m4 $(top_srcdir)/m4/quotearg.m4 \
-       $(top_srcdir)/m4/readlink.m4 $(top_srcdir)/m4/regex.m4 \
-       $(top_srcdir)/m4/rename.m4 $(top_srcdir)/m4/rpmatch.m4 \
-       $(top_srcdir)/m4/save-cwd.m4 $(top_srcdir)/m4/setenv.m4 \
-       $(top_srcdir)/m4/signed.m4 $(top_srcdir)/m4/size_max.m4 \
+       $(top_srcdir)/m4/include_next.m4 $(top_srcdir)/m4/inet_ntop.m4 \
+       $(top_srcdir)/m4/inline.m4 $(top_srcdir)/m4/intlmacosx.m4 \
+       $(top_srcdir)/m4/intmax_t.m4 $(top_srcdir)/m4/inttypes-pri.m4 \
+       $(top_srcdir)/m4/inttypes.m4 $(top_srcdir)/m4/inttypes_h.m4 \
+       $(top_srcdir)/m4/lchown.m4 $(top_srcdir)/m4/lib-ld.m4 \
+       $(top_srcdir)/m4/lib-link.m4 $(top_srcdir)/m4/lib-prefix.m4 \
+       $(top_srcdir)/m4/localcharset.m4 $(top_srcdir)/m4/longlong.m4 \
+       $(top_srcdir)/m4/lstat.m4 $(top_srcdir)/m4/malloca.m4 \
+       $(top_srcdir)/m4/mbchar.m4 $(top_srcdir)/m4/mbiter.m4 \
+       $(top_srcdir)/m4/mbrtowc.m4 $(top_srcdir)/m4/mbslen.m4 \
+       $(top_srcdir)/m4/mbsstr.m4 $(top_srcdir)/m4/mbstate_t.m4 \
+       $(top_srcdir)/m4/md5.m4 $(top_srcdir)/m4/memchr.m4 \
+       $(top_srcdir)/m4/memmove.m4 $(top_srcdir)/m4/mempcpy.m4 \
+       $(top_srcdir)/m4/memrchr.m4 $(top_srcdir)/m4/minmax.m4 \
+       $(top_srcdir)/m4/mkdir-slash.m4 $(top_srcdir)/m4/mkstemp.m4 \
+       $(top_srcdir)/m4/mktime.m4 $(top_srcdir)/m4/nanosleep.m4 \
+       $(top_srcdir)/m4/netinet_in_h.m4 $(top_srcdir)/m4/nls.m4 \
+       $(top_srcdir)/m4/openat.m4 $(top_srcdir)/m4/pathmax.m4 \
+       $(top_srcdir)/m4/po.m4 $(top_srcdir)/m4/progtest.m4 \
+       $(top_srcdir)/m4/quotearg.m4 $(top_srcdir)/m4/readlink.m4 \
+       $(top_srcdir)/m4/regex.m4 $(top_srcdir)/m4/rename.m4 \
+       $(top_srcdir)/m4/rpmatch.m4 $(top_srcdir)/m4/save-cwd.m4 \
+       $(top_srcdir)/m4/setenv.m4 $(top_srcdir)/m4/size_max.m4 \
        $(top_srcdir)/m4/snprintf.m4 $(top_srcdir)/m4/socklen.m4 \
        $(top_srcdir)/m4/sockpfaf.m4 $(top_srcdir)/m4/ssize_t.m4 \
-       $(top_srcdir)/m4/stat-macros.m4 $(top_srcdir)/m4/stdbool.m4 \
-       $(top_srcdir)/m4/stdint.m4 $(top_srcdir)/m4/stdint_h.m4 \
-       $(top_srcdir)/m4/strcase.m4 $(top_srcdir)/m4/strdup.m4 \
-       $(top_srcdir)/m4/strerror.m4 $(top_srcdir)/m4/strftime.m4 \
+       $(top_srcdir)/m4/stdbool.m4 $(top_srcdir)/m4/stdint.m4 \
+       $(top_srcdir)/m4/stdint_h.m4 $(top_srcdir)/m4/stdio_h.m4 \
+       $(top_srcdir)/m4/stdlib_h.m4 $(top_srcdir)/m4/strcase.m4 \
+       $(top_srcdir)/m4/strdup.m4 $(top_srcdir)/m4/strerror.m4 \
+       $(top_srcdir)/m4/strftime.m4 $(top_srcdir)/m4/string_h.m4 \
        $(top_srcdir)/m4/strndup.m4 $(top_srcdir)/m4/strnlen.m4 \
-       $(top_srcdir)/m4/strstr.m4 $(top_srcdir)/m4/strtoimax.m4 \
-       $(top_srcdir)/m4/strtol.m4 $(top_srcdir)/m4/strtoll.m4 \
-       $(top_srcdir)/m4/strtoul.m4 $(top_srcdir)/m4/strtoull.m4 \
-       $(top_srcdir)/m4/strtoumax.m4 \
+       $(top_srcdir)/m4/strtoimax.m4 $(top_srcdir)/m4/strtol.m4 \
+       $(top_srcdir)/m4/strtoll.m4 $(top_srcdir)/m4/strtoul.m4 \
+       $(top_srcdir)/m4/strtoull.m4 $(top_srcdir)/m4/strtoumax.m4 \
        $(top_srcdir)/m4/sunos57-select.m4 \
        $(top_srcdir)/m4/sys_socket_h.m4 \
-       $(top_srcdir)/m4/sys_stat_h.m4 $(top_srcdir)/m4/time_r.m4 \
-       $(top_srcdir)/m4/timespec.m4 $(top_srcdir)/m4/tm_gmtoff.m4 \
-       $(top_srcdir)/m4/tzset.m4 $(top_srcdir)/m4/ulonglong.m4 \
-       $(top_srcdir)/m4/unistd-safer.m4 $(top_srcdir)/m4/unistd_h.m4 \
-       $(top_srcdir)/m4/unlocked-io.m4 $(top_srcdir)/m4/vasnprintf.m4 \
-       $(top_srcdir)/m4/vasprintf.m4 $(top_srcdir)/m4/wchar_t.m4 \
-       $(top_srcdir)/m4/wcwidth.m4 $(top_srcdir)/m4/wint_t.m4 \
-       $(top_srcdir)/m4/xalloc.m4 $(top_srcdir)/m4/xgetcwd.m4 \
-       $(top_srcdir)/m4/xreadlink.m4 $(top_srcdir)/m4/xsize.m4 \
+       $(top_srcdir)/m4/sys_stat_h.m4 $(top_srcdir)/m4/sys_time_h.m4 \
+       $(top_srcdir)/m4/tempname.m4 $(top_srcdir)/m4/time_h.m4 \
+       $(top_srcdir)/m4/time_r.m4 $(top_srcdir)/m4/timespec.m4 \
+       $(top_srcdir)/m4/tm_gmtoff.m4 $(top_srcdir)/m4/tzset.m4 \
+       $(top_srcdir)/m4/ulonglong.m4 $(top_srcdir)/m4/unistd-safer.m4 \
+       $(top_srcdir)/m4/unistd_h.m4 $(top_srcdir)/m4/unlocked-io.m4 \
+       $(top_srcdir)/m4/vasnprintf.m4 $(top_srcdir)/m4/vasprintf.m4 \
+       $(top_srcdir)/m4/wchar.m4 $(top_srcdir)/m4/wchar_t.m4 \
+       $(top_srcdir)/m4/wctype.m4 $(top_srcdir)/m4/wcwidth.m4 \
+       $(top_srcdir)/m4/wint_t.m4 $(top_srcdir)/m4/xalloc.m4 \
+       $(top_srcdir)/m4/xgetcwd.m4 $(top_srcdir)/m4/xsize.m4 \
        $(top_srcdir)/m4/xstrndup.m4 $(top_srcdir)/m4/yesno.m4 \
        $(top_srcdir)/configure.in
 am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
@@ -160,16 +150,19 @@
 AR = ar
 ARFLAGS = cru
 libcvs_a_AR = $(AR) $(ARFLAGS)
-libcvs_a_DEPENDENCIES = @LIBOBJS@ @ALLOCA@
-am_libcvs_a_OBJECTS = sighandle.$(OBJEXT) allocsa.$(OBJEXT) \
-       base64.$(OBJEXT) getdate.$(OBJEXT) getnline.$(OBJEXT) \
-       strnlen1.$(OBJEXT) xalloc-die.$(OBJEXT) xgethostname.$(OBJEXT) \
-       xstrndup.$(OBJEXT)
+am__DEPENDENCIES_1 =
+am__dirstamp = $(am__leading_dot)dirstamp
+am_libcvs_a_OBJECTS = sighandle.$(OBJEXT) base64.$(OBJEXT) \
+       getdate.$(OBJEXT) getnline.$(OBJEXT) localcharset.$(OBJEXT) \
+       malloca.$(OBJEXT) mbchar.$(OBJEXT) mbslen.$(OBJEXT) \
+       mbsstr.$(OBJEXT) mreadlink-with-size.$(OBJEXT) \
+       openat-die.$(OBJEXT) strnlen1.$(OBJEXT) \
+       uniwidth/width.$(OBJEXT) xalloc-die.$(OBJEXT) \
+       xgethostname.$(OBJEXT) xreadlink.$(OBJEXT) xstrndup.$(OBJEXT)
 libcvs_a_OBJECTS = $(am_libcvs_a_OBJECTS)
 am_getdate_OBJECTS = getdate-error.$(OBJEXT) getdate-getdate.$(OBJEXT) \
        getdate-progname.$(OBJEXT)
 getdate_OBJECTS = $(am_getdate_OBJECTS)
-am__DEPENDENCIES_1 =
 getdate_DEPENDENCIES = $(noinst_LIBRARIES) $(am__DEPENDENCIES_1) \
        $(am__DEPENDENCIES_1)
 DEFAULT_INCLUDES = -I. -I$(top_builddir)@am__isrc@
@@ -182,15 +175,13 @@
 @address@hidden = test -f $@ ||
 YACCCOMPILE = $(YACC) $(YFLAGS) $(AM_YFLAGS)
 YLWRAP = $(top_srcdir)/build-aux/ylwrap
-SOURCES = $(libcvs_a_SOURCES) $(getdate_SOURCES)
-DIST_SOURCES = $(libcvs_a_SOURCES) $(getdate_SOURCES)
+SOURCES = $(libcvs_a_SOURCES) $(EXTRA_libcvs_a_SOURCES) \
+       $(getdate_SOURCES)
+DIST_SOURCES = $(libcvs_a_SOURCES) $(EXTRA_libcvs_a_SOURCES) \
+       $(getdate_SOURCES)
 ETAGS = etags
 CTAGS = ctags
 DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
-ABSOLUTE_FCNTL_H = @ABSOLUTE_FCNTL_H@
-ABSOLUTE_INTTYPES_H = @ABSOLUTE_INTTYPES_H@
-ABSOLUTE_STDINT_H = @ABSOLUTE_STDINT_H@
-ABSOLUTE_SYS_STAT_H = @ABSOLUTE_SYS_STAT_H@
 ACLOCAL = @ACLOCAL@
 ALLOCA = @ALLOCA@
 ALLOCA_H = @ALLOCA_H@
@@ -217,6 +208,7 @@
 DEFAULT_VERIFY_TEMPLATE = @DEFAULT_VERIFY_TEMPLATE@
 DEFS = @DEFS@
 DEPDIR = @DEPDIR@
+DIRENT_H = @DIRENT_H@
 ECHO_C = @ECHO_C@
 ECHO_N = @ECHO_N@
 ECHO_T = @ECHO_T@
@@ -225,28 +217,134 @@
 EOVERFLOW = @EOVERFLOW@
 EXEEXT = @EXEEXT@
 FCNTL_H = @FCNTL_H@
+FLOAT_H = @FLOAT_H@
 FNMATCH_H = @FNMATCH_H@
 GETOPT_H = @GETOPT_H@
+GLIBC21 = @GLIBC21@
 GLOB_H = @GLOB_H@
 GMSGFMT = @GMSGFMT@
 GMSGFMT_015 = @GMSGFMT_015@
+GNULIB_CHOWN = @GNULIB_CHOWN@
+GNULIB_DUP2 = @GNULIB_DUP2@
+GNULIB_FCHDIR = @GNULIB_FCHDIR@
+GNULIB_FFLUSH = @GNULIB_FFLUSH@
+GNULIB_FPRINTF_POSIX = @GNULIB_FPRINTF_POSIX@
+GNULIB_FSEEK = @GNULIB_FSEEK@
+GNULIB_FSEEKO = @GNULIB_FSEEKO@
+GNULIB_FTELL = @GNULIB_FTELL@
+GNULIB_FTELLO = @GNULIB_FTELLO@
+GNULIB_FTRUNCATE = @GNULIB_FTRUNCATE@
+GNULIB_GETCWD = @GNULIB_GETCWD@
+GNULIB_GETLOGIN_R = @GNULIB_GETLOGIN_R@
+GNULIB_GETSUBOPT = @GNULIB_GETSUBOPT@
+GNULIB_IMAXABS = @GNULIB_IMAXABS@
+GNULIB_IMAXDIV = @GNULIB_IMAXDIV@
+GNULIB_LCHOWN = @GNULIB_LCHOWN@
+GNULIB_LSEEK = @GNULIB_LSEEK@
+GNULIB_MBSCASECMP = @GNULIB_MBSCASECMP@
+GNULIB_MBSCASESTR = @GNULIB_MBSCASESTR@
+GNULIB_MBSCHR = @GNULIB_MBSCHR@
+GNULIB_MBSCSPN = @GNULIB_MBSCSPN@
+GNULIB_MBSLEN = @GNULIB_MBSLEN@
+GNULIB_MBSNCASECMP = @GNULIB_MBSNCASECMP@
+GNULIB_MBSNLEN = @GNULIB_MBSNLEN@
+GNULIB_MBSPBRK = @GNULIB_MBSPBRK@
+GNULIB_MBSPCASECMP = @GNULIB_MBSPCASECMP@
+GNULIB_MBSRCHR = @GNULIB_MBSRCHR@
+GNULIB_MBSSEP = @GNULIB_MBSSEP@
+GNULIB_MBSSPN = @GNULIB_MBSSPN@
+GNULIB_MBSSTR = @GNULIB_MBSSTR@
+GNULIB_MBSTOK_R = @GNULIB_MBSTOK_R@
+GNULIB_MEMMEM = @GNULIB_MEMMEM@
+GNULIB_MEMPCPY = @GNULIB_MEMPCPY@
+GNULIB_MEMRCHR = @GNULIB_MEMRCHR@
+GNULIB_MKDTEMP = @GNULIB_MKDTEMP@
+GNULIB_MKSTEMP = @GNULIB_MKSTEMP@
+GNULIB_PRINTF_POSIX = @GNULIB_PRINTF_POSIX@
+GNULIB_READLINK = @GNULIB_READLINK@
+GNULIB_SLEEP = @GNULIB_SLEEP@
+GNULIB_SNPRINTF = @GNULIB_SNPRINTF@
+GNULIB_SPRINTF_POSIX = @GNULIB_SPRINTF_POSIX@
+GNULIB_STPCPY = @GNULIB_STPCPY@
+GNULIB_STPNCPY = @GNULIB_STPNCPY@
+GNULIB_STRCASESTR = @GNULIB_STRCASESTR@
+GNULIB_STRCHRNUL = @GNULIB_STRCHRNUL@
+GNULIB_STRDUP = @GNULIB_STRDUP@
+GNULIB_STRNDUP = @GNULIB_STRNDUP@
+GNULIB_STRNLEN = @GNULIB_STRNLEN@
+GNULIB_STRPBRK = @GNULIB_STRPBRK@
+GNULIB_STRSEP = @GNULIB_STRSEP@
+GNULIB_STRTOIMAX = @GNULIB_STRTOIMAX@
+GNULIB_STRTOK_R = @GNULIB_STRTOK_R@
+GNULIB_STRTOUMAX = @GNULIB_STRTOUMAX@
+GNULIB_VASPRINTF = @GNULIB_VASPRINTF@
+GNULIB_VFPRINTF_POSIX = @GNULIB_VFPRINTF_POSIX@
+GNULIB_VPRINTF_POSIX = @GNULIB_VPRINTF_POSIX@
+GNULIB_VSNPRINTF = @GNULIB_VSNPRINTF@
+GNULIB_VSPRINTF_POSIX = @GNULIB_VSPRINTF_POSIX@
+GNULIB_WCWIDTH = @GNULIB_WCWIDTH@
 GPG = @GPG@
 GREP = @GREP@
+HAVE_DECL_GETLOGIN_R = @HAVE_DECL_GETLOGIN_R@
 HAVE_DECL_IMAXABS = @HAVE_DECL_IMAXABS@
 HAVE_DECL_IMAXDIV = @HAVE_DECL_IMAXDIV@
+HAVE_DECL_MEMMEM = @HAVE_DECL_MEMMEM@
+HAVE_DECL_MEMRCHR = @HAVE_DECL_MEMRCHR@
+HAVE_DECL_MKDIR = @HAVE_DECL_MKDIR@
+HAVE_DECL_SNPRINTF = @HAVE_DECL_SNPRINTF@
+HAVE_DECL_STRDUP = @HAVE_DECL_STRDUP@
+HAVE_DECL_STRNCASECMP = @HAVE_DECL_STRNCASECMP@
+HAVE_DECL_STRNDUP = @HAVE_DECL_STRNDUP@
+HAVE_DECL_STRNLEN = @HAVE_DECL_STRNLEN@
 HAVE_DECL_STRTOIMAX = @HAVE_DECL_STRTOIMAX@
+HAVE_DECL_STRTOK_R = @HAVE_DECL_STRTOK_R@
 HAVE_DECL_STRTOUMAX = @HAVE_DECL_STRTOUMAX@
+HAVE_DECL_VSNPRINTF = @HAVE_DECL_VSNPRINTF@
+HAVE_DECL_WCWIDTH = @HAVE_DECL_WCWIDTH@
+HAVE_DUP2 = @HAVE_DUP2@
+HAVE_FSEEKO = @HAVE_FSEEKO@
+HAVE_FTELLO = @HAVE_FTELLO@
+HAVE_FTRUNCATE = @HAVE_FTRUNCATE@
+HAVE_GETSUBOPT = @HAVE_GETSUBOPT@
 HAVE_INTTYPES_H = @HAVE_INTTYPES_H@
+HAVE_IO_H = @HAVE_IO_H@
+HAVE_ISWCNTRL = @HAVE_ISWCNTRL@
 HAVE_LONG_LONG_INT = @HAVE_LONG_LONG_INT@
+HAVE_LSTAT = @HAVE_LSTAT@
+HAVE_MEMPCPY = @HAVE_MEMPCPY@
+HAVE_MKDTEMP = @HAVE_MKDTEMP@
+HAVE_NETINET_IN_H = @HAVE_NETINET_IN_H@
+HAVE_READLINK = @HAVE_READLINK@
 HAVE_SIGNED_SIG_ATOMIC_T = @HAVE_SIGNED_SIG_ATOMIC_T@
 HAVE_SIGNED_WCHAR_T = @HAVE_SIGNED_WCHAR_T@
 HAVE_SIGNED_WINT_T = @HAVE_SIGNED_WINT_T@
+HAVE_SLEEP = @HAVE_SLEEP@
 HAVE_STDINT_H = @HAVE_STDINT_H@
+HAVE_STPCPY = @HAVE_STPCPY@
+HAVE_STPNCPY = @HAVE_STPNCPY@
+HAVE_STRCASECMP = @HAVE_STRCASECMP@
+HAVE_STRCASESTR = @HAVE_STRCASESTR@
+HAVE_STRCHRNUL = @HAVE_STRCHRNUL@
+HAVE_STRNDUP = @HAVE_STRNDUP@
+HAVE_STRPBRK = @HAVE_STRPBRK@
+HAVE_STRSEP = @HAVE_STRSEP@
+HAVE_STRUCT_TIMEVAL = @HAVE_STRUCT_TIMEVAL@
 HAVE_SYS_BITYPES_H = @HAVE_SYS_BITYPES_H@
+HAVE_SYS_CDEFS_H = @HAVE_SYS_CDEFS_H@
 HAVE_SYS_INTTYPES_H = @HAVE_SYS_INTTYPES_H@
+HAVE_SYS_SOCKET_H = @HAVE_SYS_SOCKET_H@
+HAVE_SYS_TIME_H = @HAVE_SYS_TIME_H@
 HAVE_SYS_TYPES_H = @HAVE_SYS_TYPES_H@
+HAVE_UNISTD_H = @HAVE_UNISTD_H@
+HAVE_UNSIGNED_LONG_LONG_INT = @HAVE_UNSIGNED_LONG_LONG_INT@
+HAVE_VASPRINTF = @HAVE_VASPRINTF@
 HAVE_WCHAR_H = @HAVE_WCHAR_H@
+HAVE_WCTYPE_H = @HAVE_WCTYPE_H@
+HAVE_WINSOCK2_H = @HAVE_WINSOCK2_H@
+HAVE_WINT_T = @HAVE_WINT_T@
+HAVE_WS2TCPIP_H = @HAVE_WS2TCPIP_H@
 HAVE__BOOL = @HAVE__BOOL@
+INCLUDE_NEXT = @INCLUDE_NEXT@
 INSTALL = @INSTALL@
 INSTALL_DATA = @INSTALL_DATA@
 INSTALL_PROGRAM = @INSTALL_PROGRAM@
@@ -261,20 +359,14 @@
 LIBCVS_LTLIBDEPS = @LIBCVS_LTLIBDEPS@
 LIBICONV = @LIBICONV@
 LIBINTL = @LIBINTL@
-LIBMULTITHREAD = @LIBMULTITHREAD@
 LIBOBJS = @LIBOBJS@
-LIBPTH = @LIBPTH@
 LIBS = @LIBS@
-LIBTHREAD = @LIBTHREAD@
 LIB_CLOCK_GETTIME = @LIB_CLOCK_GETTIME@
 LIB_NANOSLEEP = @LIB_NANOSLEEP@
 LN_S = @LN_S@
 LTLIBICONV = @LTLIBICONV@
 LTLIBINTL = @LTLIBINTL@
-LTLIBMULTITHREAD = @LTLIBMULTITHREAD@
 LTLIBOBJS = @LTLIBOBJS@
-LTLIBPTH = @LTLIBPTH@
-LTLIBTHREAD = @LTLIBTHREAD@
 MAINT = @MAINT@
 MAKEINFO = @MAKEINFO@
 MKDIR_P = @MKDIR_P@
@@ -283,6 +375,22 @@
 MSGFMT_015 = @MSGFMT_015@
 MSGMERGE = @MSGMERGE@
 NETINET_IN_H = @NETINET_IN_H@
+NEXT_DIRENT_H = @NEXT_DIRENT_H@
+NEXT_FCNTL_H = @NEXT_FCNTL_H@
+NEXT_FLOAT_H = @NEXT_FLOAT_H@
+NEXT_INTTYPES_H = @NEXT_INTTYPES_H@
+NEXT_NETINET_IN_H = @NEXT_NETINET_IN_H@
+NEXT_STDINT_H = @NEXT_STDINT_H@
+NEXT_STDIO_H = @NEXT_STDIO_H@
+NEXT_STDLIB_H = @NEXT_STDLIB_H@
+NEXT_STRING_H = @NEXT_STRING_H@
+NEXT_SYS_SOCKET_H = @NEXT_SYS_SOCKET_H@
+NEXT_SYS_STAT_H = @NEXT_SYS_STAT_H@
+NEXT_SYS_TIME_H = @NEXT_SYS_TIME_H@
+NEXT_TIME_H = @NEXT_TIME_H@
+NEXT_UNISTD_H = @NEXT_UNISTD_H@
+NEXT_WCHAR_H = @NEXT_WCHAR_H@
+NEXT_WCTYPE_H = @NEXT_WCTYPE_H@
 OBJEXT = @OBJEXT@
 PACKAGE = @PACKAGE@
 PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
@@ -300,6 +408,32 @@
 PS2PDF = @PS2PDF@
 PTRDIFF_T_SUFFIX = @PTRDIFF_T_SUFFIX@
 RANLIB = @RANLIB@
+REPLACE_CHOWN = @REPLACE_CHOWN@
+REPLACE_FCHDIR = @REPLACE_FCHDIR@
+REPLACE_FFLUSH = @REPLACE_FFLUSH@
+REPLACE_FPRINTF = @REPLACE_FPRINTF@
+REPLACE_FSEEK = @REPLACE_FSEEK@
+REPLACE_FSEEKO = @REPLACE_FSEEKO@
+REPLACE_FTELL = @REPLACE_FTELL@
+REPLACE_FTELLO = @REPLACE_FTELLO@
+REPLACE_GETCWD = @REPLACE_GETCWD@
+REPLACE_GETTIMEOFDAY = @REPLACE_GETTIMEOFDAY@
+REPLACE_LCHOWN = @REPLACE_LCHOWN@
+REPLACE_LOCALTIME_R = @REPLACE_LOCALTIME_R@
+REPLACE_LSEEK = @REPLACE_LSEEK@
+REPLACE_MKSTEMP = @REPLACE_MKSTEMP@
+REPLACE_NANOSLEEP = @REPLACE_NANOSLEEP@
+REPLACE_PRINTF = @REPLACE_PRINTF@
+REPLACE_SNPRINTF = @REPLACE_SNPRINTF@
+REPLACE_SPRINTF = @REPLACE_SPRINTF@
+REPLACE_STRPTIME = @REPLACE_STRPTIME@
+REPLACE_TIMEGM = @REPLACE_TIMEGM@
+REPLACE_VASPRINTF = @REPLACE_VASPRINTF@
+REPLACE_VFPRINTF = @REPLACE_VFPRINTF@
+REPLACE_VPRINTF = @REPLACE_VPRINTF@
+REPLACE_VSNPRINTF = @REPLACE_VSNPRINTF@
+REPLACE_VSPRINTF = @REPLACE_VSPRINTF@
+REPLACE_WCWIDTH = @REPLACE_WCWIDTH@
 ROFF = @ROFF@
 RSH_DFLT = @RSH_DFLT@
 SENDMAIL = @SENDMAIL@
@@ -312,11 +446,15 @@
 STRIP = @STRIP@
 SYS_SOCKET_H = @SYS_SOCKET_H@
 SYS_STAT_H = @SYS_STAT_H@
+SYS_TIME_H = @SYS_TIME_H@
+SYS_TIME_H_DEFINES_STRUCT_TIMESPEC = @SYS_TIME_H_DEFINES_STRUCT_TIMESPEC@
 TEXI2DVI = @TEXI2DVI@
-UNISTD_H = @UNISTD_H@
+TIME_H_DEFINES_STRUCT_TIMESPEC = @TIME_H_DEFINES_STRUCT_TIMESPEC@
 USE_NLS = @USE_NLS@
 VERSION = @VERSION@
+WCHAR_H = @WCHAR_H@
 WCHAR_T_SUFFIX = @WCHAR_T_SUFFIX@
+WCTYPE_H = @WCTYPE_H@
 WINT_T_SUFFIX = @WINT_T_SUFFIX@
 XGETTEXT = @XGETTEXT@
 XGETTEXT_015 = @XGETTEXT_015@
@@ -349,6 +487,8 @@
 docdir = @docdir@
 dvidir = @dvidir@
 exec_prefix = @exec_prefix@
+gl_LIBOBJS = @gl_LIBOBJS@
+gl_LTLIBOBJS = @gl_LTLIBOBJS@
 host = @host@
 host_alias = @host_alias@
 host_cpu = @host_cpu@
@@ -377,33 +517,42 @@
 top_builddir = @top_builddir@
 top_srcdir = @top_srcdir@
 with_default_rsh = @with_default_rsh@
-noinst_LIBRARIES = libcvs.a
+AUTOMAKE_OPTIONS = 1.5 gnits subdir-objects
+noinst_LIBRARIES = libcvs.a libcvs.a
 
 # Should look into unifying regular expression matching in CVS
 # with the diff library (perhaps to have the caller, CVS, do the
 # matching?)
 libcvs_a_SOURCES = sighandle.c system.h wait.h xselect.h xtime.h \
-       allocsa.h allocsa.c base64.h base64.c error.h exit.h \
-       getaddrinfo.h getdate.y getnline.h getnline.c gettext.h \
-       inet_ntop.h mbchar.h mbuiter.h md5.h minmax.h setenv.h \
-       size_max.h snprintf.h strcase.h strnlen1.h strnlen1.c strstr.h \
-       printf-args.h printf-parse.h vasnprintf.h vasprintf.h verify.h \
-       wcwidth.h xalloc-die.c xgethostname.h xgethostname.c xsize.h \
+       base64.h base64.c getdate.y getnline.h getnline.c gettext.h \
+       localcharset.h localcharset.c malloca.c mbchar.c mbslen.c \
+       mbsstr.c mbuiter.h minmax.h mreadlink-with-size.c openat-die.c \
+       size_max.h strnlen1.h strnlen1.c uniwidth/width.c verify.h \
+       xalloc-die.c xgethostname.h xgethostname.c xreadlink.c xsize.h \
        xstrndup.h xstrndup.c
-libcvs_a_LIBADD = @LIBOBJS@ @ALLOCA@
-BUILT_SOURCES = $(ALLOCA_H) $(ARPA_INET_H) $(FCNTL_H) $(FNMATCH_H) \
-       getdate.c $(GETOPT_H) $(GLOB_H) $(INTTYPES_H) $(NETINET_IN_H) \
-       $(STDBOOL_H) $(STDINT_H) $(SYS_SOCKET_H) $(SYS_STAT_H) \
-       $(UNISTD_H)
+libcvs_a_LIBADD = @LIBOBJS@ $(gl_LIBOBJS) @ALLOCA@
+libcvs_a_DEPENDENCIES = $(gl_LIBOBJS) @ALLOCA@
+BUILT_SOURCES = $(ALLOCA_H) $(ARPA_INET_H) configmake.h $(DIRENT_H) \
+       $(FCNTL_H) $(FLOAT_H) $(FNMATCH_H) getdate.c $(GETOPT_H) \
+       $(GLOB_H) $(INTTYPES_H) $(NETINET_IN_H) $(STDBOOL_H) \
+       $(STDINT_H) stdio.h stdlib.h string.h $(SYS_SOCKET_H) \
+       $(SYS_STAT_H) $(SYS_TIME_H) time.h unistd.h $(WCHAR_H) \
+       $(WCTYPE_H)
+CLEANFILES = configmake.h configmake.h-t charset.alias ref-add.sed \
+       ref-del.sed
 MOSTLYCLEANFILES = alloca.h alloca.h-t arpa/inet.h arpa/inet.h-t \
-       fcntl.h fcntl.h-t fnmatch.h fnmatch.h-t getdate-expected \
-       getdate-got getdate.diff getopt.h getopt.h-t glob.h glob.h-t \
-       inttypes.h inttypes.h-t netinet/in.h netinet/in.h-t stdbool.h \
-       stdbool.h-t stdint.h stdint.h-t sys/socket.h sys/socket.h-t \
-       sys/stat.h sys/stat.h-t unistd.h
+       dirent.h dirent.h-t fcntl.h fcntl.h-t float.h float.h-t \
+       fnmatch.h fnmatch.h-t getdate-expected getdate-got \
+       getdate.diff getopt.h getopt.h-t glob.h glob.h-t inttypes.h \
+       inttypes.h-t netinet/in.h netinet/in.h-t stdbool.h stdbool.h-t \
+       stdint.h stdint.h-t stdio.h stdio.h-t stdlib.h stdlib.h-t \
+       string.h string.h-t sys/socket.h sys/socket.h-t sys/stat.h \
+       sys/stat.h-t sys/time.h sys/time.h-t time.h time.h-t unistd.h \
+       unistd.h-t wchar.h wchar.h-t wctype.h wctype.h-t
 MOSTLYCLEANDIRS = arpa netinet sys sys
 DISTCLEANFILES = getdate.log
 MAINTAINERCLEANFILES = getdate.c
+SUFFIXES = .sed .sin
 
 # This is for those projects which use "gettextize --intl" to put a source-code
 # copy of libintl into their package. In such projects, every Makefile.am needs
@@ -416,21 +565,71 @@
 AM_CPPFLAGS = -I$(top_builddir)/intl
 TESTS = test-getdate.sh
 EXTRA_DIST = .cvsignore ChangeLog.fsf Makefile.gnulib build_lib.com \
-       libcvs.dep libcvs.dsp libcvs.mak test-getdate.sh alloca_.h \
-       allocsa.valgrind canon-host.h canonicalize.h chdir-long.h \
-       close-stream.h closeout.h cycle-check.h dev-ino.h dirname.h \
-       exitfail.h fcntl_.h fcntl-safer.h fcntl--.h filenamecat.h \
-       fnmatch_.h fnmatch_loop.c __fpending.h getcwd.h getdate.c \
-       getdate.h getdelim.h getline.h getlogin_r.h getndelim2.h \
-       getndelim2.c getopt_.h getopt_int.h getpagesize.h getpass.h \
-       glob_.h glob-libc.h intprops.h inttypes_.h lchown.h lstat.h \
-       mempcpy.h memrchr.h mkstemp.h at-func.c openat.h openat-priv.h \
-       pathmax.h quotearg.h regcomp.c regex.h regex_internal.c \
-       regex_internal.h regexec.c same-inode.h save-cwd.h \
-       stat-macros.h stdbool_.h stdint_.h strdup.h strftime.h \
-       strndup.h strnlen.h socket_.h stat_.h time_r.h timespec.h \
-       unistd-safer.h unistd--.h unlocked-io.h xalloc.h xgetcwd.h \
-       xreadlink.h yesno.h
+       libcvs.dep libcvs.dsp libcvs.mak test-getdate.sh alloca.c \
+       alloca_.h atexit.c canon-host.c canon-host.h canonicalize.c \
+       canonicalize.h pathmax.h canonicalize-lgpl.c canonicalize.h \
+       chdir-long.c chdir-long.h chown.c fchown-stub.c close-stream.c \
+       close-stream.h closeout.c closeout.h md5.c md5.h cycle-check.c \
+       cycle-check.h dev-ino.h dirfd.c dirfd.h basename.c dirname.c \
+       dirname.h stripslash.c dup2.c error.h exitfail.c exitfail.h \
+       dirent_.h fchdir.c fcntl_.h creat-safer.c fcntl--.h \
+       fcntl-safer.h open-safer.c filenamecat.c filenamecat.h \
+       float_.h fnmatch.c fnmatch_.h fnmatch_loop.c __fpending.c \
+       __fpending.h ftruncate.c gai_strerror.c getaddrinfo.c \
+       getaddrinfo.h getcwd.c getdate.c getdate.h getdelim.c \
+       getdelim.h gethostname.c getline.c getline.h getlogin_r.c \
+       getndelim2.c getndelim2.h getopt.c getopt1.c getopt_.h \
+       getopt_int.h getpagesize.h getpass.c getpass.h \
+       $(top_srcdir)/build-aux/config.rpath gettime.c gettimeofday.c \
+       glob-libc.h glob.c glob_.h \
+       $(top_srcdir)/build-aux/config.rpath inet_ntop.c inet_ntop.h \
+       intprops.h inttypes_.h lchown.c \
+       $(top_srcdir)/build-aux/link-warning.h config.charset \
+       ref-add.sin ref-del.sin lstat.c lstat.h malloc.c malloca.h \
+       malloca.valgrind mbchar.h memchr.c memmove.c mempcpy.c \
+       memrchr.c mkdir.c mkstemp.c mktime.c mreadlink.h nanosleep.c \
+       netinet_in_.h at-func.c fchmodat.c fchownat.c fstatat.c \
+       mkdirat.c openat-priv.h openat-proc.c openat.c openat.h \
+       pathmax.h quotearg.c quotearg.h readlink.c realloc.c regcomp.c \
+       regex.c regex.h regex_internal.c regex_internal.h regexec.c \
+       rename.c rpmatch.c same-inode.h save-cwd.c save-cwd.h setenv.c \
+       setenv.h unsetenv.c snprintf.c stat-macros.h stdbool_.h \
+       stdint_.h stdio_.h stdlib_.h strcasecmp.c strncasecmp.c \
+       strdup.c streq.h strerror.c strftime.c strftime.h string_.h \
+       strndup.c strnlen.c strtoimax.c strtol.c strtoll.c strtoul.c \
+       strtoull.c strtoumax.c sys_socket_.h sys_stat_.h sys_time_.h \
+       tempname.c tempname.h time_.h time_r.c timespec.h unistd_.h \
+       dup-safer.c fd-safer.c pipe-safer.c unistd--.h unistd-safer.h \
+       unitypes.h localcharset.h uniwidth.h uniwidth/cjk.h \
+       unlocked-io.h asnprintf.c float+.h printf-args.c printf-args.h \
+       printf-parse.c printf-parse.h vasnprintf.c vasnprintf.h \
+       asprintf.c vasprintf.c wchar_.h wctype_.h wcwidth.c xalloc.h \
+       xmalloc.c xgetcwd.c xgetcwd.h xreadlink.h yesno.c yesno.h
+EXTRA_libcvs_a_SOURCES = alloca.c atexit.c canon-host.c canonicalize.c \
+       canonicalize-lgpl.c chdir-long.c chown.c fchown-stub.c \
+       close-stream.c closeout.c md5.c cycle-check.c dirfd.c \
+       basename.c dirname.c stripslash.c dup2.c exitfail.c fchdir.c \
+       creat-safer.c open-safer.c filenamecat.c fnmatch.c \
+       fnmatch_loop.c __fpending.c ftruncate.c gai_strerror.c \
+       getaddrinfo.c getcwd.c getdelim.c gethostname.c getline.c \
+       getlogin_r.c getndelim2.c getopt.c getopt1.c getpass.c \
+       gettime.c gettimeofday.c glob.c inet_ntop.c lchown.c lstat.c \
+       malloc.c memchr.c memmove.c mempcpy.c memrchr.c mkdir.c \
+       mkstemp.c mktime.c nanosleep.c at-func.c fchmodat.c fchownat.c \
+       fstatat.c mkdirat.c openat-proc.c openat.c quotearg.c \
+       readlink.c realloc.c regcomp.c regex.c regex_internal.c \
+       regexec.c rename.c rpmatch.c save-cwd.c setenv.c unsetenv.c \
+       snprintf.c strcasecmp.c strncasecmp.c strdup.c strerror.c \
+       strftime.c strndup.c strnlen.c strtoimax.c strtol.c strtoll.c \
+       strtoul.c strtoull.c strtoumax.c tempname.c time_r.c \
+       dup-safer.c fd-safer.c pipe-safer.c asnprintf.c printf-args.c \
+       printf-parse.c vasnprintf.c asprintf.c vasprintf.c wcwidth.c \
+       xmalloc.c xgetcwd.c yesno.c
+
+# Use this preprocessor expression to decide whether #include_next works.
+# Do not rely on a 'configure'-time test for this, since the expression
+# might appear in an installed header, which is used by some other compiler.
+HAVE_INCLUDE_NEXT = (__GNUC__ || 60000000 <= __DECC_VER)
 getdate_SOURCES = error.c getdate.y progname.c
 getdate_CPPFLAGS = -DTEST
 getdate_LDADD = \
@@ -438,11 +637,14 @@
        $(LIB_CLOCK_GETTIME) \
        $(LIBINTL)
 
+LINK_WARNING_H = $(top_srcdir)/build-aux/link-warning.h
+charset_alias = $(DESTDIR)$(libdir)/charset.alias
+charset_tmp = $(DESTDIR)$(libdir)/charset.tmp
 all: $(BUILT_SOURCES)
        $(MAKE) $(AM_MAKEFLAGS) all-am
 
 .SUFFIXES:
-.SUFFIXES: .c .o .obj .y
+.SUFFIXES: .sed .sin .c .o .obj .y
 $(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am  
$(am__configure_deps)
        @for dep in $?; do \
          case '$(am__configure_deps)' in \
@@ -452,9 +654,9 @@
              exit 1;; \
          esac; \
        done; \
-       echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu  lib/Makefile'; \
+       echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnits  lib/Makefile'; \
        cd $(top_srcdir) && \
-         $(AUTOMAKE) --gnu  lib/Makefile
+         $(AUTOMAKE) --gnits  lib/Makefile
 .PRECIOUS: Makefile
 Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
        @case '$?' in \
@@ -475,6 +677,14 @@
 
 clean-noinstLIBRARIES:
        -test -z "$(noinst_LIBRARIES)" || rm -f $(noinst_LIBRARIES)
+uniwidth/$(am__dirstamp):
+       @$(MKDIR_P) uniwidth
+       @: > uniwidth/$(am__dirstamp)
+uniwidth/$(DEPDIR)/$(am__dirstamp):
+       @$(MKDIR_P) uniwidth/$(DEPDIR)
+       @: > uniwidth/$(DEPDIR)/$(am__dirstamp)
+uniwidth/width.$(OBJEXT): uniwidth/$(am__dirstamp) \
+       uniwidth/$(DEPDIR)/$(am__dirstamp)
 libcvs.a: $(libcvs_a_OBJECTS) $(libcvs_a_DEPENDENCIES) 
        -rm -f libcvs.a
        $(libcvs_a_AR) libcvs.a $(libcvs_a_OBJECTS) $(libcvs_a_LIBADD)
@@ -488,133 +698,153 @@
 
 mostlyclean-compile:
        -rm -f *.$(OBJEXT)
+       -rm -f uniwidth/width.$(OBJEXT)
 
 distclean-compile:
        -rm -f *.tab.c
 
address@hidden@@am__include@ @address@hidden(DEPDIR)/address@hidden@
 @AMDEP_TRUE@@am__include@ @address@hidden(DEPDIR)/address@hidden@
address@hidden@@am__include@ @address@hidden(DEPDIR)/address@hidden@
address@hidden@@am__include@ @address@hidden(DEPDIR)/address@hidden@
address@hidden@@am__include@ @address@hidden(DEPDIR)/address@hidden@
address@hidden@@am__include@ @address@hidden(DEPDIR)/address@hidden@
address@hidden@@am__include@ @address@hidden(DEPDIR)/address@hidden@
address@hidden@@am__include@ @address@hidden(DEPDIR)/address@hidden@
address@hidden@@am__include@ @address@hidden(DEPDIR)/address@hidden@
address@hidden@@am__include@ @address@hidden(DEPDIR)/address@hidden@
address@hidden@@am__include@ @address@hidden(DEPDIR)/address@hidden@
address@hidden@@am__include@ @address@hidden(DEPDIR)/address@hidden@
address@hidden@@am__include@ @address@hidden(DEPDIR)/address@hidden@
address@hidden@@am__include@ @address@hidden(DEPDIR)/address@hidden@
address@hidden@@am__include@ @address@hidden(DEPDIR)/address@hidden@
address@hidden@@am__include@ @address@hidden(DEPDIR)/address@hidden@
address@hidden@@am__include@ @address@hidden(DEPDIR)/address@hidden@
address@hidden@@am__include@ @address@hidden(DEPDIR)/address@hidden@
address@hidden@@am__include@ @address@hidden(DEPDIR)/address@hidden@
address@hidden@@am__include@ @address@hidden(DEPDIR)/address@hidden@
address@hidden@@am__include@ @address@hidden(DEPDIR)/address@hidden@
address@hidden@@am__include@ @address@hidden(DEPDIR)/address@hidden@
 @AMDEP_TRUE@@am__include@ @address@hidden(DEPDIR)/address@hidden@
address@hidden@@am__include@ @address@hidden(DEPDIR)/address@hidden@
 @AMDEP_TRUE@@am__include@ @address@hidden(DEPDIR)/address@hidden@
 @AMDEP_TRUE@@am__include@ @address@hidden(DEPDIR)/address@hidden@
address@hidden@@am__include@ @address@hidden(DEPDIR)/address@hidden@
address@hidden@@am__include@ @address@hidden(DEPDIR)/address@hidden@
address@hidden@@am__include@ @address@hidden(DEPDIR)/address@hidden@
address@hidden@@am__include@ @address@hidden(DEPDIR)/address@hidden@
address@hidden@@am__include@ @address@hidden(DEPDIR)/address@hidden@
address@hidden@@am__include@ @address@hidden(DEPDIR)/address@hidden@
address@hidden@@am__include@ @address@hidden(DEPDIR)/address@hidden@
address@hidden@@am__include@ @address@hidden(DEPDIR)/address@hidden@
address@hidden@@am__include@ @address@hidden(DEPDIR)/address@hidden@
address@hidden@@am__include@ @address@hidden(DEPDIR)/address@hidden@
address@hidden@@am__include@ @address@hidden(DEPDIR)/address@hidden@
address@hidden@@am__include@ @address@hidden(DEPDIR)/address@hidden@
address@hidden@@am__include@ @address@hidden(DEPDIR)/address@hidden@
address@hidden@@am__include@ @address@hidden(DEPDIR)/address@hidden@
address@hidden@@am__include@ @address@hidden(DEPDIR)/address@hidden@
address@hidden@@am__include@ @address@hidden(DEPDIR)/address@hidden@
address@hidden@@am__include@ @address@hidden(DEPDIR)/address@hidden@
address@hidden@@am__include@ @address@hidden(DEPDIR)/address@hidden@
address@hidden@@am__include@ @address@hidden(DEPDIR)/address@hidden@
address@hidden@@am__include@ @address@hidden(DEPDIR)/address@hidden@
address@hidden@@am__include@ @address@hidden(DEPDIR)/address@hidden@
address@hidden@@am__include@ @address@hidden(DEPDIR)/address@hidden@
address@hidden@@am__include@ @address@hidden(DEPDIR)/address@hidden@
address@hidden@@am__include@ @address@hidden(DEPDIR)/address@hidden@
address@hidden@@am__include@ @address@hidden(DEPDIR)/address@hidden@
address@hidden@@am__include@ @address@hidden(DEPDIR)/address@hidden@
address@hidden@@am__include@ @address@hidden(DEPDIR)/address@hidden@
address@hidden@@am__include@ @address@hidden(DEPDIR)/address@hidden@
address@hidden@@am__include@ @address@hidden(DEPDIR)/address@hidden@
address@hidden@@am__include@ @address@hidden(DEPDIR)/address@hidden@
address@hidden@@am__include@ @address@hidden(DEPDIR)/address@hidden@
address@hidden@@am__include@ @address@hidden(DEPDIR)/address@hidden@
address@hidden@@am__include@ @address@hidden(DEPDIR)/address@hidden@
address@hidden@@am__include@ @address@hidden(DEPDIR)/address@hidden@
address@hidden@@am__include@ @address@hidden(DEPDIR)/address@hidden@
address@hidden@@am__include@ @address@hidden(DEPDIR)/address@hidden@
address@hidden@@am__include@ @address@hidden(DEPDIR)/address@hidden@
address@hidden@@am__include@ @address@hidden(DEPDIR)/address@hidden@
address@hidden@@am__include@ @address@hidden(DEPDIR)/address@hidden@
address@hidden@@am__include@ @address@hidden(DEPDIR)/address@hidden@
address@hidden@@am__include@ @address@hidden(DEPDIR)/address@hidden@
address@hidden@@am__include@ @address@hidden(DEPDIR)/address@hidden@
address@hidden@@am__include@ @address@hidden(DEPDIR)/address@hidden@
address@hidden@@am__include@ @address@hidden(DEPDIR)/address@hidden@
address@hidden@@am__include@ @address@hidden(DEPDIR)/address@hidden@
address@hidden@@am__include@ @address@hidden(DEPDIR)/address@hidden@
address@hidden@@am__include@ @address@hidden(DEPDIR)/address@hidden@
address@hidden@@am__include@ @address@hidden(DEPDIR)/address@hidden@
address@hidden@@am__include@ @address@hidden(DEPDIR)/address@hidden@
address@hidden@@am__include@ @address@hidden(DEPDIR)/address@hidden@
address@hidden@@am__include@ @address@hidden(DEPDIR)/address@hidden@
address@hidden@@am__include@ @address@hidden(DEPDIR)/address@hidden@
address@hidden@@am__include@ @address@hidden(DEPDIR)/address@hidden@
address@hidden@@am__include@ @address@hidden(DEPDIR)/address@hidden@
address@hidden@@am__include@ @address@hidden(DEPDIR)/address@hidden@
address@hidden@@am__include@ @address@hidden(DEPDIR)/address@hidden@
address@hidden@@am__include@ @address@hidden(DEPDIR)/address@hidden@
address@hidden@@am__include@ @address@hidden(DEPDIR)/address@hidden@
address@hidden@@am__include@ @address@hidden(DEPDIR)/address@hidden@
address@hidden@@am__include@ @address@hidden(DEPDIR)/address@hidden@
 @AMDEP_TRUE@@am__include@ @address@hidden(DEPDIR)/address@hidden@
address@hidden@@am__include@ @address@hidden(DEPDIR)/address@hidden@
address@hidden@@am__include@ @address@hidden(DEPDIR)/address@hidden@
address@hidden@@am__include@ @address@hidden(DEPDIR)/address@hidden@
address@hidden@@am__include@ @address@hidden(DEPDIR)/address@hidden@
address@hidden@@am__include@ @address@hidden(DEPDIR)/address@hidden@
 @AMDEP_TRUE@@am__include@ @address@hidden(DEPDIR)/address@hidden@
address@hidden@@am__include@ @address@hidden(DEPDIR)/address@hidden@
address@hidden@@am__include@ @address@hidden(DEPDIR)/address@hidden@
address@hidden@@am__include@ @address@hidden(DEPDIR)/address@hidden@
address@hidden@@am__include@ @address@hidden(DEPDIR)/address@hidden@
address@hidden@@am__include@ @address@hidden/$(DEPDIR)/address@hidden@
address@hidden@@am__include@ @address@hidden/$(DEPDIR)/address@hidden@
address@hidden@@am__include@ @address@hidden/$(DEPDIR)/address@hidden@
address@hidden@@am__include@ @address@hidden/$(DEPDIR)/address@hidden@
address@hidden@@am__include@ @address@hidden/$(DEPDIR)/address@hidden@
address@hidden@@am__include@ @address@hidden/$(DEPDIR)/address@hidden@
address@hidden@@am__include@ @address@hidden/$(DEPDIR)/address@hidden@
 @AMDEP_TRUE@@am__include@ @address@hidden/$(DEPDIR)/address@hidden@
address@hidden@@am__include@ @address@hidden/$(DEPDIR)/address@hidden@
address@hidden@@am__include@ @address@hidden/$(DEPDIR)/address@hidden@
address@hidden@@am__include@ @address@hidden/$(DEPDIR)/address@hidden@
address@hidden@@am__include@ @address@hidden/$(DEPDIR)/address@hidden@
address@hidden@@am__include@ @address@hidden/$(DEPDIR)/address@hidden@
address@hidden@@am__include@ @address@hidden/$(DEPDIR)/address@hidden@
address@hidden@@am__include@ @address@hidden/$(DEPDIR)/address@hidden@
address@hidden@@am__include@ @address@hidden/$(DEPDIR)/address@hidden@
address@hidden@@am__include@ @address@hidden/$(DEPDIR)/address@hidden@
address@hidden@@am__include@ @address@hidden/$(DEPDIR)/address@hidden@
address@hidden@@am__include@ @address@hidden/$(DEPDIR)/address@hidden@
address@hidden@@am__include@ @address@hidden/$(DEPDIR)/address@hidden@
address@hidden@@am__include@ @address@hidden/$(DEPDIR)/address@hidden@
address@hidden@@am__include@ @address@hidden/$(DEPDIR)/address@hidden@
address@hidden@@am__include@ @address@hidden/$(DEPDIR)/address@hidden@
address@hidden@@am__include@ @address@hidden/$(DEPDIR)/address@hidden@
address@hidden@@am__include@ @address@hidden/$(DEPDIR)/address@hidden@
address@hidden@@am__include@ @address@hidden/$(DEPDIR)/address@hidden@
address@hidden@@am__include@ @address@hidden/$(DEPDIR)/address@hidden@
address@hidden@@am__include@ @address@hidden/$(DEPDIR)/address@hidden@
address@hidden@@am__include@ @address@hidden/$(DEPDIR)/address@hidden@
address@hidden@@am__include@ @address@hidden/$(DEPDIR)/address@hidden@
address@hidden@@am__include@ @address@hidden/$(DEPDIR)/address@hidden@
address@hidden@@am__include@ @address@hidden/$(DEPDIR)/address@hidden@
address@hidden@@am__include@ @address@hidden/$(DEPDIR)/address@hidden@
address@hidden@@am__include@ @address@hidden/$(DEPDIR)/address@hidden@
address@hidden@@am__include@ @address@hidden/$(DEPDIR)/address@hidden@
address@hidden@@am__include@ @address@hidden/$(DEPDIR)/address@hidden@
 @AMDEP_TRUE@@am__include@ @address@hidden/$(DEPDIR)/address@hidden@
 @AMDEP_TRUE@@am__include@ @address@hidden/$(DEPDIR)/address@hidden@
 @AMDEP_TRUE@@am__include@ @address@hidden/$(DEPDIR)/address@hidden@
 @AMDEP_TRUE@@am__include@ @address@hidden/$(DEPDIR)/address@hidden@
address@hidden@@am__include@ @address@hidden/$(DEPDIR)/address@hidden@
address@hidden@@am__include@ @address@hidden/$(DEPDIR)/address@hidden@
address@hidden@@am__include@ @address@hidden/$(DEPDIR)/address@hidden@
address@hidden@@am__include@ @address@hidden/$(DEPDIR)/address@hidden@
address@hidden@@am__include@ @address@hidden/$(DEPDIR)/address@hidden@
 @AMDEP_TRUE@@am__include@ @address@hidden/$(DEPDIR)/address@hidden@
address@hidden@@am__include@ @address@hidden/$(DEPDIR)/address@hidden@
address@hidden@@am__include@ @address@hidden/$(DEPDIR)/address@hidden@
address@hidden@@am__include@ @address@hidden/$(DEPDIR)/address@hidden@
address@hidden@@am__include@ @address@hidden/$(DEPDIR)/address@hidden@
address@hidden@@am__include@ @address@hidden/$(DEPDIR)/address@hidden@
address@hidden@@am__include@ @address@hidden/$(DEPDIR)/address@hidden@
address@hidden@@am__include@ @address@hidden/$(DEPDIR)/address@hidden@
address@hidden@@am__include@ @address@hidden/$(DEPDIR)/address@hidden@
address@hidden@@am__include@ @address@hidden/$(DEPDIR)/address@hidden@
address@hidden@@am__include@ @address@hidden/$(DEPDIR)/address@hidden@
address@hidden@@am__include@ @address@hidden/$(DEPDIR)/address@hidden@
address@hidden@@am__include@ @address@hidden/$(DEPDIR)/address@hidden@
address@hidden@@am__include@ @address@hidden/$(DEPDIR)/address@hidden@
address@hidden@@am__include@ @address@hidden/$(DEPDIR)/address@hidden@
address@hidden@@am__include@ @address@hidden/$(DEPDIR)/address@hidden@
address@hidden@@am__include@ @address@hidden/$(DEPDIR)/address@hidden@
address@hidden@@am__include@ @address@hidden/$(DEPDIR)/address@hidden@
address@hidden@@am__include@ @address@hidden/$(DEPDIR)/address@hidden@
address@hidden@@am__include@ @address@hidden/$(DEPDIR)/address@hidden@
address@hidden@@am__include@ @address@hidden/$(DEPDIR)/address@hidden@
address@hidden@@am__include@ @address@hidden/$(DEPDIR)/address@hidden@
address@hidden@@am__include@ @address@hidden/$(DEPDIR)/address@hidden@
address@hidden@@am__include@ @address@hidden/$(DEPDIR)/address@hidden@
address@hidden@@am__include@ @address@hidden/$(DEPDIR)/address@hidden@
address@hidden@@am__include@ @address@hidden/$(DEPDIR)/address@hidden@
address@hidden@@am__include@ @address@hidden/$(DEPDIR)/address@hidden@
address@hidden@@am__include@ @address@hidden/$(DEPDIR)/address@hidden@
address@hidden@@am__include@ @address@hidden/$(DEPDIR)/address@hidden@
address@hidden@@am__include@ @address@hidden/$(DEPDIR)/address@hidden@
address@hidden@@am__include@ @address@hidden/$(DEPDIR)/address@hidden@
address@hidden@@am__include@ @address@hidden/$(DEPDIR)/address@hidden@
address@hidden@@am__include@ @address@hidden/$(DEPDIR)/address@hidden@
address@hidden@@am__include@ @address@hidden/$(DEPDIR)/address@hidden@
address@hidden@@am__include@ @address@hidden/$(DEPDIR)/address@hidden@
address@hidden@@am__include@ @address@hidden/$(DEPDIR)/address@hidden@
address@hidden@@am__include@ @address@hidden/$(DEPDIR)/address@hidden@
address@hidden@@am__include@ @address@hidden/$(DEPDIR)/address@hidden@
address@hidden@@am__include@ @address@hidden/$(DEPDIR)/address@hidden@
address@hidden@@am__include@ @address@hidden/$(DEPDIR)/address@hidden@
address@hidden@@am__include@ @address@hidden/$(DEPDIR)/address@hidden@
address@hidden@@am__include@ @address@hidden/$(DEPDIR)/address@hidden@
address@hidden@@am__include@ @address@hidden/$(DEPDIR)/address@hidden@
address@hidden@@am__include@ @address@hidden/$(DEPDIR)/address@hidden@
address@hidden@@am__include@ @address@hidden/$(DEPDIR)/address@hidden@
 @AMDEP_TRUE@@am__include@ @address@hidden/$(DEPDIR)/address@hidden@
address@hidden@@am__include@ @address@hidden/$(DEPDIR)/address@hidden@
address@hidden@@am__include@ @address@hidden/$(DEPDIR)/address@hidden@
address@hidden@@am__include@ @address@hidden/$(DEPDIR)/address@hidden@
address@hidden@@am__include@ @address@hidden/$(DEPDIR)/address@hidden@
address@hidden@@am__include@ @address@hidden/$(DEPDIR)/address@hidden@
address@hidden@@am__include@ @address@hidden/$(DEPDIR)/address@hidden@
address@hidden@@am__include@ @address@hidden/$(DEPDIR)/address@hidden@
address@hidden@@am__include@ @address@hidden/$(DEPDIR)/address@hidden@
address@hidden@@am__include@ @address@hidden/$(DEPDIR)/address@hidden@
 @AMDEP_TRUE@@am__include@ @address@hidden/$(DEPDIR)/address@hidden@
address@hidden@@am__include@ @address@hidden/$(DEPDIR)/address@hidden@
address@hidden@@am__include@ @address@hidden/$(DEPDIR)/address@hidden@
address@hidden@@am__include@ @address@hidden/$(DEPDIR)/address@hidden@
address@hidden@@am__include@ @address@hidden/$(DEPDIR)/address@hidden@
address@hidden@@am__include@ @address@hidden/$(DEPDIR)/address@hidden@
address@hidden@@am__include@ @address@hidden/$(DEPDIR)/address@hidden@
address@hidden@@am__include@ @address@hidden/$(DEPDIR)/address@hidden@
address@hidden@@am__include@ @address@hidden/$(DEPDIR)/address@hidden@
address@hidden@@am__include@ @address@hidden/$(DEPDIR)/address@hidden@
address@hidden@@am__include@ @address@hidden/$(DEPDIR)/address@hidden@
address@hidden@@am__include@ @address@hidden/$(DEPDIR)/address@hidden@
address@hidden@@am__include@ @address@hidden/$(DEPDIR)/address@hidden@
 @AMDEP_TRUE@@am__include@ @address@hidden/$(DEPDIR)/address@hidden@
address@hidden@@am__include@ @address@hidden/$(DEPDIR)/address@hidden@
 @AMDEP_TRUE@@am__include@ @address@hidden/$(DEPDIR)/address@hidden@
address@hidden@@am__include@ @address@hidden/$(DEPDIR)/address@hidden@
address@hidden@@am__include@ @address@hidden/$(DEPDIR)/address@hidden@
 @AMDEP_TRUE@@am__include@ @address@hidden/$(DEPDIR)/address@hidden@
address@hidden@@am__include@ @address@hidden/$(DEPDIR)/address@hidden@
address@hidden@@am__include@ @address@hidden/$(DEPDIR)/address@hidden@
 
 .c.o:
address@hidden@ $(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
address@hidden@ mv -f $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
address@hidden@ depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.o$$||'`;\
address@hidden@ $(COMPILE) -MT $@ -MD -MP -MF $$depbase.Tpo -c -o $@ $< &&\
address@hidden@ mv -f $$depbase.Tpo $$depbase.Po
 @AMDEP_TRUE@@am__fastdepCC_FALSE@      source='$<' object='$@' libtool=no 
@AMDEPBACKSLASH@
 @AMDEP_TRUE@@am__fastdepCC_FALSE@      DEPDIR=$(DEPDIR) $(CCDEPMODE) 
$(depcomp) @AMDEPBACKSLASH@
address@hidden@ $(COMPILE) -c $<
address@hidden@ $(COMPILE) -c -o $@ $<
 
 .c.obj:
address@hidden@ $(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ 
`$(CYGPATH_W) '$<'`
address@hidden@ mv -f $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
address@hidden@ depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.obj$$||'`;\
address@hidden@ $(COMPILE) -MT $@ -MD -MP -MF $$depbase.Tpo -c -o $@ 
`$(CYGPATH_W) '$<'` &&\
address@hidden@ mv -f $$depbase.Tpo $$depbase.Po
 @AMDEP_TRUE@@am__fastdepCC_FALSE@      source='$<' object='$@' libtool=no 
@AMDEPBACKSLASH@
 @AMDEP_TRUE@@am__fastdepCC_FALSE@      DEPDIR=$(DEPDIR) $(CCDEPMODE) 
$(depcomp) @AMDEPBACKSLASH@
address@hidden@ $(COMPILE) -c `$(CYGPATH_W) '$<'`
address@hidden@ $(COMPILE) -c -o $@ `$(CYGPATH_W) '$<'`
 
 getdate-error.o: error.c
 @am__fastdepCC_TRUE@   $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) 
$(getdate_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT getdate-error.o -MD 
-MP -MF $(DEPDIR)/getdate-error.Tpo -c -o getdate-error.o `test -f 'error.c' || 
echo '$(srcdir)/'`error.c
@@ -813,7 +1043,7 @@
        $(MAKE) $(AM_MAKEFLAGS) check-TESTS
 check: $(BUILT_SOURCES)
        $(MAKE) $(AM_MAKEFLAGS) check-am
-all-am: Makefile $(LIBRARIES)
+all-am: Makefile $(LIBRARIES) all-local
 installdirs:
 install: $(BUILT_SOURCES)
        $(MAKE) $(AM_MAKEFLAGS) install-am
@@ -834,9 +1064,12 @@
        -test -z "$(MOSTLYCLEANFILES)" || rm -f $(MOSTLYCLEANFILES)
 
 clean-generic:
+       -test -z "$(CLEANFILES)" || rm -f $(CLEANFILES)
 
 distclean-generic:
        -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
+       -rm -f uniwidth/$(DEPDIR)/$(am__dirstamp)
+       -rm -f uniwidth/$(am__dirstamp)
        -test -z "$(DISTCLEANFILES)" || rm -f $(DISTCLEANFILES)
 
 maintainer-clean-generic:
@@ -851,7 +1084,7 @@
        mostlyclean-am
 
 distclean: distclean-am
-       -rm -rf $(DEPDIR) ./$(DEPDIR)
+       -rm -rf $(DEPDIR) ./$(DEPDIR) uniwidth/$(DEPDIR)
        -rm -f Makefile
 distclean-am: clean-am distclean-compile distclean-generic \
        distclean-local distclean-tags
@@ -870,7 +1103,7 @@
 
 install-dvi: install-dvi-am
 
-install-exec-am:
+install-exec-am: install-exec-local
 
 install-html: install-html-am
 
@@ -885,7 +1118,7 @@
 installcheck-am:
 
 maintainer-clean: maintainer-clean-am
-       -rm -rf $(DEPDIR) ./$(DEPDIR)
+       -rm -rf $(DEPDIR) ./$(DEPDIR) uniwidth/$(DEPDIR)
        -rm -f Makefile
 maintainer-clean-am: distclean-am maintainer-clean-generic
 
@@ -902,109 +1135,258 @@
 
 ps-am:
 
-uninstall-am:
+uninstall-am: uninstall-local
 
 .MAKE: install-am install-strip
 
-.PHONY: CTAGS GTAGS all all-am check check-TESTS check-am clean \
-       clean-checkPROGRAMS clean-generic clean-noinstLIBRARIES ctags \
-       distclean distclean-compile distclean-generic distclean-local \
-       distclean-tags distdir dvi dvi-am html html-am info info-am \
-       install install-am install-data install-data-am install-dvi \
-       install-dvi-am install-exec install-exec-am install-html \
-       install-html-am install-info install-info-am install-man \
-       install-pdf install-pdf-am install-ps install-ps-am \
-       install-strip installcheck installcheck-am installdirs \
-       maintainer-clean maintainer-clean-generic mostlyclean \
-       mostlyclean-compile mostlyclean-generic mostlyclean-local pdf \
-       pdf-am ps ps-am tags uninstall uninstall-am
+.PHONY: CTAGS GTAGS all all-am all-local check check-TESTS check-am \
+       clean clean-checkPROGRAMS clean-generic clean-noinstLIBRARIES \
+       ctags distclean distclean-compile distclean-generic \
+       distclean-local distclean-tags distdir dvi dvi-am html html-am \
+       info info-am install install-am install-data install-data-am \
+       install-dvi install-dvi-am install-exec install-exec-am \
+       install-exec-local install-html install-html-am install-info \
+       install-info-am install-man install-pdf install-pdf-am \
+       install-ps install-ps-am install-strip installcheck \
+       installcheck-am installdirs maintainer-clean \
+       maintainer-clean-generic mostlyclean mostlyclean-compile \
+       mostlyclean-generic mostlyclean-local pdf pdf-am ps ps-am tags \
+       uninstall uninstall-am uninstall-local
 
 
 # We need the following in order to create <alloca.h> when the system
 # doesn't have one that works with the given compiler.
 alloca.h: alloca_.h
-       cp -f $(srcdir)/alloca_.h address@hidden
+       { echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */'; \
+         cat $(srcdir)/alloca_.h; \
+       } > address@hidden
        mv -f address@hidden $@
 
 # We need the following in order to create <arpa/inet.h> when the system
 # doesn't have one.
 arpa/inet.h:
-       test -d arpa || mkdir arpa
+       @MKDIR_P@ arpa
+       rm -f address@hidden $@
+       { echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */'; \
+         echo '#include <sys/socket.h>'; \
+       } > address@hidden
+       mv address@hidden $@
+
+# Retrieve values of the variables through 'configure' followed by
+# 'make', not directly through 'configure', so that a user who
+# sets some of these variables consistently on the 'make' command
+# line gets correct results.
+#
+# One advantage of this approach, compared to the classical
+# approach of adding -DLIBDIR=\"$(libdir)\" etc. to AM_CPPFLAGS,
+# is that it protects against the use of undefined variables.
+# If, say, $(libdir) is not set in the Makefile, LIBDIR is not
+# defined by this module, and code using LIBDIR gives a
+# compilation error.
+#
+# Another advantage is that 'make' output is shorter.
+#
+# Listed in the same order as the GNU makefile conventions.
+# The Automake-defined pkg* macros are appended, in the order
+# listed in the Automake 1.10a+ documentation.
+configmake.h: Makefile
+       rm -f address@hidden $@
+       { echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */'; \
+         echo '#define PREFIX "$(prefix)"'; \
+         echo '#define EXEC_PREFIX "$(exec_prefix)"'; \
+         echo '#define BINDIR "$(bindir)"'; \
+         echo '#define SBINDIR "$(sbindir)"'; \
+         echo '#define LIBEXECDIR "$(libexecdir)"'; \
+         echo '#define DATAROOTDIR "$(datarootdir)"'; \
+         echo '#define DATADIR "$(datadir)"'; \
+         echo '#define SYSCONFDIR "$(sysconfdir)"'; \
+         echo '#define SHAREDSTATEDIR "$(sharedstatedir)"'; \
+         echo '#define LOCALSTATEDIR "$(localstatedir)"'; \
+         echo '#define INCLUDEDIR "$(includedir)"'; \
+         echo '#define OLDINCLUDEDIR "$(oldincludedir)"'; \
+         echo '#define DOCDIR "$(docdir)"'; \
+         echo '#define INFODIR "$(infodir)"'; \
+         echo '#define HTMLDIR "$(htmldir)"'; \
+         echo '#define DVIDIR "$(dvidir)"'; \
+         echo '#define PDFDIR "$(pdfdir)"'; \
+         echo '#define PSDIR "$(psdir)"'; \
+         echo '#define LIBDIR "$(libdir)"'; \
+         echo '#define LISPDIR "$(lispdir)"'; \
+         echo '#define LOCALEDIR "$(localedir)"'; \
+         echo '#define MANDIR "$(mandir)"'; \
+         echo '#define MANEXT "$(manext)"'; \
+         echo '#define PKGDATADIR "$(pkgdatadir)"'; \
+         echo '#define PKGINCLUDEDIR "$(pkgincludedir)"'; \
+         echo '#define PKGLIBDIR "$(pkglibdir)"'; \
+         echo '#define PKGLIBEXECDIR "$(pkglibexecdir)"'; \
+       } | sed '/""/d' > address@hidden
+       mv address@hidden $@
+
+# We need the following in order to create <dirent.h> when the system
+# doesn't have one that works with the given compiler.
+dirent.h: dirent_.h
        rm -f address@hidden $@
-       echo '#include <sys/socket.h>' >address@hidden
+       { echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */'; \
+         sed -e 's|@''INCLUDE_NEXT''@|$(INCLUDE_NEXT)|g' \
+             -e 's|@''NEXT_DIRENT_H''@|$(NEXT_DIRENT_H)|g' \
+             -e 's|@''REPLACE_FCHDIR''@|$(REPLACE_FCHDIR)|g' \
+             < $(srcdir)/dirent_.h; \
+       } > address@hidden
        mv address@hidden $@
 
 # We need the following in order to create <fcntl.h> when the system
 # doesn't have one that works with the given compiler.
 fcntl.h: fcntl_.h
        rm -f address@hidden $@
-       sed -e 's|@''ABSOLUTE_FCNTL_H''@|$(ABSOLUTE_FCNTL_H)|g' \
-           < $(srcdir)/fcntl_.h > address@hidden
+       { echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */'; \
+         sed -e 's/@''INCLUDE_NEXT''@/$(INCLUDE_NEXT)/g' \
+             -e 's|@''NEXT_FCNTL_H''@|$(NEXT_FCNTL_H)|g' \
+             < $(srcdir)/fcntl_.h; \
+       } > address@hidden
+       mv address@hidden $@
+
+# We need the following in order to create <float.h> when the system
+# doesn't have one that works with the given compiler.
+float.h: float_.h
+       rm -f address@hidden $@
+       { echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */' && \
+         sed -e 's/@''INCLUDE_NEXT''@/$(INCLUDE_NEXT)/g' \
+             -e 's|@''NEXT_FLOAT_H''@|$(NEXT_FLOAT_H)|g' \
+             < $(srcdir)/float_.h; \
+       } > address@hidden
        mv address@hidden $@
 
 # We need the following in order to create <fnmatch.h> when the system
 # doesn't have one that supports the required API.
 fnmatch.h: fnmatch_.h
        cp -f $(srcdir)/fnmatch_.h address@hidden
+       { echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */'; \
+         cat $(srcdir)/fnmatch_.h; \
+       } > address@hidden
        mv -f address@hidden $@
 
 # We need the following in order to create <getopt.h> when the system
 # doesn't have one that works with the given compiler.
 getopt.h: getopt_.h
-       cp -f $(srcdir)/getopt_.h address@hidden
+       { echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */'; \
+         cat $(srcdir)/getopt_.h; \
+       } > address@hidden
        mv -f address@hidden $@
 
 # We need the following in order to create <glob.h> when the system
 # doesn't have one that works with the given compiler.
 all-local $(libcvs_a_OBJECTS): $(GLOB_H)
 glob.h: glob_.h
-       cp -f $(srcdir)/glob_.h address@hidden
+       { echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */'; \
+         sed -e 's|@''HAVE_SYS_CDEFS_H''@|$(HAVE_SYS_CDEFS_H)|g' \
+             < $(srcdir)/glob_.h; \
+       } > address@hidden
        mv -f address@hidden $@
 
 # We need the following in order to create <inttypes.h> when the system
 # doesn't have one that works with the given compiler.
 inttypes.h: inttypes_.h
        rm -f address@hidden $@
+       { echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */'; \
        sed -e 's/@''HAVE_INTTYPES_H''@/$(HAVE_INTTYPES_H)/g' \
-           -e 's|@''ABSOLUTE_INTTYPES_H''@|$(ABSOLUTE_INTTYPES_H)|g' \
+             -e 's/@''INCLUDE_NEXT''@/$(INCLUDE_NEXT)/g' \
+             -e 's|@''NEXT_INTTYPES_H''@|$(NEXT_INTTYPES_H)|g' \
            -e 's/@''PRI_MACROS_BROKEN''@/$(PRI_MACROS_BROKEN)/g' \
            -e 's/@''HAVE_LONG_LONG_INT''@/$(HAVE_LONG_LONG_INT)/g' \
+             -e 
's/@''HAVE_UNSIGNED_LONG_LONG_INT''@/$(HAVE_UNSIGNED_LONG_LONG_INT)/g' \
            -e 's/@''PRIPTR_PREFIX''@/$(PRIPTR_PREFIX)/g' \
+             -e 's/@''GNULIB_IMAXABS''@/$(GNULIB_IMAXABS)/g' \
+             -e 's/@''GNULIB_IMAXDIV''@/$(GNULIB_IMAXDIV)/g' \
+             -e 's/@''GNULIB_STRTOIMAX''@/$(GNULIB_STRTOIMAX)/g' \
+             -e 's/@''GNULIB_STRTOUMAX''@/$(GNULIB_STRTOUMAX)/g' \
            -e 's/@''HAVE_DECL_IMAXABS''@/$(HAVE_DECL_IMAXABS)/g' \
            -e 's/@''HAVE_DECL_IMAXDIV''@/$(HAVE_DECL_IMAXDIV)/g' \
            -e 's/@''HAVE_DECL_STRTOIMAX''@/$(HAVE_DECL_STRTOIMAX)/g' \
            -e 's/@''HAVE_DECL_STRTOUMAX''@/$(HAVE_DECL_STRTOUMAX)/g' \
-           < $(srcdir)/inttypes_.h > address@hidden
+             -e '/definition of GL_LINK_WARNING/r $(LINK_WARNING_H)' \
+             < $(srcdir)/inttypes_.h; \
+       } > address@hidden
        mv address@hidden $@
 
+# We need the following in order to install a simple file in $(libdir)
+# which is shared with other installed packages. We use a list of referencing
+# packages so that "make uninstall" will remove the file if and only if it
+# is not used by another installed package.
+# On systems with glibc-2.1 or newer, the file is redundant, therefore we
+# avoid installing it.
+
+all-local: charset.alias ref-add.sed ref-del.sed
+install-exec-local: all-local
+       test $(GLIBC21) != no || $(mkinstalldirs) $(DESTDIR)$(libdir)
+       if test -f $(charset_alias); then \
+         sed -f ref-add.sed $(charset_alias) > $(charset_tmp) ; \
+         $(INSTALL_DATA) $(charset_tmp) $(charset_alias) ; \
+         rm -f $(charset_tmp) ; \
+       else \
+         if test $(GLIBC21) = no; then \
+           sed -f ref-add.sed charset.alias > $(charset_tmp) ; \
+           $(INSTALL_DATA) $(charset_tmp) $(charset_alias) ; \
+           rm -f $(charset_tmp) ; \
+         fi ; \
+       fi
+
+uninstall-local: all-local
+       if test -f $(charset_alias); then \
+         sed -f ref-del.sed $(charset_alias) > $(charset_tmp); \
+         if grep '^# Packages using this file: $$' $(charset_tmp) \
+             > /dev/null; then \
+           rm -f $(charset_alias); \
+         else \
+           $(INSTALL_DATA) $(charset_tmp) $(charset_alias); \
+         fi; \
+         rm -f $(charset_tmp); \
+       fi
+
+charset.alias: config.charset
+       rm -f t-$@ $@
+       $(SHELL) $(srcdir)/config.charset '$(host)' > t-$@
+       mv t-$@ $@
+.sin.sed:
+       rm -f t-$@ $@
+       sed -e '/^#/d' -e 's/@''PACKAGE''@/$(PACKAGE)/g' $< > t-$@
+       mv t-$@ $@
+
 # We need the following in order to create <netinet/in.h> when the system
 # doesn't have one.
 netinet/in.h:
-       test -d netinet || mkdir netinet
+       @MKDIR_P@ netinet
        rm -f address@hidden $@
-       echo '#include <sys/socket.h>' >address@hidden
+       { echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */'; \
+         sed -e 's/@''INCLUDE_NEXT''@/$(INCLUDE_NEXT)/g' \
+             -e 's|@''NEXT_NETINET_IN_H''@|$(NEXT_NETINET_IN_H)|g' \
+             -e 's|@''HAVE_NETINET_IN_H''@|$(HAVE_NETINET_IN_H)|g' \
+             < $(srcdir)/netinet_in_.h; \
+       } > address@hidden
        mv address@hidden $@
 
 # We need the following in order to create <stdbool.h> when the system
 # doesn't have one that works.
 stdbool.h: stdbool_.h
        rm -f address@hidden $@
-       sed -e 's/@''HAVE__BOOL''@/$(HAVE__BOOL)/g' \
-               < $(srcdir)/stdbool_.h > address@hidden
+       { echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */'; \
+         sed -e 's/@''HAVE__BOOL''@/$(HAVE__BOOL)/g' < $(srcdir)/stdbool_.h; \
+       } > address@hidden
        mv address@hidden $@
 
 # We need the following in order to create <stdint.h> when the system
 # doesn't have one that works with the given compiler.
 stdint.h: stdint_.h
        rm -f address@hidden $@
-       sed -e 's/@''HAVE_WCHAR_H''@/$(HAVE_WCHAR_H)/g' \
-           -e 's/@''HAVE_STDINT_H''@/$(HAVE_STDINT_H)/g' \
-           -e 's|@''ABSOLUTE_STDINT_H''@|$(ABSOLUTE_STDINT_H)|g' \
+       { echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */'; \
+         sed -e 's/@''HAVE_STDINT_H''@/$(HAVE_STDINT_H)/g' \
+             -e 's/@''INCLUDE_NEXT''@/$(INCLUDE_NEXT)/g' \
+             -e 's|@''NEXT_STDINT_H''@|$(NEXT_STDINT_H)|g' \
            -e 's/@''HAVE_SYS_TYPES_H''@/$(HAVE_SYS_TYPES_H)/g' \
            -e 's/@''HAVE_INTTYPES_H''@/$(HAVE_INTTYPES_H)/g' \
            -e 's/@''HAVE_SYS_INTTYPES_H''@/$(HAVE_SYS_INTTYPES_H)/g' \
            -e 's/@''HAVE_SYS_BITYPES_H''@/$(HAVE_SYS_BITYPES_H)/g' \
            -e 's/@''HAVE_LONG_LONG_INT''@/$(HAVE_LONG_LONG_INT)/g' \
+             -e 
's/@''HAVE_UNSIGNED_LONG_LONG_INT''@/$(HAVE_UNSIGNED_LONG_LONG_INT)/g' \
            -e 's/@''BITSIZEOF_PTRDIFF_T''@/$(BITSIZEOF_PTRDIFF_T)/g' \
            -e 's/@''PTRDIFF_T_SUFFIX''@/$(PTRDIFF_T_SUFFIX)/g' \
            -e 's/@''BITSIZEOF_SIG_ATOMIC_T''@/$(BITSIZEOF_SIG_ATOMIC_T)/g' \
@@ -1018,37 +1400,256 @@
            -e 's/@''BITSIZEOF_WINT_T''@/$(BITSIZEOF_WINT_T)/g' \
            -e 's/@''HAVE_SIGNED_WINT_T''@/$(HAVE_SIGNED_WINT_T)/g' \
            -e 's/@''WINT_T_SUFFIX''@/$(WINT_T_SUFFIX)/g' \
-           < $(srcdir)/stdint_.h > address@hidden
+             < $(srcdir)/stdint_.h; \
+       } > address@hidden
+       mv address@hidden $@
+
+# We need the following in order to create <stdio.h> when the system
+# doesn't have one that works with the given compiler.
+stdio.h: stdio_.h
+       rm -f address@hidden $@
+       { echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */' && \
+         sed -e 's/@''INCLUDE_NEXT''@/$(INCLUDE_NEXT)/g' \
+             -e 's|@''NEXT_STDIO_H''@|$(NEXT_STDIO_H)|g' \
+             -e 's|@''GNULIB_FPRINTF_POSIX''@|$(GNULIB_FPRINTF_POSIX)|g' \
+             -e 's|@''GNULIB_PRINTF_POSIX''@|$(GNULIB_PRINTF_POSIX)|g' \
+             -e 's|@''GNULIB_SNPRINTF''@|$(GNULIB_SNPRINTF)|g' \
+             -e 's|@''GNULIB_SPRINTF_POSIX''@|$(GNULIB_SPRINTF_POSIX)|g' \
+             -e 's|@''GNULIB_VFPRINTF_POSIX''@|$(GNULIB_VFPRINTF_POSIX)|g' \
+             -e 's|@''GNULIB_VPRINTF_POSIX''@|$(GNULIB_VPRINTF_POSIX)|g' \
+             -e 's|@''GNULIB_VSNPRINTF''@|$(GNULIB_VSNPRINTF)|g' \
+             -e 's|@''GNULIB_VSPRINTF_POSIX''@|$(GNULIB_VSPRINTF_POSIX)|g' \
+             -e 's|@''GNULIB_VASPRINTF''@|$(GNULIB_VASPRINTF)|g' \
+             -e 's|@''GNULIB_FSEEK''@|$(GNULIB_FSEEK)|g' \
+             -e 's|@''GNULIB_FSEEKO''@|$(GNULIB_FSEEKO)|g' \
+             -e 's|@''GNULIB_FTELL''@|$(GNULIB_FTELL)|g' \
+             -e 's|@''GNULIB_FTELLO''@|$(GNULIB_FTELLO)|g' \
+             -e 's|@''GNULIB_FFLUSH''@|$(GNULIB_FFLUSH)|g' \
+             -e 's|@''REPLACE_FPRINTF''@|$(REPLACE_FPRINTF)|g' \
+             -e 's|@''REPLACE_VFPRINTF''@|$(REPLACE_VFPRINTF)|g' \
+             -e 's|@''REPLACE_PRINTF''@|$(REPLACE_PRINTF)|g' \
+             -e 's|@''REPLACE_VPRINTF''@|$(REPLACE_VPRINTF)|g' \
+             -e 's|@''REPLACE_SNPRINTF''@|$(REPLACE_SNPRINTF)|g' \
+             -e 's|@''HAVE_DECL_SNPRINTF''@|$(HAVE_DECL_SNPRINTF)|g' \
+             -e 's|@''REPLACE_VSNPRINTF''@|$(REPLACE_VSNPRINTF)|g' \
+             -e 's|@''HAVE_DECL_VSNPRINTF''@|$(HAVE_DECL_VSNPRINTF)|g' \
+             -e 's|@''REPLACE_SPRINTF''@|$(REPLACE_SPRINTF)|g' \
+             -e 's|@''REPLACE_VSPRINTF''@|$(REPLACE_VSPRINTF)|g' \
+             -e 's|@''HAVE_VASPRINTF''@|$(HAVE_VASPRINTF)|g' \
+             -e 's|@''REPLACE_VASPRINTF''@|$(REPLACE_VASPRINTF)|g' \
+             -e 's|@''REPLACE_FSEEKO''@|$(REPLACE_FSEEKO)|g' \
+             -e 's|@''REPLACE_FSEEK''@|$(REPLACE_FSEEK)|g' \
+             -e 's|@''REPLACE_FTELLO''@|$(REPLACE_FTELLO)|g' \
+             -e 's|@''REPLACE_FTELL''@|$(REPLACE_FTELL)|g' \
+             -e 's|@''REPLACE_FFLUSH''@|$(REPLACE_FFLUSH)|g' \
+             -e '/definition of GL_LINK_WARNING/r $(LINK_WARNING_H)' \
+             < $(srcdir)/stdio_.h; \
+       } > address@hidden
+       mv address@hidden $@
+
+# We need the following in order to create <stdlib.h> when the system
+# doesn't have one that works with the given compiler.
+stdlib.h: stdlib_.h
+       rm -f address@hidden $@
+       { echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */' && \
+         sed -e 's/@''INCLUDE_NEXT''@/$(INCLUDE_NEXT)/g' \
+             -e 's|@''NEXT_STDLIB_H''@|$(NEXT_STDLIB_H)|g' \
+             -e 's|@''GNULIB_GETSUBOPT''@|$(GNULIB_GETSUBOPT)|g' \
+             -e 's|@''GNULIB_MKDTEMP''@|$(GNULIB_MKDTEMP)|g' \
+             -e 's|@''GNULIB_MKSTEMP''@|$(GNULIB_MKSTEMP)|g' \
+             -e 's|@''HAVE_GETSUBOPT''@|$(HAVE_GETSUBOPT)|g' \
+             -e 's|@''HAVE_MKDTEMP''@|$(HAVE_MKDTEMP)|g' \
+             -e 's|@''REPLACE_MKSTEMP''@|$(REPLACE_MKSTEMP)|g' \
+             -e '/definition of GL_LINK_WARNING/r $(LINK_WARNING_H)' \
+             < $(srcdir)/stdlib_.h; \
+       } > address@hidden
+       mv address@hidden $@
+
+# We need the following in order to create <string.h> when the system
+# doesn't have one that works with the given compiler.
+string.h: string_.h
+       rm -f address@hidden $@
+       { echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */' && \
+         sed -e 's/@''INCLUDE_NEXT''@/$(INCLUDE_NEXT)/g' \
+             -e 's|@''NEXT_STRING_H''@|$(NEXT_STRING_H)|g' \
+             -e 's|@''GNULIB_MBSLEN''@|$(GNULIB_MBSLEN)|g' \
+             -e 's|@''GNULIB_MBSNLEN''@|$(GNULIB_MBSNLEN)|g' \
+             -e 's|@''GNULIB_MBSCHR''@|$(GNULIB_MBSCHR)|g' \
+             -e 's|@''GNULIB_MBSRCHR''@|$(GNULIB_MBSRCHR)|g' \
+             -e 's|@''GNULIB_MBSSTR''@|$(GNULIB_MBSSTR)|g' \
+             -e 's|@''GNULIB_MBSCASECMP''@|$(GNULIB_MBSCASECMP)|g' \
+             -e 's|@''GNULIB_MBSNCASECMP''@|$(GNULIB_MBSNCASECMP)|g' \
+             -e 's|@''GNULIB_MBSPCASECMP''@|$(GNULIB_MBSPCASECMP)|g' \
+             -e 's|@''GNULIB_MBSCASESTR''@|$(GNULIB_MBSCASESTR)|g' \
+             -e 's|@''GNULIB_MBSCSPN''@|$(GNULIB_MBSCSPN)|g' \
+             -e 's|@''GNULIB_MBSPBRK''@|$(GNULIB_MBSPBRK)|g' \
+             -e 's|@''GNULIB_MBSSPN''@|$(GNULIB_MBSSPN)|g' \
+             -e 's|@''GNULIB_MBSSEP''@|$(GNULIB_MBSSEP)|g' \
+             -e 's|@''GNULIB_MBSTOK_R''@|$(GNULIB_MBSTOK_R)|g' \
+             -e 's|@''GNULIB_MEMMEM''@|$(GNULIB_MEMMEM)|g' \
+             -e 's|@''GNULIB_MEMPCPY''@|$(GNULIB_MEMPCPY)|g' \
+             -e 's|@''GNULIB_MEMRCHR''@|$(GNULIB_MEMRCHR)|g' \
+             -e 's|@''GNULIB_STPCPY''@|$(GNULIB_STPCPY)|g' \
+             -e 's|@''GNULIB_STPNCPY''@|$(GNULIB_STPNCPY)|g' \
+             -e 's|@''GNULIB_STRCHRNUL''@|$(GNULIB_STRCHRNUL)|g' \
+             -e 's|@''GNULIB_STRDUP''@|$(GNULIB_STRDUP)|g' \
+             -e 's|@''GNULIB_STRNDUP''@|$(GNULIB_STRNDUP)|g' \
+             -e 's|@''GNULIB_STRNLEN''@|$(GNULIB_STRNLEN)|g' \
+             -e 's|@''GNULIB_STRPBRK''@|$(GNULIB_STRPBRK)|g' \
+             -e 's|@''GNULIB_STRSEP''@|$(GNULIB_STRSEP)|g' \
+             -e 's|@''GNULIB_STRCASESTR''@|$(GNULIB_STRCASESTR)|g' \
+             -e 's|@''GNULIB_STRTOK_R''@|$(GNULIB_STRTOK_R)|g' \
+             -e 's|@''HAVE_DECL_MEMMEM''@|$(HAVE_DECL_MEMMEM)|g' \
+             -e 's|@''HAVE_MEMPCPY''@|$(HAVE_MEMPCPY)|g' \
+             -e 's|@''HAVE_DECL_MEMRCHR''@|$(HAVE_DECL_MEMRCHR)|g' \
+             -e 's|@''HAVE_STPCPY''@|$(HAVE_STPCPY)|g' \
+             -e 's|@''HAVE_STPNCPY''@|$(HAVE_STPNCPY)|g' \
+             -e 's|@''HAVE_STRCASECMP''@|$(HAVE_STRCASECMP)|g' \
+             -e 's|@''HAVE_DECL_STRNCASECMP''@|$(HAVE_DECL_STRNCASECMP)|g' \
+             -e 's|@''HAVE_STRCHRNUL''@|$(HAVE_STRCHRNUL)|g' \
+             -e 's|@''HAVE_DECL_STRDUP''@|$(HAVE_DECL_STRDUP)|g' \
+             -e 's|@''HAVE_STRNDUP''@|$(HAVE_STRNDUP)|g' \
+             -e 's|@''HAVE_DECL_STRNDUP''@|$(HAVE_DECL_STRNDUP)|g' \
+             -e 's|@''HAVE_DECL_STRNLEN''@|$(HAVE_DECL_STRNLEN)|g' \
+             -e 's|@''HAVE_STRPBRK''@|$(HAVE_STRPBRK)|g' \
+             -e 's|@''HAVE_STRSEP''@|$(HAVE_STRSEP)|g' \
+             -e 's|@''HAVE_STRCASESTR''@|$(HAVE_STRCASESTR)|g' \
+             -e 's|@''HAVE_DECL_STRTOK_R''@|$(HAVE_DECL_STRTOK_R)|g' \
+             -e '/definition of GL_LINK_WARNING/r $(LINK_WARNING_H)' \
+             < $(srcdir)/string_.h; \
+       } > address@hidden
        mv address@hidden $@
 
 # We need the following in order to create <sys/socket.h> when the system
 # doesn't have one that works with the given compiler.
-sys/socket.h: socket_.h
-       test -d sys || mkdir sys
-       cp -f $(srcdir)/socket_.h address@hidden
+sys/socket.h: sys_socket_.h
+       @MKDIR_P@ sys
+       { echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */'; \
+         sed -e 's/@''INCLUDE_NEXT''@/$(INCLUDE_NEXT)/g' \
+             -e 's|@''NEXT_SYS_SOCKET_H''@|$(NEXT_SYS_SOCKET_H)|g' \
+             -e 's|@''HAVE_SYS_SOCKET_H''@|$(HAVE_SYS_SOCKET_H)|g' \
+             -e 's|@''HAVE_WINSOCK2_H''@|$(HAVE_WINSOCK2_H)|g' \
+             -e 's|@''HAVE_WS2TCPIP_H''@|$(HAVE_WS2TCPIP_H)|g' \
+             < $(srcdir)/sys_socket_.h; \
+       } > address@hidden
        mv -f address@hidden $@
 
 # We need the following in order to create <sys/stat.h> when the system
 # has one that is incomplete.
-sys/stat.h: stat_.h
-       test -d sys || mkdir sys
+sys/stat.h: sys_stat_.h
+       @MKDIR_P@ sys
        rm -f address@hidden $@
-       sed -e 's|@''ABSOLUTE_SYS_STAT_H''@|$(ABSOLUTE_SYS_STAT_H)|g' \
-           < $(srcdir)/stat_.h > address@hidden
+       { echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */'; \
+         sed -e 's/@''INCLUDE_NEXT''@/$(INCLUDE_NEXT)/g' \
+             -e 's|@''NEXT_SYS_STAT_H''@|$(NEXT_SYS_STAT_H)|g' \
+             -e 's|@''HAVE_IO_H''@|$(HAVE_IO_H)|g' \
+             -e 's|@''HAVE_LSTAT''@|$(HAVE_LSTAT)|g' \
+             -e 's|@''HAVE_DECL_MKDIR''@|$(HAVE_DECL_MKDIR)|g' \
+             < $(srcdir)/sys_stat_.h; \
+       } > address@hidden
+       mv address@hidden $@
+
+# We need the following in order to create <sys/time.h> when the system
+# doesn't have one that works with the given compiler.
+sys/time.h: sys_time_.h
+       @MKDIR_P@ sys
+       rm -f address@hidden $@
+       { echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */'; \
+         sed -e 's/@''HAVE_SYS_TIME_H''@/$(HAVE_SYS_TIME_H)/g' \
+             -e 's/@''INCLUDE_NEXT''@/$(INCLUDE_NEXT)/g' \
+             -e 's|@''NEXT_SYS_TIME_H''@|$(NEXT_SYS_TIME_H)|g' \
+             -e 's/@''REPLACE_GETTIMEOFDAY''@/$(REPLACE_GETTIMEOFDAY)/g' \
+             -e 's/@''HAVE_STRUCT_TIMEVAL''@/$(HAVE_STRUCT_TIMEVAL)/g' \
+             < $(srcdir)/sys_time_.h; \
+       } > address@hidden
+       mv address@hidden $@
+
+# We need the following in order to create <time.h> when the system
+# doesn't have one that works with the given compiler.
+time.h: time_.h
+       rm -f address@hidden $@
+       { echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */' && \
+         sed -e 's/@''INCLUDE_NEXT''@/$(INCLUDE_NEXT)/g' \
+             -e 's|@NEXT_TIME_H''@|$(NEXT_TIME_H)|g' \
+             -e 's|@REPLACE_LOCALTIME_R''@|$(REPLACE_LOCALTIME_R)|g' \
+             -e 's|@REPLACE_NANOSLEEP''@|$(REPLACE_NANOSLEEP)|g' \
+             -e 's|@REPLACE_STRPTIME''@|$(REPLACE_STRPTIME)|g' \
+             -e 's|@REPLACE_TIMEGM''@|$(REPLACE_TIMEGM)|g' \
+             -e 
's|@SYS_TIME_H_DEFINES_STRUCT_TIMESPEC''@|$(SYS_TIME_H_DEFINES_STRUCT_TIMESPEC)|g'
 \
+             -e 
's|@TIME_H_DEFINES_STRUCT_TIMESPEC''@|$(TIME_H_DEFINES_STRUCT_TIMESPEC)|g' \
+             < $(srcdir)/time_.h; \
+       } > address@hidden
        mv address@hidden $@
 
 # We need the following in order to create an empty placeholder for
 # <unistd.h> when the system doesn't have one.
-unistd.h:
-       echo '/* Empty placeholder for address@hidden  */' >$@
+unistd.h: unistd_.h
+       rm -f address@hidden $@
+       { echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */'; \
+         sed -e 's|@''HAVE_UNISTD_H''@|$(HAVE_UNISTD_H)|g' \
+             -e 's/@''INCLUDE_NEXT''@/$(INCLUDE_NEXT)/g' \
+             -e 's|@''NEXT_UNISTD_H''@|$(NEXT_UNISTD_H)|g' \
+             -e 's|@''GNULIB_CHOWN''@|$(GNULIB_CHOWN)|g' \
+             -e 's|@''GNULIB_DUP2''@|$(GNULIB_DUP2)|g' \
+             -e 's|@''GNULIB_FCHDIR''@|$(GNULIB_FCHDIR)|g' \
+             -e 's|@''GNULIB_FTRUNCATE''@|$(GNULIB_FTRUNCATE)|g' \
+             -e 's|@''GNULIB_GETCWD''@|$(GNULIB_GETCWD)|g' \
+             -e 's|@''GNULIB_GETLOGIN_R''@|$(GNULIB_GETLOGIN_R)|g' \
+             -e 's|@''GNULIB_LCHOWN''@|$(GNULIB_LCHOWN)|g' \
+             -e 's|@''GNULIB_LSEEK''@|$(GNULIB_LSEEK)|g' \
+             -e 's|@''GNULIB_READLINK''@|$(GNULIB_READLINK)|g' \
+             -e 's|@''GNULIB_SLEEP''@|$(GNULIB_SLEEP)|g' \
+             -e 's|@''HAVE_DUP2''@|$(HAVE_DUP2)|g' \
+             -e 's|@''HAVE_FTRUNCATE''@|$(HAVE_FTRUNCATE)|g' \
+             -e 's|@''HAVE_READLINK''@|$(HAVE_READLINK)|g' \
+             -e 's|@''HAVE_SLEEP''@|$(HAVE_SLEEP)|g' \
+             -e 's|@''HAVE_DECL_GETLOGIN_R''@|$(HAVE_DECL_GETLOGIN_R)|g' \
+             -e 's|@''REPLACE_CHOWN''@|$(REPLACE_CHOWN)|g' \
+             -e 's|@''REPLACE_FCHDIR''@|$(REPLACE_FCHDIR)|g' \
+             -e 's|@''REPLACE_GETCWD''@|$(REPLACE_GETCWD)|g' \
+             -e 's|@''REPLACE_LCHOWN''@|$(REPLACE_LCHOWN)|g' \
+             -e 's|@''REPLACE_LSEEK''@|$(REPLACE_LSEEK)|g' \
+             < $(srcdir)/unistd_.h; \
+       } > address@hidden
+       mv address@hidden $@
+
+# We need the following in order to create <wchar.h> when the system
+# version does not work standalone.
+wchar.h: wchar_.h
+       rm -f address@hidden $@
+       { echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */'; \
+         sed -e 's/@''INCLUDE_NEXT''@/$(INCLUDE_NEXT)/g' \
+             -e 's|@''NEXT_WCHAR_H''@|$(NEXT_WCHAR_H)|g' \
+             -e 's/@''HAVE_WCHAR_H''@/$(HAVE_WCHAR_H)/g' \
+             -e 's|@''GNULIB_WCWIDTH''@|$(GNULIB_WCWIDTH)|g' \
+             -e 's|@''HAVE_DECL_WCWIDTH''@|$(HAVE_DECL_WCWIDTH)|g' \
+             -e 's|@''REPLACE_WCWIDTH''@|$(REPLACE_WCWIDTH)|g' \
+             -e '/definition of GL_LINK_WARNING/r $(LINK_WARNING_H)' \
+           < $(srcdir)/wchar_.h; \
+       } > address@hidden
+       mv address@hidden $@
+
+# We need the following in order to create <wctype.h> when the system
+# doesn't have one that works with the given compiler.
+wctype.h: wctype_.h
+       rm -f address@hidden $@
+       { 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|@''NEXT_WCTYPE_H''@|$(NEXT_WCTYPE_H)|g' \
+             -e 's/@''HAVE_ISWCNTRL''@/$(HAVE_ISWCNTRL)/g' \
+             -e 's/@''HAVE_WINT_T''@/$(HAVE_WINT_T)/g' \
+             < $(srcdir)/wctype_.h; \
+       } > address@hidden
+       mv address@hidden $@
 
 mostlyclean-local:
-       @test -z "$(MOSTLYCLEANDIRS)" || \
-         for dir in $(MOSTLYCLEANDIRS); do \
-           if test -d $$dir; then \
+       @for dir in '' $(MOSTLYCLEANDIRS); do \
+         if test -n "$$dir" && test -d $$dir; then \
              echo "rmdir $$dir"; rmdir $$dir; \
            fi; \
-         done
+       done; \
+       :
 
 # Until Automake gets its act together
 distclean-local:

Index: __fpending.h
===================================================================
RCS file: /cvsroot/cvs/ccvs/lib/__fpending.h,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -b -r1.3 -r1.4
--- __fpending.h        21 Aug 2006 19:22:22 -0000      1.3
+++ __fpending.h        22 Aug 2007 12:48:37 -0000      1.4
@@ -1,6 +1,6 @@
 /* Declare __fpending.
 
-   Copyright (C) 2000, 2003, 2005 Free Software Foundation, Inc.
+   Copyright (C) 2000, 2003, 2005, 2006 Free Software Foundation, Inc.
 
    This program is free software; you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
@@ -21,13 +21,14 @@
 #include <stddef.h>
 #include <stdio.h>
 
-#if HAVE_STDIO_EXT_H
-# include <stdio_ext.h>
-#endif
-
 #ifndef HAVE_DECL___FPENDING
 "this configure-time declaration test was not run"
 #endif
-#if !HAVE_DECL___FPENDING
+
+#if HAVE_DECL___FPENDING
+# if HAVE_STDIO_EXT_H
+#  include <stdio_ext.h>
+# endif
+#else
 size_t __fpending (FILE *);
 #endif

Index: alloca_.h
===================================================================
RCS file: /cvsroot/cvs/ccvs/lib/alloca_.h,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -b -r1.6 -r1.7
--- alloca_.h   19 Jun 2006 17:45:58 -0000      1.6
+++ alloca_.h   22 Aug 2007 12:48:37 -0000      1.7
@@ -1,6 +1,6 @@
 /* Memory allocation on the stack.
 
-   Copyright (C) 1995, 1999, 2001, 2002, 2003, 2004, 2006 Free Software
+   Copyright (C) 1995, 1999, 2001-2004, 2006-2007 Free Software
    Foundation, Inc.
 
    This program is free software; you can redistribute it and/or modify it
@@ -20,8 +20,8 @@
 
 /* Avoid using the symbol _ALLOCA_H here, as Bison assumes _ALLOCA_H
    means there is a real alloca function.  */
-#ifndef _GNULIB_ALLOCA_H
-# define _GNULIB_ALLOCA_H
+#ifndef _GL_ALLOCA_H
+#define _GL_ALLOCA_H
 
 /* alloca (N) returns a pointer to N bytes of memory
    allocated on the stack, which will last until the function returns.
@@ -51,4 +51,4 @@
 # endif
 #endif
 
-#endif /* _GNULIB_ALLOCA_H */
+#endif /* _GL_ALLOCA_H */

Index: asprintf.c
===================================================================
RCS file: /cvsroot/cvs/ccvs/lib/asprintf.c,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -b -r1.3 -r1.4
--- asprintf.c  22 Sep 2006 17:54:39 -0000      1.3
+++ asprintf.c  22 Aug 2007 12:48:38 -0000      1.4
@@ -1,5 +1,5 @@
 /* Formatted output to strings.
-   Copyright (C) 1999, 2002, 2006 Free Software Foundation, Inc.
+   Copyright (C) 1999, 2002, 2006-2007 Free Software Foundation, Inc.
 
    This program is free software; you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
@@ -18,7 +18,11 @@
 #include <config.h>
 
 /* Specification.  */
-#include "vasprintf.h"
+#ifdef IN_LIBASPRINTF
+# include "vasprintf.h"
+#else
+# include <stdio.h>
+#endif
 
 #include <stdarg.h>
 

Index: at-func.c
===================================================================
RCS file: /cvsroot/cvs/ccvs/lib/at-func.c,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -b -r1.1 -r1.2
--- at-func.c   21 Aug 2006 19:22:22 -0000      1.1
+++ at-func.c   22 Aug 2007 12:48:38 -0000      1.2
@@ -39,14 +39,25 @@
     return CALL_FUNC (file);
 
   {
-    char *proc_file;
-    BUILD_PROC_NAME (proc_file, fd, file);
-    err = CALL_FUNC (proc_file);
+    char buf[OPENAT_BUFFER_SIZE];
+    char *proc_file = openat_proc_name (buf, fd, file);
+    if (proc_file)
+      {
+       int proc_result = CALL_FUNC (proc_file);
+       int proc_errno = errno;
+       if (proc_file != buf)
+         free (proc_file);
     /* If the syscall succeeds, or if it fails with an unexpected
        errno value, then return right away.  Otherwise, fall through
        and resort to using save_cwd/restore_cwd.  */
-    if (0 <= err || ! EXPECTED_ERRNO (errno))
-      return err;
+       if (0 <= proc_result)
+         return proc_result;
+       if (! EXPECTED_ERRNO (proc_errno))
+         {
+           errno = proc_errno;
+           return proc_result;
+         }
+      }
   }
 
   if (save_cwd (&saved_cwd) != 0)

Index: base64.c
===================================================================
RCS file: /cvsroot/cvs/ccvs/lib/base64.c,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -b -r1.5 -r1.6
--- base64.c    26 Jun 2006 23:28:00 -0000      1.5
+++ base64.c    22 Aug 2007 12:48:38 -0000      1.6
@@ -41,9 +41,7 @@
  *
  */
 
-#ifdef HAVE_CONFIG_H
-# include <config.h>
-#endif
+#include <config.h>
 
 /* Get prototype. */
 #include "base64.h"

Index: canon-host.c
===================================================================
RCS file: /cvsroot/cvs/ccvs/lib/canon-host.c,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -b -r1.5 -r1.6
--- canon-host.c        22 Sep 2006 17:54:39 -0000      1.5
+++ canon-host.c        22 Aug 2007 12:48:38 -0000      1.6
@@ -1,6 +1,6 @@
 /* Host name canonicalization
 
-   Copyright (C) 2005, 2006 Free Software Foundation, Inc.
+   Copyright (C) 2005, 2006, 2007 Free Software Foundation, Inc.
 
    Written by Derek Price <address@hidden>.
 
@@ -22,8 +22,9 @@
 
 #include "canon-host.h"
 
+#include <string.h>
+
 #include "getaddrinfo.h"
-#include "strdup.h"
 
 /* Store the last error for the single-threaded version of this function.  */
 static int last_cherror;
@@ -69,7 +70,10 @@
   status = getaddrinfo (host, NULL, &hints, &res);
   if (!status)
     {
-      retval = strdup (res->ai_canonname);
+      /* http://lists.gnu.org/archive/html/bug-coreutils/2006-09/msg00300.html
+        says Darwin 7.9.0 getaddrinfo returns 0 but sets
+        res->ai_canonname to NULL.  */
+      retval = strdup (res->ai_canonname ? res->ai_canonname : host);
       if (!retval && cherror)
        *cherror = EAI_MEMORY;
       freeaddrinfo (res);

Index: canonicalize.c
===================================================================
RCS file: /cvsroot/cvs/ccvs/lib/canonicalize.c,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -b -r1.4 -r1.5
--- canonicalize.c      22 Sep 2006 17:54:39 -0000      1.4
+++ canonicalize.c      22 Aug 2007 12:48:38 -0000      1.5
@@ -1,5 +1,5 @@
 /* Return the canonical absolute name of a given file.
-   Copyright (C) 1996-2006 Free Software Foundation, Inc.
+   Copyright (C) 1996-2007 Free Software Foundation, Inc.
 
    This program is free software; you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
@@ -36,16 +36,18 @@
 
 #include "cycle-check.h"
 #include "filenamecat.h"
-#include "stat-macros.h"
 #include "xalloc.h"
 #include "xgetcwd.h"
 
+#ifndef ELOOP
+# define ELOOP 0
+#endif
 #ifndef __set_errno
 # define __set_errno(Val) errno = (Val)
 #endif
 
 #include "pathmax.h"
-#include "xreadlink.h"
+#include "mreadlink.h"
 
 #if !HAVE_CANONICALIZE_FILE_NAME
 /* Return the canonical absolute name of file NAME.  A canonical name
@@ -244,10 +246,10 @@
                    goto error;
                }
 
-             buf = xreadlink (rname, st.st_size);
+             buf = mreadlink_with_size (rname, st.st_size);
              if (!buf)
                {
-                 if (can_mode == CAN_MISSING)
+                 if (can_mode == CAN_MISSING && errno != ENOMEM)
                    continue;
                  else
                    goto error;

Index: canonicalize.h
===================================================================
RCS file: /cvsroot/cvs/ccvs/lib/canonicalize.h,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -b -r1.2 -r1.3
--- canonicalize.h      10 Jun 2005 20:30:20 -0000      1.2
+++ canonicalize.h      22 Aug 2007 12:48:38 -0000      1.3
@@ -1,5 +1,5 @@
 /* Return the canonical absolute name of a given file.
-   Copyright (C) 1996-2005 Free Software Foundation, Inc.
+   Copyright (C) 1996-2007 Free Software Foundation, Inc.
 
    This program is free software; you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
@@ -19,6 +19,7 @@
 #ifndef CANONICALIZE_H_
 # define CANONICALIZE_H_
 
+# if GNULIB_CANONICALIZE
 enum canonicalize_mode_t
   {
     /* All components must exist.  */
@@ -32,9 +33,21 @@
   };
 typedef enum canonicalize_mode_t canonicalize_mode_t;
 
+/* Return a malloc'd string containing the canonical absolute name of
+   the named file.  This acts like canonicalize_file_name, except that
+   whether components must exist depends on the canonicalize_mode_t
+   argument.  */
 char *canonicalize_filename_mode (const char *, canonicalize_mode_t);
+# endif
 
-# if !HAVE_CANONICALIZE_FILE_NAME
+# if HAVE_DECL_CANONICALIZE_FILE_NAME
+#  include <stdlib.h>
+# else
+/* Return a malloc'd string containing the canonical absolute name of
+   the named file.  If any file name component does not exist or is a
+   symlink to a nonexistent file, return NULL.  A canonical name does
+   not contain any `.', `..' components nor any repeated file name
+   separators ('/') or symlinks.  */
 char *canonicalize_file_name (const char *);
 # endif
 

Index: chdir-long.c
===================================================================
RCS file: /cvsroot/cvs/ccvs/lib/chdir-long.c,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -b -r1.7 -r1.8
--- chdir-long.c        22 Sep 2006 17:54:39 -0000      1.7
+++ chdir-long.c        22 Aug 2007 12:48:38 -0000      1.8
@@ -1,5 +1,5 @@
 /* provide a chdir function that tries not to fail due to ENAMETOOLONG
-   Copyright (C) 2004, 2005, 2006 Free Software Foundation, Inc.
+   Copyright (C) 2004, 2005, 2006, 2007 Free Software Foundation, Inc.
 
    This program is free software; you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
@@ -29,7 +29,6 @@
 #include <stdio.h>
 #include <assert.h>
 
-#include "memrchr.h"
 #include "openat.h"
 
 #ifndef PATH_MAX

Index: chown.c
===================================================================
RCS file: /cvsroot/cvs/ccvs/lib/chown.c,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -b -r1.2 -r1.3
--- chown.c     22 Sep 2006 17:54:39 -0000      1.2
+++ chown.c     22 Aug 2007 12:48:38 -0000      1.3
@@ -1,7 +1,7 @@
 /* provide consistent interface to chown for systems that don't interpret
    an ID of -1 as meaning `don't change the corresponding ID'.
 
-   Copyright (C) 1997, 2004, 2005, 2006 Free Software Foundation, Inc.
+   Copyright (C) 1997, 2004, 2005, 2006, 2007 Free Software Foundation, Inc.
 
    This program is free software; you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
@@ -21,19 +21,22 @@
 
 #include <config.h>
 
-/* Disable the definition of chown to rpl_chown (from config.h) in this
-   file.  Otherwise, we'd get conflicting prototypes for rpl_chown on
-   most systems.  */
-#undef chown
+/* Specification.  */
+#include <unistd.h>
 
 #include <stdbool.h>
 #include <sys/types.h>
 #include <sys/stat.h>
-#include <unistd.h>
 #include <fcntl.h>
 #include <errno.h>
 
-#include "stat-macros.h"
+/* Below we refer to the system's chown().  */
+#undef chown
+
+/* The results of open() in this file are not used with fchdir,
+   therefore save some unnecessary work in fchdir.c.  */
+#undef open
+#undef close
 
 /* Provide a more-closely POSIX-conforming version of chown on
    systems with one or both of the following problems:

Index: closeout.c
===================================================================
RCS file: /cvsroot/cvs/ccvs/lib/closeout.c,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -b -r1.6 -r1.7
--- closeout.c  22 Sep 2006 17:54:39 -0000      1.6
+++ closeout.c  22 Aug 2007 12:48:38 -0000      1.7
@@ -1,4 +1,4 @@
-/* Close standard output, exiting with a diagnostic on error.
+/* Close standard output and standard error, exiting with a diagnostic on 
error.
 
    Copyright (C) 1998, 1999, 2000, 2001, 2002, 2004, 2006 Free
    Software Foundation, Inc.
@@ -46,6 +46,8 @@
 /* Close standard output.  On error, issue a diagnostic and _exit
    with status 'exit_failure'.
 
+   Also close standard error.  On error, _exit with status 'exit_failure'.
+
    Since close_stdout is commonly registered via 'atexit', POSIX
    and the C standard both say that it should not call 'exit',
    because the behavior is undefined if 'exit' is called more than
@@ -78,4 +80,7 @@
 
       _exit (exit_failure);
     }
+
+   if (close_stream (stderr) != 0)
+     _exit (exit_failure);
 }

Index: closeout.h
===================================================================
RCS file: /cvsroot/cvs/ccvs/lib/closeout.h,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -b -r1.2 -r1.3
--- closeout.h  23 May 2005 17:44:30 -0000      1.2
+++ closeout.h  22 Aug 2007 12:48:38 -0000      1.3
@@ -1,6 +1,6 @@
-/* Close standard output.
+/* Close standard output and standard error.
 
-   Copyright (C) 1998, 2000, 2003, 2004 Free Software Foundation, Inc.
+   Copyright (C) 1998, 2000, 2003, 2004, 2006 Free Software Foundation, Inc.
 
    This program is free software; you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by

Index: dirname.h
===================================================================
RCS file: /cvsroot/cvs/ccvs/lib/dirname.h,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -b -r1.5 -r1.6
--- dirname.h   6 Jul 2006 02:17:59 -0000       1.5
+++ dirname.h   22 Aug 2007 12:48:38 -0000      1.6
@@ -48,7 +48,7 @@
 # endif
 
 # ifndef DOUBLE_SLASH_IS_DISTINCT_ROOT
-#  define DOUBLE_SLASH_IS_DISTINCT_ROOT 1
+#  define DOUBLE_SLASH_IS_DISTINCT_ROOT 0
 # endif
 
 # if FILE_SYSTEM_DRIVE_PREFIX_CAN_BE_RELATIVE

Index: dup-safer.c
===================================================================
RCS file: /cvsroot/cvs/ccvs/lib/dup-safer.c,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -b -r1.6 -r1.7
--- dup-safer.c 22 Sep 2006 17:54:39 -0000      1.6
+++ dup-safer.c 22 Aug 2007 12:48:38 -0000      1.7
@@ -35,7 +35,7 @@
 int
 dup_safer (int fd)
 {
-#ifdef F_DUPFD
+#if defined F_DUPFD && !defined FCHDIR_REPLACEMENT
   return fcntl (fd, F_DUPFD, STDERR_FILENO + 1);
 #else
   /* fd_safer calls us back, but eventually the recursion unwinds and

Index: dup2.c
===================================================================
RCS file: /cvsroot/cvs/ccvs/lib/dup2.c,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -b -r1.7 -r1.8
--- dup2.c      22 Sep 2006 17:54:39 -0000      1.7
+++ dup2.c      22 Aug 2007 12:48:39 -0000      1.8
@@ -1,6 +1,6 @@
 /* Duplicate an open file descriptor to a specified file descriptor.
 
-   Copyright (C) 1999, 2004, 2005, 2006 Free Software Foundation, Inc.
+   Copyright (C) 1999, 2004, 2005, 2006, 2007 Free Software Foundation, Inc.
 
    This program is free software; you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
@@ -20,9 +20,11 @@
 
 #include <config.h>
 
+/* Specification.  */
+#include <unistd.h>
+
 #include <errno.h>
 #include <fcntl.h>
-#include <unistd.h>
 
 #ifndef F_DUPFD
 static int

Index: error.c
===================================================================
RCS file: /cvsroot/cvs/ccvs/lib/error.c,v
retrieving revision 1.11
retrieving revision 1.12
diff -u -b -r1.11 -r1.12
--- error.c     22 Sep 2006 17:54:39 -0000      1.11
+++ error.c     22 Aug 2007 12:48:39 -0000      1.12
@@ -1,5 +1,5 @@
 /* Error handler for noninteractive utilities
-   Copyright (C) 1990-1998, 2000-2005, 2006 Free Software Foundation, Inc.
+   Copyright (C) 1990-1998, 2000-2007 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
 
    This program is free software; you can redistribute it and/or modify
@@ -31,6 +31,7 @@
 
 #if !_LIBC && ENABLE_NLS
 # include "gettext.h"
+# define _(msgid) gettext (msgid)
 #endif
 
 #ifdef _LIBC

Index: exitfail.c
===================================================================
RCS file: /cvsroot/cvs/ccvs/lib/exitfail.c,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -b -r1.5 -r1.6
--- exitfail.c  22 Sep 2006 17:54:39 -0000      1.5
+++ exitfail.c  22 Aug 2007 12:48:39 -0000      1.6
@@ -1,6 +1,6 @@
 /* Failure exit status
 
-   Copyright (C) 2002, 2003, 2005, 2006 Free Software Foundation, Inc.
+   Copyright (C) 2002, 2003, 2005, 2006, 2007 Free Software Foundation, Inc.
 
    This program is free software; you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
@@ -20,6 +20,7 @@
 #include <config.h>
 
 #include "exitfail.h"
-#include "exit.h"
+
+#include <stdlib.h>
 
 int volatile exit_failure = EXIT_FAILURE;

Index: fcntl_.h
===================================================================
RCS file: /cvsroot/cvs/ccvs/lib/fcntl_.h,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -b -r1.1 -r1.2
--- fcntl_.h    2 Sep 2006 23:17:59 -0000       1.1
+++ fcntl_.h    22 Aug 2007 12:48:39 -0000      1.2
@@ -1,6 +1,6 @@
 /* Like <fcntl.h>, but with non-working flags defined to 0.
 
-   Copyright (C) 2006 Free Software Foundation, Inc.
+   Copyright (C) 2006-2007 Free Software Foundation, Inc.
 
    This program is free software; you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
@@ -19,12 +19,34 @@
 /* written by Paul Eggert */
 
 #ifndef _GL_FCNTL_H
-#define _GL_FCNTL_H
 
 #include <sys/types.h>
 #include <sys/stat.h>
 #include <unistd.h>
-#include @ABSOLUTE_FCNTL_H@
+/* The include_next requires a split double-inclusion guard.  */
address@hidden@ @NEXT_FCNTL_H@
+
+#ifndef _GL_FCNTL_H
+#define _GL_FCNTL_H
+
+
+/* Declare overridden functions.  */
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#ifdef FCHDIR_REPLACEMENT
+# define open rpl_open
+extern int open (const char *, int, ...);
+#endif
+
+#ifdef __cplusplus
+}
+#endif
+
+
+/* Fix up the O_* macros.  */
 
 #if !defined O_DIRECT && defined O_DIRECTIO
 /* Tru64 spells it `O_DIRECTIO'.  */
@@ -59,9 +81,6 @@
 # define O_NOCTTY 0
 #endif
 
-#ifdef O_NOFOLLOW_IS_INEFFECTIVE
-# undef O_NOFOLLOW
-#endif
 #ifndef O_NOFOLLOW
 # define O_NOFOLLOW 0
 #endif
@@ -97,4 +116,6 @@
 # define O_TEXT 0
 #endif
 
-#endif
+
+#endif /* _GL_FCNTL_H */
+#endif /* _GL_FCNTL_H */

Index: filenamecat.c
===================================================================
RCS file: /cvsroot/cvs/ccvs/lib/filenamecat.c,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -b -r1.4 -r1.5
--- filenamecat.c       22 Sep 2006 17:54:39 -0000      1.4
+++ filenamecat.c       22 Aug 2007 12:48:39 -0000      1.5
@@ -1,7 +1,6 @@
 /* Concatenate two arbitrary file names.
 
-   Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004,
-   2005, 2006 Free Software Foundation, Inc.
+   Copyright (C) 1996-2007 Free Software Foundation, Inc.
 
    This program is free software; you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
@@ -24,6 +23,7 @@
 /* Specification.  */
 #include "filenamecat.h"
 
+#include <stdlib.h>
 #include <string.h>
 
 #include "dirname.h"
@@ -57,10 +57,10 @@
    set *BASE_IN_RESULT to point to the sole corresponding slash that
    is copied into the result buffer.
 
-   Report an error if memory is exhausted.  */
+   Return NULL if malloc fails.  */
 
 char *
-file_name_concat (char const *dir, char const *abase, char **base_in_result)
+mfile_name_concat (char const *dir, char const *abase, char **base_in_result)
 {
   char const *dirbase = last_component (dir);
   size_t dirbaselen = base_len (dirbase);
@@ -70,9 +70,12 @@
   char const *base = longest_relative_suffix (abase);
   size_t baselen = strlen (base);
 
-  char *p_concat = xmalloc (dirlen + needs_separator + baselen + 1);
+  char *p_concat = malloc (dirlen + needs_separator + baselen + 1);
   char *p;
 
+  if (p_concat == NULL)
+    return NULL;
+
   p = mempcpy (p_concat, dir, dirlen);
   *p = DIRECTORY_SEPARATOR;
   p += needs_separator;
@@ -86,6 +89,19 @@
   return p_concat;
 }
 
+/* Just like mfile_name_concat, above, except, rather than
+   returning NULL upon malloc failure, here, we report the
+   "memory exhausted" condition and exit.  */
+
+char *
+file_name_concat (char const *dir, char const *abase, char **base_in_result)
+{
+  char *p = mfile_name_concat (dir, abase, base_in_result);
+  if (p == NULL)
+    xalloc_die ();
+  return p;
+}
+
 #ifdef TEST_FILE_NAME_CONCAT
 # include <stdlib.h>
 # include <stdio.h>

Index: filenamecat.h
===================================================================
RCS file: /cvsroot/cvs/ccvs/lib/filenamecat.h,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -b -r1.1 -r1.2
--- filenamecat.h       10 Jun 2005 20:30:20 -0000      1.1
+++ filenamecat.h       22 Aug 2007 12:48:39 -0000      1.2
@@ -1,6 +1,6 @@
 /* Concatenate two arbitrary file names.
 
-   Copyright (C) 1996, 1997, 2003, 2005 Free Software Foundation, Inc.
+   Copyright (C) 1996, 1997, 2003, 2005, 2007 Free Software Foundation, Inc.
 
    This program is free software; you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
@@ -20,3 +20,6 @@
 
 char *file_name_concat (char const *dir, char const *base,
                        char **base_in_result);
+
+char *mfile_name_concat (char const *dir, char const *base,
+                        char **base_in_result);

Index: fnmatch.c
===================================================================
RCS file: /cvsroot/cvs/ccvs/lib/fnmatch.c,v
retrieving revision 1.17
retrieving revision 1.18
diff -u -b -r1.17 -r1.18
--- fnmatch.c   22 Sep 2006 17:54:39 -0000      1.17
+++ fnmatch.c   22 Aug 2007 12:48:39 -0000      1.18
@@ -1,4 +1,4 @@
-/* Copyright (C) 
1991,1992,1993,1996,1997,1998,1999,2000,2001,2002,2003,2004,2005,2006
+/* Copyright (C) 
1991,1992,1993,1996,1997,1998,1999,2000,2001,2002,2003,2004,2005,2006,2007
        Free Software Foundation, Inc.
 
    This program is free software; you can redistribute it and/or modify
@@ -40,15 +40,14 @@
 #include <string.h>
 
 #define WIDE_CHAR_SUPPORT \
-  (HAVE_WCTYPE_H && HAVE_WCHAR_H && HAVE_BTOWC \
+  (HAVE_WCTYPE_H && HAVE_BTOWC && HAVE_ISWCTYPE \
    && HAVE_WMEMCHR && (HAVE_WMEMCPY || HAVE_WMEMPCPY))
 
 /* For platform which support the ISO C amendement 1 functionality we
    support user defined character classes.  */
 #if defined _LIBC || WIDE_CHAR_SUPPORT
-/* Solaris 2.5 has a bug: <wchar.h> must be included before <wctype.h>.  */
-# include <wchar.h>
 # include <wctype.h>
+# include <wchar.h>
 #endif
 
 /* We need some of the locale data (the collation sequence information)
@@ -86,7 +85,7 @@
 #if defined _LIBC || !defined __GNU_LIBRARY__ || !HAVE_FNMATCH_GNU
 
 
-# if ! (defined isblank || HAVE_DECL_ISBLANK)
+# if ! (defined isblank || (HAVE_ISBLANK && HAVE_DECL_ISBLANK))
 #  define isblank(c) ((c) == ' ' || (c) == '\t')
 # endif
 

Index: fnmatch_.h
===================================================================
RCS file: /cvsroot/cvs/ccvs/lib/fnmatch_.h,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -b -r1.3 -r1.4
--- fnmatch_.h  10 Jun 2005 20:30:20 -0000      1.3
+++ fnmatch_.h  22 Aug 2007 12:48:39 -0000      1.4
@@ -1,5 +1,7 @@
 /* Copyright (C) 1991, 1992, 1993, 1996, 1997, 1998, 1999, 2001, 2002, 2003,
-   2005 Free Software Foundation, Inc.
+   2005, 2007 Free Software Foundation, Inc.
+
+   This file is part of the GNU C Library.
 
    This program is free software; you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
@@ -16,48 +18,48 @@
    Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.  */
 
 #ifndef        _FNMATCH_H
-# define _FNMATCH_H    1
+#define        _FNMATCH_H      1
 
-# ifdef        __cplusplus
+#ifdef __cplusplus
 extern "C" {
-# endif
+#endif
 
 /* We #undef these before defining them because some losing systems
    (HP-UX A.08.07 for example) define these in <unistd.h>.  */
-# undef        FNM_PATHNAME
-# undef        FNM_NOESCAPE
-# undef        FNM_PERIOD
+#undef FNM_PATHNAME
+#undef FNM_NOESCAPE
+#undef FNM_PERIOD
 
 /* Bits set in the FLAGS argument to `fnmatch'.  */
-# define FNM_PATHNAME  (1 << 0) /* No wildcard can ever match `/'.  */
-# define FNM_NOESCAPE  (1 << 1) /* Backslashes don't quote special chars.  */
-# define FNM_PERIOD    (1 << 2) /* Leading `.' is matched only explicitly.  */
+#define        FNM_PATHNAME    (1 << 0) /* No wildcard can ever match `/'.  */
+#define        FNM_NOESCAPE    (1 << 1) /* Backslashes don't quote special 
chars.  */
+#define        FNM_PERIOD      (1 << 2) /* Leading `.' is matched only 
explicitly.  */
 
-# if !defined _POSIX_C_SOURCE || _POSIX_C_SOURCE < 2 || defined _GNU_SOURCE
+#if !defined _POSIX_C_SOURCE || _POSIX_C_SOURCE < 2 || defined _GNU_SOURCE
 #  define FNM_FILE_NAME         FNM_PATHNAME   /* Preferred GNU name.  */
 #  define FNM_LEADING_DIR (1 << 3)     /* Ignore `/...' after a match.  */
 #  define FNM_CASEFOLD  (1 << 4)       /* Compare without regard to case.  */
 #  define FNM_EXTMATCH  (1 << 5)       /* Use ksh-like extended matching. */
-# endif
+#endif
 
 /* Value returned by `fnmatch' if STRING does not match PATTERN.  */
-# define FNM_NOMATCH   1
+#define        FNM_NOMATCH     1
 
 /* This value is returned if the implementation does not support
    `fnmatch'.  Since this is not the case here it will never be
    returned but the conformance test suites still require the symbol
    to be defined.  */
-# ifdef _XOPEN_SOURCE
+#ifdef _XOPEN_SOURCE
 #  define FNM_NOSYS    (-1)
-# endif
+#endif
 
 /* Match NAME against the file name pattern PATTERN,
    returning zero if it matches, FNM_NOMATCH if not.  */
 extern int fnmatch (const char *__pattern, const char *__name,
                    int __flags);
 
-# ifdef        __cplusplus
+#ifdef __cplusplus
 }
-# endif
+#endif
 
 #endif /* fnmatch.h */

Index: fnmatch_loop.c
===================================================================
RCS file: /cvsroot/cvs/ccvs/lib/fnmatch_loop.c,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -b -r1.7 -r1.8
--- fnmatch_loop.c      7 Jul 2006 02:46:50 -0000       1.7
+++ fnmatch_loop.c      22 Aug 2007 12:48:39 -0000      1.8
@@ -1,5 +1,6 @@
 /* Copyright (C) 
1991,1992,1993,1996,1997,1998,1999,2000,2001,2002,2003,2004,2005,2006
        Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
 
    This program is free software; you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
@@ -233,8 +234,7 @@
                    c = FOLD ((UCHAR) *p);
                    ++p;
 
-                   if (c == fn)
-                     goto matched;
+                   goto normal_bracket;
                  }
                else if (c == L_('[') && *p == L_(':'))
                  {
@@ -494,14 +494,19 @@
 
                            idx = 0;
                            elem = hash % table_size;
-                           second = hash % (table_size - 2);
-                           while (symb_table[2 * elem] != 0)
+                           if (symb_table[2 * elem] != 0)
+                             {
+                               second = hash % (table_size - 2) + 1;
+
+                               do
                              {
                                /* First compare the hashing value.  */
                                if (symb_table[2 * elem] == hash
-                                   && c1 == extra[symb_table[2 * elem + 1]]
+                                       && (c1
+                                           == extra[symb_table[2 * elem + 1]])
                                    && memcmp (str,
-                                              &extra[symb_table[2 * elem + 1]
+                                                  &extra[symb_table[2 * elem
+                                                                    + 1]
                                                     + 1], c1) == 0)
                                  {
                                    /* Yep, this is the entry.  */
@@ -513,6 +518,8 @@
                                /* Next entry.  */
                                elem += second;
                              }
+                               while (symb_table[2 * elem] != 0);
+                             }
 
                            if (symb_table[2 * elem] != 0)
                              {
@@ -592,6 +599,12 @@
                        if (!is_range && c == fn)
                          goto matched;
 
+#if _LIBC
+                       /* This is needed if we goto normal_bracket; from
+                          outside of is_seqval's scope.  */
+                       is_seqval = false;
+#endif
+
                        cold = c;
                        c = *p++;
                      }
@@ -703,8 +716,11 @@
 
                                idx = 0;
                                elem = hash % table_size;
-                               second = hash % (table_size - 2);
-                               while (symb_table[2 * elem] != 0)
+                               if (symb_table[2 * elem] != 0)
+                                 {
+                                   second = hash % (table_size - 2) + 1;
+
+                                   do
                                  {
                                /* First compare the hashing value.  */
                                    if (symb_table[2 * elem] == hash
@@ -723,6 +739,8 @@
                                    /* Next entry.  */
                                    elem += second;
                                  }
+                                   while (symb_table[2 * elem] != 0);
+                                 }
 
                                if (symb_table[2 * elem] != 0)
                                  {

Index: ftruncate.c
===================================================================
RCS file: /cvsroot/cvs/ccvs/lib/ftruncate.c,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -b -r1.5 -r1.6
--- ftruncate.c 22 Sep 2006 17:54:39 -0000      1.5
+++ ftruncate.c 22 Aug 2007 12:48:39 -0000      1.6
@@ -3,6 +3,9 @@
 
 #include <config.h>
 
+/* Specification.  */
+#include <unistd.h>
+
 #include <sys/types.h>
 #include <fcntl.h>
 
@@ -21,7 +24,6 @@
 
 #  include <sys/stat.h>
 #  include <errno.h>
-#  include <unistd.h>
 
 int
 ftruncate (int fd, off_t length)
@@ -64,7 +66,7 @@
 }
 
 # else /* not F_CHSIZE nor F_FREESP */
-#  if HAVE_CHSIZE
+#  if HAVE_CHSIZE                      /* native Windows, e.g. mingw */
 
 int
 ftruncate (int fd, off_t length)

Index: gai_strerror.c
===================================================================
RCS file: /cvsroot/cvs/ccvs/lib/gai_strerror.c,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -b -r1.4 -r1.5
--- gai_strerror.c      22 Sep 2006 17:54:39 -0000      1.4
+++ gai_strerror.c      22 Aug 2007 12:48:39 -0000      1.5
@@ -52,6 +52,7 @@
     { EAI_SERVICE, N_("Servname not supported for ai_socktype") },
     { EAI_SOCKTYPE, N_("ai_socktype not supported") },
     { EAI_SYSTEM, N_("System error") },
+    { EAI_OVERFLOW, N_("Argument buffer too small") },
 #ifdef __USE_GNU
     { EAI_INPROGRESS, N_("Processing request in progress") },
     { EAI_CANCELED, N_("Request canceled") },

Index: getaddrinfo.c
===================================================================
RCS file: /cvsroot/cvs/ccvs/lib/getaddrinfo.c,v
retrieving revision 1.15
retrieving revision 1.16
diff -u -b -r1.15 -r1.16
--- getaddrinfo.c       22 Sep 2006 17:54:39 -0000      1.15
+++ getaddrinfo.c       22 Aug 2007 12:48:40 -0000      1.16
@@ -1,5 +1,6 @@
 /* Get address information (partial implementation).
-   Copyright (C) 1997, 2001, 2002, 2004, 2005, 2006 Free Software Foundation, 
Inc.
+   Copyright (C) 1997, 2001, 2002, 2004, 2005, 2006, 2007 Free Software
+   Foundation, Inc.
    Contributed by Simon Josefsson <address@hidden>.
 
    This program is free software; you can redistribute it and/or modify
@@ -16,9 +17,7 @@
    along with this program; if not, write to the Free Software Foundation,
    Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.  */
 
-#ifdef HAVE_CONFIG_H
-# include <config.h>
-#endif
+#include <config.h>
 
 #include "getaddrinfo.h"
 
@@ -29,9 +28,12 @@
 /* Get calloc. */
 #include <stdlib.h>
 
-/* Get memcpy. */
+/* Get memcpy, strdup. */
 #include <string.h>
 
+/* Get snprintf. */
+#include <stdio.h>
+
 #include <stdbool.h>
 
 #include "gettext.h"
@@ -39,8 +41,6 @@
 #define N_(String) String
 
 #include "inet_ntop.h"
-#include "snprintf.h"
-#include "strdup.h"
 
 /* BeOS has AF_INET, but not PF_INET.  */
 #ifndef PF_INET
@@ -179,7 +179,7 @@
       const char *proto =
        (hints && hints->ai_socktype == SOCK_DGRAM) ? "udp" : "tcp";
 
-      if (!(hints->ai_flags & AI_NUMERICSERV))
+      if (hints == NULL || !(hints->ai_flags & AI_NUMERICSERV))
        /* FIXME: Use getservbyname_r if available. */
        se = getservbyname (servname, proto);
 
@@ -405,10 +405,12 @@
 #if HAVE_IPV6
       case AF_INET6:
 #endif
-       if (snprintf (service, servicelen, "%d",
-                     ntohs (((const struct sockaddr_in *) sa)->sin_port))
-           + 1 > servicelen)
+       {
+         unsigned short int port
+           = ntohs (((const struct sockaddr_in *) sa)->sin_port);
+         if (servicelen <= snprintf (service, servicelen, "%u", port))
          return EAI_OVERFLOW;
+       }
        break;
       }
 

Index: getcwd.c
===================================================================
RCS file: /cvsroot/cvs/ccvs/lib/getcwd.c,v
retrieving revision 1.12
retrieving revision 1.13
diff -u -b -r1.12 -r1.13
--- getcwd.c    22 Sep 2006 17:54:39 -0000      1.12
+++ getcwd.c    22 Aug 2007 12:48:40 -0000      1.13
@@ -1,4 +1,4 @@
-/* Copyright (C) 1991,92,93,94,95,96,97,98,99,2004,2005,2006 Free Software
+/* Copyright (C) 1991,92,93,94,95,96,97,98,99,2004,2005,2006,2007 Free Software
    Foundation, Inc.
    This file is part of the GNU C Library.
 
@@ -18,7 +18,8 @@
 
 #if !_LIBC
 # include <config.h>
-# include "getcwd.h"
+# include <unistd.h>
+# include "dirfd.h"
 #endif
 
 #include <errno.h>
@@ -49,8 +50,6 @@
 # ifndef mempcpy
 #  define mempcpy __mempcpy
 # endif
-#else
-# include "mempcpy.h"
 #endif
 
 #include <limits.h>
@@ -98,6 +97,11 @@
 # define __readdir readdir
 #endif
 
+/* The results of opendir() in this file are not used with dirfd and fchdir,
+   therefore save some unnecessary recursion in fchdir.c.  */
+#undef opendir
+#undef closedir
+
 /* Get the name of the current working directory, and put it in SIZE
    bytes of BUF.  Returns NULL if the directory couldn't be determined or
    SIZE was too small.  If successful, returns BUF.  In GNU, if BUF is
@@ -137,13 +141,18 @@
   size_t allocated = size;
   size_t used;
 
-#if HAVE_PARTLY_WORKING_GETCWD && !defined AT_FDCWD
+#if HAVE_PARTLY_WORKING_GETCWD
   /* The system getcwd works, except it sometimes fails when it
      shouldn't, setting errno to ERANGE, ENAMETOOLONG, or ENOENT.  If
      AT_FDCWD is not defined, the algorithm below is O(N**2) and this
      is much slower than the system getcwd (at least on GNU/Linux).
      So trust the system getcwd's results unless they look
-     suspicious.  */
+     suspicious.
+
+     Use the system getcwd even if we have openat support, since the
+     system getcwd works even when a parent is unreadable, while the
+     openat-based approach does not.  */
+
 # undef getcwd
   dir = getcwd (buf, size);
   if (dir || (errno != ERANGE && !is_ENAMETOOLONG (errno) && errno != ENOENT))
@@ -226,6 +235,8 @@
       dirstream = fdopendir (fd);
       if (dirstream == NULL)
        goto lose;
+      /* Reset fd.  It may have been closed by fdopendir.  */
+      fd = dirfd (dirstream);
       fd_needs_closing = false;
 #else
       dirstream = __opendir (dotlist);
@@ -380,7 +391,7 @@
   used = dir + allocated - dirp;
   memmove (dir, dirp, used);
 
-  if (buf == NULL && size == 0)
+  if (size == 0)
     /* Ensure that the buffer is only as large as necessary.  */
     buf = realloc (dir, used);
 

Index: getdate.c
===================================================================
RCS file: /cvsroot/cvs/ccvs/lib/getdate.c,v
retrieving revision 1.48
retrieving revision 1.49
diff -u -b -r1.48 -r1.49
--- getdate.c   22 Sep 2006 17:54:39 -0000      1.48
+++ getdate.c   22 Aug 2007 12:48:40 -0000      1.49
@@ -106,7 +106,7 @@
 
 /* Parse a string into an internal time stamp.
 
-   Copyright (C) 1999, 2000, 2002, 2003, 2004, 2005, 2006 Free Software
+   Copyright (C) 1999, 2000, 2002, 2003, 2004, 2005, 2006, 2007 Free Software
    Foundation, Inc.
 
    This program is free software; you can redistribute it and/or modify
@@ -141,6 +141,10 @@
 
 #include "getdate.h"
 
+#include "intprops.h"
+#include "timespec.h"
+#include "verify.h"
+
 /* There's no need to extend the stack, so there's no need to involve
    alloca.  */
 #define YYSTACK_USE_ALLOCA 0
@@ -211,6 +215,13 @@
 
 #define HOUR(x) ((x) * 60)
 
+/* Lots of this code assumes time_t and time_t-like values fit into
+   long int.  It also assumes that signed integer overflow silently
+   wraps around, but there's no portable way to check for that at
+   compile-time.  */
+verify (TYPE_IS_INTEGER (time_t));
+verify (LONG_MIN <= TYPE_MINIMUM (time_t) && TYPE_MAXIMUM (time_t) <= 
LONG_MAX);
+
 /* An integer value, and the number of digits in its textual
    representation.  */
 typedef struct
@@ -300,7 +311,7 @@
 
 union YYSTYPE;
 static int yylex (union YYSTYPE *, parser_control *);
-static int yyerror (parser_control *, char *);
+static int yyerror (parser_control const *, char const *);
 static long int time_zone_hhmm (textint, long int);
 
 
@@ -324,7 +335,7 @@
 #endif
 
 #if ! defined (YYSTYPE) && ! defined (YYSTYPE_IS_DECLARED)
-#line 213 "getdate.y"
+#line 224 "getdate.y"
 typedef union YYSTYPE {
   long int intval;
   textint textintval;
@@ -332,7 +343,7 @@
   relative_time rel;
 } YYSTYPE;
 /* Line 196 of yacc.c.  */
-#line 336 "getdate.tab.c"
+#line 347 "getdate.c"
 # define yystype YYSTYPE /* obsolescent; will be withdrawn */
 # define YYSTYPE_IS_DECLARED 1
 # define YYSTYPE_IS_TRIVIAL 1
@@ -344,7 +355,7 @@
 
 
 /* Line 219 of yacc.c.  */
-#line 348 "getdate.tab.c"
+#line 359 "getdate.c"
 
 #if ! defined (YYSIZE_T) && defined (__SIZE_TYPE__)
 # define YYSIZE_T __SIZE_TYPE__
@@ -592,14 +603,14 @@
 /* YYRLINE[YYN] -- source line where rule number YYN was defined.  */
 static const unsigned short int yyrline[] =
 {
-       0,   239,   239,   240,   244,   251,   253,   257,   259,   261,
-     263,   265,   267,   269,   273,   281,   289,   299,   306,   318,
-     323,   331,   333,   343,   345,   347,   352,   357,   362,   367,
-     375,   380,   400,   407,   415,   423,   428,   434,   439,   448,
-     458,   471,   473,   475,   477,   479,   481,   483,   485,   487,
-     489,   491,   493,   495,   497,   499,   501,   503,   505,   507,
-     509,   511,   515,   517,   519,   521,   523,   525,   529,   529,
-     532,   533,   538,   539,   544,   582,   583,   589,   590
+       0,   250,   250,   251,   255,   262,   264,   268,   270,   272,
+     274,   276,   278,   280,   284,   292,   300,   310,   317,   329,
+     334,   342,   344,   354,   356,   358,   363,   368,   373,   378,
+     386,   391,   411,   418,   426,   434,   439,   445,   450,   459,
+     469,   482,   484,   486,   488,   490,   492,   494,   496,   498,
+     500,   502,   504,   506,   508,   510,   512,   514,   516,   518,
+     520,   522,   526,   528,   530,   532,   534,   536,   540,   540,
+     543,   544,   549,   550,   555,   593,   594,   600,   601
 };
 #endif
 
@@ -1420,67 +1431,67 @@
   switch (yyn)
     {
         case 4:
-#line 245 "getdate.y"
+#line 256 "getdate.y"
     {
        pc->seconds = (yyvsp[0].timespec);
        pc->timespec_seen = true;
-      ;}
+      }
     break;
 
   case 7:
-#line 258 "getdate.y"
-    { pc->times_seen++; ;}
+#line 269 "getdate.y"
+    { pc->times_seen++; }
     break;
 
   case 8:
-#line 260 "getdate.y"
-    { pc->local_zones_seen++; ;}
+#line 271 "getdate.y"
+    { pc->local_zones_seen++; }
     break;
 
   case 9:
-#line 262 "getdate.y"
-    { pc->zones_seen++; ;}
+#line 273 "getdate.y"
+    { pc->zones_seen++; }
     break;
 
   case 10:
-#line 264 "getdate.y"
-    { pc->dates_seen++; ;}
+#line 275 "getdate.y"
+    { pc->dates_seen++; }
     break;
 
   case 11:
-#line 266 "getdate.y"
-    { pc->days_seen++; ;}
+#line 277 "getdate.y"
+    { pc->days_seen++; }
     break;
 
   case 12:
-#line 268 "getdate.y"
-    { pc->rels_seen = true; ;}
+#line 279 "getdate.y"
+    { pc->rels_seen = true; }
     break;
 
   case 14:
-#line 274 "getdate.y"
+#line 285 "getdate.y"
     {
        pc->hour = (yyvsp[-1].textintval).value;
        pc->minutes = 0;
        pc->seconds.tv_sec = 0;
        pc->seconds.tv_nsec = 0;
        pc->meridian = (yyvsp[0].intval);
-      ;}
+      }
     break;
 
   case 15:
-#line 282 "getdate.y"
+#line 293 "getdate.y"
     {
        pc->hour = (yyvsp[-3].textintval).value;
        pc->minutes = (yyvsp[-1].textintval).value;
        pc->seconds.tv_sec = 0;
        pc->seconds.tv_nsec = 0;
        pc->meridian = (yyvsp[0].intval);
-      ;}
+      }
     break;
 
   case 16:
-#line 290 "getdate.y"
+#line 301 "getdate.y"
     {
        pc->hour = (yyvsp[-4].textintval).value;
        pc->minutes = (yyvsp[-2].textintval).value;
@@ -1489,21 +1500,21 @@
        pc->meridian = MER24;
        pc->zones_seen++;
        pc->time_zone = time_zone_hhmm ((yyvsp[-1].textintval), 
(yyvsp[0].intval));
-      ;}
+      }
     break;
 
   case 17:
-#line 300 "getdate.y"
+#line 311 "getdate.y"
     {
        pc->hour = (yyvsp[-5].textintval).value;
        pc->minutes = (yyvsp[-3].textintval).value;
        pc->seconds = (yyvsp[-1].timespec);
        pc->meridian = (yyvsp[0].intval);
-      ;}
+      }
     break;
 
   case 18:
-#line 307 "getdate.y"
+#line 318 "getdate.y"
     {
        pc->hour = (yyvsp[-6].textintval).value;
        pc->minutes = (yyvsp[-4].textintval).value;
@@ -1511,32 +1522,32 @@
        pc->meridian = MER24;
        pc->zones_seen++;
        pc->time_zone = time_zone_hhmm ((yyvsp[-1].textintval), 
(yyvsp[0].intval));
-      ;}
+      }
     break;
 
   case 19:
-#line 319 "getdate.y"
+#line 330 "getdate.y"
     {
        pc->local_isdst = (yyvsp[0].intval);
        pc->dsts_seen += (0 < (yyvsp[0].intval));
-      ;}
+      }
     break;
 
   case 20:
-#line 324 "getdate.y"
+#line 335 "getdate.y"
     {
        pc->local_isdst = 1;
        pc->dsts_seen += (0 < (yyvsp[-1].intval)) + 1;
-      ;}
+      }
     break;
 
   case 21:
-#line 332 "getdate.y"
-    { pc->time_zone = (yyvsp[0].intval); ;}
+#line 343 "getdate.y"
+    { pc->time_zone = (yyvsp[0].intval); }
     break;
 
   case 22:
-#line 334 "getdate.y"
+#line 345 "getdate.y"
     { pc->time_zone = (yyvsp[-1].intval);
        pc->rel.ns += (yyvsp[0].rel).ns;
        pc->rel.seconds += (yyvsp[0].rel).seconds;
@@ -1545,66 +1556,66 @@
        pc->rel.day += (yyvsp[0].rel).day;
        pc->rel.month += (yyvsp[0].rel).month;
        pc->rel.year += (yyvsp[0].rel).year;
-        pc->rels_seen = true; ;}
+        pc->rels_seen = true; }
     break;
 
   case 23:
-#line 344 "getdate.y"
-    { pc->time_zone = (yyvsp[-2].intval) + time_zone_hhmm 
((yyvsp[-1].textintval), (yyvsp[0].intval)); ;}
+#line 355 "getdate.y"
+    { pc->time_zone = (yyvsp[-2].intval) + time_zone_hhmm 
((yyvsp[-1].textintval), (yyvsp[0].intval)); }
     break;
 
   case 24:
-#line 346 "getdate.y"
-    { pc->time_zone = (yyvsp[0].intval) + 60; ;}
+#line 357 "getdate.y"
+    { pc->time_zone = (yyvsp[0].intval) + 60; }
     break;
 
   case 25:
-#line 348 "getdate.y"
-    { pc->time_zone = (yyvsp[-1].intval) + 60; ;}
+#line 359 "getdate.y"
+    { pc->time_zone = (yyvsp[-1].intval) + 60; }
     break;
 
   case 26:
-#line 353 "getdate.y"
+#line 364 "getdate.y"
     {
        pc->day_ordinal = 1;
        pc->day_number = (yyvsp[0].intval);
-      ;}
+      }
     break;
 
   case 27:
-#line 358 "getdate.y"
+#line 369 "getdate.y"
     {
        pc->day_ordinal = 1;
        pc->day_number = (yyvsp[-1].intval);
-      ;}
+      }
     break;
 
   case 28:
-#line 363 "getdate.y"
+#line 374 "getdate.y"
     {
        pc->day_ordinal = (yyvsp[-1].intval);
        pc->day_number = (yyvsp[0].intval);
-      ;}
+      }
     break;
 
   case 29:
-#line 368 "getdate.y"
+#line 379 "getdate.y"
     {
        pc->day_ordinal = (yyvsp[-1].textintval).value;
        pc->day_number = (yyvsp[0].intval);
-      ;}
+      }
     break;
 
   case 30:
-#line 376 "getdate.y"
+#line 387 "getdate.y"
     {
        pc->month = (yyvsp[-2].textintval).value;
        pc->day = (yyvsp[0].textintval).value;
-      ;}
+      }
     break;
 
   case 31:
-#line 381 "getdate.y"
+#line 392 "getdate.y"
     {
        /* Interpret as YYYY/MM/DD if the first value has 4 or more digits,
           otherwise as MM/DD/YY.
@@ -1623,77 +1634,77 @@
            pc->day = (yyvsp[-2].textintval).value;
            pc->year = (yyvsp[0].textintval);
          }
-      ;}
+      }
     break;
 
   case 32:
-#line 401 "getdate.y"
+#line 412 "getdate.y"
     {
        /* ISO 8601 format.  YYYY-MM-DD.  */
        pc->year = (yyvsp[-2].textintval);
        pc->month = -(yyvsp[-1].textintval).value;
        pc->day = -(yyvsp[0].textintval).value;
-      ;}
+      }
     break;
 
   case 33:
-#line 408 "getdate.y"
+#line 419 "getdate.y"
     {
        /* e.g. 17-JUN-1992.  */
        pc->day = (yyvsp[-2].textintval).value;
        pc->month = (yyvsp[-1].intval);
        pc->year.value = -(yyvsp[0].textintval).value;
        pc->year.digits = (yyvsp[0].textintval).digits;
-      ;}
+      }
     break;
 
   case 34:
-#line 416 "getdate.y"
+#line 427 "getdate.y"
     {
        /* e.g. JUN-17-1992.  */
        pc->month = (yyvsp[-2].intval);
        pc->day = -(yyvsp[-1].textintval).value;
        pc->year.value = -(yyvsp[0].textintval).value;
        pc->year.digits = (yyvsp[0].textintval).digits;
-      ;}
+      }
     break;
 
   case 35:
-#line 424 "getdate.y"
+#line 435 "getdate.y"
     {
        pc->month = (yyvsp[-1].intval);
        pc->day = (yyvsp[0].textintval).value;
-      ;}
+      }
     break;
 
   case 36:
-#line 429 "getdate.y"
+#line 440 "getdate.y"
     {
        pc->month = (yyvsp[-3].intval);
        pc->day = (yyvsp[-2].textintval).value;
        pc->year = (yyvsp[0].textintval);
-      ;}
+      }
     break;
 
   case 37:
-#line 435 "getdate.y"
+#line 446 "getdate.y"
     {
        pc->day = (yyvsp[-1].textintval).value;
        pc->month = (yyvsp[0].intval);
-      ;}
+      }
     break;
 
   case 38:
-#line 440 "getdate.y"
+#line 451 "getdate.y"
     {
        pc->day = (yyvsp[-2].textintval).value;
        pc->month = (yyvsp[-1].intval);
        pc->year = (yyvsp[0].textintval);
-      ;}
+      }
     break;
 
   case 39:
-#line 449 "getdate.y"
+#line 460 "getdate.y"
     {
        pc->rel.ns -= (yyvsp[-1].rel).ns;
        pc->rel.seconds -= (yyvsp[-1].rel).seconds;
@@ -1702,11 +1713,11 @@
        pc->rel.day -= (yyvsp[-1].rel).day;
        pc->rel.month -= (yyvsp[-1].rel).month;
        pc->rel.year -= (yyvsp[-1].rel).year;
-      ;}
+      }
     break;
 
   case 40:
-#line 459 "getdate.y"
+#line 470 "getdate.y"
     {
        pc->rel.ns += (yyvsp[0].rel).ns;
        pc->rel.seconds += (yyvsp[0].rel).seconds;
@@ -1715,151 +1726,151 @@
        pc->rel.day += (yyvsp[0].rel).day;
        pc->rel.month += (yyvsp[0].rel).month;
        pc->rel.year += (yyvsp[0].rel).year;
-      ;}
+      }
     break;
 
   case 41:
-#line 472 "getdate.y"
-    { (yyval.rel) = RELATIVE_TIME_0; (yyval.rel).year = (yyvsp[-1].intval); ;}
+#line 483 "getdate.y"
+    { (yyval.rel) = RELATIVE_TIME_0; (yyval.rel).year = (yyvsp[-1].intval); }
     break;
 
   case 42:
-#line 474 "getdate.y"
-    { (yyval.rel) = RELATIVE_TIME_0; (yyval.rel).year = 
(yyvsp[-1].textintval).value; ;}
+#line 485 "getdate.y"
+    { (yyval.rel) = RELATIVE_TIME_0; (yyval.rel).year = 
(yyvsp[-1].textintval).value; }
     break;
 
   case 43:
-#line 476 "getdate.y"
-    { (yyval.rel) = RELATIVE_TIME_0; (yyval.rel).year = 1; ;}
+#line 487 "getdate.y"
+    { (yyval.rel) = RELATIVE_TIME_0; (yyval.rel).year = 1; }
     break;
 
   case 44:
-#line 478 "getdate.y"
-    { (yyval.rel) = RELATIVE_TIME_0; (yyval.rel).month = (yyvsp[-1].intval); ;}
+#line 489 "getdate.y"
+    { (yyval.rel) = RELATIVE_TIME_0; (yyval.rel).month = (yyvsp[-1].intval); }
     break;
 
   case 45:
-#line 480 "getdate.y"
-    { (yyval.rel) = RELATIVE_TIME_0; (yyval.rel).month = 
(yyvsp[-1].textintval).value; ;}
+#line 491 "getdate.y"
+    { (yyval.rel) = RELATIVE_TIME_0; (yyval.rel).month = 
(yyvsp[-1].textintval).value; }
     break;
 
   case 46:
-#line 482 "getdate.y"
-    { (yyval.rel) = RELATIVE_TIME_0; (yyval.rel).month = 1; ;}
+#line 493 "getdate.y"
+    { (yyval.rel) = RELATIVE_TIME_0; (yyval.rel).month = 1; }
     break;
 
   case 47:
-#line 484 "getdate.y"
-    { (yyval.rel) = RELATIVE_TIME_0; (yyval.rel).day = (yyvsp[-1].intval) * 
(yyvsp[0].intval); ;}
+#line 495 "getdate.y"
+    { (yyval.rel) = RELATIVE_TIME_0; (yyval.rel).day = (yyvsp[-1].intval) * 
(yyvsp[0].intval); }
     break;
 
   case 48:
-#line 486 "getdate.y"
-    { (yyval.rel) = RELATIVE_TIME_0; (yyval.rel).day = 
(yyvsp[-1].textintval).value * (yyvsp[0].intval); ;}
+#line 497 "getdate.y"
+    { (yyval.rel) = RELATIVE_TIME_0; (yyval.rel).day = 
(yyvsp[-1].textintval).value * (yyvsp[0].intval); }
     break;
 
   case 49:
-#line 488 "getdate.y"
-    { (yyval.rel) = RELATIVE_TIME_0; (yyval.rel).day = (yyvsp[0].intval); ;}
+#line 499 "getdate.y"
+    { (yyval.rel) = RELATIVE_TIME_0; (yyval.rel).day = (yyvsp[0].intval); }
     break;
 
   case 50:
-#line 490 "getdate.y"
-    { (yyval.rel) = RELATIVE_TIME_0; (yyval.rel).hour = (yyvsp[-1].intval); ;}
+#line 501 "getdate.y"
+    { (yyval.rel) = RELATIVE_TIME_0; (yyval.rel).hour = (yyvsp[-1].intval); }
     break;
 
   case 51:
-#line 492 "getdate.y"
-    { (yyval.rel) = RELATIVE_TIME_0; (yyval.rel).hour = 
(yyvsp[-1].textintval).value; ;}
+#line 503 "getdate.y"
+    { (yyval.rel) = RELATIVE_TIME_0; (yyval.rel).hour = 
(yyvsp[-1].textintval).value; }
     break;
 
   case 52:
-#line 494 "getdate.y"
-    { (yyval.rel) = RELATIVE_TIME_0; (yyval.rel).hour = 1; ;}
+#line 505 "getdate.y"
+    { (yyval.rel) = RELATIVE_TIME_0; (yyval.rel).hour = 1; }
     break;
 
   case 53:
-#line 496 "getdate.y"
-    { (yyval.rel) = RELATIVE_TIME_0; (yyval.rel).minutes = (yyvsp[-1].intval); 
;}
+#line 507 "getdate.y"
+    { (yyval.rel) = RELATIVE_TIME_0; (yyval.rel).minutes = (yyvsp[-1].intval); 
}
     break;
 
   case 54:
-#line 498 "getdate.y"
-    { (yyval.rel) = RELATIVE_TIME_0; (yyval.rel).minutes = 
(yyvsp[-1].textintval).value; ;}
+#line 509 "getdate.y"
+    { (yyval.rel) = RELATIVE_TIME_0; (yyval.rel).minutes = 
(yyvsp[-1].textintval).value; }
     break;
 
   case 55:
-#line 500 "getdate.y"
-    { (yyval.rel) = RELATIVE_TIME_0; (yyval.rel).minutes = 1; ;}
+#line 511 "getdate.y"
+    { (yyval.rel) = RELATIVE_TIME_0; (yyval.rel).minutes = 1; }
     break;
 
   case 56:
-#line 502 "getdate.y"
-    { (yyval.rel) = RELATIVE_TIME_0; (yyval.rel).seconds = (yyvsp[-1].intval); 
;}
+#line 513 "getdate.y"
+    { (yyval.rel) = RELATIVE_TIME_0; (yyval.rel).seconds = (yyvsp[-1].intval); 
}
     break;
 
   case 57:
-#line 504 "getdate.y"
-    { (yyval.rel) = RELATIVE_TIME_0; (yyval.rel).seconds = 
(yyvsp[-1].textintval).value; ;}
+#line 515 "getdate.y"
+    { (yyval.rel) = RELATIVE_TIME_0; (yyval.rel).seconds = 
(yyvsp[-1].textintval).value; }
     break;
 
   case 58:
-#line 506 "getdate.y"
-    { (yyval.rel) = RELATIVE_TIME_0; (yyval.rel).seconds = 
(yyvsp[-1].timespec).tv_sec; (yyval.rel).ns = (yyvsp[-1].timespec).tv_nsec; ;}
+#line 517 "getdate.y"
+    { (yyval.rel) = RELATIVE_TIME_0; (yyval.rel).seconds = 
(yyvsp[-1].timespec).tv_sec; (yyval.rel).ns = (yyvsp[-1].timespec).tv_nsec; }
     break;
 
   case 59:
-#line 508 "getdate.y"
-    { (yyval.rel) = RELATIVE_TIME_0; (yyval.rel).seconds = 
(yyvsp[-1].timespec).tv_sec; (yyval.rel).ns = (yyvsp[-1].timespec).tv_nsec; ;}
+#line 519 "getdate.y"
+    { (yyval.rel) = RELATIVE_TIME_0; (yyval.rel).seconds = 
(yyvsp[-1].timespec).tv_sec; (yyval.rel).ns = (yyvsp[-1].timespec).tv_nsec; }
     break;
 
   case 60:
-#line 510 "getdate.y"
-    { (yyval.rel) = RELATIVE_TIME_0; (yyval.rel).seconds = 1; ;}
+#line 521 "getdate.y"
+    { (yyval.rel) = RELATIVE_TIME_0; (yyval.rel).seconds = 1; }
     break;
 
   case 62:
-#line 516 "getdate.y"
-    { (yyval.rel) = RELATIVE_TIME_0; (yyval.rel).year = 
(yyvsp[-1].textintval).value; ;}
+#line 527 "getdate.y"
+    { (yyval.rel) = RELATIVE_TIME_0; (yyval.rel).year = 
(yyvsp[-1].textintval).value; }
     break;
 
   case 63:
-#line 518 "getdate.y"
-    { (yyval.rel) = RELATIVE_TIME_0; (yyval.rel).month = 
(yyvsp[-1].textintval).value; ;}
+#line 529 "getdate.y"
+    { (yyval.rel) = RELATIVE_TIME_0; (yyval.rel).month = 
(yyvsp[-1].textintval).value; }
     break;
 
   case 64:
-#line 520 "getdate.y"
-    { (yyval.rel) = RELATIVE_TIME_0; (yyval.rel).day = 
(yyvsp[-1].textintval).value * (yyvsp[0].intval); ;}
+#line 531 "getdate.y"
+    { (yyval.rel) = RELATIVE_TIME_0; (yyval.rel).day = 
(yyvsp[-1].textintval).value * (yyvsp[0].intval); }
     break;
 
   case 65:
-#line 522 "getdate.y"
-    { (yyval.rel) = RELATIVE_TIME_0; (yyval.rel).hour = 
(yyvsp[-1].textintval).value; ;}
+#line 533 "getdate.y"
+    { (yyval.rel) = RELATIVE_TIME_0; (yyval.rel).hour = 
(yyvsp[-1].textintval).value; }
     break;
 
   case 66:
-#line 524 "getdate.y"
-    { (yyval.rel) = RELATIVE_TIME_0; (yyval.rel).minutes = 
(yyvsp[-1].textintval).value; ;}
+#line 535 "getdate.y"
+    { (yyval.rel) = RELATIVE_TIME_0; (yyval.rel).minutes = 
(yyvsp[-1].textintval).value; }
     break;
 
   case 67:
-#line 526 "getdate.y"
-    { (yyval.rel) = RELATIVE_TIME_0; (yyval.rel).seconds = 
(yyvsp[-1].textintval).value; ;}
+#line 537 "getdate.y"
+    { (yyval.rel) = RELATIVE_TIME_0; (yyval.rel).seconds = 
(yyvsp[-1].textintval).value; }
     break;
 
   case 71:
-#line 534 "getdate.y"
-    { (yyval.timespec).tv_sec = (yyvsp[0].textintval).value; 
(yyval.timespec).tv_nsec = 0; ;}
+#line 545 "getdate.y"
+    { (yyval.timespec).tv_sec = (yyvsp[0].textintval).value; 
(yyval.timespec).tv_nsec = 0; }
     break;
 
   case 73:
-#line 540 "getdate.y"
-    { (yyval.timespec).tv_sec = (yyvsp[0].textintval).value; 
(yyval.timespec).tv_nsec = 0; ;}
+#line 551 "getdate.y"
+    { (yyval.timespec).tv_sec = (yyvsp[0].textintval).value; 
(yyval.timespec).tv_nsec = 0; }
     break;
 
   case 74:
-#line 545 "getdate.y"
+#line 556 "getdate.y"
     {
        if (pc->dates_seen && ! pc->year.digits
            && ! pc->rels_seen && (pc->times_seen || 2 < 
(yyvsp[0].textintval).digits))
@@ -1892,27 +1903,27 @@
                pc->meridian = MER24;
              }
          }
-      ;}
+      }
     break;
 
   case 75:
-#line 582 "getdate.y"
-    { (yyval.intval) = -1; ;}
+#line 593 "getdate.y"
+    { (yyval.intval) = -1; }
     break;
 
   case 76:
-#line 584 "getdate.y"
-    { (yyval.intval) = (yyvsp[0].textintval).value; ;}
+#line 595 "getdate.y"
+    { (yyval.intval) = (yyvsp[0].textintval).value; }
     break;
 
   case 77:
-#line 589 "getdate.y"
-    { (yyval.intval) = MER24; ;}
+#line 600 "getdate.y"
+    { (yyval.intval) = MER24; }
     break;
 
   case 78:
-#line 591 "getdate.y"
-    { (yyval.intval) = (yyvsp[0].intval); ;}
+#line 602 "getdate.y"
+    { (yyval.intval) = (yyvsp[0].intval); }
     break;
 
 
@@ -1920,7 +1931,7 @@
     }
 
 /* Line 1126 of yacc.c.  */
-#line 1924 "getdate.tab.c"
+#line 1935 "getdate.c"
 
   yyvsp -= yylen;
   yyssp -= yylen;
@@ -2188,7 +2199,7 @@
 }
 
 
-#line 594 "getdate.y"
+#line 605 "getdate.y"
 
 
 static table const meridian_table[] =
@@ -2704,7 +2715,8 @@
 
 /* Do nothing if the parser reports an error.  */
 static int
-yyerror (parser_control *pc ATTRIBUTE_UNUSED, char *s ATTRIBUTE_UNUSED)
+yyerror (parser_control const *pc ATTRIBUTE_UNUSED,
+        char const *s ATTRIBUTE_UNUSED)
 {
   return 0;
 }

Index: getdate.h
===================================================================
RCS file: /cvsroot/cvs/ccvs/lib/getdate.h,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -b -r1.3 -r1.4
--- getdate.h   19 Sep 2005 21:26:13 -0000      1.3
+++ getdate.h   22 Aug 2007 12:48:40 -0000      1.4
@@ -1,6 +1,7 @@
 /* Parse a string into an internal time stamp.
 
-   Copyright (C) 1995, 1997, 1998, 2003, 2004 Free Software Foundation, Inc.
+   Copyright (C) 1995, 1997, 1998, 2003, 2004, 2007 Free Software
+   Foundation, Inc.
 
    This program is free software; you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
@@ -17,6 +18,6 @@
    Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.  */
 
 #include <stdbool.h>
-#include "timespec.h"
+#include <time.h>
 
 bool get_date (struct timespec *, char const *, struct timespec const *);

Index: getdate.y
===================================================================
RCS file: /cvsroot/cvs/ccvs/lib/getdate.y,v
retrieving revision 1.39
retrieving revision 1.40
diff -u -b -r1.39 -r1.40
--- getdate.y   22 Sep 2006 17:54:39 -0000      1.39
+++ getdate.y   22 Aug 2007 12:48:40 -0000      1.40
@@ -1,7 +1,7 @@
 %{
 /* Parse a string into an internal time stamp.
 
-   Copyright (C) 1999, 2000, 2002, 2003, 2004, 2005, 2006 Free Software
+   Copyright (C) 1999, 2000, 2002, 2003, 2004, 2005, 2006, 2007 Free Software
    Foundation, Inc.
 
    This program is free software; you can redistribute it and/or modify
@@ -36,6 +36,10 @@
 
 #include "getdate.h"
 
+#include "intprops.h"
+#include "timespec.h"
+#include "verify.h"
+
 /* There's no need to extend the stack, so there's no need to involve
    alloca.  */
 #define YYSTACK_USE_ALLOCA 0
@@ -106,6 +110,13 @@
 
 #define HOUR(x) ((x) * 60)
 
+/* Lots of this code assumes time_t and time_t-like values fit into
+   long int.  It also assumes that signed integer overflow silently
+   wraps around, but there's no portable way to check for that at
+   compile-time.  */
+verify (TYPE_IS_INTEGER (time_t));
+verify (LONG_MIN <= TYPE_MINIMUM (time_t) && TYPE_MAXIMUM (time_t) <= 
LONG_MAX);
+
 /* An integer value, and the number of digits in its textual
    representation.  */
 typedef struct
@@ -195,7 +206,7 @@
 
 union YYSTYPE;
 static int yylex (union YYSTYPE *, parser_control *);
-static int yyerror (parser_control *, char *);
+static int yyerror (parser_control const *, char const *);
 static long int time_zone_hhmm (textint, long int);
 
 %}
@@ -1106,7 +1117,8 @@
 
 /* Do nothing if the parser reports an error.  */
 static int
-yyerror (parser_control *pc ATTRIBUTE_UNUSED, char *s ATTRIBUTE_UNUSED)
+yyerror (parser_control const *pc ATTRIBUTE_UNUSED,
+        char const *s ATTRIBUTE_UNUSED)
 {
   return 0;
 }

Index: getdelim.c
===================================================================
RCS file: /cvsroot/cvs/ccvs/lib/getdelim.c,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -b -r1.7 -r1.8
--- getdelim.c  5 Oct 2005 20:51:02 -0000       1.7
+++ getdelim.c  22 Aug 2007 12:48:40 -0000      1.8
@@ -1,5 +1,5 @@
 /* getdelim.c --- Implementation of replacement getdelim function.
-   Copyright (C) 1994, 1996, 1997, 1998, 2001, 2003, 2005 Free
+   Copyright (C) 1994, 1996, 1997, 1998, 2001, 2003, 2005, 2006 Free
    Software Foundation, Inc.
 
    This program is free software; you can redistribute it and/or
@@ -19,9 +19,7 @@
 
 /* Ported from glibc by Simon Josefsson. */
 
-#ifdef HAVE_CONFIG_H
-# include <config.h>
-#endif
+#include <config.h>
 
 #include "getdelim.h"
 

Index: getline.c
===================================================================
RCS file: /cvsroot/cvs/ccvs/lib/getline.c,v
retrieving revision 1.19
retrieving revision 1.20
diff -u -b -r1.19 -r1.20
--- getline.c   19 Sep 2005 21:26:13 -0000      1.19
+++ getline.c   22 Aug 2007 12:48:40 -0000      1.20
@@ -1,5 +1,5 @@
 /* getline.c --- Implementation of replacement getline function.
-   Copyright (C) 2005 Free Software Foundation, Inc.
+   Copyright (C) 2005, 2006 Free Software Foundation, Inc.
 
    This program is free software; you can redistribute it and/or
    modify it under the terms of the GNU General Public License as
@@ -18,9 +18,7 @@
 
 /* Written by Simon Josefsson. */
 
-#ifdef HAVE_CONFIG_H
-# include <config.h>
-#endif
+#include <config.h>
 
 #include "getdelim.h"
 #include "getline.h"

Index: getlogin_r.c
===================================================================
RCS file: /cvsroot/cvs/ccvs/lib/getlogin_r.c,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -b -r1.6 -r1.7
--- getlogin_r.c        22 Sep 2006 17:54:39 -0000      1.6
+++ getlogin_r.c        22 Aug 2007 12:48:40 -0000      1.7
@@ -1,6 +1,6 @@
 /* Provide a working getlogin_r for systems which lack it.
 
-   Copyright (C) 2005, 2006 Free Software Foundation, Inc.
+   Copyright (C) 2005, 2006, 2007 Free Software Foundation, Inc.
 
    This program is free software; you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
@@ -20,17 +20,17 @@
 
 #include <config.h>
 
-#include "getlogin_r.h"
+/* Specification.  */
+#include <unistd.h>
 
 #include <errno.h>
 #include <string.h>
-#include <unistd.h>
 
 #if !HAVE_DECL_GETLOGIN
 char *getlogin (void);
 #endif
 
-/* See getlogin_r.h for documentation.  */
+/* See unistd_.h for documentation.  */
 int
 getlogin_r (char *name, size_t size)
 {

Index: getndelim2.c
===================================================================
RCS file: /cvsroot/cvs/ccvs/lib/getndelim2.c,v
retrieving revision 1.11
retrieving revision 1.12
diff -u -b -r1.11 -r1.12
--- getndelim2.c        22 Sep 2006 17:54:39 -0000      1.11
+++ getndelim2.c        22 Aug 2007 12:48:40 -0000      1.12
@@ -34,6 +34,10 @@
 #include <limits.h>
 #include <stdint.h>
 
+#ifndef SSIZE_MAX
+# define SSIZE_MAX ((ssize_t) (SIZE_MAX / 2))
+#endif
+
 /* The maximum value that getndelim2 can return without suffering from
    overflow problems, either internally (because of pointer
    subtraction overflow) or due to the API (because of ssize_t).  */

Index: getopt_.h
===================================================================
RCS file: /cvsroot/cvs/ccvs/lib/getopt_.h,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -b -r1.5 -r1.6
--- getopt_.h   4 Oct 2005 02:34:54 -0000       1.5
+++ getopt_.h   22 Aug 2007 12:48:40 -0000      1.6
@@ -1,5 +1,5 @@
 /* Declarations for getopt.
-   Copyright (C) 1989-1994,1996-1999,2001,2003,2004,2005
+   Copyright (C) 1989-1994,1996-1999,2001,2003,2004,2005,2006,2007
    Free Software Foundation, Inc.
    This file is part of the GNU C Library.
 
@@ -196,9 +196,10 @@
    scanning, explicitly telling `getopt' that there are no more
    options.
 
-   If OPTS begins with `--', then non-option arguments are treated as
-   arguments to the option '\0'.  This behavior is specific to the GNU
-   `getopt'.  */
+   If OPTS begins with `-', then non-option arguments are treated as
+   arguments to the option '\1'.  This behavior is specific to the GNU
+   `getopt'.  If OPTS begins with `+', or POSIXLY_CORRECT is set in
+   the environment, then do not permute arguments.  */
 
 extern int getopt (int ___argc, char *const *___argv, const char *__shortopts)
        __THROW;

Index: getpagesize.h
===================================================================
RCS file: /cvsroot/cvs/ccvs/lib/getpagesize.h,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -b -r1.7 -r1.8
--- getpagesize.h       7 Jul 2006 02:46:50 -0000       1.7
+++ getpagesize.h       22 Aug 2007 12:48:40 -0000      1.8
@@ -42,6 +42,11 @@
 # endif
 #endif
 
+/* This is for AmigaOS4.0.  */
+#if !defined getpagesize && defined __amigaos4__
+# define getpagesize() 2048
+#endif
+
 #if !defined getpagesize && HAVE_SYS_PARAM_H
 # include <sys/param.h>
 # ifdef EXEC_PAGESIZE

Index: getpass.c
===================================================================
RCS file: /cvsroot/cvs/ccvs/lib/getpass.c,v
retrieving revision 1.13
retrieving revision 1.14
diff -u -b -r1.13 -r1.14
--- getpass.c   22 Sep 2006 17:54:39 -0000      1.13
+++ getpass.c   22 Aug 2007 12:48:40 -0000      1.14
@@ -1,4 +1,4 @@
-/* Copyright (C) 1992-2001, 2003, 2004, 2005, 2006 Free Software
+/* Copyright (C) 1992-2001, 2003, 2004, 2005, 2006, 2007 Free Software
    Foundation, Inc.
 
    This file is part of the GNU C Library.
@@ -29,10 +29,11 @@
 
 #include <stdbool.h>
 
-#if HAVE_STDIO_EXT_H
+#if HAVE_DECL___FSETLOCKING && HAVE___FSETLOCKING
+# if HAVE_STDIO_EXT_H
 # include <stdio_ext.h>
-#endif
-#if !HAVE___FSETLOCKING
+# endif
+#else
 # define __fsetlocking(stream, type)   /* empty */
 #endif
 
@@ -141,7 +142,7 @@
      == fileno (out).  The POSIX restrictions are tricky and change
      from POSIX version to POSIX version, so play it safe and invoke
      fseek even if in != out.  */
-  fseek (out, 0, SEEK_CUR);
+  fseeko (out, 0, SEEK_CUR);
 
   if (buf != NULL)
     {

Index: gettext.h
===================================================================
RCS file: /cvsroot/cvs/ccvs/lib/gettext.h,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -b -r1.6 -r1.7
--- gettext.h   16 Aug 2006 18:12:09 -0000      1.6
+++ gettext.h   22 Aug 2007 12:48:40 -0000      1.7
@@ -24,6 +24,18 @@
 /* Get declarations of GNU message catalog functions.  */
 # include <libintl.h>
 
+/* You can set the DEFAULT_TEXT_DOMAIN macro to specify the domain used by
+   the gettext() and ngettext() macros.  This is an alternative to calling
+   textdomain(), and is useful for libraries.  */
+# ifdef DEFAULT_TEXT_DOMAIN
+#  undef gettext
+#  define gettext(Msgid) \
+     dgettext (DEFAULT_TEXT_DOMAIN, Msgid)
+#  undef ngettext
+#  define ngettext(Msgid1, Msgid2, N) \
+     dngettext (DEFAULT_TEXT_DOMAIN, Msgid1, Msgid2, N)
+# endif
+
 #else
 
 /* Solaris /usr/include/locale.h includes /usr/include/libintl.h, which
@@ -52,17 +64,22 @@
    On pre-ANSI systems without 'const', the config.h file is supposed to
    contain "#define const".  */
 # define gettext(Msgid) ((const char *) (Msgid))
-# define dgettext(Domainname, Msgid) ((const char *) (Msgid))
-# define dcgettext(Domainname, Msgid, Category) ((const char *) (Msgid))
+# define dgettext(Domainname, Msgid) ((void) (Domainname), gettext (Msgid))
+# define dcgettext(Domainname, Msgid, Category) \
+    ((void) (Category), dgettext (Domainname, Msgid))
 # define ngettext(Msgid1, Msgid2, N) \
-    ((N) == 1 ? (const char *) (Msgid1) : (const char *) (Msgid2))
+    ((N) == 1 \
+     ? ((void) (Msgid2), (const char *) (Msgid1)) \
+     : ((void) (Msgid1), (const char *) (Msgid2)))
 # define dngettext(Domainname, Msgid1, Msgid2, N) \
-    ((N) == 1 ? (const char *) (Msgid1) : (const char *) (Msgid2))
+    ((void) (Domainname), ngettext (Msgid1, Msgid2, N))
 # define dcngettext(Domainname, Msgid1, Msgid2, N, Category) \
-    ((N) == 1 ? (const char *) (Msgid1) : (const char *) (Msgid2))
+    ((void) (Category), dngettext(Domainname, Msgid1, Msgid2, N))
 # define textdomain(Domainname) ((const char *) (Domainname))
-# define bindtextdomain(Domainname, Dirname) ((const char *) (Dirname))
-# define bind_textdomain_codeset(Domainname, Codeset) ((const char *) 
(Codeset))
+# define bindtextdomain(Domainname, Dirname) \
+    ((void) (Domainname), (const char *) (Dirname))
+# define bind_textdomain_codeset(Domainname, Codeset) \
+    ((void) (Domainname), (const char *) (Codeset))
 
 #endif
 
@@ -82,14 +99,24 @@
    MSGID.  MSGCTXT and MSGID must be string literals.  MSGCTXT should be
    short and rarely need to change.
    The letter 'p' stands for 'particular' or 'special'.  */
-#define pgettext(Msgctxt, Msgid) \
+#ifdef DEFAULT_TEXT_DOMAIN
+# define pgettext(Msgctxt, Msgid) \
+   pgettext_aux (DEFAULT_TEXT_DOMAIN, Msgctxt GETTEXT_CONTEXT_GLUE Msgid, 
Msgid, LC_MESSAGES)
+#else
+# define pgettext(Msgctxt, Msgid) \
   pgettext_aux (NULL, Msgctxt GETTEXT_CONTEXT_GLUE Msgid, Msgid, LC_MESSAGES)
+#endif
 #define dpgettext(Domainname, Msgctxt, Msgid) \
   pgettext_aux (Domainname, Msgctxt GETTEXT_CONTEXT_GLUE Msgid, Msgid, 
LC_MESSAGES)
 #define dcpgettext(Domainname, Msgctxt, Msgid, Category) \
   pgettext_aux (Domainname, Msgctxt GETTEXT_CONTEXT_GLUE Msgid, Msgid, 
Category)
-#define npgettext(Msgctxt, Msgid, MsgidPlural, N) \
+#ifdef DEFAULT_TEXT_DOMAIN
+# define npgettext(Msgctxt, Msgid, MsgidPlural, N) \
+   npgettext_aux (DEFAULT_TEXT_DOMAIN, Msgctxt GETTEXT_CONTEXT_GLUE Msgid, 
Msgid, MsgidPlural, N, LC_MESSAGES)
+#else
+# define npgettext(Msgctxt, Msgid, MsgidPlural, N) \
   npgettext_aux (NULL, Msgctxt GETTEXT_CONTEXT_GLUE Msgid, Msgid, MsgidPlural, 
N, LC_MESSAGES)
+#endif
 #define dnpgettext(Domainname, Msgctxt, Msgid, MsgidPlural, N) \
   npgettext_aux (Domainname, Msgctxt GETTEXT_CONTEXT_GLUE Msgid, Msgid, 
MsgidPlural, N, LC_MESSAGES)
 #define dcnpgettext(Domainname, Msgctxt, Msgid, MsgidPlural, N, Category) \
@@ -142,7 +169,8 @@
 #include <string.h>
 
 #define _LIBGETTEXT_HAVE_VARIABLE_SIZE_ARRAYS \
-  (__GNUC__ >= 3 || defined __cplusplus)
+  (((__GNUC__ >= 3 || __GNUG__ >= 2) && !__STRICT_ANSI__) \
+   /* || __STDC_VERSION__ >= 199901L */ )
 
 #if !_LIBGETTEXT_HAVE_VARIABLE_SIZE_ARRAYS
 #include <stdlib.h>

Index: gettime.c
===================================================================
RCS file: /cvsroot/cvs/ccvs/lib/gettime.c,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -b -r1.6 -r1.7
--- gettime.c   22 Sep 2006 17:54:39 -0000      1.6
+++ gettime.c   22 Aug 2007 12:48:40 -0000      1.7
@@ -1,6 +1,6 @@
 /* gettime -- get the system clock
 
-   Copyright (C) 2002, 2004, 2005, 2006 Free Software Foundation, Inc.
+   Copyright (C) 2002, 2004, 2005, 2006, 2007 Free Software Foundation, Inc.
 
    This program is free software; you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
@@ -22,6 +22,8 @@
 
 #include "timespec.h"
 
+#include <sys/time.h>
+
 /* Get the system time into *TS.  */
 
 void
@@ -36,23 +38,12 @@
     return;
 # endif
 
-# if HAVE_GETTIMEOFDAY
   {
     struct timeval tv;
     gettimeofday (&tv, NULL);
     ts->tv_sec = tv.tv_sec;
     ts->tv_nsec = tv.tv_usec * 1000;
   }
-# else
-
-#  ifndef OK_TO_USE_1S_CLOCK
-#   error "Only 1-second nominal clock resolution found.  Is that intended?" \
-          "If so, compile with the -DOK_TO_USE_1S_CLOCK option."
-#  endif
-  ts->tv_sec = time (NULL);
-  ts->tv_nsec = 0;
-
-# endif
 
 #endif
 }

Index: gettimeofday.c
===================================================================
RCS file: /cvsroot/cvs/ccvs/lib/gettimeofday.c,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -b -r1.4 -r1.5
--- gettimeofday.c      22 Sep 2006 17:54:39 -0000      1.4
+++ gettimeofday.c      22 Aug 2007 12:48:40 -0000      1.5
@@ -1,9 +1,7 @@
-/* Work around the bug in some systems whereby gettimeofday clobbers the
-   static buffer that localtime uses for it's return value.  The gettimeofday
-   function from Mac OS X 10.0.4, i.e. Darwin 1.3.7 has this problem.
-   The tzset replacement is necessary for at least Solaris 2.5, 2.5.1, and 2.6.
+/* Provide gettimeofday for systems that don't have it or for which it's 
broken.
 
-   Copyright (C) 2001, 2002, 2003, 2006 Free Software Foundation, Inc.
+   Copyright (C) 2001, 2002, 2003, 2005, 2006, 2007 Free Software
+   Foundation, Inc.
 
    This program is free software; you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
@@ -23,29 +21,25 @@
 
 #include <config.h>
 
-/* Disable the definitions of these functions (from config.h)
-   so we can use the library versions here.  */
-#undef gettimeofday
-#undef gmtime
-#undef localtime
-#undef tzset
+/* Specification.  */
+#include <sys/time.h>
 
-#include <sys/types.h>
+#include <time.h>
 
-#if TIME_WITH_SYS_TIME
-# include <sys/time.h>
-# include <time.h>
-#else
-# if HAVE_SYS_TIME_H
-#  include <sys/time.h>
-# else
-#  include <time.h>
-# endif
+#if HAVE_SYS_TIMEB_H
+# include <sys/timeb.h>
 #endif
 
-#include <stdlib.h>
+#if GETTIMEOFDAY_CLOBBERS_LOCALTIME || TZSET_CLOBBERS_LOCALTIME
+
+/* Work around the bug in some systems whereby gettimeofday clobbers
+   the static buffer that localtime uses for its return value.  The
+   gettimeofday function from Mac OS X 10.0.4 (i.e., Darwin 1.3.7) has
+   this problem.  The tzset replacement is necessary for at least
+   Solaris 2.5, 2.5.1, and 2.6.  */
 
-static struct tm *localtime_buffer_addr;
+static struct tm tm_zero_buffer;
+static struct tm *localtime_buffer_addr = &tm_zero_buffer;
 
 /* This is a wrapper for localtime.  It is used only on systems for which
    gettimeofday clobbers the static buffer used for localtime's result.
@@ -54,11 +48,13 @@
    localtime uses for its result.  */
 
 struct tm *
-rpl_localtime (const time_t *timep)
+localtime (time_t const *timep)
 {
+#undef localtime
+  extern struct tm *localtime (time_t const *);
   struct tm *tm = localtime (timep);
 
-  if (! localtime_buffer_addr)
+  if (localtime_buffer_addr == &tm_zero_buffer)
     localtime_buffer_addr = tm;
 
   return tm;
@@ -66,57 +62,81 @@
 
 /* Same as above, since gmtime and localtime use the same buffer.  */
 struct tm *
-rpl_gmtime (const time_t *timep)
+gmtime (time_t const *timep)
 {
+#undef gmtime
+  extern struct tm *gmtime (time_t const *);
   struct tm *tm = gmtime (timep);
 
-  if (! localtime_buffer_addr)
+  if (localtime_buffer_addr == &tm_zero_buffer)
     localtime_buffer_addr = tm;
 
   return tm;
 }
 
-/* This is a wrapper for gettimeofday.  It is used only on systems for which
-   gettimeofday clobbers the static buffer used for localtime's result.
+#endif /* GETTIMEOFDAY_CLOBBERS_LOCALTIME || TZSET_CLOBBERS_LOCALTIME */
+
+#if TZSET_CLOBBERS_LOCALTIME
+/* This is a wrapper for tzset, for systems on which tzset may clobber
+   the static buffer used for localtime's result.  */
+void
+tzset (void)
+{
+#undef tzset
+  extern void tzset (void);
+
+  /* Save and restore the contents of the buffer used for localtime's
+     result around the call to tzset.  */
+  struct tm save = *localtime_buffer_addr;
+  tzset ();
+  *localtime_buffer_addr = save;
+}
+#endif
 
-   Save and restore the contents of the buffer used for localtime's result
-   around the call to gettimeofday.  */
+/* This is a wrapper for gettimeofday.  It is used only on systems
+   that lack this function, or whose implementation of this function
+   causes problems.  */
 
 int
-rpl_gettimeofday (struct timeval *tv, struct timezone *tz)
+rpl_gettimeofday (struct timeval *restrict tv, void *restrict tz)
 {
-  struct tm save;
-  int result;
+#undef gettimeofday
+#if HAVE_GETTIMEOFDAY
+# if GETTIMEOFDAY_CLOBBERS_LOCALTIME
+  /* Save and restore the contents of the buffer used for localtime's
+     result around the call to gettimeofday.  */
+  struct tm save = *localtime_buffer_addr;
+# endif
 
-  if (! localtime_buffer_addr)
-    {
-      time_t t = 0;
-      localtime_buffer_addr = localtime (&t);
-    }
+  int result = gettimeofday (tv, tz);
 
-  save = *localtime_buffer_addr;
-  result = gettimeofday (tv, tz);
+# if GETTIMEOFDAY_CLOBBERS_LOCALTIME
   *localtime_buffer_addr = save;
+# endif
 
   return result;
-}
 
-/* This is a wrapper for tzset. It is used only on systems for which
-   tzset may clobber the static buffer used for localtime's result.
-   Save and restore the contents of the buffer used for localtime's
-   result around the call to tzset.  */
-void
-rpl_tzset (void)
-{
-  struct tm save;
+#else
 
-  if (! localtime_buffer_addr)
-    {
-      time_t t = 0;
-      localtime_buffer_addr = localtime (&t);
-    }
+# if HAVE__FTIME
 
-  save = *localtime_buffer_addr;
-  tzset ();
-  *localtime_buffer_addr = save;
+  struct _timeb timebuf;
+  _ftime (&timebuf);
+  tv->tv_sec = timebuf.time;
+  tv->tv_usec = timebuf.millitm * 1000;
+
+# else
+
+#  if !defined OK_TO_USE_1S_CLOCK
+#   error "Only 1-second nominal clock resolution found.  Is that intended?" \
+          "If so, compile with the -DOK_TO_USE_1S_CLOCK option."
+#  endif
+  tv->tv_sec = time (NULL);
+  tv->tv_usec = 0;
+
+# endif
+
+  return 0;
+
+#endif
 }

Index: glob-libc.h
===================================================================
RCS file: /cvsroot/cvs/ccvs/lib/glob-libc.h,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -b -r1.2 -r1.3
--- glob-libc.h 25 Jan 2006 12:53:38 -0000      1.2
+++ glob-libc.h 22 Aug 2007 12:48:40 -0000      1.3
@@ -1,4 +1,4 @@
-/* Copyright (C) 1991,92,95-98,2000,2001,2004-2006 Free Software Foundation, 
Inc.
+/* Copyright (C) 1991,92,95-98,2000,2001,2004-2007 Free Software Foundation, 
Inc.
    This file is part of the GNU C Library.
 
    The GNU C Library is free software; you can redistribute it and/or
@@ -23,6 +23,21 @@
 # include <sys/cdefs.h>
 #endif
 
+/* GCC 2.95 and later have "__restrict"; C99 compilers have
+   "restrict", and "configure" may have defined "restrict".
+   Other compilers use __restrict, __restrict__, and _Restrict, and
+   'configure' might #define 'restrict' to those words, so pick a
+   different name.  */
+#ifndef _Restrict_
+# if 199901L <= __STDC_VERSION__
+#  define _Restrict_ restrict
+# elif 2 < __GNUC__ || (2 == __GNUC__ && 95 <= __GNUC_MINOR__)
+#  define _Restrict_ __restrict
+# else
+#  define _Restrict_
+# endif
+#endif
+
 __BEGIN_DECLS
 
 /* We need `size_t' for the following definitions.  */
@@ -106,11 +121,11 @@
 #endif
     void *(*gl_opendir) (const char *);
 #ifdef __USE_GNU
-    int (*gl_lstat) (const char *__restrict, struct stat *__restrict);
-    int (*gl_stat) (const char *__restrict, struct stat *__restrict);
+    int (*gl_lstat) (const char *_Restrict_, struct stat *_Restrict_);
+    int (*gl_stat) (const char *_Restrict_, struct stat *_Restrict_);
 #else
-    int (*gl_lstat) (const char *__restrict, void *__restrict);
-    int (*gl_stat) (const char *__restrict, void *__restrict);
+    int (*gl_lstat) (const char *_Restrict_, void *_Restrict_);
+    int (*gl_stat) (const char *_Restrict_, void *_Restrict_);
 #endif
   } glob_t;
 
@@ -135,11 +150,11 @@
 # endif
     void *(*gl_opendir) (const char *);
 # ifdef __USE_GNU
-    int (*gl_lstat) (const char *__restrict, struct stat64 *__restrict);
-    int (*gl_stat) (const char *__restrict, struct stat64 *__restrict);
+    int (*gl_lstat) (const char *_Restrict_, struct stat64 *_Restrict_);
+    int (*gl_stat) (const char *_Restrict_, struct stat64 *_Restrict_);
 # else
-    int (*gl_lstat) (const char *__restrict, void *__restrict);
-    int (*gl_stat) (const char *__restrict, void *__restrict);
+    int (*gl_lstat) (const char *_Restrict_, void *_Restrict_);
+    int (*gl_stat) (const char *_Restrict_, void *_Restrict_);
 # endif
   } glob64_t;
 #endif
@@ -158,25 +173,25 @@
    If memory cannot be allocated for PGLOB, GLOB_NOSPACE is returned.
    Otherwise, `glob' returns zero.  */
 #if !defined __USE_FILE_OFFSET64 || __GNUC__ < 2 || defined __GLOB_GNULIB
-extern int glob (const char *__restrict __pattern, int __flags,
+extern int glob (const char *_Restrict_ __pattern, int __flags,
                 int (*__errfunc) (const char *, int),
-                glob_t *__restrict __pglob) __THROW;
+                glob_t *_Restrict_ __pglob) __THROW;
 
 /* Free storage allocated in PGLOB by a previous `glob' call.  */
 extern void globfree (glob_t *__pglob) __THROW;
 #else
-extern int __REDIRECT_NTH (glob, (const char *__restrict __pattern,
+extern int __REDIRECT_NTH (glob, (const char *_Restrict_ __pattern,
                                  int __flags,
                                  int (*__errfunc) (const char *, int),
-                                 glob_t *__restrict __pglob), glob64);
+                                 glob_t *_Restrict_ __pglob), glob64);
 
 extern void __REDIRECT_NTH (globfree, (glob_t *__pglob), globfree64);
 #endif
 
 #if defined __USE_LARGEFILE64 && !defined __GLOB_GNULIB
-extern int glob64 (const char *__restrict __pattern, int __flags,
+extern int glob64 (const char *_Restrict_ __pattern, int __flags,
                   int (*__errfunc) (const char *, int),
-                  glob64_t *__restrict __pglob) __THROW;
+                  glob64_t *_Restrict_ __pglob) __THROW;
 
 extern void globfree64 (glob64_t *__pglob) __THROW;
 #endif

Index: glob.c
===================================================================
RCS file: /cvsroot/cvs/ccvs/lib/glob.c,v
retrieving revision 1.23
retrieving revision 1.24
diff -u -b -r1.23 -r1.24
--- glob.c      22 Sep 2006 17:54:39 -0000      1.23
+++ glob.c      22 Aug 2007 12:48:40 -0000      1.24
@@ -1,4 +1,4 @@
-/* Copyright (C) 1991-2002,2003,2004,2005,2006 Free Software Foundation, Inc.
+/* Copyright (C) 1991-2002,2003,2004,2005,2006,2007 Free Software Foundation, 
Inc.
    This file is part of the GNU C Library.
 
    The GNU C Library is free software; you can redistribute it and/or
@@ -132,10 +132,6 @@
 # endif
 # define struct_stat64         struct stat64
 #else /* !_LIBC */
-# include "getlogin_r.h"
-# include "mempcpy.h"
-# include "stat-macros.h"
-# include "strdup.h"
 # define __stat64(fname, buf)  stat (fname, buf)
 # define struct_stat64         struct stat
 # define __stat(fname, buf)    stat (fname, buf)
@@ -163,6 +159,11 @@
 
 #endif /* !defined _LIBC || !defined GLOB_ONLY_P */
 
+/* The results of opendir() in this file are not used with dirfd and fchdir,
+   therefore save some unnecessary work in fchdir.c.  */
+#undef opendir
+#undef closedir
+
 static int glob_in_dir (const char *pattern, const char *directory,
                        int flags, int (*errfunc) (const char *, int),
                        glob_t *pglob);
@@ -211,10 +212,10 @@
 GLOB_ATTRIBUTE
 #endif
 glob (pattern, flags, errfunc, pglob)
-     const char *pattern;
+     const char * restrict pattern;
      int flags;
      int (*errfunc) (const char *, int);
-     glob_t *pglob;
+     glob_t * restrict pglob;
 {
   const char *filename;
   const char *dirname;

Index: glob_.h
===================================================================
RCS file: /cvsroot/cvs/ccvs/lib/glob_.h,v
retrieving revision 1.18
retrieving revision 1.19
diff -u -b -r1.18 -r1.19
--- glob_.h     11 Jul 2006 16:40:33 -0000      1.18
+++ glob_.h     22 Aug 2007 12:48:41 -0000      1.19
@@ -1,6 +1,6 @@
 /* glob_.h -- Find a path matching a pattern.
 
-   Copyright (C) 2005, 2006 Free Software Foundation, Inc.
+   Copyright (C) 2005-2007 Free Software Foundation, Inc.
 
    Written by Derek Price <address@hidden> & Paul Eggert <address@hidden>
 
@@ -18,15 +18,20 @@
    along with this program; if not, write to the Free Software Foundation,
    Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.  */
 
-#ifndef GLOB_H
-#define GLOB_H 1
+#ifndef _GL_GLOB_H
+#define _GL_GLOB_H
 
-#ifdef HAVE_SYS_CDEFS_H
+#if @HAVE_SYS_CDEFS_H@
 # include <sys/cdefs.h>
 #endif
 
 #include <stddef.h>
 
+/* On some systems, such as AIX 5.1, <sys/stat.h> does a "#define stat stat64".
+   Make sure this definition is seen before glob-libc.h defines types that
+   rely on 'struct stat'.  */
+#include <sys/stat.h>
+
 #ifndef __BEGIN_DECLS
 # define __BEGIN_DECLS
 # define __END_DECLS
@@ -38,9 +43,6 @@
 #ifndef __size_t
 # define __size_t      size_t
 #endif
-#ifndef __restrict
-# define __restrict    restrict
-#endif
 #ifndef __USE_GNU
 # define __USE_GNU    1
 #endif
@@ -55,4 +57,4 @@
 /* Now the standard GNU C Library header should work.  */
 #include "glob-libc.h"
 
-#endif /* GLOB_H */
+#endif /* _GL_GLOB_H */

Index: inttypes_.h
===================================================================
RCS file: /cvsroot/cvs/ccvs/lib/inttypes_.h,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -b -r1.1 -r1.2
--- inttypes_.h 2 Sep 2006 23:17:59 -0000       1.1
+++ inttypes_.h 22 Aug 2007 12:48:41 -0000      1.2
@@ -1,4 +1,4 @@
-/* Copyright (C) 2006 Free Software Foundation, Inc.
+/* Copyright (C) 2006-2007 Free Software Foundation, Inc.
    Written by Paul Eggert, Bruno Haible, Derek Price.
    This file is part of gnulib.
 
@@ -16,23 +16,24 @@
    along with this program; if not, write to the Free Software Foundation,
    Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.  */
 
+/*
+ * ISO C 99 <inttypes.h> for platforms that lack it.
+ * <http://www.opengroup.org/susv3xbd/inttypes.h.html>
+ */
+
 /* Include the original <inttypes.h> if it exists, and if this file
    has not been included yet or if this file includes gnulib stdint.h
-   which in turn includes this file.  */
-#if ! defined INTTYPES_H || defined _GL_JUST_INCLUDE_ABSOLUTE_INTTYPES_H
+   which in turn includes this file.
+   The include_next requires a split double-inclusion guard.  */
+#if ! defined INTTYPES_H || defined _GL_JUST_INCLUDE_SYSTEM_INTTYPES_H
 # if @HAVE_INTTYPES_H@
-#  include @ABSOLUTE_INTTYPES_H@
+#  @INCLUDE_NEXT@ @NEXT_INTTYPES_H@
 # endif
 #endif
 
-#if ! defined INTTYPES_H && ! defined _GL_JUST_INCLUDE_ABSOLUTE_INTTYPES_H
+#if ! defined INTTYPES_H && ! defined _GL_JUST_INCLUDE_SYSTEM_INTTYPES_H
 #define INTTYPES_H
 
-/*
- * ISO C 99 <inttypes.h> for platforms that lack it.
- * <http://www.opengroup.org/susv3xbd/inttypes.h.html>
- */
-
 /* Include <stdint.h> or the gnulib replacement.  */
 #include <stdint.h>
 /* Get CHAR_BIT.  */
@@ -42,10 +43,20 @@
 # error "This file assumes that 'int' has exactly 32 bits. Please report your 
platform and compiler to <address@hidden>."
 #endif
 
+/* The definition of GL_LINK_WARNING is copied here.  */
+
 /* 7.8.1 Macros for format specifiers */
 
 #if ! defined __cplusplus || defined __STDC_FORMAT_MACROS
 
+# if defined _TNS_R_TARGET
+   /* Tandem NonStop R series and compatible platforms released before
+      July 2005 support %Ld but not %lld.  */
+#  define _LONG_LONG_FORMAT_PREFIX "L"
+# else
+#  define _LONG_LONG_FORMAT_PREFIX "ll"
+# endif
+
 # if !defined PRId8 || @PRI_MACROS_BROKEN@
 #  undef PRId8
 #  ifdef INT8_MAX
@@ -160,7 +171,7 @@
 #  elif defined _MSC_VER || defined __MINGW32__
 #   define _PRI64_PREFIX "I64"
 #  elif @HAVE_LONG_LONG_INT@ && LONG_MAX >> 30 == 1
-#   define _PRI64_PREFIX "ll"
+#   define _PRI64_PREFIX _LONG_LONG_FORMAT_PREFIX
 #  endif
 #  if !defined PRId64 || @PRI_MACROS_BROKEN@
 #   undef PRId64
@@ -172,12 +183,12 @@
 #  endif
 # endif
 # ifdef UINT64_MAX
-#  if INT64_MAX == LONG_MAX
+#  if UINT64_MAX == ULONG_MAX
 #   define _PRIu64_PREFIX "l"
 #  elif defined _MSC_VER || defined __MINGW32__
 #   define _PRIu64_PREFIX "I64"
-#  elif @HAVE_LONG_LONG_INT@ && LONG_MAX >> 30 == 1
-#   define _PRIu64_PREFIX "ll"
+#  elif @HAVE_UNSIGNED_LONG_LONG_INT@ && ULONG_MAX >> 31 == 1
+#   define _PRIu64_PREFIX _LONG_LONG_FORMAT_PREFIX
 #  endif
 #  if !defined PRIo64 || @PRI_MACROS_BROKEN@
 #   undef PRIo64
@@ -653,7 +664,7 @@
 #  elif defined _MSC_VER || defined __MINGW32__
 #   define _SCN64_PREFIX "I64"
 #  elif @HAVE_LONG_LONG_INT@ && LONG_MAX >> 30 == 1
-#   define _SCN64_PREFIX "ll"
+#   define _SCN64_PREFIX _LONG_LONG_FORMAT_PREFIX
 #  endif
 #  if !defined SCNd64 || @PRI_MACROS_BROKEN@
 #   undef SCNd64
@@ -665,12 +676,12 @@
 #  endif
 # endif
 # ifdef UINT64_MAX
-#  if INT64_MAX == LONG_MAX
+#  if UINT64_MAX == ULONG_MAX
 #   define _SCNu64_PREFIX "l"
 #  elif defined _MSC_VER || defined __MINGW32__
 #   define _SCNu64_PREFIX "I64"
-#  elif @HAVE_LONG_LONG_INT@ && LONG_MAX >> 30 == 1
-#   define _SCNu64_PREFIX "ll"
+#  elif @HAVE_UNSIGNED_LONG_LONG_INT@ && ULONG_MAX >> 31 == 1
+#   define _SCNu64_PREFIX _LONG_LONG_FORMAT_PREFIX
 #  endif
 #  if !defined SCNo64 || @PRI_MACROS_BROKEN@
 #   undef SCNo64
@@ -1026,20 +1037,53 @@
 extern "C" {
 #endif
 
-#if address@hidden@
+#if @GNULIB_IMAXABS@
+# if address@hidden@
 extern intmax_t imaxabs (intmax_t);
+# endif
+#elif defined GNULIB_POSIXCHECK
+# undef imaxabs
+# define imaxabs(a) \
+    (GL_LINK_WARNING ("imaxabs is unportable - " \
+                      "use gnulib module imaxabs for portability"), \
+     imaxabs (a))
 #endif
 
-#if address@hidden@
+#if @GNULIB_IMAXDIV@
+# if address@hidden@
 typedef struct { intmax_t quot; intmax_t rem; } imaxdiv_t;
 extern imaxdiv_t imaxdiv (intmax_t, intmax_t);
+# endif
+#elif defined GNULIB_POSIXCHECK
+# undef imaxdiv
+# define imaxdiv(a,b) \
+    (GL_LINK_WARNING ("imaxdiv is unportable - " \
+                      "use gnulib module imaxdiv for portability"), \
+     imaxdiv (a, b))
 #endif
 
-#if address@hidden@
+#if @GNULIB_STRTOIMAX@
+# if address@hidden@
 extern intmax_t strtoimax (const char *, char **, int);
+# endif
+#elif defined GNULIB_POSIXCHECK
+# undef strtoimax
+# define strtoimax(p,e,b) \
+    (GL_LINK_WARNING ("strtoimax is unportable - " \
+                      "use gnulib module strtoimax for portability"), \
+     strtoimax (p, e, b))
 #endif
-#if address@hidden@
+
+#if @GNULIB_STRTOUMAX@
+# if address@hidden@
 extern uintmax_t strtoumax (const char *, char **, int);
+# endif
+#elif defined GNULIB_POSIXCHECK
+# undef strtoumax
+# define strtoumax(p,e,b) \
+    (GL_LINK_WARNING ("strtoumax is unportable - " \
+                      "use gnulib module strtoumax for portability"), \
+     strtoumax (p, e, b))
 #endif
 
 /* Don't bother defining or declaring wcstoimax and wcstoumax, since
@@ -1049,4 +1093,4 @@
 }
 #endif
 
-#endif /* INTTYPES_H */
+#endif /* !defined INTTYPES_H && !defined _GL_JUST_INCLUDE_SYSTEM_INTTYPES_H */

Index: lchown.c
===================================================================
RCS file: /cvsroot/cvs/ccvs/lib/lchown.c,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -b -r1.2 -r1.3
--- lchown.c    22 Sep 2006 17:54:39 -0000      1.2
+++ lchown.c    22 Aug 2007 12:48:41 -0000      1.3
@@ -1,6 +1,6 @@
 /* Provide a stub lchown function for systems that lack it.
 
-   Copyright (C) 1998, 1999, 2002, 2004, 2006 Free Software
+   Copyright (C) 1998, 1999, 2002, 2004, 2006, 2007 Free Software
    Foundation, Inc.
 
    This program is free software; you can redistribute it and/or modify
@@ -21,16 +21,25 @@
 
 #include <config.h>
 
-#include <sys/types.h>
-#include <sys/stat.h>
-#include <errno.h>
+/* If the system chown does not follow symlinks, we don't want it
+   replaced by gnulib's chown, which does follow symlinks.  */
+#if CHOWN_MODIFIES_SYMLINK
+# define REPLACE_CHOWN 0
+#endif
+#include <unistd.h>
 
-#include "lchown.h"
-#include "stat-macros.h"
+#include <errno.h>
+#include <sys/stat.h>
 
-/* Declare chown to avoid a warning.  Don't include unistd.h,
-   because it may have a conflicting prototype for lchown.  */
-int chown ();
+/* Some systems don't have EOPNOTSUPP.  */
+#ifndef EOPNOTSUPP
+# ifdef ENOTSUP
+#  define EOPNOTSUPP ENOTSUP
+# else
+/* Some systems don't have ENOTSUP either.  */
+#  define EOPNOTSUPP EINVAL
+# endif
+#endif
 
 /* Work just like chown, except when FILE is a symbolic link.
    In that case, set errno to EOPNOTSUPP and return -1.

Index: lstat.c
===================================================================
RCS file: /cvsroot/cvs/ccvs/lib/lstat.c,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -b -r1.7 -r1.8
--- lstat.c     22 Sep 2006 17:54:39 -0000      1.7
+++ lstat.c     22 Aug 2007 12:48:41 -0000      1.8
@@ -31,8 +31,6 @@
 #include <string.h>
 #include <errno.h>
 
-#include "stat-macros.h"
-
 /* lstat works differently on Linux and Solaris systems.  POSIX (see
    `pathname resolution' in the glossary) requires that programs like
    `ls' take into consideration the fact that FILE has a trailing slash

Index: mbchar.c
===================================================================
RCS file: /cvsroot/cvs/ccvs/lib/mbchar.c,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -b -r1.2 -r1.3
--- mbchar.c    22 Sep 2006 17:54:39 -0000      1.2
+++ mbchar.c    22 Aug 2007 12:48:41 -0000      1.3
@@ -24,7 +24,7 @@
 #if IS_BASIC_ASCII
 
 /* Bit table of characters in the ISO C "basic character set".  */
-unsigned int is_basic_table [UCHAR_MAX / 32 + 1] =
+const unsigned int is_basic_table [UCHAR_MAX / 32 + 1] =
 {
   0x00001a00,          /* '\t' '\v' '\f' */
   0xffffffef,          /* ' '...'#' '%'...'?' */

Index: mbchar.h
===================================================================
RCS file: /cvsroot/cvs/ccvs/lib/mbchar.h,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -b -r1.4 -r1.5
--- mbchar.h    24 Aug 2006 01:24:14 -0000      1.4
+++ mbchar.h    22 Aug 2007 12:48:41 -0000      1.5
@@ -1,5 +1,5 @@
 /* Multibyte character data type.
-   Copyright (C) 2001, 2005-2006 Free Software Foundation, Inc.
+   Copyright (C) 2001, 2005-2007 Free Software Foundation, Inc.
 
    This program is free software; you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
@@ -155,134 +155,7 @@
 #include <stdio.h>
 #include <time.h>
 #include <wchar.h>
-
-/* BeOS 5 has the functions but no <wctype.h>.  */
-#if HAVE_WCTYPE_H
-# include <wctype.h>
-#endif
-/* FreeBSD 4.4 to 4.11 has <wctype.h> but lacks the functions.
-   Assume all 12 functions are implemented the same way, or not at all.  */
-#if !defined iswalnum && !HAVE_ISWCNTRL
-static inline int
-iswalnum (wint_t wc)
-{
-  return (wc >= 0 && wc < 128
-         ? (wc >= '0' && wc <= '9') || ((wc & ~0x20) >= 'A' && (wc & ~0x20) <= 
'Z')
-         : 0);
-}
-# define iswalnum iswalnum
-#endif
-#if !defined iswalpha && !HAVE_ISWCNTRL
-static inline int
-iswalpha (wint_t wc)
-{
-  return (wc >= 0 && wc < 128
-         ? (wc & ~0x20) >= 'A' && (wc & ~0x20) <= 'Z'
-         : 0);
-}
-# define iswalpha iswalpha
-#endif
-#if !defined iswblank && !HAVE_ISWCNTRL
-static inline int
-iswblank (wint_t wc)
-{
-  return (wc >= 0 && wc < 128
-         ? wc == ' ' || wc == '\t'
-         : 0);
-}
-# define iswblank iswblank
-#endif
-#if !defined iswcntrl && !HAVE_ISWCNTRL
-static inline int
-iswcntrl (wint_t wc)
-{
-  return (wc >= 0 && wc < 128
-         ? (wc & ~0x1f) == 0 || wc == 0x7f
-         : 0);
-}
-# define iswcntrl iswcntrl
-#endif
-#if !defined iswdigit && !HAVE_ISWCNTRL
-static inline int
-iswdigit (wint_t wc)
-{
-  return (wc >= '0' && wc <= '9');
-}
-# define iswdigit iswdigit
-#endif
-#if !defined iswgraph && !HAVE_ISWCNTRL
-static inline int
-iswgraph (wint_t wc)
-{
-  return (wc >= 0 && wc < 128
-         ? wc >= '!' && wc <= '~'
-         : 1);
-}
-# define iswgraph iswgraph
-#endif
-#if !defined iswlower && !HAVE_ISWCNTRL
-static inline int
-iswlower (wint_t wc)
-{
-  return (wc >= 0 && wc < 128
-         ? wc >= 'a' && wc <= 'z'
-         : 0);
-}
-# define iswlower iswlower
-#endif
-#if !defined iswprint && !HAVE_ISWCNTRL
-static inline int
-iswprint (wint_t wc)
-{
-  return (wc >= 0 && wc < 128
-         ? wc >= ' ' && wc <= '~'
-         : 1);
-}
-# define iswprint iswprint
-#endif
-#if !defined iswpunct && !HAVE_ISWCNTRL
-static inline int
-iswpunct (wint_t wc)
-{
-  return (wc >= 0 && wc < 128
-         ? wc >= '!' && wc <= '~'
-           && !((wc >= '0' && wc <= '9')
-                || ((wc & ~0x20) >= 'A' && (wc & ~0x20) <= 'Z'))
-         : 1);
-}
-# define iswpunct iswpunct
-#endif
-#if !defined iswspace && !HAVE_ISWCNTRL
-static inline int
-iswspace (wint_t wc)
-{
-  return (wc >= 0 && wc < 128
-         ? wc == ' ' || wc == '\t'
-           || wc == '\n' || wc == '\v' || wc == '\f' || wc == '\r'
-         : 0);
-}
-# define iswspace iswspace
-#endif
-#if !defined iswupper && !HAVE_ISWCNTRL
-static inline int
-iswupper (wint_t wc)
-{
-  return (wc >= 0 && wc < 128
-         ? wc >= 'A' && wc <= 'Z'
-         : 0);
-}
-# define iswupper iswupper
-#endif
-#if !defined iswxdigit && !HAVE_ISWCNTRL
-static inline int
-iswxdigit (wint_t wc)
-{
-  return (wc >= '0' && wc <= '9') || ((wc & ~0x20) >= 'A' && (wc & ~0x20) <= 
'F');
-}
-# define iswxdigit iswxdigit
-#endif
-
-#include "wcwidth.h"
+#include <wctype.h>
 
 #define MBCHAR_BUF_SIZE 24
 
@@ -385,18 +258,18 @@
 
 /* Copying a character.  */
 static inline void
-mb_copy (mbchar_t *new, const mbchar_t *old)
+mb_copy (mbchar_t *new_mbc, const mbchar_t *old_mbc)
 {
-  if (old->ptr == &old->buf[0])
+  if (old_mbc->ptr == &old_mbc->buf[0])
     {
-      memcpy (&new->buf[0], &old->buf[0], old->bytes);
-      new->ptr = &new->buf[0];
+      memcpy (&new_mbc->buf[0], &old_mbc->buf[0], old_mbc->bytes);
+      new_mbc->ptr = &new_mbc->buf[0];
     }
   else
-    new->ptr = old->ptr;
-  new->bytes = old->bytes;
-  if ((new->wc_valid = old->wc_valid))
-    new->wc = old->wc;
+    new_mbc->ptr = old_mbc->ptr;
+  new_mbc->bytes = old_mbc->bytes;
+  if ((new_mbc->wc_valid = old_mbc->wc_valid))
+    new_mbc->wc = old_mbc->wc;
 }
 
 
@@ -430,7 +303,7 @@
 /* The character set is ISO-646, not EBCDIC. */
 # define IS_BASIC_ASCII 1
 
-extern unsigned int is_basic_table[];
+extern const unsigned int is_basic_table[];
 
 static inline bool
 is_basic (char c)

Index: mbuiter.h
===================================================================
RCS file: /cvsroot/cvs/ccvs/lib/mbuiter.h,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -b -r1.3 -r1.4
--- mbuiter.h   20 Sep 2005 16:58:16 -0000      1.3
+++ mbuiter.h   22 Aug 2007 12:48:42 -0000      1.4
@@ -1,5 +1,5 @@
 /* Iterating through multibyte strings: macros for multi-byte encodings.
-   Copyright (C) 2001, 2005 Free Software Foundation, Inc.
+   Copyright (C) 2001, 2005, 2007 Free Software Foundation, Inc.
 
    This program is free software; you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
@@ -73,6 +73,9 @@
    mbui_reloc (iter, ptrdiff)
      relocates iterator when the string is moved by ptrdiff bytes.
 
+   mbui_copy (&destiter, &srciter)
+     copies srciter to destiter.
+
    Here are the function prototypes of the macros.
 
    extern void         mbui_init (mbui_iterator_t iter, const char *startptr);
@@ -81,6 +84,7 @@
    extern mbchar_t     mbui_cur (mbui_iterator_t iter);
    extern const char * mbui_cur_ptr (mbui_iterator_t iter);
    extern void         mbui_reloc (mbui_iterator_t iter, ptrdiff_t ptrdiff);
+   extern void         mbui_copy (mbui_iterator_t *new, const mbui_iterator_t 
*old);
  */
 
 #ifndef _MBUITER_H
@@ -88,7 +92,9 @@
 
 #include <assert.h>
 #include <stdbool.h>
+#include <stddef.h>
 #include <stdlib.h>
+#include <string.h>
 
 /* Tru64 with Desktop Toolkit C has a bug: <stdio.h> must be included before
    <wchar.h>.
@@ -182,6 +188,17 @@
   iter->cur.ptr += ptrdiff;
 }
 
+static inline void
+mbuiter_multi_copy (struct mbuiter_multi *new_iter, const struct mbuiter_multi 
*old_iter)
+{
+  if ((new_iter->in_shift = old_iter->in_shift))
+    memcpy (&new_iter->state, &old_iter->state, sizeof (mbstate_t));
+  else
+    memset (&new_iter->state, 0, sizeof (mbstate_t));
+  new_iter->next_done = old_iter->next_done;
+  mb_copy (&new_iter->cur, &old_iter->cur);
+}
+
 /* Iteration macros.  */
 typedef struct mbuiter_multi mbui_iterator_t;
 #define mbui_init(iter, startptr) \
@@ -200,4 +217,7 @@
 /* Relocation.  */
 #define mbui_reloc(iter, ptrdiff) mbuiter_multi_reloc (&iter, ptrdiff)
 
+/* Copying an iterator.  */
+#define mbui_copy mbuiter_multi_copy
+
 #endif /* _MBUITER_H */

Index: mempcpy.c
===================================================================
RCS file: /cvsroot/cvs/ccvs/lib/mempcpy.c,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -b -r1.2 -r1.3
--- mempcpy.c   23 May 2005 17:44:31 -0000      1.2
+++ mempcpy.c   22 Aug 2007 12:48:42 -0000      1.3
@@ -1,5 +1,5 @@
 /* Copy memory area and return pointer after last written byte.
-   Copyright (C) 2003 Free Software Foundation, Inc.
+   Copyright (C) 2003, 2007 Free Software Foundation, Inc.
 
    This program is free software; you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
@@ -15,9 +15,9 @@
    along with this program; if not, write to the Free Software Foundation,
    Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.  */
 
-/* Specification.  */
-#include "mempcpy.h"
+#include <config.h>
 
+/* Specification.  */
 #include <string.h>
 
 /* Copy N bytes of SRC to DEST, return pointer to bytes after the

Index: memrchr.c
===================================================================
RCS file: /cvsroot/cvs/ccvs/lib/memrchr.c,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -b -r1.3 -r1.4
--- memrchr.c   22 Sep 2006 17:54:39 -0000      1.3
+++ memrchr.c   22 Aug 2007 12:48:42 -0000      1.4
@@ -1,7 +1,7 @@
 /* memrchr -- find the last occurrence of a byte in a memory block
 
    Copyright (C) 1991, 1993, 1996, 1997, 1999, 2000, 2003, 2004, 2005,
-   2006 Free Software Foundation, Inc.
+   2006, 2007 Free Software Foundation, Inc.
 
    Based on strlen implementation by Torbjorn Granlund (address@hidden),
    with help from Dan Sahlin (address@hidden) and
@@ -24,14 +24,13 @@
    Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.  */
 
 #if defined _LIBC
-# include <string.h>
 # include <memcopy.h>
 #else
 # include <config.h>
-# include "memrchr.h"
 # define reg_char char
 #endif
 
+#include <string.h>
 #include <limits.h>
 
 #undef __memrchr

Index: mkstemp.c
===================================================================
RCS file: /cvsroot/cvs/ccvs/lib/mkstemp.c,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -b -r1.6 -r1.7
--- mkstemp.c   22 Sep 2006 17:54:39 -0000      1.6
+++ mkstemp.c   22 Aug 2007 12:48:42 -0000      1.7
@@ -1,4 +1,4 @@
-/* Copyright (C) 1998, 1999, 2001, 2005, 2006 Free Software Foundation, Inc.
+/* Copyright (C) 1998, 1999, 2001, 2005, 2006, 2007 Free Software Foundation, 
Inc.
    This file is derived from the one in the GNU C Library.
 
    This program is free software; you can redistribute it and/or modify
@@ -17,13 +17,18 @@
 
 #if !_LIBC
 # include <config.h>
-# include "mkstemp.h"
-int __gen_tempname ();
 #endif
 
-#include <stdio.h>
 #include <stdlib.h>
 
+#if !_LIBC
+# include "tempname.h"
+# define __gen_tempname gen_tempname
+# define __GT_FILE GT_FILE
+#endif
+
+#include <stdio.h>
+
 #ifndef __GT_FILE
 # define __GT_FILE 0
 #endif

Index: mktime.c
===================================================================
RCS file: /cvsroot/cvs/ccvs/lib/mktime.c,v
retrieving revision 1.13
retrieving revision 1.14
diff -u -b -r1.13 -r1.14
--- mktime.c    22 Sep 2006 17:54:39 -0000      1.13
+++ mktime.c    22 Aug 2007 12:48:42 -0000      1.14
@@ -1,5 +1,5 @@
 /* Convert a `struct tm' to a time_t value.
-   Copyright (C) 1993-1999, 2002-2005, 2006 Free Software Foundation, Inc.
+   Copyright (C) 1993-1999, 2002-2005, 2006, 2007 Free Software Foundation, 
Inc.
    This file is part of the GNU C Library.
    Contributed by Paul Eggert <address@hidden>.
 
@@ -21,7 +21,7 @@
    mktime.  */
 /* #define DEBUG 1 */
 
-#ifdef HAVE_CONFIG_H
+#ifndef _LIBC
 # include <config.h>
 #endif
 
@@ -32,7 +32,6 @@
 # define LEAP_SECONDS_POSSIBLE 1
 #endif
 
-#include <sys/types.h>         /* Some systems define `time_t' here.  */
 #include <time.h>
 
 #include <limits.h>
@@ -141,11 +140,10 @@
 
 
 #ifndef _LIBC
-/* Portable standalone applications should supply a "time_r.h" that
+/* Portable standalone applications should supply a <time.h> that
    declares a POSIX-compliant localtime_r, for the benefit of older
    implementations that lack localtime_r or have a nonstandard one.
    See the gnulib time_r module for one way to implement this.  */
-# include "time_r.h"
 # undef __localtime_r
 # define __localtime_r localtime_r
 # define __mktime_internal mktime_internal

Index: nanosleep.c
===================================================================
RCS file: /cvsroot/cvs/ccvs/lib/nanosleep.c,v
retrieving revision 1.10
retrieving revision 1.11
diff -u -b -r1.10 -r1.11
--- nanosleep.c 22 Sep 2006 17:54:39 -0000      1.10
+++ nanosleep.c 22 Aug 2007 12:48:43 -0000      1.11
@@ -1,7 +1,7 @@
 /* Provide a replacement for the POSIX nanosleep function.
 
-   Copyright (C) 1999, 2000, 2002, 2004, 2005, 2006 Free Software
-   Foundation, Inc.
+   Copyright (C) 1999, 2000, 2002, 2004, 2005, 2006, 2007 Free
+   Software Foundation, Inc.
 
    This program is free software; you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
@@ -21,9 +21,9 @@
 
 #include <config.h>
 
-/* Undefine nanosleep here so any prototype is not redefined to be a
-   prototype for rpl_nanosleep. (they'd conflict e.g., on alpha-dec-osf3.2)  */
-#undef nanosleep
+#include <time.h>
+
+#include "timespec.h"
 
 #include <stdbool.h>
 #include <stdio.h>
@@ -33,22 +33,12 @@
 #endif
 #include <signal.h>
 
-#if TIME_WITH_SYS_TIME
-# include <sys/time.h>
-# include <time.h>
-#else
-# if HAVE_SYS_TIME_H
-#  include <sys/time.h>
-# else
-#  include <time.h>
-# endif
-#endif
-
+#include <sys/time.h>
 #include <errno.h>
 
 #include <unistd.h>
 
-#include "timespec.h"
+#undef nanosleep
 
 enum { BILLION = 1000 * 1000 * 1000 };
 

Index: openat-priv.h
===================================================================
RCS file: /cvsroot/cvs/ccvs/lib/openat-priv.h,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -b -r1.2 -r1.3
--- openat-priv.h       21 Aug 2006 19:22:22 -0000      1.2
+++ openat-priv.h       22 Aug 2007 12:48:43 -0000      1.3
@@ -1,5 +1,6 @@
-/* macros used by openat-like functions
-   Copyright (C) 2005 Free Software Foundation, Inc.
+/* Internals for openat-like functions.
+
+   Copyright (C) 2005, 2006 Free Software Foundation, Inc.
 
    This program is free software; you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
@@ -17,30 +18,11 @@
 
 /* written by Jim Meyering */
 
-#include <stdio.h>
-#include <string.h>
 #include <errno.h>
-#include "alloca.h"
-#include "intprops.h"
+#include <stdlib.h>
 
-/* Set PROC_FD_FILENAME to the expansion of "/proc/self/fd/%d/%s" in
-   alloca'd memory, using FD and FILE, respectively for %d and %s. */
-#define BUILD_PROC_NAME(Proc_fd_filename, Fd, File)                    \
-  do                                                                   \
-    {                                                                  \
-      size_t filelen = strlen (File);                                  \
-      static const char procfd[] = "/proc/self/fd/%d/%s";              \
-      /* Buffer for the file name we are going to use.  It consists of \
-        - the string /proc/self/fd/                                    \
-        - the file descriptor number                                   \
-        - the file name provided.                                      \
-        The final NUL is included in the sizeof.                       \
-        Subtract 4 to account for %d and %s.  */                       \
-      size_t buflen = sizeof (procfd) - 4 + INT_STRLEN_BOUND (Fd) + filelen; \
-      (Proc_fd_filename) = alloca (buflen);                            \
-      snprintf ((Proc_fd_filename), buflen, procfd, (Fd), (File));     \
-    }                                                                  \
-  while (0)
+#define OPENAT_BUFFER_SIZE 512
+char *openat_proc_name (char buf[OPENAT_BUFFER_SIZE], int fd, char const 
*file);
 
 /* Some systems don't have ENOSYS.  */
 #ifndef ENOSYS
@@ -52,6 +34,16 @@
 # endif
 #endif
 
+/* Some systems don't have EOPNOTSUPP.  */
+#ifndef EOPNOTSUPP
+# ifdef ENOTSUP
+#  define EOPNOTSUPP ENOTSUP
+# else
+/* Some systems don't have ENOTSUP either.  */
+#  define EOPNOTSUPP EINVAL
+# endif
+#endif
+
 /* Trying to access a BUILD_PROC_NAME file will fail on systems without
    /proc support, and even on systems *with* ProcFS support.  Return
    nonzero if the failure may be legitimate, e.g., because /proc is not

Index: openat.c
===================================================================
RCS file: /cvsroot/cvs/ccvs/lib/openat.c,v
retrieving revision 1.9
retrieving revision 1.10
diff -u -b -r1.9 -r1.10
--- openat.c    22 Sep 2006 17:54:39 -0000      1.9
+++ openat.c    22 Aug 2007 12:48:43 -0000      1.10
@@ -1,5 +1,5 @@
 /* provide a replacement openat function
-   Copyright (C) 2004, 2005, 2006 Free Software Foundation, Inc.
+   Copyright (C) 2004, 2005, 2006, 2007 Free Software Foundation, Inc.
 
    This program is free software; you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
@@ -85,14 +85,23 @@
     return open (file, flags, mode);
 
   {
-    char *proc_file;
-    BUILD_PROC_NAME (proc_file, fd, file);
-    err = open (proc_file, flags, mode);
+    char buf[OPENAT_BUFFER_SIZE];
+    char *proc_file = openat_proc_name (buf, fd, file);
+    if (proc_file)
+      {
+       int open_result = open (proc_file, flags, mode);
+       int open_errno = errno;
+       if (proc_file != buf)
+         free (proc_file);
     /* If the syscall succeeds, or if it fails with an unexpected
        errno value, then return right away.  Otherwise, fall through
        and resort to using save_cwd/restore_cwd.  */
-    if (0 <= err || ! EXPECTED_ERRNO (errno))
-      return err;
+       if (0 <= open_result || ! EXPECTED_ERRNO (open_errno))
+         {
+           errno = open_errno;
+           return open_result;
+         }
+      }
   }
 
   save_ok = (save_cwd (&saved_cwd) == 0);
@@ -128,19 +137,23 @@
 bool
 openat_needs_fchdir (void)
 {
-  int fd2;
+  bool needs_fchdir = true;
   int fd = open ("/", O_RDONLY);
-  char *proc_file;
 
-  if (fd < 0)
-    return true;
-  BUILD_PROC_NAME (proc_file, fd, ".");
-  fd2 = open (proc_file, O_RDONLY);
+  if (0 <= fd)
+    {
+      char buf[OPENAT_BUFFER_SIZE];
+      char *proc_file = openat_proc_name (buf, fd, ".");
+      if (proc_file)
+       {
+         needs_fchdir = false;
+         if (proc_file != buf)
+           free (proc_file);
+       }
   close (fd);
-  if (0 <= fd2)
-    close (fd2);
+    }
 
-  return fd2 < 0;
+  return needs_fchdir;
 }
 
 #if !HAVE_FDOPENDIR
@@ -164,10 +177,18 @@
   int saved_errno;
   DIR *dir;
 
-  char *proc_file;
-  BUILD_PROC_NAME (proc_file, fd, ".");
+  char buf[OPENAT_BUFFER_SIZE];
+  char *proc_file = openat_proc_name (buf, fd, ".");
+  if (proc_file)
+    {
   dir = opendir (proc_file);
   saved_errno = errno;
+    }
+  else
+    {
+      dir = NULL;
+      saved_errno = EOPNOTSUPP;
+    }
 
   /* If the syscall fails with an expected errno value, resort to
      save_cwd/restore_cwd.  */
@@ -195,6 +216,8 @@
 
   if (dir)
     close (fd);
+  if (proc_file != buf)
+    free (proc_file);
   errno = saved_errno;
   return dir;
 }
@@ -244,19 +267,3 @@
 #undef AT_FUNC_USE_F1_COND
 #undef AT_FUNC_POST_FILE_PARAM_DECLS
 #undef AT_FUNC_POST_FILE_ARGS
-
-/* Replacement for Solaris' function by the same name.
-   Invoke chown or lchown on file, FILE, using OWNER and GROUP, in the
-   directory open on descriptor FD.  If FLAG is AT_SYMLINK_NOFOLLOW, then
-   use lchown, otherwise, use chown.  If possible, do it without changing
-   the working directory.  Otherwise, resort to using save_cwd/fchdir,
-   then mkdir/restore_cwd.  If either the save_cwd or the restore_cwd
-   fails, then give a diagnostic and exit nonzero.  */
-
-#define AT_FUNC_NAME fchownat
-#define AT_FUNC_F1 lchown
-#define AT_FUNC_F2 chown
-#define AT_FUNC_USE_F1_COND flag == AT_SYMLINK_NOFOLLOW
-#define AT_FUNC_POST_FILE_PARAM_DECLS , uid_t owner, gid_t group, int flag
-#define AT_FUNC_POST_FILE_ARGS        , owner, group
-#include "at-func.c"

Index: openat.h
===================================================================
RCS file: /cvsroot/cvs/ccvs/lib/openat.h,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -b -r1.8 -r1.9
--- openat.h    21 Aug 2006 19:22:22 -0000      1.8
+++ openat.h    22 Aug 2007 12:48:43 -0000      1.9
@@ -85,6 +85,14 @@
 
 #endif
 
+#if HAVE_OPENAT && ! LSTAT_FOLLOWS_SLASHED_SYMLINK
+int rpl_fstatat (int fd, char const *file, struct stat *st, int flag);
+# if !COMPILING_FSTATAT
+#  undef fstatat
+#  define fstatat rpl_fstatat
+# endif
+#endif
+
 int mkdirat (int fd, char const *file, mode_t mode);
 void openat_restore_fail (int) ATTRIBUTE_NORETURN;
 void openat_save_fail (int) ATTRIBUTE_NORETURN;

Index: printf-args.c
===================================================================
RCS file: /cvsroot/cvs/ccvs/lib/printf-args.c,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -b -r1.5 -r1.6
--- printf-args.c       22 Sep 2006 17:54:40 -0000      1.5
+++ printf-args.c       22 Aug 2007 12:48:43 -0000      1.6
@@ -1,5 +1,5 @@
 /* Decomposed printf argument list.
-   Copyright (C) 1999, 2002-2003, 2005-2006 Free Software Foundation, Inc.
+   Copyright (C) 1999, 2002-2003, 2005-2007 Free Software Foundation, Inc.
 
    This program is free software; you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
@@ -15,16 +15,25 @@
    with this program; if not, write to the Free Software Foundation,
    Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.  */
 
-#include <config.h>
+/* This file can be parametrized with the following macros:
+     ENABLE_UNISTDIO    Set to 1 to enable the unistdio extensions.
+     PRINTF_FETCHARGS   Name of the function to be defined.
+     STATIC             Set to 'static' to declare the function static.  */
+
+#ifndef PRINTF_FETCHARGS
+# include <config.h>
+#endif
 
 /* Specification.  */
-#include "printf-args.h"
+#ifndef PRINTF_FETCHARGS
+# include "printf-args.h"
+#endif
 
 #ifdef STATIC
 STATIC
 #endif
 int
-printf_fetchargs (va_list args, arguments *a)
+PRINTF_FETCHARGS (va_list args, arguments *a)
 {
   size_t i;
   argument *ap;
@@ -56,7 +65,7 @@
       case TYPE_ULONGINT:
        ap->a.a_ulongint = va_arg (args, unsigned long int);
        break;
-#ifdef HAVE_LONG_LONG
+#if HAVE_LONG_LONG_INT
       case TYPE_LONGLONGINT:
        ap->a.a_longlongint = va_arg (args, long long int);
        break;
@@ -67,15 +76,13 @@
       case TYPE_DOUBLE:
        ap->a.a_double = va_arg (args, double);
        break;
-#ifdef HAVE_LONG_DOUBLE
       case TYPE_LONGDOUBLE:
        ap->a.a_longdouble = va_arg (args, long double);
        break;
-#endif
       case TYPE_CHAR:
        ap->a.a_char = va_arg (args, int);
        break;
-#ifdef HAVE_WINT_T
+#if HAVE_WINT_T
       case TYPE_WIDE_CHAR:
        /* Although ISO C 99 7.24.1.(2) says that wint_t is "unchanged by
           default argument promotions", this is not the case in mingw32,
@@ -94,7 +101,7 @@
        if (ap->a.a_string == NULL)
          ap->a.a_string = "(NULL)";
        break;
-#ifdef HAVE_WCHAR_T
+#if HAVE_WCHAR_T
       case TYPE_WIDE_STRING:
        ap->a.a_wide_string = va_arg (args, const wchar_t *);
        /* A null pointer is an invalid argument for "%ls", but in practice
@@ -128,11 +135,50 @@
       case TYPE_COUNT_LONGINT_POINTER:
        ap->a.a_count_longint_pointer = va_arg (args, long int *);
        break;
-#ifdef HAVE_LONG_LONG
+#if HAVE_LONG_LONG_INT
       case TYPE_COUNT_LONGLONGINT_POINTER:
        ap->a.a_count_longlongint_pointer = va_arg (args, long long int *);
        break;
 #endif
+#if ENABLE_UNISTDIO
+      /* The unistdio extensions.  */
+      case TYPE_U8_STRING:
+       ap->a.a_u8_string = va_arg (args, const uint8_t *);
+       /* A null pointer is an invalid argument for "%U", but in practice
+          it occurs quite frequently in printf statements that produce
+          debug output.  Use a fallback in this case.  */
+       if (ap->a.a_u8_string == NULL)
+         {
+           static const uint8_t u8_null_string[] =
+             { '(', 'N', 'U', 'L', 'L', ')', 0 };
+           ap->a.a_u8_string = u8_null_string;
+         }
+       break;
+      case TYPE_U16_STRING:
+       ap->a.a_u16_string = va_arg (args, const uint16_t *);
+       /* A null pointer is an invalid argument for "%lU", but in practice
+          it occurs quite frequently in printf statements that produce
+          debug output.  Use a fallback in this case.  */
+       if (ap->a.a_u16_string == NULL)
+         {
+           static const uint16_t u16_null_string[] =
+             { '(', 'N', 'U', 'L', 'L', ')', 0 };
+           ap->a.a_u16_string = u16_null_string;
+         }
+       break;
+      case TYPE_U32_STRING:
+       ap->a.a_u32_string = va_arg (args, const uint32_t *);
+       /* A null pointer is an invalid argument for "%llU", but in practice
+          it occurs quite frequently in printf statements that produce
+          debug output.  Use a fallback in this case.  */
+       if (ap->a.a_u32_string == NULL)
+         {
+           static const uint32_t u32_null_string[] =
+             { '(', 'N', 'U', 'L', 'L', ')', 0 };
+           ap->a.a_u32_string = u32_null_string;
+         }
+       break;
+#endif
       default:
        /* Unknown type.  */
        return -1;

Index: printf-args.h
===================================================================
RCS file: /cvsroot/cvs/ccvs/lib/printf-args.h,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -b -r1.2 -r1.3
--- printf-args.h       23 May 2005 17:44:32 -0000      1.2
+++ printf-args.h       22 Aug 2007 12:48:43 -0000      1.3
@@ -1,5 +1,5 @@
 /* Decomposed printf argument list.
-   Copyright (C) 1999, 2002-2003 Free Software Foundation, Inc.
+   Copyright (C) 1999, 2002-2003, 2006-2007 Free Software Foundation, Inc.
 
    This program is free software; you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
@@ -18,16 +18,26 @@
 #ifndef _PRINTF_ARGS_H
 #define _PRINTF_ARGS_H
 
+/* This file can be parametrized with the following macros:
+     ENABLE_UNISTDIO    Set to 1 to enable the unistdio extensions.
+     PRINTF_FETCHARGS   Name of the function to be declared.
+     STATIC             Set to 'static' to declare the function static.  */
+
+/* Default parameters.  */
+#ifndef PRINTF_FETCHARGS
+# define PRINTF_FETCHARGS printf_fetchargs
+#endif
+
 /* Get size_t.  */
 #include <stddef.h>
 
 /* Get wchar_t.  */
-#ifdef HAVE_WCHAR_T
+#if HAVE_WCHAR_T
 # include <stddef.h>
 #endif
 
 /* Get wint_t.  */
-#ifdef HAVE_WINT_T
+#if HAVE_WINT_T
 # include <wchar.h>
 #endif
 
@@ -47,20 +57,18 @@
   TYPE_UINT,
   TYPE_LONGINT,
   TYPE_ULONGINT,
-#ifdef HAVE_LONG_LONG
+#if HAVE_LONG_LONG_INT
   TYPE_LONGLONGINT,
   TYPE_ULONGLONGINT,
 #endif
   TYPE_DOUBLE,
-#ifdef HAVE_LONG_DOUBLE
   TYPE_LONGDOUBLE,
-#endif
   TYPE_CHAR,
-#ifdef HAVE_WINT_T
+#if HAVE_WINT_T
   TYPE_WIDE_CHAR,
 #endif
   TYPE_STRING,
-#ifdef HAVE_WCHAR_T
+#if HAVE_WCHAR_T
   TYPE_WIDE_STRING,
 #endif
   TYPE_POINTER,
@@ -68,9 +76,15 @@
   TYPE_COUNT_SHORT_POINTER,
   TYPE_COUNT_INT_POINTER,
   TYPE_COUNT_LONGINT_POINTER
-#ifdef HAVE_LONG_LONG
+#if HAVE_LONG_LONG_INT
 , TYPE_COUNT_LONGLONGINT_POINTER
 #endif
+#if ENABLE_UNISTDIO
+  /* The unistdio extensions.  */
+, TYPE_U8_STRING
+, TYPE_U16_STRING
+, TYPE_U32_STRING
+#endif
 } arg_type;
 
 /* Polymorphic argument */
@@ -87,21 +101,19 @@
     unsigned int               a_uint;
     long int                   a_longint;
     unsigned long int          a_ulongint;
-#ifdef HAVE_LONG_LONG
+#if HAVE_LONG_LONG_INT
     long long int              a_longlongint;
     unsigned long long int     a_ulonglongint;
 #endif
     float                      a_float;
     double                     a_double;
-#ifdef HAVE_LONG_DOUBLE
     long double                        a_longdouble;
-#endif
     int                                a_char;
-#ifdef HAVE_WINT_T
+#if HAVE_WINT_T
     wint_t                     a_wide_char;
 #endif
     const char*                        a_string;
-#ifdef HAVE_WCHAR_T
+#if HAVE_WCHAR_T
     const wchar_t*             a_wide_string;
 #endif
     void*                      a_pointer;
@@ -109,9 +121,15 @@
     short *                    a_count_short_pointer;
     int *                      a_count_int_pointer;
     long int *                 a_count_longint_pointer;
-#ifdef HAVE_LONG_LONG
+#if HAVE_LONG_LONG_INT
     long long int *            a_count_longlongint_pointer;
 #endif
+#if ENABLE_UNISTDIO
+    /* The unistdio extensions.  */
+    const uint8_t *            a_u8_string;
+    const uint16_t *           a_u16_string;
+    const uint32_t *           a_u32_string;
+#endif
   }
   a;
 }
@@ -131,6 +149,6 @@
 #else
 extern
 #endif
-int printf_fetchargs (va_list args, arguments *a);
+int PRINTF_FETCHARGS (va_list args, arguments *a);
 
 #endif /* _PRINTF_ARGS_H */

Index: printf-parse.c
===================================================================
RCS file: /cvsroot/cvs/ccvs/lib/printf-parse.c,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -b -r1.3 -r1.4
--- printf-parse.c      22 Sep 2006 17:54:40 -0000      1.3
+++ printf-parse.c      22 Aug 2007 12:48:43 -0000      1.4
@@ -1,5 +1,5 @@
 /* Formatted output to strings.
-   Copyright (C) 1999-2000, 2002-2003, 2006 Free Software Foundation, Inc.
+   Copyright (C) 1999-2000, 2002-2003, 2006-2007 Free Software Foundation, Inc.
 
    This program is free software; you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
@@ -15,24 +15,49 @@
    with this program; if not, write to the Free Software Foundation,
    Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.  */
 
-#include <config.h>
+/* This file can be parametrized with the following macros:
+     CHAR_T             The element type of the format string.
+     CHAR_T_ONLY_ASCII  Set to 1 to enable verification that all characters
+                        in the format string are ASCII.
+     DIRECTIVE          Structure denoting a format directive.
+                        Depends on CHAR_T.
+     DIRECTIVES         Structure denoting the set of format directives of a
+                        format string.  Depends on CHAR_T.
+     PRINTF_PARSE       Function that parses a format string.
+                        Depends on CHAR_T.
+     STATIC             Set to 'static' to declare the function static.
+     ENABLE_UNISTDIO    Set to 1 to enable the unistdio extensions.  */
+
+#ifndef PRINTF_PARSE
+# include <config.h>
+#endif
 
 /* Specification.  */
-#if WIDE_CHAR_VERSION
-# include "wprintf-parse.h"
-#else
+#ifndef PRINTF_PARSE
 # include "printf-parse.h"
 #endif
 
+/* Default parameters.  */
+#ifndef PRINTF_PARSE
+# define PRINTF_PARSE printf_parse
+# define CHAR_T char
+# define DIRECTIVE char_directive
+# define DIRECTIVES char_directives
+#endif
+
 /* Get size_t, NULL.  */
 #include <stddef.h>
 
 /* Get intmax_t.  */
-#if HAVE_STDINT_H_WITH_UINTMAX
+#ifdef IN_LIBINTL
+# if HAVE_STDINT_H_WITH_UINTMAX
 # include <stdint.h>
-#endif
-#if HAVE_INTTYPES_H_WITH_UINTMAX
+# endif
+# if HAVE_INTTYPES_H_WITH_UINTMAX
 # include <inttypes.h>
+# endif
+#else
+# include <stdint.h>
 #endif
 
 /* malloc(), realloc(), free().  */
@@ -41,16 +66,9 @@
 /* Checked size_t computations.  */
 #include "xsize.h"
 
-#if WIDE_CHAR_VERSION
-# define PRINTF_PARSE wprintf_parse
-# define CHAR_T wchar_t
-# define DIRECTIVE wchar_t_directive
-# define DIRECTIVES wchar_t_directives
-#else
-# define PRINTF_PARSE printf_parse
-# define CHAR_T char
-# define DIRECTIVE char_directive
-# define DIRECTIVES char_directives
+#if CHAR_T_ONLY_ASCII
+/* c_isascii().  */
+# include "c-ctype.h"
 #endif
 
 #ifdef STATIC
@@ -68,7 +86,7 @@
 
   d->count = 0;
   d_allocated = 1;
-  d->dir = malloc (d_allocated * sizeof (DIRECTIVE));
+  d->dir = (DIRECTIVE *) malloc (d_allocated * sizeof (DIRECTIVE));
   if (d->dir == NULL)
     /* Out of memory.  */
     return -1;
@@ -92,7 +110,7 @@
        if (size_overflow_p (memory_size))                              \
          /* Overflow, would lead to out of memory.  */                 \
          goto error;                                                   \
-       memory = (a->arg                                                \
+       memory = (argument *) (a->arg                                   \
                  ? realloc (a->arg, memory_size)                       \
                  : malloc (memory_size));                              \
        if (memory == NULL)                                             \
@@ -115,7 +133,7 @@
       if (c == '%')
        {
          size_t arg_index = ARG_NONE;
-         DIRECTIVE *dp = &d->dir[d->count];/* pointer to next directive */
+         DIRECTIVE *dp = &d->dir[d->count]; /* pointer to next directive */
 
          /* Initialize the next directive.  */
          dp->dir_start = cp - 1;
@@ -326,7 +344,6 @@
                      flags += 8;
                      cp++;
                    }
-#ifdef HAVE_INTMAX_T
                  else if (*cp == 'j')
                    {
                      if (sizeof (intmax_t) > sizeof (long))
@@ -341,7 +358,6 @@
                        }
                      cp++;
                    }
-#endif
                  else if (*cp == 'z' || *cp == 'Z')
                    {
                      /* 'z' is standardized in ISO C 99, but glibc uses 'Z'
@@ -382,11 +398,14 @@
              switch (c)
                {
                case 'd': case 'i':
-#ifdef HAVE_LONG_LONG
+#if HAVE_LONG_LONG_INT
+                 /* If 'long long' exists and is larger than 'long':  */
                  if (flags >= 16 || (flags & 4))
                    type = TYPE_LONGLONGINT;
                  else
 #endif
+                 /* If 'long long' exists and is the same as 'long', we parse
+                    "lld" into TYPE_LONGINT.  */
                  if (flags >= 8)
                    type = TYPE_LONGINT;
                  else if (flags & 2)
@@ -397,11 +416,14 @@
                    type = TYPE_INT;
                  break;
                case 'o': case 'u': case 'x': case 'X':
-#ifdef HAVE_LONG_LONG
+#if HAVE_LONG_LONG_INT
+                 /* If 'long long' exists and is larger than 'long':  */
                  if (flags >= 16 || (flags & 4))
                    type = TYPE_ULONGLONGINT;
                  else
 #endif
+                 /* If 'unsigned long long' exists and is the same as
+                    'unsigned long', we parse "llu" into TYPE_ULONGINT.  */
                  if (flags >= 8)
                    type = TYPE_ULONGINT;
                  else if (flags & 2)
@@ -413,16 +435,14 @@
                  break;
                case 'f': case 'F': case 'e': case 'E': case 'g': case 'G':
                case 'a': case 'A':
-#ifdef HAVE_LONG_DOUBLE
                  if (flags >= 16 || (flags & 4))
                    type = TYPE_LONGDOUBLE;
                  else
-#endif
                  type = TYPE_DOUBLE;
                  break;
                case 'c':
                  if (flags >= 8)
-#ifdef HAVE_WINT_T
+#if HAVE_WINT_T
                    type = TYPE_WIDE_CHAR;
 #else
                    goto error;
@@ -430,7 +450,7 @@
                  else
                    type = TYPE_CHAR;
                  break;
-#ifdef HAVE_WINT_T
+#if HAVE_WINT_T
                case 'C':
                  type = TYPE_WIDE_CHAR;
                  c = 'c';
@@ -438,7 +458,7 @@
 #endif
                case 's':
                  if (flags >= 8)
-#ifdef HAVE_WCHAR_T
+#if HAVE_WCHAR_T
                    type = TYPE_WIDE_STRING;
 #else
                    goto error;
@@ -446,7 +466,7 @@
                  else
                    type = TYPE_STRING;
                  break;
-#ifdef HAVE_WCHAR_T
+#if HAVE_WCHAR_T
                case 'S':
                  type = TYPE_WIDE_STRING;
                  c = 's';
@@ -456,11 +476,14 @@
                  type = TYPE_POINTER;
                  break;
                case 'n':
-#ifdef HAVE_LONG_LONG
+#if HAVE_LONG_LONG_INT
+                 /* If 'long long' exists and is larger than 'long':  */
                  if (flags >= 16 || (flags & 4))
                    type = TYPE_COUNT_LONGLONGINT_POINTER;
                  else
 #endif
+                 /* If 'long long' exists and is the same as 'long', we parse
+                    "lln" into TYPE_COUNT_LONGINT_POINTER.  */
                  if (flags >= 8)
                    type = TYPE_COUNT_LONGINT_POINTER;
                  else if (flags & 2)
@@ -470,6 +493,17 @@
                  else
                    type = TYPE_COUNT_INT_POINTER;
                  break;
+#if ENABLE_UNISTDIO
+               /* The unistdio extensions.  */
+               case 'U':
+                 if (flags >= 16)
+                   type = TYPE_U32_STRING;
+                 else if (flags >= 8)
+                   type = TYPE_U16_STRING;
+                 else
+                   type = TYPE_U8_STRING;
+                 break;
+#endif
                case '%':
                  type = TYPE_NONE;
                  break;
@@ -506,13 +540,20 @@
              if (size_overflow_p (memory_size))
                /* Overflow, would lead to out of memory.  */
                goto error;
-             memory = realloc (d->dir, memory_size);
+             memory = (DIRECTIVE *) realloc (d->dir, memory_size);
              if (memory == NULL)
                /* Out of memory.  */
                goto error;
              d->dir = memory;
            }
        }
+#if CHAR_T_ONLY_ASCII
+      else if (!c_isascii (c))
+       {
+         /* Non-ASCII character.  Not supported.  */
+         goto error;
+       }
+#endif
     }
   d->dir[d->count].dir_start = cp;
 
@@ -528,7 +569,8 @@
   return -1;
 }
 
+#undef PRINTF_PARSE
 #undef DIRECTIVES
 #undef DIRECTIVE
+#undef CHAR_T_ONLY_ASCII
 #undef CHAR_T
-#undef PRINTF_PARSE

Index: printf-parse.h
===================================================================
RCS file: /cvsroot/cvs/ccvs/lib/printf-parse.h,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -b -r1.2 -r1.3
--- printf-parse.h      23 May 2005 17:44:32 -0000      1.2
+++ printf-parse.h      22 Aug 2007 12:48:43 -0000      1.3
@@ -1,5 +1,5 @@
 /* Parse printf format string.
-   Copyright (C) 1999, 2002-2003 Free Software Foundation, Inc.
+   Copyright (C) 1999, 2002-2003, 2005, 2007 Free Software Foundation, Inc.
 
    This program is free software; you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
@@ -18,6 +18,10 @@
 #ifndef _PRINTF_PARSE_H
 #define _PRINTF_PARSE_H
 
+/* This file can be parametrized with the following macros:
+     ENABLE_UNISTDIO    Set to 1 to enable the unistdio extensions.
+     STATIC             Set to 'static' to declare the function static.  */
+
 #include "printf-args.h"
 
 
@@ -32,6 +36,9 @@
 /* arg_index value indicating that no argument is consumed.  */
 #define ARG_NONE       (~(size_t)0)
 
+/* xxx_directive: A parsed directive.
+   xxx_directives: A parsed format string.  */
+
 /* A parsed directive.  */
 typedef struct
 {
@@ -44,7 +51,7 @@
   const char* precision_start;
   const char* precision_end;
   size_t precision_arg_index;
-  char conversion; /* d i o u x X f e E g G c s p n U % but not C S */
+  char conversion; /* d i o u x X f F e E g G a A c s p n U % but not C S */
   size_t arg_index;
 }
 char_directive;
@@ -59,16 +66,114 @@
 }
 char_directives;
 
+#if ENABLE_UNISTDIO
+
+/* A parsed directive.  */
+typedef struct
+{
+  const uint8_t* dir_start;
+  const uint8_t* dir_end;
+  int flags;
+  const uint8_t* width_start;
+  const uint8_t* width_end;
+  size_t width_arg_index;
+  const uint8_t* precision_start;
+  const uint8_t* precision_end;
+  size_t precision_arg_index;
+  uint8_t conversion; /* d i o u x X f F e E g G a A c s p n U % but not C S */
+  size_t arg_index;
+}
+u8_directive;
+
+/* A parsed format string.  */
+typedef struct
+{
+  size_t count;
+  u8_directive *dir;
+  size_t max_width_length;
+  size_t max_precision_length;
+}
+u8_directives;
+
+/* A parsed directive.  */
+typedef struct
+{
+  const uint16_t* dir_start;
+  const uint16_t* dir_end;
+  int flags;
+  const uint16_t* width_start;
+  const uint16_t* width_end;
+  size_t width_arg_index;
+  const uint16_t* precision_start;
+  const uint16_t* precision_end;
+  size_t precision_arg_index;
+  uint16_t conversion; /* d i o u x X f F e E g G a A c s p n U % but not C S 
*/
+  size_t arg_index;
+}
+u16_directive;
+
+/* A parsed format string.  */
+typedef struct
+{
+  size_t count;
+  u16_directive *dir;
+  size_t max_width_length;
+  size_t max_precision_length;
+}
+u16_directives;
+
+/* A parsed directive.  */
+typedef struct
+{
+  const uint32_t* dir_start;
+  const uint32_t* dir_end;
+  int flags;
+  const uint32_t* width_start;
+  const uint32_t* width_end;
+  size_t width_arg_index;
+  const uint32_t* precision_start;
+  const uint32_t* precision_end;
+  size_t precision_arg_index;
+  uint32_t conversion; /* d i o u x X f F e E g G a A c s p n U % but not C S 
*/
+  size_t arg_index;
+}
+u32_directive;
+
+/* A parsed format string.  */
+typedef struct
+{
+  size_t count;
+  u32_directive *dir;
+  size_t max_width_length;
+  size_t max_precision_length;
+}
+u32_directives;
+
+#endif
+
 
 /* Parses the format string.  Fills in the number N of directives, and fills
    in directives[0], ..., directives[N-1], and sets directives[N].dir_start
    to the end of the format string.  Also fills in the arg_type fields of the
    arguments and the needed count of arguments.  */
-#ifdef STATIC
-STATIC
+#if ENABLE_UNISTDIO
+extern int
+       ulc_printf_parse (const char *format, char_directives *d, arguments *a);
+extern int
+       u8_printf_parse (const uint8_t *format, u8_directives *d, arguments *a);
+extern int
+       u16_printf_parse (const uint16_t *format, u16_directives *d,
+                        arguments *a);
+extern int
+       u32_printf_parse (const uint32_t *format, u32_directives *d,
+                        arguments *a);
 #else
+# ifdef STATIC
+STATIC
+# else
 extern
-#endif
+# endif
 int printf_parse (const char *format, char_directives *d, arguments *a);
+#endif
 
 #endif /* _PRINTF_PARSE_H */

Index: quotearg.c
===================================================================
RCS file: /cvsroot/cvs/ccvs/lib/quotearg.c,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -b -r1.7 -r1.8
--- quotearg.c  22 Sep 2006 17:54:40 -0000      1.7
+++ quotearg.c  22 Aug 2007 12:48:43 -0000      1.8
@@ -1,6 +1,6 @@
 /* quotearg.c - quote arguments for output
 
-   Copyright (C) 1998, 1999, 2000, 2001, 2002, 2004, 2005, 2006 Free
+   Copyright (C) 1998, 1999, 2000, 2001, 2002, 2004, 2005, 2006, 2007 Free
    Software Foundation, Inc.
 
    This program is free software; you can redistribute it and/or modify
@@ -31,26 +31,21 @@
 #include <stdbool.h>
 #include <stdlib.h>
 #include <string.h>
+#include <wchar.h>
+#include <wctype.h>
 
 #include "gettext.h"
 #define _(msgid) gettext (msgid)
 #define N_(msgid) msgid
 
-#if HAVE_WCHAR_H
-
-/* BSD/OS 4.1 wchar.h requires FILE and struct tm to be declared.  */
-# include <stdio.h>
-# include <time.h>
-
-# include <wchar.h>
-#endif
-
 #if !HAVE_MBRTOWC
 /* Disable multibyte processing entirely.  Since MB_CUR_MAX is 1, the
    other macros are defined only for documentation and to satisfy C
    syntax.  */
 # undef MB_CUR_MAX
 # define MB_CUR_MAX 1
+# undef mbstate_t
+# define mbstate_t int
 # define mbrtowc(pwc, s, n, ps) ((*(pwc) = *(s)) != 0)
 # define iswprint(wc) isprint ((unsigned char) (wc))
 # undef HAVE_MBSINIT
@@ -60,15 +55,6 @@
 # define mbsinit(ps) 1
 #endif
 
-#ifndef iswprint
-# if HAVE_WCTYPE_H
-#  include <wctype.h>
-# endif
-# if !defined iswprint && !HAVE_ISWPRINT
-#  define iswprint(wc) 1
-# endif
-#endif
-
 #ifndef SIZE_MAX
 # define SIZE_MAX ((size_t) -1)
 #endif
@@ -120,8 +106,8 @@
 clone_quoting_options (struct quoting_options *o)
 {
   int e = errno;
-  struct quoting_options *p = xmalloc (sizeof *p);
-  *p = *(o ? o : &default_quoting_options);
+  struct quoting_options *p = xmemdup (o ? o : &default_quoting_options,
+                                      sizeof *o);
   errno = e;
   return p;
 }
@@ -552,12 +538,47 @@
 {
   int e = errno;
   size_t bufsize = quotearg_buffer (0, 0, arg, argsize, o) + 1;
-  char *buf = xmalloc (bufsize);
+  char *buf = xcharalloc (bufsize);
   quotearg_buffer (buf, bufsize, arg, argsize, o);
   errno = e;
   return buf;
 }
 
+/* A storage slot with size and pointer to a value.  */
+struct slotvec
+{
+  size_t size;
+  char *val;
+};
+
+/* Preallocate a slot 0 buffer, so that the caller can always quote
+   one small component of a "memory exhausted" message in slot 0.  */
+static char slot0[256];
+static unsigned int nslots = 1;
+static struct slotvec slotvec0 = {sizeof slot0, slot0};
+static struct slotvec *slotvec = &slotvec0;
+
+void
+quotearg_free (void)
+{
+  struct slotvec *sv = slotvec;
+  unsigned int i;
+  for (i = 1; i < nslots; i++)
+    free (sv[i].val);
+  if (sv[0].val != slot0)
+    {
+      free (sv[0].val);
+      slotvec0.size = sizeof slot0;
+      slotvec0.val = slot0;
+    }
+  if (sv != &slotvec0)
+    {
+      free (sv);
+      slotvec = &slotvec0;
+    }
+  nslots = 1;
+}
+
 /* Use storage slot N to return a quoted version of argument ARG.
    ARG is of size ARGSIZE, but if that is SIZE_MAX, ARG is a
    null-terminated string.
@@ -572,18 +593,8 @@
 {
   int e = errno;
 
-  /* Preallocate a slot 0 buffer, so that the caller can always quote
-     one small component of a "memory exhausted" message in slot 0.  */
-  static char slot0[256];
-  static unsigned int nslots = 1;
   unsigned int n0 = n;
-  struct slotvec
-    {
-      size_t size;
-      char *val;
-    };
-  static struct slotvec slotvec0 = {sizeof slot0, slot0};
-  static struct slotvec *slotvec = &slotvec0;
+  struct slotvec *sv = slotvec;
 
   if (n < 0)
     abort ();
@@ -596,31 +607,29 @@
         revert to the original type, so that the test in xalloc_oversized
         is once again performed only at compile time.  */
       size_t n1 = n0 + 1;
+      bool preallocated = (sv == &slotvec0);
 
-      if (xalloc_oversized (n1, sizeof *slotvec))
+      if (xalloc_oversized (n1, sizeof *sv))
        xalloc_die ();
 
-      if (slotvec == &slotvec0)
-       {
-         slotvec = xmalloc (sizeof *slotvec);
-         *slotvec = slotvec0;
-       }
-      slotvec = xrealloc (slotvec, n1 * sizeof *slotvec);
-      memset (slotvec + nslots, 0, (n1 - nslots) * sizeof *slotvec);
+      slotvec = sv = xrealloc (preallocated ? NULL : sv, n1 * sizeof *sv);
+      if (preallocated)
+       *sv = slotvec0;
+      memset (sv + nslots, 0, (n1 - nslots) * sizeof *sv);
       nslots = n1;
     }
 
   {
-    size_t size = slotvec[n].size;
-    char *val = slotvec[n].val;
+    size_t size = sv[n].size;
+    char *val = sv[n].val;
     size_t qsize = quotearg_buffer (val, size, arg, argsize, options);
 
     if (size <= qsize)
       {
-       slotvec[n].size = size = qsize + 1;
+       sv[n].size = size = qsize + 1;
        if (val != slot0)
          free (val);
-       slotvec[n].val = val = xmalloc (size);
+       sv[n].val = val = xcharalloc (size);
        quotearg_buffer (val, size, arg, argsize, options);
       }
 

Index: quotearg.h
===================================================================
RCS file: /cvsroot/cvs/ccvs/lib/quotearg.h,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -b -r1.2 -r1.3
--- quotearg.h  23 May 2005 17:44:32 -0000      1.2
+++ quotearg.h  22 Aug 2007 12:48:43 -0000      1.3
@@ -1,7 +1,7 @@
 /* quotearg.h - quote arguments for output
 
-   Copyright (C) 1998, 1999, 2000, 2001, 2002, 2004 Free Software
-   Foundation, Inc.
+   Copyright (C) 1998, 1999, 2000, 2001, 2002, 2004, 2006 Free
+   Software Foundation, Inc.
 
    This program is free software; you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
@@ -134,4 +134,7 @@
 /* Equivalent to quotearg_char (ARG, ':').  */
 char *quotearg_colon (char const *arg);
 
+/* Free any dynamically allocated memory.  */
+void quotearg_free (void);
+
 #endif /* !QUOTEARG_H_ */

Index: readlink.c
===================================================================
RCS file: /cvsroot/cvs/ccvs/lib/readlink.c,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -b -r1.6 -r1.7
--- readlink.c  22 Sep 2006 17:54:40 -0000      1.6
+++ readlink.c  22 Aug 2007 12:48:43 -0000      1.7
@@ -1,5 +1,5 @@
 /* Stub for readlink().
-   Copyright (C) 2003-2006 Free Software Foundation, Inc.
+   Copyright (C) 2003-2007 Free Software Foundation, Inc.
 
    This program is free software; you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
@@ -17,6 +17,9 @@
 
 #include <config.h>
 
+/* Specification.  */
+#include <unistd.h>
+
 #include <errno.h>
 #include <sys/types.h>
 #include <sys/stat.h>

Index: regcomp.c
===================================================================
RCS file: /cvsroot/cvs/ccvs/lib/regcomp.c,v
retrieving revision 1.9
retrieving revision 1.10
diff -u -b -r1.9 -r1.10
--- regcomp.c   14 Apr 2006 07:40:35 -0000      1.9
+++ regcomp.c   22 Aug 2007 12:48:44 -0000      1.10
@@ -1,5 +1,5 @@
 /* Extended regular expression matching and search library.
-   Copyright (C) 2002,2003,2004,2005,2006 Free Software Foundation, Inc.
+   Copyright (C) 2002,2003,2004,2005,2006,2007 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Contributed by Isamu Hasegawa <address@hidden>.
 
@@ -451,8 +451,8 @@
 
 int
 regcomp (preg, pattern, cflags)
-    regex_t *__restrict preg;
-    const char *__restrict pattern;
+    regex_t *_Restrict_ preg;
+    const char *_Restrict_ pattern;
     int cflags;
 {
   reg_errcode_t ret;
@@ -515,13 +515,13 @@
 size_t
 regerror (errcode, preg, errbuf, errbuf_size)
     int errcode;
-    const regex_t *__restrict preg;
-    char *__restrict errbuf;
+    const regex_t *_Restrict_ preg;
+    char *_Restrict_ errbuf;
     size_t errbuf_size;
 #else /* size_t might promote */
 size_t
-regerror (int errcode, const regex_t *__restrict preg,
-         char *__restrict errbuf, size_t errbuf_size)
+regerror (int errcode, const regex_t *_Restrict_ preg,
+         char *_Restrict_ errbuf, size_t errbuf_size)
 #endif
 {
   const char *msg;
@@ -542,17 +542,13 @@
 
   if (BE (errbuf_size != 0, 1))
     {
+      size_t cpy_size = msg_size;
       if (BE (msg_size > errbuf_size, 0))
        {
-#if defined HAVE_MEMPCPY || defined _LIBC
-         *((char *) __mempcpy (errbuf, msg, errbuf_size - 1)) = '\0';
-#else
-         memcpy (errbuf, msg, errbuf_size - 1);
-         errbuf[errbuf_size - 1] = 0;
-#endif
+         cpy_size = errbuf_size - 1;
+         errbuf[cpy_size] = '\0';
        }
-      else
-       memcpy (errbuf, msg, msg_size);
+      memcpy (errbuf, msg, cpy_size);
     }
 
   return msg_size;
@@ -833,9 +829,6 @@
 init_dfa (re_dfa_t *dfa, size_t pat_len)
 {
   __re_size_t table_size;
-#ifndef _LIBC
-  char *codeset_name;
-#endif
 #ifdef RE_ENABLE_I18N
   size_t max_i18n_object_size = MAX (sizeof (wchar_t), sizeof (wctype_t));
 #else
@@ -879,22 +872,7 @@
   dfa->map_notascii = (_NL_CURRENT_WORD (LC_CTYPE, _NL_CTYPE_MAP_TO_NONASCII)
                       != 0);
 #else
-# ifdef HAVE_LANGINFO_CODESET
-  codeset_name = nl_langinfo (CODESET);
-# else
-  codeset_name = getenv ("LC_ALL");
-  if (codeset_name == NULL || codeset_name[0] == '\0')
-    codeset_name = getenv ("LC_CTYPE");
-  if (codeset_name == NULL || codeset_name[0] == '\0')
-    codeset_name = getenv ("LANG");
-  if (codeset_name == NULL)
-    codeset_name = "";
-  else if (strchr (codeset_name, '.') !=  NULL)
-    codeset_name = strchr (codeset_name, '.') + 1;
-# endif
-
-  if (strcasecmp (codeset_name, "UTF-8") == 0
-      || strcasecmp (codeset_name, "UTF8") == 0)
+  if (strcmp (locale_charset (), "UTF-8") == 0)
     dfa->is_utf8 = 1;
 
   /* We check exhaustively in the loop below if this charset is a
@@ -2177,7 +2155,7 @@
 parse_branch (re_string_t *regexp, regex_t *preg, re_token_t *token,
              reg_syntax_t syntax, Idx nest, reg_errcode_t *err)
 {
-  bin_tree_t *tree, *exp;
+  bin_tree_t *tree, *expr;
   re_dfa_t *dfa = (re_dfa_t *) preg->buffer;
   tree = parse_expression (regexp, preg, token, syntax, nest, err);
   if (BE (*err != REG_NOERROR && tree == NULL, 0))
@@ -2186,14 +2164,14 @@
   while (token->type != OP_ALT && token->type != END_OF_RE
         && (nest == 0 || token->type != OP_CLOSE_SUBEXP))
     {
-      exp = parse_expression (regexp, preg, token, syntax, nest, err);
-      if (BE (*err != REG_NOERROR && exp == NULL, 0))
+      expr = parse_expression (regexp, preg, token, syntax, nest, err);
+      if (BE (*err != REG_NOERROR && expr == NULL, 0))
        {
          return NULL;
        }
-      if (tree != NULL && exp != NULL)
+      if (tree != NULL && expr != NULL)
        {
-         tree = create_tree (dfa, tree, exp, CONCAT);
+         tree = create_tree (dfa, tree, expr, CONCAT);
          if (tree == NULL)
            {
              *err = REG_ESPACE;
@@ -2201,8 +2179,8 @@
            }
        }
       else if (tree == NULL)
-       tree = exp;
-      /* Otherwise exp == NULL, we don't need to create new tree.  */
+       tree = expr;
+      /* Otherwise expr == NULL, we don't need to create new tree.  */
     }
   return tree;
 }
@@ -3074,7 +3052,7 @@
 #endif /* not RE_ENABLE_I18N */
       non_match = true;
       if (syntax & RE_HAT_LISTS_NOT_NEWLINE)
-       bitset_set (sbcset, '\0');
+       bitset_set (sbcset, '\n');
       re_string_skip_bytes (regexp, token_len); /* Skip a token.  */
       token_len = peek_token_bracket (token, regexp, syntax);
       if (BE (token->type == END_OF_RE, 0))
@@ -3605,10 +3583,6 @@
   if (non_match)
     {
 #ifdef RE_ENABLE_I18N
-      /*
-      if (syntax & RE_HAT_LISTS_NOT_NEWLINE)
-       bitset_set(cset->sbcset, '\0');
-      */
       mbcset->non_match = 1;
 #endif /* not RE_ENABLE_I18N */
     }

Index: regex.h
===================================================================
RCS file: /cvsroot/cvs/ccvs/lib/regex.h,v
retrieving revision 1.14
retrieving revision 1.15
diff -u -b -r1.14 -r1.15
--- regex.h     16 Aug 2006 18:12:09 -0000      1.14
+++ regex.h     22 Aug 2007 12:48:44 -0000      1.15
@@ -625,38 +625,45 @@
 #endif
 
 /* GCC 2.95 and later have "__restrict"; C99 compilers have
-   "restrict", and "configure" may have defined "restrict".  */
-#ifndef __restrict
-# if ! (2 < __GNUC__ || (2 == __GNUC__ && 95 <= __GNUC_MINOR__))
-#  if defined restrict || 199901L <= __STDC_VERSION__
-#   define __restrict restrict
+   "restrict", and "configure" may have defined "restrict".
+   Other compilers use __restrict, __restrict__, and _Restrict, and
+   'configure' might #define 'restrict' to those words, so pick a
+   different name.  */
+#ifndef _Restrict_
+# if 199901L <= __STDC_VERSION__
+#  define _Restrict_ restrict
+# elif 2 < __GNUC__ || (2 == __GNUC__ && 95 <= __GNUC_MINOR__)
+#  define _Restrict_ __restrict
 #  else
-#   define __restrict
-#  endif
+#  define _Restrict_
 # endif
 #endif
-/* gcc 3.1 and up support the [restrict] syntax.  */
-#ifndef __restrict_arr
-# if (__GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 1)) \
-     && !defined __GNUG__
-#  define __restrict_arr __restrict
+/* gcc 3.1 and up support the [restrict] syntax.  Don't trust
+   sys/cdefs.h's definition of __restrict_arr, though, as it
+   mishandles gcc -ansi -pedantic.  */
+#ifndef _Restrict_arr_
+# if ((199901L <= __STDC_VERSION__                                     \
+       || ((3 < __GNUC__ || (3 == __GNUC__ && 1 <= __GNUC_MINOR__))    \
+          && !__STRICT_ANSI__))                                        \
+      && !defined __GNUG__)
+#  define _Restrict_arr_ _Restrict_
 # else
-#  define __restrict_arr
+#  define _Restrict_arr_
 # endif
 #endif
 
 /* POSIX compatibility.  */
-extern int regcomp (regex_t *__restrict __preg,
-                   const char *__restrict __pattern,
+extern int regcomp (regex_t *_Restrict_ __preg,
+                   const char *_Restrict_ __pattern,
                    int __cflags);
 
-extern int regexec (const regex_t *__restrict __preg,
-                   const char *__restrict __string, size_t __nmatch,
-                   regmatch_t __pmatch[__restrict_arr],
+extern int regexec (const regex_t *_Restrict_ __preg,
+                   const char *_Restrict_ __string, size_t __nmatch,
+                   regmatch_t __pmatch[_Restrict_arr_],
                    int __eflags);
 
-extern size_t regerror (int __errcode, const regex_t *__restrict __preg,
-                       char *__restrict __errbuf, size_t __errbuf_size);
+extern size_t regerror (int __errcode, const regex_t *_Restrict_ __preg,
+                       char *_Restrict_ __errbuf, size_t __errbuf_size);
 
 extern void regfree (regex_t *__preg);
 

Index: regex_internal.c
===================================================================
RCS file: /cvsroot/cvs/ccvs/lib/regex_internal.c,v
retrieving revision 1.10
retrieving revision 1.11
diff -u -b -r1.10 -r1.11
--- regex_internal.c    22 Sep 2006 17:54:40 -0000      1.10
+++ regex_internal.c    22 Aug 2007 12:48:44 -0000      1.11
@@ -1,5 +1,6 @@
 /* Extended regular expression matching and search library.
-   Copyright (C) 2002, 2003, 2004, 2005, 2006 Free Software Foundation, Inc.
+   Copyright (C) 2002, 2003, 2004, 2005, 2006, 2007 Free Software
+   Foundation, Inc.
    This file is part of the GNU C Library.
    Contributed by Isamu Hasegawa <address@hidden>.
 
@@ -706,7 +707,7 @@
 
              if (pstr->is_utf8)
                {
-                 const unsigned char *raw, *p, *q, *end;
+                 const unsigned char *raw, *p, *end;
 
                  /* Special case UTF-8.  Multi-byte chars start with any
                     byte other than 0x80 - 0xbf.  */
@@ -735,13 +736,11 @@
                          unsigned char buf[6];
                          size_t mbclen;
 
-                         q = p;
                          if (BE (pstr->trans != NULL, 0))
                            {
                              int i = mlen < 6 ? mlen : 6;
                              while (--i >= 0)
                                buf[i] = pstr->trans[p[i]];
-                             q = buf;
                            }
                          /* XXX Don't use mbrtowc, we know which conversion
                             to use (UTF-8 -> UCS4).  */

Index: regex_internal.h
===================================================================
RCS file: /cvsroot/cvs/ccvs/lib/regex_internal.h,v
retrieving revision 1.14
retrieving revision 1.15
diff -u -b -r1.14 -r1.15
--- regex_internal.h    21 Aug 2006 19:22:22 -0000      1.14
+++ regex_internal.h    22 Aug 2007 12:48:44 -0000      1.15
@@ -1,5 +1,5 @@
 /* Extended regular expression matching and search library.
-   Copyright (C) 2002, 2003, 2004, 2005, 2006 Free Software Foundation, Inc.
+   Copyright (C) 2002, 2003, 2004, 2005, 2006, 2007 Free Software Foundation, 
Inc.
    This file is part of the GNU C Library.
    Contributed by Isamu Hasegawa <address@hidden>.
 
@@ -27,22 +27,17 @@
 #include <stdlib.h>
 #include <string.h>
 
-#ifndef _LIBC
-# include "strcase.h"
-#endif
-
-#if defined HAVE_LANGINFO_H || defined HAVE_LANGINFO_CODESET || defined _LIBC
+#ifdef _LIBC
 # include <langinfo.h>
+#else
+# include "localcharset.h"
 #endif
 #if defined HAVE_LOCALE_H || defined _LIBC
 # include <locale.h>
 #endif
-#if defined HAVE_WCHAR_H || defined _LIBC
-# include <wchar.h>
-#endif /* HAVE_WCHAR_H || _LIBC */
-#if defined HAVE_WCTYPE_H || defined _LIBC
-# include <wctype.h>
-#endif /* HAVE_WCTYPE_H || _LIBC */
+
+#include <wchar.h>
+#include <wctype.h>
 #include <stdint.h>
 #if defined _LIBC
 # include <bits/libc-lock.h>
@@ -53,7 +48,7 @@
 #endif
 
 /* In case that the system doesn't have isblank().  */
-#if !defined _LIBC && !HAVE_DECL_ISBLANK && !defined isblank
+#if !defined _LIBC && ! (defined isblank || (HAVE_ISBLANK && 
HAVE_DECL_ISBLANK))
 # define isblank(ch) ((ch) == ' ' || (ch) == '\t')
 #endif
 
@@ -89,7 +84,7 @@
 # define SIZE_MAX ((size_t) -1)
 #endif
 
-#if (defined MB_CUR_MAX && HAVE_LOCALE_H && HAVE_WCTYPE_H && HAVE_WCHAR_H && 
HAVE_WCRTOMB && HAVE_MBRTOWC && HAVE_WCSCOLL) || _LIBC
+#if (defined MB_CUR_MAX && HAVE_LOCALE_H && HAVE_WCTYPE_H && HAVE_ISWCTYPE && 
HAVE_WCRTOMB && HAVE_MBRTOWC && HAVE_WCSCOLL) || _LIBC
 # define RE_ENABLE_I18N
 #endif
 
@@ -119,9 +114,6 @@
 # define __wctype wctype
 # define __iswctype iswctype
 # define __btowc btowc
-# ifndef __mempcpy
-#  define __mempcpy mempcpy
-# endif
 # define __wcrtomb wcrtomb
 # define __regfree regfree
 # define attribute_hidden
@@ -348,7 +340,7 @@
     Idx idx;                   /* for BACK_REF */
     re_context_type ctx_type;  /* for ANCHOR */
   } opr;
-#if __GNUC__ >= 2
+#if __GNUC__ >= 2 && !__STRICT_ANSI__
   re_token_type_t type : 8;
 #else
   re_token_type_t type;

Index: regexec.c
===================================================================
RCS file: /cvsroot/cvs/ccvs/lib/regexec.c,v
retrieving revision 1.9
retrieving revision 1.10
diff -u -b -r1.9 -r1.10
--- regexec.c   5 Jun 2006 07:14:34 -0000       1.9
+++ regexec.c   22 Aug 2007 12:48:44 -0000      1.10
@@ -1,5 +1,6 @@
 /* Extended regular expression matching and search library.
-   Copyright (C) 2002, 2003, 2004, 2005, 2006 Free Software Foundation, Inc.
+   Copyright (C) 2002, 2003, 2004, 2005, 2006, 2007 Free Software Foundation,
+   Inc.
    This file is part of the GNU C Library.
    Contributed by Isamu Hasegawa <address@hidden>.
 
@@ -221,10 +222,10 @@
 
 int
 regexec (preg, string, nmatch, pmatch, eflags)
-    const regex_t *__restrict preg;
-    const char *__restrict string;
+    const regex_t *_Restrict_ preg;
+    const char *_Restrict_ string;
     size_t nmatch;
-    regmatch_t pmatch[];
+    regmatch_t pmatch[_Restrict_arr_];
     int eflags;
 {
   reg_errcode_t err;
@@ -267,8 +268,8 @@
 
 int
 attribute_compat_text_section
-__compat_regexec (const regex_t *__restrict preg,
-                 const char *__restrict string, size_t nmatch,
+__compat_regexec (const regex_t *_Restrict_ preg,
+                 const char *_Restrict_ string, size_t nmatch,
                  regmatch_t pmatch[], int eflags)
 {
   return regexec (preg, string, nmatch, pmatch,
@@ -2338,7 +2339,7 @@
 }
 
 /* Update the state_log if we need */
-re_dfastate_t *
+static re_dfastate_t *
 internal_function
 merge_state_with_log (reg_errcode_t *err, re_match_context_t *mctx,
                      re_dfastate_t *next_state)
@@ -3966,7 +3967,7 @@
 # endif /* _LIBC */
        {
          /* match with range expression?  */
-#if __GNUC__ >= 2
+#if __GNUC__ >= 2 && ! (__STDC_VERSION__ < 199901L && __STRICT_ANSI__)
          wchar_t cmp_buf[] = {L'\0', L'\0', wc, L'\0', L'\0', L'\0'};
 #else
          wchar_t cmp_buf[] = {L'\0', L'\0', L'\0', L'\0', L'\0', L'\0'};

Index: setenv.c
===================================================================
RCS file: /cvsroot/cvs/ccvs/lib/setenv.c,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -b -r1.7 -r1.8
--- setenv.c    22 Sep 2006 17:54:40 -0000      1.7
+++ setenv.c    22 Aug 2007 12:48:44 -0000      1.8
@@ -1,4 +1,4 @@
-/* Copyright (C) 1992,1995-1999,2000-2003,2005,2006 Free Software Foundation, 
Inc.
+/* Copyright (C) 1992,1995-1999,2000-2003,2005-2007 Free Software Foundation, 
Inc.
    This file is part of the GNU C Library.
 
    This program is free software; you can redistribute it and/or modify
@@ -31,8 +31,10 @@
 # include <unistd.h>
 #endif
 
+#if _LIBC || !HAVE_SETENV
+
 #if !_LIBC
-# include "allocsa.h"
+# include "malloca.h"
 #endif
 
 #if !_LIBC
@@ -160,7 +162,7 @@
          __mempcpy (__mempcpy (__mempcpy (new_value, name, namelen), "=", 1),
                     value, vallen);
 # else
-         new_value = (char *) allocsa (namelen + 1 + vallen);
+         new_value = (char *) malloca (namelen + 1 + vallen);
          if (new_value == NULL)
            {
              __set_errno (ENOMEM);
@@ -180,7 +182,7 @@
              if (new_environ[size] == NULL)
                {
 #if defined USE_TSEARCH && !defined _LIBC
-                 freesa (new_value);
+                 freea (new_value);
 #endif
                  __set_errno (ENOMEM);
                  UNLOCK;
@@ -200,7 +202,7 @@
              STORE_VALUE (new_environ[size]);
            }
 #if defined USE_TSEARCH && !defined _LIBC
-         freesa (new_value);
+         freea (new_value);
 #endif
        }
 
@@ -228,7 +230,7 @@
          __mempcpy (__mempcpy (__mempcpy (new_value, name, namelen), "=", 1),
                     value, vallen);
 # else
-         new_value = allocsa (namelen + 1 + vallen);
+         new_value = malloca (namelen + 1 + vallen);
          if (new_value == NULL)
            {
              __set_errno (ENOMEM);
@@ -248,7 +250,7 @@
              if (np == NULL)
                {
 #if defined USE_TSEARCH && !defined _LIBC
-                 freesa (new_value);
+                 freea (new_value);
 #endif
                  __set_errno (ENOMEM);
                  UNLOCK;
@@ -266,7 +268,7 @@
              STORE_VALUE (np);
            }
 #if defined USE_TSEARCH && !defined _LIBC
-         freesa (new_value);
+         freea (new_value);
 #endif
        }
 
@@ -326,3 +328,5 @@
 weak_alias (__setenv, setenv)
 weak_alias (__clearenv, clearenv)
 #endif
+
+#endif /* _LIBC || !HAVE_SETENV */

Index: setenv.h
===================================================================
RCS file: /cvsroot/cvs/ccvs/lib/setenv.h,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -b -r1.3 -r1.4
--- setenv.h    23 May 2005 17:44:32 -0000      1.3
+++ setenv.h    22 Aug 2007 12:48:44 -0000      1.4
@@ -1,5 +1,5 @@
 /* Setting environment variables.
-   Copyright (C) 2001-2004 Free Software Foundation, Inc.
+   Copyright (C) 2001-2004, 2007 Free Software Foundation, Inc.
 
    This program is free software; you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by

Index: snprintf.c
===================================================================
RCS file: /cvsroot/cvs/ccvs/lib/snprintf.c,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -b -r1.3 -r1.4
--- snprintf.c  22 Sep 2006 17:54:40 -0000      1.3
+++ snprintf.c  22 Aug 2007 12:48:44 -0000      1.4
@@ -1,5 +1,5 @@
 /* Formatted output to strings.
-   Copyright (C) 2004, 2006 Free Software Foundation, Inc.
+   Copyright (C) 2004, 2006-2007 Free Software Foundation, Inc.
    Written by Simon Josefsson and Paul Eggert.
 
    This program is free software; you can redistribute it and/or modify
@@ -18,7 +18,8 @@
 
 #include <config.h>
 
-#include "snprintf.h"
+/* Specification.  */
+#include <stdio.h>
 
 #include <errno.h>
 #include <limits.h>

Index: stat-macros.h
===================================================================
RCS file: /cvsroot/cvs/ccvs/lib/stat-macros.h,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -b -r1.3 -r1.4
--- stat-macros.h       6 Jul 2006 02:17:59 -0000       1.3
+++ stat-macros.h       22 Aug 2007 12:48:44 -0000      1.4
@@ -1,260 +1,3 @@
-/* stat-related macros
-
-   Copyright (C) 1993, 1994, 2001, 2002, 2004, 2006 Free Software
-   Foundation, Inc.
-
-   This program is free software; you can redistribute it and/or modify
-   it under the terms of the GNU General Public License as published by
-   the Free Software Foundation; either version 2, or (at your option)
-   any later version.
-
-   This program is distributed in the hope that it will be useful,
-   but WITHOUT ANY WARRANTY; without even the implied warranty of
-   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-   GNU General Public License for more details.
-
-   You should have received a copy of the GNU General Public License
-   along with this program; if not, write to the Free Software Foundation,
-   Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.  */
-
-/* Written by Paul Eggert and Jim Meyering.  */
-
-#ifndef STAT_MACROS_H
-# define STAT_MACROS_H 1
-
-# if ! defined S_ISREG && ! defined S_IFREG
-#  error "you must include <sys/stat.h> before including this file"
-# endif
-
-# ifndef S_IFMT
-#  define S_IFMT 0170000
-# endif
-
-# if STAT_MACROS_BROKEN
-#  undef S_ISBLK
-#  undef S_ISCHR
-#  undef S_ISDIR
-#  undef S_ISFIFO
-#  undef S_ISLNK
-#  undef S_ISNAM
-#  undef S_ISMPB
-#  undef S_ISMPC
-#  undef S_ISNWK
-#  undef S_ISREG
-#  undef S_ISSOCK
-# endif
-
-
-# ifndef S_ISBLK
-#  ifdef S_IFBLK
-#   define S_ISBLK(m) (((m) & S_IFMT) == S_IFBLK)
-#  else
-#   define S_ISBLK(m) 0
-#  endif
-# endif
-
-# ifndef S_ISCHR
-#  ifdef S_IFCHR
-#   define S_ISCHR(m) (((m) & S_IFMT) == S_IFCHR)
-#  else
-#   define S_ISCHR(m) 0
-#  endif
-# endif
-
-# ifndef S_ISDIR
-#  ifdef S_IFDIR
-#   define S_ISDIR(m) (((m) & S_IFMT) == S_IFDIR)
-#  else
-#   define S_ISDIR(m) 0
-#  endif
-# endif
-
-# ifndef S_ISDOOR /* Solaris 2.5 and up */
-#  define S_ISDOOR(m) 0
-# endif
-
-# ifndef S_ISFIFO
-#  ifdef S_IFIFO
-#   define S_ISFIFO(m) (((m) & S_IFMT) == S_IFIFO)
-#  else
-#   define S_ISFIFO(m) 0
-#  endif
-# endif
-
-# ifndef S_ISLNK
-#  ifdef S_IFLNK
-#   define S_ISLNK(m) (((m) & S_IFMT) == S_IFLNK)
-#  else
-#   define S_ISLNK(m) 0
-#  endif
-# endif
-
-# ifndef S_ISMPB /* V7 */
-#  ifdef S_IFMPB
-#   define S_ISMPB(m) (((m) & S_IFMT) == S_IFMPB)
-#   define S_ISMPC(m) (((m) & S_IFMT) == S_IFMPC)
-#  else
-#   define S_ISMPB(m) 0
-#   define S_ISMPC(m) 0
-#  endif
-# endif
-
-# ifndef S_ISNAM /* Xenix */
-#  ifdef S_IFNAM
-#   define S_ISNAM(m) (((m) & S_IFMT) == S_IFNAM)
-#  else
-#   define S_ISNAM(m) 0
-#  endif
-# endif
-
-# ifndef S_ISNWK /* HP/UX */
-#  ifdef S_IFNWK
-#   define S_ISNWK(m) (((m) & S_IFMT) == S_IFNWK)
-#  else
-#   define S_ISNWK(m) 0
-#  endif
-# endif
-
-# ifndef S_ISPORT /* Solaris 10 and up */
-#  define S_ISPORT(m) 0
-# endif
-
-# ifndef S_ISREG
-#  ifdef S_IFREG
-#   define S_ISREG(m) (((m) & S_IFMT) == S_IFREG)
-#  else
-#   define S_ISREG(m) 0
-#  endif
-# endif
-
-# ifndef S_ISSOCK
-#  ifdef S_IFSOCK
-#   define S_ISSOCK(m) (((m) & S_IFMT) == S_IFSOCK)
-#  else
-#   define S_ISSOCK(m) 0
-#  endif
-# endif
-
-
-# ifndef S_TYPEISMQ
-#  define S_TYPEISMQ(p) 0
-# endif
-
-# ifndef S_TYPEISTMO
-#  define S_TYPEISTMO(p) 0
-# endif
-
-
-# ifndef S_TYPEISSEM
-#  ifdef S_INSEM
-#   define S_TYPEISSEM(p) (S_ISNAM ((p)->st_mode) && (p)->st_rdev == S_INSEM)
-#  else
-#   define S_TYPEISSEM(p) 0
-#  endif
-# endif
-
-# ifndef S_TYPEISSHM
-#  ifdef S_INSHD
-#   define S_TYPEISSHM(p) (S_ISNAM ((p)->st_mode) && (p)->st_rdev == S_INSHD)
-#  else
-#   define S_TYPEISSHM(p) 0
-#  endif
-# endif
-
-/* high performance ("contiguous data") */
-# ifndef S_ISCTG
-#  define S_ISCTG(p) 0
-# endif
-
-/* Cray DMF (data migration facility): off line, with data  */
-# ifndef S_ISOFD
-#  define S_ISOFD(p) 0
-# endif
-
-/* Cray DMF (data migration facility): off line, with no data  */
-# ifndef S_ISOFL
-#  define S_ISOFL(p) 0
-# endif
-
-/* 4.4BSD whiteout */
-# ifndef S_ISWHT
-#  define S_ISWHT(m) 0
-# endif
-
-/* If any of the following are undefined,
-   define them to their de facto standard values.  */
-# if !S_ISUID
-#  define S_ISUID 04000
-# endif
-# if !S_ISGID
-#  define S_ISGID 02000
-# endif
-
-/* S_ISVTX is a common extension to POSIX.  */
-# ifndef S_ISVTX
-#  define S_ISVTX 01000
-# endif
-
-# if !S_IRUSR && S_IREAD
-#  define S_IRUSR S_IREAD
-# endif
-# if !S_IRUSR
-#  define S_IRUSR 00400
-# endif
-# if !S_IRGRP
-#  define S_IRGRP (S_IRUSR >> 3)
-# endif
-# if !S_IROTH
-#  define S_IROTH (S_IRUSR >> 6)
-# endif
-
-# if !S_IWUSR && S_IWRITE
-#  define S_IWUSR S_IWRITE
-# endif
-# if !S_IWUSR
-#  define S_IWUSR 00200
-# endif
-# if !S_IWGRP
-#  define S_IWGRP (S_IWUSR >> 3)
-# endif
-# if !S_IWOTH
-#  define S_IWOTH (S_IWUSR >> 6)
-# endif
-
-# if !S_IXUSR && S_IEXEC
-#  define S_IXUSR S_IEXEC
-# endif
-# if !S_IXUSR
-#  define S_IXUSR 00100
-# endif
-# if !S_IXGRP
-#  define S_IXGRP (S_IXUSR >> 3)
-# endif
-# if !S_IXOTH
-#  define S_IXOTH (S_IXUSR >> 6)
-# endif
-
-# if !S_IRWXU
-#  define S_IRWXU (S_IRUSR | S_IWUSR | S_IXUSR)
-# endif
-# if !S_IRWXG
-#  define S_IRWXG (S_IRGRP | S_IWGRP | S_IXGRP)
-# endif
-# if !S_IRWXO
-#  define S_IRWXO (S_IROTH | S_IWOTH | S_IXOTH)
-# endif
-
-/* S_IXUGO is a common extension to POSIX.  */
-# if !S_IXUGO
-#  define S_IXUGO (S_IXUSR | S_IXGRP | S_IXOTH)
-# endif
-
-# ifndef S_IRWXUGO
-#  define S_IRWXUGO (S_IRWXU | S_IRWXG | S_IRWXO)
-# endif
-
 /* All the mode bits that can be affected by chmod.  */
-# define CHMOD_MODE_BITS \
+#define CHMOD_MODE_BITS \
   (S_ISUID | S_ISGID | S_ISVTX | S_IRWXU | S_IRWXG | S_IRWXO)
-
-#endif /* STAT_MACROS_H */

Index: stdbool_.h
===================================================================
RCS file: /cvsroot/cvs/ccvs/lib/stdbool_.h,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -b -r1.4 -r1.5
--- stdbool_.h  27 Jan 2006 07:38:45 -0000      1.4
+++ stdbool_.h  22 Aug 2007 12:48:45 -0000      1.5
@@ -1,4 +1,4 @@
-/* Copyright (C) 2001, 2002, 2003, 2006 Free Software Foundation, Inc.
+/* Copyright (C) 2001, 2002, 2003, 2006, 2007 Free Software Foundation, Inc.
    Written by Bruno Haible <address@hidden>, 2001.
 
    This program is free software; you can redistribute it and/or modify
@@ -15,8 +15,8 @@
    along with this program; if not, write to the Free Software Foundation,
    Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.  */
 
-#ifndef _STDBOOL_H
-#define _STDBOOL_H
+#ifndef _GL_STDBOOL_H
+#define _GL_STDBOOL_H
 
 /* ISO C 99 <stdbool.h> for platforms that lack it.  */
 
@@ -41,6 +41,9 @@
 
        - You cannot assume that _Bool is a typedef; it might be a macro.
 
+       - Bit-fields of type 'bool' are not supported.  Portable code
+         should use 'unsigned int foo : 1;' rather than 'bool foo : 1;'.
+
        - In C99, casts and automatic conversions to '_Bool' or 'bool' are
          performed in such a way that every nonzero value gets converted
          to 'true', and zero gets converted to 'false'.  This doesn't work
@@ -112,4 +115,4 @@
 #define true 1
 #define __bool_true_false_are_defined 1
 
-#endif /* _STDBOOL_H */
+#endif /* _GL_STDBOOL_H */

Index: stdint_.h
===================================================================
RCS file: /cvsroot/cvs/ccvs/lib/stdint_.h,v
retrieving revision 1.23
retrieving revision 1.24
diff -u -b -r1.23 -r1.24
--- stdint_.h   2 Sep 2006 23:17:59 -0000       1.23
+++ stdint_.h   22 Aug 2007 12:48:45 -0000      1.24
@@ -1,4 +1,4 @@
-/* Copyright (C) 2001-2002, 2004-2006 Free Software Foundation, Inc.
+/* Copyright (C) 2001-2002, 2004-2007 Free Software Foundation, Inc.
    Written by Paul Eggert, Bruno Haible, Sam Steingold, Peter Burwood.
    This file is part of gnulib.
 
@@ -16,14 +16,13 @@
    along with this program; if not, write to the Free Software Foundation,
    Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.  */
 
-#ifndef _GL_STDINT_H
-#define _GL_STDINT_H
-
 /*
  * ISO C 99 <stdint.h> for platforms that lack it.
  * <http://www.opengroup.org/susv3xbd/stdint.h.html>
  */
 
+#ifndef _GL_STDINT_H
+
 /* Get those types that are already defined in other system include
    files, so that we can "#define int8_t signed char" below without
    worrying about a later system include file containing a "typedef
@@ -42,16 +41,21 @@
   /* Other systems may have an incomplete or buggy <stdint.h>.
      Include it before <inttypes.h>, since any "#include <stdint.h>"
      in <inttypes.h> would reinclude us, skipping our contents because
-     _GL_STDINT_H is defined.  */
-# include @ABSOLUTE_STDINT_H@
+     _GL_STDINT_H is defined.
+     The include_next requires a split double-inclusion guard.  */
+# @INCLUDE_NEXT@ @NEXT_STDINT_H@
 #endif
 
+#if ! defined _GL_STDINT_H && ! defined _GL_JUST_INCLUDE_SYSTEM_STDINT_H
+#define _GL_STDINT_H
+
 /* <sys/types.h> defines some of the stdint.h types as well, on glibc,
    IRIX 6.5, and OpenBSD 3.8 (via <machine/types.h>).
+   AIX 5.2 <sys/types.h> isn't needed and causes troubles.
    MacOS X 10.4.6 <sys/types.h> includes <stdint.h> (which is us), but
    relies on the system <stdint.h> definitions, so include
-   <sys/types.h> after @address@hidden  */
-#if @HAVE_SYS_TYPES_H@
+   <sys/types.h> after @address@hidden  */
+#if @HAVE_SYS_TYPES_H@ && ! defined _AIX
 # include <sys/types.h>
 #endif
 
@@ -62,9 +66,9 @@
   /* In OpenBSD 3.8, <inttypes.h> includes <machine/types.h>, which defines
      int{8,16,32,64}_t, uint{8,16,32,64}_t and __BIT_TYPES_DEFINED__.
      <inttypes.h> also defines intptr_t and uintptr_t.  */
-# define _GL_JUST_INCLUDE_ABSOLUTE_INTTYPES_H
+# define _GL_JUST_INCLUDE_SYSTEM_INTTYPES_H
 # include <inttypes.h>
-# undef _GL_JUST_INCLUDE_ABSOLUTE_INTTYPES_H
+# undef _GL_JUST_INCLUDE_SYSTEM_INTTYPES_H
 #elif @HAVE_SYS_INTTYPES_H@
   /* Solaris 7 <sys/inttypes.h> has the types except the *_fast*_t types, and
      the macros except for *_FAST*_*, INTPTR_MIN, PTRDIFF_MIN, PTRDIFF_MAX.  */
@@ -81,11 +85,7 @@
 #if ! defined __cplusplus || defined __STDC_CONSTANT_MACROS
 
 /* Get WCHAR_MIN, WCHAR_MAX.  */
-# if @HAVE_WCHAR_H@ && ! (defined WCHAR_MIN && defined WCHAR_MAX)
-   /* BSD/OS 4.1 has a bug: <stdio.h> and <time.h> must be included before
-      <wchar.h>.  */
-#  include <stdio.h>
-#  include <time.h>
+# if ! (defined WCHAR_MIN && defined WCHAR_MAX)
 #  include <wchar.h>
 # endif
 
@@ -123,17 +123,34 @@
 #define int32_t int
 #define uint32_t unsigned int
 
-#undef int64_t
-#undef uint64_t
-#if defined _MSC_VER
-# define int64_t __int64
-# define uint64_t unsigned __int64
-#elif LONG_MAX >> 31 >> 31 == 1
+/* Do not undefine int64_t if gnulib is not being used with 64-bit
+   types, since otherwise it breaks platforms like Tandem/NSK.  */
+#if LONG_MAX >> 31 >> 31 == 1
+# undef int64_t
 # define int64_t long int
-# define uint64_t unsigned long int
+# define GL_INT64_T
+#elif defined _MSC_VER
+# undef int64_t
+# define int64_t __int64
+# define GL_INT64_T
 #elif @HAVE_LONG_LONG_INT@
+# undef int64_t
 # define int64_t long long int
+# define GL_INT64_T
+#endif
+
+#if ULONG_MAX >> 31 >> 31 >> 1 == 1
+# undef uint64_t
+# define uint64_t unsigned long int
+# define GL_UINT64_T
+#elif defined _MSC_VER
+# undef uint64_t
+# define uint64_t unsigned __int64
+# define GL_UINT64_T
+#elif @HAVE_UNSIGNED_LONG_LONG_INT@
+# undef uint64_t
 # define uint64_t unsigned long long int
+# define GL_UINT64_T
 #endif
 
 /* Avoid collision with Solaris 2.5.1 <pthread.h> etc.  */
@@ -162,8 +179,10 @@
 #define uint_least16_t uint16_t
 #define int_least32_t int32_t
 #define uint_least32_t uint32_t
-#ifdef int64_t
+#ifdef GL_INT64_T
 # define int_least64_t int64_t
+#endif
+#ifdef GL_UINT64_T
 # define uint_least64_t uint64_t
 #endif
 
@@ -191,8 +210,10 @@
 #define uint_fast16_t unsigned int_fast16_t
 #define int_fast32_t long int
 #define uint_fast32_t unsigned int_fast32_t
-#ifdef int64_t
+#ifdef GL_INT64_T
 # define int_fast64_t int64_t
+#endif
+#ifdef GL_UINT64_T
 # define uint_fast64_t uint64_t
 #endif
 
@@ -209,15 +230,20 @@
    public header files. */
 
 #undef intmax_t
-#undef uintmax_t
 #if @HAVE_LONG_LONG_INT@ && LONG_MAX >> 30 == 1
 # define intmax_t long long int
-# define uintmax_t unsigned long long int
-#elif defined int64_t
+#elif defined GL_INT64_T
 # define intmax_t int64_t
-# define uintmax_t uint64_t
 #else
 # define intmax_t long int
+#endif
+
+#undef uintmax_t
+#if @HAVE_UNSIGNED_LONG_LONG_INT@ && ULONG_MAX >> 31 == 1
+# define uintmax_t unsigned long long int
+#elif defined GL_UINT64_T
+# define uintmax_t uint64_t
+#else
 # define uintmax_t unsigned long int
 #endif
 
@@ -253,10 +279,15 @@
 
 #undef INT64_MIN
 #undef INT64_MAX
-#undef UINT64_MAX
-#ifdef int64_t
-# define INT64_MIN  (~ INT64_MAX)
+#ifdef GL_INT64_T
+/* Prefer (- INTMAX_C (1) << 63) over (~ INT64_MAX) because SunPRO C 5.0
+   evaluates the latter incorrectly in preprocessor expressions.  */
+# define INT64_MIN  (- INTMAX_C (1) << 63)
 # define INT64_MAX  INTMAX_C (9223372036854775807)
+#endif
+
+#undef UINT64_MAX
+#ifdef GL_UINT64_T
 # define UINT64_MAX  UINTMAX_C (18446744073709551615)
 #endif
 
@@ -289,10 +320,13 @@
 
 #undef INT_LEAST64_MIN
 #undef INT_LEAST64_MAX
-#undef UINT_LEAST64_MAX
-#ifdef int64_t
+#ifdef GL_INT64_T
 # define INT_LEAST64_MIN  INT64_MIN
 # define INT_LEAST64_MAX  INT64_MAX
+#endif
+
+#undef UINT_LEAST64_MAX
+#ifdef GL_UINT64_T
 # define UINT_LEAST64_MAX  UINT64_MAX
 #endif
 
@@ -325,10 +359,13 @@
 
 #undef INT_FAST64_MIN
 #undef INT_FAST64_MAX
-#undef UINT_FAST64_MAX
-#ifdef int64_t
+#ifdef GL_INT64_T
 # define INT_FAST64_MIN  INT64_MIN
 # define INT_FAST64_MAX  INT64_MAX
+#endif
+
+#undef UINT_FAST64_MAX
+#ifdef GL_UINT64_T
 # define UINT_FAST64_MAX  UINT64_MAX
 #endif
 
@@ -345,13 +382,18 @@
 
 #undef INTMAX_MIN
 #undef INTMAX_MAX
-#undef UINTMAX_MAX
-#define INTMAX_MIN  (~ INTMAX_MAX)
 #ifdef INT64_MAX
+# define INTMAX_MIN  INT64_MIN
 # define INTMAX_MAX  INT64_MAX
-# define UINTMAX_MAX  UINT64_MAX
 #else
+# define INTMAX_MIN  INT32_MIN
 # define INTMAX_MAX  INT32_MAX
+#endif
+
+#undef UINTMAX_MAX
+#ifdef UINT64_MAX
+# define UINTMAX_MAX  UINT64_MAX
+#else
 # define UINTMAX_MAX  UINT32_MAX
 #endif
 
@@ -425,32 +467,42 @@
 
 #undef INT64_C
 #undef UINT64_C
-#if defined _MSC_VER
-# define INT64_C(x) x##i64
-# define UINT64_C(x) x##ui64
-#elif LONG_MAX >> 31 >> 31 == 1
+#if LONG_MAX >> 31 >> 31 == 1
 # define INT64_C(x) x##L
-# define UINT64_C(x) x##UL
+#elif defined _MSC_VER
+# define INT64_C(x) x##i64
 #elif @HAVE_LONG_LONG_INT@
 # define INT64_C(x) x##LL
+#endif
+#if ULONG_MAX >> 31 >> 31 >> 1 == 1
+# define UINT64_C(x) x##UL
+#elif defined _MSC_VER
+# define UINT64_C(x) x##ui64
+#elif @HAVE_UNSIGNED_LONG_LONG_INT@
 # define UINT64_C(x) x##ULL
 #endif
 
 /* 7.18.4.2. Macros for greatest-width integer constants */
 
 #undef INTMAX_C
-#undef UINTMAX_C
 #if @HAVE_LONG_LONG_INT@ && LONG_MAX >> 30 == 1
 # define INTMAX_C(x)   x##LL
-# define UINTMAX_C(x)  x##ULL
-#elif defined int64_t
+#elif defined GL_INT64_T
 # define INTMAX_C(x)   INT64_C(x)
-# define UINTMAX_C(x)  UINT64_C(x)
 #else
 # define INTMAX_C(x)   x##L
+#endif
+
+#undef UINTMAX_C
+#if @HAVE_UNSIGNED_LONG_LONG_INT@ && ULONG_MAX >> 31 == 1
+# define UINTMAX_C(x)  x##ULL
+#elif defined GL_UINT64_T
+# define UINTMAX_C(x)  UINT64_C(x)
+#else
 # define UINTMAX_C(x)  x##UL
 #endif
 
 #endif /* !defined __cplusplus || defined __STDC_CONSTANT_MACROS */
 
 #endif /* _GL_STDINT_H */
+#endif /* !defined _GL_STDINT_H && !defined _GL_JUST_INCLUDE_SYSTEM_STDINT_H */

Index: strcasecmp.c
===================================================================
RCS file: /cvsroot/cvs/ccvs/lib/strcasecmp.c,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -b -r1.5 -r1.6
--- strcasecmp.c        22 Sep 2006 17:54:40 -0000      1.5
+++ strcasecmp.c        22 Aug 2007 12:48:45 -0000      1.6
@@ -1,7 +1,5 @@
 /* Case-insensitive string comparison function.
-   Copyright (C) 1998-1999, 2005-2006 Free Software Foundation, Inc.
-   Written by Bruno Haible <address@hidden>, 2005,
-   based on earlier glibc code.
+   Copyright (C) 1998-1999, 2005-2007 Free Software Foundation, Inc.
 
    This program is free software; you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
@@ -20,65 +18,28 @@
 #include <config.h>
 
 /* Specification.  */
-#include "strcase.h"
+#include <string.h>
 
 #include <ctype.h>
 #include <limits.h>
 
-#if HAVE_MBRTOWC
-# include "mbuiter.h"
-#endif
-
 #define TOLOWER(Ch) (isupper (Ch) ? tolower (Ch) : (Ch))
 
 /* Compare strings S1 and S2, ignoring case, returning less than, equal to or
    greater than zero if S1 is lexicographically less than, equal to or greater
    than S2.
-   Note: This function may, in multibyte locales, return 0 for strings of
-   different lengths!  */
+   Note: This function does not work with multibyte strings!  */
+
 int
 strcasecmp (const char *s1, const char *s2)
 {
-  if (s1 == s2)
-    return 0;
-
-  /* Be careful not to look at the entire extent of s1 or s2 until needed.
-     This is useful because when two strings differ, the difference is
-     most often already in the very few first characters.  */
-#if HAVE_MBRTOWC
-  if (MB_CUR_MAX > 1)
-    {
-      mbui_iterator_t iter1;
-      mbui_iterator_t iter2;
-
-      mbui_init (iter1, s1);
-      mbui_init (iter2, s2);
-
-      while (mbui_avail (iter1) && mbui_avail (iter2))
-       {
-         int cmp = mb_casecmp (mbui_cur (iter1), mbui_cur (iter2));
-
-         if (cmp != 0)
-           return cmp;
-
-         mbui_advance (iter1);
-         mbui_advance (iter2);
-       }
-      if (mbui_avail (iter1))
-       /* s2 terminated before s1.  */
-       return 1;
-      if (mbui_avail (iter2))
-       /* s1 terminated before s2.  */
-       return -1;
-      return 0;
-    }
-  else
-#endif
-    {
       const unsigned char *p1 = (const unsigned char *) s1;
       const unsigned char *p2 = (const unsigned char *) s2;
       unsigned char c1, c2;
 
+  if (p1 == p2)
+    return 0;
+
       do
        {
          c1 = TOLOWER (*p1);
@@ -99,5 +60,4 @@
           difference of two 'unsigned char' values - including the sign bit -
           doesn't fit in an 'int'.  */
        return (c1 > c2 ? 1 : c1 < c2 ? -1 : 0);
-    }
 }

Index: strdup.c
===================================================================
RCS file: /cvsroot/cvs/ccvs/lib/strdup.c,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -b -r1.6 -r1.7
--- strdup.c    22 Sep 2006 17:54:40 -0000      1.6
+++ strdup.c    22 Aug 2007 12:48:45 -0000      1.7
@@ -1,4 +1,4 @@
-/* Copyright (C) 1991, 1996, 1997, 1998, 2002, 2003, 2004, 2006 Free
+/* Copyright (C) 1991, 1996, 1997, 1998, 2002, 2003, 2004, 2006, 2007 Free
    Software Foundation, Inc.
 
    This file is part of the GNU C Library.
@@ -19,15 +19,17 @@
 
 #ifndef _LIBC
 # include <config.h>
-/* Get specification.  */
-# include "strdup.h"
 #endif
 
-#include <stdlib.h>
+/* Get specification.  */
 #include <string.h>
 
+#include <stdlib.h>
+
 #undef __strdup
-#undef strdup
+#ifdef _LIBC
+# undef strdup
+#endif
 
 #ifndef weak_alias
 # define __strdup strdup

Index: strerror.c
===================================================================
RCS file: /cvsroot/cvs/ccvs/lib/strerror.c,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -b -r1.8 -r1.9
--- strerror.c  22 Sep 2006 17:54:40 -0000      1.8
+++ strerror.c  22 Aug 2007 12:48:45 -0000      1.9
@@ -1,6 +1,6 @@
 /* strerror.c --- ANSI C compatible system error routine
 
-   Copyright (C) 1986, 1988, 1989, 1991, 2002, 2003, 2006 Free
+   Copyright (C) 1986, 1988, 1989, 1991, 2002, 2003, 2006, 2007 Free
    Software Foundation, Inc.
 
    This program is free software; you can redistribute it and/or modify
@@ -19,6 +19,8 @@
 
 #include <config.h>
 
+#if !HAVE_STRERROR
+
 #include <limits.h>
 
 /* Don't include <stdio.h>, since it may or may not declare
@@ -45,3 +47,11 @@
   else
     return sys_errlist[n];
 }
+
+#else
+
+/* This declaration is solely to ensure that after preprocessing
+   this file is never empty.  */
+typedef int dummy;
+
+#endif

Index: strftime.c
===================================================================
RCS file: /cvsroot/cvs/ccvs/lib/strftime.c,v
retrieving revision 1.14
retrieving revision 1.15
diff -u -b -r1.14 -r1.15
--- strftime.c  22 Sep 2006 17:54:40 -0000      1.14
+++ strftime.c  22 Aug 2007 12:48:45 -0000      1.15
@@ -1,4 +1,4 @@
-/* Copyright (C) 1991-1999, 2000, 2001, 2003, 2004, 2005, 2006 Free Software
+/* Copyright (C) 1991-1999, 2000, 2001, 2003, 2004, 2005, 2006, 2007 Free 
Software
    Foundation, Inc.
 
    NOTE: The canonical source of this file is maintained with the GNU C 
Library.
@@ -30,21 +30,14 @@
 # include "../locale/localeinfo.h"
 #else
 # include <config.h>
+# if FPRINTFTIME
+#  include "fprintftime.h"
+# endif
 #endif
 
 #include <ctype.h>
-#include <sys/types.h>         /* Some systems define `time_t' here.  */
+#include <time.h>
 
-#ifdef TIME_WITH_SYS_TIME
-# include <sys/time.h>
-# include <time.h>
-#else
-# ifdef HAVE_SYS_TIME_H
-#  include <sys/time.h>
-# else
-#  include <time.h>
-# endif
-#endif
 #if HAVE_TZNAME && ! defined tzname
 extern char *tzname[];
 #endif
@@ -55,7 +48,7 @@
    conversion specifications.  The GNU C Library uses UTF8 multibyte
    encoding, which is safe for formats, but strftime.c can be used
    with other C libraries that use unsafe encodings.  */
-#define DO_MULTIBYTE (HAVE_MBLEN && HAVE_WCHAR_H && ! MULTIBYTE_IS_FORMAT_SAFE)
+#define DO_MULTIBYTE (HAVE_MBLEN && ! MULTIBYTE_IS_FORMAT_SAFE)
 
 #if DO_MULTIBYTE
 # if HAVE_MBRLEN
@@ -141,11 +134,10 @@
 #endif
 
 #if !HAVE_TM_GMTOFF
-/* Portable standalone applications should supply a "time_r.h" that
+/* Portable standalone applications should supply a "time.h" that
    declares a POSIX-compliant localtime_r, for the benefit of older
    implementations that lack localtime_r or have a nonstandard one.
    See the gnulib time_r module for one way to implement this.  */
-# include "time_r.h"
 # undef __gmtime_r
 # undef __localtime_r
 # define __gmtime_r gmtime_r
@@ -178,6 +170,12 @@
 # define memset_zero(P, Len) (memset (P, '0', Len), (P) += (Len))
 #endif
 
+#if FPRINTFTIME
+# define advance(P, N)
+#else
+# define advance(P, N) ((P) += (N))
+#endif
+
 #define add(n, f)                                                            \
   do                                                                         \
     {                                                                        \
@@ -196,7 +194,7 @@
                memset_space (p, _delta);                                     \
            }                                                                 \
          f;                                                                  \
-         p += FPRINTFTIME ? 0 : _n;                                          \
+         advance (p, _n);                                                    \
        }                                                                     \
       i += _incr;                                                            \
     } while (0)

Index: strncasecmp.c
===================================================================
RCS file: /cvsroot/cvs/ccvs/lib/strncasecmp.c,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -b -r1.5 -r1.6
--- strncasecmp.c       22 Sep 2006 17:54:40 -0000      1.5
+++ strncasecmp.c       22 Aug 2007 12:48:46 -0000      1.6
@@ -1,5 +1,5 @@
 /* strncasecmp.c -- case insensitive string comparator
-   Copyright (C) 1998-1999, 2005-2006 Free Software Foundation, Inc.
+   Copyright (C) 1998-1999, 2005-2007 Free Software Foundation, Inc.
 
    This program is free software; you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
@@ -18,17 +18,17 @@
 #include <config.h>
 
 /* Specification.  */
-#include "strcase.h"
+#include <string.h>
 
 #include <ctype.h>
 #include <limits.h>
 
 #define TOLOWER(Ch) (isupper (Ch) ? tolower (Ch) : (Ch))
 
-/* Compare no more than N bytes of strings S1 and S2,
-   ignoring case, returning less than, equal to or
-   greater than zero if S1 is lexicographically less
-   than, equal to or greater than S2.  */
+/* Compare no more than N bytes of strings S1 and S2, ignoring case,
+   returning less than, equal to or greater than zero if S1 is
+   lexicographically less than, equal to or greater than S2.
+   Note: This function cannot work correctly in multibyte locales.  */
 
 int
 strncasecmp (const char *s1, const char *s2, size_t n)

Index: strndup.c
===================================================================
RCS file: /cvsroot/cvs/ccvs/lib/strndup.c,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -b -r1.2 -r1.3
--- strndup.c   22 Sep 2006 17:54:40 -0000      1.2
+++ strndup.c   22 Aug 2007 12:48:46 -0000      1.3
@@ -1,8 +1,7 @@
-/* Copyright (C) 1996, 1997, 1998, 2001, 2002, 2003, 2005, 2006 Free
-   Software Foundation, Inc.
+/* A replacement function, for systems that lack strndup.
 
-   NOTE: The canonical source of this file is maintained with the GNU C 
Library.
-   Bugs can be reported to address@hidden
+   Copyright (C) 1996, 1997, 1998, 2001, 2002, 2003, 2005, 2006, 2007
+   Free Software Foundation, Inc.
 
    This program is free software; you can redistribute it and/or modify it
    under the terms of the GNU General Public License as published by the
@@ -18,36 +17,16 @@
    along with this program; if not, write to the Free Software Foundation,
    Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.  */
 
-#if !_LIBC
-# include <config.h>
-# include "strndup.h"
-#endif
+#include <config.h>
 
-#include <stdlib.h>
 #include <string.h>
 
-#if !_LIBC
-# include "strnlen.h"
-# ifndef __strnlen
-#  define __strnlen strnlen
-# endif
-#endif
-
-#undef __strndup
-#if _LIBC
-# undef strndup
-#endif
-
-#ifndef weak_alias
-# define __strndup strndup
-#endif
+#include <stdlib.h>
 
 char *
-__strndup (s, n)
-     const char *s;
-     size_t n;
+strndup (char const *s, size_t n)
 {
-  size_t len = __strnlen (s, n);
+  size_t len = strnlen (s, n);
   char *new = malloc (len + 1);
 
   if (new == NULL)
@@ -56,9 +35,3 @@
   new[len] = '\0';
   return memcpy (new, s, len);
 }
-#ifdef libc_hidden_def
-libc_hidden_def (__strndup)
-#endif
-#ifdef weak_alias
-weak_alias (__strndup, strndup)
-#endif

Index: strnlen.c
===================================================================
RCS file: /cvsroot/cvs/ccvs/lib/strnlen.c,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -b -r1.2 -r1.3
--- strnlen.c   22 Sep 2006 17:54:40 -0000      1.2
+++ strnlen.c   22 Aug 2007 12:48:46 -0000      1.3
@@ -1,5 +1,5 @@
 /* Find the length of STRING, but scan at most MAXLEN characters.
-   Copyright (C) 2005, 2006 Free Software Foundation, Inc.
+   Copyright (C) 2005, 2006, 2007 Free Software Foundation, Inc.
    Written by Simon Josefsson.
 
    This program is free software; you can redistribute it and/or modify
@@ -18,7 +18,7 @@
 
 #include <config.h>
 
-#include "strnlen.h"
+#include <string.h>
 
 /* Find the length of STRING, but scan at most MAXLEN characters.
    If no '\0' terminator is found in that many characters, return MAXLEN.  */

Index: strnlen1.c
===================================================================
RCS file: /cvsroot/cvs/ccvs/lib/strnlen1.c,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -b -r1.4 -r1.5
--- strnlen1.c  22 Sep 2006 17:54:40 -0000      1.4
+++ strnlen1.c  22 Aug 2007 12:48:46 -0000      1.5
@@ -28,7 +28,7 @@
 size_t
 strnlen1 (const char *string, size_t maxlen)
 {
-  const char *end = memchr (string, '\0', maxlen);
+  const char *end = (const char *) memchr (string, '\0', maxlen);
   if (end != NULL)
     return end - string + 1;
   else

Index: strtoimax.c
===================================================================
RCS file: /cvsroot/cvs/ccvs/lib/strtoimax.c,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -b -r1.6 -r1.7
--- strtoimax.c 22 Sep 2006 17:54:40 -0000      1.6
+++ strtoimax.c 22 Aug 2007 12:48:46 -0000      1.7
@@ -33,7 +33,7 @@
 "this configure-time declaration test was not run"
 # endif
 # if !HAVE_DECL_STRTOULL && HAVE_UNSIGNED_LONG_LONG_INT
-unsigned long long strtoull (char const *, char **, int);
+unsigned long long int strtoull (char const *, char **, int);
 # endif
 
 #else
@@ -41,33 +41,35 @@
 # ifndef HAVE_DECL_STRTOLL
 "this configure-time declaration test was not run"
 # endif
-# if !HAVE_DECL_STRTOLL && HAVE_UNSIGNED_LONG_LONG_INT
-long long strtoll (char const *, char **, int);
+# if !HAVE_DECL_STRTOLL && HAVE_LONG_LONG_INT
+long long int strtoll (char const *, char **, int);
 # endif
 #endif
 
 #ifdef UNSIGNED
-# undef HAVE_LONG_LONG_INT
-# define HAVE_LONG_LONG_INT HAVE_UNSIGNED_LONG_LONG_INT
-# define INT uintmax_t
+# define Have_long_long HAVE_UNSIGNED_LONG_LONG_INT
+# define Int uintmax_t
+# define Unsigned unsigned
 # define strtoimax strtoumax
 # define strtol strtoul
 # define strtoll strtoull
 #else
-# define INT intmax_t
+# define Have_long_long HAVE_LONG_LONG_INT
+# define Int intmax_t
+# define Unsigned
 #endif
 
-INT
+Int
 strtoimax (char const *ptr, char **endptr, int base)
 {
-#if HAVE_LONG_LONG_INT
-  verify (sizeof (INT) == sizeof (long int)
-         || sizeof (INT) == sizeof (long long int));
+#if Have_long_long
+  verify (sizeof (Int) == sizeof (Unsigned long int)
+         || sizeof (Int) == sizeof (Unsigned long long int));
 
-  if (sizeof (INT) != sizeof (long int))
+  if (sizeof (Int) != sizeof (Unsigned long int))
     return strtoll (ptr, endptr, base);
 #else
-  verify (sizeof (INT) == sizeof (long int));
+  verify (sizeof (Int) == sizeof (Unsigned long int));
 #endif
 
   return strtol (ptr, endptr, base);

Index: strtol.c
===================================================================
RCS file: /cvsroot/cvs/ccvs/lib/strtol.c,v
retrieving revision 1.9
retrieving revision 1.10
diff -u -b -r1.9 -r1.10
--- strtol.c    22 Sep 2006 17:54:40 -0000      1.9
+++ strtol.c    22 Aug 2007 12:48:46 -0000      1.10
@@ -1,6 +1,7 @@
 /* Convert string representation of a number into an integer value.
 
-   Copyright (C) 1991, 1992, 1994, 1995, 1996, 1997, 1998, 1999, 2003, 2005, 
2006
+   Copyright (C) 1991, 1992, 1994, 1995, 1996, 1997, 1998, 1999, 2003, 2005,
+   2006, 2007
    Free Software Foundation, Inc.
 
    NOTE: The canonical source of this file is maintained with the GNU C
@@ -187,9 +188,7 @@
 # define LOCALE_PARAM_PROTO
 #endif
 
-#if defined _LIBC || defined HAVE_WCHAR_H
-# include <wchar.h>
-#endif
+#include <wchar.h>
 
 #ifdef USE_WIDE_CHAR
 # include <wctype.h>

Index: tempname.c
===================================================================
RCS file: /cvsroot/cvs/ccvs/lib/tempname.c,v
retrieving revision 1.11
retrieving revision 1.12
diff -u -b -r1.11 -r1.12
--- tempname.c  22 Sep 2006 17:54:40 -0000      1.11
+++ tempname.c  22 Aug 2007 12:48:46 -0000      1.12
@@ -1,7 +1,8 @@
 /* tempname.c - generate the name of a temporary file.
 
    Copyright (C) 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999,
-   2000, 2001, 2002, 2003, 2005, 2006 Free Software Foundation, Inc.
+   2000, 2001, 2002, 2003, 2005, 2006, 2007 Free Software Foundation,
+   Inc.
 
    This program is free software; you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
@@ -17,8 +18,11 @@
    with this program; if not, write to the Free Software Foundation,
    Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.  */
 
+/* Extracted from glibc sysdeps/posix/tempname.c.  See also tmpdir.c.  */
+
 #if !_LIBC
 # include <config.h>
+# include "tempname.h"
 #endif
 
 #include <sys/types.h>
@@ -48,11 +52,7 @@
 #include <string.h>
 
 #include <fcntl.h>
-
-#if HAVE_SYS_TIME_H || _LIBC
-# include <sys/time.h>
-#endif
-
+#include <sys/time.h>
 #include <stdint.h>
 #include <unistd.h>
 
@@ -63,10 +63,10 @@
 # define small_open __open
 # define large_open __open64
 #else
-# include "stat-macros.h"
 # define struct_stat64 struct stat
 # define small_open open
 # define large_open open
+# define __gen_tempname gen_tempname
 # define __getpid getpid
 # define __gettimeofday gettimeofday
 # define __mkdir mkdir
@@ -106,6 +106,7 @@
 # define uint64_t uintmax_t
 #endif
 
+#if _LIBC
 /* Return nonzero if DIR is an existent directory.  */
 static int
 direxists (const char *dir)
@@ -176,6 +177,7 @@
   sprintf (tmpl, "%.*s/%.*sXXXXXX", (int) dlen, dir, (int) plen, pfx);
   return 0;
 }
+#endif /* _LIBC */
 
 /* These are the characters used in temporary file names.  */
 static const char letters[] =
@@ -237,15 +239,11 @@
 #ifdef RANDOM_BITS
   RANDOM_BITS (random_time_bits);
 #else
-# if HAVE_GETTIMEOFDAY || _LIBC
   {
     struct timeval tv;
     __gettimeofday (&tv, NULL);
     random_time_bits = ((uint64_t) tv.tv_usec << 16) ^ tv.tv_sec;
   }
-# else
-  random_time_bits = time (NULL);
-# endif
 #endif
   value += random_time_bits ^ __getpid ();
 

Index: time_r.c
===================================================================
RCS file: /cvsroot/cvs/ccvs/lib/time_r.c,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -b -r1.6 -r1.7
--- time_r.c    22 Sep 2006 17:54:40 -0000      1.6
+++ time_r.c    22 Aug 2007 12:48:47 -0000      1.7
@@ -1,6 +1,6 @@
 /* Reentrant time functions like localtime_r.
 
-   Copyright (C) 2003, 2006 Free Software Foundation, Inc.
+   Copyright (C) 2003, 2006, 2007 Free Software Foundation, Inc.
 
    This program is free software; you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
@@ -20,7 +20,7 @@
 
 #include <config.h>
 
-#include "time_r.h"
+#include <time.h>
 
 #include <string.h>
 

Index: timespec.h
===================================================================
RCS file: /cvsroot/cvs/ccvs/lib/timespec.h,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -b -r1.5 -r1.6
--- timespec.h  19 Sep 2005 21:26:14 -0000      1.5
+++ timespec.h  22 Aug 2007 12:48:47 -0000      1.6
@@ -1,6 +1,6 @@
 /* timespec -- System time interface
 
-   Copyright (C) 2000, 2002, 2004, 2005 Free Software Foundation, Inc.
+   Copyright (C) 2000, 2002, 2004, 2005, 2007 Free Software Foundation, Inc.
 
    This program is free software; you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
@@ -19,26 +19,7 @@
 #if ! defined TIMESPEC_H
 # define TIMESPEC_H
 
-# include <sys/types.h>
-# if TIME_WITH_SYS_TIME
-#  include <sys/time.h>
 #  include <time.h>
-# else
-#  if HAVE_SYS_TIME_H
-#   include <sys/time.h>
-#  else
-#   include <time.h>
-#  endif
-# endif
-
-# if ! HAVE_STRUCT_TIMESPEC
-/* Some systems don't define this struct, e.g., AIX 4.1, Ultrix 4.3.  */
-struct timespec
-{
-  time_t tv_sec;
-  long tv_nsec;
-};
-# endif
 
 /* Return negative, zero, positive if A < B, A == B, A > B, respectively.
    Assume the nanosecond components are in range, or close to it.  */
@@ -50,12 +31,6 @@
          : a.tv_nsec - b.tv_nsec);
 }
 
-# if ! HAVE_DECL_NANOSLEEP
-/* Don't specify a prototype here.  Some systems (e.g., OSF) declare
-   nanosleep with a conflicting one (const-less first parameter).  */
-int nanosleep ();
-# endif
-
 void gettime (struct timespec *);
 int settime (struct timespec const *);
 

Index: vasnprintf.c
===================================================================
RCS file: /cvsroot/cvs/ccvs/lib/vasnprintf.c,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -b -r1.7 -r1.8
--- vasnprintf.c        22 Sep 2006 17:54:40 -0000      1.7
+++ vasnprintf.c        22 Aug 2007 12:48:47 -0000      1.8
@@ -1,5 +1,5 @@
 /* vsprintf with automatic memory allocation.
-   Copyright (C) 1999, 2002-2006 Free Software Foundation, Inc.
+   Copyright (C) 1999, 2002-2007 Free Software Foundation, Inc.
 
    This program is free software; you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
@@ -15,6 +15,35 @@
    with this program; if not, write to the Free Software Foundation,
    Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.  */
 
+/* This file can be parametrized with the following macros:
+     VASNPRINTF         The name of the function being defined.
+     FCHAR_T            The element type of the format string.
+     DCHAR_T            The element type of the destination (result) string.
+     FCHAR_T_ONLY_ASCII Set to 1 to enable verification that all characters
+                        in the format string are ASCII. MUST be set if
+                        FCHAR_T and DCHAR_T are not the same type.
+     DIRECTIVE          Structure denoting a format directive.
+                        Depends on FCHAR_T.
+     DIRECTIVES         Structure denoting the set of format directives of a
+                        format string.  Depends on FCHAR_T.
+     PRINTF_PARSE       Function that parses a format string.
+                        Depends on FCHAR_T.
+     DCHAR_CPY          memcpy like function for DCHAR_T[] arrays.
+     DCHAR_SET          memset like function for DCHAR_T[] arrays.
+     DCHAR_MBSNLEN      mbsnlen like function for DCHAR_T[] arrays.
+     SNPRINTF           The system's snprintf (or similar) function.
+                        This may be either snprintf or swprintf.
+     TCHAR_T            The element type of the argument and result string
+                        of the said SNPRINTF function.  This may be either
+                        char or wchar_t.  The code exploits that
+                        sizeof (TCHAR_T) | sizeof (DCHAR_T) and
+                        alignof (TCHAR_T) <= alignof (DCHAR_T).
+     DCHAR_IS_TCHAR     Set to 1 if DCHAR_T and TCHAR_T are the same type.
+     DCHAR_CONV_FROM_ENCODING A function to convert from char[] to DCHAR[].
+     DCHAR_IS_UINT8_T   Set to 1 if DCHAR_T is uint8_t.
+     DCHAR_IS_UINT16_T  Set to 1 if DCHAR_T is uint16_t.
+     DCHAR_IS_UINT32_T  Set to 1 if DCHAR_T is uint32_t.  */
+
 /* Tell glibc's <stdio.h> to provide a prototype for snprintf().
    This must come before <config.h> because <config.h> may include
    <features.h>, and once <features.h> has been included, it's too late.  */
@@ -22,35 +51,76 @@
 # define _GNU_SOURCE    1
 #endif
 
-#include <config.h>
+#ifndef VASNPRINTF
+# include <config.h>
+#endif
 #ifndef IN_LIBINTL
 # include <alloca.h>
 #endif
 
 /* Specification.  */
-#if WIDE_CHAR_VERSION
+#ifndef VASNPRINTF
+# if WIDE_CHAR_VERSION
 # include "vasnwprintf.h"
-#else
+# else
 # include "vasnprintf.h"
+# endif
 #endif
 
+#include <locale.h>    /* localeconv() */
 #include <stdio.h>     /* snprintf(), sprintf() */
 #include <stdlib.h>    /* abort(), malloc(), realloc(), free() */
 #include <string.h>    /* memcpy(), strlen() */
 #include <errno.h>     /* errno */
 #include <limits.h>    /* CHAR_BIT */
 #include <float.h>     /* DBL_MAX_EXP, LDBL_MAX_EXP */
-#if WIDE_CHAR_VERSION
+#if HAVE_NL_LANGINFO
+# include <langinfo.h>
+#endif
+#ifndef VASNPRINTF
+# if WIDE_CHAR_VERSION
 # include "wprintf-parse.h"
-#else
+# else
 # include "printf-parse.h"
+# endif
 #endif
 
 /* Checked size_t computations.  */
 #include "xsize.h"
 
-#ifdef HAVE_WCHAR_T
-# ifdef HAVE_WCSLEN
+#if NEED_PRINTF_LONG_DOUBLE && !defined IN_LIBINTL
+# include <math.h>
+# include "float+.h"
+# include "fpucw.h"
+#endif
+
+#if NEED_PRINTF_INFINITE_DOUBLE && !defined IN_LIBINTL
+# include <math.h>
+# include "isnan.h"
+#endif
+
+#if NEED_PRINTF_INFINITE_LONG_DOUBLE && !defined IN_LIBINTL
+# include <math.h>
+# include "isnanl-nolibm.h"
+# include "fpucw.h"
+#endif
+
+#if NEED_PRINTF_DIRECTIVE_A && !defined IN_LIBINTL
+# include <math.h>
+# include "isnan.h"
+# include "printf-frexp.h"
+# include "isnanl-nolibm.h"
+# include "printf-frexpl.h"
+# include "fpucw.h"
+#endif
+
+/* Some systems, like OSF/1 4.0 and Woe32, don't have EOVERFLOW.  */
+#ifndef EOVERFLOW
+# define EOVERFLOW E2BIG
+#endif
+
+#if HAVE_WCHAR_T
+# if HAVE_WCSLEN
 #  define local_wcslen wcslen
 # else
    /* Solaris 2.5.1 has wcslen() in a separate library libw.so. To avoid
@@ -72,12 +142,32 @@
 # endif
 #endif
 
-#if WIDE_CHAR_VERSION
+/* Default parameters.  */
+#ifndef VASNPRINTF
+# if WIDE_CHAR_VERSION
 # define VASNPRINTF vasnwprintf
-# define CHAR_T wchar_t
+#  define FCHAR_T wchar_t
+#  define DCHAR_T wchar_t
+#  define TCHAR_T wchar_t
+#  define DCHAR_IS_TCHAR 1
 # define DIRECTIVE wchar_t_directive
 # define DIRECTIVES wchar_t_directives
 # define PRINTF_PARSE wprintf_parse
+#  define DCHAR_CPY wmemcpy
+# else
+#  define VASNPRINTF vasnprintf
+#  define FCHAR_T char
+#  define DCHAR_T char
+#  define TCHAR_T char
+#  define DCHAR_IS_TCHAR 1
+#  define DIRECTIVE char_directive
+#  define DIRECTIVES char_directives
+#  define PRINTF_PARSE printf_parse
+#  define DCHAR_CPY memcpy
+# endif
+#endif
+#if WIDE_CHAR_VERSION
+  /* TCHAR_T is wchar_t.  */
 # define USE_SNPRINTF 1
 # if HAVE_DECL__SNWPRINTF
    /* On Windows, the function swprintf() has a different signature than
@@ -88,23 +178,1019 @@
 #  define SNPRINTF swprintf
 # endif
 #else
-# define VASNPRINTF vasnprintf
-# define CHAR_T char
-# define DIRECTIVE char_directive
-# define DIRECTIVES char_directives
-# define PRINTF_PARSE printf_parse
-# define USE_SNPRINTF (HAVE_DECL__SNPRINTF || HAVE_SNPRINTF)
+  /* TCHAR_T is char.  */
+# /* Use snprintf if it exists under the name 'snprintf' or '_snprintf'.
+     But don't use it on BeOS, since BeOS snprintf produces no output if the
+     size argument is >= 0x3000000.  */
+# if (HAVE_DECL__SNPRINTF || HAVE_SNPRINTF) && !defined __BEOS__
+#  define USE_SNPRINTF 1
+# else
+#  define USE_SNPRINTF 0
+# endif
 # if HAVE_DECL__SNPRINTF
    /* Windows.  */
 #  define SNPRINTF _snprintf
 # else
    /* Unix.  */
 #  define SNPRINTF snprintf
+   /* Here we need to call the native snprintf, not rpl_snprintf.  */
+#  undef snprintf
+# endif
+#endif
+/* Here we need to call the native sprintf, not rpl_sprintf.  */
+#undef sprintf
+
+#if (NEED_PRINTF_DIRECTIVE_A || NEED_PRINTF_LONG_DOUBLE || 
NEED_PRINTF_INFINITE_DOUBLE) && !defined IN_LIBINTL
+/* Determine the decimal-point character according to the current locale.  */
+# ifndef decimal_point_char_defined
+#  define decimal_point_char_defined 1
+static char
+decimal_point_char ()
+{
+  const char *point;
+  /* Determine it in a multithread-safe way.  We know nl_langinfo is
+     multithread-safe on glibc systems, but is not required to be multithread-
+     safe by POSIX.  sprintf(), however, is multithread-safe.  localeconv()
+     is rarely multithread-safe.  */
+#  if HAVE_NL_LANGINFO && __GLIBC__
+  point = nl_langinfo (RADIXCHAR);
+#  elif 1
+  char pointbuf[5];
+  sprintf (pointbuf, "%#.0f", 1.0);
+  point = &pointbuf[1];
+#  else
+  point = localeconv () -> decimal_point;
+#  endif
+  /* The decimal point is always a single byte: either '.' or ','.  */
+  return (point[0] != '\0' ? point[0] : '.');
+}
+# endif
+#endif
+
+#if NEED_PRINTF_INFINITE_DOUBLE && !defined IN_LIBINTL
+
+/* Equivalent to !isfinite(x) || x == 0, but does not require libm.  */
+static int
+is_infinite_or_zero (double x)
+{
+  return isnan (x) || x + x == x;
+}
+
+#endif
+
+#if NEED_PRINTF_INFINITE_LONG_DOUBLE && !defined IN_LIBINTL
+
+/* Equivalent to !isfinite(x), but does not require libm.  */
+static int
+is_infinitel (long double x)
+{
+  return isnanl (x) || (x + x == x && x != 0.0L);
+}
+
+#endif
+
+#if NEED_PRINTF_LONG_DOUBLE && !defined IN_LIBINTL
+
+/* Converting 'long double' to decimal without rare rounding bugs requires
+   real bignums.  We use the naming conventions of GNU gmp, but vastly simpler
+   (and slower) algorithms.  */
+
+typedef unsigned int mp_limb_t;
+# define GMP_LIMB_BITS 32
+typedef int mp_limb_verify[2 * (sizeof (mp_limb_t) * CHAR_BIT == 
GMP_LIMB_BITS) - 1];
+
+typedef unsigned long long mp_twolimb_t;
+# define GMP_TWOLIMB_BITS 64
+typedef int mp_twolimb_verify[2 * (sizeof (mp_twolimb_t) * CHAR_BIT == 
GMP_TWOLIMB_BITS) - 1];
+
+/* Representation of a bignum >= 0.  */
+typedef struct
+{
+  size_t nlimbs;
+  mp_limb_t *limbs; /* Bits in little-endian order, allocated with malloc().  
*/
+} mpn_t;
+
+/* Compute the product of two bignums >= 0.
+   Return the allocated memory in case of success, NULL in case of memory
+   allocation failure.  */
+static void *
+multiply (mpn_t src1, mpn_t src2, mpn_t *dest)
+{
+  const mp_limb_t *p1;
+  const mp_limb_t *p2;
+  size_t len1;
+  size_t len2;
+
+  if (src1.nlimbs <= src2.nlimbs)
+    {
+      len1 = src1.nlimbs;
+      p1 = src1.limbs;
+      len2 = src2.nlimbs;
+      p2 = src2.limbs;
+    }
+  else
+    {
+      len1 = src2.nlimbs;
+      p1 = src2.limbs;
+      len2 = src1.nlimbs;
+      p2 = src1.limbs;
+    }
+  /* Now 0 <= len1 <= len2.  */
+  if (len1 == 0)
+    {
+      /* src1 or src2 is zero.  */
+      dest->nlimbs = 0;
+      dest->limbs = (mp_limb_t *) malloc (1);
+    }
+  else
+    {
+      /* Here 1 <= len1 <= len2.  */
+      size_t dlen;
+      mp_limb_t *dp;
+      size_t k, i, j;
+
+      dlen = len1 + len2;
+      dp = (mp_limb_t *) malloc (dlen * sizeof (mp_limb_t));
+      if (dp == NULL)
+       return NULL;
+      for (k = len2; k > 0; )
+       dp[--k] = 0;
+      for (i = 0; i < len1; i++)
+       {
+         mp_limb_t digit1 = p1[i];
+         mp_twolimb_t carry = 0;
+         for (j = 0; j < len2; j++)
+           {
+             mp_limb_t digit2 = p2[j];
+             carry += (mp_twolimb_t) digit1 * (mp_twolimb_t) digit2;
+             carry += dp[i + j];
+             dp[i + j] = (mp_limb_t) carry;
+             carry = carry >> GMP_LIMB_BITS;
+           }
+         dp[i + len2] = (mp_limb_t) carry;
+       }
+      /* Normalise.  */
+      while (dlen > 0 && dp[dlen - 1] == 0)
+       dlen--;
+      dest->nlimbs = dlen;
+      dest->limbs = dp;
+    }
+  return dest->limbs;
+}
+
+/* Compute the quotient of a bignum a >= 0 and a bignum b > 0.
+   a is written as  a = q * b + r  with 0 <= r < b.  q is the quotient, r
+   the remainder.
+   Finally, round-to-even is performed: If r > b/2 or if r = b/2 and q is odd,
+   q is incremented.
+   Return the allocated memory in case of success, NULL in case of memory
+   allocation failure.  */
+static void *
+divide (mpn_t a, mpn_t b, mpn_t *q)
+{
+  /* Algorithm:
+     First normalise a and b: a=[a[m-1],...,a[0]], b=[b[n-1],...,b[0]]
+     with m>=0 and n>0 (in base beta = 2^GMP_LIMB_BITS).
+     If m<n, then q:=0 and r:=a.
+     If m>=n=1, perform a single-precision division:
+       r:=0, j:=m,
+       while j>0 do
+         {Here (q[m-1]*beta^(m-1)+...+q[j]*beta^j) * b[0] + r*beta^j =
+               = a[m-1]*beta^(m-1)+...+a[j]*beta^j und 0<=r<b[0]<beta}
+         j:=j-1, r:=r*beta+a[j], q[j]:=floor(r/b[0]), r:=r-b[0]*q[j].
+       Normalise [q[m-1],...,q[0]], yields q.
+     If m>=n>1, perform a multiple-precision division:
+       We have a/b < beta^(m-n+1).
+       s:=intDsize-1-(hightest bit in b[n-1]), 0<=s<intDsize.
+       Shift a and b left by s bits, copying them. r:=a.
+       r=[r[m],...,r[0]], b=[b[n-1],...,b[0]] with b[n-1]>=beta/2.
+       For j=m-n,...,0: {Here 0 <= r < b*beta^(j+1).}
+         Compute q* :
+           q* := floor((r[j+n]*beta+r[j+n-1])/b[n-1]).
+           In case of overflow (q* >= beta) set q* := beta-1.
+           Compute c2 := ((r[j+n]*beta+r[j+n-1]) - q* * b[n-1])*beta + r[j+n-2]
+           and c3 := b[n-2] * q*.
+           {We have 0 <= c2 < 2*beta^2, even 0 <= c2 < beta^2 if no overflow
+            occurred.  Furthermore 0 <= c3 < beta^2.
+            If there was overflow and
+            r[j+n]*beta+r[j+n-1] - q* * b[n-1] >= beta, i.e. c2 >= beta^2,
+            the next test can be skipped.}
+           While c3 > c2, {Here 0 <= c2 < c3 < beta^2}
+             Put q* := q* - 1, c2 := c2 + b[n-1]*beta, c3 := c3 - b[n-2].
+           If q* > 0:
+             Put r := r - b * q* * beta^j. In detail:
+               [r[n+j],...,r[j]] := [r[n+j],...,r[j]] - q* * [b[n-1],...,b[0]].
+               hence: u:=0, for i:=0 to n-1 do
+                              u := u + q* * b[i],
+                              r[j+i]:=r[j+i]-(u mod beta) (+ beta, if carry),
+                              u:=u div beta (+ 1, if carry in subtraction)
+                      r[n+j]:=r[n+j]-u.
+               {Since always u = (q* * [b[i-1],...,b[0]] div beta^i) + 1
+                               < q* + 1 <= beta,
+                the carry u does not overflow.}
+             If a negative carry occurs, put q* := q* - 1
+               and [r[n+j],...,r[j]] := [r[n+j],...,r[j]] + 
[0,b[n-1],...,b[0]].
+         Set q[j] := q*.
+       Normalise [q[m-n],..,q[0]]; this yields the quotient q.
+       Shift [r[n-1],...,r[0]] right by s bits and normalise; this yields the
+       rest r.
+       The room for q[j] can be allocated at the memory location of r[n+j].
+     Finally, round-to-even:
+       Shift r left by 1 bit.
+       If r > b or if r = b and q[0] is odd, q := q+1.
+   */
+  const mp_limb_t *a_ptr = a.limbs;
+  size_t a_len = a.nlimbs;
+  const mp_limb_t *b_ptr = b.limbs;
+  size_t b_len = b.nlimbs;
+  mp_limb_t *roomptr;
+  mp_limb_t *tmp_roomptr = NULL;
+  mp_limb_t *q_ptr;
+  size_t q_len;
+  mp_limb_t *r_ptr;
+  size_t r_len;
+
+  /* Allocate room for a_len+2 digits.
+     (Need a_len+1 digits for the real division and 1 more digit for the
+     final rounding of q.)  */
+  roomptr = (mp_limb_t *) malloc ((a_len + 2) * sizeof (mp_limb_t));
+  if (roomptr == NULL)
+    return NULL;
+
+  /* Normalise a.  */
+  while (a_len > 0 && a_ptr[a_len - 1] == 0)
+    a_len--;
+
+  /* Normalise b.  */
+  for (;;)
+    {
+      if (b_len == 0)
+       /* Division by zero.  */
+       abort ();
+      if (b_ptr[b_len - 1] == 0)
+       b_len--;
+      else
+       break;
+    }
+
+  /* Here m = a_len >= 0 and n = b_len > 0.  */
+
+  if (a_len < b_len)
+    {
+      /* m<n: trivial case.  q=0, r := copy of a.  */
+      r_ptr = roomptr;
+      r_len = a_len;
+      memcpy (r_ptr, a_ptr, a_len * sizeof (mp_limb_t));
+      q_ptr = roomptr + a_len;
+      q_len = 0;
+    }
+  else if (b_len == 1)
+    {
+      /* n=1: single precision division.
+        beta^(m-1) <= a < beta^m  ==>  beta^(m-2) <= a/b < beta^m  */
+      r_ptr = roomptr;
+      q_ptr = roomptr + 1;
+      {
+       mp_limb_t den = b_ptr[0];
+       mp_limb_t remainder = 0;
+       const mp_limb_t *sourceptr = a_ptr + a_len;
+       mp_limb_t *destptr = q_ptr + a_len;
+       size_t count;
+       for (count = a_len; count > 0; count--)
+         {
+           mp_twolimb_t num =
+             ((mp_twolimb_t) remainder << GMP_LIMB_BITS) | *--sourceptr;
+           *--destptr = num / den;
+           remainder = num % den;
+         }
+       /* Normalise and store r.  */
+       if (remainder > 0)
+         {
+           r_ptr[0] = remainder;
+           r_len = 1;
+         }
+       else
+         r_len = 0;
+       /* Normalise q.  */
+       q_len = a_len;
+       if (q_ptr[q_len - 1] == 0)
+         q_len--;
+      }
+    }
+  else
+    {
+      /* n>1: multiple precision division.
+        beta^(m-1) <= a < beta^m, beta^(n-1) <= b < beta^n  ==>
+        beta^(m-n-1) <= a/b < beta^(m-n+1).  */
+      /* Determine s.  */
+      size_t s;
+      {
+       mp_limb_t msd = b_ptr[b_len - 1]; /* = b[n-1], > 0 */
+       s = 31;
+       if (msd >= 0x10000)
+         {
+           msd = msd >> 16;
+           s -= 16;
+         }
+       if (msd >= 0x100)
+         {
+           msd = msd >> 8;
+           s -= 8;
+         }
+       if (msd >= 0x10)
+         {
+           msd = msd >> 4;
+           s -= 4;
+         }
+       if (msd >= 0x4)
+         {
+           msd = msd >> 2;
+           s -= 2;
+         }
+       if (msd >= 0x2)
+         {
+           msd = msd >> 1;
+           s -= 1;
+         }
+      }
+      /* 0 <= s < GMP_LIMB_BITS.
+        Copy b, shifting it left by s bits.  */
+      if (s > 0)
+       {
+         tmp_roomptr = (mp_limb_t *) malloc (b_len * sizeof (mp_limb_t));
+         if (tmp_roomptr == NULL)
+           {
+             free (roomptr);
+             return NULL;
+           }
+         {
+           const mp_limb_t *sourceptr = b_ptr;
+           mp_limb_t *destptr = tmp_roomptr;
+           mp_twolimb_t accu = 0;
+           size_t count;
+           for (count = b_len; count > 0; count--)
+             {
+               accu += (mp_twolimb_t) *sourceptr++ << s;
+               *destptr++ = (mp_limb_t) accu;
+               accu = accu >> GMP_LIMB_BITS;
+             }
+           /* accu must be zero, since that was how s was determined.  */
+           if (accu != 0)
+             abort ();
+         }
+         b_ptr = tmp_roomptr;
+       }
+      /* Copy a, shifting it left by s bits, yields r.
+        Memory layout:
+        At the beginning: r = roomptr[0..a_len],
+        at the end: r = roomptr[0..b_len-1], q = roomptr[b_len..a_len]  */
+      r_ptr = roomptr;
+      if (s == 0)
+       {
+         memcpy (r_ptr, a_ptr, a_len * sizeof (mp_limb_t));
+         r_ptr[a_len] = 0;
+       }
+      else
+       {
+         const mp_limb_t *sourceptr = a_ptr;
+         mp_limb_t *destptr = r_ptr;
+         mp_twolimb_t accu = 0;
+         size_t count;
+         for (count = a_len; count > 0; count--)
+           {
+             accu += (mp_twolimb_t) *sourceptr++ << s;
+             *destptr++ = (mp_limb_t) accu;
+             accu = accu >> GMP_LIMB_BITS;
+           }
+         *destptr++ = (mp_limb_t) accu;
+       }
+      q_ptr = roomptr + b_len;
+      q_len = a_len - b_len + 1; /* q will have m-n+1 limbs */
+      {
+       size_t j = a_len - b_len; /* m-n */
+       mp_limb_t b_msd = b_ptr[b_len - 1]; /* b[n-1] */
+       mp_limb_t b_2msd = b_ptr[b_len - 2]; /* b[n-2] */
+       mp_twolimb_t b_msdd = /* b[n-1]*beta+b[n-2] */
+         ((mp_twolimb_t) b_msd << GMP_LIMB_BITS) | b_2msd;
+       /* Division loop, traversed m-n+1 times.
+          j counts down, b is unchanged, beta/2 <= b[n-1] < beta.  */
+       for (;;)
+         {
+           mp_limb_t q_star;
+           mp_limb_t c1;
+           if (r_ptr[j + b_len] < b_msd) /* r[j+n] < b[n-1] ? */
+             {
+               /* Divide r[j+n]*beta+r[j+n-1] by b[n-1], no overflow.  */
+               mp_twolimb_t num =
+                 ((mp_twolimb_t) r_ptr[j + b_len] << GMP_LIMB_BITS)
+                 | r_ptr[j + b_len - 1];
+               q_star = num / b_msd;
+               c1 = num % b_msd;
+             }
+           else
+             {
+               /* Overflow, hence r[j+n]*beta+r[j+n-1] >= beta*b[n-1].  */
+               q_star = (mp_limb_t)~(mp_limb_t)0; /* q* = beta-1 */
+               /* Test whether r[j+n]*beta+r[j+n-1] - (beta-1)*b[n-1] >= beta
+                  <==> r[j+n]*beta+r[j+n-1] + b[n-1] >= beta*b[n-1]+beta
+                  <==> b[n-1] < floor((r[j+n]*beta+r[j+n-1]+b[n-1])/beta)
+                       {<= beta !}.
+                  If yes, jump directly to the subtraction loop.
+                  (Otherwise, r[j+n]*beta+r[j+n-1] - (beta-1)*b[n-1] < beta
+                   <==> floor((r[j+n]*beta+r[j+n-1]+b[n-1])/beta) = b[n-1] ) */
+               if (r_ptr[j + b_len] > b_msd
+                   || (c1 = r_ptr[j + b_len - 1] + b_msd) < b_msd)
+                 /* r[j+n] >= b[n-1]+1 or
+                    r[j+n] = b[n-1] and the addition r[j+n-1]+b[n-1] gives a
+                    carry.  */
+                 goto subtract;
+             }
+           /* q_star = q*,
+              c1 = (r[j+n]*beta+r[j+n-1]) - q* * b[n-1] (>=0, <beta).  */
+           {
+             mp_twolimb_t c2 = /* c1*beta+r[j+n-2] */
+               ((mp_twolimb_t) c1 << GMP_LIMB_BITS) | r_ptr[j + b_len - 2];
+             mp_twolimb_t c3 = /* b[n-2] * q* */
+               (mp_twolimb_t) b_2msd * (mp_twolimb_t) q_star;
+             /* While c2 < c3, increase c2 and decrease c3.
+                Consider c3-c2.  While it is > 0, decrease it by
+                b[n-1]*beta+b[n-2].  Because of b[n-1]*beta+b[n-2] >= beta^2/2
+                this can happen only twice.  */
+             if (c3 > c2)
+               {
+                 q_star = q_star - 1; /* q* := q* - 1 */
+                 if (c3 - c2 > b_msdd)
+                   q_star = q_star - 1; /* q* := q* - 1 */
+               }
+           }
+           if (q_star > 0)
+             subtract:
+             {
+               /* Subtract r := r - b * q* * beta^j.  */
+               mp_limb_t cr;
+               {
+                 const mp_limb_t *sourceptr = b_ptr;
+                 mp_limb_t *destptr = r_ptr + j;
+                 mp_twolimb_t carry = 0;
+                 size_t count;
+                 for (count = b_len; count > 0; count--)
+                   {
+                     /* Here 0 <= carry <= q*.  */
+                     carry =
+                       carry
+                       + (mp_twolimb_t) q_star * (mp_twolimb_t) *sourceptr++
+                       + (mp_limb_t) ~(*destptr);
+                     /* Here 0 <= carry <= beta*q* + beta-1.  */
+                     *destptr++ = ~(mp_limb_t) carry;
+                     carry = carry >> GMP_LIMB_BITS; /* <= q* */
+                   }
+                 cr = (mp_limb_t) carry;
+               }
+               /* Subtract cr from r_ptr[j + b_len], then forget about
+                  r_ptr[j + b_len].  */
+               if (cr > r_ptr[j + b_len])
+                 {
+                   /* Subtraction gave a carry.  */
+                   q_star = q_star - 1; /* q* := q* - 1 */
+                   /* Add b back.  */
+                   {
+                     const mp_limb_t *sourceptr = b_ptr;
+                     mp_limb_t *destptr = r_ptr + j;
+                     mp_limb_t carry = 0;
+                     size_t count;
+                     for (count = b_len; count > 0; count--)
+                       {
+                         mp_limb_t source1 = *sourceptr++;
+                         mp_limb_t source2 = *destptr;
+                         *destptr++ = source1 + source2 + carry;
+                         carry =
+                           (carry
+                            ? source1 >= (mp_limb_t) ~source2
+                            : source1 > (mp_limb_t) ~source2);
+                       }
+                   }
+                   /* Forget about the carry and about r[j+n].  */
+                 }
+             }
+           /* q* is determined.  Store it as q[j].  */
+           q_ptr[j] = q_star;
+           if (j == 0)
+             break;
+           j--;
+         }
+      }
+      r_len = b_len;
+      /* Normalise q.  */
+      if (q_ptr[q_len - 1] == 0)
+       q_len--;
+# if 0 /* Not needed here, since we need r only to compare it with b/2, and
+         b is shifted left by s bits.  */
+      /* Shift r right by s bits.  */
+      if (s > 0)
+       {
+         mp_limb_t ptr = r_ptr + r_len;
+         mp_twolimb_t accu = 0;
+         size_t count;
+         for (count = r_len; count > 0; count--)
+           {
+             accu = (mp_twolimb_t) (mp_limb_t) accu << GMP_LIMB_BITS;
+             accu += (mp_twolimb_t) *--ptr << (GMP_LIMB_BITS - s);
+             *ptr = (mp_limb_t) (accu >> GMP_LIMB_BITS);
+           }
+       }
+# endif
+      /* Normalise r.  */
+      while (r_len > 0 && r_ptr[r_len - 1] == 0)
+       r_len--;
+    }
+  /* Compare r << 1 with b.  */
+  if (r_len > b_len)
+    goto increment_q;
+  {
+    size_t i;
+    for (i = b_len;;)
+      {
+       mp_limb_t r_i =
+         (i <= r_len && i > 0 ? r_ptr[i - 1] >> (GMP_LIMB_BITS - 1) : 0)
+         | (i < r_len ? r_ptr[i] << 1 : 0);
+       mp_limb_t b_i = (i < b_len ? b_ptr[i] : 0);
+       if (r_i > b_i)
+         goto increment_q;
+       if (r_i < b_i)
+         goto keep_q;
+       if (i == 0)
+         break;
+       i--;
+      }
+  }
+  if (q_len > 0 && ((q_ptr[0] & 1) != 0))
+    /* q is odd.  */
+    increment_q:
+    {
+      size_t i;
+      for (i = 0; i < q_len; i++)
+       if (++(q_ptr[i]) != 0)
+         goto keep_q;
+      q_ptr[q_len++] = 1;
+    }
+  keep_q:
+  if (tmp_roomptr != NULL)
+    free (tmp_roomptr);
+  q->limbs = q_ptr;
+  q->nlimbs = q_len;
+  return roomptr;
+}
+
+/* Convert a bignum a >= 0, multiplied with 10^extra_zeroes, to decimal
+   representation.
+   Destroys the contents of a.
+   Return the allocated memory - containing the decimal digits in low-to-high
+   order, terminated with a NUL character - in case of success, NULL in case
+   of memory allocation failure.  */
+static char *
+convert_to_decimal (mpn_t a, size_t extra_zeroes)
+{
+  mp_limb_t *a_ptr = a.limbs;
+  size_t a_len = a.nlimbs;
+  /* 0.03345 is slightly larger than log(2)/(9*log(10)).  */
+  size_t c_len = 9 * ((size_t)(a_len * (GMP_LIMB_BITS * 0.03345f)) + 1);
+  char *c_ptr = (char *) malloc (xsum (c_len, extra_zeroes));
+  if (c_ptr != NULL)
+    {
+      char *d_ptr = c_ptr;
+      for (; extra_zeroes > 0; extra_zeroes--)
+       *d_ptr++ = '0';
+      while (a_len > 0)
+       {
+         /* Divide a by 10^9, in-place.  */
+         mp_limb_t remainder = 0;
+         mp_limb_t *ptr = a_ptr + a_len;
+         size_t count;
+         for (count = a_len; count > 0; count--)
+           {
+             mp_twolimb_t num =
+               ((mp_twolimb_t) remainder << GMP_LIMB_BITS) | *--ptr;
+             *ptr = num / 1000000000;
+             remainder = num % 1000000000;
+           }
+         /* Store the remainder as 9 decimal digits.  */
+         for (count = 9; count > 0; count--)
+           {
+             *d_ptr++ = '0' + (remainder % 10);
+             remainder = remainder / 10;
+           }
+         /* Normalize a.  */
+         if (a_ptr[a_len - 1] == 0)
+           a_len--;
+       }
+      /* Remove leading zeroes.  */
+      while (d_ptr > c_ptr && d_ptr[-1] == '0')
+       d_ptr--;
+      /* But keep at least one zero.  */
+      if (d_ptr == c_ptr)
+       *d_ptr++ = '0';
+      /* Terminate the string.  */
+      *d_ptr = '\0';
+    }
+  return c_ptr;
+}
+
+/* Assuming x is finite and >= 0:
+   write x as x = 2^e * m, where m is a bignum.
+   Return the allocated memory in case of success, NULL in case of memory
+   allocation failure.  */
+static void *
+decode_long_double (long double x, int *ep, mpn_t *mp)
+{
+  mpn_t m;
+  int exp;
+  long double y;
+  size_t i;
+
+  /* Allocate memory for result.  */
+  m.nlimbs = (LDBL_MANT_BIT + GMP_LIMB_BITS - 1) / GMP_LIMB_BITS;
+  m.limbs = (mp_limb_t *) malloc (m.nlimbs * sizeof (mp_limb_t));
+  if (m.limbs == NULL)
+    return NULL;
+  /* Split into exponential part and mantissa.  */
+  y = frexpl (x, &exp);
+  if (!(y >= 0.0L && y < 1.0L))
+    abort ();
+  /* x = 2^exp * y = 2^(exp - LDBL_MANT_BIT) * (y * LDBL_MANT_BIT), and the
+     latter is an integer.  */
+  /* Convert the mantissa (y * LDBL_MANT_BIT) to a sequence of limbs.
+     I'm not sure whether it's safe to cast a 'long double' value between
+     2^31 and 2^32 to 'unsigned int', therefore play safe and cast only
+     'long double' values between 0 and 2^16 (to 'unsigned int' or 'int',
+     doesn't matter).  */
+# if (LDBL_MANT_BIT % GMP_LIMB_BITS) != 0
+#  if (LDBL_MANT_BIT % GMP_LIMB_BITS) > GMP_LIMB_BITS / 2
+    {
+      mp_limb_t hi, lo;
+      y *= (mp_limb_t) 1 << (LDBL_MANT_BIT % (GMP_LIMB_BITS / 2));
+      hi = (int) y;
+      y -= hi;
+      if (!(y >= 0.0L && y < 1.0L))
+       abort ();
+      y *= (mp_limb_t) 1 << (GMP_LIMB_BITS / 2);
+      lo = (int) y;
+      y -= lo;
+      if (!(y >= 0.0L && y < 1.0L))
+       abort ();
+      m.limbs[LDBL_MANT_BIT / GMP_LIMB_BITS] = (hi << (GMP_LIMB_BITS / 2)) | 
lo;
+    }
+#  else
+    {
+      mp_limb_t d;
+      y *= (mp_limb_t) 1 << (LDBL_MANT_BIT % GMP_LIMB_BITS);
+      d = (int) y;
+      y -= d;
+      if (!(y >= 0.0L && y < 1.0L))
+       abort ();
+      m.limbs[LDBL_MANT_BIT / GMP_LIMB_BITS] = d;
+    }
 # endif
+# endif
+  for (i = LDBL_MANT_BIT / GMP_LIMB_BITS; i > 0; )
+    {
+      mp_limb_t hi, lo;
+      y *= (mp_limb_t) 1 << (GMP_LIMB_BITS / 2);
+      hi = (int) y;
+      y -= hi;
+      if (!(y >= 0.0L && y < 1.0L))
+       abort ();
+      y *= (mp_limb_t) 1 << (GMP_LIMB_BITS / 2);
+      lo = (int) y;
+      y -= lo;
+      if (!(y >= 0.0L && y < 1.0L))
+       abort ();
+      m.limbs[--i] = (hi << (GMP_LIMB_BITS / 2)) | lo;
+    }
+  if (!(y == 0.0L))
+    abort ();
+  /* Normalise.  */
+  while (m.nlimbs > 0 && m.limbs[m.nlimbs - 1] == 0)
+    m.nlimbs--;
+  *mp = m;
+  *ep = exp - LDBL_MANT_BIT;
+  return m.limbs;
+}
+
+/* Assuming x is finite and >= 0, and n is an integer:
+   Returns the decimal representation of round (x * 10^n).
+   Return the allocated memory - containing the decimal digits in low-to-high
+   order, terminated with a NUL character - in case of success, NULL in case
+   of memory allocation failure.  */
+static char *
+scale10_round_decimal_long_double (long double x, int n)
+{
+  int e;
+  mpn_t m;
+  void *memory = decode_long_double (x, &e, &m);
+  int s;
+  size_t extra_zeroes;
+  unsigned int abs_n;
+  unsigned int abs_s;
+  mp_limb_t *pow5_ptr;
+  size_t pow5_len;
+  unsigned int s_limbs;
+  unsigned int s_bits;
+  mpn_t pow5;
+  mpn_t z;
+  void *z_memory;
+  char *digits;
+
+  if (memory == NULL)
+    return NULL;
+  /* x = 2^e * m, hence
+     y = round (2^e * 10^n * m) = round (2^(e+n) * 5^n * m)
+       = round (2^s * 5^n * m).  */
+  s = e + n;
+  extra_zeroes = 0;
+  /* Factor out a common power of 10 if possible.  */
+  if (s > 0 && n > 0)
+    {
+      extra_zeroes = (s < n ? s : n);
+      s -= extra_zeroes;
+      n -= extra_zeroes;
+    }
+  /* Here y = round (2^s * 5^n * m) * 10^extra_zeroes.
+     Before converting to decimal, we need to compute
+     z = round (2^s * 5^n * m).  */
+  /* Compute 5^|n|, possibly shifted by |s| bits if n and s have the same
+     sign.  2.322 is slightly larger than log(5)/log(2).  */
+  abs_n = (n >= 0 ? n : -n);
+  abs_s = (s >= 0 ? s : -s);
+  pow5_ptr = (mp_limb_t *) malloc (((int)(abs_n * (2.322f / GMP_LIMB_BITS)) + 1
+                                   + abs_s / GMP_LIMB_BITS + 1)
+                                  * sizeof (mp_limb_t));
+  if (pow5_ptr == NULL)
+    {
+      free (memory);
+      return NULL;
+    }
+  /* Initialize with 1.  */
+  pow5_ptr[0] = 1;
+  pow5_len = 1;
+  /* Multiply with 5^|n|.  */
+  if (abs_n > 0)
+    {
+      static mp_limb_t const small_pow5[13 + 1] =
+       {
+         1, 5, 25, 125, 625, 3125, 15625, 78125, 390625, 1953125, 9765625,
+         48828125, 244140625, 1220703125
+       };
+      unsigned int n13;
+      for (n13 = 0; n13 <= abs_n; n13 += 13)
+       {
+         mp_limb_t digit1 = small_pow5[n13 + 13 <= abs_n ? 13 : abs_n - n13];
+         size_t j;
+         mp_twolimb_t carry = 0;
+         for (j = 0; j < pow5_len; j++)
+           {
+             mp_limb_t digit2 = pow5_ptr[j];
+             carry += (mp_twolimb_t) digit1 * (mp_twolimb_t) digit2;
+             pow5_ptr[j] = (mp_limb_t) carry;
+             carry = carry >> GMP_LIMB_BITS;
+           }
+         if (carry > 0)
+           pow5_ptr[pow5_len++] = (mp_limb_t) carry;
+       }
+    }
+  s_limbs = abs_s / GMP_LIMB_BITS;
+  s_bits = abs_s % GMP_LIMB_BITS;
+  if (n >= 0 ? s >= 0 : s <= 0)
+    {
+      /* Multiply with 2^|s|.  */
+      if (s_bits > 0)
+       {
+         mp_limb_t *ptr = pow5_ptr;
+         mp_twolimb_t accu = 0;
+         size_t count;
+         for (count = pow5_len; count > 0; count--)
+           {
+             accu += (mp_twolimb_t) *ptr << s_bits;
+             *ptr++ = (mp_limb_t) accu;
+             accu = accu >> GMP_LIMB_BITS;
+           }
+         if (accu > 0)
+           {
+             *ptr = (mp_limb_t) accu;
+             pow5_len++;
+           }
+       }
+      if (s_limbs > 0)
+       {
+         size_t count;
+         for (count = pow5_len; count > 0;)
+           {
+             count--;
+             pow5_ptr[s_limbs + count] = pow5_ptr[count];
+           }
+         for (count = s_limbs; count > 0;)
+           {
+             count--;
+             pow5_ptr[count] = 0;
+           }
+         pow5_len += s_limbs;
+       }
+      pow5.limbs = pow5_ptr;
+      pow5.nlimbs = pow5_len;
+      if (n >= 0)
+       {
+         /* Multiply m with pow5.  No division needed.  */
+         z_memory = multiply (m, pow5, &z);
+       }
+      else
+       {
+         /* Divide m by pow5 and round.  */
+         z_memory = divide (m, pow5, &z);
+       }
+    }
+  else
+    {
+      pow5.limbs = pow5_ptr;
+      pow5.nlimbs = pow5_len;
+      if (n >= 0)
+       {
+         /* n >= 0, s < 0.
+            Multiply m with pow5, then divide by 2^|s|.  */
+         mpn_t numerator;
+         mpn_t denominator;
+         void *tmp_memory;
+         tmp_memory = multiply (m, pow5, &numerator);
+         if (tmp_memory == NULL)
+           {
+             free (pow5_ptr);
+             free (memory);
+             return NULL;
+           }
+         /* Construct 2^|s|.  */
+         {
+           mp_limb_t *ptr = pow5_ptr + pow5_len;
+           size_t i;
+           for (i = 0; i < s_limbs; i++)
+             ptr[i] = 0;
+           ptr[s_limbs] = (mp_limb_t) 1 << s_bits;
+           denominator.limbs = ptr;
+           denominator.nlimbs = s_limbs + 1;
+         }
+         z_memory = divide (numerator, denominator, &z);
+         free (tmp_memory);
+       }
+      else
+       {
+         /* n < 0, s > 0.
+            Multiply m with 2^s, then divide by pow5.  */
+         mpn_t numerator;
+         mp_limb_t *num_ptr;
+         num_ptr = (mp_limb_t *) malloc ((m.nlimbs + s_limbs + 1)
+                                         * sizeof (mp_limb_t));
+         if (num_ptr == NULL)
+           {
+             free (pow5_ptr);
+             free (memory);
+             return NULL;
+           }
+         {
+           mp_limb_t *destptr = num_ptr;
+           {
+             size_t i;
+             for (i = 0; i < s_limbs; i++)
+               *destptr++ = 0;
+           }
+           if (s_bits > 0)
+             {
+               const mp_limb_t *sourceptr = m.limbs;
+               mp_twolimb_t accu = 0;
+               size_t count;
+               for (count = m.nlimbs; count > 0; count--)
+                 {
+                   accu += (mp_twolimb_t) *sourceptr++ << s;
+                   *destptr++ = (mp_limb_t) accu;
+                   accu = accu >> GMP_LIMB_BITS;
+                 }
+               if (accu > 0)
+                 *destptr++ = (mp_limb_t) accu;
+             }
+           else
+             {
+               const mp_limb_t *sourceptr = m.limbs;
+               size_t count;
+               for (count = m.nlimbs; count > 0; count--)
+                 *destptr++ = *sourceptr++;
+             }
+           numerator.limbs = num_ptr;
+           numerator.nlimbs = destptr - num_ptr;
+         }
+         z_memory = divide (numerator, pow5, &z);
+         free (num_ptr);
+       }
+    }
+  free (pow5_ptr);
+  free (memory);
+
+  /* Here y = round (x * 10^n) = z * 10^extra_zeroes.  */
+
+  if (z_memory == NULL)
+    return NULL;
+  digits = convert_to_decimal (z, extra_zeroes);
+  free (z_memory);
+  return digits;
+}
+
+/* Assuming x is finite and > 0:
+   Return an approximation for n with 10^n <= x < 10^(n+1).
+   The approximation is usually the right n, but may be off by 1 sometimes.  */
+static int
+floorlog10l (long double x)
+{
+  int exp;
+  long double y;
+  double z;
+  double l;
+
+  /* Split into exponential part and mantissa.  */
+  y = frexpl (x, &exp);
+  if (!(y >= 0.0L && y < 1.0L))
+    abort ();
+  if (y == 0.0L)
+    return INT_MIN;
+  if (y < 0.5L)
+    {
+      while (y < (1.0L / (1 << (GMP_LIMB_BITS / 2)) / (1 << (GMP_LIMB_BITS / 
2))))
+       {
+         y *= 1.0L * (1 << (GMP_LIMB_BITS / 2)) * (1 << (GMP_LIMB_BITS / 2));
+         exp -= GMP_LIMB_BITS;
+       }
+      if (y < (1.0L / (1 << 16)))
+       {
+         y *= 1.0L * (1 << 16);
+         exp -= 16;
+       }
+      if (y < (1.0L / (1 << 8)))
+       {
+         y *= 1.0L * (1 << 8);
+         exp -= 8;
+       }
+      if (y < (1.0L / (1 << 4)))
+       {
+         y *= 1.0L * (1 << 4);
+         exp -= 4;
+       }
+      if (y < (1.0L / (1 << 2)))
+       {
+         y *= 1.0L * (1 << 2);
+         exp -= 2;
+       }
+      if (y < (1.0L / (1 << 1)))
+       {
+         y *= 1.0L * (1 << 1);
+         exp -= 1;
+       }
+    }
+  if (!(y >= 0.5L && y < 1.0L))
+    abort ();
+  /* Compute an approximation for l = log2(x) = exp + log2(y).  */
+  l = exp;
+  z = y;
+  if (z < 0.70710678118654752444)
+    {
+      z *= 1.4142135623730950488;
+      l -= 0.5;
+    }
+  if (z < 0.8408964152537145431)
+    {
+      z *= 1.1892071150027210667;
+      l -= 0.25;
+    }
+  if (z < 0.91700404320467123175)
+    {
+      z *= 1.0905077326652576592;
+      l -= 0.125;
+    }
+  if (z < 0.9576032806985736469)
+    {
+      z *= 1.0442737824274138403;
+      l -= 0.0625;
+    }
+  /* Now 0.95 <= z <= 1.01.  */
+  z = 1 - z;
+  /* log(1-z) = - z - z^2/2 - z^3/3 - z^4/4 - ...
+     Four terms are enough to get an approximation with error < 10^-7.  */
+  l -= z * (1.0 + z * (0.5 + z * ((1.0 / 3) + z * 0.25)));
+  /* Finally multiply with log(2)/log(10), yields an approximation for
+     log10(x).  */
+  l *= 0.30102999566398119523;
+  /* Round down to the next integer.  */
+  return (int) l + (l < 0 ? -1 : 0);
+}
+
 #endif
 
-CHAR_T *
-VASNPRINTF (CHAR_T *resultbuf, size_t *lengthp, const CHAR_T *format, va_list 
args)
+DCHAR_T *
+VASNPRINTF (DCHAR_T *resultbuf, size_t *lengthp,
+           const FCHAR_T *format, va_list args)
 {
   DIRECTIVES d;
   arguments a;
@@ -120,7 +1206,7 @@
   if (a.arg)                                                           \
     free (a.arg);
 
-  if (printf_fetchargs (args, &a) < 0)
+  if (PRINTF_FETCHARGS (args, &a) < 0)
     {
       CLEANUP ();
       errno = EINVAL;
@@ -129,13 +1215,13 @@
 
   {
     size_t buf_neededlength;
-    CHAR_T *buf;
-    CHAR_T *buf_malloced;
-    const CHAR_T *cp;
+    TCHAR_T *buf;
+    TCHAR_T *buf_malloced;
+    const FCHAR_T *cp;
     size_t i;
     DIRECTIVE *dp;
     /* Output string accumulator.  */
-    CHAR_T *result;
+    DCHAR_T *result;
     size_t allocated;
     size_t length;
 
@@ -144,18 +1230,18 @@
     buf_neededlength =
       xsum4 (7, d.max_width_length, d.max_precision_length, 6);
 #if HAVE_ALLOCA
-    if (buf_neededlength < 4000 / sizeof (CHAR_T))
+    if (buf_neededlength < 4000 / sizeof (TCHAR_T))
       {
-       buf = (CHAR_T *) alloca (buf_neededlength * sizeof (CHAR_T));
+       buf = (TCHAR_T *) alloca (buf_neededlength * sizeof (TCHAR_T));
        buf_malloced = NULL;
       }
     else
 #endif
       {
-       size_t buf_memsize = xtimes (buf_neededlength, sizeof (CHAR_T));
+       size_t buf_memsize = xtimes (buf_neededlength, sizeof (TCHAR_T));
        if (size_overflow_p (buf_memsize))
          goto out_of_memory_1;
-       buf = (CHAR_T *) malloc (buf_memsize);
+       buf = (TCHAR_T *) malloc (buf_memsize);
        if (buf == NULL)
          goto out_of_memory_1;
        buf_malloced = buf;
@@ -182,98 +1268,1736 @@
     if ((needed) > allocated)                                               \
       {                                                                        
     \
        size_t memory_size;                                                  \
-       CHAR_T *memory;                                                      \
+       DCHAR_T *memory;                                                     \
                                                                             \
        allocated = (allocated > 0 ? xtimes (allocated, 2) : 12);            \
        if ((needed) > allocated)                                            \
          allocated = (needed);                                              \
-       memory_size = xtimes (allocated, sizeof (CHAR_T));                   \
+       memory_size = xtimes (allocated, sizeof (DCHAR_T));                  \
        if (size_overflow_p (memory_size))                                   \
          goto out_of_memory;                                                \
        if (result == resultbuf || result == NULL)                           \
-         memory = (CHAR_T *) malloc (memory_size);                          \
+         memory = (DCHAR_T *) malloc (memory_size);                         \
        else                                                                 \
-         memory = (CHAR_T *) realloc (result, memory_size);                 \
+         memory = (DCHAR_T *) realloc (result, memory_size);                \
        if (memory == NULL)                                                  \
          goto out_of_memory;                                                \
        if (result == resultbuf && length > 0)                               \
-         memcpy (memory, result, length * sizeof (CHAR_T));                 \
+         DCHAR_CPY (memory, result, length);                                \
        result = memory;                                                     \
       }
-
-    for (cp = format, i = 0, dp = &d.dir[0]; ; cp = dp->dir_end, i++, dp++)
+
+    for (cp = format, i = 0, dp = &d.dir[0]; ; cp = dp->dir_end, i++, dp++)
+      {
+       if (cp != dp->dir_start)
+         {
+           size_t n = dp->dir_start - cp;
+           size_t augmented_length = xsum (length, n);
+
+           ENSURE_ALLOCATION (augmented_length);
+           /* This copies a piece of FCHAR_T[] into a DCHAR_T[].  Here we
+              need that the format string contains only ASCII characters
+              if FCHAR_T and DCHAR_T are not the same type.  */
+           if (sizeof (FCHAR_T) == sizeof (DCHAR_T))
+             {
+               DCHAR_CPY (result + length, (const DCHAR_T *) cp, n);
+               length = augmented_length;
+             }
+           else
+             {
+               do
+                 result[length++] = (unsigned char) *cp++;
+               while (--n > 0);
+             }
+         }
+       if (i == d.count)
+         break;
+
+       /* Execute a single directive.  */
+       if (dp->conversion == '%')
+         {
+           size_t augmented_length;
+
+           if (!(dp->arg_index == ARG_NONE))
+             abort ();
+           augmented_length = xsum (length, 1);
+           ENSURE_ALLOCATION (augmented_length);
+           result[length] = '%';
+           length = augmented_length;
+         }
+       else
+         {
+           if (!(dp->arg_index != ARG_NONE))
+             abort ();
+
+           if (dp->conversion == 'n')
+             {
+               switch (a.arg[dp->arg_index].type)
+                 {
+                 case TYPE_COUNT_SCHAR_POINTER:
+                   *a.arg[dp->arg_index].a.a_count_schar_pointer = length;
+                   break;
+                 case TYPE_COUNT_SHORT_POINTER:
+                   *a.arg[dp->arg_index].a.a_count_short_pointer = length;
+                   break;
+                 case TYPE_COUNT_INT_POINTER:
+                   *a.arg[dp->arg_index].a.a_count_int_pointer = length;
+                   break;
+                 case TYPE_COUNT_LONGINT_POINTER:
+                   *a.arg[dp->arg_index].a.a_count_longint_pointer = length;
+                   break;
+#if HAVE_LONG_LONG_INT
+                 case TYPE_COUNT_LONGLONGINT_POINTER:
+                   *a.arg[dp->arg_index].a.a_count_longlongint_pointer = 
length;
+                   break;
+#endif
+                 default:
+                   abort ();
+                 }
+             }
+#if ENABLE_UNISTDIO
+           /* The unistdio extensions.  */
+           else if (dp->conversion == 'U')
+             {
+               arg_type type = a.arg[dp->arg_index].type;
+               int flags = dp->flags;
+               int has_width;
+               size_t width;
+               int has_precision;
+               size_t precision;
+
+               has_width = 0;
+               width = 0;
+               if (dp->width_start != dp->width_end)
+                 {
+                   if (dp->width_arg_index != ARG_NONE)
+                     {
+                       int arg;
+
+                       if (!(a.arg[dp->width_arg_index].type == TYPE_INT))
+                         abort ();
+                       arg = a.arg[dp->width_arg_index].a.a_int;
+                       if (arg < 0)
+                         {
+                           /* "A negative field width is taken as a '-' flag
+                               followed by a positive field width."  */
+                           flags |= FLAG_LEFT;
+                           width = (unsigned int) (-arg);
+                         }
+                       else
+                         width = arg;
+                     }
+                   else
+                     {
+                       const FCHAR_T *digitp = dp->width_start;
+
+                       do
+                         width = xsum (xtimes (width, 10), *digitp++ - '0');
+                       while (digitp != dp->width_end);
+                     }
+                   has_width = 1;
+                 }
+
+               has_precision = 0;
+               precision = 0;
+               if (dp->precision_start != dp->precision_end)
+                 {
+                   if (dp->precision_arg_index != ARG_NONE)
+                     {
+                       int arg;
+
+                       if (!(a.arg[dp->precision_arg_index].type == TYPE_INT))
+                         abort ();
+                       arg = a.arg[dp->precision_arg_index].a.a_int;
+                       /* "A negative precision is taken as if the precision
+                           were omitted."  */
+                       if (arg >= 0)
+                         {
+                           precision = arg;
+                           has_precision = 1;
+                         }
+                     }
+                   else
+                     {
+                       const FCHAR_T *digitp = dp->precision_start + 1;
+
+                       precision = 0;
+                       while (digitp != dp->precision_end)
+                         precision = xsum (xtimes (precision, 10), *digitp++ - 
'0');
+                       has_precision = 1;
+                     }
+                 }
+
+               switch (type)
+                 {
+                 case TYPE_U8_STRING:
+                   {
+                     const uint8_t *arg = a.arg[dp->arg_index].a.a_u8_string;
+                     const uint8_t *arg_end;
+                     size_t characters;
+
+                     if (has_precision)
+                       {
+                         /* Use only PRECISION characters, from the left.  */
+                         arg_end = arg;
+                         characters = 0;
+                         for (; precision > 0; precision--)
+                           {
+                             int count = u8_strmblen (arg_end);
+                             if (count == 0)
+                               break;
+                             if (count < 0)
+                               {
+                                 if (!(result == resultbuf || result == NULL))
+                                   free (result);
+                                 if (buf_malloced != NULL)
+                                   free (buf_malloced);
+                                 CLEANUP ();
+                                 errno = EILSEQ;
+                                 return NULL;
+                               }
+                             arg_end += count;
+                             characters++;
+                           }
+                       }
+                     else if (has_width)
+                       {
+                         /* Use the entire string, and count the number of
+                            characters.  */
+                         arg_end = arg;
+                         characters = 0;
+                         for (;;)
+                           {
+                             int count = u8_strmblen (arg_end);
+                             if (count == 0)
+                               break;
+                             if (count < 0)
+                               {
+                                 if (!(result == resultbuf || result == NULL))
+                                   free (result);
+                                 if (buf_malloced != NULL)
+                                   free (buf_malloced);
+                                 CLEANUP ();
+                                 errno = EILSEQ;
+                                 return NULL;
+                               }
+                             arg_end += count;
+                             characters++;
+                           }
+                       }
+                     else
+                       {
+                         /* Use the entire string.  */
+                         arg_end = arg + u8_strlen (arg);
+                         /* The number of characters doesn't matter.  */
+                         characters = 0;
+                       }
+
+                     if (has_width && width > characters
+                         && !(dp->flags & FLAG_LEFT))
+                       {
+                         size_t n = width - characters;
+                         ENSURE_ALLOCATION (xsum (length, n));
+                         DCHAR_SET (result + length, ' ', n);
+                         length += n;
+                       }
+
+# if DCHAR_IS_UINT8_T
+                     {
+                       size_t n = arg_end - arg;
+                       ENSURE_ALLOCATION (xsum (length, n));
+                       DCHAR_CPY (result + length, arg, n);
+                       length += n;
+                     }
+# else
+                     { /* Convert.  */
+                       DCHAR_T *converted = result + length;
+                       size_t converted_len = allocated - length;
+#  if DCHAR_IS_TCHAR
+                       /* Convert from UTF-8 to locale encoding.  */
+                       if (u8_conv_to_encoding (locale_charset (),
+                                                iconveh_question_mark,
+                                                arg, arg_end - arg, NULL,
+                                                &converted, &converted_len)
+                           < 0)
+#  else
+                       /* Convert from UTF-8 to UTF-16/UTF-32.  */
+                       converted =
+                         U8_TO_DCHAR (arg, arg_end - arg,
+                                      converted, &converted_len);
+                       if (converted == NULL)
+#  endif
+                         {
+                           int saved_errno = errno;
+                           if (!(result == resultbuf || result == NULL))
+                             free (result);
+                           if (buf_malloced != NULL)
+                             free (buf_malloced);
+                           CLEANUP ();
+                           errno = saved_errno;
+                           return NULL;
+                         }
+                       if (converted != result + length)
+                         {
+                           ENSURE_ALLOCATION (xsum (length, converted_len));
+                           DCHAR_CPY (result + length, converted, 
converted_len);
+                           free (converted);
+                         }
+                       length += converted_len;
+                     }
+# endif
+
+                     if (has_width && width > characters
+                         && (dp->flags & FLAG_LEFT))
+                       {
+                         size_t n = width - characters;
+                         ENSURE_ALLOCATION (xsum (length, n));
+                         DCHAR_SET (result + length, ' ', n);
+                         length += n;
+                       }
+                   }
+                   break;
+
+                 case TYPE_U16_STRING:
+                   {
+                     const uint16_t *arg = a.arg[dp->arg_index].a.a_u16_string;
+                     const uint16_t *arg_end;
+                     size_t characters;
+
+                     if (has_precision)
+                       {
+                         /* Use only PRECISION characters, from the left.  */
+                         arg_end = arg;
+                         characters = 0;
+                         for (; precision > 0; precision--)
+                           {
+                             int count = u16_strmblen (arg_end);
+                             if (count == 0)
+                               break;
+                             if (count < 0)
+                               {
+                                 if (!(result == resultbuf || result == NULL))
+                                   free (result);
+                                 if (buf_malloced != NULL)
+                                   free (buf_malloced);
+                                 CLEANUP ();
+                                 errno = EILSEQ;
+                                 return NULL;
+                               }
+                             arg_end += count;
+                             characters++;
+                           }
+                       }
+                     else if (has_width)
+                       {
+                         /* Use the entire string, and count the number of
+                            characters.  */
+                         arg_end = arg;
+                         characters = 0;
+                         for (;;)
+                           {
+                             int count = u16_strmblen (arg_end);
+                             if (count == 0)
+                               break;
+                             if (count < 0)
+                               {
+                                 if (!(result == resultbuf || result == NULL))
+                                   free (result);
+                                 if (buf_malloced != NULL)
+                                   free (buf_malloced);
+                                 CLEANUP ();
+                                 errno = EILSEQ;
+                                 return NULL;
+                               }
+                             arg_end += count;
+                             characters++;
+                           }
+                       }
+                     else
+                       {
+                         /* Use the entire string.  */
+                         arg_end = arg + u16_strlen (arg);
+                         /* The number of characters doesn't matter.  */
+                         characters = 0;
+                       }
+
+                     if (has_width && width > characters
+                         && !(dp->flags & FLAG_LEFT))
+                       {
+                         size_t n = width - characters;
+                         ENSURE_ALLOCATION (xsum (length, n));
+                         DCHAR_SET (result + length, ' ', n);
+                         length += n;
+                       }
+
+# if DCHAR_IS_UINT16_T
+                     {
+                       size_t n = arg_end - arg;
+                       ENSURE_ALLOCATION (xsum (length, n));
+                       DCHAR_CPY (result + length, arg, n);
+                       length += n;
+                     }
+# else
+                     { /* Convert.  */
+                       DCHAR_T *converted = result + length;
+                       size_t converted_len = allocated - length;
+#  if DCHAR_IS_TCHAR
+                       /* Convert from UTF-16 to locale encoding.  */
+                       if (u16_conv_to_encoding (locale_charset (),
+                                                 iconveh_question_mark,
+                                                 arg, arg_end - arg, NULL,
+                                                 &converted, &converted_len)
+                           < 0)
+#  else
+                       /* Convert from UTF-16 to UTF-8/UTF-32.  */
+                       converted =
+                         U16_TO_DCHAR (arg, arg_end - arg,
+                                       converted, &converted_len);
+                       if (converted == NULL)
+#  endif
+                         {
+                           int saved_errno = errno;
+                           if (!(result == resultbuf || result == NULL))
+                             free (result);
+                           if (buf_malloced != NULL)
+                             free (buf_malloced);
+                           CLEANUP ();
+                           errno = saved_errno;
+                           return NULL;
+                         }
+                       if (converted != result + length)
+                         {
+                           ENSURE_ALLOCATION (xsum (length, converted_len));
+                           DCHAR_CPY (result + length, converted, 
converted_len);
+                           free (converted);
+                         }
+                       length += converted_len;
+                     }
+# endif
+
+                     if (has_width && width > characters
+                         && (dp->flags & FLAG_LEFT))
+                       {
+                         size_t n = width - characters;
+                         ENSURE_ALLOCATION (xsum (length, n));
+                         DCHAR_SET (result + length, ' ', n);
+                         length += n;
+                       }
+                   }
+                   break;
+
+                 case TYPE_U32_STRING:
+                   {
+                     const uint32_t *arg = a.arg[dp->arg_index].a.a_u32_string;
+                     const uint32_t *arg_end;
+                     size_t characters;
+
+                     if (has_precision)
+                       {
+                         /* Use only PRECISION characters, from the left.  */
+                         arg_end = arg;
+                         characters = 0;
+                         for (; precision > 0; precision--)
+                           {
+                             int count = u32_strmblen (arg_end);
+                             if (count == 0)
+                               break;
+                             if (count < 0)
+                               {
+                                 if (!(result == resultbuf || result == NULL))
+                                   free (result);
+                                 if (buf_malloced != NULL)
+                                   free (buf_malloced);
+                                 CLEANUP ();
+                                 errno = EILSEQ;
+                                 return NULL;
+                               }
+                             arg_end += count;
+                             characters++;
+                           }
+                       }
+                     else if (has_width)
+                       {
+                         /* Use the entire string, and count the number of
+                            characters.  */
+                         arg_end = arg;
+                         characters = 0;
+                         for (;;)
+                           {
+                             int count = u32_strmblen (arg_end);
+                             if (count == 0)
+                               break;
+                             if (count < 0)
+                               {
+                                 if (!(result == resultbuf || result == NULL))
+                                   free (result);
+                                 if (buf_malloced != NULL)
+                                   free (buf_malloced);
+                                 CLEANUP ();
+                                 errno = EILSEQ;
+                                 return NULL;
+                               }
+                             arg_end += count;
+                             characters++;
+                           }
+                       }
+                     else
+                       {
+                         /* Use the entire string.  */
+                         arg_end = arg + u32_strlen (arg);
+                         /* The number of characters doesn't matter.  */
+                         characters = 0;
+                       }
+
+                     if (has_width && width > characters
+                         && !(dp->flags & FLAG_LEFT))
+                       {
+                         size_t n = width - characters;
+                         ENSURE_ALLOCATION (xsum (length, n));
+                         DCHAR_SET (result + length, ' ', n);
+                         length += n;
+                       }
+
+# if DCHAR_IS_UINT32_T
+                     {
+                       size_t n = arg_end - arg;
+                       ENSURE_ALLOCATION (xsum (length, n));
+                       DCHAR_CPY (result + length, arg, n);
+                       length += n;
+                     }
+# else
+                     { /* Convert.  */
+                       DCHAR_T *converted = result + length;
+                       size_t converted_len = allocated - length;
+#  if DCHAR_IS_TCHAR
+                       /* Convert from UTF-32 to locale encoding.  */
+                       if (u32_conv_to_encoding (locale_charset (),
+                                                 iconveh_question_mark,
+                                                 arg, arg_end - arg, NULL,
+                                                 &converted, &converted_len)
+                           < 0)
+#  else
+                       /* Convert from UTF-32 to UTF-8/UTF-16.  */
+                       converted =
+                         U32_TO_DCHAR (arg, arg_end - arg,
+                                       converted, &converted_len);
+                       if (converted == NULL)
+#  endif
+                         {
+                           int saved_errno = errno;
+                           if (!(result == resultbuf || result == NULL))
+                             free (result);
+                           if (buf_malloced != NULL)
+                             free (buf_malloced);
+                           CLEANUP ();
+                           errno = saved_errno;
+                           return NULL;
+                         }
+                       if (converted != result + length)
+                         {
+                           ENSURE_ALLOCATION (xsum (length, converted_len));
+                           DCHAR_CPY (result + length, converted, 
converted_len);
+                           free (converted);
+                         }
+                       length += converted_len;
+                     }
+# endif
+
+                     if (has_width && width > characters
+                         && (dp->flags & FLAG_LEFT))
+                       {
+                         size_t n = width - characters;
+                         ENSURE_ALLOCATION (xsum (length, n));
+                         DCHAR_SET (result + length, ' ', n);
+                         length += n;
+                       }
+                   }
+                   break;
+
+                 default:
+                   abort ();
+                 }
+             }
+#endif
+#if NEED_PRINTF_DIRECTIVE_A && !defined IN_LIBINTL
+           else if (dp->conversion == 'a' || dp->conversion == 'A')
+             {
+               arg_type type = a.arg[dp->arg_index].type;
+               int flags = dp->flags;
+               int has_width;
+               size_t width;
+               int has_precision;
+               size_t precision;
+               size_t tmp_length;
+               DCHAR_T tmpbuf[700];
+               DCHAR_T *tmp;
+               DCHAR_T *pad_ptr;
+               DCHAR_T *p;
+
+               has_width = 0;
+               width = 0;
+               if (dp->width_start != dp->width_end)
+                 {
+                   if (dp->width_arg_index != ARG_NONE)
+                     {
+                       int arg;
+
+                       if (!(a.arg[dp->width_arg_index].type == TYPE_INT))
+                         abort ();
+                       arg = a.arg[dp->width_arg_index].a.a_int;
+                       if (arg < 0)
+                         {
+                           /* "A negative field width is taken as a '-' flag
+                               followed by a positive field width."  */
+                           flags |= FLAG_LEFT;
+                           width = (unsigned int) (-arg);
+                         }
+                       else
+                         width = arg;
+                     }
+                   else
+                     {
+                       const FCHAR_T *digitp = dp->width_start;
+
+                       do
+                         width = xsum (xtimes (width, 10), *digitp++ - '0');
+                       while (digitp != dp->width_end);
+                     }
+                   has_width = 1;
+                 }
+
+               has_precision = 0;
+               precision = 0;
+               if (dp->precision_start != dp->precision_end)
+                 {
+                   if (dp->precision_arg_index != ARG_NONE)
+                     {
+                       int arg;
+
+                       if (!(a.arg[dp->precision_arg_index].type == TYPE_INT))
+                         abort ();
+                       arg = a.arg[dp->precision_arg_index].a.a_int;
+                       /* "A negative precision is taken as if the precision
+                           were omitted."  */
+                       if (arg >= 0)
+                         {
+                           precision = arg;
+                           has_precision = 1;
+                         }
+                     }
+                   else
+                     {
+                       const FCHAR_T *digitp = dp->precision_start + 1;
+
+                       precision = 0;
+                       while (digitp != dp->precision_end)
+                         precision = xsum (xtimes (precision, 10), *digitp++ - 
'0');
+                       has_precision = 1;
+                     }
+                 }
+
+               /* Allocate a temporary buffer of sufficient size.  */
+               if (type == TYPE_LONGDOUBLE)
+                 tmp_length =
+                   (unsigned int) ((LDBL_DIG + 1)
+                                   * 0.831 /* decimal -> hexadecimal */
+                                  )
+                   + 1; /* turn floor into ceil */
+               else
+                 tmp_length =
+                   (unsigned int) ((DBL_DIG + 1)
+                                   * 0.831 /* decimal -> hexadecimal */
+                                  )
+                   + 1; /* turn floor into ceil */
+               if (tmp_length < precision)
+                 tmp_length = precision;
+               /* Account for sign, decimal point etc. */
+               tmp_length = xsum (tmp_length, 12);
+
+               if (tmp_length < width)
+                 tmp_length = width;
+
+               tmp_length = xsum (tmp_length, 1); /* account for trailing NUL 
*/
+
+               if (tmp_length <= sizeof (tmpbuf) / sizeof (DCHAR_T))
+                 tmp = tmpbuf;
+               else
+                 {
+                   size_t tmp_memsize = xtimes (tmp_length, sizeof (DCHAR_T));
+
+                   if (size_overflow_p (tmp_memsize))
+                     /* Overflow, would lead to out of memory.  */
+                     goto out_of_memory;
+                   tmp = (DCHAR_T *) malloc (tmp_memsize);
+                   if (tmp == NULL)
+                     /* Out of memory.  */
+                     goto out_of_memory;
+                 }
+
+               pad_ptr = NULL;
+               p = tmp;
+               if (type == TYPE_LONGDOUBLE)
+                 {
+                   long double arg = a.arg[dp->arg_index].a.a_longdouble;
+
+                   if (isnanl (arg))
+                     {
+                       if (dp->conversion == 'A')
+                         {
+                           *p++ = 'N'; *p++ = 'A'; *p++ = 'N';
+                         }
+                       else
+                         {
+                           *p++ = 'n'; *p++ = 'a'; *p++ = 'n';
+                         }
+                     }
+                   else
+                     {
+                       int sign = 0;
+                       DECL_LONG_DOUBLE_ROUNDING
+
+                       BEGIN_LONG_DOUBLE_ROUNDING ();
+
+                       if (signbit (arg)) /* arg < 0.0L or negative zero */
+                         {
+                           sign = -1;
+                           arg = -arg;
+                         }
+
+                       if (sign < 0)
+                         *p++ = '-';
+                       else if (flags & FLAG_SHOWSIGN)
+                         *p++ = '+';
+                       else if (flags & FLAG_SPACE)
+                         *p++ = ' ';
+
+                       if (arg > 0.0L && arg + arg == arg)
+                         {
+                           if (dp->conversion == 'A')
+                             {
+                               *p++ = 'I'; *p++ = 'N'; *p++ = 'F';
+                             }
+                           else
+                             {
+                               *p++ = 'i'; *p++ = 'n'; *p++ = 'f';
+                             }
+                         }
+                       else
+                         {
+                           int exponent;
+                           long double mantissa;
+
+                           if (arg > 0.0L)
+                             mantissa = printf_frexpl (arg, &exponent);
+                           else
+                             {
+                               exponent = 0;
+                               mantissa = 0.0L;
+                             }
+
+                           if (has_precision
+                               && precision < (unsigned int) ((LDBL_DIG + 1) * 
0.831) + 1)
+                             {
+                               /* Round the mantissa.  */
+                               long double tail = mantissa;
+                               size_t q;
+
+                               for (q = precision; ; q--)
+                                 {
+                                   int digit = (int) tail;
+                                   tail -= digit;
+                                   if (q == 0)
+                                     {
+                                       if (digit & 1 ? tail >= 0.5L : tail > 
0.5L)
+                                         tail = 1 - tail;
+                                       else
+                                         tail = - tail;
+                                       break;
+                                     }
+                                   tail *= 16.0L;
+                                 }
+                               if (tail != 0.0L)
+                                 for (q = precision; q > 0; q--)
+                                   tail *= 0.0625L;
+                               mantissa += tail;
+                             }
+
+                           *p++ = '0';
+                           *p++ = dp->conversion - 'A' + 'X';
+                           pad_ptr = p;
+                           {
+                             int digit;
+
+                             digit = (int) mantissa;
+                             mantissa -= digit;
+                             *p++ = '0' + digit;
+                             if ((flags & FLAG_ALT)
+                                 || mantissa > 0.0L || precision > 0)
+                               {
+                                 *p++ = decimal_point_char ();
+                                 /* This loop terminates because we assume
+                                    that FLT_RADIX is a power of 2.  */
+                                 while (mantissa > 0.0L)
+                                   {
+                                     mantissa *= 16.0L;
+                                     digit = (int) mantissa;
+                                     mantissa -= digit;
+                                     *p++ = digit
+                                            + (digit < 10
+                                               ? '0'
+                                               : dp->conversion - 10);
+                                     if (precision > 0)
+                                       precision--;
+                                   }
+                                 while (precision > 0)
+                                   {
+                                     *p++ = '0';
+                                     precision--;
+                                   }
+                               }
+                             }
+                             *p++ = dp->conversion - 'A' + 'P';
+# if WIDE_CHAR_VERSION
+                             {
+                               static const wchar_t decimal_format[] =
+                                 { '%', '+', 'd', '\0' };
+                               SNPRINTF (p, 6 + 1, decimal_format, exponent);
+                             }
+                             while (*p != '\0')
+                               p++;
+# else
+                             if (sizeof (DCHAR_T) == 1)
+                               {
+                                 sprintf ((char *) p, "%+d", exponent);
+                                 while (*p != '\0')
+                                   p++;
+                               }
+                             else
+                               {
+                                 char expbuf[6 + 1];
+                                 const char *ep;
+                                 sprintf (expbuf, "%+d", exponent);
+                                 for (ep = expbuf; (*p = *ep) != '\0'; ep++)
+                                   p++;
+                               }
+# endif
+                         }
+
+                       END_LONG_DOUBLE_ROUNDING ();
+                     }
+                 }
+               else
+                 {
+                   double arg = a.arg[dp->arg_index].a.a_double;
+
+                   if (isnan (arg))
+                     {
+                       if (dp->conversion == 'A')
+                         {
+                           *p++ = 'N'; *p++ = 'A'; *p++ = 'N';
+                         }
+                       else
+                         {
+                           *p++ = 'n'; *p++ = 'a'; *p++ = 'n';
+                         }
+                     }
+                   else
+                     {
+                       int sign = 0;
+
+                       if (signbit (arg)) /* arg < 0.0 or negative zero */
+                         {
+                           sign = -1;
+                           arg = -arg;
+                         }
+
+                       if (sign < 0)
+                         *p++ = '-';
+                       else if (flags & FLAG_SHOWSIGN)
+                         *p++ = '+';
+                       else if (flags & FLAG_SPACE)
+                         *p++ = ' ';
+
+                       if (arg > 0.0 && arg + arg == arg)
+                         {
+                           if (dp->conversion == 'A')
+                             {
+                               *p++ = 'I'; *p++ = 'N'; *p++ = 'F';
+                             }
+                           else
+                             {
+                               *p++ = 'i'; *p++ = 'n'; *p++ = 'f';
+                             }
+                         }
+                       else
+                         {
+                           int exponent;
+                           double mantissa;
+
+                           if (arg > 0.0)
+                             mantissa = printf_frexp (arg, &exponent);
+                           else
+                             {
+                               exponent = 0;
+                               mantissa = 0.0;
+                             }
+
+                           if (has_precision
+                               && precision < (unsigned int) ((DBL_DIG + 1) * 
0.831) + 1)
+                             {
+                               /* Round the mantissa.  */
+                               double tail = mantissa;
+                               size_t q;
+
+                               for (q = precision; ; q--)
+                                 {
+                                   int digit = (int) tail;
+                                   tail -= digit;
+                                   if (q == 0)
+                                     {
+                                       if (digit & 1 ? tail >= 0.5 : tail > 
0.5)
+                                         tail = 1 - tail;
+                                       else
+                                         tail = - tail;
+                                       break;
+                                     }
+                                   tail *= 16.0;
+                                 }
+                               if (tail != 0.0)
+                                 for (q = precision; q > 0; q--)
+                                   tail *= 0.0625;
+                               mantissa += tail;
+                             }
+
+                           *p++ = '0';
+                           *p++ = dp->conversion - 'A' + 'X';
+                           pad_ptr = p;
+                           {
+                             int digit;
+
+                             digit = (int) mantissa;
+                             mantissa -= digit;
+                             *p++ = '0' + digit;
+                             if ((flags & FLAG_ALT)
+                                 || mantissa > 0.0 || precision > 0)
+                               {
+                                 *p++ = decimal_point_char ();
+                                 /* This loop terminates because we assume
+                                    that FLT_RADIX is a power of 2.  */
+                                 while (mantissa > 0.0)
+                                   {
+                                     mantissa *= 16.0;
+                                     digit = (int) mantissa;
+                                     mantissa -= digit;
+                                     *p++ = digit
+                                            + (digit < 10
+                                               ? '0'
+                                               : dp->conversion - 10);
+                                     if (precision > 0)
+                                       precision--;
+                                   }
+                                 while (precision > 0)
+                                   {
+                                     *p++ = '0';
+                                     precision--;
+                                   }
+                               }
+                             }
+                             *p++ = dp->conversion - 'A' + 'P';
+# if WIDE_CHAR_VERSION
+                             {
+                               static const wchar_t decimal_format[] =
+                                 { '%', '+', 'd', '\0' };
+                               SNPRINTF (p, 6 + 1, decimal_format, exponent);
+                             }
+                             while (*p != '\0')
+                               p++;
+# else
+                             if (sizeof (DCHAR_T) == 1)
+                               {
+                                 sprintf ((char *) p, "%+d", exponent);
+                                 while (*p != '\0')
+                                   p++;
+                               }
+                             else
+                               {
+                                 char expbuf[6 + 1];
+                                 const char *ep;
+                                 sprintf (expbuf, "%+d", exponent);
+                                 for (ep = expbuf; (*p = *ep) != '\0'; ep++)
+                                   p++;
+                               }
+# endif
+                         }
+                     }
+                 }
+               /* The generated string now extends from tmp to p, with the
+                  zero padding insertion point being at pad_ptr.  */
+               if (has_width && p - tmp < width)
+                 {
+                   size_t pad = width - (p - tmp);
+                   DCHAR_T *end = p + pad;
+
+                   if (flags & FLAG_LEFT)
+                     {
+                       /* Pad with spaces on the right.  */
+                       for (; pad > 0; pad--)
+                         *p++ = ' ';
+                     }
+                   else if ((flags & FLAG_ZERO) && pad_ptr != NULL)
+                     {
+                       /* Pad with zeroes.  */
+                       DCHAR_T *q = end;
+
+                       while (p > pad_ptr)
+                         *--q = *--p;
+                       for (; pad > 0; pad--)
+                         *p++ = '0';
+                     }
+                   else
+                     {
+                       /* Pad with spaces on the left.  */
+                       DCHAR_T *q = end;
+
+                       while (p > tmp)
+                         *--q = *--p;
+                       for (; pad > 0; pad--)
+                         *p++ = ' ';
+                     }
+
+                   p = end;
+                 }
+
+               {
+                 size_t count = p - tmp;
+
+                 if (count >= tmp_length)
+                   /* tmp_length was incorrectly calculated - fix the
+                      code above!  */
+                   abort ();
+
+                 /* Make room for the result.  */
+                 if (count >= allocated - length)
+                   {
+                     size_t n = xsum (length, count);
+
+                     ENSURE_ALLOCATION (n);
+                   }
+
+                 /* Append the result.  */
+                 memcpy (result + length, tmp, count * sizeof (DCHAR_T));
+                 if (tmp != tmpbuf)
+                   free (tmp);
+                 length += count;
+               }
+             }
+#endif
+#if (NEED_PRINTF_INFINITE_DOUBLE || NEED_PRINTF_INFINITE_LONG_DOUBLE || 
NEED_PRINTF_LONG_DOUBLE) && !defined IN_LIBINTL
+           else if ((dp->conversion == 'f' || dp->conversion == 'F'
+                     || dp->conversion == 'e' || dp->conversion == 'E'
+                     || dp->conversion == 'g' || dp->conversion == 'G'
+                     || dp->conversion == 'a' || dp->conversion == 'A')
+                    && (0
+# if NEED_PRINTF_INFINITE_DOUBLE
+                        || (a.arg[dp->arg_index].type == TYPE_DOUBLE
+                            /* The systems (mingw) which produce wrong output
+                               for Inf, -Inf, and NaN also do so for -0.0.
+                               Therefore we treat this case here as well.  */
+                            && is_infinite_or_zero 
(a.arg[dp->arg_index].a.a_double))
+# endif
+# if NEED_PRINTF_LONG_DOUBLE
+                        || a.arg[dp->arg_index].type == TYPE_LONGDOUBLE
+# elif NEED_PRINTF_INFINITE_LONG_DOUBLE
+                        || (a.arg[dp->arg_index].type == TYPE_LONGDOUBLE
+                            /* Some systems produce wrong output for Inf,
+                               -Inf, and NaN.  */
+                            && is_infinitel 
(a.arg[dp->arg_index].a.a_longdouble))
+# endif
+                       ))
+             {
+# if NEED_PRINTF_INFINITE_DOUBLE && (NEED_PRINTF_LONG_DOUBLE || 
NEED_PRINTF_INFINITE_LONG_DOUBLE)
+               arg_type type = a.arg[dp->arg_index].type;
+# endif
+               int flags = dp->flags;
+               int has_width;
+               size_t width;
+               int has_precision;
+               size_t precision;
+               size_t tmp_length;
+               DCHAR_T tmpbuf[700];
+               DCHAR_T *tmp;
+               DCHAR_T *pad_ptr;
+               DCHAR_T *p;
+
+               has_width = 0;
+               width = 0;
+               if (dp->width_start != dp->width_end)
+                 {
+                   if (dp->width_arg_index != ARG_NONE)
+                     {
+                       int arg;
+
+                       if (!(a.arg[dp->width_arg_index].type == TYPE_INT))
+                         abort ();
+                       arg = a.arg[dp->width_arg_index].a.a_int;
+                       if (arg < 0)
+                         {
+                           /* "A negative field width is taken as a '-' flag
+                               followed by a positive field width."  */
+                           flags |= FLAG_LEFT;
+                           width = (unsigned int) (-arg);
+                         }
+                       else
+                         width = arg;
+                     }
+                   else
+                     {
+                       const FCHAR_T *digitp = dp->width_start;
+
+                       do
+                         width = xsum (xtimes (width, 10), *digitp++ - '0');
+                       while (digitp != dp->width_end);
+                     }
+                   has_width = 1;
+                 }
+
+               has_precision = 0;
+               precision = 0;
+               if (dp->precision_start != dp->precision_end)
+                 {
+                   if (dp->precision_arg_index != ARG_NONE)
+                     {
+                       int arg;
+
+                       if (!(a.arg[dp->precision_arg_index].type == TYPE_INT))
+                         abort ();
+                       arg = a.arg[dp->precision_arg_index].a.a_int;
+                       /* "A negative precision is taken as if the precision
+                           were omitted."  */
+                       if (arg >= 0)
+                         {
+                           precision = arg;
+                           has_precision = 1;
+                         }
+                     }
+                   else
+                     {
+                       const FCHAR_T *digitp = dp->precision_start + 1;
+
+                       precision = 0;
+                       while (digitp != dp->precision_end)
+                         precision = xsum (xtimes (precision, 10), *digitp++ - 
'0');
+                       has_precision = 1;
+                     }
+                 }
+
+               /* POSIX specifies the default precision to be 6 for %f, %F,
+                  %e, %E, but not for %g, %G.  Implementations appear to use
+                  the same default precision also for %g, %G.  */
+               if (!has_precision)
+                 precision = 6;
+
+               /* Allocate a temporary buffer of sufficient size.  */
+# if NEED_PRINTF_INFINITE_DOUBLE && NEED_PRINTF_LONG_DOUBLE
+               tmp_length = (type == TYPE_LONGDOUBLE ? LDBL_DIG + 1 : 0);
+# elif NEED_PRINTF_LONG_DOUBLE
+               tmp_length = LDBL_DIG + 1;
+# else
+               tmp_length = 0;
+# endif
+               if (tmp_length < precision)
+                 tmp_length = precision;
+# if NEED_PRINTF_LONG_DOUBLE
+#  if NEED_PRINTF_INFINITE_DOUBLE
+               if (type == TYPE_LONGDOUBLE)
+#  endif
+                 if (dp->conversion == 'f' || dp->conversion == 'F')
+                   {
+                     long double arg = a.arg[dp->arg_index].a.a_longdouble;
+                     if (!(isnanl (arg) || arg + arg == arg))
+                       {
+                         /* arg is finite and nonzero.  */
+                         int exponent = floorlog10l (arg < 0 ? -arg : arg);
+                         if (exponent >= 0 && tmp_length < exponent + 
precision)
+                           tmp_length = exponent + precision;
+                       }
+                   }
+# endif
+               /* Account for sign, decimal point etc. */
+               tmp_length = xsum (tmp_length, 12);
+
+               if (tmp_length < width)
+                 tmp_length = width;
+
+               tmp_length = xsum (tmp_length, 1); /* account for trailing NUL 
*/
+
+               if (tmp_length <= sizeof (tmpbuf) / sizeof (DCHAR_T))
+                 tmp = tmpbuf;
+               else
+                 {
+                   size_t tmp_memsize = xtimes (tmp_length, sizeof (DCHAR_T));
+
+                   if (size_overflow_p (tmp_memsize))
+                     /* Overflow, would lead to out of memory.  */
+                     goto out_of_memory;
+                   tmp = (DCHAR_T *) malloc (tmp_memsize);
+                   if (tmp == NULL)
+                     /* Out of memory.  */
+                     goto out_of_memory;
+                 }
+
+               pad_ptr = NULL;
+               p = tmp;
+
+# if NEED_PRINTF_LONG_DOUBLE || NEED_PRINTF_INFINITE_LONG_DOUBLE
+#  if NEED_PRINTF_INFINITE_DOUBLE
+               if (type == TYPE_LONGDOUBLE)
+#  endif
+                 {
+                   long double arg = a.arg[dp->arg_index].a.a_longdouble;
+
+                   if (isnanl (arg))
+                     {
+                       if (dp->conversion >= 'A' && dp->conversion <= 'Z')
+                         {
+                           *p++ = 'N'; *p++ = 'A'; *p++ = 'N';
+                         }
+                       else
+                         {
+                           *p++ = 'n'; *p++ = 'a'; *p++ = 'n';
+                         }
+                     }
+                   else
+                     {
+                       int sign = 0;
+                       DECL_LONG_DOUBLE_ROUNDING
+
+                       BEGIN_LONG_DOUBLE_ROUNDING ();
+
+                       if (signbit (arg)) /* arg < 0.0L or negative zero */
+                         {
+                           sign = -1;
+                           arg = -arg;
+                         }
+
+                       if (sign < 0)
+                         *p++ = '-';
+                       else if (flags & FLAG_SHOWSIGN)
+                         *p++ = '+';
+                       else if (flags & FLAG_SPACE)
+                         *p++ = ' ';
+
+                       if (arg > 0.0L && arg + arg == arg)
+                         {
+                           if (dp->conversion >= 'A' && dp->conversion <= 'Z')
+                             {
+                               *p++ = 'I'; *p++ = 'N'; *p++ = 'F';
+                             }
+                           else
+                             {
+                               *p++ = 'i'; *p++ = 'n'; *p++ = 'f';
+                             }
+                         }
+                       else
+                         {
+#  if NEED_PRINTF_LONG_DOUBLE
+                           pad_ptr = p;
+
+                           if (dp->conversion == 'f' || dp->conversion == 'F')
+                             {
+                               char *digits;
+                               size_t ndigits;
+
+                               digits =
+                                 scale10_round_decimal_long_double (arg, 
precision);
+                               if (digits == NULL)
+                                 {
+                                   END_LONG_DOUBLE_ROUNDING ();
+                                   goto out_of_memory;
+                                 }
+                               ndigits = strlen (digits);
+
+                               if (ndigits > precision)
+                                 do
+                                   {
+                                     --ndigits;
+                                     *p++ = digits[ndigits];
+                                   }
+                                 while (ndigits > precision);
+                               else
+                                 *p++ = '0';
+                               /* Here ndigits <= precision.  */
+                               if ((flags & FLAG_ALT) || precision > 0)
+                                 {
+                                   *p++ = decimal_point_char ();
+                                   for (; precision > ndigits; precision--)
+                                     *p++ = '0';
+                                   while (ndigits > 0)
+                                     {
+                                       --ndigits;
+                                       *p++ = digits[ndigits];
+                                     }
+                                 }
+
+                               free (digits);
+                             }
+                           else if (dp->conversion == 'e' || dp->conversion == 
'E')
+                             {
+                               int exponent;
+
+                               if (arg == 0.0L)
+                                 {
+                                   exponent = 0;
+                                   *p++ = '0';
+                                   if ((flags & FLAG_ALT) || precision > 0)
+                                     {
+                                       *p++ = decimal_point_char ();
+                                       for (; precision > 0; precision--)
+                                         *p++ = '0';
+                                     }
+                                 }
+                               else
+                                 {
+                                   /* arg > 0.0L.  */
+                                   int adjusted;
+                                   char *digits;
+                                   size_t ndigits;
+
+                                   exponent = floorlog10l (arg);
+                                   adjusted = 0;
+                                   for (;;)
+                                     {
+                                       digits =
+                                         scale10_round_decimal_long_double 
(arg,
+                                                                            
(int)precision - exponent);
+                                       if (digits == NULL)
+                                         {
+                                           END_LONG_DOUBLE_ROUNDING ();
+                                           goto out_of_memory;
+                                         }
+                                       ndigits = strlen (digits);
+
+                                       if (ndigits == precision + 1)
+                                         break;
+                                       if (ndigits < precision
+                                           || ndigits > precision + 2)
+                                         /* The exponent was not guessed
+                                            precisely enough.  */
+                                         abort ();
+                                       if (adjusted)
+                                         /* None of two values of exponent is
+                                            the right one.  Prevent an endless
+                                            loop.  */
+                                         abort ();
+                                       free (digits);
+                                       if (ndigits == precision)
+                                         exponent -= 1;
+                                       else
+                                         exponent += 1;
+                                       adjusted = 1;
+                                     }
+
+                                   /* Here ndigits = precision+1.  */
+                                   *p++ = digits[--ndigits];
+                                   if ((flags & FLAG_ALT) || precision > 0)
+                                     {
+                                       *p++ = decimal_point_char ();
+                                       while (ndigits > 0)
+                                         {
+                                           --ndigits;
+                                           *p++ = digits[ndigits];
+                                         }
+                                     }
+
+                                   free (digits);
+                                 }
+
+                               *p++ = dp->conversion; /* 'e' or 'E' */
+#   if WIDE_CHAR_VERSION
+                               {
+                                 static const wchar_t decimal_format[] =
+                                   { '%', '+', '.', '2', 'd', '\0' };
+                                 SNPRINTF (p, 6 + 1, decimal_format, exponent);
+                               }
+                               while (*p != '\0')
+                                 p++;
+#   else
+                               if (sizeof (DCHAR_T) == 1)
+                                 {
+                                   sprintf ((char *) p, "%+.2d", exponent);
+                                   while (*p != '\0')
+                                     p++;
+                                 }
+                               else
+                                 {
+                                   char expbuf[6 + 1];
+                                   const char *ep;
+                                   sprintf (expbuf, "%+.2d", exponent);
+                                   for (ep = expbuf; (*p = *ep) != '\0'; ep++)
+                                     p++;
+                                 }
+#   endif
+                             }
+                           else if (dp->conversion == 'g' || dp->conversion == 
'G')
+                             {
+                               if (precision == 0)
+                                 precision = 1;
+                               /* precision >= 1.  */
+
+                               if (arg == 0.0L)
+                                 /* The exponent is 0, >= -4, < precision.
+                                    Use fixed-point notation.  */
+                                 {
+                                   size_t ndigits = precision;
+                                   /* Number of trailing zeroes that have to be
+                                      dropped.  */
+                                   size_t nzeroes =
+                                     (flags & FLAG_ALT ? 0 : precision - 1);
+
+                                   --ndigits;
+                                   *p++ = '0';
+                                   if ((flags & FLAG_ALT) || ndigits > nzeroes)
+                                     {
+                                       *p++ = decimal_point_char ();
+                                       while (ndigits > nzeroes)
+                                         {
+                                           --ndigits;
+                                           *p++ = '0';
+                                         }
+                                     }
+                                 }
+                               else
+                                 {
+                                   /* arg > 0.0L.  */
+                                   int exponent;
+                                   int adjusted;
+                                   char *digits;
+                                   size_t ndigits;
+                                   size_t nzeroes;
+
+                                   exponent = floorlog10l (arg);
+                                   adjusted = 0;
+                                   for (;;)
+                                     {
+                                       digits =
+                                         scale10_round_decimal_long_double 
(arg,
+                                                                            
(int)(precision - 1) - exponent);
+                                       if (digits == NULL)
+                                         {
+                                           END_LONG_DOUBLE_ROUNDING ();
+                                           goto out_of_memory;
+                                         }
+                                       ndigits = strlen (digits);
+
+                                       if (ndigits == precision)
+                                         break;
+                                       if (ndigits < precision - 1
+                                           || ndigits > precision + 1)
+                                         /* The exponent was not guessed
+                                            precisely enough.  */
+                                         abort ();
+                                       if (adjusted)
+                                         /* None of two values of exponent is
+                                            the right one.  Prevent an endless
+                                            loop.  */
+                                         abort ();
+                                       free (digits);
+                                       if (ndigits < precision)
+                                         exponent -= 1;
+                                       else
+                                         exponent += 1;
+                                       adjusted = 1;
+                                     }
+                                   /* Here ndigits = precision.  */
+
+                                   /* Determine the number of trailing zeroes
+                                      that have to be dropped.  */
+                                   nzeroes = 0;
+                                   if ((flags & FLAG_ALT) == 0)
+                                     while (nzeroes < ndigits
+                                            && digits[nzeroes] == '0')
+                                       nzeroes++;
+
+                                   /* The exponent is now determined.  */
+                                   if (exponent >= -4
+                                       && exponent < (long)precision)
+                                     {
+                                       /* Fixed-point notation:
+                                          max(exponent,0)+1 digits, then the
+                                          decimal point, then the remaining
+                                          digits without trailing zeroes.  */
+                                       if (exponent >= 0)
+                                         {
+                                           size_t count = exponent + 1;
+                                           /* Note: count <= precision = 
ndigits.  */
+                                           for (; count > 0; count--)
+                                             *p++ = digits[--ndigits];
+                                           if ((flags & FLAG_ALT) || ndigits > 
nzeroes)
+                                             {
+                                               *p++ = decimal_point_char ();
+                                               while (ndigits > nzeroes)
+                                                 {
+                                                   --ndigits;
+                                                   *p++ = digits[ndigits];
+                                                 }
+                                             }
+                                         }
+                                       else
+                                         {
+                                           size_t count = -exponent - 1;
+                                           *p++ = '0';
+                                           *p++ = decimal_point_char ();
+                                           for (; count > 0; count--)
+                                             *p++ = '0';
+                                           while (ndigits > nzeroes)
+                                             {
+                                               --ndigits;
+                                               *p++ = digits[ndigits];
+                                             }
+                                         }
+                                     }
+                                   else
+                                     {
+                                       /* Exponential notation.  */
+                                       *p++ = digits[--ndigits];
+                                       if ((flags & FLAG_ALT) || ndigits > 
nzeroes)
+                                         {
+                                           *p++ = decimal_point_char ();
+                                           while (ndigits > nzeroes)
+                                             {
+                                               --ndigits;
+                                               *p++ = digits[ndigits];
+                                             }
+                                         }
+                                       *p++ = dp->conversion - 'G' + 'E'; /* 
'e' or 'E' */
+#   if WIDE_CHAR_VERSION
+                                       {
+                                         static const wchar_t decimal_format[] 
=
+                                           { '%', '+', '.', '2', 'd', '\0' };
+                                         SNPRINTF (p, 6 + 1, decimal_format, 
exponent);
+                                       }
+                                       while (*p != '\0')
+                                         p++;
+#   else
+                                       if (sizeof (DCHAR_T) == 1)
+                                         {
+                                           sprintf ((char *) p, "%+.2d", 
exponent);
+                                           while (*p != '\0')
+                                             p++;
+                                         }
+                                       else
+                                         {
+                                           char expbuf[6 + 1];
+                                           const char *ep;
+                                           sprintf (expbuf, "%+.2d", exponent);
+                                           for (ep = expbuf; (*p = *ep) != 
'\0'; ep++)
+                                             p++;
+                                         }
+#   endif
+                                     }
+
+                                   free (digits);
+                                 }
+                             }
+                           else
+                             abort ();
+#  else
+                           /* arg is finite.  */
+                           abort ();
+#  endif
+                         }
+
+                       END_LONG_DOUBLE_ROUNDING ();
+                     }
+                 }
+#  if NEED_PRINTF_INFINITE_DOUBLE
+               else
+#  endif
+# endif
+# if NEED_PRINTF_INFINITE_DOUBLE
+                 {
+                   /* Simpler than above: handle only NaN, Infinity, zero.  */
+                   double arg = a.arg[dp->arg_index].a.a_double;
+
+                   if (isnan (arg))
+                     {
+                       if (dp->conversion >= 'A' && dp->conversion <= 'Z')
+                         {
+                           *p++ = 'N'; *p++ = 'A'; *p++ = 'N';
+                         }
+                       else
+                         {
+                           *p++ = 'n'; *p++ = 'a'; *p++ = 'n';
+                         }
+                     }
+                   else
+                     {
+                       int sign = 0;
+
+                       if (signbit (arg)) /* arg < 0.0L or negative zero */
+                         {
+                           sign = -1;
+                           arg = -arg;
+                         }
+
+                       if (sign < 0)
+                         *p++ = '-';
+                       else if (flags & FLAG_SHOWSIGN)
+                         *p++ = '+';
+                       else if (flags & FLAG_SPACE)
+                         *p++ = ' ';
+
+                       if (arg > 0.0 && arg + arg == arg)
+                         {
+                           if (dp->conversion >= 'A' && dp->conversion <= 'Z')
+                             {
+                               *p++ = 'I'; *p++ = 'N'; *p++ = 'F';
+                             }
+                           else
+                             {
+                               *p++ = 'i'; *p++ = 'n'; *p++ = 'f';
+                             }
+                         }
+                       else
+                         {
+                           if (!(arg == 0.0))
+                             abort ();
+
+                           pad_ptr = p;
+
+                           if (dp->conversion == 'f' || dp->conversion == 'F')
+                             {
+                               *p++ = '0';
+                               if ((flags & FLAG_ALT) || precision > 0)
+                                 {
+                                   *p++ = decimal_point_char ();
+                                   for (; precision > 0; precision--)
+                                     *p++ = '0';
+                                 }
+                             }
+                           else if (dp->conversion == 'e' || dp->conversion == 
'E')
+                             {
+                               *p++ = '0';
+                               if ((flags & FLAG_ALT) || precision > 0)
+                                 {
+                                   *p++ = decimal_point_char ();
+                                   for (; precision > 0; precision--)
+                                     *p++ = '0';
+                                 }
+                               *p++ = dp->conversion; /* 'e' or 'E' */
+                               *p++ = '+';
+                               /* Produce the same number of exponent digits as
+                                  the native printf implementation.  */
+#  if (defined _WIN32 || defined __WIN32__) && ! defined __CYGWIN__
+                               *p++ = '0';
+#  endif
+                               *p++ = '0';
+                               *p++ = '0';
+                             }
+                           else if (dp->conversion == 'g' || dp->conversion == 
'G')
       {
-       if (cp != dp->dir_start)
+                               *p++ = '0';
+                               if (flags & FLAG_ALT)
          {
-           size_t n = dp->dir_start - cp;
-           size_t augmented_length = xsum (length, n);
-
-           ENSURE_ALLOCATION (augmented_length);
-           memcpy (result + length, cp, n * sizeof (CHAR_T));
-           length = augmented_length;
+                                   size_t ndigits =
+                                     (precision > 0 ? precision - 1 : 0);
+                                   *p++ = decimal_point_char ();
+                                   for (; ndigits > 0; --ndigits)
+                                     *p++ = '0';
          }
-       if (i == d.count)
-         break;
+                             }
+                           else
+                             abort ();
+                         }
+                     }
+                 }
+# endif
 
-       /* Execute a single directive.  */
-       if (dp->conversion == '%')
+               /* The generated string now extends from tmp to p, with the
+                  zero padding insertion point being at pad_ptr.  */
+               if (has_width && p - tmp < width)
          {
-           size_t augmented_length;
+                   size_t pad = width - (p - tmp);
+                   DCHAR_T *end = p + pad;
 
-           if (!(dp->arg_index == ARG_NONE))
-             abort ();
-           augmented_length = xsum (length, 1);
-           ENSURE_ALLOCATION (augmented_length);
-           result[length] = '%';
-           length = augmented_length;
+                   if (flags & FLAG_LEFT)
+                     {
+                       /* Pad with spaces on the right.  */
+                       for (; pad > 0; pad--)
+                         *p++ = ' ';
          }
-       else
+                   else if ((flags & FLAG_ZERO) && pad_ptr != NULL)
          {
-           if (!(dp->arg_index != ARG_NONE))
-             abort ();
+                       /* Pad with zeroes.  */
+                       DCHAR_T *q = end;
 
-           if (dp->conversion == 'n')
+                       while (p > pad_ptr)
+                         *--q = *--p;
+                       for (; pad > 0; pad--)
+                         *p++ = '0';
+                     }
+                   else
              {
-               switch (a.arg[dp->arg_index].type)
+                       /* Pad with spaces on the left.  */
+                       DCHAR_T *q = end;
+
+                       while (p > tmp)
+                         *--q = *--p;
+                       for (; pad > 0; pad--)
+                         *p++ = ' ';
+                     }
+
+                   p = end;
+                 }
+
                  {
-                 case TYPE_COUNT_SCHAR_POINTER:
-                   *a.arg[dp->arg_index].a.a_count_schar_pointer = length;
-                   break;
-                 case TYPE_COUNT_SHORT_POINTER:
-                   *a.arg[dp->arg_index].a.a_count_short_pointer = length;
-                   break;
-                 case TYPE_COUNT_INT_POINTER:
-                   *a.arg[dp->arg_index].a.a_count_int_pointer = length;
-                   break;
-                 case TYPE_COUNT_LONGINT_POINTER:
-                   *a.arg[dp->arg_index].a.a_count_longint_pointer = length;
-                   break;
-#ifdef HAVE_LONG_LONG
-                 case TYPE_COUNT_LONGLONGINT_POINTER:
-                   *a.arg[dp->arg_index].a.a_count_longlongint_pointer = 
length;
-                   break;
-#endif
-                 default:
+                 size_t count = p - tmp;
+
+                 if (count >= tmp_length)
+                   /* tmp_length was incorrectly calculated - fix the
+                      code above!  */
                    abort ();
+
+                 /* Make room for the result.  */
+                 if (count >= allocated - length)
+                   {
+                     size_t n = xsum (length, count);
+
+                     ENSURE_ALLOCATION (n);
+                   }
+
+                 /* Append the result.  */
+                 memcpy (result + length, tmp, count * sizeof (DCHAR_T));
+                 if (tmp != tmpbuf)
+                   free (tmp);
+                 length += count;
                  }
              }
+#endif
            else
              {
                arg_type type = a.arg[dp->arg_index].type;
-               CHAR_T *p;
+               int flags = dp->flags;
+#if !USE_SNPRINTF || !DCHAR_IS_TCHAR || ENABLE_UNISTDIO || 
NEED_PRINTF_FLAG_ZERO
+               int has_width;
+               size_t width;
+#endif
+#if !DCHAR_IS_TCHAR || ENABLE_UNISTDIO || NEED_PRINTF_FLAG_ZERO
+               int pad_ourselves;
+#else
+#              define pad_ourselves 0
+#endif
+               TCHAR_T *fbp;
                unsigned int prefix_count;
                int prefixes[2];
 #if !USE_SNPRINTF
                size_t tmp_length;
-               CHAR_T tmpbuf[700];
-               CHAR_T *tmp;
-
-               /* Allocate a temporary buffer of sufficient size for calling
-                  sprintf.  */
-               {
-                 size_t width;
-                 size_t precision;
+               TCHAR_T tmpbuf[700];
+               TCHAR_T *tmp;
+#endif
 
+#if !USE_SNPRINTF || !DCHAR_IS_TCHAR || ENABLE_UNISTDIO || 
NEED_PRINTF_FLAG_ZERO
+               has_width = 0;
                  width = 0;
                  if (dp->width_start != dp->width_end)
                    {
@@ -284,17 +3008,33 @@
                          if (!(a.arg[dp->width_arg_index].type == TYPE_INT))
                            abort ();
                          arg = a.arg[dp->width_arg_index].a.a_int;
-                         width = (arg < 0 ? (unsigned int) (-arg) : arg);
+                       if (arg < 0)
+                         {
+                           /* "A negative field width is taken as a '-' flag
+                               followed by a positive field width."  */
+                           flags |= FLAG_LEFT;
+                           width = (unsigned int) (-arg);
+                         }
+                       else
+                         width = arg;
                        }
                      else
                        {
-                         const CHAR_T *digitp = dp->width_start;
+                       const FCHAR_T *digitp = dp->width_start;
 
                          do
                            width = xsum (xtimes (width, 10), *digitp++ - '0');
                          while (digitp != dp->width_end);
                        }
+                   has_width = 1;
                    }
+#endif
+
+#if !USE_SNPRINTF
+               /* Allocate a temporary buffer of sufficient size for calling
+                  sprintf.  */
+               {
+                 size_t precision;
 
                  precision = 6;
                  if (dp->precision_start != dp->precision_end)
@@ -310,7 +3050,7 @@
                        }
                      else
                        {
-                         const CHAR_T *digitp = dp->precision_start + 1;
+                         const FCHAR_T *digitp = dp->precision_start + 1;
 
                          precision = 0;
                          while (digitp != dp->precision_end)
@@ -322,7 +3062,7 @@
                    {
 
                    case 'd': case 'i': case 'u':
-# ifdef HAVE_LONG_LONG
+# if HAVE_LONG_LONG_INT
                      if (type == TYPE_LONGLONGINT || type == TYPE_ULONGLONGINT)
                        tmp_length =
                          (unsigned int) (sizeof (unsigned long long) * CHAR_BIT
@@ -352,7 +3092,7 @@
                      break;
 
                    case 'o':
-# ifdef HAVE_LONG_LONG
+# if HAVE_LONG_LONG_INT
                      if (type == TYPE_LONGLONGINT || type == TYPE_ULONGLONGINT)
                        tmp_length =
                          (unsigned int) (sizeof (unsigned long long) * CHAR_BIT
@@ -380,7 +3120,7 @@
                      break;
 
                    case 'x': case 'X':
-# ifdef HAVE_LONG_LONG
+# if HAVE_LONG_LONG_INT
                      if (type == TYPE_LONGLONGINT || type == TYPE_ULONGLONGINT)
                        tmp_length =
                          (unsigned int) (sizeof (unsigned long long) * CHAR_BIT
@@ -408,7 +3148,6 @@
                      break;
 
                    case 'f': case 'F':
-# ifdef HAVE_LONG_DOUBLE
                      if (type == TYPE_LONGDOUBLE)
                        tmp_length =
                          (unsigned int) (LDBL_MAX_EXP
@@ -418,7 +3157,6 @@
                          + 1 /* turn floor into ceil */
                          + 10; /* sign, decimal point etc. */
                      else
-# endif
                        tmp_length =
                          (unsigned int) (DBL_MAX_EXP
                                          * 0.30103 /* binary -> decimal */
@@ -430,14 +3168,32 @@
                      break;
 
                    case 'e': case 'E': case 'g': case 'G':
-                   case 'a': case 'A':
                      tmp_length =
                        12; /* sign, decimal point, exponent etc. */
                      tmp_length = xsum (tmp_length, precision);
                      break;
 
+                   case 'a': case 'A':
+                     if (type == TYPE_LONGDOUBLE)
+                       tmp_length =
+                         (unsigned int) (LDBL_DIG
+                                         * 0.831 /* decimal -> hexadecimal */
+                                        )
+                         + 1; /* turn floor into ceil */
+                     else
+                       tmp_length =
+                         (unsigned int) (DBL_DIG
+                                         * 0.831 /* decimal -> hexadecimal */
+                                        )
+                         + 1; /* turn floor into ceil */
+                     if (tmp_length < precision)
+                       tmp_length = precision;
+                     /* Account for sign, decimal point etc. */
+                     tmp_length = xsum (tmp_length, 12);
+                     break;
+
                    case 'c':
-# if defined HAVE_WINT_T && !WIDE_CHAR_VERSION
+# if HAVE_WINT_T && !WIDE_CHAR_VERSION
                      if (type == TYPE_WIDE_CHAR)
                        tmp_length = MB_CUR_MAX;
                      else
@@ -446,7 +3202,7 @@
                      break;
 
                    case 's':
-# ifdef HAVE_WCHAR_T
+# if HAVE_WCHAR_T
                      if (type == TYPE_WIDE_STRING)
                        {
                          tmp_length =
@@ -474,95 +3230,171 @@
                      abort ();
                    }
 
+# if ENABLE_UNISTDIO
+                 /* Padding considers the number of characters, therefore the
+                    number of elements after padding may be
+                      > max (tmp_length, width)
+                    but is certainly
+                      <= tmp_length + width.  */
+                 tmp_length = xsum (tmp_length, width);
+# else
+                 /* Padding considers the number of elements, says POSIX.  */
                  if (tmp_length < width)
                    tmp_length = width;
+# endif
 
                  tmp_length = xsum (tmp_length, 1); /* account for trailing 
NUL */
                }
 
-               if (tmp_length <= sizeof (tmpbuf) / sizeof (CHAR_T))
+               if (tmp_length <= sizeof (tmpbuf) / sizeof (TCHAR_T))
                  tmp = tmpbuf;
                else
                  {
-                   size_t tmp_memsize = xtimes (tmp_length, sizeof (CHAR_T));
+                   size_t tmp_memsize = xtimes (tmp_length, sizeof (TCHAR_T));
 
                    if (size_overflow_p (tmp_memsize))
                      /* Overflow, would lead to out of memory.  */
                      goto out_of_memory;
-                   tmp = (CHAR_T *) malloc (tmp_memsize);
+                   tmp = (TCHAR_T *) malloc (tmp_memsize);
                    if (tmp == NULL)
                      /* Out of memory.  */
                      goto out_of_memory;
                  }
 #endif
 
+               /* Decide whether to perform the padding ourselves.  */
+#if !DCHAR_IS_TCHAR || ENABLE_UNISTDIO || NEED_PRINTF_FLAG_ZERO
+               switch (dp->conversion)
+                 {
+# if !DCHAR_IS_TCHAR || ENABLE_UNISTDIO
+                 /* If we need conversion from TCHAR_T[] to DCHAR_T[], we need
+                    to perform the padding after this conversion.  Functions
+                    with unistdio extensions perform the padding based on
+                    character count rather than element count.  */
+                 case 'c': case 's':
+# endif
+# if NEED_PRINTF_FLAG_ZERO
+                 case 'f': case 'F': case 'e': case 'E': case 'g': case 'G':
+                 case 'a': case 'A':
+# endif
+                   pad_ourselves = 1;
+                   break;
+                 default:
+                   pad_ourselves = 0;
+                   break;
+                 }
+#endif
+
                /* Construct the format string for calling snprintf or
                   sprintf.  */
-               p = buf;
-               *p++ = '%';
-               if (dp->flags & FLAG_GROUP)
-                 *p++ = '\'';
-               if (dp->flags & FLAG_LEFT)
-                 *p++ = '-';
-               if (dp->flags & FLAG_SHOWSIGN)
-                 *p++ = '+';
-               if (dp->flags & FLAG_SPACE)
-                 *p++ = ' ';
-               if (dp->flags & FLAG_ALT)
-                 *p++ = '#';
-               if (dp->flags & FLAG_ZERO)
-                 *p++ = '0';
+               fbp = buf;
+               *fbp++ = '%';
+#if NEED_PRINTF_FLAG_GROUPING
+               /* The underlying implementation doesn't support the ' flag.
+                  Produce no grouping characters in this case; this is
+                  acceptable because the grouping is locale dependent.  */
+#else
+               if (flags & FLAG_GROUP)
+                 *fbp++ = '\'';
+#endif
+               if (flags & FLAG_LEFT)
+                 *fbp++ = '-';
+               if (flags & FLAG_SHOWSIGN)
+                 *fbp++ = '+';
+               if (flags & FLAG_SPACE)
+                 *fbp++ = ' ';
+               if (flags & FLAG_ALT)
+                 *fbp++ = '#';
+               if (!pad_ourselves)
+                 {
+                   if (flags & FLAG_ZERO)
+                     *fbp++ = '0';
                if (dp->width_start != dp->width_end)
                  {
                    size_t n = dp->width_end - dp->width_start;
-                   memcpy (p, dp->width_start, n * sizeof (CHAR_T));
-                   p += n;
+                       /* The width specification is known to consist only
+                          of standard ASCII characters.  */
+                       if (sizeof (FCHAR_T) == sizeof (TCHAR_T))
+                         {
+                           memcpy (fbp, dp->width_start, n * sizeof (TCHAR_T));
+                           fbp += n;
+                         }
+                       else
+                         {
+                           const FCHAR_T *mp = dp->width_start;
+                           do
+                             *fbp++ = (unsigned char) *mp++;
+                           while (--n > 0);
+                         }
+                     }
                  }
                if (dp->precision_start != dp->precision_end)
                  {
                    size_t n = dp->precision_end - dp->precision_start;
-                   memcpy (p, dp->precision_start, n * sizeof (CHAR_T));
-                   p += n;
+                   /* The precision specification is known to consist only
+                      of standard ASCII characters.  */
+                   if (sizeof (FCHAR_T) == sizeof (TCHAR_T))
+                     {
+                       memcpy (fbp, dp->precision_start, n * sizeof (TCHAR_T));
+                       fbp += n;
+                     }
+                   else
+                     {
+                       const FCHAR_T *mp = dp->precision_start;
+                       do
+                         *fbp++ = (unsigned char) *mp++;
+                       while (--n > 0);
+                     }
                  }
 
                switch (type)
                  {
-#ifdef HAVE_LONG_LONG
+#if HAVE_LONG_LONG_INT
                  case TYPE_LONGLONGINT:
                  case TYPE_ULONGLONGINT:
-                   *p++ = 'l';
+# if (defined _WIN32 || defined __WIN32__) && ! defined __CYGWIN__
+                   *fbp++ = 'I';
+                   *fbp++ = '6';
+                   *fbp++ = '4';
+                   break;
+# else
+                   *fbp++ = 'l';
                    /*FALLTHROUGH*/
+# endif
 #endif
                  case TYPE_LONGINT:
                  case TYPE_ULONGINT:
-#ifdef HAVE_WINT_T
+#if HAVE_WINT_T
                  case TYPE_WIDE_CHAR:
 #endif
-#ifdef HAVE_WCHAR_T
+#if HAVE_WCHAR_T
                  case TYPE_WIDE_STRING:
 #endif
-                   *p++ = 'l';
+                   *fbp++ = 'l';
                    break;
-#ifdef HAVE_LONG_DOUBLE
                  case TYPE_LONGDOUBLE:
-                   *p++ = 'L';
+                   *fbp++ = 'L';
                    break;
-#endif
                  default:
                    break;
                  }
-               *p = dp->conversion;
+#if NEED_PRINTF_DIRECTIVE_F
+               if (dp->conversion == 'F')
+                 *fbp = 'f';
+               else
+#endif
+                 *fbp = dp->conversion;
 #if USE_SNPRINTF
-               p[1] = '%';
-               p[2] = 'n';
-               p[3] = '\0';
+               fbp[1] = '%';
+               fbp[2] = 'n';
+               fbp[3] = '\0';
 #else
-               p[1] = '\0';
+               fbp[1] = '\0';
 #endif
 
                /* Construct the arguments for calling snprintf or sprintf.  */
                prefix_count = 0;
-               if (dp->width_arg_index != ARG_NONE)
+               if (!pad_ourselves && dp->width_arg_index != ARG_NONE)
                  {
                    if (!(a.arg[dp->width_arg_index].type == TYPE_INT))
                      abort ();
@@ -576,36 +3408,46 @@
                  }
 
 #if USE_SNPRINTF
+               /* The SNPRINTF result is appended after result[0..length].
+                  The latter is an array of DCHAR_T; SNPRINTF appends an
+                  array of TCHAR_T to it.  This is possible because
+                  sizeof (TCHAR_T) divides sizeof (DCHAR_T) and
+                  alignof (TCHAR_T) <= alignof (DCHAR_T).  */
+# define TCHARS_PER_DCHAR (sizeof (DCHAR_T) / sizeof (TCHAR_T))
                /* Prepare checking whether snprintf returns the count
                   via %n.  */
                ENSURE_ALLOCATION (xsum (length, 1));
-               result[length] = '\0';
+               *(TCHAR_T *) (result + length) = '\0';
 #endif
 
                for (;;)
                  {
-                   size_t maxlen;
-                   int count;
-                   int retcount;
-
-                   maxlen = allocated - length;
-                   count = -1;
-                   retcount = 0;
+                   int count = -1;
 
 #if USE_SNPRINTF
+                   int retcount = 0;
+                   size_t maxlen = allocated - length;
+                   /* SNPRINTF can fail if its second argument is
+                      > INT_MAX.  */
+                   if (maxlen > INT_MAX / TCHARS_PER_DCHAR)
+                     goto overflow;
+                   maxlen = maxlen * TCHARS_PER_DCHAR;
 # define SNPRINTF_BUF(arg) \
                    switch (prefix_count)                                   \
                      {                                                     \
                      case 0:                                               \
-                       retcount = SNPRINTF (result + length, maxlen, buf,  \
+                       retcount = SNPRINTF ((TCHAR_T *) (result + length), \
+                                            maxlen, buf,                   \
                                             arg, &count);                  \
                        break;                                              \
                      case 1:                                               \
-                       retcount = SNPRINTF (result + length, maxlen, buf,  \
+                       retcount = SNPRINTF ((TCHAR_T *) (result + length), \
+                                            maxlen, buf,                   \
                                             prefixes[0], arg, &count);     \
                        break;                                              \
                      case 2:                                               \
-                       retcount = SNPRINTF (result + length, maxlen, buf,  \
+                       retcount = SNPRINTF ((TCHAR_T *) (result + length), \
+                                            maxlen, buf,                   \
                                             prefixes[0], prefixes[1], arg, \
                                             &count);                       \
                        break;                                              \
@@ -681,7 +3523,7 @@
                          SNPRINTF_BUF (arg);
                        }
                        break;
-#ifdef HAVE_LONG_LONG
+#if HAVE_LONG_LONG_INT
                      case TYPE_LONGLONGINT:
                        {
                          long long int arg = 
a.arg[dp->arg_index].a.a_longlongint;
@@ -701,21 +3543,19 @@
                          SNPRINTF_BUF (arg);
                        }
                        break;
-#ifdef HAVE_LONG_DOUBLE
                      case TYPE_LONGDOUBLE:
                        {
                          long double arg = a.arg[dp->arg_index].a.a_longdouble;
                          SNPRINTF_BUF (arg);
                        }
                        break;
-#endif
                      case TYPE_CHAR:
                        {
                          int arg = a.arg[dp->arg_index].a.a_char;
                          SNPRINTF_BUF (arg);
                        }
                        break;
-#ifdef HAVE_WINT_T
+#if HAVE_WINT_T
                      case TYPE_WIDE_CHAR:
                        {
                          wint_t arg = a.arg[dp->arg_index].a.a_wide_char;
@@ -729,7 +3569,7 @@
                          SNPRINTF_BUF (arg);
                        }
                        break;
-#ifdef HAVE_WCHAR_T
+#if HAVE_WCHAR_T
                      case TYPE_WIDE_STRING:
                        {
                          const wchar_t *arg = 
a.arg[dp->arg_index].a.a_wide_string;
@@ -756,7 +3596,8 @@
                      {
                        /* Verify that snprintf() has NUL-terminated its
                           result.  */
-                       if (count < maxlen && result[length + count] != '\0')
+                       if (count < maxlen
+                           && ((TCHAR_T *) (result + length)) [count] != '\0')
                          abort ();
                        /* Portability hack.  */
                        if (retcount > count)
@@ -766,11 +3607,11 @@
                      {
                        /* snprintf() doesn't understand the '%n'
                           directive.  */
-                       if (p[1] != '\0')
+                       if (fbp[1] != '\0')
                          {
                            /* Don't use the '%n' directive; instead, look
                               at the snprintf() return value.  */
-                           p[1] = '\0';
+                           fbp[1] = '\0';
                            continue;
                          }
                        else
@@ -806,37 +3647,261 @@
                        return NULL;
                      }
 
-#if !USE_SNPRINTF
+#if USE_SNPRINTF
+                   /* Handle overflow of the allocated buffer.  */
+                   if (count >= maxlen)
+                     {
+                       /* Need at least count * sizeof (TCHAR_T) bytes.  But
+                          allocate proportionally, to avoid looping eternally
+                          if snprintf() reports a too small count.  */
+                       size_t n =
+                         xmax (xsum (length,
+                                     (count + TCHARS_PER_DCHAR - 1)
+                                     / TCHARS_PER_DCHAR),
+                               xtimes (allocated, 2));
+
+                       ENSURE_ALLOCATION (n);
+                       continue;
+                     }
+#endif
+
+#if !DCHAR_IS_TCHAR
+# if !USE_SNPRINTF
                    if (count >= tmp_length)
                      /* tmp_length was incorrectly calculated - fix the
                         code above!  */
                      abort ();
+# endif
+
+                   /* Convert from TCHAR_T[] to DCHAR_T[].  */
+                   if (dp->conversion == 'c' || dp->conversion == 's')
+                     {
+                       /* type = TYPE_CHAR or TYPE_WIDE_CHAR or TYPE_STRING
+                          TYPE_WIDE_STRING.
+                          The result string is not certainly ASCII.  */
+                       const TCHAR_T *tmpsrc;
+                       DCHAR_T *tmpdst;
+                       size_t tmpdst_len;
+                       /* This code assumes that TCHAR_T is 'char'.  */
+                       typedef int TCHAR_T_verify
+                                   [2 * (sizeof (TCHAR_T) == 1) - 1];
+# if USE_SNPRINTF
+                       tmpsrc = (TCHAR_T *) (result + length);
+# else
+                       tmpsrc = tmp;
+# endif
+                       tmpdst = NULL;
+                       tmpdst_len = 0;
+                       if (DCHAR_CONV_FROM_ENCODING (locale_charset (),
+                                                     iconveh_question_mark,
+                                                     tmpsrc, count,
+                                                     NULL,
+                                                     &tmpdst, &tmpdst_len)
+                           < 0)
+                         {
+                           int saved_errno = errno;
+                           if (!(result == resultbuf || result == NULL))
+                             free (result);
+                           if (buf_malloced != NULL)
+                             free (buf_malloced);
+                           CLEANUP ();
+                           errno = saved_errno;
+                           return NULL;
+                         }
+                       ENSURE_ALLOCATION (xsum (length, tmpdst_len));
+                       DCHAR_CPY (result + length, tmpdst, tmpdst_len);
+                       free (tmpdst);
+                       count = tmpdst_len;
+                     }
+                   else
+                     {
+                       /* The result string is ASCII.
+                          Simple 1:1 conversion.  */
+# if USE_SNPRINTF
+                       /* If sizeof (DCHAR_T) == sizeof (TCHAR_T), it's a
+                          no-op conversion, in-place on the array starting
+                          at (result + length).  */
+                       if (sizeof (DCHAR_T) != sizeof (TCHAR_T))
+# endif
+                         {
+                           const TCHAR_T *tmpsrc;
+                           DCHAR_T *tmpdst;
+                           size_t n;
+
+# if USE_SNPRINTF
+                           if (result == resultbuf)
+                             {
+                               tmpsrc = (TCHAR_T *) (result + length);
+                               /* ENSURE_ALLOCATION will not move tmpsrc
+                                  (because it's part of resultbuf).  */
+                               ENSURE_ALLOCATION (xsum (length, count));
+                             }
+                           else
+                             {
+                               /* ENSURE_ALLOCATION will move the array
+                                  (because it uses realloc().  */
+                               ENSURE_ALLOCATION (xsum (length, count));
+                               tmpsrc = (TCHAR_T *) (result + length);
+                             }
+# else
+                           tmpsrc = tmp;
+                           ENSURE_ALLOCATION (xsum (length, count));
+# endif
+                           tmpdst = result + length;
+                           /* Copy backwards, because of overlapping.  */
+                           tmpsrc += count;
+                           tmpdst += count;
+                           for (n = count; n > 0; n--)
+                             *--tmpdst = (unsigned char) *--tmpsrc;
+                         }
+                     }
 #endif
 
+#if DCHAR_IS_TCHAR && !USE_SNPRINTF
                    /* Make room for the result.  */
-                   if (count >= maxlen)
+                   if (count > allocated - length)
                      {
-                       /* Need at least count bytes.  But allocate
-                          proportionally, to avoid looping eternally if
-                          snprintf() reports a too small count.  */
+                       /* Need at least count elements.  But allocate
+                          proportionally.  */
                        size_t n =
                          xmax (xsum (length, count), xtimes (allocated, 2));
 
                        ENSURE_ALLOCATION (n);
-#if USE_SNPRINTF
-                       continue;
+                     }
 #endif
+
+                   /* Here count <= allocated - length.  */
+
+                   /* Perform padding.  */
+#if !DCHAR_IS_TCHAR || ENABLE_UNISTDIO || NEED_PRINTF_FLAG_ZERO
+                   if (pad_ourselves && has_width)
+                     {
+                       size_t w;
+# if ENABLE_UNISTDIO
+                       /* Outside POSIX, it's preferrable to compare the width
+                          against the number of _characters_ of the converted
+                          value.  */
+                       w = DCHAR_MBSNLEN (result + length, count);
+# else
+                       /* The width is compared against the number of _bytes_
+                          of the converted value, says POSIX.  */
+                       w = count;
+# endif
+                       if (w < width)
+                         {
+                           size_t pad = width - w;
+# if USE_SNPRINTF
+                           /* Make room for the result.  */
+                           if (xsum (count, pad) > allocated - length)
+                             {
+                               /* Need at least count + pad elements.  But
+                                  allocate proportionally.  */
+                               size_t n =
+                                 xmax (xsum3 (length, count, pad),
+                                       xtimes (allocated, 2));
+
+                               length += count;
+                               ENSURE_ALLOCATION (n);
+                               length -= count;
+                             }
+                           /* Here count + pad <= allocated - length.  */
+# endif
+                           {
+# if !DCHAR_IS_TCHAR || USE_SNPRINTF
+                             DCHAR_T * const rp = result + length;
+# else
+                             DCHAR_T * const rp = tmp;
+# endif
+                             DCHAR_T *p = rp + count;
+                             DCHAR_T *end = p + pad;
+# if NEED_PRINTF_FLAG_ZERO
+                             DCHAR_T *pad_ptr;
+#  if !DCHAR_IS_TCHAR
+                             if (dp->conversion == 'c'
+                                 || dp->conversion == 's')
+                               /* No zero-padding for string directives.  */
+                               pad_ptr = NULL;
+                             else
+#  endif
+                               {
+                                 pad_ptr = (*rp == '-' ? rp + 1 : rp);
+                                 /* No zero-padding of "inf" and "nan".  */
+                                 if ((*pad_ptr >= 'A' && *pad_ptr <= 'Z')
+                                     || (*pad_ptr >= 'a' && *pad_ptr <= 'z'))
+                                   pad_ptr = NULL;
+                               }
+# endif
+                             /* The generated string now extends from rp to p,
+                                with the zero padding insertion point being at
+                                pad_ptr.  */
+
+                             count = count + pad; /* = end - rp */
+
+                             if (flags & FLAG_LEFT)
+                               {
+                                 /* Pad with spaces on the right.  */
+                                 for (; pad > 0; pad--)
+                                   *p++ = ' ';
                      }
+# if NEED_PRINTF_FLAG_ZERO
+                             else if ((flags & FLAG_ZERO) && pad_ptr != NULL)
+                               {
+                                 /* Pad with zeroes.  */
+                                 DCHAR_T *q = end;
 
-#if USE_SNPRINTF
+                                 while (p > pad_ptr)
+                                   *--q = *--p;
+                                 for (; pad > 0; pad--)
+                                   *p++ = '0';
+                               }
+# endif
+                             else
+                               {
+                                 /* Pad with spaces on the left.  */
+                                 DCHAR_T *q = end;
+
+                                 while (p > rp)
+                                   *--q = *--p;
+                                 for (; pad > 0; pad--)
+                                   *p++ = ' ';
+                               }
+                           }
+                         }
+                     }
+#endif
+
+#if DCHAR_IS_TCHAR && !USE_SNPRINTF
+                   if (count >= tmp_length)
+                     /* tmp_length was incorrectly calculated - fix the
+                        code above!  */
+                     abort ();
+#endif
+
+                   /* Here still count <= allocated - length.  */
+
+#if !DCHAR_IS_TCHAR || USE_SNPRINTF
                    /* The snprintf() result did fit.  */
 #else
                    /* Append the sprintf() result.  */
-                   memcpy (result + length, tmp, count * sizeof (CHAR_T));
+                   memcpy (result + length, tmp, count * sizeof (DCHAR_T));
+#endif
+#if !USE_SNPRINTF
                    if (tmp != tmpbuf)
                      free (tmp);
 #endif
 
+#if NEED_PRINTF_DIRECTIVE_F
+                   if (dp->conversion == 'F')
+                     {
+                       /* Convert the %f result to upper case for %F.  */
+                       DCHAR_T *rp = result + length;
+                       size_t rc;
+                       for (rc = count; rc > 0; rc--, rp++)
+                         if (*rp >= 'a' && *rp <= 'z')
+                           *rp = *rp - 'a' + 'A';
+                     }
+#endif
+
                    length += count;
                    break;
                  }
@@ -851,9 +3916,9 @@
     if (result != resultbuf && length + 1 < allocated)
       {
        /* Shrink the allocated memory if possible.  */
-       CHAR_T *memory;
+       DCHAR_T *memory;
 
-       memory = (CHAR_T *) realloc (result, (length + 1) * sizeof (CHAR_T));
+       memory = (DCHAR_T *) realloc (result, (length + 1) * sizeof (DCHAR_T));
        if (memory != NULL)
          result = memory;
       }
@@ -868,6 +3933,15 @@
        not have this limitation.  */
     return result;
 
+  overflow:
+    if (!(result == resultbuf || result == NULL))
+      free (result);
+    if (buf_malloced != NULL)
+      free (buf_malloced);
+    CLEANUP ();
+    errno = EOVERFLOW;
+    return NULL;
+
   out_of_memory:
     if (!(result == resultbuf || result == NULL))
       free (result);
@@ -880,10 +3954,13 @@
   }
 }
 
+#undef TCHARS_PER_DCHAR
 #undef SNPRINTF
 #undef USE_SNPRINTF
 #undef PRINTF_PARSE
 #undef DIRECTIVES
 #undef DIRECTIVE
-#undef CHAR_T
+#undef TCHAR_T
+#undef DCHAR_T
+#undef FCHAR_T
 #undef VASNPRINTF

Index: vasnprintf.h
===================================================================
RCS file: /cvsroot/cvs/ccvs/lib/vasnprintf.h,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -b -r1.3 -r1.4
--- vasnprintf.h        23 May 2005 17:44:33 -0000      1.3
+++ vasnprintf.h        22 Aug 2007 12:48:47 -0000      1.4
@@ -1,5 +1,5 @@
 /* vsprintf with automatic memory allocation.
-   Copyright (C) 2002-2004 Free Software Foundation, Inc.
+   Copyright (C) 2002-2004, 2007 Free Software Foundation, Inc.
 
    This program is free software; you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
@@ -65,6 +65,10 @@
                 free (output);
             }
   */
+#if REPLACE_VASNPRINTF
+# define asnprintf rpl_asnprintf
+# define vasnprintf rpl_vasnprintf
+#endif
 extern char * asnprintf (char *resultbuf, size_t *lengthp, const char *format, 
...)
        __attribute__ ((__format__ (__printf__, 3, 4)));
 extern char * vasnprintf (char *resultbuf, size_t *lengthp, const char 
*format, va_list args)

Index: vasprintf.c
===================================================================
RCS file: /cvsroot/cvs/ccvs/lib/vasprintf.c,v
retrieving revision 1.15
retrieving revision 1.16
diff -u -b -r1.15 -r1.16
--- vasprintf.c 22 Sep 2006 17:54:40 -0000      1.15
+++ vasprintf.c 22 Aug 2007 12:48:47 -0000      1.16
@@ -1,5 +1,5 @@
 /* Formatted output to strings.
-   Copyright (C) 1999, 2002, 2006 Free Software Foundation, Inc.
+   Copyright (C) 1999, 2002, 2006-2007 Free Software Foundation, Inc.
 
    This program is free software; you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
@@ -18,7 +18,11 @@
 #include <config.h>
 
 /* Specification.  */
-#include "vasprintf.h"
+#ifdef IN_LIBASPRINTF
+# include "vasprintf.h"
+#else
+# include <stdio.h>
+#endif
 
 #include <errno.h>
 #include <limits.h>

Index: xalloc.h
===================================================================
RCS file: /cvsroot/cvs/ccvs/lib/xalloc.h,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -b -r1.3 -r1.4
--- xalloc.h    23 May 2005 17:44:33 -0000      1.3
+++ xalloc.h    22 Aug 2007 12:48:48 -0000      1.4
@@ -1,7 +1,7 @@
 /* xalloc.h -- malloc with out-of-memory checking
 
    Copyright (C) 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998,
-   1999, 2000, 2003, 2004 Free Software Foundation, Inc.
+   1999, 2000, 2003, 2004, 2006, 2007 Free Software Foundation, Inc.
 
    This program is free software; you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
@@ -46,13 +46,10 @@
 extern void xalloc_die (void) ATTRIBUTE_NORETURN;
 
 void *xmalloc (size_t s);
-void *xnmalloc (size_t n, size_t s);
 void *xzalloc (size_t s);
 void *xcalloc (size_t n, size_t s);
 void *xrealloc (void *p, size_t s);
-void *xnrealloc (void *p, size_t n, size_t s);
 void *x2realloc (void *p, size_t *pn);
-void *x2nrealloc (void *p, size_t *pn, size_t s);
 void *xmemdup (void const *p, size_t s);
 char *xstrdup (char const *str);
 
@@ -71,8 +68,203 @@
 # define xalloc_oversized(n, s) \
     ((size_t) (sizeof (ptrdiff_t) <= sizeof (size_t) ? -1 : -2) / (s) < (n))
 
+
+/* In the following macros, T must be an elementary or structure/union or
+   typedef'ed type, or a pointer to such a type.  To apply one of the
+   following macros to a function pointer or array type, you need to typedef
+   it first and use the typedef name.  */
+
+/* Allocate an object of type T dynamically, with error checking.  */
+/* extern t *XMALLOC (typename t); */
+# define XMALLOC(t) ((t *) xmalloc (sizeof (t)))
+
+/* Allocate memory for N elements of type T, with error checking.  */
+/* extern t *XNMALLOC (size_t n, typename t); */
+# define XNMALLOC(n, t) \
+    ((t *) (sizeof (t) == 1 ? xmalloc (n) : xnmalloc (n, sizeof (t))))
+
+/* Allocate an object of type T dynamically, with error checking,
+   and zero it.  */
+/* extern t *XZALLOC (typename t); */
+# define XZALLOC(t) ((t *) xzalloc (sizeof (t)))
+
+/* Allocate memory for N elements of type T, with error checking,
+   and zero it.  */
+/* extern t *XCALLOC (size_t n, typename t); */
+# define XCALLOC(n, t) \
+    ((t *) (sizeof (t) == 1 ? xzalloc (n) : xcalloc (n, sizeof (t))))
+
+
+# if HAVE_INLINE
+#  define static_inline static inline
+# else
+   void *xnmalloc (size_t n, size_t s);
+   void *xnrealloc (void *p, size_t n, size_t s);
+   void *x2nrealloc (void *p, size_t *pn, size_t s);
+   char *xcharalloc (size_t n);
+# endif
+
+# ifdef static_inline
+
+/* Allocate an array of N objects, each with S bytes of memory,
+   dynamically, with error checking.  S must be nonzero.  */
+
+static_inline void *
+xnmalloc (size_t n, size_t s)
+{
+  if (xalloc_oversized (n, s))
+    xalloc_die ();
+  return xmalloc (n * s);
+}
+
+/* Change the size of an allocated block of memory P to an array of N
+   objects each of S bytes, with error checking.  S must be nonzero.  */
+
+static_inline void *
+xnrealloc (void *p, size_t n, size_t s)
+{
+  if (xalloc_oversized (n, s))
+    xalloc_die ();
+  return xrealloc (p, n * s);
+}
+
+/* If P is null, allocate a block of at least *PN such objects;
+   otherwise, reallocate P so that it contains more than *PN objects
+   each of S bytes.  *PN must be nonzero unless P is null, and S must
+   be nonzero.  Set *PN to the new number of objects, and return the
+   pointer to the new block.  *PN is never set to zero, and the
+   returned pointer is never null.
+
+   Repeated reallocations are guaranteed to make progress, either by
+   allocating an initial block with a nonzero size, or by allocating a
+   larger block.
+
+   In the following implementation, nonzero sizes are increased by a
+   factor of approximately 1.5 so that repeated reallocations have
+   O(N) overall cost rather than O(N**2) cost, but the
+   specification for this function does not guarantee that rate.
+
+   Here is an example of use:
+
+     int *p = NULL;
+     size_t used = 0;
+     size_t allocated = 0;
+
+     void
+     append_int (int value)
+       {
+        if (used == allocated)
+          p = x2nrealloc (p, &allocated, sizeof *p);
+        p[used++] = value;
+       }
+
+   This causes x2nrealloc to allocate a block of some nonzero size the
+   first time it is called.
+
+   To have finer-grained control over the initial size, set *PN to a
+   nonzero value before calling this function with P == NULL.  For
+   example:
+
+     int *p = NULL;
+     size_t used = 0;
+     size_t allocated = 0;
+     size_t allocated1 = 1000;
+
+     void
+     append_int (int value)
+       {
+        if (used == allocated)
+          {
+            p = x2nrealloc (p, &allocated1, sizeof *p);
+            allocated = allocated1;
+          }
+        p[used++] = value;
+       }
+
+   */
+
+static_inline void *
+x2nrealloc (void *p, size_t *pn, size_t s)
+{
+  size_t n = *pn;
+
+  if (! p)
+    {
+      if (! n)
+       {
+         /* The approximate size to use for initial small allocation
+            requests, when the invoking code specifies an old size of
+            zero.  64 bytes is the largest "small" request for the
+            GNU C library malloc.  */
+         enum { DEFAULT_MXFAST = 64 };
+
+         n = DEFAULT_MXFAST / s;
+         n += !n;
+       }
+    }
+  else
+    {
+      /* Set N = ceil (1.5 * N) so that progress is made if N == 1.
+        Check for overflow, so that N * S stays in size_t range.
+        The check is slightly conservative, but an exact check isn't
+        worth the trouble.  */
+      if ((size_t) -1 / 3 * 2 / s <= n)
+       xalloc_die ();
+      n += (n + 1) / 2;
+    }
+
+  *pn = n;
+  return xrealloc (p, n * s);
+}
+
+/* Return a pointer to a new buffer of N bytes.  This is like xmalloc,
+   except it returns char *.  */
+
+static_inline char *
+xcharalloc (size_t n)
+{
+  return XNMALLOC (n, char);
+}
+
+# endif
+
 # ifdef __cplusplus
 }
+
+/* C++ does not allow conversions from void * to other pointer types
+   without a cast.  Use templates to work around the problem when
+   possible.  */
+
+template <typename T> inline T *
+xrealloc (T *p, size_t s)
+{
+  return (T *) xrealloc ((void *) p, s);
+}
+
+template <typename T> inline T *
+xnrealloc (T *p, size_t n, size_t s)
+{
+  return (T *) xnrealloc ((void *) p, n, s);
+}
+
+template <typename T> inline T *
+x2realloc (T *p, size_t *pn)
+{
+  return (T *) x2realloc ((void *) p, pn);
+}
+
+template <typename T> inline T *
+x2nrealloc (T *p, size_t *pn, size_t s)
+{
+  return (T *) x2nrealloc ((void *) p, pn, s);
+}
+
+template <typename T> inline T *
+xmemdup (T const *p, size_t s)
+{
+  return (T *) xmemdup ((void const *) p, s);
+}
+
 # endif
 
 

Index: xgetcwd.c
===================================================================
RCS file: /cvsroot/cvs/ccvs/lib/xgetcwd.c,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -b -r1.6 -r1.7
--- xgetcwd.c   22 Sep 2006 17:54:40 -0000      1.6
+++ xgetcwd.c   22 Aug 2007 12:48:48 -0000      1.7
@@ -1,6 +1,6 @@
 /* xgetcwd.c -- return current directory with unlimited length
 
-   Copyright (C) 2001, 2003, 2004, 2006 Free Software Foundation, Inc.
+   Copyright (C) 2001, 2003, 2004, 2006, 2007 Free Software Foundation, Inc.
 
    This program is free software; you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
@@ -23,8 +23,8 @@
 #include "xgetcwd.h"
 
 #include <errno.h>
+#include <unistd.h>
 
-#include "getcwd.h"
 #include "xalloc.h"
 
 /* Return the current directory, newly allocated.

Index: xmalloc.c
===================================================================
RCS file: /cvsroot/cvs/ccvs/lib/xmalloc.c,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -b -r1.6 -r1.7
--- xmalloc.c   22 Sep 2006 17:54:40 -0000      1.6
+++ xmalloc.c   22 Aug 2007 12:48:48 -0000      1.7
@@ -20,7 +20,11 @@
 
 #include <config.h>
 
+#if ! HAVE_INLINE
+# define static_inline
+#endif
 #include "xalloc.h"
+#undef static_inline
 
 #include <stdlib.h>
 #include <string.h>
@@ -38,148 +42,27 @@
 enum { HAVE_GNU_CALLOC = 0 };
 #endif
 
-/* Allocate an array of N objects, each with S bytes of memory,
-   dynamically, with error checking.  S must be nonzero.  */
-
-static inline void *
-xnmalloc_inline (size_t n, size_t s)
-{
-  void *p;
-  if (xalloc_oversized (n, s) || (! (p = malloc (n * s)) && n != 0))
-    xalloc_die ();
-  return p;
-}
-
-void *
-xnmalloc (size_t n, size_t s)
-{
-  return xnmalloc_inline (n, s);
-}
-
 /* Allocate N bytes of memory dynamically, with error checking.  */
 
 void *
 xmalloc (size_t n)
 {
-  return xnmalloc_inline (n, 1);
-}
-
-/* Change the size of an allocated block of memory P to an array of N
-   objects each of S bytes, with error checking.  S must be nonzero.  */
-
-static inline void *
-xnrealloc_inline (void *p, size_t n, size_t s)
-{
-  if (xalloc_oversized (n, s) || (! (p = realloc (p, n * s)) && n != 0))
+  void *p = malloc (n);
+  if (!p && n != 0)
     xalloc_die ();
   return p;
 }
 
-void *
-xnrealloc (void *p, size_t n, size_t s)
-{
-  return xnrealloc_inline (p, n, s);
-}
-
 /* Change the size of an allocated block of memory P to N bytes,
    with error checking.  */
 
 void *
 xrealloc (void *p, size_t n)
 {
-  return xnrealloc_inline (p, n, 1);
-}
-
-
-/* If P is null, allocate a block of at least *PN such objects;
-   otherwise, reallocate P so that it contains more than *PN objects
-   each of S bytes.  *PN must be nonzero unless P is null, and S must
-   be nonzero.  Set *PN to the new number of objects, and return the
-   pointer to the new block.  *PN is never set to zero, and the
-   returned pointer is never null.
-
-   Repeated reallocations are guaranteed to make progress, either by
-   allocating an initial block with a nonzero size, or by allocating a
-   larger block.
-
-   In the following implementation, nonzero sizes are doubled so that
-   repeated reallocations have O(N log N) overall cost rather than
-   O(N**2) cost, but the specification for this function does not
-   guarantee that sizes are doubled.
-
-   Here is an example of use:
-
-     int *p = NULL;
-     size_t used = 0;
-     size_t allocated = 0;
-
-     void
-     append_int (int value)
-       {
-        if (used == allocated)
-          p = x2nrealloc (p, &allocated, sizeof *p);
-        p[used++] = value;
-       }
-
-   This causes x2nrealloc to allocate a block of some nonzero size the
-   first time it is called.
-
-   To have finer-grained control over the initial size, set *PN to a
-   nonzero value before calling this function with P == NULL.  For
-   example:
-
-     int *p = NULL;
-     size_t used = 0;
-     size_t allocated = 0;
-     size_t allocated1 = 1000;
-
-     void
-     append_int (int value)
-       {
-        if (used == allocated)
-          {
-            p = x2nrealloc (p, &allocated1, sizeof *p);
-            allocated = allocated1;
-          }
-        p[used++] = value;
-       }
-
-   */
-
-static inline void *
-x2nrealloc_inline (void *p, size_t *pn, size_t s)
-{
-  size_t n = *pn;
-
-  if (! p)
-    {
-      if (! n)
-       {
-         /* The approximate size to use for initial small allocation
-            requests, when the invoking code specifies an old size of
-            zero.  64 bytes is the largest "small" request for the
-            GNU C library malloc.  */
-         enum { DEFAULT_MXFAST = 64 };
-
-         n = DEFAULT_MXFAST / s;
-         n += !n;
-       }
-    }
-  else
-    {
-      if (SIZE_MAX / 2 / s < n)
+  p = realloc (p, n);
+  if (!p && n != 0)
        xalloc_die ();
-      n *= 2;
-    }
-
-  *pn = n;
-  return xrealloc (p, n * s);
-}
-
-void *
-x2nrealloc (void *p, size_t *pn, size_t s)
-{
-  return x2nrealloc_inline (p, pn, s);
+  return p;
 }
 
 /* If P is null, allocate a block of at least *PN bytes; otherwise,
@@ -191,7 +74,7 @@
 void *
 x2realloc (void *p, size_t *pn)
 {
-  return x2nrealloc_inline (p, pn, 1);
+  return x2nrealloc (p, pn, 1);
 }
 
 /* Allocate S bytes of zeroed memory dynamically, with error checking.

Index: xreadlink.c
===================================================================
RCS file: /cvsroot/cvs/ccvs/lib/xreadlink.c,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -b -r1.6 -r1.7
--- xreadlink.c 22 Sep 2006 17:54:40 -0000      1.6
+++ xreadlink.c 22 Aug 2007 12:48:48 -0000      1.7
@@ -1,7 +1,6 @@
 /* xreadlink.c -- readlink wrapper to return the link name in malloc'd storage
 
-   Copyright (C) 2001, 2003, 2004, 2005, 2006 Free Software
-   Foundation, Inc.
+   Copyright (C) 2001, 2003-2007 Free Software Foundation, Inc.
 
    This program is free software; you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
@@ -18,13 +17,16 @@
    If not, write to the Free Software Foundation,
    51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.  */
 
-/* Written by Jim Meyering <address@hidden>  */
+/* Written by Jim Meyering <address@hidden>
+   and Bruno Haible <address@hidden>.  */
 
 #include <config.h>
 
+/* Specification.  */
 #include "xreadlink.h"
 
 #include <stdio.h>
+#include <string.h>
 #include <errno.h>
 #include <limits.h>
 #include <sys/types.h>
@@ -38,53 +40,92 @@
 # define SSIZE_MAX ((ssize_t) (SIZE_MAX / 2))
 #endif
 
-#define MAXSIZE (SIZE_MAX < SSIZE_MAX ? SIZE_MAX : SSIZE_MAX)
-
-#include "xalloc.h"
+#ifdef NO_XMALLOC
+# define xmalloc malloc
+#else
+# include "xalloc.h"
+#endif
 
-/* Call readlink to get the symbolic link value of FILE.
-   SIZE is a hint as to how long the link is expected to be;
-   typically it is taken from st_size.  It need not be correct.
+/* Call readlink to get the symbolic link value of FILENAME.
    Return a pointer to that NUL-terminated string in malloc'd storage.
    If readlink fails, return NULL (caller may use errno to diagnose).
-   If malloc fails, or if the link value is longer than SSIZE_MAX :-),
+   If realloc fails, or if the link value is longer than SIZE_MAX :-),
    give a diagnostic and exit.  */
 
 char *
-xreadlink (char const *file, size_t size)
+xreadlink (char const *filename)
 {
   /* The initial buffer size for the link value.  A power of 2
      detects arithmetic overflow earlier, but is not required.  */
-  size_t buf_size = size < MAXSIZE ? size + 1 : MAXSIZE;
+#define INITIAL_BUF_SIZE 1024
+
+  /* Allocate the initial buffer on the stack.  This way, in the common
+     case of a symlink of small size, we get away with a single small malloc()
+     instead of a big malloc() followed by a shrinking realloc().  */
+  char initial_buf[INITIAL_BUF_SIZE];
+
+  char *buffer = initial_buf;
+  size_t buf_size = sizeof (initial_buf);
 
   while (1)
     {
-      char *buffer = xmalloc (buf_size);
-      ssize_t r = readlink (file, buffer, buf_size);
-      size_t link_length = r;
+      /* Attempt to read the link into the current buffer.  */
+      ssize_t link_length = readlink (filename, buffer, buf_size);
 
       /* On AIX 5L v5.3 and HP-UX 11i v2 04/09, readlink returns -1
         with errno == ERANGE if the buffer is too small.  */
-      if (r < 0 && errno != ERANGE)
+      if (link_length < 0 && errno != ERANGE)
+       {
+         if (buffer != initial_buf)
        {
          int saved_errno = errno;
          free (buffer);
          errno = saved_errno;
+           }
          return NULL;
        }
 
-      if (link_length < buf_size)
+      if ((size_t) link_length < buf_size)
+       {
+         buffer[link_length++] = '\0';
+
+         /* Return it in a chunk of memory as small as possible.  */
+         if (buffer == initial_buf)
+           {
+             buffer = (char *) xmalloc (link_length);
+#ifdef NO_XMALLOC
+             if (buffer == NULL)
+               return NULL;
+#endif
+             memcpy (buffer, initial_buf, link_length);
+           }
+         else
+           {
+             /* Shrink buffer before returning it.  */
+             if ((size_t) link_length < buf_size)
        {
-         buffer[link_length] = 0;
+                 char *smaller_buffer = (char *) realloc (buffer, link_length);
+
+                 if (smaller_buffer != NULL)
+                   buffer = smaller_buffer;
+               }
+           }
          return buffer;
        }
 
+      if (buffer != initial_buf)
       free (buffer);
-      if (buf_size <= MAXSIZE / 2)
        buf_size *= 2;
-      else if (buf_size < MAXSIZE)
-       buf_size = MAXSIZE;
-      else
+      if (SSIZE_MAX < buf_size || (SIZE_MAX / 2 < SSIZE_MAX && buf_size == 0))
+#ifdef NO_XMALLOC
+       return NULL;
+#else
        xalloc_die ();
+#endif
+      buffer = (char *) xmalloc (buf_size);
+#ifdef NO_XMALLOC
+      if (buffer == NULL)
+       return NULL;
+#endif
     }
 }

Index: xreadlink.h
===================================================================
RCS file: /cvsroot/cvs/ccvs/lib/xreadlink.h,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -b -r1.2 -r1.3
--- xreadlink.h 23 May 2005 17:44:33 -0000      1.2
+++ xreadlink.h 22 Aug 2007 12:48:48 -0000      1.3
@@ -1,6 +1,6 @@
-/* readlink wrapper to return the link name in malloc'd storage
+/* Reading symbolic links without size limitation.
 
-   Copyright (C) 2001, 2003, 2004 Free Software Foundation, Inc.
+   Copyright (C) 2001, 2003, 2004, 2007 Free Software Foundation, Inc.
 
    This program is free software; you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
@@ -20,4 +20,5 @@
 /* Written by Jim Meyering <address@hidden>  */
 
 #include <stddef.h>
-char *xreadlink (char const *, size_t);
+
+extern char *xreadlink (char const *filename);

Index: xstrndup.c
===================================================================
RCS file: /cvsroot/cvs/ccvs/lib/xstrndup.c,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -b -r1.1 -r1.2
--- xstrndup.c  6 Jul 2006 02:17:59 -0000       1.1
+++ xstrndup.c  22 Aug 2007 12:48:48 -0000      1.2
@@ -1,6 +1,6 @@
 /* Duplicate a bounded initial segment of a string, with out-of-memory
    checking.
-   Copyright (C) 2003 Free Software Foundation, Inc.
+   Copyright (C) 2003, 2006, 2007 Free Software Foundation, Inc.
 
    This program is free software; you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
@@ -16,14 +16,12 @@
    along with this program; if not, write to the Free Software Foundation,
    Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.  */
 
-#ifdef HAVE_CONFIG_H
-# include <config.h>
-#endif
+#include <config.h>
 
 /* Specification.  */
 #include "xstrndup.h"
 
-#include "strndup.h"
+#include <string.h>
 #include "xalloc.h"
 
 /* Return a newly allocated copy of at most N bytes of STRING.

Index: yesno.c
===================================================================
RCS file: /cvsroot/cvs/ccvs/lib/yesno.c,v
retrieving revision 1.9
retrieving revision 1.10
diff -u -b -r1.9 -r1.10
--- yesno.c     22 Sep 2006 17:54:40 -0000      1.9
+++ yesno.c     22 Aug 2007 12:48:48 -0000      1.10
@@ -1,6 +1,6 @@
 /* yesno.c -- read a yes/no response from stdin
 
-   Copyright (C) 1990, 1998, 2001, 2003, 2004, 2005, 2006 Free
+   Copyright (C) 1990, 1998, 2001, 2003, 2004, 2005, 2006, 2007 Free
    Software Foundation, Inc.
 
    This program is free software; you can redistribute it and/or modify
@@ -24,19 +24,27 @@
 #include <stdlib.h>
 #include <stdio.h>
 
-#include "getline.h"
-
-/* Return true if we read an affirmative line from standard input.  */
+#if ENABLE_NLS
+# include "getline.h"
+#endif
 
 extern int rpmatch (char const *response);
 
+/* Return true if we read an affirmative line from standard input.
+
+   Since this function uses stdin, it is suggested that the caller not
+   use STDIN_FILENO directly, and also that the line
+   atexit(close_stdin) be added to main().  */
+
 bool
 yesno (void)
 {
+  bool yes;
+
+#if ENABLE_NLS
   char *response = NULL;
   size_t response_size = 0;
   ssize_t response_len = getline (&response, &response_size, stdin);
-  bool yes;
 
   if (response_len <= 0)
     yes = false;
@@ -47,5 +55,14 @@
     }
 
   free (response);
+#else
+  /* Test against "^[yY]", hardcoded to avoid requiring getline,
+     regex, and rpmatch.  */
+  int c = getchar ();
+  yes = (c == 'y' || c == 'Y');
+  while (c != '\n' && c != EOF)
+    c = getchar ();
+#endif
+
   return yes;
 }

Index: canonicalize-lgpl.c
===================================================================
RCS file: canonicalize-lgpl.c
diff -N canonicalize-lgpl.c
--- /dev/null   1 Jan 1970 00:00:00 -0000
+++ canonicalize-lgpl.c 22 Aug 2007 12:48:38 -0000      1.1
@@ -0,0 +1,353 @@
+/* Return the canonical absolute name of a given file.
+   Copyright (C) 1996-2003, 2005-2007 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+
+   This program is free software; you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation; either version 2, or (at your option)
+   any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program; if not, write to the Free Software Foundation,
+   Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.  */
+
+#include <config.h>
+
+/* Avoid a clash of our rpl_realpath() function with the prototype in
+   <stdlib.h> on Solaris 2.5.1.  */
+#undef realpath
+
+#if !HAVE_CANONICALIZE_FILE_NAME || defined _LIBC
+
+#include <alloca.h>
+
+/* Specification.  */
+#include "canonicalize.h"
+
+#include <stddef.h>
+#include <stdlib.h>
+#include <string.h>
+
+#if HAVE_UNISTD_H || defined _LIBC
+# include <unistd.h>
+#endif
+
+#include <limits.h>
+
+#if HAVE_SYS_PARAM_H || defined _LIBC
+# include <sys/param.h>
+#endif
+#ifndef MAXSYMLINKS
+# define MAXSYMLINKS 20
+#endif
+
+#include <sys/stat.h>
+
+#include <errno.h>
+#ifndef _LIBC
+# define __set_errno(e) errno = (e)
+# ifndef ENAMETOOLONG
+#  define ENAMETOOLONG EINVAL
+# endif
+#endif
+
+#ifdef _LIBC
+# include <shlib-compat.h>
+#else
+# define SHLIB_COMPAT(lib, introduced, obsoleted) 0
+# define versioned_symbol(lib, local, symbol, version)
+# define compat_symbol(lib, local, symbol, version)
+# define weak_alias(local, symbol)
+# define __canonicalize_file_name canonicalize_file_name
+# define __realpath rpl_realpath
+# include "pathmax.h"
+# include "malloca.h"
+# if HAVE_GETCWD
+#  ifdef VMS
+    /* We want the directory in Unix syntax, not in VMS syntax.  */
+#   define __getcwd(buf, max) getcwd (buf, max, 0)
+#  else
+#   define __getcwd getcwd
+#  endif
+# else
+#  define __getcwd(buf, max) getwd (buf)
+# endif
+# define __readlink readlink
+  /* On systems without symbolic links, call stat() instead of lstat().  */
+# if !defined S_ISNLK && !HAVE_READLINK
+#  define lstat stat
+# endif
+#endif
+
+/* Return the canonical absolute name of file NAME.  A canonical name
+   does not contain any `.', `..' components nor any repeated path
+   separators ('/') or symlinks.  All path components must exist.  If
+   RESOLVED is null, the result is malloc'd; otherwise, if the
+   canonical name is PATH_MAX chars or more, returns null with `errno'
+   set to ENAMETOOLONG; if the name fits in fewer than PATH_MAX chars,
+   returns the name in RESOLVED.  If the name cannot be resolved and
+   RESOLVED is non-NULL, it contains the path of the first component
+   that cannot be resolved.  If the path can be resolved, RESOLVED
+   holds the same value as the value returned.  */
+
+char *
+__realpath (const char *name, char *resolved)
+{
+  char *rpath, *dest, *extra_buf = NULL;
+  const char *start, *end, *rpath_limit;
+  long int path_max;
+#if HAVE_READLINK
+  int num_links = 0;
+#endif
+
+  if (name == NULL)
+    {
+      /* As per Single Unix Specification V2 we must return an error if
+        either parameter is a null pointer.  We extend this to allow
+        the RESOLVED parameter to be NULL in case the we are expected to
+        allocate the room for the return value.  */
+      __set_errno (EINVAL);
+      return NULL;
+    }
+
+  if (name[0] == '\0')
+    {
+      /* As per Single Unix Specification V2 we must return an error if
+        the name argument points to an empty string.  */
+      __set_errno (ENOENT);
+      return NULL;
+    }
+
+#ifdef PATH_MAX
+  path_max = PATH_MAX;
+#else
+  path_max = pathconf (name, _PC_PATH_MAX);
+  if (path_max <= 0)
+    path_max = 1024;
+#endif
+
+  if (resolved == NULL)
+    {
+      rpath = malloc (path_max);
+      if (rpath == NULL)
+       return NULL;
+    }
+  else
+    rpath = resolved;
+  rpath_limit = rpath + path_max;
+
+  if (name[0] != '/')
+    {
+      if (!__getcwd (rpath, path_max))
+       {
+         rpath[0] = '\0';
+         goto error;
+       }
+      dest = strchr (rpath, '\0');
+    }
+  else
+    {
+      rpath[0] = '/';
+      dest = rpath + 1;
+    }
+
+  for (start = end = name; *start; start = end)
+    {
+#ifdef _LIBC
+      struct stat64 st;
+#else
+      struct stat st;
+#endif
+
+      /* Skip sequence of multiple path-separators.  */
+      while (*start == '/')
+       ++start;
+
+      /* Find end of path component.  */
+      for (end = start; *end && *end != '/'; ++end)
+       /* Nothing.  */;
+
+      if (end - start == 0)
+       break;
+      else if (end - start == 1 && start[0] == '.')
+       /* nothing */;
+      else if (end - start == 2 && start[0] == '.' && start[1] == '.')
+       {
+         /* Back up to previous component, ignore if at root already.  */
+         if (dest > rpath + 1)
+           while ((--dest)[-1] != '/');
+       }
+      else
+       {
+         size_t new_size;
+
+         if (dest[-1] != '/')
+           *dest++ = '/';
+
+         if (dest + (end - start) >= rpath_limit)
+           {
+             ptrdiff_t dest_offset = dest - rpath;
+             char *new_rpath;
+
+             if (resolved)
+               {
+                 __set_errno (ENAMETOOLONG);
+                 if (dest > rpath + 1)
+                   dest--;
+                 *dest = '\0';
+                 goto error;
+               }
+             new_size = rpath_limit - rpath;
+             if (end - start + 1 > path_max)
+               new_size += end - start + 1;
+             else
+               new_size += path_max;
+             new_rpath = (char *) realloc (rpath, new_size);
+             if (new_rpath == NULL)
+               goto error;
+             rpath = new_rpath;
+             rpath_limit = rpath + new_size;
+
+             dest = rpath + dest_offset;
+           }
+
+#ifdef _LIBC
+         dest = __mempcpy (dest, start, end - start);
+#else
+         memcpy (dest, start, end - start);
+         dest += end - start;
+#endif
+         *dest = '\0';
+
+#ifdef _LIBC
+         if (__lxstat64 (_STAT_VER, rpath, &st) < 0)
+#else
+         if (lstat (rpath, &st) < 0)
+#endif
+           goto error;
+
+#if HAVE_READLINK
+         if (S_ISLNK (st.st_mode))
+           {
+             char *buf;
+             size_t len;
+             int n;
+
+             if (++num_links > MAXSYMLINKS)
+               {
+                 __set_errno (ELOOP);
+                 goto error;
+               }
+
+             buf = malloca (path_max);
+             if (!buf)
+               {
+                 errno = ENOMEM;
+                 goto error;
+               }
+
+             n = __readlink (rpath, buf, path_max);
+             if (n < 0)
+               {
+                 int saved_errno = errno;
+                 freea (buf);
+                 errno = saved_errno;
+                 goto error;
+               }
+             buf[n] = '\0';
+
+             if (!extra_buf)
+               {
+                 extra_buf = malloca (path_max);
+                 if (!extra_buf)
+                   {
+                     freea (buf);
+                     errno = ENOMEM;
+                     goto error;
+                   }
+               }
+
+             len = strlen (end);
+             if ((long int) (n + len) >= path_max)
+               {
+                 freea (buf);
+                 __set_errno (ENAMETOOLONG);
+                 goto error;
+               }
+
+             /* Careful here, end may be a pointer into extra_buf... */
+             memmove (&extra_buf[n], end, len + 1);
+             name = end = memcpy (extra_buf, buf, n);
+
+             if (buf[0] == '/')
+               dest = rpath + 1;       /* It's an absolute symlink */
+             else
+               /* Back up to previous component, ignore if at root already: */
+               if (dest > rpath + 1)
+                 while ((--dest)[-1] != '/');
+           }
+#endif
+       }
+    }
+  if (dest > rpath + 1 && dest[-1] == '/')
+    --dest;
+  *dest = '\0';
+
+  if (extra_buf)
+    freea (extra_buf);
+
+  return resolved ? memcpy (resolved, rpath, dest - rpath + 1) : rpath;
+
+error:
+  {
+    int saved_errno = errno;
+    if (extra_buf)
+      freea (extra_buf);
+    if (resolved)
+      strcpy (resolved, rpath);
+    else
+      free (rpath);
+    errno = saved_errno;
+  }
+  return NULL;
+}
+#ifdef _LIBC
+versioned_symbol (libc, __realpath, realpath, GLIBC_2_3);
+#endif
+
+
+#if SHLIB_COMPAT(libc, GLIBC_2_0, GLIBC_2_3)
+char *
+__old_realpath (const char *name, char *resolved)
+{
+  if (resolved == NULL)
+    {
+      __set_errno (EINVAL);
+      return NULL;
+    }
+
+  return __realpath (name, resolved);
+}
+compat_symbol (libc, __old_realpath, realpath, GLIBC_2_0);
+#endif
+
+
+char *
+__canonicalize_file_name (const char *name)
+{
+  return __realpath (name, NULL);
+}
+weak_alias (__canonicalize_file_name, canonicalize_file_name)
+
+#else
+
+/* This declaration is solely to ensure that after preprocessing
+   this file is never empty.  */
+typedef int dummy;
+
+#endif

Index: config.charset
===================================================================
RCS file: config.charset
diff -N config.charset
--- /dev/null   1 Jan 1970 00:00:00 -0000
+++ config.charset      22 Aug 2007 12:48:38 -0000      1.1
@@ -0,0 +1,639 @@
+#! /bin/sh
+# Output a system dependent table of character encoding aliases.
+#
+#   Copyright (C) 2000-2004, 2006 Free Software Foundation, Inc.
+#
+#   This program is free software; you can redistribute it and/or modify
+#   it under the terms of the GNU General Public License as published by
+#   the Free Software Foundation; either version 2, or (at your option)
+#   any later version.
+#
+#   This program is distributed in the hope that it will be useful,
+#   but WITHOUT ANY WARRANTY; without even the implied warranty of
+#   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+#   GNU General Public License for more details.
+#
+#   You should have received a copy of the GNU General Public License along
+#   with this program; if not, write to the Free Software Foundation,
+#   Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+#
+# The table consists of lines of the form
+#    ALIAS  CANONICAL
+#
+# ALIAS is the (system dependent) result of "nl_langinfo (CODESET)".
+# ALIAS is compared in a case sensitive way.
+#
+# CANONICAL is the GNU canonical name for this character encoding.
+# It must be an encoding supported by libiconv. Support by GNU libc is
+# also desirable. CANONICAL is case insensitive. Usually an upper case
+# MIME charset name is preferred.
+# The current list of GNU canonical charset names is as follows.
+#
+#       name              MIME?             used by which systems
+#   ASCII, ANSI_X3.4-1968       glibc solaris freebsd netbsd darwin
+#   ISO-8859-1              Y   glibc aix hpux irix osf solaris freebsd netbsd 
darwin
+#   ISO-8859-2              Y   glibc aix hpux irix osf solaris freebsd netbsd 
darwin
+#   ISO-8859-3              Y   glibc solaris
+#   ISO-8859-4              Y   osf solaris freebsd netbsd darwin
+#   ISO-8859-5              Y   glibc aix hpux irix osf solaris freebsd netbsd 
darwin
+#   ISO-8859-6              Y   glibc aix hpux solaris
+#   ISO-8859-7              Y   glibc aix hpux irix osf solaris netbsd darwin
+#   ISO-8859-8              Y   glibc aix hpux osf solaris
+#   ISO-8859-9              Y   glibc aix hpux irix osf solaris darwin
+#   ISO-8859-13                 glibc netbsd darwin
+#   ISO-8859-14                 glibc
+#   ISO-8859-15                 glibc aix osf solaris freebsd darwin
+#   KOI8-R                  Y   glibc solaris freebsd netbsd darwin
+#   KOI8-U                  Y   glibc freebsd netbsd darwin
+#   KOI8-T                      glibc
+#   CP437                       dos
+#   CP775                       dos
+#   CP850                       aix osf dos
+#   CP852                       dos
+#   CP855                       dos
+#   CP856                       aix
+#   CP857                       dos
+#   CP861                       dos
+#   CP862                       dos
+#   CP864                       dos
+#   CP865                       dos
+#   CP866                       freebsd netbsd darwin dos
+#   CP869                       dos
+#   CP874                       woe32 dos
+#   CP922                       aix
+#   CP932                       aix woe32 dos
+#   CP943                       aix
+#   CP949                       osf woe32 dos
+#   CP950                       woe32 dos
+#   CP1046                      aix
+#   CP1124                      aix
+#   CP1125                      dos
+#   CP1129                      aix
+#   CP1250                      woe32
+#   CP1251                      glibc solaris netbsd darwin woe32
+#   CP1252                      aix woe32
+#   CP1253                      woe32
+#   CP1254                      woe32
+#   CP1255                      glibc woe32
+#   CP1256                      woe32
+#   CP1257                      woe32
+#   GB2312                  Y   glibc aix hpux irix solaris freebsd netbsd 
darwin
+#   EUC-JP                  Y   glibc aix hpux irix osf solaris freebsd netbsd 
darwin
+#   EUC-KR                  Y   glibc aix hpux irix osf solaris freebsd netbsd 
darwin
+#   EUC-TW                      glibc aix hpux irix osf solaris netbsd
+#   BIG5                    Y   glibc aix hpux osf solaris freebsd netbsd 
darwin
+#   BIG5-HKSCS                  glibc solaris
+#   GBK                         glibc aix osf solaris woe32 dos
+#   GB18030                     glibc solaris netbsd
+#   SHIFT_JIS               Y   hpux osf solaris freebsd netbsd darwin
+#   JOHAB                       glibc solaris woe32
+#   TIS-620                     glibc aix hpux osf solaris
+#   VISCII                  Y   glibc
+#   TCVN5712-1                  glibc
+#   GEORGIAN-PS                 glibc
+#   HP-ROMAN8                   hpux
+#   HP-ARABIC8                  hpux
+#   HP-GREEK8                   hpux
+#   HP-HEBREW8                  hpux
+#   HP-TURKISH8                 hpux
+#   HP-KANA8                    hpux
+#   DEC-KANJI                   osf
+#   DEC-HANYU                   osf
+#   UTF-8                   Y   glibc aix hpux osf solaris netbsd darwin
+#
+# Note: Names which are not marked as being a MIME name should not be used in
+# Internet protocols for information interchange (mail, news, etc.).
+#
+# Note: ASCII and ANSI_X3.4-1968 are synonymous canonical names. Applications
+# must understand both names and treat them as equivalent.
+#
+# The first argument passed to this file is the canonical host specification,
+#    CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM
+# or
+#    CPU_TYPE-MANUFACTURER-KERNEL-OPERATING_SYSTEM
+
+host="$1"
+os=`echo "$host" | sed -e 's/^[^-]*-[^-]*-\(.*\)$/\1/'`
+echo "# This file contains a table of character encoding aliases,"
+echo "# suitable for operating system '${os}'."
+echo "# It was automatically generated from config.charset."
+# List of references, updated during installation:
+echo "# Packages using this file: "
+case "$os" in
+    linux-gnulibc1*)
+       # Linux libc5 doesn't have nl_langinfo(CODESET); therefore
+       # localcharset.c falls back to using the full locale name
+       # from the environment variables.
+       echo "C ASCII"
+       echo "POSIX ASCII"
+       for l in af af_ZA ca ca_ES da da_DK de de_AT de_BE de_CH de_DE de_LU \
+                en en_AU en_BW en_CA en_DK en_GB en_IE en_NZ en_US en_ZA \
+                en_ZW es es_AR es_BO es_CL es_CO es_DO es_EC es_ES es_GT \
+                es_HN es_MX es_PA es_PE es_PY es_SV es_US es_UY es_VE et \
+                et_EE eu eu_ES fi fi_FI fo fo_FO fr fr_BE fr_CA fr_CH fr_FR \
+                fr_LU ga ga_IE gl gl_ES id id_ID in in_ID is is_IS it it_CH \
+                it_IT kl kl_GL nl nl_BE nl_NL no no_NO pt pt_BR pt_PT sv \
+                sv_FI sv_SE; do
+         echo "$l ISO-8859-1"
+         echo "$l.iso-8859-1 ISO-8859-1"
+         echo "$l.iso-8859-15 ISO-8859-15"
+         echo "address@hidden ISO-8859-15"
+         echo "address@hidden ISO-8859-15"
+         echo "$l.cp-437 CP437"
+         echo "$l.cp-850 CP850"
+         echo "$l.cp-1252 CP1252"
+         echo "address@hidden CP1252"
+         #echo "$l.atari-st ATARI-ST" # not a commonly used encoding
+         echo "$l.utf-8 UTF-8"
+         echo "address@hidden UTF-8"
+       done
+       for l in cs cs_CZ hr hr_HR hu hu_HU pl pl_PL ro ro_RO sk sk_SK sl \
+                sl_SI sr sr_CS sr_YU; do
+         echo "$l ISO-8859-2"
+         echo "$l.iso-8859-2 ISO-8859-2"
+         echo "$l.cp-852 CP852"
+         echo "$l.cp-1250 CP1250"
+         echo "$l.utf-8 UTF-8"
+       done
+       for l in mk mk_MK ru ru_RU; do
+         echo "$l ISO-8859-5"
+         echo "$l.iso-8859-5 ISO-8859-5"
+         echo "$l.koi8-r KOI8-R"
+         echo "$l.cp-866 CP866"
+         echo "$l.cp-1251 CP1251"
+         echo "$l.utf-8 UTF-8"
+       done
+       for l in ar ar_SA; do
+         echo "$l ISO-8859-6"
+         echo "$l.iso-8859-6 ISO-8859-6"
+         echo "$l.cp-864 CP864"
+         #echo "$l.cp-868 CP868" # not a commonly used encoding
+         echo "$l.cp-1256 CP1256"
+         echo "$l.utf-8 UTF-8"
+       done
+       for l in el el_GR gr gr_GR; do
+         echo "$l ISO-8859-7"
+         echo "$l.iso-8859-7 ISO-8859-7"
+         echo "$l.cp-869 CP869"
+         echo "$l.cp-1253 CP1253"
+         echo "address@hidden CP1253"
+         echo "$l.utf-8 UTF-8"
+         echo "address@hidden UTF-8"
+       done
+       for l in he he_IL iw iw_IL; do
+         echo "$l ISO-8859-8"
+         echo "$l.iso-8859-8 ISO-8859-8"
+         echo "$l.cp-862 CP862"
+         echo "$l.cp-1255 CP1255"
+         echo "$l.utf-8 UTF-8"
+       done
+       for l in tr tr_TR; do
+         echo "$l ISO-8859-9"
+         echo "$l.iso-8859-9 ISO-8859-9"
+         echo "$l.cp-857 CP857"
+         echo "$l.cp-1254 CP1254"
+         echo "$l.utf-8 UTF-8"
+       done
+       for l in lt lt_LT lv lv_LV; do
+         #echo "$l BALTIC" # not a commonly used encoding, wrong encoding name
+         echo "$l ISO-8859-13"
+       done
+       for l in ru_UA uk uk_UA; do
+         echo "$l KOI8-U"
+       done
+       for l in zh zh_CN; do
+         #echo "$l GB_2312-80" # not a commonly used encoding, wrong encoding 
name
+         echo "$l GB2312"
+       done
+       for l in ja ja_JP ja_JP.EUC; do
+         echo "$l EUC-JP"
+       done
+       for l in ko ko_KR; do
+         echo "$l EUC-KR"
+       done
+       for l in th th_TH; do
+         echo "$l TIS-620"
+       done
+       for l in fa fa_IR; do
+         #echo "$l ISIRI-3342" # a broken encoding
+         echo "$l.utf-8 UTF-8"
+       done
+       ;;
+    linux* | *-gnu*)
+       # With glibc-2.1 or newer, we don't need any canonicalization,
+       # because glibc has iconv and both glibc and libiconv support all
+       # GNU canonical names directly. Therefore, the Makefile does not
+       # need to install the alias file at all.
+       # The following applies only to glibc-2.0.x and older libcs.
+       echo "ISO_646.IRV:1983 ASCII"
+       ;;
+    aix*)
+       echo "ISO8859-1 ISO-8859-1"
+       echo "ISO8859-2 ISO-8859-2"
+       echo "ISO8859-5 ISO-8859-5"
+       echo "ISO8859-6 ISO-8859-6"
+       echo "ISO8859-7 ISO-8859-7"
+       echo "ISO8859-8 ISO-8859-8"
+       echo "ISO8859-9 ISO-8859-9"
+       echo "ISO8859-15 ISO-8859-15"
+       echo "IBM-850 CP850"
+       echo "IBM-856 CP856"
+       echo "IBM-921 ISO-8859-13"
+       echo "IBM-922 CP922"
+       echo "IBM-932 CP932"
+       echo "IBM-943 CP943"
+       echo "IBM-1046 CP1046"
+       echo "IBM-1124 CP1124"
+       echo "IBM-1129 CP1129"
+       echo "IBM-1252 CP1252"
+       echo "IBM-eucCN GB2312"
+       echo "IBM-eucJP EUC-JP"
+       echo "IBM-eucKR EUC-KR"
+       echo "IBM-eucTW EUC-TW"
+       echo "big5 BIG5"
+       echo "GBK GBK"
+       echo "TIS-620 TIS-620"
+       echo "UTF-8 UTF-8"
+       ;;
+    hpux*)
+       echo "iso88591 ISO-8859-1"
+       echo "iso88592 ISO-8859-2"
+       echo "iso88595 ISO-8859-5"
+       echo "iso88596 ISO-8859-6"
+       echo "iso88597 ISO-8859-7"
+       echo "iso88598 ISO-8859-8"
+       echo "iso88599 ISO-8859-9"
+       echo "iso885915 ISO-8859-15"
+       echo "roman8 HP-ROMAN8"
+       echo "arabic8 HP-ARABIC8"
+       echo "greek8 HP-GREEK8"
+       echo "hebrew8 HP-HEBREW8"
+       echo "turkish8 HP-TURKISH8"
+       echo "kana8 HP-KANA8"
+       echo "tis620 TIS-620"
+       echo "big5 BIG5"
+       echo "eucJP EUC-JP"
+       echo "eucKR EUC-KR"
+       echo "eucTW EUC-TW"
+       echo "hp15CN GB2312"
+       #echo "ccdc ?" # what is this?
+       echo "SJIS SHIFT_JIS"
+       echo "utf8 UTF-8"
+       ;;
+    irix*)
+       echo "ISO8859-1 ISO-8859-1"
+       echo "ISO8859-2 ISO-8859-2"
+       echo "ISO8859-5 ISO-8859-5"
+       echo "ISO8859-7 ISO-8859-7"
+       echo "ISO8859-9 ISO-8859-9"
+       echo "eucCN GB2312"
+       echo "eucJP EUC-JP"
+       echo "eucKR EUC-KR"
+       echo "eucTW EUC-TW"
+       ;;
+    osf*)
+       echo "ISO8859-1 ISO-8859-1"
+       echo "ISO8859-2 ISO-8859-2"
+       echo "ISO8859-4 ISO-8859-4"
+       echo "ISO8859-5 ISO-8859-5"
+       echo "ISO8859-7 ISO-8859-7"
+       echo "ISO8859-8 ISO-8859-8"
+       echo "ISO8859-9 ISO-8859-9"
+       echo "ISO8859-15 ISO-8859-15"
+       echo "cp850 CP850"
+       echo "big5 BIG5"
+       echo "dechanyu DEC-HANYU"
+       echo "dechanzi GB2312"
+       echo "deckanji DEC-KANJI"
+       echo "deckorean EUC-KR"
+       echo "eucJP EUC-JP"
+       echo "eucKR EUC-KR"
+       echo "eucTW EUC-TW"
+       echo "GBK GBK"
+       echo "KSC5601 CP949"
+       echo "sdeckanji EUC-JP"
+       echo "SJIS SHIFT_JIS"
+       echo "TACTIS TIS-620"
+       echo "UTF-8 UTF-8"
+       ;;
+    solaris*)
+       echo "646 ASCII"
+       echo "ISO8859-1 ISO-8859-1"
+       echo "ISO8859-2 ISO-8859-2"
+       echo "ISO8859-3 ISO-8859-3"
+       echo "ISO8859-4 ISO-8859-4"
+       echo "ISO8859-5 ISO-8859-5"
+       echo "ISO8859-6 ISO-8859-6"
+       echo "ISO8859-7 ISO-8859-7"
+       echo "ISO8859-8 ISO-8859-8"
+       echo "ISO8859-9 ISO-8859-9"
+       echo "ISO8859-15 ISO-8859-15"
+       echo "koi8-r KOI8-R"
+       echo "ansi-1251 CP1251"
+       echo "BIG5 BIG5"
+       echo "Big5-HKSCS BIG5-HKSCS"
+       echo "gb2312 GB2312"
+       echo "GBK GBK"
+       echo "GB18030 GB18030"
+       echo "cns11643 EUC-TW"
+       echo "5601 EUC-KR"
+       echo "ko_KR.johap92 JOHAB"
+       echo "eucJP EUC-JP"
+       echo "PCK SHIFT_JIS"
+       echo "TIS620.2533 TIS-620"
+       #echo "sun_eu_greek ?" # what is this?
+       echo "UTF-8 UTF-8"
+       ;;
+    freebsd* | os2*)
+       # FreeBSD 4.2 doesn't have nl_langinfo(CODESET); therefore
+       # localcharset.c falls back to using the full locale name
+       # from the environment variables.
+       # Likewise for OS/2. OS/2 has XFree86 just like FreeBSD. Just
+       # reuse FreeBSD's locale data for OS/2.
+       echo "C ASCII"
+       echo "US-ASCII ASCII"
+       for l in la_LN lt_LN; do
+         echo "$l.ASCII ASCII"
+       done
+       for l in da_DK de_AT de_CH de_DE en_AU en_CA en_GB en_US es_ES \
+                fi_FI fr_BE fr_CA fr_CH fr_FR is_IS it_CH it_IT la_LN \
+                lt_LN nl_BE nl_NL no_NO pt_PT sv_SE; do
+         echo "$l.ISO_8859-1 ISO-8859-1"
+         echo "$l.DIS_8859-15 ISO-8859-15"
+       done
+       for l in cs_CZ hr_HR hu_HU la_LN lt_LN pl_PL sl_SI; do
+         echo "$l.ISO_8859-2 ISO-8859-2"
+       done
+       for l in la_LN lt_LT; do
+         echo "$l.ISO_8859-4 ISO-8859-4"
+       done
+       for l in ru_RU ru_SU; do
+         echo "$l.KOI8-R KOI8-R"
+         echo "$l.ISO_8859-5 ISO-8859-5"
+         echo "$l.CP866 CP866"
+       done
+       echo "uk_UA.KOI8-U KOI8-U"
+       echo "zh_TW.BIG5 BIG5"
+       echo "zh_TW.Big5 BIG5"
+       echo "zh_CN.EUC GB2312"
+       echo "ja_JP.EUC EUC-JP"
+       echo "ja_JP.SJIS SHIFT_JIS"
+       echo "ja_JP.Shift_JIS SHIFT_JIS"
+       echo "ko_KR.EUC EUC-KR"
+       ;;
+    netbsd*)
+       echo "646 ASCII"
+       echo "ISO8859-1 ISO-8859-1"
+       echo "ISO8859-2 ISO-8859-2"
+       echo "ISO8859-4 ISO-8859-4"
+       echo "ISO8859-5 ISO-8859-5"
+       echo "ISO8859-7 ISO-8859-7"
+       echo "ISO8859-13 ISO-8859-13"
+       echo "ISO8859-15 ISO-8859-15"
+       echo "eucCN GB2312"
+       echo "eucJP EUC-JP"
+       echo "eucKR EUC-KR"
+       echo "eucTW EUC-TW"
+       echo "BIG5 BIG5"
+       echo "SJIS SHIFT_JIS"
+       ;;
+    darwin[56]*)
+       # Darwin 6.8 doesn't have nl_langinfo(CODESET); therefore
+       # localcharset.c falls back to using the full locale name
+       # from the environment variables.
+       echo "C ASCII"
+       for l in en_AU en_CA en_GB en_US la_LN; do
+         echo "$l.US-ASCII ASCII"
+       done
+       for l in da_DK de_AT de_CH de_DE en_AU en_CA en_GB en_US es_ES \
+                fi_FI fr_BE fr_CA fr_CH fr_FR is_IS it_CH it_IT nl_BE \
+                nl_NL no_NO pt_PT sv_SE; do
+         echo "$l ISO-8859-1"
+         echo "$l.ISO8859-1 ISO-8859-1"
+         echo "$l.ISO8859-15 ISO-8859-15"
+       done
+       for l in la_LN; do
+         echo "$l.ISO8859-1 ISO-8859-1"
+         echo "$l.ISO8859-15 ISO-8859-15"
+       done
+       for l in cs_CZ hr_HR hu_HU la_LN pl_PL sl_SI; do
+         echo "$l.ISO8859-2 ISO-8859-2"
+       done
+       for l in la_LN lt_LT; do
+         echo "$l.ISO8859-4 ISO-8859-4"
+       done
+       for l in ru_RU; do
+         echo "$l.KOI8-R KOI8-R"
+         echo "$l.ISO8859-5 ISO-8859-5"
+         echo "$l.CP866 CP866"
+       done
+       for l in bg_BG; do
+         echo "$l.CP1251 CP1251"
+       done
+       echo "uk_UA.KOI8-U KOI8-U"
+       echo "zh_TW.BIG5 BIG5"
+       echo "zh_TW.Big5 BIG5"
+       echo "zh_CN.EUC GB2312"
+       echo "ja_JP.EUC EUC-JP"
+       echo "ja_JP.SJIS SHIFT_JIS"
+       echo "ko_KR.EUC EUC-KR"
+       ;;
+    darwin*)
+       # Darwin 7.5 has nl_langinfo(CODESET), but it is useless:
+       # - It returns the empty string when LANG is set to a locale of the
+       #   form ll_CC, although ll_CC/LC_CTYPE is a symlink to an UTF-8
+       #   LC_CTYPE file.
+       # - The environment variables LANG, LC_CTYPE, LC_ALL are not set by
+       #   the system; nl_langinfo(CODESET) returns "US-ASCII" in this case.
+       # - The documentation says:
+       #     "... all code that calls BSD system routines should ensure
+       #      that the const *char parameters of these routines are in UTF-8
+       #      encoding. All BSD system functions expect their string
+       #      parameters to be in UTF-8 encoding and nothing else."
+       #   It also says
+       #     "An additional caveat is that string parameters for files,
+       #      paths, and other file-system entities must be in canonical
+       #      UTF-8. In a canonical UTF-8 Unicode string, all decomposable
+       #      characters are decomposed ..."
+       #   but this is not true: You can pass non-decomposed UTF-8 strings
+       #   to file system functions, and it is the OS which will convert
+       #   them to decomposed UTF-8 before accessing the file system.
+       # - The Apple Terminal application displays UTF-8 by default.
+       # - However, other applications are free to use different encodings:
+       #   - xterm uses ISO-8859-1 by default.
+       #   - TextEdit uses MacRoman by default.
+       # We prefer UTF-8 over decomposed UTF-8-MAC because one should
+       # minimize the use of decomposed Unicode. Unfortunately, through the
+       # Darwin file system, decomposed UTF-8 strings are leaked into user
+       # space nevertheless.
+       echo "* UTF-8"
+       ;;
+    beos*)
+       # BeOS has a single locale, and it has UTF-8 encoding.
+       echo "* UTF-8"
+       ;;
+    msdosdjgpp*)
+       # DJGPP 2.03 doesn't have nl_langinfo(CODESET); therefore
+       # localcharset.c falls back to using the full locale name
+       # from the environment variables.
+       echo "#"
+       echo "# The encodings given here may not all be correct."
+       echo "# If you find that the encoding given for your language and"
+       echo "# country is not the one your DOS machine actually uses, just"
+       echo "# correct it in this file, and send a mail to"
+       echo "# Juan Manuel Guerrero <address@hidden>"
+       echo "# and Bruno Haible <address@hidden>."
+       echo "#"
+       echo "C ASCII"
+       # ISO-8859-1 languages
+       echo "ca CP850"
+       echo "ca_ES CP850"
+       echo "da CP865"    # not CP850 ??
+       echo "da_DK CP865" # not CP850 ??
+       echo "de CP850"
+       echo "de_AT CP850"
+       echo "de_CH CP850"
+       echo "de_DE CP850"
+       echo "en CP850"
+       echo "en_AU CP850" # not CP437 ??
+       echo "en_CA CP850"
+       echo "en_GB CP850"
+       echo "en_NZ CP437"
+       echo "en_US CP437"
+       echo "en_ZA CP850" # not CP437 ??
+       echo "es CP850"
+       echo "es_AR CP850"
+       echo "es_BO CP850"
+       echo "es_CL CP850"
+       echo "es_CO CP850"
+       echo "es_CR CP850"
+       echo "es_CU CP850"
+       echo "es_DO CP850"
+       echo "es_EC CP850"
+       echo "es_ES CP850"
+       echo "es_GT CP850"
+       echo "es_HN CP850"
+       echo "es_MX CP850"
+       echo "es_NI CP850"
+       echo "es_PA CP850"
+       echo "es_PY CP850"
+       echo "es_PE CP850"
+       echo "es_SV CP850"
+       echo "es_UY CP850"
+       echo "es_VE CP850"
+       echo "et CP850"
+       echo "et_EE CP850"
+       echo "eu CP850"
+       echo "eu_ES CP850"
+       echo "fi CP850"
+       echo "fi_FI CP850"
+       echo "fr CP850"
+       echo "fr_BE CP850"
+       echo "fr_CA CP850"
+       echo "fr_CH CP850"
+       echo "fr_FR CP850"
+       echo "ga CP850"
+       echo "ga_IE CP850"
+       echo "gd CP850"
+       echo "gd_GB CP850"
+       echo "gl CP850"
+       echo "gl_ES CP850"
+       echo "id CP850"    # not CP437 ??
+       echo "id_ID CP850" # not CP437 ??
+       echo "is CP861"    # not CP850 ??
+       echo "is_IS CP861" # not CP850 ??
+       echo "it CP850"
+       echo "it_CH CP850"
+       echo "it_IT CP850"
+       echo "lt CP775"
+       echo "lt_LT CP775"
+       echo "lv CP775"
+       echo "lv_LV CP775"
+       echo "nb CP865"    # not CP850 ??
+       echo "nb_NO CP865" # not CP850 ??
+       echo "nl CP850"
+       echo "nl_BE CP850"
+       echo "nl_NL CP850"
+       echo "nn CP865"    # not CP850 ??
+       echo "nn_NO CP865" # not CP850 ??
+       echo "no CP865"    # not CP850 ??
+       echo "no_NO CP865" # not CP850 ??
+       echo "pt CP850"
+       echo "pt_BR CP850"
+       echo "pt_PT CP850"
+       echo "sv CP850"
+       echo "sv_SE CP850"
+       # ISO-8859-2 languages
+       echo "cs CP852"
+       echo "cs_CZ CP852"
+       echo "hr CP852"
+       echo "hr_HR CP852"
+       echo "hu CP852"
+       echo "hu_HU CP852"
+       echo "pl CP852"
+       echo "pl_PL CP852"
+       echo "ro CP852"
+       echo "ro_RO CP852"
+       echo "sk CP852"
+       echo "sk_SK CP852"
+       echo "sl CP852"
+       echo "sl_SI CP852"
+       echo "sq CP852"
+       echo "sq_AL CP852"
+       echo "sr CP852"    # CP852 or CP866 or CP855 ??
+       echo "sr_CS CP852" # CP852 or CP866 or CP855 ??
+       echo "sr_YU CP852" # CP852 or CP866 or CP855 ??
+       # ISO-8859-3 languages
+       echo "mt CP850"
+       echo "mt_MT CP850"
+       # ISO-8859-5 languages
+       echo "be CP866"
+       echo "be_BE CP866"
+       echo "bg CP866"    # not CP855 ??
+       echo "bg_BG CP866" # not CP855 ??
+       echo "mk CP866"    # not CP855 ??
+       echo "mk_MK CP866" # not CP855 ??
+       echo "ru CP866"
+       echo "ru_RU CP866"
+       echo "uk CP1125"
+       echo "uk_UA CP1125"
+       # ISO-8859-6 languages
+       echo "ar CP864"
+       echo "ar_AE CP864"
+       echo "ar_DZ CP864"
+       echo "ar_EG CP864"
+       echo "ar_IQ CP864"
+       echo "ar_IR CP864"
+       echo "ar_JO CP864"
+       echo "ar_KW CP864"
+       echo "ar_MA CP864"
+       echo "ar_OM CP864"
+       echo "ar_QA CP864"
+       echo "ar_SA CP864"
+       echo "ar_SY CP864"
+       # ISO-8859-7 languages
+       echo "el CP869"
+       echo "el_GR CP869"
+       # ISO-8859-8 languages
+       echo "he CP862"
+       echo "he_IL CP862"
+       # ISO-8859-9 languages
+       echo "tr CP857"
+       echo "tr_TR CP857"
+       # Japanese
+       echo "ja CP932"
+       echo "ja_JP CP932"
+       # Chinese
+       echo "zh_CN GBK"
+       echo "zh_TW CP950" # not CP938 ??
+       # Korean
+       echo "kr CP949"    # not CP934 ??
+       echo "kr_KR CP949" # not CP934 ??
+       # Thai
+       echo "th CP874"
+       echo "th_TH CP874"
+       # Other
+       echo "eo CP850"
+       echo "eo_EO CP850"
+       ;;
+esac

Index: dirent_.h
===================================================================
RCS file: dirent_.h
diff -N dirent_.h
--- /dev/null   1 Jan 1970 00:00:00 -0000
+++ dirent_.h   22 Aug 2007 12:48:38 -0000      1.1
@@ -0,0 +1,46 @@
+/* Wrapper around <dirent.h>.
+   Copyright (C) 2006-2007 Free Software Foundation, Inc.
+
+   This program is free software; you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation; either version 2, or (at your option)
+   any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program; if not, write to the Free Software Foundation,
+   Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.  */
+
+#ifndef _GL_DIRENT_H
+
+/* The include_next requires a split double-inclusion guard.  */
address@hidden@ @NEXT_DIRENT_H@
+
+#ifndef _GL_DIRENT_H
+#define _GL_DIRENT_H
+
+
+/* Declare overridden functions.  */
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#if @REPLACE_FCHDIR@
+# define opendir rpl_opendir
+extern DIR * opendir (const char *);
+# define closedir rpl_closedir
+extern int closedir (DIR *);
+#endif
+
+#ifdef __cplusplus
+}
+#endif
+
+
+#endif /* _GL_DIRENT_H */
+#endif /* _GL_DIRENT_H */

Index: dirfd.c
===================================================================
RCS file: dirfd.c
diff -N dirfd.c
--- /dev/null   1 Jan 1970 00:00:00 -0000
+++ dirfd.c     22 Aug 2007 12:48:38 -0000      1.1
@@ -0,0 +1,29 @@
+/* dirfd.c -- return the file descriptor associated with an open DIR*
+
+   Copyright (C) 2001, 2006 Free Software Foundation, Inc.
+
+   This program is free software; you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation; either version 2, or (at your option)
+   any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program; if not, write to the Free Software Foundation,
+   Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.  */
+
+/* Written by Jim Meyering. */
+
+#include <config.h>
+
+#include "dirfd.h"
+
+int
+dirfd (DIR const *dir_p)
+{
+  return DIR_TO_FD (dir_p);
+}

Index: dirfd.h
===================================================================
RCS file: dirfd.h
diff -N dirfd.h
--- /dev/null   1 Jan 1970 00:00:00 -0000
+++ dirfd.h     22 Aug 2007 12:48:38 -0000      1.1
@@ -0,0 +1,29 @@
+/* Declare dirfd, if necessary.
+   Copyright (C) 2001, 2002, 2006 Free Software Foundation, Inc.
+
+   This program is free software; you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation; either version 2, or (at your option)
+   any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program; if not, write to the Free Software Foundation,
+   Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+
+   Written by Jim Meyering.  */
+
+#include <sys/types.h>
+
+#include <dirent.h>
+
+#ifndef HAVE_DECL_DIRFD
+"this configure-time declaration test was not run"
+#endif
+#if !HAVE_DECL_DIRFD && !defined dirfd
+int dirfd (DIR const *);
+#endif

Index: fchdir.c
===================================================================
RCS file: fchdir.c
diff -N fchdir.c
--- /dev/null   1 Jan 1970 00:00:00 -0000
+++ fchdir.c    22 Aug 2007 12:48:39 -0000      1.1
@@ -0,0 +1,279 @@
+/* fchdir replacement.
+   Copyright (C) 2006, 2007 Free Software Foundation, Inc.
+
+   This program is free software; you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation; either version 2, or (at your option)
+   any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program; if not, write to the Free Software Foundation,
+   Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.  */
+
+#include <config.h>
+
+/* Specification.  */
+#include <unistd.h>
+
+#include <errno.h>
+#include <fcntl.h>
+#include <stdarg.h>
+#include <stdlib.h>
+#include <string.h>
+#include <sys/types.h>
+#include <sys/stat.h>
+#include <dirent.h>
+
+#include "canonicalize.h"
+#include "dirfd.h"
+
+/* This replacement assumes that a directory is not renamed while opened
+   through a file descriptor.  */
+
+/* Array of file descriptors opened.  If it points to a directory, it stores
+   info about this directory; otherwise it stores an errno value of ENOTDIR.  
*/
+typedef struct
+{
+  char *name;       /* Absolute name of the directory, or NULL.  */
+  int saved_errno;  /* If name == NULL: The error code describing the failure
+                      reason.  */
+} dir_info_t;
+static dir_info_t *dirs;
+static size_t dirs_allocated;
+
+/* Try to ensure dirs has enough room for a slot at index fd.  */
+static void
+ensure_dirs_slot (size_t fd)
+{
+  if (fd >= dirs_allocated)
+    {
+      size_t new_allocated;
+      dir_info_t *new_dirs;
+      size_t i;
+
+      new_allocated = 2 * dirs_allocated + 1;
+      if (new_allocated <= fd)
+       new_allocated = fd + 1;
+      new_dirs =
+       (dirs != NULL
+        ? (dir_info_t *) realloc (dirs, new_allocated * sizeof (dir_info_t))
+        : (dir_info_t *) malloc (new_allocated * sizeof (dir_info_t)));
+      if (new_dirs != NULL)
+       {
+         for (i = dirs_allocated; i < new_allocated; i++)
+           {
+             new_dirs[i].name = NULL;
+             new_dirs[i].saved_errno = ENOTDIR;
+           }
+         dirs = new_dirs;
+         dirs_allocated = new_allocated;
+       }
+    }
+}
+
+/* Override open() and close(), to keep track of the open file descriptors.  */
+
+int
+close (int fd)
+#undef close
+{
+  int retval = close (fd);
+
+  if (retval >= 0 && fd >= 0 && fd < dirs_allocated)
+    {
+      if (dirs[fd].name != NULL)
+       free (dirs[fd].name);
+      dirs[fd].name = NULL;
+      dirs[fd].saved_errno = ENOTDIR;
+    }
+  return retval;
+}
+
+int
+open (const char *filename, int flags, ...)
+#undef open
+{
+  mode_t mode;
+  int fd;
+  struct stat statbuf;
+
+  mode = 0;
+  if (flags & O_CREAT)
+    {
+      va_list arg;
+      va_start (arg, flags);
+
+      /* If mode_t is narrower than int, use the promoted type (int),
+        not mode_t.  Use sizeof to guess whether mode_t is narrower;
+        we don't know of any practical counterexamples.  */
+      mode = (sizeof (mode_t) < sizeof (int)
+             ? va_arg (arg, int)
+             : va_arg (arg, mode_t));
+
+      va_end (arg);
+    }
+  fd = open (filename, flags, mode);
+  if (fd >= 0)
+    {
+      ensure_dirs_slot (fd);
+      if (fd < dirs_allocated
+         && fstat (fd, &statbuf) >= 0 && S_ISDIR (statbuf.st_mode))
+       {
+         dirs[fd].name = canonicalize_file_name (filename);
+         if (dirs[fd].name == NULL)
+           dirs[fd].saved_errno = errno;
+       }
+    }
+  return fd;
+}
+
+/* Override opendir() and closedir(), to keep track of the open file
+   descriptors.  Needed because there is a function dirfd().  */
+
+int
+closedir (DIR *dp)
+#undef closedir
+{
+  int fd = dirfd (dp);
+  int retval = closedir (dp);
+
+  if (retval >= 0 && fd >= 0 && fd < dirs_allocated)
+    {
+      if (dirs[fd].name != NULL)
+       free (dirs[fd].name);
+      dirs[fd].name = NULL;
+      dirs[fd].saved_errno = ENOTDIR;
+    }
+  return retval;
+}
+
+DIR *
+opendir (const char *filename)
+#undef opendir
+{
+  DIR *dp;
+
+  dp = opendir (filename);
+  if (dp != NULL)
+    {
+      int fd = dirfd (dp);
+      if (fd >= 0)
+       {
+         ensure_dirs_slot (fd);
+         if (fd < dirs_allocated)
+           {
+             dirs[fd].name = canonicalize_file_name (filename);
+             if (dirs[fd].name == NULL)
+               dirs[fd].saved_errno = errno;
+           }
+       }
+    }
+  return dp;
+}
+
+/* Override dup() and dup2(), to keep track of open file descriptors.  */
+
+int
+dup (int oldfd)
+#undef dup
+{
+  int newfd = dup (oldfd);
+
+  if (oldfd >= 0 && newfd >= 0)
+    {
+      ensure_dirs_slot (newfd);
+      if (newfd < dirs_allocated)
+       {
+         if (oldfd < dirs_allocated)
+           {
+             if (dirs[oldfd].name != NULL)
+               {
+                 dirs[newfd].name = strdup (dirs[oldfd].name);
+                 if (dirs[newfd].name == NULL)
+                   dirs[newfd].saved_errno = ENOMEM;
+               }
+             else
+               {
+                 dirs[newfd].name = NULL;
+                 dirs[newfd].saved_errno = dirs[oldfd].saved_errno;
+               }
+           }
+         else
+           {
+             dirs[newfd].name = NULL;
+             dirs[newfd].saved_errno = ENOMEM;
+           }
+       }
+    }
+  return newfd;
+}
+
+int
+dup2 (int oldfd, int newfd)
+#undef dup2
+{
+  int retval = dup2 (oldfd, newfd);
+
+  if (retval >= 0 && oldfd >= 0 && newfd >= 0 && newfd != oldfd)
+    {
+      ensure_dirs_slot (newfd);
+      if (newfd < dirs_allocated)
+       {
+         if (oldfd < dirs_allocated)
+           {
+             if (dirs[oldfd].name != NULL)
+               {
+                 dirs[newfd].name = strdup (dirs[oldfd].name);
+                 if (dirs[newfd].name == NULL)
+                   dirs[newfd].saved_errno = ENOMEM;
+               }
+             else
+               {
+                 dirs[newfd].name = NULL;
+                 dirs[newfd].saved_errno = dirs[oldfd].saved_errno;
+               }
+           }
+         else
+           {
+             dirs[newfd].name = NULL;
+             dirs[newfd].saved_errno = ENOMEM;
+           }
+       }
+    }
+  return retval;
+}
+
+/* Implement fchdir() in terms of chdir().  */
+
+int
+fchdir (int fd)
+{
+  if (fd >= 0)
+    {
+      if (fd < dirs_allocated)
+       {
+         if (dirs[fd].name != NULL)
+           return chdir (dirs[fd].name);
+         else
+           {
+             errno = dirs[fd].saved_errno;
+             return -1;
+           }
+       }
+      else
+       {
+         errno = ENOMEM;
+         return -1;
+       }
+    }
+  else
+    {
+      errno = EBADF;
+      return -1;
+    }
+}

Index: fchownat.c
===================================================================
RCS file: fchownat.c
diff -N fchownat.c
--- /dev/null   1 Jan 1970 00:00:00 -0000
+++ fchownat.c  22 Aug 2007 12:48:39 -0000      1.1
@@ -0,0 +1,49 @@
+/* This function serves as replacement for a missing fchownat function,
+   as well as a work around for the fchownat bug in glibc-2.4:
+    <http://lists.ubuntu.com/archives/ubuntu-users/2006-September/093218.html>
+   when the buggy fchownat-with-AT_SYMLINK_NOFOLLOW operates on a symlink, it
+   mistakenly affects the symlink referent, rather than the symlink itself.
+
+   Copyright (C) 2006-2007 Free Software Foundation, Inc.
+
+   This program is free software; you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation; either version 2, or (at your option)
+   any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program; if not, write to the Free Software Foundation,
+   Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.  */
+
+/* written by Jim Meyering */
+
+#include <config.h>
+
+#include "openat.h"
+
+#include <unistd.h>
+
+#include "dirname.h" /* solely for definition of IS_ABSOLUTE_FILE_NAME */
+#include "save-cwd.h"
+#include "openat-priv.h"
+
+/* Replacement for Solaris' function by the same name.
+   Invoke chown or lchown on file, FILE, using OWNER and GROUP, in the
+   directory open on descriptor FD.  If FLAG is AT_SYMLINK_NOFOLLOW, then
+   use lchown, otherwise, use chown.  If possible, do it without changing
+   the working directory.  Otherwise, resort to using save_cwd/fchdir,
+   then mkdir/restore_cwd.  If either the save_cwd or the restore_cwd
+   fails, then give a diagnostic and exit nonzero.  */
+
+#define AT_FUNC_NAME fchownat
+#define AT_FUNC_F1 lchown
+#define AT_FUNC_F2 chown
+#define AT_FUNC_USE_F1_COND flag == AT_SYMLINK_NOFOLLOW
+#define AT_FUNC_POST_FILE_PARAM_DECLS , uid_t owner, gid_t group, int flag
+#define AT_FUNC_POST_FILE_ARGS        , owner, group
+#include "at-func.c"

Index: float+.h
===================================================================
RCS file: float+.h
diff -N float+.h
--- /dev/null   1 Jan 1970 00:00:00 -0000
+++ float+.h    22 Aug 2007 12:48:39 -0000      1.1
@@ -0,0 +1,148 @@
+/* Supplemental information about the floating-point formats.
+   Copyright (C) 2007 Free Software Foundation, Inc.
+   Written by Bruno Haible <address@hidden>, 2007.
+
+   This program is free software; you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation; either version 2, or (at your option)
+   any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program; if not, write to the Free Software Foundation,
+   Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.  */
+
+#ifndef _FLOATPLUS_H
+#define _FLOATPLUS_H
+
+#include <float.h>
+#include <limits.h>
+
+/* Number of bits in the mantissa of a floating-point number, including the
+   "hidden bit".  */
+#if FLT_RADIX == 2
+# define FLT_MANT_BIT FLT_MANT_DIG
+# define DBL_MANT_BIT DBL_MANT_DIG
+# define LDBL_MANT_BIT LDBL_MANT_DIG
+#elif FLT_RADIX == 4
+# define FLT_MANT_BIT (FLT_MANT_DIG * 2)
+# define DBL_MANT_BIT (DBL_MANT_DIG * 2)
+# define LDBL_MANT_BIT (LDBL_MANT_DIG * 2)
+#elif FLT_RADIX == 16
+# define FLT_MANT_BIT (FLT_MANT_DIG * 4)
+# define DBL_MANT_BIT (DBL_MANT_DIG * 4)
+# define LDBL_MANT_BIT (LDBL_MANT_DIG * 4)
+#endif
+
+/* Bit mask that can be used to mask the exponent, as an unsigned number.  */
+#define FLT_EXP_MASK ((FLT_MAX_EXP - FLT_MIN_EXP) | 7)
+#define DBL_EXP_MASK ((DBL_MAX_EXP - DBL_MIN_EXP) | 7)
+#define LDBL_EXP_MASK ((LDBL_MAX_EXP - LDBL_MIN_EXP) | 7)
+
+/* Number of bits used for the exponent of a floating-point number, including
+   the exponent's sign.  */
+#define FLT_EXP_BIT \
+  (FLT_EXP_MASK < 0x100 ? 8 : \
+   FLT_EXP_MASK < 0x200 ? 9 : \
+   FLT_EXP_MASK < 0x400 ? 10 : \
+   FLT_EXP_MASK < 0x800 ? 11 : \
+   FLT_EXP_MASK < 0x1000 ? 12 : \
+   FLT_EXP_MASK < 0x2000 ? 13 : \
+   FLT_EXP_MASK < 0x4000 ? 14 : \
+   FLT_EXP_MASK < 0x8000 ? 15 : \
+   FLT_EXP_MASK < 0x10000 ? 16 : \
+   FLT_EXP_MASK < 0x20000 ? 17 : \
+   FLT_EXP_MASK < 0x40000 ? 18 : \
+   FLT_EXP_MASK < 0x80000 ? 19 : \
+   FLT_EXP_MASK < 0x100000 ? 20 : \
+   FLT_EXP_MASK < 0x200000 ? 21 : \
+   FLT_EXP_MASK < 0x400000 ? 22 : \
+   FLT_EXP_MASK < 0x800000 ? 23 : \
+   FLT_EXP_MASK < 0x1000000 ? 24 : \
+   FLT_EXP_MASK < 0x2000000 ? 25 : \
+   FLT_EXP_MASK < 0x4000000 ? 26 : \
+   FLT_EXP_MASK < 0x8000000 ? 27 : \
+   FLT_EXP_MASK < 0x10000000 ? 28 : \
+   FLT_EXP_MASK < 0x20000000 ? 29 : \
+   FLT_EXP_MASK < 0x40000000 ? 30 : \
+   FLT_EXP_MASK <= 0x7fffffff ? 31 : \
+   32)
+#define DBL_EXP_BIT \
+  (DBL_EXP_MASK < 0x100 ? 8 : \
+   DBL_EXP_MASK < 0x200 ? 9 : \
+   DBL_EXP_MASK < 0x400 ? 10 : \
+   DBL_EXP_MASK < 0x800 ? 11 : \
+   DBL_EXP_MASK < 0x1000 ? 12 : \
+   DBL_EXP_MASK < 0x2000 ? 13 : \
+   DBL_EXP_MASK < 0x4000 ? 14 : \
+   DBL_EXP_MASK < 0x8000 ? 15 : \
+   DBL_EXP_MASK < 0x10000 ? 16 : \
+   DBL_EXP_MASK < 0x20000 ? 17 : \
+   DBL_EXP_MASK < 0x40000 ? 18 : \
+   DBL_EXP_MASK < 0x80000 ? 19 : \
+   DBL_EXP_MASK < 0x100000 ? 20 : \
+   DBL_EXP_MASK < 0x200000 ? 21 : \
+   DBL_EXP_MASK < 0x400000 ? 22 : \
+   DBL_EXP_MASK < 0x800000 ? 23 : \
+   DBL_EXP_MASK < 0x1000000 ? 24 : \
+   DBL_EXP_MASK < 0x2000000 ? 25 : \
+   DBL_EXP_MASK < 0x4000000 ? 26 : \
+   DBL_EXP_MASK < 0x8000000 ? 27 : \
+   DBL_EXP_MASK < 0x10000000 ? 28 : \
+   DBL_EXP_MASK < 0x20000000 ? 29 : \
+   DBL_EXP_MASK < 0x40000000 ? 30 : \
+   DBL_EXP_MASK <= 0x7fffffff ? 31 : \
+   32)
+#define LDBL_EXP_BIT \
+  (LDBL_EXP_MASK < 0x100 ? 8 : \
+   LDBL_EXP_MASK < 0x200 ? 9 : \
+   LDBL_EXP_MASK < 0x400 ? 10 : \
+   LDBL_EXP_MASK < 0x800 ? 11 : \
+   LDBL_EXP_MASK < 0x1000 ? 12 : \
+   LDBL_EXP_MASK < 0x2000 ? 13 : \
+   LDBL_EXP_MASK < 0x4000 ? 14 : \
+   LDBL_EXP_MASK < 0x8000 ? 15 : \
+   LDBL_EXP_MASK < 0x10000 ? 16 : \
+   LDBL_EXP_MASK < 0x20000 ? 17 : \
+   LDBL_EXP_MASK < 0x40000 ? 18 : \
+   LDBL_EXP_MASK < 0x80000 ? 19 : \
+   LDBL_EXP_MASK < 0x100000 ? 20 : \
+   LDBL_EXP_MASK < 0x200000 ? 21 : \
+   LDBL_EXP_MASK < 0x400000 ? 22 : \
+   LDBL_EXP_MASK < 0x800000 ? 23 : \
+   LDBL_EXP_MASK < 0x1000000 ? 24 : \
+   LDBL_EXP_MASK < 0x2000000 ? 25 : \
+   LDBL_EXP_MASK < 0x4000000 ? 26 : \
+   LDBL_EXP_MASK < 0x8000000 ? 27 : \
+   LDBL_EXP_MASK < 0x10000000 ? 28 : \
+   LDBL_EXP_MASK < 0x20000000 ? 29 : \
+   LDBL_EXP_MASK < 0x40000000 ? 30 : \
+   LDBL_EXP_MASK <= 0x7fffffff ? 31 : \
+   32)
+
+/* Number of bits used for a floating-point number: the mantissa (not
+   counting the "hidden bit", since it may or may not be explicit), the
+   exponent, and the sign.  */
+#define FLT_TOTAL_BIT ((FLT_MANT_BIT - 1) + FLT_EXP_BIT + 1)
+#define DBL_TOTAL_BIT ((DBL_MANT_BIT - 1) + DBL_EXP_BIT + 1)
+#define LDBL_TOTAL_BIT ((LDBL_MANT_BIT - 1) + LDBL_EXP_BIT + 1)
+
+/* Number of bytes used for a floating-point number.
+   This can be smaller than the 'sizeof'.  For example, on i386 systems,
+   'long double' most often have LDBL_MANT_BIT = 64, LDBL_EXP_BIT = 16, hence
+   LDBL_TOTAL_BIT = 80 bits, i.e. 10 bytes of consecutive memory, but
+   sizeof (long double) = 12 or = 16.  */
+#define SIZEOF_FLT ((FLT_TOTAL_BIT + CHAR_BIT - 1) / CHAR_BIT)
+#define SIZEOF_DBL ((DBL_TOTAL_BIT + CHAR_BIT - 1) / CHAR_BIT)
+#define SIZEOF_LDBL ((LDBL_TOTAL_BIT + CHAR_BIT - 1) / CHAR_BIT)
+
+/* Verify that SIZEOF_FLT <= sizeof (float) etc.  */
+typedef int verify_sizeof_flt[2 * (SIZEOF_FLT <= sizeof (float)) - 1];
+typedef int verify_sizeof_dbl[2 * (SIZEOF_DBL <= sizeof (double)) - 1];
+typedef int verify_sizeof_ldbl[2 * (SIZEOF_LDBL <= sizeof (long double)) - 1];
+
+#endif /* _FLOATPLUS_H */

Index: float_.h
===================================================================
RCS file: float_.h
diff -N float_.h
--- /dev/null   1 Jan 1970 00:00:00 -0000
+++ float_.h    22 Aug 2007 12:48:39 -0000      1.1
@@ -0,0 +1,59 @@
+/* A correct <float.h>.
+
+   Copyright (C) 2007 Free Software Foundation, Inc.
+
+   This program is free software; you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation; either version 2, or (at your option)
+   any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program; if not, write to the Free Software Foundation,
+   Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.  */
+
+#ifndef _GL_FLOAT_H
+
+/* The include_next requires a split double-inclusion guard.  */
address@hidden@ @NEXT_FLOAT_H@
+
+#ifndef _GL_FLOAT_H
+#define _GL_FLOAT_H
+
+/* 'long double' properties.  */
+#if defined __i386__ && defined __BEOS__
+/* Number of mantissa units, in base FLT_RADIX.  */
+# undef LDBL_MANT_DIG
+# define LDBL_MANT_DIG   64
+/* Number of decimal digits that is sufficient for representing a number.  */
+# undef LDBL_DIG
+# define LDBL_DIG        18
+/* x-1 where x is the smallest representable number > 1.  */
+# undef LDBL_EPSILON
+# define LDBL_EPSILON    1.0842021724855044340E-19L
+/* Minimum e such that FLT_RADIX^(e-1) is a normalized number.  */
+# undef LDBL_MIN_EXP
+# define LDBL_MIN_EXP    (-16381)
+/* Maximum e such that FLT_RADIX^(e-1) is a representable finite number.  */
+# undef LDBL_MAX_EXP
+# define LDBL_MAX_EXP    16384
+/* Minimum positive normalized number.  */
+# undef LDBL_MIN
+# define LDBL_MIN        3.3621031431120935063E-4932L
+/* Maximum representable finite number.  */
+# undef LDBL_MAX
+# define LDBL_MAX        1.1897314953572317650E+4932L
+/* Minimum e such that 10^e is in the range of normalized numbers.  */
+# undef LDBL_MIN_10_EXP
+# define LDBL_MIN_10_EXP (-4931)
+/* Maximum e such that 10^e is in the range of representable finite numbers.  
*/
+# undef LDBL_MAX_10_EXP
+# define LDBL_MAX_10_EXP 4932
+#endif
+
+#endif /* _GL_FLOAT_H */
+#endif /* _GL_FLOAT_H */

Index: fstatat.c
===================================================================
RCS file: fstatat.c
diff -N fstatat.c
--- /dev/null   1 Jan 1970 00:00:00 -0000
+++ fstatat.c   22 Aug 2007 12:48:39 -0000      1.1
@@ -0,0 +1,57 @@
+/* Work around an fstatat bug on Solaris 9.
+
+   Copyright (C) 2006 Free Software Foundation, Inc.
+
+   This program is free software; you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation; either version 2, or (at your option)
+   any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program; if not, write to the Free Software Foundation,
+   Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.  */
+
+/* Written by Paul Eggert and Jim Meyering.  */
+
+#include <config.h>
+
+#define COMPILING_FSTATAT 1
+#include "openat.h"
+
+#include <errno.h>
+#include <string.h>
+
+/* fstatat should always follow symbolic links that end in /, but on
+   Solaris 9 it doesn't if AT_SYMLINK_NOFOLLOW is specified.  This is
+   the same problem that lstat.c addresses, so solve it in a similar
+   way.  */
+
+int
+rpl_fstatat (int fd, char const *file, struct stat *st, int flag)
+{
+  int result = fstatat (fd, file, st, flag);
+
+  if (result == 0 && (flag & AT_SYMLINK_NOFOLLOW) && S_ISLNK (st->st_mode)
+      && file[strlen (file) - 1] == '/')
+    {
+      /* FILE refers to a symbolic link and the name ends with a slash.
+        Get info about the link's referent.  */
+      result = fstatat (fd, file, st, flag & ~AT_SYMLINK_NOFOLLOW);
+      if (result == 0 && ! S_ISDIR (st->st_mode))
+       {
+         /* fstatat succeeded and FILE references a non-directory.
+            But it was specified via a name including a trailing
+            slash.  Fail with errno set to ENOTDIR to indicate the
+            contradiction.  */
+         errno = ENOTDIR;
+         return -1;
+       }
+    }
+
+  return result;
+}

Index: localcharset.c
===================================================================
RCS file: localcharset.c
diff -N localcharset.c
--- /dev/null   1 Jan 1970 00:00:00 -0000
+++ localcharset.c      22 Aug 2007 12:48:41 -0000      1.1
@@ -0,0 +1,460 @@
+/* Determine a canonical name for the current locale's character encoding.
+
+   Copyright (C) 2000-2006 Free Software Foundation, Inc.
+
+   This program is free software; you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation; either version 2, or (at your option)
+   any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License along
+   with this program; if not, write to the Free Software Foundation,
+   Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.  */
+
+/* Written by Bruno Haible <address@hidden>.  */
+
+#include <config.h>
+
+/* Specification.  */
+#include "localcharset.h"
+
+#include <stddef.h>
+#include <stdio.h>
+#include <string.h>
+#include <stdlib.h>
+
+#if defined _WIN32 || defined __WIN32__
+# define WIN32_NATIVE
+#endif
+
+#if defined __EMX__
+/* Assume EMX program runs on OS/2, even if compiled under DOS.  */
+# define OS2
+#endif
+
+#if !defined WIN32_NATIVE
+# if HAVE_LANGINFO_CODESET
+#  include <langinfo.h>
+# else
+#  if 0 /* see comment below */
+#   include <locale.h>
+#  endif
+# endif
+# ifdef __CYGWIN__
+#  define WIN32_LEAN_AND_MEAN
+#  include <windows.h>
+# endif
+#elif defined WIN32_NATIVE
+# define WIN32_LEAN_AND_MEAN
+# include <windows.h>
+#endif
+#if defined OS2
+# define INCL_DOS
+# include <os2.h>
+#endif
+
+#if ENABLE_RELOCATABLE
+# include "relocatable.h"
+#else
+# define relocate(pathname) (pathname)
+#endif
+
+/* Get LIBDIR.  */
+#ifndef LIBDIR
+# include "configmake.h"
+#endif
+
+#if defined _WIN32 || defined __WIN32__ || defined __CYGWIN__ || defined 
__EMX__ || defined __DJGPP__
+  /* Win32, Cygwin, OS/2, DOS */
+# define ISSLASH(C) ((C) == '/' || (C) == '\\')
+#endif
+
+#ifndef DIRECTORY_SEPARATOR
+# define DIRECTORY_SEPARATOR '/'
+#endif
+
+#ifndef ISSLASH
+# define ISSLASH(C) ((C) == DIRECTORY_SEPARATOR)
+#endif
+
+#if HAVE_DECL_GETC_UNLOCKED
+# undef getc
+# define getc getc_unlocked
+#endif
+
+/* The following static variable is declared 'volatile' to avoid a
+   possible multithread problem in the function get_charset_aliases. If we
+   are running in a threaded environment, and if two threads initialize
+   'charset_aliases' simultaneously, both will produce the same value,
+   and everything will be ok if the two assignments to 'charset_aliases'
+   are atomic. But I don't know what will happen if the two assignments mix.  
*/
+#if __STDC__ != 1
+# define volatile /* empty */
+#endif
+/* Pointer to the contents of the charset.alias file, if it has already been
+   read, else NULL.  Its format is:
+   ALIAS_1 '\0' CANONICAL_1 '\0' ... ALIAS_n '\0' CANONICAL_n '\0' '\0'  */
+static const char * volatile charset_aliases;
+
+/* Return a pointer to the contents of the charset.alias file.  */
+static const char *
+get_charset_aliases (void)
+{
+  const char *cp;
+
+  cp = charset_aliases;
+  if (cp == NULL)
+    {
+#if !(defined VMS || defined WIN32_NATIVE || defined __CYGWIN__)
+      FILE *fp;
+      const char *dir;
+      const char *base = "charset.alias";
+      char *file_name;
+
+      /* Make it possible to override the charset.alias location.  This is
+        necessary for running the testsuite before "make install".  */
+      dir = getenv ("CHARSETALIASDIR");
+      if (dir == NULL || dir[0] == '\0')
+       dir = relocate (LIBDIR);
+
+      /* Concatenate dir and base into freshly allocated file_name.  */
+      {
+       size_t dir_len = strlen (dir);
+       size_t base_len = strlen (base);
+       int add_slash = (dir_len > 0 && !ISSLASH (dir[dir_len - 1]));
+       file_name = (char *) malloc (dir_len + add_slash + base_len + 1);
+       if (file_name != NULL)
+         {
+           memcpy (file_name, dir, dir_len);
+           if (add_slash)
+             file_name[dir_len] = DIRECTORY_SEPARATOR;
+           memcpy (file_name + dir_len + add_slash, base, base_len + 1);
+         }
+      }
+
+      if (file_name == NULL || (fp = fopen (file_name, "r")) == NULL)
+       /* Out of memory or file not found, treat it as empty.  */
+       cp = "";
+      else
+       {
+         /* Parse the file's contents.  */
+         char *res_ptr = NULL;
+         size_t res_size = 0;
+
+         for (;;)
+           {
+             int c;
+             char buf1[50+1];
+             char buf2[50+1];
+             size_t l1, l2;
+             char *old_res_ptr;
+
+             c = getc (fp);
+             if (c == EOF)
+               break;
+             if (c == '\n' || c == ' ' || c == '\t')
+               continue;
+             if (c == '#')
+               {
+                 /* Skip comment, to end of line.  */
+                 do
+                   c = getc (fp);
+                 while (!(c == EOF || c == '\n'));
+                 if (c == EOF)
+                   break;
+                 continue;
+               }
+             ungetc (c, fp);
+             if (fscanf (fp, "%50s %50s", buf1, buf2) < 2)
+               break;
+             l1 = strlen (buf1);
+             l2 = strlen (buf2);
+             old_res_ptr = res_ptr;
+             if (res_size == 0)
+               {
+                 res_size = l1 + 1 + l2 + 1;
+                 res_ptr = (char *) malloc (res_size + 1);
+               }
+             else
+               {
+                 res_size += l1 + 1 + l2 + 1;
+                 res_ptr = (char *) realloc (res_ptr, res_size + 1);
+               }
+             if (res_ptr == NULL)
+               {
+                 /* Out of memory. */
+                 res_size = 0;
+                 if (old_res_ptr != NULL)
+                   free (old_res_ptr);
+                 break;
+               }
+             strcpy (res_ptr + res_size - (l2 + 1) - (l1 + 1), buf1);
+             strcpy (res_ptr + res_size - (l2 + 1), buf2);
+           }
+         fclose (fp);
+         if (res_size == 0)
+           cp = "";
+         else
+           {
+             *(res_ptr + res_size) = '\0';
+             cp = res_ptr;
+           }
+       }
+
+      if (file_name != NULL)
+       free (file_name);
+
+#else
+
+# if defined VMS
+      /* To avoid the troubles of an extra file charset.alias_vms in the
+        sources of many GNU packages, simply inline the aliases here.  */
+      /* The list of encodings is taken from the OpenVMS 7.3-1 documentation
+        "Compaq C Run-Time Library Reference Manual for OpenVMS systems"
+        section 10.7 "Handling Different Character Sets".  */
+      cp = "ISO8859-1" "\0" "ISO-8859-1" "\0"
+          "ISO8859-2" "\0" "ISO-8859-2" "\0"
+          "ISO8859-5" "\0" "ISO-8859-5" "\0"
+          "ISO8859-7" "\0" "ISO-8859-7" "\0"
+          "ISO8859-8" "\0" "ISO-8859-8" "\0"
+          "ISO8859-9" "\0" "ISO-8859-9" "\0"
+          /* Japanese */
+          "eucJP" "\0" "EUC-JP" "\0"
+          "SJIS" "\0" "SHIFT_JIS" "\0"
+          "DECKANJI" "\0" "DEC-KANJI" "\0"
+          "SDECKANJI" "\0" "EUC-JP" "\0"
+          /* Chinese */
+          "eucTW" "\0" "EUC-TW" "\0"
+          "DECHANYU" "\0" "DEC-HANYU" "\0"
+          "DECHANZI" "\0" "GB2312" "\0"
+          /* Korean */
+          "DECKOREAN" "\0" "EUC-KR" "\0";
+# endif
+
+# if defined WIN32_NATIVE || defined __CYGWIN__
+      /* To avoid the troubles of installing a separate file in the same
+        directory as the DLL and of retrieving the DLL's directory at
+        runtime, simply inline the aliases here.  */
+
+      cp = "CP936" "\0" "GBK" "\0"
+          "CP1361" "\0" "JOHAB" "\0"
+          "CP20127" "\0" "ASCII" "\0"
+          "CP20866" "\0" "KOI8-R" "\0"
+          "CP20936" "\0" "GB2312" "\0"
+          "CP21866" "\0" "KOI8-RU" "\0"
+          "CP28591" "\0" "ISO-8859-1" "\0"
+          "CP28592" "\0" "ISO-8859-2" "\0"
+          "CP28593" "\0" "ISO-8859-3" "\0"
+          "CP28594" "\0" "ISO-8859-4" "\0"
+          "CP28595" "\0" "ISO-8859-5" "\0"
+          "CP28596" "\0" "ISO-8859-6" "\0"
+          "CP28597" "\0" "ISO-8859-7" "\0"
+          "CP28598" "\0" "ISO-8859-8" "\0"
+          "CP28599" "\0" "ISO-8859-9" "\0"
+          "CP28605" "\0" "ISO-8859-15" "\0"
+          "CP38598" "\0" "ISO-8859-8" "\0"
+          "CP51932" "\0" "EUC-JP" "\0"
+          "CP51936" "\0" "GB2312" "\0"
+          "CP51949" "\0" "EUC-KR" "\0"
+          "CP51950" "\0" "EUC-TW" "\0"
+          "CP54936" "\0" "GB18030" "\0"
+          "CP65001" "\0" "UTF-8" "\0";
+# endif
+#endif
+
+      charset_aliases = cp;
+    }
+
+  return cp;
+}
+
+/* Determine the current locale's character encoding, and canonicalize it
+   into one of the canonical names listed in config.charset.
+   The result must not be freed; it is statically allocated.
+   If the canonical name cannot be determined, the result is a non-canonical
+   name.  */
+
+#ifdef STATIC
+STATIC
+#endif
+const char *
+locale_charset (void)
+{
+  const char *codeset;
+  const char *aliases;
+
+#if !(defined WIN32_NATIVE || defined OS2)
+
+# if HAVE_LANGINFO_CODESET
+
+  /* Most systems support nl_langinfo (CODESET) nowadays.  */
+  codeset = nl_langinfo (CODESET);
+
+#  ifdef __CYGWIN__
+  /* Cygwin 2006 does not have locales.  nl_langinfo (CODESET) always
+     returns "US-ASCII".  As long as this is not fixed, return the suffix
+     of the locale name from the environment variables (if present) or
+     the codepage as a number.  */
+  if (codeset != NULL && strcmp (codeset, "US-ASCII") == 0)
+    {
+      const char *locale;
+      static char buf[2 + 10 + 1];
+
+      locale = getenv ("LC_ALL");
+      if (locale == NULL || locale[0] == '\0')
+       {
+         locale = getenv ("LC_CTYPE");
+         if (locale == NULL || locale[0] == '\0')
+           locale = getenv ("LANG");
+       }
+      if (locale != NULL && locale[0] != '\0')
+       {
+         /* If the locale name contains an encoding after the dot, return
+            it.  */
+         const char *dot = strchr (locale, '.');
+
+         if (dot != NULL)
+           {
+             const char *modifier;
+
+             dot++;
+             /* Look for the possible @... trailer and remove it, if any.  */
+             modifier = strchr (dot, '@');
+             if (modifier == NULL)
+               return dot;
+             if (modifier - dot < sizeof (buf))
+               {
+                 memcpy (buf, dot, modifier - dot);
+                 buf [modifier - dot] = '\0';
+                 return buf;
+               }
+           }
+       }
+
+      /* Woe32 has a function returning the locale's codepage as a number.  */
+      sprintf (buf, "CP%u", GetACP ());
+      codeset = buf;
+    }
+#  endif
+
+# else
+
+  /* On old systems which lack it, use setlocale or getenv.  */
+  const char *locale = NULL;
+
+  /* But most old systems don't have a complete set of locales.  Some
+     (like SunOS 4 or DJGPP) have only the C locale.  Therefore we don't
+     use setlocale here; it would return "C" when it doesn't support the
+     locale name the user has set.  */
+#  if 0
+  locale = setlocale (LC_CTYPE, NULL);
+#  endif
+  if (locale == NULL || locale[0] == '\0')
+    {
+      locale = getenv ("LC_ALL");
+      if (locale == NULL || locale[0] == '\0')
+       {
+         locale = getenv ("LC_CTYPE");
+         if (locale == NULL || locale[0] == '\0')
+           locale = getenv ("LANG");
+       }
+    }
+
+  /* On some old systems, one used to set locale = "iso8859_1". On others,
+     you set it to "language_COUNTRY.charset". In any case, we resolve it
+     through the charset.alias file.  */
+  codeset = locale;
+
+# endif
+
+#elif defined WIN32_NATIVE
+
+  static char buf[2 + 10 + 1];
+
+  /* Woe32 has a function returning the locale's codepage as a number.  */
+  sprintf (buf, "CP%u", GetACP ());
+  codeset = buf;
+
+#elif defined OS2
+
+  const char *locale;
+  static char buf[2 + 10 + 1];
+  ULONG cp[3];
+  ULONG cplen;
+
+  /* Allow user to override the codeset, as set in the operating system,
+     with standard language environment variables.  */
+  locale = getenv ("LC_ALL");
+  if (locale == NULL || locale[0] == '\0')
+    {
+      locale = getenv ("LC_CTYPE");
+      if (locale == NULL || locale[0] == '\0')
+       locale = getenv ("LANG");
+    }
+  if (locale != NULL && locale[0] != '\0')
+    {
+      /* If the locale name contains an encoding after the dot, return it.  */
+      const char *dot = strchr (locale, '.');
+
+      if (dot != NULL)
+       {
+         const char *modifier;
+
+         dot++;
+         /* Look for the possible @... trailer and remove it, if any.  */
+         modifier = strchr (dot, '@');
+         if (modifier == NULL)
+           return dot;
+         if (modifier - dot < sizeof (buf))
+           {
+             memcpy (buf, dot, modifier - dot);
+             buf [modifier - dot] = '\0';
+             return buf;
+           }
+       }
+
+      /* Resolve through the charset.alias file.  */
+      codeset = locale;
+    }
+  else
+    {
+      /* OS/2 has a function returning the locale's codepage as a number.  */
+      if (DosQueryCp (sizeof (cp), cp, &cplen))
+       codeset = "";
+      else
+       {
+         sprintf (buf, "CP%u", cp[0]);
+         codeset = buf;
+       }
+    }
+
+#endif
+
+  if (codeset == NULL)
+    /* The canonical name cannot be determined.  */
+    codeset = "";
+
+  /* Resolve alias. */
+  for (aliases = get_charset_aliases ();
+       *aliases != '\0';
+       aliases += strlen (aliases) + 1, aliases += strlen (aliases) + 1)
+    if (strcmp (codeset, aliases) == 0
+       || (aliases[0] == '*' && aliases[1] == '\0'))
+      {
+       codeset = aliases + strlen (aliases) + 1;
+       break;
+      }
+
+  /* Don't return an empty string.  GNU libc and GNU libiconv interpret
+     the empty string as denoting "the locale's character encoding",
+     thus GNU libiconv would call this function a second time.  */
+  if (codeset[0] == '\0')
+    codeset = "ASCII";
+
+  return codeset;
+}

Index: localcharset.h
===================================================================
RCS file: localcharset.h
diff -N localcharset.h
--- /dev/null   1 Jan 1970 00:00:00 -0000
+++ localcharset.h      22 Aug 2007 12:48:41 -0000      1.1
@@ -0,0 +1,41 @@
+/* Determine a canonical name for the current locale's character encoding.
+   Copyright (C) 2000-2003 Free Software Foundation, Inc.
+   This file is part of the GNU CHARSET Library.
+
+   This program is free software; you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation; either version 2, or (at your option)
+   any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License along
+   with this program; if not, write to the Free Software Foundation,
+   Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.  */
+
+#ifndef _LOCALCHARSET_H
+#define _LOCALCHARSET_H
+
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+
+/* Determine the current locale's character encoding, and canonicalize it
+   into one of the canonical names listed in config.charset.
+   The result must not be freed; it is statically allocated.
+   If the canonical name cannot be determined, the result is a non-canonical
+   name.  */
+extern const char * locale_charset (void);
+
+
+#ifdef __cplusplus
+}
+#endif
+
+
+#endif /* _LOCALCHARSET_H */

Index: malloca.c
===================================================================
RCS file: malloca.c
diff -N malloca.c
--- /dev/null   1 Jan 1970 00:00:00 -0000
+++ malloca.c   22 Aug 2007 12:48:41 -0000      1.1
@@ -0,0 +1,137 @@
+/* Safe automatic memory allocation.
+   Copyright (C) 2003, 2006-2007 Free Software Foundation, Inc.
+   Written by Bruno Haible <address@hidden>, 2003.
+
+   This program is free software; you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation; either version 2, or (at your option)
+   any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program; if not, write to the Free Software Foundation,
+   Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.  */
+
+#include <config.h>
+
+/* Specification.  */
+#include "malloca.h"
+
+/* The speed critical point in this file is freea() applied to an alloca()
+   result: it must be fast, to match the speed of alloca().  The speed of
+   mmalloca() and freea() in the other case are not critical, because they
+   are only invoked for big memory sizes.  */
+
+#if HAVE_ALLOCA
+
+/* Store the mmalloca() results in a hash table.  This is needed to reliably
+   distinguish a mmalloca() result and an alloca() result.
+
+   Although it is possible that the same pointer is returned by alloca() and
+   by mmalloca() at different times in the same application, it does not lead
+   to a bug in freea(), because:
+     - Before a pointer returned by alloca() can point into malloc()ed memory,
+       the function must return, and once this has happened the programmer must
+       not call freea() on it anyway.
+     - Before a pointer returned by mmalloca() can point into the stack, it
+       must be freed.  The only function that can free it is freea(), and
+       when freea() frees it, it also removes it from the hash table.  */
+
+#define MAGIC_NUMBER 0x1415fb4a
+#define MAGIC_SIZE sizeof (int)
+/* This is how the header info would look like without any alignment
+   considerations.  */
+struct preliminary_header { void *next; char room[MAGIC_SIZE]; };
+/* But the header's size must be a multiple of sa_alignment_max.  */
+#define HEADER_SIZE \
+  (((sizeof (struct preliminary_header) + sa_alignment_max - 1) / 
sa_alignment_max) * sa_alignment_max)
+struct header { void *next; char room[HEADER_SIZE - sizeof (struct 
preliminary_header) + MAGIC_SIZE]; };
+/* Verify that HEADER_SIZE == sizeof (struct header).  */
+typedef int verify1[2 * (HEADER_SIZE == sizeof (struct header)) - 1];
+/* We make the hash table quite big, so that during lookups the probability
+   of empty hash buckets is quite high.  There is no need to make the hash
+   table resizable, because when the hash table gets filled so much that the
+   lookup becomes slow, it means that the application has memory leaks.  */
+#define HASH_TABLE_SIZE 257
+static void * mmalloca_results[HASH_TABLE_SIZE];
+
+#endif
+
+void *
+mmalloca (size_t n)
+{
+#if HAVE_ALLOCA
+  /* Allocate one more word, that serves as an indicator for malloc()ed
+     memory, so that freea() of an alloca() result is fast.  */
+  size_t nplus = n + HEADER_SIZE;
+
+  if (nplus >= n)
+    {
+      char *p = (char *) malloc (nplus);
+
+      if (p != NULL)
+       {
+         size_t slot;
+
+         p += HEADER_SIZE;
+
+         /* Put a magic number into the indicator word.  */
+         ((int *) p)[-1] = MAGIC_NUMBER;
+
+         /* Enter p into the hash table.  */
+         slot = (unsigned long) p % HASH_TABLE_SIZE;
+         ((struct header *) (p - HEADER_SIZE))->next = mmalloca_results[slot];
+         mmalloca_results[slot] = p;
+
+         return p;
+       }
+    }
+  /* Out of memory.  */
+  return NULL;
+#else
+# if !MALLOC_0_IS_NONNULL
+  if (n == 0)
+    n = 1;
+# endif
+  return malloc (n);
+#endif
+}
+
+#if HAVE_ALLOCA
+void
+freea (void *p)
+{
+  /* mmalloca() may have returned NULL.  */
+  if (p != NULL)
+    {
+      /* Attempt to quickly distinguish the mmalloca() result - which has
+        a magic indicator word - and the alloca() result - which has an
+        uninitialized indicator word.  It is for this test that sa_increment
+        additional bytes are allocated in the alloca() case.  */
+      if (((int *) p)[-1] == MAGIC_NUMBER)
+       {
+         /* Looks like a mmalloca() result.  To see whether it really is one,
+            perform a lookup in the hash table.  */
+         size_t slot = (unsigned long) p % HASH_TABLE_SIZE;
+         void **chain = &mmalloca_results[slot];
+         for (; *chain != NULL;)
+           {
+             if (*chain == p)
+               {
+                 /* Found it.  Remove it from the hash table and free it.  */
+                 char *p_begin = (char *) p - HEADER_SIZE;
+                 *chain = ((struct header *) p_begin)->next;
+                 free (p_begin);
+                 return;
+               }
+             chain = &((struct header *) ((char *) *chain - 
HEADER_SIZE))->next;
+           }
+       }
+      /* At this point, we know it was not a mmalloca() result.  */
+    }
+}
+#endif

Index: malloca.h
===================================================================
RCS file: malloca.h
diff -N malloca.h
--- /dev/null   1 Jan 1970 00:00:00 -0000
+++ malloca.h   22 Aug 2007 12:48:41 -0000      1.1
@@ -0,0 +1,124 @@
+/* Safe automatic memory allocation.
+   Copyright (C) 2003-2007 Free Software Foundation, Inc.
+   Written by Bruno Haible <address@hidden>, 2003.
+
+   This program is free software; you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation; either version 2, or (at your option)
+   any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program; if not, write to the Free Software Foundation,
+   Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.  */
+
+#ifndef _MALLOCA_H
+#define _MALLOCA_H
+
+#include <alloca.h>
+#include <stddef.h>
+#include <stdlib.h>
+
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+
+/* safe_alloca(N) is equivalent to alloca(N) when it is safe to call
+   alloca(N); otherwise it returns NULL.  It either returns N bytes of
+   memory allocated on the stack, that lasts until the function returns,
+   or NULL.
+   Use of safe_alloca should be avoided:
+     - inside arguments of function calls - undefined behaviour,
+     - in inline functions - the allocation may actually last until the
+       calling function returns.
+*/
+#if HAVE_ALLOCA
+/* The OS usually guarantees only one guard page at the bottom of the stack,
+   and a page size can be as small as 4096 bytes.  So we cannot safely
+   allocate anything larger than 4096 bytes.  Also care for the possibility
+   of a few compiler-allocated temporary stack slots.
+   This must be a macro, not an inline function.  */
+# define safe_alloca(N) ((N) < 4032 ? alloca (N) : NULL)
+#else
+# define safe_alloca(N) ((void) (N), NULL)
+#endif
+
+/* malloca(N) is a safe variant of alloca(N).  It allocates N bytes of
+   memory allocated on the stack, that must be freed using freea() before
+   the function returns.  Upon failure, it returns NULL.  */
+#if HAVE_ALLOCA
+# define malloca(N) \
+  ((N) < 4032 - sa_increment                                       \
+   ? (void *) ((char *) alloca ((N) + sa_increment) + sa_increment) \
+   : mmalloca (N))
+#else
+# define malloca(N) \
+  mmalloca (N)
+#endif
+extern void * mmalloca (size_t n);
+
+/* Free a block of memory allocated through malloca().  */
+#if HAVE_ALLOCA
+extern void freea (void *p);
+#else
+# define freea free
+#endif
+
+/* Maybe we should also define a variant
+    nmalloca (size_t n, size_t s) - behaves like malloca (n * s)
+   If this would be useful in your application. please speak up.  */
+
+
+#ifdef __cplusplus
+}
+#endif
+
+
+/* ------------------- Auxiliary, non-public definitions ------------------- */
+
+/* Determine the alignment of a type at compile time.  */
+#if defined __GNUC__
+# define sa_alignof __alignof__
+#elif defined __cplusplus
+  template <class type> struct sa_alignof_helper { char __slot1; type __slot2; 
};
+# define sa_alignof(type) offsetof (sa_alignof_helper<type>, __slot2)
+#elif defined __hpux
+  /* Work around a HP-UX 10.20 cc bug with enums constants defined as offsetof
+     values.  */
+# define sa_alignof(type) (sizeof (type) <= 4 ? 4 : 8)
+#elif defined _AIX
+  /* Work around an AIX 3.2.5 xlc bug with enums constants defined as offsetof
+     values.  */
+# define sa_alignof(type) (sizeof (type) <= 4 ? 4 : 8)
+#else
+# define sa_alignof(type) offsetof (struct { char __slot1; type __slot2; }, 
__slot2)
+#endif
+
+enum
+{
+/* The desired alignment of memory allocations is the maximum alignment
+   among all elementary types.  */
+  sa_alignment_long = sa_alignof (long),
+  sa_alignment_double = sa_alignof (double),
+#if HAVE_LONG_LONG_INT
+  sa_alignment_longlong = sa_alignof (long long),
+#endif
+  sa_alignment_longdouble = sa_alignof (long double),
+  sa_alignment_max = ((sa_alignment_long - 1) | (sa_alignment_double - 1)
+#if HAVE_LONG_LONG_INT
+                     | (sa_alignment_longlong - 1)
+#endif
+                     | (sa_alignment_longdouble - 1)
+                    ) + 1,
+/* The increment that guarantees room for a magic word must be >= sizeof (int)
+   and a multiple of sa_alignment_max.  */
+  sa_increment = ((sizeof (int) + sa_alignment_max - 1) / sa_alignment_max) * 
sa_alignment_max
+};
+
+#endif /* _MALLOCA_H */

Index: malloca.valgrind
===================================================================
RCS file: malloca.valgrind
diff -N malloca.valgrind
--- /dev/null   1 Jan 1970 00:00:00 -0000
+++ malloca.valgrind    22 Aug 2007 12:48:41 -0000      1.1
@@ -0,0 +1,7 @@
+# Suppress a valgrind message about use of uninitialized memory in freea().
+# This use is OK because it provides only a speedup.
+{
+    freea
+    Memcheck:Cond
+    fun:freea
+}

Index: mbslen.c
===================================================================
RCS file: mbslen.c
diff -N mbslen.c
--- /dev/null   1 Jan 1970 00:00:00 -0000
+++ mbslen.c    22 Aug 2007 12:48:42 -0000      1.1
@@ -0,0 +1,49 @@
+/* Counting the multibyte characters in a string.
+   Copyright (C) 2007 Free Software Foundation, Inc.
+   Written by Bruno Haible <address@hidden>, 2007.
+
+   This program is free software; you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation; either version 2, or (at your option)
+   any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program; if not, write to the Free Software Foundation,
+   Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.  */
+
+#include <config.h>
+
+/* Specification.  */
+#include <string.h>
+
+#include <stdlib.h>
+
+#if HAVE_MBRTOWC
+# include "mbuiter.h"
+#endif
+
+/* Return the number of multibyte characters in the character string STRING.  
*/
+size_t
+mbslen (const char *string)
+{
+#if HAVE_MBRTOWC
+  if (MB_CUR_MAX > 1)
+    {
+      size_t count;
+      mbui_iterator_t iter;
+
+      count = 0;
+      for (mbui_init (iter, string); mbui_avail (iter); mbui_advance (iter))
+       count++;
+
+      return count;
+    }
+  else
+#endif
+    return strlen (string);
+}

Index: mbsstr.c
===================================================================
RCS file: mbsstr.c
diff -N mbsstr.c
--- /dev/null   1 Jan 1970 00:00:00 -0000
+++ mbsstr.c    22 Aug 2007 12:48:42 -0000      1.1
@@ -0,0 +1,433 @@
+/* Searching in a string.
+   Copyright (C) 2005-2007 Free Software Foundation, Inc.
+   Written by Bruno Haible <address@hidden>, 2005.
+
+   This program is free software; you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation; either version 2, or (at your option)
+   any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program; if not, write to the Free Software Foundation,
+   Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.  */
+
+#include <config.h>
+
+/* Specification.  */
+#include <string.h>
+
+#include <stdbool.h>
+#include <stddef.h>  /* for NULL, in case a nonstandard string.h lacks it */
+
+#include "malloca.h"
+#if HAVE_MBRTOWC
+# include "mbuiter.h"
+#endif
+
+/* Knuth-Morris-Pratt algorithm.
+   See http://en.wikipedia.org/wiki/Knuth-Morris-Pratt_algorithm
+   Return a boolean indicating success.  */
+
+static bool
+knuth_morris_pratt_unibyte (const char *haystack, const char *needle,
+                           const char **resultp)
+{
+  size_t m = strlen (needle);
+
+  /* Allocate the table.  */
+  size_t *table = (size_t *) malloca (m * sizeof (size_t));
+  if (table == NULL)
+    return false;
+  /* Fill the table.
+     For 0 < i < m:
+       0 < table[i] <= i is defined such that
+       rhaystack[0..i-1] == needle[0..i-1] and rhaystack[i] != needle[i]
+       implies
+       forall 0 <= x < table[i]: rhaystack[x..x+m-1] != needle[0..m-1],
+       and table[i] is as large as possible with this property.
+     table[0] remains uninitialized.  */
+  {
+    size_t i, j;
+
+    table[1] = 1;
+    j = 0;
+    for (i = 2; i < m; i++)
+      {
+       unsigned char b = (unsigned char) needle[i - 1];
+
+       for (;;)
+         {
+           if (b == (unsigned char) needle[j])
+             {
+               table[i] = i - ++j;
+               break;
+             }
+           if (j == 0)
+             {
+               table[i] = i;
+               break;
+             }
+           j = j - table[j];
+         }
+      }
+  }
+
+  /* Search, using the table to accelerate the processing.  */
+  {
+    size_t j;
+    const char *rhaystack;
+    const char *phaystack;
+
+    *resultp = NULL;
+    j = 0;
+    rhaystack = haystack;
+    phaystack = haystack;
+    /* Invariant: phaystack = rhaystack + j.  */
+    while (*phaystack != '\0')
+      if ((unsigned char) needle[j] == (unsigned char) *phaystack)
+       {
+         j++;
+         phaystack++;
+         if (j == m)
+           {
+             /* The entire needle has been found.  */
+             *resultp = rhaystack;
+             break;
+           }
+       }
+      else if (j > 0)
+       {
+         /* Found a match of needle[0..j-1], mismatch at needle[j].  */
+         rhaystack += table[j];
+         j -= table[j];
+       }
+      else
+       {
+         /* Found a mismatch at needle[0] already.  */
+         rhaystack++;
+         phaystack++;
+       }
+  }
+
+  freea (table);
+  return true;
+}
+
+#if HAVE_MBRTOWC
+static bool
+knuth_morris_pratt_multibyte (const char *haystack, const char *needle,
+                             const char **resultp)
+{
+  size_t m = mbslen (needle);
+  mbchar_t *needle_mbchars;
+  size_t *table;
+
+  /* Allocate room for needle_mbchars and the table.  */
+  char *memory = (char *) malloca (m * (sizeof (mbchar_t) + sizeof (size_t)));
+  if (memory == NULL)
+    return false;
+  needle_mbchars = (mbchar_t *) memory;
+  table = (size_t *) (memory + m * sizeof (mbchar_t));
+
+  /* Fill needle_mbchars.  */
+  {
+    mbui_iterator_t iter;
+    size_t j;
+
+    j = 0;
+    for (mbui_init (iter, needle); mbui_avail (iter); mbui_advance (iter), j++)
+      mb_copy (&needle_mbchars[j], &mbui_cur (iter));
+  }
+
+  /* Fill the table.
+     For 0 < i < m:
+       0 < table[i] <= i is defined such that
+       rhaystack[0..i-1] == needle[0..i-1] and rhaystack[i] != needle[i]
+       implies
+       forall 0 <= x < table[i]: rhaystack[x..x+m-1] != needle[0..m-1],
+       and table[i] is as large as possible with this property.
+     table[0] remains uninitialized.  */
+  {
+    size_t i, j;
+
+    table[1] = 1;
+    j = 0;
+    for (i = 2; i < m; i++)
+      {
+       mbchar_t *b = &needle_mbchars[i - 1];
+
+       for (;;)
+         {
+           if (mb_equal (*b, needle_mbchars[j]))
+             {
+               table[i] = i - ++j;
+               break;
+             }
+           if (j == 0)
+             {
+               table[i] = i;
+               break;
+             }
+           j = j - table[j];
+         }
+      }
+  }
+
+  /* Search, using the table to accelerate the processing.  */
+  {
+    size_t j;
+    mbui_iterator_t rhaystack;
+    mbui_iterator_t phaystack;
+
+    *resultp = NULL;
+    j = 0;
+    mbui_init (rhaystack, haystack);
+    mbui_init (phaystack, haystack);
+    /* Invariant: phaystack = rhaystack + j.  */
+    while (mbui_avail (phaystack))
+      if (mb_equal (needle_mbchars[j], mbui_cur (phaystack)))
+       {
+         j++;
+         mbui_advance (phaystack);
+         if (j == m)
+           {
+             /* The entire needle has been found.  */
+             *resultp = mbui_cur_ptr (rhaystack);
+             break;
+           }
+       }
+      else if (j > 0)
+       {
+         /* Found a match of needle[0..j-1], mismatch at needle[j].  */
+         size_t count = table[j];
+         j -= count;
+         for (; count > 0; count--)
+           {
+             if (!mbui_avail (rhaystack))
+               abort ();
+             mbui_advance (rhaystack);
+           }
+       }
+      else
+       {
+         /* Found a mismatch at needle[0] already.  */
+         if (!mbui_avail (rhaystack))
+           abort ();
+         mbui_advance (rhaystack);
+         mbui_advance (phaystack);
+       }
+  }
+
+  freea (memory);
+  return true;
+}
+#endif
+
+/* Find the first occurrence of the character string NEEDLE in the character
+   string HAYSTACK.  Return NULL if NEEDLE is not found in HAYSTACK.  */
+char *
+mbsstr (const char *haystack, const char *needle)
+{
+  /* Be careful not to look at the entire extent of haystack or needle
+     until needed.  This is useful because of these two cases:
+       - haystack may be very long, and a match of needle found early,
+       - needle may be very long, and not even a short initial segment of
+         needle may be found in haystack.  */
+#if HAVE_MBRTOWC
+  if (MB_CUR_MAX > 1)
+    {
+      mbui_iterator_t iter_needle;
+
+      mbui_init (iter_needle, needle);
+      if (mbui_avail (iter_needle))
+       {
+         /* Minimizing the worst-case complexity:
+            Let n = mbslen(haystack), m = mbslen(needle).
+            The naïve algorithm is O(n*m) worst-case.
+            The Knuth-Morris-Pratt algorithm is O(n) worst-case but it needs a
+            memory allocation.
+            To achieve linear complexity and yet amortize the cost of the
+            memory allocation, we activate the Knuth-Morris-Pratt algorithm
+            only once the naïve algorithm has already run for some time; more
+            precisely, when
+              - the outer loop count is >= 10,
+              - the average number of comparisons per outer loop is >= 5,
+              - the total number of comparisons is >= m.
+            But we try it only once.  If the memory allocation attempt failed,
+            we don't retry it.  */
+         bool try_kmp = true;
+         size_t outer_loop_count = 0;
+         size_t comparison_count = 0;
+         size_t last_ccount = 0;                  /* last comparison count */
+         mbui_iterator_t iter_needle_last_ccount; /* = needle + last_ccount */
+
+         mbui_iterator_t iter_haystack;
+
+         mbui_init (iter_needle_last_ccount, needle);
+         mbui_init (iter_haystack, haystack);
+         for (;; mbui_advance (iter_haystack))
+           {
+             if (!mbui_avail (iter_haystack))
+               /* No match.  */
+               return NULL;
+
+             /* See whether it's advisable to use an asymptotically faster
+                algorithm.  */
+             if (try_kmp
+                 && outer_loop_count >= 10
+                 && comparison_count >= 5 * outer_loop_count)
+               {
+                 /* See if needle + comparison_count now reaches the end of
+                    needle.  */
+                 size_t count = comparison_count - last_ccount;
+                 for (;
+                      count > 0 && mbui_avail (iter_needle_last_ccount);
+                      count--)
+                   mbui_advance (iter_needle_last_ccount);
+                 last_ccount = comparison_count;
+                 if (!mbui_avail (iter_needle_last_ccount))
+                   {
+                     /* Try the Knuth-Morris-Pratt algorithm.  */
+                     const char *result;
+                     bool success =
+                       knuth_morris_pratt_multibyte (haystack, needle,
+                                                     &result);
+                     if (success)
+                       return (char *) result;
+                     try_kmp = false;
+                   }
+               }
+
+             outer_loop_count++;
+             comparison_count++;
+             if (mb_equal (mbui_cur (iter_haystack), mbui_cur (iter_needle)))
+               /* The first character matches.  */
+               {
+                 mbui_iterator_t rhaystack;
+                 mbui_iterator_t rneedle;
+
+                 memcpy (&rhaystack, &iter_haystack, sizeof (mbui_iterator_t));
+                 mbui_advance (rhaystack);
+
+                 mbui_init (rneedle, needle);
+                 if (!mbui_avail (rneedle))
+                   abort ();
+                 mbui_advance (rneedle);
+
+                 for (;; mbui_advance (rhaystack), mbui_advance (rneedle))
+                   {
+                     if (!mbui_avail (rneedle))
+                       /* Found a match.  */
+                       return (char *) mbui_cur_ptr (iter_haystack);
+                     if (!mbui_avail (rhaystack))
+                       /* No match.  */
+                       return NULL;
+                     comparison_count++;
+                     if (!mb_equal (mbui_cur (rhaystack), mbui_cur (rneedle)))
+                       /* Nothing in this round.  */
+                       break;
+                   }
+               }
+           }
+       }
+      else
+       return (char *) haystack;
+    }
+  else
+#endif
+    {
+      if (*needle != '\0')
+       {
+         /* Minimizing the worst-case complexity:
+            Let n = strlen(haystack), m = strlen(needle).
+            The naïve algorithm is O(n*m) worst-case.
+            The Knuth-Morris-Pratt algorithm is O(n) worst-case but it needs a
+            memory allocation.
+            To achieve linear complexity and yet amortize the cost of the
+            memory allocation, we activate the Knuth-Morris-Pratt algorithm
+            only once the naïve algorithm has already run for some time; more
+            precisely, when
+              - the outer loop count is >= 10,
+              - the average number of comparisons per outer loop is >= 5,
+              - the total number of comparisons is >= m.
+            But we try it only once.  If the memory allocation attempt failed,
+            we don't retry it.  */
+         bool try_kmp = true;
+         size_t outer_loop_count = 0;
+         size_t comparison_count = 0;
+         size_t last_ccount = 0;                  /* last comparison count */
+         const char *needle_last_ccount = needle; /* = needle + last_ccount */
+
+         /* Speed up the following searches of needle by caching its first
+            character.  */
+         char b = *needle++;
+
+         for (;; haystack++)
+           {
+             if (*haystack == '\0')
+               /* No match.  */
+               return NULL;
+
+             /* See whether it's advisable to use an asymptotically faster
+                algorithm.  */
+             if (try_kmp
+                 && outer_loop_count >= 10
+                 && comparison_count >= 5 * outer_loop_count)
+               {
+                 /* See if needle + comparison_count now reaches the end of
+                    needle.  */
+                 if (needle_last_ccount != NULL)
+                   {
+                     needle_last_ccount +=
+                       strnlen (needle_last_ccount,
+                                comparison_count - last_ccount);
+                     if (*needle_last_ccount == '\0')
+                       needle_last_ccount = NULL;
+                     last_ccount = comparison_count;
+                   }
+                 if (needle_last_ccount == NULL)
+                   {
+                     /* Try the Knuth-Morris-Pratt algorithm.  */
+                     const char *result;
+                     bool success =
+                       knuth_morris_pratt_unibyte (haystack, needle - 1,
+                                                   &result);
+                     if (success)
+                       return (char *) result;
+                     try_kmp = false;
+                   }
+               }
+
+             outer_loop_count++;
+             comparison_count++;
+             if (*haystack == b)
+               /* The first character matches.  */
+               {
+                 const char *rhaystack = haystack + 1;
+                 const char *rneedle = needle;
+
+                 for (;; rhaystack++, rneedle++)
+                   {
+                     if (*rneedle == '\0')
+                       /* Found a match.  */
+                       return (char *) haystack;
+                     if (*rhaystack == '\0')
+                       /* No match.  */
+                       return NULL;
+                     comparison_count++;
+                     if (*rhaystack != *rneedle)
+                       /* Nothing in this round.  */
+                       break;
+                   }
+               }
+           }
+       }
+      else
+       return (char *) haystack;
+    }
+}

Index: mreadlink-with-size.c
===================================================================
RCS file: mreadlink-with-size.c
diff -N mreadlink-with-size.c
--- /dev/null   1 Jan 1970 00:00:00 -0000
+++ mreadlink-with-size.c       22 Aug 2007 12:48:42 -0000      1.1
@@ -0,0 +1,110 @@
+/* readlink wrapper to return the link name in malloc'd storage.
+   Unlike xreadlink and xreadlink_with_size, don't ever call exit.
+
+   Copyright (C) 2001, 2003-2007 Free Software Foundation, Inc.
+
+   This program is free software; you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation; either version 2, or (at your option)
+   any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program; see the file COPYING.
+   If not, write to the Free Software Foundation,
+   51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.  */
+
+/* Written by Jim Meyering <address@hidden>  */
+
+#include <config.h>
+
+#include "mreadlink.h"
+
+#include <stdio.h>
+#include <errno.h>
+#include <limits.h>
+#include <sys/types.h>
+#include <stdlib.h>
+#include <unistd.h>
+
+#ifndef SIZE_MAX
+# define SIZE_MAX ((size_t) -1)
+#endif
+#ifndef SSIZE_MAX
+# define SSIZE_MAX ((ssize_t) (SIZE_MAX / 2))
+#endif
+
+/* SYMLINK_MAX is used only for an initial memory-allocation sanity
+   check, so it's OK to guess too small on hosts where there is no
+   arbitrary limit to symbolic link length.  */
+#ifndef SYMLINK_MAX
+# define SYMLINK_MAX 1024
+#endif
+
+#define MAXSIZE (SIZE_MAX < SSIZE_MAX ? SIZE_MAX : SSIZE_MAX)
+
+/* Call readlink to get the symbolic link value of FILE.
+   SIZE is a hint as to how long the link is expected to be;
+   typically it is taken from st_size.  It need not be correct.
+   Return a pointer to that NUL-terminated string in malloc'd storage.
+   If readlink fails, malloc fails, or if the link value is longer
+   than SSIZE_MAX, return NULL (caller may use errno to diagnose).  */
+
+char *
+mreadlink_with_size (char const *file, size_t size)
+{
+  /* Some buggy file systems report garbage in st_size.  Defend
+     against them by ignoring outlandish st_size values in the initial
+     memory allocation.  */
+  size_t symlink_max = SYMLINK_MAX;
+  size_t INITIAL_LIMIT_BOUND = 8 * 1024;
+  size_t initial_limit = (symlink_max < INITIAL_LIMIT_BOUND
+                         ? symlink_max + 1
+                         : INITIAL_LIMIT_BOUND);
+
+  /* The initial buffer size for the link value.  */
+  size_t buf_size = size < initial_limit ? size + 1 : initial_limit;
+
+  while (1)
+    {
+      ssize_t r;
+      size_t link_length;
+      char *buffer = malloc (buf_size);
+
+      if (buffer == NULL)
+       return NULL;
+      r = readlink (file, buffer, buf_size);
+      link_length = r;
+
+      /* On AIX 5L v5.3 and HP-UX 11i v2 04/09, readlink returns -1
+        with errno == ERANGE if the buffer is too small.  */
+      if (r < 0 && errno != ERANGE)
+       {
+         int saved_errno = errno;
+         free (buffer);
+         errno = saved_errno;
+         return NULL;
+       }
+
+      if (link_length < buf_size)
+       {
+         buffer[link_length] = 0;
+         return buffer;
+       }
+
+      free (buffer);
+      if (buf_size <= MAXSIZE / 2)
+       buf_size *= 2;
+      else if (buf_size < MAXSIZE)
+       buf_size = MAXSIZE;
+      else
+       {
+         errno = ENOMEM;
+         return NULL;
+       }
+    }
+}

Index: mreadlink.h
===================================================================
RCS file: mreadlink.h
diff -N mreadlink.h
--- /dev/null   1 Jan 1970 00:00:00 -0000
+++ mreadlink.h 22 Aug 2007 12:48:43 -0000      1.1
@@ -0,0 +1,24 @@
+/* Read symbolic links without size limitation.
+
+   Copyright (C) 2001, 2003, 2004, 2007 Free Software Foundation, Inc.
+
+   This program is free software; you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation; either version 2, or (at your option)
+   any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program; see the file COPYING.
+   If not, write to the Free Software Foundation,
+   51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.  */
+
+/* Written by Jim Meyering <address@hidden>  */
+
+#include <stddef.h>
+
+extern char *mreadlink_with_size (char const *filename, size_t size_hint);

Index: netinet_in_.h
===================================================================
RCS file: netinet_in_.h
diff -N netinet_in_.h
--- /dev/null   1 Jan 1970 00:00:00 -0000
+++ netinet_in_.h       22 Aug 2007 12:48:43 -0000      1.1
@@ -0,0 +1,43 @@
+/* Substitute for <netinet/in.h>.
+   Copyright (C) 2007 Free Software Foundation, Inc.
+
+   This program is free software; you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation; either version 2, or (at your option)
+   any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program; if not, write to the Free Software Foundation,
+   Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.  */
+
+#ifndef _GL_NETINET_IN_H
+
+#if @HAVE_NETINET_IN_H@
+
+/* On many platforms, <netinet/in.h> assumes prior inclusion of
+   <sys/types.h>.  */
+# include <sys/types.h>
+
+/* The include_next requires a split double-inclusion guard.  */
+# @INCLUDE_NEXT@ @NEXT_NETINET_IN_H@
+
+#endif
+
+#ifndef _GL_NETINET_IN_H
+#define _GL_NETINET_IN_H
+
+#if address@hidden@
+
+/* A platform that lacks <netinet/in.h>.  */
+
+# include <sys/socket.h>
+
+#endif
+
+#endif /* _GL_NETINET_IN_H */
+#endif /* _GL_NETINET_IN_H */

Index: openat-proc.c
===================================================================
RCS file: openat-proc.c
diff -N openat-proc.c
--- /dev/null   1 Jan 1970 00:00:00 -0000
+++ openat-proc.c       22 Aug 2007 12:48:43 -0000      1.1
@@ -0,0 +1,95 @@
+/* Create /proc/self/fd-related names for subfiles of open directories.
+
+   Copyright (C) 2006 Free Software Foundation, Inc.
+
+   This program is free software; you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation; either version 2, or (at your option)
+   any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program; if not, write to the Free Software Foundation,
+   Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.  */
+
+/* Written by Paul Eggert.  */
+
+#include <config.h>
+
+#include "openat-priv.h"
+
+#include <sys/types.h>
+#include <sys/stat.h>
+#include <fcntl.h>
+
+#include <stdio.h>
+#include <string.h>
+
+#include "dirname.h"
+#include "intprops.h"
+#include "same-inode.h"
+#include "xalloc.h"
+
+/* The results of open() in this file are not used with fchdir,
+   therefore save some unnecessary work in fchdir.c.  */
+#undef open
+#undef close
+
+#define PROC_SELF_FD_FORMAT "/proc/self/fd/%d/%s"
+
+#define PROC_SELF_FD_NAME_SIZE_BOUND(len) \
+  (sizeof PROC_SELF_FD_FORMAT - sizeof "%d%s" \
+   + INT_STRLEN_BOUND (int) + (len) + 1)
+
+
+/* Set BUF to the expansion of PROC_SELF_FD_FORMAT, using FD and FILE
+   respectively for %d and %s.  If successful, return BUF if the
+   result fits in BUF, dynamically allocated memory otherwise.  But
+   return NULL if /proc is not reliable.  */
+char *
+openat_proc_name (char buf[OPENAT_BUFFER_SIZE], int fd, char const *file)
+{
+  static int proc_status = 0;
+
+  if (! proc_status)
+    {
+      /* Set PROC_STATUS to a positive value if /proc/self/fd is
+        reliable, and a negative value otherwise.  Solaris 10
+        /proc/self/fd mishandles "..", and any file name might expand
+        to ".." after symbolic link expansion, so avoid /proc/self/fd
+        if it mishandles "..".  Solaris 10 has openat, but this
+        problem is exhibited on code that built on Solaris 8 and
+        running on Solaris 10.  */
+
+      int proc_self_fd = open ("/proc/self/fd", O_RDONLY);
+      if (proc_self_fd < 0)
+       proc_status = -1;
+      else
+       {
+         struct stat proc_self_fd_dotdot_st;
+         struct stat proc_self_st;
+         char dotdot_buf[PROC_SELF_FD_NAME_SIZE_BOUND (sizeof ".." - 1)];
+         sprintf (dotdot_buf, PROC_SELF_FD_FORMAT, proc_self_fd, "..");
+         proc_status =
+           ((stat (dotdot_buf, &proc_self_fd_dotdot_st) == 0
+             && stat ("/proc/self", &proc_self_st) == 0
+             && SAME_INODE (proc_self_fd_dotdot_st, proc_self_st))
+            ? 1 : -1);
+         close (proc_self_fd);
+       }
+    }
+
+  if (proc_status < 0)
+    return NULL;
+  else
+    {
+      size_t bufsize = PROC_SELF_FD_NAME_SIZE_BOUND (strlen (file));
+      char *result = (bufsize < OPENAT_BUFFER_SIZE ? buf : xmalloc (bufsize));
+      sprintf (result, PROC_SELF_FD_FORMAT, fd, file);
+      return result;
+    }
+}

Index: ref-add.sin
===================================================================
RCS file: ref-add.sin
diff -N ref-add.sin
--- /dev/null   1 Jan 1970 00:00:00 -0000
+++ ref-add.sin 22 Aug 2007 12:48:44 -0000      1.1
@@ -0,0 +1,30 @@
+# Add this package to a list of references stored in a text file.
+#
+#   Copyright (C) 2000 Free Software Foundation, Inc.
+#
+#   This program is free software; you can redistribute it and/or modify
+#   it under the terms of the GNU General Public License as published by
+#   the Free Software Foundation; either version 2, or (at your option)
+#   any later version.
+#
+#   This program is distributed in the hope that it will be useful,
+#   but WITHOUT ANY WARRANTY; without even the implied warranty of
+#   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+#   GNU General Public License for more details.
+#
+#   You should have received a copy of the GNU General Public License along
+#   with this program; if not, write to the Free Software Foundation,
+#   Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+#
+# Written by Bruno Haible <address@hidden>.
+#
+/^# Packages using this file: / {
+  s/# Packages using this file://
+  ta
+  :a
+  s/ @PACKAGE@ / @PACKAGE@ /
+  tb
+  s/ $/ @PACKAGE@ /
+  :b
+  s/^/# Packages using this file:/
+}

Index: ref-del.sin
===================================================================
RCS file: ref-del.sin
diff -N ref-del.sin
--- /dev/null   1 Jan 1970 00:00:00 -0000
+++ ref-del.sin 22 Aug 2007 12:48:44 -0000      1.1
@@ -0,0 +1,25 @@
+# Remove this package from a list of references stored in a text file.
+#
+#   Copyright (C) 2000 Free Software Foundation, Inc.
+#
+#   This program is free software; you can redistribute it and/or modify
+#   it under the terms of the GNU General Public License as published by
+#   the Free Software Foundation; either version 2, or (at your option)
+#   any later version.
+#
+#   This program is distributed in the hope that it will be useful,
+#   but WITHOUT ANY WARRANTY; without even the implied warranty of
+#   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+#   GNU General Public License for more details.
+#
+#   You should have received a copy of the GNU General Public License along
+#   with this program; if not, write to the Free Software Foundation,
+#   Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+#
+# Written by Bruno Haible <address@hidden>.
+#
+/^# Packages using this file: / {
+  s/# Packages using this file://
+  s/ @PACKAGE@ / /
+  s/^/# Packages using this file:/
+}

Index: stdio_.h
===================================================================
RCS file: stdio_.h
diff -N stdio_.h
--- /dev/null   1 Jan 1970 00:00:00 -0000
+++ stdio_.h    22 Aug 2007 12:48:45 -0000      1.1
@@ -0,0 +1,312 @@
+/* A GNU-like <stdio.h>.
+
+   Copyright (C) 2004, 2007 Free Software Foundation, Inc.
+
+   This program is free software; you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation; either version 2, or (at your option)
+   any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program; if not, write to the Free Software Foundation,
+   Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.  */
+
+#if defined __need_FILE || defined __need___FILE
+/* Special invocation convention inside glibc header files.  */
+
address@hidden@ @NEXT_STDIO_H@
+
+#else
+/* Normal invocation convention.  */
+
+#ifndef _GL_STDIO_H
+
+/* The include_next requires a split double-inclusion guard.  */
address@hidden@ @NEXT_STDIO_H@
+
+#ifndef _GL_STDIO_H
+#define _GL_STDIO_H
+
+#include <stdarg.h>
+#include <stddef.h>
+
+#if (@GNULIB_FSEEKO@ && @REPLACE_FSEEKO@) || (@GNULIB_FTELLO@ && 
@REPLACE_FTELLO@)
+/* Get off_t.  */
+# include <sys/types.h>
+#endif
+
+#ifndef __attribute__
+/* This feature is available in gcc versions 2.5 and later.  */
+# if __GNUC__ < 2 || (__GNUC__ == 2 && __GNUC_MINOR__ < 5) || __STRICT_ANSI__
+#  define __attribute__(Spec) /* empty */
+# endif
+/* The __-protected variants of `format' and `printf' attributes
+   are accepted by gcc versions 2.6.4 (effectively 2.7) and later.  */
+# if __GNUC__ < 2 || (__GNUC__ == 2 && __GNUC_MINOR__ < 7)
+#  define __format__ format
+#  define __printf__ printf
+# endif
+#endif
+
+
+/* The definition of GL_LINK_WARNING is copied here.  */
+
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+
+#if @GNULIB_FPRINTF_POSIX@
+# if @REPLACE_FPRINTF@
+#  define fprintf rpl_fprintf
+extern int fprintf (FILE *fp, const char *format, ...)
+       __attribute__ ((__format__ (__printf__, 2, 3)));
+# endif
+#elif defined GNULIB_POSIXCHECK
+# undef fprintf
+# define fprintf \
+    (GL_LINK_WARNING ("fprintf is not always POSIX compliant - " \
+                      "use gnulib module fprintf-posix for portable " \
+                      "POSIX compliance"), \
+     fprintf)
+#endif
+
+#if @GNULIB_VFPRINTF_POSIX@
+# if @REPLACE_VFPRINTF@
+#  define vfprintf rpl_vfprintf
+extern int vfprintf (FILE *fp, const char *format, va_list args)
+       __attribute__ ((__format__ (__printf__, 2, 0)));
+# endif
+#elif defined GNULIB_POSIXCHECK
+# undef vfprintf
+# define vfprintf(s,f,a) \
+    (GL_LINK_WARNING ("vfprintf is not always POSIX compliant - " \
+                      "use gnulib module vfprintf-posix for portable " \
+                      "POSIX compliance"), \
+     vfprintf (s, f, a))
+#endif
+
+#if @GNULIB_PRINTF_POSIX@
+# if @REPLACE_PRINTF@
+/* Don't break __attribute__((format(printf,M,N))).  */
+#  define printf __printf__
+extern int printf (const char *format, ...)
+       __attribute__ ((__format__ (__printf__, 1, 2)));
+# endif
+#elif defined GNULIB_POSIXCHECK
+# undef printf
+# define printf \
+    (GL_LINK_WARNING ("printf is not always POSIX compliant - " \
+                      "use gnulib module printf-posix for portable " \
+                      "POSIX compliance"), \
+     printf)
+/* Don't break __attribute__((format(printf,M,N))).  */
+# define format(kind,m,n) format (__##kind##__, m, n)
+# define __format__(kind,m,n) __format__ (__##kind##__, m, n)
+# define ____printf____ __printf__
+# define ____scanf____ __scanf__
+# define ____strftime____ __strftime__
+# define ____strfmon____ __strfmon__
+#endif
+
+#if @GNULIB_VPRINTF_POSIX@
+# if @REPLACE_VPRINTF@
+#  define vprintf rpl_vprintf
+extern int vprintf (const char *format, va_list args)
+       __attribute__ ((__format__ (__printf__, 1, 0)));
+# endif
+#elif defined GNULIB_POSIXCHECK
+# undef vprintf
+# define vprintf(f,a) \
+    (GL_LINK_WARNING ("vprintf is not always POSIX compliant - " \
+                      "use gnulib module vprintf-posix for portable " \
+                      "POSIX compliance"), \
+     vprintf (f, a))
+#endif
+
+#if @GNULIB_SNPRINTF@
+# if @REPLACE_SNPRINTF@
+#  define snprintf rpl_snprintf
+# endif
+# if @REPLACE_SNPRINTF@ || address@hidden@
+extern int snprintf (char *str, size_t size, const char *format, ...)
+       __attribute__ ((__format__ (__printf__, 3, 4)));
+# endif
+#elif defined GNULIB_POSIXCHECK
+# undef snprintf
+# define snprintf \
+    (GL_LINK_WARNING ("snprintf is unportable - " \
+                      "use gnulib module snprintf for portability"), \
+     snprintf)
+#endif
+
+#if @GNULIB_VSNPRINTF@
+# if @REPLACE_VSNPRINTF@
+#  define vsnprintf rpl_vsnprintf
+# endif
+# if @REPLACE_VSNPRINTF@ || address@hidden@
+extern int vsnprintf (char *str, size_t size, const char *format, va_list args)
+       __attribute__ ((__format__ (__printf__, 3, 0)));
+# endif
+#elif defined GNULIB_POSIXCHECK
+# undef vsnprintf
+# define vsnprintf(b,s,f,a) \
+    (GL_LINK_WARNING ("vsnprintf is unportable - " \
+                      "use gnulib module vsnprintf for portability"), \
+     vsnprintf (b, s, f, a))
+#endif
+
+#if @GNULIB_SPRINTF_POSIX@
+# if @REPLACE_SPRINTF@
+#  define sprintf rpl_sprintf
+extern int sprintf (char *str, const char *format, ...)
+       __attribute__ ((__format__ (__printf__, 2, 3)));
+# endif
+#elif defined GNULIB_POSIXCHECK
+# undef sprintf
+# define sprintf \
+    (GL_LINK_WARNING ("sprintf is not always POSIX compliant - " \
+                      "use gnulib module sprintf-posix for portable " \
+                      "POSIX compliance"), \
+     sprintf)
+#endif
+
+#if @GNULIB_VSPRINTF_POSIX@
+# if @REPLACE_VSPRINTF@
+#  define vsprintf rpl_vsprintf
+extern int vsprintf (char *str, const char *format, va_list args)
+       __attribute__ ((__format__ (__printf__, 2, 0)));
+# endif
+#elif defined GNULIB_POSIXCHECK
+# undef vsprintf
+# define vsprintf(b,f,a) \
+    (GL_LINK_WARNING ("vsprintf is not always POSIX compliant - " \
+                      "use gnulib module vsprintf-posix for portable " \
+                      "POSIX compliance"), \
+     vsprintf (b, f, a))
+#endif
+
+#if @GNULIB_VASPRINTF@
+# if @REPLACE_VASPRINTF@
+#  define asprintf rpl_asprintf
+#  define vasprintf rpl_vasprintf
+# endif
+# if @REPLACE_VASPRINTF@ || address@hidden@
+  /* Write formatted output to a string dynamically allocated with malloc().
+     If the memory allocation succeeds, store the address of the string in
+     *RESULT and return the number of resulting bytes, excluding the trailing
+     NUL.  Upon memory allocation error, or some other error, return -1.  */
+  extern int asprintf (char **result, const char *format, ...)
+    __attribute__ ((__format__ (__printf__, 2, 3)));
+  extern int vasprintf (char **result, const char *format, va_list args)
+    __attribute__ ((__format__ (__printf__, 2, 0)));
+# endif
+#endif
+
+#if @GNULIB_FSEEKO@
+# if @REPLACE_FSEEKO@
+/* Provide fseek, fseeko functions that are aware of a preceding
+   fflush(), and which detect pipes.  */
+#  define fseeko rpl_fseeko
+extern int fseeko (FILE *fp, off_t offset, int whence);
+#  define fseek(fp, offset, whence) fseeko (fp, (off_t)(offset), whence)
+# endif
+#elif defined GNULIB_POSIXCHECK
+# undef fseeko
+# define fseeko(f,o,w) \
+   (GL_LINK_WARNING ("fseeko is unportable - " \
+                     "use gnulib module fseeko for portability"), \
+    fseeko (f, o, w))
+#endif
+
+#if @GNULIB_FSEEK@ && @REPLACE_FSEEK@
+extern int rpl_fseek (FILE *fp, long offset, int whence);
+# undef fseek
+# if defined GNULIB_POSIXCHECK
+#  define fseek(f,o,w) \
+     (GL_LINK_WARNING ("fseek cannot handle files larger than 4 GB " \
+                       "on 32-bit platforms - " \
+                       "use fseeko function for handling of large files"), \
+      rpl_fseek (f, o, w))
+# else
+#  define fseek rpl_fseek
+# endif
+#elif defined GNULIB_POSIXCHECK
+# ifndef fseek
+#  define fseek(f,o,w) \
+     (GL_LINK_WARNING ("fseek cannot handle files larger than 4 GB " \
+                       "on 32-bit platforms - " \
+                       "use fseeko function for handling of large files"), \
+      fseek (f, o, w))
+# endif
+#endif
+
+#if @GNULIB_FTELLO@
+# if @REPLACE_FTELLO@
+#  define ftello rpl_ftello
+extern off_t ftello (FILE *fp);
+#  define ftell(fp) ftello (fp)
+# endif
+#elif defined GNULIB_POSIXCHECK
+# undef ftello
+# define ftello(f) \
+   (GL_LINK_WARNING ("ftello is unportable - " \
+                     "use gnulib module ftello for portability"), \
+    ftello (f))
+#endif
+
+#if @GNULIB_FTELL@ && @REPLACE_FTELL@
+extern long rpl_ftell (FILE *fp);
+# undef ftell
+# if GNULIB_POSIXCHECK
+#  define ftell(f) \
+     (GL_LINK_WARNING ("ftell cannot handle files larger than 4 GB " \
+                       "on 32-bit platforms - " \
+                       "use ftello function for handling of large files"), \
+      rpl_ftell (f))
+# else
+#  define ftell rpl_ftell
+# endif
+#elif defined GNULIB_POSIXCHECK
+# ifndef ftell
+#  define ftell(f) \
+     (GL_LINK_WARNING ("ftell cannot handle files larger than 4 GB " \
+                       "on 32-bit platforms - " \
+                       "use ftello function for handling of large files"), \
+      ftell (f))
+# endif
+#endif
+
+#if @GNULIB_FFLUSH@
+# if @REPLACE_FFLUSH@
+#  define fflush rpl_fflush
+  /* Flush all pending data on STREAM according to POSIX rules.  Both
+     output and seekable input streams are supported.
+     Note! LOSS OF DATA can occur if fflush is applied on an input stream
+     that is _not_seekable_ or on an update stream that is _not_seekable_
+     and in which the most recent operation was input.  Seekability can
+     be tested with lseek(fileno(fp),0,SEEK_CUR).  */
+  extern int fflush (FILE *gl_stream);
+# endif
+#elif defined GNULIB_POSIXCHECK
+# undef fflush
+# define fflush(f) \
+   (GL_LINK_WARNING ("fflush is not always POSIX compliant - " \
+                     "use gnulib module fflush for portable " \
+                     "POSIX compliance"), \
+    fflush (f))
+#endif
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* _GL_STDIO_H */
+#endif /* _GL_STDIO_H */
+#endif

Index: stdlib_.h
===================================================================
RCS file: stdlib_.h
diff -N stdlib_.h
--- /dev/null   1 Jan 1970 00:00:00 -0000
+++ stdlib_.h   22 Aug 2007 12:48:45 -0000      1.1
@@ -0,0 +1,132 @@
+/* A GNU-like <stdlib.h>.
+
+   Copyright (C) 1995, 2001-2002, 2006-2007 Free Software Foundation, Inc.
+
+   This program is free software; you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation; either version 2, or (at your option)
+   any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program; if not, write to the Free Software Foundation,
+   Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.  */
+
+#if defined __need_malloc_and_calloc
+/* Special invocation convention inside glibc header files.  */
+
address@hidden@ @NEXT_STDLIB_H@
+
+#else
+/* Normal invocation convention.  */
+
+#ifndef _GL_STDLIB_H
+
+/* The include_next requires a split double-inclusion guard.  */
address@hidden@ @NEXT_STDLIB_H@
+
+#ifndef _GL_STDLIB_H
+#define _GL_STDLIB_H
+
+
+/* The definition of GL_LINK_WARNING is copied here.  */
+
+
+/* Some systems do not define EXIT_*, despite otherwise supporting C89.  */
+#ifndef EXIT_SUCCESS
+# define EXIT_SUCCESS 0
+#endif
+/* Tandem/NSK and other platforms that define EXIT_FAILURE as -1 interfere
+   with proper operation of xargs.  */
+#ifndef EXIT_FAILURE
+# define EXIT_FAILURE 1
+#elif EXIT_FAILURE != 1
+# undef EXIT_FAILURE
+# define EXIT_FAILURE 1
+#endif
+
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+
+#if @GNULIB_GETSUBOPT@
+/* Assuming *OPTIONP is a comma separated list of elements of the form
+   "token" or "token=value", getsubopt parses the first of these elements.
+   If the first element refers to a "token" that is member of the given
+   NULL-terminated array of tokens:
+     - It replaces the comma with a NUL byte, updates *OPTIONP to point past
+       the first option and the comma, sets *VALUEP to the value of the
+       element (or NULL if it doesn't contain an "=" sign),
+     - It returns the index of the "token" in the given array of tokens.
+   Otherwise it returns -1, and *OPTIONP and *VALUEP are undefined.
+   For more details see the POSIX:2001 specification.
+   http://www.opengroup.org/susv3xsh/getsubopt.html */
+# if address@hidden@
+extern int getsubopt (char **optionp, char *const *tokens, char **valuep);
+# endif
+#elif defined GNULIB_POSIXCHECK
+# undef getsubopt
+# define getsubopt(o,t,v) \
+    (GL_LINK_WARNING ("getsubopt is unportable - " \
+                      "use gnulib module getsubopt for portability"), \
+     getsubopt (o, t, v))
+#endif
+
+
+#if @GNULIB_MKDTEMP@
+# if address@hidden@
+/* Create a unique temporary directory from TEMPLATE.
+   The last six characters of TEMPLATE must be "XXXXXX";
+   they are replaced with a string that makes the directory name unique.
+   Returns TEMPLATE, or a null pointer if it cannot get a unique name.
+   The directory is created mode 700.  */
+extern char * mkdtemp (char * /*template*/);
+# endif
+#elif defined GNULIB_POSIXCHECK
+# undef mkdtemp
+# define mkdtemp(t) \
+    (GL_LINK_WARNING ("mkdtemp is unportable - " \
+                      "use gnulib module mkdtemp for portability"), \
+     mkdtemp (t))
+#endif
+
+
+#if @GNULIB_MKSTEMP@
+# if @REPLACE_MKSTEMP@
+/* Create a unique temporary file from TEMPLATE.
+   The last six characters of TEMPLATE must be "XXXXXX";
+   they are replaced with a string that makes the file name unique.
+   The file is then created, ensuring it didn't exist before.
+   The file is created read-write (mask at least 0600 & ~umask), but it may be
+   world-readable and world-writable (mask 0666 & ~umask), depending on the
+   implementation.
+   Returns the open file descriptor if successful, otherwise -1 and errno
+   set.  */
+#  define mkstemp rpl_mkstemp
+extern int mkstemp (char * /*template*/);
+# else
+/* On MacOS X 10.3, only <unistd.h> declares mkstemp.  */
+#  include <unistd.h>
+# endif
+#elif defined GNULIB_POSIXCHECK
+# undef mkstemp
+# define mkstemp(t) \
+    (GL_LINK_WARNING ("mkstemp is unportable - " \
+                      "use gnulib module mkstemp for portability"), \
+     mkstemp (t))
+#endif
+
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* _GL_STDLIB_H */
+#endif /* _GL_STDLIB_H */
+#endif

Index: streq.h
===================================================================
RCS file: streq.h
diff -N streq.h
--- /dev/null   1 Jan 1970 00:00:00 -0000
+++ streq.h     22 Aug 2007 12:48:45 -0000      1.1
@@ -0,0 +1,173 @@
+/* Optimized string comparison.
+   Copyright (C) 2001-2002, 2007 Free Software Foundation, Inc.
+
+   This program is free software; you can redistribute it and/or modify it
+   under the terms of the GNU Library General Public License as published
+   by the Free Software Foundation; either version 2, or (at your option)
+   any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   Library General Public License for more details.
+
+   You should have received a copy of the GNU Library General Public
+   License along with this program; if not, write to the Free Software
+   Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
+   USA.  */
+
+/* Written by Bruno Haible <address@hidden>.  */
+
+#include <string.h>
+
+/* STREQ allows to optimize string comparison with a small literal string.
+     STREQ (s, "EUC-KR", 'E', 'U', 'C', '-', 'K', 'R', 0, 0, 0)
+   is semantically equivalent to
+     strcmp (s, "EUC-KR") == 0
+   just faster.  */
+
+/* Help GCC to generate good code for string comparisons with
+   immediate strings. */
+#if defined (__GNUC__) && defined (__OPTIMIZE__)
+
+static inline int
+streq9 (const char *s1, const char *s2)
+{
+  return strcmp (s1 + 9, s2 + 9) == 0;
+}
+
+static inline int
+streq8 (const char *s1, const char *s2, char s28)
+{
+  if (s1[8] == s28)
+    {
+      if (s28 == 0)
+        return 1;
+      else
+        return streq9 (s1, s2);
+    }
+  else
+    return 0;
+}
+
+static inline int
+streq7 (const char *s1, const char *s2, char s27, char s28)
+{
+  if (s1[7] == s27)
+    {
+      if (s27 == 0)
+        return 1;
+      else
+        return streq8 (s1, s2, s28);
+    }
+  else
+    return 0;
+}
+
+static inline int
+streq6 (const char *s1, const char *s2, char s26, char s27, char s28)
+{
+  if (s1[6] == s26)
+    {
+      if (s26 == 0)
+        return 1;
+      else
+        return streq7 (s1, s2, s27, s28);
+    }
+  else
+    return 0;
+}
+
+static inline int
+streq5 (const char *s1, const char *s2, char s25, char s26, char s27, char s28)
+{
+  if (s1[5] == s25)
+    {
+      if (s25 == 0)
+        return 1;
+      else
+        return streq6 (s1, s2, s26, s27, s28);
+    }
+  else
+    return 0;
+}
+
+static inline int
+streq4 (const char *s1, const char *s2, char s24, char s25, char s26, char 
s27, char s28)
+{
+  if (s1[4] == s24)
+    {
+      if (s24 == 0)
+        return 1;
+      else
+        return streq5 (s1, s2, s25, s26, s27, s28);
+    }
+  else
+    return 0;
+}
+
+static inline int
+streq3 (const char *s1, const char *s2, char s23, char s24, char s25, char 
s26, char s27, char s28)
+{
+  if (s1[3] == s23)
+    {
+      if (s23 == 0)
+        return 1;
+      else
+        return streq4 (s1, s2, s24, s25, s26, s27, s28);
+    }
+  else
+    return 0;
+}
+
+static inline int
+streq2 (const char *s1, const char *s2, char s22, char s23, char s24, char 
s25, char s26, char s27, char s28)
+{
+  if (s1[2] == s22)
+    {
+      if (s22 == 0)
+        return 1;
+      else
+        return streq3 (s1, s2, s23, s24, s25, s26, s27, s28);
+    }
+  else
+    return 0;
+}
+
+static inline int
+streq1 (const char *s1, const char *s2, char s21, char s22, char s23, char 
s24, char s25, char s26, char s27, char s28)
+{
+  if (s1[1] == s21)
+    {
+      if (s21 == 0)
+        return 1;
+      else
+        return streq2 (s1, s2, s22, s23, s24, s25, s26, s27, s28);
+    }
+  else
+    return 0;
+}
+
+static inline int
+streq0 (const char *s1, const char *s2, char s20, char s21, char s22, char 
s23, char s24, char s25, char s26, char s27, char s28)
+{
+  if (s1[0] == s20)
+    {
+      if (s20 == 0)
+        return 1;
+      else
+        return streq1 (s1, s2, s21, s22, s23, s24, s25, s26, s27, s28);
+    }
+  else
+    return 0;
+}
+
+#define STREQ(s1,s2,s20,s21,s22,s23,s24,s25,s26,s27,s28) \
+  streq0 (s1, s2, s20, s21, s22, s23, s24, s25, s26, s27, s28)
+
+#else
+
+#define STREQ(s1,s2,s20,s21,s22,s23,s24,s25,s26,s27,s28) \
+  (strcmp (s1, s2) == 0)
+
+#endif

Index: string_.h
===================================================================
RCS file: string_.h
diff -N string_.h
--- /dev/null   1 Jan 1970 00:00:00 -0000
+++ string_.h   22 Aug 2007 12:48:45 -0000      1.1
@@ -0,0 +1,548 @@
+/* A GNU-like <string.h>.
+
+   Copyright (C) 1995-1996, 2001-2007 Free Software Foundation, Inc.
+
+   This program is free software; you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation; either version 2, or (at your option)
+   any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program; if not, write to the Free Software Foundation,
+   Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.  */
+
+#ifndef _GL_STRING_H
+
+/* The include_next requires a split double-inclusion guard.  */
address@hidden@ @NEXT_STRING_H@
+
+#ifndef _GL_STRING_H
+#define _GL_STRING_H
+
+
+/* The definition of GL_LINK_WARNING is copied here.  */
+
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/* Return the first occurrence of NEEDLE in HAYSTACK.  */
+#if @GNULIB_MEMMEM@
+# if ! @HAVE_DECL_MEMMEM@
+extern void *memmem (void const *__haystack, size_t __haystack_len,
+                    void const *__needle, size_t __needle_len);
+# endif
+#elif defined GNULIB_POSIXCHECK
+# undef memmem
+# define memmem(a,al,b,bl) \
+    (GL_LINK_WARNING ("memmem is unportable - " \
+                      "use gnulib module memmem for portability"), \
+     memmem (a, al, b, bl))
+#endif
+
+/* Copy N bytes of SRC to DEST, return pointer to bytes after the
+   last written byte.  */
+#if @GNULIB_MEMPCPY@
+# if ! @HAVE_MEMPCPY@
+extern void *mempcpy (void *restrict __dest, void const *restrict __src,
+                     size_t __n);
+# endif
+#elif defined GNULIB_POSIXCHECK
+# undef mempcpy
+# define mempcpy(a,b,n) \
+    (GL_LINK_WARNING ("mempcpy is unportable - " \
+                      "use gnulib module mempcpy for portability"), \
+     mempcpy (a, b, n))
+#endif
+
+/* Search backwards through a block for a byte (specified as an int).  */
+#if @GNULIB_MEMRCHR@
+# if ! @HAVE_DECL_MEMRCHR@
+extern void *memrchr (void const *, int, size_t);
+# endif
+#elif defined GNULIB_POSIXCHECK
+# undef memrchr
+# define memrchr(a,b,c) \
+    (GL_LINK_WARNING ("memrchr is unportable - " \
+                      "use gnulib module memrchr for portability"), \
+     memrchr (a, b, c))
+#endif
+
+/* Copy SRC to DST, returning the address of the terminating '\0' in DST.  */
+#if @GNULIB_STPCPY@
+# if ! @HAVE_STPCPY@
+extern char *stpcpy (char *restrict __dst, char const *restrict __src);
+# endif
+#elif defined GNULIB_POSIXCHECK
+# undef stpcpy
+# define stpcpy(a,b) \
+    (GL_LINK_WARNING ("stpcpy is unportable - " \
+                      "use gnulib module stpcpy for portability"), \
+     stpcpy (a, b))
+#endif
+
+/* Copy no more than N bytes of SRC to DST, returning a pointer past the
+   last non-NUL byte written into DST.  */
+#if @GNULIB_STPNCPY@
+# if ! @HAVE_STPNCPY@
+#  define stpncpy gnu_stpncpy
+extern char *stpncpy (char *restrict __dst, char const *restrict __src,
+                     size_t __n);
+# endif
+#elif defined GNULIB_POSIXCHECK
+# undef stpncpy
+# define stpncpy(a,b,n) \
+    (GL_LINK_WARNING ("stpncpy is unportable - " \
+                      "use gnulib module stpncpy for portability"), \
+     stpncpy (a, b, n))
+#endif
+
+/* Compare strings S1 and S2, ignoring case, returning less than, equal to or
+   greater than zero if S1 is lexicographically less than, equal to or greater
+   than S2.
+   Note: This function does not work in multibyte locales.  */
+#if ! @HAVE_STRCASECMP@
+extern int strcasecmp (char const *s1, char const *s2);
+#endif
+#if defined GNULIB_POSIXCHECK
+/* strcasecmp() does not work with multibyte strings:
+   POSIX says that it operates on "strings", and "string" in POSIX is defined
+   as a sequence of bytes, not of characters.   */
+# undef strcasecmp
+# define strcasecmp(a,b) \
+    (GL_LINK_WARNING ("strcasecmp cannot work correctly on character strings " 
\
+                      "in multibyte locales - " \
+                      "use mbscasecmp if you care about " \
+                      "internationalization, or use c_strcasecmp (from " \
+                      "gnulib module c-strcase) if you want a locale " \
+                      "independent function"), \
+     strcasecmp (a, b))
+#endif
+
+/* Compare no more than N bytes of strings S1 and S2, ignoring case,
+   returning less than, equal to or greater than zero if S1 is
+   lexicographically less than, equal to or greater than S2.
+   Note: This function cannot work correctly in multibyte locales.  */
+#if ! @HAVE_DECL_STRNCASECMP@
+extern int strncasecmp (char const *s1, char const *s2, size_t n);
+#endif
+#if defined GNULIB_POSIXCHECK
+/* strncasecmp() does not work with multibyte strings:
+   POSIX says that it operates on "strings", and "string" in POSIX is defined
+   as a sequence of bytes, not of characters.  */
+# undef strncasecmp
+# define strncasecmp(a,b,n) \
+    (GL_LINK_WARNING ("strncasecmp cannot work correctly on character " \
+                      "strings in multibyte locales - " \
+                      "use mbsncasecmp or mbspcasecmp if you care about " \
+                      "internationalization, or use c_strncasecmp (from " \
+                      "gnulib module c-strcase) if you want a locale " \
+                      "independent function"), \
+     strncasecmp (a, b, n))
+#endif
+
+#if defined GNULIB_POSIXCHECK
+/* strchr() does not work with multibyte strings if the locale encoding is
+   GB18030 and the character to be searched is a digit.  */
+# undef strchr
+# define strchr(s,c) \
+    (GL_LINK_WARNING ("strchr cannot work correctly on character strings " \
+                      "in some multibyte locales - " \
+                      "use mbschr if you care about internationalization"), \
+     strchr (s, c))
+#endif
+
+/* Find the first occurrence of C in S or the final NUL byte.  */
+#if @GNULIB_STRCHRNUL@
+# if ! @HAVE_STRCHRNUL@
+extern char *strchrnul (char const *__s, int __c_in);
+# endif
+#elif defined GNULIB_POSIXCHECK
+# undef strchrnul
+# define strchrnul(a,b) \
+    (GL_LINK_WARNING ("strchrnul is unportable - " \
+                      "use gnulib module strchrnul for portability"), \
+     strchrnul (a, b))
+#endif
+
+/* Duplicate S, returning an identical malloc'd string.  */
+#if @GNULIB_STRDUP@
+# if ! @HAVE_DECL_STRDUP@ && ! defined strdup
+extern char *strdup (char const *__s);
+# endif
+#elif defined GNULIB_POSIXCHECK
+# undef strdup
+# define strdup(a) \
+    (GL_LINK_WARNING ("strdup is unportable - " \
+                      "use gnulib module strdup for portability"), \
+     strdup (a))
+#endif
+
+/* Return a newly allocated copy of at most N bytes of STRING.  */
+#if @GNULIB_STRNDUP@
+# if ! @HAVE_STRNDUP@
+#  undef strndup
+#  define strndup rpl_strndup
+# endif
+# if ! @HAVE_STRNDUP@ || ! @HAVE_DECL_STRNDUP@
+extern char *strndup (char const *__string, size_t __n);
+# endif
+#elif defined GNULIB_POSIXCHECK
+# undef strndup
+# define strndup(a,n) \
+    (GL_LINK_WARNING ("strndup is unportable - " \
+                      "use gnulib module strndup for portability"), \
+     strndup (a, n))
+#endif
+
+/* Find the length (number of bytes) of STRING, but scan at most
+   MAXLEN bytes.  If no '\0' terminator is found in that many bytes,
+   return MAXLEN.  */
+#if @GNULIB_STRNLEN@
+# if ! @HAVE_DECL_STRNLEN@
+extern size_t strnlen (char const *__string, size_t __maxlen);
+# endif
+#elif defined GNULIB_POSIXCHECK
+# undef strnlen
+# define strnlen(a,n) \
+    (GL_LINK_WARNING ("strnlen is unportable - " \
+                      "use gnulib module strnlen for portability"), \
+     strnlen (a, n))
+#endif
+
+#if defined GNULIB_POSIXCHECK
+/* strcspn() assumes the second argument is a list of single-byte characters.
+   Even in this simple case, it does not work with multibyte strings if the
+   locale encoding is GB18030 and one of the characters to be searched is a
+   digit.  */
+# undef strcspn
+# define strcspn(s,a) \
+    (GL_LINK_WARNING ("strcspn cannot work correctly on character strings " \
+                      "in multibyte locales - " \
+                      "use mbscspn if you care about internationalization"), \
+     strcspn (s, a))
+#endif
+
+/* Find the first occurrence in S of any character in ACCEPT.  */
+#if @GNULIB_STRPBRK@
+# if ! @HAVE_STRPBRK@
+extern char *strpbrk (char const *__s, char const *__accept);
+# endif
+# if defined GNULIB_POSIXCHECK
+/* strpbrk() assumes the second argument is a list of single-byte characters.
+   Even in this simple case, it does not work with multibyte strings if the
+   locale encoding is GB18030 and one of the characters to be searched is a
+   digit.  */
+#  undef strpbrk
+#  define strpbrk(s,a) \
+     (GL_LINK_WARNING ("strpbrk cannot work correctly on character strings " \
+                       "in multibyte locales - " \
+                       "use mbspbrk if you care about internationalization"), \
+      strpbrk (s, a))
+# endif
+#elif defined GNULIB_POSIXCHECK
+# undef strpbrk
+# define strpbrk(s,a) \
+    (GL_LINK_WARNING ("strpbrk is unportable - " \
+                      "use gnulib module strpbrk for portability"), \
+     strpbrk (s, a))
+#endif
+
+#if defined GNULIB_POSIXCHECK
+/* strspn() assumes the second argument is a list of single-byte characters.
+   Even in this simple case, it cannot work with multibyte strings.  */
+# undef strspn
+# define strspn(s,a) \
+    (GL_LINK_WARNING ("strspn cannot work correctly on character strings " \
+                      "in multibyte locales - " \
+                      "use mbsspn if you care about internationalization"), \
+     strspn (s, a))
+#endif
+
+#if defined GNULIB_POSIXCHECK
+/* strrchr() does not work with multibyte strings if the locale encoding is
+   GB18030 and the character to be searched is a digit.  */
+# undef strrchr
+# define strrchr(s,c) \
+    (GL_LINK_WARNING ("strrchr cannot work correctly on character strings " \
+                      "in some multibyte locales - " \
+                      "use mbsrchr if you care about internationalization"), \
+     strrchr (s, c))
+#endif
+
+/* Search the next delimiter (char listed in DELIM) starting at *STRINGP.
+   If one is found, overwrite it with a NUL, and advance *STRINGP
+   to point to the next char after it.  Otherwise, set *STRINGP to NULL.
+   If *STRINGP was already NULL, nothing happens.
+   Return the old value of *STRINGP.
+
+   This is a variant of strtok() that is multithread-safe and supports
+   empty fields.
+
+   Caveat: It modifies the original string.
+   Caveat: These functions cannot be used on constant strings.
+   Caveat: The identity of the delimiting character is lost.
+   Caveat: It doesn't work with multibyte strings unless all of the delimiter
+           characters are ASCII characters < 0x30.
+
+   See also strtok_r().  */
+#if @GNULIB_STRSEP@
+# if ! @HAVE_STRSEP@
+extern char *strsep (char **restrict __stringp, char const *restrict __delim);
+# endif
+# if defined GNULIB_POSIXCHECK
+#  undef strsep
+#  define strsep(s,d) \
+     (GL_LINK_WARNING ("strsep cannot work correctly on character strings " \
+                       "in multibyte locales - " \
+                       "use mbssep if you care about internationalization"), \
+      strsep (s, d))
+# endif
+#elif defined GNULIB_POSIXCHECK
+# undef strsep
+# define strsep(s,d) \
+    (GL_LINK_WARNING ("strsep is unportable - " \
+                      "use gnulib module strsep for portability"), \
+     strsep (s, d))
+#endif
+
+#if defined GNULIB_POSIXCHECK
+/* strstr() does not work with multibyte strings if the locale encoding is
+   different from UTF-8:
+   POSIX says that it operates on "strings", and "string" in POSIX is defined
+   as a sequence of bytes, not of characters.  */
+# undef strstr
+# define strstr(a,b) \
+    (GL_LINK_WARNING ("strstr cannot work correctly on character strings " \
+                      "in most multibyte locales - " \
+                      "use mbsstr if you care about internationalization"), \
+     strstr (a, b))
+#endif
+
+/* Find the first occurrence of NEEDLE in HAYSTACK, using case-insensitive
+   comparison.  */
+#if ! @HAVE_STRCASESTR@
+extern char *strcasestr (const char *haystack, const char *needle);
+#endif
+#if defined GNULIB_POSIXCHECK
+/* strcasestr() does not work with multibyte strings:
+   It is a glibc extension, and glibc implements it only for unibyte
+   locales.  */
+# undef strcasestr
+# define strcasestr(a,b) \
+    (GL_LINK_WARNING ("strcasestr does work correctly on character strings " \
+                      "in multibyte locales - " \
+                      "use mbscasestr if you care about " \
+                      "internationalization, or use c-strcasestr if you want " 
\
+                      "a locale independent function"), \
+     strcasestr (a, b))
+#endif
+
+/* Parse S into tokens separated by characters in DELIM.
+   If S is NULL, the saved pointer in SAVE_PTR is used as
+   the next starting point.  For example:
+       char s[] = "-abc-=-def";
+       char *sp;
+       x = strtok_r(s, "-", &sp);      // x = "abc", sp = "=-def"
+       x = strtok_r(NULL, "-=", &sp);  // x = "def", sp = NULL
+       x = strtok_r(NULL, "=", &sp);   // x = NULL
+               // s = "abc\0-def\0"
+
+   This is a variant of strtok() that is multithread-safe.
+
+   For the POSIX documentation for this function, see:
+   http://www.opengroup.org/susv3xsh/strtok.html
+
+   Caveat: It modifies the original string.
+   Caveat: These functions cannot be used on constant strings.
+   Caveat: The identity of the delimiting character is lost.
+   Caveat: It doesn't work with multibyte strings unless all of the delimiter
+           characters are ASCII characters < 0x30.
+
+   See also strsep().  */
+#if @GNULIB_STRTOK_R@
+# if ! @HAVE_DECL_STRTOK_R@
+extern char *strtok_r (char *restrict s, char const *restrict delim,
+                      char **restrict save_ptr);
+# endif
+# if defined GNULIB_POSIXCHECK
+#  undef strtok_r
+#  define strtok_r(s,d,p) \
+     (GL_LINK_WARNING ("strtok_r cannot work correctly on character strings " \
+                       "in multibyte locales - " \
+                       "use mbstok_r if you care about internationalization"), 
\
+      strtok_r (s, d, p))
+# endif
+#elif defined GNULIB_POSIXCHECK
+# undef strtok_r
+# define strtok_r(s,d,p) \
+    (GL_LINK_WARNING ("strtok_r is unportable - " \
+                      "use gnulib module strtok_r for portability"), \
+     strtok_r (s, d, p))
+#endif
+
+
+/* The following functions are not specified by POSIX.  They are gnulib
+   extensions.  */
+
+#if @GNULIB_MBSLEN@
+/* Return the number of multibyte characters in the character string STRING.
+   This considers multibyte characters, unlike strlen, which counts bytes.  */
+extern size_t mbslen (const char *string);
+#endif
+
+#if @GNULIB_MBSNLEN@
+/* Return the number of multibyte characters in the character string starting
+   at STRING and ending at STRING + LEN.  */
+extern size_t mbsnlen (const char *string, size_t len);
+#endif
+
+#if @GNULIB_MBSCHR@
+/* Locate the first single-byte character C in the character string STRING,
+   and return a pointer to it.  Return NULL if C is not found in STRING.
+   Unlike strchr(), this function works correctly in multibyte locales with
+   encodings such as GB18030.  */
+# define mbschr rpl_mbschr /* avoid collision with HP-UX function */
+extern char * mbschr (const char *string, int c);
+#endif
+
+#if @GNULIB_MBSRCHR@
+/* Locate the last single-byte character C in the character string STRING,
+   and return a pointer to it.  Return NULL if C is not found in STRING.
+   Unlike strrchr(), this function works correctly in multibyte locales with
+   encodings such as GB18030.  */
+# define mbsrchr rpl_mbsrchr /* avoid collision with HP-UX function */
+extern char * mbsrchr (const char *string, int c);
+#endif
+
+#if @GNULIB_MBSSTR@
+/* Find the first occurrence of the character string NEEDLE in the character
+   string HAYSTACK.  Return NULL if NEEDLE is not found in HAYSTACK.
+   Unlike strstr(), this function works correctly in multibyte locales with
+   encodings different from UTF-8.  */
+extern char * mbsstr (const char *haystack, const char *needle);
+#endif
+
+#if @GNULIB_MBSCASECMP@
+/* Compare the character strings S1 and S2, ignoring case, returning less than,
+   equal to or greater than zero if S1 is lexicographically less than, equal to
+   or greater than S2.
+   Note: This function may, in multibyte locales, return 0 for strings of
+   different lengths!
+   Unlike strcasecmp(), this function works correctly in multibyte locales.  */
+extern int mbscasecmp (const char *s1, const char *s2);
+#endif
+
+#if @GNULIB_MBSNCASECMP@
+/* Compare the initial segment of the character string S1 consisting of at most
+   N characters with the initial segment of the character string S2 consisting
+   of at most N characters, ignoring case, returning less than, equal to or
+   greater than zero if the initial segment of S1 is lexicographically less
+   than, equal to or greater than the initial segment of S2.
+   Note: This function may, in multibyte locales, return 0 for initial segments
+   of different lengths!
+   Unlike strncasecmp(), this function works correctly in multibyte locales.
+   But beware that N is not a byte count but a character count!  */
+extern int mbsncasecmp (const char *s1, const char *s2, size_t n);
+#endif
+
+#if @GNULIB_MBSPCASECMP@
+/* Compare the initial segment of the character string STRING consisting of
+   at most mbslen (PREFIX) characters with the character string PREFIX,
+   ignoring case, returning less than, equal to or greater than zero if this
+   initial segment is lexicographically less than, equal to or greater than
+   PREFIX.
+   Note: This function may, in multibyte locales, return 0 if STRING is of
+   smaller length than PREFIX!
+   Unlike strncasecmp(), this function works correctly in multibyte
+   locales.  */
+extern char * mbspcasecmp (const char *string, const char *prefix);
+#endif
+
+#if @GNULIB_MBSCASESTR@
+/* Find the first occurrence of the character string NEEDLE in the character
+   string HAYSTACK, using case-insensitive comparison.
+   Note: This function may, in multibyte locales, return success even if
+   strlen (haystack) < strlen (needle) !
+   Unlike strcasestr(), this function works correctly in multibyte locales.  */
+extern char * mbscasestr (const char *haystack, const char *needle);
+#endif
+
+#if @GNULIB_MBSCSPN@
+/* Find the first occurrence in the character string STRING of any character
+   in the character string ACCEPT.  Return the number of bytes from the
+   beginning of the string to this occurrence, or to the end of the string
+   if none exists.
+   Unlike strcspn(), this function works correctly in multibyte locales.  */
+extern size_t mbscspn (const char *string, const char *accept);
+#endif
+
+#if @GNULIB_MBSPBRK@
+/* Find the first occurrence in the character string STRING of any character
+   in the character string ACCEPT.  Return the pointer to it, or NULL if none
+   exists.
+   Unlike strpbrk(), this function works correctly in multibyte locales.  */
+# define mbspbrk rpl_mbspbrk /* avoid collision with HP-UX function */
+extern char * mbspbrk (const char *string, const char *accept);
+#endif
+
+#if @GNULIB_MBSSPN@
+/* Find the first occurrence in the character string STRING of any character
+   not in the character string REJECT.  Return the number of bytes from the
+   beginning of the string to this occurrence, or to the end of the string
+   if none exists.
+   Unlike strspn(), this function works correctly in multibyte locales.  */
+extern size_t mbsspn (const char *string, const char *reject);
+#endif
+
+#if @GNULIB_MBSSEP@
+/* Search the next delimiter (multibyte character listed in the character
+   string DELIM) starting at the character string *STRINGP.
+   If one is found, overwrite it with a NUL, and advance *STRINGP to point
+   to the next multibyte character after it.  Otherwise, set *STRINGP to NULL.
+   If *STRINGP was already NULL, nothing happens.
+   Return the old value of *STRINGP.
+
+   This is a variant of mbstok_r() that supports empty fields.
+
+   Caveat: It modifies the original string.
+   Caveat: These functions cannot be used on constant strings.
+   Caveat: The identity of the delimiting character is lost.
+
+   See also mbstok_r().  */
+extern char * mbssep (char **stringp, const char *delim);
+#endif
+
+#if @GNULIB_MBSTOK_R@
+/* Parse the character string STRING into tokens separated by characters in
+   the character string DELIM.
+   If STRING is NULL, the saved pointer in SAVE_PTR is used as
+   the next starting point.  For example:
+       char s[] = "-abc-=-def";
+       char *sp;
+       x = mbstok_r(s, "-", &sp);      // x = "abc", sp = "=-def"
+       x = mbstok_r(NULL, "-=", &sp);  // x = "def", sp = NULL
+       x = mbstok_r(NULL, "=", &sp);   // x = NULL
+               // s = "abc\0-def\0"
+
+   Caveat: It modifies the original string.
+   Caveat: These functions cannot be used on constant strings.
+   Caveat: The identity of the delimiting character is lost.
+
+   See also mbssep().  */
+extern char * mbstok_r (char *string, const char *delim, char **save_ptr);
+#endif
+
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* _GL_STRING_H */
+#endif /* _GL_STRING_H */

Index: sys_socket_.h
===================================================================
RCS file: sys_socket_.h
diff -N sys_socket_.h
--- /dev/null   1 Jan 1970 00:00:00 -0000
+++ sys_socket_.h       22 Aug 2007 12:48:46 -0000      1.1
@@ -0,0 +1,91 @@
+/* Provide a sys/socket header file for systems lacking it (read: MinGW).
+   Copyright (C) 2005, 2006, 2007 Free Software Foundation, Inc.
+   Written by Simon Josefsson.
+
+   This program is free software; you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation; either version 2, or (at your option)
+   any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program; if not, write to the Free Software Foundation,
+   Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.  */
+
+/* This file is supposed to be used on platforms that lack <sys/socket.h>
+   and on platforms where <sys/socket.h> cannot be included standalone.
+   It is intended to provide definitions and prototypes needed by an
+   application.  */
+
+#ifndef _GL_SYS_SOCKET_H
+
+#if @HAVE_SYS_SOCKET_H@
+
+/* On many platforms, <sys/socket.h> assumes prior inclusion of
+   <sys/types.h>.  */
+# include <sys/types.h>
+
+/* The include_next requires a split double-inclusion guard.  */
+# @INCLUDE_NEXT@ @NEXT_SYS_SOCKET_H@
+
+#endif
+
+#ifndef _GL_SYS_SOCKET_H
+#define _GL_SYS_SOCKET_H
+
+#if address@hidden@
+
+/* A platform that lacks <sys/socket.h>.
+
+   Currently only MinGW is supported.  See the gnulib manual regarding
+   Windows sockets.  MinGW has the header files winsock2.h and
+   ws2tcpip.h that declare the sys/socket.h definitions we need.  Note
+   that you can influence which definitions you get by setting the
+   WINVER symbol before including these two files.  For example,
+   getaddrinfo is only available if _WIN32_WINNT >= 0x0501 (that
+   symbol is set indiriectly through WINVER).  You can set this by
+   adding AC_DEFINE(WINVER, 0x0501) to configure.ac.  Note that your
+   code may not run on older Windows releases then.  My Windows 2000
+   box was not able to run the code, for example.  The situation is
+   slightly confusing because:
+   
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/winsock/winsock/getaddrinfo_2.asp
+   suggests that getaddrinfo should be available on all Windows
+   releases. */
+
+
+# if @HAVE_WINSOCK2_H@
+#  include <winsock2.h>
+# endif
+# if @HAVE_WS2TCPIP_H@
+#  include <ws2tcpip.h>
+# endif
+
+/* For shutdown(). */
+# if !defined SHUT_RD && defined SD_RECEIVE
+#  define SHUT_RD SD_RECEIVE
+# endif
+# if !defined SHUT_WR && defined SD_SEND
+#  define SHUT_WR SD_SEND
+# endif
+# if !defined SHUT_RDWR && defined SD_BOTH
+#  define SHUT_RDWR SD_BOTH
+# endif
+
+# if defined _WIN32 || defined __WIN32__
+#  define ENOTSOCK                WSAENOTSOCK
+#  define EADDRINUSE              WSAEADDRINUSE
+#  define ENETRESET               WSAENETRESET
+#  define ECONNABORTED            WSAECONNABORTED
+#  define ECONNRESET              WSAECONNRESET
+#  define ENOTCONN                WSAENOTCONN
+#  define ESHUTDOWN               WSAESHUTDOWN
+# endif
+
+#endif /* HAVE_SYS_SOCKET_H */
+
+#endif /* _GL_SYS_SOCKET_H */
+#endif /* _GL_SYS_SOCKET_H */

Index: sys_stat_.h
===================================================================
RCS file: sys_stat_.h
diff -N sys_stat_.h
--- /dev/null   1 Jan 1970 00:00:00 -0000
+++ sys_stat_.h 22 Aug 2007 12:48:46 -0000      1.1
@@ -0,0 +1,280 @@
+/* Provide a more complete sys/stat header file.
+   Copyright (C) 2006, 2007 Free Software Foundation, Inc.
+
+   This program is free software; you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation; either version 2, or (at your option)
+   any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program; if not, write to the Free Software Foundation,
+   Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.  */
+
+/* Written by Eric Blake, Paul Eggert, and Jim Meyering.  */
+
+/* This file is supposed to be used on platforms where <sys/stat.h> is
+   incomplete.  It is intended to provide definitions and prototypes
+   needed by an application.  Start with what the system provides.  */
+
+#ifndef _GL_SYS_STAT_H
+
+/* The include_next requires a split double-inclusion guard.  */
address@hidden@ @NEXT_SYS_STAT_H@
+
+#ifndef _GL_SYS_STAT_H
+#define _GL_SYS_STAT_H
+
+#ifndef S_IFMT
+# define S_IFMT 0170000
+#endif
+
+#if STAT_MACROS_BROKEN
+# undef S_ISBLK
+# undef S_ISCHR
+# undef S_ISDIR
+# undef S_ISFIFO
+# undef S_ISLNK
+# undef S_ISNAM
+# undef S_ISMPB
+# undef S_ISMPC
+# undef S_ISNWK
+# undef S_ISREG
+# undef S_ISSOCK
+#endif
+
+#ifndef S_ISBLK
+# ifdef S_IFBLK
+#  define S_ISBLK(m) (((m) & S_IFMT) == S_IFBLK)
+# else
+#  define S_ISBLK(m) 0
+# endif
+#endif
+
+#ifndef S_ISCHR
+# ifdef S_IFCHR
+#  define S_ISCHR(m) (((m) & S_IFMT) == S_IFCHR)
+# else
+#  define S_ISCHR(m) 0
+# endif
+#endif
+
+#ifndef S_ISDIR
+# ifdef S_IFDIR
+#  define S_ISDIR(m) (((m) & S_IFMT) == S_IFDIR)
+# else
+#  define S_ISDIR(m) 0
+# endif
+#endif
+
+#ifndef S_ISDOOR /* Solaris 2.5 and up */
+# define S_ISDOOR(m) 0
+#endif
+
+#ifndef S_ISFIFO
+# ifdef S_IFIFO
+#  define S_ISFIFO(m) (((m) & S_IFMT) == S_IFIFO)
+# else
+#  define S_ISFIFO(m) 0
+# endif
+#endif
+
+#ifndef S_ISLNK
+# ifdef S_IFLNK
+#  define S_ISLNK(m) (((m) & S_IFMT) == S_IFLNK)
+# else
+#  define S_ISLNK(m) 0
+# endif
+#endif
+
+#ifndef S_ISMPB /* V7 */
+# ifdef S_IFMPB
+#  define S_ISMPB(m) (((m) & S_IFMT) == S_IFMPB)
+#  define S_ISMPC(m) (((m) & S_IFMT) == S_IFMPC)
+# else
+#  define S_ISMPB(m) 0
+#  define S_ISMPC(m) 0
+# endif
+#endif
+
+#ifndef S_ISNAM /* Xenix */
+# ifdef S_IFNAM
+#  define S_ISNAM(m) (((m) & S_IFMT) == S_IFNAM)
+# else
+#  define S_ISNAM(m) 0
+# endif
+#endif
+
+#ifndef S_ISNWK /* HP/UX */
+# ifdef S_IFNWK
+#  define S_ISNWK(m) (((m) & S_IFMT) == S_IFNWK)
+# else
+#  define S_ISNWK(m) 0
+# endif
+#endif
+
+#ifndef S_ISPORT /* Solaris 10 and up */
+# define S_ISPORT(m) 0
+#endif
+
+#ifndef S_ISREG
+# ifdef S_IFREG
+#  define S_ISREG(m) (((m) & S_IFMT) == S_IFREG)
+# else
+#  define S_ISREG(m) 0
+# endif
+#endif
+
+#ifndef S_ISSOCK
+# ifdef S_IFSOCK
+#  define S_ISSOCK(m) (((m) & S_IFMT) == S_IFSOCK)
+# else
+#  define S_ISSOCK(m) 0
+# endif
+#endif
+
+
+#ifndef S_TYPEISMQ
+# define S_TYPEISMQ(p) 0
+#endif
+
+#ifndef S_TYPEISTMO
+# define S_TYPEISTMO(p) 0
+#endif
+
+
+#ifndef S_TYPEISSEM
+# ifdef S_INSEM
+#  define S_TYPEISSEM(p) (S_ISNAM ((p)->st_mode) && (p)->st_rdev == S_INSEM)
+# else
+#  define S_TYPEISSEM(p) 0
+# endif
+#endif
+
+#ifndef S_TYPEISSHM
+# ifdef S_INSHD
+#  define S_TYPEISSHM(p) (S_ISNAM ((p)->st_mode) && (p)->st_rdev == S_INSHD)
+# else
+#  define S_TYPEISSHM(p) 0
+# endif
+#endif
+
+/* high performance ("contiguous data") */
+#ifndef S_ISCTG
+# define S_ISCTG(p) 0
+#endif
+
+/* Cray DMF (data migration facility): off line, with data  */
+#ifndef S_ISOFD
+# define S_ISOFD(p) 0
+#endif
+
+/* Cray DMF (data migration facility): off line, with no data  */
+#ifndef S_ISOFL
+# define S_ISOFL(p) 0
+#endif
+
+/* 4.4BSD whiteout */
+#ifndef S_ISWHT
+# define S_ISWHT(m) 0
+#endif
+
+/* If any of the following are undefined,
+   define them to their de facto standard values.  */
+#if !S_ISUID
+# define S_ISUID 04000
+#endif
+#if !S_ISGID
+# define S_ISGID 02000
+#endif
+
+/* S_ISVTX is a common extension to POSIX.  */
+#ifndef S_ISVTX
+# define S_ISVTX 01000
+#endif
+
+#if !S_IRUSR && S_IREAD
+# define S_IRUSR S_IREAD
+#endif
+#if !S_IRUSR
+# define S_IRUSR 00400
+#endif
+#if !S_IRGRP
+# define S_IRGRP (S_IRUSR >> 3)
+#endif
+#if !S_IROTH
+# define S_IROTH (S_IRUSR >> 6)
+#endif
+
+#if !S_IWUSR && S_IWRITE
+# define S_IWUSR S_IWRITE
+#endif
+#if !S_IWUSR
+# define S_IWUSR 00200
+#endif
+#if !S_IWGRP
+# define S_IWGRP (S_IWUSR >> 3)
+#endif
+#if !S_IWOTH
+# define S_IWOTH (S_IWUSR >> 6)
+#endif
+
+#if !S_IXUSR && S_IEXEC
+# define S_IXUSR S_IEXEC
+#endif
+#if !S_IXUSR
+# define S_IXUSR 00100
+#endif
+#if !S_IXGRP
+# define S_IXGRP (S_IXUSR >> 3)
+#endif
+#if !S_IXOTH
+# define S_IXOTH (S_IXUSR >> 6)
+#endif
+
+#if !S_IRWXU
+# define S_IRWXU (S_IRUSR | S_IWUSR | S_IXUSR)
+#endif
+#if !S_IRWXG
+# define S_IRWXG (S_IRGRP | S_IWGRP | S_IXGRP)
+#endif
+#if !S_IRWXO
+# define S_IRWXO (S_IROTH | S_IWOTH | S_IXOTH)
+#endif
+
+/* S_IXUGO is a common extension to POSIX.  */
+#if !S_IXUGO
+# define S_IXUGO (S_IXUSR | S_IXGRP | S_IXOTH)
+#endif
+
+#ifndef S_IRWXUGO
+# define S_IRWXUGO (S_IRWXU | S_IRWXG | S_IRWXO)
+#endif
+
+/* mingw does not support symlinks, therefore it does not have lstat.  But
+   without links, stat does just fine.  */
+#if ! @HAVE_LSTAT@
+# define lstat stat
+#endif
+
+/* mingw's _mkdir() function has 1 argument, but we pass 2 arguments.
+   Additionally, it declares _mkdir (and depending on compile flags, an
+   alias mkdir), only in the nonstandard io.h.  */
+#if ! @HAVE_DECL_MKDIR@ && @HAVE_IO_H@
+# include <io.h>
+
+static inline int
+rpl_mkdir (char const *name, mode_t mode)
+{
+  return _mkdir (name);
+}
+
+# define mkdir rpl_mkdir
+#endif
+
+#endif /* _GL_SYS_STAT_H */
+#endif /* _GL_SYS_STAT_H */

Index: sys_time_.h
===================================================================
RCS file: sys_time_.h
diff -N sys_time_.h
--- /dev/null   1 Jan 1970 00:00:00 -0000
+++ sys_time_.h 22 Aug 2007 12:48:46 -0000      1.1
@@ -0,0 +1,52 @@
+/* Provide a more complete sys/time.h.
+
+   Copyright (C) 2007 Free Software Foundation, Inc.
+
+   This program is free software; you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation; either version 2, or (at your option)
+   any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program; if not, write to the Free Software Foundation,
+   Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.  */
+
+/* Written by Paul Eggert.  */
+
+#if defined _GL_SYS_TIME_H
+
+/* Simply delegate to the system's header, without adding anything.  */
+# if @HAVE_SYS_TIME_H@
+#  @INCLUDE_NEXT@ @NEXT_SYS_TIME_H@
+# endif
+
+#else
+
+# define _GL_SYS_TIME_H
+
+# if @HAVE_SYS_TIME_H@
+#  @INCLUDE_NEXT@ @NEXT_SYS_TIME_H@
+# else
+#  include <time.h>
+# endif
+
+# if ! @HAVE_STRUCT_TIMEVAL@
+struct timeval
+{
+  time_t tv_sec;
+  long int tv_usec;
+};
+# endif
+
+# if @REPLACE_GETTIMEOFDAY@
+#  undef gettimeofday
+#  define gettimeofday rpl_gettimeofday
+int gettimeofday (struct timeval *restrict, void *restrict);
+# endif
+
+#endif /* _GL_SYS_TIME_H */

Index: tempname.h
===================================================================
RCS file: tempname.h
diff -N tempname.h
--- /dev/null   1 Jan 1970 00:00:00 -0000
+++ tempname.h  22 Aug 2007 12:48:47 -0000      1.1
@@ -0,0 +1,40 @@
+/* Create a temporary file or directory.
+
+   Copyright (C) 2006 Free Software Foundation, Inc.
+
+   This program is free software; you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation; either version 2, or (at your option)
+   any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program; if not, write to the Free Software Foundation,
+   Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.  */
+
+/* header written by Eric Blake */
+
+/* In gnulib, always prefer large files.  GT_FILE maps to
+   __GT_BIGFILE, not __GT_FILE, for a reason.  */
+#define GT_FILE                1
+#define GT_DIR         2
+#define GT_NOCREATE    3
+
+/* Generate a temporary file name based on TMPL.  TMPL must match the
+   rules for mk[s]temp (i.e. end in "XXXXXX").  The name constructed
+   does not exist at the time of the call to gen_tempname.  TMPL is
+   overwritten with the result.
+
+   KIND may be one of:
+   GT_NOCREATE:                simply verify that the name does not exist
+                       at the time of the call.
+   GT_FILE:            create a large file using open(O_CREAT|O_EXCL)
+                       and return a read-write fd.  The file is mode 0600.
+   GT_DIR:             create a directory, which will be mode 0700.
+
+   We use a clever algorithm to get hard-to-predict names. */
+extern int gen_tempname (char *tmpl, int kind);

Index: time_.h
===================================================================
RCS file: time_.h
diff -N time_.h
--- /dev/null   1 Jan 1970 00:00:00 -0000
+++ time_.h     22 Aug 2007 12:48:47 -0000      1.1
@@ -0,0 +1,114 @@
+/* A more-standard <time.h>.
+
+   Copyright (C) 2007 Free Software Foundation, Inc.
+
+   This program is free software; you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation; either version 2, or (at your option)
+   any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program; if not, write to the Free Software Foundation,
+   Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.  */
+
+/* Don't get in the way of glibc when it includes time.h merely to
+   declare a few standard symbols, rather than to declare all the
+   symbols.  Also, Solaris 8 <time.h> eventually includes itself
+   recursively; if that is happening, just include the system <time.h>
+   without adding our own declarations.  */
+#if (defined __need_time_t || defined __need_clock_t \
+     || defined __need_timespec \
+     || defined _GL_TIME_H)
+
+# @INCLUDE_NEXT@ @NEXT_TIME_H@
+
+#else
+
+# define _GL_TIME_H
+
+# @INCLUDE_NEXT@ @NEXT_TIME_H@
+
+# ifdef __cplusplus
+extern "C" {
+# endif
+
+/* Some systems don't define struct timespec (e.g., AIX 4.1, Ultrix 4.3).
+   Or they define it with the wrong member names or define it in <sys/time.h>
+   (e.g., FreeBSD circa 1997).  */
+# if ! @TIME_H_DEFINES_STRUCT_TIMESPEC@
+#  if @SYS_TIME_H_DEFINES_STRUCT_TIMESPEC@
+#   include <sys/time.h>
+#  else
+#   undef timespec
+#   define timespec rpl_timespec
+struct timespec
+{
+  time_t tv_sec;
+  long int tv_nsec;
+};
+#  endif
+# endif
+
+/* Sleep for at least RQTP seconds unless interrupted,  If interrupted,
+   return -1 and store the remaining time into RMTP.  See
+   <http://www.opengroup.org/susv3xsh/nanosleep.html>.  */
+# if @REPLACE_NANOSLEEP@
+#  define nanosleep rpl_nanosleep
+int nanosleep (struct timespec const *__rqtp, struct timespec *__rmtp);
+# endif
+
+/* Convert TIMER to RESULT, assuming local time and UTC respectively.  See
+   <http://www.opengroup.org/susv3xsh/localtime_r.html> and
+   <http://www.opengroup.org/susv3xsh/gmtime_r.html>.  */
+# if @REPLACE_LOCALTIME_R@
+#  undef localtime_r
+#  define localtime_r rpl_localtime_r
+#  undef gmtime_r
+#  define gmtime_r rpl_gmtime_r
+struct tm *localtime_r (time_t const *restrict __timer,
+                       struct tm *restrict __result);
+struct tm *gmtime_r (time_t const *restrict __timer,
+                    struct tm *restrict __result);
+# endif
+
+/* Parse BUF as a time stamp, assuming FORMAT specifies its layout, and store
+   the resulting broken-down time into TM.  See
+   <http://www.opengroup.org/susv3xsh/strptime.html>.  */
+# if @REPLACE_STRPTIME@
+#  undef strptime
+#  define strptime rpl_strptime
+char *strptime (char const *restrict __buf, char const *restrict __format,
+               struct tm *restrict __tm);
+# endif
+
+/* Convert TM to a time_t value, assuming UTC.  */
+# if @REPLACE_TIMEGM@
+#  undef timegm
+#  define timegm rpl_timegm
+time_t timegm (struct tm *__tm);
+# endif
+
+/* Encourage applications to avoid unsafe functions that can overrun
+   buffers when given outlandish struct tm values.  Portable
+   applications should use strftime (or even sprintf) instead.  */
+# if GNULIB_PORTCHECK
+#  undef asctime
+#  define asctime eschew_asctime
+#  undef asctime_r
+#  define asctime_r eschew_asctime_r
+#  undef ctime
+#  define ctime eschew_ctime
+#  undef ctime_r
+#  define ctime_r eschew_ctime_r
+# endif
+
+# ifdef __cplusplus
+}
+# endif
+
+#endif

Index: unistd_.h
===================================================================
RCS file: unistd_.h
diff -N unistd_.h
--- /dev/null   1 Jan 1970 00:00:00 -0000
+++ unistd_.h   22 Aug 2007 12:48:47 -0000      1.1
@@ -0,0 +1,262 @@
+/* Substitute for and wrapper around <unistd.h>.
+   Copyright (C) 2004-2007 Free Software Foundation, Inc.
+
+   This program is free software; you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation; either version 2, or (at your option)
+   any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program; if not, write to the Free Software Foundation,
+   Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.  */
+
+#ifndef _GL_UNISTD_H
+
+/* The include_next requires a split double-inclusion guard.  */
+#if @HAVE_UNISTD_H@
+# @INCLUDE_NEXT@ @NEXT_UNISTD_H@
+#endif
+
+#ifndef _GL_UNISTD_H
+#define _GL_UNISTD_H
+
+/* mingw doesn't define the SEEK_* macros in <unistd.h>.  */
+#if !(defined SEEK_CUR && defined SEEK_END && defined SEEK_SET)
+# include <stdio.h>
+#endif
+
+/* mingw fails to declare _exit in <unistd.h>.  */
+#include <stdlib.h>
+
+/* The definition of GL_LINK_WARNING is copied here.  */
+
+
+/* Declare overridden functions.  */
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+
+#if @GNULIB_CHOWN@
+# if @REPLACE_CHOWN@
+#  ifndef REPLACE_CHOWN
+#   define REPLACE_CHOWN 1
+#  endif
+#  if REPLACE_CHOWN
+/* Change the owner of FILE to UID (if UID is not -1) and the group of FILE
+   to GID (if GID is not -1).  Follow symbolic links.
+   Return 0 if successful, otherwise -1 and errno set.
+   See the POSIX:2001 specification
+   <http://www.opengroup.org/susv3xsh/chown.html>.  */
+#   define chown rpl_chown
+extern int chown (const char *file, uid_t uid, gid_t gid);
+#  endif
+# endif
+#elif defined GNULIB_POSIXCHECK
+# undef chown
+# define chown(f,u,g) \
+    (GL_LINK_WARNING ("chown fails to follow symlinks on some systems and " \
+                      "doesn't treat a uid or gid of -1 on some systems - " \
+                      "use gnulib module chown for portability"), \
+     chown (f, u, g))
+#endif
+
+
+#if @GNULIB_DUP2@
+# if address@hidden@
+/* Copy the file descriptor OLDFD into file descriptor NEWFD.  Do nothing if
+   NEWFD = OLDFD, otherwise close NEWFD first if it is open.
+   Return 0 if successful, otherwise -1 and errno set.
+   See the POSIX:2001 specification
+   <http://www.opengroup.org/susv3xsh/dup2.html>.  */
+extern int dup2 (int oldfd, int newfd);
+# endif
+#elif defined GNULIB_POSIXCHECK
+# undef dup2
+# define dup2(o,n) \
+    (GL_LINK_WARNING ("dup2 is unportable - " \
+                      "use gnulib module dup2 for portability"), \
+     dup2 (o, n))
+#endif
+
+
+#if @GNULIB_FCHDIR@
+# if @REPLACE_FCHDIR@
+
+/* Change the process' current working directory to the directory on which
+   the given file descriptor is open.
+   Return 0 if successful, otherwise -1 and errno set.
+   See the POSIX:2001 specification
+   <http://www.opengroup.org/susv3xsh/fchdir.html>.  */
+extern int fchdir (int /*fd*/);
+
+#  define close rpl_close
+extern int close (int);
+#  define dup rpl_dup
+extern int dup (int);
+#  define dup2 rpl_dup2
+extern int dup2 (int, int);
+
+# endif
+#elif defined GNULIB_POSIXCHECK
+# undef fchdir
+# define fchdir(f) \
+    (GL_LINK_WARNING ("fchdir is unportable - " \
+                      "use gnulib module fchdir for portability"), \
+     fchdir (f))
+#endif
+
+
+#if @GNULIB_FTRUNCATE@
+# if address@hidden@
+/* Change the size of the file to which FD is opened to become equal to LENGTH.
+   Return 0 if successful, otherwise -1 and errno set.
+   See the POSIX:2001 specification
+   <http://www.opengroup.org/susv3xsh/ftruncate.html>.  */
+extern int ftruncate (int fd, off_t length);
+# endif
+#elif defined GNULIB_POSIXCHECK
+# undef ftruncate
+# define ftruncate(f,l) \
+    (GL_LINK_WARNING ("ftruncate is unportable - " \
+                      "use gnulib module ftruncate for portability"), \
+     ftruncate (f, l))
+#endif
+
+
+#if @GNULIB_GETCWD@
+/* Include the headers that might declare getcwd so that they will not
+   cause confusion if included after this file.  */
+# include <stdlib.h>
+# if @REPLACE_GETCWD@
+/* Get the name of the current working directory, and put it in SIZE bytes
+   of BUF.
+   Return BUF if successful, or NULL if the directory couldn't be determined
+   or SIZE was too small.
+   See the POSIX:2001 specification
+   <http://www.opengroup.org/susv3xsh/getcwd.html>.
+   Additionally, the gnulib module 'getcwd' guarantees the following GNU
+   extension: If BUF is NULL, an array is allocated with 'malloc'; the array
+   is SIZE bytes long, unless SIZE == 0, in which case it is as big as
+   necessary.  */
+#  define getcwd rpl_getcwd
+extern char * getcwd (char *buf, size_t size);
+# endif
+#elif defined GNULIB_POSIXCHECK
+# undef getcwd
+# define getcwd(b,s) \
+    (GL_LINK_WARNING ("getcwd is unportable - " \
+                      "use gnulib module getcwd for portability"), \
+     getcwd (b, s))
+#endif
+
+
+#if @GNULIB_GETLOGIN_R@
+/* Copies the user's login name to NAME.
+   The array pointed to by NAME has room for SIZE bytes.
+
+   Returns 0 if successful.  Upon error, an error number is returned, or -1 in
+   the case that the login name cannot be found but no specific error is
+   provided (this case is hopefully rare but is left open by the POSIX spec).
+
+   See <http://www.opengroup.org/susv3xsh/getlogin.html>.
+ */
+# if address@hidden@
+#  include <stddef.h>
+extern int getlogin_r (char *name, size_t size);
+# endif
+#elif defined GNULIB_POSIXCHECK
+# undef getlogin_r
+# define getlogin_r(n,s) \
+    (GL_LINK_WARNING ("getlogin_r is unportable - " \
+                      "use gnulib module getlogin_r for portability"), \
+     getlogin_r (n, s))
+#endif
+
+
+#if @GNULIB_LCHOWN@
+# if @REPLACE_LCHOWN@
+/* Change the owner of FILE to UID (if UID is not -1) and the group of FILE
+   to GID (if GID is not -1).  Do not follow symbolic links.
+   Return 0 if successful, otherwise -1 and errno set.
+   See the POSIX:2001 specification
+   <http://www.opengroup.org/susv3xsh/lchown.html>.  */
+#  define lchown rpl_lchown
+extern int lchown (char const *file, uid_t owner, gid_t group);
+# endif
+#elif defined GNULIB_POSIXCHECK
+# undef lchown
+# define lchown(f,u,g) \
+    (GL_LINK_WARNING ("lchown is unportable to pre-POSIX.1-2001 " \
+                      "systems - use gnulib module lchown for portability"), \
+     lchown (f, u, g))
+#endif
+
+
+#if @GNULIB_LSEEK@
+# if @REPLACE_LSEEK@
+/* Set the offset of FD relative to SEEK_SET, SEEK_CUR, or SEEK_END.
+   Return the new offset if successful, otherwise -1 and errno set.
+   See the POSIX:2001 specification
+   <http://www.opengroup.org/susv3xsh/lseek.html>.  */
+#  define lseek rpl_lseek
+   extern off_t lseek (int fd, off_t offset, int whence);
+# endif
+#elif defined GNULIB_POSIXCHECK
+# undef lseek
+# define lseek(f,o,w) \
+    (GL_LINK_WARNING ("lseek does not fail with ESPIPE on pipes on some " \
+                      "systems - use gnulib module lseek for portability"), \
+     lseek (f, o, w))
+#endif
+
+
+#if @GNULIB_READLINK@
+/* Read the contents of the symbolic link FILE and place the first BUFSIZE
+   bytes of it into BUF.  Return the number of bytes placed into BUF if
+   successful, otherwise -1 and errno set.
+   See the POSIX:2001 specification
+   <http://www.opengroup.org/susv3xsh/readlink.html>.  */
+# if address@hidden@
+#  include <stddef.h>
+extern int readlink (const char *file, char *buf, size_t bufsize);
+# endif
+#elif defined GNULIB_POSIXCHECK
+# undef readlink
+# define readlink(f,b,s) \
+    (GL_LINK_WARNING ("readlink is unportable - " \
+                      "use gnulib module readlink for portability"), \
+     readlink (f, b, s))
+#endif
+
+
+#if @GNULIB_SLEEP@
+/* Pause the execution of the current thread for N seconds.
+   Returns the number of seconds left to sleep.
+   See the POSIX:2001 specification
+   <http://www.opengroup.org/susv3xsh/sleep.html>.  */
+# if address@hidden@
+extern unsigned int sleep (unsigned int n);
+# endif
+#elif defined GNULIB_POSIXCHECK
+# undef sleep
+# define sleep(n) \
+    (GL_LINK_WARNING ("sleep is unportable - " \
+                      "use gnulib module sleep for portability"), \
+     sleep (n))
+#endif
+
+
+#ifdef __cplusplus
+}
+#endif
+
+
+#endif /* _GL_UNISTD_H */
+#endif /* _GL_UNISTD_H */

Index: unitypes.h
===================================================================
RCS file: unitypes.h
diff -N unitypes.h
--- /dev/null   1 Jan 1970 00:00:00 -0000
+++ unitypes.h  22 Aug 2007 12:48:47 -0000      1.1
@@ -0,0 +1,28 @@
+/* Elementary types for the GNU UniString library.
+   Copyright (C) 2002, 2005-2006 Free Software Foundation, Inc.
+
+   This program is free software; you can redistribute it and/or modify it
+   under the terms of the GNU Library General Public License as published
+   by the Free Software Foundation; either version 2, or (at your option)
+   any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   Library General Public License for more details.
+
+   You should have received a copy of the GNU Library General Public
+   License along with this program; if not, write to the Free Software
+   Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
+   USA.  */
+
+#ifndef _UNITYPES_H
+#define _UNITYPES_H
+
+/* Get uint8_t, uint16_t, uint32_t.  */
+#include <stdint.h>
+
+/* Type representing a Unicode character.  */
+typedef uint32_t ucs4_t;
+
+#endif /* _UNITYPES_H */

Index: uniwidth.h
===================================================================
RCS file: uniwidth.h
diff -N uniwidth.h
--- /dev/null   1 Jan 1970 00:00:00 -0000
+++ uniwidth.h  22 Aug 2007 12:48:47 -0000      1.1
@@ -0,0 +1,66 @@
+/* Display width functions.
+   Copyright (C) 2001-2002, 2005, 2007 Free Software Foundation, Inc.
+
+   This program is free software; you can redistribute it and/or modify it
+   under the terms of the GNU Library General Public License as published
+   by the Free Software Foundation; either version 2, or (at your option)
+   any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   Library General Public License for more details.
+
+   You should have received a copy of the GNU Library General Public
+   License along with this program; if not, write to the Free Software
+   Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
+   USA.  */
+
+#ifndef _UNIWIDTH_H
+#define _UNIWIDTH_H
+
+#include "unitypes.h"
+
+/* Get size_t.  */
+#include <stddef.h>
+
+/* Get locale_charset() declaration.  */
+#include "localcharset.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+
+/* Display width.  */
+
+/* These functions are locale dependent.  The encoding argument identifies
+   the encoding (e.g. "ISO-8859-2" for Polish).  */
+
+/* Determine number of column positions required for UC.  */
+extern int
+       uc_width (ucs4_t uc, const char *encoding);
+
+/* Determine number of column positions required for first N units
+   (or fewer if S ends before this) in S.  */
+extern int
+       u8_width (const uint8_t *s, size_t n, const char *encoding);
+extern int
+       u16_width (const uint16_t *s, size_t n, const char *encoding);
+extern int
+       u32_width (const uint32_t *s, size_t n, const char *encoding);
+
+/* Determine number of column positions required for S.  */
+extern int
+       u8_strwidth (const uint8_t *s, const char *encoding);
+extern int
+       u16_strwidth (const uint16_t *s, const char *encoding);
+extern int
+       u32_strwidth (const uint32_t *s, const char *encoding);
+
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* _UNIWIDTH_H */

Index: wchar_.h
===================================================================
RCS file: wchar_.h
diff -N wchar_.h
--- /dev/null   1 Jan 1970 00:00:00 -0000
+++ wchar_.h    22 Aug 2007 12:48:47 -0000      1.1
@@ -0,0 +1,82 @@
+/* A substitute for ISO C99 <wchar.h>, for platforms that have issues.
+
+   Copyright (C) 2007 Free Software Foundation, Inc.
+
+   This program is free software; you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation; either version 2, or (at your option)
+   any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program; if not, write to the Free Software Foundation,
+   Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.  */
+
+/* Written by Eric Blake.  */
+
+/*
+ * ISO C 99 <wchar.h> for platforms that have issues.
+ * <http://www.opengroup.org/susv3xbd/wchar.h.html>
+ *
+ * For now, this just ensures proper prerequisite inclusion order and
+ * the declaration of wcwidth().
+ */
+
+#ifndef _GL_WCHAR_H
+
+/* 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 the original <wchar.h> if it exists.
+   Some builds of uClibc lack it.  */
+/* The include_next requires a split double-inclusion guard.  */
+#if @HAVE_WCHAR_H@
+# @INCLUDE_NEXT@ @NEXT_WCHAR_H@
+#endif
+
+#ifndef _GL_WCHAR_H
+#define _GL_WCHAR_H
+
+/* The definition of GL_LINK_WARNING is copied here.  */
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+
+/* Return the number of screen columns needed for WC.  */
+#if @GNULIB_WCWIDTH@
+# if @REPLACE_WCWIDTH@
+#  undef wcwidth
+#  define wcwidth rpl_wcwidth
+extern int wcwidth (wchar_t);
+# else
+#  if !defined wcwidth && address@hidden@
+/* wcwidth exists but is not declared.  */
+extern int wcwidth (int /* actually wchar_t */);
+#  endif
+# endif
+#elif defined GNULIB_POSIXCHECK
+# undef wcwidth
+# define wcwidth(w) \
+    (GL_LINK_WARNING ("wcwidth is unportable - " \
+                      "use gnulib module wcwidth for portability"), \
+     wcwidth (w))
+#endif
+
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* _GL_WCHAR_H */
+#endif /* _GL_WCHAR_H */

Index: wctype_.h
===================================================================
RCS file: wctype_.h
diff -N wctype_.h
--- /dev/null   1 Jan 1970 00:00:00 -0000
+++ wctype_.h   22 Aug 2007 12:48:47 -0000      1.1
@@ -0,0 +1,161 @@
+/* A substitute for ISO C99 <wctype.h>, for platforms that lack it.
+
+   Copyright (C) 2006, 2007 Free Software Foundation, Inc.
+
+   This program is free software; you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation; either version 2, or (at your option)
+   any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program; if not, write to the Free Software Foundation,
+   Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.  */
+
+/* Written by Bruno Haible and Paul Eggert.  */
+
+/*
+ * ISO C 99 <wctype.h> for platforms that lack it.
+ * <http://www.opengroup.org/susv3xbd/wctype.h.html>
+ *
+ * iswctype, towctrans, towlower, towupper, wctrans, wctype,
+ * wctrans_t, and wctype_t are not yet implemented.
+ */
+
+#ifndef _GL_WCTYPE_H
+
+#if @HAVE_WINT_T@
+/* Solaris 2.5 has a bug: <wchar.h> must be included before <wctype.h>.
+   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>
+#endif
+
+/* Include the original <wctype.h> if it exists.
+   BeOS 5 has the functions but no <wctype.h>.  */
+/* The include_next requires a split double-inclusion guard.  */
+#if @HAVE_WCTYPE_H@
+# @INCLUDE_NEXT@ @NEXT_WCTYPE_H@
+#endif
+
+#ifndef _GL_WCTYPE_H
+#define _GL_WCTYPE_H
+
+#if @HAVE_WINT_T@
+typedef wint_t __wctype_wint_t;
+#else
+typedef int __wctype_wint_t;
+#endif
+
+/* FreeBSD 4.4 to 4.11 has <wctype.h> but lacks the functions.
+   Assume all 12 functions are implemented the same way, or not at all.  */
+#if ! @HAVE_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
+
+static inline int
+iswalnum (__wctype_wint_t wc)
+{
+  return ((wc >= '0' && wc <= '9')
+         || ((wc & ~0x20) >= 'A' && (wc & ~0x20) <= 'Z'));
+}
+
+static inline int
+iswalpha (__wctype_wint_t wc)
+{
+  return (wc & ~0x20) >= 'A' && (wc & ~0x20) <= 'Z';
+}
+
+static inline int
+iswblank (__wctype_wint_t wc)
+{
+  return wc == ' ' || wc == '\t';
+}
+
+static inline int
+iswcntrl (__wctype_wint_t wc)
+{
+  return (wc & ~0x1f) == 0 || wc == 0x7f;
+}
+
+static inline int
+iswdigit (__wctype_wint_t wc)
+{
+  return wc >= '0' && wc <= '9';
+}
+
+static inline int
+iswgraph (__wctype_wint_t wc)
+{
+  return wc >= '!' && wc <= '~';
+}
+
+static inline int
+iswlower (__wctype_wint_t wc)
+{
+  return wc >= 'a' && wc <= 'z';
+}
+
+static inline int
+iswprint (__wctype_wint_t wc)
+{
+  return wc >= ' ' && wc <= '~';
+}
+
+static inline int
+iswpunct (__wctype_wint_t wc)
+{
+  return (wc >= '!' && wc <= '~'
+         && !((wc >= '0' && wc <= '9')
+              || ((wc & ~0x20) >= 'A' && (wc & ~0x20) <= 'Z')));
+}
+
+static inline int
+iswspace (__wctype_wint_t wc)
+{
+  return (wc == ' ' || wc == '\t'
+         || wc == '\n' || wc == '\v' || wc == '\f' || wc == '\r');
+}
+
+static inline int
+iswupper (__wctype_wint_t wc)
+{
+  return wc >= 'A' && wc <= 'Z';
+}
+
+static inline int
+iswxdigit (__wctype_wint_t wc)
+{
+  return ((wc >= '0' && wc <= '9')
+         || ((wc & ~0x20) >= 'A' && (wc & ~0x20) <= 'F'));
+}
+
+# endif /* ! HAVE_ISWCNTRL */
+
+#endif /* _GL_WCTYPE_H */
+#endif /* _GL_WCTYPE_H */

Index: wcwidth.c
===================================================================
RCS file: wcwidth.c
diff -N wcwidth.c
--- /dev/null   1 Jan 1970 00:00:00 -0000
+++ wcwidth.c   22 Aug 2007 12:48:48 -0000      1.1
@@ -0,0 +1,52 @@
+/* Determine the number of screen columns needed for a character.
+   Copyright (C) 2006, 2007 Free Software Foundation, Inc.
+
+   This program is free software; you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation; either version 2, or (at your option)
+   any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program; if not, write to the Free Software Foundation,
+   Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.  */
+
+#include <config.h>
+
+/* Specification.  */
+#include <wchar.h>
+
+/* Get iswprint.  */
+#include <wctype.h>
+
+#include "localcharset.h"
+#include "streq.h"
+#include "uniwidth.h"
+
+#undef wcwidth
+
+int
+rpl_wcwidth (wchar_t wc)
+{
+  /* In UTF-8 locales, use a Unicode aware width function.  */
+  const char *encoding = locale_charset ();
+  if (STREQ (encoding, "UTF-8", 'U', 'T', 'F', '-', '8', 0, 0, 0 ,0))
+    {
+      /* We assume that in a UTF-8 locale, a wide character is the same as a
+        Unicode character.  */
+      return uc_width (wc, encoding);
+    }
+  else
+    {
+      /* Otherwise, fall back to the system's wcwidth function.  */
+#if HAVE_WCWIDTH
+      return wcwidth (wc);
+#else
+      return wc == 0 ? 0 : iswprint (wc) ? 1 : -1;
+#endif
+    }
+}

Index: uniwidth/.cvsignore
===================================================================
RCS file: uniwidth/.cvsignore
diff -N uniwidth/.cvsignore
--- /dev/null   1 Jan 1970 00:00:00 -0000
+++ uniwidth/.cvsignore 22 Aug 2007 12:48:48 -0000      1.1
@@ -0,0 +1,4 @@
+.deps
+.dirstamp
+cjk.h
+width.c

Index: uniwidth/cjk.h
===================================================================
RCS file: uniwidth/cjk.h
diff -N uniwidth/cjk.h
--- /dev/null   1 Jan 1970 00:00:00 -0000
+++ uniwidth/cjk.h      22 Aug 2007 12:48:48 -0000      1.1
@@ -0,0 +1,39 @@
+/* Test for CJK encoding.
+   Copyright (C) 2001-2002, 2005-2007 Free Software Foundation, Inc.
+   Written by Bruno Haible <address@hidden>, 2002.
+
+   This program is free software; you can redistribute it and/or modify it
+   under the terms of the GNU Library General Public License as published
+   by the Free Software Foundation; either version 2, or (at your option)
+   any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   Library General Public License for more details.
+
+   You should have received a copy of the GNU Library General Public
+   License along with this program; if not, write to the Free Software
+   Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
+   USA.  */
+
+#include "streq.h"
+
+static int
+is_cjk_encoding (const char *encoding)
+{
+  if (0
+      /* Legacy Japanese encodings */
+      || STREQ (encoding, "EUC-JP", 'E', 'U', 'C', '-', 'J', 'P', 0, 0, 0)
+      /* Legacy Chinese encodings */
+      || STREQ (encoding, "GB2312", 'G', 'B', '2', '3', '1', '2', 0, 0, 0)
+      || STREQ (encoding, "GBK", 'G', 'B', 'K', 0, 0, 0, 0, 0, 0)
+      || STREQ (encoding, "EUC-TW", 'E', 'U', 'C', '-', 'T', 'W', 0, 0, 0)
+      || STREQ (encoding, "BIG5", 'B', 'I', 'G', '5', 0, 0, 0, 0, 0)
+      /* Legacy Korean encodings */
+      || STREQ (encoding, "EUC-KR", 'E', 'U', 'C', '-', 'K', 'R', 0, 0, 0)
+      || STREQ (encoding, "CP949", 'C', 'P', '9', '4', '9', 0, 0, 0, 0)
+      || STREQ (encoding, "JOHAB", 'J', 'O', 'H', 'A', 'B', 0, 0, 0, 0))
+    return 1;
+  return 0;
+}

Index: uniwidth/width.c
===================================================================
RCS file: uniwidth/width.c
diff -N uniwidth/width.c
--- /dev/null   1 Jan 1970 00:00:00 -0000
+++ uniwidth/width.c    22 Aug 2007 12:48:49 -0000      1.1
@@ -0,0 +1,325 @@
+/* Determine display width of Unicode character.
+   Copyright (C) 2001-2002, 2006-2007 Free Software Foundation, Inc.
+   Written by Bruno Haible <address@hidden>, 2002.
+
+   This program is free software; you can redistribute it and/or modify it
+   under the terms of the GNU Library General Public License as published
+   by the Free Software Foundation; either version 2, or (at your option)
+   any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   Library General Public License for more details.
+
+   You should have received a copy of the GNU Library General Public
+   License along with this program; if not, write to the Free Software
+   Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
+   USA.  */
+
+#include <config.h>
+
+/* Specification.  */
+#include "uniwidth.h"
+
+#include "cjk.h"
+
+/*
+ * Non-spacing attribute table.
+ * Consists of:
+ * - Non-spacing characters; generated from PropList.txt or
+ *   "grep '^[^;]*;[^;]*;[^;]*;[^;]*;NSM;' UnicodeData.txt"
+ * - Format control characters; generated from
+ *   "grep '^[^;]*;[^;]*;Cf;' UnicodeData.txt"
+ * - Zero width characters; generated from
+ *   "grep '^[^;]*;ZERO WIDTH ' UnicodeData.txt"
+ */
+static const unsigned char nonspacing_table_data[22*64] = {
+  /* 0x0000-0x01ff */
+  0xff, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, /* 0x0000-0x003f */
+  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, /* 0x0040-0x007f */
+  0xff, 0xff, 0xff, 0xff, 0x00, 0x08, 0x00, 0x00, /* 0x0080-0x00bf */
+  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x00c0-0x00ff */
+  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x0100-0x013f */
+  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x0140-0x017f */
+  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x0180-0x01bf */
+  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x01c0-0x01ff */
+  /* 0x0200-0x03ff */
+  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x0200-0x023f */
+  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x0240-0x027f */
+  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x0280-0x02bf */
+  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x02c0-0x02ff */
+  0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, /* 0x0300-0x033f */
+  0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x00, 0x00, /* 0x0340-0x037f */
+  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x0380-0x03bf */
+  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x03c0-0x03ff */
+  /* 0x0400-0x05ff */
+  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x0400-0x043f */
+  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x0440-0x047f */
+  0x78, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x0480-0x04bf */
+  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x04c0-0x04ff */
+  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x0500-0x053f */
+  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x0540-0x057f */
+  0x00, 0x00, 0xfe, 0xff, 0xff, 0xff, 0xff, 0xbf, /* 0x0580-0x05bf */
+  0xb6, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x05c0-0x05ff */
+  /* 0x0600-0x07ff */
+  0x0f, 0x00, 0x3f, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x0600-0x063f */
+  0x00, 0xf8, 0xff, 0x7f, 0x00, 0x00, 0x01, 0x00, /* 0x0640-0x067f */
+  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x0680-0x06bf */
+  0x00, 0x00, 0xc0, 0xff, 0x9f, 0x3d, 0x00, 0x00, /* 0x06c0-0x06ff */
+  0x00, 0x80, 0x02, 0x00, 0x00, 0x00, 0xff, 0xff, /* 0x0700-0x073f */
+  0xff, 0x07, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x0740-0x077f */
+  0x00, 0x00, 0x00, 0x00, 0xc0, 0xff, 0x01, 0x00, /* 0x0780-0x07bf */
+  0x00, 0x00, 0x00, 0x00, 0x00, 0xf8, 0x0f, 0x00, /* 0x07c0-0x07ff */
+  /* 0x0800-0x09ff */
+  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x0800-0x083f */
+  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x0840-0x087f */
+  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x0880-0x08bf */
+  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x08c0-0x08ff */
+  0x06, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x10, /* 0x0900-0x093f */
+  0xfe, 0x21, 0x1e, 0x00, 0x0c, 0x00, 0x00, 0x00, /* 0x0940-0x097f */
+  0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x10, /* 0x0980-0x09bf */
+  0x1e, 0x20, 0x00, 0x00, 0x0c, 0x00, 0x00, 0x00, /* 0x09c0-0x09ff */
+  /* 0x0a00-0x0bff */
+  0x06, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x10, /* 0x0a00-0x0a3f */
+  0x86, 0x39, 0x00, 0x00, 0x00, 0x00, 0x03, 0x00, /* 0x0a40-0x0a7f */
+  0x06, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x10, /* 0x0a80-0x0abf */
+  0xbe, 0x21, 0x00, 0x00, 0x0c, 0x00, 0x00, 0x00, /* 0x0ac0-0x0aff */
+  0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x90, /* 0x0b00-0x0b3f */
+  0x0e, 0x20, 0x40, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x0b40-0x0b7f */
+  0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x0b80-0x0bbf */
+  0x01, 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x0bc0-0x0bff */
+  /* 0x0c00-0x0dff */
+  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xc0, /* 0x0c00-0x0c3f */
+  0xc1, 0x3d, 0x60, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x0c40-0x0c7f */
+  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x10, /* 0x0c80-0x0cbf */
+  0x00, 0x30, 0x00, 0x00, 0x0c, 0x00, 0x00, 0x00, /* 0x0cc0-0x0cff */
+  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x0d00-0x0d3f */
+  0x0e, 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x0d40-0x0d7f */
+  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x0d80-0x0dbf */
+  0x00, 0x04, 0x5c, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x0dc0-0x0dff */
+  /* 0x0e00-0x0fff */
+  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf2, 0x07, /* 0x0e00-0x0e3f */
+  0x80, 0x7f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x0e40-0x0e7f */
+  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf2, 0x1b, /* 0x0e80-0x0ebf */
+  0x00, 0x3f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x0ec0-0x0eff */
+  0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0xa0, 0x02, /* 0x0f00-0x0f3f */
+  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xfe, 0x7f, /* 0x0f40-0x0f7f */
+  0xdf, 0x00, 0xff, 0xfe, 0xff, 0xff, 0xff, 0x1f, /* 0x0f80-0x0fbf */
+  0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x0fc0-0x0fff */
+  /* 0x1000-0x11ff */
+  0x00, 0x00, 0x00, 0x00, 0x00, 0xe0, 0xc5, 0x02, /* 0x1000-0x103f */
+  0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x00, /* 0x1040-0x107f */
+  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x1080-0x10bf */
+  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x10c0-0x10ff */
+  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x1100-0x113f */
+  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x1140-0x117f */
+  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x1180-0x11bf */
+  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x11c0-0x11ff */
+  /* 0x1200-0x13ff */
+  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x1200-0x123f */
+  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x1240-0x127f */
+  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x1280-0x12bf */
+  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x12c0-0x12ff */
+  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x1300-0x133f */
+  0x00, 0x00, 0x00, 0x80, 0x00, 0x00, 0x00, 0x00, /* 0x1340-0x137f */
+  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x1380-0x13bf */
+  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x13c0-0x13ff */
+  /* 0x1600-0x17ff */
+  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x1600-0x163f */
+  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x1640-0x167f */
+  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x1680-0x16bf */
+  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x16c0-0x16ff */
+  0x00, 0x00, 0x1c, 0x00, 0x00, 0x00, 0x1c, 0x00, /* 0x1700-0x173f */
+  0x00, 0x00, 0x0c, 0x00, 0x00, 0x00, 0x0c, 0x00, /* 0x1740-0x177f */
+  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xb0, 0x3f, /* 0x1780-0x17bf */
+  0x40, 0xfe, 0x0f, 0x20, 0x00, 0x00, 0x00, 0x00, /* 0x17c0-0x17ff */
+  /* 0x1800-0x19ff */
+  0x00, 0x38, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x1800-0x183f */
+  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x1840-0x187f */
+  0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, /* 0x1880-0x18bf */
+  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x18c0-0x18ff */
+  0x00, 0x00, 0x00, 0x00, 0x87, 0x0f, 0x04, 0x0e, /* 0x1900-0x193f */
+  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x1940-0x197f */
+  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x1980-0x19bf */
+  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x19c0-0x19ff */
+  /* 0x1a00-0x1bff */
+  0x00, 0x00, 0x80, 0x01, 0x00, 0x00, 0x00, 0x00, /* 0x1a00-0x1a3f */
+  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x1a40-0x1a7f */
+  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x1a80-0x1abf */
+  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x1ac0-0x1aff */
+  0x0f, 0x00, 0x00, 0x00, 0x00, 0x00, 0xd0, 0x17, /* 0x1b00-0x1b3f */
+  0x04, 0x00, 0x00, 0x00, 0x00, 0xf8, 0x0f, 0x00, /* 0x1b40-0x1b7f */
+  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x1b80-0x1bbf */
+  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x1bc0-0x1bff */
+  /* 0x1c00-0x1dff */
+  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x1c00-0x1c3f */
+  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x1c40-0x1c7f */
+  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x1c80-0x1cbf */
+  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x1cc0-0x1cff */
+  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x1d00-0x1d3f */
+  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x1d40-0x1d7f */
+  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x1d80-0x1dbf */
+  0xff, 0x07, 0x00, 0x00, 0x00, 0x00, 0x00, 0xc0, /* 0x1dc0-0x1dff */
+  /* 0x2000-0x21ff */
+  0x00, 0xf8, 0x00, 0x00, 0x00, 0x7c, 0x00, 0x00, /* 0x2000-0x203f */
+  0x00, 0x00, 0x00, 0x00, 0x0f, 0xfc, 0x00, 0x00, /* 0x2040-0x207f */
+  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x2080-0x20bf */
+  0x00, 0x00, 0xff, 0xff, 0xff, 0xff, 0x00, 0x00, /* 0x20c0-0x20ff */
+  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x2100-0x213f */
+  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x2140-0x217f */
+  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x2180-0x21bf */
+  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x21c0-0x21ff */
+  /* 0x3000-0x31ff */
+  0x00, 0x00, 0x00, 0x00, 0x00, 0xfc, 0x00, 0x00, /* 0x3000-0x303f */
+  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x3040-0x307f */
+  0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, 0x00, /* 0x3080-0x30bf */
+  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x30c0-0x30ff */
+  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x3100-0x313f */
+  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x3140-0x317f */
+  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x3180-0x31bf */
+  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x31c0-0x31ff */
+  /* 0xa800-0xa9ff */
+  0x44, 0x08, 0x00, 0x00, 0x60, 0x00, 0x00, 0x00, /* 0xa800-0xa83f */
+  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0xa840-0xa87f */
+  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0xa880-0xa8bf */
+  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0xa8c0-0xa8ff */
+  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0xa900-0xa93f */
+  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0xa940-0xa97f */
+  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0xa980-0xa9bf */
+  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0xa9c0-0xa9ff */
+  /* 0xfa00-0xfbff */
+  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0xfa00-0xfa3f */
+  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0xfa40-0xfa7f */
+  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0xfa80-0xfabf */
+  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0xfac0-0xfaff */
+  0x00, 0x00, 0x00, 0x40, 0x00, 0x00, 0x00, 0x00, /* 0xfb00-0xfb3f */
+  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0xfb40-0xfb7f */
+  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0xfb80-0xfbbf */
+  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0xfbc0-0xfbff */
+  /* 0xfe00-0xffff */
+  0xff, 0xff, 0x00, 0x00, 0x0f, 0x00, 0x00, 0x00, /* 0xfe00-0xfe3f */
+  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0xfe40-0xfe7f */
+  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0xfe80-0xfebf */
+  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, /* 0xfec0-0xfeff */
+  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0xff00-0xff3f */
+  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0xff40-0xff7f */
+  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0xff80-0xffbf */
+  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0e, /* 0xffc0-0xffff */
+  /* 0x10a00-0x10bff */
+  0x6e, 0xf0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x87, /* 0x10a00-0x10a3f */
+  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x10a40-0x10a7f */
+  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x10a80-0x10abf */
+  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x10ac0-0x10aff */
+  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x10b00-0x10b3f */
+  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x10b40-0x10b7f */
+  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x10b80-0x10bbf */
+  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x10bc0-0x10bff */
+  /* 0x1d000-0x1d1ff */
+  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x1d000-0x1d03f */
+  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x1d040-0x1d07f */
+  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x1d080-0x1d0bf */
+  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x1d0c0-0x1d0ff */
+  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x1d100-0x1d13f */
+  0x00, 0x00, 0x00, 0x00, 0x80, 0x03, 0x00, 0xf8, /* 0x1d140-0x1d17f */
+  0xe7, 0x0f, 0x00, 0x00, 0x00, 0x3c, 0x00, 0x00, /* 0x1d180-0x1d1bf */
+  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x1d1c0-0x1d1ff */
+  /* 0x1d200-0x1d3ff */
+  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x1d200-0x1d23f */
+  0x1c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x1d240-0x1d27f */
+  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x1d280-0x1d2bf */
+  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x1d2c0-0x1d2ff */
+  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x1d300-0x1d33f */
+  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x1d340-0x1d37f */
+  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x1d380-0x1d3bf */
+  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00  /* 0x1d3c0-0x1d3ff */
+};
+static const signed char nonspacing_table_ind[240] = {
+   0,  1,  2,  3,  4,  5,  6,  7, /* 0x0000-0x0fff */
+   8,  9, -1, 10, 11, 12, 13, -1, /* 0x1000-0x1fff */
+  14, -1, -1, -1, -1, -1, -1, -1, /* 0x2000-0x2fff */
+  15, -1, -1, -1, -1, -1, -1, -1, /* 0x3000-0x3fff */
+  -1, -1, -1, -1, -1, -1, -1, -1, /* 0x4000-0x4fff */
+  -1, -1, -1, -1, -1, -1, -1, -1, /* 0x5000-0x5fff */
+  -1, -1, -1, -1, -1, -1, -1, -1, /* 0x6000-0x6fff */
+  -1, -1, -1, -1, -1, -1, -1, -1, /* 0x7000-0x7fff */
+  -1, -1, -1, -1, -1, -1, -1, -1, /* 0x8000-0x8fff */
+  -1, -1, -1, -1, -1, -1, -1, -1, /* 0x9000-0x9fff */
+  -1, -1, -1, -1, 16, -1, -1, -1, /* 0xa000-0xafff */
+  -1, -1, -1, -1, -1, -1, -1, -1, /* 0xb000-0xbfff */
+  -1, -1, -1, -1, -1, -1, -1, -1, /* 0xc000-0xcfff */
+  -1, -1, -1, -1, -1, -1, -1, -1, /* 0xd000-0xdfff */
+  -1, -1, -1, -1, -1, -1, -1, -1, /* 0xe000-0xefff */
+  -1, -1, -1, -1, -1, 17, -1, 18, /* 0xf000-0xffff */
+  -1, -1, -1, -1, -1, 19, -1, -1, /* 0x10000-0x10fff */
+  -1, -1, -1, -1, -1, -1, -1, -1, /* 0x11000-0x11fff */
+  -1, -1, -1, -1, -1, -1, -1, -1, /* 0x12000-0x12fff */
+  -1, -1, -1, -1, -1, -1, -1, -1, /* 0x13000-0x13fff */
+  -1, -1, -1, -1, -1, -1, -1, -1, /* 0x14000-0x14fff */
+  -1, -1, -1, -1, -1, -1, -1, -1, /* 0x15000-0x15fff */
+  -1, -1, -1, -1, -1, -1, -1, -1, /* 0x16000-0x16fff */
+  -1, -1, -1, -1, -1, -1, -1, -1, /* 0x17000-0x17fff */
+  -1, -1, -1, -1, -1, -1, -1, -1, /* 0x18000-0x18fff */
+  -1, -1, -1, -1, -1, -1, -1, -1, /* 0x19000-0x19fff */
+  -1, -1, -1, -1, -1, -1, -1, -1, /* 0x1a000-0x1afff */
+  -1, -1, -1, -1, -1, -1, -1, -1, /* 0x1b000-0x1bfff */
+  -1, -1, -1, -1, -1, -1, -1, -1, /* 0x1c000-0x1cfff */
+  20, 21, -1, -1, -1, -1, -1, -1  /* 0x1d000-0x1dfff */
+};
+
+/* Determine number of column positions required for UC.  */
+int
+uc_width (ucs4_t uc, const char *encoding)
+{
+  /* Test for non-spacing or control character.  */
+  if ((uc >> 9) < 240)
+    {
+      int ind = nonspacing_table_ind[uc >> 9];
+      if (ind >= 0)
+       if ((nonspacing_table_data[64*ind + ((uc >> 3) & 63)] >> (uc & 7)) & 1)
+         {
+           if (uc > 0 && uc < 0xa0)
+             return -1;
+           else
+             return 0;
+         }
+    }
+  else if ((uc >> 9) == (0xe0000 >> 9))
+    {
+      if (uc >= 0xe0100)
+       {
+         if (uc <= 0xe01ef)
+           return 0;
+       }
+      else
+       {
+         if (uc >= 0xe0020 ? uc <= 0xe007f : uc == 0xe0001)
+           return 0;
+       }
+    }
+  /* Test for double-width character.
+   * Generated from "grep '^....;[WF]' EastAsianWidth.txt"
+   * and            "grep '^....;[^WF]' EastAsianWidth.txt"
+   */
+  if (uc >= 0x1100
+      && ((uc < 0x1160) /* Hangul Jamo */
+         || (uc >= 0x2329 && uc < 0x232b) /* Angle Brackets */
+         || (uc >= 0x2e80 && uc < 0xa4d0  /* CJK ... Yi */
+             && !(uc == 0x303f) && !(uc >= 0x4dc0 && uc < 0x4e00))
+         || (uc >= 0xac00 && uc < 0xd7a4) /* Hangul Syllables */
+         || (uc >= 0xf900 && uc < 0xfb00) /* CJK Compatibility Ideographs */
+         || (uc >= 0xfe10 && uc < 0xfe20) /* Presentation Forms for Vertical */
+         || (uc >= 0xfe30 && uc < 0xfe70) /* CJK Compatibility Forms */
+         || (uc >= 0xff00 && uc < 0xff61) /* Fullwidth Forms */
+         || (uc >= 0xffe0 && uc < 0xffe7) /* Fullwidth Signs */
+         || (uc >= 0x20000 && uc <= 0x2a6d6) /* CJK */
+         || (uc >= 0x2f800 && uc <= 0x2fa1d) /* CJK Compatibility Ideographs */
+     )   )
+    return 2;
+  /* In ancient CJK encodings, Cyrillic and most other characters are
+     double-width as well.  */
+  if (uc >= 0x00A1 && uc < 0xFF61 && uc != 0x20A9
+      && is_cjk_encoding (encoding))
+    return 2;
+  return 1;
+}

Index: allocsa.c
===================================================================
RCS file: allocsa.c
diff -N allocsa.c
--- allocsa.c   22 Sep 2006 17:54:39 -0000      1.3
+++ /dev/null   1 Jan 1970 00:00:00 -0000
@@ -1,137 +0,0 @@
-/* Safe automatic memory allocation.
-   Copyright (C) 2003, 2006 Free Software Foundation, Inc.
-   Written by Bruno Haible <address@hidden>, 2003.
-
-   This program is free software; you can redistribute it and/or modify
-   it under the terms of the GNU General Public License as published by
-   the Free Software Foundation; either version 2, or (at your option)
-   any later version.
-
-   This program is distributed in the hope that it will be useful,
-   but WITHOUT ANY WARRANTY; without even the implied warranty of
-   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-   GNU General Public License for more details.
-
-   You should have received a copy of the GNU General Public License
-   along with this program; if not, write to the Free Software Foundation,
-   Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.  */
-
-#include <config.h>
-
-/* Specification.  */
-#include "allocsa.h"
-
-/* The speed critical point in this file is freesa() applied to an alloca()
-   result: it must be fast, to match the speed of alloca().  The speed of
-   mallocsa() and freesa() in the other case are not critical, because they
-   are only invoked for big memory sizes.  */
-
-#if HAVE_ALLOCA
-
-/* Store the mallocsa() results in a hash table.  This is needed to reliably
-   distinguish a mallocsa() result and an alloca() result.
-
-   Although it is possible that the same pointer is returned by alloca() and
-   by mallocsa() at different times in the same application, it does not lead
-   to a bug in freesa(), because:
-     - Before a pointer returned by alloca() can point into malloc()ed memory,
-       the function must return, and once this has happened the programmer must
-       not call freesa() on it anyway.
-     - Before a pointer returned by mallocsa() can point into the stack, it
-       must be freed.  The only function that can free it is freesa(), and
-       when freesa() frees it, it also removes it from the hash table.  */
-
-#define MAGIC_NUMBER 0x1415fb4a
-#define MAGIC_SIZE sizeof (int)
-/* This is how the header info would look like without any alignment
-   considerations.  */
-struct preliminary_header { void *next; char room[MAGIC_SIZE]; };
-/* But the header's size must be a multiple of sa_alignment_max.  */
-#define HEADER_SIZE \
-  (((sizeof (struct preliminary_header) + sa_alignment_max - 1) / 
sa_alignment_max) * sa_alignment_max)
-struct header { void *next; char room[HEADER_SIZE - sizeof (struct 
preliminary_header) + MAGIC_SIZE]; };
-/* Verify that HEADER_SIZE == sizeof (struct header).  */
-typedef int verify1[2 * (HEADER_SIZE == sizeof (struct header)) - 1];
-/* We make the hash table quite big, so that during lookups the probability
-   of empty hash buckets is quite high.  There is no need to make the hash
-   table resizable, because when the hash table gets filled so much that the
-   lookup becomes slow, it means that the application has memory leaks.  */
-#define HASH_TABLE_SIZE 257
-static void * mallocsa_results[HASH_TABLE_SIZE];
-
-#endif
-
-void *
-mallocsa (size_t n)
-{
-#if HAVE_ALLOCA
-  /* Allocate one more word, that serves as an indicator for malloc()ed
-     memory, so that freesa() of an alloca() result is fast.  */
-  size_t nplus = n + HEADER_SIZE;
-
-  if (nplus >= n)
-    {
-      char *p = (char *) malloc (nplus);
-
-      if (p != NULL)
-       {
-         size_t slot;
-
-         p += HEADER_SIZE;
-
-         /* Put a magic number into the indicator word.  */
-         ((int *) p)[-1] = MAGIC_NUMBER;
-
-         /* Enter p into the hash table.  */
-         slot = (unsigned long) p % HASH_TABLE_SIZE;
-         ((struct header *) (p - HEADER_SIZE))->next = mallocsa_results[slot];
-         mallocsa_results[slot] = p;
-
-         return p;
-       }
-    }
-  /* Out of memory.  */
-  return NULL;
-#else
-# if !MALLOC_0_IS_NONNULL
-  if (n == 0)
-    n = 1;
-# endif
-  return malloc (n);
-#endif
-}
-
-#if HAVE_ALLOCA
-void
-freesa (void *p)
-{
-  /* mallocsa() may have returned NULL.  */
-  if (p != NULL)
-    {
-      /* Attempt to quickly distinguish the mallocsa() result - which has
-        a magic indicator word - and the alloca() result - which has an
-        uninitialized indicator word.  It is for this test that sa_increment
-        additional bytes are allocated in the alloca() case.  */
-      if (((int *) p)[-1] == MAGIC_NUMBER)
-       {
-         /* Looks like a mallocsa() result.  To see whether it really is one,
-            perform a lookup in the hash table.  */
-         size_t slot = (unsigned long) p % HASH_TABLE_SIZE;
-         void **chain = &mallocsa_results[slot];
-         for (; *chain != NULL;)
-           {
-             if (*chain == p)
-               {
-                 /* Found it.  Remove it from the hash table and free it.  */
-                 char *p_begin = (char *) p - HEADER_SIZE;
-                 *chain = ((struct header *) p_begin)->next;
-                 free (p_begin);
-                 return;
-               }
-             chain = &((struct header *) ((char *) *chain - 
HEADER_SIZE))->next;
-           }
-       }
-      /* At this point, we know it was not a mallocsa() result.  */
-    }
-}
-#endif

Index: allocsa.h
===================================================================
RCS file: allocsa.h
diff -N allocsa.h
--- allocsa.h   16 Aug 2006 18:12:09 -0000      1.5
+++ /dev/null   1 Jan 1970 00:00:00 -0000
@@ -1,128 +0,0 @@
-/* Safe automatic memory allocation.
-   Copyright (C) 2003-2006 Free Software Foundation, Inc.
-   Written by Bruno Haible <address@hidden>, 2003.
-
-   This program is free software; you can redistribute it and/or modify
-   it under the terms of the GNU General Public License as published by
-   the Free Software Foundation; either version 2, or (at your option)
-   any later version.
-
-   This program is distributed in the hope that it will be useful,
-   but WITHOUT ANY WARRANTY; without even the implied warranty of
-   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-   GNU General Public License for more details.
-
-   You should have received a copy of the GNU General Public License
-   along with this program; if not, write to the Free Software Foundation,
-   Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.  */
-
-#ifndef _ALLOCSA_H
-#define _ALLOCSA_H
-
-#include <alloca.h>
-#include <stddef.h>
-#include <stdlib.h>
-
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-
-/* safe_alloca(N) is equivalent to alloca(N) when it is safe to call
-   alloca(N); otherwise it returns NULL.  It either returns N bytes of
-   memory allocated on the stack, that lasts until the function returns,
-   or NULL.
-   Use of safe_alloca should be avoided:
-     - inside arguments of function calls - undefined behaviour,
-     - in inline functions - the allocation may actually last until the
-       calling function returns.
-*/
-#if HAVE_ALLOCA
-/* The OS usually guarantees only one guard page at the bottom of the stack,
-   and a page size can be as small as 4096 bytes.  So we cannot safely
-   allocate anything larger than 4096 bytes.  Also care for the possibility
-   of a few compiler-allocated temporary stack slots.
-   This must be a macro, not an inline function.  */
-# define safe_alloca(N) ((N) < 4032 ? alloca (N) : NULL)
-#else
-# define safe_alloca(N) ((N), NULL)
-#endif
-
-/* allocsa(N) is a safe variant of alloca(N).  It allocates N bytes of
-   memory allocated on the stack, that must be freed using freesa() before
-   the function returns.  Upon failure, it returns NULL.  */
-#if HAVE_ALLOCA
-# define allocsa(N) \
-  ((N) < 4032 - sa_increment                                       \
-   ? (void *) ((char *) alloca ((N) + sa_increment) + sa_increment) \
-   : mallocsa (N))
-#else
-# define allocsa(N) \
-  mallocsa (N)
-#endif
-extern void * mallocsa (size_t n);
-
-/* Free a block of memory allocated through allocsa().  */
-#if HAVE_ALLOCA
-extern void freesa (void *p);
-#else
-# define freesa free
-#endif
-
-/* Maybe we should also define a variant
-    nallocsa (size_t n, size_t s) - behaves like allocsa (n * s)
-   If this would be useful in your application. please speak up.  */
-
-
-#ifdef __cplusplus
-}
-#endif
-
-
-/* ------------------- Auxiliary, non-public definitions ------------------- */
-
-/* Determine the alignment of a type at compile time.  */
-#if defined __GNUC__
-# define sa_alignof __alignof__
-#elif defined __cplusplus
-  template <class type> struct sa_alignof_helper { char __slot1; type __slot2; 
};
-# define sa_alignof(type) offsetof (sa_alignof_helper<type>, __slot2)
-#elif defined __hpux
-  /* Work around a HP-UX 10.20 cc bug with enums constants defined as offsetof
-     values.  */
-# define sa_alignof(type) (sizeof (type) <= 4 ? 4 : 8)
-#elif defined _AIX
-  /* Work around an AIX 3.2.5 xlc bug with enums constants defined as offsetof
-     values.  */
-# define sa_alignof(type) (sizeof (type) <= 4 ? 4 : 8)
-#else
-# define sa_alignof(type) offsetof (struct { char __slot1; type __slot2; }, 
__slot2)
-#endif
-
-enum
-{
-/* The desired alignment of memory allocations is the maximum alignment
-   among all elementary types.  */
-  sa_alignment_long = sa_alignof (long),
-  sa_alignment_double = sa_alignof (double),
-#ifdef HAVE_LONG_LONG
-  sa_alignment_longlong = sa_alignof (long long),
-#endif
-#ifdef HAVE_LONG_DOUBLE
-  sa_alignment_longdouble = sa_alignof (long double),
-#endif
-  sa_alignment_max = ((sa_alignment_long - 1) | (sa_alignment_double - 1)
-#ifdef HAVE_LONG_LONG
-                     | (sa_alignment_longlong - 1)
-#endif
-#ifdef HAVE_LONG_DOUBLE
-                     | (sa_alignment_longdouble - 1)
-#endif
-                    ) + 1,
-/* The increment that guarantees room for a magic word must be >= sizeof (int)
-   and a multiple of sa_alignment_max.  */
-  sa_increment = ((sizeof (int) + sa_alignment_max - 1) / sa_alignment_max) * 
sa_alignment_max
-};
-
-#endif /* _ALLOCSA_H */

Index: allocsa.valgrind
===================================================================
RCS file: allocsa.valgrind
diff -N allocsa.valgrind
--- allocsa.valgrind    4 Nov 2004 15:19:25 -0000       1.1
+++ /dev/null   1 Jan 1970 00:00:00 -0000
@@ -1,7 +0,0 @@
-# Suppress a valgrind message about use of uninitialized memory in freesa().
-# This use is OK because it provides only a speedup.
-{
-    freesa
-    Memcheck:Cond
-    fun:freesa
-}

Index: exit.h
===================================================================
RCS file: exit.h
diff -N exit.h
--- exit.h      6 Jul 2006 13:47:56 -0000       1.3
+++ /dev/null   1 Jan 1970 00:00:00 -0000
@@ -1,32 +0,0 @@
-/* exit() function.
-   Copyright (C) 1995, 2001 Free Software Foundation, Inc.
-
-   This program is free software; you can redistribute it and/or modify
-   it under the terms of the GNU General Public License as published by
-   the Free Software Foundation; either version 2, or (at your option)
-   any later version.
-
-   This program is distributed in the hope that it will be useful,
-   but WITHOUT ANY WARRANTY; without even the implied warranty of
-   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-   GNU General Public License for more details.
-
-   You should have received a copy of the GNU General Public License
-   along with this program; if not, write to the Free Software Foundation,
-   Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.  */
-
-#ifndef _EXIT_H
-#define _EXIT_H
-
-/* Get exit() declaration.  */
-#include <stdlib.h>
-
-/* Some systems do not define EXIT_*, despite otherwise supporting C89.  */
-#ifndef EXIT_SUCCESS
-# define EXIT_SUCCESS 0
-#endif
-#ifndef EXIT_FAILURE
-# define EXIT_FAILURE 1
-#endif
-
-#endif /* _EXIT_H */

Index: getcwd.h
===================================================================
RCS file: getcwd.h
diff -N getcwd.h
--- getcwd.h    4 Oct 2005 02:34:53 -0000       1.4
+++ /dev/null   1 Jan 1970 00:00:00 -0000
@@ -1,40 +0,0 @@
-/* Get the working directory, compatibly with the GNU C Library.
-
-   Copyright (C) 2004-2005 Free Software Foundation, Inc.
-
-   This program is free software; you can redistribute it and/or modify
-   it under the terms of the GNU General Public License as published by
-   the Free Software Foundation; either version 2, or (at your option)
-   any later version.
-
-   This program is distributed in the hope that it will be useful,
-   but WITHOUT ANY WARRANTY; without even the implied warranty of
-   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-   GNU General Public License for more details.
-
-   You should have received a copy of the GNU General Public License
-   along with this program; if not, write to the Free Software Foundation,
-   Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.  */
-
-/* Written by Paul Eggert.  */
-
-/* Include the headers that might declare getcwd so that they will not
-   cause confusion if included after this file.  */
-
-#include <stdlib.h>
-#include <unistd.h>
-
-/* If necessary, systematically rename identifiers so that they do not
-   collide with the system function.  Renaming avoids problems with
-   some compilers and linkers.  */
-
-#ifdef __GETCWD_PREFIX
-# undef getcwd
-# define __GETCWD_CONCAT(x, y) x ## y
-# define __GETCWD_XCONCAT(x, y) __GETCWD_CONCAT (x, y)
-# define __GETCWD_ID(y) __GETCWD_XCONCAT (__GETCWD_PREFIX, y)
-# define getcwd __GETCWD_ID (getcwd)
-/* See the POSIX:2001 specification
-   <http://www.opengroup.org/susv3xsh/getcwd.html>.  */
-char *getcwd (char *, size_t);
-#endif

Index: getlogin_r.h
===================================================================
RCS file: getlogin_r.h
diff -N getlogin_r.h
--- getlogin_r.h        20 Mar 2006 02:21:56 -0000      1.5
+++ /dev/null   1 Jan 1970 00:00:00 -0000
@@ -1,35 +0,0 @@
-/* getlogin_r declaration
-
-   Copyright (C) 2005 Free Software Foundation, Inc.
-
-   This program is free software; you can redistribute it and/or modify
-   it under the terms of the GNU General Public License as published by
-   the Free Software Foundation; either version 2, or (at your option)
-   any later version.
-
-   This program is distributed in the hope that it will be useful,
-   but WITHOUT ANY WARRANTY; without even the implied warranty of
-   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-   GNU General Public License for more details.
-
-   You should have received a copy of the GNU General Public License
-   along with this program; if not, write to the Free Software Foundation,
-   Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.  */
-
-/* Written by Paul Eggert and Derek Price.  */
-
-#include <stddef.h>
-#include <unistd.h>
-
-/* Copies the user's login name to NAME.
-   The array pointed to by NAME has room for SIZE bytes.
-
-   Returns 0 if successful.  Upon error, an error number is returned, or -1 in
-   the case that the login name cannot be found but no specific error is
-   provided (this case is hopefully rare but is left open by the POSIX spec).
-
-   See <http://www.opengroup.org/susv3xsh/getlogin.html>.
- */
-#if !HAVE_DECL_GETLOGIN_R
-int getlogin_r (char *name, size_t size);
-#endif

Index: lchown.h
===================================================================
RCS file: lchown.h
diff -N lchown.h
--- lchown.h    24 Aug 2006 01:24:14 -0000      1.1
+++ /dev/null   1 Jan 1970 00:00:00 -0000
@@ -1,9 +0,0 @@
-/* Some systems don't have EOPNOTSUPP.  */
-#ifndef EOPNOTSUPP
-# ifdef ENOTSUP
-#  define EOPNOTSUPP ENOTSUP
-# else
-/* Some systems don't have ENOTSUP either.  */
-#  define EOPNOTSUPP EINVAL
-# endif
-#endif

Index: mempcpy.h
===================================================================
RCS file: mempcpy.h
diff -N mempcpy.h
--- mempcpy.h   23 May 2005 17:44:31 -0000      1.2
+++ /dev/null   1 Jan 1970 00:00:00 -0000
@@ -1,36 +0,0 @@
-/* Copy memory area and return pointer after last written byte.
-   Copyright (C) 2003, 2004 Free Software Foundation, Inc.
-
-   This program is free software; you can redistribute it and/or modify
-   it under the terms of the GNU General Public License as published by
-   the Free Software Foundation; either version 2, or (at your option)
-   any later version.
-
-   This program is distributed in the hope that it will be useful,
-   but WITHOUT ANY WARRANTY; without even the implied warranty of
-   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-   GNU General Public License for more details.
-
-   You should have received a copy of the GNU General Public License
-   along with this program; if not, write to the Free Software Foundation,
-   Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.  */
-
-#ifndef mempcpy
-
-# if HAVE_MEMPCPY
-
-/* Get mempcpy() declaration.  */
-#  include <string.h>
-
-# else
-
-/* Get size_t */
-#  include <stddef.h>
-
-/* Copy N bytes of SRC to DEST, return pointer to bytes after the
-   last written byte.  */
-extern void *mempcpy (void *dest, const void *src, size_t n);
-
-# endif
-
-#endif

Index: memrchr.h
===================================================================
RCS file: memrchr.h
diff -N memrchr.h
--- memrchr.h   23 May 2005 17:44:31 -0000      1.2
+++ /dev/null   1 Jan 1970 00:00:00 -0000
@@ -1,27 +0,0 @@
-/* memrchr -- Find the last occurrence of a byte in a memory block.
-
-   Copyright (C) 2005 Free Software Foundation, Inc.
-
-   This program is free software; you can redistribute it and/or modify
-   it under the terms of the GNU General Public License as published by
-   the Free Software Foundation; either version 2, or (at your option)
-   any later version.
-
-   This program is distributed in the hope that it will be useful,
-   but WITHOUT ANY WARRANTY; without even the implied warranty of
-   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-   GNU General Public License for more details.
-
-   You should have received a copy of the GNU General Public License
-   along with this program; if not, write to the Free Software Foundation,
-   Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.  */
-
-#if HAVE_DECL_MEMRCHR
-# include <string.h>
-#else
-# include <stddef.h>
-
-/* Search backwards through a block for a byte (specified as an int).  */
-void *memrchr (void const *, int, size_t);
-
-#endif

Index: mkstemp.h
===================================================================
RCS file: mkstemp.h
diff -N mkstemp.h
--- mkstemp.h   22 Sep 2006 17:54:39 -0000      1.1
+++ /dev/null   1 Jan 1970 00:00:00 -0000
@@ -1,30 +0,0 @@
-/* Create a unique temporary file.
-
-   Copyright (C) 2006 Free Software Foundation, Inc.
-
-   This program is free software; you can redistribute it and/or modify
-   it under the terms of the GNU General Public License as published by
-   the Free Software Foundation; either version 2, or (at your option)
-   any later version.
-
-   This program is distributed in the hope that it will be useful,
-   but WITHOUT ANY WARRANTY; without even the implied warranty of
-   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-   GNU General Public License for more details.
-
-   You should have received a copy of the GNU General Public License
-   along with this program; if not, write to the Free Software Foundation,
-   Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.  */
-
-/* written by Jim Meyering */
-
-#include <stdlib.h>
-
-#ifdef __MKSTEMP_PREFIX
-# define _GL_CONCAT(x, y) x ## y
-# define _GL_XCONCAT(x, y) _GL_CONCAT (x, y)
-# define __MKSTEMP_ID(y) _GL_XCONCAT (__MKSTEMP_PREFIX, y)
-# undef mkstemp
-# define mkstemp __MKSTEMP_ID (mkstemp)
-int mkstemp (char *);
-#endif

Index: snprintf.h
===================================================================
RCS file: snprintf.h
diff -N snprintf.h
--- snprintf.h  6 Jul 2006 13:47:56 -0000       1.1
+++ /dev/null   1 Jan 1970 00:00:00 -0000
@@ -1,29 +0,0 @@
-/* Formatted output to strings.
-   Copyright (C) 2004 Free Software Foundation, Inc.
-   Written by Simon Josefsson.
-
-   This program is free software; you can redistribute it and/or modify
-   it under the terms of the GNU General Public License as published by
-   the Free Software Foundation; either version 2, or (at your option)
-   any later version.
-
-   This program is distributed in the hope that it will be useful,
-   but WITHOUT ANY WARRANTY; without even the implied warranty of
-   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-   GNU General Public License for more details.
-
-   You should have received a copy of the GNU General Public License along
-   with this program; if not, write to the Free Software Foundation,
-   Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.  */
-
-#ifndef SNPRINTF_H
-#define SNPRINTF_H
-
-/* Get snprintf declaration, if available.  */
-#include <stdio.h>
-
-#if defined HAVE_DECL_SNPRINTF && !HAVE_DECL_SNPRINTF
-int snprintf (char *str, size_t size, const char *format, ...);
-#endif
-
-#endif /* SNPRINTF_H */

Index: socket_.h
===================================================================
RCS file: socket_.h
diff -N socket_.h
--- socket_.h   22 Jun 2006 19:04:35 -0000      1.3
+++ /dev/null   1 Jan 1970 00:00:00 -0000
@@ -1,60 +0,0 @@
-/* Provide a sys/socket header file for systems lacking it (read: MinGW).
-   Copyright (C) 2005, 2006 Free Software Foundation, Inc.
-   Written by Simon Josefsson.
-
-   This program is free software; you can redistribute it and/or modify
-   it under the terms of the GNU General Public License as published by
-   the Free Software Foundation; either version 2, or (at your option)
-   any later version.
-
-   This program is distributed in the hope that it will be useful,
-   but WITHOUT ANY WARRANTY; without even the implied warranty of
-   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-   GNU General Public License for more details.
-
-   You should have received a copy of the GNU General Public License
-   along with this program; if not, write to the Free Software Foundation,
-   Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.  */
-
-#ifndef _SYS_SOCKET_H
-#define _SYS_SOCKET_H
-
-/* This file is supposed to be used on platforms that lack
-   sys/socket.h.  It is intended to provide definitions and prototypes
-   needed by an application.
-
-   Currently only MinGW is supported.  See the gnulib manual regarding
-   Windows sockets.  MinGW has the header files winsock2.h and
-   ws2tcpip.h that declare the sys/socket.h definitions we need.  Note
-   that you can influence which definitions you get by setting the
-   WINVER symbol before including these two files.  For example,
-   getaddrinfo is only available if _WIN32_WINNT >= 0x0501 (that
-   symbol is set indiriectly through WINVER).  You can set this by
-   adding AC_DEFINE(WINVER, 0x0501) to configure.ac.  Note that your
-   code may not run on older Windows releases then.  My Windows 2000
-   box was not able to run the code, for example.  The situation is
-   slightly confusing because:
-   
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/winsock/winsock/getaddrinfo_2.asp
-   suggests that getaddrinfo should be available on all Windows
-   releases. */
-
-
-#if HAVE_WINSOCK2_H
-# include <winsock2.h>
-#endif
-#if HAVE_WS2TCPIP_H
-# include <ws2tcpip.h>
-#endif
-
-/* For shutdown(). */
-#if !defined SHUT_RD && defined SD_RECEIVE
-# define SHUT_RD SD_RECEIVE
-#endif
-#if !defined SHUT_WR && defined SD_SEND
-# define SHUT_WR SD_SEND
-#endif
-#if !defined SHUT_RDWR && defined SD_BOTH
-# define SHUT_RDWR SD_BOTH
-#endif
-
-#endif /* _SYS_SOCKET_H */

Index: stat_.h
===================================================================
RCS file: stat_.h
diff -N stat_.h
--- stat_.h     21 Aug 2006 19:22:22 -0000      1.4
+++ /dev/null   1 Jan 1970 00:00:00 -0000
@@ -1,48 +0,0 @@
-/* Provide a complete sys/stat header file.
-   Copyright (C) 2006 Free Software Foundation, Inc.
-   Written by Eric Blake.
-
-   This program is free software; you can redistribute it and/or modify
-   it under the terms of the GNU General Public License as published by
-   the Free Software Foundation; either version 2, or (at your option)
-   any later version.
-
-   This program is distributed in the hope that it will be useful,
-   but WITHOUT ANY WARRANTY; without even the implied warranty of
-   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-   GNU General Public License for more details.
-
-   You should have received a copy of the GNU General Public License
-   along with this program; if not, write to the Free Software Foundation,
-   Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.  */
-
-#ifndef _gl_SYS_STAT_H
-#define _gl_SYS_STAT_H
-
-/* This file is supposed to be used on platforms where <sys/stat.h> is
-   incomplete.  It is intended to provide definitions and prototypes
-   needed by an application.  Start with what the system provides.  */
-#include @ABSOLUTE_SYS_STAT_H@
-
-/* mingw does not support symlinks, therefore it does not have lstat.  But
-   without links, stat does just fine.  */
-#if ! HAVE_LSTAT
-# define lstat stat
-#endif
-
-/* mingw's _mkdir() function has 1 argument, but we pass 2 arguments.
-   Additionally, it declares _mkdir (and depending on compile flags, an
-   alias mkdir), only in the nonstandard io.h.  */
-#if ! HAVE_DECL_MKDIR && HAVE_IO_H
-# include <io.h>
-
-static inline int
-rpl_mkdir (char const *name, mode_t mode)
-{
-  return _mkdir (name);
-}
-
-# define mkdir rpl_mkdir
-#endif
-
-#endif /* _gl_SYS_STAT_H */

Index: strcase.h
===================================================================
RCS file: strcase.h
diff -N strcase.h
--- strcase.h   4 Sep 2005 05:58:56 -0000       1.3
+++ /dev/null   1 Jan 1970 00:00:00 -0000
@@ -1,48 +0,0 @@
-/* Case-insensitive string comparison functions.
-   Copyright (C) 1995-1996, 2001, 2003, 2005 Free Software Foundation, Inc.
-
-   This program is free software; you can redistribute it and/or modify
-   it under the terms of the GNU General Public License as published by
-   the Free Software Foundation; either version 2, or (at your option)
-   any later version.
-
-   This program is distributed in the hope that it will be useful,
-   but WITHOUT ANY WARRANTY; without even the implied warranty of
-   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-   GNU General Public License for more details.
-
-   You should have received a copy of the GNU General Public License
-   along with this program; if not, write to the Free Software Foundation,
-   Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.  */
-
-#ifndef _STRCASE_H
-#define _STRCASE_H
-
-#include <stddef.h>
-
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-
-/* Compare strings S1 and S2, ignoring case, returning less than, equal to or
-   greater than zero if S1 is lexicographically less than, equal to or greater
-   than S2.
-   Note: This function may, in multibyte locales, return 0 for strings of
-   different lengths!  */
-extern int strcasecmp (const char *s1, const char *s2);
-
-/* Compare no more than N characters of strings S1 and S2, ignoring case,
-   returning less than, equal to or greater than zero if S1 is
-   lexicographically less than, equal to or greater than S2.
-   Note: This function can not work correctly in multibyte locales.  */
-extern int strncasecmp (const char *s1, const char *s2, size_t n);
-
-
-#ifdef __cplusplus
-}
-#endif
-
-
-#endif /* _STRCASE_H */

Index: strdup.h
===================================================================
RCS file: strdup.h
diff -N strdup.h
--- strdup.h    23 May 2005 17:44:32 -0000      1.2
+++ /dev/null   1 Jan 1970 00:00:00 -0000
@@ -1,29 +0,0 @@
-/* strdup.h -- duplicate a string
-   Copyright (C) 2004 Free Software Foundation, Inc.
-
-   This program is free software; you can redistribute it and/or modify
-   it under the terms of the GNU General Public License as published by
-   the Free Software Foundation; either version 2, or (at your option)
-   any later version.
-
-   This program is distributed in the hope that it will be useful,
-   but WITHOUT ANY WARRANTY; without even the implied warranty of
-   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-   GNU General Public License for more details.
-
-   You should have received a copy of the GNU General Public License
-   along with this program; if not, write to the Free Software Foundation,
-   Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.  */
-
-#ifndef STRDUP_H_
-#define STRDUP_H_
-
-/* Get strdup declaration, if available.  */
-#include <string.h>
-
-#if defined HAVE_DECL_STRDUP && !HAVE_DECL_STRDUP && !defined strdup
-/* Duplicate S, returning an identical malloc'd string.  */
-extern char *strdup (const char *s);
-#endif
-
-#endif /* STRDUP_H_ */

Index: strndup.h
===================================================================
RCS file: strndup.h
diff -N strndup.h
--- strndup.h   6 Jul 2006 02:17:59 -0000       1.1
+++ /dev/null   1 Jan 1970 00:00:00 -0000
@@ -1,30 +0,0 @@
-/* Duplicate a size-bounded string.
-   Copyright (C) 2003 Free Software Foundation, Inc.
-
-   This program is free software; you can redistribute it and/or modify
-   it under the terms of the GNU General Public License as published by
-   the Free Software Foundation; either version 2, or (at your option)
-   any later version.
-
-   This program is distributed in the hope that it will be useful,
-   but WITHOUT ANY WARRANTY; without even the implied warranty of
-   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-   GNU General Public License for more details.
-
-   You should have received a copy of the GNU General Public License
-   along with this program; if not, write to the Free Software Foundation,
-   Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.  */
-
-#if HAVE_STRNDUP
-
-/* Get strndup() declaration.  */
-#include <string.h>
-
-#else
-
-#include <stddef.h>
-
-/* Return a newly allocated copy of at most N bytes of STRING.  */
-extern char *strndup (const char *string, size_t n);
-
-#endif

Index: strnlen.h
===================================================================
RCS file: strnlen.h
diff -N strnlen.h
--- strnlen.h   6 Jul 2006 02:17:59 -0000       1.1
+++ /dev/null   1 Jan 1970 00:00:00 -0000
@@ -1,32 +0,0 @@
-/* Find the length of STRING, but scan at most MAXLEN characters.
-   Copyright (C) 2005 Free Software Foundation, Inc.
-   Written by Simon Josefsson.
-
-   This program is free software; you can redistribute it and/or modify
-   it under the terms of the GNU General Public License as published by
-   the Free Software Foundation; either version 2, or (at your option)
-   any later version.
-
-   This program is distributed in the hope that it will be useful,
-   but WITHOUT ANY WARRANTY; without even the implied warranty of
-   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-   GNU General Public License for more details.
-
-   You should have received a copy of the GNU General Public License
-   along with this program; if not, write to the Free Software Foundation,
-   Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.  */
-
-#ifndef STRNLEN_H
-#define STRNLEN_H
-
-/* Get strnlen declaration, if available.  */
-#include <string.h>
-
-#if defined HAVE_DECL_STRNLEN && !HAVE_DECL_STRNLEN
-/* Find the length (number of bytes) of STRING, but scan at most
-   MAXLEN bytes.  If no '\0' terminator is found in that many bytes,
-   return MAXLEN.  */
-extern size_t strnlen(const char *string, size_t maxlen);
-#endif
-
-#endif /* STRNLEN_H */

Index: strstr.c
===================================================================
RCS file: strstr.c
diff -N strstr.c
--- strstr.c    22 Sep 2006 17:54:40 -0000      1.6
+++ /dev/null   1 Jan 1970 00:00:00 -0000
@@ -1,126 +0,0 @@
-/* Searching in a string.
-   Copyright (C) 2005-2006 Free Software Foundation, Inc.
-   Written by Bruno Haible <address@hidden>, 2005.
-
-   This program is free software; you can redistribute it and/or modify
-   it under the terms of the GNU General Public License as published by
-   the Free Software Foundation; either version 2, or (at your option)
-   any later version.
-
-   This program is distributed in the hope that it will be useful,
-   but WITHOUT ANY WARRANTY; without even the implied warranty of
-   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-   GNU General Public License for more details.
-
-   You should have received a copy of the GNU General Public License
-   along with this program; if not, write to the Free Software Foundation,
-   Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.  */
-
-#include <config.h>
-
-/* Specification.  */
-#include "strstr.h"
-
-#include <stddef.h>  /* for NULL */
-
-#if HAVE_MBRTOWC
-# include "mbuiter.h"
-#endif
-
-/* Find the first occurrence of NEEDLE in HAYSTACK.  */
-char *
-strstr (const char *haystack, const char *needle)
-{
-  /* Be careful not to look at the entire extent of haystack or needle
-     until needed.  This is useful because of these two cases:
-       - haystack may be very long, and a match of needle found early,
-       - needle may be very long, and not even a short initial segment of
-         needle may be found in haystack.  */
-#if HAVE_MBRTOWC
-  if (MB_CUR_MAX > 1)
-    {
-      mbui_iterator_t iter_needle;
-
-      mbui_init (iter_needle, needle);
-      if (mbui_avail (iter_needle))
-       {
-         mbui_iterator_t iter_haystack;
-
-         mbui_init (iter_haystack, haystack);
-         for (;; mbui_advance (iter_haystack))
-           {
-             if (!mbui_avail (iter_haystack))
-               /* No match.  */
-               return NULL;
-
-             if (mb_equal (mbui_cur (iter_haystack), mbui_cur (iter_needle)))
-               /* The first character matches.  */
-               {
-                 mbui_iterator_t rhaystack;
-                 mbui_iterator_t rneedle;
-
-                 memcpy (&rhaystack, &iter_haystack, sizeof (mbui_iterator_t));
-                 mbui_advance (rhaystack);
-
-                 mbui_init (rneedle, needle);
-                 if (!mbui_avail (rneedle))
-                   abort ();
-                 mbui_advance (rneedle);
-
-                 for (;; mbui_advance (rhaystack), mbui_advance (rneedle))
-                   {
-                     if (!mbui_avail (rneedle))
-                       /* Found a match.  */
-                       return (char *) mbui_cur_ptr (iter_haystack);
-                     if (!mbui_avail (rhaystack))
-                       /* No match.  */
-                       return NULL;
-                     if (!mb_equal (mbui_cur (rhaystack), mbui_cur (rneedle)))
-                       /* Nothing in this round.  */
-                       break;
-                   }
-               }
-           }
-       }
-      else
-       return (char *) haystack;
-    }
-  else
-#endif
-    {
-      if (*needle != '\0')
-       {
-         /* Speed up the following searches of needle by caching its first
-            character.  */
-         char b = *needle++;
-
-         for (;; haystack++)
-           {
-             if (*haystack == '\0')
-               /* No match.  */
-               return NULL;
-             if (*haystack == b)
-               /* The first character matches.  */
-               {
-                 const char *rhaystack = haystack + 1;
-                 const char *rneedle = needle;
-
-                 for (;; rhaystack++, rneedle++)
-                   {
-                     if (*rneedle == '\0')
-                       /* Found a match.  */
-                       return (char *) haystack;
-                     if (*rhaystack == '\0')
-                       /* No match.  */
-                       return NULL;
-                     if (*rhaystack != *rneedle)
-                       /* Nothing in this round.  */
-                       break;
-                   }
-               }
-           }
-       }
-      else
-       return (char *) haystack;
-    }
-}

Index: strstr.h
===================================================================
RCS file: strstr.h
diff -N strstr.h
--- strstr.h    15 Sep 2005 16:56:16 -0000      1.4
+++ /dev/null   1 Jan 1970 00:00:00 -0000
@@ -1,37 +0,0 @@
-/* Searching in a string.
-   Copyright (C) 2001-2003, 2005 Free Software Foundation, Inc.
-
-   This program is free software; you can redistribute it and/or modify
-   it under the terms of the GNU General Public License as published by
-   the Free Software Foundation; either version 2, or (at your option)
-   any later version.
-
-   This program is distributed in the hope that it will be useful,
-   but WITHOUT ANY WARRANTY; without even the implied warranty of
-   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-   GNU General Public License for more details.
-
-   You should have received a copy of the GNU General Public License
-   along with this program; if not, write to the Free Software Foundation,
-   Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.  */
-
-
-/* Include string.h: on glibc systems, it contains a macro definition of
-   strstr() that would collide with our definition if included afterwards.  */
-#include <string.h>
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-/* No known system has a strstr() function that works correctly in
-   multibyte locales. Therefore we use our version always.  */
-#undef strstr
-#define strstr rpl_strstr
-
-/* Find the first occurrence of NEEDLE in HAYSTACK.  */
-extern char *strstr (const char *haystack, const char *needle);
-
-#ifdef __cplusplus
-}
-#endif

Index: time_r.h
===================================================================
RCS file: time_r.h
diff -N time_r.h
--- time_r.h    20 Mar 2006 02:21:56 -0000      1.4
+++ /dev/null   1 Jan 1970 00:00:00 -0000
@@ -1,52 +0,0 @@
-/* Reentrant time functions like localtime_r.
-
-   Copyright (C) 2003, 2005, 2006 Free Software Foundation, Inc.
-
-   This program is free software; you can redistribute it and/or modify
-   it under the terms of the GNU General Public License as published by
-   the Free Software Foundation; either version 2, or (at your option)
-   any later version.
-
-   This program is distributed in the hope that it will be useful,
-   but WITHOUT ANY WARRANTY; without even the implied warranty of
-   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-   GNU General Public License for more details.
-
-   You should have received a copy of the GNU General Public License along
-   with this program; if not, write to the Free Software Foundation,
-   Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.  */
-
-/* Written by Paul Eggert.  */
-
-#ifndef _TIME_R_H
-#define _TIME_R_H
-
-/* Include <time.h> first, since it may declare these functions with
-   signatures that disagree with POSIX, and we don't want to rename
-   those declarations.  */
-#include <time.h>
-
-#if !HAVE_TIME_R_POSIX
-
-/* Don't bother with asctime_r and ctime_r, since these functions are
-   not safe (like asctime and ctime, they can overrun their 26-byte
-   output buffers when given outlandish struct tm values), and we
-   don't want to encourage applications to use unsafe functions.  Use
-   strftime or even sprintf instead.  */
-
-# undef gmtime_r
-# undef localtime_r
-
-# define gmtime_r rpl_gmtime_r
-# define localtime_r rpl_localtime_r
-
-/* See the POSIX:2001 specification
-   <http://www.opengroup.org/susv3xsh/gmtime.html>.  */
-struct tm *gmtime_r (time_t const * restrict, struct tm * restrict);
-
-/* See the POSIX:2001 specification
-   <http://www.opengroup.org/susv3xsh/localtime.html>.  */
-struct tm *localtime_r (time_t const * restrict, struct tm * restrict);
-#endif
-
-#endif

Index: vasprintf.h
===================================================================
RCS file: vasprintf.h
diff -N vasprintf.h
--- vasprintf.h 16 Aug 2006 18:12:09 -0000      1.3
+++ /dev/null   1 Jan 1970 00:00:00 -0000
@@ -1,63 +0,0 @@
-/* vsprintf with automatic memory allocation.
-   Copyright (C) 2002-2003 Free Software Foundation, Inc.
-
-   This program is free software; you can redistribute it and/or modify
-   it under the terms of the GNU General Public License as published by
-   the Free Software Foundation; either version 2, or (at your option)
-   any later version.
-
-   This program is distributed in the hope that it will be useful,
-   but WITHOUT ANY WARRANTY; without even the implied warranty of
-   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-   GNU General Public License for more details.
-
-   You should have received a copy of the GNU General Public License
-   along with this program; if not, write to the Free Software Foundation,
-   Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.  */
-
-#ifndef _VASPRINTF_H
-#define _VASPRINTF_H
-
-#if HAVE_VASPRINTF
-
-/* Get asprintf(), vasprintf() declarations.  */
-#include <stdio.h>
-
-#else
-
-/* Get va_list.  */
-#include <stdarg.h>
-
-#ifndef __attribute__
-/* This feature is available in gcc versions 2.5 and later.  */
-# if __GNUC__ < 2 || (__GNUC__ == 2 && __GNUC_MINOR__ < 5) || __STRICT_ANSI__
-#  define __attribute__(Spec) /* empty */
-# endif
-/* The __-protected variants of `format' and `printf' attributes
-   are accepted by gcc versions 2.6.4 (effectively 2.7) and later.  */
-# if __GNUC__ < 2 || (__GNUC__ == 2 && __GNUC_MINOR__ < 7)
-#  define __format__ format
-#  define __printf__ printf
-# endif
-#endif
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-/* Write formatted output to a string dynamically allocated with malloc().
-   If the memory allocation succeeds, store the address of the string in
-   *RESULT and return the number of resulting bytes, excluding the trailing
-   NUL.  Upon memory allocation error, or some other error, return -1.  */
-extern int asprintf (char **result, const char *format, ...)
-       __attribute__ ((__format__ (__printf__, 2, 3)));
-extern int vasprintf (char **result, const char *format, va_list args)
-       __attribute__ ((__format__ (__printf__, 2, 0)));
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif
-
-#endif /* _VASPRINTF_H */

Index: wcwidth.h
===================================================================
RCS file: wcwidth.h
diff -N wcwidth.h
--- wcwidth.h   16 Aug 2006 18:12:09 -0000      1.2
+++ /dev/null   1 Jan 1970 00:00:00 -0000
@@ -1,77 +0,0 @@
-/* Determine the number of screen columns needed for a character.
-   Copyright (C) 2006 Free Software Foundation, Inc.
-
-   This program is free software; you can redistribute it and/or modify
-   it under the terms of the GNU General Public License as published by
-   the Free Software Foundation; either version 2, or (at your option)
-   any later version.
-
-   This program is distributed in the hope that it will be useful,
-   but WITHOUT ANY WARRANTY; without even the implied warranty of
-   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-   GNU General Public License for more details.
-
-   You should have received a copy of the GNU General Public License
-   along with this program; if not, write to the Free Software Foundation,
-   Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.  */
-
-#ifndef _gl_WCWIDTH_H
-#define _gl_WCWIDTH_H
-
-#if HAVE_WCHAR_T
-
-/* Get wcwidth if available, along with wchar_t.  */
-# if HAVE_WCHAR_H
-/* Tru64 with Desktop Toolkit C has a bug: <stdio.h> must be included before
-   <wchar.h>.
-   BSD/OS 4.1 has a bug: <stdio.h> and <time.h> must be included before
-   <wchar.h>.  */
-#  include <stdio.h>
-#  include <time.h>
-#  include <wchar.h>
-# endif
-
-/* Get iswprint.  */
-# if HAVE_WCTYPE_H
-#  include <wctype.h>
-# endif
-# if !defined iswprint && !HAVE_ISWPRINT
-static inline int
-iswprint (wint_t wc)
-{
-  return (wc >= 0 && wc < 128
-         ? wc >= ' ' && wc <= '~'
-         : 1);
-}
-#  define iswprint iswprint
-# endif
-
-# ifndef HAVE_DECL_WCWIDTH
-"this configure-time declaration test was not run"
-# endif
-# ifndef wcwidth
-#  if !HAVE_WCWIDTH
-
-/* wcwidth doesn't exist, so assume all printable characters have
-   width 1.  */
-static inline int
-wcwidth (wchar_t wc)
-{
-  return wc == 0 ? 0 : iswprint (wc) ? 1 : -1;
-}
-
-#  elif !HAVE_DECL_WCWIDTH
-
-/* wcwidth exists but is not declared.  */
-extern
-#   ifdef __cplusplus
-"C"
-#   endif
-int wcwidth (int /* actually wchar_t */);
-
-#  endif
-# endif
-
-#endif /* HAVE_WCHAR_H */
-
-#endif /* _gl_WCWIDTH_H */




reply via email to

[Prev in Thread] Current Thread [Next in Thread]