(VERIFY_W_TYPEOF): Add parentheses.
[platform/upstream/coreutils.git] / ChangeLog
1 2005-06-02  Jim Meyering  <jim@meyering.net>
2
3         * Version 5.3.1.
4
5         * src/sort.c (usage): Put `Ordering options:' line where it belongs.
6
7 2005-06-01  Paul Eggert  <eggert@cs.ucla.edu>
8
9         Use "file name" when talking about file names, instead of "filename"
10         or "path", as per the GNU coding standards.
11         * src/basename.c: Don't use "path" or "filename".
12         * src/copy.c: Likewise.
13         * src/copy.h: Likewise.
14         * src/cp-hash.c: Likewise.
15         * src/cp.c: Likewise.
16         * src/df.c: Likewise.
17         * src/install.c: Likewise.
18         * src/ls.c: Likewise.
19         * src/pinky.c: Likewise.
20         * src/pr.c: Likewise.
21         * src/pwd.c: Likewise.
22         * src/remove.c: Likewise.
23         * src/rmdir.c: Likewise.
24         * src/sort.c: Likewise.
25         * src/system.h: Likewise.
26         * src/tty.c: Likewise.
27         * src/who.c: Likewise.
28         * src/cp.c (parents_option): Renamed from flag_path.  All uses changed.
29         (make_dir_parents_private): Renamed from make_path_private.
30         All uses changed.
31         * src/cp.c (usage): Don't use "path" to describe a file name.
32         * src/readlink.c (usage): Likewise.
33         * src/rmdir.c (usage): Likewise.
34         * src/df.c: Don't include "path-concat.h"; not needed.
35         * src/install.c (install_file_in_file_parents): Renamed from
36         install_file_to_path.  All uses changed.
37         * src/ln.c (FILE_BASENAME_CONCAT): Renamed from PATH_BASENAME_CONCAT.
38         All uses changed.
39         * src/ls.c (make_link_name): Renamed from make_link_path.
40         All uses changed.
41         * src/pwd.c (struct file_name): Renamed from struct Path.
42         All uses changed.
43         (file_name_free): Renamed from path_free.  All uses changed.
44         (file_name_init): Renamed from path_init.  All uses changed.
45         (file_name_prepend): Renamed from path_prepend.  All uses changed.
46         * src/rmdir.c (remove_empty_parents): Renamed from empty_paths.
47         All uses changed.
48         (longopts): Add comment that --path is deprecated.
49
50 2005-05-31  Jim Meyering  <jim@meyering.net>
51
52         * src/copy.c (chown_privileges, chown_failure_ok): Mark as `extern'.
53         This is a crutch so that `make distcheck's sc_tight_scope rule
54         knows that they really are deliberately declared that way.
55
56 2005-05-30  Paul Eggert  <eggert@cs.ucla.edu>
57
58         Port to Solaris 10's rules for whether programs can chown files.
59         * src/copy.c [HAVE_PRIV_H]: Include <priv.h>.
60         (DO_CHOWN): Remove.  Replaced by chown_failure_ok.  All callers
61         changed.
62         (copy_internal): If chown failed, don't worry about what happened
63         to the mode bits; they can't have changed.
64         (chown_privileges, chown_failure_ok): New functions.
65         * src/copy.h: Add copyright notice.
66         (struct cp_options): Remove myeuid member.  Add chown_privileges
67         member.
68         (chown_privileges, chown_failure_ok): New function decls.
69         * src/cp.c (re_protect): Remove unnecessary call to geteuid.
70         Use chown_failure_ok rather than our own code.
71         * src/cp.c (cp_options_init): Use chown_privileges rather than geteuid.
72         * src/install.c (cp_option_init): Likewise.
73         * src/mv.c (cp_option_init): Likewise.
74
75 2005-05-29  Paul Eggert  <eggert@cs.ucla.edu>
76
77         * src/chgrp.c (getgrnam) [!defined _POSIX_VERSION]: Remove decl.
78         * src/chown-core.c (getgrnam, getgrgid) [!defined _POSIX_VERSION]:
79         Remove decls.
80         * src/cp.c (geteuid) [!defined _POSIX_VERSION]: Remove decl.
81         * src/id.c (getpwuid, getgrgid, getuid, getgid, geteuid, getegid)
82         [!defined _POSIX_VERSION]: Remove decls.
83         * src/install.c (getpwnam, getgrnam): Remove decl.
84         (getuid, getgid) [!defined _POSIX_VERSION]: Remove decls.
85         * src/md5sum.c (OPENOPTS, TEXT1T01, TEXTCNVT): Remove.
86         (digest_file): Use O_BINARY-using expr instead of OPENOPTS.
87         * src/system.h: Don't bother mentioning _POSIX_VERSION in comment.
88         * src/test.c: Include sys/param.h if it exists, not if _POSIX_VERSION
89         isn't defined.
90         Don't include <sys/file.h>; no longer needed.
91         (getegid, geteuid): Remove no-longer-necessary decls.
92
93         * src/pathchk.c (_POSIX_PATH_MAX) [!defined _POSIX_PATH_MAX]:
94         Define to 256, not 255, as per modern POSIX.
95
96 2005-05-27  Paul Eggert  <eggert@cs.ucla.edu>
97
98         * NEWS: dd seek=N now conforms to POSIX if the output isn't seekable.
99         * src/dd.c (skip): Return the number of records that were not
100         skipped due to encountering EOF.
101         (dd_copy): If the file wasn't seekable and EOF was encountered,
102         write zeros past EOF until the desired offset is reached.
103
104         * NEWS: expr and test now correctly compare integers of unlimited size.
105         (Also, correct a comment that claimed that expr detects integer
106         overflow; it does so only when converting from strings.)
107         * src/expr.c: Include strnumcmp.h, xstrtol.h.
108         (looks_like_integer): New function.
109         (toarith): Use it.  Also, use xstrtoimax rather than rolling our
110         own diagnostics.
111         (eval2): Don't look for trouble if !evaluate; this simplifies things.
112         Compare numbers using string comparison, so that overflow is
113         not possible.
114         * src/sort.c: Refactor so that others can use large-integer
115         comparison functions.
116         Include "strnumcmp.h".
117         (NEGATION_SIGN, NUMERIC_ZERO, fraccompare):
118         Remove; moved to strnumcmp.
119         (decimal_point): Now int, to simplify converison overhead with
120         new API.  All uses changed.
121         (thousands_sep): Now -1 if there isn't one, as per new API.
122         All uses changed.
123         (numcompare): Move contents to strnumcmp module, except for
124         skipping blanks.
125         * src/test.c: Include inttostr.h, strnumcmp.h.
126         (whitespace, digit, digit_value, integer_expected_error): Remove.
127         (is_int): Remove; replaced by...
128         (find_int): New function.
129         (binary_operator): Don't let integers overflow in comparisons;
130         return the correct answer instead.  Simplify the code.
131         (unary_operator): Convert the integer ourself, since find_int
132         no longer does so.
133         * tests/expr/basic (bigcmp): New test.
134         * tests/test/Test.pm (eq-6, gt-5, lt-5): New tests.
135
136 2005-05-26  Paul Eggert  <eggert@cs.ucla.edu>
137
138         * NEWS: nohup now redirects a tty stdin to an unreadable fd
139         instead of closing it.
140         * doc/coreutils.texi (nohup invocation): Document this.
141         * src/nohup.c (main): Implement this.
142
143 2005-05-26  Jim Meyering  <jim@meyering.net>
144
145         * src/expr.c (toarith): Fix a sign error introduced on 2005-01-14.
146         Reported by David Alan Gilbert.
147         * tests/expr/basic: Add tests using arithmetic on negative integers.
148
149 2005-05-19  Jim Meyering  <jim@meyering.net>
150
151         * src/remove.c (AD_mark_helper, AD_mark_current_as_unremovable):
152         Remove inaccurate-but-harmless `const' attributes.
153
154         * src/join.c (decode_field_spec): Add an abort after
155         `error (EXIT_FAILURE, ...' to avoid a gcc warning in caller,
156         about variables being used uninitialized.
157
158 2005-05-18  Paul Eggert  <eggert@cs.ucla.edu>
159
160         * configure.ac: Add copyright notice.  gl_LIB_CHECK -> cu_LIB_CHECK.
161         * src/Makefile.am: Add copyright notice.
162         (factor_LDADD): Remove, as factor no longer needs sqrt.
163         * src/hostname.c: Remove test for HAVE_LIMITS_H; we can assume
164         it's always true now.
165
166 2005-05-16  Paul Eggert  <eggert@cs.ucla.edu>
167
168         Fix Cygwin porting problem reported by Eric Blake.
169         * src/remove.c (DT_IS_DIR): Remove.
170         (DT_IS_KNOWN, DT_MUST_BE): New macros.
171         (remove_entry): Use them.
172
173 2005-05-14  Paul Eggert  <eggert@cs.ucla.edu>
174
175         * src/remove.c: Include unlinkdir.h.
176         (UNLINK_CAN_UNLINK_DIRS): Remove.
177         (remove_entry): Use cannot_unlink_dirs () rather than
178         UNLINK_CAN_UNLINK_DIRS.
179
180 2005-05-14  Jim Meyering  <jim@meyering.net>
181
182         Update FSF postal mail address.
183         * Makefile.maint, Makefile.cfg, gnupload
184         * src/basename.c, src/cat.c, src/checksum.h, src/chgrp.c
185         * src/chmod.c, src/chown-core.c, src/chown-core.h, src/chown.c
186         * src/chroot.c, src/cksum.c, src/comm.c, src/copy.c, src/copy.h
187         * src/cp-hash.c, src/cp-hash.h, src/cp.c, src/csplit.c, src/cut.c
188         * src/date.c, src/dcgen, src/dd.c, src/df.c, src/dircolors.c
189         * src/dirname.c, src/du.c, src/echo.c, src/env.c, src/expand.c
190         * src/expr.c, src/factor.c, src/fmt.c, src/fold.c, src/fs.h
191         * src/groups.sh, src/head.c, src/hostid.c, src/hostname.c, src/id.c
192         * src/install.c, src/join.c, src/kill.c, src/lbracket.c, src/link.c
193         * src/ln.c, src/logname.c, src/ls-dir.c, src/ls-ls.c, src/ls-vdir.c
194         * src/ls.c, src/ls.h, src/md5.c, src/md5sum.c, src/mkdir.c
195         * src/mkfifo.c, src/mknod.c, src/mv.c, src/nice.c, src/nl.c
196         * src/nohup.c, src/od.c, src/paste.c, src/pathchk.c, src/pinky.c
197         * src/pr.c, src/printenv.c, src/printf.c, src/ptx.c, src/pwd.c
198         * src/readlink.c, src/remove.c, src/remove.h, src/rm.c, src/rmdir.c
199         * src/seq.c, src/setuidgid.c, src/sha1sum.c, src/shred.c
200         * src/sleep.c, src/sort.c, src/split.c, src/stat.c, src/stty.c
201         * src/su.c, src/sum.c, src/sync.c, src/system.h, src/tac-pipe.c
202         * src/tac.c, src/tail.c, src/tee.c, src/test.c, src/touch.c
203         * src/tr.c, src/true.c, src/tsort.c, src/tty.c, src/uname.c
204         * src/unexpand.c, src/uniq.c, src/unlink.c, src/uptime.c
205         * src/users.c, src/wc.c, src/who.c, src/whoami.c, src/yes.c
206
207 2005-05-13  Jim Meyering  <jim@meyering.net>
208
209         * NEWS: `rm -r' now removes all of the files it should, even on
210         systems with a buggy readdir affecting file systems inaccessible
211         at configure time.
212
213         In some unusual circumstances `rm -r' would fail to remove --
214         or even consider -- all entries in a directory with more than 254
215         (SunOS) or 338 (Darwin) entries.  This could cause trouble even on
216         other types of systems when using an affected file system via e.g.,
217         NFS.  The underlying cause was a bug in readdir on those systems.
218         Coreutils-5.2.1 and earlier used a configure-time test designed
219         to detect precisely those problem systems, but it would detect
220         the problem and enable remove.c's work-around code only when its
221         configure-time test was run on a losing file system.  Obviously,
222         it couldn't detect a problem if the offending file system wasn't
223         tested or even mounted at coreutils configure time.  Now, rm itself
224         performs a minimal-cost run-time test to detect the problem.
225
226         * src/remove.c (CONSECUTIVE_READDIR_UNLINK_THRESHOLD): Define.
227         (remove_cwd_entries):  When readdir returns NULL for a directory from
228         which we've removed more than CONSECUTIVE_READDIR_UNLINK_THRESHOLD
229         entries, call rewinddir and then resume the readdir/unlink loop.
230         (UNLINK_CAN_UNLINK_DIRS): Rename from ROOT_CAN_UNLINK_DIRS.
231
232 2005-05-12  Paul Eggert  <eggert@cs.ucla.edu>
233
234         * NEWS: nohup now closes stdin if it is a terminal, unless
235         POSIXLY_CORRECT is set.  This fixes a glitch noted by Wayne Pollock in
236         <https://www.opengroup.org/sophocles/show_mail.tpl?
237         source=L&listname=austin-group-l&id=8341>.
238         * doc/coreutils.texi (nohup invocation): Document this.
239         * src/nohup.c (main): Implement this.
240
241 2005-05-12  Jim Meyering  <jim@meyering.net>
242
243         * src/date.c: Assume `free (NULL)' works.
244         * src/dd.c: Likewise.
245         * src/df.c:Likewise.
246         * src/dircolors.c:Likewise.
247         * src/head.c: Likewise.
248         * src/ls.c: Likewise.
249         * src/md5sum.c: Likewise.
250         * src/pr.c: Likewise.
251         * src/sort.c: Likewise.
252
253 2005-05-10  Jim Meyering  <jim@meyering.net>
254
255         * tests/touch/not-owner: Skip this test if the user running it
256         owns `/' or has write access to it.
257
258         * src/copy.c (abandon_move): Remove erroneous UNWRITABLE check.
259         This makes `mv -i --reply=no f1 f2' work as expected (in not
260         performing the move operation).  But note that specifying `-i'
261         after `--reply=no' does *not* work.
262         Tiny patch from Vlada Macek.
263         Correct a comment.
264         * tests/mv/reply-no: New file.  Test for the above fix.
265         * tests/mv/Makefile.am (TESTS): Add reply-no.
266
267         * tests/ls-2/tests: Don't print PATH to stderr.
268
269 2005-05-08  Paul Eggert  <eggert@cs.ucla.edu>
270
271         * NEWS: cp, ln, mv, rm no longer discard white space when intepreting
272         responses.
273
274 2005-05-06  Paul Eggert  <eggert@cs.ucla.edu>
275
276         * NEWS: dd has new iflag= and oflag= flags "binary" and "text".
277         * src/dd.c (flags, usage): Add support for "binary" and "text".
278
279 2005-05-04  Paul Eggert  <eggert@cs.ucla.edu>
280
281         * NEWS: chmod -w now complains if it differs from chmod a-w.
282         * src/chmod.c: Include quotearg.h.
283         (diagnose_surprises): New var.
284         (process_file): Diagnose surprises.  Simplify the logic a bit,
285         while we're at it.
286         (main): Prepare to diagnose surprises.  Remove useless code for
287         '-' option.
288         * tests/chmod/Makefile.am (TESTS): Add umask-x.
289         * tests/chmod/umask-x: New file.
290
291 2005-05-02  Paul Eggert  <eggert@cs.ucla.edu>
292
293         * NEWS: ls --indicator-style=directory renamed to ls
294         --indicator-style=slash, to avoid confusion with ls --directory.
295         * src/ls.c (usage): Likewise.
296         (slash): Renamed from directory_only.  All uses changed.
297
298 2005-05-01  Paul Eggert  <eggert@cs.ucla.edu>
299
300         * NEWS: "chmod +1 foo" is now diagnosed.
301
302 2005-04-29  Paul Eggert  <eggert@cs.ucla.edu>
303
304         * NEWS: ls -p now marks only directories.  New option
305         --indicator-style=directory equivalent to -p.
306         * doc/coreutils.texi (ls invocation): Document this.
307         Also, mention ">" is for doors.
308         * src/ls.c (enum indicator_style): New constant directory_only,
309         for -p.
310         (indicator_style_args, indicator_style_types): Set it appropriately.
311         (decode_switches, gobble_file, print_type_indicator):
312         (length_of_file_name_and_frills):
313         Implement the change described in NEWS.
314         (decode_switches): Quote ">", too.
315         (usage): Update to match the new behavior.  Describe ">".
316         * tests/ls/file-type: Test for new behavior.  Omit -1 option.
317         The "ls --color" test wasn't being checked; add a check for
318         "ls --color=auto" instead.
319
320         * tests/head/Test.pm: Don't set _POSIX2_VERSION; no longer needed.
321         * tests/misc/split-fail: Likewise.
322         * tests/pr/Test.pm: Likewise.
323         * tests/sort/Test.pm: Fix comment to match new behavior of "sort".
324         * tests/tail/Test.pm (tv): Rename tests from obs to obs-plus
325         if they use file names starting with +.
326         (test_vector): Don't set _POSIX2_VERSION if obs but not obs-plus.
327         * tests/uniq/Test.pm (tv, test_vector): Likewise.
328
329         The following was partly derived from a tiny change by Eric Blake:
330         * tests/misc/nice: Don't use 'set -'.  It's not portable to strict
331         POSIX 1003.1-2001 hosts.  Also, don't set _POSIX2_VERSION.
332         * tests/mkdir/perm: Don't use 'set -'.  Simplify test construction.
333         Work even if the underyling system attaches ACLs to new dirs.
334         * tests/mv/part-hardlink: Don't use 'set -'.
335         * tests/stty/row-col-1: Don't use 'set -'.
336
337 2005-04-28  Paul Eggert  <eggert@cs.ucla.edu>
338
339         * NEWS: Document fixes described below.
340         * src/chmod.c (change, umask_value): New static vars.
341         (reference_file): Move this static var to inside "main".
342         (process_file, process_files): Remove CHANGES arg; now taken from
343         static var.  All uses changed.
344         (usage): Fix incorrect description of MODE operand.
345         (main): For invalid mode usages, output a brief usage message.
346         Adjust to new modechange API.
347         * install.c (main): Adjust to new modechange API.
348         Also, free the mode_change object when done.
349         * mkdir.c (main): Likewise.
350         * mkfifo.c (main): Likewise.
351         * mknod.c (main): Likewise.
352         * tests/chmod/equal-X: Check for =xX bug.
353         * tests/chmod/equals: Check for =u bug.
354         * tests/chmod/usage: Check for u+gr and ug,+x bugs.
355
356 2005-04-26  Paul Eggert  <eggert@cs.ucla.edu>
357
358         Restore support for usages like "head -1" and "tail -1",
359         even when conforming to POSIX 1003.1-2001.
360         Fix bug with "POSIXLY_CORRECT=1 fold file -3".
361         join now supports a NUL field separator, e.g., "join -t '\0'".
362         join now detects and reports incompatible options, e.g.,
363         "join -t x -t y",
364         * NEWS: Document this.
365         * src/date.c: Remove posixver.h and its uses.
366         (COMMON_SHORT_OPTIONS): Remove.
367         (short_options): New constant.
368         (short_options, usage): -I now always takes an optional arg.
369         * src/expand.c: Remove posixver.h and its uses.
370         (shortopts): New constant.  -DIGIT now always takes an optional arg.
371         (main): Revamp parsing of -DIGIT to let parse_tab_stops handle it.
372         Don't complain about -DIGIT.
373         * src/fold.c: Remove posixver.h and its uses.
374         (shortopts): New constant.  -DIGIT now always takes an optional arg.
375         (main): Don't preprocess arg list; that was buggy.  Use method
376         similar to expand.
377         * src/head.c: Remove posixver.h and its uses.
378         (header_mode_option): Remove.
379         (main): Don't complain about obsolete -NUM args.
380         * src/join.c: Remove posixver.h and its uses.
381         (obsolete_usage): Remove.
382         (join_field_1, join_field_2): Initialize to SIZE_MAX to indicate
383         they haven't been set yet.
384         (tab): Now int, not char.  Initialize to -1 to indicate white space
385         separates columns, so that we can use NUL as a separator.
386         All uses changed.
387         (OBSOLETE_LONG_OPTIONS, get_option): Remove.
388         (string_to_join_field): Remove ERR_MSG_FMT arg; a single format
389         suffices.  Use xstrtoul for sizes; it suffices.
390         (decode_field_spec): Report an error and exit on failure.  Return void,
391         not bool.
392         (add_field_list): Likewise.
393         (set_join_field): New function.
394         (enum operand_status): New enum.
395         (add_file_name): New args OPERAND_STATUS, JOPTION_COUNT,
396         PREV_OPTC_STATUS, OPTC_STATUS to handle the bewildering array of
397         possibilities with obsolete option parsing.
398         (main): Use it.  Do not depend on POSIX version.
399         Check for conflicting options.  Parse obsolete options -j1 and -j2
400         so that it is a pure extension to POSIX 1003.1-2001.
401         Allow '-t\0' to specify a NUL tab, stealing the code from 'sort'.
402         * src/nice.c: Remove posixver.h and its uses.
403         (main): Always support -NUM option.
404         * src/od.c: Remove posixver.h and its uses.
405         (short_options): New constant, which always supports -w[num].
406         (COMMON_SHORT_OPTIONS): Remove.
407         * src/pr.c: Remove posixver.h and its uses.
408         (short_options): New constant, which always supports -S[string].
409         (COMMON_SHORT_OPTIONS): Remove.
410         * src/sort.c: Remove posixver.h and its uses.
411         (short_options): New constant, which always supports -y arg.
412         (COMMON_SHORT_OPTIONS): Remove.
413         (main): Redo workaround for Solaris compatibility with -y.
414         This change isn't visible to the user; it just cleans up the
415         code so that we don't need posixver.h.
416         * src/split.c: Remove posixver.h and its uses.
417         (main): Don't complain about -NUM option.
418         * src/tail.c (parse_obsolete_option): Don't complain about -NUM.
419         * src/unexpand.c: Remove posixver.h and its uses.
420         (main): Don't complain about -TAB.
421         * src/uniq.c (main): Don't complain about -NUM.
422
423 2005-04-22  Paul Eggert  <eggert@cs.ucla.edu>
424
425         * src/nohup.c (main): If getopt fails, exit with status 127,
426         not status 1.  POSIX requires this.
427         * NEWS: Document this.
428
429         * src/nice.c (main): Report proper program name when getopt finds
430         trouble.  Problem reported by Behdad Esfahbod.
431
432         * NEWS: Fix bug with "mkdir -m =+x dir"; the umask was being ignored
433         when the "+x" was being evaluated.
434         * mkdir.c (main): Compile mode with MODE_MASK_ALL and initial umask.
435         * mkfifo.c (main): Likewise.
436         * mknod.c (main): Likewise.
437         * tests/mkdir/perm: Test for the above bug.
438
439 2005-04-20  Paul Eggert  <eggert@cs.ucla.edu>
440
441         Port test cases to Microsoft-Windows-related environments,
442         following suggestions from Eric Blake.
443         * tests/install/Makefile.am (TESTS_ENVIRONMENT): Add EXEEXT.
444         * tests/install/basic-1: Undo previous change.
445         (dd, dd2): New vars, which use $EXEEXT.  All uses of dd and dd2 changed.
446         * tests/install/trap: Undo previous change.
447         (sig): New var.  Use it insted of "trap '' CHLD".
448         Append $EXEEXT to executable name.
449
450         "fetish" -> "coreutils" in more places.
451         * tests/Coreutils.pm: Renamed from tests/Fetish.pm.
452         (package Coreutils): Renamed from package Fetish.  All uses changed.
453         * tests/Makefile.am (EXTRA_DIST): Add Coreutils.pm and
454         remove Fetish.pm.
455
456 2005-04-19  Paul Eggert  <eggert@cs.ucla.edu>
457
458         * tests/mv/setup (dot_mount_point): Use stat -L, in case the
459         directory is actually a symbolic link.  Problem reported by
460         Eric Blake.
461
462         * tests/mv/mv-special-1: Use test -p to test for fifos, rather
463         than the (incorrect) test -f and the (inadequate) ls.  ls is
464         inadequate because on some hosts a buggy mv will create a file of
465         the wrong type (problem reported by Eric Blake).  Skip this test
466         if test -p doesn't work.
467
468         * tests/chmod/setgid: Use numeric group ids, not symbolic group names,
469         since the latter can have shell metacharacters in them (e.g., spaces).
470         This follows up to the 2005-01-17 patch, which missed this occurrence.
471
472 2005-04-18  Paul Eggert  <eggert@cs.ucla.edu>
473
474         "fetish" -> "coreutils" in several places.
475         * Makefile.cfg (ftp): Remove fetish.sf.net.
476         * Makefile.maint (emit_upload_commands): Likewise.
477         * src/Makefile.am (LDADD, $(PROGRAMS)): fetish -> coreutils.
478         * tests/group-names (COREUTILS_GROUPS): Renamed from FETISH_GROUPS.
479         * tests/chmod/setgid (FETISH_GROUP): Renamed from COREUTILS_GROUP.
480
481         * tests/install/basic-1: Use "cat", not "test", to test for
482         ../../src/dd.  Problem reported by Eric Blake.
483
484 2005-04-18  Jim Meyering  <jim@meyering.net>
485
486         * src/dd.c: Don't include stat-macros.h directly.  system.h does that.
487
488 2005-04-17  Paul Eggert  <eggert@cs.ucla.edu>
489
490         Work around a couple of "make check" failures reported for Cygwin
491         and ash by Eric Blake.
492         * tests/install/basic-1: Skip this test if ../../src/dd isn't readable.
493         * tests/install/trap: Skip this test if "trap '' CHLD" doesn't work.
494
495 2005-04-16  Jim Meyering  <jim@meyering.net>
496
497         * src/dd.c (S_TYPEISSHM): Remove definition.
498         Get the definition by including "stat-macros.h", instead.
499
500 2005-04-14  Paul Eggert  <eggert@cs.ucla.edu>
501
502         Fix test suite problems reported by Eric Blake on Cygwin.
503         * tests/mv/mv-special-1: Ignore chatter about when files are removed,
504         since POSIX doesn't require rename to fail across file systems.
505         * tests/mv/setup (dot_mount_point): Use stat rather than df, as
506         it's more reliable.
507         (other_partition_tmpdir): Remove df from name as that would be
508         misleading now.
509
510 2005-04-14  Jim Meyering  <jim@meyering.net>
511
512         * src/chown-core.c: Correct typo, fchmod -> fchown, in a comment.
513
514 2005-04-12  Paul Eggert  <eggert@cs.ucla.edu>
515
516         * src/ls.c (usage): "uid" -> "user ID".
517
518 2005-04-12  Jim Meyering  <jim@meyering.net>
519
520         * src/tsort.c (tsort): Use "%s" as the format string,
521         rather than a diagnostic or a file name.
522
523         * src/comm.c (compare_files): Remove declaration of unused local.
524
525         * src/chown-core.c (chopt_free): Mark parameter as unused.
526
527 2005-04-11  Paul Eggert  <eggert@cs.ucla.edu>
528
529         * man/chown.x: Reword to match user manual.
530         * man/id.x: Likewise.
531         * src/setuidgid.c (usage): Use "user ID", not "UID", and similarly
532         for "group ID".
533         * src/whoami.c (usage, main): Likewise.
534
535         Add bulletproofing for cases where stdin, stdout, or stderr are closed.
536         * src/comm.c: Include stdio-safer.h.
537         (compare_files): Exit right away on I/O error rather than continuing
538         and producing confusing output and error messages.
539         Return void, not int; all callers changed.
540         Use fopen_safer to avoid confusion with file descriptors.
541         * src/copy.c: Include unistd-safer.h.
542         (copy_reg): Use fd_safer.
543         * src/csplit.c: Include stdio-safer.h.
544         (input_desc): Remove unnecessary static initialization.
545         (set_input_file): Use STDIN_FILENO, not 0.
546         (create_output_file): Use fopen_safer.
547         * src/dircolors.c (dc_parse_file): Don't assume fopen does not
548         return stdin.
549         * src/head.c (head_file): Don't assume open does not return 0.
550         * src/join.c: Include stdio-safer.h.
551         (main): Use fopen_safer.  Simplify the resulting code.
552         * src/md5sum.c (digest_file, digest_check):
553         Don't assume that fopen does not return stdin.
554         * src/nohup.c: Include unistd-safer.h.
555         (main): Don't dup stderr to stdin or stdout by mistake.
556         * src/od.c (check_and_close): Don't assume fopen does not return stdin.
557         * src/paste.c (paste_serial): Likewise.
558         * src/pr.c: Include stdio-safer.h.
559         (open_file): Use fopen_safer.
560         (close_file): Don't assume fopen does not return stdin.
561         * src/ptx.c (main): Don't assume fopen returns stdout after closing
562         stdout.  Use freopen instead.
563         * src/shred.c: Include unistd-safer.h.
564         (wipename): Use fd_safer on directory file descriptor.
565         (wipefile): Remove special case for /dev/fd/* on older hosts.
566         It didn't work in general, and wasn't documented.
567         Use fd_safer.
568         * src/sort.c: Include unistd-safer.h.
569         (create_temp_file): Use fd_safer.
570         (xfclose): Don't assume fileno (stdin) == STDIN_FILENO, etc.
571         * src/split.c: Include unistd-safer.h.
572         (cwrite): Use fd_safer.  Replace mystery constant 0666 with symbolic
573         version, as POSIX requires.
574         * src/sum.c (bsd_sum_file, sysv_sym_file):
575         Use same pattern as elsewhere for checking for stdin.
576         * src/tac.c: Include unistd-safer.h.
577         (copy_to_temp): Use fd_safer.
578         (tac_file): Don't assume fopen cannot return stdin.
579         * src/tail.c: Include unistd-safer.h rather than fcntl-safer.h.
580         (recheck, tail_file): Use fd_safer rather than open_safer.
581         * src/tee.c: Include stdio-safer.h.
582         (tee): Use fopen_safer.
583         * src/touch.c: Include unistd-safer.h.
584         (touch): Use fd_safer.
585         * src/tsort.c (have_read_stdin): Remove; no longer needed.  All uses
586         removed.
587         (tsort): Do not assume fopen can't return stdin.
588         Close stdin before returning.  All uses changed.
589         * src/unexpand.c (next_file): Don't assume fopen cannot return stdin.
590         * src/uniq.c: Include stdio_safer.h.
591         (check_file): Don't assume fopen cannot return stdin or stdout.
592
593 2005-04-09  Jim Meyering  <jim@meyering.net>
594
595         * src/dd.c (quit): Define with ATTRIBUTE_NORETURN.
596
597         Now that close_stdout closes standard output unconditionally,
598         these workarounds for dd and cat are no longer necessary.
599         * src/dd.c (close_stdout_wrapper): Remove function.
600         (main): Call atexit with close_stdout, instead.
601         * src/cat.c (close_stdout_wrapper): Likewise.
602         Don't close STDOUT_FILENO explicitly; close_stdout does it.
603
604         * src/system.h (__attribute__): Readability nit:
605         Change this:
606         #  define __attribute__(x)
607         to this:
608         #  define __attribute__(x) /* empty */
609
610 2005-04-09  Jim Meyering  <jim@meyering.net>
611
612         * src/rm.c (usage): Mention that --recursive removes listed
613         directories too, not just their contents.
614         Say that by default, rm does not remove directories.
615
616         * src/pr.c: Don't include "timespec.h".  system.h does that.
617         * Makefile.maint (sc_system_h_headers): Propagate exit status
618         through trap.
619
620 2005-04-08  Paul Eggert  <eggert@cs.ucla.edu>
621
622         * NEWS: Document that dd no longer treats QUIT or PIPE specially,
623         and when conforming to POSIX no longer treats USR1 specially.
624         Document that dd no longer dumps core when handling signals.
625         * src/system.h (RETSIGTYPE): Remove; no longer needed.  All uses
626         replaced with void.
627         * src/csplit.c (SA_NOCLDSTOP): Define to 0 if not defined.
628         All uses changed.
629         (siginterrupt) [!HAVE_SIGINTERRUPT]: New macro.
630         (delete_all_files): New arg IN_SIGNAL_HANDLER, to avoid undefined
631         behavior when called from a signal handler.  All uses changed.
632         (main) [!defined SA_NOCLDSTOP]:
633         Use siginterrupt to specify that system calls should be interrupted.
634         * src/dd.c: Do not include safe-read.h or full-write.h; no longer needed.
635         (process_signals): Add forward decl.
636         (SA_NOCLDSTOP, sigprocmask, sigset_t) [!defined SA_NOCLDSTOP]:
637         New macros.
638         (siginterrupt) [! HAVE_SIGINTERRUPT]: New macro.
639         (SA_NODEFER) [!defined SA_NODEFER]: New macro.
640         (SA_RESETHAND) [!defined SA_RESETHAND]: New macro.
641         (caught_signals, interrupt_signal, info_signal_count, catch_siginfo):
642         New vars.
643         (usage): Mention -USR1 versus -INFO.
644         (cleanup): Don't invoke print_stats; the caller must do it now.
645         All callers changed.
646         (quit): Process signals just before exiting.
647         (interrupt_handler): Simply record the signal and return.
648         (siginfo_handler): Simply increment the signal counter and return.
649         (install_handler): Remove, replacing with:
650         (install_signal_handlers, process_signals, iread, iwrite):
651         New functions.  All callers to safe_read and full_write replaced
652         by iread and iwrite.  All callers to install_handler replaced by
653         install_handlers.
654         * src/ls.c (SA_NOCLDSTOP): Define to 0 if not defined.
655         All uses changed.
656         (siginterrupt) [! HAVE_SIGINTERRUPT]: New macro.
657         (main) [! SA_NOCLDSTOP]: Use it.
658         * src/shred.c: Remove all uses of signals; modern hosts have
659         /dev/random and don't need this gorp.
660         Do not include signal.h.
661         (env, sigill_handler, isaac_seed_machdep): Remove.  All uses removed.
662         * src/sort.c (SA_NOCLDSTOP): Define to 0 if not defined.
663         All uses changed.
664         (siginterrupt) [! HAVE_SIGINTERRUPT]: New macro.
665         (main) [! SA_NOCLDSTOP]: Use it.
666
667         * src/dd.c: Do not include inttostr.h, no longer needed.
668         (print_stats, main): Rewrite and simplify formats to use PRIuMAX
669         instead of umaxtostr.
670         (print_stats): Work even in languages that have special
671         forms for two of things, for r_truncate and w_bytes.  We can't
672         fix delta_s in this way, since ngettext doesn't support floating-point.
673         (main): Rewrite to avoid casts.
674
675 2005-04-07  Jim Meyering  <jim@meyering.net>
676
677         Placate gcc-4's -Wuninitialized.
678         * src/md5sum.c (digest_check) [lint]: Initialize hex_digest to NULL.
679         * src/test.c (binary_operator) [lint]: Initialize lt and rt to 0.
680
681         * src/test.c (is_int, age_of, binop): Declare `char *' parameters to
682         be `const'.
683         (binop): Move function definition to precede first use so we can...
684         (binop): ...remove prototype.
685
686 2005-04-05  Paul Eggert  <eggert@cs.ucla.edu>
687
688         * man/Makefile.am (.x.1): Remove "COMMAND.td/" from examples.
689         * src/basename.c (usage): Add examples.
690         * src/cat.c (usage): Likewise.
691         * src/chgrp.c (usage): Likewise.
692         * src/chown.c (usage): Likewise.
693         * src/dirname.c (usage): Likewise.
694
695 2005-04-05  Jim Meyering  <jim@meyering.net>
696
697         * src/nice.c (usage): Mention that some shells provide a
698         built-in function by the same name.
699         * src/nohup.c (usage): Likewise.
700         * src/printenv.c (usage):Likewise.
701
702 2005-04-04  Dmitry V. Levin  <ldv@altlinux.org>
703
704         * src/tee.c (tee): When closing files, do not close stdout,
705         leave this job to close_stdout() instead.
706         * configure.ac (AC_CONFIG_FILES): Add tests/tee/Makefile.
707         * tests/Makefile.am (SUBDIRS): Add tee.
708         * tests/tee/Makefile.am: New file.
709         * tests/tee/.cvsignore: Likewise.
710         * tests/tee/{basic,dash}: New tee tests.
711
712 2005-04-04  Jim Meyering  <jim@meyering.net>
713
714         * src/echo.c (usage): Mention that some shells provide a
715         built-in function by the same name.
716         * src/kill.c (usage): Likewise
717         * src/printf.c (usage): Likewise.
718         * src/pwd.c (usage): Likewise.
719         * src/stat.c (usage): Likewise.
720         * src/test.c (usage): Likewise.
721         * src/true.c (usage):
722         * src/system.h (USAGE_BUILTIN_WARNING): New macro.
723
724         * man/echo.x: Remove `DESCRIPTION' section, now that --help includes it.
725         * man/printf.x: Likewise.
726         * man/pwd.x: Likewise.
727
728 2005-04-03  Jim Meyering  <jim@meyering.net>
729
730         * src/pr.c (main): Fix off-by-one error.
731         pr -$(perl -e 'print "0"x63 . 1') would write one byte beyond the
732         end of a malloc'd buffer.
733
734 2005-04-01  Jim Meyering  <jim@meyering.net>
735
736         * src/pr.c (main): Free column_count_string when done with it.
737
738         Don't let pr treat +1:-1 like +1:18446744073709551615.
739         * src/pr.c (strtoumax): Remove declaration.
740         (first_last_page): Use xstrtoumax in place of strtoumax,
741         so we don't interpret a negative page number (e.g., in an option
742         like --pages=1:-1) as valid.
743         * tests/pr/Test.pm (neg-page): Add a test for this.
744
745 2005-03-30  Paul Eggert  <eggert@cs.ucla.edu>
746
747         * src/pinky.c (short_pinky): Adjust to read_utmp signature change.
748         * src/uptime.c (uptime): New arg OPTIONS.  All uses changed.
749         * src/users.c (users): Likewise.
750         * src/who.c (who): Likewise.
751         * src/uptime.c (main): Check PIDs when invoked with zero arguments.
752         * src/users.c (main): Likewise.
753         * src/who.c (main): Likewise.  Also with two arguments.
754         Omit duplicate code in 2-arg case.
755         (UT_PID): Moved to ../lib/readutmp.h.
756
757 2005-03-29  Jim Meyering  <jim@meyering.net>
758
759         * src/system.h (ptr_align): Declare `ptr' parameter to be a
760         `const' pointer, since this function never writes through it.
761
762         * src/uname.c: Indent cpp directives to reflect nesting.
763
764 2005-03-28  Jim Meyering  <jim@meyering.net>
765
766         * src/seq.c (get_width_format) [HAVE_RINT && HAVE_MODF && HAVE_FLOOR]:
767         Add `void' to make this an ANSI-style function declaration.
768         * src/remove.c (ds_init): Likewise.
769         * src/pr.c (print_sep_string): Likewise.
770
771         * src/stty.c (speeds): Declare this array to be static.
772         * src/Makefile.am (sc_tight_scope): Adjust to catch any
773         new declarations like that of stty.c's `speeds'.
774
775         * src/system.h (GETOPT_HELP_OPTION_DECL): Use NULL, not `0'.
776         (GETOPT_VERSION_OPTION_DECL): Likewise.
777         * src/chown.c (long_options): Likewise.
778         * src/chgrp.c (long_options): Likewise.
779         * src/chmod.c (long_options): Likewise.
780         * src/cp.c (sparse_type_string, reply_args, decode_preserve_arg):
781         Likewise.
782         * src/chown-core.c (chopt_init): Likewise.
783         * src/comm.c (long_options): Likewise.
784         * src/copy.c (copy_reg): Likewise.
785         * src/csplit.c (extract_regexp): Likewise.
786         * src/cut.c (longopts): Likewise.
787         * src/date.c (time_spec_string): Likewise.
788         * src/df.c (find_mount_point, show_point): Likewise.
789         * src/expr.c (docolon): Likewise.
790         * src/fmt.c (long_options): Likewise.
791         * src/ls.c (time_style_args, indicator_style_args, long_options)
792         (format_args, sort_args, time_args, decode_switches)
793         (gobble_file): Likewise.
794         * src/md5sum.c (long_options): Likewise.
795         * src/mv.c (reply_args): Likewise.
796         * src/paste.c (longopts): Likewise.
797         * src/pinky.c (print_entry): Likewise.
798         * src/pr.c (long_options): Likewise.
799         * src/ptx.c (long_options, format_args): Likewise.
800         * src/readlink.c (longopts): Likewise.
801         * src/sort.c (long_options, mergefps): Likewise.
802         * src/stat.c (long_options): Likewise.
803         * src/tac.c (main): Likewise.
804         * src/tail.c (follow_mode_string): Likewise.
805         * src/touch.c (longopts, time_args): Likewise.
806         * src/uniq.c (delimit_method_string): Likewise.
807         * src/uptime.c (print_uptime): Likewise.
808         * src/who.c (print_user): Likewise.
809
810 2005-03-27  Jim Meyering  <jim@meyering.net>
811
812         * src/dcgen: Simplify further, clean up.
813         Add a standard-output-closing global destructor.
814         Require perl-5.002.
815         * src/wheel-gen.pl: Use the same global destructor as dcgen.
816
817 2005-03-26  Paul Eggert  <eggert@cs.ucla.edu>
818
819         * src/dcgen: Squeeze multiple blanks into one.  Output a simple
820         array of adjacent strings rather than a more complicated data
821         structure; this saves space in the dircolors executable.
822         * src/dircolors.c (parse_line): Use char *, not unsigned char *.
823         This avoids casts.
824         (dc_parse_stream, main): Avoid casts.
825         Adjust to simpler data structure generated by new dcgen.
826
827 2005-03-25  Eric Blake  <ebb9@byu.net>  (tiny change)
828
829         * src/ls.c (usage): Document usage of LS_COLORS.
830
831 2005-03-25  Paul Eggert  <eggert@cs.ucla.edu>
832
833         * src/dircolors.hin: Add "TERM cygwin".
834
835 2005-03-25  Jim Meyering  <jim@meyering.net>
836
837         * src/system.h (DECIMAL_DIGIT_ACCUMULATE): Reverse the sense of
838         the return value, and update callers:
839         * src/cut.c (set_fields): Update use of DECIMAL_DIGIT_ACCUMULATE.
840         * src/expand.c (parse_tab_stops, main): Likewise.
841         * src/split.c (main): Likewise.
842         * src/unexpand.c (parse_tab_stops, main): Likewise.
843         * src/uniq.c (main): Likewise.
844
845 2005-03-22  Jim Meyering  <jim@meyering.net>
846
847         * build-aux: New directory.  Renamed from config.
848         * configure.ac: Reflect renaming: config -> build-aux.
849         * Makefile.am (dist-hook): Likewise.
850         * Makefile.maint: Likewise.
851         * Makefile.cfg (cvs_files): Likewise.
852         * .x-sc_sun_os_names: Likewise.
853         * .x-sc_trailing_blank: Likewise.
854
855         * src/ls.c (get_funky_string): Use '\a', rather than 7, for
856         portability to EBCDIC hosts.
857
858 2005-03-20  Jim Meyering  <jim@meyering.net>
859
860         * src/pr.c (init_header): Add missing `%' in new format string.
861         (init_header): Use zero-filled `.%09d' format, not space-filled `.%9d'.
862
863 2005-03-19  Jim Meyering  <jim@meyering.net>
864
865         * src/Makefile.am (pr_LDADD): Now that pr uses gettime, add
866         $(LIB_CLOCK_GETTIME) to get the required -lrt on newer Linux systems.
867
868 2005-03-18  Paul Eggert  <eggert@cs.ucla.edu>
869
870         * NEWS: pr -D "FORMAT" now accepts the same formats that
871         date +"FORMAT" does.
872         * src/pr.c: Include strftime.h, timespec.h.
873         (init_header): Obtain and format nanosecond part of time stamp.
874
875         * NEWS: nohup now ignores the umask when creating nohup.out.
876         nohup now closes stderr if it is a terminal and stdout is closed.
877         * src/nohup.c (main): Likewise.  Be a little more paranoid about
878         return values; e.g., check for any negative return from open.
879         Assume free (NULL) works.
880         Close file descriptor leak when redirecting standard output to a file.
881
882 2005-03-17  Jim Meyering  <jim@meyering.net>
883
884         * src/cut.c (set_fields): Use DECIMAL_DIGIT_ACCUMULATE macro,
885         in place of functionally-equivalent code.
886         * src/expand.c (parse_tab_stops, main): Likewise.
887         * src/split.c (main): Likewise.
888         * src/unexpand.c (parse_tab_stops, main): Likewise.
889         * src/uniq.c (main): Likewise.
890         * src/od.c: Use VERIFY macro in place of an equivalent open-coded
891         declaration.
892         * src/system.h (VERIFY, VERIFY_EXPR, DECIMAL_DIGIT_ACCUMULATE):
893         New macros.
894
895         Before, this command would make uniq skip 11 fields and print
896         only the first line:
897         $ _POSIX2_VERSION=1 ./uniq -f1 -1 <(seq --format='1 %g' 2)
898         1 1
899         1 2
900         * src/uniq.c (main): Interpret `uniq -f1 -1' like `uniq -f1',
901         not like `uniq -f11'.
902
903 2005-03-15  Jim Meyering  <jim@meyering.net>
904
905         Both `pr -0' and e.g., `pr -03' would evoke `column count too large'.
906         `pr -0' should give a better diagnostic and `pr -03' should be
907         equivalent to `pr -3'.
908         * src/pr.c (parse_column_count): Change return type to void.
909         Call error (EXIT_FAILURE, ... for an invalid string.
910         (main): Allocate space for column_count_string using malloc.
911         Accumulate all old-style column-count digits before converting.
912         When the number of columns is specified via both old-style,
913         (e.g., -3), and a long option (--columns=5), ensure that only
914         the last one specified takes effect.
915         * tests/pr/Test.pm: Add tests for the above.
916
917 2005-03-15  Corinna Vinschen  <corinna@vinschen.de>  (tiny change)
918
919         * src/copy.c (copy_reg): Copy regular files in binary mode.
920
921 2005-03-14  Paul Eggert  <eggert@cs.ucla.edu>
922
923         * NEWS: Restate why ls limits time stamp lengths.
924
925 2005-03-12  Jim Meyering  <jim@meyering.net>
926
927         Add a little infrastructure to help prevent future bugs like the
928         one fixed below.
929         * src/stat.c (xstrcat): New function.
930         (print_statfs, print_stat): Add buf_len parameter and convert all
931         uses of strcat to xstrcat.  Update callers.
932         (print_it): Call print_func with buf_len parameter.
933
934         Invoking stat -c FMT with a lone format directive of %s, %f, %h, %s,
935         could cause a buffer overrun error.
936         * src/stat.c (print_it): Allocate 2 more bytes, to accommodate our
937         conversion of the stat %s format string to the longer printf %llu one.
938         Patch from Guochun Shi.
939
940 2005-03-11  Paul Eggert  <eggert@cs.ucla.edu>
941
942         * src/ls.c (TIME_STAMP_LEN_MAXIMUM): New constant.
943         (long_time_expected_width, print_long_format): Use it, to avoid
944         some possible denial-of-service attacks.
945         * NEWS: Document this.
946
947 2005-03-11  Jim Meyering  <jim@meyering.net>
948
949         Prompt once again for `mv -i A B' when A and B are hard links
950         to the same file.  This fixes a bug introduced by my 2003-04-04
951         (coreutils-5.0.1) change.  Reported by Thomas Wolff via Eric Blake.
952         * src/copy.c (abandon_move): New function, factored out of
953         copy_internal, now that this code is being used from two places.
954         (copy_internal): Perform the same interactive-related test for
955         whether it's alright to proceed and (usually) overwrite the
956         destination file.
957         * tests/mv/i-4: Add tests for the above.
958
959         Don't segfault for a very long date format string, e.g.,
960         ls -ld --time-style=+%99999999H .
961         * src/ls.c (long_time_expected_width): Use x2nrealloc, not alloca,
962         so format string abuse cannot provoke stack overflow.
963         (print_long_format): Likewise.
964
965         Don't segfault for a long header date string, e.g.,
966         echo a|pr -D +%9999999A
967         * src/pr.c (init_header): Use x2nrealloc, rather than alloca.
968         Don't bother with fixed-sized initial buffer;  always use x*alloc.
969
970         * src/pr.c (init_header): Use slightly clearer INT_BUFSIZE_BOUND
971         in place of equivalent INT_STRLEN_BOUND + 1.
972         * src/expr.c (tostring, printv): Likewise.
973
974 2005-03-09  Paul Eggert  <eggert@cs.ucla.edu>
975
976         * src/system.h: Include intprops.h.
977         (TYPE_SIGNED, TYPE_MINIMUM, TYPE_MAXIMUM, INT_STRLEN_BOUND): Remove;
978         they are now defined in intprops.h.
979
980 2005-03-09  Jim Meyering  <jim@meyering.net>
981
982         * TODO: Remove entry about named pipes.  It was fixed in 5.3.0.
983
984 2005-03-08  Paul Eggert  <eggert@cs.ucla.edu>
985
986         * src/date.c (usage): Redo to match recent documentation changes.
987         Don't bother documenting which usages are GNU extensions; the list
988         wasn't correct, and is better left to the printed manual anyway.
989
990 2005-03-06  Jim Meyering  <jim@meyering.net>
991
992         Factor out column-count processing.
993         * src/pr.c: Include "inttostr.h".
994         (parse_column_count): New function.
995         (main): Use the new function for both old-style, -9, and long,
996         --columns=-9, options.
997
998         * src/cksum.c: Remove `register' keyword.
999         * src/cut.c: Likewise.
1000         * src/dd.c: Likewise.
1001         * src/env.c: Likewise.
1002         * src/factor.c: Likewise.
1003         * src/fmt.c: Likewise.
1004         * src/fold.c: Likewise.
1005         * src/id.c: Likewise.
1006         * src/logname.c: Likewise.
1007         * src/ls.c: Likewise.
1008         * src/pr.c: Likewise.
1009         * src/printf.c: Likewise.
1010         * src/shred.c: Likewise.
1011         * src/sort.c: Likewise.
1012         * src/sum.c: Likewise.
1013         * src/test.c: Likewise.
1014         * src/tsort.c: Likewise.
1015         * src/uniq.c: Likewise.
1016         * src/wc.c: Likewise.
1017         * src/whoami.c: Likewise.
1018
1019 2005-03-01  Paul Eggert  <eggert@cs.ucla.edu>
1020
1021         * src/Makefile.am (nanosec_libs): Remove $(LIB_XANOSLEEP); no
1022         longer needed.
1023
1024 2005-03-01  Jim Meyering  <jim@meyering.net>
1025
1026         * src/copy.c (copy_internal): Change test of source type from
1027         !S_ISREG to S_ISLNK.  Reported by Paul Eggert in
1028         http://lists.gnu.org/archive/html/bug-coreutils/2004-10/msg00050.html.
1029
1030 2005-02-28  Jim Meyering  <jim@meyering.net>
1031
1032         * NEWS: Mention that xnanosleep fixes sleep failure on linux-2.6.8.1.
1033
1034 2005-02-21  Paul Eggert  <eggert@cs.ucla.edu>
1035
1036         * src/Makefile.am (dd_LDADD, shred_LDADD): Add $(LIB_GETHRXTIME).
1037         (nanosec_libs): Add $(LIB_XNANOSLEEP).  Needed for newer GNU/Linux
1038         hosts with clock_gettime.
1039
1040 2005-02-20  Paul Eggert  <eggert@cs.ucla.edu>
1041
1042         * NEWS: Describe user-visible change to dd.
1043         * src/Makefile.am (dd_LDADD, shred_LDADD, nanosec_libs):
1044         Remove $(LIB_CLOCK_GETTIME).  These functions now use
1045         gethrxtime instead.
1046         * src/dd.c: Include gethrxtime.h, xtime.h.
1047         (start_time): Now of type xtime_t, not struct timespec.
1048         (print_stats, main): Use gethrxtime rather than gettime.
1049         * src/ls.c (time): Remove obsolete decl.
1050         (get_current_time): gettimeofday always returns 0, so don't
1051         check its result.
1052         * src/shred.c: Include gethrxtime.h.
1053         (isaac_seed): Use gethrxtime rather than a mishmash.
1054         * src/touch.c (time): Remove obsolete decl.
1055
1056         * tests/misc/split-fail: Don't assume that the current host
1057         supports integers wider than 32 bits.  Fix comment typo.
1058         * tests/od/x8: Likewise.
1059
1060         * src/chown-core.c (enum RCH_status): Remove trailing comma,
1061         as it's not valid in standard C89.
1062
1063 2005-02-15  Jim Meyering  <jim@meyering.net>
1064
1065         * src/stat.c (human_fstype): Add case/definition for S_MAGIC_XFS
1066         so that file systems of type `xfs' are recognized as such.
1067         * src/fs.h: Regenerate.
1068         Reported by Bernd Eckenfels.
1069         * src/stat.c (human_fstype): Likewise for S_MAGIC_JFS/jfs.
1070         * src/fs.h: Regenerate.
1071         Reported by Andreas Schwab.
1072
1073         * src/nice.c (NZERO) [NZERO == 0]: Undefine and define to 20,
1074         to work around the invalid definition from Darwin 7.7.0.
1075         Test failure reported by Sébastien Maret.
1076
1077 2005-02-14  Paul Eggert  <eggert@cs.ucla.edu>
1078
1079         * src/sort.c (mergefps): Use binary search rather than linear one
1080         when comparing new line to lines already in main memory.
1081         Idea suggested by James Lemley.
1082
1083 2005-02-09  Jim Meyering  <jim@meyering.net>
1084
1085         * src/copy.c (valid_options): Add an assertion that
1086         not both hard_link and symbolic_link are set.
1087
1088 2005-02-08  Paul Eggert  <eggert@cs.ucla.edu>
1089
1090         * NEWS: Document stat -f -c %S, plus changes to default formats.
1091         * doc/coreutils.texi (stat invocation): Normalize terminology,
1092         capitalization, and sort order to match --help output.  Mention %c
1093         for file systems.  Add new -f -c format %S, and document %s versus %S;
1094         problem reported by Jeroen van Wolffelaar.
1095         * src/stat.c (usage): Likewise.
1096         (STATFS_FRSIZE): New macro.
1097         (print_statfs): Use it, for stat -f -c %S.
1098         (do_statfs): Change default formats to output %S.
1099
1100 2005-02-03  Paul Eggert  <eggert@cs.ucla.edu>
1101
1102         * src/system.h: Include "memrchr.h".
1103         (memrchr) [!HAVE_DECL_MEMRCHR]: Remove decl.
1104
1105 2005-02-02  Jim Meyering  <jim@meyering.net>
1106
1107         * tests/du/8gb: Also adjust the test (s/64/128/) to detect
1108         systems that don't support sparse files.
1109         Check for $2 -ge 128, rather than $2 = 128, in case
1110         there is a file system type that doesn't support sparse files,
1111         yet for which metadata takes up additional space.
1112         Both reported by Andreas Schwab.
1113
1114 2005-02-01  Eric Blake  <ebb9@byu.net>  (tiny change)
1115
1116         * tests/du/8gb: Create a larger test file, so we properly
1117         detect that sparse files can be created on NTFS under cygwin.
1118
1119 2005-01-30  Jim Meyering  <jim@meyering.net>
1120
1121         * src/head.c (elide_tail_bytes_pipe): Correct wording in diagnostic.
1122
1123         * src/stty.c: Remove unnecessary parentheses in all #if directives.
1124
1125 2005-01-29  Eric Blake  <ebb9@byu.net>  (tiny change)
1126
1127         * .cvsignore: Ignore config.cache and config.status.lineno.
1128         * src/stty.c [VSWTCH]: Some systems, like Cygwin, use VSWTC
1129         instead of VSWTCH, for use with CSWTCH.
1130
1131 2005-01-29  Eric Blake  <ebb9@byu.net>  (tiny change)
1132
1133         * tests/Makefile.am (.PHONY): Add check-root and root-hint.
1134         * tests/rwx-to-mode: Ignore ACL designation.
1135         * tests/setgid-check: Likewise.
1136         * tests/chown/separator: Quote user and group names.
1137
1138 2005-01-24  Jim Meyering  <jim@meyering.net>
1139
1140         * src/cp.c (usage): Merge the descriptions of --no-dereference and -P.
1141         Suggestion from Johan Boule.
1142
1143 2005-01-17  Eric Blake  <ebb9@byu.net>  (tiny change)
1144
1145         * src/Makefile.am (all_programs.list): Strip $(EXEEXT) and remove
1146         duplicates.
1147         * man/Makefile.am (all_programs): Revert previous patch; updated
1148         all_programs.list fixes this.
1149         (.x.1): No need to add $(EXEEXT).
1150
1151 2005-01-03  Corinna Vinschen  <corinna@vinschen.de>  (tiny change)
1152
1153         * src/system.h: Use S_BLKSIZE value for ST_NBLOCKSIZE where
1154         available.
1155
1156 2005-01-22  Jim Meyering  <jim@meyering.net>
1157
1158         * Makefile.maint (v_etc_file): The version string has moved to
1159         version-etc-fsf.c, search that new file, not version-etc.c.
1160
1161 2005-01-17  Paul Eggert  <eggert@cs.ucla.edu>
1162
1163         * tests/group-names: Use numeric group ids, not symbolic group names,
1164         since the latter can have shell metacharacters in them (e.g., spaces).
1165         Problem reported by Eric Blake.
1166         * tests/chgrp/basic: Assume groups are numeric, not symbolic.
1167         * tests/chgrp/deref: Likewise.
1168         * tests/chgrp/posix-H: Likewise.
1169         * tests/chgrp/recurse: Likewise.
1170
1171 2005-01-15  Jim Meyering  <jim@meyering.net>
1172
1173         * src/shred.c (isaac_seed) [HAVE_GETHRTIME]: #if-0 this block,
1174         because just calling gethrtime evokes an `illegal instruction'
1175         failure when compiled with Sun's c89 on Solaris 8 and 9.
1176         Reported by Nelson Beebe.
1177
1178         * src/shred.c (isaac_seed) [HAVE_GETHRTIME]: Don't call ISAAC_SEED
1179         twice with the same value of `t'.
1180         Replace nested #if-#else blocks with #if-#elif-#elif chain.
1181
1182 2005-01-14  Jim Meyering  <jim@meyering.net>
1183
1184         The test, tests/tail/f-1, failed on powerpc-apple-darwin7.7.0.
1185         * src/tail.c (IS_TAILABLE_FILE_TYPE): Adjust definition also to include
1186         sockets, since that's what you get when reading from a command-line-
1187         supplied pipe on Darwin 7.7.
1188         (IS_PIPE_LIKE_FILE_TYPE): Define.
1189         (main): Use new IS_PIPE_LIKE_FILE_TYPE rather than simply S_ISFIFO.
1190         Reported by Nelson Beebe.
1191         This same change is also required on NetBSD/sparc-1.5.
1192         Reported by Adrian Bunk.
1193
1194         * src/expr.c (toarith): Rewrite to detect/diagnose integer overflow,
1195         rather than suffering silently.
1196         Before, expr would silently overflow and wrap around:
1197           $ expr 9223372036854775808 = 0   # $(echo 2^63|bc)
1198           1
1199         Now it detects the problem and exits nonzero:
1200           $ ./expr $(echo 2^63|bc) = 0
1201           ./expr: 9223372036854775808: integer is too large
1202
1203         * tests/chown/separator (id_gn): Exit 77, not 1, for a test-framework
1204         failure, so that doesn't cause `make check' to stop.  Nelson Beebe
1205         reported that this test would fail with the diagnostic,
1206         `cannot find name for group ID 10', on one of his systems.
1207
1208 2005-01-13  Jim Meyering  <jim@meyering.net>
1209
1210         * src/test.c (is_int): Don't overflow when evaluating integer
1211         constants.  Before, ./test $(echo 2^64|bc) -eq 0 && echo FAIL
1212         would print `FAIL'.
1213
1214         * tests/Fetish.pm (run_tests): Add code (if-0'd out) to detect
1215         names of temporary files that would clash on 8.3 file systems.
1216         * tests/mk-script (validate): Likewise.
1217
1218 2005-01-12  Jim Meyering  <jim@meyering.net>
1219
1220         * tests/dd/skip-seek: Shorten test names to accommodate 8.3 systems.
1221
1222         * tests/tr/Test.pm (repeat-xC): Change test name from
1223         `repeat-Compl', to avoid 8.3 conflict with `repeat-compl'.
1224         Reported by Eric Blake.
1225         (repeat-000): Rename to `repeat-zeros' for the same reason.
1226
1227 2005-01-11  Jim Meyering  <jim@meyering.net>
1228
1229         * configure.ac: Update version to 5.3.1.
1230
1231 2005-01-11  Eric Blake  <ebb9@byu.net>
1232
1233         * src/Makefile.am (check-README, check-AUTHORS): Account for $(EXEEXT).
1234         * man/Makefile.am (all_programs): Account for $(EXEEXT).
1235
1236 2005-01-11  Jim Meyering  <jim@meyering.net>
1237
1238         * src/unexpand.c (add_tab_stop): Properly diagnose a tabstop list
1239         with decreasing values.
1240
1241         * src/expand.c (main): Likewise.
1242         * src/unexpand.c (main): Check for overflow in tabstop values
1243         specified via the obsolete form.  E.g., now this command fails:
1244         _POSIX2_VERSION=1 ./unexpand -$(echo '2^64+1'|bc)
1245         Before it would act like `_POSIX2_VERSION=1 ./unexpand -1'.
1246         * tests/unexpand/basic-1 (obs-ovflo): New test for this.
1247
1248 2005-01-10  Paul Eggert  <eggert@cs.ucla.edu>
1249
1250         Respond to POSIX interpretations about pathchk -p dated 2005-01-06.
1251         * NEWS: Document the changes.
1252         * doc/coreutils.texi (pathchk invocation): Likewise.
1253         * src/pathchk.c (PORTABILITY_OPTION): New constant.
1254         (longopts, usage, main, validate_file_name):
1255         Add support for new -P option.
1256         Reject empty file names (unless -p is not specified and the
1257         current system allows empty file names).
1258         Change --portability so that is now equivalent to -p -P.
1259         Don't test whether file name is too long, if it is known to exist.
1260         (no_leading_hyphen): New function.
1261         * tests/misc/pathchk1: Add tests for empty file names and
1262         pathchk -P.
1263
1264 2005-01-08  Jim Meyering  <jim@meyering.net>
1265
1266         * Version 5.3.0.
1267
1268         `pr --columns=N' was not equivalent to `pr -N' when also using
1269         either -s or -w.
1270
1271         * src/pr.c (main): Set `explicit_columns' for --columns=N,
1272         not just for -N.  This bug has existed since the introduction
1273         of the --columns=N option on 1998-08-15.
1274         * NEWS: Document this.
1275         * tests/pr/Test.pm (test_vector): For each -N test, automatically
1276         create a new test vector using --columns=N.
1277
1278 2005-01-07  Paul Eggert  <eggert@twinsun.com>
1279
1280         * src/pr.c (main): Check for column count overflow with
1281         usages like "pr -2147483648".
1282
1283 2005-01-07  Jim Meyering  <jim@meyering.net>
1284
1285         * src/pr.c (init_fps): Use xnmalloc, rather than xmalloc.
1286
1287 2005-01-06  Jim Meyering  <jim@meyering.net>
1288
1289         * README: List the precise HP-UX version numbers that are affected.
1290         Suggestion from Bob Proulx.
1291
1292         * Makefile.maint (sc_changelog): Specify find's `-maxdepth 2'
1293         predicate before `-name ChangeLog' to avoid a harmless warning
1294         from find-4.2.10.
1295
1296 2005-01-05  Jim Meyering  <jim@meyering.net>
1297
1298         * tests/help-version: Punt on the uptime test, since it fails when
1299         it can't get boot time, and I don't want that to stop `make check'.
1300
1301         * src/du.c (process_file): Evaluate exclusion rules against
1302         the entire file name, not just the last component.
1303         Reported by Robert Lindgren.
1304         * tests/du/exclude: Test for this.
1305         * NEWS: Document this.
1306
1307         Ensure that tests/Makefile.am's check-root actions stay up to date.
1308         * Makefile.maint (sc_root_tests): New rule.
1309         (syntax-check-rules): Add it to the list.
1310
1311 2005-01-04  Jim Meyering  <jim@meyering.net>
1312
1313         * man/shred.x: Change one-line summary to reflect that shred does
1314         not remove files by default.  Suggestion from Helen Faulkner in
1315         http://bugs.debian.org/288552
1316
1317         * README: Request VERBOSE=yes output when reporting test failures.
1318         Other minor changes.
1319
1320         * tests/Makefile.am (check-root): Update.
1321
1322 2005-01-03  Paul Eggert  <eggert@cs.ucla.edu>
1323
1324         * src/system.h: Undo previous change; we now use Autoconf.
1325
1326 2005-01-03  Jim Meyering  <jim@meyering.net>
1327
1328         * tests/stty/row-col-1: Don't set rows or columns to zero, to avoid
1329         a bug in the TIOCGWINSZ ioctl on at least Solaris5.9 systems.  Setting
1330         either (or both) to zero would succeed, but subsequent `stty size'
1331         would say `no size information for this device' due to the ioctl
1332         failing with EINVAL.
1333
1334         * src/system.h: If PRIdMAX, PRIoMAX, PRIuMAX, and PRIxMAX are
1335         not all defined and either ULONG_MAX or ULLONG_MAX is not defined,
1336         then fail at compile-time rather than let tools like od produce
1337         invalid results at run time.
1338
1339 2004-12-21  Jim Meyering  <jim@meyering.net>
1340
1341         * src/csplit.c (usage): Say the default names are `xx00, xx01, ...',
1342         not `xx01, xx02, ...'.
1343         Reported by Matt Kraai in http://bugs.debian.org/286605
1344
1345         * tests/misc/split-fail: Avoid spurious failure on x86 Solaris5.9
1346         when using c89.
1347
1348 2004-12-20  Paul Eggert  <eggert@cs.ucla.edu>
1349
1350         * src/split.c (usage): Mention default size.  Suggested by Dan Jacobson.
1351
1352 2004-12-19  Paul Eggert  <eggert@cs.ucla.edu>
1353
1354         * NEWS: Mention that one should eval "`dircolors`" rather than
1355         `dircolors`.
1356
1357 2004-12-17  Jim Meyering  <jim@meyering.net>
1358
1359         * tests/mv/hard-link-1: Rearrange to use newer trap-handling code,
1360         so temporary directories aren't left behind upon e.g., interrupt.
1361
1362 2004-12-16  Paul Eggert  <eggert@cs.ucla.edu>
1363
1364         * src/ls.c (print_dir): Use "%s: not listing already-listed
1365         directory", not "not listing already-listed directory: %s", to
1366         format already-listed directories, to be consistent with other
1367         diagnostics involving file names and colons.
1368
1369 2004-12-15  Jim Meyering  <jim@meyering.net>
1370
1371         * src/Makefile.am (__LDADD): Define, so that building `[' on
1372         Solaris still uses the -lgen library that it requires in order
1373         to get a definition of eaccess.
1374
1375 2004-12-14  Jim Meyering  <jim@meyering.net>
1376
1377         tac would exit immediately upon I/O or temp-file creation failure.
1378         Now it continues on, processing any remaining command line arguments.
1379
1380         * src/tac.c: Include quotearg.h.
1381         Use quotearg_colon in most diagnostics.
1382         (copy_to_temp): Rewrite not to exit upon I/O or temp-file-creation
1383         failure.  Before, this command (with /full/tmp being a full partition)
1384           TMPDIR=/full/tmp ./tac /proc/modules tac.c
1385         would exit immediately upon the write error while trying to copy
1386         non-seekable /proc/modules to the full partition.  Now it still
1387         reports the failure but continues on with the remaining file.
1388         (tac_nonseekable): Return false also if copy_to_temp fails.
1389         [DONT_UNLINK_WHILE_OPEN]: Add a FIXME comment explaining that
1390         using atexit like this is wrong.
1391         * NEWS: Document this.
1392         * tests/misc/tac-continue: New test for this.
1393         * tests/misc/Makefile.am (TESTS): Add tac-continue.
1394
1395         * tests/chown/basic: Add a few more tests.
1396
1397 2004-12-13  Paul Eggert  <eggert@cs.ucla.edu>
1398
1399         * src/ls.c (gobble_file): Change arg name to be command_line_arg
1400         rather than explicit_arg, for consistency with copy.c.
1401         (extract_dirs_from_files): Remove ignore_dot_and_dot_dot arg, since
1402         it is deducible from dirname arg.  All callers changed.
1403         (extract_dirs_from_files, print_dir, queue_directory):
1404         Add command_line_arg arg.  All callers changed.
1405         (struct pending): Add command_line_arg member.
1406         (main): Use NULL rather than 0 when appropriate.
1407         (set_exit_status, file_failure): New functions.
1408         (queue_directory): Store command_line_arg into new structure.
1409         (print_dir, gobble_file, get_link_name):
1410         Use file_failure to report problems in accessing files,
1411         so that the exit status is set consistently.
1412         (print_dir): Simplify readdir failure code yet again.
1413         If closedir fails, report "closing directory" rather than "reading
1414         directory" failure.
1415         (xstrcoll): Use set_exit_status to set status on failure.
1416         * tests/ls-2/tests (no-a-isdir-b): This now exits with status 2,
1417         not status 1.
1418
1419 2004-12-11  Jim Meyering  <jim@meyering.net>
1420
1421         Avoid a race condition vulnerability in chown, when used with
1422         --from=O:G and without the (-h) --no-dereference option.
1423         * src/chown-core.c (restricted_chown): New function.
1424         (change_file_owner): Call it.
1425         Reported by Ulrich Drepper.
1426         * NEWS: Mention this.
1427
1428 2004-12-09  Paul Eggert  <eggert@cs.ucla.edu>
1429
1430         * ls now exits with status 1 on minor problems, 2 if serious trouble.
1431         * NEWS: Document this.
1432         * src/ls.c (LS_MINOR_PROBLEM, LS_FAILURE): New constants.
1433         All uses of EXIT_FAILURE replaced with LS_FAILURE, unless
1434         specified below.
1435         (main): Initialize exit failure to LS_FAILURE.
1436         (print_dir, gobble_file, get_link_name, xstrcoll):
1437         Set exit status to LS_MINOR_PROBLEM if the failure is minor.
1438         (print_dir): Do not give up on entire directory merely because readdir
1439         returns EOVERFLOW.
1440         (usage): Explain exit status.
1441         * tests/help-version: ls and variants now exit with status 2
1442         on serious trouble.
1443
1444 2004-12-08  Paul Eggert  <eggert@cs.ucla.edu>
1445
1446         * NEWS: Document new UTC+HH:MM date syntax, and put date changes
1447         together.
1448
1449 2004-12-07  Paul Eggert  <eggert@cs.ucla.edu>
1450
1451         * src/factor.c (factor): Don't list 1 as a factor of 1.
1452         Problem reported by Thomas Folz-Donahue.
1453
1454 2004-12-06  Jim Meyering  <jim@meyering.net>
1455
1456         * tests/du/files0-from: Sanitize environment.
1457         Otherwise, e.g., BLOCKSIZE=k would cause a failure, and that
1458         setting is the default (exported from /etc/profile) on at least one
1459         NetBSD 1.6 system.
1460         * tests/du/no-deref: Likewise.
1461         * tests/cp/symlink-slash: Likewise.
1462         * tests/ls/symlink-slash: Likewise
1463
1464 2004-12-05  Jim Meyering  <jim@meyering.net>
1465
1466         * tests/tail/Test.pm (err-6) ["tail -c"]: Avoid test failure when
1467         _POSIX2_VERSION=199209 is in the environment, or when building on
1468         e.g., OpenBSD 3.2.
1469
1470 2004-12-04  Jim Meyering  <jim@meyering.net>
1471
1472         * NEWS: Mention cut's new --complement option.
1473
1474 2004-10-01  Paolo Bonzini  <bonzini@gnu.org>
1475
1476         * cut.c (complement, COMPLEMENT_OPTION): New.
1477         (longopts): Add --complement.
1478         (usage): Say not that -b, -c, and -f `print' fields,
1479         but rather that they `select' fields for printing.
1480         Describe the new --complement option.
1481         (mark_range_start): Extracted from set_fields.
1482         (print_kth): Support --complement.
1483         (compare_ranges): New function.
1484         (set_fields): Rewrite the part that populates range_start_ht,
1485         merging it with the part that populates printable_field.
1486         (main): Handle --complement.
1487
1488 2004-12-03  Paul Eggert  <eggert@cs.ucla.edu>
1489
1490         * src/tail.c (tail_file): Set errnum to -1 if the initial "tail"
1491         failed.  This works around an assertion failure reported by
1492         Roberto Nibali in:
1493         http://lists.gnu.org/archive/html/bug-coreutils/2004-12/msg00012.html
1494
1495 2004-12-02  Jim Meyering  <jim@meyering.net>
1496
1497         With using --color and with LS_COLORS saying not to color
1498         executables, don't stat every file.
1499         * src/ls.c (is_colored): New function.
1500         (gobble_file): Use it.
1501         (main): Use it here, in place of too-strict tests against NULL:
1502         if either ORPHAN or MISSING was set to 0 from LS_COLORS, the
1503         old test would fail.
1504
1505 2004-12-01  Paul Eggert  <eggert@cs.ucla.edu>
1506
1507         * src/comm.c (compare_files): Assume setlocale exists.
1508         * src/join.c (keycmp): Likewise.
1509         * src/seq.c (decimal_point): Treat like sort.  Now char.
1510         All uses changed.
1511         (main): Assume localeconv exists.  Use same code as sort.
1512         * src/sort.c (C_DECIMAL_POINT): Remove.  Use changed to '.'.
1513         Assume setlocale exists.
1514         (thousands_sep): Renamed from th_sep.
1515         (IS_THOUSANDS_SEP): Remove.  All uses replaced by comparisons.
1516         (NONZERO): Parenthesize use of arg.
1517         (numcompare): Avoid duplicate loads.  Use ISDIGIT as boolean, for
1518         consistency.  Avoid unnecessary negation by reversing
1519         fraccompare args.
1520         (main): Rewrite localeconv call to match seq.c.
1521         * src/system.h: Assume locale.h exists.
1522         (HAVE_SETLOCALE): Remove.
1523         * src/uniq.c (different): Assume setlocale exists.
1524
1525         * src/ls.c (sort_files): Minor cleanup.  Remove an unnecessary
1526         'volatile' on a local variable.  Rewrite to avoid unnecessary
1527         double-assignment to 'func' in the usual case where strcoll does
1528         not fail.
1529
1530 2004-11-30  Paul Eggert  <eggert@cs.ucla.edu>
1531
1532         * src/pinky.c (gethostname): Remove decl.
1533         (scan_entries): Use IS_USER_PROCESS instead of by-hand code.
1534         * src/uptime.c (print_uptime): Use IS_USER_PROCESS and
1535         UT_TYPE_BOOT_TIME instead of by-hand code.
1536         * src/users.c (list_entries_users): Use IS_USER_PROCESS
1537         instead of by-hand code.
1538         * src/who.c (USER_PROCESS, RUN_LVL, INIT_PROCESS, LOGIN_PROCESS,
1539         DEAD_PROCESS, BOOT_TIME, NEW_TIME, UT_TYPE_UNDEF, UT_TYPE): Remove.
1540         (IS_USER_PROCESS): Move to ../lib/readutmp.h.
1541         (UT_TYPE_RUN_LVL, UT_TYPE_INIT_PROCESS, UT_TYPE_LOGIN_PROCESS,
1542         UT_TYPE_DEAD_PROCESS, UT_TYPE_NEW_TIME): New macros.
1543         (gethostname): Remove decl.
1544         (list_entries_who, scan_entries): Use the new macros defined above,
1545         for consistency with pinky, uptime, and users.
1546
1547 2004-11-25  Paul Eggert  <eggert@cs.ucla.edu>
1548
1549         Fix problem reported by Scott S. Tinsley for HP-UX 11.11 using
1550         HP's ANSI C compiler.  Declaring int functions causes warnings on
1551         some modern systems and shouldn't be needed to compile on ancient
1552         ones.
1553         * src/copy.h (stat, lstat, rename): Remove decls.
1554         * src/install.c (stat): Remove decl.
1555         * src/ln.c (link, symlink): Remove decls.
1556
1557 2004-11-25  Jim Meyering  <jim@meyering.net>
1558
1559         * man/help2man: Import help2man-1.35.1.
1560         * man/Makefile.am (.x.1): Remove now-unnecessary use of
1561         locally-added --program-name=NAME option.  Now, help2man gets
1562         the name from the [NAME] section (i.e. from our .x file).
1563         * man/install.x: Use `install', not `ginstall' in the one-line
1564         description.  Reported by Brendan O'Dea.
1565         * man/sha1sum.x: Use `sha1sum', not `shasum'.
1566
1567 2004-11-24  Jim Meyering  <jim@meyering.net>
1568
1569         Since the changes of 2004-05-22, the u.saved_cwd member at
1570         the bottom of the active-directory stack was no longer
1571         strictly necessary.  This change removes that member and uses
1572         the newer cwd_state parameter for the final restore_cwd.
1573
1574         * src/remove.c (struct AD_ent) [u]: Remove now-unnecessary union.
1575         [dev_ino]: Rename from `a'.
1576         (AD_pop_and_chdir): Add a parameter to play the role of just-removed
1577         bottom-of-stack cwd-state member.
1578         (AD_pop_and_chdir): No longer return boolean.  Adjust caller.
1579         (AD_push_initial): Remove CWD parameter.  Adjust caller.
1580
1581 2004-11-23  Paul Eggert  <eggert@cs.ucla.edu>
1582
1583         Minor performance improvements and cleanups for "touch".
1584         * src/touch.c (posix_date): Remove; not needed as a static var.
1585         All uses rewritten.
1586         (touch): Use new futimens function to operate more efficiently
1587         in some cases.  Don't stat/fstat existing file when
1588         (!amtime_now && change_times == (CH_ATIME | CH_MTIME)); the
1589         old time stamps aren't needed in that case.
1590         (main): change_times is int, not bool.  Simplify test for
1591         change_times.
1592
1593 2004-11-20  Paul Eggert  <eggert@cs.ucla.edu>
1594
1595         * src/install.c (usage): Avoid usage that runs afoul of Docbook
1596         translation.  Problem reported by Eric S. Raymond.
1597
1598         Restore dd's noctty flag, reverting the change of 2004-04-08.
1599         POSIX does not allow "dd" to use O_NOCTTY by default.
1600         * NEWS: Add noctty flag to dd.
1601         * doc/coreutils.texi (dd invocation): Likewise.
1602         * src/dd.c (flags, usage, main): Likewise.
1603
1604 2004-11-19  Alfred M. Szmidt  <ams@gnu.org>
1605
1606         * src/ls.c (usage): Clarified description of --no-group (-G),
1607         --human-readable (-h), --inode (-i), --size (-s), --time,
1608         and --time-style.
1609
1610 2004-11-19  Jim Meyering  <jim@meyering.net>
1611
1612         * src/ls.c (usage): Clarify description of --author.
1613         Tweak indentation so that help2man creates better nroff.
1614         Reported by Dan Jacobson.
1615
1616         * src/uniq.c (check_file): Don't check stdout for errors here.
1617
1618         * src/pwd.c (find_dir_entry): Update comment to match reality.
1619
1620 2004-11-18  Jim Meyering  <jim@meyering.net>
1621
1622         * src/pwd.c (robust_getcwd): Correct the comment: this function
1623         constructs the directory name.  The caller prints it.
1624
1625 2004-11-16  Paul Eggert  <eggert@cs.ucla.edu>
1626
1627         * src/stat.c (STATFS): New macro, for portability to Solaris 9.
1628         (do_statfs): Use it.
1629
1630         * src/basename.c, src/chroot.c, src/cksum.c, src/dd.c, src/dirname.c,
1631         src/factor.c, src/hostid.c, src/hostname.c, src/link.c, src/logname.c,
1632         src/nohup.c, src/printenv.c, src/pwd.c, src/setuidgid.c, src/sleep.c,
1633         src/sync.c, src/tsort.c, src/unlink.c, src/uptime.c, src/users.c,
1634         src/whoami.c, src/yes.c (main): Use getopt_long rather than getopt.
1635         * src/readlink.c (main): argv is not const.
1636
1637         * src/cut.c (usage): Improve documentation along the lines suggested
1638         by Debian 5.2.1-2.
1639         * src/echo.c (usage): Likewise.
1640         * src/expr.c (usage): Likewise.
1641
1642         * src/dircolors.hin: Add putty, screen-bce.
1643
1644         * src/pinky.c (print_entry): Fix memory leak.
1645         * src/who.c (print_user): Likewise.
1646
1647 2004-11-15  Paul Eggert  <eggert@cs.ucla.edu>
1648
1649         * NEWS: New dd operand "status=noxfer".
1650         * src/dd.c (C_ASCII, C_EBCDIC, C_IBM, C_BLOCK, C_UNBLOCK,
1651         C_LCASE, C_UCASE, C_SWAB, C_NOERROR, C_NOTRUNC, C_SYNC, C_TWOBUFS,
1652         C_NOCREAT, C_EXCL, C_FDATASYNC, C_FSYNC): Now constants, not
1653         macros.
1654         (STATUS_NOXFER, statuses): New constants.
1655         (usage, print_stats, scanargs): Add support for status=noxfer.
1656         (usage): Update status output to match new behavior.
1657         (print_stats): Always output complete byte count.
1658         Put space between numbers and units, as SI requires.
1659         Use ngettext so that i18n can use plurals for "byte" and "second".
1660         Don't multiply by 1e-9 (inexact); divide by 1e9 (which is exact).
1661         (iflag_error_msgid, oflag_error_msgid): Remove; replace uses by
1662         the string.
1663         * tests/dd/skip-seek (@Tests): Use status=noxfer to avoid
1664         problems with regression testing.
1665
1666 2004-11-14  Paul Eggert  <eggert@cs.ucla.edu>
1667
1668         * NEWS: dd now outputs total bytes, seconds, and bytes per second.
1669         * src/Makefile.am (dd_LDADD): Add $(LIB_CLOCK_GETTIME).
1670         * src/dd.c: Include "human.h".
1671         (w_bytes, start_time): New vars.
1672         (usage): Document new I/O statistics output
1673         (print_stats): Output new I/O statistics.
1674         (cleanup): Do statistics after closing stdin and stdout, so that
1675         the times are more accurate.
1676         (write_output, dd_copy): Count output bytes.
1677         (main): Get initial value of clock.
1678
1679 2004-11-14  Jim Meyering  <jim@meyering.net>
1680
1681         Backslash-escape `-'s in email addresses, so that they are
1682         rendered properly in UTF-locales.
1683         * man/help2man (escape_hyphens): New function.
1684         (main): Call it on email addresses.
1685
1686         * src/sort.c (zaptemp): Mark new diagnostic for translation.
1687
1688         * tests/misc/close-stdout: New file.  Test today's closeout.c change.
1689         * tests/misc/Makefile.am (TESTS): Add close-stdout.
1690
1691 2004-11-13  Jim Meyering  <jim@meyering.net>
1692
1693         * src/test.c (usage): Put the description of `[-n] STRING'
1694         on two lines, one for `-n STRING' and one for `STRING' so that
1695         help2man properly escapes the `-'.  Otherwise, the hyphen is
1696         rendered inappropriately in UTF-8 locales.
1697         Reported by Uwe Zeisberger in http://bugs.debian.org/281069.
1698
1699 2004-11-12  Paul Eggert  <eggert@cs.ucla.edu>
1700
1701         * NEWS: Document the following changes.
1702
1703         * src/sort.c: Avoid O(N**2) behavior when there are many temporary
1704         files.
1705         (temptail): New variable, so that we can easily append to list.
1706         (create_temp_file): Create new files at end of list, so that
1707         searching the list has O(N*NMERGE) behavior instead of O(N**2).
1708         (zaptemp): Update temptail if needed.
1709         (mergefps, merge): Accept new arg that counts temp files, and keep it
1710         up to date as we create and remove temporaries.  This is for
1711         efficiency, so that we don't call zaptemp so often.
1712         All callers changed.
1713         (sort): Don't create array in reverse order, since the list of
1714         temporaries is now in the correct order.
1715
1716         (zaptemp): Protect against race condition: if 'sort' is
1717         interrupted in the middle of zaptemp, it might unlink the
1718         temporary file twice, and the second time this happens the file
1719         might already have been created by some other process.
1720
1721         (zaptemp): Warn if a temporary file is not removed.
1722
1723         (create_temp_file): Use offsetof for clarity.
1724         (die): Move it up earlier, to clean up the code a bit.
1725
1726         * src/pr.c (strtoumax): Declare if not declared.
1727         (skip_to_page, first_page_number, last_page_number, page_number,
1728         first_last_page, print_header):
1729         Use uintmax_t for page numbers.
1730         (first_last_page): Remove unnecessary forward declaration.
1731         Do not modify arg (it is now a const pointer).
1732         Return a true if successful, false (without print a diagnostic)
1733         otherwise.
1734         (main): If +XXX does not specify a valid page range, treat it
1735         as a file name.  This follows the response to Open Group XCU ERN 41
1736         <http://www.opengroup.org/sophocles/show_mail.tpl?source=L&listname=austin-group-l&id=7717>,
1737         which says the behavior is allowed.
1738         (skip_to_page): When starting page number exceeds page count,
1739         print both numbers in the diagnostic.
1740         (print_header): Detect page number overflow.
1741
1742 2004-11-07  Jim Meyering  <jim@meyering.net>
1743
1744         * src/uname.c [__APPLE__]: Include <mach/machine.h> and <mach-o/arch.h>.
1745         (main) [__APPLE__]: Get the processor type via syscall rather than
1746         hard-coding "powerpc".  From Toby Peterson.
1747
1748         * src/sort.c (merge): Remove declarations of now-unused variables.
1749
1750 2004-11-06  Paul Eggert  <eggert@cs.ucla.edu>
1751
1752         * src/sort.c (first_same_file): Remove.  Move most of the code to....
1753         (avoid_trashing_input): New function.
1754         (merge): Avoid some silly merges, e.g., copying a single file to
1755         a temporary file when there are exactly 17 input files to merge.
1756         Take a count of temporary files rather than a max_merge arg.
1757         All uses changed.
1758
1759 2004-11-06  Jim Meyering  <jim@meyering.net>
1760
1761         * src/sort.c (xfclose): Don't close stdout here (just flush it),
1762         since close_stdout now closes stdout unconditionally.
1763
1764 2004-11-05  Paul Eggert  <eggert@cs.ucla.edu>
1765
1766         * src/sort.c (inittables, sort_buffer_size, getmonth, mergefps,
1767         first_same_file, merge, sort, main): Use size_t for indexes to arrays.
1768         This fixes some unlikely havoc-wreaking bugs (e.g., more than INT_MAX
1769         temporary files).
1770         (getmonth, keycompare, compare): Rewrite to avoid need for alloca,
1771         thus avoiding unchecked stack overflow in some cases.  As a side
1772         effect this improve the performance of "sort -M" by a factor of 4
1773         on my benchmarks.
1774
1775 2004-11-03  Paul Eggert  <eggert@cs.ucla.edu>
1776
1777         * src/stty.c: Include "vasprintf.h" since we use vasprintf now.
1778
1779         * src/Makefile.am (check-AUTHORS): Don't assume \? works in a sed
1780         expression; it's not portable.  Problem reported by Albert Chin.
1781         Don't invoke a program more than once.
1782         * src/groups.sh (version): New variable, containing author info,
1783         for benefit of AUTHORS check.  Use it when acting on --version option.
1784         * AUTHORS: Remove duplicate lines.  Remove bogus "chroot:"
1785         in groups line.
1786
1787         * src/system.h: Don't #define and #undef getopt around <stdlib.h>,
1788         as this breaks the new regime that does "#define getopt rpl_getopt".
1789         Problem reported by Albert Chin for Solaris 9 with Sun cc in:
1790         http://lists.gnu.org/archive/html/bug-gnulib/2004-11/msg00019.html
1791         I suppose this may cause problems on ancient hosts with
1792         incompatible getopt declarations, but we'll cross that bridge if
1793         the problem gets reported to us by someone who can test the fix.
1794
1795 2004-11-03  Jim Meyering  <jim@meyering.net>
1796
1797         * src/tac.c: quote(...) file names in diagnostics.
1798
1799 2004-10-29  Paul Eggert  <eggert@cs.ucla.edu>
1800
1801         * NEWS: Document getdate changes.
1802
1803 2004-10-29  Jim Meyering  <jim@meyering.net>
1804
1805         * src/tac.c (tac_file): Remove temporary prototype and move this
1806         function `down' so that it precedes definition of tac_nonseekable.
1807
1808         `tac /proc/modules' would print nothing
1809         Reported by Harald Dunkel in http://bugs.debian.org/278604.
1810
1811         * src/tac.c (copy_to_temp): Renamed from save_stdin, since
1812         now it copies a general file descriptor, not just stdin.
1813         (tac_nonseekable): Renamed/adapted from tac_stdin.
1814         (tac_file): Get fd via `open' directly rather than via fopen/fileno,
1815         since we never used the stream.  Perform "-" to stdin mapping here
1816         rather than in main.  Determine whether a file is seekable,
1817         by trying to `lseek' to its end, and dispatch to tac_seekable or
1818         tac_nonseekable accordingly.
1819         (main): Rewrite argument handling now that it uses only tac_file.
1820         * NEWS: Mention it here.
1821
1822 2004-10-21  Jim Meyering  <jim@meyering.net>
1823
1824         * tests/mv/leak-fd: New file.
1825         * tests/mv/Makefile.am (TESTS): Add it.
1826         * tests/rm/dot-rel: New file.
1827         * tests/rm/Makefile.am (TESTS): Add it.
1828
1829         Correct my patch of 2004-10-18.
1830         * src/remove.c (rm): Destroy the saved_cwd here (via cwd_state),
1831         if necessary, not in remove_dir.  Otherwise, removing multiple
1832         `.'-relative nonempty directories no longer worked.
1833
1834 2004-10-20  Paul Eggert  <eggert@cs.ucla.edu>
1835
1836         * src/fmt.c (usage): Improve description of --prefix.
1837         Problem reported by Edward Welbourne.
1838
1839         * man/uniq.x: Change summary so that it doesn't imply that
1840         uniq writes to its input file.  Problem reported by
1841         Dan Jacobson.
1842
1843 2004-10-18  Jim Meyering  <jim@meyering.net>
1844
1845         Plug a leak that would cause a cross-device mv to fail when
1846         operating on too many command-line-specified nonempty directories.
1847         * src/remove.c (remove_dir): Destroy the `struct saved_cwd' on the
1848         top of the stack before returning.  This usually closes the file
1849         descriptor that was used to return to the original working directory.
1850         Reported by Cyril Bouthors in
1851         http://article.gmane.org/gmane.comp.gnu.core-utils.bugs/3048
1852         * NEWS: Mention it here.
1853
1854         * src/pathchk.c (validate_file_name): Give a more descriptive
1855         diagnostic when pathconf fails.  This also avoids an unwarranted
1856         warning from gcc-3.3.5 about a format not being a string literal.
1857
1858         * src/sleep.c (main): Remove declaration of unused local, c.
1859         * src/printenv.c (main): Likewise.
1860         * src/logname.c (main): Likewise.
1861         * src/uptime.c (main): Likewise, for optc.
1862         * src/tsort.c (main): Likewise, for opt.
1863
1864 2004-10-17  Paul Eggert  <eggert@cs.ucla.edu>
1865
1866         * AUTHORS: Add self to pathchk.
1867         * src/pathchk.c (AUTHORS): Add self.
1868         Change "path" to "file name" whenever possible.
1869         Remove usage comment, as it was a duplication of the code or doc.
1870         Include <wchar.h> if available.
1871         (mbrlen, mbstate_t) [! (HAVE_MBRLEN && HAVE_MBSTATE_T)]: Define.
1872         (NEED_PATHCONF_WRAPPER, PATH_MAX, PATH_MAX_FOR, NAME_MAX,
1873         pathconf_wrapper, portable_chars, dir_ok): Remove.
1874         (NAME_MAX_MINIMUM, PATH_MAX_MINIMUM): New macros.
1875         (pathconf, _PC_NAME_MAX, _PC_PATH_MAX): Define if nonexistent.
1876         (portable_chars_only): New arg FILELEN.
1877         Don't assume ASCII; we might be on an EBCDIC host.
1878         Don't assume unibyte locale in diagnostic.
1879         (component_start, component_len): New functions.
1880         (validate_file_name): Renamed from validate_path.  All uses changed.
1881         Pretty much a complete rewrite.
1882         Don't make copy of file arg.  Always append trailing slash to
1883         pathconf arg, just in case it's a symlink (this is pure paranoia;
1884         we don't know of any hosts where the trailing slash is required).
1885         Use size_t instead of long int when possible.
1886         Avoid need to call pathconf in most practical cases.
1887         Don't use euidaccess several times to test searchability;
1888         just use lstat once.  Reword diagnostic to put the (often very long)
1889         file names last.
1890
1891 2004-10-15  Paul Eggert  <eggert@cs.ucla.edu>
1892
1893         * src/printf.c (usage): Mention Unicode, and use H for hex digits.
1894
1895 2004-10-13  Jim Meyering  <jim@meyering.net>
1896
1897         * NEWS: Mention today's fts.c fix.
1898
1899 2004-10-13  Paul Eggert  <eggert@cs.ucla.edu>
1900
1901         * tests/stty/row-col-1: Set LC_ALL=C.
1902
1903 2004-10-12  Jim Meyering  <jim@meyering.net>
1904
1905         * src/dircolors.hin: Add .flac and .mpc as audio suffixes.
1906         From Jesus Climent in http://bugs.debian.org/276149.
1907
1908 2004-10-05  Paul Eggert  <eggert@cs.ucla.edu>
1909
1910         * src/ls.c (ignore_mode): Renamed from ignore, to avoid shadowing
1911         problems.  All uses changed.
1912
1913 2004-10-05  Jim Meyering  <jim@meyering.net>
1914
1915         * .x-sc_trailing_blank: Add an exclusion for config/texinfo.tex,
1916         since Karl says its trailing blanks are there to stay :-)
1917
1918 2004-10-04  Paul Eggert  <eggert@cs.ucla.edu>
1919
1920         * src/expr.c (NEW, OLD): Remove, partly to avoid
1921         reference to obsolescent macro XMALLOC.
1922         All uses replaced by xmalloc and free.
1923
1924 2004-09-28  Jim Meyering  <jim@meyering.net>
1925
1926         * src/tail.c (usage): Clarify: --retry works only with --follow=name.
1927         Reported by Nik A. Melchior in http://bugs.debian.org/273781.
1928
1929 2004-09-27  Paul Eggert  <eggert@cs.ucla.edu>
1930
1931         * src/od.c (format_address_paren): c is optional, so don't output
1932         it if it's '\0'.
1933
1934 2004-09-26  Paul Eggert  <eggert@cs.ucla.edu>
1935
1936         Add support for ls --hide.  Idea suggested by Bardur Arantsson.
1937         * NEWS: Document this.
1938         * src/ls.c (file_ignored): Renamed from file_interesting, with
1939         inverted return value.  Accept the file name, not a struct dirent *.
1940         All uses changed.  Avoid the expense of calling fnmatch if the
1941         file is ignorable due to leading '.'.
1942         (all_files, really_all_files): Removed; replaced by:
1943         (ignore): New variable.  All uses changed.
1944         (IGNORE_DEFAULT, IGNORE_DOT_AND_DOTDOT, IGNORE_MINIMAL, HIDE_OPTION):
1945         New constants.
1946         (hide_patterns): New variable.
1947         (long_options, decode_switches, file_ignored, usage):
1948         Add support for --hide.
1949         (patterns_match): New function.
1950         (usage): Replace "hide" with "ignore" in explanation, to avoid
1951         confusion.
1952
1953 2004-09-25  Paul Eggert  <eggert@cs.ucla.edu>
1954
1955         * src/ls.c (gobble_file, print_long_format): Don't assume that
1956         human-readable output has a byte count equal to its column width;
1957         this isn't always true in locales where the radix character is not
1958         '.' or ','.
1959         (format_user_or_group): Revamp code to match the above fix;
1960         this avoids the (very faint) possibility of integer overflow.
1961
1962 2004-09-24  Paul Eggert  <eggert@cs.ucla.edu>
1963
1964         * NEWS: Mention that "chmod -r -w x" now works as expected.
1965         * src/chmod.c (main): Revamp option processing to support this.
1966         * tests/chmod/Makefile.am (TESTS): Add 'usage'.
1967         * tests/chmod/usage: New set of tests for usage like that.
1968
1969 2004-09-24  Jim Meyering  <jim@meyering.net>
1970
1971         * Makefile.maint (CVS_LIST): Use --types=AFGM option so that
1972         it lists only cvs-controlled regular files.
1973
1974         * src/csplit.c (xalloc_die): Declare to be `extern', not `static'
1975         to avoid a warning from gcc-3.4.1.  Reported by Paul Eggert.
1976
1977 2004-09-23  Paul Eggert  <eggert@cs.ucla.edu>
1978
1979         * Makefile.maint (CVS_LIST): New macro.
1980         (sc_space_tab, sc_prohibit_atoi_atof, sc_file_system,
1981         sc_prohibit_jm_in_m4, sc_system_h_headers, sc_sun_os_names,
1982         sc_trailing_blank, po-check): Use it instead of the
1983         nonstandard "cvsu --list".
1984
1985         * src/tail.c (parse_obsolete_option): Bring back support
1986         for obsolete option followed by non-obsolete, or by more
1987         than one file.  When obsolete, conform to SUSv2 rather than
1988         original POSIX 1003.2-1992, as SUSv2 corrected the case of
1989         "tail -c".  Add support for the SUSv2 "b" modifier.
1990         * NEWS: Mention the above.
1991         * tests/tail/Test.pm: New test case obs-b to check the above.
1992         err-[134] no longer need _POSIX2_VERSION=199209.
1993         Fix comments to match revised behavior.
1994
1995 2004-09-22  Jim Meyering  <jim@meyering.net>
1996
1997         * Use automake-1.9.2.  Regenerate dependent files.
1998
1999         * src/remove.c (struct dirstack_state) [current_arg_jumpbuf]:
2000         Improve the comment.
2001
2002         Clean up scoping etc. so that some make `distcheck' tests pass.
2003         * src/csplit.c (xalloc_die): Declare to be static.
2004         * src/chown-core.c (chown_files): Declare as `extern'.
2005         * src/cp-hash.c (remember_created): Likewise.
2006         * src/copy.c (copy): Likewise.
2007         * src/checksum.h (enum) [ALG_MD5]: Define to be 1, not 0.
2008
2009         * src/id.c, src/nl.c, src/expand.c: Remove trailing blanks.
2010         * src/unexpand.c: Likewise.
2011
2012         * src/Makefile.am (check-AUTHORS): New rule.
2013         (check): Depend on it.
2014         * AUTHORS: Update.
2015
2016         * Makefile.maint (syntax-check-rules): Remove duplicate sc_tight_scope.
2017         (sc_system_h_headers): Also exclude copy.h; it includes <stdbool.h>.
2018
2019 2004-09-22  Paul Eggert  <eggert@cs.ucla.edu>
2020
2021         * src/ls.c (decode_switches): Don't compare a short value
2022         to SIZE_MAX: GCC sometimes complains.
2023
2024 2004-09-21  Paul Eggert  <eggert@cs.ucla.edu>
2025
2026         * NEWS: The following commands now reject unknown options:
2027         basename dirname factor hostname link nohup sync unlink yes
2028         Also, pathchk no longer accepts trailing options.
2029
2030         * src/basename.c: Include <getopt.h>.
2031         * src/chroot.c: Likewise.
2032         * src/dirname.c: Likewise.
2033         * src/factor.c: Likewise.
2034         * src/hostid.c: Likewise.
2035         * src/hostname.c: Likewise.
2036         * src/nohup.c: Likewise.
2037         * src/pwd.c: Likewise.
2038         * src/setuidgid.c: Likewise.
2039         * src/sync.c: Likewise.
2040
2041         * src/basename.c (main): Reject unknown options.
2042         * src/dirname.c (main): Likewise.
2043         * src/factor.c (main): Likewise.
2044         * src/hostid.c (main): Likewise.
2045         * src/hostname.c (main): Likewise.
2046         * src/link.c (main): Likewise.
2047         * src/nohup.c (main): Likewise.
2048         * src/pwd.c (main): Likewise.
2049         * src/setuidgid.c (main): Likewise.
2050         * src/sync.c (main): Likewise.
2051         * src/unlink.c (main): Likewise.
2052         * src/yes.c (main): Likewise.
2053
2054         * src/cat.c (main): Remove unused "case 0".
2055         * src/chgrp.c (main): Likewise.
2056         * src/chmod.c (main): Likewise.
2057         * src/chown.c (main): Likewise.
2058         * src/comm.c (main): Likewise.
2059         * src/cp.c (main): Likewise.
2060         * src/csplit.c (main): Likewise.
2061         * src/cut.c (main): Likewise.
2062         * src/date.c (main): Likewise.
2063         * src/df.c (main): Likewise.
2064         * src/du.c (main): Likewise.
2065         * src/env.c (main): Likewise.
2066         * src/expand.c (main): Likewise.
2067         * src/fold.c (main): Likewise.
2068         * src/head.c (main): Likewise.
2069         * src/id.c (main): Likewise.
2070         * src/install.c (main): Likewise.
2071         * src/join.c (main): Likewise.
2072         * src/ln.c (main): Likewise.
2073         * src/ls.c (decode_switches): Likewise.
2074         * src/mkdir.c (main): Likewise.
2075         * src/mkfifo.c (main): Likewise.
2076         * src/mknode.c (main): Likewise.
2077         * src/mv.c (main): Likewise.
2078         * src/nl.c (main): Likewise.
2079         * src/paste.c (main): Likewise.
2080         * src/pinky.c (main): Likewise.
2081         * src/pr.c (main): Likewise.
2082         * src/ptx.c (main): Likewise.
2083         * src/readlink.c (main): Likewise.
2084         * src/rm.c (main): Likewise.
2085         * src/rmdir.c (main): Likewise.
2086         * src/seq.c (main): Likewise.
2087         * src/shred.c (main): Likewise.
2088         * src/split.c (main): Likewise.
2089         * src/sum.c (main): Likewise.
2090         * src/tac.c (main): Likewise.
2091         * src/tail.c (main): Likewise.
2092         * src/tee.c (main): Likewise.
2093         * src/touch.c (main): Likewise.
2094         * src/tr.c (main): Likewise.
2095         * src/tty.c (main): Likewise.
2096         * src/uname.c (main): Likewise.
2097         * src/unexpand.c (main): Likewise.
2098         * src/wc.c (main): Likewise.
2099         * src/who.c (main): Likewise.
2100
2101         * src/chroot.c (main): Use getopt where it suffices, not getopt_long.
2102         * src/cksum.c (main): Likewise.
2103         * src/dd.c (main): Likewise.
2104         * src/logname.c (main): Likewise.
2105         * src/printenv.c (main): Likewise.
2106         * src/sleep.c (main): Likewise.
2107         * src/tsort.c (main): Likewise.
2108         * src/uptime.c (main): Likewise.
2109         * src/users.c (main): Likewise.
2110         * src/whoami.c (main): Likewise.
2111
2112         * src/du.c (long_options): Standardize on NULL vs 0.
2113         * src/rm.c (long_opts): Likewise.
2114
2115         * src/logname.c (long_options): Remove.
2116         * src/printenv.c (long_options): Likewise.
2117         * src/sleep.c (long_options): Likewise.
2118         * src/tsort.c (long_options): Likewise.
2119         * src/uptime.c (longopts): Likewise.
2120         * src/users.c (longopts): Likewise.
2121         * src/whoami.c (long_options): Likewise.
2122
2123         * src/pathchk.c (longopts): Add --help, --version.
2124         (main): Use longopts rather than parse_long_options.
2125         * src/stty.c (longpts, main): Likewise.
2126
2127         * src/pathchk.c (main): Don't reorder arguments, so that
2128         we can check weird file names.
2129
2130         * src/readlink.c: Don't include "long-options.h".
2131         * src/sort.c: Likewise.
2132         * src/stty.c: Likewise.
2133
2134         * src/split.c (verbose): Now bool, not int.
2135         (VERBOSE_OPTION): New enum.
2136         (longopts, main): Use it.
2137
2138         * tests/factor/basic: Adjust to new wording in diagnostic
2139         that results from the above changes.
2140
2141 2004-09-21  Jim Meyering  <jim@meyering.net>
2142
2143         * man/rm.x: Say "the response is affirmative" rather than "the
2144         response begins with y or Y", so that the documentation is
2145         accurate in non-English locales.  Problem reported by Munzir Taha.
2146
2147 2004-09-19  Paul Eggert  <eggert@cs.ucla.edu>
2148
2149         * src/echo.c (main): Don't pass NULL to strcmp when
2150         POSIXLY_CORRECT and given no arguments.
2151
2152         * src/md5sum.c (STRING_OPTION): Remove.
2153         (long_options, main): Remove support for undocumented and
2154         obsolete --string option, as suggested in the 1996-09-26 patch.
2155         * NEWS: Document this.
2156
2157         * tests/rm/fail-eperm: Don't try to remove writeable files in a
2158         sticky /tmp directory, as SVR4-like systems (e.g., Solaris 9) let
2159         you remove such files.  Problem reported by Bert Fischer in:
2160         http://lists.gnu.org/archive/html/bug-coreutils/2004-09/msg00074.html
2161
2162 2004-09-18  Paul Eggert  <eggert@cs.ucla.edu>
2163
2164         * src/md5sum.c (STATUS_OPTION, STRING_OPTION): New enums.
2165         (long_options, main): Use them instead of magic numbers 2 and 1.
2166         For --string, optarg can't possibly be NULL.
2167
2168         * src/dd.c (usage): Distinguish between options and operands.
2169         (scanargs): Don't mess with argc, argv; getopt_long handles this now.
2170         Say "operands" for operands, not "options".
2171         (main): Use getopt_long, so that "dd --" works as POSIX requires.
2172         * tests/dd/misc: Check for "dd --".
2173
2174         * src/chroot.c (main): Reject unknown options instead of
2175         interpreting them as a directory to chroot to.
2176
2177         * src/cksum.c: Remove obsolete comment about POSIX 1003.2/D11.2.
2178         The current standard (POSIX 1003.1-2004) is correct.
2179         (crc_remainder) [defined CRCTAB]: Renamed from "remainder" to avoid
2180         collision with builtin function.
2181         (main) [defined CRCTAB]: Output in lowercase hexadecimal, and
2182         output the first 0 as 8 digits, to make it easier to compare to
2183         the text of the standard.  Output crctab to be a const array.
2184         (crctab): Use result of above changes.
2185         (long_options): Remove; not needed if empty.
2186         (main): getopt_long can't return 0 here, so simplify the code.
2187
2188 2004-09-13  Jim Meyering  <jim@meyering.net>
2189
2190         * src/Makefile.am (localedir.h): Don't redirect directly to target.
2191
2192 2004-09-13  Paul Eggert  <eggert@cs.ucla.edu>
2193
2194         * src/id.c (print_full_info): Don't exit with failure status simply
2195         because a user or group number can't be turned into a name.
2196         Problem reported by Felipe Kellermann in:
2197         http://lists.gnu.org/archive/html/bug-coreutils/2004-09/msg00081.html
2198
2199 2004-09-12  Jim Meyering  <jim@meyering.net>
2200
2201         * Makefile.maint (my-distcheck): When building with -Werror, also
2202         require -Wshadow.
2203
2204 2004-09-10  Paul Eggert  <eggert@cs.ucla.edu>
2205
2206         * NEWS: "tail" now handles obscure POSIX 1003.2-1992 cases better.
2207         * src/tail.c (parse_obsolete_option): Renamed from
2208         parse_obsolescent_option, since the options are obsolete now.
2209         Remove bool *arg; just exit if there's an error.  Revamp to follow
2210         POSIX 1003.2-1992 more precisely, to handle cases like "tail -
2211         file" and "tail -10 -- file" correctly when we are conforming to
2212         the older standard.
2213         (main): Adjust to this change.
2214         * tests/tail/Test.pm (test_vector): minus-* requires
2215         _POSIX2_VERSION=199209 now, to work correctly if there is
2216         an input file.  err-1 and err-3 no longer errors if there
2217         is another file.
2218
2219 2004-09-09  Paul Eggert  <eggert@cs.ucla.edu>
2220
2221         * src/test.c (usage): Document -r, -w, -x more carefully.
2222
2223 2004-09-08  Paul Eggert  <eggert@cs.ucla.edu>
2224
2225         * src/test.c (usage): Document "test" (with no args) and "[ ]".
2226         Document that -h and -L don't dereference.
2227
2228         * NEWS: Document that "tr xy -z" now works as per POSIX.
2229         Sort the descriptions.
2230         * src/tr.c (main): Don't reorder options.
2231         * tests/tr/Test.pm (fowler-1): New test case.
2232
2233 2004-09-06  Paul Eggert  <eggert@cs.ucla.edu>
2234
2235         * src/touch.c (main): Fix POSIX-conformance bug: "touch --
2236         MMDDhhmm file" must be treated like "touch MMDDhhmm file" when
2237         conforming to pre-2001 POSIX.
2238         * NEWS: Document this.
2239         * tests/touch/obsolescent: Test for this bug.  Also, set
2240         _POSIX2_VERSION=199209 and POSIXLY_CORRECT=1 so that it's
2241         a better test for obsolescent features.
2242
2243         * src/sort.c (main): Emulate Solaris 8 and 9 "sort -y", so that
2244         "sort -y abc" is like "sort abc" whereas "sort -y 100" is like
2245         plain "sort".
2246
2247         * src/od.c: Several changes for POSIX and FreeBSD compatibility.
2248         (COMMON_SHORT_OPTIONS): Add -B, -D, -e, -F, -H, -I, -L, -O, -s, -X.
2249         (long_options, main): --strings is now -S, not -s.
2250         (usage): Reflect the usage changes.
2251         (parse_old_offset): Do not issue a diagnostic on failure;
2252         callers now do this as necessary.
2253         (main): Support POSIX syntax.  Remove unused case 0 from getopt_long.
2254         Add support for new short options (many undocumented) for
2255         compatibility with FreeBSD.  Remove FIXME for -s; it's now
2256         POSIX-compatible.  Default format is now oS, not o2.
2257         * NEWS: Describe the above.
2258
2259 2004-09-05  Paul Eggert  <eggert@cs.ucla.edu>
2260
2261         * src/stty.c (valid_options): Remove.
2262         (main): Fix some bugs in handling invalid option-combinations
2263         like "stty -F".
2264         (recover_mode): Arg is now char const *, not char *.
2265         (main): Use STDIN_FILENO, not 0.
2266         Simplify option-parsing code a tad.
2267         * tests/stty/basic-1: Check for the fixed bugs.
2268
2269 2004-09-03  Paul Eggert  <eggert@cs.ucla.edu>
2270
2271         * src/stat.c (HAVE_STRUCT_STATXFS_F_TYPE): Fix typo that prevented
2272         it from ever being nonzero.  Reported by Pozsar Balazs in:
2273         http://lists.gnu.org/archive/html/bug-coreutils/2004-08/msg00189.html
2274         (human_fstype): Add ramfs, squashfs, sysfs.
2275         Reported by Pozsar Balazs in:
2276         http://lists.gnu.org/archive/html/bug-coreutils/2004-08/msg00188.html
2277         (human_fstype): Return char const *, not char *.
2278         Simplify internals a bit, and avoid casts.
2279
2280         * src/dd.c (usage): "alternated EBCDIC" -> "alternate EBCDIC".
2281         (bit_count): Remove.  All uses changed to....
2282         (multiple_bits_set): New function.
2283         (scanargs): Use it, and check separately for each set of
2284         incompatible options, to improve diagnostics.
2285         (MX): Remove.
2286         (apply_translations): Move checks for incompatible options
2287         to scanargs, so that they're done consistently.
2288
2289 2004-09-02  Paul Eggert  <eggert@cs.ucla.edu>
2290
2291         Output correct errno-related diagnostic on "paste" I/O errors.
2292         * src/paste.c (write_error, xputchar): New functions.
2293         (paste_parallel): Use correct errno value after input error.
2294         (paste_parallel, paste_serial): Report errno value after output error.
2295
2296         Port to diet libc.  Problem reported by Felix von Leitner in:
2297         http://lists.gnu.org/archive/html/bug-coreutils/2004-08/msg00171.html
2298         * src/paste.c (dummy_closed, CLOSED, dummy_endlist, ENDLIST): Remove;
2299         it's not portable C to assume FILE is a complete type.
2300         (paste_parallel): Use index test instead of ENDLIST, and NULL
2301         instead of CLOSED.
2302
2303 2004-08-24  Paul Eggert  <eggert@cs.ucla.edu>
2304
2305         POSIX-conformance fixes for "expand" and "unexpand".
2306         Also, consistently use "tab stop" rather than "tabstop".
2307         * NEWS: Document fixes.
2308         * src/expand.c: Revamp to resemble the new unexpand.c better.
2309         (usage): -i does not convert tabs after non-tabs.
2310         (add_tab_stop): Renamed from add_tabstop.  All uses changed.
2311         (parse_tab_stop): Renamed from parse_tabstop.  All uses changed.
2312         (validate_tab_stop): Renamed from validate_tabstop.  All uses changed.
2313         (next_file, main): Check fclose against 0, not EOF.
2314         (expand): Remove unnecessary casts.
2315         Add another loop nesting level, for lines, so that per-line variables
2316         are initialized cleanly.
2317         Revamp tab checking.  Check for write error immediately, rather
2318         than just once at the end of the program.
2319         * src/unexpand.c: Lkewise (for the expand.c changes).
2320         (TAB_STOP_SENTINEL): Remove.
2321         (tab_size): Now size_t, not uintmax_t, since we need to store
2322         the sequences of blanks.
2323         (max_column_width): New var.
2324         (usage): Say "blank" where POSIX requires this.
2325         (add_tab_stop): Calculate maximum column width.
2326         (unexpand): Store the pending blanks, instead of merely counting them.
2327         Follow POSIX's rules about -a requiring two blanks before a tab stop.
2328         Get rid of internal label and goto.
2329         * tests/unexpand/basic-1: Fix infloop-3 to match POSIX.
2330         Add blanks-1 through blanks-13.
2331
2332 2004-08-19  Paul Eggert  <eggert@cs.ucla.edu>
2333
2334         * NEWS: "chown : file", "chown '' file", and "chgrp '' file" now
2335         succeed without changing the uid and gid, like FreeBSD.
2336         * src/chgrp.c (parse_group): Return gid_t rather than storing it
2337         through a pointer.  Treat "chgrp '' file" as a no-op change,
2338         as FreeBSD does.
2339         (main): Set chopt.group_name to NULL if the group is the empty
2340         string.
2341         * src/chown-core.c (describe_change): Describe changes to -1:-1
2342         without using "to OWNERSHIP" phrase.
2343         * src/chown.c (usage): "chown '' file" is now allowed.
2344         (main): Do not set user name to the empty string if the group
2345         name is null.
2346         * tests/chgrp/basic: Test "chgrp '' file".
2347         * tests/chown/Makefile.am (TESTS): Add separator.
2348         * tests/chown/separator: New file, partly taken from
2349         Dmitry V. Levin's suggestion in
2350         <http://lists.gnu.org/archive/html/bug-coreutils/2004-08/msg00102.html>
2351
2352 2004-08-11  Paul Eggert  <eggert@cs.ucla.edu>
2353
2354         * tests/install/basic-1: Test for the -d regression.
2355
2356 2004-08-11  Dmitry V. Levin  <ldv@altlinux.org>
2357
2358         * src/install.c (main): Fix -d regression introduced with
2359         --target-directory support at 2004-06-25.
2360
2361 2004-08-11  Paul Eggert  <eggert@cs.ucla.edu>
2362
2363         * src/copy.c (copy_internal): When preserving links, unlink
2364         a destination with link count greater than one.  This is so
2365         that commands like "cp -a" don't get confused when copying into
2366         a destination that already contains many hard links.  Problem
2367         reported by Tim Waugh in:
2368         http://lists.gnu.org/archive/html/bug-coreutils/2004-08/msg00053.html
2369
2370 2004-08-10  Paul Eggert  <eggert@cs.ucla.edu>
2371
2372         Convert all files to UTF-8.
2373         * tests/fmt/basic (8-bit-pfx): Use UTF-8, not Latin-1.
2374         * tests/sort/Test.pm (16a): Likewise.
2375         * tests/uniq/Test.pm (8): Likewise.
2376         * tests/misc/printf-hex: Use ASCII, not Latin-1.
2377
2378         * NEWS: Document "sort -o -" and "tee -" POSIX-conformance fixes.
2379         * src/shred.c (usage): "-" is an operand, not an option.
2380         * src/sort.c (die, xfopen, mergefps, first_same_file, merge):
2381         A null file arg means standard output.
2382         (main): "-o -" means to write to a file named "-",
2383         not to standard output.
2384         * src/tee.c (usage, tee): "tee -" writes to standard output, not
2385         to a file named "-".
2386
2387 2004-08-10  Dmitry V. Levin  <ldv@altlinux.org>
2388
2389         * src/install.c (change_timestamps): Fix int->bool conversion
2390         bugs introduced on 2004-07-29.
2391
2392 2004-08-09  Paul Eggert  <eggert@cs.ucla.edu>
2393
2394         * src/shred.c (wipename): Work even if the directory is writeable
2395         and not readable.  Prefer write access, since this should work
2396         better with fdatasync.
2397
2398         * src/csplit.c (xalloc_die): New function.
2399         (main): Remove now-obsolete initialization of xalloc_fail_func.
2400
2401         * src/md5sum.c: Adjust to sha->sha1 renaming.
2402
2403 2004-08-08  Dmitry V. Levin  <ldv@altlinux.org>
2404
2405         Minor code cleanup.
2406         * src/readlink.c (canonicalize_fname): Remove unneeded proxy function.
2407         (can_mode): Make variable local.
2408
2409 2004-08-07  Paul Eggert  <eggert@cs.ucla.edu>
2410
2411         * src/system.h (O_BINARY) [!O_BINARY && defined O_BINARY]:
2412         Do not define, to avoid annoying compiler messages on QNX 6.3.
2413         Problem reported by Johan in:
2414         http://lists.gnu.org/archive/html/bug-coreutils/2004-08/msg00050.html
2415
2416 2004-08-04  Paul Eggert  <eggert@cs.ucla.edu>
2417
2418         * src/system.h (PRIdMAX, PRIoMAX, PRIuMAX, PRIxMAX):
2419         Define to a concatenation of string literals, not to an expression;
2420         needed for concatenation contexts.
2421         (INTMAX_MAX, INTMAX_MIN): New macros.
2422
2423         * src/stat.c (print_stat): Don't assume st_ino / st_dev fits in
2424         unsigned long; this isn't true for st_ino on Solaris 9.
2425
2426 2004-08-03  Paul Eggert  <eggert@cs.ucla.edu>
2427
2428         * src/uname.c: Do not depend on HAVE_SYSCTL when deciding
2429         whether to include files.  Include <sys/param.h> if
2430         HAVE_SYS_PARAM_H (not HAVE_SYSCTL).
2431         (main) [defined __POWERPC__]: Add a kludge to work around a
2432         Mac OS X bug, so that uname -p defaults to "powerpc" if
2433         sysctl ((int[]) {CTL_HW, HW_MACHINE_ARCH}, 2, buffer, &bufsize, 0, 0)
2434         fails.  Problem reported by Petter Reinholdtsen in:
2435         http://lists.gnu.org/archive/html/bug-gnu-utils/2003-02/msg00201.html
2436
2437         * src/uniq.c (hard_LC_COLLATE, ignore_case, different, check_file,
2438         main): Use bool for booleans.
2439         (writeline, check_file): Use uintmax_t for line counts.
2440         (check_file): Check for and report line number overflow,
2441         when that matters.
2442         * src/wc.c (iswspace, wc): Use to_uchar rather than a cast.
2443         (print_lines, print_words, print_chars, print_bytes, print_linelength,
2444         have_read_stdin, wc, wc_file, main):
2445         Use bool for booleans.
2446         (exit_status): Remove.
2447         (wc, wc_file): Return bool status.  All callers changed.
2448         * src/who.c (scan_entries): 0 -> STDIN_FILENO.
2449         * src/whoami.c (main): Print uids using unsigned long int, not
2450         unsigned int.
2451
2452         * src/unexpand.c: Int cleanup and minor reorganization to be more
2453         like src/expand.c.
2454         Include quote.h, xstrndup.h.
2455         (TAB_STOP_SENTINEL): Increase from INT_MAX to INTMAX_MAX.
2456         (convert_entire_line, have_read_stdin, parse_tabstops, next_file,
2457         unexpand, main):
2458         Use bool for booleans.
2459         (tab_size, tab_list, add_tabstop, validate_tabstops, unexpand):
2460         Use uintmax_t for column counts.
2461         (first_free_tab, validate_tabstops, unexpand): Use size_t for sizes.
2462         (add_tabstop, parse_tabstops, main): Don't reserve UINTMAX_MAX
2463         as a tab stop.
2464         (parse_tabstops): Don't use ISBLANK on possibly-signed char.
2465         Detect overflow in tab stop string.
2466         (next_file, main): Use EXIT_FAILURE/EXIT_SUCCESS instead of 1/0.
2467         (unexpand): Concatenate input files the same way expand does.
2468
2469         * src/touch.c (no_create, use_ref, posix_date, amtime_now,
2470         touch, main): Use bool for booleans.
2471         (main): Avoid integer overflow when given more than INT_MAX
2472         options.
2473         * src/tsort.c (struct item, n_strings): Use size_t for sizes.
2474         (have_read_stdin, count_items, scan_zeros, detect_loop,
2475         recurse_tree, walk_tree, tsort, main):
2476         Use bool for booleans.
2477         (exit_status): Remove.
2478         (tsort): Return a success flag instead of storing into a global.
2479         (main): Use it.
2480         * src/tty.c (silent, main): Use bool for booleans.
2481         (main): 0 -> STDIN_FILENO.
2482         * src/uname.c (print_element): Use bool for booleans.
2483
2484         * src/test.c (TRUE, FALSE, SHELL_BOOLEAN, TRUTH_OR, TRUTH_AND):
2485         Remove.  All uses replaced by C99 boolean primitives.
2486         (TEST_TRUE, TEST_FALSE): New constants, for readability.
2487         (test_unop, binop, unary_operator, binary_operator, two_arguments,
2488         three_arguments, posixtest, expr, term, and, or, is_int, age_of,
2489         one_argument, main): Use bool for booleans.
2490         (advance, unary_advance): Now inline procedures rather than a macros.
2491         (is_int): Renamed from isint, to avoid namespace clash with ctype.h.
2492         (term, and, or): When it's easy, loop instead of recursing.
2493         (term): Avoid integer overflow if there are INT_MAX-3 args (!).
2494         (binary_operator, unary_operator): Simplify by systematically rewriting
2495         true==FOO to FOO (where FOO is a boolean).
2496         (unary_operator): Don't consider a file to be a regular file
2497         merely because its mode&S_IFMT is zero.  Just use S_ISREG.
2498         Remove unnecessary casts.  Remove ifdefs for things like
2499         S_ISSOCK that are no longer needed, since stat-macros.h always
2500         defines them now.
2501
2502         * src/tac-pipe.c (buf_init_from_stdin, find_bol, tac_mem):
2503         Use bool for booleans.
2504         (buf_init_from_stdin, buf_free, find_bol, print_line):
2505         Use size_t for sizes.
2506         * src/tac.c (separator_ends_record, tac_seekable, tac_file,
2507         tac_stdin, tac_stdin_to_mem, main): Use bool for booleans.
2508         (match_length, G_buffer_size, tac_seekable, main): Use size_t for sizes.
2509         (tac_seekable): Use ptrdiff_t for pointer subtraction.
2510         Report an error if the result is out of range.
2511         (tac_seekable, main): Check for integer overflow in buffer size
2512         calculations.
2513         (main): Remove unnecessary casts.
2514
2515         * src/su.c (run_shell): Pass a new n_additional_args arg, so that
2516         the callee doesn't have to count 'em.  All callers changed.
2517         Don't allocate more space for the arg vector than we'll need.
2518         Use memcpy to copy the args rather than rolling our own loop.
2519         Use size_t for sizes.
2520         (fast_startup, simulate_login, change_environment, log_su,
2521         correct_password, restricted_shell, main): Use bool for booleans.
2522         (longopts): Don't assume change_environment is an int.
2523         Use NULL, not 0, for pointers.
2524         (xsetenv): New function, replacing xputenv and concat.
2525         All callers changed.
2526         (elements): Remove; no longer needed.
2527         (log_su, correct_passwd, main): Prefer !x to x==NULL.
2528         (log_su): 2 -> STDERR_FILENO.
2529         (modify_environment, main): Don't assume that getenv's returned value
2530         has an indefinite lifetime.
2531         (modify_environment): Allocate a larger environ.
2532         (main): Remove an impossible 'case 0'; if it happens now, it'll
2533         get diagnosed.  Don't assume getpwnam results outlive endpwent.
2534         Check for null or empty pw_name, pw_dir and for null pw_passwd.
2535
2536         * src/stty.c (VA_START): Remove.  All callers now use va_start.
2537         (_POSIX_VDISABLE): Remove unnecessary cast.
2538         (struct control_info, visible): Use cc_t for control chars.
2539         (struct control_info): Use size_t for sizes.
2540         (recover_mode, set_mode, display_speed, display_window_size,
2541         valid_options, main, display_changed):
2542         Use bool for booleans.
2543         (integer_arg): Return unsigned long int, not long int.
2544         Accept new max arg; all callers changed, to specify a maximum
2545         value for integer parameters instead of silently overflowing.
2546         (wrap): Do not overrun the stack buffer if the output contains
2547         more than 1024 bytes.  Instead, malloc a buffer.
2548         (main): Remove a "what is this?!?" FIXME.  Nobody knows what it is.
2549         Remove unnecessary casts.
2550         (set_control_char): Allow int values only up to cc_t range.
2551         (screen_columns): Don't reject INT_MAX.
2552         (display_changed, display_all, display_speed, recover_mode):
2553         Don't assume cc_t fits in int.
2554
2555         * src/remove.h: Add copyright notice.
2556         (struct rm_options): Use bool for booleans.
2557         * src/rmdir.c (empty_paths, ignore_fail_on_non_empty, verbose,
2558         errno_rmdir_non_empty, remove_parents, main): Likewise.
2559         * src/sum.c (have_read_stdin, bsd_sum_file, sysv_sum_file,
2560         main): Likewise.
2561         (main): Don't dump core if invoked with argv[0]==NULL.
2562         * src/tee.c (tee, append, ignore_interrupts, main, tee):
2563         Use bool for booleans.
2564         (tee): Use ssize_t for read returns.
2565
2566         * src/ptx.c: Add a FIXME mentioning that there are many
2567         unchecked integer overflows in this file.
2568         (gnu_extensions, auto_reference, input_reference, right_reference,
2569         ignore_case, initialize_regex, fix_output_parameters,
2570         output_one_roff_line, output_one_text_line, output_one_dumb_line, main):
2571         Use bool for booleans.
2572         (SKIP_SOMETHING, compare_words, digest_break_file,
2573         find_occurs_in_text, fix_output_parameters):
2574         Use to_uchar instead of a caset.
2575         (print_field): Rewrite to avoid cast.
2576
2577         * src/printf.c (posixly_correct): Use bool for booleans.
2578         (verify, main): Use EXIT_FAILURE/EXIT_SUCCESS instead of 1/0.
2579         (STRTOX): Rewrite to avoid casts.
2580         (print_esc_char): Arg is char, not int.
2581         * src/readlink.c (canonicalize): Remove.  All uses now merely inspect
2582         can_mode.
2583         (no_newline, verbose): Use bool for booleans.
2584         (can_mode): Now of type int; use -1 to denote otherwise-uninitialized.
2585         * src/shred.c (struct Options, main): Use bool for booleans.
2586         (isaac_seed_data, fillpattern, wipefile): Rewrite to avoid casts.
2587         * src/split.c (cwrite, bytes_split, lines_split, line_bytes_split):
2588         Use bool for booleans.
2589         * src/stat.c (G_fail): Remove.
2590         (print_statfs): Print various gotta-be-nonnegative values using
2591         unsigned long int, not long int or int.
2592         (do_statfs, do_stat): Return a boolean success flag.
2593         (do_stat, main): Use bool for booleans.
2594
2595         * src/pr.c: Add a FIXME mentioning that there are many
2596         unchecked integer overflows in this file.
2597         (TRUE, FALSE): Remove.  All uses replaced by true and false.
2598         (struct COLUMN, read_line, print_page, print_stored, open_file,
2599         skip_to_page, init_fps, parallel_files, align_empty_cols,
2600         empty_line, FF_only, explicit_columns, extremities, keep_FF,
2601         print_a_FF, print_a_header, use_form_feed, have_read_stdin,
2602         print_across_flag, storing_columns, balance_columns,
2603         truncate_lines, join_lines, untabify_input, failed_opens,
2604         numbered_lines, skip_count, use_esc_sequence, use_cntrl_prefix,
2605         double_space, ignore_failed_opens, use_col_separator,
2606         pad_vertically, last_line, main, init_parameters, skip_read,
2607         read_line, print_stored):
2608         Use bool for booleans.
2609         (struct COLUMN, char_to_clump, store_char, print_char):
2610         Use char for chars.
2611         (clump_buff, print_clump): Use char[], not int[], for an array whose
2612         elements are always chars.
2613         (first_last_page, main, getoptarg, balance, add_line_number,
2614         char_to_uclump): Remove unnecessary casts.
2615         (init_parameters): Allocate chars, not ints, for clump_buff.
2616         (print_char): Use to_uchar before invoking ISPRINT.
2617         (char_to_clump): Convert to unsigned char before invoking ISPRINT.
2618
2619         * src/nohup.c (main): Use bool for booleans.
2620         * src/paste.c (paste_parallel, paste_serial, main): Likewise.
2621         * src/pathchk.c (validate-path, main, portable_chars_only): Likewise.
2622         (portable_chars_only): Use to_uchar rather than a cast.
2623         * src/printenv.c (main): Use bool for booleans.
2624         Do not assume that the environ has at most one matching entry
2625         for each option (integer overflow was possible otherwise).
2626
2627         * src/od.c (FMT_BYTES_ALLOCATED): Now an enum, not a decimal
2628         constant.  Do not assume PRIdMAX etc. are strings of length 3 or
2629         less.
2630         (struct tspec): Use it.  fmt_string is now an array, not
2631         a pointer, as there's little point to the indirection here.
2632         (struct tspec, flag_dump_strings,
2633         traditional, flag_pseudo_start, limit_bytes_to_format,
2634         abbreviate_duplicate_blocks, have_read_stdin, simple_strtoul,
2635         decode_one_format, open_next_file, check_and_close,
2636         decode_format_string, skip, write_block, read_char, read_block,
2637         parse_old_offset, dump, dump_strings, main):
2638         Use bool for booleans.
2639         (struct tspec): Use void *, not char *, for generic pointers.
2640         (bytes_to_oct_digits, bytes_to_signed_dec_digits,
2641         bytes_to_unsigned_dec_digits, bytes_to_hex_digits):
2642         Use char, not unsigned int, since char suffices.
2643         (print_s_char, print_char, print_s_short, print_short,
2644         print_int, print_long, print_long_long, print_float,
2645         print_double, print_long_double): Rewrite to avoid casts.
2646         These now take void * arguments, instead of char *.
2647         Use the same body for all functions, except for the choice
2648         of type.  Assume C89 to simplify handling of signed char.
2649         (dump_hexl_mode_trailer, print_named_ascii, print_ascii):
2650         Rewrite to avoid casts.
2651         (print_named_ascii, print_ascii): Now takes void *, not char *.
2652         (decode_one_format): Use int for printf field widths, not
2653         unsigned int.  Pass void * to subsidiary printers,
2654         not char *.  Simplify handling of floating-point formats
2655         by factoring out common code dealing with precision and field width.
2656         (decode_format_string): Avoid need for temporary copy of
2657         each decoded struct tspec.
2658         (get_lcm): Remove unnecessary cast.
2659         (main): Fix bug where more than INT_MAX failed decodes were ignored.
2660
2661 2004-08-02  Paul Eggert  <eggert@cs.ucla.edu>
2662
2663         * src/nl.c (TRUE, FALSE): Remove; all uses changed to true, false.
2664         (enum number_format): Remove.
2665         (FORMAT_RIGHT_NOLZ, FORMAT_RIGHT_LZ, FORMAT_LEFT): Now strings,
2666         not enum values.
2667         (DEFAULT_SECTION_DELIMITERS): Now an array constant, not a macro.
2668         (section_del): Now const.
2669         (print_fmt): Remove.
2670         (starting_line_number, page_incr, blank_join, line_no,
2671         print_lineno, proc_text, main):
2672         Use intmax_t for line numbers.
2673         (reset_numbers, have_read_stdin, build_type_arg, nl_file, main):
2674         Use bool for booleans.
2675         (lineno_format): Now a string, not an enum value.
2676         (build_print_fmt): Remove.  All calls removed.  This work is
2677         now done within print_lineno.
2678         (build_type_arg): Use size_t for sizes.
2679         (print_lineno): Check for line number overflow.
2680         (proc_text, main): Remove unnecessary cast.
2681
2682         * src/ln.c (symbolic_link, interactive, remove_existing_files,
2683         verbose, hard_dir_link, dereference_dest_dir_symlinks,
2684         do_link, main): Use bool for booleans.
2685
2686         * src/ls.c (struct fileinfo, file_interesting,
2687         extract_dirs_from_files, color_symlink_as_referent,
2688         FILE_OR_LINK_MODE, sort_reverse, print_owner, print_group,
2689         numeric_ids, print_block_size, dired, print_with_color,
2690         check_symlink_color, print_inode, recursive, immediate_dirs,
2691         all_files, really_all_files, qmark_funny_chars,
2692         print_dir_name, format_needs_stat, format_needs_type, visit_dir,
2693         main, decode_switches, parse_ls_color, print_dir, file_interesting,
2694         gobble_file, make_link_path, basename_is_dot_or_dotdot,
2695         extract_dirs_from_files, print_long_format):
2696         Use bool for booleans.
2697         (dir_defaulted): Remove; no longer needed.
2698         (main): Use int to count files, since it suffices for argv.
2699         Rewrite to avoid need for dir_defaulted.
2700         (main, print_dir, gobble_file, get_link_name,
2701         xstrcoll):
2702         Set exit status to EXIT_SUCCES/EXIT_FAILURE rather than 0/1.
2703         (decode_switches): Put back check for ws.ws_col <= SIZE_MAX.
2704         Remove unnecessary cast to int.  Use int instead of unsigned
2705         int to count from 0 to 1.
2706         (get_funky_string, print_type_indicator): Use char for bytes, not int.
2707         (make_link_path): Use NULL for null pointers.
2708         (quote_name): Use to_uchar instead of cast.
2709
2710         * src/id.c (use_name, main, print_user, xgetgroups, print_group_list,
2711         print_full_info): Use bool for booleans.
2712         (problems): Remove, replacing with....
2713         (ok): New var (inverted from old sense).
2714         (print_user, print_group, print_full_info):
2715         Print uids/gids with %lu, not %u.
2716         (xgetgroups): Don't run out of memory if getgroups or getugroups
2717         returns -1.
2718         * src/setuidgid.c (main): Print uids/gids with %lu, not %ld.
2719
2720         * src/factor.c (wheel_tab): Use unsigned char instead of unsigned
2721         int, since it suffices.
2722         (factor, print_factors): Use size_t for sizes.
2723         (print_factors, do_stdin, main): Use bool for booleans.
2724         * src/fold.c (TAB_WIDTH): New macro; use it instead of "8".
2725         (fold_file, main): Use bool for booleans.
2726         (fold_file, main): Use size_t for sizes.
2727         (main): Allow -w options up to SIZE_MAX - TAB_WIDTH - 1, instead
2728         of prohibiting widths greater than INT_MAX.
2729         * src/head.c (presume_input_pipe, print_headers, have_read_stdin,
2730         write_header, elide_tail_bytes_pipe, elide_tail_bytes_file,
2731         elide_tail_lines_pipe, elide_tail_lines_seekable,
2732         elide_tail_lines_file, head_bytes, head_lines, head, head_file,
2733         string_to_integer, main):
2734         Use bool for booleans.
2735         (main): Rewrite to avoid cast.
2736
2737         * src/csplit.c (struct line): Use size_t for sizes.
2738         (main): Remove unnecessary cast.
2739         * src/cut.c (cut_fields): Use to_uchar rather than a cast.
2740         * src/cut.c (cut_file, main): Use bool for booleans.
2741         * src/date.c (show_date, rfc_format, batch_convert, main): Likewise.
2742         * src/env.c (main): Likewise.
2743         * src/expr.c (nextarg): Likewise.
2744         * src/env.c (main): Remove unused and nonstandard envp arg.
2745
2746         * src/fmt.c (COST, MAXWORDS): Add a comment describing some of
2747         fmt's arbitrary limits.
2748         (TRUE, FALSE): Remove; all uses changed to (true, false).
2749         (main): Use bool for booleans.
2750         Limit maximum width to MAXCHARS / 2.  Use xstrtoul, not xstrtol,
2751         to parse width.
2752         (copy_rest): Remove unnecessary cast.
2753         (get_prefix): Rewrite to avoid cast.
2754         (check_punctuation): Use char *, not unsigned char *; C89 requires
2755         this.  Avoid off-by-one buffer read overrun when line is empty.
2756         (flush_paragraph): Don't assume wptr-parabuf is <= INT_MAX.
2757         Remove unnecessary casts.
2758         * tests/fmt/basic (wide-1, wide-2, bad-suffix): Adjust to above
2759         changes.
2760
2761         * src/expand.c (convert_entire_line, have_read_stdin, parse_tabstops,
2762         next_file, expand, main):
2763         Use bool for booleans.
2764         (tab_size, tab_list, add_tabstop, parse_tabstops, validate_tabstops,
2765         expand, main):
2766         Use uintmax_t for column counts.
2767         (add_tabstop): Don't reserve -1 (now UINTMAX_MAX) as a special value.
2768         All callers changed.
2769         (parse_tabstops): Don't pass a negative char to isblank.
2770         Avoid memory leak with large tab stops.
2771         (validate_tabstops, expand): Don't assume number of tab stops is
2772         <= INT_MAX.
2773         (next_file, main): Use EXIT_SUCCESS/EXIT_FAILURE rather than 0/1 when
2774         storing values into exit_status.
2775         (expand): Use same pattern as unexpand for reading chars.
2776         Report an error when input line is too long, instead of silently
2777         screwing up.  Do not mishandle tab stops when backspacing left
2778         over start of line.
2779
2780         * src/dircolors.c (have_read_stdin, append_quoted,
2781         dc_parse_stream, dc_parse_file, main): Use bool for booleans.
2782         (dc_parse_stream): Use enum for state, rather than int.
2783         Use ssize_t to store getline result.
2784
2785         * src/dd.c (translation_needed, parse_integer, scanargs,
2786         apply_translations, char_is_saved, swab_buffer, skip_via_lseek):
2787         Use bool for booleans.
2788         (translate_buffer): Use to_uchar rather than a cast.
2789         (swab_buffer, copy_simple, copy_with_unblock):
2790         Use size_t for sizes.
2791
2792         * src/seq.c (equal_width, valid_format, main): Use bool for booleans.
2793         * src/sleep.c (apply_suffix): Likewise.
2794         * src/tail.c (struct File_spec, reopen_inaccessible_files, count_lines,
2795         forever, from_start, print_headers, have_read_stdin, valid_file_spec,
2796         write_header, file_lines, pipe_lines, pipe_bytes, recheck,
2797         tail_forever, tail_bytes, tail_lines, tail, tail_file,
2798         parse_obsolescent_option, parse_options, main): Likewise.
2799         * src/sleep.c (apply_suffix): Invert sense of result.
2800         Use int (not unsigned int) for multiplier, as this generates better
2801         code with some compilers.  Simplify code a bit.
2802         * src/tail.c (struct File_spec, max_n_unchanged_stats_between_opens,
2803         parse_options): Use uintmax_t, not unsigned int or unsigned long int,
2804         for state counters.
2805         (tail_bytes, tail_lines): Redo test of return value (-1, 0, 1) to
2806         make it a bit clearer.
2807
2808         * src/hostname.c: Include "xgethostname.h".
2809         (xgethostname): Remove decl; xgethostname.h has it.
2810         (sethostname) [!defined(HAVE_SETHOSTNAME) && defined(HAVE_SYSINFO)
2811         && defined (HAVE_SYS_SYSTEMINFO_H) && defined(HAVE_LIMITS_H)]: Use
2812         prototypes rather than K&R form.  Assume any negative value from
2813         sysinfo denotes failure, not just -1.
2814         (main): Simplify use of sethostname.
2815
2816         * src/pinky.c (include_idle, include_heading, include_fullname,
2817         include_project, include_plan, include_home_and_shell, do_short_format,
2818         include_where, main): Use bool for booleans.
2819         (count_ampersands, create_fullname, scan_entries, short_pinky):
2820         Use size_t for sizes.
2821         (create_fullname): Check for overflow in size calculations.
2822         (idle_string): Don't assume that the number of idle days
2823         is less than 10**8 and/or INT_MAX/(24*60*60).
2824         (main): No need to pass a non-NULL last arg to getopt_long.
2825         * src/uptime.c (print_uptime, uptime): Use size_t for sizes.
2826         (print_uptime): Remove unused local variable.
2827         (main): No need to pass a non-NULL last arg to getopt_long.
2828         * src/users.c (list_entries_users, users): Use size_t for sizes.
2829         (list_entries_users): Use char for bytes.
2830         (main): No need to pass a non-NULL last arg to getopt_long.
2831         * src/who.c (do_lookup, short_list, short_output, include_idle,
2832         include_heading, include_mesg, include_exit, need_boottime,
2833         need_deadprocs, need_login, need_initspawn, need_clockchange,
2834         need_runlevel, need_users, my_line_only, main): Use bool for booleans.
2835         (print_runlevel): Use unsigned char for bytes.
2836         (list_entries_who, scan_entries, who): Use size_t for sizes.
2837         (main): No need to pass a non-NULL last arg to getopt_long.
2838
2839         * src/install.c (isdir): Remove decl.
2840         (install_file_to_path): Rely on make_path to fail if the destination
2841         is not a directory, by passing preserve_existing==true to it.
2842         Hence we no longer need to call isdir.
2843         Free dest_dir immediately when it's no longer needed, rather than
2844         waiting until the end of the function.
2845         (copy_file): Don't bother calling isdir, as copy will do the
2846         right thing if the destination is a directory.
2847
2848         * src/du.c (fts_debug, opt_all, apparent_size, opt_count_all,
2849         print_grand_total, opt_separate_dirs, hash_ins, process_file, main):
2850         Use bool for booleans.
2851         (max_depth): Now size_t, not int, to avoid an arbitrary limit
2852         of INT_MAX on depth.
2853         (G_fail): Remove: no longer needed, now that the relevant
2854         functions return bool.
2855         (process_file): Use return value to signal success rather than
2856         setting a global.  Remove first_call static var; not needed, since
2857         we can look at n_alloc.  Use size_t for depths.  Remove FIXME
2858         about size_t casts, as it's now fixed.  Use xnrealloc rather
2859         than the obsolescent XREALLOC.  Don't bother to check whether
2860         reallocation is needed unless level > prev_level.
2861         (du_files): Invert sense of result, for consistency with
2862         other coreutils code.  All callers changed.
2863         (main): Allow --max-depth values up to SIZE_MAX.
2864
2865         * src/df.c (inode_format, show_all_fs, show_local_fs,
2866         show_listed_fs, posix_format, require_sync, print_type,
2867         selected_fstype, excluded_fstype, show_dev, show_point, main):
2868         Use bool for booleans.
2869         (df_readable, show_dev): Use UINTMAX_MAX instead of -1.
2870         (show_dev, show_point, main):
2871         Use EXIT_SUCCESS/EXIT_FAILURE instead of 0/1.
2872         Don't assume disk name lengths are <= INT_MAX.
2873         Rewrite pct calculation to avoid cast.
2874         (show_point): Don't assume resolved length is <= SSIZE_MAX.
2875
2876         * src/cut.c (hash_int) [!defined UINTPTR_MAX]: Use size_t
2877         instead of uintptr_t.
2878         * src/shred.c (UINT_MAX_32_BITS): Remove.
2879         (word32): Remove.  All uses changed to uint32_t.
2880         (isaac_seed_data): Remove unnecessary cast.
2881         * src/system.h (ptr_align): Use size_t; in practice, this is just as
2882         good as uintptr_t in checking for alignments, and has fewer
2883         configuration hassles.
2884
2885         * src/Makefile.am (localedir.h): Make it readonly; this
2886         undoes part of the 2004-07-27 patch.
2887
2888 2004-07-30  Paul Eggert  <eggert@cs.ucla.edu>
2889
2890         * src/sort.c (UCHAR): Remove; all uses changed to to_uchar.
2891         (IS_THOUSANDS_SEP): Use bool when appropriate.
2892         (numcompare, main): Use char, not int, when the value is always a char.
2893         (numcompare): Remove "register"; compilers are smart enough these days.
2894         * src/system.h (errno, CHAR_BIT): Remove decls;
2895         no longer needed now we assume C89 or better.
2896         Include <inttypes.h> before <stdint.h>, as it's the
2897         Autoconf-recommended pattern.
2898         (to_uchar): New inline function, moved here from tr.c.
2899         Use full names for int types, e.g. "long int" rather than "long".
2900         * src/tr.c (to_uchar): Remove; now in system.h.
2901         (is_char_class_member): Use bool when appropriate.
2902
2903         * src/mkdir.c (create_parents, main): Use bool when appropriate.
2904         (main): Use EXIT_SUCCESS/EXIT_FAILURE instead of 0/1.
2905
2906 2004-07-29  Paul Eggert  <eggert@cs.ucla.edu>
2907
2908         * src/mkfifo.c (main): Use EXIT_SUCCESS and EXIT_FAILURE, not 0 and 1.
2909
2910         * src/chmod.c (recurse, force_silent, process_file, process_files,
2911         main): Use bool when appropriate.
2912         * src/cksum.c (cksum, main): Likewise.
2913         * src/comm.c (hard_LC_COLLATE, only_file_1, only_file_2, both,
2914         compare_files, main): Likewise.
2915
2916         * src/copy.h (struct cp_options): Likewise.
2917         * src/copy.c (copy_internal, is_ancestor, copy_dir, copy_reg,
2918         same_file_ok, seen_file, copy_internal, valid_options, copy): Likewise.
2919         * src/cp-hash.h (remember_created): Likewise.
2920         * src/cp-hash.c (remember_created): Likewise.
2921         * src/cp.c (struct dir_attr, flag_path, remove_trailing_slashes,
2922         re_protect, make_path_private, target_directory_operand, do_copy,
2923         cp_option_init, decode_preserve_arg, main): Likewise.
2924         * src/install.c (isdir, change_timestamps, change_attributes,
2925         copy_file, install_file_to_path, install_file_in_dir,
2926         install_file_in_file, strip_files, dir_arg, cp_option_init, main,
2927         change_attributes, change_timestamps): Likewise.
2928         * src/mv.c (remove_trailing_slashes, rm_option_init,
2929         cp_option_init, do_move, movefile, main): Likewise.
2930         * src/remove.c (right_justify), full_filename_, AD_pop_and_chdir,
2931         AD_push, prompt, remove_dir): Likewise.
2932         * src/rm.c (rm_option_init, main): Likewise.
2933
2934         * src/remove.c (top_dir, pop_dir, full_filename_):
2935         Use size_t for sizes.
2936         * src/cp.c (target_directory_operand): Do not clear *NEW_DST if stat
2937         succeeds.  It's not necessary in that case, as *NEW_DST is always
2938         false already.
2939         (do_copy): Rewrite slightly to avoid need for "unreachable" comment.
2940         (main): Use EXIT_SUCCESS, EXIT_FAILURE instead of 0, 1.
2941         * src/rm.c (main): Likewise.
2942
2943         md5sum, sha1sum integer cleanups.
2944
2945         * src/checksum.h: Don't include config.h, sys/types.h, stdio.h:
2946         not needed.
2947         (ALG_UNSPECIFIED): Remove.
2948         (ALG_MDT): Don't make it equal to CHAR_MAX + 1; this isn't necessary.
2949         * src/md5.c: Don't include any files other than checksum.h.
2950         * src/sha1sum.c: Likewise.
2951         * src/md5sum.c (OPENOPTS, have_read_stdin, status_only, warn,
2952         bsd_split_3, split_3, hex_digits, digest_file, digest_check, main):
2953         Use bool when appropriate.
2954         (digest_check): Increase limit of number of input lines to
2955         UINTMAX_MAX from INT_MAX.  Diagnose any overflows of this counter.
2956         Use ngettext instead of hard-to-i18nize hardcoded stuff for plurals.
2957
2958 2004-07-28  Paul Eggert  <eggert@cs.ucla.edu>
2959
2960         * src/cat.c (exit_status): Remove.  Now done by passing a boolean
2961         'ok' flag around.
2962         (simple_cat, cat): Return true if successful.  All callers changed.
2963         (simple_cat, cat, main): Use bool for booleans.
2964         (simple_cat): Use size_t for sizes.
2965         (cat, main): Use the same names for parameters that we use for
2966         long options, to avoid confusion.  This inverts the sense of the
2967         show_tabs (formerly output_tabs) and number_nonblank
2968         (formerly numbers_at_empty_lines) variables.
2969         (main): Don't mess up (due to integer overflow) if we are given
2970         INT_MAX - INT_MIN + 1 options.
2971         [O_BINARY]: Don't invoke isatty unless the other options require it.
2972         (main): When deciding whether to use simple_cat, don't worry
2973         about binary option; it's irrelevant.
2974
2975         * src/dcgen: Remove comments, trailing white space, and empty
2976         lines from the output strings, to save space.
2977         Use a narrower type like 'unsigned char' for line lengths, if
2978         that will do.
2979         Make the output variables static, not extern.
2980
2981         * src/chgrp.c (parse_group): Require base 10 when parsing
2982         groups as integers.
2983         (main): int -> bool when appropriate.
2984         * src/chown.c (main): Likewise.
2985         * src/chown-core.c: Include inttostr.h.
2986         (UINT_MAX_DECIMAL_DIGITS, uint_to_string): Remove.
2987         (gid_to_name, uid_to_name): Use imaxtostr/umaxtostr
2988         instead of uint_to_string).
2989         (describe_change): Instead of an int flag, use a char *
2990         auxiliary; this avoids the need for casts.
2991         Assume free (NULL) works.
2992         (change_file_owner): Return true/false, not 0/-1, since
2993         we don't set errno.  All callers changed.
2994         Use bool when appropriate.
2995         (chown_files): Likewise.
2996         * src/chown-core.h (chown_files): Likewise.
2997
2998         * tests/chown/basic: Test for proper handling of uids like
2999         "010", which must be parsed as decimal.
3000
3001         * tests/misc/pwd: Don't assume that Perl's getpwd agrees with our
3002         pwd when there are multiple names for the working directory
3003         (which can happen with an automounter, sigh).
3004
3005         * src/Makefile.am ($(SCRIPTS)): Don't depend on Makefile;
3006         this causes Solaris 8 'make' to refuse to build "groups".
3007         (localedir.h): Don't depend on Makefile: this causes Solaris
3008         8 'make' to build localedir.h unnecessarily.  The dependence
3009         on Makefile is ineffective anyway, since $(localedir) might
3010         change even if Makefile hasn't.
3011
3012         * src/remove.c (remove_dir): If we can't save the state of the
3013         working directory, pretend we started from "/", not ".".
3014         This avoids a bug on hosts like Solaris that don't let you
3015         remove the working directory.
3016
3017 2004-07-27  Paul Eggert  <eggert@cs.ucla.edu>
3018
3019         * src/printf.c (strtiomax, strtoumax): Declare if not already
3020         declared: this fixes a portability bug with Solaris 8 + GCC.
3021         (STRTOX): Parenthesize use of macro arg as expression.
3022         (vstrtoimax, vstrtoumax, vstrtold): Remove now-unnecessary
3023         parentheses.
3024         * configure.ac: Check for declaration of strtoumax, for
3025         src/printf.c.
3026
3027         * src/Makefile.am (cp_LDADD, ginstall_LDADD, mv_LDADD,
3028         pathchk_LDADD, rm_LDADD, test_LDADD): New vars, for eaccess.
3029
3030         * tests/readlink/can-e: Don't assume that we can remove the
3031         working directory: this isn't possible under Solaris 8, say.
3032         * tests/readlink/can-f: Likewise.
3033         * tests/readlink/can-m: Likewise.
3034
3035         * src/copy.c (copy_internal): find_backup_file_name no longer
3036         returns NULL, so don't bother to check for this.
3037         * src/cp.c (do_copy): Likewise.
3038         * src/ln.c (do_link): Likewise.
3039
3040 2004-07-25  Paul Eggert  <eggert@cs.ucla.edu>
3041
3042         * src/nice.c (GET_NICE_VALUE): Renamed from GET_PRIORITY.
3043         All uses changed.
3044         (NZERO): New macro, if system doesn't define it already.
3045         (usage): Distinguish priorities from nice values.
3046         Don't assume NZERO is 20.
3047         (main): Use bool instead of int where appropriate.
3048         If user specifies an adjustment out of range, always truncate it
3049         to an inrange value instead of sometimes giving an error message
3050         and sometimes not.
3051         Do not assume that -1 is an error return from "nice" or
3052         "getpriority", as it might be the current nice value minus NZERO.
3053         If nice/setpriority fails with errno == EPERM, go ahead and run
3054         the command anyway; POSIX requires this.
3055
3056         * src/pathchk.c: Include euidaccess.h.
3057         (dir_ok): Use euidaccess, not access.
3058         * src/test.c (R_OK, W_OK, X_OK, FOK): Remove; system.h defines them.
3059         (eaccess): Remove.  All users changed to use euidaccess instead.
3060
3061 2004-07-24  Paul Eggert  <eggert@cs.ucla.edu>
3062
3063         * src/uptime.c (print_uptime) [defined BOOT_MSG]:
3064         Don't assume ut_line is null-terminated.
3065         * src/who.c (print_line): New arguments USERLEN and LINELEN,
3066         since USER and LINE might not be null terminated.  All callers
3067         changed.
3068
3069 2004-07-23  Paul Eggert  <eggert@cs.ucla.edu>
3070
3071         Fix bug with "tail -f" reported by Rob Holland in
3072         <http://lists.gnu.org/archive/html/bug-coreutils/2004-07/msg00054.html>.
3073         Also, remove the undocumented and unsupported-since-2000
3074         --max-consecutive-size-changes options.  Fix another related bug:
3075         "tail" got confused if stdin, stdout, or stderr were closed.
3076         Also, use output buffering even with "tail -f".
3077
3078         * NEWS: Document this, plus yesterday's patch.
3079         * doc/coreutils.texi (tail invocation): "size has remained the same"
3080         -> "file has not changed", which is more accurate for fifos.
3081         * src/tail.c: Include fcntl-safer.h.
3082         (COPY_TO_EOF): Set to UINTMAX_MAX, not OFF_T_MAX (which was wrong).
3083         (COPY_A_BUFFER): New macro.
3084         (struct File_spec): New members mtime, mode, blocking.
3085         Remove member n_consecutive_size_changes.
3086         (DEFAULT_MAX_N_CONSECUTIVE_SIZE_CHANGES,
3087         max_n_consecutive_size_changes_between_opens,
3088         MAX_CONSECUTIVE_SIZE_CHANGES_OPTION): Remove.
3089         (long_options, tail_forever, parse_options):
3090         Remove (non-)support for --max-consecutive-size-changes.
3091         (record_open_fd): New function.
3092         (recheck, tail_file): Use it.  Don't assume that stdin is open.
3093         (dump_remainder): Add support for new COPY_A_BUFFER special value.
3094         Treat errno==EAGAIN like EOF, since it might be a nonblocking read.
3095         (recheck): New arg BLOCKING, specifying whether to use blocking reads.
3096         All uses changed.
3097         (n_live_files): Remove, replacing with...
3098         (any_live_files): New function.  All uses changed.
3099         (tail_forever): Use nonblocking I/O unless we know that blocking I/O
3100         is safe; this avoids some hangs when reading from a fifo.
3101         Avoid invoking fstat or sleep when using blocking I/O.
3102         Do not check for changes to size if the file is not a regular file,
3103         as the size is undefined in that case.
3104         Check for changes to mtime or mode, too; this works for non-regular
3105         files.
3106         (tail_forever, main): Redo fflush strategy to work even when input
3107         is nonblocking.  Don't use unbuffered output; just flush when needed.
3108
3109 2004-07-22  Paul Eggert  <eggert@cs.ucla.edu>
3110
3111         * src/tail.c (main): Ignore -f if no file operand is specified
3112         and standard input is a pipe.
3113         * doc/coreutils.texi (tail invocation): Do not ignore -f for
3114         all pipes, just for when standard input is a pipe and no
3115         file operand is specified.
3116         * tests/tail/Test.pm: Reinstate f-1 test, since we now pass.
3117         Add a new commented-out f-2 test, which we still fail.
3118         (test_vector): All f-* tests are special cases, not just f-1.
3119
3120 2004-07-12  Paul Eggert  <eggert@cs.ucla.edu>
3121
3122         * src/uptime.c: Include c-strtod.h.
3123         (print_uptime): Use c_strtod instead of setlocale and sscanf.
3124         Use long int rather than int to count days (for 64-bit hosts),
3125         and check for arithmetic overflow when converting double to time_t.
3126
3127 2004-07-11  Paul Eggert  <eggert@cs.ucla.edu>
3128
3129         * src/printf.c (vstrtold): Renamed from vstrtod.
3130         Now returns long double.  All uses changed.
3131         (print_direc): Use "L" length modifier when printing floating point
3132         numbers, since we're now printing long double.
3133
3134 2004-07-06  Paul Eggert  <eggert@cs.ucla.edu>
3135
3136         printf cleanup, to avoid undefined behavior, to add support for
3137         formats that Bash supports, and to support wide integers like
3138         Bash does.
3139
3140         * NEWS: Document this.
3141         * src/printf.c (UNSPECIFIED): Remove.  All uses now replaced by
3142         booleans, so that we don't reserve any values for precision or
3143         width (like Bash).
3144         (STRTOX): Use prototype, not K&R-style definition.
3145         (vstrtoimax): Renamed from xstrtol (to avoid confusion with xstrtol
3146         in ../lib), with type change to intmax_t.
3147         All uses changed.
3148         (vstrtoumax): Renamed from xstrtoul, with type change to uintmax_t.
3149         All uses changed.
3150         (vstrtod): Renamed from xstrtod.  All uses changed.
3151         (print_direc): Use boolean arg instead of special value to indicate
3152         a missing precision or width.  LENGTH no longer includes
3153         length modifiers or conversion character.  New arg CONVERSION
3154         now specifies conversion character.
3155         Use intmax_t-width formatting for integers (like Bash).
3156         Add support for C99 %a, %A, %F (like Bash).
3157         Add support for field width with %c (POSIX requires this).
3158         Add a FIXME for lack of support for field width and precision
3159         for %b.
3160         Add support for '\'', '0' flags.
3161         Check for invalid combinations of flags, field width, precision,
3162         and conversion, to prevent use of undefined behavior.
3163         Allow multiple length modifiers, for formats like "%lld" (like Bash).
3164         Add support for C99 'j', 't', 'z' length modifiers (like Bash).
3165         In error message, output entire invalid conversion specification,
3166         instead of merely outputting % followed by the conversion char.
3167         * tests/misc/printf: Add tests for the above.
3168
3169 2004-04-03  Dmitry V. Levin  <ldv@altlinux.org>
3170
3171         Change "readlink -f" to be more compatible with prior implementations.
3172         Add more canonicalize options, -e and -m.
3173         Add comprehensive tests for all readlink modes.
3174
3175         * m4/canonicalize.m4 (AC_FUNC_CANONICALIZE_FILE_NAME):
3176         Do not add canonicalize.c here.
3177
3178         * src/readlink.c (longopts): Add new options.
3179         (usage): Document them.
3180         (canonicalize_fname): New proxy function.
3181         (main): Handle new options.
3182         * doc/coreutils.texi (readlink invocation): Document new
3183         "readlink -f" behaviour and new canonicalize options, -e and -m.
3184
3185         * configure.ac (AC_CONFIG_FILES): Add tests/readlink/Makefile.
3186         * tests/Makefile.am (SUBDIRS): Add readlink.
3187         * tests/readlink/Makefile.am: New file.
3188         * tests/readlink/{rl-1,can-e,can-f,can-m}: New readlink tests.
3189         * tests/misc/Makefile.am (TESTS): Remove basic readlink test.
3190         * tests/misc/readlink: Remove file.
3191
3192 2004-07-04  Jim Meyering  <jim@meyering.net>
3193
3194         * src/copy.c (copy_internal): Add a FIXME comment.
3195
3196 2004-07-02  Paul Eggert  <eggert@cs.ucla.edu>
3197
3198         * src/copy.c (copy_dir): Assume path_concat returns non-NULL.
3199         * src/cp.c (do_copy): Likewise.
3200         * src/mv.c (movefile): Likewise.
3201
3202         * src/cp.c (make_path_private): 2nd arg is now size_t, not int,
3203         to avoid problem when path_concat dir name is longer than 2 GiB (!).
3204
3205         * src/nohup.c (main): Don't pass NULL first argument to path_concat.
3206         This cleans up the semantics a bit, as we no longer try to open the
3207         same file twice.
3208
3209 2004-07-01  Paul Eggert  <eggert@cs.ucla.edu>
3210
3211         * NEWS: Add short names -t and -T for --target-directory
3212         and --no-target-directory options, respectively.
3213
3214         * src/cp.c (NO_TARGET_DIRECTORY_OPTION, TARGET_DIRECTORY_OPTION):
3215         Remove.  All uses changed to 'T' and 't', respectively.
3216         * src/install.c, src/ln.c, src/mv.c: Likewise.
3217
3218         * src/cp.c (long_opts, usage, do_copy, main): Add -t and -T as
3219         aliases for --target-directory and --no-target-directory,
3220         respectively.
3221         * src/install.c (long_options, main, usage): Likewise.
3222         * src/ln.c, src/mv.c: Likewise.
3223
3224 2004-07-01  Jim Meyering  <jim@meyering.net>
3225
3226         * Makefile.maint (sc_file_system): New target.
3227         (syntax-check-rules): Add it.
3228         .x-sc_file_system: New file.
3229         * Makefile.am (EXTRA_DIST): Add it.
3230
3231         * man/sync.x: Use "file system" rather than "filesystem".
3232         * man/stat.x, man/df.x: Likewise.
3233
3234 2004-06-30  Paul Eggert  <eggert@cs.ucla.edu>
3235
3236         * src/df.c (usage, main): Output "file system" rather than
3237         "filesystem".
3238         * src/du.c (usage): Likewise.
3239         * src/shred.c (usage): Likewise.
3240         * src/stat.c (usage): Likewise.
3241         * src/stat.c (long_options, usage): Rename "--filesystem" to
3242         "--file-system".  But keep the old name around, for compatibility
3243         reasons.
3244
3245 2004-06-29  Paul Eggert  <eggert@cs.ucla.edu>
3246
3247         Add support for --no-target-directory option.
3248
3249         * NEWS: Document it.
3250         * doc/coreutils.texi (Common options, Target directory, cp
3251         invocation, install invocation, mv invocation, ln invocation):
3252         Likewise.
3253         (link invocation): Explain how to rewrite link using ln now
3254         that we have --no-target-directory.
3255         (ln invocation): Explain that --no-target-directory subsumes
3256         --no-dereference.
3257         (unlink invocation): Modify wording to match new wording in
3258         link invocation.
3259
3260         * src/cp.c (NO_TARGET_DIRECTORY_OPTION): New constant.
3261         (long_opts, usage, do_copy, main): Add support for
3262         --no-target-directory,
3263         * src/install.c (NO_TARGET_DIRECTORY_OPTION, long_options, main,
3264         usage): Likewise.
3265         * src/ln.c (NO_TARGET_DIRECTORY_OPTION, long_options, usage,
3266         main): Likewise.
3267         * src/mv.c (NO_TARGET_DIRECTORY_OPTION, long_options, usage,
3268         main): Likewise.
3269         * src/mv.c (enum): Sort values.
3270
3271 2004-06-29  Jim Meyering  <jim@meyering.net>
3272
3273         Don't let verbose-mode output from a subshell obscure actual differences.
3274         * tests/rm/inaccessible: Turn off command-echoing just before
3275         invoking subshell, then turn it back on if VERBOSE=yes afterward.
3276
3277 2004-06-25  Paul Eggert  <eggert@cs.ucla.edu>
3278
3279         Add support for 'install --target-directory', an option
3280         that has been documented for years but not implemented (!).
3281         * doc/coreutils.texi (install invocation): Document
3282         --target-directory in synopsis, too.
3283         * src/install.c (TARGET_DIRECTORY_OPTION): New var.
3284         (long_options, main, usage): Add --target-directory.
3285         (target_directory_operand): New function, stolen from mv.c.
3286         (main): Use it.  Check for -d and --target-directory.
3287         Alter wording of diagnostics to match other programs.
3288
3289 2004-06-28  Jim Meyering  <jim@meyering.net>
3290
3291         * src/cp.c (usage): Fix copy+paste error in description of
3292         --target-directory: s/move/copy/.  From Paul Jarc.
3293
3294 2004-06-27  Paul Eggert  <eggert@cs.ucla.edu>
3295
3296         Use more-consistent rules among cp, ln, and mv when dealing with
3297         last operands that are (or look like) directories.
3298
3299         * src/cp.c (target_directory_operand): New, nearly-common function,
3300         It reports an error if the destination appears to be a directory
3301         (e.g., because it has a trailing slash) but is not.
3302         * src/ln.c, src/mv.c: Likewise.
3303         * src/cp.c (do_copy): Use it.
3304         * src/ln.c (main): Likewise.
3305         * src/mv.c (main): Likewise.
3306
3307         * src/cp.c (do_copy): Don't assume argc is positive.
3308         Don't bother to lstat dest, since copy() will do that for us.
3309         Use "const" to avoid the need for cast.
3310
3311         * src/cp.c (do_copy): Don't output a usage message because of file
3312         problems (e.g., an operand is not a directory).  Use it only for
3313         syntax.  Standardize on "target %s is not a directory" for the
3314         diagnostic.
3315         * src/ln.c (main): Likewise.
3316         * src/mv.c (main): Likewise.
3317
3318         * src/cp.c (do_copy): Remove test for trailing slash, since
3319         target_directory_operand now does this.
3320         * src/ln.c (main): Likewise.
3321         * src/mv.c (movefile): Likewise.
3322
3323         * src/cp.c (main): Reject multiple target directories.
3324         Check whether a specified target is a directory when parsing the
3325         options, using stat.  This gives more-accurate diagnostics.
3326         * src/ln.c (main): Likewise.
3327
3328         * src/ln.c (isdir): Remove decl; no longer needed.
3329         * src/mv.c (isdir, lstat): Likewise.
3330
3331         * src/ln.c (do_link): New arg dest_is_dir.  All uses changed.
3332         Don't check the destination ourself; rely on dest_is_dir.
3333         This way we can avoid lstatting the destination in the
3334         usual case, and in the worst case we lstat 1, not 3 times.
3335         Don't bother to unlink unless link failed; this saves a syscall.
3336         Remove unnecessary backup_succeeded flag;
3337         it was identical to "dest_backup != NULL".
3338
3339         * src/ln.c (main): Use int to count to argc, not unsigned int.
3340         This handles negative operand counts.
3341         * src/mv.c (main): Likewise.
3342
3343         * src/mv.c (do_move): Don't call hash_init; expect the caller to
3344         do it, for consistency with cp.c and ln.c.  All callers changed.
3345         (movefile): dest_is_dir parameter is now bool, not int.
3346         (main): Standardize on "missing destination file operand after %s"
3347         for the diagnostic, for consistency with cp.c.
3348
3349         * tests/mv/diag: Don't assume "mv --target=nonexistentdir"
3350         will complain about the arg count.
3351         Adjust to new (briefer) diagnostics.
3352         * tests/cp/fail-perm: Add a test to verify that we get the new
3353         diagnostic when failing to copy through a symlink-to-inaccessible-dir.
3354
3355 2004-06-27  Paul Eggert  <eggert@cs.ucla.edu>
3356
3357         Fix a bug: formerly, if d/x was a directory and x a file, "ln x
3358         d/" incorrectly created a link d/x/x.  It also saves some system
3359         calls.
3360
3361         * NEWS: Document the fix.
3362
3363         * src/ln.c (main): Don't append basename to dest if this
3364         results in an existing directory name.
3365         * tests/ln/misc: See whether a trailing slash is followed too far.
3366
3367 2004-06-26  Jim Meyering  <jim@meyering.net>
3368
3369         * src/printf.c (main): When given no arguments, print the standard
3370         "missing operand\nTry printf --help..." message -- to be consistent.
3371
3372 2004-06-26  Jim Meyering  <jim@meyering.net>
3373
3374         * src/mknod.c (main): Add \n at the end of message output via fprintf.
3375
3376 2004-06-25  Jim Meyering  <jim@meyering.net>
3377
3378         * tests/ln/misc: Add test for ln subscript error.
3379
3380 2004-06-23  Paul Eggert  <eggert@cs.ucla.edu>
3381
3382         * src/ln.c (do_link): Remove unnecessary call to lstat.
3383         (main): Avoid subscript error when the destination is "".
3384
3385 2004-06-23  Jim Meyering  <jim@meyering.net>
3386
3387         * tests/*: Replace all occurrences of `(exit N); exit' with
3388         `(exit N); exit N'.  Otherwise, those many tests could exit with
3389         improper exit status when exiting via e.g., a trapped interrupt.
3390         Thanks to a report from Bob Proulx.
3391
3392 2004-06-22  Paul Eggert  <eggert@cs.ucla.edu>
3393
3394         * src/who.c (idle_string, print_user): New arg boottime,
3395         specifying the most recent boot time.  All uses changed.
3396         (idle_string) Consider a line to be "old" if it hasn't been used
3397         since the last boot time.  Watch out for overflow when computing
3398         times, and for times in the future.
3399         (idle_string): Record latest boot time.
3400
3401 2004-06-22  Jim Meyering  <jim@meyering.net>
3402
3403         * src/test.c (usage): Correct description of `-t FD'.  The file
3404         descriptor, FD, is no longer optional.  Reported by Ton Nijkes.
3405
3406 2004-06-21  Paul Eggert  <eggert@cs.ucla.edu>
3407
3408         The 2004-06-19 fix for who and pinky was incomplete, as ctime
3409         has undefined behavior if the year precedes -999 or follows 9999.
3410         Since we have to stop using ctime anyway, we might as well use
3411         strftime and fix the FIXME, and support internationalized dates.
3412
3413         * NEWS: Document the new behavior.
3414         * src/who.c: Include "hard-locale.h".
3415         (time_format, time_format_width): New vars.
3416         (time_string, print_line): Use them.
3417         (main): Set them.
3418         (time_string): Use localtime + strftime instead of
3419         ctime, to avoid problems with years before -999 or after 9999.
3420         * src/pinky.c: Likewise.
3421
3422 2004-06-21  Paul Eggert  <eggert@cs.ucla.edu>
3423
3424         Fix bug: GNU 'ls' didn't count columns correctly if user or group
3425         names contained multibyte characters where the column count
3426         differed from the byte count.  This patch also corrects
3427         some comments.
3428
3429         * src/ls.c (format_user_or_group): New function, which counts
3430         columns correctly.
3431         (format_user, format_group): Use it.
3432         (format_user_or_group_width): New function, which counts columns
3433         correctly.
3434         (format_user_width, format_group_width): Use it.
3435
3436 2004-06-21  Jim Meyering  <jim@meyering.net>
3437
3438         * tests/priv-check: Quote "$PATH" in PATH=$PATH.
3439         Suggestion from Andreas Schwab.
3440
3441         * tests/priv-check: When running as root, be sure to propagate
3442         PATH through to the process we exec as non-root.
3443         Reported by michael@aplatform.com.
3444
3445         * src/mknod.c (main): Don't segfault when calculating the
3446         expected number of operands for `mknod NAME'.
3447
3448 2004-06-20  Jim Meyering  <jim@meyering.net>
3449
3450         * src/dd.c (input_seek_errno): Declare file-scoped variable as static.
3451
3452 2004-06-20  Paul Eggert  <eggert@cs.ucla.edu>
3453
3454         * src/basename.c (main):
3455         Standardize on the diagnostics given when someone gives
3456         too few operands ("missing operand after `xxx'") or
3457         too many operands ("extra operand `xxx'").
3458         Include "quote.h" and/or "error.h" if it wasn't already being included.
3459         * src/chgrp.c (main): Likewise.
3460         * src/chmod.c (main): Likewise.
3461         * src/chown.c (main): Likewise.
3462         * src/chroot.c (main): Likewise.
3463         * src/comm.c (main): Likewise.
3464         * src/cp.c (do_copy): Likewise.
3465         * src/csplit.c (main): Likewise.
3466         * src/date.c (main): Likewise.
3467         * src/dircolors.c (main): Likewise.
3468         * src/dirname.c (main): Likewise.
3469         * src/du.c (main): Likewise.
3470         * src/expr.c (main): Likewise.
3471         * src/hostid.c (main): Likewise.
3472         * src/hostname.c (main): Likewise.
3473         * src/id.c (main): Likewise.
3474         * src/install.c (main): Likewise.
3475         * src/join.c (add_file_name, main): Likewise.
3476         * src/link.c (main): Likewise.
3477         * src/ln.c (main): Likewise.
3478         * src/logname.c (main): Likewise.
3479         * src/md5sum.c (main): Likewise.
3480         * src/mkdir.c (main): Likewise.
3481         * src/mkfifo.c (main): Likewise.
3482         * src/mknod.c (main): Likewise.
3483         * src/mv.c (main): Likewise.
3484         * src/nohup.c (main): Likewise.
3485         * src/od.c (main): Likewise.
3486         * src/pathchk.c (main): Likewise.
3487         * src/ptx.c (main): Likewise.
3488         * src/readlink.c (main): Likewise.
3489         * src/rm.c (main): Likewise.
3490         * src/rmdir.c (main): Likewise.
3491         * src/seq.c (main): Likewise.
3492         * src/setuidgid.c (main): Likewise.
3493         * src/shred.c (main): Likewise.
3494         * src/sleep.c (main): Likewise.
3495         * src/sort.c (main): Likewise.
3496         * src/split.c (main): Likewise.
3497         * src/stat.c (main): Likewise.
3498         * src/test.c (beyond, main): Likewise.
3499         * src/touch.c (main): Likewise.
3500         * src/tr.c (main): Likewise.
3501         * src/tsort.c (main): Likewise.
3502         * src/tty.c (main): Likewise.
3503         * src/uname.c (main): Likewise.
3504         * src/uniq.c (main): Likewise.
3505         * src/unlink.c (main): Likewise.
3506         * src/uptime.c (main): Likewise.
3507         * src/users.c (main): Likewise.
3508         * src/who.c (main): Likewise.
3509         * src/whoami.c (main): Likewise.
3510
3511         * tests/basename/basic: Adjust to new diagnostics.
3512         * tests/du/files0-from: Likewise.
3513         * tests/expr/basic: Likewise.
3514         * tests/mv/diag: Likewise.
3515         * tests/tsort/basic-1: Likewise.
3516
3517 2004-06-20  Jim Meyering  <jim@meyering.net>
3518
3519         * src/ln.c: Remove declaration of yesno.
3520         Instead, include yesno.h.
3521         * src/copy.c: Likewise.
3522
3523         * src/remove.c: Remove declaration of yesno.
3524         Instead, include yesno.h.
3525         (top_dir): Remove now-unnecessary cast of obstack_base.
3526         (pop_dir): Likewise.
3527         (full_filename_): Likewise.
3528
3529 2004-06-19  Paul Eggert  <eggert@cs.ucla.edu>
3530
3531         Don't dump core if ctime returns NULL; this is possible on
3532         hosts with 64-bit time_t and 32-bit int.
3533         * src/who.c: Include "inttostr.h".
3534         (time_string): If ctime fails, print the raw time as an integer
3535         instead of dumping core.
3536         * src/pinky.c: Likewise, as follows:
3537         Include "inttostr.h".
3538         (time_string): New function, copied from who.c.
3539         (print_entry): Use it.
3540
3541 2004-06-19  Paul Eggert  <eggert@cs.ucla.edu>
3542
3543         * src/who.c (print_line): Don't truncate user names at 8 bytes.
3544         Problem reported by Guido Leenders in:
3545         http://lists.gnu.org/archive/html/bug-coreutils/2004-06/msg00056.html
3546         * NEWS: document this.
3547
3548 2004-06-19  Jim Meyering  <jim@meyering.net>
3549
3550         * src/system.h (case_GETOPT_VERSION_CHAR): Switch back to
3551         using GNU_PACKAGE (from PACKAGE) once again.  This restores
3552         `GNU' to the parenthesized package name in --version output.
3553         Before, the first argument from AC_INIT, `GNU coreutils', would
3554         be propagated to the PACKAGE variable.  Now, `GNU ' is trimmed.
3555         Reported by Richard Stallman.
3556
3557 2004-06-17  Jim Meyering  <jim@meyering.net>
3558
3559         * src/tr.c (to_uchar): Rename function from `uchar'.  The latter
3560         would clash with a typedef in Tru64's <sys/types.h>.  From Albert Chin.
3561
3562 2004-06-15  Paul Eggert  <eggert@cs.ucla.edu>
3563
3564         * NEWS: Remove more special cases for POSIXLY_CORRECT when POSIX
3565         allows the GNU behavior.  "--" is now supported by chroot, hostid,
3566         hosname, pwd, sync, yes.
3567         * doc/coreutils.texi (yes invocation, false invocation,
3568         true invocation): Document this.
3569         * src/chroot.c (main): Handle "--".
3570         * src/hostid.c (main): Likewise.
3571         * src/hostname.c (main): Likewise.
3572         * src/pwd.c (main): Likewise.
3573         * src/sync.c (main): Likewise.
3574         * src/yes.c (main): Likewise.
3575         * src/true.c (main): Recognize --help and --version even if
3576         POSIXLY_CORRECT is set.
3577         * src/yes.c (main): Likewise.
3578
3579 2004-06-09  Paul Eggert  <eggert@cs.ucla.edu>
3580
3581         * NEWS: Remove special cases for POSIXLY_CORRECT when POSIX allows
3582         the GNU behavior.
3583         * doc/coreutils.texi (pr invocation, unlink invocation): Document this.
3584         * src/ls.c (decode_switches): Pay attention to TABSIZE even if
3585         POSIXLY_CORRECT is set.  POSIX reserves upper-case environment
3586         variables to the implementation, so it's OK for ls to depend on
3587         TABSIZE.
3588         * src/pr.c: Include "hard-locale.h".
3589         (main): When in a non-POSIX locale, ignore POSIXLY_CORRECT, since
3590         POSIX specifies the behavior only in the POSIX locale.
3591         * src/printf.c (print_esc): Support \x, \u, \U even if POSIXLY_CORRECT,
3592         since POSIX says the behavior is unspecified here.
3593         * src/tail.c (parse_obsolescent_option): Support multiple file operands
3594         even if POSIXLY_CORRECT, since POSIX does not require a diagnostic.
3595         * src/printf.c (main): Recognize --help, --version even if
3596         POSIXLY_CORRECT.  POSIX does not specify any options, but it
3597         does not prohibit options either, so "printf" is like "expr" here.
3598         * src/unlink.c (main): Likewise.
3599         * tests/misc/printf: Adjust to the new semantics for \x if
3600         POSIXLY_CORRECT.
3601
3602 2004-06-14  Jim Meyering  <jim@meyering.net>
3603
3604         * tests/misc/pwd: New test, for fix of 2004-04-19.
3605         * tests/misc/Makefile.am (TESTS): Add pwd.
3606         (BUILD_SRC_DIR): Define BUILD_SRC_DIR.
3607
3608         * src/copy.c: Remove declaration of euidaccess.
3609         Instead, include "euidaccess.h".
3610
3611 2004-06-13  Paul Eggert  <eggert@cs.ucla.edu>
3612
3613         * src/who.c (PIDSTR_DECL_AND_INIT): Don't assume pid_t fits in int.
3614         (UT_ID) [!HAVE_STRUCT_XTMP_UT_ID]: Remove bogus comment,
3615         as (sizeof "??") reliably returns 3.
3616         (print_line): Guard against idle and pid being too long
3617         (which is possible when printing headers).
3618         (print_user): Allocate enough bytes for idlestr.  Use IDLESTR_LEN.
3619         Avoid unnecessary cast of sizeof to int.
3620         (make_id_equals_comment): Do not assume that UT_ID returns
3621         a string; it might return a non-null-terminated array.
3622         Use strncat instead.  It's not very often where strncat is
3623         exactly what you want, but this is one of those rare cases.
3624
3625 2004-06-11  Paul Eggert  <eggert@cs.ucla.edu>
3626
3627         * src/who.c (list_entries_who): Don't output a trailing space.
3628
3629 2004-06-09  Jim Meyering  <jim@meyering.net>
3630
3631         * src/touch.c (usage): Improve wording in description of the
3632         --time=WORD option.  Reported by Dan Jacobson.
3633
3634         * src/chown-core.c (change_file_owner): Change names of parameters
3635         old_uid and old_gid to required_uid and required_gid respectively.
3636
3637         * src/chmod.c (mode_changed): Return false, not 0, now that the
3638         function returns `bool'.
3639
3640 2004-06-08  Paul Eggert  <eggert@cs.ucla.edu>
3641
3642         Adjust chmod and chown to be similar if -c or -v are given.  In
3643         particular, a no-op chown is no longer reported as a change; this
3644         reverts to previous behavior.  Also, fix both commands so that -v
3645         report failures even if the failure is not due to the chmod or
3646         chown syscalls.
3647
3648         * src/chmod.c (CH_NOT_APPLIED): New constant.
3649         (describe_change): Handle it.
3650         (process_file): Use it, if a symlink wasn't changed.
3651         (mode_changed): Return bool, not int.  Accept new argument
3652         NEW_MODE; all callers changed.  This lets us avoid statting the
3653         file unless the new mode has unusual bits.
3654         (process_file): Return -1 on error.  With -v, report all errors
3655         verbosely, not just some.
3656
3657         * src/chown-core.c (change_file_owner): Return -1 on error, not
3658         1 sometimes and -1 on others.  Our caller ORs together our results,
3659         and (-1 | 1) == 0 on ones-complement hosts.
3660         With -v report all errors verbosely, not just some.
3661         Fix bug when chopt->root_dev_ino && !chopt->affect_symlink_referent:
3662         file_stats wasn't set properly in that case.
3663
3664         * tests/chgrp/basic: Adjust to above changes.
3665
3666 2004-05-20  Paul Eggert  <eggert@cs.ucla.edu>
3667
3668         * tests/chgrp/basic: Test that chgrp -h does not fail on
3669         symlinks, even on hosts where that's not supported.
3670         Test that if -R is specified without -H or L, -h is assumed.
3671         Test that chown() is not optimized away.
3672
3673 2004-05-18  Paul Eggert  <eggert@cs.ucla.edu>
3674
3675         Several fixes to chgrp and chown for compatibility with POSIX and BSD:
3676
3677           Check for incompatible options.  When -R and --dereference are
3678           both used, then either -H or -L must also be used.  When -R and -h
3679           are both used, then -P must be in effect.
3680
3681           -H, -L, and -P have no effect unless -R is also specified.
3682           If -P and -R are both specified, -h is assumed.
3683
3684           Do not optimize away the chown() system call when the file's owner
3685           and group already have the desired value.  This optimization was
3686           incorrect, as it failed to updated the last-changed time and reset
3687           special permission bits, as POSIX requires.
3688
3689           Do not report an error if the owner or group of a
3690           recursively-encountered symbolic link cannot be updated because
3691           the file system does not support it.
3692
3693         * NEWS: Document the above.
3694
3695         * src/chgrp.c (main): Check for incompatible options.  -R --dereference
3696         requires either -H or -L, and -R -h requires -P.  If -H, specify
3697         FTS_PHYSICAL as well as FTS_COMFOLLOW; this is faster.  Make this
3698         file as much like chown.c as possible.
3699         * src/chown.c (main): Likewise.
3700
3701         * src/chown-core.c (change_file_owner): Use ent->fts_statp only if
3702         needed.  Chown a directory only after chowning its children; this
3703         avoids problems if the new directory ownership doesn't permit
3704         access to the children.  Dereference symlinks before doing
3705         ROOT_DEV_INO_CHECK, not after, so that we catch symlinks to /.
3706         Do not optimize away the chown() system call when the file's owner
3707         and group already have the desired value.  POSIX does not permit
3708         this optimization.  Rely on chown and lchown to do the right
3709         thing with symlinks and/or -1 arguments, now that we have wrappers
3710         to do this.  Use ENOTSUPP not ENOSYS, and ignore all ENOTSUPP
3711         errors, not just command-line errors.
3712         (chown_files): Pass FTS_NOSTAT to xfts_open if we don't need file status.
3713
3714         * src/system.h (ENOTSUP): Remove.
3715
3716         * tests/chgrp/basic: Use chown --from to discover whether the
3717         group changed, since chgrp now changes unconditionally.  This
3718         complicates the sed script a bit.  Do not specify --dereference,
3719         since it's the default (and we want to test this).  Adjust output
3720         to match the fact that chgrp no longer optimizes the case of
3721         changing a file's group to the same value as before.
3722         * tests/chgrp/posix-H: Do not attempt to combine -h and -H; these
3723         options are incompatible, and their behavior is undefined with POSIX.
3724         (changed, not_changed): Adjust to match the fact that -h is no longer
3725         specified.  Sort names.
3726         * tests/chown/deref: Adjust error-diagnostic spelling to match new
3727         behavior.
3728
3729 2004-06-07  Paul Eggert  <eggert@cs.ucla.edu>
3730
3731         * src/uname.c (main): Fix typo introduced on 2003-05-10 that
3732         prevented a diagnostic of any operands.
3733
3734 2004-06-08  Jim Meyering  <jim@meyering.net>
3735
3736         * src/shred.c (direct_mode): Turn it on/off with directio, too.
3737
3738 2004-06-07  Jim Meyering  <jim@meyering.net>
3739
3740         Enable direct-mode I/O (bypassing the buffer cache), if possible.
3741         Prompted by a suggestion from Kalle Olavi Niemitalo
3742         in http://bugs.debian.org/207035.
3743         * src/shred.c (direct_mode): New function.
3744         (do_wipefd): Turn on direct-mode I/O.
3745         (dopass): If a file's first write fails with EINVAL,
3746         turn off direct-mode I/O and retry the write.
3747
3748 2004-06-05  Paul Eggert  <eggert@cs.ucla.edu>
3749
3750         * src/tr.c (main): "tr -d a b" is now a fatal error even if
3751         POSIXLY_CORRECT is set.  The POSIX SYNOPSIS does not allow this
3752         option combination.
3753
3754 2004-06-04  Paul Eggert  <eggert@cs.ucla.edu>
3755
3756         * src/shred.c (dopass): Don't subtract 1 from the offset after
3757         a write error.  Problem reported by Jon Peatfield in:
3758         http://lists.gnu.org/archive/html/bug-coreutils/2004-06/msg00020.html
3759
3760 2004-06-02  Paul Eggert  <eggert@cs.ucla.edu>
3761
3762         Fix bug reported by Buciuman Adrian in
3763         <http://mail.gnu.org/archive/html/bug-coreutils/2003-08/msg00105.html>
3764         where 'dd' created a file that was too large.  The bug was that dd
3765         assumed that the input file offset does not advance after a failed
3766         read; but POSIX says that the input file offset is undefined after
3767         a failed read.
3768
3769         * src/dd.c (MAX_BLOCKSIZE): New macro.
3770         (input_seekable, input_seek_errno, input_offset,
3771         input_offset_overflow): New vars.
3772         (scanargs): Reject block sizes greater than MAX_BLOCKSIZE.
3773         (advance_input_offset): New function.
3774         (skip_via_lseek): Set errno to zero when reporting our failure,
3775         so that we don't report based on garbage errno.
3776         (skip): If fdesc is standard input, advance the input offset.
3777         Do not quit if reading, and if noerror was specified;
3778         POSIX seems to require this.
3779         If read fails on output file, report the earlier lseek failure
3780         instead; this fixes a FIXME in dd_copy.
3781         (advance_input_after_read_error): New function.
3782         (dd_copy): Use it, instead of assuming that failed reads
3783         do not advance the file pointer.  Advance input offset
3784         after nonfailed reads.  Advance only a partial block if
3785         the previous read (before the failed read) succeeded, and
3786         do not generate an output block of zeros in this case.
3787         (main): Determine initial input offset, seekability of input,
3788         and error if it wasn't seekable.
3789
3790 2004-06-02  Jim Meyering  <jim@meyering.net>
3791
3792         rm (without -f) could hang unnecessarily when attempting to
3793         remove a symlink to a file on an off-line NFS-mounted partition.
3794         Reported by David Howells in https://bugzilla.redhat.com/124699.
3795         * src/remove.c (write_protected_non_symlink): New function.
3796         Don't invoke euidaccess on symlinks.
3797         (prompt): Use write_protected_non_symlink rather than using
3798         euidaccess directly, being careful not to call lstat twice for a file.
3799
3800         Fix a bug in how the --output-delimiter=D option works with
3801         abutting byte or character ranges.  Reported by David Krider in
3802         http://lists.gnu.org/archive/html/bug-coreutils/2004-05/msg00132.html
3803         * src/cut.c (print_kth): Remove special case for open-ended range.
3804         (set_fields): Record the range start index for an interval even
3805         when it abuts another interval on its low side.
3806         Also record the range start index of the longest right-open-interval.
3807         * tests/cut/Test.pm: Add tests of --output-delimiter=S with
3808         abutting and overlapping byte ranges.
3809
3810 2004-06-01  Paul Eggert  <eggert@cs.ucla.edu>
3811
3812         Some POSIX-conformance cleanups for tr.
3813
3814         * src/tr.c (posix_pedantic): Remove; no longer needed since
3815         we need to test this in just one place now.
3816         (usage): Mention -C.
3817         (unquote): Note that \055, \n, etc are escaped.
3818         Do not worry about POSIXLY_CORRECT when warning about ambiguous
3819         escape sequences.
3820         \ at end of string stands for itself.
3821         Do not diagnose invalid backslash escapes: POSIX says the behavior
3822         is unspecified in this case, so we don't need to diagnose it.
3823         (main): Add support for -C (currently an alias for -c).
3824         Do not diagnose 'tr [:upper:] [:upper:], as POSIX does not require
3825         a diagnostic here.
3826         * tests/tr/Test.pm: New tests bs-055, bs-at-end, repeat-Compl.
3827         Fix comment for range-a-a.
3828
3829 2004-05-25  Paul Eggert  <eggert@cs.ucla.edu>
3830
3831         Improve the efficiency (and in one case, correctness) of code
3832         that reads symlinks.
3833
3834         * src/copy.c (copy_internal): Don't use alloca, as it can mess up
3835         royally if the link length is long (e.g., GNU/Hurd).  Use
3836         xreadlink instead, it's safer.  Don't bother to read the link if
3837         it's the wrong size.  Add a FIXME because this area is a bit murky
3838         and undocumented.
3839         * src/ls.c (get_link_name): Update use of xreadlink.
3840         * src/readlink.c (main): Likewise.
3841         * src/stat.c (print_stat): Likewise.
3842
3843 2004-06-01  Jim Meyering  <jim@meyering.net>
3844
3845         * src/env.c (main): Prefer the notation `STREQ (a, b)'
3846         over `!strcmp (a, b)'.
3847         * src/sort.c (main, sort_buffer_size): Prefer the notation
3848         `STREQ (a, b)' over `strcmp (a, b) == 0'.
3849         * src/date.c (batch_convert): Likewise.
3850         * src/expr.c (nextarg): Likewise.
3851         * src/su.c (correct_password, restricted_shell, main): Likewise.
3852         * src/ptx.c (swallow_file_in_memory, main): Likewise.
3853         * src/test.c (binary_operator, and, or, main): Likewise.
3854
3855 2004-05-13  Paul Eggert  <eggert@cs.ucla.edu>
3856
3857         * NEWS: echo compatibility cleanup.
3858         * doc/coreutils.texi (echo invocation): Document the changes.
3859         * src/echo.c (V9_ECHO): Remove; always enabled.
3860         (DEFAULT_ECHO_TO_XPG): Renamed from V9_DEFAULT, so that
3861         we use the same naming convention as bash.  Now an enum,
3862         not a macro.
3863         (usage): Reword to mention -e/-E more accurately.
3864         Mention \0NNN (the POSIX syntax) rather than \NNN (nonstandard).
3865         (hextobin): New function.
3866         (main): Use bool rather than int for local vars when appropriate.
3867         Do not allow options if POSIXLY_CORRECT, unless we are using
3868         BSD semantics and the first argument is "-n".
3869         Don't pass unnecessary extra arg to parse_long_options.
3870         do_v9 now defaults to DEFAULT_ECHO_TO_XPG, not to allow_options.
3871         Do not look for options if !allow_options.
3872         Use size_t rather than int when appropriate.
3873         Open-code option test rather than using strrchr.
3874         Use faster test for "-".
3875         Avoid redundant argc test.
3876         Add support for \x, for Bash compatibility.
3877         Use e.g. '\a' rather than '\007', for portability to EBCDIC hosts.
3878         When '\c' is encountered, stop printing immediately, as POSIX
3879         requires.
3880         Add support for \xhh syntax.
3881         Add support for \0ooo syntax; POSIX requires this.
3882
3883 2004-06-01  Jim Meyering  <jim@meyering.net>
3884
3885         * Use automake-1.8b.  Regenerate dependent files.
3886
3887 2004-05-31  Jim Meyering  <jim@meyering.net>
3888
3889         * tests/Makefile.am.in (TESTS_ENVIRONMENT): Define PATH to include
3890         the build src/ directory -- at the front.
3891         ($(srcdir)/$x-tests): Depend on Makefile.am.
3892         Use $x as the program name, except when it would be `test' (test is
3893         the sole program tested via mk-script that is also a shell built-in).
3894         In that case, use the old ../../src/$x.
3895
3896 2004-05-30  Jim Meyering  <jim@meyering.net>
3897
3898         Work around HPUX /bin/cc compiler bug that is exposed, now that
3899         sets are arrays of type `bool'.  More details here:
3900         http://lists.gnu.org/archive/html/bug-gnulib/2004-05/msg00094.html
3901         FIXME: verify that the above URL points to the right message
3902
3903         * src/tr.c (card_of_complement): Use cleaner `sizeof in_set'
3904         rather than `N_CHARS * sizeof(in_set[0])'.  Using HPUX's /bin/cc
3905         (aC++/ANSI C B3910B A.05.55 [Dec 04 2003]) on an ia64-hp-hpux11.22
3906         system, those two expressions are not the same (256 vs. 1024).
3907         The effect of this problem was that `tr -c x y' would fail:
3908         tr: when not truncating set1, string2 must be non-empty
3909         (set_initialize): Remove unnecessary initialization of the `in_set'
3910         buffer; that initialization triggered the same compiler bug as above.
3911
3912 2004-05-29  Paul Eggert  <eggert@cs.ucla.edu>
3913
3914         tr cleanup, mostly having to do with integer type ranges.
3915         Remove all casts.
3916
3917         * tests/tr/Test.pm: Add a few tests for the below.  Alas, most of
3918         the test cases wouldn't be portable, or would take too much CPU
3919         time, or both.
3920
3921         * src/tr.c (N_CHARS, N_CHAR_CLASSES): Now an enum, not a macro.
3922         This is safe since the code already assumes N_CHARS fits in int.
3923         (Filter): Remove: we want to prototype everything.
3924         (ORD, CHR): Remove.  All uses removed.  Some replaced with:
3925         (uchar): New function.  All places where a char must be converted
3926         to an unsigned char are now done this way, not by ad-hoc methods.
3927         (count): New type.  Use it whenever counts or states are needed.
3928         (BEGIN_STATE): Increase from INT_MAX - 1 (which was bogus, anyway,
3929         since we used it in an unsigned int context) to UINTMAX_MAX - 1.
3930         (REPEAT_COUNT_MAXIMUM): New macro.  Use it in place of BEGIN_STATE
3931         whenever appropriate.
3932         (NOT_A_CHAR): Remove global macro; now a local enum.
3933         (UL_LOWER, UL_UPPER, UL_NONE): No longer specify values, since
3934         the rest of the code no longer depends on them.
3935         (class_ok): Remove; all uses changed to use inline comparisons.
3936         (RE_NO_TYPE): Remove; wasn't used or needed.
3937         (struct List_element): normal_char and equiv_code are now unsigned
3938         char, not int.
3939         first_char, last_char, and the_repeated_char are now unsigned char,
3940         not unsigned int.  repeat_count is now count, not size_t.
3941         All uses changed.
3942         (struct Spec_list): state is now count, not unsigned int.
3943         lengthis now count, not size_t.
3944         n_indefinite_repeats is now size_t, not int.
3945         has_equiv_class, has_char_class, and has_restricted_char_class
3946         are now bool, not int.  All uses changed.
3947         (struct E_string): s is now char *, not unsigned char *.
3948         escaped is now bool *, not int *.  All uses changed.
3949         (ES_MATCH): Remove macro, replacing with:
3950         (es_match): New inline function.  All uses changed.
3951         (squeeze_repeats, complement, posix_pedantic, truncate_set1,
3952         translating): Now bool, not int.
3953         (io_buf): Now char array, not unsigned char.
3954         (SET_TYPE): Remove.  All uses replaced with bool.
3955         (is_equiv_class_member, unquote, append_range, append_char_class,
3956         append_equiv_class, find_closing_delim, star_digits_closebracket,
3957         build_spec_list, parse_str, homogeneous_spec_list):
3958         Now returns bool, not int.  All uses changed.
3959         (is_equiv_class_member): Now inline.
3960         (is_equiv_class_member, is_char_class_member, make_printable_str,
3961         append_normal_char, append_range, append_repeated_char,
3962         get_s2_spec_stats):
3963         Args are now of proper integer type.
3964         (unquote, look_up_char_class, make_printable_str,
3965         append_equiv_class, build_spec_list, squeeze_filter):
3966         Avoid unsigned char *p; gently convert *p to unsigned char instead.
3967         (unquote, get_spec_stats): Do not jump past declarations and then
3968         use them; C doesn't allow this in portable programs.
3969         (make_printable_str): Check for overflow in size calculations.
3970         (xmemdup): Remove.  All uses rewritten.
3971         (find_bracketed_repeat): Args are now of proper pointer-to-integer
3972         type.  Do not reject [c*0].  Use xstrtoumax, not xstrtoul.
3973         (find_bracketed_repeat, star_digits_closebracket): Check that the
3974         digits are not escaped.
3975         (build_spec_list): Don't bother to copy opnd_str; not needed.
3976         (build_spec_list, get_next): Simplify internal logic a bit.
3977         (card_of_complement): Fix bug due to char overflow.
3978         (get_spec_stats): Don't assume len fits into int.
3979         Check for integer overflow.  Use abort() rather than assert(0).
3980         (string2_extend): Fix subscript error: is_char_class_member (..., 255)
3981         was being invoked.
3982         (squeeze_filter): READER is never null now; simplify code.
3983         READER arg now has a simpler type.  Remove unnecessary casts.
3984         (squeeze_filter, main): Calls to fwrite improperly checked result
3985         against zero, rather than against requested size.
3986         (plain_read): New function.
3987         (read_and_delete, read_and_xlate):
3988         Remove unused filter arg, and don't worry about hit_eof.
3989         Simplify by using plain_read.
3990         (set_initialize): Args are bool and bool *, not int and SET_TYPE *.
3991         (main): Always pass a non-null procedure to squeeze_filter.
3992         Rewrite so that class_ok isn't needed.
3993
3994 2004-05-29  Paul Eggert  <eggert@cs.ucla.edu>
3995
3996         * src/shred.c (dosync): Ignore EBADF errors, as IRIX 6.5
3997         fdatasync reports EBADF when syncing (unwritable) directories.
3998         Problem reported by Albert Chin-A-Young in:
3999         http://lists.gnu.org/archive/html/bug-coreutils/2004-05/msg00165.html
4000
4001 2004-05-29  Jim Meyering  <jim@meyering.net>
4002
4003         * tests/chown/deref: Fix typo: use ls -ldo, not ls -ldg.
4004         Patch from Albert Chin.
4005
4006         * src/ptx.c (text_buffer_maxend): Remove declaration of unused variable.
4007
4008         * src/remove.c (push_dir): Merge declaration and adjacent assignment
4009         into a single statement.
4010
4011 2004-05-28  Jim Meyering  <jim@meyering.net>
4012
4013         * src/remove.c (AD_mark_helper): Eliminate an unnecessary comparison.
4014
4015 2004-05-22  Jim Meyering  <jim@meyering.net>
4016
4017         rm -r would get a failed assertion when run from an inaccessible
4018         directory and with two or more command line arguments including an
4019         absolute-named directory followed by a relative-named directory.
4020
4021         * src/remove.h (struct rm_options) [require_restore_cwd]: New member.
4022         * src/remove.c (struct cwd_state): Define.
4023         (AD_pop_and_chdir): Redesign interface so that a restore_cwd failure
4024         can be detected by the caller.  Instead of returning a malloc'd
4025         directory name, communicate it to caller via a new parameter, and
4026         return an indication of whether restore_cwd failed.  Update caller.
4027         Eliminate an unnecessary call to AC_stack_top.
4028         (remove_dir): Change type of cwd_state parameter to `struct cwd_state'
4029         so we can now communicate to caller whether/how functions like
4030         restore_cwd have failed.  Update caller.
4031         (rm_1): Fail if we've failed to restore the working directory
4032         and the name of the next file to remove is `.'-relative.
4033         (rm): Fail if the require_restore_cwd flag is true and we've
4034         failed to restore the working directory.
4035         * src/mv.c (rm_option_init): Initialize new member,
4036         x->require_restore_cwd.
4037         * src/rm.c (rm_option_init): Likewise.
4038
4039 2004-05-21  Jim Meyering  <jim@meyering.net>
4040
4041         * tests/rm/inaccessible: New test for the above fix.
4042         * tests/rm/Makefile.am (TESTS): Add inaccessible.
4043
4044         * src/remove.c (rm): Use free rather than XFREE.
4045         (remove_dir): Use xmalloc, not XMALLOC.
4046         (ds_init): Likewise.
4047
4048 2004-05-20  Jim Meyering  <jim@meyering.net>
4049
4050         * Makefile.maint (sc_unmarked_diagnostics): Now that the unmarked
4051         diagnostics in shred.c have been fixed, don't exempt shred.c from
4052         this check.
4053
4054         * src/shred.c: Use translatable diagnostics, e.g.
4055         change "%s: remove" to _("%s: failed to remove") and
4056         change "%s: close"  to _("%s: failed to close").
4057
4058 2004-05-17  Paul Eggert  <eggert@cs.ucla.edu>
4059
4060         * src/shred.c (names): Bring back lower-case letters, "_", and
4061         ".".  But continue to omit +, =, %, @, #, as they're either
4062         shell metacharacters (for some shells) or are not in some
4063         character sets, or (in the case of '%') must be a
4064         metacharacter somewhere.
4065
4066 2004-05-16  Paul Eggert  <eggert@cs.ucla.edu>
4067
4068         * src/cut.c (cut_fields): Adjust to new signature of getndelim2.
4069
4070 2004-05-17  Jim Meyering  <jim@meyering.net>
4071
4072         * src/shred.c (incname): Decrement `len' only once per loop iteration.
4073
4074         chgrp and chown now dereference symlinks by default, per POSIX.
4075         Reported by Michal Politowski as http://bugs.debian.org/249177.
4076
4077         * src/chown-core.c (chopt_init): Affect each symlink referent by default.
4078         * src/chown.c (usage): Update to reflect this.
4079         * src/chgrp.c (usage): Likewise.
4080         * NEWS: Describe the change.
4081         Adapt tests accordingly.
4082         * tests/chgrp/basic: Use -h where necessary to retain semantics.
4083         * tests/chgrp/deref: Likewise.
4084         * tests/chgrp/posix-H: Likewise.
4085
4086 2004-05-15  Paul Eggert  <eggert@cs.ucla.edu>
4087
4088         In shred, check for errors from fdatasync more carefully.  If
4089         fdatasync fails with errno==EINVAL, it means this implementation
4090         does not support synchronized I/O for this file.  Do not report
4091         this as an error, as (for example) AIX 5.2 fdatasync reports it
4092         for raw disk devices.  Problem reported by Albert Chin in
4093         <http://mail.gnu.org/archive/html/bug-gnu-utils/2004-05/msg00028.html>.
4094
4095         Check for write errors, though: the old code ignored them.
4096         Improve error checking in a few other cases, too (e.g., close of a
4097         directory).
4098
4099         Also, change several 'int' values to 'bool', so that the error
4100         checking is a bit clearer.  Similarly, change unsigned values
4101         to size_t where appropriate.
4102
4103         * src/shred.c: Include "dirname.h".
4104         (datasync) [!HAVE_FDATASYNC]: Remove.
4105         (dosync): New function.
4106         (dopass): Use it.  Return 1 on write error, -1 on other error.
4107         All callers changed.  Report write error if dosync does.
4108         (do_wipefd, wipefd, wipename, wipefile): Return bool (true/false),
4109         not int (0/-1).  All callers changed.  Return false if there's a
4110         write error.
4111         (incname): Return bool (true/false), not int (0/1).  Accept
4112         size_t length, not unsigned.  All callers changed.  Do not
4113         bother checking for non-digits; it can't happen.  Replace
4114         recursion with iteration.
4115         (wipename): Use dir_name, base_name, etc. instead of assuming
4116         Unix file names.  Use size_t for length, not unsigned.
4117         Report error if unlink or close fails.
4118         (wipename, main): Use bool for booleans.
4119
4120         (names): Use only digits and uppercase letters, for greater
4121         portability.
4122
4123 2004-05-16  Jim Meyering  <jim@meyering.net>
4124
4125         * tests/chown/deref: New test for the yesterday's change.
4126         * tests/chown/Makefile.am (TESTS): Add deref.
4127
4128 2004-05-15  Jim Meyering  <jim@meyering.net>
4129
4130         chown --dereference did nothing when the owner/group of a
4131         symlink matched the desired owner/group.  Reported by David Malone.
4132         Also reported in 1999 as http://bugs.debian.org/39642.
4133
4134         * src/chown-core.c (change_file_owner): When --dereference has
4135         been specified, and when processing a symlink, stat it to get the
4136         owner and group of the referent.
4137
4138 2004-05-14  Jim Meyering  <jim@meyering.net>
4139
4140         * man/pwd.x, man/echo.x, man/printf.x: Fix typo:
4141         s/supercede/supersede/ reported by Andrew Fabbro.
4142
4143 2004-05-13  Paul Eggert  <eggert@cs.ucla.edu>
4144
4145         Improve performance of `sort -m' on large files, at the cost of
4146         making some contrived examples unsafe.  POSIX allows this
4147         optimization.  Performance problem reported by Jonathan Baker in
4148         <http://mail.gnu.org/archive/html/bug-coreutils/2004-05/msg00071.html>.
4149
4150         * src/sort.c (first_same_file): Do not treat input pipes
4151         differently from other files.
4152         * doc/coreutils.texi (sort invocation): Document that "sort -m -o F"
4153         might write F before reading all the input.
4154         * NEWS: Likewise.
4155
4156 2004-05-12  Paul Eggert  <eggert@cs.ucla.edu>
4157
4158         * src/od.c (print_ascii, dump_strings): Use e.g. '\a' rather than
4159         '\007', for portability to EBCDIC hosts.
4160         * src/printf.c (print_esc_char): Likewise.
4161         * src/tr.c (unquote, make_printable_str): Likewise.
4162
4163 2004-05-12  Jim Meyering  <jim@meyering.net>
4164
4165         * src/remove.c (AD_pop_and_chdir): Move lstat-`.' into if-block
4166         where the result is used.  This avoids one unnecessary lstat call
4167         per command line argument.
4168
4169 2004-05-12  Paul Eggert  <eggert@cs.ucla.edu>
4170
4171         Don't assume that "make -C" works; Solaris "make" doesn't have -C.
4172
4173         * src/Makefile.am (all_programs.list): New rule, copied from
4174         man/Makefile.am and tests/Makefile.am, except that we use the
4175         system tr rather than ./tr and we don't use tr -s.
4176         * tests/Makefile.am (all_programs): Use it.
4177         * man/Makefile.am (all_programs): Likewise.  Renamed from programs,
4178         for consistency.  All uses changed.
4179
4180 2004-05-11  Jim Meyering  <jim@meyering.net>
4181
4182         * tests/rm/unread3: New test, for the above fix and today's
4183         lib/save-cwd.c improvement.
4184         * tests/rm/Makefile.am (TESTS): Add unread3.
4185
4186         * src/rm.c: Don't include "save-cwd.h".  It's no longer used.
4187
4188 2004-05-10  Jim Meyering  <jim@meyering.net>
4189
4190         * tests/install/trap: New file.  Test for bug fix of 2004-04-18.
4191         * tests/install/Makefile.am (TESTS): Add trap.
4192
4193         * src/remove.c (AD_push): Don't use errno in diagnostic about
4194         `changed dev/ino'.
4195
4196         Remove these generated files from CVS.
4197         * tests/cut/cut-tests, tests/date/date-tests, tests/join/join-tests:
4198         * tests/ls/ls-tests, tests/pr/pr-tests, tests/tac/tac-tests:
4199         * tests/tail/tail-tests, tests/test/test-tests, tests/tr/range-tests:
4200         * tests/tr/tr-tests, tests/wc/wc-tests:
4201
4202 2004-05-09  Jim Meyering  <jim@meyering.net>
4203
4204         * src/tr.c (unquote): Use xcalloc rather than xmalloc and
4205         a loop initializing the just-allocated memory to zero.
4206
4207 2004-05-08  Jim Meyering  <jim@meyering.net>
4208
4209         * tests/rm/no-give-up: New file; check for today's fix.
4210         * tests/rm/Makefile.am (TESTS): Add no-give-up.
4211
4212 2004-05-08  Paul Eggert  <eggert@cs.ucla.edu>
4213
4214         Fix bug where "rm" gave up too easily, reported by Dan Jacobsen in
4215         <http://mail.gnu.org/archive/html/bug-coreutils/2004-05/msg00013.html>.
4216
4217         * src/remove.c (remove_entry): Check for errno values like ENOENT
4218         that show the file cannot be directory, instead of for errno
4219         values like EPERM that show the file might be a directory.  This
4220         is necessary because, when a single unlink() call has multiple
4221         reasons to fail, it can set errno to any of those reasons; it's
4222         only the rare errno value like ENOENT that excludes all the other
4223         possible reasons to fail even when the file is a directory.
4224         (remove_cwd_entries): Don't attempt chdir if the file is known
4225         to not be a directory.
4226         (remove_dir): Use the same method that remove_cwd_entries uses
4227         (for some reason they differed).  Don't assert that saved_errno
4228         must be EPERM; it might be just about anything.
4229
4230 2004-05-06  Jim Meyering  <jim@meyering.net>
4231
4232         * src/id.c (xgetgroups): Use xnmalloc, rather than xmalloc.
4233         Don't add `1' to the buffer size (it was to protect against malloc
4234         implementations that fail to allocate a buffer of size zero).
4235         That is no longer necessary, since we use a malloc wrapper
4236         on such systems.
4237
4238         * src/wc.c (get_input_fstatus): Use xnmalloc, rather than xmalloc.
4239         * src/head.c (elide_tail_bytes_pipe): Likewise.
4240         * src/df.c (main): Likewise.
4241         * src/shred.c (do_wipefd): Likewise.
4242         * src/users.c (list_entries_users): Likewise.
4243         * src/tail.c (main): Likewise.
4244         * src/md5sum.c (main): Likewise.
4245
4246 2004-04-29  Paul Eggert  <eggert@cs.ucla.edu>
4247
4248         * src/df.c (show_disk, show_point): If several filesystems are
4249         mounted on the same mount point, prefer the last one, not the first.
4250         Problem reported by Christian Jones in
4251         <http://mail.gnu.org/archive/html/bug-coreutils/2004-04/msg00200.html>.
4252         (show_disk): Remove unused statp arg.  Return bool, not int.
4253         (show_point): Rewrite to avoid gotos.  Use the same algorithm
4254         for lofs and dummies for each pass through the mount table,
4255         rather than subtly different algorithms (which are probably
4256         inadvertent).
4257
4258 2004-05-03  Jim Meyering  <jim@meyering.net>
4259
4260         * Makefile.am (EXTRA_DIST): Add m4/ChangeLog, now that we no longer
4261         have m4/Makefile*.
4262
4263 2004-05-01  Jim Meyering  <jim@meyering.net>
4264
4265         When chown or chgrp is modifying the referent of a symlink,
4266         use the chown(2) function, if possible.
4267         * src/chown-core.c (change_file_owner): Don't hard-code the
4268         open/fchown/close kludge here.  Use `chown' instead.
4269         The chown function works just fine on conforming systems.
4270         Other systems now go through the new chown wrapper that
4271         resorts to the old kludge.
4272
4273         * src/chown-core.c (change_file_owner): Add a comment.
4274
4275 2004-04-27  Jim Meyering  <jim@meyering.net>
4276
4277         * src/ptx.c: Make over 40 global extern variables `static'.
4278         (syntax_table, re_syntax_table): Remove declarations of two unused
4279         variables (they were exposed by the above change).
4280
4281         * src/du.c (G_fail, opt_nul_terminate_output): Declare `static'.
4282         * src/ln.c (backup_type): Likewise.
4283
4284         * src/remove.c (rm): Add `extern' keyword.
4285         * src/cp-hash.c (forget_created, remember_created)
4286         (src_to_dest_lookup, remember_copied, hash_init, forget_all): Likewise.
4287         * src/copy.c (dest_info_init, src_info_init, copy): Likewise.
4288         * src/chown-core.c (chopt_init, chopt_free, gid_to_name)
4289         (uid_to_name, chown_files): Likewise.
4290
4291         * src/Makefile.am (sc_tight_scope): New rule.
4292         * Makefile.maint (sc_tight_scope): New rule.
4293         (syntax-check-rules): Add it.
4294
4295 2004-04-26  Jim Meyering  <jim@meyering.net>
4296
4297         * Use automake-1.8.4.  Regenerate dependent files.
4298
4299         * src/sort.c (limfield): Make a comment clearer.
4300
4301 2004-04-25  Paul Eggert  <eggert@twinsun.com>
4302
4303         Fix POSIX-conformance bug: "sort -k 3,3.5b" is supposed to skip
4304         leading blanks when computing the location of the field end;
4305         it is not supposed to skip trailing blanks.  Solaris 8 "sort"
4306         does conform to POSIX.  Also fix the documentation to clarify
4307         this and related issues.
4308
4309         * doc/coreutils.texi (sort invocation): Mention -k earlier, so
4310         that the options are in alphabetical order.  Describe how -b works
4311         more-accurately; this involves fixing some examples, too.  Mention
4312         what happens if the start field falls after an end field or after
4313         a line end.  Warn about using -k without -b, -g, -M, -n, or -t.
4314         Add an example of how to sort IPv4 addresses and Apache Common
4315         Log Format dates.  Remove a duplicate example.
4316         (Putting the tools together): Use separate options rather
4317         than agglomerating them.
4318         * src/sort.c (limfield): Use skipeblanks, not skipsblanks, to
4319         decode whether to skip leading blanks.
4320         (trailing_blanks): Remove.
4321         (fillbuf, getmonth, keycompare): Don't trim trailing blanks.
4322
4323         * tests/pr/Test.pm: Fix typo in env_default comment.
4324         * tests/sort/Test.pm: Likewise.
4325         (18c, 18d): Reverse the order of output lines, so that the
4326         test cases conform to POSIX.
4327
4328 2004-04-22  Paul Eggert  <eggert@twinsun.com>
4329
4330         More signal-handling cleanup for ls.c.  Do not allow signals to
4331         happen between arbitrary output bytes, as the
4332         restore-default-color sequence can bollix up multibyte chars or
4333         color-change sequences in the ordinary output.  Instead, process
4334         signals only between printing a file name and changing the color
4335         back to non_filename_text color.  That way, if the signal handler
4336         changes the color (to the default), 'ls' will change it back when
4337         'ls' continues (after being suspended).
4338
4339         Also, do not bother with signal-handling unless stdout is a
4340         controlling terminal; this lets stdio buffer better when "ls
4341         --color" is piped or sent to a file.
4342
4343         * src/ls.c (sigprocmask, sigset_t) [!defined SA_NOCLDSTOP]: New macros.
4344         Do not include "full-write.h"; no longer needed.
4345         (tcgetpgrp) [! HAVE_TCGETPGRP]: New macro.
4346         (put_indicator_direct): Remove.  All callers changed to use
4347         put_indicator.
4348         (caught_signals, interrupt_signal, stop_signal_count): New vars.
4349         (restore_default_color): Don't bother checking for put_indicator
4350         failure.
4351         (sighandler): Don't handle SIGTSTP; that's another handler now.
4352         Simply set interrupt_signal to the signal, then exit.
4353         (stophandler, process_signals): New functions.
4354         (main): Don't output any color changes until _after_ the signal
4355         handlers are set up.  This fixes a race condition where 'ls'
4356         could be interrupted while initializing colors, and leaving the
4357         terminal in an undesirable state.
4358         Don't mess with signal-handling if standard output is not a
4359         controlling terminal.
4360         When exiting, restore the default color, then restore the
4361         default signal handling, then act on any signals that weren't
4362         acted on yet.
4363         Do not print //DIRED// etc. in colors; this avoids the need
4364         to catch signals when printing them.
4365         (print_name_with_quoting): Process signals just before switching
4366         color back to non_filename_text.
4367
4368 2004-04-23  Jim Meyering  <jim@meyering.net>
4369
4370         Avoid segfault on systems for which SIZE_MAX != (size_t) -1.
4371         * src/ls.c (quote_name): Use SIZE_MAX, not -1, in calls
4372         of quotearg_buffer.  Patch by Mikulas Patocka.
4373
4374 2004-04-18  Paul Eggert  <eggert@twinsun.com>
4375
4376         tee ignored SIGPIPE, but POSIX doesn't allow this.
4377
4378         * src/tee.c (main): Do not ignore SIGPIPE, as POSIX 1003.1-2001
4379         does not allow this.  This undoes the 1996-10-24 patch.
4380
4381 2004-04-18  Paul Eggert  <eggert@twinsun.com>
4382
4383         Signal-handling cleanup for coreutils.  Here are the highlights:
4384
4385          - csplit sometimes failed to remove files when interrupted.
4386          - csplit didn't clean up if two signals arrived nearly simultaneously.
4387          - install -s would infloop on System V if SIGCHLD was ignored.
4388          - ls could incorrectly restore color if multiple signals
4389            arrived nearly simultaneously.
4390
4391         * src/csplit.c (sigprocmask, sigset_t) [!defined SA_NOCLDSTOP]:
4392         Define.
4393         (filename_space, prefix, suffix, digits, files_created, remove_files):
4394         Now volatile.
4395         (caught_signals): New var.
4396         (cleanup): Block signals while deleting all files.
4397         (cleanup_fatal, handle_line_error, regexp_error):
4398         Mark with ATTRIBUTE_NORETURN.
4399         (create_output_file, close_output_file, interrupt_handler):
4400         Block signals while changing the number of output files,
4401         to fix some race conditions.
4402         (delete_all_files): Do nothing if remove_files is zero.
4403         Clear files_created.
4404         (main): Don't mess with signals until after argument processing
4405         is done.
4406
4407         * src/csplit.c (main): Rewrite signal-catching code to make it
4408         similar to other coreutils programs.  When processing signals,
4409         block all signals that we catch, but do not block signals that we
4410         don't catch.  Avoid problems with unsigned int warnings.
4411         * src/ls.c (main): Likewise.
4412         * src/sort.c (main): Likewise.
4413
4414         * src/csplit.c (interrupt_handler):
4415         Use void, not (obsolete) RETSIGTYPE.
4416         * src/shred.c (sigill_handler, isaac_seed_machdep): Likewise.
4417
4418         * src/csplit.c (interrupt_handler) [defined SA_NOCLDSTOP]:
4419         Use simpler "signal (sig, SIG_DFL)" rather than sigaction equivalent.
4420         * src/ls.c (sighandler) [defined SA_NOCLDSTOP]: Likewise.
4421         * src/sort.c (sighandler) [defined SA_NOCLDSTOP]: Likewise.
4422         * src/nohup.c (main) [!defined _POSIX_SOURCE]: Likewise, except
4423         for SIG_IGN.
4424         * src/tee.c (main) [!defined _POSIX_SOURCE]: Likewise.
4425
4426         * src/install.c: Include <signal.h>.
4427         (main) [defined SIGCHLD]: Set SIGCHLD handler to the default, if -s is
4428         given, since System V fork+wait does not work if SIGCHLD is ignored.
4429
4430         * src/ls.c (sighandler) [!defined SA_NOCLDSTOP]: Reset signal
4431         handler to self, not to SIG_IGN, since SIGTSTP can be received
4432         more than once.
4433         (main): Use SA_RESTART, as that is simpler than checking for EINTR
4434         failures all over the place.
4435
4436 2004-04-20  Jim Meyering  <jim@meyering.net>
4437
4438         * src/remove.c (is_empty_dir): Clarify comment.
4439
4440         * man/help2man: Accept new option: --program-name=NAME, so that we
4441         can override the one in --version output.  This is needed solely
4442         so that test.1 doesn't refer to `[' as the program name.
4443         Reported by Benjamin Cutler as http://bugs.debian.org/205251.
4444         * man/Makefile.am (.x.1): Use help2man's new --program-name option.
4445
4446         * src/pwd.c: Don't include pathmax.h; system.h already does it.
4447
4448         * src/cut.c (cut_fields): Free buffer upon getndelim2 failure.
4449
4450 2004-04-19  Jim Meyering  <jim@meyering.net>
4451
4452         * src/shred.c (isaac_seed_start) [AVOID_USED_UNINITIALIZED_WARNINGS]:
4453         Initialize a buffer to avoid warnings from tools like valgrind.
4454
4455         * Makefile.maint (sc_trailing_blank): New rule.
4456         (syntax-check-rules): Add it.
4457         * .x-sc_trailing_blank: New file.
4458
4459         Make pwd work even if the resulting name is so long that getcwd fails.
4460         * src/pwd.c: (path_free, path_init, path_prepend): New functions.
4461         (nth_parent, find_dir_entry, robust_getcwd): New functions.
4462         (main): First try getcwd, then, upon failure, robust_getcwd.
4463
4464 2004-04-18  Jim Meyering  <jim@meyering.net>
4465
4466         * src/who.c (print_user): Use xrealloc here, rather than
4467         unchecked realloc.  Remove anachronistic casts.
4468
4469         * src/remove.c (full_filename_): Don't leak upon failed realloc.
4470
4471         * src/system.h (readdir_ignoring_dot_and_dotdot): New inline function,
4472         from remove.c.
4473         * src/remove.c (readdir_ignoring_dotdirs): Move function to system.h,
4474         renaming it.  Update uses.
4475
4476 2004-04-17  Jim Meyering  <jim@meyering.net>
4477
4478         * configure.ac: Depend on automake-1.8.3.
4479
4480         * src/join.c (add_file_name): Declare function to be `static'.
4481         (string_to_join_field): Likewise.
4482         * src/remove.c (ds_init, ds_free): Likewise.
4483
4484         * Makefile.maint (sc_prohibit_jm_in_m4): New rule.
4485         (syntax-check-rules): Add to the list.
4486
4487 2004-04-13  Paul Eggert  <eggert@twinsun.com>
4488
4489         Use page-aligned buffers whenever we bother to do I/O using buffer
4490         sizes that are tailored for the files.
4491
4492         * src/cat.c: Include getpagesize.h.
4493         * src/copy.c: Likewise.
4494         * src/shred.c: Likewise.
4495         * src/split.c: Likewise.
4496         * src/cat.c (main): Align I/O buffers to page boundaries.
4497         * src/copy.c (copy_reg): Likewise.
4498         * src/shred.c (dopass): Likewise.
4499         * src/split.c (main): Likewise.
4500         * src/dd.c (ROUND_UP_OFFSET, PTR_ALIGN): Remove.
4501         All uses replaced by ptr_align.
4502         * src/od.c (gcd, lcm): Remove; now in system.h.
4503         * src/system.h (gcd, lcm, ptr_align): New functions, moved from od.c.
4504
4505 2004-04-14  Jim Meyering  <jim@meyering.net>
4506
4507         Remove m4/Makefile.am: it's no longer needed, with newer automake
4508         * configure.ac (AC_CONFIG_FILES): Remove m4/Makefile.in from the list.
4509         * Makefile.am (SUBDIRS): Remove `m4' from the list.
4510
4511 2004-04-13  Jim Meyering  <jim@meyering.net>
4512
4513         * configure.ac: Change `jm_' in AC_DEFINE'd names to `gl_'.
4514
4515 2004-03-27  Paul Eggert  <eggert@twinsun.com>
4516
4517         * NEWS: cp -pu and mv -u (when copying) now take the destination
4518         file system time stamp resolution into account.
4519         * doc/coreutils.texi (mv invocation): Document this.
4520         (cp invocation): Document -u (it was missing!) with new behavior.
4521
4522         * src/copy.c: Include "utimecmp.h".
4523         (copy_internal): Compare time stamps using utimecmp rather than
4524         MTIME_CMP.
4525
4526 2004-04-09  Jim Meyering  <jim@meyering.net>
4527
4528         * Makefile.maint (.re-list): New rule/file, to replace
4529         hard-coded list of header file names.
4530         (sc_system_h_headers): Use the new file.
4531         Don't look for sys2.h anymore.
4532
4533         * src/system.h: Include new "stat-macros.h" rather than hard-coding
4534         all of its macro definitions -- the list was slightly out of date.
4535         Suggestion from Dmitry V. Levin.
4536
4537 2004-04-08  Paul Eggert  <eggert@cs.ucla.edu>
4538
4539         * NEWS: Remove noctty flag from dd.  Suggested by Philippe Troin.
4540         * doc/coreutils.texi (dd invocation): Likewise.
4541         * src/shred.c (O_NOCTTY): Remove redundant decl.
4542         * src/dd.c (flags, usage): Remove noctty flag.
4543         (main): Always use O_NOCTTY when opening files.
4544
4545 2004-04-08  Jim Meyering  <jim@meyering.net>
4546
4547         * src/dd.c (dd_copy): Mark two diagnostics for translations.
4548         (set_fd_flags): Undo part of today's change: it's a little
4549         cleaner -- and more efficient in the common case -- to go
4550         ahead and OR in the -1 when fcntl fails.
4551
4552         * Makefile.maint (sc_dd_max_sym_length): New target.
4553         (syntax-check-rules): Add it.
4554
4555         * src/md5sum.c (PROGRAM_NAME) [algorithm == ALG_SHA1]:
4556         Correct spelling: s/shasum/sha1sum.  Reported by Jesse Kornblum.
4557
4558         * src/dd.c (set_fd_flags): Don't OR in -1 when fcntl fails.
4559         Rename parameter, flags, to avoid shadowing global.
4560         (LONGEST_SYMBOL): Tweak comment.
4561
4562 2004-04-07  Paul Eggert  <eggert@twinsun.com>
4563
4564         * NEWS: New dd conv= symbols nocreat, excl, fdatasync, fsync,
4565         and new dd options iflag= and oflag=.
4566         * src/dd.c (usage): Likewise.
4567         * src/Makefile.am (dd_LDADD, shred_LDADD): Add fdatasync's lib.
4568         * src/dd.c (fdatasync) [!HAVE_FDATASYNC]: New macro.
4569         (C_NOCREAT, C_EXCL, C_FDATASYNC, C_FSYNC): New macros.
4570         (input_flags, output_flags): New vars.
4571         (LONGEST_SYMBOL): New macro.
4572         (struct symbol_value): Renamed from struct conversion.  Members
4573         symbol and value renamed from convname and conversion.  The
4574         symbol value is now an array instead of a pointer; this saves
4575         a bit of space and time in practice.  All uses changed.
4576         (conversions): Add nocreat, excl, fdatasync, fsync.  Now const.
4577         (flags): New constant array.
4578         (iflag_error_msgid, oflag_error_msgid): New constants.
4579         (parse_symbols): Renamed from parse_conversion and generalized
4580         to handle either conversion or flag symbols.
4581         (scanargs): Adjust uses of parse_symbols accodingly.  Add
4582         support for iflag= and oflag=.  Reject attempts to use
4583         both excl and nocreat.
4584         (set_fd_flags): New function.
4585         (dd_copy): Just return X rather than calling quit (X), since our
4586         caller invokes quit with the returned value.  Add support for
4587         fdatasync and fsync.
4588         (main): Add support for iflag=, oflag=, and new conv= symbols.
4589         * src/system.h (O_DIRECT, O_DSYNC, O_NDELAY, O_NOFOLLOW,
4590         O_RSYNC, O_SYNC): Define to 0 if not already defined.
4591
4592         * NEWS: Remove duplicate mention of BLOCKSIZE.
4593
4594 2004-04-02  Andreas Schwab  <schwab@suse.de>
4595
4596         * src/stty.c: Add support for IUTF8 input flag.
4597
4598 2004-04-06  Jim Meyering  <jim@meyering.net>
4599
4600         * src/system.h (makedev) [mkdev && !makedev]: Define in terms of mkdev.
4601         Interix spells it `mkdev'.  Reported by Mark Funkenhauser.
4602
4603 2004-04-04  Jim Meyering  <jim@meyering.net>
4604
4605         A specified format is no longer automatically newline terminated.
4606         If you want a newline at the end of your format, use `\n'.
4607         * src/stat.c (print_it): Don't print a newline at the end of
4608         every format.
4609         (do_statfs): Add a newline at end of each default format string.
4610
4611 2004-03-30  Paul Eggert  <eggert@twinsun.com>
4612
4613         * src/nohup.c (main): Adjust to new calling convention
4614         for set_cloexec_flag.
4615
4616 2004-03-31  Jim Meyering  <jim@meyering.net>
4617
4618         * tests/Fetish.pm (run_tests): Remove `.orig' file.
4619         Remove debugging diagnostic.
4620
4621         Specifying an invalid --width=N (-w) or --gap-size=N (-g)
4622         would not elicit an error.
4623         * src/ptx.c: Include "xstrtol.h" and "quotearg.h".
4624         (main): Don't use atoi.  Use xstrtoul instead.
4625
4626 2004-03-30  Jim Meyering  <jim@meyering.net>
4627
4628         * Makefile.maint (sc_prohibit_atoi_atof): New rule.
4629         (syntax-check-rules): Add it.
4630         * .x-sc_prohibit_atoi_atof: New file.
4631
4632 2004-03-29  Jim Meyering  <jim@meyering.net>
4633
4634         * tests/du/files0-from: Use new OUT_SUBST directive, so that this
4635         test is not sensitive to system-dependent block size differences.
4636         Prompted by a report of Solaris 8 differences from Paul Eggert.
4637
4638         * tests/Fetish.pm: Accept new directives: OUT_SUBST, ERR_SUBST.
4639         Rename `%tmp' to `%actual'.  Reverse order of last two args to
4640         _compare_files (to $actual, $expected) so as to match declaration.
4641
4642 2004-03-28  Paul Eggert  <eggert@twinsun.com>
4643
4644         Fix some gotchas encountered when porting to Solaris 8, using
4645         the Forte 6u2 compiler.
4646
4647         * src/hostname.c [HAVE_SETHOSTNAME && !defined sethostname]:
4648         Declare sethostname, since no Solaris header does it.
4649         * src/who.c: Include "vasprintf.h", for asprintf.
4650
4651 2004-03-28  Jim Meyering  <jim@meyering.net>
4652
4653         Minor optimization:
4654         * src/du.c (process_file): Don't record dev/inode for directories.
4655
4656         Under some circumstances, without -c, du would mistakenly count the
4657         space of hard-linked files, not just the first one it encountered.
4658         Reported by Anthony Thyssen.
4659         * src/du.c (du_files): Don't ever clear the set of `seen' dev/inodes.
4660
4661         * src/du.c: Rename global `print_totals' to `print_grand_total'.
4662
4663         * src/du.c (main): Rearrange filtering loop to be a tiny bit
4664         more efficient.
4665
4666         * src/chown-core.c: Don't include savedir.h -- no longer needed.
4667         * src/chmod.c: Likewise.
4668
4669 2004-03-25  Jim Meyering  <jim@meyering.net>
4670
4671         * src/du.c (main): Remove now-unused declaration of `i'.
4672
4673 2004-03-24  Paul Eggert  <eggert@twinsun.com>
4674
4675         * src/du.c (main): Filter out file names of length zero before
4676         invoking fts, so that they don't cause fatal errors.
4677
4678 2004-03-25  Jim Meyering  <jim@meyering.net>
4679
4680         * tests/du/files0-from (zero-len): Add a test for the above.
4681
4682 2004-02-25  Paul Eggert  <eggert@twinsun.com>
4683
4684         * NEWS: New environment var BLOCKSIZE.
4685         * lib/human.c (humblock): Support BLOCKSIZE as well as BLOCK_SIZE.
4686         * tests/envvar-check: Test for it.  Factor the code to simplify it.
4687
4688 2004-03-23  Paul Eggert  <eggert@twinsun.com>
4689
4690         * NEWS: Shorten the du --files0-from announcement, and say
4691         "NUL-terminated" rather than "NUL-separated".
4692         * src/du.c (EXPECTED_BYTES_PER_FILE_NAME, DEFAULT_PROJECTED_N_FILES):
4693         Remove: not used.
4694         (usage): Say "NUL-terminated", not "NUL-separated".
4695         (main): Check for I/O error when istream is closed.
4696         Allow --files0-from=F even if F is empty; this specifies no files.
4697         (du_files): Now that we allow the list of files to be empty,
4698         handle that case.
4699         * tests/du/files0-from: Adjust to above changes to src/du.c.
4700
4701 2004-03-24  Jim Meyering  <jim@meyering.net>
4702
4703         * tests/tail-2/assert: Avoid race condition that could cause
4704         spurious failure.  Based on a patch from Andreas Schwab.
4705
4706 2004-03-23  Jim Meyering  <jim@meyering.net>
4707
4708         * src/du.c (main): Free the hash table, too.
4709
4710 2004-03-22  Jim Meyering  <jim@meyering.net>
4711
4712         * man/Makefile.am (.x.1): Remove --info-page= option, reverting
4713         the change of 2004-01-22.  I can no longer reproduce the problem
4714         that prompted that change, and `info coreutils pr' would display the
4715         `printing text' section of the manual, not the one on `pr invocation'.
4716
4717         * tests/du/files0-from (nul-1, nul-2): Adjust expected diagnostics
4718         to match corrected output.
4719
4720         * src/du.c: Include "readtokens0.h" rather than "readtokens.h".
4721         (main): Use readtoken0 functions rather than readtokens.
4722         Don't use errno when diagnosing readtokens0 failure.
4723         Fix off-by-one error in the token number reported in a diagnostic.
4724         (du_files): Return bool, rather than int.
4725         (main): Call readtokens0_free.
4726
4727 2004-03-21  Jim Meyering  <jim@meyering.net>
4728
4729         * src/remove.c (ds_free): Plug a small leak.
4730
4731         * tests/Fetish.pm: Fix typo in comment.
4732
4733 2004-03-07  Jim Meyering  <jim@meyering.net>
4734
4735         * NEWS: du accepts a new option --files0-from=FILE, where FILE
4736         contains a list of NUL-separated file names.
4737
4738         * src/du.c: Include "readtokens.h".
4739         (usage): Describe the new option, and adjust the `Usage':
4740         with this option, no FILE may be specified on the command line.
4741         (main): Handle the new option.
4742
4743         * tests/du/files0-from: New tests, for the above.
4744         * tests/du/Makefile.am (TESTS): Add files0-from.
4745
4746         * src/factor.c (do_stdin): Reflect changes in use of readtoken.
4747         * src/tsort.c (tsort): Likewise.
4748
4749 2004-02-29  Paul Eggert  <eggert@twinsun.com>
4750
4751         * NEWS: Add support for a new notation @N to get_date to represent
4752         the time stamp with numeric value N.  Improve support for
4753         fractional time stamps.  date's -d and -f options now accept them.
4754         Likewise for touch -t.  date has a new option --iso-8601=ns.
4755
4756         * doc/coreutils.texi (touch invocation):
4757         Describe use of fractional seconds.
4758         (date invocation, Options for date): Likewise.
4759         * doc/getdate.texi (General date syntax, Time of day items): Likewise.
4760         * doc/coreutils.texi (date invocation): Mention effect of LC_TIME.
4761         (Options for date): Describe new --iso-8601=ns option.
4762
4763         * doc/getdate.texi: Add copyright notice.  Change getdate to
4764         get_date when talking about the function name.
4765         (Seconds since the Epoch): New section, containing the time_t
4766         info moved from Date input formats section, along with new
4767         info about the @ syntax.  Mention negative time stamps,
4768         fractional time stamps, and leap seconds.
4769         (General date syntax): Modernize examples a bit to reflect new
4770         features.
4771         (General date syntax, Relative items in date strings):
4772         Use ' rather than " to quote formats.
4773         (Time of day items): Add an example with fractional seconds.
4774         Describe fractional-second syntax.
4775
4776         * src/Makefile.am (touch_LDADD): New macro, since `touch' now
4777         needs clock_gettime.
4778
4779         * src/date.c (enum Time_spec): New enum TIME_SPEC_NS.
4780         (time_spec_string, time_spec, show_date): Support it.
4781         (usage): Remove description of -ITIMESPEC, as it's obsolete and
4782         confusing.  Mention --iso-8601=ns.
4783         (batch_convert): getline returns ssize_t, not int.
4784
4785         * src/touch.c (newtime): Now an array of two timespecs, one
4786         for access and one for modification.
4787         (ref_stats): Remove.
4788         (get_reldate): Use get_date's parameter profile.
4789         (touch, main): Adjust to above changes.
4790         (main): Work even if tm_year == INT_MAX (so long as long int is wider).
4791         Use gettime instead of gettimeofday, for new get_date signature.
4792
4793         * tests/date/Test.pm (test_vector): New tests epoch, ns-10, ns-max32,
4794         ns-relative.
4795
4796 2004-03-15  Jim Meyering  <jim@meyering.net>
4797
4798         * Makefile.maint (alpha beta major): `Make' the emit_upload_commands
4799         target before updating $(prev_version_file).
4800
4801         * tests/misc/date-sec: New file, to test for just-fixed bug in date.
4802         See today's change in lib/getdate.y.
4803         * tests/misc/Makefile.am (TESTS): Add date-sec.
4804
4805 2004-03-14  Jim Meyering  <jim@meyering.net>
4806
4807         * announce-gen (print_changelog_deltas): Use `.sig' suffix for
4808         signature files, not `.asc'.  Reported by angico@yahoo.com.
4809
4810 2004-03-13  Jim Meyering  <jim@meyering.net>
4811
4812         * src/cp.c (do_copy): Tweak wording in a diagnostic.
4813         Suggestion from Karl Berry.
4814         Include "quoatearg.h".
4815         (do_copy): Use quotearg_colon (not quote) for diagnostics
4816         that begin with `"%s:'.
4817
4818         * src/nl.c (usage): Specify that nl uses _basic_ regular expressions.
4819         Suggestion from Dan Jacobson.
4820
4821 2004-03-12  Jim Meyering  <jim@meyering.net>
4822
4823         * Version 5.2.1.
4824
4825         Sometimes, when source and destination partition are different,
4826         mv mistakenly fails to preserve a hard link.  Reported by IIDA Yosiaki.
4827
4828         * src/copy.c: When moving a set of N hard-linked files between
4829         partitions, via two or more command line arguments where the
4830         command line argument containing the Nth link contains no other
4831         link to that same file, mv would mistakenly copy the file, rather
4832         than hard-linking it to the other(s).  That happens because when the
4833         final link is processed, its link count has been reduced to 1 since
4834         the other links have been `copied' to the destination partition
4835         and the source links have been removed.
4836         (copy_internal): When in move mode, use the source dev/inode
4837         pair to look up destination name even when st_nlink == 1.
4838         * src/cp-hash.c (src_to_dest_lookup): New function.
4839         * src/cp-hash.h (src_to_dest_lookup): Add prototype.
4840         * tests/mv/part-hardlink: New file.  Test for the above fix.
4841         * tests/mv/Makefile.am (TESTS): Add part-hardlink.
4842
4843         * announce-gen: Sync with autoconf.
4844
4845         * tests/ls/time-1: Exit 77 (not 1) if we can't set up for the test.
4846         This was triggered on a Linux-2.2.19 system using a file system
4847         NFS-mounted from some sort of Sun.
4848
4849 2004-03-11  Jim Meyering  <jim@meyering.net>
4850
4851         * Use automake-1.8.3.  Regenerate dependent files.
4852
4853 2004-03-10  Jim Meyering  <jim@meyering.net>
4854
4855         * tests/du/deref-args: Also convert sizes in the 70-79 kB range,
4856         so that this test works with SELinux-enabled systems.
4857         Based on a patch from Tim Waugh.
4858
4859         `join -1 x' would give a misleading diagnostic
4860         * src/join.c (string_to_join_field): Report that a non-numeric field
4861         number is invalid, rather than `so large that it is not representable'.
4862         * tests/join/Test.pm (invalid-j): New partial test for the above fix.
4863
4864 2004-03-06  Jim Meyering  <jim@meyering.net>
4865
4866         cp --sparse=always sparse-image-file.img /dev/hda1 could
4867         produce an invalid copy on the destination device.
4868
4869         * src/copy.c (copy_reg): Even with --sparse=always, try to
4870         make `holes' only if the destination is a regular file.
4871         Reported by Szakacsits Szabolcs.
4872
4873 2004-03-03  Paul Eggert  <eggert@twinsun.com>
4874
4875         * src/nohup.c (main): Don't invoke set_cloexec_flag with
4876         a file descriptor of -1.
4877
4878 2004-03-02  Dmitry V. Levin  <ldv@altlinux.org>
4879
4880         * src/nohup.c: Include "cloexec.h".
4881         (main): Set the copy of stderr to close on exec.
4882
4883 2004-03-01  Paul Eggert  <eggert@twinsun.com>
4884
4885         * configure.ac: Include <signal.h> when checking for strsignal,
4886         sys_siglist, and friends.  Problem reported by Tony Leneis in
4887         <http://mail.gnu.org/archive/html/bug-coreutils/2004-02/msg00136.html>.
4888
4889 2004-02-25  Paul Eggert  <eggert@twinsun.com>
4890
4891         * tests/du/deref-args, tests/du/exclude, tests/du/slash:
4892         * tests/du/trailing-slash: Run envvar-check in case BLOCK_SIZE
4893         etc. are set.
4894
4895 2004-02-23  Paul Eggert  <eggert@twinsun.com>
4896
4897         * NEWS: Document how chown's USER.GROUP argument is now parsed.
4898
4899 2004-02-23  Jim Meyering  <jim@meyering.net>
4900
4901         * src/seq.c (usage): Remove stray space after \n in --help output.
4902
4903 2004-02-22  Jim Meyering  <jim@meyering.net>
4904
4905         * src/du.c (usage): Separate -H and --si.  Say that the meaning
4906         of -H will soon change to that of --dereference-args (-D).
4907
4908 2004-02-21  Jim Meyering  <jim@meyering.net>
4909
4910         * src/comm.c (usage): Tell what comm does when there are no options.
4911         Reword in terms of FILE1 and FILE2 rather than `left file' and
4912         `right file'.  Suggestion from Dan Jacobson.
4913
4914 2004-02-15  Paul Eggert  <eggert@twinsun.com>
4915
4916         Fix some POSIX-conformance bugs in expr.
4917
4918         * NEWS: document the following changes to src/expr.c.
4919         * doc/coreutils.texi (expr invocation): Likewise.
4920         Document what forms integers may take, and say "integer"
4921         consistently instead of "number".  Warn about operands
4922         that "expr" can misinterpret, and how to work around the
4923         problem.
4924         * src/expr.c (eval, eval7, eval6, eval5, eval4, eval3, eval2, eval1):
4925         Accept a bool argument specifying whether to evaluate the
4926         expression.  This is to allow short-circuit evaluation.  All
4927         callers changed.
4928         (null): Report that a string is zero even if it has
4929         a form like "-0" or "00".
4930         (eval1, eval): Use short-circuit evaluation for | and &.
4931         (eval): Return 0 if both arguments are null or zero, instead
4932         of returning the first argument.
4933         * tests/expr/basic: Add some tests for the above.
4934
4935 2004-02-17  Jim Meyering  <jim@meyering.net>
4936
4937         * Version 5.2.0.
4938
4939         `make check' from a build inside a chroot environment would fail
4940         * tests/help-version: Specify an argument (`/') for df, in the
4941         unusual event that there is no valid entry in /etc/mtab.
4942         Likewise for id: add the -u option, so we don't get spurious
4943         failures when there are no user or group names.
4944         Patch by Tim Waugh.
4945
4946         * src/sort.c (usage) [-u]: Add punctuation so that the description in
4947         the help2man-generated (line-joined) man page is more readable.
4948         Reported by Tim Waugh.
4949         [-T]: Add a semicolon, for the same reason.
4950
4951 2004-02-15  Jim Meyering  <jim@meyering.net>
4952
4953         * Makefile.am (dist-hook): Qualify target with $(srcdir)/ prefix.
4954
4955 2004-02-11  Jim Meyering  <jim@meyering.net>
4956
4957         * tests/Makefile.am.in ($(srcdir)/Makefile.am): Use more portable
4958         $(srcdir)/../Makefile.am.in, rather than $<.
4959         Suggestion from Michael Elizabeth Chastain.
4960
4961 2004-02-10  Jim Meyering  <jim@meyering.net>
4962
4963         * config/install-sh: Make this script executable.
4964         * Makefile.am (dist-hook): New target, to ensure that config/install-sh
4965         is executable.  Otherwise, on systems that lack a suitable install
4966         binary, `make install' would fail, because of the way this script
4967         is invoked (without `$SHELL ' prefix).
4968         Reported by Bob Proulx.
4969
4970 2004-02-08  Jim Meyering  <jim@meyering.net>
4971
4972         * Version 5.1.3.
4973
4974         * tests/rm/rm5: Avoid triggering a bug in OSF/Tru64's sed
4975         that would cause an unwarranted test failure.
4976         * tests/rm/rm3: Likewise.
4977
4978 2004-02-07  Jim Meyering  <jim@meyering.net>
4979
4980         Remove xstat function pointer member.  The way it was used was not
4981         portable, since some systems (OSF V5.1, Solaris 2.5.1) provide static
4982         inline `stat' and `lstat' functions, thus making the tests of
4983         `xstat == lstat' in copy.c always fail.
4984         * src/copy.h (struct cp_options) [xstat]: Remove member.
4985         (XSTAT): New macro.
4986         * src/copy.c (copy_dir): Set `.dereference' member, not .xstat.
4987         (copy_internal): Use `XSTAT (x, ...)' in place of `*(x->xstat) (...)'.
4988         Use `x->dereference == DEREF_NEVER' in place of `x->xstat == lstat'.
4989         (valid_options): Remove now-obsolete FIXME comments.
4990
4991         * src/cp.c (re_protect): Use `XSTAT (x, ...)' in place of
4992         `*(x->xstat) (...)'.
4993         (do_copy): Declare/use local xstat rather than x->xstat.
4994         (main): Remove code that set x.xstat.
4995         * src/mv.c (cp_option_init): Don't initialize xstat member.
4996         * src/install.c (cp_option_init): Likewise.
4997
4998         * Makefile.cfg (gnu_ftp_host-alpha, etc.): Un-factor .gnu.org suffix,
4999         so that emit_upload_commands can use these variables, too.
5000
5001 2004-02-06  Jim Meyering  <jim@meyering.net>
5002
5003         * tests/rm/deep-1: Remove `du' stack space test.
5004         Apparently, `ulimit -s N' isn't portable enough.
5005         This test will be restored (with a guard against losing ulimit)
5006         in its own file later.
5007
5008         * tests/rm/deep-1 (deep): Remove progress-style diagnostics,
5009         since this test doesn't take long enough to merit them.
5010         Run du on $tmp (the containing dir), not $deep, the full path to leaf.
5011
5012         * Makefile.maint (signatures): Remove definition.
5013         Now, automake's gnupload handles this.
5014         (%.sig: %): Remove now-unused rule.
5015         (rel-files): Use automake's $(DIST_ARCHIVES), rather than
5016         `$(distdir).tar.bz2 $(distdir).tar.gz'.
5017         (emit-upload-commands): Adjust to use gnupload.
5018
5019 2004-02-05  Jim Meyering  <jim@meyering.net>
5020
5021         * src/system.h (ST_TIME_CMP_NS, ST_TIME_CMP): Remove definitions.
5022         (ATIME_CMP, CTIME_CMP, MTIME_CMP, TIMESPEC_NS): Likewise.
5023         Now, those are all defined in timespec.h.
5024         Include timespec.h.
5025
5026         * src/date.c: Don't include timespec.h, now that system.h does it.
5027
5028 2004-02-02  Paul Eggert  <eggert@twinsun.com>
5029
5030         Don't dump core if localtime returns NULL (possible on
5031         hosts with 64-bit time_t and 32-bit int).
5032         * src/date.c: Include "inttostr.h".
5033         (batch_convert, main):
5034         If time conversion fails, exit with nonzero status.
5035         (show_date): Return int to report conversion failure.
5036         Print the time as an int if localtime fails.
5037         * src/uptime.c: Print "??" if the current clock can't
5038         be converted by localtime.  This won't happen until the year
5039         2*31 + 1900, but we don't want to dump core even if the current
5040         clock has the wrong value.
5041
5042         * src/stat.c: Include "inttostr.h".
5043         (human_time): Print the date/time as a number of seconds since the
5044         epoch if it can't be converted by localtime.  This is better than
5045         just saying "invalid", and is consistent with what "ls" does.
5046         Don't dump core if the year has more than 48 digits; this isn't
5047         possible on any contemporary host, but we might as well do it right.
5048
5049 2004-01-31  Paul Eggert  <eggert@twinsun.com>
5050
5051         * src/stat.c (human_time): Accept time rather than
5052         pointer-to-const-time parameter, for clarity.  All callers changed.
5053
5054 2004-02-02  Jim Meyering  <jim@meyering.net>
5055
5056         * src/stat.c (do_stat): Remove extra trailing newline from
5057         default formats.  Reported by Nelson H. F. Beebe.
5058
5059         Print actual fractional seconds in time stamps, not just `.00000000'.
5060         * src/stat.c (human_time): Add and use new parameter, t_ns.
5061         (print_stat): Update callers.
5062         * src/ls.c (TIMESPEC_NS): Remove definition.
5063         * src/system.h (TIMESPEC_NS): Define here, instead, now that stat.c
5064         also uses this macro.
5065         Nelson H. F. Beebe noticed that ls --full-time printed nonzero
5066         fractional seconds for files on an XFS file system, but that stat's
5067         fractional seconds were always zero.
5068
5069 2004-01-28  Paul Eggert  <eggert@twinsun.com>
5070
5071         * src/seq.c (print_numbers): Use 'double' for loop index, not
5072         'int', to avoid problems with integer overflow.  On almost all
5073         machines 'double' works in every case where 'int' works, and
5074         it works on other cases besides.
5075
5076 2004-01-27  Jim Meyering  <jim@meyering.net>
5077
5078         * src/seq.c (usage): Mention that if INCREMENT is omitted,
5079         it defaults to 1, even when FIRST is larger than LAST.
5080         Reword so as not to exclude the possibility that INCREMENT be zero.
5081
5082 2004-01-25  Jim Meyering  <jim@meyering.net>
5083
5084         * Version 5.1.2.
5085
5086         * Makefile.maint (signatures): Comment out definition.
5087
5088 2004-01-23  Jim Meyering  <jim@meyering.net>
5089
5090         * Makefile.maint (header_regexp): Add exitfail.
5091
5092         * man/Makefile.am (EXTRA_DIST): Add help2man.
5093         Reported by Nelson H. F. Beebe.
5094
5095         * man/Makefile.am (.x.1): Prefix help2man invocation with `$(PERL) --'
5096         so it works on systems with Perl installed somewhere other than in
5097         /usr/bin.
5098
5099         * src/paste.c (paste_parallel): Declare local, chr, to be of type
5100         `int', not `char', since it must hold EOF.  This bug would make
5101         paste infloop on some systems.  Test failures reported by
5102         Nelson H. F. Beebe and Christian Krackowizer.
5103
5104 2004-01-22  Jim Meyering  <jim@meyering.net>
5105
5106         * tests/rmdir/fail-perm: New file.  Test for just-fixed rmdir bug.
5107         * tests/rmdir/Makefile.am (TESTS): Add fail-perm.
5108
5109         * man/help2man: Fix it so using --info-page='coreutils PROG' works.
5110         * man/Makefile.am (.x.1): Invoke our own (tweaked) copy of help2man.
5111         Use --info-page='coreutils PROG' option.
5112         Now, readlink.1 refers the user to `info coreutils readlink'
5113         rather than to `info readlink'.  Reported by Matt Swift.
5114
5115 2004-01-21  Paul Eggert  <eggert@twinsun.com>
5116
5117         Exit status cleanup.
5118
5119         * src/basename.c (usage): Use EXIT_SUCCESS, not 0, for clarity.
5120         * src/cat.c, src/chgrp.c, src/chmod.c, src/chown.c, src/chroot.c,
5121         * src/cksum.c, src/comm.c, src/cp.c, src/csplit.c, src/cut.c,
5122         * src/date.c, src/dd.c, src/df.c, src/dircolors.c, src/dirname.c,
5123         * src/du.c, src/echo.c, src/env.c, src/expand.c, src/expr.c,
5124         * src/factor.c, src/fmt.c, src/fold.c, src/head.c, src/hostid.c,
5125         * src/hostname.c, src/id.c, src/install.c, src/join.c, src/kill.c,
5126         * src/link.c, src/ln.c, src/logname.c, src/ls.c, src/md5sum.c,
5127         * src/mkdir.c, src/mkfifo.c, src/mknod.c, src/mv.c, src/nice.c,
5128         * src/nl.c, src/nohup.c, src/od.c, src/paste.c, src/pathchk.c,
5129         * src/pinky.c, src/pr.c, src/printenv.c, src/printf.c, src/pwd.c,
5130         * src/rm.c, src/rmdir.c, src/seq.c, src/setuidgid.c, src/shred.c,
5131         * src/sleep.c, src/sort.c, src/split.c, src/stat.c, src/stty.c,
5132         * src/su.c, src/sum.c, src/sync.c, src/tac.c, src/tail.c, src/tee.c,
5133         * src/test.c, src/touch.c, src/tr.c, src/tsort.c, src/tty.c,
5134         * src/uname.c, src/unexpand.c, src/uniq.c, src/unlink.c, src/uptime.c,
5135         * src/users.c, src/wc.c, src/who.c, src/whoami.c, src/yes.c: Likewise.
5136
5137         * src/cat.c (usage): Don't bother normalizing exit status
5138         since the arg is already the correct exit status now.
5139         * src/cksum.c, src/comm.c, src/csplit.c, src/cut.c,
5140         * src/dircolors.c, src/expand.c, src/fmt.c, src/fold.c, src/head.c,
5141         * src/join.c, src/md5sum.c, src/nl.c, src/od.c, src/paste.c,
5142         * src/pr.c, src/split.c, src/sum.c, src/tac.c, src/tail.c, src/tr.c,
5143         * src/tsort.c, unexpand.c, src/src/uniq.c, src/src/wc.c: Likewise.
5144
5145         * src/chown.c (main): Removed unused local 'fail'.
5146
5147         * src/chroot.c (CHROOT_FOUND_BUT_CANNOT_INVOKE, CHROOT_FAILURE):
5148         Remove.
5149
5150         * src/chroot.c (main): Initialize exit_failure to EXIT_FAIL.
5151         * src/env.c, src/nice.c, src/su.c: Likewise.
5152         * src/nohup.c (main): Likewise, to NOHUP_FAILURE.
5153         * src/setuidgid.c (main): Likewise, to SETUIDGID_FAILURE.
5154         * src/expr.c (main): Use initialize_exit_failure rather than
5155         setting exit_failure directly; this optimizes away redundant
5156         assignments.
5157         * src/printenv.c, src/sort.c, src/test.c, src/tty.c: Likewise.
5158
5159         * src/chroot.c (main): Exit with status 1 rather than 127
5160         if chroot itself fails, as per documentation.
5161
5162         * src/chroot.c (main): Use EXIT_ENOENT and EXIT_CANNOT_INVOKE
5163         rather than roll-your-own symbols or integers.
5164         * src/env.c (main): Likewise.
5165         * src/nohup.c (main): Likewise.
5166         * src/su.c (run_shell): Likewise.
5167
5168         * src/cp.c (exit_status): Remove static var....
5169         (main): Making it local here instead.  Use =, not |=, to set it.
5170
5171         * src/cut.c (FATAL_ERROR, main): Exit with status EXIT_FAILURE,
5172         not 2, on errors.
5173         * src/date.c (batch_convert, main): Likewise.
5174         * src/dd.c (dd_copy): Likewise.
5175         * src/pr.c (first_last_page, main, getoptarg): Likewise.
5176         * src/tr.c (main): Likewise.
5177         * src/date.c (main): Don't assume EXIT_FAILURE == 1, as
5178         POSIX doesn't require it.
5179         * src/dd.c (write_output, skip, dd_copy): Likewise.
5180         * src/df.c (main): Likewise.
5181         * src/id.c (main): Likewise.
5182         * src/install.c (main): Likewise.
5183         * src/ln.c (main): Likewise.
5184         * src/ls.c (main): Likewise.
5185         * src/mv.c (main): Likewise.
5186         * src/shred.c (main): Likewise.
5187
5188         * src/env.c (main): Exit with status 1, not 2, on errors detected
5189         by env proper.
5190         * src/hostname.c (main): Likewise.
5191         * src/nl.c (main): Likewise.
5192         * src/stty.c (main): Likewise.
5193
5194         * src/expr.c (EXPR_FAILURE): Renamed from EXPR_ERROR, for
5195         consistency with the other programs' naming conventions.
5196         All uses changed.
5197
5198         * src/factor.c (main): Do not report a usage error simply
5199         because stdin has bad numbers.
5200
5201         * src/id.c (problems): Now a boolean int, not a counter,
5202         so that we don't have to worry about int overflow.  All uses changed.
5203         * src/touch.c (err): Likewise.
5204
5205         * src/md5sum.c (main): Use int, not size_t, to store boolean int.
5206
5207         * src/mkfifo.c (main): Exit with status 1, not 4, if not implemented.
5208         * src/mknod.c: Likewise.
5209
5210         * src/nice.c (main): Exit with status EXIT_FAIL, not EXIT_FAILURE,
5211         on error; this is in case EXIT_FAILURE is unusual.
5212         * src/su.c (main): Likewise.
5213
5214         * src/nohup.c (NOHUP_FOUND_BUT_CANNOT_INVOKE): Remove; all uses
5215         changed to EXIT_CANNOT_INVOKE.
5216
5217         * src/printenv.c (PRINTENV_FAILURE): New constant.
5218         (main): Exit with status PRINTENV_FAILURE, not EXIT_FAILURE, on
5219         command-line syntax problems.
5220
5221         * src/rmdir.c (remove_parents): Don't set 'fail' to a negative number.
5222         (main): Avoid integer overflow when seeing whether errors occurred.
5223
5224         * src/seq.c (print_numbers): Now returns void, not (zero) int.
5225         All callers changed.
5226         (main): Remove unused local variable 'errs'.  Always exit successfully
5227         if we reach the end.
5228
5229         * src/setuidgid.c (SETUIDGID_FAILURE): Renamed from FAIL_STATUS,
5230         for consistency with other programs here.  All uses changed.
5231         (main): Use 'error' to exit rather than invoking 'exit' here.
5232
5233         * src/sort.c: Don't include <assert.h>.
5234         (SORT_OUT_OF_ORDER,  SORT_FAILURE): Now enums, not macros.
5235         (usage): Don't use 'assert'.
5236         (main): Remove redundant assignment to exit_failure.
5237
5238         * src/system.h (EXIT_FAIL, EXIT_CANNOT_INVOKE, EXIT_ENOENT):
5239         New enum values.
5240         (initialize_exit_failure): New inline function.
5241         Include exitfail.h here, since we refer to exit_failure.
5242         All callers changed to not include exitfail.h.
5243
5244         * src/tty.c (TTY_FAILURE, TTY_WRITE_ERROR): New enum values;
5245         substitute them for the corresponding integer constants.
5246
5247         * tests/help-version (expected_failure_status_date): Remove, as
5248         'date' is now normal.
5249         (expected_failure_status_nohup): New var.
5250
5251 2004-01-21  Jim Meyering  <jim@meyering.net>
5252
5253         * tests/touch/relative: Remove `command' syntax.
5254         Thanks to Nelson H. F. Beebe and Paul Eggert.
5255
5256         * tests/touch/relative: Test only year/month/day, not hours/min/sec,
5257         so as to avoid problems with systems using TAI clocks.
5258         Although it's no longer necessary, set TZ=UTC0 also for the
5259         initial touch command.  Reported by Paul Jarc here:
5260         http://article.gmane.org/gmane.comp.gnu.core-utils.bugs/1504
5261
5262 2004-01-20  Diego Biurrun  <diego@biurrun.de>
5263
5264         * src/dircolors.hin: Add .mov to the list of media files.
5265
5266 2004-01-19  Paul Eggert  <eggert@twinsun.com>
5267
5268         * tests/touch/relative: Use TZ=UTC0, not TZ=utc (which isn't
5269         portable).  Problem reported by Christian Krackowizer.  Also, use
5270         +0000 rather than +0 to specify a time zone, as the documentation
5271         requires four digits.
5272
5273 2004-01-19  Jim Meyering  <jim@meyering.net>
5274
5275         * tests/mv/hard-4: Run envvar-check in case SIMPLE_BACKUP_SUFFIX is set.
5276         * tests/mv/backup-is-src: Likewise.
5277         Problem reported by Peter Horst
5278
5279 2004-01-17  Jim Meyering  <jim@meyering.net>
5280
5281         * announce-gen (print_changelog_deltas): Use .sig suffix, not .asc.
5282
5283         * Version 5.1.1.
5284
5285 2003-12-15  Paul Eggert  <eggert@twinsun.com>
5286
5287         * NEWS, doc/coreutils.texi: touch -r and -d can now both be specified,
5288         with -r specifying the origin for -d.
5289         * src/touch.c (flexible_date): Remove static var.
5290         (get_reldate): New function.
5291         (main): Use it, to implement this new behavior.
5292
5293 2004-01-16  Jim Meyering  <jim@meyering.net>
5294
5295         * tests/touch/relative: New test for the above.
5296         * tests/touch/Makefile.am (TESTS): Add relative.
5297
5298 2004-01-13  Jim Meyering  <jim@meyering.net>
5299
5300         * src/system.h: Include contents of sys2.h.
5301         * src/sys2.h: Remove file.
5302         * src/Makefile.am (noinst_HEADERS): Remove sys2.h.
5303
5304         * Use automake-1.8.2.  Regenerate dependent files.
5305
5306         * Update to gettext-0.13.1.
5307         * configure.ac: Use gettext-0.13.1.
5308         * .x-sc_space_tab: Add m4/po.m4 to the list of exceptions.
5309
5310 2004-01-12  Jim Meyering  <jim@meyering.net>
5311
5312         * Makefile.maint (%.sig): Use .sig suffix rather than .asc.
5313
5314         * Makefile.maint (po-check): Ensure that cvsu works before using it.
5315         Reported by Alexandre Duret-Lutz.
5316
5317         * src/tail.c (main): Warn about following stdin only when it's a tty.
5318
5319         * configure.ac: Use gl_DEFAULT_POSIX2_VERSION.
5320
5321 2004-01-10  Jim Meyering  <jim@meyering.net>
5322
5323         * tests/misc/stat-fmt: Use backticks, not `$()' notation.
5324
5325 2004-01-09  Jim Meyering  <jim@meyering.net>
5326
5327         * configure.ac: Quote underquoted `jm_DUMMY_1' to avoid new warning.
5328
5329 2004-01-08  Jim Meyering  <jim@meyering.net>
5330
5331         * src/stat.c (human_fstype): Use %lx, not %x format for `unsigned long'.
5332         From Andreas Schwab.
5333
5334         * tests/Makefile.am (TESTS_ENVIRONMENT): Remove `/vg' (prerelease test
5335         remnant) from PATH component.  That would cause tests in this directory
5336         not to run the just-built binaries, but rather whatever happened
5337         to be in one's PATH.  Reported by Christian Krackowizer.
5338
5339 2004-01-04  Jim Meyering  <jim@meyering.net>
5340
5341         * src/csplit.c (new_control_record): Use x2nrealloc
5342         rather than xrealloc.
5343
5344         * src/cp.c (re_protect): Use ASSIGN_STRDUPA rather than
5345         alloca and strcpy.
5346         (make_path_private): Likewise.
5347
5348 2004-01-03  Jim Meyering  <jim@meyering.net>
5349
5350         * src/paste.c: Use `bool' (not int) as the type for a few
5351         global variables.
5352         (collapse_escapes): Rewrite to set globals rather than modifying
5353         its parameter.
5354         Use size_t (not int) for all counters and related index variables.
5355         (paste_parallel): Remove needless complexity of
5356         using xrealloc in the loop;  just allocate the buffers up front.
5357         Free the two temporary buffers.
5358         Move declarations of locals `down' into scope where used.
5359         (paste_serial): Remove `register' attributes.
5360         (main): Simplify delim-related code.
5361         Free `delims', now that it's malloc'd.
5362
5363 2004-01-02  Jim Meyering  <jim@meyering.net>
5364
5365         * src/chroot.c: Include "quote.h".
5366         (CHROOT_FOUND_BUT_CANNOT_INVOKE, CHROOT_FAILURE): Define.
5367         (main): Exit with status of 127, not 1, for too-few-args,
5368         chroot failure, or chdir failure.
5369         Give a better diagnostic upon execvp failure.
5370
5371         * src/du.c (usage): Mention that, with its current meaning,
5372         -H is deprecated.
5373
5374         * src/tail.c (main): Warn about following stdin when it's a tty.
5375         Fail when following by name but no names are specified.
5376
5377 2003-12-30  Jim Meyering  <jim@meyering.net>
5378
5379         * src/fold.c (main): Use memcpy, not strcpy.
5380
5381         * src/copy.c (copy_internal): Use ASSIGN_STRDUPA rather than
5382         alloca and strcpy.
5383
5384 2003-12-28  Jim Meyering  <jim@meyering.net>
5385
5386         * src/unexpand.c (n_tabs_allocated): New global.
5387         (add_tabstop): Use x2nrealloc rather than xrealloc.
5388         * src/expand.c: Likewise.
5389
5390         * tests/misc/expand: New file.
5391         * tests/misc/Makefile.am (TESTS): Add expand.
5392
5393         * src/sort.c (add_temp_dir): Use x2nrealloc rather than xrealloc.
5394         (fillbuf): Use x2nrealloc rather than xrealloc.
5395         (sort): Use xnmalloc rather than xmalloc.
5396         (main): Likewise.
5397
5398 2003-12-27  Jim Meyering  <jim@meyering.net>
5399
5400         * src/tee.c (tee): Use xnmalloc rather than xmalloc.
5401
5402 2003-12-29  Paul Eggert  <eggert@twinsun.com>
5403
5404         * NEWS: Remove support for join -j1 FIELD, -j2 FIELD, and -o LIST1
5405         LIST2 in POSIX 1003.1-2001 hosts, as required by POSIX.
5406
5407         * doc/coreutils.texi (join invocation): Remove documentation
5408         accordingly.  Document that -t makes all separators significant.
5409
5410         * src/join.c: Include posixver.h.
5411         (obsolete_usage): New var.
5412         (longopts): Put obsolete options first.
5413         (OBSOLETE_LONG_OPTIONS): New constant.
5414         (get_option, add_file_name): New functions.
5415         (main): Use them to support new behavior.
5416         (usage): Remove documentation for -j1 FIELD and -j2 FIELD.
5417         Do not mark -j FIELD as obsolescent; it is longstanding
5418         UNIX tradition and is a valid extension to POSIX.
5419
5420         * tests/join/Test.pm (tv): Avoid obsolete -o usage.
5421
5422 2003-12-28  Paul Eggert  <eggert@twinsun.com>
5423
5424         * src/join.c (add_field_list): Don't use alloca with unbounded
5425         size; just modify the argument, which is no longer const *.
5426
5427         Various other minor cleanups, mostly to avoid the need for casts.
5428
5429         (extract_field): Renamed from ADD_FIELD, as it's now a function.
5430
5431         (struct field.beg): Now char *, not unsigned char const *.  All
5432         uses changed.  It shouldn't be const since xmemcoll writes on its
5433         arguments.
5434         (extract_field): Likewise, for 2nd arg.
5435         (keycmp): Remove now-unnecessary cast of xmemcoll args.
5436
5437         (is_blank): New function, to avoid need to cast arg to unsigned char.
5438         (extract_field): Use it.
5439
5440         (xfields): Rewrite pretty much from scratch.
5441
5442         (hard_LC_COLLATE): Now bool, not int.
5443         (get_line, getseq, add_field_list): Now returns bool, not int.
5444         (decode_field_spec, add_field_list): Return true on success (not
5445         false), for consistency with the rest of the code.  All uses changed.
5446
5447         (tab): Now char, not unsigned char.  This wasn't 100% necessary
5448         but is slightly cleaner.
5449         (prjoin): Hoist (tab ? tab : ' ') expression, to help the compiler.
5450
5451         (empty_filler): Now const *.
5452
5453         (make_blank): Remove; wasn't needed.  Remove all calls.
5454         (main): Don't set uni_blank.nfields; zero is fine.
5455
5456 2003-12-27  Jim Meyering  <jim@meyering.net>
5457
5458         * src/join.c: Include "quote.h".
5459         (min, max): Remove definitions.
5460         Make a few function parameters and corresponding
5461         locals `const'.  Use bool for boolean variables.
5462         Use size_t (not int) for all counters and related index variables.
5463         (prjoin): Remove now-useless assertion.
5464         (string_to_join_field): New function.
5465         (main): Accept join fields as large as SIZE_MAX.
5466         (keycmp): Rename `min' to MIN and max to MAX.
5467
5468 2003-12-26  Jim Meyering  <jim@meyering.net>
5469
5470         fold -s didn't work on e.g., alpha-based systems.
5471         * src/fold.c (fold_file): Adjust types (int->size_t) so that using
5472         x2nrealloc works properly on systems with differing sizes for int
5473         and size_t.  Reported by Nelson Beebe.
5474
5475         * src/fold.c: Use `bool' (not int) as the type for a few
5476         global variables.
5477
5478 2003-12-23  Paul Eggert  <eggert@twinsun.com>
5479
5480         * src/ls.c (length_of_file_names_and_frills):
5481         Remove forward decl; not needed.
5482         (print_file_name_and_frills, length_of_file_name_and_frills):
5483         With -m, don't output spaces before inum or size.
5484         (print_with_commas): Don't output space just before newline.
5485
5486 2003-12-24  Jim Meyering  <jim@meyering.net>
5487
5488         * tests/ls/Makefile.am (TESTS): Add m-option.
5489         * tests/ls/m-option: New file.  Test for above fixes.
5490
5491 2003-12-20  Jim Meyering  <jim@meyering.net>
5492
5493         * Version 5.1.0.
5494
5495         * src/pr.c: Change type of global, buff_allocated, to size_t.
5496
5497         * src/join.c [struct seq]: Change types of members count and alloc
5498         from `int' to `size_t'.
5499
5500         * tests/Makefile.am (root-hint): Tweak wording.
5501
5502         * src/du.c: Accept new option (-0, --null) that makes it so each
5503         output line is NUL-terminated rather than newline-terminated.
5504
5505         * src/dd.c (apply_translations): Don't prohibit conv=unblock,sync.
5506         Reported by Volker Paul.
5507         * tests/dd/Makefile.am (TESTS): Add unblock-sync.
5508         * tests/dd/unblock-sync: New test for the above.
5509
5510 2003-12-19  Jim Meyering  <jim@meyering.net>
5511
5512         * tests/misc/nohup: Double quote back-ticked expression,
5513         in case it ends up having an unexpected value.
5514
5515         * tests/ls/no-arg: Use ls's -1 option in both runs.
5516
5517         * src/du.c (fts_debug): New global.
5518         (FTS_CROSS_CHECK, DEBUG_OPT): Define.
5519         (main): Make fts use FTS_TIGHT_CYCLE_CHECK.
5520         (main) [DU_DEBUG]: Accept -d option.
5521
5522 2003-12-18  Jim Meyering  <jim@meyering.net>
5523
5524         * src/ls.c (format_user): Increment dired_pos via two statements,
5525         `dired_pos += width; dired_pos++;' rather than one,
5526         `dired_pos += width + 1;' since the latter could conceivably overflow.
5527         (format_group): Likewise.
5528         From Paul Eggert.
5529
5530         * configure.ac: Require automake-1.8.
5531
5532 2003-12-12  Jim Meyering  <jim@meyering.net>
5533
5534         * Use automake-1.8.  Regenerate dependent files.
5535
5536 2003-12-08  Jim Meyering  <jim@meyering.net>
5537
5538         * Makefile.maint (news-date-check): New rule.
5539         (alpha beta major): Depend on it.
5540
5541 2003-12-03  Paul Eggert  <eggert@twinsun.com>
5542
5543         * NEWS: ls -l (and similar options) now adjust all columns to
5544         fit the data.  Generalized from a suggestion by Leah Q for file sizes.
5545         * src/ls.c (INODE_DIGITS, LOGIN_NAME_MAX, ID_LENGTH_MAX): Remove.
5546         (format_user_width, format_group_width, unsigned_file_size,
5547         format_group): New functions.
5548         (block_size_width): Renamed from block_size_size.
5549         (inode_number_width, nlink_width, owner_width, group_width,
5550         author_width, major_device_number_width, minor_device_number_width,
5551         file_size_width): New vars.
5552         (clear_files): Initialize them.
5553         (gobble_file): Set them.  Don't ceiling block_size_width to 7.
5554         (print_long_file): Use them.
5555         (gobble_file): Use a new local variable 'f' to make the code
5556         smaller and more consistent with other functions.
5557         (format_user): Output to stdout, not to a buffer, so that we
5558         don't have to worry about buffer overrun.  Update dired_pos.
5559         (print_long_file): Don't put owner, group, author into buffer;
5560         just print them directly.  Don't assume link counts and
5561         major and minor numbers fit into unsigned long int.
5562         * tests/cp/same-file, tests/mv/part-symlink: Don't assume that
5563         'ls' output is fixed-width.
5564
5565 2003-12-02  Jim Meyering  <jim@meyering.net>
5566
5567         * src/md5sum.c: Include sha1.h (reflect renaming: sha.h -> sha1.h.
5568
5569 2003-11-27  Jim Meyering  <jim@meyering.net>
5570
5571         * Use automake-1.7f.  Regenerate dependent files.
5572
5573 2003-11-24  Paul Eggert  <eggert@twinsun.com>
5574
5575         Parse floating-point operands and options in the C locale.
5576         POSIX requires this for printf, and we might as well be
5577         consistent elsewhere (tail, sleep, seq).
5578
5579         * src/printf.c: Remove decls of strtod, strtol, strtoul; no longer
5580         needed now that we assume C89.  Include "c-strtod.h".
5581         (xstrtod): Call c_strtod, not strtod.
5582         * src/sleep.c: Include "c-strtod.h".
5583         (main): Update xstrtod call to include new argument, c_strtod.
5584         * src/seq.c (scan_double_arg): Likewise.
5585         * src/tail.c (parse_options): Likewise.
5586
5587 2003-11-24  Jim Meyering  <jim@meyering.net>
5588
5589         * tests/rm/fail-2eperm: Handle another errno variant (HPUX, EPERM).
5590         Reported by Mark Conty.
5591
5592 2003-11-22  Jim Meyering  <jim@meyering.net>
5593
5594         * Makefile.maint (sc_xalloc_h_in_src): Remove rule.  Subsumed by...
5595         (sc_system_h_headers): Do this test only if sys2.h exists.
5596
5597 2003-11-20  Jim Meyering  <jim@meyering.net>
5598
5599         * tests/help-version: Ensure that the bug-reporting address is
5600         included in the --help output for every program.
5601         * tests/Makefile.am (TESTS_ENVIRONMENT): Add $PACKAGE_BUGREPORT.
5602
5603         * src/ptx.c (usage): Output bug-reporting address.
5604         Reported by Dan Jacobson.
5605
5606 2003-11-19  Jim Meyering  <jim@meyering.net>
5607
5608         * src/join.c (usage): Mention that FILE1 and FILE2 must be sorted
5609         on the join fields.  Suggestion from Bruce Robertson.
5610
5611 2003-11-18  Jim Meyering  <jim@meyering.net>
5612
5613         `od -c -w9999999' could segfault
5614         * src/od.c (dump): Use xnmalloc/free, not alloca.
5615
5616 2003-11-16  Jim Meyering  <jim@meyering.net>
5617
5618         * Use autoconf-2.59.  Regenerate dependent files.
5619
5620         * tests/du/hard-link: Minor tweak: use mkdir -p.
5621
5622         Fix read-from-free'd-buffer error detected by valgrind.
5623         * src/csplit.c (remove_line): Don't return a pointer to data in
5624         a freed buffer.  Instead, arrange to free the buffer on the
5625         subsequent call.
5626
5627         * tests/misc/csplit: New test for above fix.
5628
5629 2003-11-11  Jim Meyering  <jim@meyering.net>
5630
5631         * src/ls.c (extract_dirs_from_files): Avoid useless copy operations.
5632         This avoids a warning from valgrind about memcpy with overlapping
5633         source and destination.
5634
5635         * configure.ac: Require automake-1.7.8.
5636
5637 2003-11-09  Jim Meyering  <jim@meyering.net>
5638
5639         * Use automake-1.7.9.  Regenerate dependent files.
5640
5641         * src/rm.c: Support new options: --preserve-root and --no-preserve-root.
5642         * src/chown.c: Likewise.
5643
5644         * src/chown-core.c: Include "root-dev-ino.h".
5645         (chopt_init): Initialize new member.
5646         (change_file_owner): Support rm's new --preserve-root option.
5647
5648         * src/remove.c: Include "root-dev-ino.h".
5649         (remove_cwd_entries): Remove now-obsolete FIXME comment.
5650         (remove_dir): Support rm's new --preserve-root option.
5651
5652         * src/chown.c: Include "root-dev-ino.h".
5653         Add new options: --preserve-root and --no-preserve-root.
5654
5655         * src/chmod.c: Include "root-dev-ino.h".
5656         (process_file): Use newly-factored-out ROOT_DEV_INO_CHECK and
5657         ROOT_DEV_INO_WARN macros.
5658         (get_root_dev_ino): Remove function definition, now that it's
5659         been moved to a separate file.
5660         (usage): Describe new options.
5661
5662         * src/mv.c (rm_option_init): Initialized new member.
5663
5664         * src/remove.h: Include "dev-ino.h".
5665         (struct rm_options): Add new member: root_dev_ino.
5666         * src/chown-core.h: Include "dev-ino.h".
5667         (struct Chown_option): Add new member: root_dev_ino.
5668
5669 2003-11-06  Jim Meyering  <jim@meyering.net>
5670
5671         * src/paste.c (paste_parallel): Use `sizeof *var' rather than
5672         hard-coding `sizeof FILE*'.
5673
5674 2003-11-05  Dennis Smit  <ds@nerds-incorporated.org>
5675
5676         * src/wc.c (main): Free `fstatus' so there is no confusion about
5677         whether it's leaked or not.
5678         * src/who.c (who): Likewise for `utmp_buf'.
5679
5680 2003-11-05  Paul Eggert  <eggert@twinsun.com>
5681
5682         Fix 'cut' problems with size_t overflow and unsigned int.
5683         More generally, resize integer variables to fit use more precisely.
5684         * src/cut.c (ADD_RANGE_PAIR): Remove unnecessary parens.
5685         (struct range_pair): Make members to be of type size_t, not unsigned.
5686         (max_range_endpoint, eol_range_start): Now size_t, not unsigned.
5687         (suppress_non_delimited, output_delimiter_specified,
5688         have_read_stdin, print_kth, set_fields): Now bool, nt int.
5689         (delim): Now unsigned char, not int.
5690         (mark_printable_field, is_printable_field, is_range_start_index,
5691         set_fields, set_fields, cut_bytes, cut_fields):
5692         Use size_t, not unsigned, for field and byte counts.
5693         (hash_int): Use uintptr_t, not unsigned, for pointers converted
5694         to integers.  This squeezes more info out of them.
5695         (set_fields, cut_bytes, cut_fields, main):
5696         Use bool, not int, for booleans.
5697         (set_fields): Allocate zeroed byte array with xzalloc, not xcalloc.
5698
5699 2003-11-05  Paul Eggert  <eggert@twinsun.com>
5700
5701         * man/Makefile.am (check-programs-vs-x):
5702         Work even if $(programs) contains '$'.
5703         Work even if 'missing=1' in environment.
5704         Don't report an error simply because $(programs) outputs nothing.
5705
5706 2003-11-05  Jim Meyering  <jim@meyering.net>
5707
5708         * Use autoconf-2.58.  Regenerate dependent files.
5709
5710         * src/tr.c (spec_init): Fix typo in last change.
5711
5712         * src/sys2.h (case_GETOPT_VERSION_CHAR): Cast NULL to `(char *)' in
5713         call to variadic version_etc function, so that it works even on systems
5714         for which sizeof char* != sizeof int.
5715         * src/true.c (main): Likewise.
5716         * basename.c, chroot.c, cksum.c, dd.c, dirname.c, echo.c, expr.c:
5717         * factor.c, hostid.c, hostname.c, link.c, logname.c, nice.c, nohup.c:
5718         * pathchk.c, printenv.c, printf.c, pwd.c, setuidgid.c, sleep.c, stty.c:
5719         * sync.c, test.c, tsort.c, unlink.c, uptime.c, users.c, whoami.c, yes.c:
5720         Similarly, cast NULL to `(char *)' in call to variadic function,
5721         parse_long_options, so that it works even on systems for which
5722         sizeof char* != sizeof int.
5723         A similar problem was reported by Harti Brandt in
5724         http://mail.gnu.org/archive/html/bug-gnu-utils/2003-10/msg00320.html.
5725
5726         * src/users.c (users): Free `utmp_buf' explicitly so that people
5727         don't mistake this for a real leak.
5728         Patch by Dennis Smit <ds@nerds-incorporated.org.
5729
5730 2003-11-04  Paul Eggert  <eggert@twinsun.com>
5731
5732         * README: Document _POSIX2_VERSION.
5733
5734 2003-11-04  Jim Meyering  <jim@meyering.net>
5735
5736         * src/tac.c (memrchr): Remove #if-0'd function.
5737         (tac_stdin_to_mem): Clean up #if-0'd code.
5738
5739         * src/od.c (decode_format_string): Remove unnecessary casts.
5740         Use more maintainable `sizeof *var'.
5741         (main): Call decode_format_string rather than decode_one_format,
5742         now that `spec' may be NULL.
5743
5744         * src/chmod.c (AUTHORS): Add my name.
5745
5746         * src/split.c (next_file_name): Use `sizeof *var' rather than
5747         hard-coding `sizeof size_t'.
5748
5749         * src/sort.c (new_key): Use xzalloc, not xcalloc (1, ...).
5750
5751         * src/cut.c (ADD_RANGE_PAIR): Use x2nrealloc rather than xrealloc,
5752         to avoid potential overflow in pointer arithmetic.
5753         (set_fields): Use not `1', but rather `sizeof *printable_field' as
5754         second argument to xcalloc.
5755         * src/od.c (decode_format_string, dump_strings): Use x2nrealloc
5756         rather than xrealloc.
5757         * src/date.c (show_date): Likewise.
5758         * src/join.c (ADD_FIELD, initseq, getseq): Likewise.
5759         * src/pr.c (store_char): Likewise.
5760         * src/fold.c (fold_file): Likewise.
5761
5762         * src/copy.c (triple_hash, triple_hash_no_name): Adjust to reflect
5763         type changes (unsigned int -> size_t) in hash.c.
5764         * src/cp-hash.c (src_to_dest_hash): Likewise.
5765         * src/du.c (entry_hash): Likewise.
5766         * src/ls.c (dev_ino_hash): Likewise.
5767         * src/cut.c (hash_int): Likewise.  Declare function as static.
5768
5769 2003-11-03  Jim Meyering  <jim@meyering.net>
5770
5771         * tests/misc/Makefile.am (TESTS_ENVIRONMENT): Define PACKAGE_VERSION.
5772         * tests/misc/fold: Fail the test immediately if we're not running
5773         the expected version of fold.
5774
5775 2003-11-02  Jim Meyering  <jim@meyering.net>
5776
5777         * src/tr.c (append_normal_char, append_range, append_char_class)
5778         (append_repeated_char, append_equiv_class, spec_init): Use `sizeof *var'
5779         rather than `sizeof EXPLICIT_TYPE'.  The former is more maintainable
5780         and usually shorter.
5781         * src/copy.c (copy_internal): Likewise.
5782         * src/join.c (initseq, add_field, make_blank): Likewise.
5783         * src/od.c (main): Likewise.
5784         * src/cp.c (make_path_private): Likewise.
5785         * src/tsort.c (new_item, record_relation): Likewise.
5786
5787         * src/df.c (add_fs_type, add_excluded_fs_type, main): Likewise.
5788         (main): Also remove anachronistic cast of xmalloc return value.
5789         * src/ptx.c (alloc_and_compile_regex, main): Likewise.
5790         (main): Also remove anachronistic cast of xmalloc return value.
5791         * src/sort.c (inittables): Likewise.
5792         (sort): Also Split a long line.
5793
5794 2003-10-25  Jim Meyering  <jim@meyering.net>
5795
5796         * src/copy.c (triple_hash, triple_hash_no_name): Adjust to reflect
5797         type changes (unsigned int -> size_t) in hash.c.
5798         * src/cp-hash.c (src_to_dest_hash): Likewise.
5799         * src/du.c (entry_hash): Likewise.
5800         * src/ls.c (dev_ino_hash): Likewise.
5801         * src/cut.c (hash_int): Likewise.  Declare function as static.
5802
5803 2003-10-21  Jim Meyering  <jim@meyering.net>
5804
5805         Don't fail when run with VERBOSE=yes.
5806         * tests/chgrp/basic: Do `set +x' before starting the subshell
5807         from which we invoke chgrp.  Otherwise, the output from the
5808         VERBOSE=yes-induced `set -x' would result in spurious differences.
5809         Reported by Russel Coker via Michael Stone.
5810
5811 2003-10-19  Jim Meyering  <jim@meyering.net>
5812
5813         chmod now uses fts to perform a directory traversal when -R is
5814         specified.  Before, it operated on full path names, and as such
5815         would encounter the PATH_MAX (often 4096) limit.
5816
5817         * src/chmod.c: Include "xfts.h".
5818         (process_file): Rename from change_file_mode.
5819         Adapt to be used with fts.
5820         (process_files): New function.
5821
5822 2003-10-18  Jim Meyering  <jim@meyering.net>
5823
5824         * tests/du/deref-args: Ensure that du -D now dereferences all
5825         symlinks specified on the command line, not just those that
5826         reference directories.
5827
5828         * basename.c, cat.c, chroot.c, cksum.c, comm.c, cp.c, csplit.c, cut.c:
5829         * dd.c, df.c, dirname.c, du.c, echo.c, env.c, expr.c, factor.c, head.c:
5830         * hostid.c, hostname.c, id.c, link.c, ln.c, logname.c, ls.c, md5sum.c:
5831         * mv.c, nice.c, nl.c, nohup.c, paste.c, pathchk.c, pinky.c, pr.c:
5832         * printenv.c, printf.c, pwd.c, rm.c, setuidgid.c, sleep.c, sort.c:
5833         * split.c, stty.c, sum.c, sync.c, tac.c, tail.c, tee.c, test.c:
5834         * touch.c, tsort.c, uniq.c, unlink.c, uptime.c, users.c, wc.c:
5835         * who.c, whoami.c, yes.c (AUTHORS): Revert the WRITTEN_BY/AUTHORS change
5836         of 2003-09-19.  Now, AUTHORS is a comma-separated list of strings.
5837         Update the call to parse_long_options so that `AUTHORS, NULL' are the
5838         last parameters.
5839         * src/true.c (main): Append NULL to version_etc argument list.
5840         * src/sys2.h (case_GETOPT_VERSION_CHAR): Likewise.
5841
5842 2003-10-17  Andreas Schwab  <schwab@suse.de>
5843
5844         * tests/mk-script: Get $srcdir from first parameter instead of
5845         hardcoding it.
5846         (main): Update usage.
5847
5848         * tests/Makefile.am.in ($(srcdir)/$x-tests): Pass $(srcdir) as
5849         first argument of mk-script.
5850         ($(srcdir)/Makefile.am): Likewise.  Prepend $(srcdir) to target.
5851
5852 2003-10-17  Jim Meyering  <jim@meyering.net>
5853
5854         * src/mv.c (usage): Tweak descriptions of -i and -f so that the
5855         generated `man' page is more readable.  Suggestion from Dan Jacobson.
5856
5857         * src/chown-core.c (change_file_owner): Handle the cases in
5858         which fts_info indicates an error with the given entry.
5859
5860         * src/du.c (main): Simply assign to bit_flags.
5861         Don't bother with bit arithmetic.
5862
5863         * tests/chmod/no-x: New file.
5864         * tests/chgrp/no-x: New file.
5865         * tests/chmod/Makefile.am (TESTS): Add no-x.
5866         * tests/chgrp/Makefile.am (TESTS): Likewise.
5867
5868         * src/du.c: Include "xfts.h".
5869         (du_files): Use xfts_open, rather than fts_open.
5870         * src/chown-core.c (chown_files): Likewise.
5871
5872 2003-10-16  Jim Meyering  <jim@meyering.net>
5873
5874         * src/chgrp.c (main): Simply assign to bit_flags.
5875         Don't bother with bit arithmetic.
5876         * src/chown.c (main): Likewise.
5877         Rename a couple of local variables.
5878         Remove unnecessary casts.
5879
5880         * src/tail.c (start_bytes): Rename local, remainder, to avoid
5881         gcc's warning about shadowing a global.
5882
5883 2003-10-15  Jim Meyering  <jim@meyering.net>
5884
5885         chown and chgrp now accept POSIX-mandated -H, -L, -P options and
5886         use fts to perform a directory traversal when -R is specified.
5887         Before, they operated on full path names, and as such would
5888         encounter the PATH_MAX (often 4096) limit.
5889         They are more efficient.  For example, before, chgrp -R would
5890         take almost 5 seconds to change about 2000 directories and fail
5891         (with `File name too long'), while now it succeeds on a hierarchy
5892         of depth 20,000 in 1/10 the time.
5893
5894         * src/chown.c: Include "userspec.h" and "fts_.h".
5895         (WRITTEN_BY): Add my name.
5896         (getpwnam, getgrnam, getgrgid): Remove declarations.
5897         (endpwent): Remove definition.
5898         (usage): Update.
5899         (main): Handle new options.
5900         Call new function, chown_files rather than change_file_owner.
5901
5902         * src/chgrp.c: Include "fts_.h".
5903         (WRITTEN_BY): Add my name.
5904         (MAXUID, MAXGID): Remove definitions.  Use GID_T_MAX instead of
5905         the latter.
5906         (usage): Update.
5907         (main): Handle new options.
5908         Call new function, chown_files rather than change_file_owner.
5909
5910         Rewrite to iterate through hierarchies using fts rather than
5911         via explicit recursion.
5912         * src/chown-core.c: Include "fts_.h"
5913         (change_file_owner): Rewrite to use FTS* and FTSENT* and to operate
5914         on a single file at a time.
5915         (chown_files): New function.
5916         * src/chown-core.h [enum Dereference_symlink]: Remove declaration.
5917         [struct Chown_option] (recurse, force_silent): Change type to `bool'.
5918         [struct Chown_option] (dereference): Remove member with ambiguous name.
5919         [struct Chown_option] (affect_symlink_referent): New member.
5920         (chown_files): New prototype.
5921
5922         * tests/chgrp/recurse: Update tests accordingly.
5923         * tests/chgrp/posix-H: New tests for the above.
5924         * tests/chgrp/Makefile.am (TESTS): Add posix-H.
5925
5926         * src/ln.c (usage): Clarify that --directory, -d, -F probably won't
5927         work even for superuser.  Suggestion from Dan Jacobson.
5928
5929 2003-10-14  Paul Eggert  <eggert@twinsun.com>
5930
5931         Fix some number-parsing bugs, e.g., "head -n 100k@" wasn't
5932         properly diagnosed.
5933         * lib/human.c, lib/xstrtoimax.c, lib/xstrtol.c, lib/xstrtol.h,
5934         lib/xstrtoul.c, lib/xstrtoumax.c: Sync with gnulib.
5935         * src/sort.c (parse_field_count): Handle the case where overflow
5936         and invalid suffix char are both reported.
5937
5938 2003-10-14  Jim Meyering  <jim@meyering.net>
5939
5940         * src/ls.c (decode_switches) [TIOCGWINSZ]: Comment out the
5941         warning-inducing test, ws.ws_col <= SIZE_MAX, since it was always
5942         true on Linux.
5943
5944 2003-10-13  Paul Eggert  <eggert@twinsun.com>
5945
5946         Fix to avoid a denial-of-service attack if the display width is
5947         enormous.  Also, clean up the code a bit by removing duplicate code.
5948
5949         * src/ls.c (init_column_info): Remove forward decl; no longer needed.
5950         (calculate_columns): New function, that contains code that used
5951         to be common to print_many_per_line and print_horizontal.
5952         (print_many_per_line, print_horizontal): Use it.
5953         (decode_switches): Set max_idx here, not in calculate_columns.
5954         (print_current_files): Don't call init_column_info; calculate_columns
5955         now does that.
5956         (init_column_info): Don't allocate a lot more space than is needed
5957         to represent the current set of files.  Allocate all the new
5958         size_t cells in one call to xnmalloc, rather than a row at a time.
5959
5960 2003-10-13  Jim Meyering  <jim@meyering.net>
5961
5962         * src/ls.c (init_column_info): Add another FIXME comment.
5963
5964 2003-10-13  Paul Eggert  <eggert@twinsun.com>
5965
5966         Fix address-arithmetic bug in 'ls', reported by Georgi Guninski.
5967         Remove several arbitrary limits on hosts where int cannot represent
5968         all size_t values.
5969
5970         * src/ls.c (struct bin_str.len, length_of_file_name_and_frills, indent,
5971         nfiles, files_index, tabsize, line_length, struct column_info.line_len,
5972         struct column_info.col_arr[0], max_idx):
5973         Now size_t, not int.
5974         (get_funky_string): Return bool indicating success, instead of
5975         a negative count to indicate failure.  Store number of columns
5976         through new parameter OUTPUT_COUNT; that way, they can never
5977         go negative.  Change equals_end from int to bool.  All uses
5978         changed.
5979         (struct column_info.valid_len): Now bool, not int.  All uses changed.
5980         (dired_dump_obstack, get_funky_string, clear_files,
5981         extract_dirs_from_files, print_current_files,
5982         print_many_per_line, print_horizontal, init_column_info,
5983         put_indicator, length_of_file_name_and_frills,
5984         print_with_commas): Use size_t, not int, for local variables
5985         that count sizes.
5986         (decode_switches): Decode sizes using xstrtoul, not xstrtol.
5987         Check for TIOCGWINSZ returing negative values (or values greater
5988         than SIZE_MAX!).
5989         (visit_dir, main, parse_ls_color, queue_directory, add_ignore_pattern,
5990         init_column_info):
5991         Use xmalloc and xnmalloc, not XMALLOC.
5992         (gobble_file): Use xnrealloc, not XREALLOC.
5993         (print_color_indicator): Remove now-unnecessary cast to size_t.
5994
5995 2003-10-12  Paul Eggert  <eggert@twinsun.com>
5996
5997         * tests/du/no-x: Change wording of diagnostic to match latest du.c.
5998         * tests/sort/sort-tests: Remove from CVS; assume that people
5999         brave enough to check coreutils out from CVS can rebuild it.
6000
6001 2003-10-12  Jim Meyering  <jim@meyering.net>
6002
6003         New options: --preserve-root and --no-preserve-root.
6004         * src/chmod.c (change_file_mode): Honor new option.
6005         (change_file_mode): Strip trailing slashes on directory
6006         argument passed to change_dir_mode.
6007         (get_root_dev_ino): New function.
6008         (main): Initialize global, root_dev_ino.
6009
6010         * src/copy.c (copy_internal): Don't #ifdef-out simple uses of
6011         S_ISLNK or S_ISSOCK.  The S_IS* macros are guaranteed to be defined
6012         via system.h.
6013         * src/chmod.c (change_file_mode): Likewise.
6014
6015 2003-10-08  Jim Meyering  <jim@meyering.net>
6016
6017         * src/csplit.c (main): Remove obsolete FIXME.
6018
6019 2003-10-07  Jim Meyering  <jim@meyering.net>
6020
6021         * Use automake-1.7.8.  Regenerate dependent files.
6022
6023 2003-09-29  Paul Eggert  <eggert@twinsun.com>
6024
6025         csplit cleanup.
6026
6027         * doc/coreutils.texi (csplit invocation):
6028         The regexp offset need not have a sign; POSIX requires support
6029         for signless offets.
6030
6031         Be more careful about int widths.  For example, remove some
6032         arbitrary limits by replacing 'unsigned' with 'size_t',
6033         'uintmax_t', etc.  Use standard bool rather than a homegrown type.
6034         * lib/Makefile.am (libfetish_a_SOURCES): Add xstrtoimax.c.
6035         * src/csplit.c (FALSE, TRUE, boolean): Remove.  All uses changed
6036         to <stdbool.h> usage.
6037         (struct control): offset is now intmax_t, not int.
6038         repeat_forever is now bool, not int.
6039         (struct cstring): len is now size_t, not unsigned int.
6040         (struct buffer_record): bytes_alloc, bytes_used, num_lines are now
6041         size_t, not unsigned.  start_line, first_available are now
6042         uintmax_t, not unsigned.
6043         (hold_count, control_used): Now size_t, not unsigned.
6044         (last_line_number, current_line, bytes_written):
6045         Now uintmax_t, not unsigned.
6046         (save_to_hold_area, red_input, keep_new_line, record_line_starts,
6047         create_new_buffer, get_new_buffer, load_buffer, find_line,
6048         process_regexp, split_file, new_control_record, extract_regexp,
6049         get_format_width, get_format_prec, max_out):
6050         size args, locals, and returned values are now size_t, not unsigned
6051         or int.
6052         (get_first_line_in_buffer, find_line, write_to_file,
6053         handle_line_error, process_line_count, regexp_error, process_regexp,
6054         split_file):
6055         File line, byte, and repetition counts are now uintmax_t, not unsigned.
6056         (check_for_offset): Don't require a sign before the offset.
6057         Use xstrtoimax to do the real work.
6058         (extract_regexp): Remove harmful cast of size to unsigned.
6059         256 -> 1<<CHAR_BIT, for clarity.
6060         (get_format_flags): Return at most 3, to avoid worries about overflow.
6061
6062         (bytes_to_octal_digits): Remove.
6063
6064         (cleanup): Don't check whether output_stream is NULL, since
6065         close_output_file does that for us.
6066
6067         (new_line_control, create_new_buffer): Use "foo *p = xmalloc
6068         (sizeof *p);" instead of the more long-winded alternatives.
6069
6070         (get_new_buffer): Use O(1) algorithm for resizing a buffer
6071         to a much larger size, instead of an O(N) algorithm.
6072
6073         (process_regexp): Use plain NULL rather than casted 0.
6074
6075         (make_filename): Use %u, not %d, to format unsigned file number.
6076
6077         (new_control_record): Use xrealloc exclusively, since it handles
6078         NULL reliably.
6079
6080         (extract_regexp): Change misspelled word in diagnostic.
6081
6082         (get_format_width): Even if a minimum field width is specified,
6083         allow room for enough octal digits to represent the value of
6084         the maximum representible integer.  This fixes a potential
6085         buffer overrun.  Calculate this room at compile-time, not
6086         at run-time; this removes the need for bytes_to_octal_digits.
6087         Check for overflow; this removes a FIXME.
6088
6089         (get_format_prec): Don't allow precision to be signed; it's
6090         not ANSI.  Check for overflow.  Remove hardcoded "11" as
6091         default precision; this fixes a potential buffer overrun
6092         on hosts with wider size_t.
6093
6094         (get_format_conv_type): Change local variable to be of type
6095         unsigned char, not int; this removes a potential subscript
6096         violation on hosts where char is signed.
6097
6098         (max_out): Replace "for (;*p;)" with more-standard "while (*p)".
6099         Allow "%%" in format.  Don't overflow when
6100         counting lots of percents.
6101
6102         (usage): Default sprintf format is %02u, not %d.
6103
6104 2003-10-05  Jim Meyering  <jim@meyering.net>
6105
6106         * src/chown-core.c (change_file_owner): Remove set-but-not-used local.
6107
6108         * src/du.c (du_files): Mark diagnostic for translation.
6109
6110 2003-10-04  Jim Meyering  <jim@meyering.net>
6111
6112         * src/du.c (du_files): Ignore any failure of fts_close.
6113         Give better diagnostics for failed fts_open.
6114
6115         * src/du.c (MAX_N_DESCRIPTORS): Remove now-unused definition.
6116
6117         Deprecate existing use of -H (aka --si).
6118         * src/du.c (enum) [HUMAN_SI_OPTION]: New member.
6119         [long_options]: Use HUMAN_SI_OPTION, not 'H'.
6120         (main): Warn that the meaning of -H will soon change to be
6121         POSIX compliant.
6122
6123 2003-10-03  Jim Meyering  <jim@meyering.net>
6124
6125         * src/du.c: Accept --no-dereference (-P).
6126
6127 2003-10-02  Jim Meyering  <jim@meyering.net>
6128
6129         * tests/du/trailing-slash: Adjust for slightly different output.
6130
6131         Rewrite du.c to use fts.
6132         * src/du.c: Include "fts_.h", not ftw.h.
6133         (opt_dereference_arguments, arg_length, suffix_length): Remove globals.
6134         (IS_FTW_DIR_TYPE): Remove definition.
6135         (IS_DIR_TYPE): Define.
6136         (is_symlink_to_dir): Remove now-unnecessary function.
6137         (process_file, du_files): Rewrite to use fts.
6138
6139         * tests/du/inaccessible-cwd: Ensure that even when run from an
6140         inaccessible directory, du can still operate on accessible
6141         directories elsewhere.
6142         * tests/du/Makefile.am (TESTS): Add inaccessible-cwd.
6143
6144         * tests/rm/deep-1: Ensure that du can process a hierarchy
6145         of depth 400 while using no more than 50KB of stack space.
6146
6147 2003-10-01  Akim Demaille  <akim@epita.fr>
6148
6149         * announce-gen (print_news_deltas): New function, extracted from main.
6150         (main): Make `news_file' an array.
6151         Use '...=s' => \@var for --news and --url-directory specs.
6152         Before there were a couple of portability problems.
6153
6154 2003-09-28  Jim Meyering  <jim@meyering.net>
6155
6156         * Makefile.maint (sc_cast_of_alloca_return_value): New rule.
6157         (syntax-check-rules): Add it.
6158
6159         * src/copy.c: Remove unnecessary cast of alloca, since now it's
6160         guaranteed to be (void *).
6161         * src/cp.c: Likewise.
6162         * src/join.c: Likewise.
6163         * src/ln.c: Likewise.
6164         * src/ls.c: Likewise.
6165         * src/od.c: Likewise.
6166         * src/sys2.h (ASSIGN_STRDUPA): Likewise.
6167
6168 2003-09-27  Jim Meyering  <jim@meyering.net>
6169
6170         Don't exhaust virtual memory when processing large inputs.
6171         Fix this by removing csplit's internal free-list management;
6172         instead rely on malloc for that.
6173
6174         * src/csplit.c (free_list): Remove global.
6175         (clear_all_line_control): Remove function.
6176         (get_new_buffer): Always use create_new_buffer to obtain a
6177         new buffer, rather than searching free_list.
6178         (free_buffer): Just call free.
6179         Reported by Nikola Milutinovic.
6180
6181 2003-09-26  Jim Meyering  <jim@meyering.net>
6182
6183         * man/rm.x: Also list `chattr' in SEE ALSO section.
6184         Suggestion from Mark Hubbart.
6185
6186 2003-09-25  Jim Meyering  <jim@meyering.net>
6187
6188         * configure.ac: Don't invoke AC_AIX or AC_MINIX explicitly, now
6189         that we use gl_USE_SYSTEM_EXTENSIONS, since it AC_REQUIREs them.
6190
6191         * Use autoconf-2.57d.  Regenerate dependent files.
6192
6193 2003-09-24  Jim Meyering  <jim@meyering.net>
6194
6195         Minor efficiency tweak.
6196         * src/ln.c (PATH_BASENAME_CONCAT): Use memcpy rather than strcpy.
6197         (do_link): Likewise.
6198
6199 2003-09-23  Jim Meyering  <jim@meyering.net>
6200
6201         * src/paste.c (paste_serial): Save errno after input error,
6202         to report proper errno value.
6203         Based on a patch from Paul Eggert.
6204
6205         * src/tee.c (tee): Adjust fwrite arguments so that the return
6206         value is the number of bytes written.
6207
6208 2003-09-16  Paul Eggert  <eggert@twinsun.com>
6209
6210         Don't assume ferror sets errno.  Bug reported by Bruno Haible.
6211
6212         * src/comm.c (compare_files): Save errno after input error,
6213         to report proper errno value.
6214         * src/fold.c (fold_file): Likewise.
6215         * src/od.c (check_and_close, skip, read_char, read_block): Likewise.
6216         * src/unexpand.c (unexpand): Likewise.
6217
6218         * src/csplit.c (close_output_file): Don't report bogus errno value
6219         after ferror discovers an output error.  We don't know the proper
6220         errno value, since it might have been caused by any of a whole
6221         bunch of calls, and it might have been trashed in the meantime.
6222         Fixing this problem will require much more extensive changes;
6223         in the meantime just say "write error".
6224         * src/od.c (check_and_close, dump, dump_strings): Likewise.
6225         * src/uniq.c (check_file): Likewise.
6226
6227         * src/join.c (get_line): Report error right away if I/O fails,
6228         so that the proper errno value is used.
6229         * src/tac.c (tac_seekable, tac_file, save_stdin): Likewise.
6230         * src/tee.c (tee): Likewise.
6231         * src/uniq.c (check_file): Likewise.
6232
6233         * src/od.c (skip): If a read fails, don't retry it later, so
6234         that we report the proper errno.
6235
6236         * src/tac.c (tac_mem): Don't return a value; nobody uses it.
6237
6238         * src/tee.c (tee): Once a write failure has occurred, don't bother
6239         writing anything more to that stream.
6240
6241         * src/uniq.c (check_file): Check for ferror (stdout) even if
6242         ostream == stdout.
6243
6244         * src/yes.c (UNROLL): Remove.
6245         (main): Exit immediately when write failure is detected.
6246         Simplify code by assigning to argv when argc == 1.
6247
6248 2003-09-21  Paul Eggert  <eggert@twinsun.com>
6249
6250         * src/ptx.c: Switch encoding from Latin-1 to UTF-8.
6251         (WRITTEN_BY): Change "Franc,ois" (actually using
6252         c-with-cedilla in Latin-1) to "F.", so that it's ASCII, as
6253         xgettext requires.
6254
6255 2003-09-19  Jim Meyering  <jim@meyering.net>
6256
6257         `du -D symlink-to-dir' would mistakenly omit the slash in
6258         lines like this: 24     symlink-to-dir/subdir
6259         * src/du.c (process_file): Fix offset calculation.
6260         Reported by Jeff Sheinberg as Debian bug #211591;
6261         http://bugs.debian.org/205251
6262
6263         * tests/du/deref-args: New file/test for the above.
6264         * tests/du/Makefile.am (TESTS): Add deref-args.
6265
6266         * src/du.c (process_file): Remove useless disjunct.
6267
6268         * src/sys2.h (case_GETOPT_VERSION_CHAR): Rename parameter, Authors,
6269         to Written_by.
6270         * nearly all src/*.c files (WRITTEN_BY): Rename from AUTHORS.
6271         Begin each WRITTEN_BY string with `Written by ' and end it with `.'.
6272         Mark each WRITTEN_BY string as translatable.
6273
6274         * basename.c, cat.c, chroot.c, cksum.c, comm.c, cp.c, csplit.c, cut.c:
6275         * dd.c, df.c, dirname.c, du.c, echo.c, env.c, expr.c, factor.c, head.c:
6276         * hostid.c, hostname.c, id.c, link.c, ln.c, logname.c, ls.c, md5sum.c:
6277         * mv.c, nice.c, nl.c, nohup.c, paste.c, pathchk.c, pinky.c, pr.c:
6278         * printenv.c, printf.c, pwd.c, rm.c, setuidgid.c, sleep.c, sort.c:
6279         * split.c, stty.c, sum.c, sync.c, tac.c, tail.c, tee.c, test.c:
6280         * touch.c, tsort.c, uniq.c, unlink.c, uptime.c, users.c, wc.c:
6281         * who.c, whoami.c, yes.c: Revert yesterday's changes.
6282         Instead, a subsequent change will embed `Written by ' in
6283         each string along with the author names.
6284
6285         * src/true.c: Revert yesterday's changes.
6286         * src/sys2.h: Likewise.
6287
6288 2003-09-18  Jim Meyering  <jim@meyering.net>
6289
6290         * basename.c, cat.c, chroot.c, cksum.c, comm.c, cp.c, csplit.c, cut.c:
6291         * dd.c, df.c, dirname.c, du.c, echo.c, env.c, expr.c, factor.c, head.c:
6292         * hostid.c, hostname.c, id.c, link.c, ln.c, logname.c, ls.c, md5sum.c:
6293         * mv.c, nice.c, nl.c, nohup.c, paste.c, pathchk.c, pinky.c, pr.c:
6294         * printenv.c, printf.c, pwd.c, rm.c, setuidgid.c, sleep.c, sort.c:
6295         * split.c, stty.c, sum.c, sync.c, tac.c, tail.c, tee.c, test.c:
6296         * touch.c, tsort.c, uniq.c, unlink.c, uptime.c, users.c, wc.c:
6297         * who.c, whoami.c, yes.c: Update AUTHORS definition to be a
6298         comma-separated list of strings and/or update the call to
6299         parse_long_options so that `AUTHORS, NULL' are the last parameters.
6300         * src/true.c (main): Append NULL to version_etc argument list.
6301         * src/sys2.h (case_GETOPT_VERSION_CHAR): Likewise.
6302
6303         * src/sort.c (numcompare): Rename local, logb, to log_b to avoid
6304         shadowing the math function name.  Also rename loga to log_a.
6305
6306 2003-09-14  Jim Meyering  <jim@meyering.net>
6307
6308         * src/factor.c (print_factors): Give a separate diagnostic
6309         for numbers that are too large, but otherwise valid.
6310         Reported by Dániel Varga.
6311
6312 2003-09-10  Jim Meyering  <jim@meyering.net>
6313
6314         * Use automake-1.7.7.  Regenerate dependent files.
6315
6316         * tests/Makefile.am (all_programs): Use ../src/tr -s ' ' '\n' in place
6317         of `fmt -1'.  Using the just-built tr is a little cleaner.
6318         Christian Krackowizer reported that HPUX 10.20 doesn't have fmt.
6319         * man/Makefile.am (programs, check-x-vs-1): Likewise.
6320
6321 2003-09-09  Jim Meyering  <jim@meyering.net>
6322
6323         * src/copy.c: Alphabetize includes.
6324         Remove duplicate inclusion of "same.h".
6325
6326 2003-09-08  Jim Meyering  <jim@meyering.net>
6327
6328         * Makefile.maint (GZIP_ENV): Remove --rsyncable.
6329         Didn't give enough of a benefit, mainly because it's not yet
6330         in wide enough use.
6331
6332         * Version 5.0.91.
6333
6334         * man/Makefile.am (programs): Use ../src, not $(srcdir)/../src.
6335         (check-programs-vs-x): Fail if $(programs) is empty.
6336
6337         * src/remove.c: Add a comment.
6338
6339 2003-09-07  Jim Meyering  <jim@meyering.net>
6340
6341         * src/remove.c (D_INO, ENABLE_CYCLE_CHECK) [D_INO_IN_DIRENT]:
6342         Don't define.  These symbols are no longer used.
6343
6344         * tests/misc/tty-eof: Write ^D as \cD.
6345         Complete the change of 2003-08-02.
6346
6347         * Makefile.maint (po-check): Use cvsu, so that a temporary source
6348         file in lib/ or src/ doesn't induce an unwarranted failure.
6349         Add a kludge to filter out the sole generated source file that
6350         also has translatable messages: src/false.c.
6351
6352 2003-09-06  Jim Meyering  <jim@meyering.net>
6353
6354         * src/tail.c (enum): Add ALLOW_MISSING_OPTION.
6355         (parse_options): Give a diagnostic for (but still accept) the
6356         deprecated --allow-missing option.
6357
6358 2003-09-04  Paul Eggert  <eggert@twinsun.com>
6359
6360         Don't ignore -S if input is a pipe.  Bug report by Michael McFarland in
6361         <http://mail.gnu.org/archive/html/bug-coreutils/2003-09/msg00008.html>.
6362
6363         * src/sort.c (sort_buffer_size): Omit SIZE_BOUND arg.  Compute the
6364         size_bound ourselves. if an input file is a pipe and the user
6365         specified a size, use that size instead of trying to guess the
6366         pipe size.  This has the beneficial side effect of avoiding the
6367         overhead of default_sort_size in that case.  All callers changed.
6368         (sort): Remove static var size; now done by sort_buffer_size.
6369
6370 2003-09-05  Jim Meyering  <jim@meyering.net>
6371
6372         * Use automake-1.7.6b and autoconf-2.57b.  Regenerate dependent files.
6373
6374         * tests/tail-2/tail-n0f: Wait .5 seconds for backgrounded process
6375         to start, rather than just .1.  Upon failure, print unexpected state.
6376
6377 2003-09-04  Paul Eggert  <eggert@twinsun.com>
6378
6379         * src/head.c (elide_tail_lines_pipe): Don't assign 0 or
6380         SAFE_READ_ERROR to tmp->nbytes.
6381         * src/tail.c (pipe_lines, pipe_bytes): Likewise.
6382
6383         * src/head.c (struct linebuffer): Change nbytes and nlines
6384         from unsigned int to size_t.  unsigned int is safe (after the
6385         2003-09-03 patch) but size_t is cleaner.
6386         * src/tail.c (struct linebuffer, struct charbuffer): Likewise.
6387         (pipe_bytes): Likewise for local variable 'i', which was 'int'.
6388
6389         Standardize on BUFSIZ as opposed to other macro names and values.
6390         * src/head.c (BUFSIZE): Remove.  All uses changed to BUFSIZ.
6391         * src/tail.c (BUFSIZ) [!defined BUFSIZ]: Remove.
6392         stdio.h has always defined it,
6393         and other code already assumes it's defined.
6394         * src/tr.c (BUFSIZ) [!defined BUFSIZ]: Likewise.
6395         (IO_BUF_SIZE): Remove; replace all uses with sizeof io_buf.
6396         (io_buf): IO_BUF_SIZE -> BUFSIZ.
6397
6398 2003-09-04  Paul Eggert  <eggert@twinsun.com>
6399
6400         * src/seq.c (step): Default to 1.
6401         (print_numbers): Allow the output to be empty.
6402         (main): The default step is 1, even if LAST < FIRST;
6403         as per documentation.
6404         * tests/seq/basic (onearg-2): Output should be empty.
6405
6406 2003-09-05  Jim Meyering  <jim@meyering.net>
6407
6408         * Makefile.cfg (wget_files): Temporarily disable, until master
6409         versions are restored to ftp.gnu.org.
6410
6411         * configure.ac (AM_INIT_AUTOMAKE): Specify automake-1.7.6.
6412
6413         Make seq's --width (-w) option work properly even when the
6414         endpoint requiring the larger width is negative and smaller than
6415         the other endpoint.
6416         * src/seq.c (get_width_format): Include `-' in the set of bytes
6417         allowed in a `simple' number (no decimal point, no exponent).
6418         Reported by Patrick Mauritz.
6419
6420 2003-09-02  Paul Eggert  <eggert@twinsun.com>
6421
6422         * NEWS: sort -t '\0' now uses a NUL tab.
6423         sort option order no longer matters, unless POSIX requires it.
6424         * src/sort.c (usage): Say "blanks" instead of "whitespace",
6425         Similar fixes for many comments.
6426         (TAB_DEFAULT): New constant, so that we can support NUL as
6427         the field separator.
6428         (tab): Now int, not char.  Initialize to TAB_DEFAULT.
6429         (specify_sort_size): If multiple sizes are specified, use the largest.
6430         (begfield, limfield): Support NUL tab char.
6431         (set_ordering): Do not let -i override -d.
6432         (main): Report an error if incompatible -o or -t options are given.
6433         Report an error for "-t ''".  Allow "-t '\0'" to specify a NUL tab.
6434
6435 2003-09-05  Jim Meyering  <jim@meyering.net>
6436
6437         * tests/sort/Test.pm [o2, nul-tab]: New tests for the above.
6438
6439 2003-09-03  Andreas Schwab  <schwab@suse.de>
6440
6441         Bug report and patch here:
6442         <http://mail.gnu.org/archive/html/bug-coreutils/2003-09/msg00009.html>
6443         * src/tail.c (pipe_lines): Don't truncate return value from safe_read.
6444         * src/head.c (elide_tail_lines_pipe): Likewise.
6445
6446 2003-09-03  Jim Meyering  <jim@meyering.net>
6447
6448         * src/du.c (AUTHORS): Remove Larry McVoy's name, since the relatively
6449         small amount of code from him was first moved to lib/human.c, and was
6450         subsequently rewritten entirely.
6451         * src/df.c (AUTHORS): Likewise.
6452
6453 2003-08-22  Lawrence Teo  <lcteo@uncc.edu>
6454
6455         * src/md5sum.c (split_3): Accept the BSD format for generic
6456         message digest modes.  Currently works with BSD's MD5 and SHA1
6457         formats since these are the two algorithms presently used in
6458         coreutils.  Updated comments to reflect this change.
6459         (bsd_split_3): Updated comments.
6460
6461         * tests/md5sum/basic-1: New test to make sure that
6462         `md5sum --check' doesn't accept the BSD SHA1 format (adapted
6463         from `check-bsd' test in tests/sha1sum/basic-1).
6464
6465         * tests/sha1sum/basic-1 (check-bsd2, check-bsd3): New tests for
6466         --check exit status and BSD SHA1 format (adapted from tests
6467         in tests/md5sum/basic-1).
6468
6469 2003-08-30  Jim Meyering  <jim@meyering.net>
6470
6471         * src/ln.c (do_link): Use SAME_INODE rather than open-coding it.
6472
6473         When source and destination arguments refer to the same file, reside
6474         on a partition (e.g. VFAT) on which distinct names may refer to the
6475         same directory entry (often due to variations in case), and when the
6476         link count for the file is 1, mv no longer unlinks the file.  Instead,
6477         it gives the expected diagnostic that the source and destination are
6478         the same.  WARNING: this is an incomplete fix.  If the file happens
6479         to have a link count of 2 or greater, such an erroneous mv command
6480         will still unlink it.
6481         Although that is not possible on vfat or umsdos, it is possible on
6482         other file system types, e.g., ntfs, and hpfs.
6483         * src/copy.c (same_file_ok): Invoke same_name (which might still
6484         return false for names that refer to the same directory entry)
6485         only if the link count is 2 or more.
6486         * tests/mv/vfat: Show how to demonstrate the above problem.
6487         This test is not run.
6488         * tests/mv/Makefile.am (EXTRA_DIST): Add vfat.
6489
6490 2003-08-27  Jim Meyering  <jim@meyering.net>
6491
6492         * src/who.c: Change meaning of -l from --lookup to --login, per POSIX.
6493         who's -l option has been eliciting an unconditional warning about
6494         this impending change since sh-utils-2.0.12 (April 2002).
6495
6496         * src/paste.c (paste_parallel): Don't output `EOF' (aka -1) as a `char'.
6497         This would happen for nonempty files not ending with a newline.
6498         Reported by Dan Jacobson.
6499         * tests/misc/paste-no-nl: New file.  Test for above-fixed bug.
6500         * tests/misc/Makefile.am (TESTS): Add paste-no-nl.
6501
6502         * src/stat.c (print_it): Avoid buffer overrun that would
6503         occur when the user-specified format string ends with `%'.
6504         Patch by Tommi Kyntola.
6505         * tests/misc/stat-fmt: New file.  Test for above-fixed bug.
6506         * tests/misc/Makefile.am (TESTS): Add stat-fmt.
6507
6508 2003-08-26  Jim Meyering  <jim@meyering.net>
6509
6510         Apply changes from bison.
6511         * GNUmakefile (SHELL): Define to `sh', if necessary.
6512         Add copyright.
6513         * Makefile.maint (WGETFLAGS): Define to `-C off'.
6514         Update all uses of $(WGET).
6515
6516 2003-08-22  Akim Demaille  <akim@epita.fr>
6517
6518         * Makefile.cfg (local-checks-to-skip): New.
6519         * Makefile.maint (local-check): Rename as...
6520         (local-checks-available): this.
6521         (local-check): New.
6522
6523 2003-08-26  Akim Demaille  <akim@epita.fr>
6524
6525         * announce-gen (print_changelog_deltas): Neutralize "<#" as
6526         "<\#" to avoid magic from Gnus when posting parts of this script.
6527
6528 2003-08-25  Jim Meyering  <jim@meyering.net>
6529
6530         * src/stat.c (main): Warn about use of deprecated `-l' option.
6531
6532 2003-08-22  Jim Meyering  <jim@meyering.net>
6533
6534         * src/stat.c (do_stat): For link count at end of line, use %h format,
6535         instead of %-5h.  The latter would make stat emit trailing spaces.
6536         Reported by Dan Jacobson.
6537
6538 2003-08-20  Jim Meyering  <jim@meyering.net>
6539
6540         * Makefile.am (EXTRA_DIST): Add .x-sc_space_tab .x-sc_sun_os_names
6541
6542 2003-08-19  Jim Meyering  <jim@meyering.net>
6543
6544         * src/system.h: Include stdlib.h unconditionally,
6545         as we're now assuming that part of hosted C89.
6546
6547 2003-08-18  Jim Meyering  <jim@meyering.net>
6548
6549         * src/sys2.h (textdomain, bindtextdomain) [! ENABLE_NLS]: Define away,
6550         to avoid warnings from gcc.
6551
6552 2003-08-17  Jim Meyering  <jim@meyering.net>
6553
6554         Avoid unnecessary and sometimes time-consuming hostname lookups.
6555         * src/who.c (print_user): Use strchr, not strrchr.
6556         * src/pinky.c (print_entry): Likewise.
6557         Patch by Michael Stone.
6558         This fixes a typo I introduced in who-users.c on 1996-02-23.
6559
6560         * Makefile.maint (makefile-check): Add 0-9 to the range of characters
6561         disallowed between `@...@'.
6562
6563 2003-08-16  Paul Eggert  <eggert@twinsun.com>
6564
6565         * configure.ac (fu_cv_sys_truncating_statfs): Remove; now
6566         done by gnulib .m4 files.
6567         (jm_DUMMY_1): Require gl_READUTMP, not jm_PREREQ_READUTMP.
6568         * src/sys2.h (strtoull): Remove unused declaration.
6569
6570 2003-08-16  Jim Meyering  <jim@meyering.net>
6571
6572         * man/Makefile.am (.x.1): Ensure that generated PROGRAM.1 files
6573         are read-only.
6574
6575         * src/tail.c (tail_lines): Fix a potential (but very hard to exercise)
6576         race condition bug.  The bug would be triggered when tailing a file
6577         with file pointer not at beginning of file, and where the file was
6578         truncated to have a length of less than the initial offset at just
6579         the right moment (between the two lseek calls in this function).
6580
6581         An invalid initial value for *read_pos would result in
6582         `tail -n0 -f FILE' and `tail -c0 -f FILE' doing what amounted to a
6583         busy-wait rather than sleeping between iterations.  The bug manifests
6584         itself only when tailing regular files that are initially nonempty.
6585         * src/tail.c (tail_bytes): Set *read_pos to new file offset after
6586         each xlseek call.
6587         (tail_lines): Likewise, after lseek calls.
6588         Reported by Nick Estes.  See http://bugs.debian.org/205251 for details.
6589         * tests/tail-2/tail-n0f: New file.  Test for above fix.
6590         * tests/tail-2/Makefile.am (TESTS): Add tail-n0f.
6591
6592 2003-08-15  Jim Meyering  <jim@meyering.net>
6593
6594         * Makefile.maint (sc_space_tab): Use exclusion list in separate file.
6595         (sc_sun_os_names): Likewise.
6596         * .x-sc_space_tab, .x-sc_sun_os_names: New files.
6597
6598         * man/help2man: Remove some SPACEs before TAB.
6599
6600 2003-08-14  Paul Eggert  <eggert@twinsun.com>
6601
6602         * Makefile.maint (LC_ALL): Set to C.
6603         * man/Makefile.am (ASSORT): New var.
6604         (check-x-vs-1, programs): Use it.
6605         * src/Makefile.am (ASSORT, check-README, ../AUTHORS): Likewise.
6606         * tests/Makefile.am (ASSORT, all_programs): Likewise.
6607
6608 2003-08-11  Jim Meyering  <jim@meyering.net>
6609
6610         fold -s -wN would infloop for N < 8 with TABs in the input.
6611         E.g., this would not terminate: printf 'a\tb' | fold -w2 -s
6612         * src/fold.c (fold_file): Move contents of `else'-block
6613         out of conditional so it's used also for --spaces (-s).
6614         * tests/misc/fold: Test for the above fix.
6615         * tests/misc/Makefile.am (TESTS): Add fold.
6616
6617 2003-08-10  Jim Meyering  <jim@meyering.net>
6618
6619         * src/nice.c [!NICE_PRIORITY]: Include <sys/resource.h> after
6620         system.h so the types from time.h and sys/time.h are available.
6621         It appears that this is necessary for OpenBSD, NetBSD, and
6622         Darwin 6.5 (MacOS 10.2.5).  Reported by Nelson Beebe.
6623
6624 2003-08-06  Paul Eggert  <eggert@twinsun.com>
6625
6626         * NEWS: Add support for setting file timestamps to microsecond
6627         resolution, on hosts that support this.
6628         * src/copy.c, src/cp.c, src/install.c, src/touch.c: Include utimens.h.
6629         * src/copy.c (copy_internal):
6630         Set file timestamps with utimens, not utime.
6631         * src/cp.c (re_protect): Likewise.
6632         * src/install.c (change_timestamps): Likewise.
6633         * src/touch.c (newtime, touch, main): Likewise.
6634
6635 2003-08-09  Jim Meyering  <jim@meyering.net>
6636
6637         * Makefile.maint (sc_sun_os_names): New rule based on a regexp
6638         from Paul Eggert.
6639         (syntax-check-rules): Add it.
6640
6641         * src/tail.c (main): Tweak Solaris OS version number in comment.
6642         * src/wc.c (wc): Likewise
6643         * tests/tail-2/fflush: Likewise.
6644
6645         * src/tail.c: Add new undocumented option, --presume-input-pipe.
6646         (pipe_lines): Use memchr to skip lines, rather than an explicit loop.
6647
6648 2003-08-08  Paul Eggert  <eggert@twinsun.com>
6649
6650         Use new gnulib 'extensions' module.
6651         * configure.ac: Invoke gl_USE_SYSTEM_EXTENSIONS instead of
6652         AC_GNU_SOURCE.
6653
6654 2003-08-08  Paul Eggert  <eggert@twinsun.com>
6655
6656         * tests/du/basic: Ensure that a/b/F has at least 65 bytes too.
6657
6658 2003-08-09  Jim Meyering  <jim@meyering.net>
6659
6660         * tests/misc/split-fail: Reflect that `split -a 0' is now accepted.
6661         For tests of obsolete behavior, don't presume that unsetting
6662         _POSIX2_VERSION is equivalent to _POSIX2_VERSION=199209.
6663
6664 2003-08-07  Paul Eggert  <eggert@twinsun.com>
6665
6666         * doc/coreutils.texi (split invocation):
6667         Add -d or --numeric-suffixes option to 'split'.
6668         From a suggestion by Jesse Kornblum.
6669         * src/split.c (suffix_alphabet): New var.
6670         (longopts, usage, next_file_name, main): Support -d.
6671         (next_file_name, main): Allow -a0, as POSIX requires.
6672         (next_file_name): Don't assume ASCII-like encoding;
6673         'a' through 'z' are not contiguous in EBCDIC.
6674
6675 2003-08-05  Paul Eggert  <eggert@twinsun.com>
6676
6677         Merge getline from gnulib.
6678         * lib/getline.h, lib/getline.c, m4/getline.m4: Merge from gnulib.
6679         * lib/getndelim2.h, lib/getndelim2.c, m4/getndelim2.m4, m4/ssize_t.m4:
6680         New files, from gnulib.
6681         * lib/getdelim2.c, lib/getdelim2.h: Remove.
6682         * lib/Makefile.am (libfetish_a_SOURCES): Change getdelim2.c and
6683         getdelim2.h to getndelim2.c and getndelim2.h.
6684         * m4/jm-macros.m4 (jm_MACROS): Use gl_GETNDELIM2 rather than
6685         checking for getdelim.
6686         (jm_CHECK_ALL_TYPES): Use gt_TYPE_SSIZE_T for ssize_t rather
6687         than rolling our own.
6688         * src/cut.c: Include getndelim2.h rather than getdelim2.h.
6689         (cut_fields): Invoke getndelim2 rather than getdelim2.
6690
6691 2003-08-04  Jim Meyering  <jim@meyering.net>
6692
6693         * src/sort.c (main): Use unsigned int instead of int for `nsigs'
6694         and for the indices to iterate through nsigs.
6695
6696 2003-08-02  Paul Eggert  <eggert@twinsun.com>
6697
6698         * src/sort.c: Minor code cleanups, mostly to use more accurate
6699         types and to remove unnecessary casts.
6700         (min, max): Remove.  All uses changed to MIN and MAX.
6701         (hard_lc_collate, hard_LC_TIME, struct buffer.eof, struct
6702         keyfield.skipsblanks, struct keyfield.skipeblanks, struct
6703         keyfield.numeric, struct keyfield.general_numeric, struct
6704         keyfield.month, struct keyfield.reverse, reverse, unique,
6705         have_read_stdin): Now bool, not int.  All uses changed.
6706         (eolchar): Now char, not int.
6707         (struct keyfield.ignore): Now bool const *, not int *.
6708         (struct keyfield.translate): Now char const *, not char *.
6709         (struct month.name): Likewise.
6710         (blanks, nonprinting, nondictionary): Now bool[], not int[].
6711         (cleanup, inittables, keycompare, check, mergefps, first_same_file,
6712         check, sort, main): Use const * pointers when possible.
6713         (month_cmp): Rewrite to avoid casts.
6714         (inittables): Initialize tables unconditionally, to avoid branches.
6715         (fillbuf): Return bool, not int.  All uses changed.
6716         (fillbuf, keycompare, new_key, main):
6717         Use SIZE_MAX rather than (size_t) -1.
6718         (trailing_blanks): Renamed from trim_trailing_blanks.
6719         Return the number of blanks to trim.  All uses changed.
6720         (getmonth): Use trailing_blanks rather than open code.
6721         (keycompare): Do not cast char * to unsigned char *; not needed.
6722         CMP_WITH_IGNORE converts args to UCHAR, so no need to convert it
6723         ourselves.
6724         (compare, main): Use | rather than || to avoid jumps.
6725         Replace "diff = NONZERO (alen)" with "diff = 1", since alen must
6726         be nonzero there.
6727         (check, first_same_file, sort, main):
6728         Use bool instead of int local vars when possible.
6729         (check): Merge the old 'checkfp' and 'check' into a single function,
6730         that returns a boolean (true if the file was ordered).
6731         All uses changed.
6732         (main): Use int instead of unsigned for iterating through nsigs.
6733         Rename local var "posix_pedantic" to "posixly_correct".
6734
6735 2003-08-02  Jim Meyering  <jim@meyering.net>
6736
6737         * src/nice.c [!NICE_PRIORITY]: Include <time.h> before <sys/resource.h>
6738         to avoid compilation error on Ultrix. Reported by Christian Krackowizer.
6739
6740         * src/cut.c (cut_fields): Don't read again after encountering an
6741         initial EOF.  E.g., `cut -f2' would do so.
6742         * tests/misc/tty-eof: Add a test for the above fix.
6743
6744         * src/sort.c (sortlines): Add description and references.
6745         From Paul Eggert.
6746
6747         * tests/Makefile.am (TESTS_ENVIRONMENT): Set PATH so that
6748         the tests in help-version will use the just-built binaries.
6749         Reported by Christian Krackowizer.
6750
6751 2003-07-31  Paul Eggert  <eggert@twinsun.com>
6752
6753         * NEWS: Add --rfc-2822 option to GNU date.
6754         * doc/coreutils.texi (Time directives, Options for date, Examples
6755         of date): Likewise.
6756         * src/date.c (long_options, usage, main): Likewise.
6757         * doc/getdate.texi (General date syntax): Likewise.
6758         * doc/coreutils.texi (Options for date): Fix a typo in format:
6759         it's now %d not %_d.  Add URLs.
6760
6761 2003-08-01  Jim Meyering  <jim@meyering.net>
6762
6763         * tests/shred/remove: Ensure that $? is 0 for the final `exit 0'.
6764         Otherwise, with at least the /bin/sh from HPUX 10.20,
6765         the trap code would end up converting that to exit 1 and thus an
6766         unexpected test failure.  Reported by Christian Krackowizer.
6767
6768 2003-07-31  Paul Eggert  <eggert@twinsun.com>
6769
6770         * src/ptx.c: Do not include bumpalloc.h.
6771         (WORD_TABLE): New member alloc.
6772         (ALLOC_NEW_WORD): Remove.
6773         (occurs_alloc): New var.
6774         (digest_word_file, find_occurs_in_text): Check for arithmetic
6775         overflow when computing table size.  Use xrealloc rather than
6776         bumpalloc primitives.
6777
6778 2003-07-29  Jim Meyering  <jim@meyering.net>
6779
6780         * Version 5.0.90.
6781
6782         * README: When running tests as root, suggest using
6783         sudo with NON_ROOT_USERNAME=$USER.
6784
6785         * tests/Makefile.am (all_programs): Makefile is in ../src, not
6786         $(srcdir)/../src.
6787
6788 2003-07-28  Jim Meyering  <jim@meyering.net>
6789
6790         * Makefile.maint (GZIP_ENV): Try Debian/gzip's new --rsyncable option.
6791
6792 2003-07-28  Paul Eggert  <eggert@twinsun.com>
6793
6794         * lib/stdbool.hin (_Bool): Make it signed char, instead of
6795         an enum type, so that it's guaranteed to promote to int.
6796         * src/sort.c (sortlines_temp): Undo previous change.
6797
6798 2003-07-28  Jim Meyering  <jim@meyering.net>
6799
6800         * src/sort.c (sortlines_temp): Declare local `swap' to be `int', not
6801         `bool'.  Otherwise, at least one buggy compiler (alpha gcc-2.95.4)
6802         would cause lines[-1 - swap] (with swap = false) to evaluate to
6803         lines[4294967295].
6804
6805 2003-07-27  Jim Meyering  <jim@meyering.net>
6806
6807         * tests/priv-check (my_uid): Use `!', not `^' in case pattern `[!0-9]',
6808         since /bin/sh of at least NetBSD 1.6 and OpenBSD 3.2 don't accept `^'.
6809
6810         * src/remove.c (prompt) [! recursive]: Don't prompt about unwritable
6811         directories, as required by POSIX.   Reported by Karl Berry.
6812         * tests/rm/dir-no-w: New file.  Test for the above fix.
6813         * tests/rm/Makefile.am (TESTS): Add dir-no-w.
6814
6815         * tests/mk-script: Emit `$xx', not its expansion.
6816
6817 2003-07-27  Paul Eggert  <eggert@twinsun.com>
6818
6819         This change was inspired by a similar proposal by Stepan Kasal.
6820         * src/sort.c (mergelines, sortlines_temp): New functions.
6821         (sortlines): Use them, to reduce the number of times that
6822         we need to copy 'struct line' values.  This improved CPU
6823         performance by about 30% on one 18 MB test.
6824         (sort): Don't invoke sortlines unless we have 2 or more lines.
6825
6826 2003-07-26  Stepan Kasal  <kasal@ucw.cz>
6827
6828         * src/sort.c (sort): Don't require two `struct line's per text line,
6829         the new sort algorithm requires just 1.5.
6830
6831 2003-07-27  Jim Meyering  <jim@meyering.net>
6832
6833         * src/pathchk.c (validate_path): Use %lu, not %ld.
6834         From Paul Eggert.
6835         * src/cut.c (is_printable_field): Simplify bit arithmetic.
6836         From Paul Eggert.
6837         * src/ls.c (sort_files): Put `volatile' in the right place.
6838         From Paul Eggert.
6839
6840 2003-07-26  Jim Meyering  <jim@meyering.net>
6841
6842         Use only one bit per field/offset in array, not one `int'.
6843         * src/cut.c (printable_field): Change type to `unsigned char'.
6844         (mark_printable_field, is_printable_field): New functions.
6845         Use them in place of all direct accesses of `printable_field'.
6846
6847         * src/expand.c (parse_tabstops): Detect overflow properly.
6848         * src/cut.c (set_fields): Likewise.
6849
6850         * src/rm.c: Include "dirname.h".
6851         (usage): Use base_name (program_name) in body of --help output.
6852         This lets me...
6853         * man/Makefile.am (.x.1): ...back out the kludge of 2003-07-22.
6854         Idea from Brendan O'Dea, who suggested using
6855         `program_name = basename (argv[0]);' everywhere --
6856         can't do that, but using base_name works just fine here.
6857
6858         * src/Makefile.am (AM_INSTALLCHECK_STD_OPTIONS_EXEMPT): Exempt test.
6859
6860 2003-07-24  Paul Eggert  <eggert@twinsun.com>
6861
6862         Fix some POSIX-compliance problems with 'test'.  This makes
6863         'test' more compatible with Bash.
6864
6865         * NEWS, doc/coreutils.texi: Document the following.
6866         * src/test.c: Include exitfail.h.
6867         (TEST_FAILURE): New constant, used for exit status if 'test' fails.
6868         (test-syntax_error): Use it.
6869         (binary_operator): Now takes bool arg specifying whether left operand
6870         is -l ARG, so that caller determines this rather than us.
6871         All uses changed.
6872         (term): Use posixtest to evaluate parenthesized subexpressions.
6873         (unary_operator, one_argument): Remove support for -t without operand.
6874         (one_argument): Take argument from argv[pos].
6875         (one_argument, two_arguments, three_arguments): Advance pos.
6876         All callers changed.
6877         (three_arguments): Look for binary ops before "!".  Then look
6878         for parenthesized one_argument expressions, instead of trusting
6879         expr () to do the right thing.
6880         (posixtest): Now takes number of args.  All callers changed.
6881         Treat "( A B )" like "A B".
6882         (main): Set exit_failure to TEST_FAILURE.  Don't depend on
6883         POSIXLY_CORRECT, as we now conform to POSIX by default.
6884         (main) [!LBRACKET]: Do not recognize "--help" or "--verbose" unless.
6885         * tests/test/Test.pm (test_vector): Add several tests to check
6886         the above.  Syntax errors now exit with status 2, not 1.
6887         * man/Makefile.am (mapped_name): Use `../src/[' binary to create test.1.
6888
6889 2003-07-26  Jim Meyering  <jim@meyering.net>
6890
6891         * tests/help-version: Adjust for above change in test behavior:
6892         `[' exits with 2, not 1, and test doesn't accept --help or --version.
6893
6894         * Makefile.maint (ME): Don't use trick suggested in Make manual.
6895         It doesn't work for make-3.79.1.  Reported by Christian Krackowizer.
6896
6897         * Makefile.maint (sc_system_h_headers): Another syntax check.
6898         (syntax-check-rules): Add it to the list.
6899
6900         * src/pathchk.c (validate_path): Cast strlen value to `unsigned long'
6901         so it matches `%ld' format even on 32-bit systems.
6902
6903         * src/fmt.c (flush_paragraph): Cast field width to `int' to
6904         avoid warning on 64-bit systems.
6905
6906         * src/ls.c (sort_files): Make `func' volatile, so it can't be
6907         clobbered by a `longjmp' into this function.
6908
6909 2003-07-25  Jim Meyering  <jim@meyering.net>
6910
6911         * src/pathchk.c (validate_path): Use %ld format (not %d) for size_t
6912         value.
6913
6914         * tests/misc/split-fail: Disable the --line-bytes=$_4gb test,
6915         because it'd evoke spurious failure on 64-bit systems.
6916
6917 2003-07-24  Jim Meyering  <jim@meyering.net>
6918
6919         * src/dd.c (usage): Document the fact that SIGUSR1 makes dd
6920         output its current record counts.  Reported by Jurriaan.
6921
6922         * tests/wc/Test.pm (test_vector): Disable the `PIPE' tests when running
6923         `wc' with no options.  This goes along with the change of 2003-07-20.
6924
6925 2003-07-23  Jim Meyering  <jim@meyering.net>
6926
6927         Don't include headers already included by system.h:
6928         * src/tr.c: Don't include errno.h.
6929         * src/true.c: Don't include version-etc.h.
6930         * src/test.c: Don't include limits.h or error.h.
6931         * src/stat.c: Don't include unistd.h or time.h.
6932         * src/readlink.c: Don't include stdlib.h, unistd.h, or limits.h.
6933         * src/pr.c: Don't include time.h.
6934         * src/pathchk.c: Don't include errno.h.
6935         * src/nice.c: Don't include sys/time.h.
6936         * src/ls.c: Don't include stdlib.h.
6937
6938         * basename.c, cat.c, chroot.c, cksum.c, comm.c, csplit.c, cut.c, date.c:
6939         * dd.c, dirname.c, echo.c, env.c, expand.c, expr.c, factor.c, fmt.c:
6940         * fold.c, head.c, hostid.c, hostname.c, id.c, join.c, kill.c, logname.c:
6941         * md5sum.c, nice.c, nl.c, nohup.c, od.c, paste.c, pathchk.c, pinky.c:
6942         * pr.c, printenv.c, printf.c, ptx.c, pwd.c, seq.c, setuidgid.c, shred.c:
6943         * sleep.c, sort.c, split.c, stat.c, stty.c, su.c, sum.c, tac.c, tail.c:
6944         * tee.c, test.c, tr.c, true.c, tsort.c, tty.c, uname.c, unexpand.c:
6945         * uniq.c, uptime.c, users.c, wc.c, who.c, whoami.c, yes.c:
6946         Don't include closeout.h.
6947
6948         * tests/rm/fail-2eperm: Add a check for whether $NON_ROOT_USERNAME
6949         can access the required version of rm.
6950         * tests/rm/Makefile.am (TESTS_ENVIRONMENT): Define PACKAGE_VERSION.
6951
6952         * tests/cut/Test.pm (out-delim3a): New test.
6953
6954         * man/help2man: Update to version 1.33.
6955
6956         * src/expand.c (parse_tabstops): Detect overflow in tabstop sizes.
6957
6958         * src/dircolors.c: Include xstrndup.h.
6959         (xstrndup): Remove function, now that it's been factored out into
6960         it's own file.
6961
6962 2003-07-22  Paul Eggert  <eggert@twinsun.com>
6963
6964         * src/wc.c (wc): Fix typo in computation of file from file_x,
6965         which caused the former to be used uninitialized if file_x was
6966         nonzero.
6967
6968 2003-07-22  Jim Meyering  <jim@meyering.net>
6969
6970         * src/cut.c (set_fields): Use xcalloc in place of xmalloc+memset.
6971
6972         * man/Makefile.am (.x.1): Substitute 's,$t/$*,$*,' on output of
6973         help2man, to avoid having `rm.td/rm' appear in rm.1.  Reported by
6974         Thomas Luzat.  See http://bugs.debian.org/202413 for details.
6975
6976         * src/cut.c (main) [lint]: Initialize spec_list_string to avoid warning.
6977
6978         * src/hostid.c: Don't include <unistd.h>.  system.h already does that.
6979
6980         * src/cut.c (set_fields): Mark all selected indices before trying to
6981         determine range endpoints.
6982         * tests/cut/Test.pm: New test for the above fix.
6983
6984         Begin to address this comment: What if someone wants to
6985         extract the 1,000,000-th field of some huge input file?
6986         The first step is to rearrange things so that the values
6987         in the printable_field array are all 0/1 rather than 0/1/2.
6988         * src/cut.c (RANGE_START_SENTINEL): Remove.
6989         Store range-start indices in a hash table, rather than
6990         overloading the `printable_field' array.
6991         (range_start_ht): New global.
6992         (hash_int, hash_compare_ints, is_range_start_index): New functions.
6993         (print_kth): Use is_range_start_index; don't test printable_field.
6994         (set_fields): Detect overflow.
6995         (set_fields): Insert each range-start index into range_start_ht.
6996         (main): Call set_fields only once, and only after
6997         output_delimiter_specified and (if required) range_start_ht have
6998         been defined.
6999
7000 2003-07-20  Paul Eggert  <eggert@twinsun.com>
7001
7002         * src/wc.c (get_input_fstatus): Fix typo: `stat' was being
7003         invoked with a null pointer when there were no file arguments.
7004
7005 2003-07-20  Jim Meyering  <jim@meyering.net>
7006
7007         * Makefile.maint (sc_changelog): Add another nit-picky check.
7008
7009         * src/wc.c (write_counts): Add a comment.
7010         (wc): Rename `file' parameter.
7011         Set new local, `file', to be the file name, or (when it's NULL)
7012         _("standard output") so that all uses of `file' use the proper value.
7013         Use STREQ, not strcmp.
7014
7015 2003-07-20  Paul Eggert  <eggert@twinsun.com>
7016
7017         wc count field widths now are heuristically adjusted depending
7018         on the input size, if known.  If only one count is printed, it
7019         is guaranteed to be printed without leading spaces.
7020
7021         Previously, wc did not align the count fields if
7022         POSIXLY_CORRECT was set, but POSIX did not actually require
7023         this undesirable behavior, so it has been removed.
7024
7025         * NEWS: Document this.
7026         * doc/coreutils.texi (wc invocation): Likewise.
7027
7028         * src/wc.c (number_width): New var.
7029         (posixly_correct): Remove.
7030         (struct fstatus): New struct.
7031         (write_counts): Output fields of width number_width.
7032         Do not worry about POSIXLY_CORRECT.
7033         Use null file, not empty-string file, to denote stdin,
7034         since "" is a valid file name on some hosts.
7035         (wc, wc_file): New arg fstatus.  Use it to avoid invoking fstat
7036         if possible.
7037         (wc):  Avoid problems if end_pos - current_pos overflows.
7038         Do not print odd message if stdin has a read error.
7039         (get_input_fstatus, compute_number_width): New functions.
7040         (main): Use them to implement the new behavior.
7041         Ignore POSIXLY_CORRECT.
7042
7043         * tests/wc/Test.pm: Adjust to the new output widths.
7044
7045 2003-07-19  Jim Meyering  <jim@meyering.net>
7046
7047         * tests/rm/fail-eperm: Don't create temporary directory --
7048         we don't use it.
7049
7050         * tests/shred/remove: Don't open-code test for UID != 0.
7051         Use priv-check's require-non-root instead.
7052         Update to use newer framework.
7053
7054         * tests/help-version (expected_failure_status_expr): Record that
7055         expr exits with status of 3 for e.g., a write error.
7056
7057         * tests/priv-check: Use `id -u' to see if we're running as root,
7058         rather than trying go write to an write-protected file.
7059         When running as root, ensure $NON_ROOT_USERNAME is valid.
7060         When running as root with `require-non-root', ensure that `.'
7061         is writable by $NON_ROOT_USERNAME, then reinvoke $0 set-user-ID
7062         to $NON_ROOT_USERNAME.  If `.' is not writable, then skip the test.
7063
7064         * src/printenv.c: Include "exitfail.h".
7065         (main): Set exit_failure rather than calling close_stdout_set_status.
7066         * src/date.c: Likewise.
7067         * src/sort.c: Likewise.
7068         * src/tty.c: Likewise.
7069
7070 2003-07-18  Jim Meyering  <jim@meyering.net>
7071
7072         * tests/touch/not-owner: Update to use newer framework.
7073
7074         * tests/rm/fail-eperm: Use $srcdir/../priv-check, create a temporary
7075         directory, and remove Perl-coded `you may not run as root' test.
7076         * tests/cp/fail-perm: Use $srcdir/../priv-check, rather than
7077         hard-coding something not quite equivalent.
7078         Paul Jarc reported the inconsistent diagnostics.
7079
7080         * src/sort.c (main): Use close_stdout via atexit.
7081         Now `sort --version' and `sort --help' fail, as they should
7082         when their output is redirected to /dev/full.
7083
7084         * src/su.c (usage): Don't call close_stdout here.
7085         (main): Use close_stdout via atexit.
7086         Now `su --version > /dev/full' fails, as it should.
7087         Somehow, the change of 2000-05-07 that purports to fix this
7088         was not checked in.
7089
7090         * tests/help-version (--help/--version vs. /dev/full): Special-case
7091         `[' to protect it from expected_failure_status-`eval'.
7092
7093         * src/uniq.c (writeline): Use a SPACE, not a TAB between the
7094         count and the corresponding line, as required by POSIX.
7095         Reported by Clement Wang.
7096         * tests/uniq/Test.pm (101, 102): Update tests of -c accordingly.
7097
7098         * tests/expr/basic: Add tests for when exit status is 2.
7099
7100         * src/nohup.c (NOHUP_FOUND_BUT_CANNOT_INVOKE, NOHUP_FAILURE):
7101         Use an anonymous `enum', rather than #define.
7102
7103 2003-07-17  Paul Eggert  <eggert@twinsun.com>
7104
7105         * src/expr.c: Include "exitfail.h", "quotearg.h".
7106         (EXPR_INVALID, EXPR_ERROR): New constants.
7107         (nomoreargs, null, toarith, nextarg): Return bool, not int.
7108         (syntax_error): New function, exiting with status 2.  Use it
7109         insteading of printing "syntax error" ourselves.
7110         (main): Initialize exit_failure to EXPR_ERROR.
7111         Exit with EXPR_INVALID on syntax error (too few arguments).
7112         (nextarg): Use strcmp, not strcoll; strcoll might return
7113         an undesirable 0, or might fail.
7114         (docolon, eval4, eval3): Exit with status 3 on invalid argument type
7115         or other such error.
7116         (eval2): Report an error if strcoll fails in a string comparison.
7117         * src/sort.c: Include "exitfail.h".
7118         (main): Set exit_failure, not xalloc_exit_failure and
7119         xmemcoll_exit_failure.
7120         * tests/expr/basic: Invalid value exits with status 3, not 2.
7121
7122 2003-07-16  Jim Meyering  <jim@meyering.net>
7123
7124         * configure.ac (AC_INIT): Use 5.0.90 as the version, rather than 5.0.2,
7125         per GNU maintainer guidelines.  The next non-beta release will be 5.1.
7126
7127         This script would have caught at least two recent bugs:
7128         those in [ and kill.
7129         * tests/help-version: Revive this script.
7130         It wasn't doing anything useful, since $all_programs wasn't being
7131         defined by the invoking Makefile.am.
7132         Reflect that nohup is no longer a script, so don't exclude it.
7133         Add framework to handle the programs added since it was last run:
7134         kill, stat, unlink, [, link, readlink.
7135         Fix path-related problems deriving from the move of this script
7136         from src/ to its present location.
7137         * tests/Makefile.am (all_programs): Define.
7138         (TESTS_ENVIRONMENT): Use it.
7139
7140         * src/kill.c (main): Fix bug introduced on 2003-05-10 (for 5.0.1)
7141         whereby kill would always attempt to operate on argv[0] and fail.
7142
7143         * src/test.c (integer_expected_error): Improve diagnostic -- now,
7144         it also matches the one from bash's builtin test.
7145         (binary_operator): Add \n at end of diagnostic.
7146
7147         * tests/rm/fail-2eperm: Remove setuidgid-related code.  Move it to ...
7148         * tests/priv-check: Move setuidgid-related and
7149         NON_ROOT_USERNAME-checking code to this file.
7150
7151         * README: Update section on testing as `root'.
7152         Suggestion from Paul Jarc.
7153
7154         * src/test.c (AUTHORS): Replace 3-letter usernames with the actual
7155         names of authors that I just found in bash's builtins/test.def.
7156
7157         Running `[' with no arguments would evoke a segfault.
7158         * src/test.c (main) [LBRACKET]: Move initialization of argv to
7159         precede potential use via test_syntax_error.
7160
7161         * src/Makefile.am (AM_CPPFLAGS): Rename from `INCLUDES', to avoid
7162         warning from automake -Wall.
7163
7164 2003-07-15  Jim Meyering  <jim@meyering.net>
7165
7166         * Version 5.0.1.
7167
7168         * Makefile.maint (%.asc): Remove target first, so gpg doesn't
7169         prompt us about it.
7170
7171         * announce-gen (print_changelog_deltas): Relax tests for matching
7172         version-number line in NEWS.
7173         Change the .sig suffix to .asc here, too.
7174
7175 2003-07-14  Jim Meyering  <jim@meyering.net>
7176
7177         * Makefile.maint (%.asc): Renamed from %.sig.
7178         Generate and use ascii-armored signatures.
7179         Use gpg's -o option.
7180
7181 2003-07-13  Jim Meyering  <jim@meyering.net>
7182
7183         * src/nohup.c (NOHUP_FAILURE, NOHUP_FOUND_BUT_CANNOT_INVOKE): Define.
7184         (main): Use them.
7185
7186         * Makefile.maint (syntax-check): Move each individual check into
7187         its own target.
7188         (syntax-check-rules): This is the list of syntax-check targets.
7189         (sc_unmarked_diagnostics, sc_cast_of_argument_to_free):
7190         (sc_cast_of_x_alloc_return_value, sc_space_tab):
7191         (sc_error_exit_success, sc_xalloc_h_in_src):  New targets.
7192
7193 2003-07-12  Jim Meyering  <jim@meyering.net>
7194
7195         * configure.ac: Remove uses of OPTIONAL_BIN_ZCRIPTS and last
7196         traces of the nohup script.
7197
7198         * src/Makefile.am (bin_SCRIPTS): Remove use of just-removed
7199         $(OPTIONAL_BIN_ZCRIPTS).
7200
7201         * src/Makefile.am (localedir.h): Put the `2>&1' after the redirect
7202         target, not before the `>'.
7203
7204         * src/remove.c (remove_dir): Give a diagnostic upon failed save_cwd,
7205         now that that function no longer calls `error'.
7206
7207         * src/df.c (find_mount_point): Emit a diagnostic for each
7208         failed syscall, rather than relying on caller to do that.
7209         The caller couldn't do a good job, anyhow -- too many different
7210         ways to fail (each with a different referent).
7211         Give a diagnostic upon failed save_cwd, now that that function
7212         no longer calls `error'.
7213         (show_point): Don't diagnose find_mount_point's errors, now that
7214         it handles them itself.
7215
7216         * src/df.c (find_mount_point): Don't let free clobber errno upon
7217         failed chdir.
7218
7219         * src/sys2.h: Remove alloca-related block.
7220         * src/system.h: Include <alloca.h> here, instead.
7221
7222         It appears that the `#pragma alloca' included via "system.h" is
7223         adequate, since join.c uses alloca, yet lacked an in-file #pragma.
7224         * src/copy.c, src/cp.c, src/df.c, src/install.c, src/ln.c:
7225         * src/ls.c, src/mv.c, src/remove.c: Remove `#pragma alloca'.
7226
7227         * src/chown-core.c (change_file_owner): Do not restore any special
7228         permission bits (e.g., set-user-ID, set-group-ID) that are reset
7229         by chown(2) on some systems.  Suggestion and insistence :-) from
7230         Michael Stone.
7231
7232         * tests/input-tty: Also check `test -t 1'.
7233         This is necessary on linux-2.4.21.  Otherwise, the stty/basic-1
7234         test would block when run in the background.
7235
7236 2003-07-11  Jim Meyering  <jim@meyering.net>
7237
7238         * tests/sample-test: Also fail if cat-to-create-expected-output
7239         fails.  Otherwise, if both `exp' and `out' were to end up empty
7240         because of e.g., a full disk, they would mistakenly compare equal.
7241
7242         * src/nohup.c: New file.  Rewrite of nohup.sh in C.
7243         This solves a portability problem: on at least Solaris systems,
7244         when nohup.sh used the vendor /bin/sh, it would exit with status
7245         of `1' rather than the required 126 or 127 upon failure to exec
7246         the specified program.
7247
7248         * src/Makefile.am (EXTRA_SCRIPTS): Remove definition.
7249         (bin_PROGRAMS): Add nohup.
7250         (EXTRA_DIST): Remove nohup.sh.
7251         (all_programs): Remove use of $(EXTRA_SCRIPTS).
7252         * src/nohup.sh: Remove file.
7253         * man/Makefile.am (nohup.1): Depend on nohup.c, rather than nohup.sh.
7254
7255         * tests/misc/nohup: Tests for the above.
7256         * tests/misc/Makefile.am (TESTS): Add nohup.
7257
7258         * src/head.c (diagnose_copy_fd_failure): New function, renamed from
7259         the macro, COPY_FD_DIAGNOSE.
7260         (diagnose_copy_fd_failure): Enclose diagnostic in _(...).
7261         (head_file): Likewise.
7262
7263         * src/date.c: Include "quote.h".
7264         (batch_convert): Use the quote function rather than using literal `...'
7265         in a diagnostic.
7266
7267         * src/setuidgid.c (main): Enclose diagnostic in _(...).
7268         * src/fmt.c (main): Likewise.
7269         * src/mknod.c (main): Likewise.
7270         * src/tac.c (tac_seekable): Likewise.
7271         * src/yes.c (main): Likewise.
7272         * src/od.c (main): Likewise.
7273         * src/install.c (change_attributes): Likewise.
7274
7275 2003-07-10  Jim Meyering  <jim@meyering.net>
7276
7277         * src/head.c (usage): Use 1024*1024 in place of 1048576.
7278         * src/tail.c (usage): Likewise.
7279
7280         * tests/rm/fail-2eperm: Now that we have setuidgid, use it in
7281         place of the kludge in this test.  Suggestion from Paul Jarc.
7282
7283         * src/Makefile.am (noinst_PROGRAMS): Define to setuidgid.
7284         * src/setuidgid.c: New program, solely for testing (not installed).
7285
7286         * src/chown-core.c (change_file_owner): Don't leak file descriptors
7287         when dereferencing symlinks.
7288
7289 2003-07-09  Jim Meyering  <jim@meyering.net>
7290
7291         * tests/du/slash: New file/test for today's lib/ftw.c fix.
7292         * tests/du/Makefile.am (TESTS): Add slash
7293
7294         * src/tail.c (xlseek): Avoid warning about ``return without value
7295         from function returning non-void''.
7296
7297 2003-07-08  Jim Meyering  <jim@meyering.net>
7298
7299         * man/help2man: Update to version 1.29.
7300
7301         * man/help2man: Add END handler to close STDOUT and check for errors.
7302
7303 2003-06-30  Paul Eggert  <eggert@twinsun.com>
7304
7305         Add support for a "[" that conforms to the GNU coding standards,
7306         i.e., that does not depend on its name.
7307         * src/lbracket.c: New file.
7308         * README: Add "[".
7309         * man/Makefile.am (programs): Ignore "[", since it doesn't have
7310         a separate man page.
7311         * src/Makefile.am (bin_PROGRAMS): Add "[".
7312         (__SOURCES): New var.
7313         * src/test.c (LBRACKET): Define to 0 if not defined.
7314         (main): Use LBRACKET rather than argv[0].
7315
7316         * src/test.c (one_argument): Do not check for -t if POSIXLY_CORRECT.
7317         Reported by Paul Jarc and Dan Jacobson.
7318
7319         * src/test.c (main): Do not recognize --help or --version if
7320         POSIXLY_CORRECT, when invoked as "test".  Handle "[ ]" correctly.
7321         Do not bother testing that margv[margc] is non-null.
7322
7323 2003-07-04  Jim Meyering  <jim@meyering.net>
7324
7325         * src/who.c (print_line): Rewrite to use asprintf, in order to be
7326         able to avoid emitting trailing spaces.  Reported by Dan Jacobson.
7327
7328         * tests/misc/head-elide-tail: Add tests of head's new --lines=-N
7329         option, and perform the +1600 invocations of head IFF the envvar
7330         RUN_EXPENSIVE_TESTS is set.
7331
7332 2003-07-03  Jim Meyering  <jim@meyering.net>
7333
7334         * src/cp.c (do_copy): Give a better diagnostic when failing due
7335         to nonexistent destination directory.  Reported by Dmitry Rutsky.
7336         See http://bugs.debian.org/199730 for details.
7337
7338 2003-06-27  Jim Meyering  <jim@meyering.net>
7339
7340         split's --verbose option did nothing [broken in 4.5.10 and 5.0]
7341         * src/split.c (longopts): Use `1', not `0' as the value for
7342         for &verbose.  Reported by Keith Thompson.
7343
7344         Test for the above fix.
7345         * tests/misc/split-a: Also use --verbose and compare stderr
7346         output with what we'd expect.
7347
7348 2003-06-20  Jim Meyering  <jim@meyering.net>
7349
7350         * src/copy.c (copy_internal) [HAVE_STRUCT_STAT_ST_AUTHOR]:
7351         Use `error_t' (rather than int) as type for local `err'.
7352         From Alfred M. Szmidt.
7353
7354 2003-06-19  Marcus Brinkmann  <marcus@gnu.org>
7355
7356         * src/copy.c (copy_internal) [HAVE_STRUCT_STAT_ST_AUTHOR]:
7357         Fix author preservation code.
7358
7359 2003-06-19  Jim Meyering  <jim@meyering.net>
7360
7361         * src/ln.c (ENABLE_HARD_LINK_TO_SYMLINK_WARNING): Define to 0.
7362         (do_link): Don't warn about hard link to symlink.
7363
7364 2003-06-18  Jim Meyering  <jim@meyering.net>
7365
7366         * src/cut.c: Include "getdelim2.h", not "getstr.h".
7367         Reflect renaming: getstr -> getdelim2.
7368
7369         * src/comm.c, src/join.c, src/nl.c, src/uniq.c: Reflect renaming:
7370         readline -> readlinebuffer.
7371
7372 2003-06-09  John David Anglin  <dave.anglin@nrc-cnrc.gc.ca>
7373
7374         * src/readlink.c: Include <sys/types.h> before system.h (because
7375         the latter includes <sys/stat.h>).  Required on Ultrix 4.3.
7376
7377 2003-06-17  Jim Meyering  <jim@meyering.net>
7378
7379         * src/system.h (initialize_main): Define.
7380         Use it in every `main'.  Applied via this:
7381         p='initialize_main (&argc, &argv);'
7382         perl -ni -e '/program_name.=.argv.0/ and print "  '"$p"'\n"; print' \
7383           $(grep -l program_name.=.argv.0 *.c)
7384         test.c uses margc/margv, so I made the change manually for that file.
7385         Based on a patch from Bernard Giroud.
7386
7387 2003-06-09  John David Anglin  <dave.anglin@nrc-cnrc.gc.ca>
7388
7389         Fix for build failure on Ultrix 4.3.
7390         * src/stat.c: Include sys/statvfs.h in preference to sys/vfs.h.
7391         Include sys/param.h and sys/mount.h on ultrix.
7392
7393 2003-06-16  Jim Meyering  <jim@meyering.net>
7394
7395         * src/touch.c (O_NDELAY, O_NONBLOCK, O_NOCTTY, EISDIR): Remove
7396         definitions.
7397         * src/system.h (O_NDELAY, O_NONBLOCK, O_NOCTTY, EISDIR): Define
7398         them here instead, but with one change: define EISDIR to -1, not 0.
7399
7400         * src/cat.c (cat): Remove `#ifndef ENOSYS', now that it's
7401         guaranteed to be defined.
7402         * src/system.h (ENOSYS, ENOTSUP): Define to -1 if not defined.
7403
7404         * README: Mention the CVS repository.
7405         Encourage addition of test cases.
7406
7407 2003-06-12  Jim Meyering  <jim@meyering.net>
7408
7409         * src/touch.c (touch): Call close only if necessary.
7410         From Bruno Haible.
7411
7412         * src/wc.c (usage): Correct wording: wc prints counts in the order
7413         `newline, word, byte'.  Reported by Keith M. Briggs.
7414         * man/wc.x: Fix it here, too.  And change `lines' to `newlines'.
7415
7416 2003-06-10  Jim Meyering  <jim@meyering.net>
7417
7418         * tests/date/Test.pm: Add a test for the new format, e.g., May-23-2003.
7419
7420 2003-06-07  Jim Meyering  <jim@meyering.net>
7421
7422         * Makefile.maint (syntax-check): Add commented-out (over-aggressive)
7423         rule.
7424
7425 2003-06-06  Jim Meyering  <jim@meyering.net>
7426
7427         * src/extract-magic (main): Avoid newer 3-arg form of open,
7428         so this script works also with e.g., perl5.005_03.
7429         Patch by John David Anglin.
7430
7431 2003-06-04  Paul Eggert  <eggert@twinsun.com>
7432
7433         * src/system.h: Include <stdbool.h> unconditionally.
7434
7435 2003-06-04  Jim Meyering  <jim@meyering.net>
7436
7437         * man/Makefile.am (check-programs-vs-x): Rename target
7438         from check-programs-vs-1.  Adjust rule to check for the
7439         primary (.x) file, not the generated one (.1).
7440
7441 2003-06-03  Tim Mooney <mooney@dogbert.cc.ndsu.NoDak.edu>
7442
7443         * man/kill.x: New file.
7444         * man/Makefile.am (dist_man_MANS): Add kill.1.
7445         (kill.1): New rule.
7446
7447 2003-06-04  Jim Meyering  <jim@meyering.net>
7448
7449         Ensure that the .x file for a new program is never forgotten again.
7450         * man/Makefile.am (programs): Define.
7451         (check-programs-vs-1): New phony target.
7452         (check-local): Depend on it.
7453
7454 2003-06-03  Jim Meyering  <jim@meyering.net>
7455
7456         Avoid unnecessary copying of environment.
7457         * src/env.c (main): Rather than clearing the environment and --
7458         unless told to ignore environment -- copying all settings from
7459         the saved, original environment, clear the environment only when
7460         that is requested.  Suggested by Jens Elkner.
7461
7462 2003-06-02  Jim Meyering  <jim@meyering.net>
7463
7464         * src/system.h: Always include <string.h>, since we assume C89.
7465         Include <limits.h> without checking for HAVE_LIMITS_H.
7466
7467         * src/test.c [!TEST_STANDALONE]: Remove #if-0'd block.
7468         (STREQ, S_IXUGO): Remove redundant (in system.h) definitions.
7469
7470 2003-06-01  Jim Meyering  <jim@meyering.net>
7471
7472         Avoid a race condition in `tail -f' described by Ken Raeburn in
7473         http://mail.gnu.org/archive/html/bug-textutils/2003-05/msg00007.html
7474         * src/tail.c (file_lines): Add new parameter, *read_pos, and set it.
7475         (pipe_lines, pipe_bytes, start_bytes, start_lines): Likewise.
7476         (tail_bytes, tail_lines, tail): Likewise.
7477         (tail_file): Use the new `read_pos' value as the size,
7478         rather than stats.st_size from the fstat call.
7479
7480 2003-05-28  Jim Meyering  <jim@meyering.net>
7481
7482         * src/extract-magic: Allow expansion of `$file' in the here-
7483         document corresponding to the comment at the top of fs.h.
7484
7485 2003-05-26  Jim Meyering  <jim@meyering.net>
7486
7487         * src/stat.c: Fix portability problem on FreeBSD5.0: don't include
7488         <sys/statvfs.h> on systems without HAVE_STRUCT_STATVFS_F_BASETYPE.
7489         Use #if/#elif/... cascade so we get only one set of include files.
7490         Reported by Nelson Beebe.
7491
7492 2003-05-24  Jim Meyering  <jim@meyering.net>
7493
7494         * src/md5sum.c (split_3): Accept the BSD format only when in MD5 mode.
7495         * tests/sha1sum/basic-1: Make sure `sha1sum --check' doesn't
7496         accept the BSD format.
7497
7498 2003-03-28  Joe Orton  <jorton@redhat.com>
7499
7500         * src/md5sum.c (bsd_split_3): New function.
7501         (split_3): Detect checksums from BSD 'md5' command and handle them
7502         using bsd_split_3.
7503
7504         * tests/md5sum/basic-1: New tests for --check exit status, and for
7505         BSD-style checksum files.
7506
7507 2003-05-21  Jim Meyering  <jim@meyering.net>
7508
7509         * src/head.c (elide_tail_lines_pipe): Fix a thinko.
7510         This sort of thing is why it'd be *Really Good* to factor
7511         out the common code used here and in tail.c.
7512
7513 2003-05-14  Jim Meyering  <jim@meyering.net>
7514
7515         * src/head.c (usage): Document new feature: --bytes=-N and --lines=-N.
7516
7517         * tests/du/slink: Skip this test if `.' is on an XFS file system.
7518
7519         * tests/du/fd-leak: New file.  Test for the bug in du that
7520         was fixed by the 2003-05-12 change to lib/ftw.c.
7521         * tests/du/Makefile.am (TESTS): Add fd-leak.
7522
7523         * src/head.c (AUTHORS): Enclose string in N_(...), now that it
7524         includes a translatable word, `and'.
7525
7526         * src/dd.c (usage): Don't use `,' as the thousands separator
7527         in e.g. 1,000,000 and 1,048,576.  Instead, do this:
7528         `SIZE may be ..., MB 1000*1000, M 1024*1024 and so on...'
7529         * src/df.c (usage): Likewise.
7530         * src/du.c (usage): Likewise.
7531         * src/ls.c (usage): Likewise.
7532
7533         * Makefile.maint (syntax-check): Add another check.
7534
7535 2003-05-13  Paul Eggert  <eggert@twinsun.com>
7536
7537         Fix uniq to conform to POSIX, which requires that "uniq -d -u"
7538         must output nothing.  Problem reported by Josh Hyman.
7539
7540         * src/uniq.c (enum output_mode, mode): Remove, replacing with:
7541         (output_unique, output_first_repeated, output_later_repeated):
7542         New vars.  All uses of "mode" changed to use these variables,
7543         which are not mutually exclusive as "mode" was.
7544         (writeline): New arg "match", used to control whether to
7545         obey output_first_repeated or output_later_repeated.
7546         All callers changed.
7547         (check_file, main): Adjust to above changes.
7548
7549         * tests/uniq/Test.pm: Test that 'uniq -d -u' outputs nothing.
7550
7551 2003-05-14  Jim Meyering  <jim@meyering.net>
7552
7553         * tests/rm/rm3: Use tr's \n notation rather than \012.
7554         This package can afford to do that, since its tests are guaranteed use
7555         GNU tr, which has accepted the more modern notation for 10 years.
7556         * tests/rm/rm5: Likewise.
7557         * tests/cp/same-file: Likewise.
7558         * tests/stty/row-col-1: Likewise.
7559         * tests/stty/basic-1: Likewise.
7560         * tests/rm/deep-1: Likewise.
7561         * tests/mv/part-symlink: Likewise.
7562         * tests/mkdir/perm: Likewise.
7563         * tests/misc/nice: Likewise.
7564
7565 2003-05-13  Jim Meyering  <jim@meyering.net>
7566
7567         * src/copy.c (struct F_triple) [name]: Remove const attribute.
7568         (triple_free): Don't apply cast to argument of free.
7569         (seen_file): Add cast here instead.
7570
7571         * src/cp-hash.c (struct Src_to_dest) [name]: Remove const attribute.
7572         (src_to_dest_free): Don't apply cast to argument of free.
7573
7574         * src/sort.c (zaptemp): Don't apply cast to argument of free.
7575         * src/pr.c (init_fps, init_store_cols): Likewise.
7576         * src/join.c (delseq, freeline): Likewise.
7577         * src/expr.c (OLD): Likewise.
7578         * src/sort.c (sort): Likewise.
7579         * src/head.c (elide_tail_lines_pipe): Likewise.
7580
7581         * src/tail.c: Include "quote.h".
7582         Use quote in diagnostics.  Change many error format strings
7583         from just `%s' to e.g., `error reading %s'.
7584         (pipe_lines): Change type of parameter, n_lines, to uintmax_t.
7585         Rewrite newline-counting loop to use memchr.
7586
7587         * src/head.c (elide_tail_lines_pipe): Use `if', not assert.
7588         Now that assert is no longer used, don't include <assert.h>.
7589
7590 2003-05-12  Jim Meyering  <jim@meyering.net>
7591
7592         * src/head.c: Include <assert.h>.
7593         (AUTHORS): Add my name.
7594         (elide_tail_lines_pipe): New function.
7595
7596 2003-05-10  Jim Meyering  <jim@meyering.net>
7597
7598         * Makefile.maint (syntax-check): Check for `error (EXIT_SUCCESS,'.
7599
7600         * src/readlink.c (main): Set program_name before first use.
7601         Remove that (redundant) first use.
7602         Don't exit successfully just because --verbose was specified.
7603         Pass 0, not EXIT_SUCCESS, as first argument to error; when that
7604         parameter is 0, error does not exit.
7605
7606         * src/uname.c (main): When failing due to too many arguments, also say
7607         that, rather than just "Try `uname --help' for more information.".
7608         * src/comm.c (main): Likewise, but for too few arguments.
7609         * src/logname.c: Include error.h.
7610         (main): Say why we're failing.
7611
7612         * src/uniq.c (main): Don't segfault when argc < optind.
7613         * src/who.c (main): Handle argc < optind.
7614         * src/df.c (main): Likewise.
7615         * src/install.c (main): Likewise.
7616         * src/mv.c (main): Likewise.
7617         * src/pwd.c (main): Likewise.
7618         * src/tty.c (main): Likewise.
7619         * src/chroot.c (main): Likewise.
7620         * src/hostname.c: Likewise.
7621         * src/du.c (main): Likewise.
7622         * src/expand.c (main): Likewise.
7623         * src/env.c (main): Likewise.
7624         * src/unexpand.c (main): Likewise.
7625         * src/printenv.c (main): Likewise.
7626         * src/sync.c (main): Handle argc == 0.
7627         * src/expr.c (main): Likewise.
7628         * src/printf.c (main): Likewise.
7629         * src/basename.c (main): Likewise.
7630         * src/ln.c (main): Test for `missing argument' before computing n_files.
7631         * src/tail.c (main): Test for the case of no arguments before
7632         computing n_files.
7633
7634         * src/kill.c (send_signals): Don't check command line arguments here.
7635         (main): Check them here instead.  Handle argc < optind.
7636
7637         * src/logname.c (main): Use error, rather than fprintf, for the sake
7638         of consistency.
7639
7640         * src/rm.c (main): Don't overrun array bound if argc is 0.
7641
7642 2003-05-09  Jim Meyering  <jim@meyering.net>
7643
7644         * src/sort.c (main): Don't overrun array bound if argc is 0.
7645         That would happen when invoked via: execl ("/usr/bin/sort", NULL);
7646         Reported by Wartan Hachaturow.
7647
7648 2003-05-07  Jim Meyering  <jim@meyering.net>
7649
7650         Implement support so that `head --lines=-N' works on seekable files.
7651         * src/head.c (enum Copy_fd_status): Define.
7652         (COPY_FD_DIAGNOSE): New macro.
7653         (elide_tail_lines_seekable): New funtion.
7654         (elide_tail_lines_file): Call it here.
7655
7656 2003-05-06  Jim Meyering  <jim@meyering.net>
7657
7658         * src/sys2.h (CHAR_BIT): Remove duplicate definition.
7659
7660 2003-05-04  Jim Meyering  <jim@meyering.net>
7661
7662         * tests/head/Test.pm: Remove tests of --bytes=-N; using that framework
7663         caused the addition of thousands of small files to the tar archive.
7664         * tests/misc/head-elide-tail: New file.  Add them here instead.
7665         * tests/misc/Makefile.am (TESTS): Add head-elide-tail.
7666
7667 2003-05-04  Paul Eggert  <eggert@twinsun.com>
7668
7669         * src/remove.c (HAVE_WORKING_READDIR): Define to 0 if not defined.
7670         (IF_READDIR_NEEDS_REWINDDIR): Remove.
7671         (remove_cwd_entries): Rewrite to avoid IF_READDIR_NEEDS_REWINDDIR,
7672         which was a bit weird because it couldn't be emulated by a function.
7673
7674 2003-05-03  Jim Meyering  <jim@meyering.net>
7675
7676         Extend head to accept --lines=-N (--bytes=-N) and to print all
7677         but the N lines (bytes) at the end of the file.
7678         * src/head.c: Include full-write.h, full-read.h, inttostr.h, quote.h.
7679         Use quote() in diagnostics, rather than literal `' marks.
7680         (copy_fd, elide_tail_bytes_pipe, elide_tail_bytes_file):
7681         New functions.
7682         (elide_tail_lines_pipe, elide_tail_lines_file): New functions.
7683         (head_file): Reorganize so as to call head from only one place.
7684         (main): Likewise, for head_file.
7685         Handle new, undocumented option, --presume-input-pipe.
7686         Handle negative line and byte counts.
7687         * tests/head/Test.pm: Add lots of tests to exercise --bytes=-N.
7688
7689         * tests/du/8gb: Skip test if the file system of `.' doesn't support
7690         sparse files -- otherwise it'd create a file of size 8GB.
7691
7692 2003-05-02  Jim Meyering  <jim@meyering.net>
7693
7694         * src/fmt.c (usage): Don't mention obsolescent -WIDTH option.
7695         Instead explain about `-' and standard input.
7696         (main): Give a proper diagnostic for e.g., `fmt -c -72'.
7697         Reported by Keith Thompson.
7698         * tests/fmt/basic: Add test for the above fix.
7699
7700         * src/fmt.c: Include "quote.h".
7701         Use quote() in diagnostics, rather than literal `' marks.
7702         (main): Exit nonzero when unable to open an input file.
7703         * tests/fmt/basic: Add test for the above fix.
7704
7705         * src/fmt.c (main): Diagnose invalid suffix on obsolescent width
7706         specifications like `-72x'.
7707         * tests/fmt/basic: Add test for the above fix.
7708
7709         Work around nasty readdir bug on Darwin6.5.
7710         * src/remove.c (IF_READDIR_NEEDS_REWINDDIR): Define.
7711         [! HAVE_WORKING_READDIR] (remove_cwd_entries): If readdir has just
7712         returned NULL and there has been at least one successful unlink or
7713         rmdir call since the opendir or previous rewinddir, then call
7714         rewinddir and reiterate the loop.
7715
7716         Factor out common code.
7717         * src/remove.c (readdir_ignoring_dotdirs): New function.
7718         (is_empty_dir): Use it here.
7719         (remove_cwd_entries): Use it here.
7720
7721 2003-05-01  Jim Meyering  <jim@meyering.net>
7722
7723         * tests/rm/r-3: Create 500 rather than just 300 files.
7724         There's a bug in Darwin6.5's readdir that shows up only with
7725         338 or more files.
7726         Fix a bug in this test: `cd $pwd' (not to `..'), now that $tmp
7727         has two components.
7728
7729         * src/tail.c:
7730         Change type of n_units, n_bytes, n_lines to be `uintmax_t'.
7731         (dump_remainder): Move two declarations `down' into the scope
7732         where they are used.
7733         (xlseek): Return the resulting offset.
7734         (file_lines): Rename parameter, file_length, to end_pos.
7735         (pipe_lines): Don't coerce safe_read return value to `int'.
7736         Adapt tests accordingly.
7737         (pipe_bytes) [struct charbuffer] (nbytes): Change type from `int'
7738         to `unsigned int'.
7739         Change type of `total_bytes' from `int' to `size_t',
7740         since the former wouldn't always be wide enough.
7741         Don't coerce safe_read return value to `int',
7742         and adapt tests accordingly.
7743         Now that testing for a read error no longer involves
7744         using `tmp', handle that case *after* freeing `tmp'.
7745         (start_bytes): Clean up.
7746         (tail_bytes): Now that `n_bytes' may be larger than
7747         OFF_T_MAX, test for that condition and, if it's true, don't
7748         use lseek optimizations.
7749         (parse_options): Don't fail just because N_UNITS is larger than
7750         the maximum size of a file -- tail may be applied to an input
7751         stream (e.g., a pipe) with more data than that.
7752
7753         * Makefile.maint (syntax-check): Rename from alloc-check.
7754         Also check for SPACE-TAB sequences.
7755         Also check for malloc/calloc/realloc casts.
7756
7757 2003-05-01  Jim Meyering  <jim@meyering.net>
7758
7759         * src/tail.c (start_lines): Rewrite to use memchr.  Clean up.
7760
7761 2003-04-28  Jim Meyering  <jim@meyering.net>
7762
7763         * tests/misc/tty-eof: Send two tokens, not just one, so we don't
7764         make the now-more-picky tsort fail.
7765
7766 2003-04-24  Jim Meyering  <jim@meyering.net>
7767
7768         * src/tsort.c (tsort): Remove unnecessary test of have_read_stdin.
7769         (main): Minor syntactic clean-up.
7770
7771         * src/tsort.c (tsort): Fail if the input contains an odd number of
7772         tokens.  Reported by junkio@cox.net.
7773
7774         * tests/tsort/basic-1: Test for the above fix.
7775
7776 2003-04-21  Jim Meyering  <jim@meyering.net>
7777
7778         * tests/misc/printf: Add tests for the printf fixes below.
7779
7780         * Makefile.cfg (cvs_files): Add $(srcdir)/config/depcomp to the list.
7781
7782 2003-04-20  Paul Eggert  <eggert@twinsun.com>
7783
7784         Fix printf POSIX compatibility bug reported by Ben Harris in
7785         <http://mail.gnu.org/archive/html/bug-coreutils/2003-04/msg00070.html>.
7786         * doc/coreutils.texi (printf invocation): It's \NNN in the format,
7787         \0NNN in the %b operand.
7788         * src/printf.c (usage): Likewise.
7789         (print_esc): New arg OCTAL0 to specify whether \0NNN or \NNN
7790         is desired.  All uses changed.  Behave like Bash printf if %b
7791         operand uses \NNN where the initial N is not 0.
7792
7793 2003-04-17  Jim Meyering  <jim@meyering.net>
7794
7795         * src/stty.c: Remove uses of PROTOTYPE macro.
7796
7797 2003-04-15  Jim Meyering  <jim@meyering.net>
7798
7799         * Makefile.maint: Remove (or replace-with-TAB(s) to retain alignment)
7800         each sequence of spaces before a TAB character.
7801
7802 2003-04-13  Jim Meyering  <jim@meyering.net>
7803
7804         * src/remove.c (is_empty_dir): Don't closedir (NULL).
7805
7806 2003-04-12  Jim Meyering  <jim@meyering.net>
7807
7808         Giving nl an invalid STYLE argument (in --header-numbering=STYLE (-h),
7809         --body-numbering=STYLE (-b), or --footer-numbering=STYLE (-f)) or
7810         FORMAT (--number-format=FORMAT (-n)) would not give a useful diagnostic.
7811         * src/nl.c (main): Fix those problems and remove literal quote marks
7812         (e.g., "`%s'") from format string; instead use "%s" in each format
7813         string and `quote (optarg)' as the corresponding argument.
7814         Also, diagnose all invalid command line options before failing.
7815
7816         * src/nl.c (proc_text): Fix a bug that would make nl output extra
7817         newlines in some cases.  Details here: http://bugs.debian.org/177256.
7818         This bug was introduced on 2001-11-10 for textutils-2.0.17.
7819         * tests/misc/nl: Add test for the above-fixed bug.
7820
7821         * tests/misc/readlink: New file.  Test the --canonicalize option.
7822         * tests/misc/Makefile.am (TESTS): Add readlink.
7823
7824 2003-04-11  Jim Meyering  <jim@meyering.net>
7825
7826         Clean up.
7827         * src/chown.c, src/cp.c, src/dircolors.hin, src/du.c, src/ln.c:
7828         * src/mkfifo.c, src/ptx.c, src/spline.c, src/stty.c, src/tail.c:
7829         * src/test.c, src/unexpand.c: Remove (or replace-with-TAB(s) to
7830         retain alignment) each sequence of spaces before a TAB character.
7831
7832         * src/ls.c: Include <stdlib.h> unconditionally.
7833
7834         * Makefile.maint (xalloc-check): Rename from header-check.
7835
7836         * src/yes.c: Include error.h after system.h, not before.
7837
7838         Clean up.
7839         * src/copy.c, src/cp-hash.c, src/cp.c, src/csplit.c, src/cut.c:
7840         * src/date.c, src/df.c, src/du.c, src/expand.c, src/expr.c, src/id.c:
7841         * src/join.c, src/md5sum.c, src/nl.c, src/od.c, src/paste.c, src/pr.c:
7842         * src/ptx.c, src/sort.c, src/split.c, src/su.c, src/tail.c, src/tee.c:
7843         * src/tr.c: * src/unexpand.c, src/users.c:
7844         Remove anachronistic casts of xmalloc, xrealloc, and xcalloc
7845         return values and of xrealloc's first argument.
7846         Fix the former with this:
7847         perl -pi -e 's/\([^(]*?\*\) *(x(m|c|re)alloc)\b/$1/'
7848
7849 2003-04-10  Jim Meyering  <jim@meyering.net>
7850
7851         * src/stty.c (wrapf): Declare with format attribute.
7852
7853         The S_MAGIC_... names shouldn't be maintained in two places (prior
7854         to this change, one would have to keep stat.c and fs.h in sync).
7855         This change makes it so those names and the corresponding
7856         hexadecimal constants all reside in stat.c.  fs.h is now generated.
7857         * src/Makefile.am (fs.h): New rule to generate fs.h from stat.c.
7858         (BUILT_SOURCES): Add fs.h, now that it's generated.
7859         (EXTRA_DIST): Add extract-magic.
7860         * src/extract-magic: New script to extract fs.h definitions from stat.c.
7861         * src/stat.c (human_fstype) [__linux__]: Append each hex constant from
7862         fs.h in a comment after the corresponding `case S_MAGIC_...:' statement.
7863
7864         * tests/tail-2/big-4gb: Skip this test (don't fail) if creating a
7865         file with nominal length > 4GB fails.  Reported by Michael Deutschmann.
7866
7867         * man/unexpand.x: Add `SEE ALSO' reference to expand.
7868         * man/expand.x: Add `SEE ALSO' reference to unexpand.
7869         Suggestion from Dan Jacobson.
7870
7871 2003-04-10  Maciej W. Rozycki  <macro@ds2.pg.gda.pl>
7872
7873         * src/fs.h (S_MAGIC_DEVPTS): New magic for Linux's devpts.
7874         * src/stat.c (human_fstype): Handle Linux's devpts.
7875
7876 2003-04-09  Paul Eggert  <eggert@twinsun.com>
7877
7878         * src/split.c (line_bytes_split): Arg is of type size_t, since
7879         that's all that is supported for now.
7880         (main): Check for overflow in obsolescent line count option.
7881
7882 2003-04-09  Jim Meyering  <jim@meyering.net>
7883
7884         * tests/misc/split-fail: Add a new test for the above fix.
7885
7886         * src/split.c (bytes_split): Use size_t temporary (rather than
7887         uintmax_t original) in remaining computations.  From Paul Eggert.
7888
7889         Handle command line option arguments larger than 2^31.
7890         This allows e.g., splitting into files of size 2GB and larger,
7891         and running split --lines=N with N=2^31 or more.
7892         But for --line-bytes=N, the restriction that N <= SIZE_MAX
7893         remains (for now), due to the way it is implemented.
7894
7895         * src/split.c: Include "inttostr.h".
7896         (bytes_split, lines_split, line_bytes_split, main):
7897         Use uintmax_t, not size_t, for file sizes.
7898         (main): Give a better diagnostic for option arguments == 0.
7899         Use umaxtostr to print file sizes.
7900         Reported by Luke Hassell.
7901
7902 2003-04-08  Jim Meyering  <jim@meyering.net>
7903
7904         * src/rm.c (usage): Mention that --directory (-d) works only
7905         on some systems.  Suggestion from Samuel Tardieu.
7906
7907         * tests/basename/basic: Run $PERL to see if it is available,
7908         rather than testing its value.
7909         * tests/sum/sysv, tests/tsort/basic-1, tests/unexpand/basic-1:
7910         * tests/basename/basic, tests/dd/skip-seek, tests/dircolors/simple:
7911         * tests/expr/basic, tests/factor/basic, tests/fmt/basic:
7912         * tests/ls-2/tests, tests/md5sum/basic-1, tests/md5sum/newline-1:
7913         * tests/misc/sort, tests/misc/tty-eof, tests/mv/i-1:
7914         * tests/rm/empty-name, tests/rm/fail-eperm, tests/rm/unreadable:
7915         * tests/seq/basic, tests/sha1sum/basic-1, tests/sha1sum/sample-vec:
7916         * tests/sum/basic-1, tests/seq/basic: Likewise.
7917
7918         * tests/misc/Makefile.am (TESTS): Add split-fail.
7919         * tests/misc/split-fail: New file.
7920
7921         * src/split.c: Rename local variables: nchars -> n_bytes.
7922         (lines_split): Rename local, nlines -> n_lines.
7923         (main): Rename local variable: s/accum/n_units/.
7924         (main): Use STDIN_FILENO, not literal `0'.
7925
7926 2003-04-07  Jim Meyering  <jim@meyering.net>
7927
7928         * src/stat.c: Add #include directives for Ultrix 4.4.
7929         Based on a suggested change from Bert Deknuydt.
7930
7931 2003-04-06  Jim Meyering  <jim@meyering.net>
7932
7933         * Makefile.maint (makefile-check): New rule.
7934         (local-check): Add it.
7935
7936 2003-04-05  Jim Meyering  <jim@meyering.net>
7937
7938         * Makefile.am (nearly all of them):
7939         Use $(VAR) rather than @VAR@, now that we can rely on automake to
7940         emit a definition for each substituted variable.
7941         * tests/Makefile.am.in: Likewise.
7942
7943         * tests/rm/rm5: Add a comment explaining why this test fails when
7944         using Tru64's broken sed.
7945         * tests/rm/rm3: Likewise.
7946
7947         Make `kill -t' output signal descriptions (not `?') on Tru64.
7948         * src/kill.c (sys_siglist): Also check for __sys_siglist.
7949         Patch by Tony Leneis.
7950         * configure.ac: Also check for declaration of __sys_siglist.
7951         Required for Tru64 4.0D, 4.0F, and 5.1.
7952         Reported by Tony Leneis.
7953
7954 2003-04-04  Jim Meyering  <jim@meyering.net>
7955
7956         * src/Makefile.am (PERL): Remove unnecessary definition.
7957
7958         Because of inappropriate (but POSIX-mandated) behavior of rename,
7959         `mv a b' would not remove `a' in some unusual cases.  Work around
7960         this by unlinking `a' when necessary.
7961
7962         * src/copy.c (same_file_ok): Add an output parameter.
7963         Set it in the offending case.
7964         (copy_internal): When necessary, unlink SRC_PATH and inform caller.
7965         Reported by Ed Avis.
7966         * tests/mv/hard-4: New test for the above.
7967         * tests/mv/Makefile.am (TESTS): Add hard-4.
7968
7969         Clean up rules for automatically generated sources:
7970         * src/Makefile.am (dircolors.h, wheel-size.h, wheel.h, false.c):
7971         Make each generated file be read-only.
7972         Add each file name to BUILT_SOURCES separately.
7973         (MAINTAINERCLEANFILES): Set to $(BUILT_SOURCES).
7974
7975         Put LOCALEDIR macro definition in new file: localedir.h.
7976         * src/Makefile.am (DEFS): Remove definition.
7977         (localedir.h): New rule.
7978         (BUILT_SOURCES, DISTCLEANFILES): Add localedir.h.
7979         * src/system.h: Include "localedir.h".
7980
7981 2003-04-02  Jim Meyering  <jim@meyering.net>
7982
7983         * Version 5.0.
7984
7985         * tests/misc/Makefile.am (TESTS): Add false.
7986
7987         * Makefile.maint (TMPDIR): Make sure it's defined.
7988         (my-distcheck): Build in $(TMPDIR), not `.'.
7989
7990         * src/Makefile.am (false.c): Change all occurrences of
7991         `(EXIT_SUCCESS)' to `(EXIT_FAILURE)' so that false exits
7992         unsuccessfully also with --help.  Reported by Paul Jarc,
7993         * tests/misc/false: New test for the above.
7994
7995 2003-03-30  Jim Meyering  <jim@meyering.net>
7996
7997         * NEWS: Note the location of older NEWS files.
7998
7999         * src/remove.c (is_empty_dir): Don't let a failing closedir
8000         clobber errno.  Spotted by Arnold Robbins.
8001
8002         * src/env.c: Fix typo in comment.  From Arnold Robbins.
8003
8004 2003-03-29  Jim Meyering  <jim@meyering.net>
8005
8006         * Version 4.5.12.
8007
8008         * README: Note to expect build problems for stat.c on Ultrix 4.3.
8009         Note that there are some harmless test failures when running
8010         `make check' as root on some systems.
8011
8012 2003-03-28  Jim Meyering  <jim@meyering.net>
8013
8014         * tests/stty/row-col-1: Skip this test if stty can't get window size.
8015         This happens when connecting to sparc-solaris5.7 via ssh from within
8016         emacs.  Reported by Karl Berry.
8017
8018         * tests/du/basic: Use seq, not `yes' to generate 4KB of data.
8019         Otherwise, on systems (DJGPP) that emulate pipes using files,
8020         this test would never complete, waiting for `yes' to terminate.
8021         * tests/du/slink: As above, use seq, not `yes' to generate link target.
8022         * tests/rm/hash: As above, use seq, not `yes' to generate dir name.
8023         Reported by Rich Dawe.
8024
8025 2003-03-27  Jim Meyering  <jim@meyering.net>
8026
8027         * src/id.c: Remove Arnold Robbins' obsolete e-mail address
8028         from `written by...' comment, at his request.
8029
8030 2003-03-24  Paul Eggert  <eggert@twinsun.com>
8031
8032         Fix buffer overrun problem reported by TAKAI Kousuke, along
8033         with some other POSIX incompatibilities.
8034
8035         * src/printf.c (print_esc): Do not treat \x specially if
8036         POSIXLY_CORRECT.  Avoid buffer overrun if the format ends
8037         in backslash.  Treat incomplete escape sequences as strings
8038         of characters, as POSIX requires.
8039         (print_formatted): Allow multiple flags.  Avoid buffer overrun
8040         if the format is incomplete.
8041
8042 2003-03-24  Jim Meyering  <jim@meyering.net>
8043
8044         * tests/misc/printf: Add tests for the above fixes and changes.
8045
8046 2003-03-26  Jim Meyering  <jim@meyering.net>
8047
8048         * src/copy.h (struct cp_options): Add a comment.
8049
8050 2003-03-23  Jim Meyering  <jim@meyering.net>
8051
8052         * README: Describe problem with 64-bit mode on HPUX 11.x,
8053         with patch for /usr/include/inttypes.h.
8054         * TODO: Plan to add an autoconf test to work around the bug.
8055
8056 2003-03-22  Jim Meyering  <jim@meyering.net>
8057
8058         * src/stat.c: Don't include <sys/sysmacros.h>.
8059         That is already done via system.h.  Otherwise, the multiple
8060         inclusion would evoke redefinition warnings from Cray's /bin/cc,
8061         aka Cray Standard C Version 4.0.3  (057126) Mar 22 2003  22:02:28.
8062         (human_fstype): Factor some directives `up', out of this function.
8063         Cast away `const' to avoid error from Cray's /bin/cc.
8064
8065 2003-03-20  Jim Meyering  <jim@meyering.net>
8066
8067         * announce-gen (print_changelog_deltas): Ensure that a newline
8068         precedes each row of `*'s.
8069
8070 2003-03-20  Jim Meyering  <jim@meyering.net>
8071
8072         * Version 4.5.11.
8073
8074         * src/seq.c (valid_format): Also accept ` ' and `'' as valid
8075         format flag characters.
8076         Do not require that a field width be specified.
8077         Do not fail when given a field width of `0'.
8078         Reported by Dan Jacobson.
8079         * tests/seq/basic: Add new tests for the above-fixed bug.
8080
8081         * src/Makefile.am (all-local): Append $(EXEEXT) to use of `su'
8082         (install-root): Likewise.
8083         (install-exec-local): Likewise.
8084         Based on a patch from Richard Dawe.
8085
8086 2003-03-19  Jim Meyering  <jim@meyering.net>
8087
8088         * man/Makefile.am (.x.1): Use $(LN_S) instead of 'ln -s',
8089         because the DJGPP 2.03 port of 'ln -s' doesn't work.
8090         Include $(EXEEXT) in program names.
8091         Since $(LN_S) may degenerate to `cp -p', be careful
8092         to invoke it from the destination directory.
8093         Mostly from Richard Dawe.
8094         * configure.ac: Use AC_PROG_LN_S.
8095
8096         * tests/mv/part-symlink: Unset CDPATH.  Otherwise, having the
8097         CDPATH shell variable set could cause this test to fail.
8098         Reported by Karl Berry.
8099
8100 2003-03-18  Jim Meyering  <jim@meyering.net>
8101
8102         * src/fmt.c [struct Word] (paren, period, punct, final): Change the
8103         type of each member from bool <MEMBER>:1 to unsigned int <MEMBER>:1.
8104         AIX 5.1's xlc could not compile the former.
8105         Patch by Petter Reinholdtsen.  Also reported by Mike Jetzer.
8106
8107 2003-03-17  Richard Dawe  <rich@phekda.freeserve.co.uk>
8108
8109         * configure.ac: Include $(EXEEXT) in OPTIONAL_BIN_PROGS'
8110         program names, since automake only adds $(EXEEXT) to programs
8111         in its *_PROGRAMS.
8112
8113 2003-03-16  Jim Meyering  <jim@meyering.net>
8114
8115         * src/remove.c (rm): Put two local variables in static storage,
8116         so they can't be clobbered by the potential longjmp.
8117
8118 2003-03-15  Jim Meyering  <jim@meyering.net>
8119
8120         * Makefile.cfg (gnu_rel_host): Fix code to match the comment
8121         so that a version number with a two-digit component can still count
8122         as an alpha release.  Reported by Richard A Downing.
8123         (gnu_rel_host): Define in terms of $(RELEASE_TYPE) instead.
8124
8125 2003-03-14  Jim Meyering  <jim@meyering.net>
8126
8127         * src/ansi2knr.c: Remove no-longer-used file.
8128         * src/ansi2knr.1: Likewise.
8129
8130         * Makefile.maint (prev_version_file): Don't use ?= for this particular
8131         assignment, since it causes trouble with old versions of GNU make
8132         (e.g. 3.76.1).  The other uses of `?=' are inoffensive.  Details here.
8133         http://mail.gnu.org/archive/html/bug-coreutils/2003-03/msg00028.html
8134         Patch from Alexandre Duret-Lutz.
8135
8136         * Use patched automake-1.7.3.  Regenerate Makefile.in files in
8137         subdirectories so that each includes a definition of ACLOCAL_M4.
8138
8139         * announce-gen (main): Label the compressed source URLs.
8140
8141         * Version 4.5.10.
8142
8143         * tests/du/slink: Relax the test for the `local'ness of a file system,
8144         so that now it works also for tmpfs.
8145
8146         * tests/du/hard-link: Transform output from first du, so that this
8147         test doesn't fail on file systems like tmpfs that order directory
8148         entries differently.
8149
8150 2003-03-13  Jim Meyering  <jim@meyering.net>
8151
8152         * tests/du/8gb: Work around what appears to be an NFS failure that
8153         would make this test fail on some systems.
8154
8155 2003-03-11  Jim Meyering  <jim@meyering.net>
8156
8157         * tests/du/basic: Make the test file exactly 4k bytes long.
8158
8159         * src/split.c (longopts): Don't hard-code `2' here.
8160         Instead, just specify `&verbose', and ...
8161         (main): ... remove the `case 2:' block for --verbose.
8162
8163         * tests/du/basic: Make the test file larger than 64 bytes, so that
8164         we don't immediately disqualify file systems (e.g., NetApp) on which
8165         smaller files take up zero disk blocks.  Reported by Vin Shelton.
8166
8167 2003-03-10  Jim Meyering  <jim@meyering.net>
8168
8169         Don't segfault for a negative field width or precision in format string.
8170         Note that this is just a stopgap fix.  The longer term solution may
8171         involve adapting bash's builtins/printf.def.
8172
8173         * src/printf.c: (UNSPECIFIED): Define.
8174         (print_direc): Use the special value, UNSPECIFIED, to indicate
8175         that field_width or precision has not been specified.
8176         (print_formatted): Fail if field_width or precision is the
8177         special value, UNSPECIFIED.
8178         Reported by Oliver Kiddle <okiddle@yahoo.co.uk>
8179
8180         * src/sys2.h (INT_MIN): Define, if necessary.
8181         * tests/misc/printf: Add a test for the above-fixed bug.
8182
8183 2003-03-09  Jim Meyering  <jim@meyering.net>
8184
8185         * src/remove.c (AD_stack_pop): Cast sizeof... to int before
8186         changing its sign.  This avoids a warning from gcc on 64-bit systems.
8187         Reported by Bob Proulx.
8188         (pop_dir): Reverse order of sign change and cast, to be consistent
8189         with the above.
8190
8191 2003-03-08  Jim Meyering  <jim@meyering.net>
8192
8193         * tests/Makefile.am (evar-check): Check for POSIXLY_CORRECT not as a
8194         shell variable, but only in the environment.  With /bin/sh->bash, the
8195         shell variable is set to `y', and that would cause a spurious warning.
8196         Reported by Bob Proulx.
8197
8198         * tests/Makefile.am (check-root): Remove touch/fifo.
8199         It doesn't appear to have to be run as root.
8200
8201         * tests/rm/fail-2eperm: Rather than simply using the first non-root
8202         user name, make sure that the selected user name has a usable shell.
8203         Reported by Paul Jarc.
8204
8205         Before, when using shred on a device, one had to specify --exact,
8206         or be careful to choose a size that would not be rounded up and
8207         exceed the maximum value;  that could result in a failure of
8208         the final write.
8209         * src/shred.c (do_wipefd): --exact is now the default for non-regular
8210         files.  Suggestion from Ben Elliston.
8211         (usage): Say it.
8212
8213         * tests/misc/tty-eof: Require at least version 1.11 of Expect.pm.
8214         Old versions of Expect.pm (e.g., 1.07) lack the log_user function.
8215         Patch by Bob Proulx.
8216
8217         * src/Makefile.am (check-misc): Check for use of `defined' in
8218         #define directives.
8219         Change to $(srcdir) before running grep.
8220
8221         * src/sleep.c: Remove now-unused #include and #define directives.
8222
8223         * src/du.c (process_file): If a file's size is not being counted
8224         e.g., because it's a hard link to a file we've already counted,
8225         then don't print a line for it.
8226
8227         * tests/du/hard-link: New test for the above-fixed bug.
8228         * tests/du/Makefile.am (TESTS): Add hard-link.
8229
8230         `du -S' didn't work
8231         * src/du.c: Revert most of the `reorganization' change of 2003-02-20,
8232         and make the two-array approach work.
8233
8234         * tests/du/basic: Correct/add tests for the above fix.
8235         Set LC_ALL, etc., now that we use sort.
8236         Check the block/size of a small file, too.
8237         Correct expected results for simple dir1/dir2/file case.
8238         Add another test of du -S.
8239
8240 2003-03-07  John David Anglin  <dave.anglin@nrc-cnrc.gc.ca>
8241
8242         Avoid build failure with gcc on hppa1.1-hp-hpux10.20 (see GCC PR
8243         middle-end/9986).  As one of GCC's optimizations, it transforms a
8244         fputs_unlocked call to a fputc_unlocked call when the string is
8245         one character long.  However, hpux doesn't have fputc_unlocked.
8246
8247         * expr.c (usage): Use putchar, not fputs, to output a single character.
8248         * ls.c (dired_dump_obstack): Likewise.
8249         * ptx.c (output_one_tex_line, output_one_dumb_line): Likewise.
8250         * stat.c (print_it): Likewise.
8251
8252 2003-03-07  Jim Meyering  <jim@meyering.net>
8253
8254         * src/cp.c: Remove everything associated with mmap-stack.c.
8255         This reverts the two changes of 2003-02-21.
8256         * src/du.c: Remove everything associated with mmap-stack.c.
8257         This reverts the change of 2003-02-19.
8258
8259 2003-03-06  Jim Meyering  <jim@meyering.net>
8260
8261         * tests/cp/same-file: Unset CDPATH.  Otherwise, having the
8262         CDPATH shell variable set could cause this test to fail.
8263         Reported by Karl Berry.
8264
8265 2003-03-05  Jim Meyering  <jim@meyering.net>
8266
8267         * Version 4.5.9.
8268
8269         * src/printf.c (print_esc): Remove pointless comparison of unsigned
8270         integer with zero, to avoid a warning from Intel's ecc.
8271         Reported by Nelson Beebe.
8272
8273         * src/du.c (process_file): Sizes must all be of type uintmax_t.
8274         Otherwise, for files or totals that are too big, numbers would
8275         be truncated.  Patch mostly by Michael Stone.
8276         Reported by Ingo Saitz as Debian bug #183210.
8277
8278         * tests/du/8gb: New test for the above-fixed bug.
8279         * tests/du/Makefile.am (TESTS): Add 8gb.
8280
8281         * src/du.c (MAX_N_DESCRIPTORS): Use 3 * UTILS_OPEN_MAX / 4
8282         rather than UTILS_OPEN_MAX - 10.
8283
8284 2003-03-04  Jim Meyering  <jim@meyering.net>
8285
8286         * README: Refer new feature discussion to bug-coreutils@gnu.org,
8287         rather than bug-gnu-utils, now that the former is better known.
8288         Suggestion from Göran Uddeborg.
8289
8290         * src/stat.c (usage): Capitalize consistently.
8291         Reported by Göran Uddeborg.
8292
8293         * Makefile.maint (rel-files): Include $(signatures), so that
8294         those files are also copied into $(release_archive_dir).
8295
8296         * src/df.c (find_mount_point): Call error here, now that restore_cwd
8297         no longer does it.
8298         * src/remove.c (AD_pop_and_chdir): Likewise.
8299
8300         * tests/Makefile.am (check-root): Add fail-2eperm.
8301
8302 2003-03-03  Jim Meyering  <jim@meyering.net>
8303
8304         * src/remove.c (remove_cwd_entries): Include the full filename of
8305         the offending file, not just the basename.
8306
8307         * tests/misc/tty-eof: Set $ME properly.
8308
8309         * Makefile.maint (THIS_VERSION_REGEXP, PREV_VERSION_REGEXP):
8310         Remove now-unused variables.
8311         (tag-prev-version, prev-cvs-tag): Likewise.
8312
8313         * src/remove.c (remove_cwd_entries) [!ROOT_CAN_UNLINK_DIRS]: Give an
8314         accurate diagnostic when failing to remove a file owned by some other
8315         user.  Reported by Ivo Timmermans via Michael Stone.
8316         This fixes Debian bug# 178471.
8317
8318         * tests/rm/Makefile.am (TESTS): Add fail-2eperm.
8319         * tests/rm/fail-2eperm: New test, for the above-fixed bug.
8320         Based on a report from Ivo Timmermans.
8321
8322 2003-03-02  Jim Meyering  <jim@meyering.net>
8323
8324         * src/copy.c (copy_internal) [un_backup]: When recovering from a
8325         failure to create a hard link, do not remove the entry associating
8326         the source dev/ino with the destination file name.
8327         * tests/mv/Makefile.am (TESTS): Add hard-3.
8328         * tests/mv/hard-3: New test, for the above-fixed bug.
8329         Inspired by a report from Iida Yosiaki.
8330
8331 2003-03-01  Jim Meyering  <jim@meyering.net>
8332
8333         * src/df.c (print_header): Don't embed spaces in a separate `Type'
8334         header string.  Instead, put `Filesystem' and `Type' headers in the
8335         same string, so translators can use horizontal space as needed.
8336         Reported by Jean Charles Delepine.
8337
8338 2003-02-28  Jim Meyering  <jim@meyering.net>
8339
8340         * src/copy.c (copy_internal): When link fails because of an
8341         existing destination file, unlink that file and try again.
8342         Reported by Iida Yosiaki.
8343
8344         * tests/mv/Makefile.am (TESTS): Add hard-2.
8345         * tests/mv/hard-2: New test for the above-fixed bug.
8346         Based on a test case from Iida Yosiaki.
8347
8348 2003-02-26  Jim Meyering  <jim@meyering.net>
8349
8350         * tests/du/basic: Don't test du's -b option here.  Directory byte
8351         counts are smaller (512 rather than 4096) on at least OSF/1 5.1
8352         and IBM AIX 4.2.  Reported by Nelson Beebe.
8353
8354 2003-02-25  Jim Meyering  <jim@meyering.net>
8355
8356         * Makefile.maint (announcement): Now that ChangeLog entries
8357         are output by announce-gen, don't do it here.
8358         * announce-gen (print_changelog_deltas): New function.
8359         (main): Use it.
8360
8361 2003-02-22  Jim Meyering  <jim@meyering.net>
8362
8363         * announce-gen: New option: --release-type=TYPE
8364         * Makefile.maint (beta, major): New targets.  Remove `release'.
8365         Put them all together on a line.
8366         Pass the release type (via RELEASE_TYPE envvar) to the MAKE
8367         invocation of `announcement'.
8368         (announcement): Invoke announce-gen with --release-type=$RELEASE_TYPE.
8369
8370         * announce-gen: New option: --news=NEWS_FILE.
8371         Extract NEWS entries here, not via rules in Makefile.maint.
8372         * Makefile.maint (announcement): Now that NEWS entries are
8373         extracted by announce-gen, don't do it here.
8374         (news-r1, news-r2): Remove now-unused definitions.
8375
8376 2003-02-21  Jim Meyering  <jim@meyering.net>
8377
8378         * Version 4.5.8.
8379
8380         Merge in changes from autoconf's version of this file.
8381         * Makefile.maint (www-gnu): Define.
8382         (standards.texi-url_prefix): Use $(www-gnu).
8383         (make-stds.texi-url_prefix): Likewise.
8384
8385         * src/cp.c: Include "mmap-stack.h".
8386         (main): Invoke `run' through a macro that (when possible) runs it
8387         with a large, mmap'd stack.
8388
8389         * src/cp.c (run): New function, preparing for the above.
8390         Exit from this function, not from main
8391         (main): Call run.
8392
8393         * src/du.c: New option: --apparent-size.
8394         (enum) [APPARENT_SIZE_OPTION]: New member.
8395         (long_options): Add it.
8396         (usage): Describe it.
8397         (main): Handle it.
8398         ['b']: Set apparent_size.
8399         David Eisner reported that the behavior of --bytes had changed.
8400         Paul Eggert proposed the use of a new option, --apparent-size.
8401
8402         * src/du.c (apparent_size): New global.
8403         (print_only_size): Reflect the fact that we're printing byte counts,
8404         not ST_NBLOCKSIZE-byte-block counts.
8405         (print_size): Call print_only_size rather than duplicating its code.
8406         (process_file): Accumulate byte counts, rather than block counts.
8407
8408         * src/du.c (process_file): Always reset size_to_propagate_to_parent
8409         for --separate-dirs (-S).
8410
8411 2003-02-20  Jim Meyering  <jim@meyering.net>
8412
8413         * Use automake-1.7.3.  Regenerate dependent files.
8414
8415         * src/stat.c (print_stat): New format: %B (to print ST_NBLOCKSIZE).
8416         This makes %b (number of ST_NBLOCKSIZE-byte blocks) more useful.
8417         (usage) [%B]: Describe it.
8418         [%b]: Refer to %B.
8419
8420         * src/du.c (process_file): Reorganize the code to use only
8421         one `sum' array, and change how -S works back to the way it was
8422         before 2003-01-31.  Patch by Bruno Haible.
8423
8424         * tests/du/basic: New test.
8425         * tests/du/Makefile.am (TESTS): Add basic.
8426
8427         * tests/envvar-check: Add checks for the following:
8428         BLOCK_SIZE, DU_BLOCK_SIZE, DF_BLOCK_SIZE, LS_BLOCK_SIZE.
8429
8430         * tests/Makefile.am: Rename phony target envvar-check to evar-check
8431         so as not to conflict with the distributed file by the same name.
8432
8433         * src/du.c (process_file): Set info->skip before any possible return.
8434
8435         Report correct usage for directories, not 0.
8436         * src/du.c (process_file): Return for `file_type == FTW_DPRE'
8437         _before_ recording the dev/ino of a directory.
8438         Reported by Bruno Haible.
8439
8440         Now, df always displays the device file name corresponding to the
8441         listed mount point under `Filesystem'.  Before, for an unmounted
8442         block- or character-special file argument, it would display the
8443         command-line argument instead.
8444         * src/df.c (show_disk): Return a value indicating whether
8445         there was a match.  Don't try to find a mount point here.
8446         (show_entry): If show_disk doesn't find a match, call show_point.
8447
8448 2003-02-19  Jim Meyering  <jim@meyering.net>
8449
8450         * src/du.c: Include "mmap-stack.h".
8451         (du_files): Add prototype with ATTRIBUTE_NORETURN.
8452         Exit from this function, not from...
8453         (main): ...here.
8454         Instead, if possible, invoke du_files through a macro that
8455         runs it with a large, mmap'd stack.
8456
8457         * src/join.c (usage): Change wording in --help output:
8458         use FILENUM instead of `SIDE' and say what FILENUM means.
8459         Reported by Bernhard Gabler.
8460
8461         * src/df.c (print_header): Rather than using a hard-coded literal
8462         string of spaces matching the length of the English `...Type' header,
8463         output the right number of spaces to match the selected translation.
8464         Reported by Yann Dirson and Jean Charles Delepine as Debian bug 131113.
8465
8466         * src/split.c (bytes_split): Remove unnecessary `else' after break.
8467         (lines_split): Likewise.  and correct misleading indentation.
8468
8469         * src/split.c: Include "full-read.h".
8470         (bytes_split, lines_split, line_bytes_split): Use full_read,
8471         not safe_read.   The way split was using the latter, a short read
8472         could cause split to terminate before EOF.
8473
8474         * tests/misc/tty-eof: Test all programs that can read stdin,
8475         requiring no arguments and that write to standard output.
8476
8477         * tests/misc/tty-eof: New file.  Renamed from ...
8478         * tests/misc/cat-tty-eof: Remove file.  Rename to tty-eof.
8479         * tests/misc/Makefile.am (TESTS): Reflect renaming.
8480
8481 2003-02-18  Jim Meyering  <jim@meyering.net>
8482
8483         cksum would perform an extra read after encountering EOF
8484         * src/cksum.c (cksum): Exit the loop upon EOF, too.
8485         Patch by Michael Bacarella.
8486
8487         Test for the bug fixed today in cksum, md5sum, and sha1sum.
8488         * tests/misc/cat-tty-eof: Generalize, clean-up, and test for
8489         cat, cksum, md5sum, and sha1sum all in the same loop.
8490
8491 2003-02-14  Jim Meyering  <jim@meyering.net>
8492
8493         * src/remove.c: Include "euidaccess.h".
8494         Remove declaration of euidaccess.
8495
8496 2003-02-12  Jim Meyering  <jim@meyering.net>
8497
8498         * src/pathchk.c (portable_chars_only): Remove unnecessary `const'
8499         in cast to avoid warning from icc.  Reported by Alexandre Duret-Lutz.
8500
8501 2003-02-10  Jim Meyering  <jim@meyering.net>
8502
8503         * src/test.c: Don't include group-member.h.
8504         Include euidaccess.h.
8505         (eaccess): Rewrite function to set the real uid and gid temporarily
8506         to the effective uid and gid, then invoke 'access', and then set the
8507         real uid and gid back.  On systems that lack setreuid or setregid,
8508         fall back on the kludges in euidaccess.  Before, it would not work
8509         for e.g., files with ACLs, files that were marked immutable,
8510         or on file systems mounted read-only.  Nelson Beebe raised the issue.
8511         Paul Eggert suggested the new implementation.
8512
8513 2003-02-09  Jim Meyering  <jim@meyering.net>
8514
8515         * src/test.c (test_stat): Remove function.  It's job is done (only
8516         when necessary) by the wrapper in lib/stat.c.  Adjust all uses.
8517
8518 2003-02-08  Jim Meyering  <jim@meyering.net>
8519
8520         * Version 4.5.7.
8521
8522         * tests/mv/part-symlink: Don't assume that the file owner username
8523         length is less than 9 in ls output: instead, omit that field
8524         altogether.  Reported by, and suggested fix from, Ferdinand.
8525
8526         * tests/du/restore-wd: New test for just-fixed bug in ftw.c.
8527         * tests/du/Makefile.am (TESTS): Add restore-wd.
8528
8529         * src/rm.c: Correct now-invalid comment about cycle-detection.
8530
8531 2003-02-06  Jim Meyering  <jim@meyering.net>
8532
8533         * NEWS: Add entries from old/*/NEWS
8534         from fileutils-4.1 through 4.1.11 and
8535         from sh-utils-2.0 through 2.0.15.  Suggestion from Karl Berry.
8536
8537         * Version 4.5.6.
8538
8539         * src/du.c (process_file): Don't return early for excluded files
8540         or for files whose dev/inode we've already seen.
8541
8542 2003-02-05  Jim Meyering  <jim@meyering.net>
8543
8544         * tests/du/exclude: New file.
8545         * tests/du/Makefile.am (TESTS): Add exclude.
8546
8547 2003-02-04  Dmitry V. Levin  <ldv@altlinux.org>
8548
8549         * src/who.c (print_boottime, print_deadprocs, print_runlevel):
8550         Fix memory allocation arithmetic.
8551
8552 2003-02-04  Jim Meyering  <jim@meyering.net>
8553
8554         `df /dev/block-or-char-device-file--not-mounted' now reports
8555         the name of the file system on which the file resides, usually `/'.
8556         Before, it would leave the `Mounted on' field blank.
8557         * src/df.c (show_disk): Move function to precede find_mount_point.
8558         (show_disk): Add parameter: STATP.
8559         If we don't find a matching device name, then resort to calling
8560         find_mount_point.  Reported by Bob Proulx.
8561
8562 2003-02-03  Andreas Schwab  <schwab@suse.de>
8563
8564         * tests/rm/cycle: Require non-root.
8565         * tests/rm/isatty: Likewise.
8566
8567 2003-02-02  Jim Meyering  <jim@meyering.net>
8568
8569         * Version 4.5.5.
8570
8571         * man/Makefile.am (check-x-vs-1): Use @PATH_SEPARATOR@, not `:'.
8572
8573         Ensure that there are no offending uses of `:'.
8574         * Makefile.maint (makefile_path_separator_check): New rule.
8575         (local-check): Add it to the list.
8576
8577 2003-02-01  Jim Meyering  <jim@meyering.net>
8578
8579         * src/du.c (MAX_N_DESCRIPTORS): Define.
8580
8581         * src/stat.c (G_fail): New global.
8582         (human_time): Diagnose failed localtime, not failed nstrftime.
8583         (main): Fail if G_fail is set.
8584
8585 2003-01-31  Richard Dawe  <rich@phekda.freeserve.co.uk>
8586
8587         * tests/basename/Makefile.am: Use @PATH_SEPARATOR@ instead of
8588         hard-coding the path-separator.  Also double-quote the new PATH,
8589         to avoid problems when the path-separator is a semi-colon or when
8590         `pwd` contains e.g. a space.
8591         * tests/chgrp/Makefile.am: Likewise.
8592         * tests/chmod/Makefile.am: Likewise.
8593         * tests/chown/Makefile.am: Likewise.
8594         * tests/cp/Makefile.am: Likewise.
8595         * tests/dd/Makefile.am: Likewise.
8596         * tests/dircolors/Makefile.am: Likewise.
8597         * tests/du/Makefile.am: Likewise.
8598         * tests/expr/Makefile.am: Likewise.
8599         * tests/factor/Makefile.am: Likewise.
8600         * tests/fmt/Makefile.am: Likewise.
8601         * tests/install/Makefile.am: Likewise.
8602         * tests/ln/Makefile.am: Likewise.
8603         * tests/ls/Makefile.am: Likewise.
8604         * tests/ls-2/Makefile.am: Likewise.
8605         * tests/md5sum/Makefile.am: Likewise.
8606         * tests/misc/Makefile.am: Likewise.
8607         * tests/mkdir/Makefile.am: Likewise.
8608         * tests/mv/Makefile.am: Likewise.
8609         * tests/od/Makefile.am: Likewise.
8610         * tests/rm/Makefile.am: Likewise.
8611         * tests/rmdir/Makefile.am: Likewise.
8612         * tests/seq/Makefile.am: Likewise.
8613         * tests/sha1sum/Makefile.am: Likewise.
8614         * tests/shred/Makefile.am: Likewise.
8615         * tests/stty/Makefile.am: Likewise.
8616         * tests/sum/Makefile.am: Likewise.
8617         * tests/tail-2/Makefile.am: Likewise.
8618         * tests/touch/Makefile.am: Likewise.
8619         * tests/tsort/Makefile.am: Likewise.
8620         * tests/unexpand/Makefile.am: Likewise.
8621
8622 2003-01-31  Jim Meyering  <jim@meyering.net>
8623
8624         * src/stat.c: Include "file-type.h"
8625         (print_human_type): Remove function.
8626         (human_access): Rename from print_human_access.  Return a string.
8627         (human_time): Rename from print_human_time.  Return a string.
8628         (print_stat): Arrange so that field width and an alignment specifier
8629         are honored for the %A, %F, %x, %y, and %z formats.
8630         [%F]: Use file_type; this gives slightly different file type strings,
8631         e.g., `directory' instead of `Directory' and `regular file' or
8632         `regular empty file' instead of `Regular file'.
8633         Prompted by a report from Richard Dawe that the uses of
8634         S_IFSOCK and S_IFIFO in print_human_time were not portable
8635         to systems using e.g., DJGPP.
8636
8637 2003-01-31  Richard Dawe  <rich@phekda.freeserve.co.uk>
8638
8639         * src/stat.c (print_stat): Use S_ISLNK rather than an explicit
8640         test using S_IFMT and S_IFLNK.  S_IFLNK may not be defined.
8641
8642 2003-01-31  Jim Meyering  <jim@meyering.net>
8643
8644         * src/du.c (main): Upon processing an invalid option or an invalid
8645         --exclude-from or --max-depth option argument, don't exit right away,
8646         in case there are others.  Rather record the failure and exit after
8647         processing other options.
8648
8649         * GNUmakefile (TAR_OPTIONS): Set and export, in order to make
8650         tar archive easier to reproduce.
8651
8652         Rewrite to perform directory traversal using nftw.
8653
8654         * src/du.c: Include "dirname.h", "ftw.h", and "quotearg.h".
8655         (AUTHORS): Add self.
8656         (opt_one_file_system): Move global into `main'.
8657         (path, xstat, exit_status): Remove declarations.
8658         (arg_length, suffix_length): New globals.
8659         (G_fail): New global, sort of like the old `exit_status'.
8660         (IS_FTW_DIR_TYPE): Define.
8661         (print_only_size): New function.
8662         (process_file): New function.
8663         (str_init, ensure_space, str_copyc, str_concatc): Remove functions.
8664         (str_trunc, pop_dir, count_entry): Likewise.
8665         (du_files): Rewrite to use nftw.
8666
8667 2003-01-30  Jim Meyering  <jim@meyering.net>
8668
8669         * tests/du/trailing-slash: Ensure that du/ftw follows a command-line
8670         symlink-to-directory with -L, even without the trailing slash.
8671
8672 2003-01-27  Jim Meyering  <jim@meyering.net>
8673
8674         * src/Makefile.am (check-misc): Check for st_blocks, too.
8675
8676         * src/stat.c (print_stat): Use ST_NBLOCKS rather than `->st_blocks'.
8677         Reported by Richard Dawe.
8678
8679 2003-01-27  Andreas Schwab  <schwab@suse.de>
8680
8681         * src/ls.c (quote_name): Add fourth parameter, width, into which to
8682         store the screen columns, and return the number of bytes instead.
8683         (print_dir): Pass NULL as fourth parameter of quote_name.
8684         (print_name_with_quoting): Likewise.
8685         (length_of_file_name_and_frills): Get the width from the fourth
8686         parameter of quote_name instead of return value.
8687
8688 2003-01-27  Jim Meyering  <jim@meyering.net>
8689
8690         * src/ls.c (decode_switches): If `dired' is set without
8691         `format == long_format', then silently reset dired.  This doesn't
8692         change the behavior of ls (all prior uses of dired were protected
8693         by `&& format == long_format'), and lets us...
8694         (DIRED_INDENT): ... remove the `format == long_format' conjunct.
8695         (PUSH_CURRENT_DIRED_POS): Likewise.
8696         (main): Likewise.
8697
8698 2003-01-22  Jim Meyering  <jim@meyering.net>
8699
8700         * tests/du/no-x: New test, for functionality added to lib/ftw.c.
8701         * tests/du/Makefile.am (TESTS): Add no-x.
8702
8703 2003-01-21  Jim Meyering  <jim@meyering.net>
8704
8705         * src/remove.c (remove_entry) [ROOT_CAN_UNLINK_DIRS
8706         && HAVE_STRUCT_DIRENT_D_TYPE]: If a file has d_type == DT_UNKNOWN
8707         it may still be a directory -- or not (e.g., with FreeBSD on an
8708         NFS-mounted file system), so resort to calling lstat to find out.
8709         Based on a patch by Michael van Elst.
8710
8711         * tests/cp/same-file: Don't assume that the file owner username
8712         length is less than 9 in ls output: instead, omit that field
8713         altogether.  Reported by, and suggested fix from, Ferdinand.
8714
8715 2003-01-20  Jim Meyering  <jim@meyering.net>
8716
8717         * tests/date/Test.pm (wide-fmt): New test to demonstrate that
8718         large format widths no longer cause strftime to infloop.
8719
8720         * Makefile.maint (mail_gpg_sign_cookie): Remove now-unused definition.
8721
8722 2003-01-19  Jim Meyering  <jim@meyering.net>
8723
8724         * src/readlink.c: Include "canonicalize.h".
8725
8726 2003-01-18  Jim Meyering  <jim@meyering.net>
8727
8728         * src/ls.c (Dereference_symlink) [DEREF_COMMAND_LINE_SYMLINK_TO_DIR]:
8729         New member.
8730         (enum) [DEREFERENCE_COMMAND_LINE_SYMLINK_TO_DIR_OPTION]: New member.
8731         (long_options): Add option --dereference-command-line-symlink-to-dir.
8732         (main): Make DEREF_COMMAND_LINE_SYMLINK_TO_DIR be the default,
8733         rather than DEREF_COMMAND_LINE_ARGUMENTS, when none of the
8734         -d, -F, -l options is specified.
8735         (decode_switches): Handle --dereference-command-line-symlink-to-dir.
8736         (gobble_file): Honor DEREF_COMMAND_LINE_SYMLINK_TO_DIR.
8737         Change --dereference-command-line (-H) to dereference *all*
8738         command line arguments, including broken symlinks.
8739
8740 2003-01-15  Paul Eggert  <eggert@twinsun.com>
8741
8742         Change ls -H back to the way it was yesterday, since this is
8743         compatible with FreeBSD and the POSIX spec is confusing
8744         and somewhat contradictory.
8745
8746         * src/ls.c (DEREF_COMMAND_LINE_ARGUMENTS): Change name back
8747         from DEREF_COMMAND_LINE_SYMLINK_TO_DIR, updating all uses.
8748         (long_options): Change the long option name back.
8749         (usage): Change the usage back.
8750         (gobble_file): When -H is specified, dereference a top-level
8751         arg even if it points to a non-directory.
8752
8753 2003-01-15  Jim Meyering  <jim@meyering.net>
8754
8755         * src/ls.c (gobble_file): Fall back on using lstat when required:
8756         when --dereference (-L) is not specified, and
8757         - when operating on a dangling symlink
8758         - when operating on command-line-symlink-to-directories
8759         This fixes numerous problems.  Here are examples:
8760         - `ls dangling-symlink' would fail with `no such file...'
8761         Now it prints `dangling-symlink'.
8762         - `ls -i symlink' would mistakenly print the inode of the referent.
8763         Now it prints the inode of the symlink.  Likewise for --size (-s).
8764         Based on a patch from Michael Stone.
8765         Reported by Deepak Goel as Debian bug #173793.
8766
8767         Rename ls's --dereference-command-line (-H)
8768         option to   --dereference-command-line-symlink-to-dir.
8769         * src/ls.c [enum Dereference_symlink]
8770         (DEREF_COMMAND_LINE_SYMLINK_TO_DIR): Rename from
8771         DEREF_COMMAND_LINE_ARGUMENTS.  Update all uses.
8772         (long_options): Rename the long option.
8773         (usage): Say that --dereference-... changes how ls treats
8774         only symlinks to directories specified on the command line.
8775
8776 2003-01-14  Jim Meyering  <jim@meyering.net>
8777
8778         * tests/ls/dangle: New file/test, for the above fix.
8779         * tests/ls/inode: Another new file/test, for the above fix.
8780         * tests/ls/Makefile.am (TESTS): Add dangle and inode.
8781
8782         * src/ls.c (gobble_file): Fix a bug introduced in 4.5.4 that made it
8783         so that ls --color would no longer highlight the names of files with
8784         the execute bit set when not specified on the command line.
8785         Patch by Michael Stone.  Reported by Stephen Depooter as
8786         Debian bug 175135.
8787
8788         * tests/ls-2/tests (color-exe): New test, for the above fix.
8789
8790 2003-01-13  Jim Meyering  <jim@meyering.net>
8791
8792         * tests/shred/exact: Also test for just fixed bug with --zero.
8793
8794         * src/shred.c (long_opts): --zero does not require an argument.
8795         Patch by Michael Stone.  Reported by Roland Turner as Debian bug 172019.
8796
8797 2003-01-12  Jim Meyering  <jim@meyering.net>
8798
8799         * Makefile.maint (cvs-update): Skip any file with local modifications.
8800
8801         * src/unexpand.c (usage): Document --first-only and mention that
8802         --tabs=N (-t) enables --all (-a).  Reported by wiregauze@yahoo.com.
8803
8804 2002-12-01  Dmitry V. Levin  <ldv@altlinux.org>
8805
8806         * src/df.c: Include "canonicalize.h".
8807         Use canonicalize_file_name unconditionally.
8808
8809 2003-01-09  Jim Meyering  <jim@meyering.net>
8810
8811         * README: Add readlink.
8812
8813 2002-11-30  Dmitry V. Levin  <ldv@altlinux.org>
8814
8815         * src/df.c: Include "xgetcwd.h".
8816         * src/pwd.c: Likewise.
8817
8818 2002-11-30  Dmitry V. Levin  <ldv@altlinux.org>
8819
8820         * src/shred.c: Remove declaration of xstrdup.
8821         We already get it via xalloc.h which is included via system.h.
8822
8823 2002-08-27  Dmitry V. Levin  <ldv@altlinux.org>
8824
8825         New program: readlink.
8826
8827         * src/Makefile.am (bin_PROGRAMS): Add readlink.
8828         * src/readlink.c: New file.
8829
8830         * man/readlink.x: New file.
8831         * man/Makefile.am (dist_man_MANS): Add readlink.1.
8832         (readlink.1): New rule.
8833
8834 2003-01-09  Jim Meyering  <jim@meyering.net>
8835
8836         When selecting ranges of byte offsets (as opposed to ranges of fields)
8837         and when --output-delimiter=STRING is specified, output STRING between
8838         ranges of selected bytes.
8839         * src/cut.c (RANGE_START_SENTINEL): Define.
8840         (output_delimiter_specified): New global.
8841         (print_kth): Add parameter.  Adjust all callers.
8842         (set_fields): Mark each range-start index with RANGE_START_SENTINEL.
8843         (cut_bytes): When requested, output STRING between ranges of
8844         selected bytes.
8845         (main): Make a diagnostic a little clearer.
8846         Based on a patch from Jan Nieuwenhuizen.
8847
8848         * tests/cut/Test.pm: New tests for the above.
8849
8850         * src/cut.c (set_fields): Make code agree with comment:
8851         Don't merge abutting ranges like 4- and 2-3.  This makes no
8852         difference currently, but is required to support an upcoming change.
8853
8854 2003-01-07  Jim Meyering  <jim@meyering.net>
8855
8856         * src/cut.c (set_fields): Fix typo in comment.
8857
8858         * tests/touch/not-owner: New test, mostly extracted from fail-diag.
8859         * tests/touch/Makefile.am (TESTS): Add not-owner.
8860         * tests/touch/fail-diag: Remove the test for non-owner diagnostic.
8861         Now, this tests only the nonexistent-directory diagnostic.
8862         Suggestion from Michael Stone.
8863
8864         * tests/touch/fail-diag: Fix typo: s/ld/ls/.
8865
8866 2003-01-04  Jim Meyering  <jim@meyering.net>
8867
8868         * src/copy.h: Remove use of PARAMS.
8869         * src/remove.h: Likewise.
8870         * src/chown-core.h: Likewise.
8871
8872         rm could be tricked into mistakenly reporting a cycle.
8873         * src/remove.c: [cycle_check_state]: New global.
8874         (remove_cwd_entries): Adapt to new semantics of cycle_check.
8875         (rm): Call cycle_check_init and cycle_check_free for each file.
8876         * tests/rm/cycle (rm): New test, for the above fix.
8877         * tests/rm/Makefile.am (TESTS): Add cycle.
8878
8879         When rm detects a cycle, don't abort the entire command,
8880         but rather just the affected command line argument.
8881         * src/remove.c: Include <setjmp.h>
8882         (struct dirstack_state) [current_arg_jumpbuf]: New member.
8883         (remove_cwd_entries): Call longjmp if we detect a cycle.
8884         (rm): Call setjmp here.
8885
8886         * src/remove.c (cycle_check, is_power_of_two): Remove functions.
8887         Instead, include cycle-check.h and use it.
8888
8889         * src/remove.h (struct dev_ino): Remove declaration.
8890
8891         * src/remove.c (remove_cwd_entries): Fix typos in comment.
8892
8893         Don't include trailing /. in diagnostics about directories.
8894         * src/remove.c (full_filename_): When FILENAME is just `.'
8895         and there is a nonempty directory-name part, don't append `/.'.
8896         * tests/rm/unread2: Remove trailing /. from diagnostic.
8897         * tests/rm/rm2: Likewise.
8898
8899         * src/remove.c (struct dirstack_state): Define.
8900         To be used in place of these file-scoped globals ...
8901         (dir_stack, len_stack, Active_dir): Remove globals.
8902         (ds_init, ds_free): New functions.
8903         (full_filename): Define.
8904         (full_filename_): Rename from full_filename.
8905
8906         Begin to make AD_* functions more generic.
8907         * src/remove.c (AD_push_initial): Don't set status to RM_OK here.
8908         (AD_push): Likewise.
8909         (AD_INIT_OTHER_MEMBERS): Define.
8910         (remove_dir): Define the `status' member manually after each
8911         call to AD_push or AD_push_initial.
8912
8913         * src/Makefile.am (check-misc): New rule, to ensure that no more
8914         S_IS* macro definitions sneak into the code.
8915         (check): Depend on check-misc.
8916
8917         * src/remove.c [S_ISLNK]: Don't define.  It's already defined in sys2.h.
8918         * src/du.c (count_entry) [S_ISLNK]: Don't define.
8919         * src/shred.c [S_ISLNK, S_ISFIFO, S_ISSOCK]: Don't define.
8920
8921 2003-01-03  Jim Meyering  <jim@meyering.net>
8922
8923         * src/true.c: Add copyright.
8924         (AUTHORS): I suppose I've written it.
8925
8926         * src/Makefile.am (false.c): Make the generated file be read-only.
8927
8928 2003-01-04  Jim Meyering  <jim@meyering.net>
8929
8930         * src/ls.c: Include "dev-ino.h".
8931         [struct dev_ino]: Remove declaration.
8932
8933 2003-01-02  Jim Meyering  <jim@meyering.net>
8934
8935         * src/cp.c (do_copy): Tweak diagnostic to be consistent with the one
8936         from mv: s/missing file arguments/missing file argument/.
8937         With --target-directory=DIR, cp and mv work with a single file argument.
8938         Reported by Karl Berry.
8939
8940         * tests/rm/isatty: Enable this test.
8941
8942 2002-12-31  Jim Meyering  <jim@meyering.net>
8943
8944         * src/remove.c (AD_push_initial): Don't set status to RM_OK here.
8945         (AD_push): Likewise.
8946         (AD_INIT_OTHER_MEMBERS): Define.
8947         (remove_dir): Define the `status' member manually after each
8948         call to AD_push or AD_push_initial.
8949
8950         * src/ls.c [struct dev_ino]: Remove definition.
8951         Include "dev-ino.h" instead.
8952
8953 2002-12-28  Jim Meyering  <jim@meyering.net>
8954
8955         * tests/du/Makefile.am (TESTS): Add no-deref.
8956         * tests/du/no-deref: New script.
8957
8958 2002-12-23  Jim Meyering  <jim@meyering.net>
8959
8960         * src/remove.c (remove_cwd_entries): Fix typo in comment.
8961
8962 2002-12-21  Jim Meyering  <jim@meyering.net>
8963
8964         * announce-gen: Generate MML-formatted announcement.
8965         This makes it a *lot* harder to send stale MD5/SHA1 signatures.
8966
8967 2002-12-20  Jim Meyering  <jim@meyering.net>
8968
8969         * src/touch.c (touch): Change the wording of a diagnostic so
8970         that it makes sense both when the file exists and when it doesn't.
8971         Suggestion from Michael Stone.
8972
8973 2002-12-18  Jim Meyering  <jim@meyering.net>
8974
8975         * src/stty.c (valid_options): Declare to be static.
8976
8977 2002-12-15  Jim Meyering  <jim@meyering.net>
8978
8979         * Makefile.cfg: Remove rules related to generating m4/jm-glibc-io.m4.
8980
8981         * src/chmod.c, src/copy.c, src/copy.h, src/cp-hash.h, src/csplit.c:
8982         * src/date.c, src/expr.c, src/fmt.c, src/id.c, src/install.c:
8983         * src/ls.c, src/od.c, src/pathchk.c, src/pr.c, src/remove.c:
8984         * src/shred.c, src/sort.c, src/stat.c, src/stty.c, src/sum.c:
8985         * src/tee.c, src/test.c: Remove all uses of `PARAMS'.
8986
8987         * src/remove.c (PARAMS): Remove definition.
8988         * src/sys2.h: Likewise.
8989
8990         * src/ls.c, src/stat.c, src/date.c: Remove declaration of nstrftime.
8991         Include strftime.h instead.
8992
8993 2002-12-14  Jim Meyering  <jim@meyering.net>
8994
8995         * Makefile.cfg ($(url_dir_list)): Use .../coreutils, not .../fetish.
8996
8997         * src/system.h [! HAVE_DECL_MEMRCHR]: Declare memrchr.
8998         This is necessary at least for Irix6.5 when using c89.
8999         Reported by Nelson Beebe.
9000
9001         * tests/misc/Makefile.am (TESTS): Add cat-tty-eof.
9002
9003         * tests/misc/cat-tty-eof: New test.
9004
9005         * src/mknod.c (usage): Specify how major and minor mode numbers
9006         are interpreted.  Report forwarded by Kristin E Thomas.
9007         * src/mknod.c: Remove now-redundant usage-specifying comment.
9008
9009 2002-12-13  Jim Meyering  <jim@meyering.net>
9010
9011         * Version 4.5.4.
9012
9013         * tests/du/trailing-slash: Allow for a directory of size `0'.
9014         That happens at least on file systems of type tmpfs on linux-2.4.18.
9015
9016         * announce-gen: New script to begin replacing the commands
9017         associated with the rule here...
9018         * Makefile.maint (announcement): Invoke announce-gen.
9019         * Makefile.am (EXTRA_DIST): Add announce-gen.
9020
9021         * tests/cp/preserve-2: New file/test, for latest fix.
9022         * tests/cp/Makefile.am (TESTS): Add preserve-2.
9023
9024 2002-12-11  TAKAI Kousuke  <takai@vlsi.kuee.kyoto-u.ac.jp>
9025
9026         Fix a bug whereby cp would fail to parse an option like
9027         --preserve=mode,ownership.
9028         * src/cp.c (decode_preserve_arg): Advance `comma' to
9029         point the character following the comma.
9030
9031 2002-12-11  Jim Meyering  <jim@meyering.net>
9032
9033         * src/pathchk.c (NEED_PATHCONF_WRAPPER): Undefine before defining,
9034         in case it's already defined.
9035
9036 2002-12-09  Jim Meyering  <jim@meyering.net>
9037
9038         * tests/touch/fail-diag: Don't get a test failure if /no exists.
9039         Instead, evoke a framework failure if /no-$$ exists.
9040         Reported by Michael Stone.
9041
9042 2002-12-08  Jim Meyering  <jim@meyering.net>
9043
9044         * src/du.c (lstat) [! LSTAT_FOLLOWS_SLASHED_SYMLINK]:
9045         Define to rpl_lstat, so that even on systems like Solaris 5.8,
9046         du honors (per POSIX) the trailing slash on an argument referring
9047         to a symlink-to-directory.
9048
9049 2002-12-06  Jim Meyering  <jim@meyering.net>
9050
9051         * Use autoconf-2.57.  Regenerate dependent files.
9052         * Use automake-1.7.2.  Regenerate dependent files.
9053
9054         * src/ls.c (gobble_file): Also stat the file if it's a
9055         regular file and --indicator-style=classify (aka -F).
9056         Thanks to Ed Santiago for opening my eyes.
9057
9058         * tests/ls/file-type: New file.  Test for the above.
9059         A test to contrast ls -F and ls --indicator-style=file-type.
9060         * tests/ls/Makefile.am (TESTS): Add file-type.
9061
9062 2002-12-04  Jim Meyering  <jim@meyering.net>
9063
9064         * tests/ls/follow-slink: Make sure the symlink was created.
9065         Richard Dawe reported that `ln -s link link' succeeds, but creates
9066         no file on systems running some version of the DJGPP libc.
9067
9068 2002-12-03  Jim Meyering  <jim@meyering.net>
9069
9070         * src/Makefile.am (AUTOMAKE_OPTIONS): Remove definition (to ansi2knr)
9071         since this package no longer panders to K&R compilers.
9072
9073 2002-12-02  Jim Meyering  <jim@meyering.net>
9074
9075         * tests/du/slink: Skip this test if `.' is on a non-local file system.
9076
9077         * tests/Fetish.pm (_at_replace): Do the substitution only if there's
9078         something to replace.
9079
9080 2002-12-01  Jim Meyering  <jim@meyering.net>
9081
9082         * src/stat.c: Don't include <string.h> or <ctype.h>.
9083         That's already done via system.h.
9084         * src/dircolors.c: Don't include <ctype.h>.
9085
9086 2002-11-30  Jim Meyering  <jim@meyering.net>
9087
9088         * ls.c (gobble_file): Remove the block of code that caused
9089         `ls --color -F symlink-to-dir' to list the files in
9090         `symlink-to-dir/.'.  Now, it prints `symlink-to-dir@', (just
9091         like `ls -F symlink-to-dir') but with the addition of highlighting.
9092         Similarly, `ls --color -dF symlink-to-dir' would print
9093         `symlink-to-dir/';  now it prints `symlink-to-dir@'.
9094         Reported by Jeff Sheinberg as Debian bug #168203.
9095         * tests/ls-2/tests (sl-F-color, sl-dF-color): New tests for the above.
9096
9097         ls is now more efficient: with certain options, it no longer needs
9098         to stat each directory entry on systems with valid dirent.d_type.
9099         * src/ls.c (print_dir): Add DT_LNK and DT_REG.
9100         (main): Make --recursive set format_needs_type, not format_needs_stat.
9101         (gobble_file): Remove a FIXME comment, now that it's fixed.
9102
9103 2002-11-24  Jim Meyering  <jim@meyering.net>
9104
9105         * src/du.c (du_files): Don't strip any trailing slash.
9106         Rewrite so that `/' is no longer represented internally as
9107         the empty string.
9108         (count_entry): When appending a file name component,
9109         account for the fact that the current path may end in `/'.
9110         François Pinard reported that `du symlink-to-dir/' was not
9111         equivalent to `du symlink-to-dir/.'.  Now it is.
9112         * tests/du/trailing-slash: New file/test, for the above fix.
9113         * tests/du/Makefile.am (TESTS): Add trailing-slash.
9114
9115 2002-11-23  Jim Meyering  <jim@meyering.net>
9116
9117         * src/tac.c (output): Declare some local variables to be of type size_t,
9118         rather than `int' to avoid warnings from gcc.
9119
9120 2002-11-21  Paul Eggert  <eggert@twinsun.com>
9121
9122         * src/ls.c (decode_switches): Use case-sensitive matching to
9123         decode the QUOTING_STYLE environment variable.  This is more
9124         consistent with the documentation, and with --quoting-style.
9125
9126 2002-11-21  Martin Buck  <martin.buck@ascom.ch
9127
9128         * src/stty.c (struct speeds): Add support for all baud rates defined
9129         in linux-2.4.19.
9130
9131 2002-11-19  Jim Meyering  <jim@meyering.net>
9132
9133         * tests/sum/sysv: Export LC_ALL=C, to avoid failure when
9134         run in a UTF locale.  Report and suggested fix by Bruno Haible.
9135         * tests/fmt/basic: Likewise.
9136
9137 2002-11-17  Jim Meyering  <jim@meyering.net>
9138
9139         * configure.ac: Update via autoupdate.
9140         Add `AM_GNU_GETTEXT_VERSION(0.11.5)'.
9141
9142         * src/mv.c (movefile): Don't remove trailing slashes from SOURCE.
9143         Reported by Hans Ginzel.
9144
9145 2002-11-15  Jim Meyering  <jim@meyering.net>
9146
9147         * Makefile.cfg (gnu_rel_host): Define.
9148         (url_dir_list): Choose from (alpha|ftp).gnu.org depending
9149         on whether $(VERSION) looks like a major release number.
9150
9151         * Makefile.maint (mail_gpg_sign_cookie): Backslash-escape `#'.
9152         (release): Rename from `alpha'.
9153         (alpha): Depend on release.
9154
9155         * Makefile.maint (signatures): Define with ?=, so it's easy to override.
9156
9157 2002-11-14  Jim Meyering  <jim@meyering.net>
9158
9159         * Makefile.maint (mail_gpg_sign_cookie): Make optional.
9160         (announcement): Use the new variable.
9161
9162         * Makefile.maint: Sync with Bison, i.e.:
9163         (po-check): Scan .l and .y files instead of the
9164         .c and the .h files that they generate.  This fixes the bug
9165         reported by Tim Van Holder in:
9166         <http://mail.gnu.org/pipermail/bison-patches/2002-November/001352.html>
9167         Look for N_ as well as for _.  Try to avoid matching #define for
9168         N_ and _.
9169         From Paul Eggert.
9170
9171 2002-11-12  Jim Meyering  <jim@meyering.net>
9172
9173         * src/ls.c (HAVE_SYMLINKS): Remove unnecessary macro definition.
9174         Replace sole use with equivalent `#ifdef S_ISLNK'.
9175         Inconsistency reported by Dmitry V. Levin.
9176
9177 2002-11-11  Jim Meyering  <jim@meyering.net>
9178
9179         * src/stat.c (usage): Transform --help items output via s/ - /   /,
9180         so that help2man produces properly formatted man pages.
9181         Reported by Herbert Xu as Debian bug #168400.
9182
9183 2002-11-10  Jim Meyering  <jim@meyering.net>
9184
9185         * src/ls.c (sighandler): Handle SIGTSTP specially.
9186         Based on suggestions from Solar Designer and Dmitry V. Levin.
9187         Add comments.
9188
9189         * Makefile.cfg (cvs_files): Define.  From autoconf.
9190         (local_updates): Likewise.
9191
9192         * src/ls.c (restore_default_color_handler, sigtstp_handler):
9193         Remove functions.
9194         (sighandler): New function, based on the one in sort.c.
9195         (main): Use sigaction, if possible; otherwise signal.
9196         Handle these signals:
9197         SIGHUP, SIGINT, SIGPIPE, SIGQUIT, SIGTERM, SIGTSTP.
9198         Don't register our handler if the signal is already being ignored.
9199
9200         * src/dd.c (interrupt_handler): Use raise, rather than kill+getpid.
9201         * src/csplit.c (interrupt_handler): Likewise.
9202         * src/sort.c (sighandler): Likewise.
9203         (main): Declare `i' and `nsigs' to be unsigned, not int.
9204
9205 2002-11-09  Jim Meyering  <jim@meyering.net>
9206
9207         ls --color: restore terminal text color upon signal.
9208         * src/ls.c: Include "full-write.h" and <signal.h>.
9209         (restore_default_color, restore_default_color_handler): New functions.
9210         (sigtstp_handler, put_indicator_direct): New functions.
9211         (main) [print_with_color]: Register signal handlers.
9212         Patch mostly by Solar Designer and Stanislav Ievlev.
9213
9214         Update from autoconf.
9215         * Makefile.maint (AMTAR): Remove definition.
9216         (update, cvs-update, po-update, do-po-update): New rules.
9217         (wget-update): Update (thus renaming to cvs-update).
9218         (automake_repo): Use anoncvs@sources.redhat.com.
9219
9220 2002-11-06  Jim Meyering  <jim@meyering.net>
9221
9222         * tests/misc/Makefile.am (TESTS): Add printf-hex.
9223
9224         * tests/misc/printf: Be careful to test the code in this package,
9225         not the shell built-in function.
9226
9227         * src/printf.c (print_esc): A hexadecimal escape sequence has
9228         at most two hex. digits, not three.  Reported by Padraig Brady.
9229         (usage): Update description.
9230         * tests/misc/printf-hex: New file/test, for the above fix.
9231
9232 2002-10-07  Paul Eggert  <eggert@twinsun.com>
9233
9234         Add support for locale-specific size indications (e.g.,
9235         thousands-separators) and for explicit size suffixes on output.
9236
9237         * doc/coreutils.texi (Block size): Say that:
9238         This affects display format as well as block size.
9239         Fractional block counts are rounded up.
9240         ls file size blocksize defaults to 1.
9241         A block size spec preceded by ' generates thousands separators.
9242         A suffix without a preceding integer generates suffixes.
9243         (tail invocation): 32k -> 32 KiB.
9244         (What information is listed): ls -h is now equivalent to
9245         ls --block-size=human, and ls -H is now equivalent to
9246         ls --block-size=si.  Displayed file size is now always affected by
9247         --block-size.
9248
9249         * lib/inttostr.c, lib/inttostr.h, lib/imaxtostr.c, lib/offtostr.c,
9250         lib/umaxtostr.c: New files, taken from GNU tar.
9251
9252         * lib/Makefile.am (libfetish_a_SOURCES): Add imaxtostr.c, offtostr.c,
9253         umaxtostr.c.
9254         (EXTRA_DIST): Add inttostr.c.
9255
9256         * lib/human.c, lib/human.h: Rewrite to support locale-specific
9257         notations like thousands separators.
9258         Specify what includer of include.h must include beforehand.
9259         (human_group_digits, human_suppress_point_zero, human_autoscale,
9260         human_base_1024, human_SI, human_B): New enum values.
9261         (human_readable): Rename from human_readable_inexact; put the
9262         options before the sizes.  All uses changed.  The old human_readable
9263         function has been removed; use inttostr.h instead.
9264         (human_options): Renamed from human_block_size, with new signature
9265         that allows block sizes up to UINTMAX_MAX.  All callers changed.
9266
9267         * m4/prereq.m4 (jm_PREREQ_HUMAN): Check for locale.h, localeconv,
9268         AC_HEADER_STDBOOL.  No need to check for limits.h since it's in
9269         freestanding C89.  No need to check for stdlib.h or string.h since
9270         autoconf does this now.
9271
9272         * src/cksum.c (cksum): Use primitives from inttostr.h, not
9273         human.h, to print large numbers simply.
9274         * src/csplit.c (handle_line_error, parse_patterns): Likewise.
9275         * src/dd.c (print_stats, main): Likewise.
9276         * src/df.c (print_header): Likewise.
9277         * src/factor.c (print_factors): Likewise.
9278         * src/ls.c (print_long_format, print_file_name_and_frills): Likewise.
9279         * src/shred.c (dopass): Likewise.
9280         * src/sort.c (checkfp): Likewise.
9281         * src/sum.c (bsd_sum_file, sysv_sym_file): Likewise.
9282         * src/tail.c (xlseek): Likewise.
9283         * src/wc.c (write_counts, wc): Likewise.
9284
9285         * src/df.c (human_output_opts): New var.
9286         (output_block_size): Now uintmax_t, not int, to handle larger
9287         block sizes.  All uses changed.
9288         * src/du.c: Likewise.
9289         * src/ls.c: Likewise.
9290
9291         * src/df.c (print_header): In the header line, prefer SI to human
9292         representation if it's shorter; if neither is shorter, try to
9293         intuit what the user would prefer.
9294
9295         * src/expr.c (inttostr): Remove; use new imaxtostr library
9296         function instead.
9297
9298         * src/ls.c (file_output_block_size): New var, to distinguish
9299         file sizes from other sizes.
9300         (decode_switches): Set it.
9301
9302         * src/shred.c (OUTPUT_BLOCK_SIZE): remove.
9303         (dopass): When printing progress, use floor for what has been done
9304         so far (since we should be conservative there), and ceiling for
9305         what needs to be done (since that's what other programs use).
9306
9307 2002-10-19  Jim Meyering  <jim@meyering.net>
9308
9309         * src/pinky.c (print_heading): Align TTY and Name headings.
9310         Reported by Karl Eichwalder.
9311
9312 2002-10-18  Jim Meyering  <jim@meyering.net>
9313
9314         * src/split.c (cwrite): Change type of `bytes' parameter to size_t
9315         Remove now-useless cast.
9316         (stdread): Remove function.
9317         (bytes_split): Use size_t instead of int.
9318         Use safe_read, not stdread.
9319         (lines_split): Likewise.
9320         Use memchr rather than a `while' loop.
9321         (line_bytes_split): Use size_t instead of int.
9322         Use safe_read, not stdread.
9323         (main): Add some FIXME comments to remind me to remove casts.
9324
9325         * src/system.h (ST_BLKSIZE): Correct comment describing how to
9326         reproduce HPUX-11 cat failure.  From Petter Reinholdtsen.
9327
9328 2002-10-17  Jim Meyering  <jim@meyering.net>
9329
9330         Fix a problem that could make e.g., `cat' misbehave on systems which
9331         give invalid (unreasonably large) values for stat.st_blksize.
9332         * src/system.h (ST_BLKSIZE): Ensure that the result is in [1..4MB].
9333         Reported by Petter Reinholdtsen.
9334
9335 2002-10-14  Jim Meyering  <jim@meyering.net>
9336
9337         Specifying a printf conversion specifer as nl's separator string
9338         could cause nl to segfault.
9339         * src/nl.c (build_print_fmt): Don't include separator string
9340         in the printf format; it might contain `%'.
9341         Use a better bound on the length of the print_fmt buffer.
9342         (print_lineno): Print the separator here instead.
9343         Reported by Doug Coleman.
9344
9345         * tests/misc/nl: New file/tests, including a test for the above.
9346         * tests/misc/Makefile.am (TESTS): Add nl.
9347
9348         * tests/misc/split-l: New test, to make sure `split --lines=N' works.
9349         * tests/misc/Makefile.am (TESTS): Add split-l.
9350
9351 2002-10-13  Jim Meyering  <jim@meyering.net>
9352
9353         * Version 4.5.3.
9354
9355         * src/du.c (usage): Tweak description of --dereference-args/-D.
9356
9357         * src/du.c (count_entry): Also save cwd when dereferencing (via
9358         --dereference-args, -D) a command-line argument.
9359         Reported by Michal Svec.  Based on a patch by Andreas Schwab.
9360
9361         * src/Makefile.am (../AUTHORS): New target/rule.
9362
9363 2002-10-12  Jim Meyering  <jim@meyering.net>
9364
9365         * src/paste.c (paste_parallel): Declare local, `delims_saved', to be
9366         of type size_t, since that's the way it's used and avoids a warning.
9367
9368         * src/csplit.c (struct cstring) [len]: Declare to be unsigned int,
9369         since that's how it's always used and avoids a new warning from gcc.
9370         (read_input): Adapt to new safe_read ABI.
9371
9372         * src/cut.c (cut_fields): Add a temporary size_t variable, n_bytes,
9373         to avoid warnings.
9374
9375         * src/pinky.c (print_long_entry): fread returns size_t.
9376         Declare local `bytes' accordingly, to avoid warning.
9377
9378         tail -c +N would perform an extra read after encountering EOF
9379         [this change is analogous (bytes vs. lines) to the one of 2002-01-27]
9380         * src/tail.c (start_bytes): Detect EOF, inform caller.
9381         (tail_bytes): Upon EOF in start_bytes, return immediately.
9382         (file_lines): Reorganize to use memrchr rather than an explicit loop.
9383         Adapt to new safe_read ABI.
9384
9385 2002-10-11  Jim Meyering  <jim@meyering.net>
9386
9387         * tests/du/deref: New file/test, for the above fix.
9388         * tests/du/Makefile.am (TESTS): Add deref.
9389
9390 2002-10-10  Jim Meyering  <jim@meyering.net>
9391
9392         * tests/ln/Makefile.am (TESTS): Add target-1.
9393         * tests/ln/target-1: New file/test, for the fix on 2002-10-08.
9394
9395 2002-10-09  Jim Meyering  <jim@meyering.net>
9396
9397         * tests/cp/backup-is-src: Ensure that certain environment variables
9398         are not set (e.g., SIMPLE_BACKUP_SUFFIX).  Reported by Duncan Roe.
9399
9400         * tests/tail-2/big-4gb: Mark this as an expensive test; it would
9401         consume 4GB of disk space on systems without support for sparse files.
9402         Fix a logic error that'd make it `cat err' even though dd didn't fail.
9403
9404         * src/dircolors.hin (.jar): Fix typo: s/;3$/;31/.
9405         Patch by steven@magelico.net, forwarded by Michael Stone.
9406
9407         * tests/ls/dired: Ensure that ls produces English messages.
9408         Patch by Alexey Vyskubov, forwarded by Michael Stone.
9409
9410 2002-10-08  Dmitry V. Levin  <ldv@altlinux.org>
9411
9412         * src/ln.c (main): Fix target_directory parsing when n_files == 1.
9413
9414 2002-10-08  Jim Meyering  <jim@meyering.net>
9415
9416         * tests/tail-2/big-4gb: Use double quotes around diagnostic.
9417         Fix syntax in test: use =, not ==.
9418         Reported by Bob Proulx.
9419         Change all the rest like this: grep -lR "testing framework'" .\
9420         |xargs perl -pi -e 's/'\''(\$0: failure in testing framework)'\''/"$1"/'
9421
9422         * src/sum.c (sysv_sum_file): Adapt to new safe_read ABI.
9423         * src/tr.c (squeeze_filter, read_and_delete, read_and_xlate): Likewise.
9424         * src/tac.c (save_stdin, tac_stdin_to_mem): Likewise.
9425         * src/wc.c (wc): Likewise.
9426
9427 2002-10-07  Paul Eggert  <eggert@twinsun.com>
9428
9429         * src/cat.c (cat):
9430         Don't advance the write pointer past the end of the write buffer.
9431         * src/sort.c (begfield, limfield): Likewise.
9432
9433 2002-10-07  Jim Meyering  <jim@meyering.net>
9434
9435         * src/cat.c (simple_cat, cat): Adapt to new safe_read ABI.
9436         * src/head.c (head_bytes, head_lines): Likewise.
9437
9438 2002-10-06  Jim Meyering  <jim@meyering.net>
9439
9440         * src/dd.c (scanargs): Ensure that specified block sizes (specified
9441         via ibs=N, obs=N, and bs=N) are no larger than SSIZE_MAX.
9442         (skip, dd_copy): Adapt to new safe_read ABI.
9443
9444         * Makefile.maint (signatures): Define.
9445         (%.sig): New rule.
9446         (announcement): Depend on $(signatures).
9447
9448         * Makefile.maint (announcement): Output all URLs for detached
9449         signatures, not just the last one from the previous loop.
9450
9451 2002-10-05  Jim Meyering  <jim@meyering.net>
9452
9453         * Version 4.5.2.
9454
9455         * src/remove.c (remove_entry) [ROOT_CAN_UNLINK_DIRS]: With `rm -i DIR',
9456         don't recurse into directory, DIR.  Prompted by a report from
9457         Leonardo Milano.
9458
9459         * tests/rm/i-no-r: New file/test, for the above fix.
9460         * tests/rm/Makefile.am (TESTS): Add i-no-r.
9461
9462         * tests/tail-2/big-4gb: New file/test, for the fix of 2002-09-27.
9463         * tests/tail-2/Makefile.am (TESTS): Add big-4gb.
9464
9465 2002-10-03  Jim Meyering  <jim@meyering.net>
9466
9467         * src/rm.c (AUTHORS): Mark translatable string with `N_ (...)'.
9468         * src/df.c (AUTHORS): Likewise.
9469         * src/du.c (AUTHORS): Likewise.
9470         * src/tail.c (AUTHORS): Likewise.
9471         * src/touch.c (AUTHORS): Likewise.
9472
9473 2002-10-02  Jim Meyering  <jim@meyering.net>
9474
9475         * Makefile.am (SUBDIRS): Remove `old'.
9476         (EXTRA_DIST): List the files in old/.
9477         * configure.ac (AC_CONFIG_FILES): Remove old/* names.
9478         Suggestion from Akim Demaille.
9479
9480 2002-10-01  Jim Meyering  <jim@meyering.net>
9481
9482         * src/sys2.h (SSIZE_MAX): Define.
9483
9484 2002-09-30  Jim Meyering  <jim@meyering.net>
9485
9486         * src/csplit.c: Don't include stdlib.h here.  It's already included
9487         via system.h.
9488
9489 2002-09-29  Jim Meyering  <jim@meyering.net>
9490
9491         * src/tr.c (find_bracketed_repeat): Rearrange pointer/integer
9492         expression to avoid bogus warning from gcc.
9493
9494         * src/cat.c (simple_cat): Use a temporary to avoid bogus warnings.
9495         (cat): Declare insize and outsize to be of type size_t, not int.
9496         Rearrange pointer/integer expressions to avoid bogus warnings.
9497         (main): Declare insize and outsize to be of type size_t, not int.
9498
9499         * src/tail.c (parse_options): Give a sensible diagnostic for
9500         an invalid byte or line count.  Reported by Mikko Tuumanen.
9501
9502         * src/touch.c (main): Split a long line.
9503
9504         * tests/du/Makefile.am (TESTS): Add slink.
9505         * tests/du/slink: New test for system.h change of 2002-08-31.
9506
9507         In move mode, always first try to rename.  Before, upon failure to
9508         rename a directory, this code would never attempt to rename any
9509         other file in that directory, but would thenceforth always copy.
9510         On some systems (e.g., NetApp's OnTap-6.4), renaming a directory
9511         may fail with EXDEV, yet renaming files within that directory to
9512         a newly-created destination directory succeeds.
9513         * src/copy.c (copy_internal): Remove local, move_mode;
9514         use x->move_mode instead.  Based on a patch from Tom Haynes.
9515
9516 2002-09-28  Jim Meyering  <jim@meyering.net>
9517
9518         * src/split.c (FAIL_ONLY_ONE_WAY): New macro.
9519         Factor out some duplication.
9520         (main): Use it.
9521         [case 'a']: Use strtoul rather than strtol to avoid compiler warnings.
9522
9523         * src/sort.c (begfield, limfield): Rearrange comparisons to avoid
9524         compiler warnings.
9525         (fillbuf, keycompare): Cast literal `-1' to size_t in comparisons,
9526         to avoid compiler warnings.
9527
9528         * src/shred.c (dopass): Use a uintmax_t temporary to avoid bogus
9529         compiler warnings.
9530
9531         Fix things so `mkdir -p' can create very deep directories, e.g.,
9532         mkdir -p $(perl -e 'print "a/" x 40000') now works.
9533         * src/mkdir.c (main): For --parents (-p), call make_path with the
9534         entire directory name, so we don't ever require that file operations
9535         like stat or chmod be performed on the entire command line argument.
9536         * makepath.c (make_path): Restore umask *before* creating the final
9537         component.
9538
9539 2002-09-27  Andreas Schwab  <schwab@suse.de>
9540
9541         * src/tail.c (tail_bytes): Change type of bytes_remaining to off_t
9542         to avoid overflow.  Reported by Hans Lermen.
9543
9544 2002-09-26  Jim Meyering  <jim@meyering.net>
9545
9546         * src/install.c (get_ids): Use strtoul, not strtol.  Remove some casts.
9547
9548 2002-09-25  Jim Meyering  <jim@meyering.net>
9549
9550         * src/test.c (eaccess): Change type of local `euid' from int to uid_t
9551         and add a cast, to avoid a warning about `signed and unsigned type in
9552         conditional expression'.
9553
9554 2002-09-22  Jim Meyering  <jim@meyering.net>
9555
9556         * src/rmdir.c: Include "dirname.h", for declaration of
9557         strip_trailing_slashes.
9558
9559         * src/stat.c (PRIdMAX, PRIuMAX): Remove definitions.
9560         Now they're defined through system.h.
9561
9562         * src/cp-hash.c, src/dd.c, src/df.c, src/du.c, src/ls.c,
9563         * src/stat.c, src/wc.c: Remove all inclusions of inttypes.h,
9564         since it's already included from sys2.h via system.h.
9565
9566         * Use automake-1.6f.  Regenerate dependent files.
9567
9568         * src/Makefile.am (PERL): Remove duplicate definition.
9569
9570         fmt's -s, -t, -c options didn't work properly for long lines.
9571         Since get_line may end up calling put_paragraph (for long lines),
9572         be sure to set global, `other_indent', before it is used there.
9573
9574         * src/fmt.c (set_other_indent): New function, factored out of...
9575         (get_paragraph): ... here.  Call it.
9576         (get_line): Call set_other_indent before calling flush_paragraph,
9577         which calls fmt_paragraph, which in turn calls put_paragraph,
9578         which uses other_indent.
9579
9580         * tests/fmt/Makefile.am (TESTS): Add long-line.
9581         * tests/fmt/long-line: New file/test, for the above fix.
9582
9583 2002-09-21  Jim Meyering  <jim@meyering.net>
9584
9585         * src/od.c: No longer include deprecated <values.h>.
9586         It was required solely for now-removed reference to BITSPERBYTE.
9587         * src/install.c: Likewise.
9588         Suggestion from Bruno Haible.
9589
9590 2002-09-06  Andreas Schwab  <schwab@suse.de>
9591
9592         `rmdir -p dir-specified-with-trailing-slash/' would fail.
9593         * src/rmdir.c (remove_parents): Strip trailing slashes.
9594
9595 2002-09-20  Jim Meyering  <jim@meyering.net>
9596
9597         * tests/rmdir/t-slash: New file/test, for the above fix.
9598         * tests/rmdir/Makefile.am (TESTS): Add t-slash.
9599
9600         * Makefile.maint (announcement): Arrange to gpg-sign the message.
9601         Add a URL for each detached signature file.
9602
9603 2002-09-07  Bruno Haible  <bruno@clisp.org>
9604
9605         * configure.ac: Add need-ngettext to AM_GNU_GETTEXT invocation.
9606
9607 2002-09-18  Jim Meyering  <jim@meyering.net>
9608
9609         `od -t x8' used the wrong (`l'-prefixed) printf format.
9610         Likewise for the o8 and u8 formats.
9611         * src/od.c (ISPEC_TO_FORMAT): Define macro.
9612         (decode_one_format): Use PRIdMAX, PRIoMAX, etc. for LONG_LONG.
9613         Reported by Arun Sharma.
9614
9615 2002-09-17  Jim Meyering  <jim@meyering.net>
9616
9617         * src/sys2.h (PRIdMAX, PRIoMAX, PRIuMAX, PRIxMAX): Define if necessary.
9618         From gettext's intl/loadmsgcat.c.
9619
9620         * tests/od/x8: New file/test, for the above fix.
9621         * tests/od/Makefile.am (TESTS): Add x8.
9622
9623 2002-09-15  Jim Meyering  <jim@meyering.net>
9624
9625         * Use autoconf-2.54.  Regenerate dependent files.
9626
9627         * src/csplit.c (get_format_width): Add cast to avoid
9628         warning about `signed and unsigned type in conditional expression'.
9629
9630 2002-09-14  Jim Meyering  <jim@meyering.net>
9631
9632         * src/who.c (print_user): Change type of local to size_t
9633         to avoid warnings about `comparison between signed and unsigned'.
9634         * src/ptx.c (generate_all_output): Likewise.
9635
9636         * src/dd.c (main, skip): Add casts to avoid warnings about
9637         `comparison between signed and unsigned'.
9638
9639         * src/id.c (print_full_info, print_group_list): Add casts to avoid
9640         warnings about `signed and unsigned type in conditional expression'.
9641
9642         * src/md5sum.c: Change type of global, digest_hex_bytes, to size_t
9643         to avoid warnings about `comparison between signed and unsigned'.
9644         (split_3): Change parameter names to be readable and add comment.
9645         Clean up the test for whether a line may be ignored.
9646
9647 2002-09-13  Jim Meyering  <jim@meyering.net>
9648
9649         * src/printf.c (main): Handle leading command line argument of `--'.
9650         Reported by Raul: DervishD <raul@pleyades.net>
9651         * tests/misc/printf: New file: test for the above.
9652         * tests/misc/Makefile.am (TESTS): Add printf.
9653
9654         * src/date.c (usage): Explain that %S's range of [0..60] is required --
9655         rather than 0..59 -- to accommodate the occasional positive leap second.
9656         Reported by Richard Neill.
9657
9658 2002-09-12  Jim Meyering  <jim@meyering.net>
9659
9660         * src/Makefile.am (nanosec_libs): Define.
9661         (sleep_LDADD, tail_LDADD): Use it here.
9662
9663         Factor nanosleep-related code into ../lib/xnanosleep.c.
9664         * src/sleep.c: Include xnanosleep.h.
9665         Factor out fenv.h-related code.
9666         (timespec_subtract): Remove function.
9667         (main): Remove code that deals with computing start and stop times
9668         as well as the loop around nanosleep.  Now that's in xnanosleep.c.
9669
9670         Allow S (in --sleep-interval=S) to be a floating point value.
9671         * src/tail.c: Include xnanosleep.h and xstrtod.h.
9672         Move declaration of global variable, sleep_interval, to ...
9673         (main): ...here.
9674         (usage): Update description of --sleep-interval option.
9675         (tail_forever): New parameter, sleep_interval.  Update caller.
9676         Use xnanosleep, rather than sleep.
9677         (parse_options): New parameter, sleep_interval.  Update caller.
9678         Use xstrtod, now that we accept floating point values.
9679         Prompted by a patch from Augey Mikus.
9680
9681 2002-09-06  Jim Meyering  <jim@meyering.net>
9682
9683         * src/remove.c (prompt): Change comment to give a better note to
9684         translators.  From Michael Piefel.
9685
9686 2002-09-02  Jim Meyering  <jim@meyering.net>
9687
9688         * README: A good problem report/patch includes diffs against
9689         the most recent test release.
9690
9691         * src/pathchk.c (NEED_PATHCONF_WRAPPER): Define.
9692         (pathconf_wrapper): Define only if NEED_PATHCONF_WRAPPER is set.
9693
9694         * src/kill.c (print_table_row): Use an unsigned type for widths
9695         to avoid warning about comparison between signed and unsigned.
9696         (list_signals): Likewise.
9697
9698         * src/od.c (skip): Add a cast to avoid warning about comparison
9699         between signed and unsigned.
9700         * src/install.c (get_ids): Likewise.  Also rearrange range-checking
9701         comparisons to make them more readable.
9702
9703 2002-09-01  Jim Meyering  <jim@meyering.net>
9704
9705         * Version 4.5.1.
9706
9707 2002-08-31  Jim Meyering  <jim@meyering.net>
9708
9709         Symlinks were always reported as using 0 blocks.
9710         * src/system.h (ST_NBLOCKS): Don't depend on file type.
9711         This reverts the change of 2000-01-30.
9712         Based on a report and patch from Neil Brown via Michael Stone.
9713         This fixes Debian Bug#156358.
9714
9715         * Most files: Change `exit (0)' to `exit (EXIT_SUCCESS)',
9716         `exit (1)' to `exit (EXIT_FAILURE)', and
9717         `usage (1)' to `usage (EXIT_FAILURE)'.
9718
9719         * chgrp.c, chmod.c, chown.c, chroot.c, cp.c, date.c, dd.c, du.c,
9720         * hostname.c, id.c, install.c, ln.c, mkdir.c, mkfifo.c, mknod.c,
9721         * nice.c, pinky.c, printf.c, pwd.c, shred.c, sleep.c, stty.c,
9722         * su.c, tac-pipe.c, tail.c, tee.c, touch.c, uname.c, uptime.c,
9723         * users.c, who.c: Change `error (1, ...' to `error (EXIT_FAILURE, ...'.
9724         But don't change `error (0, ...' to `error (EXIT_SUCCESS, ...', since
9725         error never exits successfully.
9726
9727 2002-08-29  Jim Meyering  <jim@meyering.net>
9728
9729         * src/remove.c (remove_cwd_entries): Use closedir (not CLOSEDIR)
9730         when ignoring any return value.
9731
9732         * src/remove.c (remove_cwd_entries): Detect and diagnose readdir
9733         failures.  On some systems (at least EMC Celerra and Solaris5.8),
9734         this appears to be necessary.
9735         (is_empty_dir): Likewise.  Also, always close directory handle.
9736         * src/ls.c (print_dir): Likewise.
9737         (print_dir): Rename local variable: reading -> dirp.
9738         Reported by Mike Coleman.
9739
9740 2002-08-28  Jim Meyering  <jim@meyering.net>
9741
9742         * src/remove.c (remove_cwd_entries): Use CLOSEDIR, not closedir.
9743         Give a diagnostic and fail if closedir fails.
9744
9745 2002-08-26  Jim Meyering  <jim@meyering.net>
9746
9747         * Makefile.am (THANKS-to-translators): New rule.
9748         (EXTRA_DIST): Add both THANKS-to-translators and THANKStt.in.
9749         * THANKStt.in: New file.
9750
9751         * src/cat.c (close_stdout_wrapper): New, kludgey, function and
9752         file-scoped global.
9753         (main): Register it with atexit.
9754         Close STDOUT_FILENO, to avoid a problem when writing to
9755         /dev/audio on at least Solaris 5.7 and 5.8 systems.
9756         Reported by Shing-Shong Shei.
9757
9758 2002-08-25  Jim Meyering  <jim@meyering.net>
9759
9760         * src/cat.c (main): Close STDIN_FILENO rather than a literal `0'.
9761         * src/tac.c (main): Likewise.
9762         * src/tail.c (main): Likewise.
9763         * src/tee.c (main): Likewise.
9764         * src/tr.c (main): Likewise.
9765         * src/wc.c (main): Likewise.
9766
9767 2002-08-20  Jim Meyering  <jim@meyering.net>
9768
9769         * tests/mv/setup: Rewrite not to use `: ${VAR=not_set}' paradigm.
9770
9771 2002-08-10  Paul Eggert  <eggert@twinsun.com>
9772
9773         * src/nohup.sh: Don't use "exec --"; it's not portable and
9774         shouldn't be needed.
9775
9776 2002-08-09  Jim Meyering  <jim@meyering.net>
9777
9778         * src/pr.c (main): Don't ignore -COLUMN if it's the last option.
9779         (usage): Clarify help text for the -COLUMN option.
9780         Patch by Padraig Brady.
9781         * tests/pr/Test.pm [col-last]: New test for the above.
9782
9783         * configure.ac: Start with version 4.5.1, chosen so that it's larger
9784         than the latest version numbers of the component packages.
9785
9786         * man/Makefile.am (check-x-vs-1): Set and export PATH so we use
9787         programs in ../src.
9788
9789 2002-08-08  Jim Meyering  <jim@meyering.net>
9790
9791         * src/date.c: Guard inclusion of <langinfo.h> with
9792         `#if HAVE_LANGINFO_CODESET', not `#if HAVE_LANGINFO_H'.
9793         * src/sort.c: Likewise.
9794         Patch by GOTO Masanori.
9795
9796 2002-08-05  Paul Eggert  <eggert@twinsun.com>
9797
9798         Fix some minor time-related bugs with POSIX time arguments.
9799         Some valid time stamps were being rejected (notably -1, and
9800         time stamps before 1900 on 64-bit hosts).  And some invalid
9801         time stamps were being accepted, e.g. September 31.
9802
9803         * src/date.c (main): Adjust to posixtime signature change.
9804         * src/touch.c (main): Likewise.  Remove unnecessary initialization.
9805         Use localtime, not posixtm, to warn about obsolete "touch".
9806
9807 2002-08-05  Jim Meyering  <jim@meyering.net>
9808
9809         * tests/misc/Makefile.am (TESTS): Add nice and pathchk1.
9810
9811 2002-08-04  Jim Meyering  <jim@meyering.net>
9812
9813         * src/Makefile.am (check-README): New target/rule.
9814         (check): Depend on it.
9815
9816         * configure.ac (AC_CONFIG_FILES): Add old/Makefile and old/*/Makefile.
9817
9818 2002-08-03  Jim Meyering  <jim@meyering.net>
9819
9820         * Makefile.am (SUBDIRS): Add old.
9821         * old/: New directory, containing legacy ChangeLog* and NEWS files
9822         from the fileutils, sh-utils, and textutils packages.
9823
9824         * src/Makefile.am (AM_INSTALLCHECK_STD_OPTIONS_EXEMPT): Set to false.
9825
9826 2002-08-02  Paul Eggert  <eggert@twinsun.com>
9827
9828         * NEWS, doc/coreutils.texi: uniq now obeys LC_COLLATE.
9829
9830         * src/uniq.c: Include hard-locale.h, xmemcoll.h.
9831         (hard_LC_COLLATE): New var.
9832         (different): Args are now char *, not const char *.
9833         Use xmemcoll instead of memcmp to compare lines, so that
9834         LC_COLLATE has effect.  However, use memcmp if it is an
9835         easy locale.
9836         (check_file): Do not include newline in comparison, so that
9837         xmemcoll has a byte to stomp on temporarily.
9838         (main): Set hard_LC_COLLATE.
9839
9840 2002-07-29  Jim Meyering  <jim@meyering.net>
9841
9842         * Makefile.am (SUBDIRS): Remove djgpp, for now.
9843
9844 2002-07-20  Jim Meyering  <jim@meyering.net>
9845
9846         * Makefile.am (false.c): Convert only the final EXIT_SUCCESS
9847         into EXIT_FAILURE.  Otherwise, false --help and false --version
9848         would fail.
9849
9850 2002-07-08  Jim Meyering  <jim@meyering.net>
9851
9852         * src/Makefile.am (uninstall-local): Search for @GNU_PACKAGE@,
9853         rather than the hard-coded `sh-utils'.
9854
9855 2002-07-01  Jim Meyering  <jim@meyering.net>
9856
9857         * configure.ac: Merge the three files from fileutils,
9858         textutils, and sh-utils.
9859         * Makefile.am: Likewise.
9860         * src/Makefile.am: Likewise.