Improve diagnostics for restore_cwd failure.
[platform/upstream/coreutils.git] / lib / ChangeLog
1 2005-06-14  Paul Eggert  <eggert@cs.ucla.edu>
2
3         Improve quality of diagnostics on restore_cwd failure.
4         * mkdir-p.h (make_dir): Remove.  All uses replaced by mkdir.
5         (make_dir_parents): Last arg is now int * (for errno), not bool *.
6         * mkdir-p.c (make_dir, make_dir_parents): Likewise.
7         Rewrite "mkdir -p" algorithm to avoid the need for "stat"
8         each time through the loop.  Do not diagnose restore_cwd failure;
9         that is the caller's job (and perhaps the caller does not care).
10
11         * mkdir-p.c (CLEANUP_CWD, CLEANUP): Remove.
12         (make_dir_parents): Revamp to avoid need for CLEANUP_CWD, CLEANUP.
13         If the file already exists but is not a directory, don't bother
14         to try to make its parents.
15         Close potential file descriptor leak if we can't chdir("/") (!).
16         Don't always return true if chdir($PWD) fails; return true only
17         if the requested action was done successfully (except for the
18         chdir($PWD)).
19         Don't log final directory unless we actually made it.
20         Refactor to avoid duplicate code to fix up permissions.
21         Don't attempt to fix up parent permissions if chdir($PWD) fails.
22
23 2005-06-14  Jim Meyering  <jim@meyering.net>
24
25         * openat-die.c (openat_save_fail): Rename from openat_save_die.
26         (openat_restore_fail): Rename from openat_restore_die.
27         * openat.c, openat.h: Reflect s/_die/_fail/ renaming.
28
29         * mkdir-p.c (CLEANUP_CWD): Return *true*, not false when failing
30         to restore initial working directory.
31
32         Provide an alternative to exiting immediately upon save_cwd or
33         restore_cwd failure.  Now, an application can arrange e.g.,
34         to perform a longjump in that case.
35         * openat.c: Include dirname.h.
36         Use IS_ABSOLUTE_FILE_NAME rather than testing for leading slash.
37         (rpl_openat, fdopendir, fstatat): Call openat_save_die
38         and openat_restore_die rather than calling error directly.
39         Don't include "error.h" or "exitfail.h"; they're no longer needed.
40
41         * openat-die.c (openat_save_die, openat_restore_die): New file.
42         * openat.h (openat_save_die, openat_restore_die): Declare and define.
43
44 2005-06-13  Jim Meyering  <jim@meyering.net>
45
46         * mkdir-p.c (make_dir_parents): New parameter: different_working_dir,
47         to tell caller if/when we change the working directory and are
48         unable to return to the initial one.
49         * mkdir-p.h (make_dir_parents): Update prototype.
50
51 2005-06-12  Jim Meyering  <jim@meyering.net>
52
53         * mkdir-p.c (CLEANUP_CWD): Change one more `return 1' to
54         `return false'.  This fixes a bug introduced on 2004-07-30.
55
56 2005-06-01  Paul Eggert  <eggert@cs.ucla.edu>
57
58         Use "file name" when talking about file names, instead of "filename"
59         or "path", as per the GNU coding standards.
60         * mkdir-p.c: Renamed from makepath.c.
61         (make_dir_parents): Renamed from make_path.  All callers changed.
62         * mkdir-p.h: Likewise.  All includers changed.
63         * filenamecat.c: Renamed from path-concat.c.
64         (file_name_concat): Renamed from path_concat.  All callers changed.
65         [TEST_FILE_NAME_CONCAT]: Renamed from TEST_PATH_CONCAT.
66         * filenamecat.h: Likewise.  All includers changed.
67         * acl.c: Don't use "path" or "filename" to mean "file name"
68         in comments or local variable names.
69         * basename.c: Likewise.
70         * canonicalize.c, canonicalize.h: Likewise.
71         * dirname.c, dirname.h: Likewise.
72         * euidaccess.c: Likewise.
73         * exclude.c: Likewise
74         * fnmatch_.h, fnmatch_loop.c: Likewise.
75         * fsusage.c, fsuage.h: Likewise.
76         * fts.c, fts_.h: Likewise.
77         * getcwd.c: Likewise.
78         * getloadavg.c: Likewise.
79         * mkstemp.c: Likewise.
80         * mountlist.c, mountlist.h: Likewise.
81         * openat.c, openat.h: Likewise.
82         * readlink-stub.c: Likewise.
83         * readutmp.c, readutmp.h: Likewise.
84         * rename.c: Likewise.
85         * rmdir.c: Likewise.
86         * same.c: Likewise.
87         * savedir.c: Likewise.
88         * stripslash.c: Likewise.
89         * tempname.c: Likewise.
90         * xreadlink.c: Likewise.
91         * exclude.c (excluded_file_name): Renamed from excluded_filename.
92         All uses changed.
93         * exclude.h: Likewise.
94
95 2005-05-30  Paul Eggert  <eggert@cs.ucla.edu>
96
97         * euidaccess.c (getuid, getgid, getuid, getegid)
98         [!defined _POSIX_VERSION]: Remove decls; not needed these days.
99         * idcache.c (getpwuid, getpwnam, getgrgid, getgrnam)
100         [!defined _POSIX_VERSION]: Remove decls; not needed these days.
101         * pathmax.h: Include <limits.h> unconditionally, since other
102         files have been getting away with it for years (MORE/BSD 4.3
103         is extinct now).
104         * userspec.c (getpwnam, getgrnam, getgrgid)
105         [!defined _POSIX_VERSION]: Remove decls; not needed these days.
106
107 2005-05-29  Paul Eggert  <eggert@cs.ucla.edu>
108
109         * pathmax.h (_POSIX_PATH_MAX) [!defined _POSIX_PATH_MAX]:
110         Define to 256, not 255, as per modern POSIX.
111
112 2005-05-27  Paul Eggert  <eggert@cs.ucla.edu>
113
114         * fts.c: Don't worry about debugging on pre-C99-comopatible hosts;
115         the configuration hassle isn't worth it.
116         Include inttypes.h and stdint.h unconditionally if FTS_DEBUG.
117         (LONGEST_MODIFIER, PRIuMAX): Remove.
118
119         * strnumcmp.c, strnumcmp.h, strnumcmp-in.h, strintcmp.c:
120         New files.
121
122 2005-05-22  Paul Eggert  <eggert@cs.ucla.edu>
123
124         * fts.c (fd_safer) [_LGPL_PACKAGE]: New static function,
125         so that unistd-safer.h (GPL'ed code) need not be included.
126
127 2005-05-20  Paul Eggert  <eggert@cs.ucla.edu>
128
129         Split the fts code into GPL'ed and LGPL'ed parts, and fix some
130         minor memory-allocation bugs.
131
132         * fts.c: Don't include "cycle-check.h" or "hash.h".
133         (setup_dir, free_dir): New functions.
134         (enter_dir, leave_dir): Define trivial
135         alternatives of _LGPL_PACKAGE.  Move to fts-cycle.c if !_LGPL_PACKAGE.
136         (HT_INITIAL_SIZE, ENTER_DIR): Remove.  All uses removed.
137         (LEAVE_DIR): Fix typo: pass Fts and Ent to leave_dir.
138         (struct Active_dir, AD_compare, AD_hash, enter_dir, leave_dir):
139         Move to fts-cycle.c.
140         (fts_open): Use setup_dir.
141         (fts_close): Use free_dir.
142         (fts_read): Have just one copy of the ENTER_DIR code rather than three.
143         This adds a label and some gotos, but the alternatives were messier.
144         Check for memory allocation failure when entering a dir.
145         (fts_stat) [_LGPL_PACKAGE]: Bring back glibc cycle detection code.
146         * fts_.h (_LGPL_PACKAGE) [defined _LIBC]: New macro.
147         (FTS): New member fts_cycle, that is a union that contains the
148         old active_dir_ht and cycle_state.  All uses changed to mention
149         fts_cycle.ht and fts_cycle.state.
150         * fts-cycle.c: New file, containing GPL'ed code migrated out of
151         fts.c, with the following changes:
152         (setup_dir, free_dir): New functions.
153         (enter_dir): Now returns bool.  Return true if successful, false
154         if memory exhausted.  All callers changed.
155         Do not bother partly cleaning up on
156         memory allocation failure; that is free_dir's job.
157         However, free ad if hash_insert fails, to avoid memory leak.
158         (enter_dir, leave_dir): Accommodate change to FTS by inspecting
159         fts->fts_options to see which union member to use.
160
161 2005-05-20  Eric Blake  <ebb9@byu.net>  (tiny change)
162
163         * chown.c (rpl_chown): Return -1 on failure.
164
165 2005-05-20  Jim Meyering  <jim@meyering.net>
166
167         * fts.c (fts_open): Remove useless but otherwise harmless malloc call.
168         Spotted by Paul Eggert.
169
170 2005-05-19  Jim Meyering  <jim@meyering.net>
171
172         * unlinkdir.h (cannot_unlink_dir) [UNLINK_CANNOT_UNLINK_DIR]:
173         Use #define rather than a static function, to avoid a warning
174         when the function was not used.
175
176 2005-05-18  Paul Eggert  <eggert@cs.ucla.edu>
177
178         * canonicalize.c: Include canonicalize.h first, to test interface.
179         Include <stddef.h> unconditionally, since we assume C89 now.
180         All uses of PTR_INT_TYPE replaced by ptrdiff_t.
181         * fts.c: Include fts_.h first, to check interface.
182         Do not include intprops.h; no longer needed.
183         Include cycle-check.h and hash.h, since fts_.h no longer does.
184         Remove unnecessary casts of closedir to void.
185         (fts_build): Use a simpler method (not involving TYPE_SIGNED) to
186         decide whether to decrement nlinks.
187         * fts_.h: Do not include hash.h or cycle-check.h; no longer needed.
188         (FTS): Use struct hash_table * instead of Hash_table, so that
189         we no longer need to include hash.h here.
190
191 2005-05-14  Paul Eggert  <eggert@cs.ucla.edu>
192
193         * unlinkdir.c, unlinkdir.h: New files.
194
195 2005-05-14  Jim Meyering  <jim@meyering.net>
196
197         * unlocked-io.h, gethrxtime.c, gethrxtime.h, mountlist.h,
198         * xtime.h, path-concat.c: Correct cpp indentation.
199
200 2005-05-14  Jim Meyering  <jim@meyering.net>
201
202         Update FSF postal mail address everywhere.
203
204 2005-05-09  Paul Eggert  <eggert@cs.ucla.edu>
205
206         * fts_.h (FTS): Use correct type for fts_compar member.
207         (FTSENT): New member fts_fts.  Remove members fts_ino, fts_dev,
208         fts_nlink; no longer needed now that fts_statp is always there.
209         All uses changed to use fts_statp instead.
210         * fts.c (__P): Remove.  All uses rewritten to assume C89 or better.
211         (fts_open): Don't cast a function value in a possibly-unsafe way.
212         (fts_compar): New function.
213         (fts_sort): Use it.  But optimize the common case where all
214         pointers smell the same.
215
216 2005-05-08  Paul Eggert  <eggert@cs.ucla.edu>
217
218         * yesno.c: Include getline.h, not ctype.h.
219         (yesno): Don't remove leading white space; POSIX doesn't allow it.
220         Use getline to remove arbitrary restriction on response length.
221
222 2005-05-05  Paul Eggert  <eggert@cs.ucla.edu>
223
224         * makepath.c (make_path): chdir to "//", not "/", if the file name
225         starts with exactly two slashes.  This doesn't solve the problem
226         in general but it's better than nothing.  Problem reported by
227         Pierre A. Humblet via Eric Blake.
228
229 2005-05-01  Paul Eggert  <eggert@cs.ucla.edu>
230
231         * modechange.h (mode_free): Remove; all callers changed to invoke
232         'free'.
233         * modechange.c: Likewise.
234         xstrtol.h, stdbool.h, stddef.h: Don't include; no longer needed.
235         (MODE_DONE): New constant.
236         (struct mode_change): Remove 'next' member.
237         (make_node_op_equals): New function; like the old one of the
238         same name, except it allocates an array.
239         (mode_compile, mode_create_from_ref): Use it.
240         (mode_compile): Allocate result as an array, not a linked list.
241         Parse octal string ourself, so that we catch mistakes like "+0".
242         (mode_adjust): Arg is an array, not a linked list.
243
244         * mbswidth.c, regex.c, strtol.c: Sync from gnulib.
245
246 2005-04-28  Paul Eggert  <eggert@cs.ucla.edu>
247
248         * tempname.c (S_ISDIR, S_IRUSR, S_IRUSR, S_IWUSR, S_IXUSR): Remove.
249         [!_LIBC] Include "stat-macros.h" instead.
250
251         * file-type.c: Include file-type.h first.
252         * filetype.h: Don't assume <sys/stat.h> was included first.
253
254         * modechange.c: Include stat-macros.h, xalloc.h.
255         (S_ISDIR, S_ISUID, S_ISGID, S_ISVTX, S_IRUSR, S_IWUSR, S_IXUSR):
256         (S_IRGRP, S_IWGRP, S_IXGRP, S_IROTH, S_IWOTH, S_IXOTH, S_IRXWU):
257         (S_IRWXG, S_IRWXO, CHMOD_MODE_BITS):
258         Remove.  This is now stat-macros.h's job.
259         (talloc): Remove.  All callers replaced by xalloc, so that
260         our invokers don't have to worry about reporting memory failures.
261         (make_node_op_equals): Remove.
262         (MODE_ORDINARY_CHAGE, MODE_X_IF_ANY_X, MODE_COPY_EXISTING):
263         New constants.
264         (struct mode_change): Moved here from modechange.h.
265         (mode_append_entry): Remove.
266         (mode_compile): Remove MASKED_OPS arg, since it encouraged
267         apps to have incorrect behavior.  Use simpler algorithm for head
268         and tail.  Don't futz with umask; that's now the job of mode_adjust.
269         Detect more invalid usages rather than having somewhat-random behavior.
270         Don't insert an "a=" action, as that leads to incorrect behavior.
271         (mode_compile, mode_create_from_ref): Return NULL on error instead
272         of an enum, since now there's only one way to have an error.  All
273         callers changed.
274         (mode_adjust): Accept new arg UMASK_VALUE, and interpret it
275         at the correct time.  Simplify calculation of "+u" and its ilk.
276         Don't mishandle "+X".
277         (mode_free): Remove "register" and localize decls.
278         * modechange.h (MODE_X_IF_ANY_X, MODE_COPY_EXISTING):
279         (struct mode_change): Move to modechange.c; callers don't
280         need to see this stuff.
281         (MODE_MASK_EQUALS, MODE_MASK_PLUS, MODE_MASK_MINUS, MODE_MASK_ALL):
282         (MODE_INVALID, MODE_MEMORY_EXHAUSTED, MODE_BAD_REFERENCE): Remove.
283         (mode_change, mode_adjust): Reflect the new signatures noted above.
284
285 2005-04-18  Paul Eggert  <eggert@cs.ucla.edu>
286
287         * Makefile.am (noinst_LIBRARIES): fetish -> coreutils.
288         (libcoreutils_a_SOURCES): Renamed from libfetish_a_SOURCES.
289         All uses changed.
290         (libcoreutils_a_LIBADD): Renamed from libfetish_a_LIBADD.
291         All uses changed.
292         (libcoreutils_a_DEPENDENCIES): Renamed from libfetish_a_DEPENDENCIES.
293         All uses changed.
294         * chdir-long.c: fetish->coreutils in comment.
295         * t-chdir-long: fetish->coreutils in compilation command.
296
297 2005-04-13  Paul Eggert  <eggert@cs.ucla.edu>
298
299         * getdate.y (zone): Allow relunit_snumber after tZONE, so
300         that "UTC +1 second" continues to work.  Problem reported
301         by Dmitry V. Levin.
302         (relunit_snumber): New rule.
303         (relunit): Use it.
304
305 2005-04-12  Paul Eggert  <eggert@cs.ucla.edu>
306
307         * getdate.y (universal_time_zone_table): New constant.
308         (time_zone_table): Remove GMT, UT, UTC entries; they're now in
309         universal_time_zone_table.
310         (lookup_zone): Prefer universal_time_zone_table to
311         local_time_zone_table, so that "GMT" time stamps are allowed in
312         London during the summer.  Problem reported by Ian Abbott.
313
314 2005-04-11  Paul Eggert  <eggert@cs.ucla.edu>
315
316         Add bulletproofing for cases where stdin, stdout, or stderr are closed.
317         * fcntl-safer.h, open-safer.c: Remove.
318         * fd-safer.c: New file.
319         * dup-safer.c: Include unistd-safer.h first, to test interface.
320         (dup_safer) [!deefined F_DUPD]: Use new fd_safer function instead of
321         rolling our own code.
322         * fts.c: Include unistd-safer.h.
323         (fts_safe_changedir): Use fd_safer.
324         * getloadavg.c: Include unistd-safer.h.
325         (getloadavg): Use fd_safer.
326         * getusershell.c: Include stdio-safer.h.
327         (getusershell): Use fopen_safer.
328         * save-cwd.c: Include unistd-safer.h.
329         (save_cwd): Use fd_safer.
330         * unistd-safer.h (fd_safer): New decl.
331         * Makefile.am (libfetish_a_SOURCES): Remove dup-safer.c,
332         fcntl-safer.h, fopen-safer.c, open-safer.c, stdio-safer.h,
333         unistd-safer.h.
334
335 2005-04-09  Jim Meyering  <jim@meyering.net>
336
337         * fts.c (__attribute__, ATTRIBUTE_UNUSED): Define.
338         Mark parameter `sp' with ATTRIBUTE_UNUSED.
339
340         Avoid warnings from gcc-4.
341         * canon-host.c (canon_host) [HAVE_GETADDRINFO]: Use memset
342         rather than `= { 0 };' to initialize local `hint'.
343         * unicodeio.c (__attribute__, ATTRIBUTE_UNUSED): Define.
344         (exit_failure_callback, fallback_failure_callback): Mark unused
345         parameters with ATTRIBUTE_UNUSED.
346
347         * posixtm.c (posixtime) [lint]: Avoid spurious warning from gcc-4's
348         -Wuninitialized: initialize tm0.tm_year.
349
350         * human.c (humblock): Set *options even when returning due to
351         xstrtoumax conversion failure.  Thanks to a used-uninitialized
352         warning from gcc-4.
353
354 2005-04-08  Paul Eggert  <eggert@cs.ucla.edu>
355
356         * nanosleep.c (rpl_nanosleep): Include "timespec.h" before macros
357         that might redefine system include files.
358         (siginterrupt) [!HAVE_SIGINTERRUPT]: New macro.
359         (my_usleep): Use NULL rather than (void *) 0.
360         (rpl_nanosleep) [!defined SA_NOCLDSTOP]:
361         Use siginterrupt to specify that system calls should be interrupted.
362         (rpl_nanosleep): Move initialization of suspended closer to call of
363         my_usleep.
364
365 2005-04-04  Paul Eggert  <eggert@cs.ucla.edu>
366
367         * getdate.y (parser_control): rels_seen is now a boolean, not a
368         count, since there's no maximum.  All uses changed.
369         Add member dsts_seen.
370         (local_zone): Accumulate dsts_seen rather than relying on tm_isdst
371         not being INT_MAX.
372         (get_date): Initialize dsts_seen, and check that it doesn't go over 1.
373         Use pc_rels_seen to decide whther a date is absolute.
374
375         * getdate.y (number): Don't overwrite year.
376         (get_date): Initialize pc.year.digits to 0, not 4, to enable above
377         check.
378
379 2005-03-30  Paul Eggert  <eggert@cs.ucla.edu>
380
381         * readutmp.h (read_utmp): New arg OPTIONS.  All uses changed.
382         * readutmp.c: Likewise.  Include signal.h, stdbool.h.
383         (desirable_utmp_entry): New function.
384         (read_utmp) [defined UTMP_NAME_FUNCTION]: Redo memory allocation
385         using x2nrealloc, to simplify logic.
386         (read_utmp) [!defined UTMP_NAME_FUNCTION]: Check for overflow in
387         size calculation.  Do not assume utmp file is a regular file.
388         * readutmp.h (UT_PID): Moved here from ../src/who.c.
389         (READ_UTMP_CHECK_PIDS): New constant.
390
391 2005-03-29  Jim Meyering  <jim@meyering.net>
392
393         * long-options.c (long_options): Use NULL, not `0'.
394
395 2005-03-27  Jim Meyering  <jim@meyering.net>
396
397         * argmatch.c: Clarify comment: null-terminated -> NULL-terminated.
398
399 2005-03-26  Paul Eggert  <eggert@cs.ucla.edu>
400
401         * intprops.h (INT_STRLEN_BOUND, INT_BUFSIZE_BOUND):
402         "one's complement" -> "ones' complement" in comment, as per Knuth.
403         "value of type" -> "type or expression" in comment.
404         * mktime.c, strftime.c: Propagate intprops.h comment nits.
405
406 2005-03-26  Jim Meyering  <jim@meyering.net>
407
408         Comment nits.
409         * intprops.h: Add the apostrophe in `(one|two)'s complement'.
410         Correct typos: s/or/of/.
411
412 2005-03-23  Jim Meyering  <jim@meyering.net>
413
414         * canonicalize.c: Remove duplicate `#include "stat-macros.h"'.
415
416 2005-03-21  Paul Eggert  <eggert@cs.ucla.edu>
417
418         * Makefile.am (libfetish_a_SOURCES): Remove stat-macros.h, xstrtoul.c,
419         as they are now done by Autoconf macros.
420
421 2005-03-20  Paul Eggert  <eggert@cs.ucla.edu>
422
423         * gettext.h, regex.c, setenv.c, vasprintf.c: Sync from gnulib.
424         * vasnprintf.c (EOVERFLOW): Define if not already defined.
425         This merges a change from gnulib.
426
427 2005-03-18  Paul Eggert  <eggert@cs.ucla.edu>
428
429         * strftime.c (my_strftime): If the underlying strftime returns 0
430         (which shouldn't happen), generate nothing instead of returning 0
431         immediately, so that nstrftime (NULL, ...) doesn't return 0.
432
433 2005-03-15  Paul Eggert  <eggert@cs.ucla.edu>
434
435         * strftime.c (my_strftime): Prepend space to format so that we can
436         reliably distinguish strftime failure from empty output on POSIX
437         hosts.
438
439 2005-03-14  Paul Eggert  <eggert@cs.ucla.edu>
440
441         * mktime.c (TYPE_TWOS_COMPLEMENT, TYPE_ONES_COMPLEMENT,
442         TYPE_SIGNED_MAGNITUDE, TYPE_MINIMUM, TYPE_MAXIMUM): Sync from
443         intprops.h.
444         * strtol.c: Likewise.
445
446 2005-03-14  Jim Meyering  <jim@meyering.net>
447
448         * strftime.c (my_strftime) [HAVE_STRFTIME && ! (_NL_CURRENT
449         && HAVE_STRUCT_ERA_ENTRY)]: Initialize the first byte of ubuf[]
450         to be nonzero so that we (and caller) can detect the difference
451         between a valid zero-length expansion and an error return, even
452         when the underlying strftime fails before writing anything into
453         that location.
454
455 2005-03-11  Jim Meyering  <jim@meyering.net>
456
457         * getdate.c: Regenerate using bison-2.0.
458
459 2005-03-10  Jim Meyering  <jim@meyering.net>
460
461         * save-cwd.c [!HAVE_FCHDIR]: Define open, fchdir, and chdir_long
462         so that this module works on systems without fchdir.
463
464         * Makefile.am (libfetish_a_SOURCES): Remove xstrtol.c and xstrtol.h.
465
466 2005-03-09  Paul Eggert  <eggert@cs.ucla.edu>
467
468         Factor int-properties macros into a single file, except for
469         glibc-related files.
470         * intprops.h: New file.
471         * getloadavg.c: Include it instead of limits.h.
472         (INT_STRLEN_BOUND): Remove.
473         * human.c: Include intprops.h.
474         (group_number): Use INT_STRLEN_BOUND instead of rolling it ourself.
475         * human.h (LONGEST_HUMAN_READABLE): Use 146/485 rather than 302/1000.
476         * inttostr.h: Include intprops.h instead of limits.h.
477         (INT_STRLEN_BOUND, INT_BUFSIZE_BOUND): Remove.
478         * mktime.c (TYPE_IS_INTEGER, TYPE_TWOS_COMPLEMENT): New macros,
479         for consistency with intprops.h.
480         (time_t_is_integer, twos_complement_arithmetic): Use them.
481         * sig2str.h: Include <signal.h>, intprops.h.
482         (INT_STRLEN_BOUND): Remove.
483         * strftime.c (TYPE_SIGNED): Remove.
484         (INT_STRLEN_BOUND): Switch to same implementation as intprops.h.
485         * strtol.c: Adjust comments to match intprops.h.
486         * userspec.c: Include intprops.h.
487         (TYPE_SIGNED, TYPE_MINIMUM, TYPE_MAXIMUM): Remove.
488         * utimecmp.c, xnanosleep.c, xstrtol.c: Likewise.
489         * utimecmp.c (utimecmp): Use TYPE_IS_INTEGER, TYPE_TWOS_COMPLEMENT
490         instead of rolling our own expressions.
491         * xstrtol.c: Include xstrtol.h first, to test interface.
492         * fts.c: Include intprops.h.
493         (TYPE_SIGNED): Remove.
494
495 2005-03-09  Jim Meyering  <jim@meyering.net>
496
497         More migration to AC_LIBSOURCES/AC_LIBOBJ.
498         * Makefile.am (libfetish_a_SOURCES): Remove two more pairs of files:
499         cycle-check.c, cycle-check.h and argmatch.c, argmatch.h.
500
501         * cycle-check.c: Don't include "xalloc.h".  It's not used.
502
503 2005-03-01  Paul Eggert  <eggert@cs.ucla.edu>
504
505         Remove workaround for bug in Linux kernel 2.6.8 or thereabouts.
506         The workaround isn't strictly needed for POSIX conformance, and
507         it's too much of a pain to configure and maintain.  We'll ask
508         people to fix their kernels instead.
509         * xnanosleep.c: Don't include gethrxtime.h or xtime.h.
510         (NANOSLEEP_BUG_WORKAROUND): Remove.
511         (xnanosleep): Remove the workaround.
512
513 2005-02-27  Jim Meyering  <jim@meyering.net>
514
515         * xnanosleep.c (xnanosleep): Work around bug in Linux-2.6.8.1's
516         nanosleep whereby it fails without setting errno upon being resumed
517         after being suspended.
518
519 2005-02-25  Paul Eggert  <eggert@cs.ucla.edu>
520
521         * vasnprintf.c (VASNPRINTF) [!USE_SNPRINTF]: Correct the test for
522         integer overflow again.  Actually, neither this nor the 2005-01-23
523         change fixes any bug on any plausible platform; it's more of a
524         code-clarity thing.
525
526         * config.charset, gettext.h, localcharset.c: Sync from gnulib.
527
528 2005-02-23  Paul Eggert  <eggert@cs.ucla.edu>
529
530         * strftime.c: Include <stdbool.h>.  Use bool where appropriate,
531         instead of int.
532         (my_strftime): Do not mishandle years close to INT_MAX, by doing
533         the right thing even if adding 1900 would overflow.  Similarly
534         for tm_mon + 1 and tm_yday + 1.
535         Make %Y always equivalent to %C%y, and similarly for %G and %g.
536         (DO_NUMBER, DO_NUMBER_SPACEPAD): Set digits to d, not a conditional.
537         (DO_SIGNED_NUMBER): New macro.
538         (my_strftime) [HAVE_TZNAME]: Don't dump core if tp->tm_dst > 1.
539
540 2005-02-21  Paul Eggert  <eggert@cs.ucla.edu>
541
542         * Makefile.am (libfetish_a_SOURCES): Remove xnanosleep.c,
543         xnanosleep.h; now done by ../m4/xnanosleep.m4 automatically.
544
545 2005-02-20  Paul Eggert  <eggert@cs.ucla.edu>
546
547         * gethrxtime.h, gethrxtime.c, xtime.h: New files.
548         * timespec.h (gettime): Return void, since it always
549         succeeds now.  All uses changed.
550         * gettime.c (gettime) Likewise.
551         [HAVE_NANOTIME]: Prefer nanotime.
552         Assume gettimeofday succeeds, as POSIX requires.
553         Assime time () succeeds, since other code already does.
554         * xnanosleep.c: Include xtime.h and gethrxtime.h, not xalloc.h.
555         (timespec_subtract): Remove.
556         (NANOSLEEP_BUG_WORKAROUND): New constant.
557         (xnanosleep): Use gethrxtime rather than gettime; this simplifies
558         things considerably.  Use it only on GNU/Linux hosts, since the
559         workaround shouldn't be needed elsewhere.
560
561 2005-02-20  Neil Conway  <neilc@samurai.com>
562
563         * xgethostname.c (xgethostname): Check for ENOMEM, which is
564         returned by OSX/Darwin if the specified buffer is not large
565         enough for the hostname.
566
567 2005-02-20  Jim Meyering  <jim@meyering.net>
568
569         More of the same.
570         * Makefile.am (libfetish_a_SOURCES): Remove
571         linebuffer.[ch] and stripslash.c.
572
573 2005-02-11  Jim Meyering  <jim@meyering.net>
574
575         Remove names of files that are now mentioned in AC_LIBSOURCES
576         and AC_LIBOBJ uses in inttostr.m4.
577         * Makefile.am (libfetish_a_SOURCES): Remove imaxtostr.c,
578         offtostr.c, and umaxtostr.c.
579         (EXTRA_DIST): Remove inttostr.c and inttostr.h.
580
581 2005-02-08  Jim Meyering  <jim@meyering.net>
582
583         * Makefile.am (libfetish_a_SOURCES): Remove memcasecmp.c
584         and memcasecmp.h.
585
586 2005-02-07  Jim Meyering  <jim@meyering.net>
587
588         * Makefile.am (libfetish_a_SOURCES): Remove fts.c, fts_.h, and
589         getcwd.h now that they're mentioned in AC_LIBSOURCES and AC_LIBOBJ
590         uses in the corresponding ../m4/*.m4.
591
592 2005-02-03  Paul Eggert  <eggert@cs.ucla.edu>
593
594         * memrchr.h: New file.
595         * chdir-long.c: Include it.
596         * memrchr.c [!defined _LIBC]: Include it rather than <string.h>.
597         Don't bother including stddef.h.
598
599 2005-02-01  Paul Eggert  <eggert@cs.ucla.edu>
600
601         * mountlist.h (MOUNTLIST_H_): New macro, to protect against double
602         inclusion.
603         Include <sys/types.h>, for dev_t.
604         (ME_DUMMY, ME_REMOTE): Move from here....
605         * mountlist.c (ME_DUMMY, ME_REMOTE): To here.
606         (ME_DUMMY): Count "subfs" as a dummy.  Problem reported by
607         Dmitry V. Levin.
608         Include mountlist.h first, to test the interface.
609
610 2005-01-29  Jim Meyering  <jim@meyering.net>
611
612         * Makefile.am (libfetish_a_SOURCES): Remove many files from this
613         list, now that automake determines their names automatically,
614         thanks to the new AC_LIBSOURCES and AC_LIBOBJ uses in the
615         corresponding ../m4/*.m4 files.
616         (EXTRA_DIST): Add getdate.c here, so that we continue to distribute it.
617
618 2005-01-25  Jim Meyering  <jim@meyering.net>
619
620         * path-concat.c: Don't include assert.h.
621         (path_concat): Remove assertion that would have triggered
622         for ABASE starting with more than one slash.
623         Reported by Andreas Schwab.
624
625         * path-concat.c (path_concat): Set *BASE_IN_RESULT
626         properly when ABASE is an absolute file name.
627         Correct the description of this function.
628         Include <assert.h>.
629         Add an assertion and a test driver.
630         This fixes a bug introduced on 2004-07-02.
631         Andreas Schwab reported the resulting failure of cp --parents:
632         http://lists.gnu.org/archive/html/bug-coreutils/2005-01/msg00130.html
633
634 2005-01-23  Jim Meyering  <jim@meyering.net>
635
636         * vasnprintf.c (VASNPRINTF) [!USE_SNPRINTF]: Correct the test for
637         integer overflow.
638
639 2005-01-21  Paul Eggert  <eggert@cs.ucla.edu>
640
641         Sync from gnulib.
642         * error.c [!_LIBC && !ENABLE_NLS]: Do not include "gettext.h";
643         not needed.  This removes a dependency on the gettext module.
644         [defined _LIBC]: Do not include <libintl.h>; not needed.
645
646 2005-01-20  Paul Eggert  <eggert@cs.ucla.edu>
647
648         * save-cwd.c (save_cwd): Remove code to support the case
649         where fchdir is missing or flaky.
650
651         * Makefile.am (libfetish_a_SOURCES): Add version-etc-fsf.c.
652
653 2005-01-20  Simon Josefsson  <jas@extundo.com>
654
655         * version-etc-fsf.c: New file, with version_etc_copyright.
656         * version-etc.c: Remove version_etc_copyright.
657         * version-etc.h (version_etc_copyright): Use [] instead of * in
658         prototype, suggested by Paul Eggert.
659
660 2005-01-19  Jim Meyering  <jim@meyering.net>
661
662         * openat.h (AT_SYMLINK_NOFOLLOW): Define to 4096, so it's the
663         same value as for Solaris 9.
664
665         * chdir-long.c (chdir_long): Rewrite to remove limitation on
666         component length.  This included changing the parameter to be
667         of type `char *' rather than `char const *'.
668         * chdir-long.h (chdir_long): Update prototype.
669         * t-chdir-long: A test harness to exercize chdir-long.c's
670         sample main program.
671
672         * openat.c (fdopendir, fstatat): New functions.
673         * openat.h: Include headers required for use of DIR and struct stat.
674         [AT_SYMLINK_NOFOLLOW]: Define.
675         (fdopendir, fstatat): Add prototypes.
676
677 2005-01-04  Paul Eggert  <eggert@cs.ucla.edu>
678
679         * human.c (SIZE_MAX, UINTMAX_MAX): Move these conditional
680         definitions to be after all include files, to avoid collisions.
681         Problem reported by Bob Proulx.
682
683 2005-01-04  Bob Proulx  <bob@proulx.com>
684
685         * obstack.c [DEFAULT_ALIGNMENT]: Use an intermediate type to simplify
686         offsetof() macro construct to avoid compile failure with native HP-UX
687         11.0 ANSI C compiler.
688
689 2005-01-03  Paul Eggert  <eggert@cs.ucla.edu>
690
691         * utimens.c (futimens): Robustify the previous patch, by checking
692         for known valid error numbers rather than observed invalid ones.
693
694 2005-01-03  Jim Meyering  <jim@meyering.net>
695
696         * utimens.c (futimens): Account for the fact that futimes
697         can also fail with errno == ENOSYS in that case.
698         Patch from Dmitry V. Levin.
699
700 2005-01-03  Paul Eggert  <eggert@cs.ucla.edu>
701
702         * utimens.c (futimens) [HAVE_FUTIMES]: Fall back on utimes if
703         futimes fails with errno == ENOENT.  Problem reported by
704         Dmitry V. Levin.
705
706 2005-01-02  Jim Meyering  <jim@meyering.net>
707
708         * version-etc.c (version_etc_copyright): Update copyright date.
709
710 2004-12-31  Jim Meyering  <jim@meyering.net>
711
712         * openat.c (rpl_openat): Correct comment.
713         Call free_cwd, to avoid leaking a file descriptor.
714
715 2004-12-23  Paul Eggert  <eggert@cs.ucla.edu>
716
717         * getdate.y (YYSTACK_USE_ALLOCA): Define to 0, since there's no
718         need to extend the stack.
719         (YYINITDEPTH): New macro, so that the initial stack isn't overly
720         large.
721
722 2004-12-19  Paul Eggert  <eggert@cs.ucla.edu>
723
724         * c-strtod.c (STRTOD): Depend on HAVE_C99_STRTOLD, not
725         HAVE_DECL_STRTOLD.
726
727         * alloca_.h: Conditionalize on _GNULIB_ALLOCA_H, not _ALLOCA_H.
728         Remove now-obsolete comment about AIX.
729         * getdate.y: Include <alloca.h> only if HAVE_ALLOCA.
730         (YYSTACK_USE_ALLOCA): Define to 0 if !HAVE_ALLOCA.
731         (YYMAXDEPTH): New macro.
732
733 2004-12-11  Jim Meyering  <jim@meyering.net>
734
735         * chdir-long.c: Fail via #error if PATH_MAX is not defined, since
736         this file is now compiled only on systems that define PATH_MAX.
737
738 2004-12-08  Paul Eggert  <eggert@cs.ucla.edu>
739
740         * getdate.y (textint): New member "negative".
741         (time_zone_hhmm): New function.
742         Expect 14 shift-reduce conflicts, not 13.
743         (o_colon_minutes): New rule.
744         (time, zone): Use it to add support for +HH:MM, UTC+HH:MM.
745         (yylex): Set the "negative" member of signed numbers.
746
747 2004-12-06  Jim Meyering  <jim@meyering.net>
748
749         * Makefile.am (libfetish_a_SOURCES): Begin removing .c and .h file
750         names, as they are added to AC_LIBSOURCES directives in the
751         corresponding m4/*.m4 files.
752
753 2004-12-05  Jim Meyering  <jim@meyering.net>
754
755         Currently, fpending.m4 punts (by defining PENDING_OUTPUT_N_BYTES
756         to 1) if it doesn't find a valid expression for the replacement
757         function.  Before this change, that might have gone undetected
758         for some time.  Now, we'll catch it close to the source.
759
760         * t-fpending.c: New file.  Test the __fpending function.
761         This ensures that if there is an error in the definition of the
762         PENDING_OUTPUT_N_BYTES expression, we'll find about it right away;
763         that value is used only in the rare event that close_stdout's
764         fclose fails with EBADF.
765         * Makefile.am (unit-test): New target.
766         (check): Depend on it.
767         (noinst_PROGRAMS): Define.
768         (LDADD): Define.
769         * Makefile.am (unit-test): Depend on t-fpending.
770         Make the target .PHONY.
771
772 2004-12-02  Paul Eggert  <eggert@cs.ucla.edu>
773
774         * openat.c: Include "openat.h" before other include files.
775         Include "exitfail.h".
776         (openat): Remove #undef; no longer needed now that we include openat.h
777         first.
778         (rpl_openat): Add comment about mode_t promotion.  Simplify
779         code a bit by moving initializations around.  Use exit_failure
780         rather than EXIT_FAILURE.
781         * openat.h: Add copyright and authorship notice.
782         (AT_FDCWD): Use the same value Solaris 9 uses, except of type
783         'int' not 'unsigned int'.
784
785         * save-cwd.c: Include "save-cwd.h" before other include files.
786         (O_DIRECTORY): Remove; not needed here, since "." must be
787         a directory.  All uses removed.
788         (save_cwd): Use __sgi || __sun, not sun || __sun.  __sun is
789         universal on Suns, and we also need to test for IRIX.
790         Revamp code to use 'if' rather than '#if'.
791         Avoid unnecessary comparison of cwd->desc to 0.
792
793 2004-12-01  Paul Eggert  <eggert@cs.ucla.edu>
794
795         * hard-locale.c: Assume <locale.h> exists.
796         Include "strdup.h".
797         (GLIBC_VERSION): New macro.
798         (hard_locale): Assume setlocale exists.
799         Rewrite to avoid #ifdef.
800         Use strdup rather than malloc + strcpy.
801         * human.c: Assume <locale.h> exists.
802         (human_readable): Assume localeconv exists.
803
804 2004-11-30  Paul Eggert  <eggert@cs.ucla.edu>
805
806         * getcwd.c (is_ENAMETOOLONG): New macro.
807         (__getcwd.c): Don't restore errno; glibc doesn't.
808         [HAVE_PARTLY_WORKING_GETCWD && !defined AT_FDCWD]: Try system getcwd
809         first, falling back to our code only if its results look suspicious.
810         Ensure that the resulting buffer is only as large as necessary.
811
812         * readutmp.c: Include readutmp.h first.
813         Include <errno.h>, since readutmp.h no longer does that.
814         * readutmp.h: Don't include <errno.h>,
815         <sys/param.h>, <time.h>; not needed to establish interface.
816         (errno): Remove decl.
817         (HAVE_STRUCT_XTMP_UT_TYPE): Remove; no longer needed.
818         (UT_TYPE_EQ, UT_TYPE_NOT_DEFINED, UT_TYPE_BOOT_TIME,
819         UT_TYPE_USER_PROCESS, IS_USER_PROCESS): New macros.
820
821 2004-11-30  Jim Meyering  <jim@meyering.net>
822
823         Change the name of the robust chdir function from chdir to chdir_long.
824         * save-cwd.c: Include chdir-long.h rather than chdir.h.
825         (restore_cwd): Use chdir_long, not chdir.
826         * chdir-long.c: Renamed from chdir.c.
827         * chdir-long.h: Renamed from chdir.h.
828         [!defined PATH_MAX]: Define chdir_long to chdir on systems like the Hurd.
829         * Makefile.am (libfetish_a_SOURCES): Reflect name changes.
830
831         * chdir.c (O_DIRECTORY): Define, if necessary.
832         (memchrcspn): Tiny wrapper around memchr.
833         (rpl_chdir): Use memchrcspn rather than strcspn.
834
835 2004-11-28  Jim Meyering  <jim@meyering.net>
836
837         * openat.c (rpl_openat): Also accept optional mode parameter.
838         * openat.h (rpl_openat): Adjust prototype.
839
840         * save-cwd.c: Include "chdir.h", so that if save_cwd/getcwd
841         saves a name longer than PATH_MAX, restore_cwd's chdir can use it.
842
843         * Makefile.am (libfetish_a_SOURCES): Add chdir.h and openat.h.
844
845         This is a robust version of chdir, in that it can handle directory
846         names longer than PATH_MAX.
847         * chdir.c, chdir.h: New file.
848         * openat.c, openat.h: New files.
849
850 2004-11-25  Paul Eggert  <eggert@cs.ucla.edu>
851
852         Fix problems reported by Scott S. Tinsley for HP-UX 11.11 using
853         HP's ANSI C compiler.
854         * fsusage.c (statvfs) [HAVE_SYS_STATVFS_H]: Remove decl.
855         Declaring int functions causes warnings on some modern systems and
856         shouldn't be needed to compile on ancient ones.
857         * same.c (MIN) [defined MIN]: Don't define, since it's already
858         defined.
859
860         * mempcpy.c, mempcpy.h: New files, taken from gnulib.
861         * Makefile.am: (libfetish_a_SOURCES): Add getcwd.h, mempcpy.h.
862         * getcwd.c: Replace by a copy of glibc/sysdeps/posix/getcwd.c, but
863         with the following changes.
864         (__set_errno): Parenthesize properly.
865         Include <stdbool.h>.
866         (MIN, MAX, MATCHING_INO): New macros.
867         (__getcwd): Define with prototype, not K&R form.
868         Use heuristics to allocate default buffer on stack if possible.
869         If AT_FDCWD is defined, use openat and fstatat to avoid O(N**2)
870         behavior, and to avoid the PATH_MAX limit when computing
871         ../../../../...
872         Use MATCHING_INO to compare inode number to file.
873         Check for arithmetic overflow in size calculations.
874         Fix bug in reallocation of dot array that caused getcwd to fail
875         on directories nested deeper than 75.
876         Be more careful about saving errno on error.
877         Do not use realloc; use only free+malloc, as this is a bit
878         more flexible and avoids a needless copy operation.
879         Do not inspect st_dev and st_ino for symbolic links; POSIX
880         doesn't specify the latter.
881         Check for closedir errors.
882         Avoid needless casts.
883         Use "#ifdef weak_alias" around weak_alias, to be like other
884         glibc code.
885         The following changes to getcwd.c have effect only when used in
886         gnulib; they have no effect inside glibc proper.
887         (#pragma alloca) [defined _AIX && !defined __GNUC__]: Remove,
888         as alloca isn't used.
889         (alloca, __alloca): Likewise.
890         [!_LIBC]: Include "getcwd.h", "mempcpy.h".
891         Include <stddef.h>, <stdlib.h>, <string.h>, <limits.h>
892         unconditionally, as gnulib assumes C89 or better.
893         Do not include <sys/param.h>.
894         (errno) [!defined __GNU_LIBRARY__ && !defined STDC_HEADERS]: Remove
895         no-longer-necessary 'extern int errno' decl; gnulib assumes C89 or
896         better.
897         (NULL) [!defined NULL]: Remove; we assume C89 or better.
898         Include <dirent.h> in a way that is compatible with modern Autoconf.
899         (_D_ALLOC_NAMELEN, _D_EXACT_NAMLEN):
900         New macros, if not already defined.
901         Include <unistd.h> if _LIBC, not if __GNU_LIBRARY__.
902         Use "_LIBC", not "defined _LIBC", for consistency.
903         (HAVE_MEMPCPY): Remove; no longer needed now that gnulib has
904         a mempcpy module.
905         (__lstat, __closedir, __opendir, __readdir) [!_LIBC]: New macros.
906         (GETCWD_RETURN_TYPE): Remove.  All uses replaced by char *.
907         * xgetcwd.c: David MacKenzie's old code was removed, so give
908         credit only to Jim Meyering and adjust the copyright dates.
909         Do not include <limits.h>, <stdio.h>, <sys/types.h>,
910         <stdlib.h>, <unistd.h>, "pathmax.h".
911         Instead, include "xgetcwd.h" (first) and "getcwd.h".
912         (INITIAL_BUFFER_SIZE): Remove.
913         (xgetcwd): Rely on getcwd, since we now depend on a reliable one.
914
915 2004-11-23  Paul Eggert  <eggert@cs.ucla.edu>
916
917         * utimens.c (__attribute__, ATTRIBUTE_UNUSED): New macros.
918         (futimens): New function, which uses futimes if available.
919         (futimens, utimens): Support timespec==NULL, with same semantics
920         as utime and utimens.
921         * utimens.h (futimens): New decl.
922
923 2004-11-23  Sergey Poznyakoff  <gray@Mirddin.farlep.net>
924
925         * getopt_.h: Re-addition of __getopt_argv_const caused
926         redefinition warnings. To avoid them, include the defines
927         in `#if !defined __need_getopt ... #endif'. The only place
928         where __getopt_argv_const is used is in definitions
929         of getopt_long and getopt_long_only below, which are as well
930         protected by `#ifndef __need_getopt'.
931         [defined __GETOPT_PREFIX && !defined __need_getopt]: Undef
932         __need_getopt after including <stdio.h> and <unistd.h> These
933         headers might have defined it.
934
935 2004-11-23  Jim Meyering  <jim@meyering.net>
936
937         * closeout.c: Revert last change, since it seems EBADF is always
938         defined.
939
940 2004-11-22  Jim Meyering  <jim@meyering.net>
941
942         * closeout.c (EBADF): Fail with `#error ...' if it's not defined,
943         asking the user to report the problem.
944
945 2004-11-17  Paul Eggert  <eggert@cs.ucla.edu>
946
947         * realloc.c (rpl_realloc): Call 'free' if n==0, since realloc
948         might fail.  Problem reported by Yoann Vandoorselaere.
949         * calloc.c (rpl_calloc): Defend against buggy calloc implementations
950         that mishandle size_t overflow.
951
952 2004-11-16  Paul Eggert  <eggert@cs.ucla.edu>
953
954         * xgetcwd.c: Include <limits.h>, for PATH_MAX.
955         (xgetcwd): Set errno correctly when failing.
956         Work around Solaris 9 bug: getcwd sets errno==ERANGE even though
957         the failure is actually due to a PATH_MAX problem.
958
959         Further getopt changes to make it more likely that glibc will
960         buy the changes back.
961         * getopt.c (POSIXLY_CORRECT): New constant.
962         (getopt): Use it, so to preserve glibc semantic
963         * getopt1.c (getopt_long, getopt_long_only): Arg is char * const *
964         when compiling for libc.
965         * getopt_.h (__getopt_argv_const): Bring it back.
966         (getopt_long, getopt_long_only): Use it.
967
968         * getopt.c (_getopt_initialize, _getopt_internal_r, _getopt_internal):
969         New arg POSIXLY_CORRECT.  All callers changed.
970         (getopt): Argv is now char * const *, as per standard.
971         (_getopt_internal_r, _getopt_internal): Argv is now char **,
972         not char *__getopt_argv_const *.
973         * getopt1.c (getopt_long, _getopt_long_r, getopt_long_only,
974         _getopt_long_only_r): Likewise.
975         * getopt_.h (getopt, getopt_long, geopt_long_only): Likewise.
976         * getopt_int.h (_getopt_internal, _getopt_internal_r,
977         _getopt_long_r, _getopt_long_only_r): Likewise.
978         * getopt_.h (__getopt_argv_const): Remove.
979         (getopt): Argv is now char * const *, as per standard.
980
981         * canon-host.c: Include "strdup.h".
982         (canon_host): Use getaddrinfo if available, so that IPv6 works.
983         Use strdup instead of malloc/strcpy to duplicate strings.
984
985         * getdate.y (tORDINAL): New token.
986         (day, relunit): Allow it for relative times.
987         (relative_time_table): Use tORDINAL for ordinals.
988
989 2004-11-15  Paul Eggert  <eggert@cs.ucla.edu>
990
991         * human.h (LONGEST_HUMAN_READABLE): Add 1 for space before unit.
992         (human_space_before_unit): New constant.
993         * human.c (human_readable): Support it.
994
995 2004-11-14  Jim Meyering  <jim@meyering.net>
996
997         * closeout.c (close_stdout): Don't fail just because stdout was
998         closed initially, since some programs don't write to stdout in the
999         normal course of operation (other than --version and --help), and
1000         we don't want this function to make e.g. `cp 1 2 >&-' fail.
1001         But do fail if it was closed and someone has tried to write to it.
1002         E.g., printf foo >&-
1003
1004         * __fpending.c, __fpending.h: Restore these files.
1005         They're useful after all.
1006         * Makefile.am (libfetish_a_SOURCES): Add __fpending.h.
1007
1008 2004-11-11  Paul Eggert  <eggert@cs.ucla.edu>
1009
1010         * getopt.c, getopt1.c, getopt_.h, getopt_int.h:
1011         Sync from gnulib.
1012
1013 2004-11-10  Paul Eggert  <eggert@cs.ucla.edu>
1014
1015         * allocsa.h, mbswidth.c, mktime.c, readlink.c, getdate.y,
1016         quotearg.c, strftime.c: Sync from gnulib.
1017
1018 2004-11-06  Jim Meyering  <jim@meyering.net>
1019
1020         * __fpending.c, __fpending.h: Remove files.
1021
1022         * Makefile.am (libfetish_a_SOURCES): Remove __fpending.h, now
1023         that it's no longer used.
1024
1025         Ensure that no close failure goes unreported.
1026         * closeout.c (close_stdout): Always close stdout.  I.e., don't
1027         return early when it seems there's nothing to flush.
1028         Don't include __fpending.h.
1029
1030 2004-11-03  Paul Eggert  <eggert@cs.ucla.edu>
1031
1032         * unsetenv.c: New file, from gnulib.  Needed for new getdate.y.
1033         * Makefile.am (libfetish_a_SOURCES): Remove setenv.c.
1034         * xreadlink.c: Sync from gnulib.
1035
1036 2004-11-03  Jim Meyering  <jim@meyering.net>
1037
1038         * Makefile.am (libfetish_a_SOURCES): Add setenv.c and setenv.h.
1039
1040 2004-11-02  Paul Eggert  <eggert@cs.ucla.edu>
1041
1042         * getdate.y, getpass.c, setenv.h: Sync from gnulib.
1043
1044 2004-10-29  Paul Eggert  <eggert@cs.ucla.edu>
1045
1046         * getdate.y, getpagesize.h, mktime.c: Sync from gnulib.
1047
1048 2004-10-24  Paul Eggert  <eggert@cs.ucla.edu>
1049
1050         * mktime.c (leapyear): Arg is long int, not int.
1051         Change imported from gnulib.
1052
1053 2004-10-17  Paul Eggert  <eggert@cs.ucla.edu>
1054
1055         Sync from gnulib.
1056         * diacrit.c, diacrit.h: Add copyright notice.
1057         * getpass.c (fflush_unlocked, flockfile, funlockfile)
1058         (fputs_unlocked, putc_unlocked) [!_LIBCS && !USE_UNLOCKED_IO]: Map
1059         to real functions.
1060
1061 2004-10-13  Jim Meyering  <jim@meyering.net>
1062
1063         * fts.c (fts_read): When about to fail (by returning NULL) due
1064         to a failed fchdir or failed fts_safe_changedir call, set
1065         `sp->fts_cur = p'.  Do this by removing the explicit `return NULL;'
1066         statements and setting p->fts_errno so execution falls through
1067         to the common-case code below.  Otherwise, after such a failure,
1068         calling fts_close would attempt to free an already-freed buffer.
1069         Reported by Luis Lopez Lopez in http://bugs.debian.org/276352.
1070
1071 2004-10-04  Paul Eggert  <eggert@cs.ucla.edu>
1072
1073         Sync from gnulib.
1074
1075         * xalloc.h (xmemdup): Renamed from xclone.
1076         * xmalloc.c (xmemdup): Likewise.
1077         * xalloc.h (CCLONE, CLONE, NEW, XCALLOC, XMALLOC, XREALLOC,
1078         XFREE): Remove these long-obsolescent macros.
1079         * xmalloc.c (xstrdup): Implementation moved here from xstrdup.c
1080         * xstrdup.c: Remove.
1081
1082         * argmatch.c, closeout.c, error.c, exclude.c, getdate.y,
1083         getndelim2.c, getpass.c, getusershell.c, linebuffer.c,
1084         md5.c, mountlist.c, posixtm.c, readtokens.c, readutmp.c,
1085         regex.c, sha1.c, version-etc.c, yesno.c:
1086         Include "unlocked-io.h" only if USE_UNLOCKED_IO.
1087         * unlocked-io.h: Don't worry about USE_UNLOCKED_IO; that's now
1088         the includer's responsibility.
1089
1090 2004-10-03  Paul Eggert  <eggert@cs.ucla.edu>
1091
1092         Sync from gnulib.
1093         * dirfd.h, getpagesize.h: Add copyright notice.
1094         * vasnprintf.c: (VASNPRINTF): Set errno=EOVERFLOW if the output is
1095         too long.
1096         * vasnprintf.h: Doc fix.
1097         * vasprintf.c: Don't include <limits.h>.
1098         (vasprintf): Rely on vasnprintf to set errno=EOVERFLOW.
1099
1100 2004-09-23  Paul Eggert  <eggert@cs.ucla.edu>
1101
1102         * modechange.c (mode_compile): Don't decrement a pointer that
1103         points to the start of a string, as the C Standard says the
1104         resulting behavior is undefined.
1105
1106 2004-09-22  Jim Meyering  <jim@meyering.net>
1107
1108         * getopt.c: Remove extraneous spaces before TAB.
1109         * getopt_.h: Likewise.
1110
1111         * backupfile.c: Remove trailing blanks.
1112         * euidaccess.c: Likewise.
1113
1114 2004-09-13  Paul Eggert  <eggert@cs.ucla.edu>
1115
1116         * backupfile.h (enum backuptype): Rename none -> no_backups,
1117         simple -> simple_backups, numbered_existing ->
1118         numbered_existing_backups, numbered -> numbered_backups
1119         to avoid shadowing problems.  All uses changed.
1120         * argmatch.c (enum backuptype): Likewise.
1121         * backupfile.c (check_extension, numbered_backup):
1122         Rename locals to avoid shadowing 'basename'.
1123         * backupfile.h (VALID_BACKUP_TYPE): Don't evaluate arg more than
1124         once.
1125
1126 2004-09-02  Paul Eggert  <eggert@cs.ucla.edu>
1127
1128         Port to diet libc.  Problem reported by Felix von Leitner in
1129         <http://lists.gnu.org/archive/html/bug-coreutils/2004-08/msg00171.html>
1130         * fts.c (fts_stat, fts_open, fts_read): Use "unsigned short int"
1131         rather than the unportable "u_short", and similarly for u_int.
1132         * fts_.h (FTSENT): Likewise.
1133
1134 2004-08-19  Paul Eggert  <eggert@cs.ucla.edu>
1135
1136         * getopt.c, getopt1.c: Sync from gnulib.
1137         * getopt_.h: Renamed from getopt.h (this syncs from gnulib).
1138         * Makefile.am (libfetish_a_SOURCES): Remove getopt.c, getopt.h,
1139         getopt1.c, getopt_int.h.
1140         (BUILT_SOURCES, EXTRA_DIST, all-local, $(lib_OBJECTS), getopt.h,
1141         MOSTLYCLEANFILES): Add current gnulib snippet for getopt.
1142         * .cppi-disable: Add getopt_.h, getopt_int.h.
1143         * .cvsignore: Add getopt.h.
1144
1145 2004-08-18  Paul Eggert  <eggert@cs.ucla.edu>
1146
1147         * userspec.c: Don't use <alloca.h>, so that we don't use alloca on
1148         strings on unbounded length.  alloca's performance benefits aren't
1149         that important here.
1150         (V_STRDUP): Remove.
1151         (parse_with_separator): New function, with most of the internals
1152         of the old parse_user_spec.  Allow user to omit both user and group,
1153         for compatibility with FreeBSD.
1154         Clone only the user name, not the entire spec.
1155         Do not set *uid, *gid unless entirely successful.
1156         Avoid memory leak in some failing cases.
1157         Fix regression for USER.GROUP reported by Dmitry V. Levin in
1158         <http://lists.gnu.org/archive/html/bug-coreutils/2004-08/msg00102.html>
1159         (parse_user_spec): Rewrite to use parse_with_separator.
1160
1161 2004-08-11  Paul Eggert  <eggert@cs.ucla.edu>
1162
1163         * fts.c (O_DIRECTORY): Define to 0 if the system doesn't define.
1164
1165         * settime.c (settime): Recode to avoid warning with Sun Forte C 6U2.
1166
1167         * obstack.c: Include <inttypes.h> and <stdint.h> if available.
1168         (union fooround): Use uintmax_t, not long int.
1169         The rest is a merge from libc:
1170         [defined _LIBC]: Include <shlib-compat.h>.
1171         (_obstack) [defined _LIBC]: Remove after 2.3.4.
1172
1173         * xgethostname.c: Do not include error.h.  (merge from gnulib).
1174
1175         * fnmatch.c (WIDE_CHAR_SUPPORT): Don't set to 1 if missing
1176         wmemchr or wmemcpy.  Problem reported by Robert Dahlem
1177         for Reliant Unix 5.43.
1178
1179 2004-08-09  Paul Eggert  <eggert@cs.ucla.edu>
1180
1181         * Makefile.am (libfetish_a_SOURCES): Add getpass.h.
1182         * getpass.h: New file.
1183         * .cpp-disable: Add it.
1184         * getpass.c [!_LIBC]: Include it.
1185
1186         * obstack.h (obstack_empty_p):
1187         Don't assume that chunk->contents is suitably aligned.
1188         * obstack.c (_obstack_begin, _obstack_begin_1, _obstack_newchunk):
1189         Likewise. Problem reported by Benno in
1190         <http://sources.redhat.com/ml/libc-alpha/2004-08/msg00055.html>.
1191
1192         * chown.c (rpl_chown): Work even if the file is writeable but not
1193         readable.  This could be improved further but it'd take some work.
1194         * fts.c (diropen): New function.
1195         (fts_open, fts_read, fts_children, fts_safe_changedir):
1196         Use it, so that the code works even if the directory
1197         is writeable but not readable.  We'd like it to work even if
1198         the directory is merely executable, but I don't know how to do
1199         that portably.
1200
1201         * xalloc-die.c: New file.
1202         * xalloc.h (xalloc_fail_func, xalloc_msg_memory_exhausted): Remove.
1203         All uses removed.
1204         * xmalloc.c (xalloc_fail_func, xalloc_msg_memory_exhausted): Likewise.
1205         Move inclusions of gettext.h, error.h, exitfail.h to xalloc-die.c.
1206         (_, N_, xalloc_die): Move to xalloc-die.c.
1207         * userspec.c (parse_user_spaec): Use xstrdup rather than strdup,
1208         so that we needn't mess with xalloc_msg_memory_exhausted.
1209
1210         * sha1.h (sha1_ctx): Renamed from sha_ctx.
1211         (sha1_init_ctx): Renamed from sha_init_ctx.
1212         (sha1_process_block): Renamed from sha_process_block.
1213         (sha1_process_bytes): Renamed from sha_process_bytes.
1214         (sha1_finish_ctx): Renamed from sha_finish_ctx.
1215         (sha1_read_ctx): Renamed from sha_read_ctx.
1216         (sha1_stream): Renamed from sha_stream.
1217         (sha1_buffer): Renamed from sha_buffer.
1218         * sha1.c: Likewise.
1219
1220 2004-08-07  Paul Eggert  <eggert@cs.ucla.edu>
1221
1222         * canonicalize.h, cycle-check.h, stat-macros.h, strdup.h,
1223         strftime.h, xnanosleep.c: Merge from gnulib.
1224
1225 2004-08-05  Paul Eggert  <eggert@cs.ucla.edu>
1226
1227         Merge with gnulib and deal with some minor cleanups resulting.
1228
1229         * .cppi-disable: Change fnmatch.h to fnmatch_.h.
1230         * .cvsignore: Add fnmatch.h, poll.h, stdbool.h, sysexit.h.
1231         Remove safe-lstat.c, safe-lstat.h, safe-stat.c, safe-stat.h.
1232
1233         * backupfile.h, closeout.h, full-write.h, mbswidth.h, xalloc.h:
1234         Add extern "C" wrappers for C++.
1235
1236         * dirname.h (IS_ABSOLUTE_FILE_NAME): Port to DOS.
1237
1238         * gettime.c (gettime): Fall back on `time' if `gettimeofday'
1239         doesn't work.
1240         * settime.c: Include <unistd.h>, for stime (on Solaris 8, anyway).
1241         (ENOSYS): Define if not defined.
1242         (settime): Fall back on stime if it exists and settimeofday fails.
1243         But don't bother with fallbacks if a method fails with errno == EPERM.
1244
1245         * obstack.h: Add white space.
1246
1247         * printf-parse.c, printf-parse.h, vasnprintf.c: Merge changes from
1248         gnulib, but rewrite to avoid "xsize.h".
1249
1250 2004-08-04  Paul Eggert  <eggert@cs.ucla.edu>
1251
1252         * mountlist.c (SIZE_MAX): Define after including files, to avoid
1253         a collision on OpenBSD 3.4.
1254
1255         * fts.c (LONGEST_MODIFIER): New macro.
1256         (PRIuMAX) [!PRI_MACROS_BROKEN && !defined PRIuMAX]: New macro.
1257         (find_matching_ancestor): Use it for dev_t and ino_t.
1258
1259         * getndelim2.c: Sync from gnulib.
1260
1261         * error.c: Work around bug in OpenBSD 3.4 sterror_r: it
1262         sometimes returns a positive errno value even when it succeeds.
1263         (print_errno_message) [!LIBC]: Fall back on strerror if
1264         __strerror_r fails.
1265
1266 2004-08-02  Paul Eggert  <eggert@cs.ucla.edu>
1267
1268         * canonicalize.c (errno): Remove decl; we now assume C89 or better.
1269         * chown.c (errno): Likewise.
1270         * closeout.c (errno): Likewise.
1271         * dup-safer.c (errno): Likewise.
1272         * dup2.c (errno): Likewise.
1273         * exclude.c (errno): Likewise.
1274         * fopen-safer.c (errno): Likewise.
1275         * ftruncate.c (errno): Likewise.
1276         * full-write.c (errno): Likewise.
1277         * getcwd.c (errno): Likewise.
1278         * lchown.c (errno): Likewise.
1279         * memcoll.c (errno): Likewise.
1280         * nanosleep.c (errno): Likewise.
1281         * putenv.c (errno): Likewise.
1282         * rmdir.c (errno): Likewise.
1283         * same.c (errno): Likewise.
1284         * savedir.c (errno): Likewise.
1285         * setenv.c (errno): Likewise.
1286         * stat.c (errno): Likewise.
1287         * utime.c (errno): Likewise.
1288         * xgetcwd.c (errno): Likewise.
1289         * xmemcoll.c (errno): Likewise.
1290         * xreadlink.c (errno): Likewise.
1291         * xstrtol.c (errno): Likewise.
1292         * canonicalize.h (enum canonicalize_mode_t): Reformat comments to
1293         fit in 80 columns.
1294         * fileblocks.c (textutils_fileblocks_unused): Make it a typedef
1295         instead of an int, to save a few bytes in the object file.
1296         * getdate.y (lookup_word): Rewrite to avoid cast.
1297         * getloadavg.c: Include <stdbool.h>.
1298         (getloadavg_initialized): Use bool for booleans.
1299         * hard-locale.c (hard_locale): Return bool, not int.
1300         * hard-locale.h (hard_locale): Likewise.  Include <stdbool.h>.
1301         * hash.c (hash_string): Rewrite to avoid cast.
1302         * human.h: Use Autoconf-suggested pattern for inttypes and stdint.
1303         * strtiomax.c: Likewise.
1304         * xstrtol.h: Likewise.
1305         * nanosleep.c: Include stdbool.h.
1306         (rpl_nanosleep): Usee bool for booleans.
1307         * quotearg.c: Include stdbool.h.
1308         (quotearg_buffer_restyled): Use bool for booleans.
1309         * readtokens.c (readtoken): Rewrite to avoid casts.
1310         * same.c (same_name): Return bool, not int.
1311         * same.h (same_name): Likewise.  Include <stdbool.h>.
1312         * version-etc.c (version_etc_va): Use size_t for sizes.
1313         * xnanosleep.c: Include limits.h, stdbool.h.
1314         (CHAR_BIT): Remove.
1315         (timespec_subtract, xnanosleep): Use bool for booleans.
1316         * xstrtoimax.c: Just include xstrtol.h rather than rolling our
1317         own include pattern.
1318         * xstrtoumax.c: Likewise.
1319         * xstrtol.c (__xstrtol): Rewrite to avoid casts.
1320         * yesno.c: Include yesno.h first.
1321         (yesno): Return bool, not int.
1322         * yesno.h (yesno): Likewise.  Include <stdbool.h>.
1323
1324         * xstrtod.h (xstrtod): Return bool, not int.  Invert the
1325         sense of the boolean.  All uses changed.
1326         * xstrtod.c (xstrtod): Likewise.
1327         * nanosleep.c: Include stdbool.h.  Use bool for booleans.
1328
1329         * xgethostname.c: Don't include <sys/types.h> or "exit.h";
1330         no longer needed.
1331         (errno): Remove decl; we now assume C89 or better.
1332         Include unistd.h if available, for gethostname.
1333         (ENAMETOOLONG): Define to 0, not 9999, to avoid colliding with
1334         existing errno values if any.
1335         (gethostname): Remove decl, since unistd.h declares it (or doesn't,
1336         in which case it's an older system and it should just work).
1337         (xgethostname): Don't assume host name length is less than INT_MAX.
1338         Exit if malloc fails, just as the comment says.
1339
1340         * save-cwd.c: Include <stdbool.h>.
1341         (errno): Remove decl; we now assume C89 or better.
1342         (save_cwd): Use bool for booleans.
1343         (save_cwd, restore_cwd): Return -1 on failure, not 1, since we set
1344         errno on failure.
1345
1346         * readutmp.h (UT_USER): Parenthesize properly.
1347         (UT_USER_SIZE): New constant.
1348         (read_utmp): Don't assume that the number of users is less than
1349         INT_MAX.
1350         * readutmp.c (read_utmp): Likewise.
1351         Check for integer overflow in size calculations.
1352         Return -1 (not 1) on failure, since we set errno in that case.
1353
1354         * posixtm.c (posix_time_parse): Don't assume that the length of
1355         the string being parsed is <= UINT_MAX.
1356
1357         * mountlist.h (read_file_system_list): Accept bool flag, not int.
1358         * mountlist.c (read_file_system_list): Likewise.
1359         * mountlist.h: Include <stdbool.h>.
1360         * mountlist.c (errno): Remove decl; we now assume C89 or better.
1361         (xatoi): Remove; replaced by strtoul.  Hence device numbers can now
1362         go up to ULONG_MAX.
1363
1364         * isdir.c: Remove; no longer needed.
1365         * Makefile.am (libfetish_a_SOURCES): Remove isdir.c.
1366
1367         * fts_.h: Add an FSF copyright notice, since our changes are becoming
1368         nontrivial.
1369         * fts.c: Likewise.
1370         * fts_.h: Include stddef.h, for ptrdiff_t.
1371         (FTS.fts_nitems): Now size_t, not int, for hosts that allow more
1372         than INT_MAX entries in a directory.
1373         (FTS_ROOTPARENTLEVEL): Parenthesize properly.
1374         (FTSENT.fts_level): Now ptrdiff_t, not int, to allow recursing more
1375         than INT_MAX levels deep on 64-bit hosts.
1376         (FTSENT.fts_namelen): Now size_t, not u_short, to support hosts like
1377         the Hurd that don't have arbitrary limits on directory entry lengths.
1378         (FTSENT.fts_statp): Now an array, not a pointer, so that we don't
1379         have to play unportable games with pointer arithmetic.  Keep it array
1380         for the benefit of user code that assumes it is a pointer.
1381         * fts.c: Include stdint.h if available, as Autoconf suggests.
1382         (ALIGNBYTES, ALIGN): Remove; no longer needed now that fts_statp
1383         is an array.
1384         (fts_alloc, fts_palloc, fts_sort, fts_load, fts_build):
1385         Use size_t for sizes.
1386         (fts_stat, fts_safe_changedir, fts_debug, fts_read, fts_build,
1387         fts_palloc):
1388         Use bool when appropriate.
1389         (SIZE_MAX, TYPE_SIGNED): New macros.
1390         (fts_read): Use u_short for instructions.
1391         (fts_build): Use ptrdiff_t for levels.  Don't assume file name lengths
1392         fit into int.  Don't assume nlink_t is signed.
1393         (find_matching_ancestor): Don't assume dev, ino fit in int.
1394         (fts_stat): Use function prototype; required for bool arg.
1395         (fts_sort): Detect integer overflow in size calculations.
1396         (fts_alloc): Simplify allocation code, now that fts_statp is an array
1397         and not a pointer.
1398
1399         * fsusage.h: Include <stdbool.h>.
1400         (struct fs_usage): Use uintmax_t for block sizes, so that they're
1401         not limited to INT_MAX.
1402         Use bool for booleans.
1403         * fsusage.c: Use Autoconf-suggested pattern for inttypes and stdint.
1404         Include unistd.h, for lseek.
1405
1406         * fnmatch.c: Include <stdbool.h>.
1407         (errno): Remove decl; we now assume C89 or better.
1408         * fnmatch_loop.c (EXT, FCT): Use bool when appropriate.
1409         (FCT): Use size_t, not unsigned int, for sizes.
1410         (EXT): Use size_t, not int, for sizes.
1411
1412         * stripslash.c (strip_trailing_slashes): Now returns bool.
1413         * dirname.h (strip_trailing_slashes): Likewise.
1414         Include <stdbool.h>.
1415         * dirname.c (dir_name): Use bool when appropriate.
1416
1417         * argmatch.h (argmatch, __xargmatch_internal, argmatch_invalid):
1418         Use ptrdiff_t, not int, when counting arguments, to allow more
1419         than INT_MAX arguments.
1420         * argmatch.c: Likewise.  Use bool when appropriate.
1421
1422 2004-08-01  Paul Eggert  <eggert@cs.ucla.edu>
1423
1424         * safe-read.c (errno): Remove decl; we now assume C89 or better.
1425         (safe_rw): Don't work around Tru64 bug unless the bug symptoms
1426         manifest themselves.  This allows us to do proper reads and writes
1427         on other hosts, e.g., "dd" with a block size greater than 2**31.
1428
1429         * md5.c (UNALIGNED_P): Use size_t; in practice, this is just as
1430         good as uintptr_t in checking for alignments, and has fewer
1431         configuration hassles.
1432         * sha1.c (UNALIGNED_P): Likewise.
1433         * md5.h: Don't include <limits.h>.  Include <inttypes.h> if available,
1434         as it defines symbols like UINT32_MAX on Solaris 8.
1435         (md5_uint32): Assume uint32_t exists; Autoconf will define it
1436         otherwise (if the host has a 32-bit unsigned type, anyway).
1437         * memchr.c: Don't include inttypes.h or stdint.h.
1438         (UNALIGNED_P): Remove.
1439         (__memchr): Use size_t, not uintptr_t, to test alignment.
1440         * memrchr.c: Likewise, for __memrchr.
1441
1442 2004-07-30  Paul Eggert  <eggert@cs.ucla.edu>
1443
1444         * makepath.h: Include <stdbool.h>.
1445         (make_path, make_dir): Use bool, not int, since we're not setting
1446         errno.
1447         Use mode_t for modes, not int.  All uses changed.
1448         * makepath.c: Likewise.
1449         (errno): Remove decl; no longer needed since we assume C89.
1450
1451 2004-07-29  Paul Eggert  <eggert@cs.ucla.edu>
1452
1453         * modechange.c: Include <stdbool.h>.
1454         (mode_compile): Use bool when appropriate.
1455
1456         * memchr.c (UNALIGNED_P): Use sizeof, not alignof, for better
1457         performance on m68k-linux.  Reported by Andreas Schwab in
1458         <http://lists.gnu.org/archive/html/bug-coreutils/2004-07/msg00104.html>.
1459         * memrchr.c (UNALIGNED_P): Likewise.
1460
1461 2004-07-28  Paul Eggert  <eggert@cs.ucla.edu>
1462
1463         * userspec.c: Include <stdbool.h>, "inttostr.h".
1464         (V_STRDUP): Don't assume the string's length fits in int.
1465         (ISDIGIT): unsigned -> unsigned int
1466         (is_number): Define only ifdef __DJGPP__; not needed elsewhere.
1467         Use bool instead of int where appropriate.
1468         Do not allow empty strings.
1469         (parse_user_spec): Parse numbers as decimal integers, even if
1470         they have a leading 0.  Don't assume uids and gids fit in int.
1471
1472         * memchr.c: Include <stddef.h>, not <stdlib.h> and <sys/types.h>.
1473         (LONG_MAX_32_BITS): Remove.
1474         Include <inttypes.h> and <stdint.h> if available.
1475         (alignof, UNALIGNEDP): New macro, portable to all C89 hosts.
1476         (__memchr): Don't assume unsigned long int is either 4 or 8 bytes;
1477         let it be any number of bytes greater than or equal to 4.
1478         * memrchr.c: Likewise, with __memrchr.
1479
1480         * md5.h: Include <stdint.h> if HAVE_STDINT_H || _LIBC, not
1481         ifdef _LIBC.
1482         (md5_uint32): Use uint32_t if available.  Simplify fallback ifdefs.
1483         * md5.c: Don't include <sys/types.h> or <stdlib.h>; <stddef.h>
1484         suffices with C89 or better.
1485         (alignof): New macro, portable to all C89 hosts.
1486         (UNALIGNED): Use it.  Use uintptr_t if available, and assume
1487         everything is unaligned otherwise; this is more portable than
1488         assuming 'unsigned long int' will always work.
1489         * sha1.c: Likewise.
1490
1491         * getugroups.c: Include <errno.h>.
1492         (EOVERFLOW): Define if not defined.
1493         (getgroups): Return -1 with errno=EOVERFLOW if an integer overflow
1494         occurs.
1495
1496 2004-07-27  Paul Eggert  <eggert@cs.ucla.edu>
1497
1498         * euidaccess.c [HAVE_LIBGEN_H]: Include <libgen.h>, for
1499         eaccess on Solaris and SVR4-like systems.
1500         (euidaccess): Use HAVE_EACCESS, not HAVE_DECL_EACCESS.
1501
1502         cycle-check integer overflow fixup.
1503
1504         * cycle-check.h: Remove now-inaccurate comment about the files
1505         you need to include first.  You don't need to include any files
1506         other than the usual config.h.
1507         Include <inttypes.h> and <stdint.h> if available, for uintmax_t.
1508         Remove 'struct stat;' not needed since we know sys/stat.h has
1509         been included by dev-ino.h.
1510         (struct cycle_check_state): Change chdir_counter to uintmax_t,
1511         not size_t, since it isn't limited by object sizes.
1512         Change magic from long unsigned int to int; that's good enough
1513         for our use.
1514         * cycle-check.c (is_zero_or_power_of_two): Renamed from
1515         is_power_of_two, to reflect better what it really does.
1516         All uses changed.  Arg is now uintmax_t, not unsigned int
1517         (it should have been unsigned long int -- that was a bug).
1518         (cycle_check): Check for integer overflow in cycle count,
1519         and report a cycle if that happens, as it must be a cycle
1520         by this point.
1521
1522         backupfile.c rewrite to avoid arbitrary limits on lengths of
1523         numeric backup extensions.
1524
1525         * addext.c: Remove; no longer needed.
1526         * Makefile.am (libfetish_a_SOURCES): Remove addext.c.
1527         * backupfile.h (addext): Remove decl.
1528         * backupfile.c: Include "backupfile.h" first.
1529         Include errno.h, stdbool.h, limits.h, unistd.h, xalloc.h.
1530         (CLOSEDIR, INT_STRLEN_BOUND): Remove.
1531         (pathconf) [! (HAVE_PATHCONF && defined _PC_NAME_MAX)]: New macro.
1532         (_POSIX_NAME_MAX) [!defined _POSIX_NAME_MAX]: New macro.
1533         (NAME_MAX_MAXIMUM): New macro.  Unlike the old addext.c, we
1534         also look at _XOPEN_NAME_MAX, for better performance on modern
1535         hosts that support only file names of length 255 or more.
1536         (ISDIGIT): unsigned -> unsigned int
1537         (max_backup_version, version_number): Remove.
1538         (check_extension): New function.  Similar to the old addext, but
1539         static, assumes that the extension has already been added,
1540         and a bit more careful on DOS hosts.
1541         (numbered_backup): New function.  It does what max_backup_version
1542         and version_number used to do, but it doesn't use integer arithmetic
1543         to calculate extensions so it doesn't overflow.
1544         (find_backup_file_name): Rewrite to use these new functions.
1545         This has a new optimization: we needn't call pathconf if the
1546         new numbered backup name has the same length as the old.
1547         Also, use xmalloc rather than malloc, so that the caller
1548         needn't worry about memory exhaustion.
1549
1550 2004-07-25  Paul Eggert  <eggert@cs.ucla.edu>
1551
1552         * euidaccess.c [!defined LIBC]: Included group-member.h, stat-macros.h.
1553         (S_IXUSR, S_IXGRP, S_IXOTH, S_IROTH, S_IWOTH, S_IXOTH):
1554         Remove; now done by stat-macros.h.
1555         (NGROUPS_MAX, group_member): Remove; now done by group-member.h.
1556         No need to include <limits.h>.
1557         (errno): Remove decl; we now assume C89 or better.
1558         (access, getuid, getgid, geteuid, getegid, stat) [defined _LIBC]:
1559         New macros.
1560         (uid, gid, have_ids): Remove these static variables.
1561         They weren't accurate for programs that also invoked setreuid etc.
1562         (euidaccess) [defined EFF_ONLY_OK || defined ACC_SELF ||
1563         HAVE_DECL_EACCSS]: Use builtin substitutes.
1564         [defined _LIBC]: Ignore __libc_enable_secure; it's not a
1565         correct optimization for programs run as root that later
1566         invoke setreuid.
1567         [no builtin substitutes && HAVE_DECL_SETREGID &&
1568         PREFER_NONREENTRANT_EUIDACCESS]:
1569         Use setreuid+setregid to get the correct answer.
1570         [no builtin substitutes && ! (HAVE_DECL_SETREGID &&
1571         PREFER_NONREENTRANT_EUIDACCESS)]:
1572         Don't assume that the stat macros have their historical values,
1573         as POSIX doesn't require this.
1574         [defined TEST]: Include <stdlib.h>; don't include errno.h
1575         twice; include <error.h> rather than "error.h".
1576
1577 2004-07-23  Paul Eggert  <eggert@cs.ucla.edu>
1578
1579         * Makefile.am (libfetish_a_SOURCES): Add fcntl-safer.h,
1580         open-safer.c.
1581         * fcntl-safer.h, open-safer.c: New files.
1582
1583 2004-07-12  Paul Eggert  <eggert@cs.ucla.edu>
1584
1585         * c-strtod.c (STRTOD_L): New macro.
1586         (C_STRTOD) [defined LC_ALL_MASK]: Use it, so that the
1587         code is reentrant on platforms that have strtod_l.
1588
1589         * getloadavg.c: Include <errno.h>, <stdio.h>, <stdlib.h> even
1590         if HAVE_GETLOADAVG is defined, so that the test program can work.
1591         (errno): Remove declaration; not needed in C89 or later.
1592         Include "c-strtod.h".
1593         Do not include locale.h or define setlocale; no longer needed.
1594         Include <limits.h>.
1595         (INT_STRLEN_BOUND): New macro.
1596         (getloadavg): Use it to compute buffer size.
1597         Don't assume that buffer will be properly terminated by 'read'.
1598         Use c_strtod instead of setlocale.
1599         (main) [defined TEST]: Return int, not void.
1600
1601 2004-07-11  Paul Eggert  <eggert@cs.ucla.edu>
1602
1603         * Makefile.am (libfetish_a_SOURCES): Add c-strtold.c.
1604         * c-strtold.c: New file.
1605         * c-strtod.c: Include <config.h> first.
1606         (C_STRTOD, DOUBLE, STRTOD): New macros.
1607         (c_strtod): Use them.
1608         * c-strtod.h (c_strtold): New decl.
1609
1610 2004-07-07  Jim Meyering  <jim@meyering.net>
1611
1612         Don't infloop when MAXSYMLINKS is not defined.
1613         Detect symlink loops much earlier (albeit lazily) on systems
1614         with MAXSYMLINKS defined to a large value.
1615
1616         * canonicalize.c: Include "cycle-check.h".
1617         (canonicalize_filename_mode): Don't try to detect loops by counting
1618         symlink-hops.  Instead, use the cycle-check module.
1619
1620         * cycle-check.h: Include stdbool.h.
1621         Forward-declare `struct stat'.
1622
1623         * canonicalize.c (canonicalize_filename_mode): Remove do-while(0) loop.
1624         Replace each corresponding `break' stmt with `continue'.
1625
1626 2004-07-06  Jim Meyering  <jim@meyering.net>
1627
1628         * canonicalize.c: Include "stat-macros.h".
1629         (canonicalize_filename_mode): Remove #ifdef S_ISLNK, now that
1630         S_ISLNK is guaranteed to be defined (via stat-macros.h).
1631
1632 2004-04-03  Dmitry V. Levin  <ldv@altlinux.org>
1633
1634         * Makefile.am (libfetish_a_SOURCES): Add canonicalize.c
1635         unconditionally.
1636         * canonicalize.h (canonicalize_mode_t): New type.
1637         * canonicalize.c: Include "file-type.h".
1638         (canonicalize_filename_mode): New function, based on
1639         canonicalize_file_name, supports three canonicalize modes.
1640         (canonicalize_file_name)
1641         [!HAVE_CANONICALIZE_FILE_NAME && !HAVE_RESOLVEPATH]: Use it.
1642
1643 2004-07-05  Jim Meyering  <jim@meyering.net>
1644
1645         * path-concat.c (path_concat): Improve comment.  From Paul Eggert.
1646
1647 2004-07-02  Paul Eggert  <eggert@cs.ucla.edu>
1648
1649         * canonicalize.c (canonicalize_file_name): Assume that path_concat
1650         never returns NULL.
1651         * path-concat.c (mempcpy): Don't define if a system header defines it.
1652         Don't include stdio.h, stdlib.h, unistd.h, strdup.h.
1653         (longest_relative_suffix): New function.
1654         (path_concat): Use it.  Assume first argument is not NULL.
1655         Port to DOS.  Omit redundant separators.
1656         Report an error instead of returning NULL.
1657         Use mempcpy instead of memcpy.
1658         (xpath_concat): Remove: not declared or used.
1659
1660 2004-06-30  Paul Eggert  <eggert@cs.ucla.edu>
1661
1662         * dirname.h (FILE_SYSTEM_PREFIX_LEN): Renamed from
1663         FILESYSTEM_PREFIX_LEN.  All uses changed.
1664         * mountlist.h (read_file_system_list): Renamed from
1665         read_filesystem_list.  All definitions and uses changed.
1666
1667 2004-06-24  Jim Meyering  <jim@meyering.net>
1668
1669         * obstack.h (obstack_base): Fix parentheses.  From Paul Eggert.
1670
1671 2004-06-20  Jim Meyering  <jim@meyering.net>
1672
1673         * obstack.h (obstack_base): Cast to (void *), per documentation.
1674
1675         * yesno.h: New file.
1676         * yesno.c: Include "yesno.h".
1677         * Makefile.am (libfetish_a_SOURCES): Add yesno.h.
1678
1679 2004-06-19  Jim Meyering  <jim@meyering.net>
1680
1681         * filemode.c: Remove all S_IS* and S_IF* definitions.
1682         Instead, just include "stat-macros.h".
1683         * stat.c: Likewise.
1684         * rmdir.c: Likewise.
1685         * makepath.c: Likewise.
1686         * lchown.c: Likewise.
1687         * isdir.c: Likewise.
1688         * canonicalize.c: Likewise.
1689
1690         Add S_IS* definitions from filemode.c.
1691         * stat-macros.h (S_ISCTG): Define to zero if not already defined.
1692         (S_ISOFD): Likewise.
1693         (S_ISOFL): Likewise.
1694
1695 2004-06-11  Paul Eggert  <eggert@cs.ucla.edu>
1696
1697         * readutmp.c (extract_trimmed_name): Don't apply strchr to a
1698         non-string; this leads to undefined behavior.
1699
1700 2004-05-18  Paul Eggert  <eggert@cs.ucla.edu>
1701
1702         * fts.c (fts_stat, fts_alloc): Always allocate and use a struct
1703         stat, even if the user isn't interested in the results.
1704         This prevents a core dump in cycle_check when FTS_NOSTAT is set.
1705         * lchown.c (lchown): Return EOPNOTSUPP if not supported; this
1706         is what POSIX-2004 specifies.
1707         * lchown.h (EOPNOTSUPP): Define if not defined.
1708         (ENOSYS): Remove.
1709
1710 2004-06-06  Jim Meyering  <jim@meyering.net>
1711
1712         * getdate.y: Update from gnulib.
1713
1714 2004-05-25  Paul Eggert  <eggert@cs.ucla.edu>
1715
1716         * xreadlink.c: Include xreadlink.h first, to catch .h file
1717         dependency problems.
1718         (xreadlink): Accept new arg SIZE, for efficiency.
1719         All decls and uses changed.
1720         * xreadlink.h: Include <stddef.h>, for size_t.
1721         * canonicalize.c (canonicalize_file_name): Update use of xreadlink.
1722
1723 2004-06-01  Jim Meyering  <jim@meyering.net>
1724
1725         * xmalloc.c: Update from gnulib.
1726
1727 2004-05-30  Jim Meyering  <jim@meyering.net>
1728
1729         * alloca_.h: Remove trailing blank.
1730
1731 2004-05-29  Jim Meyering  <jim@meyering.net>
1732
1733         * dirname.h (IS_ABSOLUTE_FILE_NAME, IS_RELATIVE_FILE_NAME): Define.
1734
1735         * calloc.c: New file.
1736
1737 2004-05-21  Jim Meyering  <jim@meyering.net>
1738
1739         * alloca.c, alloca_.h, fnmatch.c: Update from gnulib.
1740         * localcharset.c, regex.c: Likewise.
1741
1742 2004-05-20  Jim Meyering  <jim@meyering.net>
1743
1744         * obstack.c, obstack.h: Update from gnulib.
1745
1746 2004-05-16  Paul Eggert  <eggert@cs.ucla.edu>
1747
1748         * getline.c, getndelim2.c, getndelim2.h: Sync with gnulib.
1749
1750 2004-05-11  Jim Meyering  <jim@meyering.net>
1751
1752         Prior to this change, rm required read access to the current
1753         directory on most systems (ones with the fchdir function).
1754
1755         * save-cwd.c (save_cwd) [HAVE_FCHDIR]: If opening `.' read-only
1756         fails, try write-only, and finally, resort to using xgetcwd.
1757
1758 2004-05-07  Jim Meyering  <jim@meyering.net>
1759
1760         Update from gnulib.
1761         * obstack.c (_): Define only if not already defined.
1762         * obstack.h (obstack_finish): Rename local: s/value/__value/.
1763
1764 2004-05-03  Jim Meyering  <jim@meyering.net>
1765
1766         * lchown.c (lchown) [CHOWN_MODIFIES_SYMLINK]: Just call chown.
1767
1768 2004-05-01  Jim Meyering  <jim@meyering.net>
1769
1770         * chown.c (rpl_chown) [CHOWN_FAILS_TO_HONOR_ID_OF_NEGATIVE_ONE]:
1771         Wrap old code with this conditional.
1772         [CHOWN_MODIFIES_SYMLINK]: Try to work around a chown
1773         function that does not dereference symlinks.
1774
1775 2004-04-18  Paul Eggert  <eggert@twinsun.com>
1776
1777         * nanosleep.c (suspended): Change its type from int to
1778         sig_atomic_t volatile.
1779         (first_call): Make it private to rpl_nanosleep, and have it
1780         be zero initially as that's a bit faster.
1781         (my_usleep): Round up fractional times instead of truncating them,
1782         as this is the usual meaning for 'sleep'.
1783
1784 2004-04-20  Jim Meyering  <jim@meyering.net>
1785
1786         * getndelim2.c (getndelim2): Upon realloc failure, don't leak memory.
1787
1788 2004-04-18  Jim Meyering  <jim@meyering.net>
1789
1790         * readutmp.c (read_utmp) [UTMP_NAME_FUNCTION]: Upon realloc failure,
1791         don't leak memory and do call END_UTMP_ENT.
1792
1793 2004-04-13  Jim Meyering  <jim@meyering.net>
1794
1795         * quotearg.c, quotearg.h: Remove trailing blanks.
1796
1797 2004-04-12  Jim Meyering  <jim@meyering.net>
1798
1799         * inttostr.h: Update from gnulib.
1800
1801 2004-03-27  Paul Eggert  <eggert@twinsun.com>
1802
1803         * utimecmp.c, utimecmp.h: New files.
1804         * Makefile.am (libfetish_a_SOURCES): Add utimecmp.c, utimecmp.h.
1805
1806 2004-04-09  Jim Meyering  <jim@meyering.net>
1807
1808         * stat-macros.h: New file, with contents from file-type.h
1809         and coreutils' system.h.
1810         * Makefile.am (libfetish_a_SOURCES): Add stat-macros.h.
1811         * file-type.c: Include "stat-macros.h".
1812         * file-type.h (file_type): Move all macro defiitions to new file,
1813         stat-macros.h.
1814
1815 2004-03-30  Paul Eggert  <eggert@twinsun.com>
1816
1817         * cloexec.c, cloexec.h, config.charset, file-type.c, file-type.h:
1818         * getloadavg.c, getndelim2.c, getusershell.c, group-member.c:
1819         * human.c, path-concat.c, printf-args.c, printf-args.h:
1820         * quotearg.c, quotearg.h, setenv.c, strdup.c:
1821         * userspec.c, userspec.h, vasprintf.c: Sync from gnulib.
1822
1823         * allocsa.c, allocsa.h, strdup.h: New files, from gnulib.
1824         * Makefile.am (libfetish_a_SOURCES): Add allocsa.c, allocsa.h,
1825         and strdup.h.
1826
1827 2004-03-30  Jim Meyering  <jim@meyering.net>
1828
1829         * getloadavg.c: Merge changes from emacs (via gnulib).
1830
1831 2004-03-28  Paul Eggert  <eggert@twinsun.com>
1832
1833         Fix some gotchas encountered when porting to Solaris 8, using
1834         the Forte 6u2 compiler.
1835
1836         * canonicalize.c [HAVE_UNISTD_H]: Include <unistd.h>,
1837         for resolvepath declaration.
1838         * fts.c: Include dirfd.h, for dirfd.
1839
1840 2004-02-25  Paul Eggert  <eggert@twinsun.com>
1841
1842         * human.c (humblock): Support BLOCKSIZE as well as BLOCK_SIZE.
1843
1844 2004-03-23  Paul Eggert  <eggert@twinsun.com>
1845
1846         * readtokens0.c (readtokens0): Return true on success rather
1847         than on failure.  All callers changed.  This also happens to fix a
1848         portability bug on pre-C99 hosts, where (bool) INTEGER sometimes
1849         returns false even when INTEGER is nonzero.
1850
1851 2004-03-23  Jim Meyering  <jim@meyering.net>
1852
1853         * Makefile.am (libfetish_a_SOURCES): Add getopt_int.h.
1854         * getopt_int.h: New file, from gnulib.
1855         * getopt.c, getopt.h, getopt1.c: Sync from gnulib.
1856         * getopt.c, getopt.h: Remove space(s) before TAB.
1857
1858         * mbswidth.c, mbswidth.h: Sync from gnulib.
1859
1860 2004-03-21  Jim Meyering  <jim@meyering.net>
1861
1862         * readtokens0.c, readtokens0.h: New files.
1863         * Makefile.am (libfetish_a_SOURCES): Add readtokens0.c and readtokens0.h
1864
1865         * readtokens.c (readtoken): Don't leak 64 bytes when reading
1866         an empty input stream.
1867
1868         * readtokens.c: Include <stdbool.h>.
1869         (readtoken): Use `size_t' rather than int/long.
1870         All callers adjusted.
1871         Use `bool' rather than `int' where appropriate.
1872         Use memset rather than an explicit loop.
1873         Use x2nrealloc rather than xrealloc.
1874         Allow the use of `\0' as a delimiter.
1875         (readtokens): Likewise.
1876         * readtokens.h (readtoken, readtokens): Update prototypes.
1877
1878 2004-02-29  Paul Eggert  <eggert@twinsun.com>
1879
1880         * getdate.h: Include stdbool.h, and timespec.h instead of
1881         the usual <time.h> dance.
1882         (get_date): Change signature to support fractional time stamps.
1883         All callers changed.
1884         * getdate.y: Include "getdate.h" first, as we can now
1885         assume C89 and don't need to worry about 'const'.
1886         Similarly, include "unlocked-io.h" near start, not in middle.
1887         Include <limits.h>.
1888         (textint.value): Use long int rather than int.
1889         (textint.digits): Use size_t rather than int.
1890         (BILLION, LOG10_BILLION): New constants.
1891         (parser_control): New member rel_ns.  Members day_ordinal,
1892         time_zone, month, day, hour, minutes, rel_year, rel_month,
1893         rel_day, rel_hour, rel_minutes, rel_seconds
1894         are now long int, not int.  Member seconds is now struct timespec,
1895         not int.  New member timespec_seen.  Members dates_seen, days_seen,
1896         local_zones_seen, rels_seen, times_seen, zones_seen are now size_t,
1897         not int.
1898         (%union.intval): Now long int, not int.
1899         New member timespec.
1900         (tSDECIMAL_NUMBER, tUDECIMAL_NUMBER): New tokens.
1901         (seconds, signed_seconds, unsigned_seconds): New nonterminals.
1902         (spec): Now is a timespec or an item list.
1903         (timespec, items): New nonterminals.
1904         (time, rel, relunit, number, get_date):
1905         Add support for fractional seconds.
1906         (time): Fix bug: seconds weren't cleared in "00:00 +0000" syntax.
1907         (gmtime, localtime, mktime): Remove decls; not needed with C89.
1908         (to_hour): First arg is now long int, not int.
1909         (to_year): Returns long int, not int.
1910         Don't treat year -70 like 70.
1911         (tm_diff): Returns long int, not int.
1912         (lookup_word): Use bool instead of int when appropriate.
1913         (yylex): Use size_t for count, not int.
1914         Detect overflow when parsing large integer constants.
1915         Add support for fractions.
1916         (get_date): Make pointers 'const' if possible.
1917         Use more-portable code to detect integer overflow.
1918         (main) [TEST]: Adjust to above changes.  Test for localtime failure.
1919         Don't use ctime; it's not reliable if the year has >4 digits.
1920
1921 2004-03-15  Jim Meyering  <jim@meyering.net>
1922
1923         `date --date="21:04 +0100" +%S' would print the seconds value
1924         from the current time, rather than `00'.
1925         * getdate.y: For a date string like `10:23 +0100',
1926         set the number of seconds to zero.  Reported by Marc Haber.
1927
1928 2004-03-04  Jim Meyering  <jim@meyering.net>
1929
1930         * cloexec.c (set_cloexec_flag) [ ! (F_GETFD && F_SETFD)]:
1931         Return true, not false.
1932
1933 2004-03-03  Paul Eggert  <eggert@twinsun.com>
1934
1935         * cloexec.c: Include "cloexec.h" first, and <unistd.h> before <fcntl.h>.
1936         (set_cloexec_flag): Use bool for booleans.  All uses changed.
1937         If F_GETFD returns a negative number (not just -1), report a
1938         failure.  Don't use F_SETFD if the flags are already right.
1939         Don't report a failure with F_SETFD unless it returns -1.
1940         * cloexec.h: Include <stdbool.h>.
1941         Adjust signature to use `bool' rather than `int'.
1942         * getloadavg.c (getloadavg): Use `true', not `1'.
1943
1944 2004-03-02  Dmitry V. Levin  <ldv@altlinux.org>
1945
1946         * cloexec.c: New file.
1947         The set_cloexec_flag implementation imported from GNU C Library
1948         Reference Manual.
1949         * cloexec.h: New file.
1950         * getloadavg.c: Include "cloexec.h".
1951         (getloadavg): Use set_cloexec_flag instead of manual fcntl call.
1952         * Makefile.am (libfetish_a_SOURCES): Add cloexec.c, cloexec.h.
1953
1954 2004-02-23  Paul Eggert  <eggert@twinsun.com>
1955
1956         * userspec.c: Don't include "posixver.h".
1957         (parse_user_spec): Fall back on USER.GROUP parsing, regardless
1958         of POSIX version, as POSIX 1003.1-2001 allows that behavior as a
1959         compatible extension.  Simplify code by removing a boolean int
1960         that was always nonzero if a string was nonnull.
1961
1962 2004-02-05  Jim Meyering  <jim@meyering.net>
1963
1964         * timespec.h (ST_TIME_CMP_NS, ST_TIME_CMP): Define.
1965         (ATIME_CMP, CTIME_CMP, MTIME_CMP, TIMESPEC_NS): Likewise.
1966         From coreutils' system.h.
1967
1968 2004-01-29  Jim Meyering  <jim@meyering.net>
1969
1970         * mountlist.c [HAVE_SYS_UCRED_H]: Include grp.h before sys/ucred.h.
1971
1972 2004-01-21  Paul Eggert  <eggert@twinsun.com>
1973
1974         * argmatch.c (ARGMATCH_DIE) [! defined ARGMATCH_DIE]:
1975         Include "exitfail.h", and use exit_failure rather than EXIT_FAILURE.
1976         * argmatch.h: Comment fix to match the above.
1977         * long-options.c (parse_long_options): Use prototype
1978         for usage function arg.  Pass it EXIT_SUCCESS rather than 0,
1979         for clarity.
1980         * obstack.c (obstack_exit_failure) [!defined _LIBC]:
1981         Now a macro referring to exit_failure, instead of a separate
1982         variable.  Include "exitfail.h" to get it.
1983         * xstrtol.h: Include "exitfail.h".
1984         (STRTOL_FATAL_ERROR): Exit with status exit_failure, not 2.
1985
1986 2004-01-21  Jim Meyering  <jim@meyering.net>
1987
1988         * mktime.c (__mktime_internal) [!_LIBC]: Define to mktime_internal
1989         so as not to conflict with a different-sized __mktime_internal
1990         function in GNU libc.
1991
1992 2004-01-16  Jim Meyering  <jim@meyering.net>
1993
1994         Merge from gnulib.
1995         * localcharset.c: Test HAVE_DECL_GETC_UNLOCKED,
1996         rather than HAVE_GETC_UNLOCKED.
1997
1998 2003-10-08  Paul Eggert  <eggert@twinsun.com>
1999
2000         Merge from gnulib.
2001
2002         * unlocked-io.h: Include <stdio.h>, so that the caller
2003         doesn't have to include <stdio.h> before us.
2004         (clearerr_unlocked, feof_unlocked, ferror_unlocked,
2005         fflush_unlocked, fgets_unlocked, fputc_unlocked, fputs_unlocked,
2006         fread_unlocked, fwrite_unlocked, getc_unlocked, getchar_unlocked,
2007         putc_unlocked, putchar_unlocked): Define to the unlocked counterpart
2008         if not declared, so that we can use getpass.c code from libc without
2009         rewriting it.
2010         (flockfile, ftrylockfile, funlockfile): New macros.
2011
2012 2004-01-14  Paul Eggert  <eggert@twinsun.com>
2013
2014         Merge from gnulib.
2015
2016         * fnmatch_loop.c (ALLOCA_LIMIT): Remove macro, which collided
2017         with like-named macro in fnmatch.c.
2018         (EXT): Use an internal constant instead.
2019
2020         Merge fnmatch patches from glibc.
2021         * fnmatch.c (mbsinit): Remove define.
2022         Add libc_hidden_ver (__fnmatch, fnmatch).
2023         * fnmatch_loop.c (FCT): Cast to int32_t and UCHAR when appropriate.
2024         Adjust to renaming of collseq_table_lookup to __collseq_table_lookup.
2025
2026 2003-11-24  Paul Eggert  <eggert@twinsun.com>
2027
2028         Merge from gnulib.
2029
2030         * alloca.c: Remove dependency on xalloc module.
2031         (xalloc_die): Remove.
2032         (memory_full) [!defined emacs]: New macro.
2033         [!defined emacs]: Don't include xalloc.h.
2034         (alloca): Invoke memory_full, not xalloc_die, if malloc fails or
2035         address arithmetic overflows.  Change datatypes a bit to avoid
2036         unnecessary casts.
2037
2038 2004-01-14  Paul Eggert  <eggert@twinsun.com>
2039
2040         * posixver.c: Include posixver.h.
2041
2042 2004-01-12  Jim Meyering  <jim@meyering.net>
2043
2044         * posixver.c (DEFAULT_POSIX2_VERSION): Use definition of new,
2045         optional configure-time default.
2046
2047 2004-01-10  Jim Meyering  <jim@meyering.net>
2048
2049         * version-etc.c (version_etc_copyright): Update copyright date.
2050
2051 2003-12-20  Jim Meyering  <jim@meyering.net>
2052
2053         * fts.c [!_LIBC]: Undefine, then define-away __P.
2054
2055 2003-12-19  Jim Meyering  <jim@meyering.net>
2056
2057         Rewrite fts to use a hash table or O(1)-mem cycle-detection
2058         code rather than the tree-based tsearch functions.
2059         * fts_.h: Include hash.h and cycle-check.h.
2060         (FTS_TIGHT_CYCLE_CHECK): New value.
2061         (FTS_OPTIONMASK): Adjust to include the new value.
2062         (FTS_NAMEONLY, FTS_STOP): Increase to allow room for new value.
2063         (struct FTS) [active_dir_ht]: New member.  Replaces fts_dir_signatures.
2064         (struct FTS) [cycle_state]: New member.
2065         * fts.c: Don't include <search.h>.
2066         [HAVE_INTTYPES_H]: Include <inttypes.h>.
2067         (tdestroy, tfind, tsearch): Remove definitions.
2068         (struct Active_dir): Rename from `known_object'.
2069         (AD_compare, AD_hash): New functions.
2070         (enter_dir, leave_dir): Rewrite to manipulate a hash table
2071         rather than a tree.
2072         (fts_open): Initialize hash table or cycle_state buffer.
2073         (free_node): Remove function.
2074         (find_matching_ancestor): Renamed/rewritten from look_up_active_dir.
2075         (fts_cross_check): Adapt to use new data structure.
2076
2077         * Makefile.am (libfetish_a_SOURCES): Remove search_.h.
2078         (DISTCLEANFILES): Remove definition.
2079
2080 2003-12-18  Jim Meyering  <jim@meyering.net>
2081
2082         Rewrite cycle detection code to work properly.
2083         Add some framework (compiled out by default) to test it.
2084         * fts.c (Dprintf, ENTER_DIR, LEAVE_DIR): Define.
2085         (add_object): Remove function.  Rewritten as...
2086         (enter_dir): New function.
2087         (leave_dir, free_node): New functions.
2088         (fts_read): Ensure that we call ENTER_DIR or LEAVE_DIR,
2089         as appropriate, before returning.
2090         (look_up_active_dir, fts_cross_check) [FTS_DEBUG]: New functions.
2091         (fts_stat): Don't perform the cycle check here.
2092         Now it's done via enter_dir.
2093
2094 2003-12-12  Jim Meyering  <jim@meyering.net>
2095
2096         * fts_.h (FTS) [fts_dir_signatures]: Add comment.
2097
2098 2003-12-03  Paul Eggert  <eggert@twinsun.com>
2099
2100         * getgroups.c (getgroups): xmalloc takes one argument, not two.
2101         Bug reported by Alfred M. Szmidt.
2102
2103 2003-12-02  Jim Meyering  <jim@meyering.net>
2104
2105         * Makefile.am (libfetish_a_SOURCES): Reflect sha -> sha1 renaming.
2106
2107         * sha1.c: File renamed from sha.c.
2108         * sha1.h: File renamed from sha.h.
2109         Use SHA1_H, not _SHA_H in #ifndef condition.
2110
2111         * sha.c: Add FSF Copyright.
2112         * sha.h: Correct stale references to MD5 and `16 bytes'.
2113         Patch by Ulrich Drepper.
2114
2115         * sha.h: Add FSF Copyright.  Remove reference to Scott Miller,
2116         since this file is now nearly identical to md5.h.
2117
2118         * md5.h (rol) [__GNUC__ && __i386__]: Don't use `asm' code.  These
2119         days, gcc-3.x does better all by itself.  Patch from Dean Gaudet:
2120         http://mail.gnu.org/archive/html/bug-coreutils/2003-11/msg00144.html
2121
2122 2003-11-29  Jim Meyering  <jim@meyering.net>
2123
2124         * c-strtod.c (c_strtod): Save and restore original LC_NUMERIC setting,
2125         in case it was different from the environment-derived value.
2126         Patch by Paul Eggert.
2127         Include "xalloc.h" for declaration of xstrdup.
2128
2129 2003-11-24  Paul Eggert  <eggert@twinsun.com>
2130
2131         Parse floating-point operands and options in the C locale.
2132         POSIX requires this for printf, and we might as well be
2133         consistent elsewhere (tail, sleep, seq).
2134
2135         * Makefile.am (libfetish_a_SOURCES): Add c-strtod.c, c-strtod.h.
2136         * c-strtod.c, c-strtod.h: New files.
2137         * xstrtod.h (xstrtod): Accept an extra arg, specifying the
2138         conversion function.
2139         * xstrtod.c (xstrtod): Likewise.  All callers changed to
2140         include c-strtod.h and use c_strtod.  Don't include stdlib.h; no
2141         longer needed.
2142
2143         * xnanosleep.c: Don't include xstrtod.h; it's not needed.
2144
2145 2003-11-22  Jim Meyering  <jim@meyering.net>
2146
2147         * xmalloc.c (x2nrealloc_inline): Fix typos in comments: s/size/size_t/.
2148
2149 2003-11-21  Jim Meyering  <jim@meyering.net>
2150
2151         * xreadlink.c (xreadlink): Correct outdated comment.
2152
2153 2003-11-17  Jim Meyering  <jim@meyering.net>
2154
2155         On systems without utime and without a utimes function capable of
2156         dealing with a NULL struct utimbuf* argument, this utime replacement
2157         could -- in unusual circumstances -- leak a file descriptor.
2158         * utime.c: Include <unistd.h> and <errno.h>.
2159         (utime_null): Be sure to close `fd' and to preserve errno.
2160         Reported by Geoff Collyer via Arnold Robbins.
2161
2162 2003-11-13  Jim Meyering  <jim@meyering.net>
2163
2164         * xalloc.h, xstrtol.c: Update from gnulib.
2165
2166 2003-11-11  Jim Meyering  <jim@meyering.net>
2167
2168         * ftw.c, ftw_.h: Remove files.  No longer used.
2169
2170 2003-11-09  Jim Meyering  <jim@meyering.net>
2171
2172         * root-dev-ino.c, root-dev-ino.h: New files.
2173         * Makefile.am (libfetish_a_SOURCES): Add root-dev-ino.c root-dev-ino.h.
2174
2175         * dev-ino.h: Include <sys/types.h> and <sys/stat.h>.
2176
2177 2003-11-06  Jim Meyering  <jim@meyering.net>
2178
2179         * free.c: New file, from gnulib.
2180
2181 2003-10-31  Paul Eggert  <eggert@twinsun.com>
2182
2183         * mountlist.h (struct mount_entry.me_type_malloced): New member.
2184         * mountlist.c (SIZE_MAX): Define if not defined already.
2185         (read_filesystem_list): Set and use me_type_malloced.
2186         Use "sizeof *me" rather than "sizeof (struct mount_entry)" (or
2187         whatever the type happens to be), for brevity and consistency.
2188         Check for size calculation overflow on Alphas running OSF/1.
2189
2190 2003-10-31  Jim Meyering  <jim@meyering.net>
2191
2192         * hash.c: Include "xalloc.h" for use of xalloc_oversized.
2193
2194         * linebuffer.c: Include <string.h> for declaration of memset.
2195
2196         * alloca.c, linebuffer.c, xmalloc.c, xalloc.h: Update from gnulib.
2197         * exclude.c, getgroups.c, quotearg.c, stdbool_.h: Update from gnulib.
2198         * hash.c, hash-pjw.h: Update from gnulib.
2199
2200 2003-10-25  Jim Meyering  <jim@meyering.net>
2201
2202         * hash.c, hash.h: Update from gnulib.
2203         * hash-pjw.c, hash-pjw.h: Likewise.
2204         * obstack.c, obstack.h: Likewise.
2205
2206 2003-10-25  Jim Meyering  <meyering@lucent.com>
2207
2208         * fts_.h: Include <features.h> only if _LIBC.
2209         [!_LIBC]: Define-away __THROW, __BEGIN_DECLS, __END_DECLS.
2210
2211 2003-10-19  Jim Meyering  <jim@meyering.net>
2212
2213         * vasnprintf.c (vasnprintf): Work around losing snprintf on
2214         e.g. HPUX 10.20.
2215
2216 2003-09-25  Jim Meyering  <jim@meyering.net>
2217             Bruno Haible  <bruno@clisp.org>
2218
2219         [Update from gnulib]
2220         This lets translators provide better translations for the
2221         "Written by ..." part of --version output.
2222         * version-etc.h: Include stdarg.h.
2223         (version_etc_copyright): Declare as readonly.
2224         (version_etc): Make this function variadic with a NULL-terminated list
2225         of author name strings.
2226         (version_etc_va): New declaration.
2227         * version-etc.c: Include stdarg.h, stdlib.h.
2228         (version_etc_copyright): Declare as readonly.
2229         (version_etc_va): New function. Provide a different translatable string
2230         for each possible number of authors < 10. Abbreviate when there are 10
2231         authors or more.
2232         (version_etc): Make this function variadic. Call version_etc_va.
2233         Suggestion from Gary V. Vaughan.
2234
2235         * long-options.h (parse_long_options): Change prototype: the authors
2236         string is moved to the end and becomes variadic.
2237         * long-options.c: Include stdarg.h.
2238         (parse_long_options): Make this function variadic, too.
2239         Call version_etc_va, not version_etc.
2240
2241 2003-10-17  Jim Meyering  <jim@meyering.net>
2242
2243         * xfts.c, xfts.h: New files.
2244         This factors out code used by du.c, chmod.c, and chown-core.c.
2245         * Makefile.am (libfetish_a_SOURCES): Add xfts.c and xfts.h.
2246
2247         * error.h: Update from gnulib.
2248         * getpass.c: Likewise.
2249         * fnmatch.c: Likewise.
2250         * fnmatch_loop.c: Likewise.
2251
2252 2003-10-16  Jim Meyering  <jim@meyering.net>
2253
2254         * xmalloc.c: Include <string.h>, for declarations of memset and memcpy.
2255
2256         * getgroups.c: Update from gnulib.
2257         * readutmp.c: Fix indentation, from gnulib.
2258         * exclude.c: Update from gnulib.
2259         * xgethostname.c: Include xgethostname.h.
2260         * xgethostname.h: New file, from gnulib.
2261         * Makefile.am (libfetish_a_SOURCES): Add xgethostname.h.
2262
2263 2003-10-15  Jim Meyering  <jim@meyering.net>
2264
2265         * userspec.h: New file.
2266         * userspec.c: Include "userspec.h".
2267         * Makefile.am (libfetish_a_SOURCES): Add userspec.h.
2268
2269 2003-10-14  Paul Eggert  <eggert@twinsun.com>
2270
2271         Fix some number-parsing bugs, e.g., "head -n 100k@" wasn't
2272         properly diagnosed.
2273         * human.c, xstrtoimax.c, xstrtol.c, xstrtol.h, xstrtoul.c, xstrtoumax.c:
2274         Sync with gnulib.
2275
2276 2003-10-13  Paul Eggert  <eggert@twinsun.com>
2277
2278         * xalloc.h, xmalloc.c, xstrdup.c: Import latest version from gnulib.
2279
2280 2003-09-29  Paul Eggert  <eggert@twinsun.com>
2281
2282         * Makefile.am (libfetish_a_SOURCES): Add xstrtoimax.c.
2283
2284 2003-10-02  Jim Meyering  <jim@meyering.net>
2285
2286         Don't require that the maximum length of a file name
2287         encountered in a traversal fit in an `unsigned short',
2288         and fix some portability bugs (don't depend on gcc).
2289
2290         * fts.c: Include "fts_.h", not <fts.h>.
2291         (ALIGNBYTES) [!(__GNUC__ >= 2)]: Add a definition that works with
2292         compilers that don't have __alignof__.
2293         (MAX): Use a definition that doesn't depend on gcc.
2294         (fts_build): Make `len' and `maxlen' be of type size_t, not int.
2295         Test for overflow in a less type-dependent manner.
2296         Test HAVE_STRUCT_DIRENT_D_TYPE, rather than
2297         defined DT_DIR && defined _DIRENT_HAVE_D_TYPE.
2298         (fts_palloc): Test for overflow in a less type-dependent manner.
2299         (fts_safe_changedir): Use stat, not stat64.
2300         Use fstat, not __fxstat64(_STAT_VER.
2301
2302         * fts_.h [FTS] (fts_pathlen): Change type from int to size_t.
2303         [FTSENT] (fts_pathlen): Change type from u_short to size_t.
2304         (fts_level): Change type from u_short to int.
2305
2306         * Makefile.am (libfetish_a_SOURCES): Add fts.c fts_.h.
2307         Remove ftw_.h.
2308
2309 2003-09-29  Paul Eggert  <eggert@twinsun.com>
2310
2311         * strftime.c (tm_diff) [! HAVE_TM_GMTOFF]:
2312         Fix arg typo in previous patch.
2313
2314 2003-09-28  Jim Meyering  <jim@meyering.net>
2315
2316         * error.c: Update from gnulib.
2317
2318 2003-09-19  Jim Meyering  <jim@meyering.net>
2319
2320         * version-etc.h: (version_etc): Rename parameter, authors,
2321         to written_by.
2322         * version-etc.c: (version_etc): Likewise.
2323         Combine fprintf and following putc('\n'.
2324
2325         * version-etc.c, version-etc.h: Revert yesterday's changes.
2326         * long-options.c, long-options.h: Likewise.
2327
2328 2003-09-18  Jim Meyering  <jim@meyering.net>
2329
2330         This lets translators provide better translations for the
2331         `Written by ...' part of --version output.
2332         * version-etc.c: Include stdarg.h, stdlib.h, string.h, and xalloc.h.
2333         (version_etc): Make this function variadic,
2334         with a NULL-terminated list of author name strings.
2335         (version_etc_va): New function.
2336         Suggestion from Gary V. Vaughan.
2337         * version-etc.h (version_etc_va): Declare it.
2338
2339         * long-options.c: Include stdarg.h.
2340         (parse_long_options): Make this function variadic (authors), too.
2341         Call version_etc_va, not version_etc.
2342         * long-options.h (parse_long_options): Update prototype.
2343
2344 2003-09-16  Paul Eggert  <eggert@twinsun.com>
2345
2346         * linebuffer.c (readlinebuffer): Return NULL immediately upon
2347         input error, instead of returning NULL the next time we are called
2348         (and therefore losing track of errno).
2349
2350 2003-09-15  Paul Eggert  <eggert@twinsun.com>
2351
2352         * getndelim2.c (getndelim2): Don't trash errno when a read
2353         fails, so that the caller gets the proper errno.
2354
2355         * readutmp.c (read_utmp): Likewise.
2356         Check for fstat error.  Close stream and free storage
2357         when failing.
2358
2359 2003-09-14  Jim Meyering  <jim@meyering.net>
2360
2361         * argmatch.c: Update from gnulib.
2362
2363         * Makefile.am (libfetish_a_SOURCES): Add exit.h, strndup.h,
2364         time_r.c, time_r.h.
2365
2366 2003-09-13  Jim Meyering  <jim@meyering.net>
2367
2368         * setenv.c, strcspn.c, strdup.c, strndup.c, strnlen.c, strpbrk.c:
2369         * strstr.c, strtod.c, strtoimax.c, tempname.c, unicodeio.c, userspec.c:
2370         * vasprintf.h, xgethostname.c, xreadlink.c, xstrdup.c, xstrndup.c:
2371         * xstrndup.h, xstrtod.c, xstrtol.c, yesno.c: Update from gnulib.
2372         * strndup.h: New file, from gnulib.
2373         * exit.h: New file, from GNU gettext, via gnulib.
2374
2375 2003-09-06  Paul Eggert  <eggert@twinsun.com>
2376
2377         * time_r.c, time_r.h: New files.
2378
2379         * mktime.c (my_mktime_localtime_r): Remove; all uses changed to
2380         __localtime_r.
2381         (__localtime_r) [!defined _LIBC]: New macro.  Include <time_r.h>.
2382         (__mktime_internal) [!defined _LIBC]: Now extern, not static.
2383
2384         * strftime.c (my_strftime_gmtime_r): Remove; all uses changed to
2385         __gmtime_r.
2386         (my_strftime_localtime_r): Remove; all uses changed to __localtime_r.
2387         (__gtime_r, __localtime_r) [!HAVE_TM_GMTOFF]: New macros.
2388         Include <time_r.h>.
2389
2390 2003-09-13  Jim Meyering  <jim@meyering.net>
2391
2392         * strtol.c: Update from gnulib.
2393
2394 2003-09-12  Paul Eggert  <eggert@twinsun.com>
2395
2396         * argmatch.c, xgethostname.c, xmalloc.c: Include exit.h.
2397         * obstack.c [!defined _LIBC]: Likewise.
2398         * argmatch.c (EXIT_FAILURE): Remove; now done by exit.h
2399         * exitfail.c, fatal.c, xgethostname.c, xmalloc.c: Likewise.
2400         * exitfail.c: Don't include stdlib.h; no longer needed.
2401
2402 2003-09-12  Paul Eggert  <eggert@twinsun.com>
2403
2404         * error.c (error_tail): Assume vprintf.
2405
2406 2003-09-09  Paul Eggert  <eggert@twinsun.com>
2407
2408         More K&R removal.
2409
2410         * getloadavg.c (getloadavg, main): Define via prototypes.
2411
2412         * getopt.h (struct option.name): Assume C89, and use 'const'.
2413         (getopt, etopt_long, getopt_long_only, _getopt_internal)
2414         [defined __GNU_LIBRARY__]: Assume C89, so we can always declare
2415         with a prototype.
2416         * getopt.c (const): Remove macro.
2417         Include <string.h> unconditionally.
2418         (my_index): Remove; all uses changed to strchr.
2419         (strlen): Remove decl.
2420         (exchange): Remove forward decl; no longer needed.
2421         (exchange, _getopt_initialize, _getopt_internal, getopt, main):
2422         Define with prototype.
2423         * getopt1.c (const): Remove macro.
2424         (getopt_long, getopt_long_only, main): Define with prototype.
2425
2426         * getugroups.c: Include <string.h> unconditionally.
2427
2428         * getusershell.c: Include <stdlib.h> unconditionally.
2429         (getusershell, setusershell, endusershell, readname, main):
2430         Define with prototypes.
2431
2432         * group-member.c: Include group-member.h first.
2433         Include <stdlib.h> unconditionally.
2434
2435         * hard-locale.c: Include hard-locale.h first.
2436         Include <stdlib.h>, <string.h> unconditionally.
2437
2438         * hash.c (free, malloc): Remove decls.
2439         Include <stdlib.h> unconditionally.
2440
2441         * human.c: Include <stdlib.h>, <string.h> unconditionally.
2442         (getenv): Do not declare.
2443
2444         * idcache.c: Include <string.h> unconditionally.
2445
2446         * long-options.c: Include long-options.h first, to test interface.
2447         Include <stdlib.h> unconditionally.
2448
2449         * makepath.c: Include makepath.h first, to test interface.
2450         Include <stdlib.h> and <string.h> unconditionally.
2451
2452         * linebuffer.c: Include <stdlib.h>.
2453         (free): Remove decl.
2454
2455         * malloc.c: Include <stdlib.h>, for malloc; don't bother with stddef.h.
2456         rpl_malloc returns void *, not char *.
2457         * realloc.c (rpl_realloc): Likewise.  Also, define with a prototype.
2458
2459         * md5.h: Include <limits.h> unconditionally.
2460         (UINT_MAX_32_BITS): Don't worry about non-__STDC__ case.
2461         (__P): Remove; all uses removed.
2462         * md5.c: Include "md5.h" first.
2463         (md5_init_ctx, md5_read_ctx, md5_finish_ctx, md5_stream,
2464         md5_buffer, md5_process_bytes, md5_process_block):
2465         Define with prototypes.
2466         * sha.h (__P): Remove all uses.  (It wasn't defined??)
2467         * sha.c: Include "sha.h" first.
2468         Include <stdlib.h>, <string.h> unconditionally.
2469
2470         * memchr.c (__ptr_t): Remove; all uses changed to void *.
2471         * memcmp.c (__ptr_t): Likewise.
2472         * memrchr.c (__ptr_t): Likewise.
2473         * memchr.c, memcmp.c, memcoll.c, memrchr.c:
2474         Include <string.h> unconditionally.
2475         * memchr.c, memrchr.c: Include <limits.h> unconditionally.
2476         * memchr.c: Include <stdlib.h> unconditionally.
2477         * memchr.c (LONG_MAX): Remove.
2478         * memrchr.c (LONG_MAX): Likewise.
2479         * memchr.c (__memchr): Define via a prototype.
2480         * memrchr.c (__memrchr): Likewise.
2481         * memcmp.c (__P): Remove, and remove all uses.
2482         (memcmp_bytes, memcmp_common_alignment, memcmp_not_common_alignment):
2483         Remove forward decls; no longer needed.
2484         * memcpy.c, memmove.c, memset.c: Include <stddef.h>.
2485         Use types required by C89 in prototype.
2486
2487         * mkdir.c: Include <stdlib.h>, <string.h> unconditionally.
2488         * savedir.c: Likewise.
2489         * mkdir.c (free): Remove decl.
2490         * rmdir.c (rmdir): Define with a prototype.
2491         * savedir.c: Include savedir.h first, to test interface.
2492
2493         * mktime.c (STDC_HEADERS): Remove.
2494         Include <stdlib.h>, <string.h> unconditionally.
2495
2496         * modechange.c: Include <stdlib.h> unconditionally.
2497         (malloc): Remove decl.
2498
2499         * mountlist.c: Include <stdlib.h>, <string.h> unconditionally.
2500         (free): Remove decl.
2501
2502         * obstack.h (PTR_INT_TYPE) [!defined __PTRDIFF_TYPE__]:
2503         Define to ptrdiff_t, without bothering to check HAVE_STDDEF_H.
2504         (This type really should be intptr_t, but that's a C99ism.)
2505         (_obstack_memcpy): Remove: all uses changed to memcpy.
2506         Include <string.h> unconditionally.
2507         (struct obstack): Assume __STDC__ for types of members
2508         chunkfun, freefun, extra_arg.
2509         (_obstack_newchunk, _obstack_free, _obstack_begin, _obstack_begin_1,
2510         _obstack_memory_used, obstack_alloc_failed_handler, obstack_init,
2511         obstack_begin, obstack_specify_allocation,
2512         obstack_specify_allocation_with_arg, obstack_chunkfun,
2513         obstack_freefun, obstack_free) [! (defined __STDC__ && __STDC__)]:
2514         Remove unprototyped decls and the macros that use them.
2515         * obstack.c (POINTER): Remove.  All uses changed to void *.
2516         (obstack_alloc_failed_handler, CALL_CHUNKFUN, CALL_FREEFUN,
2517         _obstack_begin, _obstack_begin_1, _obstack_allocated_p)
2518         (defined __STDC__ && __STDC__)]:
2519         Remove nonprototyped code.
2520         Include <stdlib.h> unconditionally.
2521         (_obstack_begin, _obstack_begin_1, _obstack_newchunk,
2522         _obstack_allocated_p, _obstack_free, obstack_free,
2523         _obstack_memory_used, print_and_abort):
2524         Define using prototypes.
2525         (obstack_1grow, obstack_1grow_fast, obstack_alloc, obstack_base,
2526         obstack_blank, obstack_blank_fast, obstack_copy, obstack_copy0,
2527         obstack_finish, obstack_grow, obstack_grow0, obstack_make_room,
2528         obstack_next_free, obstack_object_size, obstack_room) [0]:
2529         Remove unused, unprototyped code.
2530
2531         * path-concat.c: Include <stdlib.h>, <string.h> unconditionally.
2532
2533         * physmem.c (physmem_total, physmem_available, main): Define
2534         with prototypes.
2535
2536         * posixtm.c: Include <stdlib.h>, <string.h> unconditionally.
2537         (main): Define with a prototype.
2538
2539         * posixver.c (getenv): Remove decl.
2540
2541         * putenv.c (malloc): Returns void *, not char *.
2542         Include <string.h> unconditionally.
2543         (strchr, memcpy, NULL): Do not define.
2544
2545         * readtokens.c: Include readtokens.h first, to test interface.
2546         Include <stdlib.h>, <string.h> unconditionally.
2547         (init_tokenbuffer): Define with a prototype.
2548
2549         * regex.c (PARAMS): Remove.  All uses removed.
2550         All uses of _RE_ARGS removed, too.
2551         Include <stddef.h>, <stdlib.h>, <string.h>, <limits.h>
2552         unconditionally.
2553         (bzero): Assume memset exists.
2554         (memcmp, memcpy, NULL): Remove.
2555         (SIGN_EXTEND_CHAR): Remove; all uses replaced by casts to signed
2556         char, or assignments to local vars of type signed char.
2557         (init_syntax_once, PREFIX(extract_number_and_incr),
2558         PREFIX(print_partial_compiled_pattern),
2559         PREFIX(print_compiled_pattern), PREFIX(print_double_string),
2560         convert_mbs_to_wcs, print_fastmap, re_set_syntax,
2561         PREFIX(regex_grow_registers), PREFIX(regex_compile),
2562         PREFIX(store_op1), PREFIX(store_op2), PREFIX(insert_op1),
2563         PREFIX(insert_op2), PREFIX(at_begline_loc_p),
2564         PREFIX(at_endline_loc_p), group_in_compile_stack, insert_space,
2565         wcs_compile_range, byte_compile_range, truncate_wchar,
2566         PREFIX(re_compile_fastmap), re_compile_fastmap, re_set_registers,
2567         re_search, re_search_2, PREFIX(re_search_2), re_match, re_match_2,
2568         count_mbs_length, wcs_re_match_2_internal,
2569         byte_re_match_2_internal, PREFIX(group_match_null_string_p),
2570         PREFIX(alt_match_null_string_p),
2571         PREFIX(common_op_match_null_string_p), PREFIX(bcmp_translate),
2572         re_compile_pattern, re_comp, re_exec, regcomp, regexec, regerror,
2573         regfree, PREFIX(extract_number)): Define with prototype.  Remove
2574         now-unnecessary declaration, if any.
2575         (byte_compile_range, PREFIX(regex_compile), re_comp, re_exec,
2576         regcomp, regexec):
2577         Remove now-unnecessary casts among pointer types.
2578         * regex.h (_RE_ARGS): Remove.  All uses removed.
2579
2580         * rename.c: Include <stdlib.h>, <string.h> unconditionally.
2581         (free): Remove decl.
2582
2583         * rpmatch.c: Include <stdlib.h> unconditionally.
2584
2585         * save-cwd.c: Include <stdlib.h> unconditionally.
2586         * xgetcwd.c: Likewise.
2587
2588         * stat.c: Include <stdlib.h>, <string.h> unconditionally.
2589         (free): Remove decl.
2590
2591         The following changes are not K&R related:
2592
2593         * group-member.h: Include <sys/types.h>, so that this file is
2594         self-contained.
2595         * makepath.h: Likewise.
2596
2597         * getusershell.c (readname, default_index, line_size, readname):
2598         Use size_t, not int, for sizes.
2599         (readname): If the size overflows, report an error instead of
2600         looping forever.
2601
2602 2003-09-09  Derek Robert Price  <derek@ximbiot.com>
2603
2604         * getndelim2.c: Assume stdlib.h per the C89 spec.
2605
2606 2003-09-08  Paul Eggert  <eggert@twinsun.com>
2607
2608         Assume C89 or better; remove K&R cruft.
2609         A few of these changes were first proposed by Derek Robert Price
2610         in <http://mail.gnu.org/archive/html/bug-gnulib/2003-07/msg00105.html>.
2611
2612         * addext.c: Include <string.h> unconditionally.
2613         * backupfile.c: Include <string.h>, <stdlib.h> unconditionally.
2614         Don't declare getenv or malloc.
2615
2616         * alloca.c: Include <string.h>, <stdlib.h> unconditionally.
2617         (POINTER_TYPE, pointer): Remove; all uses changed to void *.
2618         (NULL): Remove.
2619         (find_stack_direction, alloca): Use prototypes.
2620
2621         * atexit.c (atexit): Define using a prototype.
2622
2623         * basename.c, dirname.c, stripslash.c:
2624         Include <string.h> unconditionally.
2625
2626         * bcopy.c: Include <stddef.h>.
2627         (bcopy): Define with prototype, using 'const' and 'void' and 'size_t'.
2628
2629         * canon-host.c: Include <stdlib.h>, <string.h> unconditionally.
2630
2631         * error.h (error, error_at_line, error_print_progname)
2632         [! (defined (__STDC__) && __STDC__)]: Remove decls.
2633         * error.c: Include error.h first, to check interface.
2634         Include <stdarg.h>, <stdlib.h>, <string.h> unconditionally.
2635         (VA_START): Remove; all uses changeed to va_start.
2636         (exit, strerror): Remove decls.
2637         (error_print_progname): Prototype uncondionally.
2638         Don't include <errno.h>; no longer needed.
2639         (private_strerror): Remove.
2640         (error_tail): Always define.
2641         (error, error_at_line): Assume C89 or better; always use prototypes.
2642
2643         * euidaccess.c (main): Define with a prototype.
2644
2645         * exclude.c: Include <stdlib.h>, <string.h> unconditionally.
2646
2647         * exitfail.c: Include <stdlib.h> unconditionally.
2648
2649         * fnmatch_.h (__P): Remove.  All uses changed to assume prototypes.
2650         * fnmatch.c: Include fnmatch.h first, to test interface.
2651         Include <string.h>, <stddef.h>, <stdlib.h> unconditionally.
2652         (getenv): Remove decl.
2653         (fnmatch): Define using a prototype.
2654         * fnmatch_loop.c (FCT): Remove forward decl; no longer needed.
2655         (FCT): Define using a prototype.
2656
2657         * getdate.y: Include <stdlib.h>, <string.h> unconditionally.
2658
2659         * gethostname.c: Include <stddef.h>.
2660         (gethostname): Define with prototype.  Length is size_t, not int.
2661
2662 2003-09-08  Paul Eggert  <eggert@twinsun.com>
2663
2664         * utime.c [!HAVE_UTIMES_NULL]: Include <sys/stat.h>, <fcntl.h>.
2665         (utime_null): Fix typo: 'st' was sometimes called 'sb'.
2666
2667 2003-09-09  Jim Meyering  <jim@meyering.net>
2668
2669         * getversion.c: Remove unused file.  Reported by Paul Eggert.
2670
2671 2003-09-03  Paul Eggert  <eggert@twinsun.com>
2672
2673         * human.c (human_readable): Fix bug that rounded 10501 to 10k.
2674         Bug reported by Lute Kamstra in
2675         <http://mail.gnu.org/archive/html/bug-gnulib/2003-09/msg00003.html>.
2676
2677         * getdate.y (relative_time_table): Use tDAY_UNIT for "tomorrow",
2678         "yesterday", "today", and "now" rather than tMINUTE_UNIT.  Of
2679         course with correspondingly smaller numbers for tomorrow and
2680         yesterday.  From Tadayoshi Funaba.  Originally installed into
2681         sh-utils on 1999-08-07, but the patch was mistakenly reverted by
2682         the next change to that shared file (but this time in fileutils)
2683         on 1999-08-29.
2684
2685 2003-08-18  Paul Eggert <eggert@twinsun.com>
2686
2687         * same.c: Include <stdlib.h> and <string.h> unconditionally,
2688         as we're now assuming that part of hosted C89.
2689         (free) [!HAVE_DECL_FREE]: Remove decl; no longer needed.
2690         (same_name): Invoke pathconf on destination, not source, as
2691         that's a bit clearer even if they are the same dir.
2692
2693 2003-08-18  Jim Meyering  <jim@meyering.net>
2694
2695         * getopt.h: Remove space before TAB.
2696
2697 2003-08-17  Paul Eggert  <eggert@twinsun.com>
2698
2699         * same.c: Include <stdbool.h>, <limits.h>.
2700         (_POSIX_NAME_MAX): Define if not defined.
2701         (MIN): New macro.
2702         (same_name): If file names are silently truncated, report
2703         that the file names are the same if they are the same after
2704         the silent truncation.
2705
2706 2003-08-16  Paul Eggert  <eggert@twinsun.com>
2707
2708         Merge from gnulib.
2709         * Makefile.am (libfetish_a_SOURCES): Remove getndelim2.c,
2710         getndelim2.h, xstrtoimax.c.  Add localcharset.h.
2711         (CLEANFILES, SUFFIXES): Initialize to empty.
2712         (EXTRA_DIST): Add getndelim2.c, getndelim2.h.
2713         (install-exec-local): Use $(GLIBC21), not @GLIBC21@.
2714         Do not mkdir libdir if not glibc21.
2715         (charset.alias): @host@ -> $(host).
2716         (SUFFIXES, .sin.sed, CLEANFILES): Reorder rules
2717         to match gnulib module suggestions.
2718         * localcharset.h, readlink.c: New files, from gnulib.
2719         * asnprintf.c, asnprintf.c, asprintf.c, backupfile.h,
2720         canon-host.c, config.charset, dirname.h, euidaccess.c, exclude.c,
2721         fsusage.h, full-write.c, getloadavg.c, getndelim2.h, gettext.h,
2722         group-member.h, hard-locale.h, hash.c, hash.h, hash-pjw.c,
2723         localcharset.c, long-options.h, makepath.h, malloc.c, mbswidth.c,
2724         mbswidth.h, md5.h, memcasecmp.c, memcasecmp.h, memcoll.h,
2725         mkstemp.c, modechange.h, mountlist.h, path-concat.h, pathmax.h,
2726         physmem.h, posixtm.h, printf-args.c, printf-args.h,
2727         printf-parse.c, printf-parse.h, putenv.c, quote.h, readutmp.h,
2728         ref-add.sin, ref-del.sin, safe-read.c, savedir.h, setenv.c,
2729         setenv.h, stdbool_.h, strnlen.c, strpbrk.c, strtoimax.c,
2730         strverscmp.h, tempname.c, unicodeio.c, unicodeio.h,
2731         unistd-safer.h, unlocked-io.h, vasnprintf.c, vasnprintf.h,
2732         vasprintf.c, vasprintf.h, version-etc.h, xgethostname.c,
2733         xmemcoll.c, xstrtoimax.c, xstrtoumax.c: Sync with gnulib.
2734
2735 2003-08-15  Paul Eggert  <eggert@twinsun.com>
2736
2737         * physmem.c: Include "physmem.h" before system includes.
2738
2739 2003-08-10  Jim Meyering  <jim@meyering.net>
2740
2741         * utimens.c (utimens): Revert most of last change.
2742         Test HAVE_WORKING_UTIMES instead of HAVE_UTIMES.
2743
2744 2003-08-09  Jim Meyering  <jim@meyering.net>
2745
2746         * utimens.c (utimens): Test HAVE_UTIME, not HAVE_UTIMES.
2747         Prefer utime, since it works and utimes doesn't on some systems.
2748         FIXME: Revert the above change once we have a working utimes
2749         replacement function.
2750
2751 2003-08-06  Paul Eggert  <eggert@twinsun.com>
2752
2753         * Makefile.am (libeftish_a_SOURCES): Add utimens.c, utimens.h.
2754         * utimens.c, utimens.h: New files.
2755
2756 2003-08-09  Jim Meyering  <jim@meyering.net>
2757
2758         * unicodeio.c (unicode_to_mb): Change to `Solaris 5.7' in comment.
2759         * putenv.c: Likewise.
2760
2761         * fatal.c, fatal.h: Remove unused files.
2762
2763         * Makefile.am: Use the e.g., `$(FNMATCH_H)' notation for AC_SUBST'd
2764         variable names, rather than @FNMATCH_H@.
2765         Likewise for $(ALLOCA_H).
2766         (fnmatch.h): Use `$@' in the commands, in place of the three copies
2767         of the literal target, `fnmatch.h'.
2768         (alloca.h): Likewise.
2769
2770 2003-08-08  Paul Eggert  <eggert@twinsun.com>
2771
2772         * Makefile.am (libfetish_a_SOURCES): Remove fnmatch_.h.
2773         (lib_OBJECTS): New macro, for convenience when cutting and
2774         pasting Makefile.am templates from gnulib.
2775         (EXTRA_DIST): Remove fnmatch_loop.c.
2776         (BUILT_SOURCES): Append $(FNMATCH_H).
2777         * Makefile.am: Import the following changes from gnulib templates
2778         for alloca and fnmatch):
2779         (all-local $(lib_OBJECTS)): New dependencies.
2780         (alloca.h): Use alloca.h-t for temporary.
2781         (EXTRA_DIST): Append fnmatch_.h, fnmatch_loop.c.
2782         (fnmatch.h): New rule.
2783         (MOSTLYCLEANFILES): Add fnmatch.h, fnmatch.h-t.
2784         (DISTCLEANFILES): Remove fnmatch.h
2785
2786 2003-08-08  Jim Meyering  <jim@meyering.net>
2787
2788         * mountlist.c (read_filesystem_list) [MOUNTED_GETFSSTAT]:
2789         Use MNT_NOWAIT, rather than MNT_WAIT.  Otherwise, `df DIR' could
2790         hang on OSF/1 5.1 for DIR on both local and remote file systems.
2791         Reported by (and fix confirmed by) Nelson H. F. Beebe.
2792
2793 2003-08-07  Jim Meyering  <jim@meyering.net>
2794
2795         * regex.h (RE_SYNTAX_POSIX_AWK): Remove SPACE in SPACE-TAB sequence.
2796
2797 2003-08-05  Paul Eggert  <eggert@twinsun.com>
2798
2799         Merge getline from gnulib.
2800         * getline.h, getline.c: Merge from gnulib.
2801         * getndelim2.h, getndelim2.c: New files, from gnulib.
2802         * getdelim2.c, getdelim2.h: Remove.
2803         * Makefile.am (libfetish_a_SOURCES): Change getdelim2.c and
2804         getdelim2.h to getndelim2.c and getndelim2.h.
2805
2806 2003-08-04  Paul Eggert  <eggert@twinsun.com>
2807
2808         * regex.c, regex.h: Sync with gnulib.
2809
2810 2003-08-03  Paul Eggert  <eggert@twinsun.com>
2811
2812         * stdbool_.h (_Bool): Use a #define, not a typedef.
2813
2814 2003-07-31  Paul Eggert  <eggert@twinsun.com>
2815
2816         * bumpalloc.h: Remove.
2817         * Makefile.am (libfetish_a_SOURCES): Remove bumpalloc.h.
2818
2819 2003-07-28  Jim Meyering  <jim@meyering.net>
2820
2821         * stdbool_.h: Renamed from stdbool.hin.
2822         * Makefile.am: Reflect renaming: stdbool.hin -> stdbool_.h.
2823         * stdbool.hin: Remove file.
2824
2825 2003-07-28  Paul Eggert  <eggert@twinsun.com>
2826
2827         * stdbool.hin (_Bool): Make it signed char, instead of
2828         an enum type, so that it's guaranteed to promote to int.
2829
2830 2003-07-23  Jim Meyering  <jim@meyering.net>
2831
2832         * xstrndup.h: New file.
2833         * xstrndup.c: New file, factored out of dircolors.c from coreutils.
2834         * Makefile.am (libfetish_a_SOURCES): Add xstrndup.c and xstrndup.h.
2835
2836 2003-07-23  Jim Meyering  <jim@meyering.net>
2837
2838         * lstat.c, save-cwd.c, stat.c, utime.c, xgethostname.c: Normalize
2839         naming of Sun operating systems in comments, e.g., SunOS4 -> SunOS 4,
2840         Solaris5.9 -> Solaris 9.  From Paul Eggert.
2841
2842 2003-07-22  Paul Eggert  <eggert@twinsun.com>
2843
2844         * xalloc.h (XCALLOC, XREALLOC, CCLONE): Fix under- and
2845         over-parenthesization in macros.
2846
2847 2003-07-18  Paul Eggert  <eggert@twinsun.com>
2848
2849         * closeout.h (close_stdout_set_status, close_stdout_status): Remove.
2850         * closeout.c: Likewise.  Include "closeout.h" right after config.h,
2851         to test that it can stand by itself.  Include "exitfail.h".
2852         Clients should set exit_failure instead.
2853         (EXIT_FAILURE): Remove; no longer needed.  Do not include <stdlib.h>.
2854
2855 2003-07-18  Andreas Schwab  <schwab@suse.de>
2856
2857         * memcoll.c (memcoll) [!HAVE_STRCOLL]: Clear errno.
2858
2859 2003-07-17  Paul Eggert  <eggert@twinsun.com>
2860
2861         * xalloca.h, xmalloc.c, xmemcoll.c, xmemcoll.h:
2862         Merge with gnulib.  Use a single exit_failure variable rather
2863         than a separate one for each module.
2864
2865 2003-07-16  Jim Meyering  <jim@meyering.net>
2866
2867         * Makefile.am (AM_CPPFLAGS): Rename from `INCLUDES', to avoid
2868         warning from automake -Wall.
2869
2870 2003-07-14  Jim Meyering  <jim@meyering.net>
2871
2872         * save-cwd.h: Add copyright.
2873
2874 2003-07-13  Jim Meyering  <jim@meyering.net>
2875
2876         * xgethostname.c: Include <stdlib.h> for declaration of free.
2877         (xgethostname): Return NULL, rather than exiting, upon any
2878         non-malloc/realloc error.
2879
2880 2003-07-12  Jim Meyering  <jim@meyering.net>
2881
2882         * Makefile.am (BUILT_SOURCES): Use `BUILT_SOURCES += $(STDBOOL_H)'
2883         rather than `all-local: $(STDBOOL_H)'.  The latter didn't force
2884         creation of stdbool.h before most other targets.
2885         Likewise for $(ALLOCA_H).
2886
2887         Don't emit diagnostics.  Let callers do that.
2888         * save-cwd.c: Don't include "error.h".
2889         (save_cwd): Don't call error.  Ensure that errno is valid
2890         when returning nonzero.
2891
2892         * obstack.h: Update from gnulib.
2893
2894         * makepath.c (make_path): Enclose diagnostic in _(...).
2895
2896 2003-07-10  Jim Meyering  <jim@meyering.net>
2897
2898         * userspec.c: Include "posixver.h".
2899         (parse_user_spec): Accept `.' as a separator only
2900         in pre-POSIX-200112 mode.
2901
2902         * Makefile.am (libfetish_a_SOURCES): Add these:
2903         printf-args.h, printf-parse.h, vasprintf.h, vasnprintf.h.
2904
2905         Now that a program (`who') uses asprintf, we need all of these:
2906         * asnprintf.c, asprintf.c, printf-args.c, printf-args.h, printf-parse.c:
2907         * printf-parse.h, vasnprintf.c, vasnprintf.h, vasprintf.c, vasprintf.h:
2908         New files, from gnulib.
2909
2910         * alloca_.h, getpass.c, memrchr.c, obstack.h, posixver.c,
2911         strftime.c, strnlen.c, strverscmp.c: Switch from LGPL to GPL.
2912
2913 2003-07-09  Jim Meyering  <jim@meyering.net>
2914
2915         * mktime.c: Update from gnulib.
2916         FIXME: but still need to adjust m4/mktime.c so that this fixed
2917         version is used when needed.
2918
2919         Fix the bug that would make `du /' omit the `/' on the last line.
2920         E.g., `du --exclude '[^/]*' -x /' would print only "4\t\n" for me.
2921         * ftw.c (ftw_dir): Don't clobber the leading `/'.
2922         Reported by Chris Lesniewski as http://bugs.debian.org/200542.
2923
2924 2003-07-04  Jim Meyering  <jim@meyering.net>
2925
2926         Update from gnulib.
2927         * xreadlink.c: Include <sys/types.h> unconditionally, instead of
2928         having it depend on HAVE_SYS_TYPES_H.
2929
2930 2003-06-18  Jim Meyering  <jim@meyering.net>
2931
2932         * inttostr.h (PARAMS): Remove.  All uses removed.
2933
2934         Merge in change from gnulib.
2935         * makepath.c: Remove block of alloca-related code in favor
2936         of an unconditional `#include <alloca.h>'.
2937
2938         * xalloc.h: Include <stddef.h>.
2939         Remove unnecessary parentheses.
2940         Use `1990-2000' notation in Copyright line until Emacs'
2941         copyright-update function learns how to handle a comma-separated
2942         list of years that spans a line boundary.
2943
2944         * Makefile.am (libfetish_a_SOURCES): Add getdelim2.c and getdelim2.h.
2945
2946         * getline.c (getdelim2): Move this function into its own file.
2947         * getdelim2.c: Extracted from getline.c.
2948
2949         * linebuffer.c, linebuffer.h: Update from gnulib.
2950
2951         * getdelim2.c, getdelim2.h: New files.
2952         * getstr.c, getstr.h: Remove files.
2953
2954         * same.h: Update from gnulib.
2955         * xstrtol.h: Update from gnulib.
2956
2957 2003-06-17  Paul Eggert  <eggert@twinsun.com>
2958
2959         Assume C89, so PARAMS isn't needed.
2960         * backupfile.h (PARAMS): Remove.  All uses removed.
2961         * closeout.h, dirname.h, filemode.h, fsusage.h, getdate.h, getline.h,
2962         group-member.h, hard-locale.h, hash.h, linebuffer.h, long-options.h,
2963         makepath.h, memcasecmp.h, memcoll.h, modechange.h, mountlist.h,
2964         path-concat.h, physmem.h, posixtm.h, quote.h, readutmp.h, same.h,
2965         save-cwd.h, savedir.h, stdio-safer.h, strtoimax.c, strverscmp.h,
2966         unistd-safer.h, version-etc.h, xalloc.h, xreadlink.h, xstrtod.h,
2967         xstrtol.h: Likewise.
2968         * filemode.h, hard-locale.h, memcoll.h, modechange.h, physmem.h, same.h,
2969         * strverscmp.h: Do not include config.h; no longer needed.
2970         Anyway, config.h should always be included before any other file.
2971
2972 2003-06-17  Jim Meyering  <jim@meyering.net>
2973
2974         * getline.c: Update from gnulib.
2975
2976         Merge in changes from gnulib.
2977         * hash.c: Include <stdbool.h> unconditionally.
2978         Include <limits.h>.
2979         (CHAR_BIT): Don't define.
2980
2981 2003-06-09  John David Anglin  <dave.anglin@nrc-cnrc.gc.ca>
2982
2983         * acl.c: Include <sys/types.h> before <sys/stat.h>.
2984         Required on Ultrix 4.3.
2985
2986 2003-05-20  Derek Price  <derek@ximbiot.com>
2987
2988         * stat.c [LSTAT]: Compile/use slash_aware_lstat only if it is necessary.
2989
2990 2003-06-10  Jim Meyering  <jim@meyering.net>
2991
2992         * getdate.y: Also accept dates of the form May-23-2003.
2993         Suggestion from Karl Berry.
2994
2995 2003-06-09  Jim Meyering  <jim@meyering.net>
2996
2997         * gettimeofday.c: Also undefine gmtime.
2998         (rpl_gmtime): New function.  Suggestion from Paul Eggert.
2999
3000 2003-06-08  Jim Meyering  <jim@meyering.net>
3001
3002         * getline.h: Update from gnulib.
3003
3004         Clean up, as part of merge with emacs version of strftime.c.
3005         * strftime.c (my_strftime) [!_LIBC && HAVE_TZNAME && HAVE_TZSET]:
3006         Remove function, now that we can rely on a working tzset function.
3007         [!_LIBC]: Ensure that the required autoconf test has been run.
3008         * gettimeofday.c: Also undef tzset.
3009         (rpl_tzset): New function, for use by new macro, gl_FUNC_TZSET_CLOBBER.
3010
3011 2003-06-07  Jim Meyering  <jim@meyering.net>
3012
3013         * readtokens.h: Add copyright notice.
3014         Include <stdio.h>.
3015         Remove definition and uses of __P.
3016
3017         * readtokens.c: Put `Free Software Foundation, Inc.' in place of
3018         my name in the copyright comment.
3019         (init_tokenbuffer): Remove unnecessary parentheses around malloc.
3020
3021         Update from gnulib.
3022         * getdate.y: Include alloca.h unconditionally.
3023         * xmemcoll.h: Include <stddef.h>.
3024
3025         * Makefile.am (MOSTLYCLEANFILES): Add alloca.h and alloca.ht.
3026         (MOSTLYCLEANFILES): Add stdbool.ht.
3027
3028         * human.c: Include <stdio.h>, once again, for declaration of sprintf.
3029
3030         Update from gnulib.
3031         * tempname.c: Include <stddef.h> unconditionally.
3032         Include <inttypes.h> as an alternative to <stdint.h>.
3033         * strtoimax.c: Include <stdint.h> as an alternative to <inttypes.h>.
3034         * xstrtol.h: Likewise.
3035         * xstrtoimax.c: Likewise.
3036         * xstrtoumax.c: Likewise.
3037
3038         Update from gnulib.
3039         * strcasecmp.c: Include <stddef.h>, not <sys/types.h>.
3040         * savedir.c: Include <stddef.h>.
3041         (NULL): Don't define, since <stddef.h> does that.
3042
3043 2003-06-06  Jim Meyering  <jim@meyering.net>
3044
3045         Update from gnulib.
3046         * rpmatch.c: Include <limits.h> without checking for HAVE_LIMITS_H.
3047         Include <stddefs.h> unconditionally.
3048         (NULL): Don't define, since <stddef.h> does that.
3049         * rename.c: #undef rename before defining rpl_rename.
3050         [HAVE_CONFIG_H]: Guard inclusion of config.h.
3051         * putenv.c: Include <stddef.h> rather than <sys/types.h>,
3052         as we merely need size_t.
3053         * realloc.c: Likewise.
3054         * quote.c: Don't include <stddef.h> or <sys/types.h>; not needed.
3055         * modechange.c: Include <stddef.h>.
3056         (NULL): Don't define, since <stddef.h> does that.
3057         * memcoll.h: Include <stddef.h>, to get size_t.
3058         * memcoll.c: Include "memcoll.h", which gets us size_t and checks
3059         our interface, instead of including <sys/types.h>
3060         (memcoll): Fall back on a simple algorithm using
3061         memcmp if strcoll doesn't work.
3062         * memcasecmp.h: Include <stddef.h>.
3063         * memcasecmp.c: Don't include <sys/types.h>.
3064
3065         From gnulib.
3066         * alloca_.h: New file.
3067         * Makefile.am (EXTRA_DIST): Add alloca_.h.
3068         (all-local $(lib_OBJECTS)): Depend on $(ALLOCA_H).
3069         (alloca.h): New rule.
3070
3071         * addext.c: Update from gnulib.
3072         * backupfile.c: Likewise.
3073         * config.charset: Likewise.
3074         * dirname.h: Likewise.
3075         * fsusage.c: Likewise.
3076         * userspec.c: Likewise.
3077         * xreadlink.c: Likewise.
3078         * xstrtol.c: Likewise.
3079         * __fpending.h: Likewise.
3080
3081         * md5.c: Include <string.h> and <stdlib.h> unconditionally.
3082         (memcpy): Remove definition.
3083
3084         * posixtm.c: Include <stdbool.h> unconditionally.
3085
3086 2003-06-05  Jim Meyering  <jim@meyering.net>
3087
3088         From gnulib.
3089         * mktime.c: Assume freestanding C89 or better.
3090         (HAVE_LIMITS_H): Remove.  Assume it's 1.
3091         (__P): Remove; not used.
3092         (CHAR_BIT, INT_MIN, INT_MAX): Remove; <limits.h> defines them.
3093         (mktime, not_equal_tm, print_tm, check_result,
3094         main): Use prototypes.  Use const * where appropriate.
3095         (main): Fix typo in testing code that uncovered by above changes.
3096         (Local Variables): Remove -DHAVE_LIMITS_H from compile-command.
3097
3098 2003-06-04  Paul Eggert  <eggert@twinsun.com>
3099
3100         Merge human.c etc. from gnulib.
3101         * exclude.c, human.c, human.h: Merge from gnulib.
3102         * cycle-check.c, cycle-check.h, src/system.h:
3103         Include <stdbool.h> unconditionally.
3104
3105 2003-06-02  Jim Meyering  <jim@meyering.net>
3106
3107         * stdbool.hin: New file.  From gnulib.
3108         * Makefile.am (MOSTLYCLEANFILES): Initialize.
3109         (stdbool.h): New rule.
3110         (all-local $(lib_OBJECTS)): Depend on $(STDBOOL_H)
3111         (MOSTLYCLEANFILES): Add stdbool.h.
3112         (EXTRA_DIST): Add stdbool.h.
3113
3114 2003-05-30  Jim Meyering  <jim@meyering.net>
3115
3116         * addext.c: Update from gnulib.
3117         * mktime.c: Likewise.
3118
3119 2003-05-29  Jim Meyering  <jim@meyering.net>
3120
3121         Make the %r format directive honor any locale setting.
3122         * strftime.c: (my_strftime) [!defined _NL_CURRENT && HAVE_STRFTIME]:
3123         Use underlying_strftime for %r.
3124
3125 2003-05-15  Jim Meyering  <jim@meyering.net>
3126
3127         * getopt.h: Remove a space before a TAB.
3128
3129 2003-05-13  Jim Meyering  <jim@meyering.net>
3130
3131         * setenv.c (setenv): Don't apply cast to argument of free.
3132         * putenv.c (rpl_putenv): Likewise.
3133         * alloca.c (alloca): Likewise.
3134
3135 2003-05-12  Jim Meyering  <jim@meyering.net>
3136
3137         * ftw.c (ftw_startup): Always call free_cwd after restore_cwd.
3138         Reported by Matti Aarnio as
3139         https://bugzilla.redhat.com/bugzilla/show_bug.cgi?id=90563.
3140         Forwarded by Tim Waugh.
3141
3142         * strftime.c (my_strftime): Let the `-' (no-pad) flag affect
3143         the space-padded-by-default conversion specifiers, %e, %k, %l.
3144
3145 2003-05-07  Paul Eggert  <eggert@twinsun.com>
3146
3147         * xnanosleep.c (timespec_subtract): Don't modify the 2nd arg.
3148         Work even if X-Y overflows when subtracting.  Make explicit the
3149         assumption that tv_nsec must be in range.
3150         (clock_get_realtime): Remove.  All callers changed to invoke gettime,
3151         for simplicity.
3152         (xnanosleep): Check for gettime failure every time.
3153
3154 2003-05-06  Jim Meyering  <jim@meyering.net>
3155
3156         * xnanosleep.c (clock_get_realtime): Use gettime.c's gettime function,
3157         rather than an inferior, open-coded version that would fail on
3158         AIX systems due to clock_gettime failing with errno == ENOSYS.
3159         Reported by Jérôme Zago.
3160
3161 2003-05-05  Jim Meyering  <jim@meyering.net>
3162
3163         Avoid array overrun.
3164         * ftw.c (nftw_arr): Update to reflect complete list of members.
3165         (ftw_arr): Likewise
3166         Reported by Olatunji Oluwabukunmi Ruwase.
3167
3168         Make it less likely that the above can happen again.
3169         * ftw.c (struct dummy): Ensure that at least the number of
3170         initializers matches the number of members in the corresponding enum.
3171         * ftw_.h (enum Ftw_option): Name this previously-anonymous enum.
3172         (enum Ftw_option) [FTW_N_MEMBERS]: New member.
3173
3174 2003-05-04  Jim Meyering  <jim@meyering.net>
3175
3176         * setenv.c (__set_errno, LOCK, UNLOCK): Define.
3177         (unsetenv): Update from GNU libc.
3178         Ifdef-out this function, since the only caller
3179         is putenv.c and that file now has its own copy.
3180
3181         This avoids a core dump on systems without GNU putenv,
3182         when running `env -u SOME_ALREADY_UNSET_VARIABLE'.
3183         * putenv.c (__set_errno, LOCK, UNLOCK): Define.
3184         (unsetenv): New static function, from GNU libc.
3185         (rpl_putenv): Use it.
3186
3187 2003-05-02  Jim Meyering  <jim@meyering.net>
3188
3189         * canonicalize.c (canonicalize_file_name) [!HAVE_RESOLVEPATH]:
3190         A memory-allocation error could result in heap corruption.  Fix it
3191         by also updating `dest' when rpath may be changed by xrealloc.
3192
3193 2003-04-15  Jim Meyering  <jim@meyering.net>
3194
3195         * getloadavg.c: Remove (or replace-with-TAB(s) to retain alignment)
3196         each sequence of spaces before a TAB character.
3197         * md5.c, getopt.c, getopt.h, obstack.h, strftime.c: Likewise.
3198
3199 2003-04-11  Jim Meyering  <jim@meyering.net>
3200
3201         * readutmp.c: Include <string.h> and <stdlib.h> unconditionally.
3202
3203         * canonicalize.c, exclude.c, getgroups.c, getusershell.c:
3204         * group-member.c, idcache.c, mountlist.c, readtokens.c, readutmp.c:
3205         * bumpalloc.h: Remove anachronistic casts of xmalloc, xrealloc,
3206         and xcalloc return values.
3207
3208         * xalloc.h (PARAMS): Remove definitions and uses.
3209         (XMALLOC, XCALLOC, XREALLOC): Remove unnecessary casts.
3210
3211         * xmalloc.c: Remove use of PARAMS.
3212
3213 2003-04-10  Jim Meyering  <jim@meyering.net>
3214
3215         * canonicalize.c (canonicalize_file_name) [HAVE_RESOLVEPATH]: Remove
3216         stray semicolon that caused `readlink --canonical RELATIVE_NAME' to
3217         fail on e.g., Solaris systems.  Reported by Bruce Korb.
3218         (canonicalize_file_name): Return NULL immediately if resolvepath fails.
3219         Otherwise, `readlink --canonical /no-such-file' would exhaust
3220         virtual memory on some systems (e.g. Solaris).
3221         (canonicalize_file_name): Always free `extra_buf' before returning.
3222         (canonicalize_file_name): NUL-terminate the result.
3223
3224 2003-04-05  Jim Meyering  <jim@meyering.net>
3225
3226         * Makefile.am (DEFS): Use += notation rather than `DEFS = ... @DEFS@'.
3227         Use $(VAR) rather than @VAR@, now that we can rely on automake to
3228         emit a definition for each substituted variable.
3229
3230 2003-03-26  Richard Dawe  <rich@phekda.freeserve.co.uk>
3231
3232         * dirname.c [TEST_DIRNAME]: Update build instructions for test.
3233         Add test-cases for DOS filenames. Declare program_name.
3234         (main): Set up program_name.
3235
3236 2003-03-22  Jim Meyering  <jim@meyering.net>
3237
3238         * strftime.c (widen): Cast alloca return value to proper type.
3239
3240         * fnmatch_loop.c
3241         (NEW_PATTERN): Cast alloca return value to proper type.
3242         Otherwise, it wouldn't compile with at least /bin/cc on
3243         ymp-cray-unicos9.0.2.X.
3244         Combine two mostly-identical uses of alloca into one.
3245         Thanks to the Cray-Cyber project for access to a Cray Y-MP.
3246
3247 2003-03-19  Jim Meyering  <jim@meyering.net>
3248
3249         DJGPP doesn't have S_ISLNK, so provide a replacement.
3250         * ftw.c (S_IFMT): Define, if necessary.
3251         [STAT_MACROS_BROKEN]: Undefine S_ISLNK.
3252         (S_ISLNK): Define, if necessary.
3253         Based on a patch from Rich Dawe.
3254
3255         * exclude.h (PARAMS): Remove definition and uses.
3256         * exclude.c: Remove uses of `PARAMS'.
3257
3258         * fnmatch_.h: Don't define __const.
3259         (fnmatch): Use const, not __const in prototype.
3260         From Paul Eggert.
3261
3262 2003-03-17  Richard Dawe  <rich@phekda.freeserve.co.uk>
3263
3264         * fchdir-stub.c: New file: trivial stub for fchdir.
3265
3266 2003-03-18  Jim Meyering  <jim@meyering.net>
3267
3268         * mountlist.c (read_filesystem_list) [MOUNTED_VMOUNT]: Detect any
3269         error from mntctl.
3270         Use mntctl's return value to drive the entry-processing loop, since
3271         we can't rely on the value of the vmt_length member in the last
3272         entry.  On some systems doing so could result in exhausting
3273         virtual memory.  Based in part on a patch from Mike Jetzer.
3274
3275         * quote.c (quote_n): Fix typo in comment.
3276
3277 2003-03-17  Jim Meyering  <jim@meyering.net>
3278
3279         * raise.c (raise): Rename from rpl_raise.
3280         Without that change, systems lacking raise (SunOS 4) would not be
3281         able to link programs using raise.  Reported by Volker Borchert.
3282
3283         * ftw.c (FTW_STAT): Rename from `STAT', to avoid conflict
3284         with STAT definition from <sys/dir.h> on AIX 5.1.
3285         Suggestion from Mike Jetzer and Petter Reinholdtsen.
3286
3287         * fchown-stub.c (fchown): Put function type on its own line.
3288         * readlink-stub.c (readlink): Likewise.
3289         * lstat-stub.c (lstat): Likewise.
3290
3291 2003-03-14  Jim Meyering  <jim@meyering.net>
3292
3293         * Makefile.am (AUTOMAKE_OPTIONS): Remove definition --
3294         before it pointed to ../src/ansi2knr.  Some of these files
3295         have required an ANSI (c89) compiler for a year or two.
3296         (libfetish_a_SOURCES): Remove unused files: c-stack.c, c-stack.h.
3297
3298 2003-02-04  Dmitry V. Levin  <ldv@altlinux.org>
3299
3300         * stat.c: Include "xalloc.h".
3301
3302 2003-03-13  Paul Eggert  <eggert@twinsun.com>
3303
3304         Merge changes from Bison.
3305         * obstack.h: (__INT_TO_PTR) [__STDC__]: Cast result to
3306         (void *) to avoid diagnostic with native c89 on SGI IRIX 6.5
3307         when compiling Bison 1.875's `bitset bset = obstack_alloc
3308         (bobstack, bytes);'.  Problem reported by Nelson H. F. Beebe.
3309
3310 2003-01-30  Richard Dawe  <rich@phekda.freeserve.co.uk>
3311
3312         * fchown-stub.c: New file: trivial stub for fchown.
3313         * lstat-stub.c: New file: trivial stub for lstat.
3314         * readlink-stub.c: New file: trivial stub for readlink.
3315
3316 2003-03-09  Paul Eggert  <eggert@twinsun.com>
3317
3318         * argmatch.c (EXIT_FAILURE): Define if the system doesn't.
3319         Reported by Bruce Becker; see:
3320         http://mail.gnu.org/archive/html/bug-bison/2003-03/msg00017.html
3321
3322 2003-03-03  Paul Eggert  <eggert@twinsun.com>
3323             Bruno Haible  <bruno@clisp.org>
3324
3325         * mbswidth.h: Include <wchar.h>. Needed for UnixWare 7.1.1.
3326         Reported by John Hughes, see
3327         http://mail.gnu.org/archive/html/bug-bison/2003-02/msg00030.html
3328
3329 2003-03-09  Jim Meyering  <jim@meyering.net>
3330
3331         * ftw.c: Include "save-cwd.h".
3332         (ftw_startup): Avoid use of getcwd, if possible.
3333         Instead, use fopen/fchdir via save_cwd/restore_cwd.
3334
3335 2003-03-08  Jim Meyering  <jim@meyering.net>
3336
3337         * xnanosleep.c: Don't use `defined' in a #define directive.
3338
3339 2003-03-07  Jim Meyering  <jim@meyering.net>
3340
3341         * Makefile.am (libfetish_a_SOURCES): Remove mmap-stack.h.
3342
3343         * mmap-stack.c, mmap-stack.h: Remove files.
3344
3345         * getcwd.c: #undef getcwd only after *all* included header files.
3346         Declare getcwd unconditionally.  The problem was that same.h
3347         included config.h, and that defined getcwd to rpl_getcwd a second
3348         time (after the original #undef), and led to the rpl_getcwd
3349         function calling itself endlessly.  This was the cause of at least
3350         the `du' test failures on IRIX 6.5, reported by Nelson Beebe.
3351
3352         * same.h (same_name): Remove unnecessary inclusion of config.h.
3353         It also happened to lead to infinite recursion in getcwd.c.
3354         (PARAMS): Remove definition and use.
3355
3356 2003-03-06  Jim Meyering  <jim@meyering.net>
3357
3358         * ftw.c (ftw_startup): Declare `func' parameter to be of type
3359         NFTW_FUNC_T, not void* which may be smaller on 64-bit systems.
3360         Remove now-unnecessary cast.
3361         (FTW_NAME): Cast func argument to type `NFTW_FUNC_T'.
3362
3363 2003-03-05  Jim Meyering  <jim@meyering.net>
3364
3365         * physmem.c (ARRAY_SIZE): Define it.
3366
3367 2003-03-04  Jim Meyering  <jim@meyering.net>
3368
3369         * makepath.c (CLEANUP_CWD): Call error here, now that restore_cwd
3370         no longer does it.
3371
3372         * save-cwd.h (restore_cwd): Update prototype.
3373         * save-cwd.c (restore_cwd): Remove two parameters.
3374         Simplify.  Don't call error upon failure.  Let callers do that.
3375         (save_cwd): Mention that Irix 5.3 has the same problem as SunOS 4
3376         when auditing is enabled.  But don't bother updating the #if.
3377
3378         * xgetcwd.c (xgetcwd): Improve comment.
3379
3380         * getcwd.c: New file.
3381
3382 2003-02-28  Jim Meyering  <jim@meyering.net>
3383
3384         * ftw.c (ftw_startup): Return -1 if alloca fails.
3385
3386 2003-02-28  Jim Meyering  <jim@meyering.net>
3387
3388         * fts.c (fts_children): If opening `.' fails, set the fts_child
3389         member to NULL before returning.  From NetBSD.
3390
3391         * fts.c (fts_children): If fchdir fails, close file descriptor
3392         before returning.  From NetBSD.
3393
3394 2003-02-27  Jim Meyering  <jim@meyering.net>
3395
3396         * physmem.c (physmem_total, physmem_available): Add comments.
3397         From Kaveh Ghazi.
3398
3399         * physmem.c: Merge in portability changes from gcc/libiberty
3400         to support AIX, Tru64, and Windows.  See the ChangeLog there
3401         for credits and details.  Thanks to Kaveh Ghazi for helping
3402         to keep these files in sync.
3403
3404 2003-02-24  Jim Meyering  <jim@meyering.net>
3405
3406         * fts_.h [__USE_FILE_OFFSET64]: Remove #error directive.
3407
3408         (fts_open): Initialize local, tmp, to pacify gcc.
3409
3410         * fts_.h [struct FTS] (fts_dir_signatures): New, opaque member.
3411         * fts.c: Include <search.h>.
3412         (struct known_object): Define.
3413         (object_compare, add_object, find_object): New functions, like
3414         those in ftw.c.
3415         (fts_open): Initialize new member.
3416         (fts_close): Free memory allocated for new member.
3417         (fts_stat): Detect a cycle in O(logN) time per directory processed.
3418
3419         * fts.c [HAVE_CONFIG_H]: Include <config.h>.
3420         Conditionalize inclusion of <sys/param.h>.
3421         Conditionalize inclusion of <include/sys/stat.h> vs <sys/stat.h>.
3422         Include autoconf-recommended block of dirent/NAMELEN-related
3423         definitions and includes.  Use NAMLEN throughout, rather than
3424         _D_EXACT_NAMLEN.
3425         [_LIBC] (close, closedir, fchdir, open, opendir): Define.
3426         [_LIBC] (readdir, tdestroy, tfind, tsearch): Define.
3427         Remove `__' prefix from all uses of the above.  This will help
3428         to merge *BSD changes.
3429         [!_LIBC] (internal_function): Define.
3430         [! _LIBC && ! LSTAT_FOLLOWS_SLASHED_SYMLINK]: Define lstat.
3431         (__set_errno): Define if not already defined.
3432
3433         * fts.c: (fts_open): If fts_alloc returns NULL, don't dereference it.
3434         (fts_read): If fts_safe_changedir fails because it is not
3435         able to chdir into a subdirectory, then inform the caller.
3436
3437         * fts.c, fts_.h: New files, directly from glibc.
3438
3439 2003-02-23  Jim Meyering  <jim@meyering.net>
3440
3441         * fts_.h (struct _ftsent) [fts_level]: Change type from short to int,
3442         so it can handle a root-relative file name longer than 32K bytes.
3443         [fts_pathlen, fts_namelen]: Rearrange members to decrease size of
3444         this struct from 84 to 80 bytes.
3445
3446 2003-02-21  Jim Meyering  <jim@meyering.net>
3447
3448         * mmap-stack.h: Undefine HAVE_MMAP_STACK, thus disabling
3449         this code on all systems.
3450
3451         Merge in some changes from GNU libc.
3452         * md5.h (md5_uintptr): Define.
3453
3454         * ftw.c: Include <sys/types.h> before <dirent.h>.
3455         This is required for Apple Darwin 6.3 (MacOS 10.2.3).
3456         Patch by Nelson Beebe.
3457
3458 2003-02-19  Jim Meyering  <jim@meyering.net>
3459
3460         * md5.c: Merge in some clean-up and optimization changes from glibc.
3461         * sha.c: Apply those same changes here, too.
3462
3463 2003-02-18  Jim Meyering  <jim@meyering.net>
3464
3465         * md5.c (md5_stream) [BLOCKSIZE]: Move definition to top of file.
3466         Ensure that it is a multiple of 64.
3467         Rearrange loop exit tests so as to avoid performing an
3468         additional fread after encountering an error or EOF.
3469         * sha.c (sha_stream): Likewise.
3470         Reported by Michael Bacarella.
3471
3472         * Makefile.am (CLEANFILES): Remove ftw.h and search.h.
3473         (DISTCLEANFILES): Add them here.
3474         Add fnmatch.h, too.
3475
3476         * sha.c (sha_stream): Rearrange loop exit tests so as to avoid
3477         performing an additional fread after encountering an error or EOF.
3478
3479 2003-02-17  Jim Meyering  <jim@meyering.net>
3480
3481         * mmap-stack.h (RUN_WITH_BIG_STACK_4): Define.
3482
3483         * physmem.c: Undo most of last change.
3484         Use sysmp instead, since it provides a cleaner interface.
3485         From Kaveh Ghazi.
3486
3487 2003-02-16  Jim Meyering  <jim@meyering.net>
3488
3489         * Makefile.am (libfetish_a_SOURCES): Add mmap-stack.h.
3490
3491         * mmap-stack.c (MAP_ANONYMOUS): Use MAP_ANON, if possible.
3492         Initialize `fd' to -1, so Solaris' mmap works with MAP_ANON.
3493
3494 2003-02-15  Jim Meyering  <jim@meyering.net>
3495
3496         * mmap-stack.c, mmap-stack.h: New files.
3497         Let the caller run a function with a larger (mmap'd) stack.
3498
3499         Add Irix6 support to physmem.c.
3500         * physmem.c (irix_sysget): New function.
3501         (IRIX_SYSGET_TOTAL, IRIX_SYSGET_AVAILABLE): New macros.
3502         (physmem_total, physmem_available): Use them.
3503         (main) [DEBUG]: New function.
3504
3505 2003-02-11  Jim Meyering  <jim@meyering.net>
3506
3507         * Makefile.am (libfetish_a_SOURCES): Add euidaccess.h.
3508         * euidaccess.c: Include "euidaccess.h".
3509         * euidaccess.h: New file.
3510
3511 2003-02-08  Jim Meyering  <jim@meyering.net>
3512
3513         * ftw.c (ftw_startup): Don't shadow outer declaration of save_err.
3514         Merge inconsequential changes from libc.
3515
3516         * ftw.c (ftw_startup): When using FTW_CHDIR, always remember
3517         the current directory, not just when DIR contains a slash.
3518         Reported by Manoj Srivastava via Michael Stone as Debian bug #180228.
3519
3520 2003-02-07  Jim Meyering  <jim@meyering.net>
3521
3522         Merge inconsequential changes from libc.
3523         * ftw.c: Include limits.h earlier.
3524         Move PATH_MAX definition `down' a little; add comment.
3525         Rename local, saved_errno to save_err.
3526
3527 2003-02-06  Jim Meyering  <jim@meyering.net>
3528
3529         Support for pruning.
3530         * ftw_.h (FTW_DPRE) [enum]: New member and definition.
3531         (struct FTW) [skip]: New member.
3532
3533         * search_.h (__restrict): Define to `restrict' or to nothing.
3534
3535         * fsusage.c: Remove declaration of statfs.
3536         It conflicted with one from OSF/1 5.1 in <sys/mount.h>.
3537         Reported by Nelson Beebe.
3538
3539 2003-02-05  Jim Meyering  <jim@meyering.net>
3540
3541         Fix a heap-corruption bug that affected Solaris systems.
3542         * ftw.c: Include <limits.h>.
3543         (PATH_MAX): Define to 1024, if not already defined.
3544         (process_entry): Allocate enough space to hold the resulting
3545         file name.  Don't presume that 2*dirbufsize is enough.
3546         (ftw_startup): Always use PATH_MAX to compute buffer size, now that
3547         it is guaranteed to be defined.
3548         Nelson Beebe reported that du would sometimes segfault on Solaris.
3549
3550         * ftw.c (process_entry): When using FTW_DEPTH, call `func', the
3551         user-supplied callback, once for the current directory before calling
3552         ftw_dir, in case that part of the hierarchy should be pruned.
3553         `func' does that by setting `data->skip'.
3554         (ftw_startup): Likewise.
3555
3556 2003-02-02  Jim Meyering  <jim@meyering.net>
3557
3558         * ftw.c (lstat) [!_LIBC && !LSTAT_FOLLOWS_SLASHED_SYMLINK]:
3559         Define to rpl_lstat.
3560
3561 2003-01-25  Jim Meyering  <jim@meyering.net>
3562
3563         * ftw.c (ISSLASH, FILESYSTEM_PREFIX_LEN) [_LIBC]: Define.
3564         (base_name): New function.
3565         (ftw_startup): Don't strip trailing slashes.
3566         Use base_name to find the offset of the basename.
3567
3568 2003-01-25  Jim Meyering  <jim@meyering.net>
3569
3570         * ftw.c (object_compare): Compare inode numbers before device numbers.
3571         The former is much more likely to differ for any two given file objects.
3572
3573 2003-01-23  Jim Meyering  <jim@meyering.net>
3574
3575         * tsearch.c [HAVE_CONFIG_H]: Include <config.h>.
3576         Add autoconf-recommended block of alloca-related code.
3577         Cast each use of alloca to the required type, (node**).
3578
3579         * ftw.c: Add autoconf-recommended block of alloca-related code.
3580         [!_LIBC] (__getcwd): Define to xgetcwd and declare xgetcwd.
3581
3582 2003-01-22  Jim Meyering  <jim@meyering.net>
3583
3584         * ftw.c (find_object): Don't use c99-style struct initializer.
3585
3586         * ftw_.h: Change all uses of __const to const.
3587         * search_.h: Likewise.
3588
3589         * Makefile.am (CLEANFILES): Add generated files: ftw.h search.h.
3590
3591         * ftw.c (process_entry): Handle FTW_DCHP.
3592         (ftw_dir): Handle FTW_DCH.
3593
3594         * ftw_.h [!_LIBC && !__USE_XOPEN_EXTENDED]: Define __USE_XOPEN_EXTENDED
3595         and FTW_H_STANDALONE.
3596         [anon enum] (FTW_DCH, FTW_DCHP): New members.
3597         (FTW_DCH, FTW_DCHP): Define.
3598
3599         * ftw.c: Include autoconf-recommended block of dirent/NAMELEN
3600         related definitions and includes.  Use NAMELEN throughout,
3601         rather than _D_EXACT_NAMLEN.
3602         [_LIBC]: Define NAMELEN to _D_EXACT_NAMLEN.
3603         (stpcpy): Declare, if necessary.
3604         (mempcpy): Define, if necessary.
3605         [!_LIBC] (__stpcpy, __mempcpy): Define.
3606         [!_LIBC] (LXSTAT, XSTAT): Define.
3607
3608 2003-01-21  Jim Meyering  <jim@meyering.net>
3609
3610         * tsearch.c: New file, from GNU libc.
3611         [! weak_alias]: Define __-prefixed names to publicized ones.
3612         [! defined _LIBC] (weak_alias, internal_function): Define-away.
3613         [defined weak_alias]: Guard each use of weak_alias.
3614
3615 2003-01-20  Jim Meyering  <jim@meyering.net>
3616
3617         * canonicalize.c: Include "path-concat.h".
3618
3619         * search_.h: New file, from GNU libc.
3620
3621         * Makefile.am (libfetish_a_SOURCES): Use ftw_.h here, too.
3622         (libfetish_a_SOURCES): Add search_.h.
3623         * ftw_.h: Rename from ftw.h.
3624
3625         * obstack.h (obstack_object_size): Declare temporary, __o,
3626         to be const, in order to avoid warnings.
3627         (obstack_room): Likewise.
3628         (obstack_empty_p): Likewise.
3629
3630         Merge in changes from GNU libc
3631         * error.c: Eliminate many `#ifdef USE_IN_LIBIO' conditionals.
3632
3633 2003-01-19  Ulrich Drepper  <drepper@redhat.com>
3634
3635         From GNU libc.
3636         * strftime.c (my_strftime): Handle very large width
3637         specifications for numeric values correctly.  Improve checks for
3638         overflow.
3639
3640 2003-01-19  Jim Meyering  <jim@meyering.net>
3641
3642         * strftime.c (widen) [COMPILE_WIDE]: Merge nearly-identical definitions.
3643         (nl_get_alt_digit) [! defined my_strftime]: Define.
3644         (my_strftime) [_NL_CURRENT]: Merge nearly-identical uses of
3645         _nl_get_alt_digit and _nl_get_walt_digit.
3646
3647         * strftime.c (my_strftime): Merge in locale-related changes from libc.
3648         These changes have no effect outside of _LIBC.
3649
3650 2003-01-14  Jim Meyering  <jim@meyering.net>
3651
3652         * same.c (same_name): Declare *_basename locals to be `const'.
3653         Consolidate declarations and initializations of *_base* locals.
3654
3655 2003-01-11  Bruno Haible  <bruno@clisp.org>
3656
3657         * same.c (same_name): Reorder tests so as to avoid calling stat()
3658         when a string comparison is sufficient.
3659
3660 2003-01-11  Bruno Haible  <bruno@clisp.org>
3661
3662         * readtokens.c (readtoken): Cast character to 'unsigned char', not
3663         'unsigned int'.
3664
3665 2003-01-14  Jim Meyering  <jim@meyering.net>
3666
3667         * ftw.c: Merge in Ulrich's and my changes from libc.
3668
3669 2003-01-12  Jim Meyering  <jim@meyering.net>
3670
3671         * ftw.c (ftw_startup): Rename local-shadowing local to pacify gcc.
3672         Also work on systems that have `struct direct', using autoconf's
3673         AC_HEADER_DIRENT.
3674         Tweak comments.
3675
3676         * ftw.h, ftw.c: New files, from glibc/io.
3677
3678         * Makefile.am (libfetish_a_SOURCES): Add ftw.h.
3679
3680 2003-01-11  Jim Meyering  <jim@meyering.net>
3681
3682         * makepath.c: Don't test HAVE_ERRNO_H.  It's not necessary.
3683
3684         * canonicalize.c: Don't test HAVE_ERRNO_H.  It's not necessary.
3685         Don't test HAVE_STDDEF_H.  It's not necessary.
3686         Use definition of PTR_INT_TYPE from obstack.h.
3687
3688 2002-12-01  Dmitry V. Levin  <ldv@altlinux.org>
3689
3690         * canonicalize.c: New file.
3691         The readlink-based implementation imported from GNU C Library.
3692         The resolveip-based implementation imported from src/df.c (show_point).
3693         * canonicalize.h: New file.
3694         * Makefile.am (libfetish_a_SOURCES): Add canonicalize.h.
3695
3696 2003-01-10  Jim Meyering  <jim@meyering.net>
3697
3698         * save-cwd.h: Remove uses of PARAMS.
3699
3700 2002-11-30  Dmitry V. Levin  <ldv@altlinux.org>
3701
3702         * xgetcwd.h: New file.
3703         * Makefile.am (libfetish_a_SOURCES): Add xgetcwd.h.
3704         * save-cwd.c: Include "xgetcwd.h".
3705         * xgetcwd.c: Likewise.
3706
3707 2002-11-30  Dmitry V. Levin  <ldv@altlinux.org>
3708
3709         * getgroups.c: Don't declare functions declared by xalloc.h.
3710         Include "xalloc.h" instead.
3711         * group-member.c: Likewise.
3712         * idcache.c: Likewise.
3713         * readutmp.c: Likewise.
3714
3715 2003-01-08  Jim Meyering  <jim@meyering.net>
3716
3717         * full-write.c: Undefine and define-away `const' after inclusion
3718         of errno.h, not before.  Suggestion from Bruno Haible.
3719
3720 2003-01-06  Jim Meyering  <jim@meyering.net>
3721
3722         * full-write.c: Rework so that it may serve to define full_read, too.
3723         * full-read.c: Simply #define FULL_READ and include full-write.c.
3724
3725         * Makefile.am (libfetish_a_SOURCES): Add full-read.c and full-read.h.
3726         * full-read.c, full-read.h: New files.
3727
3728         Update from gnulib.
3729
3730         2002-12-10  Paul Eggert  <eggert@twinsun.com>
3731         Port exclude.c and exclude.h to more non-GNU systems, e.g. Solaris 7.
3732         * exclude.h (EXCLUDE_ANCHORED, EXCLUDE_INCLUDE, EXCLUDE_WILDCARDS):
3733         Choose values that are less likely to collide with system fnmatch
3734         options.
3735         * exclude.c (FNM_CASEFOLD, FNM_LEADING_DIR): Define to 0 if not
3736         defined (e.g., a pure POSIX system).
3737         (EXCLUDE_macros_do_not_collide_with_FNM_macros): Use FNM_PATHNAME
3738         instead of FNM_FILE_NAME, for compatibility with pure POSIX systems.
3739
3740         Update from gnulib.
3741
3742         * utime.c (utime_null): Use SAFE_READ_ERROR.
3743         (utime_null): No need to call ftruncate if the file was nonempty.
3744         * getdate.y (get_date): Test HAVE_STRUCT_TM_TM_ZONE, not HAVE_TM_ZONE.
3745         * canon-host.c (strdup): Remove unused declaration.
3746         * fsusage.c: Include full_read.h.
3747         (get_fs_usage): Use full_read instead of safe_read.
3748         Patches by Bruno Haible.
3749
3750 2003-01-04  Jim Meyering  <jim@meyering.net>
3751
3752         * version-etc.c: Update copyright date.
3753
3754 2002-12-31  Jim Meyering  <meyering@lucent.com>
3755
3756         * dev-ino.h: New file.
3757         * cycle-check.c: New file.
3758         * cycle-check.h: New file.
3759         * Makefile.am (libfetish_a_SOURCES): Add cycle-check.c, cycle-check.h,
3760         and dev-ino.h.
3761
3762 2002-12-21  Jim Meyering  <jim@meyering.net>
3763
3764         * stime.c: Remove file (for real, this time).
3765
3766 2002-12-15  Jim Meyering  <jim@meyering.net>
3767
3768         * strftime.h: New file, for declaration of nstrftime.
3769         * Makefile.am (libfetish_a_SOURCES): Add strftime.h.
3770
3771 2002-12-09  Jim Meyering  <jim@meyering.net>
3772
3773         * unlocked-io.h: Sync from gnulib.
3774
3775 2002-12-06  Jim Meyering  <jim@meyering.net>
3776
3777         * unlocked-io.h: New file, but with proper copyright notice and
3778         attribution.  Note: this is *not* the same as the file in gnulib.
3779         This uses #if HAVE_FUNC_UNLOCKED for each `FUNC', rather than
3780         HAVE_DECL_FUNC_UNLOCKED.  This usage is consistent with the autoconf
3781         macro in ../m4/jm-glibc-io.m4.  Modulo comments, this file still
3782         contains exactly what was generated by gen-uio.
3783
3784 2002-12-04  Paul Eggert  <eggert@twinsun.com>
3785
3786         Do not generate unlocked-io.h automatically, since it's easier to
3787         maintain it by hand.
3788
3789         * gen-uio: Remove.
3790         * Makefile.am: Add copyright notice.
3791         (libfetish_a_SOURCES): Add unlocked-io.h.
3792         (BUILT_SOURCES, all-local): Remove unlocked-io.h.
3793         (DISTCLEANFILES, io_functions): Remove macros.
3794         (EXTRA_DIST): Remove gen_uio.
3795         (unlocked-io.h): Remove rule.
3796
3797 2002-12-05  Paul Eggert  <eggert@twinsun.com>
3798
3799         * alloca.c [defined emacs]: Include "lisp.h".
3800         (xalloc_die) [defined emacs]: New macro.
3801         (free) [defined emacs && defined EMACS_FREE]: Define to EMACS_FREE.
3802         [! defined emacs]: Include <xalloc.h>.
3803         (POINTER_TYPE) [!defined POINTER_TYPE]: New macro.
3804         (pointer): Typedef to POINTER_TYPE *.
3805         (malloc): Remove decl; we now always use xmalloc.
3806         (alloca): Use old-style definition, since Emacs needs this.
3807         Check for arithmetic overflow when computing combined size.
3808
3809 2002-12-04  Jim Meyering  <jim@meyering.net>
3810
3811         Reflect the fact that stat.c and lstat.c are no longer generated.
3812         * Makefile.am (BUILT_SOURCES): Remove stat.c and lstat.c.
3813         (DISTCLEANFILES): Likewise.
3814         (EXTRA_DIST): Likewise.
3815         (all_local): Don't depend on stat.c or lstat.c.
3816         (stat.c, lstat.c): Remove rules.
3817         (EXTRA_DIST): Remove xstat.in.
3818
3819         * xstat.in: Remove file.  Contents moved into stat.c.
3820         * stat.c: Rework so that it may serve to define rpl_lstat, too.
3821         * lstat.c: Simply #define LSTAT and include stat.c.
3822
3823         * safe-read.c: Rework so that it may serve to define safe_write, too.
3824         * safe-write.c: Simply #define SAFE_WRITE and include safe-read.c.
3825
3826 2002-12-03  Jim Meyering  <jim@meyering.net>
3827
3828         * safe-read.h: Update from gnulib (add comments, include stddef.h).
3829
3830 2002-12-02  Jim Meyering  <jim@meyering.net>
3831
3832         * safe-read.c (EINTR): Define.
3833         (safe_read): Rewrite to iterate IFF the read fails with EINTR.
3834
3835 2002-12-01  Jim Meyering  <jim@meyering.net>
3836
3837         * safe-read.c: Merge from gnulib.
3838         (safe_read): Also exit the loop when read returns zero.
3839         (CHAR_BIT, TYPE_SIGNED, TYPE_MINIMUM, TYPE_MAXIMUM, INT_MAX): Define.
3840
3841         * Makefile.am (libfetish_a_SOURCES): Add safe-write.c and safe-write.h.
3842
3843         * strtoll.c: Update from gnulib (trivial changes).
3844         * strdup.c: Likewise.
3845         * strpbrk.c: Likewise.
3846         * strstr.c: Likewise.
3847         * tempname.c: Likewise.
3848         * obstack.c: Likewise.
3849         * getopt.c: Likewise.
3850         * getopt1.c: Likewise.
3851         * getopt.h: Likewise.
3852         * quote.h: Update from gnulib: add Copyright comment.
3853         * quote.c: Likewise.
3854
3855 2002-11-28  Jim Meyering  <jim@meyering.net>
3856
3857         * mktime.c: Merge from gnulib/libc, for a slightly uglier solution.
3858
3859         Merge some more, in preparation for merge back into libc.
3860         * error.c (_): Define only if not already defined.
3861         Move definition to follow all #include directives.
3862         Include unlocked-io.h only if !_LIBC.
3863
3864         Merge in changes from libc.
3865         * error.c [_LIBC]: Include <libio/libioP.h>.
3866         [USE_IN_LIBIO]: Include <libio/iolibio.h>
3867         (fflush): Tweak definition to use INTUSE.
3868         (putc): Define.
3869
3870 2002-11-23  Jim Meyering  <jim@meyering.net>
3871
3872         From gnulib, by Bruno Haible
3873         * closeout.c: Include gettext.h instead of <libintl.h>.
3874         * makepath.c: Likewise.
3875         * rpmatch.c: Likewise.
3876         * userspec.c: Likewise.
3877         * version-etc.c: Likewise.
3878         * xmemcoll.c: Likewise.
3879         * error.c [!_LIBC]: Include gettext.h instead of <libintl.h>.
3880
3881         * mbswidth.h: Update from gnulib.
3882         * mbswidth.c: Likewise.
3883         * localcharset.c: Likewise.
3884         * config.charset: Likewise.
3885         * unicodeio.c: Likewise.
3886
3887 2002-11-22  Paul Eggert  <eggert@twinsun.com>
3888
3889         * quotearg.h: Allow multiple inclusion by surrounding with
3890         "#ifndef QUOTEARG_H_".  Include <stddef.h>, for size_t,
3891         so that we can be included first.
3892         (PARAMS): Remove; we now assume C89 or later.  All uses removed.
3893         * quotearg.c: Include quotearg.h immediately after config.h.
3894         No need to include stddef.h or sys/types.h any more.
3895         Surround local include files with "", not "<>".
3896         Assume HAVE_LIMITS_H unconditionally, as we assume C89.
3897         Similarly, assume HAVE_C_BACKSLASH_A, CHAR_BIT, UCHAR_MAX, UINT_MAX,
3898         HAVE_STDLIB_H, HAVE_STRING_H, STDC_HEADERS.
3899         (HAVE_MBSINIT): Undef if !HAVE_MBRTOWC.
3900         (mbsinit): Define to 1 if !defined mbsinit && !HAVE_MBSINIT.
3901         (ISPRINT): Remove; no longer needed now that we assume C89.
3902
3903         (clone_quoting_options, quotearg_buffer, quotearg_n_options):
3904         Preserve errno.
3905
3906         (quotearg_buffer_restyled, quotearg_n, quotearg_n_style,
3907         quotearg_char): Use SIZE_MAX rather than
3908         (size_t) -1 when we are talking about "infinity".
3909
3910         (quotearg_buffer_restyled): Fix bug when quoting trigraphs.
3911
3912 2002-11-22  Jim Meyering  <jim@meyering.net>
3913
3914         From gnulib.
3915         * strstr.c: Don't include <sys/types.h>.  It's unnecessary.
3916
3917 2002-11-21  Bruno Haible  <bruno@clisp.org>
3918
3919         Remove case insensitive option matching.
3920         * argmatch.h (argcasematch): Remove declaration.
3921         (ARGCASEMATCH): Remove macro.
3922         (__xargmatch_internal): Remove case_sensitive argument.
3923         (XARGMATCH): Update.
3924         (XARGCASEMATCH): Remove macro.
3925         * argmatch.c (argmatch): Renamed from __argmatch_internal. Remove
3926         case_sensitive argument.
3927         (argcasematch): Remove function.
3928         (__xargmatch_internal): Remove case_sensitive argument.
3929         (main): Use XARGMATCH instead of XARGCASEMATCH.
3930
3931         * argmatch.c: Include gettext.h instead of <locale.h> and <libintl.h>.
3932
3933 2002-11-21  Bruno Haible  <bruno@clisp.org>
3934
3935         * xmalloc.c: Change compile-time error message. Add comment about
3936         required autoconf version.
3937         * xmalloc.c: Include gettext.h instead of <libintl.h>.
3938         (textdomain): Remove definition.
3939
3940 2002-11-21  Jim Meyering  <jim@meyering.net>
3941
3942         * strdup.c (strdup): Merge in changes from gnulib; mainly to
3943         use memcpy rather than strcpy.
3944
3945         * strcspn.c: Update from gnulib.
3946
3947         * sig2str.c (str2signum): Use unsigned, not size_t, for type of index.
3948
3949         * quotearg.c: Use `"'s when including quotearg.h and xalloc.h,
3950         not the `<...>' notation.
3951         Include <errno.h> and declare errno if necessary.
3952
3953         * README: Update from gnulib.
3954
3955 2002-11-20  Paul Eggert  <eggert@twinsun.com>
3956
3957         Merge argmatch cleanups from Bison.  Assume C89.
3958
3959         * argmatch.c: Include config.h here, not in argmatch.h.
3960         Include stdlib.h, for EXIT_FAILURE.
3961         Always include <string.h>, since we assume C89.
3962         (EXIT_FAILURE): Remove pre-C89 bug workaround.
3963         * argmatch.h: Do not include <config.h> or <sys/types.h>.
3964         Include <stddef.h> instead, since it's all we need for size_t.
3965         (PARAMS): Remove.  All uses removed.
3966         (ARRAY_CARDINALITY): Do not bother to #undef.
3967         (ARRAY_CARDINALITY, ARGMATCH, ARGCASEMATCH, invalid_arg,
3968         ARGMATCH_VALID, XARGMATCH, XARGCASEMATCH):
3969         Remove unnecessary parentheses.
3970         (ARGMATCH_VALID, XARGMATCH, XARGCASEMATCH):
3971         Insert necessary parentheses.
3972         (ARGMATCH_CONSTRAINT, ARGMATCH_VERIFY): New macros.
3973         (ARGMATCH_ASSERT): Use ARGMATCH_CONSTRAINT.
3974
3975 2002-11-19  Jim Meyering  <jim@meyering.net>
3976
3977         Be careful not to clobber errno.
3978         * quotearg.c (quotearg_buffer_restyled): If mbrtowc returns
3979         `(size_t) -1' (at which point it would also set errno to EILSEQ),
3980         then restore errno to its previous value.
3981         Reported by Phillip Jones via Tim Waugh as
3982         https://bugzilla.redhat.com/bugzilla/show_bug.cgi?id=76334.
3983
3984         Avoid a link-time failure on some Linux systems.
3985         * mktime.c (STATIC): Define to be empty (_LIBC) or `static' (otherwise).
3986         (__mon_yday): Declare with the STATIC attribute.
3987         (__mktime_internal): Likewise.
3988         Based on a report from Greg Schafer.
3989
3990 2002-11-14  Jim Meyering  <jim@meyering.net>
3991
3992         * long-options.c: Don't include libintl.h, and don't define `_' --
3993         they're not used.
3994         * same.c: Likewise.
3995
3996 2002-11-10  Jim Meyering  <jim@meyering.net>
3997
3998         * raise.c: New file.
3999
4000 2002-11-08  Paul Eggert  <eggert@twinsun.com>
4001
4002         * human.c (human_readable): Revamp to avoid warning about unused
4003         variable 'amt'.  Unfortunately this means using some gotos.
4004
4005 2002-11-08  Jim Meyering  <jim@meyering.net>
4006
4007         * human.c (human_readable): Avoid warnings from gcc -Wshadow.
4008
4009 2002-11-06  Jim Meyering  <jim@meyering.net>
4010
4011         * Makefile.am (EXTRA_DIST): Add inttostr.h.
4012
4013 2002-10-07  Paul Eggert  <eggert@twinsun.com>
4014
4015         * Makefile.am (libfetish_a_SOURCES): Add imaxtostr.c, offtostr.c,
4016         umaxtostr.c.
4017         (EXTRA_DIST): Add inttostr.c.
4018         * inttostr.c, inttostr.h, imaxtostr.c, offtostr.c, umaxtostr.c:
4019         New files, taken from GNU tar.
4020
4021         * human.c, human.h: Rewrite to support locale-specific
4022         notations like thousands separators.
4023         Specify what includer of include.h must include beforehand.
4024         (human_group_digits, human_suppress_point_zero, human_autoscale,
4025         human_base_1024, human_SI, human_B): New enum values.
4026         (human_readable): Rename from human_readable_inexact; put the
4027         options before the sizes.  All uses changed.  The old human_readable
4028         function has been removed; use inttostr.h instead.
4029         (human_options): Renamed from human_block_size, with new signature
4030         that allows block sizes up to UINTMAX_MAX.  All callers changed.
4031
4032 2002-10-13  Jim Meyering  <jim@meyering.net>
4033
4034         * xnanosleep.c (initialized): Remove declaration now that it's unused.
4035
4036 2002-10-12  Paul Eggert  <eggert@twinsun.com>
4037
4038         * xnanosleep.c: There's no need to futz with the rounding mode,
4039         since the code should work properly even in the default rounding mode.
4040         (<fenv.h>): Do not include.
4041         (#pragma STDC FENV_ACCESS ON): Remove.
4042         (xnanosleep): Don't futz with rounding state.
4043
4044 2002-10-06  Jim Meyering  <jim@meyering.net>
4045
4046         * safe-read.c (safe_read): Change type of function
4047         from ssize_t to size_t.
4048         * safe-read.h: Update prototype.
4049         (SAFE_READ_ERROR): Define.
4050
4051 2002-09-28  Jim Meyering  <jim@meyering.net>
4052
4053         * makepath.c (make_path): Restore umask *before* creating the final
4054         component.
4055
4056 2002-09-25  Paul Eggert  <eggert@twinsun.com>
4057
4058         * fsusage.c [! HAVE_INTTYPES_H && HAVE_STDINT_H] Include <stdint.h>.
4059         (UINTMAX_MAX) [!defined UINTMAX_MAX]: New macro.
4060         (PROPAGATE_ALL_ONES): Work even if X is unsigned and narrower than
4061         int.  Work more efficiently if X is the same width as uintmax_t.
4062         Do not compare X to -1, to avoid bogus compiler warning.
4063         (get_fs_usage): (uintmax_t) -1 -> UINTMAX_MAX to avoid a cast.
4064         Don't assume that f_frsize and f_bsize are the same type.
4065
4066 2002-09-25  Jim Meyering  <jim@meyering.net>
4067
4068         * fsusage.c: Remove unneeded parentheses around operands of `defined'.
4069
4070         * safe-read.c (safe_read): Make comment more precise:
4071         upon error, it returns -1.
4072
4073 2002-09-22  Jim Meyering  <jim@meyering.net>
4074
4075         * makepath.c (make_path): Minor reformatting.
4076
4077 2002-09-14  Paul Eggert  <eggert@twinsun.com>
4078
4079         * xnanosleep (xnanosleep): Return -1 on failure, not 1,
4080         for consistency with nanosleep.  Check errno after nanosleep
4081         returns -1.
4082
4083 2002-09-11  Jim Meyering  <jim@meyering.net>
4084
4085         * xnanosleep.c, xnanosleep.h: New files, factored out of sleep.c.
4086         * Makefile.am (libfetish_a_SOURCES): Add them.
4087
4088 2002-09-04  Jim Meyering  <jim@meyering.net>
4089
4090         * addext.c (addext): Add a cast to avoid gcc's warning about
4091         `comparison between signed and unsigned'.
4092
4093         * sig2str.c (str2signum, sig2str): Declare loop index variables to be
4094         of type size_t so that they match type of upper bound, thus avoiding
4095         warning about `comparison between signed and unsigned'.
4096
4097 2002-08-31  Jim Meyering  <jim@meyering.net>
4098
4099         * mktime.c: Update from GNU libc.
4100         * obstack.c: Likewise.
4101         * getopt.c: Likewise.
4102         * getopt1.c: Likewise.
4103
4104 2002-08-05  Paul Eggert  <eggert@twinsun.com>
4105
4106         Fix some minor time-related bugs with POSIX time arguments.
4107         Some valid time stamps were being rejected (notably -1, and
4108         time stamps before 1900 on 64-bit hosts).  And some invalid
4109         time stamps were being accepted, e.g. September 31.
4110
4111         * posixtm.h (posixtime): Return bool instead of time_t, so
4112         that we can return (time_t) -1 successfully.
4113         * posixtm.c: Likewise.
4114         [HAVE_STDBOOL_H]: Include <stdbool.h>.
4115         (bool, false, true) [!HAVE_STDBOOL_H]: New type.
4116         (t): Remove static var.
4117         (year, posix_time_parse): Now takes struct tm * arg to modify, instead
4118         of static var.  All uses changed.
4119         (year): Do not reject years before 1900; they can occur with
4120         64-bit time_t.
4121         (posix_time_parse): Do not check for out-of-range components;
4122         that is now the caller's responsibility, since our checks were
4123         only approximations.
4124         (posixtime): Use mktime to check for out-of-range components,
4125         since it knows them exactly.
4126         If mktime returns (time_t) -1, check whether an error actually occurred
4127         by invoking localtime on -1.
4128         (main) [TEST_POSIXTIME]: Check for input data errors, and report
4129         posixtime failures better.
4130         Improve the test data (in comments only).
4131
4132 2002-07-27  Jim Meyering  <jim@meyering.net>
4133
4134         * readutmp.h: If we have both utmpx.h and utmp.h, and there exists
4135         the utmp.ut_exit member, but not the utmpx.ut_exit member, then
4136         undefine HAVE_UTMPX_H.  For AIX 4.3.3.  Doing all this in cpp is
4137         a big kludge; someday we'll put the brains in an autoconf macro.
4138         (UT_EXIT_E_TERMINATION, UT_EXIT_E_EXIT): Define.
4139
4140 2002-07-20  Jim Meyering  <jim@meyering.net>
4141
4142         * xmalloc.c: Adjust to work with new autoconf macros, AC_FUNC_MALLOC
4143         and AC_FUNC_REALLOC: test #ifndef HAVE_MALLOC/HAVE_REALLOC.
4144
4145         * gettext.h: Upgrade to gettext-0.11.3.
4146
4147 2002-07-13  Bruno Haible  <bruno@clisp.org>
4148
4149         * xstat.in: Include <string.h>.
4150         * mountlist.c: #undef MNT_IGNORE before defining it, to avoid warning
4151         on FreeBSD.
4152
4153 2002-07-09  Jim Meyering  <jim@meyering.net>
4154
4155         * mountlist.h (ME_DUMMY): Don't count entries of type `auto' as dummy
4156         ones.  At least on GNU/Linux systems, `auto' means something else.
4157         From Michael Stone.
4158
4159 2002-07-01  Jim Meyering  <jim@meyering.net>
4160
4161         * c-stack.c: Include sys/time.h.
4162         From Volker Borchert.
4163
4164 2002-06-11  Paul Eggert  <eggert@twinsun.com>
4165
4166         * fnmatch.c, fnmatch_loop.c (WIDE_CHAR_SUPPORT):
4167         New macro.  Use it uniformly instead of
4168         (defined HAVE_WCTYPE_H && defined HAVE_WCHAR_H).
4169         It also uses HAVE_BTOWC, to fix a porting bug on Solaris 2.5.1
4170         reported by Vin Shelton.
4171
4172 2002-06-22  Jim Meyering  <jim@meyering.net>
4173
4174         * fnmatch.c (ISASCII, ISPRINT): Undefine, to avoid warning about
4175         redefinition due to Solaris 2.6's definition in /usr/include/sys/euc.h.
4176
4177 2002-06-22  Paul Eggert  <eggert@twinsun.com>
4178
4179         * c-stack.h (segv_handler, c_stack_action) [! defined SA_SIGINFO]:
4180         Do not assume SA_SIGINFO behavior.
4181         Bug reported by Jim Meyering on NetBSD 1.5.2.
4182
4183 2002-06-22  Jim Meyering  <jim@meyering.net>
4184
4185         * c-stack.c, c-stack.h: New files, from diffutils-2.8.2.
4186
4187         * exitfail.c, exitfail.h: Likewise.
4188         * Makefile.am (libfetish_a_SOURCES): Add exitfail.c and exitfail.h.
4189
4190         * Makefile.am (libfetish_a_SOURCES): Add fnmatch_.h in place
4191         of fnmatch.h.
4192         (EXTRA_DIST): Add fnmatch_loop.c.
4193         (libfetish_a_SOURCES): Add c-stack.c and c-stack.h.
4194
4195         * fnmatch_loop.c: New file, from diffutils-2.8.2.
4196         * fnmatch.c: Update from diffutils-2.8.2.
4197         * fnmatch_.h: New file.  From diffutils-2.8.2.
4198         * fnmatch.h: Remove file.
4199
4200 2002-06-18  Paul Eggert  <eggert@twinsun.com>
4201
4202         * file-type.h: Report an error if neither S_ISREG nor
4203         S_IFREG is defined, instead of using a test specific to glibc
4204         2.2.  This should be safe, since POSIX requires S_ISREG and
4205         Unix Version 7 had S_IFREG.  We don't need to check for
4206         <sys/types.h> since we don't use any symbols that it defines.
4207
4208 2002-06-15  Jim Meyering  <jim@meyering.net>
4209
4210         * file-type.h (FILE_TYPE_H): Guard entire contents with #ifndef.
4211         For GNU libc 2.2 and newer, ensure that <sys/types.h> and <sys/stat.h>
4212         have been included before this file.
4213
4214 2002-06-13  Richard Dawe  <richdawe@bigfoot.com>
4215
4216         * Makefile.am (lstat.c, stat.c, .sin.sed): Use t-$@, rather than $@-t,
4217         so that each temporary file name is unique and valid in the first
4218         8 characters, for operation under DOS.
4219
4220 2002-06-15  Jim Meyering  <jim@meyering.net>
4221
4222         Work even with DJGPP 2.03, which lacks support for symlinks.
4223         From Richard Dawe.
4224         * xstat.in (S_ISLNK): Define to 0 if neither S_ISLNK nor S_IFLNK
4225         is defined.
4226         * lchown.c (S_ISLNK): Likewise.
4227
4228 2002-06-14  Jim Meyering  <jim@meyering.net>
4229
4230         * file-type.h: Use the version from diffutils-2.8.2.
4231         * file-type.c: Likewise.
4232
4233 2002-05-27  Jim Meyering  <jim@meyering.net>
4234
4235         Fix a problem seen only on nonconforming systems whereby ls.c's
4236         use of localtime, and then of gettimeofday would cause trouble:
4237         the localtime call used to initialize rpl_gettimeofday's save
4238         mechanism would clobber ls's current local time information so
4239         that in any long listing the first file would always be listed
4240         with date 1970-01-01.  Analysis by Volker Borchert.
4241
4242         * gettimeofday.c (localtime): Undefine.
4243         (rpl_localtime): New function.
4244
4245 2002-05-22  Jim Meyering  <jim@meyering.net>
4246
4247         * Makefile.am (libfetish_a_SOURCES): Add file-type.c and file-type.h.
4248         * file-type.h: New file.
4249         * file-type.c (file_type): New file/function.  Extracted from diffutils.
4250
4251 2002-04-29  Paul Eggert  <eggert@twinsun.com>
4252
4253         * hard-locale.c: Upgrade to version used in GNU Diffutils 2.8.1.
4254
4255 2002-04-28  Paul Eggert  <eggert@twinsun.com>
4256
4257         * sig2str.h (SIGNUM_BOUND): Do not use WTERMSIG, to avoid
4258         depending on <sys/wait.h> and WTERMSIG.  Default to 64 instead
4259         of 127, since 64 is the largest conceivable number for ancient
4260         nonstandard hosts.
4261         * sig2str.c: Do not include <sys/wait.h>; no longer needed.
4262
4263 2002-04-28  Jim Meyering  <jim@meyering.net>
4264
4265         * sig2str.c (WTERMSIG): Remove definition (unused).
4266
4267 2002-04-28  Paul Eggert  <eggert@twinsun.com>
4268
4269         * sig2str.h, sig2str.c: New files.
4270         * Makefile.am (libfetish_a_SOURCES): Add sig2str.h.
4271
4272 2002-04-24  Jim Meyering  <jim@meyering.net>
4273
4274         * gettext.h: New file, from Gettext.
4275         * Makefile.am (INCLUDES): Remove -I../intl.
4276         (libfetish_a_SOURCES): Add gettext.h.
4277
4278 2002-04-16  Jim Meyering  <jim@meyering.net>
4279
4280         * readutmp.h (UT_TYPE): Remove definition (now in who.c).
4281         (HAVE_STRUCT_XTMP_UT_EXIT, HAVE_STRUCT_XTMP_UT_ID): Define.
4282         (HAVE_STRUCT_XTMP_UT_PID, HAVE_STRUCT_XTMP_UT_TYPE): Define.
4283
4284 2002-04-12  Jim Meyering  <jim@meyering.net>
4285
4286         * dirfd.h (dirfd): Elide prototype if dirfd is a macro.
4287
4288 2002-03-10  Jim Meyering  <jim@meyering.net>
4289
4290         * makepath.c (make_path): Remove a comma from a diagnostic.
4291         Suggestion from Santiago Vila.
4292
4293 2002-03-08  Jim Meyering  <jim@meyering.net>
4294
4295         * rename.c: Mention that this wrapper is needed also on
4296         mips-dec-ultrix4.4 systems.
4297
4298 2002-03-02  Jim Meyering  <jim@meyering.net>
4299
4300         * gettime.c (gettime): Test HAVE_CLOCK_GETTIME,
4301         not HAVE_CLOCK_SETTIME.
4302
4303 2002-02-27  Paul Eggert  <eggert@twinsun.com>
4304
4305         * nanosleep.h: Rename to....
4306         * timespec.h: New name for nanosleep.h.  All uses changed.
4307
4308         * gettime.c: New file.
4309         * settime.c: New file.
4310         * stime.c: Remove.
4311
4312         * Makefile.am (libfetish_a_SOURCES): Add gettime.c, settime.c,
4313         timespec.h.  Remove nanosleep.h.
4314
4315 2002-02-25  Paul Eggert  <eggert@twinsun.com>
4316
4317         * acl.c, acl.h: New files.
4318         * Makefile.am (libfetish_a_SOURCES): Add acl.h, acl.c.
4319
4320 2002-02-24  Jim Meyering  <jim@meyering.net>
4321
4322         * strnlen.c (strnlen): Define-away/undef so that an inconsistent
4323         prototype in string.h (on at least AIX4.3.2.0 w/gcc-2.95.3) doesn't
4324         cause trouble.  Reported by Nelson Beebe.
4325
4326 2002-02-23  Paul Eggert  <eggert@twinsun.com>
4327
4328         * path-concat.c (xpath_concat): Reorder code to pacify
4329         compilers that don't know that xalloc_die never returns.
4330
4331 2002-02-20  Jim Meyering  <jim@meyering.net>
4332
4333         * getdate.c: Regenerate using bison-1.33.
4334
4335 2002-02-15  Paul Eggert  <eggert@twinsun.com>
4336
4337         * posixver.c, posixver.h: New files.
4338         * Makefile.am (libfetish_a_SOURCES): Add them.
4339
4340 2002-02-02  Paul Eggert  <eggert@twinsun.com>
4341             Bruno Haible  <bruno@clisp.org>
4342
4343         * unicodeio.h (print_unicode_char): Add exit_on_error argument.
4344         (fwrite_success_callback): New declaration.
4345         * unicodeio.c (unicode_to_mb): New function, extracted from
4346         print_unicode_char. Call failure callback instead of error.
4347         (fwrite_success_callback): New function.
4348         (exit_failure_callback): New function.
4349         (fallback_failure_callback): New function.
4350         (print_unicode_char): Call unicode_to_mb.
4351
4352 2002-01-26  Jim Meyering  <jim@meyering.net>
4353
4354         * Makefile.am (getdate$U.o): Depend on unlocked-io.h.
4355
4356 2002-01-22  Jim Meyering  <jim@meyering.net>
4357
4358         * Makefile.am (Makefile): Don't depend on $(BUILT_SOURCES).
4359         Otherwise, some versions of automake would omit the rule that makes
4360         Makefile from Makefile.in.
4361
4362 2001-01-21  Paul Eggert  <eggert@twinsun.com>
4363
4364         * xmemcoll.h, xmemcoll.c: New files.
4365         * Makefile.am (libfetish_a_SOURCES): Add them.
4366         * memcoll.c: Include errno.h, and declare errno if not defined.
4367         (memcoll): Set errno to zero if there is no error.
4368
4369         * quotearg.c (quotearg_buffer_restyled):
4370         Fix bug with quoting buffers containing NUL when backslashing escapes.
4371         This bug was exposed by the other changes in this patch.
4372         (quotearg_n_options): New arg ARGSIZE.
4373         All callers changed.
4374         (quoting_options_from_style): New function.
4375         (quotearg_n_style): Use it.
4376         (quotearg_n_style_mem): New function.
4377
4378         * quotearg.h (quotearg_n_style_mem): New function.
4379
4380 2002-01-16  Jim Meyering  <jim@meyering.net>
4381
4382         * getdate.y: Add three semicolons, each just before a closing brace.
4383         Bison (as of version 1.31) no longer papers over that mistake.
4384
4385 2002-02-14  Paul Eggert  <eggert@twinsun.com>
4386
4387         * backupfile.c (ISDIGIT): Comment fix.
4388         * getdate.y (ISDIGIT): Likewise.
4389         * posixtm.c (ISDIGIT, year): Likewise.
4390         * strverscmp.c (ISDIGIT): Likewise.
4391         * userspec.c (ISDIGIT): Likewise.
4392
4393 2002-01-05  Jim Meyering  <jim@meyering.net>
4394
4395         * version-etc.c (version_etc_copyright): Update copyright year.
4396
4397 2001-01-19  Paul Eggert  <eggert@twinsun.com>
4398
4399         * closeout.c (close_stdout_status): If ferror (stdout), do
4400         not silently exit merely because the output buffer happens to
4401         have nothing pending.
4402
4403 2001-12-18  Paul Eggert  <eggert@twinsun.com>
4404
4405         See the big note in ../ChangeLog.
4406         * human.c (suffixes): Prefer K to k for 1024.
4407         (generate_suffix_backwards): New function.
4408         (human_readable_inexact): Use it.
4409         * xstrtol.c (__xstrtol): If there is no number but there
4410         is a valid suffix, assume 1.  "MB" now means decimal, "MiB" binary.
4411         Accept 'K' as well as 'k'.
4412
4413 2001-12-15  Jim Meyering  <jim@meyering.net>
4414
4415         * regex.h (__restrict_arr): Update from libc.
4416
4417         * mountlist.h (ME_REMOTE): Recognize file systems of type smbfs
4418         as `remote' if the name starts with `//'.  Suggested by Michael Stone.
4419         (STREQ): Define.
4420
4421 2001-12-10  Jim Meyering  <jim@meyering.net>
4422
4423         * linebuffer.c: Remove explicit declarations of xmalloc and xrealloc,
4424         Instead, include "xalloc.h".
4425         (initbuffer): Don't cast xmalloc return value to char*.
4426         (readline): Reword comment.
4427         Don't cast xrealloc return value to char*
4428         Return NULL, not 0.
4429
4430 2001-12-09  Jim Meyering  <jim@meyering.net>
4431
4432         * modechange.c (mode_compile): Add cast to avoid pedantic warning about
4433         `signed and unsigned type in conditional expression'.
4434         * posixtm.c (posix_time_parse): Likewise.
4435
4436         * xreadlink.c (xreadlink): Add cast to avoid a pedantic warning.
4437
4438         * readtokens.c (readtoken): Declare an index to be of type unsigned
4439         to avoid a pedantic warning.
4440
4441         * getstr.c: Don't include assert.h.
4442         (getstr): Remove warning-evoking assertions.
4443         Return -1 if offset parameter is out of bounds.
4444         Change the type of a local from int to size_t.
4445
4446         * strftime.c (my_strftime_localtime_r): Include this function
4447         definition in the `#if ! HAVE_TM_GMTOFF' block.
4448
4449         * xgethostname.c: Remove declarations of xmalloc and xrealloc.
4450         Include xalloc.h instead.
4451
4452 2001-12-02  Jim Meyering  <jim@meyering.net>
4453
4454         * tempname.c: Don't declare getenv, thus reverting the change of
4455         2001-11-18.  It's no longer necessary, now that stdlib.h is always
4456         included.
4457
4458         * regex.c [!__BOUNDED_POINTERS__]: Define away __bounded,
4459         __unbounded, and __ptrvalue.  Reported by Uwe H. Steinfeld.
4460
4461 2001-11-30  Akim Demaille  <akim@epita.fr>
4462
4463         * xstrdup.c: Include xalloc.h, so that xstrdup is declared
4464         before being defined.
4465
4466 2001-11-27  Paul Eggert  <eggert@twinsun.com>
4467
4468         * quotearg.h (quotearg_n, quotearg_n_style):
4469         First arg is int, not unsigned.
4470         * quotearg.c (quotearg_n, quotearg_n_style): Likewise.
4471         (SIZE_MAX, UINT_MAX): New macros.
4472         (quotearg_n_options): Abort if N is negative.
4473         Avoid overflow check on hosts where size_t is 64 bits and int
4474         is 32 bits, as overflow is impossible there.
4475         Fix off-by-one typo that caused unnecessary reallocation.
4476
4477 2001-11-27  Jim Meyering  <jim@meyering.net>
4478
4479         * tempname.c: Merge with version from libc.
4480         * regex.c: Likewise.
4481
4482         * tempname.c: Include stdlib.h unconditionally.  On some old systems
4483         for which STDC_HEADERS is 0, it was not included, resulting in a
4484         warning about an integer-to-pointer conversion problem with getenv.
4485         Reported by Volker Borchert.
4486
4487 2001-11-26  Jim Meyering  <jim@meyering.net>
4488
4489         * gtod.h: Remove file.
4490         * Makefile.am (libfetish_a_SOURCES): Remove gtod.h.
4491         * gettimeofday.c: Don't include gtod.h.
4492         (GTOD_init): Remove function.
4493         (rpl_gettimeofday): Do its job here instead, rather than aborting.
4494         Suggestion from Volker Borchert.
4495
4496 2001-11-23  Jim Meyering  <jim@meyering.net>
4497
4498         * hash.h (struct hash_table): Don't define here.  Merely declare it.
4499         * hash.c (struct hash_table): Define it here instead.
4500
4501 2001-11-22  Jim Meyering  <jim@meyering.net>
4502
4503         * hash.h: Bracket contents of file with #ifndef HASH_H_ ... #endif.
4504
4505 2001-11-18  Paul Eggert  <eggert@twinsun.com>
4506
4507         * tempname.c (TMP_MAX): Remove; no longer needed.
4508         (TEMPORARIES): New macro.
4509         (__gen_tempname): Use TEMPORARIES rather than TMP_MAX.  This
4510         removes an artificial limitation (e.g. HP-UX 10.20, where
4511         TMP_MAX is 17576).
4512
4513 2001-11-18  Jim Meyering  <jim@meyering.net>
4514
4515         * tempname.c [!HAVE_DECL_GETENV]: Declare getenv to avoid warning
4516         on SunOS 4.
4517
4518         * Makefile.am (Makefile): Depend on $(BUILT_SOURCES), so those
4519         files will be created before anything else.
4520
4521 2001-11-17  Jim Meyering  <jim@meyering.net>
4522
4523         * modechange.c (mode_adjust): Fix error introduced on 1999-04-26
4524         that made e.g., `chmod a=,o=w,g=o F' cause F to be group readable
4525         rather than group writable.  Patch by Juan F. Codagnone.
4526
4527         * readtokens.c: Remove explicit declarations of xmalloc and xrealloc,
4528         Instead, include "xalloc.h".
4529
4530         * mountlist.c: Include unlocked-io.h after all system headers.
4531         Remove explicit declarations of xmalloc, xrealloc,
4532         and xstrdup.  Instead, include "xalloc.h".
4533
4534         * argmatch.c, closeout.c, error.c, exclude.c: Include unlocked-io.h.
4535         * fatal.c, getdate.y, getpass.c, getstr.c, getusershell.c: Likewise.
4536         * mountlist.c, posixtm.c, readtokens.c, readutmp.c: Likewise.
4537
4538         * regex.c, sha.c, version-etc.c, yesno.c: Likewise.
4539         Reported by Padraig Brady.
4540
4541         * mkstemp.c: #undef mkstemp.
4542         Include config.h.
4543         (rpl_mkstemp): Rename from mkstemp.
4544         Protoize.
4545
4546 2001-11-16  Jim Meyering  <jim@meyering.net>
4547
4548         * physmem.c [HAVE_SYS_PSTAT_H]: Include <sys/pstat.h>.
4549         (physmem_total) [HAVE_PSTAT_GETSTATIC]: If sysconf couldn't be used to
4550         determine the amount of total physical memory, use pstat_getstatic.
4551         HPUX-11 doesn't define _SC_PHYS_PAGES.
4552         (physmem_available) [HAVE_PSTAT_GETSTATIC && HAVE_PSTAT_GETDYNAMIC]:
4553         If sysconf couldn't be used to determine the amount of available
4554         physical memory, use both pstat_getstatic and pstat_getdynamic.
4555         Based on a patch from Bob Proulx.
4556
4557 2001-11-05  Jim Meyering  <jim@meyering.net>
4558
4559         * xstat.in (slash_aware_lstat): Correct a misleading comment.
4560
4561 2001-11-03  Jim Meyering  <jim@meyering.net>
4562
4563         * argmatch.h (ARGMATCH_TO_ARGUMENT): Remove casts of first two args
4564         in argmatch_to_argument call.
4565
4566         * dirfd.c (dirfd): Reflect the fact that DIR_TO_FD now takes an
4567         argument.
4568
4569         * hash.c (hash_clear): Fix a bug that could lead to an infloop or
4570         e.g., a fault due to an attempt to free a NULL pointer.
4571
4572 2001-11-01  Jim Meyering  <jim@meyering.net>
4573
4574         * dirfd.c, dirfd.h: New files.
4575         * Makefile.am (libfetish_a_SOURCES): Add dirfd.h.
4576
4577         * hash.c (hash_print) [TESTING]: Clean up.
4578
4579 2001-10-22  Paul Eggert  <eggert@twinsun.com>
4580
4581         * hard-locale.c (alloca): Define to __builtin_alloca if __GNUC__,
4582         to avoid a warning if -Wall.
4583
4584 2001-10-21  Paul Eggert  <eggert@twinsun.com>
4585
4586         * regex.c (uintptr_t): Remove macro and decl; it's config.h's job.
4587
4588 2001-10-21  Jim Meyering  <jim@meyering.net>
4589
4590         * obstack.c (_): Honor the setting of ENABLE_NLS.  Otherwise,
4591         this code would end up calling gettext even in packages built
4592         with --disable-nls.
4593         * getopt.c (_): Likewise.
4594         * regex.c (_): Likewise.
4595
4596 2001-10-20  Paul Eggert  <eggert@twinsun.com>
4597
4598         * error.c (strerror_r): Do not declare unless !_LIBC.
4599         Do not check for HAVE_DECL_STRERROR_R missing unless STRERROR_R_CHAR_P.
4600         Use strerror_r that is only a macro, even if it is not a function.
4601         (strerror): Check for HAVE_DECL_STRERROR before declaring.
4602         (private_strerror): Use prototypes, not old-style function definition.
4603         (print_errno_message): New function.
4604         Support the POSIX 'int'-flavored strerror_r, as well as the traditional
4605         char*-flavored one.
4606         (error_tail, error, error_at_line): Use it.
4607
4608 2001-10-11  Jim Meyering  <jim@meyering.net>
4609
4610         * argmatch.c (argmatch_invalid): Use quotearg_n_style (0, ...
4611         and quote_n (1, ... to avoid clobbering a buffer.
4612
4613 2001-10-05  Jim Meyering  <jim@meyering.net>
4614
4615         * Makefile.am: (libfetish_a_SOURCES): Add hash-pjw.c and hash-pjw.h.
4616         * hash-pjw.c: New file (factored out of fileutils' remove.c).
4617         * hash-pjw.h: New file.
4618
4619 2001-09-30  Jim Meyering  <jim@meyering.net>
4620
4621         * mountlist.c [MOUNTED_GETFSSTAT]:
4622         Include <sys/ucred.h>, for Apple Darwin.
4623         Include sys/mount.h and sys/fs_types.h only if available.
4624         (FS_TYPE): Define.
4625         (read_filesystem_list): Use FS_TYPE.
4626
4627 2001-09-29  Paul Eggert  <eggert@twinsun.com>
4628
4629         * exclude.c (excluded_filename): 0 -> false, since it's
4630         a boolean context.
4631
4632 2001-09-28  Paul Eggert  <eggert@twinsun.com>
4633
4634         Fix bug reported by Petter Reinholdtsen for HP-UX 10.20, which
4635         #defines strtoimax.  Also treat the other strto* functions
4636         like strtoimax.
4637
4638         * xstrtol.c (strtol): Do not declare if HAVE_DECL_STRTOL.
4639         (strtoul): Do not declare if HAVE_DECL_STRTOUL.
4640         (strtoimax, strtoumax): Do not declare if already defined as a macro.
4641
4642 2001-09-26  Jim Meyering  <jim@meyering.net>
4643
4644         Most macros in unlocked-io.h had the wrong number of arguments.
4645         * gen-uio: New script.
4646         (USE_UNLOCKED_IO): Define to 1 if not already defined.
4647         * unlocked-io.hin: Remove file.
4648         * Makefile.am (unlocked-io.h): Rewrite to use a separate script,
4649         rather than trying to embed it here.
4650         (EXTRA_DIST): Add gen-uio.  Remove unlocked-io.hin
4651         Reported by Padraig Brady.
4652
4653 2001-09-25  Volker Borchert  <bt@teknon.de>
4654
4655         * gettimeofday.c (rpl_gettimeofday): Declare local variable `result'.
4656
4657 2001-09-23  Jim Meyering  <jim@meyering.net>
4658
4659         * mountlist.c: Remove useless parentheses in #if directives.
4660         (MOUNTED) [!defined MOUNTED]: Define to _PATH_MOUNTED, for when
4661         the deprecated MOUNTED symbol is no longer defined in mntent.h.
4662
4663 2001-09-22  Jim Meyering  <jim@meyering.net>
4664
4665         * localcharset.c: Update from latest gettext.
4666         * config.charset: Likewise.
4667
4668 2001-09-20  Jim Meyering  <jim@meyering.net>
4669
4670         * xstrtol.c (strtoimax): Guard declaration with
4671         `#if !HAVE_DECL_STRTOIMAX', rather than just `#ifndef strtoimax'.
4672         The latter fails because some systems (at least rs6000-ibm-aix4.3.3.0)
4673         have their own, conflicting declaration of strtoimax in sys/inttypes.h.
4674         (strtoumax): Likewise, for completeness (it wasn't necessary).
4675
4676 2001-09-06  Paul Eggert  <eggert@twinsun.com>
4677
4678         * strtoimax.c (HAVE_LONG_LONG):
4679         Redefine to HAVE_UNSIGNED_LONG_LONG if unsigned.
4680         (strtoimax): Use sizeof (long), not sizeof strtol (ptr, endptr, base),
4681         to work around bug in IBM C compiler.
4682
4683 2001-09-16  Jim Meyering  <jim@meyering.net>
4684
4685         * mkdir.c: New file.
4686
4687 2001-09-04  Paul Eggert  <eggert@twinsun.com>
4688
4689         * xgetcwd.c: Revert some of the previous change; intead,
4690         fix the HAVE_GETCWD_NULL code to behave more like the
4691         !HAVE_GETCWD_NULL code used to.
4692
4693         Include "xalloc.h".
4694         (xgetcwd): Do not return NULL when memory is exhausted; instead,
4695         invoke xalloc_die.
4696
4697 2001-09-04  Paul Eggert  <eggert@twinsun.com>
4698
4699         * xreadlink.c (xreadlink): Omit size_t* arg.  All uses changed.
4700         Use ssize_t, not int, to store result of readlink.
4701         Check for ssize_t overflow as well as size_t overflow,
4702         as POSIX says the result of readlink is implementation-defined
4703         when ssize_t overflows.
4704         Remove unnecessary cast to char*.
4705         Use free+malloc instead of realloc, as the storage doesn't need
4706         to be preserved and it's clearer and can be more efficient that way.
4707         (SIZE_MAX, SSIZE_MAX): New macros, if <limits.h> doesn't declare.
4708         * xreadlink.h (xreadlink): Update prototype.
4709
4710 2001-09-03  Paul Eggert  <eggert@twinsun.com>
4711
4712         * exclude.c (fnmatch_no_wildcards): Fix confusion between
4713         usage of FNM_CASEFOLD and FNM_LEADING_DIR.  The bug was
4714         spotted by Jim Meyering.
4715
4716 2001-09-03  Jim Meyering  <jim@meyering.net>
4717
4718         * xreadlink.c (xreadlink): Preserve errno around `free' during failure.
4719
4720 2001-09-03  Paul Eggert  <eggert@twinsun.com>
4721
4722         * xgetcwd.c: Fix the !HAVE_GETCWD_NULL code to behave more
4723         like the HAVE_GETCWD_NULL code.
4724         Include pathmax.h if not HAVE_GETCWD.
4725         Do not include xalloc.h.
4726         (INITIAL_BUFFER_SIZE): New symbol.
4727         Do not use xmalloc / xrealloc, since the caller is responsible for
4728         handling errors.  Preserve errno around `free' during failure.
4729         Do not overrun buffer when using getwd.
4730
4731 2001-09-03  Paul Eggert  <eggert@twinsun.com>
4732
4733         * xgetcwd.c (xgetcwd): Use HAVE_GETCWD_NULL, not (defined
4734         __GLIBC__ && __GLIBC__ >= 2), to decide whether to use getcwd (NULL, 0).
4735
4736 2001-09-02  Jim Meyering  <jim@meyering.net>
4737
4738         * error.c: Update from GNU libc.
4739
4740 2001-09-01  Jim Meyering  <jim@meyering.net>
4741
4742         * xreadlink.c: New file.
4743         * xreadlink.h: New file.
4744         * Makefile.am (libfetish_a_SOURCES): Add xreadlink.c and xreadlink.h.
4745
4746         * regex.c (uintptr_t) [!_LIBC]: Define to private_uintptr_t, so it
4747         doesn't conflict with sparc Solaris 7's definition in
4748         /usr/include/sys/int_types.h.
4749
4750         * exclude.c: Use `""', not `<>' to #include non-system header files.
4751         (fnmatch_no_wildcards): Rewrite not to use function names, strcasecmp
4752         and strncasecmp as r-values.  Unixware didn't have declarations.
4753
4754 2001-08-31  Jim Meyering  <jim@meyering.net>
4755
4756         * xgetcwd.c (xgetcwd): Reorganize to avoid some duplication.
4757         Use an initial, malloc'd, buffer of length 128 rather than
4758         a statically allocated one of length 1024.
4759
4760 2001-08-30  Paul Eggert  <eggert@twinsun.com>
4761
4762         * xgetcwd.c: Don't include pathmax.h.
4763         Include stdlib.h and unistd.h if available.
4764         Include xalloc.h.
4765         (xmalloc, xstrdup, free): Remove decls.
4766         (xgetcwd): Don't assume sizes fit in unsigned.
4767         Check for overflow when computing sizes.
4768         Simplify reallocation code.
4769
4770 2001-08-28  Paul Eggert  <eggert@twinsun.com>
4771
4772         * Makefile.am (libfetish_a_SOURCES): Remove strtoxmax.c.
4773
4774         * strtoimax.c: Renamed from strtoxmax.c, removing the
4775         old strtoimax.c.
4776
4777         Also, make the following further changes to make this file's
4778         configuration more similar to that of strtol.c:
4779         (UNSIGNED): Renamed from STRTOUXMAX_UNSIGNED.  All uses changed.
4780         (strtoumax, uintmax_t, strtoull, strtol): Remove.
4781         (intmax_t, strtoimax, strtol, strtoll): New macros, if UNSIGNED.
4782         (strtoimax): Renamed from strtoumax.  All uses of unsigned values
4783         changed to signed values.
4784
4785         And make the following changes as well:
4786         Fix copyright notice, as 1999 was missing.
4787         (verify): New macro.
4788         (strtoimax): Check sizes at compile-time, not run-time.
4789         Prefer strtol to strtoll if both work.
4790         (main): Remove; it was not that useful and was a pain to maintain.
4791
4792         * strtoumax.c: Include strtoimax.c, not strtouxmax.c.
4793
4794 2001-08-30  Paul Eggert  <eggert@twinsun.com>
4795
4796         * savedir.c (savedir): Remove size parameter, as POSIX says that
4797         a directory's st_size can have an arbitrary value, so the old
4798         usage could waste an arbitrary amount of memory.  All uses
4799         changed.
4800         * savedir.h: Update prototype.
4801
4802 2001-08-30  Paul Eggert  <eggert@twinsun.com>
4803
4804         * xstrtol.c (strtoimax): New decl.
4805
4806 2001-08-28  Paul Eggert  <eggert@twinsun.com>
4807
4808         * xstrtol.h: Add copyright notice.
4809         (_DECLARE_XSTRTOL): Improve quality of diagnostic for
4810         LONGINT_INVALID_SUFFIX_CHAR.
4811
4812 2001-08-30  Paul Eggert  <eggert@twinsun.com>
4813
4814         * quotearg.c: BSD/OS 4.1 wchar.h requires FILE and struct
4815         tm to be declared.
4816
4817 2001-08-30  Paul Eggert  <eggert@twinsun.com>
4818
4819         * hash.c: Remove '2001' from copyright notice.
4820
4821 2001-08-30  Paul Eggert  <eggert@twinsun.com>
4822
4823         * full-write.h: New file.
4824         * Makefile.am (libfetish_a_SOURCES): Add full-write.h.
4825         * full-write.c: Correct credits, as cccp.c no longer
4826         exists and anyway it was so heavily changed from the old cccp
4827         code as to be unrecognizable.  Include full-write.h.
4828         (full_write) Return size_t, with short writes meaning failure.
4829         All callers changed.  This fixes a bug with large buffers
4830         on 64-bit hosts.
4831         * utime.c: Include full-write.h.
4832
4833 2001-08-30  Paul Eggert  <eggert@twinsun.com>
4834
4835         Merge 'exclude' changes from tar 1.13.22.
4836         This fixes one or two unlikely storage allocation overflow bugs,
4837         but doesn't change user-visible behavior otherwise.
4838
4839 2001-08-30  Paul Eggert  <eggert@twinsun.com>
4840
4841         * exclude.c (bool): Declare, perhaps by including stdbool.h.
4842         (<sys/types.h>): Include only if HAVE_SYS_TYPES_H.
4843         (<stdlib.h>, <string.h>, <strings.h>, <inttypes.h>, <stdint.h>):
4844         Include if available.
4845         (<xalloc.h>): Include
4846         (SIZE_MAX): Define if <stdint.h> or <inttypes.h> doesn't.
4847         (verify): New macro.  Use it to verify that EXCLUDE macros do not
4848         collide with FNM macros.
4849         (struct patopts): New struct.
4850         (struct exclude): Use it, as exclude patterns now come with options.
4851         (new_exclude): Support above changes.
4852         (new_exclude, add_exclude_file):
4853         Initial size must now be a power of two to simplify overflow checking.
4854         (free_exclude, fnmatch_no_wildcards): New function.
4855         (excluded_filename): No longer requires options arg, as the options
4856         are determined by add_exclude.  Now returns bool, not int.
4857         (excluded_filename, add_exclude):
4858         Add support for the fancy new exclusion options.
4859         (add_exclude, add_exclude_file): Now takes int options arg.
4860         Check for arithmetic overflow when computing sizes.
4861         (add_exclude_file): xrealloc might modify errno, so don't
4862         realloc until after errno might be used.
4863
4864         * exclude.h (EXCLUDE_ANCHORED, EXCLUDE_INCLUDE,EXCLUDE_WILDCARDS):
4865         New macros.
4866         (free_exclude): New decl.
4867         (add_exclude, add_exclude_file): Now takes int options arg.
4868         (excluded_filename): No longer requires options arg, as the options
4869         are determined by add_exclude.  Now returns bool, not int.
4870
4871 2001-08-30  Paul Eggert  <eggert@twinsun.com>
4872
4873         * alloca.c (alloca): Arg is of type size_t, not unsigned.
4874
4875 2001-08-27  Jim Meyering  <jim@meyering.net>
4876
4877         * Makefile.am (libfetish_a_SOURCES): Add strtoxmax.c
4878
4879         * version-etc.c (N_): Remove definition.
4880         Revert most of last change.
4881         Instead, simply don't mark the `Copyright...' string for translation.
4882         Based on advice from Paul Eggert.
4883
4884         * strtoxmax.c: Tweak comment.
4885
4886 2001-08-26  Jim Meyering  <jim@meyering.net>
4887
4888         * version-etc.c (version_etc_copyright_fmt): Replace literal year
4889         of copyright with `%s' so translators don't get an untranslated
4890         message in 2002.
4891         (COPYRIGHT_YEAR): Define.
4892         (version_etc): Use fprintf rather than fputs.
4893         Suggestion from Ulrich Drepper.
4894
4895         * Makefile.am (libfetish_a_SOURCES): Add xstrtoimax.c.
4896
4897         * strtoll.c: New file, from GNU libc.
4898         * xstrtoimax.c: New file.
4899
4900         * xstrtol.h: Add xstrtoimax.
4901         * strtoumax.c: New file.  Simply include "strtoumax.c".
4902         * strtoimax.c: New file.  Likewise, but first define STRTOUXMAX_SIGNED.
4903
4904         * strtoumax.c: Factor to work both for unsigned and signed types, ...
4905         * strtoxmax.c: ... then renamed to this.
4906
4907 2001-08-13  Paul Eggert  <eggert@twinsun.com>
4908
4909         * Makefile.am (unlocked-io.h): Do not append "_unlocked" twice.
4910         Port to Solaris 8, where 'sed' requires a space after the 'r'
4911         command, and where sh dislikes "$/".  Clean up the spacing a bit.
4912         Redirect output to $tmp just once.
4913
4914 2001-08-12  Paul Eggert  <eggert@sic.twinsun.com>
4915
4916         * addext.c (<errno.h>): Include.
4917         (errno): Declare if not defined.
4918         (addext): Work correctly when pathconf returns -1 and leaves
4919         errno alone because there is no limit.  Also, work even if
4920         pathconf returns a value greater than SIZE_MAX.
4921
4922 2001-08-12  Jim Meyering  <jim@meyering.net>
4923
4924         * xgetcwd.c (xgetcwd) [defined __GLIBC__ && __GLIBC__ >= 2]:
4925         Simply `return getcwd (NULL, 0);'.
4926         [! (defined __GLIBC__ && __GLIBC__ >= 2)]:
4927         Use 1300 as initial value for length, not PATH_MAX.
4928
4929         * pathmax.h: Clean up cpp syntax.
4930
4931 2001-08-12  Jim Meyering  <jim@meyering.net>
4932
4933         * gettimeofday.c: New file.
4934         * gtod.h: New file.
4935         * Makefile.am (libfetish_a_SOURCES): Add gtod.h.
4936
4937 2001-08-04  Jim Meyering  <jim@meyering.net>
4938
4939         * error.h (__attribute__): Remove `|| __STRICT_ANSI__' from #if stmt,
4940         to get in sync with glibc.
4941
4942 2001-08-03  Paul Eggert  <eggert@twinsun.com>
4943
4944         The following changes are from gettext 0.10.39 as maintained by
4945         Bruno Haible.
4946
4947         * mbswidth.h (MBSW_REJECT_UNPRINTABLE, MBSW_REJECT_INVALID):
4948         Renamed from MBSW_ACCEPT_UNPRINTABLE and MBSW_ACCEPT_INVALID
4949         with inverted sense.  All uses changed.
4950
4951         * mbswidth.c: Don't include <limits.h>.
4952         Include <stdlib.h> and <string.h> unconditionally.
4953         (iswcntrl, mbsinit, ISCNTRL): New macros.
4954         (mbsnwidth): Use K&R style function declarations.
4955         Don't bother checking for MB_LEN_MAX == 1, since the compiler
4956         can optimize it when MB_CUR_MAX == 1.
4957         The width of control characters is zero, not 1.
4958
4959 2001-07-15  Jim Meyering  <jim@meyering.net>
4960
4961         * Makefile.am (EXTRA_DIST): Add unlocked-io.hin.
4962         (BUILT_SOURCES): Add unlocked-io.h.
4963         (io_functions): Define.
4964         (unlocked-io.h): New rule.
4965         (DISTCLEANFILES): Add unlocked-io.h.
4966         (all-local): Depend on unlocked-io.h, to ensure it is created.
4967
4968         * unlocked-io.hin: New file
4969
4970         * regex.c: Update from glibc.
4971
4972 2001-07-05  Jim Meyering  <jim@meyering.net>
4973
4974         * Makefile.am (noinst_HEADERS): Remove definition, per new automake
4975         recommendation.
4976         (libfetish_a_SOURCES): Put all .h files here instead.
4977         Remove a thus-exposed (better checks in automake) duplicate and
4978         two unnecessary .h files.
4979
4980 2001-06-11  Jim Meyering  <jim@meyering.net>
4981
4982         * regex.c: Update from GNU libc.
4983
4984 2001-05-27  Jim Meyering  <jim@meyering.net>
4985
4986         * readutmp.h (UT_TYPE): Define.
4987
4988 2001-05-24  Jim Meyering  <jim@meyering.net>
4989
4990         * argmatch.c: Include "quote.h".
4991         (argmatch_invalid): Remove explicit `' quotes.  Instead, use the
4992         quote function.  Reported by Göran Uddeborg.
4993
4994 2001-05-20  Alexandre Duret-Lutz  <duret_g@epita.fr>
4995
4996         * dirname.c (dir_name): Compute append_dot using path, not newpath
4997         which is not yet declared.
4998
4999 2001-05-11  Paul Eggert  <eggert@twinsun.com>
5000
5001         * Makefile.am (libfetish_a_SOURCES):
5002         Add strftime.c, since we now compile it on all hosts.
5003
5004         * strftime.c (my_strftime):
5005         Define to nstrftime if emacs, but only if my_strftime is not defined.
5006         (extra_args, extra_args_spec, extra_args_spec_iso): Rename from
5007         ut_argument, ut_argument_spec, ut_argument_spec_iso, respectively.
5008         Add one more extra argument: a nanoseconds value.
5009         All uses changed.
5010         (ns): New macro.
5011         (my_strftime function): Add %N format.
5012         (emacs_strftimeu): Renamed from emacs_strftime,
5013         with extra ut argument.
5014
5015 2001-05-11  Paul Eggert  <eggert@twinsun.com>
5016
5017         dirname code cleanup.  base_name now behaves more compatibly
5018         with POSIX basename when given file names that have trailing
5019         slashes, and similarly for dir_name.  Add new primitives
5020         base_len and dir_len.  Put the directory-name-related decls
5021         into dirname.h.
5022
5023         * addext.c (ISSLASH, base_name): Remove; now in dirname.h.
5024         * backupfile.c (base_name): Likewise.
5025         * basename.c (FILESYSTEM_PREFIX_LEN, PARAMS, ISSLASH): Likewise.
5026         * dirname.c (FILESYSTEM_PREFIX_LEN, ISSLASH): Likewise.
5027         * makepath.c (strip_trailing_slashes): Likewise.
5028         * path-concat.c (DIRECTORY_SEPARATOR, FILESYSTEM_PREFIX_LEN, ISSLASH):
5029         Likewise.
5030         * rename.c (strip_trailing_slashes): Likewise.
5031         * same.c (base_name): Likewise.
5032         * stripslash.c (ISSLASH): Likewise.
5033
5034         * addext.c: Include <dirname.h> after size_t is defined.
5035         * backupfile.c: Likewise.
5036
5037         * addext.c (addext): Use base_len to trim redundant
5038         trailing slashes instead of doing it ourselves.
5039         But do not trim the last slash if it is not redundant.
5040
5041         * backupfile.c (find_backup_file_name,
5042         max_backup_version): Use base_len instead of rolling it ourselves.
5043         Handle the case of "" and (on DOS) "C:" correctly.
5044
5045         * basename.c: Do not include <stdio.h>, <assert.h>; no longer needed.
5046         Include <string.h>, <dirname.h>.
5047         (base_name): Allow file names ending in slashes, other than names
5048         that are all slashes.  In this case, return the basename followed
5049         by the slashes.  This is more general, and can be used in places
5050         where the original base_name purposely had an assertion failure.
5051         (base_len): New function.
5052
5053         * dirname.c: Include <string.h> instead of <stdlib.h>.
5054         Do not include <assert.h>; no longer needed.
5055         Include xalloc.h.
5056         (memrchr): Remove decl.
5057         (dir_name_r): Remove.
5058         (dir_len): Renamed from dirlen.  All callers changed.
5059         Rewrite in terms of base_name, for simplicity and consistency.
5060         (dir_name): Never return NULL.  All callers changed.
5061         Do not include <stdlib.h> in test program; no longer needed.
5062         return 0; is fine for test program.
5063
5064         * dirname.h (DIRECTORY_SEPARATOR, ISSLASH, FILESYSTEM_PREFIX_LEN):
5065         New macros.
5066         (base_name, base_len, dir_len, strip_trailing_slashes): New decls.
5067
5068         * path-concat.c (path_concat): Use base_len to compute
5069         base length, not strlen; this means we cannot rely on memcpy
5070         to null-terminate.
5071
5072         * same.c (STREQ): Remove.
5073         (same_name): Handle the case where the basename ends in trailing '/'.
5074
5075         * stripslash.c (strip_trailing_slashes): Return nonzero if
5076         a slash was stripped.  Do not strip the last slash after a
5077         file system prefix.
5078
5079 2001-04-08  Jim Meyering  <jim@meyering.net>
5080
5081         * getdate.y (get_date): Set tm_isdst to -1 to ensure that it is
5082         recomputed; that's necessary when the offset spans a DST transition.
5083         Patch by David J. MacKenzie.  Reported by Hon-Yin Kok.
5084
5085 2001-04-02  Jim Meyering  <jim@meyering.net>
5086
5087         * regex.h, regex.c: Update from GNU libc.
5088
5089 2001-03-19  Paul Eggert  <eggert@twinsun.com>
5090
5091         * version-etc.c (version_etc_copyright): Update to 2001.
5092
5093 2001-03-16  Paul Eggert  <eggert@twinsun.com>
5094
5095         * tempname.c (uint64_t): Define to uintmax_t if
5096         not defined, and if UINT64_MAX is not defined.
5097         Required at least for Vax Ultrix4.3, which doesn't define uint64_t.
5098         Reported by John David Anglin.
5099
5100 2001-03-10  Bruno Haible  <haible@clisp.cons.org>
5101
5102         * localcharset.c (locale_charset): Allow wildcard syntax. Also resolve
5103         alias if codeset is empty.
5104         * config.charset (BeOS): Use wildcard syntax.
5105
5106 2001-03-13  Jim Meyering  <jim@meyering.net>
5107
5108         * path-concat.c (path_concat) [FILESYSTEM_ACCEPTS_DRIVE_LETTER_PREFIX]:
5109         Don't insert a backslash when concatenating e.g., `C:' and `foo'.
5110         From Bruno Haible.
5111
5112 2001-03-06  Bruno Haible  <haible@clisp.cons.org>
5113
5114         * localcharset.c (locale_charset): Don't use setlocale(LC_CTYPE,NULL).
5115         Don't return NULL.
5116         * unicodeio.c (print_unicode_char): Simplify accordingly.
5117
5118 2001-03-06  Bruno Haible  <haible@clisp.cons.org>
5119
5120         * config.charset: Update for FreeBSD 4.2 and OSF/1 5.1. Add
5121         support for DOS/DJGPP.
5122
5123 2001-02-28  Paul Eggert  <eggert@twinsun.com>
5124
5125         * Makefile.am (libfetish_a_SOURCES):
5126         Add dup-safer.c, fopen-safer.c.
5127         (noinst_HEADERS): Add stdio-safer.h, unistd-safer.h.
5128
5129         * dup-safer.c, fopen-safer.c, stdio-safer.h, unistd-safer.h: New files.
5130
5131 2001-02-25  Paul Eggert  <eggert@twinsun.com>
5132
5133         The mkstemp replacement is taken from glibc 2.2.2, with some
5134         portability fixes for use outside glibc, as follows:
5135
5136         * tempname.c (struct_stat64): New macro.
5137         (direxists, __gen_tempname): Use it.
5138         This avoids a portability problem with Solaris 8.
5139
5140         * tempname.c (<config.h>): Include if HAVE_CONFIG_H.
5141         (<stddef.h>, <stdint.h>, <string.h>):
5142         Include only if STDC_HEADERS || _LIBC.
5143         (<fcntl.h>): Include only if HAVE_FCNTL_H || _LIBC.
5144         (<unistd.h>): Include only if HAVE_UNISTD_H || _LIBC.
5145         (<sys/time.h>): Include only if HAVE_SYS_TIME_H || _LIBC.
5146         (__set_errno): Define this macro if <errno.h> doesn't.
5147         (P_tmpdir, TMP_MAX, __GT_FILE, __GT_BIGFILE, __GT_DIR, __GT_NOCREATE):
5148         Define these macros if <stdio.h> doesn't.
5149         (S_ISDIR, S_IRUSR, S_IWUSR, S_IXUSR):
5150         Define these macros if <sys/stat.h>
5151         doesn't.  Ignore <sys/stat.h> S_ISDIR if STAT_MACROS_BROKEN.
5152         (stat64, __getpid, __gettimeofday, __mkdir, __open, __open64, lxstat64,
5153         __xstat64): Define if not _LIBC.
5154         (__secure_getenv): Define if ! (HAVE___SECURE_GETENV || _LIBC).
5155         (__gen_tempname): Invoke gettimeofday only if
5156         HAVE_GETTIMEOFDAY || _LIBC;
5157         otherwise, fall back on plain "time".
5158         Use macros like S_IRUSR | S_IWUSR rather than octal values like 0600.
5159
5160         * mkstemp.c (__GT_FILE): Define to zero if not defined.
5161
5162         * mkstemp.c, tempname.c: New files, taken from glibc 2.2.2.
5163
5164 2001-02-17  Jim Meyering  <jim@meyering.net>
5165
5166         * strtoul.c: Sync from GNU libc.  Use double quotes, not <...>
5167         around included file name.
5168
5169         * strnlen.c (__strnlen): Merge in a change from GNU libc.
5170
5171         * strftime.c: Update from GNU libc (the only changes were to comments).
5172
5173 2001-02-13  Bruno Haible  <haible@clisp.cons.org>
5174
5175         * mbswidth.h (mbswidth): Also define as macro, to avoid prototype clash.
5176
5177 2001-02-17  Paul Eggert  <eggert@twinsun.com>
5178
5179         * mbswidth.c, quotearg.c (mbrtowc, mbsinit):
5180         Remove workaround macros for hosts that have mbrtowc but not
5181         mbstate_t, as we now insist on proper declarations for both
5182         before using mbrtowc.
5183
5184 2001-02-17  Jim Meyering  <jim@meyering.net>
5185
5186         * regex.c: Update from libc.
5187
5188 2001-02-16  Paul Eggert  <eggert@twinsun.com>
5189
5190         * alloca.c (malloc): Undef before defining, since stdlib.h
5191         may have defined it.  Needed for Encore Umax-3.0.9.16b systems.
5192         Reported by Mark Hounschell via Paul Eggert.
5193
5194 2001-01-30  Bruno Haible  <haible@clisp.cons.org>
5195
5196         * config.charset: Update for FreeBSD 4.2.
5197
5198 2001-01-26  Jim Meyering  <jim@meyering.net>
5199
5200         * quotearg.c: Include stddef.h.
5201         * quote.c: Include stddef.h.
5202         Reported by Axel Kittenberger.
5203
5204         * xmalloc.c [HAVE_DONE_WORKING_MALLOC_CHECK]: Enclose error-evoking
5205         line in double quotes so that it evokes a better diagnostic.
5206         [HAVE_DONE_WORKING_REALLOC_CHECK]: Likewise.
5207         Reported by Axel Kittenberger.
5208
5209 2001-01-15  Bruno Haible  <haible@clisp.cons.org>
5210
5211         * unicodeio.c (print_unicode_char): Cast the second iconv() arg,
5212         to avoid a warning.  Add back 'const' to inptr.
5213
5214 2001-01-16  Jim Meyering  <jim@meyering.net>
5215
5216         * basename.c: Include <stdio.h>, needed by assert on SunOS 4.
5217         From Bruno Haible.
5218
5219 2001-01-14  Jim Meyering  <jim@meyering.net>
5220
5221         * rename.c: New file.  From Volker Borchert.
5222         Include stdlib.h, string.h or strings.h, and xalloc.h.
5223         Use strip_trailing_slashes rather than open-coding it.
5224
5225 2001-01-03  Paul Eggert  <eggert@twinsun.com>
5226
5227         * strftime.c: Sync with glibc time/strftime.c 1.81.
5228
5229 2001-01-03  Jim Meyering  <jim@meyering.net>
5230
5231         * unicodeio.c (print_unicode_char): Remove `const' from declaration of
5232         local `inptr' to avoid warning with some system declarations of iconv.
5233
5234 2000-12-29  Paul Eggert  <eggert@twinsun.com>
5235
5236         * modechange.c: Do not assume that mode_t uses the
5237         traditional octal encoding.  E.g. "chmod 1 FOO" should set
5238         the other-execute bit of FOO even if S_IXOTH != 1.
5239
5240         (SUID, SGID, SVTX, RUSR, WUSR, XUSR, RGRP, WGRP, XGRP, ROTH,
5241         WOTH, XOTH, ALLM): New macros.
5242         (S_ISUID, S_ISGID, S_ISVTX, S_IRUSR, S_IWUSR, S_IXUSR,
5243          S_IRGRP, S_IWGRP, S_IXGRP, S_IROTH, S_IWOTH, S_IXOTH):
5244         Use them.
5245         (S_ISGID): Fix typo; it was defaulting to the same value as S_ISUID.
5246         (S_IRWXU, S_IRWXG, S_IRWXO): Specify defaults in terms of the above.
5247         (mode_compile):
5248         No need to use uintmax_t; unsigned long is long enough.
5249         Don't bother to get suffix since we don't use it.
5250
5251 2000-12-24  Jim Meyering  <jim@meyering.net>
5252
5253         * hash.c (is_prime): Return explicit boolean values.
5254         (hash_get_first): Return NULL to appease Irix5.6's 89.
5255         Reported by Nelson Beebe.
5256
5257 2000-10-31  Bruno Haible  <haible@clisp.cons.org>
5258
5259         * localcharset.c (locale_charset): Add support for Win32.
5260
5261 2000-12-18  Paul Eggert  <eggert@twinsun.com>
5262
5263         * physmem.h, physmem.c: New files.
5264
5265         * Makefile.am (libfetish_a_SOURCES): Add physmem.c.
5266         (noinst_HEADERS): Add physmem.h.
5267
5268         * xstrtol.c (__xstrtol): Add undocumented suffixes 'g' and
5269         't' for compatibility with Solaris 8 sort.
5270
5271 2000-12-18  Bruno Haible  <haible@clisp.cons.org>
5272
5273         * config.charset: Add support for BeOS.
5274
5275 2000-12-16  Jim Meyering  <jim@meyering.net>
5276
5277         * getusershell.c [!SHELLS_FILE && __DJGPP__]: Define
5278         SHELLS_FILE to a file name that's useful on djgpp systems.
5279         Include stdlib.h.
5280         (ADDITIONAL_DEFAULT_SHELLS): Define.
5281         (default_shells): Prepend ADDITIONAL_DEFAULT_SHELLS.
5282         Based mostly on a patch from Prashant TR.
5283
5284 2000-12-16  Jim Meyering  <jim@meyering.net>
5285
5286         This bug had a serious impact on chown: `chown N:M FILE' (for integer
5287         N and M) would have treated it like `chown N:N FILE'.
5288
5289         * userspec.c (parse_user_spec): Fix typo: s/u/g/.
5290
5291 2000-10-31  Bruno Haible  <haible@clisp.cons.org>
5292
5293         * config.charset: Add ISO-8859-3, BIG5HKSCS, GB18030, JOHAB, VISCII,
5294         CP874, CP949, CP950, CP1250, CP1253, CP1254, CP1255, CP1256, CP1257
5295         to the list of canonical encodings. Rename EUC-CN to GB2312.
5296
5297 2000-12-08  Andreas Schwab  <schwab@suse.de>
5298
5299         * mbswidth.c (mbsnwidth): Don't loop endlessly when called with an
5300         invalid mulitbyte sequence and with the MBSW_ACCEPT_INVALID flag set.
5301
5302 2000-12-07  Jim Meyering  <jim@meyering.net>
5303
5304         * stripslash.c (ISSLASH): Define.
5305         (strip_trailing_slashes): Use ISSLASH rather than comparing against `/'.
5306         From Prashant TR.
5307
5308         * dirname.c (FILESYSTEM_PREFIX_LEN): Define.
5309         (dir_name_r): Declare this function as static.
5310         [BACKSLASH_IS_PATH_SEPARATOR]: Fix a bug that'd
5311         manifest itself on a name containing a mix of slashes and
5312         backslashes.
5313         Make this function work with names starting with a DOS-style
5314         drive letter and colon prefix.
5315         (dir_name): Append `.' if necessary.
5316         Based mostly on patches from Prashant TR and Eli Zaretskii.
5317
5318         * dirname.h (dir_name_r): Remove prototype.
5319
5320 2000-12-05  Jim Meyering  <jim@meyering.net>
5321
5322         * dirname.c (dir_name_r): Add `const' in a few local declarations.
5323
5324 2000-12-04  Jim Meyering  <jim@meyering.net>
5325
5326         * path-concat.c: [!HAVE_DECL_MALLOC]: Declare malloc.
5327         Also include memory.h, stdlib.h, unistd.h if appropriate.
5328         Reported by Andreas Jaeger (conflicting declaration of malloc).
5329
5330 2000-12-02  Jim Meyering  <jim@meyering.net>
5331
5332         * closeout.h: Make idempotent, to avoid some obscure warnings.
5333
5334 2000-12-01  Paul Eggert  <eggert@twinsun.com>
5335
5336         * memrchr.c: Include <config.h> before any system include file.
5337
5338 2000-11-29  Paul Eggert  <eggert@twinsun.com>
5339
5340         * dirname.c (dir_name_r): Fix typo: int -> size_t.
5341
5342 2000-11-26  Jim Meyering  <jim@meyering.net>
5343
5344         * memcoll.c: Include sys/types.h.  From Werner Almesberger.
5345
5346 2000-11-22  Paul Eggert  <eggert@twinsun.com>
5347
5348         * strftime.c (my_strftime): Do not invoke mbrlen with a
5349         size of (size_t) -1; it's not portable.
5350
5351 2000-11-17  Akim Demaille  <akim@epita.fr>
5352
5353         * obstack.h: Formatting changes.
5354         (obstack_grow, obstack_grow0): Don't cast WHERE at all: that would
5355         prevent type checking.
5356         (obstack_ptr_grow, obstack_ptr_grow_fast): When assigning, don't
5357         cast the value to (void *): assigning a `foo *' to a `void *'
5358         variable is valid.
5359         (obstack_int_grow, obstack_int_grow_fast): Don't cast AINT to int.
5360
5361 2000-11-17  Jim Meyering  <jim@meyering.net>
5362
5363         * strstr.c: Update from GNU libc.
5364
5365 2000-11-16  Jim Meyering  <jim@meyering.net>
5366
5367         * strverscmp.c: Incorporate weak-alias-related changes from glibc.
5368
5369 2000-11-11  Jim Meyering  <jim@meyering.net>
5370
5371         * error.c: Add a couple #includes, merging from GNU libc version.
5372
5373 2000-11-10  Jim Meyering  <jim@meyering.net>
5374
5375         * obstack.h: Update from GNU libc.
5376         * obstack.c: Likewise.
5377
5378 2000-11-06  Paul Eggert  <eggert@twinsun.com>
5379
5380         * getusershell.c (setusershell): Use rewind rather than
5381         fseek/fseeko, to avoid configuration hassles with fseeko.
5382         Don't bother opening SHELLS_FILE if shellstream is NULL;
5383         it's not necessary.
5384
5385 2000-11-05  Jim Meyering  <jim@meyering.net>
5386
5387         * makepath.h (make_dir): Declare.
5388         * makepath.c (make_dir): Remove `static' attribute.
5389         Tweak a comment.
5390
5391 2000-11-04  Alexandre Duret-Lutz  <duret_g@epita.fr>
5392
5393         * hash.c (hash_get_next): Fix a thinko:  when ENTRY is the
5394         last one in a bucket, advance to the next bucket.
5395
5396 2000-11-02  Vesselin Atanasov  <vesselin@bgnet.bg>
5397
5398         * fnmatch.c: Do not comment out all the code if we are using
5399         the GNU C library, because in some cases we are replacing buggy
5400         code in the GNU C library itself.
5401
5402 2000-10-30  Paul Eggert  <eggert@twinsun.com>
5403
5404         * error.h, getline.h, modechange.h:
5405         Remove "2000" from Copyright line, as the file hasn't been
5406         changed this year other than in the copyright notice.
5407
5408         * xalloc.h: Add "2000" to Copyright line, as this file
5409         was changed this year.
5410
5411 2000-10-30  Paul Eggert  <eggert@twinsun.com>
5412
5413         * fnmatch.c (FOLD): Do not assume that characters are unsigned.
5414         (fnmatch): Fix some FNM_FILE_NAME and FNM_LEADING_DIR bugs,
5415         e.g. fnmatch("d*/*1", "d/s/1", FNM_FILE_NAME) incorrectly yielded zero.
5416
5417 2000-10-29  Greg Louis  <glouis@dynamicro.on.ca>
5418
5419         * regex.h (__restrict_arr): Move definition out of #ifndef block.
5420         Required because egcs-2.91.66 (aka 1.1.2) defines __restrict, but
5421         doesn't define __restrict_arr.
5422
5423 2000-10-29  Jim Meyering  <jim@meyering.net>
5424
5425         * xstat.in: Fix grammar in comment.
5426
5427 2000-10-28  Jim Meyering  <jim@meyering.net>
5428
5429         * memchr.c: Update from libc.
5430         Adjust for portability:
5431         [HAVE_STDLIB_H]: Include stdlib.h.
5432         [HAVE_BP_SYM_H || _LIBC]: Guard inclusion of bp-sym.h.
5433         Undef __memchr, too.
5434         [!weak_alias]: Define __memchr to memchr.
5435
5436         * regex.c: Update from libc.
5437         * regex.h: Likewise.
5438         * getopt1.c: Likewise.
5439         * memcmp.c: Likewise.
5440
5441         * getusershell.c (setusershell) [HAVE_FSEEKO]: Use fseeko.
5442         Avoid using fseek, when possible -- it's broken by design.
5443         Patch by Ulrich Drepper.
5444
5445 2000-10-26  Jim Meyering  <jim@meyering.net>
5446
5447         * strftime.c: Update from libc.
5448
5449 2000-10-25  Jim Meyering  <jim@meyering.net>
5450
5451         * obstack.c: Update from libc.
5452
5453 2000-10-23  Jim Meyering  <jim@meyering.net>
5454
5455         * hard-locale.c (hard_locale): Revert last change -- it was simply
5456         wrong.  That set_locale call must not have any side effects.
5457         From Paul Eggert.
5458
5459 2000-10-22  Jim Meyering  <jim@meyering.net>
5460
5461         * md5.c (md5_process_block) [OP]: Use `rol', not CYCLIC.
5462         [CYCLIC]: Remove now-unused definition.
5463
5464         * save-cwd.c (O_DIRECTORY): Define, if needed.
5465         (save_cwd) [HAVE_FCHDIR]: Use O_DIRECTORY when opening ".".
5466         Suggestion from Ulrich Drepper.
5467
5468 2000-10-21  Jim Meyering  <jim@meyering.net>
5469
5470         * dirname.c (dir_name_r): New function, factored out of dir_name.
5471         (dir_name): Use dir_name_r.
5472         * dirname.h (dir_name_r): Declare it.
5473
5474 2000-10-21  Jim Meyering  <jim@meyering.net>
5475
5476         * dirname.c (memrchr): Declare if necessary.
5477         (dir_name): Remove the restriction that there be no
5478         trailing slashes.  Now, this code skips past them, effectively
5479         ignoring them.
5480         [TEST_DIRNAME] (main): New unit tests.
5481
5482         * memrchr.c: New file from GNU libc.
5483         Undef __memrchr, too.
5484         [!weak_alias]: Define __memrchr to memrchr.
5485         Guard weak_alias use with `#ifdef weak_alias'.
5486
5487 2000-10-17  Jim Meyering  <jim@meyering.net>
5488
5489         * quote.h (PARAMS): Define and use.
5490         Reported by Akim Demaille.
5491
5492         * getopt.c: Update from libc.
5493
5494 2000-10-16  Jim Meyering  <jim@meyering.net>
5495
5496         * hard-locale.c (hard_locale): Use "", not 0 as 2nd arg to setlocale.
5497         From Jan Fedak.
5498
5499 2000-09-25  Jim Meyering  <jim@meyering.net>
5500
5501         * md5.h (rol): Define (from GnuPG).
5502
5503         * sha.c: Give credit (GnuPG) where due.
5504         (M): Use rol rather than open-coding it.
5505         Add a FIXME comment.
5506
5507 2000-09-21  Jim Meyering  <jim@meyering.net>
5508
5509         * userspec.c (parse_user_spec): Remove debugging printf I'd added.
5510         Reported by Michael Stone.
5511
5512 2000-09-20  Jim Meyering  <jim@meyering.net>
5513
5514         * Makefile.am (libfetish_a_SOURCES): Add sha.c.
5515         (noinst_HEADERS): Add sha.h.
5516         Based on code from Scott G. Miller and from GnuPG.
5517
5518 2000-09-15  Jim Meyering  <jim@meyering.net>
5519
5520         * regex.c: Update from libc.
5521
5522 2000-09-10  Jim Meyering  <jim@meyering.net>
5523
5524         * getopt.c (_getopt_internal): Update from glibc.
5525
5526 2000-09-09  Jim Meyering  <jim@meyering.net>
5527
5528         * quotearg.c: Rename ISASCII to IN_CTYPE_DOMAIN, so people don't
5529         think it should be used as a general replacement for isascii.
5530         * fnmatch.c: Likewise.
5531         * mbswidth.c: Likewise
5532         * regex.c: Likewise.
5533
5534         Don't use atoi.
5535         * userspec.c: Include sys/param.h and limits.h.
5536         Include xstrtol.h.
5537         (CHAR_BIT, TYPE_SIGNED, TYPE_MINIMUM, TYPE_MAXIMUM): Define.
5538         (UID_T_MAX, GID_T_MAX, MAXUID, MAXGID): Define.
5539         (parse_user_spec): Use xstrtoul, not atoi when converting numeric
5540         UID, GID.  Check range.
5541
5542 2000-09-06  Jim Meyering  <jim@meyering.net>
5543
5544         * getopt.c (_getopt_internal): Update from glibc.
5545
5546 2000-08-30  Jim Meyering  <jim@meyering.net>
5547
5548         * strftime.c: Merge in changes from GNU libc.
5549
5550 2000-08-26  Jim Meyering  <jim@meyering.net>
5551
5552         * closeout.c: Include "__fpending.h".
5553         (close_stdout_status): Return right away if there's nothing to flush.
5554
5555         * Makefile.am (noinst_HEADERS): Add __fpending.h.
5556         * __fpending.c: New file.
5557         * __fpending.h: New file.
5558
5559 2000-08-07  Paul Eggert  <eggert@twinsun.com>
5560
5561         Standardize on "memory exhausted" instead of "Memory exhausted"
5562         or "virtual memory exhausted".
5563         * obstack.c (print_and_abort): Use "memory exhausted", not
5564         "virtual memory exhausted".
5565         * same.c (same_name): Invoke xalloc_die instead of printing
5566         our own message.
5567         * userspec.c (parse_user_spec): Likewise.
5568         * bumpalloc.h: comment fix
5569         * same.c, userspec.c: Include xalloc.h.
5570
5571         * xalloc.h (xalloc_msg_memory_exhausted): Now char const[],
5572         not char *const and pointing to a constant array.
5573         * xmalloc.c (xalloc_msg_memory_exhausted): Likewise.
5574         (xrealloc): Comment fix.
5575
5576         * userspec.c (parse_user_spec):
5577         Don't translate a message until just before returning,
5578         to avoid unnecessary translation.
5579
5580 2000-08-07  Jim Meyering  <jim@meyering.net>
5581
5582         * addext.c, argmatch.c, argmatch.h, backupfile.h, bumpalloc.h,
5583         chown.c, diacrit.h, dirname.h, dup2.c, exclude.h, fileblocks.c,
5584         fnmatch.c, fnmatch.h, fsusage.c, fsusage.h, getdate.h,
5585         getgroups.c, gethostname.c, getopt.h, group-member.c,
5586         hard-locale.c, hash.h, isdir.c, lchown.c, linebuffer.c,
5587         linebuffer.h, long-options.h, malloc.c, md5.c, md5.h, memchr.c,
5588         memcmp.c, memcoll.c, memset.c, mktime.c, modechange.h, obstack.h,
5589         pathmax.h, realloc.c, rmdir.c, safe-read.c, save-cwd.c, stime.c,
5590         stpcpy.c, strcasecmp.c, strcspn.c, strdup.c, stripslash.c,
5591         strstr.c, strtod.c, strtol.c, strtoul.c, strtoull.c, strtoumax.c,
5592         utime.c, version-etc.h, xalloc.h, xstrdup.c, xstrtoumax.c,
5593         yesno.c: Back out Copyright date changes for each file with no change
5594         this year.  This eases coordination with other programs using the same
5595         source code modules.  From Paul Eggert.
5596
5597 2000-08-03  Greg McGary  <greg@mcgary.org>
5598
5599         * regex.c (SET_HIGH_BOUND, MOVE_BUFFER_POINTER,
5600         ELSE_EXTEND_BUFFER_HIGH_BOUND): New macros.
5601         (EXTEND_BUFFER): Use them.
5602
5603 2000-08-01  Jim Meyering  <jim@meyering.net>
5604
5605         * dirname.c (ISSLASH): Define.
5606         (BACKSLASH_IS_PATH_SEPARATOR): Define.
5607         (dir_name) [BACKSLASH_IS_PATH_SEPARATOR]: Handle the case in which
5608         both `\' and `/' may be use as path separators.
5609         Based on a patch from Prashant TR.
5610
5611 2000-07-31  Paul Eggert  <eggert@twinsun.com>
5612
5613         * quotearg.c (quotearg_n_options): Don't make the initial
5614         slot vector a constant, since it might get modified.
5615
5616 2000-07-31  Jim Meyering  <jim@meyering.net>
5617
5618         * xmalloc.c: Use `virtual memory exhausted', not `Memory exhausted'.
5619         * obstack.c (print_and_abort): Likewise.
5620
5621 2000-07-30  Paul Eggert  <eggert@twinsun.com>
5622
5623         * quotearg.c (quotearg_n_options): Preallocate a slot 0
5624         buffer, so that the caller can always quote one small
5625         component of a "memory exhausted" message in slot 0.
5626         From a suggestion by Jim Meyering.
5627
5628 2000-07-30  Jim Meyering  <jim@meyering.net>
5629
5630         * makepath.c (make_path): Quote the other instance, too.
5631
5632         * quotearg.c (N_STATIC_SLOTVECS): Define.
5633         (STATIC_BUF_SIZE): Define.
5634         (quotearg_n_options): Use only statically allocated storage when
5635         N < N_STATIC_SLOTVECS and the length of the quoted result is smaller
5636         than STATIC_BUF_SIZE.
5637
5638 2000-07-29  Jim Meyering  <jim@meyering.net>
5639
5640         * diacrit.c (diacrit_diac): Use __MSDOS__ in favor of MSDOS.
5641         * dirname.c (dir_name): Likewise.
5642
5643         * basename.c (base_name): Use ISSLASH rather than comparing against `/'.
5644
5645         * dirname.c (dir_name) [MSDOS]: Declare `lim' to be const.
5646         (dir_name): Assert that there are no trailing slashes.
5647
5648 2000-07-18  Bruno Haible  <haible@clisp.cons.org>
5649
5650         * mbswidth.h (mbswidth): Add a flags argument.
5651         (mbswidth): New declaration.
5652         (MBSW_ACCEPT_INVALID, MBSW_ACCEPT_UNPRINTABLE): New macros.
5653         * mbswidth.c (mbswidth): Add a flags argument.
5654         (mbsnwidth): New function.
5655
5656 2000-07-24  Jim Meyering  <jim@meyering.net>
5657
5658         * mbswidth.c: Remove useless #else.  From Bruno Haible.
5659
5660 2000-07-23  Paul Eggert  <eggert@twinsun.com>
5661
5662         * mbswidth.c (_XOPEN_SOURCE):
5663         Don't define; this causes problems on Solaris 7.
5664         (wcwidth) [!HAVE_DECL_WCWIDTH]: Declare.
5665
5666 2000-07-23  Paul Eggert  <eggert@twinsun.com>
5667
5668         * quotearg.c:
5669         Include <wchar.h> even if ! (HAVE_MBRTOWC && 1 < MB_LEN_MAX),
5670         so that mbstate_t is always defined.
5671
5672         Do not inspect MB_LEN_MAX, since it's incorrectly defined to
5673         be 1 in at least one GCC installation, and this configuration
5674         error is likely to be common.  Ignoring MB_LEN_MAX hurts
5675         performance on hosts that have mbrtowc but have only unibyte
5676         locales, but I assume these hosts are rare.
5677
5678 2000-07-23  Paul Eggert  <eggert@twinsun.com>
5679
5680         * quotearg.c: Streamline by invoking multibyte code only if needed.
5681         <wchar.h>: Include only if HAVE_MBRTOWC && 1 < MB_LEN_MAX.
5682         (MB_CUR_MAX): Redefine to 1 if ! (HAVE_MBRTOWC && 1 < MB_LEN_MAX).
5683         (quotearg_buffer_restyled): If a unibyte locale, don't bother to
5684         invoke multibyte primitives.
5685
5686 2000-07-23  Jim Meyering  <jim@meyering.net>
5687
5688         * basename.c (base_name): Add an assertion.
5689
5690 2000-07-15  Bruno Haible  <clisp.cons.org>
5691
5692         * quotearg.c: When the system forces us to redefine mbstate_t,
5693         shadow its mbsinit function.
5694
5695 2000-07-16  Bruno Haible  <haible@clisp.cons.org>
5696
5697         * mbswidth.h: New file.
5698         * mbswidth.c: New file.
5699         * Makefile.am (libfetish_a_SOURCES): Add mbswidth.c.
5700         (noinst_HEADERS): Add mbswidth.h.
5701
5702 2000-07-17  Bruno Haible  <haible@clisp.cons.org>
5703
5704         * config.charset: Add support for FreeBSD. Improve support for HP-UX
5705         and IRIX 6.
5706
5707 2000-07-15  Jim Meyering  <jim@meyering.net>
5708
5709         * makepath.c: Include quote.h.
5710         (make_path): Convert "`%s'" in format strings to "%s", and wrap each
5711         corresponding argument in a `quote (...)' call.
5712         Give better diagnostics.
5713
5714         * Makefile.am (libfetish_a_SOURCES): Add quote.c.
5715         (noinst_HEADERS): Add quote.h.
5716
5717         * quote.c (quote, quote_n): New file.  Two functions taken verbatim
5718         from tar's src/misc.c.
5719         * quote.h: New file.  Prototypes for same.
5720
5721 2000-07-10  Paul Eggert  <eggert@twinsun.com>
5722
5723         From a suggestion by Bruno Haible.
5724         * quotearg.c (mbrtowc): Do not use HAVE_WCHAR_H in the definition.
5725         Use defined mbstate_t, not HAVE_MBSTATE_T_OBJECT,
5726         to decide whether to define the BeOS workaround macro;
5727         this adjusts to the change to AC_MBSTATE_T.
5728
5729 2000-07-13  Paul Eggert  <eggert@twinsun.com>
5730
5731         * quotearg.h (enum quoting style): New enum clocale_quoting_style.
5732
5733         * quotearg.c (quoting_style_args, quoting_style_vals,
5734         quotearg_buffer_restyled): Add support for
5735         clocale_quoting_style.  Undo previous change to
5736         locale_quoting_style behavior, and undo the "{LEFT QUOTATION MARK}"
5737         and "{RIGHT QUOTATION MARK}" msgids.
5738
5739 2000-07-05  Paul Eggert  <eggert@twinsun.com>
5740
5741         The old behavior of quoting `like this' doesn't look good with
5742         newer, ISO-style fonts.  See:
5743         http://www.cl.cam.ac.uk/~mgk25/ucs/quotes.html
5744
5745         Instead, quote "like this" by default.  Let the translator
5746         tailor the locale-specific quoting behavior by providing
5747         translations for {LEFT QUOTATION MARK} and {RIGHT QUOTATION MARK}.
5748
5749         * quotearg.c (N_): New macro.
5750         (gettext_default): New function.
5751         (quotearg_buffer_restyled): Use
5752         gettext_default ("{LEFT QUOTATION MARK}", "\"") for left quote, and
5753         gettext_default ("{RIGHT QUOTATION MARK}", "\"") for right quote.
5754
5755 2000-07-09  Jim Meyering  <jim@meyering.net>
5756
5757         * Most files: Update copyright dates to include 2000.
5758
5759 2000-07-08  Jim Meyering  <jim@meyering.net>
5760
5761         * xgethostname.c (ENAMETOOLONG): Define to an unlikely value
5762         if not defined.
5763         (xgethostname): Remove now-unnecessary #ifdef.
5764         Move declaration of `err' into loop where it's used.
5765
5766 2000-07-05  Bruno Haible  <haible@clisp.cons.org>
5767
5768         * xgethostname.c (xgethostname): Protect against the SunOS 5.5 bug
5769         by allocating a larger buffer. Test the gethostname return value for
5770         being >= 0, not == 0, for BeOS.  Don't exhaust memory if gethostname
5771         returns an error and ENAMETOOLONG isn't defined.
5772
5773 2000-07-05  Paul Eggert  <eggert@twinsun.com>
5774         and Bruno Haible  <haible@clisp.cons.org>
5775
5776         * quotearg.c (mbrtowc): Declare returned type, since BeOS doesn't.
5777
5778 2000-07-05  Bruno Haible  <haible@clisp.cons.org>
5779
5780         * quotearg.c (struct quoting_options): Simplify quote_these_too
5781         dimension.
5782
5783 2000-07-03  Jim Meyering  <jim@meyering.net>
5784
5785         * strndup.c: [!HAVE_DECL_STRNLEN]: Declare strnlen.
5786         Reported by Bruno Haible.
5787
5788 2000-07-04  Jim Meyering  <jim@meyering.net>
5789
5790         * quotearg.c: Make inclusion of <wchar.h> independent of whether
5791         HAVE_MBRTOWC is set.  Required at least for irix-5.6, which
5792         lacks mbrtowc.
5793
5794 2000-07-03  Paul Eggert  <eggert@twinsun.com>
5795         and Bruno Haible  <haible@clisp.cons.org>
5796
5797         * quotearg.c (mbrtowc):
5798         Assign to *pwc, and return 1 only if result is nonzero.
5799         (iswprint): Use ISPRINT when substituting our own mbrtowc.
5800
5801 2000-07-03  Jim Meyering  <jim@meyering.net>
5802
5803         * readutmp.h: [HAVE_UTMPX_H]: Include <utmp.h> if HAVE_UTMP_H.
5804         This is necessary to get a definition of e.g., UTMP_FILE on HP-UX 10.20.
5805         From Bob Proulx.
5806
5807 2000-07-02  Jim Meyering  <jim@meyering.net>
5808
5809         * quotearg.c (mbstate_t): Don't define here.
5810
5811 2000-07-02  Jim Meyering  <jim@meyering.net>
5812
5813         * nanosleep.c (SIGCONT): Define if not already defined.
5814
5815 2000-06-17  Bruno Haible  <haible@clisp.cons.org>
5816
5817         * mountlist.c: Use MOUNTED_FS_STAT_DEV instead of MOUNTED_NEXT_DEV,
5818         per change in ../m4/ls-mntd-fs.m4.
5819         (read_filesystem_list): Ignore symbolic links.
5820
5821 2000-06-29  Jim Meyering  <jim@meyering.net>
5822
5823         * same.c: Include <string.h> or <strings.h>, as appropriate,
5824         for declaration of strcmp.
5825
5826         * long-options.c: Include <stdlib.h>, for declaration of exit.
5827
5828         * mountlist.c (fsp_to_string) [HAVE_F_FSTYPENAME_IN_STATFS]:
5829         Avoid warning by casting result to `char *' to remove `const'.
5830
5831 2000-06-17  Bruno Haible  <haible@clisp.cons.org>
5832
5833         * Makefile.am (libfetish_a_SOURCES): Remove readutmp.c.
5834
5835 2000-06-26  Paul Eggert  <eggert@twinsun.com>
5836
5837         savedir now sets errno on failure and invokes xmalloc to get memory.
5838         Fix a couple of other minor bugs while we're at it.
5839
5840         * savedir.c (<unistd.h>): Do not include; there's no need.
5841         (NAMLEN): Remove macro.
5842         (malloc, realloc): Remove decls.
5843         (stpcpy): Likewise.
5844         ("xalloc.h"): Include.
5845         (NAME_SIZE_DEFAULT): New macro.
5846         (savedir): Use xmalloc / xrealloc to allocate memory.
5847         Use NAME_SIZE_DEFAULT if name_size is negative or overflows to zero.
5848         Skip "" directory entries.
5849         Use strlen to calculate directory entry length, since the old method
5850         is rarely used these days and isn't worth supporting.
5851         Don't use a pointer after freeing it.
5852         Check for integer overflow when calculating allocation size.
5853         Use memcpy to copy entries, instead of stpcpy.
5854         Set errno properly when returning NULL.
5855         Check for readdir error.
5856
5857 2000-06-26  Jim Meyering  <jim@meyering.net>
5858
5859         * posixtm.c [HAVE_STDLIB_H]: Include stdlib.h, for decl of abort.
5860
5861 2000-06-17  Bruno Haible  <haible@clisp.cons.org>
5862
5863         * getusershell.c (xmalloc, xrealloc): Remove functions.
5864         Include xalloc.h.
5865         Don't include <stdlib.h>.  Don't declare malloc, realloc.
5866
5867 2000-06-23  Bruno Haible  <haible@clisp.cons.org>
5868
5869         * unicodeio.c (print_unicode_char): Work around ansi2knr deficiency.
5870
5871 2000-06-24  Jim Meyering  <jim@meyering.net>
5872
5873         * error.c [!HAVE_DECL_STRERROR_R]: Declare strerror_r.
5874
5875 2000-06-21  Jim Meyering  <jim@meyering.net>
5876
5877         * getpass.c: New file, from Bruno Haible.  Required for BeOS.
5878
5879 2000-06-19  Paul Eggert  <eggert@twinsun.com>
5880
5881         * quotearg.c: Include <wctype.h> after <wchar.h>, for Solaris 2.5.
5882         (mbrtowc, mbstate_t): Define substitutes if
5883         HAVE_MBRTOWC && HAVE_WCHAR_H && !HAVE_MBSTATE_T_OBJECT.
5884         (iswprint): Define to 1 if !defined iswprint && !HAVE_ISWPRINT,
5885         not if ! (HAVE_MBRTOWC && HAVE_WCHAR_H).
5886
5887 2000-06-17  Bruno Haible  <haible@clisp.cons.org>
5888
5889         * xgetcwd.c (xgetcwd): If the required pathname length is smaller
5890         than 1024, return a memory chunk of least possible size, instead
5891         of size PATH_MAX + 2. In the loop, increment the size proportionally.
5892         Use free/xmalloc instead of xrealloc to avoid copying for very long
5893         paths.
5894
5895 2000-06-17  Bruno Haible  <haible@clisp.cons.org>
5896
5897         * canon-host.c (canon_host): Use malloc and memcpy to copy an
5898         address, not strdup.  Include <stdlib.h> and don't declare free().
5899
5900 2000-06-17  Bruno Haible  <haible@clisp.cons.org>
5901
5902         * path-concat.c (path_concat): Don't access dir[-1] if dir is
5903         the empty string.
5904
5905 2000-06-21  Jim Meyering  <jim@meyering.net>
5906
5907         * Makefile.am (libfetish_a_SOURCES): Add getstr.c.
5908         (noinst_HEADERS): Add getstr.h.
5909
5910         * getline.c (getstr): Move into a separate file.
5911         * getstr.c (getstr): New file, extracted from getline.c, with
5912         the following changes: new parameter, delim2; both delim[12]
5913         parameters have type `int', not `char'.  The latter would lose
5914         with 8-bit delimiters.
5915         * getstr.h: New file.
5916
5917 2000-06-19  Jim Meyering  <jim@meyering.net>
5918
5919         * getloadavg.c [HAVE_NLIST_H] (NLIST_STRUCT): Define.
5920
5921 2000-06-18  Jim Meyering  <jim@meyering.net>
5922
5923         * mkdir.c: Remove file, due mainly to copyright incompatibility.
5924         Besides, these days every porting target provides a mkdir function.
5925
5926         * strnlen.c: Include memory.h, string.h, and/or strings.h as needed.
5927         (this snippet comes from src/system.h).
5928
5929 2000-06-15  Paul Eggert  <eggert@twinsun.com>
5930
5931         * human.c (adjust_value): New function.
5932         (human_readable_inexact): Apply rounding style even when
5933         printing approximate values.
5934
5935 2000-06-14  Paul Eggert  <eggert@twinsun.com>
5936
5937         * human.c (human_readable_inexact): Allow an input block
5938         size that is not a multiple of the output block size, and vice versa.
5939         Reported by Piergiorgio Sartor.
5940
5941 2000-06-14  Paul Eggert  <eggert@twinsun.com>
5942
5943         * getdate.y (get_date): Apply relative times after time
5944         zone indicator, not before.  Reported by Todd A. Jacobs.
5945
5946 2000-06-13  Jim Meyering  <jim@meyering.net>
5947
5948         * Makefile.am (all-local): Depend on lstat.c and stat.c.
5949
5950         * xstat.in [!HAVE_DECL_FREE]: Declare free in lstat.c.
5951
5952 2000-06-12  Paul Eggert  <eggert@twinsun.com>
5953
5954         * xstat.in: Include <stdlib.h> in lstat, to declare "free".
5955
5956 2000-06-04  Paul Eggert  <eggert@twinsun.com>
5957
5958         * strnlen.c: Include <config.h> if HAVE_CONFIG_H.
5959
5960 2000-06-04  Jim Meyering  <jim@meyering.net>
5961
5962         * getugroups.c (getugroups): Cast -1 to gid_t, for systems like
5963         SunOS 4.1.4 for which gid_t is an unsigned type.
5964
5965 2000-06-03  Jim Meyering  <jim@meyering.net>
5966
5967         * strnlen.c [!HAVE_DECL_MEMCHR]: Declare memchr.
5968
5969 2000-05-26  Bruno Haible  <haible@clisp.cons.org>
5970
5971         * Makefile.am (install-exec-local): On systems with glibc-2.1 or
5972         newer, don't install charset.alias.
5973         * config.charset: Change the Linux/glibc rules so they become empty
5974         on glibc-2.1 or newer.
5975
5976 2000-06-02  Jim Meyering  <jim@meyering.net>
5977
5978         * mountlist.c: Back out last change.  Instead, do this...
5979         * mountlist.c (read_filesystem_list) [MOUNTED_VMOUNT]: Set the me_dummy
5980         member using the same `ignore'-testing code.
5981         * mountlist.h (ME_DUMMY): Add `autofs' to the list of ignored
5982         fs_type strings.
5983         From Mark D. Roth.
5984
5985 2000-05-29  Jim Meyering  <jim@meyering.net>
5986
5987         * mountlist.c (read_filesystem_list) [MOUNTED_VMOUNT]: Ignore mounts
5988         with the `ignore' attribute.  Based on a patch from Mark D. Roth.
5989
5990 2000-05-22  Jim Meyering  <jim@meyering.net>
5991
5992         * makepath.c: Remove old, now-unnecessary `#ifdef __MSDOS__' block.
5993
5994 2000-05-18  Jim Meyering  <jim@meyering.net>
5995
5996         * hash.c (hash_rehash): Fix a nasty bug: copy the free entry list
5997         back, too, since it may have been modified by allocate_entry.
5998         (hash_delete): Rewrite to use neither the assignment operator
5999         nor the comma operator in an if-expression.
6000
6001 2000-05-15  Paul Eggert  <eggert@twinsun.com>
6002
6003         * closeout.c:
6004         <sys/stat.h>, <sys/types.h>, <unistd.h>, (STDOUT_FILENO):
6005         Remove; no longer needed.
6006         "quotearg.h": Add include.
6007         (file_name): Do not bother to explicitly initialize to NULL; it's less
6008         efficient on some hosts.
6009         (close_stdout_status): Remove test as to whether stdout was already
6010         closed; it breaks for the case "echo x | sort >&-".
6011         Quote file name colons.
6012         Do not assume that _("write error") lacks format strings.
6013
6014 2000-05-15  Jim Meyering  <jim@meyering.net>
6015
6016         * version-etc.c (version_etc_copyright): Update the copyright string
6017         used in all --version output.
6018
6019 2000-05-14  Jim Meyering  <jim@meyering.net>
6020
6021         * closeout.c (close_stdout_set_file_name): New function.
6022         (close_stdout_status): Use new file-scoped global.
6023         Return right away if fstat says the stdout file descriptor is invalid.
6024         * closeout.h (close_stdout_set_file_name): Declare.
6025
6026 2000-05-10  Jim Meyering  <jim@meyering.net>
6027
6028         * closeout.c [default_exit_status]: New file-scoped variable.
6029         (close_stdout_set_status): New function.
6030         * closeout.h (close_stdout_set_status): Declare.
6031
6032 2000-05-08  Jim Meyering  <jim@meyering.net>
6033
6034         * long-options.c: Don't include closeout.h.
6035         (parse_long_options): Don't call close_stdout for --version.
6036
6037 2000-05-06  Jim Meyering  <jim@meyering.net>
6038
6039         * strnlen.c: Undefine __strnlen and strnlen.
6040         [!weak_alias]: Define __strnlen to strnlen.
6041
6042         * atexit.c: New file, from libiberty.
6043
6044 2000-05-06  Jim Meyering  <jim@meyering.net>
6045
6046         * closeout.c (close_stdout_status): Also check for errors on the
6047         stderr stream.
6048
6049 2000-05-05  Bruno Haible  <haible@clisp.cons.org>
6050
6051         * localcharset.c (get_charset_aliases): Use malloc, realloc and memcpy
6052         instead of xmalloc, xrealloc, path_concat.
6053         (locale_charset): Treat empty environment variables as absent.
6054         (DIRECTORY_SEPARATOR, ISSLASH): New macros.
6055
6056 2000-05-04  Jim Meyering  <jim@meyering.net>
6057
6058         * getopt.c: Update from glibc.
6059         * obstack.c: Likewise.
6060         * obstack.h: Likewise.
6061         * regex.c: Likewise.  NB: K&R compiler support is dropped for this file
6062
6063         * regex.h: Likewise.
6064         * strndup.c: Likewise.
6065         * strnlen.c: New file, from glibc.
6066
6067 2000-05-01  Jim Meyering  <jim@meyering.net>
6068
6069         * full-write.c (full_write): Remove `FIXME' part of comment.
6070
6071 2000-04-29  Jim Meyering  <jim@meyering.net>
6072
6073         * path-concat.c: Declare strdup only if it's not defined.
6074         * canon-host.c: Likewise.
6075
6076 2000-04-28  Jim Meyering  <jim@meyering.net>
6077
6078         * rpmatch.c [HAVE_LIMITS_H]: Include limits.h before regex.h to avoid
6079         redefinition warning on some systems (HPUX).  Otherwise, regex.h is
6080         included first, then limits.h is included by locale.h by libintl.h.
6081         From John David Anglin.
6082
6083 2000-04-25  Jim Meyering  <jim@meyering.net>
6084
6085         * makepath.c (S_IRWXUGO): Define.
6086         (make_path): Always perform explicit chmod if MODE specifies any
6087         of the `special' permission bits.  Prompted by a bug report against
6088         install from Mate Wierdl and Joost van Baal.
6089
6090 2000-04-18  Jim Meyering  <jim@meyering.net>
6091
6092         * README: New file.
6093
6094         * getpagesize.h [!getpagesize && HAVE_OS_H && B_PAGE_SIZE]: Define
6095         getpagesize.  For BeOS.  Based on a patch from Bruno Haible.
6096
6097 2000-04-17  Jim Meyering  <jim@meyering.net>
6098
6099         * strftime.c (my_strftime) [strftime]: Declare strftime here, since
6100         the definition of it to rpl_strftime also defined-away the system's
6101         declaration.
6102
6103 2000-04-15  Jim Meyering  <jim@meyering.net>
6104
6105         Use `C' to denote so-called `contiguous' files, the same way
6106         that tar does.
6107         * filemode.c (S_ISCTG) [!S_ISCTG && S_IFCTG]: Define.
6108         (ftypelet): Use S_ISCTG.
6109         From Michael Deutschmann.
6110
6111 2000-04-14  Jim Meyering  <jim@meyering.net>
6112
6113         * strftime.c (my_strftime) [#ifdef strftime]: Declare strftime.
6114
6115 2000-04-08  Jim Meyering  <jim@meyering.net>
6116
6117         * Makefile.am (charset.alias): Use t-$@, not $@-t so the DOS 8.3
6118         names don't conflict.  Reported by Eli Zaretskii.
6119
6120 2000-03-28  Bruno Haible  <haible@clisp.cons.org>
6121
6122         * unicodeio.c (print_unicode_char): Avoid triggering Solaris iconv
6123         bug.  Deal with the different error behavior of Irix iconv.
6124
6125 2000-04-07  Jim Meyering  <jim@meyering.net>
6126
6127         * putenv.c: Move inclusion of errno.h so it follows that of sys/types.h,
6128         to work around system header problems on AIX 3.2.5.  From Bruno Haible.
6129
6130 2000-04-05  Jim Meyering  <jim@meyering.net>
6131
6132         Portability tweaks required for ultrix4.3.
6133         * readutmp.h [HAVE_UTMPX_H && !HAVE_DECL_GETUTENT]: Declare getutent.
6134         * readutmp.c: Include sys/types.h before sys/stat.h.
6135         * canon-host.c: Declare strdup.
6136         * path-concat.c: Likewise.
6137         From John David Anglin.
6138
6139 2000-04-04  Jim Meyering  <jim@meyering.net>
6140
6141         Be more DOS 8.3-friendly.
6142         * ref-add.sin: Renamed from ref-add.sed.in.
6143         * ref-del.sin: Renamed from ref-del.sed.in.
6144         * Makefile.am: Reflect renaming.
6145         Reported by Eli Zaretskii.
6146
6147         Use a temporary file name that won't clash with `charset.alias'
6148         in the DOS 8.3 name space.
6149         * Makefile.am (charset_tmp): Define.
6150         (install-exec-local): Use $(charset_tmp) instead of $(charset_alias)-t.
6151         (uninstall-local): Likewise.
6152         Reported by Eli Zaretskii.
6153
6154 2000-03-29  Paul Eggert  <eggert@twinsun.com>
6155
6156         * time/strftime.c (my_strftime): Make sure we call the system
6157         strftime, not ourselves, when invoking the underlying strftime.
6158
6159 2000-03-24  Jim Meyering  <jim@meyering.net>
6160
6161         * Makefile.am (EXTRA_DIST): Add ref-add.sed.in and ref-del.sed.in.
6162         (charset_alias): Define.
6163         (install-exec-local): Factor out common code.
6164         (uninstall-local): Split lines longer than 80.
6165         (ref-add.sed, ref-del.sed): Remove rules... (do the following instead)
6166         (SUFFIXES): Define.
6167         (.sed.in.sed): New rule.  Don't redirect directly to $@.
6168         (CLEANFILES): Add ref-add.sed and ref-del.sed.
6169
6170 2000-03-19  Bruno Haible  <haible@clisp.cons.org>
6171
6172         * config.charset: Output a line containing "Packages using this file".
6173         * ref-add.sed.in, ref-del.sed.in: New files.
6174         * Makefile.am (install-exec-local, uninstall-local, ref-add.sed,
6175         ref-del.sed): New rules.
6176
6177 2000-03-17  Jim Meyering  <jim@meyering.net>
6178
6179         * unicodeio.c (<string.h>): Include only #if HAVE_STRING_H.
6180         Otherwise, include <strings.h>
6181
6182 2000-03-17  Bruno Haible  <haible@clisp.cons.org>
6183
6184         * unicodeio.c (utf8_wctomb): New function.
6185         (print_unicode_char): Pass the Unicode character to iconv in UTF-8
6186         format instead of in UCS-4 with platform dependent endianness.
6187
6188 2000-03-07  Paul Eggert  <eggert@twinsun.com>
6189
6190         * savedir.c (savedir): Work even if directory size is
6191         negative; this can happen with some screwy NFS configurations.
6192
6193 2000-03-06  Jim Meyering  <jim@meyering.net>
6194
6195         * localcharset.c (get_charset_aliases): Don't try to free file_name
6196         if it's NULL (because we ran out of memory).  From Bruno Haible.
6197
6198 2000-03-05  Jim Meyering  <jim@meyering.net>
6199
6200         * localcharset.c ("path-concat.h"): Include.
6201         (get_charset_aliases): Use path_concat instead of ANSI string
6202         concatenation.
6203
6204         * unicodeio.h (PARAMS): Define.
6205         Use it to guard prototype.
6206
6207 2000-03-04  Jim Meyering  <jim@meyering.net>
6208
6209         * Makefile.am (install-exec-local): Create $(libdir) before installing
6210         into it.
6211         (uninstall-local): Uncomment this rule so `make distcheck' works
6212         once again.
6213
6214         * unicodeio.c (<errno.h>): Include it.
6215         (errno): Declare if not defined.
6216
6217         * localcharset.c: Add Bruno's comment justifying use of volatile.
6218
6219         * config.charset: New version, incorporating remarks from a linux
6220         i18n mailing list.  From Bruno Haible.
6221
6222 2000-03-02  Jim Meyering  <jim@meyering.net>
6223
6224         * Makefile.am (EXTRA_DIST): Add config.charset.
6225
6226 2000-03-01  Jim Meyering  <jim@meyering.net>
6227
6228         * localcharset.c: Guard some #includes with `#if HAVE_...'.
6229         * unicodeio.c: Likewise.
6230
6231 2000-02-02  Bruno Haible  <haible@clisp.cons.org>
6232
6233         * config.charset: New file.
6234         * localcharset.c: New file.
6235         * unicodeio.h, unicodeio.c: New files.
6236         * Makefile.am (DEFS): Add -DLIBDIR=...
6237         (libfetish_a_SOURCES): Add localcharset.c and unicodeio.c.
6238         (noinst_HEADERS): Add unicodeio.h.
6239         (all-local, install-exec-local, charset.alias): New targets.
6240
6241 2000-02-28  Paul Eggert  <eggert@twinsun.com>
6242
6243         * quotearg.c (ALERT_CHAR): New macro.
6244         (quotearg_buffer_restyled): Use it.
6245
6246 2000-02-27  Jim Meyering  <jim@meyering.net>
6247
6248         * strtoumax.c: Fix typo in decl of strtoul: s/long long/long/.
6249         Guard declaration of strtoull also with `&& HAVE_UNSIGNED_LONG_LONG'.
6250
6251         * backupfile.c: Guard inclusion of stdlib.h with `#if HAVE_STDLIB_H',
6252         not `#if STDC_HEADERS'.
6253         Declare malloc if needed.
6254
6255         * backupfile.c: Use `#if !HAVE_DECL...' instead of `#ifndef HAVE_DECL..'
6256         now that autoconf always defines the HAVE_DECL_ symbols.
6257         * human.c: Likewise.
6258         * same.c: Likewise.
6259         * strtoumax.c: Likewise.
6260
6261         * backupfile.c: Arrange for cpp to fail if the configure-time
6262         declaration check was not run.
6263         * hash.c: Likewise.
6264         * human.c: Likewise.
6265         * same.c: Likewise.
6266         * strtoumax.c: Likewise.
6267
6268         * userspec.c (parse_user_spec): If there is no `:' but there is a `.',
6269         then first look up the entire `.'-containing string as a login name.
6270
6271 2000-02-18  Paul Eggert  <eggert@twinsun.com>
6272
6273         * getdate.y: Handle two-digit years with leading zeros correctly.
6274         (textint): New typedef.
6275         (parser_control): Member year changed from int to textint.
6276         All uses changed.
6277         (YYSTYPE): Removed; replaced by %union with int and textint members.
6278         (tDAY, tDAY_UNIT, tDAYZONE, tHOUR_UNIT, tID, tLOCAL_ZONE, tMERIDIAN,
6279         tMINUTE_UNIT, tMONTH, tMONTH_UNIT tSEC_UNIT, tSNUMBER, tUNUMBER,
6280         tYEAR_UNIT, tZONE, o_merid): Now of type <intval>.
6281         (tSNUMBER, tUNUMBER): Now of type <textintval>.
6282         (date, number, to_year): Use width of number in digits, not its value,
6283         to determine whether it's a 2-digit year, or a 2-digit time.
6284         (yylex): Store number of digits of numeric tokens.
6285         Reported by John Kendall.
6286
6287         (parser_control): Changed from struct parser_control to typedef (for
6288         consistency).  All uses changed.
6289
6290         (tID): Removed; not used.
6291         (yylex): Return '?' for unknown identifiers, rather than (unused) tID.
6292
6293 2000-02-14  Paul Eggert  <eggert@twinsun.com>
6294
6295         * getpagesize.h (getpagesize): Port to VMS for Alpha;
6296         adapted from changes to grep getpagesize.h by Martin P.J. Zinser.
6297
6298 2000-02-12  Jim Meyering  <jim@meyering.net>
6299
6300         * userspec.c (ISDIGIT): Define it.
6301         (isdigit): Remove definition.
6302         (is_number): Use ISDIGIT, not isdigit.
6303         <libintl.h>: Include.
6304         (_ and N_): Define.
6305         (parse_user_spec): Mark translatable strings.
6306
6307 2000-02-10  Jim Meyering  <jim@meyering.net>
6308
6309         With these changes, nanosleep.[ch] are finally enough like the other
6310         lib/* replacement files to compile on a few more losing systems.
6311
6312         * nanosleep.h: Don't include config.h.
6313         Remove prototype from declaration of nanosleep.
6314         (PARAMS): Remove now-unneeded definition.
6315         * nanosleep.c: #undef nanosleep.
6316         (rpl_nanosleep): Rename from nanosleep.
6317
6318 2000-02-03  Jim Meyering  <jim@meyering.net>
6319
6320         * readutmp.c (read_utmp): Guard with `#ifdef UTMP_NAME_FUNCTION',
6321         rather than with `#if HAVE_UTMPNAME'.
6322
6323 2000-02-01  Jim Meyering  <jim@meyering.net>
6324
6325         * readutmp.h (UT_USER): Add parens.  From Andreas Schwab.
6326
6327 2000-01-31  Jim Meyering  <jim@meyering.net>
6328
6329         * nanosleep.h (nanosleep): Guard declaration with
6330         `#if ! HAVE_DECL_NANOSLEEP'.
6331         Without this, OFS gets a redeclaration error for rpl_nanosleep, due to
6332         the declaration in that vendor's sys/timers.h.
6333         Reported by Christian Krackowizer.
6334
6335         * quotearg.c (ISASCII): Add #undef and move definition to follow
6336         inclusion of wctype.h to work around Solaris 2.6 namespace pollution.
6337         (ISPRINT): Likewise.
6338         Reported by Tom Tromey.
6339
6340 2000-01-30  Jim Meyering  <jim@meyering.net>
6341
6342         * readutmp.c (extract_trimmed_name): Use UT_USER instead of hard-coding
6343         uses of ->ut_name.  The latter doesn't work with new Linux header files
6344         where only utmpx.ut_user is declared.
6345
6346         * readutmp.h (UT_USER): Define.
6347
6348 2000-01-23  Jim Meyering  <jim@meyering.net>
6349
6350         * Makefile.am (libfetish_a_SOURCES): Remove explicit mention of
6351         obstack.c.
6352
6353 2000-01-22  Jim Meyering  <jim@meyering.net>
6354
6355         * strtoumax.c: [! HAVE_DECL_STRTOUL]: Declare strtoul.
6356         [! HAVE_DECL_STRTOULL]: Declare strtoull.
6357         Required for some AIX systems.  Reported by Christian Krackowizer.
6358         [TESTING] (main): New function.
6359
6360         1997-10-17  Eli Zaretskii  <eliz@is.elta.co.il>
6361         * dirname.c (dir_name): Support for DOS-style file names with drive
6362         letters.
6363
6364         * quotearg.c [HAVE_WCTYPE_H]: Include <wctype.h> for decl of iswprint.
6365
6366         * strverscmp.c (ISDIGIT): Define.
6367         (strverscmp): Use ISDIGIT, not isdigit.
6368
6369 2000-01-17  Paul Eggert  <eggert@twinsun.com>
6370
6371         * nanosleep.c (nanosleep):
6372         Don't use SA_INTERRUPT to decide whether to call sigaction, as
6373         POSIX.1 doesn't require SA_INTERRUPT and some systems
6374         (e.g. Solaris 7) don't define it.  Use SA_NOCLDSTOP instead;
6375         it's been part of POSIX.1 since day 1 (in 1988).
6376
6377 2000-01-17  Jim Meyering  <jim@meyering.net>
6378
6379         * interlock: Remove unused file.  Reported by François Pinard.
6380
6381 2000-01-16  Paul Eggert  <eggert@twinsun.com>
6382
6383         * quotearg.c (quotearg_buffer_restyled): Do not quote
6384         alert, backslash, formfeed, and vertical tab unnecessarily in
6385         shell quoting style.