Change openat.c to openat-die.c.
[platform/upstream/coreutils.git] / ChangeLog
1 2005-06-14  Jim Meyering  <jim@meyering.net>
2
3         * Version 5.3.1.
4
5         * Makefile.maint (my-distcheck): Add -Wall to the list of options that
6         are used with -Werror.  This target is not intended for general use.
7
8 2005-06-13  Jim Meyering  <jim@meyering.net>
9
10         * src/mkdir.c (main): Give a diagnostic for -- and skip -- each
11         relative directory name after make_dir_parents fails to restore
12         the working directory.  Before, `mkdir -p' could create directories
13         in the wrong place in unusual circumstances.
14         * src/install.c (main): Likewise.
15         (install_file_in_file_parents): Update make_dir_parents caller.
16         * tests/mkdir/p-3: New test for today's mkdir.c/mkdir-p.c bug fixes.
17         * tests/mkdir/Makefile.am (TESTS): Add p-3.
18
19 2005-06-10  Paul Eggert  <eggert@cs.ucla.edu>
20
21         Act on the Austin Group's response yesterday to XCU ERN 63; see
22         <http://www.opengroup.org/austin/docs/austin_260.txt>.
23         * NEWS: ls no longer outputs an extra space between mode and link count.
24         * doc/coreutils.texi: Remove the extra spaces in "ls -l" output.
25         * src/ls.c (any_has_acl): New var.
26         (clear_files): Clear it.
27         (gobble_file): Set it if a file has an ACL.
28         (print_long_format): Omit needless space unless some file has an ACL.
29
30 2005-06-10  Jim Meyering  <jim@meyering.net>
31
32         * src/system.h (VERIFY_W_TYPEOF): Add parentheses.
33
34 2005-06-02  Jim Meyering  <jim@meyering.net>
35
36         * src/sort.c (usage): Put `Ordering options:' line where it belongs.
37
38 2005-06-01  Paul Eggert  <eggert@cs.ucla.edu>
39
40         Use "file name" when talking about file names, instead of "filename"
41         or "path", as per the GNU coding standards.
42         * src/basename.c: Don't use "path" or "filename".
43         * src/copy.c: Likewise.
44         * src/copy.h: Likewise.
45         * src/cp-hash.c: Likewise.
46         * src/cp.c: Likewise.
47         * src/df.c: Likewise.
48         * src/install.c: Likewise.
49         * src/ls.c: Likewise.
50         * src/pinky.c: Likewise.
51         * src/pr.c: Likewise.
52         * src/pwd.c: Likewise.
53         * src/remove.c: Likewise.
54         * src/rmdir.c: Likewise.
55         * src/sort.c: Likewise.
56         * src/system.h: Likewise.
57         * src/tty.c: Likewise.
58         * src/who.c: Likewise.
59         * src/cp.c (parents_option): Renamed from flag_path.  All uses changed.
60         (make_dir_parents_private): Renamed from make_path_private.
61         All uses changed.
62         * src/cp.c (usage): Don't use "path" to describe a file name.
63         * src/readlink.c (usage): Likewise.
64         * src/rmdir.c (usage): Likewise.
65         * src/df.c: Don't include "path-concat.h"; not needed.
66         * src/install.c (install_file_in_file_parents): Renamed from
67         install_file_to_path.  All uses changed.
68         * src/ln.c (FILE_BASENAME_CONCAT): Renamed from PATH_BASENAME_CONCAT.
69         All uses changed.
70         * src/ls.c (make_link_name): Renamed from make_link_path.
71         All uses changed.
72         * src/pwd.c (struct file_name): Renamed from struct Path.
73         All uses changed.
74         (file_name_free): Renamed from path_free.  All uses changed.
75         (file_name_init): Renamed from path_init.  All uses changed.
76         (file_name_prepend): Renamed from path_prepend.  All uses changed.
77         * src/rmdir.c (remove_empty_parents): Renamed from empty_paths.
78         All uses changed.
79         (longopts): Add comment that --path is deprecated.
80
81 2005-05-31  Jim Meyering  <jim@meyering.net>
82
83         * src/copy.c (chown_privileges, chown_failure_ok): Mark as `extern'.
84         This is a crutch so that `make distcheck's sc_tight_scope rule
85         knows that they really are deliberately declared that way.
86
87 2005-05-30  Paul Eggert  <eggert@cs.ucla.edu>
88
89         Port to Solaris 10's rules for whether programs can chown files.
90         * src/copy.c [HAVE_PRIV_H]: Include <priv.h>.
91         (DO_CHOWN): Remove.  Replaced by chown_failure_ok.  All callers
92         changed.
93         (copy_internal): If chown failed, don't worry about what happened
94         to the mode bits; they can't have changed.
95         (chown_privileges, chown_failure_ok): New functions.
96         * src/copy.h: Add copyright notice.
97         (struct cp_options): Remove myeuid member.  Add chown_privileges
98         member.
99         (chown_privileges, chown_failure_ok): New function decls.
100         * src/cp.c (re_protect): Remove unnecessary call to geteuid.
101         Use chown_failure_ok rather than our own code.
102         * src/cp.c (cp_options_init): Use chown_privileges rather than geteuid.
103         * src/install.c (cp_option_init): Likewise.
104         * src/mv.c (cp_option_init): Likewise.
105
106 2005-05-29  Paul Eggert  <eggert@cs.ucla.edu>
107
108         * src/chgrp.c (getgrnam) [!defined _POSIX_VERSION]: Remove decl.
109         * src/chown-core.c (getgrnam, getgrgid) [!defined _POSIX_VERSION]:
110         Remove decls.
111         * src/cp.c (geteuid) [!defined _POSIX_VERSION]: Remove decl.
112         * src/id.c (getpwuid, getgrgid, getuid, getgid, geteuid, getegid)
113         [!defined _POSIX_VERSION]: Remove decls.
114         * src/install.c (getpwnam, getgrnam): Remove decl.
115         (getuid, getgid) [!defined _POSIX_VERSION]: Remove decls.
116         * src/md5sum.c (OPENOPTS, TEXT1T01, TEXTCNVT): Remove.
117         (digest_file): Use O_BINARY-using expr instead of OPENOPTS.
118         * src/system.h: Don't bother mentioning _POSIX_VERSION in comment.
119         * src/test.c: Include sys/param.h if it exists, not if _POSIX_VERSION
120         isn't defined.
121         Don't include <sys/file.h>; no longer needed.
122         (getegid, geteuid): Remove no-longer-necessary decls.
123
124         * src/pathchk.c (_POSIX_PATH_MAX) [!defined _POSIX_PATH_MAX]:
125         Define to 256, not 255, as per modern POSIX.
126
127 2005-05-27  Paul Eggert  <eggert@cs.ucla.edu>
128
129         * NEWS: dd seek=N now conforms to POSIX if the output isn't seekable.
130         * src/dd.c (skip): Return the number of records that were not
131         skipped due to encountering EOF.
132         (dd_copy): If the file wasn't seekable and EOF was encountered,
133         write zeros past EOF until the desired offset is reached.
134
135         * NEWS: expr and test now correctly compare integers of unlimited size.
136         (Also, correct a comment that claimed that expr detects integer
137         overflow; it does so only when converting from strings.)
138         * src/expr.c: Include strnumcmp.h, xstrtol.h.
139         (looks_like_integer): New function.
140         (toarith): Use it.  Also, use xstrtoimax rather than rolling our
141         own diagnostics.
142         (eval2): Don't look for trouble if !evaluate; this simplifies things.
143         Compare numbers using string comparison, so that overflow is
144         not possible.
145         * src/sort.c: Refactor so that others can use large-integer
146         comparison functions.
147         Include "strnumcmp.h".
148         (NEGATION_SIGN, NUMERIC_ZERO, fraccompare):
149         Remove; moved to strnumcmp.
150         (decimal_point): Now int, to simplify converison overhead with
151         new API.  All uses changed.
152         (thousands_sep): Now -1 if there isn't one, as per new API.
153         All uses changed.
154         (numcompare): Move contents to strnumcmp module, except for
155         skipping blanks.
156         * src/test.c: Include inttostr.h, strnumcmp.h.
157         (whitespace, digit, digit_value, integer_expected_error): Remove.
158         (is_int): Remove; replaced by...
159         (find_int): New function.
160         (binary_operator): Don't let integers overflow in comparisons;
161         return the correct answer instead.  Simplify the code.
162         (unary_operator): Convert the integer ourself, since find_int
163         no longer does so.
164         * tests/expr/basic (bigcmp): New test.
165         * tests/test/Test.pm (eq-6, gt-5, lt-5): New tests.
166
167 2005-05-26  Paul Eggert  <eggert@cs.ucla.edu>
168
169         * NEWS: nohup now redirects a tty stdin to an unreadable fd
170         instead of closing it.
171         * doc/coreutils.texi (nohup invocation): Document this.
172         * src/nohup.c (main): Implement this.
173
174 2005-05-26  Jim Meyering  <jim@meyering.net>
175
176         * src/expr.c (toarith): Fix a sign error introduced on 2005-01-14.
177         Reported by David Alan Gilbert.
178         * tests/expr/basic: Add tests using arithmetic on negative integers.
179
180 2005-05-19  Jim Meyering  <jim@meyering.net>
181
182         * src/remove.c (AD_mark_helper, AD_mark_current_as_unremovable):
183         Remove inaccurate-but-harmless `const' attributes.
184
185         * src/join.c (decode_field_spec): Add an abort after
186         `error (EXIT_FAILURE, ...' to avoid a gcc warning in caller,
187         about variables being used uninitialized.
188
189 2005-05-18  Paul Eggert  <eggert@cs.ucla.edu>
190
191         * configure.ac: Add copyright notice.  gl_LIB_CHECK -> cu_LIB_CHECK.
192         * src/Makefile.am: Add copyright notice.
193         (factor_LDADD): Remove, as factor no longer needs sqrt.
194         * src/hostname.c: Remove test for HAVE_LIMITS_H; we can assume
195         it's always true now.
196
197 2005-05-16  Paul Eggert  <eggert@cs.ucla.edu>
198
199         Fix Cygwin porting problem reported by Eric Blake.
200         * src/remove.c (DT_IS_DIR): Remove.
201         (DT_IS_KNOWN, DT_MUST_BE): New macros.
202         (remove_entry): Use them.
203
204 2005-05-14  Paul Eggert  <eggert@cs.ucla.edu>
205
206         * src/remove.c: Include unlinkdir.h.
207         (UNLINK_CAN_UNLINK_DIRS): Remove.
208         (remove_entry): Use cannot_unlink_dirs () rather than
209         UNLINK_CAN_UNLINK_DIRS.
210
211 2005-05-14  Jim Meyering  <jim@meyering.net>
212
213         Update FSF postal mail address.
214         * Makefile.maint, Makefile.cfg, gnupload
215         * src/basename.c, src/cat.c, src/checksum.h, src/chgrp.c
216         * src/chmod.c, src/chown-core.c, src/chown-core.h, src/chown.c
217         * src/chroot.c, src/cksum.c, src/comm.c, src/copy.c, src/copy.h
218         * src/cp-hash.c, src/cp-hash.h, src/cp.c, src/csplit.c, src/cut.c
219         * src/date.c, src/dcgen, src/dd.c, src/df.c, src/dircolors.c
220         * src/dirname.c, src/du.c, src/echo.c, src/env.c, src/expand.c
221         * src/expr.c, src/factor.c, src/fmt.c, src/fold.c, src/fs.h
222         * src/groups.sh, src/head.c, src/hostid.c, src/hostname.c, src/id.c
223         * src/install.c, src/join.c, src/kill.c, src/lbracket.c, src/link.c
224         * src/ln.c, src/logname.c, src/ls-dir.c, src/ls-ls.c, src/ls-vdir.c
225         * src/ls.c, src/ls.h, src/md5.c, src/md5sum.c, src/mkdir.c
226         * src/mkfifo.c, src/mknod.c, src/mv.c, src/nice.c, src/nl.c
227         * src/nohup.c, src/od.c, src/paste.c, src/pathchk.c, src/pinky.c
228         * src/pr.c, src/printenv.c, src/printf.c, src/ptx.c, src/pwd.c
229         * src/readlink.c, src/remove.c, src/remove.h, src/rm.c, src/rmdir.c
230         * src/seq.c, src/setuidgid.c, src/sha1sum.c, src/shred.c
231         * src/sleep.c, src/sort.c, src/split.c, src/stat.c, src/stty.c
232         * src/su.c, src/sum.c, src/sync.c, src/system.h, src/tac-pipe.c
233         * src/tac.c, src/tail.c, src/tee.c, src/test.c, src/touch.c
234         * src/tr.c, src/true.c, src/tsort.c, src/tty.c, src/uname.c
235         * src/unexpand.c, src/uniq.c, src/unlink.c, src/uptime.c
236         * src/users.c, src/wc.c, src/who.c, src/whoami.c, src/yes.c
237
238 2005-05-13  Jim Meyering  <jim@meyering.net>
239
240         * NEWS: `rm -r' now removes all of the files it should, even on
241         systems with a buggy readdir affecting file systems inaccessible
242         at configure time.
243
244         In some unusual circumstances `rm -r' would fail to remove --
245         or even consider -- all entries in a directory with more than 254
246         (SunOS) or 338 (Darwin) entries.  This could cause trouble even on
247         other types of systems when using an affected file system via e.g.,
248         NFS.  The underlying cause was a bug in readdir on those systems.
249         Coreutils-5.2.1 and earlier used a configure-time test designed
250         to detect precisely those problem systems, but it would detect
251         the problem and enable remove.c's work-around code only when its
252         configure-time test was run on a losing file system.  Obviously,
253         it couldn't detect a problem if the offending file system wasn't
254         tested or even mounted at coreutils configure time.  Now, rm itself
255         performs a minimal-cost run-time test to detect the problem.
256
257         * src/remove.c (CONSECUTIVE_READDIR_UNLINK_THRESHOLD): Define.
258         (remove_cwd_entries):  When readdir returns NULL for a directory from
259         which we've removed more than CONSECUTIVE_READDIR_UNLINK_THRESHOLD
260         entries, call rewinddir and then resume the readdir/unlink loop.
261         (UNLINK_CAN_UNLINK_DIRS): Rename from ROOT_CAN_UNLINK_DIRS.
262
263 2005-05-12  Paul Eggert  <eggert@cs.ucla.edu>
264
265         * NEWS: nohup now closes stdin if it is a terminal, unless
266         POSIXLY_CORRECT is set.  This fixes a glitch noted by Wayne Pollock in
267         <https://www.opengroup.org/sophocles/show_mail.tpl?
268         source=L&listname=austin-group-l&id=8341>.
269         * doc/coreutils.texi (nohup invocation): Document this.
270         * src/nohup.c (main): Implement this.
271
272 2005-05-12  Jim Meyering  <jim@meyering.net>
273
274         * src/date.c: Assume `free (NULL)' works.
275         * src/dd.c: Likewise.
276         * src/df.c:Likewise.
277         * src/dircolors.c:Likewise.
278         * src/head.c: Likewise.
279         * src/ls.c: Likewise.
280         * src/md5sum.c: Likewise.
281         * src/pr.c: Likewise.
282         * src/sort.c: Likewise.
283
284 2005-05-10  Jim Meyering  <jim@meyering.net>
285
286         * tests/touch/not-owner: Skip this test if the user running it
287         owns `/' or has write access to it.
288
289         * src/copy.c (abandon_move): Remove erroneous UNWRITABLE check.
290         This makes `mv -i --reply=no f1 f2' work as expected (in not
291         performing the move operation).  But note that specifying `-i'
292         after `--reply=no' does *not* work.
293         Tiny patch from Vlada Macek.
294         Correct a comment.
295         * tests/mv/reply-no: New file.  Test for the above fix.
296         * tests/mv/Makefile.am (TESTS): Add reply-no.
297
298         * tests/ls-2/tests: Don't print PATH to stderr.
299
300 2005-05-08  Paul Eggert  <eggert@cs.ucla.edu>
301
302         * NEWS: cp, ln, mv, rm no longer discard white space when intepreting
303         responses.
304
305 2005-05-06  Paul Eggert  <eggert@cs.ucla.edu>
306
307         * NEWS: dd has new iflag= and oflag= flags "binary" and "text".
308         * src/dd.c (flags, usage): Add support for "binary" and "text".
309
310 2005-05-04  Paul Eggert  <eggert@cs.ucla.edu>
311
312         * NEWS: chmod -w now complains if it differs from chmod a-w.
313         * src/chmod.c: Include quotearg.h.
314         (diagnose_surprises): New var.
315         (process_file): Diagnose surprises.  Simplify the logic a bit,
316         while we're at it.
317         (main): Prepare to diagnose surprises.  Remove useless code for
318         '-' option.
319         * tests/chmod/Makefile.am (TESTS): Add umask-x.
320         * tests/chmod/umask-x: New file.
321
322 2005-05-02  Paul Eggert  <eggert@cs.ucla.edu>
323
324         * NEWS: ls --indicator-style=directory renamed to ls
325         --indicator-style=slash, to avoid confusion with ls --directory.
326         * src/ls.c (usage): Likewise.
327         (slash): Renamed from directory_only.  All uses changed.
328
329 2005-05-01  Paul Eggert  <eggert@cs.ucla.edu>
330
331         * NEWS: "chmod +1 foo" is now diagnosed.
332
333 2005-04-29  Paul Eggert  <eggert@cs.ucla.edu>
334
335         * NEWS: ls -p now marks only directories.  New option
336         --indicator-style=directory equivalent to -p.
337         * doc/coreutils.texi (ls invocation): Document this.
338         Also, mention ">" is for doors.
339         * src/ls.c (enum indicator_style): New constant directory_only,
340         for -p.
341         (indicator_style_args, indicator_style_types): Set it appropriately.
342         (decode_switches, gobble_file, print_type_indicator):
343         (length_of_file_name_and_frills):
344         Implement the change described in NEWS.
345         (decode_switches): Quote ">", too.
346         (usage): Update to match the new behavior.  Describe ">".
347         * tests/ls/file-type: Test for new behavior.  Omit -1 option.
348         The "ls --color" test wasn't being checked; add a check for
349         "ls --color=auto" instead.
350
351         * tests/head/Test.pm: Don't set _POSIX2_VERSION; no longer needed.
352         * tests/misc/split-fail: Likewise.
353         * tests/pr/Test.pm: Likewise.
354         * tests/sort/Test.pm: Fix comment to match new behavior of "sort".
355         * tests/tail/Test.pm (tv): Rename tests from obs to obs-plus
356         if they use file names starting with +.
357         (test_vector): Don't set _POSIX2_VERSION if obs but not obs-plus.
358         * tests/uniq/Test.pm (tv, test_vector): Likewise.
359
360         The following was partly derived from a tiny change by Eric Blake:
361         * tests/misc/nice: Don't use 'set -'.  It's not portable to strict
362         POSIX 1003.1-2001 hosts.  Also, don't set _POSIX2_VERSION.
363         * tests/mkdir/perm: Don't use 'set -'.  Simplify test construction.
364         Work even if the underyling system attaches ACLs to new dirs.
365         * tests/mv/part-hardlink: Don't use 'set -'.
366         * tests/stty/row-col-1: Don't use 'set -'.
367
368 2005-04-28  Paul Eggert  <eggert@cs.ucla.edu>
369
370         * NEWS: Document fixes described below.
371         * src/chmod.c (change, umask_value): New static vars.
372         (reference_file): Move this static var to inside "main".
373         (process_file, process_files): Remove CHANGES arg; now taken from
374         static var.  All uses changed.
375         (usage): Fix incorrect description of MODE operand.
376         (main): For invalid mode usages, output a brief usage message.
377         Adjust to new modechange API.
378         * install.c (main): Adjust to new modechange API.
379         Also, free the mode_change object when done.
380         * mkdir.c (main): Likewise.
381         * mkfifo.c (main): Likewise.
382         * mknod.c (main): Likewise.
383         * tests/chmod/equal-X: Check for =xX bug.
384         * tests/chmod/equals: Check for =u bug.
385         * tests/chmod/usage: Check for u+gr and ug,+x bugs.
386
387 2005-04-26  Paul Eggert  <eggert@cs.ucla.edu>
388
389         Restore support for usages like "head -1" and "tail -1",
390         even when conforming to POSIX 1003.1-2001.
391         Fix bug with "POSIXLY_CORRECT=1 fold file -3".
392         join now supports a NUL field separator, e.g., "join -t '\0'".
393         join now detects and reports incompatible options, e.g.,
394         "join -t x -t y",
395         * NEWS: Document this.
396         * src/date.c: Remove posixver.h and its uses.
397         (COMMON_SHORT_OPTIONS): Remove.
398         (short_options): New constant.
399         (short_options, usage): -I now always takes an optional arg.
400         * src/expand.c: Remove posixver.h and its uses.
401         (shortopts): New constant.  -DIGIT now always takes an optional arg.
402         (main): Revamp parsing of -DIGIT to let parse_tab_stops handle it.
403         Don't complain about -DIGIT.
404         * src/fold.c: Remove posixver.h and its uses.
405         (shortopts): New constant.  -DIGIT now always takes an optional arg.
406         (main): Don't preprocess arg list; that was buggy.  Use method
407         similar to expand.
408         * src/head.c: Remove posixver.h and its uses.
409         (header_mode_option): Remove.
410         (main): Don't complain about obsolete -NUM args.
411         * src/join.c: Remove posixver.h and its uses.
412         (obsolete_usage): Remove.
413         (join_field_1, join_field_2): Initialize to SIZE_MAX to indicate
414         they haven't been set yet.
415         (tab): Now int, not char.  Initialize to -1 to indicate white space
416         separates columns, so that we can use NUL as a separator.
417         All uses changed.
418         (OBSOLETE_LONG_OPTIONS, get_option): Remove.
419         (string_to_join_field): Remove ERR_MSG_FMT arg; a single format
420         suffices.  Use xstrtoul for sizes; it suffices.
421         (decode_field_spec): Report an error and exit on failure.  Return void,
422         not bool.
423         (add_field_list): Likewise.
424         (set_join_field): New function.
425         (enum operand_status): New enum.
426         (add_file_name): New args OPERAND_STATUS, JOPTION_COUNT,
427         PREV_OPTC_STATUS, OPTC_STATUS to handle the bewildering array of
428         possibilities with obsolete option parsing.
429         (main): Use it.  Do not depend on POSIX version.
430         Check for conflicting options.  Parse obsolete options -j1 and -j2
431         so that it is a pure extension to POSIX 1003.1-2001.
432         Allow '-t\0' to specify a NUL tab, stealing the code from 'sort'.
433         * src/nice.c: Remove posixver.h and its uses.
434         (main): Always support -NUM option.
435         * src/od.c: Remove posixver.h and its uses.
436         (short_options): New constant, which always supports -w[num].
437         (COMMON_SHORT_OPTIONS): Remove.
438         * src/pr.c: Remove posixver.h and its uses.
439         (short_options): New constant, which always supports -S[string].
440         (COMMON_SHORT_OPTIONS): Remove.
441         * src/sort.c: Remove posixver.h and its uses.
442         (short_options): New constant, which always supports -y arg.
443         (COMMON_SHORT_OPTIONS): Remove.
444         (main): Redo workaround for Solaris compatibility with -y.
445         This change isn't visible to the user; it just cleans up the
446         code so that we don't need posixver.h.
447         * src/split.c: Remove posixver.h and its uses.
448         (main): Don't complain about -NUM option.
449         * src/tail.c (parse_obsolete_option): Don't complain about -NUM.
450         * src/unexpand.c: Remove posixver.h and its uses.
451         (main): Don't complain about -TAB.
452         * src/uniq.c (main): Don't complain about -NUM.
453
454 2005-04-22  Paul Eggert  <eggert@cs.ucla.edu>
455
456         * src/nohup.c (main): If getopt fails, exit with status 127,
457         not status 1.  POSIX requires this.
458         * NEWS: Document this.
459
460         * src/nice.c (main): Report proper program name when getopt finds
461         trouble.  Problem reported by Behdad Esfahbod.
462
463         * NEWS: Fix bug with "mkdir -m =+x dir"; the umask was being ignored
464         when the "+x" was being evaluated.
465         * mkdir.c (main): Compile mode with MODE_MASK_ALL and initial umask.
466         * mkfifo.c (main): Likewise.
467         * mknod.c (main): Likewise.
468         * tests/mkdir/perm: Test for the above bug.
469
470 2005-04-20  Paul Eggert  <eggert@cs.ucla.edu>
471
472         Port test cases to Microsoft-Windows-related environments,
473         following suggestions from Eric Blake.
474         * tests/install/Makefile.am (TESTS_ENVIRONMENT): Add EXEEXT.
475         * tests/install/basic-1: Undo previous change.
476         (dd, dd2): New vars, which use $EXEEXT.  All uses of dd and dd2 changed.
477         * tests/install/trap: Undo previous change.
478         (sig): New var.  Use it insted of "trap '' CHLD".
479         Append $EXEEXT to executable name.
480
481         "fetish" -> "coreutils" in more places.
482         * tests/Coreutils.pm: Renamed from tests/Fetish.pm.
483         (package Coreutils): Renamed from package Fetish.  All uses changed.
484         * tests/Makefile.am (EXTRA_DIST): Add Coreutils.pm and
485         remove Fetish.pm.
486
487 2005-04-19  Paul Eggert  <eggert@cs.ucla.edu>
488
489         * tests/mv/setup (dot_mount_point): Use stat -L, in case the
490         directory is actually a symbolic link.  Problem reported by
491         Eric Blake.
492
493         * tests/mv/mv-special-1: Use test -p to test for fifos, rather
494         than the (incorrect) test -f and the (inadequate) ls.  ls is
495         inadequate because on some hosts a buggy mv will create a file of
496         the wrong type (problem reported by Eric Blake).  Skip this test
497         if test -p doesn't work.
498
499         * tests/chmod/setgid: Use numeric group ids, not symbolic group names,
500         since the latter can have shell metacharacters in them (e.g., spaces).
501         This follows up to the 2005-01-17 patch, which missed this occurrence.
502
503 2005-04-18  Paul Eggert  <eggert@cs.ucla.edu>
504
505         "fetish" -> "coreutils" in several places.
506         * Makefile.cfg (ftp): Remove fetish.sf.net.
507         * Makefile.maint (emit_upload_commands): Likewise.
508         * src/Makefile.am (LDADD, $(PROGRAMS)): fetish -> coreutils.
509         * tests/group-names (COREUTILS_GROUPS): Renamed from FETISH_GROUPS.
510         * tests/chmod/setgid (FETISH_GROUP): Renamed from COREUTILS_GROUP.
511
512         * tests/install/basic-1: Use "cat", not "test", to test for
513         ../../src/dd.  Problem reported by Eric Blake.
514
515 2005-04-18  Jim Meyering  <jim@meyering.net>
516
517         * src/dd.c: Don't include stat-macros.h directly.  system.h does that.
518
519 2005-04-17  Paul Eggert  <eggert@cs.ucla.edu>
520
521         Work around a couple of "make check" failures reported for Cygwin
522         and ash by Eric Blake.
523         * tests/install/basic-1: Skip this test if ../../src/dd isn't readable.
524         * tests/install/trap: Skip this test if "trap '' CHLD" doesn't work.
525
526 2005-04-16  Jim Meyering  <jim@meyering.net>
527
528         * src/dd.c (S_TYPEISSHM): Remove definition.
529         Get the definition by including "stat-macros.h", instead.
530
531 2005-04-14  Paul Eggert  <eggert@cs.ucla.edu>
532
533         Fix test suite problems reported by Eric Blake on Cygwin.
534         * tests/mv/mv-special-1: Ignore chatter about when files are removed,
535         since POSIX doesn't require rename to fail across file systems.
536         * tests/mv/setup (dot_mount_point): Use stat rather than df, as
537         it's more reliable.
538         (other_partition_tmpdir): Remove df from name as that would be
539         misleading now.
540
541 2005-04-14  Jim Meyering  <jim@meyering.net>
542
543         * src/chown-core.c: Correct typo, fchmod -> fchown, in a comment.
544
545 2005-04-12  Paul Eggert  <eggert@cs.ucla.edu>
546
547         * src/ls.c (usage): "uid" -> "user ID".
548
549 2005-04-12  Jim Meyering  <jim@meyering.net>
550
551         * src/tsort.c (tsort): Use "%s" as the format string,
552         rather than a diagnostic or a file name.
553
554         * src/comm.c (compare_files): Remove declaration of unused local.
555
556         * src/chown-core.c (chopt_free): Mark parameter as unused.
557
558 2005-04-11  Paul Eggert  <eggert@cs.ucla.edu>
559
560         * man/chown.x: Reword to match user manual.
561         * man/id.x: Likewise.
562         * src/setuidgid.c (usage): Use "user ID", not "UID", and similarly
563         for "group ID".
564         * src/whoami.c (usage, main): Likewise.
565
566         Add bulletproofing for cases where stdin, stdout, or stderr are closed.
567         * src/comm.c: Include stdio-safer.h.
568         (compare_files): Exit right away on I/O error rather than continuing
569         and producing confusing output and error messages.
570         Return void, not int; all callers changed.
571         Use fopen_safer to avoid confusion with file descriptors.
572         * src/copy.c: Include unistd-safer.h.
573         (copy_reg): Use fd_safer.
574         * src/csplit.c: Include stdio-safer.h.
575         (input_desc): Remove unnecessary static initialization.
576         (set_input_file): Use STDIN_FILENO, not 0.
577         (create_output_file): Use fopen_safer.
578         * src/dircolors.c (dc_parse_file): Don't assume fopen does not
579         return stdin.
580         * src/head.c (head_file): Don't assume open does not return 0.
581         * src/join.c: Include stdio-safer.h.
582         (main): Use fopen_safer.  Simplify the resulting code.
583         * src/md5sum.c (digest_file, digest_check):
584         Don't assume that fopen does not return stdin.
585         * src/nohup.c: Include unistd-safer.h.
586         (main): Don't dup stderr to stdin or stdout by mistake.
587         * src/od.c (check_and_close): Don't assume fopen does not return stdin.
588         * src/paste.c (paste_serial): Likewise.
589         * src/pr.c: Include stdio-safer.h.
590         (open_file): Use fopen_safer.
591         (close_file): Don't assume fopen does not return stdin.
592         * src/ptx.c (main): Don't assume fopen returns stdout after closing
593         stdout.  Use freopen instead.
594         * src/shred.c: Include unistd-safer.h.
595         (wipename): Use fd_safer on directory file descriptor.
596         (wipefile): Remove special case for /dev/fd/* on older hosts.
597         It didn't work in general, and wasn't documented.
598         Use fd_safer.
599         * src/sort.c: Include unistd-safer.h.
600         (create_temp_file): Use fd_safer.
601         (xfclose): Don't assume fileno (stdin) == STDIN_FILENO, etc.
602         * src/split.c: Include unistd-safer.h.
603         (cwrite): Use fd_safer.  Replace mystery constant 0666 with symbolic
604         version, as POSIX requires.
605         * src/sum.c (bsd_sum_file, sysv_sym_file):
606         Use same pattern as elsewhere for checking for stdin.
607         * src/tac.c: Include unistd-safer.h.
608         (copy_to_temp): Use fd_safer.
609         (tac_file): Don't assume fopen cannot return stdin.
610         * src/tail.c: Include unistd-safer.h rather than fcntl-safer.h.
611         (recheck, tail_file): Use fd_safer rather than open_safer.
612         * src/tee.c: Include stdio-safer.h.
613         (tee): Use fopen_safer.
614         * src/touch.c: Include unistd-safer.h.
615         (touch): Use fd_safer.
616         * src/tsort.c (have_read_stdin): Remove; no longer needed.  All uses
617         removed.
618         (tsort): Do not assume fopen can't return stdin.
619         Close stdin before returning.  All uses changed.
620         * src/unexpand.c (next_file): Don't assume fopen cannot return stdin.
621         * src/uniq.c: Include stdio_safer.h.
622         (check_file): Don't assume fopen cannot return stdin or stdout.
623
624 2005-04-09  Jim Meyering  <jim@meyering.net>
625
626         * src/dd.c (quit): Define with ATTRIBUTE_NORETURN.
627
628         Now that close_stdout closes standard output unconditionally,
629         these workarounds for dd and cat are no longer necessary.
630         * src/dd.c (close_stdout_wrapper): Remove function.
631         (main): Call atexit with close_stdout, instead.
632         * src/cat.c (close_stdout_wrapper): Likewise.
633         Don't close STDOUT_FILENO explicitly; close_stdout does it.
634
635         * src/system.h (__attribute__): Readability nit:
636         Change this:
637         #  define __attribute__(x)
638         to this:
639         #  define __attribute__(x) /* empty */
640
641 2005-04-09  Jim Meyering  <jim@meyering.net>
642
643         * src/rm.c (usage): Mention that --recursive removes listed
644         directories too, not just their contents.
645         Say that by default, rm does not remove directories.
646
647         * src/pr.c: Don't include "timespec.h".  system.h does that.
648         * Makefile.maint (sc_system_h_headers): Propagate exit status
649         through trap.
650
651 2005-04-08  Paul Eggert  <eggert@cs.ucla.edu>
652
653         * NEWS: Document that dd no longer treats QUIT or PIPE specially,
654         and when conforming to POSIX no longer treats USR1 specially.
655         Document that dd no longer dumps core when handling signals.
656         * src/system.h (RETSIGTYPE): Remove; no longer needed.  All uses
657         replaced with void.
658         * src/csplit.c (SA_NOCLDSTOP): Define to 0 if not defined.
659         All uses changed.
660         (siginterrupt) [!HAVE_SIGINTERRUPT]: New macro.
661         (delete_all_files): New arg IN_SIGNAL_HANDLER, to avoid undefined
662         behavior when called from a signal handler.  All uses changed.
663         (main) [!defined SA_NOCLDSTOP]:
664         Use siginterrupt to specify that system calls should be interrupted.
665         * src/dd.c: Do not include safe-read.h or full-write.h; no longer needed.
666         (process_signals): Add forward decl.
667         (SA_NOCLDSTOP, sigprocmask, sigset_t) [!defined SA_NOCLDSTOP]:
668         New macros.
669         (siginterrupt) [! HAVE_SIGINTERRUPT]: New macro.
670         (SA_NODEFER) [!defined SA_NODEFER]: New macro.
671         (SA_RESETHAND) [!defined SA_RESETHAND]: New macro.
672         (caught_signals, interrupt_signal, info_signal_count, catch_siginfo):
673         New vars.
674         (usage): Mention -USR1 versus -INFO.
675         (cleanup): Don't invoke print_stats; the caller must do it now.
676         All callers changed.
677         (quit): Process signals just before exiting.
678         (interrupt_handler): Simply record the signal and return.
679         (siginfo_handler): Simply increment the signal counter and return.
680         (install_handler): Remove, replacing with:
681         (install_signal_handlers, process_signals, iread, iwrite):
682         New functions.  All callers to safe_read and full_write replaced
683         by iread and iwrite.  All callers to install_handler replaced by
684         install_handlers.
685         * src/ls.c (SA_NOCLDSTOP): Define to 0 if not defined.
686         All uses changed.
687         (siginterrupt) [! HAVE_SIGINTERRUPT]: New macro.
688         (main) [! SA_NOCLDSTOP]: Use it.
689         * src/shred.c: Remove all uses of signals; modern hosts have
690         /dev/random and don't need this gorp.
691         Do not include signal.h.
692         (env, sigill_handler, isaac_seed_machdep): Remove.  All uses removed.
693         * src/sort.c (SA_NOCLDSTOP): Define to 0 if not defined.
694         All uses changed.
695         (siginterrupt) [! HAVE_SIGINTERRUPT]: New macro.
696         (main) [! SA_NOCLDSTOP]: Use it.
697
698         * src/dd.c: Do not include inttostr.h, no longer needed.
699         (print_stats, main): Rewrite and simplify formats to use PRIuMAX
700         instead of umaxtostr.
701         (print_stats): Work even in languages that have special
702         forms for two of things, for r_truncate and w_bytes.  We can't
703         fix delta_s in this way, since ngettext doesn't support floating-point.
704         (main): Rewrite to avoid casts.
705
706 2005-04-07  Jim Meyering  <jim@meyering.net>
707
708         Placate gcc-4's -Wuninitialized.
709         * src/md5sum.c (digest_check) [lint]: Initialize hex_digest to NULL.
710         * src/test.c (binary_operator) [lint]: Initialize lt and rt to 0.
711
712         * src/test.c (is_int, age_of, binop): Declare `char *' parameters to
713         be `const'.
714         (binop): Move function definition to precede first use so we can...
715         (binop): ...remove prototype.
716
717 2005-04-05  Paul Eggert  <eggert@cs.ucla.edu>
718
719         * man/Makefile.am (.x.1): Remove "COMMAND.td/" from examples.
720         * src/basename.c (usage): Add examples.
721         * src/cat.c (usage): Likewise.
722         * src/chgrp.c (usage): Likewise.
723         * src/chown.c (usage): Likewise.
724         * src/dirname.c (usage): Likewise.
725
726 2005-04-05  Jim Meyering  <jim@meyering.net>
727
728         * src/nice.c (usage): Mention that some shells provide a
729         built-in function by the same name.
730         * src/nohup.c (usage): Likewise.
731         * src/printenv.c (usage):Likewise.
732
733 2005-04-04  Dmitry V. Levin  <ldv@altlinux.org>
734
735         * src/tee.c (tee): When closing files, do not close stdout,
736         leave this job to close_stdout() instead.
737         * configure.ac (AC_CONFIG_FILES): Add tests/tee/Makefile.
738         * tests/Makefile.am (SUBDIRS): Add tee.
739         * tests/tee/Makefile.am: New file.
740         * tests/tee/.cvsignore: Likewise.
741         * tests/tee/{basic,dash}: New tee tests.
742
743 2005-04-04  Jim Meyering  <jim@meyering.net>
744
745         * src/echo.c (usage): Mention that some shells provide a
746         built-in function by the same name.
747         * src/kill.c (usage): Likewise
748         * src/printf.c (usage): Likewise.
749         * src/pwd.c (usage): Likewise.
750         * src/stat.c (usage): Likewise.
751         * src/test.c (usage): Likewise.
752         * src/true.c (usage):
753         * src/system.h (USAGE_BUILTIN_WARNING): New macro.
754
755         * man/echo.x: Remove `DESCRIPTION' section, now that --help includes it.
756         * man/printf.x: Likewise.
757         * man/pwd.x: Likewise.
758
759 2005-04-03  Jim Meyering  <jim@meyering.net>
760
761         * src/pr.c (main): Fix off-by-one error.
762         pr -$(perl -e 'print "0"x63 . 1') would write one byte beyond the
763         end of a malloc'd buffer.
764
765 2005-04-01  Jim Meyering  <jim@meyering.net>
766
767         * src/pr.c (main): Free column_count_string when done with it.
768
769         Don't let pr treat +1:-1 like +1:18446744073709551615.
770         * src/pr.c (strtoumax): Remove declaration.
771         (first_last_page): Use xstrtoumax in place of strtoumax,
772         so we don't interpret a negative page number (e.g., in an option
773         like --pages=1:-1) as valid.
774         * tests/pr/Test.pm (neg-page): Add a test for this.
775
776 2005-03-30  Paul Eggert  <eggert@cs.ucla.edu>
777
778         * src/pinky.c (short_pinky): Adjust to read_utmp signature change.
779         * src/uptime.c (uptime): New arg OPTIONS.  All uses changed.
780         * src/users.c (users): Likewise.
781         * src/who.c (who): Likewise.
782         * src/uptime.c (main): Check PIDs when invoked with zero arguments.
783         * src/users.c (main): Likewise.
784         * src/who.c (main): Likewise.  Also with two arguments.
785         Omit duplicate code in 2-arg case.
786         (UT_PID): Moved to ../lib/readutmp.h.
787
788 2005-03-29  Jim Meyering  <jim@meyering.net>
789
790         * src/system.h (ptr_align): Declare `ptr' parameter to be a
791         `const' pointer, since this function never writes through it.
792
793         * src/uname.c: Indent cpp directives to reflect nesting.
794
795 2005-03-28  Jim Meyering  <jim@meyering.net>
796
797         * src/seq.c (get_width_format) [HAVE_RINT && HAVE_MODF && HAVE_FLOOR]:
798         Add `void' to make this an ANSI-style function declaration.
799         * src/remove.c (ds_init): Likewise.
800         * src/pr.c (print_sep_string): Likewise.
801
802         * src/stty.c (speeds): Declare this array to be static.
803         * src/Makefile.am (sc_tight_scope): Adjust to catch any
804         new declarations like that of stty.c's `speeds'.
805
806         * src/system.h (GETOPT_HELP_OPTION_DECL): Use NULL, not `0'.
807         (GETOPT_VERSION_OPTION_DECL): Likewise.
808         * src/chown.c (long_options): Likewise.
809         * src/chgrp.c (long_options): Likewise.
810         * src/chmod.c (long_options): Likewise.
811         * src/cp.c (sparse_type_string, reply_args, decode_preserve_arg):
812         Likewise.
813         * src/chown-core.c (chopt_init): Likewise.
814         * src/comm.c (long_options): Likewise.
815         * src/copy.c (copy_reg): Likewise.
816         * src/csplit.c (extract_regexp): Likewise.
817         * src/cut.c (longopts): Likewise.
818         * src/date.c (time_spec_string): Likewise.
819         * src/df.c (find_mount_point, show_point): Likewise.
820         * src/expr.c (docolon): Likewise.
821         * src/fmt.c (long_options): Likewise.
822         * src/ls.c (time_style_args, indicator_style_args, long_options)
823         (format_args, sort_args, time_args, decode_switches)
824         (gobble_file): Likewise.
825         * src/md5sum.c (long_options): Likewise.
826         * src/mv.c (reply_args): Likewise.
827         * src/paste.c (longopts): Likewise.
828         * src/pinky.c (print_entry): Likewise.
829         * src/pr.c (long_options): Likewise.
830         * src/ptx.c (long_options, format_args): Likewise.
831         * src/readlink.c (longopts): Likewise.
832         * src/sort.c (long_options, mergefps): Likewise.
833         * src/stat.c (long_options): Likewise.
834         * src/tac.c (main): Likewise.
835         * src/tail.c (follow_mode_string): Likewise.
836         * src/touch.c (longopts, time_args): Likewise.
837         * src/uniq.c (delimit_method_string): Likewise.
838         * src/uptime.c (print_uptime): Likewise.
839         * src/who.c (print_user): Likewise.
840
841 2005-03-27  Jim Meyering  <jim@meyering.net>
842
843         * src/dcgen: Simplify further, clean up.
844         Add a standard-output-closing global destructor.
845         Require perl-5.002.
846         * src/wheel-gen.pl: Use the same global destructor as dcgen.
847
848 2005-03-26  Paul Eggert  <eggert@cs.ucla.edu>
849
850         * src/dcgen: Squeeze multiple blanks into one.  Output a simple
851         array of adjacent strings rather than a more complicated data
852         structure; this saves space in the dircolors executable.
853         * src/dircolors.c (parse_line): Use char *, not unsigned char *.
854         This avoids casts.
855         (dc_parse_stream, main): Avoid casts.
856         Adjust to simpler data structure generated by new dcgen.
857
858 2005-03-25  Eric Blake  <ebb9@byu.net>  (tiny change)
859
860         * src/ls.c (usage): Document usage of LS_COLORS.
861
862 2005-03-25  Paul Eggert  <eggert@cs.ucla.edu>
863
864         * src/dircolors.hin: Add "TERM cygwin".
865
866 2005-03-25  Jim Meyering  <jim@meyering.net>
867
868         * src/system.h (DECIMAL_DIGIT_ACCUMULATE): Reverse the sense of
869         the return value, and update callers:
870         * src/cut.c (set_fields): Update use of DECIMAL_DIGIT_ACCUMULATE.
871         * src/expand.c (parse_tab_stops, main): Likewise.
872         * src/split.c (main): Likewise.
873         * src/unexpand.c (parse_tab_stops, main): Likewise.
874         * src/uniq.c (main): Likewise.
875
876 2005-03-22  Jim Meyering  <jim@meyering.net>
877
878         * build-aux: New directory.  Renamed from config.
879         * configure.ac: Reflect renaming: config -> build-aux.
880         * Makefile.am (dist-hook): Likewise.
881         * Makefile.maint: Likewise.
882         * Makefile.cfg (cvs_files): Likewise.
883         * .x-sc_sun_os_names: Likewise.
884         * .x-sc_trailing_blank: Likewise.
885
886         * src/ls.c (get_funky_string): Use '\a', rather than 7, for
887         portability to EBCDIC hosts.
888
889 2005-03-20  Jim Meyering  <jim@meyering.net>
890
891         * src/pr.c (init_header): Add missing `%' in new format string.
892         (init_header): Use zero-filled `.%09d' format, not space-filled `.%9d'.
893
894 2005-03-19  Jim Meyering  <jim@meyering.net>
895
896         * src/Makefile.am (pr_LDADD): Now that pr uses gettime, add
897         $(LIB_CLOCK_GETTIME) to get the required -lrt on newer Linux systems.
898
899 2005-03-18  Paul Eggert  <eggert@cs.ucla.edu>
900
901         * NEWS: pr -D "FORMAT" now accepts the same formats that
902         date +"FORMAT" does.
903         * src/pr.c: Include strftime.h, timespec.h.
904         (init_header): Obtain and format nanosecond part of time stamp.
905
906         * NEWS: nohup now ignores the umask when creating nohup.out.
907         nohup now closes stderr if it is a terminal and stdout is closed.
908         * src/nohup.c (main): Likewise.  Be a little more paranoid about
909         return values; e.g., check for any negative return from open.
910         Assume free (NULL) works.
911         Close file descriptor leak when redirecting standard output to a file.
912
913 2005-03-17  Jim Meyering  <jim@meyering.net>
914
915         * src/cut.c (set_fields): Use DECIMAL_DIGIT_ACCUMULATE macro,
916         in place of functionally-equivalent code.
917         * src/expand.c (parse_tab_stops, main): Likewise.
918         * src/split.c (main): Likewise.
919         * src/unexpand.c (parse_tab_stops, main): Likewise.
920         * src/uniq.c (main): Likewise.
921         * src/od.c: Use VERIFY macro in place of an equivalent open-coded
922         declaration.
923         * src/system.h (VERIFY, VERIFY_EXPR, DECIMAL_DIGIT_ACCUMULATE):
924         New macros.
925
926         Before, this command would make uniq skip 11 fields and print
927         only the first line:
928         $ _POSIX2_VERSION=1 ./uniq -f1 -1 <(seq --format='1 %g' 2)
929         1 1
930         1 2
931         * src/uniq.c (main): Interpret `uniq -f1 -1' like `uniq -f1',
932         not like `uniq -f11'.
933
934 2005-03-15  Jim Meyering  <jim@meyering.net>
935
936         Both `pr -0' and e.g., `pr -03' would evoke `column count too large'.
937         `pr -0' should give a better diagnostic and `pr -03' should be
938         equivalent to `pr -3'.
939         * src/pr.c (parse_column_count): Change return type to void.
940         Call error (EXIT_FAILURE, ... for an invalid string.
941         (main): Allocate space for column_count_string using malloc.
942         Accumulate all old-style column-count digits before converting.
943         When the number of columns is specified via both old-style,
944         (e.g., -3), and a long option (--columns=5), ensure that only
945         the last one specified takes effect.
946         * tests/pr/Test.pm: Add tests for the above.
947
948 2005-03-15  Corinna Vinschen  <corinna@vinschen.de>  (tiny change)
949
950         * src/copy.c (copy_reg): Copy regular files in binary mode.
951
952 2005-03-14  Paul Eggert  <eggert@cs.ucla.edu>
953
954         * NEWS: Restate why ls limits time stamp lengths.
955
956 2005-03-12  Jim Meyering  <jim@meyering.net>
957
958         Add a little infrastructure to help prevent future bugs like the
959         one fixed below.
960         * src/stat.c (xstrcat): New function.
961         (print_statfs, print_stat): Add buf_len parameter and convert all
962         uses of strcat to xstrcat.  Update callers.
963         (print_it): Call print_func with buf_len parameter.
964
965         Invoking stat -c FMT with a lone format directive of %s, %f, %h, %s,
966         could cause a buffer overrun error.
967         * src/stat.c (print_it): Allocate 2 more bytes, to accommodate our
968         conversion of the stat %s format string to the longer printf %llu one.
969         Patch from Guochun Shi.
970
971 2005-03-11  Paul Eggert  <eggert@cs.ucla.edu>
972
973         * src/ls.c (TIME_STAMP_LEN_MAXIMUM): New constant.
974         (long_time_expected_width, print_long_format): Use it, to avoid
975         some possible denial-of-service attacks.
976         * NEWS: Document this.
977
978 2005-03-11  Jim Meyering  <jim@meyering.net>
979
980         Prompt once again for `mv -i A B' when A and B are hard links
981         to the same file.  This fixes a bug introduced by my 2003-04-04
982         (coreutils-5.0.1) change.  Reported by Thomas Wolff via Eric Blake.
983         * src/copy.c (abandon_move): New function, factored out of
984         copy_internal, now that this code is being used from two places.
985         (copy_internal): Perform the same interactive-related test for
986         whether it's alright to proceed and (usually) overwrite the
987         destination file.
988         * tests/mv/i-4: Add tests for the above.
989
990         Don't segfault for a very long date format string, e.g.,
991         ls -ld --time-style=+%99999999H .
992         * src/ls.c (long_time_expected_width): Use x2nrealloc, not alloca,
993         so format string abuse cannot provoke stack overflow.
994         (print_long_format): Likewise.
995
996         Don't segfault for a long header date string, e.g.,
997         echo a|pr -D +%9999999A
998         * src/pr.c (init_header): Use x2nrealloc, rather than alloca.
999         Don't bother with fixed-sized initial buffer;  always use x*alloc.
1000
1001         * src/pr.c (init_header): Use slightly clearer INT_BUFSIZE_BOUND
1002         in place of equivalent INT_STRLEN_BOUND + 1.
1003         * src/expr.c (tostring, printv): Likewise.
1004
1005 2005-03-09  Paul Eggert  <eggert@cs.ucla.edu>
1006
1007         * src/system.h: Include intprops.h.
1008         (TYPE_SIGNED, TYPE_MINIMUM, TYPE_MAXIMUM, INT_STRLEN_BOUND): Remove;
1009         they are now defined in intprops.h.
1010
1011 2005-03-09  Jim Meyering  <jim@meyering.net>
1012
1013         * TODO: Remove entry about named pipes.  It was fixed in 5.3.0.
1014
1015 2005-03-08  Paul Eggert  <eggert@cs.ucla.edu>
1016
1017         * src/date.c (usage): Redo to match recent documentation changes.
1018         Don't bother documenting which usages are GNU extensions; the list
1019         wasn't correct, and is better left to the printed manual anyway.
1020
1021 2005-03-06  Jim Meyering  <jim@meyering.net>
1022
1023         Factor out column-count processing.
1024         * src/pr.c: Include "inttostr.h".
1025         (parse_column_count): New function.
1026         (main): Use the new function for both old-style, -9, and long,
1027         --columns=-9, options.
1028
1029         * src/cksum.c: Remove `register' keyword.
1030         * src/cut.c: Likewise.
1031         * src/dd.c: Likewise.
1032         * src/env.c: Likewise.
1033         * src/factor.c: Likewise.
1034         * src/fmt.c: Likewise.
1035         * src/fold.c: Likewise.
1036         * src/id.c: Likewise.
1037         * src/logname.c: Likewise.
1038         * src/ls.c: Likewise.
1039         * src/pr.c: Likewise.
1040         * src/printf.c: Likewise.
1041         * src/shred.c: Likewise.
1042         * src/sort.c: Likewise.
1043         * src/sum.c: Likewise.
1044         * src/test.c: Likewise.
1045         * src/tsort.c: Likewise.
1046         * src/uniq.c: Likewise.
1047         * src/wc.c: Likewise.
1048         * src/whoami.c: Likewise.
1049
1050 2005-03-01  Paul Eggert  <eggert@cs.ucla.edu>
1051
1052         * src/Makefile.am (nanosec_libs): Remove $(LIB_XANOSLEEP); no
1053         longer needed.
1054
1055 2005-03-01  Jim Meyering  <jim@meyering.net>
1056
1057         * src/copy.c (copy_internal): Change test of source type from
1058         !S_ISREG to S_ISLNK.  Reported by Paul Eggert in
1059         http://lists.gnu.org/archive/html/bug-coreutils/2004-10/msg00050.html.
1060
1061 2005-02-28  Jim Meyering  <jim@meyering.net>
1062
1063         * NEWS: Mention that xnanosleep fixes sleep failure on linux-2.6.8.1.
1064
1065 2005-02-21  Paul Eggert  <eggert@cs.ucla.edu>
1066
1067         * src/Makefile.am (dd_LDADD, shred_LDADD): Add $(LIB_GETHRXTIME).
1068         (nanosec_libs): Add $(LIB_XNANOSLEEP).  Needed for newer GNU/Linux
1069         hosts with clock_gettime.
1070
1071 2005-02-20  Paul Eggert  <eggert@cs.ucla.edu>
1072
1073         * NEWS: Describe user-visible change to dd.
1074         * src/Makefile.am (dd_LDADD, shred_LDADD, nanosec_libs):
1075         Remove $(LIB_CLOCK_GETTIME).  These functions now use
1076         gethrxtime instead.
1077         * src/dd.c: Include gethrxtime.h, xtime.h.
1078         (start_time): Now of type xtime_t, not struct timespec.
1079         (print_stats, main): Use gethrxtime rather than gettime.
1080         * src/ls.c (time): Remove obsolete decl.
1081         (get_current_time): gettimeofday always returns 0, so don't
1082         check its result.
1083         * src/shred.c: Include gethrxtime.h.
1084         (isaac_seed): Use gethrxtime rather than a mishmash.
1085         * src/touch.c (time): Remove obsolete decl.
1086
1087         * tests/misc/split-fail: Don't assume that the current host
1088         supports integers wider than 32 bits.  Fix comment typo.
1089         * tests/od/x8: Likewise.
1090
1091         * src/chown-core.c (enum RCH_status): Remove trailing comma,
1092         as it's not valid in standard C89.
1093
1094 2005-02-15  Jim Meyering  <jim@meyering.net>
1095
1096         * src/stat.c (human_fstype): Add case/definition for S_MAGIC_XFS
1097         so that file systems of type `xfs' are recognized as such.
1098         * src/fs.h: Regenerate.
1099         Reported by Bernd Eckenfels.
1100         * src/stat.c (human_fstype): Likewise for S_MAGIC_JFS/jfs.
1101         * src/fs.h: Regenerate.
1102         Reported by Andreas Schwab.
1103
1104         * src/nice.c (NZERO) [NZERO == 0]: Undefine and define to 20,
1105         to work around the invalid definition from Darwin 7.7.0.
1106         Test failure reported by Sébastien Maret.
1107
1108 2005-02-14  Paul Eggert  <eggert@cs.ucla.edu>
1109
1110         * src/sort.c (mergefps): Use binary search rather than linear one
1111         when comparing new line to lines already in main memory.
1112         Idea suggested by James Lemley.
1113
1114 2005-02-09  Jim Meyering  <jim@meyering.net>
1115
1116         * src/copy.c (valid_options): Add an assertion that
1117         not both hard_link and symbolic_link are set.
1118
1119 2005-02-08  Paul Eggert  <eggert@cs.ucla.edu>
1120
1121         * NEWS: Document stat -f -c %S, plus changes to default formats.
1122         * doc/coreutils.texi (stat invocation): Normalize terminology,
1123         capitalization, and sort order to match --help output.  Mention %c
1124         for file systems.  Add new -f -c format %S, and document %s versus %S;
1125         problem reported by Jeroen van Wolffelaar.
1126         * src/stat.c (usage): Likewise.
1127         (STATFS_FRSIZE): New macro.
1128         (print_statfs): Use it, for stat -f -c %S.
1129         (do_statfs): Change default formats to output %S.
1130
1131 2005-02-03  Paul Eggert  <eggert@cs.ucla.edu>
1132
1133         * src/system.h: Include "memrchr.h".
1134         (memrchr) [!HAVE_DECL_MEMRCHR]: Remove decl.
1135
1136 2005-02-02  Jim Meyering  <jim@meyering.net>
1137
1138         * tests/du/8gb: Also adjust the test (s/64/128/) to detect
1139         systems that don't support sparse files.
1140         Check for $2 -ge 128, rather than $2 = 128, in case
1141         there is a file system type that doesn't support sparse files,
1142         yet for which metadata takes up additional space.
1143         Both reported by Andreas Schwab.
1144
1145 2005-02-01  Eric Blake  <ebb9@byu.net>  (tiny change)
1146
1147         * tests/du/8gb: Create a larger test file, so we properly
1148         detect that sparse files can be created on NTFS under cygwin.
1149
1150 2005-01-30  Jim Meyering  <jim@meyering.net>
1151
1152         * src/head.c (elide_tail_bytes_pipe): Correct wording in diagnostic.
1153
1154         * src/stty.c: Remove unnecessary parentheses in all #if directives.
1155
1156 2005-01-29  Eric Blake  <ebb9@byu.net>  (tiny change)
1157
1158         * .cvsignore: Ignore config.cache and config.status.lineno.
1159         * src/stty.c [VSWTCH]: Some systems, like Cygwin, use VSWTC
1160         instead of VSWTCH, for use with CSWTCH.
1161
1162 2005-01-29  Eric Blake  <ebb9@byu.net>  (tiny change)
1163
1164         * tests/Makefile.am (.PHONY): Add check-root and root-hint.
1165         * tests/rwx-to-mode: Ignore ACL designation.
1166         * tests/setgid-check: Likewise.
1167         * tests/chown/separator: Quote user and group names.
1168
1169 2005-01-24  Jim Meyering  <jim@meyering.net>
1170
1171         * src/cp.c (usage): Merge the descriptions of --no-dereference and -P.
1172         Suggestion from Johan Boule.
1173
1174 2005-01-17  Eric Blake  <ebb9@byu.net>  (tiny change)
1175
1176         * src/Makefile.am (all_programs.list): Strip $(EXEEXT) and remove
1177         duplicates.
1178         * man/Makefile.am (all_programs): Revert previous patch; updated
1179         all_programs.list fixes this.
1180         (.x.1): No need to add $(EXEEXT).
1181
1182 2005-01-03  Corinna Vinschen  <corinna@vinschen.de>  (tiny change)
1183
1184         * src/system.h: Use S_BLKSIZE value for ST_NBLOCKSIZE where
1185         available.
1186
1187 2005-01-22  Jim Meyering  <jim@meyering.net>
1188
1189         * Makefile.maint (v_etc_file): The version string has moved to
1190         version-etc-fsf.c, search that new file, not version-etc.c.
1191
1192 2005-01-17  Paul Eggert  <eggert@cs.ucla.edu>
1193
1194         * tests/group-names: Use numeric group ids, not symbolic group names,
1195         since the latter can have shell metacharacters in them (e.g., spaces).
1196         Problem reported by Eric Blake.
1197         * tests/chgrp/basic: Assume groups are numeric, not symbolic.
1198         * tests/chgrp/deref: Likewise.
1199         * tests/chgrp/posix-H: Likewise.
1200         * tests/chgrp/recurse: Likewise.
1201
1202 2005-01-15  Jim Meyering  <jim@meyering.net>
1203
1204         * src/shred.c (isaac_seed) [HAVE_GETHRTIME]: #if-0 this block,
1205         because just calling gethrtime evokes an `illegal instruction'
1206         failure when compiled with Sun's c89 on Solaris 8 and 9.
1207         Reported by Nelson Beebe.
1208
1209         * src/shred.c (isaac_seed) [HAVE_GETHRTIME]: Don't call ISAAC_SEED
1210         twice with the same value of `t'.
1211         Replace nested #if-#else blocks with #if-#elif-#elif chain.
1212
1213 2005-01-14  Jim Meyering  <jim@meyering.net>
1214
1215         The test, tests/tail/f-1, failed on powerpc-apple-darwin7.7.0.
1216         * src/tail.c (IS_TAILABLE_FILE_TYPE): Adjust definition also to include
1217         sockets, since that's what you get when reading from a command-line-
1218         supplied pipe on Darwin 7.7.
1219         (IS_PIPE_LIKE_FILE_TYPE): Define.
1220         (main): Use new IS_PIPE_LIKE_FILE_TYPE rather than simply S_ISFIFO.
1221         Reported by Nelson Beebe.
1222         This same change is also required on NetBSD/sparc-1.5.
1223         Reported by Adrian Bunk.
1224
1225         * src/expr.c (toarith): Rewrite to detect/diagnose integer overflow,
1226         rather than suffering silently.
1227         Before, expr would silently overflow and wrap around:
1228           $ expr 9223372036854775808 = 0   # $(echo 2^63|bc)
1229           1
1230         Now it detects the problem and exits nonzero:
1231           $ ./expr $(echo 2^63|bc) = 0
1232           ./expr: 9223372036854775808: integer is too large
1233
1234         * tests/chown/separator (id_gn): Exit 77, not 1, for a test-framework
1235         failure, so that doesn't cause `make check' to stop.  Nelson Beebe
1236         reported that this test would fail with the diagnostic,
1237         `cannot find name for group ID 10', on one of his systems.
1238
1239 2005-01-13  Jim Meyering  <jim@meyering.net>
1240
1241         * src/test.c (is_int): Don't overflow when evaluating integer
1242         constants.  Before, ./test $(echo 2^64|bc) -eq 0 && echo FAIL
1243         would print `FAIL'.
1244
1245         * tests/Fetish.pm (run_tests): Add code (if-0'd out) to detect
1246         names of temporary files that would clash on 8.3 file systems.
1247         * tests/mk-script (validate): Likewise.
1248
1249 2005-01-12  Jim Meyering  <jim@meyering.net>
1250
1251         * tests/dd/skip-seek: Shorten test names to accommodate 8.3 systems.
1252
1253         * tests/tr/Test.pm (repeat-xC): Change test name from
1254         `repeat-Compl', to avoid 8.3 conflict with `repeat-compl'.
1255         Reported by Eric Blake.
1256         (repeat-000): Rename to `repeat-zeros' for the same reason.
1257
1258 2005-01-11  Jim Meyering  <jim@meyering.net>
1259
1260         * configure.ac: Update version to 5.3.1.
1261
1262 2005-01-11  Eric Blake  <ebb9@byu.net>
1263
1264         * src/Makefile.am (check-README, check-AUTHORS): Account for $(EXEEXT).
1265         * man/Makefile.am (all_programs): Account for $(EXEEXT).
1266
1267 2005-01-11  Jim Meyering  <jim@meyering.net>
1268
1269         * src/unexpand.c (add_tab_stop): Properly diagnose a tabstop list
1270         with decreasing values.
1271
1272         * src/expand.c (main): Likewise.
1273         * src/unexpand.c (main): Check for overflow in tabstop values
1274         specified via the obsolete form.  E.g., now this command fails:
1275         _POSIX2_VERSION=1 ./unexpand -$(echo '2^64+1'|bc)
1276         Before it would act like `_POSIX2_VERSION=1 ./unexpand -1'.
1277         * tests/unexpand/basic-1 (obs-ovflo): New test for this.
1278
1279 2005-01-10  Paul Eggert  <eggert@cs.ucla.edu>
1280
1281         Respond to POSIX interpretations about pathchk -p dated 2005-01-06.
1282         * NEWS: Document the changes.
1283         * doc/coreutils.texi (pathchk invocation): Likewise.
1284         * src/pathchk.c (PORTABILITY_OPTION): New constant.
1285         (longopts, usage, main, validate_file_name):
1286         Add support for new -P option.
1287         Reject empty file names (unless -p is not specified and the
1288         current system allows empty file names).
1289         Change --portability so that is now equivalent to -p -P.
1290         Don't test whether file name is too long, if it is known to exist.
1291         (no_leading_hyphen): New function.
1292         * tests/misc/pathchk1: Add tests for empty file names and
1293         pathchk -P.
1294
1295 2005-01-08  Jim Meyering  <jim@meyering.net>
1296
1297         * Version 5.3.0.
1298
1299         `pr --columns=N' was not equivalent to `pr -N' when also using
1300         either -s or -w.
1301
1302         * src/pr.c (main): Set `explicit_columns' for --columns=N,
1303         not just for -N.  This bug has existed since the introduction
1304         of the --columns=N option on 1998-08-15.
1305         * NEWS: Document this.
1306         * tests/pr/Test.pm (test_vector): For each -N test, automatically
1307         create a new test vector using --columns=N.
1308
1309 2005-01-07  Paul Eggert  <eggert@twinsun.com>
1310
1311         * src/pr.c (main): Check for column count overflow with
1312         usages like "pr -2147483648".
1313
1314 2005-01-07  Jim Meyering  <jim@meyering.net>
1315
1316         * src/pr.c (init_fps): Use xnmalloc, rather than xmalloc.
1317
1318 2005-01-06  Jim Meyering  <jim@meyering.net>
1319
1320         * README: List the precise HP-UX version numbers that are affected.
1321         Suggestion from Bob Proulx.
1322
1323         * Makefile.maint (sc_changelog): Specify find's `-maxdepth 2'
1324         predicate before `-name ChangeLog' to avoid a harmless warning
1325         from find-4.2.10.
1326
1327 2005-01-05  Jim Meyering  <jim@meyering.net>
1328
1329         * tests/help-version: Punt on the uptime test, since it fails when
1330         it can't get boot time, and I don't want that to stop `make check'.
1331
1332         * src/du.c (process_file): Evaluate exclusion rules against
1333         the entire file name, not just the last component.
1334         Reported by Robert Lindgren.
1335         * tests/du/exclude: Test for this.
1336         * NEWS: Document this.
1337
1338         Ensure that tests/Makefile.am's check-root actions stay up to date.
1339         * Makefile.maint (sc_root_tests): New rule.
1340         (syntax-check-rules): Add it to the list.
1341
1342 2005-01-04  Jim Meyering  <jim@meyering.net>
1343
1344         * man/shred.x: Change one-line summary to reflect that shred does
1345         not remove files by default.  Suggestion from Helen Faulkner in
1346         http://bugs.debian.org/288552
1347
1348         * README: Request VERBOSE=yes output when reporting test failures.
1349         Other minor changes.
1350
1351         * tests/Makefile.am (check-root): Update.
1352
1353 2005-01-03  Paul Eggert  <eggert@cs.ucla.edu>
1354
1355         * src/system.h: Undo previous change; we now use Autoconf.
1356
1357 2005-01-03  Jim Meyering  <jim@meyering.net>
1358
1359         * tests/stty/row-col-1: Don't set rows or columns to zero, to avoid
1360         a bug in the TIOCGWINSZ ioctl on at least Solaris5.9 systems.  Setting
1361         either (or both) to zero would succeed, but subsequent `stty size'
1362         would say `no size information for this device' due to the ioctl
1363         failing with EINVAL.
1364
1365         * src/system.h: If PRIdMAX, PRIoMAX, PRIuMAX, and PRIxMAX are
1366         not all defined and either ULONG_MAX or ULLONG_MAX is not defined,
1367         then fail at compile-time rather than let tools like od produce
1368         invalid results at run time.
1369
1370 2004-12-21  Jim Meyering  <jim@meyering.net>
1371
1372         * src/csplit.c (usage): Say the default names are `xx00, xx01, ...',
1373         not `xx01, xx02, ...'.
1374         Reported by Matt Kraai in http://bugs.debian.org/286605
1375
1376         * tests/misc/split-fail: Avoid spurious failure on x86 Solaris5.9
1377         when using c89.
1378
1379 2004-12-20  Paul Eggert  <eggert@cs.ucla.edu>
1380
1381         * src/split.c (usage): Mention default size.  Suggested by Dan Jacobson.
1382
1383 2004-12-19  Paul Eggert  <eggert@cs.ucla.edu>
1384
1385         * NEWS: Mention that one should eval "`dircolors`" rather than
1386         `dircolors`.
1387
1388 2004-12-17  Jim Meyering  <jim@meyering.net>
1389
1390         * tests/mv/hard-link-1: Rearrange to use newer trap-handling code,
1391         so temporary directories aren't left behind upon e.g., interrupt.
1392
1393 2004-12-16  Paul Eggert  <eggert@cs.ucla.edu>
1394
1395         * src/ls.c (print_dir): Use "%s: not listing already-listed
1396         directory", not "not listing already-listed directory: %s", to
1397         format already-listed directories, to be consistent with other
1398         diagnostics involving file names and colons.
1399
1400 2004-12-15  Jim Meyering  <jim@meyering.net>
1401
1402         * src/Makefile.am (__LDADD): Define, so that building `[' on
1403         Solaris still uses the -lgen library that it requires in order
1404         to get a definition of eaccess.
1405
1406 2004-12-14  Jim Meyering  <jim@meyering.net>
1407
1408         tac would exit immediately upon I/O or temp-file creation failure.
1409         Now it continues on, processing any remaining command line arguments.
1410
1411         * src/tac.c: Include quotearg.h.
1412         Use quotearg_colon in most diagnostics.
1413         (copy_to_temp): Rewrite not to exit upon I/O or temp-file-creation
1414         failure.  Before, this command (with /full/tmp being a full partition)
1415           TMPDIR=/full/tmp ./tac /proc/modules tac.c
1416         would exit immediately upon the write error while trying to copy
1417         non-seekable /proc/modules to the full partition.  Now it still
1418         reports the failure but continues on with the remaining file.
1419         (tac_nonseekable): Return false also if copy_to_temp fails.
1420         [DONT_UNLINK_WHILE_OPEN]: Add a FIXME comment explaining that
1421         using atexit like this is wrong.
1422         * NEWS: Document this.
1423         * tests/misc/tac-continue: New test for this.
1424         * tests/misc/Makefile.am (TESTS): Add tac-continue.
1425
1426         * tests/chown/basic: Add a few more tests.
1427
1428 2004-12-13  Paul Eggert  <eggert@cs.ucla.edu>
1429
1430         * src/ls.c (gobble_file): Change arg name to be command_line_arg
1431         rather than explicit_arg, for consistency with copy.c.
1432         (extract_dirs_from_files): Remove ignore_dot_and_dot_dot arg, since
1433         it is deducible from dirname arg.  All callers changed.
1434         (extract_dirs_from_files, print_dir, queue_directory):
1435         Add command_line_arg arg.  All callers changed.
1436         (struct pending): Add command_line_arg member.
1437         (main): Use NULL rather than 0 when appropriate.
1438         (set_exit_status, file_failure): New functions.
1439         (queue_directory): Store command_line_arg into new structure.
1440         (print_dir, gobble_file, get_link_name):
1441         Use file_failure to report problems in accessing files,
1442         so that the exit status is set consistently.
1443         (print_dir): Simplify readdir failure code yet again.
1444         If closedir fails, report "closing directory" rather than "reading
1445         directory" failure.
1446         (xstrcoll): Use set_exit_status to set status on failure.
1447         * tests/ls-2/tests (no-a-isdir-b): This now exits with status 2,
1448         not status 1.
1449
1450 2004-12-11  Jim Meyering  <jim@meyering.net>
1451
1452         Avoid a race condition vulnerability in chown, when used with
1453         --from=O:G and without the (-h) --no-dereference option.
1454         * src/chown-core.c (restricted_chown): New function.
1455         (change_file_owner): Call it.
1456         Reported by Ulrich Drepper.
1457         * NEWS: Mention this.
1458
1459 2004-12-09  Paul Eggert  <eggert@cs.ucla.edu>
1460
1461         * ls now exits with status 1 on minor problems, 2 if serious trouble.
1462         * NEWS: Document this.
1463         * src/ls.c (LS_MINOR_PROBLEM, LS_FAILURE): New constants.
1464         All uses of EXIT_FAILURE replaced with LS_FAILURE, unless
1465         specified below.
1466         (main): Initialize exit failure to LS_FAILURE.
1467         (print_dir, gobble_file, get_link_name, xstrcoll):
1468         Set exit status to LS_MINOR_PROBLEM if the failure is minor.
1469         (print_dir): Do not give up on entire directory merely because readdir
1470         returns EOVERFLOW.
1471         (usage): Explain exit status.
1472         * tests/help-version: ls and variants now exit with status 2
1473         on serious trouble.
1474
1475 2004-12-08  Paul Eggert  <eggert@cs.ucla.edu>
1476
1477         * NEWS: Document new UTC+HH:MM date syntax, and put date changes
1478         together.
1479
1480 2004-12-07  Paul Eggert  <eggert@cs.ucla.edu>
1481
1482         * src/factor.c (factor): Don't list 1 as a factor of 1.
1483         Problem reported by Thomas Folz-Donahue.
1484
1485 2004-12-06  Jim Meyering  <jim@meyering.net>
1486
1487         * tests/du/files0-from: Sanitize environment.
1488         Otherwise, e.g., BLOCKSIZE=k would cause a failure, and that
1489         setting is the default (exported from /etc/profile) on at least one
1490         NetBSD 1.6 system.
1491         * tests/du/no-deref: Likewise.
1492         * tests/cp/symlink-slash: Likewise.
1493         * tests/ls/symlink-slash: Likewise
1494
1495 2004-12-05  Jim Meyering  <jim@meyering.net>
1496
1497         * tests/tail/Test.pm (err-6) ["tail -c"]: Avoid test failure when
1498         _POSIX2_VERSION=199209 is in the environment, or when building on
1499         e.g., OpenBSD 3.2.
1500
1501 2004-12-04  Jim Meyering  <jim@meyering.net>
1502
1503         * NEWS: Mention cut's new --complement option.
1504
1505 2004-10-01  Paolo Bonzini  <bonzini@gnu.org>
1506
1507         * cut.c (complement, COMPLEMENT_OPTION): New.
1508         (longopts): Add --complement.
1509         (usage): Say not that -b, -c, and -f `print' fields,
1510         but rather that they `select' fields for printing.
1511         Describe the new --complement option.
1512         (mark_range_start): Extracted from set_fields.
1513         (print_kth): Support --complement.
1514         (compare_ranges): New function.
1515         (set_fields): Rewrite the part that populates range_start_ht,
1516         merging it with the part that populates printable_field.
1517         (main): Handle --complement.
1518
1519 2004-12-03  Paul Eggert  <eggert@cs.ucla.edu>
1520
1521         * src/tail.c (tail_file): Set errnum to -1 if the initial "tail"
1522         failed.  This works around an assertion failure reported by
1523         Roberto Nibali in:
1524         http://lists.gnu.org/archive/html/bug-coreutils/2004-12/msg00012.html
1525
1526 2004-12-02  Jim Meyering  <jim@meyering.net>
1527
1528         With using --color and with LS_COLORS saying not to color
1529         executables, don't stat every file.
1530         * src/ls.c (is_colored): New function.
1531         (gobble_file): Use it.
1532         (main): Use it here, in place of too-strict tests against NULL:
1533         if either ORPHAN or MISSING was set to 0 from LS_COLORS, the
1534         old test would fail.
1535
1536 2004-12-01  Paul Eggert  <eggert@cs.ucla.edu>
1537
1538         * src/comm.c (compare_files): Assume setlocale exists.
1539         * src/join.c (keycmp): Likewise.
1540         * src/seq.c (decimal_point): Treat like sort.  Now char.
1541         All uses changed.
1542         (main): Assume localeconv exists.  Use same code as sort.
1543         * src/sort.c (C_DECIMAL_POINT): Remove.  Use changed to '.'.
1544         Assume setlocale exists.
1545         (thousands_sep): Renamed from th_sep.
1546         (IS_THOUSANDS_SEP): Remove.  All uses replaced by comparisons.
1547         (NONZERO): Parenthesize use of arg.
1548         (numcompare): Avoid duplicate loads.  Use ISDIGIT as boolean, for
1549         consistency.  Avoid unnecessary negation by reversing
1550         fraccompare args.
1551         (main): Rewrite localeconv call to match seq.c.
1552         * src/system.h: Assume locale.h exists.
1553         (HAVE_SETLOCALE): Remove.
1554         * src/uniq.c (different): Assume setlocale exists.
1555
1556         * src/ls.c (sort_files): Minor cleanup.  Remove an unnecessary
1557         'volatile' on a local variable.  Rewrite to avoid unnecessary
1558         double-assignment to 'func' in the usual case where strcoll does
1559         not fail.
1560
1561 2004-11-30  Paul Eggert  <eggert@cs.ucla.edu>
1562
1563         * src/pinky.c (gethostname): Remove decl.
1564         (scan_entries): Use IS_USER_PROCESS instead of by-hand code.
1565         * src/uptime.c (print_uptime): Use IS_USER_PROCESS and
1566         UT_TYPE_BOOT_TIME instead of by-hand code.
1567         * src/users.c (list_entries_users): Use IS_USER_PROCESS
1568         instead of by-hand code.
1569         * src/who.c (USER_PROCESS, RUN_LVL, INIT_PROCESS, LOGIN_PROCESS,
1570         DEAD_PROCESS, BOOT_TIME, NEW_TIME, UT_TYPE_UNDEF, UT_TYPE): Remove.
1571         (IS_USER_PROCESS): Move to ../lib/readutmp.h.
1572         (UT_TYPE_RUN_LVL, UT_TYPE_INIT_PROCESS, UT_TYPE_LOGIN_PROCESS,
1573         UT_TYPE_DEAD_PROCESS, UT_TYPE_NEW_TIME): New macros.
1574         (gethostname): Remove decl.
1575         (list_entries_who, scan_entries): Use the new macros defined above,
1576         for consistency with pinky, uptime, and users.
1577
1578 2004-11-25  Paul Eggert  <eggert@cs.ucla.edu>
1579
1580         Fix problem reported by Scott S. Tinsley for HP-UX 11.11 using
1581         HP's ANSI C compiler.  Declaring int functions causes warnings on
1582         some modern systems and shouldn't be needed to compile on ancient
1583         ones.
1584         * src/copy.h (stat, lstat, rename): Remove decls.
1585         * src/install.c (stat): Remove decl.
1586         * src/ln.c (link, symlink): Remove decls.
1587
1588 2004-11-25  Jim Meyering  <jim@meyering.net>
1589
1590         * man/help2man: Import help2man-1.35.1.
1591         * man/Makefile.am (.x.1): Remove now-unnecessary use of
1592         locally-added --program-name=NAME option.  Now, help2man gets
1593         the name from the [NAME] section (i.e. from our .x file).
1594         * man/install.x: Use `install', not `ginstall' in the one-line
1595         description.  Reported by Brendan O'Dea.
1596         * man/sha1sum.x: Use `sha1sum', not `shasum'.
1597
1598 2004-11-24  Jim Meyering  <jim@meyering.net>
1599
1600         Since the changes of 2004-05-22, the u.saved_cwd member at
1601         the bottom of the active-directory stack was no longer
1602         strictly necessary.  This change removes that member and uses
1603         the newer cwd_state parameter for the final restore_cwd.
1604
1605         * src/remove.c (struct AD_ent) [u]: Remove now-unnecessary union.
1606         [dev_ino]: Rename from `a'.
1607         (AD_pop_and_chdir): Add a parameter to play the role of just-removed
1608         bottom-of-stack cwd-state member.
1609         (AD_pop_and_chdir): No longer return boolean.  Adjust caller.
1610         (AD_push_initial): Remove CWD parameter.  Adjust caller.
1611
1612 2004-11-23  Paul Eggert  <eggert@cs.ucla.edu>
1613
1614         Minor performance improvements and cleanups for "touch".
1615         * src/touch.c (posix_date): Remove; not needed as a static var.
1616         All uses rewritten.
1617         (touch): Use new futimens function to operate more efficiently
1618         in some cases.  Don't stat/fstat existing file when
1619         (!amtime_now && change_times == (CH_ATIME | CH_MTIME)); the
1620         old time stamps aren't needed in that case.
1621         (main): change_times is int, not bool.  Simplify test for
1622         change_times.
1623
1624 2004-11-20  Paul Eggert  <eggert@cs.ucla.edu>
1625
1626         * src/install.c (usage): Avoid usage that runs afoul of Docbook
1627         translation.  Problem reported by Eric S. Raymond.
1628
1629         Restore dd's noctty flag, reverting the change of 2004-04-08.
1630         POSIX does not allow "dd" to use O_NOCTTY by default.
1631         * NEWS: Add noctty flag to dd.
1632         * doc/coreutils.texi (dd invocation): Likewise.
1633         * src/dd.c (flags, usage, main): Likewise.
1634
1635 2004-11-19  Alfred M. Szmidt  <ams@gnu.org>
1636
1637         * src/ls.c (usage): Clarified description of --no-group (-G),
1638         --human-readable (-h), --inode (-i), --size (-s), --time,
1639         and --time-style.
1640
1641 2004-11-19  Jim Meyering  <jim@meyering.net>
1642
1643         * src/ls.c (usage): Clarify description of --author.
1644         Tweak indentation so that help2man creates better nroff.
1645         Reported by Dan Jacobson.
1646
1647         * src/uniq.c (check_file): Don't check stdout for errors here.
1648
1649         * src/pwd.c (find_dir_entry): Update comment to match reality.
1650
1651 2004-11-18  Jim Meyering  <jim@meyering.net>
1652
1653         * src/pwd.c (robust_getcwd): Correct the comment: this function
1654         constructs the directory name.  The caller prints it.
1655
1656 2004-11-16  Paul Eggert  <eggert@cs.ucla.edu>
1657
1658         * src/stat.c (STATFS): New macro, for portability to Solaris 9.
1659         (do_statfs): Use it.
1660
1661         * src/basename.c, src/chroot.c, src/cksum.c, src/dd.c, src/dirname.c,
1662         src/factor.c, src/hostid.c, src/hostname.c, src/link.c, src/logname.c,
1663         src/nohup.c, src/printenv.c, src/pwd.c, src/setuidgid.c, src/sleep.c,
1664         src/sync.c, src/tsort.c, src/unlink.c, src/uptime.c, src/users.c,
1665         src/whoami.c, src/yes.c (main): Use getopt_long rather than getopt.
1666         * src/readlink.c (main): argv is not const.
1667
1668         * src/cut.c (usage): Improve documentation along the lines suggested
1669         by Debian 5.2.1-2.
1670         * src/echo.c (usage): Likewise.
1671         * src/expr.c (usage): Likewise.
1672
1673         * src/dircolors.hin: Add putty, screen-bce.
1674
1675         * src/pinky.c (print_entry): Fix memory leak.
1676         * src/who.c (print_user): Likewise.
1677
1678 2004-11-15  Paul Eggert  <eggert@cs.ucla.edu>
1679
1680         * NEWS: New dd operand "status=noxfer".
1681         * src/dd.c (C_ASCII, C_EBCDIC, C_IBM, C_BLOCK, C_UNBLOCK,
1682         C_LCASE, C_UCASE, C_SWAB, C_NOERROR, C_NOTRUNC, C_SYNC, C_TWOBUFS,
1683         C_NOCREAT, C_EXCL, C_FDATASYNC, C_FSYNC): Now constants, not
1684         macros.
1685         (STATUS_NOXFER, statuses): New constants.
1686         (usage, print_stats, scanargs): Add support for status=noxfer.
1687         (usage): Update status output to match new behavior.
1688         (print_stats): Always output complete byte count.
1689         Put space between numbers and units, as SI requires.
1690         Use ngettext so that i18n can use plurals for "byte" and "second".
1691         Don't multiply by 1e-9 (inexact); divide by 1e9 (which is exact).
1692         (iflag_error_msgid, oflag_error_msgid): Remove; replace uses by
1693         the string.
1694         * tests/dd/skip-seek (@Tests): Use status=noxfer to avoid
1695         problems with regression testing.
1696
1697 2004-11-14  Paul Eggert  <eggert@cs.ucla.edu>
1698
1699         * NEWS: dd now outputs total bytes, seconds, and bytes per second.
1700         * src/Makefile.am (dd_LDADD): Add $(LIB_CLOCK_GETTIME).
1701         * src/dd.c: Include "human.h".
1702         (w_bytes, start_time): New vars.
1703         (usage): Document new I/O statistics output
1704         (print_stats): Output new I/O statistics.
1705         (cleanup): Do statistics after closing stdin and stdout, so that
1706         the times are more accurate.
1707         (write_output, dd_copy): Count output bytes.
1708         (main): Get initial value of clock.
1709
1710 2004-11-14  Jim Meyering  <jim@meyering.net>
1711
1712         Backslash-escape `-'s in email addresses, so that they are
1713         rendered properly in UTF-locales.
1714         * man/help2man (escape_hyphens): New function.
1715         (main): Call it on email addresses.
1716
1717         * src/sort.c (zaptemp): Mark new diagnostic for translation.
1718
1719         * tests/misc/close-stdout: New file.  Test today's closeout.c change.
1720         * tests/misc/Makefile.am (TESTS): Add close-stdout.
1721
1722 2004-11-13  Jim Meyering  <jim@meyering.net>
1723
1724         * src/test.c (usage): Put the description of `[-n] STRING'
1725         on two lines, one for `-n STRING' and one for `STRING' so that
1726         help2man properly escapes the `-'.  Otherwise, the hyphen is
1727         rendered inappropriately in UTF-8 locales.
1728         Reported by Uwe Zeisberger in http://bugs.debian.org/281069.
1729
1730 2004-11-12  Paul Eggert  <eggert@cs.ucla.edu>
1731
1732         * NEWS: Document the following changes.
1733
1734         * src/sort.c: Avoid O(N**2) behavior when there are many temporary
1735         files.
1736         (temptail): New variable, so that we can easily append to list.
1737         (create_temp_file): Create new files at end of list, so that
1738         searching the list has O(N*NMERGE) behavior instead of O(N**2).
1739         (zaptemp): Update temptail if needed.
1740         (mergefps, merge): Accept new arg that counts temp files, and keep it
1741         up to date as we create and remove temporaries.  This is for
1742         efficiency, so that we don't call zaptemp so often.
1743         All callers changed.
1744         (sort): Don't create array in reverse order, since the list of
1745         temporaries is now in the correct order.
1746
1747         (zaptemp): Protect against race condition: if 'sort' is
1748         interrupted in the middle of zaptemp, it might unlink the
1749         temporary file twice, and the second time this happens the file
1750         might already have been created by some other process.
1751
1752         (zaptemp): Warn if a temporary file is not removed.
1753
1754         (create_temp_file): Use offsetof for clarity.
1755         (die): Move it up earlier, to clean up the code a bit.
1756
1757         * src/pr.c (strtoumax): Declare if not declared.
1758         (skip_to_page, first_page_number, last_page_number, page_number,
1759         first_last_page, print_header):
1760         Use uintmax_t for page numbers.
1761         (first_last_page): Remove unnecessary forward declaration.
1762         Do not modify arg (it is now a const pointer).
1763         Return a true if successful, false (without print a diagnostic)
1764         otherwise.
1765         (main): If +XXX does not specify a valid page range, treat it
1766         as a file name.  This follows the response to Open Group XCU ERN 41
1767         <http://www.opengroup.org/sophocles/show_mail.tpl?source=L&listname=austin-group-l&id=7717>,
1768         which says the behavior is allowed.
1769         (skip_to_page): When starting page number exceeds page count,
1770         print both numbers in the diagnostic.
1771         (print_header): Detect page number overflow.
1772
1773 2004-11-07  Jim Meyering  <jim@meyering.net>
1774
1775         * src/uname.c [__APPLE__]: Include <mach/machine.h> and <mach-o/arch.h>.
1776         (main) [__APPLE__]: Get the processor type via syscall rather than
1777         hard-coding "powerpc".  From Toby Peterson.
1778
1779         * src/sort.c (merge): Remove declarations of now-unused variables.
1780
1781 2004-11-06  Paul Eggert  <eggert@cs.ucla.edu>
1782
1783         * src/sort.c (first_same_file): Remove.  Move most of the code to....
1784         (avoid_trashing_input): New function.
1785         (merge): Avoid some silly merges, e.g., copying a single file to
1786         a temporary file when there are exactly 17 input files to merge.
1787         Take a count of temporary files rather than a max_merge arg.
1788         All uses changed.
1789
1790 2004-11-06  Jim Meyering  <jim@meyering.net>
1791
1792         * src/sort.c (xfclose): Don't close stdout here (just flush it),
1793         since close_stdout now closes stdout unconditionally.
1794
1795 2004-11-05  Paul Eggert  <eggert@cs.ucla.edu>
1796
1797         * src/sort.c (inittables, sort_buffer_size, getmonth, mergefps,
1798         first_same_file, merge, sort, main): Use size_t for indexes to arrays.
1799         This fixes some unlikely havoc-wreaking bugs (e.g., more than INT_MAX
1800         temporary files).
1801         (getmonth, keycompare, compare): Rewrite to avoid need for alloca,
1802         thus avoiding unchecked stack overflow in some cases.  As a side
1803         effect this improve the performance of "sort -M" by a factor of 4
1804         on my benchmarks.
1805
1806 2004-11-03  Paul Eggert  <eggert@cs.ucla.edu>
1807
1808         * src/stty.c: Include "vasprintf.h" since we use vasprintf now.
1809
1810         * src/Makefile.am (check-AUTHORS): Don't assume \? works in a sed
1811         expression; it's not portable.  Problem reported by Albert Chin.
1812         Don't invoke a program more than once.
1813         * src/groups.sh (version): New variable, containing author info,
1814         for benefit of AUTHORS check.  Use it when acting on --version option.
1815         * AUTHORS: Remove duplicate lines.  Remove bogus "chroot:"
1816         in groups line.
1817
1818         * src/system.h: Don't #define and #undef getopt around <stdlib.h>,
1819         as this breaks the new regime that does "#define getopt rpl_getopt".
1820         Problem reported by Albert Chin for Solaris 9 with Sun cc in:
1821         http://lists.gnu.org/archive/html/bug-gnulib/2004-11/msg00019.html
1822         I suppose this may cause problems on ancient hosts with
1823         incompatible getopt declarations, but we'll cross that bridge if
1824         the problem gets reported to us by someone who can test the fix.
1825
1826 2004-11-03  Jim Meyering  <jim@meyering.net>
1827
1828         * src/tac.c: quote(...) file names in diagnostics.
1829
1830 2004-10-29  Paul Eggert  <eggert@cs.ucla.edu>
1831
1832         * NEWS: Document getdate changes.
1833
1834 2004-10-29  Jim Meyering  <jim@meyering.net>
1835
1836         * src/tac.c (tac_file): Remove temporary prototype and move this
1837         function `down' so that it precedes definition of tac_nonseekable.
1838
1839         `tac /proc/modules' would print nothing
1840         Reported by Harald Dunkel in http://bugs.debian.org/278604.
1841
1842         * src/tac.c (copy_to_temp): Renamed from save_stdin, since
1843         now it copies a general file descriptor, not just stdin.
1844         (tac_nonseekable): Renamed/adapted from tac_stdin.
1845         (tac_file): Get fd via `open' directly rather than via fopen/fileno,
1846         since we never used the stream.  Perform "-" to stdin mapping here
1847         rather than in main.  Determine whether a file is seekable,
1848         by trying to `lseek' to its end, and dispatch to tac_seekable or
1849         tac_nonseekable accordingly.
1850         (main): Rewrite argument handling now that it uses only tac_file.
1851         * NEWS: Mention it here.
1852
1853 2004-10-21  Jim Meyering  <jim@meyering.net>
1854
1855         * tests/mv/leak-fd: New file.
1856         * tests/mv/Makefile.am (TESTS): Add it.
1857         * tests/rm/dot-rel: New file.
1858         * tests/rm/Makefile.am (TESTS): Add it.
1859
1860         Correct my patch of 2004-10-18.
1861         * src/remove.c (rm): Destroy the saved_cwd here (via cwd_state),
1862         if necessary, not in remove_dir.  Otherwise, removing multiple
1863         `.'-relative nonempty directories no longer worked.
1864
1865 2004-10-20  Paul Eggert  <eggert@cs.ucla.edu>
1866
1867         * src/fmt.c (usage): Improve description of --prefix.
1868         Problem reported by Edward Welbourne.
1869
1870         * man/uniq.x: Change summary so that it doesn't imply that
1871         uniq writes to its input file.  Problem reported by
1872         Dan Jacobson.
1873
1874 2004-10-18  Jim Meyering  <jim@meyering.net>
1875
1876         Plug a leak that would cause a cross-device mv to fail when
1877         operating on too many command-line-specified nonempty directories.
1878         * src/remove.c (remove_dir): Destroy the `struct saved_cwd' on the
1879         top of the stack before returning.  This usually closes the file
1880         descriptor that was used to return to the original working directory.
1881         Reported by Cyril Bouthors in
1882         http://article.gmane.org/gmane.comp.gnu.core-utils.bugs/3048
1883         * NEWS: Mention it here.
1884
1885         * src/pathchk.c (validate_file_name): Give a more descriptive
1886         diagnostic when pathconf fails.  This also avoids an unwarranted
1887         warning from gcc-3.3.5 about a format not being a string literal.
1888
1889         * src/sleep.c (main): Remove declaration of unused local, c.
1890         * src/printenv.c (main): Likewise.
1891         * src/logname.c (main): Likewise.
1892         * src/uptime.c (main): Likewise, for optc.
1893         * src/tsort.c (main): Likewise, for opt.
1894
1895 2004-10-17  Paul Eggert  <eggert@cs.ucla.edu>
1896
1897         * AUTHORS: Add self to pathchk.
1898         * src/pathchk.c (AUTHORS): Add self.
1899         Change "path" to "file name" whenever possible.
1900         Remove usage comment, as it was a duplication of the code or doc.
1901         Include <wchar.h> if available.
1902         (mbrlen, mbstate_t) [! (HAVE_MBRLEN && HAVE_MBSTATE_T)]: Define.
1903         (NEED_PATHCONF_WRAPPER, PATH_MAX, PATH_MAX_FOR, NAME_MAX,
1904         pathconf_wrapper, portable_chars, dir_ok): Remove.
1905         (NAME_MAX_MINIMUM, PATH_MAX_MINIMUM): New macros.
1906         (pathconf, _PC_NAME_MAX, _PC_PATH_MAX): Define if nonexistent.
1907         (portable_chars_only): New arg FILELEN.
1908         Don't assume ASCII; we might be on an EBCDIC host.
1909         Don't assume unibyte locale in diagnostic.
1910         (component_start, component_len): New functions.
1911         (validate_file_name): Renamed from validate_path.  All uses changed.
1912         Pretty much a complete rewrite.
1913         Don't make copy of file arg.  Always append trailing slash to
1914         pathconf arg, just in case it's a symlink (this is pure paranoia;
1915         we don't know of any hosts where the trailing slash is required).
1916         Use size_t instead of long int when possible.
1917         Avoid need to call pathconf in most practical cases.
1918         Don't use euidaccess several times to test searchability;
1919         just use lstat once.  Reword diagnostic to put the (often very long)
1920         file names last.
1921
1922 2004-10-15  Paul Eggert  <eggert@cs.ucla.edu>
1923
1924         * src/printf.c (usage): Mention Unicode, and use H for hex digits.
1925
1926 2004-10-13  Jim Meyering  <jim@meyering.net>
1927
1928         * NEWS: Mention today's fts.c fix.
1929
1930 2004-10-13  Paul Eggert  <eggert@cs.ucla.edu>
1931
1932         * tests/stty/row-col-1: Set LC_ALL=C.
1933
1934 2004-10-12  Jim Meyering  <jim@meyering.net>
1935
1936         * src/dircolors.hin: Add .flac and .mpc as audio suffixes.
1937         From Jesus Climent in http://bugs.debian.org/276149.
1938
1939 2004-10-05  Paul Eggert  <eggert@cs.ucla.edu>
1940
1941         * src/ls.c (ignore_mode): Renamed from ignore, to avoid shadowing
1942         problems.  All uses changed.
1943
1944 2004-10-05  Jim Meyering  <jim@meyering.net>
1945
1946         * .x-sc_trailing_blank: Add an exclusion for config/texinfo.tex,
1947         since Karl says its trailing blanks are there to stay :-)
1948
1949 2004-10-04  Paul Eggert  <eggert@cs.ucla.edu>
1950
1951         * src/expr.c (NEW, OLD): Remove, partly to avoid
1952         reference to obsolescent macro XMALLOC.
1953         All uses replaced by xmalloc and free.
1954
1955 2004-09-28  Jim Meyering  <jim@meyering.net>
1956
1957         * src/tail.c (usage): Clarify: --retry works only with --follow=name.
1958         Reported by Nik A. Melchior in http://bugs.debian.org/273781.
1959
1960 2004-09-27  Paul Eggert  <eggert@cs.ucla.edu>
1961
1962         * src/od.c (format_address_paren): c is optional, so don't output
1963         it if it's '\0'.
1964
1965 2004-09-26  Paul Eggert  <eggert@cs.ucla.edu>
1966
1967         Add support for ls --hide.  Idea suggested by Bardur Arantsson.
1968         * NEWS: Document this.
1969         * src/ls.c (file_ignored): Renamed from file_interesting, with
1970         inverted return value.  Accept the file name, not a struct dirent *.
1971         All uses changed.  Avoid the expense of calling fnmatch if the
1972         file is ignorable due to leading '.'.
1973         (all_files, really_all_files): Removed; replaced by:
1974         (ignore): New variable.  All uses changed.
1975         (IGNORE_DEFAULT, IGNORE_DOT_AND_DOTDOT, IGNORE_MINIMAL, HIDE_OPTION):
1976         New constants.
1977         (hide_patterns): New variable.
1978         (long_options, decode_switches, file_ignored, usage):
1979         Add support for --hide.
1980         (patterns_match): New function.
1981         (usage): Replace "hide" with "ignore" in explanation, to avoid
1982         confusion.
1983
1984 2004-09-25  Paul Eggert  <eggert@cs.ucla.edu>
1985
1986         * src/ls.c (gobble_file, print_long_format): Don't assume that
1987         human-readable output has a byte count equal to its column width;
1988         this isn't always true in locales where the radix character is not
1989         '.' or ','.
1990         (format_user_or_group): Revamp code to match the above fix;
1991         this avoids the (very faint) possibility of integer overflow.
1992
1993 2004-09-24  Paul Eggert  <eggert@cs.ucla.edu>
1994
1995         * NEWS: Mention that "chmod -r -w x" now works as expected.
1996         * src/chmod.c (main): Revamp option processing to support this.
1997         * tests/chmod/Makefile.am (TESTS): Add 'usage'.
1998         * tests/chmod/usage: New set of tests for usage like that.
1999
2000 2004-09-24  Jim Meyering  <jim@meyering.net>
2001
2002         * Makefile.maint (CVS_LIST): Use --types=AFGM option so that
2003         it lists only cvs-controlled regular files.
2004
2005         * src/csplit.c (xalloc_die): Declare to be `extern', not `static'
2006         to avoid a warning from gcc-3.4.1.  Reported by Paul Eggert.
2007
2008 2004-09-23  Paul Eggert  <eggert@cs.ucla.edu>
2009
2010         * Makefile.maint (CVS_LIST): New macro.
2011         (sc_space_tab, sc_prohibit_atoi_atof, sc_file_system,
2012         sc_prohibit_jm_in_m4, sc_system_h_headers, sc_sun_os_names,
2013         sc_trailing_blank, po-check): Use it instead of the
2014         nonstandard "cvsu --list".
2015
2016         * src/tail.c (parse_obsolete_option): Bring back support
2017         for obsolete option followed by non-obsolete, or by more
2018         than one file.  When obsolete, conform to SUSv2 rather than
2019         original POSIX 1003.2-1992, as SUSv2 corrected the case of
2020         "tail -c".  Add support for the SUSv2 "b" modifier.
2021         * NEWS: Mention the above.
2022         * tests/tail/Test.pm: New test case obs-b to check the above.
2023         err-[134] no longer need _POSIX2_VERSION=199209.
2024         Fix comments to match revised behavior.
2025
2026 2004-09-22  Jim Meyering  <jim@meyering.net>
2027
2028         * Use automake-1.9.2.  Regenerate dependent files.
2029
2030         * src/remove.c (struct dirstack_state) [current_arg_jumpbuf]:
2031         Improve the comment.
2032
2033         Clean up scoping etc. so that some make `distcheck' tests pass.
2034         * src/csplit.c (xalloc_die): Declare to be static.
2035         * src/chown-core.c (chown_files): Declare as `extern'.
2036         * src/cp-hash.c (remember_created): Likewise.
2037         * src/copy.c (copy): Likewise.
2038         * src/checksum.h (enum) [ALG_MD5]: Define to be 1, not 0.
2039
2040         * src/id.c, src/nl.c, src/expand.c: Remove trailing blanks.
2041         * src/unexpand.c: Likewise.
2042
2043         * src/Makefile.am (check-AUTHORS): New rule.
2044         (check): Depend on it.
2045         * AUTHORS: Update.
2046
2047         * Makefile.maint (syntax-check-rules): Remove duplicate sc_tight_scope.
2048         (sc_system_h_headers): Also exclude copy.h; it includes <stdbool.h>.
2049
2050 2004-09-22  Paul Eggert  <eggert@cs.ucla.edu>
2051
2052         * src/ls.c (decode_switches): Don't compare a short value
2053         to SIZE_MAX: GCC sometimes complains.
2054
2055 2004-09-21  Paul Eggert  <eggert@cs.ucla.edu>
2056
2057         * NEWS: The following commands now reject unknown options:
2058         basename dirname factor hostname link nohup sync unlink yes
2059         Also, pathchk no longer accepts trailing options.
2060
2061         * src/basename.c: Include <getopt.h>.
2062         * src/chroot.c: Likewise.
2063         * src/dirname.c: Likewise.
2064         * src/factor.c: Likewise.
2065         * src/hostid.c: Likewise.
2066         * src/hostname.c: Likewise.
2067         * src/nohup.c: Likewise.
2068         * src/pwd.c: Likewise.
2069         * src/setuidgid.c: Likewise.
2070         * src/sync.c: Likewise.
2071
2072         * src/basename.c (main): Reject unknown options.
2073         * src/dirname.c (main): Likewise.
2074         * src/factor.c (main): Likewise.
2075         * src/hostid.c (main): Likewise.
2076         * src/hostname.c (main): Likewise.
2077         * src/link.c (main): Likewise.
2078         * src/nohup.c (main): Likewise.
2079         * src/pwd.c (main): Likewise.
2080         * src/setuidgid.c (main): Likewise.
2081         * src/sync.c (main): Likewise.
2082         * src/unlink.c (main): Likewise.
2083         * src/yes.c (main): Likewise.
2084
2085         * src/cat.c (main): Remove unused "case 0".
2086         * src/chgrp.c (main): Likewise.
2087         * src/chmod.c (main): Likewise.
2088         * src/chown.c (main): Likewise.
2089         * src/comm.c (main): Likewise.
2090         * src/cp.c (main): Likewise.
2091         * src/csplit.c (main): Likewise.
2092         * src/cut.c (main): Likewise.
2093         * src/date.c (main): Likewise.
2094         * src/df.c (main): Likewise.
2095         * src/du.c (main): Likewise.
2096         * src/env.c (main): Likewise.
2097         * src/expand.c (main): Likewise.
2098         * src/fold.c (main): Likewise.
2099         * src/head.c (main): Likewise.
2100         * src/id.c (main): Likewise.
2101         * src/install.c (main): Likewise.
2102         * src/join.c (main): Likewise.
2103         * src/ln.c (main): Likewise.
2104         * src/ls.c (decode_switches): Likewise.
2105         * src/mkdir.c (main): Likewise.
2106         * src/mkfifo.c (main): Likewise.
2107         * src/mknode.c (main): Likewise.
2108         * src/mv.c (main): Likewise.
2109         * src/nl.c (main): Likewise.
2110         * src/paste.c (main): Likewise.
2111         * src/pinky.c (main): Likewise.
2112         * src/pr.c (main): Likewise.
2113         * src/ptx.c (main): Likewise.
2114         * src/readlink.c (main): Likewise.
2115         * src/rm.c (main): Likewise.
2116         * src/rmdir.c (main): Likewise.
2117         * src/seq.c (main): Likewise.
2118         * src/shred.c (main): Likewise.
2119         * src/split.c (main): Likewise.
2120         * src/sum.c (main): Likewise.
2121         * src/tac.c (main): Likewise.
2122         * src/tail.c (main): Likewise.
2123         * src/tee.c (main): Likewise.
2124         * src/touch.c (main): Likewise.
2125         * src/tr.c (main): Likewise.
2126         * src/tty.c (main): Likewise.
2127         * src/uname.c (main): Likewise.
2128         * src/unexpand.c (main): Likewise.
2129         * src/wc.c (main): Likewise.
2130         * src/who.c (main): Likewise.
2131
2132         * src/chroot.c (main): Use getopt where it suffices, not getopt_long.
2133         * src/cksum.c (main): Likewise.
2134         * src/dd.c (main): Likewise.
2135         * src/logname.c (main): Likewise.
2136         * src/printenv.c (main): Likewise.
2137         * src/sleep.c (main): Likewise.
2138         * src/tsort.c (main): Likewise.
2139         * src/uptime.c (main): Likewise.
2140         * src/users.c (main): Likewise.
2141         * src/whoami.c (main): Likewise.
2142
2143         * src/du.c (long_options): Standardize on NULL vs 0.
2144         * src/rm.c (long_opts): Likewise.
2145
2146         * src/logname.c (long_options): Remove.
2147         * src/printenv.c (long_options): Likewise.
2148         * src/sleep.c (long_options): Likewise.
2149         * src/tsort.c (long_options): Likewise.
2150         * src/uptime.c (longopts): Likewise.
2151         * src/users.c (longopts): Likewise.
2152         * src/whoami.c (long_options): Likewise.
2153
2154         * src/pathchk.c (longopts): Add --help, --version.
2155         (main): Use longopts rather than parse_long_options.
2156         * src/stty.c (longpts, main): Likewise.
2157
2158         * src/pathchk.c (main): Don't reorder arguments, so that
2159         we can check weird file names.
2160
2161         * src/readlink.c: Don't include "long-options.h".
2162         * src/sort.c: Likewise.
2163         * src/stty.c: Likewise.
2164
2165         * src/split.c (verbose): Now bool, not int.
2166         (VERBOSE_OPTION): New enum.
2167         (longopts, main): Use it.
2168
2169         * tests/factor/basic: Adjust to new wording in diagnostic
2170         that results from the above changes.
2171
2172 2004-09-21  Jim Meyering  <jim@meyering.net>
2173
2174         * man/rm.x: Say "the response is affirmative" rather than "the
2175         response begins with y or Y", so that the documentation is
2176         accurate in non-English locales.  Problem reported by Munzir Taha.
2177
2178 2004-09-19  Paul Eggert  <eggert@cs.ucla.edu>
2179
2180         * src/echo.c (main): Don't pass NULL to strcmp when
2181         POSIXLY_CORRECT and given no arguments.
2182
2183         * src/md5sum.c (STRING_OPTION): Remove.
2184         (long_options, main): Remove support for undocumented and
2185         obsolete --string option, as suggested in the 1996-09-26 patch.
2186         * NEWS: Document this.
2187
2188         * tests/rm/fail-eperm: Don't try to remove writeable files in a
2189         sticky /tmp directory, as SVR4-like systems (e.g., Solaris 9) let
2190         you remove such files.  Problem reported by Bert Fischer in:
2191         http://lists.gnu.org/archive/html/bug-coreutils/2004-09/msg00074.html
2192
2193 2004-09-18  Paul Eggert  <eggert@cs.ucla.edu>
2194
2195         * src/md5sum.c (STATUS_OPTION, STRING_OPTION): New enums.
2196         (long_options, main): Use them instead of magic numbers 2 and 1.
2197         For --string, optarg can't possibly be NULL.
2198
2199         * src/dd.c (usage): Distinguish between options and operands.
2200         (scanargs): Don't mess with argc, argv; getopt_long handles this now.
2201         Say "operands" for operands, not "options".
2202         (main): Use getopt_long, so that "dd --" works as POSIX requires.
2203         * tests/dd/misc: Check for "dd --".
2204
2205         * src/chroot.c (main): Reject unknown options instead of
2206         interpreting them as a directory to chroot to.
2207
2208         * src/cksum.c: Remove obsolete comment about POSIX 1003.2/D11.2.
2209         The current standard (POSIX 1003.1-2004) is correct.
2210         (crc_remainder) [defined CRCTAB]: Renamed from "remainder" to avoid
2211         collision with builtin function.
2212         (main) [defined CRCTAB]: Output in lowercase hexadecimal, and
2213         output the first 0 as 8 digits, to make it easier to compare to
2214         the text of the standard.  Output crctab to be a const array.
2215         (crctab): Use result of above changes.
2216         (long_options): Remove; not needed if empty.
2217         (main): getopt_long can't return 0 here, so simplify the code.
2218
2219 2004-09-13  Jim Meyering  <jim@meyering.net>
2220
2221         * src/Makefile.am (localedir.h): Don't redirect directly to target.
2222
2223 2004-09-13  Paul Eggert  <eggert@cs.ucla.edu>
2224
2225         * src/id.c (print_full_info): Don't exit with failure status simply
2226         because a user or group number can't be turned into a name.
2227         Problem reported by Felipe Kellermann in:
2228         http://lists.gnu.org/archive/html/bug-coreutils/2004-09/msg00081.html
2229
2230 2004-09-12  Jim Meyering  <jim@meyering.net>
2231
2232         * Makefile.maint (my-distcheck): When building with -Werror, also
2233         require -Wshadow.
2234
2235 2004-09-10  Paul Eggert  <eggert@cs.ucla.edu>
2236
2237         * NEWS: "tail" now handles obscure POSIX 1003.2-1992 cases better.
2238         * src/tail.c (parse_obsolete_option): Renamed from
2239         parse_obsolescent_option, since the options are obsolete now.
2240         Remove bool *arg; just exit if there's an error.  Revamp to follow
2241         POSIX 1003.2-1992 more precisely, to handle cases like "tail -
2242         file" and "tail -10 -- file" correctly when we are conforming to
2243         the older standard.
2244         (main): Adjust to this change.
2245         * tests/tail/Test.pm (test_vector): minus-* requires
2246         _POSIX2_VERSION=199209 now, to work correctly if there is
2247         an input file.  err-1 and err-3 no longer errors if there
2248         is another file.
2249
2250 2004-09-09  Paul Eggert  <eggert@cs.ucla.edu>
2251
2252         * src/test.c (usage): Document -r, -w, -x more carefully.
2253
2254 2004-09-08  Paul Eggert  <eggert@cs.ucla.edu>
2255
2256         * src/test.c (usage): Document "test" (with no args) and "[ ]".
2257         Document that -h and -L don't dereference.
2258
2259         * NEWS: Document that "tr xy -z" now works as per POSIX.
2260         Sort the descriptions.
2261         * src/tr.c (main): Don't reorder options.
2262         * tests/tr/Test.pm (fowler-1): New test case.
2263
2264 2004-09-06  Paul Eggert  <eggert@cs.ucla.edu>
2265
2266         * src/touch.c (main): Fix POSIX-conformance bug: "touch --
2267         MMDDhhmm file" must be treated like "touch MMDDhhmm file" when
2268         conforming to pre-2001 POSIX.
2269         * NEWS: Document this.
2270         * tests/touch/obsolescent: Test for this bug.  Also, set
2271         _POSIX2_VERSION=199209 and POSIXLY_CORRECT=1 so that it's
2272         a better test for obsolescent features.
2273
2274         * src/sort.c (main): Emulate Solaris 8 and 9 "sort -y", so that
2275         "sort -y abc" is like "sort abc" whereas "sort -y 100" is like
2276         plain "sort".
2277
2278         * src/od.c: Several changes for POSIX and FreeBSD compatibility.
2279         (COMMON_SHORT_OPTIONS): Add -B, -D, -e, -F, -H, -I, -L, -O, -s, -X.
2280         (long_options, main): --strings is now -S, not -s.
2281         (usage): Reflect the usage changes.
2282         (parse_old_offset): Do not issue a diagnostic on failure;
2283         callers now do this as necessary.
2284         (main): Support POSIX syntax.  Remove unused case 0 from getopt_long.
2285         Add support for new short options (many undocumented) for
2286         compatibility with FreeBSD.  Remove FIXME for -s; it's now
2287         POSIX-compatible.  Default format is now oS, not o2.
2288         * NEWS: Describe the above.
2289
2290 2004-09-05  Paul Eggert  <eggert@cs.ucla.edu>
2291
2292         * src/stty.c (valid_options): Remove.
2293         (main): Fix some bugs in handling invalid option-combinations
2294         like "stty -F".
2295         (recover_mode): Arg is now char const *, not char *.
2296         (main): Use STDIN_FILENO, not 0.
2297         Simplify option-parsing code a tad.
2298         * tests/stty/basic-1: Check for the fixed bugs.
2299
2300 2004-09-03  Paul Eggert  <eggert@cs.ucla.edu>
2301
2302         * src/stat.c (HAVE_STRUCT_STATXFS_F_TYPE): Fix typo that prevented
2303         it from ever being nonzero.  Reported by Pozsar Balazs in:
2304         http://lists.gnu.org/archive/html/bug-coreutils/2004-08/msg00189.html
2305         (human_fstype): Add ramfs, squashfs, sysfs.
2306         Reported by Pozsar Balazs in:
2307         http://lists.gnu.org/archive/html/bug-coreutils/2004-08/msg00188.html
2308         (human_fstype): Return char const *, not char *.
2309         Simplify internals a bit, and avoid casts.
2310
2311         * src/dd.c (usage): "alternated EBCDIC" -> "alternate EBCDIC".
2312         (bit_count): Remove.  All uses changed to....
2313         (multiple_bits_set): New function.
2314         (scanargs): Use it, and check separately for each set of
2315         incompatible options, to improve diagnostics.
2316         (MX): Remove.
2317         (apply_translations): Move checks for incompatible options
2318         to scanargs, so that they're done consistently.
2319
2320 2004-09-02  Paul Eggert  <eggert@cs.ucla.edu>
2321
2322         Output correct errno-related diagnostic on "paste" I/O errors.
2323         * src/paste.c (write_error, xputchar): New functions.
2324         (paste_parallel): Use correct errno value after input error.
2325         (paste_parallel, paste_serial): Report errno value after output error.
2326
2327         Port to diet libc.  Problem reported by Felix von Leitner in:
2328         http://lists.gnu.org/archive/html/bug-coreutils/2004-08/msg00171.html
2329         * src/paste.c (dummy_closed, CLOSED, dummy_endlist, ENDLIST): Remove;
2330         it's not portable C to assume FILE is a complete type.
2331         (paste_parallel): Use index test instead of ENDLIST, and NULL
2332         instead of CLOSED.
2333
2334 2004-08-24  Paul Eggert  <eggert@cs.ucla.edu>
2335
2336         POSIX-conformance fixes for "expand" and "unexpand".
2337         Also, consistently use "tab stop" rather than "tabstop".
2338         * NEWS: Document fixes.
2339         * src/expand.c: Revamp to resemble the new unexpand.c better.
2340         (usage): -i does not convert tabs after non-tabs.
2341         (add_tab_stop): Renamed from add_tabstop.  All uses changed.
2342         (parse_tab_stop): Renamed from parse_tabstop.  All uses changed.
2343         (validate_tab_stop): Renamed from validate_tabstop.  All uses changed.
2344         (next_file, main): Check fclose against 0, not EOF.
2345         (expand): Remove unnecessary casts.
2346         Add another loop nesting level, for lines, so that per-line variables
2347         are initialized cleanly.
2348         Revamp tab checking.  Check for write error immediately, rather
2349         than just once at the end of the program.
2350         * src/unexpand.c: Lkewise (for the expand.c changes).
2351         (TAB_STOP_SENTINEL): Remove.
2352         (tab_size): Now size_t, not uintmax_t, since we need to store
2353         the sequences of blanks.
2354         (max_column_width): New var.
2355         (usage): Say "blank" where POSIX requires this.
2356         (add_tab_stop): Calculate maximum column width.
2357         (unexpand): Store the pending blanks, instead of merely counting them.
2358         Follow POSIX's rules about -a requiring two blanks before a tab stop.
2359         Get rid of internal label and goto.
2360         * tests/unexpand/basic-1: Fix infloop-3 to match POSIX.
2361         Add blanks-1 through blanks-13.
2362
2363 2004-08-19  Paul Eggert  <eggert@cs.ucla.edu>
2364
2365         * NEWS: "chown : file", "chown '' file", and "chgrp '' file" now
2366         succeed without changing the uid and gid, like FreeBSD.
2367         * src/chgrp.c (parse_group): Return gid_t rather than storing it
2368         through a pointer.  Treat "chgrp '' file" as a no-op change,
2369         as FreeBSD does.
2370         (main): Set chopt.group_name to NULL if the group is the empty
2371         string.
2372         * src/chown-core.c (describe_change): Describe changes to -1:-1
2373         without using "to OWNERSHIP" phrase.
2374         * src/chown.c (usage): "chown '' file" is now allowed.
2375         (main): Do not set user name to the empty string if the group
2376         name is null.
2377         * tests/chgrp/basic: Test "chgrp '' file".
2378         * tests/chown/Makefile.am (TESTS): Add separator.
2379         * tests/chown/separator: New file, partly taken from
2380         Dmitry V. Levin's suggestion in
2381         <http://lists.gnu.org/archive/html/bug-coreutils/2004-08/msg00102.html>
2382
2383 2004-08-11  Paul Eggert  <eggert@cs.ucla.edu>
2384
2385         * tests/install/basic-1: Test for the -d regression.
2386
2387 2004-08-11  Dmitry V. Levin  <ldv@altlinux.org>
2388
2389         * src/install.c (main): Fix -d regression introduced with
2390         --target-directory support at 2004-06-25.
2391
2392 2004-08-11  Paul Eggert  <eggert@cs.ucla.edu>
2393
2394         * src/copy.c (copy_internal): When preserving links, unlink
2395         a destination with link count greater than one.  This is so
2396         that commands like "cp -a" don't get confused when copying into
2397         a destination that already contains many hard links.  Problem
2398         reported by Tim Waugh in:
2399         http://lists.gnu.org/archive/html/bug-coreutils/2004-08/msg00053.html
2400
2401 2004-08-10  Paul Eggert  <eggert@cs.ucla.edu>
2402
2403         Convert all files to UTF-8.
2404         * tests/fmt/basic (8-bit-pfx): Use UTF-8, not Latin-1.
2405         * tests/sort/Test.pm (16a): Likewise.
2406         * tests/uniq/Test.pm (8): Likewise.
2407         * tests/misc/printf-hex: Use ASCII, not Latin-1.
2408
2409         * NEWS: Document "sort -o -" and "tee -" POSIX-conformance fixes.
2410         * src/shred.c (usage): "-" is an operand, not an option.
2411         * src/sort.c (die, xfopen, mergefps, first_same_file, merge):
2412         A null file arg means standard output.
2413         (main): "-o -" means to write to a file named "-",
2414         not to standard output.
2415         * src/tee.c (usage, tee): "tee -" writes to standard output, not
2416         to a file named "-".
2417
2418 2004-08-10  Dmitry V. Levin  <ldv@altlinux.org>
2419
2420         * src/install.c (change_timestamps): Fix int->bool conversion
2421         bugs introduced on 2004-07-29.
2422
2423 2004-08-09  Paul Eggert  <eggert@cs.ucla.edu>
2424
2425         * src/shred.c (wipename): Work even if the directory is writeable
2426         and not readable.  Prefer write access, since this should work
2427         better with fdatasync.
2428
2429         * src/csplit.c (xalloc_die): New function.
2430         (main): Remove now-obsolete initialization of xalloc_fail_func.
2431
2432         * src/md5sum.c: Adjust to sha->sha1 renaming.
2433
2434 2004-08-08  Dmitry V. Levin  <ldv@altlinux.org>
2435
2436         Minor code cleanup.
2437         * src/readlink.c (canonicalize_fname): Remove unneeded proxy function.
2438         (can_mode): Make variable local.
2439
2440 2004-08-07  Paul Eggert  <eggert@cs.ucla.edu>
2441
2442         * src/system.h (O_BINARY) [!O_BINARY && defined O_BINARY]:
2443         Do not define, to avoid annoying compiler messages on QNX 6.3.
2444         Problem reported by Johan in:
2445         http://lists.gnu.org/archive/html/bug-coreutils/2004-08/msg00050.html
2446
2447 2004-08-04  Paul Eggert  <eggert@cs.ucla.edu>
2448
2449         * src/system.h (PRIdMAX, PRIoMAX, PRIuMAX, PRIxMAX):
2450         Define to a concatenation of string literals, not to an expression;
2451         needed for concatenation contexts.
2452         (INTMAX_MAX, INTMAX_MIN): New macros.
2453
2454         * src/stat.c (print_stat): Don't assume st_ino / st_dev fits in
2455         unsigned long; this isn't true for st_ino on Solaris 9.
2456
2457 2004-08-03  Paul Eggert  <eggert@cs.ucla.edu>
2458
2459         * src/uname.c: Do not depend on HAVE_SYSCTL when deciding
2460         whether to include files.  Include <sys/param.h> if
2461         HAVE_SYS_PARAM_H (not HAVE_SYSCTL).
2462         (main) [defined __POWERPC__]: Add a kludge to work around a
2463         Mac OS X bug, so that uname -p defaults to "powerpc" if
2464         sysctl ((int[]) {CTL_HW, HW_MACHINE_ARCH}, 2, buffer, &bufsize, 0, 0)
2465         fails.  Problem reported by Petter Reinholdtsen in:
2466         http://lists.gnu.org/archive/html/bug-gnu-utils/2003-02/msg00201.html
2467
2468         * src/uniq.c (hard_LC_COLLATE, ignore_case, different, check_file,
2469         main): Use bool for booleans.
2470         (writeline, check_file): Use uintmax_t for line counts.
2471         (check_file): Check for and report line number overflow,
2472         when that matters.
2473         * src/wc.c (iswspace, wc): Use to_uchar rather than a cast.
2474         (print_lines, print_words, print_chars, print_bytes, print_linelength,
2475         have_read_stdin, wc, wc_file, main):
2476         Use bool for booleans.
2477         (exit_status): Remove.
2478         (wc, wc_file): Return bool status.  All callers changed.
2479         * src/who.c (scan_entries): 0 -> STDIN_FILENO.
2480         * src/whoami.c (main): Print uids using unsigned long int, not
2481         unsigned int.
2482
2483         * src/unexpand.c: Int cleanup and minor reorganization to be more
2484         like src/expand.c.
2485         Include quote.h, xstrndup.h.
2486         (TAB_STOP_SENTINEL): Increase from INT_MAX to INTMAX_MAX.
2487         (convert_entire_line, have_read_stdin, parse_tabstops, next_file,
2488         unexpand, main):
2489         Use bool for booleans.
2490         (tab_size, tab_list, add_tabstop, validate_tabstops, unexpand):
2491         Use uintmax_t for column counts.
2492         (first_free_tab, validate_tabstops, unexpand): Use size_t for sizes.
2493         (add_tabstop, parse_tabstops, main): Don't reserve UINTMAX_MAX
2494         as a tab stop.
2495         (parse_tabstops): Don't use ISBLANK on possibly-signed char.
2496         Detect overflow in tab stop string.
2497         (next_file, main): Use EXIT_FAILURE/EXIT_SUCCESS instead of 1/0.
2498         (unexpand): Concatenate input files the same way expand does.
2499
2500         * src/touch.c (no_create, use_ref, posix_date, amtime_now,
2501         touch, main): Use bool for booleans.
2502         (main): Avoid integer overflow when given more than INT_MAX
2503         options.
2504         * src/tsort.c (struct item, n_strings): Use size_t for sizes.
2505         (have_read_stdin, count_items, scan_zeros, detect_loop,
2506         recurse_tree, walk_tree, tsort, main):
2507         Use bool for booleans.
2508         (exit_status): Remove.
2509         (tsort): Return a success flag instead of storing into a global.
2510         (main): Use it.
2511         * src/tty.c (silent, main): Use bool for booleans.
2512         (main): 0 -> STDIN_FILENO.
2513         * src/uname.c (print_element): Use bool for booleans.
2514
2515         * src/test.c (TRUE, FALSE, SHELL_BOOLEAN, TRUTH_OR, TRUTH_AND):
2516         Remove.  All uses replaced by C99 boolean primitives.
2517         (TEST_TRUE, TEST_FALSE): New constants, for readability.
2518         (test_unop, binop, unary_operator, binary_operator, two_arguments,
2519         three_arguments, posixtest, expr, term, and, or, is_int, age_of,
2520         one_argument, main): Use bool for booleans.
2521         (advance, unary_advance): Now inline procedures rather than a macros.
2522         (is_int): Renamed from isint, to avoid namespace clash with ctype.h.
2523         (term, and, or): When it's easy, loop instead of recursing.
2524         (term): Avoid integer overflow if there are INT_MAX-3 args (!).
2525         (binary_operator, unary_operator): Simplify by systematically rewriting
2526         true==FOO to FOO (where FOO is a boolean).
2527         (unary_operator): Don't consider a file to be a regular file
2528         merely because its mode&S_IFMT is zero.  Just use S_ISREG.
2529         Remove unnecessary casts.  Remove ifdefs for things like
2530         S_ISSOCK that are no longer needed, since stat-macros.h always
2531         defines them now.
2532
2533         * src/tac-pipe.c (buf_init_from_stdin, find_bol, tac_mem):
2534         Use bool for booleans.
2535         (buf_init_from_stdin, buf_free, find_bol, print_line):
2536         Use size_t for sizes.
2537         * src/tac.c (separator_ends_record, tac_seekable, tac_file,
2538         tac_stdin, tac_stdin_to_mem, main): Use bool for booleans.
2539         (match_length, G_buffer_size, tac_seekable, main): Use size_t for sizes.
2540         (tac_seekable): Use ptrdiff_t for pointer subtraction.
2541         Report an error if the result is out of range.
2542         (tac_seekable, main): Check for integer overflow in buffer size
2543         calculations.
2544         (main): Remove unnecessary casts.
2545
2546         * src/su.c (run_shell): Pass a new n_additional_args arg, so that
2547         the callee doesn't have to count 'em.  All callers changed.
2548         Don't allocate more space for the arg vector than we'll need.
2549         Use memcpy to copy the args rather than rolling our own loop.
2550         Use size_t for sizes.
2551         (fast_startup, simulate_login, change_environment, log_su,
2552         correct_password, restricted_shell, main): Use bool for booleans.
2553         (longopts): Don't assume change_environment is an int.
2554         Use NULL, not 0, for pointers.
2555         (xsetenv): New function, replacing xputenv and concat.
2556         All callers changed.
2557         (elements): Remove; no longer needed.
2558         (log_su, correct_passwd, main): Prefer !x to x==NULL.
2559         (log_su): 2 -> STDERR_FILENO.
2560         (modify_environment, main): Don't assume that getenv's returned value
2561         has an indefinite lifetime.
2562         (modify_environment): Allocate a larger environ.
2563         (main): Remove an impossible 'case 0'; if it happens now, it'll
2564         get diagnosed.  Don't assume getpwnam results outlive endpwent.
2565         Check for null or empty pw_name, pw_dir and for null pw_passwd.
2566
2567         * src/stty.c (VA_START): Remove.  All callers now use va_start.
2568         (_POSIX_VDISABLE): Remove unnecessary cast.
2569         (struct control_info, visible): Use cc_t for control chars.
2570         (struct control_info): Use size_t for sizes.
2571         (recover_mode, set_mode, display_speed, display_window_size,
2572         valid_options, main, display_changed):
2573         Use bool for booleans.
2574         (integer_arg): Return unsigned long int, not long int.
2575         Accept new max arg; all callers changed, to specify a maximum
2576         value for integer parameters instead of silently overflowing.
2577         (wrap): Do not overrun the stack buffer if the output contains
2578         more than 1024 bytes.  Instead, malloc a buffer.
2579         (main): Remove a "what is this?!?" FIXME.  Nobody knows what it is.
2580         Remove unnecessary casts.
2581         (set_control_char): Allow int values only up to cc_t range.
2582         (screen_columns): Don't reject INT_MAX.
2583         (display_changed, display_all, display_speed, recover_mode):
2584         Don't assume cc_t fits in int.
2585
2586         * src/remove.h: Add copyright notice.
2587         (struct rm_options): Use bool for booleans.
2588         * src/rmdir.c (empty_paths, ignore_fail_on_non_empty, verbose,
2589         errno_rmdir_non_empty, remove_parents, main): Likewise.
2590         * src/sum.c (have_read_stdin, bsd_sum_file, sysv_sum_file,
2591         main): Likewise.
2592         (main): Don't dump core if invoked with argv[0]==NULL.
2593         * src/tee.c (tee, append, ignore_interrupts, main, tee):
2594         Use bool for booleans.
2595         (tee): Use ssize_t for read returns.
2596
2597         * src/ptx.c: Add a FIXME mentioning that there are many
2598         unchecked integer overflows in this file.
2599         (gnu_extensions, auto_reference, input_reference, right_reference,
2600         ignore_case, initialize_regex, fix_output_parameters,
2601         output_one_roff_line, output_one_text_line, output_one_dumb_line, main):
2602         Use bool for booleans.
2603         (SKIP_SOMETHING, compare_words, digest_break_file,
2604         find_occurs_in_text, fix_output_parameters):
2605         Use to_uchar instead of a caset.
2606         (print_field): Rewrite to avoid cast.
2607
2608         * src/printf.c (posixly_correct): Use bool for booleans.
2609         (verify, main): Use EXIT_FAILURE/EXIT_SUCCESS instead of 1/0.
2610         (STRTOX): Rewrite to avoid casts.
2611         (print_esc_char): Arg is char, not int.
2612         * src/readlink.c (canonicalize): Remove.  All uses now merely inspect
2613         can_mode.
2614         (no_newline, verbose): Use bool for booleans.
2615         (can_mode): Now of type int; use -1 to denote otherwise-uninitialized.
2616         * src/shred.c (struct Options, main): Use bool for booleans.
2617         (isaac_seed_data, fillpattern, wipefile): Rewrite to avoid casts.
2618         * src/split.c (cwrite, bytes_split, lines_split, line_bytes_split):
2619         Use bool for booleans.
2620         * src/stat.c (G_fail): Remove.
2621         (print_statfs): Print various gotta-be-nonnegative values using
2622         unsigned long int, not long int or int.
2623         (do_statfs, do_stat): Return a boolean success flag.
2624         (do_stat, main): Use bool for booleans.
2625
2626         * src/pr.c: Add a FIXME mentioning that there are many
2627         unchecked integer overflows in this file.
2628         (TRUE, FALSE): Remove.  All uses replaced by true and false.
2629         (struct COLUMN, read_line, print_page, print_stored, open_file,
2630         skip_to_page, init_fps, parallel_files, align_empty_cols,
2631         empty_line, FF_only, explicit_columns, extremities, keep_FF,
2632         print_a_FF, print_a_header, use_form_feed, have_read_stdin,
2633         print_across_flag, storing_columns, balance_columns,
2634         truncate_lines, join_lines, untabify_input, failed_opens,
2635         numbered_lines, skip_count, use_esc_sequence, use_cntrl_prefix,
2636         double_space, ignore_failed_opens, use_col_separator,
2637         pad_vertically, last_line, main, init_parameters, skip_read,
2638         read_line, print_stored):
2639         Use bool for booleans.
2640         (struct COLUMN, char_to_clump, store_char, print_char):
2641         Use char for chars.
2642         (clump_buff, print_clump): Use char[], not int[], for an array whose
2643         elements are always chars.
2644         (first_last_page, main, getoptarg, balance, add_line_number,
2645         char_to_uclump): Remove unnecessary casts.
2646         (init_parameters): Allocate chars, not ints, for clump_buff.
2647         (print_char): Use to_uchar before invoking ISPRINT.
2648         (char_to_clump): Convert to unsigned char before invoking ISPRINT.
2649
2650         * src/nohup.c (main): Use bool for booleans.
2651         * src/paste.c (paste_parallel, paste_serial, main): Likewise.
2652         * src/pathchk.c (validate-path, main, portable_chars_only): Likewise.
2653         (portable_chars_only): Use to_uchar rather than a cast.
2654         * src/printenv.c (main): Use bool for booleans.
2655         Do not assume that the environ has at most one matching entry
2656         for each option (integer overflow was possible otherwise).
2657
2658         * src/od.c (FMT_BYTES_ALLOCATED): Now an enum, not a decimal
2659         constant.  Do not assume PRIdMAX etc. are strings of length 3 or
2660         less.
2661         (struct tspec): Use it.  fmt_string is now an array, not
2662         a pointer, as there's little point to the indirection here.
2663         (struct tspec, flag_dump_strings,
2664         traditional, flag_pseudo_start, limit_bytes_to_format,
2665         abbreviate_duplicate_blocks, have_read_stdin, simple_strtoul,
2666         decode_one_format, open_next_file, check_and_close,
2667         decode_format_string, skip, write_block, read_char, read_block,
2668         parse_old_offset, dump, dump_strings, main):
2669         Use bool for booleans.
2670         (struct tspec): Use void *, not char *, for generic pointers.
2671         (bytes_to_oct_digits, bytes_to_signed_dec_digits,
2672         bytes_to_unsigned_dec_digits, bytes_to_hex_digits):
2673         Use char, not unsigned int, since char suffices.
2674         (print_s_char, print_char, print_s_short, print_short,
2675         print_int, print_long, print_long_long, print_float,
2676         print_double, print_long_double): Rewrite to avoid casts.
2677         These now take void * arguments, instead of char *.
2678         Use the same body for all functions, except for the choice
2679         of type.  Assume C89 to simplify handling of signed char.
2680         (dump_hexl_mode_trailer, print_named_ascii, print_ascii):
2681         Rewrite to avoid casts.
2682         (print_named_ascii, print_ascii): Now takes void *, not char *.
2683         (decode_one_format): Use int for printf field widths, not
2684         unsigned int.  Pass void * to subsidiary printers,
2685         not char *.  Simplify handling of floating-point formats
2686         by factoring out common code dealing with precision and field width.
2687         (decode_format_string): Avoid need for temporary copy of
2688         each decoded struct tspec.
2689         (get_lcm): Remove unnecessary cast.
2690         (main): Fix bug where more than INT_MAX failed decodes were ignored.
2691
2692 2004-08-02  Paul Eggert  <eggert@cs.ucla.edu>
2693
2694         * src/nl.c (TRUE, FALSE): Remove; all uses changed to true, false.
2695         (enum number_format): Remove.
2696         (FORMAT_RIGHT_NOLZ, FORMAT_RIGHT_LZ, FORMAT_LEFT): Now strings,
2697         not enum values.
2698         (DEFAULT_SECTION_DELIMITERS): Now an array constant, not a macro.
2699         (section_del): Now const.
2700         (print_fmt): Remove.
2701         (starting_line_number, page_incr, blank_join, line_no,
2702         print_lineno, proc_text, main):
2703         Use intmax_t for line numbers.
2704         (reset_numbers, have_read_stdin, build_type_arg, nl_file, main):
2705         Use bool for booleans.
2706         (lineno_format): Now a string, not an enum value.
2707         (build_print_fmt): Remove.  All calls removed.  This work is
2708         now done within print_lineno.
2709         (build_type_arg): Use size_t for sizes.
2710         (print_lineno): Check for line number overflow.
2711         (proc_text, main): Remove unnecessary cast.
2712
2713         * src/ln.c (symbolic_link, interactive, remove_existing_files,
2714         verbose, hard_dir_link, dereference_dest_dir_symlinks,
2715         do_link, main): Use bool for booleans.
2716
2717         * src/ls.c (struct fileinfo, file_interesting,
2718         extract_dirs_from_files, color_symlink_as_referent,
2719         FILE_OR_LINK_MODE, sort_reverse, print_owner, print_group,
2720         numeric_ids, print_block_size, dired, print_with_color,
2721         check_symlink_color, print_inode, recursive, immediate_dirs,
2722         all_files, really_all_files, qmark_funny_chars,
2723         print_dir_name, format_needs_stat, format_needs_type, visit_dir,
2724         main, decode_switches, parse_ls_color, print_dir, file_interesting,
2725         gobble_file, make_link_path, basename_is_dot_or_dotdot,
2726         extract_dirs_from_files, print_long_format):
2727         Use bool for booleans.
2728         (dir_defaulted): Remove; no longer needed.
2729         (main): Use int to count files, since it suffices for argv.
2730         Rewrite to avoid need for dir_defaulted.
2731         (main, print_dir, gobble_file, get_link_name,
2732         xstrcoll):
2733         Set exit status to EXIT_SUCCES/EXIT_FAILURE rather than 0/1.
2734         (decode_switches): Put back check for ws.ws_col <= SIZE_MAX.
2735         Remove unnecessary cast to int.  Use int instead of unsigned
2736         int to count from 0 to 1.
2737         (get_funky_string, print_type_indicator): Use char for bytes, not int.
2738         (make_link_path): Use NULL for null pointers.
2739         (quote_name): Use to_uchar instead of cast.
2740
2741         * src/id.c (use_name, main, print_user, xgetgroups, print_group_list,
2742         print_full_info): Use bool for booleans.
2743         (problems): Remove, replacing with....
2744         (ok): New var (inverted from old sense).
2745         (print_user, print_group, print_full_info):
2746         Print uids/gids with %lu, not %u.
2747         (xgetgroups): Don't run out of memory if getgroups or getugroups
2748         returns -1.
2749         * src/setuidgid.c (main): Print uids/gids with %lu, not %ld.
2750
2751         * src/factor.c (wheel_tab): Use unsigned char instead of unsigned
2752         int, since it suffices.
2753         (factor, print_factors): Use size_t for sizes.
2754         (print_factors, do_stdin, main): Use bool for booleans.
2755         * src/fold.c (TAB_WIDTH): New macro; use it instead of "8".
2756         (fold_file, main): Use bool for booleans.
2757         (fold_file, main): Use size_t for sizes.
2758         (main): Allow -w options up to SIZE_MAX - TAB_WIDTH - 1, instead
2759         of prohibiting widths greater than INT_MAX.
2760         * src/head.c (presume_input_pipe, print_headers, have_read_stdin,
2761         write_header, elide_tail_bytes_pipe, elide_tail_bytes_file,
2762         elide_tail_lines_pipe, elide_tail_lines_seekable,
2763         elide_tail_lines_file, head_bytes, head_lines, head, head_file,
2764         string_to_integer, main):
2765         Use bool for booleans.
2766         (main): Rewrite to avoid cast.
2767
2768         * src/csplit.c (struct line): Use size_t for sizes.
2769         (main): Remove unnecessary cast.
2770         * src/cut.c (cut_fields): Use to_uchar rather than a cast.
2771         * src/cut.c (cut_file, main): Use bool for booleans.
2772         * src/date.c (show_date, rfc_format, batch_convert, main): Likewise.
2773         * src/env.c (main): Likewise.
2774         * src/expr.c (nextarg): Likewise.
2775         * src/env.c (main): Remove unused and nonstandard envp arg.
2776
2777         * src/fmt.c (COST, MAXWORDS): Add a comment describing some of
2778         fmt's arbitrary limits.
2779         (TRUE, FALSE): Remove; all uses changed to (true, false).
2780         (main): Use bool for booleans.
2781         Limit maximum width to MAXCHARS / 2.  Use xstrtoul, not xstrtol,
2782         to parse width.
2783         (copy_rest): Remove unnecessary cast.
2784         (get_prefix): Rewrite to avoid cast.
2785         (check_punctuation): Use char *, not unsigned char *; C89 requires
2786         this.  Avoid off-by-one buffer read overrun when line is empty.
2787         (flush_paragraph): Don't assume wptr-parabuf is <= INT_MAX.
2788         Remove unnecessary casts.
2789         * tests/fmt/basic (wide-1, wide-2, bad-suffix): Adjust to above
2790         changes.
2791
2792         * src/expand.c (convert_entire_line, have_read_stdin, parse_tabstops,
2793         next_file, expand, main):
2794         Use bool for booleans.
2795         (tab_size, tab_list, add_tabstop, parse_tabstops, validate_tabstops,
2796         expand, main):
2797         Use uintmax_t for column counts.
2798         (add_tabstop): Don't reserve -1 (now UINTMAX_MAX) as a special value.
2799         All callers changed.
2800         (parse_tabstops): Don't pass a negative char to isblank.
2801         Avoid memory leak with large tab stops.
2802         (validate_tabstops, expand): Don't assume number of tab stops is
2803         <= INT_MAX.
2804         (next_file, main): Use EXIT_SUCCESS/EXIT_FAILURE rather than 0/1 when
2805         storing values into exit_status.
2806         (expand): Use same pattern as unexpand for reading chars.
2807         Report an error when input line is too long, instead of silently
2808         screwing up.  Do not mishandle tab stops when backspacing left
2809         over start of line.
2810
2811         * src/dircolors.c (have_read_stdin, append_quoted,
2812         dc_parse_stream, dc_parse_file, main): Use bool for booleans.
2813         (dc_parse_stream): Use enum for state, rather than int.
2814         Use ssize_t to store getline result.
2815
2816         * src/dd.c (translation_needed, parse_integer, scanargs,
2817         apply_translations, char_is_saved, swab_buffer, skip_via_lseek):
2818         Use bool for booleans.
2819         (translate_buffer): Use to_uchar rather than a cast.
2820         (swab_buffer, copy_simple, copy_with_unblock):
2821         Use size_t for sizes.
2822
2823         * src/seq.c (equal_width, valid_format, main): Use bool for booleans.
2824         * src/sleep.c (apply_suffix): Likewise.
2825         * src/tail.c (struct File_spec, reopen_inaccessible_files, count_lines,
2826         forever, from_start, print_headers, have_read_stdin, valid_file_spec,
2827         write_header, file_lines, pipe_lines, pipe_bytes, recheck,
2828         tail_forever, tail_bytes, tail_lines, tail, tail_file,
2829         parse_obsolescent_option, parse_options, main): Likewise.
2830         * src/sleep.c (apply_suffix): Invert sense of result.
2831         Use int (not unsigned int) for multiplier, as this generates better
2832         code with some compilers.  Simplify code a bit.
2833         * src/tail.c (struct File_spec, max_n_unchanged_stats_between_opens,
2834         parse_options): Use uintmax_t, not unsigned int or unsigned long int,
2835         for state counters.
2836         (tail_bytes, tail_lines): Redo test of return value (-1, 0, 1) to
2837         make it a bit clearer.
2838
2839         * src/hostname.c: Include "xgethostname.h".
2840         (xgethostname): Remove decl; xgethostname.h has it.
2841         (sethostname) [!defined(HAVE_SETHOSTNAME) && defined(HAVE_SYSINFO)
2842         && defined (HAVE_SYS_SYSTEMINFO_H) && defined(HAVE_LIMITS_H)]: Use
2843         prototypes rather than K&R form.  Assume any negative value from
2844         sysinfo denotes failure, not just -1.
2845         (main): Simplify use of sethostname.
2846
2847         * src/pinky.c (include_idle, include_heading, include_fullname,
2848         include_project, include_plan, include_home_and_shell, do_short_format,
2849         include_where, main): Use bool for booleans.
2850         (count_ampersands, create_fullname, scan_entries, short_pinky):
2851         Use size_t for sizes.
2852         (create_fullname): Check for overflow in size calculations.
2853         (idle_string): Don't assume that the number of idle days
2854         is less than 10**8 and/or INT_MAX/(24*60*60).
2855         (main): No need to pass a non-NULL last arg to getopt_long.
2856         * src/uptime.c (print_uptime, uptime): Use size_t for sizes.
2857         (print_uptime): Remove unused local variable.
2858         (main): No need to pass a non-NULL last arg to getopt_long.
2859         * src/users.c (list_entries_users, users): Use size_t for sizes.
2860         (list_entries_users): Use char for bytes.
2861         (main): No need to pass a non-NULL last arg to getopt_long.
2862         * src/who.c (do_lookup, short_list, short_output, include_idle,
2863         include_heading, include_mesg, include_exit, need_boottime,
2864         need_deadprocs, need_login, need_initspawn, need_clockchange,
2865         need_runlevel, need_users, my_line_only, main): Use bool for booleans.
2866         (print_runlevel): Use unsigned char for bytes.
2867         (list_entries_who, scan_entries, who): Use size_t for sizes.
2868         (main): No need to pass a non-NULL last arg to getopt_long.
2869
2870         * src/install.c (isdir): Remove decl.
2871         (install_file_to_path): Rely on make_path to fail if the destination
2872         is not a directory, by passing preserve_existing==true to it.
2873         Hence we no longer need to call isdir.
2874         Free dest_dir immediately when it's no longer needed, rather than
2875         waiting until the end of the function.
2876         (copy_file): Don't bother calling isdir, as copy will do the
2877         right thing if the destination is a directory.
2878
2879         * src/du.c (fts_debug, opt_all, apparent_size, opt_count_all,
2880         print_grand_total, opt_separate_dirs, hash_ins, process_file, main):
2881         Use bool for booleans.
2882         (max_depth): Now size_t, not int, to avoid an arbitrary limit
2883         of INT_MAX on depth.
2884         (G_fail): Remove: no longer needed, now that the relevant
2885         functions return bool.
2886         (process_file): Use return value to signal success rather than
2887         setting a global.  Remove first_call static var; not needed, since
2888         we can look at n_alloc.  Use size_t for depths.  Remove FIXME
2889         about size_t casts, as it's now fixed.  Use xnrealloc rather
2890         than the obsolescent XREALLOC.  Don't bother to check whether
2891         reallocation is needed unless level > prev_level.
2892         (du_files): Invert sense of result, for consistency with
2893         other coreutils code.  All callers changed.
2894         (main): Allow --max-depth values up to SIZE_MAX.
2895
2896         * src/df.c (inode_format, show_all_fs, show_local_fs,
2897         show_listed_fs, posix_format, require_sync, print_type,
2898         selected_fstype, excluded_fstype, show_dev, show_point, main):
2899         Use bool for booleans.
2900         (df_readable, show_dev): Use UINTMAX_MAX instead of -1.
2901         (show_dev, show_point, main):
2902         Use EXIT_SUCCESS/EXIT_FAILURE instead of 0/1.
2903         Don't assume disk name lengths are <= INT_MAX.
2904         Rewrite pct calculation to avoid cast.
2905         (show_point): Don't assume resolved length is <= SSIZE_MAX.
2906
2907         * src/cut.c (hash_int) [!defined UINTPTR_MAX]: Use size_t
2908         instead of uintptr_t.
2909         * src/shred.c (UINT_MAX_32_BITS): Remove.
2910         (word32): Remove.  All uses changed to uint32_t.
2911         (isaac_seed_data): Remove unnecessary cast.
2912         * src/system.h (ptr_align): Use size_t; in practice, this is just as
2913         good as uintptr_t in checking for alignments, and has fewer
2914         configuration hassles.
2915
2916         * src/Makefile.am (localedir.h): Make it readonly; this
2917         undoes part of the 2004-07-27 patch.
2918
2919 2004-07-30  Paul Eggert  <eggert@cs.ucla.edu>
2920
2921         * src/sort.c (UCHAR): Remove; all uses changed to to_uchar.
2922         (IS_THOUSANDS_SEP): Use bool when appropriate.
2923         (numcompare, main): Use char, not int, when the value is always a char.
2924         (numcompare): Remove "register"; compilers are smart enough these days.
2925         * src/system.h (errno, CHAR_BIT): Remove decls;
2926         no longer needed now we assume C89 or better.
2927         Include <inttypes.h> before <stdint.h>, as it's the
2928         Autoconf-recommended pattern.
2929         (to_uchar): New inline function, moved here from tr.c.
2930         Use full names for int types, e.g. "long int" rather than "long".
2931         * src/tr.c (to_uchar): Remove; now in system.h.
2932         (is_char_class_member): Use bool when appropriate.
2933
2934         * src/mkdir.c (create_parents, main): Use bool when appropriate.
2935         (main): Use EXIT_SUCCESS/EXIT_FAILURE instead of 0/1.
2936
2937 2004-07-29  Paul Eggert  <eggert@cs.ucla.edu>
2938
2939         * src/mkfifo.c (main): Use EXIT_SUCCESS and EXIT_FAILURE, not 0 and 1.
2940
2941         * src/chmod.c (recurse, force_silent, process_file, process_files,
2942         main): Use bool when appropriate.
2943         * src/cksum.c (cksum, main): Likewise.
2944         * src/comm.c (hard_LC_COLLATE, only_file_1, only_file_2, both,
2945         compare_files, main): Likewise.
2946
2947         * src/copy.h (struct cp_options): Likewise.
2948         * src/copy.c (copy_internal, is_ancestor, copy_dir, copy_reg,
2949         same_file_ok, seen_file, copy_internal, valid_options, copy): Likewise.
2950         * src/cp-hash.h (remember_created): Likewise.
2951         * src/cp-hash.c (remember_created): Likewise.
2952         * src/cp.c (struct dir_attr, flag_path, remove_trailing_slashes,
2953         re_protect, make_path_private, target_directory_operand, do_copy,
2954         cp_option_init, decode_preserve_arg, main): Likewise.
2955         * src/install.c (isdir, change_timestamps, change_attributes,
2956         copy_file, install_file_to_path, install_file_in_dir,
2957         install_file_in_file, strip_files, dir_arg, cp_option_init, main,
2958         change_attributes, change_timestamps): Likewise.
2959         * src/mv.c (remove_trailing_slashes, rm_option_init,
2960         cp_option_init, do_move, movefile, main): Likewise.
2961         * src/remove.c (right_justify), full_filename_, AD_pop_and_chdir,
2962         AD_push, prompt, remove_dir): Likewise.
2963         * src/rm.c (rm_option_init, main): Likewise.
2964
2965         * src/remove.c (top_dir, pop_dir, full_filename_):
2966         Use size_t for sizes.
2967         * src/cp.c (target_directory_operand): Do not clear *NEW_DST if stat
2968         succeeds.  It's not necessary in that case, as *NEW_DST is always
2969         false already.
2970         (do_copy): Rewrite slightly to avoid need for "unreachable" comment.
2971         (main): Use EXIT_SUCCESS, EXIT_FAILURE instead of 0, 1.
2972         * src/rm.c (main): Likewise.
2973
2974         md5sum, sha1sum integer cleanups.
2975
2976         * src/checksum.h: Don't include config.h, sys/types.h, stdio.h:
2977         not needed.
2978         (ALG_UNSPECIFIED): Remove.
2979         (ALG_MDT): Don't make it equal to CHAR_MAX + 1; this isn't necessary.
2980         * src/md5.c: Don't include any files other than checksum.h.
2981         * src/sha1sum.c: Likewise.
2982         * src/md5sum.c (OPENOPTS, have_read_stdin, status_only, warn,
2983         bsd_split_3, split_3, hex_digits, digest_file, digest_check, main):
2984         Use bool when appropriate.
2985         (digest_check): Increase limit of number of input lines to
2986         UINTMAX_MAX from INT_MAX.  Diagnose any overflows of this counter.
2987         Use ngettext instead of hard-to-i18nize hardcoded stuff for plurals.
2988
2989 2004-07-28  Paul Eggert  <eggert@cs.ucla.edu>
2990
2991         * src/cat.c (exit_status): Remove.  Now done by passing a boolean
2992         'ok' flag around.
2993         (simple_cat, cat): Return true if successful.  All callers changed.
2994         (simple_cat, cat, main): Use bool for booleans.
2995         (simple_cat): Use size_t for sizes.
2996         (cat, main): Use the same names for parameters that we use for
2997         long options, to avoid confusion.  This inverts the sense of the
2998         show_tabs (formerly output_tabs) and number_nonblank
2999         (formerly numbers_at_empty_lines) variables.
3000         (main): Don't mess up (due to integer overflow) if we are given
3001         INT_MAX - INT_MIN + 1 options.
3002         [O_BINARY]: Don't invoke isatty unless the other options require it.
3003         (main): When deciding whether to use simple_cat, don't worry
3004         about binary option; it's irrelevant.
3005
3006         * src/dcgen: Remove comments, trailing white space, and empty
3007         lines from the output strings, to save space.
3008         Use a narrower type like 'unsigned char' for line lengths, if
3009         that will do.
3010         Make the output variables static, not extern.
3011
3012         * src/chgrp.c (parse_group): Require base 10 when parsing
3013         groups as integers.
3014         (main): int -> bool when appropriate.
3015         * src/chown.c (main): Likewise.
3016         * src/chown-core.c: Include inttostr.h.
3017         (UINT_MAX_DECIMAL_DIGITS, uint_to_string): Remove.
3018         (gid_to_name, uid_to_name): Use imaxtostr/umaxtostr
3019         instead of uint_to_string).
3020         (describe_change): Instead of an int flag, use a char *
3021         auxiliary; this avoids the need for casts.
3022         Assume free (NULL) works.
3023         (change_file_owner): Return true/false, not 0/-1, since
3024         we don't set errno.  All callers changed.
3025         Use bool when appropriate.
3026         (chown_files): Likewise.
3027         * src/chown-core.h (chown_files): Likewise.
3028
3029         * tests/chown/basic: Test for proper handling of uids like
3030         "010", which must be parsed as decimal.
3031
3032         * tests/misc/pwd: Don't assume that Perl's getpwd agrees with our
3033         pwd when there are multiple names for the working directory
3034         (which can happen with an automounter, sigh).
3035
3036         * src/Makefile.am ($(SCRIPTS)): Don't depend on Makefile;
3037         this causes Solaris 8 'make' to refuse to build "groups".
3038         (localedir.h): Don't depend on Makefile: this causes Solaris
3039         8 'make' to build localedir.h unnecessarily.  The dependence
3040         on Makefile is ineffective anyway, since $(localedir) might
3041         change even if Makefile hasn't.
3042
3043         * src/remove.c (remove_dir): If we can't save the state of the
3044         working directory, pretend we started from "/", not ".".
3045         This avoids a bug on hosts like Solaris that don't let you
3046         remove the working directory.
3047
3048 2004-07-27  Paul Eggert  <eggert@cs.ucla.edu>
3049
3050         * src/printf.c (strtiomax, strtoumax): Declare if not already
3051         declared: this fixes a portability bug with Solaris 8 + GCC.
3052         (STRTOX): Parenthesize use of macro arg as expression.
3053         (vstrtoimax, vstrtoumax, vstrtold): Remove now-unnecessary
3054         parentheses.
3055         * configure.ac: Check for declaration of strtoumax, for
3056         src/printf.c.
3057
3058         * src/Makefile.am (cp_LDADD, ginstall_LDADD, mv_LDADD,
3059         pathchk_LDADD, rm_LDADD, test_LDADD): New vars, for eaccess.
3060
3061         * tests/readlink/can-e: Don't assume that we can remove the
3062         working directory: this isn't possible under Solaris 8, say.
3063         * tests/readlink/can-f: Likewise.
3064         * tests/readlink/can-m: Likewise.
3065
3066         * src/copy.c (copy_internal): find_backup_file_name no longer
3067         returns NULL, so don't bother to check for this.
3068         * src/cp.c (do_copy): Likewise.
3069         * src/ln.c (do_link): Likewise.
3070
3071 2004-07-25  Paul Eggert  <eggert@cs.ucla.edu>
3072
3073         * src/nice.c (GET_NICE_VALUE): Renamed from GET_PRIORITY.
3074         All uses changed.
3075         (NZERO): New macro, if system doesn't define it already.
3076         (usage): Distinguish priorities from nice values.
3077         Don't assume NZERO is 20.
3078         (main): Use bool instead of int where appropriate.
3079         If user specifies an adjustment out of range, always truncate it
3080         to an inrange value instead of sometimes giving an error message
3081         and sometimes not.
3082         Do not assume that -1 is an error return from "nice" or
3083         "getpriority", as it might be the current nice value minus NZERO.
3084         If nice/setpriority fails with errno == EPERM, go ahead and run
3085         the command anyway; POSIX requires this.
3086
3087         * src/pathchk.c: Include euidaccess.h.
3088         (dir_ok): Use euidaccess, not access.
3089         * src/test.c (R_OK, W_OK, X_OK, FOK): Remove; system.h defines them.
3090         (eaccess): Remove.  All users changed to use euidaccess instead.
3091
3092 2004-07-24  Paul Eggert  <eggert@cs.ucla.edu>
3093
3094         * src/uptime.c (print_uptime) [defined BOOT_MSG]:
3095         Don't assume ut_line is null-terminated.
3096         * src/who.c (print_line): New arguments USERLEN and LINELEN,
3097         since USER and LINE might not be null terminated.  All callers
3098         changed.
3099
3100 2004-07-23  Paul Eggert  <eggert@cs.ucla.edu>
3101
3102         Fix bug with "tail -f" reported by Rob Holland in
3103         <http://lists.gnu.org/archive/html/bug-coreutils/2004-07/msg00054.html>.
3104         Also, remove the undocumented and unsupported-since-2000
3105         --max-consecutive-size-changes options.  Fix another related bug:
3106         "tail" got confused if stdin, stdout, or stderr were closed.
3107         Also, use output buffering even with "tail -f".
3108
3109         * NEWS: Document this, plus yesterday's patch.
3110         * doc/coreutils.texi (tail invocation): "size has remained the same"
3111         -> "file has not changed", which is more accurate for fifos.
3112         * src/tail.c: Include fcntl-safer.h.
3113         (COPY_TO_EOF): Set to UINTMAX_MAX, not OFF_T_MAX (which was wrong).
3114         (COPY_A_BUFFER): New macro.
3115         (struct File_spec): New members mtime, mode, blocking.
3116         Remove member n_consecutive_size_changes.
3117         (DEFAULT_MAX_N_CONSECUTIVE_SIZE_CHANGES,
3118         max_n_consecutive_size_changes_between_opens,
3119         MAX_CONSECUTIVE_SIZE_CHANGES_OPTION): Remove.
3120         (long_options, tail_forever, parse_options):
3121         Remove (non-)support for --max-consecutive-size-changes.
3122         (record_open_fd): New function.
3123         (recheck, tail_file): Use it.  Don't assume that stdin is open.
3124         (dump_remainder): Add support for new COPY_A_BUFFER special value.
3125         Treat errno==EAGAIN like EOF, since it might be a nonblocking read.
3126         (recheck): New arg BLOCKING, specifying whether to use blocking reads.
3127         All uses changed.
3128         (n_live_files): Remove, replacing with...
3129         (any_live_files): New function.  All uses changed.
3130         (tail_forever): Use nonblocking I/O unless we know that blocking I/O
3131         is safe; this avoids some hangs when reading from a fifo.
3132         Avoid invoking fstat or sleep when using blocking I/O.
3133         Do not check for changes to size if the file is not a regular file,
3134         as the size is undefined in that case.
3135         Check for changes to mtime or mode, too; this works for non-regular
3136         files.
3137         (tail_forever, main): Redo fflush strategy to work even when input
3138         is nonblocking.  Don't use unbuffered output; just flush when needed.
3139
3140 2004-07-22  Paul Eggert  <eggert@cs.ucla.edu>
3141
3142         * src/tail.c (main): Ignore -f if no file operand is specified
3143         and standard input is a pipe.
3144         * doc/coreutils.texi (tail invocation): Do not ignore -f for
3145         all pipes, just for when standard input is a pipe and no
3146         file operand is specified.
3147         * tests/tail/Test.pm: Reinstate f-1 test, since we now pass.
3148         Add a new commented-out f-2 test, which we still fail.
3149         (test_vector): All f-* tests are special cases, not just f-1.
3150
3151 2004-07-12  Paul Eggert  <eggert@cs.ucla.edu>
3152
3153         * src/uptime.c: Include c-strtod.h.
3154         (print_uptime): Use c_strtod instead of setlocale and sscanf.
3155         Use long int rather than int to count days (for 64-bit hosts),
3156         and check for arithmetic overflow when converting double to time_t.
3157
3158 2004-07-11  Paul Eggert  <eggert@cs.ucla.edu>
3159
3160         * src/printf.c (vstrtold): Renamed from vstrtod.
3161         Now returns long double.  All uses changed.
3162         (print_direc): Use "L" length modifier when printing floating point
3163         numbers, since we're now printing long double.
3164
3165 2004-07-06  Paul Eggert  <eggert@cs.ucla.edu>
3166
3167         printf cleanup, to avoid undefined behavior, to add support for
3168         formats that Bash supports, and to support wide integers like
3169         Bash does.
3170
3171         * NEWS: Document this.
3172         * src/printf.c (UNSPECIFIED): Remove.  All uses now replaced by
3173         booleans, so that we don't reserve any values for precision or
3174         width (like Bash).
3175         (STRTOX): Use prototype, not K&R-style definition.
3176         (vstrtoimax): Renamed from xstrtol (to avoid confusion with xstrtol
3177         in ../lib), with type change to intmax_t.
3178         All uses changed.
3179         (vstrtoumax): Renamed from xstrtoul, with type change to uintmax_t.
3180         All uses changed.
3181         (vstrtod): Renamed from xstrtod.  All uses changed.
3182         (print_direc): Use boolean arg instead of special value to indicate
3183         a missing precision or width.  LENGTH no longer includes
3184         length modifiers or conversion character.  New arg CONVERSION
3185         now specifies conversion character.
3186         Use intmax_t-width formatting for integers (like Bash).
3187         Add support for C99 %a, %A, %F (like Bash).
3188         Add support for field width with %c (POSIX requires this).
3189         Add a FIXME for lack of support for field width and precision
3190         for %b.
3191         Add support for '\'', '0' flags.
3192         Check for invalid combinations of flags, field width, precision,
3193         and conversion, to prevent use of undefined behavior.
3194         Allow multiple length modifiers, for formats like "%lld" (like Bash).
3195         Add support for C99 'j', 't', 'z' length modifiers (like Bash).
3196         In error message, output entire invalid conversion specification,
3197         instead of merely outputting % followed by the conversion char.
3198         * tests/misc/printf: Add tests for the above.
3199
3200 2004-04-03  Dmitry V. Levin  <ldv@altlinux.org>
3201
3202         Change "readlink -f" to be more compatible with prior implementations.
3203         Add more canonicalize options, -e and -m.
3204         Add comprehensive tests for all readlink modes.
3205
3206         * m4/canonicalize.m4 (AC_FUNC_CANONICALIZE_FILE_NAME):
3207         Do not add canonicalize.c here.
3208
3209         * src/readlink.c (longopts): Add new options.
3210         (usage): Document them.
3211         (canonicalize_fname): New proxy function.
3212         (main): Handle new options.
3213         * doc/coreutils.texi (readlink invocation): Document new
3214         "readlink -f" behaviour and new canonicalize options, -e and -m.
3215
3216         * configure.ac (AC_CONFIG_FILES): Add tests/readlink/Makefile.
3217         * tests/Makefile.am (SUBDIRS): Add readlink.
3218         * tests/readlink/Makefile.am: New file.
3219         * tests/readlink/{rl-1,can-e,can-f,can-m}: New readlink tests.
3220         * tests/misc/Makefile.am (TESTS): Remove basic readlink test.
3221         * tests/misc/readlink: Remove file.
3222
3223 2004-07-04  Jim Meyering  <jim@meyering.net>
3224
3225         * src/copy.c (copy_internal): Add a FIXME comment.
3226
3227 2004-07-02  Paul Eggert  <eggert@cs.ucla.edu>
3228
3229         * src/copy.c (copy_dir): Assume path_concat returns non-NULL.
3230         * src/cp.c (do_copy): Likewise.
3231         * src/mv.c (movefile): Likewise.
3232
3233         * src/cp.c (make_path_private): 2nd arg is now size_t, not int,
3234         to avoid problem when path_concat dir name is longer than 2 GiB (!).
3235
3236         * src/nohup.c (main): Don't pass NULL first argument to path_concat.
3237         This cleans up the semantics a bit, as we no longer try to open the
3238         same file twice.
3239
3240 2004-07-01  Paul Eggert  <eggert@cs.ucla.edu>
3241
3242         * NEWS: Add short names -t and -T for --target-directory
3243         and --no-target-directory options, respectively.
3244
3245         * src/cp.c (NO_TARGET_DIRECTORY_OPTION, TARGET_DIRECTORY_OPTION):
3246         Remove.  All uses changed to 'T' and 't', respectively.
3247         * src/install.c, src/ln.c, src/mv.c: Likewise.
3248
3249         * src/cp.c (long_opts, usage, do_copy, main): Add -t and -T as
3250         aliases for --target-directory and --no-target-directory,
3251         respectively.
3252         * src/install.c (long_options, main, usage): Likewise.
3253         * src/ln.c, src/mv.c: Likewise.
3254
3255 2004-07-01  Jim Meyering  <jim@meyering.net>
3256
3257         * Makefile.maint (sc_file_system): New target.
3258         (syntax-check-rules): Add it.
3259         .x-sc_file_system: New file.
3260         * Makefile.am (EXTRA_DIST): Add it.
3261
3262         * man/sync.x: Use "file system" rather than "filesystem".
3263         * man/stat.x, man/df.x: Likewise.
3264
3265 2004-06-30  Paul Eggert  <eggert@cs.ucla.edu>
3266
3267         * src/df.c (usage, main): Output "file system" rather than
3268         "filesystem".
3269         * src/du.c (usage): Likewise.
3270         * src/shred.c (usage): Likewise.
3271         * src/stat.c (usage): Likewise.
3272         * src/stat.c (long_options, usage): Rename "--filesystem" to
3273         "--file-system".  But keep the old name around, for compatibility
3274         reasons.
3275
3276 2004-06-29  Paul Eggert  <eggert@cs.ucla.edu>
3277
3278         Add support for --no-target-directory option.
3279
3280         * NEWS: Document it.
3281         * doc/coreutils.texi (Common options, Target directory, cp
3282         invocation, install invocation, mv invocation, ln invocation):
3283         Likewise.
3284         (link invocation): Explain how to rewrite link using ln now
3285         that we have --no-target-directory.
3286         (ln invocation): Explain that --no-target-directory subsumes
3287         --no-dereference.
3288         (unlink invocation): Modify wording to match new wording in
3289         link invocation.
3290
3291         * src/cp.c (NO_TARGET_DIRECTORY_OPTION): New constant.
3292         (long_opts, usage, do_copy, main): Add support for
3293         --no-target-directory,
3294         * src/install.c (NO_TARGET_DIRECTORY_OPTION, long_options, main,
3295         usage): Likewise.
3296         * src/ln.c (NO_TARGET_DIRECTORY_OPTION, long_options, usage,
3297         main): Likewise.
3298         * src/mv.c (NO_TARGET_DIRECTORY_OPTION, long_options, usage,
3299         main): Likewise.
3300         * src/mv.c (enum): Sort values.
3301
3302 2004-06-29  Jim Meyering  <jim@meyering.net>
3303
3304         Don't let verbose-mode output from a subshell obscure actual differences.
3305         * tests/rm/inaccessible: Turn off command-echoing just before
3306         invoking subshell, then turn it back on if VERBOSE=yes afterward.
3307
3308 2004-06-25  Paul Eggert  <eggert@cs.ucla.edu>
3309
3310         Add support for 'install --target-directory', an option
3311         that has been documented for years but not implemented (!).
3312         * doc/coreutils.texi (install invocation): Document
3313         --target-directory in synopsis, too.
3314         * src/install.c (TARGET_DIRECTORY_OPTION): New var.
3315         (long_options, main, usage): Add --target-directory.
3316         (target_directory_operand): New function, stolen from mv.c.
3317         (main): Use it.  Check for -d and --target-directory.
3318         Alter wording of diagnostics to match other programs.
3319
3320 2004-06-28  Jim Meyering  <jim@meyering.net>
3321
3322         * src/cp.c (usage): Fix copy+paste error in description of
3323         --target-directory: s/move/copy/.  From Paul Jarc.
3324
3325 2004-06-27  Paul Eggert  <eggert@cs.ucla.edu>
3326
3327         Use more-consistent rules among cp, ln, and mv when dealing with
3328         last operands that are (or look like) directories.
3329
3330         * src/cp.c (target_directory_operand): New, nearly-common function,
3331         It reports an error if the destination appears to be a directory
3332         (e.g., because it has a trailing slash) but is not.
3333         * src/ln.c, src/mv.c: Likewise.
3334         * src/cp.c (do_copy): Use it.
3335         * src/ln.c (main): Likewise.
3336         * src/mv.c (main): Likewise.
3337
3338         * src/cp.c (do_copy): Don't assume argc is positive.
3339         Don't bother to lstat dest, since copy() will do that for us.
3340         Use "const" to avoid the need for cast.
3341
3342         * src/cp.c (do_copy): Don't output a usage message because of file
3343         problems (e.g., an operand is not a directory).  Use it only for
3344         syntax.  Standardize on "target %s is not a directory" for the
3345         diagnostic.
3346         * src/ln.c (main): Likewise.
3347         * src/mv.c (main): Likewise.
3348
3349         * src/cp.c (do_copy): Remove test for trailing slash, since
3350         target_directory_operand now does this.
3351         * src/ln.c (main): Likewise.
3352         * src/mv.c (movefile): Likewise.
3353
3354         * src/cp.c (main): Reject multiple target directories.
3355         Check whether a specified target is a directory when parsing the
3356         options, using stat.  This gives more-accurate diagnostics.
3357         * src/ln.c (main): Likewise.
3358
3359         * src/ln.c (isdir): Remove decl; no longer needed.
3360         * src/mv.c (isdir, lstat): Likewise.
3361
3362         * src/ln.c (do_link): New arg dest_is_dir.  All uses changed.
3363         Don't check the destination ourself; rely on dest_is_dir.
3364         This way we can avoid lstatting the destination in the
3365         usual case, and in the worst case we lstat 1, not 3 times.
3366         Don't bother to unlink unless link failed; this saves a syscall.
3367         Remove unnecessary backup_succeeded flag;
3368         it was identical to "dest_backup != NULL".
3369
3370         * src/ln.c (main): Use int to count to argc, not unsigned int.
3371         This handles negative operand counts.
3372         * src/mv.c (main): Likewise.
3373
3374         * src/mv.c (do_move): Don't call hash_init; expect the caller to
3375         do it, for consistency with cp.c and ln.c.  All callers changed.
3376         (movefile): dest_is_dir parameter is now bool, not int.
3377         (main): Standardize on "missing destination file operand after %s"
3378         for the diagnostic, for consistency with cp.c.
3379
3380         * tests/mv/diag: Don't assume "mv --target=nonexistentdir"
3381         will complain about the arg count.
3382         Adjust to new (briefer) diagnostics.
3383         * tests/cp/fail-perm: Add a test to verify that we get the new
3384         diagnostic when failing to copy through a symlink-to-inaccessible-dir.
3385
3386 2004-06-27  Paul Eggert  <eggert@cs.ucla.edu>
3387
3388         Fix a bug: formerly, if d/x was a directory and x a file, "ln x
3389         d/" incorrectly created a link d/x/x.  It also saves some system
3390         calls.
3391
3392         * NEWS: Document the fix.
3393
3394         * src/ln.c (main): Don't append basename to dest if this
3395         results in an existing directory name.
3396         * tests/ln/misc: See whether a trailing slash is followed too far.
3397
3398 2004-06-26  Jim Meyering  <jim@meyering.net>
3399
3400         * src/printf.c (main): When given no arguments, print the standard
3401         "missing operand\nTry printf --help..." message -- to be consistent.
3402
3403 2004-06-26  Jim Meyering  <jim@meyering.net>
3404
3405         * src/mknod.c (main): Add \n at the end of message output via fprintf.
3406
3407 2004-06-25  Jim Meyering  <jim@meyering.net>
3408
3409         * tests/ln/misc: Add test for ln subscript error.
3410
3411 2004-06-23  Paul Eggert  <eggert@cs.ucla.edu>
3412
3413         * src/ln.c (do_link): Remove unnecessary call to lstat.
3414         (main): Avoid subscript error when the destination is "".
3415
3416 2004-06-23  Jim Meyering  <jim@meyering.net>
3417
3418         * tests/*: Replace all occurrences of `(exit N); exit' with
3419         `(exit N); exit N'.  Otherwise, those many tests could exit with
3420         improper exit status when exiting via e.g., a trapped interrupt.
3421         Thanks to a report from Bob Proulx.
3422
3423 2004-06-22  Paul Eggert  <eggert@cs.ucla.edu>
3424
3425         * src/who.c (idle_string, print_user): New arg boottime,
3426         specifying the most recent boot time.  All uses changed.
3427         (idle_string) Consider a line to be "old" if it hasn't been used
3428         since the last boot time.  Watch out for overflow when computing
3429         times, and for times in the future.
3430         (idle_string): Record latest boot time.
3431
3432 2004-06-22  Jim Meyering  <jim@meyering.net>
3433
3434         * src/test.c (usage): Correct description of `-t FD'.  The file
3435         descriptor, FD, is no longer optional.  Reported by Ton Nijkes.
3436
3437 2004-06-21  Paul Eggert  <eggert@cs.ucla.edu>
3438
3439         The 2004-06-19 fix for who and pinky was incomplete, as ctime
3440         has undefined behavior if the year precedes -999 or follows 9999.
3441         Since we have to stop using ctime anyway, we might as well use
3442         strftime and fix the FIXME, and support internationalized dates.
3443
3444         * NEWS: Document the new behavior.
3445         * src/who.c: Include "hard-locale.h".
3446         (time_format, time_format_width): New vars.
3447         (time_string, print_line): Use them.
3448         (main): Set them.
3449         (time_string): Use localtime + strftime instead of
3450         ctime, to avoid problems with years before -999 or after 9999.
3451         * src/pinky.c: Likewise.
3452
3453 2004-06-21  Paul Eggert  <eggert@cs.ucla.edu>
3454
3455         Fix bug: GNU 'ls' didn't count columns correctly if user or group
3456         names contained multibyte characters where the column count
3457         differed from the byte count.  This patch also corrects
3458         some comments.
3459
3460         * src/ls.c (format_user_or_group): New function, which counts
3461         columns correctly.
3462         (format_user, format_group): Use it.
3463         (format_user_or_group_width): New function, which counts columns
3464         correctly.
3465         (format_user_width, format_group_width): Use it.
3466
3467 2004-06-21  Jim Meyering  <jim@meyering.net>
3468
3469         * tests/priv-check: Quote "$PATH" in PATH=$PATH.
3470         Suggestion from Andreas Schwab.
3471
3472         * tests/priv-check: When running as root, be sure to propagate
3473         PATH through to the process we exec as non-root.
3474         Reported by michael@aplatform.com.
3475
3476         * src/mknod.c (main): Don't segfault when calculating the
3477         expected number of operands for `mknod NAME'.
3478
3479 2004-06-20  Jim Meyering  <jim@meyering.net>
3480
3481         * src/dd.c (input_seek_errno): Declare file-scoped variable as static.
3482
3483 2004-06-20  Paul Eggert  <eggert@cs.ucla.edu>
3484
3485         * src/basename.c (main):
3486         Standardize on the diagnostics given when someone gives
3487         too few operands ("missing operand after `xxx'") or
3488         too many operands ("extra operand `xxx'").
3489         Include "quote.h" and/or "error.h" if it wasn't already being included.
3490         * src/chgrp.c (main): Likewise.
3491         * src/chmod.c (main): Likewise.
3492         * src/chown.c (main): Likewise.
3493         * src/chroot.c (main): Likewise.
3494         * src/comm.c (main): Likewise.
3495         * src/cp.c (do_copy): Likewise.
3496         * src/csplit.c (main): Likewise.
3497         * src/date.c (main): Likewise.
3498         * src/dircolors.c (main): Likewise.
3499         * src/dirname.c (main): Likewise.
3500         * src/du.c (main): Likewise.
3501         * src/expr.c (main): Likewise.
3502         * src/hostid.c (main): Likewise.
3503         * src/hostname.c (main): Likewise.
3504         * src/id.c (main): Likewise.
3505         * src/install.c (main): Likewise.
3506         * src/join.c (add_file_name, main): Likewise.
3507         * src/link.c (main): Likewise.
3508         * src/ln.c (main): Likewise.
3509         * src/logname.c (main): Likewise.
3510         * src/md5sum.c (main): Likewise.
3511         * src/mkdir.c (main): Likewise.
3512         * src/mkfifo.c (main): Likewise.
3513         * src/mknod.c (main): Likewise.
3514         * src/mv.c (main): Likewise.
3515         * src/nohup.c (main): Likewise.
3516         * src/od.c (main): Likewise.
3517         * src/pathchk.c (main): Likewise.
3518         * src/ptx.c (main): Likewise.
3519         * src/readlink.c (main): Likewise.
3520         * src/rm.c (main): Likewise.
3521         * src/rmdir.c (main): Likewise.
3522         * src/seq.c (main): Likewise.
3523         * src/setuidgid.c (main): Likewise.
3524         * src/shred.c (main): Likewise.
3525         * src/sleep.c (main): Likewise.
3526         * src/sort.c (main): Likewise.
3527         * src/split.c (main): Likewise.
3528         * src/stat.c (main): Likewise.
3529         * src/test.c (beyond, main): Likewise.
3530         * src/touch.c (main): Likewise.
3531         * src/tr.c (main): Likewise.
3532         * src/tsort.c (main): Likewise.
3533         * src/tty.c (main): Likewise.
3534         * src/uname.c (main): Likewise.
3535         * src/uniq.c (main): Likewise.
3536         * src/unlink.c (main): Likewise.
3537         * src/uptime.c (main): Likewise.
3538         * src/users.c (main): Likewise.
3539         * src/who.c (main): Likewise.
3540         * src/whoami.c (main): Likewise.
3541
3542         * tests/basename/basic: Adjust to new diagnostics.
3543         * tests/du/files0-from: Likewise.
3544         * tests/expr/basic: Likewise.
3545         * tests/mv/diag: Likewise.
3546         * tests/tsort/basic-1: Likewise.
3547
3548 2004-06-20  Jim Meyering  <jim@meyering.net>
3549
3550         * src/ln.c: Remove declaration of yesno.
3551         Instead, include yesno.h.
3552         * src/copy.c: Likewise.
3553
3554         * src/remove.c: Remove declaration of yesno.
3555         Instead, include yesno.h.
3556         (top_dir): Remove now-unnecessary cast of obstack_base.
3557         (pop_dir): Likewise.
3558         (full_filename_): Likewise.
3559
3560 2004-06-19  Paul Eggert  <eggert@cs.ucla.edu>
3561
3562         Don't dump core if ctime returns NULL; this is possible on
3563         hosts with 64-bit time_t and 32-bit int.
3564         * src/who.c: Include "inttostr.h".
3565         (time_string): If ctime fails, print the raw time as an integer
3566         instead of dumping core.
3567         * src/pinky.c: Likewise, as follows:
3568         Include "inttostr.h".
3569         (time_string): New function, copied from who.c.
3570         (print_entry): Use it.
3571
3572 2004-06-19  Paul Eggert  <eggert@cs.ucla.edu>
3573
3574         * src/who.c (print_line): Don't truncate user names at 8 bytes.
3575         Problem reported by Guido Leenders in:
3576         http://lists.gnu.org/archive/html/bug-coreutils/2004-06/msg00056.html
3577         * NEWS: document this.
3578
3579 2004-06-19  Jim Meyering  <jim@meyering.net>
3580
3581         * src/system.h (case_GETOPT_VERSION_CHAR): Switch back to
3582         using GNU_PACKAGE (from PACKAGE) once again.  This restores
3583         `GNU' to the parenthesized package name in --version output.
3584         Before, the first argument from AC_INIT, `GNU coreutils', would
3585         be propagated to the PACKAGE variable.  Now, `GNU ' is trimmed.
3586         Reported by Richard Stallman.
3587
3588 2004-06-17  Jim Meyering  <jim@meyering.net>
3589
3590         * src/tr.c (to_uchar): Rename function from `uchar'.  The latter
3591         would clash with a typedef in Tru64's <sys/types.h>.  From Albert Chin.
3592
3593 2004-06-15  Paul Eggert  <eggert@cs.ucla.edu>
3594
3595         * NEWS: Remove more special cases for POSIXLY_CORRECT when POSIX
3596         allows the GNU behavior.  "--" is now supported by chroot, hostid,
3597         hosname, pwd, sync, yes.
3598         * doc/coreutils.texi (yes invocation, false invocation,
3599         true invocation): Document this.
3600         * src/chroot.c (main): Handle "--".
3601         * src/hostid.c (main): Likewise.
3602         * src/hostname.c (main): Likewise.
3603         * src/pwd.c (main): Likewise.
3604         * src/sync.c (main): Likewise.
3605         * src/yes.c (main): Likewise.
3606         * src/true.c (main): Recognize --help and --version even if
3607         POSIXLY_CORRECT is set.
3608         * src/yes.c (main): Likewise.
3609
3610 2004-06-09  Paul Eggert  <eggert@cs.ucla.edu>
3611
3612         * NEWS: Remove special cases for POSIXLY_CORRECT when POSIX allows
3613         the GNU behavior.
3614         * doc/coreutils.texi (pr invocation, unlink invocation): Document this.
3615         * src/ls.c (decode_switches): Pay attention to TABSIZE even if
3616         POSIXLY_CORRECT is set.  POSIX reserves upper-case environment
3617         variables to the implementation, so it's OK for ls to depend on
3618         TABSIZE.
3619         * src/pr.c: Include "hard-locale.h".
3620         (main): When in a non-POSIX locale, ignore POSIXLY_CORRECT, since
3621         POSIX specifies the behavior only in the POSIX locale.
3622         * src/printf.c (print_esc): Support \x, \u, \U even if POSIXLY_CORRECT,
3623         since POSIX says the behavior is unspecified here.
3624         * src/tail.c (parse_obsolescent_option): Support multiple file operands
3625         even if POSIXLY_CORRECT, since POSIX does not require a diagnostic.
3626         * src/printf.c (main): Recognize --help, --version even if
3627         POSIXLY_CORRECT.  POSIX does not specify any options, but it
3628         does not prohibit options either, so "printf" is like "expr" here.
3629         * src/unlink.c (main): Likewise.
3630         * tests/misc/printf: Adjust to the new semantics for \x if
3631         POSIXLY_CORRECT.
3632
3633 2004-06-14  Jim Meyering  <jim@meyering.net>
3634
3635         * tests/misc/pwd: New test, for fix of 2004-04-19.
3636         * tests/misc/Makefile.am (TESTS): Add pwd.
3637         (BUILD_SRC_DIR): Define BUILD_SRC_DIR.
3638
3639         * src/copy.c: Remove declaration of euidaccess.
3640         Instead, include "euidaccess.h".
3641
3642 2004-06-13  Paul Eggert  <eggert@cs.ucla.edu>
3643
3644         * src/who.c (PIDSTR_DECL_AND_INIT): Don't assume pid_t fits in int.
3645         (UT_ID) [!HAVE_STRUCT_XTMP_UT_ID]: Remove bogus comment,
3646         as (sizeof "??") reliably returns 3.
3647         (print_line): Guard against idle and pid being too long
3648         (which is possible when printing headers).
3649         (print_user): Allocate enough bytes for idlestr.  Use IDLESTR_LEN.
3650         Avoid unnecessary cast of sizeof to int.
3651         (make_id_equals_comment): Do not assume that UT_ID returns
3652         a string; it might return a non-null-terminated array.
3653         Use strncat instead.  It's not very often where strncat is
3654         exactly what you want, but this is one of those rare cases.
3655
3656 2004-06-11  Paul Eggert  <eggert@cs.ucla.edu>
3657
3658         * src/who.c (list_entries_who): Don't output a trailing space.
3659
3660 2004-06-09  Jim Meyering  <jim@meyering.net>
3661
3662         * src/touch.c (usage): Improve wording in description of the
3663         --time=WORD option.  Reported by Dan Jacobson.
3664
3665         * src/chown-core.c (change_file_owner): Change names of parameters
3666         old_uid and old_gid to required_uid and required_gid respectively.
3667
3668         * src/chmod.c (mode_changed): Return false, not 0, now that the
3669         function returns `bool'.
3670
3671 2004-06-08  Paul Eggert  <eggert@cs.ucla.edu>
3672
3673         Adjust chmod and chown to be similar if -c or -v are given.  In
3674         particular, a no-op chown is no longer reported as a change; this
3675         reverts to previous behavior.  Also, fix both commands so that -v
3676         report failures even if the failure is not due to the chmod or
3677         chown syscalls.
3678
3679         * src/chmod.c (CH_NOT_APPLIED): New constant.
3680         (describe_change): Handle it.
3681         (process_file): Use it, if a symlink wasn't changed.
3682         (mode_changed): Return bool, not int.  Accept new argument
3683         NEW_MODE; all callers changed.  This lets us avoid statting the
3684         file unless the new mode has unusual bits.
3685         (process_file): Return -1 on error.  With -v, report all errors
3686         verbosely, not just some.
3687
3688         * src/chown-core.c (change_file_owner): Return -1 on error, not
3689         1 sometimes and -1 on others.  Our caller ORs together our results,
3690         and (-1 | 1) == 0 on ones-complement hosts.
3691         With -v report all errors verbosely, not just some.
3692         Fix bug when chopt->root_dev_ino && !chopt->affect_symlink_referent:
3693         file_stats wasn't set properly in that case.
3694
3695         * tests/chgrp/basic: Adjust to above changes.
3696
3697 2004-05-20  Paul Eggert  <eggert@cs.ucla.edu>
3698
3699         * tests/chgrp/basic: Test that chgrp -h does not fail on
3700         symlinks, even on hosts where that's not supported.
3701         Test that if -R is specified without -H or L, -h is assumed.
3702         Test that chown() is not optimized away.
3703
3704 2004-05-18  Paul Eggert  <eggert@cs.ucla.edu>
3705
3706         Several fixes to chgrp and chown for compatibility with POSIX and BSD:
3707
3708           Check for incompatible options.  When -R and --dereference are
3709           both used, then either -H or -L must also be used.  When -R and -h
3710           are both used, then -P must be in effect.
3711
3712           -H, -L, and -P have no effect unless -R is also specified.
3713           If -P and -R are both specified, -h is assumed.
3714
3715           Do not optimize away the chown() system call when the file's owner
3716           and group already have the desired value.  This optimization was
3717           incorrect, as it failed to updated the last-changed time and reset
3718           special permission bits, as POSIX requires.
3719
3720           Do not report an error if the owner or group of a
3721           recursively-encountered symbolic link cannot be updated because
3722           the file system does not support it.
3723
3724         * NEWS: Document the above.
3725
3726         * src/chgrp.c (main): Check for incompatible options.  -R --dereference
3727         requires either -H or -L, and -R -h requires -P.  If -H, specify
3728         FTS_PHYSICAL as well as FTS_COMFOLLOW; this is faster.  Make this
3729         file as much like chown.c as possible.
3730         * src/chown.c (main): Likewise.
3731
3732         * src/chown-core.c (change_file_owner): Use ent->fts_statp only if
3733         needed.  Chown a directory only after chowning its children; this
3734         avoids problems if the new directory ownership doesn't permit
3735         access to the children.  Dereference symlinks before doing
3736         ROOT_DEV_INO_CHECK, not after, so that we catch symlinks to /.
3737         Do not optimize away the chown() system call when the file's owner
3738         and group already have the desired value.  POSIX does not permit
3739         this optimization.  Rely on chown and lchown to do the right
3740         thing with symlinks and/or -1 arguments, now that we have wrappers
3741         to do this.  Use ENOTSUPP not ENOSYS, and ignore all ENOTSUPP
3742         errors, not just command-line errors.
3743         (chown_files): Pass FTS_NOSTAT to xfts_open if we don't need file status.
3744
3745         * src/system.h (ENOTSUP): Remove.
3746
3747         * tests/chgrp/basic: Use chown --from to discover whether the
3748         group changed, since chgrp now changes unconditionally.  This
3749         complicates the sed script a bit.  Do not specify --dereference,
3750         since it's the default (and we want to test this).  Adjust output
3751         to match the fact that chgrp no longer optimizes the case of
3752         changing a file's group to the same value as before.
3753         * tests/chgrp/posix-H: Do not attempt to combine -h and -H; these
3754         options are incompatible, and their behavior is undefined with POSIX.
3755         (changed, not_changed): Adjust to match the fact that -h is no longer
3756         specified.  Sort names.
3757         * tests/chown/deref: Adjust error-diagnostic spelling to match new
3758         behavior.
3759
3760 2004-06-07  Paul Eggert  <eggert@cs.ucla.edu>
3761
3762         * src/uname.c (main): Fix typo introduced on 2003-05-10 that
3763         prevented a diagnostic of any operands.
3764
3765 2004-06-08  Jim Meyering  <jim@meyering.net>
3766
3767         * src/shred.c (direct_mode): Turn it on/off with directio, too.
3768
3769 2004-06-07  Jim Meyering  <jim@meyering.net>
3770
3771         Enable direct-mode I/O (bypassing the buffer cache), if possible.
3772         Prompted by a suggestion from Kalle Olavi Niemitalo
3773         in http://bugs.debian.org/207035.
3774         * src/shred.c (direct_mode): New function.
3775         (do_wipefd): Turn on direct-mode I/O.
3776         (dopass): If a file's first write fails with EINVAL,
3777         turn off direct-mode I/O and retry the write.
3778
3779 2004-06-05  Paul Eggert  <eggert@cs.ucla.edu>
3780
3781         * src/tr.c (main): "tr -d a b" is now a fatal error even if
3782         POSIXLY_CORRECT is set.  The POSIX SYNOPSIS does not allow this
3783         option combination.
3784
3785 2004-06-04  Paul Eggert  <eggert@cs.ucla.edu>
3786
3787         * src/shred.c (dopass): Don't subtract 1 from the offset after
3788         a write error.  Problem reported by Jon Peatfield in:
3789         http://lists.gnu.org/archive/html/bug-coreutils/2004-06/msg00020.html
3790
3791 2004-06-02  Paul Eggert  <eggert@cs.ucla.edu>
3792
3793         Fix bug reported by Buciuman Adrian in
3794         <http://mail.gnu.org/archive/html/bug-coreutils/2003-08/msg00105.html>
3795         where 'dd' created a file that was too large.  The bug was that dd
3796         assumed that the input file offset does not advance after a failed
3797         read; but POSIX says that the input file offset is undefined after
3798         a failed read.
3799
3800         * src/dd.c (MAX_BLOCKSIZE): New macro.
3801         (input_seekable, input_seek_errno, input_offset,
3802         input_offset_overflow): New vars.
3803         (scanargs): Reject block sizes greater than MAX_BLOCKSIZE.
3804         (advance_input_offset): New function.
3805         (skip_via_lseek): Set errno to zero when reporting our failure,
3806         so that we don't report based on garbage errno.
3807         (skip): If fdesc is standard input, advance the input offset.
3808         Do not quit if reading, and if noerror was specified;
3809         POSIX seems to require this.
3810         If read fails on output file, report the earlier lseek failure
3811         instead; this fixes a FIXME in dd_copy.
3812         (advance_input_after_read_error): New function.
3813         (dd_copy): Use it, instead of assuming that failed reads
3814         do not advance the file pointer.  Advance input offset
3815         after nonfailed reads.  Advance only a partial block if
3816         the previous read (before the failed read) succeeded, and
3817         do not generate an output block of zeros in this case.
3818         (main): Determine initial input offset, seekability of input,
3819         and error if it wasn't seekable.
3820
3821 2004-06-02  Jim Meyering  <jim@meyering.net>
3822
3823         rm (without -f) could hang unnecessarily when attempting to
3824         remove a symlink to a file on an off-line NFS-mounted partition.
3825         Reported by David Howells in https://bugzilla.redhat.com/124699.
3826         * src/remove.c (write_protected_non_symlink): New function.
3827         Don't invoke euidaccess on symlinks.
3828         (prompt): Use write_protected_non_symlink rather than using
3829         euidaccess directly, being careful not to call lstat twice for a file.
3830
3831         Fix a bug in how the --output-delimiter=D option works with
3832         abutting byte or character ranges.  Reported by David Krider in
3833         http://lists.gnu.org/archive/html/bug-coreutils/2004-05/msg00132.html
3834         * src/cut.c (print_kth): Remove special case for open-ended range.
3835         (set_fields): Record the range start index for an interval even
3836         when it abuts another interval on its low side.
3837         Also record the range start index of the longest right-open-interval.
3838         * tests/cut/Test.pm: Add tests of --output-delimiter=S with
3839         abutting and overlapping byte ranges.
3840
3841 2004-06-01  Paul Eggert  <eggert@cs.ucla.edu>
3842
3843         Some POSIX-conformance cleanups for tr.
3844
3845         * src/tr.c (posix_pedantic): Remove; no longer needed since
3846         we need to test this in just one place now.
3847         (usage): Mention -C.
3848         (unquote): Note that \055, \n, etc are escaped.
3849         Do not worry about POSIXLY_CORRECT when warning about ambiguous
3850         escape sequences.
3851         \ at end of string stands for itself.
3852         Do not diagnose invalid backslash escapes: POSIX says the behavior
3853         is unspecified in this case, so we don't need to diagnose it.
3854         (main): Add support for -C (currently an alias for -c).
3855         Do not diagnose 'tr [:upper:] [:upper:], as POSIX does not require
3856         a diagnostic here.
3857         * tests/tr/Test.pm: New tests bs-055, bs-at-end, repeat-Compl.
3858         Fix comment for range-a-a.
3859
3860 2004-05-25  Paul Eggert  <eggert@cs.ucla.edu>
3861
3862         Improve the efficiency (and in one case, correctness) of code
3863         that reads symlinks.
3864
3865         * src/copy.c (copy_internal): Don't use alloca, as it can mess up
3866         royally if the link length is long (e.g., GNU/Hurd).  Use
3867         xreadlink instead, it's safer.  Don't bother to read the link if
3868         it's the wrong size.  Add a FIXME because this area is a bit murky
3869         and undocumented.
3870         * src/ls.c (get_link_name): Update use of xreadlink.
3871         * src/readlink.c (main): Likewise.
3872         * src/stat.c (print_stat): Likewise.
3873
3874 2004-06-01  Jim Meyering  <jim@meyering.net>
3875
3876         * src/env.c (main): Prefer the notation `STREQ (a, b)'
3877         over `!strcmp (a, b)'.
3878         * src/sort.c (main, sort_buffer_size): Prefer the notation
3879         `STREQ (a, b)' over `strcmp (a, b) == 0'.
3880         * src/date.c (batch_convert): Likewise.
3881         * src/expr.c (nextarg): Likewise.
3882         * src/su.c (correct_password, restricted_shell, main): Likewise.
3883         * src/ptx.c (swallow_file_in_memory, main): Likewise.
3884         * src/test.c (binary_operator, and, or, main): Likewise.
3885
3886 2004-05-13  Paul Eggert  <eggert@cs.ucla.edu>
3887
3888         * NEWS: echo compatibility cleanup.
3889         * doc/coreutils.texi (echo invocation): Document the changes.
3890         * src/echo.c (V9_ECHO): Remove; always enabled.
3891         (DEFAULT_ECHO_TO_XPG): Renamed from V9_DEFAULT, so that
3892         we use the same naming convention as bash.  Now an enum,
3893         not a macro.
3894         (usage): Reword to mention -e/-E more accurately.
3895         Mention \0NNN (the POSIX syntax) rather than \NNN (nonstandard).
3896         (hextobin): New function.
3897         (main): Use bool rather than int for local vars when appropriate.
3898         Do not allow options if POSIXLY_CORRECT, unless we are using
3899         BSD semantics and the first argument is "-n".
3900         Don't pass unnecessary extra arg to parse_long_options.
3901         do_v9 now defaults to DEFAULT_ECHO_TO_XPG, not to allow_options.
3902         Do not look for options if !allow_options.
3903         Use size_t rather than int when appropriate.
3904         Open-code option test rather than using strrchr.
3905         Use faster test for "-".
3906         Avoid redundant argc test.
3907         Add support for \x, for Bash compatibility.
3908         Use e.g. '\a' rather than '\007', for portability to EBCDIC hosts.
3909         When '\c' is encountered, stop printing immediately, as POSIX
3910         requires.
3911         Add support for \xhh syntax.
3912         Add support for \0ooo syntax; POSIX requires this.
3913
3914 2004-06-01  Jim Meyering  <jim@meyering.net>
3915
3916         * Use automake-1.8b.  Regenerate dependent files.
3917
3918 2004-05-31  Jim Meyering  <jim@meyering.net>
3919
3920         * tests/Makefile.am.in (TESTS_ENVIRONMENT): Define PATH to include
3921         the build src/ directory -- at the front.
3922         ($(srcdir)/$x-tests): Depend on Makefile.am.
3923         Use $x as the program name, except when it would be `test' (test is
3924         the sole program tested via mk-script that is also a shell built-in).
3925         In that case, use the old ../../src/$x.
3926
3927 2004-05-30  Jim Meyering  <jim@meyering.net>
3928
3929         Work around HPUX /bin/cc compiler bug that is exposed, now that
3930         sets are arrays of type `bool'.  More details here:
3931         http://lists.gnu.org/archive/html/bug-gnulib/2004-05/msg00094.html
3932         FIXME: verify that the above URL points to the right message
3933
3934         * src/tr.c (card_of_complement): Use cleaner `sizeof in_set'
3935         rather than `N_CHARS * sizeof(in_set[0])'.  Using HPUX's /bin/cc
3936         (aC++/ANSI C B3910B A.05.55 [Dec 04 2003]) on an ia64-hp-hpux11.22
3937         system, those two expressions are not the same (256 vs. 1024).
3938         The effect of this problem was that `tr -c x y' would fail:
3939         tr: when not truncating set1, string2 must be non-empty
3940         (set_initialize): Remove unnecessary initialization of the `in_set'
3941         buffer; that initialization triggered the same compiler bug as above.
3942
3943 2004-05-29  Paul Eggert  <eggert@cs.ucla.edu>
3944
3945         tr cleanup, mostly having to do with integer type ranges.
3946         Remove all casts.
3947
3948         * tests/tr/Test.pm: Add a few tests for the below.  Alas, most of
3949         the test cases wouldn't be portable, or would take too much CPU
3950         time, or both.
3951
3952         * src/tr.c (N_CHARS, N_CHAR_CLASSES): Now an enum, not a macro.
3953         This is safe since the code already assumes N_CHARS fits in int.
3954         (Filter): Remove: we want to prototype everything.
3955         (ORD, CHR): Remove.  All uses removed.  Some replaced with:
3956         (uchar): New function.  All places where a char must be converted
3957         to an unsigned char are now done this way, not by ad-hoc methods.
3958         (count): New type.  Use it whenever counts or states are needed.
3959         (BEGIN_STATE): Increase from INT_MAX - 1 (which was bogus, anyway,
3960         since we used it in an unsigned int context) to UINTMAX_MAX - 1.
3961         (REPEAT_COUNT_MAXIMUM): New macro.  Use it in place of BEGIN_STATE
3962         whenever appropriate.
3963         (NOT_A_CHAR): Remove global macro; now a local enum.
3964         (UL_LOWER, UL_UPPER, UL_NONE): No longer specify values, since
3965         the rest of the code no longer depends on them.
3966         (class_ok): Remove; all uses changed to use inline comparisons.
3967         (RE_NO_TYPE): Remove; wasn't used or needed.
3968         (struct List_element): normal_char and equiv_code are now unsigned
3969         char, not int.
3970         first_char, last_char, and the_repeated_char are now unsigned char,
3971         not unsigned int.  repeat_count is now count, not size_t.
3972         All uses changed.
3973         (struct Spec_list): state is now count, not unsigned int.
3974         lengthis now count, not size_t.
3975         n_indefinite_repeats is now size_t, not int.
3976         has_equiv_class, has_char_class, and has_restricted_char_class
3977         are now bool, not int.  All uses changed.
3978         (struct E_string): s is now char *, not unsigned char *.
3979         escaped is now bool *, not int *.  All uses changed.
3980         (ES_MATCH): Remove macro, replacing with:
3981         (es_match): New inline function.  All uses changed.
3982         (squeeze_repeats, complement, posix_pedantic, truncate_set1,
3983         translating): Now bool, not int.
3984         (io_buf): Now char array, not unsigned char.
3985         (SET_TYPE): Remove.  All uses replaced with bool.
3986         (is_equiv_class_member, unquote, append_range, append_char_class,
3987         append_equiv_class, find_closing_delim, star_digits_closebracket,
3988         build_spec_list, parse_str, homogeneous_spec_list):
3989         Now returns bool, not int.  All uses changed.
3990         (is_equiv_class_member): Now inline.
3991         (is_equiv_class_member, is_char_class_member, make_printable_str,
3992         append_normal_char, append_range, append_repeated_char,
3993         get_s2_spec_stats):
3994         Args are now of proper integer type.
3995         (unquote, look_up_char_class, make_printable_str,
3996         append_equiv_class, build_spec_list, squeeze_filter):
3997         Avoid unsigned char *p; gently convert *p to unsigned char instead.
3998         (unquote, get_spec_stats): Do not jump past declarations and then
3999         use them; C doesn't allow this in portable programs.
4000         (make_printable_str): Check for overflow in size calculations.
4001         (xmemdup): Remove.  All uses rewritten.
4002         (find_bracketed_repeat): Args are now of proper pointer-to-integer
4003         type.  Do not reject [c*0].  Use xstrtoumax, not xstrtoul.
4004         (find_bracketed_repeat, star_digits_closebracket): Check that the
4005         digits are not escaped.
4006         (build_spec_list): Don't bother to copy opnd_str; not needed.
4007         (build_spec_list, get_next): Simplify internal logic a bit.
4008         (card_of_complement): Fix bug due to char overflow.
4009         (get_spec_stats): Don't assume len fits into int.
4010         Check for integer overflow.  Use abort() rather than assert(0).
4011         (string2_extend): Fix subscript error: is_char_class_member (..., 255)
4012         was being invoked.
4013         (squeeze_filter): READER is never null now; simplify code.
4014         READER arg now has a simpler type.  Remove unnecessary casts.
4015         (squeeze_filter, main): Calls to fwrite improperly checked result
4016         against zero, rather than against requested size.
4017         (plain_read): New function.
4018         (read_and_delete, read_and_xlate):
4019         Remove unused filter arg, and don't worry about hit_eof.
4020         Simplify by using plain_read.
4021         (set_initialize): Args are bool and bool *, not int and SET_TYPE *.
4022         (main): Always pass a non-null procedure to squeeze_filter.
4023         Rewrite so that class_ok isn't needed.
4024
4025 2004-05-29  Paul Eggert  <eggert@cs.ucla.edu>
4026
4027         * src/shred.c (dosync): Ignore EBADF errors, as IRIX 6.5
4028         fdatasync reports EBADF when syncing (unwritable) directories.
4029         Problem reported by Albert Chin-A-Young in:
4030         http://lists.gnu.org/archive/html/bug-coreutils/2004-05/msg00165.html
4031
4032 2004-05-29  Jim Meyering  <jim@meyering.net>
4033
4034         * tests/chown/deref: Fix typo: use ls -ldo, not ls -ldg.
4035         Patch from Albert Chin.
4036
4037         * src/ptx.c (text_buffer_maxend): Remove declaration of unused variable.
4038
4039         * src/remove.c (push_dir): Merge declaration and adjacent assignment
4040         into a single statement.
4041
4042 2004-05-28  Jim Meyering  <jim@meyering.net>
4043
4044         * src/remove.c (AD_mark_helper): Eliminate an unnecessary comparison.
4045
4046 2004-05-22  Jim Meyering  <jim@meyering.net>
4047
4048         rm -r would get a failed assertion when run from an inaccessible
4049         directory and with two or more command line arguments including an
4050         absolute-named directory followed by a relative-named directory.
4051
4052         * src/remove.h (struct rm_options) [require_restore_cwd]: New member.
4053         * src/remove.c (struct cwd_state): Define.
4054         (AD_pop_and_chdir): Redesign interface so that a restore_cwd failure
4055         can be detected by the caller.  Instead of returning a malloc'd
4056         directory name, communicate it to caller via a new parameter, and
4057         return an indication of whether restore_cwd failed.  Update caller.
4058         Eliminate an unnecessary call to AC_stack_top.
4059         (remove_dir): Change type of cwd_state parameter to `struct cwd_state'
4060         so we can now communicate to caller whether/how functions like
4061         restore_cwd have failed.  Update caller.
4062         (rm_1): Fail if we've failed to restore the working directory
4063         and the name of the next file to remove is `.'-relative.
4064         (rm): Fail if the require_restore_cwd flag is true and we've
4065         failed to restore the working directory.
4066         * src/mv.c (rm_option_init): Initialize new member,
4067         x->require_restore_cwd.
4068         * src/rm.c (rm_option_init): Likewise.
4069
4070 2004-05-21  Jim Meyering  <jim@meyering.net>
4071
4072         * tests/rm/inaccessible: New test for the above fix.
4073         * tests/rm/Makefile.am (TESTS): Add inaccessible.
4074
4075         * src/remove.c (rm): Use free rather than XFREE.
4076         (remove_dir): Use xmalloc, not XMALLOC.
4077         (ds_init): Likewise.
4078
4079 2004-05-20  Jim Meyering  <jim@meyering.net>
4080
4081         * Makefile.maint (sc_unmarked_diagnostics): Now that the unmarked
4082         diagnostics in shred.c have been fixed, don't exempt shred.c from
4083         this check.
4084
4085         * src/shred.c: Use translatable diagnostics, e.g.
4086         change "%s: remove" to _("%s: failed to remove") and
4087         change "%s: close"  to _("%s: failed to close").
4088
4089 2004-05-17  Paul Eggert  <eggert@cs.ucla.edu>
4090
4091         * src/shred.c (names): Bring back lower-case letters, "_", and
4092         ".".  But continue to omit +, =, %, @, #, as they're either
4093         shell metacharacters (for some shells) or are not in some
4094         character sets, or (in the case of '%') must be a
4095         metacharacter somewhere.
4096
4097 2004-05-16  Paul Eggert  <eggert@cs.ucla.edu>
4098
4099         * src/cut.c (cut_fields): Adjust to new signature of getndelim2.
4100
4101 2004-05-17  Jim Meyering  <jim@meyering.net>
4102
4103         * src/shred.c (incname): Decrement `len' only once per loop iteration.
4104
4105         chgrp and chown now dereference symlinks by default, per POSIX.
4106         Reported by Michal Politowski as http://bugs.debian.org/249177.
4107
4108         * src/chown-core.c (chopt_init): Affect each symlink referent by default.
4109         * src/chown.c (usage): Update to reflect this.
4110         * src/chgrp.c (usage): Likewise.
4111         * NEWS: Describe the change.
4112         Adapt tests accordingly.
4113         * tests/chgrp/basic: Use -h where necessary to retain semantics.
4114         * tests/chgrp/deref: Likewise.
4115         * tests/chgrp/posix-H: Likewise.
4116
4117 2004-05-15  Paul Eggert  <eggert@cs.ucla.edu>
4118
4119         In shred, check for errors from fdatasync more carefully.  If
4120         fdatasync fails with errno==EINVAL, it means this implementation
4121         does not support synchronized I/O for this file.  Do not report
4122         this as an error, as (for example) AIX 5.2 fdatasync reports it
4123         for raw disk devices.  Problem reported by Albert Chin in
4124         <http://mail.gnu.org/archive/html/bug-gnu-utils/2004-05/msg00028.html>.
4125
4126         Check for write errors, though: the old code ignored them.
4127         Improve error checking in a few other cases, too (e.g., close of a
4128         directory).
4129
4130         Also, change several 'int' values to 'bool', so that the error
4131         checking is a bit clearer.  Similarly, change unsigned values
4132         to size_t where appropriate.
4133
4134         * src/shred.c: Include "dirname.h".
4135         (datasync) [!HAVE_FDATASYNC]: Remove.
4136         (dosync): New function.
4137         (dopass): Use it.  Return 1 on write error, -1 on other error.
4138         All callers changed.  Report write error if dosync does.
4139         (do_wipefd, wipefd, wipename, wipefile): Return bool (true/false),
4140         not int (0/-1).  All callers changed.  Return false if there's a
4141         write error.
4142         (incname): Return bool (true/false), not int (0/1).  Accept
4143         size_t length, not unsigned.  All callers changed.  Do not
4144         bother checking for non-digits; it can't happen.  Replace
4145         recursion with iteration.
4146         (wipename): Use dir_name, base_name, etc. instead of assuming
4147         Unix file names.  Use size_t for length, not unsigned.
4148         Report error if unlink or close fails.
4149         (wipename, main): Use bool for booleans.
4150
4151         (names): Use only digits and uppercase letters, for greater
4152         portability.
4153
4154 2004-05-16  Jim Meyering  <jim@meyering.net>
4155
4156         * tests/chown/deref: New test for the yesterday's change.
4157         * tests/chown/Makefile.am (TESTS): Add deref.
4158
4159 2004-05-15  Jim Meyering  <jim@meyering.net>
4160
4161         chown --dereference did nothing when the owner/group of a
4162         symlink matched the desired owner/group.  Reported by David Malone.
4163         Also reported in 1999 as http://bugs.debian.org/39642.
4164
4165         * src/chown-core.c (change_file_owner): When --dereference has
4166         been specified, and when processing a symlink, stat it to get the
4167         owner and group of the referent.
4168
4169 2004-05-14  Jim Meyering  <jim@meyering.net>
4170
4171         * man/pwd.x, man/echo.x, man/printf.x: Fix typo:
4172         s/supercede/supersede/ reported by Andrew Fabbro.
4173
4174 2004-05-13  Paul Eggert  <eggert@cs.ucla.edu>
4175
4176         Improve performance of `sort -m' on large files, at the cost of
4177         making some contrived examples unsafe.  POSIX allows this
4178         optimization.  Performance problem reported by Jonathan Baker in
4179         <http://mail.gnu.org/archive/html/bug-coreutils/2004-05/msg00071.html>.
4180
4181         * src/sort.c (first_same_file): Do not treat input pipes
4182         differently from other files.
4183         * doc/coreutils.texi (sort invocation): Document that "sort -m -o F"
4184         might write F before reading all the input.
4185         * NEWS: Likewise.
4186
4187 2004-05-12  Paul Eggert  <eggert@cs.ucla.edu>
4188
4189         * src/od.c (print_ascii, dump_strings): Use e.g. '\a' rather than
4190         '\007', for portability to EBCDIC hosts.
4191         * src/printf.c (print_esc_char): Likewise.
4192         * src/tr.c (unquote, make_printable_str): Likewise.
4193
4194 2004-05-12  Jim Meyering  <jim@meyering.net>
4195
4196         * src/remove.c (AD_pop_and_chdir): Move lstat-`.' into if-block
4197         where the result is used.  This avoids one unnecessary lstat call
4198         per command line argument.
4199
4200 2004-05-12  Paul Eggert  <eggert@cs.ucla.edu>
4201
4202         Don't assume that "make -C" works; Solaris "make" doesn't have -C.
4203
4204         * src/Makefile.am (all_programs.list): New rule, copied from
4205         man/Makefile.am and tests/Makefile.am, except that we use the
4206         system tr rather than ./tr and we don't use tr -s.
4207         * tests/Makefile.am (all_programs): Use it.
4208         * man/Makefile.am (all_programs): Likewise.  Renamed from programs,
4209         for consistency.  All uses changed.
4210
4211 2004-05-11  Jim Meyering  <jim@meyering.net>
4212
4213         * tests/rm/unread3: New test, for the above fix and today's
4214         lib/save-cwd.c improvement.
4215         * tests/rm/Makefile.am (TESTS): Add unread3.
4216
4217         * src/rm.c: Don't include "save-cwd.h".  It's no longer used.
4218
4219 2004-05-10  Jim Meyering  <jim@meyering.net>
4220
4221         * tests/install/trap: New file.  Test for bug fix of 2004-04-18.
4222         * tests/install/Makefile.am (TESTS): Add trap.
4223
4224         * src/remove.c (AD_push): Don't use errno in diagnostic about
4225         `changed dev/ino'.
4226
4227         Remove these generated files from CVS.
4228         * tests/cut/cut-tests, tests/date/date-tests, tests/join/join-tests:
4229         * tests/ls/ls-tests, tests/pr/pr-tests, tests/tac/tac-tests:
4230         * tests/tail/tail-tests, tests/test/test-tests, tests/tr/range-tests:
4231         * tests/tr/tr-tests, tests/wc/wc-tests:
4232
4233 2004-05-09  Jim Meyering  <jim@meyering.net>
4234
4235         * src/tr.c (unquote): Use xcalloc rather than xmalloc and
4236         a loop initializing the just-allocated memory to zero.
4237
4238 2004-05-08  Jim Meyering  <jim@meyering.net>
4239
4240         * tests/rm/no-give-up: New file; check for today's fix.
4241         * tests/rm/Makefile.am (TESTS): Add no-give-up.
4242
4243 2004-05-08  Paul Eggert  <eggert@cs.ucla.edu>
4244
4245         Fix bug where "rm" gave up too easily, reported by Dan Jacobsen in
4246         <http://mail.gnu.org/archive/html/bug-coreutils/2004-05/msg00013.html>.
4247
4248         * src/remove.c (remove_entry): Check for errno values like ENOENT
4249         that show the file cannot be directory, instead of for errno
4250         values like EPERM that show the file might be a directory.  This
4251         is necessary because, when a single unlink() call has multiple
4252         reasons to fail, it can set errno to any of those reasons; it's
4253         only the rare errno value like ENOENT that excludes all the other
4254         possible reasons to fail even when the file is a directory.
4255         (remove_cwd_entries): Don't attempt chdir if the file is known
4256         to not be a directory.
4257         (remove_dir): Use the same method that remove_cwd_entries uses
4258         (for some reason they differed).  Don't assert that saved_errno
4259         must be EPERM; it might be just about anything.
4260
4261 2004-05-06  Jim Meyering  <jim@meyering.net>
4262
4263         * src/id.c (xgetgroups): Use xnmalloc, rather than xmalloc.
4264         Don't add `1' to the buffer size (it was to protect against malloc
4265         implementations that fail to allocate a buffer of size zero).
4266         That is no longer necessary, since we use a malloc wrapper
4267         on such systems.
4268
4269         * src/wc.c (get_input_fstatus): Use xnmalloc, rather than xmalloc.
4270         * src/head.c (elide_tail_bytes_pipe): Likewise.
4271         * src/df.c (main): Likewise.
4272         * src/shred.c (do_wipefd): Likewise.
4273         * src/users.c (list_entries_users): Likewise.
4274         * src/tail.c (main): Likewise.
4275         * src/md5sum.c (main): Likewise.
4276
4277 2004-04-29  Paul Eggert  <eggert@cs.ucla.edu>
4278
4279         * src/df.c (show_disk, show_point): If several filesystems are
4280         mounted on the same mount point, prefer the last one, not the first.
4281         Problem reported by Christian Jones in
4282         <http://mail.gnu.org/archive/html/bug-coreutils/2004-04/msg00200.html>.
4283         (show_disk): Remove unused statp arg.  Return bool, not int.
4284         (show_point): Rewrite to avoid gotos.  Use the same algorithm
4285         for lofs and dummies for each pass through the mount table,
4286         rather than subtly different algorithms (which are probably
4287         inadvertent).
4288
4289 2004-05-03  Jim Meyering  <jim@meyering.net>
4290
4291         * Makefile.am (EXTRA_DIST): Add m4/ChangeLog, now that we no longer
4292         have m4/Makefile*.
4293
4294 2004-05-01  Jim Meyering  <jim@meyering.net>
4295
4296         When chown or chgrp is modifying the referent of a symlink,
4297         use the chown(2) function, if possible.
4298         * src/chown-core.c (change_file_owner): Don't hard-code the
4299         open/fchown/close kludge here.  Use `chown' instead.
4300         The chown function works just fine on conforming systems.
4301         Other systems now go through the new chown wrapper that
4302         resorts to the old kludge.
4303
4304         * src/chown-core.c (change_file_owner): Add a comment.
4305
4306 2004-04-27  Jim Meyering  <jim@meyering.net>
4307
4308         * src/ptx.c: Make over 40 global extern variables `static'.
4309         (syntax_table, re_syntax_table): Remove declarations of two unused
4310         variables (they were exposed by the above change).
4311
4312         * src/du.c (G_fail, opt_nul_terminate_output): Declare `static'.
4313         * src/ln.c (backup_type): Likewise.
4314
4315         * src/remove.c (rm): Add `extern' keyword.
4316         * src/cp-hash.c (forget_created, remember_created)
4317         (src_to_dest_lookup, remember_copied, hash_init, forget_all): Likewise.
4318         * src/copy.c (dest_info_init, src_info_init, copy): Likewise.
4319         * src/chown-core.c (chopt_init, chopt_free, gid_to_name)
4320         (uid_to_name, chown_files): Likewise.
4321
4322         * src/Makefile.am (sc_tight_scope): New rule.
4323         * Makefile.maint (sc_tight_scope): New rule.
4324         (syntax-check-rules): Add it.
4325
4326 2004-04-26  Jim Meyering  <jim@meyering.net>
4327
4328         * Use automake-1.8.4.  Regenerate dependent files.
4329
4330         * src/sort.c (limfield): Make a comment clearer.
4331
4332 2004-04-25  Paul Eggert  <eggert@twinsun.com>
4333
4334         Fix POSIX-conformance bug: "sort -k 3,3.5b" is supposed to skip
4335         leading blanks when computing the location of the field end;
4336         it is not supposed to skip trailing blanks.  Solaris 8 "sort"
4337         does conform to POSIX.  Also fix the documentation to clarify
4338         this and related issues.
4339
4340         * doc/coreutils.texi (sort invocation): Mention -k earlier, so
4341         that the options are in alphabetical order.  Describe how -b works
4342         more-accurately; this involves fixing some examples, too.  Mention
4343         what happens if the start field falls after an end field or after
4344         a line end.  Warn about using -k without -b, -g, -M, -n, or -t.
4345         Add an example of how to sort IPv4 addresses and Apache Common
4346         Log Format dates.  Remove a duplicate example.
4347         (Putting the tools together): Use separate options rather
4348         than agglomerating them.
4349         * src/sort.c (limfield): Use skipeblanks, not skipsblanks, to
4350         decode whether to skip leading blanks.
4351         (trailing_blanks): Remove.
4352         (fillbuf, getmonth, keycompare): Don't trim trailing blanks.
4353
4354         * tests/pr/Test.pm: Fix typo in env_default comment.
4355         * tests/sort/Test.pm: Likewise.
4356         (18c, 18d): Reverse the order of output lines, so that the
4357         test cases conform to POSIX.
4358
4359 2004-04-22  Paul Eggert  <eggert@twinsun.com>
4360
4361         More signal-handling cleanup for ls.c.  Do not allow signals to
4362         happen between arbitrary output bytes, as the
4363         restore-default-color sequence can bollix up multibyte chars or
4364         color-change sequences in the ordinary output.  Instead, process
4365         signals only between printing a file name and changing the color
4366         back to non_filename_text color.  That way, if the signal handler
4367         changes the color (to the default), 'ls' will change it back when
4368         'ls' continues (after being suspended).
4369
4370         Also, do not bother with signal-handling unless stdout is a
4371         controlling terminal; this lets stdio buffer better when "ls
4372         --color" is piped or sent to a file.
4373
4374         * src/ls.c (sigprocmask, sigset_t) [!defined SA_NOCLDSTOP]: New macros.
4375         Do not include "full-write.h"; no longer needed.
4376         (tcgetpgrp) [! HAVE_TCGETPGRP]: New macro.
4377         (put_indicator_direct): Remove.  All callers changed to use
4378         put_indicator.
4379         (caught_signals, interrupt_signal, stop_signal_count): New vars.
4380         (restore_default_color): Don't bother checking for put_indicator
4381         failure.
4382         (sighandler): Don't handle SIGTSTP; that's another handler now.
4383         Simply set interrupt_signal to the signal, then exit.
4384         (stophandler, process_signals): New functions.
4385         (main): Don't output any color changes until _after_ the signal
4386         handlers are set up.  This fixes a race condition where 'ls'
4387         could be interrupted while initializing colors, and leaving the
4388         terminal in an undesirable state.
4389         Don't mess with signal-handling if standard output is not a
4390         controlling terminal.
4391         When exiting, restore the default color, then restore the
4392         default signal handling, then act on any signals that weren't
4393         acted on yet.
4394         Do not print //DIRED// etc. in colors; this avoids the need
4395         to catch signals when printing them.
4396         (print_name_with_quoting): Process signals just before switching
4397         color back to non_filename_text.
4398
4399 2004-04-23  Jim Meyering  <jim@meyering.net>
4400
4401         Avoid segfault on systems for which SIZE_MAX != (size_t) -1.
4402         * src/ls.c (quote_name): Use SIZE_MAX, not -1, in calls
4403         of quotearg_buffer.  Patch by Mikulas Patocka.
4404
4405 2004-04-18  Paul Eggert  <eggert@twinsun.com>
4406
4407         tee ignored SIGPIPE, but POSIX doesn't allow this.
4408
4409         * src/tee.c (main): Do not ignore SIGPIPE, as POSIX 1003.1-2001
4410         does not allow this.  This undoes the 1996-10-24 patch.
4411
4412 2004-04-18  Paul Eggert  <eggert@twinsun.com>
4413
4414         Signal-handling cleanup for coreutils.  Here are the highlights:
4415
4416          - csplit sometimes failed to remove files when interrupted.
4417          - csplit didn't clean up if two signals arrived nearly simultaneously.
4418          - install -s would infloop on System V if SIGCHLD was ignored.
4419          - ls could incorrectly restore color if multiple signals
4420            arrived nearly simultaneously.
4421
4422         * src/csplit.c (sigprocmask, sigset_t) [!defined SA_NOCLDSTOP]:
4423         Define.
4424         (filename_space, prefix, suffix, digits, files_created, remove_files):
4425         Now volatile.
4426         (caught_signals): New var.
4427         (cleanup): Block signals while deleting all files.
4428         (cleanup_fatal, handle_line_error, regexp_error):
4429         Mark with ATTRIBUTE_NORETURN.
4430         (create_output_file, close_output_file, interrupt_handler):
4431         Block signals while changing the number of output files,
4432         to fix some race conditions.
4433         (delete_all_files): Do nothing if remove_files is zero.
4434         Clear files_created.
4435         (main): Don't mess with signals until after argument processing
4436         is done.
4437
4438         * src/csplit.c (main): Rewrite signal-catching code to make it
4439         similar to other coreutils programs.  When processing signals,
4440         block all signals that we catch, but do not block signals that we
4441         don't catch.  Avoid problems with unsigned int warnings.
4442         * src/ls.c (main): Likewise.
4443         * src/sort.c (main): Likewise.
4444
4445         * src/csplit.c (interrupt_handler):
4446         Use void, not (obsolete) RETSIGTYPE.
4447         * src/shred.c (sigill_handler, isaac_seed_machdep): Likewise.
4448
4449         * src/csplit.c (interrupt_handler) [defined SA_NOCLDSTOP]:
4450         Use simpler "signal (sig, SIG_DFL)" rather than sigaction equivalent.
4451         * src/ls.c (sighandler) [defined SA_NOCLDSTOP]: Likewise.
4452         * src/sort.c (sighandler) [defined SA_NOCLDSTOP]: Likewise.
4453         * src/nohup.c (main) [!defined _POSIX_SOURCE]: Likewise, except
4454         for SIG_IGN.
4455         * src/tee.c (main) [!defined _POSIX_SOURCE]: Likewise.
4456
4457         * src/install.c: Include <signal.h>.
4458         (main) [defined SIGCHLD]: Set SIGCHLD handler to the default, if -s is
4459         given, since System V fork+wait does not work if SIGCHLD is ignored.
4460
4461         * src/ls.c (sighandler) [!defined SA_NOCLDSTOP]: Reset signal
4462         handler to self, not to SIG_IGN, since SIGTSTP can be received
4463         more than once.
4464         (main): Use SA_RESTART, as that is simpler than checking for EINTR
4465         failures all over the place.
4466
4467 2004-04-20  Jim Meyering  <jim@meyering.net>
4468
4469         * src/remove.c (is_empty_dir): Clarify comment.
4470
4471         * man/help2man: Accept new option: --program-name=NAME, so that we
4472         can override the one in --version output.  This is needed solely
4473         so that test.1 doesn't refer to `[' as the program name.
4474         Reported by Benjamin Cutler as http://bugs.debian.org/205251.
4475         * man/Makefile.am (.x.1): Use help2man's new --program-name option.
4476
4477         * src/pwd.c: Don't include pathmax.h; system.h already does it.
4478
4479         * src/cut.c (cut_fields): Free buffer upon getndelim2 failure.
4480
4481 2004-04-19  Jim Meyering  <jim@meyering.net>
4482
4483         * src/shred.c (isaac_seed_start) [AVOID_USED_UNINITIALIZED_WARNINGS]:
4484         Initialize a buffer to avoid warnings from tools like valgrind.
4485
4486         * Makefile.maint (sc_trailing_blank): New rule.
4487         (syntax-check-rules): Add it.
4488         * .x-sc_trailing_blank: New file.
4489
4490         Make pwd work even if the resulting name is so long that getcwd fails.
4491         * src/pwd.c: (path_free, path_init, path_prepend): New functions.
4492         (nth_parent, find_dir_entry, robust_getcwd): New functions.
4493         (main): First try getcwd, then, upon failure, robust_getcwd.
4494
4495 2004-04-18  Jim Meyering  <jim@meyering.net>
4496
4497         * src/who.c (print_user): Use xrealloc here, rather than
4498         unchecked realloc.  Remove anachronistic casts.
4499
4500         * src/remove.c (full_filename_): Don't leak upon failed realloc.
4501
4502         * src/system.h (readdir_ignoring_dot_and_dotdot): New inline function,
4503         from remove.c.
4504         * src/remove.c (readdir_ignoring_dotdirs): Move function to system.h,
4505         renaming it.  Update uses.
4506
4507 2004-04-17  Jim Meyering  <jim@meyering.net>
4508
4509         * configure.ac: Depend on automake-1.8.3.
4510
4511         * src/join.c (add_file_name): Declare function to be `static'.
4512         (string_to_join_field): Likewise.
4513         * src/remove.c (ds_init, ds_free): Likewise.
4514
4515         * Makefile.maint (sc_prohibit_jm_in_m4): New rule.
4516         (syntax-check-rules): Add to the list.
4517
4518 2004-04-13  Paul Eggert  <eggert@twinsun.com>
4519
4520         Use page-aligned buffers whenever we bother to do I/O using buffer
4521         sizes that are tailored for the files.
4522
4523         * src/cat.c: Include getpagesize.h.
4524         * src/copy.c: Likewise.
4525         * src/shred.c: Likewise.
4526         * src/split.c: Likewise.
4527         * src/cat.c (main): Align I/O buffers to page boundaries.
4528         * src/copy.c (copy_reg): Likewise.
4529         * src/shred.c (dopass): Likewise.
4530         * src/split.c (main): Likewise.
4531         * src/dd.c (ROUND_UP_OFFSET, PTR_ALIGN): Remove.
4532         All uses replaced by ptr_align.
4533         * src/od.c (gcd, lcm): Remove; now in system.h.
4534         * src/system.h (gcd, lcm, ptr_align): New functions, moved from od.c.
4535
4536 2004-04-14  Jim Meyering  <jim@meyering.net>
4537
4538         Remove m4/Makefile.am: it's no longer needed, with newer automake
4539         * configure.ac (AC_CONFIG_FILES): Remove m4/Makefile.in from the list.
4540         * Makefile.am (SUBDIRS): Remove `m4' from the list.
4541
4542 2004-04-13  Jim Meyering  <jim@meyering.net>
4543
4544         * configure.ac: Change `jm_' in AC_DEFINE'd names to `gl_'.
4545
4546 2004-03-27  Paul Eggert  <eggert@twinsun.com>
4547
4548         * NEWS: cp -pu and mv -u (when copying) now take the destination
4549         file system time stamp resolution into account.
4550         * doc/coreutils.texi (mv invocation): Document this.
4551         (cp invocation): Document -u (it was missing!) with new behavior.
4552
4553         * src/copy.c: Include "utimecmp.h".
4554         (copy_internal): Compare time stamps using utimecmp rather than
4555         MTIME_CMP.
4556
4557 2004-04-09  Jim Meyering  <jim@meyering.net>
4558
4559         * Makefile.maint (.re-list): New rule/file, to replace
4560         hard-coded list of header file names.
4561         (sc_system_h_headers): Use the new file.
4562         Don't look for sys2.h anymore.
4563
4564         * src/system.h: Include new "stat-macros.h" rather than hard-coding
4565         all of its macro definitions -- the list was slightly out of date.
4566         Suggestion from Dmitry V. Levin.
4567
4568 2004-04-08  Paul Eggert  <eggert@cs.ucla.edu>
4569
4570         * NEWS: Remove noctty flag from dd.  Suggested by Philippe Troin.
4571         * doc/coreutils.texi (dd invocation): Likewise.
4572         * src/shred.c (O_NOCTTY): Remove redundant decl.
4573         * src/dd.c (flags, usage): Remove noctty flag.
4574         (main): Always use O_NOCTTY when opening files.
4575
4576 2004-04-08  Jim Meyering  <jim@meyering.net>
4577
4578         * src/dd.c (dd_copy): Mark two diagnostics for translations.
4579         (set_fd_flags): Undo part of today's change: it's a little
4580         cleaner -- and more efficient in the common case -- to go
4581         ahead and OR in the -1 when fcntl fails.
4582
4583         * Makefile.maint (sc_dd_max_sym_length): New target.
4584         (syntax-check-rules): Add it.
4585
4586         * src/md5sum.c (PROGRAM_NAME) [algorithm == ALG_SHA1]:
4587         Correct spelling: s/shasum/sha1sum.  Reported by Jesse Kornblum.
4588
4589         * src/dd.c (set_fd_flags): Don't OR in -1 when fcntl fails.
4590         Rename parameter, flags, to avoid shadowing global.
4591         (LONGEST_SYMBOL): Tweak comment.
4592
4593 2004-04-07  Paul Eggert  <eggert@twinsun.com>
4594
4595         * NEWS: New dd conv= symbols nocreat, excl, fdatasync, fsync,
4596         and new dd options iflag= and oflag=.
4597         * src/dd.c (usage): Likewise.
4598         * src/Makefile.am (dd_LDADD, shred_LDADD): Add fdatasync's lib.
4599         * src/dd.c (fdatasync) [!HAVE_FDATASYNC]: New macro.
4600         (C_NOCREAT, C_EXCL, C_FDATASYNC, C_FSYNC): New macros.
4601         (input_flags, output_flags): New vars.
4602         (LONGEST_SYMBOL): New macro.
4603         (struct symbol_value): Renamed from struct conversion.  Members
4604         symbol and value renamed from convname and conversion.  The
4605         symbol value is now an array instead of a pointer; this saves
4606         a bit of space and time in practice.  All uses changed.
4607         (conversions): Add nocreat, excl, fdatasync, fsync.  Now const.
4608         (flags): New constant array.
4609         (iflag_error_msgid, oflag_error_msgid): New constants.
4610         (parse_symbols): Renamed from parse_conversion and generalized
4611         to handle either conversion or flag symbols.
4612         (scanargs): Adjust uses of parse_symbols accodingly.  Add
4613         support for iflag= and oflag=.  Reject attempts to use
4614         both excl and nocreat.
4615         (set_fd_flags): New function.
4616         (dd_copy): Just return X rather than calling quit (X), since our
4617         caller invokes quit with the returned value.  Add support for
4618         fdatasync and fsync.
4619         (main): Add support for iflag=, oflag=, and new conv= symbols.
4620         * src/system.h (O_DIRECT, O_DSYNC, O_NDELAY, O_NOFOLLOW,
4621         O_RSYNC, O_SYNC): Define to 0 if not already defined.
4622
4623         * NEWS: Remove duplicate mention of BLOCKSIZE.
4624
4625 2004-04-02  Andreas Schwab  <schwab@suse.de>
4626
4627         * src/stty.c: Add support for IUTF8 input flag.
4628
4629 2004-04-06  Jim Meyering  <jim@meyering.net>
4630
4631         * src/system.h (makedev) [mkdev && !makedev]: Define in terms of mkdev.
4632         Interix spells it `mkdev'.  Reported by Mark Funkenhauser.
4633
4634 2004-04-04  Jim Meyering  <jim@meyering.net>
4635
4636         A specified format is no longer automatically newline terminated.
4637         If you want a newline at the end of your format, use `\n'.
4638         * src/stat.c (print_it): Don't print a newline at the end of
4639         every format.
4640         (do_statfs): Add a newline at end of each default format string.
4641
4642 2004-03-30  Paul Eggert  <eggert@twinsun.com>
4643
4644         * src/nohup.c (main): Adjust to new calling convention
4645         for set_cloexec_flag.
4646
4647 2004-03-31  Jim Meyering  <jim@meyering.net>
4648
4649         * tests/Fetish.pm (run_tests): Remove `.orig' file.
4650         Remove debugging diagnostic.
4651
4652         Specifying an invalid --width=N (-w) or --gap-size=N (-g)
4653         would not elicit an error.
4654         * src/ptx.c: Include "xstrtol.h" and "quotearg.h".
4655         (main): Don't use atoi.  Use xstrtoul instead.
4656
4657 2004-03-30  Jim Meyering  <jim@meyering.net>
4658
4659         * Makefile.maint (sc_prohibit_atoi_atof): New rule.
4660         (syntax-check-rules): Add it.
4661         * .x-sc_prohibit_atoi_atof: New file.
4662
4663 2004-03-29  Jim Meyering  <jim@meyering.net>
4664
4665         * tests/du/files0-from: Use new OUT_SUBST directive, so that this
4666         test is not sensitive to system-dependent block size differences.
4667         Prompted by a report of Solaris 8 differences from Paul Eggert.
4668
4669         * tests/Fetish.pm: Accept new directives: OUT_SUBST, ERR_SUBST.
4670         Rename `%tmp' to `%actual'.  Reverse order of last two args to
4671         _compare_files (to $actual, $expected) so as to match declaration.
4672
4673 2004-03-28  Paul Eggert  <eggert@twinsun.com>
4674
4675         Fix some gotchas encountered when porting to Solaris 8, using
4676         the Forte 6u2 compiler.
4677
4678         * src/hostname.c [HAVE_SETHOSTNAME && !defined sethostname]:
4679         Declare sethostname, since no Solaris header does it.
4680         * src/who.c: Include "vasprintf.h", for asprintf.
4681
4682 2004-03-28  Jim Meyering  <jim@meyering.net>
4683
4684         Minor optimization:
4685         * src/du.c (process_file): Don't record dev/inode for directories.
4686
4687         Under some circumstances, without -c, du would mistakenly count the
4688         space of hard-linked files, not just the first one it encountered.
4689         Reported by Anthony Thyssen.
4690         * src/du.c (du_files): Don't ever clear the set of `seen' dev/inodes.
4691
4692         * src/du.c: Rename global `print_totals' to `print_grand_total'.
4693
4694         * src/du.c (main): Rearrange filtering loop to be a tiny bit
4695         more efficient.
4696
4697         * src/chown-core.c: Don't include savedir.h -- no longer needed.
4698         * src/chmod.c: Likewise.
4699
4700 2004-03-25  Jim Meyering  <jim@meyering.net>
4701
4702         * src/du.c (main): Remove now-unused declaration of `i'.
4703
4704 2004-03-24  Paul Eggert  <eggert@twinsun.com>
4705
4706         * src/du.c (main): Filter out file names of length zero before
4707         invoking fts, so that they don't cause fatal errors.
4708
4709 2004-03-25  Jim Meyering  <jim@meyering.net>
4710
4711         * tests/du/files0-from (zero-len): Add a test for the above.
4712
4713 2004-02-25  Paul Eggert  <eggert@twinsun.com>
4714
4715         * NEWS: New environment var BLOCKSIZE.
4716         * lib/human.c (humblock): Support BLOCKSIZE as well as BLOCK_SIZE.
4717         * tests/envvar-check: Test for it.  Factor the code to simplify it.
4718
4719 2004-03-23  Paul Eggert  <eggert@twinsun.com>
4720
4721         * NEWS: Shorten the du --files0-from announcement, and say
4722         "NUL-terminated" rather than "NUL-separated".
4723         * src/du.c (EXPECTED_BYTES_PER_FILE_NAME, DEFAULT_PROJECTED_N_FILES):
4724         Remove: not used.
4725         (usage): Say "NUL-terminated", not "NUL-separated".
4726         (main): Check for I/O error when istream is closed.
4727         Allow --files0-from=F even if F is empty; this specifies no files.
4728         (du_files): Now that we allow the list of files to be empty,
4729         handle that case.
4730         * tests/du/files0-from: Adjust to above changes to src/du.c.
4731
4732 2004-03-24  Jim Meyering  <jim@meyering.net>
4733
4734         * tests/tail-2/assert: Avoid race condition that could cause
4735         spurious failure.  Based on a patch from Andreas Schwab.
4736
4737 2004-03-23  Jim Meyering  <jim@meyering.net>
4738
4739         * src/du.c (main): Free the hash table, too.
4740
4741 2004-03-22  Jim Meyering  <jim@meyering.net>
4742
4743         * man/Makefile.am (.x.1): Remove --info-page= option, reverting
4744         the change of 2004-01-22.  I can no longer reproduce the problem
4745         that prompted that change, and `info coreutils pr' would display the
4746         `printing text' section of the manual, not the one on `pr invocation'.
4747
4748         * tests/du/files0-from (nul-1, nul-2): Adjust expected diagnostics
4749         to match corrected output.
4750
4751         * src/du.c: Include "readtokens0.h" rather than "readtokens.h".
4752         (main): Use readtoken0 functions rather than readtokens.
4753         Don't use errno when diagnosing readtokens0 failure.
4754         Fix off-by-one error in the token number reported in a diagnostic.
4755         (du_files): Return bool, rather than int.
4756         (main): Call readtokens0_free.
4757
4758 2004-03-21  Jim Meyering  <jim@meyering.net>
4759
4760         * src/remove.c (ds_free): Plug a small leak.
4761
4762         * tests/Fetish.pm: Fix typo in comment.
4763
4764 2004-03-07  Jim Meyering  <jim@meyering.net>
4765
4766         * NEWS: du accepts a new option --files0-from=FILE, where FILE
4767         contains a list of NUL-separated file names.
4768
4769         * src/du.c: Include "readtokens.h".
4770         (usage): Describe the new option, and adjust the `Usage':
4771         with this option, no FILE may be specified on the command line.
4772         (main): Handle the new option.
4773
4774         * tests/du/files0-from: New tests, for the above.
4775         * tests/du/Makefile.am (TESTS): Add files0-from.
4776
4777         * src/factor.c (do_stdin): Reflect changes in use of readtoken.
4778         * src/tsort.c (tsort): Likewise.
4779
4780 2004-02-29  Paul Eggert  <eggert@twinsun.com>
4781
4782         * NEWS: Add support for a new notation @N to get_date to represent
4783         the time stamp with numeric value N.  Improve support for
4784         fractional time stamps.  date's -d and -f options now accept them.
4785         Likewise for touch -t.  date has a new option --iso-8601=ns.
4786
4787         * doc/coreutils.texi (touch invocation):
4788         Describe use of fractional seconds.
4789         (date invocation, Options for date): Likewise.
4790         * doc/getdate.texi (General date syntax, Time of day items): Likewise.
4791         * doc/coreutils.texi (date invocation): Mention effect of LC_TIME.
4792         (Options for date): Describe new --iso-8601=ns option.
4793
4794         * doc/getdate.texi: Add copyright notice.  Change getdate to
4795         get_date when talking about the function name.
4796         (Seconds since the Epoch): New section, containing the time_t
4797         info moved from Date input formats section, along with new
4798         info about the @ syntax.  Mention negative time stamps,
4799         fractional time stamps, and leap seconds.
4800         (General date syntax): Modernize examples a bit to reflect new
4801         features.
4802         (General date syntax, Relative items in date strings):
4803         Use ' rather than " to quote formats.
4804         (Time of day items): Add an example with fractional seconds.
4805         Describe fractional-second syntax.
4806
4807         * src/Makefile.am (touch_LDADD): New macro, since `touch' now
4808         needs clock_gettime.
4809
4810         * src/date.c (enum Time_spec): New enum TIME_SPEC_NS.
4811         (time_spec_string, time_spec, show_date): Support it.
4812         (usage): Remove description of -ITIMESPEC, as it's obsolete and
4813         confusing.  Mention --iso-8601=ns.
4814         (batch_convert): getline returns ssize_t, not int.
4815
4816         * src/touch.c (newtime): Now an array of two timespecs, one
4817         for access and one for modification.
4818         (ref_stats): Remove.
4819         (get_reldate): Use get_date's parameter profile.
4820         (touch, main): Adjust to above changes.
4821         (main): Work even if tm_year == INT_MAX (so long as long int is wider).
4822         Use gettime instead of gettimeofday, for new get_date signature.
4823
4824         * tests/date/Test.pm (test_vector): New tests epoch, ns-10, ns-max32,
4825         ns-relative.
4826
4827 2004-03-15  Jim Meyering  <jim@meyering.net>
4828
4829         * Makefile.maint (alpha beta major): `Make' the emit_upload_commands
4830         target before updating $(prev_version_file).
4831
4832         * tests/misc/date-sec: New file, to test for just-fixed bug in date.
4833         See today's change in lib/getdate.y.
4834         * tests/misc/Makefile.am (TESTS): Add date-sec.
4835
4836 2004-03-14  Jim Meyering  <jim@meyering.net>
4837
4838         * announce-gen (print_changelog_deltas): Use `.sig' suffix for
4839         signature files, not `.asc'.  Reported by angico@yahoo.com.
4840
4841 2004-03-13  Jim Meyering  <jim@meyering.net>
4842
4843         * src/cp.c (do_copy): Tweak wording in a diagnostic.
4844         Suggestion from Karl Berry.
4845         Include "quoatearg.h".
4846         (do_copy): Use quotearg_colon (not quote) for diagnostics
4847         that begin with `"%s:'.
4848
4849         * src/nl.c (usage): Specify that nl uses _basic_ regular expressions.
4850         Suggestion from Dan Jacobson.
4851
4852 2004-03-12  Jim Meyering  <jim@meyering.net>
4853
4854         * Version 5.2.1.
4855
4856         Sometimes, when source and destination partition are different,
4857         mv mistakenly fails to preserve a hard link.  Reported by IIDA Yosiaki.
4858
4859         * src/copy.c: When moving a set of N hard-linked files between
4860         partitions, via two or more command line arguments where the
4861         command line argument containing the Nth link contains no other
4862         link to that same file, mv would mistakenly copy the file, rather
4863         than hard-linking it to the other(s).  That happens because when the
4864         final link is processed, its link count has been reduced to 1 since
4865         the other links have been `copied' to the destination partition
4866         and the source links have been removed.
4867         (copy_internal): When in move mode, use the source dev/inode
4868         pair to look up destination name even when st_nlink == 1.
4869         * src/cp-hash.c (src_to_dest_lookup): New function.
4870         * src/cp-hash.h (src_to_dest_lookup): Add prototype.
4871         * tests/mv/part-hardlink: New file.  Test for the above fix.
4872         * tests/mv/Makefile.am (TESTS): Add part-hardlink.
4873
4874         * announce-gen: Sync with autoconf.
4875
4876         * tests/ls/time-1: Exit 77 (not 1) if we can't set up for the test.
4877         This was triggered on a Linux-2.2.19 system using a file system
4878         NFS-mounted from some sort of Sun.
4879
4880 2004-03-11  Jim Meyering  <jim@meyering.net>
4881
4882         * Use automake-1.8.3.  Regenerate dependent files.
4883
4884 2004-03-10  Jim Meyering  <jim@meyering.net>
4885
4886         * tests/du/deref-args: Also convert sizes in the 70-79 kB range,
4887         so that this test works with SELinux-enabled systems.
4888         Based on a patch from Tim Waugh.
4889
4890         `join -1 x' would give a misleading diagnostic
4891         * src/join.c (string_to_join_field): Report that a non-numeric field
4892         number is invalid, rather than `so large that it is not representable'.
4893         * tests/join/Test.pm (invalid-j): New partial test for the above fix.
4894
4895 2004-03-06  Jim Meyering  <jim@meyering.net>
4896
4897         cp --sparse=always sparse-image-file.img /dev/hda1 could
4898         produce an invalid copy on the destination device.
4899
4900         * src/copy.c (copy_reg): Even with --sparse=always, try to
4901         make `holes' only if the destination is a regular file.
4902         Reported by Szakacsits Szabolcs.
4903
4904 2004-03-03  Paul Eggert  <eggert@twinsun.com>
4905
4906         * src/nohup.c (main): Don't invoke set_cloexec_flag with
4907         a file descriptor of -1.
4908
4909 2004-03-02  Dmitry V. Levin  <ldv@altlinux.org>
4910
4911         * src/nohup.c: Include "cloexec.h".
4912         (main): Set the copy of stderr to close on exec.
4913
4914 2004-03-01  Paul Eggert  <eggert@twinsun.com>
4915
4916         * configure.ac: Include <signal.h> when checking for strsignal,
4917         sys_siglist, and friends.  Problem reported by Tony Leneis in
4918         <http://mail.gnu.org/archive/html/bug-coreutils/2004-02/msg00136.html>.
4919
4920 2004-02-25  Paul Eggert  <eggert@twinsun.com>
4921
4922         * tests/du/deref-args, tests/du/exclude, tests/du/slash:
4923         * tests/du/trailing-slash: Run envvar-check in case BLOCK_SIZE
4924         etc. are set.
4925
4926 2004-02-23  Paul Eggert  <eggert@twinsun.com>
4927
4928         * NEWS: Document how chown's USER.GROUP argument is now parsed.
4929
4930 2004-02-23  Jim Meyering  <jim@meyering.net>
4931
4932         * src/seq.c (usage): Remove stray space after \n in --help output.
4933
4934 2004-02-22  Jim Meyering  <jim@meyering.net>
4935
4936         * src/du.c (usage): Separate -H and --si.  Say that the meaning
4937         of -H will soon change to that of --dereference-args (-D).
4938
4939 2004-02-21  Jim Meyering  <jim@meyering.net>
4940
4941         * src/comm.c (usage): Tell what comm does when there are no options.
4942         Reword in terms of FILE1 and FILE2 rather than `left file' and
4943         `right file'.  Suggestion from Dan Jacobson.
4944
4945 2004-02-15  Paul Eggert  <eggert@twinsun.com>
4946
4947         Fix some POSIX-conformance bugs in expr.
4948
4949         * NEWS: document the following changes to src/expr.c.
4950         * doc/coreutils.texi (expr invocation): Likewise.
4951         Document what forms integers may take, and say "integer"
4952         consistently instead of "number".  Warn about operands
4953         that "expr" can misinterpret, and how to work around the
4954         problem.
4955         * src/expr.c (eval, eval7, eval6, eval5, eval4, eval3, eval2, eval1):
4956         Accept a bool argument specifying whether to evaluate the
4957         expression.  This is to allow short-circuit evaluation.  All
4958         callers changed.
4959         (null): Report that a string is zero even if it has
4960         a form like "-0" or "00".
4961         (eval1, eval): Use short-circuit evaluation for | and &.
4962         (eval): Return 0 if both arguments are null or zero, instead
4963         of returning the first argument.
4964         * tests/expr/basic: Add some tests for the above.
4965
4966 2004-02-17  Jim Meyering  <jim@meyering.net>
4967
4968         * Version 5.2.0.
4969
4970         `make check' from a build inside a chroot environment would fail
4971         * tests/help-version: Specify an argument (`/') for df, in the
4972         unusual event that there is no valid entry in /etc/mtab.
4973         Likewise for id: add the -u option, so we don't get spurious
4974         failures when there are no user or group names.
4975         Patch by Tim Waugh.
4976
4977         * src/sort.c (usage) [-u]: Add punctuation so that the description in
4978         the help2man-generated (line-joined) man page is more readable.
4979         Reported by Tim Waugh.
4980         [-T]: Add a semicolon, for the same reason.
4981
4982 2004-02-15  Jim Meyering  <jim@meyering.net>
4983
4984         * Makefile.am (dist-hook): Qualify target with $(srcdir)/ prefix.
4985
4986 2004-02-11  Jim Meyering  <jim@meyering.net>
4987
4988         * tests/Makefile.am.in ($(srcdir)/Makefile.am): Use more portable
4989         $(srcdir)/../Makefile.am.in, rather than $<.
4990         Suggestion from Michael Elizabeth Chastain.
4991
4992 2004-02-10  Jim Meyering  <jim@meyering.net>
4993
4994         * config/install-sh: Make this script executable.
4995         * Makefile.am (dist-hook): New target, to ensure that config/install-sh
4996         is executable.  Otherwise, on systems that lack a suitable install
4997         binary, `make install' would fail, because of the way this script
4998         is invoked (without `$SHELL ' prefix).
4999         Reported by Bob Proulx.
5000
5001 2004-02-08  Jim Meyering  <jim@meyering.net>
5002
5003         * Version 5.1.3.
5004
5005         * tests/rm/rm5: Avoid triggering a bug in OSF/Tru64's sed
5006         that would cause an unwarranted test failure.
5007         * tests/rm/rm3: Likewise.
5008
5009 2004-02-07  Jim Meyering  <jim@meyering.net>
5010
5011         Remove xstat function pointer member.  The way it was used was not
5012         portable, since some systems (OSF V5.1, Solaris 2.5.1) provide static
5013         inline `stat' and `lstat' functions, thus making the tests of
5014         `xstat == lstat' in copy.c always fail.
5015         * src/copy.h (struct cp_options) [xstat]: Remove member.
5016         (XSTAT): New macro.
5017         * src/copy.c (copy_dir): Set `.dereference' member, not .xstat.
5018         (copy_internal): Use `XSTAT (x, ...)' in place of `*(x->xstat) (...)'.
5019         Use `x->dereference == DEREF_NEVER' in place of `x->xstat == lstat'.
5020         (valid_options): Remove now-obsolete FIXME comments.
5021
5022         * src/cp.c (re_protect): Use `XSTAT (x, ...)' in place of
5023         `*(x->xstat) (...)'.
5024         (do_copy): Declare/use local xstat rather than x->xstat.
5025         (main): Remove code that set x.xstat.
5026         * src/mv.c (cp_option_init): Don't initialize xstat member.
5027         * src/install.c (cp_option_init): Likewise.
5028
5029         * Makefile.cfg (gnu_ftp_host-alpha, etc.): Un-factor .gnu.org suffix,
5030         so that emit_upload_commands can use these variables, too.
5031
5032 2004-02-06  Jim Meyering  <jim@meyering.net>
5033
5034         * tests/rm/deep-1: Remove `du' stack space test.
5035         Apparently, `ulimit -s N' isn't portable enough.
5036         This test will be restored (with a guard against losing ulimit)
5037         in its own file later.
5038
5039         * tests/rm/deep-1 (deep): Remove progress-style diagnostics,
5040         since this test doesn't take long enough to merit them.
5041         Run du on $tmp (the containing dir), not $deep, the full path to leaf.
5042
5043         * Makefile.maint (signatures): Remove definition.
5044         Now, automake's gnupload handles this.
5045         (%.sig: %): Remove now-unused rule.
5046         (rel-files): Use automake's $(DIST_ARCHIVES), rather than
5047         `$(distdir).tar.bz2 $(distdir).tar.gz'.
5048         (emit-upload-commands): Adjust to use gnupload.
5049
5050 2004-02-05  Jim Meyering  <jim@meyering.net>
5051
5052         * src/system.h (ST_TIME_CMP_NS, ST_TIME_CMP): Remove definitions.
5053         (ATIME_CMP, CTIME_CMP, MTIME_CMP, TIMESPEC_NS): Likewise.
5054         Now, those are all defined in timespec.h.
5055         Include timespec.h.
5056
5057         * src/date.c: Don't include timespec.h, now that system.h does it.
5058
5059 2004-02-02  Paul Eggert  <eggert@twinsun.com>
5060
5061         Don't dump core if localtime returns NULL (possible on
5062         hosts with 64-bit time_t and 32-bit int).
5063         * src/date.c: Include "inttostr.h".
5064         (batch_convert, main):
5065         If time conversion fails, exit with nonzero status.
5066         (show_date): Return int to report conversion failure.
5067         Print the time as an int if localtime fails.
5068         * src/uptime.c: Print "??" if the current clock can't
5069         be converted by localtime.  This won't happen until the year
5070         2*31 + 1900, but we don't want to dump core even if the current
5071         clock has the wrong value.
5072
5073         * src/stat.c: Include "inttostr.h".
5074         (human_time): Print the date/time as a number of seconds since the
5075         epoch if it can't be converted by localtime.  This is better than
5076         just saying "invalid", and is consistent with what "ls" does.
5077         Don't dump core if the year has more than 48 digits; this isn't
5078         possible on any contemporary host, but we might as well do it right.
5079
5080 2004-01-31  Paul Eggert  <eggert@twinsun.com>
5081
5082         * src/stat.c (human_time): Accept time rather than
5083         pointer-to-const-time parameter, for clarity.  All callers changed.
5084
5085 2004-02-02  Jim Meyering  <jim@meyering.net>
5086
5087         * src/stat.c (do_stat): Remove extra trailing newline from
5088         default formats.  Reported by Nelson H. F. Beebe.
5089
5090         Print actual fractional seconds in time stamps, not just `.00000000'.
5091         * src/stat.c (human_time): Add and use new parameter, t_ns.
5092         (print_stat): Update callers.
5093         * src/ls.c (TIMESPEC_NS): Remove definition.
5094         * src/system.h (TIMESPEC_NS): Define here, instead, now that stat.c
5095         also uses this macro.
5096         Nelson H. F. Beebe noticed that ls --full-time printed nonzero
5097         fractional seconds for files on an XFS file system, but that stat's
5098         fractional seconds were always zero.
5099
5100 2004-01-28  Paul Eggert  <eggert@twinsun.com>
5101
5102         * src/seq.c (print_numbers): Use 'double' for loop index, not
5103         'int', to avoid problems with integer overflow.  On almost all
5104         machines 'double' works in every case where 'int' works, and
5105         it works on other cases besides.
5106
5107 2004-01-27  Jim Meyering  <jim@meyering.net>
5108
5109         * src/seq.c (usage): Mention that if INCREMENT is omitted,
5110         it defaults to 1, even when FIRST is larger than LAST.
5111         Reword so as not to exclude the possibility that INCREMENT be zero.
5112
5113 2004-01-25  Jim Meyering  <jim@meyering.net>
5114
5115         * Version 5.1.2.
5116
5117         * Makefile.maint (signatures): Comment out definition.
5118
5119 2004-01-23  Jim Meyering  <jim@meyering.net>
5120
5121         * Makefile.maint (header_regexp): Add exitfail.
5122
5123         * man/Makefile.am (EXTRA_DIST): Add help2man.
5124         Reported by Nelson H. F. Beebe.
5125
5126         * man/Makefile.am (.x.1): Prefix help2man invocation with `$(PERL) --'
5127         so it works on systems with Perl installed somewhere other than in
5128         /usr/bin.
5129
5130         * src/paste.c (paste_parallel): Declare local, chr, to be of type
5131         `int', not `char', since it must hold EOF.  This bug would make
5132         paste infloop on some systems.  Test failures reported by
5133         Nelson H. F. Beebe and Christian Krackowizer.
5134
5135 2004-01-22  Jim Meyering  <jim@meyering.net>
5136
5137         * tests/rmdir/fail-perm: New file.  Test for just-fixed rmdir bug.
5138         * tests/rmdir/Makefile.am (TESTS): Add fail-perm.
5139
5140         * man/help2man: Fix it so using --info-page='coreutils PROG' works.
5141         * man/Makefile.am (.x.1): Invoke our own (tweaked) copy of help2man.
5142         Use --info-page='coreutils PROG' option.
5143         Now, readlink.1 refers the user to `info coreutils readlink'
5144         rather than to `info readlink'.  Reported by Matt Swift.
5145
5146 2004-01-21  Paul Eggert  <eggert@twinsun.com>
5147
5148         Exit status cleanup.
5149
5150         * src/basename.c (usage): Use EXIT_SUCCESS, not 0, for clarity.
5151         * src/cat.c, src/chgrp.c, src/chmod.c, src/chown.c, src/chroot.c,
5152         * src/cksum.c, src/comm.c, src/cp.c, src/csplit.c, src/cut.c,
5153         * src/date.c, src/dd.c, src/df.c, src/dircolors.c, src/dirname.c,
5154         * src/du.c, src/echo.c, src/env.c, src/expand.c, src/expr.c,
5155         * src/factor.c, src/fmt.c, src/fold.c, src/head.c, src/hostid.c,
5156         * src/hostname.c, src/id.c, src/install.c, src/join.c, src/kill.c,
5157         * src/link.c, src/ln.c, src/logname.c, src/ls.c, src/md5sum.c,
5158         * src/mkdir.c, src/mkfifo.c, src/mknod.c, src/mv.c, src/nice.c,
5159         * src/nl.c, src/nohup.c, src/od.c, src/paste.c, src/pathchk.c,
5160         * src/pinky.c, src/pr.c, src/printenv.c, src/printf.c, src/pwd.c,
5161         * src/rm.c, src/rmdir.c, src/seq.c, src/setuidgid.c, src/shred.c,
5162         * src/sleep.c, src/sort.c, src/split.c, src/stat.c, src/stty.c,
5163         * src/su.c, src/sum.c, src/sync.c, src/tac.c, src/tail.c, src/tee.c,
5164         * src/test.c, src/touch.c, src/tr.c, src/tsort.c, src/tty.c,
5165         * src/uname.c, src/unexpand.c, src/uniq.c, src/unlink.c, src/uptime.c,
5166         * src/users.c, src/wc.c, src/who.c, src/whoami.c, src/yes.c: Likewise.
5167
5168         * src/cat.c (usage): Don't bother normalizing exit status
5169         since the arg is already the correct exit status now.
5170         * src/cksum.c, src/comm.c, src/csplit.c, src/cut.c,
5171         * src/dircolors.c, src/expand.c, src/fmt.c, src/fold.c, src/head.c,
5172         * src/join.c, src/md5sum.c, src/nl.c, src/od.c, src/paste.c,
5173         * src/pr.c, src/split.c, src/sum.c, src/tac.c, src/tail.c, src/tr.c,
5174         * src/tsort.c, unexpand.c, src/src/uniq.c, src/src/wc.c: Likewise.
5175
5176         * src/chown.c (main): Removed unused local 'fail'.
5177
5178         * src/chroot.c (CHROOT_FOUND_BUT_CANNOT_INVOKE, CHROOT_FAILURE):
5179         Remove.
5180
5181         * src/chroot.c (main): Initialize exit_failure to EXIT_FAIL.
5182         * src/env.c, src/nice.c, src/su.c: Likewise.
5183         * src/nohup.c (main): Likewise, to NOHUP_FAILURE.
5184         * src/setuidgid.c (main): Likewise, to SETUIDGID_FAILURE.
5185         * src/expr.c (main): Use initialize_exit_failure rather than
5186         setting exit_failure directly; this optimizes away redundant
5187         assignments.
5188         * src/printenv.c, src/sort.c, src/test.c, src/tty.c: Likewise.
5189
5190         * src/chroot.c (main): Exit with status 1 rather than 127
5191         if chroot itself fails, as per documentation.
5192
5193         * src/chroot.c (main): Use EXIT_ENOENT and EXIT_CANNOT_INVOKE
5194         rather than roll-your-own symbols or integers.
5195         * src/env.c (main): Likewise.
5196         * src/nohup.c (main): Likewise.
5197         * src/su.c (run_shell): Likewise.
5198
5199         * src/cp.c (exit_status): Remove static var....
5200         (main): Making it local here instead.  Use =, not |=, to set it.
5201
5202         * src/cut.c (FATAL_ERROR, main): Exit with status EXIT_FAILURE,
5203         not 2, on errors.
5204         * src/date.c (batch_convert, main): Likewise.
5205         * src/dd.c (dd_copy): Likewise.
5206         * src/pr.c (first_last_page, main, getoptarg): Likewise.
5207         * src/tr.c (main): Likewise.
5208         * src/date.c (main): Don't assume EXIT_FAILURE == 1, as
5209         POSIX doesn't require it.
5210         * src/dd.c (write_output, skip, dd_copy): Likewise.
5211         * src/df.c (main): Likewise.
5212         * src/id.c (main): Likewise.
5213         * src/install.c (main): Likewise.
5214         * src/ln.c (main): Likewise.
5215         * src/ls.c (main): Likewise.
5216         * src/mv.c (main): Likewise.
5217         * src/shred.c (main): Likewise.
5218
5219         * src/env.c (main): Exit with status 1, not 2, on errors detected
5220         by env proper.
5221         * src/hostname.c (main): Likewise.
5222         * src/nl.c (main): Likewise.
5223         * src/stty.c (main): Likewise.
5224
5225         * src/expr.c (EXPR_FAILURE): Renamed from EXPR_ERROR, for
5226         consistency with the other programs' naming conventions.
5227         All uses changed.
5228
5229         * src/factor.c (main): Do not report a usage error simply
5230         because stdin has bad numbers.
5231
5232         * src/id.c (problems): Now a boolean int, not a counter,
5233         so that we don't have to worry about int overflow.  All uses changed.
5234         * src/touch.c (err): Likewise.
5235
5236         * src/md5sum.c (main): Use int, not size_t, to store boolean int.
5237
5238         * src/mkfifo.c (main): Exit with status 1, not 4, if not implemented.
5239         * src/mknod.c: Likewise.
5240
5241         * src/nice.c (main): Exit with status EXIT_FAIL, not EXIT_FAILURE,
5242         on error; this is in case EXIT_FAILURE is unusual.
5243         * src/su.c (main): Likewise.
5244
5245         * src/nohup.c (NOHUP_FOUND_BUT_CANNOT_INVOKE): Remove; all uses
5246         changed to EXIT_CANNOT_INVOKE.
5247
5248         * src/printenv.c (PRINTENV_FAILURE): New constant.
5249         (main): Exit with status PRINTENV_FAILURE, not EXIT_FAILURE, on
5250         command-line syntax problems.
5251
5252         * src/rmdir.c (remove_parents): Don't set 'fail' to a negative number.
5253         (main): Avoid integer overflow when seeing whether errors occurred.
5254
5255         * src/seq.c (print_numbers): Now returns void, not (zero) int.
5256         All callers changed.
5257         (main): Remove unused local variable 'errs'.  Always exit successfully
5258         if we reach the end.
5259
5260         * src/setuidgid.c (SETUIDGID_FAILURE): Renamed from FAIL_STATUS,
5261         for consistency with other programs here.  All uses changed.
5262         (main): Use 'error' to exit rather than invoking 'exit' here.
5263
5264         * src/sort.c: Don't include <assert.h>.
5265         (SORT_OUT_OF_ORDER,  SORT_FAILURE): Now enums, not macros.
5266         (usage): Don't use 'assert'.
5267         (main): Remove redundant assignment to exit_failure.
5268
5269         * src/system.h (EXIT_FAIL, EXIT_CANNOT_INVOKE, EXIT_ENOENT):
5270         New enum values.
5271         (initialize_exit_failure): New inline function.
5272         Include exitfail.h here, since we refer to exit_failure.
5273         All callers changed to not include exitfail.h.
5274
5275         * src/tty.c (TTY_FAILURE, TTY_WRITE_ERROR): New enum values;
5276         substitute them for the corresponding integer constants.
5277
5278         * tests/help-version (expected_failure_status_date): Remove, as
5279         'date' is now normal.
5280         (expected_failure_status_nohup): New var.
5281
5282 2004-01-21  Jim Meyering  <jim@meyering.net>
5283
5284         * tests/touch/relative: Remove `command' syntax.
5285         Thanks to Nelson H. F. Beebe and Paul Eggert.
5286
5287         * tests/touch/relative: Test only year/month/day, not hours/min/sec,
5288         so as to avoid problems with systems using TAI clocks.
5289         Although it's no longer necessary, set TZ=UTC0 also for the
5290         initial touch command.  Reported by Paul Jarc here:
5291         http://article.gmane.org/gmane.comp.gnu.core-utils.bugs/1504
5292
5293 2004-01-20  Diego Biurrun  <diego@biurrun.de>
5294
5295         * src/dircolors.hin: Add .mov to the list of media files.
5296
5297 2004-01-19  Paul Eggert  <eggert@twinsun.com>
5298
5299         * tests/touch/relative: Use TZ=UTC0, not TZ=utc (which isn't
5300         portable).  Problem reported by Christian Krackowizer.  Also, use
5301         +0000 rather than +0 to specify a time zone, as the documentation
5302         requires four digits.
5303
5304 2004-01-19  Jim Meyering  <jim@meyering.net>
5305
5306         * tests/mv/hard-4: Run envvar-check in case SIMPLE_BACKUP_SUFFIX is set.
5307         * tests/mv/backup-is-src: Likewise.
5308         Problem reported by Peter Horst
5309
5310 2004-01-17  Jim Meyering  <jim@meyering.net>
5311
5312         * announce-gen (print_changelog_deltas): Use .sig suffix, not .asc.
5313
5314         * Version 5.1.1.
5315
5316 2003-12-15  Paul Eggert  <eggert@twinsun.com>
5317
5318         * NEWS, doc/coreutils.texi: touch -r and -d can now both be specified,
5319         with -r specifying the origin for -d.
5320         * src/touch.c (flexible_date): Remove static var.
5321         (get_reldate): New function.
5322         (main): Use it, to implement this new behavior.
5323
5324 2004-01-16  Jim Meyering  <jim@meyering.net>
5325
5326         * tests/touch/relative: New test for the above.
5327         * tests/touch/Makefile.am (TESTS): Add relative.
5328
5329 2004-01-13  Jim Meyering  <jim@meyering.net>
5330
5331         * src/system.h: Include contents of sys2.h.
5332         * src/sys2.h: Remove file.
5333         * src/Makefile.am (noinst_HEADERS): Remove sys2.h.
5334
5335         * Use automake-1.8.2.  Regenerate dependent files.
5336
5337         * Update to gettext-0.13.1.
5338         * configure.ac: Use gettext-0.13.1.
5339         * .x-sc_space_tab: Add m4/po.m4 to the list of exceptions.
5340
5341 2004-01-12  Jim Meyering  <jim@meyering.net>
5342
5343         * Makefile.maint (%.sig): Use .sig suffix rather than .asc.
5344
5345         * Makefile.maint (po-check): Ensure that cvsu works before using it.
5346         Reported by Alexandre Duret-Lutz.
5347
5348         * src/tail.c (main): Warn about following stdin only when it's a tty.
5349
5350         * configure.ac: Use gl_DEFAULT_POSIX2_VERSION.
5351
5352 2004-01-10  Jim Meyering  <jim@meyering.net>
5353
5354         * tests/misc/stat-fmt: Use backticks, not `$()' notation.
5355
5356 2004-01-09  Jim Meyering  <jim@meyering.net>
5357
5358         * configure.ac: Quote underquoted `jm_DUMMY_1' to avoid new warning.
5359
5360 2004-01-08  Jim Meyering  <jim@meyering.net>
5361
5362         * src/stat.c (human_fstype): Use %lx, not %x format for `unsigned long'.
5363         From Andreas Schwab.
5364
5365         * tests/Makefile.am (TESTS_ENVIRONMENT): Remove `/vg' (prerelease test
5366         remnant) from PATH component.  That would cause tests in this directory
5367         not to run the just-built binaries, but rather whatever happened
5368         to be in one's PATH.  Reported by Christian Krackowizer.
5369
5370 2004-01-04  Jim Meyering  <jim@meyering.net>
5371
5372         * src/csplit.c (new_control_record): Use x2nrealloc
5373         rather than xrealloc.
5374
5375         * src/cp.c (re_protect): Use ASSIGN_STRDUPA rather than
5376         alloca and strcpy.
5377         (make_path_private): Likewise.
5378
5379 2004-01-03  Jim Meyering  <jim@meyering.net>
5380
5381         * src/paste.c: Use `bool' (not int) as the type for a few
5382         global variables.
5383         (collapse_escapes): Rewrite to set globals rather than modifying
5384         its parameter.
5385         Use size_t (not int) for all counters and related index variables.
5386         (paste_parallel): Remove needless complexity of
5387         using xrealloc in the loop;  just allocate the buffers up front.
5388         Free the two temporary buffers.
5389         Move declarations of locals `down' into scope where used.
5390         (paste_serial): Remove `register' attributes.
5391         (main): Simplify delim-related code.
5392         Free `delims', now that it's malloc'd.
5393
5394 2004-01-02  Jim Meyering  <jim@meyering.net>
5395
5396         * src/chroot.c: Include "quote.h".
5397         (CHROOT_FOUND_BUT_CANNOT_INVOKE, CHROOT_FAILURE): Define.
5398         (main): Exit with status of 127, not 1, for too-few-args,
5399         chroot failure, or chdir failure.
5400         Give a better diagnostic upon execvp failure.
5401
5402         * src/du.c (usage): Mention that, with its current meaning,
5403         -H is deprecated.
5404
5405         * src/tail.c (main): Warn about following stdin when it's a tty.
5406         Fail when following by name but no names are specified.
5407
5408 2003-12-30  Jim Meyering  <jim@meyering.net>
5409
5410         * src/fold.c (main): Use memcpy, not strcpy.
5411
5412         * src/copy.c (copy_internal): Use ASSIGN_STRDUPA rather than
5413         alloca and strcpy.
5414
5415 2003-12-28  Jim Meyering  <jim@meyering.net>
5416
5417         * src/unexpand.c (n_tabs_allocated): New global.
5418         (add_tabstop): Use x2nrealloc rather than xrealloc.
5419         * src/expand.c: Likewise.
5420
5421         * tests/misc/expand: New file.
5422         * tests/misc/Makefile.am (TESTS): Add expand.
5423
5424         * src/sort.c (add_temp_dir): Use x2nrealloc rather than xrealloc.
5425         (fillbuf): Use x2nrealloc rather than xrealloc.
5426         (sort): Use xnmalloc rather than xmalloc.
5427         (main): Likewise.
5428
5429 2003-12-27  Jim Meyering  <jim@meyering.net>
5430
5431         * src/tee.c (tee): Use xnmalloc rather than xmalloc.
5432
5433 2003-12-29  Paul Eggert  <eggert@twinsun.com>
5434
5435         * NEWS: Remove support for join -j1 FIELD, -j2 FIELD, and -o LIST1
5436         LIST2 in POSIX 1003.1-2001 hosts, as required by POSIX.
5437
5438         * doc/coreutils.texi (join invocation): Remove documentation
5439         accordingly.  Document that -t makes all separators significant.
5440
5441         * src/join.c: Include posixver.h.
5442         (obsolete_usage): New var.
5443         (longopts): Put obsolete options first.
5444         (OBSOLETE_LONG_OPTIONS): New constant.
5445         (get_option, add_file_name): New functions.
5446         (main): Use them to support new behavior.
5447         (usage): Remove documentation for -j1 FIELD and -j2 FIELD.
5448         Do not mark -j FIELD as obsolescent; it is longstanding
5449         UNIX tradition and is a valid extension to POSIX.
5450
5451         * tests/join/Test.pm (tv): Avoid obsolete -o usage.
5452
5453 2003-12-28  Paul Eggert  <eggert@twinsun.com>
5454
5455         * src/join.c (add_field_list): Don't use alloca with unbounded
5456         size; just modify the argument, which is no longer const *.
5457
5458         Various other minor cleanups, mostly to avoid the need for casts.
5459
5460         (extract_field): Renamed from ADD_FIELD, as it's now a function.
5461
5462         (struct field.beg): Now char *, not unsigned char const *.  All
5463         uses changed.  It shouldn't be const since xmemcoll writes on its
5464         arguments.
5465         (extract_field): Likewise, for 2nd arg.
5466         (keycmp): Remove now-unnecessary cast of xmemcoll args.
5467
5468         (is_blank): New function, to avoid need to cast arg to unsigned char.
5469         (extract_field): Use it.
5470
5471         (xfields): Rewrite pretty much from scratch.
5472
5473         (hard_LC_COLLATE): Now bool, not int.
5474         (get_line, getseq, add_field_list): Now returns bool, not int.
5475         (decode_field_spec, add_field_list): Return true on success (not
5476         false), for consistency with the rest of the code.  All uses changed.
5477
5478         (tab): Now char, not unsigned char.  This wasn't 100% necessary
5479         but is slightly cleaner.
5480         (prjoin): Hoist (tab ? tab : ' ') expression, to help the compiler.
5481
5482         (empty_filler): Now const *.
5483
5484         (make_blank): Remove; wasn't needed.  Remove all calls.
5485         (main): Don't set uni_blank.nfields; zero is fine.
5486
5487 2003-12-27  Jim Meyering  <jim@meyering.net>
5488
5489         * src/join.c: Include "quote.h".
5490         (min, max): Remove definitions.
5491         Make a few function parameters and corresponding
5492         locals `const'.  Use bool for boolean variables.
5493         Use size_t (not int) for all counters and related index variables.
5494         (prjoin): Remove now-useless assertion.
5495         (string_to_join_field): New function.
5496         (main): Accept join fields as large as SIZE_MAX.
5497         (keycmp): Rename `min' to MIN and max to MAX.
5498
5499 2003-12-26  Jim Meyering  <jim@meyering.net>
5500
5501         fold -s didn't work on e.g., alpha-based systems.
5502         * src/fold.c (fold_file): Adjust types (int->size_t) so that using
5503         x2nrealloc works properly on systems with differing sizes for int
5504         and size_t.  Reported by Nelson Beebe.
5505
5506         * src/fold.c: Use `bool' (not int) as the type for a few
5507         global variables.
5508
5509 2003-12-23  Paul Eggert  <eggert@twinsun.com>
5510
5511         * src/ls.c (length_of_file_names_and_frills):
5512         Remove forward decl; not needed.
5513         (print_file_name_and_frills, length_of_file_name_and_frills):
5514         With -m, don't output spaces before inum or size.
5515         (print_with_commas): Don't output space just before newline.
5516
5517 2003-12-24  Jim Meyering  <jim@meyering.net>
5518
5519         * tests/ls/Makefile.am (TESTS): Add m-option.
5520         * tests/ls/m-option: New file.  Test for above fixes.
5521
5522 2003-12-20  Jim Meyering  <jim@meyering.net>
5523
5524         * Version 5.1.0.
5525
5526         * src/pr.c: Change type of global, buff_allocated, to size_t.
5527
5528         * src/join.c [struct seq]: Change types of members count and alloc
5529         from `int' to `size_t'.
5530
5531         * tests/Makefile.am (root-hint): Tweak wording.
5532
5533         * src/du.c: Accept new option (-0, --null) that makes it so each
5534         output line is NUL-terminated rather than newline-terminated.
5535
5536         * src/dd.c (apply_translations): Don't prohibit conv=unblock,sync.
5537         Reported by Volker Paul.
5538         * tests/dd/Makefile.am (TESTS): Add unblock-sync.
5539         * tests/dd/unblock-sync: New test for the above.
5540
5541 2003-12-19  Jim Meyering  <jim@meyering.net>
5542
5543         * tests/misc/nohup: Double quote back-ticked expression,
5544         in case it ends up having an unexpected value.
5545
5546         * tests/ls/no-arg: Use ls's -1 option in both runs.
5547
5548         * src/du.c (fts_debug): New global.
5549         (FTS_CROSS_CHECK, DEBUG_OPT): Define.
5550         (main): Make fts use FTS_TIGHT_CYCLE_CHECK.
5551         (main) [DU_DEBUG]: Accept -d option.
5552
5553 2003-12-18  Jim Meyering  <jim@meyering.net>
5554
5555         * src/ls.c (format_user): Increment dired_pos via two statements,
5556         `dired_pos += width; dired_pos++;' rather than one,
5557         `dired_pos += width + 1;' since the latter could conceivably overflow.
5558         (format_group): Likewise.
5559         From Paul Eggert.
5560
5561         * configure.ac: Require automake-1.8.
5562
5563 2003-12-12  Jim Meyering  <jim@meyering.net>
5564
5565         * Use automake-1.8.  Regenerate dependent files.
5566
5567 2003-12-08  Jim Meyering  <jim@meyering.net>
5568
5569         * Makefile.maint (news-date-check): New rule.
5570         (alpha beta major): Depend on it.
5571
5572 2003-12-03  Paul Eggert  <eggert@twinsun.com>
5573
5574         * NEWS: ls -l (and similar options) now adjust all columns to
5575         fit the data.  Generalized from a suggestion by Leah Q for file sizes.
5576         * src/ls.c (INODE_DIGITS, LOGIN_NAME_MAX, ID_LENGTH_MAX): Remove.
5577         (format_user_width, format_group_width, unsigned_file_size,
5578         format_group): New functions.
5579         (block_size_width): Renamed from block_size_size.
5580         (inode_number_width, nlink_width, owner_width, group_width,
5581         author_width, major_device_number_width, minor_device_number_width,
5582         file_size_width): New vars.
5583         (clear_files): Initialize them.
5584         (gobble_file): Set them.  Don't ceiling block_size_width to 7.
5585         (print_long_file): Use them.
5586         (gobble_file): Use a new local variable 'f' to make the code
5587         smaller and more consistent with other functions.
5588         (format_user): Output to stdout, not to a buffer, so that we
5589         don't have to worry about buffer overrun.  Update dired_pos.
5590         (print_long_file): Don't put owner, group, author into buffer;
5591         just print them directly.  Don't assume link counts and
5592         major and minor numbers fit into unsigned long int.
5593         * tests/cp/same-file, tests/mv/part-symlink: Don't assume that
5594         'ls' output is fixed-width.
5595
5596 2003-12-02  Jim Meyering  <jim@meyering.net>
5597
5598         * src/md5sum.c: Include sha1.h (reflect renaming: sha.h -> sha1.h.
5599
5600 2003-11-27  Jim Meyering  <jim@meyering.net>
5601
5602         * Use automake-1.7f.  Regenerate dependent files.
5603
5604 2003-11-24  Paul Eggert  <eggert@twinsun.com>
5605
5606         Parse floating-point operands and options in the C locale.
5607         POSIX requires this for printf, and we might as well be
5608         consistent elsewhere (tail, sleep, seq).
5609
5610         * src/printf.c: Remove decls of strtod, strtol, strtoul; no longer
5611         needed now that we assume C89.  Include "c-strtod.h".
5612         (xstrtod): Call c_strtod, not strtod.
5613         * src/sleep.c: Include "c-strtod.h".
5614         (main): Update xstrtod call to include new argument, c_strtod.
5615         * src/seq.c (scan_double_arg): Likewise.
5616         * src/tail.c (parse_options): Likewise.
5617
5618 2003-11-24  Jim Meyering  <jim@meyering.net>
5619
5620         * tests/rm/fail-2eperm: Handle another errno variant (HPUX, EPERM).
5621         Reported by Mark Conty.
5622
5623 2003-11-22  Jim Meyering  <jim@meyering.net>
5624
5625         * Makefile.maint (sc_xalloc_h_in_src): Remove rule.  Subsumed by...
5626         (sc_system_h_headers): Do this test only if sys2.h exists.
5627
5628 2003-11-20  Jim Meyering  <jim@meyering.net>
5629
5630         * tests/help-version: Ensure that the bug-reporting address is
5631         included in the --help output for every program.
5632         * tests/Makefile.am (TESTS_ENVIRONMENT): Add $PACKAGE_BUGREPORT.
5633
5634         * src/ptx.c (usage): Output bug-reporting address.
5635         Reported by Dan Jacobson.
5636
5637 2003-11-19  Jim Meyering  <jim@meyering.net>
5638
5639         * src/join.c (usage): Mention that FILE1 and FILE2 must be sorted
5640         on the join fields.  Suggestion from Bruce Robertson.
5641
5642 2003-11-18  Jim Meyering  <jim@meyering.net>
5643
5644         `od -c -w9999999' could segfault
5645         * src/od.c (dump): Use xnmalloc/free, not alloca.
5646
5647 2003-11-16  Jim Meyering  <jim@meyering.net>
5648
5649         * Use autoconf-2.59.  Regenerate dependent files.
5650
5651         * tests/du/hard-link: Minor tweak: use mkdir -p.
5652
5653         Fix read-from-free'd-buffer error detected by valgrind.
5654         * src/csplit.c (remove_line): Don't return a pointer to data in
5655         a freed buffer.  Instead, arrange to free the buffer on the
5656         subsequent call.
5657
5658         * tests/misc/csplit: New test for above fix.
5659
5660 2003-11-11  Jim Meyering  <jim@meyering.net>
5661
5662         * src/ls.c (extract_dirs_from_files): Avoid useless copy operations.
5663         This avoids a warning from valgrind about memcpy with overlapping
5664         source and destination.
5665
5666         * configure.ac: Require automake-1.7.8.
5667
5668 2003-11-09  Jim Meyering  <jim@meyering.net>
5669
5670         * Use automake-1.7.9.  Regenerate dependent files.
5671
5672         * src/rm.c: Support new options: --preserve-root and --no-preserve-root.
5673         * src/chown.c: Likewise.
5674
5675         * src/chown-core.c: Include "root-dev-ino.h".
5676         (chopt_init): Initialize new member.
5677         (change_file_owner): Support rm's new --preserve-root option.
5678
5679         * src/remove.c: Include "root-dev-ino.h".
5680         (remove_cwd_entries): Remove now-obsolete FIXME comment.
5681         (remove_dir): Support rm's new --preserve-root option.
5682
5683         * src/chown.c: Include "root-dev-ino.h".
5684         Add new options: --preserve-root and --no-preserve-root.
5685
5686         * src/chmod.c: Include "root-dev-ino.h".
5687         (process_file): Use newly-factored-out ROOT_DEV_INO_CHECK and
5688         ROOT_DEV_INO_WARN macros.
5689         (get_root_dev_ino): Remove function definition, now that it's
5690         been moved to a separate file.
5691         (usage): Describe new options.
5692
5693         * src/mv.c (rm_option_init): Initialized new member.
5694
5695         * src/remove.h: Include "dev-ino.h".
5696         (struct rm_options): Add new member: root_dev_ino.
5697         * src/chown-core.h: Include "dev-ino.h".
5698         (struct Chown_option): Add new member: root_dev_ino.
5699
5700 2003-11-06  Jim Meyering  <jim@meyering.net>
5701
5702         * src/paste.c (paste_parallel): Use `sizeof *var' rather than
5703         hard-coding `sizeof FILE*'.
5704
5705 2003-11-05  Dennis Smit  <ds@nerds-incorporated.org>
5706
5707         * src/wc.c (main): Free `fstatus' so there is no confusion about
5708         whether it's leaked or not.
5709         * src/who.c (who): Likewise for `utmp_buf'.
5710
5711 2003-11-05  Paul Eggert  <eggert@twinsun.com>
5712
5713         Fix 'cut' problems with size_t overflow and unsigned int.
5714         More generally, resize integer variables to fit use more precisely.
5715         * src/cut.c (ADD_RANGE_PAIR): Remove unnecessary parens.
5716         (struct range_pair): Make members to be of type size_t, not unsigned.
5717         (max_range_endpoint, eol_range_start): Now size_t, not unsigned.
5718         (suppress_non_delimited, output_delimiter_specified,
5719         have_read_stdin, print_kth, set_fields): Now bool, nt int.
5720         (delim): Now unsigned char, not int.
5721         (mark_printable_field, is_printable_field, is_range_start_index,
5722         set_fields, set_fields, cut_bytes, cut_fields):
5723         Use size_t, not unsigned, for field and byte counts.
5724         (hash_int): Use uintptr_t, not unsigned, for pointers converted
5725         to integers.  This squeezes more info out of them.
5726         (set_fields, cut_bytes, cut_fields, main):
5727         Use bool, not int, for booleans.
5728         (set_fields): Allocate zeroed byte array with xzalloc, not xcalloc.
5729
5730 2003-11-05  Paul Eggert  <eggert@twinsun.com>
5731
5732         * man/Makefile.am (check-programs-vs-x):
5733         Work even if $(programs) contains '$'.
5734         Work even if 'missing=1' in environment.
5735         Don't report an error simply because $(programs) outputs nothing.
5736
5737 2003-11-05  Jim Meyering  <jim@meyering.net>
5738
5739         * Use autoconf-2.58.  Regenerate dependent files.
5740
5741         * src/tr.c (spec_init): Fix typo in last change.
5742
5743         * src/sys2.h (case_GETOPT_VERSION_CHAR): Cast NULL to `(char *)' in
5744         call to variadic version_etc function, so that it works even on systems
5745         for which sizeof char* != sizeof int.
5746         * src/true.c (main): Likewise.
5747         * basename.c, chroot.c, cksum.c, dd.c, dirname.c, echo.c, expr.c:
5748         * factor.c, hostid.c, hostname.c, link.c, logname.c, nice.c, nohup.c:
5749         * pathchk.c, printenv.c, printf.c, pwd.c, setuidgid.c, sleep.c, stty.c:
5750         * sync.c, test.c, tsort.c, unlink.c, uptime.c, users.c, whoami.c, yes.c:
5751         Similarly, cast NULL to `(char *)' in call to variadic function,
5752         parse_long_options, so that it works even on systems for which
5753         sizeof char* != sizeof int.
5754         A similar problem was reported by Harti Brandt in
5755         http://mail.gnu.org/archive/html/bug-gnu-utils/2003-10/msg00320.html.
5756
5757         * src/users.c (users): Free `utmp_buf' explicitly so that people
5758         don't mistake this for a real leak.
5759         Patch by Dennis Smit <ds@nerds-incorporated.org.
5760
5761 2003-11-04  Paul Eggert  <eggert@twinsun.com>
5762
5763         * README: Document _POSIX2_VERSION.
5764
5765 2003-11-04  Jim Meyering  <jim@meyering.net>
5766
5767         * src/tac.c (memrchr): Remove #if-0'd function.
5768         (tac_stdin_to_mem): Clean up #if-0'd code.
5769
5770         * src/od.c (decode_format_string): Remove unnecessary casts.
5771         Use more maintainable `sizeof *var'.
5772         (main): Call decode_format_string rather than decode_one_format,
5773         now that `spec' may be NULL.
5774
5775         * src/chmod.c (AUTHORS): Add my name.
5776
5777         * src/split.c (next_file_name): Use `sizeof *var' rather than
5778         hard-coding `sizeof size_t'.
5779
5780         * src/sort.c (new_key): Use xzalloc, not xcalloc (1, ...).
5781
5782         * src/cut.c (ADD_RANGE_PAIR): Use x2nrealloc rather than xrealloc,
5783         to avoid potential overflow in pointer arithmetic.
5784         (set_fields): Use not `1', but rather `sizeof *printable_field' as
5785         second argument to xcalloc.
5786         * src/od.c (decode_format_string, dump_strings): Use x2nrealloc
5787         rather than xrealloc.
5788         * src/date.c (show_date): Likewise.
5789         * src/join.c (ADD_FIELD, initseq, getseq): Likewise.
5790         * src/pr.c (store_char): Likewise.
5791         * src/fold.c (fold_file): Likewise.
5792
5793         * src/copy.c (triple_hash, triple_hash_no_name): Adjust to reflect
5794         type changes (unsigned int -> size_t) in hash.c.
5795         * src/cp-hash.c (src_to_dest_hash): Likewise.
5796         * src/du.c (entry_hash): Likewise.
5797         * src/ls.c (dev_ino_hash): Likewise.
5798         * src/cut.c (hash_int): Likewise.  Declare function as static.
5799
5800 2003-11-03  Jim Meyering  <jim@meyering.net>
5801
5802         * tests/misc/Makefile.am (TESTS_ENVIRONMENT): Define PACKAGE_VERSION.
5803         * tests/misc/fold: Fail the test immediately if we're not running
5804         the expected version of fold.
5805
5806 2003-11-02  Jim Meyering  <jim@meyering.net>
5807
5808         * src/tr.c (append_normal_char, append_range, append_char_class)
5809         (append_repeated_char, append_equiv_class, spec_init): Use `sizeof *var'
5810         rather than `sizeof EXPLICIT_TYPE'.  The former is more maintainable
5811         and usually shorter.
5812         * src/copy.c (copy_internal): Likewise.
5813         * src/join.c (initseq, add_field, make_blank): Likewise.
5814         * src/od.c (main): Likewise.
5815         * src/cp.c (make_path_private): Likewise.
5816         * src/tsort.c (new_item, record_relation): Likewise.
5817
5818         * src/df.c (add_fs_type, add_excluded_fs_type, main): Likewise.
5819         (main): Also remove anachronistic cast of xmalloc return value.
5820         * src/ptx.c (alloc_and_compile_regex, main): Likewise.
5821         (main): Also remove anachronistic cast of xmalloc return value.
5822         * src/sort.c (inittables): Likewise.
5823         (sort): Also Split a long line.
5824
5825 2003-10-25  Jim Meyering  <jim@meyering.net>
5826
5827         * src/copy.c (triple_hash, triple_hash_no_name): Adjust to reflect
5828         type changes (unsigned int -> size_t) in hash.c.
5829         * src/cp-hash.c (src_to_dest_hash): Likewise.
5830         * src/du.c (entry_hash): Likewise.
5831         * src/ls.c (dev_ino_hash): Likewise.
5832         * src/cut.c (hash_int): Likewise.  Declare function as static.
5833
5834 2003-10-21  Jim Meyering  <jim@meyering.net>
5835
5836         Don't fail when run with VERBOSE=yes.
5837         * tests/chgrp/basic: Do `set +x' before starting the subshell
5838         from which we invoke chgrp.  Otherwise, the output from the
5839         VERBOSE=yes-induced `set -x' would result in spurious differences.
5840         Reported by Russel Coker via Michael Stone.
5841
5842 2003-10-19  Jim Meyering  <jim@meyering.net>
5843
5844         chmod now uses fts to perform a directory traversal when -R is
5845         specified.  Before, it operated on full path names, and as such
5846         would encounter the PATH_MAX (often 4096) limit.
5847
5848         * src/chmod.c: Include "xfts.h".
5849         (process_file): Rename from change_file_mode.
5850         Adapt to be used with fts.
5851         (process_files): New function.
5852
5853 2003-10-18  Jim Meyering  <jim@meyering.net>
5854
5855         * tests/du/deref-args: Ensure that du -D now dereferences all
5856         symlinks specified on the command line, not just those that
5857         reference directories.
5858
5859         * basename.c, cat.c, chroot.c, cksum.c, comm.c, cp.c, csplit.c, cut.c:
5860         * dd.c, df.c, dirname.c, du.c, echo.c, env.c, expr.c, factor.c, head.c:
5861         * hostid.c, hostname.c, id.c, link.c, ln.c, logname.c, ls.c, md5sum.c:
5862         * mv.c, nice.c, nl.c, nohup.c, paste.c, pathchk.c, pinky.c, pr.c:
5863         * printenv.c, printf.c, pwd.c, rm.c, setuidgid.c, sleep.c, sort.c:
5864         * split.c, stty.c, sum.c, sync.c, tac.c, tail.c, tee.c, test.c:
5865         * touch.c, tsort.c, uniq.c, unlink.c, uptime.c, users.c, wc.c:
5866         * who.c, whoami.c, yes.c (AUTHORS): Revert the WRITTEN_BY/AUTHORS change
5867         of 2003-09-19.  Now, AUTHORS is a comma-separated list of strings.
5868         Update the call to parse_long_options so that `AUTHORS, NULL' are the
5869         last parameters.
5870         * src/true.c (main): Append NULL to version_etc argument list.
5871         * src/sys2.h (case_GETOPT_VERSION_CHAR): Likewise.
5872
5873 2003-10-17  Andreas Schwab  <schwab@suse.de>
5874
5875         * tests/mk-script: Get $srcdir from first parameter instead of
5876         hardcoding it.
5877         (main): Update usage.
5878
5879         * tests/Makefile.am.in ($(srcdir)/$x-tests): Pass $(srcdir) as
5880         first argument of mk-script.
5881         ($(srcdir)/Makefile.am): Likewise.  Prepend $(srcdir) to target.
5882
5883 2003-10-17  Jim Meyering  <jim@meyering.net>
5884
5885         * src/mv.c (usage): Tweak descriptions of -i and -f so that the
5886         generated `man' page is more readable.  Suggestion from Dan Jacobson.
5887
5888         * src/chown-core.c (change_file_owner): Handle the cases in
5889         which fts_info indicates an error with the given entry.
5890
5891         * src/du.c (main): Simply assign to bit_flags.
5892         Don't bother with bit arithmetic.
5893
5894         * tests/chmod/no-x: New file.
5895         * tests/chgrp/no-x: New file.
5896         * tests/chmod/Makefile.am (TESTS): Add no-x.
5897         * tests/chgrp/Makefile.am (TESTS): Likewise.
5898
5899         * src/du.c: Include "xfts.h".
5900         (du_files): Use xfts_open, rather than fts_open.
5901         * src/chown-core.c (chown_files): Likewise.
5902
5903 2003-10-16  Jim Meyering  <jim@meyering.net>
5904
5905         * src/chgrp.c (main): Simply assign to bit_flags.
5906         Don't bother with bit arithmetic.
5907         * src/chown.c (main): Likewise.
5908         Rename a couple of local variables.
5909         Remove unnecessary casts.
5910
5911         * src/tail.c (start_bytes): Rename local, remainder, to avoid
5912         gcc's warning about shadowing a global.
5913
5914 2003-10-15  Jim Meyering  <jim@meyering.net>
5915
5916         chown and chgrp now accept POSIX-mandated -H, -L, -P options and
5917         use fts to perform a directory traversal when -R is specified.
5918         Before, they operated on full path names, and as such would
5919         encounter the PATH_MAX (often 4096) limit.
5920         They are more efficient.  For example, before, chgrp -R would
5921         take almost 5 seconds to change about 2000 directories and fail
5922         (with `File name too long'), while now it succeeds on a hierarchy
5923         of depth 20,000 in 1/10 the time.
5924
5925         * src/chown.c: Include "userspec.h" and "fts_.h".
5926         (WRITTEN_BY): Add my name.
5927         (getpwnam, getgrnam, getgrgid): Remove declarations.
5928         (endpwent): Remove definition.
5929         (usage): Update.
5930         (main): Handle new options.
5931         Call new function, chown_files rather than change_file_owner.
5932
5933         * src/chgrp.c: Include "fts_.h".
5934         (WRITTEN_BY): Add my name.
5935         (MAXUID, MAXGID): Remove definitions.  Use GID_T_MAX instead of
5936         the latter.
5937         (usage): Update.
5938         (main): Handle new options.
5939         Call new function, chown_files rather than change_file_owner.
5940
5941         Rewrite to iterate through hierarchies using fts rather than
5942         via explicit recursion.
5943         * src/chown-core.c: Include "fts_.h"
5944         (change_file_owner): Rewrite to use FTS* and FTSENT* and to operate
5945         on a single file at a time.
5946         (chown_files): New function.
5947         * src/chown-core.h [enum Dereference_symlink]: Remove declaration.
5948         [struct Chown_option] (recurse, force_silent): Change type to `bool'.
5949         [struct Chown_option] (dereference): Remove member with ambiguous name.
5950         [struct Chown_option] (affect_symlink_referent): New member.
5951         (chown_files): New prototype.
5952
5953         * tests/chgrp/recurse: Update tests accordingly.
5954         * tests/chgrp/posix-H: New tests for the above.
5955         * tests/chgrp/Makefile.am (TESTS): Add posix-H.
5956
5957         * src/ln.c (usage): Clarify that --directory, -d, -F probably won't
5958         work even for superuser.  Suggestion from Dan Jacobson.
5959
5960 2003-10-14  Paul Eggert  <eggert@twinsun.com>
5961
5962         Fix some number-parsing bugs, e.g., "head -n 100k@" wasn't
5963         properly diagnosed.
5964         * lib/human.c, lib/xstrtoimax.c, lib/xstrtol.c, lib/xstrtol.h,
5965         lib/xstrtoul.c, lib/xstrtoumax.c: Sync with gnulib.
5966         * src/sort.c (parse_field_count): Handle the case where overflow
5967         and invalid suffix char are both reported.
5968
5969 2003-10-14  Jim Meyering  <jim@meyering.net>
5970
5971         * src/ls.c (decode_switches) [TIOCGWINSZ]: Comment out the
5972         warning-inducing test, ws.ws_col <= SIZE_MAX, since it was always
5973         true on Linux.
5974
5975 2003-10-13  Paul Eggert  <eggert@twinsun.com>
5976
5977         Fix to avoid a denial-of-service attack if the display width is
5978         enormous.  Also, clean up the code a bit by removing duplicate code.
5979
5980         * src/ls.c (init_column_info): Remove forward decl; no longer needed.
5981         (calculate_columns): New function, that contains code that used
5982         to be common to print_many_per_line and print_horizontal.
5983         (print_many_per_line, print_horizontal): Use it.
5984         (decode_switches): Set max_idx here, not in calculate_columns.
5985         (print_current_files): Don't call init_column_info; calculate_columns
5986         now does that.
5987         (init_column_info): Don't allocate a lot more space than is needed
5988         to represent the current set of files.  Allocate all the new
5989         size_t cells in one call to xnmalloc, rather than a row at a time.
5990
5991 2003-10-13  Jim Meyering  <jim@meyering.net>
5992
5993         * src/ls.c (init_column_info): Add another FIXME comment.
5994
5995 2003-10-13  Paul Eggert  <eggert@twinsun.com>
5996
5997         Fix address-arithmetic bug in 'ls', reported by Georgi Guninski.
5998         Remove several arbitrary limits on hosts where int cannot represent
5999         all size_t values.
6000
6001         * src/ls.c (struct bin_str.len, length_of_file_name_and_frills, indent,
6002         nfiles, files_index, tabsize, line_length, struct column_info.line_len,
6003         struct column_info.col_arr[0], max_idx):
6004         Now size_t, not int.
6005         (get_funky_string): Return bool indicating success, instead of
6006         a negative count to indicate failure.  Store number of columns
6007         through new parameter OUTPUT_COUNT; that way, they can never
6008         go negative.  Change equals_end from int to bool.  All uses
6009         changed.
6010         (struct column_info.valid_len): Now bool, not int.  All uses changed.
6011         (dired_dump_obstack, get_funky_string, clear_files,
6012         extract_dirs_from_files, print_current_files,
6013         print_many_per_line, print_horizontal, init_column_info,
6014         put_indicator, length_of_file_name_and_frills,
6015         print_with_commas): Use size_t, not int, for local variables
6016         that count sizes.
6017         (decode_switches): Decode sizes using xstrtoul, not xstrtol.
6018         Check for TIOCGWINSZ returing negative values (or values greater
6019         than SIZE_MAX!).
6020         (visit_dir, main, parse_ls_color, queue_directory, add_ignore_pattern,
6021         init_column_info):
6022         Use xmalloc and xnmalloc, not XMALLOC.
6023         (gobble_file): Use xnrealloc, not XREALLOC.
6024         (print_color_indicator): Remove now-unnecessary cast to size_t.
6025
6026 2003-10-12  Paul Eggert  <eggert@twinsun.com>
6027
6028         * tests/du/no-x: Change wording of diagnostic to match latest du.c.
6029         * tests/sort/sort-tests: Remove from CVS; assume that people
6030         brave enough to check coreutils out from CVS can rebuild it.
6031
6032 2003-10-12  Jim Meyering  <jim@meyering.net>
6033
6034         New options: --preserve-root and --no-preserve-root.
6035         * src/chmod.c (change_file_mode): Honor new option.
6036         (change_file_mode): Strip trailing slashes on directory
6037         argument passed to change_dir_mode.
6038         (get_root_dev_ino): New function.
6039         (main): Initialize global, root_dev_ino.
6040
6041         * src/copy.c (copy_internal): Don't #ifdef-out simple uses of
6042         S_ISLNK or S_ISSOCK.  The S_IS* macros are guaranteed to be defined
6043         via system.h.
6044         * src/chmod.c (change_file_mode): Likewise.
6045
6046 2003-10-08  Jim Meyering  <jim@meyering.net>
6047
6048         * src/csplit.c (main): Remove obsolete FIXME.
6049
6050 2003-10-07  Jim Meyering  <jim@meyering.net>
6051
6052         * Use automake-1.7.8.  Regenerate dependent files.
6053
6054 2003-09-29  Paul Eggert  <eggert@twinsun.com>
6055
6056         csplit cleanup.
6057
6058         * doc/coreutils.texi (csplit invocation):
6059         The regexp offset need not have a sign; POSIX requires support
6060         for signless offets.
6061
6062         Be more careful about int widths.  For example, remove some
6063         arbitrary limits by replacing 'unsigned' with 'size_t',
6064         'uintmax_t', etc.  Use standard bool rather than a homegrown type.
6065         * lib/Makefile.am (libfetish_a_SOURCES): Add xstrtoimax.c.
6066         * src/csplit.c (FALSE, TRUE, boolean): Remove.  All uses changed
6067         to <stdbool.h> usage.
6068         (struct control): offset is now intmax_t, not int.
6069         repeat_forever is now bool, not int.
6070         (struct cstring): len is now size_t, not unsigned int.
6071         (struct buffer_record): bytes_alloc, bytes_used, num_lines are now
6072         size_t, not unsigned.  start_line, first_available are now
6073         uintmax_t, not unsigned.
6074         (hold_count, control_used): Now size_t, not unsigned.
6075         (last_line_number, current_line, bytes_written):
6076         Now uintmax_t, not unsigned.
6077         (save_to_hold_area, red_input, keep_new_line, record_line_starts,
6078         create_new_buffer, get_new_buffer, load_buffer, find_line,
6079         process_regexp, split_file, new_control_record, extract_regexp,
6080         get_format_width, get_format_prec, max_out):
6081         size args, locals, and returned values are now size_t, not unsigned
6082         or int.
6083         (get_first_line_in_buffer, find_line, write_to_file,
6084         handle_line_error, process_line_count, regexp_error, process_regexp,
6085         split_file):
6086         File line, byte, and repetition counts are now uintmax_t, not unsigned.
6087         (check_for_offset): Don't require a sign before the offset.
6088         Use xstrtoimax to do the real work.
6089         (extract_regexp): Remove harmful cast of size to unsigned.
6090         256 -> 1<<CHAR_BIT, for clarity.
6091         (get_format_flags): Return at most 3, to avoid worries about overflow.
6092
6093         (bytes_to_octal_digits): Remove.
6094
6095         (cleanup): Don't check whether output_stream is NULL, since
6096         close_output_file does that for us.
6097
6098         (new_line_control, create_new_buffer): Use "foo *p = xmalloc
6099         (sizeof *p);" instead of the more long-winded alternatives.
6100
6101         (get_new_buffer): Use O(1) algorithm for resizing a buffer
6102         to a much larger size, instead of an O(N) algorithm.
6103
6104         (process_regexp): Use plain NULL rather than casted 0.
6105
6106         (make_filename): Use %u, not %d, to format unsigned file number.
6107
6108         (new_control_record): Use xrealloc exclusively, since it handles
6109         NULL reliably.
6110
6111         (extract_regexp): Change misspelled word in diagnostic.
6112
6113         (get_format_width): Even if a minimum field width is specified,
6114         allow room for enough octal digits to represent the value of
6115         the maximum representible integer.  This fixes a potential
6116         buffer overrun.  Calculate this room at compile-time, not
6117         at run-time; this removes the need for bytes_to_octal_digits.
6118         Check for overflow; this removes a FIXME.
6119
6120         (get_format_prec): Don't allow precision to be signed; it's
6121         not ANSI.  Check for overflow.  Remove hardcoded "11" as
6122         default precision; this fixes a potential buffer overrun
6123         on hosts with wider size_t.
6124
6125         (get_format_conv_type): Change local variable to be of type
6126         unsigned char, not int; this removes a potential subscript
6127         violation on hosts where char is signed.
6128
6129         (max_out): Replace "for (;*p;)" with more-standard "while (*p)".
6130         Allow "%%" in format.  Don't overflow when
6131         counting lots of percents.
6132
6133         (usage): Default sprintf format is %02u, not %d.
6134
6135 2003-10-05  Jim Meyering  <jim@meyering.net>
6136
6137         * src/chown-core.c (change_file_owner): Remove set-but-not-used local.
6138
6139         * src/du.c (du_files): Mark diagnostic for translation.
6140
6141 2003-10-04  Jim Meyering  <jim@meyering.net>
6142
6143         * src/du.c (du_files): Ignore any failure of fts_close.
6144         Give better diagnostics for failed fts_open.
6145
6146         * src/du.c (MAX_N_DESCRIPTORS): Remove now-unused definition.
6147
6148         Deprecate existing use of -H (aka --si).
6149         * src/du.c (enum) [HUMAN_SI_OPTION]: New member.
6150         [long_options]: Use HUMAN_SI_OPTION, not 'H'.
6151         (main): Warn that the meaning of -H will soon change to be
6152         POSIX compliant.
6153
6154 2003-10-03  Jim Meyering  <jim@meyering.net>
6155
6156         * src/du.c: Accept --no-dereference (-P).
6157
6158 2003-10-02  Jim Meyering  <jim@meyering.net>
6159
6160         * tests/du/trailing-slash: Adjust for slightly different output.
6161
6162         Rewrite du.c to use fts.
6163         * src/du.c: Include "fts_.h", not ftw.h.
6164         (opt_dereference_arguments, arg_length, suffix_length): Remove globals.
6165         (IS_FTW_DIR_TYPE): Remove definition.
6166         (IS_DIR_TYPE): Define.
6167         (is_symlink_to_dir): Remove now-unnecessary function.
6168         (process_file, du_files): Rewrite to use fts.
6169
6170         * tests/du/inaccessible-cwd: Ensure that even when run from an
6171         inaccessible directory, du can still operate on accessible
6172         directories elsewhere.
6173         * tests/du/Makefile.am (TESTS): Add inaccessible-cwd.
6174
6175         * tests/rm/deep-1: Ensure that du can process a hierarchy
6176         of depth 400 while using no more than 50KB of stack space.
6177
6178 2003-10-01  Akim Demaille  <akim@epita.fr>
6179
6180         * announce-gen (print_news_deltas): New function, extracted from main.
6181         (main): Make `news_file' an array.
6182         Use '...=s' => \@var for --news and --url-directory specs.
6183         Before there were a couple of portability problems.
6184
6185 2003-09-28  Jim Meyering  <jim@meyering.net>
6186
6187         * Makefile.maint (sc_cast_of_alloca_return_value): New rule.
6188         (syntax-check-rules): Add it.
6189
6190         * src/copy.c: Remove unnecessary cast of alloca, since now it's
6191         guaranteed to be (void *).
6192         * src/cp.c: Likewise.
6193         * src/join.c: Likewise.
6194         * src/ln.c: Likewise.
6195         * src/ls.c: Likewise.
6196         * src/od.c: Likewise.
6197         * src/sys2.h (ASSIGN_STRDUPA): Likewise.
6198
6199 2003-09-27  Jim Meyering  <jim@meyering.net>
6200
6201         Don't exhaust virtual memory when processing large inputs.
6202         Fix this by removing csplit's internal free-list management;
6203         instead rely on malloc for that.
6204
6205         * src/csplit.c (free_list): Remove global.
6206         (clear_all_line_control): Remove function.
6207         (get_new_buffer): Always use create_new_buffer to obtain a
6208         new buffer, rather than searching free_list.
6209         (free_buffer): Just call free.
6210         Reported by Nikola Milutinovic.
6211
6212 2003-09-26  Jim Meyering  <jim@meyering.net>
6213
6214         * man/rm.x: Also list `chattr' in SEE ALSO section.
6215         Suggestion from Mark Hubbart.
6216
6217 2003-09-25  Jim Meyering  <jim@meyering.net>
6218
6219         * configure.ac: Don't invoke AC_AIX or AC_MINIX explicitly, now
6220         that we use gl_USE_SYSTEM_EXTENSIONS, since it AC_REQUIREs them.
6221
6222         * Use autoconf-2.57d.  Regenerate dependent files.
6223
6224 2003-09-24  Jim Meyering  <jim@meyering.net>
6225
6226         Minor efficiency tweak.
6227         * src/ln.c (PATH_BASENAME_CONCAT): Use memcpy rather than strcpy.
6228         (do_link): Likewise.
6229
6230 2003-09-23  Jim Meyering  <jim@meyering.net>
6231
6232         * src/paste.c (paste_serial): Save errno after input error,
6233         to report proper errno value.
6234         Based on a patch from Paul Eggert.
6235
6236         * src/tee.c (tee): Adjust fwrite arguments so that the return
6237         value is the number of bytes written.
6238
6239 2003-09-16  Paul Eggert  <eggert@twinsun.com>
6240
6241         Don't assume ferror sets errno.  Bug reported by Bruno Haible.
6242
6243         * src/comm.c (compare_files): Save errno after input error,
6244         to report proper errno value.
6245         * src/fold.c (fold_file): Likewise.
6246         * src/od.c (check_and_close, skip, read_char, read_block): Likewise.
6247         * src/unexpand.c (unexpand): Likewise.
6248
6249         * src/csplit.c (close_output_file): Don't report bogus errno value
6250         after ferror discovers an output error.  We don't know the proper
6251         errno value, since it might have been caused by any of a whole
6252         bunch of calls, and it might have been trashed in the meantime.
6253         Fixing this problem will require much more extensive changes;
6254         in the meantime just say "write error".
6255         * src/od.c (check_and_close, dump, dump_strings): Likewise.
6256         * src/uniq.c (check_file): Likewise.
6257
6258         * src/join.c (get_line): Report error right away if I/O fails,
6259         so that the proper errno value is used.
6260         * src/tac.c (tac_seekable, tac_file, save_stdin): Likewise.
6261         * src/tee.c (tee): Likewise.
6262         * src/uniq.c (check_file): Likewise.
6263
6264         * src/od.c (skip): If a read fails, don't retry it later, so
6265         that we report the proper errno.
6266
6267         * src/tac.c (tac_mem): Don't return a value; nobody uses it.
6268
6269         * src/tee.c (tee): Once a write failure has occurred, don't bother
6270         writing anything more to that stream.
6271
6272         * src/uniq.c (check_file): Check for ferror (stdout) even if
6273         ostream == stdout.
6274
6275         * src/yes.c (UNROLL): Remove.
6276         (main): Exit immediately when write failure is detected.
6277         Simplify code by assigning to argv when argc == 1.
6278
6279 2003-09-21  Paul Eggert  <eggert@twinsun.com>
6280
6281         * src/ptx.c: Switch encoding from Latin-1 to UTF-8.
6282         (WRITTEN_BY): Change "Franc,ois" (actually using
6283         c-with-cedilla in Latin-1) to "F.", so that it's ASCII, as
6284         xgettext requires.
6285
6286 2003-09-19  Jim Meyering  <jim@meyering.net>
6287
6288         `du -D symlink-to-dir' would mistakenly omit the slash in
6289         lines like this: 24     symlink-to-dir/subdir
6290         * src/du.c (process_file): Fix offset calculation.
6291         Reported by Jeff Sheinberg as Debian bug #211591;
6292         http://bugs.debian.org/205251
6293
6294         * tests/du/deref-args: New file/test for the above.
6295         * tests/du/Makefile.am (TESTS): Add deref-args.
6296
6297         * src/du.c (process_file): Remove useless disjunct.
6298
6299         * src/sys2.h (case_GETOPT_VERSION_CHAR): Rename parameter, Authors,
6300         to Written_by.
6301         * nearly all src/*.c files (WRITTEN_BY): Rename from AUTHORS.
6302         Begin each WRITTEN_BY string with `Written by ' and end it with `.'.
6303         Mark each WRITTEN_BY string as translatable.
6304
6305         * basename.c, cat.c, chroot.c, cksum.c, comm.c, cp.c, csplit.c, cut.c:
6306         * dd.c, df.c, dirname.c, du.c, echo.c, env.c, expr.c, factor.c, head.c:
6307         * hostid.c, hostname.c, id.c, link.c, ln.c, logname.c, ls.c, md5sum.c:
6308         * mv.c, nice.c, nl.c, nohup.c, paste.c, pathchk.c, pinky.c, pr.c:
6309         * printenv.c, printf.c, pwd.c, rm.c, setuidgid.c, sleep.c, sort.c:
6310         * split.c, stty.c, sum.c, sync.c, tac.c, tail.c, tee.c, test.c:
6311         * touch.c, tsort.c, uniq.c, unlink.c, uptime.c, users.c, wc.c:
6312         * who.c, whoami.c, yes.c: Revert yesterday's changes.
6313         Instead, a subsequent change will embed `Written by ' in
6314         each string along with the author names.
6315
6316         * src/true.c: Revert yesterday's changes.
6317         * src/sys2.h: Likewise.
6318
6319 2003-09-18  Jim Meyering  <jim@meyering.net>
6320
6321         * basename.c, cat.c, chroot.c, cksum.c, comm.c, cp.c, csplit.c, cut.c:
6322         * dd.c, df.c, dirname.c, du.c, echo.c, env.c, expr.c, factor.c, head.c:
6323         * hostid.c, hostname.c, id.c, link.c, ln.c, logname.c, ls.c, md5sum.c:
6324         * mv.c, nice.c, nl.c, nohup.c, paste.c, pathchk.c, pinky.c, pr.c:
6325         * printenv.c, printf.c, pwd.c, rm.c, setuidgid.c, sleep.c, sort.c:
6326         * split.c, stty.c, sum.c, sync.c, tac.c, tail.c, tee.c, test.c:
6327         * touch.c, tsort.c, uniq.c, unlink.c, uptime.c, users.c, wc.c:
6328         * who.c, whoami.c, yes.c: Update AUTHORS definition to be a
6329         comma-separated list of strings and/or update the call to
6330         parse_long_options so that `AUTHORS, NULL' are the last parameters.
6331         * src/true.c (main): Append NULL to version_etc argument list.
6332         * src/sys2.h (case_GETOPT_VERSION_CHAR): Likewise.
6333
6334         * src/sort.c (numcompare): Rename local, logb, to log_b to avoid
6335         shadowing the math function name.  Also rename loga to log_a.
6336
6337 2003-09-14  Jim Meyering  <jim@meyering.net>
6338
6339         * src/factor.c (print_factors): Give a separate diagnostic
6340         for numbers that are too large, but otherwise valid.
6341         Reported by Dániel Varga.
6342
6343 2003-09-10  Jim Meyering  <jim@meyering.net>
6344
6345         * Use automake-1.7.7.  Regenerate dependent files.
6346
6347         * tests/Makefile.am (all_programs): Use ../src/tr -s ' ' '\n' in place
6348         of `fmt -1'.  Using the just-built tr is a little cleaner.
6349         Christian Krackowizer reported that HPUX 10.20 doesn't have fmt.
6350         * man/Makefile.am (programs, check-x-vs-1): Likewise.
6351
6352 2003-09-09  Jim Meyering  <jim@meyering.net>
6353
6354         * src/copy.c: Alphabetize includes.
6355         Remove duplicate inclusion of "same.h".
6356
6357 2003-09-08  Jim Meyering  <jim@meyering.net>
6358
6359         * Makefile.maint (GZIP_ENV): Remove --rsyncable.
6360         Didn't give enough of a benefit, mainly because it's not yet
6361         in wide enough use.
6362
6363         * Version 5.0.91.
6364
6365         * man/Makefile.am (programs): Use ../src, not $(srcdir)/../src.
6366         (check-programs-vs-x): Fail if $(programs) is empty.
6367
6368         * src/remove.c: Add a comment.
6369
6370 2003-09-07  Jim Meyering  <jim@meyering.net>
6371
6372         * src/remove.c (D_INO, ENABLE_CYCLE_CHECK) [D_INO_IN_DIRENT]:
6373         Don't define.  These symbols are no longer used.
6374
6375         * tests/misc/tty-eof: Write ^D as \cD.
6376         Complete the change of 2003-08-02.
6377
6378         * Makefile.maint (po-check): Use cvsu, so that a temporary source
6379         file in lib/ or src/ doesn't induce an unwarranted failure.
6380         Add a kludge to filter out the sole generated source file that
6381         also has translatable messages: src/false.c.
6382
6383 2003-09-06  Jim Meyering  <jim@meyering.net>
6384
6385         * src/tail.c (enum): Add ALLOW_MISSING_OPTION.
6386         (parse_options): Give a diagnostic for (but still accept) the
6387         deprecated --allow-missing option.
6388
6389 2003-09-04  Paul Eggert  <eggert@twinsun.com>
6390
6391         Don't ignore -S if input is a pipe.  Bug report by Michael McFarland in
6392         <http://mail.gnu.org/archive/html/bug-coreutils/2003-09/msg00008.html>.
6393
6394         * src/sort.c (sort_buffer_size): Omit SIZE_BOUND arg.  Compute the
6395         size_bound ourselves. if an input file is a pipe and the user
6396         specified a size, use that size instead of trying to guess the
6397         pipe size.  This has the beneficial side effect of avoiding the
6398         overhead of default_sort_size in that case.  All callers changed.
6399         (sort): Remove static var size; now done by sort_buffer_size.
6400
6401 2003-09-05  Jim Meyering  <jim@meyering.net>
6402
6403         * Use automake-1.7.6b and autoconf-2.57b.  Regenerate dependent files.
6404
6405         * tests/tail-2/tail-n0f: Wait .5 seconds for backgrounded process
6406         to start, rather than just .1.  Upon failure, print unexpected state.
6407
6408 2003-09-04  Paul Eggert  <eggert@twinsun.com>
6409
6410         * src/head.c (elide_tail_lines_pipe): Don't assign 0 or
6411         SAFE_READ_ERROR to tmp->nbytes.
6412         * src/tail.c (pipe_lines, pipe_bytes): Likewise.
6413
6414         * src/head.c (struct linebuffer): Change nbytes and nlines
6415         from unsigned int to size_t.  unsigned int is safe (after the
6416         2003-09-03 patch) but size_t is cleaner.
6417         * src/tail.c (struct linebuffer, struct charbuffer): Likewise.
6418         (pipe_bytes): Likewise for local variable 'i', which was 'int'.
6419
6420         Standardize on BUFSIZ as opposed to other macro names and values.
6421         * src/head.c (BUFSIZE): Remove.  All uses changed to BUFSIZ.
6422         * src/tail.c (BUFSIZ) [!defined BUFSIZ]: Remove.
6423         stdio.h has always defined it,
6424         and other code already assumes it's defined.
6425         * src/tr.c (BUFSIZ) [!defined BUFSIZ]: Likewise.
6426         (IO_BUF_SIZE): Remove; replace all uses with sizeof io_buf.
6427         (io_buf): IO_BUF_SIZE -> BUFSIZ.
6428
6429 2003-09-04  Paul Eggert  <eggert@twinsun.com>
6430
6431         * src/seq.c (step): Default to 1.
6432         (print_numbers): Allow the output to be empty.
6433         (main): The default step is 1, even if LAST < FIRST;
6434         as per documentation.
6435         * tests/seq/basic (onearg-2): Output should be empty.
6436
6437 2003-09-05  Jim Meyering  <jim@meyering.net>
6438
6439         * Makefile.cfg (wget_files): Temporarily disable, until master
6440         versions are restored to ftp.gnu.org.
6441
6442         * configure.ac (AM_INIT_AUTOMAKE): Specify automake-1.7.6.
6443
6444         Make seq's --width (-w) option work properly even when the
6445         endpoint requiring the larger width is negative and smaller than
6446         the other endpoint.
6447         * src/seq.c (get_width_format): Include `-' in the set of bytes
6448         allowed in a `simple' number (no decimal point, no exponent).
6449         Reported by Patrick Mauritz.
6450
6451 2003-09-02  Paul Eggert  <eggert@twinsun.com>
6452
6453         * NEWS: sort -t '\0' now uses a NUL tab.
6454         sort option order no longer matters, unless POSIX requires it.
6455         * src/sort.c (usage): Say "blanks" instead of "whitespace",
6456         Similar fixes for many comments.
6457         (TAB_DEFAULT): New constant, so that we can support NUL as
6458         the field separator.
6459         (tab): Now int, not char.  Initialize to TAB_DEFAULT.
6460         (specify_sort_size): If multiple sizes are specified, use the largest.
6461         (begfield, limfield): Support NUL tab char.
6462         (set_ordering): Do not let -i override -d.
6463         (main): Report an error if incompatible -o or -t options are given.
6464         Report an error for "-t ''".  Allow "-t '\0'" to specify a NUL tab.
6465
6466 2003-09-05  Jim Meyering  <jim@meyering.net>
6467
6468         * tests/sort/Test.pm [o2, nul-tab]: New tests for the above.
6469
6470 2003-09-03  Andreas Schwab  <schwab@suse.de>
6471
6472         Bug report and patch here:
6473         <http://mail.gnu.org/archive/html/bug-coreutils/2003-09/msg00009.html>
6474         * src/tail.c (pipe_lines): Don't truncate return value from safe_read.
6475         * src/head.c (elide_tail_lines_pipe): Likewise.
6476
6477 2003-09-03  Jim Meyering  <jim@meyering.net>
6478
6479         * src/du.c (AUTHORS): Remove Larry McVoy's name, since the relatively
6480         small amount of code from him was first moved to lib/human.c, and was
6481         subsequently rewritten entirely.
6482         * src/df.c (AUTHORS): Likewise.
6483
6484 2003-08-22  Lawrence Teo  <lcteo@uncc.edu>
6485
6486         * src/md5sum.c (split_3): Accept the BSD format for generic
6487         message digest modes.  Currently works with BSD's MD5 and SHA1
6488         formats since these are the two algorithms presently used in
6489         coreutils.  Updated comments to reflect this change.
6490         (bsd_split_3): Updated comments.
6491
6492         * tests/md5sum/basic-1: New test to make sure that
6493         `md5sum --check' doesn't accept the BSD SHA1 format (adapted
6494         from `check-bsd' test in tests/sha1sum/basic-1).
6495
6496         * tests/sha1sum/basic-1 (check-bsd2, check-bsd3): New tests for
6497         --check exit status and BSD SHA1 format (adapted from tests
6498         in tests/md5sum/basic-1).
6499
6500 2003-08-30  Jim Meyering  <jim@meyering.net>
6501
6502         * src/ln.c (do_link): Use SAME_INODE rather than open-coding it.
6503
6504         When source and destination arguments refer to the same file, reside
6505         on a partition (e.g. VFAT) on which distinct names may refer to the
6506         same directory entry (often due to variations in case), and when the
6507         link count for the file is 1, mv no longer unlinks the file.  Instead,
6508         it gives the expected diagnostic that the source and destination are
6509         the same.  WARNING: this is an incomplete fix.  If the file happens
6510         to have a link count of 2 or greater, such an erroneous mv command
6511         will still unlink it.
6512         Although that is not possible on vfat or umsdos, it is possible on
6513         other file system types, e.g., ntfs, and hpfs.
6514         * src/copy.c (same_file_ok): Invoke same_name (which might still
6515         return false for names that refer to the same directory entry)
6516         only if the link count is 2 or more.
6517         * tests/mv/vfat: Show how to demonstrate the above problem.
6518         This test is not run.
6519         * tests/mv/Makefile.am (EXTRA_DIST): Add vfat.
6520
6521 2003-08-27  Jim Meyering  <jim@meyering.net>
6522
6523         * src/who.c: Change meaning of -l from --lookup to --login, per POSIX.
6524         who's -l option has been eliciting an unconditional warning about
6525         this impending change since sh-utils-2.0.12 (April 2002).
6526
6527         * src/paste.c (paste_parallel): Don't output `EOF' (aka -1) as a `char'.
6528         This would happen for nonempty files not ending with a newline.
6529         Reported by Dan Jacobson.
6530         * tests/misc/paste-no-nl: New file.  Test for above-fixed bug.
6531         * tests/misc/Makefile.am (TESTS): Add paste-no-nl.
6532
6533         * src/stat.c (print_it): Avoid buffer overrun that would
6534         occur when the user-specified format string ends with `%'.
6535         Patch by Tommi Kyntola.
6536         * tests/misc/stat-fmt: New file.  Test for above-fixed bug.
6537         * tests/misc/Makefile.am (TESTS): Add stat-fmt.
6538
6539 2003-08-26  Jim Meyering  <jim@meyering.net>
6540
6541         Apply changes from bison.
6542         * GNUmakefile (SHELL): Define to `sh', if necessary.
6543         Add copyright.
6544         * Makefile.maint (WGETFLAGS): Define to `-C off'.
6545         Update all uses of $(WGET).
6546
6547 2003-08-22  Akim Demaille  <akim@epita.fr>
6548
6549         * Makefile.cfg (local-checks-to-skip): New.
6550         * Makefile.maint (local-check): Rename as...
6551         (local-checks-available): this.
6552         (local-check): New.
6553
6554 2003-08-26  Akim Demaille  <akim@epita.fr>
6555
6556         * announce-gen (print_changelog_deltas): Neutralize "<#" as
6557         "<\#" to avoid magic from Gnus when posting parts of this script.
6558
6559 2003-08-25  Jim Meyering  <jim@meyering.net>
6560
6561         * src/stat.c (main): Warn about use of deprecated `-l' option.
6562
6563 2003-08-22  Jim Meyering  <jim@meyering.net>
6564
6565         * src/stat.c (do_stat): For link count at end of line, use %h format,
6566         instead of %-5h.  The latter would make stat emit trailing spaces.
6567         Reported by Dan Jacobson.
6568
6569 2003-08-20  Jim Meyering  <jim@meyering.net>
6570
6571         * Makefile.am (EXTRA_DIST): Add .x-sc_space_tab .x-sc_sun_os_names
6572
6573 2003-08-19  Jim Meyering  <jim@meyering.net>
6574
6575         * src/system.h: Include stdlib.h unconditionally,
6576         as we're now assuming that part of hosted C89.
6577
6578 2003-08-18  Jim Meyering  <jim@meyering.net>
6579
6580         * src/sys2.h (textdomain, bindtextdomain) [! ENABLE_NLS]: Define away,
6581         to avoid warnings from gcc.
6582
6583 2003-08-17  Jim Meyering  <jim@meyering.net>
6584
6585         Avoid unnecessary and sometimes time-consuming hostname lookups.
6586         * src/who.c (print_user): Use strchr, not strrchr.
6587         * src/pinky.c (print_entry): Likewise.
6588         Patch by Michael Stone.
6589         This fixes a typo I introduced in who-users.c on 1996-02-23.
6590
6591         * Makefile.maint (makefile-check): Add 0-9 to the range of characters
6592         disallowed between `@...@'.
6593
6594 2003-08-16  Paul Eggert  <eggert@twinsun.com>
6595
6596         * configure.ac (fu_cv_sys_truncating_statfs): Remove; now
6597         done by gnulib .m4 files.
6598         (jm_DUMMY_1): Require gl_READUTMP, not jm_PREREQ_READUTMP.
6599         * src/sys2.h (strtoull): Remove unused declaration.
6600
6601 2003-08-16  Jim Meyering  <jim@meyering.net>
6602
6603         * man/Makefile.am (.x.1): Ensure that generated PROGRAM.1 files
6604         are read-only.
6605
6606         * src/tail.c (tail_lines): Fix a potential (but very hard to exercise)
6607         race condition bug.  The bug would be triggered when tailing a file
6608         with file pointer not at beginning of file, and where the file was
6609         truncated to have a length of less than the initial offset at just
6610         the right moment (between the two lseek calls in this function).
6611
6612         An invalid initial value for *read_pos would result in
6613         `tail -n0 -f FILE' and `tail -c0 -f FILE' doing what amounted to a
6614         busy-wait rather than sleeping between iterations.  The bug manifests
6615         itself only when tailing regular files that are initially nonempty.
6616         * src/tail.c (tail_bytes): Set *read_pos to new file offset after
6617         each xlseek call.
6618         (tail_lines): Likewise, after lseek calls.
6619         Reported by Nick Estes.  See http://bugs.debian.org/205251 for details.
6620         * tests/tail-2/tail-n0f: New file.  Test for above fix.
6621         * tests/tail-2/Makefile.am (TESTS): Add tail-n0f.
6622
6623 2003-08-15  Jim Meyering  <jim@meyering.net>
6624
6625         * Makefile.maint (sc_space_tab): Use exclusion list in separate file.
6626         (sc_sun_os_names): Likewise.
6627         * .x-sc_space_tab, .x-sc_sun_os_names: New files.
6628
6629         * man/help2man: Remove some SPACEs before TAB.
6630
6631 2003-08-14  Paul Eggert  <eggert@twinsun.com>
6632
6633         * Makefile.maint (LC_ALL): Set to C.
6634         * man/Makefile.am (ASSORT): New var.
6635         (check-x-vs-1, programs): Use it.
6636         * src/Makefile.am (ASSORT, check-README, ../AUTHORS): Likewise.
6637         * tests/Makefile.am (ASSORT, all_programs): Likewise.
6638
6639 2003-08-11  Jim Meyering  <jim@meyering.net>
6640
6641         fold -s -wN would infloop for N < 8 with TABs in the input.
6642         E.g., this would not terminate: printf 'a\tb' | fold -w2 -s
6643         * src/fold.c (fold_file): Move contents of `else'-block
6644         out of conditional so it's used also for --spaces (-s).
6645         * tests/misc/fold: Test for the above fix.
6646         * tests/misc/Makefile.am (TESTS): Add fold.
6647
6648 2003-08-10  Jim Meyering  <jim@meyering.net>
6649
6650         * src/nice.c [!NICE_PRIORITY]: Include <sys/resource.h> after
6651         system.h so the types from time.h and sys/time.h are available.
6652         It appears that this is necessary for OpenBSD, NetBSD, and
6653         Darwin 6.5 (MacOS 10.2.5).  Reported by Nelson Beebe.
6654
6655 2003-08-06  Paul Eggert  <eggert@twinsun.com>
6656
6657         * NEWS: Add support for setting file timestamps to microsecond
6658         resolution, on hosts that support this.
6659         * src/copy.c, src/cp.c, src/install.c, src/touch.c: Include utimens.h.
6660         * src/copy.c (copy_internal):
6661         Set file timestamps with utimens, not utime.
6662         * src/cp.c (re_protect): Likewise.
6663         * src/install.c (change_timestamps): Likewise.
6664         * src/touch.c (newtime, touch, main): Likewise.
6665
6666 2003-08-09  Jim Meyering  <jim@meyering.net>
6667
6668         * Makefile.maint (sc_sun_os_names): New rule based on a regexp
6669         from Paul Eggert.
6670         (syntax-check-rules): Add it.
6671
6672         * src/tail.c (main): Tweak Solaris OS version number in comment.
6673         * src/wc.c (wc): Likewise
6674         * tests/tail-2/fflush: Likewise.
6675
6676         * src/tail.c: Add new undocumented option, --presume-input-pipe.
6677         (pipe_lines): Use memchr to skip lines, rather than an explicit loop.
6678
6679 2003-08-08  Paul Eggert  <eggert@twinsun.com>
6680
6681         Use new gnulib 'extensions' module.
6682         * configure.ac: Invoke gl_USE_SYSTEM_EXTENSIONS instead of
6683         AC_GNU_SOURCE.
6684
6685 2003-08-08  Paul Eggert  <eggert@twinsun.com>
6686
6687         * tests/du/basic: Ensure that a/b/F has at least 65 bytes too.
6688
6689 2003-08-09  Jim Meyering  <jim@meyering.net>
6690
6691         * tests/misc/split-fail: Reflect that `split -a 0' is now accepted.
6692         For tests of obsolete behavior, don't presume that unsetting
6693         _POSIX2_VERSION is equivalent to _POSIX2_VERSION=199209.
6694
6695 2003-08-07  Paul Eggert  <eggert@twinsun.com>
6696
6697         * doc/coreutils.texi (split invocation):
6698         Add -d or --numeric-suffixes option to 'split'.
6699         From a suggestion by Jesse Kornblum.
6700         * src/split.c (suffix_alphabet): New var.
6701         (longopts, usage, next_file_name, main): Support -d.
6702         (next_file_name, main): Allow -a0, as POSIX requires.
6703         (next_file_name): Don't assume ASCII-like encoding;
6704         'a' through 'z' are not contiguous in EBCDIC.
6705
6706 2003-08-05  Paul Eggert  <eggert@twinsun.com>
6707
6708         Merge getline from gnulib.
6709         * lib/getline.h, lib/getline.c, m4/getline.m4: Merge from gnulib.
6710         * lib/getndelim2.h, lib/getndelim2.c, m4/getndelim2.m4, m4/ssize_t.m4:
6711         New files, from gnulib.
6712         * lib/getdelim2.c, lib/getdelim2.h: Remove.
6713         * lib/Makefile.am (libfetish_a_SOURCES): Change getdelim2.c and
6714         getdelim2.h to getndelim2.c and getndelim2.h.
6715         * m4/jm-macros.m4 (jm_MACROS): Use gl_GETNDELIM2 rather than
6716         checking for getdelim.
6717         (jm_CHECK_ALL_TYPES): Use gt_TYPE_SSIZE_T for ssize_t rather
6718         than rolling our own.
6719         * src/cut.c: Include getndelim2.h rather than getdelim2.h.
6720         (cut_fields): Invoke getndelim2 rather than getdelim2.
6721
6722 2003-08-04  Jim Meyering  <jim@meyering.net>
6723
6724         * src/sort.c (main): Use unsigned int instead of int for `nsigs'
6725         and for the indices to iterate through nsigs.
6726
6727 2003-08-02  Paul Eggert  <eggert@twinsun.com>
6728
6729         * src/sort.c: Minor code cleanups, mostly to use more accurate
6730         types and to remove unnecessary casts.
6731         (min, max): Remove.  All uses changed to MIN and MAX.
6732         (hard_lc_collate, hard_LC_TIME, struct buffer.eof, struct
6733         keyfield.skipsblanks, struct keyfield.skipeblanks, struct
6734         keyfield.numeric, struct keyfield.general_numeric, struct
6735         keyfield.month, struct keyfield.reverse, reverse, unique,
6736         have_read_stdin): Now bool, not int.  All uses changed.
6737         (eolchar): Now char, not int.
6738         (struct keyfield.ignore): Now bool const *, not int *.
6739         (struct keyfield.translate): Now char const *, not char *.
6740         (struct month.name): Likewise.
6741         (blanks, nonprinting, nondictionary): Now bool[], not int[].
6742         (cleanup, inittables, keycompare, check, mergefps, first_same_file,
6743         check, sort, main): Use const * pointers when possible.
6744         (month_cmp): Rewrite to avoid casts.
6745         (inittables): Initialize tables unconditionally, to avoid branches.
6746         (fillbuf): Return bool, not int.  All uses changed.
6747         (fillbuf, keycompare, new_key, main):
6748         Use SIZE_MAX rather than (size_t) -1.
6749         (trailing_blanks): Renamed from trim_trailing_blanks.
6750         Return the number of blanks to trim.  All uses changed.
6751         (getmonth): Use trailing_blanks rather than open code.
6752         (keycompare): Do not cast char * to unsigned char *; not needed.
6753         CMP_WITH_IGNORE converts args to UCHAR, so no need to convert it
6754         ourselves.
6755         (compare, main): Use | rather than || to avoid jumps.
6756         Replace "diff = NONZERO (alen)" with "diff = 1", since alen must
6757         be nonzero there.
6758         (check, first_same_file, sort, main):
6759         Use bool instead of int local vars when possible.
6760         (check): Merge the old 'checkfp' and 'check' into a single function,
6761         that returns a boolean (true if the file was ordered).
6762         All uses changed.
6763         (main): Use int instead of unsigned for iterating through nsigs.
6764         Rename local var "posix_pedantic" to "posixly_correct".
6765
6766 2003-08-02  Jim Meyering  <jim@meyering.net>
6767
6768         * src/nice.c [!NICE_PRIORITY]: Include <time.h> before <sys/resource.h>
6769         to avoid compilation error on Ultrix. Reported by Christian Krackowizer.
6770
6771         * src/cut.c (cut_fields): Don't read again after encountering an
6772         initial EOF.  E.g., `cut -f2' would do so.
6773         * tests/misc/tty-eof: Add a test for the above fix.
6774
6775         * src/sort.c (sortlines): Add description and references.
6776         From Paul Eggert.
6777
6778         * tests/Makefile.am (TESTS_ENVIRONMENT): Set PATH so that
6779         the tests in help-version will use the just-built binaries.
6780         Reported by Christian Krackowizer.
6781
6782 2003-07-31  Paul Eggert  <eggert@twinsun.com>
6783
6784         * NEWS: Add --rfc-2822 option to GNU date.
6785         * doc/coreutils.texi (Time directives, Options for date, Examples
6786         of date): Likewise.
6787         * src/date.c (long_options, usage, main): Likewise.
6788         * doc/getdate.texi (General date syntax): Likewise.
6789         * doc/coreutils.texi (Options for date): Fix a typo in format:
6790         it's now %d not %_d.  Add URLs.
6791
6792 2003-08-01  Jim Meyering  <jim@meyering.net>
6793
6794         * tests/shred/remove: Ensure that $? is 0 for the final `exit 0'.
6795         Otherwise, with at least the /bin/sh from HPUX 10.20,
6796         the trap code would end up converting that to exit 1 and thus an
6797         unexpected test failure.  Reported by Christian Krackowizer.
6798
6799 2003-07-31  Paul Eggert  <eggert@twinsun.com>
6800
6801         * src/ptx.c: Do not include bumpalloc.h.
6802         (WORD_TABLE): New member alloc.
6803         (ALLOC_NEW_WORD): Remove.
6804         (occurs_alloc): New var.
6805         (digest_word_file, find_occurs_in_text): Check for arithmetic
6806         overflow when computing table size.  Use xrealloc rather than
6807         bumpalloc primitives.
6808
6809 2003-07-29  Jim Meyering  <jim@meyering.net>
6810
6811         * Version 5.0.90.
6812
6813         * README: When running tests as root, suggest using
6814         sudo with NON_ROOT_USERNAME=$USER.
6815
6816         * tests/Makefile.am (all_programs): Makefile is in ../src, not
6817         $(srcdir)/../src.
6818
6819 2003-07-28  Jim Meyering  <jim@meyering.net>
6820
6821         * Makefile.maint (GZIP_ENV): Try Debian/gzip's new --rsyncable option.
6822
6823 2003-07-28  Paul Eggert  <eggert@twinsun.com>
6824
6825         * lib/stdbool.hin (_Bool): Make it signed char, instead of
6826         an enum type, so that it's guaranteed to promote to int.
6827         * src/sort.c (sortlines_temp): Undo previous change.
6828
6829 2003-07-28  Jim Meyering  <jim@meyering.net>
6830
6831         * src/sort.c (sortlines_temp): Declare local `swap' to be `int', not
6832         `bool'.  Otherwise, at least one buggy compiler (alpha gcc-2.95.4)
6833         would cause lines[-1 - swap] (with swap = false) to evaluate to
6834         lines[4294967295].
6835
6836 2003-07-27  Jim Meyering  <jim@meyering.net>
6837
6838         * tests/priv-check (my_uid): Use `!', not `^' in case pattern `[!0-9]',
6839         since /bin/sh of at least NetBSD 1.6 and OpenBSD 3.2 don't accept `^'.
6840
6841         * src/remove.c (prompt) [! recursive]: Don't prompt about unwritable
6842         directories, as required by POSIX.   Reported by Karl Berry.
6843         * tests/rm/dir-no-w: New file.  Test for the above fix.
6844         * tests/rm/Makefile.am (TESTS): Add dir-no-w.
6845
6846         * tests/mk-script: Emit `$xx', not its expansion.
6847
6848 2003-07-27  Paul Eggert  <eggert@twinsun.com>
6849
6850         This change was inspired by a similar proposal by Stepan Kasal.
6851         * src/sort.c (mergelines, sortlines_temp): New functions.
6852         (sortlines): Use them, to reduce the number of times that
6853         we need to copy 'struct line' values.  This improved CPU
6854         performance by about 30% on one 18 MB test.
6855         (sort): Don't invoke sortlines unless we have 2 or more lines.
6856
6857 2003-07-26  Stepan Kasal  <kasal@ucw.cz>
6858
6859         * src/sort.c (sort): Don't require two `struct line's per text line,
6860         the new sort algorithm requires just 1.5.
6861
6862 2003-07-27  Jim Meyering  <jim@meyering.net>
6863
6864         * src/pathchk.c (validate_path): Use %lu, not %ld.
6865         From Paul Eggert.
6866         * src/cut.c (is_printable_field): Simplify bit arithmetic.
6867         From Paul Eggert.
6868         * src/ls.c (sort_files): Put `volatile' in the right place.
6869         From Paul Eggert.
6870
6871 2003-07-26  Jim Meyering  <jim@meyering.net>
6872
6873         Use only one bit per field/offset in array, not one `int'.
6874         * src/cut.c (printable_field): Change type to `unsigned char'.
6875         (mark_printable_field, is_printable_field): New functions.
6876         Use them in place of all direct accesses of `printable_field'.
6877
6878         * src/expand.c (parse_tabstops): Detect overflow properly.
6879         * src/cut.c (set_fields): Likewise.
6880
6881         * src/rm.c: Include "dirname.h".
6882         (usage): Use base_name (program_name) in body of --help output.
6883         This lets me...
6884         * man/Makefile.am (.x.1): ...back out the kludge of 2003-07-22.
6885         Idea from Brendan O'Dea, who suggested using
6886         `program_name = basename (argv[0]);' everywhere --
6887         can't do that, but using base_name works just fine here.
6888
6889         * src/Makefile.am (AM_INSTALLCHECK_STD_OPTIONS_EXEMPT): Exempt test.
6890
6891 2003-07-24  Paul Eggert  <eggert@twinsun.com>
6892
6893         Fix some POSIX-compliance problems with 'test'.  This makes
6894         'test' more compatible with Bash.
6895
6896         * NEWS, doc/coreutils.texi: Document the following.
6897         * src/test.c: Include exitfail.h.
6898         (TEST_FAILURE): New constant, used for exit status if 'test' fails.
6899         (test-syntax_error): Use it.
6900         (binary_operator): Now takes bool arg specifying whether left operand
6901         is -l ARG, so that caller determines this rather than us.
6902         All uses changed.
6903         (term): Use posixtest to evaluate parenthesized subexpressions.
6904         (unary_operator, one_argument): Remove support for -t without operand.
6905         (one_argument): Take argument from argv[pos].
6906         (one_argument, two_arguments, three_arguments): Advance pos.
6907         All callers changed.
6908         (three_arguments): Look for binary ops before "!".  Then look
6909         for parenthesized one_argument expressions, instead of trusting
6910         expr () to do the right thing.
6911         (posixtest): Now takes number of args.  All callers changed.
6912         Treat "( A B )" like "A B".
6913         (main): Set exit_failure to TEST_FAILURE.  Don't depend on
6914         POSIXLY_CORRECT, as we now conform to POSIX by default.
6915         (main) [!LBRACKET]: Do not recognize "--help" or "--verbose" unless.
6916         * tests/test/Test.pm (test_vector): Add several tests to check
6917         the above.  Syntax errors now exit with status 2, not 1.
6918         * man/Makefile.am (mapped_name): Use `../src/[' binary to create test.1.
6919
6920 2003-07-26  Jim Meyering  <jim@meyering.net>
6921
6922         * tests/help-version: Adjust for above change in test behavior:
6923         `[' exits with 2, not 1, and test doesn't accept --help or --version.
6924
6925         * Makefile.maint (ME): Don't use trick suggested in Make manual.
6926         It doesn't work for make-3.79.1.  Reported by Christian Krackowizer.
6927
6928         * Makefile.maint (sc_system_h_headers): Another syntax check.
6929         (syntax-check-rules): Add it to the list.
6930
6931         * src/pathchk.c (validate_path): Cast strlen value to `unsigned long'
6932         so it matches `%ld' format even on 32-bit systems.
6933
6934         * src/fmt.c (flush_paragraph): Cast field width to `int' to
6935         avoid warning on 64-bit systems.
6936
6937         * src/ls.c (sort_files): Make `func' volatile, so it can't be
6938         clobbered by a `longjmp' into this function.
6939
6940 2003-07-25  Jim Meyering  <jim@meyering.net>
6941
6942         * src/pathchk.c (validate_path): Use %ld format (not %d) for size_t
6943         value.
6944
6945         * tests/misc/split-fail: Disable the --line-bytes=$_4gb test,
6946         because it'd evoke spurious failure on 64-bit systems.
6947
6948 2003-07-24  Jim Meyering  <jim@meyering.net>
6949
6950         * src/dd.c (usage): Document the fact that SIGUSR1 makes dd
6951         output its current record counts.  Reported by Jurriaan.
6952
6953         * tests/wc/Test.pm (test_vector): Disable the `PIPE' tests when running
6954         `wc' with no options.  This goes along with the change of 2003-07-20.
6955
6956 2003-07-23  Jim Meyering  <jim@meyering.net>
6957
6958         Don't include headers already included by system.h:
6959         * src/tr.c: Don't include errno.h.
6960         * src/true.c: Don't include version-etc.h.
6961         * src/test.c: Don't include limits.h or error.h.
6962         * src/stat.c: Don't include unistd.h or time.h.
6963         * src/readlink.c: Don't include stdlib.h, unistd.h, or limits.h.
6964         * src/pr.c: Don't include time.h.
6965         * src/pathchk.c: Don't include errno.h.
6966         * src/nice.c: Don't include sys/time.h.
6967         * src/ls.c: Don't include stdlib.h.
6968
6969         * basename.c, cat.c, chroot.c, cksum.c, comm.c, csplit.c, cut.c, date.c:
6970         * dd.c, dirname.c, echo.c, env.c, expand.c, expr.c, factor.c, fmt.c:
6971         * fold.c, head.c, hostid.c, hostname.c, id.c, join.c, kill.c, logname.c:
6972         * md5sum.c, nice.c, nl.c, nohup.c, od.c, paste.c, pathchk.c, pinky.c:
6973         * pr.c, printenv.c, printf.c, ptx.c, pwd.c, seq.c, setuidgid.c, shred.c:
6974         * sleep.c, sort.c, split.c, stat.c, stty.c, su.c, sum.c, tac.c, tail.c:
6975         * tee.c, test.c, tr.c, true.c, tsort.c, tty.c, uname.c, unexpand.c:
6976         * uniq.c, uptime.c, users.c, wc.c, who.c, whoami.c, yes.c:
6977         Don't include closeout.h.
6978
6979         * tests/rm/fail-2eperm: Add a check for whether $NON_ROOT_USERNAME
6980         can access the required version of rm.
6981         * tests/rm/Makefile.am (TESTS_ENVIRONMENT): Define PACKAGE_VERSION.
6982
6983         * tests/cut/Test.pm (out-delim3a): New test.
6984
6985         * man/help2man: Update to version 1.33.
6986
6987         * src/expand.c (parse_tabstops): Detect overflow in tabstop sizes.
6988
6989         * src/dircolors.c: Include xstrndup.h.
6990         (xstrndup): Remove function, now that it's been factored out into
6991         it's own file.
6992
6993 2003-07-22  Paul Eggert  <eggert@twinsun.com>
6994
6995         * src/wc.c (wc): Fix typo in computation of file from file_x,
6996         which caused the former to be used uninitialized if file_x was
6997         nonzero.
6998
6999 2003-07-22  Jim Meyering  <jim@meyering.net>
7000
7001         * src/cut.c (set_fields): Use xcalloc in place of xmalloc+memset.
7002
7003         * man/Makefile.am (.x.1): Substitute 's,$t/$*,$*,' on output of
7004         help2man, to avoid having `rm.td/rm' appear in rm.1.  Reported by
7005         Thomas Luzat.  See http://bugs.debian.org/202413 for details.
7006
7007         * src/cut.c (main) [lint]: Initialize spec_list_string to avoid warning.
7008
7009         * src/hostid.c: Don't include <unistd.h>.  system.h already does that.
7010
7011         * src/cut.c (set_fields): Mark all selected indices before trying to
7012         determine range endpoints.
7013         * tests/cut/Test.pm: New test for the above fix.
7014
7015         Begin to address this comment: What if someone wants to
7016         extract the 1,000,000-th field of some huge input file?
7017         The first step is to rearrange things so that the values
7018         in the printable_field array are all 0/1 rather than 0/1/2.
7019         * src/cut.c (RANGE_START_SENTINEL): Remove.
7020         Store range-start indices in a hash table, rather than
7021         overloading the `printable_field' array.
7022         (range_start_ht): New global.
7023         (hash_int, hash_compare_ints, is_range_start_index): New functions.
7024         (print_kth): Use is_range_start_index; don't test printable_field.
7025         (set_fields): Detect overflow.
7026         (set_fields): Insert each range-start index into range_start_ht.
7027         (main): Call set_fields only once, and only after
7028         output_delimiter_specified and (if required) range_start_ht have
7029         been defined.
7030
7031 2003-07-20  Paul Eggert  <eggert@twinsun.com>
7032
7033         * src/wc.c (get_input_fstatus): Fix typo: `stat' was being
7034         invoked with a null pointer when there were no file arguments.
7035
7036 2003-07-20  Jim Meyering  <jim@meyering.net>
7037
7038         * Makefile.maint (sc_changelog): Add another nit-picky check.
7039
7040         * src/wc.c (write_counts): Add a comment.
7041         (wc): Rename `file' parameter.
7042         Set new local, `file', to be the file name, or (when it's NULL)
7043         _("standard output") so that all uses of `file' use the proper value.
7044         Use STREQ, not strcmp.
7045
7046 2003-07-20  Paul Eggert  <eggert@twinsun.com>
7047
7048         wc count field widths now are heuristically adjusted depending
7049         on the input size, if known.  If only one count is printed, it
7050         is guaranteed to be printed without leading spaces.
7051
7052         Previously, wc did not align the count fields if
7053         POSIXLY_CORRECT was set, but POSIX did not actually require
7054         this undesirable behavior, so it has been removed.
7055
7056         * NEWS: Document this.
7057         * doc/coreutils.texi (wc invocation): Likewise.
7058
7059         * src/wc.c (number_width): New var.
7060         (posixly_correct): Remove.
7061         (struct fstatus): New struct.
7062         (write_counts): Output fields of width number_width.
7063         Do not worry about POSIXLY_CORRECT.
7064         Use null file, not empty-string file, to denote stdin,
7065         since "" is a valid file name on some hosts.
7066         (wc, wc_file): New arg fstatus.  Use it to avoid invoking fstat
7067         if possible.
7068         (wc):  Avoid problems if end_pos - current_pos overflows.
7069         Do not print odd message if stdin has a read error.
7070         (get_input_fstatus, compute_number_width): New functions.
7071         (main): Use them to implement the new behavior.
7072         Ignore POSIXLY_CORRECT.
7073
7074         * tests/wc/Test.pm: Adjust to the new output widths.
7075
7076 2003-07-19  Jim Meyering  <jim@meyering.net>
7077
7078         * tests/rm/fail-eperm: Don't create temporary directory --
7079         we don't use it.
7080
7081         * tests/shred/remove: Don't open-code test for UID != 0.
7082         Use priv-check's require-non-root instead.
7083         Update to use newer framework.
7084
7085         * tests/help-version (expected_failure_status_expr): Record that
7086         expr exits with status of 3 for e.g., a write error.
7087
7088         * tests/priv-check: Use `id -u' to see if we're running as root,
7089         rather than trying go write to an write-protected file.
7090         When running as root, ensure $NON_ROOT_USERNAME is valid.
7091         When running as root with `require-non-root', ensure that `.'
7092         is writable by $NON_ROOT_USERNAME, then reinvoke $0 set-user-ID
7093         to $NON_ROOT_USERNAME.  If `.' is not writable, then skip the test.
7094
7095         * src/printenv.c: Include "exitfail.h".
7096         (main): Set exit_failure rather than calling close_stdout_set_status.
7097         * src/date.c: Likewise.
7098         * src/sort.c: Likewise.
7099         * src/tty.c: Likewise.
7100
7101 2003-07-18  Jim Meyering  <jim@meyering.net>
7102
7103         * tests/touch/not-owner: Update to use newer framework.
7104
7105         * tests/rm/fail-eperm: Use $srcdir/../priv-check, create a temporary
7106         directory, and remove Perl-coded `you may not run as root' test.
7107         * tests/cp/fail-perm: Use $srcdir/../priv-check, rather than
7108         hard-coding something not quite equivalent.
7109         Paul Jarc reported the inconsistent diagnostics.
7110
7111         * src/sort.c (main): Use close_stdout via atexit.
7112         Now `sort --version' and `sort --help' fail, as they should
7113         when their output is redirected to /dev/full.
7114
7115         * src/su.c (usage): Don't call close_stdout here.
7116         (main): Use close_stdout via atexit.
7117         Now `su --version > /dev/full' fails, as it should.
7118         Somehow, the change of 2000-05-07 that purports to fix this
7119         was not checked in.
7120
7121         * tests/help-version (--help/--version vs. /dev/full): Special-case
7122         `[' to protect it from expected_failure_status-`eval'.
7123
7124         * src/uniq.c (writeline): Use a SPACE, not a TAB between the
7125         count and the corresponding line, as required by POSIX.
7126         Reported by Clement Wang.
7127         * tests/uniq/Test.pm (101, 102): Update tests of -c accordingly.
7128
7129         * tests/expr/basic: Add tests for when exit status is 2.
7130
7131         * src/nohup.c (NOHUP_FOUND_BUT_CANNOT_INVOKE, NOHUP_FAILURE):
7132         Use an anonymous `enum', rather than #define.
7133
7134 2003-07-17  Paul Eggert  <eggert@twinsun.com>
7135
7136         * src/expr.c: Include "exitfail.h", "quotearg.h".
7137         (EXPR_INVALID, EXPR_ERROR): New constants.
7138         (nomoreargs, null, toarith, nextarg): Return bool, not int.
7139         (syntax_error): New function, exiting with status 2.  Use it
7140         insteading of printing "syntax error" ourselves.
7141         (main): Initialize exit_failure to EXPR_ERROR.
7142         Exit with EXPR_INVALID on syntax error (too few arguments).
7143         (nextarg): Use strcmp, not strcoll; strcoll might return
7144         an undesirable 0, or might fail.
7145         (docolon, eval4, eval3): Exit with status 3 on invalid argument type
7146         or other such error.
7147         (eval2): Report an error if strcoll fails in a string comparison.
7148         * src/sort.c: Include "exitfail.h".
7149         (main): Set exit_failure, not xalloc_exit_failure and
7150         xmemcoll_exit_failure.
7151         * tests/expr/basic: Invalid value exits with status 3, not 2.
7152
7153 2003-07-16  Jim Meyering  <jim@meyering.net>
7154
7155         * configure.ac (AC_INIT): Use 5.0.90 as the version, rather than 5.0.2,
7156         per GNU maintainer guidelines.  The next non-beta release will be 5.1.
7157
7158         This script would have caught at least two recent bugs:
7159         those in [ and kill.
7160         * tests/help-version: Revive this script.
7161         It wasn't doing anything useful, since $all_programs wasn't being
7162         defined by the invoking Makefile.am.
7163         Reflect that nohup is no longer a script, so don't exclude it.
7164         Add framework to handle the programs added since it was last run:
7165         kill, stat, unlink, [, link, readlink.
7166         Fix path-related problems deriving from the move of this script
7167         from src/ to its present location.
7168         * tests/Makefile.am (all_programs): Define.
7169         (TESTS_ENVIRONMENT): Use it.
7170
7171         * src/kill.c (main): Fix bug introduced on 2003-05-10 (for 5.0.1)
7172         whereby kill would always attempt to operate on argv[0] and fail.
7173
7174         * src/test.c (integer_expected_error): Improve diagnostic -- now,
7175         it also matches the one from bash's builtin test.
7176         (binary_operator): Add \n at end of diagnostic.
7177
7178         * tests/rm/fail-2eperm: Remove setuidgid-related code.  Move it to ...
7179         * tests/priv-check: Move setuidgid-related and
7180         NON_ROOT_USERNAME-checking code to this file.
7181
7182         * README: Update section on testing as `root'.
7183         Suggestion from Paul Jarc.
7184
7185         * src/test.c (AUTHORS): Replace 3-letter usernames with the actual
7186         names of authors that I just found in bash's builtins/test.def.
7187
7188         Running `[' with no arguments would evoke a segfault.
7189         * src/test.c (main) [LBRACKET]: Move initialization of argv to
7190         precede potential use via test_syntax_error.
7191
7192         * src/Makefile.am (AM_CPPFLAGS): Rename from `INCLUDES', to avoid
7193         warning from automake -Wall.
7194
7195 2003-07-15  Jim Meyering  <jim@meyering.net>
7196
7197         * Version 5.0.1.
7198
7199         * Makefile.maint (%.asc): Remove target first, so gpg doesn't
7200         prompt us about it.
7201
7202         * announce-gen (print_changelog_deltas): Relax tests for matching
7203         version-number line in NEWS.
7204         Change the .sig suffix to .asc here, too.
7205
7206 2003-07-14  Jim Meyering  <jim@meyering.net>
7207
7208         * Makefile.maint (%.asc): Renamed from %.sig.
7209         Generate and use ascii-armored signatures.
7210         Use gpg's -o option.
7211
7212 2003-07-13  Jim Meyering  <jim@meyering.net>
7213
7214         * src/nohup.c (NOHUP_FAILURE, NOHUP_FOUND_BUT_CANNOT_INVOKE): Define.
7215         (main): Use them.
7216
7217         * Makefile.maint (syntax-check): Move each individual check into
7218         its own target.
7219         (syntax-check-rules): This is the list of syntax-check targets.
7220         (sc_unmarked_diagnostics, sc_cast_of_argument_to_free):
7221         (sc_cast_of_x_alloc_return_value, sc_space_tab):
7222         (sc_error_exit_success, sc_xalloc_h_in_src):  New targets.
7223
7224 2003-07-12  Jim Meyering  <jim@meyering.net>
7225
7226         * configure.ac: Remove uses of OPTIONAL_BIN_ZCRIPTS and last
7227         traces of the nohup script.
7228
7229         * src/Makefile.am (bin_SCRIPTS): Remove use of just-removed
7230         $(OPTIONAL_BIN_ZCRIPTS).
7231
7232         * src/Makefile.am (localedir.h): Put the `2>&1' after the redirect
7233         target, not before the `>'.
7234
7235         * src/remove.c (remove_dir): Give a diagnostic upon failed save_cwd,
7236         now that that function no longer calls `error'.
7237
7238         * src/df.c (find_mount_point): Emit a diagnostic for each
7239         failed syscall, rather than relying on caller to do that.
7240         The caller couldn't do a good job, anyhow -- too many different
7241         ways to fail (each with a different referent).
7242         Give a diagnostic upon failed save_cwd, now that that function
7243         no longer calls `error'.
7244         (show_point): Don't diagnose find_mount_point's errors, now that
7245         it handles them itself.
7246
7247         * src/df.c (find_mount_point): Don't let free clobber errno upon
7248         failed chdir.
7249
7250         * src/sys2.h: Remove alloca-related block.
7251         * src/system.h: Include <alloca.h> here, instead.
7252
7253         It appears that the `#pragma alloca' included via "system.h" is
7254         adequate, since join.c uses alloca, yet lacked an in-file #pragma.
7255         * src/copy.c, src/cp.c, src/df.c, src/install.c, src/ln.c:
7256         * src/ls.c, src/mv.c, src/remove.c: Remove `#pragma alloca'.
7257
7258         * src/chown-core.c (change_file_owner): Do not restore any special
7259         permission bits (e.g., set-user-ID, set-group-ID) that are reset
7260         by chown(2) on some systems.  Suggestion and insistence :-) from
7261         Michael Stone.
7262
7263         * tests/input-tty: Also check `test -t 1'.
7264         This is necessary on linux-2.4.21.  Otherwise, the stty/basic-1
7265         test would block when run in the background.
7266
7267 2003-07-11  Jim Meyering  <jim@meyering.net>
7268
7269         * tests/sample-test: Also fail if cat-to-create-expected-output
7270         fails.  Otherwise, if both `exp' and `out' were to end up empty
7271         because of e.g., a full disk, they would mistakenly compare equal.
7272
7273         * src/nohup.c: New file.  Rewrite of nohup.sh in C.
7274         This solves a portability problem: on at least Solaris systems,
7275         when nohup.sh used the vendor /bin/sh, it would exit with status
7276         of `1' rather than the required 126 or 127 upon failure to exec
7277         the specified program.
7278
7279         * src/Makefile.am (EXTRA_SCRIPTS): Remove definition.
7280         (bin_PROGRAMS): Add nohup.
7281         (EXTRA_DIST): Remove nohup.sh.
7282         (all_programs): Remove use of $(EXTRA_SCRIPTS).
7283         * src/nohup.sh: Remove file.
7284         * man/Makefile.am (nohup.1): Depend on nohup.c, rather than nohup.sh.
7285
7286         * tests/misc/nohup: Tests for the above.
7287         * tests/misc/Makefile.am (TESTS): Add nohup.
7288
7289         * src/head.c (diagnose_copy_fd_failure): New function, renamed from
7290         the macro, COPY_FD_DIAGNOSE.
7291         (diagnose_copy_fd_failure): Enclose diagnostic in _(...).
7292         (head_file): Likewise.
7293
7294         * src/date.c: Include "quote.h".
7295         (batch_convert): Use the quote function rather than using literal `...'
7296         in a diagnostic.
7297
7298         * src/setuidgid.c (main): Enclose diagnostic in _(...).
7299         * src/fmt.c (main): Likewise.
7300         * src/mknod.c (main): Likewise.
7301         * src/tac.c (tac_seekable): Likewise.
7302         * src/yes.c (main): Likewise.
7303         * src/od.c (main): Likewise.
7304         * src/install.c (change_attributes): Likewise.
7305
7306 2003-07-10  Jim Meyering  <jim@meyering.net>
7307
7308         * src/head.c (usage): Use 1024*1024 in place of 1048576.
7309         * src/tail.c (usage): Likewise.
7310
7311         * tests/rm/fail-2eperm: Now that we have setuidgid, use it in
7312         place of the kludge in this test.  Suggestion from Paul Jarc.
7313
7314         * src/Makefile.am (noinst_PROGRAMS): Define to setuidgid.
7315         * src/setuidgid.c: New program, solely for testing (not installed).
7316
7317         * src/chown-core.c (change_file_owner): Don't leak file descriptors
7318         when dereferencing symlinks.
7319
7320 2003-07-09  Jim Meyering  <jim@meyering.net>
7321
7322         * tests/du/slash: New file/test for today's lib/ftw.c fix.
7323         * tests/du/Makefile.am (TESTS): Add slash
7324
7325         * src/tail.c (xlseek): Avoid warning about ``return without value
7326         from function returning non-void''.
7327
7328 2003-07-08  Jim Meyering  <jim@meyering.net>
7329
7330         * man/help2man: Update to version 1.29.
7331
7332         * man/help2man: Add END handler to close STDOUT and check for errors.
7333
7334 2003-06-30  Paul Eggert  <eggert@twinsun.com>
7335
7336         Add support for a "[" that conforms to the GNU coding standards,
7337         i.e., that does not depend on its name.
7338         * src/lbracket.c: New file.
7339         * README: Add "[".
7340         * man/Makefile.am (programs): Ignore "[", since it doesn't have
7341         a separate man page.
7342         * src/Makefile.am (bin_PROGRAMS): Add "[".
7343         (__SOURCES): New var.
7344         * src/test.c (LBRACKET): Define to 0 if not defined.
7345         (main): Use LBRACKET rather than argv[0].
7346
7347         * src/test.c (one_argument): Do not check for -t if POSIXLY_CORRECT.
7348         Reported by Paul Jarc and Dan Jacobson.
7349
7350         * src/test.c (main): Do not recognize --help or --version if
7351         POSIXLY_CORRECT, when invoked as "test".  Handle "[ ]" correctly.
7352         Do not bother testing that margv[margc] is non-null.
7353
7354 2003-07-04  Jim Meyering  <jim@meyering.net>
7355
7356         * src/who.c (print_line): Rewrite to use asprintf, in order to be
7357         able to avoid emitting trailing spaces.  Reported by Dan Jacobson.
7358
7359         * tests/misc/head-elide-tail: Add tests of head's new --lines=-N
7360         option, and perform the +1600 invocations of head IFF the envvar
7361         RUN_EXPENSIVE_TESTS is set.
7362
7363 2003-07-03  Jim Meyering  <jim@meyering.net>
7364
7365         * src/cp.c (do_copy): Give a better diagnostic when failing due
7366         to nonexistent destination directory.  Reported by Dmitry Rutsky.
7367         See http://bugs.debian.org/199730 for details.
7368
7369 2003-06-27  Jim Meyering  <jim@meyering.net>
7370
7371         split's --verbose option did nothing [broken in 4.5.10 and 5.0]
7372         * src/split.c (longopts): Use `1', not `0' as the value for
7373         for &verbose.  Reported by Keith Thompson.
7374
7375         Test for the above fix.
7376         * tests/misc/split-a: Also use --verbose and compare stderr
7377         output with what we'd expect.
7378
7379 2003-06-20  Jim Meyering  <jim@meyering.net>
7380
7381         * src/copy.c (copy_internal) [HAVE_STRUCT_STAT_ST_AUTHOR]:
7382         Use `error_t' (rather than int) as type for local `err'.
7383         From Alfred M. Szmidt.
7384
7385 2003-06-19  Marcus Brinkmann  <marcus@gnu.org>
7386
7387         * src/copy.c (copy_internal) [HAVE_STRUCT_STAT_ST_AUTHOR]:
7388         Fix author preservation code.
7389
7390 2003-06-19  Jim Meyering  <jim@meyering.net>
7391
7392         * src/ln.c (ENABLE_HARD_LINK_TO_SYMLINK_WARNING): Define to 0.
7393         (do_link): Don't warn about hard link to symlink.
7394
7395 2003-06-18  Jim Meyering  <jim@meyering.net>
7396
7397         * src/cut.c: Include "getdelim2.h", not "getstr.h".
7398         Reflect renaming: getstr -> getdelim2.
7399
7400         * src/comm.c, src/join.c, src/nl.c, src/uniq.c: Reflect renaming:
7401         readline -> readlinebuffer.
7402
7403 2003-06-09  John David Anglin  <dave.anglin@nrc-cnrc.gc.ca>
7404
7405         * src/readlink.c: Include <sys/types.h> before system.h (because
7406         the latter includes <sys/stat.h>).  Required on Ultrix 4.3.
7407
7408 2003-06-17  Jim Meyering  <jim@meyering.net>
7409
7410         * src/system.h (initialize_main): Define.
7411         Use it in every `main'.  Applied via this:
7412         p='initialize_main (&argc, &argv);'
7413         perl -ni -e '/program_name.=.argv.0/ and print "  '"$p"'\n"; print' \
7414           $(grep -l program_name.=.argv.0 *.c)
7415         test.c uses margc/margv, so I made the change manually for that file.
7416         Based on a patch from Bernard Giroud.
7417
7418 2003-06-09  John David Anglin  <dave.anglin@nrc-cnrc.gc.ca>
7419
7420         Fix for build failure on Ultrix 4.3.
7421         * src/stat.c: Include sys/statvfs.h in preference to sys/vfs.h.
7422         Include sys/param.h and sys/mount.h on ultrix.
7423
7424 2003-06-16  Jim Meyering  <jim@meyering.net>
7425
7426         * src/touch.c (O_NDELAY, O_NONBLOCK, O_NOCTTY, EISDIR): Remove
7427         definitions.
7428         * src/system.h (O_NDELAY, O_NONBLOCK, O_NOCTTY, EISDIR): Define
7429         them here instead, but with one change: define EISDIR to -1, not 0.
7430
7431         * src/cat.c (cat): Remove `#ifndef ENOSYS', now that it's
7432         guaranteed to be defined.
7433         * src/system.h (ENOSYS, ENOTSUP): Define to -1 if not defined.
7434
7435         * README: Mention the CVS repository.
7436         Encourage addition of test cases.
7437
7438 2003-06-12  Jim Meyering  <jim@meyering.net>
7439
7440         * src/touch.c (touch): Call close only if necessary.
7441         From Bruno Haible.
7442
7443         * src/wc.c (usage): Correct wording: wc prints counts in the order
7444         `newline, word, byte'.  Reported by Keith M. Briggs.
7445         * man/wc.x: Fix it here, too.  And change `lines' to `newlines'.
7446
7447 2003-06-10  Jim Meyering  <jim@meyering.net>
7448
7449         * tests/date/Test.pm: Add a test for the new format, e.g., May-23-2003.
7450
7451 2003-06-07  Jim Meyering  <jim@meyering.net>
7452
7453         * Makefile.maint (syntax-check): Add commented-out (over-aggressive)
7454         rule.
7455
7456 2003-06-06  Jim Meyering  <jim@meyering.net>
7457
7458         * src/extract-magic (main): Avoid newer 3-arg form of open,
7459         so this script works also with e.g., perl5.005_03.
7460         Patch by John David Anglin.
7461
7462 2003-06-04  Paul Eggert  <eggert@twinsun.com>
7463
7464         * src/system.h: Include <stdbool.h> unconditionally.
7465
7466 2003-06-04  Jim Meyering  <jim@meyering.net>
7467
7468         * man/Makefile.am (check-programs-vs-x): Rename target
7469         from check-programs-vs-1.  Adjust rule to check for the
7470         primary (.x) file, not the generated one (.1).
7471
7472 2003-06-03  Tim Mooney <mooney@dogbert.cc.ndsu.NoDak.edu>
7473
7474         * man/kill.x: New file.
7475         * man/Makefile.am (dist_man_MANS): Add kill.1.
7476         (kill.1): New rule.
7477
7478 2003-06-04  Jim Meyering  <jim@meyering.net>
7479
7480         Ensure that the .x file for a new program is never forgotten again.
7481         * man/Makefile.am (programs): Define.
7482         (check-programs-vs-1): New phony target.
7483         (check-local): Depend on it.
7484
7485 2003-06-03  Jim Meyering  <jim@meyering.net>
7486
7487         Avoid unnecessary copying of environment.
7488         * src/env.c (main): Rather than clearing the environment and --
7489         unless told to ignore environment -- copying all settings from
7490         the saved, original environment, clear the environment only when
7491         that is requested.  Suggested by Jens Elkner.
7492
7493 2003-06-02  Jim Meyering  <jim@meyering.net>
7494
7495         * src/system.h: Always include <string.h>, since we assume C89.
7496         Include <limits.h> without checking for HAVE_LIMITS_H.
7497
7498         * src/test.c [!TEST_STANDALONE]: Remove #if-0'd block.
7499         (STREQ, S_IXUGO): Remove redundant (in system.h) definitions.
7500
7501 2003-06-01  Jim Meyering  <jim@meyering.net>
7502
7503         Avoid a race condition in `tail -f' described by Ken Raeburn in
7504         http://mail.gnu.org/archive/html/bug-textutils/2003-05/msg00007.html
7505         * src/tail.c (file_lines): Add new parameter, *read_pos, and set it.
7506         (pipe_lines, pipe_bytes, start_bytes, start_lines): Likewise.
7507         (tail_bytes, tail_lines, tail): Likewise.
7508         (tail_file): Use the new `read_pos' value as the size,
7509         rather than stats.st_size from the fstat call.
7510
7511 2003-05-28  Jim Meyering  <jim@meyering.net>
7512
7513         * src/extract-magic: Allow expansion of `$file' in the here-
7514         document corresponding to the comment at the top of fs.h.
7515
7516 2003-05-26  Jim Meyering  <jim@meyering.net>
7517
7518         * src/stat.c: Fix portability problem on FreeBSD5.0: don't include
7519         <sys/statvfs.h> on systems without HAVE_STRUCT_STATVFS_F_BASETYPE.
7520         Use #if/#elif/... cascade so we get only one set of include files.
7521         Reported by Nelson Beebe.
7522
7523 2003-05-24  Jim Meyering  <jim@meyering.net>
7524
7525         * src/md5sum.c (split_3): Accept the BSD format only when in MD5 mode.
7526         * tests/sha1sum/basic-1: Make sure `sha1sum --check' doesn't
7527         accept the BSD format.
7528
7529 2003-03-28  Joe Orton  <jorton@redhat.com>
7530
7531         * src/md5sum.c (bsd_split_3): New function.
7532         (split_3): Detect checksums from BSD 'md5' command and handle them
7533         using bsd_split_3.
7534
7535         * tests/md5sum/basic-1: New tests for --check exit status, and for
7536         BSD-style checksum files.
7537
7538 2003-05-21  Jim Meyering  <jim@meyering.net>
7539
7540         * src/head.c (elide_tail_lines_pipe): Fix a thinko.
7541         This sort of thing is why it'd be *Really Good* to factor
7542         out the common code used here and in tail.c.
7543
7544 2003-05-14  Jim Meyering  <jim@meyering.net>
7545
7546         * src/head.c (usage): Document new feature: --bytes=-N and --lines=-N.
7547
7548         * tests/du/slink: Skip this test if `.' is on an XFS file system.
7549
7550         * tests/du/fd-leak: New file.  Test for the bug in du that
7551         was fixed by the 2003-05-12 change to lib/ftw.c.
7552         * tests/du/Makefile.am (TESTS): Add fd-leak.
7553
7554         * src/head.c (AUTHORS): Enclose string in N_(...), now that it
7555         includes a translatable word, `and'.
7556
7557         * src/dd.c (usage): Don't use `,' as the thousands separator
7558         in e.g. 1,000,000 and 1,048,576.  Instead, do this:
7559         `SIZE may be ..., MB 1000*1000, M 1024*1024 and so on...'
7560         * src/df.c (usage): Likewise.
7561         * src/du.c (usage): Likewise.
7562         * src/ls.c (usage): Likewise.
7563
7564         * Makefile.maint (syntax-check): Add another check.
7565
7566 2003-05-13  Paul Eggert  <eggert@twinsun.com>
7567
7568         Fix uniq to conform to POSIX, which requires that "uniq -d -u"
7569         must output nothing.  Problem reported by Josh Hyman.
7570
7571         * src/uniq.c (enum output_mode, mode): Remove, replacing with:
7572         (output_unique, output_first_repeated, output_later_repeated):
7573         New vars.  All uses of "mode" changed to use these variables,
7574         which are not mutually exclusive as "mode" was.
7575         (writeline): New arg "match", used to control whether to
7576         obey output_first_repeated or output_later_repeated.
7577         All callers changed.
7578         (check_file, main): Adjust to above changes.
7579
7580         * tests/uniq/Test.pm: Test that 'uniq -d -u' outputs nothing.
7581
7582 2003-05-14  Jim Meyering  <jim@meyering.net>
7583
7584         * tests/rm/rm3: Use tr's \n notation rather than \012.
7585         This package can afford to do that, since its tests are guaranteed use
7586         GNU tr, which has accepted the more modern notation for 10 years.
7587         * tests/rm/rm5: Likewise.
7588         * tests/cp/same-file: Likewise.
7589         * tests/stty/row-col-1: Likewise.
7590         * tests/stty/basic-1: Likewise.
7591         * tests/rm/deep-1: Likewise.
7592         * tests/mv/part-symlink: Likewise.
7593         * tests/mkdir/perm: Likewise.
7594         * tests/misc/nice: Likewise.
7595
7596 2003-05-13  Jim Meyering  <jim@meyering.net>
7597
7598         * src/copy.c (struct F_triple) [name]: Remove const attribute.
7599         (triple_free): Don't apply cast to argument of free.
7600         (seen_file): Add cast here instead.
7601
7602         * src/cp-hash.c (struct Src_to_dest) [name]: Remove const attribute.
7603         (src_to_dest_free): Don't apply cast to argument of free.
7604
7605         * src/sort.c (zaptemp): Don't apply cast to argument of free.
7606         * src/pr.c (init_fps, init_store_cols): Likewise.
7607         * src/join.c (delseq, freeline): Likewise.
7608         * src/expr.c (OLD): Likewise.
7609         * src/sort.c (sort): Likewise.
7610         * src/head.c (elide_tail_lines_pipe): Likewise.
7611
7612         * src/tail.c: Include "quote.h".
7613         Use quote in diagnostics.  Change many error format strings
7614         from just `%s' to e.g., `error reading %s'.
7615         (pipe_lines): Change type of parameter, n_lines, to uintmax_t.
7616         Rewrite newline-counting loop to use memchr.
7617
7618         * src/head.c (elide_tail_lines_pipe): Use `if', not assert.
7619         Now that assert is no longer used, don't include <assert.h>.
7620
7621 2003-05-12  Jim Meyering  <jim@meyering.net>
7622
7623         * src/head.c: Include <assert.h>.
7624         (AUTHORS): Add my name.
7625         (elide_tail_lines_pipe): New function.
7626
7627 2003-05-10  Jim Meyering  <jim@meyering.net>
7628
7629         * Makefile.maint (syntax-check): Check for `error (EXIT_SUCCESS,'.
7630
7631         * src/readlink.c (main): Set program_name before first use.
7632         Remove that (redundant) first use.
7633         Don't exit successfully just because --verbose was specified.
7634         Pass 0, not EXIT_SUCCESS, as first argument to error; when that
7635         parameter is 0, error does not exit.
7636
7637         * src/uname.c (main): When failing due to too many arguments, also say
7638         that, rather than just "Try `uname --help' for more information.".
7639         * src/comm.c (main): Likewise, but for too few arguments.
7640         * src/logname.c: Include error.h.
7641         (main): Say why we're failing.
7642
7643         * src/uniq.c (main): Don't segfault when argc < optind.
7644         * src/who.c (main): Handle argc < optind.
7645         * src/df.c (main): Likewise.
7646         * src/install.c (main): Likewise.
7647         * src/mv.c (main): Likewise.
7648         * src/pwd.c (main): Likewise.
7649         * src/tty.c (main): Likewise.
7650         * src/chroot.c (main): Likewise.
7651         * src/hostname.c: Likewise.
7652         * src/du.c (main): Likewise.
7653         * src/expand.c (main): Likewise.
7654         * src/env.c (main): Likewise.
7655         * src/unexpand.c (main): Likewise.
7656         * src/printenv.c (main): Likewise.
7657         * src/sync.c (main): Handle argc == 0.
7658         * src/expr.c (main): Likewise.
7659         * src/printf.c (main): Likewise.
7660         * src/basename.c (main): Likewise.
7661         * src/ln.c (main): Test for `missing argument' before computing n_files.
7662         * src/tail.c (main): Test for the case of no arguments before
7663         computing n_files.
7664
7665         * src/kill.c (send_signals): Don't check command line arguments here.
7666         (main): Check them here instead.  Handle argc < optind.
7667
7668         * src/logname.c (main): Use error, rather than fprintf, for the sake
7669         of consistency.
7670
7671         * src/rm.c (main): Don't overrun array bound if argc is 0.
7672
7673 2003-05-09  Jim Meyering  <jim@meyering.net>
7674
7675         * src/sort.c (main): Don't overrun array bound if argc is 0.
7676         That would happen when invoked via: execl ("/usr/bin/sort", NULL);
7677         Reported by Wartan Hachaturow.
7678
7679 2003-05-07  Jim Meyering  <jim@meyering.net>
7680
7681         Implement support so that `head --lines=-N' works on seekable files.
7682         * src/head.c (enum Copy_fd_status): Define.
7683         (COPY_FD_DIAGNOSE): New macro.
7684         (elide_tail_lines_seekable): New funtion.
7685         (elide_tail_lines_file): Call it here.
7686
7687 2003-05-06  Jim Meyering  <jim@meyering.net>
7688
7689         * src/sys2.h (CHAR_BIT): Remove duplicate definition.
7690
7691 2003-05-04  Jim Meyering  <jim@meyering.net>
7692
7693         * tests/head/Test.pm: Remove tests of --bytes=-N; using that framework
7694         caused the addition of thousands of small files to the tar archive.
7695         * tests/misc/head-elide-tail: New file.  Add them here instead.
7696         * tests/misc/Makefile.am (TESTS): Add head-elide-tail.
7697
7698 2003-05-04  Paul Eggert  <eggert@twinsun.com>
7699
7700         * src/remove.c (HAVE_WORKING_READDIR): Define to 0 if not defined.
7701         (IF_READDIR_NEEDS_REWINDDIR): Remove.
7702         (remove_cwd_entries): Rewrite to avoid IF_READDIR_NEEDS_REWINDDIR,
7703         which was a bit weird because it couldn't be emulated by a function.
7704
7705 2003-05-03  Jim Meyering  <jim@meyering.net>
7706
7707         Extend head to accept --lines=-N (--bytes=-N) and to print all
7708         but the N lines (bytes) at the end of the file.
7709         * src/head.c: Include full-write.h, full-read.h, inttostr.h, quote.h.
7710         Use quote() in diagnostics, rather than literal `' marks.
7711         (copy_fd, elide_tail_bytes_pipe, elide_tail_bytes_file):
7712         New functions.
7713         (elide_tail_lines_pipe, elide_tail_lines_file): New functions.
7714         (head_file): Reorganize so as to call head from only one place.
7715         (main): Likewise, for head_file.
7716         Handle new, undocumented option, --presume-input-pipe.
7717         Handle negative line and byte counts.
7718         * tests/head/Test.pm: Add lots of tests to exercise --bytes=-N.
7719
7720         * tests/du/8gb: Skip test if the file system of `.' doesn't support
7721         sparse files -- otherwise it'd create a file of size 8GB.
7722
7723 2003-05-02  Jim Meyering  <jim@meyering.net>
7724
7725         * src/fmt.c (usage): Don't mention obsolescent -WIDTH option.
7726         Instead explain about `-' and standard input.
7727         (main): Give a proper diagnostic for e.g., `fmt -c -72'.
7728         Reported by Keith Thompson.
7729         * tests/fmt/basic: Add test for the above fix.
7730
7731         * src/fmt.c: Include "quote.h".
7732         Use quote() in diagnostics, rather than literal `' marks.
7733         (main): Exit nonzero when unable to open an input file.
7734         * tests/fmt/basic: Add test for the above fix.
7735
7736         * src/fmt.c (main): Diagnose invalid suffix on obsolescent width
7737         specifications like `-72x'.
7738         * tests/fmt/basic: Add test for the above fix.
7739
7740         Work around nasty readdir bug on Darwin6.5.
7741         * src/remove.c (IF_READDIR_NEEDS_REWINDDIR): Define.
7742         [! HAVE_WORKING_READDIR] (remove_cwd_entries): If readdir has just
7743         returned NULL and there has been at least one successful unlink or
7744         rmdir call since the opendir or previous rewinddir, then call
7745         rewinddir and reiterate the loop.
7746
7747         Factor out common code.
7748         * src/remove.c (readdir_ignoring_dotdirs): New function.
7749         (is_empty_dir): Use it here.
7750         (remove_cwd_entries): Use it here.
7751
7752 2003-05-01  Jim Meyering  <jim@meyering.net>
7753
7754         * tests/rm/r-3: Create 500 rather than just 300 files.
7755         There's a bug in Darwin6.5's readdir that shows up only with
7756         338 or more files.
7757         Fix a bug in this test: `cd $pwd' (not to `..'), now that $tmp
7758         has two components.
7759
7760         * src/tail.c:
7761         Change type of n_units, n_bytes, n_lines to be `uintmax_t'.
7762         (dump_remainder): Move two declarations `down' into the scope
7763         where they are used.
7764         (xlseek): Return the resulting offset.
7765         (file_lines): Rename parameter, file_length, to end_pos.
7766         (pipe_lines): Don't coerce safe_read return value to `int'.
7767         Adapt tests accordingly.
7768         (pipe_bytes) [struct charbuffer] (nbytes): Change type from `int'
7769         to `unsigned int'.
7770         Change type of `total_bytes' from `int' to `size_t',
7771         since the former wouldn't always be wide enough.
7772         Don't coerce safe_read return value to `int',
7773         and adapt tests accordingly.
7774         Now that testing for a read error no longer involves
7775         using `tmp', handle that case *after* freeing `tmp'.
7776         (start_bytes): Clean up.
7777         (tail_bytes): Now that `n_bytes' may be larger than
7778         OFF_T_MAX, test for that condition and, if it's true, don't
7779         use lseek optimizations.
7780         (parse_options): Don't fail just because N_UNITS is larger than
7781         the maximum size of a file -- tail may be applied to an input
7782         stream (e.g., a pipe) with more data than that.
7783
7784         * Makefile.maint (syntax-check): Rename from alloc-check.
7785         Also check for SPACE-TAB sequences.
7786         Also check for malloc/calloc/realloc casts.
7787
7788 2003-05-01  Jim Meyering  <jim@meyering.net>
7789
7790         * src/tail.c (start_lines): Rewrite to use memchr.  Clean up.
7791
7792 2003-04-28  Jim Meyering  <jim@meyering.net>
7793
7794         * tests/misc/tty-eof: Send two tokens, not just one, so we don't
7795         make the now-more-picky tsort fail.
7796
7797 2003-04-24  Jim Meyering  <jim@meyering.net>
7798
7799         * src/tsort.c (tsort): Remove unnecessary test of have_read_stdin.
7800         (main): Minor syntactic clean-up.
7801
7802         * src/tsort.c (tsort): Fail if the input contains an odd number of
7803         tokens.  Reported by junkio@cox.net.
7804
7805         * tests/tsort/basic-1: Test for the above fix.
7806
7807 2003-04-21  Jim Meyering  <jim@meyering.net>
7808
7809         * tests/misc/printf: Add tests for the printf fixes below.
7810
7811         * Makefile.cfg (cvs_files): Add $(srcdir)/config/depcomp to the list.
7812
7813 2003-04-20  Paul Eggert  <eggert@twinsun.com>
7814
7815         Fix printf POSIX compatibility bug reported by Ben Harris in
7816         <http://mail.gnu.org/archive/html/bug-coreutils/2003-04/msg00070.html>.
7817         * doc/coreutils.texi (printf invocation): It's \NNN in the format,
7818         \0NNN in the %b operand.
7819         * src/printf.c (usage): Likewise.
7820         (print_esc): New arg OCTAL0 to specify whether \0NNN or \NNN
7821         is desired.  All uses changed.  Behave like Bash printf if %b
7822         operand uses \NNN where the initial N is not 0.
7823
7824 2003-04-17  Jim Meyering  <jim@meyering.net>
7825
7826         * src/stty.c: Remove uses of PROTOTYPE macro.
7827
7828 2003-04-15  Jim Meyering  <jim@meyering.net>
7829
7830         * Makefile.maint: Remove (or replace-with-TAB(s) to retain alignment)
7831         each sequence of spaces before a TAB character.
7832
7833 2003-04-13  Jim Meyering  <jim@meyering.net>
7834
7835         * src/remove.c (is_empty_dir): Don't closedir (NULL).
7836
7837 2003-04-12  Jim Meyering  <jim@meyering.net>
7838
7839         Giving nl an invalid STYLE argument (in --header-numbering=STYLE (-h),
7840         --body-numbering=STYLE (-b), or --footer-numbering=STYLE (-f)) or
7841         FORMAT (--number-format=FORMAT (-n)) would not give a useful diagnostic.
7842         * src/nl.c (main): Fix those problems and remove literal quote marks
7843         (e.g., "`%s'") from format string; instead use "%s" in each format
7844         string and `quote (optarg)' as the corresponding argument.
7845         Also, diagnose all invalid command line options before failing.
7846
7847         * src/nl.c (proc_text): Fix a bug that would make nl output extra
7848         newlines in some cases.  Details here: http://bugs.debian.org/177256.
7849         This bug was introduced on 2001-11-10 for textutils-2.0.17.
7850         * tests/misc/nl: Add test for the above-fixed bug.
7851
7852         * tests/misc/readlink: New file.  Test the --canonicalize option.
7853         * tests/misc/Makefile.am (TESTS): Add readlink.
7854
7855 2003-04-11  Jim Meyering  <jim@meyering.net>
7856
7857         Clean up.
7858         * src/chown.c, src/cp.c, src/dircolors.hin, src/du.c, src/ln.c:
7859         * src/mkfifo.c, src/ptx.c, src/spline.c, src/stty.c, src/tail.c:
7860         * src/test.c, src/unexpand.c: Remove (or replace-with-TAB(s) to
7861         retain alignment) each sequence of spaces before a TAB character.
7862
7863         * src/ls.c: Include <stdlib.h> unconditionally.
7864
7865         * Makefile.maint (xalloc-check): Rename from header-check.
7866
7867         * src/yes.c: Include error.h after system.h, not before.
7868
7869         Clean up.
7870         * src/copy.c, src/cp-hash.c, src/cp.c, src/csplit.c, src/cut.c:
7871         * src/date.c, src/df.c, src/du.c, src/expand.c, src/expr.c, src/id.c:
7872         * src/join.c, src/md5sum.c, src/nl.c, src/od.c, src/paste.c, src/pr.c:
7873         * src/ptx.c, src/sort.c, src/split.c, src/su.c, src/tail.c, src/tee.c:
7874         * src/tr.c: * src/unexpand.c, src/users.c:
7875         Remove anachronistic casts of xmalloc, xrealloc, and xcalloc
7876         return values and of xrealloc's first argument.
7877         Fix the former with this:
7878         perl -pi -e 's/\([^(]*?\*\) *(x(m|c|re)alloc)\b/$1/'
7879
7880 2003-04-10  Jim Meyering  <jim@meyering.net>
7881
7882         * src/stty.c (wrapf): Declare with format attribute.
7883
7884         The S_MAGIC_... names shouldn't be maintained in two places (prior
7885         to this change, one would have to keep stat.c and fs.h in sync).
7886         This change makes it so those names and the corresponding
7887         hexadecimal constants all reside in stat.c.  fs.h is now generated.
7888         * src/Makefile.am (fs.h): New rule to generate fs.h from stat.c.
7889         (BUILT_SOURCES): Add fs.h, now that it's generated.
7890         (EXTRA_DIST): Add extract-magic.
7891         * src/extract-magic: New script to extract fs.h definitions from stat.c.
7892         * src/stat.c (human_fstype) [__linux__]: Append each hex constant from
7893         fs.h in a comment after the corresponding `case S_MAGIC_...:' statement.
7894
7895         * tests/tail-2/big-4gb: Skip this test (don't fail) if creating a
7896         file with nominal length > 4GB fails.  Reported by Michael Deutschmann.
7897
7898         * man/unexpand.x: Add `SEE ALSO' reference to expand.
7899         * man/expand.x: Add `SEE ALSO' reference to unexpand.
7900         Suggestion from Dan Jacobson.
7901
7902 2003-04-10  Maciej W. Rozycki  <macro@ds2.pg.gda.pl>
7903
7904         * src/fs.h (S_MAGIC_DEVPTS): New magic for Linux's devpts.
7905         * src/stat.c (human_fstype): Handle Linux's devpts.
7906
7907 2003-04-09  Paul Eggert  <eggert@twinsun.com>
7908
7909         * src/split.c (line_bytes_split): Arg is of type size_t, since
7910         that's all that is supported for now.
7911         (main): Check for overflow in obsolescent line count option.
7912
7913 2003-04-09  Jim Meyering  <jim@meyering.net>
7914
7915         * tests/misc/split-fail: Add a new test for the above fix.
7916
7917         * src/split.c (bytes_split): Use size_t temporary (rather than
7918         uintmax_t original) in remaining computations.  From Paul Eggert.
7919
7920         Handle command line option arguments larger than 2^31.
7921         This allows e.g., splitting into files of size 2GB and larger,
7922         and running split --lines=N with N=2^31 or more.
7923         But for --line-bytes=N, the restriction that N <= SIZE_MAX
7924         remains (for now), due to the way it is implemented.
7925
7926         * src/split.c: Include "inttostr.h".
7927         (bytes_split, lines_split, line_bytes_split, main):
7928         Use uintmax_t, not size_t, for file sizes.
7929         (main): Give a better diagnostic for option arguments == 0.
7930         Use umaxtostr to print file sizes.
7931         Reported by Luke Hassell.
7932
7933 2003-04-08  Jim Meyering  <jim@meyering.net>
7934
7935         * src/rm.c (usage): Mention that --directory (-d) works only
7936         on some systems.  Suggestion from Samuel Tardieu.
7937
7938         * tests/basename/basic: Run $PERL to see if it is available,
7939         rather than testing its value.
7940         * tests/sum/sysv, tests/tsort/basic-1, tests/unexpand/basic-1:
7941         * tests/basename/basic, tests/dd/skip-seek, tests/dircolors/simple:
7942         * tests/expr/basic, tests/factor/basic, tests/fmt/basic:
7943         * tests/ls-2/tests, tests/md5sum/basic-1, tests/md5sum/newline-1:
7944         * tests/misc/sort, tests/misc/tty-eof, tests/mv/i-1:
7945         * tests/rm/empty-name, tests/rm/fail-eperm, tests/rm/unreadable:
7946         * tests/seq/basic, tests/sha1sum/basic-1, tests/sha1sum/sample-vec:
7947         * tests/sum/basic-1, tests/seq/basic: Likewise.
7948
7949         * tests/misc/Makefile.am (TESTS): Add split-fail.
7950         * tests/misc/split-fail: New file.
7951
7952         * src/split.c: Rename local variables: nchars -> n_bytes.
7953         (lines_split): Rename local, nlines -> n_lines.
7954         (main): Rename local variable: s/accum/n_units/.
7955         (main): Use STDIN_FILENO, not literal `0'.
7956
7957 2003-04-07  Jim Meyering  <jim@meyering.net>
7958
7959         * src/stat.c: Add #include directives for Ultrix 4.4.
7960         Based on a suggested change from Bert Deknuydt.
7961
7962 2003-04-06  Jim Meyering  <jim@meyering.net>
7963
7964         * Makefile.maint (makefile-check): New rule.
7965         (local-check): Add it.
7966
7967 2003-04-05  Jim Meyering  <jim@meyering.net>
7968
7969         * Makefile.am (nearly all of them):
7970         Use $(VAR) rather than @VAR@, now that we can rely on automake to
7971         emit a definition for each substituted variable.
7972         * tests/Makefile.am.in: Likewise.
7973
7974         * tests/rm/rm5: Add a comment explaining why this test fails when
7975         using Tru64's broken sed.
7976         * tests/rm/rm3: Likewise.
7977
7978         Make `kill -t' output signal descriptions (not `?') on Tru64.
7979         * src/kill.c (sys_siglist): Also check for __sys_siglist.
7980         Patch by Tony Leneis.
7981         * configure.ac: Also check for declaration of __sys_siglist.
7982         Required for Tru64 4.0D, 4.0F, and 5.1.
7983         Reported by Tony Leneis.
7984
7985 2003-04-04  Jim Meyering  <jim@meyering.net>
7986
7987         * src/Makefile.am (PERL): Remove unnecessary definition.
7988
7989         Because of inappropriate (but POSIX-mandated) behavior of rename,
7990         `mv a b' would not remove `a' in some unusual cases.  Work around
7991         this by unlinking `a' when necessary.
7992
7993         * src/copy.c (same_file_ok): Add an output parameter.
7994         Set it in the offending case.
7995         (copy_internal): When necessary, unlink SRC_PATH and inform caller.
7996         Reported by Ed Avis.
7997         * tests/mv/hard-4: New test for the above.
7998         * tests/mv/Makefile.am (TESTS): Add hard-4.
7999
8000         Clean up rules for automatically generated sources:
8001         * src/Makefile.am (dircolors.h, wheel-size.h, wheel.h, false.c):
8002         Make each generated file be read-only.
8003         Add each file name to BUILT_SOURCES separately.
8004         (MAINTAINERCLEANFILES): Set to $(BUILT_SOURCES).
8005
8006         Put LOCALEDIR macro definition in new file: localedir.h.
8007         * src/Makefile.am (DEFS): Remove definition.
8008         (localedir.h): New rule.
8009         (BUILT_SOURCES, DISTCLEANFILES): Add localedir.h.
8010         * src/system.h: Include "localedir.h".
8011
8012 2003-04-02  Jim Meyering  <jim@meyering.net>
8013
8014         * Version 5.0.
8015
8016         * tests/misc/Makefile.am (TESTS): Add false.
8017
8018         * Makefile.maint (TMPDIR): Make sure it's defined.
8019         (my-distcheck): Build in $(TMPDIR), not `.'.
8020
8021         * src/Makefile.am (false.c): Change all occurrences of
8022         `(EXIT_SUCCESS)' to `(EXIT_FAILURE)' so that false exits
8023         unsuccessfully also with --help.  Reported by Paul Jarc,
8024         * tests/misc/false: New test for the above.
8025
8026 2003-03-30  Jim Meyering  <jim@meyering.net>
8027
8028         * NEWS: Note the location of older NEWS files.
8029
8030         * src/remove.c (is_empty_dir): Don't let a failing closedir
8031         clobber errno.  Spotted by Arnold Robbins.
8032
8033         * src/env.c: Fix typo in comment.  From Arnold Robbins.
8034
8035 2003-03-29  Jim Meyering  <jim@meyering.net>
8036
8037         * Version 4.5.12.
8038
8039         * README: Note to expect build problems for stat.c on Ultrix 4.3.
8040         Note that there are some harmless test failures when running
8041         `make check' as root on some systems.
8042
8043 2003-03-28  Jim Meyering  <jim@meyering.net>
8044
8045         * tests/stty/row-col-1: Skip this test if stty can't get window size.
8046         This happens when connecting to sparc-solaris5.7 via ssh from within
8047         emacs.  Reported by Karl Berry.
8048
8049         * tests/du/basic: Use seq, not `yes' to generate 4KB of data.
8050         Otherwise, on systems (DJGPP) that emulate pipes using files,
8051         this test would never complete, waiting for `yes' to terminate.
8052         * tests/du/slink: As above, use seq, not `yes' to generate link target.
8053         * tests/rm/hash: As above, use seq, not `yes' to generate dir name.
8054         Reported by Rich Dawe.
8055
8056 2003-03-27  Jim Meyering  <jim@meyering.net>
8057
8058         * src/id.c: Remove Arnold Robbins' obsolete e-mail address
8059         from `written by...' comment, at his request.
8060
8061 2003-03-24  Paul Eggert  <eggert@twinsun.com>
8062
8063         Fix buffer overrun problem reported by TAKAI Kousuke, along
8064         with some other POSIX incompatibilities.
8065
8066         * src/printf.c (print_esc): Do not treat \x specially if
8067         POSIXLY_CORRECT.  Avoid buffer overrun if the format ends
8068         in backslash.  Treat incomplete escape sequences as strings
8069         of characters, as POSIX requires.
8070         (print_formatted): Allow multiple flags.  Avoid buffer overrun
8071         if the format is incomplete.
8072
8073 2003-03-24  Jim Meyering  <jim@meyering.net>
8074
8075         * tests/misc/printf: Add tests for the above fixes and changes.
8076
8077 2003-03-26  Jim Meyering  <jim@meyering.net>
8078
8079         * src/copy.h (struct cp_options): Add a comment.
8080
8081 2003-03-23  Jim Meyering  <jim@meyering.net>
8082
8083         * README: Describe problem with 64-bit mode on HPUX 11.x,
8084         with patch for /usr/include/inttypes.h.
8085         * TODO: Plan to add an autoconf test to work around the bug.
8086
8087 2003-03-22  Jim Meyering  <jim@meyering.net>
8088
8089         * src/stat.c: Don't include <sys/sysmacros.h>.
8090         That is already done via system.h.  Otherwise, the multiple
8091         inclusion would evoke redefinition warnings from Cray's /bin/cc,
8092         aka Cray Standard C Version 4.0.3  (057126) Mar 22 2003  22:02:28.
8093         (human_fstype): Factor some directives `up', out of this function.
8094         Cast away `const' to avoid error from Cray's /bin/cc.
8095
8096 2003-03-20  Jim Meyering  <jim@meyering.net>
8097
8098         * announce-gen (print_changelog_deltas): Ensure that a newline
8099         precedes each row of `*'s.
8100
8101 2003-03-20  Jim Meyering  <jim@meyering.net>
8102
8103         * Version 4.5.11.
8104
8105         * src/seq.c (valid_format): Also accept ` ' and `'' as valid
8106         format flag characters.
8107         Do not require that a field width be specified.
8108         Do not fail when given a field width of `0'.
8109         Reported by Dan Jacobson.
8110         * tests/seq/basic: Add new tests for the above-fixed bug.
8111
8112         * src/Makefile.am (all-local): Append $(EXEEXT) to use of `su'
8113         (install-root): Likewise.
8114         (install-exec-local): Likewise.
8115         Based on a patch from Richard Dawe.
8116
8117 2003-03-19  Jim Meyering  <jim@meyering.net>
8118
8119         * man/Makefile.am (.x.1): Use $(LN_S) instead of 'ln -s',
8120         because the DJGPP 2.03 port of 'ln -s' doesn't work.
8121         Include $(EXEEXT) in program names.
8122         Since $(LN_S) may degenerate to `cp -p', be careful
8123         to invoke it from the destination directory.
8124         Mostly from Richard Dawe.
8125         * configure.ac: Use AC_PROG_LN_S.
8126
8127         * tests/mv/part-symlink: Unset CDPATH.  Otherwise, having the
8128         CDPATH shell variable set could cause this test to fail.
8129         Reported by Karl Berry.
8130
8131 2003-03-18  Jim Meyering  <jim@meyering.net>
8132
8133         * src/fmt.c [struct Word] (paren, period, punct, final): Change the
8134         type of each member from bool <MEMBER>:1 to unsigned int <MEMBER>:1.
8135         AIX 5.1's xlc could not compile the former.
8136         Patch by Petter Reinholdtsen.  Also reported by Mike Jetzer.
8137
8138 2003-03-17  Richard Dawe  <rich@phekda.freeserve.co.uk>
8139
8140         * configure.ac: Include $(EXEEXT) in OPTIONAL_BIN_PROGS'
8141         program names, since automake only adds $(EXEEXT) to programs
8142         in its *_PROGRAMS.
8143
8144 2003-03-16  Jim Meyering  <jim@meyering.net>
8145
8146         * src/remove.c (rm): Put two local variables in static storage,
8147         so they can't be clobbered by the potential longjmp.
8148
8149 2003-03-15  Jim Meyering  <jim@meyering.net>
8150
8151         * Makefile.cfg (gnu_rel_host): Fix code to match the comment
8152         so that a version number with a two-digit component can still count
8153         as an alpha release.  Reported by Richard A Downing.
8154         (gnu_rel_host): Define in terms of $(RELEASE_TYPE) instead.
8155
8156 2003-03-14  Jim Meyering  <jim@meyering.net>
8157
8158         * src/ansi2knr.c: Remove no-longer-used file.
8159         * src/ansi2knr.1: Likewise.
8160
8161         * Makefile.maint (prev_version_file): Don't use ?= for this particular
8162         assignment, since it causes trouble with old versions of GNU make
8163         (e.g. 3.76.1).  The other uses of `?=' are inoffensive.  Details here.
8164         http://mail.gnu.org/archive/html/bug-coreutils/2003-03/msg00028.html
8165         Patch from Alexandre Duret-Lutz.
8166
8167         * Use patched automake-1.7.3.  Regenerate Makefile.in files in
8168         subdirectories so that each includes a definition of ACLOCAL_M4.
8169
8170         * announce-gen (main): Label the compressed source URLs.
8171
8172         * Version 4.5.10.
8173
8174         * tests/du/slink: Relax the test for the `local'ness of a file system,
8175         so that now it works also for tmpfs.
8176
8177         * tests/du/hard-link: Transform output from first du, so that this
8178         test doesn't fail on file systems like tmpfs that order directory
8179         entries differently.
8180
8181 2003-03-13  Jim Meyering  <jim@meyering.net>
8182
8183         * tests/du/8gb: Work around what appears to be an NFS failure that
8184         would make this test fail on some systems.
8185
8186 2003-03-11  Jim Meyering  <jim@meyering.net>
8187
8188         * tests/du/basic: Make the test file exactly 4k bytes long.
8189
8190         * src/split.c (longopts): Don't hard-code `2' here.
8191         Instead, just specify `&verbose', and ...
8192         (main): ... remove the `case 2:' block for --verbose.
8193
8194         * tests/du/basic: Make the test file larger than 64 bytes, so that
8195         we don't immediately disqualify file systems (e.g., NetApp) on which
8196         smaller files take up zero disk blocks.  Reported by Vin Shelton.
8197
8198 2003-03-10  Jim Meyering  <jim@meyering.net>
8199
8200         Don't segfault for a negative field width or precision in format string.
8201         Note that this is just a stopgap fix.  The longer term solution may
8202         involve adapting bash's builtins/printf.def.
8203
8204         * src/printf.c: (UNSPECIFIED): Define.
8205         (print_direc): Use the special value, UNSPECIFIED, to indicate
8206         that field_width or precision has not been specified.
8207         (print_formatted): Fail if field_width or precision is the
8208         special value, UNSPECIFIED.
8209         Reported by Oliver Kiddle <okiddle@yahoo.co.uk>
8210
8211         * src/sys2.h (INT_MIN): Define, if necessary.
8212         * tests/misc/printf: Add a test for the above-fixed bug.
8213
8214 2003-03-09  Jim Meyering  <jim@meyering.net>
8215
8216         * src/remove.c (AD_stack_pop): Cast sizeof... to int before
8217         changing its sign.  This avoids a warning from gcc on 64-bit systems.
8218         Reported by Bob Proulx.
8219         (pop_dir): Reverse order of sign change and cast, to be consistent
8220         with the above.
8221
8222 2003-03-08  Jim Meyering  <jim@meyering.net>
8223
8224         * tests/Makefile.am (evar-check): Check for POSIXLY_CORRECT not as a
8225         shell variable, but only in the environment.  With /bin/sh->bash, the
8226         shell variable is set to `y', and that would cause a spurious warning.
8227         Reported by Bob Proulx.
8228
8229         * tests/Makefile.am (check-root): Remove touch/fifo.
8230         It doesn't appear to have to be run as root.
8231
8232         * tests/rm/fail-2eperm: Rather than simply using the first non-root
8233         user name, make sure that the selected user name has a usable shell.
8234         Reported by Paul Jarc.
8235
8236         Before, when using shred on a device, one had to specify --exact,
8237         or be careful to choose a size that would not be rounded up and
8238         exceed the maximum value;  that could result in a failure of
8239         the final write.
8240         * src/shred.c (do_wipefd): --exact is now the default for non-regular
8241         files.  Suggestion from Ben Elliston.
8242         (usage): Say it.
8243
8244         * tests/misc/tty-eof: Require at least version 1.11 of Expect.pm.
8245         Old versions of Expect.pm (e.g., 1.07) lack the log_user function.
8246         Patch by Bob Proulx.
8247
8248         * src/Makefile.am (check-misc): Check for use of `defined' in
8249         #define directives.
8250         Change to $(srcdir) before running grep.
8251
8252         * src/sleep.c: Remove now-unused #include and #define directives.
8253
8254         * src/du.c (process_file): If a file's size is not being counted
8255         e.g., because it's a hard link to a file we've already counted,
8256         then don't print a line for it.
8257
8258         * tests/du/hard-link: New test for the above-fixed bug.
8259         * tests/du/Makefile.am (TESTS): Add hard-link.
8260
8261         `du -S' didn't work
8262         * src/du.c: Revert most of the `reorganization' change of 2003-02-20,
8263         and make the two-array approach work.
8264
8265         * tests/du/basic: Correct/add tests for the above fix.
8266         Set LC_ALL, etc., now that we use sort.
8267         Check the block/size of a small file, too.
8268         Correct expected results for simple dir1/dir2/file case.
8269         Add another test of du -S.
8270
8271 2003-03-07  John David Anglin  <dave.anglin@nrc-cnrc.gc.ca>
8272
8273         Avoid build failure with gcc on hppa1.1-hp-hpux10.20 (see GCC PR
8274         middle-end/9986).  As one of GCC's optimizations, it transforms a
8275         fputs_unlocked call to a fputc_unlocked call when the string is
8276         one character long.  However, hpux doesn't have fputc_unlocked.
8277
8278         * expr.c (usage): Use putchar, not fputs, to output a single character.
8279         * ls.c (dired_dump_obstack): Likewise.
8280         * ptx.c (output_one_tex_line, output_one_dumb_line): Likewise.
8281         * stat.c (print_it): Likewise.
8282
8283 2003-03-07  Jim Meyering  <jim@meyering.net>
8284
8285         * src/cp.c: Remove everything associated with mmap-stack.c.
8286         This reverts the two changes of 2003-02-21.
8287         * src/du.c: Remove everything associated with mmap-stack.c.
8288         This reverts the change of 2003-02-19.
8289
8290 2003-03-06  Jim Meyering  <jim@meyering.net>
8291
8292         * tests/cp/same-file: Unset CDPATH.  Otherwise, having the
8293         CDPATH shell variable set could cause this test to fail.
8294         Reported by Karl Berry.
8295
8296 2003-03-05  Jim Meyering  <jim@meyering.net>
8297
8298         * Version 4.5.9.
8299
8300         * src/printf.c (print_esc): Remove pointless comparison of unsigned
8301         integer with zero, to avoid a warning from Intel's ecc.
8302         Reported by Nelson Beebe.
8303
8304         * src/du.c (process_file): Sizes must all be of type uintmax_t.
8305         Otherwise, for files or totals that are too big, numbers would
8306         be truncated.  Patch mostly by Michael Stone.
8307         Reported by Ingo Saitz as Debian bug #183210.
8308
8309         * tests/du/8gb: New test for the above-fixed bug.
8310         * tests/du/Makefile.am (TESTS): Add 8gb.
8311
8312         * src/du.c (MAX_N_DESCRIPTORS): Use 3 * UTILS_OPEN_MAX / 4
8313         rather than UTILS_OPEN_MAX - 10.
8314
8315 2003-03-04  Jim Meyering  <jim@meyering.net>
8316
8317         * README: Refer new feature discussion to bug-coreutils@gnu.org,
8318         rather than bug-gnu-utils, now that the former is better known.
8319         Suggestion from Göran Uddeborg.
8320
8321         * src/stat.c (usage): Capitalize consistently.
8322         Reported by Göran Uddeborg.
8323
8324         * Makefile.maint (rel-files): Include $(signatures), so that
8325         those files are also copied into $(release_archive_dir).
8326
8327         * src/df.c (find_mount_point): Call error here, now that restore_cwd
8328         no longer does it.
8329         * src/remove.c (AD_pop_and_chdir): Likewise.
8330
8331         * tests/Makefile.am (check-root): Add fail-2eperm.
8332
8333 2003-03-03  Jim Meyering  <jim@meyering.net>
8334
8335         * src/remove.c (remove_cwd_entries): Include the full filename of
8336         the offending file, not just the basename.
8337
8338         * tests/misc/tty-eof: Set $ME properly.
8339
8340         * Makefile.maint (THIS_VERSION_REGEXP, PREV_VERSION_REGEXP):
8341         Remove now-unused variables.
8342         (tag-prev-version, prev-cvs-tag): Likewise.
8343
8344         * src/remove.c (remove_cwd_entries) [!ROOT_CAN_UNLINK_DIRS]: Give an
8345         accurate diagnostic when failing to remove a file owned by some other
8346         user.  Reported by Ivo Timmermans via Michael Stone.
8347         This fixes Debian bug# 178471.
8348
8349         * tests/rm/Makefile.am (TESTS): Add fail-2eperm.
8350         * tests/rm/fail-2eperm: New test, for the above-fixed bug.
8351         Based on a report from Ivo Timmermans.
8352
8353 2003-03-02  Jim Meyering  <jim@meyering.net>
8354
8355         * src/copy.c (copy_internal) [un_backup]: When recovering from a
8356         failure to create a hard link, do not remove the entry associating
8357         the source dev/ino with the destination file name.
8358         * tests/mv/Makefile.am (TESTS): Add hard-3.
8359         * tests/mv/hard-3: New test, for the above-fixed bug.
8360         Inspired by a report from Iida Yosiaki.
8361
8362 2003-03-01  Jim Meyering  <jim@meyering.net>
8363
8364         * src/df.c (print_header): Don't embed spaces in a separate `Type'
8365         header string.  Instead, put `Filesystem' and `Type' headers in the
8366         same string, so translators can use horizontal space as needed.
8367         Reported by Jean Charles Delepine.
8368
8369 2003-02-28  Jim Meyering  <jim@meyering.net>
8370
8371         * src/copy.c (copy_internal): When link fails because of an
8372         existing destination file, unlink that file and try again.
8373         Reported by Iida Yosiaki.
8374
8375         * tests/mv/Makefile.am (TESTS): Add hard-2.
8376         * tests/mv/hard-2: New test for the above-fixed bug.
8377         Based on a test case from Iida Yosiaki.
8378
8379 2003-02-26  Jim Meyering  <jim@meyering.net>
8380
8381         * tests/du/basic: Don't test du's -b option here.  Directory byte
8382         counts are smaller (512 rather than 4096) on at least OSF/1 5.1
8383         and IBM AIX 4.2.  Reported by Nelson Beebe.
8384
8385 2003-02-25  Jim Meyering  <jim@meyering.net>
8386
8387         * Makefile.maint (announcement): Now that ChangeLog entries
8388         are output by announce-gen, don't do it here.
8389         * announce-gen (print_changelog_deltas): New function.
8390         (main): Use it.
8391
8392 2003-02-22  Jim Meyering  <jim@meyering.net>
8393
8394         * announce-gen: New option: --release-type=TYPE
8395         * Makefile.maint (beta, major): New targets.  Remove `release'.
8396         Put them all together on a line.
8397         Pass the release type (via RELEASE_TYPE envvar) to the MAKE
8398         invocation of `announcement'.
8399         (announcement): Invoke announce-gen with --release-type=$RELEASE_TYPE.
8400
8401         * announce-gen: New option: --news=NEWS_FILE.
8402         Extract NEWS entries here, not via rules in Makefile.maint.
8403         * Makefile.maint (announcement): Now that NEWS entries are
8404         extracted by announce-gen, don't do it here.
8405         (news-r1, news-r2): Remove now-unused definitions.
8406
8407 2003-02-21  Jim Meyering  <jim@meyering.net>
8408
8409         * Version 4.5.8.
8410
8411         Merge in changes from autoconf's version of this file.
8412         * Makefile.maint (www-gnu): Define.
8413         (standards.texi-url_prefix): Use $(www-gnu).
8414         (make-stds.texi-url_prefix): Likewise.
8415
8416         * src/cp.c: Include "mmap-stack.h".
8417         (main): Invoke `run' through a macro that (when possible) runs it
8418         with a large, mmap'd stack.
8419
8420         * src/cp.c (run): New function, preparing for the above.
8421         Exit from this function, not from main
8422         (main): Call run.
8423
8424         * src/du.c: New option: --apparent-size.
8425         (enum) [APPARENT_SIZE_OPTION]: New member.
8426         (long_options): Add it.
8427         (usage): Describe it.
8428         (main): Handle it.
8429         ['b']: Set apparent_size.
8430         David Eisner reported that the behavior of --bytes had changed.
8431         Paul Eggert proposed the use of a new option, --apparent-size.
8432
8433         * src/du.c (apparent_size): New global.
8434         (print_only_size): Reflect the fact that we're printing byte counts,
8435         not ST_NBLOCKSIZE-byte-block counts.
8436         (print_size): Call print_only_size rather than duplicating its code.
8437         (process_file): Accumulate byte counts, rather than block counts.
8438
8439         * src/du.c (process_file): Always reset size_to_propagate_to_parent
8440         for --separate-dirs (-S).
8441
8442 2003-02-20  Jim Meyering  <jim@meyering.net>
8443
8444         * Use automake-1.7.3.  Regenerate dependent files.
8445
8446         * src/stat.c (print_stat): New format: %B (to print ST_NBLOCKSIZE).
8447         This makes %b (number of ST_NBLOCKSIZE-byte blocks) more useful.
8448         (usage) [%B]: Describe it.
8449         [%b]: Refer to %B.
8450
8451         * src/du.c (process_file): Reorganize the code to use only
8452         one `sum' array, and change how -S works back to the way it was
8453         before 2003-01-31.  Patch by Bruno Haible.
8454
8455         * tests/du/basic: New test.
8456         * tests/du/Makefile.am (TESTS): Add basic.
8457
8458         * tests/envvar-check: Add checks for the following:
8459         BLOCK_SIZE, DU_BLOCK_SIZE, DF_BLOCK_SIZE, LS_BLOCK_SIZE.
8460
8461         * tests/Makefile.am: Rename phony target envvar-check to evar-check
8462         so as not to conflict with the distributed file by the same name.
8463
8464         * src/du.c (process_file): Set info->skip before any possible return.
8465
8466         Report correct usage for directories, not 0.
8467         * src/du.c (process_file): Return for `file_type == FTW_DPRE'
8468         _before_ recording the dev/ino of a directory.
8469         Reported by Bruno Haible.
8470
8471         Now, df always displays the device file name corresponding to the
8472         listed mount point under `Filesystem'.  Before, for an unmounted
8473         block- or character-special file argument, it would display the
8474         command-line argument instead.
8475         * src/df.c (show_disk): Return a value indicating whether
8476         there was a match.  Don't try to find a mount point here.
8477         (show_entry): If show_disk doesn't find a match, call show_point.
8478
8479 2003-02-19  Jim Meyering  <jim@meyering.net>
8480
8481         * src/du.c: Include "mmap-stack.h".
8482         (du_files): Add prototype with ATTRIBUTE_NORETURN.
8483         Exit from this function, not from...
8484         (main): ...here.
8485         Instead, if possible, invoke du_files through a macro that
8486         runs it with a large, mmap'd stack.
8487
8488         * src/join.c (usage): Change wording in --help output:
8489         use FILENUM instead of `SIDE' and say what FILENUM means.
8490         Reported by Bernhard Gabler.
8491
8492         * src/df.c (print_header): Rather than using a hard-coded literal
8493         string of spaces matching the length of the English `...Type' header,
8494         output the right number of spaces to match the selected translation.
8495         Reported by Yann Dirson and Jean Charles Delepine as Debian bug 131113.
8496
8497         * src/split.c (bytes_split): Remove unnecessary `else' after break.
8498         (lines_split): Likewise.  and correct misleading indentation.
8499
8500         * src/split.c: Include "full-read.h".
8501         (bytes_split, lines_split, line_bytes_split): Use full_read,
8502         not safe_read.   The way split was using the latter, a short read
8503         could cause split to terminate before EOF.
8504
8505         * tests/misc/tty-eof: Test all programs that can read stdin,
8506         requiring no arguments and that write to standard output.
8507
8508         * tests/misc/tty-eof: New file.  Renamed from ...
8509         * tests/misc/cat-tty-eof: Remove file.  Rename to tty-eof.
8510         * tests/misc/Makefile.am (TESTS): Reflect renaming.
8511
8512 2003-02-18  Jim Meyering  <jim@meyering.net>
8513
8514         cksum would perform an extra read after encountering EOF
8515         * src/cksum.c (cksum): Exit the loop upon EOF, too.
8516         Patch by Michael Bacarella.
8517
8518         Test for the bug fixed today in cksum, md5sum, and sha1sum.
8519         * tests/misc/cat-tty-eof: Generalize, clean-up, and test for
8520         cat, cksum, md5sum, and sha1sum all in the same loop.
8521
8522 2003-02-14  Jim Meyering  <jim@meyering.net>
8523
8524         * src/remove.c: Include "euidaccess.h".
8525         Remove declaration of euidaccess.
8526
8527 2003-02-12  Jim Meyering  <jim@meyering.net>
8528
8529         * src/pathchk.c (portable_chars_only): Remove unnecessary `const'
8530         in cast to avoid warning from icc.  Reported by Alexandre Duret-Lutz.
8531
8532 2003-02-10  Jim Meyering  <jim@meyering.net>
8533
8534         * src/test.c: Don't include group-member.h.
8535         Include euidaccess.h.
8536         (eaccess): Rewrite function to set the real uid and gid temporarily
8537         to the effective uid and gid, then invoke 'access', and then set the
8538         real uid and gid back.  On systems that lack setreuid or setregid,
8539         fall back on the kludges in euidaccess.  Before, it would not work
8540         for e.g., files with ACLs, files that were marked immutable,
8541         or on file systems mounted read-only.  Nelson Beebe raised the issue.
8542         Paul Eggert suggested the new implementation.
8543
8544 2003-02-09  Jim Meyering  <jim@meyering.net>
8545
8546         * src/test.c (test_stat): Remove function.  It's job is done (only
8547         when necessary) by the wrapper in lib/stat.c.  Adjust all uses.
8548
8549 2003-02-08  Jim Meyering  <jim@meyering.net>
8550
8551         * Version 4.5.7.
8552
8553         * tests/mv/part-symlink: Don't assume that the file owner username
8554         length is less than 9 in ls output: instead, omit that field
8555         altogether.  Reported by, and suggested fix from, Ferdinand.
8556
8557         * tests/du/restore-wd: New test for just-fixed bug in ftw.c.
8558         * tests/du/Makefile.am (TESTS): Add restore-wd.
8559
8560         * src/rm.c: Correct now-invalid comment about cycle-detection.
8561
8562 2003-02-06  Jim Meyering  <jim@meyering.net>
8563
8564         * NEWS: Add entries from old/*/NEWS
8565         from fileutils-4.1 through 4.1.11 and
8566         from sh-utils-2.0 through 2.0.15.  Suggestion from Karl Berry.
8567
8568         * Version 4.5.6.
8569
8570         * src/du.c (process_file): Don't return early for excluded files
8571         or for files whose dev/inode we've already seen.
8572
8573 2003-02-05  Jim Meyering  <jim@meyering.net>
8574
8575         * tests/du/exclude: New file.
8576         * tests/du/Makefile.am (TESTS): Add exclude.
8577
8578 2003-02-04  Dmitry V. Levin  <ldv@altlinux.org>
8579
8580         * src/who.c (print_boottime, print_deadprocs, print_runlevel):
8581         Fix memory allocation arithmetic.
8582
8583 2003-02-04  Jim Meyering  <jim@meyering.net>
8584
8585         `df /dev/block-or-char-device-file--not-mounted' now reports
8586         the name of the file system on which the file resides, usually `/'.
8587         Before, it would leave the `Mounted on' field blank.
8588         * src/df.c (show_disk): Move function to precede find_mount_point.
8589         (show_disk): Add parameter: STATP.
8590         If we don't find a matching device name, then resort to calling
8591         find_mount_point.  Reported by Bob Proulx.
8592
8593 2003-02-03  Andreas Schwab  <schwab@suse.de>
8594
8595         * tests/rm/cycle: Require non-root.
8596         * tests/rm/isatty: Likewise.
8597
8598 2003-02-02  Jim Meyering  <jim@meyering.net>
8599
8600         * Version 4.5.5.
8601
8602         * man/Makefile.am (check-x-vs-1): Use @PATH_SEPARATOR@, not `:'.
8603
8604         Ensure that there are no offending uses of `:'.
8605         * Makefile.maint (makefile_path_separator_check): New rule.
8606         (local-check): Add it to the list.
8607
8608 2003-02-01  Jim Meyering  <jim@meyering.net>
8609
8610         * src/du.c (MAX_N_DESCRIPTORS): Define.
8611
8612         * src/stat.c (G_fail): New global.
8613         (human_time): Diagnose failed localtime, not failed nstrftime.
8614         (main): Fail if G_fail is set.
8615
8616 2003-01-31  Richard Dawe  <rich@phekda.freeserve.co.uk>
8617
8618         * tests/basename/Makefile.am: Use @PATH_SEPARATOR@ instead of
8619         hard-coding the path-separator.  Also double-quote the new PATH,
8620         to avoid problems when the path-separator is a semi-colon or when
8621         `pwd` contains e.g. a space.
8622         * tests/chgrp/Makefile.am: Likewise.
8623         * tests/chmod/Makefile.am: Likewise.
8624         * tests/chown/Makefile.am: Likewise.
8625         * tests/cp/Makefile.am: Likewise.
8626         * tests/dd/Makefile.am: Likewise.
8627         * tests/dircolors/Makefile.am: Likewise.
8628         * tests/du/Makefile.am: Likewise.
8629         * tests/expr/Makefile.am: Likewise.
8630         * tests/factor/Makefile.am: Likewise.
8631         * tests/fmt/Makefile.am: Likewise.
8632         * tests/install/Makefile.am: Likewise.
8633         * tests/ln/Makefile.am: Likewise.
8634         * tests/ls/Makefile.am: Likewise.
8635         * tests/ls-2/Makefile.am: Likewise.
8636         * tests/md5sum/Makefile.am: Likewise.
8637         * tests/misc/Makefile.am: Likewise.
8638         * tests/mkdir/Makefile.am: Likewise.
8639         * tests/mv/Makefile.am: Likewise.
8640         * tests/od/Makefile.am: Likewise.
8641         * tests/rm/Makefile.am: Likewise.
8642         * tests/rmdir/Makefile.am: Likewise.
8643         * tests/seq/Makefile.am: Likewise.
8644         * tests/sha1sum/Makefile.am: Likewise.
8645         * tests/shred/Makefile.am: Likewise.
8646         * tests/stty/Makefile.am: Likewise.
8647         * tests/sum/Makefile.am: Likewise.
8648         * tests/tail-2/Makefile.am: Likewise.
8649         * tests/touch/Makefile.am: Likewise.
8650         * tests/tsort/Makefile.am: Likewise.
8651         * tests/unexpand/Makefile.am: Likewise.
8652
8653 2003-01-31  Jim Meyering  <jim@meyering.net>
8654
8655         * src/stat.c: Include "file-type.h"
8656         (print_human_type): Remove function.
8657         (human_access): Rename from print_human_access.  Return a string.
8658         (human_time): Rename from print_human_time.  Return a string.
8659         (print_stat): Arrange so that field width and an alignment specifier
8660         are honored for the %A, %F, %x, %y, and %z formats.
8661         [%F]: Use file_type; this gives slightly different file type strings,
8662         e.g., `directory' instead of `Directory' and `regular file' or
8663         `regular empty file' instead of `Regular file'.
8664         Prompted by a report from Richard Dawe that the uses of
8665         S_IFSOCK and S_IFIFO in print_human_time were not portable
8666         to systems using e.g., DJGPP.
8667
8668 2003-01-31  Richard Dawe  <rich@phekda.freeserve.co.uk>
8669
8670         * src/stat.c (print_stat): Use S_ISLNK rather than an explicit
8671         test using S_IFMT and S_IFLNK.  S_IFLNK may not be defined.
8672
8673 2003-01-31  Jim Meyering  <jim@meyering.net>
8674
8675         * src/du.c (main): Upon processing an invalid option or an invalid
8676         --exclude-from or --max-depth option argument, don't exit right away,
8677         in case there are others.  Rather record the failure and exit after
8678         processing other options.
8679
8680         * GNUmakefile (TAR_OPTIONS): Set and export, in order to make
8681         tar archive easier to reproduce.
8682
8683         Rewrite to perform directory traversal using nftw.
8684
8685         * src/du.c: Include "dirname.h", "ftw.h", and "quotearg.h".
8686         (AUTHORS): Add self.
8687         (opt_one_file_system): Move global into `main'.
8688         (path, xstat, exit_status): Remove declarations.
8689         (arg_length, suffix_length): New globals.
8690         (G_fail): New global, sort of like the old `exit_status'.
8691         (IS_FTW_DIR_TYPE): Define.
8692         (print_only_size): New function.
8693         (process_file): New function.
8694         (str_init, ensure_space, str_copyc, str_concatc): Remove functions.
8695         (str_trunc, pop_dir, count_entry): Likewise.
8696         (du_files): Rewrite to use nftw.
8697
8698 2003-01-30  Jim Meyering  <jim@meyering.net>
8699
8700         * tests/du/trailing-slash: Ensure that du/ftw follows a command-line
8701         symlink-to-directory with -L, even without the trailing slash.
8702
8703 2003-01-27  Jim Meyering  <jim@meyering.net>
8704
8705         * src/Makefile.am (check-misc): Check for st_blocks, too.
8706
8707         * src/stat.c (print_stat): Use ST_NBLOCKS rather than `->st_blocks'.
8708         Reported by Richard Dawe.
8709
8710 2003-01-27  Andreas Schwab  <schwab@suse.de>
8711
8712         * src/ls.c (quote_name): Add fourth parameter, width, into which to
8713         store the screen columns, and return the number of bytes instead.
8714         (print_dir): Pass NULL as fourth parameter of quote_name.
8715         (print_name_with_quoting): Likewise.
8716         (length_of_file_name_and_frills): Get the width from the fourth
8717         parameter of quote_name instead of return value.
8718
8719 2003-01-27  Jim Meyering  <jim@meyering.net>
8720
8721         * src/ls.c (decode_switches): If `dired' is set without
8722         `format == long_format', then silently reset dired.  This doesn't
8723         change the behavior of ls (all prior uses of dired were protected
8724         by `&& format == long_format'), and lets us...
8725         (DIRED_INDENT): ... remove the `format == long_format' conjunct.
8726         (PUSH_CURRENT_DIRED_POS): Likewise.
8727         (main): Likewise.
8728
8729 2003-01-22  Jim Meyering  <jim@meyering.net>
8730
8731         * tests/du/no-x: New test, for functionality added to lib/ftw.c.
8732         * tests/du/Makefile.am (TESTS): Add no-x.
8733
8734 2003-01-21  Jim Meyering  <jim@meyering.net>
8735
8736         * src/remove.c (remove_entry) [ROOT_CAN_UNLINK_DIRS
8737         && HAVE_STRUCT_DIRENT_D_TYPE]: If a file has d_type == DT_UNKNOWN
8738         it may still be a directory -- or not (e.g., with FreeBSD on an
8739         NFS-mounted file system), so resort to calling lstat to find out.
8740         Based on a patch by Michael van Elst.
8741
8742         * tests/cp/same-file: Don't assume that the file owner username
8743         length is less than 9 in ls output: instead, omit that field
8744         altogether.  Reported by, and suggested fix from, Ferdinand.
8745
8746 2003-01-20  Jim Meyering  <jim@meyering.net>
8747
8748         * tests/date/Test.pm (wide-fmt): New test to demonstrate that
8749         large format widths no longer cause strftime to infloop.
8750
8751         * Makefile.maint (mail_gpg_sign_cookie): Remove now-unused definition.
8752
8753 2003-01-19  Jim Meyering  <jim@meyering.net>
8754
8755         * src/readlink.c: Include "canonicalize.h".
8756
8757 2003-01-18  Jim Meyering  <jim@meyering.net>
8758
8759         * src/ls.c (Dereference_symlink) [DEREF_COMMAND_LINE_SYMLINK_TO_DIR]:
8760         New member.
8761         (enum) [DEREFERENCE_COMMAND_LINE_SYMLINK_TO_DIR_OPTION]: New member.
8762         (long_options): Add option --dereference-command-line-symlink-to-dir.
8763         (main): Make DEREF_COMMAND_LINE_SYMLINK_TO_DIR be the default,
8764         rather than DEREF_COMMAND_LINE_ARGUMENTS, when none of the
8765         -d, -F, -l options is specified.
8766         (decode_switches): Handle --dereference-command-line-symlink-to-dir.
8767         (gobble_file): Honor DEREF_COMMAND_LINE_SYMLINK_TO_DIR.
8768         Change --dereference-command-line (-H) to dereference *all*
8769         command line arguments, including broken symlinks.
8770
8771 2003-01-15  Paul Eggert  <eggert@twinsun.com>
8772
8773         Change ls -H back to the way it was yesterday, since this is
8774         compatible with FreeBSD and the POSIX spec is confusing
8775         and somewhat contradictory.
8776
8777         * src/ls.c (DEREF_COMMAND_LINE_ARGUMENTS): Change name back
8778         from DEREF_COMMAND_LINE_SYMLINK_TO_DIR, updating all uses.
8779         (long_options): Change the long option name back.
8780         (usage): Change the usage back.
8781         (gobble_file): When -H is specified, dereference a top-level
8782         arg even if it points to a non-directory.
8783
8784 2003-01-15  Jim Meyering  <jim@meyering.net>
8785
8786         * src/ls.c (gobble_file): Fall back on using lstat when required:
8787         when --dereference (-L) is not specified, and
8788         - when operating on a dangling symlink
8789         - when operating on command-line-symlink-to-directories
8790         This fixes numerous problems.  Here are examples:
8791         - `ls dangling-symlink' would fail with `no such file...'
8792         Now it prints `dangling-symlink'.
8793         - `ls -i symlink' would mistakenly print the inode of the referent.
8794         Now it prints the inode of the symlink.  Likewise for --size (-s).
8795         Based on a patch from Michael Stone.
8796         Reported by Deepak Goel as Debian bug #173793.
8797
8798         Rename ls's --dereference-command-line (-H)
8799         option to   --dereference-command-line-symlink-to-dir.
8800         * src/ls.c [enum Dereference_symlink]
8801         (DEREF_COMMAND_LINE_SYMLINK_TO_DIR): Rename from
8802         DEREF_COMMAND_LINE_ARGUMENTS.  Update all uses.
8803         (long_options): Rename the long option.
8804         (usage): Say that --dereference-... changes how ls treats
8805         only symlinks to directories specified on the command line.
8806
8807 2003-01-14  Jim Meyering  <jim@meyering.net>
8808
8809         * tests/ls/dangle: New file/test, for the above fix.
8810         * tests/ls/inode: Another new file/test, for the above fix.
8811         * tests/ls/Makefile.am (TESTS): Add dangle and inode.
8812
8813         * src/ls.c (gobble_file): Fix a bug introduced in 4.5.4 that made it
8814         so that ls --color would no longer highlight the names of files with
8815         the execute bit set when not specified on the command line.
8816         Patch by Michael Stone.  Reported by Stephen Depooter as
8817         Debian bug 175135.
8818
8819         * tests/ls-2/tests (color-exe): New test, for the above fix.
8820
8821 2003-01-13  Jim Meyering  <jim@meyering.net>
8822
8823         * tests/shred/exact: Also test for just fixed bug with --zero.
8824
8825         * src/shred.c (long_opts): --zero does not require an argument.
8826         Patch by Michael Stone.  Reported by Roland Turner as Debian bug 172019.
8827
8828 2003-01-12  Jim Meyering  <jim@meyering.net>
8829
8830         * Makefile.maint (cvs-update): Skip any file with local modifications.
8831
8832         * src/unexpand.c (usage): Document --first-only and mention that
8833         --tabs=N (-t) enables --all (-a).  Reported by wiregauze@yahoo.com.
8834
8835 2002-12-01  Dmitry V. Levin  <ldv@altlinux.org>
8836
8837         * src/df.c: Include "canonicalize.h".
8838         Use canonicalize_file_name unconditionally.
8839
8840 2003-01-09  Jim Meyering  <jim@meyering.net>
8841
8842         * README: Add readlink.
8843
8844 2002-11-30  Dmitry V. Levin  <ldv@altlinux.org>
8845
8846         * src/df.c: Include "xgetcwd.h".
8847         * src/pwd.c: Likewise.
8848
8849 2002-11-30  Dmitry V. Levin  <ldv@altlinux.org>
8850
8851         * src/shred.c: Remove declaration of xstrdup.
8852         We already get it via xalloc.h which is included via system.h.
8853
8854 2002-08-27  Dmitry V. Levin  <ldv@altlinux.org>
8855
8856         New program: readlink.
8857
8858         * src/Makefile.am (bin_PROGRAMS): Add readlink.
8859         * src/readlink.c: New file.
8860
8861         * man/readlink.x: New file.
8862         * man/Makefile.am (dist_man_MANS): Add readlink.1.
8863         (readlink.1): New rule.
8864
8865 2003-01-09  Jim Meyering  <jim@meyering.net>
8866
8867         When selecting ranges of byte offsets (as opposed to ranges of fields)
8868         and when --output-delimiter=STRING is specified, output STRING between
8869         ranges of selected bytes.
8870         * src/cut.c (RANGE_START_SENTINEL): Define.
8871         (output_delimiter_specified): New global.
8872         (print_kth): Add parameter.  Adjust all callers.
8873         (set_fields): Mark each range-start index with RANGE_START_SENTINEL.
8874         (cut_bytes): When requested, output STRING between ranges of
8875         selected bytes.
8876         (main): Make a diagnostic a little clearer.
8877         Based on a patch from Jan Nieuwenhuizen.
8878
8879         * tests/cut/Test.pm: New tests for the above.
8880
8881         * src/cut.c (set_fields): Make code agree with comment:
8882         Don't merge abutting ranges like 4- and 2-3.  This makes no
8883         difference currently, but is required to support an upcoming change.
8884
8885 2003-01-07  Jim Meyering  <jim@meyering.net>
8886
8887         * src/cut.c (set_fields): Fix typo in comment.
8888
8889         * tests/touch/not-owner: New test, mostly extracted from fail-diag.
8890         * tests/touch/Makefile.am (TESTS): Add not-owner.
8891         * tests/touch/fail-diag: Remove the test for non-owner diagnostic.
8892         Now, this tests only the nonexistent-directory diagnostic.
8893         Suggestion from Michael Stone.
8894
8895         * tests/touch/fail-diag: Fix typo: s/ld/ls/.
8896
8897 2003-01-04  Jim Meyering  <jim@meyering.net>
8898
8899         * src/copy.h: Remove use of PARAMS.
8900         * src/remove.h: Likewise.
8901         * src/chown-core.h: Likewise.
8902
8903         rm could be tricked into mistakenly reporting a cycle.
8904         * src/remove.c: [cycle_check_state]: New global.
8905         (remove_cwd_entries): Adapt to new semantics of cycle_check.
8906         (rm): Call cycle_check_init and cycle_check_free for each file.
8907         * tests/rm/cycle (rm): New test, for the above fix.
8908         * tests/rm/Makefile.am (TESTS): Add cycle.
8909
8910         When rm detects a cycle, don't abort the entire command,
8911         but rather just the affected command line argument.
8912         * src/remove.c: Include <setjmp.h>
8913         (struct dirstack_state) [current_arg_jumpbuf]: New member.
8914         (remove_cwd_entries): Call longjmp if we detect a cycle.
8915         (rm): Call setjmp here.
8916
8917         * src/remove.c (cycle_check, is_power_of_two): Remove functions.
8918         Instead, include cycle-check.h and use it.
8919
8920         * src/remove.h (struct dev_ino): Remove declaration.
8921
8922         * src/remove.c (remove_cwd_entries): Fix typos in comment.
8923
8924         Don't include trailing /. in diagnostics about directories.
8925         * src/remove.c (full_filename_): When FILENAME is just `.'
8926         and there is a nonempty directory-name part, don't append `/.'.
8927         * tests/rm/unread2: Remove trailing /. from diagnostic.
8928         * tests/rm/rm2: Likewise.
8929
8930         * src/remove.c (struct dirstack_state): Define.
8931         To be used in place of these file-scoped globals ...
8932         (dir_stack, len_stack, Active_dir): Remove globals.
8933         (ds_init, ds_free): New functions.
8934         (full_filename): Define.
8935         (full_filename_): Rename from full_filename.
8936
8937         Begin to make AD_* functions more generic.
8938         * src/remove.c (AD_push_initial): Don't set status to RM_OK here.
8939         (AD_push): Likewise.
8940         (AD_INIT_OTHER_MEMBERS): Define.
8941         (remove_dir): Define the `status' member manually after each
8942         call to AD_push or AD_push_initial.
8943
8944         * src/Makefile.am (check-misc): New rule, to ensure that no more
8945         S_IS* macro definitions sneak into the code.
8946         (check): Depend on check-misc.
8947
8948         * src/remove.c [S_ISLNK]: Don't define.  It's already defined in sys2.h.
8949         * src/du.c (count_entry) [S_ISLNK]: Don't define.
8950         * src/shred.c [S_ISLNK, S_ISFIFO, S_ISSOCK]: Don't define.
8951
8952 2003-01-03  Jim Meyering  <jim@meyering.net>
8953
8954         * src/true.c: Add copyright.
8955         (AUTHORS): I suppose I've written it.
8956
8957         * src/Makefile.am (false.c): Make the generated file be read-only.
8958
8959 2003-01-04  Jim Meyering  <jim@meyering.net>
8960
8961         * src/ls.c: Include "dev-ino.h".
8962         [struct dev_ino]: Remove declaration.
8963
8964 2003-01-02  Jim Meyering  <jim@meyering.net>
8965
8966         * src/cp.c (do_copy): Tweak diagnostic to be consistent with the one
8967         from mv: s/missing file arguments/missing file argument/.
8968         With --target-directory=DIR, cp and mv work with a single file argument.
8969         Reported by Karl Berry.
8970
8971         * tests/rm/isatty: Enable this test.
8972
8973 2002-12-31  Jim Meyering  <jim@meyering.net>
8974
8975         * src/remove.c (AD_push_initial): Don't set status to RM_OK here.
8976         (AD_push): Likewise.
8977         (AD_INIT_OTHER_MEMBERS): Define.
8978         (remove_dir): Define the `status' member manually after each
8979         call to AD_push or AD_push_initial.
8980
8981         * src/ls.c [struct dev_ino]: Remove definition.
8982         Include "dev-ino.h" instead.
8983
8984 2002-12-28  Jim Meyering  <jim@meyering.net>
8985
8986         * tests/du/Makefile.am (TESTS): Add no-deref.
8987         * tests/du/no-deref: New script.
8988
8989 2002-12-23  Jim Meyering  <jim@meyering.net>
8990
8991         * src/remove.c (remove_cwd_entries): Fix typo in comment.
8992
8993 2002-12-21  Jim Meyering  <jim@meyering.net>
8994
8995         * announce-gen: Generate MML-formatted announcement.
8996         This makes it a *lot* harder to send stale MD5/SHA1 signatures.
8997
8998 2002-12-20  Jim Meyering  <jim@meyering.net>
8999
9000         * src/touch.c (touch): Change the wording of a diagnostic so
9001         that it makes sense both when the file exists and when it doesn't.
9002         Suggestion from Michael Stone.
9003
9004 2002-12-18  Jim Meyering  <jim@meyering.net>
9005
9006         * src/stty.c (valid_options): Declare to be static.
9007
9008 2002-12-15  Jim Meyering  <jim@meyering.net>
9009
9010         * Makefile.cfg: Remove rules related to generating m4/jm-glibc-io.m4.
9011
9012         * src/chmod.c, src/copy.c, src/copy.h, src/cp-hash.h, src/csplit.c:
9013         * src/date.c, src/expr.c, src/fmt.c, src/id.c, src/install.c:
9014         * src/ls.c, src/od.c, src/pathchk.c, src/pr.c, src/remove.c:
9015         * src/shred.c, src/sort.c, src/stat.c, src/stty.c, src/sum.c:
9016         * src/tee.c, src/test.c: Remove all uses of `PARAMS'.
9017
9018         * src/remove.c (PARAMS): Remove definition.
9019         * src/sys2.h: Likewise.
9020
9021         * src/ls.c, src/stat.c, src/date.c: Remove declaration of nstrftime.
9022         Include strftime.h instead.
9023
9024 2002-12-14  Jim Meyering  <jim@meyering.net>
9025
9026         * Makefile.cfg ($(url_dir_list)): Use .../coreutils, not .../fetish.
9027
9028         * src/system.h [! HAVE_DECL_MEMRCHR]: Declare memrchr.
9029         This is necessary at least for Irix6.5 when using c89.
9030         Reported by Nelson Beebe.
9031
9032         * tests/misc/Makefile.am (TESTS): Add cat-tty-eof.
9033
9034         * tests/misc/cat-tty-eof: New test.
9035
9036         * src/mknod.c (usage): Specify how major and minor mode numbers
9037         are interpreted.  Report forwarded by Kristin E Thomas.
9038         * src/mknod.c: Remove now-redundant usage-specifying comment.
9039
9040 2002-12-13  Jim Meyering  <jim@meyering.net>
9041
9042         * Version 4.5.4.
9043
9044         * tests/du/trailing-slash: Allow for a directory of size `0'.
9045         That happens at least on file systems of type tmpfs on linux-2.4.18.
9046
9047         * announce-gen: New script to begin replacing the commands
9048         associated with the rule here...
9049         * Makefile.maint (announcement): Invoke announce-gen.
9050         * Makefile.am (EXTRA_DIST): Add announce-gen.
9051
9052         * tests/cp/preserve-2: New file/test, for latest fix.
9053         * tests/cp/Makefile.am (TESTS): Add preserve-2.
9054
9055 2002-12-11  TAKAI Kousuke  <takai@vlsi.kuee.kyoto-u.ac.jp>
9056
9057         Fix a bug whereby cp would fail to parse an option like
9058         --preserve=mode,ownership.
9059         * src/cp.c (decode_preserve_arg): Advance `comma' to
9060         point the character following the comma.
9061
9062 2002-12-11  Jim Meyering  <jim@meyering.net>
9063
9064         * src/pathchk.c (NEED_PATHCONF_WRAPPER): Undefine before defining,
9065         in case it's already defined.
9066
9067 2002-12-09  Jim Meyering  <jim@meyering.net>
9068
9069         * tests/touch/fail-diag: Don't get a test failure if /no exists.
9070         Instead, evoke a framework failure if /no-$$ exists.
9071         Reported by Michael Stone.
9072
9073 2002-12-08  Jim Meyering  <jim@meyering.net>
9074
9075         * src/du.c (lstat) [! LSTAT_FOLLOWS_SLASHED_SYMLINK]:
9076         Define to rpl_lstat, so that even on systems like Solaris 5.8,
9077         du honors (per POSIX) the trailing slash on an argument referring
9078         to a symlink-to-directory.
9079
9080 2002-12-06  Jim Meyering  <jim@meyering.net>
9081
9082         * Use autoconf-2.57.  Regenerate dependent files.
9083         * Use automake-1.7.2.  Regenerate dependent files.
9084
9085         * src/ls.c (gobble_file): Also stat the file if it's a
9086         regular file and --indicator-style=classify (aka -F).
9087         Thanks to Ed Santiago for opening my eyes.
9088
9089         * tests/ls/file-type: New file.  Test for the above.
9090         A test to contrast ls -F and ls --indicator-style=file-type.
9091         * tests/ls/Makefile.am (TESTS): Add file-type.
9092
9093 2002-12-04  Jim Meyering  <jim@meyering.net>
9094
9095         * tests/ls/follow-slink: Make sure the symlink was created.
9096         Richard Dawe reported that `ln -s link link' succeeds, but creates
9097         no file on systems running some version of the DJGPP libc.
9098
9099 2002-12-03  Jim Meyering  <jim@meyering.net>
9100
9101         * src/Makefile.am (AUTOMAKE_OPTIONS): Remove definition (to ansi2knr)
9102         since this package no longer panders to K&R compilers.
9103
9104 2002-12-02  Jim Meyering  <jim@meyering.net>
9105
9106         * tests/du/slink: Skip this test if `.' is on a non-local file system.
9107
9108         * tests/Fetish.pm (_at_replace): Do the substitution only if there's
9109         something to replace.
9110
9111 2002-12-01  Jim Meyering  <jim@meyering.net>
9112
9113         * src/stat.c: Don't include <string.h> or <ctype.h>.
9114         That's already done via system.h.
9115         * src/dircolors.c: Don't include <ctype.h>.
9116
9117 2002-11-30  Jim Meyering  <jim@meyering.net>
9118
9119         * ls.c (gobble_file): Remove the block of code that caused
9120         `ls --color -F symlink-to-dir' to list the files in
9121         `symlink-to-dir/.'.  Now, it prints `symlink-to-dir@', (just
9122         like `ls -F symlink-to-dir') but with the addition of highlighting.
9123         Similarly, `ls --color -dF symlink-to-dir' would print
9124         `symlink-to-dir/';  now it prints `symlink-to-dir@'.
9125         Reported by Jeff Sheinberg as Debian bug #168203.
9126         * tests/ls-2/tests (sl-F-color, sl-dF-color): New tests for the above.
9127
9128         ls is now more efficient: with certain options, it no longer needs
9129         to stat each directory entry on systems with valid dirent.d_type.
9130         * src/ls.c (print_dir): Add DT_LNK and DT_REG.
9131         (main): Make --recursive set format_needs_type, not format_needs_stat.
9132         (gobble_file): Remove a FIXME comment, now that it's fixed.
9133
9134 2002-11-24  Jim Meyering  <jim@meyering.net>
9135
9136         * src/du.c (du_files): Don't strip any trailing slash.
9137         Rewrite so that `/' is no longer represented internally as
9138         the empty string.
9139         (count_entry): When appending a file name component,
9140         account for the fact that the current path may end in `/'.
9141         François Pinard reported that `du symlink-to-dir/' was not
9142         equivalent to `du symlink-to-dir/.'.  Now it is.
9143         * tests/du/trailing-slash: New file/test, for the above fix.
9144         * tests/du/Makefile.am (TESTS): Add trailing-slash.
9145
9146 2002-11-23  Jim Meyering  <jim@meyering.net>
9147
9148         * src/tac.c (output): Declare some local variables to be of type size_t,
9149         rather than `int' to avoid warnings from gcc.
9150
9151 2002-11-21  Paul Eggert  <eggert@twinsun.com>
9152
9153         * src/ls.c (decode_switches): Use case-sensitive matching to
9154         decode the QUOTING_STYLE environment variable.  This is more
9155         consistent with the documentation, and with --quoting-style.
9156
9157 2002-11-21  Martin Buck  <martin.buck@ascom.ch
9158
9159         * src/stty.c (struct speeds): Add support for all baud rates defined
9160         in linux-2.4.19.
9161
9162 2002-11-19  Jim Meyering  <jim@meyering.net>
9163
9164         * tests/sum/sysv: Export LC_ALL=C, to avoid failure when
9165         run in a UTF locale.  Report and suggested fix by Bruno Haible.
9166         * tests/fmt/basic: Likewise.
9167
9168 2002-11-17  Jim Meyering  <jim@meyering.net>
9169
9170         * configure.ac: Update via autoupdate.
9171         Add `AM_GNU_GETTEXT_VERSION(0.11.5)'.
9172
9173         * src/mv.c (movefile): Don't remove trailing slashes from SOURCE.
9174         Reported by Hans Ginzel.
9175
9176 2002-11-15  Jim Meyering  <jim@meyering.net>
9177
9178         * Makefile.cfg (gnu_rel_host): Define.
9179         (url_dir_list): Choose from (alpha|ftp).gnu.org depending
9180         on whether $(VERSION) looks like a major release number.
9181
9182         * Makefile.maint (mail_gpg_sign_cookie): Backslash-escape `#'.
9183         (release): Rename from `alpha'.
9184         (alpha): Depend on release.
9185
9186         * Makefile.maint (signatures): Define with ?=, so it's easy to override.
9187
9188 2002-11-14  Jim Meyering  <jim@meyering.net>
9189
9190         * Makefile.maint (mail_gpg_sign_cookie): Make optional.
9191         (announcement): Use the new variable.
9192
9193         * Makefile.maint: Sync with Bison, i.e.:
9194         (po-check): Scan .l and .y files instead of the
9195         .c and the .h files that they generate.  This fixes the bug
9196         reported by Tim Van Holder in:
9197         <http://mail.gnu.org/pipermail/bison-patches/2002-November/001352.html>
9198         Look for N_ as well as for _.  Try to avoid matching #define for
9199         N_ and _.
9200         From Paul Eggert.
9201
9202 2002-11-12  Jim Meyering  <jim@meyering.net>
9203
9204         * src/ls.c (HAVE_SYMLINKS): Remove unnecessary macro definition.
9205         Replace sole use with equivalent `#ifdef S_ISLNK'.
9206         Inconsistency reported by Dmitry V. Levin.
9207
9208 2002-11-11  Jim Meyering  <jim@meyering.net>
9209
9210         * src/stat.c (usage): Transform --help items output via s/ - /   /,
9211         so that help2man produces properly formatted man pages.
9212         Reported by Herbert Xu as Debian bug #168400.
9213
9214 2002-11-10  Jim Meyering  <jim@meyering.net>
9215
9216         * src/ls.c (sighandler): Handle SIGTSTP specially.
9217         Based on suggestions from Solar Designer and Dmitry V. Levin.
9218         Add comments.
9219
9220         * Makefile.cfg (cvs_files): Define.  From autoconf.
9221         (local_updates): Likewise.
9222
9223         * src/ls.c (restore_default_color_handler, sigtstp_handler):
9224         Remove functions.
9225         (sighandler): New function, based on the one in sort.c.
9226         (main): Use sigaction, if possible; otherwise signal.
9227         Handle these signals:
9228         SIGHUP, SIGINT, SIGPIPE, SIGQUIT, SIGTERM, SIGTSTP.
9229         Don't register our handler if the signal is already being ignored.
9230
9231         * src/dd.c (interrupt_handler): Use raise, rather than kill+getpid.
9232         * src/csplit.c (interrupt_handler): Likewise.
9233         * src/sort.c (sighandler): Likewise.
9234         (main): Declare `i' and `nsigs' to be unsigned, not int.
9235
9236 2002-11-09  Jim Meyering  <jim@meyering.net>
9237
9238         ls --color: restore terminal text color upon signal.
9239         * src/ls.c: Include "full-write.h" and <signal.h>.
9240         (restore_default_color, restore_default_color_handler): New functions.
9241         (sigtstp_handler, put_indicator_direct): New functions.
9242         (main) [print_with_color]: Register signal handlers.
9243         Patch mostly by Solar Designer and Stanislav Ievlev.
9244
9245         Update from autoconf.
9246         * Makefile.maint (AMTAR): Remove definition.
9247         (update, cvs-update, po-update, do-po-update): New rules.
9248         (wget-update): Update (thus renaming to cvs-update).
9249         (automake_repo): Use anoncvs@sources.redhat.com.
9250
9251 2002-11-06  Jim Meyering  <jim@meyering.net>
9252
9253         * tests/misc/Makefile.am (TESTS): Add printf-hex.
9254
9255         * tests/misc/printf: Be careful to test the code in this package,
9256         not the shell built-in function.
9257
9258         * src/printf.c (print_esc): A hexadecimal escape sequence has
9259         at most two hex. digits, not three.  Reported by Padraig Brady.
9260         (usage): Update description.
9261         * tests/misc/printf-hex: New file/test, for the above fix.
9262
9263 2002-10-07  Paul Eggert  <eggert@twinsun.com>
9264
9265         Add support for locale-specific size indications (e.g.,
9266         thousands-separators) and for explicit size suffixes on output.
9267
9268         * doc/coreutils.texi (Block size): Say that:
9269         This affects display format as well as block size.
9270         Fractional block counts are rounded up.
9271         ls file size blocksize defaults to 1.
9272         A block size spec preceded by ' generates thousands separators.
9273         A suffix without a preceding integer generates suffixes.
9274         (tail invocation): 32k -> 32 KiB.
9275         (What information is listed): ls -h is now equivalent to
9276         ls --block-size=human, and ls -H is now equivalent to
9277         ls --block-size=si.  Displayed file size is now always affected by
9278         --block-size.
9279
9280         * lib/inttostr.c, lib/inttostr.h, lib/imaxtostr.c, lib/offtostr.c,
9281         lib/umaxtostr.c: New files, taken from GNU tar.
9282
9283         * lib/Makefile.am (libfetish_a_SOURCES): Add imaxtostr.c, offtostr.c,
9284         umaxtostr.c.
9285         (EXTRA_DIST): Add inttostr.c.
9286
9287         * lib/human.c, lib/human.h: Rewrite to support locale-specific
9288         notations like thousands separators.
9289         Specify what includer of include.h must include beforehand.
9290         (human_group_digits, human_suppress_point_zero, human_autoscale,
9291         human_base_1024, human_SI, human_B): New enum values.
9292         (human_readable): Rename from human_readable_inexact; put the
9293         options before the sizes.  All uses changed.  The old human_readable
9294         function has been removed; use inttostr.h instead.
9295         (human_options): Renamed from human_block_size, with new signature
9296         that allows block sizes up to UINTMAX_MAX.  All callers changed.
9297
9298         * m4/prereq.m4 (jm_PREREQ_HUMAN): Check for locale.h, localeconv,
9299         AC_HEADER_STDBOOL.  No need to check for limits.h since it's in
9300         freestanding C89.  No need to check for stdlib.h or string.h since
9301         autoconf does this now.
9302
9303         * src/cksum.c (cksum): Use primitives from inttostr.h, not
9304         human.h, to print large numbers simply.
9305         * src/csplit.c (handle_line_error, parse_patterns): Likewise.
9306         * src/dd.c (print_stats, main): Likewise.
9307         * src/df.c (print_header): Likewise.
9308         * src/factor.c (print_factors): Likewise.
9309         * src/ls.c (print_long_format, print_file_name_and_frills): Likewise.
9310         * src/shred.c (dopass): Likewise.
9311         * src/sort.c (checkfp): Likewise.
9312         * src/sum.c (bsd_sum_file, sysv_sym_file): Likewise.
9313         * src/tail.c (xlseek): Likewise.
9314         * src/wc.c (write_counts, wc): Likewise.
9315
9316         * src/df.c (human_output_opts): New var.
9317         (output_block_size): Now uintmax_t, not int, to handle larger
9318         block sizes.  All uses changed.
9319         * src/du.c: Likewise.
9320         * src/ls.c: Likewise.
9321
9322         * src/df.c (print_header): In the header line, prefer SI to human
9323         representation if it's shorter; if neither is shorter, try to
9324         intuit what the user would prefer.
9325
9326         * src/expr.c (inttostr): Remove; use new imaxtostr library
9327         function instead.
9328
9329         * src/ls.c (file_output_block_size): New var, to distinguish
9330         file sizes from other sizes.
9331         (decode_switches): Set it.
9332
9333         * src/shred.c (OUTPUT_BLOCK_SIZE): remove.
9334         (dopass): When printing progress, use floor for what has been done
9335         so far (since we should be conservative there), and ceiling for
9336         what needs to be done (since that's what other programs use).
9337
9338 2002-10-19  Jim Meyering  <jim@meyering.net>
9339
9340         * src/pinky.c (print_heading): Align TTY and Name headings.
9341         Reported by Karl Eichwalder.
9342
9343 2002-10-18  Jim Meyering  <jim@meyering.net>
9344
9345         * src/split.c (cwrite): Change type of `bytes' parameter to size_t
9346         Remove now-useless cast.
9347         (stdread): Remove function.
9348         (bytes_split): Use size_t instead of int.
9349         Use safe_read, not stdread.
9350         (lines_split): Likewise.
9351         Use memchr rather than a `while' loop.
9352         (line_bytes_split): Use size_t instead of int.
9353         Use safe_read, not stdread.
9354         (main): Add some FIXME comments to remind me to remove casts.
9355
9356         * src/system.h (ST_BLKSIZE): Correct comment describing how to
9357         reproduce HPUX-11 cat failure.  From Petter Reinholdtsen.
9358
9359 2002-10-17  Jim Meyering  <jim@meyering.net>
9360
9361         Fix a problem that could make e.g., `cat' misbehave on systems which
9362         give invalid (unreasonably large) values for stat.st_blksize.
9363         * src/system.h (ST_BLKSIZE): Ensure that the result is in [1..4MB].
9364         Reported by Petter Reinholdtsen.
9365
9366 2002-10-14  Jim Meyering  <jim@meyering.net>
9367
9368         Specifying a printf conversion specifer as nl's separator string
9369         could cause nl to segfault.
9370         * src/nl.c (build_print_fmt): Don't include separator string
9371         in the printf format; it might contain `%'.
9372         Use a better bound on the length of the print_fmt buffer.
9373         (print_lineno): Print the separator here instead.
9374         Reported by Doug Coleman.
9375
9376         * tests/misc/nl: New file/tests, including a test for the above.
9377         * tests/misc/Makefile.am (TESTS): Add nl.
9378
9379         * tests/misc/split-l: New test, to make sure `split --lines=N' works.
9380         * tests/misc/Makefile.am (TESTS): Add split-l.
9381
9382 2002-10-13  Jim Meyering  <jim@meyering.net>
9383
9384         * Version 4.5.3.
9385
9386         * src/du.c (usage): Tweak description of --dereference-args/-D.
9387
9388         * src/du.c (count_entry): Also save cwd when dereferencing (via
9389         --dereference-args, -D) a command-line argument.
9390         Reported by Michal Svec.  Based on a patch by Andreas Schwab.
9391
9392         * src/Makefile.am (../AUTHORS): New target/rule.
9393
9394 2002-10-12  Jim Meyering  <jim@meyering.net>
9395
9396         * src/paste.c (paste_parallel): Declare local, `delims_saved', to be
9397         of type size_t, since that's the way it's used and avoids a warning.
9398
9399         * src/csplit.c (struct cstring) [len]: Declare to be unsigned int,
9400         since that's how it's always used and avoids a new warning from gcc.
9401         (read_input): Adapt to new safe_read ABI.
9402
9403         * src/cut.c (cut_fields): Add a temporary size_t variable, n_bytes,
9404         to avoid warnings.
9405
9406         * src/pinky.c (print_long_entry): fread returns size_t.
9407         Declare local `bytes' accordingly, to avoid warning.
9408
9409         tail -c +N would perform an extra read after encountering EOF
9410         [this change is analogous (bytes vs. lines) to the one of 2002-01-27]
9411         * src/tail.c (start_bytes): Detect EOF, inform caller.
9412         (tail_bytes): Upon EOF in start_bytes, return immediately.
9413         (file_lines): Reorganize to use memrchr rather than an explicit loop.
9414         Adapt to new safe_read ABI.
9415
9416 2002-10-11  Jim Meyering  <jim@meyering.net>
9417
9418         * tests/du/deref: New file/test, for the above fix.
9419         * tests/du/Makefile.am (TESTS): Add deref.
9420
9421 2002-10-10  Jim Meyering  <jim@meyering.net>
9422
9423         * tests/ln/Makefile.am (TESTS): Add target-1.
9424         * tests/ln/target-1: New file/test, for the fix on 2002-10-08.
9425
9426 2002-10-09  Jim Meyering  <jim@meyering.net>
9427
9428         * tests/cp/backup-is-src: Ensure that certain environment variables
9429         are not set (e.g., SIMPLE_BACKUP_SUFFIX).  Reported by Duncan Roe.
9430
9431         * tests/tail-2/big-4gb: Mark this as an expensive test; it would
9432         consume 4GB of disk space on systems without support for sparse files.
9433         Fix a logic error that'd make it `cat err' even though dd didn't fail.
9434
9435         * src/dircolors.hin (.jar): Fix typo: s/;3$/;31/.
9436         Patch by steven@magelico.net, forwarded by Michael Stone.
9437
9438         * tests/ls/dired: Ensure that ls produces English messages.
9439         Patch by Alexey Vyskubov, forwarded by Michael Stone.
9440
9441 2002-10-08  Dmitry V. Levin  <ldv@altlinux.org>
9442
9443         * src/ln.c (main): Fix target_directory parsing when n_files == 1.
9444
9445 2002-10-08  Jim Meyering  <jim@meyering.net>
9446
9447         * tests/tail-2/big-4gb: Use double quotes around diagnostic.
9448         Fix syntax in test: use =, not ==.
9449         Reported by Bob Proulx.
9450         Change all the rest like this: grep -lR "testing framework'" .\
9451         |xargs perl -pi -e 's/'\''(\$0: failure in testing framework)'\''/"$1"/'
9452
9453         * src/sum.c (sysv_sum_file): Adapt to new safe_read ABI.
9454         * src/tr.c (squeeze_filter, read_and_delete, read_and_xlate): Likewise.
9455         * src/tac.c (save_stdin, tac_stdin_to_mem): Likewise.
9456         * src/wc.c (wc): Likewise.
9457
9458 2002-10-07  Paul Eggert  <eggert@twinsun.com>
9459
9460         * src/cat.c (cat):
9461         Don't advance the write pointer past the end of the write buffer.
9462         * src/sort.c (begfield, limfield): Likewise.
9463
9464 2002-10-07  Jim Meyering  <jim@meyering.net>
9465
9466         * src/cat.c (simple_cat, cat): Adapt to new safe_read ABI.
9467         * src/head.c (head_bytes, head_lines): Likewise.
9468
9469 2002-10-06  Jim Meyering  <jim@meyering.net>
9470
9471         * src/dd.c (scanargs): Ensure that specified block sizes (specified
9472         via ibs=N, obs=N, and bs=N) are no larger than SSIZE_MAX.
9473         (skip, dd_copy): Adapt to new safe_read ABI.
9474
9475         * Makefile.maint (signatures): Define.
9476         (%.sig): New rule.
9477         (announcement): Depend on $(signatures).
9478
9479         * Makefile.maint (announcement): Output all URLs for detached
9480         signatures, not just the last one from the previous loop.
9481
9482 2002-10-05  Jim Meyering  <jim@meyering.net>
9483
9484         * Version 4.5.2.
9485
9486         * src/remove.c (remove_entry) [ROOT_CAN_UNLINK_DIRS]: With `rm -i DIR',
9487         don't recurse into directory, DIR.  Prompted by a report from
9488         Leonardo Milano.
9489
9490         * tests/rm/i-no-r: New file/test, for the above fix.
9491         * tests/rm/Makefile.am (TESTS): Add i-no-r.
9492
9493         * tests/tail-2/big-4gb: New file/test, for the fix of 2002-09-27.
9494         * tests/tail-2/Makefile.am (TESTS): Add big-4gb.
9495
9496 2002-10-03  Jim Meyering  <jim@meyering.net>
9497
9498         * src/rm.c (AUTHORS): Mark translatable string with `N_ (...)'.
9499         * src/df.c (AUTHORS): Likewise.
9500         * src/du.c (AUTHORS): Likewise.
9501         * src/tail.c (AUTHORS): Likewise.
9502         * src/touch.c (AUTHORS): Likewise.
9503
9504 2002-10-02  Jim Meyering  <jim@meyering.net>
9505
9506         * Makefile.am (SUBDIRS): Remove `old'.
9507         (EXTRA_DIST): List the files in old/.
9508         * configure.ac (AC_CONFIG_FILES): Remove old/* names.
9509         Suggestion from Akim Demaille.
9510
9511 2002-10-01  Jim Meyering  <jim@meyering.net>
9512
9513         * src/sys2.h (SSIZE_MAX): Define.
9514
9515 2002-09-30  Jim Meyering  <jim@meyering.net>
9516
9517         * src/csplit.c: Don't include stdlib.h here.  It's already included
9518         via system.h.
9519
9520 2002-09-29  Jim Meyering  <jim@meyering.net>
9521
9522         * src/tr.c (find_bracketed_repeat): Rearrange pointer/integer
9523         expression to avoid bogus warning from gcc.
9524
9525         * src/cat.c (simple_cat): Use a temporary to avoid bogus warnings.
9526         (cat): Declare insize and outsize to be of type size_t, not int.
9527         Rearrange pointer/integer expressions to avoid bogus warnings.
9528         (main): Declare insize and outsize to be of type size_t, not int.
9529
9530         * src/tail.c (parse_options): Give a sensible diagnostic for
9531         an invalid byte or line count.  Reported by Mikko Tuumanen.
9532
9533         * src/touch.c (main): Split a long line.
9534
9535         * tests/du/Makefile.am (TESTS): Add slink.
9536         * tests/du/slink: New test for system.h change of 2002-08-31.
9537
9538         In move mode, always first try to rename.  Before, upon failure to
9539         rename a directory, this code would never attempt to rename any
9540         other file in that directory, but would thenceforth always copy.
9541         On some systems (e.g., NetApp's OnTap-6.4), renaming a directory
9542         may fail with EXDEV, yet renaming files within that directory to
9543         a newly-created destination directory succeeds.
9544         * src/copy.c (copy_internal): Remove local, move_mode;
9545         use x->move_mode instead.  Based on a patch from Tom Haynes.
9546
9547 2002-09-28  Jim Meyering  <jim@meyering.net>
9548
9549         * src/split.c (FAIL_ONLY_ONE_WAY): New macro.
9550         Factor out some duplication.
9551         (main): Use it.
9552         [case 'a']: Use strtoul rather than strtol to avoid compiler warnings.
9553
9554         * src/sort.c (begfield, limfield): Rearrange comparisons to avoid
9555         compiler warnings.
9556         (fillbuf, keycompare): Cast literal `-1' to size_t in comparisons,
9557         to avoid compiler warnings.
9558
9559         * src/shred.c (dopass): Use a uintmax_t temporary to avoid bogus
9560         compiler warnings.
9561
9562         Fix things so `mkdir -p' can create very deep directories, e.g.,
9563         mkdir -p $(perl -e 'print "a/" x 40000') now works.
9564         * src/mkdir.c (main): For --parents (-p), call make_path with the
9565         entire directory name, so we don't ever require that file operations
9566         like stat or chmod be performed on the entire command line argument.
9567         * makepath.c (make_path): Restore umask *before* creating the final
9568         component.
9569
9570 2002-09-27  Andreas Schwab  <schwab@suse.de>
9571
9572         * src/tail.c (tail_bytes): Change type of bytes_remaining to off_t
9573         to avoid overflow.  Reported by Hans Lermen.
9574
9575 2002-09-26  Jim Meyering  <jim@meyering.net>
9576
9577         * src/install.c (get_ids): Use strtoul, not strtol.  Remove some casts.
9578
9579 2002-09-25  Jim Meyering  <jim@meyering.net>
9580
9581         * src/test.c (eaccess): Change type of local `euid' from int to uid_t
9582         and add a cast, to avoid a warning about `signed and unsigned type in
9583         conditional expression'.
9584
9585 2002-09-22  Jim Meyering  <jim@meyering.net>
9586
9587         * src/rmdir.c: Include "dirname.h", for declaration of
9588         strip_trailing_slashes.
9589
9590         * src/stat.c (PRIdMAX, PRIuMAX): Remove definitions.
9591         Now they're defined through system.h.
9592
9593         * src/cp-hash.c, src/dd.c, src/df.c, src/du.c, src/ls.c,
9594         * src/stat.c, src/wc.c: Remove all inclusions of inttypes.h,
9595         since it's already included from sys2.h via system.h.
9596
9597         * Use automake-1.6f.  Regenerate dependent files.
9598
9599         * src/Makefile.am (PERL): Remove duplicate definition.
9600
9601         fmt's -s, -t, -c options didn't work properly for long lines.
9602         Since get_line may end up calling put_paragraph (for long lines),
9603         be sure to set global, `other_indent', before it is used there.
9604
9605         * src/fmt.c (set_other_indent): New function, factored out of...
9606         (get_paragraph): ... here.  Call it.
9607         (get_line): Call set_other_indent before calling flush_paragraph,
9608         which calls fmt_paragraph, which in turn calls put_paragraph,
9609         which uses other_indent.
9610
9611         * tests/fmt/Makefile.am (TESTS): Add long-line.
9612         * tests/fmt/long-line: New file/test, for the above fix.
9613
9614 2002-09-21  Jim Meyering  <jim@meyering.net>
9615
9616         * src/od.c: No longer include deprecated <values.h>.
9617         It was required solely for now-removed reference to BITSPERBYTE.
9618         * src/install.c: Likewise.
9619         Suggestion from Bruno Haible.
9620
9621 2002-09-06  Andreas Schwab  <schwab@suse.de>
9622
9623         `rmdir -p dir-specified-with-trailing-slash/' would fail.
9624         * src/rmdir.c (remove_parents): Strip trailing slashes.
9625
9626 2002-09-20  Jim Meyering  <jim@meyering.net>
9627
9628         * tests/rmdir/t-slash: New file/test, for the above fix.
9629         * tests/rmdir/Makefile.am (TESTS): Add t-slash.
9630
9631         * Makefile.maint (announcement): Arrange to gpg-sign the message.
9632         Add a URL for each detached signature file.
9633
9634 2002-09-07  Bruno Haible  <bruno@clisp.org>
9635
9636         * configure.ac: Add need-ngettext to AM_GNU_GETTEXT invocation.
9637
9638 2002-09-18  Jim Meyering  <jim@meyering.net>
9639
9640         `od -t x8' used the wrong (`l'-prefixed) printf format.
9641         Likewise for the o8 and u8 formats.
9642         * src/od.c (ISPEC_TO_FORMAT): Define macro.
9643         (decode_one_format): Use PRIdMAX, PRIoMAX, etc. for LONG_LONG.
9644         Reported by Arun Sharma.
9645
9646 2002-09-17  Jim Meyering  <jim@meyering.net>
9647
9648         * src/sys2.h (PRIdMAX, PRIoMAX, PRIuMAX, PRIxMAX): Define if necessary.
9649         From gettext's intl/loadmsgcat.c.
9650
9651         * tests/od/x8: New file/test, for the above fix.
9652         * tests/od/Makefile.am (TESTS): Add x8.
9653
9654 2002-09-15  Jim Meyering  <jim@meyering.net>
9655
9656         * Use autoconf-2.54.  Regenerate dependent files.
9657
9658         * src/csplit.c (get_format_width): Add cast to avoid
9659         warning about `signed and unsigned type in conditional expression'.
9660
9661 2002-09-14  Jim Meyering  <jim@meyering.net>
9662
9663         * src/who.c (print_user): Change type of local to size_t
9664         to avoid warnings about `comparison between signed and unsigned'.
9665         * src/ptx.c (generate_all_output): Likewise.
9666
9667         * src/dd.c (main, skip): Add casts to avoid warnings about
9668         `comparison between signed and unsigned'.
9669
9670         * src/id.c (print_full_info, print_group_list): Add casts to avoid
9671         warnings about `signed and unsigned type in conditional expression'.
9672
9673         * src/md5sum.c: Change type of global, digest_hex_bytes, to size_t
9674         to avoid warnings about `comparison between signed and unsigned'.
9675         (split_3): Change parameter names to be readable and add comment.
9676         Clean up the test for whether a line may be ignored.
9677
9678 2002-09-13  Jim Meyering  <jim@meyering.net>
9679
9680         * src/printf.c (main): Handle leading command line argument of `--'.
9681         Reported by Raul: DervishD <raul@pleyades.net>
9682         * tests/misc/printf: New file: test for the above.
9683         * tests/misc/Makefile.am (TESTS): Add printf.
9684
9685         * src/date.c (usage): Explain that %S's range of [0..60] is required --
9686         rather than 0..59 -- to accommodate the occasional positive leap second.
9687         Reported by Richard Neill.
9688
9689 2002-09-12  Jim Meyering  <jim@meyering.net>
9690
9691         * src/Makefile.am (nanosec_libs): Define.
9692         (sleep_LDADD, tail_LDADD): Use it here.
9693
9694         Factor nanosleep-related code into ../lib/xnanosleep.c.
9695         * src/sleep.c: Include xnanosleep.h.
9696         Factor out fenv.h-related code.
9697         (timespec_subtract): Remove function.
9698         (main): Remove code that deals with computing start and stop times
9699         as well as the loop around nanosleep.  Now that's in xnanosleep.c.
9700
9701         Allow S (in --sleep-interval=S) to be a floating point value.
9702         * src/tail.c: Include xnanosleep.h and xstrtod.h.
9703         Move declaration of global variable, sleep_interval, to ...
9704         (main): ...here.
9705         (usage): Update description of --sleep-interval option.
9706         (tail_forever): New parameter, sleep_interval.  Update caller.
9707         Use xnanosleep, rather than sleep.
9708         (parse_options): New parameter, sleep_interval.  Update caller.
9709         Use xstrtod, now that we accept floating point values.
9710         Prompted by a patch from Augey Mikus.
9711
9712 2002-09-06  Jim Meyering  <jim@meyering.net>
9713
9714         * src/remove.c (prompt): Change comment to give a better note to
9715         translators.  From Michael Piefel.
9716
9717 2002-09-02  Jim Meyering  <jim@meyering.net>
9718
9719         * README: A good problem report/patch includes diffs against
9720         the most recent test release.
9721
9722         * src/pathchk.c (NEED_PATHCONF_WRAPPER): Define.
9723         (pathconf_wrapper): Define only if NEED_PATHCONF_WRAPPER is set.
9724
9725         * src/kill.c (print_table_row): Use an unsigned type for widths
9726         to avoid warning about comparison between signed and unsigned.
9727         (list_signals): Likewise.
9728
9729         * src/od.c (skip): Add a cast to avoid warning about comparison
9730         between signed and unsigned.
9731         * src/install.c (get_ids): Likewise.  Also rearrange range-checking
9732         comparisons to make them more readable.
9733
9734 2002-09-01  Jim Meyering  <jim@meyering.net>
9735
9736         * Version 4.5.1.
9737
9738 2002-08-31  Jim Meyering  <jim@meyering.net>
9739
9740         Symlinks were always reported as using 0 blocks.
9741         * src/system.h (ST_NBLOCKS): Don't depend on file type.
9742         This reverts the change of 2000-01-30.
9743         Based on a report and patch from Neil Brown via Michael Stone.
9744         This fixes Debian Bug#156358.
9745
9746         * Most files: Change `exit (0)' to `exit (EXIT_SUCCESS)',
9747         `exit (1)' to `exit (EXIT_FAILURE)', and
9748         `usage (1)' to `usage (EXIT_FAILURE)'.
9749
9750         * chgrp.c, chmod.c, chown.c, chroot.c, cp.c, date.c, dd.c, du.c,
9751         * hostname.c, id.c, install.c, ln.c, mkdir.c, mkfifo.c, mknod.c,
9752         * nice.c, pinky.c, printf.c, pwd.c, shred.c, sleep.c, stty.c,
9753         * su.c, tac-pipe.c, tail.c, tee.c, touch.c, uname.c, uptime.c,
9754         * users.c, who.c: Change `error (1, ...' to `error (EXIT_FAILURE, ...'.
9755         But don't change `error (0, ...' to `error (EXIT_SUCCESS, ...', since
9756         error never exits successfully.
9757
9758 2002-08-29  Jim Meyering  <jim@meyering.net>
9759
9760         * src/remove.c (remove_cwd_entries): Use closedir (not CLOSEDIR)
9761         when ignoring any return value.
9762
9763         * src/remove.c (remove_cwd_entries): Detect and diagnose readdir
9764         failures.  On some systems (at least EMC Celerra and Solaris5.8),
9765         this appears to be necessary.
9766         (is_empty_dir): Likewise.  Also, always close directory handle.
9767         * src/ls.c (print_dir): Likewise.
9768         (print_dir): Rename local variable: reading -> dirp.
9769         Reported by Mike Coleman.
9770
9771 2002-08-28  Jim Meyering  <jim@meyering.net>
9772
9773         * src/remove.c (remove_cwd_entries): Use CLOSEDIR, not closedir.
9774         Give a diagnostic and fail if closedir fails.
9775
9776 2002-08-26  Jim Meyering  <jim@meyering.net>
9777
9778         * Makefile.am (THANKS-to-translators): New rule.
9779         (EXTRA_DIST): Add both THANKS-to-translators and THANKStt.in.
9780         * THANKStt.in: New file.
9781
9782         * src/cat.c (close_stdout_wrapper): New, kludgey, function and
9783         file-scoped global.
9784         (main): Register it with atexit.
9785         Close STDOUT_FILENO, to avoid a problem when writing to
9786         /dev/audio on at least Solaris 5.7 and 5.8 systems.
9787         Reported by Shing-Shong Shei.
9788
9789 2002-08-25  Jim Meyering  <jim@meyering.net>
9790
9791         * src/cat.c (main): Close STDIN_FILENO rather than a literal `0'.
9792         * src/tac.c (main): Likewise.
9793         * src/tail.c (main): Likewise.
9794         * src/tee.c (main): Likewise.
9795         * src/tr.c (main): Likewise.
9796         * src/wc.c (main): Likewise.
9797
9798 2002-08-20  Jim Meyering  <jim@meyering.net>
9799
9800         * tests/mv/setup: Rewrite not to use `: ${VAR=not_set}' paradigm.
9801
9802 2002-08-10  Paul Eggert  <eggert@twinsun.com>
9803
9804         * src/nohup.sh: Don't use "exec --"; it's not portable and
9805         shouldn't be needed.
9806
9807 2002-08-09  Jim Meyering  <jim@meyering.net>
9808
9809         * src/pr.c (main): Don't ignore -COLUMN if it's the last option.
9810         (usage): Clarify help text for the -COLUMN option.
9811         Patch by Padraig Brady.
9812         * tests/pr/Test.pm [col-last]: New test for the above.
9813
9814         * configure.ac: Start with version 4.5.1, chosen so that it's larger
9815         than the latest version numbers of the component packages.
9816
9817         * man/Makefile.am (check-x-vs-1): Set and export PATH so we use
9818         programs in ../src.
9819
9820 2002-08-08  Jim Meyering  <jim@meyering.net>
9821
9822         * src/date.c: Guard inclusion of <langinfo.h> with
9823         `#if HAVE_LANGINFO_CODESET', not `#if HAVE_LANGINFO_H'.
9824         * src/sort.c: Likewise.
9825         Patch by GOTO Masanori.
9826
9827 2002-08-05  Paul Eggert  <eggert@twinsun.com>
9828
9829         Fix some minor time-related bugs with POSIX time arguments.
9830         Some valid time stamps were being rejected (notably -1, and
9831         time stamps before 1900 on 64-bit hosts).  And some invalid
9832         time stamps were being accepted, e.g. September 31.
9833
9834         * src/date.c (main): Adjust to posixtime signature change.
9835         * src/touch.c (main): Likewise.  Remove unnecessary initialization.
9836         Use localtime, not posixtm, to warn about obsolete "touch".
9837
9838 2002-08-05  Jim Meyering  <jim@meyering.net>
9839
9840         * tests/misc/Makefile.am (TESTS): Add nice and pathchk1.
9841
9842 2002-08-04  Jim Meyering  <jim@meyering.net>
9843
9844         * src/Makefile.am (check-README): New target/rule.
9845         (check): Depend on it.
9846
9847         * configure.ac (AC_CONFIG_FILES): Add old/Makefile and old/*/Makefile.
9848
9849 2002-08-03  Jim Meyering  <jim@meyering.net>
9850
9851         * Makefile.am (SUBDIRS): Add old.
9852         * old/: New directory, containing legacy ChangeLog* and NEWS files
9853         from the fileutils, sh-utils, and textutils packages.
9854
9855         * src/Makefile.am (AM_INSTALLCHECK_STD_OPTIONS_EXEMPT): Set to false.
9856
9857 2002-08-02  Paul Eggert  <eggert@twinsun.com>
9858
9859         * NEWS, doc/coreutils.texi: uniq now obeys LC_COLLATE.
9860
9861         * src/uniq.c: Include hard-locale.h, xmemcoll.h.
9862         (hard_LC_COLLATE): New var.
9863         (different): Args are now char *, not const char *.
9864         Use xmemcoll instead of memcmp to compare lines, so that
9865         LC_COLLATE has effect.  However, use memcmp if it is an
9866         easy locale.
9867         (check_file): Do not include newline in comparison, so that
9868         xmemcoll has a byte to stomp on temporarily.
9869         (main): Set hard_LC_COLLATE.
9870
9871 2002-07-29  Jim Meyering  <jim@meyering.net>
9872
9873         * Makefile.am (SUBDIRS): Remove djgpp, for now.
9874
9875 2002-07-20  Jim Meyering  <jim@meyering.net>
9876
9877         * Makefile.am (false.c): Convert only the final EXIT_SUCCESS
9878         into EXIT_FAILURE.  Otherwise, false --help and false --version
9879         would fail.
9880
9881 2002-07-08  Jim Meyering  <jim@meyering.net>
9882
9883         * src/Makefile.am (uninstall-local): Search for @GNU_PACKAGE@,
9884         rather than the hard-coded `sh-utils'.
9885
9886 2002-07-01  Jim Meyering  <jim@meyering.net>
9887
9888         * configure.ac: Merge the three files from fileutils,
9889         textutils, and sh-utils.
9890         * Makefile.am: Likewise.
9891         * src/Makefile.am: Likewise.