*** empty log message ***
[platform/upstream/coreutils.git] / ChangeLog
1 2005-06-10  Jim Meyering  <jim@meyering.net>
2
3         * Version 5.3.1.
4
5         * src/system.h (VERIFY_W_TYPEOF): Add parentheses.
6
7 2005-06-02  Jim Meyering  <jim@meyering.net>
8
9         * src/sort.c (usage): Put `Ordering options:' line where it belongs.
10
11 2005-06-01  Paul Eggert  <eggert@cs.ucla.edu>
12
13         Use "file name" when talking about file names, instead of "filename"
14         or "path", as per the GNU coding standards.
15         * src/basename.c: Don't use "path" or "filename".
16         * src/copy.c: Likewise.
17         * src/copy.h: Likewise.
18         * src/cp-hash.c: Likewise.
19         * src/cp.c: Likewise.
20         * src/df.c: Likewise.
21         * src/install.c: Likewise.
22         * src/ls.c: Likewise.
23         * src/pinky.c: Likewise.
24         * src/pr.c: Likewise.
25         * src/pwd.c: Likewise.
26         * src/remove.c: Likewise.
27         * src/rmdir.c: Likewise.
28         * src/sort.c: Likewise.
29         * src/system.h: Likewise.
30         * src/tty.c: Likewise.
31         * src/who.c: Likewise.
32         * src/cp.c (parents_option): Renamed from flag_path.  All uses changed.
33         (make_dir_parents_private): Renamed from make_path_private.
34         All uses changed.
35         * src/cp.c (usage): Don't use "path" to describe a file name.
36         * src/readlink.c (usage): Likewise.
37         * src/rmdir.c (usage): Likewise.
38         * src/df.c: Don't include "path-concat.h"; not needed.
39         * src/install.c (install_file_in_file_parents): Renamed from
40         install_file_to_path.  All uses changed.
41         * src/ln.c (FILE_BASENAME_CONCAT): Renamed from PATH_BASENAME_CONCAT.
42         All uses changed.
43         * src/ls.c (make_link_name): Renamed from make_link_path.
44         All uses changed.
45         * src/pwd.c (struct file_name): Renamed from struct Path.
46         All uses changed.
47         (file_name_free): Renamed from path_free.  All uses changed.
48         (file_name_init): Renamed from path_init.  All uses changed.
49         (file_name_prepend): Renamed from path_prepend.  All uses changed.
50         * src/rmdir.c (remove_empty_parents): Renamed from empty_paths.
51         All uses changed.
52         (longopts): Add comment that --path is deprecated.
53
54 2005-05-31  Jim Meyering  <jim@meyering.net>
55
56         * src/copy.c (chown_privileges, chown_failure_ok): Mark as `extern'.
57         This is a crutch so that `make distcheck's sc_tight_scope rule
58         knows that they really are deliberately declared that way.
59
60 2005-05-30  Paul Eggert  <eggert@cs.ucla.edu>
61
62         Port to Solaris 10's rules for whether programs can chown files.
63         * src/copy.c [HAVE_PRIV_H]: Include <priv.h>.
64         (DO_CHOWN): Remove.  Replaced by chown_failure_ok.  All callers
65         changed.
66         (copy_internal): If chown failed, don't worry about what happened
67         to the mode bits; they can't have changed.
68         (chown_privileges, chown_failure_ok): New functions.
69         * src/copy.h: Add copyright notice.
70         (struct cp_options): Remove myeuid member.  Add chown_privileges
71         member.
72         (chown_privileges, chown_failure_ok): New function decls.
73         * src/cp.c (re_protect): Remove unnecessary call to geteuid.
74         Use chown_failure_ok rather than our own code.
75         * src/cp.c (cp_options_init): Use chown_privileges rather than geteuid.
76         * src/install.c (cp_option_init): Likewise.
77         * src/mv.c (cp_option_init): Likewise.
78
79 2005-05-29  Paul Eggert  <eggert@cs.ucla.edu>
80
81         * src/chgrp.c (getgrnam) [!defined _POSIX_VERSION]: Remove decl.
82         * src/chown-core.c (getgrnam, getgrgid) [!defined _POSIX_VERSION]:
83         Remove decls.
84         * src/cp.c (geteuid) [!defined _POSIX_VERSION]: Remove decl.
85         * src/id.c (getpwuid, getgrgid, getuid, getgid, geteuid, getegid)
86         [!defined _POSIX_VERSION]: Remove decls.
87         * src/install.c (getpwnam, getgrnam): Remove decl.
88         (getuid, getgid) [!defined _POSIX_VERSION]: Remove decls.
89         * src/md5sum.c (OPENOPTS, TEXT1T01, TEXTCNVT): Remove.
90         (digest_file): Use O_BINARY-using expr instead of OPENOPTS.
91         * src/system.h: Don't bother mentioning _POSIX_VERSION in comment.
92         * src/test.c: Include sys/param.h if it exists, not if _POSIX_VERSION
93         isn't defined.
94         Don't include <sys/file.h>; no longer needed.
95         (getegid, geteuid): Remove no-longer-necessary decls.
96
97         * src/pathchk.c (_POSIX_PATH_MAX) [!defined _POSIX_PATH_MAX]:
98         Define to 256, not 255, as per modern POSIX.
99
100 2005-05-27  Paul Eggert  <eggert@cs.ucla.edu>
101
102         * NEWS: dd seek=N now conforms to POSIX if the output isn't seekable.
103         * src/dd.c (skip): Return the number of records that were not
104         skipped due to encountering EOF.
105         (dd_copy): If the file wasn't seekable and EOF was encountered,
106         write zeros past EOF until the desired offset is reached.
107
108         * NEWS: expr and test now correctly compare integers of unlimited size.
109         (Also, correct a comment that claimed that expr detects integer
110         overflow; it does so only when converting from strings.)
111         * src/expr.c: Include strnumcmp.h, xstrtol.h.
112         (looks_like_integer): New function.
113         (toarith): Use it.  Also, use xstrtoimax rather than rolling our
114         own diagnostics.
115         (eval2): Don't look for trouble if !evaluate; this simplifies things.
116         Compare numbers using string comparison, so that overflow is
117         not possible.
118         * src/sort.c: Refactor so that others can use large-integer
119         comparison functions.
120         Include "strnumcmp.h".
121         (NEGATION_SIGN, NUMERIC_ZERO, fraccompare):
122         Remove; moved to strnumcmp.
123         (decimal_point): Now int, to simplify converison overhead with
124         new API.  All uses changed.
125         (thousands_sep): Now -1 if there isn't one, as per new API.
126         All uses changed.
127         (numcompare): Move contents to strnumcmp module, except for
128         skipping blanks.
129         * src/test.c: Include inttostr.h, strnumcmp.h.
130         (whitespace, digit, digit_value, integer_expected_error): Remove.
131         (is_int): Remove; replaced by...
132         (find_int): New function.
133         (binary_operator): Don't let integers overflow in comparisons;
134         return the correct answer instead.  Simplify the code.
135         (unary_operator): Convert the integer ourself, since find_int
136         no longer does so.
137         * tests/expr/basic (bigcmp): New test.
138         * tests/test/Test.pm (eq-6, gt-5, lt-5): New tests.
139
140 2005-05-26  Paul Eggert  <eggert@cs.ucla.edu>
141
142         * NEWS: nohup now redirects a tty stdin to an unreadable fd
143         instead of closing it.
144         * doc/coreutils.texi (nohup invocation): Document this.
145         * src/nohup.c (main): Implement this.
146
147 2005-05-26  Jim Meyering  <jim@meyering.net>
148
149         * src/expr.c (toarith): Fix a sign error introduced on 2005-01-14.
150         Reported by David Alan Gilbert.
151         * tests/expr/basic: Add tests using arithmetic on negative integers.
152
153 2005-05-19  Jim Meyering  <jim@meyering.net>
154
155         * src/remove.c (AD_mark_helper, AD_mark_current_as_unremovable):
156         Remove inaccurate-but-harmless `const' attributes.
157
158         * src/join.c (decode_field_spec): Add an abort after
159         `error (EXIT_FAILURE, ...' to avoid a gcc warning in caller,
160         about variables being used uninitialized.
161
162 2005-05-18  Paul Eggert  <eggert@cs.ucla.edu>
163
164         * configure.ac: Add copyright notice.  gl_LIB_CHECK -> cu_LIB_CHECK.
165         * src/Makefile.am: Add copyright notice.
166         (factor_LDADD): Remove, as factor no longer needs sqrt.
167         * src/hostname.c: Remove test for HAVE_LIMITS_H; we can assume
168         it's always true now.
169
170 2005-05-16  Paul Eggert  <eggert@cs.ucla.edu>
171
172         Fix Cygwin porting problem reported by Eric Blake.
173         * src/remove.c (DT_IS_DIR): Remove.
174         (DT_IS_KNOWN, DT_MUST_BE): New macros.
175         (remove_entry): Use them.
176
177 2005-05-14  Paul Eggert  <eggert@cs.ucla.edu>
178
179         * src/remove.c: Include unlinkdir.h.
180         (UNLINK_CAN_UNLINK_DIRS): Remove.
181         (remove_entry): Use cannot_unlink_dirs () rather than
182         UNLINK_CAN_UNLINK_DIRS.
183
184 2005-05-14  Jim Meyering  <jim@meyering.net>
185
186         Update FSF postal mail address.
187         * Makefile.maint, Makefile.cfg, gnupload
188         * src/basename.c, src/cat.c, src/checksum.h, src/chgrp.c
189         * src/chmod.c, src/chown-core.c, src/chown-core.h, src/chown.c
190         * src/chroot.c, src/cksum.c, src/comm.c, src/copy.c, src/copy.h
191         * src/cp-hash.c, src/cp-hash.h, src/cp.c, src/csplit.c, src/cut.c
192         * src/date.c, src/dcgen, src/dd.c, src/df.c, src/dircolors.c
193         * src/dirname.c, src/du.c, src/echo.c, src/env.c, src/expand.c
194         * src/expr.c, src/factor.c, src/fmt.c, src/fold.c, src/fs.h
195         * src/groups.sh, src/head.c, src/hostid.c, src/hostname.c, src/id.c
196         * src/install.c, src/join.c, src/kill.c, src/lbracket.c, src/link.c
197         * src/ln.c, src/logname.c, src/ls-dir.c, src/ls-ls.c, src/ls-vdir.c
198         * src/ls.c, src/ls.h, src/md5.c, src/md5sum.c, src/mkdir.c
199         * src/mkfifo.c, src/mknod.c, src/mv.c, src/nice.c, src/nl.c
200         * src/nohup.c, src/od.c, src/paste.c, src/pathchk.c, src/pinky.c
201         * src/pr.c, src/printenv.c, src/printf.c, src/ptx.c, src/pwd.c
202         * src/readlink.c, src/remove.c, src/remove.h, src/rm.c, src/rmdir.c
203         * src/seq.c, src/setuidgid.c, src/sha1sum.c, src/shred.c
204         * src/sleep.c, src/sort.c, src/split.c, src/stat.c, src/stty.c
205         * src/su.c, src/sum.c, src/sync.c, src/system.h, src/tac-pipe.c
206         * src/tac.c, src/tail.c, src/tee.c, src/test.c, src/touch.c
207         * src/tr.c, src/true.c, src/tsort.c, src/tty.c, src/uname.c
208         * src/unexpand.c, src/uniq.c, src/unlink.c, src/uptime.c
209         * src/users.c, src/wc.c, src/who.c, src/whoami.c, src/yes.c
210
211 2005-05-13  Jim Meyering  <jim@meyering.net>
212
213         * NEWS: `rm -r' now removes all of the files it should, even on
214         systems with a buggy readdir affecting file systems inaccessible
215         at configure time.
216
217         In some unusual circumstances `rm -r' would fail to remove --
218         or even consider -- all entries in a directory with more than 254
219         (SunOS) or 338 (Darwin) entries.  This could cause trouble even on
220         other types of systems when using an affected file system via e.g.,
221         NFS.  The underlying cause was a bug in readdir on those systems.
222         Coreutils-5.2.1 and earlier used a configure-time test designed
223         to detect precisely those problem systems, but it would detect
224         the problem and enable remove.c's work-around code only when its
225         configure-time test was run on a losing file system.  Obviously,
226         it couldn't detect a problem if the offending file system wasn't
227         tested or even mounted at coreutils configure time.  Now, rm itself
228         performs a minimal-cost run-time test to detect the problem.
229
230         * src/remove.c (CONSECUTIVE_READDIR_UNLINK_THRESHOLD): Define.
231         (remove_cwd_entries):  When readdir returns NULL for a directory from
232         which we've removed more than CONSECUTIVE_READDIR_UNLINK_THRESHOLD
233         entries, call rewinddir and then resume the readdir/unlink loop.
234         (UNLINK_CAN_UNLINK_DIRS): Rename from ROOT_CAN_UNLINK_DIRS.
235
236 2005-05-12  Paul Eggert  <eggert@cs.ucla.edu>
237
238         * NEWS: nohup now closes stdin if it is a terminal, unless
239         POSIXLY_CORRECT is set.  This fixes a glitch noted by Wayne Pollock in
240         <https://www.opengroup.org/sophocles/show_mail.tpl?
241         source=L&listname=austin-group-l&id=8341>.
242         * doc/coreutils.texi (nohup invocation): Document this.
243         * src/nohup.c (main): Implement this.
244
245 2005-05-12  Jim Meyering  <jim@meyering.net>
246
247         * src/date.c: Assume `free (NULL)' works.
248         * src/dd.c: Likewise.
249         * src/df.c:Likewise.
250         * src/dircolors.c:Likewise.
251         * src/head.c: Likewise.
252         * src/ls.c: Likewise.
253         * src/md5sum.c: Likewise.
254         * src/pr.c: Likewise.
255         * src/sort.c: Likewise.
256
257 2005-05-10  Jim Meyering  <jim@meyering.net>
258
259         * tests/touch/not-owner: Skip this test if the user running it
260         owns `/' or has write access to it.
261
262         * src/copy.c (abandon_move): Remove erroneous UNWRITABLE check.
263         This makes `mv -i --reply=no f1 f2' work as expected (in not
264         performing the move operation).  But note that specifying `-i'
265         after `--reply=no' does *not* work.
266         Tiny patch from Vlada Macek.
267         Correct a comment.
268         * tests/mv/reply-no: New file.  Test for the above fix.
269         * tests/mv/Makefile.am (TESTS): Add reply-no.
270
271         * tests/ls-2/tests: Don't print PATH to stderr.
272
273 2005-05-08  Paul Eggert  <eggert@cs.ucla.edu>
274
275         * NEWS: cp, ln, mv, rm no longer discard white space when intepreting
276         responses.
277
278 2005-05-06  Paul Eggert  <eggert@cs.ucla.edu>
279
280         * NEWS: dd has new iflag= and oflag= flags "binary" and "text".
281         * src/dd.c (flags, usage): Add support for "binary" and "text".
282
283 2005-05-04  Paul Eggert  <eggert@cs.ucla.edu>
284
285         * NEWS: chmod -w now complains if it differs from chmod a-w.
286         * src/chmod.c: Include quotearg.h.
287         (diagnose_surprises): New var.
288         (process_file): Diagnose surprises.  Simplify the logic a bit,
289         while we're at it.
290         (main): Prepare to diagnose surprises.  Remove useless code for
291         '-' option.
292         * tests/chmod/Makefile.am (TESTS): Add umask-x.
293         * tests/chmod/umask-x: New file.
294
295 2005-05-02  Paul Eggert  <eggert@cs.ucla.edu>
296
297         * NEWS: ls --indicator-style=directory renamed to ls
298         --indicator-style=slash, to avoid confusion with ls --directory.
299         * src/ls.c (usage): Likewise.
300         (slash): Renamed from directory_only.  All uses changed.
301
302 2005-05-01  Paul Eggert  <eggert@cs.ucla.edu>
303
304         * NEWS: "chmod +1 foo" is now diagnosed.
305
306 2005-04-29  Paul Eggert  <eggert@cs.ucla.edu>
307
308         * NEWS: ls -p now marks only directories.  New option
309         --indicator-style=directory equivalent to -p.
310         * doc/coreutils.texi (ls invocation): Document this.
311         Also, mention ">" is for doors.
312         * src/ls.c (enum indicator_style): New constant directory_only,
313         for -p.
314         (indicator_style_args, indicator_style_types): Set it appropriately.
315         (decode_switches, gobble_file, print_type_indicator):
316         (length_of_file_name_and_frills):
317         Implement the change described in NEWS.
318         (decode_switches): Quote ">", too.
319         (usage): Update to match the new behavior.  Describe ">".
320         * tests/ls/file-type: Test for new behavior.  Omit -1 option.
321         The "ls --color" test wasn't being checked; add a check for
322         "ls --color=auto" instead.
323
324         * tests/head/Test.pm: Don't set _POSIX2_VERSION; no longer needed.
325         * tests/misc/split-fail: Likewise.
326         * tests/pr/Test.pm: Likewise.
327         * tests/sort/Test.pm: Fix comment to match new behavior of "sort".
328         * tests/tail/Test.pm (tv): Rename tests from obs to obs-plus
329         if they use file names starting with +.
330         (test_vector): Don't set _POSIX2_VERSION if obs but not obs-plus.
331         * tests/uniq/Test.pm (tv, test_vector): Likewise.
332
333         The following was partly derived from a tiny change by Eric Blake:
334         * tests/misc/nice: Don't use 'set -'.  It's not portable to strict
335         POSIX 1003.1-2001 hosts.  Also, don't set _POSIX2_VERSION.
336         * tests/mkdir/perm: Don't use 'set -'.  Simplify test construction.
337         Work even if the underyling system attaches ACLs to new dirs.
338         * tests/mv/part-hardlink: Don't use 'set -'.
339         * tests/stty/row-col-1: Don't use 'set -'.
340
341 2005-04-28  Paul Eggert  <eggert@cs.ucla.edu>
342
343         * NEWS: Document fixes described below.
344         * src/chmod.c (change, umask_value): New static vars.
345         (reference_file): Move this static var to inside "main".
346         (process_file, process_files): Remove CHANGES arg; now taken from
347         static var.  All uses changed.
348         (usage): Fix incorrect description of MODE operand.
349         (main): For invalid mode usages, output a brief usage message.
350         Adjust to new modechange API.
351         * install.c (main): Adjust to new modechange API.
352         Also, free the mode_change object when done.
353         * mkdir.c (main): Likewise.
354         * mkfifo.c (main): Likewise.
355         * mknod.c (main): Likewise.
356         * tests/chmod/equal-X: Check for =xX bug.
357         * tests/chmod/equals: Check for =u bug.
358         * tests/chmod/usage: Check for u+gr and ug,+x bugs.
359
360 2005-04-26  Paul Eggert  <eggert@cs.ucla.edu>
361
362         Restore support for usages like "head -1" and "tail -1",
363         even when conforming to POSIX 1003.1-2001.
364         Fix bug with "POSIXLY_CORRECT=1 fold file -3".
365         join now supports a NUL field separator, e.g., "join -t '\0'".
366         join now detects and reports incompatible options, e.g.,
367         "join -t x -t y",
368         * NEWS: Document this.
369         * src/date.c: Remove posixver.h and its uses.
370         (COMMON_SHORT_OPTIONS): Remove.
371         (short_options): New constant.
372         (short_options, usage): -I now always takes an optional arg.
373         * src/expand.c: Remove posixver.h and its uses.
374         (shortopts): New constant.  -DIGIT now always takes an optional arg.
375         (main): Revamp parsing of -DIGIT to let parse_tab_stops handle it.
376         Don't complain about -DIGIT.
377         * src/fold.c: Remove posixver.h and its uses.
378         (shortopts): New constant.  -DIGIT now always takes an optional arg.
379         (main): Don't preprocess arg list; that was buggy.  Use method
380         similar to expand.
381         * src/head.c: Remove posixver.h and its uses.
382         (header_mode_option): Remove.
383         (main): Don't complain about obsolete -NUM args.
384         * src/join.c: Remove posixver.h and its uses.
385         (obsolete_usage): Remove.
386         (join_field_1, join_field_2): Initialize to SIZE_MAX to indicate
387         they haven't been set yet.
388         (tab): Now int, not char.  Initialize to -1 to indicate white space
389         separates columns, so that we can use NUL as a separator.
390         All uses changed.
391         (OBSOLETE_LONG_OPTIONS, get_option): Remove.
392         (string_to_join_field): Remove ERR_MSG_FMT arg; a single format
393         suffices.  Use xstrtoul for sizes; it suffices.
394         (decode_field_spec): Report an error and exit on failure.  Return void,
395         not bool.
396         (add_field_list): Likewise.
397         (set_join_field): New function.
398         (enum operand_status): New enum.
399         (add_file_name): New args OPERAND_STATUS, JOPTION_COUNT,
400         PREV_OPTC_STATUS, OPTC_STATUS to handle the bewildering array of
401         possibilities with obsolete option parsing.
402         (main): Use it.  Do not depend on POSIX version.
403         Check for conflicting options.  Parse obsolete options -j1 and -j2
404         so that it is a pure extension to POSIX 1003.1-2001.
405         Allow '-t\0' to specify a NUL tab, stealing the code from 'sort'.
406         * src/nice.c: Remove posixver.h and its uses.
407         (main): Always support -NUM option.
408         * src/od.c: Remove posixver.h and its uses.
409         (short_options): New constant, which always supports -w[num].
410         (COMMON_SHORT_OPTIONS): Remove.
411         * src/pr.c: Remove posixver.h and its uses.
412         (short_options): New constant, which always supports -S[string].
413         (COMMON_SHORT_OPTIONS): Remove.
414         * src/sort.c: Remove posixver.h and its uses.
415         (short_options): New constant, which always supports -y arg.
416         (COMMON_SHORT_OPTIONS): Remove.
417         (main): Redo workaround for Solaris compatibility with -y.
418         This change isn't visible to the user; it just cleans up the
419         code so that we don't need posixver.h.
420         * src/split.c: Remove posixver.h and its uses.
421         (main): Don't complain about -NUM option.
422         * src/tail.c (parse_obsolete_option): Don't complain about -NUM.
423         * src/unexpand.c: Remove posixver.h and its uses.
424         (main): Don't complain about -TAB.
425         * src/uniq.c (main): Don't complain about -NUM.
426
427 2005-04-22  Paul Eggert  <eggert@cs.ucla.edu>
428
429         * src/nohup.c (main): If getopt fails, exit with status 127,
430         not status 1.  POSIX requires this.
431         * NEWS: Document this.
432
433         * src/nice.c (main): Report proper program name when getopt finds
434         trouble.  Problem reported by Behdad Esfahbod.
435
436         * NEWS: Fix bug with "mkdir -m =+x dir"; the umask was being ignored
437         when the "+x" was being evaluated.
438         * mkdir.c (main): Compile mode with MODE_MASK_ALL and initial umask.
439         * mkfifo.c (main): Likewise.
440         * mknod.c (main): Likewise.
441         * tests/mkdir/perm: Test for the above bug.
442
443 2005-04-20  Paul Eggert  <eggert@cs.ucla.edu>
444
445         Port test cases to Microsoft-Windows-related environments,
446         following suggestions from Eric Blake.
447         * tests/install/Makefile.am (TESTS_ENVIRONMENT): Add EXEEXT.
448         * tests/install/basic-1: Undo previous change.
449         (dd, dd2): New vars, which use $EXEEXT.  All uses of dd and dd2 changed.
450         * tests/install/trap: Undo previous change.
451         (sig): New var.  Use it insted of "trap '' CHLD".
452         Append $EXEEXT to executable name.
453
454         "fetish" -> "coreutils" in more places.
455         * tests/Coreutils.pm: Renamed from tests/Fetish.pm.
456         (package Coreutils): Renamed from package Fetish.  All uses changed.
457         * tests/Makefile.am (EXTRA_DIST): Add Coreutils.pm and
458         remove Fetish.pm.
459
460 2005-04-19  Paul Eggert  <eggert@cs.ucla.edu>
461
462         * tests/mv/setup (dot_mount_point): Use stat -L, in case the
463         directory is actually a symbolic link.  Problem reported by
464         Eric Blake.
465
466         * tests/mv/mv-special-1: Use test -p to test for fifos, rather
467         than the (incorrect) test -f and the (inadequate) ls.  ls is
468         inadequate because on some hosts a buggy mv will create a file of
469         the wrong type (problem reported by Eric Blake).  Skip this test
470         if test -p doesn't work.
471
472         * tests/chmod/setgid: Use numeric group ids, not symbolic group names,
473         since the latter can have shell metacharacters in them (e.g., spaces).
474         This follows up to the 2005-01-17 patch, which missed this occurrence.
475
476 2005-04-18  Paul Eggert  <eggert@cs.ucla.edu>
477
478         "fetish" -> "coreutils" in several places.
479         * Makefile.cfg (ftp): Remove fetish.sf.net.
480         * Makefile.maint (emit_upload_commands): Likewise.
481         * src/Makefile.am (LDADD, $(PROGRAMS)): fetish -> coreutils.
482         * tests/group-names (COREUTILS_GROUPS): Renamed from FETISH_GROUPS.
483         * tests/chmod/setgid (FETISH_GROUP): Renamed from COREUTILS_GROUP.
484
485         * tests/install/basic-1: Use "cat", not "test", to test for
486         ../../src/dd.  Problem reported by Eric Blake.
487
488 2005-04-18  Jim Meyering  <jim@meyering.net>
489
490         * src/dd.c: Don't include stat-macros.h directly.  system.h does that.
491
492 2005-04-17  Paul Eggert  <eggert@cs.ucla.edu>
493
494         Work around a couple of "make check" failures reported for Cygwin
495         and ash by Eric Blake.
496         * tests/install/basic-1: Skip this test if ../../src/dd isn't readable.
497         * tests/install/trap: Skip this test if "trap '' CHLD" doesn't work.
498
499 2005-04-16  Jim Meyering  <jim@meyering.net>
500
501         * src/dd.c (S_TYPEISSHM): Remove definition.
502         Get the definition by including "stat-macros.h", instead.
503
504 2005-04-14  Paul Eggert  <eggert@cs.ucla.edu>
505
506         Fix test suite problems reported by Eric Blake on Cygwin.
507         * tests/mv/mv-special-1: Ignore chatter about when files are removed,
508         since POSIX doesn't require rename to fail across file systems.
509         * tests/mv/setup (dot_mount_point): Use stat rather than df, as
510         it's more reliable.
511         (other_partition_tmpdir): Remove df from name as that would be
512         misleading now.
513
514 2005-04-14  Jim Meyering  <jim@meyering.net>
515
516         * src/chown-core.c: Correct typo, fchmod -> fchown, in a comment.
517
518 2005-04-12  Paul Eggert  <eggert@cs.ucla.edu>
519
520         * src/ls.c (usage): "uid" -> "user ID".
521
522 2005-04-12  Jim Meyering  <jim@meyering.net>
523
524         * src/tsort.c (tsort): Use "%s" as the format string,
525         rather than a diagnostic or a file name.
526
527         * src/comm.c (compare_files): Remove declaration of unused local.
528
529         * src/chown-core.c (chopt_free): Mark parameter as unused.
530
531 2005-04-11  Paul Eggert  <eggert@cs.ucla.edu>
532
533         * man/chown.x: Reword to match user manual.
534         * man/id.x: Likewise.
535         * src/setuidgid.c (usage): Use "user ID", not "UID", and similarly
536         for "group ID".
537         * src/whoami.c (usage, main): Likewise.
538
539         Add bulletproofing for cases where stdin, stdout, or stderr are closed.
540         * src/comm.c: Include stdio-safer.h.
541         (compare_files): Exit right away on I/O error rather than continuing
542         and producing confusing output and error messages.
543         Return void, not int; all callers changed.
544         Use fopen_safer to avoid confusion with file descriptors.
545         * src/copy.c: Include unistd-safer.h.
546         (copy_reg): Use fd_safer.
547         * src/csplit.c: Include stdio-safer.h.
548         (input_desc): Remove unnecessary static initialization.
549         (set_input_file): Use STDIN_FILENO, not 0.
550         (create_output_file): Use fopen_safer.
551         * src/dircolors.c (dc_parse_file): Don't assume fopen does not
552         return stdin.
553         * src/head.c (head_file): Don't assume open does not return 0.
554         * src/join.c: Include stdio-safer.h.
555         (main): Use fopen_safer.  Simplify the resulting code.
556         * src/md5sum.c (digest_file, digest_check):
557         Don't assume that fopen does not return stdin.
558         * src/nohup.c: Include unistd-safer.h.
559         (main): Don't dup stderr to stdin or stdout by mistake.
560         * src/od.c (check_and_close): Don't assume fopen does not return stdin.
561         * src/paste.c (paste_serial): Likewise.
562         * src/pr.c: Include stdio-safer.h.
563         (open_file): Use fopen_safer.
564         (close_file): Don't assume fopen does not return stdin.
565         * src/ptx.c (main): Don't assume fopen returns stdout after closing
566         stdout.  Use freopen instead.
567         * src/shred.c: Include unistd-safer.h.
568         (wipename): Use fd_safer on directory file descriptor.
569         (wipefile): Remove special case for /dev/fd/* on older hosts.
570         It didn't work in general, and wasn't documented.
571         Use fd_safer.
572         * src/sort.c: Include unistd-safer.h.
573         (create_temp_file): Use fd_safer.
574         (xfclose): Don't assume fileno (stdin) == STDIN_FILENO, etc.
575         * src/split.c: Include unistd-safer.h.
576         (cwrite): Use fd_safer.  Replace mystery constant 0666 with symbolic
577         version, as POSIX requires.
578         * src/sum.c (bsd_sum_file, sysv_sym_file):
579         Use same pattern as elsewhere for checking for stdin.
580         * src/tac.c: Include unistd-safer.h.
581         (copy_to_temp): Use fd_safer.
582         (tac_file): Don't assume fopen cannot return stdin.
583         * src/tail.c: Include unistd-safer.h rather than fcntl-safer.h.
584         (recheck, tail_file): Use fd_safer rather than open_safer.
585         * src/tee.c: Include stdio-safer.h.
586         (tee): Use fopen_safer.
587         * src/touch.c: Include unistd-safer.h.
588         (touch): Use fd_safer.
589         * src/tsort.c (have_read_stdin): Remove; no longer needed.  All uses
590         removed.
591         (tsort): Do not assume fopen can't return stdin.
592         Close stdin before returning.  All uses changed.
593         * src/unexpand.c (next_file): Don't assume fopen cannot return stdin.
594         * src/uniq.c: Include stdio_safer.h.
595         (check_file): Don't assume fopen cannot return stdin or stdout.
596
597 2005-04-09  Jim Meyering  <jim@meyering.net>
598
599         * src/dd.c (quit): Define with ATTRIBUTE_NORETURN.
600
601         Now that close_stdout closes standard output unconditionally,
602         these workarounds for dd and cat are no longer necessary.
603         * src/dd.c (close_stdout_wrapper): Remove function.
604         (main): Call atexit with close_stdout, instead.
605         * src/cat.c (close_stdout_wrapper): Likewise.
606         Don't close STDOUT_FILENO explicitly; close_stdout does it.
607
608         * src/system.h (__attribute__): Readability nit:
609         Change this:
610         #  define __attribute__(x)
611         to this:
612         #  define __attribute__(x) /* empty */
613
614 2005-04-09  Jim Meyering  <jim@meyering.net>
615
616         * src/rm.c (usage): Mention that --recursive removes listed
617         directories too, not just their contents.
618         Say that by default, rm does not remove directories.
619
620         * src/pr.c: Don't include "timespec.h".  system.h does that.
621         * Makefile.maint (sc_system_h_headers): Propagate exit status
622         through trap.
623
624 2005-04-08  Paul Eggert  <eggert@cs.ucla.edu>
625
626         * NEWS: Document that dd no longer treats QUIT or PIPE specially,
627         and when conforming to POSIX no longer treats USR1 specially.
628         Document that dd no longer dumps core when handling signals.
629         * src/system.h (RETSIGTYPE): Remove; no longer needed.  All uses
630         replaced with void.
631         * src/csplit.c (SA_NOCLDSTOP): Define to 0 if not defined.
632         All uses changed.
633         (siginterrupt) [!HAVE_SIGINTERRUPT]: New macro.
634         (delete_all_files): New arg IN_SIGNAL_HANDLER, to avoid undefined
635         behavior when called from a signal handler.  All uses changed.
636         (main) [!defined SA_NOCLDSTOP]:
637         Use siginterrupt to specify that system calls should be interrupted.
638         * src/dd.c: Do not include safe-read.h or full-write.h; no longer needed.
639         (process_signals): Add forward decl.
640         (SA_NOCLDSTOP, sigprocmask, sigset_t) [!defined SA_NOCLDSTOP]:
641         New macros.
642         (siginterrupt) [! HAVE_SIGINTERRUPT]: New macro.
643         (SA_NODEFER) [!defined SA_NODEFER]: New macro.
644         (SA_RESETHAND) [!defined SA_RESETHAND]: New macro.
645         (caught_signals, interrupt_signal, info_signal_count, catch_siginfo):
646         New vars.
647         (usage): Mention -USR1 versus -INFO.
648         (cleanup): Don't invoke print_stats; the caller must do it now.
649         All callers changed.
650         (quit): Process signals just before exiting.
651         (interrupt_handler): Simply record the signal and return.
652         (siginfo_handler): Simply increment the signal counter and return.
653         (install_handler): Remove, replacing with:
654         (install_signal_handlers, process_signals, iread, iwrite):
655         New functions.  All callers to safe_read and full_write replaced
656         by iread and iwrite.  All callers to install_handler replaced by
657         install_handlers.
658         * src/ls.c (SA_NOCLDSTOP): Define to 0 if not defined.
659         All uses changed.
660         (siginterrupt) [! HAVE_SIGINTERRUPT]: New macro.
661         (main) [! SA_NOCLDSTOP]: Use it.
662         * src/shred.c: Remove all uses of signals; modern hosts have
663         /dev/random and don't need this gorp.
664         Do not include signal.h.
665         (env, sigill_handler, isaac_seed_machdep): Remove.  All uses removed.
666         * src/sort.c (SA_NOCLDSTOP): Define to 0 if not defined.
667         All uses changed.
668         (siginterrupt) [! HAVE_SIGINTERRUPT]: New macro.
669         (main) [! SA_NOCLDSTOP]: Use it.
670
671         * src/dd.c: Do not include inttostr.h, no longer needed.
672         (print_stats, main): Rewrite and simplify formats to use PRIuMAX
673         instead of umaxtostr.
674         (print_stats): Work even in languages that have special
675         forms for two of things, for r_truncate and w_bytes.  We can't
676         fix delta_s in this way, since ngettext doesn't support floating-point.
677         (main): Rewrite to avoid casts.
678
679 2005-04-07  Jim Meyering  <jim@meyering.net>
680
681         Placate gcc-4's -Wuninitialized.
682         * src/md5sum.c (digest_check) [lint]: Initialize hex_digest to NULL.
683         * src/test.c (binary_operator) [lint]: Initialize lt and rt to 0.
684
685         * src/test.c (is_int, age_of, binop): Declare `char *' parameters to
686         be `const'.
687         (binop): Move function definition to precede first use so we can...
688         (binop): ...remove prototype.
689
690 2005-04-05  Paul Eggert  <eggert@cs.ucla.edu>
691
692         * man/Makefile.am (.x.1): Remove "COMMAND.td/" from examples.
693         * src/basename.c (usage): Add examples.
694         * src/cat.c (usage): Likewise.
695         * src/chgrp.c (usage): Likewise.
696         * src/chown.c (usage): Likewise.
697         * src/dirname.c (usage): Likewise.
698
699 2005-04-05  Jim Meyering  <jim@meyering.net>
700
701         * src/nice.c (usage): Mention that some shells provide a
702         built-in function by the same name.
703         * src/nohup.c (usage): Likewise.
704         * src/printenv.c (usage):Likewise.
705
706 2005-04-04  Dmitry V. Levin  <ldv@altlinux.org>
707
708         * src/tee.c (tee): When closing files, do not close stdout,
709         leave this job to close_stdout() instead.
710         * configure.ac (AC_CONFIG_FILES): Add tests/tee/Makefile.
711         * tests/Makefile.am (SUBDIRS): Add tee.
712         * tests/tee/Makefile.am: New file.
713         * tests/tee/.cvsignore: Likewise.
714         * tests/tee/{basic,dash}: New tee tests.
715
716 2005-04-04  Jim Meyering  <jim@meyering.net>
717
718         * src/echo.c (usage): Mention that some shells provide a
719         built-in function by the same name.
720         * src/kill.c (usage): Likewise
721         * src/printf.c (usage): Likewise.
722         * src/pwd.c (usage): Likewise.
723         * src/stat.c (usage): Likewise.
724         * src/test.c (usage): Likewise.
725         * src/true.c (usage):
726         * src/system.h (USAGE_BUILTIN_WARNING): New macro.
727
728         * man/echo.x: Remove `DESCRIPTION' section, now that --help includes it.
729         * man/printf.x: Likewise.
730         * man/pwd.x: Likewise.
731
732 2005-04-03  Jim Meyering  <jim@meyering.net>
733
734         * src/pr.c (main): Fix off-by-one error.
735         pr -$(perl -e 'print "0"x63 . 1') would write one byte beyond the
736         end of a malloc'd buffer.
737
738 2005-04-01  Jim Meyering  <jim@meyering.net>
739
740         * src/pr.c (main): Free column_count_string when done with it.
741
742         Don't let pr treat +1:-1 like +1:18446744073709551615.
743         * src/pr.c (strtoumax): Remove declaration.
744         (first_last_page): Use xstrtoumax in place of strtoumax,
745         so we don't interpret a negative page number (e.g., in an option
746         like --pages=1:-1) as valid.
747         * tests/pr/Test.pm (neg-page): Add a test for this.
748
749 2005-03-30  Paul Eggert  <eggert@cs.ucla.edu>
750
751         * src/pinky.c (short_pinky): Adjust to read_utmp signature change.
752         * src/uptime.c (uptime): New arg OPTIONS.  All uses changed.
753         * src/users.c (users): Likewise.
754         * src/who.c (who): Likewise.
755         * src/uptime.c (main): Check PIDs when invoked with zero arguments.
756         * src/users.c (main): Likewise.
757         * src/who.c (main): Likewise.  Also with two arguments.
758         Omit duplicate code in 2-arg case.
759         (UT_PID): Moved to ../lib/readutmp.h.
760
761 2005-03-29  Jim Meyering  <jim@meyering.net>
762
763         * src/system.h (ptr_align): Declare `ptr' parameter to be a
764         `const' pointer, since this function never writes through it.
765
766         * src/uname.c: Indent cpp directives to reflect nesting.
767
768 2005-03-28  Jim Meyering  <jim@meyering.net>
769
770         * src/seq.c (get_width_format) [HAVE_RINT && HAVE_MODF && HAVE_FLOOR]:
771         Add `void' to make this an ANSI-style function declaration.
772         * src/remove.c (ds_init): Likewise.
773         * src/pr.c (print_sep_string): Likewise.
774
775         * src/stty.c (speeds): Declare this array to be static.
776         * src/Makefile.am (sc_tight_scope): Adjust to catch any
777         new declarations like that of stty.c's `speeds'.
778
779         * src/system.h (GETOPT_HELP_OPTION_DECL): Use NULL, not `0'.
780         (GETOPT_VERSION_OPTION_DECL): Likewise.
781         * src/chown.c (long_options): Likewise.
782         * src/chgrp.c (long_options): Likewise.
783         * src/chmod.c (long_options): Likewise.
784         * src/cp.c (sparse_type_string, reply_args, decode_preserve_arg):
785         Likewise.
786         * src/chown-core.c (chopt_init): Likewise.
787         * src/comm.c (long_options): Likewise.
788         * src/copy.c (copy_reg): Likewise.
789         * src/csplit.c (extract_regexp): Likewise.
790         * src/cut.c (longopts): Likewise.
791         * src/date.c (time_spec_string): Likewise.
792         * src/df.c (find_mount_point, show_point): Likewise.
793         * src/expr.c (docolon): Likewise.
794         * src/fmt.c (long_options): Likewise.
795         * src/ls.c (time_style_args, indicator_style_args, long_options)
796         (format_args, sort_args, time_args, decode_switches)
797         (gobble_file): Likewise.
798         * src/md5sum.c (long_options): Likewise.
799         * src/mv.c (reply_args): Likewise.
800         * src/paste.c (longopts): Likewise.
801         * src/pinky.c (print_entry): Likewise.
802         * src/pr.c (long_options): Likewise.
803         * src/ptx.c (long_options, format_args): Likewise.
804         * src/readlink.c (longopts): Likewise.
805         * src/sort.c (long_options, mergefps): Likewise.
806         * src/stat.c (long_options): Likewise.
807         * src/tac.c (main): Likewise.
808         * src/tail.c (follow_mode_string): Likewise.
809         * src/touch.c (longopts, time_args): Likewise.
810         * src/uniq.c (delimit_method_string): Likewise.
811         * src/uptime.c (print_uptime): Likewise.
812         * src/who.c (print_user): Likewise.
813
814 2005-03-27  Jim Meyering  <jim@meyering.net>
815
816         * src/dcgen: Simplify further, clean up.
817         Add a standard-output-closing global destructor.
818         Require perl-5.002.
819         * src/wheel-gen.pl: Use the same global destructor as dcgen.
820
821 2005-03-26  Paul Eggert  <eggert@cs.ucla.edu>
822
823         * src/dcgen: Squeeze multiple blanks into one.  Output a simple
824         array of adjacent strings rather than a more complicated data
825         structure; this saves space in the dircolors executable.
826         * src/dircolors.c (parse_line): Use char *, not unsigned char *.
827         This avoids casts.
828         (dc_parse_stream, main): Avoid casts.
829         Adjust to simpler data structure generated by new dcgen.
830
831 2005-03-25  Eric Blake  <ebb9@byu.net>  (tiny change)
832
833         * src/ls.c (usage): Document usage of LS_COLORS.
834
835 2005-03-25  Paul Eggert  <eggert@cs.ucla.edu>
836
837         * src/dircolors.hin: Add "TERM cygwin".
838
839 2005-03-25  Jim Meyering  <jim@meyering.net>
840
841         * src/system.h (DECIMAL_DIGIT_ACCUMULATE): Reverse the sense of
842         the return value, and update callers:
843         * src/cut.c (set_fields): Update use of DECIMAL_DIGIT_ACCUMULATE.
844         * src/expand.c (parse_tab_stops, main): Likewise.
845         * src/split.c (main): Likewise.
846         * src/unexpand.c (parse_tab_stops, main): Likewise.
847         * src/uniq.c (main): Likewise.
848
849 2005-03-22  Jim Meyering  <jim@meyering.net>
850
851         * build-aux: New directory.  Renamed from config.
852         * configure.ac: Reflect renaming: config -> build-aux.
853         * Makefile.am (dist-hook): Likewise.
854         * Makefile.maint: Likewise.
855         * Makefile.cfg (cvs_files): Likewise.
856         * .x-sc_sun_os_names: Likewise.
857         * .x-sc_trailing_blank: Likewise.
858
859         * src/ls.c (get_funky_string): Use '\a', rather than 7, for
860         portability to EBCDIC hosts.
861
862 2005-03-20  Jim Meyering  <jim@meyering.net>
863
864         * src/pr.c (init_header): Add missing `%' in new format string.
865         (init_header): Use zero-filled `.%09d' format, not space-filled `.%9d'.
866
867 2005-03-19  Jim Meyering  <jim@meyering.net>
868
869         * src/Makefile.am (pr_LDADD): Now that pr uses gettime, add
870         $(LIB_CLOCK_GETTIME) to get the required -lrt on newer Linux systems.
871
872 2005-03-18  Paul Eggert  <eggert@cs.ucla.edu>
873
874         * NEWS: pr -D "FORMAT" now accepts the same formats that
875         date +"FORMAT" does.
876         * src/pr.c: Include strftime.h, timespec.h.
877         (init_header): Obtain and format nanosecond part of time stamp.
878
879         * NEWS: nohup now ignores the umask when creating nohup.out.
880         nohup now closes stderr if it is a terminal and stdout is closed.
881         * src/nohup.c (main): Likewise.  Be a little more paranoid about
882         return values; e.g., check for any negative return from open.
883         Assume free (NULL) works.
884         Close file descriptor leak when redirecting standard output to a file.
885
886 2005-03-17  Jim Meyering  <jim@meyering.net>
887
888         * src/cut.c (set_fields): Use DECIMAL_DIGIT_ACCUMULATE macro,
889         in place of functionally-equivalent code.
890         * src/expand.c (parse_tab_stops, main): Likewise.
891         * src/split.c (main): Likewise.
892         * src/unexpand.c (parse_tab_stops, main): Likewise.
893         * src/uniq.c (main): Likewise.
894         * src/od.c: Use VERIFY macro in place of an equivalent open-coded
895         declaration.
896         * src/system.h (VERIFY, VERIFY_EXPR, DECIMAL_DIGIT_ACCUMULATE):
897         New macros.
898
899         Before, this command would make uniq skip 11 fields and print
900         only the first line:
901         $ _POSIX2_VERSION=1 ./uniq -f1 -1 <(seq --format='1 %g' 2)
902         1 1
903         1 2
904         * src/uniq.c (main): Interpret `uniq -f1 -1' like `uniq -f1',
905         not like `uniq -f11'.
906
907 2005-03-15  Jim Meyering  <jim@meyering.net>
908
909         Both `pr -0' and e.g., `pr -03' would evoke `column count too large'.
910         `pr -0' should give a better diagnostic and `pr -03' should be
911         equivalent to `pr -3'.
912         * src/pr.c (parse_column_count): Change return type to void.
913         Call error (EXIT_FAILURE, ... for an invalid string.
914         (main): Allocate space for column_count_string using malloc.
915         Accumulate all old-style column-count digits before converting.
916         When the number of columns is specified via both old-style,
917         (e.g., -3), and a long option (--columns=5), ensure that only
918         the last one specified takes effect.
919         * tests/pr/Test.pm: Add tests for the above.
920
921 2005-03-15  Corinna Vinschen  <corinna@vinschen.de>  (tiny change)
922
923         * src/copy.c (copy_reg): Copy regular files in binary mode.
924
925 2005-03-14  Paul Eggert  <eggert@cs.ucla.edu>
926
927         * NEWS: Restate why ls limits time stamp lengths.
928
929 2005-03-12  Jim Meyering  <jim@meyering.net>
930
931         Add a little infrastructure to help prevent future bugs like the
932         one fixed below.
933         * src/stat.c (xstrcat): New function.
934         (print_statfs, print_stat): Add buf_len parameter and convert all
935         uses of strcat to xstrcat.  Update callers.
936         (print_it): Call print_func with buf_len parameter.
937
938         Invoking stat -c FMT with a lone format directive of %s, %f, %h, %s,
939         could cause a buffer overrun error.
940         * src/stat.c (print_it): Allocate 2 more bytes, to accommodate our
941         conversion of the stat %s format string to the longer printf %llu one.
942         Patch from Guochun Shi.
943
944 2005-03-11  Paul Eggert  <eggert@cs.ucla.edu>
945
946         * src/ls.c (TIME_STAMP_LEN_MAXIMUM): New constant.
947         (long_time_expected_width, print_long_format): Use it, to avoid
948         some possible denial-of-service attacks.
949         * NEWS: Document this.
950
951 2005-03-11  Jim Meyering  <jim@meyering.net>
952
953         Prompt once again for `mv -i A B' when A and B are hard links
954         to the same file.  This fixes a bug introduced by my 2003-04-04
955         (coreutils-5.0.1) change.  Reported by Thomas Wolff via Eric Blake.
956         * src/copy.c (abandon_move): New function, factored out of
957         copy_internal, now that this code is being used from two places.
958         (copy_internal): Perform the same interactive-related test for
959         whether it's alright to proceed and (usually) overwrite the
960         destination file.
961         * tests/mv/i-4: Add tests for the above.
962
963         Don't segfault for a very long date format string, e.g.,
964         ls -ld --time-style=+%99999999H .
965         * src/ls.c (long_time_expected_width): Use x2nrealloc, not alloca,
966         so format string abuse cannot provoke stack overflow.
967         (print_long_format): Likewise.
968
969         Don't segfault for a long header date string, e.g.,
970         echo a|pr -D +%9999999A
971         * src/pr.c (init_header): Use x2nrealloc, rather than alloca.
972         Don't bother with fixed-sized initial buffer;  always use x*alloc.
973
974         * src/pr.c (init_header): Use slightly clearer INT_BUFSIZE_BOUND
975         in place of equivalent INT_STRLEN_BOUND + 1.
976         * src/expr.c (tostring, printv): Likewise.
977
978 2005-03-09  Paul Eggert  <eggert@cs.ucla.edu>
979
980         * src/system.h: Include intprops.h.
981         (TYPE_SIGNED, TYPE_MINIMUM, TYPE_MAXIMUM, INT_STRLEN_BOUND): Remove;
982         they are now defined in intprops.h.
983
984 2005-03-09  Jim Meyering  <jim@meyering.net>
985
986         * TODO: Remove entry about named pipes.  It was fixed in 5.3.0.
987
988 2005-03-08  Paul Eggert  <eggert@cs.ucla.edu>
989
990         * src/date.c (usage): Redo to match recent documentation changes.
991         Don't bother documenting which usages are GNU extensions; the list
992         wasn't correct, and is better left to the printed manual anyway.
993
994 2005-03-06  Jim Meyering  <jim@meyering.net>
995
996         Factor out column-count processing.
997         * src/pr.c: Include "inttostr.h".
998         (parse_column_count): New function.
999         (main): Use the new function for both old-style, -9, and long,
1000         --columns=-9, options.
1001
1002         * src/cksum.c: Remove `register' keyword.
1003         * src/cut.c: Likewise.
1004         * src/dd.c: Likewise.
1005         * src/env.c: Likewise.
1006         * src/factor.c: Likewise.
1007         * src/fmt.c: Likewise.
1008         * src/fold.c: Likewise.
1009         * src/id.c: Likewise.
1010         * src/logname.c: Likewise.
1011         * src/ls.c: Likewise.
1012         * src/pr.c: Likewise.
1013         * src/printf.c: Likewise.
1014         * src/shred.c: Likewise.
1015         * src/sort.c: Likewise.
1016         * src/sum.c: Likewise.
1017         * src/test.c: Likewise.
1018         * src/tsort.c: Likewise.
1019         * src/uniq.c: Likewise.
1020         * src/wc.c: Likewise.
1021         * src/whoami.c: Likewise.
1022
1023 2005-03-01  Paul Eggert  <eggert@cs.ucla.edu>
1024
1025         * src/Makefile.am (nanosec_libs): Remove $(LIB_XANOSLEEP); no
1026         longer needed.
1027
1028 2005-03-01  Jim Meyering  <jim@meyering.net>
1029
1030         * src/copy.c (copy_internal): Change test of source type from
1031         !S_ISREG to S_ISLNK.  Reported by Paul Eggert in
1032         http://lists.gnu.org/archive/html/bug-coreutils/2004-10/msg00050.html.
1033
1034 2005-02-28  Jim Meyering  <jim@meyering.net>
1035
1036         * NEWS: Mention that xnanosleep fixes sleep failure on linux-2.6.8.1.
1037
1038 2005-02-21  Paul Eggert  <eggert@cs.ucla.edu>
1039
1040         * src/Makefile.am (dd_LDADD, shred_LDADD): Add $(LIB_GETHRXTIME).
1041         (nanosec_libs): Add $(LIB_XNANOSLEEP).  Needed for newer GNU/Linux
1042         hosts with clock_gettime.
1043
1044 2005-02-20  Paul Eggert  <eggert@cs.ucla.edu>
1045
1046         * NEWS: Describe user-visible change to dd.
1047         * src/Makefile.am (dd_LDADD, shred_LDADD, nanosec_libs):
1048         Remove $(LIB_CLOCK_GETTIME).  These functions now use
1049         gethrxtime instead.
1050         * src/dd.c: Include gethrxtime.h, xtime.h.
1051         (start_time): Now of type xtime_t, not struct timespec.
1052         (print_stats, main): Use gethrxtime rather than gettime.
1053         * src/ls.c (time): Remove obsolete decl.
1054         (get_current_time): gettimeofday always returns 0, so don't
1055         check its result.
1056         * src/shred.c: Include gethrxtime.h.
1057         (isaac_seed): Use gethrxtime rather than a mishmash.
1058         * src/touch.c (time): Remove obsolete decl.
1059
1060         * tests/misc/split-fail: Don't assume that the current host
1061         supports integers wider than 32 bits.  Fix comment typo.
1062         * tests/od/x8: Likewise.
1063
1064         * src/chown-core.c (enum RCH_status): Remove trailing comma,
1065         as it's not valid in standard C89.
1066
1067 2005-02-15  Jim Meyering  <jim@meyering.net>
1068
1069         * src/stat.c (human_fstype): Add case/definition for S_MAGIC_XFS
1070         so that file systems of type `xfs' are recognized as such.
1071         * src/fs.h: Regenerate.
1072         Reported by Bernd Eckenfels.
1073         * src/stat.c (human_fstype): Likewise for S_MAGIC_JFS/jfs.
1074         * src/fs.h: Regenerate.
1075         Reported by Andreas Schwab.
1076
1077         * src/nice.c (NZERO) [NZERO == 0]: Undefine and define to 20,
1078         to work around the invalid definition from Darwin 7.7.0.
1079         Test failure reported by Sébastien Maret.
1080
1081 2005-02-14  Paul Eggert  <eggert@cs.ucla.edu>
1082
1083         * src/sort.c (mergefps): Use binary search rather than linear one
1084         when comparing new line to lines already in main memory.
1085         Idea suggested by James Lemley.
1086
1087 2005-02-09  Jim Meyering  <jim@meyering.net>
1088
1089         * src/copy.c (valid_options): Add an assertion that
1090         not both hard_link and symbolic_link are set.
1091
1092 2005-02-08  Paul Eggert  <eggert@cs.ucla.edu>
1093
1094         * NEWS: Document stat -f -c %S, plus changes to default formats.
1095         * doc/coreutils.texi (stat invocation): Normalize terminology,
1096         capitalization, and sort order to match --help output.  Mention %c
1097         for file systems.  Add new -f -c format %S, and document %s versus %S;
1098         problem reported by Jeroen van Wolffelaar.
1099         * src/stat.c (usage): Likewise.
1100         (STATFS_FRSIZE): New macro.
1101         (print_statfs): Use it, for stat -f -c %S.
1102         (do_statfs): Change default formats to output %S.
1103
1104 2005-02-03  Paul Eggert  <eggert@cs.ucla.edu>
1105
1106         * src/system.h: Include "memrchr.h".
1107         (memrchr) [!HAVE_DECL_MEMRCHR]: Remove decl.
1108
1109 2005-02-02  Jim Meyering  <jim@meyering.net>
1110
1111         * tests/du/8gb: Also adjust the test (s/64/128/) to detect
1112         systems that don't support sparse files.
1113         Check for $2 -ge 128, rather than $2 = 128, in case
1114         there is a file system type that doesn't support sparse files,
1115         yet for which metadata takes up additional space.
1116         Both reported by Andreas Schwab.
1117
1118 2005-02-01  Eric Blake  <ebb9@byu.net>  (tiny change)
1119
1120         * tests/du/8gb: Create a larger test file, so we properly
1121         detect that sparse files can be created on NTFS under cygwin.
1122
1123 2005-01-30  Jim Meyering  <jim@meyering.net>
1124
1125         * src/head.c (elide_tail_bytes_pipe): Correct wording in diagnostic.
1126
1127         * src/stty.c: Remove unnecessary parentheses in all #if directives.
1128
1129 2005-01-29  Eric Blake  <ebb9@byu.net>  (tiny change)
1130
1131         * .cvsignore: Ignore config.cache and config.status.lineno.
1132         * src/stty.c [VSWTCH]: Some systems, like Cygwin, use VSWTC
1133         instead of VSWTCH, for use with CSWTCH.
1134
1135 2005-01-29  Eric Blake  <ebb9@byu.net>  (tiny change)
1136
1137         * tests/Makefile.am (.PHONY): Add check-root and root-hint.
1138         * tests/rwx-to-mode: Ignore ACL designation.
1139         * tests/setgid-check: Likewise.
1140         * tests/chown/separator: Quote user and group names.
1141
1142 2005-01-24  Jim Meyering  <jim@meyering.net>
1143
1144         * src/cp.c (usage): Merge the descriptions of --no-dereference and -P.
1145         Suggestion from Johan Boule.
1146
1147 2005-01-17  Eric Blake  <ebb9@byu.net>  (tiny change)
1148
1149         * src/Makefile.am (all_programs.list): Strip $(EXEEXT) and remove
1150         duplicates.
1151         * man/Makefile.am (all_programs): Revert previous patch; updated
1152         all_programs.list fixes this.
1153         (.x.1): No need to add $(EXEEXT).
1154
1155 2005-01-03  Corinna Vinschen  <corinna@vinschen.de>  (tiny change)
1156
1157         * src/system.h: Use S_BLKSIZE value for ST_NBLOCKSIZE where
1158         available.
1159
1160 2005-01-22  Jim Meyering  <jim@meyering.net>
1161
1162         * Makefile.maint (v_etc_file): The version string has moved to
1163         version-etc-fsf.c, search that new file, not version-etc.c.
1164
1165 2005-01-17  Paul Eggert  <eggert@cs.ucla.edu>
1166
1167         * tests/group-names: Use numeric group ids, not symbolic group names,
1168         since the latter can have shell metacharacters in them (e.g., spaces).
1169         Problem reported by Eric Blake.
1170         * tests/chgrp/basic: Assume groups are numeric, not symbolic.
1171         * tests/chgrp/deref: Likewise.
1172         * tests/chgrp/posix-H: Likewise.
1173         * tests/chgrp/recurse: Likewise.
1174
1175 2005-01-15  Jim Meyering  <jim@meyering.net>
1176
1177         * src/shred.c (isaac_seed) [HAVE_GETHRTIME]: #if-0 this block,
1178         because just calling gethrtime evokes an `illegal instruction'
1179         failure when compiled with Sun's c89 on Solaris 8 and 9.
1180         Reported by Nelson Beebe.
1181
1182         * src/shred.c (isaac_seed) [HAVE_GETHRTIME]: Don't call ISAAC_SEED
1183         twice with the same value of `t'.
1184         Replace nested #if-#else blocks with #if-#elif-#elif chain.
1185
1186 2005-01-14  Jim Meyering  <jim@meyering.net>
1187
1188         The test, tests/tail/f-1, failed on powerpc-apple-darwin7.7.0.
1189         * src/tail.c (IS_TAILABLE_FILE_TYPE): Adjust definition also to include
1190         sockets, since that's what you get when reading from a command-line-
1191         supplied pipe on Darwin 7.7.
1192         (IS_PIPE_LIKE_FILE_TYPE): Define.
1193         (main): Use new IS_PIPE_LIKE_FILE_TYPE rather than simply S_ISFIFO.
1194         Reported by Nelson Beebe.
1195         This same change is also required on NetBSD/sparc-1.5.
1196         Reported by Adrian Bunk.
1197
1198         * src/expr.c (toarith): Rewrite to detect/diagnose integer overflow,
1199         rather than suffering silently.
1200         Before, expr would silently overflow and wrap around:
1201           $ expr 9223372036854775808 = 0   # $(echo 2^63|bc)
1202           1
1203         Now it detects the problem and exits nonzero:
1204           $ ./expr $(echo 2^63|bc) = 0
1205           ./expr: 9223372036854775808: integer is too large
1206
1207         * tests/chown/separator (id_gn): Exit 77, not 1, for a test-framework
1208         failure, so that doesn't cause `make check' to stop.  Nelson Beebe
1209         reported that this test would fail with the diagnostic,
1210         `cannot find name for group ID 10', on one of his systems.
1211
1212 2005-01-13  Jim Meyering  <jim@meyering.net>
1213
1214         * src/test.c (is_int): Don't overflow when evaluating integer
1215         constants.  Before, ./test $(echo 2^64|bc) -eq 0 && echo FAIL
1216         would print `FAIL'.
1217
1218         * tests/Fetish.pm (run_tests): Add code (if-0'd out) to detect
1219         names of temporary files that would clash on 8.3 file systems.
1220         * tests/mk-script (validate): Likewise.
1221
1222 2005-01-12  Jim Meyering  <jim@meyering.net>
1223
1224         * tests/dd/skip-seek: Shorten test names to accommodate 8.3 systems.
1225
1226         * tests/tr/Test.pm (repeat-xC): Change test name from
1227         `repeat-Compl', to avoid 8.3 conflict with `repeat-compl'.
1228         Reported by Eric Blake.
1229         (repeat-000): Rename to `repeat-zeros' for the same reason.
1230
1231 2005-01-11  Jim Meyering  <jim@meyering.net>
1232
1233         * configure.ac: Update version to 5.3.1.
1234
1235 2005-01-11  Eric Blake  <ebb9@byu.net>
1236
1237         * src/Makefile.am (check-README, check-AUTHORS): Account for $(EXEEXT).
1238         * man/Makefile.am (all_programs): Account for $(EXEEXT).
1239
1240 2005-01-11  Jim Meyering  <jim@meyering.net>
1241
1242         * src/unexpand.c (add_tab_stop): Properly diagnose a tabstop list
1243         with decreasing values.
1244
1245         * src/expand.c (main): Likewise.
1246         * src/unexpand.c (main): Check for overflow in tabstop values
1247         specified via the obsolete form.  E.g., now this command fails:
1248         _POSIX2_VERSION=1 ./unexpand -$(echo '2^64+1'|bc)
1249         Before it would act like `_POSIX2_VERSION=1 ./unexpand -1'.
1250         * tests/unexpand/basic-1 (obs-ovflo): New test for this.
1251
1252 2005-01-10  Paul Eggert  <eggert@cs.ucla.edu>
1253
1254         Respond to POSIX interpretations about pathchk -p dated 2005-01-06.
1255         * NEWS: Document the changes.
1256         * doc/coreutils.texi (pathchk invocation): Likewise.
1257         * src/pathchk.c (PORTABILITY_OPTION): New constant.
1258         (longopts, usage, main, validate_file_name):
1259         Add support for new -P option.
1260         Reject empty file names (unless -p is not specified and the
1261         current system allows empty file names).
1262         Change --portability so that is now equivalent to -p -P.
1263         Don't test whether file name is too long, if it is known to exist.
1264         (no_leading_hyphen): New function.
1265         * tests/misc/pathchk1: Add tests for empty file names and
1266         pathchk -P.
1267
1268 2005-01-08  Jim Meyering  <jim@meyering.net>
1269
1270         * Version 5.3.0.
1271
1272         `pr --columns=N' was not equivalent to `pr -N' when also using
1273         either -s or -w.
1274
1275         * src/pr.c (main): Set `explicit_columns' for --columns=N,
1276         not just for -N.  This bug has existed since the introduction
1277         of the --columns=N option on 1998-08-15.
1278         * NEWS: Document this.
1279         * tests/pr/Test.pm (test_vector): For each -N test, automatically
1280         create a new test vector using --columns=N.
1281
1282 2005-01-07  Paul Eggert  <eggert@twinsun.com>
1283
1284         * src/pr.c (main): Check for column count overflow with
1285         usages like "pr -2147483648".
1286
1287 2005-01-07  Jim Meyering  <jim@meyering.net>
1288
1289         * src/pr.c (init_fps): Use xnmalloc, rather than xmalloc.
1290
1291 2005-01-06  Jim Meyering  <jim@meyering.net>
1292
1293         * README: List the precise HP-UX version numbers that are affected.
1294         Suggestion from Bob Proulx.
1295
1296         * Makefile.maint (sc_changelog): Specify find's `-maxdepth 2'
1297         predicate before `-name ChangeLog' to avoid a harmless warning
1298         from find-4.2.10.
1299
1300 2005-01-05  Jim Meyering  <jim@meyering.net>
1301
1302         * tests/help-version: Punt on the uptime test, since it fails when
1303         it can't get boot time, and I don't want that to stop `make check'.
1304
1305         * src/du.c (process_file): Evaluate exclusion rules against
1306         the entire file name, not just the last component.
1307         Reported by Robert Lindgren.
1308         * tests/du/exclude: Test for this.
1309         * NEWS: Document this.
1310
1311         Ensure that tests/Makefile.am's check-root actions stay up to date.
1312         * Makefile.maint (sc_root_tests): New rule.
1313         (syntax-check-rules): Add it to the list.
1314
1315 2005-01-04  Jim Meyering  <jim@meyering.net>
1316
1317         * man/shred.x: Change one-line summary to reflect that shred does
1318         not remove files by default.  Suggestion from Helen Faulkner in
1319         http://bugs.debian.org/288552
1320
1321         * README: Request VERBOSE=yes output when reporting test failures.
1322         Other minor changes.
1323
1324         * tests/Makefile.am (check-root): Update.
1325
1326 2005-01-03  Paul Eggert  <eggert@cs.ucla.edu>
1327
1328         * src/system.h: Undo previous change; we now use Autoconf.
1329
1330 2005-01-03  Jim Meyering  <jim@meyering.net>
1331
1332         * tests/stty/row-col-1: Don't set rows or columns to zero, to avoid
1333         a bug in the TIOCGWINSZ ioctl on at least Solaris5.9 systems.  Setting
1334         either (or both) to zero would succeed, but subsequent `stty size'
1335         would say `no size information for this device' due to the ioctl
1336         failing with EINVAL.
1337
1338         * src/system.h: If PRIdMAX, PRIoMAX, PRIuMAX, and PRIxMAX are
1339         not all defined and either ULONG_MAX or ULLONG_MAX is not defined,
1340         then fail at compile-time rather than let tools like od produce
1341         invalid results at run time.
1342
1343 2004-12-21  Jim Meyering  <jim@meyering.net>
1344
1345         * src/csplit.c (usage): Say the default names are `xx00, xx01, ...',
1346         not `xx01, xx02, ...'.
1347         Reported by Matt Kraai in http://bugs.debian.org/286605
1348
1349         * tests/misc/split-fail: Avoid spurious failure on x86 Solaris5.9
1350         when using c89.
1351
1352 2004-12-20  Paul Eggert  <eggert@cs.ucla.edu>
1353
1354         * src/split.c (usage): Mention default size.  Suggested by Dan Jacobson.
1355
1356 2004-12-19  Paul Eggert  <eggert@cs.ucla.edu>
1357
1358         * NEWS: Mention that one should eval "`dircolors`" rather than
1359         `dircolors`.
1360
1361 2004-12-17  Jim Meyering  <jim@meyering.net>
1362
1363         * tests/mv/hard-link-1: Rearrange to use newer trap-handling code,
1364         so temporary directories aren't left behind upon e.g., interrupt.
1365
1366 2004-12-16  Paul Eggert  <eggert@cs.ucla.edu>
1367
1368         * src/ls.c (print_dir): Use "%s: not listing already-listed
1369         directory", not "not listing already-listed directory: %s", to
1370         format already-listed directories, to be consistent with other
1371         diagnostics involving file names and colons.
1372
1373 2004-12-15  Jim Meyering  <jim@meyering.net>
1374
1375         * src/Makefile.am (__LDADD): Define, so that building `[' on
1376         Solaris still uses the -lgen library that it requires in order
1377         to get a definition of eaccess.
1378
1379 2004-12-14  Jim Meyering  <jim@meyering.net>
1380
1381         tac would exit immediately upon I/O or temp-file creation failure.
1382         Now it continues on, processing any remaining command line arguments.
1383
1384         * src/tac.c: Include quotearg.h.
1385         Use quotearg_colon in most diagnostics.
1386         (copy_to_temp): Rewrite not to exit upon I/O or temp-file-creation
1387         failure.  Before, this command (with /full/tmp being a full partition)
1388           TMPDIR=/full/tmp ./tac /proc/modules tac.c
1389         would exit immediately upon the write error while trying to copy
1390         non-seekable /proc/modules to the full partition.  Now it still
1391         reports the failure but continues on with the remaining file.
1392         (tac_nonseekable): Return false also if copy_to_temp fails.
1393         [DONT_UNLINK_WHILE_OPEN]: Add a FIXME comment explaining that
1394         using atexit like this is wrong.
1395         * NEWS: Document this.
1396         * tests/misc/tac-continue: New test for this.
1397         * tests/misc/Makefile.am (TESTS): Add tac-continue.
1398
1399         * tests/chown/basic: Add a few more tests.
1400
1401 2004-12-13  Paul Eggert  <eggert@cs.ucla.edu>
1402
1403         * src/ls.c (gobble_file): Change arg name to be command_line_arg
1404         rather than explicit_arg, for consistency with copy.c.
1405         (extract_dirs_from_files): Remove ignore_dot_and_dot_dot arg, since
1406         it is deducible from dirname arg.  All callers changed.
1407         (extract_dirs_from_files, print_dir, queue_directory):
1408         Add command_line_arg arg.  All callers changed.
1409         (struct pending): Add command_line_arg member.
1410         (main): Use NULL rather than 0 when appropriate.
1411         (set_exit_status, file_failure): New functions.
1412         (queue_directory): Store command_line_arg into new structure.
1413         (print_dir, gobble_file, get_link_name):
1414         Use file_failure to report problems in accessing files,
1415         so that the exit status is set consistently.
1416         (print_dir): Simplify readdir failure code yet again.
1417         If closedir fails, report "closing directory" rather than "reading
1418         directory" failure.
1419         (xstrcoll): Use set_exit_status to set status on failure.
1420         * tests/ls-2/tests (no-a-isdir-b): This now exits with status 2,
1421         not status 1.
1422
1423 2004-12-11  Jim Meyering  <jim@meyering.net>
1424
1425         Avoid a race condition vulnerability in chown, when used with
1426         --from=O:G and without the (-h) --no-dereference option.
1427         * src/chown-core.c (restricted_chown): New function.
1428         (change_file_owner): Call it.
1429         Reported by Ulrich Drepper.
1430         * NEWS: Mention this.
1431
1432 2004-12-09  Paul Eggert  <eggert@cs.ucla.edu>
1433
1434         * ls now exits with status 1 on minor problems, 2 if serious trouble.
1435         * NEWS: Document this.
1436         * src/ls.c (LS_MINOR_PROBLEM, LS_FAILURE): New constants.
1437         All uses of EXIT_FAILURE replaced with LS_FAILURE, unless
1438         specified below.
1439         (main): Initialize exit failure to LS_FAILURE.
1440         (print_dir, gobble_file, get_link_name, xstrcoll):
1441         Set exit status to LS_MINOR_PROBLEM if the failure is minor.
1442         (print_dir): Do not give up on entire directory merely because readdir
1443         returns EOVERFLOW.
1444         (usage): Explain exit status.
1445         * tests/help-version: ls and variants now exit with status 2
1446         on serious trouble.
1447
1448 2004-12-08  Paul Eggert  <eggert@cs.ucla.edu>
1449
1450         * NEWS: Document new UTC+HH:MM date syntax, and put date changes
1451         together.
1452
1453 2004-12-07  Paul Eggert  <eggert@cs.ucla.edu>
1454
1455         * src/factor.c (factor): Don't list 1 as a factor of 1.
1456         Problem reported by Thomas Folz-Donahue.
1457
1458 2004-12-06  Jim Meyering  <jim@meyering.net>
1459
1460         * tests/du/files0-from: Sanitize environment.
1461         Otherwise, e.g., BLOCKSIZE=k would cause a failure, and that
1462         setting is the default (exported from /etc/profile) on at least one
1463         NetBSD 1.6 system.
1464         * tests/du/no-deref: Likewise.
1465         * tests/cp/symlink-slash: Likewise.
1466         * tests/ls/symlink-slash: Likewise
1467
1468 2004-12-05  Jim Meyering  <jim@meyering.net>
1469
1470         * tests/tail/Test.pm (err-6) ["tail -c"]: Avoid test failure when
1471         _POSIX2_VERSION=199209 is in the environment, or when building on
1472         e.g., OpenBSD 3.2.
1473
1474 2004-12-04  Jim Meyering  <jim@meyering.net>
1475
1476         * NEWS: Mention cut's new --complement option.
1477
1478 2004-10-01  Paolo Bonzini  <bonzini@gnu.org>
1479
1480         * cut.c (complement, COMPLEMENT_OPTION): New.
1481         (longopts): Add --complement.
1482         (usage): Say not that -b, -c, and -f `print' fields,
1483         but rather that they `select' fields for printing.
1484         Describe the new --complement option.
1485         (mark_range_start): Extracted from set_fields.
1486         (print_kth): Support --complement.
1487         (compare_ranges): New function.
1488         (set_fields): Rewrite the part that populates range_start_ht,
1489         merging it with the part that populates printable_field.
1490         (main): Handle --complement.
1491
1492 2004-12-03  Paul Eggert  <eggert@cs.ucla.edu>
1493
1494         * src/tail.c (tail_file): Set errnum to -1 if the initial "tail"
1495         failed.  This works around an assertion failure reported by
1496         Roberto Nibali in:
1497         http://lists.gnu.org/archive/html/bug-coreutils/2004-12/msg00012.html
1498
1499 2004-12-02  Jim Meyering  <jim@meyering.net>
1500
1501         With using --color and with LS_COLORS saying not to color
1502         executables, don't stat every file.
1503         * src/ls.c (is_colored): New function.
1504         (gobble_file): Use it.
1505         (main): Use it here, in place of too-strict tests against NULL:
1506         if either ORPHAN or MISSING was set to 0 from LS_COLORS, the
1507         old test would fail.
1508
1509 2004-12-01  Paul Eggert  <eggert@cs.ucla.edu>
1510
1511         * src/comm.c (compare_files): Assume setlocale exists.
1512         * src/join.c (keycmp): Likewise.
1513         * src/seq.c (decimal_point): Treat like sort.  Now char.
1514         All uses changed.
1515         (main): Assume localeconv exists.  Use same code as sort.
1516         * src/sort.c (C_DECIMAL_POINT): Remove.  Use changed to '.'.
1517         Assume setlocale exists.
1518         (thousands_sep): Renamed from th_sep.
1519         (IS_THOUSANDS_SEP): Remove.  All uses replaced by comparisons.
1520         (NONZERO): Parenthesize use of arg.
1521         (numcompare): Avoid duplicate loads.  Use ISDIGIT as boolean, for
1522         consistency.  Avoid unnecessary negation by reversing
1523         fraccompare args.
1524         (main): Rewrite localeconv call to match seq.c.
1525         * src/system.h: Assume locale.h exists.
1526         (HAVE_SETLOCALE): Remove.
1527         * src/uniq.c (different): Assume setlocale exists.
1528
1529         * src/ls.c (sort_files): Minor cleanup.  Remove an unnecessary
1530         'volatile' on a local variable.  Rewrite to avoid unnecessary
1531         double-assignment to 'func' in the usual case where strcoll does
1532         not fail.
1533
1534 2004-11-30  Paul Eggert  <eggert@cs.ucla.edu>
1535
1536         * src/pinky.c (gethostname): Remove decl.
1537         (scan_entries): Use IS_USER_PROCESS instead of by-hand code.
1538         * src/uptime.c (print_uptime): Use IS_USER_PROCESS and
1539         UT_TYPE_BOOT_TIME instead of by-hand code.
1540         * src/users.c (list_entries_users): Use IS_USER_PROCESS
1541         instead of by-hand code.
1542         * src/who.c (USER_PROCESS, RUN_LVL, INIT_PROCESS, LOGIN_PROCESS,
1543         DEAD_PROCESS, BOOT_TIME, NEW_TIME, UT_TYPE_UNDEF, UT_TYPE): Remove.
1544         (IS_USER_PROCESS): Move to ../lib/readutmp.h.
1545         (UT_TYPE_RUN_LVL, UT_TYPE_INIT_PROCESS, UT_TYPE_LOGIN_PROCESS,
1546         UT_TYPE_DEAD_PROCESS, UT_TYPE_NEW_TIME): New macros.
1547         (gethostname): Remove decl.
1548         (list_entries_who, scan_entries): Use the new macros defined above,
1549         for consistency with pinky, uptime, and users.
1550
1551 2004-11-25  Paul Eggert  <eggert@cs.ucla.edu>
1552
1553         Fix problem reported by Scott S. Tinsley for HP-UX 11.11 using
1554         HP's ANSI C compiler.  Declaring int functions causes warnings on
1555         some modern systems and shouldn't be needed to compile on ancient
1556         ones.
1557         * src/copy.h (stat, lstat, rename): Remove decls.
1558         * src/install.c (stat): Remove decl.
1559         * src/ln.c (link, symlink): Remove decls.
1560
1561 2004-11-25  Jim Meyering  <jim@meyering.net>
1562
1563         * man/help2man: Import help2man-1.35.1.
1564         * man/Makefile.am (.x.1): Remove now-unnecessary use of
1565         locally-added --program-name=NAME option.  Now, help2man gets
1566         the name from the [NAME] section (i.e. from our .x file).
1567         * man/install.x: Use `install', not `ginstall' in the one-line
1568         description.  Reported by Brendan O'Dea.
1569         * man/sha1sum.x: Use `sha1sum', not `shasum'.
1570
1571 2004-11-24  Jim Meyering  <jim@meyering.net>
1572
1573         Since the changes of 2004-05-22, the u.saved_cwd member at
1574         the bottom of the active-directory stack was no longer
1575         strictly necessary.  This change removes that member and uses
1576         the newer cwd_state parameter for the final restore_cwd.
1577
1578         * src/remove.c (struct AD_ent) [u]: Remove now-unnecessary union.
1579         [dev_ino]: Rename from `a'.
1580         (AD_pop_and_chdir): Add a parameter to play the role of just-removed
1581         bottom-of-stack cwd-state member.
1582         (AD_pop_and_chdir): No longer return boolean.  Adjust caller.
1583         (AD_push_initial): Remove CWD parameter.  Adjust caller.
1584
1585 2004-11-23  Paul Eggert  <eggert@cs.ucla.edu>
1586
1587         Minor performance improvements and cleanups for "touch".
1588         * src/touch.c (posix_date): Remove; not needed as a static var.
1589         All uses rewritten.
1590         (touch): Use new futimens function to operate more efficiently
1591         in some cases.  Don't stat/fstat existing file when
1592         (!amtime_now && change_times == (CH_ATIME | CH_MTIME)); the
1593         old time stamps aren't needed in that case.
1594         (main): change_times is int, not bool.  Simplify test for
1595         change_times.
1596
1597 2004-11-20  Paul Eggert  <eggert@cs.ucla.edu>
1598
1599         * src/install.c (usage): Avoid usage that runs afoul of Docbook
1600         translation.  Problem reported by Eric S. Raymond.
1601
1602         Restore dd's noctty flag, reverting the change of 2004-04-08.
1603         POSIX does not allow "dd" to use O_NOCTTY by default.
1604         * NEWS: Add noctty flag to dd.
1605         * doc/coreutils.texi (dd invocation): Likewise.
1606         * src/dd.c (flags, usage, main): Likewise.
1607
1608 2004-11-19  Alfred M. Szmidt  <ams@gnu.org>
1609
1610         * src/ls.c (usage): Clarified description of --no-group (-G),
1611         --human-readable (-h), --inode (-i), --size (-s), --time,
1612         and --time-style.
1613
1614 2004-11-19  Jim Meyering  <jim@meyering.net>
1615
1616         * src/ls.c (usage): Clarify description of --author.
1617         Tweak indentation so that help2man creates better nroff.
1618         Reported by Dan Jacobson.
1619
1620         * src/uniq.c (check_file): Don't check stdout for errors here.
1621
1622         * src/pwd.c (find_dir_entry): Update comment to match reality.
1623
1624 2004-11-18  Jim Meyering  <jim@meyering.net>
1625
1626         * src/pwd.c (robust_getcwd): Correct the comment: this function
1627         constructs the directory name.  The caller prints it.
1628
1629 2004-11-16  Paul Eggert  <eggert@cs.ucla.edu>
1630
1631         * src/stat.c (STATFS): New macro, for portability to Solaris 9.
1632         (do_statfs): Use it.
1633
1634         * src/basename.c, src/chroot.c, src/cksum.c, src/dd.c, src/dirname.c,
1635         src/factor.c, src/hostid.c, src/hostname.c, src/link.c, src/logname.c,
1636         src/nohup.c, src/printenv.c, src/pwd.c, src/setuidgid.c, src/sleep.c,
1637         src/sync.c, src/tsort.c, src/unlink.c, src/uptime.c, src/users.c,
1638         src/whoami.c, src/yes.c (main): Use getopt_long rather than getopt.
1639         * src/readlink.c (main): argv is not const.
1640
1641         * src/cut.c (usage): Improve documentation along the lines suggested
1642         by Debian 5.2.1-2.
1643         * src/echo.c (usage): Likewise.
1644         * src/expr.c (usage): Likewise.
1645
1646         * src/dircolors.hin: Add putty, screen-bce.
1647
1648         * src/pinky.c (print_entry): Fix memory leak.
1649         * src/who.c (print_user): Likewise.
1650
1651 2004-11-15  Paul Eggert  <eggert@cs.ucla.edu>
1652
1653         * NEWS: New dd operand "status=noxfer".
1654         * src/dd.c (C_ASCII, C_EBCDIC, C_IBM, C_BLOCK, C_UNBLOCK,
1655         C_LCASE, C_UCASE, C_SWAB, C_NOERROR, C_NOTRUNC, C_SYNC, C_TWOBUFS,
1656         C_NOCREAT, C_EXCL, C_FDATASYNC, C_FSYNC): Now constants, not
1657         macros.
1658         (STATUS_NOXFER, statuses): New constants.
1659         (usage, print_stats, scanargs): Add support for status=noxfer.
1660         (usage): Update status output to match new behavior.
1661         (print_stats): Always output complete byte count.
1662         Put space between numbers and units, as SI requires.
1663         Use ngettext so that i18n can use plurals for "byte" and "second".
1664         Don't multiply by 1e-9 (inexact); divide by 1e9 (which is exact).
1665         (iflag_error_msgid, oflag_error_msgid): Remove; replace uses by
1666         the string.
1667         * tests/dd/skip-seek (@Tests): Use status=noxfer to avoid
1668         problems with regression testing.
1669
1670 2004-11-14  Paul Eggert  <eggert@cs.ucla.edu>
1671
1672         * NEWS: dd now outputs total bytes, seconds, and bytes per second.
1673         * src/Makefile.am (dd_LDADD): Add $(LIB_CLOCK_GETTIME).
1674         * src/dd.c: Include "human.h".
1675         (w_bytes, start_time): New vars.
1676         (usage): Document new I/O statistics output
1677         (print_stats): Output new I/O statistics.
1678         (cleanup): Do statistics after closing stdin and stdout, so that
1679         the times are more accurate.
1680         (write_output, dd_copy): Count output bytes.
1681         (main): Get initial value of clock.
1682
1683 2004-11-14  Jim Meyering  <jim@meyering.net>
1684
1685         Backslash-escape `-'s in email addresses, so that they are
1686         rendered properly in UTF-locales.
1687         * man/help2man (escape_hyphens): New function.
1688         (main): Call it on email addresses.
1689
1690         * src/sort.c (zaptemp): Mark new diagnostic for translation.
1691
1692         * tests/misc/close-stdout: New file.  Test today's closeout.c change.
1693         * tests/misc/Makefile.am (TESTS): Add close-stdout.
1694
1695 2004-11-13  Jim Meyering  <jim@meyering.net>
1696
1697         * src/test.c (usage): Put the description of `[-n] STRING'
1698         on two lines, one for `-n STRING' and one for `STRING' so that
1699         help2man properly escapes the `-'.  Otherwise, the hyphen is
1700         rendered inappropriately in UTF-8 locales.
1701         Reported by Uwe Zeisberger in http://bugs.debian.org/281069.
1702
1703 2004-11-12  Paul Eggert  <eggert@cs.ucla.edu>
1704
1705         * NEWS: Document the following changes.
1706
1707         * src/sort.c: Avoid O(N**2) behavior when there are many temporary
1708         files.
1709         (temptail): New variable, so that we can easily append to list.
1710         (create_temp_file): Create new files at end of list, so that
1711         searching the list has O(N*NMERGE) behavior instead of O(N**2).
1712         (zaptemp): Update temptail if needed.
1713         (mergefps, merge): Accept new arg that counts temp files, and keep it
1714         up to date as we create and remove temporaries.  This is for
1715         efficiency, so that we don't call zaptemp so often.
1716         All callers changed.
1717         (sort): Don't create array in reverse order, since the list of
1718         temporaries is now in the correct order.
1719
1720         (zaptemp): Protect against race condition: if 'sort' is
1721         interrupted in the middle of zaptemp, it might unlink the
1722         temporary file twice, and the second time this happens the file
1723         might already have been created by some other process.
1724
1725         (zaptemp): Warn if a temporary file is not removed.
1726
1727         (create_temp_file): Use offsetof for clarity.
1728         (die): Move it up earlier, to clean up the code a bit.
1729
1730         * src/pr.c (strtoumax): Declare if not declared.
1731         (skip_to_page, first_page_number, last_page_number, page_number,
1732         first_last_page, print_header):
1733         Use uintmax_t for page numbers.
1734         (first_last_page): Remove unnecessary forward declaration.
1735         Do not modify arg (it is now a const pointer).
1736         Return a true if successful, false (without print a diagnostic)
1737         otherwise.
1738         (main): If +XXX does not specify a valid page range, treat it
1739         as a file name.  This follows the response to Open Group XCU ERN 41
1740         <http://www.opengroup.org/sophocles/show_mail.tpl?source=L&listname=austin-group-l&id=7717>,
1741         which says the behavior is allowed.
1742         (skip_to_page): When starting page number exceeds page count,
1743         print both numbers in the diagnostic.
1744         (print_header): Detect page number overflow.
1745
1746 2004-11-07  Jim Meyering  <jim@meyering.net>
1747
1748         * src/uname.c [__APPLE__]: Include <mach/machine.h> and <mach-o/arch.h>.
1749         (main) [__APPLE__]: Get the processor type via syscall rather than
1750         hard-coding "powerpc".  From Toby Peterson.
1751
1752         * src/sort.c (merge): Remove declarations of now-unused variables.
1753
1754 2004-11-06  Paul Eggert  <eggert@cs.ucla.edu>
1755
1756         * src/sort.c (first_same_file): Remove.  Move most of the code to....
1757         (avoid_trashing_input): New function.
1758         (merge): Avoid some silly merges, e.g., copying a single file to
1759         a temporary file when there are exactly 17 input files to merge.
1760         Take a count of temporary files rather than a max_merge arg.
1761         All uses changed.
1762
1763 2004-11-06  Jim Meyering  <jim@meyering.net>
1764
1765         * src/sort.c (xfclose): Don't close stdout here (just flush it),
1766         since close_stdout now closes stdout unconditionally.
1767
1768 2004-11-05  Paul Eggert  <eggert@cs.ucla.edu>
1769
1770         * src/sort.c (inittables, sort_buffer_size, getmonth, mergefps,
1771         first_same_file, merge, sort, main): Use size_t for indexes to arrays.
1772         This fixes some unlikely havoc-wreaking bugs (e.g., more than INT_MAX
1773         temporary files).
1774         (getmonth, keycompare, compare): Rewrite to avoid need for alloca,
1775         thus avoiding unchecked stack overflow in some cases.  As a side
1776         effect this improve the performance of "sort -M" by a factor of 4
1777         on my benchmarks.
1778
1779 2004-11-03  Paul Eggert  <eggert@cs.ucla.edu>
1780
1781         * src/stty.c: Include "vasprintf.h" since we use vasprintf now.
1782
1783         * src/Makefile.am (check-AUTHORS): Don't assume \? works in a sed
1784         expression; it's not portable.  Problem reported by Albert Chin.
1785         Don't invoke a program more than once.
1786         * src/groups.sh (version): New variable, containing author info,
1787         for benefit of AUTHORS check.  Use it when acting on --version option.
1788         * AUTHORS: Remove duplicate lines.  Remove bogus "chroot:"
1789         in groups line.
1790
1791         * src/system.h: Don't #define and #undef getopt around <stdlib.h>,
1792         as this breaks the new regime that does "#define getopt rpl_getopt".
1793         Problem reported by Albert Chin for Solaris 9 with Sun cc in:
1794         http://lists.gnu.org/archive/html/bug-gnulib/2004-11/msg00019.html
1795         I suppose this may cause problems on ancient hosts with
1796         incompatible getopt declarations, but we'll cross that bridge if
1797         the problem gets reported to us by someone who can test the fix.
1798
1799 2004-11-03  Jim Meyering  <jim@meyering.net>
1800
1801         * src/tac.c: quote(...) file names in diagnostics.
1802
1803 2004-10-29  Paul Eggert  <eggert@cs.ucla.edu>
1804
1805         * NEWS: Document getdate changes.
1806
1807 2004-10-29  Jim Meyering  <jim@meyering.net>
1808
1809         * src/tac.c (tac_file): Remove temporary prototype and move this
1810         function `down' so that it precedes definition of tac_nonseekable.
1811
1812         `tac /proc/modules' would print nothing
1813         Reported by Harald Dunkel in http://bugs.debian.org/278604.
1814
1815         * src/tac.c (copy_to_temp): Renamed from save_stdin, since
1816         now it copies a general file descriptor, not just stdin.
1817         (tac_nonseekable): Renamed/adapted from tac_stdin.
1818         (tac_file): Get fd via `open' directly rather than via fopen/fileno,
1819         since we never used the stream.  Perform "-" to stdin mapping here
1820         rather than in main.  Determine whether a file is seekable,
1821         by trying to `lseek' to its end, and dispatch to tac_seekable or
1822         tac_nonseekable accordingly.
1823         (main): Rewrite argument handling now that it uses only tac_file.
1824         * NEWS: Mention it here.
1825
1826 2004-10-21  Jim Meyering  <jim@meyering.net>
1827
1828         * tests/mv/leak-fd: New file.
1829         * tests/mv/Makefile.am (TESTS): Add it.
1830         * tests/rm/dot-rel: New file.
1831         * tests/rm/Makefile.am (TESTS): Add it.
1832
1833         Correct my patch of 2004-10-18.
1834         * src/remove.c (rm): Destroy the saved_cwd here (via cwd_state),
1835         if necessary, not in remove_dir.  Otherwise, removing multiple
1836         `.'-relative nonempty directories no longer worked.
1837
1838 2004-10-20  Paul Eggert  <eggert@cs.ucla.edu>
1839
1840         * src/fmt.c (usage): Improve description of --prefix.
1841         Problem reported by Edward Welbourne.
1842
1843         * man/uniq.x: Change summary so that it doesn't imply that
1844         uniq writes to its input file.  Problem reported by
1845         Dan Jacobson.
1846
1847 2004-10-18  Jim Meyering  <jim@meyering.net>
1848
1849         Plug a leak that would cause a cross-device mv to fail when
1850         operating on too many command-line-specified nonempty directories.
1851         * src/remove.c (remove_dir): Destroy the `struct saved_cwd' on the
1852         top of the stack before returning.  This usually closes the file
1853         descriptor that was used to return to the original working directory.
1854         Reported by Cyril Bouthors in
1855         http://article.gmane.org/gmane.comp.gnu.core-utils.bugs/3048
1856         * NEWS: Mention it here.
1857
1858         * src/pathchk.c (validate_file_name): Give a more descriptive
1859         diagnostic when pathconf fails.  This also avoids an unwarranted
1860         warning from gcc-3.3.5 about a format not being a string literal.
1861
1862         * src/sleep.c (main): Remove declaration of unused local, c.
1863         * src/printenv.c (main): Likewise.
1864         * src/logname.c (main): Likewise.
1865         * src/uptime.c (main): Likewise, for optc.
1866         * src/tsort.c (main): Likewise, for opt.
1867
1868 2004-10-17  Paul Eggert  <eggert@cs.ucla.edu>
1869
1870         * AUTHORS: Add self to pathchk.
1871         * src/pathchk.c (AUTHORS): Add self.
1872         Change "path" to "file name" whenever possible.
1873         Remove usage comment, as it was a duplication of the code or doc.
1874         Include <wchar.h> if available.
1875         (mbrlen, mbstate_t) [! (HAVE_MBRLEN && HAVE_MBSTATE_T)]: Define.
1876         (NEED_PATHCONF_WRAPPER, PATH_MAX, PATH_MAX_FOR, NAME_MAX,
1877         pathconf_wrapper, portable_chars, dir_ok): Remove.
1878         (NAME_MAX_MINIMUM, PATH_MAX_MINIMUM): New macros.
1879         (pathconf, _PC_NAME_MAX, _PC_PATH_MAX): Define if nonexistent.
1880         (portable_chars_only): New arg FILELEN.
1881         Don't assume ASCII; we might be on an EBCDIC host.
1882         Don't assume unibyte locale in diagnostic.
1883         (component_start, component_len): New functions.
1884         (validate_file_name): Renamed from validate_path.  All uses changed.
1885         Pretty much a complete rewrite.
1886         Don't make copy of file arg.  Always append trailing slash to
1887         pathconf arg, just in case it's a symlink (this is pure paranoia;
1888         we don't know of any hosts where the trailing slash is required).
1889         Use size_t instead of long int when possible.
1890         Avoid need to call pathconf in most practical cases.
1891         Don't use euidaccess several times to test searchability;
1892         just use lstat once.  Reword diagnostic to put the (often very long)
1893         file names last.
1894
1895 2004-10-15  Paul Eggert  <eggert@cs.ucla.edu>
1896
1897         * src/printf.c (usage): Mention Unicode, and use H for hex digits.
1898
1899 2004-10-13  Jim Meyering  <jim@meyering.net>
1900
1901         * NEWS: Mention today's fts.c fix.
1902
1903 2004-10-13  Paul Eggert  <eggert@cs.ucla.edu>
1904
1905         * tests/stty/row-col-1: Set LC_ALL=C.
1906
1907 2004-10-12  Jim Meyering  <jim@meyering.net>
1908
1909         * src/dircolors.hin: Add .flac and .mpc as audio suffixes.
1910         From Jesus Climent in http://bugs.debian.org/276149.
1911
1912 2004-10-05  Paul Eggert  <eggert@cs.ucla.edu>
1913
1914         * src/ls.c (ignore_mode): Renamed from ignore, to avoid shadowing
1915         problems.  All uses changed.
1916
1917 2004-10-05  Jim Meyering  <jim@meyering.net>
1918
1919         * .x-sc_trailing_blank: Add an exclusion for config/texinfo.tex,
1920         since Karl says its trailing blanks are there to stay :-)
1921
1922 2004-10-04  Paul Eggert  <eggert@cs.ucla.edu>
1923
1924         * src/expr.c (NEW, OLD): Remove, partly to avoid
1925         reference to obsolescent macro XMALLOC.
1926         All uses replaced by xmalloc and free.
1927
1928 2004-09-28  Jim Meyering  <jim@meyering.net>
1929
1930         * src/tail.c (usage): Clarify: --retry works only with --follow=name.
1931         Reported by Nik A. Melchior in http://bugs.debian.org/273781.
1932
1933 2004-09-27  Paul Eggert  <eggert@cs.ucla.edu>
1934
1935         * src/od.c (format_address_paren): c is optional, so don't output
1936         it if it's '\0'.
1937
1938 2004-09-26  Paul Eggert  <eggert@cs.ucla.edu>
1939
1940         Add support for ls --hide.  Idea suggested by Bardur Arantsson.
1941         * NEWS: Document this.
1942         * src/ls.c (file_ignored): Renamed from file_interesting, with
1943         inverted return value.  Accept the file name, not a struct dirent *.
1944         All uses changed.  Avoid the expense of calling fnmatch if the
1945         file is ignorable due to leading '.'.
1946         (all_files, really_all_files): Removed; replaced by:
1947         (ignore): New variable.  All uses changed.
1948         (IGNORE_DEFAULT, IGNORE_DOT_AND_DOTDOT, IGNORE_MINIMAL, HIDE_OPTION):
1949         New constants.
1950         (hide_patterns): New variable.
1951         (long_options, decode_switches, file_ignored, usage):
1952         Add support for --hide.
1953         (patterns_match): New function.
1954         (usage): Replace "hide" with "ignore" in explanation, to avoid
1955         confusion.
1956
1957 2004-09-25  Paul Eggert  <eggert@cs.ucla.edu>
1958
1959         * src/ls.c (gobble_file, print_long_format): Don't assume that
1960         human-readable output has a byte count equal to its column width;
1961         this isn't always true in locales where the radix character is not
1962         '.' or ','.
1963         (format_user_or_group): Revamp code to match the above fix;
1964         this avoids the (very faint) possibility of integer overflow.
1965
1966 2004-09-24  Paul Eggert  <eggert@cs.ucla.edu>
1967
1968         * NEWS: Mention that "chmod -r -w x" now works as expected.
1969         * src/chmod.c (main): Revamp option processing to support this.
1970         * tests/chmod/Makefile.am (TESTS): Add 'usage'.
1971         * tests/chmod/usage: New set of tests for usage like that.
1972
1973 2004-09-24  Jim Meyering  <jim@meyering.net>
1974
1975         * Makefile.maint (CVS_LIST): Use --types=AFGM option so that
1976         it lists only cvs-controlled regular files.
1977
1978         * src/csplit.c (xalloc_die): Declare to be `extern', not `static'
1979         to avoid a warning from gcc-3.4.1.  Reported by Paul Eggert.
1980
1981 2004-09-23  Paul Eggert  <eggert@cs.ucla.edu>
1982
1983         * Makefile.maint (CVS_LIST): New macro.
1984         (sc_space_tab, sc_prohibit_atoi_atof, sc_file_system,
1985         sc_prohibit_jm_in_m4, sc_system_h_headers, sc_sun_os_names,
1986         sc_trailing_blank, po-check): Use it instead of the
1987         nonstandard "cvsu --list".
1988
1989         * src/tail.c (parse_obsolete_option): Bring back support
1990         for obsolete option followed by non-obsolete, or by more
1991         than one file.  When obsolete, conform to SUSv2 rather than
1992         original POSIX 1003.2-1992, as SUSv2 corrected the case of
1993         "tail -c".  Add support for the SUSv2 "b" modifier.
1994         * NEWS: Mention the above.
1995         * tests/tail/Test.pm: New test case obs-b to check the above.
1996         err-[134] no longer need _POSIX2_VERSION=199209.
1997         Fix comments to match revised behavior.
1998
1999 2004-09-22  Jim Meyering  <jim@meyering.net>
2000
2001         * Use automake-1.9.2.  Regenerate dependent files.
2002
2003         * src/remove.c (struct dirstack_state) [current_arg_jumpbuf]:
2004         Improve the comment.
2005
2006         Clean up scoping etc. so that some make `distcheck' tests pass.
2007         * src/csplit.c (xalloc_die): Declare to be static.
2008         * src/chown-core.c (chown_files): Declare as `extern'.
2009         * src/cp-hash.c (remember_created): Likewise.
2010         * src/copy.c (copy): Likewise.
2011         * src/checksum.h (enum) [ALG_MD5]: Define to be 1, not 0.
2012
2013         * src/id.c, src/nl.c, src/expand.c: Remove trailing blanks.
2014         * src/unexpand.c: Likewise.
2015
2016         * src/Makefile.am (check-AUTHORS): New rule.
2017         (check): Depend on it.
2018         * AUTHORS: Update.
2019
2020         * Makefile.maint (syntax-check-rules): Remove duplicate sc_tight_scope.
2021         (sc_system_h_headers): Also exclude copy.h; it includes <stdbool.h>.
2022
2023 2004-09-22  Paul Eggert  <eggert@cs.ucla.edu>
2024
2025         * src/ls.c (decode_switches): Don't compare a short value
2026         to SIZE_MAX: GCC sometimes complains.
2027
2028 2004-09-21  Paul Eggert  <eggert@cs.ucla.edu>
2029
2030         * NEWS: The following commands now reject unknown options:
2031         basename dirname factor hostname link nohup sync unlink yes
2032         Also, pathchk no longer accepts trailing options.
2033
2034         * src/basename.c: Include <getopt.h>.
2035         * src/chroot.c: Likewise.
2036         * src/dirname.c: Likewise.
2037         * src/factor.c: Likewise.
2038         * src/hostid.c: Likewise.
2039         * src/hostname.c: Likewise.
2040         * src/nohup.c: Likewise.
2041         * src/pwd.c: Likewise.
2042         * src/setuidgid.c: Likewise.
2043         * src/sync.c: Likewise.
2044
2045         * src/basename.c (main): Reject unknown options.
2046         * src/dirname.c (main): Likewise.
2047         * src/factor.c (main): Likewise.
2048         * src/hostid.c (main): Likewise.
2049         * src/hostname.c (main): Likewise.
2050         * src/link.c (main): Likewise.
2051         * src/nohup.c (main): Likewise.
2052         * src/pwd.c (main): Likewise.
2053         * src/setuidgid.c (main): Likewise.
2054         * src/sync.c (main): Likewise.
2055         * src/unlink.c (main): Likewise.
2056         * src/yes.c (main): Likewise.
2057
2058         * src/cat.c (main): Remove unused "case 0".
2059         * src/chgrp.c (main): Likewise.
2060         * src/chmod.c (main): Likewise.
2061         * src/chown.c (main): Likewise.
2062         * src/comm.c (main): Likewise.
2063         * src/cp.c (main): Likewise.
2064         * src/csplit.c (main): Likewise.
2065         * src/cut.c (main): Likewise.
2066         * src/date.c (main): Likewise.
2067         * src/df.c (main): Likewise.
2068         * src/du.c (main): Likewise.
2069         * src/env.c (main): Likewise.
2070         * src/expand.c (main): Likewise.
2071         * src/fold.c (main): Likewise.
2072         * src/head.c (main): Likewise.
2073         * src/id.c (main): Likewise.
2074         * src/install.c (main): Likewise.
2075         * src/join.c (main): Likewise.
2076         * src/ln.c (main): Likewise.
2077         * src/ls.c (decode_switches): Likewise.
2078         * src/mkdir.c (main): Likewise.
2079         * src/mkfifo.c (main): Likewise.
2080         * src/mknode.c (main): Likewise.
2081         * src/mv.c (main): Likewise.
2082         * src/nl.c (main): Likewise.
2083         * src/paste.c (main): Likewise.
2084         * src/pinky.c (main): Likewise.
2085         * src/pr.c (main): Likewise.
2086         * src/ptx.c (main): Likewise.
2087         * src/readlink.c (main): Likewise.
2088         * src/rm.c (main): Likewise.
2089         * src/rmdir.c (main): Likewise.
2090         * src/seq.c (main): Likewise.
2091         * src/shred.c (main): Likewise.
2092         * src/split.c (main): Likewise.
2093         * src/sum.c (main): Likewise.
2094         * src/tac.c (main): Likewise.
2095         * src/tail.c (main): Likewise.
2096         * src/tee.c (main): Likewise.
2097         * src/touch.c (main): Likewise.
2098         * src/tr.c (main): Likewise.
2099         * src/tty.c (main): Likewise.
2100         * src/uname.c (main): Likewise.
2101         * src/unexpand.c (main): Likewise.
2102         * src/wc.c (main): Likewise.
2103         * src/who.c (main): Likewise.
2104
2105         * src/chroot.c (main): Use getopt where it suffices, not getopt_long.
2106         * src/cksum.c (main): Likewise.
2107         * src/dd.c (main): Likewise.
2108         * src/logname.c (main): Likewise.
2109         * src/printenv.c (main): Likewise.
2110         * src/sleep.c (main): Likewise.
2111         * src/tsort.c (main): Likewise.
2112         * src/uptime.c (main): Likewise.
2113         * src/users.c (main): Likewise.
2114         * src/whoami.c (main): Likewise.
2115
2116         * src/du.c (long_options): Standardize on NULL vs 0.
2117         * src/rm.c (long_opts): Likewise.
2118
2119         * src/logname.c (long_options): Remove.
2120         * src/printenv.c (long_options): Likewise.
2121         * src/sleep.c (long_options): Likewise.
2122         * src/tsort.c (long_options): Likewise.
2123         * src/uptime.c (longopts): Likewise.
2124         * src/users.c (longopts): Likewise.
2125         * src/whoami.c (long_options): Likewise.
2126
2127         * src/pathchk.c (longopts): Add --help, --version.
2128         (main): Use longopts rather than parse_long_options.
2129         * src/stty.c (longpts, main): Likewise.
2130
2131         * src/pathchk.c (main): Don't reorder arguments, so that
2132         we can check weird file names.
2133
2134         * src/readlink.c: Don't include "long-options.h".
2135         * src/sort.c: Likewise.
2136         * src/stty.c: Likewise.
2137
2138         * src/split.c (verbose): Now bool, not int.
2139         (VERBOSE_OPTION): New enum.
2140         (longopts, main): Use it.
2141
2142         * tests/factor/basic: Adjust to new wording in diagnostic
2143         that results from the above changes.
2144
2145 2004-09-21  Jim Meyering  <jim@meyering.net>
2146
2147         * man/rm.x: Say "the response is affirmative" rather than "the
2148         response begins with y or Y", so that the documentation is
2149         accurate in non-English locales.  Problem reported by Munzir Taha.
2150
2151 2004-09-19  Paul Eggert  <eggert@cs.ucla.edu>
2152
2153         * src/echo.c (main): Don't pass NULL to strcmp when
2154         POSIXLY_CORRECT and given no arguments.
2155
2156         * src/md5sum.c (STRING_OPTION): Remove.
2157         (long_options, main): Remove support for undocumented and
2158         obsolete --string option, as suggested in the 1996-09-26 patch.
2159         * NEWS: Document this.
2160
2161         * tests/rm/fail-eperm: Don't try to remove writeable files in a
2162         sticky /tmp directory, as SVR4-like systems (e.g., Solaris 9) let
2163         you remove such files.  Problem reported by Bert Fischer in:
2164         http://lists.gnu.org/archive/html/bug-coreutils/2004-09/msg00074.html
2165
2166 2004-09-18  Paul Eggert  <eggert@cs.ucla.edu>
2167
2168         * src/md5sum.c (STATUS_OPTION, STRING_OPTION): New enums.
2169         (long_options, main): Use them instead of magic numbers 2 and 1.
2170         For --string, optarg can't possibly be NULL.
2171
2172         * src/dd.c (usage): Distinguish between options and operands.
2173         (scanargs): Don't mess with argc, argv; getopt_long handles this now.
2174         Say "operands" for operands, not "options".
2175         (main): Use getopt_long, so that "dd --" works as POSIX requires.
2176         * tests/dd/misc: Check for "dd --".
2177
2178         * src/chroot.c (main): Reject unknown options instead of
2179         interpreting them as a directory to chroot to.
2180
2181         * src/cksum.c: Remove obsolete comment about POSIX 1003.2/D11.2.
2182         The current standard (POSIX 1003.1-2004) is correct.
2183         (crc_remainder) [defined CRCTAB]: Renamed from "remainder" to avoid
2184         collision with builtin function.
2185         (main) [defined CRCTAB]: Output in lowercase hexadecimal, and
2186         output the first 0 as 8 digits, to make it easier to compare to
2187         the text of the standard.  Output crctab to be a const array.
2188         (crctab): Use result of above changes.
2189         (long_options): Remove; not needed if empty.
2190         (main): getopt_long can't return 0 here, so simplify the code.
2191
2192 2004-09-13  Jim Meyering  <jim@meyering.net>
2193
2194         * src/Makefile.am (localedir.h): Don't redirect directly to target.
2195
2196 2004-09-13  Paul Eggert  <eggert@cs.ucla.edu>
2197
2198         * src/id.c (print_full_info): Don't exit with failure status simply
2199         because a user or group number can't be turned into a name.
2200         Problem reported by Felipe Kellermann in:
2201         http://lists.gnu.org/archive/html/bug-coreutils/2004-09/msg00081.html
2202
2203 2004-09-12  Jim Meyering  <jim@meyering.net>
2204
2205         * Makefile.maint (my-distcheck): When building with -Werror, also
2206         require -Wshadow.
2207
2208 2004-09-10  Paul Eggert  <eggert@cs.ucla.edu>
2209
2210         * NEWS: "tail" now handles obscure POSIX 1003.2-1992 cases better.
2211         * src/tail.c (parse_obsolete_option): Renamed from
2212         parse_obsolescent_option, since the options are obsolete now.
2213         Remove bool *arg; just exit if there's an error.  Revamp to follow
2214         POSIX 1003.2-1992 more precisely, to handle cases like "tail -
2215         file" and "tail -10 -- file" correctly when we are conforming to
2216         the older standard.
2217         (main): Adjust to this change.
2218         * tests/tail/Test.pm (test_vector): minus-* requires
2219         _POSIX2_VERSION=199209 now, to work correctly if there is
2220         an input file.  err-1 and err-3 no longer errors if there
2221         is another file.
2222
2223 2004-09-09  Paul Eggert  <eggert@cs.ucla.edu>
2224
2225         * src/test.c (usage): Document -r, -w, -x more carefully.
2226
2227 2004-09-08  Paul Eggert  <eggert@cs.ucla.edu>
2228
2229         * src/test.c (usage): Document "test" (with no args) and "[ ]".
2230         Document that -h and -L don't dereference.
2231
2232         * NEWS: Document that "tr xy -z" now works as per POSIX.
2233         Sort the descriptions.
2234         * src/tr.c (main): Don't reorder options.
2235         * tests/tr/Test.pm (fowler-1): New test case.
2236
2237 2004-09-06  Paul Eggert  <eggert@cs.ucla.edu>
2238
2239         * src/touch.c (main): Fix POSIX-conformance bug: "touch --
2240         MMDDhhmm file" must be treated like "touch MMDDhhmm file" when
2241         conforming to pre-2001 POSIX.
2242         * NEWS: Document this.
2243         * tests/touch/obsolescent: Test for this bug.  Also, set
2244         _POSIX2_VERSION=199209 and POSIXLY_CORRECT=1 so that it's
2245         a better test for obsolescent features.
2246
2247         * src/sort.c (main): Emulate Solaris 8 and 9 "sort -y", so that
2248         "sort -y abc" is like "sort abc" whereas "sort -y 100" is like
2249         plain "sort".
2250
2251         * src/od.c: Several changes for POSIX and FreeBSD compatibility.
2252         (COMMON_SHORT_OPTIONS): Add -B, -D, -e, -F, -H, -I, -L, -O, -s, -X.
2253         (long_options, main): --strings is now -S, not -s.
2254         (usage): Reflect the usage changes.
2255         (parse_old_offset): Do not issue a diagnostic on failure;
2256         callers now do this as necessary.
2257         (main): Support POSIX syntax.  Remove unused case 0 from getopt_long.
2258         Add support for new short options (many undocumented) for
2259         compatibility with FreeBSD.  Remove FIXME for -s; it's now
2260         POSIX-compatible.  Default format is now oS, not o2.
2261         * NEWS: Describe the above.
2262
2263 2004-09-05  Paul Eggert  <eggert@cs.ucla.edu>
2264
2265         * src/stty.c (valid_options): Remove.
2266         (main): Fix some bugs in handling invalid option-combinations
2267         like "stty -F".
2268         (recover_mode): Arg is now char const *, not char *.
2269         (main): Use STDIN_FILENO, not 0.
2270         Simplify option-parsing code a tad.
2271         * tests/stty/basic-1: Check for the fixed bugs.
2272
2273 2004-09-03  Paul Eggert  <eggert@cs.ucla.edu>
2274
2275         * src/stat.c (HAVE_STRUCT_STATXFS_F_TYPE): Fix typo that prevented
2276         it from ever being nonzero.  Reported by Pozsar Balazs in:
2277         http://lists.gnu.org/archive/html/bug-coreutils/2004-08/msg00189.html
2278         (human_fstype): Add ramfs, squashfs, sysfs.
2279         Reported by Pozsar Balazs in:
2280         http://lists.gnu.org/archive/html/bug-coreutils/2004-08/msg00188.html
2281         (human_fstype): Return char const *, not char *.
2282         Simplify internals a bit, and avoid casts.
2283
2284         * src/dd.c (usage): "alternated EBCDIC" -> "alternate EBCDIC".
2285         (bit_count): Remove.  All uses changed to....
2286         (multiple_bits_set): New function.
2287         (scanargs): Use it, and check separately for each set of
2288         incompatible options, to improve diagnostics.
2289         (MX): Remove.
2290         (apply_translations): Move checks for incompatible options
2291         to scanargs, so that they're done consistently.
2292
2293 2004-09-02  Paul Eggert  <eggert@cs.ucla.edu>
2294
2295         Output correct errno-related diagnostic on "paste" I/O errors.
2296         * src/paste.c (write_error, xputchar): New functions.
2297         (paste_parallel): Use correct errno value after input error.
2298         (paste_parallel, paste_serial): Report errno value after output error.
2299
2300         Port to diet libc.  Problem reported by Felix von Leitner in:
2301         http://lists.gnu.org/archive/html/bug-coreutils/2004-08/msg00171.html
2302         * src/paste.c (dummy_closed, CLOSED, dummy_endlist, ENDLIST): Remove;
2303         it's not portable C to assume FILE is a complete type.
2304         (paste_parallel): Use index test instead of ENDLIST, and NULL
2305         instead of CLOSED.
2306
2307 2004-08-24  Paul Eggert  <eggert@cs.ucla.edu>
2308
2309         POSIX-conformance fixes for "expand" and "unexpand".
2310         Also, consistently use "tab stop" rather than "tabstop".
2311         * NEWS: Document fixes.
2312         * src/expand.c: Revamp to resemble the new unexpand.c better.
2313         (usage): -i does not convert tabs after non-tabs.
2314         (add_tab_stop): Renamed from add_tabstop.  All uses changed.
2315         (parse_tab_stop): Renamed from parse_tabstop.  All uses changed.
2316         (validate_tab_stop): Renamed from validate_tabstop.  All uses changed.
2317         (next_file, main): Check fclose against 0, not EOF.
2318         (expand): Remove unnecessary casts.
2319         Add another loop nesting level, for lines, so that per-line variables
2320         are initialized cleanly.
2321         Revamp tab checking.  Check for write error immediately, rather
2322         than just once at the end of the program.
2323         * src/unexpand.c: Lkewise (for the expand.c changes).
2324         (TAB_STOP_SENTINEL): Remove.
2325         (tab_size): Now size_t, not uintmax_t, since we need to store
2326         the sequences of blanks.
2327         (max_column_width): New var.
2328         (usage): Say "blank" where POSIX requires this.
2329         (add_tab_stop): Calculate maximum column width.
2330         (unexpand): Store the pending blanks, instead of merely counting them.
2331         Follow POSIX's rules about -a requiring two blanks before a tab stop.
2332         Get rid of internal label and goto.
2333         * tests/unexpand/basic-1: Fix infloop-3 to match POSIX.
2334         Add blanks-1 through blanks-13.
2335
2336 2004-08-19  Paul Eggert  <eggert@cs.ucla.edu>
2337
2338         * NEWS: "chown : file", "chown '' file", and "chgrp '' file" now
2339         succeed without changing the uid and gid, like FreeBSD.
2340         * src/chgrp.c (parse_group): Return gid_t rather than storing it
2341         through a pointer.  Treat "chgrp '' file" as a no-op change,
2342         as FreeBSD does.
2343         (main): Set chopt.group_name to NULL if the group is the empty
2344         string.
2345         * src/chown-core.c (describe_change): Describe changes to -1:-1
2346         without using "to OWNERSHIP" phrase.
2347         * src/chown.c (usage): "chown '' file" is now allowed.
2348         (main): Do not set user name to the empty string if the group
2349         name is null.
2350         * tests/chgrp/basic: Test "chgrp '' file".
2351         * tests/chown/Makefile.am (TESTS): Add separator.
2352         * tests/chown/separator: New file, partly taken from
2353         Dmitry V. Levin's suggestion in
2354         <http://lists.gnu.org/archive/html/bug-coreutils/2004-08/msg00102.html>
2355
2356 2004-08-11  Paul Eggert  <eggert@cs.ucla.edu>
2357
2358         * tests/install/basic-1: Test for the -d regression.
2359
2360 2004-08-11  Dmitry V. Levin  <ldv@altlinux.org>
2361
2362         * src/install.c (main): Fix -d regression introduced with
2363         --target-directory support at 2004-06-25.
2364
2365 2004-08-11  Paul Eggert  <eggert@cs.ucla.edu>
2366
2367         * src/copy.c (copy_internal): When preserving links, unlink
2368         a destination with link count greater than one.  This is so
2369         that commands like "cp -a" don't get confused when copying into
2370         a destination that already contains many hard links.  Problem
2371         reported by Tim Waugh in:
2372         http://lists.gnu.org/archive/html/bug-coreutils/2004-08/msg00053.html
2373
2374 2004-08-10  Paul Eggert  <eggert@cs.ucla.edu>
2375
2376         Convert all files to UTF-8.
2377         * tests/fmt/basic (8-bit-pfx): Use UTF-8, not Latin-1.
2378         * tests/sort/Test.pm (16a): Likewise.
2379         * tests/uniq/Test.pm (8): Likewise.
2380         * tests/misc/printf-hex: Use ASCII, not Latin-1.
2381
2382         * NEWS: Document "sort -o -" and "tee -" POSIX-conformance fixes.
2383         * src/shred.c (usage): "-" is an operand, not an option.
2384         * src/sort.c (die, xfopen, mergefps, first_same_file, merge):
2385         A null file arg means standard output.
2386         (main): "-o -" means to write to a file named "-",
2387         not to standard output.
2388         * src/tee.c (usage, tee): "tee -" writes to standard output, not
2389         to a file named "-".
2390
2391 2004-08-10  Dmitry V. Levin  <ldv@altlinux.org>
2392
2393         * src/install.c (change_timestamps): Fix int->bool conversion
2394         bugs introduced on 2004-07-29.
2395
2396 2004-08-09  Paul Eggert  <eggert@cs.ucla.edu>
2397
2398         * src/shred.c (wipename): Work even if the directory is writeable
2399         and not readable.  Prefer write access, since this should work
2400         better with fdatasync.
2401
2402         * src/csplit.c (xalloc_die): New function.
2403         (main): Remove now-obsolete initialization of xalloc_fail_func.
2404
2405         * src/md5sum.c: Adjust to sha->sha1 renaming.
2406
2407 2004-08-08  Dmitry V. Levin  <ldv@altlinux.org>
2408
2409         Minor code cleanup.
2410         * src/readlink.c (canonicalize_fname): Remove unneeded proxy function.
2411         (can_mode): Make variable local.
2412
2413 2004-08-07  Paul Eggert  <eggert@cs.ucla.edu>
2414
2415         * src/system.h (O_BINARY) [!O_BINARY && defined O_BINARY]:
2416         Do not define, to avoid annoying compiler messages on QNX 6.3.
2417         Problem reported by Johan in:
2418         http://lists.gnu.org/archive/html/bug-coreutils/2004-08/msg00050.html
2419
2420 2004-08-04  Paul Eggert  <eggert@cs.ucla.edu>
2421
2422         * src/system.h (PRIdMAX, PRIoMAX, PRIuMAX, PRIxMAX):
2423         Define to a concatenation of string literals, not to an expression;
2424         needed for concatenation contexts.
2425         (INTMAX_MAX, INTMAX_MIN): New macros.
2426
2427         * src/stat.c (print_stat): Don't assume st_ino / st_dev fits in
2428         unsigned long; this isn't true for st_ino on Solaris 9.
2429
2430 2004-08-03  Paul Eggert  <eggert@cs.ucla.edu>
2431
2432         * src/uname.c: Do not depend on HAVE_SYSCTL when deciding
2433         whether to include files.  Include <sys/param.h> if
2434         HAVE_SYS_PARAM_H (not HAVE_SYSCTL).
2435         (main) [defined __POWERPC__]: Add a kludge to work around a
2436         Mac OS X bug, so that uname -p defaults to "powerpc" if
2437         sysctl ((int[]) {CTL_HW, HW_MACHINE_ARCH}, 2, buffer, &bufsize, 0, 0)
2438         fails.  Problem reported by Petter Reinholdtsen in:
2439         http://lists.gnu.org/archive/html/bug-gnu-utils/2003-02/msg00201.html
2440
2441         * src/uniq.c (hard_LC_COLLATE, ignore_case, different, check_file,
2442         main): Use bool for booleans.
2443         (writeline, check_file): Use uintmax_t for line counts.
2444         (check_file): Check for and report line number overflow,
2445         when that matters.
2446         * src/wc.c (iswspace, wc): Use to_uchar rather than a cast.
2447         (print_lines, print_words, print_chars, print_bytes, print_linelength,
2448         have_read_stdin, wc, wc_file, main):
2449         Use bool for booleans.
2450         (exit_status): Remove.
2451         (wc, wc_file): Return bool status.  All callers changed.
2452         * src/who.c (scan_entries): 0 -> STDIN_FILENO.
2453         * src/whoami.c (main): Print uids using unsigned long int, not
2454         unsigned int.
2455
2456         * src/unexpand.c: Int cleanup and minor reorganization to be more
2457         like src/expand.c.
2458         Include quote.h, xstrndup.h.
2459         (TAB_STOP_SENTINEL): Increase from INT_MAX to INTMAX_MAX.
2460         (convert_entire_line, have_read_stdin, parse_tabstops, next_file,
2461         unexpand, main):
2462         Use bool for booleans.
2463         (tab_size, tab_list, add_tabstop, validate_tabstops, unexpand):
2464         Use uintmax_t for column counts.
2465         (first_free_tab, validate_tabstops, unexpand): Use size_t for sizes.
2466         (add_tabstop, parse_tabstops, main): Don't reserve UINTMAX_MAX
2467         as a tab stop.
2468         (parse_tabstops): Don't use ISBLANK on possibly-signed char.
2469         Detect overflow in tab stop string.
2470         (next_file, main): Use EXIT_FAILURE/EXIT_SUCCESS instead of 1/0.
2471         (unexpand): Concatenate input files the same way expand does.
2472
2473         * src/touch.c (no_create, use_ref, posix_date, amtime_now,
2474         touch, main): Use bool for booleans.
2475         (main): Avoid integer overflow when given more than INT_MAX
2476         options.
2477         * src/tsort.c (struct item, n_strings): Use size_t for sizes.
2478         (have_read_stdin, count_items, scan_zeros, detect_loop,
2479         recurse_tree, walk_tree, tsort, main):
2480         Use bool for booleans.
2481         (exit_status): Remove.
2482         (tsort): Return a success flag instead of storing into a global.
2483         (main): Use it.
2484         * src/tty.c (silent, main): Use bool for booleans.
2485         (main): 0 -> STDIN_FILENO.
2486         * src/uname.c (print_element): Use bool for booleans.
2487
2488         * src/test.c (TRUE, FALSE, SHELL_BOOLEAN, TRUTH_OR, TRUTH_AND):
2489         Remove.  All uses replaced by C99 boolean primitives.
2490         (TEST_TRUE, TEST_FALSE): New constants, for readability.
2491         (test_unop, binop, unary_operator, binary_operator, two_arguments,
2492         three_arguments, posixtest, expr, term, and, or, is_int, age_of,
2493         one_argument, main): Use bool for booleans.
2494         (advance, unary_advance): Now inline procedures rather than a macros.
2495         (is_int): Renamed from isint, to avoid namespace clash with ctype.h.
2496         (term, and, or): When it's easy, loop instead of recursing.
2497         (term): Avoid integer overflow if there are INT_MAX-3 args (!).
2498         (binary_operator, unary_operator): Simplify by systematically rewriting
2499         true==FOO to FOO (where FOO is a boolean).
2500         (unary_operator): Don't consider a file to be a regular file
2501         merely because its mode&S_IFMT is zero.  Just use S_ISREG.
2502         Remove unnecessary casts.  Remove ifdefs for things like
2503         S_ISSOCK that are no longer needed, since stat-macros.h always
2504         defines them now.
2505
2506         * src/tac-pipe.c (buf_init_from_stdin, find_bol, tac_mem):
2507         Use bool for booleans.
2508         (buf_init_from_stdin, buf_free, find_bol, print_line):
2509         Use size_t for sizes.
2510         * src/tac.c (separator_ends_record, tac_seekable, tac_file,
2511         tac_stdin, tac_stdin_to_mem, main): Use bool for booleans.
2512         (match_length, G_buffer_size, tac_seekable, main): Use size_t for sizes.
2513         (tac_seekable): Use ptrdiff_t for pointer subtraction.
2514         Report an error if the result is out of range.
2515         (tac_seekable, main): Check for integer overflow in buffer size
2516         calculations.
2517         (main): Remove unnecessary casts.
2518
2519         * src/su.c (run_shell): Pass a new n_additional_args arg, so that
2520         the callee doesn't have to count 'em.  All callers changed.
2521         Don't allocate more space for the arg vector than we'll need.
2522         Use memcpy to copy the args rather than rolling our own loop.
2523         Use size_t for sizes.
2524         (fast_startup, simulate_login, change_environment, log_su,
2525         correct_password, restricted_shell, main): Use bool for booleans.
2526         (longopts): Don't assume change_environment is an int.
2527         Use NULL, not 0, for pointers.
2528         (xsetenv): New function, replacing xputenv and concat.
2529         All callers changed.
2530         (elements): Remove; no longer needed.
2531         (log_su, correct_passwd, main): Prefer !x to x==NULL.
2532         (log_su): 2 -> STDERR_FILENO.
2533         (modify_environment, main): Don't assume that getenv's returned value
2534         has an indefinite lifetime.
2535         (modify_environment): Allocate a larger environ.
2536         (main): Remove an impossible 'case 0'; if it happens now, it'll
2537         get diagnosed.  Don't assume getpwnam results outlive endpwent.
2538         Check for null or empty pw_name, pw_dir and for null pw_passwd.
2539
2540         * src/stty.c (VA_START): Remove.  All callers now use va_start.
2541         (_POSIX_VDISABLE): Remove unnecessary cast.
2542         (struct control_info, visible): Use cc_t for control chars.
2543         (struct control_info): Use size_t for sizes.
2544         (recover_mode, set_mode, display_speed, display_window_size,
2545         valid_options, main, display_changed):
2546         Use bool for booleans.
2547         (integer_arg): Return unsigned long int, not long int.
2548         Accept new max arg; all callers changed, to specify a maximum
2549         value for integer parameters instead of silently overflowing.
2550         (wrap): Do not overrun the stack buffer if the output contains
2551         more than 1024 bytes.  Instead, malloc a buffer.
2552         (main): Remove a "what is this?!?" FIXME.  Nobody knows what it is.
2553         Remove unnecessary casts.
2554         (set_control_char): Allow int values only up to cc_t range.
2555         (screen_columns): Don't reject INT_MAX.
2556         (display_changed, display_all, display_speed, recover_mode):
2557         Don't assume cc_t fits in int.
2558
2559         * src/remove.h: Add copyright notice.
2560         (struct rm_options): Use bool for booleans.
2561         * src/rmdir.c (empty_paths, ignore_fail_on_non_empty, verbose,
2562         errno_rmdir_non_empty, remove_parents, main): Likewise.
2563         * src/sum.c (have_read_stdin, bsd_sum_file, sysv_sum_file,
2564         main): Likewise.
2565         (main): Don't dump core if invoked with argv[0]==NULL.
2566         * src/tee.c (tee, append, ignore_interrupts, main, tee):
2567         Use bool for booleans.
2568         (tee): Use ssize_t for read returns.
2569
2570         * src/ptx.c: Add a FIXME mentioning that there are many
2571         unchecked integer overflows in this file.
2572         (gnu_extensions, auto_reference, input_reference, right_reference,
2573         ignore_case, initialize_regex, fix_output_parameters,
2574         output_one_roff_line, output_one_text_line, output_one_dumb_line, main):
2575         Use bool for booleans.
2576         (SKIP_SOMETHING, compare_words, digest_break_file,
2577         find_occurs_in_text, fix_output_parameters):
2578         Use to_uchar instead of a caset.
2579         (print_field): Rewrite to avoid cast.
2580
2581         * src/printf.c (posixly_correct): Use bool for booleans.
2582         (verify, main): Use EXIT_FAILURE/EXIT_SUCCESS instead of 1/0.
2583         (STRTOX): Rewrite to avoid casts.
2584         (print_esc_char): Arg is char, not int.
2585         * src/readlink.c (canonicalize): Remove.  All uses now merely inspect
2586         can_mode.
2587         (no_newline, verbose): Use bool for booleans.
2588         (can_mode): Now of type int; use -1 to denote otherwise-uninitialized.
2589         * src/shred.c (struct Options, main): Use bool for booleans.
2590         (isaac_seed_data, fillpattern, wipefile): Rewrite to avoid casts.
2591         * src/split.c (cwrite, bytes_split, lines_split, line_bytes_split):
2592         Use bool for booleans.
2593         * src/stat.c (G_fail): Remove.
2594         (print_statfs): Print various gotta-be-nonnegative values using
2595         unsigned long int, not long int or int.
2596         (do_statfs, do_stat): Return a boolean success flag.
2597         (do_stat, main): Use bool for booleans.
2598
2599         * src/pr.c: Add a FIXME mentioning that there are many
2600         unchecked integer overflows in this file.
2601         (TRUE, FALSE): Remove.  All uses replaced by true and false.
2602         (struct COLUMN, read_line, print_page, print_stored, open_file,
2603         skip_to_page, init_fps, parallel_files, align_empty_cols,
2604         empty_line, FF_only, explicit_columns, extremities, keep_FF,
2605         print_a_FF, print_a_header, use_form_feed, have_read_stdin,
2606         print_across_flag, storing_columns, balance_columns,
2607         truncate_lines, join_lines, untabify_input, failed_opens,
2608         numbered_lines, skip_count, use_esc_sequence, use_cntrl_prefix,
2609         double_space, ignore_failed_opens, use_col_separator,
2610         pad_vertically, last_line, main, init_parameters, skip_read,
2611         read_line, print_stored):
2612         Use bool for booleans.
2613         (struct COLUMN, char_to_clump, store_char, print_char):
2614         Use char for chars.
2615         (clump_buff, print_clump): Use char[], not int[], for an array whose
2616         elements are always chars.
2617         (first_last_page, main, getoptarg, balance, add_line_number,
2618         char_to_uclump): Remove unnecessary casts.
2619         (init_parameters): Allocate chars, not ints, for clump_buff.
2620         (print_char): Use to_uchar before invoking ISPRINT.
2621         (char_to_clump): Convert to unsigned char before invoking ISPRINT.
2622
2623         * src/nohup.c (main): Use bool for booleans.
2624         * src/paste.c (paste_parallel, paste_serial, main): Likewise.
2625         * src/pathchk.c (validate-path, main, portable_chars_only): Likewise.
2626         (portable_chars_only): Use to_uchar rather than a cast.
2627         * src/printenv.c (main): Use bool for booleans.
2628         Do not assume that the environ has at most one matching entry
2629         for each option (integer overflow was possible otherwise).
2630
2631         * src/od.c (FMT_BYTES_ALLOCATED): Now an enum, not a decimal
2632         constant.  Do not assume PRIdMAX etc. are strings of length 3 or
2633         less.
2634         (struct tspec): Use it.  fmt_string is now an array, not
2635         a pointer, as there's little point to the indirection here.
2636         (struct tspec, flag_dump_strings,
2637         traditional, flag_pseudo_start, limit_bytes_to_format,
2638         abbreviate_duplicate_blocks, have_read_stdin, simple_strtoul,
2639         decode_one_format, open_next_file, check_and_close,
2640         decode_format_string, skip, write_block, read_char, read_block,
2641         parse_old_offset, dump, dump_strings, main):
2642         Use bool for booleans.
2643         (struct tspec): Use void *, not char *, for generic pointers.
2644         (bytes_to_oct_digits, bytes_to_signed_dec_digits,
2645         bytes_to_unsigned_dec_digits, bytes_to_hex_digits):
2646         Use char, not unsigned int, since char suffices.
2647         (print_s_char, print_char, print_s_short, print_short,
2648         print_int, print_long, print_long_long, print_float,
2649         print_double, print_long_double): Rewrite to avoid casts.
2650         These now take void * arguments, instead of char *.
2651         Use the same body for all functions, except for the choice
2652         of type.  Assume C89 to simplify handling of signed char.
2653         (dump_hexl_mode_trailer, print_named_ascii, print_ascii):
2654         Rewrite to avoid casts.
2655         (print_named_ascii, print_ascii): Now takes void *, not char *.
2656         (decode_one_format): Use int for printf field widths, not
2657         unsigned int.  Pass void * to subsidiary printers,
2658         not char *.  Simplify handling of floating-point formats
2659         by factoring out common code dealing with precision and field width.
2660         (decode_format_string): Avoid need for temporary copy of
2661         each decoded struct tspec.
2662         (get_lcm): Remove unnecessary cast.
2663         (main): Fix bug where more than INT_MAX failed decodes were ignored.
2664
2665 2004-08-02  Paul Eggert  <eggert@cs.ucla.edu>
2666
2667         * src/nl.c (TRUE, FALSE): Remove; all uses changed to true, false.
2668         (enum number_format): Remove.
2669         (FORMAT_RIGHT_NOLZ, FORMAT_RIGHT_LZ, FORMAT_LEFT): Now strings,
2670         not enum values.
2671         (DEFAULT_SECTION_DELIMITERS): Now an array constant, not a macro.
2672         (section_del): Now const.
2673         (print_fmt): Remove.
2674         (starting_line_number, page_incr, blank_join, line_no,
2675         print_lineno, proc_text, main):
2676         Use intmax_t for line numbers.
2677         (reset_numbers, have_read_stdin, build_type_arg, nl_file, main):
2678         Use bool for booleans.
2679         (lineno_format): Now a string, not an enum value.
2680         (build_print_fmt): Remove.  All calls removed.  This work is
2681         now done within print_lineno.
2682         (build_type_arg): Use size_t for sizes.
2683         (print_lineno): Check for line number overflow.
2684         (proc_text, main): Remove unnecessary cast.
2685
2686         * src/ln.c (symbolic_link, interactive, remove_existing_files,
2687         verbose, hard_dir_link, dereference_dest_dir_symlinks,
2688         do_link, main): Use bool for booleans.
2689
2690         * src/ls.c (struct fileinfo, file_interesting,
2691         extract_dirs_from_files, color_symlink_as_referent,
2692         FILE_OR_LINK_MODE, sort_reverse, print_owner, print_group,
2693         numeric_ids, print_block_size, dired, print_with_color,
2694         check_symlink_color, print_inode, recursive, immediate_dirs,
2695         all_files, really_all_files, qmark_funny_chars,
2696         print_dir_name, format_needs_stat, format_needs_type, visit_dir,
2697         main, decode_switches, parse_ls_color, print_dir, file_interesting,
2698         gobble_file, make_link_path, basename_is_dot_or_dotdot,
2699         extract_dirs_from_files, print_long_format):
2700         Use bool for booleans.
2701         (dir_defaulted): Remove; no longer needed.
2702         (main): Use int to count files, since it suffices for argv.
2703         Rewrite to avoid need for dir_defaulted.
2704         (main, print_dir, gobble_file, get_link_name,
2705         xstrcoll):
2706         Set exit status to EXIT_SUCCES/EXIT_FAILURE rather than 0/1.
2707         (decode_switches): Put back check for ws.ws_col <= SIZE_MAX.
2708         Remove unnecessary cast to int.  Use int instead of unsigned
2709         int to count from 0 to 1.
2710         (get_funky_string, print_type_indicator): Use char for bytes, not int.
2711         (make_link_path): Use NULL for null pointers.
2712         (quote_name): Use to_uchar instead of cast.
2713
2714         * src/id.c (use_name, main, print_user, xgetgroups, print_group_list,
2715         print_full_info): Use bool for booleans.
2716         (problems): Remove, replacing with....
2717         (ok): New var (inverted from old sense).
2718         (print_user, print_group, print_full_info):
2719         Print uids/gids with %lu, not %u.
2720         (xgetgroups): Don't run out of memory if getgroups or getugroups
2721         returns -1.
2722         * src/setuidgid.c (main): Print uids/gids with %lu, not %ld.
2723
2724         * src/factor.c (wheel_tab): Use unsigned char instead of unsigned
2725         int, since it suffices.
2726         (factor, print_factors): Use size_t for sizes.
2727         (print_factors, do_stdin, main): Use bool for booleans.
2728         * src/fold.c (TAB_WIDTH): New macro; use it instead of "8".
2729         (fold_file, main): Use bool for booleans.
2730         (fold_file, main): Use size_t for sizes.
2731         (main): Allow -w options up to SIZE_MAX - TAB_WIDTH - 1, instead
2732         of prohibiting widths greater than INT_MAX.
2733         * src/head.c (presume_input_pipe, print_headers, have_read_stdin,
2734         write_header, elide_tail_bytes_pipe, elide_tail_bytes_file,
2735         elide_tail_lines_pipe, elide_tail_lines_seekable,
2736         elide_tail_lines_file, head_bytes, head_lines, head, head_file,
2737         string_to_integer, main):
2738         Use bool for booleans.
2739         (main): Rewrite to avoid cast.
2740
2741         * src/csplit.c (struct line): Use size_t for sizes.
2742         (main): Remove unnecessary cast.
2743         * src/cut.c (cut_fields): Use to_uchar rather than a cast.
2744         * src/cut.c (cut_file, main): Use bool for booleans.
2745         * src/date.c (show_date, rfc_format, batch_convert, main): Likewise.
2746         * src/env.c (main): Likewise.
2747         * src/expr.c (nextarg): Likewise.
2748         * src/env.c (main): Remove unused and nonstandard envp arg.
2749
2750         * src/fmt.c (COST, MAXWORDS): Add a comment describing some of
2751         fmt's arbitrary limits.
2752         (TRUE, FALSE): Remove; all uses changed to (true, false).
2753         (main): Use bool for booleans.
2754         Limit maximum width to MAXCHARS / 2.  Use xstrtoul, not xstrtol,
2755         to parse width.
2756         (copy_rest): Remove unnecessary cast.
2757         (get_prefix): Rewrite to avoid cast.
2758         (check_punctuation): Use char *, not unsigned char *; C89 requires
2759         this.  Avoid off-by-one buffer read overrun when line is empty.
2760         (flush_paragraph): Don't assume wptr-parabuf is <= INT_MAX.
2761         Remove unnecessary casts.
2762         * tests/fmt/basic (wide-1, wide-2, bad-suffix): Adjust to above
2763         changes.
2764
2765         * src/expand.c (convert_entire_line, have_read_stdin, parse_tabstops,
2766         next_file, expand, main):
2767         Use bool for booleans.
2768         (tab_size, tab_list, add_tabstop, parse_tabstops, validate_tabstops,
2769         expand, main):
2770         Use uintmax_t for column counts.
2771         (add_tabstop): Don't reserve -1 (now UINTMAX_MAX) as a special value.
2772         All callers changed.
2773         (parse_tabstops): Don't pass a negative char to isblank.
2774         Avoid memory leak with large tab stops.
2775         (validate_tabstops, expand): Don't assume number of tab stops is
2776         <= INT_MAX.
2777         (next_file, main): Use EXIT_SUCCESS/EXIT_FAILURE rather than 0/1 when
2778         storing values into exit_status.
2779         (expand): Use same pattern as unexpand for reading chars.
2780         Report an error when input line is too long, instead of silently
2781         screwing up.  Do not mishandle tab stops when backspacing left
2782         over start of line.
2783
2784         * src/dircolors.c (have_read_stdin, append_quoted,
2785         dc_parse_stream, dc_parse_file, main): Use bool for booleans.
2786         (dc_parse_stream): Use enum for state, rather than int.
2787         Use ssize_t to store getline result.
2788
2789         * src/dd.c (translation_needed, parse_integer, scanargs,
2790         apply_translations, char_is_saved, swab_buffer, skip_via_lseek):
2791         Use bool for booleans.
2792         (translate_buffer): Use to_uchar rather than a cast.
2793         (swab_buffer, copy_simple, copy_with_unblock):
2794         Use size_t for sizes.
2795
2796         * src/seq.c (equal_width, valid_format, main): Use bool for booleans.
2797         * src/sleep.c (apply_suffix): Likewise.
2798         * src/tail.c (struct File_spec, reopen_inaccessible_files, count_lines,
2799         forever, from_start, print_headers, have_read_stdin, valid_file_spec,
2800         write_header, file_lines, pipe_lines, pipe_bytes, recheck,
2801         tail_forever, tail_bytes, tail_lines, tail, tail_file,
2802         parse_obsolescent_option, parse_options, main): Likewise.
2803         * src/sleep.c (apply_suffix): Invert sense of result.
2804         Use int (not unsigned int) for multiplier, as this generates better
2805         code with some compilers.  Simplify code a bit.
2806         * src/tail.c (struct File_spec, max_n_unchanged_stats_between_opens,
2807         parse_options): Use uintmax_t, not unsigned int or unsigned long int,
2808         for state counters.
2809         (tail_bytes, tail_lines): Redo test of return value (-1, 0, 1) to
2810         make it a bit clearer.
2811
2812         * src/hostname.c: Include "xgethostname.h".
2813         (xgethostname): Remove decl; xgethostname.h has it.
2814         (sethostname) [!defined(HAVE_SETHOSTNAME) && defined(HAVE_SYSINFO)
2815         && defined (HAVE_SYS_SYSTEMINFO_H) && defined(HAVE_LIMITS_H)]: Use
2816         prototypes rather than K&R form.  Assume any negative value from
2817         sysinfo denotes failure, not just -1.
2818         (main): Simplify use of sethostname.
2819
2820         * src/pinky.c (include_idle, include_heading, include_fullname,
2821         include_project, include_plan, include_home_and_shell, do_short_format,
2822         include_where, main): Use bool for booleans.
2823         (count_ampersands, create_fullname, scan_entries, short_pinky):
2824         Use size_t for sizes.
2825         (create_fullname): Check for overflow in size calculations.
2826         (idle_string): Don't assume that the number of idle days
2827         is less than 10**8 and/or INT_MAX/(24*60*60).
2828         (main): No need to pass a non-NULL last arg to getopt_long.
2829         * src/uptime.c (print_uptime, uptime): Use size_t for sizes.
2830         (print_uptime): Remove unused local variable.
2831         (main): No need to pass a non-NULL last arg to getopt_long.
2832         * src/users.c (list_entries_users, users): Use size_t for sizes.
2833         (list_entries_users): Use char for bytes.
2834         (main): No need to pass a non-NULL last arg to getopt_long.
2835         * src/who.c (do_lookup, short_list, short_output, include_idle,
2836         include_heading, include_mesg, include_exit, need_boottime,
2837         need_deadprocs, need_login, need_initspawn, need_clockchange,
2838         need_runlevel, need_users, my_line_only, main): Use bool for booleans.
2839         (print_runlevel): Use unsigned char for bytes.
2840         (list_entries_who, scan_entries, who): Use size_t for sizes.
2841         (main): No need to pass a non-NULL last arg to getopt_long.
2842
2843         * src/install.c (isdir): Remove decl.
2844         (install_file_to_path): Rely on make_path to fail if the destination
2845         is not a directory, by passing preserve_existing==true to it.
2846         Hence we no longer need to call isdir.
2847         Free dest_dir immediately when it's no longer needed, rather than
2848         waiting until the end of the function.
2849         (copy_file): Don't bother calling isdir, as copy will do the
2850         right thing if the destination is a directory.
2851
2852         * src/du.c (fts_debug, opt_all, apparent_size, opt_count_all,
2853         print_grand_total, opt_separate_dirs, hash_ins, process_file, main):
2854         Use bool for booleans.
2855         (max_depth): Now size_t, not int, to avoid an arbitrary limit
2856         of INT_MAX on depth.
2857         (G_fail): Remove: no longer needed, now that the relevant
2858         functions return bool.
2859         (process_file): Use return value to signal success rather than
2860         setting a global.  Remove first_call static var; not needed, since
2861         we can look at n_alloc.  Use size_t for depths.  Remove FIXME
2862         about size_t casts, as it's now fixed.  Use xnrealloc rather
2863         than the obsolescent XREALLOC.  Don't bother to check whether
2864         reallocation is needed unless level > prev_level.
2865         (du_files): Invert sense of result, for consistency with
2866         other coreutils code.  All callers changed.
2867         (main): Allow --max-depth values up to SIZE_MAX.
2868
2869         * src/df.c (inode_format, show_all_fs, show_local_fs,
2870         show_listed_fs, posix_format, require_sync, print_type,
2871         selected_fstype, excluded_fstype, show_dev, show_point, main):
2872         Use bool for booleans.
2873         (df_readable, show_dev): Use UINTMAX_MAX instead of -1.
2874         (show_dev, show_point, main):
2875         Use EXIT_SUCCESS/EXIT_FAILURE instead of 0/1.
2876         Don't assume disk name lengths are <= INT_MAX.
2877         Rewrite pct calculation to avoid cast.
2878         (show_point): Don't assume resolved length is <= SSIZE_MAX.
2879
2880         * src/cut.c (hash_int) [!defined UINTPTR_MAX]: Use size_t
2881         instead of uintptr_t.
2882         * src/shred.c (UINT_MAX_32_BITS): Remove.
2883         (word32): Remove.  All uses changed to uint32_t.
2884         (isaac_seed_data): Remove unnecessary cast.
2885         * src/system.h (ptr_align): Use size_t; in practice, this is just as
2886         good as uintptr_t in checking for alignments, and has fewer
2887         configuration hassles.
2888
2889         * src/Makefile.am (localedir.h): Make it readonly; this
2890         undoes part of the 2004-07-27 patch.
2891
2892 2004-07-30  Paul Eggert  <eggert@cs.ucla.edu>
2893
2894         * src/sort.c (UCHAR): Remove; all uses changed to to_uchar.
2895         (IS_THOUSANDS_SEP): Use bool when appropriate.
2896         (numcompare, main): Use char, not int, when the value is always a char.
2897         (numcompare): Remove "register"; compilers are smart enough these days.
2898         * src/system.h (errno, CHAR_BIT): Remove decls;
2899         no longer needed now we assume C89 or better.
2900         Include <inttypes.h> before <stdint.h>, as it's the
2901         Autoconf-recommended pattern.
2902         (to_uchar): New inline function, moved here from tr.c.
2903         Use full names for int types, e.g. "long int" rather than "long".
2904         * src/tr.c (to_uchar): Remove; now in system.h.
2905         (is_char_class_member): Use bool when appropriate.
2906
2907         * src/mkdir.c (create_parents, main): Use bool when appropriate.
2908         (main): Use EXIT_SUCCESS/EXIT_FAILURE instead of 0/1.
2909
2910 2004-07-29  Paul Eggert  <eggert@cs.ucla.edu>
2911
2912         * src/mkfifo.c (main): Use EXIT_SUCCESS and EXIT_FAILURE, not 0 and 1.
2913
2914         * src/chmod.c (recurse, force_silent, process_file, process_files,
2915         main): Use bool when appropriate.
2916         * src/cksum.c (cksum, main): Likewise.
2917         * src/comm.c (hard_LC_COLLATE, only_file_1, only_file_2, both,
2918         compare_files, main): Likewise.
2919
2920         * src/copy.h (struct cp_options): Likewise.
2921         * src/copy.c (copy_internal, is_ancestor, copy_dir, copy_reg,
2922         same_file_ok, seen_file, copy_internal, valid_options, copy): Likewise.
2923         * src/cp-hash.h (remember_created): Likewise.
2924         * src/cp-hash.c (remember_created): Likewise.
2925         * src/cp.c (struct dir_attr, flag_path, remove_trailing_slashes,
2926         re_protect, make_path_private, target_directory_operand, do_copy,
2927         cp_option_init, decode_preserve_arg, main): Likewise.
2928         * src/install.c (isdir, change_timestamps, change_attributes,
2929         copy_file, install_file_to_path, install_file_in_dir,
2930         install_file_in_file, strip_files, dir_arg, cp_option_init, main,
2931         change_attributes, change_timestamps): Likewise.
2932         * src/mv.c (remove_trailing_slashes, rm_option_init,
2933         cp_option_init, do_move, movefile, main): Likewise.
2934         * src/remove.c (right_justify), full_filename_, AD_pop_and_chdir,
2935         AD_push, prompt, remove_dir): Likewise.
2936         * src/rm.c (rm_option_init, main): Likewise.
2937
2938         * src/remove.c (top_dir, pop_dir, full_filename_):
2939         Use size_t for sizes.
2940         * src/cp.c (target_directory_operand): Do not clear *NEW_DST if stat
2941         succeeds.  It's not necessary in that case, as *NEW_DST is always
2942         false already.
2943         (do_copy): Rewrite slightly to avoid need for "unreachable" comment.
2944         (main): Use EXIT_SUCCESS, EXIT_FAILURE instead of 0, 1.
2945         * src/rm.c (main): Likewise.
2946
2947         md5sum, sha1sum integer cleanups.
2948
2949         * src/checksum.h: Don't include config.h, sys/types.h, stdio.h:
2950         not needed.
2951         (ALG_UNSPECIFIED): Remove.
2952         (ALG_MDT): Don't make it equal to CHAR_MAX + 1; this isn't necessary.
2953         * src/md5.c: Don't include any files other than checksum.h.
2954         * src/sha1sum.c: Likewise.
2955         * src/md5sum.c (OPENOPTS, have_read_stdin, status_only, warn,
2956         bsd_split_3, split_3, hex_digits, digest_file, digest_check, main):
2957         Use bool when appropriate.
2958         (digest_check): Increase limit of number of input lines to
2959         UINTMAX_MAX from INT_MAX.  Diagnose any overflows of this counter.
2960         Use ngettext instead of hard-to-i18nize hardcoded stuff for plurals.
2961
2962 2004-07-28  Paul Eggert  <eggert@cs.ucla.edu>
2963
2964         * src/cat.c (exit_status): Remove.  Now done by passing a boolean
2965         'ok' flag around.
2966         (simple_cat, cat): Return true if successful.  All callers changed.
2967         (simple_cat, cat, main): Use bool for booleans.
2968         (simple_cat): Use size_t for sizes.
2969         (cat, main): Use the same names for parameters that we use for
2970         long options, to avoid confusion.  This inverts the sense of the
2971         show_tabs (formerly output_tabs) and number_nonblank
2972         (formerly numbers_at_empty_lines) variables.
2973         (main): Don't mess up (due to integer overflow) if we are given
2974         INT_MAX - INT_MIN + 1 options.
2975         [O_BINARY]: Don't invoke isatty unless the other options require it.
2976         (main): When deciding whether to use simple_cat, don't worry
2977         about binary option; it's irrelevant.
2978
2979         * src/dcgen: Remove comments, trailing white space, and empty
2980         lines from the output strings, to save space.
2981         Use a narrower type like 'unsigned char' for line lengths, if
2982         that will do.
2983         Make the output variables static, not extern.
2984
2985         * src/chgrp.c (parse_group): Require base 10 when parsing
2986         groups as integers.
2987         (main): int -> bool when appropriate.
2988         * src/chown.c (main): Likewise.
2989         * src/chown-core.c: Include inttostr.h.
2990         (UINT_MAX_DECIMAL_DIGITS, uint_to_string): Remove.
2991         (gid_to_name, uid_to_name): Use imaxtostr/umaxtostr
2992         instead of uint_to_string).
2993         (describe_change): Instead of an int flag, use a char *
2994         auxiliary; this avoids the need for casts.
2995         Assume free (NULL) works.
2996         (change_file_owner): Return true/false, not 0/-1, since
2997         we don't set errno.  All callers changed.
2998         Use bool when appropriate.
2999         (chown_files): Likewise.
3000         * src/chown-core.h (chown_files): Likewise.
3001
3002         * tests/chown/basic: Test for proper handling of uids like
3003         "010", which must be parsed as decimal.
3004
3005         * tests/misc/pwd: Don't assume that Perl's getpwd agrees with our
3006         pwd when there are multiple names for the working directory
3007         (which can happen with an automounter, sigh).
3008
3009         * src/Makefile.am ($(SCRIPTS)): Don't depend on Makefile;
3010         this causes Solaris 8 'make' to refuse to build "groups".
3011         (localedir.h): Don't depend on Makefile: this causes Solaris
3012         8 'make' to build localedir.h unnecessarily.  The dependence
3013         on Makefile is ineffective anyway, since $(localedir) might
3014         change even if Makefile hasn't.
3015
3016         * src/remove.c (remove_dir): If we can't save the state of the
3017         working directory, pretend we started from "/", not ".".
3018         This avoids a bug on hosts like Solaris that don't let you
3019         remove the working directory.
3020
3021 2004-07-27  Paul Eggert  <eggert@cs.ucla.edu>
3022
3023         * src/printf.c (strtiomax, strtoumax): Declare if not already
3024         declared: this fixes a portability bug with Solaris 8 + GCC.
3025         (STRTOX): Parenthesize use of macro arg as expression.
3026         (vstrtoimax, vstrtoumax, vstrtold): Remove now-unnecessary
3027         parentheses.
3028         * configure.ac: Check for declaration of strtoumax, for
3029         src/printf.c.
3030
3031         * src/Makefile.am (cp_LDADD, ginstall_LDADD, mv_LDADD,
3032         pathchk_LDADD, rm_LDADD, test_LDADD): New vars, for eaccess.
3033
3034         * tests/readlink/can-e: Don't assume that we can remove the
3035         working directory: this isn't possible under Solaris 8, say.
3036         * tests/readlink/can-f: Likewise.
3037         * tests/readlink/can-m: Likewise.
3038
3039         * src/copy.c (copy_internal): find_backup_file_name no longer
3040         returns NULL, so don't bother to check for this.
3041         * src/cp.c (do_copy): Likewise.
3042         * src/ln.c (do_link): Likewise.
3043
3044 2004-07-25  Paul Eggert  <eggert@cs.ucla.edu>
3045
3046         * src/nice.c (GET_NICE_VALUE): Renamed from GET_PRIORITY.
3047         All uses changed.
3048         (NZERO): New macro, if system doesn't define it already.
3049         (usage): Distinguish priorities from nice values.
3050         Don't assume NZERO is 20.
3051         (main): Use bool instead of int where appropriate.
3052         If user specifies an adjustment out of range, always truncate it
3053         to an inrange value instead of sometimes giving an error message
3054         and sometimes not.
3055         Do not assume that -1 is an error return from "nice" or
3056         "getpriority", as it might be the current nice value minus NZERO.
3057         If nice/setpriority fails with errno == EPERM, go ahead and run
3058         the command anyway; POSIX requires this.
3059
3060         * src/pathchk.c: Include euidaccess.h.
3061         (dir_ok): Use euidaccess, not access.
3062         * src/test.c (R_OK, W_OK, X_OK, FOK): Remove; system.h defines them.
3063         (eaccess): Remove.  All users changed to use euidaccess instead.
3064
3065 2004-07-24  Paul Eggert  <eggert@cs.ucla.edu>
3066
3067         * src/uptime.c (print_uptime) [defined BOOT_MSG]:
3068         Don't assume ut_line is null-terminated.
3069         * src/who.c (print_line): New arguments USERLEN and LINELEN,
3070         since USER and LINE might not be null terminated.  All callers
3071         changed.
3072
3073 2004-07-23  Paul Eggert  <eggert@cs.ucla.edu>
3074
3075         Fix bug with "tail -f" reported by Rob Holland in
3076         <http://lists.gnu.org/archive/html/bug-coreutils/2004-07/msg00054.html>.
3077         Also, remove the undocumented and unsupported-since-2000
3078         --max-consecutive-size-changes options.  Fix another related bug:
3079         "tail" got confused if stdin, stdout, or stderr were closed.
3080         Also, use output buffering even with "tail -f".
3081
3082         * NEWS: Document this, plus yesterday's patch.
3083         * doc/coreutils.texi (tail invocation): "size has remained the same"
3084         -> "file has not changed", which is more accurate for fifos.
3085         * src/tail.c: Include fcntl-safer.h.
3086         (COPY_TO_EOF): Set to UINTMAX_MAX, not OFF_T_MAX (which was wrong).
3087         (COPY_A_BUFFER): New macro.
3088         (struct File_spec): New members mtime, mode, blocking.
3089         Remove member n_consecutive_size_changes.
3090         (DEFAULT_MAX_N_CONSECUTIVE_SIZE_CHANGES,
3091         max_n_consecutive_size_changes_between_opens,
3092         MAX_CONSECUTIVE_SIZE_CHANGES_OPTION): Remove.
3093         (long_options, tail_forever, parse_options):
3094         Remove (non-)support for --max-consecutive-size-changes.
3095         (record_open_fd): New function.
3096         (recheck, tail_file): Use it.  Don't assume that stdin is open.
3097         (dump_remainder): Add support for new COPY_A_BUFFER special value.
3098         Treat errno==EAGAIN like EOF, since it might be a nonblocking read.
3099         (recheck): New arg BLOCKING, specifying whether to use blocking reads.
3100         All uses changed.
3101         (n_live_files): Remove, replacing with...
3102         (any_live_files): New function.  All uses changed.
3103         (tail_forever): Use nonblocking I/O unless we know that blocking I/O
3104         is safe; this avoids some hangs when reading from a fifo.
3105         Avoid invoking fstat or sleep when using blocking I/O.
3106         Do not check for changes to size if the file is not a regular file,
3107         as the size is undefined in that case.
3108         Check for changes to mtime or mode, too; this works for non-regular
3109         files.
3110         (tail_forever, main): Redo fflush strategy to work even when input
3111         is nonblocking.  Don't use unbuffered output; just flush when needed.
3112
3113 2004-07-22  Paul Eggert  <eggert@cs.ucla.edu>
3114
3115         * src/tail.c (main): Ignore -f if no file operand is specified
3116         and standard input is a pipe.
3117         * doc/coreutils.texi (tail invocation): Do not ignore -f for
3118         all pipes, just for when standard input is a pipe and no
3119         file operand is specified.
3120         * tests/tail/Test.pm: Reinstate f-1 test, since we now pass.
3121         Add a new commented-out f-2 test, which we still fail.
3122         (test_vector): All f-* tests are special cases, not just f-1.
3123
3124 2004-07-12  Paul Eggert  <eggert@cs.ucla.edu>
3125
3126         * src/uptime.c: Include c-strtod.h.
3127         (print_uptime): Use c_strtod instead of setlocale and sscanf.
3128         Use long int rather than int to count days (for 64-bit hosts),
3129         and check for arithmetic overflow when converting double to time_t.
3130
3131 2004-07-11  Paul Eggert  <eggert@cs.ucla.edu>
3132
3133         * src/printf.c (vstrtold): Renamed from vstrtod.
3134         Now returns long double.  All uses changed.
3135         (print_direc): Use "L" length modifier when printing floating point
3136         numbers, since we're now printing long double.
3137
3138 2004-07-06  Paul Eggert  <eggert@cs.ucla.edu>
3139
3140         printf cleanup, to avoid undefined behavior, to add support for
3141         formats that Bash supports, and to support wide integers like
3142         Bash does.
3143
3144         * NEWS: Document this.
3145         * src/printf.c (UNSPECIFIED): Remove.  All uses now replaced by
3146         booleans, so that we don't reserve any values for precision or
3147         width (like Bash).
3148         (STRTOX): Use prototype, not K&R-style definition.
3149         (vstrtoimax): Renamed from xstrtol (to avoid confusion with xstrtol
3150         in ../lib), with type change to intmax_t.
3151         All uses changed.
3152         (vstrtoumax): Renamed from xstrtoul, with type change to uintmax_t.
3153         All uses changed.
3154         (vstrtod): Renamed from xstrtod.  All uses changed.
3155         (print_direc): Use boolean arg instead of special value to indicate
3156         a missing precision or width.  LENGTH no longer includes
3157         length modifiers or conversion character.  New arg CONVERSION
3158         now specifies conversion character.
3159         Use intmax_t-width formatting for integers (like Bash).
3160         Add support for C99 %a, %A, %F (like Bash).
3161         Add support for field width with %c (POSIX requires this).
3162         Add a FIXME for lack of support for field width and precision
3163         for %b.
3164         Add support for '\'', '0' flags.
3165         Check for invalid combinations of flags, field width, precision,
3166         and conversion, to prevent use of undefined behavior.
3167         Allow multiple length modifiers, for formats like "%lld" (like Bash).
3168         Add support for C99 'j', 't', 'z' length modifiers (like Bash).
3169         In error message, output entire invalid conversion specification,
3170         instead of merely outputting % followed by the conversion char.
3171         * tests/misc/printf: Add tests for the above.
3172
3173 2004-04-03  Dmitry V. Levin  <ldv@altlinux.org>
3174
3175         Change "readlink -f" to be more compatible with prior implementations.
3176         Add more canonicalize options, -e and -m.
3177         Add comprehensive tests for all readlink modes.
3178
3179         * m4/canonicalize.m4 (AC_FUNC_CANONICALIZE_FILE_NAME):
3180         Do not add canonicalize.c here.
3181
3182         * src/readlink.c (longopts): Add new options.
3183         (usage): Document them.
3184         (canonicalize_fname): New proxy function.
3185         (main): Handle new options.
3186         * doc/coreutils.texi (readlink invocation): Document new
3187         "readlink -f" behaviour and new canonicalize options, -e and -m.
3188
3189         * configure.ac (AC_CONFIG_FILES): Add tests/readlink/Makefile.
3190         * tests/Makefile.am (SUBDIRS): Add readlink.
3191         * tests/readlink/Makefile.am: New file.
3192         * tests/readlink/{rl-1,can-e,can-f,can-m}: New readlink tests.
3193         * tests/misc/Makefile.am (TESTS): Remove basic readlink test.
3194         * tests/misc/readlink: Remove file.
3195
3196 2004-07-04  Jim Meyering  <jim@meyering.net>
3197
3198         * src/copy.c (copy_internal): Add a FIXME comment.
3199
3200 2004-07-02  Paul Eggert  <eggert@cs.ucla.edu>
3201
3202         * src/copy.c (copy_dir): Assume path_concat returns non-NULL.
3203         * src/cp.c (do_copy): Likewise.
3204         * src/mv.c (movefile): Likewise.
3205
3206         * src/cp.c (make_path_private): 2nd arg is now size_t, not int,
3207         to avoid problem when path_concat dir name is longer than 2 GiB (!).
3208
3209         * src/nohup.c (main): Don't pass NULL first argument to path_concat.
3210         This cleans up the semantics a bit, as we no longer try to open the
3211         same file twice.
3212
3213 2004-07-01  Paul Eggert  <eggert@cs.ucla.edu>
3214
3215         * NEWS: Add short names -t and -T for --target-directory
3216         and --no-target-directory options, respectively.
3217
3218         * src/cp.c (NO_TARGET_DIRECTORY_OPTION, TARGET_DIRECTORY_OPTION):
3219         Remove.  All uses changed to 'T' and 't', respectively.
3220         * src/install.c, src/ln.c, src/mv.c: Likewise.
3221
3222         * src/cp.c (long_opts, usage, do_copy, main): Add -t and -T as
3223         aliases for --target-directory and --no-target-directory,
3224         respectively.
3225         * src/install.c (long_options, main, usage): Likewise.
3226         * src/ln.c, src/mv.c: Likewise.
3227
3228 2004-07-01  Jim Meyering  <jim@meyering.net>
3229
3230         * Makefile.maint (sc_file_system): New target.
3231         (syntax-check-rules): Add it.
3232         .x-sc_file_system: New file.
3233         * Makefile.am (EXTRA_DIST): Add it.
3234
3235         * man/sync.x: Use "file system" rather than "filesystem".
3236         * man/stat.x, man/df.x: Likewise.
3237
3238 2004-06-30  Paul Eggert  <eggert@cs.ucla.edu>
3239
3240         * src/df.c (usage, main): Output "file system" rather than
3241         "filesystem".
3242         * src/du.c (usage): Likewise.
3243         * src/shred.c (usage): Likewise.
3244         * src/stat.c (usage): Likewise.
3245         * src/stat.c (long_options, usage): Rename "--filesystem" to
3246         "--file-system".  But keep the old name around, for compatibility
3247         reasons.
3248
3249 2004-06-29  Paul Eggert  <eggert@cs.ucla.edu>
3250
3251         Add support for --no-target-directory option.
3252
3253         * NEWS: Document it.
3254         * doc/coreutils.texi (Common options, Target directory, cp
3255         invocation, install invocation, mv invocation, ln invocation):
3256         Likewise.
3257         (link invocation): Explain how to rewrite link using ln now
3258         that we have --no-target-directory.
3259         (ln invocation): Explain that --no-target-directory subsumes
3260         --no-dereference.
3261         (unlink invocation): Modify wording to match new wording in
3262         link invocation.
3263
3264         * src/cp.c (NO_TARGET_DIRECTORY_OPTION): New constant.
3265         (long_opts, usage, do_copy, main): Add support for
3266         --no-target-directory,
3267         * src/install.c (NO_TARGET_DIRECTORY_OPTION, long_options, main,
3268         usage): Likewise.
3269         * src/ln.c (NO_TARGET_DIRECTORY_OPTION, long_options, usage,
3270         main): Likewise.
3271         * src/mv.c (NO_TARGET_DIRECTORY_OPTION, long_options, usage,
3272         main): Likewise.
3273         * src/mv.c (enum): Sort values.
3274
3275 2004-06-29  Jim Meyering  <jim@meyering.net>
3276
3277         Don't let verbose-mode output from a subshell obscure actual differences.
3278         * tests/rm/inaccessible: Turn off command-echoing just before
3279         invoking subshell, then turn it back on if VERBOSE=yes afterward.
3280
3281 2004-06-25  Paul Eggert  <eggert@cs.ucla.edu>
3282
3283         Add support for 'install --target-directory', an option
3284         that has been documented for years but not implemented (!).
3285         * doc/coreutils.texi (install invocation): Document
3286         --target-directory in synopsis, too.
3287         * src/install.c (TARGET_DIRECTORY_OPTION): New var.
3288         (long_options, main, usage): Add --target-directory.
3289         (target_directory_operand): New function, stolen from mv.c.
3290         (main): Use it.  Check for -d and --target-directory.
3291         Alter wording of diagnostics to match other programs.
3292
3293 2004-06-28  Jim Meyering  <jim@meyering.net>
3294
3295         * src/cp.c (usage): Fix copy+paste error in description of
3296         --target-directory: s/move/copy/.  From Paul Jarc.
3297
3298 2004-06-27  Paul Eggert  <eggert@cs.ucla.edu>
3299
3300         Use more-consistent rules among cp, ln, and mv when dealing with
3301         last operands that are (or look like) directories.
3302
3303         * src/cp.c (target_directory_operand): New, nearly-common function,
3304         It reports an error if the destination appears to be a directory
3305         (e.g., because it has a trailing slash) but is not.
3306         * src/ln.c, src/mv.c: Likewise.
3307         * src/cp.c (do_copy): Use it.
3308         * src/ln.c (main): Likewise.
3309         * src/mv.c (main): Likewise.
3310
3311         * src/cp.c (do_copy): Don't assume argc is positive.
3312         Don't bother to lstat dest, since copy() will do that for us.
3313         Use "const" to avoid the need for cast.
3314
3315         * src/cp.c (do_copy): Don't output a usage message because of file
3316         problems (e.g., an operand is not a directory).  Use it only for
3317         syntax.  Standardize on "target %s is not a directory" for the
3318         diagnostic.
3319         * src/ln.c (main): Likewise.
3320         * src/mv.c (main): Likewise.
3321
3322         * src/cp.c (do_copy): Remove test for trailing slash, since
3323         target_directory_operand now does this.
3324         * src/ln.c (main): Likewise.
3325         * src/mv.c (movefile): Likewise.
3326
3327         * src/cp.c (main): Reject multiple target directories.
3328         Check whether a specified target is a directory when parsing the
3329         options, using stat.  This gives more-accurate diagnostics.
3330         * src/ln.c (main): Likewise.
3331
3332         * src/ln.c (isdir): Remove decl; no longer needed.
3333         * src/mv.c (isdir, lstat): Likewise.
3334
3335         * src/ln.c (do_link): New arg dest_is_dir.  All uses changed.
3336         Don't check the destination ourself; rely on dest_is_dir.
3337         This way we can avoid lstatting the destination in the
3338         usual case, and in the worst case we lstat 1, not 3 times.
3339         Don't bother to unlink unless link failed; this saves a syscall.
3340         Remove unnecessary backup_succeeded flag;
3341         it was identical to "dest_backup != NULL".
3342
3343         * src/ln.c (main): Use int to count to argc, not unsigned int.
3344         This handles negative operand counts.
3345         * src/mv.c (main): Likewise.
3346
3347         * src/mv.c (do_move): Don't call hash_init; expect the caller to
3348         do it, for consistency with cp.c and ln.c.  All callers changed.
3349         (movefile): dest_is_dir parameter is now bool, not int.
3350         (main): Standardize on "missing destination file operand after %s"
3351         for the diagnostic, for consistency with cp.c.
3352
3353         * tests/mv/diag: Don't assume "mv --target=nonexistentdir"
3354         will complain about the arg count.
3355         Adjust to new (briefer) diagnostics.
3356         * tests/cp/fail-perm: Add a test to verify that we get the new
3357         diagnostic when failing to copy through a symlink-to-inaccessible-dir.
3358
3359 2004-06-27  Paul Eggert  <eggert@cs.ucla.edu>
3360
3361         Fix a bug: formerly, if d/x was a directory and x a file, "ln x
3362         d/" incorrectly created a link d/x/x.  It also saves some system
3363         calls.
3364
3365         * NEWS: Document the fix.
3366
3367         * src/ln.c (main): Don't append basename to dest if this
3368         results in an existing directory name.
3369         * tests/ln/misc: See whether a trailing slash is followed too far.
3370
3371 2004-06-26  Jim Meyering  <jim@meyering.net>
3372
3373         * src/printf.c (main): When given no arguments, print the standard
3374         "missing operand\nTry printf --help..." message -- to be consistent.
3375
3376 2004-06-26  Jim Meyering  <jim@meyering.net>
3377
3378         * src/mknod.c (main): Add \n at the end of message output via fprintf.
3379
3380 2004-06-25  Jim Meyering  <jim@meyering.net>
3381
3382         * tests/ln/misc: Add test for ln subscript error.
3383
3384 2004-06-23  Paul Eggert  <eggert@cs.ucla.edu>
3385
3386         * src/ln.c (do_link): Remove unnecessary call to lstat.
3387         (main): Avoid subscript error when the destination is "".
3388
3389 2004-06-23  Jim Meyering  <jim@meyering.net>
3390
3391         * tests/*: Replace all occurrences of `(exit N); exit' with
3392         `(exit N); exit N'.  Otherwise, those many tests could exit with
3393         improper exit status when exiting via e.g., a trapped interrupt.
3394         Thanks to a report from Bob Proulx.
3395
3396 2004-06-22  Paul Eggert  <eggert@cs.ucla.edu>
3397
3398         * src/who.c (idle_string, print_user): New arg boottime,
3399         specifying the most recent boot time.  All uses changed.
3400         (idle_string) Consider a line to be "old" if it hasn't been used
3401         since the last boot time.  Watch out for overflow when computing
3402         times, and for times in the future.
3403         (idle_string): Record latest boot time.
3404
3405 2004-06-22  Jim Meyering  <jim@meyering.net>
3406
3407         * src/test.c (usage): Correct description of `-t FD'.  The file
3408         descriptor, FD, is no longer optional.  Reported by Ton Nijkes.
3409
3410 2004-06-21  Paul Eggert  <eggert@cs.ucla.edu>
3411
3412         The 2004-06-19 fix for who and pinky was incomplete, as ctime
3413         has undefined behavior if the year precedes -999 or follows 9999.
3414         Since we have to stop using ctime anyway, we might as well use
3415         strftime and fix the FIXME, and support internationalized dates.
3416
3417         * NEWS: Document the new behavior.
3418         * src/who.c: Include "hard-locale.h".
3419         (time_format, time_format_width): New vars.
3420         (time_string, print_line): Use them.
3421         (main): Set them.
3422         (time_string): Use localtime + strftime instead of
3423         ctime, to avoid problems with years before -999 or after 9999.
3424         * src/pinky.c: Likewise.
3425
3426 2004-06-21  Paul Eggert  <eggert@cs.ucla.edu>
3427
3428         Fix bug: GNU 'ls' didn't count columns correctly if user or group
3429         names contained multibyte characters where the column count
3430         differed from the byte count.  This patch also corrects
3431         some comments.
3432
3433         * src/ls.c (format_user_or_group): New function, which counts
3434         columns correctly.
3435         (format_user, format_group): Use it.
3436         (format_user_or_group_width): New function, which counts columns
3437         correctly.
3438         (format_user_width, format_group_width): Use it.
3439
3440 2004-06-21  Jim Meyering  <jim@meyering.net>
3441
3442         * tests/priv-check: Quote "$PATH" in PATH=$PATH.
3443         Suggestion from Andreas Schwab.
3444
3445         * tests/priv-check: When running as root, be sure to propagate
3446         PATH through to the process we exec as non-root.
3447         Reported by michael@aplatform.com.
3448
3449         * src/mknod.c (main): Don't segfault when calculating the
3450         expected number of operands for `mknod NAME'.
3451
3452 2004-06-20  Jim Meyering  <jim@meyering.net>
3453
3454         * src/dd.c (input_seek_errno): Declare file-scoped variable as static.
3455
3456 2004-06-20  Paul Eggert  <eggert@cs.ucla.edu>
3457
3458         * src/basename.c (main):
3459         Standardize on the diagnostics given when someone gives
3460         too few operands ("missing operand after `xxx'") or
3461         too many operands ("extra operand `xxx'").
3462         Include "quote.h" and/or "error.h" if it wasn't already being included.
3463         * src/chgrp.c (main): Likewise.
3464         * src/chmod.c (main): Likewise.
3465         * src/chown.c (main): Likewise.
3466         * src/chroot.c (main): Likewise.
3467         * src/comm.c (main): Likewise.
3468         * src/cp.c (do_copy): Likewise.
3469         * src/csplit.c (main): Likewise.
3470         * src/date.c (main): Likewise.
3471         * src/dircolors.c (main): Likewise.
3472         * src/dirname.c (main): Likewise.
3473         * src/du.c (main): Likewise.
3474         * src/expr.c (main): Likewise.
3475         * src/hostid.c (main): Likewise.
3476         * src/hostname.c (main): Likewise.
3477         * src/id.c (main): Likewise.
3478         * src/install.c (main): Likewise.
3479         * src/join.c (add_file_name, main): Likewise.
3480         * src/link.c (main): Likewise.
3481         * src/ln.c (main): Likewise.
3482         * src/logname.c (main): Likewise.
3483         * src/md5sum.c (main): Likewise.
3484         * src/mkdir.c (main): Likewise.
3485         * src/mkfifo.c (main): Likewise.
3486         * src/mknod.c (main): Likewise.
3487         * src/mv.c (main): Likewise.
3488         * src/nohup.c (main): Likewise.
3489         * src/od.c (main): Likewise.
3490         * src/pathchk.c (main): Likewise.
3491         * src/ptx.c (main): Likewise.
3492         * src/readlink.c (main): Likewise.
3493         * src/rm.c (main): Likewise.
3494         * src/rmdir.c (main): Likewise.
3495         * src/seq.c (main): Likewise.
3496         * src/setuidgid.c (main): Likewise.
3497         * src/shred.c (main): Likewise.
3498         * src/sleep.c (main): Likewise.
3499         * src/sort.c (main): Likewise.
3500         * src/split.c (main): Likewise.
3501         * src/stat.c (main): Likewise.
3502         * src/test.c (beyond, main): Likewise.
3503         * src/touch.c (main): Likewise.
3504         * src/tr.c (main): Likewise.
3505         * src/tsort.c (main): Likewise.
3506         * src/tty.c (main): Likewise.
3507         * src/uname.c (main): Likewise.
3508         * src/uniq.c (main): Likewise.
3509         * src/unlink.c (main): Likewise.
3510         * src/uptime.c (main): Likewise.
3511         * src/users.c (main): Likewise.
3512         * src/who.c (main): Likewise.
3513         * src/whoami.c (main): Likewise.
3514
3515         * tests/basename/basic: Adjust to new diagnostics.
3516         * tests/du/files0-from: Likewise.
3517         * tests/expr/basic: Likewise.
3518         * tests/mv/diag: Likewise.
3519         * tests/tsort/basic-1: Likewise.
3520
3521 2004-06-20  Jim Meyering  <jim@meyering.net>
3522
3523         * src/ln.c: Remove declaration of yesno.
3524         Instead, include yesno.h.
3525         * src/copy.c: Likewise.
3526
3527         * src/remove.c: Remove declaration of yesno.
3528         Instead, include yesno.h.
3529         (top_dir): Remove now-unnecessary cast of obstack_base.
3530         (pop_dir): Likewise.
3531         (full_filename_): Likewise.
3532
3533 2004-06-19  Paul Eggert  <eggert@cs.ucla.edu>
3534
3535         Don't dump core if ctime returns NULL; this is possible on
3536         hosts with 64-bit time_t and 32-bit int.
3537         * src/who.c: Include "inttostr.h".
3538         (time_string): If ctime fails, print the raw time as an integer
3539         instead of dumping core.
3540         * src/pinky.c: Likewise, as follows:
3541         Include "inttostr.h".
3542         (time_string): New function, copied from who.c.
3543         (print_entry): Use it.
3544
3545 2004-06-19  Paul Eggert  <eggert@cs.ucla.edu>
3546
3547         * src/who.c (print_line): Don't truncate user names at 8 bytes.
3548         Problem reported by Guido Leenders in:
3549         http://lists.gnu.org/archive/html/bug-coreutils/2004-06/msg00056.html
3550         * NEWS: document this.
3551
3552 2004-06-19  Jim Meyering  <jim@meyering.net>
3553
3554         * src/system.h (case_GETOPT_VERSION_CHAR): Switch back to
3555         using GNU_PACKAGE (from PACKAGE) once again.  This restores
3556         `GNU' to the parenthesized package name in --version output.
3557         Before, the first argument from AC_INIT, `GNU coreutils', would
3558         be propagated to the PACKAGE variable.  Now, `GNU ' is trimmed.
3559         Reported by Richard Stallman.
3560
3561 2004-06-17  Jim Meyering  <jim@meyering.net>
3562
3563         * src/tr.c (to_uchar): Rename function from `uchar'.  The latter
3564         would clash with a typedef in Tru64's <sys/types.h>.  From Albert Chin.
3565
3566 2004-06-15  Paul Eggert  <eggert@cs.ucla.edu>
3567
3568         * NEWS: Remove more special cases for POSIXLY_CORRECT when POSIX
3569         allows the GNU behavior.  "--" is now supported by chroot, hostid,
3570         hosname, pwd, sync, yes.
3571         * doc/coreutils.texi (yes invocation, false invocation,
3572         true invocation): Document this.
3573         * src/chroot.c (main): Handle "--".
3574         * src/hostid.c (main): Likewise.
3575         * src/hostname.c (main): Likewise.
3576         * src/pwd.c (main): Likewise.
3577         * src/sync.c (main): Likewise.
3578         * src/yes.c (main): Likewise.
3579         * src/true.c (main): Recognize --help and --version even if
3580         POSIXLY_CORRECT is set.
3581         * src/yes.c (main): Likewise.
3582
3583 2004-06-09  Paul Eggert  <eggert@cs.ucla.edu>
3584
3585         * NEWS: Remove special cases for POSIXLY_CORRECT when POSIX allows
3586         the GNU behavior.
3587         * doc/coreutils.texi (pr invocation, unlink invocation): Document this.
3588         * src/ls.c (decode_switches): Pay attention to TABSIZE even if
3589         POSIXLY_CORRECT is set.  POSIX reserves upper-case environment
3590         variables to the implementation, so it's OK for ls to depend on
3591         TABSIZE.
3592         * src/pr.c: Include "hard-locale.h".
3593         (main): When in a non-POSIX locale, ignore POSIXLY_CORRECT, since
3594         POSIX specifies the behavior only in the POSIX locale.
3595         * src/printf.c (print_esc): Support \x, \u, \U even if POSIXLY_CORRECT,
3596         since POSIX says the behavior is unspecified here.
3597         * src/tail.c (parse_obsolescent_option): Support multiple file operands
3598         even if POSIXLY_CORRECT, since POSIX does not require a diagnostic.
3599         * src/printf.c (main): Recognize --help, --version even if
3600         POSIXLY_CORRECT.  POSIX does not specify any options, but it
3601         does not prohibit options either, so "printf" is like "expr" here.
3602         * src/unlink.c (main): Likewise.
3603         * tests/misc/printf: Adjust to the new semantics for \x if
3604         POSIXLY_CORRECT.
3605
3606 2004-06-14  Jim Meyering  <jim@meyering.net>
3607
3608         * tests/misc/pwd: New test, for fix of 2004-04-19.
3609         * tests/misc/Makefile.am (TESTS): Add pwd.
3610         (BUILD_SRC_DIR): Define BUILD_SRC_DIR.
3611
3612         * src/copy.c: Remove declaration of euidaccess.
3613         Instead, include "euidaccess.h".
3614
3615 2004-06-13  Paul Eggert  <eggert@cs.ucla.edu>
3616
3617         * src/who.c (PIDSTR_DECL_AND_INIT): Don't assume pid_t fits in int.
3618         (UT_ID) [!HAVE_STRUCT_XTMP_UT_ID]: Remove bogus comment,
3619         as (sizeof "??") reliably returns 3.
3620         (print_line): Guard against idle and pid being too long
3621         (which is possible when printing headers).
3622         (print_user): Allocate enough bytes for idlestr.  Use IDLESTR_LEN.
3623         Avoid unnecessary cast of sizeof to int.
3624         (make_id_equals_comment): Do not assume that UT_ID returns
3625         a string; it might return a non-null-terminated array.
3626         Use strncat instead.  It's not very often where strncat is
3627         exactly what you want, but this is one of those rare cases.
3628
3629 2004-06-11  Paul Eggert  <eggert@cs.ucla.edu>
3630
3631         * src/who.c (list_entries_who): Don't output a trailing space.
3632
3633 2004-06-09  Jim Meyering  <jim@meyering.net>
3634
3635         * src/touch.c (usage): Improve wording in description of the
3636         --time=WORD option.  Reported by Dan Jacobson.
3637
3638         * src/chown-core.c (change_file_owner): Change names of parameters
3639         old_uid and old_gid to required_uid and required_gid respectively.
3640
3641         * src/chmod.c (mode_changed): Return false, not 0, now that the
3642         function returns `bool'.
3643
3644 2004-06-08  Paul Eggert  <eggert@cs.ucla.edu>
3645
3646         Adjust chmod and chown to be similar if -c or -v are given.  In
3647         particular, a no-op chown is no longer reported as a change; this
3648         reverts to previous behavior.  Also, fix both commands so that -v
3649         report failures even if the failure is not due to the chmod or
3650         chown syscalls.
3651
3652         * src/chmod.c (CH_NOT_APPLIED): New constant.
3653         (describe_change): Handle it.
3654         (process_file): Use it, if a symlink wasn't changed.
3655         (mode_changed): Return bool, not int.  Accept new argument
3656         NEW_MODE; all callers changed.  This lets us avoid statting the
3657         file unless the new mode has unusual bits.
3658         (process_file): Return -1 on error.  With -v, report all errors
3659         verbosely, not just some.
3660
3661         * src/chown-core.c (change_file_owner): Return -1 on error, not
3662         1 sometimes and -1 on others.  Our caller ORs together our results,
3663         and (-1 | 1) == 0 on ones-complement hosts.
3664         With -v report all errors verbosely, not just some.
3665         Fix bug when chopt->root_dev_ino && !chopt->affect_symlink_referent:
3666         file_stats wasn't set properly in that case.
3667
3668         * tests/chgrp/basic: Adjust to above changes.
3669
3670 2004-05-20  Paul Eggert  <eggert@cs.ucla.edu>
3671
3672         * tests/chgrp/basic: Test that chgrp -h does not fail on
3673         symlinks, even on hosts where that's not supported.
3674         Test that if -R is specified without -H or L, -h is assumed.
3675         Test that chown() is not optimized away.
3676
3677 2004-05-18  Paul Eggert  <eggert@cs.ucla.edu>
3678
3679         Several fixes to chgrp and chown for compatibility with POSIX and BSD:
3680
3681           Check for incompatible options.  When -R and --dereference are
3682           both used, then either -H or -L must also be used.  When -R and -h
3683           are both used, then -P must be in effect.
3684
3685           -H, -L, and -P have no effect unless -R is also specified.
3686           If -P and -R are both specified, -h is assumed.
3687
3688           Do not optimize away the chown() system call when the file's owner
3689           and group already have the desired value.  This optimization was
3690           incorrect, as it failed to updated the last-changed time and reset
3691           special permission bits, as POSIX requires.
3692
3693           Do not report an error if the owner or group of a
3694           recursively-encountered symbolic link cannot be updated because
3695           the file system does not support it.
3696
3697         * NEWS: Document the above.
3698
3699         * src/chgrp.c (main): Check for incompatible options.  -R --dereference
3700         requires either -H or -L, and -R -h requires -P.  If -H, specify
3701         FTS_PHYSICAL as well as FTS_COMFOLLOW; this is faster.  Make this
3702         file as much like chown.c as possible.
3703         * src/chown.c (main): Likewise.
3704
3705         * src/chown-core.c (change_file_owner): Use ent->fts_statp only if
3706         needed.  Chown a directory only after chowning its children; this
3707         avoids problems if the new directory ownership doesn't permit
3708         access to the children.  Dereference symlinks before doing
3709         ROOT_DEV_INO_CHECK, not after, so that we catch symlinks to /.
3710         Do not optimize away the chown() system call when the file's owner
3711         and group already have the desired value.  POSIX does not permit
3712         this optimization.  Rely on chown and lchown to do the right
3713         thing with symlinks and/or -1 arguments, now that we have wrappers
3714         to do this.  Use ENOTSUPP not ENOSYS, and ignore all ENOTSUPP
3715         errors, not just command-line errors.
3716         (chown_files): Pass FTS_NOSTAT to xfts_open if we don't need file status.
3717
3718         * src/system.h (ENOTSUP): Remove.
3719
3720         * tests/chgrp/basic: Use chown --from to discover whether the
3721         group changed, since chgrp now changes unconditionally.  This
3722         complicates the sed script a bit.  Do not specify --dereference,
3723         since it's the default (and we want to test this).  Adjust output
3724         to match the fact that chgrp no longer optimizes the case of
3725         changing a file's group to the same value as before.
3726         * tests/chgrp/posix-H: Do not attempt to combine -h and -H; these
3727         options are incompatible, and their behavior is undefined with POSIX.
3728         (changed, not_changed): Adjust to match the fact that -h is no longer
3729         specified.  Sort names.
3730         * tests/chown/deref: Adjust error-diagnostic spelling to match new
3731         behavior.
3732
3733 2004-06-07  Paul Eggert  <eggert@cs.ucla.edu>
3734
3735         * src/uname.c (main): Fix typo introduced on 2003-05-10 that
3736         prevented a diagnostic of any operands.
3737
3738 2004-06-08  Jim Meyering  <jim@meyering.net>
3739
3740         * src/shred.c (direct_mode): Turn it on/off with directio, too.
3741
3742 2004-06-07  Jim Meyering  <jim@meyering.net>
3743
3744         Enable direct-mode I/O (bypassing the buffer cache), if possible.
3745         Prompted by a suggestion from Kalle Olavi Niemitalo
3746         in http://bugs.debian.org/207035.
3747         * src/shred.c (direct_mode): New function.
3748         (do_wipefd): Turn on direct-mode I/O.
3749         (dopass): If a file's first write fails with EINVAL,
3750         turn off direct-mode I/O and retry the write.
3751
3752 2004-06-05  Paul Eggert  <eggert@cs.ucla.edu>
3753
3754         * src/tr.c (main): "tr -d a b" is now a fatal error even if
3755         POSIXLY_CORRECT is set.  The POSIX SYNOPSIS does not allow this
3756         option combination.
3757
3758 2004-06-04  Paul Eggert  <eggert@cs.ucla.edu>
3759
3760         * src/shred.c (dopass): Don't subtract 1 from the offset after
3761         a write error.  Problem reported by Jon Peatfield in:
3762         http://lists.gnu.org/archive/html/bug-coreutils/2004-06/msg00020.html
3763
3764 2004-06-02  Paul Eggert  <eggert@cs.ucla.edu>
3765
3766         Fix bug reported by Buciuman Adrian in
3767         <http://mail.gnu.org/archive/html/bug-coreutils/2003-08/msg00105.html>
3768         where 'dd' created a file that was too large.  The bug was that dd
3769         assumed that the input file offset does not advance after a failed
3770         read; but POSIX says that the input file offset is undefined after
3771         a failed read.
3772
3773         * src/dd.c (MAX_BLOCKSIZE): New macro.
3774         (input_seekable, input_seek_errno, input_offset,
3775         input_offset_overflow): New vars.
3776         (scanargs): Reject block sizes greater than MAX_BLOCKSIZE.
3777         (advance_input_offset): New function.
3778         (skip_via_lseek): Set errno to zero when reporting our failure,
3779         so that we don't report based on garbage errno.
3780         (skip): If fdesc is standard input, advance the input offset.
3781         Do not quit if reading, and if noerror was specified;
3782         POSIX seems to require this.
3783         If read fails on output file, report the earlier lseek failure
3784         instead; this fixes a FIXME in dd_copy.
3785         (advance_input_after_read_error): New function.
3786         (dd_copy): Use it, instead of assuming that failed reads
3787         do not advance the file pointer.  Advance input offset
3788         after nonfailed reads.  Advance only a partial block if
3789         the previous read (before the failed read) succeeded, and
3790         do not generate an output block of zeros in this case.
3791         (main): Determine initial input offset, seekability of input,
3792         and error if it wasn't seekable.
3793
3794 2004-06-02  Jim Meyering  <jim@meyering.net>
3795
3796         rm (without -f) could hang unnecessarily when attempting to
3797         remove a symlink to a file on an off-line NFS-mounted partition.
3798         Reported by David Howells in https://bugzilla.redhat.com/124699.
3799         * src/remove.c (write_protected_non_symlink): New function.
3800         Don't invoke euidaccess on symlinks.
3801         (prompt): Use write_protected_non_symlink rather than using
3802         euidaccess directly, being careful not to call lstat twice for a file.
3803
3804         Fix a bug in how the --output-delimiter=D option works with
3805         abutting byte or character ranges.  Reported by David Krider in
3806         http://lists.gnu.org/archive/html/bug-coreutils/2004-05/msg00132.html
3807         * src/cut.c (print_kth): Remove special case for open-ended range.
3808         (set_fields): Record the range start index for an interval even
3809         when it abuts another interval on its low side.
3810         Also record the range start index of the longest right-open-interval.
3811         * tests/cut/Test.pm: Add tests of --output-delimiter=S with
3812         abutting and overlapping byte ranges.
3813
3814 2004-06-01  Paul Eggert  <eggert@cs.ucla.edu>
3815
3816         Some POSIX-conformance cleanups for tr.
3817
3818         * src/tr.c (posix_pedantic): Remove; no longer needed since
3819         we need to test this in just one place now.
3820         (usage): Mention -C.
3821         (unquote): Note that \055, \n, etc are escaped.
3822         Do not worry about POSIXLY_CORRECT when warning about ambiguous
3823         escape sequences.
3824         \ at end of string stands for itself.
3825         Do not diagnose invalid backslash escapes: POSIX says the behavior
3826         is unspecified in this case, so we don't need to diagnose it.
3827         (main): Add support for -C (currently an alias for -c).
3828         Do not diagnose 'tr [:upper:] [:upper:], as POSIX does not require
3829         a diagnostic here.
3830         * tests/tr/Test.pm: New tests bs-055, bs-at-end, repeat-Compl.
3831         Fix comment for range-a-a.
3832
3833 2004-05-25  Paul Eggert  <eggert@cs.ucla.edu>
3834
3835         Improve the efficiency (and in one case, correctness) of code
3836         that reads symlinks.
3837
3838         * src/copy.c (copy_internal): Don't use alloca, as it can mess up
3839         royally if the link length is long (e.g., GNU/Hurd).  Use
3840         xreadlink instead, it's safer.  Don't bother to read the link if
3841         it's the wrong size.  Add a FIXME because this area is a bit murky
3842         and undocumented.
3843         * src/ls.c (get_link_name): Update use of xreadlink.
3844         * src/readlink.c (main): Likewise.
3845         * src/stat.c (print_stat): Likewise.
3846
3847 2004-06-01  Jim Meyering  <jim@meyering.net>
3848
3849         * src/env.c (main): Prefer the notation `STREQ (a, b)'
3850         over `!strcmp (a, b)'.
3851         * src/sort.c (main, sort_buffer_size): Prefer the notation
3852         `STREQ (a, b)' over `strcmp (a, b) == 0'.
3853         * src/date.c (batch_convert): Likewise.
3854         * src/expr.c (nextarg): Likewise.
3855         * src/su.c (correct_password, restricted_shell, main): Likewise.
3856         * src/ptx.c (swallow_file_in_memory, main): Likewise.
3857         * src/test.c (binary_operator, and, or, main): Likewise.
3858
3859 2004-05-13  Paul Eggert  <eggert@cs.ucla.edu>
3860
3861         * NEWS: echo compatibility cleanup.
3862         * doc/coreutils.texi (echo invocation): Document the changes.
3863         * src/echo.c (V9_ECHO): Remove; always enabled.
3864         (DEFAULT_ECHO_TO_XPG): Renamed from V9_DEFAULT, so that
3865         we use the same naming convention as bash.  Now an enum,
3866         not a macro.
3867         (usage): Reword to mention -e/-E more accurately.
3868         Mention \0NNN (the POSIX syntax) rather than \NNN (nonstandard).
3869         (hextobin): New function.
3870         (main): Use bool rather than int for local vars when appropriate.
3871         Do not allow options if POSIXLY_CORRECT, unless we are using
3872         BSD semantics and the first argument is "-n".
3873         Don't pass unnecessary extra arg to parse_long_options.
3874         do_v9 now defaults to DEFAULT_ECHO_TO_XPG, not to allow_options.
3875         Do not look for options if !allow_options.
3876         Use size_t rather than int when appropriate.
3877         Open-code option test rather than using strrchr.
3878         Use faster test for "-".
3879         Avoid redundant argc test.
3880         Add support for \x, for Bash compatibility.
3881         Use e.g. '\a' rather than '\007', for portability to EBCDIC hosts.
3882         When '\c' is encountered, stop printing immediately, as POSIX
3883         requires.
3884         Add support for \xhh syntax.
3885         Add support for \0ooo syntax; POSIX requires this.
3886
3887 2004-06-01  Jim Meyering  <jim@meyering.net>
3888
3889         * Use automake-1.8b.  Regenerate dependent files.
3890
3891 2004-05-31  Jim Meyering  <jim@meyering.net>
3892
3893         * tests/Makefile.am.in (TESTS_ENVIRONMENT): Define PATH to include
3894         the build src/ directory -- at the front.
3895         ($(srcdir)/$x-tests): Depend on Makefile.am.
3896         Use $x as the program name, except when it would be `test' (test is
3897         the sole program tested via mk-script that is also a shell built-in).
3898         In that case, use the old ../../src/$x.
3899
3900 2004-05-30  Jim Meyering  <jim@meyering.net>
3901
3902         Work around HPUX /bin/cc compiler bug that is exposed, now that
3903         sets are arrays of type `bool'.  More details here:
3904         http://lists.gnu.org/archive/html/bug-gnulib/2004-05/msg00094.html
3905         FIXME: verify that the above URL points to the right message
3906
3907         * src/tr.c (card_of_complement): Use cleaner `sizeof in_set'
3908         rather than `N_CHARS * sizeof(in_set[0])'.  Using HPUX's /bin/cc
3909         (aC++/ANSI C B3910B A.05.55 [Dec 04 2003]) on an ia64-hp-hpux11.22
3910         system, those two expressions are not the same (256 vs. 1024).
3911         The effect of this problem was that `tr -c x y' would fail:
3912         tr: when not truncating set1, string2 must be non-empty
3913         (set_initialize): Remove unnecessary initialization of the `in_set'
3914         buffer; that initialization triggered the same compiler bug as above.
3915
3916 2004-05-29  Paul Eggert  <eggert@cs.ucla.edu>
3917
3918         tr cleanup, mostly having to do with integer type ranges.
3919         Remove all casts.
3920
3921         * tests/tr/Test.pm: Add a few tests for the below.  Alas, most of
3922         the test cases wouldn't be portable, or would take too much CPU
3923         time, or both.
3924
3925         * src/tr.c (N_CHARS, N_CHAR_CLASSES): Now an enum, not a macro.
3926         This is safe since the code already assumes N_CHARS fits in int.
3927         (Filter): Remove: we want to prototype everything.
3928         (ORD, CHR): Remove.  All uses removed.  Some replaced with:
3929         (uchar): New function.  All places where a char must be converted
3930         to an unsigned char are now done this way, not by ad-hoc methods.
3931         (count): New type.  Use it whenever counts or states are needed.
3932         (BEGIN_STATE): Increase from INT_MAX - 1 (which was bogus, anyway,
3933         since we used it in an unsigned int context) to UINTMAX_MAX - 1.
3934         (REPEAT_COUNT_MAXIMUM): New macro.  Use it in place of BEGIN_STATE
3935         whenever appropriate.
3936         (NOT_A_CHAR): Remove global macro; now a local enum.
3937         (UL_LOWER, UL_UPPER, UL_NONE): No longer specify values, since
3938         the rest of the code no longer depends on them.
3939         (class_ok): Remove; all uses changed to use inline comparisons.
3940         (RE_NO_TYPE): Remove; wasn't used or needed.
3941         (struct List_element): normal_char and equiv_code are now unsigned
3942         char, not int.
3943         first_char, last_char, and the_repeated_char are now unsigned char,
3944         not unsigned int.  repeat_count is now count, not size_t.
3945         All uses changed.
3946         (struct Spec_list): state is now count, not unsigned int.
3947         lengthis now count, not size_t.
3948         n_indefinite_repeats is now size_t, not int.
3949         has_equiv_class, has_char_class, and has_restricted_char_class
3950         are now bool, not int.  All uses changed.
3951         (struct E_string): s is now char *, not unsigned char *.
3952         escaped is now bool *, not int *.  All uses changed.
3953         (ES_MATCH): Remove macro, replacing with:
3954         (es_match): New inline function.  All uses changed.
3955         (squeeze_repeats, complement, posix_pedantic, truncate_set1,
3956         translating): Now bool, not int.
3957         (io_buf): Now char array, not unsigned char.
3958         (SET_TYPE): Remove.  All uses replaced with bool.
3959         (is_equiv_class_member, unquote, append_range, append_char_class,
3960         append_equiv_class, find_closing_delim, star_digits_closebracket,
3961         build_spec_list, parse_str, homogeneous_spec_list):
3962         Now returns bool, not int.  All uses changed.
3963         (is_equiv_class_member): Now inline.
3964         (is_equiv_class_member, is_char_class_member, make_printable_str,
3965         append_normal_char, append_range, append_repeated_char,
3966         get_s2_spec_stats):
3967         Args are now of proper integer type.
3968         (unquote, look_up_char_class, make_printable_str,
3969         append_equiv_class, build_spec_list, squeeze_filter):
3970         Avoid unsigned char *p; gently convert *p to unsigned char instead.
3971         (unquote, get_spec_stats): Do not jump past declarations and then
3972         use them; C doesn't allow this in portable programs.
3973         (make_printable_str): Check for overflow in size calculations.
3974         (xmemdup): Remove.  All uses rewritten.
3975         (find_bracketed_repeat): Args are now of proper pointer-to-integer
3976         type.  Do not reject [c*0].  Use xstrtoumax, not xstrtoul.
3977         (find_bracketed_repeat, star_digits_closebracket): Check that the
3978         digits are not escaped.
3979         (build_spec_list): Don't bother to copy opnd_str; not needed.
3980         (build_spec_list, get_next): Simplify internal logic a bit.
3981         (card_of_complement): Fix bug due to char overflow.
3982         (get_spec_stats): Don't assume len fits into int.
3983         Check for integer overflow.  Use abort() rather than assert(0).
3984         (string2_extend): Fix subscript error: is_char_class_member (..., 255)
3985         was being invoked.
3986         (squeeze_filter): READER is never null now; simplify code.
3987         READER arg now has a simpler type.  Remove unnecessary casts.
3988         (squeeze_filter, main): Calls to fwrite improperly checked result
3989         against zero, rather than against requested size.
3990         (plain_read): New function.
3991         (read_and_delete, read_and_xlate):
3992         Remove unused filter arg, and don't worry about hit_eof.
3993         Simplify by using plain_read.
3994         (set_initialize): Args are bool and bool *, not int and SET_TYPE *.
3995         (main): Always pass a non-null procedure to squeeze_filter.
3996         Rewrite so that class_ok isn't needed.
3997
3998 2004-05-29  Paul Eggert  <eggert@cs.ucla.edu>
3999
4000         * src/shred.c (dosync): Ignore EBADF errors, as IRIX 6.5
4001         fdatasync reports EBADF when syncing (unwritable) directories.
4002         Problem reported by Albert Chin-A-Young in:
4003         http://lists.gnu.org/archive/html/bug-coreutils/2004-05/msg00165.html
4004
4005 2004-05-29  Jim Meyering  <jim@meyering.net>
4006
4007         * tests/chown/deref: Fix typo: use ls -ldo, not ls -ldg.
4008         Patch from Albert Chin.
4009
4010         * src/ptx.c (text_buffer_maxend): Remove declaration of unused variable.
4011
4012         * src/remove.c (push_dir): Merge declaration and adjacent assignment
4013         into a single statement.
4014
4015 2004-05-28  Jim Meyering  <jim@meyering.net>
4016
4017         * src/remove.c (AD_mark_helper): Eliminate an unnecessary comparison.
4018
4019 2004-05-22  Jim Meyering  <jim@meyering.net>
4020
4021         rm -r would get a failed assertion when run from an inaccessible
4022         directory and with two or more command line arguments including an
4023         absolute-named directory followed by a relative-named directory.
4024
4025         * src/remove.h (struct rm_options) [require_restore_cwd]: New member.
4026         * src/remove.c (struct cwd_state): Define.
4027         (AD_pop_and_chdir): Redesign interface so that a restore_cwd failure
4028         can be detected by the caller.  Instead of returning a malloc'd
4029         directory name, communicate it to caller via a new parameter, and
4030         return an indication of whether restore_cwd failed.  Update caller.
4031         Eliminate an unnecessary call to AC_stack_top.
4032         (remove_dir): Change type of cwd_state parameter to `struct cwd_state'
4033         so we can now communicate to caller whether/how functions like
4034         restore_cwd have failed.  Update caller.
4035         (rm_1): Fail if we've failed to restore the working directory
4036         and the name of the next file to remove is `.'-relative.
4037         (rm): Fail if the require_restore_cwd flag is true and we've
4038         failed to restore the working directory.
4039         * src/mv.c (rm_option_init): Initialize new member,
4040         x->require_restore_cwd.
4041         * src/rm.c (rm_option_init): Likewise.
4042
4043 2004-05-21  Jim Meyering  <jim@meyering.net>
4044
4045         * tests/rm/inaccessible: New test for the above fix.
4046         * tests/rm/Makefile.am (TESTS): Add inaccessible.
4047
4048         * src/remove.c (rm): Use free rather than XFREE.
4049         (remove_dir): Use xmalloc, not XMALLOC.
4050         (ds_init): Likewise.
4051
4052 2004-05-20  Jim Meyering  <jim@meyering.net>
4053
4054         * Makefile.maint (sc_unmarked_diagnostics): Now that the unmarked
4055         diagnostics in shred.c have been fixed, don't exempt shred.c from
4056         this check.
4057
4058         * src/shred.c: Use translatable diagnostics, e.g.
4059         change "%s: remove" to _("%s: failed to remove") and
4060         change "%s: close"  to _("%s: failed to close").
4061
4062 2004-05-17  Paul Eggert  <eggert@cs.ucla.edu>
4063
4064         * src/shred.c (names): Bring back lower-case letters, "_", and
4065         ".".  But continue to omit +, =, %, @, #, as they're either
4066         shell metacharacters (for some shells) or are not in some
4067         character sets, or (in the case of '%') must be a
4068         metacharacter somewhere.
4069
4070 2004-05-16  Paul Eggert  <eggert@cs.ucla.edu>
4071
4072         * src/cut.c (cut_fields): Adjust to new signature of getndelim2.
4073
4074 2004-05-17  Jim Meyering  <jim@meyering.net>
4075
4076         * src/shred.c (incname): Decrement `len' only once per loop iteration.
4077
4078         chgrp and chown now dereference symlinks by default, per POSIX.
4079         Reported by Michal Politowski as http://bugs.debian.org/249177.
4080
4081         * src/chown-core.c (chopt_init): Affect each symlink referent by default.
4082         * src/chown.c (usage): Update to reflect this.
4083         * src/chgrp.c (usage): Likewise.
4084         * NEWS: Describe the change.
4085         Adapt tests accordingly.
4086         * tests/chgrp/basic: Use -h where necessary to retain semantics.
4087         * tests/chgrp/deref: Likewise.
4088         * tests/chgrp/posix-H: Likewise.
4089
4090 2004-05-15  Paul Eggert  <eggert@cs.ucla.edu>
4091
4092         In shred, check for errors from fdatasync more carefully.  If
4093         fdatasync fails with errno==EINVAL, it means this implementation
4094         does not support synchronized I/O for this file.  Do not report
4095         this as an error, as (for example) AIX 5.2 fdatasync reports it
4096         for raw disk devices.  Problem reported by Albert Chin in
4097         <http://mail.gnu.org/archive/html/bug-gnu-utils/2004-05/msg00028.html>.
4098
4099         Check for write errors, though: the old code ignored them.
4100         Improve error checking in a few other cases, too (e.g., close of a
4101         directory).
4102
4103         Also, change several 'int' values to 'bool', so that the error
4104         checking is a bit clearer.  Similarly, change unsigned values
4105         to size_t where appropriate.
4106
4107         * src/shred.c: Include "dirname.h".
4108         (datasync) [!HAVE_FDATASYNC]: Remove.
4109         (dosync): New function.
4110         (dopass): Use it.  Return 1 on write error, -1 on other error.
4111         All callers changed.  Report write error if dosync does.
4112         (do_wipefd, wipefd, wipename, wipefile): Return bool (true/false),
4113         not int (0/-1).  All callers changed.  Return false if there's a
4114         write error.
4115         (incname): Return bool (true/false), not int (0/1).  Accept
4116         size_t length, not unsigned.  All callers changed.  Do not
4117         bother checking for non-digits; it can't happen.  Replace
4118         recursion with iteration.
4119         (wipename): Use dir_name, base_name, etc. instead of assuming
4120         Unix file names.  Use size_t for length, not unsigned.
4121         Report error if unlink or close fails.
4122         (wipename, main): Use bool for booleans.
4123
4124         (names): Use only digits and uppercase letters, for greater
4125         portability.
4126
4127 2004-05-16  Jim Meyering  <jim@meyering.net>
4128
4129         * tests/chown/deref: New test for the yesterday's change.
4130         * tests/chown/Makefile.am (TESTS): Add deref.
4131
4132 2004-05-15  Jim Meyering  <jim@meyering.net>
4133
4134         chown --dereference did nothing when the owner/group of a
4135         symlink matched the desired owner/group.  Reported by David Malone.
4136         Also reported in 1999 as http://bugs.debian.org/39642.
4137
4138         * src/chown-core.c (change_file_owner): When --dereference has
4139         been specified, and when processing a symlink, stat it to get the
4140         owner and group of the referent.
4141
4142 2004-05-14  Jim Meyering  <jim@meyering.net>
4143
4144         * man/pwd.x, man/echo.x, man/printf.x: Fix typo:
4145         s/supercede/supersede/ reported by Andrew Fabbro.
4146
4147 2004-05-13  Paul Eggert  <eggert@cs.ucla.edu>
4148
4149         Improve performance of `sort -m' on large files, at the cost of
4150         making some contrived examples unsafe.  POSIX allows this
4151         optimization.  Performance problem reported by Jonathan Baker in
4152         <http://mail.gnu.org/archive/html/bug-coreutils/2004-05/msg00071.html>.
4153
4154         * src/sort.c (first_same_file): Do not treat input pipes
4155         differently from other files.
4156         * doc/coreutils.texi (sort invocation): Document that "sort -m -o F"
4157         might write F before reading all the input.
4158         * NEWS: Likewise.
4159
4160 2004-05-12  Paul Eggert  <eggert@cs.ucla.edu>
4161
4162         * src/od.c (print_ascii, dump_strings): Use e.g. '\a' rather than
4163         '\007', for portability to EBCDIC hosts.
4164         * src/printf.c (print_esc_char): Likewise.
4165         * src/tr.c (unquote, make_printable_str): Likewise.
4166
4167 2004-05-12  Jim Meyering  <jim@meyering.net>
4168
4169         * src/remove.c (AD_pop_and_chdir): Move lstat-`.' into if-block
4170         where the result is used.  This avoids one unnecessary lstat call
4171         per command line argument.
4172
4173 2004-05-12  Paul Eggert  <eggert@cs.ucla.edu>
4174
4175         Don't assume that "make -C" works; Solaris "make" doesn't have -C.
4176
4177         * src/Makefile.am (all_programs.list): New rule, copied from
4178         man/Makefile.am and tests/Makefile.am, except that we use the
4179         system tr rather than ./tr and we don't use tr -s.
4180         * tests/Makefile.am (all_programs): Use it.
4181         * man/Makefile.am (all_programs): Likewise.  Renamed from programs,
4182         for consistency.  All uses changed.
4183
4184 2004-05-11  Jim Meyering  <jim@meyering.net>
4185
4186         * tests/rm/unread3: New test, for the above fix and today's
4187         lib/save-cwd.c improvement.
4188         * tests/rm/Makefile.am (TESTS): Add unread3.
4189
4190         * src/rm.c: Don't include "save-cwd.h".  It's no longer used.
4191
4192 2004-05-10  Jim Meyering  <jim@meyering.net>
4193
4194         * tests/install/trap: New file.  Test for bug fix of 2004-04-18.
4195         * tests/install/Makefile.am (TESTS): Add trap.
4196
4197         * src/remove.c (AD_push): Don't use errno in diagnostic about
4198         `changed dev/ino'.
4199
4200         Remove these generated files from CVS.
4201         * tests/cut/cut-tests, tests/date/date-tests, tests/join/join-tests:
4202         * tests/ls/ls-tests, tests/pr/pr-tests, tests/tac/tac-tests:
4203         * tests/tail/tail-tests, tests/test/test-tests, tests/tr/range-tests:
4204         * tests/tr/tr-tests, tests/wc/wc-tests:
4205
4206 2004-05-09  Jim Meyering  <jim@meyering.net>
4207
4208         * src/tr.c (unquote): Use xcalloc rather than xmalloc and
4209         a loop initializing the just-allocated memory to zero.
4210
4211 2004-05-08  Jim Meyering  <jim@meyering.net>
4212
4213         * tests/rm/no-give-up: New file; check for today's fix.
4214         * tests/rm/Makefile.am (TESTS): Add no-give-up.
4215
4216 2004-05-08  Paul Eggert  <eggert@cs.ucla.edu>
4217
4218         Fix bug where "rm" gave up too easily, reported by Dan Jacobsen in
4219         <http://mail.gnu.org/archive/html/bug-coreutils/2004-05/msg00013.html>.
4220
4221         * src/remove.c (remove_entry): Check for errno values like ENOENT
4222         that show the file cannot be directory, instead of for errno
4223         values like EPERM that show the file might be a directory.  This
4224         is necessary because, when a single unlink() call has multiple
4225         reasons to fail, it can set errno to any of those reasons; it's
4226         only the rare errno value like ENOENT that excludes all the other
4227         possible reasons to fail even when the file is a directory.
4228         (remove_cwd_entries): Don't attempt chdir if the file is known
4229         to not be a directory.
4230         (remove_dir): Use the same method that remove_cwd_entries uses
4231         (for some reason they differed).  Don't assert that saved_errno
4232         must be EPERM; it might be just about anything.
4233
4234 2004-05-06  Jim Meyering  <jim@meyering.net>
4235
4236         * src/id.c (xgetgroups): Use xnmalloc, rather than xmalloc.
4237         Don't add `1' to the buffer size (it was to protect against malloc
4238         implementations that fail to allocate a buffer of size zero).
4239         That is no longer necessary, since we use a malloc wrapper
4240         on such systems.
4241
4242         * src/wc.c (get_input_fstatus): Use xnmalloc, rather than xmalloc.
4243         * src/head.c (elide_tail_bytes_pipe): Likewise.
4244         * src/df.c (main): Likewise.
4245         * src/shred.c (do_wipefd): Likewise.
4246         * src/users.c (list_entries_users): Likewise.
4247         * src/tail.c (main): Likewise.
4248         * src/md5sum.c (main): Likewise.
4249
4250 2004-04-29  Paul Eggert  <eggert@cs.ucla.edu>
4251
4252         * src/df.c (show_disk, show_point): If several filesystems are
4253         mounted on the same mount point, prefer the last one, not the first.
4254         Problem reported by Christian Jones in
4255         <http://mail.gnu.org/archive/html/bug-coreutils/2004-04/msg00200.html>.
4256         (show_disk): Remove unused statp arg.  Return bool, not int.
4257         (show_point): Rewrite to avoid gotos.  Use the same algorithm
4258         for lofs and dummies for each pass through the mount table,
4259         rather than subtly different algorithms (which are probably
4260         inadvertent).
4261
4262 2004-05-03  Jim Meyering  <jim@meyering.net>
4263
4264         * Makefile.am (EXTRA_DIST): Add m4/ChangeLog, now that we no longer
4265         have m4/Makefile*.
4266
4267 2004-05-01  Jim Meyering  <jim@meyering.net>
4268
4269         When chown or chgrp is modifying the referent of a symlink,
4270         use the chown(2) function, if possible.
4271         * src/chown-core.c (change_file_owner): Don't hard-code the
4272         open/fchown/close kludge here.  Use `chown' instead.
4273         The chown function works just fine on conforming systems.
4274         Other systems now go through the new chown wrapper that
4275         resorts to the old kludge.
4276
4277         * src/chown-core.c (change_file_owner): Add a comment.
4278
4279 2004-04-27  Jim Meyering  <jim@meyering.net>
4280
4281         * src/ptx.c: Make over 40 global extern variables `static'.
4282         (syntax_table, re_syntax_table): Remove declarations of two unused
4283         variables (they were exposed by the above change).
4284
4285         * src/du.c (G_fail, opt_nul_terminate_output): Declare `static'.
4286         * src/ln.c (backup_type): Likewise.
4287
4288         * src/remove.c (rm): Add `extern' keyword.
4289         * src/cp-hash.c (forget_created, remember_created)
4290         (src_to_dest_lookup, remember_copied, hash_init, forget_all): Likewise.
4291         * src/copy.c (dest_info_init, src_info_init, copy): Likewise.
4292         * src/chown-core.c (chopt_init, chopt_free, gid_to_name)
4293         (uid_to_name, chown_files): Likewise.
4294
4295         * src/Makefile.am (sc_tight_scope): New rule.
4296         * Makefile.maint (sc_tight_scope): New rule.
4297         (syntax-check-rules): Add it.
4298
4299 2004-04-26  Jim Meyering  <jim@meyering.net>
4300
4301         * Use automake-1.8.4.  Regenerate dependent files.
4302
4303         * src/sort.c (limfield): Make a comment clearer.
4304
4305 2004-04-25  Paul Eggert  <eggert@twinsun.com>
4306
4307         Fix POSIX-conformance bug: "sort -k 3,3.5b" is supposed to skip
4308         leading blanks when computing the location of the field end;
4309         it is not supposed to skip trailing blanks.  Solaris 8 "sort"
4310         does conform to POSIX.  Also fix the documentation to clarify
4311         this and related issues.
4312
4313         * doc/coreutils.texi (sort invocation): Mention -k earlier, so
4314         that the options are in alphabetical order.  Describe how -b works
4315         more-accurately; this involves fixing some examples, too.  Mention
4316         what happens if the start field falls after an end field or after
4317         a line end.  Warn about using -k without -b, -g, -M, -n, or -t.
4318         Add an example of how to sort IPv4 addresses and Apache Common
4319         Log Format dates.  Remove a duplicate example.
4320         (Putting the tools together): Use separate options rather
4321         than agglomerating them.
4322         * src/sort.c (limfield): Use skipeblanks, not skipsblanks, to
4323         decode whether to skip leading blanks.
4324         (trailing_blanks): Remove.
4325         (fillbuf, getmonth, keycompare): Don't trim trailing blanks.
4326
4327         * tests/pr/Test.pm: Fix typo in env_default comment.
4328         * tests/sort/Test.pm: Likewise.
4329         (18c, 18d): Reverse the order of output lines, so that the
4330         test cases conform to POSIX.
4331
4332 2004-04-22  Paul Eggert  <eggert@twinsun.com>
4333
4334         More signal-handling cleanup for ls.c.  Do not allow signals to
4335         happen between arbitrary output bytes, as the
4336         restore-default-color sequence can bollix up multibyte chars or
4337         color-change sequences in the ordinary output.  Instead, process
4338         signals only between printing a file name and changing the color
4339         back to non_filename_text color.  That way, if the signal handler
4340         changes the color (to the default), 'ls' will change it back when
4341         'ls' continues (after being suspended).
4342
4343         Also, do not bother with signal-handling unless stdout is a
4344         controlling terminal; this lets stdio buffer better when "ls
4345         --color" is piped or sent to a file.
4346
4347         * src/ls.c (sigprocmask, sigset_t) [!defined SA_NOCLDSTOP]: New macros.
4348         Do not include "full-write.h"; no longer needed.
4349         (tcgetpgrp) [! HAVE_TCGETPGRP]: New macro.
4350         (put_indicator_direct): Remove.  All callers changed to use
4351         put_indicator.
4352         (caught_signals, interrupt_signal, stop_signal_count): New vars.
4353         (restore_default_color): Don't bother checking for put_indicator
4354         failure.
4355         (sighandler): Don't handle SIGTSTP; that's another handler now.
4356         Simply set interrupt_signal to the signal, then exit.
4357         (stophandler, process_signals): New functions.
4358         (main): Don't output any color changes until _after_ the signal
4359         handlers are set up.  This fixes a race condition where 'ls'
4360         could be interrupted while initializing colors, and leaving the
4361         terminal in an undesirable state.
4362         Don't mess with signal-handling if standard output is not a
4363         controlling terminal.
4364         When exiting, restore the default color, then restore the
4365         default signal handling, then act on any signals that weren't
4366         acted on yet.
4367         Do not print //DIRED// etc. in colors; this avoids the need
4368         to catch signals when printing them.
4369         (print_name_with_quoting): Process signals just before switching
4370         color back to non_filename_text.
4371
4372 2004-04-23  Jim Meyering  <jim@meyering.net>
4373
4374         Avoid segfault on systems for which SIZE_MAX != (size_t) -1.
4375         * src/ls.c (quote_name): Use SIZE_MAX, not -1, in calls
4376         of quotearg_buffer.  Patch by Mikulas Patocka.
4377
4378 2004-04-18  Paul Eggert  <eggert@twinsun.com>
4379
4380         tee ignored SIGPIPE, but POSIX doesn't allow this.
4381
4382         * src/tee.c (main): Do not ignore SIGPIPE, as POSIX 1003.1-2001
4383         does not allow this.  This undoes the 1996-10-24 patch.
4384
4385 2004-04-18  Paul Eggert  <eggert@twinsun.com>
4386
4387         Signal-handling cleanup for coreutils.  Here are the highlights:
4388
4389          - csplit sometimes failed to remove files when interrupted.
4390          - csplit didn't clean up if two signals arrived nearly simultaneously.
4391          - install -s would infloop on System V if SIGCHLD was ignored.
4392          - ls could incorrectly restore color if multiple signals
4393            arrived nearly simultaneously.
4394
4395         * src/csplit.c (sigprocmask, sigset_t) [!defined SA_NOCLDSTOP]:
4396         Define.
4397         (filename_space, prefix, suffix, digits, files_created, remove_files):
4398         Now volatile.
4399         (caught_signals): New var.
4400         (cleanup): Block signals while deleting all files.
4401         (cleanup_fatal, handle_line_error, regexp_error):
4402         Mark with ATTRIBUTE_NORETURN.
4403         (create_output_file, close_output_file, interrupt_handler):
4404         Block signals while changing the number of output files,
4405         to fix some race conditions.
4406         (delete_all_files): Do nothing if remove_files is zero.
4407         Clear files_created.
4408         (main): Don't mess with signals until after argument processing
4409         is done.
4410
4411         * src/csplit.c (main): Rewrite signal-catching code to make it
4412         similar to other coreutils programs.  When processing signals,
4413         block all signals that we catch, but do not block signals that we
4414         don't catch.  Avoid problems with unsigned int warnings.
4415         * src/ls.c (main): Likewise.
4416         * src/sort.c (main): Likewise.
4417
4418         * src/csplit.c (interrupt_handler):
4419         Use void, not (obsolete) RETSIGTYPE.
4420         * src/shred.c (sigill_handler, isaac_seed_machdep): Likewise.
4421
4422         * src/csplit.c (interrupt_handler) [defined SA_NOCLDSTOP]:
4423         Use simpler "signal (sig, SIG_DFL)" rather than sigaction equivalent.
4424         * src/ls.c (sighandler) [defined SA_NOCLDSTOP]: Likewise.
4425         * src/sort.c (sighandler) [defined SA_NOCLDSTOP]: Likewise.
4426         * src/nohup.c (main) [!defined _POSIX_SOURCE]: Likewise, except
4427         for SIG_IGN.
4428         * src/tee.c (main) [!defined _POSIX_SOURCE]: Likewise.
4429
4430         * src/install.c: Include <signal.h>.
4431         (main) [defined SIGCHLD]: Set SIGCHLD handler to the default, if -s is
4432         given, since System V fork+wait does not work if SIGCHLD is ignored.
4433
4434         * src/ls.c (sighandler) [!defined SA_NOCLDSTOP]: Reset signal
4435         handler to self, not to SIG_IGN, since SIGTSTP can be received
4436         more than once.
4437         (main): Use SA_RESTART, as that is simpler than checking for EINTR
4438         failures all over the place.
4439
4440 2004-04-20  Jim Meyering  <jim@meyering.net>
4441
4442         * src/remove.c (is_empty_dir): Clarify comment.
4443
4444         * man/help2man: Accept new option: --program-name=NAME, so that we
4445         can override the one in --version output.  This is needed solely
4446         so that test.1 doesn't refer to `[' as the program name.
4447         Reported by Benjamin Cutler as http://bugs.debian.org/205251.
4448         * man/Makefile.am (.x.1): Use help2man's new --program-name option.
4449
4450         * src/pwd.c: Don't include pathmax.h; system.h already does it.
4451
4452         * src/cut.c (cut_fields): Free buffer upon getndelim2 failure.
4453
4454 2004-04-19  Jim Meyering  <jim@meyering.net>
4455
4456         * src/shred.c (isaac_seed_start) [AVOID_USED_UNINITIALIZED_WARNINGS]:
4457         Initialize a buffer to avoid warnings from tools like valgrind.
4458
4459         * Makefile.maint (sc_trailing_blank): New rule.
4460         (syntax-check-rules): Add it.
4461         * .x-sc_trailing_blank: New file.
4462
4463         Make pwd work even if the resulting name is so long that getcwd fails.
4464         * src/pwd.c: (path_free, path_init, path_prepend): New functions.
4465         (nth_parent, find_dir_entry, robust_getcwd): New functions.
4466         (main): First try getcwd, then, upon failure, robust_getcwd.
4467
4468 2004-04-18  Jim Meyering  <jim@meyering.net>
4469
4470         * src/who.c (print_user): Use xrealloc here, rather than
4471         unchecked realloc.  Remove anachronistic casts.
4472
4473         * src/remove.c (full_filename_): Don't leak upon failed realloc.
4474
4475         * src/system.h (readdir_ignoring_dot_and_dotdot): New inline function,
4476         from remove.c.
4477         * src/remove.c (readdir_ignoring_dotdirs): Move function to system.h,
4478         renaming it.  Update uses.
4479
4480 2004-04-17  Jim Meyering  <jim@meyering.net>
4481
4482         * configure.ac: Depend on automake-1.8.3.
4483
4484         * src/join.c (add_file_name): Declare function to be `static'.
4485         (string_to_join_field): Likewise.
4486         * src/remove.c (ds_init, ds_free): Likewise.
4487
4488         * Makefile.maint (sc_prohibit_jm_in_m4): New rule.
4489         (syntax-check-rules): Add to the list.
4490
4491 2004-04-13  Paul Eggert  <eggert@twinsun.com>
4492
4493         Use page-aligned buffers whenever we bother to do I/O using buffer
4494         sizes that are tailored for the files.
4495
4496         * src/cat.c: Include getpagesize.h.
4497         * src/copy.c: Likewise.
4498         * src/shred.c: Likewise.
4499         * src/split.c: Likewise.
4500         * src/cat.c (main): Align I/O buffers to page boundaries.
4501         * src/copy.c (copy_reg): Likewise.
4502         * src/shred.c (dopass): Likewise.
4503         * src/split.c (main): Likewise.
4504         * src/dd.c (ROUND_UP_OFFSET, PTR_ALIGN): Remove.
4505         All uses replaced by ptr_align.
4506         * src/od.c (gcd, lcm): Remove; now in system.h.
4507         * src/system.h (gcd, lcm, ptr_align): New functions, moved from od.c.
4508
4509 2004-04-14  Jim Meyering  <jim@meyering.net>
4510
4511         Remove m4/Makefile.am: it's no longer needed, with newer automake
4512         * configure.ac (AC_CONFIG_FILES): Remove m4/Makefile.in from the list.
4513         * Makefile.am (SUBDIRS): Remove `m4' from the list.
4514
4515 2004-04-13  Jim Meyering  <jim@meyering.net>
4516
4517         * configure.ac: Change `jm_' in AC_DEFINE'd names to `gl_'.
4518
4519 2004-03-27  Paul Eggert  <eggert@twinsun.com>
4520
4521         * NEWS: cp -pu and mv -u (when copying) now take the destination
4522         file system time stamp resolution into account.
4523         * doc/coreutils.texi (mv invocation): Document this.
4524         (cp invocation): Document -u (it was missing!) with new behavior.
4525
4526         * src/copy.c: Include "utimecmp.h".
4527         (copy_internal): Compare time stamps using utimecmp rather than
4528         MTIME_CMP.
4529
4530 2004-04-09  Jim Meyering  <jim@meyering.net>
4531
4532         * Makefile.maint (.re-list): New rule/file, to replace
4533         hard-coded list of header file names.
4534         (sc_system_h_headers): Use the new file.
4535         Don't look for sys2.h anymore.
4536
4537         * src/system.h: Include new "stat-macros.h" rather than hard-coding
4538         all of its macro definitions -- the list was slightly out of date.
4539         Suggestion from Dmitry V. Levin.
4540
4541 2004-04-08  Paul Eggert  <eggert@cs.ucla.edu>
4542
4543         * NEWS: Remove noctty flag from dd.  Suggested by Philippe Troin.
4544         * doc/coreutils.texi (dd invocation): Likewise.
4545         * src/shred.c (O_NOCTTY): Remove redundant decl.
4546         * src/dd.c (flags, usage): Remove noctty flag.
4547         (main): Always use O_NOCTTY when opening files.
4548
4549 2004-04-08  Jim Meyering  <jim@meyering.net>
4550
4551         * src/dd.c (dd_copy): Mark two diagnostics for translations.
4552         (set_fd_flags): Undo part of today's change: it's a little
4553         cleaner -- and more efficient in the common case -- to go
4554         ahead and OR in the -1 when fcntl fails.
4555
4556         * Makefile.maint (sc_dd_max_sym_length): New target.
4557         (syntax-check-rules): Add it.
4558
4559         * src/md5sum.c (PROGRAM_NAME) [algorithm == ALG_SHA1]:
4560         Correct spelling: s/shasum/sha1sum.  Reported by Jesse Kornblum.
4561
4562         * src/dd.c (set_fd_flags): Don't OR in -1 when fcntl fails.
4563         Rename parameter, flags, to avoid shadowing global.
4564         (LONGEST_SYMBOL): Tweak comment.
4565
4566 2004-04-07  Paul Eggert  <eggert@twinsun.com>
4567
4568         * NEWS: New dd conv= symbols nocreat, excl, fdatasync, fsync,
4569         and new dd options iflag= and oflag=.
4570         * src/dd.c (usage): Likewise.
4571         * src/Makefile.am (dd_LDADD, shred_LDADD): Add fdatasync's lib.
4572         * src/dd.c (fdatasync) [!HAVE_FDATASYNC]: New macro.
4573         (C_NOCREAT, C_EXCL, C_FDATASYNC, C_FSYNC): New macros.
4574         (input_flags, output_flags): New vars.
4575         (LONGEST_SYMBOL): New macro.
4576         (struct symbol_value): Renamed from struct conversion.  Members
4577         symbol and value renamed from convname and conversion.  The
4578         symbol value is now an array instead of a pointer; this saves
4579         a bit of space and time in practice.  All uses changed.
4580         (conversions): Add nocreat, excl, fdatasync, fsync.  Now const.
4581         (flags): New constant array.
4582         (iflag_error_msgid, oflag_error_msgid): New constants.
4583         (parse_symbols): Renamed from parse_conversion and generalized
4584         to handle either conversion or flag symbols.
4585         (scanargs): Adjust uses of parse_symbols accodingly.  Add
4586         support for iflag= and oflag=.  Reject attempts to use
4587         both excl and nocreat.
4588         (set_fd_flags): New function.
4589         (dd_copy): Just return X rather than calling quit (X), since our
4590         caller invokes quit with the returned value.  Add support for
4591         fdatasync and fsync.
4592         (main): Add support for iflag=, oflag=, and new conv= symbols.
4593         * src/system.h (O_DIRECT, O_DSYNC, O_NDELAY, O_NOFOLLOW,
4594         O_RSYNC, O_SYNC): Define to 0 if not already defined.
4595
4596         * NEWS: Remove duplicate mention of BLOCKSIZE.
4597
4598 2004-04-02  Andreas Schwab  <schwab@suse.de>
4599
4600         * src/stty.c: Add support for IUTF8 input flag.
4601
4602 2004-04-06  Jim Meyering  <jim@meyering.net>
4603
4604         * src/system.h (makedev) [mkdev && !makedev]: Define in terms of mkdev.
4605         Interix spells it `mkdev'.  Reported by Mark Funkenhauser.
4606
4607 2004-04-04  Jim Meyering  <jim@meyering.net>
4608
4609         A specified format is no longer automatically newline terminated.
4610         If you want a newline at the end of your format, use `\n'.
4611         * src/stat.c (print_it): Don't print a newline at the end of
4612         every format.
4613         (do_statfs): Add a newline at end of each default format string.
4614
4615 2004-03-30  Paul Eggert  <eggert@twinsun.com>
4616
4617         * src/nohup.c (main): Adjust to new calling convention
4618         for set_cloexec_flag.
4619
4620 2004-03-31  Jim Meyering  <jim@meyering.net>
4621
4622         * tests/Fetish.pm (run_tests): Remove `.orig' file.
4623         Remove debugging diagnostic.
4624
4625         Specifying an invalid --width=N (-w) or --gap-size=N (-g)
4626         would not elicit an error.
4627         * src/ptx.c: Include "xstrtol.h" and "quotearg.h".
4628         (main): Don't use atoi.  Use xstrtoul instead.
4629
4630 2004-03-30  Jim Meyering  <jim@meyering.net>
4631
4632         * Makefile.maint (sc_prohibit_atoi_atof): New rule.
4633         (syntax-check-rules): Add it.
4634         * .x-sc_prohibit_atoi_atof: New file.
4635
4636 2004-03-29  Jim Meyering  <jim@meyering.net>
4637
4638         * tests/du/files0-from: Use new OUT_SUBST directive, so that this
4639         test is not sensitive to system-dependent block size differences.
4640         Prompted by a report of Solaris 8 differences from Paul Eggert.
4641
4642         * tests/Fetish.pm: Accept new directives: OUT_SUBST, ERR_SUBST.
4643         Rename `%tmp' to `%actual'.  Reverse order of last two args to
4644         _compare_files (to $actual, $expected) so as to match declaration.
4645
4646 2004-03-28  Paul Eggert  <eggert@twinsun.com>
4647
4648         Fix some gotchas encountered when porting to Solaris 8, using
4649         the Forte 6u2 compiler.
4650
4651         * src/hostname.c [HAVE_SETHOSTNAME && !defined sethostname]:
4652         Declare sethostname, since no Solaris header does it.
4653         * src/who.c: Include "vasprintf.h", for asprintf.
4654
4655 2004-03-28  Jim Meyering  <jim@meyering.net>
4656
4657         Minor optimization:
4658         * src/du.c (process_file): Don't record dev/inode for directories.
4659
4660         Under some circumstances, without -c, du would mistakenly count the
4661         space of hard-linked files, not just the first one it encountered.
4662         Reported by Anthony Thyssen.
4663         * src/du.c (du_files): Don't ever clear the set of `seen' dev/inodes.
4664
4665         * src/du.c: Rename global `print_totals' to `print_grand_total'.
4666
4667         * src/du.c (main): Rearrange filtering loop to be a tiny bit
4668         more efficient.
4669
4670         * src/chown-core.c: Don't include savedir.h -- no longer needed.
4671         * src/chmod.c: Likewise.
4672
4673 2004-03-25  Jim Meyering  <jim@meyering.net>
4674
4675         * src/du.c (main): Remove now-unused declaration of `i'.
4676
4677 2004-03-24  Paul Eggert  <eggert@twinsun.com>
4678
4679         * src/du.c (main): Filter out file names of length zero before
4680         invoking fts, so that they don't cause fatal errors.
4681
4682 2004-03-25  Jim Meyering  <jim@meyering.net>
4683
4684         * tests/du/files0-from (zero-len): Add a test for the above.
4685
4686 2004-02-25  Paul Eggert  <eggert@twinsun.com>
4687
4688         * NEWS: New environment var BLOCKSIZE.
4689         * lib/human.c (humblock): Support BLOCKSIZE as well as BLOCK_SIZE.
4690         * tests/envvar-check: Test for it.  Factor the code to simplify it.
4691
4692 2004-03-23  Paul Eggert  <eggert@twinsun.com>
4693
4694         * NEWS: Shorten the du --files0-from announcement, and say
4695         "NUL-terminated" rather than "NUL-separated".
4696         * src/du.c (EXPECTED_BYTES_PER_FILE_NAME, DEFAULT_PROJECTED_N_FILES):
4697         Remove: not used.
4698         (usage): Say "NUL-terminated", not "NUL-separated".
4699         (main): Check for I/O error when istream is closed.
4700         Allow --files0-from=F even if F is empty; this specifies no files.
4701         (du_files): Now that we allow the list of files to be empty,
4702         handle that case.
4703         * tests/du/files0-from: Adjust to above changes to src/du.c.
4704
4705 2004-03-24  Jim Meyering  <jim@meyering.net>
4706
4707         * tests/tail-2/assert: Avoid race condition that could cause
4708         spurious failure.  Based on a patch from Andreas Schwab.
4709
4710 2004-03-23  Jim Meyering  <jim@meyering.net>
4711
4712         * src/du.c (main): Free the hash table, too.
4713
4714 2004-03-22  Jim Meyering  <jim@meyering.net>
4715
4716         * man/Makefile.am (.x.1): Remove --info-page= option, reverting
4717         the change of 2004-01-22.  I can no longer reproduce the problem
4718         that prompted that change, and `info coreutils pr' would display the
4719         `printing text' section of the manual, not the one on `pr invocation'.
4720
4721         * tests/du/files0-from (nul-1, nul-2): Adjust expected diagnostics
4722         to match corrected output.
4723
4724         * src/du.c: Include "readtokens0.h" rather than "readtokens.h".
4725         (main): Use readtoken0 functions rather than readtokens.
4726         Don't use errno when diagnosing readtokens0 failure.
4727         Fix off-by-one error in the token number reported in a diagnostic.
4728         (du_files): Return bool, rather than int.
4729         (main): Call readtokens0_free.
4730
4731 2004-03-21  Jim Meyering  <jim@meyering.net>
4732
4733         * src/remove.c (ds_free): Plug a small leak.
4734
4735         * tests/Fetish.pm: Fix typo in comment.
4736
4737 2004-03-07  Jim Meyering  <jim@meyering.net>
4738
4739         * NEWS: du accepts a new option --files0-from=FILE, where FILE
4740         contains a list of NUL-separated file names.
4741
4742         * src/du.c: Include "readtokens.h".
4743         (usage): Describe the new option, and adjust the `Usage':
4744         with this option, no FILE may be specified on the command line.
4745         (main): Handle the new option.
4746
4747         * tests/du/files0-from: New tests, for the above.
4748         * tests/du/Makefile.am (TESTS): Add files0-from.
4749
4750         * src/factor.c (do_stdin): Reflect changes in use of readtoken.
4751         * src/tsort.c (tsort): Likewise.
4752
4753 2004-02-29  Paul Eggert  <eggert@twinsun.com>
4754
4755         * NEWS: Add support for a new notation @N to get_date to represent
4756         the time stamp with numeric value N.  Improve support for
4757         fractional time stamps.  date's -d and -f options now accept them.
4758         Likewise for touch -t.  date has a new option --iso-8601=ns.
4759
4760         * doc/coreutils.texi (touch invocation):
4761         Describe use of fractional seconds.
4762         (date invocation, Options for date): Likewise.
4763         * doc/getdate.texi (General date syntax, Time of day items): Likewise.
4764         * doc/coreutils.texi (date invocation): Mention effect of LC_TIME.
4765         (Options for date): Describe new --iso-8601=ns option.
4766
4767         * doc/getdate.texi: Add copyright notice.  Change getdate to
4768         get_date when talking about the function name.
4769         (Seconds since the Epoch): New section, containing the time_t
4770         info moved from Date input formats section, along with new
4771         info about the @ syntax.  Mention negative time stamps,
4772         fractional time stamps, and leap seconds.
4773         (General date syntax): Modernize examples a bit to reflect new
4774         features.
4775         (General date syntax, Relative items in date strings):
4776         Use ' rather than " to quote formats.
4777         (Time of day items): Add an example with fractional seconds.
4778         Describe fractional-second syntax.
4779
4780         * src/Makefile.am (touch_LDADD): New macro, since `touch' now
4781         needs clock_gettime.
4782
4783         * src/date.c (enum Time_spec): New enum TIME_SPEC_NS.
4784         (time_spec_string, time_spec, show_date): Support it.
4785         (usage): Remove description of -ITIMESPEC, as it's obsolete and
4786         confusing.  Mention --iso-8601=ns.
4787         (batch_convert): getline returns ssize_t, not int.
4788
4789         * src/touch.c (newtime): Now an array of two timespecs, one
4790         for access and one for modification.
4791         (ref_stats): Remove.
4792         (get_reldate): Use get_date's parameter profile.
4793         (touch, main): Adjust to above changes.
4794         (main): Work even if tm_year == INT_MAX (so long as long int is wider).
4795         Use gettime instead of gettimeofday, for new get_date signature.
4796
4797         * tests/date/Test.pm (test_vector): New tests epoch, ns-10, ns-max32,
4798         ns-relative.
4799
4800 2004-03-15  Jim Meyering  <jim@meyering.net>
4801
4802         * Makefile.maint (alpha beta major): `Make' the emit_upload_commands
4803         target before updating $(prev_version_file).
4804
4805         * tests/misc/date-sec: New file, to test for just-fixed bug in date.
4806         See today's change in lib/getdate.y.
4807         * tests/misc/Makefile.am (TESTS): Add date-sec.
4808
4809 2004-03-14  Jim Meyering  <jim@meyering.net>
4810
4811         * announce-gen (print_changelog_deltas): Use `.sig' suffix for
4812         signature files, not `.asc'.  Reported by angico@yahoo.com.
4813
4814 2004-03-13  Jim Meyering  <jim@meyering.net>
4815
4816         * src/cp.c (do_copy): Tweak wording in a diagnostic.
4817         Suggestion from Karl Berry.
4818         Include "quoatearg.h".
4819         (do_copy): Use quotearg_colon (not quote) for diagnostics
4820         that begin with `"%s:'.
4821
4822         * src/nl.c (usage): Specify that nl uses _basic_ regular expressions.
4823         Suggestion from Dan Jacobson.
4824
4825 2004-03-12  Jim Meyering  <jim@meyering.net>
4826
4827         * Version 5.2.1.
4828
4829         Sometimes, when source and destination partition are different,
4830         mv mistakenly fails to preserve a hard link.  Reported by IIDA Yosiaki.
4831
4832         * src/copy.c: When moving a set of N hard-linked files between
4833         partitions, via two or more command line arguments where the
4834         command line argument containing the Nth link contains no other
4835         link to that same file, mv would mistakenly copy the file, rather
4836         than hard-linking it to the other(s).  That happens because when the
4837         final link is processed, its link count has been reduced to 1 since
4838         the other links have been `copied' to the destination partition
4839         and the source links have been removed.
4840         (copy_internal): When in move mode, use the source dev/inode
4841         pair to look up destination name even when st_nlink == 1.
4842         * src/cp-hash.c (src_to_dest_lookup): New function.
4843         * src/cp-hash.h (src_to_dest_lookup): Add prototype.
4844         * tests/mv/part-hardlink: New file.  Test for the above fix.
4845         * tests/mv/Makefile.am (TESTS): Add part-hardlink.
4846
4847         * announce-gen: Sync with autoconf.
4848
4849         * tests/ls/time-1: Exit 77 (not 1) if we can't set up for the test.
4850         This was triggered on a Linux-2.2.19 system using a file system
4851         NFS-mounted from some sort of Sun.
4852
4853 2004-03-11  Jim Meyering  <jim@meyering.net>
4854
4855         * Use automake-1.8.3.  Regenerate dependent files.
4856
4857 2004-03-10  Jim Meyering  <jim@meyering.net>
4858
4859         * tests/du/deref-args: Also convert sizes in the 70-79 kB range,
4860         so that this test works with SELinux-enabled systems.
4861         Based on a patch from Tim Waugh.
4862
4863         `join -1 x' would give a misleading diagnostic
4864         * src/join.c (string_to_join_field): Report that a non-numeric field
4865         number is invalid, rather than `so large that it is not representable'.
4866         * tests/join/Test.pm (invalid-j): New partial test for the above fix.
4867
4868 2004-03-06  Jim Meyering  <jim@meyering.net>
4869
4870         cp --sparse=always sparse-image-file.img /dev/hda1 could
4871         produce an invalid copy on the destination device.
4872
4873         * src/copy.c (copy_reg): Even with --sparse=always, try to
4874         make `holes' only if the destination is a regular file.
4875         Reported by Szakacsits Szabolcs.
4876
4877 2004-03-03  Paul Eggert  <eggert@twinsun.com>
4878
4879         * src/nohup.c (main): Don't invoke set_cloexec_flag with
4880         a file descriptor of -1.
4881
4882 2004-03-02  Dmitry V. Levin  <ldv@altlinux.org>
4883
4884         * src/nohup.c: Include "cloexec.h".
4885         (main): Set the copy of stderr to close on exec.
4886
4887 2004-03-01  Paul Eggert  <eggert@twinsun.com>
4888
4889         * configure.ac: Include <signal.h> when checking for strsignal,
4890         sys_siglist, and friends.  Problem reported by Tony Leneis in
4891         <http://mail.gnu.org/archive/html/bug-coreutils/2004-02/msg00136.html>.
4892
4893 2004-02-25  Paul Eggert  <eggert@twinsun.com>
4894
4895         * tests/du/deref-args, tests/du/exclude, tests/du/slash:
4896         * tests/du/trailing-slash: Run envvar-check in case BLOCK_SIZE
4897         etc. are set.
4898
4899 2004-02-23  Paul Eggert  <eggert@twinsun.com>
4900
4901         * NEWS: Document how chown's USER.GROUP argument is now parsed.
4902
4903 2004-02-23  Jim Meyering  <jim@meyering.net>
4904
4905         * src/seq.c (usage): Remove stray space after \n in --help output.
4906
4907 2004-02-22  Jim Meyering  <jim@meyering.net>
4908
4909         * src/du.c (usage): Separate -H and --si.  Say that the meaning
4910         of -H will soon change to that of --dereference-args (-D).
4911
4912 2004-02-21  Jim Meyering  <jim@meyering.net>
4913
4914         * src/comm.c (usage): Tell what comm does when there are no options.
4915         Reword in terms of FILE1 and FILE2 rather than `left file' and
4916         `right file'.  Suggestion from Dan Jacobson.
4917
4918 2004-02-15  Paul Eggert  <eggert@twinsun.com>
4919
4920         Fix some POSIX-conformance bugs in expr.
4921
4922         * NEWS: document the following changes to src/expr.c.
4923         * doc/coreutils.texi (expr invocation): Likewise.
4924         Document what forms integers may take, and say "integer"
4925         consistently instead of "number".  Warn about operands
4926         that "expr" can misinterpret, and how to work around the
4927         problem.
4928         * src/expr.c (eval, eval7, eval6, eval5, eval4, eval3, eval2, eval1):
4929         Accept a bool argument specifying whether to evaluate the
4930         expression.  This is to allow short-circuit evaluation.  All
4931         callers changed.
4932         (null): Report that a string is zero even if it has
4933         a form like "-0" or "00".
4934         (eval1, eval): Use short-circuit evaluation for | and &.
4935         (eval): Return 0 if both arguments are null or zero, instead
4936         of returning the first argument.
4937         * tests/expr/basic: Add some tests for the above.
4938
4939 2004-02-17  Jim Meyering  <jim@meyering.net>
4940
4941         * Version 5.2.0.
4942
4943         `make check' from a build inside a chroot environment would fail
4944         * tests/help-version: Specify an argument (`/') for df, in the
4945         unusual event that there is no valid entry in /etc/mtab.
4946         Likewise for id: add the -u option, so we don't get spurious
4947         failures when there are no user or group names.
4948         Patch by Tim Waugh.
4949
4950         * src/sort.c (usage) [-u]: Add punctuation so that the description in
4951         the help2man-generated (line-joined) man page is more readable.
4952         Reported by Tim Waugh.
4953         [-T]: Add a semicolon, for the same reason.
4954
4955 2004-02-15  Jim Meyering  <jim@meyering.net>
4956
4957         * Makefile.am (dist-hook): Qualify target with $(srcdir)/ prefix.
4958
4959 2004-02-11  Jim Meyering  <jim@meyering.net>
4960
4961         * tests/Makefile.am.in ($(srcdir)/Makefile.am): Use more portable
4962         $(srcdir)/../Makefile.am.in, rather than $<.
4963         Suggestion from Michael Elizabeth Chastain.
4964
4965 2004-02-10  Jim Meyering  <jim@meyering.net>
4966
4967         * config/install-sh: Make this script executable.
4968         * Makefile.am (dist-hook): New target, to ensure that config/install-sh
4969         is executable.  Otherwise, on systems that lack a suitable install
4970         binary, `make install' would fail, because of the way this script
4971         is invoked (without `$SHELL ' prefix).
4972         Reported by Bob Proulx.
4973
4974 2004-02-08  Jim Meyering  <jim@meyering.net>
4975
4976         * Version 5.1.3.
4977
4978         * tests/rm/rm5: Avoid triggering a bug in OSF/Tru64's sed
4979         that would cause an unwarranted test failure.
4980         * tests/rm/rm3: Likewise.
4981
4982 2004-02-07  Jim Meyering  <jim@meyering.net>
4983
4984         Remove xstat function pointer member.  The way it was used was not
4985         portable, since some systems (OSF V5.1, Solaris 2.5.1) provide static
4986         inline `stat' and `lstat' functions, thus making the tests of
4987         `xstat == lstat' in copy.c always fail.
4988         * src/copy.h (struct cp_options) [xstat]: Remove member.
4989         (XSTAT): New macro.
4990         * src/copy.c (copy_dir): Set `.dereference' member, not .xstat.
4991         (copy_internal): Use `XSTAT (x, ...)' in place of `*(x->xstat) (...)'.
4992         Use `x->dereference == DEREF_NEVER' in place of `x->xstat == lstat'.
4993         (valid_options): Remove now-obsolete FIXME comments.
4994
4995         * src/cp.c (re_protect): Use `XSTAT (x, ...)' in place of
4996         `*(x->xstat) (...)'.
4997         (do_copy): Declare/use local xstat rather than x->xstat.
4998         (main): Remove code that set x.xstat.
4999         * src/mv.c (cp_option_init): Don't initialize xstat member.
5000         * src/install.c (cp_option_init): Likewise.
5001
5002         * Makefile.cfg (gnu_ftp_host-alpha, etc.): Un-factor .gnu.org suffix,
5003         so that emit_upload_commands can use these variables, too.
5004
5005 2004-02-06  Jim Meyering  <jim@meyering.net>
5006
5007         * tests/rm/deep-1: Remove `du' stack space test.
5008         Apparently, `ulimit -s N' isn't portable enough.
5009         This test will be restored (with a guard against losing ulimit)
5010         in its own file later.
5011
5012         * tests/rm/deep-1 (deep): Remove progress-style diagnostics,
5013         since this test doesn't take long enough to merit them.
5014         Run du on $tmp (the containing dir), not $deep, the full path to leaf.
5015
5016         * Makefile.maint (signatures): Remove definition.
5017         Now, automake's gnupload handles this.
5018         (%.sig: %): Remove now-unused rule.
5019         (rel-files): Use automake's $(DIST_ARCHIVES), rather than
5020         `$(distdir).tar.bz2 $(distdir).tar.gz'.
5021         (emit-upload-commands): Adjust to use gnupload.
5022
5023 2004-02-05  Jim Meyering  <jim@meyering.net>
5024
5025         * src/system.h (ST_TIME_CMP_NS, ST_TIME_CMP): Remove definitions.
5026         (ATIME_CMP, CTIME_CMP, MTIME_CMP, TIMESPEC_NS): Likewise.
5027         Now, those are all defined in timespec.h.
5028         Include timespec.h.
5029
5030         * src/date.c: Don't include timespec.h, now that system.h does it.
5031
5032 2004-02-02  Paul Eggert  <eggert@twinsun.com>
5033
5034         Don't dump core if localtime returns NULL (possible on
5035         hosts with 64-bit time_t and 32-bit int).
5036         * src/date.c: Include "inttostr.h".
5037         (batch_convert, main):
5038         If time conversion fails, exit with nonzero status.
5039         (show_date): Return int to report conversion failure.
5040         Print the time as an int if localtime fails.
5041         * src/uptime.c: Print "??" if the current clock can't
5042         be converted by localtime.  This won't happen until the year
5043         2*31 + 1900, but we don't want to dump core even if the current
5044         clock has the wrong value.
5045
5046         * src/stat.c: Include "inttostr.h".
5047         (human_time): Print the date/time as a number of seconds since the
5048         epoch if it can't be converted by localtime.  This is better than
5049         just saying "invalid", and is consistent with what "ls" does.
5050         Don't dump core if the year has more than 48 digits; this isn't
5051         possible on any contemporary host, but we might as well do it right.
5052
5053 2004-01-31  Paul Eggert  <eggert@twinsun.com>
5054
5055         * src/stat.c (human_time): Accept time rather than
5056         pointer-to-const-time parameter, for clarity.  All callers changed.
5057
5058 2004-02-02  Jim Meyering  <jim@meyering.net>
5059
5060         * src/stat.c (do_stat): Remove extra trailing newline from
5061         default formats.  Reported by Nelson H. F. Beebe.
5062
5063         Print actual fractional seconds in time stamps, not just `.00000000'.
5064         * src/stat.c (human_time): Add and use new parameter, t_ns.
5065         (print_stat): Update callers.
5066         * src/ls.c (TIMESPEC_NS): Remove definition.
5067         * src/system.h (TIMESPEC_NS): Define here, instead, now that stat.c
5068         also uses this macro.
5069         Nelson H. F. Beebe noticed that ls --full-time printed nonzero
5070         fractional seconds for files on an XFS file system, but that stat's
5071         fractional seconds were always zero.
5072
5073 2004-01-28  Paul Eggert  <eggert@twinsun.com>
5074
5075         * src/seq.c (print_numbers): Use 'double' for loop index, not
5076         'int', to avoid problems with integer overflow.  On almost all
5077         machines 'double' works in every case where 'int' works, and
5078         it works on other cases besides.
5079
5080 2004-01-27  Jim Meyering  <jim@meyering.net>
5081
5082         * src/seq.c (usage): Mention that if INCREMENT is omitted,
5083         it defaults to 1, even when FIRST is larger than LAST.
5084         Reword so as not to exclude the possibility that INCREMENT be zero.
5085
5086 2004-01-25  Jim Meyering  <jim@meyering.net>
5087
5088         * Version 5.1.2.
5089
5090         * Makefile.maint (signatures): Comment out definition.
5091
5092 2004-01-23  Jim Meyering  <jim@meyering.net>
5093
5094         * Makefile.maint (header_regexp): Add exitfail.
5095
5096         * man/Makefile.am (EXTRA_DIST): Add help2man.
5097         Reported by Nelson H. F. Beebe.
5098
5099         * man/Makefile.am (.x.1): Prefix help2man invocation with `$(PERL) --'
5100         so it works on systems with Perl installed somewhere other than in
5101         /usr/bin.
5102
5103         * src/paste.c (paste_parallel): Declare local, chr, to be of type
5104         `int', not `char', since it must hold EOF.  This bug would make
5105         paste infloop on some systems.  Test failures reported by
5106         Nelson H. F. Beebe and Christian Krackowizer.
5107
5108 2004-01-22  Jim Meyering  <jim@meyering.net>
5109
5110         * tests/rmdir/fail-perm: New file.  Test for just-fixed rmdir bug.
5111         * tests/rmdir/Makefile.am (TESTS): Add fail-perm.
5112
5113         * man/help2man: Fix it so using --info-page='coreutils PROG' works.
5114         * man/Makefile.am (.x.1): Invoke our own (tweaked) copy of help2man.
5115         Use --info-page='coreutils PROG' option.
5116         Now, readlink.1 refers the user to `info coreutils readlink'
5117         rather than to `info readlink'.  Reported by Matt Swift.
5118
5119 2004-01-21  Paul Eggert  <eggert@twinsun.com>
5120
5121         Exit status cleanup.
5122
5123         * src/basename.c (usage): Use EXIT_SUCCESS, not 0, for clarity.
5124         * src/cat.c, src/chgrp.c, src/chmod.c, src/chown.c, src/chroot.c,
5125         * src/cksum.c, src/comm.c, src/cp.c, src/csplit.c, src/cut.c,
5126         * src/date.c, src/dd.c, src/df.c, src/dircolors.c, src/dirname.c,
5127         * src/du.c, src/echo.c, src/env.c, src/expand.c, src/expr.c,
5128         * src/factor.c, src/fmt.c, src/fold.c, src/head.c, src/hostid.c,
5129         * src/hostname.c, src/id.c, src/install.c, src/join.c, src/kill.c,
5130         * src/link.c, src/ln.c, src/logname.c, src/ls.c, src/md5sum.c,
5131         * src/mkdir.c, src/mkfifo.c, src/mknod.c, src/mv.c, src/nice.c,
5132         * src/nl.c, src/nohup.c, src/od.c, src/paste.c, src/pathchk.c,
5133         * src/pinky.c, src/pr.c, src/printenv.c, src/printf.c, src/pwd.c,
5134         * src/rm.c, src/rmdir.c, src/seq.c, src/setuidgid.c, src/shred.c,
5135         * src/sleep.c, src/sort.c, src/split.c, src/stat.c, src/stty.c,
5136         * src/su.c, src/sum.c, src/sync.c, src/tac.c, src/tail.c, src/tee.c,
5137         * src/test.c, src/touch.c, src/tr.c, src/tsort.c, src/tty.c,
5138         * src/uname.c, src/unexpand.c, src/uniq.c, src/unlink.c, src/uptime.c,
5139         * src/users.c, src/wc.c, src/who.c, src/whoami.c, src/yes.c: Likewise.
5140
5141         * src/cat.c (usage): Don't bother normalizing exit status
5142         since the arg is already the correct exit status now.
5143         * src/cksum.c, src/comm.c, src/csplit.c, src/cut.c,
5144         * src/dircolors.c, src/expand.c, src/fmt.c, src/fold.c, src/head.c,
5145         * src/join.c, src/md5sum.c, src/nl.c, src/od.c, src/paste.c,
5146         * src/pr.c, src/split.c, src/sum.c, src/tac.c, src/tail.c, src/tr.c,
5147         * src/tsort.c, unexpand.c, src/src/uniq.c, src/src/wc.c: Likewise.
5148
5149         * src/chown.c (main): Removed unused local 'fail'.
5150
5151         * src/chroot.c (CHROOT_FOUND_BUT_CANNOT_INVOKE, CHROOT_FAILURE):
5152         Remove.
5153
5154         * src/chroot.c (main): Initialize exit_failure to EXIT_FAIL.
5155         * src/env.c, src/nice.c, src/su.c: Likewise.
5156         * src/nohup.c (main): Likewise, to NOHUP_FAILURE.
5157         * src/setuidgid.c (main): Likewise, to SETUIDGID_FAILURE.
5158         * src/expr.c (main): Use initialize_exit_failure rather than
5159         setting exit_failure directly; this optimizes away redundant
5160         assignments.
5161         * src/printenv.c, src/sort.c, src/test.c, src/tty.c: Likewise.
5162
5163         * src/chroot.c (main): Exit with status 1 rather than 127
5164         if chroot itself fails, as per documentation.
5165
5166         * src/chroot.c (main): Use EXIT_ENOENT and EXIT_CANNOT_INVOKE
5167         rather than roll-your-own symbols or integers.
5168         * src/env.c (main): Likewise.
5169         * src/nohup.c (main): Likewise.
5170         * src/su.c (run_shell): Likewise.
5171
5172         * src/cp.c (exit_status): Remove static var....
5173         (main): Making it local here instead.  Use =, not |=, to set it.
5174
5175         * src/cut.c (FATAL_ERROR, main): Exit with status EXIT_FAILURE,
5176         not 2, on errors.
5177         * src/date.c (batch_convert, main): Likewise.
5178         * src/dd.c (dd_copy): Likewise.
5179         * src/pr.c (first_last_page, main, getoptarg): Likewise.
5180         * src/tr.c (main): Likewise.
5181         * src/date.c (main): Don't assume EXIT_FAILURE == 1, as
5182         POSIX doesn't require it.
5183         * src/dd.c (write_output, skip, dd_copy): Likewise.
5184         * src/df.c (main): Likewise.
5185         * src/id.c (main): Likewise.
5186         * src/install.c (main): Likewise.
5187         * src/ln.c (main): Likewise.
5188         * src/ls.c (main): Likewise.
5189         * src/mv.c (main): Likewise.
5190         * src/shred.c (main): Likewise.
5191
5192         * src/env.c (main): Exit with status 1, not 2, on errors detected
5193         by env proper.
5194         * src/hostname.c (main): Likewise.
5195         * src/nl.c (main): Likewise.
5196         * src/stty.c (main): Likewise.
5197
5198         * src/expr.c (EXPR_FAILURE): Renamed from EXPR_ERROR, for
5199         consistency with the other programs' naming conventions.
5200         All uses changed.
5201
5202         * src/factor.c (main): Do not report a usage error simply
5203         because stdin has bad numbers.
5204
5205         * src/id.c (problems): Now a boolean int, not a counter,
5206         so that we don't have to worry about int overflow.  All uses changed.
5207         * src/touch.c (err): Likewise.
5208
5209         * src/md5sum.c (main): Use int, not size_t, to store boolean int.
5210
5211         * src/mkfifo.c (main): Exit with status 1, not 4, if not implemented.
5212         * src/mknod.c: Likewise.
5213
5214         * src/nice.c (main): Exit with status EXIT_FAIL, not EXIT_FAILURE,
5215         on error; this is in case EXIT_FAILURE is unusual.
5216         * src/su.c (main): Likewise.
5217
5218         * src/nohup.c (NOHUP_FOUND_BUT_CANNOT_INVOKE): Remove; all uses
5219         changed to EXIT_CANNOT_INVOKE.
5220
5221         * src/printenv.c (PRINTENV_FAILURE): New constant.
5222         (main): Exit with status PRINTENV_FAILURE, not EXIT_FAILURE, on
5223         command-line syntax problems.
5224
5225         * src/rmdir.c (remove_parents): Don't set 'fail' to a negative number.
5226         (main): Avoid integer overflow when seeing whether errors occurred.
5227
5228         * src/seq.c (print_numbers): Now returns void, not (zero) int.
5229         All callers changed.
5230         (main): Remove unused local variable 'errs'.  Always exit successfully
5231         if we reach the end.
5232
5233         * src/setuidgid.c (SETUIDGID_FAILURE): Renamed from FAIL_STATUS,
5234         for consistency with other programs here.  All uses changed.
5235         (main): Use 'error' to exit rather than invoking 'exit' here.
5236
5237         * src/sort.c: Don't include <assert.h>.
5238         (SORT_OUT_OF_ORDER,  SORT_FAILURE): Now enums, not macros.
5239         (usage): Don't use 'assert'.
5240         (main): Remove redundant assignment to exit_failure.
5241
5242         * src/system.h (EXIT_FAIL, EXIT_CANNOT_INVOKE, EXIT_ENOENT):
5243         New enum values.
5244         (initialize_exit_failure): New inline function.
5245         Include exitfail.h here, since we refer to exit_failure.
5246         All callers changed to not include exitfail.h.
5247
5248         * src/tty.c (TTY_FAILURE, TTY_WRITE_ERROR): New enum values;
5249         substitute them for the corresponding integer constants.
5250
5251         * tests/help-version (expected_failure_status_date): Remove, as
5252         'date' is now normal.
5253         (expected_failure_status_nohup): New var.
5254
5255 2004-01-21  Jim Meyering  <jim@meyering.net>
5256
5257         * tests/touch/relative: Remove `command' syntax.
5258         Thanks to Nelson H. F. Beebe and Paul Eggert.
5259
5260         * tests/touch/relative: Test only year/month/day, not hours/min/sec,
5261         so as to avoid problems with systems using TAI clocks.
5262         Although it's no longer necessary, set TZ=UTC0 also for the
5263         initial touch command.  Reported by Paul Jarc here:
5264         http://article.gmane.org/gmane.comp.gnu.core-utils.bugs/1504
5265
5266 2004-01-20  Diego Biurrun  <diego@biurrun.de>
5267
5268         * src/dircolors.hin: Add .mov to the list of media files.
5269
5270 2004-01-19  Paul Eggert  <eggert@twinsun.com>
5271
5272         * tests/touch/relative: Use TZ=UTC0, not TZ=utc (which isn't
5273         portable).  Problem reported by Christian Krackowizer.  Also, use
5274         +0000 rather than +0 to specify a time zone, as the documentation
5275         requires four digits.
5276
5277 2004-01-19  Jim Meyering  <jim@meyering.net>
5278
5279         * tests/mv/hard-4: Run envvar-check in case SIMPLE_BACKUP_SUFFIX is set.
5280         * tests/mv/backup-is-src: Likewise.
5281         Problem reported by Peter Horst
5282
5283 2004-01-17  Jim Meyering  <jim@meyering.net>
5284
5285         * announce-gen (print_changelog_deltas): Use .sig suffix, not .asc.
5286
5287         * Version 5.1.1.
5288
5289 2003-12-15  Paul Eggert  <eggert@twinsun.com>
5290
5291         * NEWS, doc/coreutils.texi: touch -r and -d can now both be specified,
5292         with -r specifying the origin for -d.
5293         * src/touch.c (flexible_date): Remove static var.
5294         (get_reldate): New function.
5295         (main): Use it, to implement this new behavior.
5296
5297 2004-01-16  Jim Meyering  <jim@meyering.net>
5298
5299         * tests/touch/relative: New test for the above.
5300         * tests/touch/Makefile.am (TESTS): Add relative.
5301
5302 2004-01-13  Jim Meyering  <jim@meyering.net>
5303
5304         * src/system.h: Include contents of sys2.h.
5305         * src/sys2.h: Remove file.
5306         * src/Makefile.am (noinst_HEADERS): Remove sys2.h.
5307
5308         * Use automake-1.8.2.  Regenerate dependent files.
5309
5310         * Update to gettext-0.13.1.
5311         * configure.ac: Use gettext-0.13.1.
5312         * .x-sc_space_tab: Add m4/po.m4 to the list of exceptions.
5313
5314 2004-01-12  Jim Meyering  <jim@meyering.net>
5315
5316         * Makefile.maint (%.sig): Use .sig suffix rather than .asc.
5317
5318         * Makefile.maint (po-check): Ensure that cvsu works before using it.
5319         Reported by Alexandre Duret-Lutz.
5320
5321         * src/tail.c (main): Warn about following stdin only when it's a tty.
5322
5323         * configure.ac: Use gl_DEFAULT_POSIX2_VERSION.
5324
5325 2004-01-10  Jim Meyering  <jim@meyering.net>
5326
5327         * tests/misc/stat-fmt: Use backticks, not `$()' notation.
5328
5329 2004-01-09  Jim Meyering  <jim@meyering.net>
5330
5331         * configure.ac: Quote underquoted `jm_DUMMY_1' to avoid new warning.
5332
5333 2004-01-08  Jim Meyering  <jim@meyering.net>
5334
5335         * src/stat.c (human_fstype): Use %lx, not %x format for `unsigned long'.
5336         From Andreas Schwab.
5337
5338         * tests/Makefile.am (TESTS_ENVIRONMENT): Remove `/vg' (prerelease test
5339         remnant) from PATH component.  That would cause tests in this directory
5340         not to run the just-built binaries, but rather whatever happened
5341         to be in one's PATH.  Reported by Christian Krackowizer.
5342
5343 2004-01-04  Jim Meyering  <jim@meyering.net>
5344
5345         * src/csplit.c (new_control_record): Use x2nrealloc
5346         rather than xrealloc.
5347
5348         * src/cp.c (re_protect): Use ASSIGN_STRDUPA rather than
5349         alloca and strcpy.
5350         (make_path_private): Likewise.
5351
5352 2004-01-03  Jim Meyering  <jim@meyering.net>
5353
5354         * src/paste.c: Use `bool' (not int) as the type for a few
5355         global variables.
5356         (collapse_escapes): Rewrite to set globals rather than modifying
5357         its parameter.
5358         Use size_t (not int) for all counters and related index variables.
5359         (paste_parallel): Remove needless complexity of
5360         using xrealloc in the loop;  just allocate the buffers up front.
5361         Free the two temporary buffers.
5362         Move declarations of locals `down' into scope where used.
5363         (paste_serial): Remove `register' attributes.
5364         (main): Simplify delim-related code.
5365         Free `delims', now that it's malloc'd.
5366
5367 2004-01-02  Jim Meyering  <jim@meyering.net>
5368
5369         * src/chroot.c: Include "quote.h".
5370         (CHROOT_FOUND_BUT_CANNOT_INVOKE, CHROOT_FAILURE): Define.
5371         (main): Exit with status of 127, not 1, for too-few-args,
5372         chroot failure, or chdir failure.
5373         Give a better diagnostic upon execvp failure.
5374
5375         * src/du.c (usage): Mention that, with its current meaning,
5376         -H is deprecated.
5377
5378         * src/tail.c (main): Warn about following stdin when it's a tty.
5379         Fail when following by name but no names are specified.
5380
5381 2003-12-30  Jim Meyering  <jim@meyering.net>
5382
5383         * src/fold.c (main): Use memcpy, not strcpy.
5384
5385         * src/copy.c (copy_internal): Use ASSIGN_STRDUPA rather than
5386         alloca and strcpy.
5387
5388 2003-12-28  Jim Meyering  <jim@meyering.net>
5389
5390         * src/unexpand.c (n_tabs_allocated): New global.
5391         (add_tabstop): Use x2nrealloc rather than xrealloc.
5392         * src/expand.c: Likewise.
5393
5394         * tests/misc/expand: New file.
5395         * tests/misc/Makefile.am (TESTS): Add expand.
5396
5397         * src/sort.c (add_temp_dir): Use x2nrealloc rather than xrealloc.
5398         (fillbuf): Use x2nrealloc rather than xrealloc.
5399         (sort): Use xnmalloc rather than xmalloc.
5400         (main): Likewise.
5401
5402 2003-12-27  Jim Meyering  <jim@meyering.net>
5403
5404         * src/tee.c (tee): Use xnmalloc rather than xmalloc.
5405
5406 2003-12-29  Paul Eggert  <eggert@twinsun.com>
5407
5408         * NEWS: Remove support for join -j1 FIELD, -j2 FIELD, and -o LIST1
5409         LIST2 in POSIX 1003.1-2001 hosts, as required by POSIX.
5410
5411         * doc/coreutils.texi (join invocation): Remove documentation
5412         accordingly.  Document that -t makes all separators significant.
5413
5414         * src/join.c: Include posixver.h.
5415         (obsolete_usage): New var.
5416         (longopts): Put obsolete options first.
5417         (OBSOLETE_LONG_OPTIONS): New constant.
5418         (get_option, add_file_name): New functions.
5419         (main): Use them to support new behavior.
5420         (usage): Remove documentation for -j1 FIELD and -j2 FIELD.
5421         Do not mark -j FIELD as obsolescent; it is longstanding
5422         UNIX tradition and is a valid extension to POSIX.
5423
5424         * tests/join/Test.pm (tv): Avoid obsolete -o usage.
5425
5426 2003-12-28  Paul Eggert  <eggert@twinsun.com>
5427
5428         * src/join.c (add_field_list): Don't use alloca with unbounded
5429         size; just modify the argument, which is no longer const *.
5430
5431         Various other minor cleanups, mostly to avoid the need for casts.
5432
5433         (extract_field): Renamed from ADD_FIELD, as it's now a function.
5434
5435         (struct field.beg): Now char *, not unsigned char const *.  All
5436         uses changed.  It shouldn't be const since xmemcoll writes on its
5437         arguments.
5438         (extract_field): Likewise, for 2nd arg.
5439         (keycmp): Remove now-unnecessary cast of xmemcoll args.
5440
5441         (is_blank): New function, to avoid need to cast arg to unsigned char.
5442         (extract_field): Use it.
5443
5444         (xfields): Rewrite pretty much from scratch.
5445
5446         (hard_LC_COLLATE): Now bool, not int.
5447         (get_line, getseq, add_field_list): Now returns bool, not int.
5448         (decode_field_spec, add_field_list): Return true on success (not
5449         false), for consistency with the rest of the code.  All uses changed.
5450
5451         (tab): Now char, not unsigned char.  This wasn't 100% necessary
5452         but is slightly cleaner.
5453         (prjoin): Hoist (tab ? tab : ' ') expression, to help the compiler.
5454
5455         (empty_filler): Now const *.
5456
5457         (make_blank): Remove; wasn't needed.  Remove all calls.
5458         (main): Don't set uni_blank.nfields; zero is fine.
5459
5460 2003-12-27  Jim Meyering  <jim@meyering.net>
5461
5462         * src/join.c: Include "quote.h".
5463         (min, max): Remove definitions.
5464         Make a few function parameters and corresponding
5465         locals `const'.  Use bool for boolean variables.
5466         Use size_t (not int) for all counters and related index variables.
5467         (prjoin): Remove now-useless assertion.
5468         (string_to_join_field): New function.
5469         (main): Accept join fields as large as SIZE_MAX.
5470         (keycmp): Rename `min' to MIN and max to MAX.
5471
5472 2003-12-26  Jim Meyering  <jim@meyering.net>
5473
5474         fold -s didn't work on e.g., alpha-based systems.
5475         * src/fold.c (fold_file): Adjust types (int->size_t) so that using
5476         x2nrealloc works properly on systems with differing sizes for int
5477         and size_t.  Reported by Nelson Beebe.
5478
5479         * src/fold.c: Use `bool' (not int) as the type for a few
5480         global variables.
5481
5482 2003-12-23  Paul Eggert  <eggert@twinsun.com>
5483
5484         * src/ls.c (length_of_file_names_and_frills):
5485         Remove forward decl; not needed.
5486         (print_file_name_and_frills, length_of_file_name_and_frills):
5487         With -m, don't output spaces before inum or size.
5488         (print_with_commas): Don't output space just before newline.
5489
5490 2003-12-24  Jim Meyering  <jim@meyering.net>
5491
5492         * tests/ls/Makefile.am (TESTS): Add m-option.
5493         * tests/ls/m-option: New file.  Test for above fixes.
5494
5495 2003-12-20  Jim Meyering  <jim@meyering.net>
5496
5497         * Version 5.1.0.
5498
5499         * src/pr.c: Change type of global, buff_allocated, to size_t.
5500
5501         * src/join.c [struct seq]: Change types of members count and alloc
5502         from `int' to `size_t'.
5503
5504         * tests/Makefile.am (root-hint): Tweak wording.
5505
5506         * src/du.c: Accept new option (-0, --null) that makes it so each
5507         output line is NUL-terminated rather than newline-terminated.
5508
5509         * src/dd.c (apply_translations): Don't prohibit conv=unblock,sync.
5510         Reported by Volker Paul.
5511         * tests/dd/Makefile.am (TESTS): Add unblock-sync.
5512         * tests/dd/unblock-sync: New test for the above.
5513
5514 2003-12-19  Jim Meyering  <jim@meyering.net>
5515
5516         * tests/misc/nohup: Double quote back-ticked expression,
5517         in case it ends up having an unexpected value.
5518
5519         * tests/ls/no-arg: Use ls's -1 option in both runs.
5520
5521         * src/du.c (fts_debug): New global.
5522         (FTS_CROSS_CHECK, DEBUG_OPT): Define.
5523         (main): Make fts use FTS_TIGHT_CYCLE_CHECK.
5524         (main) [DU_DEBUG]: Accept -d option.
5525
5526 2003-12-18  Jim Meyering  <jim@meyering.net>
5527
5528         * src/ls.c (format_user): Increment dired_pos via two statements,
5529         `dired_pos += width; dired_pos++;' rather than one,
5530         `dired_pos += width + 1;' since the latter could conceivably overflow.
5531         (format_group): Likewise.
5532         From Paul Eggert.
5533
5534         * configure.ac: Require automake-1.8.
5535
5536 2003-12-12  Jim Meyering  <jim@meyering.net>
5537
5538         * Use automake-1.8.  Regenerate dependent files.
5539
5540 2003-12-08  Jim Meyering  <jim@meyering.net>
5541
5542         * Makefile.maint (news-date-check): New rule.
5543         (alpha beta major): Depend on it.
5544
5545 2003-12-03  Paul Eggert  <eggert@twinsun.com>
5546
5547         * NEWS: ls -l (and similar options) now adjust all columns to
5548         fit the data.  Generalized from a suggestion by Leah Q for file sizes.
5549         * src/ls.c (INODE_DIGITS, LOGIN_NAME_MAX, ID_LENGTH_MAX): Remove.
5550         (format_user_width, format_group_width, unsigned_file_size,
5551         format_group): New functions.
5552         (block_size_width): Renamed from block_size_size.
5553         (inode_number_width, nlink_width, owner_width, group_width,
5554         author_width, major_device_number_width, minor_device_number_width,
5555         file_size_width): New vars.
5556         (clear_files): Initialize them.
5557         (gobble_file): Set them.  Don't ceiling block_size_width to 7.
5558         (print_long_file): Use them.
5559         (gobble_file): Use a new local variable 'f' to make the code
5560         smaller and more consistent with other functions.
5561         (format_user): Output to stdout, not to a buffer, so that we
5562         don't have to worry about buffer overrun.  Update dired_pos.
5563         (print_long_file): Don't put owner, group, author into buffer;
5564         just print them directly.  Don't assume link counts and
5565         major and minor numbers fit into unsigned long int.
5566         * tests/cp/same-file, tests/mv/part-symlink: Don't assume that
5567         'ls' output is fixed-width.
5568
5569 2003-12-02  Jim Meyering  <jim@meyering.net>
5570
5571         * src/md5sum.c: Include sha1.h (reflect renaming: sha.h -> sha1.h.
5572
5573 2003-11-27  Jim Meyering  <jim@meyering.net>
5574
5575         * Use automake-1.7f.  Regenerate dependent files.
5576
5577 2003-11-24  Paul Eggert  <eggert@twinsun.com>
5578
5579         Parse floating-point operands and options in the C locale.
5580         POSIX requires this for printf, and we might as well be
5581         consistent elsewhere (tail, sleep, seq).
5582
5583         * src/printf.c: Remove decls of strtod, strtol, strtoul; no longer
5584         needed now that we assume C89.  Include "c-strtod.h".
5585         (xstrtod): Call c_strtod, not strtod.
5586         * src/sleep.c: Include "c-strtod.h".
5587         (main): Update xstrtod call to include new argument, c_strtod.
5588         * src/seq.c (scan_double_arg): Likewise.
5589         * src/tail.c (parse_options): Likewise.
5590
5591 2003-11-24  Jim Meyering  <jim@meyering.net>
5592
5593         * tests/rm/fail-2eperm: Handle another errno variant (HPUX, EPERM).
5594         Reported by Mark Conty.
5595
5596 2003-11-22  Jim Meyering  <jim@meyering.net>
5597
5598         * Makefile.maint (sc_xalloc_h_in_src): Remove rule.  Subsumed by...
5599         (sc_system_h_headers): Do this test only if sys2.h exists.
5600
5601 2003-11-20  Jim Meyering  <jim@meyering.net>
5602
5603         * tests/help-version: Ensure that the bug-reporting address is
5604         included in the --help output for every program.
5605         * tests/Makefile.am (TESTS_ENVIRONMENT): Add $PACKAGE_BUGREPORT.
5606
5607         * src/ptx.c (usage): Output bug-reporting address.
5608         Reported by Dan Jacobson.
5609
5610 2003-11-19  Jim Meyering  <jim@meyering.net>
5611
5612         * src/join.c (usage): Mention that FILE1 and FILE2 must be sorted
5613         on the join fields.  Suggestion from Bruce Robertson.
5614
5615 2003-11-18  Jim Meyering  <jim@meyering.net>
5616
5617         `od -c -w9999999' could segfault
5618         * src/od.c (dump): Use xnmalloc/free, not alloca.
5619
5620 2003-11-16  Jim Meyering  <jim@meyering.net>
5621
5622         * Use autoconf-2.59.  Regenerate dependent files.
5623
5624         * tests/du/hard-link: Minor tweak: use mkdir -p.
5625
5626         Fix read-from-free'd-buffer error detected by valgrind.
5627         * src/csplit.c (remove_line): Don't return a pointer to data in
5628         a freed buffer.  Instead, arrange to free the buffer on the
5629         subsequent call.
5630
5631         * tests/misc/csplit: New test for above fix.
5632
5633 2003-11-11  Jim Meyering  <jim@meyering.net>
5634
5635         * src/ls.c (extract_dirs_from_files): Avoid useless copy operations.
5636         This avoids a warning from valgrind about memcpy with overlapping
5637         source and destination.
5638
5639         * configure.ac: Require automake-1.7.8.
5640
5641 2003-11-09  Jim Meyering  <jim@meyering.net>
5642
5643         * Use automake-1.7.9.  Regenerate dependent files.
5644
5645         * src/rm.c: Support new options: --preserve-root and --no-preserve-root.
5646         * src/chown.c: Likewise.
5647
5648         * src/chown-core.c: Include "root-dev-ino.h".
5649         (chopt_init): Initialize new member.
5650         (change_file_owner): Support rm's new --preserve-root option.
5651
5652         * src/remove.c: Include "root-dev-ino.h".
5653         (remove_cwd_entries): Remove now-obsolete FIXME comment.
5654         (remove_dir): Support rm's new --preserve-root option.
5655
5656         * src/chown.c: Include "root-dev-ino.h".
5657         Add new options: --preserve-root and --no-preserve-root.
5658
5659         * src/chmod.c: Include "root-dev-ino.h".
5660         (process_file): Use newly-factored-out ROOT_DEV_INO_CHECK and
5661         ROOT_DEV_INO_WARN macros.
5662         (get_root_dev_ino): Remove function definition, now that it's
5663         been moved to a separate file.
5664         (usage): Describe new options.
5665
5666         * src/mv.c (rm_option_init): Initialized new member.
5667
5668         * src/remove.h: Include "dev-ino.h".
5669         (struct rm_options): Add new member: root_dev_ino.
5670         * src/chown-core.h: Include "dev-ino.h".
5671         (struct Chown_option): Add new member: root_dev_ino.
5672
5673 2003-11-06  Jim Meyering  <jim@meyering.net>
5674
5675         * src/paste.c (paste_parallel): Use `sizeof *var' rather than
5676         hard-coding `sizeof FILE*'.
5677
5678 2003-11-05  Dennis Smit  <ds@nerds-incorporated.org>
5679
5680         * src/wc.c (main): Free `fstatus' so there is no confusion about
5681         whether it's leaked or not.
5682         * src/who.c (who): Likewise for `utmp_buf'.
5683
5684 2003-11-05  Paul Eggert  <eggert@twinsun.com>
5685
5686         Fix 'cut' problems with size_t overflow and unsigned int.
5687         More generally, resize integer variables to fit use more precisely.
5688         * src/cut.c (ADD_RANGE_PAIR): Remove unnecessary parens.
5689         (struct range_pair): Make members to be of type size_t, not unsigned.
5690         (max_range_endpoint, eol_range_start): Now size_t, not unsigned.
5691         (suppress_non_delimited, output_delimiter_specified,
5692         have_read_stdin, print_kth, set_fields): Now bool, nt int.
5693         (delim): Now unsigned char, not int.
5694         (mark_printable_field, is_printable_field, is_range_start_index,
5695         set_fields, set_fields, cut_bytes, cut_fields):
5696         Use size_t, not unsigned, for field and byte counts.
5697         (hash_int): Use uintptr_t, not unsigned, for pointers converted
5698         to integers.  This squeezes more info out of them.
5699         (set_fields, cut_bytes, cut_fields, main):
5700         Use bool, not int, for booleans.
5701         (set_fields): Allocate zeroed byte array with xzalloc, not xcalloc.
5702
5703 2003-11-05  Paul Eggert  <eggert@twinsun.com>
5704
5705         * man/Makefile.am (check-programs-vs-x):
5706         Work even if $(programs) contains '$'.
5707         Work even if 'missing=1' in environment.
5708         Don't report an error simply because $(programs) outputs nothing.
5709
5710 2003-11-05  Jim Meyering  <jim@meyering.net>
5711
5712         * Use autoconf-2.58.  Regenerate dependent files.
5713
5714         * src/tr.c (spec_init): Fix typo in last change.
5715
5716         * src/sys2.h (case_GETOPT_VERSION_CHAR): Cast NULL to `(char *)' in
5717         call to variadic version_etc function, so that it works even on systems
5718         for which sizeof char* != sizeof int.
5719         * src/true.c (main): Likewise.
5720         * basename.c, chroot.c, cksum.c, dd.c, dirname.c, echo.c, expr.c:
5721         * factor.c, hostid.c, hostname.c, link.c, logname.c, nice.c, nohup.c:
5722         * pathchk.c, printenv.c, printf.c, pwd.c, setuidgid.c, sleep.c, stty.c:
5723         * sync.c, test.c, tsort.c, unlink.c, uptime.c, users.c, whoami.c, yes.c:
5724         Similarly, cast NULL to `(char *)' in call to variadic function,
5725         parse_long_options, so that it works even on systems for which
5726         sizeof char* != sizeof int.
5727         A similar problem was reported by Harti Brandt in
5728         http://mail.gnu.org/archive/html/bug-gnu-utils/2003-10/msg00320.html.
5729
5730         * src/users.c (users): Free `utmp_buf' explicitly so that people
5731         don't mistake this for a real leak.
5732         Patch by Dennis Smit <ds@nerds-incorporated.org.
5733
5734 2003-11-04  Paul Eggert  <eggert@twinsun.com>
5735
5736         * README: Document _POSIX2_VERSION.
5737
5738 2003-11-04  Jim Meyering  <jim@meyering.net>
5739
5740         * src/tac.c (memrchr): Remove #if-0'd function.
5741         (tac_stdin_to_mem): Clean up #if-0'd code.
5742
5743         * src/od.c (decode_format_string): Remove unnecessary casts.
5744         Use more maintainable `sizeof *var'.
5745         (main): Call decode_format_string rather than decode_one_format,
5746         now that `spec' may be NULL.
5747
5748         * src/chmod.c (AUTHORS): Add my name.
5749
5750         * src/split.c (next_file_name): Use `sizeof *var' rather than
5751         hard-coding `sizeof size_t'.
5752
5753         * src/sort.c (new_key): Use xzalloc, not xcalloc (1, ...).
5754
5755         * src/cut.c (ADD_RANGE_PAIR): Use x2nrealloc rather than xrealloc,
5756         to avoid potential overflow in pointer arithmetic.
5757         (set_fields): Use not `1', but rather `sizeof *printable_field' as
5758         second argument to xcalloc.
5759         * src/od.c (decode_format_string, dump_strings): Use x2nrealloc
5760         rather than xrealloc.
5761         * src/date.c (show_date): Likewise.
5762         * src/join.c (ADD_FIELD, initseq, getseq): Likewise.
5763         * src/pr.c (store_char): Likewise.
5764         * src/fold.c (fold_file): Likewise.
5765
5766         * src/copy.c (triple_hash, triple_hash_no_name): Adjust to reflect
5767         type changes (unsigned int -> size_t) in hash.c.
5768         * src/cp-hash.c (src_to_dest_hash): Likewise.
5769         * src/du.c (entry_hash): Likewise.
5770         * src/ls.c (dev_ino_hash): Likewise.
5771         * src/cut.c (hash_int): Likewise.  Declare function as static.
5772
5773 2003-11-03  Jim Meyering  <jim@meyering.net>
5774
5775         * tests/misc/Makefile.am (TESTS_ENVIRONMENT): Define PACKAGE_VERSION.
5776         * tests/misc/fold: Fail the test immediately if we're not running
5777         the expected version of fold.
5778
5779 2003-11-02  Jim Meyering  <jim@meyering.net>
5780
5781         * src/tr.c (append_normal_char, append_range, append_char_class)
5782         (append_repeated_char, append_equiv_class, spec_init): Use `sizeof *var'
5783         rather than `sizeof EXPLICIT_TYPE'.  The former is more maintainable
5784         and usually shorter.
5785         * src/copy.c (copy_internal): Likewise.
5786         * src/join.c (initseq, add_field, make_blank): Likewise.
5787         * src/od.c (main): Likewise.
5788         * src/cp.c (make_path_private): Likewise.
5789         * src/tsort.c (new_item, record_relation): Likewise.
5790
5791         * src/df.c (add_fs_type, add_excluded_fs_type, main): Likewise.
5792         (main): Also remove anachronistic cast of xmalloc return value.
5793         * src/ptx.c (alloc_and_compile_regex, main): Likewise.
5794         (main): Also remove anachronistic cast of xmalloc return value.
5795         * src/sort.c (inittables): Likewise.
5796         (sort): Also Split a long line.
5797
5798 2003-10-25  Jim Meyering  <jim@meyering.net>
5799
5800         * src/copy.c (triple_hash, triple_hash_no_name): Adjust to reflect
5801         type changes (unsigned int -> size_t) in hash.c.
5802         * src/cp-hash.c (src_to_dest_hash): Likewise.
5803         * src/du.c (entry_hash): Likewise.
5804         * src/ls.c (dev_ino_hash): Likewise.
5805         * src/cut.c (hash_int): Likewise.  Declare function as static.
5806
5807 2003-10-21  Jim Meyering  <jim@meyering.net>
5808
5809         Don't fail when run with VERBOSE=yes.
5810         * tests/chgrp/basic: Do `set +x' before starting the subshell
5811         from which we invoke chgrp.  Otherwise, the output from the
5812         VERBOSE=yes-induced `set -x' would result in spurious differences.
5813         Reported by Russel Coker via Michael Stone.
5814
5815 2003-10-19  Jim Meyering  <jim@meyering.net>
5816
5817         chmod now uses fts to perform a directory traversal when -R is
5818         specified.  Before, it operated on full path names, and as such
5819         would encounter the PATH_MAX (often 4096) limit.
5820
5821         * src/chmod.c: Include "xfts.h".
5822         (process_file): Rename from change_file_mode.
5823         Adapt to be used with fts.
5824         (process_files): New function.
5825
5826 2003-10-18  Jim Meyering  <jim@meyering.net>
5827
5828         * tests/du/deref-args: Ensure that du -D now dereferences all
5829         symlinks specified on the command line, not just those that
5830         reference directories.
5831
5832         * basename.c, cat.c, chroot.c, cksum.c, comm.c, cp.c, csplit.c, cut.c:
5833         * dd.c, df.c, dirname.c, du.c, echo.c, env.c, expr.c, factor.c, head.c:
5834         * hostid.c, hostname.c, id.c, link.c, ln.c, logname.c, ls.c, md5sum.c:
5835         * mv.c, nice.c, nl.c, nohup.c, paste.c, pathchk.c, pinky.c, pr.c:
5836         * printenv.c, printf.c, pwd.c, rm.c, setuidgid.c, sleep.c, sort.c:
5837         * split.c, stty.c, sum.c, sync.c, tac.c, tail.c, tee.c, test.c:
5838         * touch.c, tsort.c, uniq.c, unlink.c, uptime.c, users.c, wc.c:
5839         * who.c, whoami.c, yes.c (AUTHORS): Revert the WRITTEN_BY/AUTHORS change
5840         of 2003-09-19.  Now, AUTHORS is a comma-separated list of strings.
5841         Update the call to parse_long_options so that `AUTHORS, NULL' are the
5842         last parameters.
5843         * src/true.c (main): Append NULL to version_etc argument list.
5844         * src/sys2.h (case_GETOPT_VERSION_CHAR): Likewise.
5845
5846 2003-10-17  Andreas Schwab  <schwab@suse.de>
5847
5848         * tests/mk-script: Get $srcdir from first parameter instead of
5849         hardcoding it.
5850         (main): Update usage.
5851
5852         * tests/Makefile.am.in ($(srcdir)/$x-tests): Pass $(srcdir) as
5853         first argument of mk-script.
5854         ($(srcdir)/Makefile.am): Likewise.  Prepend $(srcdir) to target.
5855
5856 2003-10-17  Jim Meyering  <jim@meyering.net>
5857
5858         * src/mv.c (usage): Tweak descriptions of -i and -f so that the
5859         generated `man' page is more readable.  Suggestion from Dan Jacobson.
5860
5861         * src/chown-core.c (change_file_owner): Handle the cases in
5862         which fts_info indicates an error with the given entry.
5863
5864         * src/du.c (main): Simply assign to bit_flags.
5865         Don't bother with bit arithmetic.
5866
5867         * tests/chmod/no-x: New file.
5868         * tests/chgrp/no-x: New file.
5869         * tests/chmod/Makefile.am (TESTS): Add no-x.
5870         * tests/chgrp/Makefile.am (TESTS): Likewise.
5871
5872         * src/du.c: Include "xfts.h".
5873         (du_files): Use xfts_open, rather than fts_open.
5874         * src/chown-core.c (chown_files): Likewise.
5875
5876 2003-10-16  Jim Meyering  <jim@meyering.net>
5877
5878         * src/chgrp.c (main): Simply assign to bit_flags.
5879         Don't bother with bit arithmetic.
5880         * src/chown.c (main): Likewise.
5881         Rename a couple of local variables.
5882         Remove unnecessary casts.
5883
5884         * src/tail.c (start_bytes): Rename local, remainder, to avoid
5885         gcc's warning about shadowing a global.
5886
5887 2003-10-15  Jim Meyering  <jim@meyering.net>
5888
5889         chown and chgrp now accept POSIX-mandated -H, -L, -P options and
5890         use fts to perform a directory traversal when -R is specified.
5891         Before, they operated on full path names, and as such would
5892         encounter the PATH_MAX (often 4096) limit.
5893         They are more efficient.  For example, before, chgrp -R would
5894         take almost 5 seconds to change about 2000 directories and fail
5895         (with `File name too long'), while now it succeeds on a hierarchy
5896         of depth 20,000 in 1/10 the time.
5897
5898         * src/chown.c: Include "userspec.h" and "fts_.h".
5899         (WRITTEN_BY): Add my name.
5900         (getpwnam, getgrnam, getgrgid): Remove declarations.
5901         (endpwent): Remove definition.
5902         (usage): Update.
5903         (main): Handle new options.
5904         Call new function, chown_files rather than change_file_owner.
5905
5906         * src/chgrp.c: Include "fts_.h".
5907         (WRITTEN_BY): Add my name.
5908         (MAXUID, MAXGID): Remove definitions.  Use GID_T_MAX instead of
5909         the latter.
5910         (usage): Update.
5911         (main): Handle new options.
5912         Call new function, chown_files rather than change_file_owner.
5913
5914         Rewrite to iterate through hierarchies using fts rather than
5915         via explicit recursion.
5916         * src/chown-core.c: Include "fts_.h"
5917         (change_file_owner): Rewrite to use FTS* and FTSENT* and to operate
5918         on a single file at a time.
5919         (chown_files): New function.
5920         * src/chown-core.h [enum Dereference_symlink]: Remove declaration.
5921         [struct Chown_option] (recurse, force_silent): Change type to `bool'.
5922         [struct Chown_option] (dereference): Remove member with ambiguous name.
5923         [struct Chown_option] (affect_symlink_referent): New member.
5924         (chown_files): New prototype.
5925
5926         * tests/chgrp/recurse: Update tests accordingly.
5927         * tests/chgrp/posix-H: New tests for the above.
5928         * tests/chgrp/Makefile.am (TESTS): Add posix-H.
5929
5930         * src/ln.c (usage): Clarify that --directory, -d, -F probably won't
5931         work even for superuser.  Suggestion from Dan Jacobson.
5932
5933 2003-10-14  Paul Eggert  <eggert@twinsun.com>
5934
5935         Fix some number-parsing bugs, e.g., "head -n 100k@" wasn't
5936         properly diagnosed.
5937         * lib/human.c, lib/xstrtoimax.c, lib/xstrtol.c, lib/xstrtol.h,
5938         lib/xstrtoul.c, lib/xstrtoumax.c: Sync with gnulib.
5939         * src/sort.c (parse_field_count): Handle the case where overflow
5940         and invalid suffix char are both reported.
5941
5942 2003-10-14  Jim Meyering  <jim@meyering.net>
5943
5944         * src/ls.c (decode_switches) [TIOCGWINSZ]: Comment out the
5945         warning-inducing test, ws.ws_col <= SIZE_MAX, since it was always
5946         true on Linux.
5947
5948 2003-10-13  Paul Eggert  <eggert@twinsun.com>
5949
5950         Fix to avoid a denial-of-service attack if the display width is
5951         enormous.  Also, clean up the code a bit by removing duplicate code.
5952
5953         * src/ls.c (init_column_info): Remove forward decl; no longer needed.
5954         (calculate_columns): New function, that contains code that used
5955         to be common to print_many_per_line and print_horizontal.
5956         (print_many_per_line, print_horizontal): Use it.
5957         (decode_switches): Set max_idx here, not in calculate_columns.
5958         (print_current_files): Don't call init_column_info; calculate_columns
5959         now does that.
5960         (init_column_info): Don't allocate a lot more space than is needed
5961         to represent the current set of files.  Allocate all the new
5962         size_t cells in one call to xnmalloc, rather than a row at a time.
5963
5964 2003-10-13  Jim Meyering  <jim@meyering.net>
5965
5966         * src/ls.c (init_column_info): Add another FIXME comment.
5967
5968 2003-10-13  Paul Eggert  <eggert@twinsun.com>
5969
5970         Fix address-arithmetic bug in 'ls', reported by Georgi Guninski.
5971         Remove several arbitrary limits on hosts where int cannot represent
5972         all size_t values.
5973
5974         * src/ls.c (struct bin_str.len, length_of_file_name_and_frills, indent,
5975         nfiles, files_index, tabsize, line_length, struct column_info.line_len,
5976         struct column_info.col_arr[0], max_idx):
5977         Now size_t, not int.
5978         (get_funky_string): Return bool indicating success, instead of
5979         a negative count to indicate failure.  Store number of columns
5980         through new parameter OUTPUT_COUNT; that way, they can never
5981         go negative.  Change equals_end from int to bool.  All uses
5982         changed.
5983         (struct column_info.valid_len): Now bool, not int.  All uses changed.
5984         (dired_dump_obstack, get_funky_string, clear_files,
5985         extract_dirs_from_files, print_current_files,
5986         print_many_per_line, print_horizontal, init_column_info,
5987         put_indicator, length_of_file_name_and_frills,
5988         print_with_commas): Use size_t, not int, for local variables
5989         that count sizes.
5990         (decode_switches): Decode sizes using xstrtoul, not xstrtol.
5991         Check for TIOCGWINSZ returing negative values (or values greater
5992         than SIZE_MAX!).
5993         (visit_dir, main, parse_ls_color, queue_directory, add_ignore_pattern,
5994         init_column_info):
5995         Use xmalloc and xnmalloc, not XMALLOC.
5996         (gobble_file): Use xnrealloc, not XREALLOC.
5997         (print_color_indicator): Remove now-unnecessary cast to size_t.
5998
5999 2003-10-12  Paul Eggert  <eggert@twinsun.com>
6000
6001         * tests/du/no-x: Change wording of diagnostic to match latest du.c.
6002         * tests/sort/sort-tests: Remove from CVS; assume that people
6003         brave enough to check coreutils out from CVS can rebuild it.
6004
6005 2003-10-12  Jim Meyering  <jim@meyering.net>
6006
6007         New options: --preserve-root and --no-preserve-root.
6008         * src/chmod.c (change_file_mode): Honor new option.
6009         (change_file_mode): Strip trailing slashes on directory
6010         argument passed to change_dir_mode.
6011         (get_root_dev_ino): New function.
6012         (main): Initialize global, root_dev_ino.
6013
6014         * src/copy.c (copy_internal): Don't #ifdef-out simple uses of
6015         S_ISLNK or S_ISSOCK.  The S_IS* macros are guaranteed to be defined
6016         via system.h.
6017         * src/chmod.c (change_file_mode): Likewise.
6018
6019 2003-10-08  Jim Meyering  <jim@meyering.net>
6020
6021         * src/csplit.c (main): Remove obsolete FIXME.
6022
6023 2003-10-07  Jim Meyering  <jim@meyering.net>
6024
6025         * Use automake-1.7.8.  Regenerate dependent files.
6026
6027 2003-09-29  Paul Eggert  <eggert@twinsun.com>
6028
6029         csplit cleanup.
6030
6031         * doc/coreutils.texi (csplit invocation):
6032         The regexp offset need not have a sign; POSIX requires support
6033         for signless offets.
6034
6035         Be more careful about int widths.  For example, remove some
6036         arbitrary limits by replacing 'unsigned' with 'size_t',
6037         'uintmax_t', etc.  Use standard bool rather than a homegrown type.
6038         * lib/Makefile.am (libfetish_a_SOURCES): Add xstrtoimax.c.
6039         * src/csplit.c (FALSE, TRUE, boolean): Remove.  All uses changed
6040         to <stdbool.h> usage.
6041         (struct control): offset is now intmax_t, not int.
6042         repeat_forever is now bool, not int.
6043         (struct cstring): len is now size_t, not unsigned int.
6044         (struct buffer_record): bytes_alloc, bytes_used, num_lines are now
6045         size_t, not unsigned.  start_line, first_available are now
6046         uintmax_t, not unsigned.
6047         (hold_count, control_used): Now size_t, not unsigned.
6048         (last_line_number, current_line, bytes_written):
6049         Now uintmax_t, not unsigned.
6050         (save_to_hold_area, red_input, keep_new_line, record_line_starts,
6051         create_new_buffer, get_new_buffer, load_buffer, find_line,
6052         process_regexp, split_file, new_control_record, extract_regexp,
6053         get_format_width, get_format_prec, max_out):
6054         size args, locals, and returned values are now size_t, not unsigned
6055         or int.
6056         (get_first_line_in_buffer, find_line, write_to_file,
6057         handle_line_error, process_line_count, regexp_error, process_regexp,
6058         split_file):
6059         File line, byte, and repetition counts are now uintmax_t, not unsigned.
6060         (check_for_offset): Don't require a sign before the offset.
6061         Use xstrtoimax to do the real work.
6062         (extract_regexp): Remove harmful cast of size to unsigned.
6063         256 -> 1<<CHAR_BIT, for clarity.
6064         (get_format_flags): Return at most 3, to avoid worries about overflow.
6065
6066         (bytes_to_octal_digits): Remove.
6067
6068         (cleanup): Don't check whether output_stream is NULL, since
6069         close_output_file does that for us.
6070
6071         (new_line_control, create_new_buffer): Use "foo *p = xmalloc
6072         (sizeof *p);" instead of the more long-winded alternatives.
6073
6074         (get_new_buffer): Use O(1) algorithm for resizing a buffer
6075         to a much larger size, instead of an O(N) algorithm.
6076
6077         (process_regexp): Use plain NULL rather than casted 0.
6078
6079         (make_filename): Use %u, not %d, to format unsigned file number.
6080
6081         (new_control_record): Use xrealloc exclusively, since it handles
6082         NULL reliably.
6083
6084         (extract_regexp): Change misspelled word in diagnostic.
6085
6086         (get_format_width): Even if a minimum field width is specified,
6087         allow room for enough octal digits to represent the value of
6088         the maximum representible integer.  This fixes a potential
6089         buffer overrun.  Calculate this room at compile-time, not
6090         at run-time; this removes the need for bytes_to_octal_digits.
6091         Check for overflow; this removes a FIXME.
6092
6093         (get_format_prec): Don't allow precision to be signed; it's
6094         not ANSI.  Check for overflow.  Remove hardcoded "11" as
6095         default precision; this fixes a potential buffer overrun
6096         on hosts with wider size_t.
6097
6098         (get_format_conv_type): Change local variable to be of type
6099         unsigned char, not int; this removes a potential subscript
6100         violation on hosts where char is signed.
6101
6102         (max_out): Replace "for (;*p;)" with more-standard "while (*p)".
6103         Allow "%%" in format.  Don't overflow when
6104         counting lots of percents.
6105
6106         (usage): Default sprintf format is %02u, not %d.
6107
6108 2003-10-05  Jim Meyering  <jim@meyering.net>
6109
6110         * src/chown-core.c (change_file_owner): Remove set-but-not-used local.
6111
6112         * src/du.c (du_files): Mark diagnostic for translation.
6113
6114 2003-10-04  Jim Meyering  <jim@meyering.net>
6115
6116         * src/du.c (du_files): Ignore any failure of fts_close.
6117         Give better diagnostics for failed fts_open.
6118
6119         * src/du.c (MAX_N_DESCRIPTORS): Remove now-unused definition.
6120
6121         Deprecate existing use of -H (aka --si).
6122         * src/du.c (enum) [HUMAN_SI_OPTION]: New member.
6123         [long_options]: Use HUMAN_SI_OPTION, not 'H'.
6124         (main): Warn that the meaning of -H will soon change to be
6125         POSIX compliant.
6126
6127 2003-10-03  Jim Meyering  <jim@meyering.net>
6128
6129         * src/du.c: Accept --no-dereference (-P).
6130
6131 2003-10-02  Jim Meyering  <jim@meyering.net>
6132
6133         * tests/du/trailing-slash: Adjust for slightly different output.
6134
6135         Rewrite du.c to use fts.
6136         * src/du.c: Include "fts_.h", not ftw.h.
6137         (opt_dereference_arguments, arg_length, suffix_length): Remove globals.
6138         (IS_FTW_DIR_TYPE): Remove definition.
6139         (IS_DIR_TYPE): Define.
6140         (is_symlink_to_dir): Remove now-unnecessary function.
6141         (process_file, du_files): Rewrite to use fts.
6142
6143         * tests/du/inaccessible-cwd: Ensure that even when run from an
6144         inaccessible directory, du can still operate on accessible
6145         directories elsewhere.
6146         * tests/du/Makefile.am (TESTS): Add inaccessible-cwd.
6147
6148         * tests/rm/deep-1: Ensure that du can process a hierarchy
6149         of depth 400 while using no more than 50KB of stack space.
6150
6151 2003-10-01  Akim Demaille  <akim@epita.fr>
6152
6153         * announce-gen (print_news_deltas): New function, extracted from main.
6154         (main): Make `news_file' an array.
6155         Use '...=s' => \@var for --news and --url-directory specs.
6156         Before there were a couple of portability problems.
6157
6158 2003-09-28  Jim Meyering  <jim@meyering.net>
6159
6160         * Makefile.maint (sc_cast_of_alloca_return_value): New rule.
6161         (syntax-check-rules): Add it.
6162
6163         * src/copy.c: Remove unnecessary cast of alloca, since now it's
6164         guaranteed to be (void *).
6165         * src/cp.c: Likewise.
6166         * src/join.c: Likewise.
6167         * src/ln.c: Likewise.
6168         * src/ls.c: Likewise.
6169         * src/od.c: Likewise.
6170         * src/sys2.h (ASSIGN_STRDUPA): Likewise.
6171
6172 2003-09-27  Jim Meyering  <jim@meyering.net>
6173
6174         Don't exhaust virtual memory when processing large inputs.
6175         Fix this by removing csplit's internal free-list management;
6176         instead rely on malloc for that.
6177
6178         * src/csplit.c (free_list): Remove global.
6179         (clear_all_line_control): Remove function.
6180         (get_new_buffer): Always use create_new_buffer to obtain a
6181         new buffer, rather than searching free_list.
6182         (free_buffer): Just call free.
6183         Reported by Nikola Milutinovic.
6184
6185 2003-09-26  Jim Meyering  <jim@meyering.net>
6186
6187         * man/rm.x: Also list `chattr' in SEE ALSO section.
6188         Suggestion from Mark Hubbart.
6189
6190 2003-09-25  Jim Meyering  <jim@meyering.net>
6191
6192         * configure.ac: Don't invoke AC_AIX or AC_MINIX explicitly, now
6193         that we use gl_USE_SYSTEM_EXTENSIONS, since it AC_REQUIREs them.
6194
6195         * Use autoconf-2.57d.  Regenerate dependent files.
6196
6197 2003-09-24  Jim Meyering  <jim@meyering.net>
6198
6199         Minor efficiency tweak.
6200         * src/ln.c (PATH_BASENAME_CONCAT): Use memcpy rather than strcpy.
6201         (do_link): Likewise.
6202
6203 2003-09-23  Jim Meyering  <jim@meyering.net>
6204
6205         * src/paste.c (paste_serial): Save errno after input error,
6206         to report proper errno value.
6207         Based on a patch from Paul Eggert.
6208
6209         * src/tee.c (tee): Adjust fwrite arguments so that the return
6210         value is the number of bytes written.
6211
6212 2003-09-16  Paul Eggert  <eggert@twinsun.com>
6213
6214         Don't assume ferror sets errno.  Bug reported by Bruno Haible.
6215
6216         * src/comm.c (compare_files): Save errno after input error,
6217         to report proper errno value.
6218         * src/fold.c (fold_file): Likewise.
6219         * src/od.c (check_and_close, skip, read_char, read_block): Likewise.
6220         * src/unexpand.c (unexpand): Likewise.
6221
6222         * src/csplit.c (close_output_file): Don't report bogus errno value
6223         after ferror discovers an output error.  We don't know the proper
6224         errno value, since it might have been caused by any of a whole
6225         bunch of calls, and it might have been trashed in the meantime.
6226         Fixing this problem will require much more extensive changes;
6227         in the meantime just say "write error".
6228         * src/od.c (check_and_close, dump, dump_strings): Likewise.
6229         * src/uniq.c (check_file): Likewise.
6230
6231         * src/join.c (get_line): Report error right away if I/O fails,
6232         so that the proper errno value is used.
6233         * src/tac.c (tac_seekable, tac_file, save_stdin): Likewise.
6234         * src/tee.c (tee): Likewise.
6235         * src/uniq.c (check_file): Likewise.
6236
6237         * src/od.c (skip): If a read fails, don't retry it later, so
6238         that we report the proper errno.
6239
6240         * src/tac.c (tac_mem): Don't return a value; nobody uses it.
6241
6242         * src/tee.c (tee): Once a write failure has occurred, don't bother
6243         writing anything more to that stream.
6244
6245         * src/uniq.c (check_file): Check for ferror (stdout) even if
6246         ostream == stdout.
6247
6248         * src/yes.c (UNROLL): Remove.
6249         (main): Exit immediately when write failure is detected.
6250         Simplify code by assigning to argv when argc == 1.
6251
6252 2003-09-21  Paul Eggert  <eggert@twinsun.com>
6253
6254         * src/ptx.c: Switch encoding from Latin-1 to UTF-8.
6255         (WRITTEN_BY): Change "Franc,ois" (actually using
6256         c-with-cedilla in Latin-1) to "F.", so that it's ASCII, as
6257         xgettext requires.
6258
6259 2003-09-19  Jim Meyering  <jim@meyering.net>
6260
6261         `du -D symlink-to-dir' would mistakenly omit the slash in
6262         lines like this: 24     symlink-to-dir/subdir
6263         * src/du.c (process_file): Fix offset calculation.
6264         Reported by Jeff Sheinberg as Debian bug #211591;
6265         http://bugs.debian.org/205251
6266
6267         * tests/du/deref-args: New file/test for the above.
6268         * tests/du/Makefile.am (TESTS): Add deref-args.
6269
6270         * src/du.c (process_file): Remove useless disjunct.
6271
6272         * src/sys2.h (case_GETOPT_VERSION_CHAR): Rename parameter, Authors,
6273         to Written_by.
6274         * nearly all src/*.c files (WRITTEN_BY): Rename from AUTHORS.
6275         Begin each WRITTEN_BY string with `Written by ' and end it with `.'.
6276         Mark each WRITTEN_BY string as translatable.
6277
6278         * basename.c, cat.c, chroot.c, cksum.c, comm.c, cp.c, csplit.c, cut.c:
6279         * dd.c, df.c, dirname.c, du.c, echo.c, env.c, expr.c, factor.c, head.c:
6280         * hostid.c, hostname.c, id.c, link.c, ln.c, logname.c, ls.c, md5sum.c:
6281         * mv.c, nice.c, nl.c, nohup.c, paste.c, pathchk.c, pinky.c, pr.c:
6282         * printenv.c, printf.c, pwd.c, rm.c, setuidgid.c, sleep.c, sort.c:
6283         * split.c, stty.c, sum.c, sync.c, tac.c, tail.c, tee.c, test.c:
6284         * touch.c, tsort.c, uniq.c, unlink.c, uptime.c, users.c, wc.c:
6285         * who.c, whoami.c, yes.c: Revert yesterday's changes.
6286         Instead, a subsequent change will embed `Written by ' in
6287         each string along with the author names.
6288
6289         * src/true.c: Revert yesterday's changes.
6290         * src/sys2.h: Likewise.
6291
6292 2003-09-18  Jim Meyering  <jim@meyering.net>
6293
6294         * basename.c, cat.c, chroot.c, cksum.c, comm.c, cp.c, csplit.c, cut.c:
6295         * dd.c, df.c, dirname.c, du.c, echo.c, env.c, expr.c, factor.c, head.c:
6296         * hostid.c, hostname.c, id.c, link.c, ln.c, logname.c, ls.c, md5sum.c:
6297         * mv.c, nice.c, nl.c, nohup.c, paste.c, pathchk.c, pinky.c, pr.c:
6298         * printenv.c, printf.c, pwd.c, rm.c, setuidgid.c, sleep.c, sort.c:
6299         * split.c, stty.c, sum.c, sync.c, tac.c, tail.c, tee.c, test.c:
6300         * touch.c, tsort.c, uniq.c, unlink.c, uptime.c, users.c, wc.c:
6301         * who.c, whoami.c, yes.c: Update AUTHORS definition to be a
6302         comma-separated list of strings and/or update the call to
6303         parse_long_options so that `AUTHORS, NULL' are the last parameters.
6304         * src/true.c (main): Append NULL to version_etc argument list.
6305         * src/sys2.h (case_GETOPT_VERSION_CHAR): Likewise.
6306
6307         * src/sort.c (numcompare): Rename local, logb, to log_b to avoid
6308         shadowing the math function name.  Also rename loga to log_a.
6309
6310 2003-09-14  Jim Meyering  <jim@meyering.net>
6311
6312         * src/factor.c (print_factors): Give a separate diagnostic
6313         for numbers that are too large, but otherwise valid.
6314         Reported by Dániel Varga.
6315
6316 2003-09-10  Jim Meyering  <jim@meyering.net>
6317
6318         * Use automake-1.7.7.  Regenerate dependent files.
6319
6320         * tests/Makefile.am (all_programs): Use ../src/tr -s ' ' '\n' in place
6321         of `fmt -1'.  Using the just-built tr is a little cleaner.
6322         Christian Krackowizer reported that HPUX 10.20 doesn't have fmt.
6323         * man/Makefile.am (programs, check-x-vs-1): Likewise.
6324
6325 2003-09-09  Jim Meyering  <jim@meyering.net>
6326
6327         * src/copy.c: Alphabetize includes.
6328         Remove duplicate inclusion of "same.h".
6329
6330 2003-09-08  Jim Meyering  <jim@meyering.net>
6331
6332         * Makefile.maint (GZIP_ENV): Remove --rsyncable.
6333         Didn't give enough of a benefit, mainly because it's not yet
6334         in wide enough use.
6335
6336         * Version 5.0.91.
6337
6338         * man/Makefile.am (programs): Use ../src, not $(srcdir)/../src.
6339         (check-programs-vs-x): Fail if $(programs) is empty.
6340
6341         * src/remove.c: Add a comment.
6342
6343 2003-09-07  Jim Meyering  <jim@meyering.net>
6344
6345         * src/remove.c (D_INO, ENABLE_CYCLE_CHECK) [D_INO_IN_DIRENT]:
6346         Don't define.  These symbols are no longer used.
6347
6348         * tests/misc/tty-eof: Write ^D as \cD.
6349         Complete the change of 2003-08-02.
6350
6351         * Makefile.maint (po-check): Use cvsu, so that a temporary source
6352         file in lib/ or src/ doesn't induce an unwarranted failure.
6353         Add a kludge to filter out the sole generated source file that
6354         also has translatable messages: src/false.c.
6355
6356 2003-09-06  Jim Meyering  <jim@meyering.net>
6357
6358         * src/tail.c (enum): Add ALLOW_MISSING_OPTION.
6359         (parse_options): Give a diagnostic for (but still accept) the
6360         deprecated --allow-missing option.
6361
6362 2003-09-04  Paul Eggert  <eggert@twinsun.com>
6363
6364         Don't ignore -S if input is a pipe.  Bug report by Michael McFarland in
6365         <http://mail.gnu.org/archive/html/bug-coreutils/2003-09/msg00008.html>.
6366
6367         * src/sort.c (sort_buffer_size): Omit SIZE_BOUND arg.  Compute the
6368         size_bound ourselves. if an input file is a pipe and the user
6369         specified a size, use that size instead of trying to guess the
6370         pipe size.  This has the beneficial side effect of avoiding the
6371         overhead of default_sort_size in that case.  All callers changed.
6372         (sort): Remove static var size; now done by sort_buffer_size.
6373
6374 2003-09-05  Jim Meyering  <jim@meyering.net>
6375
6376         * Use automake-1.7.6b and autoconf-2.57b.  Regenerate dependent files.
6377
6378         * tests/tail-2/tail-n0f: Wait .5 seconds for backgrounded process
6379         to start, rather than just .1.  Upon failure, print unexpected state.
6380
6381 2003-09-04  Paul Eggert  <eggert@twinsun.com>
6382
6383         * src/head.c (elide_tail_lines_pipe): Don't assign 0 or
6384         SAFE_READ_ERROR to tmp->nbytes.
6385         * src/tail.c (pipe_lines, pipe_bytes): Likewise.
6386
6387         * src/head.c (struct linebuffer): Change nbytes and nlines
6388         from unsigned int to size_t.  unsigned int is safe (after the
6389         2003-09-03 patch) but size_t is cleaner.
6390         * src/tail.c (struct linebuffer, struct charbuffer): Likewise.
6391         (pipe_bytes): Likewise for local variable 'i', which was 'int'.
6392
6393         Standardize on BUFSIZ as opposed to other macro names and values.
6394         * src/head.c (BUFSIZE): Remove.  All uses changed to BUFSIZ.
6395         * src/tail.c (BUFSIZ) [!defined BUFSIZ]: Remove.
6396         stdio.h has always defined it,
6397         and other code already assumes it's defined.
6398         * src/tr.c (BUFSIZ) [!defined BUFSIZ]: Likewise.
6399         (IO_BUF_SIZE): Remove; replace all uses with sizeof io_buf.
6400         (io_buf): IO_BUF_SIZE -> BUFSIZ.
6401
6402 2003-09-04  Paul Eggert  <eggert@twinsun.com>
6403
6404         * src/seq.c (step): Default to 1.
6405         (print_numbers): Allow the output to be empty.
6406         (main): The default step is 1, even if LAST < FIRST;
6407         as per documentation.
6408         * tests/seq/basic (onearg-2): Output should be empty.
6409
6410 2003-09-05  Jim Meyering  <jim@meyering.net>
6411
6412         * Makefile.cfg (wget_files): Temporarily disable, until master
6413         versions are restored to ftp.gnu.org.
6414
6415         * configure.ac (AM_INIT_AUTOMAKE): Specify automake-1.7.6.
6416
6417         Make seq's --width (-w) option work properly even when the
6418         endpoint requiring the larger width is negative and smaller than
6419         the other endpoint.
6420         * src/seq.c (get_width_format): Include `-' in the set of bytes
6421         allowed in a `simple' number (no decimal point, no exponent).
6422         Reported by Patrick Mauritz.
6423
6424 2003-09-02  Paul Eggert  <eggert@twinsun.com>
6425
6426         * NEWS: sort -t '\0' now uses a NUL tab.
6427         sort option order no longer matters, unless POSIX requires it.
6428         * src/sort.c (usage): Say "blanks" instead of "whitespace",
6429         Similar fixes for many comments.
6430         (TAB_DEFAULT): New constant, so that we can support NUL as
6431         the field separator.
6432         (tab): Now int, not char.  Initialize to TAB_DEFAULT.
6433         (specify_sort_size): If multiple sizes are specified, use the largest.
6434         (begfield, limfield): Support NUL tab char.
6435         (set_ordering): Do not let -i override -d.
6436         (main): Report an error if incompatible -o or -t options are given.
6437         Report an error for "-t ''".  Allow "-t '\0'" to specify a NUL tab.
6438
6439 2003-09-05  Jim Meyering  <jim@meyering.net>
6440
6441         * tests/sort/Test.pm [o2, nul-tab]: New tests for the above.
6442
6443 2003-09-03  Andreas Schwab  <schwab@suse.de>
6444
6445         Bug report and patch here:
6446         <http://mail.gnu.org/archive/html/bug-coreutils/2003-09/msg00009.html>
6447         * src/tail.c (pipe_lines): Don't truncate return value from safe_read.
6448         * src/head.c (elide_tail_lines_pipe): Likewise.
6449
6450 2003-09-03  Jim Meyering  <jim@meyering.net>
6451
6452         * src/du.c (AUTHORS): Remove Larry McVoy's name, since the relatively
6453         small amount of code from him was first moved to lib/human.c, and was
6454         subsequently rewritten entirely.
6455         * src/df.c (AUTHORS): Likewise.
6456
6457 2003-08-22  Lawrence Teo  <lcteo@uncc.edu>
6458
6459         * src/md5sum.c (split_3): Accept the BSD format for generic
6460         message digest modes.  Currently works with BSD's MD5 and SHA1
6461         formats since these are the two algorithms presently used in
6462         coreutils.  Updated comments to reflect this change.
6463         (bsd_split_3): Updated comments.
6464
6465         * tests/md5sum/basic-1: New test to make sure that
6466         `md5sum --check' doesn't accept the BSD SHA1 format (adapted
6467         from `check-bsd' test in tests/sha1sum/basic-1).
6468
6469         * tests/sha1sum/basic-1 (check-bsd2, check-bsd3): New tests for
6470         --check exit status and BSD SHA1 format (adapted from tests
6471         in tests/md5sum/basic-1).
6472
6473 2003-08-30  Jim Meyering  <jim@meyering.net>
6474
6475         * src/ln.c (do_link): Use SAME_INODE rather than open-coding it.
6476
6477         When source and destination arguments refer to the same file, reside
6478         on a partition (e.g. VFAT) on which distinct names may refer to the
6479         same directory entry (often due to variations in case), and when the
6480         link count for the file is 1, mv no longer unlinks the file.  Instead,
6481         it gives the expected diagnostic that the source and destination are
6482         the same.  WARNING: this is an incomplete fix.  If the file happens
6483         to have a link count of 2 or greater, such an erroneous mv command
6484         will still unlink it.
6485         Although that is not possible on vfat or umsdos, it is possible on
6486         other file system types, e.g., ntfs, and hpfs.
6487         * src/copy.c (same_file_ok): Invoke same_name (which might still
6488         return false for names that refer to the same directory entry)
6489         only if the link count is 2 or more.
6490         * tests/mv/vfat: Show how to demonstrate the above problem.
6491         This test is not run.
6492         * tests/mv/Makefile.am (EXTRA_DIST): Add vfat.
6493
6494 2003-08-27  Jim Meyering  <jim@meyering.net>
6495
6496         * src/who.c: Change meaning of -l from --lookup to --login, per POSIX.
6497         who's -l option has been eliciting an unconditional warning about
6498         this impending change since sh-utils-2.0.12 (April 2002).
6499
6500         * src/paste.c (paste_parallel): Don't output `EOF' (aka -1) as a `char'.
6501         This would happen for nonempty files not ending with a newline.
6502         Reported by Dan Jacobson.
6503         * tests/misc/paste-no-nl: New file.  Test for above-fixed bug.
6504         * tests/misc/Makefile.am (TESTS): Add paste-no-nl.
6505
6506         * src/stat.c (print_it): Avoid buffer overrun that would
6507         occur when the user-specified format string ends with `%'.
6508         Patch by Tommi Kyntola.
6509         * tests/misc/stat-fmt: New file.  Test for above-fixed bug.
6510         * tests/misc/Makefile.am (TESTS): Add stat-fmt.
6511
6512 2003-08-26  Jim Meyering  <jim@meyering.net>
6513
6514         Apply changes from bison.
6515         * GNUmakefile (SHELL): Define to `sh', if necessary.
6516         Add copyright.
6517         * Makefile.maint (WGETFLAGS): Define to `-C off'.
6518         Update all uses of $(WGET).
6519
6520 2003-08-22  Akim Demaille  <akim@epita.fr>
6521
6522         * Makefile.cfg (local-checks-to-skip): New.
6523         * Makefile.maint (local-check): Rename as...
6524         (local-checks-available): this.
6525         (local-check): New.
6526
6527 2003-08-26  Akim Demaille  <akim@epita.fr>
6528
6529         * announce-gen (print_changelog_deltas): Neutralize "<#" as
6530         "<\#" to avoid magic from Gnus when posting parts of this script.
6531
6532 2003-08-25  Jim Meyering  <jim@meyering.net>
6533
6534         * src/stat.c (main): Warn about use of deprecated `-l' option.
6535
6536 2003-08-22  Jim Meyering  <jim@meyering.net>
6537
6538         * src/stat.c (do_stat): For link count at end of line, use %h format,
6539         instead of %-5h.  The latter would make stat emit trailing spaces.
6540         Reported by Dan Jacobson.
6541
6542 2003-08-20  Jim Meyering  <jim@meyering.net>
6543
6544         * Makefile.am (EXTRA_DIST): Add .x-sc_space_tab .x-sc_sun_os_names
6545
6546 2003-08-19  Jim Meyering  <jim@meyering.net>
6547
6548         * src/system.h: Include stdlib.h unconditionally,
6549         as we're now assuming that part of hosted C89.
6550
6551 2003-08-18  Jim Meyering  <jim@meyering.net>
6552
6553         * src/sys2.h (textdomain, bindtextdomain) [! ENABLE_NLS]: Define away,
6554         to avoid warnings from gcc.
6555
6556 2003-08-17  Jim Meyering  <jim@meyering.net>
6557
6558         Avoid unnecessary and sometimes time-consuming hostname lookups.
6559         * src/who.c (print_user): Use strchr, not strrchr.
6560         * src/pinky.c (print_entry): Likewise.
6561         Patch by Michael Stone.
6562         This fixes a typo I introduced in who-users.c on 1996-02-23.
6563
6564         * Makefile.maint (makefile-check): Add 0-9 to the range of characters
6565         disallowed between `@...@'.
6566
6567 2003-08-16  Paul Eggert  <eggert@twinsun.com>
6568
6569         * configure.ac (fu_cv_sys_truncating_statfs): Remove; now
6570         done by gnulib .m4 files.
6571         (jm_DUMMY_1): Require gl_READUTMP, not jm_PREREQ_READUTMP.
6572         * src/sys2.h (strtoull): Remove unused declaration.
6573
6574 2003-08-16  Jim Meyering  <jim@meyering.net>
6575
6576         * man/Makefile.am (.x.1): Ensure that generated PROGRAM.1 files
6577         are read-only.
6578
6579         * src/tail.c (tail_lines): Fix a potential (but very hard to exercise)
6580         race condition bug.  The bug would be triggered when tailing a file
6581         with file pointer not at beginning of file, and where the file was
6582         truncated to have a length of less than the initial offset at just
6583         the right moment (between the two lseek calls in this function).
6584
6585         An invalid initial value for *read_pos would result in
6586         `tail -n0 -f FILE' and `tail -c0 -f FILE' doing what amounted to a
6587         busy-wait rather than sleeping between iterations.  The bug manifests
6588         itself only when tailing regular files that are initially nonempty.
6589         * src/tail.c (tail_bytes): Set *read_pos to new file offset after
6590         each xlseek call.
6591         (tail_lines): Likewise, after lseek calls.
6592         Reported by Nick Estes.  See http://bugs.debian.org/205251 for details.
6593         * tests/tail-2/tail-n0f: New file.  Test for above fix.
6594         * tests/tail-2/Makefile.am (TESTS): Add tail-n0f.
6595
6596 2003-08-15  Jim Meyering  <jim@meyering.net>
6597
6598         * Makefile.maint (sc_space_tab): Use exclusion list in separate file.
6599         (sc_sun_os_names): Likewise.
6600         * .x-sc_space_tab, .x-sc_sun_os_names: New files.
6601
6602         * man/help2man: Remove some SPACEs before TAB.
6603
6604 2003-08-14  Paul Eggert  <eggert@twinsun.com>
6605
6606         * Makefile.maint (LC_ALL): Set to C.
6607         * man/Makefile.am (ASSORT): New var.
6608         (check-x-vs-1, programs): Use it.
6609         * src/Makefile.am (ASSORT, check-README, ../AUTHORS): Likewise.
6610         * tests/Makefile.am (ASSORT, all_programs): Likewise.
6611
6612 2003-08-11  Jim Meyering  <jim@meyering.net>
6613
6614         fold -s -wN would infloop for N < 8 with TABs in the input.
6615         E.g., this would not terminate: printf 'a\tb' | fold -w2 -s
6616         * src/fold.c (fold_file): Move contents of `else'-block
6617         out of conditional so it's used also for --spaces (-s).
6618         * tests/misc/fold: Test for the above fix.
6619         * tests/misc/Makefile.am (TESTS): Add fold.
6620
6621 2003-08-10  Jim Meyering  <jim@meyering.net>
6622
6623         * src/nice.c [!NICE_PRIORITY]: Include <sys/resource.h> after
6624         system.h so the types from time.h and sys/time.h are available.
6625         It appears that this is necessary for OpenBSD, NetBSD, and
6626         Darwin 6.5 (MacOS 10.2.5).  Reported by Nelson Beebe.
6627
6628 2003-08-06  Paul Eggert  <eggert@twinsun.com>
6629
6630         * NEWS: Add support for setting file timestamps to microsecond
6631         resolution, on hosts that support this.
6632         * src/copy.c, src/cp.c, src/install.c, src/touch.c: Include utimens.h.
6633         * src/copy.c (copy_internal):
6634         Set file timestamps with utimens, not utime.
6635         * src/cp.c (re_protect): Likewise.
6636         * src/install.c (change_timestamps): Likewise.
6637         * src/touch.c (newtime, touch, main): Likewise.
6638
6639 2003-08-09  Jim Meyering  <jim@meyering.net>
6640
6641         * Makefile.maint (sc_sun_os_names): New rule based on a regexp
6642         from Paul Eggert.
6643         (syntax-check-rules): Add it.
6644
6645         * src/tail.c (main): Tweak Solaris OS version number in comment.
6646         * src/wc.c (wc): Likewise
6647         * tests/tail-2/fflush: Likewise.
6648
6649         * src/tail.c: Add new undocumented option, --presume-input-pipe.
6650         (pipe_lines): Use memchr to skip lines, rather than an explicit loop.
6651
6652 2003-08-08  Paul Eggert  <eggert@twinsun.com>
6653
6654         Use new gnulib 'extensions' module.
6655         * configure.ac: Invoke gl_USE_SYSTEM_EXTENSIONS instead of
6656         AC_GNU_SOURCE.
6657
6658 2003-08-08  Paul Eggert  <eggert@twinsun.com>
6659
6660         * tests/du/basic: Ensure that a/b/F has at least 65 bytes too.
6661
6662 2003-08-09  Jim Meyering  <jim@meyering.net>
6663
6664         * tests/misc/split-fail: Reflect that `split -a 0' is now accepted.
6665         For tests of obsolete behavior, don't presume that unsetting
6666         _POSIX2_VERSION is equivalent to _POSIX2_VERSION=199209.
6667
6668 2003-08-07  Paul Eggert  <eggert@twinsun.com>
6669
6670         * doc/coreutils.texi (split invocation):
6671         Add -d or --numeric-suffixes option to 'split'.
6672         From a suggestion by Jesse Kornblum.
6673         * src/split.c (suffix_alphabet): New var.
6674         (longopts, usage, next_file_name, main): Support -d.
6675         (next_file_name, main): Allow -a0, as POSIX requires.
6676         (next_file_name): Don't assume ASCII-like encoding;
6677         'a' through 'z' are not contiguous in EBCDIC.
6678
6679 2003-08-05  Paul Eggert  <eggert@twinsun.com>
6680
6681         Merge getline from gnulib.
6682         * lib/getline.h, lib/getline.c, m4/getline.m4: Merge from gnulib.
6683         * lib/getndelim2.h, lib/getndelim2.c, m4/getndelim2.m4, m4/ssize_t.m4:
6684         New files, from gnulib.
6685         * lib/getdelim2.c, lib/getdelim2.h: Remove.
6686         * lib/Makefile.am (libfetish_a_SOURCES): Change getdelim2.c and
6687         getdelim2.h to getndelim2.c and getndelim2.h.
6688         * m4/jm-macros.m4 (jm_MACROS): Use gl_GETNDELIM2 rather than
6689         checking for getdelim.
6690         (jm_CHECK_ALL_TYPES): Use gt_TYPE_SSIZE_T for ssize_t rather
6691         than rolling our own.
6692         * src/cut.c: Include getndelim2.h rather than getdelim2.h.
6693         (cut_fields): Invoke getndelim2 rather than getdelim2.
6694
6695 2003-08-04  Jim Meyering  <jim@meyering.net>
6696
6697         * src/sort.c (main): Use unsigned int instead of int for `nsigs'
6698         and for the indices to iterate through nsigs.
6699
6700 2003-08-02  Paul Eggert  <eggert@twinsun.com>
6701
6702         * src/sort.c: Minor code cleanups, mostly to use more accurate
6703         types and to remove unnecessary casts.
6704         (min, max): Remove.  All uses changed to MIN and MAX.
6705         (hard_lc_collate, hard_LC_TIME, struct buffer.eof, struct
6706         keyfield.skipsblanks, struct keyfield.skipeblanks, struct
6707         keyfield.numeric, struct keyfield.general_numeric, struct
6708         keyfield.month, struct keyfield.reverse, reverse, unique,
6709         have_read_stdin): Now bool, not int.  All uses changed.
6710         (eolchar): Now char, not int.
6711         (struct keyfield.ignore): Now bool const *, not int *.
6712         (struct keyfield.translate): Now char const *, not char *.
6713         (struct month.name): Likewise.
6714         (blanks, nonprinting, nondictionary): Now bool[], not int[].
6715         (cleanup, inittables, keycompare, check, mergefps, first_same_file,
6716         check, sort, main): Use const * pointers when possible.
6717         (month_cmp): Rewrite to avoid casts.
6718         (inittables): Initialize tables unconditionally, to avoid branches.
6719         (fillbuf): Return bool, not int.  All uses changed.
6720         (fillbuf, keycompare, new_key, main):
6721         Use SIZE_MAX rather than (size_t) -1.
6722         (trailing_blanks): Renamed from trim_trailing_blanks.
6723         Return the number of blanks to trim.  All uses changed.
6724         (getmonth): Use trailing_blanks rather than open code.
6725         (keycompare): Do not cast char * to unsigned char *; not needed.
6726         CMP_WITH_IGNORE converts args to UCHAR, so no need to convert it
6727         ourselves.
6728         (compare, main): Use | rather than || to avoid jumps.
6729         Replace "diff = NONZERO (alen)" with "diff = 1", since alen must
6730         be nonzero there.
6731         (check, first_same_file, sort, main):
6732         Use bool instead of int local vars when possible.
6733         (check): Merge the old 'checkfp' and 'check' into a single function,
6734         that returns a boolean (true if the file was ordered).
6735         All uses changed.
6736         (main): Use int instead of unsigned for iterating through nsigs.
6737         Rename local var "posix_pedantic" to "posixly_correct".
6738
6739 2003-08-02  Jim Meyering  <jim@meyering.net>
6740
6741         * src/nice.c [!NICE_PRIORITY]: Include <time.h> before <sys/resource.h>
6742         to avoid compilation error on Ultrix. Reported by Christian Krackowizer.
6743
6744         * src/cut.c (cut_fields): Don't read again after encountering an
6745         initial EOF.  E.g., `cut -f2' would do so.
6746         * tests/misc/tty-eof: Add a test for the above fix.
6747
6748         * src/sort.c (sortlines): Add description and references.
6749         From Paul Eggert.
6750
6751         * tests/Makefile.am (TESTS_ENVIRONMENT): Set PATH so that
6752         the tests in help-version will use the just-built binaries.
6753         Reported by Christian Krackowizer.
6754
6755 2003-07-31  Paul Eggert  <eggert@twinsun.com>
6756
6757         * NEWS: Add --rfc-2822 option to GNU date.
6758         * doc/coreutils.texi (Time directives, Options for date, Examples
6759         of date): Likewise.
6760         * src/date.c (long_options, usage, main): Likewise.
6761         * doc/getdate.texi (General date syntax): Likewise.
6762         * doc/coreutils.texi (Options for date): Fix a typo in format:
6763         it's now %d not %_d.  Add URLs.
6764
6765 2003-08-01  Jim Meyering  <jim@meyering.net>
6766
6767         * tests/shred/remove: Ensure that $? is 0 for the final `exit 0'.
6768         Otherwise, with at least the /bin/sh from HPUX 10.20,
6769         the trap code would end up converting that to exit 1 and thus an
6770         unexpected test failure.  Reported by Christian Krackowizer.
6771
6772 2003-07-31  Paul Eggert  <eggert@twinsun.com>
6773
6774         * src/ptx.c: Do not include bumpalloc.h.
6775         (WORD_TABLE): New member alloc.
6776         (ALLOC_NEW_WORD): Remove.
6777         (occurs_alloc): New var.
6778         (digest_word_file, find_occurs_in_text): Check for arithmetic
6779         overflow when computing table size.  Use xrealloc rather than
6780         bumpalloc primitives.
6781
6782 2003-07-29  Jim Meyering  <jim@meyering.net>
6783
6784         * Version 5.0.90.
6785
6786         * README: When running tests as root, suggest using
6787         sudo with NON_ROOT_USERNAME=$USER.
6788
6789         * tests/Makefile.am (all_programs): Makefile is in ../src, not
6790         $(srcdir)/../src.
6791
6792 2003-07-28  Jim Meyering  <jim@meyering.net>
6793
6794         * Makefile.maint (GZIP_ENV): Try Debian/gzip's new --rsyncable option.
6795
6796 2003-07-28  Paul Eggert  <eggert@twinsun.com>
6797
6798         * lib/stdbool.hin (_Bool): Make it signed char, instead of
6799         an enum type, so that it's guaranteed to promote to int.
6800         * src/sort.c (sortlines_temp): Undo previous change.
6801
6802 2003-07-28  Jim Meyering  <jim@meyering.net>
6803
6804         * src/sort.c (sortlines_temp): Declare local `swap' to be `int', not
6805         `bool'.  Otherwise, at least one buggy compiler (alpha gcc-2.95.4)
6806         would cause lines[-1 - swap] (with swap = false) to evaluate to
6807         lines[4294967295].
6808
6809 2003-07-27  Jim Meyering  <jim@meyering.net>
6810
6811         * tests/priv-check (my_uid): Use `!', not `^' in case pattern `[!0-9]',
6812         since /bin/sh of at least NetBSD 1.6 and OpenBSD 3.2 don't accept `^'.
6813
6814         * src/remove.c (prompt) [! recursive]: Don't prompt about unwritable
6815         directories, as required by POSIX.   Reported by Karl Berry.
6816         * tests/rm/dir-no-w: New file.  Test for the above fix.
6817         * tests/rm/Makefile.am (TESTS): Add dir-no-w.
6818
6819         * tests/mk-script: Emit `$xx', not its expansion.
6820
6821 2003-07-27  Paul Eggert  <eggert@twinsun.com>
6822
6823         This change was inspired by a similar proposal by Stepan Kasal.
6824         * src/sort.c (mergelines, sortlines_temp): New functions.
6825         (sortlines): Use them, to reduce the number of times that
6826         we need to copy 'struct line' values.  This improved CPU
6827         performance by about 30% on one 18 MB test.
6828         (sort): Don't invoke sortlines unless we have 2 or more lines.
6829
6830 2003-07-26  Stepan Kasal  <kasal@ucw.cz>
6831
6832         * src/sort.c (sort): Don't require two `struct line's per text line,
6833         the new sort algorithm requires just 1.5.
6834
6835 2003-07-27  Jim Meyering  <jim@meyering.net>
6836
6837         * src/pathchk.c (validate_path): Use %lu, not %ld.
6838         From Paul Eggert.
6839         * src/cut.c (is_printable_field): Simplify bit arithmetic.
6840         From Paul Eggert.
6841         * src/ls.c (sort_files): Put `volatile' in the right place.
6842         From Paul Eggert.
6843
6844 2003-07-26  Jim Meyering  <jim@meyering.net>
6845
6846         Use only one bit per field/offset in array, not one `int'.
6847         * src/cut.c (printable_field): Change type to `unsigned char'.
6848         (mark_printable_field, is_printable_field): New functions.
6849         Use them in place of all direct accesses of `printable_field'.
6850
6851         * src/expand.c (parse_tabstops): Detect overflow properly.
6852         * src/cut.c (set_fields): Likewise.
6853
6854         * src/rm.c: Include "dirname.h".
6855         (usage): Use base_name (program_name) in body of --help output.
6856         This lets me...
6857         * man/Makefile.am (.x.1): ...back out the kludge of 2003-07-22.
6858         Idea from Brendan O'Dea, who suggested using
6859         `program_name = basename (argv[0]);' everywhere --
6860         can't do that, but using base_name works just fine here.
6861
6862         * src/Makefile.am (AM_INSTALLCHECK_STD_OPTIONS_EXEMPT): Exempt test.
6863
6864 2003-07-24  Paul Eggert  <eggert@twinsun.com>
6865
6866         Fix some POSIX-compliance problems with 'test'.  This makes
6867         'test' more compatible with Bash.
6868
6869         * NEWS, doc/coreutils.texi: Document the following.
6870         * src/test.c: Include exitfail.h.
6871         (TEST_FAILURE): New constant, used for exit status if 'test' fails.
6872         (test-syntax_error): Use it.
6873         (binary_operator): Now takes bool arg specifying whether left operand
6874         is -l ARG, so that caller determines this rather than us.
6875         All uses changed.
6876         (term): Use posixtest to evaluate parenthesized subexpressions.
6877         (unary_operator, one_argument): Remove support for -t without operand.
6878         (one_argument): Take argument from argv[pos].
6879         (one_argument, two_arguments, three_arguments): Advance pos.
6880         All callers changed.
6881         (three_arguments): Look for binary ops before "!".  Then look
6882         for parenthesized one_argument expressions, instead of trusting
6883         expr () to do the right thing.
6884         (posixtest): Now takes number of args.  All callers changed.
6885         Treat "( A B )" like "A B".
6886         (main): Set exit_failure to TEST_FAILURE.  Don't depend on
6887         POSIXLY_CORRECT, as we now conform to POSIX by default.
6888         (main) [!LBRACKET]: Do not recognize "--help" or "--verbose" unless.
6889         * tests/test/Test.pm (test_vector): Add several tests to check
6890         the above.  Syntax errors now exit with status 2, not 1.
6891         * man/Makefile.am (mapped_name): Use `../src/[' binary to create test.1.
6892
6893 2003-07-26  Jim Meyering  <jim@meyering.net>
6894
6895         * tests/help-version: Adjust for above change in test behavior:
6896         `[' exits with 2, not 1, and test doesn't accept --help or --version.
6897
6898         * Makefile.maint (ME): Don't use trick suggested in Make manual.
6899         It doesn't work for make-3.79.1.  Reported by Christian Krackowizer.
6900
6901         * Makefile.maint (sc_system_h_headers): Another syntax check.
6902         (syntax-check-rules): Add it to the list.
6903
6904         * src/pathchk.c (validate_path): Cast strlen value to `unsigned long'
6905         so it matches `%ld' format even on 32-bit systems.
6906
6907         * src/fmt.c (flush_paragraph): Cast field width to `int' to
6908         avoid warning on 64-bit systems.
6909
6910         * src/ls.c (sort_files): Make `func' volatile, so it can't be
6911         clobbered by a `longjmp' into this function.
6912
6913 2003-07-25  Jim Meyering  <jim@meyering.net>
6914
6915         * src/pathchk.c (validate_path): Use %ld format (not %d) for size_t
6916         value.
6917
6918         * tests/misc/split-fail: Disable the --line-bytes=$_4gb test,
6919         because it'd evoke spurious failure on 64-bit systems.
6920
6921 2003-07-24  Jim Meyering  <jim@meyering.net>
6922
6923         * src/dd.c (usage): Document the fact that SIGUSR1 makes dd
6924         output its current record counts.  Reported by Jurriaan.
6925
6926         * tests/wc/Test.pm (test_vector): Disable the `PIPE' tests when running
6927         `wc' with no options.  This goes along with the change of 2003-07-20.
6928
6929 2003-07-23  Jim Meyering  <jim@meyering.net>
6930
6931         Don't include headers already included by system.h:
6932         * src/tr.c: Don't include errno.h.
6933         * src/true.c: Don't include version-etc.h.
6934         * src/test.c: Don't include limits.h or error.h.
6935         * src/stat.c: Don't include unistd.h or time.h.
6936         * src/readlink.c: Don't include stdlib.h, unistd.h, or limits.h.
6937         * src/pr.c: Don't include time.h.
6938         * src/pathchk.c: Don't include errno.h.
6939         * src/nice.c: Don't include sys/time.h.
6940         * src/ls.c: Don't include stdlib.h.
6941
6942         * basename.c, cat.c, chroot.c, cksum.c, comm.c, csplit.c, cut.c, date.c:
6943         * dd.c, dirname.c, echo.c, env.c, expand.c, expr.c, factor.c, fmt.c:
6944         * fold.c, head.c, hostid.c, hostname.c, id.c, join.c, kill.c, logname.c:
6945         * md5sum.c, nice.c, nl.c, nohup.c, od.c, paste.c, pathchk.c, pinky.c:
6946         * pr.c, printenv.c, printf.c, ptx.c, pwd.c, seq.c, setuidgid.c, shred.c:
6947         * sleep.c, sort.c, split.c, stat.c, stty.c, su.c, sum.c, tac.c, tail.c:
6948         * tee.c, test.c, tr.c, true.c, tsort.c, tty.c, uname.c, unexpand.c:
6949         * uniq.c, uptime.c, users.c, wc.c, who.c, whoami.c, yes.c:
6950         Don't include closeout.h.
6951
6952         * tests/rm/fail-2eperm: Add a check for whether $NON_ROOT_USERNAME
6953         can access the required version of rm.
6954         * tests/rm/Makefile.am (TESTS_ENVIRONMENT): Define PACKAGE_VERSION.
6955
6956         * tests/cut/Test.pm (out-delim3a): New test.
6957
6958         * man/help2man: Update to version 1.33.
6959
6960         * src/expand.c (parse_tabstops): Detect overflow in tabstop sizes.
6961
6962         * src/dircolors.c: Include xstrndup.h.
6963         (xstrndup): Remove function, now that it's been factored out into
6964         it's own file.
6965
6966 2003-07-22  Paul Eggert  <eggert@twinsun.com>
6967
6968         * src/wc.c (wc): Fix typo in computation of file from file_x,
6969         which caused the former to be used uninitialized if file_x was
6970         nonzero.
6971
6972 2003-07-22  Jim Meyering  <jim@meyering.net>
6973
6974         * src/cut.c (set_fields): Use xcalloc in place of xmalloc+memset.
6975
6976         * man/Makefile.am (.x.1): Substitute 's,$t/$*,$*,' on output of
6977         help2man, to avoid having `rm.td/rm' appear in rm.1.  Reported by
6978         Thomas Luzat.  See http://bugs.debian.org/202413 for details.
6979
6980         * src/cut.c (main) [lint]: Initialize spec_list_string to avoid warning.
6981
6982         * src/hostid.c: Don't include <unistd.h>.  system.h already does that.
6983
6984         * src/cut.c (set_fields): Mark all selected indices before trying to
6985         determine range endpoints.
6986         * tests/cut/Test.pm: New test for the above fix.
6987
6988         Begin to address this comment: What if someone wants to
6989         extract the 1,000,000-th field of some huge input file?
6990         The first step is to rearrange things so that the values
6991         in the printable_field array are all 0/1 rather than 0/1/2.
6992         * src/cut.c (RANGE_START_SENTINEL): Remove.
6993         Store range-start indices in a hash table, rather than
6994         overloading the `printable_field' array.
6995         (range_start_ht): New global.
6996         (hash_int, hash_compare_ints, is_range_start_index): New functions.
6997         (print_kth): Use is_range_start_index; don't test printable_field.
6998         (set_fields): Detect overflow.
6999         (set_fields): Insert each range-start index into range_start_ht.
7000         (main): Call set_fields only once, and only after
7001         output_delimiter_specified and (if required) range_start_ht have
7002         been defined.
7003
7004 2003-07-20  Paul Eggert  <eggert@twinsun.com>
7005
7006         * src/wc.c (get_input_fstatus): Fix typo: `stat' was being
7007         invoked with a null pointer when there were no file arguments.
7008
7009 2003-07-20  Jim Meyering  <jim@meyering.net>
7010
7011         * Makefile.maint (sc_changelog): Add another nit-picky check.
7012
7013         * src/wc.c (write_counts): Add a comment.
7014         (wc): Rename `file' parameter.
7015         Set new local, `file', to be the file name, or (when it's NULL)
7016         _("standard output") so that all uses of `file' use the proper value.
7017         Use STREQ, not strcmp.
7018
7019 2003-07-20  Paul Eggert  <eggert@twinsun.com>
7020
7021         wc count field widths now are heuristically adjusted depending
7022         on the input size, if known.  If only one count is printed, it
7023         is guaranteed to be printed without leading spaces.
7024
7025         Previously, wc did not align the count fields if
7026         POSIXLY_CORRECT was set, but POSIX did not actually require
7027         this undesirable behavior, so it has been removed.
7028
7029         * NEWS: Document this.
7030         * doc/coreutils.texi (wc invocation): Likewise.
7031
7032         * src/wc.c (number_width): New var.
7033         (posixly_correct): Remove.
7034         (struct fstatus): New struct.
7035         (write_counts): Output fields of width number_width.
7036         Do not worry about POSIXLY_CORRECT.
7037         Use null file, not empty-string file, to denote stdin,
7038         since "" is a valid file name on some hosts.
7039         (wc, wc_file): New arg fstatus.  Use it to avoid invoking fstat
7040         if possible.
7041         (wc):  Avoid problems if end_pos - current_pos overflows.
7042         Do not print odd message if stdin has a read error.
7043         (get_input_fstatus, compute_number_width): New functions.
7044         (main): Use them to implement the new behavior.
7045         Ignore POSIXLY_CORRECT.
7046
7047         * tests/wc/Test.pm: Adjust to the new output widths.
7048
7049 2003-07-19  Jim Meyering  <jim@meyering.net>
7050
7051         * tests/rm/fail-eperm: Don't create temporary directory --
7052         we don't use it.
7053
7054         * tests/shred/remove: Don't open-code test for UID != 0.
7055         Use priv-check's require-non-root instead.
7056         Update to use newer framework.
7057
7058         * tests/help-version (expected_failure_status_expr): Record that
7059         expr exits with status of 3 for e.g., a write error.
7060
7061         * tests/priv-check: Use `id -u' to see if we're running as root,
7062         rather than trying go write to an write-protected file.
7063         When running as root, ensure $NON_ROOT_USERNAME is valid.
7064         When running as root with `require-non-root', ensure that `.'
7065         is writable by $NON_ROOT_USERNAME, then reinvoke $0 set-user-ID
7066         to $NON_ROOT_USERNAME.  If `.' is not writable, then skip the test.
7067
7068         * src/printenv.c: Include "exitfail.h".
7069         (main): Set exit_failure rather than calling close_stdout_set_status.
7070         * src/date.c: Likewise.
7071         * src/sort.c: Likewise.
7072         * src/tty.c: Likewise.
7073
7074 2003-07-18  Jim Meyering  <jim@meyering.net>
7075
7076         * tests/touch/not-owner: Update to use newer framework.
7077
7078         * tests/rm/fail-eperm: Use $srcdir/../priv-check, create a temporary
7079         directory, and remove Perl-coded `you may not run as root' test.
7080         * tests/cp/fail-perm: Use $srcdir/../priv-check, rather than
7081         hard-coding something not quite equivalent.
7082         Paul Jarc reported the inconsistent diagnostics.
7083
7084         * src/sort.c (main): Use close_stdout via atexit.
7085         Now `sort --version' and `sort --help' fail, as they should
7086         when their output is redirected to /dev/full.
7087
7088         * src/su.c (usage): Don't call close_stdout here.
7089         (main): Use close_stdout via atexit.
7090         Now `su --version > /dev/full' fails, as it should.
7091         Somehow, the change of 2000-05-07 that purports to fix this
7092         was not checked in.
7093
7094         * tests/help-version (--help/--version vs. /dev/full): Special-case
7095         `[' to protect it from expected_failure_status-`eval'.
7096
7097         * src/uniq.c (writeline): Use a SPACE, not a TAB between the
7098         count and the corresponding line, as required by POSIX.
7099         Reported by Clement Wang.
7100         * tests/uniq/Test.pm (101, 102): Update tests of -c accordingly.
7101
7102         * tests/expr/basic: Add tests for when exit status is 2.
7103
7104         * src/nohup.c (NOHUP_FOUND_BUT_CANNOT_INVOKE, NOHUP_FAILURE):
7105         Use an anonymous `enum', rather than #define.
7106
7107 2003-07-17  Paul Eggert  <eggert@twinsun.com>
7108
7109         * src/expr.c: Include "exitfail.h", "quotearg.h".
7110         (EXPR_INVALID, EXPR_ERROR): New constants.
7111         (nomoreargs, null, toarith, nextarg): Return bool, not int.
7112         (syntax_error): New function, exiting with status 2.  Use it
7113         insteading of printing "syntax error" ourselves.
7114         (main): Initialize exit_failure to EXPR_ERROR.
7115         Exit with EXPR_INVALID on syntax error (too few arguments).
7116         (nextarg): Use strcmp, not strcoll; strcoll might return
7117         an undesirable 0, or might fail.
7118         (docolon, eval4, eval3): Exit with status 3 on invalid argument type
7119         or other such error.
7120         (eval2): Report an error if strcoll fails in a string comparison.
7121         * src/sort.c: Include "exitfail.h".
7122         (main): Set exit_failure, not xalloc_exit_failure and
7123         xmemcoll_exit_failure.
7124         * tests/expr/basic: Invalid value exits with status 3, not 2.
7125
7126 2003-07-16  Jim Meyering  <jim@meyering.net>
7127
7128         * configure.ac (AC_INIT): Use 5.0.90 as the version, rather than 5.0.2,
7129         per GNU maintainer guidelines.  The next non-beta release will be 5.1.
7130
7131         This script would have caught at least two recent bugs:
7132         those in [ and kill.
7133         * tests/help-version: Revive this script.
7134         It wasn't doing anything useful, since $all_programs wasn't being
7135         defined by the invoking Makefile.am.
7136         Reflect that nohup is no longer a script, so don't exclude it.
7137         Add framework to handle the programs added since it was last run:
7138         kill, stat, unlink, [, link, readlink.
7139         Fix path-related problems deriving from the move of this script
7140         from src/ to its present location.
7141         * tests/Makefile.am (all_programs): Define.
7142         (TESTS_ENVIRONMENT): Use it.
7143
7144         * src/kill.c (main): Fix bug introduced on 2003-05-10 (for 5.0.1)
7145         whereby kill would always attempt to operate on argv[0] and fail.
7146
7147         * src/test.c (integer_expected_error): Improve diagnostic -- now,
7148         it also matches the one from bash's builtin test.
7149         (binary_operator): Add \n at end of diagnostic.
7150
7151         * tests/rm/fail-2eperm: Remove setuidgid-related code.  Move it to ...
7152         * tests/priv-check: Move setuidgid-related and
7153         NON_ROOT_USERNAME-checking code to this file.
7154
7155         * README: Update section on testing as `root'.
7156         Suggestion from Paul Jarc.
7157
7158         * src/test.c (AUTHORS): Replace 3-letter usernames with the actual
7159         names of authors that I just found in bash's builtins/test.def.
7160
7161         Running `[' with no arguments would evoke a segfault.
7162         * src/test.c (main) [LBRACKET]: Move initialization of argv to
7163         precede potential use via test_syntax_error.
7164
7165         * src/Makefile.am (AM_CPPFLAGS): Rename from `INCLUDES', to avoid
7166         warning from automake -Wall.
7167
7168 2003-07-15  Jim Meyering  <jim@meyering.net>
7169
7170         * Version 5.0.1.
7171
7172         * Makefile.maint (%.asc): Remove target first, so gpg doesn't
7173         prompt us about it.
7174
7175         * announce-gen (print_changelog_deltas): Relax tests for matching
7176         version-number line in NEWS.
7177         Change the .sig suffix to .asc here, too.
7178
7179 2003-07-14  Jim Meyering  <jim@meyering.net>
7180
7181         * Makefile.maint (%.asc): Renamed from %.sig.
7182         Generate and use ascii-armored signatures.
7183         Use gpg's -o option.
7184
7185 2003-07-13  Jim Meyering  <jim@meyering.net>
7186
7187         * src/nohup.c (NOHUP_FAILURE, NOHUP_FOUND_BUT_CANNOT_INVOKE): Define.
7188         (main): Use them.
7189
7190         * Makefile.maint (syntax-check): Move each individual check into
7191         its own target.
7192         (syntax-check-rules): This is the list of syntax-check targets.
7193         (sc_unmarked_diagnostics, sc_cast_of_argument_to_free):
7194         (sc_cast_of_x_alloc_return_value, sc_space_tab):
7195         (sc_error_exit_success, sc_xalloc_h_in_src):  New targets.
7196
7197 2003-07-12  Jim Meyering  <jim@meyering.net>
7198
7199         * configure.ac: Remove uses of OPTIONAL_BIN_ZCRIPTS and last
7200         traces of the nohup script.
7201
7202         * src/Makefile.am (bin_SCRIPTS): Remove use of just-removed
7203         $(OPTIONAL_BIN_ZCRIPTS).
7204
7205         * src/Makefile.am (localedir.h): Put the `2>&1' after the redirect
7206         target, not before the `>'.
7207
7208         * src/remove.c (remove_dir): Give a diagnostic upon failed save_cwd,
7209         now that that function no longer calls `error'.
7210
7211         * src/df.c (find_mount_point): Emit a diagnostic for each
7212         failed syscall, rather than relying on caller to do that.
7213         The caller couldn't do a good job, anyhow -- too many different
7214         ways to fail (each with a different referent).
7215         Give a diagnostic upon failed save_cwd, now that that function
7216         no longer calls `error'.
7217         (show_point): Don't diagnose find_mount_point's errors, now that
7218         it handles them itself.
7219
7220         * src/df.c (find_mount_point): Don't let free clobber errno upon
7221         failed chdir.
7222
7223         * src/sys2.h: Remove alloca-related block.
7224         * src/system.h: Include <alloca.h> here, instead.
7225
7226         It appears that the `#pragma alloca' included via "system.h" is
7227         adequate, since join.c uses alloca, yet lacked an in-file #pragma.
7228         * src/copy.c, src/cp.c, src/df.c, src/install.c, src/ln.c:
7229         * src/ls.c, src/mv.c, src/remove.c: Remove `#pragma alloca'.
7230
7231         * src/chown-core.c (change_file_owner): Do not restore any special
7232         permission bits (e.g., set-user-ID, set-group-ID) that are reset
7233         by chown(2) on some systems.  Suggestion and insistence :-) from
7234         Michael Stone.
7235
7236         * tests/input-tty: Also check `test -t 1'.
7237         This is necessary on linux-2.4.21.  Otherwise, the stty/basic-1
7238         test would block when run in the background.
7239
7240 2003-07-11  Jim Meyering  <jim@meyering.net>
7241
7242         * tests/sample-test: Also fail if cat-to-create-expected-output
7243         fails.  Otherwise, if both `exp' and `out' were to end up empty
7244         because of e.g., a full disk, they would mistakenly compare equal.
7245
7246         * src/nohup.c: New file.  Rewrite of nohup.sh in C.
7247         This solves a portability problem: on at least Solaris systems,
7248         when nohup.sh used the vendor /bin/sh, it would exit with status
7249         of `1' rather than the required 126 or 127 upon failure to exec
7250         the specified program.
7251
7252         * src/Makefile.am (EXTRA_SCRIPTS): Remove definition.
7253         (bin_PROGRAMS): Add nohup.
7254         (EXTRA_DIST): Remove nohup.sh.
7255         (all_programs): Remove use of $(EXTRA_SCRIPTS).
7256         * src/nohup.sh: Remove file.
7257         * man/Makefile.am (nohup.1): Depend on nohup.c, rather than nohup.sh.
7258
7259         * tests/misc/nohup: Tests for the above.
7260         * tests/misc/Makefile.am (TESTS): Add nohup.
7261
7262         * src/head.c (diagnose_copy_fd_failure): New function, renamed from
7263         the macro, COPY_FD_DIAGNOSE.
7264         (diagnose_copy_fd_failure): Enclose diagnostic in _(...).
7265         (head_file): Likewise.
7266
7267         * src/date.c: Include "quote.h".
7268         (batch_convert): Use the quote function rather than using literal `...'
7269         in a diagnostic.
7270
7271         * src/setuidgid.c (main): Enclose diagnostic in _(...).
7272         * src/fmt.c (main): Likewise.
7273         * src/mknod.c (main): Likewise.
7274         * src/tac.c (tac_seekable): Likewise.
7275         * src/yes.c (main): Likewise.
7276         * src/od.c (main): Likewise.
7277         * src/install.c (change_attributes): Likewise.
7278
7279 2003-07-10  Jim Meyering  <jim@meyering.net>
7280
7281         * src/head.c (usage): Use 1024*1024 in place of 1048576.
7282         * src/tail.c (usage): Likewise.
7283
7284         * tests/rm/fail-2eperm: Now that we have setuidgid, use it in
7285         place of the kludge in this test.  Suggestion from Paul Jarc.
7286
7287         * src/Makefile.am (noinst_PROGRAMS): Define to setuidgid.
7288         * src/setuidgid.c: New program, solely for testing (not installed).
7289
7290         * src/chown-core.c (change_file_owner): Don't leak file descriptors
7291         when dereferencing symlinks.
7292
7293 2003-07-09  Jim Meyering  <jim@meyering.net>
7294
7295         * tests/du/slash: New file/test for today's lib/ftw.c fix.
7296         * tests/du/Makefile.am (TESTS): Add slash
7297
7298         * src/tail.c (xlseek): Avoid warning about ``return without value
7299         from function returning non-void''.
7300
7301 2003-07-08  Jim Meyering  <jim@meyering.net>
7302
7303         * man/help2man: Update to version 1.29.
7304
7305         * man/help2man: Add END handler to close STDOUT and check for errors.
7306
7307 2003-06-30  Paul Eggert  <eggert@twinsun.com>
7308
7309         Add support for a "[" that conforms to the GNU coding standards,
7310         i.e., that does not depend on its name.
7311         * src/lbracket.c: New file.
7312         * README: Add "[".
7313         * man/Makefile.am (programs): Ignore "[", since it doesn't have
7314         a separate man page.
7315         * src/Makefile.am (bin_PROGRAMS): Add "[".
7316         (__SOURCES): New var.
7317         * src/test.c (LBRACKET): Define to 0 if not defined.
7318         (main): Use LBRACKET rather than argv[0].
7319
7320         * src/test.c (one_argument): Do not check for -t if POSIXLY_CORRECT.
7321         Reported by Paul Jarc and Dan Jacobson.
7322
7323         * src/test.c (main): Do not recognize --help or --version if
7324         POSIXLY_CORRECT, when invoked as "test".  Handle "[ ]" correctly.
7325         Do not bother testing that margv[margc] is non-null.
7326
7327 2003-07-04  Jim Meyering  <jim@meyering.net>
7328
7329         * src/who.c (print_line): Rewrite to use asprintf, in order to be
7330         able to avoid emitting trailing spaces.  Reported by Dan Jacobson.
7331
7332         * tests/misc/head-elide-tail: Add tests of head's new --lines=-N
7333         option, and perform the +1600 invocations of head IFF the envvar
7334         RUN_EXPENSIVE_TESTS is set.
7335
7336 2003-07-03  Jim Meyering  <jim@meyering.net>
7337
7338         * src/cp.c (do_copy): Give a better diagnostic when failing due
7339         to nonexistent destination directory.  Reported by Dmitry Rutsky.
7340         See http://bugs.debian.org/199730 for details.
7341
7342 2003-06-27  Jim Meyering  <jim@meyering.net>
7343
7344         split's --verbose option did nothing [broken in 4.5.10 and 5.0]
7345         * src/split.c (longopts): Use `1', not `0' as the value for
7346         for &verbose.  Reported by Keith Thompson.
7347
7348         Test for the above fix.
7349         * tests/misc/split-a: Also use --verbose and compare stderr
7350         output with what we'd expect.
7351
7352 2003-06-20  Jim Meyering  <jim@meyering.net>
7353
7354         * src/copy.c (copy_internal) [HAVE_STRUCT_STAT_ST_AUTHOR]:
7355         Use `error_t' (rather than int) as type for local `err'.
7356         From Alfred M. Szmidt.
7357
7358 2003-06-19  Marcus Brinkmann  <marcus@gnu.org>
7359
7360         * src/copy.c (copy_internal) [HAVE_STRUCT_STAT_ST_AUTHOR]:
7361         Fix author preservation code.
7362
7363 2003-06-19  Jim Meyering  <jim@meyering.net>
7364
7365         * src/ln.c (ENABLE_HARD_LINK_TO_SYMLINK_WARNING): Define to 0.
7366         (do_link): Don't warn about hard link to symlink.
7367
7368 2003-06-18  Jim Meyering  <jim@meyering.net>
7369
7370         * src/cut.c: Include "getdelim2.h", not "getstr.h".
7371         Reflect renaming: getstr -> getdelim2.
7372
7373         * src/comm.c, src/join.c, src/nl.c, src/uniq.c: Reflect renaming:
7374         readline -> readlinebuffer.
7375
7376 2003-06-09  John David Anglin  <dave.anglin@nrc-cnrc.gc.ca>
7377
7378         * src/readlink.c: Include <sys/types.h> before system.h (because
7379         the latter includes <sys/stat.h>).  Required on Ultrix 4.3.
7380
7381 2003-06-17  Jim Meyering  <jim@meyering.net>
7382
7383         * src/system.h (initialize_main): Define.
7384         Use it in every `main'.  Applied via this:
7385         p='initialize_main (&argc, &argv);'
7386         perl -ni -e '/program_name.=.argv.0/ and print "  '"$p"'\n"; print' \
7387           $(grep -l program_name.=.argv.0 *.c)
7388         test.c uses margc/margv, so I made the change manually for that file.
7389         Based on a patch from Bernard Giroud.
7390
7391 2003-06-09  John David Anglin  <dave.anglin@nrc-cnrc.gc.ca>
7392
7393         Fix for build failure on Ultrix 4.3.
7394         * src/stat.c: Include sys/statvfs.h in preference to sys/vfs.h.
7395         Include sys/param.h and sys/mount.h on ultrix.
7396
7397 2003-06-16  Jim Meyering  <jim@meyering.net>
7398
7399         * src/touch.c (O_NDELAY, O_NONBLOCK, O_NOCTTY, EISDIR): Remove
7400         definitions.
7401         * src/system.h (O_NDELAY, O_NONBLOCK, O_NOCTTY, EISDIR): Define
7402         them here instead, but with one change: define EISDIR to -1, not 0.
7403
7404         * src/cat.c (cat): Remove `#ifndef ENOSYS', now that it's
7405         guaranteed to be defined.
7406         * src/system.h (ENOSYS, ENOTSUP): Define to -1 if not defined.
7407
7408         * README: Mention the CVS repository.
7409         Encourage addition of test cases.
7410
7411 2003-06-12  Jim Meyering  <jim@meyering.net>
7412
7413         * src/touch.c (touch): Call close only if necessary.
7414         From Bruno Haible.
7415
7416         * src/wc.c (usage): Correct wording: wc prints counts in the order
7417         `newline, word, byte'.  Reported by Keith M. Briggs.
7418         * man/wc.x: Fix it here, too.  And change `lines' to `newlines'.
7419
7420 2003-06-10  Jim Meyering  <jim@meyering.net>
7421
7422         * tests/date/Test.pm: Add a test for the new format, e.g., May-23-2003.
7423
7424 2003-06-07  Jim Meyering  <jim@meyering.net>
7425
7426         * Makefile.maint (syntax-check): Add commented-out (over-aggressive)
7427         rule.
7428
7429 2003-06-06  Jim Meyering  <jim@meyering.net>
7430
7431         * src/extract-magic (main): Avoid newer 3-arg form of open,
7432         so this script works also with e.g., perl5.005_03.
7433         Patch by John David Anglin.
7434
7435 2003-06-04  Paul Eggert  <eggert@twinsun.com>
7436
7437         * src/system.h: Include <stdbool.h> unconditionally.
7438
7439 2003-06-04  Jim Meyering  <jim@meyering.net>
7440
7441         * man/Makefile.am (check-programs-vs-x): Rename target
7442         from check-programs-vs-1.  Adjust rule to check for the
7443         primary (.x) file, not the generated one (.1).
7444
7445 2003-06-03  Tim Mooney <mooney@dogbert.cc.ndsu.NoDak.edu>
7446
7447         * man/kill.x: New file.
7448         * man/Makefile.am (dist_man_MANS): Add kill.1.
7449         (kill.1): New rule.
7450
7451 2003-06-04  Jim Meyering  <jim@meyering.net>
7452
7453         Ensure that the .x file for a new program is never forgotten again.
7454         * man/Makefile.am (programs): Define.
7455         (check-programs-vs-1): New phony target.
7456         (check-local): Depend on it.
7457
7458 2003-06-03  Jim Meyering  <jim@meyering.net>
7459
7460         Avoid unnecessary copying of environment.
7461         * src/env.c (main): Rather than clearing the environment and --
7462         unless told to ignore environment -- copying all settings from
7463         the saved, original environment, clear the environment only when
7464         that is requested.  Suggested by Jens Elkner.
7465
7466 2003-06-02  Jim Meyering  <jim@meyering.net>
7467
7468         * src/system.h: Always include <string.h>, since we assume C89.
7469         Include <limits.h> without checking for HAVE_LIMITS_H.
7470
7471         * src/test.c [!TEST_STANDALONE]: Remove #if-0'd block.
7472         (STREQ, S_IXUGO): Remove redundant (in system.h) definitions.
7473
7474 2003-06-01  Jim Meyering  <jim@meyering.net>
7475
7476         Avoid a race condition in `tail -f' described by Ken Raeburn in
7477         http://mail.gnu.org/archive/html/bug-textutils/2003-05/msg00007.html
7478         * src/tail.c (file_lines): Add new parameter, *read_pos, and set it.
7479         (pipe_lines, pipe_bytes, start_bytes, start_lines): Likewise.
7480         (tail_bytes, tail_lines, tail): Likewise.
7481         (tail_file): Use the new `read_pos' value as the size,
7482         rather than stats.st_size from the fstat call.
7483
7484 2003-05-28  Jim Meyering  <jim@meyering.net>
7485
7486         * src/extract-magic: Allow expansion of `$file' in the here-
7487         document corresponding to the comment at the top of fs.h.
7488
7489 2003-05-26  Jim Meyering  <jim@meyering.net>
7490
7491         * src/stat.c: Fix portability problem on FreeBSD5.0: don't include
7492         <sys/statvfs.h> on systems without HAVE_STRUCT_STATVFS_F_BASETYPE.
7493         Use #if/#elif/... cascade so we get only one set of include files.
7494         Reported by Nelson Beebe.
7495
7496 2003-05-24  Jim Meyering  <jim@meyering.net>
7497
7498         * src/md5sum.c (split_3): Accept the BSD format only when in MD5 mode.
7499         * tests/sha1sum/basic-1: Make sure `sha1sum --check' doesn't
7500         accept the BSD format.
7501
7502 2003-03-28  Joe Orton  <jorton@redhat.com>
7503
7504         * src/md5sum.c (bsd_split_3): New function.
7505         (split_3): Detect checksums from BSD 'md5' command and handle them
7506         using bsd_split_3.
7507
7508         * tests/md5sum/basic-1: New tests for --check exit status, and for
7509         BSD-style checksum files.
7510
7511 2003-05-21  Jim Meyering  <jim@meyering.net>
7512
7513         * src/head.c (elide_tail_lines_pipe): Fix a thinko.
7514         This sort of thing is why it'd be *Really Good* to factor
7515         out the common code used here and in tail.c.
7516
7517 2003-05-14  Jim Meyering  <jim@meyering.net>
7518
7519         * src/head.c (usage): Document new feature: --bytes=-N and --lines=-N.
7520
7521         * tests/du/slink: Skip this test if `.' is on an XFS file system.
7522
7523         * tests/du/fd-leak: New file.  Test for the bug in du that
7524         was fixed by the 2003-05-12 change to lib/ftw.c.
7525         * tests/du/Makefile.am (TESTS): Add fd-leak.
7526
7527         * src/head.c (AUTHORS): Enclose string in N_(...), now that it
7528         includes a translatable word, `and'.
7529
7530         * src/dd.c (usage): Don't use `,' as the thousands separator
7531         in e.g. 1,000,000 and 1,048,576.  Instead, do this:
7532         `SIZE may be ..., MB 1000*1000, M 1024*1024 and so on...'
7533         * src/df.c (usage): Likewise.
7534         * src/du.c (usage): Likewise.
7535         * src/ls.c (usage): Likewise.
7536
7537         * Makefile.maint (syntax-check): Add another check.
7538
7539 2003-05-13  Paul Eggert  <eggert@twinsun.com>
7540
7541         Fix uniq to conform to POSIX, which requires that "uniq -d -u"
7542         must output nothing.  Problem reported by Josh Hyman.
7543
7544         * src/uniq.c (enum output_mode, mode): Remove, replacing with:
7545         (output_unique, output_first_repeated, output_later_repeated):
7546         New vars.  All uses of "mode" changed to use these variables,
7547         which are not mutually exclusive as "mode" was.
7548         (writeline): New arg "match", used to control whether to
7549         obey output_first_repeated or output_later_repeated.
7550         All callers changed.
7551         (check_file, main): Adjust to above changes.
7552
7553         * tests/uniq/Test.pm: Test that 'uniq -d -u' outputs nothing.
7554
7555 2003-05-14  Jim Meyering  <jim@meyering.net>
7556
7557         * tests/rm/rm3: Use tr's \n notation rather than \012.
7558         This package can afford to do that, since its tests are guaranteed use
7559         GNU tr, which has accepted the more modern notation for 10 years.
7560         * tests/rm/rm5: Likewise.
7561         * tests/cp/same-file: Likewise.
7562         * tests/stty/row-col-1: Likewise.
7563         * tests/stty/basic-1: Likewise.
7564         * tests/rm/deep-1: Likewise.
7565         * tests/mv/part-symlink: Likewise.
7566         * tests/mkdir/perm: Likewise.
7567         * tests/misc/nice: Likewise.
7568
7569 2003-05-13  Jim Meyering  <jim@meyering.net>
7570
7571         * src/copy.c (struct F_triple) [name]: Remove const attribute.
7572         (triple_free): Don't apply cast to argument of free.
7573         (seen_file): Add cast here instead.
7574
7575         * src/cp-hash.c (struct Src_to_dest) [name]: Remove const attribute.
7576         (src_to_dest_free): Don't apply cast to argument of free.
7577
7578         * src/sort.c (zaptemp): Don't apply cast to argument of free.
7579         * src/pr.c (init_fps, init_store_cols): Likewise.
7580         * src/join.c (delseq, freeline): Likewise.
7581         * src/expr.c (OLD): Likewise.
7582         * src/sort.c (sort): Likewise.
7583         * src/head.c (elide_tail_lines_pipe): Likewise.
7584
7585         * src/tail.c: Include "quote.h".
7586         Use quote in diagnostics.  Change many error format strings
7587         from just `%s' to e.g., `error reading %s'.
7588         (pipe_lines): Change type of parameter, n_lines, to uintmax_t.
7589         Rewrite newline-counting loop to use memchr.
7590
7591         * src/head.c (elide_tail_lines_pipe): Use `if', not assert.
7592         Now that assert is no longer used, don't include <assert.h>.
7593
7594 2003-05-12  Jim Meyering  <jim@meyering.net>
7595
7596         * src/head.c: Include <assert.h>.
7597         (AUTHORS): Add my name.
7598         (elide_tail_lines_pipe): New function.
7599
7600 2003-05-10  Jim Meyering  <jim@meyering.net>
7601
7602         * Makefile.maint (syntax-check): Check for `error (EXIT_SUCCESS,'.
7603
7604         * src/readlink.c (main): Set program_name before first use.
7605         Remove that (redundant) first use.
7606         Don't exit successfully just because --verbose was specified.
7607         Pass 0, not EXIT_SUCCESS, as first argument to error; when that
7608         parameter is 0, error does not exit.
7609
7610         * src/uname.c (main): When failing due to too many arguments, also say
7611         that, rather than just "Try `uname --help' for more information.".
7612         * src/comm.c (main): Likewise, but for too few arguments.
7613         * src/logname.c: Include error.h.
7614         (main): Say why we're failing.
7615
7616         * src/uniq.c (main): Don't segfault when argc < optind.
7617         * src/who.c (main): Handle argc < optind.
7618         * src/df.c (main): Likewise.
7619         * src/install.c (main): Likewise.
7620         * src/mv.c (main): Likewise.
7621         * src/pwd.c (main): Likewise.
7622         * src/tty.c (main): Likewise.
7623         * src/chroot.c (main): Likewise.
7624         * src/hostname.c: Likewise.
7625         * src/du.c (main): Likewise.
7626         * src/expand.c (main): Likewise.
7627         * src/env.c (main): Likewise.
7628         * src/unexpand.c (main): Likewise.
7629         * src/printenv.c (main): Likewise.
7630         * src/sync.c (main): Handle argc == 0.
7631         * src/expr.c (main): Likewise.
7632         * src/printf.c (main): Likewise.
7633         * src/basename.c (main): Likewise.
7634         * src/ln.c (main): Test for `missing argument' before computing n_files.
7635         * src/tail.c (main): Test for the case of no arguments before
7636         computing n_files.
7637
7638         * src/kill.c (send_signals): Don't check command line arguments here.
7639         (main): Check them here instead.  Handle argc < optind.
7640
7641         * src/logname.c (main): Use error, rather than fprintf, for the sake
7642         of consistency.
7643
7644         * src/rm.c (main): Don't overrun array bound if argc is 0.
7645
7646 2003-05-09  Jim Meyering  <jim@meyering.net>
7647
7648         * src/sort.c (main): Don't overrun array bound if argc is 0.
7649         That would happen when invoked via: execl ("/usr/bin/sort", NULL);
7650         Reported by Wartan Hachaturow.
7651
7652 2003-05-07  Jim Meyering  <jim@meyering.net>
7653
7654         Implement support so that `head --lines=-N' works on seekable files.
7655         * src/head.c (enum Copy_fd_status): Define.
7656         (COPY_FD_DIAGNOSE): New macro.
7657         (elide_tail_lines_seekable): New funtion.
7658         (elide_tail_lines_file): Call it here.
7659
7660 2003-05-06  Jim Meyering  <jim@meyering.net>
7661
7662         * src/sys2.h (CHAR_BIT): Remove duplicate definition.
7663
7664 2003-05-04  Jim Meyering  <jim@meyering.net>
7665
7666         * tests/head/Test.pm: Remove tests of --bytes=-N; using that framework
7667         caused the addition of thousands of small files to the tar archive.
7668         * tests/misc/head-elide-tail: New file.  Add them here instead.
7669         * tests/misc/Makefile.am (TESTS): Add head-elide-tail.
7670
7671 2003-05-04  Paul Eggert  <eggert@twinsun.com>
7672
7673         * src/remove.c (HAVE_WORKING_READDIR): Define to 0 if not defined.
7674         (IF_READDIR_NEEDS_REWINDDIR): Remove.
7675         (remove_cwd_entries): Rewrite to avoid IF_READDIR_NEEDS_REWINDDIR,
7676         which was a bit weird because it couldn't be emulated by a function.
7677
7678 2003-05-03  Jim Meyering  <jim@meyering.net>
7679
7680         Extend head to accept --lines=-N (--bytes=-N) and to print all
7681         but the N lines (bytes) at the end of the file.
7682         * src/head.c: Include full-write.h, full-read.h, inttostr.h, quote.h.
7683         Use quote() in diagnostics, rather than literal `' marks.
7684         (copy_fd, elide_tail_bytes_pipe, elide_tail_bytes_file):
7685         New functions.
7686         (elide_tail_lines_pipe, elide_tail_lines_file): New functions.
7687         (head_file): Reorganize so as to call head from only one place.
7688         (main): Likewise, for head_file.
7689         Handle new, undocumented option, --presume-input-pipe.
7690         Handle negative line and byte counts.
7691         * tests/head/Test.pm: Add lots of tests to exercise --bytes=-N.
7692
7693         * tests/du/8gb: Skip test if the file system of `.' doesn't support
7694         sparse files -- otherwise it'd create a file of size 8GB.
7695
7696 2003-05-02  Jim Meyering  <jim@meyering.net>
7697
7698         * src/fmt.c (usage): Don't mention obsolescent -WIDTH option.
7699         Instead explain about `-' and standard input.
7700         (main): Give a proper diagnostic for e.g., `fmt -c -72'.
7701         Reported by Keith Thompson.
7702         * tests/fmt/basic: Add test for the above fix.
7703
7704         * src/fmt.c: Include "quote.h".
7705         Use quote() in diagnostics, rather than literal `' marks.
7706         (main): Exit nonzero when unable to open an input file.
7707         * tests/fmt/basic: Add test for the above fix.
7708
7709         * src/fmt.c (main): Diagnose invalid suffix on obsolescent width
7710         specifications like `-72x'.
7711         * tests/fmt/basic: Add test for the above fix.
7712
7713         Work around nasty readdir bug on Darwin6.5.
7714         * src/remove.c (IF_READDIR_NEEDS_REWINDDIR): Define.
7715         [! HAVE_WORKING_READDIR] (remove_cwd_entries): If readdir has just
7716         returned NULL and there has been at least one successful unlink or
7717         rmdir call since the opendir or previous rewinddir, then call
7718         rewinddir and reiterate the loop.
7719
7720         Factor out common code.
7721         * src/remove.c (readdir_ignoring_dotdirs): New function.
7722         (is_empty_dir): Use it here.
7723         (remove_cwd_entries): Use it here.
7724
7725 2003-05-01  Jim Meyering  <jim@meyering.net>
7726
7727         * tests/rm/r-3: Create 500 rather than just 300 files.
7728         There's a bug in Darwin6.5's readdir that shows up only with
7729         338 or more files.
7730         Fix a bug in this test: `cd $pwd' (not to `..'), now that $tmp
7731         has two components.
7732
7733         * src/tail.c:
7734         Change type of n_units, n_bytes, n_lines to be `uintmax_t'.
7735         (dump_remainder): Move two declarations `down' into the scope
7736         where they are used.
7737         (xlseek): Return the resulting offset.
7738         (file_lines): Rename parameter, file_length, to end_pos.
7739         (pipe_lines): Don't coerce safe_read return value to `int'.
7740         Adapt tests accordingly.
7741         (pipe_bytes) [struct charbuffer] (nbytes): Change type from `int'
7742         to `unsigned int'.
7743         Change type of `total_bytes' from `int' to `size_t',
7744         since the former wouldn't always be wide enough.
7745         Don't coerce safe_read return value to `int',
7746         and adapt tests accordingly.
7747         Now that testing for a read error no longer involves
7748         using `tmp', handle that case *after* freeing `tmp'.
7749         (start_bytes): Clean up.
7750         (tail_bytes): Now that `n_bytes' may be larger than
7751         OFF_T_MAX, test for that condition and, if it's true, don't
7752         use lseek optimizations.
7753         (parse_options): Don't fail just because N_UNITS is larger than
7754         the maximum size of a file -- tail may be applied to an input
7755         stream (e.g., a pipe) with more data than that.
7756
7757         * Makefile.maint (syntax-check): Rename from alloc-check.
7758         Also check for SPACE-TAB sequences.
7759         Also check for malloc/calloc/realloc casts.
7760
7761 2003-05-01  Jim Meyering  <jim@meyering.net>
7762
7763         * src/tail.c (start_lines): Rewrite to use memchr.  Clean up.
7764
7765 2003-04-28  Jim Meyering  <jim@meyering.net>
7766
7767         * tests/misc/tty-eof: Send two tokens, not just one, so we don't
7768         make the now-more-picky tsort fail.
7769
7770 2003-04-24  Jim Meyering  <jim@meyering.net>
7771
7772         * src/tsort.c (tsort): Remove unnecessary test of have_read_stdin.
7773         (main): Minor syntactic clean-up.
7774
7775         * src/tsort.c (tsort): Fail if the input contains an odd number of
7776         tokens.  Reported by junkio@cox.net.
7777
7778         * tests/tsort/basic-1: Test for the above fix.
7779
7780 2003-04-21  Jim Meyering  <jim@meyering.net>
7781
7782         * tests/misc/printf: Add tests for the printf fixes below.
7783
7784         * Makefile.cfg (cvs_files): Add $(srcdir)/config/depcomp to the list.
7785
7786 2003-04-20  Paul Eggert  <eggert@twinsun.com>
7787
7788         Fix printf POSIX compatibility bug reported by Ben Harris in
7789         <http://mail.gnu.org/archive/html/bug-coreutils/2003-04/msg00070.html>.
7790         * doc/coreutils.texi (printf invocation): It's \NNN in the format,
7791         \0NNN in the %b operand.
7792         * src/printf.c (usage): Likewise.
7793         (print_esc): New arg OCTAL0 to specify whether \0NNN or \NNN
7794         is desired.  All uses changed.  Behave like Bash printf if %b
7795         operand uses \NNN where the initial N is not 0.
7796
7797 2003-04-17  Jim Meyering  <jim@meyering.net>
7798
7799         * src/stty.c: Remove uses of PROTOTYPE macro.
7800
7801 2003-04-15  Jim Meyering  <jim@meyering.net>
7802
7803         * Makefile.maint: Remove (or replace-with-TAB(s) to retain alignment)
7804         each sequence of spaces before a TAB character.
7805
7806 2003-04-13  Jim Meyering  <jim@meyering.net>
7807
7808         * src/remove.c (is_empty_dir): Don't closedir (NULL).
7809
7810 2003-04-12  Jim Meyering  <jim@meyering.net>
7811
7812         Giving nl an invalid STYLE argument (in --header-numbering=STYLE (-h),
7813         --body-numbering=STYLE (-b), or --footer-numbering=STYLE (-f)) or
7814         FORMAT (--number-format=FORMAT (-n)) would not give a useful diagnostic.
7815         * src/nl.c (main): Fix those problems and remove literal quote marks
7816         (e.g., "`%s'") from format string; instead use "%s" in each format
7817         string and `quote (optarg)' as the corresponding argument.
7818         Also, diagnose all invalid command line options before failing.
7819
7820         * src/nl.c (proc_text): Fix a bug that would make nl output extra
7821         newlines in some cases.  Details here: http://bugs.debian.org/177256.
7822         This bug was introduced on 2001-11-10 for textutils-2.0.17.
7823         * tests/misc/nl: Add test for the above-fixed bug.
7824
7825         * tests/misc/readlink: New file.  Test the --canonicalize option.
7826         * tests/misc/Makefile.am (TESTS): Add readlink.
7827
7828 2003-04-11  Jim Meyering  <jim@meyering.net>
7829
7830         Clean up.
7831         * src/chown.c, src/cp.c, src/dircolors.hin, src/du.c, src/ln.c:
7832         * src/mkfifo.c, src/ptx.c, src/spline.c, src/stty.c, src/tail.c:
7833         * src/test.c, src/unexpand.c: Remove (or replace-with-TAB(s) to
7834         retain alignment) each sequence of spaces before a TAB character.
7835
7836         * src/ls.c: Include <stdlib.h> unconditionally.
7837
7838         * Makefile.maint (xalloc-check): Rename from header-check.
7839
7840         * src/yes.c: Include error.h after system.h, not before.
7841
7842         Clean up.
7843         * src/copy.c, src/cp-hash.c, src/cp.c, src/csplit.c, src/cut.c:
7844         * src/date.c, src/df.c, src/du.c, src/expand.c, src/expr.c, src/id.c:
7845         * src/join.c, src/md5sum.c, src/nl.c, src/od.c, src/paste.c, src/pr.c:
7846         * src/ptx.c, src/sort.c, src/split.c, src/su.c, src/tail.c, src/tee.c:
7847         * src/tr.c: * src/unexpand.c, src/users.c:
7848         Remove anachronistic casts of xmalloc, xrealloc, and xcalloc
7849         return values and of xrealloc's first argument.
7850         Fix the former with this:
7851         perl -pi -e 's/\([^(]*?\*\) *(x(m|c|re)alloc)\b/$1/'
7852
7853 2003-04-10  Jim Meyering  <jim@meyering.net>
7854
7855         * src/stty.c (wrapf): Declare with format attribute.
7856
7857         The S_MAGIC_... names shouldn't be maintained in two places (prior
7858         to this change, one would have to keep stat.c and fs.h in sync).
7859         This change makes it so those names and the corresponding
7860         hexadecimal constants all reside in stat.c.  fs.h is now generated.
7861         * src/Makefile.am (fs.h): New rule to generate fs.h from stat.c.
7862         (BUILT_SOURCES): Add fs.h, now that it's generated.
7863         (EXTRA_DIST): Add extract-magic.
7864         * src/extract-magic: New script to extract fs.h definitions from stat.c.
7865         * src/stat.c (human_fstype) [__linux__]: Append each hex constant from
7866         fs.h in a comment after the corresponding `case S_MAGIC_...:' statement.
7867
7868         * tests/tail-2/big-4gb: Skip this test (don't fail) if creating a
7869         file with nominal length > 4GB fails.  Reported by Michael Deutschmann.
7870
7871         * man/unexpand.x: Add `SEE ALSO' reference to expand.
7872         * man/expand.x: Add `SEE ALSO' reference to unexpand.
7873         Suggestion from Dan Jacobson.
7874
7875 2003-04-10  Maciej W. Rozycki  <macro@ds2.pg.gda.pl>
7876
7877         * src/fs.h (S_MAGIC_DEVPTS): New magic for Linux's devpts.
7878         * src/stat.c (human_fstype): Handle Linux's devpts.
7879
7880 2003-04-09  Paul Eggert  <eggert@twinsun.com>
7881
7882         * src/split.c (line_bytes_split): Arg is of type size_t, since
7883         that's all that is supported for now.
7884         (main): Check for overflow in obsolescent line count option.
7885
7886 2003-04-09  Jim Meyering  <jim@meyering.net>
7887
7888         * tests/misc/split-fail: Add a new test for the above fix.
7889
7890         * src/split.c (bytes_split): Use size_t temporary (rather than
7891         uintmax_t original) in remaining computations.  From Paul Eggert.
7892
7893         Handle command line option arguments larger than 2^31.
7894         This allows e.g., splitting into files of size 2GB and larger,
7895         and running split --lines=N with N=2^31 or more.
7896         But for --line-bytes=N, the restriction that N <= SIZE_MAX
7897         remains (for now), due to the way it is implemented.
7898
7899         * src/split.c: Include "inttostr.h".
7900         (bytes_split, lines_split, line_bytes_split, main):
7901         Use uintmax_t, not size_t, for file sizes.
7902         (main): Give a better diagnostic for option arguments == 0.
7903         Use umaxtostr to print file sizes.
7904         Reported by Luke Hassell.
7905
7906 2003-04-08  Jim Meyering  <jim@meyering.net>
7907
7908         * src/rm.c (usage): Mention that --directory (-d) works only
7909         on some systems.  Suggestion from Samuel Tardieu.
7910
7911         * tests/basename/basic: Run $PERL to see if it is available,
7912         rather than testing its value.
7913         * tests/sum/sysv, tests/tsort/basic-1, tests/unexpand/basic-1:
7914         * tests/basename/basic, tests/dd/skip-seek, tests/dircolors/simple:
7915         * tests/expr/basic, tests/factor/basic, tests/fmt/basic:
7916         * tests/ls-2/tests, tests/md5sum/basic-1, tests/md5sum/newline-1:
7917         * tests/misc/sort, tests/misc/tty-eof, tests/mv/i-1:
7918         * tests/rm/empty-name, tests/rm/fail-eperm, tests/rm/unreadable:
7919         * tests/seq/basic, tests/sha1sum/basic-1, tests/sha1sum/sample-vec:
7920         * tests/sum/basic-1, tests/seq/basic: Likewise.
7921
7922         * tests/misc/Makefile.am (TESTS): Add split-fail.
7923         * tests/misc/split-fail: New file.
7924
7925         * src/split.c: Rename local variables: nchars -> n_bytes.
7926         (lines_split): Rename local, nlines -> n_lines.
7927         (main): Rename local variable: s/accum/n_units/.
7928         (main): Use STDIN_FILENO, not literal `0'.
7929
7930 2003-04-07  Jim Meyering  <jim@meyering.net>
7931
7932         * src/stat.c: Add #include directives for Ultrix 4.4.
7933         Based on a suggested change from Bert Deknuydt.
7934
7935 2003-04-06  Jim Meyering  <jim@meyering.net>
7936
7937         * Makefile.maint (makefile-check): New rule.
7938         (local-check): Add it.
7939
7940 2003-04-05  Jim Meyering  <jim@meyering.net>
7941
7942         * Makefile.am (nearly all of them):
7943         Use $(VAR) rather than @VAR@, now that we can rely on automake to
7944         emit a definition for each substituted variable.
7945         * tests/Makefile.am.in: Likewise.
7946
7947         * tests/rm/rm5: Add a comment explaining why this test fails when
7948         using Tru64's broken sed.
7949         * tests/rm/rm3: Likewise.
7950
7951         Make `kill -t' output signal descriptions (not `?') on Tru64.
7952         * src/kill.c (sys_siglist): Also check for __sys_siglist.
7953         Patch by Tony Leneis.
7954         * configure.ac: Also check for declaration of __sys_siglist.
7955         Required for Tru64 4.0D, 4.0F, and 5.1.
7956         Reported by Tony Leneis.
7957
7958 2003-04-04  Jim Meyering  <jim@meyering.net>
7959
7960         * src/Makefile.am (PERL): Remove unnecessary definition.
7961
7962         Because of inappropriate (but POSIX-mandated) behavior of rename,
7963         `mv a b' would not remove `a' in some unusual cases.  Work around
7964         this by unlinking `a' when necessary.
7965
7966         * src/copy.c (same_file_ok): Add an output parameter.
7967         Set it in the offending case.
7968         (copy_internal): When necessary, unlink SRC_PATH and inform caller.
7969         Reported by Ed Avis.
7970         * tests/mv/hard-4: New test for the above.
7971         * tests/mv/Makefile.am (TESTS): Add hard-4.
7972
7973         Clean up rules for automatically generated sources:
7974         * src/Makefile.am (dircolors.h, wheel-size.h, wheel.h, false.c):
7975         Make each generated file be read-only.
7976         Add each file name to BUILT_SOURCES separately.
7977         (MAINTAINERCLEANFILES): Set to $(BUILT_SOURCES).
7978
7979         Put LOCALEDIR macro definition in new file: localedir.h.
7980         * src/Makefile.am (DEFS): Remove definition.
7981         (localedir.h): New rule.
7982         (BUILT_SOURCES, DISTCLEANFILES): Add localedir.h.
7983         * src/system.h: Include "localedir.h".
7984
7985 2003-04-02  Jim Meyering  <jim@meyering.net>
7986
7987         * Version 5.0.
7988
7989         * tests/misc/Makefile.am (TESTS): Add false.
7990
7991         * Makefile.maint (TMPDIR): Make sure it's defined.
7992         (my-distcheck): Build in $(TMPDIR), not `.'.
7993
7994         * src/Makefile.am (false.c): Change all occurrences of
7995         `(EXIT_SUCCESS)' to `(EXIT_FAILURE)' so that false exits
7996         unsuccessfully also with --help.  Reported by Paul Jarc,
7997         * tests/misc/false: New test for the above.
7998
7999 2003-03-30  Jim Meyering  <jim@meyering.net>
8000
8001         * NEWS: Note the location of older NEWS files.
8002
8003         * src/remove.c (is_empty_dir): Don't let a failing closedir
8004         clobber errno.  Spotted by Arnold Robbins.
8005
8006         * src/env.c: Fix typo in comment.  From Arnold Robbins.
8007
8008 2003-03-29  Jim Meyering  <jim@meyering.net>
8009
8010         * Version 4.5.12.
8011
8012         * README: Note to expect build problems for stat.c on Ultrix 4.3.
8013         Note that there are some harmless test failures when running
8014         `make check' as root on some systems.
8015
8016 2003-03-28  Jim Meyering  <jim@meyering.net>
8017
8018         * tests/stty/row-col-1: Skip this test if stty can't get window size.
8019         This happens when connecting to sparc-solaris5.7 via ssh from within
8020         emacs.  Reported by Karl Berry.
8021
8022         * tests/du/basic: Use seq, not `yes' to generate 4KB of data.
8023         Otherwise, on systems (DJGPP) that emulate pipes using files,
8024         this test would never complete, waiting for `yes' to terminate.
8025         * tests/du/slink: As above, use seq, not `yes' to generate link target.
8026         * tests/rm/hash: As above, use seq, not `yes' to generate dir name.
8027         Reported by Rich Dawe.
8028
8029 2003-03-27  Jim Meyering  <jim@meyering.net>
8030
8031         * src/id.c: Remove Arnold Robbins' obsolete e-mail address
8032         from `written by...' comment, at his request.
8033
8034 2003-03-24  Paul Eggert  <eggert@twinsun.com>
8035
8036         Fix buffer overrun problem reported by TAKAI Kousuke, along
8037         with some other POSIX incompatibilities.
8038
8039         * src/printf.c (print_esc): Do not treat \x specially if
8040         POSIXLY_CORRECT.  Avoid buffer overrun if the format ends
8041         in backslash.  Treat incomplete escape sequences as strings
8042         of characters, as POSIX requires.
8043         (print_formatted): Allow multiple flags.  Avoid buffer overrun
8044         if the format is incomplete.
8045
8046 2003-03-24  Jim Meyering  <jim@meyering.net>
8047
8048         * tests/misc/printf: Add tests for the above fixes and changes.
8049
8050 2003-03-26  Jim Meyering  <jim@meyering.net>
8051
8052         * src/copy.h (struct cp_options): Add a comment.
8053
8054 2003-03-23  Jim Meyering  <jim@meyering.net>
8055
8056         * README: Describe problem with 64-bit mode on HPUX 11.x,
8057         with patch for /usr/include/inttypes.h.
8058         * TODO: Plan to add an autoconf test to work around the bug.
8059
8060 2003-03-22  Jim Meyering  <jim@meyering.net>
8061
8062         * src/stat.c: Don't include <sys/sysmacros.h>.
8063         That is already done via system.h.  Otherwise, the multiple
8064         inclusion would evoke redefinition warnings from Cray's /bin/cc,
8065         aka Cray Standard C Version 4.0.3  (057126) Mar 22 2003  22:02:28.
8066         (human_fstype): Factor some directives `up', out of this function.
8067         Cast away `const' to avoid error from Cray's /bin/cc.
8068
8069 2003-03-20  Jim Meyering  <jim@meyering.net>
8070
8071         * announce-gen (print_changelog_deltas): Ensure that a newline
8072         precedes each row of `*'s.
8073
8074 2003-03-20  Jim Meyering  <jim@meyering.net>
8075
8076         * Version 4.5.11.
8077
8078         * src/seq.c (valid_format): Also accept ` ' and `'' as valid
8079         format flag characters.
8080         Do not require that a field width be specified.
8081         Do not fail when given a field width of `0'.
8082         Reported by Dan Jacobson.
8083         * tests/seq/basic: Add new tests for the above-fixed bug.
8084
8085         * src/Makefile.am (all-local): Append $(EXEEXT) to use of `su'
8086         (install-root): Likewise.
8087         (install-exec-local): Likewise.
8088         Based on a patch from Richard Dawe.
8089
8090 2003-03-19  Jim Meyering  <jim@meyering.net>
8091
8092         * man/Makefile.am (.x.1): Use $(LN_S) instead of 'ln -s',
8093         because the DJGPP 2.03 port of 'ln -s' doesn't work.
8094         Include $(EXEEXT) in program names.
8095         Since $(LN_S) may degenerate to `cp -p', be careful
8096         to invoke it from the destination directory.
8097         Mostly from Richard Dawe.
8098         * configure.ac: Use AC_PROG_LN_S.
8099
8100         * tests/mv/part-symlink: Unset CDPATH.  Otherwise, having the
8101         CDPATH shell variable set could cause this test to fail.
8102         Reported by Karl Berry.
8103
8104 2003-03-18  Jim Meyering  <jim@meyering.net>
8105
8106         * src/fmt.c [struct Word] (paren, period, punct, final): Change the
8107         type of each member from bool <MEMBER>:1 to unsigned int <MEMBER>:1.
8108         AIX 5.1's xlc could not compile the former.
8109         Patch by Petter Reinholdtsen.  Also reported by Mike Jetzer.
8110
8111 2003-03-17  Richard Dawe  <rich@phekda.freeserve.co.uk>
8112
8113         * configure.ac: Include $(EXEEXT) in OPTIONAL_BIN_PROGS'
8114         program names, since automake only adds $(EXEEXT) to programs
8115         in its *_PROGRAMS.
8116
8117 2003-03-16  Jim Meyering  <jim@meyering.net>
8118
8119         * src/remove.c (rm): Put two local variables in static storage,
8120         so they can't be clobbered by the potential longjmp.
8121
8122 2003-03-15  Jim Meyering  <jim@meyering.net>
8123
8124         * Makefile.cfg (gnu_rel_host): Fix code to match the comment
8125         so that a version number with a two-digit component can still count
8126         as an alpha release.  Reported by Richard A Downing.
8127         (gnu_rel_host): Define in terms of $(RELEASE_TYPE) instead.
8128
8129 2003-03-14  Jim Meyering  <jim@meyering.net>
8130
8131         * src/ansi2knr.c: Remove no-longer-used file.
8132         * src/ansi2knr.1: Likewise.
8133
8134         * Makefile.maint (prev_version_file): Don't use ?= for this particular
8135         assignment, since it causes trouble with old versions of GNU make
8136         (e.g. 3.76.1).  The other uses of `?=' are inoffensive.  Details here.
8137         http://mail.gnu.org/archive/html/bug-coreutils/2003-03/msg00028.html
8138         Patch from Alexandre Duret-Lutz.
8139
8140         * Use patched automake-1.7.3.  Regenerate Makefile.in files in
8141         subdirectories so that each includes a definition of ACLOCAL_M4.
8142
8143         * announce-gen (main): Label the compressed source URLs.
8144
8145         * Version 4.5.10.
8146
8147         * tests/du/slink: Relax the test for the `local'ness of a file system,
8148         so that now it works also for tmpfs.
8149
8150         * tests/du/hard-link: Transform output from first du, so that this
8151         test doesn't fail on file systems like tmpfs that order directory
8152         entries differently.
8153
8154 2003-03-13  Jim Meyering  <jim@meyering.net>
8155
8156         * tests/du/8gb: Work around what appears to be an NFS failure that
8157         would make this test fail on some systems.
8158
8159 2003-03-11  Jim Meyering  <jim@meyering.net>
8160
8161         * tests/du/basic: Make the test file exactly 4k bytes long.
8162
8163         * src/split.c (longopts): Don't hard-code `2' here.
8164         Instead, just specify `&verbose', and ...
8165         (main): ... remove the `case 2:' block for --verbose.
8166
8167         * tests/du/basic: Make the test file larger than 64 bytes, so that
8168         we don't immediately disqualify file systems (e.g., NetApp) on which
8169         smaller files take up zero disk blocks.  Reported by Vin Shelton.
8170
8171 2003-03-10  Jim Meyering  <jim@meyering.net>
8172
8173         Don't segfault for a negative field width or precision in format string.
8174         Note that this is just a stopgap fix.  The longer term solution may
8175         involve adapting bash's builtins/printf.def.
8176
8177         * src/printf.c: (UNSPECIFIED): Define.
8178         (print_direc): Use the special value, UNSPECIFIED, to indicate
8179         that field_width or precision has not been specified.
8180         (print_formatted): Fail if field_width or precision is the
8181         special value, UNSPECIFIED.
8182         Reported by Oliver Kiddle <okiddle@yahoo.co.uk>
8183
8184         * src/sys2.h (INT_MIN): Define, if necessary.
8185         * tests/misc/printf: Add a test for the above-fixed bug.
8186
8187 2003-03-09  Jim Meyering  <jim@meyering.net>
8188
8189         * src/remove.c (AD_stack_pop): Cast sizeof... to int before
8190         changing its sign.  This avoids a warning from gcc on 64-bit systems.
8191         Reported by Bob Proulx.
8192         (pop_dir): Reverse order of sign change and cast, to be consistent
8193         with the above.
8194
8195 2003-03-08  Jim Meyering  <jim@meyering.net>
8196
8197         * tests/Makefile.am (evar-check): Check for POSIXLY_CORRECT not as a
8198         shell variable, but only in the environment.  With /bin/sh->bash, the
8199         shell variable is set to `y', and that would cause a spurious warning.
8200         Reported by Bob Proulx.
8201
8202         * tests/Makefile.am (check-root): Remove touch/fifo.
8203         It doesn't appear to have to be run as root.
8204
8205         * tests/rm/fail-2eperm: Rather than simply using the first non-root
8206         user name, make sure that the selected user name has a usable shell.
8207         Reported by Paul Jarc.
8208
8209         Before, when using shred on a device, one had to specify --exact,
8210         or be careful to choose a size that would not be rounded up and
8211         exceed the maximum value;  that could result in a failure of
8212         the final write.
8213         * src/shred.c (do_wipefd): --exact is now the default for non-regular
8214         files.  Suggestion from Ben Elliston.
8215         (usage): Say it.
8216
8217         * tests/misc/tty-eof: Require at least version 1.11 of Expect.pm.
8218         Old versions of Expect.pm (e.g., 1.07) lack the log_user function.
8219         Patch by Bob Proulx.
8220
8221         * src/Makefile.am (check-misc): Check for use of `defined' in
8222         #define directives.
8223         Change to $(srcdir) before running grep.
8224
8225         * src/sleep.c: Remove now-unused #include and #define directives.
8226
8227         * src/du.c (process_file): If a file's size is not being counted
8228         e.g., because it's a hard link to a file we've already counted,
8229         then don't print a line for it.
8230
8231         * tests/du/hard-link: New test for the above-fixed bug.
8232         * tests/du/Makefile.am (TESTS): Add hard-link.
8233
8234         `du -S' didn't work
8235         * src/du.c: Revert most of the `reorganization' change of 2003-02-20,
8236         and make the two-array approach work.
8237
8238         * tests/du/basic: Correct/add tests for the above fix.
8239         Set LC_ALL, etc., now that we use sort.
8240         Check the block/size of a small file, too.
8241         Correct expected results for simple dir1/dir2/file case.
8242         Add another test of du -S.
8243
8244 2003-03-07  John David Anglin  <dave.anglin@nrc-cnrc.gc.ca>
8245
8246         Avoid build failure with gcc on hppa1.1-hp-hpux10.20 (see GCC PR
8247         middle-end/9986).  As one of GCC's optimizations, it transforms a
8248         fputs_unlocked call to a fputc_unlocked call when the string is
8249         one character long.  However, hpux doesn't have fputc_unlocked.
8250
8251         * expr.c (usage): Use putchar, not fputs, to output a single character.
8252         * ls.c (dired_dump_obstack): Likewise.
8253         * ptx.c (output_one_tex_line, output_one_dumb_line): Likewise.
8254         * stat.c (print_it): Likewise.
8255
8256 2003-03-07  Jim Meyering  <jim@meyering.net>
8257
8258         * src/cp.c: Remove everything associated with mmap-stack.c.
8259         This reverts the two changes of 2003-02-21.
8260         * src/du.c: Remove everything associated with mmap-stack.c.
8261         This reverts the change of 2003-02-19.
8262
8263 2003-03-06  Jim Meyering  <jim@meyering.net>
8264
8265         * tests/cp/same-file: Unset CDPATH.  Otherwise, having the
8266         CDPATH shell variable set could cause this test to fail.
8267         Reported by Karl Berry.
8268
8269 2003-03-05  Jim Meyering  <jim@meyering.net>
8270
8271         * Version 4.5.9.
8272
8273         * src/printf.c (print_esc): Remove pointless comparison of unsigned
8274         integer with zero, to avoid a warning from Intel's ecc.
8275         Reported by Nelson Beebe.
8276
8277         * src/du.c (process_file): Sizes must all be of type uintmax_t.
8278         Otherwise, for files or totals that are too big, numbers would
8279         be truncated.  Patch mostly by Michael Stone.
8280         Reported by Ingo Saitz as Debian bug #183210.
8281
8282         * tests/du/8gb: New test for the above-fixed bug.
8283         * tests/du/Makefile.am (TESTS): Add 8gb.
8284
8285         * src/du.c (MAX_N_DESCRIPTORS): Use 3 * UTILS_OPEN_MAX / 4
8286         rather than UTILS_OPEN_MAX - 10.
8287
8288 2003-03-04  Jim Meyering  <jim@meyering.net>
8289
8290         * README: Refer new feature discussion to bug-coreutils@gnu.org,
8291         rather than bug-gnu-utils, now that the former is better known.
8292         Suggestion from Göran Uddeborg.
8293
8294         * src/stat.c (usage): Capitalize consistently.
8295         Reported by Göran Uddeborg.
8296
8297         * Makefile.maint (rel-files): Include $(signatures), so that
8298         those files are also copied into $(release_archive_dir).
8299
8300         * src/df.c (find_mount_point): Call error here, now that restore_cwd
8301         no longer does it.
8302         * src/remove.c (AD_pop_and_chdir): Likewise.
8303
8304         * tests/Makefile.am (check-root): Add fail-2eperm.
8305
8306 2003-03-03  Jim Meyering  <jim@meyering.net>
8307
8308         * src/remove.c (remove_cwd_entries): Include the full filename of
8309         the offending file, not just the basename.
8310
8311         * tests/misc/tty-eof: Set $ME properly.
8312
8313         * Makefile.maint (THIS_VERSION_REGEXP, PREV_VERSION_REGEXP):
8314         Remove now-unused variables.
8315         (tag-prev-version, prev-cvs-tag): Likewise.
8316
8317         * src/remove.c (remove_cwd_entries) [!ROOT_CAN_UNLINK_DIRS]: Give an
8318         accurate diagnostic when failing to remove a file owned by some other
8319         user.  Reported by Ivo Timmermans via Michael Stone.
8320         This fixes Debian bug# 178471.
8321
8322         * tests/rm/Makefile.am (TESTS): Add fail-2eperm.
8323         * tests/rm/fail-2eperm: New test, for the above-fixed bug.
8324         Based on a report from Ivo Timmermans.
8325
8326 2003-03-02  Jim Meyering  <jim@meyering.net>
8327
8328         * src/copy.c (copy_internal) [un_backup]: When recovering from a
8329         failure to create a hard link, do not remove the entry associating
8330         the source dev/ino with the destination file name.
8331         * tests/mv/Makefile.am (TESTS): Add hard-3.
8332         * tests/mv/hard-3: New test, for the above-fixed bug.
8333         Inspired by a report from Iida Yosiaki.
8334
8335 2003-03-01  Jim Meyering  <jim@meyering.net>
8336
8337         * src/df.c (print_header): Don't embed spaces in a separate `Type'
8338         header string.  Instead, put `Filesystem' and `Type' headers in the
8339         same string, so translators can use horizontal space as needed.
8340         Reported by Jean Charles Delepine.
8341
8342 2003-02-28  Jim Meyering  <jim@meyering.net>
8343
8344         * src/copy.c (copy_internal): When link fails because of an
8345         existing destination file, unlink that file and try again.
8346         Reported by Iida Yosiaki.
8347
8348         * tests/mv/Makefile.am (TESTS): Add hard-2.
8349         * tests/mv/hard-2: New test for the above-fixed bug.
8350         Based on a test case from Iida Yosiaki.
8351
8352 2003-02-26  Jim Meyering  <jim@meyering.net>
8353
8354         * tests/du/basic: Don't test du's -b option here.  Directory byte
8355         counts are smaller (512 rather than 4096) on at least OSF/1 5.1
8356         and IBM AIX 4.2.  Reported by Nelson Beebe.
8357
8358 2003-02-25  Jim Meyering  <jim@meyering.net>
8359
8360         * Makefile.maint (announcement): Now that ChangeLog entries
8361         are output by announce-gen, don't do it here.
8362         * announce-gen (print_changelog_deltas): New function.
8363         (main): Use it.
8364
8365 2003-02-22  Jim Meyering  <jim@meyering.net>
8366
8367         * announce-gen: New option: --release-type=TYPE
8368         * Makefile.maint (beta, major): New targets.  Remove `release'.
8369         Put them all together on a line.
8370         Pass the release type (via RELEASE_TYPE envvar) to the MAKE
8371         invocation of `announcement'.
8372         (announcement): Invoke announce-gen with --release-type=$RELEASE_TYPE.
8373
8374         * announce-gen: New option: --news=NEWS_FILE.
8375         Extract NEWS entries here, not via rules in Makefile.maint.
8376         * Makefile.maint (announcement): Now that NEWS entries are
8377         extracted by announce-gen, don't do it here.
8378         (news-r1, news-r2): Remove now-unused definitions.
8379
8380 2003-02-21  Jim Meyering  <jim@meyering.net>
8381
8382         * Version 4.5.8.
8383
8384         Merge in changes from autoconf's version of this file.
8385         * Makefile.maint (www-gnu): Define.
8386         (standards.texi-url_prefix): Use $(www-gnu).
8387         (make-stds.texi-url_prefix): Likewise.
8388
8389         * src/cp.c: Include "mmap-stack.h".
8390         (main): Invoke `run' through a macro that (when possible) runs it
8391         with a large, mmap'd stack.
8392
8393         * src/cp.c (run): New function, preparing for the above.
8394         Exit from this function, not from main
8395         (main): Call run.
8396
8397         * src/du.c: New option: --apparent-size.
8398         (enum) [APPARENT_SIZE_OPTION]: New member.
8399         (long_options): Add it.
8400         (usage): Describe it.
8401         (main): Handle it.
8402         ['b']: Set apparent_size.
8403         David Eisner reported that the behavior of --bytes had changed.
8404         Paul Eggert proposed the use of a new option, --apparent-size.
8405
8406         * src/du.c (apparent_size): New global.
8407         (print_only_size): Reflect the fact that we're printing byte counts,
8408         not ST_NBLOCKSIZE-byte-block counts.
8409         (print_size): Call print_only_size rather than duplicating its code.
8410         (process_file): Accumulate byte counts, rather than block counts.
8411
8412         * src/du.c (process_file): Always reset size_to_propagate_to_parent
8413         for --separate-dirs (-S).
8414
8415 2003-02-20  Jim Meyering  <jim@meyering.net>
8416
8417         * Use automake-1.7.3.  Regenerate dependent files.
8418
8419         * src/stat.c (print_stat): New format: %B (to print ST_NBLOCKSIZE).
8420         This makes %b (number of ST_NBLOCKSIZE-byte blocks) more useful.
8421         (usage) [%B]: Describe it.
8422         [%b]: Refer to %B.
8423
8424         * src/du.c (process_file): Reorganize the code to use only
8425         one `sum' array, and change how -S works back to the way it was
8426         before 2003-01-31.  Patch by Bruno Haible.
8427
8428         * tests/du/basic: New test.
8429         * tests/du/Makefile.am (TESTS): Add basic.
8430
8431         * tests/envvar-check: Add checks for the following:
8432         BLOCK_SIZE, DU_BLOCK_SIZE, DF_BLOCK_SIZE, LS_BLOCK_SIZE.
8433
8434         * tests/Makefile.am: Rename phony target envvar-check to evar-check
8435         so as not to conflict with the distributed file by the same name.
8436
8437         * src/du.c (process_file): Set info->skip before any possible return.
8438
8439         Report correct usage for directories, not 0.
8440         * src/du.c (process_file): Return for `file_type == FTW_DPRE'
8441         _before_ recording the dev/ino of a directory.
8442         Reported by Bruno Haible.
8443
8444         Now, df always displays the device file name corresponding to the
8445         listed mount point under `Filesystem'.  Before, for an unmounted
8446         block- or character-special file argument, it would display the
8447         command-line argument instead.
8448         * src/df.c (show_disk): Return a value indicating whether
8449         there was a match.  Don't try to find a mount point here.
8450         (show_entry): If show_disk doesn't find a match, call show_point.
8451
8452 2003-02-19  Jim Meyering  <jim@meyering.net>
8453
8454         * src/du.c: Include "mmap-stack.h".
8455         (du_files): Add prototype with ATTRIBUTE_NORETURN.
8456         Exit from this function, not from...
8457         (main): ...here.
8458         Instead, if possible, invoke du_files through a macro that
8459         runs it with a large, mmap'd stack.
8460
8461         * src/join.c (usage): Change wording in --help output:
8462         use FILENUM instead of `SIDE' and say what FILENUM means.
8463         Reported by Bernhard Gabler.
8464
8465         * src/df.c (print_header): Rather than using a hard-coded literal
8466         string of spaces matching the length of the English `...Type' header,
8467         output the right number of spaces to match the selected translation.
8468         Reported by Yann Dirson and Jean Charles Delepine as Debian bug 131113.
8469
8470         * src/split.c (bytes_split): Remove unnecessary `else' after break.
8471         (lines_split): Likewise.  and correct misleading indentation.
8472
8473         * src/split.c: Include "full-read.h".
8474         (bytes_split, lines_split, line_bytes_split): Use full_read,
8475         not safe_read.   The way split was using the latter, a short read
8476         could cause split to terminate before EOF.
8477
8478         * tests/misc/tty-eof: Test all programs that can read stdin,
8479         requiring no arguments and that write to standard output.
8480
8481         * tests/misc/tty-eof: New file.  Renamed from ...
8482         * tests/misc/cat-tty-eof: Remove file.  Rename to tty-eof.
8483         * tests/misc/Makefile.am (TESTS): Reflect renaming.
8484
8485 2003-02-18  Jim Meyering  <jim@meyering.net>
8486
8487         cksum would perform an extra read after encountering EOF
8488         * src/cksum.c (cksum): Exit the loop upon EOF, too.
8489         Patch by Michael Bacarella.
8490
8491         Test for the bug fixed today in cksum, md5sum, and sha1sum.
8492         * tests/misc/cat-tty-eof: Generalize, clean-up, and test for
8493         cat, cksum, md5sum, and sha1sum all in the same loop.
8494
8495 2003-02-14  Jim Meyering  <jim@meyering.net>
8496
8497         * src/remove.c: Include "euidaccess.h".
8498         Remove declaration of euidaccess.
8499
8500 2003-02-12  Jim Meyering  <jim@meyering.net>
8501
8502         * src/pathchk.c (portable_chars_only): Remove unnecessary `const'
8503         in cast to avoid warning from icc.  Reported by Alexandre Duret-Lutz.
8504
8505 2003-02-10  Jim Meyering  <jim@meyering.net>
8506
8507         * src/test.c: Don't include group-member.h.
8508         Include euidaccess.h.
8509         (eaccess): Rewrite function to set the real uid and gid temporarily
8510         to the effective uid and gid, then invoke 'access', and then set the
8511         real uid and gid back.  On systems that lack setreuid or setregid,
8512         fall back on the kludges in euidaccess.  Before, it would not work
8513         for e.g., files with ACLs, files that were marked immutable,
8514         or on file systems mounted read-only.  Nelson Beebe raised the issue.
8515         Paul Eggert suggested the new implementation.
8516
8517 2003-02-09  Jim Meyering  <jim@meyering.net>
8518
8519         * src/test.c (test_stat): Remove function.  It's job is done (only
8520         when necessary) by the wrapper in lib/stat.c.  Adjust all uses.
8521
8522 2003-02-08  Jim Meyering  <jim@meyering.net>
8523
8524         * Version 4.5.7.
8525
8526         * tests/mv/part-symlink: Don't assume that the file owner username
8527         length is less than 9 in ls output: instead, omit that field
8528         altogether.  Reported by, and suggested fix from, Ferdinand.
8529
8530         * tests/du/restore-wd: New test for just-fixed bug in ftw.c.
8531         * tests/du/Makefile.am (TESTS): Add restore-wd.
8532
8533         * src/rm.c: Correct now-invalid comment about cycle-detection.
8534
8535 2003-02-06  Jim Meyering  <jim@meyering.net>
8536
8537         * NEWS: Add entries from old/*/NEWS
8538         from fileutils-4.1 through 4.1.11 and
8539         from sh-utils-2.0 through 2.0.15.  Suggestion from Karl Berry.
8540
8541         * Version 4.5.6.
8542
8543         * src/du.c (process_file): Don't return early for excluded files
8544         or for files whose dev/inode we've already seen.
8545
8546 2003-02-05  Jim Meyering  <jim@meyering.net>
8547
8548         * tests/du/exclude: New file.
8549         * tests/du/Makefile.am (TESTS): Add exclude.
8550
8551 2003-02-04  Dmitry V. Levin  <ldv@altlinux.org>
8552
8553         * src/who.c (print_boottime, print_deadprocs, print_runlevel):
8554         Fix memory allocation arithmetic.
8555
8556 2003-02-04  Jim Meyering  <jim@meyering.net>
8557
8558         `df /dev/block-or-char-device-file--not-mounted' now reports
8559         the name of the file system on which the file resides, usually `/'.
8560         Before, it would leave the `Mounted on' field blank.
8561         * src/df.c (show_disk): Move function to precede find_mount_point.
8562         (show_disk): Add parameter: STATP.
8563         If we don't find a matching device name, then resort to calling
8564         find_mount_point.  Reported by Bob Proulx.
8565
8566 2003-02-03  Andreas Schwab  <schwab@suse.de>
8567
8568         * tests/rm/cycle: Require non-root.
8569         * tests/rm/isatty: Likewise.
8570
8571 2003-02-02  Jim Meyering  <jim@meyering.net>
8572
8573         * Version 4.5.5.
8574
8575         * man/Makefile.am (check-x-vs-1): Use @PATH_SEPARATOR@, not `:'.
8576
8577         Ensure that there are no offending uses of `:'.
8578         * Makefile.maint (makefile_path_separator_check): New rule.
8579         (local-check): Add it to the list.
8580
8581 2003-02-01  Jim Meyering  <jim@meyering.net>
8582
8583         * src/du.c (MAX_N_DESCRIPTORS): Define.
8584
8585         * src/stat.c (G_fail): New global.
8586         (human_time): Diagnose failed localtime, not failed nstrftime.
8587         (main): Fail if G_fail is set.
8588
8589 2003-01-31  Richard Dawe  <rich@phekda.freeserve.co.uk>
8590
8591         * tests/basename/Makefile.am: Use @PATH_SEPARATOR@ instead of
8592         hard-coding the path-separator.  Also double-quote the new PATH,
8593         to avoid problems when the path-separator is a semi-colon or when
8594         `pwd` contains e.g. a space.
8595         * tests/chgrp/Makefile.am: Likewise.
8596         * tests/chmod/Makefile.am: Likewise.
8597         * tests/chown/Makefile.am: Likewise.
8598         * tests/cp/Makefile.am: Likewise.
8599         * tests/dd/Makefile.am: Likewise.
8600         * tests/dircolors/Makefile.am: Likewise.
8601         * tests/du/Makefile.am: Likewise.
8602         * tests/expr/Makefile.am: Likewise.
8603         * tests/factor/Makefile.am: Likewise.
8604         * tests/fmt/Makefile.am: Likewise.
8605         * tests/install/Makefile.am: Likewise.
8606         * tests/ln/Makefile.am: Likewise.
8607         * tests/ls/Makefile.am: Likewise.
8608         * tests/ls-2/Makefile.am: Likewise.
8609         * tests/md5sum/Makefile.am: Likewise.
8610         * tests/misc/Makefile.am: Likewise.
8611         * tests/mkdir/Makefile.am: Likewise.
8612         * tests/mv/Makefile.am: Likewise.
8613         * tests/od/Makefile.am: Likewise.
8614         * tests/rm/Makefile.am: Likewise.
8615         * tests/rmdir/Makefile.am: Likewise.
8616         * tests/seq/Makefile.am: Likewise.
8617         * tests/sha1sum/Makefile.am: Likewise.
8618         * tests/shred/Makefile.am: Likewise.
8619         * tests/stty/Makefile.am: Likewise.
8620         * tests/sum/Makefile.am: Likewise.
8621         * tests/tail-2/Makefile.am: Likewise.
8622         * tests/touch/Makefile.am: Likewise.
8623         * tests/tsort/Makefile.am: Likewise.
8624         * tests/unexpand/Makefile.am: Likewise.
8625
8626 2003-01-31  Jim Meyering  <jim@meyering.net>
8627
8628         * src/stat.c: Include "file-type.h"
8629         (print_human_type): Remove function.
8630         (human_access): Rename from print_human_access.  Return a string.
8631         (human_time): Rename from print_human_time.  Return a string.
8632         (print_stat): Arrange so that field width and an alignment specifier
8633         are honored for the %A, %F, %x, %y, and %z formats.
8634         [%F]: Use file_type; this gives slightly different file type strings,
8635         e.g., `directory' instead of `Directory' and `regular file' or
8636         `regular empty file' instead of `Regular file'.
8637         Prompted by a report from Richard Dawe that the uses of
8638         S_IFSOCK and S_IFIFO in print_human_time were not portable
8639         to systems using e.g., DJGPP.
8640
8641 2003-01-31  Richard Dawe  <rich@phekda.freeserve.co.uk>
8642
8643         * src/stat.c (print_stat): Use S_ISLNK rather than an explicit
8644         test using S_IFMT and S_IFLNK.  S_IFLNK may not be defined.
8645
8646 2003-01-31  Jim Meyering  <jim@meyering.net>
8647
8648         * src/du.c (main): Upon processing an invalid option or an invalid
8649         --exclude-from or --max-depth option argument, don't exit right away,
8650         in case there are others.  Rather record the failure and exit after
8651         processing other options.
8652
8653         * GNUmakefile (TAR_OPTIONS): Set and export, in order to make
8654         tar archive easier to reproduce.
8655
8656         Rewrite to perform directory traversal using nftw.
8657
8658         * src/du.c: Include "dirname.h", "ftw.h", and "quotearg.h".
8659         (AUTHORS): Add self.
8660         (opt_one_file_system): Move global into `main'.
8661         (path, xstat, exit_status): Remove declarations.
8662         (arg_length, suffix_length): New globals.
8663         (G_fail): New global, sort of like the old `exit_status'.
8664         (IS_FTW_DIR_TYPE): Define.
8665         (print_only_size): New function.
8666         (process_file): New function.
8667         (str_init, ensure_space, str_copyc, str_concatc): Remove functions.
8668         (str_trunc, pop_dir, count_entry): Likewise.
8669         (du_files): Rewrite to use nftw.
8670
8671 2003-01-30  Jim Meyering  <jim@meyering.net>
8672
8673         * tests/du/trailing-slash: Ensure that du/ftw follows a command-line
8674         symlink-to-directory with -L, even without the trailing slash.
8675
8676 2003-01-27  Jim Meyering  <jim@meyering.net>
8677
8678         * src/Makefile.am (check-misc): Check for st_blocks, too.
8679
8680         * src/stat.c (print_stat): Use ST_NBLOCKS rather than `->st_blocks'.
8681         Reported by Richard Dawe.
8682
8683 2003-01-27  Andreas Schwab  <schwab@suse.de>
8684
8685         * src/ls.c (quote_name): Add fourth parameter, width, into which to
8686         store the screen columns, and return the number of bytes instead.
8687         (print_dir): Pass NULL as fourth parameter of quote_name.
8688         (print_name_with_quoting): Likewise.
8689         (length_of_file_name_and_frills): Get the width from the fourth
8690         parameter of quote_name instead of return value.
8691
8692 2003-01-27  Jim Meyering  <jim@meyering.net>
8693
8694         * src/ls.c (decode_switches): If `dired' is set without
8695         `format == long_format', then silently reset dired.  This doesn't
8696         change the behavior of ls (all prior uses of dired were protected
8697         by `&& format == long_format'), and lets us...
8698         (DIRED_INDENT): ... remove the `format == long_format' conjunct.
8699         (PUSH_CURRENT_DIRED_POS): Likewise.
8700         (main): Likewise.
8701
8702 2003-01-22  Jim Meyering  <jim@meyering.net>
8703
8704         * tests/du/no-x: New test, for functionality added to lib/ftw.c.
8705         * tests/du/Makefile.am (TESTS): Add no-x.
8706
8707 2003-01-21  Jim Meyering  <jim@meyering.net>
8708
8709         * src/remove.c (remove_entry) [ROOT_CAN_UNLINK_DIRS
8710         && HAVE_STRUCT_DIRENT_D_TYPE]: If a file has d_type == DT_UNKNOWN
8711         it may still be a directory -- or not (e.g., with FreeBSD on an
8712         NFS-mounted file system), so resort to calling lstat to find out.
8713         Based on a patch by Michael van Elst.
8714
8715         * tests/cp/same-file: Don't assume that the file owner username
8716         length is less than 9 in ls output: instead, omit that field
8717         altogether.  Reported by, and suggested fix from, Ferdinand.
8718
8719 2003-01-20  Jim Meyering  <jim@meyering.net>
8720
8721         * tests/date/Test.pm (wide-fmt): New test to demonstrate that
8722         large format widths no longer cause strftime to infloop.
8723
8724         * Makefile.maint (mail_gpg_sign_cookie): Remove now-unused definition.
8725
8726 2003-01-19  Jim Meyering  <jim@meyering.net>
8727
8728         * src/readlink.c: Include "canonicalize.h".
8729
8730 2003-01-18  Jim Meyering  <jim@meyering.net>
8731
8732         * src/ls.c (Dereference_symlink) [DEREF_COMMAND_LINE_SYMLINK_TO_DIR]:
8733         New member.
8734         (enum) [DEREFERENCE_COMMAND_LINE_SYMLINK_TO_DIR_OPTION]: New member.
8735         (long_options): Add option --dereference-command-line-symlink-to-dir.
8736         (main): Make DEREF_COMMAND_LINE_SYMLINK_TO_DIR be the default,
8737         rather than DEREF_COMMAND_LINE_ARGUMENTS, when none of the
8738         -d, -F, -l options is specified.
8739         (decode_switches): Handle --dereference-command-line-symlink-to-dir.
8740         (gobble_file): Honor DEREF_COMMAND_LINE_SYMLINK_TO_DIR.
8741         Change --dereference-command-line (-H) to dereference *all*
8742         command line arguments, including broken symlinks.
8743
8744 2003-01-15  Paul Eggert  <eggert@twinsun.com>
8745
8746         Change ls -H back to the way it was yesterday, since this is
8747         compatible with FreeBSD and the POSIX spec is confusing
8748         and somewhat contradictory.
8749
8750         * src/ls.c (DEREF_COMMAND_LINE_ARGUMENTS): Change name back
8751         from DEREF_COMMAND_LINE_SYMLINK_TO_DIR, updating all uses.
8752         (long_options): Change the long option name back.
8753         (usage): Change the usage back.
8754         (gobble_file): When -H is specified, dereference a top-level
8755         arg even if it points to a non-directory.
8756
8757 2003-01-15  Jim Meyering  <jim@meyering.net>
8758
8759         * src/ls.c (gobble_file): Fall back on using lstat when required:
8760         when --dereference (-L) is not specified, and
8761         - when operating on a dangling symlink
8762         - when operating on command-line-symlink-to-directories
8763         This fixes numerous problems.  Here are examples:
8764         - `ls dangling-symlink' would fail with `no such file...'
8765         Now it prints `dangling-symlink'.
8766         - `ls -i symlink' would mistakenly print the inode of the referent.
8767         Now it prints the inode of the symlink.  Likewise for --size (-s).
8768         Based on a patch from Michael Stone.
8769         Reported by Deepak Goel as Debian bug #173793.
8770
8771         Rename ls's --dereference-command-line (-H)
8772         option to   --dereference-command-line-symlink-to-dir.
8773         * src/ls.c [enum Dereference_symlink]
8774         (DEREF_COMMAND_LINE_SYMLINK_TO_DIR): Rename from
8775         DEREF_COMMAND_LINE_ARGUMENTS.  Update all uses.
8776         (long_options): Rename the long option.
8777         (usage): Say that --dereference-... changes how ls treats
8778         only symlinks to directories specified on the command line.
8779
8780 2003-01-14  Jim Meyering  <jim@meyering.net>
8781
8782         * tests/ls/dangle: New file/test, for the above fix.
8783         * tests/ls/inode: Another new file/test, for the above fix.
8784         * tests/ls/Makefile.am (TESTS): Add dangle and inode.
8785
8786         * src/ls.c (gobble_file): Fix a bug introduced in 4.5.4 that made it
8787         so that ls --color would no longer highlight the names of files with
8788         the execute bit set when not specified on the command line.
8789         Patch by Michael Stone.  Reported by Stephen Depooter as
8790         Debian bug 175135.
8791
8792         * tests/ls-2/tests (color-exe): New test, for the above fix.
8793
8794 2003-01-13  Jim Meyering  <jim@meyering.net>
8795
8796         * tests/shred/exact: Also test for just fixed bug with --zero.
8797
8798         * src/shred.c (long_opts): --zero does not require an argument.
8799         Patch by Michael Stone.  Reported by Roland Turner as Debian bug 172019.
8800
8801 2003-01-12  Jim Meyering  <jim@meyering.net>
8802
8803         * Makefile.maint (cvs-update): Skip any file with local modifications.
8804
8805         * src/unexpand.c (usage): Document --first-only and mention that
8806         --tabs=N (-t) enables --all (-a).  Reported by wiregauze@yahoo.com.
8807
8808 2002-12-01  Dmitry V. Levin  <ldv@altlinux.org>
8809
8810         * src/df.c: Include "canonicalize.h".
8811         Use canonicalize_file_name unconditionally.
8812
8813 2003-01-09  Jim Meyering  <jim@meyering.net>
8814
8815         * README: Add readlink.
8816
8817 2002-11-30  Dmitry V. Levin  <ldv@altlinux.org>
8818
8819         * src/df.c: Include "xgetcwd.h".
8820         * src/pwd.c: Likewise.
8821
8822 2002-11-30  Dmitry V. Levin  <ldv@altlinux.org>
8823
8824         * src/shred.c: Remove declaration of xstrdup.
8825         We already get it via xalloc.h which is included via system.h.
8826
8827 2002-08-27  Dmitry V. Levin  <ldv@altlinux.org>
8828
8829         New program: readlink.
8830
8831         * src/Makefile.am (bin_PROGRAMS): Add readlink.
8832         * src/readlink.c: New file.
8833
8834         * man/readlink.x: New file.
8835         * man/Makefile.am (dist_man_MANS): Add readlink.1.
8836         (readlink.1): New rule.
8837
8838 2003-01-09  Jim Meyering  <jim@meyering.net>
8839
8840         When selecting ranges of byte offsets (as opposed to ranges of fields)
8841         and when --output-delimiter=STRING is specified, output STRING between
8842         ranges of selected bytes.
8843         * src/cut.c (RANGE_START_SENTINEL): Define.
8844         (output_delimiter_specified): New global.
8845         (print_kth): Add parameter.  Adjust all callers.
8846         (set_fields): Mark each range-start index with RANGE_START_SENTINEL.
8847         (cut_bytes): When requested, output STRING between ranges of
8848         selected bytes.
8849         (main): Make a diagnostic a little clearer.
8850         Based on a patch from Jan Nieuwenhuizen.
8851
8852         * tests/cut/Test.pm: New tests for the above.
8853
8854         * src/cut.c (set_fields): Make code agree with comment:
8855         Don't merge abutting ranges like 4- and 2-3.  This makes no
8856         difference currently, but is required to support an upcoming change.
8857
8858 2003-01-07  Jim Meyering  <jim@meyering.net>
8859
8860         * src/cut.c (set_fields): Fix typo in comment.
8861
8862         * tests/touch/not-owner: New test, mostly extracted from fail-diag.
8863         * tests/touch/Makefile.am (TESTS): Add not-owner.
8864         * tests/touch/fail-diag: Remove the test for non-owner diagnostic.
8865         Now, this tests only the nonexistent-directory diagnostic.
8866         Suggestion from Michael Stone.
8867
8868         * tests/touch/fail-diag: Fix typo: s/ld/ls/.
8869
8870 2003-01-04  Jim Meyering  <jim@meyering.net>
8871
8872         * src/copy.h: Remove use of PARAMS.
8873         * src/remove.h: Likewise.
8874         * src/chown-core.h: Likewise.
8875
8876         rm could be tricked into mistakenly reporting a cycle.
8877         * src/remove.c: [cycle_check_state]: New global.
8878         (remove_cwd_entries): Adapt to new semantics of cycle_check.
8879         (rm): Call cycle_check_init and cycle_check_free for each file.
8880         * tests/rm/cycle (rm): New test, for the above fix.
8881         * tests/rm/Makefile.am (TESTS): Add cycle.
8882
8883         When rm detects a cycle, don't abort the entire command,
8884         but rather just the affected command line argument.
8885         * src/remove.c: Include <setjmp.h>
8886         (struct dirstack_state) [current_arg_jumpbuf]: New member.
8887         (remove_cwd_entries): Call longjmp if we detect a cycle.
8888         (rm): Call setjmp here.
8889
8890         * src/remove.c (cycle_check, is_power_of_two): Remove functions.
8891         Instead, include cycle-check.h and use it.
8892
8893         * src/remove.h (struct dev_ino): Remove declaration.
8894
8895         * src/remove.c (remove_cwd_entries): Fix typos in comment.
8896
8897         Don't include trailing /. in diagnostics about directories.
8898         * src/remove.c (full_filename_): When FILENAME is just `.'
8899         and there is a nonempty directory-name part, don't append `/.'.
8900         * tests/rm/unread2: Remove trailing /. from diagnostic.
8901         * tests/rm/rm2: Likewise.
8902
8903         * src/remove.c (struct dirstack_state): Define.
8904         To be used in place of these file-scoped globals ...
8905         (dir_stack, len_stack, Active_dir): Remove globals.
8906         (ds_init, ds_free): New functions.
8907         (full_filename): Define.
8908         (full_filename_): Rename from full_filename.
8909
8910         Begin to make AD_* functions more generic.
8911         * src/remove.c (AD_push_initial): Don't set status to RM_OK here.
8912         (AD_push): Likewise.
8913         (AD_INIT_OTHER_MEMBERS): Define.
8914         (remove_dir): Define the `status' member manually after each
8915         call to AD_push or AD_push_initial.
8916
8917         * src/Makefile.am (check-misc): New rule, to ensure that no more
8918         S_IS* macro definitions sneak into the code.
8919         (check): Depend on check-misc.
8920
8921         * src/remove.c [S_ISLNK]: Don't define.  It's already defined in sys2.h.
8922         * src/du.c (count_entry) [S_ISLNK]: Don't define.
8923         * src/shred.c [S_ISLNK, S_ISFIFO, S_ISSOCK]: Don't define.
8924
8925 2003-01-03  Jim Meyering  <jim@meyering.net>
8926
8927         * src/true.c: Add copyright.
8928         (AUTHORS): I suppose I've written it.
8929
8930         * src/Makefile.am (false.c): Make the generated file be read-only.
8931
8932 2003-01-04  Jim Meyering  <jim@meyering.net>
8933
8934         * src/ls.c: Include "dev-ino.h".
8935         [struct dev_ino]: Remove declaration.
8936
8937 2003-01-02  Jim Meyering  <jim@meyering.net>
8938
8939         * src/cp.c (do_copy): Tweak diagnostic to be consistent with the one
8940         from mv: s/missing file arguments/missing file argument/.
8941         With --target-directory=DIR, cp and mv work with a single file argument.
8942         Reported by Karl Berry.
8943
8944         * tests/rm/isatty: Enable this test.
8945
8946 2002-12-31  Jim Meyering  <jim@meyering.net>
8947
8948         * src/remove.c (AD_push_initial): Don't set status to RM_OK here.
8949         (AD_push): Likewise.
8950         (AD_INIT_OTHER_MEMBERS): Define.
8951         (remove_dir): Define the `status' member manually after each
8952         call to AD_push or AD_push_initial.
8953
8954         * src/ls.c [struct dev_ino]: Remove definition.
8955         Include "dev-ino.h" instead.
8956
8957 2002-12-28  Jim Meyering  <jim@meyering.net>
8958
8959         * tests/du/Makefile.am (TESTS): Add no-deref.
8960         * tests/du/no-deref: New script.
8961
8962 2002-12-23  Jim Meyering  <jim@meyering.net>
8963
8964         * src/remove.c (remove_cwd_entries): Fix typo in comment.
8965
8966 2002-12-21  Jim Meyering  <jim@meyering.net>
8967
8968         * announce-gen: Generate MML-formatted announcement.
8969         This makes it a *lot* harder to send stale MD5/SHA1 signatures.
8970
8971 2002-12-20  Jim Meyering  <jim@meyering.net>
8972
8973         * src/touch.c (touch): Change the wording of a diagnostic so
8974         that it makes sense both when the file exists and when it doesn't.
8975         Suggestion from Michael Stone.
8976
8977 2002-12-18  Jim Meyering  <jim@meyering.net>
8978
8979         * src/stty.c (valid_options): Declare to be static.
8980
8981 2002-12-15  Jim Meyering  <jim@meyering.net>
8982
8983         * Makefile.cfg: Remove rules related to generating m4/jm-glibc-io.m4.
8984
8985         * src/chmod.c, src/copy.c, src/copy.h, src/cp-hash.h, src/csplit.c:
8986         * src/date.c, src/expr.c, src/fmt.c, src/id.c, src/install.c:
8987         * src/ls.c, src/od.c, src/pathchk.c, src/pr.c, src/remove.c:
8988         * src/shred.c, src/sort.c, src/stat.c, src/stty.c, src/sum.c:
8989         * src/tee.c, src/test.c: Remove all uses of `PARAMS'.
8990
8991         * src/remove.c (PARAMS): Remove definition.
8992         * src/sys2.h: Likewise.
8993
8994         * src/ls.c, src/stat.c, src/date.c: Remove declaration of nstrftime.
8995         Include strftime.h instead.
8996
8997 2002-12-14  Jim Meyering  <jim@meyering.net>
8998
8999         * Makefile.cfg ($(url_dir_list)): Use .../coreutils, not .../fetish.
9000
9001         * src/system.h [! HAVE_DECL_MEMRCHR]: Declare memrchr.
9002         This is necessary at least for Irix6.5 when using c89.
9003         Reported by Nelson Beebe.
9004
9005         * tests/misc/Makefile.am (TESTS): Add cat-tty-eof.
9006
9007         * tests/misc/cat-tty-eof: New test.
9008
9009         * src/mknod.c (usage): Specify how major and minor mode numbers
9010         are interpreted.  Report forwarded by Kristin E Thomas.
9011         * src/mknod.c: Remove now-redundant usage-specifying comment.
9012
9013 2002-12-13  Jim Meyering  <jim@meyering.net>
9014
9015         * Version 4.5.4.
9016
9017         * tests/du/trailing-slash: Allow for a directory of size `0'.
9018         That happens at least on file systems of type tmpfs on linux-2.4.18.
9019
9020         * announce-gen: New script to begin replacing the commands
9021         associated with the rule here...
9022         * Makefile.maint (announcement): Invoke announce-gen.
9023         * Makefile.am (EXTRA_DIST): Add announce-gen.
9024
9025         * tests/cp/preserve-2: New file/test, for latest fix.
9026         * tests/cp/Makefile.am (TESTS): Add preserve-2.
9027
9028 2002-12-11  TAKAI Kousuke  <takai@vlsi.kuee.kyoto-u.ac.jp>
9029
9030         Fix a bug whereby cp would fail to parse an option like
9031         --preserve=mode,ownership.
9032         * src/cp.c (decode_preserve_arg): Advance `comma' to
9033         point the character following the comma.
9034
9035 2002-12-11  Jim Meyering  <jim@meyering.net>
9036
9037         * src/pathchk.c (NEED_PATHCONF_WRAPPER): Undefine before defining,
9038         in case it's already defined.
9039
9040 2002-12-09  Jim Meyering  <jim@meyering.net>
9041
9042         * tests/touch/fail-diag: Don't get a test failure if /no exists.
9043         Instead, evoke a framework failure if /no-$$ exists.
9044         Reported by Michael Stone.
9045
9046 2002-12-08  Jim Meyering  <jim@meyering.net>
9047
9048         * src/du.c (lstat) [! LSTAT_FOLLOWS_SLASHED_SYMLINK]:
9049         Define to rpl_lstat, so that even on systems like Solaris 5.8,
9050         du honors (per POSIX) the trailing slash on an argument referring
9051         to a symlink-to-directory.
9052
9053 2002-12-06  Jim Meyering  <jim@meyering.net>
9054
9055         * Use autoconf-2.57.  Regenerate dependent files.
9056         * Use automake-1.7.2.  Regenerate dependent files.
9057
9058         * src/ls.c (gobble_file): Also stat the file if it's a
9059         regular file and --indicator-style=classify (aka -F).
9060         Thanks to Ed Santiago for opening my eyes.
9061
9062         * tests/ls/file-type: New file.  Test for the above.
9063         A test to contrast ls -F and ls --indicator-style=file-type.
9064         * tests/ls/Makefile.am (TESTS): Add file-type.
9065
9066 2002-12-04  Jim Meyering  <jim@meyering.net>
9067
9068         * tests/ls/follow-slink: Make sure the symlink was created.
9069         Richard Dawe reported that `ln -s link link' succeeds, but creates
9070         no file on systems running some version of the DJGPP libc.
9071
9072 2002-12-03  Jim Meyering  <jim@meyering.net>
9073
9074         * src/Makefile.am (AUTOMAKE_OPTIONS): Remove definition (to ansi2knr)
9075         since this package no longer panders to K&R compilers.
9076
9077 2002-12-02  Jim Meyering  <jim@meyering.net>
9078
9079         * tests/du/slink: Skip this test if `.' is on a non-local file system.
9080
9081         * tests/Fetish.pm (_at_replace): Do the substitution only if there's
9082         something to replace.
9083
9084 2002-12-01  Jim Meyering  <jim@meyering.net>
9085
9086         * src/stat.c: Don't include <string.h> or <ctype.h>.
9087         That's already done via system.h.
9088         * src/dircolors.c: Don't include <ctype.h>.
9089
9090 2002-11-30  Jim Meyering  <jim@meyering.net>
9091
9092         * ls.c (gobble_file): Remove the block of code that caused
9093         `ls --color -F symlink-to-dir' to list the files in
9094         `symlink-to-dir/.'.  Now, it prints `symlink-to-dir@', (just
9095         like `ls -F symlink-to-dir') but with the addition of highlighting.
9096         Similarly, `ls --color -dF symlink-to-dir' would print
9097         `symlink-to-dir/';  now it prints `symlink-to-dir@'.
9098         Reported by Jeff Sheinberg as Debian bug #168203.
9099         * tests/ls-2/tests (sl-F-color, sl-dF-color): New tests for the above.
9100
9101         ls is now more efficient: with certain options, it no longer needs
9102         to stat each directory entry on systems with valid dirent.d_type.
9103         * src/ls.c (print_dir): Add DT_LNK and DT_REG.
9104         (main): Make --recursive set format_needs_type, not format_needs_stat.
9105         (gobble_file): Remove a FIXME comment, now that it's fixed.
9106
9107 2002-11-24  Jim Meyering  <jim@meyering.net>
9108
9109         * src/du.c (du_files): Don't strip any trailing slash.
9110         Rewrite so that `/' is no longer represented internally as
9111         the empty string.
9112         (count_entry): When appending a file name component,
9113         account for the fact that the current path may end in `/'.
9114         François Pinard reported that `du symlink-to-dir/' was not
9115         equivalent to `du symlink-to-dir/.'.  Now it is.
9116         * tests/du/trailing-slash: New file/test, for the above fix.
9117         * tests/du/Makefile.am (TESTS): Add trailing-slash.
9118
9119 2002-11-23  Jim Meyering  <jim@meyering.net>
9120
9121         * src/tac.c (output): Declare some local variables to be of type size_t,
9122         rather than `int' to avoid warnings from gcc.
9123
9124 2002-11-21  Paul Eggert  <eggert@twinsun.com>
9125
9126         * src/ls.c (decode_switches): Use case-sensitive matching to
9127         decode the QUOTING_STYLE environment variable.  This is more
9128         consistent with the documentation, and with --quoting-style.
9129
9130 2002-11-21  Martin Buck  <martin.buck@ascom.ch
9131
9132         * src/stty.c (struct speeds): Add support for all baud rates defined
9133         in linux-2.4.19.
9134
9135 2002-11-19  Jim Meyering  <jim@meyering.net>
9136
9137         * tests/sum/sysv: Export LC_ALL=C, to avoid failure when
9138         run in a UTF locale.  Report and suggested fix by Bruno Haible.
9139         * tests/fmt/basic: Likewise.
9140
9141 2002-11-17  Jim Meyering  <jim@meyering.net>
9142
9143         * configure.ac: Update via autoupdate.
9144         Add `AM_GNU_GETTEXT_VERSION(0.11.5)'.
9145
9146         * src/mv.c (movefile): Don't remove trailing slashes from SOURCE.
9147         Reported by Hans Ginzel.
9148
9149 2002-11-15  Jim Meyering  <jim@meyering.net>
9150
9151         * Makefile.cfg (gnu_rel_host): Define.
9152         (url_dir_list): Choose from (alpha|ftp).gnu.org depending
9153         on whether $(VERSION) looks like a major release number.
9154
9155         * Makefile.maint (mail_gpg_sign_cookie): Backslash-escape `#'.
9156         (release): Rename from `alpha'.
9157         (alpha): Depend on release.
9158
9159         * Makefile.maint (signatures): Define with ?=, so it's easy to override.
9160
9161 2002-11-14  Jim Meyering  <jim@meyering.net>
9162
9163         * Makefile.maint (mail_gpg_sign_cookie): Make optional.
9164         (announcement): Use the new variable.
9165
9166         * Makefile.maint: Sync with Bison, i.e.:
9167         (po-check): Scan .l and .y files instead of the
9168         .c and the .h files that they generate.  This fixes the bug
9169         reported by Tim Van Holder in:
9170         <http://mail.gnu.org/pipermail/bison-patches/2002-November/001352.html>
9171         Look for N_ as well as for _.  Try to avoid matching #define for
9172         N_ and _.
9173         From Paul Eggert.
9174
9175 2002-11-12  Jim Meyering  <jim@meyering.net>
9176
9177         * src/ls.c (HAVE_SYMLINKS): Remove unnecessary macro definition.
9178         Replace sole use with equivalent `#ifdef S_ISLNK'.
9179         Inconsistency reported by Dmitry V. Levin.
9180
9181 2002-11-11  Jim Meyering  <jim@meyering.net>
9182
9183         * src/stat.c (usage): Transform --help items output via s/ - /   /,
9184         so that help2man produces properly formatted man pages.
9185         Reported by Herbert Xu as Debian bug #168400.
9186
9187 2002-11-10  Jim Meyering  <jim@meyering.net>
9188
9189         * src/ls.c (sighandler): Handle SIGTSTP specially.
9190         Based on suggestions from Solar Designer and Dmitry V. Levin.
9191         Add comments.
9192
9193         * Makefile.cfg (cvs_files): Define.  From autoconf.
9194         (local_updates): Likewise.
9195
9196         * src/ls.c (restore_default_color_handler, sigtstp_handler):
9197         Remove functions.
9198         (sighandler): New function, based on the one in sort.c.
9199         (main): Use sigaction, if possible; otherwise signal.
9200         Handle these signals:
9201         SIGHUP, SIGINT, SIGPIPE, SIGQUIT, SIGTERM, SIGTSTP.
9202         Don't register our handler if the signal is already being ignored.
9203
9204         * src/dd.c (interrupt_handler): Use raise, rather than kill+getpid.
9205         * src/csplit.c (interrupt_handler): Likewise.
9206         * src/sort.c (sighandler): Likewise.
9207         (main): Declare `i' and `nsigs' to be unsigned, not int.
9208
9209 2002-11-09  Jim Meyering  <jim@meyering.net>
9210
9211         ls --color: restore terminal text color upon signal.
9212         * src/ls.c: Include "full-write.h" and <signal.h>.
9213         (restore_default_color, restore_default_color_handler): New functions.
9214         (sigtstp_handler, put_indicator_direct): New functions.
9215         (main) [print_with_color]: Register signal handlers.
9216         Patch mostly by Solar Designer and Stanislav Ievlev.
9217
9218         Update from autoconf.
9219         * Makefile.maint (AMTAR): Remove definition.
9220         (update, cvs-update, po-update, do-po-update): New rules.
9221         (wget-update): Update (thus renaming to cvs-update).
9222         (automake_repo): Use anoncvs@sources.redhat.com.
9223
9224 2002-11-06  Jim Meyering  <jim@meyering.net>
9225
9226         * tests/misc/Makefile.am (TESTS): Add printf-hex.
9227
9228         * tests/misc/printf: Be careful to test the code in this package,
9229         not the shell built-in function.
9230
9231         * src/printf.c (print_esc): A hexadecimal escape sequence has
9232         at most two hex. digits, not three.  Reported by Padraig Brady.
9233         (usage): Update description.
9234         * tests/misc/printf-hex: New file/test, for the above fix.
9235
9236 2002-10-07  Paul Eggert  <eggert@twinsun.com>
9237
9238         Add support for locale-specific size indications (e.g.,
9239         thousands-separators) and for explicit size suffixes on output.
9240
9241         * doc/coreutils.texi (Block size): Say that:
9242         This affects display format as well as block size.
9243         Fractional block counts are rounded up.
9244         ls file size blocksize defaults to 1.
9245         A block size spec preceded by ' generates thousands separators.
9246         A suffix without a preceding integer generates suffixes.
9247         (tail invocation): 32k -> 32 KiB.
9248         (What information is listed): ls -h is now equivalent to
9249         ls --block-size=human, and ls -H is now equivalent to
9250         ls --block-size=si.  Displayed file size is now always affected by
9251         --block-size.
9252
9253         * lib/inttostr.c, lib/inttostr.h, lib/imaxtostr.c, lib/offtostr.c,
9254         lib/umaxtostr.c: New files, taken from GNU tar.
9255
9256         * lib/Makefile.am (libfetish_a_SOURCES): Add imaxtostr.c, offtostr.c,
9257         umaxtostr.c.
9258         (EXTRA_DIST): Add inttostr.c.
9259
9260         * lib/human.c, lib/human.h: Rewrite to support locale-specific
9261         notations like thousands separators.
9262         Specify what includer of include.h must include beforehand.
9263         (human_group_digits, human_suppress_point_zero, human_autoscale,
9264         human_base_1024, human_SI, human_B): New enum values.
9265         (human_readable): Rename from human_readable_inexact; put the
9266         options before the sizes.  All uses changed.  The old human_readable
9267         function has been removed; use inttostr.h instead.
9268         (human_options): Renamed from human_block_size, with new signature
9269         that allows block sizes up to UINTMAX_MAX.  All callers changed.
9270
9271         * m4/prereq.m4 (jm_PREREQ_HUMAN): Check for locale.h, localeconv,
9272         AC_HEADER_STDBOOL.  No need to check for limits.h since it's in
9273         freestanding C89.  No need to check for stdlib.h or string.h since
9274         autoconf does this now.
9275
9276         * src/cksum.c (cksum): Use primitives from inttostr.h, not
9277         human.h, to print large numbers simply.
9278         * src/csplit.c (handle_line_error, parse_patterns): Likewise.
9279         * src/dd.c (print_stats, main): Likewise.
9280         * src/df.c (print_header): Likewise.
9281         * src/factor.c (print_factors): Likewise.
9282         * src/ls.c (print_long_format, print_file_name_and_frills): Likewise.
9283         * src/shred.c (dopass): Likewise.
9284         * src/sort.c (checkfp): Likewise.
9285         * src/sum.c (bsd_sum_file, sysv_sym_file): Likewise.
9286         * src/tail.c (xlseek): Likewise.
9287         * src/wc.c (write_counts, wc): Likewise.
9288
9289         * src/df.c (human_output_opts): New var.
9290         (output_block_size): Now uintmax_t, not int, to handle larger
9291         block sizes.  All uses changed.
9292         * src/du.c: Likewise.
9293         * src/ls.c: Likewise.
9294
9295         * src/df.c (print_header): In the header line, prefer SI to human
9296         representation if it's shorter; if neither is shorter, try to
9297         intuit what the user would prefer.
9298
9299         * src/expr.c (inttostr): Remove; use new imaxtostr library
9300         function instead.
9301
9302         * src/ls.c (file_output_block_size): New var, to distinguish
9303         file sizes from other sizes.
9304         (decode_switches): Set it.
9305
9306         * src/shred.c (OUTPUT_BLOCK_SIZE): remove.
9307         (dopass): When printing progress, use floor for what has been done
9308         so far (since we should be conservative there), and ceiling for
9309         what needs to be done (since that's what other programs use).
9310
9311 2002-10-19  Jim Meyering  <jim@meyering.net>
9312
9313         * src/pinky.c (print_heading): Align TTY and Name headings.
9314         Reported by Karl Eichwalder.
9315
9316 2002-10-18  Jim Meyering  <jim@meyering.net>
9317
9318         * src/split.c (cwrite): Change type of `bytes' parameter to size_t
9319         Remove now-useless cast.
9320         (stdread): Remove function.
9321         (bytes_split): Use size_t instead of int.
9322         Use safe_read, not stdread.
9323         (lines_split): Likewise.
9324         Use memchr rather than a `while' loop.
9325         (line_bytes_split): Use size_t instead of int.
9326         Use safe_read, not stdread.
9327         (main): Add some FIXME comments to remind me to remove casts.
9328
9329         * src/system.h (ST_BLKSIZE): Correct comment describing how to
9330         reproduce HPUX-11 cat failure.  From Petter Reinholdtsen.
9331
9332 2002-10-17  Jim Meyering  <jim@meyering.net>
9333
9334         Fix a problem that could make e.g., `cat' misbehave on systems which
9335         give invalid (unreasonably large) values for stat.st_blksize.
9336         * src/system.h (ST_BLKSIZE): Ensure that the result is in [1..4MB].
9337         Reported by Petter Reinholdtsen.
9338
9339 2002-10-14  Jim Meyering  <jim@meyering.net>
9340
9341         Specifying a printf conversion specifer as nl's separator string
9342         could cause nl to segfault.
9343         * src/nl.c (build_print_fmt): Don't include separator string
9344         in the printf format; it might contain `%'.
9345         Use a better bound on the length of the print_fmt buffer.
9346         (print_lineno): Print the separator here instead.
9347         Reported by Doug Coleman.
9348
9349         * tests/misc/nl: New file/tests, including a test for the above.
9350         * tests/misc/Makefile.am (TESTS): Add nl.
9351
9352         * tests/misc/split-l: New test, to make sure `split --lines=N' works.
9353         * tests/misc/Makefile.am (TESTS): Add split-l.
9354
9355 2002-10-13  Jim Meyering  <jim@meyering.net>
9356
9357         * Version 4.5.3.
9358
9359         * src/du.c (usage): Tweak description of --dereference-args/-D.
9360
9361         * src/du.c (count_entry): Also save cwd when dereferencing (via
9362         --dereference-args, -D) a command-line argument.
9363         Reported by Michal Svec.  Based on a patch by Andreas Schwab.
9364
9365         * src/Makefile.am (../AUTHORS): New target/rule.
9366
9367 2002-10-12  Jim Meyering  <jim@meyering.net>
9368
9369         * src/paste.c (paste_parallel): Declare local, `delims_saved', to be
9370         of type size_t, since that's the way it's used and avoids a warning.
9371
9372         * src/csplit.c (struct cstring) [len]: Declare to be unsigned int,
9373         since that's how it's always used and avoids a new warning from gcc.
9374         (read_input): Adapt to new safe_read ABI.
9375
9376         * src/cut.c (cut_fields): Add a temporary size_t variable, n_bytes,
9377         to avoid warnings.
9378
9379         * src/pinky.c (print_long_entry): fread returns size_t.
9380         Declare local `bytes' accordingly, to avoid warning.
9381
9382         tail -c +N would perform an extra read after encountering EOF
9383         [this change is analogous (bytes vs. lines) to the one of 2002-01-27]
9384         * src/tail.c (start_bytes): Detect EOF, inform caller.
9385         (tail_bytes): Upon EOF in start_bytes, return immediately.
9386         (file_lines): Reorganize to use memrchr rather than an explicit loop.
9387         Adapt to new safe_read ABI.
9388
9389 2002-10-11  Jim Meyering  <jim@meyering.net>
9390
9391         * tests/du/deref: New file/test, for the above fix.
9392         * tests/du/Makefile.am (TESTS): Add deref.
9393
9394 2002-10-10  Jim Meyering  <jim@meyering.net>
9395
9396         * tests/ln/Makefile.am (TESTS): Add target-1.
9397         * tests/ln/target-1: New file/test, for the fix on 2002-10-08.
9398
9399 2002-10-09  Jim Meyering  <jim@meyering.net>
9400
9401         * tests/cp/backup-is-src: Ensure that certain environment variables
9402         are not set (e.g., SIMPLE_BACKUP_SUFFIX).  Reported by Duncan Roe.
9403
9404         * tests/tail-2/big-4gb: Mark this as an expensive test; it would
9405         consume 4GB of disk space on systems without support for sparse files.
9406         Fix a logic error that'd make it `cat err' even though dd didn't fail.
9407
9408         * src/dircolors.hin (.jar): Fix typo: s/;3$/;31/.
9409         Patch by steven@magelico.net, forwarded by Michael Stone.
9410
9411         * tests/ls/dired: Ensure that ls produces English messages.
9412         Patch by Alexey Vyskubov, forwarded by Michael Stone.
9413
9414 2002-10-08  Dmitry V. Levin  <ldv@altlinux.org>
9415
9416         * src/ln.c (main): Fix target_directory parsing when n_files == 1.
9417
9418 2002-10-08  Jim Meyering  <jim@meyering.net>
9419
9420         * tests/tail-2/big-4gb: Use double quotes around diagnostic.
9421         Fix syntax in test: use =, not ==.
9422         Reported by Bob Proulx.
9423         Change all the rest like this: grep -lR "testing framework'" .\
9424         |xargs perl -pi -e 's/'\''(\$0: failure in testing framework)'\''/"$1"/'
9425
9426         * src/sum.c (sysv_sum_file): Adapt to new safe_read ABI.
9427         * src/tr.c (squeeze_filter, read_and_delete, read_and_xlate): Likewise.
9428         * src/tac.c (save_stdin, tac_stdin_to_mem): Likewise.
9429         * src/wc.c (wc): Likewise.
9430
9431 2002-10-07  Paul Eggert  <eggert@twinsun.com>
9432
9433         * src/cat.c (cat):
9434         Don't advance the write pointer past the end of the write buffer.
9435         * src/sort.c (begfield, limfield): Likewise.
9436
9437 2002-10-07  Jim Meyering  <jim@meyering.net>
9438
9439         * src/cat.c (simple_cat, cat): Adapt to new safe_read ABI.
9440         * src/head.c (head_bytes, head_lines): Likewise.
9441
9442 2002-10-06  Jim Meyering  <jim@meyering.net>
9443
9444         * src/dd.c (scanargs): Ensure that specified block sizes (specified
9445         via ibs=N, obs=N, and bs=N) are no larger than SSIZE_MAX.
9446         (skip, dd_copy): Adapt to new safe_read ABI.
9447
9448         * Makefile.maint (signatures): Define.
9449         (%.sig): New rule.
9450         (announcement): Depend on $(signatures).
9451
9452         * Makefile.maint (announcement): Output all URLs for detached
9453         signatures, not just the last one from the previous loop.
9454
9455 2002-10-05  Jim Meyering  <jim@meyering.net>
9456
9457         * Version 4.5.2.
9458
9459         * src/remove.c (remove_entry) [ROOT_CAN_UNLINK_DIRS]: With `rm -i DIR',
9460         don't recurse into directory, DIR.  Prompted by a report from
9461         Leonardo Milano.
9462
9463         * tests/rm/i-no-r: New file/test, for the above fix.
9464         * tests/rm/Makefile.am (TESTS): Add i-no-r.
9465
9466         * tests/tail-2/big-4gb: New file/test, for the fix of 2002-09-27.
9467         * tests/tail-2/Makefile.am (TESTS): Add big-4gb.
9468
9469 2002-10-03  Jim Meyering  <jim@meyering.net>
9470
9471         * src/rm.c (AUTHORS): Mark translatable string with `N_ (...)'.
9472         * src/df.c (AUTHORS): Likewise.
9473         * src/du.c (AUTHORS): Likewise.
9474         * src/tail.c (AUTHORS): Likewise.
9475         * src/touch.c (AUTHORS): Likewise.
9476
9477 2002-10-02  Jim Meyering  <jim@meyering.net>
9478
9479         * Makefile.am (SUBDIRS): Remove `old'.
9480         (EXTRA_DIST): List the files in old/.
9481         * configure.ac (AC_CONFIG_FILES): Remove old/* names.
9482         Suggestion from Akim Demaille.
9483
9484 2002-10-01  Jim Meyering  <jim@meyering.net>
9485
9486         * src/sys2.h (SSIZE_MAX): Define.
9487
9488 2002-09-30  Jim Meyering  <jim@meyering.net>
9489
9490         * src/csplit.c: Don't include stdlib.h here.  It's already included
9491         via system.h.
9492
9493 2002-09-29  Jim Meyering  <jim@meyering.net>
9494
9495         * src/tr.c (find_bracketed_repeat): Rearrange pointer/integer
9496         expression to avoid bogus warning from gcc.
9497
9498         * src/cat.c (simple_cat): Use a temporary to avoid bogus warnings.
9499         (cat): Declare insize and outsize to be of type size_t, not int.
9500         Rearrange pointer/integer expressions to avoid bogus warnings.
9501         (main): Declare insize and outsize to be of type size_t, not int.
9502
9503         * src/tail.c (parse_options): Give a sensible diagnostic for
9504         an invalid byte or line count.  Reported by Mikko Tuumanen.
9505
9506         * src/touch.c (main): Split a long line.
9507
9508         * tests/du/Makefile.am (TESTS): Add slink.
9509         * tests/du/slink: New test for system.h change of 2002-08-31.
9510
9511         In move mode, always first try to rename.  Before, upon failure to
9512         rename a directory, this code would never attempt to rename any
9513         other file in that directory, but would thenceforth always copy.
9514         On some systems (e.g., NetApp's OnTap-6.4), renaming a directory
9515         may fail with EXDEV, yet renaming files within that directory to
9516         a newly-created destination directory succeeds.
9517         * src/copy.c (copy_internal): Remove local, move_mode;
9518         use x->move_mode instead.  Based on a patch from Tom Haynes.
9519
9520 2002-09-28  Jim Meyering  <jim@meyering.net>
9521
9522         * src/split.c (FAIL_ONLY_ONE_WAY): New macro.
9523         Factor out some duplication.
9524         (main): Use it.
9525         [case 'a']: Use strtoul rather than strtol to avoid compiler warnings.
9526
9527         * src/sort.c (begfield, limfield): Rearrange comparisons to avoid
9528         compiler warnings.
9529         (fillbuf, keycompare): Cast literal `-1' to size_t in comparisons,
9530         to avoid compiler warnings.
9531
9532         * src/shred.c (dopass): Use a uintmax_t temporary to avoid bogus
9533         compiler warnings.
9534
9535         Fix things so `mkdir -p' can create very deep directories, e.g.,
9536         mkdir -p $(perl -e 'print "a/" x 40000') now works.
9537         * src/mkdir.c (main): For --parents (-p), call make_path with the
9538         entire directory name, so we don't ever require that file operations
9539         like stat or chmod be performed on the entire command line argument.
9540         * makepath.c (make_path): Restore umask *before* creating the final
9541         component.
9542
9543 2002-09-27  Andreas Schwab  <schwab@suse.de>
9544
9545         * src/tail.c (tail_bytes): Change type of bytes_remaining to off_t
9546         to avoid overflow.  Reported by Hans Lermen.
9547
9548 2002-09-26  Jim Meyering  <jim@meyering.net>
9549
9550         * src/install.c (get_ids): Use strtoul, not strtol.  Remove some casts.
9551
9552 2002-09-25  Jim Meyering  <jim@meyering.net>
9553
9554         * src/test.c (eaccess): Change type of local `euid' from int to uid_t
9555         and add a cast, to avoid a warning about `signed and unsigned type in
9556         conditional expression'.
9557
9558 2002-09-22  Jim Meyering  <jim@meyering.net>
9559
9560         * src/rmdir.c: Include "dirname.h", for declaration of
9561         strip_trailing_slashes.
9562
9563         * src/stat.c (PRIdMAX, PRIuMAX): Remove definitions.
9564         Now they're defined through system.h.
9565
9566         * src/cp-hash.c, src/dd.c, src/df.c, src/du.c, src/ls.c,
9567         * src/stat.c, src/wc.c: Remove all inclusions of inttypes.h,
9568         since it's already included from sys2.h via system.h.
9569
9570         * Use automake-1.6f.  Regenerate dependent files.
9571
9572         * src/Makefile.am (PERL): Remove duplicate definition.
9573
9574         fmt's -s, -t, -c options didn't work properly for long lines.
9575         Since get_line may end up calling put_paragraph (for long lines),
9576         be sure to set global, `other_indent', before it is used there.
9577
9578         * src/fmt.c (set_other_indent): New function, factored out of...
9579         (get_paragraph): ... here.  Call it.
9580         (get_line): Call set_other_indent before calling flush_paragraph,
9581         which calls fmt_paragraph, which in turn calls put_paragraph,
9582         which uses other_indent.
9583
9584         * tests/fmt/Makefile.am (TESTS): Add long-line.
9585         * tests/fmt/long-line: New file/test, for the above fix.
9586
9587 2002-09-21  Jim Meyering  <jim@meyering.net>
9588
9589         * src/od.c: No longer include deprecated <values.h>.
9590         It was required solely for now-removed reference to BITSPERBYTE.
9591         * src/install.c: Likewise.
9592         Suggestion from Bruno Haible.
9593
9594 2002-09-06  Andreas Schwab  <schwab@suse.de>
9595
9596         `rmdir -p dir-specified-with-trailing-slash/' would fail.
9597         * src/rmdir.c (remove_parents): Strip trailing slashes.
9598
9599 2002-09-20  Jim Meyering  <jim@meyering.net>
9600
9601         * tests/rmdir/t-slash: New file/test, for the above fix.
9602         * tests/rmdir/Makefile.am (TESTS): Add t-slash.
9603
9604         * Makefile.maint (announcement): Arrange to gpg-sign the message.
9605         Add a URL for each detached signature file.
9606
9607 2002-09-07  Bruno Haible  <bruno@clisp.org>
9608
9609         * configure.ac: Add need-ngettext to AM_GNU_GETTEXT invocation.
9610
9611 2002-09-18  Jim Meyering  <jim@meyering.net>
9612
9613         `od -t x8' used the wrong (`l'-prefixed) printf format.
9614         Likewise for the o8 and u8 formats.
9615         * src/od.c (ISPEC_TO_FORMAT): Define macro.
9616         (decode_one_format): Use PRIdMAX, PRIoMAX, etc. for LONG_LONG.
9617         Reported by Arun Sharma.
9618
9619 2002-09-17  Jim Meyering  <jim@meyering.net>
9620
9621         * src/sys2.h (PRIdMAX, PRIoMAX, PRIuMAX, PRIxMAX): Define if necessary.
9622         From gettext's intl/loadmsgcat.c.
9623
9624         * tests/od/x8: New file/test, for the above fix.
9625         * tests/od/Makefile.am (TESTS): Add x8.
9626
9627 2002-09-15  Jim Meyering  <jim@meyering.net>
9628
9629         * Use autoconf-2.54.  Regenerate dependent files.
9630
9631         * src/csplit.c (get_format_width): Add cast to avoid
9632         warning about `signed and unsigned type in conditional expression'.
9633
9634 2002-09-14  Jim Meyering  <jim@meyering.net>
9635
9636         * src/who.c (print_user): Change type of local to size_t
9637         to avoid warnings about `comparison between signed and unsigned'.
9638         * src/ptx.c (generate_all_output): Likewise.
9639
9640         * src/dd.c (main, skip): Add casts to avoid warnings about
9641         `comparison between signed and unsigned'.
9642
9643         * src/id.c (print_full_info, print_group_list): Add casts to avoid
9644         warnings about `signed and unsigned type in conditional expression'.
9645
9646         * src/md5sum.c: Change type of global, digest_hex_bytes, to size_t
9647         to avoid warnings about `comparison between signed and unsigned'.
9648         (split_3): Change parameter names to be readable and add comment.
9649         Clean up the test for whether a line may be ignored.
9650
9651 2002-09-13  Jim Meyering  <jim@meyering.net>
9652
9653         * src/printf.c (main): Handle leading command line argument of `--'.
9654         Reported by Raul: DervishD <raul@pleyades.net>
9655         * tests/misc/printf: New file: test for the above.
9656         * tests/misc/Makefile.am (TESTS): Add printf.
9657
9658         * src/date.c (usage): Explain that %S's range of [0..60] is required --
9659         rather than 0..59 -- to accommodate the occasional positive leap second.
9660         Reported by Richard Neill.
9661
9662 2002-09-12  Jim Meyering  <jim@meyering.net>
9663
9664         * src/Makefile.am (nanosec_libs): Define.
9665         (sleep_LDADD, tail_LDADD): Use it here.
9666
9667         Factor nanosleep-related code into ../lib/xnanosleep.c.
9668         * src/sleep.c: Include xnanosleep.h.
9669         Factor out fenv.h-related code.
9670         (timespec_subtract): Remove function.
9671         (main): Remove code that deals with computing start and stop times
9672         as well as the loop around nanosleep.  Now that's in xnanosleep.c.
9673
9674         Allow S (in --sleep-interval=S) to be a floating point value.
9675         * src/tail.c: Include xnanosleep.h and xstrtod.h.
9676         Move declaration of global variable, sleep_interval, to ...
9677         (main): ...here.
9678         (usage): Update description of --sleep-interval option.
9679         (tail_forever): New parameter, sleep_interval.  Update caller.
9680         Use xnanosleep, rather than sleep.
9681         (parse_options): New parameter, sleep_interval.  Update caller.
9682         Use xstrtod, now that we accept floating point values.
9683         Prompted by a patch from Augey Mikus.
9684
9685 2002-09-06  Jim Meyering  <jim@meyering.net>
9686
9687         * src/remove.c (prompt): Change comment to give a better note to
9688         translators.  From Michael Piefel.
9689
9690 2002-09-02  Jim Meyering  <jim@meyering.net>
9691
9692         * README: A good problem report/patch includes diffs against
9693         the most recent test release.
9694
9695         * src/pathchk.c (NEED_PATHCONF_WRAPPER): Define.
9696         (pathconf_wrapper): Define only if NEED_PATHCONF_WRAPPER is set.
9697
9698         * src/kill.c (print_table_row): Use an unsigned type for widths
9699         to avoid warning about comparison between signed and unsigned.
9700         (list_signals): Likewise.
9701
9702         * src/od.c (skip): Add a cast to avoid warning about comparison
9703         between signed and unsigned.
9704         * src/install.c (get_ids): Likewise.  Also rearrange range-checking
9705         comparisons to make them more readable.
9706
9707 2002-09-01  Jim Meyering  <jim@meyering.net>
9708
9709         * Version 4.5.1.
9710
9711 2002-08-31  Jim Meyering  <jim@meyering.net>
9712
9713         Symlinks were always reported as using 0 blocks.
9714         * src/system.h (ST_NBLOCKS): Don't depend on file type.
9715         This reverts the change of 2000-01-30.
9716         Based on a report and patch from Neil Brown via Michael Stone.
9717         This fixes Debian Bug#156358.
9718
9719         * Most files: Change `exit (0)' to `exit (EXIT_SUCCESS)',
9720         `exit (1)' to `exit (EXIT_FAILURE)', and
9721         `usage (1)' to `usage (EXIT_FAILURE)'.
9722
9723         * chgrp.c, chmod.c, chown.c, chroot.c, cp.c, date.c, dd.c, du.c,
9724         * hostname.c, id.c, install.c, ln.c, mkdir.c, mkfifo.c, mknod.c,
9725         * nice.c, pinky.c, printf.c, pwd.c, shred.c, sleep.c, stty.c,
9726         * su.c, tac-pipe.c, tail.c, tee.c, touch.c, uname.c, uptime.c,
9727         * users.c, who.c: Change `error (1, ...' to `error (EXIT_FAILURE, ...'.
9728         But don't change `error (0, ...' to `error (EXIT_SUCCESS, ...', since
9729         error never exits successfully.
9730
9731 2002-08-29  Jim Meyering  <jim@meyering.net>
9732
9733         * src/remove.c (remove_cwd_entries): Use closedir (not CLOSEDIR)
9734         when ignoring any return value.
9735
9736         * src/remove.c (remove_cwd_entries): Detect and diagnose readdir
9737         failures.  On some systems (at least EMC Celerra and Solaris5.8),
9738         this appears to be necessary.
9739         (is_empty_dir): Likewise.  Also, always close directory handle.
9740         * src/ls.c (print_dir): Likewise.
9741         (print_dir): Rename local variable: reading -> dirp.
9742         Reported by Mike Coleman.
9743
9744 2002-08-28  Jim Meyering  <jim@meyering.net>
9745
9746         * src/remove.c (remove_cwd_entries): Use CLOSEDIR, not closedir.
9747         Give a diagnostic and fail if closedir fails.
9748
9749 2002-08-26  Jim Meyering  <jim@meyering.net>
9750
9751         * Makefile.am (THANKS-to-translators): New rule.
9752         (EXTRA_DIST): Add both THANKS-to-translators and THANKStt.in.
9753         * THANKStt.in: New file.
9754
9755         * src/cat.c (close_stdout_wrapper): New, kludgey, function and
9756         file-scoped global.
9757         (main): Register it with atexit.
9758         Close STDOUT_FILENO, to avoid a problem when writing to
9759         /dev/audio on at least Solaris 5.7 and 5.8 systems.
9760         Reported by Shing-Shong Shei.
9761
9762 2002-08-25  Jim Meyering  <jim@meyering.net>
9763
9764         * src/cat.c (main): Close STDIN_FILENO rather than a literal `0'.
9765         * src/tac.c (main): Likewise.
9766         * src/tail.c (main): Likewise.
9767         * src/tee.c (main): Likewise.
9768         * src/tr.c (main): Likewise.
9769         * src/wc.c (main): Likewise.
9770
9771 2002-08-20  Jim Meyering  <jim@meyering.net>
9772
9773         * tests/mv/setup: Rewrite not to use `: ${VAR=not_set}' paradigm.
9774
9775 2002-08-10  Paul Eggert  <eggert@twinsun.com>
9776
9777         * src/nohup.sh: Don't use "exec --"; it's not portable and
9778         shouldn't be needed.
9779
9780 2002-08-09  Jim Meyering  <jim@meyering.net>
9781
9782         * src/pr.c (main): Don't ignore -COLUMN if it's the last option.
9783         (usage): Clarify help text for the -COLUMN option.
9784         Patch by Padraig Brady.
9785         * tests/pr/Test.pm [col-last]: New test for the above.
9786
9787         * configure.ac: Start with version 4.5.1, chosen so that it's larger
9788         than the latest version numbers of the component packages.
9789
9790         * man/Makefile.am (check-x-vs-1): Set and export PATH so we use
9791         programs in ../src.
9792
9793 2002-08-08  Jim Meyering  <jim@meyering.net>
9794
9795         * src/date.c: Guard inclusion of <langinfo.h> with
9796         `#if HAVE_LANGINFO_CODESET', not `#if HAVE_LANGINFO_H'.
9797         * src/sort.c: Likewise.
9798         Patch by GOTO Masanori.
9799
9800 2002-08-05  Paul Eggert  <eggert@twinsun.com>
9801
9802         Fix some minor time-related bugs with POSIX time arguments.
9803         Some valid time stamps were being rejected (notably -1, and
9804         time stamps before 1900 on 64-bit hosts).  And some invalid
9805         time stamps were being accepted, e.g. September 31.
9806
9807         * src/date.c (main): Adjust to posixtime signature change.
9808         * src/touch.c (main): Likewise.  Remove unnecessary initialization.
9809         Use localtime, not posixtm, to warn about obsolete "touch".
9810
9811 2002-08-05  Jim Meyering  <jim@meyering.net>
9812
9813         * tests/misc/Makefile.am (TESTS): Add nice and pathchk1.
9814
9815 2002-08-04  Jim Meyering  <jim@meyering.net>
9816
9817         * src/Makefile.am (check-README): New target/rule.
9818         (check): Depend on it.
9819
9820         * configure.ac (AC_CONFIG_FILES): Add old/Makefile and old/*/Makefile.
9821
9822 2002-08-03  Jim Meyering  <jim@meyering.net>
9823
9824         * Makefile.am (SUBDIRS): Add old.
9825         * old/: New directory, containing legacy ChangeLog* and NEWS files
9826         from the fileutils, sh-utils, and textutils packages.
9827
9828         * src/Makefile.am (AM_INSTALLCHECK_STD_OPTIONS_EXEMPT): Set to false.
9829
9830 2002-08-02  Paul Eggert  <eggert@twinsun.com>
9831
9832         * NEWS, doc/coreutils.texi: uniq now obeys LC_COLLATE.
9833
9834         * src/uniq.c: Include hard-locale.h, xmemcoll.h.
9835         (hard_LC_COLLATE): New var.
9836         (different): Args are now char *, not const char *.
9837         Use xmemcoll instead of memcmp to compare lines, so that
9838         LC_COLLATE has effect.  However, use memcmp if it is an
9839         easy locale.
9840         (check_file): Do not include newline in comparison, so that
9841         xmemcoll has a byte to stomp on temporarily.
9842         (main): Set hard_LC_COLLATE.
9843
9844 2002-07-29  Jim Meyering  <jim@meyering.net>
9845
9846         * Makefile.am (SUBDIRS): Remove djgpp, for now.
9847
9848 2002-07-20  Jim Meyering  <jim@meyering.net>
9849
9850         * Makefile.am (false.c): Convert only the final EXIT_SUCCESS
9851         into EXIT_FAILURE.  Otherwise, false --help and false --version
9852         would fail.
9853
9854 2002-07-08  Jim Meyering  <jim@meyering.net>
9855
9856         * src/Makefile.am (uninstall-local): Search for @GNU_PACKAGE@,
9857         rather than the hard-coded `sh-utils'.
9858
9859 2002-07-01  Jim Meyering  <jim@meyering.net>
9860
9861         * configure.ac: Merge the three files from fileutils,
9862         textutils, and sh-utils.
9863         * Makefile.am: Likewise.
9864         * src/Makefile.am: Likewise.