.
[platform/upstream/coreutils.git] / ChangeLog
1 2005-06-13  Jim Meyering  <jim@meyering.net>
2
3         * Version 5.3.1.
4
5         * src/mkdir.c (main): Give a diagnostic for -- and skip -- each
6         relative directory name after make_dir_parents fails to restore
7         the working directory.  Before, `mkdir -p' could create directories
8         in the wrong place in unusual circumstances.
9         * src/install.c (main): Likewise.
10         (install_file_in_file_parents): Update make_dir_parents caller.
11         * tests/mkdir/p-3: New test for today's mkdir.c/mkdir-p.c bug fixes.
12         * tests/mkdir/Makefile.am (TESTS): Add p-3.
13
14 2005-06-10  Paul Eggert  <eggert@cs.ucla.edu>
15
16         Act on the Austin Group's response yesterday to XCU ERN 63; see
17         <http://www.opengroup.org/austin/docs/austin_260.txt>.
18         * NEWS: ls no longer outputs an extra space between mode and link count.
19         * doc/coreutils.texi: Remove the extra spaces in "ls -l" output.
20         * src/ls.c (any_has_acl): New var.
21         (clear_files): Clear it.
22         (gobble_file): Set it if a file has an ACL.
23         (print_long_format): Omit needless space unless some file has an ACL.
24
25 2005-06-10  Jim Meyering  <jim@meyering.net>
26
27         * src/system.h (VERIFY_W_TYPEOF): Add parentheses.
28
29 2005-06-02  Jim Meyering  <jim@meyering.net>
30
31         * src/sort.c (usage): Put `Ordering options:' line where it belongs.
32
33 2005-06-01  Paul Eggert  <eggert@cs.ucla.edu>
34
35         Use "file name" when talking about file names, instead of "filename"
36         or "path", as per the GNU coding standards.
37         * src/basename.c: Don't use "path" or "filename".
38         * src/copy.c: Likewise.
39         * src/copy.h: Likewise.
40         * src/cp-hash.c: Likewise.
41         * src/cp.c: Likewise.
42         * src/df.c: Likewise.
43         * src/install.c: Likewise.
44         * src/ls.c: Likewise.
45         * src/pinky.c: Likewise.
46         * src/pr.c: Likewise.
47         * src/pwd.c: Likewise.
48         * src/remove.c: Likewise.
49         * src/rmdir.c: Likewise.
50         * src/sort.c: Likewise.
51         * src/system.h: Likewise.
52         * src/tty.c: Likewise.
53         * src/who.c: Likewise.
54         * src/cp.c (parents_option): Renamed from flag_path.  All uses changed.
55         (make_dir_parents_private): Renamed from make_path_private.
56         All uses changed.
57         * src/cp.c (usage): Don't use "path" to describe a file name.
58         * src/readlink.c (usage): Likewise.
59         * src/rmdir.c (usage): Likewise.
60         * src/df.c: Don't include "path-concat.h"; not needed.
61         * src/install.c (install_file_in_file_parents): Renamed from
62         install_file_to_path.  All uses changed.
63         * src/ln.c (FILE_BASENAME_CONCAT): Renamed from PATH_BASENAME_CONCAT.
64         All uses changed.
65         * src/ls.c (make_link_name): Renamed from make_link_path.
66         All uses changed.
67         * src/pwd.c (struct file_name): Renamed from struct Path.
68         All uses changed.
69         (file_name_free): Renamed from path_free.  All uses changed.
70         (file_name_init): Renamed from path_init.  All uses changed.
71         (file_name_prepend): Renamed from path_prepend.  All uses changed.
72         * src/rmdir.c (remove_empty_parents): Renamed from empty_paths.
73         All uses changed.
74         (longopts): Add comment that --path is deprecated.
75
76 2005-05-31  Jim Meyering  <jim@meyering.net>
77
78         * src/copy.c (chown_privileges, chown_failure_ok): Mark as `extern'.
79         This is a crutch so that `make distcheck's sc_tight_scope rule
80         knows that they really are deliberately declared that way.
81
82 2005-05-30  Paul Eggert  <eggert@cs.ucla.edu>
83
84         Port to Solaris 10's rules for whether programs can chown files.
85         * src/copy.c [HAVE_PRIV_H]: Include <priv.h>.
86         (DO_CHOWN): Remove.  Replaced by chown_failure_ok.  All callers
87         changed.
88         (copy_internal): If chown failed, don't worry about what happened
89         to the mode bits; they can't have changed.
90         (chown_privileges, chown_failure_ok): New functions.
91         * src/copy.h: Add copyright notice.
92         (struct cp_options): Remove myeuid member.  Add chown_privileges
93         member.
94         (chown_privileges, chown_failure_ok): New function decls.
95         * src/cp.c (re_protect): Remove unnecessary call to geteuid.
96         Use chown_failure_ok rather than our own code.
97         * src/cp.c (cp_options_init): Use chown_privileges rather than geteuid.
98         * src/install.c (cp_option_init): Likewise.
99         * src/mv.c (cp_option_init): Likewise.
100
101 2005-05-29  Paul Eggert  <eggert@cs.ucla.edu>
102
103         * src/chgrp.c (getgrnam) [!defined _POSIX_VERSION]: Remove decl.
104         * src/chown-core.c (getgrnam, getgrgid) [!defined _POSIX_VERSION]:
105         Remove decls.
106         * src/cp.c (geteuid) [!defined _POSIX_VERSION]: Remove decl.
107         * src/id.c (getpwuid, getgrgid, getuid, getgid, geteuid, getegid)
108         [!defined _POSIX_VERSION]: Remove decls.
109         * src/install.c (getpwnam, getgrnam): Remove decl.
110         (getuid, getgid) [!defined _POSIX_VERSION]: Remove decls.
111         * src/md5sum.c (OPENOPTS, TEXT1T01, TEXTCNVT): Remove.
112         (digest_file): Use O_BINARY-using expr instead of OPENOPTS.
113         * src/system.h: Don't bother mentioning _POSIX_VERSION in comment.
114         * src/test.c: Include sys/param.h if it exists, not if _POSIX_VERSION
115         isn't defined.
116         Don't include <sys/file.h>; no longer needed.
117         (getegid, geteuid): Remove no-longer-necessary decls.
118
119         * src/pathchk.c (_POSIX_PATH_MAX) [!defined _POSIX_PATH_MAX]:
120         Define to 256, not 255, as per modern POSIX.
121
122 2005-05-27  Paul Eggert  <eggert@cs.ucla.edu>
123
124         * NEWS: dd seek=N now conforms to POSIX if the output isn't seekable.
125         * src/dd.c (skip): Return the number of records that were not
126         skipped due to encountering EOF.
127         (dd_copy): If the file wasn't seekable and EOF was encountered,
128         write zeros past EOF until the desired offset is reached.
129
130         * NEWS: expr and test now correctly compare integers of unlimited size.
131         (Also, correct a comment that claimed that expr detects integer
132         overflow; it does so only when converting from strings.)
133         * src/expr.c: Include strnumcmp.h, xstrtol.h.
134         (looks_like_integer): New function.
135         (toarith): Use it.  Also, use xstrtoimax rather than rolling our
136         own diagnostics.
137         (eval2): Don't look for trouble if !evaluate; this simplifies things.
138         Compare numbers using string comparison, so that overflow is
139         not possible.
140         * src/sort.c: Refactor so that others can use large-integer
141         comparison functions.
142         Include "strnumcmp.h".
143         (NEGATION_SIGN, NUMERIC_ZERO, fraccompare):
144         Remove; moved to strnumcmp.
145         (decimal_point): Now int, to simplify converison overhead with
146         new API.  All uses changed.
147         (thousands_sep): Now -1 if there isn't one, as per new API.
148         All uses changed.
149         (numcompare): Move contents to strnumcmp module, except for
150         skipping blanks.
151         * src/test.c: Include inttostr.h, strnumcmp.h.
152         (whitespace, digit, digit_value, integer_expected_error): Remove.
153         (is_int): Remove; replaced by...
154         (find_int): New function.
155         (binary_operator): Don't let integers overflow in comparisons;
156         return the correct answer instead.  Simplify the code.
157         (unary_operator): Convert the integer ourself, since find_int
158         no longer does so.
159         * tests/expr/basic (bigcmp): New test.
160         * tests/test/Test.pm (eq-6, gt-5, lt-5): New tests.
161
162 2005-05-26  Paul Eggert  <eggert@cs.ucla.edu>
163
164         * NEWS: nohup now redirects a tty stdin to an unreadable fd
165         instead of closing it.
166         * doc/coreutils.texi (nohup invocation): Document this.
167         * src/nohup.c (main): Implement this.
168
169 2005-05-26  Jim Meyering  <jim@meyering.net>
170
171         * src/expr.c (toarith): Fix a sign error introduced on 2005-01-14.
172         Reported by David Alan Gilbert.
173         * tests/expr/basic: Add tests using arithmetic on negative integers.
174
175 2005-05-19  Jim Meyering  <jim@meyering.net>
176
177         * src/remove.c (AD_mark_helper, AD_mark_current_as_unremovable):
178         Remove inaccurate-but-harmless `const' attributes.
179
180         * src/join.c (decode_field_spec): Add an abort after
181         `error (EXIT_FAILURE, ...' to avoid a gcc warning in caller,
182         about variables being used uninitialized.
183
184 2005-05-18  Paul Eggert  <eggert@cs.ucla.edu>
185
186         * configure.ac: Add copyright notice.  gl_LIB_CHECK -> cu_LIB_CHECK.
187         * src/Makefile.am: Add copyright notice.
188         (factor_LDADD): Remove, as factor no longer needs sqrt.
189         * src/hostname.c: Remove test for HAVE_LIMITS_H; we can assume
190         it's always true now.
191
192 2005-05-16  Paul Eggert  <eggert@cs.ucla.edu>
193
194         Fix Cygwin porting problem reported by Eric Blake.
195         * src/remove.c (DT_IS_DIR): Remove.
196         (DT_IS_KNOWN, DT_MUST_BE): New macros.
197         (remove_entry): Use them.
198
199 2005-05-14  Paul Eggert  <eggert@cs.ucla.edu>
200
201         * src/remove.c: Include unlinkdir.h.
202         (UNLINK_CAN_UNLINK_DIRS): Remove.
203         (remove_entry): Use cannot_unlink_dirs () rather than
204         UNLINK_CAN_UNLINK_DIRS.
205
206 2005-05-14  Jim Meyering  <jim@meyering.net>
207
208         Update FSF postal mail address.
209         * Makefile.maint, Makefile.cfg, gnupload
210         * src/basename.c, src/cat.c, src/checksum.h, src/chgrp.c
211         * src/chmod.c, src/chown-core.c, src/chown-core.h, src/chown.c
212         * src/chroot.c, src/cksum.c, src/comm.c, src/copy.c, src/copy.h
213         * src/cp-hash.c, src/cp-hash.h, src/cp.c, src/csplit.c, src/cut.c
214         * src/date.c, src/dcgen, src/dd.c, src/df.c, src/dircolors.c
215         * src/dirname.c, src/du.c, src/echo.c, src/env.c, src/expand.c
216         * src/expr.c, src/factor.c, src/fmt.c, src/fold.c, src/fs.h
217         * src/groups.sh, src/head.c, src/hostid.c, src/hostname.c, src/id.c
218         * src/install.c, src/join.c, src/kill.c, src/lbracket.c, src/link.c
219         * src/ln.c, src/logname.c, src/ls-dir.c, src/ls-ls.c, src/ls-vdir.c
220         * src/ls.c, src/ls.h, src/md5.c, src/md5sum.c, src/mkdir.c
221         * src/mkfifo.c, src/mknod.c, src/mv.c, src/nice.c, src/nl.c
222         * src/nohup.c, src/od.c, src/paste.c, src/pathchk.c, src/pinky.c
223         * src/pr.c, src/printenv.c, src/printf.c, src/ptx.c, src/pwd.c
224         * src/readlink.c, src/remove.c, src/remove.h, src/rm.c, src/rmdir.c
225         * src/seq.c, src/setuidgid.c, src/sha1sum.c, src/shred.c
226         * src/sleep.c, src/sort.c, src/split.c, src/stat.c, src/stty.c
227         * src/su.c, src/sum.c, src/sync.c, src/system.h, src/tac-pipe.c
228         * src/tac.c, src/tail.c, src/tee.c, src/test.c, src/touch.c
229         * src/tr.c, src/true.c, src/tsort.c, src/tty.c, src/uname.c
230         * src/unexpand.c, src/uniq.c, src/unlink.c, src/uptime.c
231         * src/users.c, src/wc.c, src/who.c, src/whoami.c, src/yes.c
232
233 2005-05-13  Jim Meyering  <jim@meyering.net>
234
235         * NEWS: `rm -r' now removes all of the files it should, even on
236         systems with a buggy readdir affecting file systems inaccessible
237         at configure time.
238
239         In some unusual circumstances `rm -r' would fail to remove --
240         or even consider -- all entries in a directory with more than 254
241         (SunOS) or 338 (Darwin) entries.  This could cause trouble even on
242         other types of systems when using an affected file system via e.g.,
243         NFS.  The underlying cause was a bug in readdir on those systems.
244         Coreutils-5.2.1 and earlier used a configure-time test designed
245         to detect precisely those problem systems, but it would detect
246         the problem and enable remove.c's work-around code only when its
247         configure-time test was run on a losing file system.  Obviously,
248         it couldn't detect a problem if the offending file system wasn't
249         tested or even mounted at coreutils configure time.  Now, rm itself
250         performs a minimal-cost run-time test to detect the problem.
251
252         * src/remove.c (CONSECUTIVE_READDIR_UNLINK_THRESHOLD): Define.
253         (remove_cwd_entries):  When readdir returns NULL for a directory from
254         which we've removed more than CONSECUTIVE_READDIR_UNLINK_THRESHOLD
255         entries, call rewinddir and then resume the readdir/unlink loop.
256         (UNLINK_CAN_UNLINK_DIRS): Rename from ROOT_CAN_UNLINK_DIRS.
257
258 2005-05-12  Paul Eggert  <eggert@cs.ucla.edu>
259
260         * NEWS: nohup now closes stdin if it is a terminal, unless
261         POSIXLY_CORRECT is set.  This fixes a glitch noted by Wayne Pollock in
262         <https://www.opengroup.org/sophocles/show_mail.tpl?
263         source=L&listname=austin-group-l&id=8341>.
264         * doc/coreutils.texi (nohup invocation): Document this.
265         * src/nohup.c (main): Implement this.
266
267 2005-05-12  Jim Meyering  <jim@meyering.net>
268
269         * src/date.c: Assume `free (NULL)' works.
270         * src/dd.c: Likewise.
271         * src/df.c:Likewise.
272         * src/dircolors.c:Likewise.
273         * src/head.c: Likewise.
274         * src/ls.c: Likewise.
275         * src/md5sum.c: Likewise.
276         * src/pr.c: Likewise.
277         * src/sort.c: Likewise.
278
279 2005-05-10  Jim Meyering  <jim@meyering.net>
280
281         * tests/touch/not-owner: Skip this test if the user running it
282         owns `/' or has write access to it.
283
284         * src/copy.c (abandon_move): Remove erroneous UNWRITABLE check.
285         This makes `mv -i --reply=no f1 f2' work as expected (in not
286         performing the move operation).  But note that specifying `-i'
287         after `--reply=no' does *not* work.
288         Tiny patch from Vlada Macek.
289         Correct a comment.
290         * tests/mv/reply-no: New file.  Test for the above fix.
291         * tests/mv/Makefile.am (TESTS): Add reply-no.
292
293         * tests/ls-2/tests: Don't print PATH to stderr.
294
295 2005-05-08  Paul Eggert  <eggert@cs.ucla.edu>
296
297         * NEWS: cp, ln, mv, rm no longer discard white space when intepreting
298         responses.
299
300 2005-05-06  Paul Eggert  <eggert@cs.ucla.edu>
301
302         * NEWS: dd has new iflag= and oflag= flags "binary" and "text".
303         * src/dd.c (flags, usage): Add support for "binary" and "text".
304
305 2005-05-04  Paul Eggert  <eggert@cs.ucla.edu>
306
307         * NEWS: chmod -w now complains if it differs from chmod a-w.
308         * src/chmod.c: Include quotearg.h.
309         (diagnose_surprises): New var.
310         (process_file): Diagnose surprises.  Simplify the logic a bit,
311         while we're at it.
312         (main): Prepare to diagnose surprises.  Remove useless code for
313         '-' option.
314         * tests/chmod/Makefile.am (TESTS): Add umask-x.
315         * tests/chmod/umask-x: New file.
316
317 2005-05-02  Paul Eggert  <eggert@cs.ucla.edu>
318
319         * NEWS: ls --indicator-style=directory renamed to ls
320         --indicator-style=slash, to avoid confusion with ls --directory.
321         * src/ls.c (usage): Likewise.
322         (slash): Renamed from directory_only.  All uses changed.
323
324 2005-05-01  Paul Eggert  <eggert@cs.ucla.edu>
325
326         * NEWS: "chmod +1 foo" is now diagnosed.
327
328 2005-04-29  Paul Eggert  <eggert@cs.ucla.edu>
329
330         * NEWS: ls -p now marks only directories.  New option
331         --indicator-style=directory equivalent to -p.
332         * doc/coreutils.texi (ls invocation): Document this.
333         Also, mention ">" is for doors.
334         * src/ls.c (enum indicator_style): New constant directory_only,
335         for -p.
336         (indicator_style_args, indicator_style_types): Set it appropriately.
337         (decode_switches, gobble_file, print_type_indicator):
338         (length_of_file_name_and_frills):
339         Implement the change described in NEWS.
340         (decode_switches): Quote ">", too.
341         (usage): Update to match the new behavior.  Describe ">".
342         * tests/ls/file-type: Test for new behavior.  Omit -1 option.
343         The "ls --color" test wasn't being checked; add a check for
344         "ls --color=auto" instead.
345
346         * tests/head/Test.pm: Don't set _POSIX2_VERSION; no longer needed.
347         * tests/misc/split-fail: Likewise.
348         * tests/pr/Test.pm: Likewise.
349         * tests/sort/Test.pm: Fix comment to match new behavior of "sort".
350         * tests/tail/Test.pm (tv): Rename tests from obs to obs-plus
351         if they use file names starting with +.
352         (test_vector): Don't set _POSIX2_VERSION if obs but not obs-plus.
353         * tests/uniq/Test.pm (tv, test_vector): Likewise.
354
355         The following was partly derived from a tiny change by Eric Blake:
356         * tests/misc/nice: Don't use 'set -'.  It's not portable to strict
357         POSIX 1003.1-2001 hosts.  Also, don't set _POSIX2_VERSION.
358         * tests/mkdir/perm: Don't use 'set -'.  Simplify test construction.
359         Work even if the underyling system attaches ACLs to new dirs.
360         * tests/mv/part-hardlink: Don't use 'set -'.
361         * tests/stty/row-col-1: Don't use 'set -'.
362
363 2005-04-28  Paul Eggert  <eggert@cs.ucla.edu>
364
365         * NEWS: Document fixes described below.
366         * src/chmod.c (change, umask_value): New static vars.
367         (reference_file): Move this static var to inside "main".
368         (process_file, process_files): Remove CHANGES arg; now taken from
369         static var.  All uses changed.
370         (usage): Fix incorrect description of MODE operand.
371         (main): For invalid mode usages, output a brief usage message.
372         Adjust to new modechange API.
373         * install.c (main): Adjust to new modechange API.
374         Also, free the mode_change object when done.
375         * mkdir.c (main): Likewise.
376         * mkfifo.c (main): Likewise.
377         * mknod.c (main): Likewise.
378         * tests/chmod/equal-X: Check for =xX bug.
379         * tests/chmod/equals: Check for =u bug.
380         * tests/chmod/usage: Check for u+gr and ug,+x bugs.
381
382 2005-04-26  Paul Eggert  <eggert@cs.ucla.edu>
383
384         Restore support for usages like "head -1" and "tail -1",
385         even when conforming to POSIX 1003.1-2001.
386         Fix bug with "POSIXLY_CORRECT=1 fold file -3".
387         join now supports a NUL field separator, e.g., "join -t '\0'".
388         join now detects and reports incompatible options, e.g.,
389         "join -t x -t y",
390         * NEWS: Document this.
391         * src/date.c: Remove posixver.h and its uses.
392         (COMMON_SHORT_OPTIONS): Remove.
393         (short_options): New constant.
394         (short_options, usage): -I now always takes an optional arg.
395         * src/expand.c: Remove posixver.h and its uses.
396         (shortopts): New constant.  -DIGIT now always takes an optional arg.
397         (main): Revamp parsing of -DIGIT to let parse_tab_stops handle it.
398         Don't complain about -DIGIT.
399         * src/fold.c: Remove posixver.h and its uses.
400         (shortopts): New constant.  -DIGIT now always takes an optional arg.
401         (main): Don't preprocess arg list; that was buggy.  Use method
402         similar to expand.
403         * src/head.c: Remove posixver.h and its uses.
404         (header_mode_option): Remove.
405         (main): Don't complain about obsolete -NUM args.
406         * src/join.c: Remove posixver.h and its uses.
407         (obsolete_usage): Remove.
408         (join_field_1, join_field_2): Initialize to SIZE_MAX to indicate
409         they haven't been set yet.
410         (tab): Now int, not char.  Initialize to -1 to indicate white space
411         separates columns, so that we can use NUL as a separator.
412         All uses changed.
413         (OBSOLETE_LONG_OPTIONS, get_option): Remove.
414         (string_to_join_field): Remove ERR_MSG_FMT arg; a single format
415         suffices.  Use xstrtoul for sizes; it suffices.
416         (decode_field_spec): Report an error and exit on failure.  Return void,
417         not bool.
418         (add_field_list): Likewise.
419         (set_join_field): New function.
420         (enum operand_status): New enum.
421         (add_file_name): New args OPERAND_STATUS, JOPTION_COUNT,
422         PREV_OPTC_STATUS, OPTC_STATUS to handle the bewildering array of
423         possibilities with obsolete option parsing.
424         (main): Use it.  Do not depend on POSIX version.
425         Check for conflicting options.  Parse obsolete options -j1 and -j2
426         so that it is a pure extension to POSIX 1003.1-2001.
427         Allow '-t\0' to specify a NUL tab, stealing the code from 'sort'.
428         * src/nice.c: Remove posixver.h and its uses.
429         (main): Always support -NUM option.
430         * src/od.c: Remove posixver.h and its uses.
431         (short_options): New constant, which always supports -w[num].
432         (COMMON_SHORT_OPTIONS): Remove.
433         * src/pr.c: Remove posixver.h and its uses.
434         (short_options): New constant, which always supports -S[string].
435         (COMMON_SHORT_OPTIONS): Remove.
436         * src/sort.c: Remove posixver.h and its uses.
437         (short_options): New constant, which always supports -y arg.
438         (COMMON_SHORT_OPTIONS): Remove.
439         (main): Redo workaround for Solaris compatibility with -y.
440         This change isn't visible to the user; it just cleans up the
441         code so that we don't need posixver.h.
442         * src/split.c: Remove posixver.h and its uses.
443         (main): Don't complain about -NUM option.
444         * src/tail.c (parse_obsolete_option): Don't complain about -NUM.
445         * src/unexpand.c: Remove posixver.h and its uses.
446         (main): Don't complain about -TAB.
447         * src/uniq.c (main): Don't complain about -NUM.
448
449 2005-04-22  Paul Eggert  <eggert@cs.ucla.edu>
450
451         * src/nohup.c (main): If getopt fails, exit with status 127,
452         not status 1.  POSIX requires this.
453         * NEWS: Document this.
454
455         * src/nice.c (main): Report proper program name when getopt finds
456         trouble.  Problem reported by Behdad Esfahbod.
457
458         * NEWS: Fix bug with "mkdir -m =+x dir"; the umask was being ignored
459         when the "+x" was being evaluated.
460         * mkdir.c (main): Compile mode with MODE_MASK_ALL and initial umask.
461         * mkfifo.c (main): Likewise.
462         * mknod.c (main): Likewise.
463         * tests/mkdir/perm: Test for the above bug.
464
465 2005-04-20  Paul Eggert  <eggert@cs.ucla.edu>
466
467         Port test cases to Microsoft-Windows-related environments,
468         following suggestions from Eric Blake.
469         * tests/install/Makefile.am (TESTS_ENVIRONMENT): Add EXEEXT.
470         * tests/install/basic-1: Undo previous change.
471         (dd, dd2): New vars, which use $EXEEXT.  All uses of dd and dd2 changed.
472         * tests/install/trap: Undo previous change.
473         (sig): New var.  Use it insted of "trap '' CHLD".
474         Append $EXEEXT to executable name.
475
476         "fetish" -> "coreutils" in more places.
477         * tests/Coreutils.pm: Renamed from tests/Fetish.pm.
478         (package Coreutils): Renamed from package Fetish.  All uses changed.
479         * tests/Makefile.am (EXTRA_DIST): Add Coreutils.pm and
480         remove Fetish.pm.
481
482 2005-04-19  Paul Eggert  <eggert@cs.ucla.edu>
483
484         * tests/mv/setup (dot_mount_point): Use stat -L, in case the
485         directory is actually a symbolic link.  Problem reported by
486         Eric Blake.
487
488         * tests/mv/mv-special-1: Use test -p to test for fifos, rather
489         than the (incorrect) test -f and the (inadequate) ls.  ls is
490         inadequate because on some hosts a buggy mv will create a file of
491         the wrong type (problem reported by Eric Blake).  Skip this test
492         if test -p doesn't work.
493
494         * tests/chmod/setgid: Use numeric group ids, not symbolic group names,
495         since the latter can have shell metacharacters in them (e.g., spaces).
496         This follows up to the 2005-01-17 patch, which missed this occurrence.
497
498 2005-04-18  Paul Eggert  <eggert@cs.ucla.edu>
499
500         "fetish" -> "coreutils" in several places.
501         * Makefile.cfg (ftp): Remove fetish.sf.net.
502         * Makefile.maint (emit_upload_commands): Likewise.
503         * src/Makefile.am (LDADD, $(PROGRAMS)): fetish -> coreutils.
504         * tests/group-names (COREUTILS_GROUPS): Renamed from FETISH_GROUPS.
505         * tests/chmod/setgid (FETISH_GROUP): Renamed from COREUTILS_GROUP.
506
507         * tests/install/basic-1: Use "cat", not "test", to test for
508         ../../src/dd.  Problem reported by Eric Blake.
509
510 2005-04-18  Jim Meyering  <jim@meyering.net>
511
512         * src/dd.c: Don't include stat-macros.h directly.  system.h does that.
513
514 2005-04-17  Paul Eggert  <eggert@cs.ucla.edu>
515
516         Work around a couple of "make check" failures reported for Cygwin
517         and ash by Eric Blake.
518         * tests/install/basic-1: Skip this test if ../../src/dd isn't readable.
519         * tests/install/trap: Skip this test if "trap '' CHLD" doesn't work.
520
521 2005-04-16  Jim Meyering  <jim@meyering.net>
522
523         * src/dd.c (S_TYPEISSHM): Remove definition.
524         Get the definition by including "stat-macros.h", instead.
525
526 2005-04-14  Paul Eggert  <eggert@cs.ucla.edu>
527
528         Fix test suite problems reported by Eric Blake on Cygwin.
529         * tests/mv/mv-special-1: Ignore chatter about when files are removed,
530         since POSIX doesn't require rename to fail across file systems.
531         * tests/mv/setup (dot_mount_point): Use stat rather than df, as
532         it's more reliable.
533         (other_partition_tmpdir): Remove df from name as that would be
534         misleading now.
535
536 2005-04-14  Jim Meyering  <jim@meyering.net>
537
538         * src/chown-core.c: Correct typo, fchmod -> fchown, in a comment.
539
540 2005-04-12  Paul Eggert  <eggert@cs.ucla.edu>
541
542         * src/ls.c (usage): "uid" -> "user ID".
543
544 2005-04-12  Jim Meyering  <jim@meyering.net>
545
546         * src/tsort.c (tsort): Use "%s" as the format string,
547         rather than a diagnostic or a file name.
548
549         * src/comm.c (compare_files): Remove declaration of unused local.
550
551         * src/chown-core.c (chopt_free): Mark parameter as unused.
552
553 2005-04-11  Paul Eggert  <eggert@cs.ucla.edu>
554
555         * man/chown.x: Reword to match user manual.
556         * man/id.x: Likewise.
557         * src/setuidgid.c (usage): Use "user ID", not "UID", and similarly
558         for "group ID".
559         * src/whoami.c (usage, main): Likewise.
560
561         Add bulletproofing for cases where stdin, stdout, or stderr are closed.
562         * src/comm.c: Include stdio-safer.h.
563         (compare_files): Exit right away on I/O error rather than continuing
564         and producing confusing output and error messages.
565         Return void, not int; all callers changed.
566         Use fopen_safer to avoid confusion with file descriptors.
567         * src/copy.c: Include unistd-safer.h.
568         (copy_reg): Use fd_safer.
569         * src/csplit.c: Include stdio-safer.h.
570         (input_desc): Remove unnecessary static initialization.
571         (set_input_file): Use STDIN_FILENO, not 0.
572         (create_output_file): Use fopen_safer.
573         * src/dircolors.c (dc_parse_file): Don't assume fopen does not
574         return stdin.
575         * src/head.c (head_file): Don't assume open does not return 0.
576         * src/join.c: Include stdio-safer.h.
577         (main): Use fopen_safer.  Simplify the resulting code.
578         * src/md5sum.c (digest_file, digest_check):
579         Don't assume that fopen does not return stdin.
580         * src/nohup.c: Include unistd-safer.h.
581         (main): Don't dup stderr to stdin or stdout by mistake.
582         * src/od.c (check_and_close): Don't assume fopen does not return stdin.
583         * src/paste.c (paste_serial): Likewise.
584         * src/pr.c: Include stdio-safer.h.
585         (open_file): Use fopen_safer.
586         (close_file): Don't assume fopen does not return stdin.
587         * src/ptx.c (main): Don't assume fopen returns stdout after closing
588         stdout.  Use freopen instead.
589         * src/shred.c: Include unistd-safer.h.
590         (wipename): Use fd_safer on directory file descriptor.
591         (wipefile): Remove special case for /dev/fd/* on older hosts.
592         It didn't work in general, and wasn't documented.
593         Use fd_safer.
594         * src/sort.c: Include unistd-safer.h.
595         (create_temp_file): Use fd_safer.
596         (xfclose): Don't assume fileno (stdin) == STDIN_FILENO, etc.
597         * src/split.c: Include unistd-safer.h.
598         (cwrite): Use fd_safer.  Replace mystery constant 0666 with symbolic
599         version, as POSIX requires.
600         * src/sum.c (bsd_sum_file, sysv_sym_file):
601         Use same pattern as elsewhere for checking for stdin.
602         * src/tac.c: Include unistd-safer.h.
603         (copy_to_temp): Use fd_safer.
604         (tac_file): Don't assume fopen cannot return stdin.
605         * src/tail.c: Include unistd-safer.h rather than fcntl-safer.h.
606         (recheck, tail_file): Use fd_safer rather than open_safer.
607         * src/tee.c: Include stdio-safer.h.
608         (tee): Use fopen_safer.
609         * src/touch.c: Include unistd-safer.h.
610         (touch): Use fd_safer.
611         * src/tsort.c (have_read_stdin): Remove; no longer needed.  All uses
612         removed.
613         (tsort): Do not assume fopen can't return stdin.
614         Close stdin before returning.  All uses changed.
615         * src/unexpand.c (next_file): Don't assume fopen cannot return stdin.
616         * src/uniq.c: Include stdio_safer.h.
617         (check_file): Don't assume fopen cannot return stdin or stdout.
618
619 2005-04-09  Jim Meyering  <jim@meyering.net>
620
621         * src/dd.c (quit): Define with ATTRIBUTE_NORETURN.
622
623         Now that close_stdout closes standard output unconditionally,
624         these workarounds for dd and cat are no longer necessary.
625         * src/dd.c (close_stdout_wrapper): Remove function.
626         (main): Call atexit with close_stdout, instead.
627         * src/cat.c (close_stdout_wrapper): Likewise.
628         Don't close STDOUT_FILENO explicitly; close_stdout does it.
629
630         * src/system.h (__attribute__): Readability nit:
631         Change this:
632         #  define __attribute__(x)
633         to this:
634         #  define __attribute__(x) /* empty */
635
636 2005-04-09  Jim Meyering  <jim@meyering.net>
637
638         * src/rm.c (usage): Mention that --recursive removes listed
639         directories too, not just their contents.
640         Say that by default, rm does not remove directories.
641
642         * src/pr.c: Don't include "timespec.h".  system.h does that.
643         * Makefile.maint (sc_system_h_headers): Propagate exit status
644         through trap.
645
646 2005-04-08  Paul Eggert  <eggert@cs.ucla.edu>
647
648         * NEWS: Document that dd no longer treats QUIT or PIPE specially,
649         and when conforming to POSIX no longer treats USR1 specially.
650         Document that dd no longer dumps core when handling signals.
651         * src/system.h (RETSIGTYPE): Remove; no longer needed.  All uses
652         replaced with void.
653         * src/csplit.c (SA_NOCLDSTOP): Define to 0 if not defined.
654         All uses changed.
655         (siginterrupt) [!HAVE_SIGINTERRUPT]: New macro.
656         (delete_all_files): New arg IN_SIGNAL_HANDLER, to avoid undefined
657         behavior when called from a signal handler.  All uses changed.
658         (main) [!defined SA_NOCLDSTOP]:
659         Use siginterrupt to specify that system calls should be interrupted.
660         * src/dd.c: Do not include safe-read.h or full-write.h; no longer needed.
661         (process_signals): Add forward decl.
662         (SA_NOCLDSTOP, sigprocmask, sigset_t) [!defined SA_NOCLDSTOP]:
663         New macros.
664         (siginterrupt) [! HAVE_SIGINTERRUPT]: New macro.
665         (SA_NODEFER) [!defined SA_NODEFER]: New macro.
666         (SA_RESETHAND) [!defined SA_RESETHAND]: New macro.
667         (caught_signals, interrupt_signal, info_signal_count, catch_siginfo):
668         New vars.
669         (usage): Mention -USR1 versus -INFO.
670         (cleanup): Don't invoke print_stats; the caller must do it now.
671         All callers changed.
672         (quit): Process signals just before exiting.
673         (interrupt_handler): Simply record the signal and return.
674         (siginfo_handler): Simply increment the signal counter and return.
675         (install_handler): Remove, replacing with:
676         (install_signal_handlers, process_signals, iread, iwrite):
677         New functions.  All callers to safe_read and full_write replaced
678         by iread and iwrite.  All callers to install_handler replaced by
679         install_handlers.
680         * src/ls.c (SA_NOCLDSTOP): Define to 0 if not defined.
681         All uses changed.
682         (siginterrupt) [! HAVE_SIGINTERRUPT]: New macro.
683         (main) [! SA_NOCLDSTOP]: Use it.
684         * src/shred.c: Remove all uses of signals; modern hosts have
685         /dev/random and don't need this gorp.
686         Do not include signal.h.
687         (env, sigill_handler, isaac_seed_machdep): Remove.  All uses removed.
688         * src/sort.c (SA_NOCLDSTOP): Define to 0 if not defined.
689         All uses changed.
690         (siginterrupt) [! HAVE_SIGINTERRUPT]: New macro.
691         (main) [! SA_NOCLDSTOP]: Use it.
692
693         * src/dd.c: Do not include inttostr.h, no longer needed.
694         (print_stats, main): Rewrite and simplify formats to use PRIuMAX
695         instead of umaxtostr.
696         (print_stats): Work even in languages that have special
697         forms for two of things, for r_truncate and w_bytes.  We can't
698         fix delta_s in this way, since ngettext doesn't support floating-point.
699         (main): Rewrite to avoid casts.
700
701 2005-04-07  Jim Meyering  <jim@meyering.net>
702
703         Placate gcc-4's -Wuninitialized.
704         * src/md5sum.c (digest_check) [lint]: Initialize hex_digest to NULL.
705         * src/test.c (binary_operator) [lint]: Initialize lt and rt to 0.
706
707         * src/test.c (is_int, age_of, binop): Declare `char *' parameters to
708         be `const'.
709         (binop): Move function definition to precede first use so we can...
710         (binop): ...remove prototype.
711
712 2005-04-05  Paul Eggert  <eggert@cs.ucla.edu>
713
714         * man/Makefile.am (.x.1): Remove "COMMAND.td/" from examples.
715         * src/basename.c (usage): Add examples.
716         * src/cat.c (usage): Likewise.
717         * src/chgrp.c (usage): Likewise.
718         * src/chown.c (usage): Likewise.
719         * src/dirname.c (usage): Likewise.
720
721 2005-04-05  Jim Meyering  <jim@meyering.net>
722
723         * src/nice.c (usage): Mention that some shells provide a
724         built-in function by the same name.
725         * src/nohup.c (usage): Likewise.
726         * src/printenv.c (usage):Likewise.
727
728 2005-04-04  Dmitry V. Levin  <ldv@altlinux.org>
729
730         * src/tee.c (tee): When closing files, do not close stdout,
731         leave this job to close_stdout() instead.
732         * configure.ac (AC_CONFIG_FILES): Add tests/tee/Makefile.
733         * tests/Makefile.am (SUBDIRS): Add tee.
734         * tests/tee/Makefile.am: New file.
735         * tests/tee/.cvsignore: Likewise.
736         * tests/tee/{basic,dash}: New tee tests.
737
738 2005-04-04  Jim Meyering  <jim@meyering.net>
739
740         * src/echo.c (usage): Mention that some shells provide a
741         built-in function by the same name.
742         * src/kill.c (usage): Likewise
743         * src/printf.c (usage): Likewise.
744         * src/pwd.c (usage): Likewise.
745         * src/stat.c (usage): Likewise.
746         * src/test.c (usage): Likewise.
747         * src/true.c (usage):
748         * src/system.h (USAGE_BUILTIN_WARNING): New macro.
749
750         * man/echo.x: Remove `DESCRIPTION' section, now that --help includes it.
751         * man/printf.x: Likewise.
752         * man/pwd.x: Likewise.
753
754 2005-04-03  Jim Meyering  <jim@meyering.net>
755
756         * src/pr.c (main): Fix off-by-one error.
757         pr -$(perl -e 'print "0"x63 . 1') would write one byte beyond the
758         end of a malloc'd buffer.
759
760 2005-04-01  Jim Meyering  <jim@meyering.net>
761
762         * src/pr.c (main): Free column_count_string when done with it.
763
764         Don't let pr treat +1:-1 like +1:18446744073709551615.
765         * src/pr.c (strtoumax): Remove declaration.
766         (first_last_page): Use xstrtoumax in place of strtoumax,
767         so we don't interpret a negative page number (e.g., in an option
768         like --pages=1:-1) as valid.
769         * tests/pr/Test.pm (neg-page): Add a test for this.
770
771 2005-03-30  Paul Eggert  <eggert@cs.ucla.edu>
772
773         * src/pinky.c (short_pinky): Adjust to read_utmp signature change.
774         * src/uptime.c (uptime): New arg OPTIONS.  All uses changed.
775         * src/users.c (users): Likewise.
776         * src/who.c (who): Likewise.
777         * src/uptime.c (main): Check PIDs when invoked with zero arguments.
778         * src/users.c (main): Likewise.
779         * src/who.c (main): Likewise.  Also with two arguments.
780         Omit duplicate code in 2-arg case.
781         (UT_PID): Moved to ../lib/readutmp.h.
782
783 2005-03-29  Jim Meyering  <jim@meyering.net>
784
785         * src/system.h (ptr_align): Declare `ptr' parameter to be a
786         `const' pointer, since this function never writes through it.
787
788         * src/uname.c: Indent cpp directives to reflect nesting.
789
790 2005-03-28  Jim Meyering  <jim@meyering.net>
791
792         * src/seq.c (get_width_format) [HAVE_RINT && HAVE_MODF && HAVE_FLOOR]:
793         Add `void' to make this an ANSI-style function declaration.
794         * src/remove.c (ds_init): Likewise.
795         * src/pr.c (print_sep_string): Likewise.
796
797         * src/stty.c (speeds): Declare this array to be static.
798         * src/Makefile.am (sc_tight_scope): Adjust to catch any
799         new declarations like that of stty.c's `speeds'.
800
801         * src/system.h (GETOPT_HELP_OPTION_DECL): Use NULL, not `0'.
802         (GETOPT_VERSION_OPTION_DECL): Likewise.
803         * src/chown.c (long_options): Likewise.
804         * src/chgrp.c (long_options): Likewise.
805         * src/chmod.c (long_options): Likewise.
806         * src/cp.c (sparse_type_string, reply_args, decode_preserve_arg):
807         Likewise.
808         * src/chown-core.c (chopt_init): Likewise.
809         * src/comm.c (long_options): Likewise.
810         * src/copy.c (copy_reg): Likewise.
811         * src/csplit.c (extract_regexp): Likewise.
812         * src/cut.c (longopts): Likewise.
813         * src/date.c (time_spec_string): Likewise.
814         * src/df.c (find_mount_point, show_point): Likewise.
815         * src/expr.c (docolon): Likewise.
816         * src/fmt.c (long_options): Likewise.
817         * src/ls.c (time_style_args, indicator_style_args, long_options)
818         (format_args, sort_args, time_args, decode_switches)
819         (gobble_file): Likewise.
820         * src/md5sum.c (long_options): Likewise.
821         * src/mv.c (reply_args): Likewise.
822         * src/paste.c (longopts): Likewise.
823         * src/pinky.c (print_entry): Likewise.
824         * src/pr.c (long_options): Likewise.
825         * src/ptx.c (long_options, format_args): Likewise.
826         * src/readlink.c (longopts): Likewise.
827         * src/sort.c (long_options, mergefps): Likewise.
828         * src/stat.c (long_options): Likewise.
829         * src/tac.c (main): Likewise.
830         * src/tail.c (follow_mode_string): Likewise.
831         * src/touch.c (longopts, time_args): Likewise.
832         * src/uniq.c (delimit_method_string): Likewise.
833         * src/uptime.c (print_uptime): Likewise.
834         * src/who.c (print_user): Likewise.
835
836 2005-03-27  Jim Meyering  <jim@meyering.net>
837
838         * src/dcgen: Simplify further, clean up.
839         Add a standard-output-closing global destructor.
840         Require perl-5.002.
841         * src/wheel-gen.pl: Use the same global destructor as dcgen.
842
843 2005-03-26  Paul Eggert  <eggert@cs.ucla.edu>
844
845         * src/dcgen: Squeeze multiple blanks into one.  Output a simple
846         array of adjacent strings rather than a more complicated data
847         structure; this saves space in the dircolors executable.
848         * src/dircolors.c (parse_line): Use char *, not unsigned char *.
849         This avoids casts.
850         (dc_parse_stream, main): Avoid casts.
851         Adjust to simpler data structure generated by new dcgen.
852
853 2005-03-25  Eric Blake  <ebb9@byu.net>  (tiny change)
854
855         * src/ls.c (usage): Document usage of LS_COLORS.
856
857 2005-03-25  Paul Eggert  <eggert@cs.ucla.edu>
858
859         * src/dircolors.hin: Add "TERM cygwin".
860
861 2005-03-25  Jim Meyering  <jim@meyering.net>
862
863         * src/system.h (DECIMAL_DIGIT_ACCUMULATE): Reverse the sense of
864         the return value, and update callers:
865         * src/cut.c (set_fields): Update use of DECIMAL_DIGIT_ACCUMULATE.
866         * src/expand.c (parse_tab_stops, main): Likewise.
867         * src/split.c (main): Likewise.
868         * src/unexpand.c (parse_tab_stops, main): Likewise.
869         * src/uniq.c (main): Likewise.
870
871 2005-03-22  Jim Meyering  <jim@meyering.net>
872
873         * build-aux: New directory.  Renamed from config.
874         * configure.ac: Reflect renaming: config -> build-aux.
875         * Makefile.am (dist-hook): Likewise.
876         * Makefile.maint: Likewise.
877         * Makefile.cfg (cvs_files): Likewise.
878         * .x-sc_sun_os_names: Likewise.
879         * .x-sc_trailing_blank: Likewise.
880
881         * src/ls.c (get_funky_string): Use '\a', rather than 7, for
882         portability to EBCDIC hosts.
883
884 2005-03-20  Jim Meyering  <jim@meyering.net>
885
886         * src/pr.c (init_header): Add missing `%' in new format string.
887         (init_header): Use zero-filled `.%09d' format, not space-filled `.%9d'.
888
889 2005-03-19  Jim Meyering  <jim@meyering.net>
890
891         * src/Makefile.am (pr_LDADD): Now that pr uses gettime, add
892         $(LIB_CLOCK_GETTIME) to get the required -lrt on newer Linux systems.
893
894 2005-03-18  Paul Eggert  <eggert@cs.ucla.edu>
895
896         * NEWS: pr -D "FORMAT" now accepts the same formats that
897         date +"FORMAT" does.
898         * src/pr.c: Include strftime.h, timespec.h.
899         (init_header): Obtain and format nanosecond part of time stamp.
900
901         * NEWS: nohup now ignores the umask when creating nohup.out.
902         nohup now closes stderr if it is a terminal and stdout is closed.
903         * src/nohup.c (main): Likewise.  Be a little more paranoid about
904         return values; e.g., check for any negative return from open.
905         Assume free (NULL) works.
906         Close file descriptor leak when redirecting standard output to a file.
907
908 2005-03-17  Jim Meyering  <jim@meyering.net>
909
910         * src/cut.c (set_fields): Use DECIMAL_DIGIT_ACCUMULATE macro,
911         in place of functionally-equivalent code.
912         * src/expand.c (parse_tab_stops, main): Likewise.
913         * src/split.c (main): Likewise.
914         * src/unexpand.c (parse_tab_stops, main): Likewise.
915         * src/uniq.c (main): Likewise.
916         * src/od.c: Use VERIFY macro in place of an equivalent open-coded
917         declaration.
918         * src/system.h (VERIFY, VERIFY_EXPR, DECIMAL_DIGIT_ACCUMULATE):
919         New macros.
920
921         Before, this command would make uniq skip 11 fields and print
922         only the first line:
923         $ _POSIX2_VERSION=1 ./uniq -f1 -1 <(seq --format='1 %g' 2)
924         1 1
925         1 2
926         * src/uniq.c (main): Interpret `uniq -f1 -1' like `uniq -f1',
927         not like `uniq -f11'.
928
929 2005-03-15  Jim Meyering  <jim@meyering.net>
930
931         Both `pr -0' and e.g., `pr -03' would evoke `column count too large'.
932         `pr -0' should give a better diagnostic and `pr -03' should be
933         equivalent to `pr -3'.
934         * src/pr.c (parse_column_count): Change return type to void.
935         Call error (EXIT_FAILURE, ... for an invalid string.
936         (main): Allocate space for column_count_string using malloc.
937         Accumulate all old-style column-count digits before converting.
938         When the number of columns is specified via both old-style,
939         (e.g., -3), and a long option (--columns=5), ensure that only
940         the last one specified takes effect.
941         * tests/pr/Test.pm: Add tests for the above.
942
943 2005-03-15  Corinna Vinschen  <corinna@vinschen.de>  (tiny change)
944
945         * src/copy.c (copy_reg): Copy regular files in binary mode.
946
947 2005-03-14  Paul Eggert  <eggert@cs.ucla.edu>
948
949         * NEWS: Restate why ls limits time stamp lengths.
950
951 2005-03-12  Jim Meyering  <jim@meyering.net>
952
953         Add a little infrastructure to help prevent future bugs like the
954         one fixed below.
955         * src/stat.c (xstrcat): New function.
956         (print_statfs, print_stat): Add buf_len parameter and convert all
957         uses of strcat to xstrcat.  Update callers.
958         (print_it): Call print_func with buf_len parameter.
959
960         Invoking stat -c FMT with a lone format directive of %s, %f, %h, %s,
961         could cause a buffer overrun error.
962         * src/stat.c (print_it): Allocate 2 more bytes, to accommodate our
963         conversion of the stat %s format string to the longer printf %llu one.
964         Patch from Guochun Shi.
965
966 2005-03-11  Paul Eggert  <eggert@cs.ucla.edu>
967
968         * src/ls.c (TIME_STAMP_LEN_MAXIMUM): New constant.
969         (long_time_expected_width, print_long_format): Use it, to avoid
970         some possible denial-of-service attacks.
971         * NEWS: Document this.
972
973 2005-03-11  Jim Meyering  <jim@meyering.net>
974
975         Prompt once again for `mv -i A B' when A and B are hard links
976         to the same file.  This fixes a bug introduced by my 2003-04-04
977         (coreutils-5.0.1) change.  Reported by Thomas Wolff via Eric Blake.
978         * src/copy.c (abandon_move): New function, factored out of
979         copy_internal, now that this code is being used from two places.
980         (copy_internal): Perform the same interactive-related test for
981         whether it's alright to proceed and (usually) overwrite the
982         destination file.
983         * tests/mv/i-4: Add tests for the above.
984
985         Don't segfault for a very long date format string, e.g.,
986         ls -ld --time-style=+%99999999H .
987         * src/ls.c (long_time_expected_width): Use x2nrealloc, not alloca,
988         so format string abuse cannot provoke stack overflow.
989         (print_long_format): Likewise.
990
991         Don't segfault for a long header date string, e.g.,
992         echo a|pr -D +%9999999A
993         * src/pr.c (init_header): Use x2nrealloc, rather than alloca.
994         Don't bother with fixed-sized initial buffer;  always use x*alloc.
995
996         * src/pr.c (init_header): Use slightly clearer INT_BUFSIZE_BOUND
997         in place of equivalent INT_STRLEN_BOUND + 1.
998         * src/expr.c (tostring, printv): Likewise.
999
1000 2005-03-09  Paul Eggert  <eggert@cs.ucla.edu>
1001
1002         * src/system.h: Include intprops.h.
1003         (TYPE_SIGNED, TYPE_MINIMUM, TYPE_MAXIMUM, INT_STRLEN_BOUND): Remove;
1004         they are now defined in intprops.h.
1005
1006 2005-03-09  Jim Meyering  <jim@meyering.net>
1007
1008         * TODO: Remove entry about named pipes.  It was fixed in 5.3.0.
1009
1010 2005-03-08  Paul Eggert  <eggert@cs.ucla.edu>
1011
1012         * src/date.c (usage): Redo to match recent documentation changes.
1013         Don't bother documenting which usages are GNU extensions; the list
1014         wasn't correct, and is better left to the printed manual anyway.
1015
1016 2005-03-06  Jim Meyering  <jim@meyering.net>
1017
1018         Factor out column-count processing.
1019         * src/pr.c: Include "inttostr.h".
1020         (parse_column_count): New function.
1021         (main): Use the new function for both old-style, -9, and long,
1022         --columns=-9, options.
1023
1024         * src/cksum.c: Remove `register' keyword.
1025         * src/cut.c: Likewise.
1026         * src/dd.c: Likewise.
1027         * src/env.c: Likewise.
1028         * src/factor.c: Likewise.
1029         * src/fmt.c: Likewise.
1030         * src/fold.c: Likewise.
1031         * src/id.c: Likewise.
1032         * src/logname.c: Likewise.
1033         * src/ls.c: Likewise.
1034         * src/pr.c: Likewise.
1035         * src/printf.c: Likewise.
1036         * src/shred.c: Likewise.
1037         * src/sort.c: Likewise.
1038         * src/sum.c: Likewise.
1039         * src/test.c: Likewise.
1040         * src/tsort.c: Likewise.
1041         * src/uniq.c: Likewise.
1042         * src/wc.c: Likewise.
1043         * src/whoami.c: Likewise.
1044
1045 2005-03-01  Paul Eggert  <eggert@cs.ucla.edu>
1046
1047         * src/Makefile.am (nanosec_libs): Remove $(LIB_XANOSLEEP); no
1048         longer needed.
1049
1050 2005-03-01  Jim Meyering  <jim@meyering.net>
1051
1052         * src/copy.c (copy_internal): Change test of source type from
1053         !S_ISREG to S_ISLNK.  Reported by Paul Eggert in
1054         http://lists.gnu.org/archive/html/bug-coreutils/2004-10/msg00050.html.
1055
1056 2005-02-28  Jim Meyering  <jim@meyering.net>
1057
1058         * NEWS: Mention that xnanosleep fixes sleep failure on linux-2.6.8.1.
1059
1060 2005-02-21  Paul Eggert  <eggert@cs.ucla.edu>
1061
1062         * src/Makefile.am (dd_LDADD, shred_LDADD): Add $(LIB_GETHRXTIME).
1063         (nanosec_libs): Add $(LIB_XNANOSLEEP).  Needed for newer GNU/Linux
1064         hosts with clock_gettime.
1065
1066 2005-02-20  Paul Eggert  <eggert@cs.ucla.edu>
1067
1068         * NEWS: Describe user-visible change to dd.
1069         * src/Makefile.am (dd_LDADD, shred_LDADD, nanosec_libs):
1070         Remove $(LIB_CLOCK_GETTIME).  These functions now use
1071         gethrxtime instead.
1072         * src/dd.c: Include gethrxtime.h, xtime.h.
1073         (start_time): Now of type xtime_t, not struct timespec.
1074         (print_stats, main): Use gethrxtime rather than gettime.
1075         * src/ls.c (time): Remove obsolete decl.
1076         (get_current_time): gettimeofday always returns 0, so don't
1077         check its result.
1078         * src/shred.c: Include gethrxtime.h.
1079         (isaac_seed): Use gethrxtime rather than a mishmash.
1080         * src/touch.c (time): Remove obsolete decl.
1081
1082         * tests/misc/split-fail: Don't assume that the current host
1083         supports integers wider than 32 bits.  Fix comment typo.
1084         * tests/od/x8: Likewise.
1085
1086         * src/chown-core.c (enum RCH_status): Remove trailing comma,
1087         as it's not valid in standard C89.
1088
1089 2005-02-15  Jim Meyering  <jim@meyering.net>
1090
1091         * src/stat.c (human_fstype): Add case/definition for S_MAGIC_XFS
1092         so that file systems of type `xfs' are recognized as such.
1093         * src/fs.h: Regenerate.
1094         Reported by Bernd Eckenfels.
1095         * src/stat.c (human_fstype): Likewise for S_MAGIC_JFS/jfs.
1096         * src/fs.h: Regenerate.
1097         Reported by Andreas Schwab.
1098
1099         * src/nice.c (NZERO) [NZERO == 0]: Undefine and define to 20,
1100         to work around the invalid definition from Darwin 7.7.0.
1101         Test failure reported by Sébastien Maret.
1102
1103 2005-02-14  Paul Eggert  <eggert@cs.ucla.edu>
1104
1105         * src/sort.c (mergefps): Use binary search rather than linear one
1106         when comparing new line to lines already in main memory.
1107         Idea suggested by James Lemley.
1108
1109 2005-02-09  Jim Meyering  <jim@meyering.net>
1110
1111         * src/copy.c (valid_options): Add an assertion that
1112         not both hard_link and symbolic_link are set.
1113
1114 2005-02-08  Paul Eggert  <eggert@cs.ucla.edu>
1115
1116         * NEWS: Document stat -f -c %S, plus changes to default formats.
1117         * doc/coreutils.texi (stat invocation): Normalize terminology,
1118         capitalization, and sort order to match --help output.  Mention %c
1119         for file systems.  Add new -f -c format %S, and document %s versus %S;
1120         problem reported by Jeroen van Wolffelaar.
1121         * src/stat.c (usage): Likewise.
1122         (STATFS_FRSIZE): New macro.
1123         (print_statfs): Use it, for stat -f -c %S.
1124         (do_statfs): Change default formats to output %S.
1125
1126 2005-02-03  Paul Eggert  <eggert@cs.ucla.edu>
1127
1128         * src/system.h: Include "memrchr.h".
1129         (memrchr) [!HAVE_DECL_MEMRCHR]: Remove decl.
1130
1131 2005-02-02  Jim Meyering  <jim@meyering.net>
1132
1133         * tests/du/8gb: Also adjust the test (s/64/128/) to detect
1134         systems that don't support sparse files.
1135         Check for $2 -ge 128, rather than $2 = 128, in case
1136         there is a file system type that doesn't support sparse files,
1137         yet for which metadata takes up additional space.
1138         Both reported by Andreas Schwab.
1139
1140 2005-02-01  Eric Blake  <ebb9@byu.net>  (tiny change)
1141
1142         * tests/du/8gb: Create a larger test file, so we properly
1143         detect that sparse files can be created on NTFS under cygwin.
1144
1145 2005-01-30  Jim Meyering  <jim@meyering.net>
1146
1147         * src/head.c (elide_tail_bytes_pipe): Correct wording in diagnostic.
1148
1149         * src/stty.c: Remove unnecessary parentheses in all #if directives.
1150
1151 2005-01-29  Eric Blake  <ebb9@byu.net>  (tiny change)
1152
1153         * .cvsignore: Ignore config.cache and config.status.lineno.
1154         * src/stty.c [VSWTCH]: Some systems, like Cygwin, use VSWTC
1155         instead of VSWTCH, for use with CSWTCH.
1156
1157 2005-01-29  Eric Blake  <ebb9@byu.net>  (tiny change)
1158
1159         * tests/Makefile.am (.PHONY): Add check-root and root-hint.
1160         * tests/rwx-to-mode: Ignore ACL designation.
1161         * tests/setgid-check: Likewise.
1162         * tests/chown/separator: Quote user and group names.
1163
1164 2005-01-24  Jim Meyering  <jim@meyering.net>
1165
1166         * src/cp.c (usage): Merge the descriptions of --no-dereference and -P.
1167         Suggestion from Johan Boule.
1168
1169 2005-01-17  Eric Blake  <ebb9@byu.net>  (tiny change)
1170
1171         * src/Makefile.am (all_programs.list): Strip $(EXEEXT) and remove
1172         duplicates.
1173         * man/Makefile.am (all_programs): Revert previous patch; updated
1174         all_programs.list fixes this.
1175         (.x.1): No need to add $(EXEEXT).
1176
1177 2005-01-03  Corinna Vinschen  <corinna@vinschen.de>  (tiny change)
1178
1179         * src/system.h: Use S_BLKSIZE value for ST_NBLOCKSIZE where
1180         available.
1181
1182 2005-01-22  Jim Meyering  <jim@meyering.net>
1183
1184         * Makefile.maint (v_etc_file): The version string has moved to
1185         version-etc-fsf.c, search that new file, not version-etc.c.
1186
1187 2005-01-17  Paul Eggert  <eggert@cs.ucla.edu>
1188
1189         * tests/group-names: Use numeric group ids, not symbolic group names,
1190         since the latter can have shell metacharacters in them (e.g., spaces).
1191         Problem reported by Eric Blake.
1192         * tests/chgrp/basic: Assume groups are numeric, not symbolic.
1193         * tests/chgrp/deref: Likewise.
1194         * tests/chgrp/posix-H: Likewise.
1195         * tests/chgrp/recurse: Likewise.
1196
1197 2005-01-15  Jim Meyering  <jim@meyering.net>
1198
1199         * src/shred.c (isaac_seed) [HAVE_GETHRTIME]: #if-0 this block,
1200         because just calling gethrtime evokes an `illegal instruction'
1201         failure when compiled with Sun's c89 on Solaris 8 and 9.
1202         Reported by Nelson Beebe.
1203
1204         * src/shred.c (isaac_seed) [HAVE_GETHRTIME]: Don't call ISAAC_SEED
1205         twice with the same value of `t'.
1206         Replace nested #if-#else blocks with #if-#elif-#elif chain.
1207
1208 2005-01-14  Jim Meyering  <jim@meyering.net>
1209
1210         The test, tests/tail/f-1, failed on powerpc-apple-darwin7.7.0.
1211         * src/tail.c (IS_TAILABLE_FILE_TYPE): Adjust definition also to include
1212         sockets, since that's what you get when reading from a command-line-
1213         supplied pipe on Darwin 7.7.
1214         (IS_PIPE_LIKE_FILE_TYPE): Define.
1215         (main): Use new IS_PIPE_LIKE_FILE_TYPE rather than simply S_ISFIFO.
1216         Reported by Nelson Beebe.
1217         This same change is also required on NetBSD/sparc-1.5.
1218         Reported by Adrian Bunk.
1219
1220         * src/expr.c (toarith): Rewrite to detect/diagnose integer overflow,
1221         rather than suffering silently.
1222         Before, expr would silently overflow and wrap around:
1223           $ expr 9223372036854775808 = 0   # $(echo 2^63|bc)
1224           1
1225         Now it detects the problem and exits nonzero:
1226           $ ./expr $(echo 2^63|bc) = 0
1227           ./expr: 9223372036854775808: integer is too large
1228
1229         * tests/chown/separator (id_gn): Exit 77, not 1, for a test-framework
1230         failure, so that doesn't cause `make check' to stop.  Nelson Beebe
1231         reported that this test would fail with the diagnostic,
1232         `cannot find name for group ID 10', on one of his systems.
1233
1234 2005-01-13  Jim Meyering  <jim@meyering.net>
1235
1236         * src/test.c (is_int): Don't overflow when evaluating integer
1237         constants.  Before, ./test $(echo 2^64|bc) -eq 0 && echo FAIL
1238         would print `FAIL'.
1239
1240         * tests/Fetish.pm (run_tests): Add code (if-0'd out) to detect
1241         names of temporary files that would clash on 8.3 file systems.
1242         * tests/mk-script (validate): Likewise.
1243
1244 2005-01-12  Jim Meyering  <jim@meyering.net>
1245
1246         * tests/dd/skip-seek: Shorten test names to accommodate 8.3 systems.
1247
1248         * tests/tr/Test.pm (repeat-xC): Change test name from
1249         `repeat-Compl', to avoid 8.3 conflict with `repeat-compl'.
1250         Reported by Eric Blake.
1251         (repeat-000): Rename to `repeat-zeros' for the same reason.
1252
1253 2005-01-11  Jim Meyering  <jim@meyering.net>
1254
1255         * configure.ac: Update version to 5.3.1.
1256
1257 2005-01-11  Eric Blake  <ebb9@byu.net>
1258
1259         * src/Makefile.am (check-README, check-AUTHORS): Account for $(EXEEXT).
1260         * man/Makefile.am (all_programs): Account for $(EXEEXT).
1261
1262 2005-01-11  Jim Meyering  <jim@meyering.net>
1263
1264         * src/unexpand.c (add_tab_stop): Properly diagnose a tabstop list
1265         with decreasing values.
1266
1267         * src/expand.c (main): Likewise.
1268         * src/unexpand.c (main): Check for overflow in tabstop values
1269         specified via the obsolete form.  E.g., now this command fails:
1270         _POSIX2_VERSION=1 ./unexpand -$(echo '2^64+1'|bc)
1271         Before it would act like `_POSIX2_VERSION=1 ./unexpand -1'.
1272         * tests/unexpand/basic-1 (obs-ovflo): New test for this.
1273
1274 2005-01-10  Paul Eggert  <eggert@cs.ucla.edu>
1275
1276         Respond to POSIX interpretations about pathchk -p dated 2005-01-06.
1277         * NEWS: Document the changes.
1278         * doc/coreutils.texi (pathchk invocation): Likewise.
1279         * src/pathchk.c (PORTABILITY_OPTION): New constant.
1280         (longopts, usage, main, validate_file_name):
1281         Add support for new -P option.
1282         Reject empty file names (unless -p is not specified and the
1283         current system allows empty file names).
1284         Change --portability so that is now equivalent to -p -P.
1285         Don't test whether file name is too long, if it is known to exist.
1286         (no_leading_hyphen): New function.
1287         * tests/misc/pathchk1: Add tests for empty file names and
1288         pathchk -P.
1289
1290 2005-01-08  Jim Meyering  <jim@meyering.net>
1291
1292         * Version 5.3.0.
1293
1294         `pr --columns=N' was not equivalent to `pr -N' when also using
1295         either -s or -w.
1296
1297         * src/pr.c (main): Set `explicit_columns' for --columns=N,
1298         not just for -N.  This bug has existed since the introduction
1299         of the --columns=N option on 1998-08-15.
1300         * NEWS: Document this.
1301         * tests/pr/Test.pm (test_vector): For each -N test, automatically
1302         create a new test vector using --columns=N.
1303
1304 2005-01-07  Paul Eggert  <eggert@twinsun.com>
1305
1306         * src/pr.c (main): Check for column count overflow with
1307         usages like "pr -2147483648".
1308
1309 2005-01-07  Jim Meyering  <jim@meyering.net>
1310
1311         * src/pr.c (init_fps): Use xnmalloc, rather than xmalloc.
1312
1313 2005-01-06  Jim Meyering  <jim@meyering.net>
1314
1315         * README: List the precise HP-UX version numbers that are affected.
1316         Suggestion from Bob Proulx.
1317
1318         * Makefile.maint (sc_changelog): Specify find's `-maxdepth 2'
1319         predicate before `-name ChangeLog' to avoid a harmless warning
1320         from find-4.2.10.
1321
1322 2005-01-05  Jim Meyering  <jim@meyering.net>
1323
1324         * tests/help-version: Punt on the uptime test, since it fails when
1325         it can't get boot time, and I don't want that to stop `make check'.
1326
1327         * src/du.c (process_file): Evaluate exclusion rules against
1328         the entire file name, not just the last component.
1329         Reported by Robert Lindgren.
1330         * tests/du/exclude: Test for this.
1331         * NEWS: Document this.
1332
1333         Ensure that tests/Makefile.am's check-root actions stay up to date.
1334         * Makefile.maint (sc_root_tests): New rule.
1335         (syntax-check-rules): Add it to the list.
1336
1337 2005-01-04  Jim Meyering  <jim@meyering.net>
1338
1339         * man/shred.x: Change one-line summary to reflect that shred does
1340         not remove files by default.  Suggestion from Helen Faulkner in
1341         http://bugs.debian.org/288552
1342
1343         * README: Request VERBOSE=yes output when reporting test failures.
1344         Other minor changes.
1345
1346         * tests/Makefile.am (check-root): Update.
1347
1348 2005-01-03  Paul Eggert  <eggert@cs.ucla.edu>
1349
1350         * src/system.h: Undo previous change; we now use Autoconf.
1351
1352 2005-01-03  Jim Meyering  <jim@meyering.net>
1353
1354         * tests/stty/row-col-1: Don't set rows or columns to zero, to avoid
1355         a bug in the TIOCGWINSZ ioctl on at least Solaris5.9 systems.  Setting
1356         either (or both) to zero would succeed, but subsequent `stty size'
1357         would say `no size information for this device' due to the ioctl
1358         failing with EINVAL.
1359
1360         * src/system.h: If PRIdMAX, PRIoMAX, PRIuMAX, and PRIxMAX are
1361         not all defined and either ULONG_MAX or ULLONG_MAX is not defined,
1362         then fail at compile-time rather than let tools like od produce
1363         invalid results at run time.
1364
1365 2004-12-21  Jim Meyering  <jim@meyering.net>
1366
1367         * src/csplit.c (usage): Say the default names are `xx00, xx01, ...',
1368         not `xx01, xx02, ...'.
1369         Reported by Matt Kraai in http://bugs.debian.org/286605
1370
1371         * tests/misc/split-fail: Avoid spurious failure on x86 Solaris5.9
1372         when using c89.
1373
1374 2004-12-20  Paul Eggert  <eggert@cs.ucla.edu>
1375
1376         * src/split.c (usage): Mention default size.  Suggested by Dan Jacobson.
1377
1378 2004-12-19  Paul Eggert  <eggert@cs.ucla.edu>
1379
1380         * NEWS: Mention that one should eval "`dircolors`" rather than
1381         `dircolors`.
1382
1383 2004-12-17  Jim Meyering  <jim@meyering.net>
1384
1385         * tests/mv/hard-link-1: Rearrange to use newer trap-handling code,
1386         so temporary directories aren't left behind upon e.g., interrupt.
1387
1388 2004-12-16  Paul Eggert  <eggert@cs.ucla.edu>
1389
1390         * src/ls.c (print_dir): Use "%s: not listing already-listed
1391         directory", not "not listing already-listed directory: %s", to
1392         format already-listed directories, to be consistent with other
1393         diagnostics involving file names and colons.
1394
1395 2004-12-15  Jim Meyering  <jim@meyering.net>
1396
1397         * src/Makefile.am (__LDADD): Define, so that building `[' on
1398         Solaris still uses the -lgen library that it requires in order
1399         to get a definition of eaccess.
1400
1401 2004-12-14  Jim Meyering  <jim@meyering.net>
1402
1403         tac would exit immediately upon I/O or temp-file creation failure.
1404         Now it continues on, processing any remaining command line arguments.
1405
1406         * src/tac.c: Include quotearg.h.
1407         Use quotearg_colon in most diagnostics.
1408         (copy_to_temp): Rewrite not to exit upon I/O or temp-file-creation
1409         failure.  Before, this command (with /full/tmp being a full partition)
1410           TMPDIR=/full/tmp ./tac /proc/modules tac.c
1411         would exit immediately upon the write error while trying to copy
1412         non-seekable /proc/modules to the full partition.  Now it still
1413         reports the failure but continues on with the remaining file.
1414         (tac_nonseekable): Return false also if copy_to_temp fails.
1415         [DONT_UNLINK_WHILE_OPEN]: Add a FIXME comment explaining that
1416         using atexit like this is wrong.
1417         * NEWS: Document this.
1418         * tests/misc/tac-continue: New test for this.
1419         * tests/misc/Makefile.am (TESTS): Add tac-continue.
1420
1421         * tests/chown/basic: Add a few more tests.
1422
1423 2004-12-13  Paul Eggert  <eggert@cs.ucla.edu>
1424
1425         * src/ls.c (gobble_file): Change arg name to be command_line_arg
1426         rather than explicit_arg, for consistency with copy.c.
1427         (extract_dirs_from_files): Remove ignore_dot_and_dot_dot arg, since
1428         it is deducible from dirname arg.  All callers changed.
1429         (extract_dirs_from_files, print_dir, queue_directory):
1430         Add command_line_arg arg.  All callers changed.
1431         (struct pending): Add command_line_arg member.
1432         (main): Use NULL rather than 0 when appropriate.
1433         (set_exit_status, file_failure): New functions.
1434         (queue_directory): Store command_line_arg into new structure.
1435         (print_dir, gobble_file, get_link_name):
1436         Use file_failure to report problems in accessing files,
1437         so that the exit status is set consistently.
1438         (print_dir): Simplify readdir failure code yet again.
1439         If closedir fails, report "closing directory" rather than "reading
1440         directory" failure.
1441         (xstrcoll): Use set_exit_status to set status on failure.
1442         * tests/ls-2/tests (no-a-isdir-b): This now exits with status 2,
1443         not status 1.
1444
1445 2004-12-11  Jim Meyering  <jim@meyering.net>
1446
1447         Avoid a race condition vulnerability in chown, when used with
1448         --from=O:G and without the (-h) --no-dereference option.
1449         * src/chown-core.c (restricted_chown): New function.
1450         (change_file_owner): Call it.
1451         Reported by Ulrich Drepper.
1452         * NEWS: Mention this.
1453
1454 2004-12-09  Paul Eggert  <eggert@cs.ucla.edu>
1455
1456         * ls now exits with status 1 on minor problems, 2 if serious trouble.
1457         * NEWS: Document this.
1458         * src/ls.c (LS_MINOR_PROBLEM, LS_FAILURE): New constants.
1459         All uses of EXIT_FAILURE replaced with LS_FAILURE, unless
1460         specified below.
1461         (main): Initialize exit failure to LS_FAILURE.
1462         (print_dir, gobble_file, get_link_name, xstrcoll):
1463         Set exit status to LS_MINOR_PROBLEM if the failure is minor.
1464         (print_dir): Do not give up on entire directory merely because readdir
1465         returns EOVERFLOW.
1466         (usage): Explain exit status.
1467         * tests/help-version: ls and variants now exit with status 2
1468         on serious trouble.
1469
1470 2004-12-08  Paul Eggert  <eggert@cs.ucla.edu>
1471
1472         * NEWS: Document new UTC+HH:MM date syntax, and put date changes
1473         together.
1474
1475 2004-12-07  Paul Eggert  <eggert@cs.ucla.edu>
1476
1477         * src/factor.c (factor): Don't list 1 as a factor of 1.
1478         Problem reported by Thomas Folz-Donahue.
1479
1480 2004-12-06  Jim Meyering  <jim@meyering.net>
1481
1482         * tests/du/files0-from: Sanitize environment.
1483         Otherwise, e.g., BLOCKSIZE=k would cause a failure, and that
1484         setting is the default (exported from /etc/profile) on at least one
1485         NetBSD 1.6 system.
1486         * tests/du/no-deref: Likewise.
1487         * tests/cp/symlink-slash: Likewise.
1488         * tests/ls/symlink-slash: Likewise
1489
1490 2004-12-05  Jim Meyering  <jim@meyering.net>
1491
1492         * tests/tail/Test.pm (err-6) ["tail -c"]: Avoid test failure when
1493         _POSIX2_VERSION=199209 is in the environment, or when building on
1494         e.g., OpenBSD 3.2.
1495
1496 2004-12-04  Jim Meyering  <jim@meyering.net>
1497
1498         * NEWS: Mention cut's new --complement option.
1499
1500 2004-10-01  Paolo Bonzini  <bonzini@gnu.org>
1501
1502         * cut.c (complement, COMPLEMENT_OPTION): New.
1503         (longopts): Add --complement.
1504         (usage): Say not that -b, -c, and -f `print' fields,
1505         but rather that they `select' fields for printing.
1506         Describe the new --complement option.
1507         (mark_range_start): Extracted from set_fields.
1508         (print_kth): Support --complement.
1509         (compare_ranges): New function.
1510         (set_fields): Rewrite the part that populates range_start_ht,
1511         merging it with the part that populates printable_field.
1512         (main): Handle --complement.
1513
1514 2004-12-03  Paul Eggert  <eggert@cs.ucla.edu>
1515
1516         * src/tail.c (tail_file): Set errnum to -1 if the initial "tail"
1517         failed.  This works around an assertion failure reported by
1518         Roberto Nibali in:
1519         http://lists.gnu.org/archive/html/bug-coreutils/2004-12/msg00012.html
1520
1521 2004-12-02  Jim Meyering  <jim@meyering.net>
1522
1523         With using --color and with LS_COLORS saying not to color
1524         executables, don't stat every file.
1525         * src/ls.c (is_colored): New function.
1526         (gobble_file): Use it.
1527         (main): Use it here, in place of too-strict tests against NULL:
1528         if either ORPHAN or MISSING was set to 0 from LS_COLORS, the
1529         old test would fail.
1530
1531 2004-12-01  Paul Eggert  <eggert@cs.ucla.edu>
1532
1533         * src/comm.c (compare_files): Assume setlocale exists.
1534         * src/join.c (keycmp): Likewise.
1535         * src/seq.c (decimal_point): Treat like sort.  Now char.
1536         All uses changed.
1537         (main): Assume localeconv exists.  Use same code as sort.
1538         * src/sort.c (C_DECIMAL_POINT): Remove.  Use changed to '.'.
1539         Assume setlocale exists.
1540         (thousands_sep): Renamed from th_sep.
1541         (IS_THOUSANDS_SEP): Remove.  All uses replaced by comparisons.
1542         (NONZERO): Parenthesize use of arg.
1543         (numcompare): Avoid duplicate loads.  Use ISDIGIT as boolean, for
1544         consistency.  Avoid unnecessary negation by reversing
1545         fraccompare args.
1546         (main): Rewrite localeconv call to match seq.c.
1547         * src/system.h: Assume locale.h exists.
1548         (HAVE_SETLOCALE): Remove.
1549         * src/uniq.c (different): Assume setlocale exists.
1550
1551         * src/ls.c (sort_files): Minor cleanup.  Remove an unnecessary
1552         'volatile' on a local variable.  Rewrite to avoid unnecessary
1553         double-assignment to 'func' in the usual case where strcoll does
1554         not fail.
1555
1556 2004-11-30  Paul Eggert  <eggert@cs.ucla.edu>
1557
1558         * src/pinky.c (gethostname): Remove decl.
1559         (scan_entries): Use IS_USER_PROCESS instead of by-hand code.
1560         * src/uptime.c (print_uptime): Use IS_USER_PROCESS and
1561         UT_TYPE_BOOT_TIME instead of by-hand code.
1562         * src/users.c (list_entries_users): Use IS_USER_PROCESS
1563         instead of by-hand code.
1564         * src/who.c (USER_PROCESS, RUN_LVL, INIT_PROCESS, LOGIN_PROCESS,
1565         DEAD_PROCESS, BOOT_TIME, NEW_TIME, UT_TYPE_UNDEF, UT_TYPE): Remove.
1566         (IS_USER_PROCESS): Move to ../lib/readutmp.h.
1567         (UT_TYPE_RUN_LVL, UT_TYPE_INIT_PROCESS, UT_TYPE_LOGIN_PROCESS,
1568         UT_TYPE_DEAD_PROCESS, UT_TYPE_NEW_TIME): New macros.
1569         (gethostname): Remove decl.
1570         (list_entries_who, scan_entries): Use the new macros defined above,
1571         for consistency with pinky, uptime, and users.
1572
1573 2004-11-25  Paul Eggert  <eggert@cs.ucla.edu>
1574
1575         Fix problem reported by Scott S. Tinsley for HP-UX 11.11 using
1576         HP's ANSI C compiler.  Declaring int functions causes warnings on
1577         some modern systems and shouldn't be needed to compile on ancient
1578         ones.
1579         * src/copy.h (stat, lstat, rename): Remove decls.
1580         * src/install.c (stat): Remove decl.
1581         * src/ln.c (link, symlink): Remove decls.
1582
1583 2004-11-25  Jim Meyering  <jim@meyering.net>
1584
1585         * man/help2man: Import help2man-1.35.1.
1586         * man/Makefile.am (.x.1): Remove now-unnecessary use of
1587         locally-added --program-name=NAME option.  Now, help2man gets
1588         the name from the [NAME] section (i.e. from our .x file).
1589         * man/install.x: Use `install', not `ginstall' in the one-line
1590         description.  Reported by Brendan O'Dea.
1591         * man/sha1sum.x: Use `sha1sum', not `shasum'.
1592
1593 2004-11-24  Jim Meyering  <jim@meyering.net>
1594
1595         Since the changes of 2004-05-22, the u.saved_cwd member at
1596         the bottom of the active-directory stack was no longer
1597         strictly necessary.  This change removes that member and uses
1598         the newer cwd_state parameter for the final restore_cwd.
1599
1600         * src/remove.c (struct AD_ent) [u]: Remove now-unnecessary union.
1601         [dev_ino]: Rename from `a'.
1602         (AD_pop_and_chdir): Add a parameter to play the role of just-removed
1603         bottom-of-stack cwd-state member.
1604         (AD_pop_and_chdir): No longer return boolean.  Adjust caller.
1605         (AD_push_initial): Remove CWD parameter.  Adjust caller.
1606
1607 2004-11-23  Paul Eggert  <eggert@cs.ucla.edu>
1608
1609         Minor performance improvements and cleanups for "touch".
1610         * src/touch.c (posix_date): Remove; not needed as a static var.
1611         All uses rewritten.
1612         (touch): Use new futimens function to operate more efficiently
1613         in some cases.  Don't stat/fstat existing file when
1614         (!amtime_now && change_times == (CH_ATIME | CH_MTIME)); the
1615         old time stamps aren't needed in that case.
1616         (main): change_times is int, not bool.  Simplify test for
1617         change_times.
1618
1619 2004-11-20  Paul Eggert  <eggert@cs.ucla.edu>
1620
1621         * src/install.c (usage): Avoid usage that runs afoul of Docbook
1622         translation.  Problem reported by Eric S. Raymond.
1623
1624         Restore dd's noctty flag, reverting the change of 2004-04-08.
1625         POSIX does not allow "dd" to use O_NOCTTY by default.
1626         * NEWS: Add noctty flag to dd.
1627         * doc/coreutils.texi (dd invocation): Likewise.
1628         * src/dd.c (flags, usage, main): Likewise.
1629
1630 2004-11-19  Alfred M. Szmidt  <ams@gnu.org>
1631
1632         * src/ls.c (usage): Clarified description of --no-group (-G),
1633         --human-readable (-h), --inode (-i), --size (-s), --time,
1634         and --time-style.
1635
1636 2004-11-19  Jim Meyering  <jim@meyering.net>
1637
1638         * src/ls.c (usage): Clarify description of --author.
1639         Tweak indentation so that help2man creates better nroff.
1640         Reported by Dan Jacobson.
1641
1642         * src/uniq.c (check_file): Don't check stdout for errors here.
1643
1644         * src/pwd.c (find_dir_entry): Update comment to match reality.
1645
1646 2004-11-18  Jim Meyering  <jim@meyering.net>
1647
1648         * src/pwd.c (robust_getcwd): Correct the comment: this function
1649         constructs the directory name.  The caller prints it.
1650
1651 2004-11-16  Paul Eggert  <eggert@cs.ucla.edu>
1652
1653         * src/stat.c (STATFS): New macro, for portability to Solaris 9.
1654         (do_statfs): Use it.
1655
1656         * src/basename.c, src/chroot.c, src/cksum.c, src/dd.c, src/dirname.c,
1657         src/factor.c, src/hostid.c, src/hostname.c, src/link.c, src/logname.c,
1658         src/nohup.c, src/printenv.c, src/pwd.c, src/setuidgid.c, src/sleep.c,
1659         src/sync.c, src/tsort.c, src/unlink.c, src/uptime.c, src/users.c,
1660         src/whoami.c, src/yes.c (main): Use getopt_long rather than getopt.
1661         * src/readlink.c (main): argv is not const.
1662
1663         * src/cut.c (usage): Improve documentation along the lines suggested
1664         by Debian 5.2.1-2.
1665         * src/echo.c (usage): Likewise.
1666         * src/expr.c (usage): Likewise.
1667
1668         * src/dircolors.hin: Add putty, screen-bce.
1669
1670         * src/pinky.c (print_entry): Fix memory leak.
1671         * src/who.c (print_user): Likewise.
1672
1673 2004-11-15  Paul Eggert  <eggert@cs.ucla.edu>
1674
1675         * NEWS: New dd operand "status=noxfer".
1676         * src/dd.c (C_ASCII, C_EBCDIC, C_IBM, C_BLOCK, C_UNBLOCK,
1677         C_LCASE, C_UCASE, C_SWAB, C_NOERROR, C_NOTRUNC, C_SYNC, C_TWOBUFS,
1678         C_NOCREAT, C_EXCL, C_FDATASYNC, C_FSYNC): Now constants, not
1679         macros.
1680         (STATUS_NOXFER, statuses): New constants.
1681         (usage, print_stats, scanargs): Add support for status=noxfer.
1682         (usage): Update status output to match new behavior.
1683         (print_stats): Always output complete byte count.
1684         Put space between numbers and units, as SI requires.
1685         Use ngettext so that i18n can use plurals for "byte" and "second".
1686         Don't multiply by 1e-9 (inexact); divide by 1e9 (which is exact).
1687         (iflag_error_msgid, oflag_error_msgid): Remove; replace uses by
1688         the string.
1689         * tests/dd/skip-seek (@Tests): Use status=noxfer to avoid
1690         problems with regression testing.
1691
1692 2004-11-14  Paul Eggert  <eggert@cs.ucla.edu>
1693
1694         * NEWS: dd now outputs total bytes, seconds, and bytes per second.
1695         * src/Makefile.am (dd_LDADD): Add $(LIB_CLOCK_GETTIME).
1696         * src/dd.c: Include "human.h".
1697         (w_bytes, start_time): New vars.
1698         (usage): Document new I/O statistics output
1699         (print_stats): Output new I/O statistics.
1700         (cleanup): Do statistics after closing stdin and stdout, so that
1701         the times are more accurate.
1702         (write_output, dd_copy): Count output bytes.
1703         (main): Get initial value of clock.
1704
1705 2004-11-14  Jim Meyering  <jim@meyering.net>
1706
1707         Backslash-escape `-'s in email addresses, so that they are
1708         rendered properly in UTF-locales.
1709         * man/help2man (escape_hyphens): New function.
1710         (main): Call it on email addresses.
1711
1712         * src/sort.c (zaptemp): Mark new diagnostic for translation.
1713
1714         * tests/misc/close-stdout: New file.  Test today's closeout.c change.
1715         * tests/misc/Makefile.am (TESTS): Add close-stdout.
1716
1717 2004-11-13  Jim Meyering  <jim@meyering.net>
1718
1719         * src/test.c (usage): Put the description of `[-n] STRING'
1720         on two lines, one for `-n STRING' and one for `STRING' so that
1721         help2man properly escapes the `-'.  Otherwise, the hyphen is
1722         rendered inappropriately in UTF-8 locales.
1723         Reported by Uwe Zeisberger in http://bugs.debian.org/281069.
1724
1725 2004-11-12  Paul Eggert  <eggert@cs.ucla.edu>
1726
1727         * NEWS: Document the following changes.
1728
1729         * src/sort.c: Avoid O(N**2) behavior when there are many temporary
1730         files.
1731         (temptail): New variable, so that we can easily append to list.
1732         (create_temp_file): Create new files at end of list, so that
1733         searching the list has O(N*NMERGE) behavior instead of O(N**2).
1734         (zaptemp): Update temptail if needed.
1735         (mergefps, merge): Accept new arg that counts temp files, and keep it
1736         up to date as we create and remove temporaries.  This is for
1737         efficiency, so that we don't call zaptemp so often.
1738         All callers changed.
1739         (sort): Don't create array in reverse order, since the list of
1740         temporaries is now in the correct order.
1741
1742         (zaptemp): Protect against race condition: if 'sort' is
1743         interrupted in the middle of zaptemp, it might unlink the
1744         temporary file twice, and the second time this happens the file
1745         might already have been created by some other process.
1746
1747         (zaptemp): Warn if a temporary file is not removed.
1748
1749         (create_temp_file): Use offsetof for clarity.
1750         (die): Move it up earlier, to clean up the code a bit.
1751
1752         * src/pr.c (strtoumax): Declare if not declared.
1753         (skip_to_page, first_page_number, last_page_number, page_number,
1754         first_last_page, print_header):
1755         Use uintmax_t for page numbers.
1756         (first_last_page): Remove unnecessary forward declaration.
1757         Do not modify arg (it is now a const pointer).
1758         Return a true if successful, false (without print a diagnostic)
1759         otherwise.
1760         (main): If +XXX does not specify a valid page range, treat it
1761         as a file name.  This follows the response to Open Group XCU ERN 41
1762         <http://www.opengroup.org/sophocles/show_mail.tpl?source=L&listname=austin-group-l&id=7717>,
1763         which says the behavior is allowed.
1764         (skip_to_page): When starting page number exceeds page count,
1765         print both numbers in the diagnostic.
1766         (print_header): Detect page number overflow.
1767
1768 2004-11-07  Jim Meyering  <jim@meyering.net>
1769
1770         * src/uname.c [__APPLE__]: Include <mach/machine.h> and <mach-o/arch.h>.
1771         (main) [__APPLE__]: Get the processor type via syscall rather than
1772         hard-coding "powerpc".  From Toby Peterson.
1773
1774         * src/sort.c (merge): Remove declarations of now-unused variables.
1775
1776 2004-11-06  Paul Eggert  <eggert@cs.ucla.edu>
1777
1778         * src/sort.c (first_same_file): Remove.  Move most of the code to....
1779         (avoid_trashing_input): New function.
1780         (merge): Avoid some silly merges, e.g., copying a single file to
1781         a temporary file when there are exactly 17 input files to merge.
1782         Take a count of temporary files rather than a max_merge arg.
1783         All uses changed.
1784
1785 2004-11-06  Jim Meyering  <jim@meyering.net>
1786
1787         * src/sort.c (xfclose): Don't close stdout here (just flush it),
1788         since close_stdout now closes stdout unconditionally.
1789
1790 2004-11-05  Paul Eggert  <eggert@cs.ucla.edu>
1791
1792         * src/sort.c (inittables, sort_buffer_size, getmonth, mergefps,
1793         first_same_file, merge, sort, main): Use size_t for indexes to arrays.
1794         This fixes some unlikely havoc-wreaking bugs (e.g., more than INT_MAX
1795         temporary files).
1796         (getmonth, keycompare, compare): Rewrite to avoid need for alloca,
1797         thus avoiding unchecked stack overflow in some cases.  As a side
1798         effect this improve the performance of "sort -M" by a factor of 4
1799         on my benchmarks.
1800
1801 2004-11-03  Paul Eggert  <eggert@cs.ucla.edu>
1802
1803         * src/stty.c: Include "vasprintf.h" since we use vasprintf now.
1804
1805         * src/Makefile.am (check-AUTHORS): Don't assume \? works in a sed
1806         expression; it's not portable.  Problem reported by Albert Chin.
1807         Don't invoke a program more than once.
1808         * src/groups.sh (version): New variable, containing author info,
1809         for benefit of AUTHORS check.  Use it when acting on --version option.
1810         * AUTHORS: Remove duplicate lines.  Remove bogus "chroot:"
1811         in groups line.
1812
1813         * src/system.h: Don't #define and #undef getopt around <stdlib.h>,
1814         as this breaks the new regime that does "#define getopt rpl_getopt".
1815         Problem reported by Albert Chin for Solaris 9 with Sun cc in:
1816         http://lists.gnu.org/archive/html/bug-gnulib/2004-11/msg00019.html
1817         I suppose this may cause problems on ancient hosts with
1818         incompatible getopt declarations, but we'll cross that bridge if
1819         the problem gets reported to us by someone who can test the fix.
1820
1821 2004-11-03  Jim Meyering  <jim@meyering.net>
1822
1823         * src/tac.c: quote(...) file names in diagnostics.
1824
1825 2004-10-29  Paul Eggert  <eggert@cs.ucla.edu>
1826
1827         * NEWS: Document getdate changes.
1828
1829 2004-10-29  Jim Meyering  <jim@meyering.net>
1830
1831         * src/tac.c (tac_file): Remove temporary prototype and move this
1832         function `down' so that it precedes definition of tac_nonseekable.
1833
1834         `tac /proc/modules' would print nothing
1835         Reported by Harald Dunkel in http://bugs.debian.org/278604.
1836
1837         * src/tac.c (copy_to_temp): Renamed from save_stdin, since
1838         now it copies a general file descriptor, not just stdin.
1839         (tac_nonseekable): Renamed/adapted from tac_stdin.
1840         (tac_file): Get fd via `open' directly rather than via fopen/fileno,
1841         since we never used the stream.  Perform "-" to stdin mapping here
1842         rather than in main.  Determine whether a file is seekable,
1843         by trying to `lseek' to its end, and dispatch to tac_seekable or
1844         tac_nonseekable accordingly.
1845         (main): Rewrite argument handling now that it uses only tac_file.
1846         * NEWS: Mention it here.
1847
1848 2004-10-21  Jim Meyering  <jim@meyering.net>
1849
1850         * tests/mv/leak-fd: New file.
1851         * tests/mv/Makefile.am (TESTS): Add it.
1852         * tests/rm/dot-rel: New file.
1853         * tests/rm/Makefile.am (TESTS): Add it.
1854
1855         Correct my patch of 2004-10-18.
1856         * src/remove.c (rm): Destroy the saved_cwd here (via cwd_state),
1857         if necessary, not in remove_dir.  Otherwise, removing multiple
1858         `.'-relative nonempty directories no longer worked.
1859
1860 2004-10-20  Paul Eggert  <eggert@cs.ucla.edu>
1861
1862         * src/fmt.c (usage): Improve description of --prefix.
1863         Problem reported by Edward Welbourne.
1864
1865         * man/uniq.x: Change summary so that it doesn't imply that
1866         uniq writes to its input file.  Problem reported by
1867         Dan Jacobson.
1868
1869 2004-10-18  Jim Meyering  <jim@meyering.net>
1870
1871         Plug a leak that would cause a cross-device mv to fail when
1872         operating on too many command-line-specified nonempty directories.
1873         * src/remove.c (remove_dir): Destroy the `struct saved_cwd' on the
1874         top of the stack before returning.  This usually closes the file
1875         descriptor that was used to return to the original working directory.
1876         Reported by Cyril Bouthors in
1877         http://article.gmane.org/gmane.comp.gnu.core-utils.bugs/3048
1878         * NEWS: Mention it here.
1879
1880         * src/pathchk.c (validate_file_name): Give a more descriptive
1881         diagnostic when pathconf fails.  This also avoids an unwarranted
1882         warning from gcc-3.3.5 about a format not being a string literal.
1883
1884         * src/sleep.c (main): Remove declaration of unused local, c.
1885         * src/printenv.c (main): Likewise.
1886         * src/logname.c (main): Likewise.
1887         * src/uptime.c (main): Likewise, for optc.
1888         * src/tsort.c (main): Likewise, for opt.
1889
1890 2004-10-17  Paul Eggert  <eggert@cs.ucla.edu>
1891
1892         * AUTHORS: Add self to pathchk.
1893         * src/pathchk.c (AUTHORS): Add self.
1894         Change "path" to "file name" whenever possible.
1895         Remove usage comment, as it was a duplication of the code or doc.
1896         Include <wchar.h> if available.
1897         (mbrlen, mbstate_t) [! (HAVE_MBRLEN && HAVE_MBSTATE_T)]: Define.
1898         (NEED_PATHCONF_WRAPPER, PATH_MAX, PATH_MAX_FOR, NAME_MAX,
1899         pathconf_wrapper, portable_chars, dir_ok): Remove.
1900         (NAME_MAX_MINIMUM, PATH_MAX_MINIMUM): New macros.
1901         (pathconf, _PC_NAME_MAX, _PC_PATH_MAX): Define if nonexistent.
1902         (portable_chars_only): New arg FILELEN.
1903         Don't assume ASCII; we might be on an EBCDIC host.
1904         Don't assume unibyte locale in diagnostic.
1905         (component_start, component_len): New functions.
1906         (validate_file_name): Renamed from validate_path.  All uses changed.
1907         Pretty much a complete rewrite.
1908         Don't make copy of file arg.  Always append trailing slash to
1909         pathconf arg, just in case it's a symlink (this is pure paranoia;
1910         we don't know of any hosts where the trailing slash is required).
1911         Use size_t instead of long int when possible.
1912         Avoid need to call pathconf in most practical cases.
1913         Don't use euidaccess several times to test searchability;
1914         just use lstat once.  Reword diagnostic to put the (often very long)
1915         file names last.
1916
1917 2004-10-15  Paul Eggert  <eggert@cs.ucla.edu>
1918
1919         * src/printf.c (usage): Mention Unicode, and use H for hex digits.
1920
1921 2004-10-13  Jim Meyering  <jim@meyering.net>
1922
1923         * NEWS: Mention today's fts.c fix.
1924
1925 2004-10-13  Paul Eggert  <eggert@cs.ucla.edu>
1926
1927         * tests/stty/row-col-1: Set LC_ALL=C.
1928
1929 2004-10-12  Jim Meyering  <jim@meyering.net>
1930
1931         * src/dircolors.hin: Add .flac and .mpc as audio suffixes.
1932         From Jesus Climent in http://bugs.debian.org/276149.
1933
1934 2004-10-05  Paul Eggert  <eggert@cs.ucla.edu>
1935
1936         * src/ls.c (ignore_mode): Renamed from ignore, to avoid shadowing
1937         problems.  All uses changed.
1938
1939 2004-10-05  Jim Meyering  <jim@meyering.net>
1940
1941         * .x-sc_trailing_blank: Add an exclusion for config/texinfo.tex,
1942         since Karl says its trailing blanks are there to stay :-)
1943
1944 2004-10-04  Paul Eggert  <eggert@cs.ucla.edu>
1945
1946         * src/expr.c (NEW, OLD): Remove, partly to avoid
1947         reference to obsolescent macro XMALLOC.
1948         All uses replaced by xmalloc and free.
1949
1950 2004-09-28  Jim Meyering  <jim@meyering.net>
1951
1952         * src/tail.c (usage): Clarify: --retry works only with --follow=name.
1953         Reported by Nik A. Melchior in http://bugs.debian.org/273781.
1954
1955 2004-09-27  Paul Eggert  <eggert@cs.ucla.edu>
1956
1957         * src/od.c (format_address_paren): c is optional, so don't output
1958         it if it's '\0'.
1959
1960 2004-09-26  Paul Eggert  <eggert@cs.ucla.edu>
1961
1962         Add support for ls --hide.  Idea suggested by Bardur Arantsson.
1963         * NEWS: Document this.
1964         * src/ls.c (file_ignored): Renamed from file_interesting, with
1965         inverted return value.  Accept the file name, not a struct dirent *.
1966         All uses changed.  Avoid the expense of calling fnmatch if the
1967         file is ignorable due to leading '.'.
1968         (all_files, really_all_files): Removed; replaced by:
1969         (ignore): New variable.  All uses changed.
1970         (IGNORE_DEFAULT, IGNORE_DOT_AND_DOTDOT, IGNORE_MINIMAL, HIDE_OPTION):
1971         New constants.
1972         (hide_patterns): New variable.
1973         (long_options, decode_switches, file_ignored, usage):
1974         Add support for --hide.
1975         (patterns_match): New function.
1976         (usage): Replace "hide" with "ignore" in explanation, to avoid
1977         confusion.
1978
1979 2004-09-25  Paul Eggert  <eggert@cs.ucla.edu>
1980
1981         * src/ls.c (gobble_file, print_long_format): Don't assume that
1982         human-readable output has a byte count equal to its column width;
1983         this isn't always true in locales where the radix character is not
1984         '.' or ','.
1985         (format_user_or_group): Revamp code to match the above fix;
1986         this avoids the (very faint) possibility of integer overflow.
1987
1988 2004-09-24  Paul Eggert  <eggert@cs.ucla.edu>
1989
1990         * NEWS: Mention that "chmod -r -w x" now works as expected.
1991         * src/chmod.c (main): Revamp option processing to support this.
1992         * tests/chmod/Makefile.am (TESTS): Add 'usage'.
1993         * tests/chmod/usage: New set of tests for usage like that.
1994
1995 2004-09-24  Jim Meyering  <jim@meyering.net>
1996
1997         * Makefile.maint (CVS_LIST): Use --types=AFGM option so that
1998         it lists only cvs-controlled regular files.
1999
2000         * src/csplit.c (xalloc_die): Declare to be `extern', not `static'
2001         to avoid a warning from gcc-3.4.1.  Reported by Paul Eggert.
2002
2003 2004-09-23  Paul Eggert  <eggert@cs.ucla.edu>
2004
2005         * Makefile.maint (CVS_LIST): New macro.
2006         (sc_space_tab, sc_prohibit_atoi_atof, sc_file_system,
2007         sc_prohibit_jm_in_m4, sc_system_h_headers, sc_sun_os_names,
2008         sc_trailing_blank, po-check): Use it instead of the
2009         nonstandard "cvsu --list".
2010
2011         * src/tail.c (parse_obsolete_option): Bring back support
2012         for obsolete option followed by non-obsolete, or by more
2013         than one file.  When obsolete, conform to SUSv2 rather than
2014         original POSIX 1003.2-1992, as SUSv2 corrected the case of
2015         "tail -c".  Add support for the SUSv2 "b" modifier.
2016         * NEWS: Mention the above.
2017         * tests/tail/Test.pm: New test case obs-b to check the above.
2018         err-[134] no longer need _POSIX2_VERSION=199209.
2019         Fix comments to match revised behavior.
2020
2021 2004-09-22  Jim Meyering  <jim@meyering.net>
2022
2023         * Use automake-1.9.2.  Regenerate dependent files.
2024
2025         * src/remove.c (struct dirstack_state) [current_arg_jumpbuf]:
2026         Improve the comment.
2027
2028         Clean up scoping etc. so that some make `distcheck' tests pass.
2029         * src/csplit.c (xalloc_die): Declare to be static.
2030         * src/chown-core.c (chown_files): Declare as `extern'.
2031         * src/cp-hash.c (remember_created): Likewise.
2032         * src/copy.c (copy): Likewise.
2033         * src/checksum.h (enum) [ALG_MD5]: Define to be 1, not 0.
2034
2035         * src/id.c, src/nl.c, src/expand.c: Remove trailing blanks.
2036         * src/unexpand.c: Likewise.
2037
2038         * src/Makefile.am (check-AUTHORS): New rule.
2039         (check): Depend on it.
2040         * AUTHORS: Update.
2041
2042         * Makefile.maint (syntax-check-rules): Remove duplicate sc_tight_scope.
2043         (sc_system_h_headers): Also exclude copy.h; it includes <stdbool.h>.
2044
2045 2004-09-22  Paul Eggert  <eggert@cs.ucla.edu>
2046
2047         * src/ls.c (decode_switches): Don't compare a short value
2048         to SIZE_MAX: GCC sometimes complains.
2049
2050 2004-09-21  Paul Eggert  <eggert@cs.ucla.edu>
2051
2052         * NEWS: The following commands now reject unknown options:
2053         basename dirname factor hostname link nohup sync unlink yes
2054         Also, pathchk no longer accepts trailing options.
2055
2056         * src/basename.c: Include <getopt.h>.
2057         * src/chroot.c: Likewise.
2058         * src/dirname.c: Likewise.
2059         * src/factor.c: Likewise.
2060         * src/hostid.c: Likewise.
2061         * src/hostname.c: Likewise.
2062         * src/nohup.c: Likewise.
2063         * src/pwd.c: Likewise.
2064         * src/setuidgid.c: Likewise.
2065         * src/sync.c: Likewise.
2066
2067         * src/basename.c (main): Reject unknown options.
2068         * src/dirname.c (main): Likewise.
2069         * src/factor.c (main): Likewise.
2070         * src/hostid.c (main): Likewise.
2071         * src/hostname.c (main): Likewise.
2072         * src/link.c (main): Likewise.
2073         * src/nohup.c (main): Likewise.
2074         * src/pwd.c (main): Likewise.
2075         * src/setuidgid.c (main): Likewise.
2076         * src/sync.c (main): Likewise.
2077         * src/unlink.c (main): Likewise.
2078         * src/yes.c (main): Likewise.
2079
2080         * src/cat.c (main): Remove unused "case 0".
2081         * src/chgrp.c (main): Likewise.
2082         * src/chmod.c (main): Likewise.
2083         * src/chown.c (main): Likewise.
2084         * src/comm.c (main): Likewise.
2085         * src/cp.c (main): Likewise.
2086         * src/csplit.c (main): Likewise.
2087         * src/cut.c (main): Likewise.
2088         * src/date.c (main): Likewise.
2089         * src/df.c (main): Likewise.
2090         * src/du.c (main): Likewise.
2091         * src/env.c (main): Likewise.
2092         * src/expand.c (main): Likewise.
2093         * src/fold.c (main): Likewise.
2094         * src/head.c (main): Likewise.
2095         * src/id.c (main): Likewise.
2096         * src/install.c (main): Likewise.
2097         * src/join.c (main): Likewise.
2098         * src/ln.c (main): Likewise.
2099         * src/ls.c (decode_switches): Likewise.
2100         * src/mkdir.c (main): Likewise.
2101         * src/mkfifo.c (main): Likewise.
2102         * src/mknode.c (main): Likewise.
2103         * src/mv.c (main): Likewise.
2104         * src/nl.c (main): Likewise.
2105         * src/paste.c (main): Likewise.
2106         * src/pinky.c (main): Likewise.
2107         * src/pr.c (main): Likewise.
2108         * src/ptx.c (main): Likewise.
2109         * src/readlink.c (main): Likewise.
2110         * src/rm.c (main): Likewise.
2111         * src/rmdir.c (main): Likewise.
2112         * src/seq.c (main): Likewise.
2113         * src/shred.c (main): Likewise.
2114         * src/split.c (main): Likewise.
2115         * src/sum.c (main): Likewise.
2116         * src/tac.c (main): Likewise.
2117         * src/tail.c (main): Likewise.
2118         * src/tee.c (main): Likewise.
2119         * src/touch.c (main): Likewise.
2120         * src/tr.c (main): Likewise.
2121         * src/tty.c (main): Likewise.
2122         * src/uname.c (main): Likewise.
2123         * src/unexpand.c (main): Likewise.
2124         * src/wc.c (main): Likewise.
2125         * src/who.c (main): Likewise.
2126
2127         * src/chroot.c (main): Use getopt where it suffices, not getopt_long.
2128         * src/cksum.c (main): Likewise.
2129         * src/dd.c (main): Likewise.
2130         * src/logname.c (main): Likewise.
2131         * src/printenv.c (main): Likewise.
2132         * src/sleep.c (main): Likewise.
2133         * src/tsort.c (main): Likewise.
2134         * src/uptime.c (main): Likewise.
2135         * src/users.c (main): Likewise.
2136         * src/whoami.c (main): Likewise.
2137
2138         * src/du.c (long_options): Standardize on NULL vs 0.
2139         * src/rm.c (long_opts): Likewise.
2140
2141         * src/logname.c (long_options): Remove.
2142         * src/printenv.c (long_options): Likewise.
2143         * src/sleep.c (long_options): Likewise.
2144         * src/tsort.c (long_options): Likewise.
2145         * src/uptime.c (longopts): Likewise.
2146         * src/users.c (longopts): Likewise.
2147         * src/whoami.c (long_options): Likewise.
2148
2149         * src/pathchk.c (longopts): Add --help, --version.
2150         (main): Use longopts rather than parse_long_options.
2151         * src/stty.c (longpts, main): Likewise.
2152
2153         * src/pathchk.c (main): Don't reorder arguments, so that
2154         we can check weird file names.
2155
2156         * src/readlink.c: Don't include "long-options.h".
2157         * src/sort.c: Likewise.
2158         * src/stty.c: Likewise.
2159
2160         * src/split.c (verbose): Now bool, not int.
2161         (VERBOSE_OPTION): New enum.
2162         (longopts, main): Use it.
2163
2164         * tests/factor/basic: Adjust to new wording in diagnostic
2165         that results from the above changes.
2166
2167 2004-09-21  Jim Meyering  <jim@meyering.net>
2168
2169         * man/rm.x: Say "the response is affirmative" rather than "the
2170         response begins with y or Y", so that the documentation is
2171         accurate in non-English locales.  Problem reported by Munzir Taha.
2172
2173 2004-09-19  Paul Eggert  <eggert@cs.ucla.edu>
2174
2175         * src/echo.c (main): Don't pass NULL to strcmp when
2176         POSIXLY_CORRECT and given no arguments.
2177
2178         * src/md5sum.c (STRING_OPTION): Remove.
2179         (long_options, main): Remove support for undocumented and
2180         obsolete --string option, as suggested in the 1996-09-26 patch.
2181         * NEWS: Document this.
2182
2183         * tests/rm/fail-eperm: Don't try to remove writeable files in a
2184         sticky /tmp directory, as SVR4-like systems (e.g., Solaris 9) let
2185         you remove such files.  Problem reported by Bert Fischer in:
2186         http://lists.gnu.org/archive/html/bug-coreutils/2004-09/msg00074.html
2187
2188 2004-09-18  Paul Eggert  <eggert@cs.ucla.edu>
2189
2190         * src/md5sum.c (STATUS_OPTION, STRING_OPTION): New enums.
2191         (long_options, main): Use them instead of magic numbers 2 and 1.
2192         For --string, optarg can't possibly be NULL.
2193
2194         * src/dd.c (usage): Distinguish between options and operands.
2195         (scanargs): Don't mess with argc, argv; getopt_long handles this now.
2196         Say "operands" for operands, not "options".
2197         (main): Use getopt_long, so that "dd --" works as POSIX requires.
2198         * tests/dd/misc: Check for "dd --".
2199
2200         * src/chroot.c (main): Reject unknown options instead of
2201         interpreting them as a directory to chroot to.
2202
2203         * src/cksum.c: Remove obsolete comment about POSIX 1003.2/D11.2.
2204         The current standard (POSIX 1003.1-2004) is correct.
2205         (crc_remainder) [defined CRCTAB]: Renamed from "remainder" to avoid
2206         collision with builtin function.
2207         (main) [defined CRCTAB]: Output in lowercase hexadecimal, and
2208         output the first 0 as 8 digits, to make it easier to compare to
2209         the text of the standard.  Output crctab to be a const array.
2210         (crctab): Use result of above changes.
2211         (long_options): Remove; not needed if empty.
2212         (main): getopt_long can't return 0 here, so simplify the code.
2213
2214 2004-09-13  Jim Meyering  <jim@meyering.net>
2215
2216         * src/Makefile.am (localedir.h): Don't redirect directly to target.
2217
2218 2004-09-13  Paul Eggert  <eggert@cs.ucla.edu>
2219
2220         * src/id.c (print_full_info): Don't exit with failure status simply
2221         because a user or group number can't be turned into a name.
2222         Problem reported by Felipe Kellermann in:
2223         http://lists.gnu.org/archive/html/bug-coreutils/2004-09/msg00081.html
2224
2225 2004-09-12  Jim Meyering  <jim@meyering.net>
2226
2227         * Makefile.maint (my-distcheck): When building with -Werror, also
2228         require -Wshadow.
2229
2230 2004-09-10  Paul Eggert  <eggert@cs.ucla.edu>
2231
2232         * NEWS: "tail" now handles obscure POSIX 1003.2-1992 cases better.
2233         * src/tail.c (parse_obsolete_option): Renamed from
2234         parse_obsolescent_option, since the options are obsolete now.
2235         Remove bool *arg; just exit if there's an error.  Revamp to follow
2236         POSIX 1003.2-1992 more precisely, to handle cases like "tail -
2237         file" and "tail -10 -- file" correctly when we are conforming to
2238         the older standard.
2239         (main): Adjust to this change.
2240         * tests/tail/Test.pm (test_vector): minus-* requires
2241         _POSIX2_VERSION=199209 now, to work correctly if there is
2242         an input file.  err-1 and err-3 no longer errors if there
2243         is another file.
2244
2245 2004-09-09  Paul Eggert  <eggert@cs.ucla.edu>
2246
2247         * src/test.c (usage): Document -r, -w, -x more carefully.
2248
2249 2004-09-08  Paul Eggert  <eggert@cs.ucla.edu>
2250
2251         * src/test.c (usage): Document "test" (with no args) and "[ ]".
2252         Document that -h and -L don't dereference.
2253
2254         * NEWS: Document that "tr xy -z" now works as per POSIX.
2255         Sort the descriptions.
2256         * src/tr.c (main): Don't reorder options.
2257         * tests/tr/Test.pm (fowler-1): New test case.
2258
2259 2004-09-06  Paul Eggert  <eggert@cs.ucla.edu>
2260
2261         * src/touch.c (main): Fix POSIX-conformance bug: "touch --
2262         MMDDhhmm file" must be treated like "touch MMDDhhmm file" when
2263         conforming to pre-2001 POSIX.
2264         * NEWS: Document this.
2265         * tests/touch/obsolescent: Test for this bug.  Also, set
2266         _POSIX2_VERSION=199209 and POSIXLY_CORRECT=1 so that it's
2267         a better test for obsolescent features.
2268
2269         * src/sort.c (main): Emulate Solaris 8 and 9 "sort -y", so that
2270         "sort -y abc" is like "sort abc" whereas "sort -y 100" is like
2271         plain "sort".
2272
2273         * src/od.c: Several changes for POSIX and FreeBSD compatibility.
2274         (COMMON_SHORT_OPTIONS): Add -B, -D, -e, -F, -H, -I, -L, -O, -s, -X.
2275         (long_options, main): --strings is now -S, not -s.
2276         (usage): Reflect the usage changes.
2277         (parse_old_offset): Do not issue a diagnostic on failure;
2278         callers now do this as necessary.
2279         (main): Support POSIX syntax.  Remove unused case 0 from getopt_long.
2280         Add support for new short options (many undocumented) for
2281         compatibility with FreeBSD.  Remove FIXME for -s; it's now
2282         POSIX-compatible.  Default format is now oS, not o2.
2283         * NEWS: Describe the above.
2284
2285 2004-09-05  Paul Eggert  <eggert@cs.ucla.edu>
2286
2287         * src/stty.c (valid_options): Remove.
2288         (main): Fix some bugs in handling invalid option-combinations
2289         like "stty -F".
2290         (recover_mode): Arg is now char const *, not char *.
2291         (main): Use STDIN_FILENO, not 0.
2292         Simplify option-parsing code a tad.
2293         * tests/stty/basic-1: Check for the fixed bugs.
2294
2295 2004-09-03  Paul Eggert  <eggert@cs.ucla.edu>
2296
2297         * src/stat.c (HAVE_STRUCT_STATXFS_F_TYPE): Fix typo that prevented
2298         it from ever being nonzero.  Reported by Pozsar Balazs in:
2299         http://lists.gnu.org/archive/html/bug-coreutils/2004-08/msg00189.html
2300         (human_fstype): Add ramfs, squashfs, sysfs.
2301         Reported by Pozsar Balazs in:
2302         http://lists.gnu.org/archive/html/bug-coreutils/2004-08/msg00188.html
2303         (human_fstype): Return char const *, not char *.
2304         Simplify internals a bit, and avoid casts.
2305
2306         * src/dd.c (usage): "alternated EBCDIC" -> "alternate EBCDIC".
2307         (bit_count): Remove.  All uses changed to....
2308         (multiple_bits_set): New function.
2309         (scanargs): Use it, and check separately for each set of
2310         incompatible options, to improve diagnostics.
2311         (MX): Remove.
2312         (apply_translations): Move checks for incompatible options
2313         to scanargs, so that they're done consistently.
2314
2315 2004-09-02  Paul Eggert  <eggert@cs.ucla.edu>
2316
2317         Output correct errno-related diagnostic on "paste" I/O errors.
2318         * src/paste.c (write_error, xputchar): New functions.
2319         (paste_parallel): Use correct errno value after input error.
2320         (paste_parallel, paste_serial): Report errno value after output error.
2321
2322         Port to diet libc.  Problem reported by Felix von Leitner in:
2323         http://lists.gnu.org/archive/html/bug-coreutils/2004-08/msg00171.html
2324         * src/paste.c (dummy_closed, CLOSED, dummy_endlist, ENDLIST): Remove;
2325         it's not portable C to assume FILE is a complete type.
2326         (paste_parallel): Use index test instead of ENDLIST, and NULL
2327         instead of CLOSED.
2328
2329 2004-08-24  Paul Eggert  <eggert@cs.ucla.edu>
2330
2331         POSIX-conformance fixes for "expand" and "unexpand".
2332         Also, consistently use "tab stop" rather than "tabstop".
2333         * NEWS: Document fixes.
2334         * src/expand.c: Revamp to resemble the new unexpand.c better.
2335         (usage): -i does not convert tabs after non-tabs.
2336         (add_tab_stop): Renamed from add_tabstop.  All uses changed.
2337         (parse_tab_stop): Renamed from parse_tabstop.  All uses changed.
2338         (validate_tab_stop): Renamed from validate_tabstop.  All uses changed.
2339         (next_file, main): Check fclose against 0, not EOF.
2340         (expand): Remove unnecessary casts.
2341         Add another loop nesting level, for lines, so that per-line variables
2342         are initialized cleanly.
2343         Revamp tab checking.  Check for write error immediately, rather
2344         than just once at the end of the program.
2345         * src/unexpand.c: Lkewise (for the expand.c changes).
2346         (TAB_STOP_SENTINEL): Remove.
2347         (tab_size): Now size_t, not uintmax_t, since we need to store
2348         the sequences of blanks.
2349         (max_column_width): New var.
2350         (usage): Say "blank" where POSIX requires this.
2351         (add_tab_stop): Calculate maximum column width.
2352         (unexpand): Store the pending blanks, instead of merely counting them.
2353         Follow POSIX's rules about -a requiring two blanks before a tab stop.
2354         Get rid of internal label and goto.
2355         * tests/unexpand/basic-1: Fix infloop-3 to match POSIX.
2356         Add blanks-1 through blanks-13.
2357
2358 2004-08-19  Paul Eggert  <eggert@cs.ucla.edu>
2359
2360         * NEWS: "chown : file", "chown '' file", and "chgrp '' file" now
2361         succeed without changing the uid and gid, like FreeBSD.
2362         * src/chgrp.c (parse_group): Return gid_t rather than storing it
2363         through a pointer.  Treat "chgrp '' file" as a no-op change,
2364         as FreeBSD does.
2365         (main): Set chopt.group_name to NULL if the group is the empty
2366         string.
2367         * src/chown-core.c (describe_change): Describe changes to -1:-1
2368         without using "to OWNERSHIP" phrase.
2369         * src/chown.c (usage): "chown '' file" is now allowed.
2370         (main): Do not set user name to the empty string if the group
2371         name is null.
2372         * tests/chgrp/basic: Test "chgrp '' file".
2373         * tests/chown/Makefile.am (TESTS): Add separator.
2374         * tests/chown/separator: New file, partly taken from
2375         Dmitry V. Levin's suggestion in
2376         <http://lists.gnu.org/archive/html/bug-coreutils/2004-08/msg00102.html>
2377
2378 2004-08-11  Paul Eggert  <eggert@cs.ucla.edu>
2379
2380         * tests/install/basic-1: Test for the -d regression.
2381
2382 2004-08-11  Dmitry V. Levin  <ldv@altlinux.org>
2383
2384         * src/install.c (main): Fix -d regression introduced with
2385         --target-directory support at 2004-06-25.
2386
2387 2004-08-11  Paul Eggert  <eggert@cs.ucla.edu>
2388
2389         * src/copy.c (copy_internal): When preserving links, unlink
2390         a destination with link count greater than one.  This is so
2391         that commands like "cp -a" don't get confused when copying into
2392         a destination that already contains many hard links.  Problem
2393         reported by Tim Waugh in:
2394         http://lists.gnu.org/archive/html/bug-coreutils/2004-08/msg00053.html
2395
2396 2004-08-10  Paul Eggert  <eggert@cs.ucla.edu>
2397
2398         Convert all files to UTF-8.
2399         * tests/fmt/basic (8-bit-pfx): Use UTF-8, not Latin-1.
2400         * tests/sort/Test.pm (16a): Likewise.
2401         * tests/uniq/Test.pm (8): Likewise.
2402         * tests/misc/printf-hex: Use ASCII, not Latin-1.
2403
2404         * NEWS: Document "sort -o -" and "tee -" POSIX-conformance fixes.
2405         * src/shred.c (usage): "-" is an operand, not an option.
2406         * src/sort.c (die, xfopen, mergefps, first_same_file, merge):
2407         A null file arg means standard output.
2408         (main): "-o -" means to write to a file named "-",
2409         not to standard output.
2410         * src/tee.c (usage, tee): "tee -" writes to standard output, not
2411         to a file named "-".
2412
2413 2004-08-10  Dmitry V. Levin  <ldv@altlinux.org>
2414
2415         * src/install.c (change_timestamps): Fix int->bool conversion
2416         bugs introduced on 2004-07-29.
2417
2418 2004-08-09  Paul Eggert  <eggert@cs.ucla.edu>
2419
2420         * src/shred.c (wipename): Work even if the directory is writeable
2421         and not readable.  Prefer write access, since this should work
2422         better with fdatasync.
2423
2424         * src/csplit.c (xalloc_die): New function.
2425         (main): Remove now-obsolete initialization of xalloc_fail_func.
2426
2427         * src/md5sum.c: Adjust to sha->sha1 renaming.
2428
2429 2004-08-08  Dmitry V. Levin  <ldv@altlinux.org>
2430
2431         Minor code cleanup.
2432         * src/readlink.c (canonicalize_fname): Remove unneeded proxy function.
2433         (can_mode): Make variable local.
2434
2435 2004-08-07  Paul Eggert  <eggert@cs.ucla.edu>
2436
2437         * src/system.h (O_BINARY) [!O_BINARY && defined O_BINARY]:
2438         Do not define, to avoid annoying compiler messages on QNX 6.3.
2439         Problem reported by Johan in:
2440         http://lists.gnu.org/archive/html/bug-coreutils/2004-08/msg00050.html
2441
2442 2004-08-04  Paul Eggert  <eggert@cs.ucla.edu>
2443
2444         * src/system.h (PRIdMAX, PRIoMAX, PRIuMAX, PRIxMAX):
2445         Define to a concatenation of string literals, not to an expression;
2446         needed for concatenation contexts.
2447         (INTMAX_MAX, INTMAX_MIN): New macros.
2448
2449         * src/stat.c (print_stat): Don't assume st_ino / st_dev fits in
2450         unsigned long; this isn't true for st_ino on Solaris 9.
2451
2452 2004-08-03  Paul Eggert  <eggert@cs.ucla.edu>
2453
2454         * src/uname.c: Do not depend on HAVE_SYSCTL when deciding
2455         whether to include files.  Include <sys/param.h> if
2456         HAVE_SYS_PARAM_H (not HAVE_SYSCTL).
2457         (main) [defined __POWERPC__]: Add a kludge to work around a
2458         Mac OS X bug, so that uname -p defaults to "powerpc" if
2459         sysctl ((int[]) {CTL_HW, HW_MACHINE_ARCH}, 2, buffer, &bufsize, 0, 0)
2460         fails.  Problem reported by Petter Reinholdtsen in:
2461         http://lists.gnu.org/archive/html/bug-gnu-utils/2003-02/msg00201.html
2462
2463         * src/uniq.c (hard_LC_COLLATE, ignore_case, different, check_file,
2464         main): Use bool for booleans.
2465         (writeline, check_file): Use uintmax_t for line counts.
2466         (check_file): Check for and report line number overflow,
2467         when that matters.
2468         * src/wc.c (iswspace, wc): Use to_uchar rather than a cast.
2469         (print_lines, print_words, print_chars, print_bytes, print_linelength,
2470         have_read_stdin, wc, wc_file, main):
2471         Use bool for booleans.
2472         (exit_status): Remove.
2473         (wc, wc_file): Return bool status.  All callers changed.
2474         * src/who.c (scan_entries): 0 -> STDIN_FILENO.
2475         * src/whoami.c (main): Print uids using unsigned long int, not
2476         unsigned int.
2477
2478         * src/unexpand.c: Int cleanup and minor reorganization to be more
2479         like src/expand.c.
2480         Include quote.h, xstrndup.h.
2481         (TAB_STOP_SENTINEL): Increase from INT_MAX to INTMAX_MAX.
2482         (convert_entire_line, have_read_stdin, parse_tabstops, next_file,
2483         unexpand, main):
2484         Use bool for booleans.
2485         (tab_size, tab_list, add_tabstop, validate_tabstops, unexpand):
2486         Use uintmax_t for column counts.
2487         (first_free_tab, validate_tabstops, unexpand): Use size_t for sizes.
2488         (add_tabstop, parse_tabstops, main): Don't reserve UINTMAX_MAX
2489         as a tab stop.
2490         (parse_tabstops): Don't use ISBLANK on possibly-signed char.
2491         Detect overflow in tab stop string.
2492         (next_file, main): Use EXIT_FAILURE/EXIT_SUCCESS instead of 1/0.
2493         (unexpand): Concatenate input files the same way expand does.
2494
2495         * src/touch.c (no_create, use_ref, posix_date, amtime_now,
2496         touch, main): Use bool for booleans.
2497         (main): Avoid integer overflow when given more than INT_MAX
2498         options.
2499         * src/tsort.c (struct item, n_strings): Use size_t for sizes.
2500         (have_read_stdin, count_items, scan_zeros, detect_loop,
2501         recurse_tree, walk_tree, tsort, main):
2502         Use bool for booleans.
2503         (exit_status): Remove.
2504         (tsort): Return a success flag instead of storing into a global.
2505         (main): Use it.
2506         * src/tty.c (silent, main): Use bool for booleans.
2507         (main): 0 -> STDIN_FILENO.
2508         * src/uname.c (print_element): Use bool for booleans.
2509
2510         * src/test.c (TRUE, FALSE, SHELL_BOOLEAN, TRUTH_OR, TRUTH_AND):
2511         Remove.  All uses replaced by C99 boolean primitives.
2512         (TEST_TRUE, TEST_FALSE): New constants, for readability.
2513         (test_unop, binop, unary_operator, binary_operator, two_arguments,
2514         three_arguments, posixtest, expr, term, and, or, is_int, age_of,
2515         one_argument, main): Use bool for booleans.
2516         (advance, unary_advance): Now inline procedures rather than a macros.
2517         (is_int): Renamed from isint, to avoid namespace clash with ctype.h.
2518         (term, and, or): When it's easy, loop instead of recursing.
2519         (term): Avoid integer overflow if there are INT_MAX-3 args (!).
2520         (binary_operator, unary_operator): Simplify by systematically rewriting
2521         true==FOO to FOO (where FOO is a boolean).
2522         (unary_operator): Don't consider a file to be a regular file
2523         merely because its mode&S_IFMT is zero.  Just use S_ISREG.
2524         Remove unnecessary casts.  Remove ifdefs for things like
2525         S_ISSOCK that are no longer needed, since stat-macros.h always
2526         defines them now.
2527
2528         * src/tac-pipe.c (buf_init_from_stdin, find_bol, tac_mem):
2529         Use bool for booleans.
2530         (buf_init_from_stdin, buf_free, find_bol, print_line):
2531         Use size_t for sizes.
2532         * src/tac.c (separator_ends_record, tac_seekable, tac_file,
2533         tac_stdin, tac_stdin_to_mem, main): Use bool for booleans.
2534         (match_length, G_buffer_size, tac_seekable, main): Use size_t for sizes.
2535         (tac_seekable): Use ptrdiff_t for pointer subtraction.
2536         Report an error if the result is out of range.
2537         (tac_seekable, main): Check for integer overflow in buffer size
2538         calculations.
2539         (main): Remove unnecessary casts.
2540
2541         * src/su.c (run_shell): Pass a new n_additional_args arg, so that
2542         the callee doesn't have to count 'em.  All callers changed.
2543         Don't allocate more space for the arg vector than we'll need.
2544         Use memcpy to copy the args rather than rolling our own loop.
2545         Use size_t for sizes.
2546         (fast_startup, simulate_login, change_environment, log_su,
2547         correct_password, restricted_shell, main): Use bool for booleans.
2548         (longopts): Don't assume change_environment is an int.
2549         Use NULL, not 0, for pointers.
2550         (xsetenv): New function, replacing xputenv and concat.
2551         All callers changed.
2552         (elements): Remove; no longer needed.
2553         (log_su, correct_passwd, main): Prefer !x to x==NULL.
2554         (log_su): 2 -> STDERR_FILENO.
2555         (modify_environment, main): Don't assume that getenv's returned value
2556         has an indefinite lifetime.
2557         (modify_environment): Allocate a larger environ.
2558         (main): Remove an impossible 'case 0'; if it happens now, it'll
2559         get diagnosed.  Don't assume getpwnam results outlive endpwent.
2560         Check for null or empty pw_name, pw_dir and for null pw_passwd.
2561
2562         * src/stty.c (VA_START): Remove.  All callers now use va_start.
2563         (_POSIX_VDISABLE): Remove unnecessary cast.
2564         (struct control_info, visible): Use cc_t for control chars.
2565         (struct control_info): Use size_t for sizes.
2566         (recover_mode, set_mode, display_speed, display_window_size,
2567         valid_options, main, display_changed):
2568         Use bool for booleans.
2569         (integer_arg): Return unsigned long int, not long int.
2570         Accept new max arg; all callers changed, to specify a maximum
2571         value for integer parameters instead of silently overflowing.
2572         (wrap): Do not overrun the stack buffer if the output contains
2573         more than 1024 bytes.  Instead, malloc a buffer.
2574         (main): Remove a "what is this?!?" FIXME.  Nobody knows what it is.
2575         Remove unnecessary casts.
2576         (set_control_char): Allow int values only up to cc_t range.
2577         (screen_columns): Don't reject INT_MAX.
2578         (display_changed, display_all, display_speed, recover_mode):
2579         Don't assume cc_t fits in int.
2580
2581         * src/remove.h: Add copyright notice.
2582         (struct rm_options): Use bool for booleans.
2583         * src/rmdir.c (empty_paths, ignore_fail_on_non_empty, verbose,
2584         errno_rmdir_non_empty, remove_parents, main): Likewise.
2585         * src/sum.c (have_read_stdin, bsd_sum_file, sysv_sum_file,
2586         main): Likewise.
2587         (main): Don't dump core if invoked with argv[0]==NULL.
2588         * src/tee.c (tee, append, ignore_interrupts, main, tee):
2589         Use bool for booleans.
2590         (tee): Use ssize_t for read returns.
2591
2592         * src/ptx.c: Add a FIXME mentioning that there are many
2593         unchecked integer overflows in this file.
2594         (gnu_extensions, auto_reference, input_reference, right_reference,
2595         ignore_case, initialize_regex, fix_output_parameters,
2596         output_one_roff_line, output_one_text_line, output_one_dumb_line, main):
2597         Use bool for booleans.
2598         (SKIP_SOMETHING, compare_words, digest_break_file,
2599         find_occurs_in_text, fix_output_parameters):
2600         Use to_uchar instead of a caset.
2601         (print_field): Rewrite to avoid cast.
2602
2603         * src/printf.c (posixly_correct): Use bool for booleans.
2604         (verify, main): Use EXIT_FAILURE/EXIT_SUCCESS instead of 1/0.
2605         (STRTOX): Rewrite to avoid casts.
2606         (print_esc_char): Arg is char, not int.
2607         * src/readlink.c (canonicalize): Remove.  All uses now merely inspect
2608         can_mode.
2609         (no_newline, verbose): Use bool for booleans.
2610         (can_mode): Now of type int; use -1 to denote otherwise-uninitialized.
2611         * src/shred.c (struct Options, main): Use bool for booleans.
2612         (isaac_seed_data, fillpattern, wipefile): Rewrite to avoid casts.
2613         * src/split.c (cwrite, bytes_split, lines_split, line_bytes_split):
2614         Use bool for booleans.
2615         * src/stat.c (G_fail): Remove.
2616         (print_statfs): Print various gotta-be-nonnegative values using
2617         unsigned long int, not long int or int.
2618         (do_statfs, do_stat): Return a boolean success flag.
2619         (do_stat, main): Use bool for booleans.
2620
2621         * src/pr.c: Add a FIXME mentioning that there are many
2622         unchecked integer overflows in this file.
2623         (TRUE, FALSE): Remove.  All uses replaced by true and false.
2624         (struct COLUMN, read_line, print_page, print_stored, open_file,
2625         skip_to_page, init_fps, parallel_files, align_empty_cols,
2626         empty_line, FF_only, explicit_columns, extremities, keep_FF,
2627         print_a_FF, print_a_header, use_form_feed, have_read_stdin,
2628         print_across_flag, storing_columns, balance_columns,
2629         truncate_lines, join_lines, untabify_input, failed_opens,
2630         numbered_lines, skip_count, use_esc_sequence, use_cntrl_prefix,
2631         double_space, ignore_failed_opens, use_col_separator,
2632         pad_vertically, last_line, main, init_parameters, skip_read,
2633         read_line, print_stored):
2634         Use bool for booleans.
2635         (struct COLUMN, char_to_clump, store_char, print_char):
2636         Use char for chars.
2637         (clump_buff, print_clump): Use char[], not int[], for an array whose
2638         elements are always chars.
2639         (first_last_page, main, getoptarg, balance, add_line_number,
2640         char_to_uclump): Remove unnecessary casts.
2641         (init_parameters): Allocate chars, not ints, for clump_buff.
2642         (print_char): Use to_uchar before invoking ISPRINT.
2643         (char_to_clump): Convert to unsigned char before invoking ISPRINT.
2644
2645         * src/nohup.c (main): Use bool for booleans.
2646         * src/paste.c (paste_parallel, paste_serial, main): Likewise.
2647         * src/pathchk.c (validate-path, main, portable_chars_only): Likewise.
2648         (portable_chars_only): Use to_uchar rather than a cast.
2649         * src/printenv.c (main): Use bool for booleans.
2650         Do not assume that the environ has at most one matching entry
2651         for each option (integer overflow was possible otherwise).
2652
2653         * src/od.c (FMT_BYTES_ALLOCATED): Now an enum, not a decimal
2654         constant.  Do not assume PRIdMAX etc. are strings of length 3 or
2655         less.
2656         (struct tspec): Use it.  fmt_string is now an array, not
2657         a pointer, as there's little point to the indirection here.
2658         (struct tspec, flag_dump_strings,
2659         traditional, flag_pseudo_start, limit_bytes_to_format,
2660         abbreviate_duplicate_blocks, have_read_stdin, simple_strtoul,
2661         decode_one_format, open_next_file, check_and_close,
2662         decode_format_string, skip, write_block, read_char, read_block,
2663         parse_old_offset, dump, dump_strings, main):
2664         Use bool for booleans.
2665         (struct tspec): Use void *, not char *, for generic pointers.
2666         (bytes_to_oct_digits, bytes_to_signed_dec_digits,
2667         bytes_to_unsigned_dec_digits, bytes_to_hex_digits):
2668         Use char, not unsigned int, since char suffices.
2669         (print_s_char, print_char, print_s_short, print_short,
2670         print_int, print_long, print_long_long, print_float,
2671         print_double, print_long_double): Rewrite to avoid casts.
2672         These now take void * arguments, instead of char *.
2673         Use the same body for all functions, except for the choice
2674         of type.  Assume C89 to simplify handling of signed char.
2675         (dump_hexl_mode_trailer, print_named_ascii, print_ascii):
2676         Rewrite to avoid casts.
2677         (print_named_ascii, print_ascii): Now takes void *, not char *.
2678         (decode_one_format): Use int for printf field widths, not
2679         unsigned int.  Pass void * to subsidiary printers,
2680         not char *.  Simplify handling of floating-point formats
2681         by factoring out common code dealing with precision and field width.
2682         (decode_format_string): Avoid need for temporary copy of
2683         each decoded struct tspec.
2684         (get_lcm): Remove unnecessary cast.
2685         (main): Fix bug where more than INT_MAX failed decodes were ignored.
2686
2687 2004-08-02  Paul Eggert  <eggert@cs.ucla.edu>
2688
2689         * src/nl.c (TRUE, FALSE): Remove; all uses changed to true, false.
2690         (enum number_format): Remove.
2691         (FORMAT_RIGHT_NOLZ, FORMAT_RIGHT_LZ, FORMAT_LEFT): Now strings,
2692         not enum values.
2693         (DEFAULT_SECTION_DELIMITERS): Now an array constant, not a macro.
2694         (section_del): Now const.
2695         (print_fmt): Remove.
2696         (starting_line_number, page_incr, blank_join, line_no,
2697         print_lineno, proc_text, main):
2698         Use intmax_t for line numbers.
2699         (reset_numbers, have_read_stdin, build_type_arg, nl_file, main):
2700         Use bool for booleans.
2701         (lineno_format): Now a string, not an enum value.
2702         (build_print_fmt): Remove.  All calls removed.  This work is
2703         now done within print_lineno.
2704         (build_type_arg): Use size_t for sizes.
2705         (print_lineno): Check for line number overflow.
2706         (proc_text, main): Remove unnecessary cast.
2707
2708         * src/ln.c (symbolic_link, interactive, remove_existing_files,
2709         verbose, hard_dir_link, dereference_dest_dir_symlinks,
2710         do_link, main): Use bool for booleans.
2711
2712         * src/ls.c (struct fileinfo, file_interesting,
2713         extract_dirs_from_files, color_symlink_as_referent,
2714         FILE_OR_LINK_MODE, sort_reverse, print_owner, print_group,
2715         numeric_ids, print_block_size, dired, print_with_color,
2716         check_symlink_color, print_inode, recursive, immediate_dirs,
2717         all_files, really_all_files, qmark_funny_chars,
2718         print_dir_name, format_needs_stat, format_needs_type, visit_dir,
2719         main, decode_switches, parse_ls_color, print_dir, file_interesting,
2720         gobble_file, make_link_path, basename_is_dot_or_dotdot,
2721         extract_dirs_from_files, print_long_format):
2722         Use bool for booleans.
2723         (dir_defaulted): Remove; no longer needed.
2724         (main): Use int to count files, since it suffices for argv.
2725         Rewrite to avoid need for dir_defaulted.
2726         (main, print_dir, gobble_file, get_link_name,
2727         xstrcoll):
2728         Set exit status to EXIT_SUCCES/EXIT_FAILURE rather than 0/1.
2729         (decode_switches): Put back check for ws.ws_col <= SIZE_MAX.
2730         Remove unnecessary cast to int.  Use int instead of unsigned
2731         int to count from 0 to 1.
2732         (get_funky_string, print_type_indicator): Use char for bytes, not int.
2733         (make_link_path): Use NULL for null pointers.
2734         (quote_name): Use to_uchar instead of cast.
2735
2736         * src/id.c (use_name, main, print_user, xgetgroups, print_group_list,
2737         print_full_info): Use bool for booleans.
2738         (problems): Remove, replacing with....
2739         (ok): New var (inverted from old sense).
2740         (print_user, print_group, print_full_info):
2741         Print uids/gids with %lu, not %u.
2742         (xgetgroups): Don't run out of memory if getgroups or getugroups
2743         returns -1.
2744         * src/setuidgid.c (main): Print uids/gids with %lu, not %ld.
2745
2746         * src/factor.c (wheel_tab): Use unsigned char instead of unsigned
2747         int, since it suffices.
2748         (factor, print_factors): Use size_t for sizes.
2749         (print_factors, do_stdin, main): Use bool for booleans.
2750         * src/fold.c (TAB_WIDTH): New macro; use it instead of "8".
2751         (fold_file, main): Use bool for booleans.
2752         (fold_file, main): Use size_t for sizes.
2753         (main): Allow -w options up to SIZE_MAX - TAB_WIDTH - 1, instead
2754         of prohibiting widths greater than INT_MAX.
2755         * src/head.c (presume_input_pipe, print_headers, have_read_stdin,
2756         write_header, elide_tail_bytes_pipe, elide_tail_bytes_file,
2757         elide_tail_lines_pipe, elide_tail_lines_seekable,
2758         elide_tail_lines_file, head_bytes, head_lines, head, head_file,
2759         string_to_integer, main):
2760         Use bool for booleans.
2761         (main): Rewrite to avoid cast.
2762
2763         * src/csplit.c (struct line): Use size_t for sizes.
2764         (main): Remove unnecessary cast.
2765         * src/cut.c (cut_fields): Use to_uchar rather than a cast.
2766         * src/cut.c (cut_file, main): Use bool for booleans.
2767         * src/date.c (show_date, rfc_format, batch_convert, main): Likewise.
2768         * src/env.c (main): Likewise.
2769         * src/expr.c (nextarg): Likewise.
2770         * src/env.c (main): Remove unused and nonstandard envp arg.
2771
2772         * src/fmt.c (COST, MAXWORDS): Add a comment describing some of
2773         fmt's arbitrary limits.
2774         (TRUE, FALSE): Remove; all uses changed to (true, false).
2775         (main): Use bool for booleans.
2776         Limit maximum width to MAXCHARS / 2.  Use xstrtoul, not xstrtol,
2777         to parse width.
2778         (copy_rest): Remove unnecessary cast.
2779         (get_prefix): Rewrite to avoid cast.
2780         (check_punctuation): Use char *, not unsigned char *; C89 requires
2781         this.  Avoid off-by-one buffer read overrun when line is empty.
2782         (flush_paragraph): Don't assume wptr-parabuf is <= INT_MAX.
2783         Remove unnecessary casts.
2784         * tests/fmt/basic (wide-1, wide-2, bad-suffix): Adjust to above
2785         changes.
2786
2787         * src/expand.c (convert_entire_line, have_read_stdin, parse_tabstops,
2788         next_file, expand, main):
2789         Use bool for booleans.
2790         (tab_size, tab_list, add_tabstop, parse_tabstops, validate_tabstops,
2791         expand, main):
2792         Use uintmax_t for column counts.
2793         (add_tabstop): Don't reserve -1 (now UINTMAX_MAX) as a special value.
2794         All callers changed.
2795         (parse_tabstops): Don't pass a negative char to isblank.
2796         Avoid memory leak with large tab stops.
2797         (validate_tabstops, expand): Don't assume number of tab stops is
2798         <= INT_MAX.
2799         (next_file, main): Use EXIT_SUCCESS/EXIT_FAILURE rather than 0/1 when
2800         storing values into exit_status.
2801         (expand): Use same pattern as unexpand for reading chars.
2802         Report an error when input line is too long, instead of silently
2803         screwing up.  Do not mishandle tab stops when backspacing left
2804         over start of line.
2805
2806         * src/dircolors.c (have_read_stdin, append_quoted,
2807         dc_parse_stream, dc_parse_file, main): Use bool for booleans.
2808         (dc_parse_stream): Use enum for state, rather than int.
2809         Use ssize_t to store getline result.
2810
2811         * src/dd.c (translation_needed, parse_integer, scanargs,
2812         apply_translations, char_is_saved, swab_buffer, skip_via_lseek):
2813         Use bool for booleans.
2814         (translate_buffer): Use to_uchar rather than a cast.
2815         (swab_buffer, copy_simple, copy_with_unblock):
2816         Use size_t for sizes.
2817
2818         * src/seq.c (equal_width, valid_format, main): Use bool for booleans.
2819         * src/sleep.c (apply_suffix): Likewise.
2820         * src/tail.c (struct File_spec, reopen_inaccessible_files, count_lines,
2821         forever, from_start, print_headers, have_read_stdin, valid_file_spec,
2822         write_header, file_lines, pipe_lines, pipe_bytes, recheck,
2823         tail_forever, tail_bytes, tail_lines, tail, tail_file,
2824         parse_obsolescent_option, parse_options, main): Likewise.
2825         * src/sleep.c (apply_suffix): Invert sense of result.
2826         Use int (not unsigned int) for multiplier, as this generates better
2827         code with some compilers.  Simplify code a bit.
2828         * src/tail.c (struct File_spec, max_n_unchanged_stats_between_opens,
2829         parse_options): Use uintmax_t, not unsigned int or unsigned long int,
2830         for state counters.
2831         (tail_bytes, tail_lines): Redo test of return value (-1, 0, 1) to
2832         make it a bit clearer.
2833
2834         * src/hostname.c: Include "xgethostname.h".
2835         (xgethostname): Remove decl; xgethostname.h has it.
2836         (sethostname) [!defined(HAVE_SETHOSTNAME) && defined(HAVE_SYSINFO)
2837         && defined (HAVE_SYS_SYSTEMINFO_H) && defined(HAVE_LIMITS_H)]: Use
2838         prototypes rather than K&R form.  Assume any negative value from
2839         sysinfo denotes failure, not just -1.
2840         (main): Simplify use of sethostname.
2841
2842         * src/pinky.c (include_idle, include_heading, include_fullname,
2843         include_project, include_plan, include_home_and_shell, do_short_format,
2844         include_where, main): Use bool for booleans.
2845         (count_ampersands, create_fullname, scan_entries, short_pinky):
2846         Use size_t for sizes.
2847         (create_fullname): Check for overflow in size calculations.
2848         (idle_string): Don't assume that the number of idle days
2849         is less than 10**8 and/or INT_MAX/(24*60*60).
2850         (main): No need to pass a non-NULL last arg to getopt_long.
2851         * src/uptime.c (print_uptime, uptime): Use size_t for sizes.
2852         (print_uptime): Remove unused local variable.
2853         (main): No need to pass a non-NULL last arg to getopt_long.
2854         * src/users.c (list_entries_users, users): Use size_t for sizes.
2855         (list_entries_users): Use char for bytes.
2856         (main): No need to pass a non-NULL last arg to getopt_long.
2857         * src/who.c (do_lookup, short_list, short_output, include_idle,
2858         include_heading, include_mesg, include_exit, need_boottime,
2859         need_deadprocs, need_login, need_initspawn, need_clockchange,
2860         need_runlevel, need_users, my_line_only, main): Use bool for booleans.
2861         (print_runlevel): Use unsigned char for bytes.
2862         (list_entries_who, scan_entries, who): Use size_t for sizes.
2863         (main): No need to pass a non-NULL last arg to getopt_long.
2864
2865         * src/install.c (isdir): Remove decl.
2866         (install_file_to_path): Rely on make_path to fail if the destination
2867         is not a directory, by passing preserve_existing==true to it.
2868         Hence we no longer need to call isdir.
2869         Free dest_dir immediately when it's no longer needed, rather than
2870         waiting until the end of the function.
2871         (copy_file): Don't bother calling isdir, as copy will do the
2872         right thing if the destination is a directory.
2873
2874         * src/du.c (fts_debug, opt_all, apparent_size, opt_count_all,
2875         print_grand_total, opt_separate_dirs, hash_ins, process_file, main):
2876         Use bool for booleans.
2877         (max_depth): Now size_t, not int, to avoid an arbitrary limit
2878         of INT_MAX on depth.
2879         (G_fail): Remove: no longer needed, now that the relevant
2880         functions return bool.
2881         (process_file): Use return value to signal success rather than
2882         setting a global.  Remove first_call static var; not needed, since
2883         we can look at n_alloc.  Use size_t for depths.  Remove FIXME
2884         about size_t casts, as it's now fixed.  Use xnrealloc rather
2885         than the obsolescent XREALLOC.  Don't bother to check whether
2886         reallocation is needed unless level > prev_level.
2887         (du_files): Invert sense of result, for consistency with
2888         other coreutils code.  All callers changed.
2889         (main): Allow --max-depth values up to SIZE_MAX.
2890
2891         * src/df.c (inode_format, show_all_fs, show_local_fs,
2892         show_listed_fs, posix_format, require_sync, print_type,
2893         selected_fstype, excluded_fstype, show_dev, show_point, main):
2894         Use bool for booleans.
2895         (df_readable, show_dev): Use UINTMAX_MAX instead of -1.
2896         (show_dev, show_point, main):
2897         Use EXIT_SUCCESS/EXIT_FAILURE instead of 0/1.
2898         Don't assume disk name lengths are <= INT_MAX.
2899         Rewrite pct calculation to avoid cast.
2900         (show_point): Don't assume resolved length is <= SSIZE_MAX.
2901
2902         * src/cut.c (hash_int) [!defined UINTPTR_MAX]: Use size_t
2903         instead of uintptr_t.
2904         * src/shred.c (UINT_MAX_32_BITS): Remove.
2905         (word32): Remove.  All uses changed to uint32_t.
2906         (isaac_seed_data): Remove unnecessary cast.
2907         * src/system.h (ptr_align): Use size_t; in practice, this is just as
2908         good as uintptr_t in checking for alignments, and has fewer
2909         configuration hassles.
2910
2911         * src/Makefile.am (localedir.h): Make it readonly; this
2912         undoes part of the 2004-07-27 patch.
2913
2914 2004-07-30  Paul Eggert  <eggert@cs.ucla.edu>
2915
2916         * src/sort.c (UCHAR): Remove; all uses changed to to_uchar.
2917         (IS_THOUSANDS_SEP): Use bool when appropriate.
2918         (numcompare, main): Use char, not int, when the value is always a char.
2919         (numcompare): Remove "register"; compilers are smart enough these days.
2920         * src/system.h (errno, CHAR_BIT): Remove decls;
2921         no longer needed now we assume C89 or better.
2922         Include <inttypes.h> before <stdint.h>, as it's the
2923         Autoconf-recommended pattern.
2924         (to_uchar): New inline function, moved here from tr.c.
2925         Use full names for int types, e.g. "long int" rather than "long".
2926         * src/tr.c (to_uchar): Remove; now in system.h.
2927         (is_char_class_member): Use bool when appropriate.
2928
2929         * src/mkdir.c (create_parents, main): Use bool when appropriate.
2930         (main): Use EXIT_SUCCESS/EXIT_FAILURE instead of 0/1.
2931
2932 2004-07-29  Paul Eggert  <eggert@cs.ucla.edu>
2933
2934         * src/mkfifo.c (main): Use EXIT_SUCCESS and EXIT_FAILURE, not 0 and 1.
2935
2936         * src/chmod.c (recurse, force_silent, process_file, process_files,
2937         main): Use bool when appropriate.
2938         * src/cksum.c (cksum, main): Likewise.
2939         * src/comm.c (hard_LC_COLLATE, only_file_1, only_file_2, both,
2940         compare_files, main): Likewise.
2941
2942         * src/copy.h (struct cp_options): Likewise.
2943         * src/copy.c (copy_internal, is_ancestor, copy_dir, copy_reg,
2944         same_file_ok, seen_file, copy_internal, valid_options, copy): Likewise.
2945         * src/cp-hash.h (remember_created): Likewise.
2946         * src/cp-hash.c (remember_created): Likewise.
2947         * src/cp.c (struct dir_attr, flag_path, remove_trailing_slashes,
2948         re_protect, make_path_private, target_directory_operand, do_copy,
2949         cp_option_init, decode_preserve_arg, main): Likewise.
2950         * src/install.c (isdir, change_timestamps, change_attributes,
2951         copy_file, install_file_to_path, install_file_in_dir,
2952         install_file_in_file, strip_files, dir_arg, cp_option_init, main,
2953         change_attributes, change_timestamps): Likewise.
2954         * src/mv.c (remove_trailing_slashes, rm_option_init,
2955         cp_option_init, do_move, movefile, main): Likewise.
2956         * src/remove.c (right_justify), full_filename_, AD_pop_and_chdir,
2957         AD_push, prompt, remove_dir): Likewise.
2958         * src/rm.c (rm_option_init, main): Likewise.
2959
2960         * src/remove.c (top_dir, pop_dir, full_filename_):
2961         Use size_t for sizes.
2962         * src/cp.c (target_directory_operand): Do not clear *NEW_DST if stat
2963         succeeds.  It's not necessary in that case, as *NEW_DST is always
2964         false already.
2965         (do_copy): Rewrite slightly to avoid need for "unreachable" comment.
2966         (main): Use EXIT_SUCCESS, EXIT_FAILURE instead of 0, 1.
2967         * src/rm.c (main): Likewise.
2968
2969         md5sum, sha1sum integer cleanups.
2970
2971         * src/checksum.h: Don't include config.h, sys/types.h, stdio.h:
2972         not needed.
2973         (ALG_UNSPECIFIED): Remove.
2974         (ALG_MDT): Don't make it equal to CHAR_MAX + 1; this isn't necessary.
2975         * src/md5.c: Don't include any files other than checksum.h.
2976         * src/sha1sum.c: Likewise.
2977         * src/md5sum.c (OPENOPTS, have_read_stdin, status_only, warn,
2978         bsd_split_3, split_3, hex_digits, digest_file, digest_check, main):
2979         Use bool when appropriate.
2980         (digest_check): Increase limit of number of input lines to
2981         UINTMAX_MAX from INT_MAX.  Diagnose any overflows of this counter.
2982         Use ngettext instead of hard-to-i18nize hardcoded stuff for plurals.
2983
2984 2004-07-28  Paul Eggert  <eggert@cs.ucla.edu>
2985
2986         * src/cat.c (exit_status): Remove.  Now done by passing a boolean
2987         'ok' flag around.
2988         (simple_cat, cat): Return true if successful.  All callers changed.
2989         (simple_cat, cat, main): Use bool for booleans.
2990         (simple_cat): Use size_t for sizes.
2991         (cat, main): Use the same names for parameters that we use for
2992         long options, to avoid confusion.  This inverts the sense of the
2993         show_tabs (formerly output_tabs) and number_nonblank
2994         (formerly numbers_at_empty_lines) variables.
2995         (main): Don't mess up (due to integer overflow) if we are given
2996         INT_MAX - INT_MIN + 1 options.
2997         [O_BINARY]: Don't invoke isatty unless the other options require it.
2998         (main): When deciding whether to use simple_cat, don't worry
2999         about binary option; it's irrelevant.
3000
3001         * src/dcgen: Remove comments, trailing white space, and empty
3002         lines from the output strings, to save space.
3003         Use a narrower type like 'unsigned char' for line lengths, if
3004         that will do.
3005         Make the output variables static, not extern.
3006
3007         * src/chgrp.c (parse_group): Require base 10 when parsing
3008         groups as integers.
3009         (main): int -> bool when appropriate.
3010         * src/chown.c (main): Likewise.
3011         * src/chown-core.c: Include inttostr.h.
3012         (UINT_MAX_DECIMAL_DIGITS, uint_to_string): Remove.
3013         (gid_to_name, uid_to_name): Use imaxtostr/umaxtostr
3014         instead of uint_to_string).
3015         (describe_change): Instead of an int flag, use a char *
3016         auxiliary; this avoids the need for casts.
3017         Assume free (NULL) works.
3018         (change_file_owner): Return true/false, not 0/-1, since
3019         we don't set errno.  All callers changed.
3020         Use bool when appropriate.
3021         (chown_files): Likewise.
3022         * src/chown-core.h (chown_files): Likewise.
3023
3024         * tests/chown/basic: Test for proper handling of uids like
3025         "010", which must be parsed as decimal.
3026
3027         * tests/misc/pwd: Don't assume that Perl's getpwd agrees with our
3028         pwd when there are multiple names for the working directory
3029         (which can happen with an automounter, sigh).
3030
3031         * src/Makefile.am ($(SCRIPTS)): Don't depend on Makefile;
3032         this causes Solaris 8 'make' to refuse to build "groups".
3033         (localedir.h): Don't depend on Makefile: this causes Solaris
3034         8 'make' to build localedir.h unnecessarily.  The dependence
3035         on Makefile is ineffective anyway, since $(localedir) might
3036         change even if Makefile hasn't.
3037
3038         * src/remove.c (remove_dir): If we can't save the state of the
3039         working directory, pretend we started from "/", not ".".
3040         This avoids a bug on hosts like Solaris that don't let you
3041         remove the working directory.
3042
3043 2004-07-27  Paul Eggert  <eggert@cs.ucla.edu>
3044
3045         * src/printf.c (strtiomax, strtoumax): Declare if not already
3046         declared: this fixes a portability bug with Solaris 8 + GCC.
3047         (STRTOX): Parenthesize use of macro arg as expression.
3048         (vstrtoimax, vstrtoumax, vstrtold): Remove now-unnecessary
3049         parentheses.
3050         * configure.ac: Check for declaration of strtoumax, for
3051         src/printf.c.
3052
3053         * src/Makefile.am (cp_LDADD, ginstall_LDADD, mv_LDADD,
3054         pathchk_LDADD, rm_LDADD, test_LDADD): New vars, for eaccess.
3055
3056         * tests/readlink/can-e: Don't assume that we can remove the
3057         working directory: this isn't possible under Solaris 8, say.
3058         * tests/readlink/can-f: Likewise.
3059         * tests/readlink/can-m: Likewise.
3060
3061         * src/copy.c (copy_internal): find_backup_file_name no longer
3062         returns NULL, so don't bother to check for this.
3063         * src/cp.c (do_copy): Likewise.
3064         * src/ln.c (do_link): Likewise.
3065
3066 2004-07-25  Paul Eggert  <eggert@cs.ucla.edu>
3067
3068         * src/nice.c (GET_NICE_VALUE): Renamed from GET_PRIORITY.
3069         All uses changed.
3070         (NZERO): New macro, if system doesn't define it already.
3071         (usage): Distinguish priorities from nice values.
3072         Don't assume NZERO is 20.
3073         (main): Use bool instead of int where appropriate.
3074         If user specifies an adjustment out of range, always truncate it
3075         to an inrange value instead of sometimes giving an error message
3076         and sometimes not.
3077         Do not assume that -1 is an error return from "nice" or
3078         "getpriority", as it might be the current nice value minus NZERO.
3079         If nice/setpriority fails with errno == EPERM, go ahead and run
3080         the command anyway; POSIX requires this.
3081
3082         * src/pathchk.c: Include euidaccess.h.
3083         (dir_ok): Use euidaccess, not access.
3084         * src/test.c (R_OK, W_OK, X_OK, FOK): Remove; system.h defines them.
3085         (eaccess): Remove.  All users changed to use euidaccess instead.
3086
3087 2004-07-24  Paul Eggert  <eggert@cs.ucla.edu>
3088
3089         * src/uptime.c (print_uptime) [defined BOOT_MSG]:
3090         Don't assume ut_line is null-terminated.
3091         * src/who.c (print_line): New arguments USERLEN and LINELEN,
3092         since USER and LINE might not be null terminated.  All callers
3093         changed.
3094
3095 2004-07-23  Paul Eggert  <eggert@cs.ucla.edu>
3096
3097         Fix bug with "tail -f" reported by Rob Holland in
3098         <http://lists.gnu.org/archive/html/bug-coreutils/2004-07/msg00054.html>.
3099         Also, remove the undocumented and unsupported-since-2000
3100         --max-consecutive-size-changes options.  Fix another related bug:
3101         "tail" got confused if stdin, stdout, or stderr were closed.
3102         Also, use output buffering even with "tail -f".
3103
3104         * NEWS: Document this, plus yesterday's patch.
3105         * doc/coreutils.texi (tail invocation): "size has remained the same"
3106         -> "file has not changed", which is more accurate for fifos.
3107         * src/tail.c: Include fcntl-safer.h.
3108         (COPY_TO_EOF): Set to UINTMAX_MAX, not OFF_T_MAX (which was wrong).
3109         (COPY_A_BUFFER): New macro.
3110         (struct File_spec): New members mtime, mode, blocking.
3111         Remove member n_consecutive_size_changes.
3112         (DEFAULT_MAX_N_CONSECUTIVE_SIZE_CHANGES,
3113         max_n_consecutive_size_changes_between_opens,
3114         MAX_CONSECUTIVE_SIZE_CHANGES_OPTION): Remove.
3115         (long_options, tail_forever, parse_options):
3116         Remove (non-)support for --max-consecutive-size-changes.
3117         (record_open_fd): New function.
3118         (recheck, tail_file): Use it.  Don't assume that stdin is open.
3119         (dump_remainder): Add support for new COPY_A_BUFFER special value.
3120         Treat errno==EAGAIN like EOF, since it might be a nonblocking read.
3121         (recheck): New arg BLOCKING, specifying whether to use blocking reads.
3122         All uses changed.
3123         (n_live_files): Remove, replacing with...
3124         (any_live_files): New function.  All uses changed.
3125         (tail_forever): Use nonblocking I/O unless we know that blocking I/O
3126         is safe; this avoids some hangs when reading from a fifo.
3127         Avoid invoking fstat or sleep when using blocking I/O.
3128         Do not check for changes to size if the file is not a regular file,
3129         as the size is undefined in that case.
3130         Check for changes to mtime or mode, too; this works for non-regular
3131         files.
3132         (tail_forever, main): Redo fflush strategy to work even when input
3133         is nonblocking.  Don't use unbuffered output; just flush when needed.
3134
3135 2004-07-22  Paul Eggert  <eggert@cs.ucla.edu>
3136
3137         * src/tail.c (main): Ignore -f if no file operand is specified
3138         and standard input is a pipe.
3139         * doc/coreutils.texi (tail invocation): Do not ignore -f for
3140         all pipes, just for when standard input is a pipe and no
3141         file operand is specified.
3142         * tests/tail/Test.pm: Reinstate f-1 test, since we now pass.
3143         Add a new commented-out f-2 test, which we still fail.
3144         (test_vector): All f-* tests are special cases, not just f-1.
3145
3146 2004-07-12  Paul Eggert  <eggert@cs.ucla.edu>
3147
3148         * src/uptime.c: Include c-strtod.h.
3149         (print_uptime): Use c_strtod instead of setlocale and sscanf.
3150         Use long int rather than int to count days (for 64-bit hosts),
3151         and check for arithmetic overflow when converting double to time_t.
3152
3153 2004-07-11  Paul Eggert  <eggert@cs.ucla.edu>
3154
3155         * src/printf.c (vstrtold): Renamed from vstrtod.
3156         Now returns long double.  All uses changed.
3157         (print_direc): Use "L" length modifier when printing floating point
3158         numbers, since we're now printing long double.
3159
3160 2004-07-06  Paul Eggert  <eggert@cs.ucla.edu>
3161
3162         printf cleanup, to avoid undefined behavior, to add support for
3163         formats that Bash supports, and to support wide integers like
3164         Bash does.
3165
3166         * NEWS: Document this.
3167         * src/printf.c (UNSPECIFIED): Remove.  All uses now replaced by
3168         booleans, so that we don't reserve any values for precision or
3169         width (like Bash).
3170         (STRTOX): Use prototype, not K&R-style definition.
3171         (vstrtoimax): Renamed from xstrtol (to avoid confusion with xstrtol
3172         in ../lib), with type change to intmax_t.
3173         All uses changed.
3174         (vstrtoumax): Renamed from xstrtoul, with type change to uintmax_t.
3175         All uses changed.
3176         (vstrtod): Renamed from xstrtod.  All uses changed.
3177         (print_direc): Use boolean arg instead of special value to indicate
3178         a missing precision or width.  LENGTH no longer includes
3179         length modifiers or conversion character.  New arg CONVERSION
3180         now specifies conversion character.
3181         Use intmax_t-width formatting for integers (like Bash).
3182         Add support for C99 %a, %A, %F (like Bash).
3183         Add support for field width with %c (POSIX requires this).
3184         Add a FIXME for lack of support for field width and precision
3185         for %b.
3186         Add support for '\'', '0' flags.
3187         Check for invalid combinations of flags, field width, precision,
3188         and conversion, to prevent use of undefined behavior.
3189         Allow multiple length modifiers, for formats like "%lld" (like Bash).
3190         Add support for C99 'j', 't', 'z' length modifiers (like Bash).
3191         In error message, output entire invalid conversion specification,
3192         instead of merely outputting % followed by the conversion char.
3193         * tests/misc/printf: Add tests for the above.
3194
3195 2004-04-03  Dmitry V. Levin  <ldv@altlinux.org>
3196
3197         Change "readlink -f" to be more compatible with prior implementations.
3198         Add more canonicalize options, -e and -m.
3199         Add comprehensive tests for all readlink modes.
3200
3201         * m4/canonicalize.m4 (AC_FUNC_CANONICALIZE_FILE_NAME):
3202         Do not add canonicalize.c here.
3203
3204         * src/readlink.c (longopts): Add new options.
3205         (usage): Document them.
3206         (canonicalize_fname): New proxy function.
3207         (main): Handle new options.
3208         * doc/coreutils.texi (readlink invocation): Document new
3209         "readlink -f" behaviour and new canonicalize options, -e and -m.
3210
3211         * configure.ac (AC_CONFIG_FILES): Add tests/readlink/Makefile.
3212         * tests/Makefile.am (SUBDIRS): Add readlink.
3213         * tests/readlink/Makefile.am: New file.
3214         * tests/readlink/{rl-1,can-e,can-f,can-m}: New readlink tests.
3215         * tests/misc/Makefile.am (TESTS): Remove basic readlink test.
3216         * tests/misc/readlink: Remove file.
3217
3218 2004-07-04  Jim Meyering  <jim@meyering.net>
3219
3220         * src/copy.c (copy_internal): Add a FIXME comment.
3221
3222 2004-07-02  Paul Eggert  <eggert@cs.ucla.edu>
3223
3224         * src/copy.c (copy_dir): Assume path_concat returns non-NULL.
3225         * src/cp.c (do_copy): Likewise.
3226         * src/mv.c (movefile): Likewise.
3227
3228         * src/cp.c (make_path_private): 2nd arg is now size_t, not int,
3229         to avoid problem when path_concat dir name is longer than 2 GiB (!).
3230
3231         * src/nohup.c (main): Don't pass NULL first argument to path_concat.
3232         This cleans up the semantics a bit, as we no longer try to open the
3233         same file twice.
3234
3235 2004-07-01  Paul Eggert  <eggert@cs.ucla.edu>
3236
3237         * NEWS: Add short names -t and -T for --target-directory
3238         and --no-target-directory options, respectively.
3239
3240         * src/cp.c (NO_TARGET_DIRECTORY_OPTION, TARGET_DIRECTORY_OPTION):
3241         Remove.  All uses changed to 'T' and 't', respectively.
3242         * src/install.c, src/ln.c, src/mv.c: Likewise.
3243
3244         * src/cp.c (long_opts, usage, do_copy, main): Add -t and -T as
3245         aliases for --target-directory and --no-target-directory,
3246         respectively.
3247         * src/install.c (long_options, main, usage): Likewise.
3248         * src/ln.c, src/mv.c: Likewise.
3249
3250 2004-07-01  Jim Meyering  <jim@meyering.net>
3251
3252         * Makefile.maint (sc_file_system): New target.
3253         (syntax-check-rules): Add it.
3254         .x-sc_file_system: New file.
3255         * Makefile.am (EXTRA_DIST): Add it.
3256
3257         * man/sync.x: Use "file system" rather than "filesystem".
3258         * man/stat.x, man/df.x: Likewise.
3259
3260 2004-06-30  Paul Eggert  <eggert@cs.ucla.edu>
3261
3262         * src/df.c (usage, main): Output "file system" rather than
3263         "filesystem".
3264         * src/du.c (usage): Likewise.
3265         * src/shred.c (usage): Likewise.
3266         * src/stat.c (usage): Likewise.
3267         * src/stat.c (long_options, usage): Rename "--filesystem" to
3268         "--file-system".  But keep the old name around, for compatibility
3269         reasons.
3270
3271 2004-06-29  Paul Eggert  <eggert@cs.ucla.edu>
3272
3273         Add support for --no-target-directory option.
3274
3275         * NEWS: Document it.
3276         * doc/coreutils.texi (Common options, Target directory, cp
3277         invocation, install invocation, mv invocation, ln invocation):
3278         Likewise.
3279         (link invocation): Explain how to rewrite link using ln now
3280         that we have --no-target-directory.
3281         (ln invocation): Explain that --no-target-directory subsumes
3282         --no-dereference.
3283         (unlink invocation): Modify wording to match new wording in
3284         link invocation.
3285
3286         * src/cp.c (NO_TARGET_DIRECTORY_OPTION): New constant.
3287         (long_opts, usage, do_copy, main): Add support for
3288         --no-target-directory,
3289         * src/install.c (NO_TARGET_DIRECTORY_OPTION, long_options, main,
3290         usage): Likewise.
3291         * src/ln.c (NO_TARGET_DIRECTORY_OPTION, long_options, usage,
3292         main): Likewise.
3293         * src/mv.c (NO_TARGET_DIRECTORY_OPTION, long_options, usage,
3294         main): Likewise.
3295         * src/mv.c (enum): Sort values.
3296
3297 2004-06-29  Jim Meyering  <jim@meyering.net>
3298
3299         Don't let verbose-mode output from a subshell obscure actual differences.
3300         * tests/rm/inaccessible: Turn off command-echoing just before
3301         invoking subshell, then turn it back on if VERBOSE=yes afterward.
3302
3303 2004-06-25  Paul Eggert  <eggert@cs.ucla.edu>
3304
3305         Add support for 'install --target-directory', an option
3306         that has been documented for years but not implemented (!).
3307         * doc/coreutils.texi (install invocation): Document
3308         --target-directory in synopsis, too.
3309         * src/install.c (TARGET_DIRECTORY_OPTION): New var.
3310         (long_options, main, usage): Add --target-directory.
3311         (target_directory_operand): New function, stolen from mv.c.
3312         (main): Use it.  Check for -d and --target-directory.
3313         Alter wording of diagnostics to match other programs.
3314
3315 2004-06-28  Jim Meyering  <jim@meyering.net>
3316
3317         * src/cp.c (usage): Fix copy+paste error in description of
3318         --target-directory: s/move/copy/.  From Paul Jarc.
3319
3320 2004-06-27  Paul Eggert  <eggert@cs.ucla.edu>
3321
3322         Use more-consistent rules among cp, ln, and mv when dealing with
3323         last operands that are (or look like) directories.
3324
3325         * src/cp.c (target_directory_operand): New, nearly-common function,
3326         It reports an error if the destination appears to be a directory
3327         (e.g., because it has a trailing slash) but is not.
3328         * src/ln.c, src/mv.c: Likewise.
3329         * src/cp.c (do_copy): Use it.
3330         * src/ln.c (main): Likewise.
3331         * src/mv.c (main): Likewise.
3332
3333         * src/cp.c (do_copy): Don't assume argc is positive.
3334         Don't bother to lstat dest, since copy() will do that for us.
3335         Use "const" to avoid the need for cast.
3336
3337         * src/cp.c (do_copy): Don't output a usage message because of file
3338         problems (e.g., an operand is not a directory).  Use it only for
3339         syntax.  Standardize on "target %s is not a directory" for the
3340         diagnostic.
3341         * src/ln.c (main): Likewise.
3342         * src/mv.c (main): Likewise.
3343
3344         * src/cp.c (do_copy): Remove test for trailing slash, since
3345         target_directory_operand now does this.
3346         * src/ln.c (main): Likewise.
3347         * src/mv.c (movefile): Likewise.
3348
3349         * src/cp.c (main): Reject multiple target directories.
3350         Check whether a specified target is a directory when parsing the
3351         options, using stat.  This gives more-accurate diagnostics.
3352         * src/ln.c (main): Likewise.
3353
3354         * src/ln.c (isdir): Remove decl; no longer needed.
3355         * src/mv.c (isdir, lstat): Likewise.
3356
3357         * src/ln.c (do_link): New arg dest_is_dir.  All uses changed.
3358         Don't check the destination ourself; rely on dest_is_dir.
3359         This way we can avoid lstatting the destination in the
3360         usual case, and in the worst case we lstat 1, not 3 times.
3361         Don't bother to unlink unless link failed; this saves a syscall.
3362         Remove unnecessary backup_succeeded flag;
3363         it was identical to "dest_backup != NULL".
3364
3365         * src/ln.c (main): Use int to count to argc, not unsigned int.
3366         This handles negative operand counts.
3367         * src/mv.c (main): Likewise.
3368
3369         * src/mv.c (do_move): Don't call hash_init; expect the caller to
3370         do it, for consistency with cp.c and ln.c.  All callers changed.
3371         (movefile): dest_is_dir parameter is now bool, not int.
3372         (main): Standardize on "missing destination file operand after %s"
3373         for the diagnostic, for consistency with cp.c.
3374
3375         * tests/mv/diag: Don't assume "mv --target=nonexistentdir"
3376         will complain about the arg count.
3377         Adjust to new (briefer) diagnostics.
3378         * tests/cp/fail-perm: Add a test to verify that we get the new
3379         diagnostic when failing to copy through a symlink-to-inaccessible-dir.
3380
3381 2004-06-27  Paul Eggert  <eggert@cs.ucla.edu>
3382
3383         Fix a bug: formerly, if d/x was a directory and x a file, "ln x
3384         d/" incorrectly created a link d/x/x.  It also saves some system
3385         calls.
3386
3387         * NEWS: Document the fix.
3388
3389         * src/ln.c (main): Don't append basename to dest if this
3390         results in an existing directory name.
3391         * tests/ln/misc: See whether a trailing slash is followed too far.
3392
3393 2004-06-26  Jim Meyering  <jim@meyering.net>
3394
3395         * src/printf.c (main): When given no arguments, print the standard
3396         "missing operand\nTry printf --help..." message -- to be consistent.
3397
3398 2004-06-26  Jim Meyering  <jim@meyering.net>
3399
3400         * src/mknod.c (main): Add \n at the end of message output via fprintf.
3401
3402 2004-06-25  Jim Meyering  <jim@meyering.net>
3403
3404         * tests/ln/misc: Add test for ln subscript error.
3405
3406 2004-06-23  Paul Eggert  <eggert@cs.ucla.edu>
3407
3408         * src/ln.c (do_link): Remove unnecessary call to lstat.
3409         (main): Avoid subscript error when the destination is "".
3410
3411 2004-06-23  Jim Meyering  <jim@meyering.net>
3412
3413         * tests/*: Replace all occurrences of `(exit N); exit' with
3414         `(exit N); exit N'.  Otherwise, those many tests could exit with
3415         improper exit status when exiting via e.g., a trapped interrupt.
3416         Thanks to a report from Bob Proulx.
3417
3418 2004-06-22  Paul Eggert  <eggert@cs.ucla.edu>
3419
3420         * src/who.c (idle_string, print_user): New arg boottime,
3421         specifying the most recent boot time.  All uses changed.
3422         (idle_string) Consider a line to be "old" if it hasn't been used
3423         since the last boot time.  Watch out for overflow when computing
3424         times, and for times in the future.
3425         (idle_string): Record latest boot time.
3426
3427 2004-06-22  Jim Meyering  <jim@meyering.net>
3428
3429         * src/test.c (usage): Correct description of `-t FD'.  The file
3430         descriptor, FD, is no longer optional.  Reported by Ton Nijkes.
3431
3432 2004-06-21  Paul Eggert  <eggert@cs.ucla.edu>
3433
3434         The 2004-06-19 fix for who and pinky was incomplete, as ctime
3435         has undefined behavior if the year precedes -999 or follows 9999.
3436         Since we have to stop using ctime anyway, we might as well use
3437         strftime and fix the FIXME, and support internationalized dates.
3438
3439         * NEWS: Document the new behavior.
3440         * src/who.c: Include "hard-locale.h".
3441         (time_format, time_format_width): New vars.
3442         (time_string, print_line): Use them.
3443         (main): Set them.
3444         (time_string): Use localtime + strftime instead of
3445         ctime, to avoid problems with years before -999 or after 9999.
3446         * src/pinky.c: Likewise.
3447
3448 2004-06-21  Paul Eggert  <eggert@cs.ucla.edu>
3449
3450         Fix bug: GNU 'ls' didn't count columns correctly if user or group
3451         names contained multibyte characters where the column count
3452         differed from the byte count.  This patch also corrects
3453         some comments.
3454
3455         * src/ls.c (format_user_or_group): New function, which counts
3456         columns correctly.
3457         (format_user, format_group): Use it.
3458         (format_user_or_group_width): New function, which counts columns
3459         correctly.
3460         (format_user_width, format_group_width): Use it.
3461
3462 2004-06-21  Jim Meyering  <jim@meyering.net>
3463
3464         * tests/priv-check: Quote "$PATH" in PATH=$PATH.
3465         Suggestion from Andreas Schwab.
3466
3467         * tests/priv-check: When running as root, be sure to propagate
3468         PATH through to the process we exec as non-root.
3469         Reported by michael@aplatform.com.
3470
3471         * src/mknod.c (main): Don't segfault when calculating the
3472         expected number of operands for `mknod NAME'.
3473
3474 2004-06-20  Jim Meyering  <jim@meyering.net>
3475
3476         * src/dd.c (input_seek_errno): Declare file-scoped variable as static.
3477
3478 2004-06-20  Paul Eggert  <eggert@cs.ucla.edu>
3479
3480         * src/basename.c (main):
3481         Standardize on the diagnostics given when someone gives
3482         too few operands ("missing operand after `xxx'") or
3483         too many operands ("extra operand `xxx'").
3484         Include "quote.h" and/or "error.h" if it wasn't already being included.
3485         * src/chgrp.c (main): Likewise.
3486         * src/chmod.c (main): Likewise.
3487         * src/chown.c (main): Likewise.
3488         * src/chroot.c (main): Likewise.
3489         * src/comm.c (main): Likewise.
3490         * src/cp.c (do_copy): Likewise.
3491         * src/csplit.c (main): Likewise.
3492         * src/date.c (main): Likewise.
3493         * src/dircolors.c (main): Likewise.
3494         * src/dirname.c (main): Likewise.
3495         * src/du.c (main): Likewise.
3496         * src/expr.c (main): Likewise.
3497         * src/hostid.c (main): Likewise.
3498         * src/hostname.c (main): Likewise.
3499         * src/id.c (main): Likewise.
3500         * src/install.c (main): Likewise.
3501         * src/join.c (add_file_name, main): Likewise.
3502         * src/link.c (main): Likewise.
3503         * src/ln.c (main): Likewise.
3504         * src/logname.c (main): Likewise.
3505         * src/md5sum.c (main): Likewise.
3506         * src/mkdir.c (main): Likewise.
3507         * src/mkfifo.c (main): Likewise.
3508         * src/mknod.c (main): Likewise.
3509         * src/mv.c (main): Likewise.
3510         * src/nohup.c (main): Likewise.
3511         * src/od.c (main): Likewise.
3512         * src/pathchk.c (main): Likewise.
3513         * src/ptx.c (main): Likewise.
3514         * src/readlink.c (main): Likewise.
3515         * src/rm.c (main): Likewise.
3516         * src/rmdir.c (main): Likewise.
3517         * src/seq.c (main): Likewise.
3518         * src/setuidgid.c (main): Likewise.
3519         * src/shred.c (main): Likewise.
3520         * src/sleep.c (main): Likewise.
3521         * src/sort.c (main): Likewise.
3522         * src/split.c (main): Likewise.
3523         * src/stat.c (main): Likewise.
3524         * src/test.c (beyond, main): Likewise.
3525         * src/touch.c (main): Likewise.
3526         * src/tr.c (main): Likewise.
3527         * src/tsort.c (main): Likewise.
3528         * src/tty.c (main): Likewise.
3529         * src/uname.c (main): Likewise.
3530         * src/uniq.c (main): Likewise.
3531         * src/unlink.c (main): Likewise.
3532         * src/uptime.c (main): Likewise.
3533         * src/users.c (main): Likewise.
3534         * src/who.c (main): Likewise.
3535         * src/whoami.c (main): Likewise.
3536
3537         * tests/basename/basic: Adjust to new diagnostics.
3538         * tests/du/files0-from: Likewise.
3539         * tests/expr/basic: Likewise.
3540         * tests/mv/diag: Likewise.
3541         * tests/tsort/basic-1: Likewise.
3542
3543 2004-06-20  Jim Meyering  <jim@meyering.net>
3544
3545         * src/ln.c: Remove declaration of yesno.
3546         Instead, include yesno.h.
3547         * src/copy.c: Likewise.
3548
3549         * src/remove.c: Remove declaration of yesno.
3550         Instead, include yesno.h.
3551         (top_dir): Remove now-unnecessary cast of obstack_base.
3552         (pop_dir): Likewise.
3553         (full_filename_): Likewise.
3554
3555 2004-06-19  Paul Eggert  <eggert@cs.ucla.edu>
3556
3557         Don't dump core if ctime returns NULL; this is possible on
3558         hosts with 64-bit time_t and 32-bit int.
3559         * src/who.c: Include "inttostr.h".
3560         (time_string): If ctime fails, print the raw time as an integer
3561         instead of dumping core.
3562         * src/pinky.c: Likewise, as follows:
3563         Include "inttostr.h".
3564         (time_string): New function, copied from who.c.
3565         (print_entry): Use it.
3566
3567 2004-06-19  Paul Eggert  <eggert@cs.ucla.edu>
3568
3569         * src/who.c (print_line): Don't truncate user names at 8 bytes.
3570         Problem reported by Guido Leenders in:
3571         http://lists.gnu.org/archive/html/bug-coreutils/2004-06/msg00056.html
3572         * NEWS: document this.
3573
3574 2004-06-19  Jim Meyering  <jim@meyering.net>
3575
3576         * src/system.h (case_GETOPT_VERSION_CHAR): Switch back to
3577         using GNU_PACKAGE (from PACKAGE) once again.  This restores
3578         `GNU' to the parenthesized package name in --version output.
3579         Before, the first argument from AC_INIT, `GNU coreutils', would
3580         be propagated to the PACKAGE variable.  Now, `GNU ' is trimmed.
3581         Reported by Richard Stallman.
3582
3583 2004-06-17  Jim Meyering  <jim@meyering.net>
3584
3585         * src/tr.c (to_uchar): Rename function from `uchar'.  The latter
3586         would clash with a typedef in Tru64's <sys/types.h>.  From Albert Chin.
3587
3588 2004-06-15  Paul Eggert  <eggert@cs.ucla.edu>
3589
3590         * NEWS: Remove more special cases for POSIXLY_CORRECT when POSIX
3591         allows the GNU behavior.  "--" is now supported by chroot, hostid,
3592         hosname, pwd, sync, yes.
3593         * doc/coreutils.texi (yes invocation, false invocation,
3594         true invocation): Document this.
3595         * src/chroot.c (main): Handle "--".
3596         * src/hostid.c (main): Likewise.
3597         * src/hostname.c (main): Likewise.
3598         * src/pwd.c (main): Likewise.
3599         * src/sync.c (main): Likewise.
3600         * src/yes.c (main): Likewise.
3601         * src/true.c (main): Recognize --help and --version even if
3602         POSIXLY_CORRECT is set.
3603         * src/yes.c (main): Likewise.
3604
3605 2004-06-09  Paul Eggert  <eggert@cs.ucla.edu>
3606
3607         * NEWS: Remove special cases for POSIXLY_CORRECT when POSIX allows
3608         the GNU behavior.
3609         * doc/coreutils.texi (pr invocation, unlink invocation): Document this.
3610         * src/ls.c (decode_switches): Pay attention to TABSIZE even if
3611         POSIXLY_CORRECT is set.  POSIX reserves upper-case environment
3612         variables to the implementation, so it's OK for ls to depend on
3613         TABSIZE.
3614         * src/pr.c: Include "hard-locale.h".
3615         (main): When in a non-POSIX locale, ignore POSIXLY_CORRECT, since
3616         POSIX specifies the behavior only in the POSIX locale.
3617         * src/printf.c (print_esc): Support \x, \u, \U even if POSIXLY_CORRECT,
3618         since POSIX says the behavior is unspecified here.
3619         * src/tail.c (parse_obsolescent_option): Support multiple file operands
3620         even if POSIXLY_CORRECT, since POSIX does not require a diagnostic.
3621         * src/printf.c (main): Recognize --help, --version even if
3622         POSIXLY_CORRECT.  POSIX does not specify any options, but it
3623         does not prohibit options either, so "printf" is like "expr" here.
3624         * src/unlink.c (main): Likewise.
3625         * tests/misc/printf: Adjust to the new semantics for \x if
3626         POSIXLY_CORRECT.
3627
3628 2004-06-14  Jim Meyering  <jim@meyering.net>
3629
3630         * tests/misc/pwd: New test, for fix of 2004-04-19.
3631         * tests/misc/Makefile.am (TESTS): Add pwd.
3632         (BUILD_SRC_DIR): Define BUILD_SRC_DIR.
3633
3634         * src/copy.c: Remove declaration of euidaccess.
3635         Instead, include "euidaccess.h".
3636
3637 2004-06-13  Paul Eggert  <eggert@cs.ucla.edu>
3638
3639         * src/who.c (PIDSTR_DECL_AND_INIT): Don't assume pid_t fits in int.
3640         (UT_ID) [!HAVE_STRUCT_XTMP_UT_ID]: Remove bogus comment,
3641         as (sizeof "??") reliably returns 3.
3642         (print_line): Guard against idle and pid being too long
3643         (which is possible when printing headers).
3644         (print_user): Allocate enough bytes for idlestr.  Use IDLESTR_LEN.
3645         Avoid unnecessary cast of sizeof to int.
3646         (make_id_equals_comment): Do not assume that UT_ID returns
3647         a string; it might return a non-null-terminated array.
3648         Use strncat instead.  It's not very often where strncat is
3649         exactly what you want, but this is one of those rare cases.
3650
3651 2004-06-11  Paul Eggert  <eggert@cs.ucla.edu>
3652
3653         * src/who.c (list_entries_who): Don't output a trailing space.
3654
3655 2004-06-09  Jim Meyering  <jim@meyering.net>
3656
3657         * src/touch.c (usage): Improve wording in description of the
3658         --time=WORD option.  Reported by Dan Jacobson.
3659
3660         * src/chown-core.c (change_file_owner): Change names of parameters
3661         old_uid and old_gid to required_uid and required_gid respectively.
3662
3663         * src/chmod.c (mode_changed): Return false, not 0, now that the
3664         function returns `bool'.
3665
3666 2004-06-08  Paul Eggert  <eggert@cs.ucla.edu>
3667
3668         Adjust chmod and chown to be similar if -c or -v are given.  In
3669         particular, a no-op chown is no longer reported as a change; this
3670         reverts to previous behavior.  Also, fix both commands so that -v
3671         report failures even if the failure is not due to the chmod or
3672         chown syscalls.
3673
3674         * src/chmod.c (CH_NOT_APPLIED): New constant.
3675         (describe_change): Handle it.
3676         (process_file): Use it, if a symlink wasn't changed.
3677         (mode_changed): Return bool, not int.  Accept new argument
3678         NEW_MODE; all callers changed.  This lets us avoid statting the
3679         file unless the new mode has unusual bits.
3680         (process_file): Return -1 on error.  With -v, report all errors
3681         verbosely, not just some.
3682
3683         * src/chown-core.c (change_file_owner): Return -1 on error, not
3684         1 sometimes and -1 on others.  Our caller ORs together our results,
3685         and (-1 | 1) == 0 on ones-complement hosts.
3686         With -v report all errors verbosely, not just some.
3687         Fix bug when chopt->root_dev_ino && !chopt->affect_symlink_referent:
3688         file_stats wasn't set properly in that case.
3689
3690         * tests/chgrp/basic: Adjust to above changes.
3691
3692 2004-05-20  Paul Eggert  <eggert@cs.ucla.edu>
3693
3694         * tests/chgrp/basic: Test that chgrp -h does not fail on
3695         symlinks, even on hosts where that's not supported.
3696         Test that if -R is specified without -H or L, -h is assumed.
3697         Test that chown() is not optimized away.
3698
3699 2004-05-18  Paul Eggert  <eggert@cs.ucla.edu>
3700
3701         Several fixes to chgrp and chown for compatibility with POSIX and BSD:
3702
3703           Check for incompatible options.  When -R and --dereference are
3704           both used, then either -H or -L must also be used.  When -R and -h
3705           are both used, then -P must be in effect.
3706
3707           -H, -L, and -P have no effect unless -R is also specified.
3708           If -P and -R are both specified, -h is assumed.
3709
3710           Do not optimize away the chown() system call when the file's owner
3711           and group already have the desired value.  This optimization was
3712           incorrect, as it failed to updated the last-changed time and reset
3713           special permission bits, as POSIX requires.
3714
3715           Do not report an error if the owner or group of a
3716           recursively-encountered symbolic link cannot be updated because
3717           the file system does not support it.
3718
3719         * NEWS: Document the above.
3720
3721         * src/chgrp.c (main): Check for incompatible options.  -R --dereference
3722         requires either -H or -L, and -R -h requires -P.  If -H, specify
3723         FTS_PHYSICAL as well as FTS_COMFOLLOW; this is faster.  Make this
3724         file as much like chown.c as possible.
3725         * src/chown.c (main): Likewise.
3726
3727         * src/chown-core.c (change_file_owner): Use ent->fts_statp only if
3728         needed.  Chown a directory only after chowning its children; this
3729         avoids problems if the new directory ownership doesn't permit
3730         access to the children.  Dereference symlinks before doing
3731         ROOT_DEV_INO_CHECK, not after, so that we catch symlinks to /.
3732         Do not optimize away the chown() system call when the file's owner
3733         and group already have the desired value.  POSIX does not permit
3734         this optimization.  Rely on chown and lchown to do the right
3735         thing with symlinks and/or -1 arguments, now that we have wrappers
3736         to do this.  Use ENOTSUPP not ENOSYS, and ignore all ENOTSUPP
3737         errors, not just command-line errors.
3738         (chown_files): Pass FTS_NOSTAT to xfts_open if we don't need file status.
3739
3740         * src/system.h (ENOTSUP): Remove.
3741
3742         * tests/chgrp/basic: Use chown --from to discover whether the
3743         group changed, since chgrp now changes unconditionally.  This
3744         complicates the sed script a bit.  Do not specify --dereference,
3745         since it's the default (and we want to test this).  Adjust output
3746         to match the fact that chgrp no longer optimizes the case of
3747         changing a file's group to the same value as before.
3748         * tests/chgrp/posix-H: Do not attempt to combine -h and -H; these
3749         options are incompatible, and their behavior is undefined with POSIX.
3750         (changed, not_changed): Adjust to match the fact that -h is no longer
3751         specified.  Sort names.
3752         * tests/chown/deref: Adjust error-diagnostic spelling to match new
3753         behavior.
3754
3755 2004-06-07  Paul Eggert  <eggert@cs.ucla.edu>
3756
3757         * src/uname.c (main): Fix typo introduced on 2003-05-10 that
3758         prevented a diagnostic of any operands.
3759
3760 2004-06-08  Jim Meyering  <jim@meyering.net>
3761
3762         * src/shred.c (direct_mode): Turn it on/off with directio, too.
3763
3764 2004-06-07  Jim Meyering  <jim@meyering.net>
3765
3766         Enable direct-mode I/O (bypassing the buffer cache), if possible.
3767         Prompted by a suggestion from Kalle Olavi Niemitalo
3768         in http://bugs.debian.org/207035.
3769         * src/shred.c (direct_mode): New function.
3770         (do_wipefd): Turn on direct-mode I/O.
3771         (dopass): If a file's first write fails with EINVAL,
3772         turn off direct-mode I/O and retry the write.
3773
3774 2004-06-05  Paul Eggert  <eggert@cs.ucla.edu>
3775
3776         * src/tr.c (main): "tr -d a b" is now a fatal error even if
3777         POSIXLY_CORRECT is set.  The POSIX SYNOPSIS does not allow this
3778         option combination.
3779
3780 2004-06-04  Paul Eggert  <eggert@cs.ucla.edu>
3781
3782         * src/shred.c (dopass): Don't subtract 1 from the offset after
3783         a write error.  Problem reported by Jon Peatfield in:
3784         http://lists.gnu.org/archive/html/bug-coreutils/2004-06/msg00020.html
3785
3786 2004-06-02  Paul Eggert  <eggert@cs.ucla.edu>
3787
3788         Fix bug reported by Buciuman Adrian in
3789         <http://mail.gnu.org/archive/html/bug-coreutils/2003-08/msg00105.html>
3790         where 'dd' created a file that was too large.  The bug was that dd
3791         assumed that the input file offset does not advance after a failed
3792         read; but POSIX says that the input file offset is undefined after
3793         a failed read.
3794
3795         * src/dd.c (MAX_BLOCKSIZE): New macro.
3796         (input_seekable, input_seek_errno, input_offset,
3797         input_offset_overflow): New vars.
3798         (scanargs): Reject block sizes greater than MAX_BLOCKSIZE.
3799         (advance_input_offset): New function.
3800         (skip_via_lseek): Set errno to zero when reporting our failure,
3801         so that we don't report based on garbage errno.
3802         (skip): If fdesc is standard input, advance the input offset.
3803         Do not quit if reading, and if noerror was specified;
3804         POSIX seems to require this.
3805         If read fails on output file, report the earlier lseek failure
3806         instead; this fixes a FIXME in dd_copy.
3807         (advance_input_after_read_error): New function.
3808         (dd_copy): Use it, instead of assuming that failed reads
3809         do not advance the file pointer.  Advance input offset
3810         after nonfailed reads.  Advance only a partial block if
3811         the previous read (before the failed read) succeeded, and
3812         do not generate an output block of zeros in this case.
3813         (main): Determine initial input offset, seekability of input,
3814         and error if it wasn't seekable.
3815
3816 2004-06-02  Jim Meyering  <jim@meyering.net>
3817
3818         rm (without -f) could hang unnecessarily when attempting to
3819         remove a symlink to a file on an off-line NFS-mounted partition.
3820         Reported by David Howells in https://bugzilla.redhat.com/124699.
3821         * src/remove.c (write_protected_non_symlink): New function.
3822         Don't invoke euidaccess on symlinks.
3823         (prompt): Use write_protected_non_symlink rather than using
3824         euidaccess directly, being careful not to call lstat twice for a file.
3825
3826         Fix a bug in how the --output-delimiter=D option works with
3827         abutting byte or character ranges.  Reported by David Krider in
3828         http://lists.gnu.org/archive/html/bug-coreutils/2004-05/msg00132.html
3829         * src/cut.c (print_kth): Remove special case for open-ended range.
3830         (set_fields): Record the range start index for an interval even
3831         when it abuts another interval on its low side.
3832         Also record the range start index of the longest right-open-interval.
3833         * tests/cut/Test.pm: Add tests of --output-delimiter=S with
3834         abutting and overlapping byte ranges.
3835
3836 2004-06-01  Paul Eggert  <eggert@cs.ucla.edu>
3837
3838         Some POSIX-conformance cleanups for tr.
3839
3840         * src/tr.c (posix_pedantic): Remove; no longer needed since
3841         we need to test this in just one place now.
3842         (usage): Mention -C.
3843         (unquote): Note that \055, \n, etc are escaped.
3844         Do not worry about POSIXLY_CORRECT when warning about ambiguous
3845         escape sequences.
3846         \ at end of string stands for itself.
3847         Do not diagnose invalid backslash escapes: POSIX says the behavior
3848         is unspecified in this case, so we don't need to diagnose it.
3849         (main): Add support for -C (currently an alias for -c).
3850         Do not diagnose 'tr [:upper:] [:upper:], as POSIX does not require
3851         a diagnostic here.
3852         * tests/tr/Test.pm: New tests bs-055, bs-at-end, repeat-Compl.
3853         Fix comment for range-a-a.
3854
3855 2004-05-25  Paul Eggert  <eggert@cs.ucla.edu>
3856
3857         Improve the efficiency (and in one case, correctness) of code
3858         that reads symlinks.
3859
3860         * src/copy.c (copy_internal): Don't use alloca, as it can mess up
3861         royally if the link length is long (e.g., GNU/Hurd).  Use
3862         xreadlink instead, it's safer.  Don't bother to read the link if
3863         it's the wrong size.  Add a FIXME because this area is a bit murky
3864         and undocumented.
3865         * src/ls.c (get_link_name): Update use of xreadlink.
3866         * src/readlink.c (main): Likewise.
3867         * src/stat.c (print_stat): Likewise.
3868
3869 2004-06-01  Jim Meyering  <jim@meyering.net>
3870
3871         * src/env.c (main): Prefer the notation `STREQ (a, b)'
3872         over `!strcmp (a, b)'.
3873         * src/sort.c (main, sort_buffer_size): Prefer the notation
3874         `STREQ (a, b)' over `strcmp (a, b) == 0'.
3875         * src/date.c (batch_convert): Likewise.
3876         * src/expr.c (nextarg): Likewise.
3877         * src/su.c (correct_password, restricted_shell, main): Likewise.
3878         * src/ptx.c (swallow_file_in_memory, main): Likewise.
3879         * src/test.c (binary_operator, and, or, main): Likewise.
3880
3881 2004-05-13  Paul Eggert  <eggert@cs.ucla.edu>
3882
3883         * NEWS: echo compatibility cleanup.
3884         * doc/coreutils.texi (echo invocation): Document the changes.
3885         * src/echo.c (V9_ECHO): Remove; always enabled.
3886         (DEFAULT_ECHO_TO_XPG): Renamed from V9_DEFAULT, so that
3887         we use the same naming convention as bash.  Now an enum,
3888         not a macro.
3889         (usage): Reword to mention -e/-E more accurately.
3890         Mention \0NNN (the POSIX syntax) rather than \NNN (nonstandard).
3891         (hextobin): New function.
3892         (main): Use bool rather than int for local vars when appropriate.
3893         Do not allow options if POSIXLY_CORRECT, unless we are using
3894         BSD semantics and the first argument is "-n".
3895         Don't pass unnecessary extra arg to parse_long_options.
3896         do_v9 now defaults to DEFAULT_ECHO_TO_XPG, not to allow_options.
3897         Do not look for options if !allow_options.
3898         Use size_t rather than int when appropriate.
3899         Open-code option test rather than using strrchr.
3900         Use faster test for "-".
3901         Avoid redundant argc test.
3902         Add support for \x, for Bash compatibility.
3903         Use e.g. '\a' rather than '\007', for portability to EBCDIC hosts.
3904         When '\c' is encountered, stop printing immediately, as POSIX
3905         requires.
3906         Add support for \xhh syntax.
3907         Add support for \0ooo syntax; POSIX requires this.
3908
3909 2004-06-01  Jim Meyering  <jim@meyering.net>
3910
3911         * Use automake-1.8b.  Regenerate dependent files.
3912
3913 2004-05-31  Jim Meyering  <jim@meyering.net>
3914
3915         * tests/Makefile.am.in (TESTS_ENVIRONMENT): Define PATH to include
3916         the build src/ directory -- at the front.
3917         ($(srcdir)/$x-tests): Depend on Makefile.am.
3918         Use $x as the program name, except when it would be `test' (test is
3919         the sole program tested via mk-script that is also a shell built-in).
3920         In that case, use the old ../../src/$x.
3921
3922 2004-05-30  Jim Meyering  <jim@meyering.net>
3923
3924         Work around HPUX /bin/cc compiler bug that is exposed, now that
3925         sets are arrays of type `bool'.  More details here:
3926         http://lists.gnu.org/archive/html/bug-gnulib/2004-05/msg00094.html
3927         FIXME: verify that the above URL points to the right message
3928
3929         * src/tr.c (card_of_complement): Use cleaner `sizeof in_set'
3930         rather than `N_CHARS * sizeof(in_set[0])'.  Using HPUX's /bin/cc
3931         (aC++/ANSI C B3910B A.05.55 [Dec 04 2003]) on an ia64-hp-hpux11.22
3932         system, those two expressions are not the same (256 vs. 1024).
3933         The effect of this problem was that `tr -c x y' would fail:
3934         tr: when not truncating set1, string2 must be non-empty
3935         (set_initialize): Remove unnecessary initialization of the `in_set'
3936         buffer; that initialization triggered the same compiler bug as above.
3937
3938 2004-05-29  Paul Eggert  <eggert@cs.ucla.edu>
3939
3940         tr cleanup, mostly having to do with integer type ranges.
3941         Remove all casts.
3942
3943         * tests/tr/Test.pm: Add a few tests for the below.  Alas, most of
3944         the test cases wouldn't be portable, or would take too much CPU
3945         time, or both.
3946
3947         * src/tr.c (N_CHARS, N_CHAR_CLASSES): Now an enum, not a macro.
3948         This is safe since the code already assumes N_CHARS fits in int.
3949         (Filter): Remove: we want to prototype everything.
3950         (ORD, CHR): Remove.  All uses removed.  Some replaced with:
3951         (uchar): New function.  All places where a char must be converted
3952         to an unsigned char are now done this way, not by ad-hoc methods.
3953         (count): New type.  Use it whenever counts or states are needed.
3954         (BEGIN_STATE): Increase from INT_MAX - 1 (which was bogus, anyway,
3955         since we used it in an unsigned int context) to UINTMAX_MAX - 1.
3956         (REPEAT_COUNT_MAXIMUM): New macro.  Use it in place of BEGIN_STATE
3957         whenever appropriate.
3958         (NOT_A_CHAR): Remove global macro; now a local enum.
3959         (UL_LOWER, UL_UPPER, UL_NONE): No longer specify values, since
3960         the rest of the code no longer depends on them.
3961         (class_ok): Remove; all uses changed to use inline comparisons.
3962         (RE_NO_TYPE): Remove; wasn't used or needed.
3963         (struct List_element): normal_char and equiv_code are now unsigned
3964         char, not int.
3965         first_char, last_char, and the_repeated_char are now unsigned char,
3966         not unsigned int.  repeat_count is now count, not size_t.
3967         All uses changed.
3968         (struct Spec_list): state is now count, not unsigned int.
3969         lengthis now count, not size_t.
3970         n_indefinite_repeats is now size_t, not int.
3971         has_equiv_class, has_char_class, and has_restricted_char_class
3972         are now bool, not int.  All uses changed.
3973         (struct E_string): s is now char *, not unsigned char *.
3974         escaped is now bool *, not int *.  All uses changed.
3975         (ES_MATCH): Remove macro, replacing with:
3976         (es_match): New inline function.  All uses changed.
3977         (squeeze_repeats, complement, posix_pedantic, truncate_set1,
3978         translating): Now bool, not int.
3979         (io_buf): Now char array, not unsigned char.
3980         (SET_TYPE): Remove.  All uses replaced with bool.
3981         (is_equiv_class_member, unquote, append_range, append_char_class,
3982         append_equiv_class, find_closing_delim, star_digits_closebracket,
3983         build_spec_list, parse_str, homogeneous_spec_list):
3984         Now returns bool, not int.  All uses changed.
3985         (is_equiv_class_member): Now inline.
3986         (is_equiv_class_member, is_char_class_member, make_printable_str,
3987         append_normal_char, append_range, append_repeated_char,
3988         get_s2_spec_stats):
3989         Args are now of proper integer type.
3990         (unquote, look_up_char_class, make_printable_str,
3991         append_equiv_class, build_spec_list, squeeze_filter):
3992         Avoid unsigned char *p; gently convert *p to unsigned char instead.
3993         (unquote, get_spec_stats): Do not jump past declarations and then
3994         use them; C doesn't allow this in portable programs.
3995         (make_printable_str): Check for overflow in size calculations.
3996         (xmemdup): Remove.  All uses rewritten.
3997         (find_bracketed_repeat): Args are now of proper pointer-to-integer
3998         type.  Do not reject [c*0].  Use xstrtoumax, not xstrtoul.
3999         (find_bracketed_repeat, star_digits_closebracket): Check that the
4000         digits are not escaped.
4001         (build_spec_list): Don't bother to copy opnd_str; not needed.
4002         (build_spec_list, get_next): Simplify internal logic a bit.
4003         (card_of_complement): Fix bug due to char overflow.
4004         (get_spec_stats): Don't assume len fits into int.
4005         Check for integer overflow.  Use abort() rather than assert(0).
4006         (string2_extend): Fix subscript error: is_char_class_member (..., 255)
4007         was being invoked.
4008         (squeeze_filter): READER is never null now; simplify code.
4009         READER arg now has a simpler type.  Remove unnecessary casts.
4010         (squeeze_filter, main): Calls to fwrite improperly checked result
4011         against zero, rather than against requested size.
4012         (plain_read): New function.
4013         (read_and_delete, read_and_xlate):
4014         Remove unused filter arg, and don't worry about hit_eof.
4015         Simplify by using plain_read.
4016         (set_initialize): Args are bool and bool *, not int and SET_TYPE *.
4017         (main): Always pass a non-null procedure to squeeze_filter.
4018         Rewrite so that class_ok isn't needed.
4019
4020 2004-05-29  Paul Eggert  <eggert@cs.ucla.edu>
4021
4022         * src/shred.c (dosync): Ignore EBADF errors, as IRIX 6.5
4023         fdatasync reports EBADF when syncing (unwritable) directories.
4024         Problem reported by Albert Chin-A-Young in:
4025         http://lists.gnu.org/archive/html/bug-coreutils/2004-05/msg00165.html
4026
4027 2004-05-29  Jim Meyering  <jim@meyering.net>
4028
4029         * tests/chown/deref: Fix typo: use ls -ldo, not ls -ldg.
4030         Patch from Albert Chin.
4031
4032         * src/ptx.c (text_buffer_maxend): Remove declaration of unused variable.
4033
4034         * src/remove.c (push_dir): Merge declaration and adjacent assignment
4035         into a single statement.
4036
4037 2004-05-28  Jim Meyering  <jim@meyering.net>
4038
4039         * src/remove.c (AD_mark_helper): Eliminate an unnecessary comparison.
4040
4041 2004-05-22  Jim Meyering  <jim@meyering.net>
4042
4043         rm -r would get a failed assertion when run from an inaccessible
4044         directory and with two or more command line arguments including an
4045         absolute-named directory followed by a relative-named directory.
4046
4047         * src/remove.h (struct rm_options) [require_restore_cwd]: New member.
4048         * src/remove.c (struct cwd_state): Define.
4049         (AD_pop_and_chdir): Redesign interface so that a restore_cwd failure
4050         can be detected by the caller.  Instead of returning a malloc'd
4051         directory name, communicate it to caller via a new parameter, and
4052         return an indication of whether restore_cwd failed.  Update caller.
4053         Eliminate an unnecessary call to AC_stack_top.
4054         (remove_dir): Change type of cwd_state parameter to `struct cwd_state'
4055         so we can now communicate to caller whether/how functions like
4056         restore_cwd have failed.  Update caller.
4057         (rm_1): Fail if we've failed to restore the working directory
4058         and the name of the next file to remove is `.'-relative.
4059         (rm): Fail if the require_restore_cwd flag is true and we've
4060         failed to restore the working directory.
4061         * src/mv.c (rm_option_init): Initialize new member,
4062         x->require_restore_cwd.
4063         * src/rm.c (rm_option_init): Likewise.
4064
4065 2004-05-21  Jim Meyering  <jim@meyering.net>
4066
4067         * tests/rm/inaccessible: New test for the above fix.
4068         * tests/rm/Makefile.am (TESTS): Add inaccessible.
4069
4070         * src/remove.c (rm): Use free rather than XFREE.
4071         (remove_dir): Use xmalloc, not XMALLOC.
4072         (ds_init): Likewise.
4073
4074 2004-05-20  Jim Meyering  <jim@meyering.net>
4075
4076         * Makefile.maint (sc_unmarked_diagnostics): Now that the unmarked
4077         diagnostics in shred.c have been fixed, don't exempt shred.c from
4078         this check.
4079
4080         * src/shred.c: Use translatable diagnostics, e.g.
4081         change "%s: remove" to _("%s: failed to remove") and
4082         change "%s: close"  to _("%s: failed to close").
4083
4084 2004-05-17  Paul Eggert  <eggert@cs.ucla.edu>
4085
4086         * src/shred.c (names): Bring back lower-case letters, "_", and
4087         ".".  But continue to omit +, =, %, @, #, as they're either
4088         shell metacharacters (for some shells) or are not in some
4089         character sets, or (in the case of '%') must be a
4090         metacharacter somewhere.
4091
4092 2004-05-16  Paul Eggert  <eggert@cs.ucla.edu>
4093
4094         * src/cut.c (cut_fields): Adjust to new signature of getndelim2.
4095
4096 2004-05-17  Jim Meyering  <jim@meyering.net>
4097
4098         * src/shred.c (incname): Decrement `len' only once per loop iteration.
4099
4100         chgrp and chown now dereference symlinks by default, per POSIX.
4101         Reported by Michal Politowski as http://bugs.debian.org/249177.
4102
4103         * src/chown-core.c (chopt_init): Affect each symlink referent by default.
4104         * src/chown.c (usage): Update to reflect this.
4105         * src/chgrp.c (usage): Likewise.
4106         * NEWS: Describe the change.
4107         Adapt tests accordingly.
4108         * tests/chgrp/basic: Use -h where necessary to retain semantics.
4109         * tests/chgrp/deref: Likewise.
4110         * tests/chgrp/posix-H: Likewise.
4111
4112 2004-05-15  Paul Eggert  <eggert@cs.ucla.edu>
4113
4114         In shred, check for errors from fdatasync more carefully.  If
4115         fdatasync fails with errno==EINVAL, it means this implementation
4116         does not support synchronized I/O for this file.  Do not report
4117         this as an error, as (for example) AIX 5.2 fdatasync reports it
4118         for raw disk devices.  Problem reported by Albert Chin in
4119         <http://mail.gnu.org/archive/html/bug-gnu-utils/2004-05/msg00028.html>.
4120
4121         Check for write errors, though: the old code ignored them.
4122         Improve error checking in a few other cases, too (e.g., close of a
4123         directory).
4124
4125         Also, change several 'int' values to 'bool', so that the error
4126         checking is a bit clearer.  Similarly, change unsigned values
4127         to size_t where appropriate.
4128
4129         * src/shred.c: Include "dirname.h".
4130         (datasync) [!HAVE_FDATASYNC]: Remove.
4131         (dosync): New function.
4132         (dopass): Use it.  Return 1 on write error, -1 on other error.
4133         All callers changed.  Report write error if dosync does.
4134         (do_wipefd, wipefd, wipename, wipefile): Return bool (true/false),
4135         not int (0/-1).  All callers changed.  Return false if there's a
4136         write error.
4137         (incname): Return bool (true/false), not int (0/1).  Accept
4138         size_t length, not unsigned.  All callers changed.  Do not
4139         bother checking for non-digits; it can't happen.  Replace
4140         recursion with iteration.
4141         (wipename): Use dir_name, base_name, etc. instead of assuming
4142         Unix file names.  Use size_t for length, not unsigned.
4143         Report error if unlink or close fails.
4144         (wipename, main): Use bool for booleans.
4145
4146         (names): Use only digits and uppercase letters, for greater
4147         portability.
4148
4149 2004-05-16  Jim Meyering  <jim@meyering.net>
4150
4151         * tests/chown/deref: New test for the yesterday's change.
4152         * tests/chown/Makefile.am (TESTS): Add deref.
4153
4154 2004-05-15  Jim Meyering  <jim@meyering.net>
4155
4156         chown --dereference did nothing when the owner/group of a
4157         symlink matched the desired owner/group.  Reported by David Malone.
4158         Also reported in 1999 as http://bugs.debian.org/39642.
4159
4160         * src/chown-core.c (change_file_owner): When --dereference has
4161         been specified, and when processing a symlink, stat it to get the
4162         owner and group of the referent.
4163
4164 2004-05-14  Jim Meyering  <jim@meyering.net>
4165
4166         * man/pwd.x, man/echo.x, man/printf.x: Fix typo:
4167         s/supercede/supersede/ reported by Andrew Fabbro.
4168
4169 2004-05-13  Paul Eggert  <eggert@cs.ucla.edu>
4170
4171         Improve performance of `sort -m' on large files, at the cost of
4172         making some contrived examples unsafe.  POSIX allows this
4173         optimization.  Performance problem reported by Jonathan Baker in
4174         <http://mail.gnu.org/archive/html/bug-coreutils/2004-05/msg00071.html>.
4175
4176         * src/sort.c (first_same_file): Do not treat input pipes
4177         differently from other files.
4178         * doc/coreutils.texi (sort invocation): Document that "sort -m -o F"
4179         might write F before reading all the input.
4180         * NEWS: Likewise.
4181
4182 2004-05-12  Paul Eggert  <eggert@cs.ucla.edu>
4183
4184         * src/od.c (print_ascii, dump_strings): Use e.g. '\a' rather than
4185         '\007', for portability to EBCDIC hosts.
4186         * src/printf.c (print_esc_char): Likewise.
4187         * src/tr.c (unquote, make_printable_str): Likewise.
4188
4189 2004-05-12  Jim Meyering  <jim@meyering.net>
4190
4191         * src/remove.c (AD_pop_and_chdir): Move lstat-`.' into if-block
4192         where the result is used.  This avoids one unnecessary lstat call
4193         per command line argument.
4194
4195 2004-05-12  Paul Eggert  <eggert@cs.ucla.edu>
4196
4197         Don't assume that "make -C" works; Solaris "make" doesn't have -C.
4198
4199         * src/Makefile.am (all_programs.list): New rule, copied from
4200         man/Makefile.am and tests/Makefile.am, except that we use the
4201         system tr rather than ./tr and we don't use tr -s.
4202         * tests/Makefile.am (all_programs): Use it.
4203         * man/Makefile.am (all_programs): Likewise.  Renamed from programs,
4204         for consistency.  All uses changed.
4205
4206 2004-05-11  Jim Meyering  <jim@meyering.net>
4207
4208         * tests/rm/unread3: New test, for the above fix and today's
4209         lib/save-cwd.c improvement.
4210         * tests/rm/Makefile.am (TESTS): Add unread3.
4211
4212         * src/rm.c: Don't include "save-cwd.h".  It's no longer used.
4213
4214 2004-05-10  Jim Meyering  <jim@meyering.net>
4215
4216         * tests/install/trap: New file.  Test for bug fix of 2004-04-18.
4217         * tests/install/Makefile.am (TESTS): Add trap.
4218
4219         * src/remove.c (AD_push): Don't use errno in diagnostic about
4220         `changed dev/ino'.
4221
4222         Remove these generated files from CVS.
4223         * tests/cut/cut-tests, tests/date/date-tests, tests/join/join-tests:
4224         * tests/ls/ls-tests, tests/pr/pr-tests, tests/tac/tac-tests:
4225         * tests/tail/tail-tests, tests/test/test-tests, tests/tr/range-tests:
4226         * tests/tr/tr-tests, tests/wc/wc-tests:
4227
4228 2004-05-09  Jim Meyering  <jim@meyering.net>
4229
4230         * src/tr.c (unquote): Use xcalloc rather than xmalloc and
4231         a loop initializing the just-allocated memory to zero.
4232
4233 2004-05-08  Jim Meyering  <jim@meyering.net>
4234
4235         * tests/rm/no-give-up: New file; check for today's fix.
4236         * tests/rm/Makefile.am (TESTS): Add no-give-up.
4237
4238 2004-05-08  Paul Eggert  <eggert@cs.ucla.edu>
4239
4240         Fix bug where "rm" gave up too easily, reported by Dan Jacobsen in
4241         <http://mail.gnu.org/archive/html/bug-coreutils/2004-05/msg00013.html>.
4242
4243         * src/remove.c (remove_entry): Check for errno values like ENOENT
4244         that show the file cannot be directory, instead of for errno
4245         values like EPERM that show the file might be a directory.  This
4246         is necessary because, when a single unlink() call has multiple
4247         reasons to fail, it can set errno to any of those reasons; it's
4248         only the rare errno value like ENOENT that excludes all the other
4249         possible reasons to fail even when the file is a directory.
4250         (remove_cwd_entries): Don't attempt chdir if the file is known
4251         to not be a directory.
4252         (remove_dir): Use the same method that remove_cwd_entries uses
4253         (for some reason they differed).  Don't assert that saved_errno
4254         must be EPERM; it might be just about anything.
4255
4256 2004-05-06  Jim Meyering  <jim@meyering.net>
4257
4258         * src/id.c (xgetgroups): Use xnmalloc, rather than xmalloc.
4259         Don't add `1' to the buffer size (it was to protect against malloc
4260         implementations that fail to allocate a buffer of size zero).
4261         That is no longer necessary, since we use a malloc wrapper
4262         on such systems.
4263
4264         * src/wc.c (get_input_fstatus): Use xnmalloc, rather than xmalloc.
4265         * src/head.c (elide_tail_bytes_pipe): Likewise.
4266         * src/df.c (main): Likewise.
4267         * src/shred.c (do_wipefd): Likewise.
4268         * src/users.c (list_entries_users): Likewise.
4269         * src/tail.c (main): Likewise.
4270         * src/md5sum.c (main): Likewise.
4271
4272 2004-04-29  Paul Eggert  <eggert@cs.ucla.edu>
4273
4274         * src/df.c (show_disk, show_point): If several filesystems are
4275         mounted on the same mount point, prefer the last one, not the first.
4276         Problem reported by Christian Jones in
4277         <http://mail.gnu.org/archive/html/bug-coreutils/2004-04/msg00200.html>.
4278         (show_disk): Remove unused statp arg.  Return bool, not int.
4279         (show_point): Rewrite to avoid gotos.  Use the same algorithm
4280         for lofs and dummies for each pass through the mount table,
4281         rather than subtly different algorithms (which are probably
4282         inadvertent).
4283
4284 2004-05-03  Jim Meyering  <jim@meyering.net>
4285
4286         * Makefile.am (EXTRA_DIST): Add m4/ChangeLog, now that we no longer
4287         have m4/Makefile*.
4288
4289 2004-05-01  Jim Meyering  <jim@meyering.net>
4290
4291         When chown or chgrp is modifying the referent of a symlink,
4292         use the chown(2) function, if possible.
4293         * src/chown-core.c (change_file_owner): Don't hard-code the
4294         open/fchown/close kludge here.  Use `chown' instead.
4295         The chown function works just fine on conforming systems.
4296         Other systems now go through the new chown wrapper that
4297         resorts to the old kludge.
4298
4299         * src/chown-core.c (change_file_owner): Add a comment.
4300
4301 2004-04-27  Jim Meyering  <jim@meyering.net>
4302
4303         * src/ptx.c: Make over 40 global extern variables `static'.
4304         (syntax_table, re_syntax_table): Remove declarations of two unused
4305         variables (they were exposed by the above change).
4306
4307         * src/du.c (G_fail, opt_nul_terminate_output): Declare `static'.
4308         * src/ln.c (backup_type): Likewise.
4309
4310         * src/remove.c (rm): Add `extern' keyword.
4311         * src/cp-hash.c (forget_created, remember_created)
4312         (src_to_dest_lookup, remember_copied, hash_init, forget_all): Likewise.
4313         * src/copy.c (dest_info_init, src_info_init, copy): Likewise.
4314         * src/chown-core.c (chopt_init, chopt_free, gid_to_name)
4315         (uid_to_name, chown_files): Likewise.
4316
4317         * src/Makefile.am (sc_tight_scope): New rule.
4318         * Makefile.maint (sc_tight_scope): New rule.
4319         (syntax-check-rules): Add it.
4320
4321 2004-04-26  Jim Meyering  <jim@meyering.net>
4322
4323         * Use automake-1.8.4.  Regenerate dependent files.
4324
4325         * src/sort.c (limfield): Make a comment clearer.
4326
4327 2004-04-25  Paul Eggert  <eggert@twinsun.com>
4328
4329         Fix POSIX-conformance bug: "sort -k 3,3.5b" is supposed to skip
4330         leading blanks when computing the location of the field end;
4331         it is not supposed to skip trailing blanks.  Solaris 8 "sort"
4332         does conform to POSIX.  Also fix the documentation to clarify
4333         this and related issues.
4334
4335         * doc/coreutils.texi (sort invocation): Mention -k earlier, so
4336         that the options are in alphabetical order.  Describe how -b works
4337         more-accurately; this involves fixing some examples, too.  Mention
4338         what happens if the start field falls after an end field or after
4339         a line end.  Warn about using -k without -b, -g, -M, -n, or -t.
4340         Add an example of how to sort IPv4 addresses and Apache Common
4341         Log Format dates.  Remove a duplicate example.
4342         (Putting the tools together): Use separate options rather
4343         than agglomerating them.
4344         * src/sort.c (limfield): Use skipeblanks, not skipsblanks, to
4345         decode whether to skip leading blanks.
4346         (trailing_blanks): Remove.
4347         (fillbuf, getmonth, keycompare): Don't trim trailing blanks.
4348
4349         * tests/pr/Test.pm: Fix typo in env_default comment.
4350         * tests/sort/Test.pm: Likewise.
4351         (18c, 18d): Reverse the order of output lines, so that the
4352         test cases conform to POSIX.
4353
4354 2004-04-22  Paul Eggert  <eggert@twinsun.com>
4355
4356         More signal-handling cleanup for ls.c.  Do not allow signals to
4357         happen between arbitrary output bytes, as the
4358         restore-default-color sequence can bollix up multibyte chars or
4359         color-change sequences in the ordinary output.  Instead, process
4360         signals only between printing a file name and changing the color
4361         back to non_filename_text color.  That way, if the signal handler
4362         changes the color (to the default), 'ls' will change it back when
4363         'ls' continues (after being suspended).
4364
4365         Also, do not bother with signal-handling unless stdout is a
4366         controlling terminal; this lets stdio buffer better when "ls
4367         --color" is piped or sent to a file.
4368
4369         * src/ls.c (sigprocmask, sigset_t) [!defined SA_NOCLDSTOP]: New macros.
4370         Do not include "full-write.h"; no longer needed.
4371         (tcgetpgrp) [! HAVE_TCGETPGRP]: New macro.
4372         (put_indicator_direct): Remove.  All callers changed to use
4373         put_indicator.
4374         (caught_signals, interrupt_signal, stop_signal_count): New vars.
4375         (restore_default_color): Don't bother checking for put_indicator
4376         failure.
4377         (sighandler): Don't handle SIGTSTP; that's another handler now.
4378         Simply set interrupt_signal to the signal, then exit.
4379         (stophandler, process_signals): New functions.
4380         (main): Don't output any color changes until _after_ the signal
4381         handlers are set up.  This fixes a race condition where 'ls'
4382         could be interrupted while initializing colors, and leaving the
4383         terminal in an undesirable state.
4384         Don't mess with signal-handling if standard output is not a
4385         controlling terminal.
4386         When exiting, restore the default color, then restore the
4387         default signal handling, then act on any signals that weren't
4388         acted on yet.
4389         Do not print //DIRED// etc. in colors; this avoids the need
4390         to catch signals when printing them.
4391         (print_name_with_quoting): Process signals just before switching
4392         color back to non_filename_text.
4393
4394 2004-04-23  Jim Meyering  <jim@meyering.net>
4395
4396         Avoid segfault on systems for which SIZE_MAX != (size_t) -1.
4397         * src/ls.c (quote_name): Use SIZE_MAX, not -1, in calls
4398         of quotearg_buffer.  Patch by Mikulas Patocka.
4399
4400 2004-04-18  Paul Eggert  <eggert@twinsun.com>
4401
4402         tee ignored SIGPIPE, but POSIX doesn't allow this.
4403
4404         * src/tee.c (main): Do not ignore SIGPIPE, as POSIX 1003.1-2001
4405         does not allow this.  This undoes the 1996-10-24 patch.
4406
4407 2004-04-18  Paul Eggert  <eggert@twinsun.com>
4408
4409         Signal-handling cleanup for coreutils.  Here are the highlights:
4410
4411          - csplit sometimes failed to remove files when interrupted.
4412          - csplit didn't clean up if two signals arrived nearly simultaneously.
4413          - install -s would infloop on System V if SIGCHLD was ignored.
4414          - ls could incorrectly restore color if multiple signals
4415            arrived nearly simultaneously.
4416
4417         * src/csplit.c (sigprocmask, sigset_t) [!defined SA_NOCLDSTOP]:
4418         Define.
4419         (filename_space, prefix, suffix, digits, files_created, remove_files):
4420         Now volatile.
4421         (caught_signals): New var.
4422         (cleanup): Block signals while deleting all files.
4423         (cleanup_fatal, handle_line_error, regexp_error):
4424         Mark with ATTRIBUTE_NORETURN.
4425         (create_output_file, close_output_file, interrupt_handler):
4426         Block signals while changing the number of output files,
4427         to fix some race conditions.
4428         (delete_all_files): Do nothing if remove_files is zero.
4429         Clear files_created.
4430         (main): Don't mess with signals until after argument processing
4431         is done.
4432
4433         * src/csplit.c (main): Rewrite signal-catching code to make it
4434         similar to other coreutils programs.  When processing signals,
4435         block all signals that we catch, but do not block signals that we
4436         don't catch.  Avoid problems with unsigned int warnings.
4437         * src/ls.c (main): Likewise.
4438         * src/sort.c (main): Likewise.
4439
4440         * src/csplit.c (interrupt_handler):
4441         Use void, not (obsolete) RETSIGTYPE.
4442         * src/shred.c (sigill_handler, isaac_seed_machdep): Likewise.
4443
4444         * src/csplit.c (interrupt_handler) [defined SA_NOCLDSTOP]:
4445         Use simpler "signal (sig, SIG_DFL)" rather than sigaction equivalent.
4446         * src/ls.c (sighandler) [defined SA_NOCLDSTOP]: Likewise.
4447         * src/sort.c (sighandler) [defined SA_NOCLDSTOP]: Likewise.
4448         * src/nohup.c (main) [!defined _POSIX_SOURCE]: Likewise, except
4449         for SIG_IGN.
4450         * src/tee.c (main) [!defined _POSIX_SOURCE]: Likewise.
4451
4452         * src/install.c: Include <signal.h>.
4453         (main) [defined SIGCHLD]: Set SIGCHLD handler to the default, if -s is
4454         given, since System V fork+wait does not work if SIGCHLD is ignored.
4455
4456         * src/ls.c (sighandler) [!defined SA_NOCLDSTOP]: Reset signal
4457         handler to self, not to SIG_IGN, since SIGTSTP can be received
4458         more than once.
4459         (main): Use SA_RESTART, as that is simpler than checking for EINTR
4460         failures all over the place.
4461
4462 2004-04-20  Jim Meyering  <jim@meyering.net>
4463
4464         * src/remove.c (is_empty_dir): Clarify comment.
4465
4466         * man/help2man: Accept new option: --program-name=NAME, so that we
4467         can override the one in --version output.  This is needed solely
4468         so that test.1 doesn't refer to `[' as the program name.
4469         Reported by Benjamin Cutler as http://bugs.debian.org/205251.
4470         * man/Makefile.am (.x.1): Use help2man's new --program-name option.
4471
4472         * src/pwd.c: Don't include pathmax.h; system.h already does it.
4473
4474         * src/cut.c (cut_fields): Free buffer upon getndelim2 failure.
4475
4476 2004-04-19  Jim Meyering  <jim@meyering.net>
4477
4478         * src/shred.c (isaac_seed_start) [AVOID_USED_UNINITIALIZED_WARNINGS]:
4479         Initialize a buffer to avoid warnings from tools like valgrind.
4480
4481         * Makefile.maint (sc_trailing_blank): New rule.
4482         (syntax-check-rules): Add it.
4483         * .x-sc_trailing_blank: New file.
4484
4485         Make pwd work even if the resulting name is so long that getcwd fails.
4486         * src/pwd.c: (path_free, path_init, path_prepend): New functions.
4487         (nth_parent, find_dir_entry, robust_getcwd): New functions.
4488         (main): First try getcwd, then, upon failure, robust_getcwd.
4489
4490 2004-04-18  Jim Meyering  <jim@meyering.net>
4491
4492         * src/who.c (print_user): Use xrealloc here, rather than
4493         unchecked realloc.  Remove anachronistic casts.
4494
4495         * src/remove.c (full_filename_): Don't leak upon failed realloc.
4496
4497         * src/system.h (readdir_ignoring_dot_and_dotdot): New inline function,
4498         from remove.c.
4499         * src/remove.c (readdir_ignoring_dotdirs): Move function to system.h,
4500         renaming it.  Update uses.
4501
4502 2004-04-17  Jim Meyering  <jim@meyering.net>
4503
4504         * configure.ac: Depend on automake-1.8.3.
4505
4506         * src/join.c (add_file_name): Declare function to be `static'.
4507         (string_to_join_field): Likewise.
4508         * src/remove.c (ds_init, ds_free): Likewise.
4509
4510         * Makefile.maint (sc_prohibit_jm_in_m4): New rule.
4511         (syntax-check-rules): Add to the list.
4512
4513 2004-04-13  Paul Eggert  <eggert@twinsun.com>
4514
4515         Use page-aligned buffers whenever we bother to do I/O using buffer
4516         sizes that are tailored for the files.
4517
4518         * src/cat.c: Include getpagesize.h.
4519         * src/copy.c: Likewise.
4520         * src/shred.c: Likewise.
4521         * src/split.c: Likewise.
4522         * src/cat.c (main): Align I/O buffers to page boundaries.
4523         * src/copy.c (copy_reg): Likewise.
4524         * src/shred.c (dopass): Likewise.
4525         * src/split.c (main): Likewise.
4526         * src/dd.c (ROUND_UP_OFFSET, PTR_ALIGN): Remove.
4527         All uses replaced by ptr_align.
4528         * src/od.c (gcd, lcm): Remove; now in system.h.
4529         * src/system.h (gcd, lcm, ptr_align): New functions, moved from od.c.
4530
4531 2004-04-14  Jim Meyering  <jim@meyering.net>
4532
4533         Remove m4/Makefile.am: it's no longer needed, with newer automake
4534         * configure.ac (AC_CONFIG_FILES): Remove m4/Makefile.in from the list.
4535         * Makefile.am (SUBDIRS): Remove `m4' from the list.
4536
4537 2004-04-13  Jim Meyering  <jim@meyering.net>
4538
4539         * configure.ac: Change `jm_' in AC_DEFINE'd names to `gl_'.
4540
4541 2004-03-27  Paul Eggert  <eggert@twinsun.com>
4542
4543         * NEWS: cp -pu and mv -u (when copying) now take the destination
4544         file system time stamp resolution into account.
4545         * doc/coreutils.texi (mv invocation): Document this.
4546         (cp invocation): Document -u (it was missing!) with new behavior.
4547
4548         * src/copy.c: Include "utimecmp.h".
4549         (copy_internal): Compare time stamps using utimecmp rather than
4550         MTIME_CMP.
4551
4552 2004-04-09  Jim Meyering  <jim@meyering.net>
4553
4554         * Makefile.maint (.re-list): New rule/file, to replace
4555         hard-coded list of header file names.
4556         (sc_system_h_headers): Use the new file.
4557         Don't look for sys2.h anymore.
4558
4559         * src/system.h: Include new "stat-macros.h" rather than hard-coding
4560         all of its macro definitions -- the list was slightly out of date.
4561         Suggestion from Dmitry V. Levin.
4562
4563 2004-04-08  Paul Eggert  <eggert@cs.ucla.edu>
4564
4565         * NEWS: Remove noctty flag from dd.  Suggested by Philippe Troin.
4566         * doc/coreutils.texi (dd invocation): Likewise.
4567         * src/shred.c (O_NOCTTY): Remove redundant decl.
4568         * src/dd.c (flags, usage): Remove noctty flag.
4569         (main): Always use O_NOCTTY when opening files.
4570
4571 2004-04-08  Jim Meyering  <jim@meyering.net>
4572
4573         * src/dd.c (dd_copy): Mark two diagnostics for translations.
4574         (set_fd_flags): Undo part of today's change: it's a little
4575         cleaner -- and more efficient in the common case -- to go
4576         ahead and OR in the -1 when fcntl fails.
4577
4578         * Makefile.maint (sc_dd_max_sym_length): New target.
4579         (syntax-check-rules): Add it.
4580
4581         * src/md5sum.c (PROGRAM_NAME) [algorithm == ALG_SHA1]:
4582         Correct spelling: s/shasum/sha1sum.  Reported by Jesse Kornblum.
4583
4584         * src/dd.c (set_fd_flags): Don't OR in -1 when fcntl fails.
4585         Rename parameter, flags, to avoid shadowing global.
4586         (LONGEST_SYMBOL): Tweak comment.
4587
4588 2004-04-07  Paul Eggert  <eggert@twinsun.com>
4589
4590         * NEWS: New dd conv= symbols nocreat, excl, fdatasync, fsync,
4591         and new dd options iflag= and oflag=.
4592         * src/dd.c (usage): Likewise.
4593         * src/Makefile.am (dd_LDADD, shred_LDADD): Add fdatasync's lib.
4594         * src/dd.c (fdatasync) [!HAVE_FDATASYNC]: New macro.
4595         (C_NOCREAT, C_EXCL, C_FDATASYNC, C_FSYNC): New macros.
4596         (input_flags, output_flags): New vars.
4597         (LONGEST_SYMBOL): New macro.
4598         (struct symbol_value): Renamed from struct conversion.  Members
4599         symbol and value renamed from convname and conversion.  The
4600         symbol value is now an array instead of a pointer; this saves
4601         a bit of space and time in practice.  All uses changed.
4602         (conversions): Add nocreat, excl, fdatasync, fsync.  Now const.
4603         (flags): New constant array.
4604         (iflag_error_msgid, oflag_error_msgid): New constants.
4605         (parse_symbols): Renamed from parse_conversion and generalized
4606         to handle either conversion or flag symbols.
4607         (scanargs): Adjust uses of parse_symbols accodingly.  Add
4608         support for iflag= and oflag=.  Reject attempts to use
4609         both excl and nocreat.
4610         (set_fd_flags): New function.
4611         (dd_copy): Just return X rather than calling quit (X), since our
4612         caller invokes quit with the returned value.  Add support for
4613         fdatasync and fsync.
4614         (main): Add support for iflag=, oflag=, and new conv= symbols.
4615         * src/system.h (O_DIRECT, O_DSYNC, O_NDELAY, O_NOFOLLOW,
4616         O_RSYNC, O_SYNC): Define to 0 if not already defined.
4617
4618         * NEWS: Remove duplicate mention of BLOCKSIZE.
4619
4620 2004-04-02  Andreas Schwab  <schwab@suse.de>
4621
4622         * src/stty.c: Add support for IUTF8 input flag.
4623
4624 2004-04-06  Jim Meyering  <jim@meyering.net>
4625
4626         * src/system.h (makedev) [mkdev && !makedev]: Define in terms of mkdev.
4627         Interix spells it `mkdev'.  Reported by Mark Funkenhauser.
4628
4629 2004-04-04  Jim Meyering  <jim@meyering.net>
4630
4631         A specified format is no longer automatically newline terminated.
4632         If you want a newline at the end of your format, use `\n'.
4633         * src/stat.c (print_it): Don't print a newline at the end of
4634         every format.
4635         (do_statfs): Add a newline at end of each default format string.
4636
4637 2004-03-30  Paul Eggert  <eggert@twinsun.com>
4638
4639         * src/nohup.c (main): Adjust to new calling convention
4640         for set_cloexec_flag.
4641
4642 2004-03-31  Jim Meyering  <jim@meyering.net>
4643
4644         * tests/Fetish.pm (run_tests): Remove `.orig' file.
4645         Remove debugging diagnostic.
4646
4647         Specifying an invalid --width=N (-w) or --gap-size=N (-g)
4648         would not elicit an error.
4649         * src/ptx.c: Include "xstrtol.h" and "quotearg.h".
4650         (main): Don't use atoi.  Use xstrtoul instead.
4651
4652 2004-03-30  Jim Meyering  <jim@meyering.net>
4653
4654         * Makefile.maint (sc_prohibit_atoi_atof): New rule.
4655         (syntax-check-rules): Add it.
4656         * .x-sc_prohibit_atoi_atof: New file.
4657
4658 2004-03-29  Jim Meyering  <jim@meyering.net>
4659
4660         * tests/du/files0-from: Use new OUT_SUBST directive, so that this
4661         test is not sensitive to system-dependent block size differences.
4662         Prompted by a report of Solaris 8 differences from Paul Eggert.
4663
4664         * tests/Fetish.pm: Accept new directives: OUT_SUBST, ERR_SUBST.
4665         Rename `%tmp' to `%actual'.  Reverse order of last two args to
4666         _compare_files (to $actual, $expected) so as to match declaration.
4667
4668 2004-03-28  Paul Eggert  <eggert@twinsun.com>
4669
4670         Fix some gotchas encountered when porting to Solaris 8, using
4671         the Forte 6u2 compiler.
4672
4673         * src/hostname.c [HAVE_SETHOSTNAME && !defined sethostname]:
4674         Declare sethostname, since no Solaris header does it.
4675         * src/who.c: Include "vasprintf.h", for asprintf.
4676
4677 2004-03-28  Jim Meyering  <jim@meyering.net>
4678
4679         Minor optimization:
4680         * src/du.c (process_file): Don't record dev/inode for directories.
4681
4682         Under some circumstances, without -c, du would mistakenly count the
4683         space of hard-linked files, not just the first one it encountered.
4684         Reported by Anthony Thyssen.
4685         * src/du.c (du_files): Don't ever clear the set of `seen' dev/inodes.
4686
4687         * src/du.c: Rename global `print_totals' to `print_grand_total'.
4688
4689         * src/du.c (main): Rearrange filtering loop to be a tiny bit
4690         more efficient.
4691
4692         * src/chown-core.c: Don't include savedir.h -- no longer needed.
4693         * src/chmod.c: Likewise.
4694
4695 2004-03-25  Jim Meyering  <jim@meyering.net>
4696
4697         * src/du.c (main): Remove now-unused declaration of `i'.
4698
4699 2004-03-24  Paul Eggert  <eggert@twinsun.com>
4700
4701         * src/du.c (main): Filter out file names of length zero before
4702         invoking fts, so that they don't cause fatal errors.
4703
4704 2004-03-25  Jim Meyering  <jim@meyering.net>
4705
4706         * tests/du/files0-from (zero-len): Add a test for the above.
4707
4708 2004-02-25  Paul Eggert  <eggert@twinsun.com>
4709
4710         * NEWS: New environment var BLOCKSIZE.
4711         * lib/human.c (humblock): Support BLOCKSIZE as well as BLOCK_SIZE.
4712         * tests/envvar-check: Test for it.  Factor the code to simplify it.
4713
4714 2004-03-23  Paul Eggert  <eggert@twinsun.com>
4715
4716         * NEWS: Shorten the du --files0-from announcement, and say
4717         "NUL-terminated" rather than "NUL-separated".
4718         * src/du.c (EXPECTED_BYTES_PER_FILE_NAME, DEFAULT_PROJECTED_N_FILES):
4719         Remove: not used.
4720         (usage): Say "NUL-terminated", not "NUL-separated".
4721         (main): Check for I/O error when istream is closed.
4722         Allow --files0-from=F even if F is empty; this specifies no files.
4723         (du_files): Now that we allow the list of files to be empty,
4724         handle that case.
4725         * tests/du/files0-from: Adjust to above changes to src/du.c.
4726
4727 2004-03-24  Jim Meyering  <jim@meyering.net>
4728
4729         * tests/tail-2/assert: Avoid race condition that could cause
4730         spurious failure.  Based on a patch from Andreas Schwab.
4731
4732 2004-03-23  Jim Meyering  <jim@meyering.net>
4733
4734         * src/du.c (main): Free the hash table, too.
4735
4736 2004-03-22  Jim Meyering  <jim@meyering.net>
4737
4738         * man/Makefile.am (.x.1): Remove --info-page= option, reverting
4739         the change of 2004-01-22.  I can no longer reproduce the problem
4740         that prompted that change, and `info coreutils pr' would display the
4741         `printing text' section of the manual, not the one on `pr invocation'.
4742
4743         * tests/du/files0-from (nul-1, nul-2): Adjust expected diagnostics
4744         to match corrected output.
4745
4746         * src/du.c: Include "readtokens0.h" rather than "readtokens.h".
4747         (main): Use readtoken0 functions rather than readtokens.
4748         Don't use errno when diagnosing readtokens0 failure.
4749         Fix off-by-one error in the token number reported in a diagnostic.
4750         (du_files): Return bool, rather than int.
4751         (main): Call readtokens0_free.
4752
4753 2004-03-21  Jim Meyering  <jim@meyering.net>
4754
4755         * src/remove.c (ds_free): Plug a small leak.
4756
4757         * tests/Fetish.pm: Fix typo in comment.
4758
4759 2004-03-07  Jim Meyering  <jim@meyering.net>
4760
4761         * NEWS: du accepts a new option --files0-from=FILE, where FILE
4762         contains a list of NUL-separated file names.
4763
4764         * src/du.c: Include "readtokens.h".
4765         (usage): Describe the new option, and adjust the `Usage':
4766         with this option, no FILE may be specified on the command line.
4767         (main): Handle the new option.
4768
4769         * tests/du/files0-from: New tests, for the above.
4770         * tests/du/Makefile.am (TESTS): Add files0-from.
4771
4772         * src/factor.c (do_stdin): Reflect changes in use of readtoken.
4773         * src/tsort.c (tsort): Likewise.
4774
4775 2004-02-29  Paul Eggert  <eggert@twinsun.com>
4776
4777         * NEWS: Add support for a new notation @N to get_date to represent
4778         the time stamp with numeric value N.  Improve support for
4779         fractional time stamps.  date's -d and -f options now accept them.
4780         Likewise for touch -t.  date has a new option --iso-8601=ns.
4781
4782         * doc/coreutils.texi (touch invocation):
4783         Describe use of fractional seconds.
4784         (date invocation, Options for date): Likewise.
4785         * doc/getdate.texi (General date syntax, Time of day items): Likewise.
4786         * doc/coreutils.texi (date invocation): Mention effect of LC_TIME.
4787         (Options for date): Describe new --iso-8601=ns option.
4788
4789         * doc/getdate.texi: Add copyright notice.  Change getdate to
4790         get_date when talking about the function name.
4791         (Seconds since the Epoch): New section, containing the time_t
4792         info moved from Date input formats section, along with new
4793         info about the @ syntax.  Mention negative time stamps,
4794         fractional time stamps, and leap seconds.
4795         (General date syntax): Modernize examples a bit to reflect new
4796         features.
4797         (General date syntax, Relative items in date strings):
4798         Use ' rather than " to quote formats.
4799         (Time of day items): Add an example with fractional seconds.
4800         Describe fractional-second syntax.
4801
4802         * src/Makefile.am (touch_LDADD): New macro, since `touch' now
4803         needs clock_gettime.
4804
4805         * src/date.c (enum Time_spec): New enum TIME_SPEC_NS.
4806         (time_spec_string, time_spec, show_date): Support it.
4807         (usage): Remove description of -ITIMESPEC, as it's obsolete and
4808         confusing.  Mention --iso-8601=ns.
4809         (batch_convert): getline returns ssize_t, not int.
4810
4811         * src/touch.c (newtime): Now an array of two timespecs, one
4812         for access and one for modification.
4813         (ref_stats): Remove.
4814         (get_reldate): Use get_date's parameter profile.
4815         (touch, main): Adjust to above changes.
4816         (main): Work even if tm_year == INT_MAX (so long as long int is wider).
4817         Use gettime instead of gettimeofday, for new get_date signature.
4818
4819         * tests/date/Test.pm (test_vector): New tests epoch, ns-10, ns-max32,
4820         ns-relative.
4821
4822 2004-03-15  Jim Meyering  <jim@meyering.net>
4823
4824         * Makefile.maint (alpha beta major): `Make' the emit_upload_commands
4825         target before updating $(prev_version_file).
4826
4827         * tests/misc/date-sec: New file, to test for just-fixed bug in date.
4828         See today's change in lib/getdate.y.
4829         * tests/misc/Makefile.am (TESTS): Add date-sec.
4830
4831 2004-03-14  Jim Meyering  <jim@meyering.net>
4832
4833         * announce-gen (print_changelog_deltas): Use `.sig' suffix for
4834         signature files, not `.asc'.  Reported by angico@yahoo.com.
4835
4836 2004-03-13  Jim Meyering  <jim@meyering.net>
4837
4838         * src/cp.c (do_copy): Tweak wording in a diagnostic.
4839         Suggestion from Karl Berry.
4840         Include "quoatearg.h".
4841         (do_copy): Use quotearg_colon (not quote) for diagnostics
4842         that begin with `"%s:'.
4843
4844         * src/nl.c (usage): Specify that nl uses _basic_ regular expressions.
4845         Suggestion from Dan Jacobson.
4846
4847 2004-03-12  Jim Meyering  <jim@meyering.net>
4848
4849         * Version 5.2.1.
4850
4851         Sometimes, when source and destination partition are different,
4852         mv mistakenly fails to preserve a hard link.  Reported by IIDA Yosiaki.
4853
4854         * src/copy.c: When moving a set of N hard-linked files between
4855         partitions, via two or more command line arguments where the
4856         command line argument containing the Nth link contains no other
4857         link to that same file, mv would mistakenly copy the file, rather
4858         than hard-linking it to the other(s).  That happens because when the
4859         final link is processed, its link count has been reduced to 1 since
4860         the other links have been `copied' to the destination partition
4861         and the source links have been removed.
4862         (copy_internal): When in move mode, use the source dev/inode
4863         pair to look up destination name even when st_nlink == 1.
4864         * src/cp-hash.c (src_to_dest_lookup): New function.
4865         * src/cp-hash.h (src_to_dest_lookup): Add prototype.
4866         * tests/mv/part-hardlink: New file.  Test for the above fix.
4867         * tests/mv/Makefile.am (TESTS): Add part-hardlink.
4868
4869         * announce-gen: Sync with autoconf.
4870
4871         * tests/ls/time-1: Exit 77 (not 1) if we can't set up for the test.
4872         This was triggered on a Linux-2.2.19 system using a file system
4873         NFS-mounted from some sort of Sun.
4874
4875 2004-03-11  Jim Meyering  <jim@meyering.net>
4876
4877         * Use automake-1.8.3.  Regenerate dependent files.
4878
4879 2004-03-10  Jim Meyering  <jim@meyering.net>
4880
4881         * tests/du/deref-args: Also convert sizes in the 70-79 kB range,
4882         so that this test works with SELinux-enabled systems.
4883         Based on a patch from Tim Waugh.
4884
4885         `join -1 x' would give a misleading diagnostic
4886         * src/join.c (string_to_join_field): Report that a non-numeric field
4887         number is invalid, rather than `so large that it is not representable'.
4888         * tests/join/Test.pm (invalid-j): New partial test for the above fix.
4889
4890 2004-03-06  Jim Meyering  <jim@meyering.net>
4891
4892         cp --sparse=always sparse-image-file.img /dev/hda1 could
4893         produce an invalid copy on the destination device.
4894
4895         * src/copy.c (copy_reg): Even with --sparse=always, try to
4896         make `holes' only if the destination is a regular file.
4897         Reported by Szakacsits Szabolcs.
4898
4899 2004-03-03  Paul Eggert  <eggert@twinsun.com>
4900
4901         * src/nohup.c (main): Don't invoke set_cloexec_flag with
4902         a file descriptor of -1.
4903
4904 2004-03-02  Dmitry V. Levin  <ldv@altlinux.org>
4905
4906         * src/nohup.c: Include "cloexec.h".
4907         (main): Set the copy of stderr to close on exec.
4908
4909 2004-03-01  Paul Eggert  <eggert@twinsun.com>
4910
4911         * configure.ac: Include <signal.h> when checking for strsignal,
4912         sys_siglist, and friends.  Problem reported by Tony Leneis in
4913         <http://mail.gnu.org/archive/html/bug-coreutils/2004-02/msg00136.html>.
4914
4915 2004-02-25  Paul Eggert  <eggert@twinsun.com>
4916
4917         * tests/du/deref-args, tests/du/exclude, tests/du/slash:
4918         * tests/du/trailing-slash: Run envvar-check in case BLOCK_SIZE
4919         etc. are set.
4920
4921 2004-02-23  Paul Eggert  <eggert@twinsun.com>
4922
4923         * NEWS: Document how chown's USER.GROUP argument is now parsed.
4924
4925 2004-02-23  Jim Meyering  <jim@meyering.net>
4926
4927         * src/seq.c (usage): Remove stray space after \n in --help output.
4928
4929 2004-02-22  Jim Meyering  <jim@meyering.net>
4930
4931         * src/du.c (usage): Separate -H and --si.  Say that the meaning
4932         of -H will soon change to that of --dereference-args (-D).
4933
4934 2004-02-21  Jim Meyering  <jim@meyering.net>
4935
4936         * src/comm.c (usage): Tell what comm does when there are no options.
4937         Reword in terms of FILE1 and FILE2 rather than `left file' and
4938         `right file'.  Suggestion from Dan Jacobson.
4939
4940 2004-02-15  Paul Eggert  <eggert@twinsun.com>
4941
4942         Fix some POSIX-conformance bugs in expr.
4943
4944         * NEWS: document the following changes to src/expr.c.
4945         * doc/coreutils.texi (expr invocation): Likewise.
4946         Document what forms integers may take, and say "integer"
4947         consistently instead of "number".  Warn about operands
4948         that "expr" can misinterpret, and how to work around the
4949         problem.
4950         * src/expr.c (eval, eval7, eval6, eval5, eval4, eval3, eval2, eval1):
4951         Accept a bool argument specifying whether to evaluate the
4952         expression.  This is to allow short-circuit evaluation.  All
4953         callers changed.
4954         (null): Report that a string is zero even if it has
4955         a form like "-0" or "00".
4956         (eval1, eval): Use short-circuit evaluation for | and &.
4957         (eval): Return 0 if both arguments are null or zero, instead
4958         of returning the first argument.
4959         * tests/expr/basic: Add some tests for the above.
4960
4961 2004-02-17  Jim Meyering  <jim@meyering.net>
4962
4963         * Version 5.2.0.
4964
4965         `make check' from a build inside a chroot environment would fail
4966         * tests/help-version: Specify an argument (`/') for df, in the
4967         unusual event that there is no valid entry in /etc/mtab.
4968         Likewise for id: add the -u option, so we don't get spurious
4969         failures when there are no user or group names.
4970         Patch by Tim Waugh.
4971
4972         * src/sort.c (usage) [-u]: Add punctuation so that the description in
4973         the help2man-generated (line-joined) man page is more readable.
4974         Reported by Tim Waugh.
4975         [-T]: Add a semicolon, for the same reason.
4976
4977 2004-02-15  Jim Meyering  <jim@meyering.net>
4978
4979         * Makefile.am (dist-hook): Qualify target with $(srcdir)/ prefix.
4980
4981 2004-02-11  Jim Meyering  <jim@meyering.net>
4982
4983         * tests/Makefile.am.in ($(srcdir)/Makefile.am): Use more portable
4984         $(srcdir)/../Makefile.am.in, rather than $<.
4985         Suggestion from Michael Elizabeth Chastain.
4986
4987 2004-02-10  Jim Meyering  <jim@meyering.net>
4988
4989         * config/install-sh: Make this script executable.
4990         * Makefile.am (dist-hook): New target, to ensure that config/install-sh
4991         is executable.  Otherwise, on systems that lack a suitable install
4992         binary, `make install' would fail, because of the way this script
4993         is invoked (without `$SHELL ' prefix).
4994         Reported by Bob Proulx.
4995
4996 2004-02-08  Jim Meyering  <jim@meyering.net>
4997
4998         * Version 5.1.3.
4999
5000         * tests/rm/rm5: Avoid triggering a bug in OSF/Tru64's sed
5001         that would cause an unwarranted test failure.
5002         * tests/rm/rm3: Likewise.
5003
5004 2004-02-07  Jim Meyering  <jim@meyering.net>
5005
5006         Remove xstat function pointer member.  The way it was used was not
5007         portable, since some systems (OSF V5.1, Solaris 2.5.1) provide static
5008         inline `stat' and `lstat' functions, thus making the tests of
5009         `xstat == lstat' in copy.c always fail.
5010         * src/copy.h (struct cp_options) [xstat]: Remove member.
5011         (XSTAT): New macro.
5012         * src/copy.c (copy_dir): Set `.dereference' member, not .xstat.
5013         (copy_internal): Use `XSTAT (x, ...)' in place of `*(x->xstat) (...)'.
5014         Use `x->dereference == DEREF_NEVER' in place of `x->xstat == lstat'.
5015         (valid_options): Remove now-obsolete FIXME comments.
5016
5017         * src/cp.c (re_protect): Use `XSTAT (x, ...)' in place of
5018         `*(x->xstat) (...)'.
5019         (do_copy): Declare/use local xstat rather than x->xstat.
5020         (main): Remove code that set x.xstat.
5021         * src/mv.c (cp_option_init): Don't initialize xstat member.
5022         * src/install.c (cp_option_init): Likewise.
5023
5024         * Makefile.cfg (gnu_ftp_host-alpha, etc.): Un-factor .gnu.org suffix,
5025         so that emit_upload_commands can use these variables, too.
5026
5027 2004-02-06  Jim Meyering  <jim@meyering.net>
5028
5029         * tests/rm/deep-1: Remove `du' stack space test.
5030         Apparently, `ulimit -s N' isn't portable enough.
5031         This test will be restored (with a guard against losing ulimit)
5032         in its own file later.
5033
5034         * tests/rm/deep-1 (deep): Remove progress-style diagnostics,
5035         since this test doesn't take long enough to merit them.
5036         Run du on $tmp (the containing dir), not $deep, the full path to leaf.
5037
5038         * Makefile.maint (signatures): Remove definition.
5039         Now, automake's gnupload handles this.
5040         (%.sig: %): Remove now-unused rule.
5041         (rel-files): Use automake's $(DIST_ARCHIVES), rather than
5042         `$(distdir).tar.bz2 $(distdir).tar.gz'.
5043         (emit-upload-commands): Adjust to use gnupload.
5044
5045 2004-02-05  Jim Meyering  <jim@meyering.net>
5046
5047         * src/system.h (ST_TIME_CMP_NS, ST_TIME_CMP): Remove definitions.
5048         (ATIME_CMP, CTIME_CMP, MTIME_CMP, TIMESPEC_NS): Likewise.
5049         Now, those are all defined in timespec.h.
5050         Include timespec.h.
5051
5052         * src/date.c: Don't include timespec.h, now that system.h does it.
5053
5054 2004-02-02  Paul Eggert  <eggert@twinsun.com>
5055
5056         Don't dump core if localtime returns NULL (possible on
5057         hosts with 64-bit time_t and 32-bit int).
5058         * src/date.c: Include "inttostr.h".
5059         (batch_convert, main):
5060         If time conversion fails, exit with nonzero status.
5061         (show_date): Return int to report conversion failure.
5062         Print the time as an int if localtime fails.
5063         * src/uptime.c: Print "??" if the current clock can't
5064         be converted by localtime.  This won't happen until the year
5065         2*31 + 1900, but we don't want to dump core even if the current
5066         clock has the wrong value.
5067
5068         * src/stat.c: Include "inttostr.h".
5069         (human_time): Print the date/time as a number of seconds since the
5070         epoch if it can't be converted by localtime.  This is better than
5071         just saying "invalid", and is consistent with what "ls" does.
5072         Don't dump core if the year has more than 48 digits; this isn't
5073         possible on any contemporary host, but we might as well do it right.
5074
5075 2004-01-31  Paul Eggert  <eggert@twinsun.com>
5076
5077         * src/stat.c (human_time): Accept time rather than
5078         pointer-to-const-time parameter, for clarity.  All callers changed.
5079
5080 2004-02-02  Jim Meyering  <jim@meyering.net>
5081
5082         * src/stat.c (do_stat): Remove extra trailing newline from
5083         default formats.  Reported by Nelson H. F. Beebe.
5084
5085         Print actual fractional seconds in time stamps, not just `.00000000'.
5086         * src/stat.c (human_time): Add and use new parameter, t_ns.
5087         (print_stat): Update callers.
5088         * src/ls.c (TIMESPEC_NS): Remove definition.
5089         * src/system.h (TIMESPEC_NS): Define here, instead, now that stat.c
5090         also uses this macro.
5091         Nelson H. F. Beebe noticed that ls --full-time printed nonzero
5092         fractional seconds for files on an XFS file system, but that stat's
5093         fractional seconds were always zero.
5094
5095 2004-01-28  Paul Eggert  <eggert@twinsun.com>
5096
5097         * src/seq.c (print_numbers): Use 'double' for loop index, not
5098         'int', to avoid problems with integer overflow.  On almost all
5099         machines 'double' works in every case where 'int' works, and
5100         it works on other cases besides.
5101
5102 2004-01-27  Jim Meyering  <jim@meyering.net>
5103
5104         * src/seq.c (usage): Mention that if INCREMENT is omitted,
5105         it defaults to 1, even when FIRST is larger than LAST.
5106         Reword so as not to exclude the possibility that INCREMENT be zero.
5107
5108 2004-01-25  Jim Meyering  <jim@meyering.net>
5109
5110         * Version 5.1.2.
5111
5112         * Makefile.maint (signatures): Comment out definition.
5113
5114 2004-01-23  Jim Meyering  <jim@meyering.net>
5115
5116         * Makefile.maint (header_regexp): Add exitfail.
5117
5118         * man/Makefile.am (EXTRA_DIST): Add help2man.
5119         Reported by Nelson H. F. Beebe.
5120
5121         * man/Makefile.am (.x.1): Prefix help2man invocation with `$(PERL) --'
5122         so it works on systems with Perl installed somewhere other than in
5123         /usr/bin.
5124
5125         * src/paste.c (paste_parallel): Declare local, chr, to be of type
5126         `int', not `char', since it must hold EOF.  This bug would make
5127         paste infloop on some systems.  Test failures reported by
5128         Nelson H. F. Beebe and Christian Krackowizer.
5129
5130 2004-01-22  Jim Meyering  <jim@meyering.net>
5131
5132         * tests/rmdir/fail-perm: New file.  Test for just-fixed rmdir bug.
5133         * tests/rmdir/Makefile.am (TESTS): Add fail-perm.
5134
5135         * man/help2man: Fix it so using --info-page='coreutils PROG' works.
5136         * man/Makefile.am (.x.1): Invoke our own (tweaked) copy of help2man.
5137         Use --info-page='coreutils PROG' option.
5138         Now, readlink.1 refers the user to `info coreutils readlink'
5139         rather than to `info readlink'.  Reported by Matt Swift.
5140
5141 2004-01-21  Paul Eggert  <eggert@twinsun.com>
5142
5143         Exit status cleanup.
5144
5145         * src/basename.c (usage): Use EXIT_SUCCESS, not 0, for clarity.
5146         * src/cat.c, src/chgrp.c, src/chmod.c, src/chown.c, src/chroot.c,
5147         * src/cksum.c, src/comm.c, src/cp.c, src/csplit.c, src/cut.c,
5148         * src/date.c, src/dd.c, src/df.c, src/dircolors.c, src/dirname.c,
5149         * src/du.c, src/echo.c, src/env.c, src/expand.c, src/expr.c,
5150         * src/factor.c, src/fmt.c, src/fold.c, src/head.c, src/hostid.c,
5151         * src/hostname.c, src/id.c, src/install.c, src/join.c, src/kill.c,
5152         * src/link.c, src/ln.c, src/logname.c, src/ls.c, src/md5sum.c,
5153         * src/mkdir.c, src/mkfifo.c, src/mknod.c, src/mv.c, src/nice.c,
5154         * src/nl.c, src/nohup.c, src/od.c, src/paste.c, src/pathchk.c,
5155         * src/pinky.c, src/pr.c, src/printenv.c, src/printf.c, src/pwd.c,
5156         * src/rm.c, src/rmdir.c, src/seq.c, src/setuidgid.c, src/shred.c,
5157         * src/sleep.c, src/sort.c, src/split.c, src/stat.c, src/stty.c,
5158         * src/su.c, src/sum.c, src/sync.c, src/tac.c, src/tail.c, src/tee.c,
5159         * src/test.c, src/touch.c, src/tr.c, src/tsort.c, src/tty.c,
5160         * src/uname.c, src/unexpand.c, src/uniq.c, src/unlink.c, src/uptime.c,
5161         * src/users.c, src/wc.c, src/who.c, src/whoami.c, src/yes.c: Likewise.
5162
5163         * src/cat.c (usage): Don't bother normalizing exit status
5164         since the arg is already the correct exit status now.
5165         * src/cksum.c, src/comm.c, src/csplit.c, src/cut.c,
5166         * src/dircolors.c, src/expand.c, src/fmt.c, src/fold.c, src/head.c,
5167         * src/join.c, src/md5sum.c, src/nl.c, src/od.c, src/paste.c,
5168         * src/pr.c, src/split.c, src/sum.c, src/tac.c, src/tail.c, src/tr.c,
5169         * src/tsort.c, unexpand.c, src/src/uniq.c, src/src/wc.c: Likewise.
5170
5171         * src/chown.c (main): Removed unused local 'fail'.
5172
5173         * src/chroot.c (CHROOT_FOUND_BUT_CANNOT_INVOKE, CHROOT_FAILURE):
5174         Remove.
5175
5176         * src/chroot.c (main): Initialize exit_failure to EXIT_FAIL.
5177         * src/env.c, src/nice.c, src/su.c: Likewise.
5178         * src/nohup.c (main): Likewise, to NOHUP_FAILURE.
5179         * src/setuidgid.c (main): Likewise, to SETUIDGID_FAILURE.
5180         * src/expr.c (main): Use initialize_exit_failure rather than
5181         setting exit_failure directly; this optimizes away redundant
5182         assignments.
5183         * src/printenv.c, src/sort.c, src/test.c, src/tty.c: Likewise.
5184
5185         * src/chroot.c (main): Exit with status 1 rather than 127
5186         if chroot itself fails, as per documentation.
5187
5188         * src/chroot.c (main): Use EXIT_ENOENT and EXIT_CANNOT_INVOKE
5189         rather than roll-your-own symbols or integers.
5190         * src/env.c (main): Likewise.
5191         * src/nohup.c (main): Likewise.
5192         * src/su.c (run_shell): Likewise.
5193
5194         * src/cp.c (exit_status): Remove static var....
5195         (main): Making it local here instead.  Use =, not |=, to set it.
5196
5197         * src/cut.c (FATAL_ERROR, main): Exit with status EXIT_FAILURE,
5198         not 2, on errors.
5199         * src/date.c (batch_convert, main): Likewise.
5200         * src/dd.c (dd_copy): Likewise.
5201         * src/pr.c (first_last_page, main, getoptarg): Likewise.
5202         * src/tr.c (main): Likewise.
5203         * src/date.c (main): Don't assume EXIT_FAILURE == 1, as
5204         POSIX doesn't require it.
5205         * src/dd.c (write_output, skip, dd_copy): Likewise.
5206         * src/df.c (main): Likewise.
5207         * src/id.c (main): Likewise.
5208         * src/install.c (main): Likewise.
5209         * src/ln.c (main): Likewise.
5210         * src/ls.c (main): Likewise.
5211         * src/mv.c (main): Likewise.
5212         * src/shred.c (main): Likewise.
5213
5214         * src/env.c (main): Exit with status 1, not 2, on errors detected
5215         by env proper.
5216         * src/hostname.c (main): Likewise.
5217         * src/nl.c (main): Likewise.
5218         * src/stty.c (main): Likewise.
5219
5220         * src/expr.c (EXPR_FAILURE): Renamed from EXPR_ERROR, for
5221         consistency with the other programs' naming conventions.
5222         All uses changed.
5223
5224         * src/factor.c (main): Do not report a usage error simply
5225         because stdin has bad numbers.
5226
5227         * src/id.c (problems): Now a boolean int, not a counter,
5228         so that we don't have to worry about int overflow.  All uses changed.
5229         * src/touch.c (err): Likewise.
5230
5231         * src/md5sum.c (main): Use int, not size_t, to store boolean int.
5232
5233         * src/mkfifo.c (main): Exit with status 1, not 4, if not implemented.
5234         * src/mknod.c: Likewise.
5235
5236         * src/nice.c (main): Exit with status EXIT_FAIL, not EXIT_FAILURE,
5237         on error; this is in case EXIT_FAILURE is unusual.
5238         * src/su.c (main): Likewise.
5239
5240         * src/nohup.c (NOHUP_FOUND_BUT_CANNOT_INVOKE): Remove; all uses
5241         changed to EXIT_CANNOT_INVOKE.
5242
5243         * src/printenv.c (PRINTENV_FAILURE): New constant.
5244         (main): Exit with status PRINTENV_FAILURE, not EXIT_FAILURE, on
5245         command-line syntax problems.
5246
5247         * src/rmdir.c (remove_parents): Don't set 'fail' to a negative number.
5248         (main): Avoid integer overflow when seeing whether errors occurred.
5249
5250         * src/seq.c (print_numbers): Now returns void, not (zero) int.
5251         All callers changed.
5252         (main): Remove unused local variable 'errs'.  Always exit successfully
5253         if we reach the end.
5254
5255         * src/setuidgid.c (SETUIDGID_FAILURE): Renamed from FAIL_STATUS,
5256         for consistency with other programs here.  All uses changed.
5257         (main): Use 'error' to exit rather than invoking 'exit' here.
5258
5259         * src/sort.c: Don't include <assert.h>.
5260         (SORT_OUT_OF_ORDER,  SORT_FAILURE): Now enums, not macros.
5261         (usage): Don't use 'assert'.
5262         (main): Remove redundant assignment to exit_failure.
5263
5264         * src/system.h (EXIT_FAIL, EXIT_CANNOT_INVOKE, EXIT_ENOENT):
5265         New enum values.
5266         (initialize_exit_failure): New inline function.
5267         Include exitfail.h here, since we refer to exit_failure.
5268         All callers changed to not include exitfail.h.
5269
5270         * src/tty.c (TTY_FAILURE, TTY_WRITE_ERROR): New enum values;
5271         substitute them for the corresponding integer constants.
5272
5273         * tests/help-version (expected_failure_status_date): Remove, as
5274         'date' is now normal.
5275         (expected_failure_status_nohup): New var.
5276
5277 2004-01-21  Jim Meyering  <jim@meyering.net>
5278
5279         * tests/touch/relative: Remove `command' syntax.
5280         Thanks to Nelson H. F. Beebe and Paul Eggert.
5281
5282         * tests/touch/relative: Test only year/month/day, not hours/min/sec,
5283         so as to avoid problems with systems using TAI clocks.
5284         Although it's no longer necessary, set TZ=UTC0 also for the
5285         initial touch command.  Reported by Paul Jarc here:
5286         http://article.gmane.org/gmane.comp.gnu.core-utils.bugs/1504
5287
5288 2004-01-20  Diego Biurrun  <diego@biurrun.de>
5289
5290         * src/dircolors.hin: Add .mov to the list of media files.
5291
5292 2004-01-19  Paul Eggert  <eggert@twinsun.com>
5293
5294         * tests/touch/relative: Use TZ=UTC0, not TZ=utc (which isn't
5295         portable).  Problem reported by Christian Krackowizer.  Also, use
5296         +0000 rather than +0 to specify a time zone, as the documentation
5297         requires four digits.
5298
5299 2004-01-19  Jim Meyering  <jim@meyering.net>
5300
5301         * tests/mv/hard-4: Run envvar-check in case SIMPLE_BACKUP_SUFFIX is set.
5302         * tests/mv/backup-is-src: Likewise.
5303         Problem reported by Peter Horst
5304
5305 2004-01-17  Jim Meyering  <jim@meyering.net>
5306
5307         * announce-gen (print_changelog_deltas): Use .sig suffix, not .asc.
5308
5309         * Version 5.1.1.
5310
5311 2003-12-15  Paul Eggert  <eggert@twinsun.com>
5312
5313         * NEWS, doc/coreutils.texi: touch -r and -d can now both be specified,
5314         with -r specifying the origin for -d.
5315         * src/touch.c (flexible_date): Remove static var.
5316         (get_reldate): New function.
5317         (main): Use it, to implement this new behavior.
5318
5319 2004-01-16  Jim Meyering  <jim@meyering.net>
5320
5321         * tests/touch/relative: New test for the above.
5322         * tests/touch/Makefile.am (TESTS): Add relative.
5323
5324 2004-01-13  Jim Meyering  <jim@meyering.net>
5325
5326         * src/system.h: Include contents of sys2.h.
5327         * src/sys2.h: Remove file.
5328         * src/Makefile.am (noinst_HEADERS): Remove sys2.h.
5329
5330         * Use automake-1.8.2.  Regenerate dependent files.
5331
5332         * Update to gettext-0.13.1.
5333         * configure.ac: Use gettext-0.13.1.
5334         * .x-sc_space_tab: Add m4/po.m4 to the list of exceptions.
5335
5336 2004-01-12  Jim Meyering  <jim@meyering.net>
5337
5338         * Makefile.maint (%.sig): Use .sig suffix rather than .asc.
5339
5340         * Makefile.maint (po-check): Ensure that cvsu works before using it.
5341         Reported by Alexandre Duret-Lutz.
5342
5343         * src/tail.c (main): Warn about following stdin only when it's a tty.
5344
5345         * configure.ac: Use gl_DEFAULT_POSIX2_VERSION.
5346
5347 2004-01-10  Jim Meyering  <jim@meyering.net>
5348
5349         * tests/misc/stat-fmt: Use backticks, not `$()' notation.
5350
5351 2004-01-09  Jim Meyering  <jim@meyering.net>
5352
5353         * configure.ac: Quote underquoted `jm_DUMMY_1' to avoid new warning.
5354
5355 2004-01-08  Jim Meyering  <jim@meyering.net>
5356
5357         * src/stat.c (human_fstype): Use %lx, not %x format for `unsigned long'.
5358         From Andreas Schwab.
5359
5360         * tests/Makefile.am (TESTS_ENVIRONMENT): Remove `/vg' (prerelease test
5361         remnant) from PATH component.  That would cause tests in this directory
5362         not to run the just-built binaries, but rather whatever happened
5363         to be in one's PATH.  Reported by Christian Krackowizer.
5364
5365 2004-01-04  Jim Meyering  <jim@meyering.net>
5366
5367         * src/csplit.c (new_control_record): Use x2nrealloc
5368         rather than xrealloc.
5369
5370         * src/cp.c (re_protect): Use ASSIGN_STRDUPA rather than
5371         alloca and strcpy.
5372         (make_path_private): Likewise.
5373
5374 2004-01-03  Jim Meyering  <jim@meyering.net>
5375
5376         * src/paste.c: Use `bool' (not int) as the type for a few
5377         global variables.
5378         (collapse_escapes): Rewrite to set globals rather than modifying
5379         its parameter.
5380         Use size_t (not int) for all counters and related index variables.
5381         (paste_parallel): Remove needless complexity of
5382         using xrealloc in the loop;  just allocate the buffers up front.
5383         Free the two temporary buffers.
5384         Move declarations of locals `down' into scope where used.
5385         (paste_serial): Remove `register' attributes.
5386         (main): Simplify delim-related code.
5387         Free `delims', now that it's malloc'd.
5388
5389 2004-01-02  Jim Meyering  <jim@meyering.net>
5390
5391         * src/chroot.c: Include "quote.h".
5392         (CHROOT_FOUND_BUT_CANNOT_INVOKE, CHROOT_FAILURE): Define.
5393         (main): Exit with status of 127, not 1, for too-few-args,
5394         chroot failure, or chdir failure.
5395         Give a better diagnostic upon execvp failure.
5396
5397         * src/du.c (usage): Mention that, with its current meaning,
5398         -H is deprecated.
5399
5400         * src/tail.c (main): Warn about following stdin when it's a tty.
5401         Fail when following by name but no names are specified.
5402
5403 2003-12-30  Jim Meyering  <jim@meyering.net>
5404
5405         * src/fold.c (main): Use memcpy, not strcpy.
5406
5407         * src/copy.c (copy_internal): Use ASSIGN_STRDUPA rather than
5408         alloca and strcpy.
5409
5410 2003-12-28  Jim Meyering  <jim@meyering.net>
5411
5412         * src/unexpand.c (n_tabs_allocated): New global.
5413         (add_tabstop): Use x2nrealloc rather than xrealloc.
5414         * src/expand.c: Likewise.
5415
5416         * tests/misc/expand: New file.
5417         * tests/misc/Makefile.am (TESTS): Add expand.
5418
5419         * src/sort.c (add_temp_dir): Use x2nrealloc rather than xrealloc.
5420         (fillbuf): Use x2nrealloc rather than xrealloc.
5421         (sort): Use xnmalloc rather than xmalloc.
5422         (main): Likewise.
5423
5424 2003-12-27  Jim Meyering  <jim@meyering.net>
5425
5426         * src/tee.c (tee): Use xnmalloc rather than xmalloc.
5427
5428 2003-12-29  Paul Eggert  <eggert@twinsun.com>
5429
5430         * NEWS: Remove support for join -j1 FIELD, -j2 FIELD, and -o LIST1
5431         LIST2 in POSIX 1003.1-2001 hosts, as required by POSIX.
5432
5433         * doc/coreutils.texi (join invocation): Remove documentation
5434         accordingly.  Document that -t makes all separators significant.
5435
5436         * src/join.c: Include posixver.h.
5437         (obsolete_usage): New var.
5438         (longopts): Put obsolete options first.
5439         (OBSOLETE_LONG_OPTIONS): New constant.
5440         (get_option, add_file_name): New functions.
5441         (main): Use them to support new behavior.
5442         (usage): Remove documentation for -j1 FIELD and -j2 FIELD.
5443         Do not mark -j FIELD as obsolescent; it is longstanding
5444         UNIX tradition and is a valid extension to POSIX.
5445
5446         * tests/join/Test.pm (tv): Avoid obsolete -o usage.
5447
5448 2003-12-28  Paul Eggert  <eggert@twinsun.com>
5449
5450         * src/join.c (add_field_list): Don't use alloca with unbounded
5451         size; just modify the argument, which is no longer const *.
5452
5453         Various other minor cleanups, mostly to avoid the need for casts.
5454
5455         (extract_field): Renamed from ADD_FIELD, as it's now a function.
5456
5457         (struct field.beg): Now char *, not unsigned char const *.  All
5458         uses changed.  It shouldn't be const since xmemcoll writes on its
5459         arguments.
5460         (extract_field): Likewise, for 2nd arg.
5461         (keycmp): Remove now-unnecessary cast of xmemcoll args.
5462
5463         (is_blank): New function, to avoid need to cast arg to unsigned char.
5464         (extract_field): Use it.
5465
5466         (xfields): Rewrite pretty much from scratch.
5467
5468         (hard_LC_COLLATE): Now bool, not int.
5469         (get_line, getseq, add_field_list): Now returns bool, not int.
5470         (decode_field_spec, add_field_list): Return true on success (not
5471         false), for consistency with the rest of the code.  All uses changed.
5472
5473         (tab): Now char, not unsigned char.  This wasn't 100% necessary
5474         but is slightly cleaner.
5475         (prjoin): Hoist (tab ? tab : ' ') expression, to help the compiler.
5476
5477         (empty_filler): Now const *.
5478
5479         (make_blank): Remove; wasn't needed.  Remove all calls.
5480         (main): Don't set uni_blank.nfields; zero is fine.
5481
5482 2003-12-27  Jim Meyering  <jim@meyering.net>
5483
5484         * src/join.c: Include "quote.h".
5485         (min, max): Remove definitions.
5486         Make a few function parameters and corresponding
5487         locals `const'.  Use bool for boolean variables.
5488         Use size_t (not int) for all counters and related index variables.
5489         (prjoin): Remove now-useless assertion.
5490         (string_to_join_field): New function.
5491         (main): Accept join fields as large as SIZE_MAX.
5492         (keycmp): Rename `min' to MIN and max to MAX.
5493
5494 2003-12-26  Jim Meyering  <jim@meyering.net>
5495
5496         fold -s didn't work on e.g., alpha-based systems.
5497         * src/fold.c (fold_file): Adjust types (int->size_t) so that using
5498         x2nrealloc works properly on systems with differing sizes for int
5499         and size_t.  Reported by Nelson Beebe.
5500
5501         * src/fold.c: Use `bool' (not int) as the type for a few
5502         global variables.
5503
5504 2003-12-23  Paul Eggert  <eggert@twinsun.com>
5505
5506         * src/ls.c (length_of_file_names_and_frills):
5507         Remove forward decl; not needed.
5508         (print_file_name_and_frills, length_of_file_name_and_frills):
5509         With -m, don't output spaces before inum or size.
5510         (print_with_commas): Don't output space just before newline.
5511
5512 2003-12-24  Jim Meyering  <jim@meyering.net>
5513
5514         * tests/ls/Makefile.am (TESTS): Add m-option.
5515         * tests/ls/m-option: New file.  Test for above fixes.
5516
5517 2003-12-20  Jim Meyering  <jim@meyering.net>
5518
5519         * Version 5.1.0.
5520
5521         * src/pr.c: Change type of global, buff_allocated, to size_t.
5522
5523         * src/join.c [struct seq]: Change types of members count and alloc
5524         from `int' to `size_t'.
5525
5526         * tests/Makefile.am (root-hint): Tweak wording.
5527
5528         * src/du.c: Accept new option (-0, --null) that makes it so each
5529         output line is NUL-terminated rather than newline-terminated.
5530
5531         * src/dd.c (apply_translations): Don't prohibit conv=unblock,sync.
5532         Reported by Volker Paul.
5533         * tests/dd/Makefile.am (TESTS): Add unblock-sync.
5534         * tests/dd/unblock-sync: New test for the above.
5535
5536 2003-12-19  Jim Meyering  <jim@meyering.net>
5537
5538         * tests/misc/nohup: Double quote back-ticked expression,
5539         in case it ends up having an unexpected value.
5540
5541         * tests/ls/no-arg: Use ls's -1 option in both runs.
5542
5543         * src/du.c (fts_debug): New global.
5544         (FTS_CROSS_CHECK, DEBUG_OPT): Define.
5545         (main): Make fts use FTS_TIGHT_CYCLE_CHECK.
5546         (main) [DU_DEBUG]: Accept -d option.
5547
5548 2003-12-18  Jim Meyering  <jim@meyering.net>
5549
5550         * src/ls.c (format_user): Increment dired_pos via two statements,
5551         `dired_pos += width; dired_pos++;' rather than one,
5552         `dired_pos += width + 1;' since the latter could conceivably overflow.
5553         (format_group): Likewise.
5554         From Paul Eggert.
5555
5556         * configure.ac: Require automake-1.8.
5557
5558 2003-12-12  Jim Meyering  <jim@meyering.net>
5559
5560         * Use automake-1.8.  Regenerate dependent files.
5561
5562 2003-12-08  Jim Meyering  <jim@meyering.net>
5563
5564         * Makefile.maint (news-date-check): New rule.
5565         (alpha beta major): Depend on it.
5566
5567 2003-12-03  Paul Eggert  <eggert@twinsun.com>
5568
5569         * NEWS: ls -l (and similar options) now adjust all columns to
5570         fit the data.  Generalized from a suggestion by Leah Q for file sizes.
5571         * src/ls.c (INODE_DIGITS, LOGIN_NAME_MAX, ID_LENGTH_MAX): Remove.
5572         (format_user_width, format_group_width, unsigned_file_size,
5573         format_group): New functions.
5574         (block_size_width): Renamed from block_size_size.
5575         (inode_number_width, nlink_width, owner_width, group_width,
5576         author_width, major_device_number_width, minor_device_number_width,
5577         file_size_width): New vars.
5578         (clear_files): Initialize them.
5579         (gobble_file): Set them.  Don't ceiling block_size_width to 7.
5580         (print_long_file): Use them.
5581         (gobble_file): Use a new local variable 'f' to make the code
5582         smaller and more consistent with other functions.
5583         (format_user): Output to stdout, not to a buffer, so that we
5584         don't have to worry about buffer overrun.  Update dired_pos.
5585         (print_long_file): Don't put owner, group, author into buffer;
5586         just print them directly.  Don't assume link counts and
5587         major and minor numbers fit into unsigned long int.
5588         * tests/cp/same-file, tests/mv/part-symlink: Don't assume that
5589         'ls' output is fixed-width.
5590
5591 2003-12-02  Jim Meyering  <jim@meyering.net>
5592
5593         * src/md5sum.c: Include sha1.h (reflect renaming: sha.h -> sha1.h.
5594
5595 2003-11-27  Jim Meyering  <jim@meyering.net>
5596
5597         * Use automake-1.7f.  Regenerate dependent files.
5598
5599 2003-11-24  Paul Eggert  <eggert@twinsun.com>
5600
5601         Parse floating-point operands and options in the C locale.
5602         POSIX requires this for printf, and we might as well be
5603         consistent elsewhere (tail, sleep, seq).
5604
5605         * src/printf.c: Remove decls of strtod, strtol, strtoul; no longer
5606         needed now that we assume C89.  Include "c-strtod.h".
5607         (xstrtod): Call c_strtod, not strtod.
5608         * src/sleep.c: Include "c-strtod.h".
5609         (main): Update xstrtod call to include new argument, c_strtod.
5610         * src/seq.c (scan_double_arg): Likewise.
5611         * src/tail.c (parse_options): Likewise.
5612
5613 2003-11-24  Jim Meyering  <jim@meyering.net>
5614
5615         * tests/rm/fail-2eperm: Handle another errno variant (HPUX, EPERM).
5616         Reported by Mark Conty.
5617
5618 2003-11-22  Jim Meyering  <jim@meyering.net>
5619
5620         * Makefile.maint (sc_xalloc_h_in_src): Remove rule.  Subsumed by...
5621         (sc_system_h_headers): Do this test only if sys2.h exists.
5622
5623 2003-11-20  Jim Meyering  <jim@meyering.net>
5624
5625         * tests/help-version: Ensure that the bug-reporting address is
5626         included in the --help output for every program.
5627         * tests/Makefile.am (TESTS_ENVIRONMENT): Add $PACKAGE_BUGREPORT.
5628
5629         * src/ptx.c (usage): Output bug-reporting address.
5630         Reported by Dan Jacobson.
5631
5632 2003-11-19  Jim Meyering  <jim@meyering.net>
5633
5634         * src/join.c (usage): Mention that FILE1 and FILE2 must be sorted
5635         on the join fields.  Suggestion from Bruce Robertson.
5636
5637 2003-11-18  Jim Meyering  <jim@meyering.net>
5638
5639         `od -c -w9999999' could segfault
5640         * src/od.c (dump): Use xnmalloc/free, not alloca.
5641
5642 2003-11-16  Jim Meyering  <jim@meyering.net>
5643
5644         * Use autoconf-2.59.  Regenerate dependent files.
5645
5646         * tests/du/hard-link: Minor tweak: use mkdir -p.
5647
5648         Fix read-from-free'd-buffer error detected by valgrind.
5649         * src/csplit.c (remove_line): Don't return a pointer to data in
5650         a freed buffer.  Instead, arrange to free the buffer on the
5651         subsequent call.
5652
5653         * tests/misc/csplit: New test for above fix.
5654
5655 2003-11-11  Jim Meyering  <jim@meyering.net>
5656
5657         * src/ls.c (extract_dirs_from_files): Avoid useless copy operations.
5658         This avoids a warning from valgrind about memcpy with overlapping
5659         source and destination.
5660
5661         * configure.ac: Require automake-1.7.8.
5662
5663 2003-11-09  Jim Meyering  <jim@meyering.net>
5664
5665         * Use automake-1.7.9.  Regenerate dependent files.
5666
5667         * src/rm.c: Support new options: --preserve-root and --no-preserve-root.
5668         * src/chown.c: Likewise.
5669
5670         * src/chown-core.c: Include "root-dev-ino.h".
5671         (chopt_init): Initialize new member.
5672         (change_file_owner): Support rm's new --preserve-root option.
5673
5674         * src/remove.c: Include "root-dev-ino.h".
5675         (remove_cwd_entries): Remove now-obsolete FIXME comment.
5676         (remove_dir): Support rm's new --preserve-root option.
5677
5678         * src/chown.c: Include "root-dev-ino.h".
5679         Add new options: --preserve-root and --no-preserve-root.
5680
5681         * src/chmod.c: Include "root-dev-ino.h".
5682         (process_file): Use newly-factored-out ROOT_DEV_INO_CHECK and
5683         ROOT_DEV_INO_WARN macros.
5684         (get_root_dev_ino): Remove function definition, now that it's
5685         been moved to a separate file.
5686         (usage): Describe new options.
5687
5688         * src/mv.c (rm_option_init): Initialized new member.
5689
5690         * src/remove.h: Include "dev-ino.h".
5691         (struct rm_options): Add new member: root_dev_ino.
5692         * src/chown-core.h: Include "dev-ino.h".
5693         (struct Chown_option): Add new member: root_dev_ino.
5694
5695 2003-11-06  Jim Meyering  <jim@meyering.net>
5696
5697         * src/paste.c (paste_parallel): Use `sizeof *var' rather than
5698         hard-coding `sizeof FILE*'.
5699
5700 2003-11-05  Dennis Smit  <ds@nerds-incorporated.org>
5701
5702         * src/wc.c (main): Free `fstatus' so there is no confusion about
5703         whether it's leaked or not.
5704         * src/who.c (who): Likewise for `utmp_buf'.
5705
5706 2003-11-05  Paul Eggert  <eggert@twinsun.com>
5707
5708         Fix 'cut' problems with size_t overflow and unsigned int.
5709         More generally, resize integer variables to fit use more precisely.
5710         * src/cut.c (ADD_RANGE_PAIR): Remove unnecessary parens.
5711         (struct range_pair): Make members to be of type size_t, not unsigned.
5712         (max_range_endpoint, eol_range_start): Now size_t, not unsigned.
5713         (suppress_non_delimited, output_delimiter_specified,
5714         have_read_stdin, print_kth, set_fields): Now bool, nt int.
5715         (delim): Now unsigned char, not int.
5716         (mark_printable_field, is_printable_field, is_range_start_index,
5717         set_fields, set_fields, cut_bytes, cut_fields):
5718         Use size_t, not unsigned, for field and byte counts.
5719         (hash_int): Use uintptr_t, not unsigned, for pointers converted
5720         to integers.  This squeezes more info out of them.
5721         (set_fields, cut_bytes, cut_fields, main):
5722         Use bool, not int, for booleans.
5723         (set_fields): Allocate zeroed byte array with xzalloc, not xcalloc.
5724
5725 2003-11-05  Paul Eggert  <eggert@twinsun.com>
5726
5727         * man/Makefile.am (check-programs-vs-x):
5728         Work even if $(programs) contains '$'.
5729         Work even if 'missing=1' in environment.
5730         Don't report an error simply because $(programs) outputs nothing.
5731
5732 2003-11-05  Jim Meyering  <jim@meyering.net>
5733
5734         * Use autoconf-2.58.  Regenerate dependent files.
5735
5736         * src/tr.c (spec_init): Fix typo in last change.
5737
5738         * src/sys2.h (case_GETOPT_VERSION_CHAR): Cast NULL to `(char *)' in
5739         call to variadic version_etc function, so that it works even on systems
5740         for which sizeof char* != sizeof int.
5741         * src/true.c (main): Likewise.
5742         * basename.c, chroot.c, cksum.c, dd.c, dirname.c, echo.c, expr.c:
5743         * factor.c, hostid.c, hostname.c, link.c, logname.c, nice.c, nohup.c:
5744         * pathchk.c, printenv.c, printf.c, pwd.c, setuidgid.c, sleep.c, stty.c:
5745         * sync.c, test.c, tsort.c, unlink.c, uptime.c, users.c, whoami.c, yes.c:
5746         Similarly, cast NULL to `(char *)' in call to variadic function,
5747         parse_long_options, so that it works even on systems for which
5748         sizeof char* != sizeof int.
5749         A similar problem was reported by Harti Brandt in
5750         http://mail.gnu.org/archive/html/bug-gnu-utils/2003-10/msg00320.html.
5751
5752         * src/users.c (users): Free `utmp_buf' explicitly so that people
5753         don't mistake this for a real leak.
5754         Patch by Dennis Smit <ds@nerds-incorporated.org.
5755
5756 2003-11-04  Paul Eggert  <eggert@twinsun.com>
5757
5758         * README: Document _POSIX2_VERSION.
5759
5760 2003-11-04  Jim Meyering  <jim@meyering.net>
5761
5762         * src/tac.c (memrchr): Remove #if-0'd function.
5763         (tac_stdin_to_mem): Clean up #if-0'd code.
5764
5765         * src/od.c (decode_format_string): Remove unnecessary casts.
5766         Use more maintainable `sizeof *var'.
5767         (main): Call decode_format_string rather than decode_one_format,
5768         now that `spec' may be NULL.
5769
5770         * src/chmod.c (AUTHORS): Add my name.
5771
5772         * src/split.c (next_file_name): Use `sizeof *var' rather than
5773         hard-coding `sizeof size_t'.
5774
5775         * src/sort.c (new_key): Use xzalloc, not xcalloc (1, ...).
5776
5777         * src/cut.c (ADD_RANGE_PAIR): Use x2nrealloc rather than xrealloc,
5778         to avoid potential overflow in pointer arithmetic.
5779         (set_fields): Use not `1', but rather `sizeof *printable_field' as
5780         second argument to xcalloc.
5781         * src/od.c (decode_format_string, dump_strings): Use x2nrealloc
5782         rather than xrealloc.
5783         * src/date.c (show_date): Likewise.
5784         * src/join.c (ADD_FIELD, initseq, getseq): Likewise.
5785         * src/pr.c (store_char): Likewise.
5786         * src/fold.c (fold_file): Likewise.
5787
5788         * src/copy.c (triple_hash, triple_hash_no_name): Adjust to reflect
5789         type changes (unsigned int -> size_t) in hash.c.
5790         * src/cp-hash.c (src_to_dest_hash): Likewise.
5791         * src/du.c (entry_hash): Likewise.
5792         * src/ls.c (dev_ino_hash): Likewise.
5793         * src/cut.c (hash_int): Likewise.  Declare function as static.
5794
5795 2003-11-03  Jim Meyering  <jim@meyering.net>
5796
5797         * tests/misc/Makefile.am (TESTS_ENVIRONMENT): Define PACKAGE_VERSION.
5798         * tests/misc/fold: Fail the test immediately if we're not running
5799         the expected version of fold.
5800
5801 2003-11-02  Jim Meyering  <jim@meyering.net>
5802
5803         * src/tr.c (append_normal_char, append_range, append_char_class)
5804         (append_repeated_char, append_equiv_class, spec_init): Use `sizeof *var'
5805         rather than `sizeof EXPLICIT_TYPE'.  The former is more maintainable
5806         and usually shorter.
5807         * src/copy.c (copy_internal): Likewise.
5808         * src/join.c (initseq, add_field, make_blank): Likewise.
5809         * src/od.c (main): Likewise.
5810         * src/cp.c (make_path_private): Likewise.
5811         * src/tsort.c (new_item, record_relation): Likewise.
5812
5813         * src/df.c (add_fs_type, add_excluded_fs_type, main): Likewise.
5814         (main): Also remove anachronistic cast of xmalloc return value.
5815         * src/ptx.c (alloc_and_compile_regex, main): Likewise.
5816         (main): Also remove anachronistic cast of xmalloc return value.
5817         * src/sort.c (inittables): Likewise.
5818         (sort): Also Split a long line.
5819
5820 2003-10-25  Jim Meyering  <jim@meyering.net>
5821
5822         * src/copy.c (triple_hash, triple_hash_no_name): Adjust to reflect
5823         type changes (unsigned int -> size_t) in hash.c.
5824         * src/cp-hash.c (src_to_dest_hash): Likewise.
5825         * src/du.c (entry_hash): Likewise.
5826         * src/ls.c (dev_ino_hash): Likewise.
5827         * src/cut.c (hash_int): Likewise.  Declare function as static.
5828
5829 2003-10-21  Jim Meyering  <jim@meyering.net>
5830
5831         Don't fail when run with VERBOSE=yes.
5832         * tests/chgrp/basic: Do `set +x' before starting the subshell
5833         from which we invoke chgrp.  Otherwise, the output from the
5834         VERBOSE=yes-induced `set -x' would result in spurious differences.
5835         Reported by Russel Coker via Michael Stone.
5836
5837 2003-10-19  Jim Meyering  <jim@meyering.net>
5838
5839         chmod now uses fts to perform a directory traversal when -R is
5840         specified.  Before, it operated on full path names, and as such
5841         would encounter the PATH_MAX (often 4096) limit.
5842
5843         * src/chmod.c: Include "xfts.h".
5844         (process_file): Rename from change_file_mode.
5845         Adapt to be used with fts.
5846         (process_files): New function.
5847
5848 2003-10-18  Jim Meyering  <jim@meyering.net>
5849
5850         * tests/du/deref-args: Ensure that du -D now dereferences all
5851         symlinks specified on the command line, not just those that
5852         reference directories.
5853
5854         * basename.c, cat.c, chroot.c, cksum.c, comm.c, cp.c, csplit.c, cut.c:
5855         * dd.c, df.c, dirname.c, du.c, echo.c, env.c, expr.c, factor.c, head.c:
5856         * hostid.c, hostname.c, id.c, link.c, ln.c, logname.c, ls.c, md5sum.c:
5857         * mv.c, nice.c, nl.c, nohup.c, paste.c, pathchk.c, pinky.c, pr.c:
5858         * printenv.c, printf.c, pwd.c, rm.c, setuidgid.c, sleep.c, sort.c:
5859         * split.c, stty.c, sum.c, sync.c, tac.c, tail.c, tee.c, test.c:
5860         * touch.c, tsort.c, uniq.c, unlink.c, uptime.c, users.c, wc.c:
5861         * who.c, whoami.c, yes.c (AUTHORS): Revert the WRITTEN_BY/AUTHORS change
5862         of 2003-09-19.  Now, AUTHORS is a comma-separated list of strings.
5863         Update the call to parse_long_options so that `AUTHORS, NULL' are the
5864         last parameters.
5865         * src/true.c (main): Append NULL to version_etc argument list.
5866         * src/sys2.h (case_GETOPT_VERSION_CHAR): Likewise.
5867
5868 2003-10-17  Andreas Schwab  <schwab@suse.de>
5869
5870         * tests/mk-script: Get $srcdir from first parameter instead of
5871         hardcoding it.
5872         (main): Update usage.
5873
5874         * tests/Makefile.am.in ($(srcdir)/$x-tests): Pass $(srcdir) as
5875         first argument of mk-script.
5876         ($(srcdir)/Makefile.am): Likewise.  Prepend $(srcdir) to target.
5877
5878 2003-10-17  Jim Meyering  <jim@meyering.net>
5879
5880         * src/mv.c (usage): Tweak descriptions of -i and -f so that the
5881         generated `man' page is more readable.  Suggestion from Dan Jacobson.
5882
5883         * src/chown-core.c (change_file_owner): Handle the cases in
5884         which fts_info indicates an error with the given entry.
5885
5886         * src/du.c (main): Simply assign to bit_flags.
5887         Don't bother with bit arithmetic.
5888
5889         * tests/chmod/no-x: New file.
5890         * tests/chgrp/no-x: New file.
5891         * tests/chmod/Makefile.am (TESTS): Add no-x.
5892         * tests/chgrp/Makefile.am (TESTS): Likewise.
5893
5894         * src/du.c: Include "xfts.h".
5895         (du_files): Use xfts_open, rather than fts_open.
5896         * src/chown-core.c (chown_files): Likewise.
5897
5898 2003-10-16  Jim Meyering  <jim@meyering.net>
5899
5900         * src/chgrp.c (main): Simply assign to bit_flags.
5901         Don't bother with bit arithmetic.
5902         * src/chown.c (main): Likewise.
5903         Rename a couple of local variables.
5904         Remove unnecessary casts.
5905
5906         * src/tail.c (start_bytes): Rename local, remainder, to avoid
5907         gcc's warning about shadowing a global.
5908
5909 2003-10-15  Jim Meyering  <jim@meyering.net>
5910
5911         chown and chgrp now accept POSIX-mandated -H, -L, -P options and
5912         use fts to perform a directory traversal when -R is specified.
5913         Before, they operated on full path names, and as such would
5914         encounter the PATH_MAX (often 4096) limit.
5915         They are more efficient.  For example, before, chgrp -R would
5916         take almost 5 seconds to change about 2000 directories and fail
5917         (with `File name too long'), while now it succeeds on a hierarchy
5918         of depth 20,000 in 1/10 the time.
5919
5920         * src/chown.c: Include "userspec.h" and "fts_.h".
5921         (WRITTEN_BY): Add my name.
5922         (getpwnam, getgrnam, getgrgid): Remove declarations.
5923         (endpwent): Remove definition.
5924         (usage): Update.
5925         (main): Handle new options.
5926         Call new function, chown_files rather than change_file_owner.
5927
5928         * src/chgrp.c: Include "fts_.h".
5929         (WRITTEN_BY): Add my name.
5930         (MAXUID, MAXGID): Remove definitions.  Use GID_T_MAX instead of
5931         the latter.
5932         (usage): Update.
5933         (main): Handle new options.
5934         Call new function, chown_files rather than change_file_owner.
5935
5936         Rewrite to iterate through hierarchies using fts rather than
5937         via explicit recursion.
5938         * src/chown-core.c: Include "fts_.h"
5939         (change_file_owner): Rewrite to use FTS* and FTSENT* and to operate
5940         on a single file at a time.
5941         (chown_files): New function.
5942         * src/chown-core.h [enum Dereference_symlink]: Remove declaration.
5943         [struct Chown_option] (recurse, force_silent): Change type to `bool'.
5944         [struct Chown_option] (dereference): Remove member with ambiguous name.
5945         [struct Chown_option] (affect_symlink_referent): New member.
5946         (chown_files): New prototype.
5947
5948         * tests/chgrp/recurse: Update tests accordingly.
5949         * tests/chgrp/posix-H: New tests for the above.
5950         * tests/chgrp/Makefile.am (TESTS): Add posix-H.
5951
5952         * src/ln.c (usage): Clarify that --directory, -d, -F probably won't
5953         work even for superuser.  Suggestion from Dan Jacobson.
5954
5955 2003-10-14  Paul Eggert  <eggert@twinsun.com>
5956
5957         Fix some number-parsing bugs, e.g., "head -n 100k@" wasn't
5958         properly diagnosed.
5959         * lib/human.c, lib/xstrtoimax.c, lib/xstrtol.c, lib/xstrtol.h,
5960         lib/xstrtoul.c, lib/xstrtoumax.c: Sync with gnulib.
5961         * src/sort.c (parse_field_count): Handle the case where overflow
5962         and invalid suffix char are both reported.
5963
5964 2003-10-14  Jim Meyering  <jim@meyering.net>
5965
5966         * src/ls.c (decode_switches) [TIOCGWINSZ]: Comment out the
5967         warning-inducing test, ws.ws_col <= SIZE_MAX, since it was always
5968         true on Linux.
5969
5970 2003-10-13  Paul Eggert  <eggert@twinsun.com>
5971
5972         Fix to avoid a denial-of-service attack if the display width is
5973         enormous.  Also, clean up the code a bit by removing duplicate code.
5974
5975         * src/ls.c (init_column_info): Remove forward decl; no longer needed.
5976         (calculate_columns): New function, that contains code that used
5977         to be common to print_many_per_line and print_horizontal.
5978         (print_many_per_line, print_horizontal): Use it.
5979         (decode_switches): Set max_idx here, not in calculate_columns.
5980         (print_current_files): Don't call init_column_info; calculate_columns
5981         now does that.
5982         (init_column_info): Don't allocate a lot more space than is needed
5983         to represent the current set of files.  Allocate all the new
5984         size_t cells in one call to xnmalloc, rather than a row at a time.
5985
5986 2003-10-13  Jim Meyering  <jim@meyering.net>
5987
5988         * src/ls.c (init_column_info): Add another FIXME comment.
5989
5990 2003-10-13  Paul Eggert  <eggert@twinsun.com>
5991
5992         Fix address-arithmetic bug in 'ls', reported by Georgi Guninski.
5993         Remove several arbitrary limits on hosts where int cannot represent
5994         all size_t values.
5995
5996         * src/ls.c (struct bin_str.len, length_of_file_name_and_frills, indent,
5997         nfiles, files_index, tabsize, line_length, struct column_info.line_len,
5998         struct column_info.col_arr[0], max_idx):
5999         Now size_t, not int.
6000         (get_funky_string): Return bool indicating success, instead of
6001         a negative count to indicate failure.  Store number of columns
6002         through new parameter OUTPUT_COUNT; that way, they can never
6003         go negative.  Change equals_end from int to bool.  All uses
6004         changed.
6005         (struct column_info.valid_len): Now bool, not int.  All uses changed.
6006         (dired_dump_obstack, get_funky_string, clear_files,
6007         extract_dirs_from_files, print_current_files,
6008         print_many_per_line, print_horizontal, init_column_info,
6009         put_indicator, length_of_file_name_and_frills,
6010         print_with_commas): Use size_t, not int, for local variables
6011         that count sizes.
6012         (decode_switches): Decode sizes using xstrtoul, not xstrtol.
6013         Check for TIOCGWINSZ returing negative values (or values greater
6014         than SIZE_MAX!).
6015         (visit_dir, main, parse_ls_color, queue_directory, add_ignore_pattern,
6016         init_column_info):
6017         Use xmalloc and xnmalloc, not XMALLOC.
6018         (gobble_file): Use xnrealloc, not XREALLOC.
6019         (print_color_indicator): Remove now-unnecessary cast to size_t.
6020
6021 2003-10-12  Paul Eggert  <eggert@twinsun.com>
6022
6023         * tests/du/no-x: Change wording of diagnostic to match latest du.c.
6024         * tests/sort/sort-tests: Remove from CVS; assume that people
6025         brave enough to check coreutils out from CVS can rebuild it.
6026
6027 2003-10-12  Jim Meyering  <jim@meyering.net>
6028
6029         New options: --preserve-root and --no-preserve-root.
6030         * src/chmod.c (change_file_mode): Honor new option.
6031         (change_file_mode): Strip trailing slashes on directory
6032         argument passed to change_dir_mode.
6033         (get_root_dev_ino): New function.
6034         (main): Initialize global, root_dev_ino.
6035
6036         * src/copy.c (copy_internal): Don't #ifdef-out simple uses of
6037         S_ISLNK or S_ISSOCK.  The S_IS* macros are guaranteed to be defined
6038         via system.h.
6039         * src/chmod.c (change_file_mode): Likewise.
6040
6041 2003-10-08  Jim Meyering  <jim@meyering.net>
6042
6043         * src/csplit.c (main): Remove obsolete FIXME.
6044
6045 2003-10-07  Jim Meyering  <jim@meyering.net>
6046
6047         * Use automake-1.7.8.  Regenerate dependent files.
6048
6049 2003-09-29  Paul Eggert  <eggert@twinsun.com>
6050
6051         csplit cleanup.
6052
6053         * doc/coreutils.texi (csplit invocation):
6054         The regexp offset need not have a sign; POSIX requires support
6055         for signless offets.
6056
6057         Be more careful about int widths.  For example, remove some
6058         arbitrary limits by replacing 'unsigned' with 'size_t',
6059         'uintmax_t', etc.  Use standard bool rather than a homegrown type.
6060         * lib/Makefile.am (libfetish_a_SOURCES): Add xstrtoimax.c.
6061         * src/csplit.c (FALSE, TRUE, boolean): Remove.  All uses changed
6062         to <stdbool.h> usage.
6063         (struct control): offset is now intmax_t, not int.
6064         repeat_forever is now bool, not int.
6065         (struct cstring): len is now size_t, not unsigned int.
6066         (struct buffer_record): bytes_alloc, bytes_used, num_lines are now
6067         size_t, not unsigned.  start_line, first_available are now
6068         uintmax_t, not unsigned.
6069         (hold_count, control_used): Now size_t, not unsigned.
6070         (last_line_number, current_line, bytes_written):
6071         Now uintmax_t, not unsigned.
6072         (save_to_hold_area, red_input, keep_new_line, record_line_starts,
6073         create_new_buffer, get_new_buffer, load_buffer, find_line,
6074         process_regexp, split_file, new_control_record, extract_regexp,
6075         get_format_width, get_format_prec, max_out):
6076         size args, locals, and returned values are now size_t, not unsigned
6077         or int.
6078         (get_first_line_in_buffer, find_line, write_to_file,
6079         handle_line_error, process_line_count, regexp_error, process_regexp,
6080         split_file):
6081         File line, byte, and repetition counts are now uintmax_t, not unsigned.
6082         (check_for_offset): Don't require a sign before the offset.
6083         Use xstrtoimax to do the real work.
6084         (extract_regexp): Remove harmful cast of size to unsigned.
6085         256 -> 1<<CHAR_BIT, for clarity.
6086         (get_format_flags): Return at most 3, to avoid worries about overflow.
6087
6088         (bytes_to_octal_digits): Remove.
6089
6090         (cleanup): Don't check whether output_stream is NULL, since
6091         close_output_file does that for us.
6092
6093         (new_line_control, create_new_buffer): Use "foo *p = xmalloc
6094         (sizeof *p);" instead of the more long-winded alternatives.
6095
6096         (get_new_buffer): Use O(1) algorithm for resizing a buffer
6097         to a much larger size, instead of an O(N) algorithm.
6098
6099         (process_regexp): Use plain NULL rather than casted 0.
6100
6101         (make_filename): Use %u, not %d, to format unsigned file number.
6102
6103         (new_control_record): Use xrealloc exclusively, since it handles
6104         NULL reliably.
6105
6106         (extract_regexp): Change misspelled word in diagnostic.
6107
6108         (get_format_width): Even if a minimum field width is specified,
6109         allow room for enough octal digits to represent the value of
6110         the maximum representible integer.  This fixes a potential
6111         buffer overrun.  Calculate this room at compile-time, not
6112         at run-time; this removes the need for bytes_to_octal_digits.
6113         Check for overflow; this removes a FIXME.
6114
6115         (get_format_prec): Don't allow precision to be signed; it's
6116         not ANSI.  Check for overflow.  Remove hardcoded "11" as
6117         default precision; this fixes a potential buffer overrun
6118         on hosts with wider size_t.
6119
6120         (get_format_conv_type): Change local variable to be of type
6121         unsigned char, not int; this removes a potential subscript
6122         violation on hosts where char is signed.
6123
6124         (max_out): Replace "for (;*p;)" with more-standard "while (*p)".
6125         Allow "%%" in format.  Don't overflow when
6126         counting lots of percents.
6127
6128         (usage): Default sprintf format is %02u, not %d.
6129
6130 2003-10-05  Jim Meyering  <jim@meyering.net>
6131
6132         * src/chown-core.c (change_file_owner): Remove set-but-not-used local.
6133
6134         * src/du.c (du_files): Mark diagnostic for translation.
6135
6136 2003-10-04  Jim Meyering  <jim@meyering.net>
6137
6138         * src/du.c (du_files): Ignore any failure of fts_close.
6139         Give better diagnostics for failed fts_open.
6140
6141         * src/du.c (MAX_N_DESCRIPTORS): Remove now-unused definition.
6142
6143         Deprecate existing use of -H (aka --si).
6144         * src/du.c (enum) [HUMAN_SI_OPTION]: New member.
6145         [long_options]: Use HUMAN_SI_OPTION, not 'H'.
6146         (main): Warn that the meaning of -H will soon change to be
6147         POSIX compliant.
6148
6149 2003-10-03  Jim Meyering  <jim@meyering.net>
6150
6151         * src/du.c: Accept --no-dereference (-P).
6152
6153 2003-10-02  Jim Meyering  <jim@meyering.net>
6154
6155         * tests/du/trailing-slash: Adjust for slightly different output.
6156
6157         Rewrite du.c to use fts.
6158         * src/du.c: Include "fts_.h", not ftw.h.
6159         (opt_dereference_arguments, arg_length, suffix_length): Remove globals.
6160         (IS_FTW_DIR_TYPE): Remove definition.
6161         (IS_DIR_TYPE): Define.
6162         (is_symlink_to_dir): Remove now-unnecessary function.
6163         (process_file, du_files): Rewrite to use fts.
6164
6165         * tests/du/inaccessible-cwd: Ensure that even when run from an
6166         inaccessible directory, du can still operate on accessible
6167         directories elsewhere.
6168         * tests/du/Makefile.am (TESTS): Add inaccessible-cwd.
6169
6170         * tests/rm/deep-1: Ensure that du can process a hierarchy
6171         of depth 400 while using no more than 50KB of stack space.
6172
6173 2003-10-01  Akim Demaille  <akim@epita.fr>
6174
6175         * announce-gen (print_news_deltas): New function, extracted from main.
6176         (main): Make `news_file' an array.
6177         Use '...=s' => \@var for --news and --url-directory specs.
6178         Before there were a couple of portability problems.
6179
6180 2003-09-28  Jim Meyering  <jim@meyering.net>
6181
6182         * Makefile.maint (sc_cast_of_alloca_return_value): New rule.
6183         (syntax-check-rules): Add it.
6184
6185         * src/copy.c: Remove unnecessary cast of alloca, since now it's
6186         guaranteed to be (void *).
6187         * src/cp.c: Likewise.
6188         * src/join.c: Likewise.
6189         * src/ln.c: Likewise.
6190         * src/ls.c: Likewise.
6191         * src/od.c: Likewise.
6192         * src/sys2.h (ASSIGN_STRDUPA): Likewise.
6193
6194 2003-09-27  Jim Meyering  <jim@meyering.net>
6195
6196         Don't exhaust virtual memory when processing large inputs.
6197         Fix this by removing csplit's internal free-list management;
6198         instead rely on malloc for that.
6199
6200         * src/csplit.c (free_list): Remove global.
6201         (clear_all_line_control): Remove function.
6202         (get_new_buffer): Always use create_new_buffer to obtain a
6203         new buffer, rather than searching free_list.
6204         (free_buffer): Just call free.
6205         Reported by Nikola Milutinovic.
6206
6207 2003-09-26  Jim Meyering  <jim@meyering.net>
6208
6209         * man/rm.x: Also list `chattr' in SEE ALSO section.
6210         Suggestion from Mark Hubbart.
6211
6212 2003-09-25  Jim Meyering  <jim@meyering.net>
6213
6214         * configure.ac: Don't invoke AC_AIX or AC_MINIX explicitly, now
6215         that we use gl_USE_SYSTEM_EXTENSIONS, since it AC_REQUIREs them.
6216
6217         * Use autoconf-2.57d.  Regenerate dependent files.
6218
6219 2003-09-24  Jim Meyering  <jim@meyering.net>
6220
6221         Minor efficiency tweak.
6222         * src/ln.c (PATH_BASENAME_CONCAT): Use memcpy rather than strcpy.
6223         (do_link): Likewise.
6224
6225 2003-09-23  Jim Meyering  <jim@meyering.net>
6226
6227         * src/paste.c (paste_serial): Save errno after input error,
6228         to report proper errno value.
6229         Based on a patch from Paul Eggert.
6230
6231         * src/tee.c (tee): Adjust fwrite arguments so that the return
6232         value is the number of bytes written.
6233
6234 2003-09-16  Paul Eggert  <eggert@twinsun.com>
6235
6236         Don't assume ferror sets errno.  Bug reported by Bruno Haible.
6237
6238         * src/comm.c (compare_files): Save errno after input error,
6239         to report proper errno value.
6240         * src/fold.c (fold_file): Likewise.
6241         * src/od.c (check_and_close, skip, read_char, read_block): Likewise.
6242         * src/unexpand.c (unexpand): Likewise.
6243
6244         * src/csplit.c (close_output_file): Don't report bogus errno value
6245         after ferror discovers an output error.  We don't know the proper
6246         errno value, since it might have been caused by any of a whole
6247         bunch of calls, and it might have been trashed in the meantime.
6248         Fixing this problem will require much more extensive changes;
6249         in the meantime just say "write error".
6250         * src/od.c (check_and_close, dump, dump_strings): Likewise.
6251         * src/uniq.c (check_file): Likewise.
6252
6253         * src/join.c (get_line): Report error right away if I/O fails,
6254         so that the proper errno value is used.
6255         * src/tac.c (tac_seekable, tac_file, save_stdin): Likewise.
6256         * src/tee.c (tee): Likewise.
6257         * src/uniq.c (check_file): Likewise.
6258
6259         * src/od.c (skip): If a read fails, don't retry it later, so
6260         that we report the proper errno.
6261
6262         * src/tac.c (tac_mem): Don't return a value; nobody uses it.
6263
6264         * src/tee.c (tee): Once a write failure has occurred, don't bother
6265         writing anything more to that stream.
6266
6267         * src/uniq.c (check_file): Check for ferror (stdout) even if
6268         ostream == stdout.
6269
6270         * src/yes.c (UNROLL): Remove.
6271         (main): Exit immediately when write failure is detected.
6272         Simplify code by assigning to argv when argc == 1.
6273
6274 2003-09-21  Paul Eggert  <eggert@twinsun.com>
6275
6276         * src/ptx.c: Switch encoding from Latin-1 to UTF-8.
6277         (WRITTEN_BY): Change "Franc,ois" (actually using
6278         c-with-cedilla in Latin-1) to "F.", so that it's ASCII, as
6279         xgettext requires.
6280
6281 2003-09-19  Jim Meyering  <jim@meyering.net>
6282
6283         `du -D symlink-to-dir' would mistakenly omit the slash in
6284         lines like this: 24     symlink-to-dir/subdir
6285         * src/du.c (process_file): Fix offset calculation.
6286         Reported by Jeff Sheinberg as Debian bug #211591;
6287         http://bugs.debian.org/205251
6288
6289         * tests/du/deref-args: New file/test for the above.
6290         * tests/du/Makefile.am (TESTS): Add deref-args.
6291
6292         * src/du.c (process_file): Remove useless disjunct.
6293
6294         * src/sys2.h (case_GETOPT_VERSION_CHAR): Rename parameter, Authors,
6295         to Written_by.
6296         * nearly all src/*.c files (WRITTEN_BY): Rename from AUTHORS.
6297         Begin each WRITTEN_BY string with `Written by ' and end it with `.'.
6298         Mark each WRITTEN_BY string as translatable.
6299
6300         * basename.c, cat.c, chroot.c, cksum.c, comm.c, cp.c, csplit.c, cut.c:
6301         * dd.c, df.c, dirname.c, du.c, echo.c, env.c, expr.c, factor.c, head.c:
6302         * hostid.c, hostname.c, id.c, link.c, ln.c, logname.c, ls.c, md5sum.c:
6303         * mv.c, nice.c, nl.c, nohup.c, paste.c, pathchk.c, pinky.c, pr.c:
6304         * printenv.c, printf.c, pwd.c, rm.c, setuidgid.c, sleep.c, sort.c:
6305         * split.c, stty.c, sum.c, sync.c, tac.c, tail.c, tee.c, test.c:
6306         * touch.c, tsort.c, uniq.c, unlink.c, uptime.c, users.c, wc.c:
6307         * who.c, whoami.c, yes.c: Revert yesterday's changes.
6308         Instead, a subsequent change will embed `Written by ' in
6309         each string along with the author names.
6310
6311         * src/true.c: Revert yesterday's changes.
6312         * src/sys2.h: Likewise.
6313
6314 2003-09-18  Jim Meyering  <jim@meyering.net>
6315
6316         * basename.c, cat.c, chroot.c, cksum.c, comm.c, cp.c, csplit.c, cut.c:
6317         * dd.c, df.c, dirname.c, du.c, echo.c, env.c, expr.c, factor.c, head.c:
6318         * hostid.c, hostname.c, id.c, link.c, ln.c, logname.c, ls.c, md5sum.c:
6319         * mv.c, nice.c, nl.c, nohup.c, paste.c, pathchk.c, pinky.c, pr.c:
6320         * printenv.c, printf.c, pwd.c, rm.c, setuidgid.c, sleep.c, sort.c:
6321         * split.c, stty.c, sum.c, sync.c, tac.c, tail.c, tee.c, test.c:
6322         * touch.c, tsort.c, uniq.c, unlink.c, uptime.c, users.c, wc.c:
6323         * who.c, whoami.c, yes.c: Update AUTHORS definition to be a
6324         comma-separated list of strings and/or update the call to
6325         parse_long_options so that `AUTHORS, NULL' are the last parameters.
6326         * src/true.c (main): Append NULL to version_etc argument list.
6327         * src/sys2.h (case_GETOPT_VERSION_CHAR): Likewise.
6328
6329         * src/sort.c (numcompare): Rename local, logb, to log_b to avoid
6330         shadowing the math function name.  Also rename loga to log_a.
6331
6332 2003-09-14  Jim Meyering  <jim@meyering.net>
6333
6334         * src/factor.c (print_factors): Give a separate diagnostic
6335         for numbers that are too large, but otherwise valid.
6336         Reported by Dániel Varga.
6337
6338 2003-09-10  Jim Meyering  <jim@meyering.net>
6339
6340         * Use automake-1.7.7.  Regenerate dependent files.
6341
6342         * tests/Makefile.am (all_programs): Use ../src/tr -s ' ' '\n' in place
6343         of `fmt -1'.  Using the just-built tr is a little cleaner.
6344         Christian Krackowizer reported that HPUX 10.20 doesn't have fmt.
6345         * man/Makefile.am (programs, check-x-vs-1): Likewise.
6346
6347 2003-09-09  Jim Meyering  <jim@meyering.net>
6348
6349         * src/copy.c: Alphabetize includes.
6350         Remove duplicate inclusion of "same.h".
6351
6352 2003-09-08  Jim Meyering  <jim@meyering.net>
6353
6354         * Makefile.maint (GZIP_ENV): Remove --rsyncable.
6355         Didn't give enough of a benefit, mainly because it's not yet
6356         in wide enough use.
6357
6358         * Version 5.0.91.
6359
6360         * man/Makefile.am (programs): Use ../src, not $(srcdir)/../src.
6361         (check-programs-vs-x): Fail if $(programs) is empty.
6362
6363         * src/remove.c: Add a comment.
6364
6365 2003-09-07  Jim Meyering  <jim@meyering.net>
6366
6367         * src/remove.c (D_INO, ENABLE_CYCLE_CHECK) [D_INO_IN_DIRENT]:
6368         Don't define.  These symbols are no longer used.
6369
6370         * tests/misc/tty-eof: Write ^D as \cD.
6371         Complete the change of 2003-08-02.
6372
6373         * Makefile.maint (po-check): Use cvsu, so that a temporary source
6374         file in lib/ or src/ doesn't induce an unwarranted failure.
6375         Add a kludge to filter out the sole generated source file that
6376         also has translatable messages: src/false.c.
6377
6378 2003-09-06  Jim Meyering  <jim@meyering.net>
6379
6380         * src/tail.c (enum): Add ALLOW_MISSING_OPTION.
6381         (parse_options): Give a diagnostic for (but still accept) the
6382         deprecated --allow-missing option.
6383
6384 2003-09-04  Paul Eggert  <eggert@twinsun.com>
6385
6386         Don't ignore -S if input is a pipe.  Bug report by Michael McFarland in
6387         <http://mail.gnu.org/archive/html/bug-coreutils/2003-09/msg00008.html>.
6388
6389         * src/sort.c (sort_buffer_size): Omit SIZE_BOUND arg.  Compute the
6390         size_bound ourselves. if an input file is a pipe and the user
6391         specified a size, use that size instead of trying to guess the
6392         pipe size.  This has the beneficial side effect of avoiding the
6393         overhead of default_sort_size in that case.  All callers changed.
6394         (sort): Remove static var size; now done by sort_buffer_size.
6395
6396 2003-09-05  Jim Meyering  <jim@meyering.net>
6397
6398         * Use automake-1.7.6b and autoconf-2.57b.  Regenerate dependent files.
6399
6400         * tests/tail-2/tail-n0f: Wait .5 seconds for backgrounded process
6401         to start, rather than just .1.  Upon failure, print unexpected state.
6402
6403 2003-09-04  Paul Eggert  <eggert@twinsun.com>
6404
6405         * src/head.c (elide_tail_lines_pipe): Don't assign 0 or
6406         SAFE_READ_ERROR to tmp->nbytes.
6407         * src/tail.c (pipe_lines, pipe_bytes): Likewise.
6408
6409         * src/head.c (struct linebuffer): Change nbytes and nlines
6410         from unsigned int to size_t.  unsigned int is safe (after the
6411         2003-09-03 patch) but size_t is cleaner.
6412         * src/tail.c (struct linebuffer, struct charbuffer): Likewise.
6413         (pipe_bytes): Likewise for local variable 'i', which was 'int'.
6414
6415         Standardize on BUFSIZ as opposed to other macro names and values.
6416         * src/head.c (BUFSIZE): Remove.  All uses changed to BUFSIZ.
6417         * src/tail.c (BUFSIZ) [!defined BUFSIZ]: Remove.
6418         stdio.h has always defined it,
6419         and other code already assumes it's defined.
6420         * src/tr.c (BUFSIZ) [!defined BUFSIZ]: Likewise.
6421         (IO_BUF_SIZE): Remove; replace all uses with sizeof io_buf.
6422         (io_buf): IO_BUF_SIZE -> BUFSIZ.
6423
6424 2003-09-04  Paul Eggert  <eggert@twinsun.com>
6425
6426         * src/seq.c (step): Default to 1.
6427         (print_numbers): Allow the output to be empty.
6428         (main): The default step is 1, even if LAST < FIRST;
6429         as per documentation.
6430         * tests/seq/basic (onearg-2): Output should be empty.
6431
6432 2003-09-05  Jim Meyering  <jim@meyering.net>
6433
6434         * Makefile.cfg (wget_files): Temporarily disable, until master
6435         versions are restored to ftp.gnu.org.
6436
6437         * configure.ac (AM_INIT_AUTOMAKE): Specify automake-1.7.6.
6438
6439         Make seq's --width (-w) option work properly even when the
6440         endpoint requiring the larger width is negative and smaller than
6441         the other endpoint.
6442         * src/seq.c (get_width_format): Include `-' in the set of bytes
6443         allowed in a `simple' number (no decimal point, no exponent).
6444         Reported by Patrick Mauritz.
6445
6446 2003-09-02  Paul Eggert  <eggert@twinsun.com>
6447
6448         * NEWS: sort -t '\0' now uses a NUL tab.
6449         sort option order no longer matters, unless POSIX requires it.
6450         * src/sort.c (usage): Say "blanks" instead of "whitespace",
6451         Similar fixes for many comments.
6452         (TAB_DEFAULT): New constant, so that we can support NUL as
6453         the field separator.
6454         (tab): Now int, not char.  Initialize to TAB_DEFAULT.
6455         (specify_sort_size): If multiple sizes are specified, use the largest.
6456         (begfield, limfield): Support NUL tab char.
6457         (set_ordering): Do not let -i override -d.
6458         (main): Report an error if incompatible -o or -t options are given.
6459         Report an error for "-t ''".  Allow "-t '\0'" to specify a NUL tab.
6460
6461 2003-09-05  Jim Meyering  <jim@meyering.net>
6462
6463         * tests/sort/Test.pm [o2, nul-tab]: New tests for the above.
6464
6465 2003-09-03  Andreas Schwab  <schwab@suse.de>
6466
6467         Bug report and patch here:
6468         <http://mail.gnu.org/archive/html/bug-coreutils/2003-09/msg00009.html>
6469         * src/tail.c (pipe_lines): Don't truncate return value from safe_read.
6470         * src/head.c (elide_tail_lines_pipe): Likewise.
6471
6472 2003-09-03  Jim Meyering  <jim@meyering.net>
6473
6474         * src/du.c (AUTHORS): Remove Larry McVoy's name, since the relatively
6475         small amount of code from him was first moved to lib/human.c, and was
6476         subsequently rewritten entirely.
6477         * src/df.c (AUTHORS): Likewise.
6478
6479 2003-08-22  Lawrence Teo  <lcteo@uncc.edu>
6480
6481         * src/md5sum.c (split_3): Accept the BSD format for generic
6482         message digest modes.  Currently works with BSD's MD5 and SHA1
6483         formats since these are the two algorithms presently used in
6484         coreutils.  Updated comments to reflect this change.
6485         (bsd_split_3): Updated comments.
6486
6487         * tests/md5sum/basic-1: New test to make sure that
6488         `md5sum --check' doesn't accept the BSD SHA1 format (adapted
6489         from `check-bsd' test in tests/sha1sum/basic-1).
6490
6491         * tests/sha1sum/basic-1 (check-bsd2, check-bsd3): New tests for
6492         --check exit status and BSD SHA1 format (adapted from tests
6493         in tests/md5sum/basic-1).
6494
6495 2003-08-30  Jim Meyering  <jim@meyering.net>
6496
6497         * src/ln.c (do_link): Use SAME_INODE rather than open-coding it.
6498
6499         When source and destination arguments refer to the same file, reside
6500         on a partition (e.g. VFAT) on which distinct names may refer to the
6501         same directory entry (often due to variations in case), and when the
6502         link count for the file is 1, mv no longer unlinks the file.  Instead,
6503         it gives the expected diagnostic that the source and destination are
6504         the same.  WARNING: this is an incomplete fix.  If the file happens
6505         to have a link count of 2 or greater, such an erroneous mv command
6506         will still unlink it.
6507         Although that is not possible on vfat or umsdos, it is possible on
6508         other file system types, e.g., ntfs, and hpfs.
6509         * src/copy.c (same_file_ok): Invoke same_name (which might still
6510         return false for names that refer to the same directory entry)
6511         only if the link count is 2 or more.
6512         * tests/mv/vfat: Show how to demonstrate the above problem.
6513         This test is not run.
6514         * tests/mv/Makefile.am (EXTRA_DIST): Add vfat.
6515
6516 2003-08-27  Jim Meyering  <jim@meyering.net>
6517
6518         * src/who.c: Change meaning of -l from --lookup to --login, per POSIX.
6519         who's -l option has been eliciting an unconditional warning about
6520         this impending change since sh-utils-2.0.12 (April 2002).
6521
6522         * src/paste.c (paste_parallel): Don't output `EOF' (aka -1) as a `char'.
6523         This would happen for nonempty files not ending with a newline.
6524         Reported by Dan Jacobson.
6525         * tests/misc/paste-no-nl: New file.  Test for above-fixed bug.
6526         * tests/misc/Makefile.am (TESTS): Add paste-no-nl.
6527
6528         * src/stat.c (print_it): Avoid buffer overrun that would
6529         occur when the user-specified format string ends with `%'.
6530         Patch by Tommi Kyntola.
6531         * tests/misc/stat-fmt: New file.  Test for above-fixed bug.
6532         * tests/misc/Makefile.am (TESTS): Add stat-fmt.
6533
6534 2003-08-26  Jim Meyering  <jim@meyering.net>
6535
6536         Apply changes from bison.
6537         * GNUmakefile (SHELL): Define to `sh', if necessary.
6538         Add copyright.
6539         * Makefile.maint (WGETFLAGS): Define to `-C off'.
6540         Update all uses of $(WGET).
6541
6542 2003-08-22  Akim Demaille  <akim@epita.fr>
6543
6544         * Makefile.cfg (local-checks-to-skip): New.
6545         * Makefile.maint (local-check): Rename as...
6546         (local-checks-available): this.
6547         (local-check): New.
6548
6549 2003-08-26  Akim Demaille  <akim@epita.fr>
6550
6551         * announce-gen (print_changelog_deltas): Neutralize "<#" as
6552         "<\#" to avoid magic from Gnus when posting parts of this script.
6553
6554 2003-08-25  Jim Meyering  <jim@meyering.net>
6555
6556         * src/stat.c (main): Warn about use of deprecated `-l' option.
6557
6558 2003-08-22  Jim Meyering  <jim@meyering.net>
6559
6560         * src/stat.c (do_stat): For link count at end of line, use %h format,
6561         instead of %-5h.  The latter would make stat emit trailing spaces.
6562         Reported by Dan Jacobson.
6563
6564 2003-08-20  Jim Meyering  <jim@meyering.net>
6565
6566         * Makefile.am (EXTRA_DIST): Add .x-sc_space_tab .x-sc_sun_os_names
6567
6568 2003-08-19  Jim Meyering  <jim@meyering.net>
6569
6570         * src/system.h: Include stdlib.h unconditionally,
6571         as we're now assuming that part of hosted C89.
6572
6573 2003-08-18  Jim Meyering  <jim@meyering.net>
6574
6575         * src/sys2.h (textdomain, bindtextdomain) [! ENABLE_NLS]: Define away,
6576         to avoid warnings from gcc.
6577
6578 2003-08-17  Jim Meyering  <jim@meyering.net>
6579
6580         Avoid unnecessary and sometimes time-consuming hostname lookups.
6581         * src/who.c (print_user): Use strchr, not strrchr.
6582         * src/pinky.c (print_entry): Likewise.
6583         Patch by Michael Stone.
6584         This fixes a typo I introduced in who-users.c on 1996-02-23.
6585
6586         * Makefile.maint (makefile-check): Add 0-9 to the range of characters
6587         disallowed between `@...@'.
6588
6589 2003-08-16  Paul Eggert  <eggert@twinsun.com>
6590
6591         * configure.ac (fu_cv_sys_truncating_statfs): Remove; now
6592         done by gnulib .m4 files.
6593         (jm_DUMMY_1): Require gl_READUTMP, not jm_PREREQ_READUTMP.
6594         * src/sys2.h (strtoull): Remove unused declaration.
6595
6596 2003-08-16  Jim Meyering  <jim@meyering.net>
6597
6598         * man/Makefile.am (.x.1): Ensure that generated PROGRAM.1 files
6599         are read-only.
6600
6601         * src/tail.c (tail_lines): Fix a potential (but very hard to exercise)
6602         race condition bug.  The bug would be triggered when tailing a file
6603         with file pointer not at beginning of file, and where the file was
6604         truncated to have a length of less than the initial offset at just
6605         the right moment (between the two lseek calls in this function).
6606
6607         An invalid initial value for *read_pos would result in
6608         `tail -n0 -f FILE' and `tail -c0 -f FILE' doing what amounted to a
6609         busy-wait rather than sleeping between iterations.  The bug manifests
6610         itself only when tailing regular files that are initially nonempty.
6611         * src/tail.c (tail_bytes): Set *read_pos to new file offset after
6612         each xlseek call.
6613         (tail_lines): Likewise, after lseek calls.
6614         Reported by Nick Estes.  See http://bugs.debian.org/205251 for details.
6615         * tests/tail-2/tail-n0f: New file.  Test for above fix.
6616         * tests/tail-2/Makefile.am (TESTS): Add tail-n0f.
6617
6618 2003-08-15  Jim Meyering  <jim@meyering.net>
6619
6620         * Makefile.maint (sc_space_tab): Use exclusion list in separate file.
6621         (sc_sun_os_names): Likewise.
6622         * .x-sc_space_tab, .x-sc_sun_os_names: New files.
6623
6624         * man/help2man: Remove some SPACEs before TAB.
6625
6626 2003-08-14  Paul Eggert  <eggert@twinsun.com>
6627
6628         * Makefile.maint (LC_ALL): Set to C.
6629         * man/Makefile.am (ASSORT): New var.
6630         (check-x-vs-1, programs): Use it.
6631         * src/Makefile.am (ASSORT, check-README, ../AUTHORS): Likewise.
6632         * tests/Makefile.am (ASSORT, all_programs): Likewise.
6633
6634 2003-08-11  Jim Meyering  <jim@meyering.net>
6635
6636         fold -s -wN would infloop for N < 8 with TABs in the input.
6637         E.g., this would not terminate: printf 'a\tb' | fold -w2 -s
6638         * src/fold.c (fold_file): Move contents of `else'-block
6639         out of conditional so it's used also for --spaces (-s).
6640         * tests/misc/fold: Test for the above fix.
6641         * tests/misc/Makefile.am (TESTS): Add fold.
6642
6643 2003-08-10  Jim Meyering  <jim@meyering.net>
6644
6645         * src/nice.c [!NICE_PRIORITY]: Include <sys/resource.h> after
6646         system.h so the types from time.h and sys/time.h are available.
6647         It appears that this is necessary for OpenBSD, NetBSD, and
6648         Darwin 6.5 (MacOS 10.2.5).  Reported by Nelson Beebe.
6649
6650 2003-08-06  Paul Eggert  <eggert@twinsun.com>
6651
6652         * NEWS: Add support for setting file timestamps to microsecond
6653         resolution, on hosts that support this.
6654         * src/copy.c, src/cp.c, src/install.c, src/touch.c: Include utimens.h.
6655         * src/copy.c (copy_internal):
6656         Set file timestamps with utimens, not utime.
6657         * src/cp.c (re_protect): Likewise.
6658         * src/install.c (change_timestamps): Likewise.
6659         * src/touch.c (newtime, touch, main): Likewise.
6660
6661 2003-08-09  Jim Meyering  <jim@meyering.net>
6662
6663         * Makefile.maint (sc_sun_os_names): New rule based on a regexp
6664         from Paul Eggert.
6665         (syntax-check-rules): Add it.
6666
6667         * src/tail.c (main): Tweak Solaris OS version number in comment.
6668         * src/wc.c (wc): Likewise
6669         * tests/tail-2/fflush: Likewise.
6670
6671         * src/tail.c: Add new undocumented option, --presume-input-pipe.
6672         (pipe_lines): Use memchr to skip lines, rather than an explicit loop.
6673
6674 2003-08-08  Paul Eggert  <eggert@twinsun.com>
6675
6676         Use new gnulib 'extensions' module.
6677         * configure.ac: Invoke gl_USE_SYSTEM_EXTENSIONS instead of
6678         AC_GNU_SOURCE.
6679
6680 2003-08-08  Paul Eggert  <eggert@twinsun.com>
6681
6682         * tests/du/basic: Ensure that a/b/F has at least 65 bytes too.
6683
6684 2003-08-09  Jim Meyering  <jim@meyering.net>
6685
6686         * tests/misc/split-fail: Reflect that `split -a 0' is now accepted.
6687         For tests of obsolete behavior, don't presume that unsetting
6688         _POSIX2_VERSION is equivalent to _POSIX2_VERSION=199209.
6689
6690 2003-08-07  Paul Eggert  <eggert@twinsun.com>
6691
6692         * doc/coreutils.texi (split invocation):
6693         Add -d or --numeric-suffixes option to 'split'.
6694         From a suggestion by Jesse Kornblum.
6695         * src/split.c (suffix_alphabet): New var.
6696         (longopts, usage, next_file_name, main): Support -d.
6697         (next_file_name, main): Allow -a0, as POSIX requires.
6698         (next_file_name): Don't assume ASCII-like encoding;
6699         'a' through 'z' are not contiguous in EBCDIC.
6700
6701 2003-08-05  Paul Eggert  <eggert@twinsun.com>
6702
6703         Merge getline from gnulib.
6704         * lib/getline.h, lib/getline.c, m4/getline.m4: Merge from gnulib.
6705         * lib/getndelim2.h, lib/getndelim2.c, m4/getndelim2.m4, m4/ssize_t.m4:
6706         New files, from gnulib.
6707         * lib/getdelim2.c, lib/getdelim2.h: Remove.
6708         * lib/Makefile.am (libfetish_a_SOURCES): Change getdelim2.c and
6709         getdelim2.h to getndelim2.c and getndelim2.h.
6710         * m4/jm-macros.m4 (jm_MACROS): Use gl_GETNDELIM2 rather than
6711         checking for getdelim.
6712         (jm_CHECK_ALL_TYPES): Use gt_TYPE_SSIZE_T for ssize_t rather
6713         than rolling our own.
6714         * src/cut.c: Include getndelim2.h rather than getdelim2.h.
6715         (cut_fields): Invoke getndelim2 rather than getdelim2.
6716
6717 2003-08-04  Jim Meyering  <jim@meyering.net>
6718
6719         * src/sort.c (main): Use unsigned int instead of int for `nsigs'
6720         and for the indices to iterate through nsigs.
6721
6722 2003-08-02  Paul Eggert  <eggert@twinsun.com>
6723
6724         * src/sort.c: Minor code cleanups, mostly to use more accurate
6725         types and to remove unnecessary casts.
6726         (min, max): Remove.  All uses changed to MIN and MAX.
6727         (hard_lc_collate, hard_LC_TIME, struct buffer.eof, struct
6728         keyfield.skipsblanks, struct keyfield.skipeblanks, struct
6729         keyfield.numeric, struct keyfield.general_numeric, struct
6730         keyfield.month, struct keyfield.reverse, reverse, unique,
6731         have_read_stdin): Now bool, not int.  All uses changed.
6732         (eolchar): Now char, not int.
6733         (struct keyfield.ignore): Now bool const *, not int *.
6734         (struct keyfield.translate): Now char const *, not char *.
6735         (struct month.name): Likewise.
6736         (blanks, nonprinting, nondictionary): Now bool[], not int[].
6737         (cleanup, inittables, keycompare, check, mergefps, first_same_file,
6738         check, sort, main): Use const * pointers when possible.
6739         (month_cmp): Rewrite to avoid casts.
6740         (inittables): Initialize tables unconditionally, to avoid branches.
6741         (fillbuf): Return bool, not int.  All uses changed.
6742         (fillbuf, keycompare, new_key, main):
6743         Use SIZE_MAX rather than (size_t) -1.
6744         (trailing_blanks): Renamed from trim_trailing_blanks.
6745         Return the number of blanks to trim.  All uses changed.
6746         (getmonth): Use trailing_blanks rather than open code.
6747         (keycompare): Do not cast char * to unsigned char *; not needed.
6748         CMP_WITH_IGNORE converts args to UCHAR, so no need to convert it
6749         ourselves.
6750         (compare, main): Use | rather than || to avoid jumps.
6751         Replace "diff = NONZERO (alen)" with "diff = 1", since alen must
6752         be nonzero there.
6753         (check, first_same_file, sort, main):
6754         Use bool instead of int local vars when possible.
6755         (check): Merge the old 'checkfp' and 'check' into a single function,
6756         that returns a boolean (true if the file was ordered).
6757         All uses changed.
6758         (main): Use int instead of unsigned for iterating through nsigs.
6759         Rename local var "posix_pedantic" to "posixly_correct".
6760
6761 2003-08-02  Jim Meyering  <jim@meyering.net>
6762
6763         * src/nice.c [!NICE_PRIORITY]: Include <time.h> before <sys/resource.h>
6764         to avoid compilation error on Ultrix. Reported by Christian Krackowizer.
6765
6766         * src/cut.c (cut_fields): Don't read again after encountering an
6767         initial EOF.  E.g., `cut -f2' would do so.
6768         * tests/misc/tty-eof: Add a test for the above fix.
6769
6770         * src/sort.c (sortlines): Add description and references.
6771         From Paul Eggert.
6772
6773         * tests/Makefile.am (TESTS_ENVIRONMENT): Set PATH so that
6774         the tests in help-version will use the just-built binaries.
6775         Reported by Christian Krackowizer.
6776
6777 2003-07-31  Paul Eggert  <eggert@twinsun.com>
6778
6779         * NEWS: Add --rfc-2822 option to GNU date.
6780         * doc/coreutils.texi (Time directives, Options for date, Examples
6781         of date): Likewise.
6782         * src/date.c (long_options, usage, main): Likewise.
6783         * doc/getdate.texi (General date syntax): Likewise.
6784         * doc/coreutils.texi (Options for date): Fix a typo in format:
6785         it's now %d not %_d.  Add URLs.
6786
6787 2003-08-01  Jim Meyering  <jim@meyering.net>
6788
6789         * tests/shred/remove: Ensure that $? is 0 for the final `exit 0'.
6790         Otherwise, with at least the /bin/sh from HPUX 10.20,
6791         the trap code would end up converting that to exit 1 and thus an
6792         unexpected test failure.  Reported by Christian Krackowizer.
6793
6794 2003-07-31  Paul Eggert  <eggert@twinsun.com>
6795
6796         * src/ptx.c: Do not include bumpalloc.h.
6797         (WORD_TABLE): New member alloc.
6798         (ALLOC_NEW_WORD): Remove.
6799         (occurs_alloc): New var.
6800         (digest_word_file, find_occurs_in_text): Check for arithmetic
6801         overflow when computing table size.  Use xrealloc rather than
6802         bumpalloc primitives.
6803
6804 2003-07-29  Jim Meyering  <jim@meyering.net>
6805
6806         * Version 5.0.90.
6807
6808         * README: When running tests as root, suggest using
6809         sudo with NON_ROOT_USERNAME=$USER.
6810
6811         * tests/Makefile.am (all_programs): Makefile is in ../src, not
6812         $(srcdir)/../src.
6813
6814 2003-07-28  Jim Meyering  <jim@meyering.net>
6815
6816         * Makefile.maint (GZIP_ENV): Try Debian/gzip's new --rsyncable option.
6817
6818 2003-07-28  Paul Eggert  <eggert@twinsun.com>
6819
6820         * lib/stdbool.hin (_Bool): Make it signed char, instead of
6821         an enum type, so that it's guaranteed to promote to int.
6822         * src/sort.c (sortlines_temp): Undo previous change.
6823
6824 2003-07-28  Jim Meyering  <jim@meyering.net>
6825
6826         * src/sort.c (sortlines_temp): Declare local `swap' to be `int', not
6827         `bool'.  Otherwise, at least one buggy compiler (alpha gcc-2.95.4)
6828         would cause lines[-1 - swap] (with swap = false) to evaluate to
6829         lines[4294967295].
6830
6831 2003-07-27  Jim Meyering  <jim@meyering.net>
6832
6833         * tests/priv-check (my_uid): Use `!', not `^' in case pattern `[!0-9]',
6834         since /bin/sh of at least NetBSD 1.6 and OpenBSD 3.2 don't accept `^'.
6835
6836         * src/remove.c (prompt) [! recursive]: Don't prompt about unwritable
6837         directories, as required by POSIX.   Reported by Karl Berry.
6838         * tests/rm/dir-no-w: New file.  Test for the above fix.
6839         * tests/rm/Makefile.am (TESTS): Add dir-no-w.
6840
6841         * tests/mk-script: Emit `$xx', not its expansion.
6842
6843 2003-07-27  Paul Eggert  <eggert@twinsun.com>
6844
6845         This change was inspired by a similar proposal by Stepan Kasal.
6846         * src/sort.c (mergelines, sortlines_temp): New functions.
6847         (sortlines): Use them, to reduce the number of times that
6848         we need to copy 'struct line' values.  This improved CPU
6849         performance by about 30% on one 18 MB test.
6850         (sort): Don't invoke sortlines unless we have 2 or more lines.
6851
6852 2003-07-26  Stepan Kasal  <kasal@ucw.cz>
6853
6854         * src/sort.c (sort): Don't require two `struct line's per text line,
6855         the new sort algorithm requires just 1.5.
6856
6857 2003-07-27  Jim Meyering  <jim@meyering.net>
6858
6859         * src/pathchk.c (validate_path): Use %lu, not %ld.
6860         From Paul Eggert.
6861         * src/cut.c (is_printable_field): Simplify bit arithmetic.
6862         From Paul Eggert.
6863         * src/ls.c (sort_files): Put `volatile' in the right place.
6864         From Paul Eggert.
6865
6866 2003-07-26  Jim Meyering  <jim@meyering.net>
6867
6868         Use only one bit per field/offset in array, not one `int'.
6869         * src/cut.c (printable_field): Change type to `unsigned char'.
6870         (mark_printable_field, is_printable_field): New functions.
6871         Use them in place of all direct accesses of `printable_field'.
6872
6873         * src/expand.c (parse_tabstops): Detect overflow properly.
6874         * src/cut.c (set_fields): Likewise.
6875
6876         * src/rm.c: Include "dirname.h".
6877         (usage): Use base_name (program_name) in body of --help output.
6878         This lets me...
6879         * man/Makefile.am (.x.1): ...back out the kludge of 2003-07-22.
6880         Idea from Brendan O'Dea, who suggested using
6881         `program_name = basename (argv[0]);' everywhere --
6882         can't do that, but using base_name works just fine here.
6883
6884         * src/Makefile.am (AM_INSTALLCHECK_STD_OPTIONS_EXEMPT): Exempt test.
6885
6886 2003-07-24  Paul Eggert  <eggert@twinsun.com>
6887
6888         Fix some POSIX-compliance problems with 'test'.  This makes
6889         'test' more compatible with Bash.
6890
6891         * NEWS, doc/coreutils.texi: Document the following.
6892         * src/test.c: Include exitfail.h.
6893         (TEST_FAILURE): New constant, used for exit status if 'test' fails.
6894         (test-syntax_error): Use it.
6895         (binary_operator): Now takes bool arg specifying whether left operand
6896         is -l ARG, so that caller determines this rather than us.
6897         All uses changed.
6898         (term): Use posixtest to evaluate parenthesized subexpressions.
6899         (unary_operator, one_argument): Remove support for -t without operand.
6900         (one_argument): Take argument from argv[pos].
6901         (one_argument, two_arguments, three_arguments): Advance pos.
6902         All callers changed.
6903         (three_arguments): Look for binary ops before "!".  Then look
6904         for parenthesized one_argument expressions, instead of trusting
6905         expr () to do the right thing.
6906         (posixtest): Now takes number of args.  All callers changed.
6907         Treat "( A B )" like "A B".
6908         (main): Set exit_failure to TEST_FAILURE.  Don't depend on
6909         POSIXLY_CORRECT, as we now conform to POSIX by default.
6910         (main) [!LBRACKET]: Do not recognize "--help" or "--verbose" unless.
6911         * tests/test/Test.pm (test_vector): Add several tests to check
6912         the above.  Syntax errors now exit with status 2, not 1.
6913         * man/Makefile.am (mapped_name): Use `../src/[' binary to create test.1.
6914
6915 2003-07-26  Jim Meyering  <jim@meyering.net>
6916
6917         * tests/help-version: Adjust for above change in test behavior:
6918         `[' exits with 2, not 1, and test doesn't accept --help or --version.
6919
6920         * Makefile.maint (ME): Don't use trick suggested in Make manual.
6921         It doesn't work for make-3.79.1.  Reported by Christian Krackowizer.
6922
6923         * Makefile.maint (sc_system_h_headers): Another syntax check.
6924         (syntax-check-rules): Add it to the list.
6925
6926         * src/pathchk.c (validate_path): Cast strlen value to `unsigned long'
6927         so it matches `%ld' format even on 32-bit systems.
6928
6929         * src/fmt.c (flush_paragraph): Cast field width to `int' to
6930         avoid warning on 64-bit systems.
6931
6932         * src/ls.c (sort_files): Make `func' volatile, so it can't be
6933         clobbered by a `longjmp' into this function.
6934
6935 2003-07-25  Jim Meyering  <jim@meyering.net>
6936
6937         * src/pathchk.c (validate_path): Use %ld format (not %d) for size_t
6938         value.
6939
6940         * tests/misc/split-fail: Disable the --line-bytes=$_4gb test,
6941         because it'd evoke spurious failure on 64-bit systems.
6942
6943 2003-07-24  Jim Meyering  <jim@meyering.net>
6944
6945         * src/dd.c (usage): Document the fact that SIGUSR1 makes dd
6946         output its current record counts.  Reported by Jurriaan.
6947
6948         * tests/wc/Test.pm (test_vector): Disable the `PIPE' tests when running
6949         `wc' with no options.  This goes along with the change of 2003-07-20.
6950
6951 2003-07-23  Jim Meyering  <jim@meyering.net>
6952
6953         Don't include headers already included by system.h:
6954         * src/tr.c: Don't include errno.h.
6955         * src/true.c: Don't include version-etc.h.
6956         * src/test.c: Don't include limits.h or error.h.
6957         * src/stat.c: Don't include unistd.h or time.h.
6958         * src/readlink.c: Don't include stdlib.h, unistd.h, or limits.h.
6959         * src/pr.c: Don't include time.h.
6960         * src/pathchk.c: Don't include errno.h.
6961         * src/nice.c: Don't include sys/time.h.
6962         * src/ls.c: Don't include stdlib.h.
6963
6964         * basename.c, cat.c, chroot.c, cksum.c, comm.c, csplit.c, cut.c, date.c:
6965         * dd.c, dirname.c, echo.c, env.c, expand.c, expr.c, factor.c, fmt.c:
6966         * fold.c, head.c, hostid.c, hostname.c, id.c, join.c, kill.c, logname.c:
6967         * md5sum.c, nice.c, nl.c, nohup.c, od.c, paste.c, pathchk.c, pinky.c:
6968         * pr.c, printenv.c, printf.c, ptx.c, pwd.c, seq.c, setuidgid.c, shred.c:
6969         * sleep.c, sort.c, split.c, stat.c, stty.c, su.c, sum.c, tac.c, tail.c:
6970         * tee.c, test.c, tr.c, true.c, tsort.c, tty.c, uname.c, unexpand.c:
6971         * uniq.c, uptime.c, users.c, wc.c, who.c, whoami.c, yes.c:
6972         Don't include closeout.h.
6973
6974         * tests/rm/fail-2eperm: Add a check for whether $NON_ROOT_USERNAME
6975         can access the required version of rm.
6976         * tests/rm/Makefile.am (TESTS_ENVIRONMENT): Define PACKAGE_VERSION.
6977
6978         * tests/cut/Test.pm (out-delim3a): New test.
6979
6980         * man/help2man: Update to version 1.33.
6981
6982         * src/expand.c (parse_tabstops): Detect overflow in tabstop sizes.
6983
6984         * src/dircolors.c: Include xstrndup.h.
6985         (xstrndup): Remove function, now that it's been factored out into
6986         it's own file.
6987
6988 2003-07-22  Paul Eggert  <eggert@twinsun.com>
6989
6990         * src/wc.c (wc): Fix typo in computation of file from file_x,
6991         which caused the former to be used uninitialized if file_x was
6992         nonzero.
6993
6994 2003-07-22  Jim Meyering  <jim@meyering.net>
6995
6996         * src/cut.c (set_fields): Use xcalloc in place of xmalloc+memset.
6997
6998         * man/Makefile.am (.x.1): Substitute 's,$t/$*,$*,' on output of
6999         help2man, to avoid having `rm.td/rm' appear in rm.1.  Reported by
7000         Thomas Luzat.  See http://bugs.debian.org/202413 for details.
7001
7002         * src/cut.c (main) [lint]: Initialize spec_list_string to avoid warning.
7003
7004         * src/hostid.c: Don't include <unistd.h>.  system.h already does that.
7005
7006         * src/cut.c (set_fields): Mark all selected indices before trying to
7007         determine range endpoints.
7008         * tests/cut/Test.pm: New test for the above fix.
7009
7010         Begin to address this comment: What if someone wants to
7011         extract the 1,000,000-th field of some huge input file?
7012         The first step is to rearrange things so that the values
7013         in the printable_field array are all 0/1 rather than 0/1/2.
7014         * src/cut.c (RANGE_START_SENTINEL): Remove.
7015         Store range-start indices in a hash table, rather than
7016         overloading the `printable_field' array.
7017         (range_start_ht): New global.
7018         (hash_int, hash_compare_ints, is_range_start_index): New functions.
7019         (print_kth): Use is_range_start_index; don't test printable_field.
7020         (set_fields): Detect overflow.
7021         (set_fields): Insert each range-start index into range_start_ht.
7022         (main): Call set_fields only once, and only after
7023         output_delimiter_specified and (if required) range_start_ht have
7024         been defined.
7025
7026 2003-07-20  Paul Eggert  <eggert@twinsun.com>
7027
7028         * src/wc.c (get_input_fstatus): Fix typo: `stat' was being
7029         invoked with a null pointer when there were no file arguments.
7030
7031 2003-07-20  Jim Meyering  <jim@meyering.net>
7032
7033         * Makefile.maint (sc_changelog): Add another nit-picky check.
7034
7035         * src/wc.c (write_counts): Add a comment.
7036         (wc): Rename `file' parameter.
7037         Set new local, `file', to be the file name, or (when it's NULL)
7038         _("standard output") so that all uses of `file' use the proper value.
7039         Use STREQ, not strcmp.
7040
7041 2003-07-20  Paul Eggert  <eggert@twinsun.com>
7042
7043         wc count field widths now are heuristically adjusted depending
7044         on the input size, if known.  If only one count is printed, it
7045         is guaranteed to be printed without leading spaces.
7046
7047         Previously, wc did not align the count fields if
7048         POSIXLY_CORRECT was set, but POSIX did not actually require
7049         this undesirable behavior, so it has been removed.
7050
7051         * NEWS: Document this.
7052         * doc/coreutils.texi (wc invocation): Likewise.
7053
7054         * src/wc.c (number_width): New var.
7055         (posixly_correct): Remove.
7056         (struct fstatus): New struct.
7057         (write_counts): Output fields of width number_width.
7058         Do not worry about POSIXLY_CORRECT.
7059         Use null file, not empty-string file, to denote stdin,
7060         since "" is a valid file name on some hosts.
7061         (wc, wc_file): New arg fstatus.  Use it to avoid invoking fstat
7062         if possible.
7063         (wc):  Avoid problems if end_pos - current_pos overflows.
7064         Do not print odd message if stdin has a read error.
7065         (get_input_fstatus, compute_number_width): New functions.
7066         (main): Use them to implement the new behavior.
7067         Ignore POSIXLY_CORRECT.
7068
7069         * tests/wc/Test.pm: Adjust to the new output widths.
7070
7071 2003-07-19  Jim Meyering  <jim@meyering.net>
7072
7073         * tests/rm/fail-eperm: Don't create temporary directory --
7074         we don't use it.
7075
7076         * tests/shred/remove: Don't open-code test for UID != 0.
7077         Use priv-check's require-non-root instead.
7078         Update to use newer framework.
7079
7080         * tests/help-version (expected_failure_status_expr): Record that
7081         expr exits with status of 3 for e.g., a write error.
7082
7083         * tests/priv-check: Use `id -u' to see if we're running as root,
7084         rather than trying go write to an write-protected file.
7085         When running as root, ensure $NON_ROOT_USERNAME is valid.
7086         When running as root with `require-non-root', ensure that `.'
7087         is writable by $NON_ROOT_USERNAME, then reinvoke $0 set-user-ID
7088         to $NON_ROOT_USERNAME.  If `.' is not writable, then skip the test.
7089
7090         * src/printenv.c: Include "exitfail.h".
7091         (main): Set exit_failure rather than calling close_stdout_set_status.
7092         * src/date.c: Likewise.
7093         * src/sort.c: Likewise.
7094         * src/tty.c: Likewise.
7095
7096 2003-07-18  Jim Meyering  <jim@meyering.net>
7097
7098         * tests/touch/not-owner: Update to use newer framework.
7099
7100         * tests/rm/fail-eperm: Use $srcdir/../priv-check, create a temporary
7101         directory, and remove Perl-coded `you may not run as root' test.
7102         * tests/cp/fail-perm: Use $srcdir/../priv-check, rather than
7103         hard-coding something not quite equivalent.
7104         Paul Jarc reported the inconsistent diagnostics.
7105
7106         * src/sort.c (main): Use close_stdout via atexit.
7107         Now `sort --version' and `sort --help' fail, as they should
7108         when their output is redirected to /dev/full.
7109
7110         * src/su.c (usage): Don't call close_stdout here.
7111         (main): Use close_stdout via atexit.
7112         Now `su --version > /dev/full' fails, as it should.
7113         Somehow, the change of 2000-05-07 that purports to fix this
7114         was not checked in.
7115
7116         * tests/help-version (--help/--version vs. /dev/full): Special-case
7117         `[' to protect it from expected_failure_status-`eval'.
7118
7119         * src/uniq.c (writeline): Use a SPACE, not a TAB between the
7120         count and the corresponding line, as required by POSIX.
7121         Reported by Clement Wang.
7122         * tests/uniq/Test.pm (101, 102): Update tests of -c accordingly.
7123
7124         * tests/expr/basic: Add tests for when exit status is 2.
7125
7126         * src/nohup.c (NOHUP_FOUND_BUT_CANNOT_INVOKE, NOHUP_FAILURE):
7127         Use an anonymous `enum', rather than #define.
7128
7129 2003-07-17  Paul Eggert  <eggert@twinsun.com>
7130
7131         * src/expr.c: Include "exitfail.h", "quotearg.h".
7132         (EXPR_INVALID, EXPR_ERROR): New constants.
7133         (nomoreargs, null, toarith, nextarg): Return bool, not int.
7134         (syntax_error): New function, exiting with status 2.  Use it
7135         insteading of printing "syntax error" ourselves.
7136         (main): Initialize exit_failure to EXPR_ERROR.
7137         Exit with EXPR_INVALID on syntax error (too few arguments).
7138         (nextarg): Use strcmp, not strcoll; strcoll might return
7139         an undesirable 0, or might fail.
7140         (docolon, eval4, eval3): Exit with status 3 on invalid argument type
7141         or other such error.
7142         (eval2): Report an error if strcoll fails in a string comparison.
7143         * src/sort.c: Include "exitfail.h".
7144         (main): Set exit_failure, not xalloc_exit_failure and
7145         xmemcoll_exit_failure.
7146         * tests/expr/basic: Invalid value exits with status 3, not 2.
7147
7148 2003-07-16  Jim Meyering  <jim@meyering.net>
7149
7150         * configure.ac (AC_INIT): Use 5.0.90 as the version, rather than 5.0.2,
7151         per GNU maintainer guidelines.  The next non-beta release will be 5.1.
7152
7153         This script would have caught at least two recent bugs:
7154         those in [ and kill.
7155         * tests/help-version: Revive this script.
7156         It wasn't doing anything useful, since $all_programs wasn't being
7157         defined by the invoking Makefile.am.
7158         Reflect that nohup is no longer a script, so don't exclude it.
7159         Add framework to handle the programs added since it was last run:
7160         kill, stat, unlink, [, link, readlink.
7161         Fix path-related problems deriving from the move of this script
7162         from src/ to its present location.
7163         * tests/Makefile.am (all_programs): Define.
7164         (TESTS_ENVIRONMENT): Use it.
7165
7166         * src/kill.c (main): Fix bug introduced on 2003-05-10 (for 5.0.1)
7167         whereby kill would always attempt to operate on argv[0] and fail.
7168
7169         * src/test.c (integer_expected_error): Improve diagnostic -- now,
7170         it also matches the one from bash's builtin test.
7171         (binary_operator): Add \n at end of diagnostic.
7172
7173         * tests/rm/fail-2eperm: Remove setuidgid-related code.  Move it to ...
7174         * tests/priv-check: Move setuidgid-related and
7175         NON_ROOT_USERNAME-checking code to this file.
7176
7177         * README: Update section on testing as `root'.
7178         Suggestion from Paul Jarc.
7179
7180         * src/test.c (AUTHORS): Replace 3-letter usernames with the actual
7181         names of authors that I just found in bash's builtins/test.def.
7182
7183         Running `[' with no arguments would evoke a segfault.
7184         * src/test.c (main) [LBRACKET]: Move initialization of argv to
7185         precede potential use via test_syntax_error.
7186
7187         * src/Makefile.am (AM_CPPFLAGS): Rename from `INCLUDES', to avoid
7188         warning from automake -Wall.
7189
7190 2003-07-15  Jim Meyering  <jim@meyering.net>
7191
7192         * Version 5.0.1.
7193
7194         * Makefile.maint (%.asc): Remove target first, so gpg doesn't
7195         prompt us about it.
7196
7197         * announce-gen (print_changelog_deltas): Relax tests for matching
7198         version-number line in NEWS.
7199         Change the .sig suffix to .asc here, too.
7200
7201 2003-07-14  Jim Meyering  <jim@meyering.net>
7202
7203         * Makefile.maint (%.asc): Renamed from %.sig.
7204         Generate and use ascii-armored signatures.
7205         Use gpg's -o option.
7206
7207 2003-07-13  Jim Meyering  <jim@meyering.net>
7208
7209         * src/nohup.c (NOHUP_FAILURE, NOHUP_FOUND_BUT_CANNOT_INVOKE): Define.
7210         (main): Use them.
7211
7212         * Makefile.maint (syntax-check): Move each individual check into
7213         its own target.
7214         (syntax-check-rules): This is the list of syntax-check targets.
7215         (sc_unmarked_diagnostics, sc_cast_of_argument_to_free):
7216         (sc_cast_of_x_alloc_return_value, sc_space_tab):
7217         (sc_error_exit_success, sc_xalloc_h_in_src):  New targets.
7218
7219 2003-07-12  Jim Meyering  <jim@meyering.net>
7220
7221         * configure.ac: Remove uses of OPTIONAL_BIN_ZCRIPTS and last
7222         traces of the nohup script.
7223
7224         * src/Makefile.am (bin_SCRIPTS): Remove use of just-removed
7225         $(OPTIONAL_BIN_ZCRIPTS).
7226
7227         * src/Makefile.am (localedir.h): Put the `2>&1' after the redirect
7228         target, not before the `>'.
7229
7230         * src/remove.c (remove_dir): Give a diagnostic upon failed save_cwd,
7231         now that that function no longer calls `error'.
7232
7233         * src/df.c (find_mount_point): Emit a diagnostic for each
7234         failed syscall, rather than relying on caller to do that.
7235         The caller couldn't do a good job, anyhow -- too many different
7236         ways to fail (each with a different referent).
7237         Give a diagnostic upon failed save_cwd, now that that function
7238         no longer calls `error'.
7239         (show_point): Don't diagnose find_mount_point's errors, now that
7240         it handles them itself.
7241
7242         * src/df.c (find_mount_point): Don't let free clobber errno upon
7243         failed chdir.
7244
7245         * src/sys2.h: Remove alloca-related block.
7246         * src/system.h: Include <alloca.h> here, instead.
7247
7248         It appears that the `#pragma alloca' included via "system.h" is
7249         adequate, since join.c uses alloca, yet lacked an in-file #pragma.
7250         * src/copy.c, src/cp.c, src/df.c, src/install.c, src/ln.c:
7251         * src/ls.c, src/mv.c, src/remove.c: Remove `#pragma alloca'.
7252
7253         * src/chown-core.c (change_file_owner): Do not restore any special
7254         permission bits (e.g., set-user-ID, set-group-ID) that are reset
7255         by chown(2) on some systems.  Suggestion and insistence :-) from
7256         Michael Stone.
7257
7258         * tests/input-tty: Also check `test -t 1'.
7259         This is necessary on linux-2.4.21.  Otherwise, the stty/basic-1
7260         test would block when run in the background.
7261
7262 2003-07-11  Jim Meyering  <jim@meyering.net>
7263
7264         * tests/sample-test: Also fail if cat-to-create-expected-output
7265         fails.  Otherwise, if both `exp' and `out' were to end up empty
7266         because of e.g., a full disk, they would mistakenly compare equal.
7267
7268         * src/nohup.c: New file.  Rewrite of nohup.sh in C.
7269         This solves a portability problem: on at least Solaris systems,
7270         when nohup.sh used the vendor /bin/sh, it would exit with status
7271         of `1' rather than the required 126 or 127 upon failure to exec
7272         the specified program.
7273
7274         * src/Makefile.am (EXTRA_SCRIPTS): Remove definition.
7275         (bin_PROGRAMS): Add nohup.
7276         (EXTRA_DIST): Remove nohup.sh.
7277         (all_programs): Remove use of $(EXTRA_SCRIPTS).
7278         * src/nohup.sh: Remove file.
7279         * man/Makefile.am (nohup.1): Depend on nohup.c, rather than nohup.sh.
7280
7281         * tests/misc/nohup: Tests for the above.
7282         * tests/misc/Makefile.am (TESTS): Add nohup.
7283
7284         * src/head.c (diagnose_copy_fd_failure): New function, renamed from
7285         the macro, COPY_FD_DIAGNOSE.
7286         (diagnose_copy_fd_failure): Enclose diagnostic in _(...).
7287         (head_file): Likewise.
7288
7289         * src/date.c: Include "quote.h".
7290         (batch_convert): Use the quote function rather than using literal `...'
7291         in a diagnostic.
7292
7293         * src/setuidgid.c (main): Enclose diagnostic in _(...).
7294         * src/fmt.c (main): Likewise.
7295         * src/mknod.c (main): Likewise.
7296         * src/tac.c (tac_seekable): Likewise.
7297         * src/yes.c (main): Likewise.
7298         * src/od.c (main): Likewise.
7299         * src/install.c (change_attributes): Likewise.
7300
7301 2003-07-10  Jim Meyering  <jim@meyering.net>
7302
7303         * src/head.c (usage): Use 1024*1024 in place of 1048576.
7304         * src/tail.c (usage): Likewise.
7305
7306         * tests/rm/fail-2eperm: Now that we have setuidgid, use it in
7307         place of the kludge in this test.  Suggestion from Paul Jarc.
7308
7309         * src/Makefile.am (noinst_PROGRAMS): Define to setuidgid.
7310         * src/setuidgid.c: New program, solely for testing (not installed).
7311
7312         * src/chown-core.c (change_file_owner): Don't leak file descriptors
7313         when dereferencing symlinks.
7314
7315 2003-07-09  Jim Meyering  <jim@meyering.net>
7316
7317         * tests/du/slash: New file/test for today's lib/ftw.c fix.
7318         * tests/du/Makefile.am (TESTS): Add slash
7319
7320         * src/tail.c (xlseek): Avoid warning about ``return without value
7321         from function returning non-void''.
7322
7323 2003-07-08  Jim Meyering  <jim@meyering.net>
7324
7325         * man/help2man: Update to version 1.29.
7326
7327         * man/help2man: Add END handler to close STDOUT and check for errors.
7328
7329 2003-06-30  Paul Eggert  <eggert@twinsun.com>
7330
7331         Add support for a "[" that conforms to the GNU coding standards,
7332         i.e., that does not depend on its name.
7333         * src/lbracket.c: New file.
7334         * README: Add "[".
7335         * man/Makefile.am (programs): Ignore "[", since it doesn't have
7336         a separate man page.
7337         * src/Makefile.am (bin_PROGRAMS): Add "[".
7338         (__SOURCES): New var.
7339         * src/test.c (LBRACKET): Define to 0 if not defined.
7340         (main): Use LBRACKET rather than argv[0].
7341
7342         * src/test.c (one_argument): Do not check for -t if POSIXLY_CORRECT.
7343         Reported by Paul Jarc and Dan Jacobson.
7344
7345         * src/test.c (main): Do not recognize --help or --version if
7346         POSIXLY_CORRECT, when invoked as "test".  Handle "[ ]" correctly.
7347         Do not bother testing that margv[margc] is non-null.
7348
7349 2003-07-04  Jim Meyering  <jim@meyering.net>
7350
7351         * src/who.c (print_line): Rewrite to use asprintf, in order to be
7352         able to avoid emitting trailing spaces.  Reported by Dan Jacobson.
7353
7354         * tests/misc/head-elide-tail: Add tests of head's new --lines=-N
7355         option, and perform the +1600 invocations of head IFF the envvar
7356         RUN_EXPENSIVE_TESTS is set.
7357
7358 2003-07-03  Jim Meyering  <jim@meyering.net>
7359
7360         * src/cp.c (do_copy): Give a better diagnostic when failing due
7361         to nonexistent destination directory.  Reported by Dmitry Rutsky.
7362         See http://bugs.debian.org/199730 for details.
7363
7364 2003-06-27  Jim Meyering  <jim@meyering.net>
7365
7366         split's --verbose option did nothing [broken in 4.5.10 and 5.0]
7367         * src/split.c (longopts): Use `1', not `0' as the value for
7368         for &verbose.  Reported by Keith Thompson.
7369
7370         Test for the above fix.
7371         * tests/misc/split-a: Also use --verbose and compare stderr
7372         output with what we'd expect.
7373
7374 2003-06-20  Jim Meyering  <jim@meyering.net>
7375
7376         * src/copy.c (copy_internal) [HAVE_STRUCT_STAT_ST_AUTHOR]:
7377         Use `error_t' (rather than int) as type for local `err'.
7378         From Alfred M. Szmidt.
7379
7380 2003-06-19  Marcus Brinkmann  <marcus@gnu.org>
7381
7382         * src/copy.c (copy_internal) [HAVE_STRUCT_STAT_ST_AUTHOR]:
7383         Fix author preservation code.
7384
7385 2003-06-19  Jim Meyering  <jim@meyering.net>
7386
7387         * src/ln.c (ENABLE_HARD_LINK_TO_SYMLINK_WARNING): Define to 0.
7388         (do_link): Don't warn about hard link to symlink.
7389
7390 2003-06-18  Jim Meyering  <jim@meyering.net>
7391
7392         * src/cut.c: Include "getdelim2.h", not "getstr.h".
7393         Reflect renaming: getstr -> getdelim2.
7394
7395         * src/comm.c, src/join.c, src/nl.c, src/uniq.c: Reflect renaming:
7396         readline -> readlinebuffer.
7397
7398 2003-06-09  John David Anglin  <dave.anglin@nrc-cnrc.gc.ca>
7399
7400         * src/readlink.c: Include <sys/types.h> before system.h (because
7401         the latter includes <sys/stat.h>).  Required on Ultrix 4.3.
7402
7403 2003-06-17  Jim Meyering  <jim@meyering.net>
7404
7405         * src/system.h (initialize_main): Define.
7406         Use it in every `main'.  Applied via this:
7407         p='initialize_main (&argc, &argv);'
7408         perl -ni -e '/program_name.=.argv.0/ and print "  '"$p"'\n"; print' \
7409           $(grep -l program_name.=.argv.0 *.c)
7410         test.c uses margc/margv, so I made the change manually for that file.
7411         Based on a patch from Bernard Giroud.
7412
7413 2003-06-09  John David Anglin  <dave.anglin@nrc-cnrc.gc.ca>
7414
7415         Fix for build failure on Ultrix 4.3.
7416         * src/stat.c: Include sys/statvfs.h in preference to sys/vfs.h.
7417         Include sys/param.h and sys/mount.h on ultrix.
7418
7419 2003-06-16  Jim Meyering  <jim@meyering.net>
7420
7421         * src/touch.c (O_NDELAY, O_NONBLOCK, O_NOCTTY, EISDIR): Remove
7422         definitions.
7423         * src/system.h (O_NDELAY, O_NONBLOCK, O_NOCTTY, EISDIR): Define
7424         them here instead, but with one change: define EISDIR to -1, not 0.
7425
7426         * src/cat.c (cat): Remove `#ifndef ENOSYS', now that it's
7427         guaranteed to be defined.
7428         * src/system.h (ENOSYS, ENOTSUP): Define to -1 if not defined.
7429
7430         * README: Mention the CVS repository.
7431         Encourage addition of test cases.
7432
7433 2003-06-12  Jim Meyering  <jim@meyering.net>
7434
7435         * src/touch.c (touch): Call close only if necessary.
7436         From Bruno Haible.
7437
7438         * src/wc.c (usage): Correct wording: wc prints counts in the order
7439         `newline, word, byte'.  Reported by Keith M. Briggs.
7440         * man/wc.x: Fix it here, too.  And change `lines' to `newlines'.
7441
7442 2003-06-10  Jim Meyering  <jim@meyering.net>
7443
7444         * tests/date/Test.pm: Add a test for the new format, e.g., May-23-2003.
7445
7446 2003-06-07  Jim Meyering  <jim@meyering.net>
7447
7448         * Makefile.maint (syntax-check): Add commented-out (over-aggressive)
7449         rule.
7450
7451 2003-06-06  Jim Meyering  <jim@meyering.net>
7452
7453         * src/extract-magic (main): Avoid newer 3-arg form of open,
7454         so this script works also with e.g., perl5.005_03.
7455         Patch by John David Anglin.
7456
7457 2003-06-04  Paul Eggert  <eggert@twinsun.com>
7458
7459         * src/system.h: Include <stdbool.h> unconditionally.
7460
7461 2003-06-04  Jim Meyering  <jim@meyering.net>
7462
7463         * man/Makefile.am (check-programs-vs-x): Rename target
7464         from check-programs-vs-1.  Adjust rule to check for the
7465         primary (.x) file, not the generated one (.1).
7466
7467 2003-06-03  Tim Mooney <mooney@dogbert.cc.ndsu.NoDak.edu>
7468
7469         * man/kill.x: New file.
7470         * man/Makefile.am (dist_man_MANS): Add kill.1.
7471         (kill.1): New rule.
7472
7473 2003-06-04  Jim Meyering  <jim@meyering.net>
7474
7475         Ensure that the .x file for a new program is never forgotten again.
7476         * man/Makefile.am (programs): Define.
7477         (check-programs-vs-1): New phony target.
7478         (check-local): Depend on it.
7479
7480 2003-06-03  Jim Meyering  <jim@meyering.net>
7481
7482         Avoid unnecessary copying of environment.
7483         * src/env.c (main): Rather than clearing the environment and --
7484         unless told to ignore environment -- copying all settings from
7485         the saved, original environment, clear the environment only when
7486         that is requested.  Suggested by Jens Elkner.
7487
7488 2003-06-02  Jim Meyering  <jim@meyering.net>
7489
7490         * src/system.h: Always include <string.h>, since we assume C89.
7491         Include <limits.h> without checking for HAVE_LIMITS_H.
7492
7493         * src/test.c [!TEST_STANDALONE]: Remove #if-0'd block.
7494         (STREQ, S_IXUGO): Remove redundant (in system.h) definitions.
7495
7496 2003-06-01  Jim Meyering  <jim@meyering.net>
7497
7498         Avoid a race condition in `tail -f' described by Ken Raeburn in
7499         http://mail.gnu.org/archive/html/bug-textutils/2003-05/msg00007.html
7500         * src/tail.c (file_lines): Add new parameter, *read_pos, and set it.
7501         (pipe_lines, pipe_bytes, start_bytes, start_lines): Likewise.
7502         (tail_bytes, tail_lines, tail): Likewise.
7503         (tail_file): Use the new `read_pos' value as the size,
7504         rather than stats.st_size from the fstat call.
7505
7506 2003-05-28  Jim Meyering  <jim@meyering.net>
7507
7508         * src/extract-magic: Allow expansion of `$file' in the here-
7509         document corresponding to the comment at the top of fs.h.
7510
7511 2003-05-26  Jim Meyering  <jim@meyering.net>
7512
7513         * src/stat.c: Fix portability problem on FreeBSD5.0: don't include
7514         <sys/statvfs.h> on systems without HAVE_STRUCT_STATVFS_F_BASETYPE.
7515         Use #if/#elif/... cascade so we get only one set of include files.
7516         Reported by Nelson Beebe.
7517
7518 2003-05-24  Jim Meyering  <jim@meyering.net>
7519
7520         * src/md5sum.c (split_3): Accept the BSD format only when in MD5 mode.
7521         * tests/sha1sum/basic-1: Make sure `sha1sum --check' doesn't
7522         accept the BSD format.
7523
7524 2003-03-28  Joe Orton  <jorton@redhat.com>
7525
7526         * src/md5sum.c (bsd_split_3): New function.
7527         (split_3): Detect checksums from BSD 'md5' command and handle them
7528         using bsd_split_3.
7529
7530         * tests/md5sum/basic-1: New tests for --check exit status, and for
7531         BSD-style checksum files.
7532
7533 2003-05-21  Jim Meyering  <jim@meyering.net>
7534
7535         * src/head.c (elide_tail_lines_pipe): Fix a thinko.
7536         This sort of thing is why it'd be *Really Good* to factor
7537         out the common code used here and in tail.c.
7538
7539 2003-05-14  Jim Meyering  <jim@meyering.net>
7540
7541         * src/head.c (usage): Document new feature: --bytes=-N and --lines=-N.
7542
7543         * tests/du/slink: Skip this test if `.' is on an XFS file system.
7544
7545         * tests/du/fd-leak: New file.  Test for the bug in du that
7546         was fixed by the 2003-05-12 change to lib/ftw.c.
7547         * tests/du/Makefile.am (TESTS): Add fd-leak.
7548
7549         * src/head.c (AUTHORS): Enclose string in N_(...), now that it
7550         includes a translatable word, `and'.
7551
7552         * src/dd.c (usage): Don't use `,' as the thousands separator
7553         in e.g. 1,000,000 and 1,048,576.  Instead, do this:
7554         `SIZE may be ..., MB 1000*1000, M 1024*1024 and so on...'
7555         * src/df.c (usage): Likewise.
7556         * src/du.c (usage): Likewise.
7557         * src/ls.c (usage): Likewise.
7558
7559         * Makefile.maint (syntax-check): Add another check.
7560
7561 2003-05-13  Paul Eggert  <eggert@twinsun.com>
7562
7563         Fix uniq to conform to POSIX, which requires that "uniq -d -u"
7564         must output nothing.  Problem reported by Josh Hyman.
7565
7566         * src/uniq.c (enum output_mode, mode): Remove, replacing with:
7567         (output_unique, output_first_repeated, output_later_repeated):
7568         New vars.  All uses of "mode" changed to use these variables,
7569         which are not mutually exclusive as "mode" was.
7570         (writeline): New arg "match", used to control whether to
7571         obey output_first_repeated or output_later_repeated.
7572         All callers changed.
7573         (check_file, main): Adjust to above changes.
7574
7575         * tests/uniq/Test.pm: Test that 'uniq -d -u' outputs nothing.
7576
7577 2003-05-14  Jim Meyering  <jim@meyering.net>
7578
7579         * tests/rm/rm3: Use tr's \n notation rather than \012.
7580         This package can afford to do that, since its tests are guaranteed use
7581         GNU tr, which has accepted the more modern notation for 10 years.
7582         * tests/rm/rm5: Likewise.
7583         * tests/cp/same-file: Likewise.
7584         * tests/stty/row-col-1: Likewise.
7585         * tests/stty/basic-1: Likewise.
7586         * tests/rm/deep-1: Likewise.
7587         * tests/mv/part-symlink: Likewise.
7588         * tests/mkdir/perm: Likewise.
7589         * tests/misc/nice: Likewise.
7590
7591 2003-05-13  Jim Meyering  <jim@meyering.net>
7592
7593         * src/copy.c (struct F_triple) [name]: Remove const attribute.
7594         (triple_free): Don't apply cast to argument of free.
7595         (seen_file): Add cast here instead.
7596
7597         * src/cp-hash.c (struct Src_to_dest) [name]: Remove const attribute.
7598         (src_to_dest_free): Don't apply cast to argument of free.
7599
7600         * src/sort.c (zaptemp): Don't apply cast to argument of free.
7601         * src/pr.c (init_fps, init_store_cols): Likewise.
7602         * src/join.c (delseq, freeline): Likewise.
7603         * src/expr.c (OLD): Likewise.
7604         * src/sort.c (sort): Likewise.
7605         * src/head.c (elide_tail_lines_pipe): Likewise.
7606
7607         * src/tail.c: Include "quote.h".
7608         Use quote in diagnostics.  Change many error format strings
7609         from just `%s' to e.g., `error reading %s'.
7610         (pipe_lines): Change type of parameter, n_lines, to uintmax_t.
7611         Rewrite newline-counting loop to use memchr.
7612
7613         * src/head.c (elide_tail_lines_pipe): Use `if', not assert.
7614         Now that assert is no longer used, don't include <assert.h>.
7615
7616 2003-05-12  Jim Meyering  <jim@meyering.net>
7617
7618         * src/head.c: Include <assert.h>.
7619         (AUTHORS): Add my name.
7620         (elide_tail_lines_pipe): New function.
7621
7622 2003-05-10  Jim Meyering  <jim@meyering.net>
7623
7624         * Makefile.maint (syntax-check): Check for `error (EXIT_SUCCESS,'.
7625
7626         * src/readlink.c (main): Set program_name before first use.
7627         Remove that (redundant) first use.
7628         Don't exit successfully just because --verbose was specified.
7629         Pass 0, not EXIT_SUCCESS, as first argument to error; when that
7630         parameter is 0, error does not exit.
7631
7632         * src/uname.c (main): When failing due to too many arguments, also say
7633         that, rather than just "Try `uname --help' for more information.".
7634         * src/comm.c (main): Likewise, but for too few arguments.
7635         * src/logname.c: Include error.h.
7636         (main): Say why we're failing.
7637
7638         * src/uniq.c (main): Don't segfault when argc < optind.
7639         * src/who.c (main): Handle argc < optind.
7640         * src/df.c (main): Likewise.
7641         * src/install.c (main): Likewise.
7642         * src/mv.c (main): Likewise.
7643         * src/pwd.c (main): Likewise.
7644         * src/tty.c (main): Likewise.
7645         * src/chroot.c (main): Likewise.
7646         * src/hostname.c: Likewise.
7647         * src/du.c (main): Likewise.
7648         * src/expand.c (main): Likewise.
7649         * src/env.c (main): Likewise.
7650         * src/unexpand.c (main): Likewise.
7651         * src/printenv.c (main): Likewise.
7652         * src/sync.c (main): Handle argc == 0.
7653         * src/expr.c (main): Likewise.
7654         * src/printf.c (main): Likewise.
7655         * src/basename.c (main): Likewise.
7656         * src/ln.c (main): Test for `missing argument' before computing n_files.
7657         * src/tail.c (main): Test for the case of no arguments before
7658         computing n_files.
7659
7660         * src/kill.c (send_signals): Don't check command line arguments here.
7661         (main): Check them here instead.  Handle argc < optind.
7662
7663         * src/logname.c (main): Use error, rather than fprintf, for the sake
7664         of consistency.
7665
7666         * src/rm.c (main): Don't overrun array bound if argc is 0.
7667
7668 2003-05-09  Jim Meyering  <jim@meyering.net>
7669
7670         * src/sort.c (main): Don't overrun array bound if argc is 0.
7671         That would happen when invoked via: execl ("/usr/bin/sort", NULL);
7672         Reported by Wartan Hachaturow.
7673
7674 2003-05-07  Jim Meyering  <jim@meyering.net>
7675
7676         Implement support so that `head --lines=-N' works on seekable files.
7677         * src/head.c (enum Copy_fd_status): Define.
7678         (COPY_FD_DIAGNOSE): New macro.
7679         (elide_tail_lines_seekable): New funtion.
7680         (elide_tail_lines_file): Call it here.
7681
7682 2003-05-06  Jim Meyering  <jim@meyering.net>
7683
7684         * src/sys2.h (CHAR_BIT): Remove duplicate definition.
7685
7686 2003-05-04  Jim Meyering  <jim@meyering.net>
7687
7688         * tests/head/Test.pm: Remove tests of --bytes=-N; using that framework
7689         caused the addition of thousands of small files to the tar archive.
7690         * tests/misc/head-elide-tail: New file.  Add them here instead.
7691         * tests/misc/Makefile.am (TESTS): Add head-elide-tail.
7692
7693 2003-05-04  Paul Eggert  <eggert@twinsun.com>
7694
7695         * src/remove.c (HAVE_WORKING_READDIR): Define to 0 if not defined.
7696         (IF_READDIR_NEEDS_REWINDDIR): Remove.
7697         (remove_cwd_entries): Rewrite to avoid IF_READDIR_NEEDS_REWINDDIR,
7698         which was a bit weird because it couldn't be emulated by a function.
7699
7700 2003-05-03  Jim Meyering  <jim@meyering.net>
7701
7702         Extend head to accept --lines=-N (--bytes=-N) and to print all
7703         but the N lines (bytes) at the end of the file.
7704         * src/head.c: Include full-write.h, full-read.h, inttostr.h, quote.h.
7705         Use quote() in diagnostics, rather than literal `' marks.
7706         (copy_fd, elide_tail_bytes_pipe, elide_tail_bytes_file):
7707         New functions.
7708         (elide_tail_lines_pipe, elide_tail_lines_file): New functions.
7709         (head_file): Reorganize so as to call head from only one place.
7710         (main): Likewise, for head_file.
7711         Handle new, undocumented option, --presume-input-pipe.
7712         Handle negative line and byte counts.
7713         * tests/head/Test.pm: Add lots of tests to exercise --bytes=-N.
7714
7715         * tests/du/8gb: Skip test if the file system of `.' doesn't support
7716         sparse files -- otherwise it'd create a file of size 8GB.
7717
7718 2003-05-02  Jim Meyering  <jim@meyering.net>
7719
7720         * src/fmt.c (usage): Don't mention obsolescent -WIDTH option.
7721         Instead explain about `-' and standard input.
7722         (main): Give a proper diagnostic for e.g., `fmt -c -72'.
7723         Reported by Keith Thompson.
7724         * tests/fmt/basic: Add test for the above fix.
7725
7726         * src/fmt.c: Include "quote.h".
7727         Use quote() in diagnostics, rather than literal `' marks.
7728         (main): Exit nonzero when unable to open an input file.
7729         * tests/fmt/basic: Add test for the above fix.
7730
7731         * src/fmt.c (main): Diagnose invalid suffix on obsolescent width
7732         specifications like `-72x'.
7733         * tests/fmt/basic: Add test for the above fix.
7734
7735         Work around nasty readdir bug on Darwin6.5.
7736         * src/remove.c (IF_READDIR_NEEDS_REWINDDIR): Define.
7737         [! HAVE_WORKING_READDIR] (remove_cwd_entries): If readdir has just
7738         returned NULL and there has been at least one successful unlink or
7739         rmdir call since the opendir or previous rewinddir, then call
7740         rewinddir and reiterate the loop.
7741
7742         Factor out common code.
7743         * src/remove.c (readdir_ignoring_dotdirs): New function.
7744         (is_empty_dir): Use it here.
7745         (remove_cwd_entries): Use it here.
7746
7747 2003-05-01  Jim Meyering  <jim@meyering.net>
7748
7749         * tests/rm/r-3: Create 500 rather than just 300 files.
7750         There's a bug in Darwin6.5's readdir that shows up only with
7751         338 or more files.
7752         Fix a bug in this test: `cd $pwd' (not to `..'), now that $tmp
7753         has two components.
7754
7755         * src/tail.c:
7756         Change type of n_units, n_bytes, n_lines to be `uintmax_t'.
7757         (dump_remainder): Move two declarations `down' into the scope
7758         where they are used.
7759         (xlseek): Return the resulting offset.
7760         (file_lines): Rename parameter, file_length, to end_pos.
7761         (pipe_lines): Don't coerce safe_read return value to `int'.
7762         Adapt tests accordingly.
7763         (pipe_bytes) [struct charbuffer] (nbytes): Change type from `int'
7764         to `unsigned int'.
7765         Change type of `total_bytes' from `int' to `size_t',
7766         since the former wouldn't always be wide enough.
7767         Don't coerce safe_read return value to `int',
7768         and adapt tests accordingly.
7769         Now that testing for a read error no longer involves
7770         using `tmp', handle that case *after* freeing `tmp'.
7771         (start_bytes): Clean up.
7772         (tail_bytes): Now that `n_bytes' may be larger than
7773         OFF_T_MAX, test for that condition and, if it's true, don't
7774         use lseek optimizations.
7775         (parse_options): Don't fail just because N_UNITS is larger than
7776         the maximum size of a file -- tail may be applied to an input
7777         stream (e.g., a pipe) with more data than that.
7778
7779         * Makefile.maint (syntax-check): Rename from alloc-check.
7780         Also check for SPACE-TAB sequences.
7781         Also check for malloc/calloc/realloc casts.
7782
7783 2003-05-01  Jim Meyering  <jim@meyering.net>
7784
7785         * src/tail.c (start_lines): Rewrite to use memchr.  Clean up.
7786
7787 2003-04-28  Jim Meyering  <jim@meyering.net>
7788
7789         * tests/misc/tty-eof: Send two tokens, not just one, so we don't
7790         make the now-more-picky tsort fail.
7791
7792 2003-04-24  Jim Meyering  <jim@meyering.net>
7793
7794         * src/tsort.c (tsort): Remove unnecessary test of have_read_stdin.
7795         (main): Minor syntactic clean-up.
7796
7797         * src/tsort.c (tsort): Fail if the input contains an odd number of
7798         tokens.  Reported by junkio@cox.net.
7799
7800         * tests/tsort/basic-1: Test for the above fix.
7801
7802 2003-04-21  Jim Meyering  <jim@meyering.net>
7803
7804         * tests/misc/printf: Add tests for the printf fixes below.
7805
7806         * Makefile.cfg (cvs_files): Add $(srcdir)/config/depcomp to the list.
7807
7808 2003-04-20  Paul Eggert  <eggert@twinsun.com>
7809
7810         Fix printf POSIX compatibility bug reported by Ben Harris in
7811         <http://mail.gnu.org/archive/html/bug-coreutils/2003-04/msg00070.html>.
7812         * doc/coreutils.texi (printf invocation): It's \NNN in the format,
7813         \0NNN in the %b operand.
7814         * src/printf.c (usage): Likewise.
7815         (print_esc): New arg OCTAL0 to specify whether \0NNN or \NNN
7816         is desired.  All uses changed.  Behave like Bash printf if %b
7817         operand uses \NNN where the initial N is not 0.
7818
7819 2003-04-17  Jim Meyering  <jim@meyering.net>
7820
7821         * src/stty.c: Remove uses of PROTOTYPE macro.
7822
7823 2003-04-15  Jim Meyering  <jim@meyering.net>
7824
7825         * Makefile.maint: Remove (or replace-with-TAB(s) to retain alignment)
7826         each sequence of spaces before a TAB character.
7827
7828 2003-04-13  Jim Meyering  <jim@meyering.net>
7829
7830         * src/remove.c (is_empty_dir): Don't closedir (NULL).
7831
7832 2003-04-12  Jim Meyering  <jim@meyering.net>
7833
7834         Giving nl an invalid STYLE argument (in --header-numbering=STYLE (-h),
7835         --body-numbering=STYLE (-b), or --footer-numbering=STYLE (-f)) or
7836         FORMAT (--number-format=FORMAT (-n)) would not give a useful diagnostic.
7837         * src/nl.c (main): Fix those problems and remove literal quote marks
7838         (e.g., "`%s'") from format string; instead use "%s" in each format
7839         string and `quote (optarg)' as the corresponding argument.
7840         Also, diagnose all invalid command line options before failing.
7841
7842         * src/nl.c (proc_text): Fix a bug that would make nl output extra
7843         newlines in some cases.  Details here: http://bugs.debian.org/177256.
7844         This bug was introduced on 2001-11-10 for textutils-2.0.17.
7845         * tests/misc/nl: Add test for the above-fixed bug.
7846
7847         * tests/misc/readlink: New file.  Test the --canonicalize option.
7848         * tests/misc/Makefile.am (TESTS): Add readlink.
7849
7850 2003-04-11  Jim Meyering  <jim@meyering.net>
7851
7852         Clean up.
7853         * src/chown.c, src/cp.c, src/dircolors.hin, src/du.c, src/ln.c:
7854         * src/mkfifo.c, src/ptx.c, src/spline.c, src/stty.c, src/tail.c:
7855         * src/test.c, src/unexpand.c: Remove (or replace-with-TAB(s) to
7856         retain alignment) each sequence of spaces before a TAB character.
7857
7858         * src/ls.c: Include <stdlib.h> unconditionally.
7859
7860         * Makefile.maint (xalloc-check): Rename from header-check.
7861
7862         * src/yes.c: Include error.h after system.h, not before.
7863
7864         Clean up.
7865         * src/copy.c, src/cp-hash.c, src/cp.c, src/csplit.c, src/cut.c:
7866         * src/date.c, src/df.c, src/du.c, src/expand.c, src/expr.c, src/id.c:
7867         * src/join.c, src/md5sum.c, src/nl.c, src/od.c, src/paste.c, src/pr.c:
7868         * src/ptx.c, src/sort.c, src/split.c, src/su.c, src/tail.c, src/tee.c:
7869         * src/tr.c: * src/unexpand.c, src/users.c:
7870         Remove anachronistic casts of xmalloc, xrealloc, and xcalloc
7871         return values and of xrealloc's first argument.
7872         Fix the former with this:
7873         perl -pi -e 's/\([^(]*?\*\) *(x(m|c|re)alloc)\b/$1/'
7874
7875 2003-04-10  Jim Meyering  <jim@meyering.net>
7876
7877         * src/stty.c (wrapf): Declare with format attribute.
7878
7879         The S_MAGIC_... names shouldn't be maintained in two places (prior
7880         to this change, one would have to keep stat.c and fs.h in sync).
7881         This change makes it so those names and the corresponding
7882         hexadecimal constants all reside in stat.c.  fs.h is now generated.
7883         * src/Makefile.am (fs.h): New rule to generate fs.h from stat.c.
7884         (BUILT_SOURCES): Add fs.h, now that it's generated.
7885         (EXTRA_DIST): Add extract-magic.
7886         * src/extract-magic: New script to extract fs.h definitions from stat.c.
7887         * src/stat.c (human_fstype) [__linux__]: Append each hex constant from
7888         fs.h in a comment after the corresponding `case S_MAGIC_...:' statement.
7889
7890         * tests/tail-2/big-4gb: Skip this test (don't fail) if creating a
7891         file with nominal length > 4GB fails.  Reported by Michael Deutschmann.
7892
7893         * man/unexpand.x: Add `SEE ALSO' reference to expand.
7894         * man/expand.x: Add `SEE ALSO' reference to unexpand.
7895         Suggestion from Dan Jacobson.
7896
7897 2003-04-10  Maciej W. Rozycki  <macro@ds2.pg.gda.pl>
7898
7899         * src/fs.h (S_MAGIC_DEVPTS): New magic for Linux's devpts.
7900         * src/stat.c (human_fstype): Handle Linux's devpts.
7901
7902 2003-04-09  Paul Eggert  <eggert@twinsun.com>
7903
7904         * src/split.c (line_bytes_split): Arg is of type size_t, since
7905         that's all that is supported for now.
7906         (main): Check for overflow in obsolescent line count option.
7907
7908 2003-04-09  Jim Meyering  <jim@meyering.net>
7909
7910         * tests/misc/split-fail: Add a new test for the above fix.
7911
7912         * src/split.c (bytes_split): Use size_t temporary (rather than
7913         uintmax_t original) in remaining computations.  From Paul Eggert.
7914
7915         Handle command line option arguments larger than 2^31.
7916         This allows e.g., splitting into files of size 2GB and larger,
7917         and running split --lines=N with N=2^31 or more.
7918         But for --line-bytes=N, the restriction that N <= SIZE_MAX
7919         remains (for now), due to the way it is implemented.
7920
7921         * src/split.c: Include "inttostr.h".
7922         (bytes_split, lines_split, line_bytes_split, main):
7923         Use uintmax_t, not size_t, for file sizes.
7924         (main): Give a better diagnostic for option arguments == 0.
7925         Use umaxtostr to print file sizes.
7926         Reported by Luke Hassell.
7927
7928 2003-04-08  Jim Meyering  <jim@meyering.net>
7929
7930         * src/rm.c (usage): Mention that --directory (-d) works only
7931         on some systems.  Suggestion from Samuel Tardieu.
7932
7933         * tests/basename/basic: Run $PERL to see if it is available,
7934         rather than testing its value.
7935         * tests/sum/sysv, tests/tsort/basic-1, tests/unexpand/basic-1:
7936         * tests/basename/basic, tests/dd/skip-seek, tests/dircolors/simple:
7937         * tests/expr/basic, tests/factor/basic, tests/fmt/basic:
7938         * tests/ls-2/tests, tests/md5sum/basic-1, tests/md5sum/newline-1:
7939         * tests/misc/sort, tests/misc/tty-eof, tests/mv/i-1:
7940         * tests/rm/empty-name, tests/rm/fail-eperm, tests/rm/unreadable:
7941         * tests/seq/basic, tests/sha1sum/basic-1, tests/sha1sum/sample-vec:
7942         * tests/sum/basic-1, tests/seq/basic: Likewise.
7943
7944         * tests/misc/Makefile.am (TESTS): Add split-fail.
7945         * tests/misc/split-fail: New file.
7946
7947         * src/split.c: Rename local variables: nchars -> n_bytes.
7948         (lines_split): Rename local, nlines -> n_lines.
7949         (main): Rename local variable: s/accum/n_units/.
7950         (main): Use STDIN_FILENO, not literal `0'.
7951
7952 2003-04-07  Jim Meyering  <jim@meyering.net>
7953
7954         * src/stat.c: Add #include directives for Ultrix 4.4.
7955         Based on a suggested change from Bert Deknuydt.
7956
7957 2003-04-06  Jim Meyering  <jim@meyering.net>
7958
7959         * Makefile.maint (makefile-check): New rule.
7960         (local-check): Add it.
7961
7962 2003-04-05  Jim Meyering  <jim@meyering.net>
7963
7964         * Makefile.am (nearly all of them):
7965         Use $(VAR) rather than @VAR@, now that we can rely on automake to
7966         emit a definition for each substituted variable.
7967         * tests/Makefile.am.in: Likewise.
7968
7969         * tests/rm/rm5: Add a comment explaining why this test fails when
7970         using Tru64's broken sed.
7971         * tests/rm/rm3: Likewise.
7972
7973         Make `kill -t' output signal descriptions (not `?') on Tru64.
7974         * src/kill.c (sys_siglist): Also check for __sys_siglist.
7975         Patch by Tony Leneis.
7976         * configure.ac: Also check for declaration of __sys_siglist.
7977         Required for Tru64 4.0D, 4.0F, and 5.1.
7978         Reported by Tony Leneis.
7979
7980 2003-04-04  Jim Meyering  <jim@meyering.net>
7981
7982         * src/Makefile.am (PERL): Remove unnecessary definition.
7983
7984         Because of inappropriate (but POSIX-mandated) behavior of rename,
7985         `mv a b' would not remove `a' in some unusual cases.  Work around
7986         this by unlinking `a' when necessary.
7987
7988         * src/copy.c (same_file_ok): Add an output parameter.
7989         Set it in the offending case.
7990         (copy_internal): When necessary, unlink SRC_PATH and inform caller.
7991         Reported by Ed Avis.
7992         * tests/mv/hard-4: New test for the above.
7993         * tests/mv/Makefile.am (TESTS): Add hard-4.
7994
7995         Clean up rules for automatically generated sources:
7996         * src/Makefile.am (dircolors.h, wheel-size.h, wheel.h, false.c):
7997         Make each generated file be read-only.
7998         Add each file name to BUILT_SOURCES separately.
7999         (MAINTAINERCLEANFILES): Set to $(BUILT_SOURCES).
8000
8001         Put LOCALEDIR macro definition in new file: localedir.h.
8002         * src/Makefile.am (DEFS): Remove definition.
8003         (localedir.h): New rule.
8004         (BUILT_SOURCES, DISTCLEANFILES): Add localedir.h.
8005         * src/system.h: Include "localedir.h".
8006
8007 2003-04-02  Jim Meyering  <jim@meyering.net>
8008
8009         * Version 5.0.
8010
8011         * tests/misc/Makefile.am (TESTS): Add false.
8012
8013         * Makefile.maint (TMPDIR): Make sure it's defined.
8014         (my-distcheck): Build in $(TMPDIR), not `.'.
8015
8016         * src/Makefile.am (false.c): Change all occurrences of
8017         `(EXIT_SUCCESS)' to `(EXIT_FAILURE)' so that false exits
8018         unsuccessfully also with --help.  Reported by Paul Jarc,
8019         * tests/misc/false: New test for the above.
8020
8021 2003-03-30  Jim Meyering  <jim@meyering.net>
8022
8023         * NEWS: Note the location of older NEWS files.
8024
8025         * src/remove.c (is_empty_dir): Don't let a failing closedir
8026         clobber errno.  Spotted by Arnold Robbins.
8027
8028         * src/env.c: Fix typo in comment.  From Arnold Robbins.
8029
8030 2003-03-29  Jim Meyering  <jim@meyering.net>
8031
8032         * Version 4.5.12.
8033
8034         * README: Note to expect build problems for stat.c on Ultrix 4.3.
8035         Note that there are some harmless test failures when running
8036         `make check' as root on some systems.
8037
8038 2003-03-28  Jim Meyering  <jim@meyering.net>
8039
8040         * tests/stty/row-col-1: Skip this test if stty can't get window size.
8041         This happens when connecting to sparc-solaris5.7 via ssh from within
8042         emacs.  Reported by Karl Berry.
8043
8044         * tests/du/basic: Use seq, not `yes' to generate 4KB of data.
8045         Otherwise, on systems (DJGPP) that emulate pipes using files,
8046         this test would never complete, waiting for `yes' to terminate.
8047         * tests/du/slink: As above, use seq, not `yes' to generate link target.
8048         * tests/rm/hash: As above, use seq, not `yes' to generate dir name.
8049         Reported by Rich Dawe.
8050
8051 2003-03-27  Jim Meyering  <jim@meyering.net>
8052
8053         * src/id.c: Remove Arnold Robbins' obsolete e-mail address
8054         from `written by...' comment, at his request.
8055
8056 2003-03-24  Paul Eggert  <eggert@twinsun.com>
8057
8058         Fix buffer overrun problem reported by TAKAI Kousuke, along
8059         with some other POSIX incompatibilities.
8060
8061         * src/printf.c (print_esc): Do not treat \x specially if
8062         POSIXLY_CORRECT.  Avoid buffer overrun if the format ends
8063         in backslash.  Treat incomplete escape sequences as strings
8064         of characters, as POSIX requires.
8065         (print_formatted): Allow multiple flags.  Avoid buffer overrun
8066         if the format is incomplete.
8067
8068 2003-03-24  Jim Meyering  <jim@meyering.net>
8069
8070         * tests/misc/printf: Add tests for the above fixes and changes.
8071
8072 2003-03-26  Jim Meyering  <jim@meyering.net>
8073
8074         * src/copy.h (struct cp_options): Add a comment.
8075
8076 2003-03-23  Jim Meyering  <jim@meyering.net>
8077
8078         * README: Describe problem with 64-bit mode on HPUX 11.x,
8079         with patch for /usr/include/inttypes.h.
8080         * TODO: Plan to add an autoconf test to work around the bug.
8081
8082 2003-03-22  Jim Meyering  <jim@meyering.net>
8083
8084         * src/stat.c: Don't include <sys/sysmacros.h>.
8085         That is already done via system.h.  Otherwise, the multiple
8086         inclusion would evoke redefinition warnings from Cray's /bin/cc,
8087         aka Cray Standard C Version 4.0.3  (057126) Mar 22 2003  22:02:28.
8088         (human_fstype): Factor some directives `up', out of this function.
8089         Cast away `const' to avoid error from Cray's /bin/cc.
8090
8091 2003-03-20  Jim Meyering  <jim@meyering.net>
8092
8093         * announce-gen (print_changelog_deltas): Ensure that a newline
8094         precedes each row of `*'s.
8095
8096 2003-03-20  Jim Meyering  <jim@meyering.net>
8097
8098         * Version 4.5.11.
8099
8100         * src/seq.c (valid_format): Also accept ` ' and `'' as valid
8101         format flag characters.
8102         Do not require that a field width be specified.
8103         Do not fail when given a field width of `0'.
8104         Reported by Dan Jacobson.
8105         * tests/seq/basic: Add new tests for the above-fixed bug.
8106
8107         * src/Makefile.am (all-local): Append $(EXEEXT) to use of `su'
8108         (install-root): Likewise.
8109         (install-exec-local): Likewise.
8110         Based on a patch from Richard Dawe.
8111
8112 2003-03-19  Jim Meyering  <jim@meyering.net>
8113
8114         * man/Makefile.am (.x.1): Use $(LN_S) instead of 'ln -s',
8115         because the DJGPP 2.03 port of 'ln -s' doesn't work.
8116         Include $(EXEEXT) in program names.
8117         Since $(LN_S) may degenerate to `cp -p', be careful
8118         to invoke it from the destination directory.
8119         Mostly from Richard Dawe.
8120         * configure.ac: Use AC_PROG_LN_S.
8121
8122         * tests/mv/part-symlink: Unset CDPATH.  Otherwise, having the
8123         CDPATH shell variable set could cause this test to fail.
8124         Reported by Karl Berry.
8125
8126 2003-03-18  Jim Meyering  <jim@meyering.net>
8127
8128         * src/fmt.c [struct Word] (paren, period, punct, final): Change the
8129         type of each member from bool <MEMBER>:1 to unsigned int <MEMBER>:1.
8130         AIX 5.1's xlc could not compile the former.
8131         Patch by Petter Reinholdtsen.  Also reported by Mike Jetzer.
8132
8133 2003-03-17  Richard Dawe  <rich@phekda.freeserve.co.uk>
8134
8135         * configure.ac: Include $(EXEEXT) in OPTIONAL_BIN_PROGS'
8136         program names, since automake only adds $(EXEEXT) to programs
8137         in its *_PROGRAMS.
8138
8139 2003-03-16  Jim Meyering  <jim@meyering.net>
8140
8141         * src/remove.c (rm): Put two local variables in static storage,
8142         so they can't be clobbered by the potential longjmp.
8143
8144 2003-03-15  Jim Meyering  <jim@meyering.net>
8145
8146         * Makefile.cfg (gnu_rel_host): Fix code to match the comment
8147         so that a version number with a two-digit component can still count
8148         as an alpha release.  Reported by Richard A Downing.
8149         (gnu_rel_host): Define in terms of $(RELEASE_TYPE) instead.
8150
8151 2003-03-14  Jim Meyering  <jim@meyering.net>
8152
8153         * src/ansi2knr.c: Remove no-longer-used file.
8154         * src/ansi2knr.1: Likewise.
8155
8156         * Makefile.maint (prev_version_file): Don't use ?= for this particular
8157         assignment, since it causes trouble with old versions of GNU make
8158         (e.g. 3.76.1).  The other uses of `?=' are inoffensive.  Details here.
8159         http://mail.gnu.org/archive/html/bug-coreutils/2003-03/msg00028.html
8160         Patch from Alexandre Duret-Lutz.
8161
8162         * Use patched automake-1.7.3.  Regenerate Makefile.in files in
8163         subdirectories so that each includes a definition of ACLOCAL_M4.
8164
8165         * announce-gen (main): Label the compressed source URLs.
8166
8167         * Version 4.5.10.
8168
8169         * tests/du/slink: Relax the test for the `local'ness of a file system,
8170         so that now it works also for tmpfs.
8171
8172         * tests/du/hard-link: Transform output from first du, so that this
8173         test doesn't fail on file systems like tmpfs that order directory
8174         entries differently.
8175
8176 2003-03-13  Jim Meyering  <jim@meyering.net>
8177
8178         * tests/du/8gb: Work around what appears to be an NFS failure that
8179         would make this test fail on some systems.
8180
8181 2003-03-11  Jim Meyering  <jim@meyering.net>
8182
8183         * tests/du/basic: Make the test file exactly 4k bytes long.
8184
8185         * src/split.c (longopts): Don't hard-code `2' here.
8186         Instead, just specify `&verbose', and ...
8187         (main): ... remove the `case 2:' block for --verbose.
8188
8189         * tests/du/basic: Make the test file larger than 64 bytes, so that
8190         we don't immediately disqualify file systems (e.g., NetApp) on which
8191         smaller files take up zero disk blocks.  Reported by Vin Shelton.
8192
8193 2003-03-10  Jim Meyering  <jim@meyering.net>
8194
8195         Don't segfault for a negative field width or precision in format string.
8196         Note that this is just a stopgap fix.  The longer term solution may
8197         involve adapting bash's builtins/printf.def.
8198
8199         * src/printf.c: (UNSPECIFIED): Define.
8200         (print_direc): Use the special value, UNSPECIFIED, to indicate
8201         that field_width or precision has not been specified.
8202         (print_formatted): Fail if field_width or precision is the
8203         special value, UNSPECIFIED.
8204         Reported by Oliver Kiddle <okiddle@yahoo.co.uk>
8205
8206         * src/sys2.h (INT_MIN): Define, if necessary.
8207         * tests/misc/printf: Add a test for the above-fixed bug.
8208
8209 2003-03-09  Jim Meyering  <jim@meyering.net>
8210
8211         * src/remove.c (AD_stack_pop): Cast sizeof... to int before
8212         changing its sign.  This avoids a warning from gcc on 64-bit systems.
8213         Reported by Bob Proulx.
8214         (pop_dir): Reverse order of sign change and cast, to be consistent
8215         with the above.
8216
8217 2003-03-08  Jim Meyering  <jim@meyering.net>
8218
8219         * tests/Makefile.am (evar-check): Check for POSIXLY_CORRECT not as a
8220         shell variable, but only in the environment.  With /bin/sh->bash, the
8221         shell variable is set to `y', and that would cause a spurious warning.
8222         Reported by Bob Proulx.
8223
8224         * tests/Makefile.am (check-root): Remove touch/fifo.
8225         It doesn't appear to have to be run as root.
8226
8227         * tests/rm/fail-2eperm: Rather than simply using the first non-root
8228         user name, make sure that the selected user name has a usable shell.
8229         Reported by Paul Jarc.
8230
8231         Before, when using shred on a device, one had to specify --exact,
8232         or be careful to choose a size that would not be rounded up and
8233         exceed the maximum value;  that could result in a failure of
8234         the final write.
8235         * src/shred.c (do_wipefd): --exact is now the default for non-regular
8236         files.  Suggestion from Ben Elliston.
8237         (usage): Say it.
8238
8239         * tests/misc/tty-eof: Require at least version 1.11 of Expect.pm.
8240         Old versions of Expect.pm (e.g., 1.07) lack the log_user function.
8241         Patch by Bob Proulx.
8242
8243         * src/Makefile.am (check-misc): Check for use of `defined' in
8244         #define directives.
8245         Change to $(srcdir) before running grep.
8246
8247         * src/sleep.c: Remove now-unused #include and #define directives.
8248
8249         * src/du.c (process_file): If a file's size is not being counted
8250         e.g., because it's a hard link to a file we've already counted,
8251         then don't print a line for it.
8252
8253         * tests/du/hard-link: New test for the above-fixed bug.
8254         * tests/du/Makefile.am (TESTS): Add hard-link.
8255
8256         `du -S' didn't work
8257         * src/du.c: Revert most of the `reorganization' change of 2003-02-20,
8258         and make the two-array approach work.
8259
8260         * tests/du/basic: Correct/add tests for the above fix.
8261         Set LC_ALL, etc., now that we use sort.
8262         Check the block/size of a small file, too.
8263         Correct expected results for simple dir1/dir2/file case.
8264         Add another test of du -S.
8265
8266 2003-03-07  John David Anglin  <dave.anglin@nrc-cnrc.gc.ca>
8267
8268         Avoid build failure with gcc on hppa1.1-hp-hpux10.20 (see GCC PR
8269         middle-end/9986).  As one of GCC's optimizations, it transforms a
8270         fputs_unlocked call to a fputc_unlocked call when the string is
8271         one character long.  However, hpux doesn't have fputc_unlocked.
8272
8273         * expr.c (usage): Use putchar, not fputs, to output a single character.
8274         * ls.c (dired_dump_obstack): Likewise.
8275         * ptx.c (output_one_tex_line, output_one_dumb_line): Likewise.
8276         * stat.c (print_it): Likewise.
8277
8278 2003-03-07  Jim Meyering  <jim@meyering.net>
8279
8280         * src/cp.c: Remove everything associated with mmap-stack.c.
8281         This reverts the two changes of 2003-02-21.
8282         * src/du.c: Remove everything associated with mmap-stack.c.
8283         This reverts the change of 2003-02-19.
8284
8285 2003-03-06  Jim Meyering  <jim@meyering.net>
8286
8287         * tests/cp/same-file: Unset CDPATH.  Otherwise, having the
8288         CDPATH shell variable set could cause this test to fail.
8289         Reported by Karl Berry.
8290
8291 2003-03-05  Jim Meyering  <jim@meyering.net>
8292
8293         * Version 4.5.9.
8294
8295         * src/printf.c (print_esc): Remove pointless comparison of unsigned
8296         integer with zero, to avoid a warning from Intel's ecc.
8297         Reported by Nelson Beebe.
8298
8299         * src/du.c (process_file): Sizes must all be of type uintmax_t.
8300         Otherwise, for files or totals that are too big, numbers would
8301         be truncated.  Patch mostly by Michael Stone.
8302         Reported by Ingo Saitz as Debian bug #183210.
8303
8304         * tests/du/8gb: New test for the above-fixed bug.
8305         * tests/du/Makefile.am (TESTS): Add 8gb.
8306
8307         * src/du.c (MAX_N_DESCRIPTORS): Use 3 * UTILS_OPEN_MAX / 4
8308         rather than UTILS_OPEN_MAX - 10.
8309
8310 2003-03-04  Jim Meyering  <jim@meyering.net>
8311
8312         * README: Refer new feature discussion to bug-coreutils@gnu.org,
8313         rather than bug-gnu-utils, now that the former is better known.
8314         Suggestion from Göran Uddeborg.
8315
8316         * src/stat.c (usage): Capitalize consistently.
8317         Reported by Göran Uddeborg.
8318
8319         * Makefile.maint (rel-files): Include $(signatures), so that
8320         those files are also copied into $(release_archive_dir).
8321
8322         * src/df.c (find_mount_point): Call error here, now that restore_cwd
8323         no longer does it.
8324         * src/remove.c (AD_pop_and_chdir): Likewise.
8325
8326         * tests/Makefile.am (check-root): Add fail-2eperm.
8327
8328 2003-03-03  Jim Meyering  <jim@meyering.net>
8329
8330         * src/remove.c (remove_cwd_entries): Include the full filename of
8331         the offending file, not just the basename.
8332
8333         * tests/misc/tty-eof: Set $ME properly.
8334
8335         * Makefile.maint (THIS_VERSION_REGEXP, PREV_VERSION_REGEXP):
8336         Remove now-unused variables.
8337         (tag-prev-version, prev-cvs-tag): Likewise.
8338
8339         * src/remove.c (remove_cwd_entries) [!ROOT_CAN_UNLINK_DIRS]: Give an
8340         accurate diagnostic when failing to remove a file owned by some other
8341         user.  Reported by Ivo Timmermans via Michael Stone.
8342         This fixes Debian bug# 178471.
8343
8344         * tests/rm/Makefile.am (TESTS): Add fail-2eperm.
8345         * tests/rm/fail-2eperm: New test, for the above-fixed bug.
8346         Based on a report from Ivo Timmermans.
8347
8348 2003-03-02  Jim Meyering  <jim@meyering.net>
8349
8350         * src/copy.c (copy_internal) [un_backup]: When recovering from a
8351         failure to create a hard link, do not remove the entry associating
8352         the source dev/ino with the destination file name.
8353         * tests/mv/Makefile.am (TESTS): Add hard-3.
8354         * tests/mv/hard-3: New test, for the above-fixed bug.
8355         Inspired by a report from Iida Yosiaki.
8356
8357 2003-03-01  Jim Meyering  <jim@meyering.net>
8358
8359         * src/df.c (print_header): Don't embed spaces in a separate `Type'
8360         header string.  Instead, put `Filesystem' and `Type' headers in the
8361         same string, so translators can use horizontal space as needed.
8362         Reported by Jean Charles Delepine.
8363
8364 2003-02-28  Jim Meyering  <jim@meyering.net>
8365
8366         * src/copy.c (copy_internal): When link fails because of an
8367         existing destination file, unlink that file and try again.
8368         Reported by Iida Yosiaki.
8369
8370         * tests/mv/Makefile.am (TESTS): Add hard-2.
8371         * tests/mv/hard-2: New test for the above-fixed bug.
8372         Based on a test case from Iida Yosiaki.
8373
8374 2003-02-26  Jim Meyering  <jim@meyering.net>
8375
8376         * tests/du/basic: Don't test du's -b option here.  Directory byte
8377         counts are smaller (512 rather than 4096) on at least OSF/1 5.1
8378         and IBM AIX 4.2.  Reported by Nelson Beebe.
8379
8380 2003-02-25  Jim Meyering  <jim@meyering.net>
8381
8382         * Makefile.maint (announcement): Now that ChangeLog entries
8383         are output by announce-gen, don't do it here.
8384         * announce-gen (print_changelog_deltas): New function.
8385         (main): Use it.
8386
8387 2003-02-22  Jim Meyering  <jim@meyering.net>
8388
8389         * announce-gen: New option: --release-type=TYPE
8390         * Makefile.maint (beta, major): New targets.  Remove `release'.
8391         Put them all together on a line.
8392         Pass the release type (via RELEASE_TYPE envvar) to the MAKE
8393         invocation of `announcement'.
8394         (announcement): Invoke announce-gen with --release-type=$RELEASE_TYPE.
8395
8396         * announce-gen: New option: --news=NEWS_FILE.
8397         Extract NEWS entries here, not via rules in Makefile.maint.
8398         * Makefile.maint (announcement): Now that NEWS entries are
8399         extracted by announce-gen, don't do it here.
8400         (news-r1, news-r2): Remove now-unused definitions.
8401
8402 2003-02-21  Jim Meyering  <jim@meyering.net>
8403
8404         * Version 4.5.8.
8405
8406         Merge in changes from autoconf's version of this file.
8407         * Makefile.maint (www-gnu): Define.
8408         (standards.texi-url_prefix): Use $(www-gnu).
8409         (make-stds.texi-url_prefix): Likewise.
8410
8411         * src/cp.c: Include "mmap-stack.h".
8412         (main): Invoke `run' through a macro that (when possible) runs it
8413         with a large, mmap'd stack.
8414
8415         * src/cp.c (run): New function, preparing for the above.
8416         Exit from this function, not from main
8417         (main): Call run.
8418
8419         * src/du.c: New option: --apparent-size.
8420         (enum) [APPARENT_SIZE_OPTION]: New member.
8421         (long_options): Add it.
8422         (usage): Describe it.
8423         (main): Handle it.
8424         ['b']: Set apparent_size.
8425         David Eisner reported that the behavior of --bytes had changed.
8426         Paul Eggert proposed the use of a new option, --apparent-size.
8427
8428         * src/du.c (apparent_size): New global.
8429         (print_only_size): Reflect the fact that we're printing byte counts,
8430         not ST_NBLOCKSIZE-byte-block counts.
8431         (print_size): Call print_only_size rather than duplicating its code.
8432         (process_file): Accumulate byte counts, rather than block counts.
8433
8434         * src/du.c (process_file): Always reset size_to_propagate_to_parent
8435         for --separate-dirs (-S).
8436
8437 2003-02-20  Jim Meyering  <jim@meyering.net>
8438
8439         * Use automake-1.7.3.  Regenerate dependent files.
8440
8441         * src/stat.c (print_stat): New format: %B (to print ST_NBLOCKSIZE).
8442         This makes %b (number of ST_NBLOCKSIZE-byte blocks) more useful.
8443         (usage) [%B]: Describe it.
8444         [%b]: Refer to %B.
8445
8446         * src/du.c (process_file): Reorganize the code to use only
8447         one `sum' array, and change how -S works back to the way it was
8448         before 2003-01-31.  Patch by Bruno Haible.
8449
8450         * tests/du/basic: New test.
8451         * tests/du/Makefile.am (TESTS): Add basic.
8452
8453         * tests/envvar-check: Add checks for the following:
8454         BLOCK_SIZE, DU_BLOCK_SIZE, DF_BLOCK_SIZE, LS_BLOCK_SIZE.
8455
8456         * tests/Makefile.am: Rename phony target envvar-check to evar-check
8457         so as not to conflict with the distributed file by the same name.
8458
8459         * src/du.c (process_file): Set info->skip before any possible return.
8460
8461         Report correct usage for directories, not 0.
8462         * src/du.c (process_file): Return for `file_type == FTW_DPRE'
8463         _before_ recording the dev/ino of a directory.
8464         Reported by Bruno Haible.
8465
8466         Now, df always displays the device file name corresponding to the
8467         listed mount point under `Filesystem'.  Before, for an unmounted
8468         block- or character-special file argument, it would display the
8469         command-line argument instead.
8470         * src/df.c (show_disk): Return a value indicating whether
8471         there was a match.  Don't try to find a mount point here.
8472         (show_entry): If show_disk doesn't find a match, call show_point.
8473
8474 2003-02-19  Jim Meyering  <jim@meyering.net>
8475
8476         * src/du.c: Include "mmap-stack.h".
8477         (du_files): Add prototype with ATTRIBUTE_NORETURN.
8478         Exit from this function, not from...
8479         (main): ...here.
8480         Instead, if possible, invoke du_files through a macro that
8481         runs it with a large, mmap'd stack.
8482
8483         * src/join.c (usage): Change wording in --help output:
8484         use FILENUM instead of `SIDE' and say what FILENUM means.
8485         Reported by Bernhard Gabler.
8486
8487         * src/df.c (print_header): Rather than using a hard-coded literal
8488         string of spaces matching the length of the English `...Type' header,
8489         output the right number of spaces to match the selected translation.
8490         Reported by Yann Dirson and Jean Charles Delepine as Debian bug 131113.
8491
8492         * src/split.c (bytes_split): Remove unnecessary `else' after break.
8493         (lines_split): Likewise.  and correct misleading indentation.
8494
8495         * src/split.c: Include "full-read.h".
8496         (bytes_split, lines_split, line_bytes_split): Use full_read,
8497         not safe_read.   The way split was using the latter, a short read
8498         could cause split to terminate before EOF.
8499
8500         * tests/misc/tty-eof: Test all programs that can read stdin,
8501         requiring no arguments and that write to standard output.
8502
8503         * tests/misc/tty-eof: New file.  Renamed from ...
8504         * tests/misc/cat-tty-eof: Remove file.  Rename to tty-eof.
8505         * tests/misc/Makefile.am (TESTS): Reflect renaming.
8506
8507 2003-02-18  Jim Meyering  <jim@meyering.net>
8508
8509         cksum would perform an extra read after encountering EOF
8510         * src/cksum.c (cksum): Exit the loop upon EOF, too.
8511         Patch by Michael Bacarella.
8512
8513         Test for the bug fixed today in cksum, md5sum, and sha1sum.
8514         * tests/misc/cat-tty-eof: Generalize, clean-up, and test for
8515         cat, cksum, md5sum, and sha1sum all in the same loop.
8516
8517 2003-02-14  Jim Meyering  <jim@meyering.net>
8518
8519         * src/remove.c: Include "euidaccess.h".
8520         Remove declaration of euidaccess.
8521
8522 2003-02-12  Jim Meyering  <jim@meyering.net>
8523
8524         * src/pathchk.c (portable_chars_only): Remove unnecessary `const'
8525         in cast to avoid warning from icc.  Reported by Alexandre Duret-Lutz.
8526
8527 2003-02-10  Jim Meyering  <jim@meyering.net>
8528
8529         * src/test.c: Don't include group-member.h.
8530         Include euidaccess.h.
8531         (eaccess): Rewrite function to set the real uid and gid temporarily
8532         to the effective uid and gid, then invoke 'access', and then set the
8533         real uid and gid back.  On systems that lack setreuid or setregid,
8534         fall back on the kludges in euidaccess.  Before, it would not work
8535         for e.g., files with ACLs, files that were marked immutable,
8536         or on file systems mounted read-only.  Nelson Beebe raised the issue.
8537         Paul Eggert suggested the new implementation.
8538
8539 2003-02-09  Jim Meyering  <jim@meyering.net>
8540
8541         * src/test.c (test_stat): Remove function.  It's job is done (only
8542         when necessary) by the wrapper in lib/stat.c.  Adjust all uses.
8543
8544 2003-02-08  Jim Meyering  <jim@meyering.net>
8545
8546         * Version 4.5.7.
8547
8548         * tests/mv/part-symlink: Don't assume that the file owner username
8549         length is less than 9 in ls output: instead, omit that field
8550         altogether.  Reported by, and suggested fix from, Ferdinand.
8551
8552         * tests/du/restore-wd: New test for just-fixed bug in ftw.c.
8553         * tests/du/Makefile.am (TESTS): Add restore-wd.
8554
8555         * src/rm.c: Correct now-invalid comment about cycle-detection.
8556
8557 2003-02-06  Jim Meyering  <jim@meyering.net>
8558
8559         * NEWS: Add entries from old/*/NEWS
8560         from fileutils-4.1 through 4.1.11 and
8561         from sh-utils-2.0 through 2.0.15.  Suggestion from Karl Berry.
8562
8563         * Version 4.5.6.
8564
8565         * src/du.c (process_file): Don't return early for excluded files
8566         or for files whose dev/inode we've already seen.
8567
8568 2003-02-05  Jim Meyering  <jim@meyering.net>
8569
8570         * tests/du/exclude: New file.
8571         * tests/du/Makefile.am (TESTS): Add exclude.
8572
8573 2003-02-04  Dmitry V. Levin  <ldv@altlinux.org>
8574
8575         * src/who.c (print_boottime, print_deadprocs, print_runlevel):
8576         Fix memory allocation arithmetic.
8577
8578 2003-02-04  Jim Meyering  <jim@meyering.net>
8579
8580         `df /dev/block-or-char-device-file--not-mounted' now reports
8581         the name of the file system on which the file resides, usually `/'.
8582         Before, it would leave the `Mounted on' field blank.
8583         * src/df.c (show_disk): Move function to precede find_mount_point.
8584         (show_disk): Add parameter: STATP.
8585         If we don't find a matching device name, then resort to calling
8586         find_mount_point.  Reported by Bob Proulx.
8587
8588 2003-02-03  Andreas Schwab  <schwab@suse.de>
8589
8590         * tests/rm/cycle: Require non-root.
8591         * tests/rm/isatty: Likewise.
8592
8593 2003-02-02  Jim Meyering  <jim@meyering.net>
8594
8595         * Version 4.5.5.
8596
8597         * man/Makefile.am (check-x-vs-1): Use @PATH_SEPARATOR@, not `:'.
8598
8599         Ensure that there are no offending uses of `:'.
8600         * Makefile.maint (makefile_path_separator_check): New rule.
8601         (local-check): Add it to the list.
8602
8603 2003-02-01  Jim Meyering  <jim@meyering.net>
8604
8605         * src/du.c (MAX_N_DESCRIPTORS): Define.
8606
8607         * src/stat.c (G_fail): New global.
8608         (human_time): Diagnose failed localtime, not failed nstrftime.
8609         (main): Fail if G_fail is set.
8610
8611 2003-01-31  Richard Dawe  <rich@phekda.freeserve.co.uk>
8612
8613         * tests/basename/Makefile.am: Use @PATH_SEPARATOR@ instead of
8614         hard-coding the path-separator.  Also double-quote the new PATH,
8615         to avoid problems when the path-separator is a semi-colon or when
8616         `pwd` contains e.g. a space.
8617         * tests/chgrp/Makefile.am: Likewise.
8618         * tests/chmod/Makefile.am: Likewise.
8619         * tests/chown/Makefile.am: Likewise.
8620         * tests/cp/Makefile.am: Likewise.
8621         * tests/dd/Makefile.am: Likewise.
8622         * tests/dircolors/Makefile.am: Likewise.
8623         * tests/du/Makefile.am: Likewise.
8624         * tests/expr/Makefile.am: Likewise.
8625         * tests/factor/Makefile.am: Likewise.
8626         * tests/fmt/Makefile.am: Likewise.
8627         * tests/install/Makefile.am: Likewise.
8628         * tests/ln/Makefile.am: Likewise.
8629         * tests/ls/Makefile.am: Likewise.
8630         * tests/ls-2/Makefile.am: Likewise.
8631         * tests/md5sum/Makefile.am: Likewise.
8632         * tests/misc/Makefile.am: Likewise.
8633         * tests/mkdir/Makefile.am: Likewise.
8634         * tests/mv/Makefile.am: Likewise.
8635         * tests/od/Makefile.am: Likewise.
8636         * tests/rm/Makefile.am: Likewise.
8637         * tests/rmdir/Makefile.am: Likewise.
8638         * tests/seq/Makefile.am: Likewise.
8639         * tests/sha1sum/Makefile.am: Likewise.
8640         * tests/shred/Makefile.am: Likewise.
8641         * tests/stty/Makefile.am: Likewise.
8642         * tests/sum/Makefile.am: Likewise.
8643         * tests/tail-2/Makefile.am: Likewise.
8644         * tests/touch/Makefile.am: Likewise.
8645         * tests/tsort/Makefile.am: Likewise.
8646         * tests/unexpand/Makefile.am: Likewise.
8647
8648 2003-01-31  Jim Meyering  <jim@meyering.net>
8649
8650         * src/stat.c: Include "file-type.h"
8651         (print_human_type): Remove function.
8652         (human_access): Rename from print_human_access.  Return a string.
8653         (human_time): Rename from print_human_time.  Return a string.
8654         (print_stat): Arrange so that field width and an alignment specifier
8655         are honored for the %A, %F, %x, %y, and %z formats.
8656         [%F]: Use file_type; this gives slightly different file type strings,
8657         e.g., `directory' instead of `Directory' and `regular file' or
8658         `regular empty file' instead of `Regular file'.
8659         Prompted by a report from Richard Dawe that the uses of
8660         S_IFSOCK and S_IFIFO in print_human_time were not portable
8661         to systems using e.g., DJGPP.
8662
8663 2003-01-31  Richard Dawe  <rich@phekda.freeserve.co.uk>
8664
8665         * src/stat.c (print_stat): Use S_ISLNK rather than an explicit
8666         test using S_IFMT and S_IFLNK.  S_IFLNK may not be defined.
8667
8668 2003-01-31  Jim Meyering  <jim@meyering.net>
8669
8670         * src/du.c (main): Upon processing an invalid option or an invalid
8671         --exclude-from or --max-depth option argument, don't exit right away,
8672         in case there are others.  Rather record the failure and exit after
8673         processing other options.
8674
8675         * GNUmakefile (TAR_OPTIONS): Set and export, in order to make
8676         tar archive easier to reproduce.
8677
8678         Rewrite to perform directory traversal using nftw.
8679
8680         * src/du.c: Include "dirname.h", "ftw.h", and "quotearg.h".
8681         (AUTHORS): Add self.
8682         (opt_one_file_system): Move global into `main'.
8683         (path, xstat, exit_status): Remove declarations.
8684         (arg_length, suffix_length): New globals.
8685         (G_fail): New global, sort of like the old `exit_status'.
8686         (IS_FTW_DIR_TYPE): Define.
8687         (print_only_size): New function.
8688         (process_file): New function.
8689         (str_init, ensure_space, str_copyc, str_concatc): Remove functions.
8690         (str_trunc, pop_dir, count_entry): Likewise.
8691         (du_files): Rewrite to use nftw.
8692
8693 2003-01-30  Jim Meyering  <jim@meyering.net>
8694
8695         * tests/du/trailing-slash: Ensure that du/ftw follows a command-line
8696         symlink-to-directory with -L, even without the trailing slash.
8697
8698 2003-01-27  Jim Meyering  <jim@meyering.net>
8699
8700         * src/Makefile.am (check-misc): Check for st_blocks, too.
8701
8702         * src/stat.c (print_stat): Use ST_NBLOCKS rather than `->st_blocks'.
8703         Reported by Richard Dawe.
8704
8705 2003-01-27  Andreas Schwab  <schwab@suse.de>
8706
8707         * src/ls.c (quote_name): Add fourth parameter, width, into which to
8708         store the screen columns, and return the number of bytes instead.
8709         (print_dir): Pass NULL as fourth parameter of quote_name.
8710         (print_name_with_quoting): Likewise.
8711         (length_of_file_name_and_frills): Get the width from the fourth
8712         parameter of quote_name instead of return value.
8713
8714 2003-01-27  Jim Meyering  <jim@meyering.net>
8715
8716         * src/ls.c (decode_switches): If `dired' is set without
8717         `format == long_format', then silently reset dired.  This doesn't
8718         change the behavior of ls (all prior uses of dired were protected
8719         by `&& format == long_format'), and lets us...
8720         (DIRED_INDENT): ... remove the `format == long_format' conjunct.
8721         (PUSH_CURRENT_DIRED_POS): Likewise.
8722         (main): Likewise.
8723
8724 2003-01-22  Jim Meyering  <jim@meyering.net>
8725
8726         * tests/du/no-x: New test, for functionality added to lib/ftw.c.
8727         * tests/du/Makefile.am (TESTS): Add no-x.
8728
8729 2003-01-21  Jim Meyering  <jim@meyering.net>
8730
8731         * src/remove.c (remove_entry) [ROOT_CAN_UNLINK_DIRS
8732         && HAVE_STRUCT_DIRENT_D_TYPE]: If a file has d_type == DT_UNKNOWN
8733         it may still be a directory -- or not (e.g., with FreeBSD on an
8734         NFS-mounted file system), so resort to calling lstat to find out.
8735         Based on a patch by Michael van Elst.
8736
8737         * tests/cp/same-file: Don't assume that the file owner username
8738         length is less than 9 in ls output: instead, omit that field
8739         altogether.  Reported by, and suggested fix from, Ferdinand.
8740
8741 2003-01-20  Jim Meyering  <jim@meyering.net>
8742
8743         * tests/date/Test.pm (wide-fmt): New test to demonstrate that
8744         large format widths no longer cause strftime to infloop.
8745
8746         * Makefile.maint (mail_gpg_sign_cookie): Remove now-unused definition.
8747
8748 2003-01-19  Jim Meyering  <jim@meyering.net>
8749
8750         * src/readlink.c: Include "canonicalize.h".
8751
8752 2003-01-18  Jim Meyering  <jim@meyering.net>
8753
8754         * src/ls.c (Dereference_symlink) [DEREF_COMMAND_LINE_SYMLINK_TO_DIR]:
8755         New member.
8756         (enum) [DEREFERENCE_COMMAND_LINE_SYMLINK_TO_DIR_OPTION]: New member.
8757         (long_options): Add option --dereference-command-line-symlink-to-dir.
8758         (main): Make DEREF_COMMAND_LINE_SYMLINK_TO_DIR be the default,
8759         rather than DEREF_COMMAND_LINE_ARGUMENTS, when none of the
8760         -d, -F, -l options is specified.
8761         (decode_switches): Handle --dereference-command-line-symlink-to-dir.
8762         (gobble_file): Honor DEREF_COMMAND_LINE_SYMLINK_TO_DIR.
8763         Change --dereference-command-line (-H) to dereference *all*
8764         command line arguments, including broken symlinks.
8765
8766 2003-01-15  Paul Eggert  <eggert@twinsun.com>
8767
8768         Change ls -H back to the way it was yesterday, since this is
8769         compatible with FreeBSD and the POSIX spec is confusing
8770         and somewhat contradictory.
8771
8772         * src/ls.c (DEREF_COMMAND_LINE_ARGUMENTS): Change name back
8773         from DEREF_COMMAND_LINE_SYMLINK_TO_DIR, updating all uses.
8774         (long_options): Change the long option name back.
8775         (usage): Change the usage back.
8776         (gobble_file): When -H is specified, dereference a top-level
8777         arg even if it points to a non-directory.
8778
8779 2003-01-15  Jim Meyering  <jim@meyering.net>
8780
8781         * src/ls.c (gobble_file): Fall back on using lstat when required:
8782         when --dereference (-L) is not specified, and
8783         - when operating on a dangling symlink
8784         - when operating on command-line-symlink-to-directories
8785         This fixes numerous problems.  Here are examples:
8786         - `ls dangling-symlink' would fail with `no such file...'
8787         Now it prints `dangling-symlink'.
8788         - `ls -i symlink' would mistakenly print the inode of the referent.
8789         Now it prints the inode of the symlink.  Likewise for --size (-s).
8790         Based on a patch from Michael Stone.
8791         Reported by Deepak Goel as Debian bug #173793.
8792
8793         Rename ls's --dereference-command-line (-H)
8794         option to   --dereference-command-line-symlink-to-dir.
8795         * src/ls.c [enum Dereference_symlink]
8796         (DEREF_COMMAND_LINE_SYMLINK_TO_DIR): Rename from
8797         DEREF_COMMAND_LINE_ARGUMENTS.  Update all uses.
8798         (long_options): Rename the long option.
8799         (usage): Say that --dereference-... changes how ls treats
8800         only symlinks to directories specified on the command line.
8801
8802 2003-01-14  Jim Meyering  <jim@meyering.net>
8803
8804         * tests/ls/dangle: New file/test, for the above fix.
8805         * tests/ls/inode: Another new file/test, for the above fix.
8806         * tests/ls/Makefile.am (TESTS): Add dangle and inode.
8807
8808         * src/ls.c (gobble_file): Fix a bug introduced in 4.5.4 that made it
8809         so that ls --color would no longer highlight the names of files with
8810         the execute bit set when not specified on the command line.
8811         Patch by Michael Stone.  Reported by Stephen Depooter as
8812         Debian bug 175135.
8813
8814         * tests/ls-2/tests (color-exe): New test, for the above fix.
8815
8816 2003-01-13  Jim Meyering  <jim@meyering.net>
8817
8818         * tests/shred/exact: Also test for just fixed bug with --zero.
8819
8820         * src/shred.c (long_opts): --zero does not require an argument.
8821         Patch by Michael Stone.  Reported by Roland Turner as Debian bug 172019.
8822
8823 2003-01-12  Jim Meyering  <jim@meyering.net>
8824
8825         * Makefile.maint (cvs-update): Skip any file with local modifications.
8826
8827         * src/unexpand.c (usage): Document --first-only and mention that
8828         --tabs=N (-t) enables --all (-a).  Reported by wiregauze@yahoo.com.
8829
8830 2002-12-01  Dmitry V. Levin  <ldv@altlinux.org>
8831
8832         * src/df.c: Include "canonicalize.h".
8833         Use canonicalize_file_name unconditionally.
8834
8835 2003-01-09  Jim Meyering  <jim@meyering.net>
8836
8837         * README: Add readlink.
8838
8839 2002-11-30  Dmitry V. Levin  <ldv@altlinux.org>
8840
8841         * src/df.c: Include "xgetcwd.h".
8842         * src/pwd.c: Likewise.
8843
8844 2002-11-30  Dmitry V. Levin  <ldv@altlinux.org>
8845
8846         * src/shred.c: Remove declaration of xstrdup.
8847         We already get it via xalloc.h which is included via system.h.
8848
8849 2002-08-27  Dmitry V. Levin  <ldv@altlinux.org>
8850
8851         New program: readlink.
8852
8853         * src/Makefile.am (bin_PROGRAMS): Add readlink.
8854         * src/readlink.c: New file.
8855
8856         * man/readlink.x: New file.
8857         * man/Makefile.am (dist_man_MANS): Add readlink.1.
8858         (readlink.1): New rule.
8859
8860 2003-01-09  Jim Meyering  <jim@meyering.net>
8861
8862         When selecting ranges of byte offsets (as opposed to ranges of fields)
8863         and when --output-delimiter=STRING is specified, output STRING between
8864         ranges of selected bytes.
8865         * src/cut.c (RANGE_START_SENTINEL): Define.
8866         (output_delimiter_specified): New global.
8867         (print_kth): Add parameter.  Adjust all callers.
8868         (set_fields): Mark each range-start index with RANGE_START_SENTINEL.
8869         (cut_bytes): When requested, output STRING between ranges of
8870         selected bytes.
8871         (main): Make a diagnostic a little clearer.
8872         Based on a patch from Jan Nieuwenhuizen.
8873
8874         * tests/cut/Test.pm: New tests for the above.
8875
8876         * src/cut.c (set_fields): Make code agree with comment:
8877         Don't merge abutting ranges like 4- and 2-3.  This makes no
8878         difference currently, but is required to support an upcoming change.
8879
8880 2003-01-07  Jim Meyering  <jim@meyering.net>
8881
8882         * src/cut.c (set_fields): Fix typo in comment.
8883
8884         * tests/touch/not-owner: New test, mostly extracted from fail-diag.
8885         * tests/touch/Makefile.am (TESTS): Add not-owner.
8886         * tests/touch/fail-diag: Remove the test for non-owner diagnostic.
8887         Now, this tests only the nonexistent-directory diagnostic.
8888         Suggestion from Michael Stone.
8889
8890         * tests/touch/fail-diag: Fix typo: s/ld/ls/.
8891
8892 2003-01-04  Jim Meyering  <jim@meyering.net>
8893
8894         * src/copy.h: Remove use of PARAMS.
8895         * src/remove.h: Likewise.
8896         * src/chown-core.h: Likewise.
8897
8898         rm could be tricked into mistakenly reporting a cycle.
8899         * src/remove.c: [cycle_check_state]: New global.
8900         (remove_cwd_entries): Adapt to new semantics of cycle_check.
8901         (rm): Call cycle_check_init and cycle_check_free for each file.
8902         * tests/rm/cycle (rm): New test, for the above fix.
8903         * tests/rm/Makefile.am (TESTS): Add cycle.
8904
8905         When rm detects a cycle, don't abort the entire command,
8906         but rather just the affected command line argument.
8907         * src/remove.c: Include <setjmp.h>
8908         (struct dirstack_state) [current_arg_jumpbuf]: New member.
8909         (remove_cwd_entries): Call longjmp if we detect a cycle.
8910         (rm): Call setjmp here.
8911
8912         * src/remove.c (cycle_check, is_power_of_two): Remove functions.
8913         Instead, include cycle-check.h and use it.
8914
8915         * src/remove.h (struct dev_ino): Remove declaration.
8916
8917         * src/remove.c (remove_cwd_entries): Fix typos in comment.
8918
8919         Don't include trailing /. in diagnostics about directories.
8920         * src/remove.c (full_filename_): When FILENAME is just `.'
8921         and there is a nonempty directory-name part, don't append `/.'.
8922         * tests/rm/unread2: Remove trailing /. from diagnostic.
8923         * tests/rm/rm2: Likewise.
8924
8925         * src/remove.c (struct dirstack_state): Define.
8926         To be used in place of these file-scoped globals ...
8927         (dir_stack, len_stack, Active_dir): Remove globals.
8928         (ds_init, ds_free): New functions.
8929         (full_filename): Define.
8930         (full_filename_): Rename from full_filename.
8931
8932         Begin to make AD_* functions more generic.
8933         * src/remove.c (AD_push_initial): Don't set status to RM_OK here.
8934         (AD_push): Likewise.
8935         (AD_INIT_OTHER_MEMBERS): Define.
8936         (remove_dir): Define the `status' member manually after each
8937         call to AD_push or AD_push_initial.
8938
8939         * src/Makefile.am (check-misc): New rule, to ensure that no more
8940         S_IS* macro definitions sneak into the code.
8941         (check): Depend on check-misc.
8942
8943         * src/remove.c [S_ISLNK]: Don't define.  It's already defined in sys2.h.
8944         * src/du.c (count_entry) [S_ISLNK]: Don't define.
8945         * src/shred.c [S_ISLNK, S_ISFIFO, S_ISSOCK]: Don't define.
8946
8947 2003-01-03  Jim Meyering  <jim@meyering.net>
8948
8949         * src/true.c: Add copyright.
8950         (AUTHORS): I suppose I've written it.
8951
8952         * src/Makefile.am (false.c): Make the generated file be read-only.
8953
8954 2003-01-04  Jim Meyering  <jim@meyering.net>
8955
8956         * src/ls.c: Include "dev-ino.h".
8957         [struct dev_ino]: Remove declaration.
8958
8959 2003-01-02  Jim Meyering  <jim@meyering.net>
8960
8961         * src/cp.c (do_copy): Tweak diagnostic to be consistent with the one
8962         from mv: s/missing file arguments/missing file argument/.
8963         With --target-directory=DIR, cp and mv work with a single file argument.
8964         Reported by Karl Berry.
8965
8966         * tests/rm/isatty: Enable this test.
8967
8968 2002-12-31  Jim Meyering  <jim@meyering.net>
8969
8970         * src/remove.c (AD_push_initial): Don't set status to RM_OK here.
8971         (AD_push): Likewise.
8972         (AD_INIT_OTHER_MEMBERS): Define.
8973         (remove_dir): Define the `status' member manually after each
8974         call to AD_push or AD_push_initial.
8975
8976         * src/ls.c [struct dev_ino]: Remove definition.
8977         Include "dev-ino.h" instead.
8978
8979 2002-12-28  Jim Meyering  <jim@meyering.net>
8980
8981         * tests/du/Makefile.am (TESTS): Add no-deref.
8982         * tests/du/no-deref: New script.
8983
8984 2002-12-23  Jim Meyering  <jim@meyering.net>
8985
8986         * src/remove.c (remove_cwd_entries): Fix typo in comment.
8987
8988 2002-12-21  Jim Meyering  <jim@meyering.net>
8989
8990         * announce-gen: Generate MML-formatted announcement.
8991         This makes it a *lot* harder to send stale MD5/SHA1 signatures.
8992
8993 2002-12-20  Jim Meyering  <jim@meyering.net>
8994
8995         * src/touch.c (touch): Change the wording of a diagnostic so
8996         that it makes sense both when the file exists and when it doesn't.
8997         Suggestion from Michael Stone.
8998
8999 2002-12-18  Jim Meyering  <jim@meyering.net>
9000
9001         * src/stty.c (valid_options): Declare to be static.
9002
9003 2002-12-15  Jim Meyering  <jim@meyering.net>
9004
9005         * Makefile.cfg: Remove rules related to generating m4/jm-glibc-io.m4.
9006
9007         * src/chmod.c, src/copy.c, src/copy.h, src/cp-hash.h, src/csplit.c:
9008         * src/date.c, src/expr.c, src/fmt.c, src/id.c, src/install.c:
9009         * src/ls.c, src/od.c, src/pathchk.c, src/pr.c, src/remove.c:
9010         * src/shred.c, src/sort.c, src/stat.c, src/stty.c, src/sum.c:
9011         * src/tee.c, src/test.c: Remove all uses of `PARAMS'.
9012
9013         * src/remove.c (PARAMS): Remove definition.
9014         * src/sys2.h: Likewise.
9015
9016         * src/ls.c, src/stat.c, src/date.c: Remove declaration of nstrftime.
9017         Include strftime.h instead.
9018
9019 2002-12-14  Jim Meyering  <jim@meyering.net>
9020
9021         * Makefile.cfg ($(url_dir_list)): Use .../coreutils, not .../fetish.
9022
9023         * src/system.h [! HAVE_DECL_MEMRCHR]: Declare memrchr.
9024         This is necessary at least for Irix6.5 when using c89.
9025         Reported by Nelson Beebe.
9026
9027         * tests/misc/Makefile.am (TESTS): Add cat-tty-eof.
9028
9029         * tests/misc/cat-tty-eof: New test.
9030
9031         * src/mknod.c (usage): Specify how major and minor mode numbers
9032         are interpreted.  Report forwarded by Kristin E Thomas.
9033         * src/mknod.c: Remove now-redundant usage-specifying comment.
9034
9035 2002-12-13  Jim Meyering  <jim@meyering.net>
9036
9037         * Version 4.5.4.
9038
9039         * tests/du/trailing-slash: Allow for a directory of size `0'.
9040         That happens at least on file systems of type tmpfs on linux-2.4.18.
9041
9042         * announce-gen: New script to begin replacing the commands
9043         associated with the rule here...
9044         * Makefile.maint (announcement): Invoke announce-gen.
9045         * Makefile.am (EXTRA_DIST): Add announce-gen.
9046
9047         * tests/cp/preserve-2: New file/test, for latest fix.
9048         * tests/cp/Makefile.am (TESTS): Add preserve-2.
9049
9050 2002-12-11  TAKAI Kousuke  <takai@vlsi.kuee.kyoto-u.ac.jp>
9051
9052         Fix a bug whereby cp would fail to parse an option like
9053         --preserve=mode,ownership.
9054         * src/cp.c (decode_preserve_arg): Advance `comma' to
9055         point the character following the comma.
9056
9057 2002-12-11  Jim Meyering  <jim@meyering.net>
9058
9059         * src/pathchk.c (NEED_PATHCONF_WRAPPER): Undefine before defining,
9060         in case it's already defined.
9061
9062 2002-12-09  Jim Meyering  <jim@meyering.net>
9063
9064         * tests/touch/fail-diag: Don't get a test failure if /no exists.
9065         Instead, evoke a framework failure if /no-$$ exists.
9066         Reported by Michael Stone.
9067
9068 2002-12-08  Jim Meyering  <jim@meyering.net>
9069
9070         * src/du.c (lstat) [! LSTAT_FOLLOWS_SLASHED_SYMLINK]:
9071         Define to rpl_lstat, so that even on systems like Solaris 5.8,
9072         du honors (per POSIX) the trailing slash on an argument referring
9073         to a symlink-to-directory.
9074
9075 2002-12-06  Jim Meyering  <jim@meyering.net>
9076
9077         * Use autoconf-2.57.  Regenerate dependent files.
9078         * Use automake-1.7.2.  Regenerate dependent files.
9079
9080         * src/ls.c (gobble_file): Also stat the file if it's a
9081         regular file and --indicator-style=classify (aka -F).
9082         Thanks to Ed Santiago for opening my eyes.
9083
9084         * tests/ls/file-type: New file.  Test for the above.
9085         A test to contrast ls -F and ls --indicator-style=file-type.
9086         * tests/ls/Makefile.am (TESTS): Add file-type.
9087
9088 2002-12-04  Jim Meyering  <jim@meyering.net>
9089
9090         * tests/ls/follow-slink: Make sure the symlink was created.
9091         Richard Dawe reported that `ln -s link link' succeeds, but creates
9092         no file on systems running some version of the DJGPP libc.
9093
9094 2002-12-03  Jim Meyering  <jim@meyering.net>
9095
9096         * src/Makefile.am (AUTOMAKE_OPTIONS): Remove definition (to ansi2knr)
9097         since this package no longer panders to K&R compilers.
9098
9099 2002-12-02  Jim Meyering  <jim@meyering.net>
9100
9101         * tests/du/slink: Skip this test if `.' is on a non-local file system.
9102
9103         * tests/Fetish.pm (_at_replace): Do the substitution only if there's
9104         something to replace.
9105
9106 2002-12-01  Jim Meyering  <jim@meyering.net>
9107
9108         * src/stat.c: Don't include <string.h> or <ctype.h>.
9109         That's already done via system.h.
9110         * src/dircolors.c: Don't include <ctype.h>.
9111
9112 2002-11-30  Jim Meyering  <jim@meyering.net>
9113
9114         * ls.c (gobble_file): Remove the block of code that caused
9115         `ls --color -F symlink-to-dir' to list the files in
9116         `symlink-to-dir/.'.  Now, it prints `symlink-to-dir@', (just
9117         like `ls -F symlink-to-dir') but with the addition of highlighting.
9118         Similarly, `ls --color -dF symlink-to-dir' would print
9119         `symlink-to-dir/';  now it prints `symlink-to-dir@'.
9120         Reported by Jeff Sheinberg as Debian bug #168203.
9121         * tests/ls-2/tests (sl-F-color, sl-dF-color): New tests for the above.
9122
9123         ls is now more efficient: with certain options, it no longer needs
9124         to stat each directory entry on systems with valid dirent.d_type.
9125         * src/ls.c (print_dir): Add DT_LNK and DT_REG.
9126         (main): Make --recursive set format_needs_type, not format_needs_stat.
9127         (gobble_file): Remove a FIXME comment, now that it's fixed.
9128
9129 2002-11-24  Jim Meyering  <jim@meyering.net>
9130
9131         * src/du.c (du_files): Don't strip any trailing slash.
9132         Rewrite so that `/' is no longer represented internally as
9133         the empty string.
9134         (count_entry): When appending a file name component,
9135         account for the fact that the current path may end in `/'.
9136         François Pinard reported that `du symlink-to-dir/' was not
9137         equivalent to `du symlink-to-dir/.'.  Now it is.
9138         * tests/du/trailing-slash: New file/test, for the above fix.
9139         * tests/du/Makefile.am (TESTS): Add trailing-slash.
9140
9141 2002-11-23  Jim Meyering  <jim@meyering.net>
9142
9143         * src/tac.c (output): Declare some local variables to be of type size_t,
9144         rather than `int' to avoid warnings from gcc.
9145
9146 2002-11-21  Paul Eggert  <eggert@twinsun.com>
9147
9148         * src/ls.c (decode_switches): Use case-sensitive matching to
9149         decode the QUOTING_STYLE environment variable.  This is more
9150         consistent with the documentation, and with --quoting-style.
9151
9152 2002-11-21  Martin Buck  <martin.buck@ascom.ch
9153
9154         * src/stty.c (struct speeds): Add support for all baud rates defined
9155         in linux-2.4.19.
9156
9157 2002-11-19  Jim Meyering  <jim@meyering.net>
9158
9159         * tests/sum/sysv: Export LC_ALL=C, to avoid failure when
9160         run in a UTF locale.  Report and suggested fix by Bruno Haible.
9161         * tests/fmt/basic: Likewise.
9162
9163 2002-11-17  Jim Meyering  <jim@meyering.net>
9164
9165         * configure.ac: Update via autoupdate.
9166         Add `AM_GNU_GETTEXT_VERSION(0.11.5)'.
9167
9168         * src/mv.c (movefile): Don't remove trailing slashes from SOURCE.
9169         Reported by Hans Ginzel.
9170
9171 2002-11-15  Jim Meyering  <jim@meyering.net>
9172
9173         * Makefile.cfg (gnu_rel_host): Define.
9174         (url_dir_list): Choose from (alpha|ftp).gnu.org depending
9175         on whether $(VERSION) looks like a major release number.
9176
9177         * Makefile.maint (mail_gpg_sign_cookie): Backslash-escape `#'.
9178         (release): Rename from `alpha'.
9179         (alpha): Depend on release.
9180
9181         * Makefile.maint (signatures): Define with ?=, so it's easy to override.
9182
9183 2002-11-14  Jim Meyering  <jim@meyering.net>
9184
9185         * Makefile.maint (mail_gpg_sign_cookie): Make optional.
9186         (announcement): Use the new variable.
9187
9188         * Makefile.maint: Sync with Bison, i.e.:
9189         (po-check): Scan .l and .y files instead of the
9190         .c and the .h files that they generate.  This fixes the bug
9191         reported by Tim Van Holder in:
9192         <http://mail.gnu.org/pipermail/bison-patches/2002-November/001352.html>
9193         Look for N_ as well as for _.  Try to avoid matching #define for
9194         N_ and _.
9195         From Paul Eggert.
9196
9197 2002-11-12  Jim Meyering  <jim@meyering.net>
9198
9199         * src/ls.c (HAVE_SYMLINKS): Remove unnecessary macro definition.
9200         Replace sole use with equivalent `#ifdef S_ISLNK'.
9201         Inconsistency reported by Dmitry V. Levin.
9202
9203 2002-11-11  Jim Meyering  <jim@meyering.net>
9204
9205         * src/stat.c (usage): Transform --help items output via s/ - /   /,
9206         so that help2man produces properly formatted man pages.
9207         Reported by Herbert Xu as Debian bug #168400.
9208
9209 2002-11-10  Jim Meyering  <jim@meyering.net>
9210
9211         * src/ls.c (sighandler): Handle SIGTSTP specially.
9212         Based on suggestions from Solar Designer and Dmitry V. Levin.
9213         Add comments.
9214
9215         * Makefile.cfg (cvs_files): Define.  From autoconf.
9216         (local_updates): Likewise.
9217
9218         * src/ls.c (restore_default_color_handler, sigtstp_handler):
9219         Remove functions.
9220         (sighandler): New function, based on the one in sort.c.
9221         (main): Use sigaction, if possible; otherwise signal.
9222         Handle these signals:
9223         SIGHUP, SIGINT, SIGPIPE, SIGQUIT, SIGTERM, SIGTSTP.
9224         Don't register our handler if the signal is already being ignored.
9225
9226         * src/dd.c (interrupt_handler): Use raise, rather than kill+getpid.
9227         * src/csplit.c (interrupt_handler): Likewise.
9228         * src/sort.c (sighandler): Likewise.
9229         (main): Declare `i' and `nsigs' to be unsigned, not int.
9230
9231 2002-11-09  Jim Meyering  <jim@meyering.net>
9232
9233         ls --color: restore terminal text color upon signal.
9234         * src/ls.c: Include "full-write.h" and <signal.h>.
9235         (restore_default_color, restore_default_color_handler): New functions.
9236         (sigtstp_handler, put_indicator_direct): New functions.
9237         (main) [print_with_color]: Register signal handlers.
9238         Patch mostly by Solar Designer and Stanislav Ievlev.
9239
9240         Update from autoconf.
9241         * Makefile.maint (AMTAR): Remove definition.
9242         (update, cvs-update, po-update, do-po-update): New rules.
9243         (wget-update): Update (thus renaming to cvs-update).
9244         (automake_repo): Use anoncvs@sources.redhat.com.
9245
9246 2002-11-06  Jim Meyering  <jim@meyering.net>
9247
9248         * tests/misc/Makefile.am (TESTS): Add printf-hex.
9249
9250         * tests/misc/printf: Be careful to test the code in this package,
9251         not the shell built-in function.
9252
9253         * src/printf.c (print_esc): A hexadecimal escape sequence has
9254         at most two hex. digits, not three.  Reported by Padraig Brady.
9255         (usage): Update description.
9256         * tests/misc/printf-hex: New file/test, for the above fix.
9257
9258 2002-10-07  Paul Eggert  <eggert@twinsun.com>
9259
9260         Add support for locale-specific size indications (e.g.,
9261         thousands-separators) and for explicit size suffixes on output.
9262
9263         * doc/coreutils.texi (Block size): Say that:
9264         This affects display format as well as block size.
9265         Fractional block counts are rounded up.
9266         ls file size blocksize defaults to 1.
9267         A block size spec preceded by ' generates thousands separators.
9268         A suffix without a preceding integer generates suffixes.
9269         (tail invocation): 32k -> 32 KiB.
9270         (What information is listed): ls -h is now equivalent to
9271         ls --block-size=human, and ls -H is now equivalent to
9272         ls --block-size=si.  Displayed file size is now always affected by
9273         --block-size.
9274
9275         * lib/inttostr.c, lib/inttostr.h, lib/imaxtostr.c, lib/offtostr.c,
9276         lib/umaxtostr.c: New files, taken from GNU tar.
9277
9278         * lib/Makefile.am (libfetish_a_SOURCES): Add imaxtostr.c, offtostr.c,
9279         umaxtostr.c.
9280         (EXTRA_DIST): Add inttostr.c.
9281
9282         * lib/human.c, lib/human.h: Rewrite to support locale-specific
9283         notations like thousands separators.
9284         Specify what includer of include.h must include beforehand.
9285         (human_group_digits, human_suppress_point_zero, human_autoscale,
9286         human_base_1024, human_SI, human_B): New enum values.
9287         (human_readable): Rename from human_readable_inexact; put the
9288         options before the sizes.  All uses changed.  The old human_readable
9289         function has been removed; use inttostr.h instead.
9290         (human_options): Renamed from human_block_size, with new signature
9291         that allows block sizes up to UINTMAX_MAX.  All callers changed.
9292
9293         * m4/prereq.m4 (jm_PREREQ_HUMAN): Check for locale.h, localeconv,
9294         AC_HEADER_STDBOOL.  No need to check for limits.h since it's in
9295         freestanding C89.  No need to check for stdlib.h or string.h since
9296         autoconf does this now.
9297
9298         * src/cksum.c (cksum): Use primitives from inttostr.h, not
9299         human.h, to print large numbers simply.
9300         * src/csplit.c (handle_line_error, parse_patterns): Likewise.
9301         * src/dd.c (print_stats, main): Likewise.
9302         * src/df.c (print_header): Likewise.
9303         * src/factor.c (print_factors): Likewise.
9304         * src/ls.c (print_long_format, print_file_name_and_frills): Likewise.
9305         * src/shred.c (dopass): Likewise.
9306         * src/sort.c (checkfp): Likewise.
9307         * src/sum.c (bsd_sum_file, sysv_sym_file): Likewise.
9308         * src/tail.c (xlseek): Likewise.
9309         * src/wc.c (write_counts, wc): Likewise.
9310
9311         * src/df.c (human_output_opts): New var.
9312         (output_block_size): Now uintmax_t, not int, to handle larger
9313         block sizes.  All uses changed.
9314         * src/du.c: Likewise.
9315         * src/ls.c: Likewise.
9316
9317         * src/df.c (print_header): In the header line, prefer SI to human
9318         representation if it's shorter; if neither is shorter, try to
9319         intuit what the user would prefer.
9320
9321         * src/expr.c (inttostr): Remove; use new imaxtostr library
9322         function instead.
9323
9324         * src/ls.c (file_output_block_size): New var, to distinguish
9325         file sizes from other sizes.
9326         (decode_switches): Set it.
9327
9328         * src/shred.c (OUTPUT_BLOCK_SIZE): remove.
9329         (dopass): When printing progress, use floor for what has been done
9330         so far (since we should be conservative there), and ceiling for
9331         what needs to be done (since that's what other programs use).
9332
9333 2002-10-19  Jim Meyering  <jim@meyering.net>
9334
9335         * src/pinky.c (print_heading): Align TTY and Name headings.
9336         Reported by Karl Eichwalder.
9337
9338 2002-10-18  Jim Meyering  <jim@meyering.net>
9339
9340         * src/split.c (cwrite): Change type of `bytes' parameter to size_t
9341         Remove now-useless cast.
9342         (stdread): Remove function.
9343         (bytes_split): Use size_t instead of int.
9344         Use safe_read, not stdread.
9345         (lines_split): Likewise.
9346         Use memchr rather than a `while' loop.
9347         (line_bytes_split): Use size_t instead of int.
9348         Use safe_read, not stdread.
9349         (main): Add some FIXME comments to remind me to remove casts.
9350
9351         * src/system.h (ST_BLKSIZE): Correct comment describing how to
9352         reproduce HPUX-11 cat failure.  From Petter Reinholdtsen.
9353
9354 2002-10-17  Jim Meyering  <jim@meyering.net>
9355
9356         Fix a problem that could make e.g., `cat' misbehave on systems which
9357         give invalid (unreasonably large) values for stat.st_blksize.
9358         * src/system.h (ST_BLKSIZE): Ensure that the result is in [1..4MB].
9359         Reported by Petter Reinholdtsen.
9360
9361 2002-10-14  Jim Meyering  <jim@meyering.net>
9362
9363         Specifying a printf conversion specifer as nl's separator string
9364         could cause nl to segfault.
9365         * src/nl.c (build_print_fmt): Don't include separator string
9366         in the printf format; it might contain `%'.
9367         Use a better bound on the length of the print_fmt buffer.
9368         (print_lineno): Print the separator here instead.
9369         Reported by Doug Coleman.
9370
9371         * tests/misc/nl: New file/tests, including a test for the above.
9372         * tests/misc/Makefile.am (TESTS): Add nl.
9373
9374         * tests/misc/split-l: New test, to make sure `split --lines=N' works.
9375         * tests/misc/Makefile.am (TESTS): Add split-l.
9376
9377 2002-10-13  Jim Meyering  <jim@meyering.net>
9378
9379         * Version 4.5.3.
9380
9381         * src/du.c (usage): Tweak description of --dereference-args/-D.
9382
9383         * src/du.c (count_entry): Also save cwd when dereferencing (via
9384         --dereference-args, -D) a command-line argument.
9385         Reported by Michal Svec.  Based on a patch by Andreas Schwab.
9386
9387         * src/Makefile.am (../AUTHORS): New target/rule.
9388
9389 2002-10-12  Jim Meyering  <jim@meyering.net>
9390
9391         * src/paste.c (paste_parallel): Declare local, `delims_saved', to be
9392         of type size_t, since that's the way it's used and avoids a warning.
9393
9394         * src/csplit.c (struct cstring) [len]: Declare to be unsigned int,
9395         since that's how it's always used and avoids a new warning from gcc.
9396         (read_input): Adapt to new safe_read ABI.
9397
9398         * src/cut.c (cut_fields): Add a temporary size_t variable, n_bytes,
9399         to avoid warnings.
9400
9401         * src/pinky.c (print_long_entry): fread returns size_t.
9402         Declare local `bytes' accordingly, to avoid warning.
9403
9404         tail -c +N would perform an extra read after encountering EOF
9405         [this change is analogous (bytes vs. lines) to the one of 2002-01-27]
9406         * src/tail.c (start_bytes): Detect EOF, inform caller.
9407         (tail_bytes): Upon EOF in start_bytes, return immediately.
9408         (file_lines): Reorganize to use memrchr rather than an explicit loop.
9409         Adapt to new safe_read ABI.
9410
9411 2002-10-11  Jim Meyering  <jim@meyering.net>
9412
9413         * tests/du/deref: New file/test, for the above fix.
9414         * tests/du/Makefile.am (TESTS): Add deref.
9415
9416 2002-10-10  Jim Meyering  <jim@meyering.net>
9417
9418         * tests/ln/Makefile.am (TESTS): Add target-1.
9419         * tests/ln/target-1: New file/test, for the fix on 2002-10-08.
9420
9421 2002-10-09  Jim Meyering  <jim@meyering.net>
9422
9423         * tests/cp/backup-is-src: Ensure that certain environment variables
9424         are not set (e.g., SIMPLE_BACKUP_SUFFIX).  Reported by Duncan Roe.
9425
9426         * tests/tail-2/big-4gb: Mark this as an expensive test; it would
9427         consume 4GB of disk space on systems without support for sparse files.
9428         Fix a logic error that'd make it `cat err' even though dd didn't fail.
9429
9430         * src/dircolors.hin (.jar): Fix typo: s/;3$/;31/.
9431         Patch by steven@magelico.net, forwarded by Michael Stone.
9432
9433         * tests/ls/dired: Ensure that ls produces English messages.
9434         Patch by Alexey Vyskubov, forwarded by Michael Stone.
9435
9436 2002-10-08  Dmitry V. Levin  <ldv@altlinux.org>
9437
9438         * src/ln.c (main): Fix target_directory parsing when n_files == 1.
9439
9440 2002-10-08  Jim Meyering  <jim@meyering.net>
9441
9442         * tests/tail-2/big-4gb: Use double quotes around diagnostic.
9443         Fix syntax in test: use =, not ==.
9444         Reported by Bob Proulx.
9445         Change all the rest like this: grep -lR "testing framework'" .\
9446         |xargs perl -pi -e 's/'\''(\$0: failure in testing framework)'\''/"$1"/'
9447
9448         * src/sum.c (sysv_sum_file): Adapt to new safe_read ABI.
9449         * src/tr.c (squeeze_filter, read_and_delete, read_and_xlate): Likewise.
9450         * src/tac.c (save_stdin, tac_stdin_to_mem): Likewise.
9451         * src/wc.c (wc): Likewise.
9452
9453 2002-10-07  Paul Eggert  <eggert@twinsun.com>
9454
9455         * src/cat.c (cat):
9456         Don't advance the write pointer past the end of the write buffer.
9457         * src/sort.c (begfield, limfield): Likewise.
9458
9459 2002-10-07  Jim Meyering  <jim@meyering.net>
9460
9461         * src/cat.c (simple_cat, cat): Adapt to new safe_read ABI.
9462         * src/head.c (head_bytes, head_lines): Likewise.
9463
9464 2002-10-06  Jim Meyering  <jim@meyering.net>
9465
9466         * src/dd.c (scanargs): Ensure that specified block sizes (specified
9467         via ibs=N, obs=N, and bs=N) are no larger than SSIZE_MAX.
9468         (skip, dd_copy): Adapt to new safe_read ABI.
9469
9470         * Makefile.maint (signatures): Define.
9471         (%.sig): New rule.
9472         (announcement): Depend on $(signatures).
9473
9474         * Makefile.maint (announcement): Output all URLs for detached
9475         signatures, not just the last one from the previous loop.
9476
9477 2002-10-05  Jim Meyering  <jim@meyering.net>
9478
9479         * Version 4.5.2.
9480
9481         * src/remove.c (remove_entry) [ROOT_CAN_UNLINK_DIRS]: With `rm -i DIR',
9482         don't recurse into directory, DIR.  Prompted by a report from
9483         Leonardo Milano.
9484
9485         * tests/rm/i-no-r: New file/test, for the above fix.
9486         * tests/rm/Makefile.am (TESTS): Add i-no-r.
9487
9488         * tests/tail-2/big-4gb: New file/test, for the fix of 2002-09-27.
9489         * tests/tail-2/Makefile.am (TESTS): Add big-4gb.
9490
9491 2002-10-03  Jim Meyering  <jim@meyering.net>
9492
9493         * src/rm.c (AUTHORS): Mark translatable string with `N_ (...)'.
9494         * src/df.c (AUTHORS): Likewise.
9495         * src/du.c (AUTHORS): Likewise.
9496         * src/tail.c (AUTHORS): Likewise.
9497         * src/touch.c (AUTHORS): Likewise.
9498
9499 2002-10-02  Jim Meyering  <jim@meyering.net>
9500
9501         * Makefile.am (SUBDIRS): Remove `old'.
9502         (EXTRA_DIST): List the files in old/.
9503         * configure.ac (AC_CONFIG_FILES): Remove old/* names.
9504         Suggestion from Akim Demaille.
9505
9506 2002-10-01  Jim Meyering  <jim@meyering.net>
9507
9508         * src/sys2.h (SSIZE_MAX): Define.
9509
9510 2002-09-30  Jim Meyering  <jim@meyering.net>
9511
9512         * src/csplit.c: Don't include stdlib.h here.  It's already included
9513         via system.h.
9514
9515 2002-09-29  Jim Meyering  <jim@meyering.net>
9516
9517         * src/tr.c (find_bracketed_repeat): Rearrange pointer/integer
9518         expression to avoid bogus warning from gcc.
9519
9520         * src/cat.c (simple_cat): Use a temporary to avoid bogus warnings.
9521         (cat): Declare insize and outsize to be of type size_t, not int.
9522         Rearrange pointer/integer expressions to avoid bogus warnings.
9523         (main): Declare insize and outsize to be of type size_t, not int.
9524
9525         * src/tail.c (parse_options): Give a sensible diagnostic for
9526         an invalid byte or line count.  Reported by Mikko Tuumanen.
9527
9528         * src/touch.c (main): Split a long line.
9529
9530         * tests/du/Makefile.am (TESTS): Add slink.
9531         * tests/du/slink: New test for system.h change of 2002-08-31.
9532
9533         In move mode, always first try to rename.  Before, upon failure to
9534         rename a directory, this code would never attempt to rename any
9535         other file in that directory, but would thenceforth always copy.
9536         On some systems (e.g., NetApp's OnTap-6.4), renaming a directory
9537         may fail with EXDEV, yet renaming files within that directory to
9538         a newly-created destination directory succeeds.
9539         * src/copy.c (copy_internal): Remove local, move_mode;
9540         use x->move_mode instead.  Based on a patch from Tom Haynes.
9541
9542 2002-09-28  Jim Meyering  <jim@meyering.net>
9543
9544         * src/split.c (FAIL_ONLY_ONE_WAY): New macro.
9545         Factor out some duplication.
9546         (main): Use it.
9547         [case 'a']: Use strtoul rather than strtol to avoid compiler warnings.
9548
9549         * src/sort.c (begfield, limfield): Rearrange comparisons to avoid
9550         compiler warnings.
9551         (fillbuf, keycompare): Cast literal `-1' to size_t in comparisons,
9552         to avoid compiler warnings.
9553
9554         * src/shred.c (dopass): Use a uintmax_t temporary to avoid bogus
9555         compiler warnings.
9556
9557         Fix things so `mkdir -p' can create very deep directories, e.g.,
9558         mkdir -p $(perl -e 'print "a/" x 40000') now works.
9559         * src/mkdir.c (main): For --parents (-p), call make_path with the
9560         entire directory name, so we don't ever require that file operations
9561         like stat or chmod be performed on the entire command line argument.
9562         * makepath.c (make_path): Restore umask *before* creating the final
9563         component.
9564
9565 2002-09-27  Andreas Schwab  <schwab@suse.de>
9566
9567         * src/tail.c (tail_bytes): Change type of bytes_remaining to off_t
9568         to avoid overflow.  Reported by Hans Lermen.
9569
9570 2002-09-26  Jim Meyering  <jim@meyering.net>
9571
9572         * src/install.c (get_ids): Use strtoul, not strtol.  Remove some casts.
9573
9574 2002-09-25  Jim Meyering  <jim@meyering.net>
9575
9576         * src/test.c (eaccess): Change type of local `euid' from int to uid_t
9577         and add a cast, to avoid a warning about `signed and unsigned type in
9578         conditional expression'.
9579
9580 2002-09-22  Jim Meyering  <jim@meyering.net>
9581
9582         * src/rmdir.c: Include "dirname.h", for declaration of
9583         strip_trailing_slashes.
9584
9585         * src/stat.c (PRIdMAX, PRIuMAX): Remove definitions.
9586         Now they're defined through system.h.
9587
9588         * src/cp-hash.c, src/dd.c, src/df.c, src/du.c, src/ls.c,
9589         * src/stat.c, src/wc.c: Remove all inclusions of inttypes.h,
9590         since it's already included from sys2.h via system.h.
9591
9592         * Use automake-1.6f.  Regenerate dependent files.
9593
9594         * src/Makefile.am (PERL): Remove duplicate definition.
9595
9596         fmt's -s, -t, -c options didn't work properly for long lines.
9597         Since get_line may end up calling put_paragraph (for long lines),
9598         be sure to set global, `other_indent', before it is used there.
9599
9600         * src/fmt.c (set_other_indent): New function, factored out of...
9601         (get_paragraph): ... here.  Call it.
9602         (get_line): Call set_other_indent before calling flush_paragraph,
9603         which calls fmt_paragraph, which in turn calls put_paragraph,
9604         which uses other_indent.
9605
9606         * tests/fmt/Makefile.am (TESTS): Add long-line.
9607         * tests/fmt/long-line: New file/test, for the above fix.
9608
9609 2002-09-21  Jim Meyering  <jim@meyering.net>
9610
9611         * src/od.c: No longer include deprecated <values.h>.
9612         It was required solely for now-removed reference to BITSPERBYTE.
9613         * src/install.c: Likewise.
9614         Suggestion from Bruno Haible.
9615
9616 2002-09-06  Andreas Schwab  <schwab@suse.de>
9617
9618         `rmdir -p dir-specified-with-trailing-slash/' would fail.
9619         * src/rmdir.c (remove_parents): Strip trailing slashes.
9620
9621 2002-09-20  Jim Meyering  <jim@meyering.net>
9622
9623         * tests/rmdir/t-slash: New file/test, for the above fix.
9624         * tests/rmdir/Makefile.am (TESTS): Add t-slash.
9625
9626         * Makefile.maint (announcement): Arrange to gpg-sign the message.
9627         Add a URL for each detached signature file.
9628
9629 2002-09-07  Bruno Haible  <bruno@clisp.org>
9630
9631         * configure.ac: Add need-ngettext to AM_GNU_GETTEXT invocation.
9632
9633 2002-09-18  Jim Meyering  <jim@meyering.net>
9634
9635         `od -t x8' used the wrong (`l'-prefixed) printf format.
9636         Likewise for the o8 and u8 formats.
9637         * src/od.c (ISPEC_TO_FORMAT): Define macro.
9638         (decode_one_format): Use PRIdMAX, PRIoMAX, etc. for LONG_LONG.
9639         Reported by Arun Sharma.
9640
9641 2002-09-17  Jim Meyering  <jim@meyering.net>
9642
9643         * src/sys2.h (PRIdMAX, PRIoMAX, PRIuMAX, PRIxMAX): Define if necessary.
9644         From gettext's intl/loadmsgcat.c.
9645
9646         * tests/od/x8: New file/test, for the above fix.
9647         * tests/od/Makefile.am (TESTS): Add x8.
9648
9649 2002-09-15  Jim Meyering  <jim@meyering.net>
9650
9651         * Use autoconf-2.54.  Regenerate dependent files.
9652
9653         * src/csplit.c (get_format_width): Add cast to avoid
9654         warning about `signed and unsigned type in conditional expression'.
9655
9656 2002-09-14  Jim Meyering  <jim@meyering.net>
9657
9658         * src/who.c (print_user): Change type of local to size_t
9659         to avoid warnings about `comparison between signed and unsigned'.
9660         * src/ptx.c (generate_all_output): Likewise.
9661
9662         * src/dd.c (main, skip): Add casts to avoid warnings about
9663         `comparison between signed and unsigned'.
9664
9665         * src/id.c (print_full_info, print_group_list): Add casts to avoid
9666         warnings about `signed and unsigned type in conditional expression'.
9667
9668         * src/md5sum.c: Change type of global, digest_hex_bytes, to size_t
9669         to avoid warnings about `comparison between signed and unsigned'.
9670         (split_3): Change parameter names to be readable and add comment.
9671         Clean up the test for whether a line may be ignored.
9672
9673 2002-09-13  Jim Meyering  <jim@meyering.net>
9674
9675         * src/printf.c (main): Handle leading command line argument of `--'.
9676         Reported by Raul: DervishD <raul@pleyades.net>
9677         * tests/misc/printf: New file: test for the above.
9678         * tests/misc/Makefile.am (TESTS): Add printf.
9679
9680         * src/date.c (usage): Explain that %S's range of [0..60] is required --
9681         rather than 0..59 -- to accommodate the occasional positive leap second.
9682         Reported by Richard Neill.
9683
9684 2002-09-12  Jim Meyering  <jim@meyering.net>
9685
9686         * src/Makefile.am (nanosec_libs): Define.
9687         (sleep_LDADD, tail_LDADD): Use it here.
9688
9689         Factor nanosleep-related code into ../lib/xnanosleep.c.
9690         * src/sleep.c: Include xnanosleep.h.
9691         Factor out fenv.h-related code.
9692         (timespec_subtract): Remove function.
9693         (main): Remove code that deals with computing start and stop times
9694         as well as the loop around nanosleep.  Now that's in xnanosleep.c.
9695
9696         Allow S (in --sleep-interval=S) to be a floating point value.
9697         * src/tail.c: Include xnanosleep.h and xstrtod.h.
9698         Move declaration of global variable, sleep_interval, to ...
9699         (main): ...here.
9700         (usage): Update description of --sleep-interval option.
9701         (tail_forever): New parameter, sleep_interval.  Update caller.
9702         Use xnanosleep, rather than sleep.
9703         (parse_options): New parameter, sleep_interval.  Update caller.
9704         Use xstrtod, now that we accept floating point values.
9705         Prompted by a patch from Augey Mikus.
9706
9707 2002-09-06  Jim Meyering  <jim@meyering.net>
9708
9709         * src/remove.c (prompt): Change comment to give a better note to
9710         translators.  From Michael Piefel.
9711
9712 2002-09-02  Jim Meyering  <jim@meyering.net>
9713
9714         * README: A good problem report/patch includes diffs against
9715         the most recent test release.
9716
9717         * src/pathchk.c (NEED_PATHCONF_WRAPPER): Define.
9718         (pathconf_wrapper): Define only if NEED_PATHCONF_WRAPPER is set.
9719
9720         * src/kill.c (print_table_row): Use an unsigned type for widths
9721         to avoid warning about comparison between signed and unsigned.
9722         (list_signals): Likewise.
9723
9724         * src/od.c (skip): Add a cast to avoid warning about comparison
9725         between signed and unsigned.
9726         * src/install.c (get_ids): Likewise.  Also rearrange range-checking
9727         comparisons to make them more readable.
9728
9729 2002-09-01  Jim Meyering  <jim@meyering.net>
9730
9731         * Version 4.5.1.
9732
9733 2002-08-31  Jim Meyering  <jim@meyering.net>
9734
9735         Symlinks were always reported as using 0 blocks.
9736         * src/system.h (ST_NBLOCKS): Don't depend on file type.
9737         This reverts the change of 2000-01-30.
9738         Based on a report and patch from Neil Brown via Michael Stone.
9739         This fixes Debian Bug#156358.
9740
9741         * Most files: Change `exit (0)' to `exit (EXIT_SUCCESS)',
9742         `exit (1)' to `exit (EXIT_FAILURE)', and
9743         `usage (1)' to `usage (EXIT_FAILURE)'.
9744
9745         * chgrp.c, chmod.c, chown.c, chroot.c, cp.c, date.c, dd.c, du.c,
9746         * hostname.c, id.c, install.c, ln.c, mkdir.c, mkfifo.c, mknod.c,
9747         * nice.c, pinky.c, printf.c, pwd.c, shred.c, sleep.c, stty.c,
9748         * su.c, tac-pipe.c, tail.c, tee.c, touch.c, uname.c, uptime.c,
9749         * users.c, who.c: Change `error (1, ...' to `error (EXIT_FAILURE, ...'.
9750         But don't change `error (0, ...' to `error (EXIT_SUCCESS, ...', since
9751         error never exits successfully.
9752
9753 2002-08-29  Jim Meyering  <jim@meyering.net>
9754
9755         * src/remove.c (remove_cwd_entries): Use closedir (not CLOSEDIR)
9756         when ignoring any return value.
9757
9758         * src/remove.c (remove_cwd_entries): Detect and diagnose readdir
9759         failures.  On some systems (at least EMC Celerra and Solaris5.8),
9760         this appears to be necessary.
9761         (is_empty_dir): Likewise.  Also, always close directory handle.
9762         * src/ls.c (print_dir): Likewise.
9763         (print_dir): Rename local variable: reading -> dirp.
9764         Reported by Mike Coleman.
9765
9766 2002-08-28  Jim Meyering  <jim@meyering.net>
9767
9768         * src/remove.c (remove_cwd_entries): Use CLOSEDIR, not closedir.
9769         Give a diagnostic and fail if closedir fails.
9770
9771 2002-08-26  Jim Meyering  <jim@meyering.net>
9772
9773         * Makefile.am (THANKS-to-translators): New rule.
9774         (EXTRA_DIST): Add both THANKS-to-translators and THANKStt.in.
9775         * THANKStt.in: New file.
9776
9777         * src/cat.c (close_stdout_wrapper): New, kludgey, function and
9778         file-scoped global.
9779         (main): Register it with atexit.
9780         Close STDOUT_FILENO, to avoid a problem when writing to
9781         /dev/audio on at least Solaris 5.7 and 5.8 systems.
9782         Reported by Shing-Shong Shei.
9783
9784 2002-08-25  Jim Meyering  <jim@meyering.net>
9785
9786         * src/cat.c (main): Close STDIN_FILENO rather than a literal `0'.
9787         * src/tac.c (main): Likewise.
9788         * src/tail.c (main): Likewise.
9789         * src/tee.c (main): Likewise.
9790         * src/tr.c (main): Likewise.
9791         * src/wc.c (main): Likewise.
9792
9793 2002-08-20  Jim Meyering  <jim@meyering.net>
9794
9795         * tests/mv/setup: Rewrite not to use `: ${VAR=not_set}' paradigm.
9796
9797 2002-08-10  Paul Eggert  <eggert@twinsun.com>
9798
9799         * src/nohup.sh: Don't use "exec --"; it's not portable and
9800         shouldn't be needed.
9801
9802 2002-08-09  Jim Meyering  <jim@meyering.net>
9803
9804         * src/pr.c (main): Don't ignore -COLUMN if it's the last option.
9805         (usage): Clarify help text for the -COLUMN option.
9806         Patch by Padraig Brady.
9807         * tests/pr/Test.pm [col-last]: New test for the above.
9808
9809         * configure.ac: Start with version 4.5.1, chosen so that it's larger
9810         than the latest version numbers of the component packages.
9811
9812         * man/Makefile.am (check-x-vs-1): Set and export PATH so we use
9813         programs in ../src.
9814
9815 2002-08-08  Jim Meyering  <jim@meyering.net>
9816
9817         * src/date.c: Guard inclusion of <langinfo.h> with
9818         `#if HAVE_LANGINFO_CODESET', not `#if HAVE_LANGINFO_H'.
9819         * src/sort.c: Likewise.
9820         Patch by GOTO Masanori.
9821
9822 2002-08-05  Paul Eggert  <eggert@twinsun.com>
9823
9824         Fix some minor time-related bugs with POSIX time arguments.
9825         Some valid time stamps were being rejected (notably -1, and
9826         time stamps before 1900 on 64-bit hosts).  And some invalid
9827         time stamps were being accepted, e.g. September 31.
9828
9829         * src/date.c (main): Adjust to posixtime signature change.
9830         * src/touch.c (main): Likewise.  Remove unnecessary initialization.
9831         Use localtime, not posixtm, to warn about obsolete "touch".
9832
9833 2002-08-05  Jim Meyering  <jim@meyering.net>
9834
9835         * tests/misc/Makefile.am (TESTS): Add nice and pathchk1.
9836
9837 2002-08-04  Jim Meyering  <jim@meyering.net>
9838
9839         * src/Makefile.am (check-README): New target/rule.
9840         (check): Depend on it.
9841
9842         * configure.ac (AC_CONFIG_FILES): Add old/Makefile and old/*/Makefile.
9843
9844 2002-08-03  Jim Meyering  <jim@meyering.net>
9845
9846         * Makefile.am (SUBDIRS): Add old.
9847         * old/: New directory, containing legacy ChangeLog* and NEWS files
9848         from the fileutils, sh-utils, and textutils packages.
9849
9850         * src/Makefile.am (AM_INSTALLCHECK_STD_OPTIONS_EXEMPT): Set to false.
9851
9852 2002-08-02  Paul Eggert  <eggert@twinsun.com>
9853
9854         * NEWS, doc/coreutils.texi: uniq now obeys LC_COLLATE.
9855
9856         * src/uniq.c: Include hard-locale.h, xmemcoll.h.
9857         (hard_LC_COLLATE): New var.
9858         (different): Args are now char *, not const char *.
9859         Use xmemcoll instead of memcmp to compare lines, so that
9860         LC_COLLATE has effect.  However, use memcmp if it is an
9861         easy locale.
9862         (check_file): Do not include newline in comparison, so that
9863         xmemcoll has a byte to stomp on temporarily.
9864         (main): Set hard_LC_COLLATE.
9865
9866 2002-07-29  Jim Meyering  <jim@meyering.net>
9867
9868         * Makefile.am (SUBDIRS): Remove djgpp, for now.
9869
9870 2002-07-20  Jim Meyering  <jim@meyering.net>
9871
9872         * Makefile.am (false.c): Convert only the final EXIT_SUCCESS
9873         into EXIT_FAILURE.  Otherwise, false --help and false --version
9874         would fail.
9875
9876 2002-07-08  Jim Meyering  <jim@meyering.net>
9877
9878         * src/Makefile.am (uninstall-local): Search for @GNU_PACKAGE@,
9879         rather than the hard-coded `sh-utils'.
9880
9881 2002-07-01  Jim Meyering  <jim@meyering.net>
9882
9883         * configure.ac: Merge the three files from fileutils,
9884         textutils, and sh-utils.
9885         * Makefile.am: Likewise.
9886         * src/Makefile.am: Likewise.