recognize new archive, audio, image formats; give audio files a separate color
[platform/upstream/coreutils.git] / lib / ChangeLog
1 2006-11-22  Paul Eggert  <eggert@cs.ucla.edu>
2
3         * randread.c (__attribute__): Don't define if __attribute__ is
4         already defined.  Otherwise, the code won't conform to C99, since
5         the macro arg is spelled differently by some include file, and the
6         compilation fails with pedantic GCC.
7
8 2006-11-22  Jim Meyering  <jim@meyering.net>
9
10         * .cvsignore, .gitignore: Add fstat.c.
11
12 2006-11-14  Jim Meyering  <jim@meyering.net>
13
14         * readlink-stub.c, lstat-stub.c: Remove now-unused files.
15
16 2006-10-14  Paul Eggert  <eggert@cs.ucla.edu>
17
18         Port sha512sum to hosts where uintmax_t is only 32 bits, e.g.,
19         HP/Tandom NonStop OSS circa 2005 has 32-bit uintmax_t, 64-bit intmax_t.
20         * u64.h: New file.
21         * sha512.c (SWAP, sha512_init_ctx, sha384_init_ctx, sha512_read_ctx):
22         (sha384_read_ctx, sha512_conclude_ctx, sha512_process_bytes):
23         (sha512_round_constants, F2, F1, sha512_process_block):
24         (S0, S1, SS0, SS1, M, R):
25         Rewrite to use u64.h instead of assuming uint64_t.
26         * sha512.h: Include u64.h rather than stdint.h.
27         (rol64): Remove; moved to u64.h and renamed to u64rol.
28
29 2006-10-12  Jim Meyering  <jim@meyering.net>
30
31         * Makefile.am (libcoreutils_a_LIBADD): Append $(LIBOBJS),
32         to accommodate the latest version of gnulib-tool.
33         (libcoreutils_a_DEPENDENCIES): Likewise.
34         From Bruno Haible.
35
36 2006-10-06  Jim Meyering  <jim@meyering.net>
37
38         Avoid a compiler warning: const'ify and remove a cast.
39         * randread.c (struct randread_source) [handler]: Make parameter "const".
40         [handler_arg]: Add "const" attribute.
41         (randread_error): Make parameter "const".
42         (simple_new, randread_set_handler, randread_set_handler_arg): Likewise.
43         (randread_new): Remove now-unnecessary cast.
44         * randread.h: Adjust prototypes.
45
46 2006-09-29  Paul Eggert  <eggert@cs.ucla.edu>
47
48         * .cvsignore: Add openat-proc.c.
49
50 2006-09-25  Paul Eggert  <eggert@cs.ucla.edu>
51
52         * .cvsignore: Add fchmodat.c.
53
54 2006-09-25  Jim Meyering  <jim@meyering.net>
55
56         * fchmodat.c: Remove file.  gnulib's copy is identical.
57
58 2006-09-01  Paul Eggert  <eggert@cs.ucla.edu>
59
60         * .cvsignore: Add fcntl.h, fcntl_.h, inttypes_.h, isapipe.c,
61         isapipe.h.
62
63 2006-08-25  Paul Eggert  <eggert@cs.ucla.edu>
64
65         * euidaccess-stat.c: Include <config.h> unconditionally, since
66         we now assume config.h exists.
67         * fchmodat.c: Likewise.
68         * fd-reopen.c: Likewise.
69         * fdopendir-glibc.c: Likewise.
70         * memxfrm.c: Likewise.
71         * printf-parse.c: Likewise.
72         * rand-isaac.c: Likewise.
73         * randint.c: Likewise.
74         * randperm.c: Likewise.
75         * randread.c: Likewise.
76         * root-dev-ino.c: Likewise.
77         * sha256.c: Likewise.
78         * sha512.c: Likewise.
79         * stdopen.c: Likewise.
80         * strintcmp.c: Likewise.
81         * strnumcmp.c: Likewise.
82         * t-chdir-long: Likewise.
83         * tsearch.c: Likewise.
84         * unicodeio.c: Likewise.
85         * vasnprintf.c: Likewise.
86         * xfts.c: Likewise.
87         * xmemxfrm.c: Likewise.
88
89         * .cvsignore: Add configmake.h, stamp-h1.
90
91 2006-08-23  Paul Eggert  <eggert@cs.ucla.edu>
92
93         * .cvsignore: Add config.h, config.hin.
94         * Makefile.am (AM_CPPFLAGS): Remove; we no longer need '-I..'.
95
96 2006-08-22  Paul Eggert  <eggert@cs.ucla.edu>
97
98         * .cvsignore: Add Makefile.in, getdate.tab.h.
99         Remove stat.c, sysexit.h.
100
101 2006-08-22  Jim Meyering  <jim@meyering.net>
102
103         * .cvsignore: Add files that are now generated by ../bootstrap.
104
105 2006-08-21  Eric Blake  <ebb9@byu.net>
106
107         * Makefile.am (LDADD): Restore this line; it is still needed for
108         t-fpending on platforms without __fpending.
109
110 2006-08-20  Paul Eggert  <eggert@cs.ucla.edu>
111
112         Add a bootstrap procedure, so that the CVS version contains fewer
113         files and we bootstrap the rest from gnulib, gettext, etc.
114         * Makefile.am: include gnulib.mk, so that we can remove most of
115         this file.
116         (AM_CPPFLAGS): Don't mention -I$(srcdir), since that's now done
117         for us.
118         (noinst_LIBRARIES, LDDADD, DEFS): Remove.
119         (libcoreutils_a_SOURCES): Trim down greatly, just to the files
120         that aren't in gnulib.
121         (libcoreutils_a_LIBADD, lib_OBJECTS, BUILT_SOURCES, CLEANFILES):
122         (MAINTAINERCLEANFILES, MOSTLYCLEANDIRS, MOSTLYCLEANFILES):
123         (SUFFIXES, EXTRA_DIST, all-local, charset_alias, charset_tmp):
124         (install-exec-local, uninstall-local, charset.alias, .sin.sed):
125         (stdbool.h, stdint.h, fnmatch.h, arpa/inet.h, netinet/in.h):
126         (sys/socket.h, getopt.h): Remove.
127
128         * Makefile.in, README, __fpending.c, __fpending.h, acl.c, acl.h:
129         * alloca.c, alloca_.h, allocsa.c, allocsa.h, argmatch.c, argmatch.h:
130         * asnprintf.c, asprintf.c, at-func.c, atexit.c, backupfile.c:
131         * backupfile.h, base64.c, base64.h, basename.c, bcopy.c, c-strtod.c:
132         * c-strtod.h, c-strtold.c, calloc.c, canon-host.c, canon-host.h:
133         * canonicalize.c, canonicalize.h, chdir-long.c, chdir-long.h:
134         * chdir-safer.c, chdir-safer.h, chown.c, cloexec.c, cloexec.h:
135         * close-stream.c, close-stream.h, closeout.c, closeout.h:
136         * config.charset, creat-safer.c, cycle-check.c, cycle-check.h:
137         * dev-ino.h, diacrit.c, diacrit.h, dirchownmod.c, dirchownmod.h:
138         * dirfd.c, dirfd.h, dirname.c, dirname.h, dup-safer.c, dup2.c:
139         * error.c, error.h, euidaccess.c, euidaccess.h, exclude.c:
140         * exclude.h, exit.h, exitfail.c, exitfail.h, fchown-stub.c:
141         * fcntl--.h, fcntl-safer.h, fd-safer.c, file-type.c, file-type.h:
142         * fileblocks.c, filemode.c, filemode.h, filenamecat.c:
143         * filenamecat.h, fnmatch.c, fnmatch_.h, fnmatch_loop.c:
144         * fopen-safer.c, fprintftime.c, fprintftime.h, free.c, fsusage.c:
145         * fsusage.h, ftruncate.c, fts-cycle.c, fts.c, fts_.h, full-read.c:
146         * full-read.h, full-write.c, full-write.h, gai_strerror.c:
147         * getaddrinfo.c, getaddrinfo.h, getcwd.c, getcwd.h, getdate.h:
148         * getdate.y, getdelim.c, getdelim.h, getgroups.c, gethostname.c:
149         * gethrxtime.c, gethrxtime.h, getline.c, getline.h, getloadavg.c:
150         * getndelim2.c, getndelim2.h, getopt.c, getopt1.c, getopt_.h:
151         * getopt_int.h, getpagesize.h, getpass.c, getpass.h, gettext.h:
152         * gettime.c, gettimeofday.c, getugroups.c, getusershell.c:
153         * group-member.c, group-member.h, hard-locale.c, hard-locale.h:
154         * hash-pjw.c, hash-pjw.h, hash.c, hash.h, human.c, human.h:
155         * idcache.c, imaxtostr.c, inet_ntop.c, inet_ntop.h, intprops.h:
156         * inttostr.c, inttostr.h, lchmod.h, lchown.c, lchown.h:
157         * linebuffer.c, linebuffer.h, localcharset.c, localcharset.h:
158         * long-options.c, long-options.h, lstat.c, lstat.h, malloc.c:
159         * mbchar.c, mbchar.h, mbswidth.c, mbswidth.h, mbuiter.h, md5.c:
160         * md5.h, memcasecmp.c, memcasecmp.h, memchr.c, memcmp.c, memcoll.c:
161         * memcoll.h, memcpy.c, memmove.c, mempcpy.c, mempcpy.h, memrchr.c:
162         * memrchr.h, memset.c, mkancesdirs.c, mkancesdirs.h, mkdir-p.c:
163         * mkdir-p.h, mkdir.c, mkdirat.c, mkstemp-safer.c, mkstemp.c:
164         * mktime.c, modechange.c, modechange.h, mountlist.c, mountlist.h:
165         * nanosleep.c, obstack.c, obstack.h, offtostr.c, open-safer.c:
166         * openat-die.c, openat-priv.h, openat.c, openat.h, pathmax.h:
167         * physmem.c, physmem.h, pipe-safer.c, posixtm.c, posixtm.h:
168         * posixver.c, posixver.h, printf-args.c, printf-args.h:
169         * printf-parse.h, putenv.c, quote.c, quote.h, quotearg.c:
170         * quotearg.h, raise.c, readlink.c, readtokens.c, readtokens.h:
171         * readtokens0.c, readtokens0.h, readutmp.c, readutmp.h, realloc.c:
172         * ref-add.sin, ref-del.sin, regcomp.c, regex.c, regex.h:
173         * regex_internal.c, regex_internal.h, regexec.c, rename.c, rmdir.c:
174         * rpmatch.c, safe-read.c, safe-read.h, safe-write.c, safe-write.h:
175         * same-inode.h, same.c, same.h, save-cwd.c, save-cwd.h, savedir.c:
176         * savedir.h, setenv.c, setenv.h, settime.c, sha1.c, sha1.h:
177         * sig2str.c, sig2str.h, snprintf.c, snprintf.h, socket_.h:
178         * stat-macros.h, stat-time.h, stdbool_.h, stdint_.h, stdio--.h:
179         * stdio-safer.h, stdlib--.h, stdlib-safer.h, stpcpy.c, strcase.h:
180         * strcasecmp.c, strcspn.c, strdup.c, strdup.h, strftime.c:
181         * strftime.h, stripslash.c, strncasecmp.c, strndup.c, strndup.h:
182         * strnlen.c, strnlen.h, strnlen1.c, strnlen1.h, strpbrk.c, strstr.c:
183         * strstr.h, strtod.c, strtoimax.c, strtol.c, strtoll.c, strtoul.c:
184         * strtoull.c, strtoumax.c, strverscmp.c, strverscmp.h, tempname.c:
185         * time_r.c, time_r.h, timespec.h, umaxtostr.c, unicodeio.h:
186         * unistd--.h, unistd-safer.h, unlinkdir.c, unlinkdir.h:
187         * unlocked-io.h, unsetenv.c, userspec.c, userspec.h, utime.c:
188         * utimecmp.c, utimecmp.h, utimens.c, utimens.h, vasnprintf.h:
189         * vasprintf.c, vasprintf.h, verify.h, version-etc-fsf.c:
190         * version-etc.c, version-etc.h, wcwidth.h, xalloc-die.c, xalloc.h:
191         * xgetcwd.c, xgetcwd.h, xgethostname.c, xgethostname.h, xmalloc.c:
192         * xmemcoll.c, xmemcoll.h, xnanosleep.c, xnanosleep.h, xreadlink.c:
193         * xreadlink.h, xstrndup.c, xstrndup.h, xstrtod.c, xstrtod.h:
194         * xstrtoimax.c, xstrtol.c, xstrtol.h, xstrtold.c, xstrtoul.c:
195         * xstrtoumax.c, xtime.h, yesno.c, yesno.h:
196         Remove from CVS, since ../bootstrap generates them automatically.
197
198 2006-08-18  Bruno Haible  <bruno@clisp.org>
199
200         * mountlist.c [MOUNTED_GETMNTINFO2]: Include sys/statvfs.h.
201         (ME_DUMMY): Treat "kernfs" as a dummy.
202         (read_file_system_list) [MOUNTED_GETMNTINFO2]: Implement.
203
204 2006-08-17  Paul Eggert  <eggert@cs.ucla.edu>
205
206         * ChangeLog: Add copyright notice.
207         * .gdb-history: Likewise.
208         * TODO: Likewise.
209         * __fpending.h: Likewise.
210         * fdopendir-glibc.c: Likewise.
211         * fprintftime.h: Likewise.
212         * root-dev-ino.h: Likewise.
213         * search_.h: Likewise.
214         * t-chdir-long: Likewise.
215         * t-fpending.c: Likewise.
216         * savedir.c: Use (C) in copyright notice.
217         * savedir.h: Likewise.
218
219 2006-08-16  Paul Eggert  <eggert@cs.ucla.edu>
220
221         * memcoll.c (memcoll): Set errno = 0 in the shortcut case, too.
222         Problem and fix reported by Pádraig Brady in
223         <http://lists.gnu.org/archive/html/bug-coreutils/2006-08/msg00099.html>.
224
225 2006-08-16  Jim Meyering  <jim@meyering.net>
226
227         * fts.c (fts_children): Remove obsolete "// FIXME ..." comment.
228         Reported by Bruno Haible.
229
230 2006-08-15  Jim Meyering  <jim@meyering.net>
231
232         * at-func.c: New file, with the logic of all emulated at-functions.
233         * openat-priv.h: Include <errno.h> and define ENOSYS,
234         in support of the EXPECTED_ERRNO macro.
235         * openat.c (fstatat, unlinkat, fchownat): Remove function definitions.
236         Instead, define the appropriate symbols and include "at-func.c".
237         * mkdirat.c (mkdirat): Likewise.
238         * fchmodat.c (fchmodat): Likewise.
239         (ENOSYS): Remove definition.
240         * openat.c: Don't include <errno.h>, now that "openat-priv.h" does it.
241         Don't include "unistd--.h" -- it wasn't ever used.
242
243 2006-08-14  Paul Eggert  <eggert@cs.ucla.edu>
244
245         * memcoll.c (memcoll): Optimize for the common case where the
246         arguments are bytewise equal.
247
248 2006-08-11  Paul Eggert  <eggert@cs.ucla.edu>
249
250         * pipe-safer.c (pipe_safer): Fix misspelling: HAVE_FUNC_PIPE ->
251         HAVE_PIPE.  Fix a file descriptor leak when fd_safer fails.
252
253         * regex_internal.c (re_string_skip_chars): Don't assume WEOF fits
254         in wchar_t.  Problem reported by Eric Blake.
255
256         * snprintf.c (snprintf): memcpy LEN bytes, not SIZE - 1, when
257         LEN is smaller than SIZE.  Suggested by Bruno Haible.
258         Also, help the compiler to keep LEN in a register.
259
260 2006-08-10  Paul Eggert  <eggert@cs.ucla.edu>
261
262         Import the following changes from libc:
263
264         2006-06-02  Jakub Jelinek  <jakub@redhat.com>
265
266         * posix/regex_internal.c (re_string_skip_chars): If no character has
267         been converted at all, set *last_wc to WEOF.  If mbrtowc failed, set wc
268         to the byte which couldn't be converted.
269         (re_string_reconstruct): Don't clear valid_raw_len before calling
270         re_string_skip_chars.  If wc is WEOF after re_string_skip_chars, set
271         tip_context using re_string_context_at.
272
273         2006-05-02  Ulrich Drepper  <drepper@redhat.com>
274
275         * posix/regex.h: g++ still cannot handled [restrict].
276
277         2006-04-21  Ulrich Drepper  <drepper@redhat.com>
278
279         * posix/regex.h: Remove special handling for VMS.
280
281         Accommodate new getaddrinfo implementation in gnulib.
282         * inet_ntop.c, inet_ntop.h, snprintf.c, snprintf.h, socket_.h:
283         New files, from gnulib.
284         * .cppi-disable: Add snprintf.h, socket_.h.
285         * Makefile.am (libcoreutils_a_SOURCES): Add inet_ntop.h, snprintf.h.
286         (MOSTLYCLEANDIRS): New macro.
287         (BUILT_SOURCES): Add $(ARPA_INET_H), $(SYS_SOCKET_H), $(NETINET_IN_H).
288         (arpa/inet.h, netinet/in.h, sys/socket.h): New rules.
289         (MOSTLYCLEANFILES): Add arpa/inet.h, arpa/inet.h-t, netinet/in.h,
290         netinet/in.h-t, sys/socket.h, sys/socket.h-t.
291         (EXTRA_DIST): Add socket_.h.
292
293 2006-08-09  Paul Eggert  <eggert@cs.ucla.edu>
294
295         * allocsa.h, config.charset, error.c, error.h, exitfail.c, full-write.c:
296         * getaddrinfo.c, getaddrinfo.h, gettext.h, localcharset.c, mbchar.h:
297         * mbswidth.c, mkstemp-safer.c, pipe-safer.c, printf-args.c, quote.c:
298         * readlink.c, regex_internal.h, setenv.c, stdint_.h, stdio--.h:
299         * stdio-safer.h, stpcpy.c, strcspn.c, strtoimax.c, vasnprintf.h:
300         * version-etc.c, wcwidth.h:
301         Update from gnulib.
302
303 2006-08-09  Jim Meyering  <jim@meyering.net>
304
305         * rand-isaac.c: Include <config.h>.
306
307 2006-08-08  Paul Eggert  <eggert@cs.ucla.edu>
308
309         * Makefile.am (libcoreutils_a_SOURCES): Add xmemxfrm.c, xmemxfrm.h.
310         * memxfrm.c, memxfrm.h, randint.c, randint.h, randperm.c, randperm.h:
311         * randread.c, randread.h, xmemxfrm.c, xmemxfrm.h: New files.
312         * rand-isaac.h: New file.
313         * rand-isaac.c: New file, mostly taken from ../src/rand-isaac.c.
314
315 2006-07-28  Paul Eggert  <eggert@cs.ucla.edu>
316
317         * modechange.c (mode_compile): Numeric modes now affect setuid and
318         setgid on directories only if they set these bits.
319         * modechange.h: Remove obsolete comment about masks.
320
321 2006-07-22  Paul Eggert  <eggert@cs.ucla.edu>
322
323         * close-stream.c, close-stream.h: New files.
324         * closeout.c (close_stdout): Use new function close_stream.
325
326 2006-07-19  Mike Frysinger  <vapier@gentoo.org>
327
328         * mountlist.c [ME_REMOTE]: Filter out cifs.
329         Reported by Toralf Förster in <http://bugs.gentoo.org/141012>.
330
331 2006-07-20  Jim Meyering  <jim@meyering.net>
332
333         * mountlist.c (ME_REMOTE): Compare strchr's result to NULL, not 0,
334         for better readability.
335
336 2006-07-16  Paul Eggert  <eggert@cs.ucla.edu>
337
338         * dirchownmod.c, dirchownmod.h, mkancesdirs.c, mkancesdirs.h:
339         New files.
340         * mkdir-p.c: Don't include alloca.h, stdio.h, sys/types.h,
341         unistd.h, string.h, chdir-safer.h, dirname.h, lchmod.h, lchown.h,
342         save-cwd.h.  Instead, include dirchownmod.h and mkancesdirs.h.
343         (make_dir_parents): New args MAKE_ANCESTOR, OPTIONS, ANNOUNCE,
344         MODE_BITS.  Remove options VERBOSE_FMT_STRING, CWD_ERRNO.  All
345         callers changed.  Revamp internals significantly, by not
346         attempting to create directories that are temporarily more
347         permissive than the final results.  Do not attempt to use
348         save_cwd/restore_cwd; it isn't worth it for mkdir and install.
349         This removes some race conditions, fixes some bugs, and simplifies
350         things.  Use new dirchownmod function to do owner and mode changes.
351         * mkdir-p.h: Likewise.
352         * modechange.c (octal_to_mode): New function.
353         (struct mode_change): New member mentioned.
354         (make_node_op_equals): New arg mentioned.  All callers changed.
355         (mode_compile): Keep track of which mode bits the user has explicitly
356         mentioned.
357         (mode_adjust): New arg DIR, so that we implement the X op correctly.
358         New arg PMODE_BITS, to keep track of which mode bits the user
359         mentioned; it treats S_ISUID and S_ISGID speciall.
360         All callers changed.
361         * modechange.h: Likewise.
362
363 2006-07-16  Jim Meyering  <jim@meyering.net>
364
365         * userspec.c (parse_with_separator): Say "invalid spec" rather than
366         the sometimes erroneous "cannot get the login group of a numeric UID"
367         for a spec like "not-a-username:" or "1:".  Reported by
368         suckfish@ihug.co.nz in https://bugzilla.redhat.com/bugzilla/199027.
369
370 2006-07-10  Derek R. Price  <derek@ximbiot.com>
371
372         * backupfile.c, dirfd.h, fts.c, getcwd.c:
373         Ignore the obsolescent !HAVE_DIRENT_H case.  Consolidate NAMLEN
374         macros into the GNU _D_EXACT_NAMLEN.
375         * savedir.c:  Likewise.
376         (savedirstream): Use _D_EXACT_NAMLEN in preference to strlen.
377
378 2006-07-08  Paul Eggert  <eggert@cs.ucla.edu>
379
380         * Makefile.am (stdint.h): FULL_PATH_STDINT_H -> ABSOLUTE_STDINT_H,
381         to accommodate update from gnulib.
382
383         Update from gnulib, as follows:
384
385         2006-07-06  Jim Hyslop  <jhyslop@dreampossible.ca>  (tiny change)
386
387         * getaddrinfo.c: Changes to compile under MSVC6: changed
388         '#if WIN32_NATIVE' to '#ifdef' & moved WSAAPI macro inside
389         brackets.  Other minor changes to suppress some compiler
390         warnings.
391
392         2006-07-06  Paul Eggert  <eggert@cs.ucla.edu>
393
394         * getloadavg.c: Use __VMS, not VMS.
395         * getopt.c: Likewise.
396         * getpagesize.h: Likewise.
397
398         2006-07-06  Derek R. Price  <derek@ximbiot.com>
399         and Paul Eggert  <eggert@cs.ucla.edu>
400
401         * backupfile.c [HAVE_DIRENT_H && ! HAVE_NDIR_H]:
402         Don't worry about this obsolete case any more.
403         (HAVE_DIR): Remove.  All uses removed; we now assume you can read
404         directories.
405         * dirfd.h [HAVE_DIRENT_H && ! HAVE_NDIR_H]: Don't
406         worry about this obsolete case any more.
407         * fts.c: Likewise.
408         * getcwd.c: Likewise.
409         * savedir.c: Likewise.
410
411         2006-07-06  Paul Eggert  <eggert@cs.ucla.edu>
412
413         * fnmatch.c (ISBLANK): Remove.  All uses changed to isblank.
414         (isblank) [! (defined isblank || HAVE_DECL_ISBLANK)]: New macro.
415         (ISGRAPH): Remove.  All uses changed to isgraph.
416         (FOLD) [!defined _LIBC]: Remove special case.
417         * getdate.y (lookup_word): Remove no-longer-needed call to islower.
418         * regext_internal.h (isblank): Depend on HAVE_DECL_ISBLANK, not
419         HAVE_ISBLANK.
420         * strftime.c (TOLOWER, TOUPPER) [!defined _LIBC]: Remove special case.
421
422         2006-07-06  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
423
424         * strtod.c (strtod): cast the argument of tolower to unsigned char.
425
426         2006-07-05  Paul Eggert  <eggert@cs.ucla.edu>
427
428         * memcasecmp.c: Include <limits.h>.
429         (memcasecmp): Don't assume UCHAR_MAX <= INT_MAX.
430         * strtod.c (strtod): Don't assume isspace works on negative chars.
431         Don't assume isdigit succeeds only on '0' through '9'.
432
433         2006-07-05  Derek R. Price  <derek@ximbiot.com>
434
435         * exclude.c (IN_CTYPE_DOMAIN, is_space): Remove; no longer needed.
436         All uses of is_space replaced by isspace.
437         * exit.h: Don't talk about STDC_HEADERS.
438         * fnmatch.c (ISASCII): Remove; no longer needed.  All uses removed.
439         (ISPRINT, ISDIGIT, ISALNUM, ISALPHA, ISCNTRL, ISLOWER, ISPUNCT):
440         (ISSPACE, ISUPPER, ISXDIGIT): Remove; no longer needed.  All uses
441         replaced by isprint etc.
442         * getdate.y (IN_CTYPE_DOMAIN, ISSPACE, ISALPHA, ISLOWER): Likewise.
443         * getusershell.c (IN_CTYPE_DOMAIN, ISSPACE): Likewise.
444         * memcasecmp.c (IN_CTYPE_DOMAIN, ISLOWER, TOUPPER): Likewise.
445         * strtod.c (IN_CTYPE_DOMAIN, ISSPACE, ISDIGIT, TOLOWER): Likewise.
446         * strtol.c (IN_CTYPE_DOMAIN): Likewise.
447         * xstrtol.c (IN_CTYPE_DOMAIN, ISSPACE): Likewise.
448
449         2006-07-05  Eric Blake  <ebb9@byu.net>
450
451         * getaddrinfo.h (NI_NUMERICHOST, NI_NUMERICSERV): Define if
452         missing from netdb.h.
453         * getaddrinfo.c (includes): Include inet_ntop and snprintf.
454
455         2006-06-27  Bruno Haible  <bruno@clisp.org>
456
457         Assume ANSI C header files and <ctype.h> functions.
458         * mbswidth.c (IN_CTYPE_DOMAIN, ISPRINT, ISCNTRL): Remove macros.
459         (mbsnwidth): Use isprint, iscntrl instead.
460
461 2006-07-08  Jim Meyering  <jim@meyering.net>
462
463         * getndelim2.h (getndelim2): Remove doubled "after" in comment.
464
465 2006-07-03  Paul Eggert  <eggert@cs.ucla.edu>
466
467         * Makefile.am (libcoreutils_a_SOURCES): Add setenv.h, wcwidth.h,
468         to accommodate sync from gnulib.
469
470         Sync from gnulib.
471
472         2006-06-30  Jim Hyslop <jhyslop@dreampossible.ca>  (tiny change)
473
474         * getaddrinfo.c: fixed typo
475
476         2006-06-28  Bruno Haible  <bruno@clisp.org>
477
478         * getaddrinfo.h: Fix POSIX URL.
479         * getaddrinfo.c (WIN32_NATIVE): New macro. Use it instead of _WIN32.
480         (use_win32_p): Make static.
481         (getaddrinfo): Reject service name if it is empty or does not consist
482         solely of decimal digits, or if its value is > 65535.
483         (getnameinfo): Remove useless casts.
484
485         2006-06-28  Eric Blake  <ebb9@byu.net>
486
487         * mbchar.h (wcwidth): Include wcwidth.h.
488         * mbswidth.c (wcwidth): Move from here...
489         * wcwidth.h: ...to this new file.
490
491         2006-06-28  Simon Josefsson  <jas@extundo.com>
492
493         * getaddrinfo.c: Try to load ws2_32.dll on Windows, to find the
494         functions there.  It will succeed on Windows XP, but on Windows
495         2000 and (presumably) earlier, it will fail, and use the internal
496         re-implementation.
497         (use_win32_p): New function.
498         (getaddrinfo): Use strtoul on servname, to support numeric ports.
499         Support AI_NUMERICSERV to disable getservbyname.
500         (getnameinfo): New function, only supports
501         NI_NUMERICHOST|NI_NUMERICSERV for now.
502
503         * getaddrinfo.h: Test and check for AI_* flags separately, MinGW
504         only have some of them.  Add AI_NUMERICSERV.  Add prototype for
505         getnameinfo.
506
507         2006-06-26  Paul Eggert  <eggert@cs.ucla.edu>
508
509         * base64.c (B64): Use _ as the formal parameter, not x, to avoid
510         bug in IBM C V6 for AIX.  Problem reported by Larry Jones in
511         <http://lists.gnu.org/archive/html/bug-gnulib/2006-06/msg00181.html>.
512
513         2006-06-21  Simon Josefsson  <jas@extundo.com>
514
515         * getaddrinfo.c (getaddrinfo): Set ai_family in the return
516         variable.
517
518         2006-06-19  Paul Eggert  <eggert@cs.ucla.edu>
519
520         * alloca_.h (alloca) [defined alloca]: Don't define or declare.
521
522         2006-06-16  Eric Blake  <ebb9@byu.net>
523
524         * unsetenv.c [!defined errno]: Assume errno.h declares errno.
525         * unicodeio.c [!defined errno]: Likewise.
526         * strtol.c [!defined errno]: Likewise.
527         * strtod.c [!defined errno]: Likewise.
528
529         2006-05-26  Martin Lambers  <marlam@marlam.de>
530
531         * getpass.c: Updates the test for the native W32 API, and adds
532         missing includes, thus fixing compilation warnings.
533
534         2006-05-25  Sergey Poznyakoff  <gray@gnu.org.ua>
535
536         * exclude.c (exclude_fnmatch): New function.
537         (excluded_file_name): Call exclude_fnmatch.
538         * exclude.h (excluded_file_name): New prototype
539
540         2006-05-19  Jim Meyering  <jim@meyering.net>
541
542         * getugroups.c: Correct an outdated comment.  From Bruno Haible.
543
544         2006-05-10  Paul Eggert  <eggert@cs.ucla.edu>
545
546         * sha1.c (rol): Cast right-shift arg to uint32_t to prevent
547         unwanted sign propagation, e.g., on hosts with 64-bit int.
548         There still are some problems with reeelly weird theoretical hosts
549         (e.g., 33-bit int) but it's not worth worrying about now.
550         (K1, K2, K3, K4): Remove unnecessary L suffix.
551
552         2006-03-24  Simon Josefsson  <jas@extundo.com>
553
554         * base64.c: Fix problems reported by Eric Blake <ebb9@byu.net>,
555         including some doc fixes.
556         (base64_encode_alloc): Fix +1 bug on allocation failures.
557
558         2006-03-24  Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
559
560         * base64.c (base64_encode): Do not read past end of array with
561         unsanitized input on systems with CHAR_BIT > 8.
562
563         2006-03-24  Eric Blake  <ebb9@byu.net>
564
565         * time_r.c (copy_string_result): Remove, as it is no longer used.
566
567 2006-07-03  Paul Eggert  <eggert@cs.ucla.edu>
568
569         * stdint_.h: Include <sys/types.h> after @FULL_PATH_STDINT_H@, for
570         MacOS X 10.4.6.  Don't mention <sys/int_types.h>.  Problems
571         reported by Mark D. Baushke, one in
572         <http://lists.gnu.org/archive/html/bug-gnulib/2006-07/msg00015.html>.
573
574 2006-07-03  Jim Meyering  <jim@meyering.net>
575
576         * cycle-check.h (CYCLE_CHECK_REFLECT_CHDIR_UP): Abort if this
577         macro is used before the first cycle_check call.
578
579 2006-07-02  Paul Eggert  <eggert@cs.ucla.edu>
580
581         * stdint_.h (intmax_t, uintmax_t): Prefer long to long long if
582         both are 64 bits, since this seems to be the tradition, and this
583         prevents gcc -Wformat from warning about usages with PRIuMAX.  If
584         we ever run into a host that prefers long long to long in this
585         case, we'll need another configure-time test.  Problem reported by
586         Jim Meyering.
587
588 2006-07-02  Paul Eggert  <eggert@cs.ucla.edu>
589
590         * Makefile.am (stdint.h): Sync from gnulib.
591         * stdint_.h: Sync from gnulib.
592
593 2006-06-30  Paul Eggert  <eggert@cs.ucla.edu>
594
595         * xstrtod.c (XSTRTOD, DOUBLE): New macros, so that we can support
596         both double and long double versions.
597         (XSTRTOD): Renamed from xstrtod.  Use DOUBLE internally.
598         * xstrtold.c: New file.
599         * xstrtod.h (xstrtold): New decl.
600
601 2006-06-29  Derek R. Price  <derek@ximbiot.com>
602
603         * strftime.c: Assume strftime exists.
604
605 2006-06-28  Derek R. Price  <derek@ximbiot.com>
606
607         * savedir.c (CLOSEDIR): Remove.  All uses changed to closedir.
608         Autoconf 2.60 says this stuff was obsolete.
609
610 2006-06-20  Paul Eggert  <eggert@cs.ucla.edu>
611
612         * openat.c (openat): Use ?:, not if, to work around GCC bug 4210
613         <http://gcc.gnu.org/bugzilla/show_bug.cgi?id=4210>.
614         Problem reported by Denis Excoffier in
615         <http://lists.gnu.org/archive/html/bug-tar/2006-06/msg00023.html>.
616
617 2006-06-19  Jim Meyering  <jim@meyering.net>
618
619         Apply this change from gnulib:
620         2006-06-16  Eric Blake  <ebb9@byu.net>
621         * unsetenv.c [!defined errno]: Assume errno.h declares errno.
622
623 2006-06-11  Paul Eggert  <eggert@cs.ucla.edu>
624
625         * getdate.y (__attribute__): Don't define if already defined.
626         Problem reported by Larry Jones.
627         * utimens.c (__attribute__): Likewise.
628
629 2006-06-10  Jim Meyering  <jim@meyering.net>
630
631         Apply this change from gnulib:
632
633         2006-05-30  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
634                     Bruno Haible  <bruno@clisp.org>
635
636         * strndup.c (strndup) [!_LIBC]: Don't undefine macro definition.
637
638 2006-06-04  Paul Eggert  <eggert@cs.ucla.edu>
639
640         * regexec.c (group_nodes_into_DFAstates): Fix a buffer overrun
641         reported by Andreas Schwab.
642
643 2006-05-25  Paul Eggert  <eggert@cs.ucla.edu>
644
645         * tempname.c (small_open, large_open): New macros.
646         (__open, __open64) [!_LIBC]: Remove.
647         (__gen_tempname): Use small_open and large_open instead of __open
648         and __open64.  This fixes a portability bug on HP-UX 11.11i
649         reported by Simon Wing-Tang in
650         <http://lists.gnu.org/archive/html/bug-coreutils/2006-05/msg00114.html>.
651
652 2006-05-23  Paul Eggert  <eggert@cs.ucla.edu>
653
654         * filemode.c: Don't include <string.h>; this include was
655         inadvertently put into the previous patch.  Problem noted
656         by Jim Meyering.
657
658 2006-05-22  Paul Eggert  <eggert@cs.ucla.edu>
659
660         * filemode.c (setst): Remove.
661         (strmode): Rewrite to avoid setst.  This makes the code shorter,
662         (arguably) clearer, and the generated code is a bit smaller on my
663         Debian GNU/Linux stable x86 host.
664
665         Import from gnulib.
666         * verify.h: Document the internals better.  Most of this change
667         was written by Bruno Haible.
668
669 2006-05-21  Jim Meyering  <jim@meyering.net>
670
671         * fts.c (fts_open): Fail with EINVAL if a caller violates this rule:
672         Either FTS_LOGICAL or FTS_PHYSICAL must be provided to the
673         fts_open() function.
674
675 2006-05-19  Paul Eggert  <eggert@cs.ucla.edu>
676
677         * nanosleep.c [HAVE_SYS_SELECT_H]: Include <sys/select.h>.
678         Use the usual Autoconf way to include <time.h> and/or sys/time.h.
679         (my_usleep): Don't mishandle maximum value.
680
681 2006-05-15  Jim Meyering  <jim@meyering.net>
682
683         Avoid the expense of an fstat, when possible.
684         * fts.c (O_NOFOLLOW, STREQ): Define.
685         (diropen_fd): Remove function.  Merge it into sole caller...
686         (diropen): ...here.  Use O_NOFOLLOW when appropriate.
687         (fts_safe_changedir): Call fstat for dev/inode check, only if the
688         previous open/openat call may have opened the wrong directory.
689
690 2006-05-13  Jim Meyering  <jim@meyering.net>
691
692         * xfts.c (xfts_open): Always use FTS_CWDFD.
693
694         Restore the parts of fts that were removed on 2006-01-17, so that
695         it's easier for legacy applications designed for the version
696         of fts in glibc or BSD to convert to this more robust version.
697         Add a new mode, FTS_CWDFD, by which to enable the improved
698         (openat- based -- aka no-chdir) semantics.
699         * fts_.h (FTS_CWDFD): Define.  Callers must use this fts_open
700         option to enable the more robust behavior.
701         (FTS_OPTIONMASK): Widen accordingly.
702         * fts.c: Restore removed code, reverting the default behavior.
703
704 2006-05-11  Jim Meyering  <jim@meyering.net>
705
706         * sha1.c (sha1_buffer): Correct comment: s/MD5/SHA1/.  From James Lemley.
707
708 2006-04-25  Paul Eggert  <eggert@cs.ucla.edu>
709
710         * getdate.y (get_date): When adding relative date, start with the
711         initial time, not with the result of the first mktime call.
712
713 2006-04-17  Paul Eggert  <eggert@cs.ucla.edu>
714
715         * filemode.c: Include "filemode.h" first, to test the interface.
716         Assume that filemode.h includes sys/types.h and sys/stat.h.
717         (HAVE_ST_DM_MODE): New macro, moved here from ls.c.
718         (ftypelet): Reorder to put common cases first, for efficiency.
719         Add 'P', 'w'.  Remove 'M', since it's now the caller's responsibility
720         to do 'M'.
721         (strmode): Renamed from mode_string, and now stores 12 bytes instead
722         of 10, for compatibility with FreeBSD.  All callers changed.
723         (filemodestring): Now stores 12 bytes instead of 10, and sets file types
724         that can't be deduced solely from st_mode.  First arg is now a const
725         pointer.
726         * filemode.h (HAVE_DECL_STRMODE): Include <string.h> for strmode.
727         (strmode): Renamed from mode_string.
728         (filemodestring): New decl.
729         * stat-macros.h: Don't undef S_ISDOOR, since it's never buggy.
730         (S_ISDOOR): Don't bother with S_IFDOOR, since that code is never needed.
731         (S_ISPORT, S_ISWHT): New macros, if not already defined.
732
733         * openat.h (openat_needs_fchdir) [ ! defined __OPENAT_PREFIX]:
734         Turn this into a macro that always returns false.
735
736 2006-04-15  Paul Eggert  <eggert@cs.ucla.edu>
737
738         * utimens.c (futimens): glibc futimesat messes up if /proc
739         isn't mounted.  Problem reported by Kir Kolyshkin.
740
741 2006-04-14  Jim Meyering  <jim@meyering.net>
742
743         Remove unreachable code and plug leaks in code that handles degenerate
744         input and some failure cases.
745         * fts.c (fts_build): #if-0-out a block of unused code. Patch from glibc.
746         (fts_build): Remove just-#if-0'd code and the code that
747         declares and sets cderrno.
748         (fts_build): Free `head' before returning NULL, in two places,
749         to avoid leaks.  Patch from glibc.
750         (fts_open): Don't allocate parent if *argv==NULL.  Patch from glibc.
751
752 2006-04-13  Paul Eggert  <eggert@cs.ucla.edu>
753
754         * regcomp.c (init_dfa): Don't use wchar_t or wctype_t if RE_ENABLE_I18N
755         is not defined.  Problem reported by Mark D. Baushke via Derek R. Price.
756         * regex.h (RE_DUP_MAX): Update comment to match current implementation.
757
758 2006-04-12  Paul Eggert  <eggert@cs.ucla.edu>
759
760         * fsusage.c: Don't include <inttypes.h> or <stdint.h>, since
761         fsusage.h now does that.  Include fsusage.h first, to test interface.
762         Prefer statvfs if it works, since it's blessed by POSIX.  Attempt
763         at most one method (the old code could have generated decls that
764         didn't conform to C89, not that this was ever exercised).
765         * fsusage.h: Include <inttypes.h> and <stdint.h> if they exist.
766
767 2006-04-09  Paul Eggert  <eggert@cs.ucla.edu>
768
769         Merge regex changes from libc, removing some of our
770         POSIX-conformance changes that were rejected and redoing them in a
771         less-intrusive way.
772
773         * regcomp.c (re_compile_internal, init_dfa):
774         Length arg is now size_t, not Idx.  All uses changed.
775         (peek_token): Forward decl now says internal_function.
776         (__re_error_msgid, __re_error_msgid_idx):
777         Now static rather than extern with attribute_hidden.
778         (re_compile_pattern) [!defined _LIBC]: Use K&R-style defn.
779         For some reason libc prefers K&R style defns for external functions.
780         (regerror) [!defined _LIBC]: Likewise.
781         (re_set_syntax, re_compile_fastmap, regcomp, regfree, re_comp):
782         (seek_collating_symbol_entry, lookup_collation_sequence_value):
783         (build_range_exp, build_collating_symbol):
784         Use K&R-style defn.
785         (re_compile_fastmap): Use '\0' to memset, not 0.
786         (utf8_sb_map): Make the calculations more obvious.
787         (init_dfa, parse_bracket_exp, build_charclass_op):
788         Call calloc and cast result, as glibc does.
789         (init_word_char, fetch_token, peek_token, peek_token_bracket):
790         (build_range_exp, build_collating_symbol):
791         Now internal functions.
792
793         * regex.c [!defined _LIBC]: Allow compiling with C++ compilers.
794
795         * regex.h (__USE_GNU_REGEX): New macro.  Don't depend on
796         _REGEX_SOURCE any more; depend on _GNU_SOURCE instead.
797         Don't depend on VMS; depend on __VMS instead, for POSIX
798         namespace cleanness.
799         (regoff_t): Define to ssize_t, not long int.
800
801         Remove the REG_ macros named below.  Instead, make the old names
802         (e.g., RE_BACKSLASH_ESCAPE_IN_LISTS) visible only if
803         __USE_GNU_REGEX.
804         (REG_BACKSLASH_ESCAPE_IN_LISTS):
805         (REG_BK_PLUS_QM, REG_CHAR_CLASSES, REG_CONTEXT_INDEP_ANCHORS):
806         (REG_CONTEXT_INDEP_OPS, REG_CONTEXT_INVALID_OPS):
807         (REG_DOT_NEWLINE, REG_DOT_NOT_NULL, REG_HAT_LISTS_NOT_NEWLINE):
808         (REG_INTERVALS, REG_LIMITED_OPS, REG_NEWLINE_ALT):
809         (REG_NO_BK_BRACES, REG_NO_BK_PARENS, REG_NO_BK_REFS):
810         (REG_NO_BK_VBAR, REG_NO_EMPTY_RANGES):
811         (REG_UNMATCHED_RIGHT_PAREN_ORD, REG_NO_POSIX_BACKTRACKING):
812         (REG_NO_GNU_OPS, REG_DEBUG, REG_INVALID_INTERVAL_ORD):
813         (REG_IGNORE_CASE, REG_CARET_ANCHORS_HERE):
814         (REG_CONTEXT_INVALID_DUP, REG_NO_SUB, REG_SYNTAX_EMACS):
815         (REG_SYNTAX_AWK, REG_SYNTAX_GNU_AWK, REG_SYNTAX_POSIX_AWK):
816         (REG_SYNTAX_GREP, REG_SYNTAX_EGREP, REG_SYNTAX_POSIX_EGREP):
817         (REG_SYNTAX_ED, REG_SYNTAX_SED, _REG_SYNTAX_POSIX_COMMON):
818         (REG_SYNTAX_POSIX_BASIC, REG_SYNTAX_POSIX_MINIMAL_BASIC):
819         (REG_SYNTAX_POSIX_EXTENDED, REG_SYNTAX_POSIX_MINIMAL_EXTENDED):
820         (REG_DUP_MAX, REG_UNALLOCATED, REG_REALLOCATE, REG_FIXED):
821         (REG_NREGS):
822         Remove.  All uses replaced by the old RE_* names.
823         (RE_BACKSLASH_ESCAPE_IN_LISTS):
824         (RE_BK_PLUS_QM, RE_CHAR_CLASSES, RE_CONTEXT_INDEP_ANCHORS):
825         (RE_CONTEXT_INDEP_OPS, RE_CONTEXT_INVALID_OPS):
826         (RE_DOT_NEWLINE, RE_DOT_NOT_NULL, RE_HAT_LISTS_NOT_NEWLINE):
827         (RE_INTERVALS, RE_LIMITED_OPS, RE_NEWLINE_ALT):
828         (RE_NO_BK_BRACES, RE_NO_BK_PARENS, RE_NO_BK_REFS):
829         (RE_NO_BK_VBAR, RE_NO_EMPTY_RANGES):
830         (RE_UNMATCHED_RIGHT_PAREN_ORD, RE_NO_POSIX_BACKTRACKING):
831         (RE_NO_GNU_OPS, RE_DEBUG, RE_INVALID_INTERVAL_ORD):
832         (RE_IGNORE_CASE, RE_CARET_ANCHORS_HERE):
833         (RE_CONTEXT_INVALID_DUP, RE_NO_SUB):
834         Don't bother having these macros be independent of each others'
835         values, since they no longer exist in the POSIX name space.
836
837         Rename the following member names back to their old names,
838         unless !__USE_GNU_REGEX.  All uses changed back.
839         (buffer): Renamed from re_buffer.
840         (allocated): Renamed from re_allocated.
841         (used): Renamed from re_used.
842         (syntax): Renamed from re_syntax.
843         (fastmap): Renamed from re_fastmap.
844         (translate): Renamed from re_translate.
845         (can_be_null): Renamed from re_can_be_null.
846         (regs_allocated): Renamed from re_regs_allocated.
847         (fastmap_accurate): Renamed from re_fastmap_accurate.
848         (no_sub): Renamed from re_no_sub.
849         (not_bol): Renamed from re_not_bol.
850         (not_eol): Renamed from re_not_eol.
851         (newline_anchor): Renamed from re_newline_anchor.
852         (num_regs): Renamed from rm_num_regs.
853         (start): Renamed from rm_start.
854         (end): Renamed from rm_end.
855
856         (free_state): Move up a bit.
857
858         * regex_internal.h (inline) [__GNUC__ < 3 && defined _LIBC]:
859         #define to be empty.
860         (ASCII_CHARS): New macro, replacing all uses of 0x80 and/or SBC_MAX / 2
861         when that is what is intended.
862         (SBC_MAX): Define to UCHAR_MAX + 1, not 256.
863         (__re_error_msgid, __re_error_msgid_idx): Remove decls; not needed.
864         (MAX): New macro.
865         (re_xmalloc, re_calloc, re_xrealloc, re_x2realloc): Remove.
866         All uses changed back to re_malloc, etc.  It's now the caller's
867         responsibility to check for overflow; all callers changed.
868         (re_alloc_oversized, re_x2alloc_oversized, re_xnmalloc, re_xnrealloc):
869         (re_x2nrealloc): Remove.
870         (free_state): Remove decl.
871
872         * regexc.c (regexec, re_match, re_search, re_match_2, re_search_2):
873         (re_set_registers, re_exec):
874         Use K&R-style defn.
875
876         2006-01-31  Roland McGrath  <roland@redhat.com>
877
878         * regcomp.c (calc_eclosure_iter): Remove dead variables.
879         Reported by Mike Frysinger <vapier@gentoo.org>.
880
881         2006-01-15  Andreas Jaeger  <aj@suse.de>
882
883         [BZ #1950]
884         * regex_internal.c (re_string_reconstruct): Adjust for
885         build_wcs_upper_buffer change.
886         (build_wcs_upper_buffer): Change return type.
887
888         2005-12-10  Ulrich Drepper  <drepper@redhat.com>
889
890         * regex_internal.h: Include <stdint.h> if available.
891
892         2005-12-06  Paolo Bonzini  <bonzini@gnu.org>
893
894         * regex_internal.h (SIZE_MAX): Provide a default definition.
895
896         2005-10-14  Ulrich Drepper  <drepper@redhat.com>
897
898         * regcomp.c: Adjust for changed secondary hash function.
899
900         2005-09-30  Ulrich Drepper  <drepper@redhat.com>
901
902         * regex.h: Pretty printing.
903         Clean up namespace a bit.
904
905         2005-09-30  Jakub Jelinek  <jakub@redhat.com>
906
907         * regexec.c (update_cur_sifted_state, check_arrival,
908         check_arrival_add_next_nodes): Avoid using uninitialized variable.
909
910         2005-09-06  Paul Eggert  <eggert@cs.ucla.edu>
911                     Ulrich Drepper  <drepper@redhat.com>
912
913         [BZ #1302]
914         * regex_internal.h (bitset_t): Renamed from bitset.  All uses changed.
915         (bitset_word_t): Renamed from bitset_word.  All uses changed.
916
917         2005-09-22  Ulrich Drepper  <drepper@redhat.com>
918
919         [BZ #281]
920         * regex.h: Define RE_TRANSLATE_TYPE as unsigned char *.
921         * regcomp.c: Remove unnecessary uses of
922         unsigned RE_TRANSLATE_TYPE.
923         * regex_internal.h: Likewise.
924         * regex_internal.c: Likewise.
925         * regexec.c: Likewise.
926         Based on a patch by Stepan Kasal <kasal@ucw.cz>.
927
928         2005-09-07  Ulrich Drepper  <drepper@redhat.com>
929
930         * regexec.c (find_recover_state): Remove unnecessary
931         initialization.
932         (transit_state_bkref): Make DFA a const pointer.
933         (get_subexp): Likewise.
934         (check_arrival): Likewise.
935         (update_cur_sifted_state): Likewise.
936         (re_search_internal): Likewise.
937         (prune_impossible_nodes): Likewise.
938         (acquire_init_state_context): Likewise.
939         (proceed_next_node): Likewise.
940         (set_regs): Likewise.
941         (free_fail_stack_return): Likewise.
942         (check_arrival_expand_ecl): Mark DFA parameter as const.
943         (check_arrival_expand_ecl_sub): Likewise.
944         (check_subexp_limits): Likewise.
945         (sub_epsilon_src_nodes):  Likewise.
946         (add_epsilon_src_nodes):  Likewise.
947         (merge_state_array): Likewise.
948         (update_regs): Likewise.
949         (build_trtable): Likewise.
950         (sift_states_backward): Mark MCTX parameter as const.
951         (build_sifted_states): Likewise.
952         (update_cur_sifted_state): Likewise.
953         (sift_states_mkref): Likewise.
954         (check_arrival_expand_ecl): Mark eclosure as const.
955         (check_dst_limits_calc_pos_1): Likewise.
956         * regex_internal.h (re_match_context_t): Make dfa a const
957         pointer.
958
959         2005-09-06  Ulrich Drepper  <drepper@redhat.com>
960
961         * regexec.c (merge_state_with_log): Define dfa as const pointer.
962         (transit_state_sb): Likewise.
963         (transit_state_mb): Likewise.
964         (sift_states_iter_mb): Likewise.
965         (check_arrival_add_next_nodes): Likewise.
966         (check_node_accept_bytes): Change first parameter to pointer-to-const.
967         [_LIBC] (re_search_2_stub): Use mempcpy.
968
969         * regex_internal.c (re_string_reconstruct): Avoid calling
970         mbrtowc for very simple UTF-8 case.
971
972         * regex_internal.c (re_acquire_state): Make DFA pointer arg
973         a pointer-to-const.
974         (re_acquire_state_context): Likewise.
975         * regex_internal.h: Adjust prototypes.
976
977         * regex.c: Prevent using C++ compilers.
978
979         * regex_internal.c (re_acquire_state): Minor code rearrangement.
980         (re_acquire_state_context): Likewise.
981
982 2006-03-11  Eric Blake  <ebb9@byu.net>
983
984         * same.c (same_name): s/base_name/last_component/
985         * backupfile.c (check_extension, numbered_backup): Likewise.
986         * filenamecat.c (file_name_concat): Likewise.
987
988 2006-03-11  Eric Blake  <ebb9@byu.net>,
989             Paul Eggert  <eggert@cs.ucla.edu>
990
991         * dirname.h (FILE_SYSTEM_PREFIX_LEN): Move here from dos.m4.
992         [FILE_SYSTEM_ACCEPTS_DRIVE_LETTER_PREFIX]: Don't treat 1: as a
993         drive prefix.
994         (IS_ABSOLUTE_FILE_NAME): Treat all drive letters as absolute on
995         platforms like cygwin with FILE_SYSTEM_DRIVE_PREFIX_IS_ABSOLUTE.
996         (last_component): New method.
997         * dirname.c (dir_len): Determine when drive letters need a
998         subsequent slash.  Preserve // when it is special.
999         (dir_name): Don't append dot when drive letter is absolute.
1000         [TEST_DIRNAME]: Move into a full-blown gnulib test.
1001         * basename.c (base_name): New semantics - malloc the result.
1002         Preserve // when it is special.  Preserve relative files that look
1003         like drive letters.
1004         (base_len): Preserve // when it is special.
1005         (last_component): New method, similar to old base_name semantics.
1006         * stripslash.c (strip_trailing_slashes): Use last_component, not
1007         base_name.  Strip redundant slashes from ///.
1008
1009 2006-03-19  Jim Meyering  <jim@meyering.net>
1010
1011         Work even in a chroot where d_ino values for entries in "/"
1012         don't match the stat.st_ino values for the same names.
1013         * getcwd.c (__getcwd): When no d_ino value matches the target inode
1014         number, iterate through all entries again, using lstat instead.
1015         Reported by Kenshi Muto in http://bugs.debian.org/355810, and by
1016         Zouhir Hafidi in https://bugzilla.redhat.com/bugzilla/190656.
1017
1018         * getcwd.c (__getcwd): Clarify a comment.
1019         Use memcpy in place of a call to strcpy.
1020
1021 2006-03-16  Paul Eggert  <eggert@cs.ucla.edu>
1022
1023         * regex.h (regoff_t) [defined _REGEX_LARGE_OFFSETS]:
1024         Typedef to long int, not to off_, as POSIX will likely change
1025         in that direction.
1026
1027 2006-03-12  Jim Meyering  <jim@meyering.net>
1028
1029         * fts-cycle.c (leave_dir): If cycle-check's saved dev-ino pair matches
1030         that of the current directory (which we're about to chdir ".." out of),
1031         then save the dev-ino of the parent, instead.
1032
1033         * same-inode.h (SAME_INODE): New file/macro.
1034         * chdir-safer.c (SAME_INODE): Remove definition.
1035         Include "same-inode.h", instead.
1036         * same.c: Likewise.
1037         * cycle-check.h: Include "same-inode.h".
1038         (CYCLE_CHECK_REFLECT_CHDIR_UP): Define.
1039         * cycle-check.c (SAME_INODE): Remove definition.
1040         * root-dev-ino.h: Include "same-inode.h".
1041
1042 2006-03-12  Paul Eggert  <eggert@cs.ucla.edu>
1043
1044         * Makefile.am (libcoreutils_a_SOURCES): Remove time_r.c, time_r.h,
1045         as this is now done in m4.
1046         * time_r.h (asctime_r, ctime_r): Remove.  These functions can
1047         overrun buffers and shouldn't be used (much as gets shouldn't be
1048         used).
1049         * time_r.c (asctime_r, ctime_r): Likewise.
1050
1051 2006-02-17  Simon Josefsson  <jas@extundo.com>
1052
1053         * base64.h, base64.c: New files.
1054         * Makefile.am (libcoreutils_a_SOURCES): Add base64.h and base64.c.
1055
1056 2006-02-20  Paul Eggert  <eggert@cs.ucla.edu>
1057
1058         * getcwd.c (AT_FDCWD): Work around a bug in Solaris 9 and 10, where
1059         AT_FDCWD exceeds INT_MAX.
1060         * openat.h (AT_FDCWD): Likewise.
1061
1062 2006-02-17  Jim Meyering  <jim@meyering.net>
1063
1064         * openat.c: Include lstat.h, so that uses of lstat are converted
1065         to uses of rpl_lstat, e.g., on Solaris 9.  Otherwise, programs like
1066         du (which now uses the openat-enabled fts and hence fstatat) would
1067         mistakenly fail to dereference a symlink-to-directory specified
1068         with a trailing slash.
1069
1070 2006-02-14  Paul Eggert  <eggert@cs.ucla.edu>
1071
1072         * vasnprintf.c (VASNPRINTF): Rewrite the computation so that we
1073         need not use xsum.
1074
1075 2006-02-14  Bruno Haible  <bruno@clisp.org>
1076
1077         Sync from gnulib.
1078
1079         * vasnprintf.c (VASNPRINTF): In the computation of the size of the
1080         temporary buffer for sprintf, take into account the precision also
1081         for 'd', 'i', 'u', 'o', 'x', 'X'.
1082
1083 2006-02-14  Simon Josefsson  <jas@extundo.com>
1084
1085         Sync from gnulib.
1086
1087         * getaddrinfo.h: Define EAI_ADDRFAMILY and EAI_SYSTEM if not set,
1088         for mingw32.
1089
1090         * gai_strerror.c, getaddrinfo.h: Protect netdb.h #include (for
1091         mingw32).
1092
1093 2006-02-07  Paul Eggert  <eggert@cs.ucla.edu>
1094
1095         * closeout.c (close_stdout): Don't assume 'bool' converts nonzero
1096         ints to 0 or 1, as this isn't true for the stdbool.h substitute.
1097
1098 2006-02-02  Jim Meyering  <jim@meyering.net>
1099
1100         Eliminate the unwelcome (albeit unlikely) possibility of xmalloc
1101         failure on deficient systems, and simplify gnulib lgpl dependencies.
1102         * lstat.c (rpl_lstat): Rewrite to use stat() in place of the
1103         xmalloc/lstat combination.  Based on a patch from Bruno Haible.
1104
1105 2006-01-27  Paul Eggert  <eggert@cs.ucla.edu>
1106
1107         * fnmatch.c (L_): Renamed from L, to work around a bug in
1108         Mac OS X 10.3.9 with GCC 3 reported by Claudio Fontana in
1109         <http://lists.gnu.org/archive/html/bug-gnulib/2006-01/msg00074.html>.
1110         All uses changed.
1111
1112 2006-01-26  Paul Eggert  <eggert@cs.ucla.edu>
1113
1114         * stdbool_.h: Sync from gnulib.
1115         Use signed char with all non-GCC compilers.
1116
1117 2006-01-25  Paul Eggert  <eggert@cs.ucla.edu>
1118
1119         * stdbool_.h: Merge from gnulib; we still don't quite match exactly,
1120         but we're getting closer.
1121         (true, false) [defined __BEOS__]: undef, as before.
1122         (_Bool) [!@HAVE__BOOL@ && defined __GNUC__]: Use an enum
1123         rather than a #define.
1124
1125 2006-01-25  Jim Meyering  <jim@meyering.net>
1126
1127         * fileblocks.c: Remove useless parentheses in cpp directive.
1128         * readutmp.h: Likewise.
1129
1130 2006-01-23  Paul Eggert  <eggert@cs.ucla.edu>
1131
1132         Work around porting bugs reported by Dieter in
1133         <http://lists.gnu.org/archive/html/bug-bison/2006-01/msg00049.html>.
1134         * getopt.c (_NOPROTO): Remove; no longer needed.
1135         Include <stdlib.h> and <unistd.h> in all environments; it's safe now.
1136         Include "getopt.h" first, to check interface.
1137         (getenv): Declare only if defined HAVE_DECL_GETENV &&
1138         !HAVE_DECL_GETENV.
1139         * strndup.c [!_LIBC]: Include "strndup.h" to get prototype.
1140         (__strndup): Revert to K&R-style function dfns, the glibc style.
1141         * strnlen.c: Don't claim it's taken from glibc; it's not.
1142         (strnlen, __strnlen): Remove #defines and #undefs; not needed.
1143         Include strnlen.h first, to get prototype properly.
1144         (strnlen): Renamed from __strnlen.
1145         Remove weak alias.
1146
1147 2006-01-23  Ulrich Drepper  <drepper@redhat.com>
1148
1149         These changes imported from libc.
1150         * getopt.c: Use __fxprintf instead of inline stream orientation
1151         test and two separate function calls.
1152         * strndup.c (__strndup): Add libc_hidden_def.
1153
1154 2006-01-23  Jim Meyering  <jim@meyering.net>
1155
1156         * xalloc-die.c: Remove unused definition of N_.
1157
1158 2006-01-22  Paul Eggert  <eggert@cs.ucla.edu>
1159
1160         * quotearg.c (quotearg_buffer_restyled): Add "default: break;"
1161         to pacify gcc -Wswitch-default.
1162
1163 2006-01-17  Jim Meyering  <jim@meyering.net>
1164
1165         Rewrite fts.c not to change the current working directory,
1166         by using openat, fstatat, fdopendir, etc..
1167
1168         * fts.c [! _LIBC]: Include "openat.h" and "unistd--.h".
1169         (HAVE_OPENAT_SUPPORT): Define.
1170         [_LIBC] (fchdir): Don't undef or define; no longer used.
1171         (FCHDIR): Define in terms of cwd_advance_fd rather than fchdir.
1172         Now, this `function' always succeeds, and consumes its file descriptor
1173         parameter -- so callers must not close such FDs.  Update callers.
1174         (diropen_fd, opendirat, cwd_advance_fd): New functions.
1175         (diropen): Add parameter, SP.  Adjust all callers.
1176         Implement using diropen_fd, rather than open.
1177         (fts_open): Initialize new member, fts_cwd_fd.
1178         Remove fts_rft-setting code.
1179         (fts_close): Close fts_cwd_fd, if necessary.
1180         (__opendir2): Define in terms of opendir or opendirat,
1181         depending on whether the FST_NOCHDIR flag is set.
1182         (fts_build): Since fts_safe_changedir consumes its FD, and since
1183         this code must do `closedir(dirp)', dup the dirfd(dirp) argument,
1184         and close the dup'd file descriptor upon failure.
1185         (fts_stat): Use fstatat(...AT_SYMLINK_NOFOLLOW) in place of lstat.
1186         (fts_safe_changedir): Tweak semantics to reflect that this function
1187         now calls cwd_advance_fd and hence consumes its FD argument.
1188         * fts_.h [struct FTS] (fts_cwd_fd): New member.
1189         [struct FTS] (fts_rft): Remove now-unused member.
1190         [struct FTS] (fts_cycle.state): Improve comment.
1191
1192         * openat.c (openat_needs_fchdir): New function.
1193         * openat.h (openat_needs_fchdir): Declare it.
1194
1195 2006-01-12  Jim Meyering  <jim@meyering.net>
1196
1197         * stdint_.h: Remove useless parentheses in cpp directives, so that
1198         this file passes coreutils' `make syntax-check' tests.
1199
1200 2006-01-11  Paul Eggert  <eggert@cs.ucla.edu>
1201
1202         * .cvsignore: Add stdint.h.
1203         * Makefile.am (BUILT_SOURCES, EXTRA_DIST, stdint.h, MOSTLYCLEANFILES):
1204         Add gnulib snippet.
1205         * md5.c: Fix commentary typos.
1206         (alignof, UNALIGNED_P): No need for a GCC-specific version.
1207         * md5.h (__attribute__): Remove; unused.
1208         * sha1.c, sha256.c, sha256.c: Fix commentary to match md5 better.
1209         * sha1.h (struct sha1_ctx): Use a word buffer, not a byte buffer,
1210         so that we don't need to worry about alignment.  All uses changed.
1211         This merges the 2005-10-28 md5 change into sha1.
1212         * sha256.h (struct sha256_ctx): Likewise.
1213         * sha512.h (struct sha512_ctx): Likewise.
1214         * sha256.h: Include stdint.h rather than md5.h.
1215         * sha512.h: Include stdint.h uniformly, since we now have the
1216         stdint module.
1217         * stdint_.h: New file, from gnulib.
1218
1219 2006-01-11  Jim Meyering  <jim@meyering.net>
1220
1221         * fts.c (fts_stat): When following a symlink-to-directory,
1222         don't necessarily interpret stat-fails+lstat-succeeds as indicating
1223         a dangling symlink.  That can also happen at least for ELOOP.
1224         The fix: return FTS_SLNONE only when the stat errno is ENOENT.
1225         FYI, this bug predates the inclusion of fts.c in coreutils.
1226
1227 2006-01-11  Jim Meyering  <jim@meyering.net>
1228
1229         * fts.c [!_LIBC]: Include "fcntl--.h", to map open to open_safer.
1230         (fts_open): Put new (2006-01-04) maxarglen declaration and uses
1231         in their own block, so pre-c99 compilers don't object.
1232
1233         * openat.c (fchownat): New function.
1234         * openat.h (fchmodat, fchownat): Declare.
1235         (chmodat, lchmodat): Define convenience functions.
1236         (chownat, lchownat): Likewise.
1237         * fchmodat.c (fchmodat): New file and function.
1238
1239         * md5.c (OP): Remove useless space-before-TAB.
1240
1241 2006-01-10  Paul Eggert  <eggert@cs.ucla.edu>
1242
1243         * localcharset.c, md5.c, md5.h, savedir.c, savedir.h, sha1.c, sha1.h
1244         * strcasecmp.c, strncasecmp.c, verify.h, regex_internal.h:
1245         Sync from gnulib.
1246         * sha256.c, sha256.h, sha512.c, sha512.h:
1247         Replace all instances of md5_uint32_t with uint32_t, to accommodate
1248         gnulib change.
1249
1250 2006-01-10  Jim Meyering  <jim@meyering.net>
1251
1252         Avoid the double-free (first in fts_read, second in fts_close) that
1253         would occur when an `active' directory is made inaccessible (e.g.,
1254         via chmod a-x) during a traversal.
1255         * fts.c (fts_read): After a failed fchdir, update sp->fts_cur
1256         before returning.  Reproduce this failure by
1257         mkdir -p a/b; cd a; chmod a-x . b
1258         Reported by Stavros Passas.
1259
1260 2006-01-06  Jim Meyering  <jim@meyering.net>
1261
1262         * version-etc.c (COPYRIGHT_YEAR): Update to 2006.
1263
1264 2006-01-04  Paul Eggert  <eggert@cs.ucla.edu>
1265
1266         * strftime.c (tzname): Don't declare if it is already #defined.
1267         Problem reported for Mingw by Mark Junker.
1268
1269 2006-01-04  Jim Meyering  <jim@meyering.net>
1270
1271         Merge from glibc.
1272         * fts.c (fts_open): Avoid function call in MAX macro use.
1273
1274 2006-01-03  Paul Eggert  <eggert@cs.ucla.edu>
1275
1276         * xtime.h (xtime_make, xtime_nonnegative_nsec, xtime_nsec): Use
1277         long int, not int, for nanosecond counts, so that people who are
1278         used to POSIX struct timespec won't be surprised.  Reported by Jim
1279         Meyering.
1280
1281 2006-01-01  Paul Eggert  <eggert@cs.ucla.edu>
1282
1283         * chmod-safer.c, chmod-safer.h: Remove.
1284         * lchmod.h: New file.
1285         * mkdir-p.c: Include lchmod.h, lchown.h.
1286         (make_dir_parents): Use lchown rather than chown, and
1287         lchmod rather than chmod.
1288
1289 2005-12-26  Paul Eggert  <eggert@cs.ucla.edu>
1290
1291         * chdir-long.c (cdb_free): Don't bother trying to open directory
1292         for write access: POSIX says that must fail.
1293         * chdir-safer.c (chdir_no_follow): Likewise.
1294         * fts.c (diropen): Likewise.
1295         * save-cwd.c (save_cwd): Likewise.
1296         * chdir-long.c (cdb_free): Open with O_NOCTTY | O_NONBLOCK as
1297         well, for minor improvements on hosts that lack O_DIRECTORY.
1298         * chmod-safer.c (defined_S_IFMT): New macro.
1299         Include stat-macros.h.
1300         Include stdlib.h, for abort().
1301         Don't include stdio.h or assert.h; no longer needed.
1302         (same_file_type): Don't assume S_IFMT is defined, as POSIX
1303         does not require this.  Don't assume S_IFCHR and S_IFBLK have
1304         their usual sort of bit pattern.
1305         (fchmod_new): Open with O_NOCTTY for as well, for minor
1306         improvement on hosts where that matters.  Don't bother to assert,
1307         since the caller (in this source file) checks the same thing.
1308         Discard any errno from a close failure, for consistency with other
1309         code.
1310         * chown.c (rpl_chown) [CHOWN_MODIFIES_SYMLINK]:
1311         Don't try O_WRONLY unless O_RDONLY failed wth EACCES.
1312         Fall back on chown if open failed with EACCES.
1313
1314 2005-12-26  Jim Meyering  <jim@meyering.net>
1315
1316         * chdir-safer.c (chdir_no_follow): Move declaration of local,
1317         sb2, `down' into the scope where it is used.
1318         Note that on some systems this function also fails when DIR
1319         is a writable-yet-unreadable directory.
1320
1321 2005-12-25  Paul Eggert  <eggert@cs.ucla.edu>
1322
1323         * chdir-safer.h (FCHMOD_SAFER_H): Remove: it was misnamed, and
1324         wasn't needed anyay.
1325         * chdir-safer.c (chdir_no_follow): Don't include stdio.h, assert.h,
1326         fcntl--.h; not needed.
1327         (O_DIRECTORY): Define if not already defined.
1328         (chdir_no_follow): Revamp describing comment to match code more
1329         closely.  Redo use of internal vars to avoid lint complaints.
1330         Work even if directory is writeable but not readable.
1331         Open with O_DIRECTORY | O_NOCTTY, for benefit of hosts that
1332         don't have O_NOFOLLOW.  Use O_NONBLOCK (POSIX spelling) rather
1333         than O_NDELAY.  Don't bother invoking fstat if open does not
1334         dereference symlink, since the result isn't used then.
1335         Don't assume file descriptor is positive; it might be zero
1336         now that we no longer include fcntl--.h (we don't need fcntl--.h
1337         since we immediately close the descriptor).
1338
1339 2005-12-25  Jim Meyering  <jim@meyering.net>
1340
1341         * chdir-safer.c (chdir_no_follow): Remove unnecessary
1342         test of S_ISDIR (sb_init.st_mode).
1343
1344 2005-12-23  Jim Meyering  <jim@meyering.net>
1345
1346         * mkdir-p.c (make_dir_parents): Use chdir_no_follow only
1347         if we've just created the directory.
1348
1349         * chdir-safer.c (chdir_no_follow): Rewrite to use fchdir even
1350         when O_NOFOLLOW is not defined.  Suggested by James Youngman.
1351
1352         * chmod-safer.c (O_NOFOLLOW): Define, if necessary.
1353         * chdir-safer.c (O_NOFOLLOW): Likewise.
1354         Reported by Eric Blake.
1355
1356 2005-12-22  Jim Meyering  <jim@meyering.net>
1357
1358         * openat.c: Include "fcntl--.h" and "unistd--.h", to map open
1359         and dup to open_safer and dup_safer, respectively.
1360         (openat_permissive): Fix typo in comment.
1361
1362 2005-12-21  Jim Meyering  <jim@meyering.net>
1363
1364         Like chdir(2), but safer, if possible.
1365         * chdir-safer.c, chdir-safer.h: New files.
1366
1367 2005-12-20  Jim Meyering  <jim@meyering.net>
1368
1369         * mkdir-p.c (RW_USR): Remove definition.
1370         (make_dir_parents): Use S_IRWXU, now that read access is also required.
1371
1372         Avoid a race condition, on systems where open honors O_NOFOLLOW.
1373         * mkdir-p.c (make_dir_parents): Include chdir-safer.h.
1374         Use chdir_no_follow in place of chdir.
1375
1376         * mkdir-p.c (make_dir_parents): Remove unnecessary casts of alloca,
1377         since now it's guaranteed to be (void *).
1378
1379         * chmod-safer.c (fchmod_new): Don't try to close fd if it's < 0.
1380
1381 2005-12-19  Jim Meyering  <jim@meyering.net>
1382
1383         * chmod-safer.c, chmod-safer.h: New files.
1384
1385 2005-12-05  Andreas Gruenbacher  <agruen@suse.de>
1386
1387         Add POSIX ACL support
1388         * acl.h (copy_acl, set_acl): Add declarations.
1389         * acl.c (acl_entries): Add fallback implementation for POSIX ACL
1390         systems other than Linux.
1391         (chmod_or_fchmod): New function: use fchmod when possible,
1392         and chmod otherwise.
1393         (file_has_acl): Add a POSIX ACL implementation, with a
1394         Linux-specific subcase.
1395         (copy_acl): Add: copy an acl and S_ISUID, S_ISGID, and
1396         S_ISVTX from one file to another.  Fall back to fchmod/chmod when
1397         acls are unsupported.
1398         (set_acl): Add: set a file's acl and S_ISUID, S_ISGID, and
1399         S_ISVTX to a defined value.  Fall back to fchmod/chmod when acls
1400         are unsupported.
1401
1402 2005-12-16  Paul Eggert  <eggert@cs.ucla.edu>
1403
1404         * openat.c: Don't include <stdlib.h>, <unistd.h>, <fcntl.h>,
1405         "gettext.h"; either no longer needed or are guaranteed by openat.h.
1406         (_): Remove; no longer needed.
1407         (openat): Renamed from rpl_openat; no need for rpl_openat
1408         since openat.h renames openat for us.
1409         Replace most of the body with a call to openat_permissive,
1410         to avoid duplicate code.
1411         Port to (probably hypothetical) environments were mode_t is
1412         wider than int.
1413         (openat_permissive): Require mode arg, so that we can check
1414         types better.  Put it just after flags.  Change cwd failure
1415         indicator from pointer-to-bool to pointer-to-errno-value.
1416         All callers changed.
1417         Invoke openat_save_fail and/or openat_restore_fail if
1418         cwd_errno is null, so that openat can call us.
1419         (openat_permissive, fdopendir, fstatat, unlinkat):
1420         Simplify errno handling to avoid some duplicate code,
1421         as it's OK to set errno on success.
1422         * openat.h: Revamp code so that function macros depend on
1423         __OPENAT_PREFIX only, not also on AT_FDCWD.
1424         (openat_ro): Remove.  Caller changed to use openat_permissive.
1425         (openat_permissive): Now a macro, if not a function.
1426         (openat_restore_fail, openat_save_fail): Now always functions,
1427         since mkdirat needs them even if __OPENAT_PREFIX is defined.
1428
1429 2005-12-14  Jim Meyering  <jim@meyering.net>
1430
1431         * Makefile.am (libcoreutils_a_SOURCES): Remove fprintftime.c
1432         and fprintftime.h.  Now they're pulled in via the .m4 file.
1433
1434 2005-12-13  Paul Eggert  <eggert@cs.ucla.edu>
1435
1436         * Makefile.am (stdbool.h): Resurrect the 'sed' that goes along
1437         with '#if !@HAVE_BOOL@".
1438         * stdbool_.h (_Bool): Resurrect the "#if !@HAVE__BOOL@" check, to
1439         work around compilers that have a (possibly-broken) _Bool but lack
1440         a working <stdbool.h>.
1441
1442 2005-12-07  Paul Eggert  <eggert@cs.ucla.edu>
1443
1444         * stat-time.h (STATE_TIMESPEC, STAT_TIMESPEC_NS): Add check for
1445         TYPEOF_STRUCT_STAT_ST_ATIM_IS_STRUCT_TIMESPEC, to fix IRIX 5.3
1446         porting problem reported by Georg Schwarz in
1447         <http://lists.gnu.org/archive/html/bug-coreutils/2005-12/msg00083.html>.
1448
1449 2005-12-04  Jim Meyering  <jim@meyering.net>
1450
1451         * openat-priv.h (EXPECTED_ERRNO): Add ENOSYS, for Solaris 8.
1452         Paul Eggert reported that unlink/rmdir vs. e.g., /proc/self/fd/N/FILE
1453         fails with ENOSYS.  This makes openat revert to using save-cwd.c
1454         functions in that case.
1455
1456 2005-12-01  Paul Eggert  <eggert@cs.ucla.edu>
1457
1458         Sync from gnulib.
1459
1460         * exclude.c: Include verify.h.
1461         (verify): Remove.  All callers changed to use verify.h's version.
1462         * strtoimax.c: Likewise.
1463         * utimecmp.c: Likewis.e
1464
1465         * obstack.c [defined _LIBC && defined USE_IN_LIBIO]: Don't
1466         include <wchar.h>; no longer needed.
1467
1468 2005-12-01  Jim Meyering  <jim@meyering.net>
1469
1470         Sync from gnulib.
1471
1472         * intprops.h (signed_type_or_expr__): Define.
1473         (INT_STRLEN_BOUND) [__GNUC__]: Use a slightly tighter bound
1474         for unsigned types.
1475
1476 2005-12-01  Jakub Jelinek  <jakub@redhat.com>
1477         and  Ulrich Drepper  <drepper@redhat.com>
1478
1479         Import from libc via gnulib.
1480         * obstack.c (print_and_abort) [defined _LIBC]: Use __fxprintf
1481         instead of inline stream orientation test and two separate
1482         function calls.  Pay no attention to USE_IN_LIBIO.
1483
1484 2005-12-01  Roland McGrath  <roland@redhat.com>
1485
1486         Import from libc via gnulib.  [BZ #1331]
1487         * obstack.h [!__STDC__] (obstack_int_grow_fast): Fix misnamed
1488         macro argument.
1489         Reported by Matej Vela <vela@debian.org>.
1490
1491 2005-11-30  Jim Meyering  <jim@meyering.net>
1492
1493         * openat-priv.h: New file, defining macros used by mkdirat.c
1494         and openat.c.
1495         * mkdirat.c: Include openat-priv.h.
1496         Remove definitions of macros defined therein.
1497         * openat.c: Likewise.
1498
1499         * mkdirat.c (mkdirat): New file and function.
1500         * openat.h (mkdirat): Declare.
1501
1502 2005-11-25  Paul Eggert  <eggert@cs.ucla.edu>
1503
1504         * mountlist.c (ME_DUMMY): "none" and "proc" file systems are dummies
1505         too.  Problem with "none" reported by Bob Proulx.  Problem with
1506         "proc" reported by n0dalus.
1507
1508         * mountlist.c: Include <limits.h>.
1509         (dev_from_mount_options)
1510         [defined MOUNTED_GETMNTENT1 || defined MOUNTED_GETMNTENT2]:
1511         New function.  It no longer assumes "dev=" has the System V meaning
1512         on Linux (since it doesn't).  It also parses "dev=" more carefully.
1513         (read_file_system_list)
1514         [defined MOUNTED_GETMNTENT1 || defined MOUNTED_GETMNTENT2]: Use it.
1515         MOUNTED_GETMNTENT2 is new here; the code didn't used to look for
1516         dev= in that case.
1517
1518         * Makefile.am (stdbool.h): Just copy stdbool_.h; no need to sed
1519         any more.
1520
1521         * stdbool_.h: Simplify greatly, under the assumption that these
1522         days most people use C99-compatible compilers to debug, so it's
1523         not worth worrying about catering to older compilers for that.
1524         This works around some porting problems with HP-UX compilers.
1525         (false, true) [defined __BEOS__]: Don't #undef; no longer needed.
1526         (_Bool): typedef to bool if C++ or BeOS, and #define to signed char
1527         otherwise.
1528
1529         * gettime.c (gettime) [!defined OK_TO_USE_1S_CLOCK]:
1530         Report an error at compile-time if only a 1-second nominal clock
1531         resolution is found.
1532
1533 2005-11-23  Paul Eggert  <eggert@cs.ucla.edu>
1534
1535         * Makefile.am (libcoreutils_a_SOURCES): Add buffer-lcm.c, buffer-lcm.h.
1536         * buffer-lcm.c, buffer-lcm.h: New files, from diffutils.
1537
1538 2005-11-23  Jim Meyering  <jim@meyering.net>
1539
1540         * openat.c (fdopendir): Don't change errno when returning non-NULL.
1541
1542 2005-11-22  Jim Meyering  <jim@meyering.net>
1543
1544         * openat.h (openat_permissive): Declare.
1545         (openat_ro): Define.
1546
1547         * openat.c (EXPECTED_ERRNO): New macro.
1548         (openat_permissive): New function -- used in remove.c rewrite.
1549         (all functions): Set errno just before returning, only if there
1550         was an actual failure.
1551         Use EXPECTED_ERRNO rather than comparing against only ENOTDIR.
1552
1553 2005-11-20  Jim Meyering  <jim@meyering.net>
1554
1555         * euidaccess-stat.c: New file, mostly from euidaccess.c.
1556         * euidaccess-stat.h: New file.
1557
1558 2005-11-15  Paul Eggert  <eggert@cs.ucla.edu>
1559
1560         * xstrtod.c: Don't bother with #pragma STDC FENV_ACCESS ON, as
1561         coreutils no longer futzes with rounding modes.
1562
1563 2005-11-08  Eric Blake  <ebb9@byu.net>
1564
1565         * getaddrinfo.h: Use #if !, not #ifndef, for AC_CHECK_DECLS.
1566
1567 2005-11-13  Jim Meyering  <jim@meyering.net>
1568
1569         * mkstemp-safer.c: Include <config.h>, required for possible
1570         replacement of mkstemp.
1571
1572 2005-11-12  Jim Meyering  <jim@meyering.net>
1573
1574         Emulate openat-family functions using Linux's procfs, if possible.
1575         Idea and some code based on Ulrich Drepper's glibc changes.
1576
1577         * openat.c: (BUILD_PROC_NAME): New macro.
1578         Include <stdio.h>, <string.h>, "alloca.h" and "intprops.h".
1579         (rpl_openat): Emulate by trying to open /proc/self/fd/%d/%s,
1580         before falling back on save_cwd and restore_cwd.
1581         (fdopendir, fstatat, unlinkat): Likewise.
1582
1583 2005-11-11  Jim Meyering  <jim@meyering.net>
1584
1585         * openat.c (fstatat, unlinkat): Perform the syscall directly,
1586         skipping the save_cwd...restore_cwd overhead, if FILE is absolute.
1587
1588 2005-11-10  Paul Eggert  <eggert@cs.ucla.edu>
1589
1590         * gethrxtime.c: Include "timespec.h" rather than the sys/time / time
1591         business.
1592         (gethrxtime) [! (HAVE_NANOUPTIME
1593         || (defined CLOCK_MONOTONIC && HAVE_CLOCK_GETTIME)
1594         || HAVE_MICROUPTIME)]: Fall back on gettime rather than rolling
1595         our own approximation.
1596
1597 2005-11-01  Paul Eggert  <eggert@cs.ucla.edu>
1598
1599         * posixtm.h (PDS_PRE_2000): New macro.
1600         * posixtm.c (year): Arg is now syntax_bits rather than allow_century.
1601         All usages changed.  Reject dates outside the range 1969-1999 if
1602         PDS_PRE_2000 is used.
1603
1604 2005-10-30  Paul Eggert  <eggert@cs.ucla.edu>
1605
1606         Fix porting problems reported by Theodoros V. Kalamatianos.
1607         * fd-reopen.c [defined HAVE_CONFIG_H]: Include <config.h>,
1608         so that large files can be opened.
1609         * utimens.c (futimens) [HAVE_WORKING_UTIMES && HAVE_FUTIMES]:
1610         Don't assume that futimes failing means we must fail.
1611
1612 2005-10-29  Paul Eggert  <eggert@cs.ucla.edu>
1613
1614         * getcwd.c (__getcwd): Don't assume that system calls after readdir
1615         leave errno alone.  Problem reported by Dmitry V. Levin.
1616
1617 2005-10-28  Paul Eggert  <eggert@cs.ucla.edu>
1618
1619         * savedir.c (savedir): Don't assume that xrealloc etc. leave
1620         errno alone.  Problem reported by Frederic Jolliton.
1621
1622 2005-10-24  Jim Meyering  <jim@meyering.net>
1623
1624         * mkdir-p.c (make_dir_parents): Like the code above, don't rely
1625         on mkdir failing with a particular errno value (EEXIST).
1626         Based on a patch by Dmitry V. Levin.
1627
1628         * mkdir-p.c (make_dir_parents): Make the preceding fix a little
1629         more robust, e.g., when the final component is created as a non-
1630         directory by another process just before `mkdir -p's final mkdir.
1631
1632         A command like `mkdir -p nonexistent/.' would create the
1633         directory but exit nonzero with a diagnostic.  This could also be
1634         triggered with a non-`.' component, e.g., in a race with another
1635         process running the same `mkdir -p nonexistent/sub' command.
1636
1637         * mkdir-p.c (make_dir_parents): Handle the case of an
1638         existing final component.
1639         Reported by Matthias Andree here:
1640         http://savannah.gnu.org/bugs/?func=detailitem&item_id=14848
1641
1642 2005-10-23  Jim Meyering  <jim@meyering.net>
1643
1644         * sha512.h: Remove no-longer-relevant comment.
1645
1646 2005-08-27  David Madore  <david.madore@ens.fr>
1647
1648         * sha256.h, sha256.c, sha512.h, sha512.c: New files - sha-2
1649         implementation.
1650
1651 2005-10-20  Jim Meyering  <jim@meyering.net>
1652
1653         * modechange.c (mode_compile): Reject an invalid mode string
1654         that starts with an octal digit.  From Andreas Gruenbacher.
1655
1656 2005-10-13  Paul Eggert  <eggert@cs.ucla.edu>
1657
1658         * mkdir-p.c (make_dir_parents): Don't report an error if an
1659         intermediate directory is in a read-only file system.  Problem
1660         reported by Eric Blake.
1661
1662 2005-10-08  Jim Meyering  <jim@meyering.net>
1663
1664         * openat.c (rpl_openat): Use the promoted type (int), not mode_t,
1665         as second argument to va_arg.  Otherwise, some versions of gcc
1666         warn that `if this code is reached, the program will abort'.
1667
1668         Update from gnulib.
1669         * getdelim.c: (SIZE_MAX): New macro, if not already defined.
1670
1671 2005-10-05  Jim Meyering  <jim@meyering.net>
1672
1673         * Makefile.am (libcoreutils_a_DEPENDENCIES): Remove definition.
1674         Once it's gone, automake generates an equivalent one.
1675         Suggestion from Stepan Kasal.
1676
1677         * getaddrinfo.h: Merge from gnulib.
1678
1679 2005-10-04  Jim Meyering  <jim@meyering.net>
1680
1681         Merge from gnulib.
1682         * getaddrinfo.h: Include sys/types.h before other headers.
1683
1684 2005-10-02  Paul Eggert  <eggert@cs.ucla.edu>
1685
1686         * getdelim.c: Import from gnulib (to fix unused var warnings) then
1687         apply the following fixes:
1688         Include getdelim.h first.  Include <limits.h>.
1689         (SSIZE_MAX): New macro, if not already defined.
1690         (getdelim): Fix buffer overrun on 64-bit hosts with lines longer
1691         than 2 GiB.
1692
1693 2005-10-01  Simon Josefsson  <jas@extundo.com>
1694
1695         * getaddrinfo.h: Protect #include's of sys/socket.h and netdb.h.
1696         Only define struct addrinfo if !HAVE_STRUCT_ADDRINFO.  Protect
1697         AI_* and EAI_* definitions.  Protect function declarations.
1698
1699 2005-09-29  Paul Eggert  <eggert@cs.ucla.edu>
1700
1701         * openat.c (fdopendir): Do not define if HAVE_FDOPENDIR.
1702         Remove AT_FDCWD test.
1703         Do not consume the fd unless successful.
1704         * openat.h (fdopendir): Do not define if HAVE_FDOPENDIR.
1705
1706 2005-09-29  Paul Eggert  <eggert@cs.ucla.edu>
1707
1708         * xtime.h (XTIME_PRECISION): Now of type int, not long long int,
1709         so that the code works even with ancient cpp.  Portability problem
1710         with GCC 2.7.2.1 reported by Thomas M.Ott.
1711
1712         * settime.c (settime): Fix { typo in previous patch.  Also, don't
1713         bother returning ENOSYS if settimeofday or stime fails; just let
1714         them return whatever errno they want to return.
1715
1716 2005-09-29  Jim Meyering  <jim@meyering.net>
1717
1718         * settime.c (settime): Move the HAVE_STIME block `up' into an #elif
1719         block, so that we don't even try to compile it if settimeofday is
1720         available.  This works around a compilation failure on OSF1 V5.1,
1721         due to stime requiring a `long int*' while tv_sec is `int'.
1722
1723 2005-09-27  Jim Meyering  <jim@meyering.net>
1724
1725         * fprintftime.c [HAVE_CONFIG_H]: Include <config.h> conditionally,
1726         to be consistent with gnulib.
1727         * getcwd.c: Change #ifdef<TAB>HAVE_CONFIG_H to #ifdef HAVE_CONFIG_H.
1728         * fts-cycle.c [HAVE_CONFIG_H]: Include <config.h>.
1729         * strnumcmp.c [HAVE_CONFIG_H]: Include <config.h> here, now that
1730         strnumcmp-in.h no longer includes it.
1731
1732 2005-09-26  Paul Eggert  <eggert@cs.ucla.edu>
1733
1734         * utimens.c: Include unistd.h, for dup2.
1735         (futimens): Fix typo: HAVE_FUTIMESAT was misspelled in an #if.
1736         (futimens) [! HAVE_FUTIMESAT]: If !file, set errno before returning -1.
1737
1738 2005-09-25  Jim Meyering  <jim@meyering.net>
1739
1740         * strnumcmp-in.h: Protect against multiple inclusion.
1741
1742 2005-09-24  Paul Eggert  <eggert@cs.ucla.edu>
1743
1744         * utimens.c (ENOSYS): Define if not already defined.
1745         (futimens): Support having a null PATH if the file descriptor
1746         is nonnegative.
1747
1748         * Makefile.am (libcoreutils_a_SOURCES): Remove mbchar.c, since
1749         it doesn't build in OpenBSD 3.4.  See
1750         <http://lists.gnu.org/archive/html/bug-gnulib/2005-09/msg00242.html>.
1751
1752         * regex_internal.h (__GNUC_PREREQ, always_inline, inline, pure):
1753         Remove.
1754         (__attribute): Define to empty unless GCC 3.1 or later.
1755         This works around a core dump on OpenBSD 3.4, which has GCC
1756         2.95.3, which dumps core when given __attribute__(()).  It also
1757         simplifies other tests, since we really don't want to bother with
1758         worrying about which ancient version of GCC supported what.
1759         Original problem reported by Yoann Vandoorselaere, with part of
1760         the fix suggested by Derek Price.
1761
1762 2005-09-24  Jim Meyering  <jim@meyering.net>
1763
1764         * openat-die.c, root-dev-ino.c, setenv.c, stdopen.c:
1765         * tsearch.c, unsetenv.c, xfts.c: Use `#ifdef HAVE_CONFIG_H',
1766         not `#if HAVE_CONFIG_H', for consistency with gnulib.
1767
1768         * strintcmp.c: Include <config.h> here, ...
1769         * strnumcmp-in.h: ..., not here.
1770
1771         Sync from gnulib.
1772
1773         * verify.h (verify_type__): Use `unsigned int' as the bitfield type
1774         so we can once again use a positive bitfield width of 1 -- now we
1775         don't have to explain why we were using a bitfield width of 2.
1776
1777 2005-09-23  Paul Eggert  <eggert@cs.ucla.edu>
1778
1779         * utimens.c (futimens): Use futimesat if available.
1780         Prefer it to futimes since it doesn't have the futimes bug.
1781
1782         * verify.h (GL_CONCAT0, GL_CONCAT): Remove.
1783         (verify): Don't use the __LINE__ trick, as it doesn't work in general.
1784         Instead, declare a function that returns a pointer to an array,
1785         and use verify_type__ to declare the size of the array.
1786         Problem and germ of a solution reported by Bruno Haible.
1787         (verify_type__): Use 2, not 1, for bitfield size, to avoid
1788         a warning with Irix 6.5 cc.  Problem reported by Bruno Haible.
1789
1790 2005-09-23  Jim Meyering  <jim@meyering.net>
1791
1792         * strnumcmp-in.h: Include <config.h>.  Otherwise builds with strict
1793         C89 (e.g., Sun's /opt/SUNWspro/bin/c89) would fail due to the use
1794         of `inline'.
1795
1796 2005-09-22  Paul Eggert  <eggert@cs.ucla.edu>
1797
1798         * getaddrinfo.c [HAVE_NETINET_IN_H]: Include <netinet/in.h>.
1799         Problem reported by Eric Blake.
1800         (getaddrinfo): Initialize se so that it's not garbage.
1801         Redo internal storage allocation so that it doesn't make unportable
1802         assumptions about alignment.
1803         Fix a memory leak.
1804
1805 2005-09-21  Paul Eggert  <eggert@cs.ucla.edu>
1806
1807         Sync from gnulib.
1808
1809         * Makefile.am (libcoreutils_a_SOURCES): Add getaddrinfo.h,
1810         mbchar.c, mbchar.h, mbuiter.h, strcase.h, strlen1.c, strnlen1.h,
1811         strstr.h.
1812
1813         * argmatch.h (GL_CONCAT): Remove.
1814         Include "verify.h" instead.
1815         (ARGMATCH_CONSTRAINT, ARGMATCH_ASSERT): Remove.
1816         (ARGMATCH_VERIFY): Rewrite in terms of new verify macros.
1817
1818         * xalloc.h (VERIFY_EXPR, X2NREALLOC, X2REALLOC): Remove.
1819         The latter two macros are moving to ../src/system.h for now.
1820         This reverts this file to the gnulib version.
1821
1822         * xanstrftime.c, xanstrftime.h: Remove; no longer used.
1823
1824         * .cppi-disable: Add getaddrinfo.h, getdelim.h, mbchar.h,
1825         mbuiter.h, strcase.h, strnlen.h, strnlen1.h.
1826
1827         * canon-host.h, gai_strerror.c, getaddrinfo.c, getaddrinfo.h:
1828         * getdelim.c, getdelim.h, mbchar.c, mbchar.h, mbuiter.h:
1829         * strcase.h, strnlen.h, strnlen1.c, strnlen1.h, strstr.h:
1830         New files, from gnulib.
1831
1832         * __fpending.c, __fpending.h, acl.c, argmatch.c, atexit.c:
1833         * backupfile.c, basename.c, calloc.c, canonicalize.c:
1834         * chdir-long.c, chown.c, cloexec.c, closeout.c, creat-safer.c:
1835         * cycle-check.c, dirfd.c, dirfd.h, dirname.c, dup-safer.c:
1836         * dup2.c, euidaccess.c, exclude.c, exitfail.c, fchown-stub.c:
1837         * fd-safer.c, file-type.c, fileblocks.c, filemode.c:
1838         * filenamecat.c, fnmatch.c, fopen-safer.c, free.c, fsusage.c:
1839         * ftruncate.c, full-write.c, getcwd.c, getcwd.h, getdate.h:
1840         * getgroups.c, getndelim2.c, getopt1.c, getopt_.h:
1841         * gettimeofday.c, getugroups.c, group-member.c, hard-locale.c:
1842         * hash-pjw.c, hash.c, human.c, human.h, idcache.c, inttostr.c:
1843         * inttostr.h, lchown.c, long-options.c, lstat.c, malloc.c:
1844         * memcasecmp.c, memchr.c, memcmp.c, memcoll.c, memcpy.c:
1845         * memmove.c, mkdir.c, mkstemp.c, mktime.c, modechange.c:
1846         * mountlist.c, nanosleep.c, open-safer.c, openat.c, physmem.c:
1847         * pipe-safer.c, posixtm.c, posixver.c, putenv.c, quote.c:
1848         * quotearg.c, raise.c, readlink.c, readtokens0.c, readutmp.c:
1849         * realloc.c, regex.c, regex_internal.h, rename.c, rmdir.c:
1850         * rpmatch.c, safe-read.c, same.c, save-cwd.c, savedir.c:
1851         * settime.c, sig2str.c, strcspn.c, stripslash.c, strndup.c:
1852         * strnlen.c, strtod.c, strtoimax.c, strtol.c, strverscmp.c:
1853         * tempname.c, time_r.c, time_r.h, timespec.h, unicodeio.h:
1854         * unistd--.h, unlinkdir.c, userspec.c, utimecmp.c:
1855         * version-etc-fsf.c, version-etc.c, xalloc-die.c, xgetcwd.c:
1856         * xgethostname.c, xmalloc.c, xmemcoll.c, xnanosleep.c:
1857         * xreadlink.c, xstrndup.c, xstrtoimax.c, xstrtol.c:
1858         * xstrtoumax.c, yesno.c:
1859         Sync from gnulib.
1860
1861         * canon-host.c, getline.c, getline.h, getpass.c, strcasecmp.c:
1862         * strncasecmp.c, strstr.c:
1863         Nontrivial sync from gnulib.
1864
1865         * .cvsignore: Sort entries.
1866
1867         * mkdir-p.c (ENOSYS): Define to EEXIST if not defined.
1868         (make_dir_parents): Treat ENOSYS like EEXIST.
1869
1870 2005-09-20  Jim Meyering  <jim@meyering.net>
1871
1872         * openat.c (fdopendir): Be sure to close the supplied
1873         file descriptor before returning.  This makes our replacement
1874         implementation a little closer to Solaris's, where fdopendir
1875         ties the file descriptor to the returned DIR* pointer.
1876
1877 2005-09-19  Jim Meyering  <jim@meyering.net>
1878
1879         * openat.c (unlinkat): New function.
1880         * openat.h (unlinkat): Add prototype.
1881
1882 2005-09-16  Paul Eggert  <eggert@cs.ucla.edu>
1883
1884         Import from gnulib.
1885         * stat-time.h: New file.
1886         * timespec.h (ST_TIME_CMP_NS, ST_TIME_CMP, ATIME_CMP, CTIME_CMP):
1887         (MTIME_CMP, TIMESPEC_NS): Remove.  Now done by stat-time.h,
1888         in a different way.
1889         (timespec_cmp): New function.
1890         * utimecmp.c: Include stat-time.h.
1891         (SYSCALL_RESOLUTION): Depend on whether various struct stat
1892         members exist, not on the obsolescent ST_MTIM_NSEC.
1893         (utimecmp): Use the new stat-time functions rater than TIMESPEC_NS.
1894
1895         * .cppi-disable: Add stat-time.h.
1896
1897 2005-09-16  Jim Meyering  <jim@meyering.net>
1898
1899         * strftime.c [FPRINTFTIME] (fprintftime): Provide a new interface:
1900         size_t fprintftime (FILE *fp, char const *fmt, struct tm const *tm,
1901                             int utc, int nanoseconds);
1902         Background:
1903         date should not have to allocate a megabyte of virtual memory to
1904         handle a format argument like +%1048575T.  When implemented with
1905         strftime, it must allocate such a buffer, use strftime to fill it
1906         in, print it, then free it.
1907         With fprintftime, it simply prints everything and exits.
1908         With no need for memory allocation, that's one fewer way to fail.
1909
1910         * fprintftime.c, fprintftime.h: New files.
1911         * Makefile.am (libcoreutils_a_SOURCES):
1912         Add fprintftime.c and fprintftime.h.
1913
1914 2005-09-15  Paul Eggert  <eggert@cs.ucla.edu>
1915
1916         * strftime.c (my_strftime): Rewrite the previous change slightly,
1917         to make it a bit faster and (I hope) clearer.
1918
1919 2005-09-14  Jim Meyering  <jim@meyering.net>
1920
1921         * strftime.c (my_strftime): Parse the colons of %:::z *after* the
1922         optional field width, not before, so we accept %9:z, not %:9z.
1923         (my_strftime): Be sure to use L_('x') for literals.
1924
1925 2005-09-13  Paul Eggert  <eggert@cs.ucla.edu>
1926
1927         Merge md5 from libc, and clean up some sha1 glitches.
1928         * md5.h (__GNUC_PREREQ, __THROW, __attribute__): New macros.
1929         (__md5_buffer): Renamed from md5_buffer.  Add a macro undoing this
1930         if _LIBC is not defined.  Add __THROW.
1931         (__md5_finish_ctx, __md5_init_ctx, __md5_process_block):
1932         (__md5_process_bytes, __md5_read_ctx, __md5_stream): Likewise.
1933         (struct md5_ctx): Mark buffer as being aligned.
1934         (rol): Remove; all uses changed to CYCLIC.
1935         * md5.c (CYCLIC): New macro.  All uses of rol changed to use CYCLIC.
1936         Redo comment to minimize changes from libc.
1937         * sha1.h (struct sha1_ctx): Mark buffer as being aligned.
1938         * sha1.c (SWAP): Renamed from NOTSWAP, to avoid a horrible misnaming.
1939         All uses changed.  Remove the old SWAP.
1940         Remove obvious comment about BLOCKSIZE.
1941         (rol): New macro, moved here from md5.h.
1942         (sha1_process_block): Remove an incoherent FIXME comment.
1943
1944         * strftime.c (my_strftime): Add support for %:z, %::z, %:::z.
1945         Fix bug in formats like %2N.
1946
1947 2005-09-13  Jim Meyering  <jim@meyering.net>
1948
1949         * xalloc.h: Revert unintended change that removed definitions
1950         of X2REALLOC and X2NREALLOC.
1951
1952         * backupfile.c: Use ARGMATCH_VERIFY, just in case.
1953
1954 2005-09-09  Paul Eggert  <eggert@cs.ucla.edu>
1955
1956         * regcomp.c, regex.c, regex.h, regex_internal.c, regex_internal.h:
1957         * regexec.c: Import from gnulib, to fix some 64-bit bugs.
1958
1959 2005-09-06  Paul Eggert  <eggert@cs.ucla.edu>
1960
1961         * verify.h (__builtin_constant_p): Remove, undoing previous change.
1962         (verify_type__): Solve the problem by using a bit-field rather
1963         than an array.
1964
1965 2005-09-05  Jim Meyering  <jim@meyering.net>
1966
1967         * verify.h (__builtin_constant_p) [__GNUC__ <= 2]: Define to 1.
1968         (verify_type__) [verify_error_if_non_const__]: New member/test,
1969         to help detect when verify or verify_expr is mistakenly passed
1970         a non-constant argument within a function.
1971
1972 2005-08-31  Jim Meyering  <jim@meyering.net>
1973
1974         * quotearg.c (quotearg_n_options): Change code to be suboptimal, in
1975         order to avoid an unsuppressible warning from gcc on 64-bit systems.
1976
1977         * localcharset.c (get_charset_aliases): Add `void' in parameter list
1978         to placate gcc's -Wstrict-prototypes.
1979
1980 2005-08-27  Jim Meyering  <jim@meyering.net>
1981
1982         * md5.c: Use `#error' rather than a string literal to provoke failure.
1983         * sha1.c: Likewise.
1984
1985 2005-08-25  Jim Meyering  <jim@meyering.net>
1986
1987         * open-safer.c: Include <config.h>.
1988         Otherwise, we'd lose LARGEFILE support in any file using
1989         e.g. "fcntl--.h"
1990
1991 2005-08-24  Jim Meyering  <jim@meyering.net>
1992
1993         * stdopen.c (stdopen): Revert to iterating over descriptors, but
1994         rather than using fstat, use fcntl with its F_GETFD flag, which
1995         is more efficient.  Unlike the 2-syscall dup-close approach,
1996         this one doesn't apply any unnecessary pressure on the file
1997         descriptor pool -- thus there is one fewer way to fail.
1998
1999 2005-08-23  Jim Meyering  <jim@meyering.net>
2000
2001         * regcomp.c, regex.c, regex.h, regex_internal.c: Update from gnulib.
2002         * regex_internal.h, regexec.c: Likewise.
2003
2004 2005-08-19  Jim Meyering  <jim@meyering.net>
2005
2006         * stdopen.c (stdopen): Return `bool' so caller can detect failure.
2007
2008 2005-08-17  Jim Meyering  <jim@meyering.net>
2009
2010         Make the %s format (seconds since the epoch) work for a negative
2011         number and when used with a zero-padded field width, e.g. %015s.
2012
2013         * strftime.c (my_strftime): Move the `do_number_sign_and_padding'
2014         label so that it precedes the code to set `digits'.  Otherwise,
2015         %0Ns wouldn't work.  Before this change, `date -d @-22 +%05s' would
2016         print `00-22'.  Now, it prints `-0022', as it should.
2017
2018 2005-08-15  Bruno Haible  <bruno@clisp.org>
2019
2020         Import from gnulib.
2021         * regex.h (__restrict_arr): Don't define to __restrict if __cplusplus
2022         is defined.
2023
2024 2005-08-13  Jim Meyering  <jim@meyering.net>
2025
2026         * getdate.y (get_date): Undo part of the 2005-04-04 change, so that
2027         the command "date -d'2005-03-27 +1 day'" succeeds once again, even
2028         when run in a time zone for which daylight savings time is in effect
2029         for the starting date.
2030
2031 2005-08-12  Jim Meyering  <jim@meyering.net>
2032
2033         * regcomp.c (duplicate_node) [lint]: Set *new_idx to -1, to avoid
2034         warnings (unfounded) in caller that it may be used uninitialized.
2035
2036         * regex.c (IF_LINT): Define.
2037
2038         * regex_internal.c (re_string_realloc_buffers): Rename local-shadowed
2039         variable: s/new_array/offsets/.
2040         (re_acquire_state) [lint]: Set *err, to avoid warnings in caller.
2041
2042         * regexec.c (regexec, re_search_stub) [!_LIBC]: Omit declaration
2043         of unused local, dfa.
2044         (proceed_next_node): Remove outer declaration and
2045         unnecessary initialization of local-shadowed `dest_node'.
2046         Declare it in inner scopes, nearer its uses instead.
2047
2048         * regex.h (RE_SYNTAX_POSIX_AWK): Remove useless space-before-TAB.
2049
2050         * fts-cycle.c (setup_dir, enter_dir, leave_dir, free_dir):
2051         Use the hash-table-based cycle-detection code not just when
2052         FTS_TIGHT_CYCLE_CHECK if specified, but also with FTS_LOGICAL.
2053         Reported by James Youngman in
2054         <http://lists.gnu.org/archive/html/bug-gnulib/2005-08/msg00011.html>.
2055         * fts_.h: Mention that with FTS_LOGICAL, we use FTS_TIGHT_CYCLE_CHECK.
2056
2057         * fts.c (fts_cross_check) [FTS_DEBUG]: s/active_dir_ht/fts_cycle.ht/.
2058         This lets us compile with -DFTS_DEBUG, once again.
2059
2060 2005-08-02  Jim Meyering  <jim@meyering.net>
2061
2062         * xanstrftime.c, xanstrftime.h: New files.
2063
2064 2005-07-21  Paul Eggert  <eggert@cs.ucla.edu>
2065
2066         * getdate.y (relative_time): New type.
2067         (RELATIVE_TIME_0): New constant.
2068         (parser_control): Use relative_time instead of doing it ourselves.
2069         (%union): Add new relative_time rel member.
2070         (tYEAR_UNIT, tMONTH_UNIT, tHOUR_UNIT, tMINUTE_UNIT, tSEC_UNIT):
2071         Now typeless.
2072         (relunit, relunit_snumber): Now of type rel.
2073         (zone, rel, relunit, get_date): Adjust to above changes.
2074
2075 2005-07-12  Jim Meyering  <jim@meyering.net>
2076
2077         * xalloc.h (X2NREALLOC): Define.
2078
2079 2005-07-11  Paul Eggert  <eggert@cs.ucla.edu>
2080
2081         * verify.h (verify_expr): Use ((verify_type__ (R) *) 0), not
2082         sizeof (verify_type__ (R)), to pacify C++ compilers.  Problem
2083         reported by Bruno Haible.
2084
2085         * version-etc-fsf.c (version_etc_copyright): Parameterize the
2086         copyright symbol and the year.
2087         * version-etc.c (COPYRIGHT_YEAR): New constant.
2088         (version_etc_va): Use parameterized copyright notice.
2089         Reword to conform to the current GNU coding standards.
2090
2091 2005-07-08  Eric Blake  <ebb9@byu.net>  (tiny change)
2092
2093         * getloadavg.c (getloadavg) [__CYGWIN__]: Port to cygwin.
2094         [__linux__]: Allocate a big enough buffer for /proc/loadavg.
2095         [!LDAV_DONE]: Avoid unused variable warning.
2096
2097 2005-07-08  Eric Blake  <ebb9@byu.net>  (tiny change)
2098         and  Paul Eggert  <eggert@cs.ucla.edu>
2099
2100         * regcomp.c (init_dfa, build_range_exp): Store __btowc value
2101         in wint_t, not wchar_t.  Remove now-unnecessary cast.
2102
2103 2005-07-07  Paul Eggert  <eggert@cs.ucla.edu>
2104
2105         Switch to Isamu Hasegawa's implementation of regex, which is
2106         now in gnulib.
2107         * regcomp.c, regex_internal.c, regex_internal.h, regexec.c:
2108         New files, from gnulib.
2109         * regex.h, regex.c: Sync from gnulib.
2110         * Makefile.am (libcoreutils_a_SOURCES): Remove regex.h; gnulib
2111         now does this automatically for us.
2112         * .cppi-disable: Add regcomp.c, regex_internal.c, regex_internal.h.
2113
2114 2005-07-04  Paul Eggert  <eggert@cs.ucla.edu>
2115
2116         * verify.h (GL_CONCAT0, GL_CONCAT): Define unconditionally; don't
2117         depend on whether verify_decl is defined.
2118         (verify): Renamed from verify_decl.  All uses changed.
2119         Use an extern function decl, as it can't possibly collide with other
2120         decls.
2121         (verify_expr): Renamed from verify.  All uses changed.
2122         (verify_type__): New private macro.
2123         (verify, verify_expr): Use it.
2124
2125 2005-07-04  Jim Meyering  <jim@meyering.net>
2126
2127         * verify.h (verify, verify_decl): New file/macros.
2128         * Makefile.am (libcoreutils_a_SOURCES): Add verify.h here, temporarily.
2129         Eventually, it'll be pulled in via AC_LIBSOURCES.
2130
2131         * argmatch.h (verify_dcl): Rename from VERIFY.  Update use.
2132
2133 2005-07-03  Paul Eggert  <eggert@cs.ucla.edu>
2134
2135         Remove the dependency of the strftime module on the tzset module.
2136         * strftime.c (my_strftime) [! defined _LIBC && ! HAVE_RUN_TZSET_TEST]:
2137         Copy the input structure, to work around some of the bug with
2138         Solaris 2.5.1 and Solaris 2.6.
2139
2140 2005-07-03  Jim Meyering  <jim@meyering.net>
2141
2142         * posixtm.c (posixtime) [lint]: Initialize *all* of tm0, not just
2143         the .tm_year member, since otherwise gcc-4.0 would now warn about
2144         tm_zone, tm_gmtoff, tm_isdst, tm_yday, tm_wday.
2145
2146 2005-07-03  Paul Eggert  <eggert@cs.ucla.edu>
2147
2148         * Makefile.am (libcoreutils_a_SOURCES): Undo previous change.
2149
2150         * Makefile.am (libcoreutils_a_SOURCES): Add fcntl--.h, stdio--h,
2151         stdlib--.h, unistd--.h.
2152         * fts.c [! _LIBC]: Include "lstat.h" rather than rolling our own.
2153         * lstat.c: Sync from gnulib.
2154         * lstat.h: New file, from gnulib.
2155         * stat.c: Remove.
2156
2157 2005-07-03  Jim Meyering  <jim@meyering.net>
2158
2159         * fd-reopen.c: Include <unistd.h> for declaration of close.
2160
2161 2005-07-02  Paul Eggert  <eggert@cs.ucla.edu>
2162
2163         Cleanup to isolate "safer" functions to a small part of the code.
2164         * fcntl--.h, stdio--.h, stdlib--.h, unistd--.h, fcntl-safer.h:
2165         * open-safer.c, stdlib-safer.h, mkstemp-safer.c, fd-reopen.h:
2166         * fd-reopen.c: New files.
2167         * fopen-safer.c: Include stdio-safer.h first, to check interface.
2168         Don't bother including stdio.h, since stdio-safer.h does.
2169         * fts.c (fd_safer): Remove decl.
2170         Include fcntl--.h rather than unistd-safer.h
2171         (fts_safe_changedir): Don't call fd_safer; no longer needed
2172         now that we include fcntl--.h.
2173         * getloadavg.c: Include fcntl--.h rather than fcntl.h.
2174         Do not include unistd-safer.h.
2175         (getloadavg): Don't call fd_safer; no longer needed
2176         now that we include fcntl--.h.
2177         * getusershell.c: Include stdio--.h rather than stdio.h
2178         and stdio-safer.h.
2179         (getusershell): Call fopen, not fopen_safer.
2180         * save-cwd.c: Include fcntl--.h rather than fcntl.h.
2181         Do not include unistd-safer.h.
2182         (save_cwd): Don't call fd_safer; no longer needed
2183         now that we include fcntl--.h.
2184
2185 2005-07-02  Jim Meyering  <jim@meyering.net>
2186
2187         * getopt_.h: Assume HAVE_UNISTD_H, i.e., include <unistd.h>
2188         unconditionally.
2189
2190         * fnmatch.c: Update from gnulib.
2191
2192         * backupfile.c, canon-host.c, canonicalize.c, chown.c, cloexec.c:
2193         * dup-safer.c, dup2.c, euidaccess.c, fd-safer.c, fileblocks.c:
2194         * fopen-safer.c, fsusage.c, ftruncate.c, getcwd.c, getcwd.h:
2195         * getloadavg.c, getopt_.h, getpagesize.h, getugroups.c, group-member.c:
2196         * human.h, idcache.c, mkdir-p.c, mountlist.c, nanosleep.c, pathmax.h:
2197         * physmem.c, posixver.c, putenv.c, raise.c, safe-read.c, same.c:
2198         * save-cwd.c, setenv.c, settime.c, tempname.c, unlinkdir.c:
2199         * unsetenv.c, userspec.c, xgethostname.c, xreadlink.c:
2200         Assume HAVE_UNISTD_H, i.e., include <unistd.h> unconditionally.
2201
2202 2005-07-01  Jim Meyering  <jim@meyering.net>
2203
2204         * chown.c, cloexec.c, dup-safer.c, dup2.c, fsusage.c, getcwd.c:
2205         * getloadavg.c, mountlist.c, openat.h, save-cwd.c, tempname.c:
2206         Assume HAVE_FCNTL_H (i.e., include <fcntl.h> unconditionally,
2207         and don't include <sys/file.h>).
2208
2209 2005-07-01  Paul Eggert  <eggert@cs.ucla.edu>
2210
2211         * xnanosleep.c: Include timespec.h, since OpenBSD 3.4 <time.h>
2212         declares only 'struct timespec;' (!).
2213
2214 2005-06-30  Jim Meyering  <jim@meyering.net>
2215
2216         * stdopen.c: Add copyright.
2217         Include <fcntl.h> and <unistd.h> unconditionally --
2218         it seems to be ok to do this, these days.
2219
2220         * stdopen.c: Rewritten by Paul Eggert.
2221         Now, the minimum overhead is just two system calls: dup and close.
2222
2223         * stdopen.c: New file.  As yet unused.
2224         The minimum overhead is three fstat calls.
2225         * stdopen.h: New file.
2226
2227         * argmatch.h [!VERIFY] (VERIFY): Define.
2228         (ARGMATCH_VERIFY): Use it, so this macro may be used more than
2229         once in any given scope.
2230
2231         * xalloc.h (VERIFY_EXPR): Undef before defining, and add a comment.
2232
2233 2005-06-29  Jim Meyering  <jim@meyering.net>
2234
2235         * mkdir-p.c (make_dir_parents): Don't apply sizeof to a hard-coded
2236         type name.  Use the variable name instead.
2237         * idcache.c (getuser, getuidbyname, getgroup, getgidbyname): Likewise.
2238
2239         * xalloc.h (VERIFY_EXPR): Define.
2240         (X2REALLOC): New macro, to make using x2realloc a little safer.
2241
2242 2005-06-26  Jim Meyering  <jim@meyering.net>
2243
2244         * Makefile.am (libcoreutils_a_SOURCES): Remove diacrit.c and diacrit.h.
2245
2246 2005-06-25  Jim Meyering  <jim@meyering.net>
2247
2248         * Makefile.am (libcoreutils_a_SOURCES): Remove
2249         root-dev-ino.c and root-dev-ino.h.
2250         (libcoreutils_a_SOURCES): Remove dev-ino.h too, now that we
2251         get it via root-dev-ino.m4
2252         (libcoreutils_a_SOURCES): Remove version-etc.c version-etc.h
2253         and version-etc-fsf.c.
2254
2255 2005-06-24  Paul Eggert  <eggert@cs.ucla.edu>
2256
2257         * canon-host.c (canon_host) [HAVE_GETADDRINFO]: Use `= { 0, };' to
2258         initialize local `hint'.  This undoes the previous change, and
2259         syncs with gnulib.
2260
2261 2005-06-23  Jim Meyering  <jim@meyering.net>
2262
2263         * Makefile.am (libcoreutils_a_SOURCES): Remove xreadlink.c
2264         and xreadlink.h.
2265         (libcoreutils_a_SOURCES): Remove xstrtod.c and xstrtod.h.
2266
2267         * backupfile.c (backup_args): Change a `0' to NULL.
2268
2269 2005-06-22  Paul Eggert  <eggert@cs.ucla.edu>
2270
2271         * mktime.c: Include <string.h> even if !DEBUG.  (From glibc.)
2272         (ranged_convert): Don't save conversion in a temporary struct.
2273         This causes a warning with GCC 4.0.0, and anyway in the typical
2274         case it's not worth the extra 100 bytes or so of code.
2275         (ranged_convert, __mktime_internal): When calling a function via a
2276         pointer P, use P () rather than (*P) (), as we now assume C89 or better.
2277
2278         * readutmp.c (desirable_utmp_entry): Fix bug where "who -b" and
2279         "who -r" failed to give output.  Problem reported by Tim Waugh.
2280
2281 2005-06-22  Jim Meyering  <jim@meyering.net>
2282
2283         * xmalloc.c: Update from gnulib.
2284
2285 2005-06-19  Jim Meyering  <jim@meyering.net>
2286
2287         * Makefile.am (libcoreutils_a_SOURCES): Remove xgetcwd.c, xgetcwd.h,
2288         xfts.c and xfts.h.
2289
2290 2005-06-16  Jim Meyering  <jim@meyering.net>
2291
2292         * calloc.c (rpl_calloc): Allocate a 1-byte buffer (not 1xS or Nx1)
2293         when either N or S is zero.
2294
2295 2005-06-15  Jim Meyering  <jim@meyering.net>
2296
2297         * mkdir-p.c (make_dir_parents): Don't let a failed chdir($PWD)
2298         stop us from restricting permissions of just-created absolute-named
2299         directories.
2300
2301 2005-06-14  Paul Eggert  <eggert@cs.ucla.edu>
2302
2303         Improve quality of diagnostics on restore_cwd failure.
2304         * mkdir-p.h (make_dir): Remove.  All uses replaced by mkdir.
2305         (make_dir_parents): Last arg is now int * (for errno), not bool *.
2306         * mkdir-p.c (make_dir, make_dir_parents): Likewise.
2307         Rewrite "mkdir -p" algorithm to avoid the need for "stat"
2308         each time through the loop.  Do not diagnose restore_cwd failure;
2309         that is the caller's job (and perhaps the caller does not care).
2310
2311         * mkdir-p.c (CLEANUP_CWD, CLEANUP): Remove.
2312         (make_dir_parents): Revamp to avoid need for CLEANUP_CWD, CLEANUP.
2313         If the file already exists but is not a directory, don't bother
2314         to try to make its parents.
2315         Close potential file descriptor leak if we can't chdir("/") (!).
2316         Don't always return true if chdir($PWD) fails; return true only
2317         if the requested action was done successfully (except for the
2318         chdir($PWD)).
2319         Don't log final directory unless we actually made it.
2320         Refactor to avoid duplicate code to fix up permissions.
2321         Don't attempt to fix up parent permissions if chdir($PWD) fails.
2322
2323 2005-06-14  Jim Meyering  <jim@meyering.net>
2324
2325         * openat-die.c (openat_save_fail): Rename from openat_save_die.
2326         (openat_restore_fail): Rename from openat_restore_die.
2327         * openat.c, openat.h: Reflect s/_die/_fail/ renaming.
2328
2329         * mkdir-p.c (CLEANUP_CWD): Return *true*, not false when failing
2330         to restore initial working directory.
2331
2332         Provide an alternative to exiting immediately upon save_cwd or
2333         restore_cwd failure.  Now, an application can arrange e.g.,
2334         to perform a longjump in that case.
2335         * openat.c: Include dirname.h.
2336         Use IS_ABSOLUTE_FILE_NAME rather than testing for leading slash.
2337         (rpl_openat, fdopendir, fstatat): Call openat_save_die
2338         and openat_restore_die rather than calling error directly.
2339         Don't include "error.h" or "exitfail.h"; they're no longer needed.
2340
2341         * openat-die.c (openat_save_die, openat_restore_die): New file.
2342         * openat.h (openat_save_die, openat_restore_die): Declare and define.
2343
2344 2005-06-13  Jim Meyering  <jim@meyering.net>
2345
2346         * mkdir-p.c (make_dir_parents): New parameter: different_working_dir,
2347         to tell caller if/when we change the working directory and are
2348         unable to return to the initial one.
2349         * mkdir-p.h (make_dir_parents): Update prototype.
2350
2351 2005-06-12  Jim Meyering  <jim@meyering.net>
2352
2353         * mkdir-p.c (CLEANUP_CWD): Change one more `return 1' to
2354         `return false'.  This fixes a bug introduced on 2004-07-30.
2355
2356 2005-06-01  Paul Eggert  <eggert@cs.ucla.edu>
2357
2358         Use "file name" when talking about file names, instead of "filename"
2359         or "path", as per the GNU coding standards.
2360         * mkdir-p.c: Renamed from makepath.c.
2361         (make_dir_parents): Renamed from make_path.  All callers changed.
2362         * mkdir-p.h: Likewise.  All includers changed.
2363         * filenamecat.c: Renamed from path-concat.c.
2364         (file_name_concat): Renamed from path_concat.  All callers changed.
2365         [TEST_FILE_NAME_CONCAT]: Renamed from TEST_PATH_CONCAT.
2366         * filenamecat.h: Likewise.  All includers changed.
2367         * acl.c: Don't use "path" or "filename" to mean "file name"
2368         in comments or local variable names.
2369         * basename.c: Likewise.
2370         * canonicalize.c, canonicalize.h: Likewise.
2371         * dirname.c, dirname.h: Likewise.
2372         * euidaccess.c: Likewise.
2373         * exclude.c: Likewise
2374         * fnmatch_.h, fnmatch_loop.c: Likewise.
2375         * fsusage.c, fsuage.h: Likewise.
2376         * fts.c, fts_.h: Likewise.
2377         * getcwd.c: Likewise.
2378         * getloadavg.c: Likewise.
2379         * mkstemp.c: Likewise.
2380         * mountlist.c, mountlist.h: Likewise.
2381         * openat.c, openat.h: Likewise.
2382         * readlink-stub.c: Likewise.
2383         * readutmp.c, readutmp.h: Likewise.
2384         * rename.c: Likewise.
2385         * rmdir.c: Likewise.
2386         * same.c: Likewise.
2387         * savedir.c: Likewise.
2388         * stripslash.c: Likewise.
2389         * tempname.c: Likewise.
2390         * xreadlink.c: Likewise.
2391         * exclude.c (excluded_file_name): Renamed from excluded_filename.
2392         All uses changed.
2393         * exclude.h: Likewise.
2394
2395 2005-05-30  Paul Eggert  <eggert@cs.ucla.edu>
2396
2397         * euidaccess.c (getuid, getgid, getuid, getegid)
2398         [!defined _POSIX_VERSION]: Remove decls; not needed these days.
2399         * idcache.c (getpwuid, getpwnam, getgrgid, getgrnam)
2400         [!defined _POSIX_VERSION]: Remove decls; not needed these days.
2401         * pathmax.h: Include <limits.h> unconditionally, since other
2402         files have been getting away with it for years (MORE/BSD 4.3
2403         is extinct now).
2404         * userspec.c (getpwnam, getgrnam, getgrgid)
2405         [!defined _POSIX_VERSION]: Remove decls; not needed these days.
2406
2407 2005-05-29  Paul Eggert  <eggert@cs.ucla.edu>
2408
2409         * pathmax.h (_POSIX_PATH_MAX) [!defined _POSIX_PATH_MAX]:
2410         Define to 256, not 255, as per modern POSIX.
2411
2412 2005-05-27  Paul Eggert  <eggert@cs.ucla.edu>
2413
2414         * fts.c: Don't worry about debugging on pre-C99-comopatible hosts;
2415         the configuration hassle isn't worth it.
2416         Include inttypes.h and stdint.h unconditionally if FTS_DEBUG.
2417         (LONGEST_MODIFIER, PRIuMAX): Remove.
2418
2419         * strnumcmp.c, strnumcmp.h, strnumcmp-in.h, strintcmp.c:
2420         New files.
2421
2422 2005-05-22  Paul Eggert  <eggert@cs.ucla.edu>
2423
2424         * fts.c (fd_safer) [_LGPL_PACKAGE]: New static function,
2425         so that unistd-safer.h (GPL'ed code) need not be included.
2426
2427 2005-05-20  Paul Eggert  <eggert@cs.ucla.edu>
2428
2429         Split the fts code into GPL'ed and LGPL'ed parts, and fix some
2430         minor memory-allocation bugs.
2431
2432         * fts.c: Don't include "cycle-check.h" or "hash.h".
2433         (setup_dir, free_dir): New functions.
2434         (enter_dir, leave_dir): Define trivial
2435         alternatives of _LGPL_PACKAGE.  Move to fts-cycle.c if !_LGPL_PACKAGE.
2436         (HT_INITIAL_SIZE, ENTER_DIR): Remove.  All uses removed.
2437         (LEAVE_DIR): Fix typo: pass Fts and Ent to leave_dir.
2438         (struct Active_dir, AD_compare, AD_hash, enter_dir, leave_dir):
2439         Move to fts-cycle.c.
2440         (fts_open): Use setup_dir.
2441         (fts_close): Use free_dir.
2442         (fts_read): Have just one copy of the ENTER_DIR code rather than three.
2443         This adds a label and some gotos, but the alternatives were messier.
2444         Check for memory allocation failure when entering a dir.
2445         (fts_stat) [_LGPL_PACKAGE]: Bring back glibc cycle detection code.
2446         * fts_.h (_LGPL_PACKAGE) [defined _LIBC]: New macro.
2447         (FTS): New member fts_cycle, that is a union that contains the
2448         old active_dir_ht and cycle_state.  All uses changed to mention
2449         fts_cycle.ht and fts_cycle.state.
2450         * fts-cycle.c: New file, containing GPL'ed code migrated out of
2451         fts.c, with the following changes:
2452         (setup_dir, free_dir): New functions.
2453         (enter_dir): Now returns bool.  Return true if successful, false
2454         if memory exhausted.  All callers changed.
2455         Do not bother partly cleaning up on
2456         memory allocation failure; that is free_dir's job.
2457         However, free ad if hash_insert fails, to avoid memory leak.
2458         (enter_dir, leave_dir): Accommodate change to FTS by inspecting
2459         fts->fts_options to see which union member to use.
2460
2461 2005-05-20  Eric Blake  <ebb9@byu.net>  (tiny change)
2462
2463         * chown.c (rpl_chown): Return -1 on failure.
2464
2465 2005-05-20  Jim Meyering  <jim@meyering.net>
2466
2467         * fts.c (fts_open): Remove useless but otherwise harmless malloc call.
2468         Spotted by Paul Eggert.
2469
2470 2005-05-19  Jim Meyering  <jim@meyering.net>
2471
2472         * unlinkdir.h (cannot_unlink_dir) [UNLINK_CANNOT_UNLINK_DIR]:
2473         Use #define rather than a static function, to avoid a warning
2474         when the function was not used.
2475
2476 2005-05-18  Paul Eggert  <eggert@cs.ucla.edu>
2477
2478         * canonicalize.c: Include canonicalize.h first, to test interface.
2479         Include <stddef.h> unconditionally, since we assume C89 now.
2480         All uses of PTR_INT_TYPE replaced by ptrdiff_t.
2481         * fts.c: Include fts_.h first, to check interface.
2482         Do not include intprops.h; no longer needed.
2483         Include cycle-check.h and hash.h, since fts_.h no longer does.
2484         Remove unnecessary casts of closedir to void.
2485         (fts_build): Use a simpler method (not involving TYPE_SIGNED) to
2486         decide whether to decrement nlinks.
2487         * fts_.h: Do not include hash.h or cycle-check.h; no longer needed.
2488         (FTS): Use struct hash_table * instead of Hash_table, so that
2489         we no longer need to include hash.h here.
2490
2491 2005-05-14  Paul Eggert  <eggert@cs.ucla.edu>
2492
2493         * unlinkdir.c, unlinkdir.h: New files.
2494
2495 2005-05-14  Jim Meyering  <jim@meyering.net>
2496
2497         * unlocked-io.h, gethrxtime.c, gethrxtime.h, mountlist.h,
2498         * xtime.h, path-concat.c: Correct cpp indentation.
2499
2500 2005-05-14  Jim Meyering  <jim@meyering.net>
2501
2502         Update FSF postal mail address everywhere.
2503
2504 2005-05-09  Paul Eggert  <eggert@cs.ucla.edu>
2505
2506         * fts_.h (FTS): Use correct type for fts_compar member.
2507         (FTSENT): New member fts_fts.  Remove members fts_ino, fts_dev,
2508         fts_nlink; no longer needed now that fts_statp is always there.
2509         All uses changed to use fts_statp instead.
2510         * fts.c (__P): Remove.  All uses rewritten to assume C89 or better.
2511         (fts_open): Don't cast a function value in a possibly-unsafe way.
2512         (fts_compar): New function.
2513         (fts_sort): Use it.  But optimize the common case where all
2514         pointers smell the same.
2515
2516 2005-05-08  Paul Eggert  <eggert@cs.ucla.edu>
2517
2518         * yesno.c: Include getline.h, not ctype.h.
2519         (yesno): Don't remove leading white space; POSIX doesn't allow it.
2520         Use getline to remove arbitrary restriction on response length.
2521
2522 2005-05-05  Paul Eggert  <eggert@cs.ucla.edu>
2523
2524         * makepath.c (make_path): chdir to "//", not "/", if the file name
2525         starts with exactly two slashes.  This doesn't solve the problem
2526         in general but it's better than nothing.  Problem reported by
2527         Pierre A. Humblet via Eric Blake.
2528
2529 2005-05-01  Paul Eggert  <eggert@cs.ucla.edu>
2530
2531         * modechange.h (mode_free): Remove; all callers changed to invoke
2532         'free'.
2533         * modechange.c: Likewise.
2534         xstrtol.h, stdbool.h, stddef.h: Don't include; no longer needed.
2535         (MODE_DONE): New constant.
2536         (struct mode_change): Remove 'next' member.
2537         (make_node_op_equals): New function; like the old one of the
2538         same name, except it allocates an array.
2539         (mode_compile, mode_create_from_ref): Use it.
2540         (mode_compile): Allocate result as an array, not a linked list.
2541         Parse octal string ourself, so that we catch mistakes like "+0".
2542         (mode_adjust): Arg is an array, not a linked list.
2543
2544         * mbswidth.c, regex.c, strtol.c: Sync from gnulib.
2545
2546 2005-04-28  Paul Eggert  <eggert@cs.ucla.edu>
2547
2548         * tempname.c (S_ISDIR, S_IRUSR, S_IRUSR, S_IWUSR, S_IXUSR): Remove.
2549         [!_LIBC] Include "stat-macros.h" instead.
2550
2551         * file-type.c: Include file-type.h first.
2552         * filetype.h: Don't assume <sys/stat.h> was included first.
2553
2554         * modechange.c: Include stat-macros.h, xalloc.h.
2555         (S_ISDIR, S_ISUID, S_ISGID, S_ISVTX, S_IRUSR, S_IWUSR, S_IXUSR):
2556         (S_IRGRP, S_IWGRP, S_IXGRP, S_IROTH, S_IWOTH, S_IXOTH, S_IRXWU):
2557         (S_IRWXG, S_IRWXO, CHMOD_MODE_BITS):
2558         Remove.  This is now stat-macros.h's job.
2559         (talloc): Remove.  All callers replaced by xalloc, so that
2560         our invokers don't have to worry about reporting memory failures.
2561         (make_node_op_equals): Remove.
2562         (MODE_ORDINARY_CHAGE, MODE_X_IF_ANY_X, MODE_COPY_EXISTING):
2563         New constants.
2564         (struct mode_change): Moved here from modechange.h.
2565         (mode_append_entry): Remove.
2566         (mode_compile): Remove MASKED_OPS arg, since it encouraged
2567         apps to have incorrect behavior.  Use simpler algorithm for head
2568         and tail.  Don't futz with umask; that's now the job of mode_adjust.
2569         Detect more invalid usages rather than having somewhat-random behavior.
2570         Don't insert an "a=" action, as that leads to incorrect behavior.
2571         (mode_compile, mode_create_from_ref): Return NULL on error instead
2572         of an enum, since now there's only one way to have an error.  All
2573         callers changed.
2574         (mode_adjust): Accept new arg UMASK_VALUE, and interpret it
2575         at the correct time.  Simplify calculation of "+u" and its ilk.
2576         Don't mishandle "+X".
2577         (mode_free): Remove "register" and localize decls.
2578         * modechange.h (MODE_X_IF_ANY_X, MODE_COPY_EXISTING):
2579         (struct mode_change): Move to modechange.c; callers don't
2580         need to see this stuff.
2581         (MODE_MASK_EQUALS, MODE_MASK_PLUS, MODE_MASK_MINUS, MODE_MASK_ALL):
2582         (MODE_INVALID, MODE_MEMORY_EXHAUSTED, MODE_BAD_REFERENCE): Remove.
2583         (mode_change, mode_adjust): Reflect the new signatures noted above.
2584
2585 2005-04-18  Paul Eggert  <eggert@cs.ucla.edu>
2586
2587         * Makefile.am (noinst_LIBRARIES): fetish -> coreutils.
2588         (libcoreutils_a_SOURCES): Renamed from libfetish_a_SOURCES.
2589         All uses changed.
2590         (libcoreutils_a_LIBADD): Renamed from libfetish_a_LIBADD.
2591         All uses changed.
2592         (libcoreutils_a_DEPENDENCIES): Renamed from libfetish_a_DEPENDENCIES.
2593         All uses changed.
2594         * chdir-long.c: fetish->coreutils in comment.
2595         * t-chdir-long: fetish->coreutils in compilation command.
2596
2597 2005-04-13  Paul Eggert  <eggert@cs.ucla.edu>
2598
2599         * getdate.y (zone): Allow relunit_snumber after tZONE, so
2600         that "UTC +1 second" continues to work.  Problem reported
2601         by Dmitry V. Levin.
2602         (relunit_snumber): New rule.
2603         (relunit): Use it.
2604
2605 2005-04-12  Paul Eggert  <eggert@cs.ucla.edu>
2606
2607         * getdate.y (universal_time_zone_table): New constant.
2608         (time_zone_table): Remove GMT, UT, UTC entries; they're now in
2609         universal_time_zone_table.
2610         (lookup_zone): Prefer universal_time_zone_table to
2611         local_time_zone_table, so that "GMT" time stamps are allowed in
2612         London during the summer.  Problem reported by Ian Abbott.
2613
2614 2005-04-11  Paul Eggert  <eggert@cs.ucla.edu>
2615
2616         Add bulletproofing for cases where stdin, stdout, or stderr are closed.
2617         * fcntl-safer.h, open-safer.c: Remove.
2618         * fd-safer.c: New file.
2619         * dup-safer.c: Include unistd-safer.h first, to test interface.
2620         (dup_safer) [!deefined F_DUPD]: Use new fd_safer function instead of
2621         rolling our own code.
2622         * fts.c: Include unistd-safer.h.
2623         (fts_safe_changedir): Use fd_safer.
2624         * getloadavg.c: Include unistd-safer.h.
2625         (getloadavg): Use fd_safer.
2626         * getusershell.c: Include stdio-safer.h.
2627         (getusershell): Use fopen_safer.
2628         * save-cwd.c: Include unistd-safer.h.
2629         (save_cwd): Use fd_safer.
2630         * unistd-safer.h (fd_safer): New decl.
2631         * Makefile.am (libfetish_a_SOURCES): Remove dup-safer.c,
2632         fcntl-safer.h, fopen-safer.c, open-safer.c, stdio-safer.h,
2633         unistd-safer.h.
2634
2635 2005-04-09  Jim Meyering  <jim@meyering.net>
2636
2637         * fts.c (__attribute__, ATTRIBUTE_UNUSED): Define.
2638         Mark parameter `sp' with ATTRIBUTE_UNUSED.
2639
2640         Avoid warnings from gcc-4.
2641         * canon-host.c (canon_host) [HAVE_GETADDRINFO]: Use memset
2642         rather than `= { 0 };' to initialize local `hint'.
2643         * unicodeio.c (__attribute__, ATTRIBUTE_UNUSED): Define.
2644         (exit_failure_callback, fallback_failure_callback): Mark unused
2645         parameters with ATTRIBUTE_UNUSED.
2646
2647         * posixtm.c (posixtime) [lint]: Avoid spurious warning from gcc-4's
2648         -Wuninitialized: initialize tm0.tm_year.
2649
2650         * human.c (humblock): Set *options even when returning due to
2651         xstrtoumax conversion failure.  Thanks to a used-uninitialized
2652         warning from gcc-4.
2653
2654 2005-04-08  Paul Eggert  <eggert@cs.ucla.edu>
2655
2656         * nanosleep.c (rpl_nanosleep): Include "timespec.h" before macros
2657         that might redefine system include files.
2658         (siginterrupt) [!HAVE_SIGINTERRUPT]: New macro.
2659         (my_usleep): Use NULL rather than (void *) 0.
2660         (rpl_nanosleep) [!defined SA_NOCLDSTOP]:
2661         Use siginterrupt to specify that system calls should be interrupted.
2662         (rpl_nanosleep): Move initialization of suspended closer to call of
2663         my_usleep.
2664
2665 2005-04-04  Paul Eggert  <eggert@cs.ucla.edu>
2666
2667         * getdate.y (parser_control): rels_seen is now a boolean, not a
2668         count, since there's no maximum.  All uses changed.
2669         Add member dsts_seen.
2670         (local_zone): Accumulate dsts_seen rather than relying on tm_isdst
2671         not being INT_MAX.
2672         (get_date): Initialize dsts_seen, and check that it doesn't go over 1.
2673         Use pc_rels_seen to decide whther a date is absolute.
2674
2675         * getdate.y (number): Don't overwrite year.
2676         (get_date): Initialize pc.year.digits to 0, not 4, to enable above
2677         check.
2678
2679 2005-03-30  Paul Eggert  <eggert@cs.ucla.edu>
2680
2681         * readutmp.h (read_utmp): New arg OPTIONS.  All uses changed.
2682         * readutmp.c: Likewise.  Include signal.h, stdbool.h.
2683         (desirable_utmp_entry): New function.
2684         (read_utmp) [defined UTMP_NAME_FUNCTION]: Redo memory allocation
2685         using x2nrealloc, to simplify logic.
2686         (read_utmp) [!defined UTMP_NAME_FUNCTION]: Check for overflow in
2687         size calculation.  Do not assume utmp file is a regular file.
2688         * readutmp.h (UT_PID): Moved here from ../src/who.c.
2689         (READ_UTMP_CHECK_PIDS): New constant.
2690
2691 2005-03-29  Jim Meyering  <jim@meyering.net>
2692
2693         * long-options.c (long_options): Use NULL, not `0'.
2694
2695 2005-03-27  Jim Meyering  <jim@meyering.net>
2696
2697         * argmatch.c: Clarify comment: null-terminated -> NULL-terminated.
2698
2699 2005-03-26  Paul Eggert  <eggert@cs.ucla.edu>
2700
2701         * intprops.h (INT_STRLEN_BOUND, INT_BUFSIZE_BOUND):
2702         "one's complement" -> "ones' complement" in comment, as per Knuth.
2703         "value of type" -> "type or expression" in comment.
2704         * mktime.c, strftime.c: Propagate intprops.h comment nits.
2705
2706 2005-03-26  Jim Meyering  <jim@meyering.net>
2707
2708         Comment nits.
2709         * intprops.h: Add the apostrophe in `(one|two)'s complement'.
2710         Correct typos: s/or/of/.
2711
2712 2005-03-23  Jim Meyering  <jim@meyering.net>
2713
2714         * canonicalize.c: Remove duplicate `#include "stat-macros.h"'.
2715
2716 2005-03-21  Paul Eggert  <eggert@cs.ucla.edu>
2717
2718         * Makefile.am (libfetish_a_SOURCES): Remove stat-macros.h, xstrtoul.c,
2719         as they are now done by Autoconf macros.
2720
2721 2005-03-20  Paul Eggert  <eggert@cs.ucla.edu>
2722
2723         * gettext.h, regex.c, setenv.c, vasprintf.c: Sync from gnulib.
2724         * vasnprintf.c (EOVERFLOW): Define if not already defined.
2725         This merges a change from gnulib.
2726
2727 2005-03-18  Paul Eggert  <eggert@cs.ucla.edu>
2728
2729         * strftime.c (my_strftime): If the underlying strftime returns 0
2730         (which shouldn't happen), generate nothing instead of returning 0
2731         immediately, so that nstrftime (NULL, ...) doesn't return 0.
2732
2733 2005-03-15  Paul Eggert  <eggert@cs.ucla.edu>
2734
2735         * strftime.c (my_strftime): Prepend space to format so that we can
2736         reliably distinguish strftime failure from empty output on POSIX
2737         hosts.
2738
2739 2005-03-14  Paul Eggert  <eggert@cs.ucla.edu>
2740
2741         * mktime.c (TYPE_TWOS_COMPLEMENT, TYPE_ONES_COMPLEMENT,
2742         TYPE_SIGNED_MAGNITUDE, TYPE_MINIMUM, TYPE_MAXIMUM): Sync from
2743         intprops.h.
2744         * strtol.c: Likewise.
2745
2746 2005-03-14  Jim Meyering  <jim@meyering.net>
2747
2748         * strftime.c (my_strftime) [HAVE_STRFTIME && ! (_NL_CURRENT
2749         && HAVE_STRUCT_ERA_ENTRY)]: Initialize the first byte of ubuf[]
2750         to be nonzero so that we (and caller) can detect the difference
2751         between a valid zero-length expansion and an error return, even
2752         when the underlying strftime fails before writing anything into
2753         that location.
2754
2755 2005-03-11  Jim Meyering  <jim@meyering.net>
2756
2757         * getdate.c: Regenerate using bison-2.0.
2758
2759 2005-03-10  Jim Meyering  <jim@meyering.net>
2760
2761         * save-cwd.c [!HAVE_FCHDIR]: Define open, fchdir, and chdir_long
2762         so that this module works on systems without fchdir.
2763
2764         * Makefile.am (libfetish_a_SOURCES): Remove xstrtol.c and xstrtol.h.
2765
2766 2005-03-09  Paul Eggert  <eggert@cs.ucla.edu>
2767
2768         Factor int-properties macros into a single file, except for
2769         glibc-related files.
2770         * intprops.h: New file.
2771         * getloadavg.c: Include it instead of limits.h.
2772         (INT_STRLEN_BOUND): Remove.
2773         * human.c: Include intprops.h.
2774         (group_number): Use INT_STRLEN_BOUND instead of rolling it ourself.
2775         * human.h (LONGEST_HUMAN_READABLE): Use 146/485 rather than 302/1000.
2776         * inttostr.h: Include intprops.h instead of limits.h.
2777         (INT_STRLEN_BOUND, INT_BUFSIZE_BOUND): Remove.
2778         * mktime.c (TYPE_IS_INTEGER, TYPE_TWOS_COMPLEMENT): New macros,
2779         for consistency with intprops.h.
2780         (time_t_is_integer, twos_complement_arithmetic): Use them.
2781         * sig2str.h: Include <signal.h>, intprops.h.
2782         (INT_STRLEN_BOUND): Remove.
2783         * strftime.c (TYPE_SIGNED): Remove.
2784         (INT_STRLEN_BOUND): Switch to same implementation as intprops.h.
2785         * strtol.c: Adjust comments to match intprops.h.
2786         * userspec.c: Include intprops.h.
2787         (TYPE_SIGNED, TYPE_MINIMUM, TYPE_MAXIMUM): Remove.
2788         * utimecmp.c, xnanosleep.c, xstrtol.c: Likewise.
2789         * utimecmp.c (utimecmp): Use TYPE_IS_INTEGER, TYPE_TWOS_COMPLEMENT
2790         instead of rolling our own expressions.
2791         * xstrtol.c: Include xstrtol.h first, to test interface.
2792         * fts.c: Include intprops.h.
2793         (TYPE_SIGNED): Remove.
2794
2795 2005-03-09  Jim Meyering  <jim@meyering.net>
2796
2797         More migration to AC_LIBSOURCES/AC_LIBOBJ.
2798         * Makefile.am (libfetish_a_SOURCES): Remove two more pairs of files:
2799         cycle-check.c, cycle-check.h and argmatch.c, argmatch.h.
2800
2801         * cycle-check.c: Don't include "xalloc.h".  It's not used.
2802
2803 2005-03-01  Paul Eggert  <eggert@cs.ucla.edu>
2804
2805         Remove workaround for bug in Linux kernel 2.6.8 or thereabouts.
2806         The workaround isn't strictly needed for POSIX conformance, and
2807         it's too much of a pain to configure and maintain.  We'll ask
2808         people to fix their kernels instead.
2809         * xnanosleep.c: Don't include gethrxtime.h or xtime.h.
2810         (NANOSLEEP_BUG_WORKAROUND): Remove.
2811         (xnanosleep): Remove the workaround.
2812
2813 2005-02-27  Jim Meyering  <jim@meyering.net>
2814
2815         * xnanosleep.c (xnanosleep): Work around bug in Linux-2.6.8.1's
2816         nanosleep whereby it fails without setting errno upon being resumed
2817         after being suspended.
2818
2819 2005-02-25  Paul Eggert  <eggert@cs.ucla.edu>
2820
2821         * vasnprintf.c (VASNPRINTF) [!USE_SNPRINTF]: Correct the test for
2822         integer overflow again.  Actually, neither this nor the 2005-01-23
2823         change fixes any bug on any plausible platform; it's more of a
2824         code-clarity thing.
2825
2826         * config.charset, gettext.h, localcharset.c: Sync from gnulib.
2827
2828 2005-02-23  Paul Eggert  <eggert@cs.ucla.edu>
2829
2830         * strftime.c: Include <stdbool.h>.  Use bool where appropriate,
2831         instead of int.
2832         (my_strftime): Do not mishandle years close to INT_MAX, by doing
2833         the right thing even if adding 1900 would overflow.  Similarly
2834         for tm_mon + 1 and tm_yday + 1.
2835         Make %Y always equivalent to %C%y, and similarly for %G and %g.
2836         (DO_NUMBER, DO_NUMBER_SPACEPAD): Set digits to d, not a conditional.
2837         (DO_SIGNED_NUMBER): New macro.
2838         (my_strftime) [HAVE_TZNAME]: Don't dump core if tp->tm_dst > 1.
2839
2840 2005-02-21  Paul Eggert  <eggert@cs.ucla.edu>
2841
2842         * Makefile.am (libfetish_a_SOURCES): Remove xnanosleep.c,
2843         xnanosleep.h; now done by ../m4/xnanosleep.m4 automatically.
2844
2845 2005-02-20  Paul Eggert  <eggert@cs.ucla.edu>
2846
2847         * gethrxtime.h, gethrxtime.c, xtime.h: New files.
2848         * timespec.h (gettime): Return void, since it always
2849         succeeds now.  All uses changed.
2850         * gettime.c (gettime) Likewise.
2851         [HAVE_NANOTIME]: Prefer nanotime.
2852         Assume gettimeofday succeeds, as POSIX requires.
2853         Assime time () succeeds, since other code already does.
2854         * xnanosleep.c: Include xtime.h and gethrxtime.h, not xalloc.h.
2855         (timespec_subtract): Remove.
2856         (NANOSLEEP_BUG_WORKAROUND): New constant.
2857         (xnanosleep): Use gethrxtime rather than gettime; this simplifies
2858         things considerably.  Use it only on GNU/Linux hosts, since the
2859         workaround shouldn't be needed elsewhere.
2860
2861 2005-02-20  Neil Conway  <neilc@samurai.com>
2862
2863         * xgethostname.c (xgethostname): Check for ENOMEM, which is
2864         returned by OSX/Darwin if the specified buffer is not large
2865         enough for the hostname.
2866
2867 2005-02-20  Jim Meyering  <jim@meyering.net>
2868
2869         More of the same.
2870         * Makefile.am (libfetish_a_SOURCES): Remove
2871         linebuffer.[ch] and stripslash.c.
2872
2873 2005-02-11  Jim Meyering  <jim@meyering.net>
2874
2875         Remove names of files that are now mentioned in AC_LIBSOURCES
2876         and AC_LIBOBJ uses in inttostr.m4.
2877         * Makefile.am (libfetish_a_SOURCES): Remove imaxtostr.c,
2878         offtostr.c, and umaxtostr.c.
2879         (EXTRA_DIST): Remove inttostr.c and inttostr.h.
2880
2881 2005-02-08  Jim Meyering  <jim@meyering.net>
2882
2883         * Makefile.am (libfetish_a_SOURCES): Remove memcasecmp.c
2884         and memcasecmp.h.
2885
2886 2005-02-07  Jim Meyering  <jim@meyering.net>
2887
2888         * Makefile.am (libfetish_a_SOURCES): Remove fts.c, fts_.h, and
2889         getcwd.h now that they're mentioned in AC_LIBSOURCES and AC_LIBOBJ
2890         uses in the corresponding ../m4/*.m4.
2891
2892 2005-02-03  Paul Eggert  <eggert@cs.ucla.edu>
2893
2894         * memrchr.h: New file.
2895         * chdir-long.c: Include it.
2896         * memrchr.c [!defined _LIBC]: Include it rather than <string.h>.
2897         Don't bother including stddef.h.
2898
2899 2005-02-01  Paul Eggert  <eggert@cs.ucla.edu>
2900
2901         * mountlist.h (MOUNTLIST_H_): New macro, to protect against double
2902         inclusion.
2903         Include <sys/types.h>, for dev_t.
2904         (ME_DUMMY, ME_REMOTE): Move from here....
2905         * mountlist.c (ME_DUMMY, ME_REMOTE): To here.
2906         (ME_DUMMY): Count "subfs" as a dummy.  Problem reported by
2907         Dmitry V. Levin.
2908         Include mountlist.h first, to test the interface.
2909
2910 2005-01-29  Jim Meyering  <jim@meyering.net>
2911
2912         * Makefile.am (libfetish_a_SOURCES): Remove many files from this
2913         list, now that automake determines their names automatically,
2914         thanks to the new AC_LIBSOURCES and AC_LIBOBJ uses in the
2915         corresponding ../m4/*.m4 files.
2916         (EXTRA_DIST): Add getdate.c here, so that we continue to distribute it.
2917
2918 2005-01-25  Jim Meyering  <jim@meyering.net>
2919
2920         * path-concat.c: Don't include assert.h.
2921         (path_concat): Remove assertion that would have triggered
2922         for ABASE starting with more than one slash.
2923         Reported by Andreas Schwab.
2924
2925         * path-concat.c (path_concat): Set *BASE_IN_RESULT
2926         properly when ABASE is an absolute file name.
2927         Correct the description of this function.
2928         Include <assert.h>.
2929         Add an assertion and a test driver.
2930         This fixes a bug introduced on 2004-07-02.
2931         Andreas Schwab reported the resulting failure of cp --parents:
2932         http://lists.gnu.org/archive/html/bug-coreutils/2005-01/msg00130.html
2933
2934 2005-01-23  Jim Meyering  <jim@meyering.net>
2935
2936         * vasnprintf.c (VASNPRINTF) [!USE_SNPRINTF]: Correct the test for
2937         integer overflow.
2938
2939 2005-01-21  Paul Eggert  <eggert@cs.ucla.edu>
2940
2941         Sync from gnulib.
2942         * error.c [!_LIBC && !ENABLE_NLS]: Do not include "gettext.h";
2943         not needed.  This removes a dependency on the gettext module.
2944         [defined _LIBC]: Do not include <libintl.h>; not needed.
2945
2946 2005-01-20  Paul Eggert  <eggert@cs.ucla.edu>
2947
2948         * save-cwd.c (save_cwd): Remove code to support the case
2949         where fchdir is missing or flaky.
2950
2951         * Makefile.am (libfetish_a_SOURCES): Add version-etc-fsf.c.
2952
2953 2005-01-20  Simon Josefsson  <jas@extundo.com>
2954
2955         * version-etc-fsf.c: New file, with version_etc_copyright.
2956         * version-etc.c: Remove version_etc_copyright.
2957         * version-etc.h (version_etc_copyright): Use [] instead of * in
2958         prototype, suggested by Paul Eggert.
2959
2960 2005-01-19  Jim Meyering  <jim@meyering.net>
2961
2962         * openat.h (AT_SYMLINK_NOFOLLOW): Define to 4096, so it's the
2963         same value as for Solaris 9.
2964
2965         * chdir-long.c (chdir_long): Rewrite to remove limitation on
2966         component length.  This included changing the parameter to be
2967         of type `char *' rather than `char const *'.
2968         * chdir-long.h (chdir_long): Update prototype.
2969         * t-chdir-long: A test harness to exercize chdir-long.c's
2970         sample main program.
2971
2972         * openat.c (fdopendir, fstatat): New functions.
2973         * openat.h: Include headers required for use of DIR and struct stat.
2974         [AT_SYMLINK_NOFOLLOW]: Define.
2975         (fdopendir, fstatat): Add prototypes.
2976
2977 2005-01-04  Paul Eggert  <eggert@cs.ucla.edu>
2978
2979         * human.c (SIZE_MAX, UINTMAX_MAX): Move these conditional
2980         definitions to be after all include files, to avoid collisions.
2981         Problem reported by Bob Proulx.
2982
2983 2005-01-04  Bob Proulx  <bob@proulx.com>
2984
2985         * obstack.c [DEFAULT_ALIGNMENT]: Use an intermediate type to simplify
2986         offsetof() macro construct to avoid compile failure with native HP-UX
2987         11.0 ANSI C compiler.
2988
2989 2005-01-03  Paul Eggert  <eggert@cs.ucla.edu>
2990
2991         * utimens.c (futimens): Robustify the previous patch, by checking
2992         for known valid error numbers rather than observed invalid ones.
2993
2994 2005-01-03  Jim Meyering  <jim@meyering.net>
2995
2996         * utimens.c (futimens): Account for the fact that futimes
2997         can also fail with errno == ENOSYS in that case.
2998         Patch from Dmitry V. Levin.
2999
3000 2005-01-03  Paul Eggert  <eggert@cs.ucla.edu>
3001
3002         * utimens.c (futimens) [HAVE_FUTIMES]: Fall back on utimes if
3003         futimes fails with errno == ENOENT.  Problem reported by
3004         Dmitry V. Levin.
3005
3006 2005-01-02  Jim Meyering  <jim@meyering.net>
3007
3008         * version-etc.c (version_etc_copyright): Update copyright date.
3009
3010 2004-12-31  Jim Meyering  <jim@meyering.net>
3011
3012         * openat.c (rpl_openat): Correct comment.
3013         Call free_cwd, to avoid leaking a file descriptor.
3014
3015 2004-12-23  Paul Eggert  <eggert@cs.ucla.edu>
3016
3017         * getdate.y (YYSTACK_USE_ALLOCA): Define to 0, since there's no
3018         need to extend the stack.
3019         (YYINITDEPTH): New macro, so that the initial stack isn't overly
3020         large.
3021
3022 2004-12-19  Paul Eggert  <eggert@cs.ucla.edu>
3023
3024         * c-strtod.c (STRTOD): Depend on HAVE_C99_STRTOLD, not
3025         HAVE_DECL_STRTOLD.
3026
3027         * alloca_.h: Conditionalize on _GNULIB_ALLOCA_H, not _ALLOCA_H.
3028         Remove now-obsolete comment about AIX.
3029         * getdate.y: Include <alloca.h> only if HAVE_ALLOCA.
3030         (YYSTACK_USE_ALLOCA): Define to 0 if !HAVE_ALLOCA.
3031         (YYMAXDEPTH): New macro.
3032
3033 2004-12-11  Jim Meyering  <jim@meyering.net>
3034
3035         * chdir-long.c: Fail via #error if PATH_MAX is not defined, since
3036         this file is now compiled only on systems that define PATH_MAX.
3037
3038 2004-12-08  Paul Eggert  <eggert@cs.ucla.edu>
3039
3040         * getdate.y (textint): New member "negative".
3041         (time_zone_hhmm): New function.
3042         Expect 14 shift-reduce conflicts, not 13.
3043         (o_colon_minutes): New rule.
3044         (time, zone): Use it to add support for +HH:MM, UTC+HH:MM.
3045         (yylex): Set the "negative" member of signed numbers.
3046
3047 2004-12-06  Jim Meyering  <jim@meyering.net>
3048
3049         * Makefile.am (libfetish_a_SOURCES): Begin removing .c and .h file
3050         names, as they are added to AC_LIBSOURCES directives in the
3051         corresponding m4/*.m4 files.
3052
3053 2004-12-05  Jim Meyering  <jim@meyering.net>
3054
3055         Currently, fpending.m4 punts (by defining PENDING_OUTPUT_N_BYTES
3056         to 1) if it doesn't find a valid expression for the replacement
3057         function.  Before this change, that might have gone undetected
3058         for some time.  Now, we'll catch it close to the source.
3059
3060         * t-fpending.c: New file.  Test the __fpending function.
3061         This ensures that if there is an error in the definition of the
3062         PENDING_OUTPUT_N_BYTES expression, we'll find about it right away;
3063         that value is used only in the rare event that close_stdout's
3064         fclose fails with EBADF.
3065         * Makefile.am (unit-test): New target.
3066         (check): Depend on it.
3067         (noinst_PROGRAMS): Define.
3068         (LDADD): Define.
3069         * Makefile.am (unit-test): Depend on t-fpending.
3070         Make the target .PHONY.
3071
3072 2004-12-02  Paul Eggert  <eggert@cs.ucla.edu>
3073
3074         * openat.c: Include "openat.h" before other include files.
3075         Include "exitfail.h".
3076         (openat): Remove #undef; no longer needed now that we include openat.h
3077         first.
3078         (rpl_openat): Add comment about mode_t promotion.  Simplify
3079         code a bit by moving initializations around.  Use exit_failure
3080         rather than EXIT_FAILURE.
3081         * openat.h: Add copyright and authorship notice.
3082         (AT_FDCWD): Use the same value Solaris 9 uses, except of type
3083         'int' not 'unsigned int'.
3084
3085         * save-cwd.c: Include "save-cwd.h" before other include files.
3086         (O_DIRECTORY): Remove; not needed here, since "." must be
3087         a directory.  All uses removed.
3088         (save_cwd): Use __sgi || __sun, not sun || __sun.  __sun is
3089         universal on Suns, and we also need to test for IRIX.
3090         Revamp code to use 'if' rather than '#if'.
3091         Avoid unnecessary comparison of cwd->desc to 0.
3092
3093 2004-12-01  Paul Eggert  <eggert@cs.ucla.edu>
3094
3095         * hard-locale.c: Assume <locale.h> exists.
3096         Include "strdup.h".
3097         (GLIBC_VERSION): New macro.
3098         (hard_locale): Assume setlocale exists.
3099         Rewrite to avoid #ifdef.
3100         Use strdup rather than malloc + strcpy.
3101         * human.c: Assume <locale.h> exists.
3102         (human_readable): Assume localeconv exists.
3103
3104 2004-11-30  Paul Eggert  <eggert@cs.ucla.edu>
3105
3106         * getcwd.c (is_ENAMETOOLONG): New macro.
3107         (__getcwd.c): Don't restore errno; glibc doesn't.
3108         [HAVE_PARTLY_WORKING_GETCWD && !defined AT_FDCWD]: Try system getcwd
3109         first, falling back to our code only if its results look suspicious.
3110         Ensure that the resulting buffer is only as large as necessary.
3111
3112         * readutmp.c: Include readutmp.h first.
3113         Include <errno.h>, since readutmp.h no longer does that.
3114         * readutmp.h: Don't include <errno.h>,
3115         <sys/param.h>, <time.h>; not needed to establish interface.
3116         (errno): Remove decl.
3117         (HAVE_STRUCT_XTMP_UT_TYPE): Remove; no longer needed.
3118         (UT_TYPE_EQ, UT_TYPE_NOT_DEFINED, UT_TYPE_BOOT_TIME,
3119         UT_TYPE_USER_PROCESS, IS_USER_PROCESS): New macros.
3120
3121 2004-11-30  Jim Meyering  <jim@meyering.net>
3122
3123         Change the name of the robust chdir function from chdir to chdir_long.
3124         * save-cwd.c: Include chdir-long.h rather than chdir.h.
3125         (restore_cwd): Use chdir_long, not chdir.
3126         * chdir-long.c: Renamed from chdir.c.
3127         * chdir-long.h: Renamed from chdir.h.
3128         [!defined PATH_MAX]: Define chdir_long to chdir on systems like the Hurd.
3129         * Makefile.am (libfetish_a_SOURCES): Reflect name changes.
3130
3131         * chdir.c (O_DIRECTORY): Define, if necessary.
3132         (memchrcspn): Tiny wrapper around memchr.
3133         (rpl_chdir): Use memchrcspn rather than strcspn.
3134
3135 2004-11-28  Jim Meyering  <jim@meyering.net>
3136
3137         * openat.c (rpl_openat): Also accept optional mode parameter.
3138         * openat.h (rpl_openat): Adjust prototype.
3139
3140         * save-cwd.c: Include "chdir.h", so that if save_cwd/getcwd
3141         saves a name longer than PATH_MAX, restore_cwd's chdir can use it.
3142
3143         * Makefile.am (libfetish_a_SOURCES): Add chdir.h and openat.h.
3144
3145         This is a robust version of chdir, in that it can handle directory
3146         names longer than PATH_MAX.
3147         * chdir.c, chdir.h: New file.
3148         * openat.c, openat.h: New files.
3149
3150 2004-11-25  Paul Eggert  <eggert@cs.ucla.edu>
3151
3152         Fix problems reported by Scott S. Tinsley for HP-UX 11.11 using
3153         HP's ANSI C compiler.
3154         * fsusage.c (statvfs) [HAVE_SYS_STATVFS_H]: Remove decl.
3155         Declaring int functions causes warnings on some modern systems and
3156         shouldn't be needed to compile on ancient ones.
3157         * same.c (MIN) [defined MIN]: Don't define, since it's already
3158         defined.
3159
3160         * mempcpy.c, mempcpy.h: New files, taken from gnulib.
3161         * Makefile.am: (libfetish_a_SOURCES): Add getcwd.h, mempcpy.h.
3162         * getcwd.c: Replace by a copy of glibc/sysdeps/posix/getcwd.c, but
3163         with the following changes.
3164         (__set_errno): Parenthesize properly.
3165         Include <stdbool.h>.
3166         (MIN, MAX, MATCHING_INO): New macros.
3167         (__getcwd): Define with prototype, not K&R form.
3168         Use heuristics to allocate default buffer on stack if possible.
3169         If AT_FDCWD is defined, use openat and fstatat to avoid O(N**2)
3170         behavior, and to avoid the PATH_MAX limit when computing
3171         ../../../../...
3172         Use MATCHING_INO to compare inode number to file.
3173         Check for arithmetic overflow in size calculations.
3174         Fix bug in reallocation of dot array that caused getcwd to fail
3175         on directories nested deeper than 75.
3176         Be more careful about saving errno on error.
3177         Do not use realloc; use only free+malloc, as this is a bit
3178         more flexible and avoids a needless copy operation.
3179         Do not inspect st_dev and st_ino for symbolic links; POSIX
3180         doesn't specify the latter.
3181         Check for closedir errors.
3182         Avoid needless casts.
3183         Use "#ifdef weak_alias" around weak_alias, to be like other
3184         glibc code.
3185         The following changes to getcwd.c have effect only when used in
3186         gnulib; they have no effect inside glibc proper.
3187         (#pragma alloca) [defined _AIX && !defined __GNUC__]: Remove,
3188         as alloca isn't used.
3189         (alloca, __alloca): Likewise.
3190         [!_LIBC]: Include "getcwd.h", "mempcpy.h".
3191         Include <stddef.h>, <stdlib.h>, <string.h>, <limits.h>
3192         unconditionally, as gnulib assumes C89 or better.
3193         Do not include <sys/param.h>.
3194         (errno) [!defined __GNU_LIBRARY__ && !defined STDC_HEADERS]: Remove
3195         no-longer-necessary 'extern int errno' decl; gnulib assumes C89 or
3196         better.
3197         (NULL) [!defined NULL]: Remove; we assume C89 or better.
3198         Include <dirent.h> in a way that is compatible with modern Autoconf.
3199         (_D_ALLOC_NAMELEN, _D_EXACT_NAMLEN):
3200         New macros, if not already defined.
3201         Include <unistd.h> if _LIBC, not if __GNU_LIBRARY__.
3202         Use "_LIBC", not "defined _LIBC", for consistency.
3203         (HAVE_MEMPCPY): Remove; no longer needed now that gnulib has
3204         a mempcpy module.
3205         (__lstat, __closedir, __opendir, __readdir) [!_LIBC]: New macros.
3206         (GETCWD_RETURN_TYPE): Remove.  All uses replaced by char *.
3207         * xgetcwd.c: David MacKenzie's old code was removed, so give
3208         credit only to Jim Meyering and adjust the copyright dates.
3209         Do not include <limits.h>, <stdio.h>, <sys/types.h>,
3210         <stdlib.h>, <unistd.h>, "pathmax.h".
3211         Instead, include "xgetcwd.h" (first) and "getcwd.h".
3212         (INITIAL_BUFFER_SIZE): Remove.
3213         (xgetcwd): Rely on getcwd, since we now depend on a reliable one.
3214
3215 2004-11-23  Paul Eggert  <eggert@cs.ucla.edu>
3216
3217         * utimens.c (__attribute__, ATTRIBUTE_UNUSED): New macros.
3218         (futimens): New function, which uses futimes if available.
3219         (futimens, utimens): Support timespec==NULL, with same semantics
3220         as utime and utimens.
3221         * utimens.h (futimens): New decl.
3222
3223 2004-11-23  Sergey Poznyakoff  <gray@Mirddin.farlep.net>
3224
3225         * getopt_.h: Re-addition of __getopt_argv_const caused
3226         redefinition warnings. To avoid them, include the defines
3227         in `#if !defined __need_getopt ... #endif'. The only place
3228         where __getopt_argv_const is used is in definitions
3229         of getopt_long and getopt_long_only below, which are as well
3230         protected by `#ifndef __need_getopt'.
3231         [defined __GETOPT_PREFIX && !defined __need_getopt]: Undef
3232         __need_getopt after including <stdio.h> and <unistd.h> These
3233         headers might have defined it.
3234
3235 2004-11-23  Jim Meyering  <jim@meyering.net>
3236
3237         * closeout.c: Revert last change, since it seems EBADF is always
3238         defined.
3239
3240 2004-11-22  Jim Meyering  <jim@meyering.net>
3241
3242         * closeout.c (EBADF): Fail with `#error ...' if it's not defined,
3243         asking the user to report the problem.
3244
3245 2004-11-17  Paul Eggert  <eggert@cs.ucla.edu>
3246
3247         * realloc.c (rpl_realloc): Call 'free' if n==0, since realloc
3248         might fail.  Problem reported by Yoann Vandoorselaere.
3249         * calloc.c (rpl_calloc): Defend against buggy calloc implementations
3250         that mishandle size_t overflow.
3251
3252 2004-11-16  Paul Eggert  <eggert@cs.ucla.edu>
3253
3254         * xgetcwd.c: Include <limits.h>, for PATH_MAX.
3255         (xgetcwd): Set errno correctly when failing.
3256         Work around Solaris 9 bug: getcwd sets errno==ERANGE even though
3257         the failure is actually due to a PATH_MAX problem.
3258
3259         Further getopt changes to make it more likely that glibc will
3260         buy the changes back.
3261         * getopt.c (POSIXLY_CORRECT): New constant.
3262         (getopt): Use it, so to preserve glibc semantic
3263         * getopt1.c (getopt_long, getopt_long_only): Arg is char * const *
3264         when compiling for libc.
3265         * getopt_.h (__getopt_argv_const): Bring it back.
3266         (getopt_long, getopt_long_only): Use it.
3267
3268         * getopt.c (_getopt_initialize, _getopt_internal_r, _getopt_internal):
3269         New arg POSIXLY_CORRECT.  All callers changed.
3270         (getopt): Argv is now char * const *, as per standard.
3271         (_getopt_internal_r, _getopt_internal): Argv is now char **,
3272         not char *__getopt_argv_const *.
3273         * getopt1.c (getopt_long, _getopt_long_r, getopt_long_only,
3274         _getopt_long_only_r): Likewise.
3275         * getopt_.h (getopt, getopt_long, geopt_long_only): Likewise.
3276         * getopt_int.h (_getopt_internal, _getopt_internal_r,
3277         _getopt_long_r, _getopt_long_only_r): Likewise.
3278         * getopt_.h (__getopt_argv_const): Remove.
3279         (getopt): Argv is now char * const *, as per standard.
3280
3281         * canon-host.c: Include "strdup.h".
3282         (canon_host): Use getaddrinfo if available, so that IPv6 works.
3283         Use strdup instead of malloc/strcpy to duplicate strings.
3284
3285         * getdate.y (tORDINAL): New token.
3286         (day, relunit): Allow it for relative times.
3287         (relative_time_table): Use tORDINAL for ordinals.
3288
3289 2004-11-15  Paul Eggert  <eggert@cs.ucla.edu>
3290
3291         * human.h (LONGEST_HUMAN_READABLE): Add 1 for space before unit.
3292         (human_space_before_unit): New constant.
3293         * human.c (human_readable): Support it.
3294
3295 2004-11-14  Jim Meyering  <jim@meyering.net>
3296
3297         * closeout.c (close_stdout): Don't fail just because stdout was
3298         closed initially, since some programs don't write to stdout in the
3299         normal course of operation (other than --version and --help), and
3300         we don't want this function to make e.g. `cp 1 2 >&-' fail.
3301         But do fail if it was closed and someone has tried to write to it.
3302         E.g., printf foo >&-
3303
3304         * __fpending.c, __fpending.h: Restore these files.
3305         They're useful after all.
3306         * Makefile.am (libfetish_a_SOURCES): Add __fpending.h.
3307
3308 2004-11-11  Paul Eggert  <eggert@cs.ucla.edu>
3309
3310         * getopt.c, getopt1.c, getopt_.h, getopt_int.h:
3311         Sync from gnulib.
3312
3313 2004-11-10  Paul Eggert  <eggert@cs.ucla.edu>
3314
3315         * allocsa.h, mbswidth.c, mktime.c, readlink.c, getdate.y,
3316         quotearg.c, strftime.c: Sync from gnulib.
3317
3318 2004-11-06  Jim Meyering  <jim@meyering.net>
3319
3320         * __fpending.c, __fpending.h: Remove files.
3321
3322         * Makefile.am (libfetish_a_SOURCES): Remove __fpending.h, now
3323         that it's no longer used.
3324
3325         Ensure that no close failure goes unreported.
3326         * closeout.c (close_stdout): Always close stdout.  I.e., don't
3327         return early when it seems there's nothing to flush.
3328         Don't include __fpending.h.
3329
3330 2004-11-03  Paul Eggert  <eggert@cs.ucla.edu>
3331
3332         * unsetenv.c: New file, from gnulib.  Needed for new getdate.y.
3333         * Makefile.am (libfetish_a_SOURCES): Remove setenv.c.
3334         * xreadlink.c: Sync from gnulib.
3335
3336 2004-11-03  Jim Meyering  <jim@meyering.net>
3337
3338         * Makefile.am (libfetish_a_SOURCES): Add setenv.c and setenv.h.
3339
3340 2004-11-02  Paul Eggert  <eggert@cs.ucla.edu>
3341
3342         * getdate.y, getpass.c, setenv.h: Sync from gnulib.
3343
3344 2004-10-29  Paul Eggert  <eggert@cs.ucla.edu>
3345
3346         * getdate.y, getpagesize.h, mktime.c: Sync from gnulib.
3347
3348 2004-10-24  Paul Eggert  <eggert@cs.ucla.edu>
3349
3350         * mktime.c (leapyear): Arg is long int, not int.
3351         Change imported from gnulib.
3352
3353 2004-10-17  Paul Eggert  <eggert@cs.ucla.edu>
3354
3355         Sync from gnulib.
3356         * diacrit.c, diacrit.h: Add copyright notice.
3357         * getpass.c (fflush_unlocked, flockfile, funlockfile)
3358         (fputs_unlocked, putc_unlocked) [!_LIBCS && !USE_UNLOCKED_IO]: Map
3359         to real functions.
3360
3361 2004-10-13  Jim Meyering  <jim@meyering.net>
3362
3363         * fts.c (fts_read): When about to fail (by returning NULL) due
3364         to a failed fchdir or failed fts_safe_changedir call, set
3365         `sp->fts_cur = p'.  Do this by removing the explicit `return NULL;'
3366         statements and setting p->fts_errno so execution falls through
3367         to the common-case code below.  Otherwise, after such a failure,
3368         calling fts_close would attempt to free an already-freed buffer.
3369         Reported by Luis Lopez Lopez in http://bugs.debian.org/276352.
3370
3371 2004-10-04  Paul Eggert  <eggert@cs.ucla.edu>
3372
3373         Sync from gnulib.
3374
3375         * xalloc.h (xmemdup): Renamed from xclone.
3376         * xmalloc.c (xmemdup): Likewise.
3377         * xalloc.h (CCLONE, CLONE, NEW, XCALLOC, XMALLOC, XREALLOC,
3378         XFREE): Remove these long-obsolescent macros.
3379         * xmalloc.c (xstrdup): Implementation moved here from xstrdup.c
3380         * xstrdup.c: Remove.
3381
3382         * argmatch.c, closeout.c, error.c, exclude.c, getdate.y,
3383         getndelim2.c, getpass.c, getusershell.c, linebuffer.c,
3384         md5.c, mountlist.c, posixtm.c, readtokens.c, readutmp.c,
3385         regex.c, sha1.c, version-etc.c, yesno.c:
3386         Include "unlocked-io.h" only if USE_UNLOCKED_IO.
3387         * unlocked-io.h: Don't worry about USE_UNLOCKED_IO; that's now
3388         the includer's responsibility.
3389
3390 2004-10-03  Paul Eggert  <eggert@cs.ucla.edu>
3391
3392         Sync from gnulib.
3393         * dirfd.h, getpagesize.h: Add copyright notice.
3394         * vasnprintf.c: (VASNPRINTF): Set errno=EOVERFLOW if the output is
3395         too long.
3396         * vasnprintf.h: Doc fix.
3397         * vasprintf.c: Don't include <limits.h>.
3398         (vasprintf): Rely on vasnprintf to set errno=EOVERFLOW.
3399
3400 2004-09-23  Paul Eggert  <eggert@cs.ucla.edu>
3401
3402         * modechange.c (mode_compile): Don't decrement a pointer that
3403         points to the start of a string, as the C Standard says the
3404         resulting behavior is undefined.
3405
3406 2004-09-22  Jim Meyering  <jim@meyering.net>
3407
3408         * getopt.c: Remove extraneous spaces before TAB.
3409         * getopt_.h: Likewise.
3410
3411         * backupfile.c: Remove trailing blanks.
3412         * euidaccess.c: Likewise.
3413
3414 2004-09-13  Paul Eggert  <eggert@cs.ucla.edu>
3415
3416         * backupfile.h (enum backuptype): Rename none -> no_backups,
3417         simple -> simple_backups, numbered_existing ->
3418         numbered_existing_backups, numbered -> numbered_backups
3419         to avoid shadowing problems.  All uses changed.
3420         * argmatch.c (enum backuptype): Likewise.
3421         * backupfile.c (check_extension, numbered_backup):
3422         Rename locals to avoid shadowing 'basename'.
3423         * backupfile.h (VALID_BACKUP_TYPE): Don't evaluate arg more than
3424         once.
3425
3426 2004-09-02  Paul Eggert  <eggert@cs.ucla.edu>
3427
3428         Port to diet libc.  Problem reported by Felix von Leitner in
3429         <http://lists.gnu.org/archive/html/bug-coreutils/2004-08/msg00171.html>
3430         * fts.c (fts_stat, fts_open, fts_read): Use "unsigned short int"
3431         rather than the unportable "u_short", and similarly for u_int.
3432         * fts_.h (FTSENT): Likewise.
3433
3434 2004-08-19  Paul Eggert  <eggert@cs.ucla.edu>
3435
3436         * getopt.c, getopt1.c: Sync from gnulib.
3437         * getopt_.h: Renamed from getopt.h (this syncs from gnulib).
3438         * Makefile.am (libfetish_a_SOURCES): Remove getopt.c, getopt.h,
3439         getopt1.c, getopt_int.h.
3440         (BUILT_SOURCES, EXTRA_DIST, all-local, $(lib_OBJECTS), getopt.h,
3441         MOSTLYCLEANFILES): Add current gnulib snippet for getopt.
3442         * .cppi-disable: Add getopt_.h, getopt_int.h.
3443         * .cvsignore: Add getopt.h.
3444
3445 2004-08-18  Paul Eggert  <eggert@cs.ucla.edu>
3446
3447         * userspec.c: Don't use <alloca.h>, so that we don't use alloca on
3448         strings on unbounded length.  alloca's performance benefits aren't
3449         that important here.
3450         (V_STRDUP): Remove.
3451         (parse_with_separator): New function, with most of the internals
3452         of the old parse_user_spec.  Allow user to omit both user and group,
3453         for compatibility with FreeBSD.
3454         Clone only the user name, not the entire spec.
3455         Do not set *uid, *gid unless entirely successful.
3456         Avoid memory leak in some failing cases.
3457         Fix regression for USER.GROUP reported by Dmitry V. Levin in
3458         <http://lists.gnu.org/archive/html/bug-coreutils/2004-08/msg00102.html>
3459         (parse_user_spec): Rewrite to use parse_with_separator.
3460
3461 2004-08-11  Paul Eggert  <eggert@cs.ucla.edu>
3462
3463         * fts.c (O_DIRECTORY): Define to 0 if the system doesn't define.
3464
3465         * settime.c (settime): Recode to avoid warning with Sun Forte C 6U2.
3466
3467         * obstack.c: Include <inttypes.h> and <stdint.h> if available.
3468         (union fooround): Use uintmax_t, not long int.
3469         The rest is a merge from libc:
3470         [defined _LIBC]: Include <shlib-compat.h>.
3471         (_obstack) [defined _LIBC]: Remove after 2.3.4.
3472
3473         * xgethostname.c: Do not include error.h.  (merge from gnulib).
3474
3475         * fnmatch.c (WIDE_CHAR_SUPPORT): Don't set to 1 if missing
3476         wmemchr or wmemcpy.  Problem reported by Robert Dahlem
3477         for Reliant Unix 5.43.
3478
3479 2004-08-09  Paul Eggert  <eggert@cs.ucla.edu>
3480
3481         * Makefile.am (libfetish_a_SOURCES): Add getpass.h.
3482         * getpass.h: New file.
3483         * .cpp-disable: Add it.
3484         * getpass.c [!_LIBC]: Include it.
3485
3486         * obstack.h (obstack_empty_p):
3487         Don't assume that chunk->contents is suitably aligned.
3488         * obstack.c (_obstack_begin, _obstack_begin_1, _obstack_newchunk):
3489         Likewise. Problem reported by Benno in
3490         <http://sources.redhat.com/ml/libc-alpha/2004-08/msg00055.html>.
3491
3492         * chown.c (rpl_chown): Work even if the file is writeable but not
3493         readable.  This could be improved further but it'd take some work.
3494         * fts.c (diropen): New function.
3495         (fts_open, fts_read, fts_children, fts_safe_changedir):
3496         Use it, so that the code works even if the directory
3497         is writeable but not readable.  We'd like it to work even if
3498         the directory is merely executable, but I don't know how to do
3499         that portably.
3500
3501         * xalloc-die.c: New file.
3502         * xalloc.h (xalloc_fail_func, xalloc_msg_memory_exhausted): Remove.
3503         All uses removed.
3504         * xmalloc.c (xalloc_fail_func, xalloc_msg_memory_exhausted): Likewise.
3505         Move inclusions of gettext.h, error.h, exitfail.h to xalloc-die.c.
3506         (_, N_, xalloc_die): Move to xalloc-die.c.
3507         * userspec.c (parse_user_spaec): Use xstrdup rather than strdup,
3508         so that we needn't mess with xalloc_msg_memory_exhausted.
3509
3510         * sha1.h (sha1_ctx): Renamed from sha_ctx.
3511         (sha1_init_ctx): Renamed from sha_init_ctx.
3512         (sha1_process_block): Renamed from sha_process_block.
3513         (sha1_process_bytes): Renamed from sha_process_bytes.
3514         (sha1_finish_ctx): Renamed from sha_finish_ctx.
3515         (sha1_read_ctx): Renamed from sha_read_ctx.
3516         (sha1_stream): Renamed from sha_stream.
3517         (sha1_buffer): Renamed from sha_buffer.
3518         * sha1.c: Likewise.
3519
3520 2004-08-07  Paul Eggert  <eggert@cs.ucla.edu>
3521
3522         * canonicalize.h, cycle-check.h, stat-macros.h, strdup.h,
3523         strftime.h, xnanosleep.c: Merge from gnulib.
3524
3525 2004-08-05  Paul Eggert  <eggert@cs.ucla.edu>
3526
3527         Merge with gnulib and deal with some minor cleanups resulting.
3528
3529         * .cppi-disable: Change fnmatch.h to fnmatch_.h.
3530         * .cvsignore: Add fnmatch.h, poll.h, stdbool.h, sysexit.h.
3531         Remove safe-lstat.c, safe-lstat.h, safe-stat.c, safe-stat.h.
3532
3533         * backupfile.h, closeout.h, full-write.h, mbswidth.h, xalloc.h:
3534         Add extern "C" wrappers for C++.
3535
3536         * dirname.h (IS_ABSOLUTE_FILE_NAME): Port to DOS.
3537
3538         * gettime.c (gettime): Fall back on `time' if `gettimeofday'
3539         doesn't work.
3540         * settime.c: Include <unistd.h>, for stime (on Solaris 8, anyway).
3541         (ENOSYS): Define if not defined.
3542         (settime): Fall back on stime if it exists and settimeofday fails.
3543         But don't bother with fallbacks if a method fails with errno == EPERM.
3544
3545         * obstack.h: Add white space.
3546
3547         * printf-parse.c, printf-parse.h, vasnprintf.c: Merge changes from
3548         gnulib, but rewrite to avoid "xsize.h".
3549
3550 2004-08-04  Paul Eggert  <eggert@cs.ucla.edu>
3551
3552         * mountlist.c (SIZE_MAX): Define after including files, to avoid
3553         a collision on OpenBSD 3.4.
3554
3555         * fts.c (LONGEST_MODIFIER): New macro.
3556         (PRIuMAX) [!PRI_MACROS_BROKEN && !defined PRIuMAX]: New macro.
3557         (find_matching_ancestor): Use it for dev_t and ino_t.
3558
3559         * getndelim2.c: Sync from gnulib.
3560
3561         * error.c: Work around bug in OpenBSD 3.4 sterror_r: it
3562         sometimes returns a positive errno value even when it succeeds.
3563         (print_errno_message) [!LIBC]: Fall back on strerror if
3564         __strerror_r fails.
3565
3566 2004-08-02  Paul Eggert  <eggert@cs.ucla.edu>
3567
3568         * canonicalize.c (errno): Remove decl; we now assume C89 or better.
3569         * chown.c (errno): Likewise.
3570         * closeout.c (errno): Likewise.
3571         * dup-safer.c (errno): Likewise.
3572         * dup2.c (errno): Likewise.
3573         * exclude.c (errno): Likewise.
3574         * fopen-safer.c (errno): Likewise.
3575         * ftruncate.c (errno): Likewise.
3576         * full-write.c (errno): Likewise.
3577         * getcwd.c (errno): Likewise.
3578         * lchown.c (errno): Likewise.
3579         * memcoll.c (errno): Likewise.
3580         * nanosleep.c (errno): Likewise.
3581         * putenv.c (errno): Likewise.
3582         * rmdir.c (errno): Likewise.
3583         * same.c (errno): Likewise.
3584         * savedir.c (errno): Likewise.
3585         * setenv.c (errno): Likewise.
3586         * stat.c (errno): Likewise.
3587         * utime.c (errno): Likewise.
3588         * xgetcwd.c (errno): Likewise.
3589         * xmemcoll.c (errno): Likewise.
3590         * xreadlink.c (errno): Likewise.
3591         * xstrtol.c (errno): Likewise.
3592         * canonicalize.h (enum canonicalize_mode_t): Reformat comments to
3593         fit in 80 columns.
3594         * fileblocks.c (textutils_fileblocks_unused): Make it a typedef
3595         instead of an int, to save a few bytes in the object file.
3596         * getdate.y (lookup_word): Rewrite to avoid cast.
3597         * getloadavg.c: Include <stdbool.h>.
3598         (getloadavg_initialized): Use bool for booleans.
3599         * hard-locale.c (hard_locale): Return bool, not int.
3600         * hard-locale.h (hard_locale): Likewise.  Include <stdbool.h>.
3601         * hash.c (hash_string): Rewrite to avoid cast.
3602         * human.h: Use Autoconf-suggested pattern for inttypes and stdint.
3603         * strtiomax.c: Likewise.
3604         * xstrtol.h: Likewise.
3605         * nanosleep.c: Include stdbool.h.
3606         (rpl_nanosleep): Usee bool for booleans.
3607         * quotearg.c: Include stdbool.h.
3608         (quotearg_buffer_restyled): Use bool for booleans.
3609         * readtokens.c (readtoken): Rewrite to avoid casts.
3610         * same.c (same_name): Return bool, not int.
3611         * same.h (same_name): Likewise.  Include <stdbool.h>.
3612         * version-etc.c (version_etc_va): Use size_t for sizes.
3613         * xnanosleep.c: Include limits.h, stdbool.h.
3614         (CHAR_BIT): Remove.
3615         (timespec_subtract, xnanosleep): Use bool for booleans.
3616         * xstrtoimax.c: Just include xstrtol.h rather than rolling our
3617         own include pattern.
3618         * xstrtoumax.c: Likewise.
3619         * xstrtol.c (__xstrtol): Rewrite to avoid casts.
3620         * yesno.c: Include yesno.h first.
3621         (yesno): Return bool, not int.
3622         * yesno.h (yesno): Likewise.  Include <stdbool.h>.
3623
3624         * xstrtod.h (xstrtod): Return bool, not int.  Invert the
3625         sense of the boolean.  All uses changed.
3626         * xstrtod.c (xstrtod): Likewise.
3627         * nanosleep.c: Include stdbool.h.  Use bool for booleans.
3628
3629         * xgethostname.c: Don't include <sys/types.h> or "exit.h";
3630         no longer needed.
3631         (errno): Remove decl; we now assume C89 or better.
3632         Include unistd.h if available, for gethostname.
3633         (ENAMETOOLONG): Define to 0, not 9999, to avoid colliding with
3634         existing errno values if any.
3635         (gethostname): Remove decl, since unistd.h declares it (or doesn't,
3636         in which case it's an older system and it should just work).
3637         (xgethostname): Don't assume host name length is less than INT_MAX.
3638         Exit if malloc fails, just as the comment says.
3639
3640         * save-cwd.c: Include <stdbool.h>.
3641         (errno): Remove decl; we now assume C89 or better.
3642         (save_cwd): Use bool for booleans.
3643         (save_cwd, restore_cwd): Return -1 on failure, not 1, since we set
3644         errno on failure.
3645
3646         * readutmp.h (UT_USER): Parenthesize properly.
3647         (UT_USER_SIZE): New constant.
3648         (read_utmp): Don't assume that the number of users is less than
3649         INT_MAX.
3650         * readutmp.c (read_utmp): Likewise.
3651         Check for integer overflow in size calculations.
3652         Return -1 (not 1) on failure, since we set errno in that case.
3653
3654         * posixtm.c (posix_time_parse): Don't assume that the length of
3655         the string being parsed is <= UINT_MAX.
3656
3657         * mountlist.h (read_file_system_list): Accept bool flag, not int.
3658         * mountlist.c (read_file_system_list): Likewise.
3659         * mountlist.h: Include <stdbool.h>.
3660         * mountlist.c (errno): Remove decl; we now assume C89 or better.
3661         (xatoi): Remove; replaced by strtoul.  Hence device numbers can now
3662         go up to ULONG_MAX.
3663
3664         * isdir.c: Remove; no longer needed.
3665         * Makefile.am (libfetish_a_SOURCES): Remove isdir.c.
3666
3667         * fts_.h: Add an FSF copyright notice, since our changes are becoming
3668         nontrivial.
3669         * fts.c: Likewise.
3670         * fts_.h: Include stddef.h, for ptrdiff_t.
3671         (FTS.fts_nitems): Now size_t, not int, for hosts that allow more
3672         than INT_MAX entries in a directory.
3673         (FTS_ROOTPARENTLEVEL): Parenthesize properly.
3674         (FTSENT.fts_level): Now ptrdiff_t, not int, to allow recursing more
3675         than INT_MAX levels deep on 64-bit hosts.
3676         (FTSENT.fts_namelen): Now size_t, not u_short, to support hosts like
3677         the Hurd that don't have arbitrary limits on directory entry lengths.
3678         (FTSENT.fts_statp): Now an array, not a pointer, so that we don't
3679         have to play unportable games with pointer arithmetic.  Keep it array
3680         for the benefit of user code that assumes it is a pointer.
3681         * fts.c: Include stdint.h if available, as Autoconf suggests.
3682         (ALIGNBYTES, ALIGN): Remove; no longer needed now that fts_statp
3683         is an array.
3684         (fts_alloc, fts_palloc, fts_sort, fts_load, fts_build):
3685         Use size_t for sizes.
3686         (fts_stat, fts_safe_changedir, fts_debug, fts_read, fts_build,
3687         fts_palloc):
3688         Use bool when appropriate.
3689         (SIZE_MAX, TYPE_SIGNED): New macros.
3690         (fts_read): Use u_short for instructions.
3691         (fts_build): Use ptrdiff_t for levels.  Don't assume file name lengths
3692         fit into int.  Don't assume nlink_t is signed.
3693         (find_matching_ancestor): Don't assume dev, ino fit in int.
3694         (fts_stat): Use function prototype; required for bool arg.
3695         (fts_sort): Detect integer overflow in size calculations.
3696         (fts_alloc): Simplify allocation code, now that fts_statp is an array
3697         and not a pointer.
3698
3699         * fsusage.h: Include <stdbool.h>.
3700         (struct fs_usage): Use uintmax_t for block sizes, so that they're
3701         not limited to INT_MAX.
3702         Use bool for booleans.
3703         * fsusage.c: Use Autoconf-suggested pattern for inttypes and stdint.
3704         Include unistd.h, for lseek.
3705
3706         * fnmatch.c: Include <stdbool.h>.
3707         (errno): Remove decl; we now assume C89 or better.
3708         * fnmatch_loop.c (EXT, FCT): Use bool when appropriate.
3709         (FCT): Use size_t, not unsigned int, for sizes.
3710         (EXT): Use size_t, not int, for sizes.
3711
3712         * stripslash.c (strip_trailing_slashes): Now returns bool.
3713         * dirname.h (strip_trailing_slashes): Likewise.
3714         Include <stdbool.h>.
3715         * dirname.c (dir_name): Use bool when appropriate.
3716
3717         * argmatch.h (argmatch, __xargmatch_internal, argmatch_invalid):
3718         Use ptrdiff_t, not int, when counting arguments, to allow more
3719         than INT_MAX arguments.
3720         * argmatch.c: Likewise.  Use bool when appropriate.
3721
3722 2004-08-01  Paul Eggert  <eggert@cs.ucla.edu>
3723
3724         * safe-read.c (errno): Remove decl; we now assume C89 or better.
3725         (safe_rw): Don't work around Tru64 bug unless the bug symptoms
3726         manifest themselves.  This allows us to do proper reads and writes
3727         on other hosts, e.g., "dd" with a block size greater than 2**31.
3728
3729         * md5.c (UNALIGNED_P): Use size_t; in practice, this is just as
3730         good as uintptr_t in checking for alignments, and has fewer
3731         configuration hassles.
3732         * sha1.c (UNALIGNED_P): Likewise.
3733         * md5.h: Don't include <limits.h>.  Include <inttypes.h> if available,
3734         as it defines symbols like UINT32_MAX on Solaris 8.
3735         (md5_uint32): Assume uint32_t exists; Autoconf will define it
3736         otherwise (if the host has a 32-bit unsigned type, anyway).
3737         * memchr.c: Don't include inttypes.h or stdint.h.
3738         (UNALIGNED_P): Remove.
3739         (__memchr): Use size_t, not uintptr_t, to test alignment.
3740         * memrchr.c: Likewise, for __memrchr.
3741
3742 2004-07-30  Paul Eggert  <eggert@cs.ucla.edu>
3743
3744         * makepath.h: Include <stdbool.h>.
3745         (make_path, make_dir): Use bool, not int, since we're not setting
3746         errno.
3747         Use mode_t for modes, not int.  All uses changed.
3748         * makepath.c: Likewise.
3749         (errno): Remove decl; no longer needed since we assume C89.
3750
3751 2004-07-29  Paul Eggert  <eggert@cs.ucla.edu>
3752
3753         * modechange.c: Include <stdbool.h>.
3754         (mode_compile): Use bool when appropriate.
3755
3756         * memchr.c (UNALIGNED_P): Use sizeof, not alignof, for better
3757         performance on m68k-linux.  Reported by Andreas Schwab in
3758         <http://lists.gnu.org/archive/html/bug-coreutils/2004-07/msg00104.html>.
3759         * memrchr.c (UNALIGNED_P): Likewise.
3760
3761 2004-07-28  Paul Eggert  <eggert@cs.ucla.edu>
3762
3763         * userspec.c: Include <stdbool.h>, "inttostr.h".
3764         (V_STRDUP): Don't assume the string's length fits in int.
3765         (ISDIGIT): unsigned -> unsigned int
3766         (is_number): Define only ifdef __DJGPP__; not needed elsewhere.
3767         Use bool instead of int where appropriate.
3768         Do not allow empty strings.
3769         (parse_user_spec): Parse numbers as decimal integers, even if
3770         they have a leading 0.  Don't assume uids and gids fit in int.
3771
3772         * memchr.c: Include <stddef.h>, not <stdlib.h> and <sys/types.h>.
3773         (LONG_MAX_32_BITS): Remove.
3774         Include <inttypes.h> and <stdint.h> if available.
3775         (alignof, UNALIGNEDP): New macro, portable to all C89 hosts.
3776         (__memchr): Don't assume unsigned long int is either 4 or 8 bytes;
3777         let it be any number of bytes greater than or equal to 4.
3778         * memrchr.c: Likewise, with __memrchr.
3779
3780         * md5.h: Include <stdint.h> if HAVE_STDINT_H || _LIBC, not
3781         ifdef _LIBC.
3782         (md5_uint32): Use uint32_t if available.  Simplify fallback ifdefs.
3783         * md5.c: Don't include <sys/types.h> or <stdlib.h>; <stddef.h>
3784         suffices with C89 or better.
3785         (alignof): New macro, portable to all C89 hosts.
3786         (UNALIGNED): Use it.  Use uintptr_t if available, and assume
3787         everything is unaligned otherwise; this is more portable than
3788         assuming 'unsigned long int' will always work.
3789         * sha1.c: Likewise.
3790
3791         * getugroups.c: Include <errno.h>.
3792         (EOVERFLOW): Define if not defined.
3793         (getgroups): Return -1 with errno=EOVERFLOW if an integer overflow
3794         occurs.
3795
3796 2004-07-27  Paul Eggert  <eggert@cs.ucla.edu>
3797
3798         * euidaccess.c [HAVE_LIBGEN_H]: Include <libgen.h>, for
3799         eaccess on Solaris and SVR4-like systems.
3800         (euidaccess): Use HAVE_EACCESS, not HAVE_DECL_EACCESS.
3801
3802         cycle-check integer overflow fixup.
3803
3804         * cycle-check.h: Remove now-inaccurate comment about the files
3805         you need to include first.  You don't need to include any files
3806         other than the usual config.h.
3807         Include <inttypes.h> and <stdint.h> if available, for uintmax_t.
3808         Remove 'struct stat;' not needed since we know sys/stat.h has
3809         been included by dev-ino.h.
3810         (struct cycle_check_state): Change chdir_counter to uintmax_t,
3811         not size_t, since it isn't limited by object sizes.
3812         Change magic from long unsigned int to int; that's good enough
3813         for our use.
3814         * cycle-check.c (is_zero_or_power_of_two): Renamed from
3815         is_power_of_two, to reflect better what it really does.
3816         All uses changed.  Arg is now uintmax_t, not unsigned int
3817         (it should have been unsigned long int -- that was a bug).
3818         (cycle_check): Check for integer overflow in cycle count,
3819         and report a cycle if that happens, as it must be a cycle
3820         by this point.
3821
3822         backupfile.c rewrite to avoid arbitrary limits on lengths of
3823         numeric backup extensions.
3824
3825         * addext.c: Remove; no longer needed.
3826         * Makefile.am (libfetish_a_SOURCES): Remove addext.c.
3827         * backupfile.h (addext): Remove decl.
3828         * backupfile.c: Include "backupfile.h" first.
3829         Include errno.h, stdbool.h, limits.h, unistd.h, xalloc.h.
3830         (CLOSEDIR, INT_STRLEN_BOUND): Remove.
3831         (pathconf) [! (HAVE_PATHCONF && defined _PC_NAME_MAX)]: New macro.
3832         (_POSIX_NAME_MAX) [!defined _POSIX_NAME_MAX]: New macro.
3833         (NAME_MAX_MAXIMUM): New macro.  Unlike the old addext.c, we
3834         also look at _XOPEN_NAME_MAX, for better performance on modern
3835         hosts that support only file names of length 255 or more.
3836         (ISDIGIT): unsigned -> unsigned int
3837         (max_backup_version, version_number): Remove.
3838         (check_extension): New function.  Similar to the old addext, but
3839         static, assumes that the extension has already been added,
3840         and a bit more careful on DOS hosts.
3841         (numbered_backup): New function.  It does what max_backup_version
3842         and version_number used to do, but it doesn't use integer arithmetic
3843         to calculate extensions so it doesn't overflow.
3844         (find_backup_file_name): Rewrite to use these new functions.
3845         This has a new optimization: we needn't call pathconf if the
3846         new numbered backup name has the same length as the old.
3847         Also, use xmalloc rather than malloc, so that the caller
3848         needn't worry about memory exhaustion.
3849
3850 2004-07-25  Paul Eggert  <eggert@cs.ucla.edu>
3851
3852         * euidaccess.c [!defined LIBC]: Included group-member.h, stat-macros.h.
3853         (S_IXUSR, S_IXGRP, S_IXOTH, S_IROTH, S_IWOTH, S_IXOTH):
3854         Remove; now done by stat-macros.h.
3855         (NGROUPS_MAX, group_member): Remove; now done by group-member.h.
3856         No need to include <limits.h>.
3857         (errno): Remove decl; we now assume C89 or better.
3858         (access, getuid, getgid, geteuid, getegid, stat) [defined _LIBC]:
3859         New macros.
3860         (uid, gid, have_ids): Remove these static variables.
3861         They weren't accurate for programs that also invoked setreuid etc.
3862         (euidaccess) [defined EFF_ONLY_OK || defined ACC_SELF ||
3863         HAVE_DECL_EACCSS]: Use builtin substitutes.
3864         [defined _LIBC]: Ignore __libc_enable_secure; it's not a
3865         correct optimization for programs run as root that later
3866         invoke setreuid.
3867         [no builtin substitutes && HAVE_DECL_SETREGID &&
3868         PREFER_NONREENTRANT_EUIDACCESS]:
3869         Use setreuid+setregid to get the correct answer.
3870         [no builtin substitutes && ! (HAVE_DECL_SETREGID &&
3871         PREFER_NONREENTRANT_EUIDACCESS)]:
3872         Don't assume that the stat macros have their historical values,
3873         as POSIX doesn't require this.
3874         [defined TEST]: Include <stdlib.h>; don't include errno.h
3875         twice; include <error.h> rather than "error.h".
3876
3877 2004-07-23  Paul Eggert  <eggert@cs.ucla.edu>
3878
3879         * Makefile.am (libfetish_a_SOURCES): Add fcntl-safer.h,
3880         open-safer.c.
3881         * fcntl-safer.h, open-safer.c: New files.
3882
3883 2004-07-12  Paul Eggert  <eggert@cs.ucla.edu>
3884
3885         * c-strtod.c (STRTOD_L): New macro.
3886         (C_STRTOD) [defined LC_ALL_MASK]: Use it, so that the
3887         code is reentrant on platforms that have strtod_l.
3888
3889         * getloadavg.c: Include <errno.h>, <stdio.h>, <stdlib.h> even
3890         if HAVE_GETLOADAVG is defined, so that the test program can work.
3891         (errno): Remove declaration; not needed in C89 or later.
3892         Include "c-strtod.h".
3893         Do not include locale.h or define setlocale; no longer needed.
3894         Include <limits.h>.
3895         (INT_STRLEN_BOUND): New macro.
3896         (getloadavg): Use it to compute buffer size.
3897         Don't assume that buffer will be properly terminated by 'read'.
3898         Use c_strtod instead of setlocale.
3899         (main) [defined TEST]: Return int, not void.
3900
3901 2004-07-11  Paul Eggert  <eggert@cs.ucla.edu>
3902
3903         * Makefile.am (libfetish_a_SOURCES): Add c-strtold.c.
3904         * c-strtold.c: New file.
3905         * c-strtod.c: Include <config.h> first.
3906         (C_STRTOD, DOUBLE, STRTOD): New macros.
3907         (c_strtod): Use them.
3908         * c-strtod.h (c_strtold): New decl.
3909
3910 2004-07-07  Jim Meyering  <jim@meyering.net>
3911
3912         Don't infloop when MAXSYMLINKS is not defined.
3913         Detect symlink loops much earlier (albeit lazily) on systems
3914         with MAXSYMLINKS defined to a large value.
3915
3916         * canonicalize.c: Include "cycle-check.h".
3917         (canonicalize_filename_mode): Don't try to detect loops by counting
3918         symlink-hops.  Instead, use the cycle-check module.
3919
3920         * cycle-check.h: Include stdbool.h.
3921         Forward-declare `struct stat'.
3922
3923         * canonicalize.c (canonicalize_filename_mode): Remove do-while(0) loop.
3924         Replace each corresponding `break' stmt with `continue'.
3925
3926 2004-07-06  Jim Meyering  <jim@meyering.net>
3927
3928         * canonicalize.c: Include "stat-macros.h".
3929         (canonicalize_filename_mode): Remove #ifdef S_ISLNK, now that
3930         S_ISLNK is guaranteed to be defined (via stat-macros.h).
3931
3932 2004-04-03  Dmitry V. Levin  <ldv@altlinux.org>
3933
3934         * Makefile.am (libfetish_a_SOURCES): Add canonicalize.c
3935         unconditionally.
3936         * canonicalize.h (canonicalize_mode_t): New type.
3937         * canonicalize.c: Include "file-type.h".
3938         (canonicalize_filename_mode): New function, based on
3939         canonicalize_file_name, supports three canonicalize modes.
3940         (canonicalize_file_name)
3941         [!HAVE_CANONICALIZE_FILE_NAME && !HAVE_RESOLVEPATH]: Use it.
3942
3943 2004-07-05  Jim Meyering  <jim@meyering.net>
3944
3945         * path-concat.c (path_concat): Improve comment.  From Paul Eggert.
3946
3947 2004-07-02  Paul Eggert  <eggert@cs.ucla.edu>
3948
3949         * canonicalize.c (canonicalize_file_name): Assume that path_concat
3950         never returns NULL.
3951         * path-concat.c (mempcpy): Don't define if a system header defines it.
3952         Don't include stdio.h, stdlib.h, unistd.h, strdup.h.
3953         (longest_relative_suffix): New function.
3954         (path_concat): Use it.  Assume first argument is not NULL.
3955         Port to DOS.  Omit redundant separators.
3956         Report an error instead of returning NULL.
3957         Use mempcpy instead of memcpy.
3958         (xpath_concat): Remove: not declared or used.
3959
3960 2004-06-30  Paul Eggert  <eggert@cs.ucla.edu>
3961
3962         * dirname.h (FILE_SYSTEM_PREFIX_LEN): Renamed from
3963         FILESYSTEM_PREFIX_LEN.  All uses changed.
3964         * mountlist.h (read_file_system_list): Renamed from
3965         read_filesystem_list.  All definitions and uses changed.
3966
3967 2004-06-24  Jim Meyering  <jim@meyering.net>
3968
3969         * obstack.h (obstack_base): Fix parentheses.  From Paul Eggert.
3970
3971 2004-06-20  Jim Meyering  <jim@meyering.net>
3972
3973         * obstack.h (obstack_base): Cast to (void *), per documentation.
3974
3975         * yesno.h: New file.
3976         * yesno.c: Include "yesno.h".
3977         * Makefile.am (libfetish_a_SOURCES): Add yesno.h.
3978
3979 2004-06-19  Jim Meyering  <jim@meyering.net>
3980
3981         * filemode.c: Remove all S_IS* and S_IF* definitions.
3982         Instead, just include "stat-macros.h".
3983         * stat.c: Likewise.
3984         * rmdir.c: Likewise.
3985         * makepath.c: Likewise.
3986         * lchown.c: Likewise.
3987         * isdir.c: Likewise.
3988         * canonicalize.c: Likewise.
3989
3990         Add S_IS* definitions from filemode.c.
3991         * stat-macros.h (S_ISCTG): Define to zero if not already defined.
3992         (S_ISOFD): Likewise.
3993         (S_ISOFL): Likewise.
3994
3995 2004-06-11  Paul Eggert  <eggert@cs.ucla.edu>
3996
3997         * readutmp.c (extract_trimmed_name): Don't apply strchr to a
3998         non-string; this leads to undefined behavior.
3999
4000 2004-05-18  Paul Eggert  <eggert@cs.ucla.edu>
4001
4002         * fts.c (fts_stat, fts_alloc): Always allocate and use a struct
4003         stat, even if the user isn't interested in the results.
4004         This prevents a core dump in cycle_check when FTS_NOSTAT is set.
4005         * lchown.c (lchown): Return EOPNOTSUPP if not supported; this
4006         is what POSIX-2004 specifies.
4007         * lchown.h (EOPNOTSUPP): Define if not defined.
4008         (ENOSYS): Remove.
4009
4010 2004-06-06  Jim Meyering  <jim@meyering.net>
4011
4012         * getdate.y: Update from gnulib.
4013
4014 2004-05-25  Paul Eggert  <eggert@cs.ucla.edu>
4015
4016         * xreadlink.c: Include xreadlink.h first, to catch .h file
4017         dependency problems.
4018         (xreadlink): Accept new arg SIZE, for efficiency.
4019         All decls and uses changed.
4020         * xreadlink.h: Include <stddef.h>, for size_t.
4021         * canonicalize.c (canonicalize_file_name): Update use of xreadlink.
4022
4023 2004-06-01  Jim Meyering  <jim@meyering.net>
4024
4025         * xmalloc.c: Update from gnulib.
4026
4027 2004-05-30  Jim Meyering  <jim@meyering.net>
4028
4029         * alloca_.h: Remove trailing blank.
4030
4031 2004-05-29  Jim Meyering  <jim@meyering.net>
4032
4033         * dirname.h (IS_ABSOLUTE_FILE_NAME, IS_RELATIVE_FILE_NAME): Define.
4034
4035         * calloc.c: New file.
4036
4037 2004-05-21  Jim Meyering  <jim@meyering.net>
4038
4039         * alloca.c, alloca_.h, fnmatch.c: Update from gnulib.
4040         * localcharset.c, regex.c: Likewise.
4041
4042 2004-05-20  Jim Meyering  <jim@meyering.net>
4043
4044         * obstack.c, obstack.h: Update from gnulib.
4045
4046 2004-05-16  Paul Eggert  <eggert@cs.ucla.edu>
4047
4048         * getline.c, getndelim2.c, getndelim2.h: Sync with gnulib.
4049
4050 2004-05-11  Jim Meyering  <jim@meyering.net>
4051
4052         Prior to this change, rm required read access to the current
4053         directory on most systems (ones with the fchdir function).
4054
4055         * save-cwd.c (save_cwd) [HAVE_FCHDIR]: If opening `.' read-only
4056         fails, try write-only, and finally, resort to using xgetcwd.
4057
4058 2004-05-07  Jim Meyering  <jim@meyering.net>
4059
4060         Update from gnulib.
4061         * obstack.c (_): Define only if not already defined.
4062         * obstack.h (obstack_finish): Rename local: s/value/__value/.
4063
4064 2004-05-03  Jim Meyering  <jim@meyering.net>
4065
4066         * lchown.c (lchown) [CHOWN_MODIFIES_SYMLINK]: Just call chown.
4067
4068 2004-05-01  Jim Meyering  <jim@meyering.net>
4069
4070         * chown.c (rpl_chown) [CHOWN_FAILS_TO_HONOR_ID_OF_NEGATIVE_ONE]:
4071         Wrap old code with this conditional.
4072         [CHOWN_MODIFIES_SYMLINK]: Try to work around a chown
4073         function that does not dereference symlinks.
4074
4075 2004-04-18  Paul Eggert  <eggert@twinsun.com>
4076
4077         * nanosleep.c (suspended): Change its type from int to
4078         sig_atomic_t volatile.
4079         (first_call): Make it private to rpl_nanosleep, and have it
4080         be zero initially as that's a bit faster.
4081         (my_usleep): Round up fractional times instead of truncating them,
4082         as this is the usual meaning for 'sleep'.
4083
4084 2004-04-20  Jim Meyering  <jim@meyering.net>
4085
4086         * getndelim2.c (getndelim2): Upon realloc failure, don't leak memory.
4087
4088 2004-04-18  Jim Meyering  <jim@meyering.net>
4089
4090         * readutmp.c (read_utmp) [UTMP_NAME_FUNCTION]: Upon realloc failure,
4091         don't leak memory and do call END_UTMP_ENT.
4092
4093 2004-04-13  Jim Meyering  <jim@meyering.net>
4094
4095         * quotearg.c, quotearg.h: Remove trailing blanks.
4096
4097 2004-04-12  Jim Meyering  <jim@meyering.net>
4098
4099         * inttostr.h: Update from gnulib.
4100
4101 2004-03-27  Paul Eggert  <eggert@twinsun.com>
4102
4103         * utimecmp.c, utimecmp.h: New files.
4104         * Makefile.am (libfetish_a_SOURCES): Add utimecmp.c, utimecmp.h.
4105
4106 2004-04-09  Jim Meyering  <jim@meyering.net>
4107
4108         * stat-macros.h: New file, with contents from file-type.h
4109         and coreutils' system.h.
4110         * Makefile.am (libfetish_a_SOURCES): Add stat-macros.h.
4111         * file-type.c: Include "stat-macros.h".
4112         * file-type.h (file_type): Move all macro defiitions to new file,
4113         stat-macros.h.
4114
4115 2004-03-30  Paul Eggert  <eggert@twinsun.com>
4116
4117         * cloexec.c, cloexec.h, config.charset, file-type.c, file-type.h:
4118         * getloadavg.c, getndelim2.c, getusershell.c, group-member.c:
4119         * human.c, path-concat.c, printf-args.c, printf-args.h:
4120         * quotearg.c, quotearg.h, setenv.c, strdup.c:
4121         * userspec.c, userspec.h, vasprintf.c: Sync from gnulib.
4122
4123         * allocsa.c, allocsa.h, strdup.h: New files, from gnulib.
4124         * Makefile.am (libfetish_a_SOURCES): Add allocsa.c, allocsa.h,
4125         and strdup.h.
4126
4127 2004-03-30  Jim Meyering  <jim@meyering.net>
4128
4129         * getloadavg.c: Merge changes from emacs (via gnulib).
4130
4131 2004-03-28  Paul Eggert  <eggert@twinsun.com>
4132
4133         Fix some gotchas encountered when porting to Solaris 8, using
4134         the Forte 6u2 compiler.
4135
4136         * canonicalize.c [HAVE_UNISTD_H]: Include <unistd.h>,
4137         for resolvepath declaration.
4138         * fts.c: Include dirfd.h, for dirfd.
4139
4140 2004-02-25  Paul Eggert  <eggert@twinsun.com>
4141
4142         * human.c (humblock): Support BLOCKSIZE as well as BLOCK_SIZE.
4143
4144 2004-03-23  Paul Eggert  <eggert@twinsun.com>
4145
4146         * readtokens0.c (readtokens0): Return true on success rather
4147         than on failure.  All callers changed.  This also happens to fix a
4148         portability bug on pre-C99 hosts, where (bool) INTEGER sometimes
4149         returns false even when INTEGER is nonzero.
4150
4151 2004-03-23  Jim Meyering  <jim@meyering.net>
4152
4153         * Makefile.am (libfetish_a_SOURCES): Add getopt_int.h.
4154         * getopt_int.h: New file, from gnulib.
4155         * getopt.c, getopt.h, getopt1.c: Sync from gnulib.
4156         * getopt.c, getopt.h: Remove space(s) before TAB.
4157
4158         * mbswidth.c, mbswidth.h: Sync from gnulib.
4159
4160 2004-03-21  Jim Meyering  <jim@meyering.net>
4161
4162         * readtokens0.c, readtokens0.h: New files.
4163         * Makefile.am (libfetish_a_SOURCES): Add readtokens0.c and readtokens0.h
4164
4165         * readtokens.c (readtoken): Don't leak 64 bytes when reading
4166         an empty input stream.
4167
4168         * readtokens.c: Include <stdbool.h>.
4169         (readtoken): Use `size_t' rather than int/long.
4170         All callers adjusted.
4171         Use `bool' rather than `int' where appropriate.
4172         Use memset rather than an explicit loop.
4173         Use x2nrealloc rather than xrealloc.
4174         Allow the use of `\0' as a delimiter.
4175         (readtokens): Likewise.
4176         * readtokens.h (readtoken, readtokens): Update prototypes.
4177
4178 2004-02-29  Paul Eggert  <eggert@twinsun.com>
4179
4180         * getdate.h: Include stdbool.h, and timespec.h instead of
4181         the usual <time.h> dance.
4182         (get_date): Change signature to support fractional time stamps.
4183         All callers changed.
4184         * getdate.y: Include "getdate.h" first, as we can now
4185         assume C89 and don't need to worry about 'const'.
4186         Similarly, include "unlocked-io.h" near start, not in middle.
4187         Include <limits.h>.
4188         (textint.value): Use long int rather than int.
4189         (textint.digits): Use size_t rather than int.
4190         (BILLION, LOG10_BILLION): New constants.
4191         (parser_control): New member rel_ns.  Members day_ordinal,
4192         time_zone, month, day, hour, minutes, rel_year, rel_month,
4193         rel_day, rel_hour, rel_minutes, rel_seconds
4194         are now long int, not int.  Member seconds is now struct timespec,
4195         not int.  New member timespec_seen.  Members dates_seen, days_seen,
4196         local_zones_seen, rels_seen, times_seen, zones_seen are now size_t,
4197         not int.
4198         (%union.intval): Now long int, not int.
4199         New member timespec.
4200         (tSDECIMAL_NUMBER, tUDECIMAL_NUMBER): New tokens.
4201         (seconds, signed_seconds, unsigned_seconds): New nonterminals.
4202         (spec): Now is a timespec or an item list.
4203         (timespec, items): New nonterminals.
4204         (time, rel, relunit, number, get_date):
4205         Add support for fractional seconds.
4206         (time): Fix bug: seconds weren't cleared in "00:00 +0000" syntax.
4207         (gmtime, localtime, mktime): Remove decls; not needed with C89.
4208         (to_hour): First arg is now long int, not int.
4209         (to_year): Returns long int, not int.
4210         Don't treat year -70 like 70.
4211         (tm_diff): Returns long int, not int.
4212         (lookup_word): Use bool instead of int when appropriate.
4213         (yylex): Use size_t for count, not int.
4214         Detect overflow when parsing large integer constants.
4215         Add support for fractions.
4216         (get_date): Make pointers 'const' if possible.
4217         Use more-portable code to detect integer overflow.
4218         (main) [TEST]: Adjust to above changes.  Test for localtime failure.
4219         Don't use ctime; it's not reliable if the year has >4 digits.
4220
4221 2004-03-15  Jim Meyering  <jim@meyering.net>
4222
4223         `date --date="21:04 +0100" +%S' would print the seconds value
4224         from the current time, rather than `00'.
4225         * getdate.y: For a date string like `10:23 +0100',
4226         set the number of seconds to zero.  Reported by Marc Haber.
4227
4228 2004-03-04  Jim Meyering  <jim@meyering.net>
4229
4230         * cloexec.c (set_cloexec_flag) [ ! (F_GETFD && F_SETFD)]:
4231         Return true, not false.
4232
4233 2004-03-03  Paul Eggert  <eggert@twinsun.com>
4234
4235         * cloexec.c: Include "cloexec.h" first, and <unistd.h> before <fcntl.h>.
4236         (set_cloexec_flag): Use bool for booleans.  All uses changed.
4237         If F_GETFD returns a negative number (not just -1), report a
4238         failure.  Don't use F_SETFD if the flags are already right.
4239         Don't report a failure with F_SETFD unless it returns -1.
4240         * cloexec.h: Include <stdbool.h>.
4241         Adjust signature to use `bool' rather than `int'.
4242         * getloadavg.c (getloadavg): Use `true', not `1'.
4243
4244 2004-03-02  Dmitry V. Levin  <ldv@altlinux.org>
4245
4246         * cloexec.c: New file.
4247         The set_cloexec_flag implementation imported from GNU C Library
4248         Reference Manual.
4249         * cloexec.h: New file.
4250         * getloadavg.c: Include "cloexec.h".
4251         (getloadavg): Use set_cloexec_flag instead of manual fcntl call.
4252         * Makefile.am (libfetish_a_SOURCES): Add cloexec.c, cloexec.h.
4253
4254 2004-02-23  Paul Eggert  <eggert@twinsun.com>
4255
4256         * userspec.c: Don't include "posixver.h".
4257         (parse_user_spec): Fall back on USER.GROUP parsing, regardless
4258         of POSIX version, as POSIX 1003.1-2001 allows that behavior as a
4259         compatible extension.  Simplify code by removing a boolean int
4260         that was always nonzero if a string was nonnull.
4261
4262 2004-02-05  Jim Meyering  <jim@meyering.net>
4263
4264         * timespec.h (ST_TIME_CMP_NS, ST_TIME_CMP): Define.
4265         (ATIME_CMP, CTIME_CMP, MTIME_CMP, TIMESPEC_NS): Likewise.
4266         From coreutils' system.h.
4267
4268 2004-01-29  Jim Meyering  <jim@meyering.net>
4269
4270         * mountlist.c [HAVE_SYS_UCRED_H]: Include grp.h before sys/ucred.h.
4271
4272 2004-01-21  Paul Eggert  <eggert@twinsun.com>
4273
4274         * argmatch.c (ARGMATCH_DIE) [! defined ARGMATCH_DIE]:
4275         Include "exitfail.h", and use exit_failure rather than EXIT_FAILURE.
4276         * argmatch.h: Comment fix to match the above.
4277         * long-options.c (parse_long_options): Use prototype
4278         for usage function arg.  Pass it EXIT_SUCCESS rather than 0,
4279         for clarity.
4280         * obstack.c (obstack_exit_failure) [!defined _LIBC]:
4281         Now a macro referring to exit_failure, instead of a separate
4282         variable.  Include "exitfail.h" to get it.
4283         * xstrtol.h: Include "exitfail.h".
4284         (STRTOL_FATAL_ERROR): Exit with status exit_failure, not 2.
4285
4286 2004-01-21  Jim Meyering  <jim@meyering.net>
4287
4288         * mktime.c (__mktime_internal) [!_LIBC]: Define to mktime_internal
4289         so as not to conflict with a different-sized __mktime_internal
4290         function in GNU libc.
4291
4292 2004-01-16  Jim Meyering  <jim@meyering.net>
4293
4294         Merge from gnulib.
4295         * localcharset.c: Test HAVE_DECL_GETC_UNLOCKED,
4296         rather than HAVE_GETC_UNLOCKED.
4297
4298 2003-10-08  Paul Eggert  <eggert@twinsun.com>
4299
4300         Merge from gnulib.
4301
4302         * unlocked-io.h: Include <stdio.h>, so that the caller
4303         doesn't have to include <stdio.h> before us.
4304         (clearerr_unlocked, feof_unlocked, ferror_unlocked,
4305         fflush_unlocked, fgets_unlocked, fputc_unlocked, fputs_unlocked,
4306         fread_unlocked, fwrite_unlocked, getc_unlocked, getchar_unlocked,
4307         putc_unlocked, putchar_unlocked): Define to the unlocked counterpart
4308         if not declared, so that we can use getpass.c code from libc without
4309         rewriting it.
4310         (flockfile, ftrylockfile, funlockfile): New macros.
4311
4312 2004-01-14  Paul Eggert  <eggert@twinsun.com>
4313
4314         Merge from gnulib.
4315
4316         * fnmatch_loop.c (ALLOCA_LIMIT): Remove macro, which collided
4317         with like-named macro in fnmatch.c.
4318         (EXT): Use an internal constant instead.
4319
4320         Merge fnmatch patches from glibc.
4321         * fnmatch.c (mbsinit): Remove define.
4322         Add libc_hidden_ver (__fnmatch, fnmatch).
4323         * fnmatch_loop.c (FCT): Cast to int32_t and UCHAR when appropriate.
4324         Adjust to renaming of collseq_table_lookup to __collseq_table_lookup.
4325
4326 2003-11-24  Paul Eggert  <eggert@twinsun.com>
4327
4328         Merge from gnulib.
4329
4330         * alloca.c: Remove dependency on xalloc module.
4331         (xalloc_die): Remove.
4332         (memory_full) [!defined emacs]: New macro.
4333         [!defined emacs]: Don't include xalloc.h.
4334         (alloca): Invoke memory_full, not xalloc_die, if malloc fails or
4335         address arithmetic overflows.  Change datatypes a bit to avoid
4336         unnecessary casts.
4337
4338 2004-01-14  Paul Eggert  <eggert@twinsun.com>
4339
4340         * posixver.c: Include posixver.h.
4341
4342 2004-01-12  Jim Meyering  <jim@meyering.net>
4343
4344         * posixver.c (DEFAULT_POSIX2_VERSION): Use definition of new,
4345         optional configure-time default.
4346
4347 2004-01-10  Jim Meyering  <jim@meyering.net>
4348
4349         * version-etc.c (version_etc_copyright): Update copyright date.
4350
4351 2003-12-20  Jim Meyering  <jim@meyering.net>
4352
4353         * fts.c [!_LIBC]: Undefine, then define-away __P.
4354
4355 2003-12-19  Jim Meyering  <jim@meyering.net>
4356
4357         Rewrite fts to use a hash table or O(1)-mem cycle-detection
4358         code rather than the tree-based tsearch functions.
4359         * fts_.h: Include hash.h and cycle-check.h.
4360         (FTS_TIGHT_CYCLE_CHECK): New value.
4361         (FTS_OPTIONMASK): Adjust to include the new value.
4362         (FTS_NAMEONLY, FTS_STOP): Increase to allow room for new value.
4363         (struct FTS) [active_dir_ht]: New member.  Replaces fts_dir_signatures.
4364         (struct FTS) [cycle_state]: New member.
4365         * fts.c: Don't include <search.h>.
4366         [HAVE_INTTYPES_H]: Include <inttypes.h>.
4367         (tdestroy, tfind, tsearch): Remove definitions.
4368         (struct Active_dir): Rename from `known_object'.
4369         (AD_compare, AD_hash): New functions.
4370         (enter_dir, leave_dir): Rewrite to manipulate a hash table
4371         rather than a tree.
4372         (fts_open): Initialize hash table or cycle_state buffer.
4373         (free_node): Remove function.
4374         (find_matching_ancestor): Renamed/rewritten from look_up_active_dir.
4375         (fts_cross_check): Adapt to use new data structure.
4376
4377         * Makefile.am (libfetish_a_SOURCES): Remove search_.h.
4378         (DISTCLEANFILES): Remove definition.
4379
4380 2003-12-18  Jim Meyering  <jim@meyering.net>
4381
4382         Rewrite cycle detection code to work properly.
4383         Add some framework (compiled out by default) to test it.
4384         * fts.c (Dprintf, ENTER_DIR, LEAVE_DIR): Define.
4385         (add_object): Remove function.  Rewritten as...
4386         (enter_dir): New function.
4387         (leave_dir, free_node): New functions.
4388         (fts_read): Ensure that we call ENTER_DIR or LEAVE_DIR,
4389         as appropriate, before returning.
4390         (look_up_active_dir, fts_cross_check) [FTS_DEBUG]: New functions.
4391         (fts_stat): Don't perform the cycle check here.
4392         Now it's done via enter_dir.
4393
4394 2003-12-12  Jim Meyering  <jim@meyering.net>
4395
4396         * fts_.h (FTS) [fts_dir_signatures]: Add comment.
4397
4398 2003-12-03  Paul Eggert  <eggert@twinsun.com>
4399
4400         * getgroups.c (getgroups): xmalloc takes one argument, not two.
4401         Bug reported by Alfred M. Szmidt.
4402
4403 2003-12-02  Jim Meyering  <jim@meyering.net>
4404
4405         * Makefile.am (libfetish_a_SOURCES): Reflect sha -> sha1 renaming.
4406
4407         * sha1.c: File renamed from sha.c.
4408         * sha1.h: File renamed from sha.h.
4409         Use SHA1_H, not _SHA_H in #ifndef condition.
4410
4411         * sha.c: Add FSF Copyright.
4412         * sha.h: Correct stale references to MD5 and `16 bytes'.
4413         Patch by Ulrich Drepper.
4414
4415         * sha.h: Add FSF Copyright.  Remove reference to Scott Miller,
4416         since this file is now nearly identical to md5.h.
4417
4418         * md5.h (rol) [__GNUC__ && __i386__]: Don't use `asm' code.  These
4419         days, gcc-3.x does better all by itself.  Patch from Dean Gaudet:
4420         http://mail.gnu.org/archive/html/bug-coreutils/2003-11/msg00144.html
4421
4422 2003-11-29  Jim Meyering  <jim@meyering.net>
4423
4424         * c-strtod.c (c_strtod): Save and restore original LC_NUMERIC setting,
4425         in case it was different from the environment-derived value.
4426         Patch by Paul Eggert.
4427         Include "xalloc.h" for declaration of xstrdup.
4428
4429 2003-11-24  Paul Eggert  <eggert@twinsun.com>
4430
4431         Parse floating-point operands and options in the C locale.
4432         POSIX requires this for printf, and we might as well be
4433         consistent elsewhere (tail, sleep, seq).
4434
4435         * Makefile.am (libfetish_a_SOURCES): Add c-strtod.c, c-strtod.h.
4436         * c-strtod.c, c-strtod.h: New files.
4437         * xstrtod.h (xstrtod): Accept an extra arg, specifying the
4438         conversion function.
4439         * xstrtod.c (xstrtod): Likewise.  All callers changed to
4440         include c-strtod.h and use c_strtod.  Don't include stdlib.h; no
4441         longer needed.
4442
4443         * xnanosleep.c: Don't include xstrtod.h; it's not needed.
4444
4445 2003-11-22  Jim Meyering  <jim@meyering.net>
4446
4447         * xmalloc.c (x2nrealloc_inline): Fix typos in comments: s/size/size_t/.
4448
4449 2003-11-21  Jim Meyering  <jim@meyering.net>
4450
4451         * xreadlink.c (xreadlink): Correct outdated comment.
4452
4453 2003-11-17  Jim Meyering  <jim@meyering.net>
4454
4455         On systems without utime and without a utimes function capable of
4456         dealing with a NULL struct utimbuf* argument, this utime replacement
4457         could -- in unusual circumstances -- leak a file descriptor.
4458         * utime.c: Include <unistd.h> and <errno.h>.
4459         (utime_null): Be sure to close `fd' and to preserve errno.
4460         Reported by Geoff Collyer via Arnold Robbins.
4461
4462 2003-11-13  Jim Meyering  <jim@meyering.net>
4463
4464         * xalloc.h, xstrtol.c: Update from gnulib.
4465
4466 2003-11-11  Jim Meyering  <jim@meyering.net>
4467
4468         * ftw.c, ftw_.h: Remove files.  No longer used.
4469
4470 2003-11-09  Jim Meyering  <jim@meyering.net>
4471
4472         * root-dev-ino.c, root-dev-ino.h: New files.
4473         * Makefile.am (libfetish_a_SOURCES): Add root-dev-ino.c root-dev-ino.h.
4474
4475         * dev-ino.h: Include <sys/types.h> and <sys/stat.h>.
4476
4477 2003-11-06  Jim Meyering  <jim@meyering.net>
4478
4479         * free.c: New file, from gnulib.
4480
4481 2003-10-31  Paul Eggert  <eggert@twinsun.com>
4482
4483         * mountlist.h (struct mount_entry.me_type_malloced): New member.
4484         * mountlist.c (SIZE_MAX): Define if not defined already.
4485         (read_filesystem_list): Set and use me_type_malloced.
4486         Use "sizeof *me" rather than "sizeof (struct mount_entry)" (or
4487         whatever the type happens to be), for brevity and consistency.
4488         Check for size calculation overflow on Alphas running OSF/1.
4489
4490 2003-10-31  Jim Meyering  <jim@meyering.net>
4491
4492         * hash.c: Include "xalloc.h" for use of xalloc_oversized.
4493
4494         * linebuffer.c: Include <string.h> for declaration of memset.
4495
4496         * alloca.c, linebuffer.c, xmalloc.c, xalloc.h: Update from gnulib.
4497         * exclude.c, getgroups.c, quotearg.c, stdbool_.h: Update from gnulib.
4498         * hash.c, hash-pjw.h: Update from gnulib.
4499
4500 2003-10-25  Jim Meyering  <jim@meyering.net>
4501
4502         * hash.c, hash.h: Update from gnulib.
4503         * hash-pjw.c, hash-pjw.h: Likewise.
4504         * obstack.c, obstack.h: Likewise.
4505
4506 2003-10-25  Jim Meyering  <meyering@lucent.com>
4507
4508         * fts_.h: Include <features.h> only if _LIBC.
4509         [!_LIBC]: Define-away __THROW, __BEGIN_DECLS, __END_DECLS.
4510
4511 2003-10-19  Jim Meyering  <jim@meyering.net>
4512
4513         * vasnprintf.c (vasnprintf): Work around losing snprintf on
4514         e.g. HPUX 10.20.
4515
4516 2003-09-25  Jim Meyering  <jim@meyering.net>
4517             Bruno Haible  <bruno@clisp.org>
4518
4519         [Update from gnulib]
4520         This lets translators provide better translations for the
4521         "Written by ..." part of --version output.
4522         * version-etc.h: Include stdarg.h.
4523         (version_etc_copyright): Declare as readonly.
4524         (version_etc): Make this function variadic with a NULL-terminated list
4525         of author name strings.
4526         (version_etc_va): New declaration.
4527         * version-etc.c: Include stdarg.h, stdlib.h.
4528         (version_etc_copyright): Declare as readonly.
4529         (version_etc_va): New function. Provide a different translatable string
4530         for each possible number of authors < 10. Abbreviate when there are 10
4531         authors or more.
4532         (version_etc): Make this function variadic. Call version_etc_va.
4533         Suggestion from Gary V. Vaughan.
4534
4535         * long-options.h (parse_long_options): Change prototype: the authors
4536         string is moved to the end and becomes variadic.
4537         * long-options.c: Include stdarg.h.
4538         (parse_long_options): Make this function variadic, too.
4539         Call version_etc_va, not version_etc.
4540
4541 2003-10-17  Jim Meyering  <jim@meyering.net>
4542
4543         * xfts.c, xfts.h: New files.
4544         This factors out code used by du.c, chmod.c, and chown-core.c.
4545         * Makefile.am (libfetish_a_SOURCES): Add xfts.c and xfts.h.
4546
4547         * error.h: Update from gnulib.
4548         * getpass.c: Likewise.
4549         * fnmatch.c: Likewise.
4550         * fnmatch_loop.c: Likewise.
4551
4552 2003-10-16  Jim Meyering  <jim@meyering.net>
4553
4554         * xmalloc.c: Include <string.h>, for declarations of memset and memcpy.
4555
4556         * getgroups.c: Update from gnulib.
4557         * readutmp.c: Fix indentation, from gnulib.
4558         * exclude.c: Update from gnulib.
4559         * xgethostname.c: Include xgethostname.h.
4560         * xgethostname.h: New file, from gnulib.
4561         * Makefile.am (libfetish_a_SOURCES): Add xgethostname.h.
4562
4563 2003-10-15  Jim Meyering  <jim@meyering.net>
4564
4565         * userspec.h: New file.
4566         * userspec.c: Include "userspec.h".
4567         * Makefile.am (libfetish_a_SOURCES): Add userspec.h.
4568
4569 2003-10-14  Paul Eggert  <eggert@twinsun.com>
4570
4571         Fix some number-parsing bugs, e.g., "head -n 100k@" wasn't
4572         properly diagnosed.
4573         * human.c, xstrtoimax.c, xstrtol.c, xstrtol.h, xstrtoul.c, xstrtoumax.c:
4574         Sync with gnulib.
4575
4576 2003-10-13  Paul Eggert  <eggert@twinsun.com>
4577
4578         * xalloc.h, xmalloc.c, xstrdup.c: Import latest version from gnulib.
4579
4580 2003-09-29  Paul Eggert  <eggert@twinsun.com>
4581
4582         * Makefile.am (libfetish_a_SOURCES): Add xstrtoimax.c.
4583
4584 2003-10-02  Jim Meyering  <jim@meyering.net>
4585
4586         Don't require that the maximum length of a file name
4587         encountered in a traversal fit in an `unsigned short',
4588         and fix some portability bugs (don't depend on gcc).
4589
4590         * fts.c: Include "fts_.h", not <fts.h>.
4591         (ALIGNBYTES) [!(__GNUC__ >= 2)]: Add a definition that works with
4592         compilers that don't have __alignof__.
4593         (MAX): Use a definition that doesn't depend on gcc.
4594         (fts_build): Make `len' and `maxlen' be of type size_t, not int.
4595         Test for overflow in a less type-dependent manner.
4596         Test HAVE_STRUCT_DIRENT_D_TYPE, rather than
4597         defined DT_DIR && defined _DIRENT_HAVE_D_TYPE.
4598         (fts_palloc): Test for overflow in a less type-dependent manner.
4599         (fts_safe_changedir): Use stat, not stat64.
4600         Use fstat, not __fxstat64(_STAT_VER.
4601
4602         * fts_.h [FTS] (fts_pathlen): Change type from int to size_t.
4603         [FTSENT] (fts_pathlen): Change type from u_short to size_t.
4604         (fts_level): Change type from u_short to int.
4605
4606         * Makefile.am (libfetish_a_SOURCES): Add fts.c fts_.h.
4607         Remove ftw_.h.
4608
4609 2003-09-29  Paul Eggert  <eggert@twinsun.com>
4610
4611         * strftime.c (tm_diff) [! HAVE_TM_GMTOFF]:
4612         Fix arg typo in previous patch.
4613
4614 2003-09-28  Jim Meyering  <jim@meyering.net>
4615
4616         * error.c: Update from gnulib.
4617
4618 2003-09-19  Jim Meyering  <jim@meyering.net>
4619
4620         * version-etc.h: (version_etc): Rename parameter, authors,
4621         to written_by.
4622         * version-etc.c: (version_etc): Likewise.
4623         Combine fprintf and following putc('\n'.
4624
4625         * version-etc.c, version-etc.h: Revert yesterday's changes.
4626         * long-options.c, long-options.h: Likewise.
4627
4628 2003-09-18  Jim Meyering  <jim@meyering.net>
4629
4630         This lets translators provide better translations for the
4631         `Written by ...' part of --version output.
4632         * version-etc.c: Include stdarg.h, stdlib.h, string.h, and xalloc.h.
4633         (version_etc): Make this function variadic,
4634         with a NULL-terminated list of author name strings.
4635         (version_etc_va): New function.
4636         Suggestion from Gary V. Vaughan.
4637         * version-etc.h (version_etc_va): Declare it.
4638
4639         * long-options.c: Include stdarg.h.
4640         (parse_long_options): Make this function variadic (authors), too.
4641         Call version_etc_va, not version_etc.
4642         * long-options.h (parse_long_options): Update prototype.
4643
4644 2003-09-16  Paul Eggert  <eggert@twinsun.com>
4645
4646         * linebuffer.c (readlinebuffer): Return NULL immediately upon
4647         input error, instead of returning NULL the next time we are called
4648         (and therefore losing track of errno).
4649
4650 2003-09-15  Paul Eggert  <eggert@twinsun.com>
4651
4652         * getndelim2.c (getndelim2): Don't trash errno when a read
4653         fails, so that the caller gets the proper errno.
4654
4655         * readutmp.c (read_utmp): Likewise.
4656         Check for fstat error.  Close stream and free storage
4657         when failing.
4658
4659 2003-09-14  Jim Meyering  <jim@meyering.net>
4660
4661         * argmatch.c: Update from gnulib.
4662
4663         * Makefile.am (libfetish_a_SOURCES): Add exit.h, strndup.h,
4664         time_r.c, time_r.h.
4665
4666 2003-09-13  Jim Meyering  <jim@meyering.net>
4667
4668         * setenv.c, strcspn.c, strdup.c, strndup.c, strnlen.c, strpbrk.c:
4669         * strstr.c, strtod.c, strtoimax.c, tempname.c, unicodeio.c, userspec.c:
4670         * vasprintf.h, xgethostname.c, xreadlink.c, xstrdup.c, xstrndup.c:
4671         * xstrndup.h, xstrtod.c, xstrtol.c, yesno.c: Update from gnulib.
4672         * strndup.h: New file, from gnulib.
4673         * exit.h: New file, from GNU gettext, via gnulib.
4674
4675 2003-09-06  Paul Eggert  <eggert@twinsun.com>
4676
4677         * time_r.c, time_r.h: New files.
4678
4679         * mktime.c (my_mktime_localtime_r): Remove; all uses changed to
4680         __localtime_r.
4681         (__localtime_r) [!defined _LIBC]: New macro.  Include <time_r.h>.
4682         (__mktime_internal) [!defined _LIBC]: Now extern, not static.
4683
4684         * strftime.c (my_strftime_gmtime_r): Remove; all uses changed to
4685         __gmtime_r.
4686         (my_strftime_localtime_r): Remove; all uses changed to __localtime_r.
4687         (__gtime_r, __localtime_r) [!HAVE_TM_GMTOFF]: New macros.
4688         Include <time_r.h>.
4689
4690 2003-09-13  Jim Meyering  <jim@meyering.net>
4691
4692         * strtol.c: Update from gnulib.
4693
4694 2003-09-12  Paul Eggert  <eggert@twinsun.com>
4695
4696         * argmatch.c, xgethostname.c, xmalloc.c: Include exit.h.
4697         * obstack.c [!defined _LIBC]: Likewise.
4698         * argmatch.c (EXIT_FAILURE): Remove; now done by exit.h
4699         * exitfail.c, fatal.c, xgethostname.c, xmalloc.c: Likewise.
4700         * exitfail.c: Don't include stdlib.h; no longer needed.
4701
4702 2003-09-12  Paul Eggert  <eggert@twinsun.com>
4703
4704         * error.c (error_tail): Assume vprintf.
4705
4706 2003-09-09  Paul Eggert  <eggert@twinsun.com>
4707
4708         More K&R removal.
4709
4710         * getloadavg.c (getloadavg, main): Define via prototypes.
4711
4712         * getopt.h (struct option.name): Assume C89, and use 'const'.
4713         (getopt, etopt_long, getopt_long_only, _getopt_internal)
4714         [defined __GNU_LIBRARY__]: Assume C89, so we can always declare
4715         with a prototype.
4716         * getopt.c (const): Remove macro.
4717         Include <string.h> unconditionally.
4718         (my_index): Remove; all uses changed to strchr.
4719         (strlen): Remove decl.
4720         (exchange): Remove forward decl; no longer needed.
4721         (exchange, _getopt_initialize, _getopt_internal, getopt, main):
4722         Define with prototype.
4723         * getopt1.c (const): Remove macro.
4724         (getopt_long, getopt_long_only, main): Define with prototype.
4725
4726         * getugroups.c: Include <string.h> unconditionally.
4727
4728         * getusershell.c: Include <stdlib.h> unconditionally.
4729         (getusershell, setusershell, endusershell, readname, main):
4730         Define with prototypes.
4731
4732         * group-member.c: Include group-member.h first.
4733         Include <stdlib.h> unconditionally.
4734
4735         * hard-locale.c: Include hard-locale.h first.
4736         Include <stdlib.h>, <string.h> unconditionally.
4737
4738         * hash.c (free, malloc): Remove decls.
4739         Include <stdlib.h> unconditionally.
4740
4741         * human.c: Include <stdlib.h>, <string.h> unconditionally.
4742         (getenv): Do not declare.
4743
4744         * idcache.c: Include <string.h> unconditionally.
4745
4746         * long-options.c: Include long-options.h first, to test interface.
4747         Include <stdlib.h> unconditionally.
4748
4749         * makepath.c: Include makepath.h first, to test interface.
4750         Include <stdlib.h> and <string.h> unconditionally.
4751
4752         * linebuffer.c: Include <stdlib.h>.
4753         (free): Remove decl.
4754
4755         * malloc.c: Include <stdlib.h>, for malloc; don't bother with stddef.h.
4756         rpl_malloc returns void *, not char *.
4757         * realloc.c (rpl_realloc): Likewise.  Also, define with a prototype.
4758
4759         * md5.h: Include <limits.h> unconditionally.
4760         (UINT_MAX_32_BITS): Don't worry about non-__STDC__ case.
4761         (__P): Remove; all uses removed.
4762         * md5.c: Include "md5.h" first.
4763         (md5_init_ctx, md5_read_ctx, md5_finish_ctx, md5_stream,
4764         md5_buffer, md5_process_bytes, md5_process_block):
4765         Define with prototypes.
4766         * sha.h (__P): Remove all uses.  (It wasn't defined??)
4767         * sha.c: Include "sha.h" first.
4768         Include <stdlib.h>, <string.h> unconditionally.
4769
4770         * memchr.c (__ptr_t): Remove; all uses changed to void *.
4771         * memcmp.c (__ptr_t): Likewise.
4772         * memrchr.c (__ptr_t): Likewise.
4773         * memchr.c, memcmp.c, memcoll.c, memrchr.c:
4774         Include <string.h> unconditionally.
4775         * memchr.c, memrchr.c: Include <limits.h> unconditionally.
4776         * memchr.c: Include <stdlib.h> unconditionally.
4777         * memchr.c (LONG_MAX): Remove.
4778         * memrchr.c (LONG_MAX): Likewise.
4779         * memchr.c (__memchr): Define via a prototype.
4780         * memrchr.c (__memrchr): Likewise.
4781         * memcmp.c (__P): Remove, and remove all uses.
4782         (memcmp_bytes, memcmp_common_alignment, memcmp_not_common_alignment):
4783         Remove forward decls; no longer needed.
4784         * memcpy.c, memmove.c, memset.c: Include <stddef.h>.
4785         Use types required by C89 in prototype.
4786
4787         * mkdir.c: Include <stdlib.h>, <string.h> unconditionally.
4788         * savedir.c: Likewise.
4789         * mkdir.c (free): Remove decl.
4790         * rmdir.c (rmdir): Define with a prototype.
4791         * savedir.c: Include savedir.h first, to test interface.
4792
4793         * mktime.c (STDC_HEADERS): Remove.
4794         Include <stdlib.h>, <string.h> unconditionally.
4795
4796         * modechange.c: Include <stdlib.h> unconditionally.
4797         (malloc): Remove decl.
4798
4799         * mountlist.c: Include <stdlib.h>, <string.h> unconditionally.
4800         (free): Remove decl.
4801
4802         * obstack.h (PTR_INT_TYPE) [!defined __PTRDIFF_TYPE__]:
4803         Define to ptrdiff_t, without bothering to check HAVE_STDDEF_H.
4804         (This type really should be intptr_t, but that's a C99ism.)
4805         (_obstack_memcpy): Remove: all uses changed to memcpy.
4806         Include <string.h> unconditionally.
4807         (struct obstack): Assume __STDC__ for types of members
4808         chunkfun, freefun, extra_arg.
4809         (_obstack_newchunk, _obstack_free, _obstack_begin, _obstack_begin_1,
4810         _obstack_memory_used, obstack_alloc_failed_handler, obstack_init,
4811         obstack_begin, obstack_specify_allocation,
4812         obstack_specify_allocation_with_arg, obstack_chunkfun,
4813         obstack_freefun, obstack_free) [! (defined __STDC__ && __STDC__)]:
4814         Remove unprototyped decls and the macros that use them.
4815         * obstack.c (POINTER): Remove.  All uses changed to void *.
4816         (obstack_alloc_failed_handler, CALL_CHUNKFUN, CALL_FREEFUN,
4817         _obstack_begin, _obstack_begin_1, _obstack_allocated_p)
4818         (defined __STDC__ && __STDC__)]:
4819         Remove nonprototyped code.
4820         Include <stdlib.h> unconditionally.
4821         (_obstack_begin, _obstack_begin_1, _obstack_newchunk,
4822         _obstack_allocated_p, _obstack_free, obstack_free,
4823         _obstack_memory_used, print_and_abort):
4824         Define using prototypes.
4825         (obstack_1grow, obstack_1grow_fast, obstack_alloc, obstack_base,
4826         obstack_blank, obstack_blank_fast, obstack_copy, obstack_copy0,
4827         obstack_finish, obstack_grow, obstack_grow0, obstack_make_room,
4828         obstack_next_free, obstack_object_size, obstack_room) [0]:
4829         Remove unused, unprototyped code.
4830
4831         * path-concat.c: Include <stdlib.h>, <string.h> unconditionally.
4832
4833         * physmem.c (physmem_total, physmem_available, main): Define
4834         with prototypes.
4835
4836         * posixtm.c: Include <stdlib.h>, <string.h> unconditionally.
4837         (main): Define with a prototype.
4838
4839         * posixver.c (getenv): Remove decl.
4840
4841         * putenv.c (malloc): Returns void *, not char *.
4842         Include <string.h> unconditionally.
4843         (strchr, memcpy, NULL): Do not define.
4844
4845         * readtokens.c: Include readtokens.h first, to test interface.
4846         Include <stdlib.h>, <string.h> unconditionally.
4847         (init_tokenbuffer): Define with a prototype.
4848
4849         * regex.c (PARAMS): Remove.  All uses removed.
4850         All uses of _RE_ARGS removed, too.
4851         Include <stddef.h>, <stdlib.h>, <string.h>, <limits.h>
4852         unconditionally.
4853         (bzero): Assume memset exists.
4854         (memcmp, memcpy, NULL): Remove.
4855         (SIGN_EXTEND_CHAR): Remove; all uses replaced by casts to signed
4856         char, or assignments to local vars of type signed char.
4857         (init_syntax_once, PREFIX(extract_number_and_incr),
4858         PREFIX(print_partial_compiled_pattern),
4859         PREFIX(print_compiled_pattern), PREFIX(print_double_string),
4860         convert_mbs_to_wcs, print_fastmap, re_set_syntax,
4861         PREFIX(regex_grow_registers), PREFIX(regex_compile),
4862         PREFIX(store_op1), PREFIX(store_op2), PREFIX(insert_op1),
4863         PREFIX(insert_op2), PREFIX(at_begline_loc_p),
4864         PREFIX(at_endline_loc_p), group_in_compile_stack, insert_space,
4865         wcs_compile_range, byte_compile_range, truncate_wchar,
4866         PREFIX(re_compile_fastmap), re_compile_fastmap, re_set_registers,
4867         re_search, re_search_2, PREFIX(re_search_2), re_match, re_match_2,
4868         count_mbs_length, wcs_re_match_2_internal,
4869         byte_re_match_2_internal, PREFIX(group_match_null_string_p),
4870         PREFIX(alt_match_null_string_p),
4871         PREFIX(common_op_match_null_string_p), PREFIX(bcmp_translate),
4872         re_compile_pattern, re_comp, re_exec, regcomp, regexec, regerror,
4873         regfree, PREFIX(extract_number)): Define with prototype.  Remove
4874         now-unnecessary declaration, if any.
4875         (byte_compile_range, PREFIX(regex_compile), re_comp, re_exec,
4876         regcomp, regexec):
4877         Remove now-unnecessary casts among pointer types.
4878         * regex.h (_RE_ARGS): Remove.  All uses removed.
4879
4880         * rename.c: Include <stdlib.h>, <string.h> unconditionally.
4881         (free): Remove decl.
4882
4883         * rpmatch.c: Include <stdlib.h> unconditionally.
4884
4885         * save-cwd.c: Include <stdlib.h> unconditionally.
4886         * xgetcwd.c: Likewise.
4887
4888         * stat.c: Include <stdlib.h>, <string.h> unconditionally.
4889         (free): Remove decl.
4890
4891         The following changes are not K&R related:
4892
4893         * group-member.h: Include <sys/types.h>, so that this file is
4894         self-contained.
4895         * makepath.h: Likewise.
4896
4897         * getusershell.c (readname, default_index, line_size, readname):
4898         Use size_t, not int, for sizes.
4899         (readname): If the size overflows, report an error instead of
4900         looping forever.
4901
4902 2003-09-09  Derek Robert Price  <derek@ximbiot.com>
4903
4904         * getndelim2.c: Assume stdlib.h per the C89 spec.
4905
4906 2003-09-08  Paul Eggert  <eggert@twinsun.com>
4907
4908         Assume C89 or better; remove K&R cruft.
4909         A few of these changes were first proposed by Derek Robert Price
4910         in <http://mail.gnu.org/archive/html/bug-gnulib/2003-07/msg00105.html>.
4911
4912         * addext.c: Include <string.h> unconditionally.
4913         * backupfile.c: Include <string.h>, <stdlib.h> unconditionally.
4914         Don't declare getenv or malloc.
4915
4916         * alloca.c: Include <string.h>, <stdlib.h> unconditionally.
4917         (POINTER_TYPE, pointer): Remove; all uses changed to void *.
4918         (NULL): Remove.
4919         (find_stack_direction, alloca): Use prototypes.
4920
4921         * atexit.c (atexit): Define using a prototype.
4922
4923         * basename.c, dirname.c, stripslash.c:
4924         Include <string.h> unconditionally.
4925
4926         * bcopy.c: Include <stddef.h>.
4927         (bcopy): Define with prototype, using 'const' and 'void' and 'size_t'.
4928
4929         * canon-host.c: Include <stdlib.h>, <string.h> unconditionally.
4930
4931         * error.h (error, error_at_line, error_print_progname)
4932         [! (defined (__STDC__) && __STDC__)]: Remove decls.
4933         * error.c: Include error.h first, to check interface.
4934         Include <stdarg.h>, <stdlib.h>, <string.h> unconditionally.
4935         (VA_START): Remove; all uses changeed to va_start.
4936         (exit, strerror): Remove decls.
4937         (error_print_progname): Prototype uncondionally.
4938         Don't include <errno.h>; no longer needed.
4939         (private_strerror): Remove.
4940         (error_tail): Always define.
4941         (error, error_at_line): Assume C89 or better; always use prototypes.
4942
4943         * euidaccess.c (main): Define with a prototype.
4944
4945         * exclude.c: Include <stdlib.h>, <string.h> unconditionally.
4946
4947         * exitfail.c: Include <stdlib.h> unconditionally.
4948
4949         * fnmatch_.h (__P): Remove.  All uses changed to assume prototypes.
4950         * fnmatch.c: Include fnmatch.h first, to test interface.
4951         Include <string.h>, <stddef.h>, <stdlib.h> unconditionally.
4952         (getenv): Remove decl.
4953         (fnmatch): Define using a prototype.
4954         * fnmatch_loop.c (FCT): Remove forward decl; no longer needed.
4955         (FCT): Define using a prototype.
4956
4957         * getdate.y: Include <stdlib.h>, <string.h> unconditionally.
4958
4959         * gethostname.c: Include <stddef.h>.
4960         (gethostname): Define with prototype.  Length is size_t, not int.
4961
4962 2003-09-08  Paul Eggert  <eggert@twinsun.com>
4963
4964         * utime.c [!HAVE_UTIMES_NULL]: Include <sys/stat.h>, <fcntl.h>.
4965         (utime_null): Fix typo: 'st' was sometimes called 'sb'.
4966
4967 2003-09-09  Jim Meyering  <jim@meyering.net>
4968
4969         * getversion.c: Remove unused file.  Reported by Paul Eggert.
4970
4971 2003-09-03  Paul Eggert  <eggert@twinsun.com>
4972
4973         * human.c (human_readable): Fix bug that rounded 10501 to 10k.
4974         Bug reported by Lute Kamstra in
4975         <http://mail.gnu.org/archive/html/bug-gnulib/2003-09/msg00003.html>.
4976
4977         * getdate.y (relative_time_table): Use tDAY_UNIT for "tomorrow",
4978         "yesterday", "today", and "now" rather than tMINUTE_UNIT.  Of
4979         course with correspondingly smaller numbers for tomorrow and
4980         yesterday.  From Tadayoshi Funaba.  Originally installed into
4981         sh-utils on 1999-08-07, but the patch was mistakenly reverted by
4982         the next change to that shared file (but this time in fileutils)
4983         on 1999-08-29.
4984
4985 2003-08-18  Paul Eggert <eggert@twinsun.com>
4986
4987         * same.c: Include <stdlib.h> and <string.h> unconditionally,
4988         as we're now assuming that part of hosted C89.
4989         (free) [!HAVE_DECL_FREE]: Remove decl; no longer needed.
4990         (same_name): Invoke pathconf on destination, not source, as
4991         that's a bit clearer even if they are the same dir.
4992
4993 2003-08-18  Jim Meyering  <jim@meyering.net>
4994
4995         * getopt.h: Remove space before TAB.
4996
4997 2003-08-17  Paul Eggert  <eggert@twinsun.com>
4998
4999         * same.c: Include <stdbool.h>, <limits.h>.
5000         (_POSIX_NAME_MAX): Define if not defined.
5001         (MIN): New macro.
5002         (same_name): If file names are silently truncated, report
5003         that the file names are the same if they are the same after
5004         the silent truncation.
5005
5006 2003-08-16  Paul Eggert  <eggert@twinsun.com>
5007
5008         Merge from gnulib.
5009         * Makefile.am (libfetish_a_SOURCES): Remove getndelim2.c,
5010         getndelim2.h, xstrtoimax.c.  Add localcharset.h.
5011         (CLEANFILES, SUFFIXES): Initialize to empty.
5012         (EXTRA_DIST): Add getndelim2.c, getndelim2.h.
5013         (install-exec-local): Use $(GLIBC21), not @GLIBC21@.
5014         Do not mkdir libdir if not glibc21.
5015         (charset.alias): @host@ -> $(host).
5016         (SUFFIXES, .sin.sed, CLEANFILES): Reorder rules
5017         to match gnulib module suggestions.
5018         * localcharset.h, readlink.c: New files, from gnulib.
5019         * asnprintf.c, asnprintf.c, asprintf.c, backupfile.h,
5020         canon-host.c, config.charset, dirname.h, euidaccess.c, exclude.c,
5021         fsusage.h, full-write.c, getloadavg.c, getndelim2.h, gettext.h,
5022         group-member.h, hard-locale.h, hash.c, hash.h, hash-pjw.c,
5023         localcharset.c, long-options.h, makepath.h, malloc.c, mbswidth.c,
5024         mbswidth.h, md5.h, memcasecmp.c, memcasecmp.h, memcoll.h,
5025         mkstemp.c, modechange.h, mountlist.h, path-concat.h, pathmax.h,
5026         physmem.h, posixtm.h, printf-args.c, printf-args.h,
5027         printf-parse.c, printf-parse.h, putenv.c, quote.h, readutmp.h,
5028         ref-add.sin, ref-del.sin, safe-read.c, savedir.h, setenv.c,
5029         setenv.h, stdbool_.h, strnlen.c, strpbrk.c, strtoimax.c,
5030         strverscmp.h, tempname.c, unicodeio.c, unicodeio.h,
5031         unistd-safer.h, unlocked-io.h, vasnprintf.c, vasnprintf.h,
5032         vasprintf.c, vasprintf.h, version-etc.h, xgethostname.c,
5033         xmemcoll.c, xstrtoimax.c, xstrtoumax.c: Sync with gnulib.
5034
5035 2003-08-15  Paul Eggert  <eggert@twinsun.com>
5036
5037         * physmem.c: Include "physmem.h" before system includes.
5038
5039 2003-08-10  Jim Meyering  <jim@meyering.net>
5040
5041         * utimens.c (utimens): Revert most of last change.
5042         Test HAVE_WORKING_UTIMES instead of HAVE_UTIMES.
5043
5044 2003-08-09  Jim Meyering  <jim@meyering.net>
5045
5046         * utimens.c (utimens): Test HAVE_UTIME, not HAVE_UTIMES.
5047         Prefer utime, since it works and utimes doesn't on some systems.
5048         FIXME: Revert the above change once we have a working utimes
5049         replacement function.
5050
5051 2003-08-06  Paul Eggert  <eggert@twinsun.com>
5052
5053         * Makefile.am (libeftish_a_SOURCES): Add utimens.c, utimens.h.
5054         * utimens.c, utimens.h: New files.
5055
5056 2003-08-09  Jim Meyering  <jim@meyering.net>
5057
5058         * unicodeio.c (unicode_to_mb): Change to `Solaris 5.7' in comment.
5059         * putenv.c: Likewise.
5060
5061         * fatal.c, fatal.h: Remove unused files.
5062
5063         * Makefile.am: Use the e.g., `$(FNMATCH_H)' notation for AC_SUBST'd
5064         variable names, rather than @FNMATCH_H@.
5065         Likewise for $(ALLOCA_H).
5066         (fnmatch.h): Use `$@' in the commands, in place of the three copies
5067         of the literal target, `fnmatch.h'.
5068         (alloca.h): Likewise.
5069
5070 2003-08-08  Paul Eggert  <eggert@twinsun.com>
5071
5072         * Makefile.am (libfetish_a_SOURCES): Remove fnmatch_.h.
5073         (lib_OBJECTS): New macro, for convenience when cutting and
5074         pasting Makefile.am templates from gnulib.
5075         (EXTRA_DIST): Remove fnmatch_loop.c.
5076         (BUILT_SOURCES): Append $(FNMATCH_H).
5077         * Makefile.am: Import the following changes from gnulib templates
5078         for alloca and fnmatch):
5079         (all-local $(lib_OBJECTS)): New dependencies.
5080         (alloca.h): Use alloca.h-t for temporary.
5081         (EXTRA_DIST): Append fnmatch_.h, fnmatch_loop.c.
5082         (fnmatch.h): New rule.
5083         (MOSTLYCLEANFILES): Add fnmatch.h, fnmatch.h-t.
5084         (DISTCLEANFILES): Remove fnmatch.h
5085
5086 2003-08-08  Jim Meyering  <jim@meyering.net>
5087
5088         * mountlist.c (read_filesystem_list) [MOUNTED_GETFSSTAT]:
5089         Use MNT_NOWAIT, rather than MNT_WAIT.  Otherwise, `df DIR' could
5090         hang on OSF/1 5.1 for DIR on both local and remote file systems.
5091         Reported by (and fix confirmed by) Nelson H. F. Beebe.
5092
5093 2003-08-07  Jim Meyering  <jim@meyering.net>
5094
5095         * regex.h (RE_SYNTAX_POSIX_AWK): Remove SPACE in SPACE-TAB sequence.
5096
5097 2003-08-05  Paul Eggert  <eggert@twinsun.com>
5098
5099         Merge getline from gnulib.
5100         * getline.h, getline.c: Merge from gnulib.
5101         * getndelim2.h, getndelim2.c: New files, from gnulib.
5102         * getdelim2.c, getdelim2.h: Remove.
5103         * Makefile.am (libfetish_a_SOURCES): Change getdelim2.c and
5104         getdelim2.h to getndelim2.c and getndelim2.h.
5105
5106 2003-08-04  Paul Eggert  <eggert@twinsun.com>
5107
5108         * regex.c, regex.h: Sync with gnulib.
5109
5110 2003-08-03  Paul Eggert  <eggert@twinsun.com>
5111
5112         * stdbool_.h (_Bool): Use a #define, not a typedef.
5113
5114 2003-07-31  Paul Eggert  <eggert@twinsun.com>
5115
5116         * bumpalloc.h: Remove.
5117         * Makefile.am (libfetish_a_SOURCES): Remove bumpalloc.h.
5118
5119 2003-07-28  Jim Meyering  <jim@meyering.net>
5120
5121         * stdbool_.h: Renamed from stdbool.hin.
5122         * Makefile.am: Reflect renaming: stdbool.hin -> stdbool_.h.
5123         * stdbool.hin: Remove file.
5124
5125 2003-07-28  Paul Eggert  <eggert@twinsun.com>
5126
5127         * stdbool.hin (_Bool): Make it signed char, instead of
5128         an enum type, so that it's guaranteed to promote to int.
5129
5130 2003-07-23  Jim Meyering  <jim@meyering.net>
5131
5132         * xstrndup.h: New file.
5133         * xstrndup.c: New file, factored out of dircolors.c from coreutils.
5134         * Makefile.am (libfetish_a_SOURCES): Add xstrndup.c and xstrndup.h.
5135
5136 2003-07-23  Jim Meyering  <jim@meyering.net>
5137
5138         * lstat.c, save-cwd.c, stat.c, utime.c, xgethostname.c: Normalize
5139         naming of Sun operating systems in comments, e.g., SunOS4 -> SunOS 4,
5140         Solaris5.9 -> Solaris 9.  From Paul Eggert.
5141
5142 2003-07-22  Paul Eggert  <eggert@twinsun.com>
5143
5144         * xalloc.h (XCALLOC, XREALLOC, CCLONE): Fix under- and
5145         over-parenthesization in macros.
5146
5147 2003-07-18  Paul Eggert  <eggert@twinsun.com>
5148
5149         * closeout.h (close_stdout_set_status, close_stdout_status): Remove.
5150         * closeout.c: Likewise.  Include "closeout.h" right after config.h,
5151         to test that it can stand by itself.  Include "exitfail.h".
5152         Clients should set exit_failure instead.
5153         (EXIT_FAILURE): Remove; no longer needed.  Do not include <stdlib.h>.
5154
5155 2003-07-18  Andreas Schwab  <schwab@suse.de>
5156
5157         * memcoll.c (memcoll) [!HAVE_STRCOLL]: Clear errno.
5158
5159 2003-07-17  Paul Eggert  <eggert@twinsun.com>
5160
5161         * xalloca.h, xmalloc.c, xmemcoll.c, xmemcoll.h:
5162         Merge with gnulib.  Use a single exit_failure variable rather
5163         than a separate one for each module.
5164
5165 2003-07-16  Jim Meyering  <jim@meyering.net>
5166
5167         * Makefile.am (AM_CPPFLAGS): Rename from `INCLUDES', to avoid
5168         warning from automake -Wall.
5169
5170 2003-07-14  Jim Meyering  <jim@meyering.net>
5171
5172         * save-cwd.h: Add copyright.
5173
5174 2003-07-13  Jim Meyering  <jim@meyering.net>
5175
5176         * xgethostname.c: Include <stdlib.h> for declaration of free.
5177         (xgethostname): Return NULL, rather than exiting, upon any
5178         non-malloc/realloc error.
5179
5180 2003-07-12  Jim Meyering  <jim@meyering.net>
5181
5182         * Makefile.am (BUILT_SOURCES): Use `BUILT_SOURCES += $(STDBOOL_H)'
5183         rather than `all-local: $(STDBOOL_H)'.  The latter didn't force
5184         creation of stdbool.h before most other targets.
5185         Likewise for $(ALLOCA_H).
5186
5187         Don't emit diagnostics.  Let callers do that.
5188         * save-cwd.c: Don't include "error.h".
5189         (save_cwd): Don't call error.  Ensure that errno is valid
5190         when returning nonzero.
5191
5192         * obstack.h: Update from gnulib.
5193
5194         * makepath.c (make_path): Enclose diagnostic in _(...).
5195
5196 2003-07-10  Jim Meyering  <jim@meyering.net>
5197
5198         * userspec.c: Include "posixver.h".
5199         (parse_user_spec): Accept `.' as a separator only
5200         in pre-POSIX-200112 mode.
5201
5202         * Makefile.am (libfetish_a_SOURCES): Add these:
5203         printf-args.h, printf-parse.h, vasprintf.h, vasnprintf.h.
5204
5205         Now that a program (`who') uses asprintf, we need all of these:
5206         * asnprintf.c, asprintf.c, printf-args.c, printf-args.h, printf-parse.c:
5207         * printf-parse.h, vasnprintf.c, vasnprintf.h, vasprintf.c, vasprintf.h:
5208         New files, from gnulib.
5209
5210         * alloca_.h, getpass.c, memrchr.c, obstack.h, posixver.c,
5211         strftime.c, strnlen.c, strverscmp.c: Switch from LGPL to GPL.
5212
5213 2003-07-09  Jim Meyering  <jim@meyering.net>
5214
5215         * mktime.c: Update from gnulib.
5216         FIXME: but still need to adjust m4/mktime.c so that this fixed
5217         version is used when needed.
5218
5219         Fix the bug that would make `du /' omit the `/' on the last line.
5220         E.g., `du --exclude '[^/]*' -x /' would print only "4\t\n" for me.
5221         * ftw.c (ftw_dir): Don't clobber the leading `/'.
5222         Reported by Chris Lesniewski as http://bugs.debian.org/200542.
5223
5224 2003-07-04  Jim Meyering  <jim@meyering.net>
5225
5226         Update from gnulib.
5227         * xreadlink.c: Include <sys/types.h> unconditionally, instead of
5228         having it depend on HAVE_SYS_TYPES_H.
5229
5230 2003-06-18  Jim Meyering  <jim@meyering.net>
5231
5232         * inttostr.h (PARAMS): Remove.  All uses removed.
5233
5234         Merge in change from gnulib.
5235         * makepath.c: Remove block of alloca-related code in favor
5236         of an unconditional `#include <alloca.h>'.
5237
5238         * xalloc.h: Include <stddef.h>.
5239         Remove unnecessary parentheses.
5240         Use `1990-2000' notation in Copyright line until Emacs'
5241         copyright-update function learns how to handle a comma-separated
5242         list of years that spans a line boundary.
5243
5244         * Makefile.am (libfetish_a_SOURCES): Add getdelim2.c and getdelim2.h.
5245
5246         * getline.c (getdelim2): Move this function into its own file.
5247         * getdelim2.c: Extracted from getline.c.
5248
5249         * linebuffer.c, linebuffer.h: Update from gnulib.
5250
5251         * getdelim2.c, getdelim2.h: New files.
5252         * getstr.c, getstr.h: Remove files.
5253
5254         * same.h: Update from gnulib.
5255         * xstrtol.h: Update from gnulib.
5256
5257 2003-06-17  Paul Eggert  <eggert@twinsun.com>
5258
5259         Assume C89, so PARAMS isn't needed.
5260         * backupfile.h (PARAMS): Remove.  All uses removed.
5261         * closeout.h, dirname.h, filemode.h, fsusage.h, getdate.h, getline.h,
5262         group-member.h, hard-locale.h, hash.h, linebuffer.h, long-options.h,
5263         makepath.h, memcasecmp.h, memcoll.h, modechange.h, mountlist.h,
5264         path-concat.h, physmem.h, posixtm.h, quote.h, readutmp.h, same.h,
5265         save-cwd.h, savedir.h, stdio-safer.h, strtoimax.c, strverscmp.h,
5266         unistd-safer.h, version-etc.h, xalloc.h, xreadlink.h, xstrtod.h,
5267         xstrtol.h: Likewise.
5268         * filemode.h, hard-locale.h, memcoll.h, modechange.h, physmem.h, same.h,
5269         * strverscmp.h: Do not include config.h; no longer needed.
5270         Anyway, config.h should always be included before any other file.
5271
5272 2003-06-17  Jim Meyering  <jim@meyering.net>
5273
5274         * getline.c: Update from gnulib.
5275
5276         Merge in changes from gnulib.
5277         * hash.c: Include <stdbool.h> unconditionally.
5278         Include <limits.h>.
5279         (CHAR_BIT): Don't define.
5280
5281 2003-06-09  John David Anglin  <dave.anglin@nrc-cnrc.gc.ca>
5282
5283         * acl.c: Include <sys/types.h> before <sys/stat.h>.
5284         Required on Ultrix 4.3.
5285
5286 2003-05-20  Derek Price  <derek@ximbiot.com>
5287
5288         * stat.c [LSTAT]: Compile/use slash_aware_lstat only if it is necessary.
5289
5290 2003-06-10  Jim Meyering  <jim@meyering.net>
5291
5292         * getdate.y: Also accept dates of the form May-23-2003.
5293         Suggestion from Karl Berry.
5294
5295 2003-06-09  Jim Meyering  <jim@meyering.net>
5296
5297         * gettimeofday.c: Also undefine gmtime.
5298         (rpl_gmtime): New function.  Suggestion from Paul Eggert.
5299
5300 2003-06-08  Jim Meyering  <jim@meyering.net>
5301
5302         * getline.h: Update from gnulib.
5303
5304         Clean up, as part of merge with emacs version of strftime.c.
5305         * strftime.c (my_strftime) [!_LIBC && HAVE_TZNAME && HAVE_TZSET]:
5306         Remove function, now that we can rely on a working tzset function.
5307         [!_LIBC]: Ensure that the required autoconf test has been run.
5308         * gettimeofday.c: Also undef tzset.
5309         (rpl_tzset): New function, for use by new macro, gl_FUNC_TZSET_CLOBBER.
5310
5311 2003-06-07  Jim Meyering  <jim@meyering.net>
5312
5313         * readtokens.h: Add copyright notice.
5314         Include <stdio.h>.
5315         Remove definition and uses of __P.
5316
5317         * readtokens.c: Put `Free Software Foundation, Inc.' in place of
5318         my name in the copyright comment.
5319         (init_tokenbuffer): Remove unnecessary parentheses around malloc.
5320
5321         Update from gnulib.
5322         * getdate.y: Include alloca.h unconditionally.
5323         * xmemcoll.h: Include <stddef.h>.
5324
5325         * Makefile.am (MOSTLYCLEANFILES): Add alloca.h and alloca.ht.
5326         (MOSTLYCLEANFILES): Add stdbool.ht.
5327
5328         * human.c: Include <stdio.h>, once again, for declaration of sprintf.
5329
5330         Update from gnulib.
5331         * tempname.c: Include <stddef.h> unconditionally.
5332         Include <inttypes.h> as an alternative to <stdint.h>.
5333         * strtoimax.c: Include <stdint.h> as an alternative to <inttypes.h>.
5334         * xstrtol.h: Likewise.
5335         * xstrtoimax.c: Likewise.
5336         * xstrtoumax.c: Likewise.
5337
5338         Update from gnulib.
5339         * strcasecmp.c: Include <stddef.h>, not <sys/types.h>.
5340         * savedir.c: Include <stddef.h>.
5341         (NULL): Don't define, since <stddef.h> does that.
5342
5343 2003-06-06  Jim Meyering  <jim@meyering.net>
5344
5345         Update from gnulib.
5346         * rpmatch.c: Include <limits.h> without checking for HAVE_LIMITS_H.
5347         Include <stddefs.h> unconditionally.
5348         (NULL): Don't define, since <stddef.h> does that.
5349         * rename.c: #undef rename before defining rpl_rename.
5350         [HAVE_CONFIG_H]: Guard inclusion of config.h.
5351         * putenv.c: Include <stddef.h> rather than <sys/types.h>,
5352         as we merely need size_t.
5353         * realloc.c: Likewise.
5354         * quote.c: Don't include <stddef.h> or <sys/types.h>; not needed.
5355         * modechange.c: Include <stddef.h>.
5356         (NULL): Don't define, since <stddef.h> does that.
5357         * memcoll.h: Include <stddef.h>, to get size_t.
5358         * memcoll.c: Include "memcoll.h", which gets us size_t and checks
5359         our interface, instead of including <sys/types.h>
5360         (memcoll): Fall back on a simple algorithm using
5361         memcmp if strcoll doesn't work.
5362         * memcasecmp.h: Include <stddef.h>.
5363         * memcasecmp.c: Don't include <sys/types.h>.
5364
5365         From gnulib.
5366         * alloca_.h: New file.
5367         * Makefile.am (EXTRA_DIST): Add alloca_.h.
5368         (all-local $(lib_OBJECTS)): Depend on $(ALLOCA_H).
5369         (alloca.h): New rule.
5370
5371         * addext.c: Update from gnulib.
5372         * backupfile.c: Likewise.
5373         * config.charset: Likewise.
5374         * dirname.h: Likewise.
5375         * fsusage.c: Likewise.
5376         * userspec.c: Likewise.
5377         * xreadlink.c: Likewise.
5378         * xstrtol.c: Likewise.
5379         * __fpending.h: Likewise.
5380
5381         * md5.c: Include <string.h> and <stdlib.h> unconditionally.
5382         (memcpy): Remove definition.
5383
5384         * posixtm.c: Include <stdbool.h> unconditionally.
5385
5386 2003-06-05  Jim Meyering  <jim@meyering.net>
5387
5388         From gnulib.
5389         * mktime.c: Assume freestanding C89 or better.
5390         (HAVE_LIMITS_H): Remove.  Assume it's 1.
5391         (__P): Remove; not used.
5392         (CHAR_BIT, INT_MIN, INT_MAX): Remove; <limits.h> defines them.
5393         (mktime, not_equal_tm, print_tm, check_result,
5394         main): Use prototypes.  Use const * where appropriate.
5395         (main): Fix typo in testing code that uncovered by above changes.
5396         (Local Variables): Remove -DHAVE_LIMITS_H from compile-command.
5397
5398 2003-06-04  Paul Eggert  <eggert@twinsun.com>
5399
5400         Merge human.c etc. from gnulib.
5401         * exclude.c, human.c, human.h: Merge from gnulib.
5402         * cycle-check.c, cycle-check.h, src/system.h:
5403         Include <stdbool.h> unconditionally.
5404
5405 2003-06-02  Jim Meyering  <jim@meyering.net>
5406
5407         * stdbool.hin: New file.  From gnulib.
5408         * Makefile.am (MOSTLYCLEANFILES): Initialize.
5409         (stdbool.h): New rule.
5410         (all-local $(lib_OBJECTS)): Depend on $(STDBOOL_H)
5411         (MOSTLYCLEANFILES): Add stdbool.h.
5412         (EXTRA_DIST): Add stdbool.h.
5413
5414 2003-05-30  Jim Meyering  <jim@meyering.net>
5415
5416         * addext.c: Update from gnulib.
5417         * mktime.c: Likewise.
5418
5419 2003-05-29  Jim Meyering  <jim@meyering.net>
5420
5421         Make the %r format directive honor any locale setting.
5422         * strftime.c: (my_strftime) [!defined _NL_CURRENT && HAVE_STRFTIME]:
5423         Use underlying_strftime for %r.
5424
5425 2003-05-15  Jim Meyering  <jim@meyering.net>
5426
5427         * getopt.h: Remove a space before a TAB.
5428
5429 2003-05-13  Jim Meyering  <jim@meyering.net>
5430
5431         * setenv.c (setenv): Don't apply cast to argument of free.
5432         * putenv.c (rpl_putenv): Likewise.
5433         * alloca.c (alloca): Likewise.
5434
5435 2003-05-12  Jim Meyering  <jim@meyering.net>
5436
5437         * ftw.c (ftw_startup): Always call free_cwd after restore_cwd.
5438         Reported by Matti Aarnio as
5439         https://bugzilla.redhat.com/bugzilla/show_bug.cgi?id=90563.
5440         Forwarded by Tim Waugh.
5441
5442         * strftime.c (my_strftime): Let the `-' (no-pad) flag affect
5443         the space-padded-by-default conversion specifiers, %e, %k, %l.
5444
5445 2003-05-07  Paul Eggert  <eggert@twinsun.com>
5446
5447         * xnanosleep.c (timespec_subtract): Don't modify the 2nd arg.
5448         Work even if X-Y overflows when subtracting.  Make explicit the
5449         assumption that tv_nsec must be in range.
5450         (clock_get_realtime): Remove.  All callers changed to invoke gettime,
5451         for simplicity.
5452         (xnanosleep): Check for gettime failure every time.
5453
5454 2003-05-06  Jim Meyering  <jim@meyering.net>
5455
5456         * xnanosleep.c (clock_get_realtime): Use gettime.c's gettime function,
5457         rather than an inferior, open-coded version that would fail on
5458         AIX systems due to clock_gettime failing with errno == ENOSYS.
5459         Reported by Jérôme Zago.
5460
5461 2003-05-05  Jim Meyering  <jim@meyering.net>
5462
5463         Avoid array overrun.
5464         * ftw.c (nftw_arr): Update to reflect complete list of members.
5465         (ftw_arr): Likewise
5466         Reported by Olatunji Oluwabukunmi Ruwase.
5467
5468         Make it less likely that the above can happen again.
5469         * ftw.c (struct dummy): Ensure that at least the number of
5470         initializers matches the number of members in the corresponding enum.
5471         * ftw_.h (enum Ftw_option): Name this previously-anonymous enum.
5472         (enum Ftw_option) [FTW_N_MEMBERS]: New member.
5473
5474 2003-05-04  Jim Meyering  <jim@meyering.net>
5475
5476         * setenv.c (__set_errno, LOCK, UNLOCK): Define.
5477         (unsetenv): Update from GNU libc.
5478         Ifdef-out this function, since the only caller
5479         is putenv.c and that file now has its own copy.
5480
5481         This avoids a core dump on systems without GNU putenv,
5482         when running `env -u SOME_ALREADY_UNSET_VARIABLE'.
5483         * putenv.c (__set_errno, LOCK, UNLOCK): Define.
5484         (unsetenv): New static function, from GNU libc.
5485         (rpl_putenv): Use it.
5486
5487 2003-05-02  Jim Meyering  <jim@meyering.net>
5488
5489         * canonicalize.c (canonicalize_file_name) [!HAVE_RESOLVEPATH]:
5490         A memory-allocation error could result in heap corruption.  Fix it
5491         by also updating `dest' when rpath may be changed by xrealloc.
5492
5493 2003-04-15  Jim Meyering  <jim@meyering.net>
5494
5495         * getloadavg.c: Remove (or replace-with-TAB(s) to retain alignment)
5496         each sequence of spaces before a TAB character.
5497         * md5.c, getopt.c, getopt.h, obstack.h, strftime.c: Likewise.
5498
5499 2003-04-11  Jim Meyering  <jim@meyering.net>
5500
5501         * readutmp.c: Include <string.h> and <stdlib.h> unconditionally.
5502
5503         * canonicalize.c, exclude.c, getgroups.c, getusershell.c:
5504         * group-member.c, idcache.c, mountlist.c, readtokens.c, readutmp.c:
5505         * bumpalloc.h: Remove anachronistic casts of xmalloc, xrealloc,
5506         and xcalloc return values.
5507
5508         * xalloc.h (PARAMS): Remove definitions and uses.
5509         (XMALLOC, XCALLOC, XREALLOC): Remove unnecessary casts.
5510
5511         * xmalloc.c: Remove use of PARAMS.
5512
5513 2003-04-10  Jim Meyering  <jim@meyering.net>
5514
5515         * canonicalize.c (canonicalize_file_name) [HAVE_RESOLVEPATH]: Remove
5516         stray semicolon that caused `readlink --canonical RELATIVE_NAME' to
5517         fail on e.g., Solaris systems.  Reported by Bruce Korb.
5518         (canonicalize_file_name): Return NULL immediately if resolvepath fails.
5519         Otherwise, `readlink --canonical /no-such-file' would exhaust
5520         virtual memory on some systems (e.g. Solaris).
5521         (canonicalize_file_name): Always free `extra_buf' before returning.
5522         (canonicalize_file_name): NUL-terminate the result.
5523
5524 2003-04-05  Jim Meyering  <jim@meyering.net>
5525
5526         * Makefile.am (DEFS): Use += notation rather than `DEFS = ... @DEFS@'.
5527         Use $(VAR) rather than @VAR@, now that we can rely on automake to
5528         emit a definition for each substituted variable.
5529
5530 2003-03-26  Richard Dawe  <rich@phekda.freeserve.co.uk>
5531
5532         * dirname.c [TEST_DIRNAME]: Update build instructions for test.
5533         Add test-cases for DOS filenames. Declare program_name.
5534         (main): Set up program_name.
5535
5536 2003-03-22  Jim Meyering  <jim@meyering.net>
5537
5538         * strftime.c (widen): Cast alloca return value to proper type.
5539
5540         * fnmatch_loop.c
5541         (NEW_PATTERN): Cast alloca return value to proper type.
5542         Otherwise, it wouldn't compile with at least /bin/cc on
5543         ymp-cray-unicos9.0.2.X.
5544         Combine two mostly-identical uses of alloca into one.
5545         Thanks to the Cray-Cyber project for access to a Cray Y-MP.
5546
5547 2003-03-19  Jim Meyering  <jim@meyering.net>
5548
5549         DJGPP doesn't have S_ISLNK, so provide a replacement.
5550         * ftw.c (S_IFMT): Define, if necessary.
5551         [STAT_MACROS_BROKEN]: Undefine S_ISLNK.
5552         (S_ISLNK): Define, if necessary.
5553         Based on a patch from Rich Dawe.
5554
5555         * exclude.h (PARAMS): Remove definition and uses.
5556         * exclude.c: Remove uses of `PARAMS'.
5557
5558         * fnmatch_.h: Don't define __const.
5559         (fnmatch): Use const, not __const in prototype.
5560         From Paul Eggert.
5561
5562 2003-03-17  Richard Dawe  <rich@phekda.freeserve.co.uk>
5563
5564         * fchdir-stub.c: New file: trivial stub for fchdir.
5565
5566 2003-03-18  Jim Meyering  <jim@meyering.net>
5567
5568         * mountlist.c (read_filesystem_list) [MOUNTED_VMOUNT]: Detect any
5569         error from mntctl.
5570         Use mntctl's return value to drive the entry-processing loop, since
5571         we can't rely on the value of the vmt_length member in the last
5572         entry.  On some systems doing so could result in exhausting
5573         virtual memory.  Based in part on a patch from Mike Jetzer.
5574
5575         * quote.c (quote_n): Fix typo in comment.
5576
5577 2003-03-17  Jim Meyering  <jim@meyering.net>
5578
5579         * raise.c (raise): Rename from rpl_raise.
5580         Without that change, systems lacking raise (SunOS 4) would not be
5581         able to link programs using raise.  Reported by Volker Borchert.
5582
5583         * ftw.c (FTW_STAT): Rename from `STAT', to avoid conflict
5584         with STAT definition from <sys/dir.h> on AIX 5.1.
5585         Suggestion from Mike Jetzer and Petter Reinholdtsen.
5586
5587         * fchown-stub.c (fchown): Put function type on its own line.
5588         * readlink-stub.c (readlink): Likewise.
5589         * lstat-stub.c (lstat): Likewise.
5590
5591 2003-03-14  Jim Meyering  <jim@meyering.net>
5592
5593         * Makefile.am (AUTOMAKE_OPTIONS): Remove definition --
5594         before it pointed to ../src/ansi2knr.  Some of these files
5595         have required an ANSI (c89) compiler for a year or two.
5596         (libfetish_a_SOURCES): Remove unused files: c-stack.c, c-stack.h.
5597
5598 2003-02-04  Dmitry V. Levin  <ldv@altlinux.org>
5599
5600         * stat.c: Include "xalloc.h".
5601
5602 2003-03-13  Paul Eggert  <eggert@twinsun.com>
5603
5604         Merge changes from Bison.
5605         * obstack.h: (__INT_TO_PTR) [__STDC__]: Cast result to
5606         (void *) to avoid diagnostic with native c89 on SGI IRIX 6.5
5607         when compiling Bison 1.875's `bitset bset = obstack_alloc
5608         (bobstack, bytes);'.  Problem reported by Nelson H. F. Beebe.
5609
5610 2003-01-30  Richard Dawe  <rich@phekda.freeserve.co.uk>
5611
5612         * fchown-stub.c: New file: trivial stub for fchown.
5613         * lstat-stub.c: New file: trivial stub for lstat.
5614         * readlink-stub.c: New file: trivial stub for readlink.
5615
5616 2003-03-09  Paul Eggert  <eggert@twinsun.com>
5617
5618         * argmatch.c (EXIT_FAILURE): Define if the system doesn't.
5619         Reported by Bruce Becker; see:
5620         http://mail.gnu.org/archive/html/bug-bison/2003-03/msg00017.html
5621
5622 2003-03-03  Paul Eggert  <eggert@twinsun.com>
5623             Bruno Haible  <bruno@clisp.org>
5624
5625         * mbswidth.h: Include <wchar.h>. Needed for UnixWare 7.1.1.
5626         Reported by John Hughes, see
5627         http://mail.gnu.org/archive/html/bug-bison/2003-02/msg00030.html
5628
5629 2003-03-09  Jim Meyering  <jim@meyering.net>
5630
5631         * ftw.c: Include "save-cwd.h".
5632         (ftw_startup): Avoid use of getcwd, if possible.
5633         Instead, use fopen/fchdir via save_cwd/restore_cwd.
5634
5635 2003-03-08  Jim Meyering  <jim@meyering.net>
5636
5637         * xnanosleep.c: Don't use `defined' in a #define directive.
5638
5639 2003-03-07  Jim Meyering  <jim@meyering.net>
5640
5641         * Makefile.am (libfetish_a_SOURCES): Remove mmap-stack.h.
5642
5643         * mmap-stack.c, mmap-stack.h: Remove files.
5644
5645         * getcwd.c: #undef getcwd only after *all* included header files.
5646         Declare getcwd unconditionally.  The problem was that same.h
5647         included config.h, and that defined getcwd to rpl_getcwd a second
5648         time (after the original #undef), and led to the rpl_getcwd
5649         function calling itself endlessly.  This was the cause of at least
5650         the `du' test failures on IRIX 6.5, reported by Nelson Beebe.
5651
5652         * same.h (same_name): Remove unnecessary inclusion of config.h.
5653         It also happened to lead to infinite recursion in getcwd.c.
5654         (PARAMS): Remove definition and use.
5655
5656 2003-03-06  Jim Meyering  <jim@meyering.net>
5657
5658         * ftw.c (ftw_startup): Declare `func' parameter to be of type
5659         NFTW_FUNC_T, not void* which may be smaller on 64-bit systems.
5660         Remove now-unnecessary cast.
5661         (FTW_NAME): Cast func argument to type `NFTW_FUNC_T'.
5662
5663 2003-03-05  Jim Meyering  <jim@meyering.net>
5664
5665         * physmem.c (ARRAY_SIZE): Define it.
5666
5667 2003-03-04  Jim Meyering  <jim@meyering.net>
5668
5669         * makepath.c (CLEANUP_CWD): Call error here, now that restore_cwd
5670         no longer does it.
5671
5672         * save-cwd.h (restore_cwd): Update prototype.
5673         * save-cwd.c (restore_cwd): Remove two parameters.
5674         Simplify.  Don't call error upon failure.  Let callers do that.
5675         (save_cwd): Mention that Irix 5.3 has the same problem as SunOS 4
5676         when auditing is enabled.  But don't bother updating the #if.
5677
5678         * xgetcwd.c (xgetcwd): Improve comment.
5679
5680         * getcwd.c: New file.
5681
5682 2003-02-28  Jim Meyering  <jim@meyering.net>
5683
5684         * ftw.c (ftw_startup): Return -1 if alloca fails.
5685
5686 2003-02-28  Jim Meyering  <jim@meyering.net>
5687
5688         * fts.c (fts_children): If opening `.' fails, set the fts_child
5689         member to NULL before returning.  From NetBSD.
5690
5691         * fts.c (fts_children): If fchdir fails, close file descriptor
5692         before returning.  From NetBSD.
5693
5694 2003-02-27  Jim Meyering  <jim@meyering.net>
5695
5696         * physmem.c (physmem_total, physmem_available): Add comments.
5697         From Kaveh Ghazi.
5698
5699         * physmem.c: Merge in portability changes from gcc/libiberty
5700         to support AIX, Tru64, and Windows.  See the ChangeLog there
5701         for credits and details.  Thanks to Kaveh Ghazi for helping
5702         to keep these files in sync.
5703
5704 2003-02-24  Jim Meyering  <jim@meyering.net>
5705
5706         * fts_.h [__USE_FILE_OFFSET64]: Remove #error directive.
5707
5708         (fts_open): Initialize local, tmp, to pacify gcc.
5709
5710         * fts_.h [struct FTS] (fts_dir_signatures): New, opaque member.
5711         * fts.c: Include <search.h>.
5712         (struct known_object): Define.
5713         (object_compare, add_object, find_object): New functions, like
5714         those in ftw.c.
5715         (fts_open): Initialize new member.
5716         (fts_close): Free memory allocated for new member.
5717         (fts_stat): Detect a cycle in O(logN) time per directory processed.
5718
5719         * fts.c [HAVE_CONFIG_H]: Include <config.h>.
5720         Conditionalize inclusion of <sys/param.h>.
5721         Conditionalize inclusion of <include/sys/stat.h> vs <sys/stat.h>.
5722         Include autoconf-recommended block of dirent/NAMELEN-related
5723         definitions and includes.  Use NAMLEN throughout, rather than
5724         _D_EXACT_NAMLEN.
5725         [_LIBC] (close, closedir, fchdir, open, opendir): Define.
5726         [_LIBC] (readdir, tdestroy, tfind, tsearch): Define.
5727         Remove `__' prefix from all uses of the above.  This will help
5728         to merge *BSD changes.
5729         [!_LIBC] (internal_function): Define.
5730         [! _LIBC && ! LSTAT_FOLLOWS_SLASHED_SYMLINK]: Define lstat.
5731         (__set_errno): Define if not already defined.
5732
5733         * fts.c: (fts_open): If fts_alloc returns NULL, don't dereference it.
5734         (fts_read): If fts_safe_changedir fails because it is not
5735         able to chdir into a subdirectory, then inform the caller.
5736
5737         * fts.c, fts_.h: New files, directly from glibc.
5738
5739 2003-02-23  Jim Meyering  <jim@meyering.net>
5740
5741         * fts_.h (struct _ftsent) [fts_level]: Change type from short to int,
5742         so it can handle a root-relative file name longer than 32K bytes.
5743         [fts_pathlen, fts_namelen]: Rearrange members to decrease size of
5744         this struct from 84 to 80 bytes.
5745
5746 2003-02-21  Jim Meyering  <jim@meyering.net>
5747
5748         * mmap-stack.h: Undefine HAVE_MMAP_STACK, thus disabling
5749         this code on all systems.
5750
5751         Merge in some changes from GNU libc.
5752         * md5.h (md5_uintptr): Define.
5753
5754         * ftw.c: Include <sys/types.h> before <dirent.h>.
5755         This is required for Apple Darwin 6.3 (MacOS 10.2.3).
5756         Patch by Nelson Beebe.
5757
5758 2003-02-19  Jim Meyering  <jim@meyering.net>
5759
5760         * md5.c: Merge in some clean-up and optimization changes from glibc.
5761         * sha.c: Apply those same changes here, too.
5762
5763 2003-02-18  Jim Meyering  <jim@meyering.net>
5764
5765         * md5.c (md5_stream) [BLOCKSIZE]: Move definition to top of file.
5766         Ensure that it is a multiple of 64.
5767         Rearrange loop exit tests so as to avoid performing an
5768         additional fread after encountering an error or EOF.
5769         * sha.c (sha_stream): Likewise.
5770         Reported by Michael Bacarella.
5771
5772         * Makefile.am (CLEANFILES): Remove ftw.h and search.h.
5773         (DISTCLEANFILES): Add them here.
5774         Add fnmatch.h, too.
5775
5776         * sha.c (sha_stream): Rearrange loop exit tests so as to avoid
5777         performing an additional fread after encountering an error or EOF.
5778
5779 2003-02-17  Jim Meyering  <jim@meyering.net>
5780
5781         * mmap-stack.h (RUN_WITH_BIG_STACK_4): Define.
5782
5783         * physmem.c: Undo most of last change.
5784         Use sysmp instead, since it provides a cleaner interface.
5785         From Kaveh Ghazi.
5786
5787 2003-02-16  Jim Meyering  <jim@meyering.net>
5788
5789         * Makefile.am (libfetish_a_SOURCES): Add mmap-stack.h.
5790
5791         * mmap-stack.c (MAP_ANONYMOUS): Use MAP_ANON, if possible.
5792         Initialize `fd' to -1, so Solaris' mmap works with MAP_ANON.
5793
5794 2003-02-15  Jim Meyering  <jim@meyering.net>
5795
5796         * mmap-stack.c, mmap-stack.h: New files.
5797         Let the caller run a function with a larger (mmap'd) stack.
5798
5799         Add Irix6 support to physmem.c.
5800         * physmem.c (irix_sysget): New function.
5801         (IRIX_SYSGET_TOTAL, IRIX_SYSGET_AVAILABLE): New macros.
5802         (physmem_total, physmem_available): Use them.
5803         (main) [DEBUG]: New function.
5804
5805 2003-02-11  Jim Meyering  <jim@meyering.net>
5806
5807         * Makefile.am (libfetish_a_SOURCES): Add euidaccess.h.
5808         * euidaccess.c: Include "euidaccess.h".
5809         * euidaccess.h: New file.
5810
5811 2003-02-08  Jim Meyering  <jim@meyering.net>
5812
5813         * ftw.c (ftw_startup): Don't shadow outer declaration of save_err.
5814         Merge inconsequential changes from libc.
5815
5816         * ftw.c (ftw_startup): When using FTW_CHDIR, always remember
5817         the current directory, not just when DIR contains a slash.
5818         Reported by Manoj Srivastava via Michael Stone as Debian bug #180228.
5819
5820 2003-02-07  Jim Meyering  <jim@meyering.net>
5821
5822         Merge inconsequential changes from libc.
5823         * ftw.c: Include limits.h earlier.
5824         Move PATH_MAX definition `down' a little; add comment.
5825         Rename local, saved_errno to save_err.
5826
5827 2003-02-06  Jim Meyering  <jim@meyering.net>
5828
5829         Support for pruning.
5830         * ftw_.h (FTW_DPRE) [enum]: New member and definition.
5831         (struct FTW) [skip]: New member.
5832
5833         * search_.h (__restrict): Define to `restrict' or to nothing.
5834
5835         * fsusage.c: Remove declaration of statfs.
5836         It conflicted with one from OSF/1 5.1 in <sys/mount.h>.
5837         Reported by Nelson Beebe.
5838
5839 2003-02-05  Jim Meyering  <jim@meyering.net>
5840
5841         Fix a heap-corruption bug that affected Solaris systems.
5842         * ftw.c: Include <limits.h>.
5843         (PATH_MAX): Define to 1024, if not already defined.
5844         (process_entry): Allocate enough space to hold the resulting
5845         file name.  Don't presume that 2*dirbufsize is enough.
5846         (ftw_startup): Always use PATH_MAX to compute buffer size, now that
5847         it is guaranteed to be defined.
5848         Nelson Beebe reported that du would sometimes segfault on Solaris.
5849
5850         * ftw.c (process_entry): When using FTW_DEPTH, call `func', the
5851         user-supplied callback, once for the current directory before calling
5852         ftw_dir, in case that part of the hierarchy should be pruned.
5853         `func' does that by setting `data->skip'.
5854         (ftw_startup): Likewise.
5855
5856 2003-02-02  Jim Meyering  <jim@meyering.net>
5857
5858         * ftw.c (lstat) [!_LIBC && !LSTAT_FOLLOWS_SLASHED_SYMLINK]:
5859         Define to rpl_lstat.
5860
5861 2003-01-25  Jim Meyering  <jim@meyering.net>
5862
5863         * ftw.c (ISSLASH, FILESYSTEM_PREFIX_LEN) [_LIBC]: Define.
5864         (base_name): New function.
5865         (ftw_startup): Don't strip trailing slashes.
5866         Use base_name to find the offset of the basename.
5867
5868 2003-01-25  Jim Meyering  <jim@meyering.net>
5869
5870         * ftw.c (object_compare): Compare inode numbers before device numbers.
5871         The former is much more likely to differ for any two given file objects.
5872
5873 2003-01-23  Jim Meyering  <jim@meyering.net>
5874
5875         * tsearch.c [HAVE_CONFIG_H]: Include <config.h>.
5876         Add autoconf-recommended block of alloca-related code.
5877         Cast each use of alloca to the required type, (node**).
5878
5879         * ftw.c: Add autoconf-recommended block of alloca-related code.
5880         [!_LIBC] (__getcwd): Define to xgetcwd and declare xgetcwd.
5881
5882 2003-01-22  Jim Meyering  <jim@meyering.net>
5883
5884         * ftw.c (find_object): Don't use c99-style struct initializer.
5885
5886         * ftw_.h: Change all uses of __const to const.
5887         * search_.h: Likewise.
5888
5889         * Makefile.am (CLEANFILES): Add generated files: ftw.h search.h.
5890
5891         * ftw.c (process_entry): Handle FTW_DCHP.
5892         (ftw_dir): Handle FTW_DCH.
5893
5894         * ftw_.h [!_LIBC && !__USE_XOPEN_EXTENDED]: Define __USE_XOPEN_EXTENDED
5895         and FTW_H_STANDALONE.
5896         [anon enum] (FTW_DCH, FTW_DCHP): New members.
5897         (FTW_DCH, FTW_DCHP): Define.
5898
5899         * ftw.c: Include autoconf-recommended block of dirent/NAMELEN
5900         related definitions and includes.  Use NAMELEN throughout,
5901         rather than _D_EXACT_NAMLEN.
5902         [_LIBC]: Define NAMELEN to _D_EXACT_NAMLEN.
5903         (stpcpy): Declare, if necessary.
5904         (mempcpy): Define, if necessary.
5905         [!_LIBC] (__stpcpy, __mempcpy): Define.
5906         [!_LIBC] (LXSTAT, XSTAT): Define.
5907
5908 2003-01-21  Jim Meyering  <jim@meyering.net>
5909
5910         * tsearch.c: New file, from GNU libc.
5911         [! weak_alias]: Define __-prefixed names to publicized ones.
5912         [! defined _LIBC] (weak_alias, internal_function): Define-away.
5913         [defined weak_alias]: Guard each use of weak_alias.
5914
5915 2003-01-20  Jim Meyering  <jim@meyering.net>
5916
5917         * canonicalize.c: Include "path-concat.h".
5918
5919         * search_.h: New file, from GNU libc.
5920
5921         * Makefile.am (libfetish_a_SOURCES): Use ftw_.h here, too.
5922         (libfetish_a_SOURCES): Add search_.h.
5923         * ftw_.h: Rename from ftw.h.
5924
5925         * obstack.h (obstack_object_size): Declare temporary, __o,
5926         to be const, in order to avoid warnings.
5927         (obstack_room): Likewise.
5928         (obstack_empty_p): Likewise.
5929
5930         Merge in changes from GNU libc
5931         * error.c: Eliminate many `#ifdef USE_IN_LIBIO' conditionals.
5932
5933 2003-01-19  Ulrich Drepper  <drepper@redhat.com>
5934
5935         From GNU libc.
5936         * strftime.c (my_strftime): Handle very large width
5937         specifications for numeric values correctly.  Improve checks for
5938         overflow.
5939
5940 2003-01-19  Jim Meyering  <jim@meyering.net>
5941
5942         * strftime.c (widen) [COMPILE_WIDE]: Merge nearly-identical definitions.
5943         (nl_get_alt_digit) [! defined my_strftime]: Define.
5944         (my_strftime) [_NL_CURRENT]: Merge nearly-identical uses of
5945         _nl_get_alt_digit and _nl_get_walt_digit.
5946
5947         * strftime.c (my_strftime): Merge in locale-related changes from libc.
5948         These changes have no effect outside of _LIBC.
5949
5950 2003-01-14  Jim Meyering  <jim@meyering.net>
5951
5952         * same.c (same_name): Declare *_basename locals to be `const'.
5953         Consolidate declarations and initializations of *_base* locals.
5954
5955 2003-01-11  Bruno Haible  <bruno@clisp.org>
5956
5957         * same.c (same_name): Reorder tests so as to avoid calling stat()
5958         when a string comparison is sufficient.
5959
5960 2003-01-11  Bruno Haible  <bruno@clisp.org>
5961
5962         * readtokens.c (readtoken): Cast character to 'unsigned char', not
5963         'unsigned int'.
5964
5965 2003-01-14  Jim Meyering  <jim@meyering.net>
5966
5967         * ftw.c: Merge in Ulrich's and my changes from libc.
5968
5969 2003-01-12  Jim Meyering  <jim@meyering.net>
5970
5971         * ftw.c (ftw_startup): Rename local-shadowing local to pacify gcc.
5972         Also work on systems that have `struct direct', using autoconf's
5973         AC_HEADER_DIRENT.
5974         Tweak comments.
5975
5976         * ftw.h, ftw.c: New files, from glibc/io.
5977
5978         * Makefile.am (libfetish_a_SOURCES): Add ftw.h.
5979
5980 2003-01-11  Jim Meyering  <jim@meyering.net>
5981
5982         * makepath.c: Don't test HAVE_ERRNO_H.  It's not necessary.
5983
5984         * canonicalize.c: Don't test HAVE_ERRNO_H.  It's not necessary.
5985         Don't test HAVE_STDDEF_H.  It's not necessary.
5986         Use definition of PTR_INT_TYPE from obstack.h.
5987
5988 2002-12-01  Dmitry V. Levin  <ldv@altlinux.org>
5989
5990         * canonicalize.c: New file.
5991         The readlink-based implementation imported from GNU C Library.
5992         The resolveip-based implementation imported from src/df.c (show_point).
5993         * canonicalize.h: New file.
5994         * Makefile.am (libfetish_a_SOURCES): Add canonicalize.h.
5995
5996 2003-01-10  Jim Meyering  <jim@meyering.net>
5997
5998         * save-cwd.h: Remove uses of PARAMS.
5999
6000 2002-11-30  Dmitry V. Levin  <ldv@altlinux.org>
6001
6002         * xgetcwd.h: New file.
6003         * Makefile.am (libfetish_a_SOURCES): Add xgetcwd.h.
6004         * save-cwd.c: Include "xgetcwd.h".
6005         * xgetcwd.c: Likewise.
6006
6007 2002-11-30  Dmitry V. Levin  <ldv@altlinux.org>
6008
6009         * getgroups.c: Don't declare functions declared by xalloc.h.
6010         Include "xalloc.h" instead.
6011         * group-member.c: Likewise.
6012         * idcache.c: Likewise.
6013         * readutmp.c: Likewise.
6014
6015 2003-01-08  Jim Meyering  <jim@meyering.net>
6016
6017         * full-write.c: Undefine and define-away `const' after inclusion
6018         of errno.h, not before.  Suggestion from Bruno Haible.
6019
6020 2003-01-06  Jim Meyering  <jim@meyering.net>
6021
6022         * full-write.c: Rework so that it may serve to define full_read, too.
6023         * full-read.c: Simply #define FULL_READ and include full-write.c.
6024
6025         * Makefile.am (libfetish_a_SOURCES): Add full-read.c and full-read.h.
6026         * full-read.c, full-read.h: New files.
6027
6028         Update from gnulib.
6029
6030         2002-12-10  Paul Eggert  <eggert@twinsun.com>
6031         Port exclude.c and exclude.h to more non-GNU systems, e.g. Solaris 7.
6032         * exclude.h (EXCLUDE_ANCHORED, EXCLUDE_INCLUDE, EXCLUDE_WILDCARDS):
6033         Choose values that are less likely to collide with system fnmatch
6034         options.
6035         * exclude.c (FNM_CASEFOLD, FNM_LEADING_DIR): Define to 0 if not
6036         defined (e.g., a pure POSIX system).
6037         (EXCLUDE_macros_do_not_collide_with_FNM_macros): Use FNM_PATHNAME
6038         instead of FNM_FILE_NAME, for compatibility with pure POSIX systems.
6039
6040         Update from gnulib.
6041
6042         * utime.c (utime_null): Use SAFE_READ_ERROR.
6043         (utime_null): No need to call ftruncate if the file was nonempty.
6044         * getdate.y (get_date): Test HAVE_STRUCT_TM_TM_ZONE, not HAVE_TM_ZONE.
6045         * canon-host.c (strdup): Remove unused declaration.
6046         * fsusage.c: Include full_read.h.
6047         (get_fs_usage): Use full_read instead of safe_read.
6048         Patches by Bruno Haible.
6049
6050 2003-01-04  Jim Meyering  <jim@meyering.net>
6051
6052         * version-etc.c: Update copyright date.
6053
6054 2002-12-31  Jim Meyering  <meyering@lucent.com>
6055
6056         * dev-ino.h: New file.
6057         * cycle-check.c: New file.
6058         * cycle-check.h: New file.
6059         * Makefile.am (libfetish_a_SOURCES): Add cycle-check.c, cycle-check.h,
6060         and dev-ino.h.
6061
6062 2002-12-21  Jim Meyering  <jim@meyering.net>
6063
6064         * stime.c: Remove file (for real, this time).
6065
6066 2002-12-15  Jim Meyering  <jim@meyering.net>
6067
6068         * strftime.h: New file, for declaration of nstrftime.
6069         * Makefile.am (libfetish_a_SOURCES): Add strftime.h.
6070
6071 2002-12-09  Jim Meyering  <jim@meyering.net>
6072
6073         * unlocked-io.h: Sync from gnulib.
6074
6075 2002-12-06  Jim Meyering  <jim@meyering.net>
6076
6077         * unlocked-io.h: New file, but with proper copyright notice and
6078         attribution.  Note: this is *not* the same as the file in gnulib.
6079         This uses #if HAVE_FUNC_UNLOCKED for each `FUNC', rather than
6080         HAVE_DECL_FUNC_UNLOCKED.  This usage is consistent with the autoconf
6081         macro in ../m4/jm-glibc-io.m4.  Modulo comments, this file still
6082         contains exactly what was generated by gen-uio.
6083
6084 2002-12-04  Paul Eggert  <eggert@twinsun.com>
6085
6086         Do not generate unlocked-io.h automatically, since it's easier to
6087         maintain it by hand.
6088
6089         * gen-uio: Remove.
6090         * Makefile.am: Add copyright notice.
6091         (libfetish_a_SOURCES): Add unlocked-io.h.
6092         (BUILT_SOURCES, all-local): Remove unlocked-io.h.
6093         (DISTCLEANFILES, io_functions): Remove macros.
6094         (EXTRA_DIST): Remove gen_uio.
6095         (unlocked-io.h): Remove rule.
6096
6097 2002-12-05  Paul Eggert  <eggert@twinsun.com>
6098
6099         * alloca.c [defined emacs]: Include "lisp.h".
6100         (xalloc_die) [defined emacs]: New macro.
6101         (free) [defined emacs && defined EMACS_FREE]: Define to EMACS_FREE.
6102         [! defined emacs]: Include <xalloc.h>.
6103         (POINTER_TYPE) [!defined POINTER_TYPE]: New macro.
6104         (pointer): Typedef to POINTER_TYPE *.
6105         (malloc): Remove decl; we now always use xmalloc.
6106         (alloca): Use old-style definition, since Emacs needs this.
6107         Check for arithmetic overflow when computing combined size.
6108
6109 2002-12-04  Jim Meyering  <jim@meyering.net>
6110
6111         Reflect the fact that stat.c and lstat.c are no longer generated.
6112         * Makefile.am (BUILT_SOURCES): Remove stat.c and lstat.c.
6113         (DISTCLEANFILES): Likewise.
6114         (EXTRA_DIST): Likewise.
6115         (all_local): Don't depend on stat.c or lstat.c.
6116         (stat.c, lstat.c): Remove rules.
6117         (EXTRA_DIST): Remove xstat.in.
6118
6119         * xstat.in: Remove file.  Contents moved into stat.c.
6120         * stat.c: Rework so that it may serve to define rpl_lstat, too.
6121         * lstat.c: Simply #define LSTAT and include stat.c.
6122
6123         * safe-read.c: Rework so that it may serve to define safe_write, too.
6124         * safe-write.c: Simply #define SAFE_WRITE and include safe-read.c.
6125
6126 2002-12-03  Jim Meyering  <jim@meyering.net>
6127
6128         * safe-read.h: Update from gnulib (add comments, include stddef.h).
6129
6130 2002-12-02  Jim Meyering  <jim@meyering.net>
6131
6132         * safe-read.c (EINTR): Define.
6133         (safe_read): Rewrite to iterate IFF the read fails with EINTR.
6134
6135 2002-12-01  Jim Meyering  <jim@meyering.net>
6136
6137         * safe-read.c: Merge from gnulib.
6138         (safe_read): Also exit the loop when read returns zero.
6139         (CHAR_BIT, TYPE_SIGNED, TYPE_MINIMUM, TYPE_MAXIMUM, INT_MAX): Define.
6140
6141         * Makefile.am (libfetish_a_SOURCES): Add safe-write.c and safe-write.h.
6142
6143         * strtoll.c: Update from gnulib (trivial changes).
6144         * strdup.c: Likewise.
6145         * strpbrk.c: Likewise.
6146         * strstr.c: Likewise.
6147         * tempname.c: Likewise.
6148         * obstack.c: Likewise.
6149         * getopt.c: Likewise.
6150         * getopt1.c: Likewise.
6151         * getopt.h: Likewise.
6152         * quote.h: Update from gnulib: add Copyright comment.
6153         * quote.c: Likewise.
6154
6155 2002-11-28  Jim Meyering  <jim@meyering.net>
6156
6157         * mktime.c: Merge from gnulib/libc, for a slightly uglier solution.
6158
6159         Merge some more, in preparation for merge back into libc.
6160         * error.c (_): Define only if not already defined.
6161         Move definition to follow all #include directives.
6162         Include unlocked-io.h only if !_LIBC.
6163
6164         Merge in changes from libc.
6165         * error.c [_LIBC]: Include <libio/libioP.h>.
6166         [USE_IN_LIBIO]: Include <libio/iolibio.h>
6167         (fflush): Tweak definition to use INTUSE.
6168         (putc): Define.
6169
6170 2002-11-23  Jim Meyering  <jim@meyering.net>
6171
6172         From gnulib, by Bruno Haible
6173         * closeout.c: Include gettext.h instead of <libintl.h>.
6174         * makepath.c: Likewise.
6175         * rpmatch.c: Likewise.
6176         * userspec.c: Likewise.
6177         * version-etc.c: Likewise.
6178         * xmemcoll.c: Likewise.
6179         * error.c [!_LIBC]: Include gettext.h instead of <libintl.h>.
6180
6181         * mbswidth.h: Update from gnulib.
6182         * mbswidth.c: Likewise.
6183         * localcharset.c: Likewise.
6184         * config.charset: Likewise.
6185         * unicodeio.c: Likewise.
6186
6187 2002-11-22  Paul Eggert  <eggert@twinsun.com>
6188
6189         * quotearg.h: Allow multiple inclusion by surrounding with
6190         "#ifndef QUOTEARG_H_".  Include <stddef.h>, for size_t,
6191         so that we can be included first.
6192         (PARAMS): Remove; we now assume C89 or later.  All uses removed.
6193         * quotearg.c: Include quotearg.h immediately after config.h.
6194         No need to include stddef.h or sys/types.h any more.
6195         Surround local include files with "", not "<>".
6196         Assume HAVE_LIMITS_H unconditionally, as we assume C89.
6197         Similarly, assume HAVE_C_BACKSLASH_A, CHAR_BIT, UCHAR_MAX, UINT_MAX,
6198         HAVE_STDLIB_H, HAVE_STRING_H, STDC_HEADERS.
6199         (HAVE_MBSINIT): Undef if !HAVE_MBRTOWC.
6200         (mbsinit): Define to 1 if !defined mbsinit && !HAVE_MBSINIT.
6201         (ISPRINT): Remove; no longer needed now that we assume C89.
6202
6203         (clone_quoting_options, quotearg_buffer, quotearg_n_options):
6204         Preserve errno.
6205
6206         (quotearg_buffer_restyled, quotearg_n, quotearg_n_style,
6207         quotearg_char): Use SIZE_MAX rather than
6208         (size_t) -1 when we are talking about "infinity".
6209
6210         (quotearg_buffer_restyled): Fix bug when quoting trigraphs.
6211
6212 2002-11-22  Jim Meyering  <jim@meyering.net>
6213
6214         From gnulib.
6215         * strstr.c: Don't include <sys/types.h>.  It's unnecessary.
6216
6217 2002-11-21  Bruno Haible  <bruno@clisp.org>
6218
6219         Remove case insensitive option matching.
6220         * argmatch.h (argcasematch): Remove declaration.
6221         (ARGCASEMATCH): Remove macro.
6222         (__xargmatch_internal): Remove case_sensitive argument.
6223         (XARGMATCH): Update.
6224         (XARGCASEMATCH): Remove macro.
6225         * argmatch.c (argmatch): Renamed from __argmatch_internal. Remove
6226         case_sensitive argument.
6227         (argcasematch): Remove function.
6228         (__xargmatch_internal): Remove case_sensitive argument.
6229         (main): Use XARGMATCH instead of XARGCASEMATCH.
6230
6231         * argmatch.c: Include gettext.h instead of <locale.h> and <libintl.h>.
6232
6233 2002-11-21  Bruno Haible  <bruno@clisp.org>
6234
6235         * xmalloc.c: Change compile-time error message. Add comment about
6236         required autoconf version.
6237         * xmalloc.c: Include gettext.h instead of <libintl.h>.
6238         (textdomain): Remove definition.
6239
6240 2002-11-21  Jim Meyering  <jim@meyering.net>
6241
6242         * strdup.c (strdup): Merge in changes from gnulib; mainly to
6243         use memcpy rather than strcpy.
6244
6245         * strcspn.c: Update from gnulib.
6246
6247         * sig2str.c (str2signum): Use unsigned, not size_t, for type of index.
6248
6249         * quotearg.c: Use `"'s when including quotearg.h and xalloc.h,
6250         not the `<...>' notation.
6251         Include <errno.h> and declare errno if necessary.
6252
6253         * README: Update from gnulib.
6254
6255 2002-11-20  Paul Eggert  <eggert@twinsun.com>
6256
6257         Merge argmatch cleanups from Bison.  Assume C89.
6258
6259         * argmatch.c: Include config.h here, not in argmatch.h.
6260         Include stdlib.h, for EXIT_FAILURE.
6261         Always include <string.h>, since we assume C89.
6262         (EXIT_FAILURE): Remove pre-C89 bug workaround.
6263         * argmatch.h: Do not include <config.h> or <sys/types.h>.
6264         Include <stddef.h> instead, since it's all we need for size_t.
6265         (PARAMS): Remove.  All uses removed.
6266         (ARRAY_CARDINALITY): Do not bother to #undef.
6267         (ARRAY_CARDINALITY, ARGMATCH, ARGCASEMATCH, invalid_arg,
6268         ARGMATCH_VALID, XARGMATCH, XARGCASEMATCH):
6269         Remove unnecessary parentheses.
6270         (ARGMATCH_VALID, XARGMATCH, XARGCASEMATCH):
6271         Insert necessary parentheses.
6272         (ARGMATCH_CONSTRAINT, ARGMATCH_VERIFY): New macros.
6273         (ARGMATCH_ASSERT): Use ARGMATCH_CONSTRAINT.
6274
6275 2002-11-19  Jim Meyering  <jim@meyering.net>
6276
6277         Be careful not to clobber errno.
6278         * quotearg.c (quotearg_buffer_restyled): If mbrtowc returns
6279         `(size_t) -1' (at which point it would also set errno to EILSEQ),
6280         then restore errno to its previous value.
6281         Reported by Phillip Jones via Tim Waugh as
6282         https://bugzilla.redhat.com/bugzilla/show_bug.cgi?id=76334.
6283
6284         Avoid a link-time failure on some Linux systems.
6285         * mktime.c (STATIC): Define to be empty (_LIBC) or `static' (otherwise).
6286         (__mon_yday): Declare with the STATIC attribute.
6287         (__mktime_internal): Likewise.
6288         Based on a report from Greg Schafer.
6289
6290 2002-11-14  Jim Meyering  <jim@meyering.net>
6291
6292         * long-options.c: Don't include libintl.h, and don't define `_' --
6293         they're not used.
6294         * same.c: Likewise.
6295
6296 2002-11-10  Jim Meyering  <jim@meyering.net>
6297
6298         * raise.c: New file.
6299
6300 2002-11-08  Paul Eggert  <eggert@twinsun.com>
6301
6302         * human.c (human_readable): Revamp to avoid warning about unused
6303         variable 'amt'.  Unfortunately this means using some gotos.
6304
6305 2002-11-08  Jim Meyering  <jim@meyering.net>
6306
6307         * human.c (human_readable): Avoid warnings from gcc -Wshadow.
6308
6309 2002-11-06  Jim Meyering  <jim@meyering.net>
6310
6311         * Makefile.am (EXTRA_DIST): Add inttostr.h.
6312
6313 2002-10-07  Paul Eggert  <eggert@twinsun.com>
6314
6315         * Makefile.am (libfetish_a_SOURCES): Add imaxtostr.c, offtostr.c,
6316         umaxtostr.c.
6317         (EXTRA_DIST): Add inttostr.c.
6318         * inttostr.c, inttostr.h, imaxtostr.c, offtostr.c, umaxtostr.c:
6319         New files, taken from GNU tar.
6320
6321         * human.c, human.h: Rewrite to support locale-specific
6322         notations like thousands separators.
6323         Specify what includer of include.h must include beforehand.
6324         (human_group_digits, human_suppress_point_zero, human_autoscale,
6325         human_base_1024, human_SI, human_B): New enum values.
6326         (human_readable): Rename from human_readable_inexact; put the
6327         options before the sizes.  All uses changed.  The old human_readable
6328         function has been removed; use inttostr.h instead.
6329         (human_options): Renamed from human_block_size, with new signature
6330         that allows block sizes up to UINTMAX_MAX.  All callers changed.
6331
6332 2002-10-13  Jim Meyering  <jim@meyering.net>
6333
6334         * xnanosleep.c (initialized): Remove declaration now that it's unused.
6335
6336 2002-10-12  Paul Eggert  <eggert@twinsun.com>
6337
6338         * xnanosleep.c: There's no need to futz with the rounding mode,
6339         since the code should work properly even in the default rounding mode.
6340         (<fenv.h>): Do not include.
6341         (#pragma STDC FENV_ACCESS ON): Remove.
6342         (xnanosleep): Don't futz with rounding state.
6343
6344 2002-10-06  Jim Meyering  <jim@meyering.net>
6345
6346         * safe-read.c (safe_read): Change type of function
6347         from ssize_t to size_t.
6348         * safe-read.h: Update prototype.
6349         (SAFE_READ_ERROR): Define.
6350
6351 2002-09-28  Jim Meyering  <jim@meyering.net>
6352
6353         * makepath.c (make_path): Restore umask *before* creating the final
6354         component.
6355
6356 2002-09-25  Paul Eggert  <eggert@twinsun.com>
6357
6358         * fsusage.c [! HAVE_INTTYPES_H && HAVE_STDINT_H] Include <stdint.h>.
6359         (UINTMAX_MAX) [!defined UINTMAX_MAX]: New macro.
6360         (PROPAGATE_ALL_ONES): Work even if X is unsigned and narrower than
6361         int.  Work more efficiently if X is the same width as uintmax_t.
6362         Do not compare X to -1, to avoid bogus compiler warning.
6363         (get_fs_usage): (uintmax_t) -1 -> UINTMAX_MAX to avoid a cast.
6364         Don't assume that f_frsize and f_bsize are the same type.
6365
6366 2002-09-25  Jim Meyering  <jim@meyering.net>
6367
6368         * fsusage.c: Remove unneeded parentheses around operands of `defined'.
6369
6370         * safe-read.c (safe_read): Make comment more precise:
6371         upon error, it returns -1.
6372
6373 2002-09-22  Jim Meyering  <jim@meyering.net>
6374
6375         * makepath.c (make_path): Minor reformatting.
6376
6377 2002-09-14  Paul Eggert  <eggert@twinsun.com>
6378
6379         * xnanosleep (xnanosleep): Return -1 on failure, not 1,
6380         for consistency with nanosleep.  Check errno after nanosleep
6381         returns -1.
6382
6383 2002-09-11  Jim Meyering  <jim@meyering.net>
6384
6385         * xnanosleep.c, xnanosleep.h: New files, factored out of sleep.c.
6386         * Makefile.am (libfetish_a_SOURCES): Add them.
6387
6388 2002-09-04  Jim Meyering  <jim@meyering.net>
6389
6390         * addext.c (addext): Add a cast to avoid gcc's warning about
6391         `comparison between signed and unsigned'.
6392
6393         * sig2str.c (str2signum, sig2str): Declare loop index variables to be
6394         of type size_t so that they match type of upper bound, thus avoiding
6395         warning about `comparison between signed and unsigned'.
6396
6397 2002-08-31  Jim Meyering  <jim@meyering.net>
6398
6399         * mktime.c: Update from GNU libc.
6400         * obstack.c: Likewise.
6401         * getopt.c: Likewise.
6402         * getopt1.c: Likewise.
6403
6404 2002-08-05  Paul Eggert  <eggert@twinsun.com>
6405
6406         Fix some minor time-related bugs with POSIX time arguments.
6407         Some valid time stamps were being rejected (notably -1, and
6408         time stamps before 1900 on 64-bit hosts).  And some invalid
6409         time stamps were being accepted, e.g. September 31.
6410
6411         * posixtm.h (posixtime): Return bool instead of time_t, so
6412         that we can return (time_t) -1 successfully.
6413         * posixtm.c: Likewise.
6414         [HAVE_STDBOOL_H]: Include <stdbool.h>.
6415         (bool, false, true) [!HAVE_STDBOOL_H]: New type.
6416         (t): Remove static var.
6417         (year, posix_time_parse): Now takes struct tm * arg to modify, instead
6418         of static var.  All uses changed.
6419         (year): Do not reject years before 1900; they can occur with
6420         64-bit time_t.
6421         (posix_time_parse): Do not check for out-of-range components;
6422         that is now the caller's responsibility, since our checks were
6423         only approximations.
6424         (posixtime): Use mktime to check for out-of-range components,
6425         since it knows them exactly.
6426         If mktime returns (time_t) -1, check whether an error actually occurred
6427         by invoking localtime on -1.
6428         (main) [TEST_POSIXTIME]: Check for input data errors, and report
6429         posixtime failures better.
6430         Improve the test data (in comments only).
6431
6432 2002-07-27  Jim Meyering  <jim@meyering.net>
6433
6434         * readutmp.h: If we have both utmpx.h and utmp.h, and there exists
6435         the utmp.ut_exit member, but not the utmpx.ut_exit member, then
6436         undefine HAVE_UTMPX_H.  For AIX 4.3.3.  Doing all this in cpp is
6437         a big kludge; someday we'll put the brains in an autoconf macro.
6438         (UT_EXIT_E_TERMINATION, UT_EXIT_E_EXIT): Define.
6439
6440 2002-07-20  Jim Meyering  <jim@meyering.net>
6441
6442         * xmalloc.c: Adjust to work with new autoconf macros, AC_FUNC_MALLOC
6443         and AC_FUNC_REALLOC: test #ifndef HAVE_MALLOC/HAVE_REALLOC.
6444
6445         * gettext.h: Upgrade to gettext-0.11.3.
6446
6447 2002-07-13  Bruno Haible  <bruno@clisp.org>
6448
6449         * xstat.in: Include <string.h>.
6450         * mountlist.c: #undef MNT_IGNORE before defining it, to avoid warning
6451         on FreeBSD.
6452
6453 2002-07-09  Jim Meyering  <jim@meyering.net>
6454
6455         * mountlist.h (ME_DUMMY): Don't count entries of type `auto' as dummy
6456         ones.  At least on GNU/Linux systems, `auto' means something else.
6457         From Michael Stone.
6458
6459 2002-07-01  Jim Meyering  <jim@meyering.net>
6460
6461         * c-stack.c: Include sys/time.h.
6462         From Volker Borchert.
6463
6464 2002-06-11  Paul Eggert  <eggert@twinsun.com>
6465
6466         * fnmatch.c, fnmatch_loop.c (WIDE_CHAR_SUPPORT):
6467         New macro.  Use it uniformly instead of
6468         (defined HAVE_WCTYPE_H && defined HAVE_WCHAR_H).
6469         It also uses HAVE_BTOWC, to fix a porting bug on Solaris 2.5.1
6470         reported by Vin Shelton.
6471
6472 2002-06-22  Jim Meyering  <jim@meyering.net>
6473
6474         * fnmatch.c (ISASCII, ISPRINT): Undefine, to avoid warning about
6475         redefinition due to Solaris 2.6's definition in /usr/include/sys/euc.h.
6476
6477 2002-06-22  Paul Eggert  <eggert@twinsun.com>
6478
6479         * c-stack.h (segv_handler, c_stack_action) [! defined SA_SIGINFO]:
6480         Do not assume SA_SIGINFO behavior.
6481         Bug reported by Jim Meyering on NetBSD 1.5.2.
6482
6483 2002-06-22  Jim Meyering  <jim@meyering.net>
6484
6485         * c-stack.c, c-stack.h: New files, from diffutils-2.8.2.
6486
6487         * exitfail.c, exitfail.h: Likewise.
6488         * Makefile.am (libfetish_a_SOURCES): Add exitfail.c and exitfail.h.
6489
6490         * Makefile.am (libfetish_a_SOURCES): Add fnmatch_.h in place
6491         of fnmatch.h.
6492         (EXTRA_DIST): Add fnmatch_loop.c.
6493         (libfetish_a_SOURCES): Add c-stack.c and c-stack.h.
6494
6495         * fnmatch_loop.c: New file, from diffutils-2.8.2.
6496         * fnmatch.c: Update from diffutils-2.8.2.
6497         * fnmatch_.h: New file.  From diffutils-2.8.2.
6498         * fnmatch.h: Remove file.
6499
6500 2002-06-18  Paul Eggert  <eggert@twinsun.com>
6501
6502         * file-type.h: Report an error if neither S_ISREG nor
6503         S_IFREG is defined, instead of using a test specific to glibc
6504         2.2.  This should be safe, since POSIX requires S_ISREG and
6505         Unix Version 7 had S_IFREG.  We don't need to check for
6506         <sys/types.h> since we don't use any symbols that it defines.
6507
6508 2002-06-15  Jim Meyering  <jim@meyering.net>
6509
6510         * file-type.h (FILE_TYPE_H): Guard entire contents with #ifndef.
6511         For GNU libc 2.2 and newer, ensure that <sys/types.h> and <sys/stat.h>
6512         have been included before this file.
6513
6514 2002-06-13  Richard Dawe  <richdawe@bigfoot.com>
6515
6516         * Makefile.am (lstat.c, stat.c, .sin.sed): Use t-$@, rather than $@-t,
6517         so that each temporary file name is unique and valid in the first
6518         8 characters, for operation under DOS.
6519
6520 2002-06-15  Jim Meyering  <jim@meyering.net>
6521
6522         Work even with DJGPP 2.03, which lacks support for symlinks.
6523         From Richard Dawe.
6524         * xstat.in (S_ISLNK): Define to 0 if neither S_ISLNK nor S_IFLNK
6525         is defined.
6526         * lchown.c (S_ISLNK): Likewise.
6527
6528 2002-06-14  Jim Meyering  <jim@meyering.net>
6529
6530         * file-type.h: Use the version from diffutils-2.8.2.
6531         * file-type.c: Likewise.
6532
6533 2002-05-27  Jim Meyering  <jim@meyering.net>
6534
6535         Fix a problem seen only on nonconforming systems whereby ls.c's
6536         use of localtime, and then of gettimeofday would cause trouble:
6537         the localtime call used to initialize rpl_gettimeofday's save
6538         mechanism would clobber ls's current local time information so
6539         that in any long listing the first file would always be listed
6540         with date 1970-01-01.  Analysis by Volker Borchert.
6541
6542         * gettimeofday.c (localtime): Undefine.
6543         (rpl_localtime): New function.
6544
6545 2002-05-22  Jim Meyering  <jim@meyering.net>
6546
6547         * Makefile.am (libfetish_a_SOURCES): Add file-type.c and file-type.h.
6548         * file-type.h: New file.
6549         * file-type.c (file_type): New file/function.  Extracted from diffutils.
6550
6551 2002-04-29  Paul Eggert  <eggert@twinsun.com>
6552
6553         * hard-locale.c: Upgrade to version used in GNU Diffutils 2.8.1.
6554
6555 2002-04-28  Paul Eggert  <eggert@twinsun.com>
6556
6557         * sig2str.h (SIGNUM_BOUND): Do not use WTERMSIG, to avoid
6558         depending on <sys/wait.h> and WTERMSIG.  Default to 64 instead
6559         of 127, since 64 is the largest conceivable number for ancient
6560         nonstandard hosts.
6561         * sig2str.c: Do not include <sys/wait.h>; no longer needed.
6562
6563 2002-04-28  Jim Meyering  <jim@meyering.net>
6564
6565         * sig2str.c (WTERMSIG): Remove definition (unused).
6566
6567 2002-04-28  Paul Eggert  <eggert@twinsun.com>
6568
6569         * sig2str.h, sig2str.c: New files.
6570         * Makefile.am (libfetish_a_SOURCES): Add sig2str.h.
6571
6572 2002-04-24  Jim Meyering  <jim@meyering.net>
6573
6574         * gettext.h: New file, from Gettext.
6575         * Makefile.am (INCLUDES): Remove -I../intl.
6576         (libfetish_a_SOURCES): Add gettext.h.
6577
6578 2002-04-16  Jim Meyering  <jim@meyering.net>
6579
6580         * readutmp.h (UT_TYPE): Remove definition (now in who.c).
6581         (HAVE_STRUCT_XTMP_UT_EXIT, HAVE_STRUCT_XTMP_UT_ID): Define.
6582         (HAVE_STRUCT_XTMP_UT_PID, HAVE_STRUCT_XTMP_UT_TYPE): Define.
6583
6584 2002-04-12  Jim Meyering  <jim@meyering.net>
6585
6586         * dirfd.h (dirfd): Elide prototype if dirfd is a macro.
6587
6588 2002-03-10  Jim Meyering  <jim@meyering.net>
6589
6590         * makepath.c (make_path): Remove a comma from a diagnostic.
6591         Suggestion from Santiago Vila.
6592
6593 2002-03-08  Jim Meyering  <jim@meyering.net>
6594
6595         * rename.c: Mention that this wrapper is needed also on
6596         mips-dec-ultrix4.4 systems.
6597
6598 2002-03-02  Jim Meyering  <jim@meyering.net>
6599
6600         * gettime.c (gettime): Test HAVE_CLOCK_GETTIME,
6601         not HAVE_CLOCK_SETTIME.
6602
6603 2002-02-27  Paul Eggert  <eggert@twinsun.com>
6604
6605         * nanosleep.h: Rename to....
6606         * timespec.h: New name for nanosleep.h.  All uses changed.
6607
6608         * gettime.c: New file.
6609         * settime.c: New file.
6610         * stime.c: Remove.
6611
6612         * Makefile.am (libfetish_a_SOURCES): Add gettime.c, settime.c,
6613         timespec.h.  Remove nanosleep.h.
6614
6615 2002-02-25  Paul Eggert  <eggert@twinsun.com>
6616
6617         * acl.c, acl.h: New files.
6618         * Makefile.am (libfetish_a_SOURCES): Add acl.h, acl.c.
6619
6620 2002-02-24  Jim Meyering  <jim@meyering.net>
6621
6622         * strnlen.c (strnlen): Define-away/undef so that an inconsistent
6623         prototype in string.h (on at least AIX4.3.2.0 w/gcc-2.95.3) doesn't
6624         cause trouble.  Reported by Nelson Beebe.
6625
6626 2002-02-23  Paul Eggert  <eggert@twinsun.com>
6627
6628         * path-concat.c (xpath_concat): Reorder code to pacify
6629         compilers that don't know that xalloc_die never returns.
6630
6631 2002-02-20  Jim Meyering  <jim@meyering.net>
6632
6633         * getdate.c: Regenerate using bison-1.33.
6634
6635 2002-02-15  Paul Eggert  <eggert@twinsun.com>
6636
6637         * posixver.c, posixver.h: New files.
6638         * Makefile.am (libfetish_a_SOURCES): Add them.
6639
6640 2002-02-02  Paul Eggert  <eggert@twinsun.com>
6641             Bruno Haible  <bruno@clisp.org>
6642
6643         * unicodeio.h (print_unicode_char): Add exit_on_error argument.
6644         (fwrite_success_callback): New declaration.
6645         * unicodeio.c (unicode_to_mb): New function, extracted from
6646         print_unicode_char. Call failure callback instead of error.
6647         (fwrite_success_callback): New function.
6648         (exit_failure_callback): New function.
6649         (fallback_failure_callback): New function.
6650         (print_unicode_char): Call unicode_to_mb.
6651
6652 2002-01-26  Jim Meyering  <jim@meyering.net>
6653
6654         * Makefile.am (getdate$U.o): Depend on unlocked-io.h.
6655
6656 2002-01-22  Jim Meyering  <jim@meyering.net>
6657
6658         * Makefile.am (Makefile): Don't depend on $(BUILT_SOURCES).
6659         Otherwise, some versions of automake would omit the rule that makes
6660         Makefile from Makefile.in.
6661
6662 2001-01-21  Paul Eggert  <eggert@twinsun.com>
6663
6664         * xmemcoll.h, xmemcoll.c: New files.
6665         * Makefile.am (libfetish_a_SOURCES): Add them.
6666         * memcoll.c: Include errno.h, and declare errno if not defined.
6667         (memcoll): Set errno to zero if there is no error.
6668
6669         * quotearg.c (quotearg_buffer_restyled):
6670         Fix bug with quoting buffers containing NUL when backslashing escapes.
6671         This bug was exposed by the other changes in this patch.
6672         (quotearg_n_options): New arg ARGSIZE.
6673         All callers changed.
6674         (quoting_options_from_style): New function.
6675         (quotearg_n_style): Use it.
6676         (quotearg_n_style_mem): New function.
6677
6678         * quotearg.h (quotearg_n_style_mem): New function.
6679
6680 2002-01-16  Jim Meyering  <jim@meyering.net>
6681
6682         * getdate.y: Add three semicolons, each just before a closing brace.
6683         Bison (as of version 1.31) no longer papers over that mistake.
6684
6685 2002-02-14  Paul Eggert  <eggert@twinsun.com>
6686
6687         * backupfile.c (ISDIGIT): Comment fix.
6688         * getdate.y (ISDIGIT): Likewise.
6689         * posixtm.c (ISDIGIT, year): Likewise.
6690         * strverscmp.c (ISDIGIT): Likewise.
6691         * userspec.c (ISDIGIT): Likewise.
6692
6693 2002-01-05  Jim Meyering  <jim@meyering.net>
6694
6695         * version-etc.c (version_etc_copyright): Update copyright year.
6696
6697 2001-01-19  Paul Eggert  <eggert@twinsun.com>
6698
6699         * closeout.c (close_stdout_status): If ferror (stdout), do
6700         not silently exit merely because the output buffer happens to
6701         have nothing pending.
6702
6703 2001-12-18  Paul Eggert  <eggert@twinsun.com>
6704
6705         See the big note in ../ChangeLog.
6706         * human.c (suffixes): Prefer K to k for 1024.
6707         (generate_suffix_backwards): New function.
6708         (human_readable_inexact): Use it.
6709         * xstrtol.c (__xstrtol): If there is no number but there
6710         is a valid suffix, assume 1.  "MB" now means decimal, "MiB" binary.
6711         Accept 'K' as well as 'k'.
6712
6713 2001-12-15  Jim Meyering  <jim@meyering.net>
6714
6715         * regex.h (__restrict_arr): Update from libc.
6716
6717         * mountlist.h (ME_REMOTE): Recognize file systems of type smbfs
6718         as `remote' if the name starts with `//'.  Suggested by Michael Stone.
6719         (STREQ): Define.
6720
6721 2001-12-10  Jim Meyering  <jim@meyering.net>
6722
6723         * linebuffer.c: Remove explicit declarations of xmalloc and xrealloc,
6724         Instead, include "xalloc.h".
6725         (initbuffer): Don't cast xmalloc return value to char*.
6726         (readline): Reword comment.
6727         Don't cast xrealloc return value to char*
6728         Return NULL, not 0.
6729
6730 2001-12-09  Jim Meyering  <jim@meyering.net>
6731
6732         * modechange.c (mode_compile): Add cast to avoid pedantic warning about
6733         `signed and unsigned type in conditional expression'.
6734         * posixtm.c (posix_time_parse): Likewise.
6735
6736         * xreadlink.c (xreadlink): Add cast to avoid a pedantic warning.
6737
6738         * readtokens.c (readtoken): Declare an index to be of type unsigned
6739         to avoid a pedantic warning.
6740
6741         * getstr.c: Don't include assert.h.
6742         (getstr): Remove warning-evoking assertions.
6743         Return -1 if offset parameter is out of bounds.
6744         Change the type of a local from int to size_t.
6745
6746         * strftime.c (my_strftime_localtime_r): Include this function
6747         definition in the `#if ! HAVE_TM_GMTOFF' block.
6748
6749         * xgethostname.c: Remove declarations of xmalloc and xrealloc.
6750         Include xalloc.h instead.
6751
6752 2001-12-02  Jim Meyering  <jim@meyering.net>
6753
6754         * tempname.c: Don't declare getenv, thus reverting the change of
6755         2001-11-18.  It's no longer necessary, now that stdlib.h is always
6756         included.
6757
6758         * regex.c [!__BOUNDED_POINTERS__]: Define away __bounded,
6759         __unbounded, and __ptrvalue.  Reported by Uwe H. Steinfeld.
6760
6761 2001-11-30  Akim Demaille  <akim@epita.fr>
6762
6763         * xstrdup.c: Include xalloc.h, so that xstrdup is declared
6764         before being defined.
6765
6766 2001-11-27  Paul Eggert  <eggert@twinsun.com>
6767
6768         * quotearg.h (quotearg_n, quotearg_n_style):
6769         First arg is int, not unsigned.
6770         * quotearg.c (quotearg_n, quotearg_n_style): Likewise.
6771         (SIZE_MAX, UINT_MAX): New macros.
6772         (quotearg_n_options): Abort if N is negative.
6773         Avoid overflow check on hosts where size_t is 64 bits and int
6774         is 32 bits, as overflow is impossible there.
6775         Fix off-by-one typo that caused unnecessary reallocation.
6776
6777 2001-11-27  Jim Meyering  <jim@meyering.net>
6778
6779         * tempname.c: Merge with version from libc.
6780         * regex.c: Likewise.
6781
6782         * tempname.c: Include stdlib.h unconditionally.  On some old systems
6783         for which STDC_HEADERS is 0, it was not included, resulting in a
6784         warning about an integer-to-pointer conversion problem with getenv.
6785         Reported by Volker Borchert.
6786
6787 2001-11-26  Jim Meyering  <jim@meyering.net>
6788
6789         * gtod.h: Remove file.
6790         * Makefile.am (libfetish_a_SOURCES): Remove gtod.h.
6791         * gettimeofday.c: Don't include gtod.h.
6792         (GTOD_init): Remove function.
6793         (rpl_gettimeofday): Do its job here instead, rather than aborting.
6794         Suggestion from Volker Borchert.
6795
6796 2001-11-23  Jim Meyering  <jim@meyering.net>
6797
6798         * hash.h (struct hash_table): Don't define here.  Merely declare it.
6799         * hash.c (struct hash_table): Define it here instead.
6800
6801 2001-11-22  Jim Meyering  <jim@meyering.net>
6802
6803         * hash.h: Bracket contents of file with #ifndef HASH_H_ ... #endif.
6804
6805 2001-11-18  Paul Eggert  <eggert@twinsun.com>
6806
6807         * tempname.c (TMP_MAX): Remove; no longer needed.
6808         (TEMPORARIES): New macro.
6809         (__gen_tempname): Use TEMPORARIES rather than TMP_MAX.  This
6810         removes an artificial limitation (e.g. HP-UX 10.20, where
6811         TMP_MAX is 17576).
6812
6813 2001-11-18  Jim Meyering  <jim@meyering.net>
6814
6815         * tempname.c [!HAVE_DECL_GETENV]: Declare getenv to avoid warning
6816         on SunOS 4.
6817
6818         * Makefile.am (Makefile): Depend on $(BUILT_SOURCES), so those
6819         files will be created before anything else.
6820
6821 2001-11-17  Jim Meyering  <jim@meyering.net>
6822
6823         * modechange.c (mode_adjust): Fix error introduced on 1999-04-26
6824         that made e.g., `chmod a=,o=w,g=o F' cause F to be group readable
6825         rather than group writable.  Patch by Juan F. Codagnone.
6826
6827         * readtokens.c: Remove explicit declarations of xmalloc and xrealloc,
6828         Instead, include "xalloc.h".
6829
6830         * mountlist.c: Include unlocked-io.h after all system headers.
6831         Remove explicit declarations of xmalloc, xrealloc,
6832         and xstrdup.  Instead, include "xalloc.h".
6833
6834         * argmatch.c, closeout.c, error.c, exclude.c: Include unlocked-io.h.
6835         * fatal.c, getdate.y, getpass.c, getstr.c, getusershell.c: Likewise.
6836         * mountlist.c, posixtm.c, readtokens.c, readutmp.c: Likewise.
6837
6838         * regex.c, sha.c, version-etc.c, yesno.c: Likewise.
6839         Reported by Padraig Brady.
6840
6841         * mkstemp.c: #undef mkstemp.
6842         Include config.h.
6843         (rpl_mkstemp): Rename from mkstemp.
6844         Protoize.
6845
6846 2001-11-16  Jim Meyering  <jim@meyering.net>
6847
6848         * physmem.c [HAVE_SYS_PSTAT_H]: Include <sys/pstat.h>.
6849         (physmem_total) [HAVE_PSTAT_GETSTATIC]: If sysconf couldn't be used to
6850         determine the amount of total physical memory, use pstat_getstatic.
6851         HPUX-11 doesn't define _SC_PHYS_PAGES.
6852         (physmem_available) [HAVE_PSTAT_GETSTATIC && HAVE_PSTAT_GETDYNAMIC]:
6853         If sysconf couldn't be used to determine the amount of available
6854         physical memory, use both pstat_getstatic and pstat_getdynamic.
6855         Based on a patch from Bob Proulx.
6856
6857 2001-11-05  Jim Meyering  <jim@meyering.net>
6858
6859         * xstat.in (slash_aware_lstat): Correct a misleading comment.
6860
6861 2001-11-03  Jim Meyering  <jim@meyering.net>
6862
6863         * argmatch.h (ARGMATCH_TO_ARGUMENT): Remove casts of first two args
6864         in argmatch_to_argument call.
6865
6866         * dirfd.c (dirfd): Reflect the fact that DIR_TO_FD now takes an
6867         argument.
6868
6869         * hash.c (hash_clear): Fix a bug that could lead to an infloop or
6870         e.g., a fault due to an attempt to free a NULL pointer.
6871
6872 2001-11-01  Jim Meyering  <jim@meyering.net>
6873
6874         * dirfd.c, dirfd.h: New files.
6875         * Makefile.am (libfetish_a_SOURCES): Add dirfd.h.
6876
6877         * hash.c (hash_print) [TESTING]: Clean up.
6878
6879 2001-10-22  Paul Eggert  <eggert@twinsun.com>
6880
6881         * hard-locale.c (alloca): Define to __builtin_alloca if __GNUC__,
6882         to avoid a warning if -Wall.
6883
6884 2001-10-21  Paul Eggert  <eggert@twinsun.com>
6885
6886         * regex.c (uintptr_t): Remove macro and decl; it's config.h's job.
6887
6888 2001-10-21  Jim Meyering  <jim@meyering.net>
6889
6890         * obstack.c (_): Honor the setting of ENABLE_NLS.  Otherwise,
6891         this code would end up calling gettext even in packages built
6892         with --disable-nls.
6893         * getopt.c (_): Likewise.
6894         * regex.c (_): Likewise.
6895
6896 2001-10-20  Paul Eggert  <eggert@twinsun.com>
6897
6898         * error.c (strerror_r): Do not declare unless !_LIBC.
6899         Do not check for HAVE_DECL_STRERROR_R missing unless STRERROR_R_CHAR_P.
6900         Use strerror_r that is only a macro, even if it is not a function.
6901         (strerror): Check for HAVE_DECL_STRERROR before declaring.
6902         (private_strerror): Use prototypes, not old-style function definition.
6903         (print_errno_message): New function.
6904         Support the POSIX 'int'-flavored strerror_r, as well as the traditional
6905         char*-flavored one.
6906         (error_tail, error, error_at_line): Use it.
6907
6908 2001-10-11  Jim Meyering  <jim@meyering.net>
6909
6910         * argmatch.c (argmatch_invalid): Use quotearg_n_style (0, ...
6911         and quote_n (1, ... to avoid clobbering a buffer.
6912
6913 2001-10-05  Jim Meyering  <jim@meyering.net>
6914
6915         * Makefile.am: (libfetish_a_SOURCES): Add hash-pjw.c and hash-pjw.h.
6916         * hash-pjw.c: New file (factored out of fileutils' remove.c).
6917         * hash-pjw.h: New file.
6918
6919 2001-09-30  Jim Meyering  <jim@meyering.net>
6920
6921         * mountlist.c [MOUNTED_GETFSSTAT]:
6922         Include <sys/ucred.h>, for Apple Darwin.
6923         Include sys/mount.h and sys/fs_types.h only if available.
6924         (FS_TYPE): Define.
6925         (read_filesystem_list): Use FS_TYPE.
6926
6927 2001-09-29  Paul Eggert  <eggert@twinsun.com>
6928
6929         * exclude.c (excluded_filename): 0 -> false, since it's
6930         a boolean context.
6931
6932 2001-09-28  Paul Eggert  <eggert@twinsun.com>
6933
6934         Fix bug reported by Petter Reinholdtsen for HP-UX 10.20, which
6935         #defines strtoimax.  Also treat the other strto* functions
6936         like strtoimax.
6937
6938         * xstrtol.c (strtol): Do not declare if HAVE_DECL_STRTOL.
6939         (strtoul): Do not declare if HAVE_DECL_STRTOUL.
6940         (strtoimax, strtoumax): Do not declare if already defined as a macro.
6941
6942 2001-09-26  Jim Meyering  <jim@meyering.net>
6943
6944         Most macros in unlocked-io.h had the wrong number of arguments.
6945         * gen-uio: New script.
6946         (USE_UNLOCKED_IO): Define to 1 if not already defined.
6947         * unlocked-io.hin: Remove file.
6948         * Makefile.am (unlocked-io.h): Rewrite to use a separate script,
6949         rather than trying to embed it here.
6950         (EXTRA_DIST): Add gen-uio.  Remove unlocked-io.hin
6951         Reported by Padraig Brady.
6952
6953 2001-09-25  Volker Borchert  <bt@teknon.de>
6954
6955         * gettimeofday.c (rpl_gettimeofday): Declare local variable `result'.
6956
6957 2001-09-23  Jim Meyering  <jim@meyering.net>
6958
6959         * mountlist.c: Remove useless parentheses in #if directives.
6960         (MOUNTED) [!defined MOUNTED]: Define to _PATH_MOUNTED, for when
6961         the deprecated MOUNTED symbol is no longer defined in mntent.h.
6962
6963 2001-09-22  Jim Meyering  <jim@meyering.net>
6964
6965         * localcharset.c: Update from latest gettext.
6966         * config.charset: Likewise.
6967
6968 2001-09-20  Jim Meyering  <jim@meyering.net>
6969
6970         * xstrtol.c (strtoimax): Guard declaration with
6971         `#if !HAVE_DECL_STRTOIMAX', rather than just `#ifndef strtoimax'.
6972         The latter fails because some systems (at least rs6000-ibm-aix4.3.3.0)
6973         have their own, conflicting declaration of strtoimax in sys/inttypes.h.
6974         (strtoumax): Likewise, for completeness (it wasn't necessary).
6975
6976 2001-09-06  Paul Eggert  <eggert@twinsun.com>
6977
6978         * strtoimax.c (HAVE_LONG_LONG):
6979         Redefine to HAVE_UNSIGNED_LONG_LONG if unsigned.
6980         (strtoimax): Use sizeof (long), not sizeof strtol (ptr, endptr, base),
6981         to work around bug in IBM C compiler.
6982
6983 2001-09-16  Jim Meyering  <jim@meyering.net>
6984
6985         * mkdir.c: New file.
6986
6987 2001-09-04  Paul Eggert  <eggert@twinsun.com>
6988
6989         * xgetcwd.c: Revert some of the previous change; intead,
6990         fix the HAVE_GETCWD_NULL code to behave more like the
6991         !HAVE_GETCWD_NULL code used to.
6992
6993         Include "xalloc.h".
6994         (xgetcwd): Do not return NULL when memory is exhausted; instead,
6995         invoke xalloc_die.
6996
6997 2001-09-04  Paul Eggert  <eggert@twinsun.com>
6998
6999         * xreadlink.c (xreadlink): Omit size_t* arg.  All uses changed.
7000         Use ssize_t, not int, to store result of readlink.
7001         Check for ssize_t overflow as well as size_t overflow,
7002         as POSIX says the result of readlink is implementation-defined
7003         when ssize_t overflows.
7004         Remove unnecessary cast to char*.
7005         Use free+malloc instead of realloc, as the storage doesn't need
7006         to be preserved and it's clearer and can be more efficient that way.
7007         (SIZE_MAX, SSIZE_MAX): New macros, if <limits.h> doesn't declare.
7008         * xreadlink.h (xreadlink): Update prototype.
7009
7010 2001-09-03  Paul Eggert  <eggert@twinsun.com>
7011
7012         * exclude.c (fnmatch_no_wildcards): Fix confusion between
7013         usage of FNM_CASEFOLD and FNM_LEADING_DIR.  The bug was
7014         spotted by Jim Meyering.
7015
7016 2001-09-03  Jim Meyering  <jim@meyering.net>
7017
7018         * xreadlink.c (xreadlink): Preserve errno around `free' during failure.
7019
7020 2001-09-03  Paul Eggert  <eggert@twinsun.com>
7021
7022         * xgetcwd.c: Fix the !HAVE_GETCWD_NULL code to behave more
7023         like the HAVE_GETCWD_NULL code.
7024         Include pathmax.h if not HAVE_GETCWD.
7025         Do not include xalloc.h.
7026         (INITIAL_BUFFER_SIZE): New symbol.
7027         Do not use xmalloc / xrealloc, since the caller is responsible for
7028         handling errors.  Preserve errno around `free' during failure.
7029         Do not overrun buffer when using getwd.
7030
7031 2001-09-03  Paul Eggert  <eggert@twinsun.com>
7032
7033         * xgetcwd.c (xgetcwd): Use HAVE_GETCWD_NULL, not (defined
7034         __GLIBC__ && __GLIBC__ >= 2), to decide whether to use getcwd (NULL, 0).
7035
7036 2001-09-02  Jim Meyering  <jim@meyering.net>
7037
7038         * error.c: Update from GNU libc.
7039
7040 2001-09-01  Jim Meyering  <jim@meyering.net>
7041
7042         * xreadlink.c: New file.
7043         * xreadlink.h: New file.
7044         * Makefile.am (libfetish_a_SOURCES): Add xreadlink.c and xreadlink.h.
7045
7046         * regex.c (uintptr_t) [!_LIBC]: Define to private_uintptr_t, so it
7047         doesn't conflict with sparc Solaris 7's definition in
7048         /usr/include/sys/int_types.h.
7049
7050         * exclude.c: Use `""', not `<>' to #include non-system header files.
7051         (fnmatch_no_wildcards): Rewrite not to use function names, strcasecmp
7052         and strncasecmp as r-values.  Unixware didn't have declarations.
7053
7054 2001-08-31  Jim Meyering  <jim@meyering.net>
7055
7056         * xgetcwd.c (xgetcwd): Reorganize to avoid some duplication.
7057         Use an initial, malloc'd, buffer of length 128 rather than
7058         a statically allocated one of length 1024.
7059
7060 2001-08-30  Paul Eggert  <eggert@twinsun.com>
7061
7062         * xgetcwd.c: Don't include pathmax.h.
7063         Include stdlib.h and unistd.h if available.
7064         Include xalloc.h.
7065         (xmalloc, xstrdup, free): Remove decls.
7066         (xgetcwd): Don't assume sizes fit in unsigned.
7067         Check for overflow when computing sizes.
7068         Simplify reallocation code.
7069
7070 2001-08-28  Paul Eggert  <eggert@twinsun.com>
7071
7072         * Makefile.am (libfetish_a_SOURCES): Remove strtoxmax.c.
7073
7074         * strtoimax.c: Renamed from strtoxmax.c, removing the
7075         old strtoimax.c.
7076
7077         Also, make the following further changes to make this file's
7078         configuration more similar to that of strtol.c:
7079         (UNSIGNED): Renamed from STRTOUXMAX_UNSIGNED.  All uses changed.
7080         (strtoumax, uintmax_t, strtoull, strtol): Remove.
7081         (intmax_t, strtoimax, strtol, strtoll): New macros, if UNSIGNED.
7082         (strtoimax): Renamed from strtoumax.  All uses of unsigned values
7083         changed to signed values.
7084
7085         And make the following changes as well:
7086         Fix copyright notice, as 1999 was missing.
7087         (verify): New macro.
7088         (strtoimax): Check sizes at compile-time, not run-time.
7089         Prefer strtol to strtoll if both work.
7090         (main): Remove; it was not that useful and was a pain to maintain.
7091
7092         * strtoumax.c: Include strtoimax.c, not strtouxmax.c.
7093
7094 2001-08-30  Paul Eggert  <eggert@twinsun.com>
7095
7096         * savedir.c (savedir): Remove size parameter, as POSIX says that
7097         a directory's st_size can have an arbitrary value, so the old
7098         usage could waste an arbitrary amount of memory.  All uses
7099         changed.
7100         * savedir.h: Update prototype.
7101
7102 2001-08-30  Paul Eggert  <eggert@twinsun.com>
7103
7104         * xstrtol.c (strtoimax): New decl.
7105
7106 2001-08-28  Paul Eggert  <eggert@twinsun.com>
7107
7108         * xstrtol.h: Add copyright notice.
7109         (_DECLARE_XSTRTOL): Improve quality of diagnostic for
7110         LONGINT_INVALID_SUFFIX_CHAR.
7111
7112 2001-08-30  Paul Eggert  <eggert@twinsun.com>
7113
7114         * quotearg.c: BSD/OS 4.1 wchar.h requires FILE and struct
7115         tm to be declared.
7116
7117 2001-08-30  Paul Eggert  <eggert@twinsun.com>
7118
7119         * hash.c: Remove '2001' from copyright notice.
7120
7121 2001-08-30  Paul Eggert  <eggert@twinsun.com>
7122
7123         * full-write.h: New file.
7124         * Makefile.am (libfetish_a_SOURCES): Add full-write.h.
7125         * full-write.c: Correct credits, as cccp.c no longer
7126         exists and anyway it was so heavily changed from the old cccp
7127         code as to be unrecognizable.  Include full-write.h.
7128         (full_write) Return size_t, with short writes meaning failure.
7129         All callers changed.  This fixes a bug with large buffers
7130         on 64-bit hosts.
7131         * utime.c: Include full-write.h.
7132
7133 2001-08-30  Paul Eggert  <eggert@twinsun.com>
7134
7135         Merge 'exclude' changes from tar 1.13.22.
7136         This fixes one or two unlikely storage allocation overflow bugs,
7137         but doesn't change user-visible behavior otherwise.
7138
7139 2001-08-30  Paul Eggert  <eggert@twinsun.com>
7140
7141         * exclude.c (bool): Declare, perhaps by including stdbool.h.
7142         (<sys/types.h>): Include only if HAVE_SYS_TYPES_H.
7143         (<stdlib.h>, <string.h>, <strings.h>, <inttypes.h>, <stdint.h>):
7144         Include if available.
7145         (<xalloc.h>): Include
7146         (SIZE_MAX): Define if <stdint.h> or <inttypes.h> doesn't.
7147         (verify): New macro.  Use it to verify that EXCLUDE macros do not
7148         collide with FNM macros.
7149         (struct patopts): New struct.
7150         (struct exclude): Use it, as exclude patterns now come with options.
7151         (new_exclude): Support above changes.
7152         (new_exclude, add_exclude_file):
7153         Initial size must now be a power of two to simplify overflow checking.
7154         (free_exclude, fnmatch_no_wildcards): New function.
7155         (excluded_filename): No longer requires options arg, as the options
7156         are determined by add_exclude.  Now returns bool, not int.
7157         (excluded_filename, add_exclude):
7158         Add support for the fancy new exclusion options.
7159         (add_exclude, add_exclude_file): Now takes int options arg.
7160         Check for arithmetic overflow when computing sizes.
7161         (add_exclude_file): xrealloc might modify errno, so don't
7162         realloc until after errno might be used.
7163
7164         * exclude.h (EXCLUDE_ANCHORED, EXCLUDE_INCLUDE,EXCLUDE_WILDCARDS):
7165         New macros.
7166         (free_exclude): New decl.
7167         (add_exclude, add_exclude_file): Now takes int options arg.
7168         (excluded_filename): No longer requires options arg, as the options
7169         are determined by add_exclude.  Now returns bool, not int.
7170
7171 2001-08-30  Paul Eggert  <eggert@twinsun.com>
7172
7173         * alloca.c (alloca): Arg is of type size_t, not unsigned.
7174
7175 2001-08-27  Jim Meyering  <jim@meyering.net>
7176
7177         * Makefile.am (libfetish_a_SOURCES): Add strtoxmax.c
7178
7179         * version-etc.c (N_): Remove definition.
7180         Revert most of last change.
7181         Instead, simply don't mark the `Copyright...' string for translation.
7182         Based on advice from Paul Eggert.
7183
7184         * strtoxmax.c: Tweak comment.
7185
7186 2001-08-26  Jim Meyering  <jim@meyering.net>
7187
7188         * version-etc.c (version_etc_copyright_fmt): Replace literal year
7189         of copyright with `%s' so translators don't get an untranslated
7190         message in 2002.
7191         (COPYRIGHT_YEAR): Define.
7192         (version_etc): Use fprintf rather than fputs.
7193         Suggestion from Ulrich Drepper.
7194
7195         * Makefile.am (libfetish_a_SOURCES): Add xstrtoimax.c.
7196
7197         * strtoll.c: New file, from GNU libc.
7198         * xstrtoimax.c: New file.
7199
7200         * xstrtol.h: Add xstrtoimax.
7201         * strtoumax.c: New file.  Simply include "strtoumax.c".
7202         * strtoimax.c: New file.  Likewise, but first define STRTOUXMAX_SIGNED.
7203
7204         * strtoumax.c: Factor to work both for unsigned and signed types, ...
7205         * strtoxmax.c: ... then renamed to this.
7206
7207 2001-08-13  Paul Eggert  <eggert@twinsun.com>
7208
7209         * Makefile.am (unlocked-io.h): Do not append "_unlocked" twice.
7210         Port to Solaris 8, where 'sed' requires a space after the 'r'
7211         command, and where sh dislikes "$/".  Clean up the spacing a bit.
7212         Redirect output to $tmp just once.
7213
7214 2001-08-12  Paul Eggert  <eggert@sic.twinsun.com>
7215
7216         * addext.c (<errno.h>): Include.
7217         (errno): Declare if not defined.
7218         (addext): Work correctly when pathconf returns -1 and leaves
7219         errno alone because there is no limit.  Also, work even if
7220         pathconf returns a value greater than SIZE_MAX.
7221
7222 2001-08-12  Jim Meyering  <jim@meyering.net>
7223
7224         * xgetcwd.c (xgetcwd) [defined __GLIBC__ && __GLIBC__ >= 2]:
7225         Simply `return getcwd (NULL, 0);'.
7226         [! (defined __GLIBC__ && __GLIBC__ >= 2)]:
7227         Use 1300 as initial value for length, not PATH_MAX.
7228
7229         * pathmax.h: Clean up cpp syntax.
7230
7231 2001-08-12  Jim Meyering  <jim@meyering.net>
7232
7233         * gettimeofday.c: New file.
7234         * gtod.h: New file.
7235         * Makefile.am (libfetish_a_SOURCES): Add gtod.h.
7236
7237 2001-08-04  Jim Meyering  <jim@meyering.net>
7238
7239         * error.h (__attribute__): Remove `|| __STRICT_ANSI__' from #if stmt,
7240         to get in sync with glibc.
7241
7242 2001-08-03  Paul Eggert  <eggert@twinsun.com>
7243
7244         The following changes are from gettext 0.10.39 as maintained by
7245         Bruno Haible.
7246
7247         * mbswidth.h (MBSW_REJECT_UNPRINTABLE, MBSW_REJECT_INVALID):
7248         Renamed from MBSW_ACCEPT_UNPRINTABLE and MBSW_ACCEPT_INVALID
7249         with inverted sense.  All uses changed.
7250
7251         * mbswidth.c: Don't include <limits.h>.
7252         Include <stdlib.h> and <string.h> unconditionally.
7253         (iswcntrl, mbsinit, ISCNTRL): New macros.
7254         (mbsnwidth): Use K&R style function declarations.
7255         Don't bother checking for MB_LEN_MAX == 1, since the compiler
7256         can optimize it when MB_CUR_MAX == 1.
7257         The width of control characters is zero, not 1.
7258
7259 2001-07-15  Jim Meyering  <jim@meyering.net>
7260
7261         * Makefile.am (EXTRA_DIST): Add unlocked-io.hin.
7262         (BUILT_SOURCES): Add unlocked-io.h.
7263         (io_functions): Define.
7264         (unlocked-io.h): New rule.
7265         (DISTCLEANFILES): Add unlocked-io.h.
7266         (all-local): Depend on unlocked-io.h, to ensure it is created.
7267
7268         * unlocked-io.hin: New file
7269
7270         * regex.c: Update from glibc.
7271
7272 2001-07-05  Jim Meyering  <jim@meyering.net>
7273
7274         * Makefile.am (noinst_HEADERS): Remove definition, per new automake
7275         recommendation.
7276         (libfetish_a_SOURCES): Put all .h files here instead.
7277         Remove a thus-exposed (better checks in automake) duplicate and
7278         two unnecessary .h files.
7279
7280 2001-06-11  Jim Meyering  <jim@meyering.net>
7281
7282         * regex.c: Update from GNU libc.
7283
7284 2001-05-27  Jim Meyering  <jim@meyering.net>
7285
7286         * readutmp.h (UT_TYPE): Define.
7287
7288 2001-05-24  Jim Meyering  <jim@meyering.net>
7289
7290         * argmatch.c: Include "quote.h".
7291         (argmatch_invalid): Remove explicit `' quotes.  Instead, use the
7292         quote function.  Reported by Göran Uddeborg.
7293
7294 2001-05-20  Alexandre Duret-Lutz  <duret_g@epita.fr>
7295
7296         * dirname.c (dir_name): Compute append_dot using path, not newpath
7297         which is not yet declared.
7298
7299 2001-05-11  Paul Eggert  <eggert@twinsun.com>
7300
7301         * Makefile.am (libfetish_a_SOURCES):
7302         Add strftime.c, since we now compile it on all hosts.
7303
7304         * strftime.c (my_strftime):
7305         Define to nstrftime if emacs, but only if my_strftime is not defined.
7306         (extra_args, extra_args_spec, extra_args_spec_iso): Rename from
7307         ut_argument, ut_argument_spec, ut_argument_spec_iso, respectively.
7308         Add one more extra argument: a nanoseconds value.
7309         All uses changed.
7310         (ns): New macro.
7311         (my_strftime function): Add %N format.
7312         (emacs_strftimeu): Renamed from emacs_strftime,
7313         with extra ut argument.
7314
7315 2001-05-11  Paul Eggert  <eggert@twinsun.com>
7316
7317         dirname code cleanup.  base_name now behaves more compatibly
7318         with POSIX basename when given file names that have trailing
7319         slashes, and similarly for dir_name.  Add new primitives
7320         base_len and dir_len.  Put the directory-name-related decls
7321         into dirname.h.
7322
7323         * addext.c (ISSLASH, base_name): Remove; now in dirname.h.
7324         * backupfile.c (base_name): Likewise.
7325         * basename.c (FILESYSTEM_PREFIX_LEN, PARAMS, ISSLASH): Likewise.
7326         * dirname.c (FILESYSTEM_PREFIX_LEN, ISSLASH): Likewise.
7327         * makepath.c (strip_trailing_slashes): Likewise.
7328         * path-concat.c (DIRECTORY_SEPARATOR, FILESYSTEM_PREFIX_LEN, ISSLASH):
7329         Likewise.
7330         * rename.c (strip_trailing_slashes): Likewise.
7331         * same.c (base_name): Likewise.
7332         * stripslash.c (ISSLASH): Likewise.
7333
7334         * addext.c: Include <dirname.h> after size_t is defined.
7335         * backupfile.c: Likewise.
7336
7337         * addext.c (addext): Use base_len to trim redundant
7338         trailing slashes instead of doing it ourselves.
7339         But do not trim the last slash if it is not redundant.
7340
7341         * backupfile.c (find_backup_file_name,
7342         max_backup_version): Use base_len instead of rolling it ourselves.
7343         Handle the case of "" and (on DOS) "C:" correctly.
7344
7345         * basename.c: Do not include <stdio.h>, <assert.h>; no longer needed.
7346         Include <string.h>, <dirname.h>.
7347         (base_name): Allow file names ending in slashes, other than names
7348         that are all slashes.  In this case, return the basename followed
7349         by the slashes.  This is more general, and can be used in places
7350         where the original base_name purposely had an assertion failure.
7351         (base_len): New function.
7352
7353         * dirname.c: Include <string.h> instead of <stdlib.h>.
7354         Do not include <assert.h>; no longer needed.
7355         Include xalloc.h.
7356         (memrchr): Remove decl.
7357         (dir_name_r): Remove.
7358         (dir_len): Renamed from dirlen.  All callers changed.
7359         Rewrite in terms of base_name, for simplicity and consistency.
7360         (dir_name): Never return NULL.  All callers changed.
7361         Do not include <stdlib.h> in test program; no longer needed.
7362         return 0; is fine for test program.
7363
7364         * dirname.h (DIRECTORY_SEPARATOR, ISSLASH, FILESYSTEM_PREFIX_LEN):
7365         New macros.
7366         (base_name, base_len, dir_len, strip_trailing_slashes): New decls.
7367
7368         * path-concat.c (path_concat): Use base_len to compute
7369         base length, not strlen; this means we cannot rely on memcpy
7370         to null-terminate.
7371
7372         * same.c (STREQ): Remove.
7373         (same_name): Handle the case where the basename ends in trailing '/'.
7374
7375         * stripslash.c (strip_trailing_slashes): Return nonzero if
7376         a slash was stripped.  Do not strip the last slash after a
7377         file system prefix.
7378
7379 2001-04-08  Jim Meyering  <jim@meyering.net>
7380
7381         * getdate.y (get_date): Set tm_isdst to -1 to ensure that it is
7382         recomputed; that's necessary when the offset spans a DST transition.
7383         Patch by David J. MacKenzie.  Reported by Hon-Yin Kok.
7384
7385 2001-04-02  Jim Meyering  <jim@meyering.net>
7386
7387         * regex.h, regex.c: Update from GNU libc.
7388
7389 2001-03-19  Paul Eggert  <eggert@twinsun.com>
7390
7391         * version-etc.c (version_etc_copyright): Update to 2001.
7392
7393 2001-03-16  Paul Eggert  <eggert@twinsun.com>
7394
7395         * tempname.c (uint64_t): Define to uintmax_t if
7396         not defined, and if UINT64_MAX is not defined.
7397         Required at least for Vax Ultrix4.3, which doesn't define uint64_t.
7398         Reported by John David Anglin.
7399
7400 2001-03-10  Bruno Haible  <haible@clisp.cons.org>
7401
7402         * localcharset.c (locale_charset): Allow wildcard syntax. Also resolve
7403         alias if codeset is empty.
7404         * config.charset (BeOS): Use wildcard syntax.
7405
7406 2001-03-13  Jim Meyering  <jim@meyering.net>
7407
7408         * path-concat.c (path_concat) [FILESYSTEM_ACCEPTS_DRIVE_LETTER_PREFIX]:
7409         Don't insert a backslash when concatenating e.g., `C:' and `foo'.
7410         From Bruno Haible.
7411
7412 2001-03-06  Bruno Haible  <haible@clisp.cons.org>
7413
7414         * localcharset.c (locale_charset): Don't use setlocale(LC_CTYPE,NULL).
7415         Don't return NULL.
7416         * unicodeio.c (print_unicode_char): Simplify accordingly.
7417
7418 2001-03-06  Bruno Haible  <haible@clisp.cons.org>
7419
7420         * config.charset: Update for FreeBSD 4.2 and OSF/1 5.1. Add
7421         support for DOS/DJGPP.
7422
7423 2001-02-28  Paul Eggert  <eggert@twinsun.com>
7424
7425         * Makefile.am (libfetish_a_SOURCES):
7426         Add dup-safer.c, fopen-safer.c.
7427         (noinst_HEADERS): Add stdio-safer.h, unistd-safer.h.
7428
7429         * dup-safer.c, fopen-safer.c, stdio-safer.h, unistd-safer.h: New files.
7430
7431 2001-02-25  Paul Eggert  <eggert@twinsun.com>
7432
7433         The mkstemp replacement is taken from glibc 2.2.2, with some
7434         portability fixes for use outside glibc, as follows:
7435
7436         * tempname.c (struct_stat64): New macro.
7437         (direxists, __gen_tempname): Use it.
7438         This avoids a portability problem with Solaris 8.
7439
7440         * tempname.c (<config.h>): Include if HAVE_CONFIG_H.
7441         (<stddef.h>, <stdint.h>, <string.h>):
7442         Include only if STDC_HEADERS || _LIBC.
7443         (<fcntl.h>): Include only if HAVE_FCNTL_H || _LIBC.
7444         (<unistd.h>): Include only if HAVE_UNISTD_H || _LIBC.
7445         (<sys/time.h>): Include only if HAVE_SYS_TIME_H || _LIBC.
7446         (__set_errno): Define this macro if <errno.h> doesn't.
7447         (P_tmpdir, TMP_MAX, __GT_FILE, __GT_BIGFILE, __GT_DIR, __GT_NOCREATE):
7448         Define these macros if <stdio.h> doesn't.
7449         (S_ISDIR, S_IRUSR, S_IWUSR, S_IXUSR):
7450         Define these macros if <sys/stat.h>
7451         doesn't.  Ignore <sys/stat.h> S_ISDIR if STAT_MACROS_BROKEN.
7452         (stat64, __getpid, __gettimeofday, __mkdir, __open, __open64, lxstat64,
7453         __xstat64): Define if not _LIBC.
7454         (__secure_getenv): Define if ! (HAVE___SECURE_GETENV || _LIBC).
7455         (__gen_tempname): Invoke gettimeofday only if
7456         HAVE_GETTIMEOFDAY || _LIBC;
7457         otherwise, fall back on plain "time".
7458         Use macros like S_IRUSR | S_IWUSR rather than octal values like 0600.
7459
7460         * mkstemp.c (__GT_FILE): Define to zero if not defined.
7461
7462         * mkstemp.c, tempname.c: New files, taken from glibc 2.2.2.
7463
7464 2001-02-17  Jim Meyering  <jim@meyering.net>
7465
7466         * strtoul.c: Sync from GNU libc.  Use double quotes, not <...>
7467         around included file name.
7468
7469         * strnlen.c (__strnlen): Merge in a change from GNU libc.
7470
7471         * strftime.c: Update from GNU libc (the only changes were to comments).
7472
7473 2001-02-13  Bruno Haible  <haible@clisp.cons.org>
7474
7475         * mbswidth.h (mbswidth): Also define as macro, to avoid prototype clash.
7476
7477 2001-02-17  Paul Eggert  <eggert@twinsun.com>
7478
7479         * mbswidth.c, quotearg.c (mbrtowc, mbsinit):
7480         Remove workaround macros for hosts that have mbrtowc but not
7481         mbstate_t, as we now insist on proper declarations for both
7482         before using mbrtowc.
7483
7484 2001-02-17  Jim Meyering  <jim@meyering.net>
7485
7486         * regex.c: Update from libc.
7487
7488 2001-02-16  Paul Eggert  <eggert@twinsun.com>
7489
7490         * alloca.c (malloc): Undef before defining, since stdlib.h
7491         may have defined it.  Needed for Encore Umax-3.0.9.16b systems.
7492         Reported by Mark Hounschell via Paul Eggert.
7493
7494 2001-01-30  Bruno Haible  <haible@clisp.cons.org>
7495
7496         * config.charset: Update for FreeBSD 4.2.
7497
7498 2001-01-26  Jim Meyering  <jim@meyering.net>
7499
7500         * quotearg.c: Include stddef.h.
7501         * quote.c: Include stddef.h.
7502         Reported by Axel Kittenberger.
7503
7504         * xmalloc.c [HAVE_DONE_WORKING_MALLOC_CHECK]: Enclose error-evoking
7505         line in double quotes so that it evokes a better diagnostic.
7506         [HAVE_DONE_WORKING_REALLOC_CHECK]: Likewise.
7507         Reported by Axel Kittenberger.
7508
7509 2001-01-15  Bruno Haible  <haible@clisp.cons.org>
7510
7511         * unicodeio.c (print_unicode_char): Cast the second iconv() arg,
7512         to avoid a warning.  Add back 'const' to inptr.
7513
7514 2001-01-16  Jim Meyering  <jim@meyering.net>
7515
7516         * basename.c: Include <stdio.h>, needed by assert on SunOS 4.
7517         From Bruno Haible.
7518
7519 2001-01-14  Jim Meyering  <jim@meyering.net>
7520
7521         * rename.c: New file.  From Volker Borchert.
7522         Include stdlib.h, string.h or strings.h, and xalloc.h.
7523         Use strip_trailing_slashes rather than open-coding it.
7524
7525 2001-01-03  Paul Eggert  <eggert@twinsun.com>
7526
7527         * strftime.c: Sync with glibc time/strftime.c 1.81.
7528
7529 2001-01-03  Jim Meyering  <jim@meyering.net>
7530
7531         * unicodeio.c (print_unicode_char): Remove `const' from declaration of
7532         local `inptr' to avoid warning with some system declarations of iconv.
7533
7534 2000-12-29  Paul Eggert  <eggert@twinsun.com>
7535
7536         * modechange.c: Do not assume that mode_t uses the
7537         traditional octal encoding.  E.g. "chmod 1 FOO" should set
7538         the other-execute bit of FOO even if S_IXOTH != 1.
7539
7540         (SUID, SGID, SVTX, RUSR, WUSR, XUSR, RGRP, WGRP, XGRP, ROTH,
7541         WOTH, XOTH, ALLM): New macros.
7542         (S_ISUID, S_ISGID, S_ISVTX, S_IRUSR, S_IWUSR, S_IXUSR,
7543          S_IRGRP, S_IWGRP, S_IXGRP, S_IROTH, S_IWOTH, S_IXOTH):
7544         Use them.
7545         (S_ISGID): Fix typo; it was defaulting to the same value as S_ISUID.
7546         (S_IRWXU, S_IRWXG, S_IRWXO): Specify defaults in terms of the above.
7547         (mode_compile):
7548         No need to use uintmax_t; unsigned long is long enough.
7549         Don't bother to get suffix since we don't use it.
7550
7551 2000-12-24  Jim Meyering  <jim@meyering.net>
7552
7553         * hash.c (is_prime): Return explicit boolean values.
7554         (hash_get_first): Return NULL to appease Irix5.6's 89.
7555         Reported by Nelson Beebe.
7556
7557 2000-10-31  Bruno Haible  <haible@clisp.cons.org>
7558
7559         * localcharset.c (locale_charset): Add support for Win32.
7560
7561 2000-12-18  Paul Eggert  <eggert@twinsun.com>
7562
7563         * physmem.h, physmem.c: New files.
7564
7565         * Makefile.am (libfetish_a_SOURCES): Add physmem.c.
7566         (noinst_HEADERS): Add physmem.h.
7567
7568         * xstrtol.c (__xstrtol): Add undocumented suffixes 'g' and
7569         't' for compatibility with Solaris 8 sort.
7570
7571 2000-12-18  Bruno Haible  <haible@clisp.cons.org>
7572
7573         * config.charset: Add support for BeOS.
7574
7575 2000-12-16  Jim Meyering  <jim@meyering.net>
7576
7577         * getusershell.c [!SHELLS_FILE && __DJGPP__]: Define
7578         SHELLS_FILE to a file name that's useful on djgpp systems.
7579         Include stdlib.h.
7580         (ADDITIONAL_DEFAULT_SHELLS): Define.
7581         (default_shells): Prepend ADDITIONAL_DEFAULT_SHELLS.
7582         Based mostly on a patch from Prashant TR.
7583
7584 2000-12-16  Jim Meyering  <jim@meyering.net>
7585
7586         This bug had a serious impact on chown: `chown N:M FILE' (for integer
7587         N and M) would have treated it like `chown N:N FILE'.
7588
7589         * userspec.c (parse_user_spec): Fix typo: s/u/g/.
7590
7591 2000-10-31  Bruno Haible  <haible@clisp.cons.org>
7592
7593         * config.charset: Add ISO-8859-3, BIG5HKSCS, GB18030, JOHAB, VISCII,
7594         CP874, CP949, CP950, CP1250, CP1253, CP1254, CP1255, CP1256, CP1257
7595         to the list of canonical encodings. Rename EUC-CN to GB2312.
7596
7597 2000-12-08  Andreas Schwab  <schwab@suse.de>
7598
7599         * mbswidth.c (mbsnwidth): Don't loop endlessly when called with an
7600         invalid mulitbyte sequence and with the MBSW_ACCEPT_INVALID flag set.
7601
7602 2000-12-07  Jim Meyering  <jim@meyering.net>
7603
7604         * stripslash.c (ISSLASH): Define.
7605         (strip_trailing_slashes): Use ISSLASH rather than comparing against `/'.
7606         From Prashant TR.
7607
7608         * dirname.c (FILESYSTEM_PREFIX_LEN): Define.
7609         (dir_name_r): Declare this function as static.
7610         [BACKSLASH_IS_PATH_SEPARATOR]: Fix a bug that'd
7611         manifest itself on a name containing a mix of slashes and
7612         backslashes.
7613         Make this function work with names starting with a DOS-style
7614         drive letter and colon prefix.
7615         (dir_name): Append `.' if necessary.
7616         Based mostly on patches from Prashant TR and Eli Zaretskii.
7617
7618         * dirname.h (dir_name_r): Remove prototype.
7619
7620 2000-12-05  Jim Meyering  <jim@meyering.net>
7621
7622         * dirname.c (dir_name_r): Add `const' in a few local declarations.
7623
7624 2000-12-04  Jim Meyering  <jim@meyering.net>
7625
7626         * path-concat.c: [!HAVE_DECL_MALLOC]: Declare malloc.
7627         Also include memory.h, stdlib.h, unistd.h if appropriate.
7628         Reported by Andreas Jaeger (conflicting declaration of malloc).
7629
7630 2000-12-02  Jim Meyering  <jim@meyering.net>
7631
7632         * closeout.h: Make idempotent, to avoid some obscure warnings.
7633
7634 2000-12-01  Paul Eggert  <eggert@twinsun.com>
7635
7636         * memrchr.c: Include <config.h> before any system include file.
7637
7638 2000-11-29  Paul Eggert  <eggert@twinsun.com>
7639
7640         * dirname.c (dir_name_r): Fix typo: int -> size_t.
7641
7642 2000-11-26  Jim Meyering  <jim@meyering.net>
7643
7644         * memcoll.c: Include sys/types.h.  From Werner Almesberger.
7645
7646 2000-11-22  Paul Eggert  <eggert@twinsun.com>
7647
7648         * strftime.c (my_strftime): Do not invoke mbrlen with a
7649         size of (size_t) -1; it's not portable.
7650
7651 2000-11-17  Akim Demaille  <akim@epita.fr>
7652
7653         * obstack.h: Formatting changes.
7654         (obstack_grow, obstack_grow0): Don't cast WHERE at all: that would
7655         prevent type checking.
7656         (obstack_ptr_grow, obstack_ptr_grow_fast): When assigning, don't
7657         cast the value to (void *): assigning a `foo *' to a `void *'
7658         variable is valid.
7659         (obstack_int_grow, obstack_int_grow_fast): Don't cast AINT to int.
7660
7661 2000-11-17  Jim Meyering  <jim@meyering.net>
7662
7663         * strstr.c: Update from GNU libc.
7664
7665 2000-11-16  Jim Meyering  <jim@meyering.net>
7666
7667         * strverscmp.c: Incorporate weak-alias-related changes from glibc.
7668
7669 2000-11-11  Jim Meyering  <jim@meyering.net>
7670
7671         * error.c: Add a couple #includes, merging from GNU libc version.
7672
7673 2000-11-10  Jim Meyering  <jim@meyering.net>
7674
7675         * obstack.h: Update from GNU libc.
7676         * obstack.c: Likewise.
7677
7678 2000-11-06  Paul Eggert  <eggert@twinsun.com>
7679
7680         * getusershell.c (setusershell): Use rewind rather than
7681         fseek/fseeko, to avoid configuration hassles with fseeko.
7682         Don't bother opening SHELLS_FILE if shellstream is NULL;
7683         it's not necessary.
7684
7685 2000-11-05  Jim Meyering  <jim@meyering.net>
7686
7687         * makepath.h (make_dir): Declare.
7688         * makepath.c (make_dir): Remove `static' attribute.
7689         Tweak a comment.
7690
7691 2000-11-04  Alexandre Duret-Lutz  <duret_g@epita.fr>
7692
7693         * hash.c (hash_get_next): Fix a thinko:  when ENTRY is the
7694         last one in a bucket, advance to the next bucket.
7695
7696 2000-11-02  Vesselin Atanasov  <vesselin@bgnet.bg>
7697
7698         * fnmatch.c: Do not comment out all the code if we are using
7699         the GNU C library, because in some cases we are replacing buggy
7700         code in the GNU C library itself.
7701
7702 2000-10-30  Paul Eggert  <eggert@twinsun.com>
7703
7704         * error.h, getline.h, modechange.h:
7705         Remove "2000" from Copyright line, as the file hasn't been
7706         changed this year other than in the copyright notice.
7707
7708         * xalloc.h: Add "2000" to Copyright line, as this file
7709         was changed this year.
7710
7711 2000-10-30  Paul Eggert  <eggert@twinsun.com>
7712
7713         * fnmatch.c (FOLD): Do not assume that characters are unsigned.
7714         (fnmatch): Fix some FNM_FILE_NAME and FNM_LEADING_DIR bugs,
7715         e.g. fnmatch("d*/*1", "d/s/1", FNM_FILE_NAME) incorrectly yielded zero.
7716
7717 2000-10-29  Greg Louis  <glouis@dynamicro.on.ca>
7718
7719         * regex.h (__restrict_arr): Move definition out of #ifndef block.
7720         Required because egcs-2.91.66 (aka 1.1.2) defines __restrict, but
7721         doesn't define __restrict_arr.
7722
7723 2000-10-29  Jim Meyering  <jim@meyering.net>
7724
7725         * xstat.in: Fix grammar in comment.
7726
7727 2000-10-28  Jim Meyering  <jim@meyering.net>
7728
7729         * memchr.c: Update from libc.
7730         Adjust for portability:
7731         [HAVE_STDLIB_H]: Include stdlib.h.
7732         [HAVE_BP_SYM_H || _LIBC]: Guard inclusion of bp-sym.h.
7733         Undef __memchr, too.
7734         [!weak_alias]: Define __memchr to memchr.
7735
7736         * regex.c: Update from libc.
7737         * regex.h: Likewise.
7738         * getopt1.c: Likewise.
7739         * memcmp.c: Likewise.
7740
7741         * getusershell.c (setusershell) [HAVE_FSEEKO]: Use fseeko.
7742         Avoid using fseek, when possible -- it's broken by design.
7743         Patch by Ulrich Drepper.
7744
7745 2000-10-26  Jim Meyering  <jim@meyering.net>
7746
7747         * strftime.c: Update from libc.
7748
7749 2000-10-25  Jim Meyering  <jim@meyering.net>
7750
7751         * obstack.c: Update from libc.
7752
7753 2000-10-23  Jim Meyering  <jim@meyering.net>
7754
7755         * hard-locale.c (hard_locale): Revert last change -- it was simply
7756         wrong.  That set_locale call must not have any side effects.
7757         From Paul Eggert.
7758
7759 2000-10-22  Jim Meyering  <jim@meyering.net>
7760
7761         * md5.c (md5_process_block) [OP]: Use `rol', not CYCLIC.
7762         [CYCLIC]: Remove now-unused definition.
7763
7764         * save-cwd.c (O_DIRECTORY): Define, if needed.
7765         (save_cwd) [HAVE_FCHDIR]: Use O_DIRECTORY when opening ".".
7766         Suggestion from Ulrich Drepper.
7767
7768 2000-10-21  Jim Meyering  <jim@meyering.net>
7769
7770         * dirname.c (dir_name_r): New function, factored out of dir_name.
7771         (dir_name): Use dir_name_r.
7772         * dirname.h (dir_name_r): Declare it.
7773
7774 2000-10-21  Jim Meyering  <jim@meyering.net>
7775
7776         * dirname.c (memrchr): Declare if necessary.
7777         (dir_name): Remove the restriction that there be no
7778         trailing slashes.  Now, this code skips past them, effectively
7779         ignoring them.
7780         [TEST_DIRNAME] (main): New unit tests.
7781
7782         * memrchr.c: New file from GNU libc.
7783         Undef __memrchr, too.
7784         [!weak_alias]: Define __memrchr to memrchr.
7785         Guard weak_alias use with `#ifdef weak_alias'.
7786
7787 2000-10-17  Jim Meyering  <jim@meyering.net>
7788
7789         * quote.h (PARAMS): Define and use.
7790         Reported by Akim Demaille.
7791
7792         * getopt.c: Update from libc.
7793
7794 2000-10-16  Jim Meyering  <jim@meyering.net>
7795
7796         * hard-locale.c (hard_locale): Use "", not 0 as 2nd arg to setlocale.
7797         From Jan Fedak.
7798
7799 2000-09-25  Jim Meyering  <jim@meyering.net>
7800
7801         * md5.h (rol): Define (from GnuPG).
7802
7803         * sha.c: Give credit (GnuPG) where due.
7804         (M): Use rol rather than open-coding it.
7805         Add a FIXME comment.
7806
7807 2000-09-21  Jim Meyering  <jim@meyering.net>
7808
7809         * userspec.c (parse_user_spec): Remove debugging printf I'd added.
7810         Reported by Michael Stone.
7811
7812 2000-09-20  Jim Meyering  <jim@meyering.net>
7813
7814         * Makefile.am (libfetish_a_SOURCES): Add sha.c.
7815         (noinst_HEADERS): Add sha.h.
7816         Based on code from Scott G. Miller and from GnuPG.
7817
7818 2000-09-15  Jim Meyering  <jim@meyering.net>
7819
7820         * regex.c: Update from libc.
7821
7822 2000-09-10  Jim Meyering  <jim@meyering.net>
7823
7824         * getopt.c (_getopt_internal): Update from glibc.
7825
7826 2000-09-09  Jim Meyering  <jim@meyering.net>
7827
7828         * quotearg.c: Rename ISASCII to IN_CTYPE_DOMAIN, so people don't
7829         think it should be used as a general replacement for isascii.
7830         * fnmatch.c: Likewise.
7831         * mbswidth.c: Likewise
7832         * regex.c: Likewise.
7833
7834         Don't use atoi.
7835         * userspec.c: Include sys/param.h and limits.h.
7836         Include xstrtol.h.
7837         (CHAR_BIT, TYPE_SIGNED, TYPE_MINIMUM, TYPE_MAXIMUM): Define.
7838         (UID_T_MAX, GID_T_MAX, MAXUID, MAXGID): Define.
7839         (parse_user_spec): Use xstrtoul, not atoi when converting numeric
7840         UID, GID.  Check range.
7841
7842 2000-09-06  Jim Meyering  <jim@meyering.net>
7843
7844         * getopt.c (_getopt_internal): Update from glibc.
7845
7846 2000-08-30  Jim Meyering  <jim@meyering.net>
7847
7848         * strftime.c: Merge in changes from GNU libc.
7849
7850 2000-08-26  Jim Meyering  <jim@meyering.net>
7851
7852         * closeout.c: Include "__fpending.h".
7853         (close_stdout_status): Return right away if there's nothing to flush.
7854
7855         * Makefile.am (noinst_HEADERS): Add __fpending.h.
7856         * __fpending.c: New file.
7857         * __fpending.h: New file.
7858
7859 2000-08-07  Paul Eggert  <eggert@twinsun.com>
7860
7861         Standardize on "memory exhausted" instead of "Memory exhausted"
7862         or "virtual memory exhausted".
7863         * obstack.c (print_and_abort): Use "memory exhausted", not
7864         "virtual memory exhausted".
7865         * same.c (same_name): Invoke xalloc_die instead of printing
7866         our own message.
7867         * userspec.c (parse_user_spec): Likewise.
7868         * bumpalloc.h: comment fix
7869         * same.c, userspec.c: Include xalloc.h.
7870
7871         * xalloc.h (xalloc_msg_memory_exhausted): Now char const[],
7872         not char *const and pointing to a constant array.
7873         * xmalloc.c (xalloc_msg_memory_exhausted): Likewise.
7874         (xrealloc): Comment fix.
7875
7876         * userspec.c (parse_user_spec):
7877         Don't translate a message until just before returning,
7878         to avoid unnecessary translation.
7879
7880 2000-08-07  Jim Meyering  <jim@meyering.net>
7881
7882         * addext.c, argmatch.c, argmatch.h, backupfile.h, bumpalloc.h,
7883         chown.c, diacrit.h, dirname.h, dup2.c, exclude.h, fileblocks.c,
7884         fnmatch.c, fnmatch.h, fsusage.c, fsusage.h, getdate.h,
7885         getgroups.c, gethostname.c, getopt.h, group-member.c,
7886         hard-locale.c, hash.h, isdir.c, lchown.c, linebuffer.c,
7887         linebuffer.h, long-options.h, malloc.c, md5.c, md5.h, memchr.c,
7888         memcmp.c, memcoll.c, memset.c, mktime.c, modechange.h, obstack.h,
7889         pathmax.h, realloc.c, rmdir.c, safe-read.c, save-cwd.c, stime.c,
7890         stpcpy.c, strcasecmp.c, strcspn.c, strdup.c, stripslash.c,
7891         strstr.c, strtod.c, strtol.c, strtoul.c, strtoull.c, strtoumax.c,
7892         utime.c, version-etc.h, xalloc.h, xstrdup.c, xstrtoumax.c,
7893         yesno.c: Back out Copyright date changes for each file with no change
7894         this year.  This eases coordination with other programs using the same
7895         source code modules.  From Paul Eggert.
7896
7897 2000-08-03  Greg McGary  <greg@mcgary.org>
7898
7899         * regex.c (SET_HIGH_BOUND, MOVE_BUFFER_POINTER,
7900         ELSE_EXTEND_BUFFER_HIGH_BOUND): New macros.
7901         (EXTEND_BUFFER): Use them.
7902
7903 2000-08-01  Jim Meyering  <jim@meyering.net>
7904
7905         * dirname.c (ISSLASH): Define.
7906         (BACKSLASH_IS_PATH_SEPARATOR): Define.
7907         (dir_name) [BACKSLASH_IS_PATH_SEPARATOR]: Handle the case in which
7908         both `\' and `/' may be use as path separators.
7909         Based on a patch from Prashant TR.
7910
7911 2000-07-31  Paul Eggert  <eggert@twinsun.com>
7912
7913         * quotearg.c (quotearg_n_options): Don't make the initial
7914         slot vector a constant, since it might get modified.
7915
7916 2000-07-31  Jim Meyering  <jim@meyering.net>
7917
7918         * xmalloc.c: Use `virtual memory exhausted', not `Memory exhausted'.
7919         * obstack.c (print_and_abort): Likewise.
7920
7921 2000-07-30  Paul Eggert  <eggert@twinsun.com>
7922
7923         * quotearg.c (quotearg_n_options): Preallocate a slot 0
7924         buffer, so that the caller can always quote one small
7925         component of a "memory exhausted" message in slot 0.
7926         From a suggestion by Jim Meyering.
7927
7928 2000-07-30  Jim Meyering  <jim@meyering.net>
7929
7930         * makepath.c (make_path): Quote the other instance, too.
7931
7932         * quotearg.c (N_STATIC_SLOTVECS): Define.
7933         (STATIC_BUF_SIZE): Define.
7934         (quotearg_n_options): Use only statically allocated storage when
7935         N < N_STATIC_SLOTVECS and the length of the quoted result is smaller
7936         than STATIC_BUF_SIZE.
7937
7938 2000-07-29  Jim Meyering  <jim@meyering.net>
7939
7940         * diacrit.c (diacrit_diac): Use __MSDOS__ in favor of MSDOS.
7941         * dirname.c (dir_name): Likewise.
7942
7943         * basename.c (base_name): Use ISSLASH rather than comparing against `/'.
7944
7945         * dirname.c (dir_name) [MSDOS]: Declare `lim' to be const.
7946         (dir_name): Assert that there are no trailing slashes.
7947
7948 2000-07-18  Bruno Haible  <haible@clisp.cons.org>
7949
7950         * mbswidth.h (mbswidth): Add a flags argument.
7951         (mbswidth): New declaration.
7952         (MBSW_ACCEPT_INVALID, MBSW_ACCEPT_UNPRINTABLE): New macros.
7953         * mbswidth.c (mbswidth): Add a flags argument.
7954         (mbsnwidth): New function.
7955
7956 2000-07-24  Jim Meyering  <jim@meyering.net>
7957
7958         * mbswidth.c: Remove useless #else.  From Bruno Haible.
7959
7960 2000-07-23  Paul Eggert  <eggert@twinsun.com>
7961
7962         * mbswidth.c (_XOPEN_SOURCE):
7963         Don't define; this causes problems on Solaris 7.
7964         (wcwidth) [!HAVE_DECL_WCWIDTH]: Declare.
7965
7966 2000-07-23  Paul Eggert  <eggert@twinsun.com>
7967
7968         * quotearg.c:
7969         Include <wchar.h> even if ! (HAVE_MBRTOWC && 1 < MB_LEN_MAX),
7970         so that mbstate_t is always defined.
7971
7972         Do not inspect MB_LEN_MAX, since it's incorrectly defined to
7973         be 1 in at least one GCC installation, and this configuration
7974         error is likely to be common.  Ignoring MB_LEN_MAX hurts
7975         performance on hosts that have mbrtowc but have only unibyte
7976         locales, but I assume these hosts are rare.
7977
7978 2000-07-23  Paul Eggert  <eggert@twinsun.com>
7979
7980         * quotearg.c: Streamline by invoking multibyte code only if needed.
7981         <wchar.h>: Include only if HAVE_MBRTOWC && 1 < MB_LEN_MAX.
7982         (MB_CUR_MAX): Redefine to 1 if ! (HAVE_MBRTOWC && 1 < MB_LEN_MAX).
7983         (quotearg_buffer_restyled): If a unibyte locale, don't bother to
7984         invoke multibyte primitives.
7985
7986 2000-07-23  Jim Meyering  <jim@meyering.net>
7987
7988         * basename.c (base_name): Add an assertion.
7989
7990 2000-07-15  Bruno Haible  <clisp.cons.org>
7991
7992         * quotearg.c: When the system forces us to redefine mbstate_t,
7993         shadow its mbsinit function.
7994
7995 2000-07-16  Bruno Haible  <haible@clisp.cons.org>
7996
7997         * mbswidth.h: New file.
7998         * mbswidth.c: New file.
7999         * Makefile.am (libfetish_a_SOURCES): Add mbswidth.c.
8000         (noinst_HEADERS): Add mbswidth.h.
8001
8002 2000-07-17  Bruno Haible  <haible@clisp.cons.org>
8003
8004         * config.charset: Add support for FreeBSD. Improve support for HP-UX
8005         and IRIX 6.
8006
8007 2000-07-15  Jim Meyering  <jim@meyering.net>
8008
8009         * makepath.c: Include quote.h.
8010         (make_path): Convert "`%s'" in format strings to "%s", and wrap each
8011         corresponding argument in a `quote (...)' call.
8012         Give better diagnostics.
8013
8014         * Makefile.am (libfetish_a_SOURCES): Add quote.c.
8015         (noinst_HEADERS): Add quote.h.
8016
8017         * quote.c (quote, quote_n): New file.  Two functions taken verbatim
8018         from tar's src/misc.c.
8019         * quote.h: New file.  Prototypes for same.
8020
8021 2000-07-10  Paul Eggert  <eggert@twinsun.com>
8022
8023         From a suggestion by Bruno Haible.
8024         * quotearg.c (mbrtowc): Do not use HAVE_WCHAR_H in the definition.
8025         Use defined mbstate_t, not HAVE_MBSTATE_T_OBJECT,
8026         to decide whether to define the BeOS workaround macro;
8027         this adjusts to the change to AC_MBSTATE_T.
8028
8029 2000-07-13  Paul Eggert  <eggert@twinsun.com>
8030
8031         * quotearg.h (enum quoting style): New enum clocale_quoting_style.
8032
8033         * quotearg.c (quoting_style_args, quoting_style_vals,
8034         quotearg_buffer_restyled): Add support for
8035         clocale_quoting_style.  Undo previous change to
8036         locale_quoting_style behavior, and undo the "{LEFT QUOTATION MARK}"
8037         and "{RIGHT QUOTATION MARK}" msgids.
8038
8039 2000-07-05  Paul Eggert  <eggert@twinsun.com>
8040
8041         The old behavior of quoting `like this' doesn't look good with
8042         newer, ISO-style fonts.  See:
8043         http://www.cl.cam.ac.uk/~mgk25/ucs/quotes.html
8044
8045         Instead, quote "like this" by default.  Let the translator
8046         tailor the locale-specific quoting behavior by providing
8047         translations for {LEFT QUOTATION MARK} and {RIGHT QUOTATION MARK}.
8048
8049         * quotearg.c (N_): New macro.
8050         (gettext_default): New function.
8051         (quotearg_buffer_restyled): Use
8052         gettext_default ("{LEFT QUOTATION MARK}", "\"") for left quote, and
8053         gettext_default ("{RIGHT QUOTATION MARK}", "\"") for right quote.
8054
8055 2000-07-09  Jim Meyering  <jim@meyering.net>
8056
8057         * Most files: Update copyright dates to include 2000.
8058
8059 2000-07-08  Jim Meyering  <jim@meyering.net>
8060
8061         * xgethostname.c (ENAMETOOLONG): Define to an unlikely value
8062         if not defined.
8063         (xgethostname): Remove now-unnecessary #ifdef.
8064         Move declaration of `err' into loop where it's used.
8065
8066 2000-07-05  Bruno Haible  <haible@clisp.cons.org>
8067
8068         * xgethostname.c (xgethostname): Protect against the SunOS 5.5 bug
8069         by allocating a larger buffer. Test the gethostname return value for
8070         being >= 0, not == 0, for BeOS.  Don't exhaust memory if gethostname
8071         returns an error and ENAMETOOLONG isn't defined.
8072
8073 2000-07-05  Paul Eggert  <eggert@twinsun.com>
8074         and Bruno Haible  <haible@clisp.cons.org>
8075
8076         * quotearg.c (mbrtowc): Declare returned type, since BeOS doesn't.
8077
8078 2000-07-05  Bruno Haible  <haible@clisp.cons.org>
8079
8080         * quotearg.c (struct quoting_options): Simplify quote_these_too
8081         dimension.
8082
8083 2000-07-03  Jim Meyering  <jim@meyering.net>
8084
8085         * strndup.c: [!HAVE_DECL_STRNLEN]: Declare strnlen.
8086         Reported by Bruno Haible.
8087
8088 2000-07-04  Jim Meyering  <jim@meyering.net>
8089
8090         * quotearg.c: Make inclusion of <wchar.h> independent of whether
8091         HAVE_MBRTOWC is set.  Required at least for irix-5.6, which
8092         lacks mbrtowc.
8093
8094 2000-07-03  Paul Eggert  <eggert@twinsun.com>
8095         and Bruno Haible  <haible@clisp.cons.org>
8096
8097         * quotearg.c (mbrtowc):
8098         Assign to *pwc, and return 1 only if result is nonzero.
8099         (iswprint): Use ISPRINT when substituting our own mbrtowc.
8100
8101 2000-07-03  Jim Meyering  <jim@meyering.net>
8102
8103         * readutmp.h: [HAVE_UTMPX_H]: Include <utmp.h> if HAVE_UTMP_H.
8104         This is necessary to get a definition of e.g., UTMP_FILE on HP-UX 10.20.
8105         From Bob Proulx.
8106
8107 2000-07-02  Jim Meyering  <jim@meyering.net>
8108
8109         * quotearg.c (mbstate_t): Don't define here.
8110
8111 2000-07-02  Jim Meyering  <jim@meyering.net>
8112
8113         * nanosleep.c (SIGCONT): Define if not already defined.
8114
8115 2000-06-17  Bruno Haible  <haible@clisp.cons.org>
8116
8117         * mountlist.c: Use MOUNTED_FS_STAT_DEV instead of MOUNTED_NEXT_DEV,
8118         per change in ../m4/ls-mntd-fs.m4.
8119         (read_filesystem_list): Ignore symbolic links.
8120
8121 2000-06-29  Jim Meyering  <jim@meyering.net>
8122
8123         * same.c: Include <string.h> or <strings.h>, as appropriate,
8124         for declaration of strcmp.
8125
8126         * long-options.c: Include <stdlib.h>, for declaration of exit.
8127
8128         * mountlist.c (fsp_to_string) [HAVE_F_FSTYPENAME_IN_STATFS]:
8129         Avoid warning by casting result to `char *' to remove `const'.
8130
8131 2000-06-17  Bruno Haible  <haible@clisp.cons.org>
8132
8133         * Makefile.am (libfetish_a_SOURCES): Remove readutmp.c.
8134
8135 2000-06-26  Paul Eggert  <eggert@twinsun.com>
8136
8137         savedir now sets errno on failure and invokes xmalloc to get memory.
8138         Fix a couple of other minor bugs while we're at it.
8139
8140         * savedir.c (<unistd.h>): Do not include; there's no need.
8141         (NAMLEN): Remove macro.
8142         (malloc, realloc): Remove decls.
8143         (stpcpy): Likewise.
8144         ("xalloc.h"): Include.
8145         (NAME_SIZE_DEFAULT): New macro.
8146         (savedir): Use xmalloc / xrealloc to allocate memory.
8147         Use NAME_SIZE_DEFAULT if name_size is negative or overflows to zero.
8148         Skip "" directory entries.
8149         Use strlen to calculate directory entry length, since the old method
8150         is rarely used these days and isn't worth supporting.
8151         Don't use a pointer after freeing it.
8152         Check for integer overflow when calculating allocation size.
8153         Use memcpy to copy entries, instead of stpcpy.
8154         Set errno properly when returning NULL.
8155         Check for readdir error.
8156
8157 2000-06-26  Jim Meyering  <jim@meyering.net>
8158
8159         * posixtm.c [HAVE_STDLIB_H]: Include stdlib.h, for decl of abort.
8160
8161 2000-06-17  Bruno Haible  <haible@clisp.cons.org>
8162
8163         * getusershell.c (xmalloc, xrealloc): Remove functions.
8164         Include xalloc.h.
8165         Don't include <stdlib.h>.  Don't declare malloc, realloc.
8166
8167 2000-06-23  Bruno Haible  <haible@clisp.cons.org>
8168
8169         * unicodeio.c (print_unicode_char): Work around ansi2knr deficiency.
8170
8171 2000-06-24  Jim Meyering  <jim@meyering.net>
8172
8173         * error.c [!HAVE_DECL_STRERROR_R]: Declare strerror_r.
8174
8175 2000-06-21  Jim Meyering  <jim@meyering.net>
8176
8177         * getpass.c: New file, from Bruno Haible.  Required for BeOS.
8178
8179 2000-06-19  Paul Eggert  <eggert@twinsun.com>
8180
8181         * quotearg.c: Include <wctype.h> after <wchar.h>, for Solaris 2.5.
8182         (mbrtowc, mbstate_t): Define substitutes if
8183         HAVE_MBRTOWC && HAVE_WCHAR_H && !HAVE_MBSTATE_T_OBJECT.
8184         (iswprint): Define to 1 if !defined iswprint && !HAVE_ISWPRINT,
8185         not if ! (HAVE_MBRTOWC && HAVE_WCHAR_H).
8186
8187 2000-06-17  Bruno Haible  <haible@clisp.cons.org>
8188
8189         * xgetcwd.c (xgetcwd): If the required pathname length is smaller
8190         than 1024, return a memory chunk of least possible size, instead
8191         of size PATH_MAX + 2. In the loop, increment the size proportionally.
8192         Use free/xmalloc instead of xrealloc to avoid copying for very long
8193         paths.
8194
8195 2000-06-17  Bruno Haible  <haible@clisp.cons.org>
8196
8197         * canon-host.c (canon_host): Use malloc and memcpy to copy an
8198         address, not strdup.  Include <stdlib.h> and don't declare free().
8199
8200 2000-06-17  Bruno Haible  <haible@clisp.cons.org>
8201
8202         * path-concat.c (path_concat): Don't access dir[-1] if dir is
8203         the empty string.
8204
8205 2000-06-21  Jim Meyering  <jim@meyering.net>
8206
8207         * Makefile.am (libfetish_a_SOURCES): Add getstr.c.
8208         (noinst_HEADERS): Add getstr.h.
8209
8210         * getline.c (getstr): Move into a separate file.
8211         * getstr.c (getstr): New file, extracted from getline.c, with
8212         the following changes: new parameter, delim2; both delim[12]
8213         parameters have type `int', not `char'.  The latter would lose
8214         with 8-bit delimiters.
8215         * getstr.h: New file.
8216
8217 2000-06-19  Jim Meyering  <jim@meyering.net>
8218
8219         * getloadavg.c [HAVE_NLIST_H] (NLIST_STRUCT): Define.
8220
8221 2000-06-18  Jim Meyering  <jim@meyering.net>
8222
8223         * mkdir.c: Remove file, due mainly to copyright incompatibility.
8224         Besides, these days every porting target provides a mkdir function.
8225
8226         * strnlen.c: Include memory.h, string.h, and/or strings.h as needed.
8227         (this snippet comes from src/system.h).
8228
8229 2000-06-15  Paul Eggert  <eggert@twinsun.com>
8230
8231         * human.c (adjust_value): New function.
8232         (human_readable_inexact): Apply rounding style even when
8233         printing approximate values.
8234
8235 2000-06-14  Paul Eggert  <eggert@twinsun.com>
8236
8237         * human.c (human_readable_inexact): Allow an input block
8238         size that is not a multiple of the output block size, and vice versa.
8239         Reported by Piergiorgio Sartor.
8240
8241 2000-06-14  Paul Eggert  <eggert@twinsun.com>
8242
8243         * getdate.y (get_date): Apply relative times after time
8244         zone indicator, not before.  Reported by Todd A. Jacobs.
8245
8246 2000-06-13  Jim Meyering  <jim@meyering.net>
8247
8248         * Makefile.am (all-local): Depend on lstat.c and stat.c.
8249
8250         * xstat.in [!HAVE_DECL_FREE]: Declare free in lstat.c.
8251
8252 2000-06-12  Paul Eggert  <eggert@twinsun.com>
8253
8254         * xstat.in: Include <stdlib.h> in lstat, to declare "free".
8255
8256 2000-06-04  Paul Eggert  <eggert@twinsun.com>
8257
8258         * strnlen.c: Include <config.h> if HAVE_CONFIG_H.
8259
8260 2000-06-04  Jim Meyering  <jim@meyering.net>
8261
8262         * getugroups.c (getugroups): Cast -1 to gid_t, for systems like
8263         SunOS 4.1.4 for which gid_t is an unsigned type.
8264
8265 2000-06-03  Jim Meyering  <jim@meyering.net>
8266
8267         * strnlen.c [!HAVE_DECL_MEMCHR]: Declare memchr.
8268
8269 2000-05-26  Bruno Haible  <haible@clisp.cons.org>
8270
8271         * Makefile.am (install-exec-local): On systems with glibc-2.1 or
8272         newer, don't install charset.alias.
8273         * config.charset: Change the Linux/glibc rules so they become empty
8274         on glibc-2.1 or newer.
8275
8276 2000-06-02  Jim Meyering  <jim@meyering.net>
8277
8278         * mountlist.c: Back out last change.  Instead, do this...
8279         * mountlist.c (read_filesystem_list) [MOUNTED_VMOUNT]: Set the me_dummy
8280         member using the same `ignore'-testing code.
8281         * mountlist.h (ME_DUMMY): Add `autofs' to the list of ignored
8282         fs_type strings.
8283         From Mark D. Roth.
8284
8285 2000-05-29  Jim Meyering  <jim@meyering.net>
8286
8287         * mountlist.c (read_filesystem_list) [MOUNTED_VMOUNT]: Ignore mounts
8288         with the `ignore' attribute.  Based on a patch from Mark D. Roth.
8289
8290 2000-05-22  Jim Meyering  <jim@meyering.net>
8291
8292         * makepath.c: Remove old, now-unnecessary `#ifdef __MSDOS__' block.
8293
8294 2000-05-18  Jim Meyering  <jim@meyering.net>
8295
8296         * hash.c (hash_rehash): Fix a nasty bug: copy the free entry list
8297         back, too, since it may have been modified by allocate_entry.
8298         (hash_delete): Rewrite to use neither the assignment operator
8299         nor the comma operator in an if-expression.
8300
8301 2000-05-15  Paul Eggert  <eggert@twinsun.com>
8302
8303         * closeout.c:
8304         <sys/stat.h>, <sys/types.h>, <unistd.h>, (STDOUT_FILENO):
8305         Remove; no longer needed.
8306         "quotearg.h": Add include.
8307         (file_name): Do not bother to explicitly initialize to NULL; it's less
8308         efficient on some hosts.
8309         (close_stdout_status): Remove test as to whether stdout was already
8310         closed; it breaks for the case "echo x | sort >&-".
8311         Quote file name colons.
8312         Do not assume that _("write error") lacks format strings.
8313
8314 2000-05-15  Jim Meyering  <jim@meyering.net>
8315
8316         * version-etc.c (version_etc_copyright): Update the copyright string
8317         used in all --version output.
8318
8319 2000-05-14  Jim Meyering  <jim@meyering.net>
8320
8321         * closeout.c (close_stdout_set_file_name): New function.
8322         (close_stdout_status): Use new file-scoped global.
8323         Return right away if fstat says the stdout file descriptor is invalid.
8324         * closeout.h (close_stdout_set_file_name): Declare.
8325
8326 2000-05-10  Jim Meyering  <jim@meyering.net>
8327
8328         * closeout.c [default_exit_status]: New file-scoped variable.
8329         (close_stdout_set_status): New function.
8330         * closeout.h (close_stdout_set_status): Declare.
8331
8332 2000-05-08  Jim Meyering  <jim@meyering.net>
8333
8334         * long-options.c: Don't include closeout.h.
8335         (parse_long_options): Don't call close_stdout for --version.
8336
8337 2000-05-06  Jim Meyering  <jim@meyering.net>
8338
8339         * strnlen.c: Undefine __strnlen and strnlen.
8340         [!weak_alias]: Define __strnlen to strnlen.
8341
8342         * atexit.c: New file, from libiberty.
8343
8344 2000-05-06  Jim Meyering  <jim@meyering.net>
8345
8346         * closeout.c (close_stdout_status): Also check for errors on the
8347         stderr stream.
8348
8349 2000-05-05  Bruno Haible  <haible@clisp.cons.org>
8350
8351         * localcharset.c (get_charset_aliases): Use malloc, realloc and memcpy
8352         instead of xmalloc, xrealloc, path_concat.
8353         (locale_charset): Treat empty environment variables as absent.
8354         (DIRECTORY_SEPARATOR, ISSLASH): New macros.
8355
8356 2000-05-04  Jim Meyering  <jim@meyering.net>
8357
8358         * getopt.c: Update from glibc.
8359         * obstack.c: Likewise.
8360         * obstack.h: Likewise.
8361         * regex.c: Likewise.  NB: K&R compiler support is dropped for this file
8362
8363         * regex.h: Likewise.
8364         * strndup.c: Likewise.
8365         * strnlen.c: New file, from glibc.
8366
8367 2000-05-01  Jim Meyering  <jim@meyering.net>
8368
8369         * full-write.c (full_write): Remove `FIXME' part of comment.
8370
8371 2000-04-29  Jim Meyering  <jim@meyering.net>
8372
8373         * path-concat.c: Declare strdup only if it's not defined.
8374         * canon-host.c: Likewise.
8375
8376 2000-04-28  Jim Meyering  <jim@meyering.net>
8377
8378         * rpmatch.c [HAVE_LIMITS_H]: Include limits.h before regex.h to avoid
8379         redefinition warning on some systems (HPUX).  Otherwise, regex.h is
8380         included first, then limits.h is included by locale.h by libintl.h.
8381         From John David Anglin.
8382
8383 2000-04-25  Jim Meyering  <jim@meyering.net>
8384
8385         * makepath.c (S_IRWXUGO): Define.
8386         (make_path): Always perform explicit chmod if MODE specifies any
8387         of the `special' permission bits.  Prompted by a bug report against
8388         install from Mate Wierdl and Joost van Baal.
8389
8390 2000-04-18  Jim Meyering  <jim@meyering.net>
8391
8392         * README: New file.
8393
8394         * getpagesize.h [!getpagesize && HAVE_OS_H && B_PAGE_SIZE]: Define
8395         getpagesize.  For BeOS.  Based on a patch from Bruno Haible.
8396
8397 2000-04-17  Jim Meyering  <jim@meyering.net>
8398
8399         * strftime.c (my_strftime) [strftime]: Declare strftime here, since
8400         the definition of it to rpl_strftime also defined-away the system's
8401         declaration.
8402
8403 2000-04-15  Jim Meyering  <jim@meyering.net>
8404
8405         Use `C' to denote so-called `contiguous' files, the same way
8406         that tar does.
8407         * filemode.c (S_ISCTG) [!S_ISCTG && S_IFCTG]: Define.
8408         (ftypelet): Use S_ISCTG.
8409         From Michael Deutschmann.
8410
8411 2000-04-14  Jim Meyering  <jim@meyering.net>
8412
8413         * strftime.c (my_strftime) [#ifdef strftime]: Declare strftime.
8414
8415 2000-04-08  Jim Meyering  <jim@meyering.net>
8416
8417         * Makefile.am (charset.alias): Use t-$@, not $@-t so the DOS 8.3
8418         names don't conflict.  Reported by Eli Zaretskii.
8419
8420 2000-03-28  Bruno Haible  <haible@clisp.cons.org>
8421
8422         * unicodeio.c (print_unicode_char): Avoid triggering Solaris iconv
8423         bug.  Deal with the different error behavior of Irix iconv.
8424
8425 2000-04-07  Jim Meyering  <jim@meyering.net>
8426
8427         * putenv.c: Move inclusion of errno.h so it follows that of sys/types.h,
8428         to work around system header problems on AIX 3.2.5.  From Bruno Haible.
8429
8430 2000-04-05  Jim Meyering  <jim@meyering.net>
8431
8432         Portability tweaks required for ultrix4.3.
8433         * readutmp.h [HAVE_UTMPX_H && !HAVE_DECL_GETUTENT]: Declare getutent.
8434         * readutmp.c: Include sys/types.h before sys/stat.h.
8435         * canon-host.c: Declare strdup.
8436         * path-concat.c: Likewise.
8437         From John David Anglin.
8438
8439 2000-04-04  Jim Meyering  <jim@meyering.net>
8440
8441         Be more DOS 8.3-friendly.
8442         * ref-add.sin: Renamed from ref-add.sed.in.
8443         * ref-del.sin: Renamed from ref-del.sed.in.
8444         * Makefile.am: Reflect renaming.
8445         Reported by Eli Zaretskii.
8446
8447         Use a temporary file name that won't clash with `charset.alias'
8448         in the DOS 8.3 name space.
8449         * Makefile.am (charset_tmp): Define.
8450         (install-exec-local): Use $(charset_tmp) instead of $(charset_alias)-t.
8451         (uninstall-local): Likewise.
8452         Reported by Eli Zaretskii.
8453
8454 2000-03-29  Paul Eggert  <eggert@twinsun.com>
8455
8456         * time/strftime.c (my_strftime): Make sure we call the system
8457         strftime, not ourselves, when invoking the underlying strftime.
8458
8459 2000-03-24  Jim Meyering  <jim@meyering.net>
8460
8461         * Makefile.am (EXTRA_DIST): Add ref-add.sed.in and ref-del.sed.in.
8462         (charset_alias): Define.
8463         (install-exec-local): Factor out common code.
8464         (uninstall-local): Split lines longer than 80.
8465         (ref-add.sed, ref-del.sed): Remove rules... (do the following instead)
8466         (SUFFIXES): Define.
8467         (.sed.in.sed): New rule.  Don't redirect directly to $@.
8468         (CLEANFILES): Add ref-add.sed and ref-del.sed.
8469
8470 2000-03-19  Bruno Haible  <haible@clisp.cons.org>
8471
8472         * config.charset: Output a line containing "Packages using this file".
8473         * ref-add.sed.in, ref-del.sed.in: New files.
8474         * Makefile.am (install-exec-local, uninstall-local, ref-add.sed,
8475         ref-del.sed): New rules.
8476
8477 2000-03-17  Jim Meyering  <jim@meyering.net>
8478
8479         * unicodeio.c (<string.h>): Include only #if HAVE_STRING_H.
8480         Otherwise, include <strings.h>
8481
8482 2000-03-17  Bruno Haible  <haible@clisp.cons.org>
8483
8484         * unicodeio.c (utf8_wctomb): New function.
8485         (print_unicode_char): Pass the Unicode character to iconv in UTF-8
8486         format instead of in UCS-4 with platform dependent endianness.
8487
8488 2000-03-07  Paul Eggert  <eggert@twinsun.com>
8489
8490         * savedir.c (savedir): Work even if directory size is
8491         negative; this can happen with some screwy NFS configurations.
8492
8493 2000-03-06  Jim Meyering  <jim@meyering.net>
8494
8495         * localcharset.c (get_charset_aliases): Don't try to free file_name
8496         if it's NULL (because we ran out of memory).  From Bruno Haible.
8497
8498 2000-03-05  Jim Meyering  <jim@meyering.net>
8499
8500         * localcharset.c ("path-concat.h"): Include.
8501         (get_charset_aliases): Use path_concat instead of ANSI string
8502         concatenation.
8503
8504         * unicodeio.h (PARAMS): Define.
8505         Use it to guard prototype.
8506
8507 2000-03-04  Jim Meyering  <jim@meyering.net>
8508
8509         * Makefile.am (install-exec-local): Create $(libdir) before installing
8510         into it.
8511         (uninstall-local): Uncomment this rule so `make distcheck' works
8512         once again.
8513
8514         * unicodeio.c (<errno.h>): Include it.
8515         (errno): Declare if not defined.
8516
8517         * localcharset.c: Add Bruno's comment justifying use of volatile.
8518
8519         * config.charset: New version, incorporating remarks from a linux
8520         i18n mailing list.  From Bruno Haible.
8521
8522 2000-03-02  Jim Meyering  <jim@meyering.net>
8523
8524         * Makefile.am (EXTRA_DIST): Add config.charset.
8525
8526 2000-03-01  Jim Meyering  <jim@meyering.net>
8527
8528         * localcharset.c: Guard some #includes with `#if HAVE_...'.
8529         * unicodeio.c: Likewise.
8530
8531 2000-02-02  Bruno Haible  <haible@clisp.cons.org>
8532
8533         * config.charset: New file.
8534         * localcharset.c: New file.
8535         * unicodeio.h, unicodeio.c: New files.
8536         * Makefile.am (DEFS): Add -DLIBDIR=...
8537         (libfetish_a_SOURCES): Add localcharset.c and unicodeio.c.
8538         (noinst_HEADERS): Add unicodeio.h.
8539         (all-local, install-exec-local, charset.alias): New targets.
8540
8541 2000-02-28  Paul Eggert  <eggert@twinsun.com>
8542
8543         * quotearg.c (ALERT_CHAR): New macro.
8544         (quotearg_buffer_restyled): Use it.
8545
8546 2000-02-27  Jim Meyering  <jim@meyering.net>
8547
8548         * strtoumax.c: Fix typo in decl of strtoul: s/long long/long/.
8549         Guard declaration of strtoull also with `&& HAVE_UNSIGNED_LONG_LONG'.
8550
8551         * backupfile.c: Guard inclusion of stdlib.h with `#if HAVE_STDLIB_H',
8552         not `#if STDC_HEADERS'.
8553         Declare malloc if needed.
8554
8555         * backupfile.c: Use `#if !HAVE_DECL...' instead of `#ifndef HAVE_DECL..'
8556         now that autoconf always defines the HAVE_DECL_ symbols.
8557         * human.c: Likewise.
8558         * same.c: Likewise.
8559         * strtoumax.c: Likewise.
8560
8561         * backupfile.c: Arrange for cpp to fail if the configure-time
8562         declaration check was not run.
8563         * hash.c: Likewise.
8564         * human.c: Likewise.
8565         * same.c: Likewise.
8566         * strtoumax.c: Likewise.
8567
8568         * userspec.c (parse_user_spec): If there is no `:' but there is a `.',
8569         then first look up the entire `.'-containing string as a login name.
8570
8571 2000-02-18  Paul Eggert  <eggert@twinsun.com>
8572
8573         * getdate.y: Handle two-digit years with leading zeros correctly.
8574         (textint): New typedef.
8575         (parser_control): Member year changed from int to textint.
8576         All uses changed.
8577         (YYSTYPE): Removed; replaced by %union with int and textint members.
8578         (tDAY, tDAY_UNIT, tDAYZONE, tHOUR_UNIT, tID, tLOCAL_ZONE, tMERIDIAN,
8579         tMINUTE_UNIT, tMONTH, tMONTH_UNIT tSEC_UNIT, tSNUMBER, tUNUMBER,
8580         tYEAR_UNIT, tZONE, o_merid): Now of type <intval>.
8581         (tSNUMBER, tUNUMBER): Now of type <textintval>.
8582         (date, number, to_year): Use width of number in digits, not its value,
8583         to determine whether it's a 2-digit year, or a 2-digit time.
8584         (yylex): Store number of digits of numeric tokens.
8585         Reported by John Kendall.
8586
8587         (parser_control): Changed from struct parser_control to typedef (for
8588         consistency).  All uses changed.
8589
8590         (tID): Removed; not used.
8591         (yylex): Return '?' for unknown identifiers, rather than (unused) tID.
8592
8593 2000-02-14  Paul Eggert  <eggert@twinsun.com>
8594
8595         * getpagesize.h (getpagesize): Port to VMS for Alpha;
8596         adapted from changes to grep getpagesize.h by Martin P.J. Zinser.
8597
8598 2000-02-12  Jim Meyering  <jim@meyering.net>
8599
8600         * userspec.c (ISDIGIT): Define it.
8601         (isdigit): Remove definition.
8602         (is_number): Use ISDIGIT, not isdigit.
8603         <libintl.h>: Include.
8604         (_ and N_): Define.
8605         (parse_user_spec): Mark translatable strings.
8606
8607 2000-02-10  Jim Meyering  <jim@meyering.net>
8608
8609         With these changes, nanosleep.[ch] are finally enough like the other
8610         lib/* replacement files to compile on a few more losing systems.
8611
8612         * nanosleep.h: Don't include config.h.
8613         Remove prototype from declaration of nanosleep.
8614         (PARAMS): Remove now-unneeded definition.
8615         * nanosleep.c: #undef nanosleep.
8616         (rpl_nanosleep): Rename from nanosleep.
8617
8618 2000-02-03  Jim Meyering  <jim@meyering.net>
8619
8620         * readutmp.c (read_utmp): Guard with `#ifdef UTMP_NAME_FUNCTION',
8621         rather than with `#if HAVE_UTMPNAME'.
8622
8623 2000-02-01  Jim Meyering  <jim@meyering.net>
8624
8625         * readutmp.h (UT_USER): Add parens.  From Andreas Schwab.
8626
8627 2000-01-31  Jim Meyering  <jim@meyering.net>
8628
8629         * nanosleep.h (nanosleep): Guard declaration with
8630         `#if ! HAVE_DECL_NANOSLEEP'.
8631         Without this, OFS gets a redeclaration error for rpl_nanosleep, due to
8632         the declaration in that vendor's sys/timers.h.
8633         Reported by Christian Krackowizer.
8634
8635         * quotearg.c (ISASCII): Add #undef and move definition to follow
8636         inclusion of wctype.h to work around Solaris 2.6 namespace pollution.
8637         (ISPRINT): Likewise.
8638         Reported by Tom Tromey.
8639
8640 2000-01-30  Jim Meyering  <jim@meyering.net>
8641
8642         * readutmp.c (extract_trimmed_name): Use UT_USER instead of hard-coding
8643         uses of ->ut_name.  The latter doesn't work with new Linux header files
8644         where only utmpx.ut_user is declared.
8645
8646         * readutmp.h (UT_USER): Define.
8647
8648 2000-01-23  Jim Meyering  <jim@meyering.net>
8649
8650         * Makefile.am (libfetish_a_SOURCES): Remove explicit mention of
8651         obstack.c.
8652
8653 2000-01-22  Jim Meyering  <jim@meyering.net>
8654
8655         * strtoumax.c: [! HAVE_DECL_STRTOUL]: Declare strtoul.
8656         [! HAVE_DECL_STRTOULL]: Declare strtoull.
8657         Required for some AIX systems.  Reported by Christian Krackowizer.
8658         [TESTING] (main): New function.
8659
8660         1997-10-17  Eli Zaretskii  <eliz@is.elta.co.il>
8661         * dirname.c (dir_name): Support for DOS-style file names with drive
8662         letters.
8663
8664         * quotearg.c [HAVE_WCTYPE_H]: Include <wctype.h> for decl of iswprint.
8665
8666         * strverscmp.c (ISDIGIT): Define.
8667         (strverscmp): Use ISDIGIT, not isdigit.
8668
8669 2000-01-17  Paul Eggert  <eggert@twinsun.com>
8670
8671         * nanosleep.c (nanosleep):
8672         Don't use SA_INTERRUPT to decide whether to call sigaction, as
8673         POSIX.1 doesn't require SA_INTERRUPT and some systems
8674         (e.g. Solaris 7) don't define it.  Use SA_NOCLDSTOP instead;
8675         it's been part of POSIX.1 since day 1 (in 1988).
8676
8677 2000-01-17  Jim Meyering  <jim@meyering.net>
8678
8679         * interlock: Remove unused file.  Reported by François Pinard.
8680
8681 2000-01-16  Paul Eggert  <eggert@twinsun.com>
8682
8683         * quotearg.c (quotearg_buffer_restyled): Do not quote
8684         alert, backslash, formfeed, and vertical tab unnecessarily in
8685         shell quoting style.
8686
8687
8688         -----
8689
8690         Copyright (C) 2000, 2001, 2002, 2003, 2004, 2005, 2006 Free
8691         Software Foundation, Inc.
8692
8693         Copying and distribution of this file, with or without
8694         modification, are permitted provided the copyright notice
8695         and this notice are preserved.