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