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