(libcoreutils_a_SOURCES): Add fcntl--.h, stdio--h,
[platform/upstream/coreutils.git] / ChangeLog
1 2005-07-02  Paul Eggert  <eggert@cs.ucla.edu>
2
3         * Version 5.3.1.
4
5         Cleanup to isolate "safer" functions to a small part of the code.
6         * src/comm.c: Include stdio--.h, not stdio-safer.h.
7         (compare_files): Use fopen, not fopen_safer.
8         * src/copy.c: Include fcntl--.h, not unistd-safer.h.
9         (copy_reg): Don't call fd_safer; no longer needed
10         now that we include fcntl--.h.
11         * src/csplit.c: Include fd-reopen.h.
12         Include stdio--.h, not stdio-safer.h.
13         (input_desc): Remove.  All uses changed to STDIN_FILENO.
14         (set_input_file): Reopen stdin, to simplify code.
15         (create_output_file): Use fopen, not fopen_safer.
16         * src/dd.c: Include fd-reopen.h.
17         (open_fd): Remove.  All callers changed to use fd_reopen instead.
18         * src/join.c: Include stdio--.h, not stdio-safer.h.
19         (main): Use fopen, not fopen_safer.
20         * src/md5sum.c: Include stdio--.h.
21         (digest_check): Don't try to read both checksums and data from stdin.
22         * src/nohup.c: Include fd-reopen.h.
23         Include unistd--.h, not unistd-safer.h.
24         (main): Use fd_reopen to simplify code.  When replacing stdin,
25         use "/dev/null" not "/", as that's less likely to go wrong these days.
26         (main): Use dup, not dup_safer.
27         * src/pr.c: Include stdio--.h, not stdio-safer.h.
28         (open_file): Invoke fopen, not fopen_safer.
29         * src/shred.c: Include fcntl--.h, not unistd-safer.h.
30         (wipename, wipe_file): Don't use fd_safer; no longer needed
31         now that we include fcntl--.h.
32         * src/sort.c: Include stdio--.h rather than stdio-safer.h.
33         Include stdlib--.h.  Do not include unistd-safer.h.
34         (create_temp_file): Don't call fd_safer; no longer needed
35         now that we include *--.h files.
36         (xfopen): Don't call fopen_safer, for similar reasons.
37         * src/split.c: Include fcntl--.h rather than unistd-safer.h.
38         Include fd-reopen.h.
39         (input_desc): Remove.  All uses replaced by STDIN_FILENO.
40         (cwrite): Don't call fd_safer; no longer needed now that
41         we include fcntl--.h.
42         (main): Reuse stdin rather than opening a new one.  This
43         saves a file descriptor.
44         * src/stty.c: Include fd-reopen.h.
45         (display_all, display_settings, display_window_size, set_window_size):
46         Remove fd arg, since we now assume stdin.  All callers changed.
47         (main): Reuse stdin rather than opening a new one.  This
48         saves a file descriptor.
49         * src/tac.c: Include stdlib--.h rather than unistd-safer.h.
50         (copy_to_temp): Don't call fd_safer; no longer needed now
51         that we include stdlib--.h.
52         * src/tail.c: Include fcntl--.h, not unistd-safer.h.
53         (recheck, tail_file): Don't call fd_safer; no longer needed
54         now that we include fcntl--.h.
55         * src/tee.c: Include stdio--.h, not stdio-safer.h.
56         (tee): Don't call fopen_safer; no longer needed now that we
57         include stdio--.h.
58         * src/touch.c: Include fcntl--.h, not unistd-safer.h.
59         (touch): Don't call fd_safer; no longer needed now that
60         we include fcntl--.h.
61
62         * src/du.c (main): Reuse stdin rather than opening a new stream.
63         This saves a file descriptor.
64         * src/uniq.c: Don't include stdio-safer.h; no longer needed.
65         (writeline): Remove stream arg; we now always output to stdout.
66         All callers changed.
67         (check_file): Reuse stdout rather than opening a new stream.
68         This saves a file descriptor.
69
70 2005-07-02  Jim Meyering  <jim@meyering.net>
71
72         * Makefile.maint (sc_obsolete_symbols): New rule.
73         (syntax-check-rules): Add it to the list.
74         * Makefile.am (EXTRA_DIST): Add .x-sc_obsolete_symbols.
75         * .x-sc_obsolete_symbols: New file.
76
77 2005-07-01  Jim Meyering  <jim@meyering.net>
78
79         * src/system.h: Assume HAVE_FCNTL_H (i.e., include <fcntl.h>
80         unconditionally, and don't include <sys/file.h>).
81         * src/system.h: Likewise for HAVE_UNISTD_H.
82
83 2005-06-30  Jim Meyering  <jim@meyering.net>
84
85         * src/cp.c: Add uses of ARGMATCH_VERIFY to ensure that
86         corresponding option string and value arrays are consistent.
87         * src/date.c: Likewise.
88         * src/du.c: Likewise.
89         * src/ls.c: Likewise.
90         cp.c and date.c each had a harmless trailing `, 0' (now-removed)
91         in a value list.
92
93         * src/system.h (VERIFY): Guard definition with #ifndef.
94         (VERIFY_EXPR): Undef before defining.
95
96 2005-06-29  Jim Meyering  <jim@meyering.net>
97
98         * src/pr.c (main, store_char): Use X2REALLOC rather than x2realloc.
99         * src/du.c (show_date): Likewise.
100         * src/date.c (show_date): Likewise.
101         * src/od.c (dump_strings): Likewise.
102         * src/sort.c (fillbuf): Likewise.
103         * src/chmod.c (main): Likewise.
104
105         * src/system.h (VERIFY): Rewrite to use string-concatenation
106         and __LINE__ so as not to require a struct name parameter.
107         (GL_CONCAT, GL_CONCAT2): Define helper macros.
108         * src/od.c: Update sole use.
109
110         * src/ls.c (gobble_file): Use stat.st_author, not stat.st_uid
111         when computing the --author column width.  This bug might have
112         resulted in misaligned columns when using the --author option
113         on the Hurd.  Spotted by Arnold Robbins.
114
115 2005-06-28  Jim Meyering  <jim@meyering.net>
116
117         * src/pr.c (main, store_char): Use x2realloc on 1-byte base types,
118         not x2nrealloc.  The former is a little more concise and readable.
119         N.B. this sort of transformation is ok only when the base type is
120         unlikely ever to change to a multibyte type.
121         * src/du.c (show_date): Likewise.
122         * src/date.c (show_date): Likewise.
123         * src/od.c (dump_strings): Likewise.
124         * src/sort.c (fillbuf): Likewise.
125
126 2005-06-24  Jim Meyering  <jim@meyering.net>
127
128         * src/mv.c (usage): Clarify how --reply=no works.
129
130 2005-06-23  Paul Eggert  <eggert@cs.ucla.edu>
131
132         Address the following "du" issues:
133
134         - The option name "--last-time=TYPE" is different from the ls's option
135           "--time=TYPE" with a similar meaning.  I assume this wasn't intended.
136
137         - --time-style implies --time, but this is not true for "ls".  It's
138           better to be consistent.
139
140         - Since we don't have POSIX compatibility concerns, there's no need
141           for the "posix-" styles, or for support of styles with newlines, or
142           for the "locale" style, except for parsing the TIME_STYLE
143           environment variable.
144
145         - It's cleaner (and these days, no less efficient) to use functions
146           rather than macros when possible.
147
148         - struct duinfo doesn't need a 'valid' flag; you can simply use a time
149           stamp that is less than all valid time stamps.
150
151         - The code needs a bit of reformatting to fit the usual GNU style.
152
153         * NEWS: du's --last-time option is now --time.
154         * doc/coreutils.texi (ls invocation): Fix typo: --time=use is
155         equivalent to --time=atime, not --time=ctime.
156         (ls invocation, du invocation): Fix typo: --time-style=long-iso
157         is equivalent to a time style with a leading "+".
158         (du invocation): --last-time is now --time.
159         --time-style no longer implies --time.
160         The locale and posix- stuff now works only for TIME_STYLE, not
161         for --time-style.  Give equivalent format for --time-style=iso.
162         * src/du.c: Do not include hard-locale.h.
163         (struct duinfo): Remove 'valid' member.  All uses changed to use
164         negative nsec instead.
165         (DUIINFO_INI, DUINFO_SET, DUINFO_ADD): Remove.
166         (duinfo_init, duinfo_set, duinfo_add): New functions, taking the
167         role of the removed macros.
168         (opt_time): Renamed from opt_last_time.  All uses changed.
169         (TIME_OPTION): Renamed from LAST_TIME_OPTION.  All uses changed.
170         (long_options, usage): Rename --last-time to --time.
171         (locale_time_style): Remove.
172         (time_style_args, time_style_types, usage): Remove support for
173         --time-style=locale.
174         (show_date): Now returns void, since nobody looked at the result.
175         Assume FORMAT is not null.  An empty FORMAT now outputs an empty time.
176         Simplify nstrftime invocation.
177         (main): Put in ls compatibility workarounds only for TIME_STYLE,
178         not for --time-style.  Omit unnecessary space in iso time style.
179
180 2005-06-23  Jim Meyering  <jim@meyering.net>
181
182         * src/du.c (time_format): Add `const' attribute.
183
184         * src/date.c (show_date): Use puts rather than printf ("%s\n",.
185
186         * src/du.c (show_date): Rename local `time_format' so as not to
187         shadow the file-scoped global by that name.
188         (show_date): Add a FIXME comment.
189
190         * src/du.c: Include hard-locale.h and strftime.h.
191         (DUINFO_INI, DUINFO_SET, DUINFO_ADD):
192         Enclose body in `do {...} while (0)', not just `{...}'.
193         Adjust uses (add semicolons).
194         Adjust formatting, indentation.
195         (usage): Tweak formatting to maintain more or less constant indentation.
196
197 2005-06-14  William Brendling  <wbrendling@gmail.com>
198
199         * src/du.c: Add --last-time and --time-style options.
200
201 2005-06-22  Paul Eggert  <eggert@cs.ucla.edu>
202
203         * tests/umask-check: New file.
204         * tests/Makefile.am (EXTRA_DIST): Add umask-check.
205         * tests/mkdir/perm: Use umask-check.
206         * tests/cp/cp-parents: Likewise, instead of using chmod
207         as described below.  Problem reported by Kevin Mudrick.
208
209 2005-06-22  Jim Meyering  <jim@meyering.net>
210
211         Make rmdir produce diagnostics like this:
212         rmdir: /tmp: Permission denied
213         not like this:
214         rmdir: `/tmp': Permission denied
215
216         * src/rmdir.c: Include "quotearg.h", not "quote.h".
217         (remove_parents, main): Use quotearg_colon, not quote.
218
219 2005-06-22  Paul Eggert  <eggert@cs.ucla.edu>
220
221         * tests/cp/cp-parents: Use chmod to work around some hosts with
222         ACL problems.  Problem reported by Kevin Mudrick.
223
224 2005-06-21  Jim Meyering  <jim@meyering.net>
225
226         * tests/du/deref-args: Use --apparent-size to avoid the vagaries
227         of counting blocks.  Kevin Mudrick reported that this test would
228         fail on an nfs-mounted directory where attribute-caching is
229         turned on.
230
231 2005-06-19  Jim Meyering  <jim@meyering.net>
232
233         * src/tac.c (tac_mem, tac_stdin_to_mem): Remove #if-0'd functions.
234
235         * src/shred.c (usage): Use `file system', not `filesystem'.
236
237 2005-06-18  Jim Meyering  <jim@meyering.net>
238
239         * src/tr.c (unquote): Remove unnecessary `' quotes from a diagnostic.
240
241 2005-06-17  Jim Meyering  <jim@meyering.net>
242
243         * src/shred.c (usage): Clarify that shred works on an ext3 file
244         system as long as it's not in data=journal mode.
245         Tiny change by Mark Melahn.
246
247 2005-06-16  Paul Eggert  <eggert@cs.ucla.edu>
248
249         * src/hostid.c (main): Don't print fewer than 8 digits, or spurious
250         leading "f"s.  "f" problem reported by Tim Waugh.
251         * NEWS: Document this.
252
253 2005-06-16  Jim Meyering  <jim@meyering.net>
254
255         Don't embed `this'-style quotes in format strings.
256         * src/tr.c: Rather than this: error (..., "...`%s'...", arg);
257         do this:                      error (..., "...%s...", quote (arg));
258         * src/od.c, src/tr.c, src/csplit.c, src/date.c, src/hostname.c:
259         * src/join.c, src/ptx.c, src/seq.c, src/sort.c, src/split.c:
260         * src/split.c, src/tail.c: Likewise.
261
262         * src/sleep.c: Include "quote.h".  Remove hard-coded quotes, as above.
263         * src/nice.c, src/printf.c, src/fold.c, src/pr.c: Likewise.
264         * src/factor.c, src/cat.c, src/expr.c, src/stty.c: Likewise.
265
266         * src/mv.c: Finally remove support for --version-control=S (-V).
267         It was deprecated nearly 6 years ago and has been warning
268         users to switch to --backup=S since fileutils-4.0j.
269         * src/cp.c, src/install.c, src/ln.c: Likewise.
270
271 2005-06-15  Jim Meyering  <jim@meyering.net>
272
273         * src/install.c (main): Fix my typo: s/argv[optind]/file[i]/.
274         * tests/install/basic-1: Ensure that each `-d'-specified directory
275         is created.  Ensure that rel-named dirs are not created when
276         chdir($PWD) fails.
277
278         * tests/mkdir/p-3: Add a test for just-fixed bug in mkdir-p.c.
279
280 2005-06-14  Paul Eggert  <eggert@cs.ucla.edu>
281
282         Improve diagnostics for restore_cwd failure.
283         * src/install.c (main): Standardize on a diagnostic for
284         restore_cwd failure, and report errno.
285         (install_file_in_file_parents): Fail if restore_cwd fails and
286         one of the files is relative.  This fixes a bug (albeit unlikely).
287         * src/mkdir.c (create_parents): Remove static var (now local to 'main').
288         (main): Standardize on a diagnostic for restore_cwd failure,
289         and report errno.
290         Don't bother to check cwd_errno unless create_parents.
291         Use mkdir rather than make_dir; it's simpler.
292
293         * src/install.c (main): Adjust to new make_dir_parents convention.
294         * src/mkdir.c (main): Likewise.
295
296 2005-06-14  Jim Meyering  <jim@meyering.net>
297
298         * tests/mkdir/p-3: Ensure mkdir succeeds if the following argument
299         is an absolute directory name.
300
301         * Makefile.maint (my-distcheck): Add -Wall to the list of options that
302         are used with -Werror.  This target is not intended for general use.
303
304 2005-06-13  Jim Meyering  <jim@meyering.net>
305
306         * src/mkdir.c (main): Give a diagnostic for -- and skip -- each
307         relative directory name after make_dir_parents fails to restore
308         the working directory.  Before, `mkdir -p' could create directories
309         in the wrong place in unusual circumstances.
310         * src/install.c (main): Likewise.
311         (install_file_in_file_parents): Update make_dir_parents caller.
312         * tests/mkdir/p-3: New test for today's mkdir.c/mkdir-p.c bug fixes.
313         * tests/mkdir/Makefile.am (TESTS): Add p-3.
314
315 2005-06-10  Paul Eggert  <eggert@cs.ucla.edu>
316
317         Act on the Austin Group's response yesterday to XCU ERN 63; see
318         <http://www.opengroup.org/austin/docs/austin_260.txt>.
319         * NEWS: ls no longer outputs an extra space between mode and link count.
320         * doc/coreutils.texi: Remove the extra spaces in "ls -l" output.
321         * src/ls.c (any_has_acl): New var.
322         (clear_files): Clear it.
323         (gobble_file): Set it if a file has an ACL.
324         (print_long_format): Omit needless space unless some file has an ACL.
325
326 2005-06-10  Jim Meyering  <jim@meyering.net>
327
328         * src/system.h (VERIFY_W_TYPEOF): Add parentheses.
329
330 2005-06-02  Jim Meyering  <jim@meyering.net>
331
332         * src/sort.c (usage): Put `Ordering options:' line where it belongs.
333
334 2005-06-01  Paul Eggert  <eggert@cs.ucla.edu>
335
336         Use "file name" when talking about file names, instead of "filename"
337         or "path", as per the GNU coding standards.
338         * src/basename.c: Don't use "path" or "filename".
339         * src/copy.c: Likewise.
340         * src/copy.h: Likewise.
341         * src/cp-hash.c: Likewise.
342         * src/cp.c: Likewise.
343         * src/df.c: Likewise.
344         * src/install.c: Likewise.
345         * src/ls.c: Likewise.
346         * src/pinky.c: Likewise.
347         * src/pr.c: Likewise.
348         * src/pwd.c: Likewise.
349         * src/remove.c: Likewise.
350         * src/rmdir.c: Likewise.
351         * src/sort.c: Likewise.
352         * src/system.h: Likewise.
353         * src/tty.c: Likewise.
354         * src/who.c: Likewise.
355         * src/cp.c (parents_option): Renamed from flag_path.  All uses changed.
356         (make_dir_parents_private): Renamed from make_path_private.
357         All uses changed.
358         * src/cp.c (usage): Don't use "path" to describe a file name.
359         * src/readlink.c (usage): Likewise.
360         * src/rmdir.c (usage): Likewise.
361         * src/df.c: Don't include "path-concat.h"; not needed.
362         * src/install.c (install_file_in_file_parents): Renamed from
363         install_file_to_path.  All uses changed.
364         * src/ln.c (FILE_BASENAME_CONCAT): Renamed from PATH_BASENAME_CONCAT.
365         All uses changed.
366         * src/ls.c (make_link_name): Renamed from make_link_path.
367         All uses changed.
368         * src/pwd.c (struct file_name): Renamed from struct Path.
369         All uses changed.
370         (file_name_free): Renamed from path_free.  All uses changed.
371         (file_name_init): Renamed from path_init.  All uses changed.
372         (file_name_prepend): Renamed from path_prepend.  All uses changed.
373         * src/rmdir.c (remove_empty_parents): Renamed from empty_paths.
374         All uses changed.
375         (longopts): Add comment that --path is deprecated.
376
377 2005-05-31  Jim Meyering  <jim@meyering.net>
378
379         * src/copy.c (chown_privileges, chown_failure_ok): Mark as `extern'.
380         This is a crutch so that `make distcheck's sc_tight_scope rule
381         knows that they really are deliberately declared that way.
382
383 2005-05-30  Paul Eggert  <eggert@cs.ucla.edu>
384
385         Port to Solaris 10's rules for whether programs can chown files.
386         * src/copy.c [HAVE_PRIV_H]: Include <priv.h>.
387         (DO_CHOWN): Remove.  Replaced by chown_failure_ok.  All callers
388         changed.
389         (copy_internal): If chown failed, don't worry about what happened
390         to the mode bits; they can't have changed.
391         (chown_privileges, chown_failure_ok): New functions.
392         * src/copy.h: Add copyright notice.
393         (struct cp_options): Remove myeuid member.  Add chown_privileges
394         member.
395         (chown_privileges, chown_failure_ok): New function decls.
396         * src/cp.c (re_protect): Remove unnecessary call to geteuid.
397         Use chown_failure_ok rather than our own code.
398         * src/cp.c (cp_options_init): Use chown_privileges rather than geteuid.
399         * src/install.c (cp_option_init): Likewise.
400         * src/mv.c (cp_option_init): Likewise.
401
402 2005-05-29  Paul Eggert  <eggert@cs.ucla.edu>
403
404         * src/chgrp.c (getgrnam) [!defined _POSIX_VERSION]: Remove decl.
405         * src/chown-core.c (getgrnam, getgrgid) [!defined _POSIX_VERSION]:
406         Remove decls.
407         * src/cp.c (geteuid) [!defined _POSIX_VERSION]: Remove decl.
408         * src/id.c (getpwuid, getgrgid, getuid, getgid, geteuid, getegid)
409         [!defined _POSIX_VERSION]: Remove decls.
410         * src/install.c (getpwnam, getgrnam): Remove decl.
411         (getuid, getgid) [!defined _POSIX_VERSION]: Remove decls.
412         * src/md5sum.c (OPENOPTS, TEXT1T01, TEXTCNVT): Remove.
413         (digest_file): Use O_BINARY-using expr instead of OPENOPTS.
414         * src/system.h: Don't bother mentioning _POSIX_VERSION in comment.
415         * src/test.c: Include sys/param.h if it exists, not if _POSIX_VERSION
416         isn't defined.
417         Don't include <sys/file.h>; no longer needed.
418         (getegid, geteuid): Remove no-longer-necessary decls.
419
420         * src/pathchk.c (_POSIX_PATH_MAX) [!defined _POSIX_PATH_MAX]:
421         Define to 256, not 255, as per modern POSIX.
422
423 2005-05-27  Paul Eggert  <eggert@cs.ucla.edu>
424
425         * NEWS: dd seek=N now conforms to POSIX if the output isn't seekable.
426         * src/dd.c (skip): Return the number of records that were not
427         skipped due to encountering EOF.
428         (dd_copy): If the file wasn't seekable and EOF was encountered,
429         write zeros past EOF until the desired offset is reached.
430
431         * NEWS: expr and test now correctly compare integers of unlimited size.
432         (Also, correct a comment that claimed that expr detects integer
433         overflow; it does so only when converting from strings.)
434         * src/expr.c: Include strnumcmp.h, xstrtol.h.
435         (looks_like_integer): New function.
436         (toarith): Use it.  Also, use xstrtoimax rather than rolling our
437         own diagnostics.
438         (eval2): Don't look for trouble if !evaluate; this simplifies things.
439         Compare numbers using string comparison, so that overflow is
440         not possible.
441         * src/sort.c: Refactor so that others can use large-integer
442         comparison functions.
443         Include "strnumcmp.h".
444         (NEGATION_SIGN, NUMERIC_ZERO, fraccompare):
445         Remove; moved to strnumcmp.
446         (decimal_point): Now int, to simplify converison overhead with
447         new API.  All uses changed.
448         (thousands_sep): Now -1 if there isn't one, as per new API.
449         All uses changed.
450         (numcompare): Move contents to strnumcmp module, except for
451         skipping blanks.
452         * src/test.c: Include inttostr.h, strnumcmp.h.
453         (whitespace, digit, digit_value, integer_expected_error): Remove.
454         (is_int): Remove; replaced by...
455         (find_int): New function.
456         (binary_operator): Don't let integers overflow in comparisons;
457         return the correct answer instead.  Simplify the code.
458         (unary_operator): Convert the integer ourself, since find_int
459         no longer does so.
460         * tests/expr/basic (bigcmp): New test.
461         * tests/test/Test.pm (eq-6, gt-5, lt-5): New tests.
462
463 2005-05-26  Paul Eggert  <eggert@cs.ucla.edu>
464
465         * NEWS: nohup now redirects a tty stdin to an unreadable fd
466         instead of closing it.
467         * doc/coreutils.texi (nohup invocation): Document this.
468         * src/nohup.c (main): Implement this.
469
470 2005-05-26  Jim Meyering  <jim@meyering.net>
471
472         * src/expr.c (toarith): Fix a sign error introduced on 2005-01-14.
473         Reported by David Alan Gilbert.
474         * tests/expr/basic: Add tests using arithmetic on negative integers.
475
476 2005-05-19  Jim Meyering  <jim@meyering.net>
477
478         * src/remove.c (AD_mark_helper, AD_mark_current_as_unremovable):
479         Remove inaccurate-but-harmless `const' attributes.
480
481         * src/join.c (decode_field_spec): Add an abort after
482         `error (EXIT_FAILURE, ...' to avoid a gcc warning in caller,
483         about variables being used uninitialized.
484
485 2005-05-18  Paul Eggert  <eggert@cs.ucla.edu>
486
487         * configure.ac: Add copyright notice.  gl_LIB_CHECK -> cu_LIB_CHECK.
488         * src/Makefile.am: Add copyright notice.
489         (factor_LDADD): Remove, as factor no longer needs sqrt.
490         * src/hostname.c: Remove test for HAVE_LIMITS_H; we can assume
491         it's always true now.
492
493 2005-05-16  Paul Eggert  <eggert@cs.ucla.edu>
494
495         Fix Cygwin porting problem reported by Eric Blake.
496         * src/remove.c (DT_IS_DIR): Remove.
497         (DT_IS_KNOWN, DT_MUST_BE): New macros.
498         (remove_entry): Use them.
499
500 2005-05-14  Paul Eggert  <eggert@cs.ucla.edu>
501
502         * src/remove.c: Include unlinkdir.h.
503         (UNLINK_CAN_UNLINK_DIRS): Remove.
504         (remove_entry): Use cannot_unlink_dirs () rather than
505         UNLINK_CAN_UNLINK_DIRS.
506
507 2005-05-14  Jim Meyering  <jim@meyering.net>
508
509         Update FSF postal mail address.
510         * Makefile.maint, Makefile.cfg, gnupload
511         * src/basename.c, src/cat.c, src/checksum.h, src/chgrp.c
512         * src/chmod.c, src/chown-core.c, src/chown-core.h, src/chown.c
513         * src/chroot.c, src/cksum.c, src/comm.c, src/copy.c, src/copy.h
514         * src/cp-hash.c, src/cp-hash.h, src/cp.c, src/csplit.c, src/cut.c
515         * src/date.c, src/dcgen, src/dd.c, src/df.c, src/dircolors.c
516         * src/dirname.c, src/du.c, src/echo.c, src/env.c, src/expand.c
517         * src/expr.c, src/factor.c, src/fmt.c, src/fold.c, src/fs.h
518         * src/groups.sh, src/head.c, src/hostid.c, src/hostname.c, src/id.c
519         * src/install.c, src/join.c, src/kill.c, src/lbracket.c, src/link.c
520         * src/ln.c, src/logname.c, src/ls-dir.c, src/ls-ls.c, src/ls-vdir.c
521         * src/ls.c, src/ls.h, src/md5.c, src/md5sum.c, src/mkdir.c
522         * src/mkfifo.c, src/mknod.c, src/mv.c, src/nice.c, src/nl.c
523         * src/nohup.c, src/od.c, src/paste.c, src/pathchk.c, src/pinky.c
524         * src/pr.c, src/printenv.c, src/printf.c, src/ptx.c, src/pwd.c
525         * src/readlink.c, src/remove.c, src/remove.h, src/rm.c, src/rmdir.c
526         * src/seq.c, src/setuidgid.c, src/sha1sum.c, src/shred.c
527         * src/sleep.c, src/sort.c, src/split.c, src/stat.c, src/stty.c
528         * src/su.c, src/sum.c, src/sync.c, src/system.h, src/tac-pipe.c
529         * src/tac.c, src/tail.c, src/tee.c, src/test.c, src/touch.c
530         * src/tr.c, src/true.c, src/tsort.c, src/tty.c, src/uname.c
531         * src/unexpand.c, src/uniq.c, src/unlink.c, src/uptime.c
532         * src/users.c, src/wc.c, src/who.c, src/whoami.c, src/yes.c
533
534 2005-05-13  Jim Meyering  <jim@meyering.net>
535
536         * NEWS: `rm -r' now removes all of the files it should, even on
537         systems with a buggy readdir affecting file systems inaccessible
538         at configure time.
539
540         In some unusual circumstances `rm -r' would fail to remove --
541         or even consider -- all entries in a directory with more than 254
542         (SunOS) or 338 (Darwin) entries.  This could cause trouble even on
543         other types of systems when using an affected file system via e.g.,
544         NFS.  The underlying cause was a bug in readdir on those systems.
545         Coreutils-5.2.1 and earlier used a configure-time test designed
546         to detect precisely those problem systems, but it would detect
547         the problem and enable remove.c's work-around code only when its
548         configure-time test was run on a losing file system.  Obviously,
549         it couldn't detect a problem if the offending file system wasn't
550         tested or even mounted at coreutils configure time.  Now, rm itself
551         performs a minimal-cost run-time test to detect the problem.
552
553         * src/remove.c (CONSECUTIVE_READDIR_UNLINK_THRESHOLD): Define.
554         (remove_cwd_entries):  When readdir returns NULL for a directory from
555         which we've removed more than CONSECUTIVE_READDIR_UNLINK_THRESHOLD
556         entries, call rewinddir and then resume the readdir/unlink loop.
557         (UNLINK_CAN_UNLINK_DIRS): Rename from ROOT_CAN_UNLINK_DIRS.
558
559 2005-05-12  Paul Eggert  <eggert@cs.ucla.edu>
560
561         * NEWS: nohup now closes stdin if it is a terminal, unless
562         POSIXLY_CORRECT is set.  This fixes a glitch noted by Wayne Pollock in
563         <https://www.opengroup.org/sophocles/show_mail.tpl?
564         source=L&listname=austin-group-l&id=8341>.
565         * doc/coreutils.texi (nohup invocation): Document this.
566         * src/nohup.c (main): Implement this.
567
568 2005-05-12  Jim Meyering  <jim@meyering.net>
569
570         * src/date.c: Assume `free (NULL)' works.
571         * src/dd.c: Likewise.
572         * src/df.c:Likewise.
573         * src/dircolors.c:Likewise.
574         * src/head.c: Likewise.
575         * src/ls.c: Likewise.
576         * src/md5sum.c: Likewise.
577         * src/pr.c: Likewise.
578         * src/sort.c: Likewise.
579
580 2005-05-10  Jim Meyering  <jim@meyering.net>
581
582         * tests/touch/not-owner: Skip this test if the user running it
583         owns `/' or has write access to it.
584
585         * src/copy.c (abandon_move): Remove erroneous UNWRITABLE check.
586         This makes `mv -i --reply=no f1 f2' work as expected (in not
587         performing the move operation).  But note that specifying `-i'
588         after `--reply=no' does *not* work.
589         Tiny patch from Vlada Macek.
590         Correct a comment.
591         * tests/mv/reply-no: New file.  Test for the above fix.
592         * tests/mv/Makefile.am (TESTS): Add reply-no.
593
594         * tests/ls-2/tests: Don't print PATH to stderr.
595
596 2005-05-08  Paul Eggert  <eggert@cs.ucla.edu>
597
598         * NEWS: cp, ln, mv, rm no longer discard white space when intepreting
599         responses.
600
601 2005-05-06  Paul Eggert  <eggert@cs.ucla.edu>
602
603         * NEWS: dd has new iflag= and oflag= flags "binary" and "text".
604         * src/dd.c (flags, usage): Add support for "binary" and "text".
605
606 2005-05-04  Paul Eggert  <eggert@cs.ucla.edu>
607
608         * NEWS: chmod -w now complains if it differs from chmod a-w.
609         * src/chmod.c: Include quotearg.h.
610         (diagnose_surprises): New var.
611         (process_file): Diagnose surprises.  Simplify the logic a bit,
612         while we're at it.
613         (main): Prepare to diagnose surprises.  Remove useless code for
614         '-' option.
615         * tests/chmod/Makefile.am (TESTS): Add umask-x.
616         * tests/chmod/umask-x: New file.
617
618 2005-05-02  Paul Eggert  <eggert@cs.ucla.edu>
619
620         * NEWS: ls --indicator-style=directory renamed to ls
621         --indicator-style=slash, to avoid confusion with ls --directory.
622         * src/ls.c (usage): Likewise.
623         (slash): Renamed from directory_only.  All uses changed.
624
625 2005-05-01  Paul Eggert  <eggert@cs.ucla.edu>
626
627         * NEWS: "chmod +1 foo" is now diagnosed.
628
629 2005-04-29  Paul Eggert  <eggert@cs.ucla.edu>
630
631         * NEWS: ls -p now marks only directories.  New option
632         --indicator-style=directory equivalent to -p.
633         * doc/coreutils.texi (ls invocation): Document this.
634         Also, mention ">" is for doors.
635         * src/ls.c (enum indicator_style): New constant directory_only,
636         for -p.
637         (indicator_style_args, indicator_style_types): Set it appropriately.
638         (decode_switches, gobble_file, print_type_indicator):
639         (length_of_file_name_and_frills):
640         Implement the change described in NEWS.
641         (decode_switches): Quote ">", too.
642         (usage): Update to match the new behavior.  Describe ">".
643         * tests/ls/file-type: Test for new behavior.  Omit -1 option.
644         The "ls --color" test wasn't being checked; add a check for
645         "ls --color=auto" instead.
646
647         * tests/head/Test.pm: Don't set _POSIX2_VERSION; no longer needed.
648         * tests/misc/split-fail: Likewise.
649         * tests/pr/Test.pm: Likewise.
650         * tests/sort/Test.pm: Fix comment to match new behavior of "sort".
651         * tests/tail/Test.pm (tv): Rename tests from obs to obs-plus
652         if they use file names starting with +.
653         (test_vector): Don't set _POSIX2_VERSION if obs but not obs-plus.
654         * tests/uniq/Test.pm (tv, test_vector): Likewise.
655
656         The following was partly derived from a tiny change by Eric Blake:
657         * tests/misc/nice: Don't use 'set -'.  It's not portable to strict
658         POSIX 1003.1-2001 hosts.  Also, don't set _POSIX2_VERSION.
659         * tests/mkdir/perm: Don't use 'set -'.  Simplify test construction.
660         Work even if the underyling system attaches ACLs to new dirs.
661         * tests/mv/part-hardlink: Don't use 'set -'.
662         * tests/stty/row-col-1: Don't use 'set -'.
663
664 2005-04-28  Paul Eggert  <eggert@cs.ucla.edu>
665
666         * NEWS: Document fixes described below.
667         * src/chmod.c (change, umask_value): New static vars.
668         (reference_file): Move this static var to inside "main".
669         (process_file, process_files): Remove CHANGES arg; now taken from
670         static var.  All uses changed.
671         (usage): Fix incorrect description of MODE operand.
672         (main): For invalid mode usages, output a brief usage message.
673         Adjust to new modechange API.
674         * install.c (main): Adjust to new modechange API.
675         Also, free the mode_change object when done.
676         * mkdir.c (main): Likewise.
677         * mkfifo.c (main): Likewise.
678         * mknod.c (main): Likewise.
679         * tests/chmod/equal-X: Check for =xX bug.
680         * tests/chmod/equals: Check for =u bug.
681         * tests/chmod/usage: Check for u+gr and ug,+x bugs.
682
683 2005-04-26  Paul Eggert  <eggert@cs.ucla.edu>
684
685         Restore support for usages like "head -1" and "tail -1",
686         even when conforming to POSIX 1003.1-2001.
687         Fix bug with "POSIXLY_CORRECT=1 fold file -3".
688         join now supports a NUL field separator, e.g., "join -t '\0'".
689         join now detects and reports incompatible options, e.g.,
690         "join -t x -t y",
691         * NEWS: Document this.
692         * src/date.c: Remove posixver.h and its uses.
693         (COMMON_SHORT_OPTIONS): Remove.
694         (short_options): New constant.
695         (short_options, usage): -I now always takes an optional arg.
696         * src/expand.c: Remove posixver.h and its uses.
697         (shortopts): New constant.  -DIGIT now always takes an optional arg.
698         (main): Revamp parsing of -DIGIT to let parse_tab_stops handle it.
699         Don't complain about -DIGIT.
700         * src/fold.c: Remove posixver.h and its uses.
701         (shortopts): New constant.  -DIGIT now always takes an optional arg.
702         (main): Don't preprocess arg list; that was buggy.  Use method
703         similar to expand.
704         * src/head.c: Remove posixver.h and its uses.
705         (header_mode_option): Remove.
706         (main): Don't complain about obsolete -NUM args.
707         * src/join.c: Remove posixver.h and its uses.
708         (obsolete_usage): Remove.
709         (join_field_1, join_field_2): Initialize to SIZE_MAX to indicate
710         they haven't been set yet.
711         (tab): Now int, not char.  Initialize to -1 to indicate white space
712         separates columns, so that we can use NUL as a separator.
713         All uses changed.
714         (OBSOLETE_LONG_OPTIONS, get_option): Remove.
715         (string_to_join_field): Remove ERR_MSG_FMT arg; a single format
716         suffices.  Use xstrtoul for sizes; it suffices.
717         (decode_field_spec): Report an error and exit on failure.  Return void,
718         not bool.
719         (add_field_list): Likewise.
720         (set_join_field): New function.
721         (enum operand_status): New enum.
722         (add_file_name): New args OPERAND_STATUS, JOPTION_COUNT,
723         PREV_OPTC_STATUS, OPTC_STATUS to handle the bewildering array of
724         possibilities with obsolete option parsing.
725         (main): Use it.  Do not depend on POSIX version.
726         Check for conflicting options.  Parse obsolete options -j1 and -j2
727         so that it is a pure extension to POSIX 1003.1-2001.
728         Allow '-t\0' to specify a NUL tab, stealing the code from 'sort'.
729         * src/nice.c: Remove posixver.h and its uses.
730         (main): Always support -NUM option.
731         * src/od.c: Remove posixver.h and its uses.
732         (short_options): New constant, which always supports -w[num].
733         (COMMON_SHORT_OPTIONS): Remove.
734         * src/pr.c: Remove posixver.h and its uses.
735         (short_options): New constant, which always supports -S[string].
736         (COMMON_SHORT_OPTIONS): Remove.
737         * src/sort.c: Remove posixver.h and its uses.
738         (short_options): New constant, which always supports -y arg.
739         (COMMON_SHORT_OPTIONS): Remove.
740         (main): Redo workaround for Solaris compatibility with -y.
741         This change isn't visible to the user; it just cleans up the
742         code so that we don't need posixver.h.
743         * src/split.c: Remove posixver.h and its uses.
744         (main): Don't complain about -NUM option.
745         * src/tail.c (parse_obsolete_option): Don't complain about -NUM.
746         * src/unexpand.c: Remove posixver.h and its uses.
747         (main): Don't complain about -TAB.
748         * src/uniq.c (main): Don't complain about -NUM.
749
750 2005-04-22  Paul Eggert  <eggert@cs.ucla.edu>
751
752         * src/nohup.c (main): If getopt fails, exit with status 127,
753         not status 1.  POSIX requires this.
754         * NEWS: Document this.
755
756         * src/nice.c (main): Report proper program name when getopt finds
757         trouble.  Problem reported by Behdad Esfahbod.
758
759         * NEWS: Fix bug with "mkdir -m =+x dir"; the umask was being ignored
760         when the "+x" was being evaluated.
761         * mkdir.c (main): Compile mode with MODE_MASK_ALL and initial umask.
762         * mkfifo.c (main): Likewise.
763         * mknod.c (main): Likewise.
764         * tests/mkdir/perm: Test for the above bug.
765
766 2005-04-20  Paul Eggert  <eggert@cs.ucla.edu>
767
768         Port test cases to Microsoft-Windows-related environments,
769         following suggestions from Eric Blake.
770         * tests/install/Makefile.am (TESTS_ENVIRONMENT): Add EXEEXT.
771         * tests/install/basic-1: Undo previous change.
772         (dd, dd2): New vars, which use $EXEEXT.  All uses of dd and dd2 changed.
773         * tests/install/trap: Undo previous change.
774         (sig): New var.  Use it insted of "trap '' CHLD".
775         Append $EXEEXT to executable name.
776
777         "fetish" -> "coreutils" in more places.
778         * tests/Coreutils.pm: Renamed from tests/Fetish.pm.
779         (package Coreutils): Renamed from package Fetish.  All uses changed.
780         * tests/Makefile.am (EXTRA_DIST): Add Coreutils.pm and
781         remove Fetish.pm.
782
783 2005-04-19  Paul Eggert  <eggert@cs.ucla.edu>
784
785         * tests/mv/setup (dot_mount_point): Use stat -L, in case the
786         directory is actually a symbolic link.  Problem reported by
787         Eric Blake.
788
789         * tests/mv/mv-special-1: Use test -p to test for fifos, rather
790         than the (incorrect) test -f and the (inadequate) ls.  ls is
791         inadequate because on some hosts a buggy mv will create a file of
792         the wrong type (problem reported by Eric Blake).  Skip this test
793         if test -p doesn't work.
794
795         * tests/chmod/setgid: Use numeric group ids, not symbolic group names,
796         since the latter can have shell metacharacters in them (e.g., spaces).
797         This follows up to the 2005-01-17 patch, which missed this occurrence.
798
799 2005-04-18  Paul Eggert  <eggert@cs.ucla.edu>
800
801         "fetish" -> "coreutils" in several places.
802         * Makefile.cfg (ftp): Remove fetish.sf.net.
803         * Makefile.maint (emit_upload_commands): Likewise.
804         * src/Makefile.am (LDADD, $(PROGRAMS)): fetish -> coreutils.
805         * tests/group-names (COREUTILS_GROUPS): Renamed from FETISH_GROUPS.
806         * tests/chmod/setgid (FETISH_GROUP): Renamed from COREUTILS_GROUP.
807
808         * tests/install/basic-1: Use "cat", not "test", to test for
809         ../../src/dd.  Problem reported by Eric Blake.
810
811 2005-04-18  Jim Meyering  <jim@meyering.net>
812
813         * src/dd.c: Don't include stat-macros.h directly.  system.h does that.
814
815 2005-04-17  Paul Eggert  <eggert@cs.ucla.edu>
816
817         Work around a couple of "make check" failures reported for Cygwin
818         and ash by Eric Blake.
819         * tests/install/basic-1: Skip this test if ../../src/dd isn't readable.
820         * tests/install/trap: Skip this test if "trap '' CHLD" doesn't work.
821
822 2005-04-16  Jim Meyering  <jim@meyering.net>
823
824         * src/dd.c (S_TYPEISSHM): Remove definition.
825         Get the definition by including "stat-macros.h", instead.
826
827 2005-04-14  Paul Eggert  <eggert@cs.ucla.edu>
828
829         Fix test suite problems reported by Eric Blake on Cygwin.
830         * tests/mv/mv-special-1: Ignore chatter about when files are removed,
831         since POSIX doesn't require rename to fail across file systems.
832         * tests/mv/setup (dot_mount_point): Use stat rather than df, as
833         it's more reliable.
834         (other_partition_tmpdir): Remove df from name as that would be
835         misleading now.
836
837 2005-04-14  Jim Meyering  <jim@meyering.net>
838
839         * src/chown-core.c: Correct typo, fchmod -> fchown, in a comment.
840
841 2005-04-12  Paul Eggert  <eggert@cs.ucla.edu>
842
843         * src/ls.c (usage): "uid" -> "user ID".
844
845 2005-04-12  Jim Meyering  <jim@meyering.net>
846
847         * src/tsort.c (tsort): Use "%s" as the format string,
848         rather than a diagnostic or a file name.
849
850         * src/comm.c (compare_files): Remove declaration of unused local.
851
852         * src/chown-core.c (chopt_free): Mark parameter as unused.
853
854 2005-04-11  Paul Eggert  <eggert@cs.ucla.edu>
855
856         * man/chown.x: Reword to match user manual.
857         * man/id.x: Likewise.
858         * src/setuidgid.c (usage): Use "user ID", not "UID", and similarly
859         for "group ID".
860         * src/whoami.c (usage, main): Likewise.
861
862         Add bulletproofing for cases where stdin, stdout, or stderr are closed.
863         * src/comm.c: Include stdio-safer.h.
864         (compare_files): Exit right away on I/O error rather than continuing
865         and producing confusing output and error messages.
866         Return void, not int; all callers changed.
867         Use fopen_safer to avoid confusion with file descriptors.
868         * src/copy.c: Include unistd-safer.h.
869         (copy_reg): Use fd_safer.
870         * src/csplit.c: Include stdio-safer.h.
871         (input_desc): Remove unnecessary static initialization.
872         (set_input_file): Use STDIN_FILENO, not 0.
873         (create_output_file): Use fopen_safer.
874         * src/dircolors.c (dc_parse_file): Don't assume fopen does not
875         return stdin.
876         * src/head.c (head_file): Don't assume open does not return 0.
877         * src/join.c: Include stdio-safer.h.
878         (main): Use fopen_safer.  Simplify the resulting code.
879         * src/md5sum.c (digest_file, digest_check):
880         Don't assume that fopen does not return stdin.
881         * src/nohup.c: Include unistd-safer.h.
882         (main): Don't dup stderr to stdin or stdout by mistake.
883         * src/od.c (check_and_close): Don't assume fopen does not return stdin.
884         * src/paste.c (paste_serial): Likewise.
885         * src/pr.c: Include stdio-safer.h.
886         (open_file): Use fopen_safer.
887         (close_file): Don't assume fopen does not return stdin.
888         * src/ptx.c (main): Don't assume fopen returns stdout after closing
889         stdout.  Use freopen instead.
890         * src/shred.c: Include unistd-safer.h.
891         (wipename): Use fd_safer on directory file descriptor.
892         (wipefile): Remove special case for /dev/fd/* on older hosts.
893         It didn't work in general, and wasn't documented.
894         Use fd_safer.
895         * src/sort.c: Include unistd-safer.h.
896         (create_temp_file): Use fd_safer.
897         (xfclose): Don't assume fileno (stdin) == STDIN_FILENO, etc.
898         * src/split.c: Include unistd-safer.h.
899         (cwrite): Use fd_safer.  Replace mystery constant 0666 with symbolic
900         version, as POSIX requires.
901         * src/sum.c (bsd_sum_file, sysv_sym_file):
902         Use same pattern as elsewhere for checking for stdin.
903         * src/tac.c: Include unistd-safer.h.
904         (copy_to_temp): Use fd_safer.
905         (tac_file): Don't assume fopen cannot return stdin.
906         * src/tail.c: Include unistd-safer.h rather than fcntl-safer.h.
907         (recheck, tail_file): Use fd_safer rather than open_safer.
908         * src/tee.c: Include stdio-safer.h.
909         (tee): Use fopen_safer.
910         * src/touch.c: Include unistd-safer.h.
911         (touch): Use fd_safer.
912         * src/tsort.c (have_read_stdin): Remove; no longer needed.  All uses
913         removed.
914         (tsort): Do not assume fopen can't return stdin.
915         Close stdin before returning.  All uses changed.
916         * src/unexpand.c (next_file): Don't assume fopen cannot return stdin.
917         * src/uniq.c: Include stdio_safer.h.
918         (check_file): Don't assume fopen cannot return stdin or stdout.
919
920 2005-04-09  Jim Meyering  <jim@meyering.net>
921
922         * src/dd.c (quit): Define with ATTRIBUTE_NORETURN.
923
924         Now that close_stdout closes standard output unconditionally,
925         these workarounds for dd and cat are no longer necessary.
926         * src/dd.c (close_stdout_wrapper): Remove function.
927         (main): Call atexit with close_stdout, instead.
928         * src/cat.c (close_stdout_wrapper): Likewise.
929         Don't close STDOUT_FILENO explicitly; close_stdout does it.
930
931         * src/system.h (__attribute__): Readability nit:
932         Change this:
933         #  define __attribute__(x)
934         to this:
935         #  define __attribute__(x) /* empty */
936
937 2005-04-09  Jim Meyering  <jim@meyering.net>
938
939         * src/rm.c (usage): Mention that --recursive removes listed
940         directories too, not just their contents.
941         Say that by default, rm does not remove directories.
942
943         * src/pr.c: Don't include "timespec.h".  system.h does that.
944         * Makefile.maint (sc_system_h_headers): Propagate exit status
945         through trap.
946
947 2005-04-08  Paul Eggert  <eggert@cs.ucla.edu>
948
949         * NEWS: Document that dd no longer treats QUIT or PIPE specially,
950         and when conforming to POSIX no longer treats USR1 specially.
951         Document that dd no longer dumps core when handling signals.
952         * src/system.h (RETSIGTYPE): Remove; no longer needed.  All uses
953         replaced with void.
954         * src/csplit.c (SA_NOCLDSTOP): Define to 0 if not defined.
955         All uses changed.
956         (siginterrupt) [!HAVE_SIGINTERRUPT]: New macro.
957         (delete_all_files): New arg IN_SIGNAL_HANDLER, to avoid undefined
958         behavior when called from a signal handler.  All uses changed.
959         (main) [!defined SA_NOCLDSTOP]:
960         Use siginterrupt to specify that system calls should be interrupted.
961         * src/dd.c: Do not include safe-read.h or full-write.h; no longer needed.
962         (process_signals): Add forward decl.
963         (SA_NOCLDSTOP, sigprocmask, sigset_t) [!defined SA_NOCLDSTOP]:
964         New macros.
965         (siginterrupt) [! HAVE_SIGINTERRUPT]: New macro.
966         (SA_NODEFER) [!defined SA_NODEFER]: New macro.
967         (SA_RESETHAND) [!defined SA_RESETHAND]: New macro.
968         (caught_signals, interrupt_signal, info_signal_count, catch_siginfo):
969         New vars.
970         (usage): Mention -USR1 versus -INFO.
971         (cleanup): Don't invoke print_stats; the caller must do it now.
972         All callers changed.
973         (quit): Process signals just before exiting.
974         (interrupt_handler): Simply record the signal and return.
975         (siginfo_handler): Simply increment the signal counter and return.
976         (install_handler): Remove, replacing with:
977         (install_signal_handlers, process_signals, iread, iwrite):
978         New functions.  All callers to safe_read and full_write replaced
979         by iread and iwrite.  All callers to install_handler replaced by
980         install_handlers.
981         * src/ls.c (SA_NOCLDSTOP): Define to 0 if not defined.
982         All uses changed.
983         (siginterrupt) [! HAVE_SIGINTERRUPT]: New macro.
984         (main) [! SA_NOCLDSTOP]: Use it.
985         * src/shred.c: Remove all uses of signals; modern hosts have
986         /dev/random and don't need this gorp.
987         Do not include signal.h.
988         (env, sigill_handler, isaac_seed_machdep): Remove.  All uses removed.
989         * src/sort.c (SA_NOCLDSTOP): Define to 0 if not defined.
990         All uses changed.
991         (siginterrupt) [! HAVE_SIGINTERRUPT]: New macro.
992         (main) [! SA_NOCLDSTOP]: Use it.
993
994         * src/dd.c: Do not include inttostr.h, no longer needed.
995         (print_stats, main): Rewrite and simplify formats to use PRIuMAX
996         instead of umaxtostr.
997         (print_stats): Work even in languages that have special
998         forms for two of things, for r_truncate and w_bytes.  We can't
999         fix delta_s in this way, since ngettext doesn't support floating-point.
1000         (main): Rewrite to avoid casts.
1001
1002 2005-04-07  Jim Meyering  <jim@meyering.net>
1003
1004         Placate gcc-4's -Wuninitialized.
1005         * src/md5sum.c (digest_check) [lint]: Initialize hex_digest to NULL.
1006         * src/test.c (binary_operator) [lint]: Initialize lt and rt to 0.
1007
1008         * src/test.c (is_int, age_of, binop): Declare `char *' parameters to
1009         be `const'.
1010         (binop): Move function definition to precede first use so we can...
1011         (binop): ...remove prototype.
1012
1013 2005-04-05  Paul Eggert  <eggert@cs.ucla.edu>
1014
1015         * man/Makefile.am (.x.1): Remove "COMMAND.td/" from examples.
1016         * src/basename.c (usage): Add examples.
1017         * src/cat.c (usage): Likewise.
1018         * src/chgrp.c (usage): Likewise.
1019         * src/chown.c (usage): Likewise.
1020         * src/dirname.c (usage): Likewise.
1021
1022 2005-04-05  Jim Meyering  <jim@meyering.net>
1023
1024         * src/nice.c (usage): Mention that some shells provide a
1025         built-in function by the same name.
1026         * src/nohup.c (usage): Likewise.
1027         * src/printenv.c (usage):Likewise.
1028
1029 2005-04-04  Dmitry V. Levin  <ldv@altlinux.org>
1030
1031         * src/tee.c (tee): When closing files, do not close stdout,
1032         leave this job to close_stdout() instead.
1033         * configure.ac (AC_CONFIG_FILES): Add tests/tee/Makefile.
1034         * tests/Makefile.am (SUBDIRS): Add tee.
1035         * tests/tee/Makefile.am: New file.
1036         * tests/tee/.cvsignore: Likewise.
1037         * tests/tee/{basic,dash}: New tee tests.
1038
1039 2005-04-04  Jim Meyering  <jim@meyering.net>
1040
1041         * src/echo.c (usage): Mention that some shells provide a
1042         built-in function by the same name.
1043         * src/kill.c (usage): Likewise
1044         * src/printf.c (usage): Likewise.
1045         * src/pwd.c (usage): Likewise.
1046         * src/stat.c (usage): Likewise.
1047         * src/test.c (usage): Likewise.
1048         * src/true.c (usage):
1049         * src/system.h (USAGE_BUILTIN_WARNING): New macro.
1050
1051         * man/echo.x: Remove `DESCRIPTION' section, now that --help includes it.
1052         * man/printf.x: Likewise.
1053         * man/pwd.x: Likewise.
1054
1055 2005-04-03  Jim Meyering  <jim@meyering.net>
1056
1057         * src/pr.c (main): Fix off-by-one error.
1058         pr -$(perl -e 'print "0"x63 . 1') would write one byte beyond the
1059         end of a malloc'd buffer.
1060
1061 2005-04-01  Jim Meyering  <jim@meyering.net>
1062
1063         * src/pr.c (main): Free column_count_string when done with it.
1064
1065         Don't let pr treat +1:-1 like +1:18446744073709551615.
1066         * src/pr.c (strtoumax): Remove declaration.
1067         (first_last_page): Use xstrtoumax in place of strtoumax,
1068         so we don't interpret a negative page number (e.g., in an option
1069         like --pages=1:-1) as valid.
1070         * tests/pr/Test.pm (neg-page): Add a test for this.
1071
1072 2005-03-30  Paul Eggert  <eggert@cs.ucla.edu>
1073
1074         * src/pinky.c (short_pinky): Adjust to read_utmp signature change.
1075         * src/uptime.c (uptime): New arg OPTIONS.  All uses changed.
1076         * src/users.c (users): Likewise.
1077         * src/who.c (who): Likewise.
1078         * src/uptime.c (main): Check PIDs when invoked with zero arguments.
1079         * src/users.c (main): Likewise.
1080         * src/who.c (main): Likewise.  Also with two arguments.
1081         Omit duplicate code in 2-arg case.
1082         (UT_PID): Moved to ../lib/readutmp.h.
1083
1084 2005-03-29  Jim Meyering  <jim@meyering.net>
1085
1086         * src/system.h (ptr_align): Declare `ptr' parameter to be a
1087         `const' pointer, since this function never writes through it.
1088
1089         * src/uname.c: Indent cpp directives to reflect nesting.
1090
1091 2005-03-28  Jim Meyering  <jim@meyering.net>
1092
1093         * src/seq.c (get_width_format) [HAVE_RINT && HAVE_MODF && HAVE_FLOOR]:
1094         Add `void' to make this an ANSI-style function declaration.
1095         * src/remove.c (ds_init): Likewise.
1096         * src/pr.c (print_sep_string): Likewise.
1097
1098         * src/stty.c (speeds): Declare this array to be static.
1099         * src/Makefile.am (sc_tight_scope): Adjust to catch any
1100         new declarations like that of stty.c's `speeds'.
1101
1102         * src/system.h (GETOPT_HELP_OPTION_DECL): Use NULL, not `0'.
1103         (GETOPT_VERSION_OPTION_DECL): Likewise.
1104         * src/chown.c (long_options): Likewise.
1105         * src/chgrp.c (long_options): Likewise.
1106         * src/chmod.c (long_options): Likewise.
1107         * src/cp.c (sparse_type_string, reply_args, decode_preserve_arg):
1108         Likewise.
1109         * src/chown-core.c (chopt_init): Likewise.
1110         * src/comm.c (long_options): Likewise.
1111         * src/copy.c (copy_reg): Likewise.
1112         * src/csplit.c (extract_regexp): Likewise.
1113         * src/cut.c (longopts): Likewise.
1114         * src/date.c (time_spec_string): Likewise.
1115         * src/df.c (find_mount_point, show_point): Likewise.
1116         * src/expr.c (docolon): Likewise.
1117         * src/fmt.c (long_options): Likewise.
1118         * src/ls.c (time_style_args, indicator_style_args, long_options)
1119         (format_args, sort_args, time_args, decode_switches)
1120         (gobble_file): Likewise.
1121         * src/md5sum.c (long_options): Likewise.
1122         * src/mv.c (reply_args): Likewise.
1123         * src/paste.c (longopts): Likewise.
1124         * src/pinky.c (print_entry): Likewise.
1125         * src/pr.c (long_options): Likewise.
1126         * src/ptx.c (long_options, format_args): Likewise.
1127         * src/readlink.c (longopts): Likewise.
1128         * src/sort.c (long_options, mergefps): Likewise.
1129         * src/stat.c (long_options): Likewise.
1130         * src/tac.c (main): Likewise.
1131         * src/tail.c (follow_mode_string): Likewise.
1132         * src/touch.c (longopts, time_args): Likewise.
1133         * src/uniq.c (delimit_method_string): Likewise.
1134         * src/uptime.c (print_uptime): Likewise.
1135         * src/who.c (print_user): Likewise.
1136
1137 2005-03-27  Jim Meyering  <jim@meyering.net>
1138
1139         * src/dcgen: Simplify further, clean up.
1140         Add a standard-output-closing global destructor.
1141         Require perl-5.002.
1142         * src/wheel-gen.pl: Use the same global destructor as dcgen.
1143
1144 2005-03-26  Paul Eggert  <eggert@cs.ucla.edu>
1145
1146         * src/dcgen: Squeeze multiple blanks into one.  Output a simple
1147         array of adjacent strings rather than a more complicated data
1148         structure; this saves space in the dircolors executable.
1149         * src/dircolors.c (parse_line): Use char *, not unsigned char *.
1150         This avoids casts.
1151         (dc_parse_stream, main): Avoid casts.
1152         Adjust to simpler data structure generated by new dcgen.
1153
1154 2005-03-25  Eric Blake  <ebb9@byu.net>  (tiny change)
1155
1156         * src/ls.c (usage): Document usage of LS_COLORS.
1157
1158 2005-03-25  Paul Eggert  <eggert@cs.ucla.edu>
1159
1160         * src/dircolors.hin: Add "TERM cygwin".
1161
1162 2005-03-25  Jim Meyering  <jim@meyering.net>
1163
1164         * src/system.h (DECIMAL_DIGIT_ACCUMULATE): Reverse the sense of
1165         the return value, and update callers:
1166         * src/cut.c (set_fields): Update use of DECIMAL_DIGIT_ACCUMULATE.
1167         * src/expand.c (parse_tab_stops, main): Likewise.
1168         * src/split.c (main): Likewise.
1169         * src/unexpand.c (parse_tab_stops, main): Likewise.
1170         * src/uniq.c (main): Likewise.
1171
1172 2005-03-22  Jim Meyering  <jim@meyering.net>
1173
1174         * build-aux: New directory.  Renamed from config.
1175         * configure.ac: Reflect renaming: config -> build-aux.
1176         * Makefile.am (dist-hook): Likewise.
1177         * Makefile.maint: Likewise.
1178         * Makefile.cfg (cvs_files): Likewise.
1179         * .x-sc_sun_os_names: Likewise.
1180         * .x-sc_trailing_blank: Likewise.
1181
1182         * src/ls.c (get_funky_string): Use '\a', rather than 7, for
1183         portability to EBCDIC hosts.
1184
1185 2005-03-20  Jim Meyering  <jim@meyering.net>
1186
1187         * src/pr.c (init_header): Add missing `%' in new format string.
1188         (init_header): Use zero-filled `.%09d' format, not space-filled `.%9d'.
1189
1190 2005-03-19  Jim Meyering  <jim@meyering.net>
1191
1192         * src/Makefile.am (pr_LDADD): Now that pr uses gettime, add
1193         $(LIB_CLOCK_GETTIME) to get the required -lrt on newer Linux systems.
1194
1195 2005-03-18  Paul Eggert  <eggert@cs.ucla.edu>
1196
1197         * NEWS: pr -D "FORMAT" now accepts the same formats that
1198         date +"FORMAT" does.
1199         * src/pr.c: Include strftime.h, timespec.h.
1200         (init_header): Obtain and format nanosecond part of time stamp.
1201
1202         * NEWS: nohup now ignores the umask when creating nohup.out.
1203         nohup now closes stderr if it is a terminal and stdout is closed.
1204         * src/nohup.c (main): Likewise.  Be a little more paranoid about
1205         return values; e.g., check for any negative return from open.
1206         Assume free (NULL) works.
1207         Close file descriptor leak when redirecting standard output to a file.
1208
1209 2005-03-17  Jim Meyering  <jim@meyering.net>
1210
1211         * src/cut.c (set_fields): Use DECIMAL_DIGIT_ACCUMULATE macro,
1212         in place of functionally-equivalent code.
1213         * src/expand.c (parse_tab_stops, main): Likewise.
1214         * src/split.c (main): Likewise.
1215         * src/unexpand.c (parse_tab_stops, main): Likewise.
1216         * src/uniq.c (main): Likewise.
1217         * src/od.c: Use VERIFY macro in place of an equivalent open-coded
1218         declaration.
1219         * src/system.h (VERIFY, VERIFY_EXPR, DECIMAL_DIGIT_ACCUMULATE):
1220         New macros.
1221
1222         Before, this command would make uniq skip 11 fields and print
1223         only the first line:
1224         $ _POSIX2_VERSION=1 ./uniq -f1 -1 <(seq --format='1 %g' 2)
1225         1 1
1226         1 2
1227         * src/uniq.c (main): Interpret `uniq -f1 -1' like `uniq -f1',
1228         not like `uniq -f11'.
1229
1230 2005-03-15  Jim Meyering  <jim@meyering.net>
1231
1232         Both `pr -0' and e.g., `pr -03' would evoke `column count too large'.
1233         `pr -0' should give a better diagnostic and `pr -03' should be
1234         equivalent to `pr -3'.
1235         * src/pr.c (parse_column_count): Change return type to void.
1236         Call error (EXIT_FAILURE, ... for an invalid string.
1237         (main): Allocate space for column_count_string using malloc.
1238         Accumulate all old-style column-count digits before converting.
1239         When the number of columns is specified via both old-style,
1240         (e.g., -3), and a long option (--columns=5), ensure that only
1241         the last one specified takes effect.
1242         * tests/pr/Test.pm: Add tests for the above.
1243
1244 2005-03-15  Corinna Vinschen  <corinna@vinschen.de>  (tiny change)
1245
1246         * src/copy.c (copy_reg): Copy regular files in binary mode.
1247
1248 2005-03-14  Paul Eggert  <eggert@cs.ucla.edu>
1249
1250         * NEWS: Restate why ls limits time stamp lengths.
1251
1252 2005-03-12  Jim Meyering  <jim@meyering.net>
1253
1254         Add a little infrastructure to help prevent future bugs like the
1255         one fixed below.
1256         * src/stat.c (xstrcat): New function.
1257         (print_statfs, print_stat): Add buf_len parameter and convert all
1258         uses of strcat to xstrcat.  Update callers.
1259         (print_it): Call print_func with buf_len parameter.
1260
1261         Invoking stat -c FMT with a lone format directive of %s, %f, %h, %s,
1262         could cause a buffer overrun error.
1263         * src/stat.c (print_it): Allocate 2 more bytes, to accommodate our
1264         conversion of the stat %s format string to the longer printf %llu one.
1265         Patch from Guochun Shi.
1266
1267 2005-03-11  Paul Eggert  <eggert@cs.ucla.edu>
1268
1269         * src/ls.c (TIME_STAMP_LEN_MAXIMUM): New constant.
1270         (long_time_expected_width, print_long_format): Use it, to avoid
1271         some possible denial-of-service attacks.
1272         * NEWS: Document this.
1273
1274 2005-03-11  Jim Meyering  <jim@meyering.net>
1275
1276         Prompt once again for `mv -i A B' when A and B are hard links
1277         to the same file.  This fixes a bug introduced by my 2003-04-04
1278         (coreutils-5.0.1) change.  Reported by Thomas Wolff via Eric Blake.
1279         * src/copy.c (abandon_move): New function, factored out of
1280         copy_internal, now that this code is being used from two places.
1281         (copy_internal): Perform the same interactive-related test for
1282         whether it's alright to proceed and (usually) overwrite the
1283         destination file.
1284         * tests/mv/i-4: Add tests for the above.
1285
1286         Don't segfault for a very long date format string, e.g.,
1287         ls -ld --time-style=+%99999999H .
1288         * src/ls.c (long_time_expected_width): Use x2nrealloc, not alloca,
1289         so format string abuse cannot provoke stack overflow.
1290         (print_long_format): Likewise.
1291
1292         Don't segfault for a long header date string, e.g.,
1293         echo a|pr -D +%9999999A
1294         * src/pr.c (init_header): Use x2nrealloc, rather than alloca.
1295         Don't bother with fixed-sized initial buffer;  always use x*alloc.
1296
1297         * src/pr.c (init_header): Use slightly clearer INT_BUFSIZE_BOUND
1298         in place of equivalent INT_STRLEN_BOUND + 1.
1299         * src/expr.c (tostring, printv): Likewise.
1300
1301 2005-03-09  Paul Eggert  <eggert@cs.ucla.edu>
1302
1303         * src/system.h: Include intprops.h.
1304         (TYPE_SIGNED, TYPE_MINIMUM, TYPE_MAXIMUM, INT_STRLEN_BOUND): Remove;
1305         they are now defined in intprops.h.
1306
1307 2005-03-09  Jim Meyering  <jim@meyering.net>
1308
1309         * TODO: Remove entry about named pipes.  It was fixed in 5.3.0.
1310
1311 2005-03-08  Paul Eggert  <eggert@cs.ucla.edu>
1312
1313         * src/date.c (usage): Redo to match recent documentation changes.
1314         Don't bother documenting which usages are GNU extensions; the list
1315         wasn't correct, and is better left to the printed manual anyway.
1316
1317 2005-03-06  Jim Meyering  <jim@meyering.net>
1318
1319         Factor out column-count processing.
1320         * src/pr.c: Include "inttostr.h".
1321         (parse_column_count): New function.
1322         (main): Use the new function for both old-style, -9, and long,
1323         --columns=-9, options.
1324
1325         * src/cksum.c: Remove `register' keyword.
1326         * src/cut.c: Likewise.
1327         * src/dd.c: Likewise.
1328         * src/env.c: Likewise.
1329         * src/factor.c: Likewise.
1330         * src/fmt.c: Likewise.
1331         * src/fold.c: Likewise.
1332         * src/id.c: Likewise.
1333         * src/logname.c: Likewise.
1334         * src/ls.c: Likewise.
1335         * src/pr.c: Likewise.
1336         * src/printf.c: Likewise.
1337         * src/shred.c: Likewise.
1338         * src/sort.c: Likewise.
1339         * src/sum.c: Likewise.
1340         * src/test.c: Likewise.
1341         * src/tsort.c: Likewise.
1342         * src/uniq.c: Likewise.
1343         * src/wc.c: Likewise.
1344         * src/whoami.c: Likewise.
1345
1346 2005-03-01  Paul Eggert  <eggert@cs.ucla.edu>
1347
1348         * src/Makefile.am (nanosec_libs): Remove $(LIB_XANOSLEEP); no
1349         longer needed.
1350
1351 2005-03-01  Jim Meyering  <jim@meyering.net>
1352
1353         * src/copy.c (copy_internal): Change test of source type from
1354         !S_ISREG to S_ISLNK.  Reported by Paul Eggert in
1355         http://lists.gnu.org/archive/html/bug-coreutils/2004-10/msg00050.html.
1356
1357 2005-02-28  Jim Meyering  <jim@meyering.net>
1358
1359         * NEWS: Mention that xnanosleep fixes sleep failure on linux-2.6.8.1.
1360
1361 2005-02-21  Paul Eggert  <eggert@cs.ucla.edu>
1362
1363         * src/Makefile.am (dd_LDADD, shred_LDADD): Add $(LIB_GETHRXTIME).
1364         (nanosec_libs): Add $(LIB_XNANOSLEEP).  Needed for newer GNU/Linux
1365         hosts with clock_gettime.
1366
1367 2005-02-20  Paul Eggert  <eggert@cs.ucla.edu>
1368
1369         * NEWS: Describe user-visible change to dd.
1370         * src/Makefile.am (dd_LDADD, shred_LDADD, nanosec_libs):
1371         Remove $(LIB_CLOCK_GETTIME).  These functions now use
1372         gethrxtime instead.
1373         * src/dd.c: Include gethrxtime.h, xtime.h.
1374         (start_time): Now of type xtime_t, not struct timespec.
1375         (print_stats, main): Use gethrxtime rather than gettime.
1376         * src/ls.c (time): Remove obsolete decl.
1377         (get_current_time): gettimeofday always returns 0, so don't
1378         check its result.
1379         * src/shred.c: Include gethrxtime.h.
1380         (isaac_seed): Use gethrxtime rather than a mishmash.
1381         * src/touch.c (time): Remove obsolete decl.
1382
1383         * tests/misc/split-fail: Don't assume that the current host
1384         supports integers wider than 32 bits.  Fix comment typo.
1385         * tests/od/x8: Likewise.
1386
1387         * src/chown-core.c (enum RCH_status): Remove trailing comma,
1388         as it's not valid in standard C89.
1389
1390 2005-02-15  Jim Meyering  <jim@meyering.net>
1391
1392         * src/stat.c (human_fstype): Add case/definition for S_MAGIC_XFS
1393         so that file systems of type `xfs' are recognized as such.
1394         * src/fs.h: Regenerate.
1395         Reported by Bernd Eckenfels.
1396         * src/stat.c (human_fstype): Likewise for S_MAGIC_JFS/jfs.
1397         * src/fs.h: Regenerate.
1398         Reported by Andreas Schwab.
1399
1400         * src/nice.c (NZERO) [NZERO == 0]: Undefine and define to 20,
1401         to work around the invalid definition from Darwin 7.7.0.
1402         Test failure reported by Sébastien Maret.
1403
1404 2005-02-14  Paul Eggert  <eggert@cs.ucla.edu>
1405
1406         * src/sort.c (mergefps): Use binary search rather than linear one
1407         when comparing new line to lines already in main memory.
1408         Idea suggested by James Lemley.
1409
1410 2005-02-09  Jim Meyering  <jim@meyering.net>
1411
1412         * src/copy.c (valid_options): Add an assertion that
1413         not both hard_link and symbolic_link are set.
1414
1415 2005-02-08  Paul Eggert  <eggert@cs.ucla.edu>
1416
1417         * NEWS: Document stat -f -c %S, plus changes to default formats.
1418         * doc/coreutils.texi (stat invocation): Normalize terminology,
1419         capitalization, and sort order to match --help output.  Mention %c
1420         for file systems.  Add new -f -c format %S, and document %s versus %S;
1421         problem reported by Jeroen van Wolffelaar.
1422         * src/stat.c (usage): Likewise.
1423         (STATFS_FRSIZE): New macro.
1424         (print_statfs): Use it, for stat -f -c %S.
1425         (do_statfs): Change default formats to output %S.
1426
1427 2005-02-03  Paul Eggert  <eggert@cs.ucla.edu>
1428
1429         * src/system.h: Include "memrchr.h".
1430         (memrchr) [!HAVE_DECL_MEMRCHR]: Remove decl.
1431
1432 2005-02-02  Jim Meyering  <jim@meyering.net>
1433
1434         * tests/du/8gb: Also adjust the test (s/64/128/) to detect
1435         systems that don't support sparse files.
1436         Check for $2 -ge 128, rather than $2 = 128, in case
1437         there is a file system type that doesn't support sparse files,
1438         yet for which metadata takes up additional space.
1439         Both reported by Andreas Schwab.
1440
1441 2005-02-01  Eric Blake  <ebb9@byu.net>  (tiny change)
1442
1443         * tests/du/8gb: Create a larger test file, so we properly
1444         detect that sparse files can be created on NTFS under cygwin.
1445
1446 2005-01-30  Jim Meyering  <jim@meyering.net>
1447
1448         * src/head.c (elide_tail_bytes_pipe): Correct wording in diagnostic.
1449
1450         * src/stty.c: Remove unnecessary parentheses in all #if directives.
1451
1452 2005-01-29  Eric Blake  <ebb9@byu.net>  (tiny change)
1453
1454         * .cvsignore: Ignore config.cache and config.status.lineno.
1455         * src/stty.c [VSWTCH]: Some systems, like Cygwin, use VSWTC
1456         instead of VSWTCH, for use with CSWTCH.
1457
1458 2005-01-29  Eric Blake  <ebb9@byu.net>  (tiny change)
1459
1460         * tests/Makefile.am (.PHONY): Add check-root and root-hint.
1461         * tests/rwx-to-mode: Ignore ACL designation.
1462         * tests/setgid-check: Likewise.
1463         * tests/chown/separator: Quote user and group names.
1464
1465 2005-01-24  Jim Meyering  <jim@meyering.net>
1466
1467         * src/cp.c (usage): Merge the descriptions of --no-dereference and -P.
1468         Suggestion from Johan Boule.
1469
1470 2005-01-17  Eric Blake  <ebb9@byu.net>  (tiny change)
1471
1472         * src/Makefile.am (all_programs.list): Strip $(EXEEXT) and remove
1473         duplicates.
1474         * man/Makefile.am (all_programs): Revert previous patch; updated
1475         all_programs.list fixes this.
1476         (.x.1): No need to add $(EXEEXT).
1477
1478 2005-01-03  Corinna Vinschen  <corinna@vinschen.de>  (tiny change)
1479
1480         * src/system.h: Use S_BLKSIZE value for ST_NBLOCKSIZE where
1481         available.
1482
1483 2005-01-22  Jim Meyering  <jim@meyering.net>
1484
1485         * Makefile.maint (v_etc_file): The version string has moved to
1486         version-etc-fsf.c, search that new file, not version-etc.c.
1487
1488 2005-01-17  Paul Eggert  <eggert@cs.ucla.edu>
1489
1490         * tests/group-names: Use numeric group ids, not symbolic group names,
1491         since the latter can have shell metacharacters in them (e.g., spaces).
1492         Problem reported by Eric Blake.
1493         * tests/chgrp/basic: Assume groups are numeric, not symbolic.
1494         * tests/chgrp/deref: Likewise.
1495         * tests/chgrp/posix-H: Likewise.
1496         * tests/chgrp/recurse: Likewise.
1497
1498 2005-01-15  Jim Meyering  <jim@meyering.net>
1499
1500         * src/shred.c (isaac_seed) [HAVE_GETHRTIME]: #if-0 this block,
1501         because just calling gethrtime evokes an `illegal instruction'
1502         failure when compiled with Sun's c89 on Solaris 8 and 9.
1503         Reported by Nelson Beebe.
1504
1505         * src/shred.c (isaac_seed) [HAVE_GETHRTIME]: Don't call ISAAC_SEED
1506         twice with the same value of `t'.
1507         Replace nested #if-#else blocks with #if-#elif-#elif chain.
1508
1509 2005-01-14  Jim Meyering  <jim@meyering.net>
1510
1511         The test, tests/tail/f-1, failed on powerpc-apple-darwin7.7.0.
1512         * src/tail.c (IS_TAILABLE_FILE_TYPE): Adjust definition also to include
1513         sockets, since that's what you get when reading from a command-line-
1514         supplied pipe on Darwin 7.7.
1515         (IS_PIPE_LIKE_FILE_TYPE): Define.
1516         (main): Use new IS_PIPE_LIKE_FILE_TYPE rather than simply S_ISFIFO.
1517         Reported by Nelson Beebe.
1518         This same change is also required on NetBSD/sparc-1.5.
1519         Reported by Adrian Bunk.
1520
1521         * src/expr.c (toarith): Rewrite to detect/diagnose integer overflow,
1522         rather than suffering silently.
1523         Before, expr would silently overflow and wrap around:
1524           $ expr 9223372036854775808 = 0   # $(echo 2^63|bc)
1525           1
1526         Now it detects the problem and exits nonzero:
1527           $ ./expr $(echo 2^63|bc) = 0
1528           ./expr: 9223372036854775808: integer is too large
1529
1530         * tests/chown/separator (id_gn): Exit 77, not 1, for a test-framework
1531         failure, so that doesn't cause `make check' to stop.  Nelson Beebe
1532         reported that this test would fail with the diagnostic,
1533         `cannot find name for group ID 10', on one of his systems.
1534
1535 2005-01-13  Jim Meyering  <jim@meyering.net>
1536
1537         * src/test.c (is_int): Don't overflow when evaluating integer
1538         constants.  Before, ./test $(echo 2^64|bc) -eq 0 && echo FAIL
1539         would print `FAIL'.
1540
1541         * tests/Fetish.pm (run_tests): Add code (if-0'd out) to detect
1542         names of temporary files that would clash on 8.3 file systems.
1543         * tests/mk-script (validate): Likewise.
1544
1545 2005-01-12  Jim Meyering  <jim@meyering.net>
1546
1547         * tests/dd/skip-seek: Shorten test names to accommodate 8.3 systems.
1548
1549         * tests/tr/Test.pm (repeat-xC): Change test name from
1550         `repeat-Compl', to avoid 8.3 conflict with `repeat-compl'.
1551         Reported by Eric Blake.
1552         (repeat-000): Rename to `repeat-zeros' for the same reason.
1553
1554 2005-01-11  Jim Meyering  <jim@meyering.net>
1555
1556         * configure.ac: Update version to 5.3.1.
1557
1558 2005-01-11  Eric Blake  <ebb9@byu.net>
1559
1560         * src/Makefile.am (check-README, check-AUTHORS): Account for $(EXEEXT).
1561         * man/Makefile.am (all_programs): Account for $(EXEEXT).
1562
1563 2005-01-11  Jim Meyering  <jim@meyering.net>
1564
1565         * src/unexpand.c (add_tab_stop): Properly diagnose a tabstop list
1566         with decreasing values.
1567
1568         * src/expand.c (main): Likewise.
1569         * src/unexpand.c (main): Check for overflow in tabstop values
1570         specified via the obsolete form.  E.g., now this command fails:
1571         _POSIX2_VERSION=1 ./unexpand -$(echo '2^64+1'|bc)
1572         Before it would act like `_POSIX2_VERSION=1 ./unexpand -1'.
1573         * tests/unexpand/basic-1 (obs-ovflo): New test for this.
1574
1575 2005-01-10  Paul Eggert  <eggert@cs.ucla.edu>
1576
1577         Respond to POSIX interpretations about pathchk -p dated 2005-01-06.
1578         * NEWS: Document the changes.
1579         * doc/coreutils.texi (pathchk invocation): Likewise.
1580         * src/pathchk.c (PORTABILITY_OPTION): New constant.
1581         (longopts, usage, main, validate_file_name):
1582         Add support for new -P option.
1583         Reject empty file names (unless -p is not specified and the
1584         current system allows empty file names).
1585         Change --portability so that is now equivalent to -p -P.
1586         Don't test whether file name is too long, if it is known to exist.
1587         (no_leading_hyphen): New function.
1588         * tests/misc/pathchk1: Add tests for empty file names and
1589         pathchk -P.
1590
1591 2005-01-08  Jim Meyering  <jim@meyering.net>
1592
1593         * Version 5.3.0.
1594
1595         `pr --columns=N' was not equivalent to `pr -N' when also using
1596         either -s or -w.
1597
1598         * src/pr.c (main): Set `explicit_columns' for --columns=N,
1599         not just for -N.  This bug has existed since the introduction
1600         of the --columns=N option on 1998-08-15.
1601         * NEWS: Document this.
1602         * tests/pr/Test.pm (test_vector): For each -N test, automatically
1603         create a new test vector using --columns=N.
1604
1605 2005-01-07  Paul Eggert  <eggert@twinsun.com>
1606
1607         * src/pr.c (main): Check for column count overflow with
1608         usages like "pr -2147483648".
1609
1610 2005-01-07  Jim Meyering  <jim@meyering.net>
1611
1612         * src/pr.c (init_fps): Use xnmalloc, rather than xmalloc.
1613
1614 2005-01-06  Jim Meyering  <jim@meyering.net>
1615
1616         * README: List the precise HP-UX version numbers that are affected.
1617         Suggestion from Bob Proulx.
1618
1619         * Makefile.maint (sc_changelog): Specify find's `-maxdepth 2'
1620         predicate before `-name ChangeLog' to avoid a harmless warning
1621         from find-4.2.10.
1622
1623 2005-01-05  Jim Meyering  <jim@meyering.net>
1624
1625         * tests/help-version: Punt on the uptime test, since it fails when
1626         it can't get boot time, and I don't want that to stop `make check'.
1627
1628         * src/du.c (process_file): Evaluate exclusion rules against
1629         the entire file name, not just the last component.
1630         Reported by Robert Lindgren.
1631         * tests/du/exclude: Test for this.
1632         * NEWS: Document this.
1633
1634         Ensure that tests/Makefile.am's check-root actions stay up to date.
1635         * Makefile.maint (sc_root_tests): New rule.
1636         (syntax-check-rules): Add it to the list.
1637
1638 2005-01-04  Jim Meyering  <jim@meyering.net>
1639
1640         * man/shred.x: Change one-line summary to reflect that shred does
1641         not remove files by default.  Suggestion from Helen Faulkner in
1642         http://bugs.debian.org/288552
1643
1644         * README: Request VERBOSE=yes output when reporting test failures.
1645         Other minor changes.
1646
1647         * tests/Makefile.am (check-root): Update.
1648
1649 2005-01-03  Paul Eggert  <eggert@cs.ucla.edu>
1650
1651         * src/system.h: Undo previous change; we now use Autoconf.
1652
1653 2005-01-03  Jim Meyering  <jim@meyering.net>
1654
1655         * tests/stty/row-col-1: Don't set rows or columns to zero, to avoid
1656         a bug in the TIOCGWINSZ ioctl on at least Solaris5.9 systems.  Setting
1657         either (or both) to zero would succeed, but subsequent `stty size'
1658         would say `no size information for this device' due to the ioctl
1659         failing with EINVAL.
1660
1661         * src/system.h: If PRIdMAX, PRIoMAX, PRIuMAX, and PRIxMAX are
1662         not all defined and either ULONG_MAX or ULLONG_MAX is not defined,
1663         then fail at compile-time rather than let tools like od produce
1664         invalid results at run time.
1665
1666 2004-12-21  Jim Meyering  <jim@meyering.net>
1667
1668         * src/csplit.c (usage): Say the default names are `xx00, xx01, ...',
1669         not `xx01, xx02, ...'.
1670         Reported by Matt Kraai in http://bugs.debian.org/286605
1671
1672         * tests/misc/split-fail: Avoid spurious failure on x86 Solaris5.9
1673         when using c89.
1674
1675 2004-12-20  Paul Eggert  <eggert@cs.ucla.edu>
1676
1677         * src/split.c (usage): Mention default size.  Suggested by Dan Jacobson.
1678
1679 2004-12-19  Paul Eggert  <eggert@cs.ucla.edu>
1680
1681         * NEWS: Mention that one should eval "`dircolors`" rather than
1682         `dircolors`.
1683
1684 2004-12-17  Jim Meyering  <jim@meyering.net>
1685
1686         * tests/mv/hard-link-1: Rearrange to use newer trap-handling code,
1687         so temporary directories aren't left behind upon e.g., interrupt.
1688
1689 2004-12-16  Paul Eggert  <eggert@cs.ucla.edu>
1690
1691         * src/ls.c (print_dir): Use "%s: not listing already-listed
1692         directory", not "not listing already-listed directory: %s", to
1693         format already-listed directories, to be consistent with other
1694         diagnostics involving file names and colons.
1695
1696 2004-12-15  Jim Meyering  <jim@meyering.net>
1697
1698         * src/Makefile.am (__LDADD): Define, so that building `[' on
1699         Solaris still uses the -lgen library that it requires in order
1700         to get a definition of eaccess.
1701
1702 2004-12-14  Jim Meyering  <jim@meyering.net>
1703
1704         tac would exit immediately upon I/O or temp-file creation failure.
1705         Now it continues on, processing any remaining command line arguments.
1706
1707         * src/tac.c: Include quotearg.h.
1708         Use quotearg_colon in most diagnostics.
1709         (copy_to_temp): Rewrite not to exit upon I/O or temp-file-creation
1710         failure.  Before, this command (with /full/tmp being a full partition)
1711           TMPDIR=/full/tmp ./tac /proc/modules tac.c
1712         would exit immediately upon the write error while trying to copy
1713         non-seekable /proc/modules to the full partition.  Now it still
1714         reports the failure but continues on with the remaining file.
1715         (tac_nonseekable): Return false also if copy_to_temp fails.
1716         [DONT_UNLINK_WHILE_OPEN]: Add a FIXME comment explaining that
1717         using atexit like this is wrong.
1718         * NEWS: Document this.
1719         * tests/misc/tac-continue: New test for this.
1720         * tests/misc/Makefile.am (TESTS): Add tac-continue.
1721
1722         * tests/chown/basic: Add a few more tests.
1723
1724 2004-12-13  Paul Eggert  <eggert@cs.ucla.edu>
1725
1726         * src/ls.c (gobble_file): Change arg name to be command_line_arg
1727         rather than explicit_arg, for consistency with copy.c.
1728         (extract_dirs_from_files): Remove ignore_dot_and_dot_dot arg, since
1729         it is deducible from dirname arg.  All callers changed.
1730         (extract_dirs_from_files, print_dir, queue_directory):
1731         Add command_line_arg arg.  All callers changed.
1732         (struct pending): Add command_line_arg member.
1733         (main): Use NULL rather than 0 when appropriate.
1734         (set_exit_status, file_failure): New functions.
1735         (queue_directory): Store command_line_arg into new structure.
1736         (print_dir, gobble_file, get_link_name):
1737         Use file_failure to report problems in accessing files,
1738         so that the exit status is set consistently.
1739         (print_dir): Simplify readdir failure code yet again.
1740         If closedir fails, report "closing directory" rather than "reading
1741         directory" failure.
1742         (xstrcoll): Use set_exit_status to set status on failure.
1743         * tests/ls-2/tests (no-a-isdir-b): This now exits with status 2,
1744         not status 1.
1745
1746 2004-12-11  Jim Meyering  <jim@meyering.net>
1747
1748         Avoid a race condition vulnerability in chown, when used with
1749         --from=O:G and without the (-h) --no-dereference option.
1750         * src/chown-core.c (restricted_chown): New function.
1751         (change_file_owner): Call it.
1752         Reported by Ulrich Drepper.
1753         * NEWS: Mention this.
1754
1755 2004-12-09  Paul Eggert  <eggert@cs.ucla.edu>
1756
1757         * ls now exits with status 1 on minor problems, 2 if serious trouble.
1758         * NEWS: Document this.
1759         * src/ls.c (LS_MINOR_PROBLEM, LS_FAILURE): New constants.
1760         All uses of EXIT_FAILURE replaced with LS_FAILURE, unless
1761         specified below.
1762         (main): Initialize exit failure to LS_FAILURE.
1763         (print_dir, gobble_file, get_link_name, xstrcoll):
1764         Set exit status to LS_MINOR_PROBLEM if the failure is minor.
1765         (print_dir): Do not give up on entire directory merely because readdir
1766         returns EOVERFLOW.
1767         (usage): Explain exit status.
1768         * tests/help-version: ls and variants now exit with status 2
1769         on serious trouble.
1770
1771 2004-12-08  Paul Eggert  <eggert@cs.ucla.edu>
1772
1773         * NEWS: Document new UTC+HH:MM date syntax, and put date changes
1774         together.
1775
1776 2004-12-07  Paul Eggert  <eggert@cs.ucla.edu>
1777
1778         * src/factor.c (factor): Don't list 1 as a factor of 1.
1779         Problem reported by Thomas Folz-Donahue.
1780
1781 2004-12-06  Jim Meyering  <jim@meyering.net>
1782
1783         * tests/du/files0-from: Sanitize environment.
1784         Otherwise, e.g., BLOCKSIZE=k would cause a failure, and that
1785         setting is the default (exported from /etc/profile) on at least one
1786         NetBSD 1.6 system.
1787         * tests/du/no-deref: Likewise.
1788         * tests/cp/symlink-slash: Likewise.
1789         * tests/ls/symlink-slash: Likewise
1790
1791 2004-12-05  Jim Meyering  <jim@meyering.net>
1792
1793         * tests/tail/Test.pm (err-6) ["tail -c"]: Avoid test failure when
1794         _POSIX2_VERSION=199209 is in the environment, or when building on
1795         e.g., OpenBSD 3.2.
1796
1797 2004-12-04  Jim Meyering  <jim@meyering.net>
1798
1799         * NEWS: Mention cut's new --complement option.
1800
1801 2004-10-01  Paolo Bonzini  <bonzini@gnu.org>
1802
1803         * cut.c (complement, COMPLEMENT_OPTION): New.
1804         (longopts): Add --complement.
1805         (usage): Say not that -b, -c, and -f `print' fields,
1806         but rather that they `select' fields for printing.
1807         Describe the new --complement option.
1808         (mark_range_start): Extracted from set_fields.
1809         (print_kth): Support --complement.
1810         (compare_ranges): New function.
1811         (set_fields): Rewrite the part that populates range_start_ht,
1812         merging it with the part that populates printable_field.
1813         (main): Handle --complement.
1814
1815 2004-12-03  Paul Eggert  <eggert@cs.ucla.edu>
1816
1817         * src/tail.c (tail_file): Set errnum to -1 if the initial "tail"
1818         failed.  This works around an assertion failure reported by
1819         Roberto Nibali in:
1820         http://lists.gnu.org/archive/html/bug-coreutils/2004-12/msg00012.html
1821
1822 2004-12-02  Jim Meyering  <jim@meyering.net>
1823
1824         With using --color and with LS_COLORS saying not to color
1825         executables, don't stat every file.
1826         * src/ls.c (is_colored): New function.
1827         (gobble_file): Use it.
1828         (main): Use it here, in place of too-strict tests against NULL:
1829         if either ORPHAN or MISSING was set to 0 from LS_COLORS, the
1830         old test would fail.
1831
1832 2004-12-01  Paul Eggert  <eggert@cs.ucla.edu>
1833
1834         * src/comm.c (compare_files): Assume setlocale exists.
1835         * src/join.c (keycmp): Likewise.
1836         * src/seq.c (decimal_point): Treat like sort.  Now char.
1837         All uses changed.
1838         (main): Assume localeconv exists.  Use same code as sort.
1839         * src/sort.c (C_DECIMAL_POINT): Remove.  Use changed to '.'.
1840         Assume setlocale exists.
1841         (thousands_sep): Renamed from th_sep.
1842         (IS_THOUSANDS_SEP): Remove.  All uses replaced by comparisons.
1843         (NONZERO): Parenthesize use of arg.
1844         (numcompare): Avoid duplicate loads.  Use ISDIGIT as boolean, for
1845         consistency.  Avoid unnecessary negation by reversing
1846         fraccompare args.
1847         (main): Rewrite localeconv call to match seq.c.
1848         * src/system.h: Assume locale.h exists.
1849         (HAVE_SETLOCALE): Remove.
1850         * src/uniq.c (different): Assume setlocale exists.
1851
1852         * src/ls.c (sort_files): Minor cleanup.  Remove an unnecessary
1853         'volatile' on a local variable.  Rewrite to avoid unnecessary
1854         double-assignment to 'func' in the usual case where strcoll does
1855         not fail.
1856
1857 2004-11-30  Paul Eggert  <eggert@cs.ucla.edu>
1858
1859         * src/pinky.c (gethostname): Remove decl.
1860         (scan_entries): Use IS_USER_PROCESS instead of by-hand code.
1861         * src/uptime.c (print_uptime): Use IS_USER_PROCESS and
1862         UT_TYPE_BOOT_TIME instead of by-hand code.
1863         * src/users.c (list_entries_users): Use IS_USER_PROCESS
1864         instead of by-hand code.
1865         * src/who.c (USER_PROCESS, RUN_LVL, INIT_PROCESS, LOGIN_PROCESS,
1866         DEAD_PROCESS, BOOT_TIME, NEW_TIME, UT_TYPE_UNDEF, UT_TYPE): Remove.
1867         (IS_USER_PROCESS): Move to ../lib/readutmp.h.
1868         (UT_TYPE_RUN_LVL, UT_TYPE_INIT_PROCESS, UT_TYPE_LOGIN_PROCESS,
1869         UT_TYPE_DEAD_PROCESS, UT_TYPE_NEW_TIME): New macros.
1870         (gethostname): Remove decl.
1871         (list_entries_who, scan_entries): Use the new macros defined above,
1872         for consistency with pinky, uptime, and users.
1873
1874 2004-11-25  Paul Eggert  <eggert@cs.ucla.edu>
1875
1876         Fix problem reported by Scott S. Tinsley for HP-UX 11.11 using
1877         HP's ANSI C compiler.  Declaring int functions causes warnings on
1878         some modern systems and shouldn't be needed to compile on ancient
1879         ones.
1880         * src/copy.h (stat, lstat, rename): Remove decls.
1881         * src/install.c (stat): Remove decl.
1882         * src/ln.c (link, symlink): Remove decls.
1883
1884 2004-11-25  Jim Meyering  <jim@meyering.net>
1885
1886         * man/help2man: Import help2man-1.35.1.
1887         * man/Makefile.am (.x.1): Remove now-unnecessary use of
1888         locally-added --program-name=NAME option.  Now, help2man gets
1889         the name from the [NAME] section (i.e. from our .x file).
1890         * man/install.x: Use `install', not `ginstall' in the one-line
1891         description.  Reported by Brendan O'Dea.
1892         * man/sha1sum.x: Use `sha1sum', not `shasum'.
1893
1894 2004-11-24  Jim Meyering  <jim@meyering.net>
1895
1896         Since the changes of 2004-05-22, the u.saved_cwd member at
1897         the bottom of the active-directory stack was no longer
1898         strictly necessary.  This change removes that member and uses
1899         the newer cwd_state parameter for the final restore_cwd.
1900
1901         * src/remove.c (struct AD_ent) [u]: Remove now-unnecessary union.
1902         [dev_ino]: Rename from `a'.
1903         (AD_pop_and_chdir): Add a parameter to play the role of just-removed
1904         bottom-of-stack cwd-state member.
1905         (AD_pop_and_chdir): No longer return boolean.  Adjust caller.
1906         (AD_push_initial): Remove CWD parameter.  Adjust caller.
1907
1908 2004-11-23  Paul Eggert  <eggert@cs.ucla.edu>
1909
1910         Minor performance improvements and cleanups for "touch".
1911         * src/touch.c (posix_date): Remove; not needed as a static var.
1912         All uses rewritten.
1913         (touch): Use new futimens function to operate more efficiently
1914         in some cases.  Don't stat/fstat existing file when
1915         (!amtime_now && change_times == (CH_ATIME | CH_MTIME)); the
1916         old time stamps aren't needed in that case.
1917         (main): change_times is int, not bool.  Simplify test for
1918         change_times.
1919
1920 2004-11-20  Paul Eggert  <eggert@cs.ucla.edu>
1921
1922         * src/install.c (usage): Avoid usage that runs afoul of Docbook
1923         translation.  Problem reported by Eric S. Raymond.
1924
1925         Restore dd's noctty flag, reverting the change of 2004-04-08.
1926         POSIX does not allow "dd" to use O_NOCTTY by default.
1927         * NEWS: Add noctty flag to dd.
1928         * doc/coreutils.texi (dd invocation): Likewise.
1929         * src/dd.c (flags, usage, main): Likewise.
1930
1931 2004-11-19  Alfred M. Szmidt  <ams@gnu.org>
1932
1933         * src/ls.c (usage): Clarified description of --no-group (-G),
1934         --human-readable (-h), --inode (-i), --size (-s), --time,
1935         and --time-style.
1936
1937 2004-11-19  Jim Meyering  <jim@meyering.net>
1938
1939         * src/ls.c (usage): Clarify description of --author.
1940         Tweak indentation so that help2man creates better nroff.
1941         Reported by Dan Jacobson.
1942
1943         * src/uniq.c (check_file): Don't check stdout for errors here.
1944
1945         * src/pwd.c (find_dir_entry): Update comment to match reality.
1946
1947 2004-11-18  Jim Meyering  <jim@meyering.net>
1948
1949         * src/pwd.c (robust_getcwd): Correct the comment: this function
1950         constructs the directory name.  The caller prints it.
1951
1952 2004-11-16  Paul Eggert  <eggert@cs.ucla.edu>
1953
1954         * src/stat.c (STATFS): New macro, for portability to Solaris 9.
1955         (do_statfs): Use it.
1956
1957         * src/basename.c, src/chroot.c, src/cksum.c, src/dd.c, src/dirname.c,
1958         src/factor.c, src/hostid.c, src/hostname.c, src/link.c, src/logname.c,
1959         src/nohup.c, src/printenv.c, src/pwd.c, src/setuidgid.c, src/sleep.c,
1960         src/sync.c, src/tsort.c, src/unlink.c, src/uptime.c, src/users.c,
1961         src/whoami.c, src/yes.c (main): Use getopt_long rather than getopt.
1962         * src/readlink.c (main): argv is not const.
1963
1964         * src/cut.c (usage): Improve documentation along the lines suggested
1965         by Debian 5.2.1-2.
1966         * src/echo.c (usage): Likewise.
1967         * src/expr.c (usage): Likewise.
1968
1969         * src/dircolors.hin: Add putty, screen-bce.
1970
1971         * src/pinky.c (print_entry): Fix memory leak.
1972         * src/who.c (print_user): Likewise.
1973
1974 2004-11-15  Paul Eggert  <eggert@cs.ucla.edu>
1975
1976         * NEWS: New dd operand "status=noxfer".
1977         * src/dd.c (C_ASCII, C_EBCDIC, C_IBM, C_BLOCK, C_UNBLOCK,
1978         C_LCASE, C_UCASE, C_SWAB, C_NOERROR, C_NOTRUNC, C_SYNC, C_TWOBUFS,
1979         C_NOCREAT, C_EXCL, C_FDATASYNC, C_FSYNC): Now constants, not
1980         macros.
1981         (STATUS_NOXFER, statuses): New constants.
1982         (usage, print_stats, scanargs): Add support for status=noxfer.
1983         (usage): Update status output to match new behavior.
1984         (print_stats): Always output complete byte count.
1985         Put space between numbers and units, as SI requires.
1986         Use ngettext so that i18n can use plurals for "byte" and "second".
1987         Don't multiply by 1e-9 (inexact); divide by 1e9 (which is exact).
1988         (iflag_error_msgid, oflag_error_msgid): Remove; replace uses by
1989         the string.
1990         * tests/dd/skip-seek (@Tests): Use status=noxfer to avoid
1991         problems with regression testing.
1992
1993 2004-11-14  Paul Eggert  <eggert@cs.ucla.edu>
1994
1995         * NEWS: dd now outputs total bytes, seconds, and bytes per second.
1996         * src/Makefile.am (dd_LDADD): Add $(LIB_CLOCK_GETTIME).
1997         * src/dd.c: Include "human.h".
1998         (w_bytes, start_time): New vars.
1999         (usage): Document new I/O statistics output
2000         (print_stats): Output new I/O statistics.
2001         (cleanup): Do statistics after closing stdin and stdout, so that
2002         the times are more accurate.
2003         (write_output, dd_copy): Count output bytes.
2004         (main): Get initial value of clock.
2005
2006 2004-11-14  Jim Meyering  <jim@meyering.net>
2007
2008         Backslash-escape `-'s in email addresses, so that they are
2009         rendered properly in UTF-locales.
2010         * man/help2man (escape_hyphens): New function.
2011         (main): Call it on email addresses.
2012
2013         * src/sort.c (zaptemp): Mark new diagnostic for translation.
2014
2015         * tests/misc/close-stdout: New file.  Test today's closeout.c change.
2016         * tests/misc/Makefile.am (TESTS): Add close-stdout.
2017
2018 2004-11-13  Jim Meyering  <jim@meyering.net>
2019
2020         * src/test.c (usage): Put the description of `[-n] STRING'
2021         on two lines, one for `-n STRING' and one for `STRING' so that
2022         help2man properly escapes the `-'.  Otherwise, the hyphen is
2023         rendered inappropriately in UTF-8 locales.
2024         Reported by Uwe Zeisberger in http://bugs.debian.org/281069.
2025
2026 2004-11-12  Paul Eggert  <eggert@cs.ucla.edu>
2027
2028         * NEWS: Document the following changes.
2029
2030         * src/sort.c: Avoid O(N**2) behavior when there are many temporary
2031         files.
2032         (temptail): New variable, so that we can easily append to list.
2033         (create_temp_file): Create new files at end of list, so that
2034         searching the list has O(N*NMERGE) behavior instead of O(N**2).
2035         (zaptemp): Update temptail if needed.
2036         (mergefps, merge): Accept new arg that counts temp files, and keep it
2037         up to date as we create and remove temporaries.  This is for
2038         efficiency, so that we don't call zaptemp so often.
2039         All callers changed.
2040         (sort): Don't create array in reverse order, since the list of
2041         temporaries is now in the correct order.
2042
2043         (zaptemp): Protect against race condition: if 'sort' is
2044         interrupted in the middle of zaptemp, it might unlink the
2045         temporary file twice, and the second time this happens the file
2046         might already have been created by some other process.
2047
2048         (zaptemp): Warn if a temporary file is not removed.
2049
2050         (create_temp_file): Use offsetof for clarity.
2051         (die): Move it up earlier, to clean up the code a bit.
2052
2053         * src/pr.c (strtoumax): Declare if not declared.
2054         (skip_to_page, first_page_number, last_page_number, page_number,
2055         first_last_page, print_header):
2056         Use uintmax_t for page numbers.
2057         (first_last_page): Remove unnecessary forward declaration.
2058         Do not modify arg (it is now a const pointer).
2059         Return a true if successful, false (without print a diagnostic)
2060         otherwise.
2061         (main): If +XXX does not specify a valid page range, treat it
2062         as a file name.  This follows the response to Open Group XCU ERN 41
2063         <http://www.opengroup.org/sophocles/show_mail.tpl?source=L&listname=austin-group-l&id=7717>,
2064         which says the behavior is allowed.
2065         (skip_to_page): When starting page number exceeds page count,
2066         print both numbers in the diagnostic.
2067         (print_header): Detect page number overflow.
2068
2069 2004-11-07  Jim Meyering  <jim@meyering.net>
2070
2071         * src/uname.c [__APPLE__]: Include <mach/machine.h> and <mach-o/arch.h>.
2072         (main) [__APPLE__]: Get the processor type via syscall rather than
2073         hard-coding "powerpc".  From Toby Peterson.
2074
2075         * src/sort.c (merge): Remove declarations of now-unused variables.
2076
2077 2004-11-06  Paul Eggert  <eggert@cs.ucla.edu>
2078
2079         * src/sort.c (first_same_file): Remove.  Move most of the code to....
2080         (avoid_trashing_input): New function.
2081         (merge): Avoid some silly merges, e.g., copying a single file to
2082         a temporary file when there are exactly 17 input files to merge.
2083         Take a count of temporary files rather than a max_merge arg.
2084         All uses changed.
2085
2086 2004-11-06  Jim Meyering  <jim@meyering.net>
2087
2088         * src/sort.c (xfclose): Don't close stdout here (just flush it),
2089         since close_stdout now closes stdout unconditionally.
2090
2091 2004-11-05  Paul Eggert  <eggert@cs.ucla.edu>
2092
2093         * src/sort.c (inittables, sort_buffer_size, getmonth, mergefps,
2094         first_same_file, merge, sort, main): Use size_t for indexes to arrays.
2095         This fixes some unlikely havoc-wreaking bugs (e.g., more than INT_MAX
2096         temporary files).
2097         (getmonth, keycompare, compare): Rewrite to avoid need for alloca,
2098         thus avoiding unchecked stack overflow in some cases.  As a side
2099         effect this improve the performance of "sort -M" by a factor of 4
2100         on my benchmarks.
2101
2102 2004-11-03  Paul Eggert  <eggert@cs.ucla.edu>
2103
2104         * src/stty.c: Include "vasprintf.h" since we use vasprintf now.
2105
2106         * src/Makefile.am (check-AUTHORS): Don't assume \? works in a sed
2107         expression; it's not portable.  Problem reported by Albert Chin.
2108         Don't invoke a program more than once.
2109         * src/groups.sh (version): New variable, containing author info,
2110         for benefit of AUTHORS check.  Use it when acting on --version option.
2111         * AUTHORS: Remove duplicate lines.  Remove bogus "chroot:"
2112         in groups line.
2113
2114         * src/system.h: Don't #define and #undef getopt around <stdlib.h>,
2115         as this breaks the new regime that does "#define getopt rpl_getopt".
2116         Problem reported by Albert Chin for Solaris 9 with Sun cc in:
2117         http://lists.gnu.org/archive/html/bug-gnulib/2004-11/msg00019.html
2118         I suppose this may cause problems on ancient hosts with
2119         incompatible getopt declarations, but we'll cross that bridge if
2120         the problem gets reported to us by someone who can test the fix.
2121
2122 2004-11-03  Jim Meyering  <jim@meyering.net>
2123
2124         * src/tac.c: quote(...) file names in diagnostics.
2125
2126 2004-10-29  Paul Eggert  <eggert@cs.ucla.edu>
2127
2128         * NEWS: Document getdate changes.
2129
2130 2004-10-29  Jim Meyering  <jim@meyering.net>
2131
2132         * src/tac.c (tac_file): Remove temporary prototype and move this
2133         function `down' so that it precedes definition of tac_nonseekable.
2134
2135         `tac /proc/modules' would print nothing
2136         Reported by Harald Dunkel in http://bugs.debian.org/278604.
2137
2138         * src/tac.c (copy_to_temp): Renamed from save_stdin, since
2139         now it copies a general file descriptor, not just stdin.
2140         (tac_nonseekable): Renamed/adapted from tac_stdin.
2141         (tac_file): Get fd via `open' directly rather than via fopen/fileno,
2142         since we never used the stream.  Perform "-" to stdin mapping here
2143         rather than in main.  Determine whether a file is seekable,
2144         by trying to `lseek' to its end, and dispatch to tac_seekable or
2145         tac_nonseekable accordingly.
2146         (main): Rewrite argument handling now that it uses only tac_file.
2147         * NEWS: Mention it here.
2148
2149 2004-10-21  Jim Meyering  <jim@meyering.net>
2150
2151         * tests/mv/leak-fd: New file.
2152         * tests/mv/Makefile.am (TESTS): Add it.
2153         * tests/rm/dot-rel: New file.
2154         * tests/rm/Makefile.am (TESTS): Add it.
2155
2156         Correct my patch of 2004-10-18.
2157         * src/remove.c (rm): Destroy the saved_cwd here (via cwd_state),
2158         if necessary, not in remove_dir.  Otherwise, removing multiple
2159         `.'-relative nonempty directories no longer worked.
2160
2161 2004-10-20  Paul Eggert  <eggert@cs.ucla.edu>
2162
2163         * src/fmt.c (usage): Improve description of --prefix.
2164         Problem reported by Edward Welbourne.
2165
2166         * man/uniq.x: Change summary so that it doesn't imply that
2167         uniq writes to its input file.  Problem reported by
2168         Dan Jacobson.
2169
2170 2004-10-18  Jim Meyering  <jim@meyering.net>
2171
2172         Plug a leak that would cause a cross-device mv to fail when
2173         operating on too many command-line-specified nonempty directories.
2174         * src/remove.c (remove_dir): Destroy the `struct saved_cwd' on the
2175         top of the stack before returning.  This usually closes the file
2176         descriptor that was used to return to the original working directory.
2177         Reported by Cyril Bouthors in
2178         http://article.gmane.org/gmane.comp.gnu.core-utils.bugs/3048
2179         * NEWS: Mention it here.
2180
2181         * src/pathchk.c (validate_file_name): Give a more descriptive
2182         diagnostic when pathconf fails.  This also avoids an unwarranted
2183         warning from gcc-3.3.5 about a format not being a string literal.
2184
2185         * src/sleep.c (main): Remove declaration of unused local, c.
2186         * src/printenv.c (main): Likewise.
2187         * src/logname.c (main): Likewise.
2188         * src/uptime.c (main): Likewise, for optc.
2189         * src/tsort.c (main): Likewise, for opt.
2190
2191 2004-10-17  Paul Eggert  <eggert@cs.ucla.edu>
2192
2193         * AUTHORS: Add self to pathchk.
2194         * src/pathchk.c (AUTHORS): Add self.
2195         Change "path" to "file name" whenever possible.
2196         Remove usage comment, as it was a duplication of the code or doc.
2197         Include <wchar.h> if available.
2198         (mbrlen, mbstate_t) [! (HAVE_MBRLEN && HAVE_MBSTATE_T)]: Define.
2199         (NEED_PATHCONF_WRAPPER, PATH_MAX, PATH_MAX_FOR, NAME_MAX,
2200         pathconf_wrapper, portable_chars, dir_ok): Remove.
2201         (NAME_MAX_MINIMUM, PATH_MAX_MINIMUM): New macros.
2202         (pathconf, _PC_NAME_MAX, _PC_PATH_MAX): Define if nonexistent.
2203         (portable_chars_only): New arg FILELEN.
2204         Don't assume ASCII; we might be on an EBCDIC host.
2205         Don't assume unibyte locale in diagnostic.
2206         (component_start, component_len): New functions.
2207         (validate_file_name): Renamed from validate_path.  All uses changed.
2208         Pretty much a complete rewrite.
2209         Don't make copy of file arg.  Always append trailing slash to
2210         pathconf arg, just in case it's a symlink (this is pure paranoia;
2211         we don't know of any hosts where the trailing slash is required).
2212         Use size_t instead of long int when possible.
2213         Avoid need to call pathconf in most practical cases.
2214         Don't use euidaccess several times to test searchability;
2215         just use lstat once.  Reword diagnostic to put the (often very long)
2216         file names last.
2217
2218 2004-10-15  Paul Eggert  <eggert@cs.ucla.edu>
2219
2220         * src/printf.c (usage): Mention Unicode, and use H for hex digits.
2221
2222 2004-10-13  Jim Meyering  <jim@meyering.net>
2223
2224         * NEWS: Mention today's fts.c fix.
2225
2226 2004-10-13  Paul Eggert  <eggert@cs.ucla.edu>
2227
2228         * tests/stty/row-col-1: Set LC_ALL=C.
2229
2230 2004-10-12  Jim Meyering  <jim@meyering.net>
2231
2232         * src/dircolors.hin: Add .flac and .mpc as audio suffixes.
2233         From Jesus Climent in http://bugs.debian.org/276149.
2234
2235 2004-10-05  Paul Eggert  <eggert@cs.ucla.edu>
2236
2237         * src/ls.c (ignore_mode): Renamed from ignore, to avoid shadowing
2238         problems.  All uses changed.
2239
2240 2004-10-05  Jim Meyering  <jim@meyering.net>
2241
2242         * .x-sc_trailing_blank: Add an exclusion for config/texinfo.tex,
2243         since Karl says its trailing blanks are there to stay :-)
2244
2245 2004-10-04  Paul Eggert  <eggert@cs.ucla.edu>
2246
2247         * src/expr.c (NEW, OLD): Remove, partly to avoid
2248         reference to obsolescent macro XMALLOC.
2249         All uses replaced by xmalloc and free.
2250
2251 2004-09-28  Jim Meyering  <jim@meyering.net>
2252
2253         * src/tail.c (usage): Clarify: --retry works only with --follow=name.
2254         Reported by Nik A. Melchior in http://bugs.debian.org/273781.
2255
2256 2004-09-27  Paul Eggert  <eggert@cs.ucla.edu>
2257
2258         * src/od.c (format_address_paren): c is optional, so don't output
2259         it if it's '\0'.
2260
2261 2004-09-26  Paul Eggert  <eggert@cs.ucla.edu>
2262
2263         Add support for ls --hide.  Idea suggested by Bardur Arantsson.
2264         * NEWS: Document this.
2265         * src/ls.c (file_ignored): Renamed from file_interesting, with
2266         inverted return value.  Accept the file name, not a struct dirent *.
2267         All uses changed.  Avoid the expense of calling fnmatch if the
2268         file is ignorable due to leading '.'.
2269         (all_files, really_all_files): Removed; replaced by:
2270         (ignore): New variable.  All uses changed.
2271         (IGNORE_DEFAULT, IGNORE_DOT_AND_DOTDOT, IGNORE_MINIMAL, HIDE_OPTION):
2272         New constants.
2273         (hide_patterns): New variable.
2274         (long_options, decode_switches, file_ignored, usage):
2275         Add support for --hide.
2276         (patterns_match): New function.
2277         (usage): Replace "hide" with "ignore" in explanation, to avoid
2278         confusion.
2279
2280 2004-09-25  Paul Eggert  <eggert@cs.ucla.edu>
2281
2282         * src/ls.c (gobble_file, print_long_format): Don't assume that
2283         human-readable output has a byte count equal to its column width;
2284         this isn't always true in locales where the radix character is not
2285         '.' or ','.
2286         (format_user_or_group): Revamp code to match the above fix;
2287         this avoids the (very faint) possibility of integer overflow.
2288
2289 2004-09-24  Paul Eggert  <eggert@cs.ucla.edu>
2290
2291         * NEWS: Mention that "chmod -r -w x" now works as expected.
2292         * src/chmod.c (main): Revamp option processing to support this.
2293         * tests/chmod/Makefile.am (TESTS): Add 'usage'.
2294         * tests/chmod/usage: New set of tests for usage like that.
2295
2296 2004-09-24  Jim Meyering  <jim@meyering.net>
2297
2298         * Makefile.maint (CVS_LIST): Use --types=AFGM option so that
2299         it lists only cvs-controlled regular files.
2300
2301         * src/csplit.c (xalloc_die): Declare to be `extern', not `static'
2302         to avoid a warning from gcc-3.4.1.  Reported by Paul Eggert.
2303
2304 2004-09-23  Paul Eggert  <eggert@cs.ucla.edu>
2305
2306         * Makefile.maint (CVS_LIST): New macro.
2307         (sc_space_tab, sc_prohibit_atoi_atof, sc_file_system,
2308         sc_prohibit_jm_in_m4, sc_system_h_headers, sc_sun_os_names,
2309         sc_trailing_blank, po-check): Use it instead of the
2310         nonstandard "cvsu --list".
2311
2312         * src/tail.c (parse_obsolete_option): Bring back support
2313         for obsolete option followed by non-obsolete, or by more
2314         than one file.  When obsolete, conform to SUSv2 rather than
2315         original POSIX 1003.2-1992, as SUSv2 corrected the case of
2316         "tail -c".  Add support for the SUSv2 "b" modifier.
2317         * NEWS: Mention the above.
2318         * tests/tail/Test.pm: New test case obs-b to check the above.
2319         err-[134] no longer need _POSIX2_VERSION=199209.
2320         Fix comments to match revised behavior.
2321
2322 2004-09-22  Jim Meyering  <jim@meyering.net>
2323
2324         * Use automake-1.9.2.  Regenerate dependent files.
2325
2326         * src/remove.c (struct dirstack_state) [current_arg_jumpbuf]:
2327         Improve the comment.
2328
2329         Clean up scoping etc. so that some make `distcheck' tests pass.
2330         * src/csplit.c (xalloc_die): Declare to be static.
2331         * src/chown-core.c (chown_files): Declare as `extern'.
2332         * src/cp-hash.c (remember_created): Likewise.
2333         * src/copy.c (copy): Likewise.
2334         * src/checksum.h (enum) [ALG_MD5]: Define to be 1, not 0.
2335
2336         * src/id.c, src/nl.c, src/expand.c: Remove trailing blanks.
2337         * src/unexpand.c: Likewise.
2338
2339         * src/Makefile.am (check-AUTHORS): New rule.
2340         (check): Depend on it.
2341         * AUTHORS: Update.
2342
2343         * Makefile.maint (syntax-check-rules): Remove duplicate sc_tight_scope.
2344         (sc_system_h_headers): Also exclude copy.h; it includes <stdbool.h>.
2345
2346 2004-09-22  Paul Eggert  <eggert@cs.ucla.edu>
2347
2348         * src/ls.c (decode_switches): Don't compare a short value
2349         to SIZE_MAX: GCC sometimes complains.
2350
2351 2004-09-21  Paul Eggert  <eggert@cs.ucla.edu>
2352
2353         * NEWS: The following commands now reject unknown options:
2354         basename dirname factor hostname link nohup sync unlink yes
2355         Also, pathchk no longer accepts trailing options.
2356
2357         * src/basename.c: Include <getopt.h>.
2358         * src/chroot.c: Likewise.
2359         * src/dirname.c: Likewise.
2360         * src/factor.c: Likewise.
2361         * src/hostid.c: Likewise.
2362         * src/hostname.c: Likewise.
2363         * src/nohup.c: Likewise.
2364         * src/pwd.c: Likewise.
2365         * src/setuidgid.c: Likewise.
2366         * src/sync.c: Likewise.
2367
2368         * src/basename.c (main): Reject unknown options.
2369         * src/dirname.c (main): Likewise.
2370         * src/factor.c (main): Likewise.
2371         * src/hostid.c (main): Likewise.
2372         * src/hostname.c (main): Likewise.
2373         * src/link.c (main): Likewise.
2374         * src/nohup.c (main): Likewise.
2375         * src/pwd.c (main): Likewise.
2376         * src/setuidgid.c (main): Likewise.
2377         * src/sync.c (main): Likewise.
2378         * src/unlink.c (main): Likewise.
2379         * src/yes.c (main): Likewise.
2380
2381         * src/cat.c (main): Remove unused "case 0".
2382         * src/chgrp.c (main): Likewise.
2383         * src/chmod.c (main): Likewise.
2384         * src/chown.c (main): Likewise.
2385         * src/comm.c (main): Likewise.
2386         * src/cp.c (main): Likewise.
2387         * src/csplit.c (main): Likewise.
2388         * src/cut.c (main): Likewise.
2389         * src/date.c (main): Likewise.
2390         * src/df.c (main): Likewise.
2391         * src/du.c (main): Likewise.
2392         * src/env.c (main): Likewise.
2393         * src/expand.c (main): Likewise.
2394         * src/fold.c (main): Likewise.
2395         * src/head.c (main): Likewise.
2396         * src/id.c (main): Likewise.
2397         * src/install.c (main): Likewise.
2398         * src/join.c (main): Likewise.
2399         * src/ln.c (main): Likewise.
2400         * src/ls.c (decode_switches): Likewise.
2401         * src/mkdir.c (main): Likewise.
2402         * src/mkfifo.c (main): Likewise.
2403         * src/mknode.c (main): Likewise.
2404         * src/mv.c (main): Likewise.
2405         * src/nl.c (main): Likewise.
2406         * src/paste.c (main): Likewise.
2407         * src/pinky.c (main): Likewise.
2408         * src/pr.c (main): Likewise.
2409         * src/ptx.c (main): Likewise.
2410         * src/readlink.c (main): Likewise.
2411         * src/rm.c (main): Likewise.
2412         * src/rmdir.c (main): Likewise.
2413         * src/seq.c (main): Likewise.
2414         * src/shred.c (main): Likewise.
2415         * src/split.c (main): Likewise.
2416         * src/sum.c (main): Likewise.
2417         * src/tac.c (main): Likewise.
2418         * src/tail.c (main): Likewise.
2419         * src/tee.c (main): Likewise.
2420         * src/touch.c (main): Likewise.
2421         * src/tr.c (main): Likewise.
2422         * src/tty.c (main): Likewise.
2423         * src/uname.c (main): Likewise.
2424         * src/unexpand.c (main): Likewise.
2425         * src/wc.c (main): Likewise.
2426         * src/who.c (main): Likewise.
2427
2428         * src/chroot.c (main): Use getopt where it suffices, not getopt_long.
2429         * src/cksum.c (main): Likewise.
2430         * src/dd.c (main): Likewise.
2431         * src/logname.c (main): Likewise.
2432         * src/printenv.c (main): Likewise.
2433         * src/sleep.c (main): Likewise.
2434         * src/tsort.c (main): Likewise.
2435         * src/uptime.c (main): Likewise.
2436         * src/users.c (main): Likewise.
2437         * src/whoami.c (main): Likewise.
2438
2439         * src/du.c (long_options): Standardize on NULL vs 0.
2440         * src/rm.c (long_opts): Likewise.
2441
2442         * src/logname.c (long_options): Remove.
2443         * src/printenv.c (long_options): Likewise.
2444         * src/sleep.c (long_options): Likewise.
2445         * src/tsort.c (long_options): Likewise.
2446         * src/uptime.c (longopts): Likewise.
2447         * src/users.c (longopts): Likewise.
2448         * src/whoami.c (long_options): Likewise.
2449
2450         * src/pathchk.c (longopts): Add --help, --version.
2451         (main): Use longopts rather than parse_long_options.
2452         * src/stty.c (longpts, main): Likewise.
2453
2454         * src/pathchk.c (main): Don't reorder arguments, so that
2455         we can check weird file names.
2456
2457         * src/readlink.c: Don't include "long-options.h".
2458         * src/sort.c: Likewise.
2459         * src/stty.c: Likewise.
2460
2461         * src/split.c (verbose): Now bool, not int.
2462         (VERBOSE_OPTION): New enum.
2463         (longopts, main): Use it.
2464
2465         * tests/factor/basic: Adjust to new wording in diagnostic
2466         that results from the above changes.
2467
2468 2004-09-21  Jim Meyering  <jim@meyering.net>
2469
2470         * man/rm.x: Say "the response is affirmative" rather than "the
2471         response begins with y or Y", so that the documentation is
2472         accurate in non-English locales.  Problem reported by Munzir Taha.
2473
2474 2004-09-19  Paul Eggert  <eggert@cs.ucla.edu>
2475
2476         * src/echo.c (main): Don't pass NULL to strcmp when
2477         POSIXLY_CORRECT and given no arguments.
2478
2479         * src/md5sum.c (STRING_OPTION): Remove.
2480         (long_options, main): Remove support for undocumented and
2481         obsolete --string option, as suggested in the 1996-09-26 patch.
2482         * NEWS: Document this.
2483
2484         * tests/rm/fail-eperm: Don't try to remove writeable files in a
2485         sticky /tmp directory, as SVR4-like systems (e.g., Solaris 9) let
2486         you remove such files.  Problem reported by Bert Fischer in:
2487         http://lists.gnu.org/archive/html/bug-coreutils/2004-09/msg00074.html
2488
2489 2004-09-18  Paul Eggert  <eggert@cs.ucla.edu>
2490
2491         * src/md5sum.c (STATUS_OPTION, STRING_OPTION): New enums.
2492         (long_options, main): Use them instead of magic numbers 2 and 1.
2493         For --string, optarg can't possibly be NULL.
2494
2495         * src/dd.c (usage): Distinguish between options and operands.
2496         (scanargs): Don't mess with argc, argv; getopt_long handles this now.
2497         Say "operands" for operands, not "options".
2498         (main): Use getopt_long, so that "dd --" works as POSIX requires.
2499         * tests/dd/misc: Check for "dd --".
2500
2501         * src/chroot.c (main): Reject unknown options instead of
2502         interpreting them as a directory to chroot to.
2503
2504         * src/cksum.c: Remove obsolete comment about POSIX 1003.2/D11.2.
2505         The current standard (POSIX 1003.1-2004) is correct.
2506         (crc_remainder) [defined CRCTAB]: Renamed from "remainder" to avoid
2507         collision with builtin function.
2508         (main) [defined CRCTAB]: Output in lowercase hexadecimal, and
2509         output the first 0 as 8 digits, to make it easier to compare to
2510         the text of the standard.  Output crctab to be a const array.
2511         (crctab): Use result of above changes.
2512         (long_options): Remove; not needed if empty.
2513         (main): getopt_long can't return 0 here, so simplify the code.
2514
2515 2004-09-13  Jim Meyering  <jim@meyering.net>
2516
2517         * src/Makefile.am (localedir.h): Don't redirect directly to target.
2518
2519 2004-09-13  Paul Eggert  <eggert@cs.ucla.edu>
2520
2521         * src/id.c (print_full_info): Don't exit with failure status simply
2522         because a user or group number can't be turned into a name.
2523         Problem reported by Felipe Kellermann in:
2524         http://lists.gnu.org/archive/html/bug-coreutils/2004-09/msg00081.html
2525
2526 2004-09-12  Jim Meyering  <jim@meyering.net>
2527
2528         * Makefile.maint (my-distcheck): When building with -Werror, also
2529         require -Wshadow.
2530
2531 2004-09-10  Paul Eggert  <eggert@cs.ucla.edu>
2532
2533         * NEWS: "tail" now handles obscure POSIX 1003.2-1992 cases better.
2534         * src/tail.c (parse_obsolete_option): Renamed from
2535         parse_obsolescent_option, since the options are obsolete now.
2536         Remove bool *arg; just exit if there's an error.  Revamp to follow
2537         POSIX 1003.2-1992 more precisely, to handle cases like "tail -
2538         file" and "tail -10 -- file" correctly when we are conforming to
2539         the older standard.
2540         (main): Adjust to this change.
2541         * tests/tail/Test.pm (test_vector): minus-* requires
2542         _POSIX2_VERSION=199209 now, to work correctly if there is
2543         an input file.  err-1 and err-3 no longer errors if there
2544         is another file.
2545
2546 2004-09-09  Paul Eggert  <eggert@cs.ucla.edu>
2547
2548         * src/test.c (usage): Document -r, -w, -x more carefully.
2549
2550 2004-09-08  Paul Eggert  <eggert@cs.ucla.edu>
2551
2552         * src/test.c (usage): Document "test" (with no args) and "[ ]".
2553         Document that -h and -L don't dereference.
2554
2555         * NEWS: Document that "tr xy -z" now works as per POSIX.
2556         Sort the descriptions.
2557         * src/tr.c (main): Don't reorder options.
2558         * tests/tr/Test.pm (fowler-1): New test case.
2559
2560 2004-09-06  Paul Eggert  <eggert@cs.ucla.edu>
2561
2562         * src/touch.c (main): Fix POSIX-conformance bug: "touch --
2563         MMDDhhmm file" must be treated like "touch MMDDhhmm file" when
2564         conforming to pre-2001 POSIX.
2565         * NEWS: Document this.
2566         * tests/touch/obsolescent: Test for this bug.  Also, set
2567         _POSIX2_VERSION=199209 and POSIXLY_CORRECT=1 so that it's
2568         a better test for obsolescent features.
2569
2570         * src/sort.c (main): Emulate Solaris 8 and 9 "sort -y", so that
2571         "sort -y abc" is like "sort abc" whereas "sort -y 100" is like
2572         plain "sort".
2573
2574         * src/od.c: Several changes for POSIX and FreeBSD compatibility.
2575         (COMMON_SHORT_OPTIONS): Add -B, -D, -e, -F, -H, -I, -L, -O, -s, -X.
2576         (long_options, main): --strings is now -S, not -s.
2577         (usage): Reflect the usage changes.
2578         (parse_old_offset): Do not issue a diagnostic on failure;
2579         callers now do this as necessary.
2580         (main): Support POSIX syntax.  Remove unused case 0 from getopt_long.
2581         Add support for new short options (many undocumented) for
2582         compatibility with FreeBSD.  Remove FIXME for -s; it's now
2583         POSIX-compatible.  Default format is now oS, not o2.
2584         * NEWS: Describe the above.
2585
2586 2004-09-05  Paul Eggert  <eggert@cs.ucla.edu>
2587
2588         * src/stty.c (valid_options): Remove.
2589         (main): Fix some bugs in handling invalid option-combinations
2590         like "stty -F".
2591         (recover_mode): Arg is now char const *, not char *.
2592         (main): Use STDIN_FILENO, not 0.
2593         Simplify option-parsing code a tad.
2594         * tests/stty/basic-1: Check for the fixed bugs.
2595
2596 2004-09-03  Paul Eggert  <eggert@cs.ucla.edu>
2597
2598         * src/stat.c (HAVE_STRUCT_STATXFS_F_TYPE): Fix typo that prevented
2599         it from ever being nonzero.  Reported by Pozsar Balazs in:
2600         http://lists.gnu.org/archive/html/bug-coreutils/2004-08/msg00189.html
2601         (human_fstype): Add ramfs, squashfs, sysfs.
2602         Reported by Pozsar Balazs in:
2603         http://lists.gnu.org/archive/html/bug-coreutils/2004-08/msg00188.html
2604         (human_fstype): Return char const *, not char *.
2605         Simplify internals a bit, and avoid casts.
2606
2607         * src/dd.c (usage): "alternated EBCDIC" -> "alternate EBCDIC".
2608         (bit_count): Remove.  All uses changed to....
2609         (multiple_bits_set): New function.
2610         (scanargs): Use it, and check separately for each set of
2611         incompatible options, to improve diagnostics.
2612         (MX): Remove.
2613         (apply_translations): Move checks for incompatible options
2614         to scanargs, so that they're done consistently.
2615
2616 2004-09-02  Paul Eggert  <eggert@cs.ucla.edu>
2617
2618         Output correct errno-related diagnostic on "paste" I/O errors.
2619         * src/paste.c (write_error, xputchar): New functions.
2620         (paste_parallel): Use correct errno value after input error.
2621         (paste_parallel, paste_serial): Report errno value after output error.
2622
2623         Port to diet libc.  Problem reported by Felix von Leitner in:
2624         http://lists.gnu.org/archive/html/bug-coreutils/2004-08/msg00171.html
2625         * src/paste.c (dummy_closed, CLOSED, dummy_endlist, ENDLIST): Remove;
2626         it's not portable C to assume FILE is a complete type.
2627         (paste_parallel): Use index test instead of ENDLIST, and NULL
2628         instead of CLOSED.
2629
2630 2004-08-24  Paul Eggert  <eggert@cs.ucla.edu>
2631
2632         POSIX-conformance fixes for "expand" and "unexpand".
2633         Also, consistently use "tab stop" rather than "tabstop".
2634         * NEWS: Document fixes.
2635         * src/expand.c: Revamp to resemble the new unexpand.c better.
2636         (usage): -i does not convert tabs after non-tabs.
2637         (add_tab_stop): Renamed from add_tabstop.  All uses changed.
2638         (parse_tab_stop): Renamed from parse_tabstop.  All uses changed.
2639         (validate_tab_stop): Renamed from validate_tabstop.  All uses changed.
2640         (next_file, main): Check fclose against 0, not EOF.
2641         (expand): Remove unnecessary casts.
2642         Add another loop nesting level, for lines, so that per-line variables
2643         are initialized cleanly.
2644         Revamp tab checking.  Check for write error immediately, rather
2645         than just once at the end of the program.
2646         * src/unexpand.c: Lkewise (for the expand.c changes).
2647         (TAB_STOP_SENTINEL): Remove.
2648         (tab_size): Now size_t, not uintmax_t, since we need to store
2649         the sequences of blanks.
2650         (max_column_width): New var.
2651         (usage): Say "blank" where POSIX requires this.
2652         (add_tab_stop): Calculate maximum column width.
2653         (unexpand): Store the pending blanks, instead of merely counting them.
2654         Follow POSIX's rules about -a requiring two blanks before a tab stop.
2655         Get rid of internal label and goto.
2656         * tests/unexpand/basic-1: Fix infloop-3 to match POSIX.
2657         Add blanks-1 through blanks-13.
2658
2659 2004-08-19  Paul Eggert  <eggert@cs.ucla.edu>
2660
2661         * NEWS: "chown : file", "chown '' file", and "chgrp '' file" now
2662         succeed without changing the uid and gid, like FreeBSD.
2663         * src/chgrp.c (parse_group): Return gid_t rather than storing it
2664         through a pointer.  Treat "chgrp '' file" as a no-op change,
2665         as FreeBSD does.
2666         (main): Set chopt.group_name to NULL if the group is the empty
2667         string.
2668         * src/chown-core.c (describe_change): Describe changes to -1:-1
2669         without using "to OWNERSHIP" phrase.
2670         * src/chown.c (usage): "chown '' file" is now allowed.
2671         (main): Do not set user name to the empty string if the group
2672         name is null.
2673         * tests/chgrp/basic: Test "chgrp '' file".
2674         * tests/chown/Makefile.am (TESTS): Add separator.
2675         * tests/chown/separator: New file, partly taken from
2676         Dmitry V. Levin's suggestion in
2677         <http://lists.gnu.org/archive/html/bug-coreutils/2004-08/msg00102.html>
2678
2679 2004-08-11  Paul Eggert  <eggert@cs.ucla.edu>
2680
2681         * tests/install/basic-1: Test for the -d regression.
2682
2683 2004-08-11  Dmitry V. Levin  <ldv@altlinux.org>
2684
2685         * src/install.c (main): Fix -d regression introduced with
2686         --target-directory support at 2004-06-25.
2687
2688 2004-08-11  Paul Eggert  <eggert@cs.ucla.edu>
2689
2690         * src/copy.c (copy_internal): When preserving links, unlink
2691         a destination with link count greater than one.  This is so
2692         that commands like "cp -a" don't get confused when copying into
2693         a destination that already contains many hard links.  Problem
2694         reported by Tim Waugh in:
2695         http://lists.gnu.org/archive/html/bug-coreutils/2004-08/msg00053.html
2696
2697 2004-08-10  Paul Eggert  <eggert@cs.ucla.edu>
2698
2699         Convert all files to UTF-8.
2700         * tests/fmt/basic (8-bit-pfx): Use UTF-8, not Latin-1.
2701         * tests/sort/Test.pm (16a): Likewise.
2702         * tests/uniq/Test.pm (8): Likewise.
2703         * tests/misc/printf-hex: Use ASCII, not Latin-1.
2704
2705         * NEWS: Document "sort -o -" and "tee -" POSIX-conformance fixes.
2706         * src/shred.c (usage): "-" is an operand, not an option.
2707         * src/sort.c (die, xfopen, mergefps, first_same_file, merge):
2708         A null file arg means standard output.
2709         (main): "-o -" means to write to a file named "-",
2710         not to standard output.
2711         * src/tee.c (usage, tee): "tee -" writes to standard output, not
2712         to a file named "-".
2713
2714 2004-08-10  Dmitry V. Levin  <ldv@altlinux.org>
2715
2716         * src/install.c (change_timestamps): Fix int->bool conversion
2717         bugs introduced on 2004-07-29.
2718
2719 2004-08-09  Paul Eggert  <eggert@cs.ucla.edu>
2720
2721         * src/shred.c (wipename): Work even if the directory is writeable
2722         and not readable.  Prefer write access, since this should work
2723         better with fdatasync.
2724
2725         * src/csplit.c (xalloc_die): New function.
2726         (main): Remove now-obsolete initialization of xalloc_fail_func.
2727
2728         * src/md5sum.c: Adjust to sha->sha1 renaming.
2729
2730 2004-08-08  Dmitry V. Levin  <ldv@altlinux.org>
2731
2732         Minor code cleanup.
2733         * src/readlink.c (canonicalize_fname): Remove unneeded proxy function.
2734         (can_mode): Make variable local.
2735
2736 2004-08-07  Paul Eggert  <eggert@cs.ucla.edu>
2737
2738         * src/system.h (O_BINARY) [!O_BINARY && defined O_BINARY]:
2739         Do not define, to avoid annoying compiler messages on QNX 6.3.
2740         Problem reported by Johan in:
2741         http://lists.gnu.org/archive/html/bug-coreutils/2004-08/msg00050.html
2742
2743 2004-08-04  Paul Eggert  <eggert@cs.ucla.edu>
2744
2745         * src/system.h (PRIdMAX, PRIoMAX, PRIuMAX, PRIxMAX):
2746         Define to a concatenation of string literals, not to an expression;
2747         needed for concatenation contexts.
2748         (INTMAX_MAX, INTMAX_MIN): New macros.
2749
2750         * src/stat.c (print_stat): Don't assume st_ino / st_dev fits in
2751         unsigned long; this isn't true for st_ino on Solaris 9.
2752
2753 2004-08-03  Paul Eggert  <eggert@cs.ucla.edu>
2754
2755         * src/uname.c: Do not depend on HAVE_SYSCTL when deciding
2756         whether to include files.  Include <sys/param.h> if
2757         HAVE_SYS_PARAM_H (not HAVE_SYSCTL).
2758         (main) [defined __POWERPC__]: Add a kludge to work around a
2759         Mac OS X bug, so that uname -p defaults to "powerpc" if
2760         sysctl ((int[]) {CTL_HW, HW_MACHINE_ARCH}, 2, buffer, &bufsize, 0, 0)
2761         fails.  Problem reported by Petter Reinholdtsen in:
2762         http://lists.gnu.org/archive/html/bug-gnu-utils/2003-02/msg00201.html
2763
2764         * src/uniq.c (hard_LC_COLLATE, ignore_case, different, check_file,
2765         main): Use bool for booleans.
2766         (writeline, check_file): Use uintmax_t for line counts.
2767         (check_file): Check for and report line number overflow,
2768         when that matters.
2769         * src/wc.c (iswspace, wc): Use to_uchar rather than a cast.
2770         (print_lines, print_words, print_chars, print_bytes, print_linelength,
2771         have_read_stdin, wc, wc_file, main):
2772         Use bool for booleans.
2773         (exit_status): Remove.
2774         (wc, wc_file): Return bool status.  All callers changed.
2775         * src/who.c (scan_entries): 0 -> STDIN_FILENO.
2776         * src/whoami.c (main): Print uids using unsigned long int, not
2777         unsigned int.
2778
2779         * src/unexpand.c: Int cleanup and minor reorganization to be more
2780         like src/expand.c.
2781         Include quote.h, xstrndup.h.
2782         (TAB_STOP_SENTINEL): Increase from INT_MAX to INTMAX_MAX.
2783         (convert_entire_line, have_read_stdin, parse_tabstops, next_file,
2784         unexpand, main):
2785         Use bool for booleans.
2786         (tab_size, tab_list, add_tabstop, validate_tabstops, unexpand):
2787         Use uintmax_t for column counts.
2788         (first_free_tab, validate_tabstops, unexpand): Use size_t for sizes.
2789         (add_tabstop, parse_tabstops, main): Don't reserve UINTMAX_MAX
2790         as a tab stop.
2791         (parse_tabstops): Don't use ISBLANK on possibly-signed char.
2792         Detect overflow in tab stop string.
2793         (next_file, main): Use EXIT_FAILURE/EXIT_SUCCESS instead of 1/0.
2794         (unexpand): Concatenate input files the same way expand does.
2795
2796         * src/touch.c (no_create, use_ref, posix_date, amtime_now,
2797         touch, main): Use bool for booleans.
2798         (main): Avoid integer overflow when given more than INT_MAX
2799         options.
2800         * src/tsort.c (struct item, n_strings): Use size_t for sizes.
2801         (have_read_stdin, count_items, scan_zeros, detect_loop,
2802         recurse_tree, walk_tree, tsort, main):
2803         Use bool for booleans.
2804         (exit_status): Remove.
2805         (tsort): Return a success flag instead of storing into a global.
2806         (main): Use it.
2807         * src/tty.c (silent, main): Use bool for booleans.
2808         (main): 0 -> STDIN_FILENO.
2809         * src/uname.c (print_element): Use bool for booleans.
2810
2811         * src/test.c (TRUE, FALSE, SHELL_BOOLEAN, TRUTH_OR, TRUTH_AND):
2812         Remove.  All uses replaced by C99 boolean primitives.
2813         (TEST_TRUE, TEST_FALSE): New constants, for readability.
2814         (test_unop, binop, unary_operator, binary_operator, two_arguments,
2815         three_arguments, posixtest, expr, term, and, or, is_int, age_of,
2816         one_argument, main): Use bool for booleans.
2817         (advance, unary_advance): Now inline procedures rather than a macros.
2818         (is_int): Renamed from isint, to avoid namespace clash with ctype.h.
2819         (term, and, or): When it's easy, loop instead of recursing.
2820         (term): Avoid integer overflow if there are INT_MAX-3 args (!).
2821         (binary_operator, unary_operator): Simplify by systematically rewriting
2822         true==FOO to FOO (where FOO is a boolean).
2823         (unary_operator): Don't consider a file to be a regular file
2824         merely because its mode&S_IFMT is zero.  Just use S_ISREG.
2825         Remove unnecessary casts.  Remove ifdefs for things like
2826         S_ISSOCK that are no longer needed, since stat-macros.h always
2827         defines them now.
2828
2829         * src/tac-pipe.c (buf_init_from_stdin, find_bol, tac_mem):
2830         Use bool for booleans.
2831         (buf_init_from_stdin, buf_free, find_bol, print_line):
2832         Use size_t for sizes.
2833         * src/tac.c (separator_ends_record, tac_seekable, tac_file,
2834         tac_stdin, tac_stdin_to_mem, main): Use bool for booleans.
2835         (match_length, G_buffer_size, tac_seekable, main): Use size_t for sizes.
2836         (tac_seekable): Use ptrdiff_t for pointer subtraction.
2837         Report an error if the result is out of range.
2838         (tac_seekable, main): Check for integer overflow in buffer size
2839         calculations.
2840         (main): Remove unnecessary casts.
2841
2842         * src/su.c (run_shell): Pass a new n_additional_args arg, so that
2843         the callee doesn't have to count 'em.  All callers changed.
2844         Don't allocate more space for the arg vector than we'll need.
2845         Use memcpy to copy the args rather than rolling our own loop.
2846         Use size_t for sizes.
2847         (fast_startup, simulate_login, change_environment, log_su,
2848         correct_password, restricted_shell, main): Use bool for booleans.
2849         (longopts): Don't assume change_environment is an int.
2850         Use NULL, not 0, for pointers.
2851         (xsetenv): New function, replacing xputenv and concat.
2852         All callers changed.
2853         (elements): Remove; no longer needed.
2854         (log_su, correct_passwd, main): Prefer !x to x==NULL.
2855         (log_su): 2 -> STDERR_FILENO.
2856         (modify_environment, main): Don't assume that getenv's returned value
2857         has an indefinite lifetime.
2858         (modify_environment): Allocate a larger environ.
2859         (main): Remove an impossible 'case 0'; if it happens now, it'll
2860         get diagnosed.  Don't assume getpwnam results outlive endpwent.
2861         Check for null or empty pw_name, pw_dir and for null pw_passwd.
2862
2863         * src/stty.c (VA_START): Remove.  All callers now use va_start.
2864         (_POSIX_VDISABLE): Remove unnecessary cast.
2865         (struct control_info, visible): Use cc_t for control chars.
2866         (struct control_info): Use size_t for sizes.
2867         (recover_mode, set_mode, display_speed, display_window_size,
2868         valid_options, main, display_changed):
2869         Use bool for booleans.
2870         (integer_arg): Return unsigned long int, not long int.
2871         Accept new max arg; all callers changed, to specify a maximum
2872         value for integer parameters instead of silently overflowing.
2873         (wrap): Do not overrun the stack buffer if the output contains
2874         more than 1024 bytes.  Instead, malloc a buffer.
2875         (main): Remove a "what is this?!?" FIXME.  Nobody knows what it is.
2876         Remove unnecessary casts.
2877         (set_control_char): Allow int values only up to cc_t range.
2878         (screen_columns): Don't reject INT_MAX.
2879         (display_changed, display_all, display_speed, recover_mode):
2880         Don't assume cc_t fits in int.
2881
2882         * src/remove.h: Add copyright notice.
2883         (struct rm_options): Use bool for booleans.
2884         * src/rmdir.c (empty_paths, ignore_fail_on_non_empty, verbose,
2885         errno_rmdir_non_empty, remove_parents, main): Likewise.
2886         * src/sum.c (have_read_stdin, bsd_sum_file, sysv_sum_file,
2887         main): Likewise.
2888         (main): Don't dump core if invoked with argv[0]==NULL.
2889         * src/tee.c (tee, append, ignore_interrupts, main, tee):
2890         Use bool for booleans.
2891         (tee): Use ssize_t for read returns.
2892
2893         * src/ptx.c: Add a FIXME mentioning that there are many
2894         unchecked integer overflows in this file.
2895         (gnu_extensions, auto_reference, input_reference, right_reference,
2896         ignore_case, initialize_regex, fix_output_parameters,
2897         output_one_roff_line, output_one_text_line, output_one_dumb_line, main):
2898         Use bool for booleans.
2899         (SKIP_SOMETHING, compare_words, digest_break_file,
2900         find_occurs_in_text, fix_output_parameters):
2901         Use to_uchar instead of a caset.
2902         (print_field): Rewrite to avoid cast.
2903
2904         * src/printf.c (posixly_correct): Use bool for booleans.
2905         (verify, main): Use EXIT_FAILURE/EXIT_SUCCESS instead of 1/0.
2906         (STRTOX): Rewrite to avoid casts.
2907         (print_esc_char): Arg is char, not int.
2908         * src/readlink.c (canonicalize): Remove.  All uses now merely inspect
2909         can_mode.
2910         (no_newline, verbose): Use bool for booleans.
2911         (can_mode): Now of type int; use -1 to denote otherwise-uninitialized.
2912         * src/shred.c (struct Options, main): Use bool for booleans.
2913         (isaac_seed_data, fillpattern, wipefile): Rewrite to avoid casts.
2914         * src/split.c (cwrite, bytes_split, lines_split, line_bytes_split):
2915         Use bool for booleans.
2916         * src/stat.c (G_fail): Remove.
2917         (print_statfs): Print various gotta-be-nonnegative values using
2918         unsigned long int, not long int or int.
2919         (do_statfs, do_stat): Return a boolean success flag.
2920         (do_stat, main): Use bool for booleans.
2921
2922         * src/pr.c: Add a FIXME mentioning that there are many
2923         unchecked integer overflows in this file.
2924         (TRUE, FALSE): Remove.  All uses replaced by true and false.
2925         (struct COLUMN, read_line, print_page, print_stored, open_file,
2926         skip_to_page, init_fps, parallel_files, align_empty_cols,
2927         empty_line, FF_only, explicit_columns, extremities, keep_FF,
2928         print_a_FF, print_a_header, use_form_feed, have_read_stdin,
2929         print_across_flag, storing_columns, balance_columns,
2930         truncate_lines, join_lines, untabify_input, failed_opens,
2931         numbered_lines, skip_count, use_esc_sequence, use_cntrl_prefix,
2932         double_space, ignore_failed_opens, use_col_separator,
2933         pad_vertically, last_line, main, init_parameters, skip_read,
2934         read_line, print_stored):
2935         Use bool for booleans.
2936         (struct COLUMN, char_to_clump, store_char, print_char):
2937         Use char for chars.
2938         (clump_buff, print_clump): Use char[], not int[], for an array whose
2939         elements are always chars.
2940         (first_last_page, main, getoptarg, balance, add_line_number,
2941         char_to_uclump): Remove unnecessary casts.
2942         (init_parameters): Allocate chars, not ints, for clump_buff.
2943         (print_char): Use to_uchar before invoking ISPRINT.
2944         (char_to_clump): Convert to unsigned char before invoking ISPRINT.
2945
2946         * src/nohup.c (main): Use bool for booleans.
2947         * src/paste.c (paste_parallel, paste_serial, main): Likewise.
2948         * src/pathchk.c (validate-path, main, portable_chars_only): Likewise.
2949         (portable_chars_only): Use to_uchar rather than a cast.
2950         * src/printenv.c (main): Use bool for booleans.
2951         Do not assume that the environ has at most one matching entry
2952         for each option (integer overflow was possible otherwise).
2953
2954         * src/od.c (FMT_BYTES_ALLOCATED): Now an enum, not a decimal
2955         constant.  Do not assume PRIdMAX etc. are strings of length 3 or
2956         less.
2957         (struct tspec): Use it.  fmt_string is now an array, not
2958         a pointer, as there's little point to the indirection here.
2959         (struct tspec, flag_dump_strings,
2960         traditional, flag_pseudo_start, limit_bytes_to_format,
2961         abbreviate_duplicate_blocks, have_read_stdin, simple_strtoul,
2962         decode_one_format, open_next_file, check_and_close,
2963         decode_format_string, skip, write_block, read_char, read_block,
2964         parse_old_offset, dump, dump_strings, main):
2965         Use bool for booleans.
2966         (struct tspec): Use void *, not char *, for generic pointers.
2967         (bytes_to_oct_digits, bytes_to_signed_dec_digits,
2968         bytes_to_unsigned_dec_digits, bytes_to_hex_digits):
2969         Use char, not unsigned int, since char suffices.
2970         (print_s_char, print_char, print_s_short, print_short,
2971         print_int, print_long, print_long_long, print_float,
2972         print_double, print_long_double): Rewrite to avoid casts.
2973         These now take void * arguments, instead of char *.
2974         Use the same body for all functions, except for the choice
2975         of type.  Assume C89 to simplify handling of signed char.
2976         (dump_hexl_mode_trailer, print_named_ascii, print_ascii):
2977         Rewrite to avoid casts.
2978         (print_named_ascii, print_ascii): Now takes void *, not char *.
2979         (decode_one_format): Use int for printf field widths, not
2980         unsigned int.  Pass void * to subsidiary printers,
2981         not char *.  Simplify handling of floating-point formats
2982         by factoring out common code dealing with precision and field width.
2983         (decode_format_string): Avoid need for temporary copy of
2984         each decoded struct tspec.
2985         (get_lcm): Remove unnecessary cast.
2986         (main): Fix bug where more than INT_MAX failed decodes were ignored.
2987
2988 2004-08-02  Paul Eggert  <eggert@cs.ucla.edu>
2989
2990         * src/nl.c (TRUE, FALSE): Remove; all uses changed to true, false.
2991         (enum number_format): Remove.
2992         (FORMAT_RIGHT_NOLZ, FORMAT_RIGHT_LZ, FORMAT_LEFT): Now strings,
2993         not enum values.
2994         (DEFAULT_SECTION_DELIMITERS): Now an array constant, not a macro.
2995         (section_del): Now const.
2996         (print_fmt): Remove.
2997         (starting_line_number, page_incr, blank_join, line_no,
2998         print_lineno, proc_text, main):
2999         Use intmax_t for line numbers.
3000         (reset_numbers, have_read_stdin, build_type_arg, nl_file, main):
3001         Use bool for booleans.
3002         (lineno_format): Now a string, not an enum value.
3003         (build_print_fmt): Remove.  All calls removed.  This work is
3004         now done within print_lineno.
3005         (build_type_arg): Use size_t for sizes.
3006         (print_lineno): Check for line number overflow.
3007         (proc_text, main): Remove unnecessary cast.
3008
3009         * src/ln.c (symbolic_link, interactive, remove_existing_files,
3010         verbose, hard_dir_link, dereference_dest_dir_symlinks,
3011         do_link, main): Use bool for booleans.
3012
3013         * src/ls.c (struct fileinfo, file_interesting,
3014         extract_dirs_from_files, color_symlink_as_referent,
3015         FILE_OR_LINK_MODE, sort_reverse, print_owner, print_group,
3016         numeric_ids, print_block_size, dired, print_with_color,
3017         check_symlink_color, print_inode, recursive, immediate_dirs,
3018         all_files, really_all_files, qmark_funny_chars,
3019         print_dir_name, format_needs_stat, format_needs_type, visit_dir,
3020         main, decode_switches, parse_ls_color, print_dir, file_interesting,
3021         gobble_file, make_link_path, basename_is_dot_or_dotdot,
3022         extract_dirs_from_files, print_long_format):
3023         Use bool for booleans.
3024         (dir_defaulted): Remove; no longer needed.
3025         (main): Use int to count files, since it suffices for argv.
3026         Rewrite to avoid need for dir_defaulted.
3027         (main, print_dir, gobble_file, get_link_name,
3028         xstrcoll):
3029         Set exit status to EXIT_SUCCES/EXIT_FAILURE rather than 0/1.
3030         (decode_switches): Put back check for ws.ws_col <= SIZE_MAX.
3031         Remove unnecessary cast to int.  Use int instead of unsigned
3032         int to count from 0 to 1.
3033         (get_funky_string, print_type_indicator): Use char for bytes, not int.
3034         (make_link_path): Use NULL for null pointers.
3035         (quote_name): Use to_uchar instead of cast.
3036
3037         * src/id.c (use_name, main, print_user, xgetgroups, print_group_list,
3038         print_full_info): Use bool for booleans.
3039         (problems): Remove, replacing with....
3040         (ok): New var (inverted from old sense).
3041         (print_user, print_group, print_full_info):
3042         Print uids/gids with %lu, not %u.
3043         (xgetgroups): Don't run out of memory if getgroups or getugroups
3044         returns -1.
3045         * src/setuidgid.c (main): Print uids/gids with %lu, not %ld.
3046
3047         * src/factor.c (wheel_tab): Use unsigned char instead of unsigned
3048         int, since it suffices.
3049         (factor, print_factors): Use size_t for sizes.
3050         (print_factors, do_stdin, main): Use bool for booleans.
3051         * src/fold.c (TAB_WIDTH): New macro; use it instead of "8".
3052         (fold_file, main): Use bool for booleans.
3053         (fold_file, main): Use size_t for sizes.
3054         (main): Allow -w options up to SIZE_MAX - TAB_WIDTH - 1, instead
3055         of prohibiting widths greater than INT_MAX.
3056         * src/head.c (presume_input_pipe, print_headers, have_read_stdin,
3057         write_header, elide_tail_bytes_pipe, elide_tail_bytes_file,
3058         elide_tail_lines_pipe, elide_tail_lines_seekable,
3059         elide_tail_lines_file, head_bytes, head_lines, head, head_file,
3060         string_to_integer, main):
3061         Use bool for booleans.
3062         (main): Rewrite to avoid cast.
3063
3064         * src/csplit.c (struct line): Use size_t for sizes.
3065         (main): Remove unnecessary cast.
3066         * src/cut.c (cut_fields): Use to_uchar rather than a cast.
3067         * src/cut.c (cut_file, main): Use bool for booleans.
3068         * src/date.c (show_date, rfc_format, batch_convert, main): Likewise.
3069         * src/env.c (main): Likewise.
3070         * src/expr.c (nextarg): Likewise.
3071         * src/env.c (main): Remove unused and nonstandard envp arg.
3072
3073         * src/fmt.c (COST, MAXWORDS): Add a comment describing some of
3074         fmt's arbitrary limits.
3075         (TRUE, FALSE): Remove; all uses changed to (true, false).
3076         (main): Use bool for booleans.
3077         Limit maximum width to MAXCHARS / 2.  Use xstrtoul, not xstrtol,
3078         to parse width.
3079         (copy_rest): Remove unnecessary cast.
3080         (get_prefix): Rewrite to avoid cast.
3081         (check_punctuation): Use char *, not unsigned char *; C89 requires
3082         this.  Avoid off-by-one buffer read overrun when line is empty.
3083         (flush_paragraph): Don't assume wptr-parabuf is <= INT_MAX.
3084         Remove unnecessary casts.
3085         * tests/fmt/basic (wide-1, wide-2, bad-suffix): Adjust to above
3086         changes.
3087
3088         * src/expand.c (convert_entire_line, have_read_stdin, parse_tabstops,
3089         next_file, expand, main):
3090         Use bool for booleans.
3091         (tab_size, tab_list, add_tabstop, parse_tabstops, validate_tabstops,
3092         expand, main):
3093         Use uintmax_t for column counts.
3094         (add_tabstop): Don't reserve -1 (now UINTMAX_MAX) as a special value.
3095         All callers changed.
3096         (parse_tabstops): Don't pass a negative char to isblank.
3097         Avoid memory leak with large tab stops.
3098         (validate_tabstops, expand): Don't assume number of tab stops is
3099         <= INT_MAX.
3100         (next_file, main): Use EXIT_SUCCESS/EXIT_FAILURE rather than 0/1 when
3101         storing values into exit_status.
3102         (expand): Use same pattern as unexpand for reading chars.
3103         Report an error when input line is too long, instead of silently
3104         screwing up.  Do not mishandle tab stops when backspacing left
3105         over start of line.
3106
3107         * src/dircolors.c (have_read_stdin, append_quoted,
3108         dc_parse_stream, dc_parse_file, main): Use bool for booleans.
3109         (dc_parse_stream): Use enum for state, rather than int.
3110         Use ssize_t to store getline result.
3111
3112         * src/dd.c (translation_needed, parse_integer, scanargs,
3113         apply_translations, char_is_saved, swab_buffer, skip_via_lseek):
3114         Use bool for booleans.
3115         (translate_buffer): Use to_uchar rather than a cast.
3116         (swab_buffer, copy_simple, copy_with_unblock):
3117         Use size_t for sizes.
3118
3119         * src/seq.c (equal_width, valid_format, main): Use bool for booleans.
3120         * src/sleep.c (apply_suffix): Likewise.
3121         * src/tail.c (struct File_spec, reopen_inaccessible_files, count_lines,
3122         forever, from_start, print_headers, have_read_stdin, valid_file_spec,
3123         write_header, file_lines, pipe_lines, pipe_bytes, recheck,
3124         tail_forever, tail_bytes, tail_lines, tail, tail_file,
3125         parse_obsolescent_option, parse_options, main): Likewise.
3126         * src/sleep.c (apply_suffix): Invert sense of result.
3127         Use int (not unsigned int) for multiplier, as this generates better
3128         code with some compilers.  Simplify code a bit.
3129         * src/tail.c (struct File_spec, max_n_unchanged_stats_between_opens,
3130         parse_options): Use uintmax_t, not unsigned int or unsigned long int,
3131         for state counters.
3132         (tail_bytes, tail_lines): Redo test of return value (-1, 0, 1) to
3133         make it a bit clearer.
3134
3135         * src/hostname.c: Include "xgethostname.h".
3136         (xgethostname): Remove decl; xgethostname.h has it.
3137         (sethostname) [!defined(HAVE_SETHOSTNAME) && defined(HAVE_SYSINFO)
3138         && defined (HAVE_SYS_SYSTEMINFO_H) && defined(HAVE_LIMITS_H)]: Use
3139         prototypes rather than K&R form.  Assume any negative value from
3140         sysinfo denotes failure, not just -1.
3141         (main): Simplify use of sethostname.
3142
3143         * src/pinky.c (include_idle, include_heading, include_fullname,
3144         include_project, include_plan, include_home_and_shell, do_short_format,
3145         include_where, main): Use bool for booleans.
3146         (count_ampersands, create_fullname, scan_entries, short_pinky):
3147         Use size_t for sizes.
3148         (create_fullname): Check for overflow in size calculations.
3149         (idle_string): Don't assume that the number of idle days
3150         is less than 10**8 and/or INT_MAX/(24*60*60).
3151         (main): No need to pass a non-NULL last arg to getopt_long.
3152         * src/uptime.c (print_uptime, uptime): Use size_t for sizes.
3153         (print_uptime): Remove unused local variable.
3154         (main): No need to pass a non-NULL last arg to getopt_long.
3155         * src/users.c (list_entries_users, users): Use size_t for sizes.
3156         (list_entries_users): Use char for bytes.
3157         (main): No need to pass a non-NULL last arg to getopt_long.
3158         * src/who.c (do_lookup, short_list, short_output, include_idle,
3159         include_heading, include_mesg, include_exit, need_boottime,
3160         need_deadprocs, need_login, need_initspawn, need_clockchange,
3161         need_runlevel, need_users, my_line_only, main): Use bool for booleans.
3162         (print_runlevel): Use unsigned char for bytes.
3163         (list_entries_who, scan_entries, who): Use size_t for sizes.
3164         (main): No need to pass a non-NULL last arg to getopt_long.
3165
3166         * src/install.c (isdir): Remove decl.
3167         (install_file_to_path): Rely on make_path to fail if the destination
3168         is not a directory, by passing preserve_existing==true to it.
3169         Hence we no longer need to call isdir.
3170         Free dest_dir immediately when it's no longer needed, rather than
3171         waiting until the end of the function.
3172         (copy_file): Don't bother calling isdir, as copy will do the
3173         right thing if the destination is a directory.
3174
3175         * src/du.c (fts_debug, opt_all, apparent_size, opt_count_all,
3176         print_grand_total, opt_separate_dirs, hash_ins, process_file, main):
3177         Use bool for booleans.
3178         (max_depth): Now size_t, not int, to avoid an arbitrary limit
3179         of INT_MAX on depth.
3180         (G_fail): Remove: no longer needed, now that the relevant
3181         functions return bool.
3182         (process_file): Use return value to signal success rather than
3183         setting a global.  Remove first_call static var; not needed, since
3184         we can look at n_alloc.  Use size_t for depths.  Remove FIXME
3185         about size_t casts, as it's now fixed.  Use xnrealloc rather
3186         than the obsolescent XREALLOC.  Don't bother to check whether
3187         reallocation is needed unless level > prev_level.
3188         (du_files): Invert sense of result, for consistency with
3189         other coreutils code.  All callers changed.
3190         (main): Allow --max-depth values up to SIZE_MAX.
3191
3192         * src/df.c (inode_format, show_all_fs, show_local_fs,
3193         show_listed_fs, posix_format, require_sync, print_type,
3194         selected_fstype, excluded_fstype, show_dev, show_point, main):
3195         Use bool for booleans.
3196         (df_readable, show_dev): Use UINTMAX_MAX instead of -1.
3197         (show_dev, show_point, main):
3198         Use EXIT_SUCCESS/EXIT_FAILURE instead of 0/1.
3199         Don't assume disk name lengths are <= INT_MAX.
3200         Rewrite pct calculation to avoid cast.
3201         (show_point): Don't assume resolved length is <= SSIZE_MAX.
3202
3203         * src/cut.c (hash_int) [!defined UINTPTR_MAX]: Use size_t
3204         instead of uintptr_t.
3205         * src/shred.c (UINT_MAX_32_BITS): Remove.
3206         (word32): Remove.  All uses changed to uint32_t.
3207         (isaac_seed_data): Remove unnecessary cast.
3208         * src/system.h (ptr_align): Use size_t; in practice, this is just as
3209         good as uintptr_t in checking for alignments, and has fewer
3210         configuration hassles.
3211
3212         * src/Makefile.am (localedir.h): Make it readonly; this
3213         undoes part of the 2004-07-27 patch.
3214
3215 2004-07-30  Paul Eggert  <eggert@cs.ucla.edu>
3216
3217         * src/sort.c (UCHAR): Remove; all uses changed to to_uchar.
3218         (IS_THOUSANDS_SEP): Use bool when appropriate.
3219         (numcompare, main): Use char, not int, when the value is always a char.
3220         (numcompare): Remove "register"; compilers are smart enough these days.
3221         * src/system.h (errno, CHAR_BIT): Remove decls;
3222         no longer needed now we assume C89 or better.
3223         Include <inttypes.h> before <stdint.h>, as it's the
3224         Autoconf-recommended pattern.
3225         (to_uchar): New inline function, moved here from tr.c.
3226         Use full names for int types, e.g. "long int" rather than "long".
3227         * src/tr.c (to_uchar): Remove; now in system.h.
3228         (is_char_class_member): Use bool when appropriate.
3229
3230         * src/mkdir.c (create_parents, main): Use bool when appropriate.
3231         (main): Use EXIT_SUCCESS/EXIT_FAILURE instead of 0/1.
3232
3233 2004-07-29  Paul Eggert  <eggert@cs.ucla.edu>
3234
3235         * src/mkfifo.c (main): Use EXIT_SUCCESS and EXIT_FAILURE, not 0 and 1.
3236
3237         * src/chmod.c (recurse, force_silent, process_file, process_files,
3238         main): Use bool when appropriate.
3239         * src/cksum.c (cksum, main): Likewise.
3240         * src/comm.c (hard_LC_COLLATE, only_file_1, only_file_2, both,
3241         compare_files, main): Likewise.
3242
3243         * src/copy.h (struct cp_options): Likewise.
3244         * src/copy.c (copy_internal, is_ancestor, copy_dir, copy_reg,
3245         same_file_ok, seen_file, copy_internal, valid_options, copy): Likewise.
3246         * src/cp-hash.h (remember_created): Likewise.
3247         * src/cp-hash.c (remember_created): Likewise.
3248         * src/cp.c (struct dir_attr, flag_path, remove_trailing_slashes,
3249         re_protect, make_path_private, target_directory_operand, do_copy,
3250         cp_option_init, decode_preserve_arg, main): Likewise.
3251         * src/install.c (isdir, change_timestamps, change_attributes,
3252         copy_file, install_file_to_path, install_file_in_dir,
3253         install_file_in_file, strip_files, dir_arg, cp_option_init, main,
3254         change_attributes, change_timestamps): Likewise.
3255         * src/mv.c (remove_trailing_slashes, rm_option_init,
3256         cp_option_init, do_move, movefile, main): Likewise.
3257         * src/remove.c (right_justify), full_filename_, AD_pop_and_chdir,
3258         AD_push, prompt, remove_dir): Likewise.
3259         * src/rm.c (rm_option_init, main): Likewise.
3260
3261         * src/remove.c (top_dir, pop_dir, full_filename_):
3262         Use size_t for sizes.
3263         * src/cp.c (target_directory_operand): Do not clear *NEW_DST if stat
3264         succeeds.  It's not necessary in that case, as *NEW_DST is always
3265         false already.
3266         (do_copy): Rewrite slightly to avoid need for "unreachable" comment.
3267         (main): Use EXIT_SUCCESS, EXIT_FAILURE instead of 0, 1.
3268         * src/rm.c (main): Likewise.
3269
3270         md5sum, sha1sum integer cleanups.
3271
3272         * src/checksum.h: Don't include config.h, sys/types.h, stdio.h:
3273         not needed.
3274         (ALG_UNSPECIFIED): Remove.
3275         (ALG_MDT): Don't make it equal to CHAR_MAX + 1; this isn't necessary.
3276         * src/md5.c: Don't include any files other than checksum.h.
3277         * src/sha1sum.c: Likewise.
3278         * src/md5sum.c (OPENOPTS, have_read_stdin, status_only, warn,
3279         bsd_split_3, split_3, hex_digits, digest_file, digest_check, main):
3280         Use bool when appropriate.
3281         (digest_check): Increase limit of number of input lines to
3282         UINTMAX_MAX from INT_MAX.  Diagnose any overflows of this counter.
3283         Use ngettext instead of hard-to-i18nize hardcoded stuff for plurals.
3284
3285 2004-07-28  Paul Eggert  <eggert@cs.ucla.edu>
3286
3287         * src/cat.c (exit_status): Remove.  Now done by passing a boolean
3288         'ok' flag around.
3289         (simple_cat, cat): Return true if successful.  All callers changed.
3290         (simple_cat, cat, main): Use bool for booleans.
3291         (simple_cat): Use size_t for sizes.
3292         (cat, main): Use the same names for parameters that we use for
3293         long options, to avoid confusion.  This inverts the sense of the
3294         show_tabs (formerly output_tabs) and number_nonblank
3295         (formerly numbers_at_empty_lines) variables.
3296         (main): Don't mess up (due to integer overflow) if we are given
3297         INT_MAX - INT_MIN + 1 options.
3298         [O_BINARY]: Don't invoke isatty unless the other options require it.
3299         (main): When deciding whether to use simple_cat, don't worry
3300         about binary option; it's irrelevant.
3301
3302         * src/dcgen: Remove comments, trailing white space, and empty
3303         lines from the output strings, to save space.
3304         Use a narrower type like 'unsigned char' for line lengths, if
3305         that will do.
3306         Make the output variables static, not extern.
3307
3308         * src/chgrp.c (parse_group): Require base 10 when parsing
3309         groups as integers.
3310         (main): int -> bool when appropriate.
3311         * src/chown.c (main): Likewise.
3312         * src/chown-core.c: Include inttostr.h.
3313         (UINT_MAX_DECIMAL_DIGITS, uint_to_string): Remove.
3314         (gid_to_name, uid_to_name): Use imaxtostr/umaxtostr
3315         instead of uint_to_string).
3316         (describe_change): Instead of an int flag, use a char *
3317         auxiliary; this avoids the need for casts.
3318         Assume free (NULL) works.
3319         (change_file_owner): Return true/false, not 0/-1, since
3320         we don't set errno.  All callers changed.
3321         Use bool when appropriate.
3322         (chown_files): Likewise.
3323         * src/chown-core.h (chown_files): Likewise.
3324
3325         * tests/chown/basic: Test for proper handling of uids like
3326         "010", which must be parsed as decimal.
3327
3328         * tests/misc/pwd: Don't assume that Perl's getpwd agrees with our
3329         pwd when there are multiple names for the working directory
3330         (which can happen with an automounter, sigh).
3331
3332         * src/Makefile.am ($(SCRIPTS)): Don't depend on Makefile;
3333         this causes Solaris 8 'make' to refuse to build "groups".
3334         (localedir.h): Don't depend on Makefile: this causes Solaris
3335         8 'make' to build localedir.h unnecessarily.  The dependence
3336         on Makefile is ineffective anyway, since $(localedir) might
3337         change even if Makefile hasn't.
3338
3339         * src/remove.c (remove_dir): If we can't save the state of the
3340         working directory, pretend we started from "/", not ".".
3341         This avoids a bug on hosts like Solaris that don't let you
3342         remove the working directory.
3343
3344 2004-07-27  Paul Eggert  <eggert@cs.ucla.edu>
3345
3346         * src/printf.c (strtiomax, strtoumax): Declare if not already
3347         declared: this fixes a portability bug with Solaris 8 + GCC.
3348         (STRTOX): Parenthesize use of macro arg as expression.
3349         (vstrtoimax, vstrtoumax, vstrtold): Remove now-unnecessary
3350         parentheses.
3351         * configure.ac: Check for declaration of strtoumax, for
3352         src/printf.c.
3353
3354         * src/Makefile.am (cp_LDADD, ginstall_LDADD, mv_LDADD,
3355         pathchk_LDADD, rm_LDADD, test_LDADD): New vars, for eaccess.
3356
3357         * tests/readlink/can-e: Don't assume that we can remove the
3358         working directory: this isn't possible under Solaris 8, say.
3359         * tests/readlink/can-f: Likewise.
3360         * tests/readlink/can-m: Likewise.
3361
3362         * src/copy.c (copy_internal): find_backup_file_name no longer
3363         returns NULL, so don't bother to check for this.
3364         * src/cp.c (do_copy): Likewise.
3365         * src/ln.c (do_link): Likewise.
3366
3367 2004-07-25  Paul Eggert  <eggert@cs.ucla.edu>
3368
3369         * src/nice.c (GET_NICE_VALUE): Renamed from GET_PRIORITY.
3370         All uses changed.
3371         (NZERO): New macro, if system doesn't define it already.
3372         (usage): Distinguish priorities from nice values.
3373         Don't assume NZERO is 20.
3374         (main): Use bool instead of int where appropriate.
3375         If user specifies an adjustment out of range, always truncate it
3376         to an inrange value instead of sometimes giving an error message
3377         and sometimes not.
3378         Do not assume that -1 is an error return from "nice" or
3379         "getpriority", as it might be the current nice value minus NZERO.
3380         If nice/setpriority fails with errno == EPERM, go ahead and run
3381         the command anyway; POSIX requires this.
3382
3383         * src/pathchk.c: Include euidaccess.h.
3384         (dir_ok): Use euidaccess, not access.
3385         * src/test.c (R_OK, W_OK, X_OK, FOK): Remove; system.h defines them.
3386         (eaccess): Remove.  All users changed to use euidaccess instead.
3387
3388 2004-07-24  Paul Eggert  <eggert@cs.ucla.edu>
3389
3390         * src/uptime.c (print_uptime) [defined BOOT_MSG]:
3391         Don't assume ut_line is null-terminated.
3392         * src/who.c (print_line): New arguments USERLEN and LINELEN,
3393         since USER and LINE might not be null terminated.  All callers
3394         changed.
3395
3396 2004-07-23  Paul Eggert  <eggert@cs.ucla.edu>
3397
3398         Fix bug with "tail -f" reported by Rob Holland in
3399         <http://lists.gnu.org/archive/html/bug-coreutils/2004-07/msg00054.html>.
3400         Also, remove the undocumented and unsupported-since-2000
3401         --max-consecutive-size-changes options.  Fix another related bug:
3402         "tail" got confused if stdin, stdout, or stderr were closed.
3403         Also, use output buffering even with "tail -f".
3404
3405         * NEWS: Document this, plus yesterday's patch.
3406         * doc/coreutils.texi (tail invocation): "size has remained the same"
3407         -> "file has not changed", which is more accurate for fifos.
3408         * src/tail.c: Include fcntl-safer.h.
3409         (COPY_TO_EOF): Set to UINTMAX_MAX, not OFF_T_MAX (which was wrong).
3410         (COPY_A_BUFFER): New macro.
3411         (struct File_spec): New members mtime, mode, blocking.
3412         Remove member n_consecutive_size_changes.
3413         (DEFAULT_MAX_N_CONSECUTIVE_SIZE_CHANGES,
3414         max_n_consecutive_size_changes_between_opens,
3415         MAX_CONSECUTIVE_SIZE_CHANGES_OPTION): Remove.
3416         (long_options, tail_forever, parse_options):
3417         Remove (non-)support for --max-consecutive-size-changes.
3418         (record_open_fd): New function.
3419         (recheck, tail_file): Use it.  Don't assume that stdin is open.
3420         (dump_remainder): Add support for new COPY_A_BUFFER special value.
3421         Treat errno==EAGAIN like EOF, since it might be a nonblocking read.
3422         (recheck): New arg BLOCKING, specifying whether to use blocking reads.
3423         All uses changed.
3424         (n_live_files): Remove, replacing with...
3425         (any_live_files): New function.  All uses changed.
3426         (tail_forever): Use nonblocking I/O unless we know that blocking I/O
3427         is safe; this avoids some hangs when reading from a fifo.
3428         Avoid invoking fstat or sleep when using blocking I/O.
3429         Do not check for changes to size if the file is not a regular file,
3430         as the size is undefined in that case.
3431         Check for changes to mtime or mode, too; this works for non-regular
3432         files.
3433         (tail_forever, main): Redo fflush strategy to work even when input
3434         is nonblocking.  Don't use unbuffered output; just flush when needed.
3435
3436 2004-07-22  Paul Eggert  <eggert@cs.ucla.edu>
3437
3438         * src/tail.c (main): Ignore -f if no file operand is specified
3439         and standard input is a pipe.
3440         * doc/coreutils.texi (tail invocation): Do not ignore -f for
3441         all pipes, just for when standard input is a pipe and no
3442         file operand is specified.
3443         * tests/tail/Test.pm: Reinstate f-1 test, since we now pass.
3444         Add a new commented-out f-2 test, which we still fail.
3445         (test_vector): All f-* tests are special cases, not just f-1.
3446
3447 2004-07-12  Paul Eggert  <eggert@cs.ucla.edu>
3448
3449         * src/uptime.c: Include c-strtod.h.
3450         (print_uptime): Use c_strtod instead of setlocale and sscanf.
3451         Use long int rather than int to count days (for 64-bit hosts),
3452         and check for arithmetic overflow when converting double to time_t.
3453
3454 2004-07-11  Paul Eggert  <eggert@cs.ucla.edu>
3455
3456         * src/printf.c (vstrtold): Renamed from vstrtod.
3457         Now returns long double.  All uses changed.
3458         (print_direc): Use "L" length modifier when printing floating point
3459         numbers, since we're now printing long double.
3460
3461 2004-07-06  Paul Eggert  <eggert@cs.ucla.edu>
3462
3463         printf cleanup, to avoid undefined behavior, to add support for
3464         formats that Bash supports, and to support wide integers like
3465         Bash does.
3466
3467         * NEWS: Document this.
3468         * src/printf.c (UNSPECIFIED): Remove.  All uses now replaced by
3469         booleans, so that we don't reserve any values for precision or
3470         width (like Bash).
3471         (STRTOX): Use prototype, not K&R-style definition.
3472         (vstrtoimax): Renamed from xstrtol (to avoid confusion with xstrtol
3473         in ../lib), with type change to intmax_t.
3474         All uses changed.
3475         (vstrtoumax): Renamed from xstrtoul, with type change to uintmax_t.
3476         All uses changed.
3477         (vstrtod): Renamed from xstrtod.  All uses changed.
3478         (print_direc): Use boolean arg instead of special value to indicate
3479         a missing precision or width.  LENGTH no longer includes
3480         length modifiers or conversion character.  New arg CONVERSION
3481         now specifies conversion character.
3482         Use intmax_t-width formatting for integers (like Bash).
3483         Add support for C99 %a, %A, %F (like Bash).
3484         Add support for field width with %c (POSIX requires this).
3485         Add a FIXME for lack of support for field width and precision
3486         for %b.
3487         Add support for '\'', '0' flags.
3488         Check for invalid combinations of flags, field width, precision,
3489         and conversion, to prevent use of undefined behavior.
3490         Allow multiple length modifiers, for formats like "%lld" (like Bash).
3491         Add support for C99 'j', 't', 'z' length modifiers (like Bash).
3492         In error message, output entire invalid conversion specification,
3493         instead of merely outputting % followed by the conversion char.
3494         * tests/misc/printf: Add tests for the above.
3495
3496 2004-04-03  Dmitry V. Levin  <ldv@altlinux.org>
3497
3498         Change "readlink -f" to be more compatible with prior implementations.
3499         Add more canonicalize options, -e and -m.
3500         Add comprehensive tests for all readlink modes.
3501
3502         * m4/canonicalize.m4 (AC_FUNC_CANONICALIZE_FILE_NAME):
3503         Do not add canonicalize.c here.
3504
3505         * src/readlink.c (longopts): Add new options.
3506         (usage): Document them.
3507         (canonicalize_fname): New proxy function.
3508         (main): Handle new options.
3509         * doc/coreutils.texi (readlink invocation): Document new
3510         "readlink -f" behaviour and new canonicalize options, -e and -m.
3511
3512         * configure.ac (AC_CONFIG_FILES): Add tests/readlink/Makefile.
3513         * tests/Makefile.am (SUBDIRS): Add readlink.
3514         * tests/readlink/Makefile.am: New file.
3515         * tests/readlink/{rl-1,can-e,can-f,can-m}: New readlink tests.
3516         * tests/misc/Makefile.am (TESTS): Remove basic readlink test.
3517         * tests/misc/readlink: Remove file.
3518
3519 2004-07-04  Jim Meyering  <jim@meyering.net>
3520
3521         * src/copy.c (copy_internal): Add a FIXME comment.
3522
3523 2004-07-02  Paul Eggert  <eggert@cs.ucla.edu>
3524
3525         * src/copy.c (copy_dir): Assume path_concat returns non-NULL.
3526         * src/cp.c (do_copy): Likewise.
3527         * src/mv.c (movefile): Likewise.
3528
3529         * src/cp.c (make_path_private): 2nd arg is now size_t, not int,
3530         to avoid problem when path_concat dir name is longer than 2 GiB (!).
3531
3532         * src/nohup.c (main): Don't pass NULL first argument to path_concat.
3533         This cleans up the semantics a bit, as we no longer try to open the
3534         same file twice.
3535
3536 2004-07-01  Paul Eggert  <eggert@cs.ucla.edu>
3537
3538         * NEWS: Add short names -t and -T for --target-directory
3539         and --no-target-directory options, respectively.
3540
3541         * src/cp.c (NO_TARGET_DIRECTORY_OPTION, TARGET_DIRECTORY_OPTION):
3542         Remove.  All uses changed to 'T' and 't', respectively.
3543         * src/install.c, src/ln.c, src/mv.c: Likewise.
3544
3545         * src/cp.c (long_opts, usage, do_copy, main): Add -t and -T as
3546         aliases for --target-directory and --no-target-directory,
3547         respectively.
3548         * src/install.c (long_options, main, usage): Likewise.
3549         * src/ln.c, src/mv.c: Likewise.
3550
3551 2004-07-01  Jim Meyering  <jim@meyering.net>
3552
3553         * Makefile.maint (sc_file_system): New target.
3554         (syntax-check-rules): Add it.
3555         .x-sc_file_system: New file.
3556         * Makefile.am (EXTRA_DIST): Add it.
3557
3558         * man/sync.x: Use "file system" rather than "filesystem".
3559         * man/stat.x, man/df.x: Likewise.
3560
3561 2004-06-30  Paul Eggert  <eggert@cs.ucla.edu>
3562
3563         * src/df.c (usage, main): Output "file system" rather than
3564         "filesystem".
3565         * src/du.c (usage): Likewise.
3566         * src/shred.c (usage): Likewise.
3567         * src/stat.c (usage): Likewise.
3568         * src/stat.c (long_options, usage): Rename "--filesystem" to
3569         "--file-system".  But keep the old name around, for compatibility
3570         reasons.
3571
3572 2004-06-29  Paul Eggert  <eggert@cs.ucla.edu>
3573
3574         Add support for --no-target-directory option.
3575
3576         * NEWS: Document it.
3577         * doc/coreutils.texi (Common options, Target directory, cp
3578         invocation, install invocation, mv invocation, ln invocation):
3579         Likewise.
3580         (link invocation): Explain how to rewrite link using ln now
3581         that we have --no-target-directory.
3582         (ln invocation): Explain that --no-target-directory subsumes
3583         --no-dereference.
3584         (unlink invocation): Modify wording to match new wording in
3585         link invocation.
3586
3587         * src/cp.c (NO_TARGET_DIRECTORY_OPTION): New constant.
3588         (long_opts, usage, do_copy, main): Add support for
3589         --no-target-directory,
3590         * src/install.c (NO_TARGET_DIRECTORY_OPTION, long_options, main,
3591         usage): Likewise.
3592         * src/ln.c (NO_TARGET_DIRECTORY_OPTION, long_options, usage,
3593         main): Likewise.
3594         * src/mv.c (NO_TARGET_DIRECTORY_OPTION, long_options, usage,
3595         main): Likewise.
3596         * src/mv.c (enum): Sort values.
3597
3598 2004-06-29  Jim Meyering  <jim@meyering.net>
3599
3600         Don't let verbose-mode output from a subshell obscure actual differences.
3601         * tests/rm/inaccessible: Turn off command-echoing just before
3602         invoking subshell, then turn it back on if VERBOSE=yes afterward.
3603
3604 2004-06-25  Paul Eggert  <eggert@cs.ucla.edu>
3605
3606         Add support for 'install --target-directory', an option
3607         that has been documented for years but not implemented (!).
3608         * doc/coreutils.texi (install invocation): Document
3609         --target-directory in synopsis, too.
3610         * src/install.c (TARGET_DIRECTORY_OPTION): New var.
3611         (long_options, main, usage): Add --target-directory.
3612         (target_directory_operand): New function, stolen from mv.c.
3613         (main): Use it.  Check for -d and --target-directory.
3614         Alter wording of diagnostics to match other programs.
3615
3616 2004-06-28  Jim Meyering  <jim@meyering.net>
3617
3618         * src/cp.c (usage): Fix copy+paste error in description of
3619         --target-directory: s/move/copy/.  From Paul Jarc.
3620
3621 2004-06-27  Paul Eggert  <eggert@cs.ucla.edu>
3622
3623         Use more-consistent rules among cp, ln, and mv when dealing with
3624         last operands that are (or look like) directories.
3625
3626         * src/cp.c (target_directory_operand): New, nearly-common function,
3627         It reports an error if the destination appears to be a directory
3628         (e.g., because it has a trailing slash) but is not.
3629         * src/ln.c, src/mv.c: Likewise.
3630         * src/cp.c (do_copy): Use it.
3631         * src/ln.c (main): Likewise.
3632         * src/mv.c (main): Likewise.
3633
3634         * src/cp.c (do_copy): Don't assume argc is positive.
3635         Don't bother to lstat dest, since copy() will do that for us.
3636         Use "const" to avoid the need for cast.
3637
3638         * src/cp.c (do_copy): Don't output a usage message because of file
3639         problems (e.g., an operand is not a directory).  Use it only for
3640         syntax.  Standardize on "target %s is not a directory" for the
3641         diagnostic.
3642         * src/ln.c (main): Likewise.
3643         * src/mv.c (main): Likewise.
3644
3645         * src/cp.c (do_copy): Remove test for trailing slash, since
3646         target_directory_operand now does this.
3647         * src/ln.c (main): Likewise.
3648         * src/mv.c (movefile): Likewise.
3649
3650         * src/cp.c (main): Reject multiple target directories.
3651         Check whether a specified target is a directory when parsing the
3652         options, using stat.  This gives more-accurate diagnostics.
3653         * src/ln.c (main): Likewise.
3654
3655         * src/ln.c (isdir): Remove decl; no longer needed.
3656         * src/mv.c (isdir, lstat): Likewise.
3657
3658         * src/ln.c (do_link): New arg dest_is_dir.  All uses changed.
3659         Don't check the destination ourself; rely on dest_is_dir.
3660         This way we can avoid lstatting the destination in the
3661         usual case, and in the worst case we lstat 1, not 3 times.
3662         Don't bother to unlink unless link failed; this saves a syscall.
3663         Remove unnecessary backup_succeeded flag;
3664         it was identical to "dest_backup != NULL".
3665
3666         * src/ln.c (main): Use int to count to argc, not unsigned int.
3667         This handles negative operand counts.
3668         * src/mv.c (main): Likewise.
3669
3670         * src/mv.c (do_move): Don't call hash_init; expect the caller to
3671         do it, for consistency with cp.c and ln.c.  All callers changed.
3672         (movefile): dest_is_dir parameter is now bool, not int.
3673         (main): Standardize on "missing destination file operand after %s"
3674         for the diagnostic, for consistency with cp.c.
3675
3676         * tests/mv/diag: Don't assume "mv --target=nonexistentdir"
3677         will complain about the arg count.
3678         Adjust to new (briefer) diagnostics.
3679         * tests/cp/fail-perm: Add a test to verify that we get the new
3680         diagnostic when failing to copy through a symlink-to-inaccessible-dir.
3681
3682 2004-06-27  Paul Eggert  <eggert@cs.ucla.edu>
3683
3684         Fix a bug: formerly, if d/x was a directory and x a file, "ln x
3685         d/" incorrectly created a link d/x/x.  It also saves some system
3686         calls.
3687
3688         * NEWS: Document the fix.
3689
3690         * src/ln.c (main): Don't append basename to dest if this
3691         results in an existing directory name.
3692         * tests/ln/misc: See whether a trailing slash is followed too far.
3693
3694 2004-06-26  Jim Meyering  <jim@meyering.net>
3695
3696         * src/printf.c (main): When given no arguments, print the standard
3697         "missing operand\nTry printf --help..." message -- to be consistent.
3698
3699 2004-06-26  Jim Meyering  <jim@meyering.net>
3700
3701         * src/mknod.c (main): Add \n at the end of message output via fprintf.
3702
3703 2004-06-25  Jim Meyering  <jim@meyering.net>
3704
3705         * tests/ln/misc: Add test for ln subscript error.
3706
3707 2004-06-23  Paul Eggert  <eggert@cs.ucla.edu>
3708
3709         * src/ln.c (do_link): Remove unnecessary call to lstat.
3710         (main): Avoid subscript error when the destination is "".
3711
3712 2004-06-23  Jim Meyering  <jim@meyering.net>
3713
3714         * tests/*: Replace all occurrences of `(exit N); exit' with
3715         `(exit N); exit N'.  Otherwise, those many tests could exit with
3716         improper exit status when exiting via e.g., a trapped interrupt.
3717         Thanks to a report from Bob Proulx.
3718
3719 2004-06-22  Paul Eggert  <eggert@cs.ucla.edu>
3720
3721         * src/who.c (idle_string, print_user): New arg boottime,
3722         specifying the most recent boot time.  All uses changed.
3723         (idle_string) Consider a line to be "old" if it hasn't been used
3724         since the last boot time.  Watch out for overflow when computing
3725         times, and for times in the future.
3726         (idle_string): Record latest boot time.
3727
3728 2004-06-22  Jim Meyering  <jim@meyering.net>
3729
3730         * src/test.c (usage): Correct description of `-t FD'.  The file
3731         descriptor, FD, is no longer optional.  Reported by Ton Nijkes.
3732
3733 2004-06-21  Paul Eggert  <eggert@cs.ucla.edu>
3734
3735         The 2004-06-19 fix for who and pinky was incomplete, as ctime
3736         has undefined behavior if the year precedes -999 or follows 9999.
3737         Since we have to stop using ctime anyway, we might as well use
3738         strftime and fix the FIXME, and support internationalized dates.
3739
3740         * NEWS: Document the new behavior.
3741         * src/who.c: Include "hard-locale.h".
3742         (time_format, time_format_width): New vars.
3743         (time_string, print_line): Use them.
3744         (main): Set them.
3745         (time_string): Use localtime + strftime instead of
3746         ctime, to avoid problems with years before -999 or after 9999.
3747         * src/pinky.c: Likewise.
3748
3749 2004-06-21  Paul Eggert  <eggert@cs.ucla.edu>
3750
3751         Fix bug: GNU 'ls' didn't count columns correctly if user or group
3752         names contained multibyte characters where the column count
3753         differed from the byte count.  This patch also corrects
3754         some comments.
3755
3756         * src/ls.c (format_user_or_group): New function, which counts
3757         columns correctly.
3758         (format_user, format_group): Use it.
3759         (format_user_or_group_width): New function, which counts columns
3760         correctly.
3761         (format_user_width, format_group_width): Use it.
3762
3763 2004-06-21  Jim Meyering  <jim@meyering.net>
3764
3765         * tests/priv-check: Quote "$PATH" in PATH=$PATH.
3766         Suggestion from Andreas Schwab.
3767
3768         * tests/priv-check: When running as root, be sure to propagate
3769         PATH through to the process we exec as non-root.
3770         Reported by michael@aplatform.com.
3771
3772         * src/mknod.c (main): Don't segfault when calculating the
3773         expected number of operands for `mknod NAME'.
3774
3775 2004-06-20  Jim Meyering  <jim@meyering.net>
3776
3777         * src/dd.c (input_seek_errno): Declare file-scoped variable as static.
3778
3779 2004-06-20  Paul Eggert  <eggert@cs.ucla.edu>
3780
3781         * src/basename.c (main):
3782         Standardize on the diagnostics given when someone gives
3783         too few operands ("missing operand after `xxx'") or
3784         too many operands ("extra operand `xxx'").
3785         Include "quote.h" and/or "error.h" if it wasn't already being included.
3786         * src/chgrp.c (main): Likewise.
3787         * src/chmod.c (main): Likewise.
3788         * src/chown.c (main): Likewise.
3789         * src/chroot.c (main): Likewise.
3790         * src/comm.c (main): Likewise.
3791         * src/cp.c (do_copy): Likewise.
3792         * src/csplit.c (main): Likewise.
3793         * src/date.c (main): Likewise.
3794         * src/dircolors.c (main): Likewise.
3795         * src/dirname.c (main): Likewise.
3796         * src/du.c (main): Likewise.
3797         * src/expr.c (main): Likewise.
3798         * src/hostid.c (main): Likewise.
3799         * src/hostname.c (main): Likewise.
3800         * src/id.c (main): Likewise.
3801         * src/install.c (main): Likewise.
3802         * src/join.c (add_file_name, main): Likewise.
3803         * src/link.c (main): Likewise.
3804         * src/ln.c (main): Likewise.
3805         * src/logname.c (main): Likewise.
3806         * src/md5sum.c (main): Likewise.
3807         * src/mkdir.c (main): Likewise.
3808         * src/mkfifo.c (main): Likewise.
3809         * src/mknod.c (main): Likewise.
3810         * src/mv.c (main): Likewise.
3811         * src/nohup.c (main): Likewise.
3812         * src/od.c (main): Likewise.
3813         * src/pathchk.c (main): Likewise.
3814         * src/ptx.c (main): Likewise.
3815         * src/readlink.c (main): Likewise.
3816         * src/rm.c (main): Likewise.
3817         * src/rmdir.c (main): Likewise.
3818         * src/seq.c (main): Likewise.
3819         * src/setuidgid.c (main): Likewise.
3820         * src/shred.c (main): Likewise.
3821         * src/sleep.c (main): Likewise.
3822         * src/sort.c (main): Likewise.
3823         * src/split.c (main): Likewise.
3824         * src/stat.c (main): Likewise.
3825         * src/test.c (beyond, main): Likewise.
3826         * src/touch.c (main): Likewise.
3827         * src/tr.c (main): Likewise.
3828         * src/tsort.c (main): Likewise.
3829         * src/tty.c (main): Likewise.
3830         * src/uname.c (main): Likewise.
3831         * src/uniq.c (main): Likewise.
3832         * src/unlink.c (main): Likewise.
3833         * src/uptime.c (main): Likewise.
3834         * src/users.c (main): Likewise.
3835         * src/who.c (main): Likewise.
3836         * src/whoami.c (main): Likewise.
3837
3838         * tests/basename/basic: Adjust to new diagnostics.
3839         * tests/du/files0-from: Likewise.
3840         * tests/expr/basic: Likewise.
3841         * tests/mv/diag: Likewise.
3842         * tests/tsort/basic-1: Likewise.
3843
3844 2004-06-20  Jim Meyering  <jim@meyering.net>
3845
3846         * src/ln.c: Remove declaration of yesno.
3847         Instead, include yesno.h.
3848         * src/copy.c: Likewise.
3849
3850         * src/remove.c: Remove declaration of yesno.
3851         Instead, include yesno.h.
3852         (top_dir): Remove now-unnecessary cast of obstack_base.
3853         (pop_dir): Likewise.
3854         (full_filename_): Likewise.
3855
3856 2004-06-19  Paul Eggert  <eggert@cs.ucla.edu>
3857
3858         Don't dump core if ctime returns NULL; this is possible on
3859         hosts with 64-bit time_t and 32-bit int.
3860         * src/who.c: Include "inttostr.h".
3861         (time_string): If ctime fails, print the raw time as an integer
3862         instead of dumping core.
3863         * src/pinky.c: Likewise, as follows:
3864         Include "inttostr.h".
3865         (time_string): New function, copied from who.c.
3866         (print_entry): Use it.
3867
3868 2004-06-19  Paul Eggert  <eggert@cs.ucla.edu>
3869
3870         * src/who.c (print_line): Don't truncate user names at 8 bytes.
3871         Problem reported by Guido Leenders in:
3872         http://lists.gnu.org/archive/html/bug-coreutils/2004-06/msg00056.html
3873         * NEWS: document this.
3874
3875 2004-06-19  Jim Meyering  <jim@meyering.net>
3876
3877         * src/system.h (case_GETOPT_VERSION_CHAR): Switch back to
3878         using GNU_PACKAGE (from PACKAGE) once again.  This restores
3879         `GNU' to the parenthesized package name in --version output.
3880         Before, the first argument from AC_INIT, `GNU coreutils', would
3881         be propagated to the PACKAGE variable.  Now, `GNU ' is trimmed.
3882         Reported by Richard Stallman.
3883
3884 2004-06-17  Jim Meyering  <jim@meyering.net>
3885
3886         * src/tr.c (to_uchar): Rename function from `uchar'.  The latter
3887         would clash with a typedef in Tru64's <sys/types.h>.  From Albert Chin.
3888
3889 2004-06-15  Paul Eggert  <eggert@cs.ucla.edu>
3890
3891         * NEWS: Remove more special cases for POSIXLY_CORRECT when POSIX
3892         allows the GNU behavior.  "--" is now supported by chroot, hostid,
3893         hosname, pwd, sync, yes.
3894         * doc/coreutils.texi (yes invocation, false invocation,
3895         true invocation): Document this.
3896         * src/chroot.c (main): Handle "--".
3897         * src/hostid.c (main): Likewise.
3898         * src/hostname.c (main): Likewise.
3899         * src/pwd.c (main): Likewise.
3900         * src/sync.c (main): Likewise.
3901         * src/yes.c (main): Likewise.
3902         * src/true.c (main): Recognize --help and --version even if
3903         POSIXLY_CORRECT is set.
3904         * src/yes.c (main): Likewise.
3905
3906 2004-06-09  Paul Eggert  <eggert@cs.ucla.edu>
3907
3908         * NEWS: Remove special cases for POSIXLY_CORRECT when POSIX allows
3909         the GNU behavior.
3910         * doc/coreutils.texi (pr invocation, unlink invocation): Document this.
3911         * src/ls.c (decode_switches): Pay attention to TABSIZE even if
3912         POSIXLY_CORRECT is set.  POSIX reserves upper-case environment
3913         variables to the implementation, so it's OK for ls to depend on
3914         TABSIZE.
3915         * src/pr.c: Include "hard-locale.h".
3916         (main): When in a non-POSIX locale, ignore POSIXLY_CORRECT, since
3917         POSIX specifies the behavior only in the POSIX locale.
3918         * src/printf.c (print_esc): Support \x, \u, \U even if POSIXLY_CORRECT,
3919         since POSIX says the behavior is unspecified here.
3920         * src/tail.c (parse_obsolescent_option): Support multiple file operands
3921         even if POSIXLY_CORRECT, since POSIX does not require a diagnostic.
3922         * src/printf.c (main): Recognize --help, --version even if
3923         POSIXLY_CORRECT.  POSIX does not specify any options, but it
3924         does not prohibit options either, so "printf" is like "expr" here.
3925         * src/unlink.c (main): Likewise.
3926         * tests/misc/printf: Adjust to the new semantics for \x if
3927         POSIXLY_CORRECT.
3928
3929 2004-06-14  Jim Meyering  <jim@meyering.net>
3930
3931         * tests/misc/pwd: New test, for fix of 2004-04-19.
3932         * tests/misc/Makefile.am (TESTS): Add pwd.
3933         (BUILD_SRC_DIR): Define BUILD_SRC_DIR.
3934
3935         * src/copy.c: Remove declaration of euidaccess.
3936         Instead, include "euidaccess.h".
3937
3938 2004-06-13  Paul Eggert  <eggert@cs.ucla.edu>
3939
3940         * src/who.c (PIDSTR_DECL_AND_INIT): Don't assume pid_t fits in int.
3941         (UT_ID) [!HAVE_STRUCT_XTMP_UT_ID]: Remove bogus comment,
3942         as (sizeof "??") reliably returns 3.
3943         (print_line): Guard against idle and pid being too long
3944         (which is possible when printing headers).
3945         (print_user): Allocate enough bytes for idlestr.  Use IDLESTR_LEN.
3946         Avoid unnecessary cast of sizeof to int.
3947         (make_id_equals_comment): Do not assume that UT_ID returns
3948         a string; it might return a non-null-terminated array.
3949         Use strncat instead.  It's not very often where strncat is
3950         exactly what you want, but this is one of those rare cases.
3951
3952 2004-06-11  Paul Eggert  <eggert@cs.ucla.edu>
3953
3954         * src/who.c (list_entries_who): Don't output a trailing space.
3955
3956 2004-06-09  Jim Meyering  <jim@meyering.net>
3957
3958         * src/touch.c (usage): Improve wording in description of the
3959         --time=WORD option.  Reported by Dan Jacobson.
3960
3961         * src/chown-core.c (change_file_owner): Change names of parameters
3962         old_uid and old_gid to required_uid and required_gid respectively.
3963
3964         * src/chmod.c (mode_changed): Return false, not 0, now that the
3965         function returns `bool'.
3966
3967 2004-06-08  Paul Eggert  <eggert@cs.ucla.edu>
3968
3969         Adjust chmod and chown to be similar if -c or -v are given.  In
3970         particular, a no-op chown is no longer reported as a change; this
3971         reverts to previous behavior.  Also, fix both commands so that -v
3972         report failures even if the failure is not due to the chmod or
3973         chown syscalls.
3974
3975         * src/chmod.c (CH_NOT_APPLIED): New constant.
3976         (describe_change): Handle it.
3977         (process_file): Use it, if a symlink wasn't changed.
3978         (mode_changed): Return bool, not int.  Accept new argument
3979         NEW_MODE; all callers changed.  This lets us avoid statting the
3980         file unless the new mode has unusual bits.
3981         (process_file): Return -1 on error.  With -v, report all errors
3982         verbosely, not just some.
3983
3984         * src/chown-core.c (change_file_owner): Return -1 on error, not
3985         1 sometimes and -1 on others.  Our caller ORs together our results,
3986         and (-1 | 1) == 0 on ones-complement hosts.
3987         With -v report all errors verbosely, not just some.
3988         Fix bug when chopt->root_dev_ino && !chopt->affect_symlink_referent:
3989         file_stats wasn't set properly in that case.
3990
3991         * tests/chgrp/basic: Adjust to above changes.
3992
3993 2004-05-20  Paul Eggert  <eggert@cs.ucla.edu>
3994
3995         * tests/chgrp/basic: Test that chgrp -h does not fail on
3996         symlinks, even on hosts where that's not supported.
3997         Test that if -R is specified without -H or L, -h is assumed.
3998         Test that chown() is not optimized away.
3999
4000 2004-05-18  Paul Eggert  <eggert@cs.ucla.edu>
4001
4002         Several fixes to chgrp and chown for compatibility with POSIX and BSD:
4003
4004           Check for incompatible options.  When -R and --dereference are
4005           both used, then either -H or -L must also be used.  When -R and -h
4006           are both used, then -P must be in effect.
4007
4008           -H, -L, and -P have no effect unless -R is also specified.
4009           If -P and -R are both specified, -h is assumed.
4010
4011           Do not optimize away the chown() system call when the file's owner
4012           and group already have the desired value.  This optimization was
4013           incorrect, as it failed to updated the last-changed time and reset
4014           special permission bits, as POSIX requires.
4015
4016           Do not report an error if the owner or group of a
4017           recursively-encountered symbolic link cannot be updated because
4018           the file system does not support it.
4019
4020         * NEWS: Document the above.
4021
4022         * src/chgrp.c (main): Check for incompatible options.  -R --dereference
4023         requires either -H or -L, and -R -h requires -P.  If -H, specify
4024         FTS_PHYSICAL as well as FTS_COMFOLLOW; this is faster.  Make this
4025         file as much like chown.c as possible.
4026         * src/chown.c (main): Likewise.
4027
4028         * src/chown-core.c (change_file_owner): Use ent->fts_statp only if
4029         needed.  Chown a directory only after chowning its children; this
4030         avoids problems if the new directory ownership doesn't permit
4031         access to the children.  Dereference symlinks before doing
4032         ROOT_DEV_INO_CHECK, not after, so that we catch symlinks to /.
4033         Do not optimize away the chown() system call when the file's owner
4034         and group already have the desired value.  POSIX does not permit
4035         this optimization.  Rely on chown and lchown to do the right
4036         thing with symlinks and/or -1 arguments, now that we have wrappers
4037         to do this.  Use ENOTSUPP not ENOSYS, and ignore all ENOTSUPP
4038         errors, not just command-line errors.
4039         (chown_files): Pass FTS_NOSTAT to xfts_open if we don't need file status.
4040
4041         * src/system.h (ENOTSUP): Remove.
4042
4043         * tests/chgrp/basic: Use chown --from to discover whether the
4044         group changed, since chgrp now changes unconditionally.  This
4045         complicates the sed script a bit.  Do not specify --dereference,
4046         since it's the default (and we want to test this).  Adjust output
4047         to match the fact that chgrp no longer optimizes the case of
4048         changing a file's group to the same value as before.
4049         * tests/chgrp/posix-H: Do not attempt to combine -h and -H; these
4050         options are incompatible, and their behavior is undefined with POSIX.
4051         (changed, not_changed): Adjust to match the fact that -h is no longer
4052         specified.  Sort names.
4053         * tests/chown/deref: Adjust error-diagnostic spelling to match new
4054         behavior.
4055
4056 2004-06-07  Paul Eggert  <eggert@cs.ucla.edu>
4057
4058         * src/uname.c (main): Fix typo introduced on 2003-05-10 that
4059         prevented a diagnostic of any operands.
4060
4061 2004-06-08  Jim Meyering  <jim@meyering.net>
4062
4063         * src/shred.c (direct_mode): Turn it on/off with directio, too.
4064
4065 2004-06-07  Jim Meyering  <jim@meyering.net>
4066
4067         Enable direct-mode I/O (bypassing the buffer cache), if possible.
4068         Prompted by a suggestion from Kalle Olavi Niemitalo
4069         in http://bugs.debian.org/207035.
4070         * src/shred.c (direct_mode): New function.
4071         (do_wipefd): Turn on direct-mode I/O.
4072         (dopass): If a file's first write fails with EINVAL,
4073         turn off direct-mode I/O and retry the write.
4074
4075 2004-06-05  Paul Eggert  <eggert@cs.ucla.edu>
4076
4077         * src/tr.c (main): "tr -d a b" is now a fatal error even if
4078         POSIXLY_CORRECT is set.  The POSIX SYNOPSIS does not allow this
4079         option combination.
4080
4081 2004-06-04  Paul Eggert  <eggert@cs.ucla.edu>
4082
4083         * src/shred.c (dopass): Don't subtract 1 from the offset after
4084         a write error.  Problem reported by Jon Peatfield in:
4085         http://lists.gnu.org/archive/html/bug-coreutils/2004-06/msg00020.html
4086
4087 2004-06-02  Paul Eggert  <eggert@cs.ucla.edu>
4088
4089         Fix bug reported by Buciuman Adrian in
4090         <http://mail.gnu.org/archive/html/bug-coreutils/2003-08/msg00105.html>
4091         where 'dd' created a file that was too large.  The bug was that dd
4092         assumed that the input file offset does not advance after a failed
4093         read; but POSIX says that the input file offset is undefined after
4094         a failed read.
4095
4096         * src/dd.c (MAX_BLOCKSIZE): New macro.
4097         (input_seekable, input_seek_errno, input_offset,
4098         input_offset_overflow): New vars.
4099         (scanargs): Reject block sizes greater than MAX_BLOCKSIZE.
4100         (advance_input_offset): New function.
4101         (skip_via_lseek): Set errno to zero when reporting our failure,
4102         so that we don't report based on garbage errno.
4103         (skip): If fdesc is standard input, advance the input offset.
4104         Do not quit if reading, and if noerror was specified;
4105         POSIX seems to require this.
4106         If read fails on output file, report the earlier lseek failure
4107         instead; this fixes a FIXME in dd_copy.
4108         (advance_input_after_read_error): New function.
4109         (dd_copy): Use it, instead of assuming that failed reads
4110         do not advance the file pointer.  Advance input offset
4111         after nonfailed reads.  Advance only a partial block if
4112         the previous read (before the failed read) succeeded, and
4113         do not generate an output block of zeros in this case.
4114         (main): Determine initial input offset, seekability of input,
4115         and error if it wasn't seekable.
4116
4117 2004-06-02  Jim Meyering  <jim@meyering.net>
4118
4119         rm (without -f) could hang unnecessarily when attempting to
4120         remove a symlink to a file on an off-line NFS-mounted partition.
4121         Reported by David Howells in https://bugzilla.redhat.com/124699.
4122         * src/remove.c (write_protected_non_symlink): New function.
4123         Don't invoke euidaccess on symlinks.
4124         (prompt): Use write_protected_non_symlink rather than using
4125         euidaccess directly, being careful not to call lstat twice for a file.
4126
4127         Fix a bug in how the --output-delimiter=D option works with
4128         abutting byte or character ranges.  Reported by David Krider in
4129         http://lists.gnu.org/archive/html/bug-coreutils/2004-05/msg00132.html
4130         * src/cut.c (print_kth): Remove special case for open-ended range.
4131         (set_fields): Record the range start index for an interval even
4132         when it abuts another interval on its low side.
4133         Also record the range start index of the longest right-open-interval.
4134         * tests/cut/Test.pm: Add tests of --output-delimiter=S with
4135         abutting and overlapping byte ranges.
4136
4137 2004-06-01  Paul Eggert  <eggert@cs.ucla.edu>
4138
4139         Some POSIX-conformance cleanups for tr.
4140
4141         * src/tr.c (posix_pedantic): Remove; no longer needed since
4142         we need to test this in just one place now.
4143         (usage): Mention -C.
4144         (unquote): Note that \055, \n, etc are escaped.
4145         Do not worry about POSIXLY_CORRECT when warning about ambiguous
4146         escape sequences.
4147         \ at end of string stands for itself.
4148         Do not diagnose invalid backslash escapes: POSIX says the behavior
4149         is unspecified in this case, so we don't need to diagnose it.
4150         (main): Add support for -C (currently an alias for -c).
4151         Do not diagnose 'tr [:upper:] [:upper:], as POSIX does not require
4152         a diagnostic here.
4153         * tests/tr/Test.pm: New tests bs-055, bs-at-end, repeat-Compl.
4154         Fix comment for range-a-a.
4155
4156 2004-05-25  Paul Eggert  <eggert@cs.ucla.edu>
4157
4158         Improve the efficiency (and in one case, correctness) of code
4159         that reads symlinks.
4160
4161         * src/copy.c (copy_internal): Don't use alloca, as it can mess up
4162         royally if the link length is long (e.g., GNU/Hurd).  Use
4163         xreadlink instead, it's safer.  Don't bother to read the link if
4164         it's the wrong size.  Add a FIXME because this area is a bit murky
4165         and undocumented.
4166         * src/ls.c (get_link_name): Update use of xreadlink.
4167         * src/readlink.c (main): Likewise.
4168         * src/stat.c (print_stat): Likewise.
4169
4170 2004-06-01  Jim Meyering  <jim@meyering.net>
4171
4172         * src/env.c (main): Prefer the notation `STREQ (a, b)'
4173         over `!strcmp (a, b)'.
4174         * src/sort.c (main, sort_buffer_size): Prefer the notation
4175         `STREQ (a, b)' over `strcmp (a, b) == 0'.
4176         * src/date.c (batch_convert): Likewise.
4177         * src/expr.c (nextarg): Likewise.
4178         * src/su.c (correct_password, restricted_shell, main): Likewise.
4179         * src/ptx.c (swallow_file_in_memory, main): Likewise.
4180         * src/test.c (binary_operator, and, or, main): Likewise.
4181
4182 2004-05-13  Paul Eggert  <eggert@cs.ucla.edu>
4183
4184         * NEWS: echo compatibility cleanup.
4185         * doc/coreutils.texi (echo invocation): Document the changes.
4186         * src/echo.c (V9_ECHO): Remove; always enabled.
4187         (DEFAULT_ECHO_TO_XPG): Renamed from V9_DEFAULT, so that
4188         we use the same naming convention as bash.  Now an enum,
4189         not a macro.
4190         (usage): Reword to mention -e/-E more accurately.
4191         Mention \0NNN (the POSIX syntax) rather than \NNN (nonstandard).
4192         (hextobin): New function.
4193         (main): Use bool rather than int for local vars when appropriate.
4194         Do not allow options if POSIXLY_CORRECT, unless we are using
4195         BSD semantics and the first argument is "-n".
4196         Don't pass unnecessary extra arg to parse_long_options.
4197         do_v9 now defaults to DEFAULT_ECHO_TO_XPG, not to allow_options.
4198         Do not look for options if !allow_options.
4199         Use size_t rather than int when appropriate.
4200         Open-code option test rather than using strrchr.
4201         Use faster test for "-".
4202         Avoid redundant argc test.
4203         Add support for \x, for Bash compatibility.
4204         Use e.g. '\a' rather than '\007', for portability to EBCDIC hosts.
4205         When '\c' is encountered, stop printing immediately, as POSIX
4206         requires.
4207         Add support for \xhh syntax.
4208         Add support for \0ooo syntax; POSIX requires this.
4209
4210 2004-06-01  Jim Meyering  <jim@meyering.net>
4211
4212         * Use automake-1.8b.  Regenerate dependent files.
4213
4214 2004-05-31  Jim Meyering  <jim@meyering.net>
4215
4216         * tests/Makefile.am.in (TESTS_ENVIRONMENT): Define PATH to include
4217         the build src/ directory -- at the front.
4218         ($(srcdir)/$x-tests): Depend on Makefile.am.
4219         Use $x as the program name, except when it would be `test' (test is
4220         the sole program tested via mk-script that is also a shell built-in).
4221         In that case, use the old ../../src/$x.
4222
4223 2004-05-30  Jim Meyering  <jim@meyering.net>
4224
4225         Work around HPUX /bin/cc compiler bug that is exposed, now that
4226         sets are arrays of type `bool'.  More details here:
4227         http://lists.gnu.org/archive/html/bug-gnulib/2004-05/msg00094.html
4228         FIXME: verify that the above URL points to the right message
4229
4230         * src/tr.c (card_of_complement): Use cleaner `sizeof in_set'
4231         rather than `N_CHARS * sizeof(in_set[0])'.  Using HPUX's /bin/cc
4232         (aC++/ANSI C B3910B A.05.55 [Dec 04 2003]) on an ia64-hp-hpux11.22
4233         system, those two expressions are not the same (256 vs. 1024).
4234         The effect of this problem was that `tr -c x y' would fail:
4235         tr: when not truncating set1, string2 must be non-empty
4236         (set_initialize): Remove unnecessary initialization of the `in_set'
4237         buffer; that initialization triggered the same compiler bug as above.
4238
4239 2004-05-29  Paul Eggert  <eggert@cs.ucla.edu>
4240
4241         tr cleanup, mostly having to do with integer type ranges.
4242         Remove all casts.
4243
4244         * tests/tr/Test.pm: Add a few tests for the below.  Alas, most of
4245         the test cases wouldn't be portable, or would take too much CPU
4246         time, or both.
4247
4248         * src/tr.c (N_CHARS, N_CHAR_CLASSES): Now an enum, not a macro.
4249         This is safe since the code already assumes N_CHARS fits in int.
4250         (Filter): Remove: we want to prototype everything.
4251         (ORD, CHR): Remove.  All uses removed.  Some replaced with:
4252         (uchar): New function.  All places where a char must be converted
4253         to an unsigned char are now done this way, not by ad-hoc methods.
4254         (count): New type.  Use it whenever counts or states are needed.
4255         (BEGIN_STATE): Increase from INT_MAX - 1 (which was bogus, anyway,
4256         since we used it in an unsigned int context) to UINTMAX_MAX - 1.
4257         (REPEAT_COUNT_MAXIMUM): New macro.  Use it in place of BEGIN_STATE
4258         whenever appropriate.
4259         (NOT_A_CHAR): Remove global macro; now a local enum.
4260         (UL_LOWER, UL_UPPER, UL_NONE): No longer specify values, since
4261         the rest of the code no longer depends on them.
4262         (class_ok): Remove; all uses changed to use inline comparisons.
4263         (RE_NO_TYPE): Remove; wasn't used or needed.
4264         (struct List_element): normal_char and equiv_code are now unsigned
4265         char, not int.
4266         first_char, last_char, and the_repeated_char are now unsigned char,
4267         not unsigned int.  repeat_count is now count, not size_t.
4268         All uses changed.
4269         (struct Spec_list): state is now count, not unsigned int.
4270         lengthis now count, not size_t.
4271         n_indefinite_repeats is now size_t, not int.
4272         has_equiv_class, has_char_class, and has_restricted_char_class
4273         are now bool, not int.  All uses changed.
4274         (struct E_string): s is now char *, not unsigned char *.
4275         escaped is now bool *, not int *.  All uses changed.
4276         (ES_MATCH): Remove macro, replacing with:
4277         (es_match): New inline function.  All uses changed.
4278         (squeeze_repeats, complement, posix_pedantic, truncate_set1,
4279         translating): Now bool, not int.
4280         (io_buf): Now char array, not unsigned char.
4281         (SET_TYPE): Remove.  All uses replaced with bool.
4282         (is_equiv_class_member, unquote, append_range, append_char_class,
4283         append_equiv_class, find_closing_delim, star_digits_closebracket,
4284         build_spec_list, parse_str, homogeneous_spec_list):
4285         Now returns bool, not int.  All uses changed.
4286         (is_equiv_class_member): Now inline.
4287         (is_equiv_class_member, is_char_class_member, make_printable_str,
4288         append_normal_char, append_range, append_repeated_char,
4289         get_s2_spec_stats):
4290         Args are now of proper integer type.
4291         (unquote, look_up_char_class, make_printable_str,
4292         append_equiv_class, build_spec_list, squeeze_filter):
4293         Avoid unsigned char *p; gently convert *p to unsigned char instead.
4294         (unquote, get_spec_stats): Do not jump past declarations and then
4295         use them; C doesn't allow this in portable programs.
4296         (make_printable_str): Check for overflow in size calculations.
4297         (xmemdup): Remove.  All uses rewritten.
4298         (find_bracketed_repeat): Args are now of proper pointer-to-integer
4299         type.  Do not reject [c*0].  Use xstrtoumax, not xstrtoul.
4300         (find_bracketed_repeat, star_digits_closebracket): Check that the
4301         digits are not escaped.
4302         (build_spec_list): Don't bother to copy opnd_str; not needed.
4303         (build_spec_list, get_next): Simplify internal logic a bit.
4304         (card_of_complement): Fix bug due to char overflow.
4305         (get_spec_stats): Don't assume len fits into int.
4306         Check for integer overflow.  Use abort() rather than assert(0).
4307         (string2_extend): Fix subscript error: is_char_class_member (..., 255)
4308         was being invoked.
4309         (squeeze_filter): READER is never null now; simplify code.
4310         READER arg now has a simpler type.  Remove unnecessary casts.
4311         (squeeze_filter, main): Calls to fwrite improperly checked result
4312         against zero, rather than against requested size.
4313         (plain_read): New function.
4314         (read_and_delete, read_and_xlate):
4315         Remove unused filter arg, and don't worry about hit_eof.
4316         Simplify by using plain_read.
4317         (set_initialize): Args are bool and bool *, not int and SET_TYPE *.
4318         (main): Always pass a non-null procedure to squeeze_filter.
4319         Rewrite so that class_ok isn't needed.
4320
4321 2004-05-29  Paul Eggert  <eggert@cs.ucla.edu>
4322
4323         * src/shred.c (dosync): Ignore EBADF errors, as IRIX 6.5
4324         fdatasync reports EBADF when syncing (unwritable) directories.
4325         Problem reported by Albert Chin-A-Young in:
4326         http://lists.gnu.org/archive/html/bug-coreutils/2004-05/msg00165.html
4327
4328 2004-05-29  Jim Meyering  <jim@meyering.net>
4329
4330         * tests/chown/deref: Fix typo: use ls -ldo, not ls -ldg.
4331         Patch from Albert Chin.
4332
4333         * src/ptx.c (text_buffer_maxend): Remove declaration of unused variable.
4334
4335         * src/remove.c (push_dir): Merge declaration and adjacent assignment
4336         into a single statement.
4337
4338 2004-05-28  Jim Meyering  <jim@meyering.net>
4339
4340         * src/remove.c (AD_mark_helper): Eliminate an unnecessary comparison.
4341
4342 2004-05-22  Jim Meyering  <jim@meyering.net>
4343
4344         rm -r would get a failed assertion when run from an inaccessible
4345         directory and with two or more command line arguments including an
4346         absolute-named directory followed by a relative-named directory.
4347
4348         * src/remove.h (struct rm_options) [require_restore_cwd]: New member.
4349         * src/remove.c (struct cwd_state): Define.
4350         (AD_pop_and_chdir): Redesign interface so that a restore_cwd failure
4351         can be detected by the caller.  Instead of returning a malloc'd
4352         directory name, communicate it to caller via a new parameter, and
4353         return an indication of whether restore_cwd failed.  Update caller.
4354         Eliminate an unnecessary call to AC_stack_top.
4355         (remove_dir): Change type of cwd_state parameter to `struct cwd_state'
4356         so we can now communicate to caller whether/how functions like
4357         restore_cwd have failed.  Update caller.
4358         (rm_1): Fail if we've failed to restore the working directory
4359         and the name of the next file to remove is `.'-relative.
4360         (rm): Fail if the require_restore_cwd flag is true and we've
4361         failed to restore the working directory.
4362         * src/mv.c (rm_option_init): Initialize new member,
4363         x->require_restore_cwd.
4364         * src/rm.c (rm_option_init): Likewise.
4365
4366 2004-05-21  Jim Meyering  <jim@meyering.net>
4367
4368         * tests/rm/inaccessible: New test for the above fix.
4369         * tests/rm/Makefile.am (TESTS): Add inaccessible.
4370
4371         * src/remove.c (rm): Use free rather than XFREE.
4372         (remove_dir): Use xmalloc, not XMALLOC.
4373         (ds_init): Likewise.
4374
4375 2004-05-20  Jim Meyering  <jim@meyering.net>
4376
4377         * Makefile.maint (sc_unmarked_diagnostics): Now that the unmarked
4378         diagnostics in shred.c have been fixed, don't exempt shred.c from
4379         this check.
4380
4381         * src/shred.c: Use translatable diagnostics, e.g.
4382         change "%s: remove" to _("%s: failed to remove") and
4383         change "%s: close"  to _("%s: failed to close").
4384
4385 2004-05-17  Paul Eggert  <eggert@cs.ucla.edu>
4386
4387         * src/shred.c (names): Bring back lower-case letters, "_", and
4388         ".".  But continue to omit +, =, %, @, #, as they're either
4389         shell metacharacters (for some shells) or are not in some
4390         character sets, or (in the case of '%') must be a
4391         metacharacter somewhere.
4392
4393 2004-05-16  Paul Eggert  <eggert@cs.ucla.edu>
4394
4395         * src/cut.c (cut_fields): Adjust to new signature of getndelim2.
4396
4397 2004-05-17  Jim Meyering  <jim@meyering.net>
4398
4399         * src/shred.c (incname): Decrement `len' only once per loop iteration.
4400
4401         chgrp and chown now dereference symlinks by default, per POSIX.
4402         Reported by Michal Politowski as http://bugs.debian.org/249177.
4403
4404         * src/chown-core.c (chopt_init): Affect each symlink referent by default.
4405         * src/chown.c (usage): Update to reflect this.
4406         * src/chgrp.c (usage): Likewise.
4407         * NEWS: Describe the change.
4408         Adapt tests accordingly.
4409         * tests/chgrp/basic: Use -h where necessary to retain semantics.
4410         * tests/chgrp/deref: Likewise.
4411         * tests/chgrp/posix-H: Likewise.
4412
4413 2004-05-15  Paul Eggert  <eggert@cs.ucla.edu>
4414
4415         In shred, check for errors from fdatasync more carefully.  If
4416         fdatasync fails with errno==EINVAL, it means this implementation
4417         does not support synchronized I/O for this file.  Do not report
4418         this as an error, as (for example) AIX 5.2 fdatasync reports it
4419         for raw disk devices.  Problem reported by Albert Chin in
4420         <http://mail.gnu.org/archive/html/bug-gnu-utils/2004-05/msg00028.html>.
4421
4422         Check for write errors, though: the old code ignored them.
4423         Improve error checking in a few other cases, too (e.g., close of a
4424         directory).
4425
4426         Also, change several 'int' values to 'bool', so that the error
4427         checking is a bit clearer.  Similarly, change unsigned values
4428         to size_t where appropriate.
4429
4430         * src/shred.c: Include "dirname.h".
4431         (datasync) [!HAVE_FDATASYNC]: Remove.
4432         (dosync): New function.
4433         (dopass): Use it.  Return 1 on write error, -1 on other error.
4434         All callers changed.  Report write error if dosync does.
4435         (do_wipefd, wipefd, wipename, wipefile): Return bool (true/false),
4436         not int (0/-1).  All callers changed.  Return false if there's a
4437         write error.
4438         (incname): Return bool (true/false), not int (0/1).  Accept
4439         size_t length, not unsigned.  All callers changed.  Do not
4440         bother checking for non-digits; it can't happen.  Replace
4441         recursion with iteration.
4442         (wipename): Use dir_name, base_name, etc. instead of assuming
4443         Unix file names.  Use size_t for length, not unsigned.
4444         Report error if unlink or close fails.
4445         (wipename, main): Use bool for booleans.
4446
4447         (names): Use only digits and uppercase letters, for greater
4448         portability.
4449
4450 2004-05-16  Jim Meyering  <jim@meyering.net>
4451
4452         * tests/chown/deref: New test for the yesterday's change.
4453         * tests/chown/Makefile.am (TESTS): Add deref.
4454
4455 2004-05-15  Jim Meyering  <jim@meyering.net>
4456
4457         chown --dereference did nothing when the owner/group of a
4458         symlink matched the desired owner/group.  Reported by David Malone.
4459         Also reported in 1999 as http://bugs.debian.org/39642.
4460
4461         * src/chown-core.c (change_file_owner): When --dereference has
4462         been specified, and when processing a symlink, stat it to get the
4463         owner and group of the referent.
4464
4465 2004-05-14  Jim Meyering  <jim@meyering.net>
4466
4467         * man/pwd.x, man/echo.x, man/printf.x: Fix typo:
4468         s/supercede/supersede/ reported by Andrew Fabbro.
4469
4470 2004-05-13  Paul Eggert  <eggert@cs.ucla.edu>
4471
4472         Improve performance of `sort -m' on large files, at the cost of
4473         making some contrived examples unsafe.  POSIX allows this
4474         optimization.  Performance problem reported by Jonathan Baker in
4475         <http://mail.gnu.org/archive/html/bug-coreutils/2004-05/msg00071.html>.
4476
4477         * src/sort.c (first_same_file): Do not treat input pipes
4478         differently from other files.
4479         * doc/coreutils.texi (sort invocation): Document that "sort -m -o F"
4480         might write F before reading all the input.
4481         * NEWS: Likewise.
4482
4483 2004-05-12  Paul Eggert  <eggert@cs.ucla.edu>
4484
4485         * src/od.c (print_ascii, dump_strings): Use e.g. '\a' rather than
4486         '\007', for portability to EBCDIC hosts.
4487         * src/printf.c (print_esc_char): Likewise.
4488         * src/tr.c (unquote, make_printable_str): Likewise.
4489
4490 2004-05-12  Jim Meyering  <jim@meyering.net>
4491
4492         * src/remove.c (AD_pop_and_chdir): Move lstat-`.' into if-block
4493         where the result is used.  This avoids one unnecessary lstat call
4494         per command line argument.
4495
4496 2004-05-12  Paul Eggert  <eggert@cs.ucla.edu>
4497
4498         Don't assume that "make -C" works; Solaris "make" doesn't have -C.
4499
4500         * src/Makefile.am (all_programs.list): New rule, copied from
4501         man/Makefile.am and tests/Makefile.am, except that we use the
4502         system tr rather than ./tr and we don't use tr -s.
4503         * tests/Makefile.am (all_programs): Use it.
4504         * man/Makefile.am (all_programs): Likewise.  Renamed from programs,
4505         for consistency.  All uses changed.
4506
4507 2004-05-11  Jim Meyering  <jim@meyering.net>
4508
4509         * tests/rm/unread3: New test, for the above fix and today's
4510         lib/save-cwd.c improvement.
4511         * tests/rm/Makefile.am (TESTS): Add unread3.
4512
4513         * src/rm.c: Don't include "save-cwd.h".  It's no longer used.
4514
4515 2004-05-10  Jim Meyering  <jim@meyering.net>
4516
4517         * tests/install/trap: New file.  Test for bug fix of 2004-04-18.
4518         * tests/install/Makefile.am (TESTS): Add trap.
4519
4520         * src/remove.c (AD_push): Don't use errno in diagnostic about
4521         `changed dev/ino'.
4522
4523         Remove these generated files from CVS.
4524         * tests/cut/cut-tests, tests/date/date-tests, tests/join/join-tests:
4525         * tests/ls/ls-tests, tests/pr/pr-tests, tests/tac/tac-tests:
4526         * tests/tail/tail-tests, tests/test/test-tests, tests/tr/range-tests:
4527         * tests/tr/tr-tests, tests/wc/wc-tests:
4528
4529 2004-05-09  Jim Meyering  <jim@meyering.net>
4530
4531         * src/tr.c (unquote): Use xcalloc rather than xmalloc and
4532         a loop initializing the just-allocated memory to zero.
4533
4534 2004-05-08  Jim Meyering  <jim@meyering.net>
4535
4536         * tests/rm/no-give-up: New file; check for today's fix.
4537         * tests/rm/Makefile.am (TESTS): Add no-give-up.
4538
4539 2004-05-08  Paul Eggert  <eggert@cs.ucla.edu>
4540
4541         Fix bug where "rm" gave up too easily, reported by Dan Jacobsen in
4542         <http://mail.gnu.org/archive/html/bug-coreutils/2004-05/msg00013.html>.
4543
4544         * src/remove.c (remove_entry): Check for errno values like ENOENT
4545         that show the file cannot be directory, instead of for errno
4546         values like EPERM that show the file might be a directory.  This
4547         is necessary because, when a single unlink() call has multiple
4548         reasons to fail, it can set errno to any of those reasons; it's
4549         only the rare errno value like ENOENT that excludes all the other
4550         possible reasons to fail even when the file is a directory.
4551         (remove_cwd_entries): Don't attempt chdir if the file is known
4552         to not be a directory.
4553         (remove_dir): Use the same method that remove_cwd_entries uses
4554         (for some reason they differed).  Don't assert that saved_errno
4555         must be EPERM; it might be just about anything.
4556
4557 2004-05-06  Jim Meyering  <jim@meyering.net>
4558
4559         * src/id.c (xgetgroups): Use xnmalloc, rather than xmalloc.
4560         Don't add `1' to the buffer size (it was to protect against malloc
4561         implementations that fail to allocate a buffer of size zero).
4562         That is no longer necessary, since we use a malloc wrapper
4563         on such systems.
4564
4565         * src/wc.c (get_input_fstatus): Use xnmalloc, rather than xmalloc.
4566         * src/head.c (elide_tail_bytes_pipe): Likewise.
4567         * src/df.c (main): Likewise.
4568         * src/shred.c (do_wipefd): Likewise.
4569         * src/users.c (list_entries_users): Likewise.
4570         * src/tail.c (main): Likewise.
4571         * src/md5sum.c (main): Likewise.
4572
4573 2004-04-29  Paul Eggert  <eggert@cs.ucla.edu>
4574
4575         * src/df.c (show_disk, show_point): If several filesystems are
4576         mounted on the same mount point, prefer the last one, not the first.
4577         Problem reported by Christian Jones in
4578         <http://mail.gnu.org/archive/html/bug-coreutils/2004-04/msg00200.html>.
4579         (show_disk): Remove unused statp arg.  Return bool, not int.
4580         (show_point): Rewrite to avoid gotos.  Use the same algorithm
4581         for lofs and dummies for each pass through the mount table,
4582         rather than subtly different algorithms (which are probably
4583         inadvertent).
4584
4585 2004-05-03  Jim Meyering  <jim@meyering.net>
4586
4587         * Makefile.am (EXTRA_DIST): Add m4/ChangeLog, now that we no longer
4588         have m4/Makefile*.
4589
4590 2004-05-01  Jim Meyering  <jim@meyering.net>
4591
4592         When chown or chgrp is modifying the referent of a symlink,
4593         use the chown(2) function, if possible.
4594         * src/chown-core.c (change_file_owner): Don't hard-code the
4595         open/fchown/close kludge here.  Use `chown' instead.
4596         The chown function works just fine on conforming systems.
4597         Other systems now go through the new chown wrapper that
4598         resorts to the old kludge.
4599
4600         * src/chown-core.c (change_file_owner): Add a comment.
4601
4602 2004-04-27  Jim Meyering  <jim@meyering.net>
4603
4604         * src/ptx.c: Make over 40 global extern variables `static'.
4605         (syntax_table, re_syntax_table): Remove declarations of two unused
4606         variables (they were exposed by the above change).
4607
4608         * src/du.c (G_fail, opt_nul_terminate_output): Declare `static'.
4609         * src/ln.c (backup_type): Likewise.
4610
4611         * src/remove.c (rm): Add `extern' keyword.
4612         * src/cp-hash.c (forget_created, remember_created)
4613         (src_to_dest_lookup, remember_copied, hash_init, forget_all): Likewise.
4614         * src/copy.c (dest_info_init, src_info_init, copy): Likewise.
4615         * src/chown-core.c (chopt_init, chopt_free, gid_to_name)
4616         (uid_to_name, chown_files): Likewise.
4617
4618         * src/Makefile.am (sc_tight_scope): New rule.
4619         * Makefile.maint (sc_tight_scope): New rule.
4620         (syntax-check-rules): Add it.
4621
4622 2004-04-26  Jim Meyering  <jim@meyering.net>
4623
4624         * Use automake-1.8.4.  Regenerate dependent files.
4625
4626         * src/sort.c (limfield): Make a comment clearer.
4627
4628 2004-04-25  Paul Eggert  <eggert@twinsun.com>
4629
4630         Fix POSIX-conformance bug: "sort -k 3,3.5b" is supposed to skip
4631         leading blanks when computing the location of the field end;
4632         it is not supposed to skip trailing blanks.  Solaris 8 "sort"
4633         does conform to POSIX.  Also fix the documentation to clarify
4634         this and related issues.
4635
4636         * doc/coreutils.texi (sort invocation): Mention -k earlier, so
4637         that the options are in alphabetical order.  Describe how -b works
4638         more-accurately; this involves fixing some examples, too.  Mention
4639         what happens if the start field falls after an end field or after
4640         a line end.  Warn about using -k without -b, -g, -M, -n, or -t.
4641         Add an example of how to sort IPv4 addresses and Apache Common
4642         Log Format dates.  Remove a duplicate example.
4643         (Putting the tools together): Use separate options rather
4644         than agglomerating them.
4645         * src/sort.c (limfield): Use skipeblanks, not skipsblanks, to
4646         decode whether to skip leading blanks.
4647         (trailing_blanks): Remove.
4648         (fillbuf, getmonth, keycompare): Don't trim trailing blanks.
4649
4650         * tests/pr/Test.pm: Fix typo in env_default comment.
4651         * tests/sort/Test.pm: Likewise.
4652         (18c, 18d): Reverse the order of output lines, so that the
4653         test cases conform to POSIX.
4654
4655 2004-04-22  Paul Eggert  <eggert@twinsun.com>
4656
4657         More signal-handling cleanup for ls.c.  Do not allow signals to
4658         happen between arbitrary output bytes, as the
4659         restore-default-color sequence can bollix up multibyte chars or
4660         color-change sequences in the ordinary output.  Instead, process
4661         signals only between printing a file name and changing the color
4662         back to non_filename_text color.  That way, if the signal handler
4663         changes the color (to the default), 'ls' will change it back when
4664         'ls' continues (after being suspended).
4665
4666         Also, do not bother with signal-handling unless stdout is a
4667         controlling terminal; this lets stdio buffer better when "ls
4668         --color" is piped or sent to a file.
4669
4670         * src/ls.c (sigprocmask, sigset_t) [!defined SA_NOCLDSTOP]: New macros.
4671         Do not include "full-write.h"; no longer needed.
4672         (tcgetpgrp) [! HAVE_TCGETPGRP]: New macro.
4673         (put_indicator_direct): Remove.  All callers changed to use
4674         put_indicator.
4675         (caught_signals, interrupt_signal, stop_signal_count): New vars.
4676         (restore_default_color): Don't bother checking for put_indicator
4677         failure.
4678         (sighandler): Don't handle SIGTSTP; that's another handler now.
4679         Simply set interrupt_signal to the signal, then exit.
4680         (stophandler, process_signals): New functions.
4681         (main): Don't output any color changes until _after_ the signal
4682         handlers are set up.  This fixes a race condition where 'ls'
4683         could be interrupted while initializing colors, and leaving the
4684         terminal in an undesirable state.
4685         Don't mess with signal-handling if standard output is not a
4686         controlling terminal.
4687         When exiting, restore the default color, then restore the
4688         default signal handling, then act on any signals that weren't
4689         acted on yet.
4690         Do not print //DIRED// etc. in colors; this avoids the need
4691         to catch signals when printing them.
4692         (print_name_with_quoting): Process signals just before switching
4693         color back to non_filename_text.
4694
4695 2004-04-23  Jim Meyering  <jim@meyering.net>
4696
4697         Avoid segfault on systems for which SIZE_MAX != (size_t) -1.
4698         * src/ls.c (quote_name): Use SIZE_MAX, not -1, in calls
4699         of quotearg_buffer.  Patch by Mikulas Patocka.
4700
4701 2004-04-18  Paul Eggert  <eggert@twinsun.com>
4702
4703         tee ignored SIGPIPE, but POSIX doesn't allow this.
4704
4705         * src/tee.c (main): Do not ignore SIGPIPE, as POSIX 1003.1-2001
4706         does not allow this.  This undoes the 1996-10-24 patch.
4707
4708 2004-04-18  Paul Eggert  <eggert@twinsun.com>
4709
4710         Signal-handling cleanup for coreutils.  Here are the highlights:
4711
4712          - csplit sometimes failed to remove files when interrupted.
4713          - csplit didn't clean up if two signals arrived nearly simultaneously.
4714          - install -s would infloop on System V if SIGCHLD was ignored.
4715          - ls could incorrectly restore color if multiple signals
4716            arrived nearly simultaneously.
4717
4718         * src/csplit.c (sigprocmask, sigset_t) [!defined SA_NOCLDSTOP]:
4719         Define.
4720         (filename_space, prefix, suffix, digits, files_created, remove_files):
4721         Now volatile.
4722         (caught_signals): New var.
4723         (cleanup): Block signals while deleting all files.
4724         (cleanup_fatal, handle_line_error, regexp_error):
4725         Mark with ATTRIBUTE_NORETURN.
4726         (create_output_file, close_output_file, interrupt_handler):
4727         Block signals while changing the number of output files,
4728         to fix some race conditions.
4729         (delete_all_files): Do nothing if remove_files is zero.
4730         Clear files_created.
4731         (main): Don't mess with signals until after argument processing
4732         is done.
4733
4734         * src/csplit.c (main): Rewrite signal-catching code to make it
4735         similar to other coreutils programs.  When processing signals,
4736         block all signals that we catch, but do not block signals that we
4737         don't catch.  Avoid problems with unsigned int warnings.
4738         * src/ls.c (main): Likewise.
4739         * src/sort.c (main): Likewise.
4740
4741         * src/csplit.c (interrupt_handler):
4742         Use void, not (obsolete) RETSIGTYPE.
4743         * src/shred.c (sigill_handler, isaac_seed_machdep): Likewise.
4744
4745         * src/csplit.c (interrupt_handler) [defined SA_NOCLDSTOP]:
4746         Use simpler "signal (sig, SIG_DFL)" rather than sigaction equivalent.
4747         * src/ls.c (sighandler) [defined SA_NOCLDSTOP]: Likewise.
4748         * src/sort.c (sighandler) [defined SA_NOCLDSTOP]: Likewise.
4749         * src/nohup.c (main) [!defined _POSIX_SOURCE]: Likewise, except
4750         for SIG_IGN.
4751         * src/tee.c (main) [!defined _POSIX_SOURCE]: Likewise.
4752
4753         * src/install.c: Include <signal.h>.
4754         (main) [defined SIGCHLD]: Set SIGCHLD handler to the default, if -s is
4755         given, since System V fork+wait does not work if SIGCHLD is ignored.
4756
4757         * src/ls.c (sighandler) [!defined SA_NOCLDSTOP]: Reset signal
4758         handler to self, not to SIG_IGN, since SIGTSTP can be received
4759         more than once.
4760         (main): Use SA_RESTART, as that is simpler than checking for EINTR
4761         failures all over the place.
4762
4763 2004-04-20  Jim Meyering  <jim@meyering.net>
4764
4765         * src/remove.c (is_empty_dir): Clarify comment.
4766
4767         * man/help2man: Accept new option: --program-name=NAME, so that we
4768         can override the one in --version output.  This is needed solely
4769         so that test.1 doesn't refer to `[' as the program name.
4770         Reported by Benjamin Cutler as http://bugs.debian.org/205251.
4771         * man/Makefile.am (.x.1): Use help2man's new --program-name option.
4772
4773         * src/pwd.c: Don't include pathmax.h; system.h already does it.
4774
4775         * src/cut.c (cut_fields): Free buffer upon getndelim2 failure.
4776
4777 2004-04-19  Jim Meyering  <jim@meyering.net>
4778
4779         * src/shred.c (isaac_seed_start) [AVOID_USED_UNINITIALIZED_WARNINGS]:
4780         Initialize a buffer to avoid warnings from tools like valgrind.
4781
4782         * Makefile.maint (sc_trailing_blank): New rule.
4783         (syntax-check-rules): Add it.
4784         * .x-sc_trailing_blank: New file.
4785
4786         Make pwd work even if the resulting name is so long that getcwd fails.
4787         * src/pwd.c: (path_free, path_init, path_prepend): New functions.
4788         (nth_parent, find_dir_entry, robust_getcwd): New functions.
4789         (main): First try getcwd, then, upon failure, robust_getcwd.
4790
4791 2004-04-18  Jim Meyering  <jim@meyering.net>
4792
4793         * src/who.c (print_user): Use xrealloc here, rather than
4794         unchecked realloc.  Remove anachronistic casts.
4795
4796         * src/remove.c (full_filename_): Don't leak upon failed realloc.
4797
4798         * src/system.h (readdir_ignoring_dot_and_dotdot): New inline function,
4799         from remove.c.
4800         * src/remove.c (readdir_ignoring_dotdirs): Move function to system.h,
4801         renaming it.  Update uses.
4802
4803 2004-04-17  Jim Meyering  <jim@meyering.net>
4804
4805         * configure.ac: Depend on automake-1.8.3.
4806
4807         * src/join.c (add_file_name): Declare function to be `static'.
4808         (string_to_join_field): Likewise.
4809         * src/remove.c (ds_init, ds_free): Likewise.
4810
4811         * Makefile.maint (sc_prohibit_jm_in_m4): New rule.
4812         (syntax-check-rules): Add to the list.
4813
4814 2004-04-13  Paul Eggert  <eggert@twinsun.com>
4815
4816         Use page-aligned buffers whenever we bother to do I/O using buffer
4817         sizes that are tailored for the files.
4818
4819         * src/cat.c: Include getpagesize.h.
4820         * src/copy.c: Likewise.
4821         * src/shred.c: Likewise.
4822         * src/split.c: Likewise.
4823         * src/cat.c (main): Align I/O buffers to page boundaries.
4824         * src/copy.c (copy_reg): Likewise.
4825         * src/shred.c (dopass): Likewise.
4826         * src/split.c (main): Likewise.
4827         * src/dd.c (ROUND_UP_OFFSET, PTR_ALIGN): Remove.
4828         All uses replaced by ptr_align.
4829         * src/od.c (gcd, lcm): Remove; now in system.h.
4830         * src/system.h (gcd, lcm, ptr_align): New functions, moved from od.c.
4831
4832 2004-04-14  Jim Meyering  <jim@meyering.net>
4833
4834         Remove m4/Makefile.am: it's no longer needed, with newer automake
4835         * configure.ac (AC_CONFIG_FILES): Remove m4/Makefile.in from the list.
4836         * Makefile.am (SUBDIRS): Remove `m4' from the list.
4837
4838 2004-04-13  Jim Meyering  <jim@meyering.net>
4839
4840         * configure.ac: Change `jm_' in AC_DEFINE'd names to `gl_'.
4841
4842 2004-03-27  Paul Eggert  <eggert@twinsun.com>
4843
4844         * NEWS: cp -pu and mv -u (when copying) now take the destination
4845         file system time stamp resolution into account.
4846         * doc/coreutils.texi (mv invocation): Document this.
4847         (cp invocation): Document -u (it was missing!) with new behavior.
4848
4849         * src/copy.c: Include "utimecmp.h".
4850         (copy_internal): Compare time stamps using utimecmp rather than
4851         MTIME_CMP.
4852
4853 2004-04-09  Jim Meyering  <jim@meyering.net>
4854
4855         * Makefile.maint (.re-list): New rule/file, to replace
4856         hard-coded list of header file names.
4857         (sc_system_h_headers): Use the new file.
4858         Don't look for sys2.h anymore.
4859
4860         * src/system.h: Include new "stat-macros.h" rather than hard-coding
4861         all of its macro definitions -- the list was slightly out of date.
4862         Suggestion from Dmitry V. Levin.
4863
4864 2004-04-08  Paul Eggert  <eggert@cs.ucla.edu>
4865
4866         * NEWS: Remove noctty flag from dd.  Suggested by Philippe Troin.
4867         * doc/coreutils.texi (dd invocation): Likewise.
4868         * src/shred.c (O_NOCTTY): Remove redundant decl.
4869         * src/dd.c (flags, usage): Remove noctty flag.
4870         (main): Always use O_NOCTTY when opening files.
4871
4872 2004-04-08  Jim Meyering  <jim@meyering.net>
4873
4874         * src/dd.c (dd_copy): Mark two diagnostics for translations.
4875         (set_fd_flags): Undo part of today's change: it's a little
4876         cleaner -- and more efficient in the common case -- to go
4877         ahead and OR in the -1 when fcntl fails.
4878
4879         * Makefile.maint (sc_dd_max_sym_length): New target.
4880         (syntax-check-rules): Add it.
4881
4882         * src/md5sum.c (PROGRAM_NAME) [algorithm == ALG_SHA1]:
4883         Correct spelling: s/shasum/sha1sum.  Reported by Jesse Kornblum.
4884
4885         * src/dd.c (set_fd_flags): Don't OR in -1 when fcntl fails.
4886         Rename parameter, flags, to avoid shadowing global.
4887         (LONGEST_SYMBOL): Tweak comment.
4888
4889 2004-04-07  Paul Eggert  <eggert@twinsun.com>
4890
4891         * NEWS: New dd conv= symbols nocreat, excl, fdatasync, fsync,
4892         and new dd options iflag= and oflag=.
4893         * src/dd.c (usage): Likewise.
4894         * src/Makefile.am (dd_LDADD, shred_LDADD): Add fdatasync's lib.
4895         * src/dd.c (fdatasync) [!HAVE_FDATASYNC]: New macro.
4896         (C_NOCREAT, C_EXCL, C_FDATASYNC, C_FSYNC): New macros.
4897         (input_flags, output_flags): New vars.
4898         (LONGEST_SYMBOL): New macro.
4899         (struct symbol_value): Renamed from struct conversion.  Members
4900         symbol and value renamed from convname and conversion.  The
4901         symbol value is now an array instead of a pointer; this saves
4902         a bit of space and time in practice.  All uses changed.
4903         (conversions): Add nocreat, excl, fdatasync, fsync.  Now const.
4904         (flags): New constant array.
4905         (iflag_error_msgid, oflag_error_msgid): New constants.
4906         (parse_symbols): Renamed from parse_conversion and generalized
4907         to handle either conversion or flag symbols.
4908         (scanargs): Adjust uses of parse_symbols accodingly.  Add
4909         support for iflag= and oflag=.  Reject attempts to use
4910         both excl and nocreat.
4911         (set_fd_flags): New function.
4912         (dd_copy): Just return X rather than calling quit (X), since our
4913         caller invokes quit with the returned value.  Add support for
4914         fdatasync and fsync.
4915         (main): Add support for iflag=, oflag=, and new conv= symbols.
4916         * src/system.h (O_DIRECT, O_DSYNC, O_NDELAY, O_NOFOLLOW,
4917         O_RSYNC, O_SYNC): Define to 0 if not already defined.
4918
4919         * NEWS: Remove duplicate mention of BLOCKSIZE.
4920
4921 2004-04-02  Andreas Schwab  <schwab@suse.de>
4922
4923         * src/stty.c: Add support for IUTF8 input flag.
4924
4925 2004-04-06  Jim Meyering  <jim@meyering.net>
4926
4927         * src/system.h (makedev) [mkdev && !makedev]: Define in terms of mkdev.
4928         Interix spells it `mkdev'.  Reported by Mark Funkenhauser.
4929
4930 2004-04-04  Jim Meyering  <jim@meyering.net>
4931
4932         A specified format is no longer automatically newline terminated.
4933         If you want a newline at the end of your format, use `\n'.
4934         * src/stat.c (print_it): Don't print a newline at the end of
4935         every format.
4936         (do_statfs): Add a newline at end of each default format string.
4937
4938 2004-03-30  Paul Eggert  <eggert@twinsun.com>
4939
4940         * src/nohup.c (main): Adjust to new calling convention
4941         for set_cloexec_flag.
4942
4943 2004-03-31  Jim Meyering  <jim@meyering.net>
4944
4945         * tests/Fetish.pm (run_tests): Remove `.orig' file.
4946         Remove debugging diagnostic.
4947
4948         Specifying an invalid --width=N (-w) or --gap-size=N (-g)
4949         would not elicit an error.
4950         * src/ptx.c: Include "xstrtol.h" and "quotearg.h".
4951         (main): Don't use atoi.  Use xstrtoul instead.
4952
4953 2004-03-30  Jim Meyering  <jim@meyering.net>
4954
4955         * Makefile.maint (sc_prohibit_atoi_atof): New rule.
4956         (syntax-check-rules): Add it.
4957         * .x-sc_prohibit_atoi_atof: New file.
4958
4959 2004-03-29  Jim Meyering  <jim@meyering.net>
4960
4961         * tests/du/files0-from: Use new OUT_SUBST directive, so that this
4962         test is not sensitive to system-dependent block size differences.
4963         Prompted by a report of Solaris 8 differences from Paul Eggert.
4964
4965         * tests/Fetish.pm: Accept new directives: OUT_SUBST, ERR_SUBST.
4966         Rename `%tmp' to `%actual'.  Reverse order of last two args to
4967         _compare_files (to $actual, $expected) so as to match declaration.
4968
4969 2004-03-28  Paul Eggert  <eggert@twinsun.com>
4970
4971         Fix some gotchas encountered when porting to Solaris 8, using
4972         the Forte 6u2 compiler.
4973
4974         * src/hostname.c [HAVE_SETHOSTNAME && !defined sethostname]:
4975         Declare sethostname, since no Solaris header does it.
4976         * src/who.c: Include "vasprintf.h", for asprintf.
4977
4978 2004-03-28  Jim Meyering  <jim@meyering.net>
4979
4980         Minor optimization:
4981         * src/du.c (process_file): Don't record dev/inode for directories.
4982
4983         Under some circumstances, without -c, du would mistakenly count the
4984         space of hard-linked files, not just the first one it encountered.
4985         Reported by Anthony Thyssen.
4986         * src/du.c (du_files): Don't ever clear the set of `seen' dev/inodes.
4987
4988         * src/du.c: Rename global `print_totals' to `print_grand_total'.
4989
4990         * src/du.c (main): Rearrange filtering loop to be a tiny bit
4991         more efficient.
4992
4993         * src/chown-core.c: Don't include savedir.h -- no longer needed.
4994         * src/chmod.c: Likewise.
4995
4996 2004-03-25  Jim Meyering  <jim@meyering.net>
4997
4998         * src/du.c (main): Remove now-unused declaration of `i'.
4999
5000 2004-03-24  Paul Eggert  <eggert@twinsun.com>
5001
5002         * src/du.c (main): Filter out file names of length zero before
5003         invoking fts, so that they don't cause fatal errors.
5004
5005 2004-03-25  Jim Meyering  <jim@meyering.net>
5006
5007         * tests/du/files0-from (zero-len): Add a test for the above.
5008
5009 2004-02-25  Paul Eggert  <eggert@twinsun.com>
5010
5011         * NEWS: New environment var BLOCKSIZE.
5012         * lib/human.c (humblock): Support BLOCKSIZE as well as BLOCK_SIZE.
5013         * tests/envvar-check: Test for it.  Factor the code to simplify it.
5014
5015 2004-03-23  Paul Eggert  <eggert@twinsun.com>
5016
5017         * NEWS: Shorten the du --files0-from announcement, and say
5018         "NUL-terminated" rather than "NUL-separated".
5019         * src/du.c (EXPECTED_BYTES_PER_FILE_NAME, DEFAULT_PROJECTED_N_FILES):
5020         Remove: not used.
5021         (usage): Say "NUL-terminated", not "NUL-separated".
5022         (main): Check for I/O error when istream is closed.
5023         Allow --files0-from=F even if F is empty; this specifies no files.
5024         (du_files): Now that we allow the list of files to be empty,
5025         handle that case.
5026         * tests/du/files0-from: Adjust to above changes to src/du.c.
5027
5028 2004-03-24  Jim Meyering  <jim@meyering.net>
5029
5030         * tests/tail-2/assert: Avoid race condition that could cause
5031         spurious failure.  Based on a patch from Andreas Schwab.
5032
5033 2004-03-23  Jim Meyering  <jim@meyering.net>
5034
5035         * src/du.c (main): Free the hash table, too.
5036
5037 2004-03-22  Jim Meyering  <jim@meyering.net>
5038
5039         * man/Makefile.am (.x.1): Remove --info-page= option, reverting
5040         the change of 2004-01-22.  I can no longer reproduce the problem
5041         that prompted that change, and `info coreutils pr' would display the
5042         `printing text' section of the manual, not the one on `pr invocation'.
5043
5044         * tests/du/files0-from (nul-1, nul-2): Adjust expected diagnostics
5045         to match corrected output.
5046
5047         * src/du.c: Include "readtokens0.h" rather than "readtokens.h".
5048         (main): Use readtoken0 functions rather than readtokens.
5049         Don't use errno when diagnosing readtokens0 failure.
5050         Fix off-by-one error in the token number reported in a diagnostic.
5051         (du_files): Return bool, rather than int.
5052         (main): Call readtokens0_free.
5053
5054 2004-03-21  Jim Meyering  <jim@meyering.net>
5055
5056         * src/remove.c (ds_free): Plug a small leak.
5057
5058         * tests/Fetish.pm: Fix typo in comment.
5059
5060 2004-03-07  Jim Meyering  <jim@meyering.net>
5061
5062         * NEWS: du accepts a new option --files0-from=FILE, where FILE
5063         contains a list of NUL-separated file names.
5064
5065         * src/du.c: Include "readtokens.h".
5066         (usage): Describe the new option, and adjust the `Usage':
5067         with this option, no FILE may be specified on the command line.
5068         (main): Handle the new option.
5069
5070         * tests/du/files0-from: New tests, for the above.
5071         * tests/du/Makefile.am (TESTS): Add files0-from.
5072
5073         * src/factor.c (do_stdin): Reflect changes in use of readtoken.
5074         * src/tsort.c (tsort): Likewise.
5075
5076 2004-02-29  Paul Eggert  <eggert@twinsun.com>
5077
5078         * NEWS: Add support for a new notation @N to get_date to represent
5079         the time stamp with numeric value N.  Improve support for
5080         fractional time stamps.  date's -d and -f options now accept them.
5081         Likewise for touch -t.  date has a new option --iso-8601=ns.
5082
5083         * doc/coreutils.texi (touch invocation):
5084         Describe use of fractional seconds.
5085         (date invocation, Options for date): Likewise.
5086         * doc/getdate.texi (General date syntax, Time of day items): Likewise.
5087         * doc/coreutils.texi (date invocation): Mention effect of LC_TIME.
5088         (Options for date): Describe new --iso-8601=ns option.
5089
5090         * doc/getdate.texi: Add copyright notice.  Change getdate to
5091         get_date when talking about the function name.
5092         (Seconds since the Epoch): New section, containing the time_t
5093         info moved from Date input formats section, along with new
5094         info about the @ syntax.  Mention negative time stamps,
5095         fractional time stamps, and leap seconds.
5096         (General date syntax): Modernize examples a bit to reflect new
5097         features.
5098         (General date syntax, Relative items in date strings):
5099         Use ' rather than " to quote formats.
5100         (Time of day items): Add an example with fractional seconds.
5101         Describe fractional-second syntax.
5102
5103         * src/Makefile.am (touch_LDADD): New macro, since `touch' now
5104         needs clock_gettime.
5105
5106         * src/date.c (enum Time_spec): New enum TIME_SPEC_NS.
5107         (time_spec_string, time_spec, show_date): Support it.
5108         (usage): Remove description of -ITIMESPEC, as it's obsolete and
5109         confusing.  Mention --iso-8601=ns.
5110         (batch_convert): getline returns ssize_t, not int.
5111
5112         * src/touch.c (newtime): Now an array of two timespecs, one
5113         for access and one for modification.
5114         (ref_stats): Remove.
5115         (get_reldate): Use get_date's parameter profile.
5116         (touch, main): Adjust to above changes.
5117         (main): Work even if tm_year == INT_MAX (so long as long int is wider).
5118         Use gettime instead of gettimeofday, for new get_date signature.
5119
5120         * tests/date/Test.pm (test_vector): New tests epoch, ns-10, ns-max32,
5121         ns-relative.
5122
5123 2004-03-15  Jim Meyering  <jim@meyering.net>
5124
5125         * Makefile.maint (alpha beta major): `Make' the emit_upload_commands
5126         target before updating $(prev_version_file).
5127
5128         * tests/misc/date-sec: New file, to test for just-fixed bug in date.
5129         See today's change in lib/getdate.y.
5130         * tests/misc/Makefile.am (TESTS): Add date-sec.
5131
5132 2004-03-14  Jim Meyering  <jim@meyering.net>
5133
5134         * announce-gen (print_changelog_deltas): Use `.sig' suffix for
5135         signature files, not `.asc'.  Reported by angico@yahoo.com.
5136
5137 2004-03-13  Jim Meyering  <jim@meyering.net>
5138
5139         * src/cp.c (do_copy): Tweak wording in a diagnostic.
5140         Suggestion from Karl Berry.
5141         Include "quoatearg.h".
5142         (do_copy): Use quotearg_colon (not quote) for diagnostics
5143         that begin with `"%s:'.
5144
5145         * src/nl.c (usage): Specify that nl uses _basic_ regular expressions.
5146         Suggestion from Dan Jacobson.
5147
5148 2004-03-12  Jim Meyering  <jim@meyering.net>
5149
5150         * Version 5.2.1.
5151
5152         Sometimes, when source and destination partition are different,
5153         mv mistakenly fails to preserve a hard link.  Reported by IIDA Yosiaki.
5154
5155         * src/copy.c: When moving a set of N hard-linked files between
5156         partitions, via two or more command line arguments where the
5157         command line argument containing the Nth link contains no other
5158         link to that same file, mv would mistakenly copy the file, rather
5159         than hard-linking it to the other(s).  That happens because when the
5160         final link is processed, its link count has been reduced to 1 since
5161         the other links have been `copied' to the destination partition
5162         and the source links have been removed.
5163         (copy_internal): When in move mode, use the source dev/inode
5164         pair to look up destination name even when st_nlink == 1.
5165         * src/cp-hash.c (src_to_dest_lookup): New function.
5166         * src/cp-hash.h (src_to_dest_lookup): Add prototype.
5167         * tests/mv/part-hardlink: New file.  Test for the above fix.
5168         * tests/mv/Makefile.am (TESTS): Add part-hardlink.
5169
5170         * announce-gen: Sync with autoconf.
5171
5172         * tests/ls/time-1: Exit 77 (not 1) if we can't set up for the test.
5173         This was triggered on a Linux-2.2.19 system using a file system
5174         NFS-mounted from some sort of Sun.
5175
5176 2004-03-11  Jim Meyering  <jim@meyering.net>
5177
5178         * Use automake-1.8.3.  Regenerate dependent files.
5179
5180 2004-03-10  Jim Meyering  <jim@meyering.net>
5181
5182         * tests/du/deref-args: Also convert sizes in the 70-79 kB range,
5183         so that this test works with SELinux-enabled systems.
5184         Based on a patch from Tim Waugh.
5185
5186         `join -1 x' would give a misleading diagnostic
5187         * src/join.c (string_to_join_field): Report that a non-numeric field
5188         number is invalid, rather than `so large that it is not representable'.
5189         * tests/join/Test.pm (invalid-j): New partial test for the above fix.
5190
5191 2004-03-06  Jim Meyering  <jim@meyering.net>
5192
5193         cp --sparse=always sparse-image-file.img /dev/hda1 could
5194         produce an invalid copy on the destination device.
5195
5196         * src/copy.c (copy_reg): Even with --sparse=always, try to
5197         make `holes' only if the destination is a regular file.
5198         Reported by Szakacsits Szabolcs.
5199
5200 2004-03-03  Paul Eggert  <eggert@twinsun.com>
5201
5202         * src/nohup.c (main): Don't invoke set_cloexec_flag with
5203         a file descriptor of -1.
5204
5205 2004-03-02  Dmitry V. Levin  <ldv@altlinux.org>
5206
5207         * src/nohup.c: Include "cloexec.h".
5208         (main): Set the copy of stderr to close on exec.
5209
5210 2004-03-01  Paul Eggert  <eggert@twinsun.com>
5211
5212         * configure.ac: Include <signal.h> when checking for strsignal,
5213         sys_siglist, and friends.  Problem reported by Tony Leneis in
5214         <http://mail.gnu.org/archive/html/bug-coreutils/2004-02/msg00136.html>.
5215
5216 2004-02-25  Paul Eggert  <eggert@twinsun.com>
5217
5218         * tests/du/deref-args, tests/du/exclude, tests/du/slash:
5219         * tests/du/trailing-slash: Run envvar-check in case BLOCK_SIZE
5220         etc. are set.
5221
5222 2004-02-23  Paul Eggert  <eggert@twinsun.com>
5223
5224         * NEWS: Document how chown's USER.GROUP argument is now parsed.
5225
5226 2004-02-23  Jim Meyering  <jim@meyering.net>
5227
5228         * src/seq.c (usage): Remove stray space after \n in --help output.
5229
5230 2004-02-22  Jim Meyering  <jim@meyering.net>
5231
5232         * src/du.c (usage): Separate -H and --si.  Say that the meaning
5233         of -H will soon change to that of --dereference-args (-D).
5234
5235 2004-02-21  Jim Meyering  <jim@meyering.net>
5236
5237         * src/comm.c (usage): Tell what comm does when there are no options.
5238         Reword in terms of FILE1 and FILE2 rather than `left file' and
5239         `right file'.  Suggestion from Dan Jacobson.
5240
5241 2004-02-15  Paul Eggert  <eggert@twinsun.com>
5242
5243         Fix some POSIX-conformance bugs in expr.
5244
5245         * NEWS: document the following changes to src/expr.c.
5246         * doc/coreutils.texi (expr invocation): Likewise.
5247         Document what forms integers may take, and say "integer"
5248         consistently instead of "number".  Warn about operands
5249         that "expr" can misinterpret, and how to work around the
5250         problem.
5251         * src/expr.c (eval, eval7, eval6, eval5, eval4, eval3, eval2, eval1):
5252         Accept a bool argument specifying whether to evaluate the
5253         expression.  This is to allow short-circuit evaluation.  All
5254         callers changed.
5255         (null): Report that a string is zero even if it has
5256         a form like "-0" or "00".
5257         (eval1, eval): Use short-circuit evaluation for | and &.
5258         (eval): Return 0 if both arguments are null or zero, instead
5259         of returning the first argument.
5260         * tests/expr/basic: Add some tests for the above.
5261
5262 2004-02-17  Jim Meyering  <jim@meyering.net>
5263
5264         * Version 5.2.0.
5265
5266         `make check' from a build inside a chroot environment would fail
5267         * tests/help-version: Specify an argument (`/') for df, in the
5268         unusual event that there is no valid entry in /etc/mtab.
5269         Likewise for id: add the -u option, so we don't get spurious
5270         failures when there are no user or group names.
5271         Patch by Tim Waugh.
5272
5273         * src/sort.c (usage) [-u]: Add punctuation so that the description in
5274         the help2man-generated (line-joined) man page is more readable.
5275         Reported by Tim Waugh.
5276         [-T]: Add a semicolon, for the same reason.
5277
5278 2004-02-15  Jim Meyering  <jim@meyering.net>
5279
5280         * Makefile.am (dist-hook): Qualify target with $(srcdir)/ prefix.
5281
5282 2004-02-11  Jim Meyering  <jim@meyering.net>
5283
5284         * tests/Makefile.am.in ($(srcdir)/Makefile.am): Use more portable
5285         $(srcdir)/../Makefile.am.in, rather than $<.
5286         Suggestion from Michael Elizabeth Chastain.
5287
5288 2004-02-10  Jim Meyering  <jim@meyering.net>
5289
5290         * config/install-sh: Make this script executable.
5291         * Makefile.am (dist-hook): New target, to ensure that config/install-sh
5292         is executable.  Otherwise, on systems that lack a suitable install
5293         binary, `make install' would fail, because of the way this script
5294         is invoked (without `$SHELL ' prefix).
5295         Reported by Bob Proulx.
5296
5297 2004-02-08  Jim Meyering  <jim@meyering.net>
5298
5299         * Version 5.1.3.
5300
5301         * tests/rm/rm5: Avoid triggering a bug in OSF/Tru64's sed
5302         that would cause an unwarranted test failure.
5303         * tests/rm/rm3: Likewise.
5304
5305 2004-02-07  Jim Meyering  <jim@meyering.net>
5306
5307         Remove xstat function pointer member.  The way it was used was not
5308         portable, since some systems (OSF V5.1, Solaris 2.5.1) provide static
5309         inline `stat' and `lstat' functions, thus making the tests of
5310         `xstat == lstat' in copy.c always fail.
5311         * src/copy.h (struct cp_options) [xstat]: Remove member.
5312         (XSTAT): New macro.
5313         * src/copy.c (copy_dir): Set `.dereference' member, not .xstat.
5314         (copy_internal): Use `XSTAT (x, ...)' in place of `*(x->xstat) (...)'.
5315         Use `x->dereference == DEREF_NEVER' in place of `x->xstat == lstat'.
5316         (valid_options): Remove now-obsolete FIXME comments.
5317
5318         * src/cp.c (re_protect): Use `XSTAT (x, ...)' in place of
5319         `*(x->xstat) (...)'.
5320         (do_copy): Declare/use local xstat rather than x->xstat.
5321         (main): Remove code that set x.xstat.
5322         * src/mv.c (cp_option_init): Don't initialize xstat member.
5323         * src/install.c (cp_option_init): Likewise.
5324
5325         * Makefile.cfg (gnu_ftp_host-alpha, etc.): Un-factor .gnu.org suffix,
5326         so that emit_upload_commands can use these variables, too.
5327
5328 2004-02-06  Jim Meyering  <jim@meyering.net>
5329
5330         * tests/rm/deep-1: Remove `du' stack space test.
5331         Apparently, `ulimit -s N' isn't portable enough.
5332         This test will be restored (with a guard against losing ulimit)
5333         in its own file later.
5334
5335         * tests/rm/deep-1 (deep): Remove progress-style diagnostics,
5336         since this test doesn't take long enough to merit them.
5337         Run du on $tmp (the containing dir), not $deep, the full path to leaf.
5338
5339         * Makefile.maint (signatures): Remove definition.
5340         Now, automake's gnupload handles this.
5341         (%.sig: %): Remove now-unused rule.
5342         (rel-files): Use automake's $(DIST_ARCHIVES), rather than
5343         `$(distdir).tar.bz2 $(distdir).tar.gz'.
5344         (emit-upload-commands): Adjust to use gnupload.
5345
5346 2004-02-05  Jim Meyering  <jim@meyering.net>
5347
5348         * src/system.h (ST_TIME_CMP_NS, ST_TIME_CMP): Remove definitions.
5349         (ATIME_CMP, CTIME_CMP, MTIME_CMP, TIMESPEC_NS): Likewise.
5350         Now, those are all defined in timespec.h.
5351         Include timespec.h.
5352
5353         * src/date.c: Don't include timespec.h, now that system.h does it.
5354
5355 2004-02-02  Paul Eggert  <eggert@twinsun.com>
5356
5357         Don't dump core if localtime returns NULL (possible on
5358         hosts with 64-bit time_t and 32-bit int).
5359         * src/date.c: Include "inttostr.h".
5360         (batch_convert, main):
5361         If time conversion fails, exit with nonzero status.
5362         (show_date): Return int to report conversion failure.
5363         Print the time as an int if localtime fails.
5364         * src/uptime.c: Print "??" if the current clock can't
5365         be converted by localtime.  This won't happen until the year
5366         2*31 + 1900, but we don't want to dump core even if the current
5367         clock has the wrong value.
5368
5369         * src/stat.c: Include "inttostr.h".
5370         (human_time): Print the date/time as a number of seconds since the
5371         epoch if it can't be converted by localtime.  This is better than
5372         just saying "invalid", and is consistent with what "ls" does.
5373         Don't dump core if the year has more than 48 digits; this isn't
5374         possible on any contemporary host, but we might as well do it right.
5375
5376 2004-01-31  Paul Eggert  <eggert@twinsun.com>
5377
5378         * src/stat.c (human_time): Accept time rather than
5379         pointer-to-const-time parameter, for clarity.  All callers changed.
5380
5381 2004-02-02  Jim Meyering  <jim@meyering.net>
5382
5383         * src/stat.c (do_stat): Remove extra trailing newline from
5384         default formats.  Reported by Nelson H. F. Beebe.
5385
5386         Print actual fractional seconds in time stamps, not just `.00000000'.
5387         * src/stat.c (human_time): Add and use new parameter, t_ns.
5388         (print_stat): Update callers.
5389         * src/ls.c (TIMESPEC_NS): Remove definition.
5390         * src/system.h (TIMESPEC_NS): Define here, instead, now that stat.c
5391         also uses this macro.
5392         Nelson H. F. Beebe noticed that ls --full-time printed nonzero
5393         fractional seconds for files on an XFS file system, but that stat's
5394         fractional seconds were always zero.
5395
5396 2004-01-28  Paul Eggert  <eggert@twinsun.com>
5397
5398         * src/seq.c (print_numbers): Use 'double' for loop index, not
5399         'int', to avoid problems with integer overflow.  On almost all
5400         machines 'double' works in every case where 'int' works, and
5401         it works on other cases besides.
5402
5403 2004-01-27  Jim Meyering  <jim@meyering.net>
5404
5405         * src/seq.c (usage): Mention that if INCREMENT is omitted,
5406         it defaults to 1, even when FIRST is larger than LAST.
5407         Reword so as not to exclude the possibility that INCREMENT be zero.
5408
5409 2004-01-25  Jim Meyering  <jim@meyering.net>
5410
5411         * Version 5.1.2.
5412
5413         * Makefile.maint (signatures): Comment out definition.
5414
5415 2004-01-23  Jim Meyering  <jim@meyering.net>
5416
5417         * Makefile.maint (header_regexp): Add exitfail.
5418
5419         * man/Makefile.am (EXTRA_DIST): Add help2man.
5420         Reported by Nelson H. F. Beebe.
5421
5422         * man/Makefile.am (.x.1): Prefix help2man invocation with `$(PERL) --'
5423         so it works on systems with Perl installed somewhere other than in
5424         /usr/bin.
5425
5426         * src/paste.c (paste_parallel): Declare local, chr, to be of type
5427         `int', not `char', since it must hold EOF.  This bug would make
5428         paste infloop on some systems.  Test failures reported by
5429         Nelson H. F. Beebe and Christian Krackowizer.
5430
5431 2004-01-22  Jim Meyering  <jim@meyering.net>
5432
5433         * tests/rmdir/fail-perm: New file.  Test for just-fixed rmdir bug.
5434         * tests/rmdir/Makefile.am (TESTS): Add fail-perm.
5435
5436         * man/help2man: Fix it so using --info-page='coreutils PROG' works.
5437         * man/Makefile.am (.x.1): Invoke our own (tweaked) copy of help2man.
5438         Use --info-page='coreutils PROG' option.
5439         Now, readlink.1 refers the user to `info coreutils readlink'
5440         rather than to `info readlink'.  Reported by Matt Swift.
5441
5442 2004-01-21  Paul Eggert  <eggert@twinsun.com>
5443
5444         Exit status cleanup.
5445
5446         * src/basename.c (usage): Use EXIT_SUCCESS, not 0, for clarity.
5447         * src/cat.c, src/chgrp.c, src/chmod.c, src/chown.c, src/chroot.c,
5448         * src/cksum.c, src/comm.c, src/cp.c, src/csplit.c, src/cut.c,
5449         * src/date.c, src/dd.c, src/df.c, src/dircolors.c, src/dirname.c,
5450         * src/du.c, src/echo.c, src/env.c, src/expand.c, src/expr.c,
5451         * src/factor.c, src/fmt.c, src/fold.c, src/head.c, src/hostid.c,
5452         * src/hostname.c, src/id.c, src/install.c, src/join.c, src/kill.c,
5453         * src/link.c, src/ln.c, src/logname.c, src/ls.c, src/md5sum.c,
5454         * src/mkdir.c, src/mkfifo.c, src/mknod.c, src/mv.c, src/nice.c,
5455         * src/nl.c, src/nohup.c, src/od.c, src/paste.c, src/pathchk.c,
5456         * src/pinky.c, src/pr.c, src/printenv.c, src/printf.c, src/pwd.c,
5457         * src/rm.c, src/rmdir.c, src/seq.c, src/setuidgid.c, src/shred.c,
5458         * src/sleep.c, src/sort.c, src/split.c, src/stat.c, src/stty.c,
5459         * src/su.c, src/sum.c, src/sync.c, src/tac.c, src/tail.c, src/tee.c,
5460         * src/test.c, src/touch.c, src/tr.c, src/tsort.c, src/tty.c,
5461         * src/uname.c, src/unexpand.c, src/uniq.c, src/unlink.c, src/uptime.c,
5462         * src/users.c, src/wc.c, src/who.c, src/whoami.c, src/yes.c: Likewise.
5463
5464         * src/cat.c (usage): Don't bother normalizing exit status
5465         since the arg is already the correct exit status now.
5466         * src/cksum.c, src/comm.c, src/csplit.c, src/cut.c,
5467         * src/dircolors.c, src/expand.c, src/fmt.c, src/fold.c, src/head.c,
5468         * src/join.c, src/md5sum.c, src/nl.c, src/od.c, src/paste.c,
5469         * src/pr.c, src/split.c, src/sum.c, src/tac.c, src/tail.c, src/tr.c,
5470         * src/tsort.c, unexpand.c, src/src/uniq.c, src/src/wc.c: Likewise.
5471
5472         * src/chown.c (main): Removed unused local 'fail'.
5473
5474         * src/chroot.c (CHROOT_FOUND_BUT_CANNOT_INVOKE, CHROOT_FAILURE):
5475         Remove.
5476
5477         * src/chroot.c (main): Initialize exit_failure to EXIT_FAIL.
5478         * src/env.c, src/nice.c, src/su.c: Likewise.
5479         * src/nohup.c (main): Likewise, to NOHUP_FAILURE.
5480         * src/setuidgid.c (main): Likewise, to SETUIDGID_FAILURE.
5481         * src/expr.c (main): Use initialize_exit_failure rather than
5482         setting exit_failure directly; this optimizes away redundant
5483         assignments.
5484         * src/printenv.c, src/sort.c, src/test.c, src/tty.c: Likewise.
5485
5486         * src/chroot.c (main): Exit with status 1 rather than 127
5487         if chroot itself fails, as per documentation.
5488
5489         * src/chroot.c (main): Use EXIT_ENOENT and EXIT_CANNOT_INVOKE
5490         rather than roll-your-own symbols or integers.
5491         * src/env.c (main): Likewise.
5492         * src/nohup.c (main): Likewise.
5493         * src/su.c (run_shell): Likewise.
5494
5495         * src/cp.c (exit_status): Remove static var....
5496         (main): Making it local here instead.  Use =, not |=, to set it.
5497
5498         * src/cut.c (FATAL_ERROR, main): Exit with status EXIT_FAILURE,
5499         not 2, on errors.
5500         * src/date.c (batch_convert, main): Likewise.
5501         * src/dd.c (dd_copy): Likewise.
5502         * src/pr.c (first_last_page, main, getoptarg): Likewise.
5503         * src/tr.c (main): Likewise.
5504         * src/date.c (main): Don't assume EXIT_FAILURE == 1, as
5505         POSIX doesn't require it.
5506         * src/dd.c (write_output, skip, dd_copy): Likewise.
5507         * src/df.c (main): Likewise.
5508         * src/id.c (main): Likewise.
5509         * src/install.c (main): Likewise.
5510         * src/ln.c (main): Likewise.
5511         * src/ls.c (main): Likewise.
5512         * src/mv.c (main): Likewise.
5513         * src/shred.c (main): Likewise.
5514
5515         * src/env.c (main): Exit with status 1, not 2, on errors detected
5516         by env proper.
5517         * src/hostname.c (main): Likewise.
5518         * src/nl.c (main): Likewise.
5519         * src/stty.c (main): Likewise.
5520
5521         * src/expr.c (EXPR_FAILURE): Renamed from EXPR_ERROR, for
5522         consistency with the other programs' naming conventions.
5523         All uses changed.
5524
5525         * src/factor.c (main): Do not report a usage error simply
5526         because stdin has bad numbers.
5527
5528         * src/id.c (problems): Now a boolean int, not a counter,
5529         so that we don't have to worry about int overflow.  All uses changed.
5530         * src/touch.c (err): Likewise.
5531
5532         * src/md5sum.c (main): Use int, not size_t, to store boolean int.
5533
5534         * src/mkfifo.c (main): Exit with status 1, not 4, if not implemented.
5535         * src/mknod.c: Likewise.
5536
5537         * src/nice.c (main): Exit with status EXIT_FAIL, not EXIT_FAILURE,
5538         on error; this is in case EXIT_FAILURE is unusual.
5539         * src/su.c (main): Likewise.
5540
5541         * src/nohup.c (NOHUP_FOUND_BUT_CANNOT_INVOKE): Remove; all uses
5542         changed to EXIT_CANNOT_INVOKE.
5543
5544         * src/printenv.c (PRINTENV_FAILURE): New constant.
5545         (main): Exit with status PRINTENV_FAILURE, not EXIT_FAILURE, on
5546         command-line syntax problems.
5547
5548         * src/rmdir.c (remove_parents): Don't set 'fail' to a negative number.
5549         (main): Avoid integer overflow when seeing whether errors occurred.
5550
5551         * src/seq.c (print_numbers): Now returns void, not (zero) int.
5552         All callers changed.
5553         (main): Remove unused local variable 'errs'.  Always exit successfully
5554         if we reach the end.
5555
5556         * src/setuidgid.c (SETUIDGID_FAILURE): Renamed from FAIL_STATUS,
5557         for consistency with other programs here.  All uses changed.
5558         (main): Use 'error' to exit rather than invoking 'exit' here.
5559
5560         * src/sort.c: Don't include <assert.h>.
5561         (SORT_OUT_OF_ORDER,  SORT_FAILURE): Now enums, not macros.
5562         (usage): Don't use 'assert'.
5563         (main): Remove redundant assignment to exit_failure.
5564
5565         * src/system.h (EXIT_FAIL, EXIT_CANNOT_INVOKE, EXIT_ENOENT):
5566         New enum values.
5567         (initialize_exit_failure): New inline function.
5568         Include exitfail.h here, since we refer to exit_failure.
5569         All callers changed to not include exitfail.h.
5570
5571         * src/tty.c (TTY_FAILURE, TTY_WRITE_ERROR): New enum values;
5572         substitute them for the corresponding integer constants.
5573
5574         * tests/help-version (expected_failure_status_date): Remove, as
5575         'date' is now normal.
5576         (expected_failure_status_nohup): New var.
5577
5578 2004-01-21  Jim Meyering  <jim@meyering.net>
5579
5580         * tests/touch/relative: Remove `command' syntax.
5581         Thanks to Nelson H. F. Beebe and Paul Eggert.
5582
5583         * tests/touch/relative: Test only year/month/day, not hours/min/sec,
5584         so as to avoid problems with systems using TAI clocks.
5585         Although it's no longer necessary, set TZ=UTC0 also for the
5586         initial touch command.  Reported by Paul Jarc here:
5587         http://article.gmane.org/gmane.comp.gnu.core-utils.bugs/1504
5588
5589 2004-01-20  Diego Biurrun  <diego@biurrun.de>
5590
5591         * src/dircolors.hin: Add .mov to the list of media files.
5592
5593 2004-01-19  Paul Eggert  <eggert@twinsun.com>
5594
5595         * tests/touch/relative: Use TZ=UTC0, not TZ=utc (which isn't
5596         portable).  Problem reported by Christian Krackowizer.  Also, use
5597         +0000 rather than +0 to specify a time zone, as the documentation
5598         requires four digits.
5599
5600 2004-01-19  Jim Meyering  <jim@meyering.net>
5601
5602         * tests/mv/hard-4: Run envvar-check in case SIMPLE_BACKUP_SUFFIX is set.
5603         * tests/mv/backup-is-src: Likewise.
5604         Problem reported by Peter Horst
5605
5606 2004-01-17  Jim Meyering  <jim@meyering.net>
5607
5608         * announce-gen (print_changelog_deltas): Use .sig suffix, not .asc.
5609
5610         * Version 5.1.1.
5611
5612 2003-12-15  Paul Eggert  <eggert@twinsun.com>
5613
5614         * NEWS, doc/coreutils.texi: touch -r and -d can now both be specified,
5615         with -r specifying the origin for -d.
5616         * src/touch.c (flexible_date): Remove static var.
5617         (get_reldate): New function.
5618         (main): Use it, to implement this new behavior.
5619
5620 2004-01-16  Jim Meyering  <jim@meyering.net>
5621
5622         * tests/touch/relative: New test for the above.
5623         * tests/touch/Makefile.am (TESTS): Add relative.
5624
5625 2004-01-13  Jim Meyering  <jim@meyering.net>
5626
5627         * src/system.h: Include contents of sys2.h.
5628         * src/sys2.h: Remove file.
5629         * src/Makefile.am (noinst_HEADERS): Remove sys2.h.
5630
5631         * Use automake-1.8.2.  Regenerate dependent files.
5632
5633         * Update to gettext-0.13.1.
5634         * configure.ac: Use gettext-0.13.1.
5635         * .x-sc_space_tab: Add m4/po.m4 to the list of exceptions.
5636
5637 2004-01-12  Jim Meyering  <jim@meyering.net>
5638
5639         * Makefile.maint (%.sig): Use .sig suffix rather than .asc.
5640
5641         * Makefile.maint (po-check): Ensure that cvsu works before using it.
5642         Reported by Alexandre Duret-Lutz.
5643
5644         * src/tail.c (main): Warn about following stdin only when it's a tty.
5645
5646         * configure.ac: Use gl_DEFAULT_POSIX2_VERSION.
5647
5648 2004-01-10  Jim Meyering  <jim@meyering.net>
5649
5650         * tests/misc/stat-fmt: Use backticks, not `$()' notation.
5651
5652 2004-01-09  Jim Meyering  <jim@meyering.net>
5653
5654         * configure.ac: Quote underquoted `jm_DUMMY_1' to avoid new warning.
5655
5656 2004-01-08  Jim Meyering  <jim@meyering.net>
5657
5658         * src/stat.c (human_fstype): Use %lx, not %x format for `unsigned long'.
5659         From Andreas Schwab.
5660
5661         * tests/Makefile.am (TESTS_ENVIRONMENT): Remove `/vg' (prerelease test
5662         remnant) from PATH component.  That would cause tests in this directory
5663         not to run the just-built binaries, but rather whatever happened
5664         to be in one's PATH.  Reported by Christian Krackowizer.
5665
5666 2004-01-04  Jim Meyering  <jim@meyering.net>
5667
5668         * src/csplit.c (new_control_record): Use x2nrealloc
5669         rather than xrealloc.
5670
5671         * src/cp.c (re_protect): Use ASSIGN_STRDUPA rather than
5672         alloca and strcpy.
5673         (make_path_private): Likewise.
5674
5675 2004-01-03  Jim Meyering  <jim@meyering.net>
5676
5677         * src/paste.c: Use `bool' (not int) as the type for a few
5678         global variables.
5679         (collapse_escapes): Rewrite to set globals rather than modifying
5680         its parameter.
5681         Use size_t (not int) for all counters and related index variables.
5682         (paste_parallel): Remove needless complexity of
5683         using xrealloc in the loop;  just allocate the buffers up front.
5684         Free the two temporary buffers.
5685         Move declarations of locals `down' into scope where used.
5686         (paste_serial): Remove `register' attributes.
5687         (main): Simplify delim-related code.
5688         Free `delims', now that it's malloc'd.
5689
5690 2004-01-02  Jim Meyering  <jim@meyering.net>
5691
5692         * src/chroot.c: Include "quote.h".
5693         (CHROOT_FOUND_BUT_CANNOT_INVOKE, CHROOT_FAILURE): Define.
5694         (main): Exit with status of 127, not 1, for too-few-args,
5695         chroot failure, or chdir failure.
5696         Give a better diagnostic upon execvp failure.
5697
5698         * src/du.c (usage): Mention that, with its current meaning,
5699         -H is deprecated.
5700
5701         * src/tail.c (main): Warn about following stdin when it's a tty.
5702         Fail when following by name but no names are specified.
5703
5704 2003-12-30  Jim Meyering  <jim@meyering.net>
5705
5706         * src/fold.c (main): Use memcpy, not strcpy.
5707
5708         * src/copy.c (copy_internal): Use ASSIGN_STRDUPA rather than
5709         alloca and strcpy.
5710
5711 2003-12-28  Jim Meyering  <jim@meyering.net>
5712
5713         * src/unexpand.c (n_tabs_allocated): New global.
5714         (add_tabstop): Use x2nrealloc rather than xrealloc.
5715         * src/expand.c: Likewise.
5716
5717         * tests/misc/expand: New file.
5718         * tests/misc/Makefile.am (TESTS): Add expand.
5719
5720         * src/sort.c (add_temp_dir): Use x2nrealloc rather than xrealloc.
5721         (fillbuf): Use x2nrealloc rather than xrealloc.
5722         (sort): Use xnmalloc rather than xmalloc.
5723         (main): Likewise.
5724
5725 2003-12-27  Jim Meyering  <jim@meyering.net>
5726
5727         * src/tee.c (tee): Use xnmalloc rather than xmalloc.
5728
5729 2003-12-29  Paul Eggert  <eggert@twinsun.com>
5730
5731         * NEWS: Remove support for join -j1 FIELD, -j2 FIELD, and -o LIST1
5732         LIST2 in POSIX 1003.1-2001 hosts, as required by POSIX.
5733
5734         * doc/coreutils.texi (join invocation): Remove documentation
5735         accordingly.  Document that -t makes all separators significant.
5736
5737         * src/join.c: Include posixver.h.
5738         (obsolete_usage): New var.
5739         (longopts): Put obsolete options first.
5740         (OBSOLETE_LONG_OPTIONS): New constant.
5741         (get_option, add_file_name): New functions.
5742         (main): Use them to support new behavior.
5743         (usage): Remove documentation for -j1 FIELD and -j2 FIELD.
5744         Do not mark -j FIELD as obsolescent; it is longstanding
5745         UNIX tradition and is a valid extension to POSIX.
5746
5747         * tests/join/Test.pm (tv): Avoid obsolete -o usage.
5748
5749 2003-12-28  Paul Eggert  <eggert@twinsun.com>
5750
5751         * src/join.c (add_field_list): Don't use alloca with unbounded
5752         size; just modify the argument, which is no longer const *.
5753
5754         Various other minor cleanups, mostly to avoid the need for casts.
5755
5756         (extract_field): Renamed from ADD_FIELD, as it's now a function.
5757
5758         (struct field.beg): Now char *, not unsigned char const *.  All
5759         uses changed.  It shouldn't be const since xmemcoll writes on its
5760         arguments.
5761         (extract_field): Likewise, for 2nd arg.
5762         (keycmp): Remove now-unnecessary cast of xmemcoll args.
5763
5764         (is_blank): New function, to avoid need to cast arg to unsigned char.
5765         (extract_field): Use it.
5766
5767         (xfields): Rewrite pretty much from scratch.
5768
5769         (hard_LC_COLLATE): Now bool, not int.
5770         (get_line, getseq, add_field_list): Now returns bool, not int.
5771         (decode_field_spec, add_field_list): Return true on success (not
5772         false), for consistency with the rest of the code.  All uses changed.
5773
5774         (tab): Now char, not unsigned char.  This wasn't 100% necessary
5775         but is slightly cleaner.
5776         (prjoin): Hoist (tab ? tab : ' ') expression, to help the compiler.
5777
5778         (empty_filler): Now const *.
5779
5780         (make_blank): Remove; wasn't needed.  Remove all calls.
5781         (main): Don't set uni_blank.nfields; zero is fine.
5782
5783 2003-12-27  Jim Meyering  <jim@meyering.net>
5784
5785         * src/join.c: Include "quote.h".
5786         (min, max): Remove definitions.
5787         Make a few function parameters and corresponding
5788         locals `const'.  Use bool for boolean variables.
5789         Use size_t (not int) for all counters and related index variables.
5790         (prjoin): Remove now-useless assertion.
5791         (string_to_join_field): New function.
5792         (main): Accept join fields as large as SIZE_MAX.
5793         (keycmp): Rename `min' to MIN and max to MAX.
5794
5795 2003-12-26  Jim Meyering  <jim@meyering.net>
5796
5797         fold -s didn't work on e.g., alpha-based systems.
5798         * src/fold.c (fold_file): Adjust types (int->size_t) so that using
5799         x2nrealloc works properly on systems with differing sizes for int
5800         and size_t.  Reported by Nelson Beebe.
5801
5802         * src/fold.c: Use `bool' (not int) as the type for a few
5803         global variables.
5804
5805 2003-12-23  Paul Eggert  <eggert@twinsun.com>
5806
5807         * src/ls.c (length_of_file_names_and_frills):
5808         Remove forward decl; not needed.
5809         (print_file_name_and_frills, length_of_file_name_and_frills):
5810         With -m, don't output spaces before inum or size.
5811         (print_with_commas): Don't output space just before newline.
5812
5813 2003-12-24  Jim Meyering  <jim@meyering.net>
5814
5815         * tests/ls/Makefile.am (TESTS): Add m-option.
5816         * tests/ls/m-option: New file.  Test for above fixes.
5817
5818 2003-12-20  Jim Meyering  <jim@meyering.net>
5819
5820         * Version 5.1.0.
5821
5822         * src/pr.c: Change type of global, buff_allocated, to size_t.
5823
5824         * src/join.c [struct seq]: Change types of members count and alloc
5825         from `int' to `size_t'.
5826
5827         * tests/Makefile.am (root-hint): Tweak wording.
5828
5829         * src/du.c: Accept new option (-0, --null) that makes it so each
5830         output line is NUL-terminated rather than newline-terminated.
5831
5832         * src/dd.c (apply_translations): Don't prohibit conv=unblock,sync.
5833         Reported by Volker Paul.
5834         * tests/dd/Makefile.am (TESTS): Add unblock-sync.
5835         * tests/dd/unblock-sync: New test for the above.
5836
5837 2003-12-19  Jim Meyering  <jim@meyering.net>
5838
5839         * tests/misc/nohup: Double quote back-ticked expression,
5840         in case it ends up having an unexpected value.
5841
5842         * tests/ls/no-arg: Use ls's -1 option in both runs.
5843
5844         * src/du.c (fts_debug): New global.
5845         (FTS_CROSS_CHECK, DEBUG_OPT): Define.
5846         (main): Make fts use FTS_TIGHT_CYCLE_CHECK.
5847         (main) [DU_DEBUG]: Accept -d option.
5848
5849 2003-12-18  Jim Meyering  <jim@meyering.net>
5850
5851         * src/ls.c (format_user): Increment dired_pos via two statements,
5852         `dired_pos += width; dired_pos++;' rather than one,
5853         `dired_pos += width + 1;' since the latter could conceivably overflow.
5854         (format_group): Likewise.
5855         From Paul Eggert.
5856
5857         * configure.ac: Require automake-1.8.
5858
5859 2003-12-12  Jim Meyering  <jim@meyering.net>
5860
5861         * Use automake-1.8.  Regenerate dependent files.
5862
5863 2003-12-08  Jim Meyering  <jim@meyering.net>
5864
5865         * Makefile.maint (news-date-check): New rule.
5866         (alpha beta major): Depend on it.
5867
5868 2003-12-03  Paul Eggert  <eggert@twinsun.com>
5869
5870         * NEWS: ls -l (and similar options) now adjust all columns to
5871         fit the data.  Generalized from a suggestion by Leah Q for file sizes.
5872         * src/ls.c (INODE_DIGITS, LOGIN_NAME_MAX, ID_LENGTH_MAX): Remove.
5873         (format_user_width, format_group_width, unsigned_file_size,
5874         format_group): New functions.
5875         (block_size_width): Renamed from block_size_size.
5876         (inode_number_width, nlink_width, owner_width, group_width,
5877         author_width, major_device_number_width, minor_device_number_width,
5878         file_size_width): New vars.
5879         (clear_files): Initialize them.
5880         (gobble_file): Set them.  Don't ceiling block_size_width to 7.
5881         (print_long_file): Use them.
5882         (gobble_file): Use a new local variable 'f' to make the code
5883         smaller and more consistent with other functions.
5884         (format_user): Output to stdout, not to a buffer, so that we
5885         don't have to worry about buffer overrun.  Update dired_pos.
5886         (print_long_file): Don't put owner, group, author into buffer;
5887         just print them directly.  Don't assume link counts and
5888         major and minor numbers fit into unsigned long int.
5889         * tests/cp/same-file, tests/mv/part-symlink: Don't assume that
5890         'ls' output is fixed-width.
5891
5892 2003-12-02  Jim Meyering  <jim@meyering.net>
5893
5894         * src/md5sum.c: Include sha1.h (reflect renaming: sha.h -> sha1.h.
5895
5896 2003-11-27  Jim Meyering  <jim@meyering.net>
5897
5898         * Use automake-1.7f.  Regenerate dependent files.
5899
5900 2003-11-24  Paul Eggert  <eggert@twinsun.com>
5901
5902         Parse floating-point operands and options in the C locale.
5903         POSIX requires this for printf, and we might as well be
5904         consistent elsewhere (tail, sleep, seq).
5905
5906         * src/printf.c: Remove decls of strtod, strtol, strtoul; no longer
5907         needed now that we assume C89.  Include "c-strtod.h".
5908         (xstrtod): Call c_strtod, not strtod.
5909         * src/sleep.c: Include "c-strtod.h".
5910         (main): Update xstrtod call to include new argument, c_strtod.
5911         * src/seq.c (scan_double_arg): Likewise.
5912         * src/tail.c (parse_options): Likewise.
5913
5914 2003-11-24  Jim Meyering  <jim@meyering.net>
5915
5916         * tests/rm/fail-2eperm: Handle another errno variant (HPUX, EPERM).
5917         Reported by Mark Conty.
5918
5919 2003-11-22  Jim Meyering  <jim@meyering.net>
5920
5921         * Makefile.maint (sc_xalloc_h_in_src): Remove rule.  Subsumed by...
5922         (sc_system_h_headers): Do this test only if sys2.h exists.
5923
5924 2003-11-20  Jim Meyering  <jim@meyering.net>
5925
5926         * tests/help-version: Ensure that the bug-reporting address is
5927         included in the --help output for every program.
5928         * tests/Makefile.am (TESTS_ENVIRONMENT): Add $PACKAGE_BUGREPORT.
5929
5930         * src/ptx.c (usage): Output bug-reporting address.
5931         Reported by Dan Jacobson.
5932
5933 2003-11-19  Jim Meyering  <jim@meyering.net>
5934
5935         * src/join.c (usage): Mention that FILE1 and FILE2 must be sorted
5936         on the join fields.  Suggestion from Bruce Robertson.
5937
5938 2003-11-18  Jim Meyering  <jim@meyering.net>
5939
5940         `od -c -w9999999' could segfault
5941         * src/od.c (dump): Use xnmalloc/free, not alloca.
5942
5943 2003-11-16  Jim Meyering  <jim@meyering.net>
5944
5945         * Use autoconf-2.59.  Regenerate dependent files.
5946
5947         * tests/du/hard-link: Minor tweak: use mkdir -p.
5948
5949         Fix read-from-free'd-buffer error detected by valgrind.
5950         * src/csplit.c (remove_line): Don't return a pointer to data in
5951         a freed buffer.  Instead, arrange to free the buffer on the
5952         subsequent call.
5953
5954         * tests/misc/csplit: New test for above fix.
5955
5956 2003-11-11  Jim Meyering  <jim@meyering.net>
5957
5958         * src/ls.c (extract_dirs_from_files): Avoid useless copy operations.
5959         This avoids a warning from valgrind about memcpy with overlapping
5960         source and destination.
5961
5962         * configure.ac: Require automake-1.7.8.
5963
5964 2003-11-09  Jim Meyering  <jim@meyering.net>
5965
5966         * Use automake-1.7.9.  Regenerate dependent files.
5967
5968         * src/rm.c: Support new options: --preserve-root and --no-preserve-root.
5969         * src/chown.c: Likewise.
5970
5971         * src/chown-core.c: Include "root-dev-ino.h".
5972         (chopt_init): Initialize new member.
5973         (change_file_owner): Support rm's new --preserve-root option.
5974
5975         * src/remove.c: Include "root-dev-ino.h".
5976         (remove_cwd_entries): Remove now-obsolete FIXME comment.
5977         (remove_dir): Support rm's new --preserve-root option.
5978
5979         * src/chown.c: Include "root-dev-ino.h".
5980         Add new options: --preserve-root and --no-preserve-root.
5981
5982         * src/chmod.c: Include "root-dev-ino.h".
5983         (process_file): Use newly-factored-out ROOT_DEV_INO_CHECK and
5984         ROOT_DEV_INO_WARN macros.
5985         (get_root_dev_ino): Remove function definition, now that it's
5986         been moved to a separate file.
5987         (usage): Describe new options.
5988
5989         * src/mv.c (rm_option_init): Initialized new member.
5990
5991         * src/remove.h: Include "dev-ino.h".
5992         (struct rm_options): Add new member: root_dev_ino.
5993         * src/chown-core.h: Include "dev-ino.h".
5994         (struct Chown_option): Add new member: root_dev_ino.
5995
5996 2003-11-06  Jim Meyering  <jim@meyering.net>
5997
5998         * src/paste.c (paste_parallel): Use `sizeof *var' rather than
5999         hard-coding `sizeof FILE*'.
6000
6001 2003-11-05  Dennis Smit  <ds@nerds-incorporated.org>
6002
6003         * src/wc.c (main): Free `fstatus' so there is no confusion about
6004         whether it's leaked or not.
6005         * src/who.c (who): Likewise for `utmp_buf'.
6006
6007 2003-11-05  Paul Eggert  <eggert@twinsun.com>
6008
6009         Fix 'cut' problems with size_t overflow and unsigned int.
6010         More generally, resize integer variables to fit use more precisely.
6011         * src/cut.c (ADD_RANGE_PAIR): Remove unnecessary parens.
6012         (struct range_pair): Make members to be of type size_t, not unsigned.
6013         (max_range_endpoint, eol_range_start): Now size_t, not unsigned.
6014         (suppress_non_delimited, output_delimiter_specified,
6015         have_read_stdin, print_kth, set_fields): Now bool, nt int.
6016         (delim): Now unsigned char, not int.
6017         (mark_printable_field, is_printable_field, is_range_start_index,
6018         set_fields, set_fields, cut_bytes, cut_fields):
6019         Use size_t, not unsigned, for field and byte counts.
6020         (hash_int): Use uintptr_t, not unsigned, for pointers converted
6021         to integers.  This squeezes more info out of them.
6022         (set_fields, cut_bytes, cut_fields, main):
6023         Use bool, not int, for booleans.
6024         (set_fields): Allocate zeroed byte array with xzalloc, not xcalloc.
6025
6026 2003-11-05  Paul Eggert  <eggert@twinsun.com>
6027
6028         * man/Makefile.am (check-programs-vs-x):
6029         Work even if $(programs) contains '$'.
6030         Work even if 'missing=1' in environment.
6031         Don't report an error simply because $(programs) outputs nothing.
6032
6033 2003-11-05  Jim Meyering  <jim@meyering.net>
6034
6035         * Use autoconf-2.58.  Regenerate dependent files.
6036
6037         * src/tr.c (spec_init): Fix typo in last change.
6038
6039         * src/sys2.h (case_GETOPT_VERSION_CHAR): Cast NULL to `(char *)' in
6040         call to variadic version_etc function, so that it works even on systems
6041         for which sizeof char* != sizeof int.
6042         * src/true.c (main): Likewise.
6043         * basename.c, chroot.c, cksum.c, dd.c, dirname.c, echo.c, expr.c:
6044         * factor.c, hostid.c, hostname.c, link.c, logname.c, nice.c, nohup.c:
6045         * pathchk.c, printenv.c, printf.c, pwd.c, setuidgid.c, sleep.c, stty.c:
6046         * sync.c, test.c, tsort.c, unlink.c, uptime.c, users.c, whoami.c, yes.c:
6047         Similarly, cast NULL to `(char *)' in call to variadic function,
6048         parse_long_options, so that it works even on systems for which
6049         sizeof char* != sizeof int.
6050         A similar problem was reported by Harti Brandt in
6051         http://mail.gnu.org/archive/html/bug-gnu-utils/2003-10/msg00320.html.
6052
6053         * src/users.c (users): Free `utmp_buf' explicitly so that people
6054         don't mistake this for a real leak.
6055         Patch by Dennis Smit <ds@nerds-incorporated.org.
6056
6057 2003-11-04  Paul Eggert  <eggert@twinsun.com>
6058
6059         * README: Document _POSIX2_VERSION.
6060
6061 2003-11-04  Jim Meyering  <jim@meyering.net>
6062
6063         * src/tac.c (memrchr): Remove #if-0'd function.
6064         (tac_stdin_to_mem): Clean up #if-0'd code.
6065
6066         * src/od.c (decode_format_string): Remove unnecessary casts.
6067         Use more maintainable `sizeof *var'.
6068         (main): Call decode_format_string rather than decode_one_format,
6069         now that `spec' may be NULL.
6070
6071         * src/chmod.c (AUTHORS): Add my name.
6072
6073         * src/split.c (next_file_name): Use `sizeof *var' rather than
6074         hard-coding `sizeof size_t'.
6075
6076         * src/sort.c (new_key): Use xzalloc, not xcalloc (1, ...).
6077
6078         * src/cut.c (ADD_RANGE_PAIR): Use x2nrealloc rather than xrealloc,
6079         to avoid potential overflow in pointer arithmetic.
6080         (set_fields): Use not `1', but rather `sizeof *printable_field' as
6081         second argument to xcalloc.
6082         * src/od.c (decode_format_string, dump_strings): Use x2nrealloc
6083         rather than xrealloc.
6084         * src/date.c (show_date): Likewise.
6085         * src/join.c (ADD_FIELD, initseq, getseq): Likewise.
6086         * src/pr.c (store_char): Likewise.
6087         * src/fold.c (fold_file): Likewise.
6088
6089         * src/copy.c (triple_hash, triple_hash_no_name): Adjust to reflect
6090         type changes (unsigned int -> size_t) in hash.c.
6091         * src/cp-hash.c (src_to_dest_hash): Likewise.
6092         * src/du.c (entry_hash): Likewise.
6093         * src/ls.c (dev_ino_hash): Likewise.
6094         * src/cut.c (hash_int): Likewise.  Declare function as static.
6095
6096 2003-11-03  Jim Meyering  <jim@meyering.net>
6097
6098         * tests/misc/Makefile.am (TESTS_ENVIRONMENT): Define PACKAGE_VERSION.
6099         * tests/misc/fold: Fail the test immediately if we're not running
6100         the expected version of fold.
6101
6102 2003-11-02  Jim Meyering  <jim@meyering.net>
6103
6104         * src/tr.c (append_normal_char, append_range, append_char_class)
6105         (append_repeated_char, append_equiv_class, spec_init): Use `sizeof *var'
6106         rather than `sizeof EXPLICIT_TYPE'.  The former is more maintainable
6107         and usually shorter.
6108         * src/copy.c (copy_internal): Likewise.
6109         * src/join.c (initseq, add_field, make_blank): Likewise.
6110         * src/od.c (main): Likewise.
6111         * src/cp.c (make_path_private): Likewise.
6112         * src/tsort.c (new_item, record_relation): Likewise.
6113
6114         * src/df.c (add_fs_type, add_excluded_fs_type, main): Likewise.
6115         (main): Also remove anachronistic cast of xmalloc return value.
6116         * src/ptx.c (alloc_and_compile_regex, main): Likewise.
6117         (main): Also remove anachronistic cast of xmalloc return value.
6118         * src/sort.c (inittables): Likewise.
6119         (sort): Also Split a long line.
6120
6121 2003-10-25  Jim Meyering  <jim@meyering.net>
6122
6123         * src/copy.c (triple_hash, triple_hash_no_name): Adjust to reflect
6124         type changes (unsigned int -> size_t) in hash.c.
6125         * src/cp-hash.c (src_to_dest_hash): Likewise.
6126         * src/du.c (entry_hash): Likewise.
6127         * src/ls.c (dev_ino_hash): Likewise.
6128         * src/cut.c (hash_int): Likewise.  Declare function as static.
6129
6130 2003-10-21  Jim Meyering  <jim@meyering.net>
6131
6132         Don't fail when run with VERBOSE=yes.
6133         * tests/chgrp/basic: Do `set +x' before starting the subshell
6134         from which we invoke chgrp.  Otherwise, the output from the
6135         VERBOSE=yes-induced `set -x' would result in spurious differences.
6136         Reported by Russel Coker via Michael Stone.
6137
6138 2003-10-19  Jim Meyering  <jim@meyering.net>
6139
6140         chmod now uses fts to perform a directory traversal when -R is
6141         specified.  Before, it operated on full path names, and as such
6142         would encounter the PATH_MAX (often 4096) limit.
6143
6144         * src/chmod.c: Include "xfts.h".
6145         (process_file): Rename from change_file_mode.
6146         Adapt to be used with fts.
6147         (process_files): New function.
6148
6149 2003-10-18  Jim Meyering  <jim@meyering.net>
6150
6151         * tests/du/deref-args: Ensure that du -D now dereferences all
6152         symlinks specified on the command line, not just those that
6153         reference directories.
6154
6155         * basename.c, cat.c, chroot.c, cksum.c, comm.c, cp.c, csplit.c, cut.c:
6156         * dd.c, df.c, dirname.c, du.c, echo.c, env.c, expr.c, factor.c, head.c:
6157         * hostid.c, hostname.c, id.c, link.c, ln.c, logname.c, ls.c, md5sum.c:
6158         * mv.c, nice.c, nl.c, nohup.c, paste.c, pathchk.c, pinky.c, pr.c:
6159         * printenv.c, printf.c, pwd.c, rm.c, setuidgid.c, sleep.c, sort.c:
6160         * split.c, stty.c, sum.c, sync.c, tac.c, tail.c, tee.c, test.c:
6161         * touch.c, tsort.c, uniq.c, unlink.c, uptime.c, users.c, wc.c:
6162         * who.c, whoami.c, yes.c (AUTHORS): Revert the WRITTEN_BY/AUTHORS change
6163         of 2003-09-19.  Now, AUTHORS is a comma-separated list of strings.
6164         Update the call to parse_long_options so that `AUTHORS, NULL' are the
6165         last parameters.
6166         * src/true.c (main): Append NULL to version_etc argument list.
6167         * src/sys2.h (case_GETOPT_VERSION_CHAR): Likewise.
6168
6169 2003-10-17  Andreas Schwab  <schwab@suse.de>
6170
6171         * tests/mk-script: Get $srcdir from first parameter instead of
6172         hardcoding it.
6173         (main): Update usage.
6174
6175         * tests/Makefile.am.in ($(srcdir)/$x-tests): Pass $(srcdir) as
6176         first argument of mk-script.
6177         ($(srcdir)/Makefile.am): Likewise.  Prepend $(srcdir) to target.
6178
6179 2003-10-17  Jim Meyering  <jim@meyering.net>
6180
6181         * src/mv.c (usage): Tweak descriptions of -i and -f so that the
6182         generated `man' page is more readable.  Suggestion from Dan Jacobson.
6183
6184         * src/chown-core.c (change_file_owner): Handle the cases in
6185         which fts_info indicates an error with the given entry.
6186
6187         * src/du.c (main): Simply assign to bit_flags.
6188         Don't bother with bit arithmetic.
6189
6190         * tests/chmod/no-x: New file.
6191         * tests/chgrp/no-x: New file.
6192         * tests/chmod/Makefile.am (TESTS): Add no-x.
6193         * tests/chgrp/Makefile.am (TESTS): Likewise.
6194
6195         * src/du.c: Include "xfts.h".
6196         (du_files): Use xfts_open, rather than fts_open.
6197         * src/chown-core.c (chown_files): Likewise.
6198
6199 2003-10-16  Jim Meyering  <jim@meyering.net>
6200
6201         * src/chgrp.c (main): Simply assign to bit_flags.
6202         Don't bother with bit arithmetic.
6203         * src/chown.c (main): Likewise.
6204         Rename a couple of local variables.
6205         Remove unnecessary casts.
6206
6207         * src/tail.c (start_bytes): Rename local, remainder, to avoid
6208         gcc's warning about shadowing a global.
6209
6210 2003-10-15  Jim Meyering  <jim@meyering.net>
6211
6212         chown and chgrp now accept POSIX-mandated -H, -L, -P options and
6213         use fts to perform a directory traversal when -R is specified.
6214         Before, they operated on full path names, and as such would
6215         encounter the PATH_MAX (often 4096) limit.
6216         They are more efficient.  For example, before, chgrp -R would
6217         take almost 5 seconds to change about 2000 directories and fail
6218         (with `File name too long'), while now it succeeds on a hierarchy
6219         of depth 20,000 in 1/10 the time.
6220
6221         * src/chown.c: Include "userspec.h" and "fts_.h".
6222         (WRITTEN_BY): Add my name.
6223         (getpwnam, getgrnam, getgrgid): Remove declarations.
6224         (endpwent): Remove definition.
6225         (usage): Update.
6226         (main): Handle new options.
6227         Call new function, chown_files rather than change_file_owner.
6228
6229         * src/chgrp.c: Include "fts_.h".
6230         (WRITTEN_BY): Add my name.
6231         (MAXUID, MAXGID): Remove definitions.  Use GID_T_MAX instead of
6232         the latter.
6233         (usage): Update.
6234         (main): Handle new options.
6235         Call new function, chown_files rather than change_file_owner.
6236
6237         Rewrite to iterate through hierarchies using fts rather than
6238         via explicit recursion.
6239         * src/chown-core.c: Include "fts_.h"
6240         (change_file_owner): Rewrite to use FTS* and FTSENT* and to operate
6241         on a single file at a time.
6242         (chown_files): New function.
6243         * src/chown-core.h [enum Dereference_symlink]: Remove declaration.
6244         [struct Chown_option] (recurse, force_silent): Change type to `bool'.
6245         [struct Chown_option] (dereference): Remove member with ambiguous name.
6246         [struct Chown_option] (affect_symlink_referent): New member.
6247         (chown_files): New prototype.
6248
6249         * tests/chgrp/recurse: Update tests accordingly.
6250         * tests/chgrp/posix-H: New tests for the above.
6251         * tests/chgrp/Makefile.am (TESTS): Add posix-H.
6252
6253         * src/ln.c (usage): Clarify that --directory, -d, -F probably won't
6254         work even for superuser.  Suggestion from Dan Jacobson.
6255
6256 2003-10-14  Paul Eggert  <eggert@twinsun.com>
6257
6258         Fix some number-parsing bugs, e.g., "head -n 100k@" wasn't
6259         properly diagnosed.
6260         * lib/human.c, lib/xstrtoimax.c, lib/xstrtol.c, lib/xstrtol.h,
6261         lib/xstrtoul.c, lib/xstrtoumax.c: Sync with gnulib.
6262         * src/sort.c (parse_field_count): Handle the case where overflow
6263         and invalid suffix char are both reported.
6264
6265 2003-10-14  Jim Meyering  <jim@meyering.net>
6266
6267         * src/ls.c (decode_switches) [TIOCGWINSZ]: Comment out the
6268         warning-inducing test, ws.ws_col <= SIZE_MAX, since it was always
6269         true on Linux.
6270
6271 2003-10-13  Paul Eggert  <eggert@twinsun.com>
6272
6273         Fix to avoid a denial-of-service attack if the display width is
6274         enormous.  Also, clean up the code a bit by removing duplicate code.
6275
6276         * src/ls.c (init_column_info): Remove forward decl; no longer needed.
6277         (calculate_columns): New function, that contains code that used
6278         to be common to print_many_per_line and print_horizontal.
6279         (print_many_per_line, print_horizontal): Use it.
6280         (decode_switches): Set max_idx here, not in calculate_columns.
6281         (print_current_files): Don't call init_column_info; calculate_columns
6282         now does that.
6283         (init_column_info): Don't allocate a lot more space than is needed
6284         to represent the current set of files.  Allocate all the new
6285         size_t cells in one call to xnmalloc, rather than a row at a time.
6286
6287 2003-10-13  Jim Meyering  <jim@meyering.net>
6288
6289         * src/ls.c (init_column_info): Add another FIXME comment.
6290
6291 2003-10-13  Paul Eggert  <eggert@twinsun.com>
6292
6293         Fix address-arithmetic bug in 'ls', reported by Georgi Guninski.
6294         Remove several arbitrary limits on hosts where int cannot represent
6295         all size_t values.
6296
6297         * src/ls.c (struct bin_str.len, length_of_file_name_and_frills, indent,
6298         nfiles, files_index, tabsize, line_length, struct column_info.line_len,
6299         struct column_info.col_arr[0], max_idx):
6300         Now size_t, not int.
6301         (get_funky_string): Return bool indicating success, instead of
6302         a negative count to indicate failure.  Store number of columns
6303         through new parameter OUTPUT_COUNT; that way, they can never
6304         go negative.  Change equals_end from int to bool.  All uses
6305         changed.
6306         (struct column_info.valid_len): Now bool, not int.  All uses changed.
6307         (dired_dump_obstack, get_funky_string, clear_files,
6308         extract_dirs_from_files, print_current_files,
6309         print_many_per_line, print_horizontal, init_column_info,
6310         put_indicator, length_of_file_name_and_frills,
6311         print_with_commas): Use size_t, not int, for local variables
6312         that count sizes.
6313         (decode_switches): Decode sizes using xstrtoul, not xstrtol.
6314         Check for TIOCGWINSZ returing negative values (or values greater
6315         than SIZE_MAX!).
6316         (visit_dir, main, parse_ls_color, queue_directory, add_ignore_pattern,
6317         init_column_info):
6318         Use xmalloc and xnmalloc, not XMALLOC.
6319         (gobble_file): Use xnrealloc, not XREALLOC.
6320         (print_color_indicator): Remove now-unnecessary cast to size_t.
6321
6322 2003-10-12  Paul Eggert  <eggert@twinsun.com>
6323
6324         * tests/du/no-x: Change wording of diagnostic to match latest du.c.
6325         * tests/sort/sort-tests: Remove from CVS; assume that people
6326         brave enough to check coreutils out from CVS can rebuild it.
6327
6328 2003-10-12  Jim Meyering  <jim@meyering.net>
6329
6330         New options: --preserve-root and --no-preserve-root.
6331         * src/chmod.c (change_file_mode): Honor new option.
6332         (change_file_mode): Strip trailing slashes on directory
6333         argument passed to change_dir_mode.
6334         (get_root_dev_ino): New function.
6335         (main): Initialize global, root_dev_ino.
6336
6337         * src/copy.c (copy_internal): Don't #ifdef-out simple uses of
6338         S_ISLNK or S_ISSOCK.  The S_IS* macros are guaranteed to be defined
6339         via system.h.
6340         * src/chmod.c (change_file_mode): Likewise.
6341
6342 2003-10-08  Jim Meyering  <jim@meyering.net>
6343
6344         * src/csplit.c (main): Remove obsolete FIXME.
6345
6346 2003-10-07  Jim Meyering  <jim@meyering.net>
6347
6348         * Use automake-1.7.8.  Regenerate dependent files.
6349
6350 2003-09-29  Paul Eggert  <eggert@twinsun.com>
6351
6352         csplit cleanup.
6353
6354         * doc/coreutils.texi (csplit invocation):
6355         The regexp offset need not have a sign; POSIX requires support
6356         for signless offets.
6357
6358         Be more careful about int widths.  For example, remove some
6359         arbitrary limits by replacing 'unsigned' with 'size_t',
6360         'uintmax_t', etc.  Use standard bool rather than a homegrown type.
6361         * lib/Makefile.am (libfetish_a_SOURCES): Add xstrtoimax.c.
6362         * src/csplit.c (FALSE, TRUE, boolean): Remove.  All uses changed
6363         to <stdbool.h> usage.
6364         (struct control): offset is now intmax_t, not int.
6365         repeat_forever is now bool, not int.
6366         (struct cstring): len is now size_t, not unsigned int.
6367         (struct buffer_record): bytes_alloc, bytes_used, num_lines are now
6368         size_t, not unsigned.  start_line, first_available are now
6369         uintmax_t, not unsigned.
6370         (hold_count, control_used): Now size_t, not unsigned.
6371         (last_line_number, current_line, bytes_written):
6372         Now uintmax_t, not unsigned.
6373         (save_to_hold_area, red_input, keep_new_line, record_line_starts,
6374         create_new_buffer, get_new_buffer, load_buffer, find_line,
6375         process_regexp, split_file, new_control_record, extract_regexp,
6376         get_format_width, get_format_prec, max_out):
6377         size args, locals, and returned values are now size_t, not unsigned
6378         or int.
6379         (get_first_line_in_buffer, find_line, write_to_file,
6380         handle_line_error, process_line_count, regexp_error, process_regexp,
6381         split_file):
6382         File line, byte, and repetition counts are now uintmax_t, not unsigned.
6383         (check_for_offset): Don't require a sign before the offset.
6384         Use xstrtoimax to do the real work.
6385         (extract_regexp): Remove harmful cast of size to unsigned.
6386         256 -> 1<<CHAR_BIT, for clarity.
6387         (get_format_flags): Return at most 3, to avoid worries about overflow.
6388
6389         (bytes_to_octal_digits): Remove.
6390
6391         (cleanup): Don't check whether output_stream is NULL, since
6392         close_output_file does that for us.
6393
6394         (new_line_control, create_new_buffer): Use "foo *p = xmalloc
6395         (sizeof *p);" instead of the more long-winded alternatives.
6396
6397         (get_new_buffer): Use O(1) algorithm for resizing a buffer
6398         to a much larger size, instead of an O(N) algorithm.
6399
6400         (process_regexp): Use plain NULL rather than casted 0.
6401
6402         (make_filename): Use %u, not %d, to format unsigned file number.
6403
6404         (new_control_record): Use xrealloc exclusively, since it handles
6405         NULL reliably.
6406
6407         (extract_regexp): Change misspelled word in diagnostic.
6408
6409         (get_format_width): Even if a minimum field width is specified,
6410         allow room for enough octal digits to represent the value of
6411         the maximum representible integer.  This fixes a potential
6412         buffer overrun.  Calculate this room at compile-time, not
6413         at run-time; this removes the need for bytes_to_octal_digits.
6414         Check for overflow; this removes a FIXME.
6415
6416         (get_format_prec): Don't allow precision to be signed; it's
6417         not ANSI.  Check for overflow.  Remove hardcoded "11" as
6418         default precision; this fixes a potential buffer overrun
6419         on hosts with wider size_t.
6420
6421         (get_format_conv_type): Change local variable to be of type
6422         unsigned char, not int; this removes a potential subscript
6423         violation on hosts where char is signed.
6424
6425         (max_out): Replace "for (;*p;)" with more-standard "while (*p)".
6426         Allow "%%" in format.  Don't overflow when
6427         counting lots of percents.
6428
6429         (usage): Default sprintf format is %02u, not %d.
6430
6431 2003-10-05  Jim Meyering  <jim@meyering.net>
6432
6433         * src/chown-core.c (change_file_owner): Remove set-but-not-used local.
6434
6435         * src/du.c (du_files): Mark diagnostic for translation.
6436
6437 2003-10-04  Jim Meyering  <jim@meyering.net>
6438
6439         * src/du.c (du_files): Ignore any failure of fts_close.
6440         Give better diagnostics for failed fts_open.
6441
6442         * src/du.c (MAX_N_DESCRIPTORS): Remove now-unused definition.
6443
6444         Deprecate existing use of -H (aka --si).
6445         * src/du.c (enum) [HUMAN_SI_OPTION]: New member.
6446         [long_options]: Use HUMAN_SI_OPTION, not 'H'.
6447         (main): Warn that the meaning of -H will soon change to be
6448         POSIX compliant.
6449
6450 2003-10-03  Jim Meyering  <jim@meyering.net>
6451
6452         * src/du.c: Accept --no-dereference (-P).
6453
6454 2003-10-02  Jim Meyering  <jim@meyering.net>
6455
6456         * tests/du/trailing-slash: Adjust for slightly different output.
6457
6458         Rewrite du.c to use fts.
6459         * src/du.c: Include "fts_.h", not ftw.h.
6460         (opt_dereference_arguments, arg_length, suffix_length): Remove globals.
6461         (IS_FTW_DIR_TYPE): Remove definition.
6462         (IS_DIR_TYPE): Define.
6463         (is_symlink_to_dir): Remove now-unnecessary function.
6464         (process_file, du_files): Rewrite to use fts.
6465
6466         * tests/du/inaccessible-cwd: Ensure that even when run from an
6467         inaccessible directory, du can still operate on accessible
6468         directories elsewhere.
6469         * tests/du/Makefile.am (TESTS): Add inaccessible-cwd.
6470
6471         * tests/rm/deep-1: Ensure that du can process a hierarchy
6472         of depth 400 while using no more than 50KB of stack space.
6473
6474 2003-10-01  Akim Demaille  <akim@epita.fr>
6475
6476         * announce-gen (print_news_deltas): New function, extracted from main.
6477         (main): Make `news_file' an array.
6478         Use '...=s' => \@var for --news and --url-directory specs.
6479         Before there were a couple of portability problems.
6480
6481 2003-09-28  Jim Meyering  <jim@meyering.net>
6482
6483         * Makefile.maint (sc_cast_of_alloca_return_value): New rule.
6484         (syntax-check-rules): Add it.
6485
6486         * src/copy.c: Remove unnecessary cast of alloca, since now it's
6487         guaranteed to be (void *).
6488         * src/cp.c: Likewise.
6489         * src/join.c: Likewise.
6490         * src/ln.c: Likewise.
6491         * src/ls.c: Likewise.
6492         * src/od.c: Likewise.
6493         * src/sys2.h (ASSIGN_STRDUPA): Likewise.
6494
6495 2003-09-27  Jim Meyering  <jim@meyering.net>
6496
6497         Don't exhaust virtual memory when processing large inputs.
6498         Fix this by removing csplit's internal free-list management;
6499         instead rely on malloc for that.
6500
6501         * src/csplit.c (free_list): Remove global.
6502         (clear_all_line_control): Remove function.
6503         (get_new_buffer): Always use create_new_buffer to obtain a
6504         new buffer, rather than searching free_list.
6505         (free_buffer): Just call free.
6506         Reported by Nikola Milutinovic.
6507
6508 2003-09-26  Jim Meyering  <jim@meyering.net>
6509
6510         * man/rm.x: Also list `chattr' in SEE ALSO section.
6511         Suggestion from Mark Hubbart.
6512
6513 2003-09-25  Jim Meyering  <jim@meyering.net>
6514
6515         * configure.ac: Don't invoke AC_AIX or AC_MINIX explicitly, now
6516         that we use gl_USE_SYSTEM_EXTENSIONS, since it AC_REQUIREs them.
6517
6518         * Use autoconf-2.57d.  Regenerate dependent files.
6519
6520 2003-09-24  Jim Meyering  <jim@meyering.net>
6521
6522         Minor efficiency tweak.
6523         * src/ln.c (PATH_BASENAME_CONCAT): Use memcpy rather than strcpy.
6524         (do_link): Likewise.
6525
6526 2003-09-23  Jim Meyering  <jim@meyering.net>
6527
6528         * src/paste.c (paste_serial): Save errno after input error,
6529         to report proper errno value.
6530         Based on a patch from Paul Eggert.
6531
6532         * src/tee.c (tee): Adjust fwrite arguments so that the return
6533         value is the number of bytes written.
6534
6535 2003-09-16  Paul Eggert  <eggert@twinsun.com>
6536
6537         Don't assume ferror sets errno.  Bug reported by Bruno Haible.
6538
6539         * src/comm.c (compare_files): Save errno after input error,
6540         to report proper errno value.
6541         * src/fold.c (fold_file): Likewise.
6542         * src/od.c (check_and_close, skip, read_char, read_block): Likewise.
6543         * src/unexpand.c (unexpand): Likewise.
6544
6545         * src/csplit.c (close_output_file): Don't report bogus errno value
6546         after ferror discovers an output error.  We don't know the proper
6547         errno value, since it might have been caused by any of a whole
6548         bunch of calls, and it might have been trashed in the meantime.
6549         Fixing this problem will require much more extensive changes;
6550         in the meantime just say "write error".
6551         * src/od.c (check_and_close, dump, dump_strings): Likewise.
6552         * src/uniq.c (check_file): Likewise.
6553
6554         * src/join.c (get_line): Report error right away if I/O fails,
6555         so that the proper errno value is used.
6556         * src/tac.c (tac_seekable, tac_file, save_stdin): Likewise.
6557         * src/tee.c (tee): Likewise.
6558         * src/uniq.c (check_file): Likewise.
6559
6560         * src/od.c (skip): If a read fails, don't retry it later, so
6561         that we report the proper errno.
6562
6563         * src/tac.c (tac_mem): Don't return a value; nobody uses it.
6564
6565         * src/tee.c (tee): Once a write failure has occurred, don't bother
6566         writing anything more to that stream.
6567
6568         * src/uniq.c (check_file): Check for ferror (stdout) even if
6569         ostream == stdout.
6570
6571         * src/yes.c (UNROLL): Remove.
6572         (main): Exit immediately when write failure is detected.
6573         Simplify code by assigning to argv when argc == 1.
6574
6575 2003-09-21  Paul Eggert  <eggert@twinsun.com>
6576
6577         * src/ptx.c: Switch encoding from Latin-1 to UTF-8.
6578         (WRITTEN_BY): Change "Franc,ois" (actually using
6579         c-with-cedilla in Latin-1) to "F.", so that it's ASCII, as
6580         xgettext requires.
6581
6582 2003-09-19  Jim Meyering  <jim@meyering.net>
6583
6584         `du -D symlink-to-dir' would mistakenly omit the slash in
6585         lines like this: 24     symlink-to-dir/subdir
6586         * src/du.c (process_file): Fix offset calculation.
6587         Reported by Jeff Sheinberg as Debian bug #211591;
6588         http://bugs.debian.org/205251
6589
6590         * tests/du/deref-args: New file/test for the above.
6591         * tests/du/Makefile.am (TESTS): Add deref-args.
6592
6593         * src/du.c (process_file): Remove useless disjunct.
6594
6595         * src/sys2.h (case_GETOPT_VERSION_CHAR): Rename parameter, Authors,
6596         to Written_by.
6597         * nearly all src/*.c files (WRITTEN_BY): Rename from AUTHORS.
6598         Begin each WRITTEN_BY string with `Written by ' and end it with `.'.
6599         Mark each WRITTEN_BY string as translatable.
6600
6601         * basename.c, cat.c, chroot.c, cksum.c, comm.c, cp.c, csplit.c, cut.c:
6602         * dd.c, df.c, dirname.c, du.c, echo.c, env.c, expr.c, factor.c, head.c:
6603         * hostid.c, hostname.c, id.c, link.c, ln.c, logname.c, ls.c, md5sum.c:
6604         * mv.c, nice.c, nl.c, nohup.c, paste.c, pathchk.c, pinky.c, pr.c:
6605         * printenv.c, printf.c, pwd.c, rm.c, setuidgid.c, sleep.c, sort.c:
6606         * split.c, stty.c, sum.c, sync.c, tac.c, tail.c, tee.c, test.c:
6607         * touch.c, tsort.c, uniq.c, unlink.c, uptime.c, users.c, wc.c:
6608         * who.c, whoami.c, yes.c: Revert yesterday's changes.
6609         Instead, a subsequent change will embed `Written by ' in
6610         each string along with the author names.
6611
6612         * src/true.c: Revert yesterday's changes.
6613         * src/sys2.h: Likewise.
6614
6615 2003-09-18  Jim Meyering  <jim@meyering.net>
6616
6617         * basename.c, cat.c, chroot.c, cksum.c, comm.c, cp.c, csplit.c, cut.c:
6618         * dd.c, df.c, dirname.c, du.c, echo.c, env.c, expr.c, factor.c, head.c:
6619         * hostid.c, hostname.c, id.c, link.c, ln.c, logname.c, ls.c, md5sum.c:
6620         * mv.c, nice.c, nl.c, nohup.c, paste.c, pathchk.c, pinky.c, pr.c:
6621         * printenv.c, printf.c, pwd.c, rm.c, setuidgid.c, sleep.c, sort.c:
6622         * split.c, stty.c, sum.c, sync.c, tac.c, tail.c, tee.c, test.c:
6623         * touch.c, tsort.c, uniq.c, unlink.c, uptime.c, users.c, wc.c:
6624         * who.c, whoami.c, yes.c: Update AUTHORS definition to be a
6625         comma-separated list of strings and/or update the call to
6626         parse_long_options so that `AUTHORS, NULL' are the last parameters.
6627         * src/true.c (main): Append NULL to version_etc argument list.
6628         * src/sys2.h (case_GETOPT_VERSION_CHAR): Likewise.
6629
6630         * src/sort.c (numcompare): Rename local, logb, to log_b to avoid
6631         shadowing the math function name.  Also rename loga to log_a.
6632
6633 2003-09-14  Jim Meyering  <jim@meyering.net>
6634
6635         * src/factor.c (print_factors): Give a separate diagnostic
6636         for numbers that are too large, but otherwise valid.
6637         Reported by Dániel Varga.
6638
6639 2003-09-10  Jim Meyering  <jim@meyering.net>
6640
6641         * Use automake-1.7.7.  Regenerate dependent files.
6642
6643         * tests/Makefile.am (all_programs): Use ../src/tr -s ' ' '\n' in place
6644         of `fmt -1'.  Using the just-built tr is a little cleaner.
6645         Christian Krackowizer reported that HPUX 10.20 doesn't have fmt.
6646         * man/Makefile.am (programs, check-x-vs-1): Likewise.
6647
6648 2003-09-09  Jim Meyering  <jim@meyering.net>
6649
6650         * src/copy.c: Alphabetize includes.
6651         Remove duplicate inclusion of "same.h".
6652
6653 2003-09-08  Jim Meyering  <jim@meyering.net>
6654
6655         * Makefile.maint (GZIP_ENV): Remove --rsyncable.
6656         Didn't give enough of a benefit, mainly because it's not yet
6657         in wide enough use.
6658
6659         * Version 5.0.91.
6660
6661         * man/Makefile.am (programs): Use ../src, not $(srcdir)/../src.
6662         (check-programs-vs-x): Fail if $(programs) is empty.
6663
6664         * src/remove.c: Add a comment.
6665
6666 2003-09-07  Jim Meyering  <jim@meyering.net>
6667
6668         * src/remove.c (D_INO, ENABLE_CYCLE_CHECK) [D_INO_IN_DIRENT]:
6669         Don't define.  These symbols are no longer used.
6670
6671         * tests/misc/tty-eof: Write ^D as \cD.
6672         Complete the change of 2003-08-02.
6673
6674         * Makefile.maint (po-check): Use cvsu, so that a temporary source
6675         file in lib/ or src/ doesn't induce an unwarranted failure.
6676         Add a kludge to filter out the sole generated source file that
6677         also has translatable messages: src/false.c.
6678
6679 2003-09-06  Jim Meyering  <jim@meyering.net>
6680
6681         * src/tail.c (enum): Add ALLOW_MISSING_OPTION.
6682         (parse_options): Give a diagnostic for (but still accept) the
6683         deprecated --allow-missing option.
6684
6685 2003-09-04  Paul Eggert  <eggert@twinsun.com>
6686
6687         Don't ignore -S if input is a pipe.  Bug report by Michael McFarland in
6688         <http://mail.gnu.org/archive/html/bug-coreutils/2003-09/msg00008.html>.
6689
6690         * src/sort.c (sort_buffer_size): Omit SIZE_BOUND arg.  Compute the
6691         size_bound ourselves. if an input file is a pipe and the user
6692         specified a size, use that size instead of trying to guess the
6693         pipe size.  This has the beneficial side effect of avoiding the
6694         overhead of default_sort_size in that case.  All callers changed.
6695         (sort): Remove static var size; now done by sort_buffer_size.
6696
6697 2003-09-05  Jim Meyering  <jim@meyering.net>
6698
6699         * Use automake-1.7.6b and autoconf-2.57b.  Regenerate dependent files.
6700
6701         * tests/tail-2/tail-n0f: Wait .5 seconds for backgrounded process
6702         to start, rather than just .1.  Upon failure, print unexpected state.
6703
6704 2003-09-04  Paul Eggert  <eggert@twinsun.com>
6705
6706         * src/head.c (elide_tail_lines_pipe): Don't assign 0 or
6707         SAFE_READ_ERROR to tmp->nbytes.
6708         * src/tail.c (pipe_lines, pipe_bytes): Likewise.
6709
6710         * src/head.c (struct linebuffer): Change nbytes and nlines
6711         from unsigned int to size_t.  unsigned int is safe (after the
6712         2003-09-03 patch) but size_t is cleaner.
6713         * src/tail.c (struct linebuffer, struct charbuffer): Likewise.
6714         (pipe_bytes): Likewise for local variable 'i', which was 'int'.
6715
6716         Standardize on BUFSIZ as opposed to other macro names and values.
6717         * src/head.c (BUFSIZE): Remove.  All uses changed to BUFSIZ.
6718         * src/tail.c (BUFSIZ) [!defined BUFSIZ]: Remove.
6719         stdio.h has always defined it,
6720         and other code already assumes it's defined.
6721         * src/tr.c (BUFSIZ) [!defined BUFSIZ]: Likewise.
6722         (IO_BUF_SIZE): Remove; replace all uses with sizeof io_buf.
6723         (io_buf): IO_BUF_SIZE -> BUFSIZ.
6724
6725 2003-09-04  Paul Eggert  <eggert@twinsun.com>
6726
6727         * src/seq.c (step): Default to 1.
6728         (print_numbers): Allow the output to be empty.
6729         (main): The default step is 1, even if LAST < FIRST;
6730         as per documentation.
6731         * tests/seq/basic (onearg-2): Output should be empty.
6732
6733 2003-09-05  Jim Meyering  <jim@meyering.net>
6734
6735         * Makefile.cfg (wget_files): Temporarily disable, until master
6736         versions are restored to ftp.gnu.org.
6737
6738         * configure.ac (AM_INIT_AUTOMAKE): Specify automake-1.7.6.
6739
6740         Make seq's --width (-w) option work properly even when the
6741         endpoint requiring the larger width is negative and smaller than
6742         the other endpoint.
6743         * src/seq.c (get_width_format): Include `-' in the set of bytes
6744         allowed in a `simple' number (no decimal point, no exponent).
6745         Reported by Patrick Mauritz.
6746
6747 2003-09-02  Paul Eggert  <eggert@twinsun.com>
6748
6749         * NEWS: sort -t '\0' now uses a NUL tab.
6750         sort option order no longer matters, unless POSIX requires it.
6751         * src/sort.c (usage): Say "blanks" instead of "whitespace",
6752         Similar fixes for many comments.
6753         (TAB_DEFAULT): New constant, so that we can support NUL as
6754         the field separator.
6755         (tab): Now int, not char.  Initialize to TAB_DEFAULT.
6756         (specify_sort_size): If multiple sizes are specified, use the largest.
6757         (begfield, limfield): Support NUL tab char.
6758         (set_ordering): Do not let -i override -d.
6759         (main): Report an error if incompatible -o or -t options are given.
6760         Report an error for "-t ''".  Allow "-t '\0'" to specify a NUL tab.
6761
6762 2003-09-05  Jim Meyering  <jim@meyering.net>
6763
6764         * tests/sort/Test.pm [o2, nul-tab]: New tests for the above.
6765
6766 2003-09-03  Andreas Schwab  <schwab@suse.de>
6767
6768         Bug report and patch here:
6769         <http://mail.gnu.org/archive/html/bug-coreutils/2003-09/msg00009.html>
6770         * src/tail.c (pipe_lines): Don't truncate return value from safe_read.
6771         * src/head.c (elide_tail_lines_pipe): Likewise.
6772
6773 2003-09-03  Jim Meyering  <jim@meyering.net>
6774
6775         * src/du.c (AUTHORS): Remove Larry McVoy's name, since the relatively
6776         small amount of code from him was first moved to lib/human.c, and was
6777         subsequently rewritten entirely.
6778         * src/df.c (AUTHORS): Likewise.
6779
6780 2003-08-22  Lawrence Teo  <lcteo@uncc.edu>
6781
6782         * src/md5sum.c (split_3): Accept the BSD format for generic
6783         message digest modes.  Currently works with BSD's MD5 and SHA1
6784         formats since these are the two algorithms presently used in
6785         coreutils.  Updated comments to reflect this change.
6786         (bsd_split_3): Updated comments.
6787
6788         * tests/md5sum/basic-1: New test to make sure that
6789         `md5sum --check' doesn't accept the BSD SHA1 format (adapted
6790         from `check-bsd' test in tests/sha1sum/basic-1).
6791
6792         * tests/sha1sum/basic-1 (check-bsd2, check-bsd3): New tests for
6793         --check exit status and BSD SHA1 format (adapted from tests
6794         in tests/md5sum/basic-1).
6795
6796 2003-08-30  Jim Meyering  <jim@meyering.net>
6797
6798         * src/ln.c (do_link): Use SAME_INODE rather than open-coding it.
6799
6800         When source and destination arguments refer to the same file, reside
6801         on a partition (e.g. VFAT) on which distinct names may refer to the
6802         same directory entry (often due to variations in case), and when the
6803         link count for the file is 1, mv no longer unlinks the file.  Instead,
6804         it gives the expected diagnostic that the source and destination are
6805         the same.  WARNING: this is an incomplete fix.  If the file happens
6806         to have a link count of 2 or greater, such an erroneous mv command
6807         will still unlink it.
6808         Although that is not possible on vfat or umsdos, it is possible on
6809         other file system types, e.g., ntfs, and hpfs.
6810         * src/copy.c (same_file_ok): Invoke same_name (which might still
6811         return false for names that refer to the same directory entry)
6812         only if the link count is 2 or more.
6813         * tests/mv/vfat: Show how to demonstrate the above problem.
6814         This test is not run.
6815         * tests/mv/Makefile.am (EXTRA_DIST): Add vfat.
6816
6817 2003-08-27  Jim Meyering  <jim@meyering.net>
6818
6819         * src/who.c: Change meaning of -l from --lookup to --login, per POSIX.
6820         who's -l option has been eliciting an unconditional warning about
6821         this impending change since sh-utils-2.0.12 (April 2002).
6822
6823         * src/paste.c (paste_parallel): Don't output `EOF' (aka -1) as a `char'.
6824         This would happen for nonempty files not ending with a newline.
6825         Reported by Dan Jacobson.
6826         * tests/misc/paste-no-nl: New file.  Test for above-fixed bug.
6827         * tests/misc/Makefile.am (TESTS): Add paste-no-nl.
6828
6829         * src/stat.c (print_it): Avoid buffer overrun that would
6830         occur when the user-specified format string ends with `%'.
6831         Patch by Tommi Kyntola.
6832         * tests/misc/stat-fmt: New file.  Test for above-fixed bug.
6833         * tests/misc/Makefile.am (TESTS): Add stat-fmt.
6834
6835 2003-08-26  Jim Meyering  <jim@meyering.net>
6836
6837         Apply changes from bison.
6838         * GNUmakefile (SHELL): Define to `sh', if necessary.
6839         Add copyright.
6840         * Makefile.maint (WGETFLAGS): Define to `-C off'.
6841         Update all uses of $(WGET).
6842
6843 2003-08-22  Akim Demaille  <akim@epita.fr>
6844
6845         * Makefile.cfg (local-checks-to-skip): New.
6846         * Makefile.maint (local-check): Rename as...
6847         (local-checks-available): this.
6848         (local-check): New.
6849
6850 2003-08-26  Akim Demaille  <akim@epita.fr>
6851
6852         * announce-gen (print_changelog_deltas): Neutralize "<#" as
6853         "<\#" to avoid magic from Gnus when posting parts of this script.
6854
6855 2003-08-25  Jim Meyering  <jim@meyering.net>
6856
6857         * src/stat.c (main): Warn about use of deprecated `-l' option.
6858
6859 2003-08-22  Jim Meyering  <jim@meyering.net>
6860
6861         * src/stat.c (do_stat): For link count at end of line, use %h format,
6862         instead of %-5h.  The latter would make stat emit trailing spaces.
6863         Reported by Dan Jacobson.
6864
6865 2003-08-20  Jim Meyering  <jim@meyering.net>
6866
6867         * Makefile.am (EXTRA_DIST): Add .x-sc_space_tab .x-sc_sun_os_names
6868
6869 2003-08-19  Jim Meyering  <jim@meyering.net>
6870
6871         * src/system.h: Include stdlib.h unconditionally,
6872         as we're now assuming that part of hosted C89.
6873
6874 2003-08-18  Jim Meyering  <jim@meyering.net>
6875
6876         * src/sys2.h (textdomain, bindtextdomain) [! ENABLE_NLS]: Define away,
6877         to avoid warnings from gcc.
6878
6879 2003-08-17  Jim Meyering  <jim@meyering.net>
6880
6881         Avoid unnecessary and sometimes time-consuming hostname lookups.
6882         * src/who.c (print_user): Use strchr, not strrchr.
6883         * src/pinky.c (print_entry): Likewise.
6884         Patch by Michael Stone.
6885         This fixes a typo I introduced in who-users.c on 1996-02-23.
6886
6887         * Makefile.maint (makefile-check): Add 0-9 to the range of characters
6888         disallowed between `@...@'.
6889
6890 2003-08-16  Paul Eggert  <eggert@twinsun.com>
6891
6892         * configure.ac (fu_cv_sys_truncating_statfs): Remove; now
6893         done by gnulib .m4 files.
6894         (jm_DUMMY_1): Require gl_READUTMP, not jm_PREREQ_READUTMP.
6895         * src/sys2.h (strtoull): Remove unused declaration.
6896
6897 2003-08-16  Jim Meyering  <jim@meyering.net>
6898
6899         * man/Makefile.am (.x.1): Ensure that generated PROGRAM.1 files
6900         are read-only.
6901
6902         * src/tail.c (tail_lines): Fix a potential (but very hard to exercise)
6903         race condition bug.  The bug would be triggered when tailing a file
6904         with file pointer not at beginning of file, and where the file was
6905         truncated to have a length of less than the initial offset at just
6906         the right moment (between the two lseek calls in this function).
6907
6908         An invalid initial value for *read_pos would result in
6909         `tail -n0 -f FILE' and `tail -c0 -f FILE' doing what amounted to a
6910         busy-wait rather than sleeping between iterations.  The bug manifests
6911         itself only when tailing regular files that are initially nonempty.
6912         * src/tail.c (tail_bytes): Set *read_pos to new file offset after
6913         each xlseek call.
6914         (tail_lines): Likewise, after lseek calls.
6915         Reported by Nick Estes.  See http://bugs.debian.org/205251 for details.
6916         * tests/tail-2/tail-n0f: New file.  Test for above fix.
6917         * tests/tail-2/Makefile.am (TESTS): Add tail-n0f.
6918
6919 2003-08-15  Jim Meyering  <jim@meyering.net>
6920
6921         * Makefile.maint (sc_space_tab): Use exclusion list in separate file.
6922         (sc_sun_os_names): Likewise.
6923         * .x-sc_space_tab, .x-sc_sun_os_names: New files.
6924
6925         * man/help2man: Remove some SPACEs before TAB.
6926
6927 2003-08-14  Paul Eggert  <eggert@twinsun.com>
6928
6929         * Makefile.maint (LC_ALL): Set to C.
6930         * man/Makefile.am (ASSORT): New var.
6931         (check-x-vs-1, programs): Use it.
6932         * src/Makefile.am (ASSORT, check-README, ../AUTHORS): Likewise.
6933         * tests/Makefile.am (ASSORT, all_programs): Likewise.
6934
6935 2003-08-11  Jim Meyering  <jim@meyering.net>
6936
6937         fold -s -wN would infloop for N < 8 with TABs in the input.
6938         E.g., this would not terminate: printf 'a\tb' | fold -w2 -s
6939         * src/fold.c (fold_file): Move contents of `else'-block
6940         out of conditional so it's used also for --spaces (-s).
6941         * tests/misc/fold: Test for the above fix.
6942         * tests/misc/Makefile.am (TESTS): Add fold.
6943
6944 2003-08-10  Jim Meyering  <jim@meyering.net>
6945
6946         * src/nice.c [!NICE_PRIORITY]: Include <sys/resource.h> after
6947         system.h so the types from time.h and sys/time.h are available.
6948         It appears that this is necessary for OpenBSD, NetBSD, and
6949         Darwin 6.5 (MacOS 10.2.5).  Reported by Nelson Beebe.
6950
6951 2003-08-06  Paul Eggert  <eggert@twinsun.com>
6952
6953         * NEWS: Add support for setting file timestamps to microsecond
6954         resolution, on hosts that support this.
6955         * src/copy.c, src/cp.c, src/install.c, src/touch.c: Include utimens.h.
6956         * src/copy.c (copy_internal):
6957         Set file timestamps with utimens, not utime.
6958         * src/cp.c (re_protect): Likewise.
6959         * src/install.c (change_timestamps): Likewise.
6960         * src/touch.c (newtime, touch, main): Likewise.
6961
6962 2003-08-09  Jim Meyering  <jim@meyering.net>
6963
6964         * Makefile.maint (sc_sun_os_names): New rule based on a regexp
6965         from Paul Eggert.
6966         (syntax-check-rules): Add it.
6967
6968         * src/tail.c (main): Tweak Solaris OS version number in comment.
6969         * src/wc.c (wc): Likewise
6970         * tests/tail-2/fflush: Likewise.
6971
6972         * src/tail.c: Add new undocumented option, --presume-input-pipe.
6973         (pipe_lines): Use memchr to skip lines, rather than an explicit loop.
6974
6975 2003-08-08  Paul Eggert  <eggert@twinsun.com>
6976
6977         Use new gnulib 'extensions' module.
6978         * configure.ac: Invoke gl_USE_SYSTEM_EXTENSIONS instead of
6979         AC_GNU_SOURCE.
6980
6981 2003-08-08  Paul Eggert  <eggert@twinsun.com>
6982
6983         * tests/du/basic: Ensure that a/b/F has at least 65 bytes too.
6984
6985 2003-08-09  Jim Meyering  <jim@meyering.net>
6986
6987         * tests/misc/split-fail: Reflect that `split -a 0' is now accepted.
6988         For tests of obsolete behavior, don't presume that unsetting
6989         _POSIX2_VERSION is equivalent to _POSIX2_VERSION=199209.
6990
6991 2003-08-07  Paul Eggert  <eggert@twinsun.com>
6992
6993         * doc/coreutils.texi (split invocation):
6994         Add -d or --numeric-suffixes option to 'split'.
6995         From a suggestion by Jesse Kornblum.
6996         * src/split.c (suffix_alphabet): New var.
6997         (longopts, usage, next_file_name, main): Support -d.
6998         (next_file_name, main): Allow -a0, as POSIX requires.
6999         (next_file_name): Don't assume ASCII-like encoding;
7000         'a' through 'z' are not contiguous in EBCDIC.
7001
7002 2003-08-05  Paul Eggert  <eggert@twinsun.com>
7003
7004         Merge getline from gnulib.
7005         * lib/getline.h, lib/getline.c, m4/getline.m4: Merge from gnulib.
7006         * lib/getndelim2.h, lib/getndelim2.c, m4/getndelim2.m4, m4/ssize_t.m4:
7007         New files, from gnulib.
7008         * lib/getdelim2.c, lib/getdelim2.h: Remove.
7009         * lib/Makefile.am (libfetish_a_SOURCES): Change getdelim2.c and
7010         getdelim2.h to getndelim2.c and getndelim2.h.
7011         * m4/jm-macros.m4 (jm_MACROS): Use gl_GETNDELIM2 rather than
7012         checking for getdelim.
7013         (jm_CHECK_ALL_TYPES): Use gt_TYPE_SSIZE_T for ssize_t rather
7014         than rolling our own.
7015         * src/cut.c: Include getndelim2.h rather than getdelim2.h.
7016         (cut_fields): Invoke getndelim2 rather than getdelim2.
7017
7018 2003-08-04  Jim Meyering  <jim@meyering.net>
7019
7020         * src/sort.c (main): Use unsigned int instead of int for `nsigs'
7021         and for the indices to iterate through nsigs.
7022
7023 2003-08-02  Paul Eggert  <eggert@twinsun.com>
7024
7025         * src/sort.c: Minor code cleanups, mostly to use more accurate
7026         types and to remove unnecessary casts.
7027         (min, max): Remove.  All uses changed to MIN and MAX.
7028         (hard_lc_collate, hard_LC_TIME, struct buffer.eof, struct
7029         keyfield.skipsblanks, struct keyfield.skipeblanks, struct
7030         keyfield.numeric, struct keyfield.general_numeric, struct
7031         keyfield.month, struct keyfield.reverse, reverse, unique,
7032         have_read_stdin): Now bool, not int.  All uses changed.
7033         (eolchar): Now char, not int.
7034         (struct keyfield.ignore): Now bool const *, not int *.
7035         (struct keyfield.translate): Now char const *, not char *.
7036         (struct month.name): Likewise.
7037         (blanks, nonprinting, nondictionary): Now bool[], not int[].
7038         (cleanup, inittables, keycompare, check, mergefps, first_same_file,
7039         check, sort, main): Use const * pointers when possible.
7040         (month_cmp): Rewrite to avoid casts.
7041         (inittables): Initialize tables unconditionally, to avoid branches.
7042         (fillbuf): Return bool, not int.  All uses changed.
7043         (fillbuf, keycompare, new_key, main):
7044         Use SIZE_MAX rather than (size_t) -1.
7045         (trailing_blanks): Renamed from trim_trailing_blanks.
7046         Return the number of blanks to trim.  All uses changed.
7047         (getmonth): Use trailing_blanks rather than open code.
7048         (keycompare): Do not cast char * to unsigned char *; not needed.
7049         CMP_WITH_IGNORE converts args to UCHAR, so no need to convert it
7050         ourselves.
7051         (compare, main): Use | rather than || to avoid jumps.
7052         Replace "diff = NONZERO (alen)" with "diff = 1", since alen must
7053         be nonzero there.
7054         (check, first_same_file, sort, main):
7055         Use bool instead of int local vars when possible.
7056         (check): Merge the old 'checkfp' and 'check' into a single function,
7057         that returns a boolean (true if the file was ordered).
7058         All uses changed.
7059         (main): Use int instead of unsigned for iterating through nsigs.
7060         Rename local var "posix_pedantic" to "posixly_correct".
7061
7062 2003-08-02  Jim Meyering  <jim@meyering.net>
7063
7064         * src/nice.c [!NICE_PRIORITY]: Include <time.h> before <sys/resource.h>
7065         to avoid compilation error on Ultrix. Reported by Christian Krackowizer.
7066
7067         * src/cut.c (cut_fields): Don't read again after encountering an
7068         initial EOF.  E.g., `cut -f2' would do so.
7069         * tests/misc/tty-eof: Add a test for the above fix.
7070
7071         * src/sort.c (sortlines): Add description and references.
7072         From Paul Eggert.
7073
7074         * tests/Makefile.am (TESTS_ENVIRONMENT): Set PATH so that
7075         the tests in help-version will use the just-built binaries.
7076         Reported by Christian Krackowizer.
7077
7078 2003-07-31  Paul Eggert  <eggert@twinsun.com>
7079
7080         * NEWS: Add --rfc-2822 option to GNU date.
7081         * doc/coreutils.texi (Time directives, Options for date, Examples
7082         of date): Likewise.
7083         * src/date.c (long_options, usage, main): Likewise.
7084         * doc/getdate.texi (General date syntax): Likewise.
7085         * doc/coreutils.texi (Options for date): Fix a typo in format:
7086         it's now %d not %_d.  Add URLs.
7087
7088 2003-08-01  Jim Meyering  <jim@meyering.net>
7089
7090         * tests/shred/remove: Ensure that $? is 0 for the final `exit 0'.
7091         Otherwise, with at least the /bin/sh from HPUX 10.20,
7092         the trap code would end up converting that to exit 1 and thus an
7093         unexpected test failure.  Reported by Christian Krackowizer.
7094
7095 2003-07-31  Paul Eggert  <eggert@twinsun.com>
7096
7097         * src/ptx.c: Do not include bumpalloc.h.
7098         (WORD_TABLE): New member alloc.
7099         (ALLOC_NEW_WORD): Remove.
7100         (occurs_alloc): New var.
7101         (digest_word_file, find_occurs_in_text): Check for arithmetic
7102         overflow when computing table size.  Use xrealloc rather than
7103         bumpalloc primitives.
7104
7105 2003-07-29  Jim Meyering  <jim@meyering.net>
7106
7107         * Version 5.0.90.
7108
7109         * README: When running tests as root, suggest using
7110         sudo with NON_ROOT_USERNAME=$USER.
7111
7112         * tests/Makefile.am (all_programs): Makefile is in ../src, not
7113         $(srcdir)/../src.
7114
7115 2003-07-28  Jim Meyering  <jim@meyering.net>
7116
7117         * Makefile.maint (GZIP_ENV): Try Debian/gzip's new --rsyncable option.
7118
7119 2003-07-28  Paul Eggert  <eggert@twinsun.com>
7120
7121         * lib/stdbool.hin (_Bool): Make it signed char, instead of
7122         an enum type, so that it's guaranteed to promote to int.
7123         * src/sort.c (sortlines_temp): Undo previous change.
7124
7125 2003-07-28  Jim Meyering  <jim@meyering.net>
7126
7127         * src/sort.c (sortlines_temp): Declare local `swap' to be `int', not
7128         `bool'.  Otherwise, at least one buggy compiler (alpha gcc-2.95.4)
7129         would cause lines[-1 - swap] (with swap = false) to evaluate to
7130         lines[4294967295].
7131
7132 2003-07-27  Jim Meyering  <jim@meyering.net>
7133
7134         * tests/priv-check (my_uid): Use `!', not `^' in case pattern `[!0-9]',
7135         since /bin/sh of at least NetBSD 1.6 and OpenBSD 3.2 don't accept `^'.
7136
7137         * src/remove.c (prompt) [! recursive]: Don't prompt about unwritable
7138         directories, as required by POSIX.   Reported by Karl Berry.
7139         * tests/rm/dir-no-w: New file.  Test for the above fix.
7140         * tests/rm/Makefile.am (TESTS): Add dir-no-w.
7141
7142         * tests/mk-script: Emit `$xx', not its expansion.
7143
7144 2003-07-27  Paul Eggert  <eggert@twinsun.com>
7145
7146         This change was inspired by a similar proposal by Stepan Kasal.
7147         * src/sort.c (mergelines, sortlines_temp): New functions.
7148         (sortlines): Use them, to reduce the number of times that
7149         we need to copy 'struct line' values.  This improved CPU
7150         performance by about 30% on one 18 MB test.
7151         (sort): Don't invoke sortlines unless we have 2 or more lines.
7152
7153 2003-07-26  Stepan Kasal  <kasal@ucw.cz>
7154
7155         * src/sort.c (sort): Don't require two `struct line's per text line,
7156         the new sort algorithm requires just 1.5.
7157
7158 2003-07-27  Jim Meyering  <jim@meyering.net>
7159
7160         * src/pathchk.c (validate_path): Use %lu, not %ld.
7161         From Paul Eggert.
7162         * src/cut.c (is_printable_field): Simplify bit arithmetic.
7163         From Paul Eggert.
7164         * src/ls.c (sort_files): Put `volatile' in the right place.
7165         From Paul Eggert.
7166
7167 2003-07-26  Jim Meyering  <jim@meyering.net>
7168
7169         Use only one bit per field/offset in array, not one `int'.
7170         * src/cut.c (printable_field): Change type to `unsigned char'.
7171         (mark_printable_field, is_printable_field): New functions.
7172         Use them in place of all direct accesses of `printable_field'.
7173
7174         * src/expand.c (parse_tabstops): Detect overflow properly.
7175         * src/cut.c (set_fields): Likewise.
7176
7177         * src/rm.c: Include "dirname.h".
7178         (usage): Use base_name (program_name) in body of --help output.
7179         This lets me...
7180         * man/Makefile.am (.x.1): ...back out the kludge of 2003-07-22.
7181         Idea from Brendan O'Dea, who suggested using
7182         `program_name = basename (argv[0]);' everywhere --
7183         can't do that, but using base_name works just fine here.
7184
7185         * src/Makefile.am (AM_INSTALLCHECK_STD_OPTIONS_EXEMPT): Exempt test.
7186
7187 2003-07-24  Paul Eggert  <eggert@twinsun.com>
7188
7189         Fix some POSIX-compliance problems with 'test'.  This makes
7190         'test' more compatible with Bash.
7191
7192         * NEWS, doc/coreutils.texi: Document the following.
7193         * src/test.c: Include exitfail.h.
7194         (TEST_FAILURE): New constant, used for exit status if 'test' fails.
7195         (test-syntax_error): Use it.
7196         (binary_operator): Now takes bool arg specifying whether left operand
7197         is -l ARG, so that caller determines this rather than us.
7198         All uses changed.
7199         (term): Use posixtest to evaluate parenthesized subexpressions.
7200         (unary_operator, one_argument): Remove support for -t without operand.
7201         (one_argument): Take argument from argv[pos].
7202         (one_argument, two_arguments, three_arguments): Advance pos.
7203         All callers changed.
7204         (three_arguments): Look for binary ops before "!".  Then look
7205         for parenthesized one_argument expressions, instead of trusting
7206         expr () to do the right thing.
7207         (posixtest): Now takes number of args.  All callers changed.
7208         Treat "( A B )" like "A B".
7209         (main): Set exit_failure to TEST_FAILURE.  Don't depend on
7210         POSIXLY_CORRECT, as we now conform to POSIX by default.
7211         (main) [!LBRACKET]: Do not recognize "--help" or "--verbose" unless.
7212         * tests/test/Test.pm (test_vector): Add several tests to check
7213         the above.  Syntax errors now exit with status 2, not 1.
7214         * man/Makefile.am (mapped_name): Use `../src/[' binary to create test.1.
7215
7216 2003-07-26  Jim Meyering  <jim@meyering.net>
7217
7218         * tests/help-version: Adjust for above change in test behavior:
7219         `[' exits with 2, not 1, and test doesn't accept --help or --version.
7220
7221         * Makefile.maint (ME): Don't use trick suggested in Make manual.
7222         It doesn't work for make-3.79.1.  Reported by Christian Krackowizer.
7223
7224         * Makefile.maint (sc_system_h_headers): Another syntax check.
7225         (syntax-check-rules): Add it to the list.
7226
7227         * src/pathchk.c (validate_path): Cast strlen value to `unsigned long'
7228         so it matches `%ld' format even on 32-bit systems.
7229
7230         * src/fmt.c (flush_paragraph): Cast field width to `int' to
7231         avoid warning on 64-bit systems.
7232
7233         * src/ls.c (sort_files): Make `func' volatile, so it can't be
7234         clobbered by a `longjmp' into this function.
7235
7236 2003-07-25  Jim Meyering  <jim@meyering.net>
7237
7238         * src/pathchk.c (validate_path): Use %ld format (not %d) for size_t
7239         value.
7240
7241         * tests/misc/split-fail: Disable the --line-bytes=$_4gb test,
7242         because it'd evoke spurious failure on 64-bit systems.
7243
7244 2003-07-24  Jim Meyering  <jim@meyering.net>
7245
7246         * src/dd.c (usage): Document the fact that SIGUSR1 makes dd
7247         output its current record counts.  Reported by Jurriaan.
7248
7249         * tests/wc/Test.pm (test_vector): Disable the `PIPE' tests when running
7250         `wc' with no options.  This goes along with the change of 2003-07-20.
7251
7252 2003-07-23  Jim Meyering  <jim@meyering.net>
7253
7254         Don't include headers already included by system.h:
7255         * src/tr.c: Don't include errno.h.
7256         * src/true.c: Don't include version-etc.h.
7257         * src/test.c: Don't include limits.h or error.h.
7258         * src/stat.c: Don't include unistd.h or time.h.
7259         * src/readlink.c: Don't include stdlib.h, unistd.h, or limits.h.
7260         * src/pr.c: Don't include time.h.
7261         * src/pathchk.c: Don't include errno.h.
7262         * src/nice.c: Don't include sys/time.h.
7263         * src/ls.c: Don't include stdlib.h.
7264
7265         * basename.c, cat.c, chroot.c, cksum.c, comm.c, csplit.c, cut.c, date.c:
7266         * dd.c, dirname.c, echo.c, env.c, expand.c, expr.c, factor.c, fmt.c:
7267         * fold.c, head.c, hostid.c, hostname.c, id.c, join.c, kill.c, logname.c:
7268         * md5sum.c, nice.c, nl.c, nohup.c, od.c, paste.c, pathchk.c, pinky.c:
7269         * pr.c, printenv.c, printf.c, ptx.c, pwd.c, seq.c, setuidgid.c, shred.c:
7270         * sleep.c, sort.c, split.c, stat.c, stty.c, su.c, sum.c, tac.c, tail.c:
7271         * tee.c, test.c, tr.c, true.c, tsort.c, tty.c, uname.c, unexpand.c:
7272         * uniq.c, uptime.c, users.c, wc.c, who.c, whoami.c, yes.c:
7273         Don't include closeout.h.
7274
7275         * tests/rm/fail-2eperm: Add a check for whether $NON_ROOT_USERNAME
7276         can access the required version of rm.
7277         * tests/rm/Makefile.am (TESTS_ENVIRONMENT): Define PACKAGE_VERSION.
7278
7279         * tests/cut/Test.pm (out-delim3a): New test.
7280
7281         * man/help2man: Update to version 1.33.
7282
7283         * src/expand.c (parse_tabstops): Detect overflow in tabstop sizes.
7284
7285         * src/dircolors.c: Include xstrndup.h.
7286         (xstrndup): Remove function, now that it's been factored out into
7287         it's own file.
7288
7289 2003-07-22  Paul Eggert  <eggert@twinsun.com>
7290
7291         * src/wc.c (wc): Fix typo in computation of file from file_x,
7292         which caused the former to be used uninitialized if file_x was
7293         nonzero.
7294
7295 2003-07-22  Jim Meyering  <jim@meyering.net>
7296
7297         * src/cut.c (set_fields): Use xcalloc in place of xmalloc+memset.
7298
7299         * man/Makefile.am (.x.1): Substitute 's,$t/$*,$*,' on output of
7300         help2man, to avoid having `rm.td/rm' appear in rm.1.  Reported by
7301         Thomas Luzat.  See http://bugs.debian.org/202413 for details.
7302
7303         * src/cut.c (main) [lint]: Initialize spec_list_string to avoid warning.
7304
7305         * src/hostid.c: Don't include <unistd.h>.  system.h already does that.
7306
7307         * src/cut.c (set_fields): Mark all selected indices before trying to
7308         determine range endpoints.
7309         * tests/cut/Test.pm: New test for the above fix.
7310
7311         Begin to address this comment: What if someone wants to
7312         extract the 1,000,000-th field of some huge input file?
7313         The first step is to rearrange things so that the values
7314         in the printable_field array are all 0/1 rather than 0/1/2.
7315         * src/cut.c (RANGE_START_SENTINEL): Remove.
7316         Store range-start indices in a hash table, rather than
7317         overloading the `printable_field' array.
7318         (range_start_ht): New global.
7319         (hash_int, hash_compare_ints, is_range_start_index): New functions.
7320         (print_kth): Use is_range_start_index; don't test printable_field.
7321         (set_fields): Detect overflow.
7322         (set_fields): Insert each range-start index into range_start_ht.
7323         (main): Call set_fields only once, and only after
7324         output_delimiter_specified and (if required) range_start_ht have
7325         been defined.
7326
7327 2003-07-20  Paul Eggert  <eggert@twinsun.com>
7328
7329         * src/wc.c (get_input_fstatus): Fix typo: `stat' was being
7330         invoked with a null pointer when there were no file arguments.
7331
7332 2003-07-20  Jim Meyering  <jim@meyering.net>
7333
7334         * Makefile.maint (sc_changelog): Add another nit-picky check.
7335
7336         * src/wc.c (write_counts): Add a comment.
7337         (wc): Rename `file' parameter.
7338         Set new local, `file', to be the file name, or (when it's NULL)
7339         _("standard output") so that all uses of `file' use the proper value.
7340         Use STREQ, not strcmp.
7341
7342 2003-07-20  Paul Eggert  <eggert@twinsun.com>
7343
7344         wc count field widths now are heuristically adjusted depending
7345         on the input size, if known.  If only one count is printed, it
7346         is guaranteed to be printed without leading spaces.
7347
7348         Previously, wc did not align the count fields if
7349         POSIXLY_CORRECT was set, but POSIX did not actually require
7350         this undesirable behavior, so it has been removed.
7351
7352         * NEWS: Document this.
7353         * doc/coreutils.texi (wc invocation): Likewise.
7354
7355         * src/wc.c (number_width): New var.
7356         (posixly_correct): Remove.
7357         (struct fstatus): New struct.
7358         (write_counts): Output fields of width number_width.
7359         Do not worry about POSIXLY_CORRECT.
7360         Use null file, not empty-string file, to denote stdin,
7361         since "" is a valid file name on some hosts.
7362         (wc, wc_file): New arg fstatus.  Use it to avoid invoking fstat
7363         if possible.
7364         (wc):  Avoid problems if end_pos - current_pos overflows.
7365         Do not print odd message if stdin has a read error.
7366         (get_input_fstatus, compute_number_width): New functions.
7367         (main): Use them to implement the new behavior.
7368         Ignore POSIXLY_CORRECT.
7369
7370         * tests/wc/Test.pm: Adjust to the new output widths.
7371
7372 2003-07-19  Jim Meyering  <jim@meyering.net>
7373
7374         * tests/rm/fail-eperm: Don't create temporary directory --
7375         we don't use it.
7376
7377         * tests/shred/remove: Don't open-code test for UID != 0.
7378         Use priv-check's require-non-root instead.
7379         Update to use newer framework.
7380
7381         * tests/help-version (expected_failure_status_expr): Record that
7382         expr exits with status of 3 for e.g., a write error.
7383
7384         * tests/priv-check: Use `id -u' to see if we're running as root,
7385         rather than trying go write to an write-protected file.
7386         When running as root, ensure $NON_ROOT_USERNAME is valid.
7387         When running as root with `require-non-root', ensure that `.'
7388         is writable by $NON_ROOT_USERNAME, then reinvoke $0 set-user-ID
7389         to $NON_ROOT_USERNAME.  If `.' is not writable, then skip the test.
7390
7391         * src/printenv.c: Include "exitfail.h".
7392         (main): Set exit_failure rather than calling close_stdout_set_status.
7393         * src/date.c: Likewise.
7394         * src/sort.c: Likewise.
7395         * src/tty.c: Likewise.
7396
7397 2003-07-18  Jim Meyering  <jim@meyering.net>
7398
7399         * tests/touch/not-owner: Update to use newer framework.
7400
7401         * tests/rm/fail-eperm: Use $srcdir/../priv-check, create a temporary
7402         directory, and remove Perl-coded `you may not run as root' test.
7403         * tests/cp/fail-perm: Use $srcdir/../priv-check, rather than
7404         hard-coding something not quite equivalent.
7405         Paul Jarc reported the inconsistent diagnostics.
7406
7407         * src/sort.c (main): Use close_stdout via atexit.
7408         Now `sort --version' and `sort --help' fail, as they should
7409         when their output is redirected to /dev/full.
7410
7411         * src/su.c (usage): Don't call close_stdout here.
7412         (main): Use close_stdout via atexit.
7413         Now `su --version > /dev/full' fails, as it should.
7414         Somehow, the change of 2000-05-07 that purports to fix this
7415         was not checked in.
7416
7417         * tests/help-version (--help/--version vs. /dev/full): Special-case
7418         `[' to protect it from expected_failure_status-`eval'.
7419
7420         * src/uniq.c (writeline): Use a SPACE, not a TAB between the
7421         count and the corresponding line, as required by POSIX.
7422         Reported by Clement Wang.
7423         * tests/uniq/Test.pm (101, 102): Update tests of -c accordingly.
7424
7425         * tests/expr/basic: Add tests for when exit status is 2.
7426
7427         * src/nohup.c (NOHUP_FOUND_BUT_CANNOT_INVOKE, NOHUP_FAILURE):
7428         Use an anonymous `enum', rather than #define.
7429
7430 2003-07-17  Paul Eggert  <eggert@twinsun.com>
7431
7432         * src/expr.c: Include "exitfail.h", "quotearg.h".
7433         (EXPR_INVALID, EXPR_ERROR): New constants.
7434         (nomoreargs, null, toarith, nextarg): Return bool, not int.
7435         (syntax_error): New function, exiting with status 2.  Use it
7436         insteading of printing "syntax error" ourselves.
7437         (main): Initialize exit_failure to EXPR_ERROR.
7438         Exit with EXPR_INVALID on syntax error (too few arguments).
7439         (nextarg): Use strcmp, not strcoll; strcoll might return
7440         an undesirable 0, or might fail.
7441         (docolon, eval4, eval3): Exit with status 3 on invalid argument type
7442         or other such error.
7443         (eval2): Report an error if strcoll fails in a string comparison.
7444         * src/sort.c: Include "exitfail.h".
7445         (main): Set exit_failure, not xalloc_exit_failure and
7446         xmemcoll_exit_failure.
7447         * tests/expr/basic: Invalid value exits with status 3, not 2.
7448
7449 2003-07-16  Jim Meyering  <jim@meyering.net>
7450
7451         * configure.ac (AC_INIT): Use 5.0.90 as the version, rather than 5.0.2,
7452         per GNU maintainer guidelines.  The next non-beta release will be 5.1.
7453
7454         This script would have caught at least two recent bugs:
7455         those in [ and kill.
7456         * tests/help-version: Revive this script.
7457         It wasn't doing anything useful, since $all_programs wasn't being
7458         defined by the invoking Makefile.am.
7459         Reflect that nohup is no longer a script, so don't exclude it.
7460         Add framework to handle the programs added since it was last run:
7461         kill, stat, unlink, [, link, readlink.
7462         Fix path-related problems deriving from the move of this script
7463         from src/ to its present location.
7464         * tests/Makefile.am (all_programs): Define.
7465         (TESTS_ENVIRONMENT): Use it.
7466
7467         * src/kill.c (main): Fix bug introduced on 2003-05-10 (for 5.0.1)
7468         whereby kill would always attempt to operate on argv[0] and fail.
7469
7470         * src/test.c (integer_expected_error): Improve diagnostic -- now,
7471         it also matches the one from bash's builtin test.
7472         (binary_operator): Add \n at end of diagnostic.
7473
7474         * tests/rm/fail-2eperm: Remove setuidgid-related code.  Move it to ...
7475         * tests/priv-check: Move setuidgid-related and
7476         NON_ROOT_USERNAME-checking code to this file.
7477
7478         * README: Update section on testing as `root'.
7479         Suggestion from Paul Jarc.
7480
7481         * src/test.c (AUTHORS): Replace 3-letter usernames with the actual
7482         names of authors that I just found in bash's builtins/test.def.
7483
7484         Running `[' with no arguments would evoke a segfault.
7485         * src/test.c (main) [LBRACKET]: Move initialization of argv to
7486         precede potential use via test_syntax_error.
7487
7488         * src/Makefile.am (AM_CPPFLAGS): Rename from `INCLUDES', to avoid
7489         warning from automake -Wall.
7490
7491 2003-07-15  Jim Meyering  <jim@meyering.net>
7492
7493         * Version 5.0.1.
7494
7495         * Makefile.maint (%.asc): Remove target first, so gpg doesn't
7496         prompt us about it.
7497
7498         * announce-gen (print_changelog_deltas): Relax tests for matching
7499         version-number line in NEWS.
7500         Change the .sig suffix to .asc here, too.
7501
7502 2003-07-14  Jim Meyering  <jim@meyering.net>
7503
7504         * Makefile.maint (%.asc): Renamed from %.sig.
7505         Generate and use ascii-armored signatures.
7506         Use gpg's -o option.
7507
7508 2003-07-13  Jim Meyering  <jim@meyering.net>
7509
7510         * src/nohup.c (NOHUP_FAILURE, NOHUP_FOUND_BUT_CANNOT_INVOKE): Define.
7511         (main): Use them.
7512
7513         * Makefile.maint (syntax-check): Move each individual check into
7514         its own target.
7515         (syntax-check-rules): This is the list of syntax-check targets.
7516         (sc_unmarked_diagnostics, sc_cast_of_argument_to_free):
7517         (sc_cast_of_x_alloc_return_value, sc_space_tab):
7518         (sc_error_exit_success, sc_xalloc_h_in_src):  New targets.
7519
7520 2003-07-12  Jim Meyering  <jim@meyering.net>
7521
7522         * configure.ac: Remove uses of OPTIONAL_BIN_ZCRIPTS and last
7523         traces of the nohup script.
7524
7525         * src/Makefile.am (bin_SCRIPTS): Remove use of just-removed
7526         $(OPTIONAL_BIN_ZCRIPTS).
7527
7528         * src/Makefile.am (localedir.h): Put the `2>&1' after the redirect
7529         target, not before the `>'.
7530
7531         * src/remove.c (remove_dir): Give a diagnostic upon failed save_cwd,
7532         now that that function no longer calls `error'.
7533
7534         * src/df.c (find_mount_point): Emit a diagnostic for each
7535         failed syscall, rather than relying on caller to do that.
7536         The caller couldn't do a good job, anyhow -- too many different
7537         ways to fail (each with a different referent).
7538         Give a diagnostic upon failed save_cwd, now that that function
7539         no longer calls `error'.
7540         (show_point): Don't diagnose find_mount_point's errors, now that
7541         it handles them itself.
7542
7543         * src/df.c (find_mount_point): Don't let free clobber errno upon
7544         failed chdir.
7545
7546         * src/sys2.h: Remove alloca-related block.
7547         * src/system.h: Include <alloca.h> here, instead.
7548
7549         It appears that the `#pragma alloca' included via "system.h" is
7550         adequate, since join.c uses alloca, yet lacked an in-file #pragma.
7551         * src/copy.c, src/cp.c, src/df.c, src/install.c, src/ln.c:
7552         * src/ls.c, src/mv.c, src/remove.c: Remove `#pragma alloca'.
7553
7554         * src/chown-core.c (change_file_owner): Do not restore any special
7555         permission bits (e.g., set-user-ID, set-group-ID) that are reset
7556         by chown(2) on some systems.  Suggestion and insistence :-) from
7557         Michael Stone.
7558
7559         * tests/input-tty: Also check `test -t 1'.
7560         This is necessary on linux-2.4.21.  Otherwise, the stty/basic-1
7561         test would block when run in the background.
7562
7563 2003-07-11  Jim Meyering  <jim@meyering.net>
7564
7565         * tests/sample-test: Also fail if cat-to-create-expected-output
7566         fails.  Otherwise, if both `exp' and `out' were to end up empty
7567         because of e.g., a full disk, they would mistakenly compare equal.
7568
7569         * src/nohup.c: New file.  Rewrite of nohup.sh in C.
7570         This solves a portability problem: on at least Solaris systems,
7571         when nohup.sh used the vendor /bin/sh, it would exit with status
7572         of `1' rather than the required 126 or 127 upon failure to exec
7573         the specified program.
7574
7575         * src/Makefile.am (EXTRA_SCRIPTS): Remove definition.
7576         (bin_PROGRAMS): Add nohup.
7577         (EXTRA_DIST): Remove nohup.sh.
7578         (all_programs): Remove use of $(EXTRA_SCRIPTS).
7579         * src/nohup.sh: Remove file.
7580         * man/Makefile.am (nohup.1): Depend on nohup.c, rather than nohup.sh.
7581
7582         * tests/misc/nohup: Tests for the above.
7583         * tests/misc/Makefile.am (TESTS): Add nohup.
7584
7585         * src/head.c (diagnose_copy_fd_failure): New function, renamed from
7586         the macro, COPY_FD_DIAGNOSE.
7587         (diagnose_copy_fd_failure): Enclose diagnostic in _(...).
7588         (head_file): Likewise.
7589
7590         * src/date.c: Include "quote.h".
7591         (batch_convert): Use the quote function rather than using literal `...'
7592         in a diagnostic.
7593
7594         * src/setuidgid.c (main): Enclose diagnostic in _(...).
7595         * src/fmt.c (main): Likewise.
7596         * src/mknod.c (main): Likewise.
7597         * src/tac.c (tac_seekable): Likewise.
7598         * src/yes.c (main): Likewise.
7599         * src/od.c (main): Likewise.
7600         * src/install.c (change_attributes): Likewise.
7601
7602 2003-07-10  Jim Meyering  <jim@meyering.net>
7603
7604         * src/head.c (usage): Use 1024*1024 in place of 1048576.
7605         * src/tail.c (usage): Likewise.
7606
7607         * tests/rm/fail-2eperm: Now that we have setuidgid, use it in
7608         place of the kludge in this test.  Suggestion from Paul Jarc.
7609
7610         * src/Makefile.am (noinst_PROGRAMS): Define to setuidgid.
7611         * src/setuidgid.c: New program, solely for testing (not installed).
7612
7613         * src/chown-core.c (change_file_owner): Don't leak file descriptors
7614         when dereferencing symlinks.
7615
7616 2003-07-09  Jim Meyering  <jim@meyering.net>
7617
7618         * tests/du/slash: New file/test for today's lib/ftw.c fix.
7619         * tests/du/Makefile.am (TESTS): Add slash
7620
7621         * src/tail.c (xlseek): Avoid warning about ``return without value
7622         from function returning non-void''.
7623
7624 2003-07-08  Jim Meyering  <jim@meyering.net>
7625
7626         * man/help2man: Update to version 1.29.
7627
7628         * man/help2man: Add END handler to close STDOUT and check for errors.
7629
7630 2003-06-30  Paul Eggert  <eggert@twinsun.com>
7631
7632         Add support for a "[" that conforms to the GNU coding standards,
7633         i.e., that does not depend on its name.
7634         * src/lbracket.c: New file.
7635         * README: Add "[".
7636         * man/Makefile.am (programs): Ignore "[", since it doesn't have
7637         a separate man page.
7638         * src/Makefile.am (bin_PROGRAMS): Add "[".
7639         (__SOURCES): New var.
7640         * src/test.c (LBRACKET): Define to 0 if not defined.
7641         (main): Use LBRACKET rather than argv[0].
7642
7643         * src/test.c (one_argument): Do not check for -t if POSIXLY_CORRECT.
7644         Reported by Paul Jarc and Dan Jacobson.
7645
7646         * src/test.c (main): Do not recognize --help or --version if
7647         POSIXLY_CORRECT, when invoked as "test".  Handle "[ ]" correctly.
7648         Do not bother testing that margv[margc] is non-null.
7649
7650 2003-07-04  Jim Meyering  <jim@meyering.net>
7651
7652         * src/who.c (print_line): Rewrite to use asprintf, in order to be
7653         able to avoid emitting trailing spaces.  Reported by Dan Jacobson.
7654
7655         * tests/misc/head-elide-tail: Add tests of head's new --lines=-N
7656         option, and perform the +1600 invocations of head IFF the envvar
7657         RUN_EXPENSIVE_TESTS is set.
7658
7659 2003-07-03  Jim Meyering  <jim@meyering.net>
7660
7661         * src/cp.c (do_copy): Give a better diagnostic when failing due
7662         to nonexistent destination directory.  Reported by Dmitry Rutsky.
7663         See http://bugs.debian.org/199730 for details.
7664
7665 2003-06-27  Jim Meyering  <jim@meyering.net>
7666
7667         split's --verbose option did nothing [broken in 4.5.10 and 5.0]
7668         * src/split.c (longopts): Use `1', not `0' as the value for
7669         for &verbose.  Reported by Keith Thompson.
7670
7671         Test for the above fix.
7672         * tests/misc/split-a: Also use --verbose and compare stderr
7673         output with what we'd expect.
7674
7675 2003-06-20  Jim Meyering  <jim@meyering.net>
7676
7677         * src/copy.c (copy_internal) [HAVE_STRUCT_STAT_ST_AUTHOR]:
7678         Use `error_t' (rather than int) as type for local `err'.
7679         From Alfred M. Szmidt.
7680
7681 2003-06-19  Marcus Brinkmann  <marcus@gnu.org>
7682
7683         * src/copy.c (copy_internal) [HAVE_STRUCT_STAT_ST_AUTHOR]:
7684         Fix author preservation code.
7685
7686 2003-06-19  Jim Meyering  <jim@meyering.net>
7687
7688         * src/ln.c (ENABLE_HARD_LINK_TO_SYMLINK_WARNING): Define to 0.
7689         (do_link): Don't warn about hard link to symlink.
7690
7691 2003-06-18  Jim Meyering  <jim@meyering.net>
7692
7693         * src/cut.c: Include "getdelim2.h", not "getstr.h".
7694         Reflect renaming: getstr -> getdelim2.
7695
7696         * src/comm.c, src/join.c, src/nl.c, src/uniq.c: Reflect renaming:
7697         readline -> readlinebuffer.
7698
7699 2003-06-09  John David Anglin  <dave.anglin@nrc-cnrc.gc.ca>
7700
7701         * src/readlink.c: Include <sys/types.h> before system.h (because
7702         the latter includes <sys/stat.h>).  Required on Ultrix 4.3.
7703
7704 2003-06-17  Jim Meyering  <jim@meyering.net>
7705
7706         * src/system.h (initialize_main): Define.
7707         Use it in every `main'.  Applied via this:
7708         p='initialize_main (&argc, &argv);'
7709         perl -ni -e '/program_name.=.argv.0/ and print "  '"$p"'\n"; print' \
7710           $(grep -l program_name.=.argv.0 *.c)
7711         test.c uses margc/margv, so I made the change manually for that file.
7712         Based on a patch from Bernard Giroud.
7713
7714 2003-06-09  John David Anglin  <dave.anglin@nrc-cnrc.gc.ca>
7715
7716         Fix for build failure on Ultrix 4.3.
7717         * src/stat.c: Include sys/statvfs.h in preference to sys/vfs.h.
7718         Include sys/param.h and sys/mount.h on ultrix.
7719
7720 2003-06-16  Jim Meyering  <jim@meyering.net>
7721
7722         * src/touch.c (O_NDELAY, O_NONBLOCK, O_NOCTTY, EISDIR): Remove
7723         definitions.
7724         * src/system.h (O_NDELAY, O_NONBLOCK, O_NOCTTY, EISDIR): Define
7725         them here instead, but with one change: define EISDIR to -1, not 0.
7726
7727         * src/cat.c (cat): Remove `#ifndef ENOSYS', now that it's
7728         guaranteed to be defined.
7729         * src/system.h (ENOSYS, ENOTSUP): Define to -1 if not defined.
7730
7731         * README: Mention the CVS repository.
7732         Encourage addition of test cases.
7733
7734 2003-06-12  Jim Meyering  <jim@meyering.net>
7735
7736         * src/touch.c (touch): Call close only if necessary.
7737         From Bruno Haible.
7738
7739         * src/wc.c (usage): Correct wording: wc prints counts in the order
7740         `newline, word, byte'.  Reported by Keith M. Briggs.
7741         * man/wc.x: Fix it here, too.  And change `lines' to `newlines'.
7742
7743 2003-06-10  Jim Meyering  <jim@meyering.net>
7744
7745         * tests/date/Test.pm: Add a test for the new format, e.g., May-23-2003.
7746
7747 2003-06-07  Jim Meyering  <jim@meyering.net>
7748
7749         * Makefile.maint (syntax-check): Add commented-out (over-aggressive)
7750         rule.
7751
7752 2003-06-06  Jim Meyering  <jim@meyering.net>
7753
7754         * src/extract-magic (main): Avoid newer 3-arg form of open,
7755         so this script works also with e.g., perl5.005_03.
7756         Patch by John David Anglin.
7757
7758 2003-06-04  Paul Eggert  <eggert@twinsun.com>
7759
7760         * src/system.h: Include <stdbool.h> unconditionally.
7761
7762 2003-06-04  Jim Meyering  <jim@meyering.net>
7763
7764         * man/Makefile.am (check-programs-vs-x): Rename target
7765         from check-programs-vs-1.  Adjust rule to check for the
7766         primary (.x) file, not the generated one (.1).
7767
7768 2003-06-03  Tim Mooney <mooney@dogbert.cc.ndsu.NoDak.edu>
7769
7770         * man/kill.x: New file.
7771         * man/Makefile.am (dist_man_MANS): Add kill.1.
7772         (kill.1): New rule.
7773
7774 2003-06-04  Jim Meyering  <jim@meyering.net>
7775
7776         Ensure that the .x file for a new program is never forgotten again.
7777         * man/Makefile.am (programs): Define.
7778         (check-programs-vs-1): New phony target.
7779         (check-local): Depend on it.
7780
7781 2003-06-03  Jim Meyering  <jim@meyering.net>
7782
7783         Avoid unnecessary copying of environment.
7784         * src/env.c (main): Rather than clearing the environment and --
7785         unless told to ignore environment -- copying all settings from
7786         the saved, original environment, clear the environment only when
7787         that is requested.  Suggested by Jens Elkner.
7788
7789 2003-06-02  Jim Meyering  <jim@meyering.net>
7790
7791         * src/system.h: Always include <string.h>, since we assume C89.
7792         Include <limits.h> without checking for HAVE_LIMITS_H.
7793
7794         * src/test.c [!TEST_STANDALONE]: Remove #if-0'd block.
7795         (STREQ, S_IXUGO): Remove redundant (in system.h) definitions.
7796
7797 2003-06-01  Jim Meyering  <jim@meyering.net>
7798
7799         Avoid a race condition in `tail -f' described by Ken Raeburn in
7800         http://mail.gnu.org/archive/html/bug-textutils/2003-05/msg00007.html
7801         * src/tail.c (file_lines): Add new parameter, *read_pos, and set it.
7802         (pipe_lines, pipe_bytes, start_bytes, start_lines): Likewise.
7803         (tail_bytes, tail_lines, tail): Likewise.
7804         (tail_file): Use the new `read_pos' value as the size,
7805         rather than stats.st_size from the fstat call.
7806
7807 2003-05-28  Jim Meyering  <jim@meyering.net>
7808
7809         * src/extract-magic: Allow expansion of `$file' in the here-
7810         document corresponding to the comment at the top of fs.h.
7811
7812 2003-05-26  Jim Meyering  <jim@meyering.net>
7813
7814         * src/stat.c: Fix portability problem on FreeBSD5.0: don't include
7815         <sys/statvfs.h> on systems without HAVE_STRUCT_STATVFS_F_BASETYPE.
7816         Use #if/#elif/... cascade so we get only one set of include files.
7817         Reported by Nelson Beebe.
7818
7819 2003-05-24  Jim Meyering  <jim@meyering.net>
7820
7821         * src/md5sum.c (split_3): Accept the BSD format only when in MD5 mode.
7822         * tests/sha1sum/basic-1: Make sure `sha1sum --check' doesn't
7823         accept the BSD format.
7824
7825 2003-03-28  Joe Orton  <jorton@redhat.com>
7826
7827         * src/md5sum.c (bsd_split_3): New function.
7828         (split_3): Detect checksums from BSD 'md5' command and handle them
7829         using bsd_split_3.
7830
7831         * tests/md5sum/basic-1: New tests for --check exit status, and for
7832         BSD-style checksum files.
7833
7834 2003-05-21  Jim Meyering  <jim@meyering.net>
7835
7836         * src/head.c (elide_tail_lines_pipe): Fix a thinko.
7837         This sort of thing is why it'd be *Really Good* to factor
7838         out the common code used here and in tail.c.
7839
7840 2003-05-14  Jim Meyering  <jim@meyering.net>
7841
7842         * src/head.c (usage): Document new feature: --bytes=-N and --lines=-N.
7843
7844         * tests/du/slink: Skip this test if `.' is on an XFS file system.
7845
7846         * tests/du/fd-leak: New file.  Test for the bug in du that
7847         was fixed by the 2003-05-12 change to lib/ftw.c.
7848         * tests/du/Makefile.am (TESTS): Add fd-leak.
7849
7850         * src/head.c (AUTHORS): Enclose string in N_(...), now that it
7851         includes a translatable word, `and'.
7852
7853         * src/dd.c (usage): Don't use `,' as the thousands separator
7854         in e.g. 1,000,000 and 1,048,576.  Instead, do this:
7855         `SIZE may be ..., MB 1000*1000, M 1024*1024 and so on...'
7856         * src/df.c (usage): Likewise.
7857         * src/du.c (usage): Likewise.
7858         * src/ls.c (usage): Likewise.
7859
7860         * Makefile.maint (syntax-check): Add another check.
7861
7862 2003-05-13  Paul Eggert  <eggert@twinsun.com>
7863
7864         Fix uniq to conform to POSIX, which requires that "uniq -d -u"
7865         must output nothing.  Problem reported by Josh Hyman.
7866
7867         * src/uniq.c (enum output_mode, mode): Remove, replacing with:
7868         (output_unique, output_first_repeated, output_later_repeated):
7869         New vars.  All uses of "mode" changed to use these variables,
7870         which are not mutually exclusive as "mode" was.
7871         (writeline): New arg "match", used to control whether to
7872         obey output_first_repeated or output_later_repeated.
7873         All callers changed.
7874         (check_file, main): Adjust to above changes.
7875
7876         * tests/uniq/Test.pm: Test that 'uniq -d -u' outputs nothing.
7877
7878 2003-05-14  Jim Meyering  <jim@meyering.net>
7879
7880         * tests/rm/rm3: Use tr's \n notation rather than \012.
7881         This package can afford to do that, since its tests are guaranteed use
7882         GNU tr, which has accepted the more modern notation for 10 years.
7883         * tests/rm/rm5: Likewise.
7884         * tests/cp/same-file: Likewise.
7885         * tests/stty/row-col-1: Likewise.
7886         * tests/stty/basic-1: Likewise.
7887         * tests/rm/deep-1: Likewise.
7888         * tests/mv/part-symlink: Likewise.
7889         * tests/mkdir/perm: Likewise.
7890         * tests/misc/nice: Likewise.
7891
7892 2003-05-13  Jim Meyering  <jim@meyering.net>
7893
7894         * src/copy.c (struct F_triple) [name]: Remove const attribute.
7895         (triple_free): Don't apply cast to argument of free.
7896         (seen_file): Add cast here instead.
7897
7898         * src/cp-hash.c (struct Src_to_dest) [name]: Remove const attribute.
7899         (src_to_dest_free): Don't apply cast to argument of free.
7900
7901         * src/sort.c (zaptemp): Don't apply cast to argument of free.
7902         * src/pr.c (init_fps, init_store_cols): Likewise.
7903         * src/join.c (delseq, freeline): Likewise.
7904         * src/expr.c (OLD): Likewise.
7905         * src/sort.c (sort): Likewise.
7906         * src/head.c (elide_tail_lines_pipe): Likewise.
7907
7908         * src/tail.c: Include "quote.h".
7909         Use quote in diagnostics.  Change many error format strings
7910         from just `%s' to e.g., `error reading %s'.
7911         (pipe_lines): Change type of parameter, n_lines, to uintmax_t.
7912         Rewrite newline-counting loop to use memchr.
7913
7914         * src/head.c (elide_tail_lines_pipe): Use `if', not assert.
7915         Now that assert is no longer used, don't include <assert.h>.
7916
7917 2003-05-12  Jim Meyering  <jim@meyering.net>
7918
7919         * src/head.c: Include <assert.h>.
7920         (AUTHORS): Add my name.
7921         (elide_tail_lines_pipe): New function.
7922
7923 2003-05-10  Jim Meyering  <jim@meyering.net>
7924
7925         * Makefile.maint (syntax-check): Check for `error (EXIT_SUCCESS,'.
7926
7927         * src/readlink.c (main): Set program_name before first use.
7928         Remove that (redundant) first use.
7929         Don't exit successfully just because --verbose was specified.
7930         Pass 0, not EXIT_SUCCESS, as first argument to error; when that
7931         parameter is 0, error does not exit.
7932
7933         * src/uname.c (main): When failing due to too many arguments, also say
7934         that, rather than just "Try `uname --help' for more information.".
7935         * src/comm.c (main): Likewise, but for too few arguments.
7936         * src/logname.c: Include error.h.
7937         (main): Say why we're failing.
7938
7939         * src/uniq.c (main): Don't segfault when argc < optind.
7940         * src/who.c (main): Handle argc < optind.
7941         * src/df.c (main): Likewise.
7942         * src/install.c (main): Likewise.
7943         * src/mv.c (main): Likewise.
7944         * src/pwd.c (main): Likewise.
7945         * src/tty.c (main): Likewise.
7946         * src/chroot.c (main): Likewise.
7947         * src/hostname.c: Likewise.
7948         * src/du.c (main): Likewise.
7949         * src/expand.c (main): Likewise.
7950         * src/env.c (main): Likewise.
7951         * src/unexpand.c (main): Likewise.
7952         * src/printenv.c (main): Likewise.
7953         * src/sync.c (main): Handle argc == 0.
7954         * src/expr.c (main): Likewise.
7955         * src/printf.c (main): Likewise.
7956         * src/basename.c (main): Likewise.
7957         * src/ln.c (main): Test for `missing argument' before computing n_files.
7958         * src/tail.c (main): Test for the case of no arguments before
7959         computing n_files.
7960
7961         * src/kill.c (send_signals): Don't check command line arguments here.
7962         (main): Check them here instead.  Handle argc < optind.
7963
7964         * src/logname.c (main): Use error, rather than fprintf, for the sake
7965         of consistency.
7966
7967         * src/rm.c (main): Don't overrun array bound if argc is 0.
7968
7969 2003-05-09  Jim Meyering  <jim@meyering.net>
7970
7971         * src/sort.c (main): Don't overrun array bound if argc is 0.
7972         That would happen when invoked via: execl ("/usr/bin/sort", NULL);
7973         Reported by Wartan Hachaturow.
7974
7975 2003-05-07  Jim Meyering  <jim@meyering.net>
7976
7977         Implement support so that `head --lines=-N' works on seekable files.
7978         * src/head.c (enum Copy_fd_status): Define.
7979         (COPY_FD_DIAGNOSE): New macro.
7980         (elide_tail_lines_seekable): New funtion.
7981         (elide_tail_lines_file): Call it here.
7982
7983 2003-05-06  Jim Meyering  <jim@meyering.net>
7984
7985         * src/sys2.h (CHAR_BIT): Remove duplicate definition.
7986
7987 2003-05-04  Jim Meyering  <jim@meyering.net>
7988
7989         * tests/head/Test.pm: Remove tests of --bytes=-N; using that framework
7990         caused the addition of thousands of small files to the tar archive.
7991         * tests/misc/head-elide-tail: New file.  Add them here instead.
7992         * tests/misc/Makefile.am (TESTS): Add head-elide-tail.
7993
7994 2003-05-04  Paul Eggert  <eggert@twinsun.com>
7995
7996         * src/remove.c (HAVE_WORKING_READDIR): Define to 0 if not defined.
7997         (IF_READDIR_NEEDS_REWINDDIR): Remove.
7998         (remove_cwd_entries): Rewrite to avoid IF_READDIR_NEEDS_REWINDDIR,
7999         which was a bit weird because it couldn't be emulated by a function.
8000
8001 2003-05-03  Jim Meyering  <jim@meyering.net>
8002
8003         Extend head to accept --lines=-N (--bytes=-N) and to print all
8004         but the N lines (bytes) at the end of the file.
8005         * src/head.c: Include full-write.h, full-read.h, inttostr.h, quote.h.
8006         Use quote() in diagnostics, rather than literal `' marks.
8007         (copy_fd, elide_tail_bytes_pipe, elide_tail_bytes_file):
8008         New functions.
8009         (elide_tail_lines_pipe, elide_tail_lines_file): New functions.
8010         (head_file): Reorganize so as to call head from only one place.
8011         (main): Likewise, for head_file.
8012         Handle new, undocumented option, --presume-input-pipe.
8013         Handle negative line and byte counts.
8014         * tests/head/Test.pm: Add lots of tests to exercise --bytes=-N.
8015
8016         * tests/du/8gb: Skip test if the file system of `.' doesn't support
8017         sparse files -- otherwise it'd create a file of size 8GB.
8018
8019 2003-05-02  Jim Meyering  <jim@meyering.net>
8020
8021         * src/fmt.c (usage): Don't mention obsolescent -WIDTH option.
8022         Instead explain about `-' and standard input.
8023         (main): Give a proper diagnostic for e.g., `fmt -c -72'.
8024         Reported by Keith Thompson.
8025         * tests/fmt/basic: Add test for the above fix.
8026
8027         * src/fmt.c: Include "quote.h".
8028         Use quote() in diagnostics, rather than literal `' marks.
8029         (main): Exit nonzero when unable to open an input file.
8030         * tests/fmt/basic: Add test for the above fix.
8031
8032         * src/fmt.c (main): Diagnose invalid suffix on obsolescent width
8033         specifications like `-72x'.
8034         * tests/fmt/basic: Add test for the above fix.
8035
8036         Work around nasty readdir bug on Darwin6.5.
8037         * src/remove.c (IF_READDIR_NEEDS_REWINDDIR): Define.
8038         [! HAVE_WORKING_READDIR] (remove_cwd_entries): If readdir has just
8039         returned NULL and there has been at least one successful unlink or
8040         rmdir call since the opendir or previous rewinddir, then call
8041         rewinddir and reiterate the loop.
8042
8043         Factor out common code.
8044         * src/remove.c (readdir_ignoring_dotdirs): New function.
8045         (is_empty_dir): Use it here.
8046         (remove_cwd_entries): Use it here.
8047
8048 2003-05-01  Jim Meyering  <jim@meyering.net>
8049
8050         * tests/rm/r-3: Create 500 rather than just 300 files.
8051         There's a bug in Darwin6.5's readdir that shows up only with
8052         338 or more files.
8053         Fix a bug in this test: `cd $pwd' (not to `..'), now that $tmp
8054         has two components.
8055
8056         * src/tail.c:
8057         Change type of n_units, n_bytes, n_lines to be `uintmax_t'.
8058         (dump_remainder): Move two declarations `down' into the scope
8059         where they are used.
8060         (xlseek): Return the resulting offset.
8061         (file_lines): Rename parameter, file_length, to end_pos.
8062         (pipe_lines): Don't coerce safe_read return value to `int'.
8063         Adapt tests accordingly.
8064         (pipe_bytes) [struct charbuffer] (nbytes): Change type from `int'
8065         to `unsigned int'.
8066         Change type of `total_bytes' from `int' to `size_t',
8067         since the former wouldn't always be wide enough.
8068         Don't coerce safe_read return value to `int',
8069         and adapt tests accordingly.
8070         Now that testing for a read error no longer involves
8071         using `tmp', handle that case *after* freeing `tmp'.
8072         (start_bytes): Clean up.
8073         (tail_bytes): Now that `n_bytes' may be larger than
8074         OFF_T_MAX, test for that condition and, if it's true, don't
8075         use lseek optimizations.
8076         (parse_options): Don't fail just because N_UNITS is larger than
8077         the maximum size of a file -- tail may be applied to an input
8078         stream (e.g., a pipe) with more data than that.
8079
8080         * Makefile.maint (syntax-check): Rename from alloc-check.
8081         Also check for SPACE-TAB sequences.
8082         Also check for malloc/calloc/realloc casts.
8083
8084 2003-05-01  Jim Meyering  <jim@meyering.net>
8085
8086         * src/tail.c (start_lines): Rewrite to use memchr.  Clean up.
8087
8088 2003-04-28  Jim Meyering  <jim@meyering.net>
8089
8090         * tests/misc/tty-eof: Send two tokens, not just one, so we don't
8091         make the now-more-picky tsort fail.
8092
8093 2003-04-24  Jim Meyering  <jim@meyering.net>
8094
8095         * src/tsort.c (tsort): Remove unnecessary test of have_read_stdin.
8096         (main): Minor syntactic clean-up.
8097
8098         * src/tsort.c (tsort): Fail if the input contains an odd number of
8099         tokens.  Reported by junkio@cox.net.
8100
8101         * tests/tsort/basic-1: Test for the above fix.
8102
8103 2003-04-21  Jim Meyering  <jim@meyering.net>
8104
8105         * tests/misc/printf: Add tests for the printf fixes below.
8106
8107         * Makefile.cfg (cvs_files): Add $(srcdir)/config/depcomp to the list.
8108
8109 2003-04-20  Paul Eggert  <eggert@twinsun.com>
8110
8111         Fix printf POSIX compatibility bug reported by Ben Harris in
8112         <http://mail.gnu.org/archive/html/bug-coreutils/2003-04/msg00070.html>.
8113         * doc/coreutils.texi (printf invocation): It's \NNN in the format,
8114         \0NNN in the %b operand.
8115         * src/printf.c (usage): Likewise.
8116         (print_esc): New arg OCTAL0 to specify whether \0NNN or \NNN
8117         is desired.  All uses changed.  Behave like Bash printf if %b
8118         operand uses \NNN where the initial N is not 0.
8119
8120 2003-04-17  Jim Meyering  <jim@meyering.net>
8121
8122         * src/stty.c: Remove uses of PROTOTYPE macro.
8123
8124 2003-04-15  Jim Meyering  <jim@meyering.net>
8125
8126         * Makefile.maint: Remove (or replace-with-TAB(s) to retain alignment)
8127         each sequence of spaces before a TAB character.
8128
8129 2003-04-13  Jim Meyering  <jim@meyering.net>
8130
8131         * src/remove.c (is_empty_dir): Don't closedir (NULL).
8132
8133 2003-04-12  Jim Meyering  <jim@meyering.net>
8134
8135         Giving nl an invalid STYLE argument (in --header-numbering=STYLE (-h),
8136         --body-numbering=STYLE (-b), or --footer-numbering=STYLE (-f)) or
8137         FORMAT (--number-format=FORMAT (-n)) would not give a useful diagnostic.
8138         * src/nl.c (main): Fix those problems and remove literal quote marks
8139         (e.g., "`%s'") from format string; instead use "%s" in each format
8140         string and `quote (optarg)' as the corresponding argument.
8141         Also, diagnose all invalid command line options before failing.
8142
8143         * src/nl.c (proc_text): Fix a bug that would make nl output extra
8144         newlines in some cases.  Details here: http://bugs.debian.org/177256.
8145         This bug was introduced on 2001-11-10 for textutils-2.0.17.
8146         * tests/misc/nl: Add test for the above-fixed bug.
8147
8148         * tests/misc/readlink: New file.  Test the --canonicalize option.
8149         * tests/misc/Makefile.am (TESTS): Add readlink.
8150
8151 2003-04-11  Jim Meyering  <jim@meyering.net>
8152
8153         Clean up.
8154         * src/chown.c, src/cp.c, src/dircolors.hin, src/du.c, src/ln.c:
8155         * src/mkfifo.c, src/ptx.c, src/spline.c, src/stty.c, src/tail.c:
8156         * src/test.c, src/unexpand.c: Remove (or replace-with-TAB(s) to
8157         retain alignment) each sequence of spaces before a TAB character.
8158
8159         * src/ls.c: Include <stdlib.h> unconditionally.
8160
8161         * Makefile.maint (xalloc-check): Rename from header-check.
8162
8163         * src/yes.c: Include error.h after system.h, not before.
8164
8165         Clean up.
8166         * src/copy.c, src/cp-hash.c, src/cp.c, src/csplit.c, src/cut.c:
8167         * src/date.c, src/df.c, src/du.c, src/expand.c, src/expr.c, src/id.c:
8168         * src/join.c, src/md5sum.c, src/nl.c, src/od.c, src/paste.c, src/pr.c:
8169         * src/ptx.c, src/sort.c, src/split.c, src/su.c, src/tail.c, src/tee.c:
8170         * src/tr.c: * src/unexpand.c, src/users.c:
8171         Remove anachronistic casts of xmalloc, xrealloc, and xcalloc
8172         return values and of xrealloc's first argument.
8173         Fix the former with this:
8174         perl -pi -e 's/\([^(]*?\*\) *(x(m|c|re)alloc)\b/$1/'
8175
8176 2003-04-10  Jim Meyering  <jim@meyering.net>
8177
8178         * src/stty.c (wrapf): Declare with format attribute.
8179
8180         The S_MAGIC_... names shouldn't be maintained in two places (prior
8181         to this change, one would have to keep stat.c and fs.h in sync).
8182         This change makes it so those names and the corresponding
8183         hexadecimal constants all reside in stat.c.  fs.h is now generated.
8184         * src/Makefile.am (fs.h): New rule to generate fs.h from stat.c.
8185         (BUILT_SOURCES): Add fs.h, now that it's generated.
8186         (EXTRA_DIST): Add extract-magic.
8187         * src/extract-magic: New script to extract fs.h definitions from stat.c.
8188         * src/stat.c (human_fstype) [__linux__]: Append each hex constant from
8189         fs.h in a comment after the corresponding `case S_MAGIC_...:' statement.
8190
8191         * tests/tail-2/big-4gb: Skip this test (don't fail) if creating a
8192         file with nominal length > 4GB fails.  Reported by Michael Deutschmann.
8193
8194         * man/unexpand.x: Add `SEE ALSO' reference to expand.
8195         * man/expand.x: Add `SEE ALSO' reference to unexpand.
8196         Suggestion from Dan Jacobson.
8197
8198 2003-04-10  Maciej W. Rozycki  <macro@ds2.pg.gda.pl>
8199
8200         * src/fs.h (S_MAGIC_DEVPTS): New magic for Linux's devpts.
8201         * src/stat.c (human_fstype): Handle Linux's devpts.
8202
8203 2003-04-09  Paul Eggert  <eggert@twinsun.com>
8204
8205         * src/split.c (line_bytes_split): Arg is of type size_t, since
8206         that's all that is supported for now.
8207         (main): Check for overflow in obsolescent line count option.
8208
8209 2003-04-09  Jim Meyering  <jim@meyering.net>
8210
8211         * tests/misc/split-fail: Add a new test for the above fix.
8212
8213         * src/split.c (bytes_split): Use size_t temporary (rather than
8214         uintmax_t original) in remaining computations.  From Paul Eggert.
8215
8216         Handle command line option arguments larger than 2^31.
8217         This allows e.g., splitting into files of size 2GB and larger,
8218         and running split --lines=N with N=2^31 or more.
8219         But for --line-bytes=N, the restriction that N <= SIZE_MAX
8220         remains (for now), due to the way it is implemented.
8221
8222         * src/split.c: Include "inttostr.h".
8223         (bytes_split, lines_split, line_bytes_split, main):
8224         Use uintmax_t, not size_t, for file sizes.
8225         (main): Give a better diagnostic for option arguments == 0.
8226         Use umaxtostr to print file sizes.
8227         Reported by Luke Hassell.
8228
8229 2003-04-08  Jim Meyering  <jim@meyering.net>
8230
8231         * src/rm.c (usage): Mention that --directory (-d) works only
8232         on some systems.  Suggestion from Samuel Tardieu.
8233
8234         * tests/basename/basic: Run $PERL to see if it is available,
8235         rather than testing its value.
8236         * tests/sum/sysv, tests/tsort/basic-1, tests/unexpand/basic-1:
8237         * tests/basename/basic, tests/dd/skip-seek, tests/dircolors/simple:
8238         * tests/expr/basic, tests/factor/basic, tests/fmt/basic:
8239         * tests/ls-2/tests, tests/md5sum/basic-1, tests/md5sum/newline-1:
8240         * tests/misc/sort, tests/misc/tty-eof, tests/mv/i-1:
8241         * tests/rm/empty-name, tests/rm/fail-eperm, tests/rm/unreadable:
8242         * tests/seq/basic, tests/sha1sum/basic-1, tests/sha1sum/sample-vec:
8243         * tests/sum/basic-1, tests/seq/basic: Likewise.
8244
8245         * tests/misc/Makefile.am (TESTS): Add split-fail.
8246         * tests/misc/split-fail: New file.
8247
8248         * src/split.c: Rename local variables: nchars -> n_bytes.
8249         (lines_split): Rename local, nlines -> n_lines.
8250         (main): Rename local variable: s/accum/n_units/.
8251         (main): Use STDIN_FILENO, not literal `0'.
8252
8253 2003-04-07  Jim Meyering  <jim@meyering.net>
8254
8255         * src/stat.c: Add #include directives for Ultrix 4.4.
8256         Based on a suggested change from Bert Deknuydt.
8257
8258 2003-04-06  Jim Meyering  <jim@meyering.net>
8259
8260         * Makefile.maint (makefile-check): New rule.
8261         (local-check): Add it.
8262
8263 2003-04-05  Jim Meyering  <jim@meyering.net>
8264
8265         * Makefile.am (nearly all of them):
8266         Use $(VAR) rather than @VAR@, now that we can rely on automake to
8267         emit a definition for each substituted variable.
8268         * tests/Makefile.am.in: Likewise.
8269
8270         * tests/rm/rm5: Add a comment explaining why this test fails when
8271         using Tru64's broken sed.
8272         * tests/rm/rm3: Likewise.
8273
8274         Make `kill -t' output signal descriptions (not `?') on Tru64.
8275         * src/kill.c (sys_siglist): Also check for __sys_siglist.
8276         Patch by Tony Leneis.
8277         * configure.ac: Also check for declaration of __sys_siglist.
8278         Required for Tru64 4.0D, 4.0F, and 5.1.
8279         Reported by Tony Leneis.
8280
8281 2003-04-04  Jim Meyering  <jim@meyering.net>
8282
8283         * src/Makefile.am (PERL): Remove unnecessary definition.
8284
8285         Because of inappropriate (but POSIX-mandated) behavior of rename,
8286         `mv a b' would not remove `a' in some unusual cases.  Work around
8287         this by unlinking `a' when necessary.
8288
8289         * src/copy.c (same_file_ok): Add an output parameter.
8290         Set it in the offending case.
8291         (copy_internal): When necessary, unlink SRC_PATH and inform caller.
8292         Reported by Ed Avis.
8293         * tests/mv/hard-4: New test for the above.
8294         * tests/mv/Makefile.am (TESTS): Add hard-4.
8295
8296         Clean up rules for automatically generated sources:
8297         * src/Makefile.am (dircolors.h, wheel-size.h, wheel.h, false.c):
8298         Make each generated file be read-only.
8299         Add each file name to BUILT_SOURCES separately.
8300         (MAINTAINERCLEANFILES): Set to $(BUILT_SOURCES).
8301
8302         Put LOCALEDIR macro definition in new file: localedir.h.
8303         * src/Makefile.am (DEFS): Remove definition.
8304         (localedir.h): New rule.
8305         (BUILT_SOURCES, DISTCLEANFILES): Add localedir.h.
8306         * src/system.h: Include "localedir.h".
8307
8308 2003-04-02  Jim Meyering  <jim@meyering.net>
8309
8310         * Version 5.0.
8311
8312         * tests/misc/Makefile.am (TESTS): Add false.
8313
8314         * Makefile.maint (TMPDIR): Make sure it's defined.
8315         (my-distcheck): Build in $(TMPDIR), not `.'.
8316
8317         * src/Makefile.am (false.c): Change all occurrences of
8318         `(EXIT_SUCCESS)' to `(EXIT_FAILURE)' so that false exits
8319         unsuccessfully also with --help.  Reported by Paul Jarc,
8320         * tests/misc/false: New test for the above.
8321
8322 2003-03-30  Jim Meyering  <jim@meyering.net>
8323
8324         * NEWS: Note the location of older NEWS files.
8325
8326         * src/remove.c (is_empty_dir): Don't let a failing closedir
8327         clobber errno.  Spotted by Arnold Robbins.
8328
8329         * src/env.c: Fix typo in comment.  From Arnold Robbins.
8330
8331 2003-03-29  Jim Meyering  <jim@meyering.net>
8332
8333         * Version 4.5.12.
8334
8335         * README: Note to expect build problems for stat.c on Ultrix 4.3.
8336         Note that there are some harmless test failures when running
8337         `make check' as root on some systems.
8338
8339 2003-03-28  Jim Meyering  <jim@meyering.net>
8340
8341         * tests/stty/row-col-1: Skip this test if stty can't get window size.
8342         This happens when connecting to sparc-solaris5.7 via ssh from within
8343         emacs.  Reported by Karl Berry.
8344
8345         * tests/du/basic: Use seq, not `yes' to generate 4KB of data.
8346         Otherwise, on systems (DJGPP) that emulate pipes using files,
8347         this test would never complete, waiting for `yes' to terminate.
8348         * tests/du/slink: As above, use seq, not `yes' to generate link target.
8349         * tests/rm/hash: As above, use seq, not `yes' to generate dir name.
8350         Reported by Rich Dawe.
8351
8352 2003-03-27  Jim Meyering  <jim@meyering.net>
8353
8354         * src/id.c: Remove Arnold Robbins' obsolete e-mail address
8355         from `written by...' comment, at his request.
8356
8357 2003-03-24  Paul Eggert  <eggert@twinsun.com>
8358
8359         Fix buffer overrun problem reported by TAKAI Kousuke, along
8360         with some other POSIX incompatibilities.
8361
8362         * src/printf.c (print_esc): Do not treat \x specially if
8363         POSIXLY_CORRECT.  Avoid buffer overrun if the format ends
8364         in backslash.  Treat incomplete escape sequences as strings
8365         of characters, as POSIX requires.
8366         (print_formatted): Allow multiple flags.  Avoid buffer overrun
8367         if the format is incomplete.
8368
8369 2003-03-24  Jim Meyering  <jim@meyering.net>
8370
8371         * tests/misc/printf: Add tests for the above fixes and changes.
8372
8373 2003-03-26  Jim Meyering  <jim@meyering.net>
8374
8375         * src/copy.h (struct cp_options): Add a comment.
8376
8377 2003-03-23  Jim Meyering  <jim@meyering.net>
8378
8379         * README: Describe problem with 64-bit mode on HPUX 11.x,
8380         with patch for /usr/include/inttypes.h.
8381         * TODO: Plan to add an autoconf test to work around the bug.
8382
8383 2003-03-22  Jim Meyering  <jim@meyering.net>
8384
8385         * src/stat.c: Don't include <sys/sysmacros.h>.
8386         That is already done via system.h.  Otherwise, the multiple
8387         inclusion would evoke redefinition warnings from Cray's /bin/cc,
8388         aka Cray Standard C Version 4.0.3  (057126) Mar 22 2003  22:02:28.
8389         (human_fstype): Factor some directives `up', out of this function.
8390         Cast away `const' to avoid error from Cray's /bin/cc.
8391
8392 2003-03-20  Jim Meyering  <jim@meyering.net>
8393
8394         * announce-gen (print_changelog_deltas): Ensure that a newline
8395         precedes each row of `*'s.
8396
8397 2003-03-20  Jim Meyering  <jim@meyering.net>
8398
8399         * Version 4.5.11.
8400
8401         * src/seq.c (valid_format): Also accept ` ' and `'' as valid
8402         format flag characters.
8403         Do not require that a field width be specified.
8404         Do not fail when given a field width of `0'.
8405         Reported by Dan Jacobson.
8406         * tests/seq/basic: Add new tests for the above-fixed bug.
8407
8408         * src/Makefile.am (all-local): Append $(EXEEXT) to use of `su'
8409         (install-root): Likewise.
8410         (install-exec-local): Likewise.
8411         Based on a patch from Richard Dawe.
8412
8413 2003-03-19  Jim Meyering  <jim@meyering.net>
8414
8415         * man/Makefile.am (.x.1): Use $(LN_S) instead of 'ln -s',
8416         because the DJGPP 2.03 port of 'ln -s' doesn't work.
8417         Include $(EXEEXT) in program names.
8418         Since $(LN_S) may degenerate to `cp -p', be careful
8419         to invoke it from the destination directory.
8420         Mostly from Richard Dawe.
8421         * configure.ac: Use AC_PROG_LN_S.
8422
8423         * tests/mv/part-symlink: Unset CDPATH.  Otherwise, having the
8424         CDPATH shell variable set could cause this test to fail.
8425         Reported by Karl Berry.
8426
8427 2003-03-18  Jim Meyering  <jim@meyering.net>
8428
8429         * src/fmt.c [struct Word] (paren, period, punct, final): Change the
8430         type of each member from bool <MEMBER>:1 to unsigned int <MEMBER>:1.
8431         AIX 5.1's xlc could not compile the former.
8432         Patch by Petter Reinholdtsen.  Also reported by Mike Jetzer.
8433
8434 2003-03-17  Richard Dawe  <rich@phekda.freeserve.co.uk>
8435
8436         * configure.ac: Include $(EXEEXT) in OPTIONAL_BIN_PROGS'
8437         program names, since automake only adds $(EXEEXT) to programs
8438         in its *_PROGRAMS.
8439
8440 2003-03-16  Jim Meyering  <jim@meyering.net>
8441
8442         * src/remove.c (rm): Put two local variables in static storage,
8443         so they can't be clobbered by the potential longjmp.
8444
8445 2003-03-15  Jim Meyering  <jim@meyering.net>
8446
8447         * Makefile.cfg (gnu_rel_host): Fix code to match the comment
8448         so that a version number with a two-digit component can still count
8449         as an alpha release.  Reported by Richard A Downing.
8450         (gnu_rel_host): Define in terms of $(RELEASE_TYPE) instead.
8451
8452 2003-03-14  Jim Meyering  <jim@meyering.net>
8453
8454         * src/ansi2knr.c: Remove no-longer-used file.
8455         * src/ansi2knr.1: Likewise.
8456
8457         * Makefile.maint (prev_version_file): Don't use ?= for this particular
8458         assignment, since it causes trouble with old versions of GNU make
8459         (e.g. 3.76.1).  The other uses of `?=' are inoffensive.  Details here.
8460         http://mail.gnu.org/archive/html/bug-coreutils/2003-03/msg00028.html
8461         Patch from Alexandre Duret-Lutz.
8462
8463         * Use patched automake-1.7.3.  Regenerate Makefile.in files in
8464         subdirectories so that each includes a definition of ACLOCAL_M4.
8465
8466         * announce-gen (main): Label the compressed source URLs.
8467
8468         * Version 4.5.10.
8469
8470         * tests/du/slink: Relax the test for the `local'ness of a file system,
8471         so that now it works also for tmpfs.
8472
8473         * tests/du/hard-link: Transform output from first du, so that this
8474         test doesn't fail on file systems like tmpfs that order directory
8475         entries differently.
8476
8477 2003-03-13  Jim Meyering  <jim@meyering.net>
8478
8479         * tests/du/8gb: Work around what appears to be an NFS failure that
8480         would make this test fail on some systems.
8481
8482 2003-03-11  Jim Meyering  <jim@meyering.net>
8483
8484         * tests/du/basic: Make the test file exactly 4k bytes long.
8485
8486         * src/split.c (longopts): Don't hard-code `2' here.
8487         Instead, just specify `&verbose', and ...
8488         (main): ... remove the `case 2:' block for --verbose.
8489
8490         * tests/du/basic: Make the test file larger than 64 bytes, so that
8491         we don't immediately disqualify file systems (e.g., NetApp) on which
8492         smaller files take up zero disk blocks.  Reported by Vin Shelton.
8493
8494 2003-03-10  Jim Meyering  <jim@meyering.net>
8495
8496         Don't segfault for a negative field width or precision in format string.
8497         Note that this is just a stopgap fix.  The longer term solution may
8498         involve adapting bash's builtins/printf.def.
8499
8500         * src/printf.c: (UNSPECIFIED): Define.
8501         (print_direc): Use the special value, UNSPECIFIED, to indicate
8502         that field_width or precision has not been specified.
8503         (print_formatted): Fail if field_width or precision is the
8504         special value, UNSPECIFIED.
8505         Reported by Oliver Kiddle <okiddle@yahoo.co.uk>
8506
8507         * src/sys2.h (INT_MIN): Define, if necessary.
8508         * tests/misc/printf: Add a test for the above-fixed bug.
8509
8510 2003-03-09  Jim Meyering  <jim@meyering.net>
8511
8512         * src/remove.c (AD_stack_pop): Cast sizeof... to int before
8513         changing its sign.  This avoids a warning from gcc on 64-bit systems.
8514         Reported by Bob Proulx.
8515         (pop_dir): Reverse order of sign change and cast, to be consistent
8516         with the above.
8517
8518 2003-03-08  Jim Meyering  <jim@meyering.net>
8519
8520         * tests/Makefile.am (evar-check): Check for POSIXLY_CORRECT not as a
8521         shell variable, but only in the environment.  With /bin/sh->bash, the
8522         shell variable is set to `y', and that would cause a spurious warning.
8523         Reported by Bob Proulx.
8524
8525         * tests/Makefile.am (check-root): Remove touch/fifo.
8526         It doesn't appear to have to be run as root.
8527
8528         * tests/rm/fail-2eperm: Rather than simply using the first non-root
8529         user name, make sure that the selected user name has a usable shell.
8530         Reported by Paul Jarc.
8531
8532         Before, when using shred on a device, one had to specify --exact,
8533         or be careful to choose a size that would not be rounded up and
8534         exceed the maximum value;  that could result in a failure of
8535         the final write.
8536         * src/shred.c (do_wipefd): --exact is now the default for non-regular
8537         files.  Suggestion from Ben Elliston.
8538         (usage): Say it.
8539
8540         * tests/misc/tty-eof: Require at least version 1.11 of Expect.pm.
8541         Old versions of Expect.pm (e.g., 1.07) lack the log_user function.
8542         Patch by Bob Proulx.
8543
8544         * src/Makefile.am (check-misc): Check for use of `defined' in
8545         #define directives.
8546         Change to $(srcdir) before running grep.
8547
8548         * src/sleep.c: Remove now-unused #include and #define directives.
8549
8550         * src/du.c (process_file): If a file's size is not being counted
8551         e.g., because it's a hard link to a file we've already counted,
8552         then don't print a line for it.
8553
8554         * tests/du/hard-link: New test for the above-fixed bug.
8555         * tests/du/Makefile.am (TESTS): Add hard-link.
8556
8557         `du -S' didn't work
8558         * src/du.c: Revert most of the `reorganization' change of 2003-02-20,
8559         and make the two-array approach work.
8560
8561         * tests/du/basic: Correct/add tests for the above fix.
8562         Set LC_ALL, etc., now that we use sort.
8563         Check the block/size of a small file, too.
8564         Correct expected results for simple dir1/dir2/file case.
8565         Add another test of du -S.
8566
8567 2003-03-07  John David Anglin  <dave.anglin@nrc-cnrc.gc.ca>
8568
8569         Avoid build failure with gcc on hppa1.1-hp-hpux10.20 (see GCC PR
8570         middle-end/9986).  As one of GCC's optimizations, it transforms a
8571         fputs_unlocked call to a fputc_unlocked call when the string is
8572         one character long.  However, hpux doesn't have fputc_unlocked.
8573
8574         * expr.c (usage): Use putchar, not fputs, to output a single character.
8575         * ls.c (dired_dump_obstack): Likewise.
8576         * ptx.c (output_one_tex_line, output_one_dumb_line): Likewise.
8577         * stat.c (print_it): Likewise.
8578
8579 2003-03-07  Jim Meyering  <jim@meyering.net>
8580
8581         * src/cp.c: Remove everything associated with mmap-stack.c.
8582         This reverts the two changes of 2003-02-21.
8583         * src/du.c: Remove everything associated with mmap-stack.c.
8584         This reverts the change of 2003-02-19.
8585
8586 2003-03-06  Jim Meyering  <jim@meyering.net>
8587
8588         * tests/cp/same-file: Unset CDPATH.  Otherwise, having the
8589         CDPATH shell variable set could cause this test to fail.
8590         Reported by Karl Berry.
8591
8592 2003-03-05  Jim Meyering  <jim@meyering.net>
8593
8594         * Version 4.5.9.
8595
8596         * src/printf.c (print_esc): Remove pointless comparison of unsigned
8597         integer with zero, to avoid a warning from Intel's ecc.
8598         Reported by Nelson Beebe.
8599
8600         * src/du.c (process_file): Sizes must all be of type uintmax_t.
8601         Otherwise, for files or totals that are too big, numbers would
8602         be truncated.  Patch mostly by Michael Stone.
8603         Reported by Ingo Saitz as Debian bug #183210.
8604
8605         * tests/du/8gb: New test for the above-fixed bug.
8606         * tests/du/Makefile.am (TESTS): Add 8gb.
8607
8608         * src/du.c (MAX_N_DESCRIPTORS): Use 3 * UTILS_OPEN_MAX / 4
8609         rather than UTILS_OPEN_MAX - 10.
8610
8611 2003-03-04  Jim Meyering  <jim@meyering.net>
8612
8613         * README: Refer new feature discussion to bug-coreutils@gnu.org,
8614         rather than bug-gnu-utils, now that the former is better known.
8615         Suggestion from Göran Uddeborg.
8616
8617         * src/stat.c (usage): Capitalize consistently.
8618         Reported by Göran Uddeborg.
8619
8620         * Makefile.maint (rel-files): Include $(signatures), so that
8621         those files are also copied into $(release_archive_dir).
8622
8623         * src/df.c (find_mount_point): Call error here, now that restore_cwd
8624         no longer does it.
8625         * src/remove.c (AD_pop_and_chdir): Likewise.
8626
8627         * tests/Makefile.am (check-root): Add fail-2eperm.
8628
8629 2003-03-03  Jim Meyering  <jim@meyering.net>
8630
8631         * src/remove.c (remove_cwd_entries): Include the full filename of
8632         the offending file, not just the basename.
8633
8634         * tests/misc/tty-eof: Set $ME properly.
8635
8636         * Makefile.maint (THIS_VERSION_REGEXP, PREV_VERSION_REGEXP):
8637         Remove now-unused variables.
8638         (tag-prev-version, prev-cvs-tag): Likewise.
8639
8640         * src/remove.c (remove_cwd_entries) [!ROOT_CAN_UNLINK_DIRS]: Give an
8641         accurate diagnostic when failing to remove a file owned by some other
8642         user.  Reported by Ivo Timmermans via Michael Stone.
8643         This fixes Debian bug# 178471.
8644
8645         * tests/rm/Makefile.am (TESTS): Add fail-2eperm.
8646         * tests/rm/fail-2eperm: New test, for the above-fixed bug.
8647         Based on a report from Ivo Timmermans.
8648
8649 2003-03-02  Jim Meyering  <jim@meyering.net>
8650
8651         * src/copy.c (copy_internal) [un_backup]: When recovering from a
8652         failure to create a hard link, do not remove the entry associating
8653         the source dev/ino with the destination file name.
8654         * tests/mv/Makefile.am (TESTS): Add hard-3.
8655         * tests/mv/hard-3: New test, for the above-fixed bug.
8656         Inspired by a report from Iida Yosiaki.
8657
8658 2003-03-01  Jim Meyering  <jim@meyering.net>
8659
8660         * src/df.c (print_header): Don't embed spaces in a separate `Type'
8661         header string.  Instead, put `Filesystem' and `Type' headers in the
8662         same string, so translators can use horizontal space as needed.
8663         Reported by Jean Charles Delepine.
8664
8665 2003-02-28  Jim Meyering  <jim@meyering.net>
8666
8667         * src/copy.c (copy_internal): When link fails because of an
8668         existing destination file, unlink that file and try again.
8669         Reported by Iida Yosiaki.
8670
8671         * tests/mv/Makefile.am (TESTS): Add hard-2.
8672         * tests/mv/hard-2: New test for the above-fixed bug.
8673         Based on a test case from Iida Yosiaki.
8674
8675 2003-02-26  Jim Meyering  <jim@meyering.net>
8676
8677         * tests/du/basic: Don't test du's -b option here.  Directory byte
8678         counts are smaller (512 rather than 4096) on at least OSF/1 5.1
8679         and IBM AIX 4.2.  Reported by Nelson Beebe.
8680
8681 2003-02-25  Jim Meyering  <jim@meyering.net>
8682
8683         * Makefile.maint (announcement): Now that ChangeLog entries
8684         are output by announce-gen, don't do it here.
8685         * announce-gen (print_changelog_deltas): New function.
8686         (main): Use it.
8687
8688 2003-02-22  Jim Meyering  <jim@meyering.net>
8689
8690         * announce-gen: New option: --release-type=TYPE
8691         * Makefile.maint (beta, major): New targets.  Remove `release'.
8692         Put them all together on a line.
8693         Pass the release type (via RELEASE_TYPE envvar) to the MAKE
8694         invocation of `announcement'.
8695         (announcement): Invoke announce-gen with --release-type=$RELEASE_TYPE.
8696
8697         * announce-gen: New option: --news=NEWS_FILE.
8698         Extract NEWS entries here, not via rules in Makefile.maint.
8699         * Makefile.maint (announcement): Now that NEWS entries are
8700         extracted by announce-gen, don't do it here.
8701         (news-r1, news-r2): Remove now-unused definitions.
8702
8703 2003-02-21  Jim Meyering  <jim@meyering.net>
8704
8705         * Version 4.5.8.
8706
8707         Merge in changes from autoconf's version of this file.
8708         * Makefile.maint (www-gnu): Define.
8709         (standards.texi-url_prefix): Use $(www-gnu).
8710         (make-stds.texi-url_prefix): Likewise.
8711
8712         * src/cp.c: Include "mmap-stack.h".
8713         (main): Invoke `run' through a macro that (when possible) runs it
8714         with a large, mmap'd stack.
8715
8716         * src/cp.c (run): New function, preparing for the above.
8717         Exit from this function, not from main
8718         (main): Call run.
8719
8720         * src/du.c: New option: --apparent-size.
8721         (enum) [APPARENT_SIZE_OPTION]: New member.
8722         (long_options): Add it.
8723         (usage): Describe it.
8724         (main): Handle it.
8725         ['b']: Set apparent_size.
8726         David Eisner reported that the behavior of --bytes had changed.
8727         Paul Eggert proposed the use of a new option, --apparent-size.
8728
8729         * src/du.c (apparent_size): New global.
8730         (print_only_size): Reflect the fact that we're printing byte counts,
8731         not ST_NBLOCKSIZE-byte-block counts.
8732         (print_size): Call print_only_size rather than duplicating its code.
8733         (process_file): Accumulate byte counts, rather than block counts.
8734
8735         * src/du.c (process_file): Always reset size_to_propagate_to_parent
8736         for --separate-dirs (-S).
8737
8738 2003-02-20  Jim Meyering  <jim@meyering.net>
8739
8740         * Use automake-1.7.3.  Regenerate dependent files.
8741
8742         * src/stat.c (print_stat): New format: %B (to print ST_NBLOCKSIZE).
8743         This makes %b (number of ST_NBLOCKSIZE-byte blocks) more useful.
8744         (usage) [%B]: Describe it.
8745         [%b]: Refer to %B.
8746
8747         * src/du.c (process_file): Reorganize the code to use only
8748         one `sum' array, and change how -S works back to the way it was
8749         before 2003-01-31.  Patch by Bruno Haible.
8750
8751         * tests/du/basic: New test.
8752         * tests/du/Makefile.am (TESTS): Add basic.
8753
8754         * tests/envvar-check: Add checks for the following:
8755         BLOCK_SIZE, DU_BLOCK_SIZE, DF_BLOCK_SIZE, LS_BLOCK_SIZE.
8756
8757         * tests/Makefile.am: Rename phony target envvar-check to evar-check
8758         so as not to conflict with the distributed file by the same name.
8759
8760         * src/du.c (process_file): Set info->skip before any possible return.
8761
8762         Report correct usage for directories, not 0.
8763         * src/du.c (process_file): Return for `file_type == FTW_DPRE'
8764         _before_ recording the dev/ino of a directory.
8765         Reported by Bruno Haible.
8766
8767         Now, df always displays the device file name corresponding to the
8768         listed mount point under `Filesystem'.  Before, for an unmounted
8769         block- or character-special file argument, it would display the
8770         command-line argument instead.
8771         * src/df.c (show_disk): Return a value indicating whether
8772         there was a match.  Don't try to find a mount point here.
8773         (show_entry): If show_disk doesn't find a match, call show_point.
8774
8775 2003-02-19  Jim Meyering  <jim@meyering.net>
8776
8777         * src/du.c: Include "mmap-stack.h".
8778         (du_files): Add prototype with ATTRIBUTE_NORETURN.
8779         Exit from this function, not from...
8780         (main): ...here.
8781         Instead, if possible, invoke du_files through a macro that
8782         runs it with a large, mmap'd stack.
8783
8784         * src/join.c (usage): Change wording in --help output:
8785         use FILENUM instead of `SIDE' and say what FILENUM means.
8786         Reported by Bernhard Gabler.
8787
8788         * src/df.c (print_header): Rather than using a hard-coded literal
8789         string of spaces matching the length of the English `...Type' header,
8790         output the right number of spaces to match the selected translation.
8791         Reported by Yann Dirson and Jean Charles Delepine as Debian bug 131113.
8792
8793         * src/split.c (bytes_split): Remove unnecessary `else' after break.
8794         (lines_split): Likewise.  and correct misleading indentation.
8795
8796         * src/split.c: Include "full-read.h".
8797         (bytes_split, lines_split, line_bytes_split): Use full_read,
8798         not safe_read.   The way split was using the latter, a short read
8799         could cause split to terminate before EOF.
8800
8801         * tests/misc/tty-eof: Test all programs that can read stdin,
8802         requiring no arguments and that write to standard output.
8803
8804         * tests/misc/tty-eof: New file.  Renamed from ...
8805         * tests/misc/cat-tty-eof: Remove file.  Rename to tty-eof.
8806         * tests/misc/Makefile.am (TESTS): Reflect renaming.
8807
8808 2003-02-18  Jim Meyering  <jim@meyering.net>
8809
8810         cksum would perform an extra read after encountering EOF
8811         * src/cksum.c (cksum): Exit the loop upon EOF, too.
8812         Patch by Michael Bacarella.
8813
8814         Test for the bug fixed today in cksum, md5sum, and sha1sum.
8815         * tests/misc/cat-tty-eof: Generalize, clean-up, and test for
8816         cat, cksum, md5sum, and sha1sum all in the same loop.
8817
8818 2003-02-14  Jim Meyering  <jim@meyering.net>
8819
8820         * src/remove.c: Include "euidaccess.h".
8821         Remove declaration of euidaccess.
8822
8823 2003-02-12  Jim Meyering  <jim@meyering.net>
8824
8825         * src/pathchk.c (portable_chars_only): Remove unnecessary `const'
8826         in cast to avoid warning from icc.  Reported by Alexandre Duret-Lutz.
8827
8828 2003-02-10  Jim Meyering  <jim@meyering.net>
8829
8830         * src/test.c: Don't include group-member.h.
8831         Include euidaccess.h.
8832         (eaccess): Rewrite function to set the real uid and gid temporarily
8833         to the effective uid and gid, then invoke 'access', and then set the
8834         real uid and gid back.  On systems that lack setreuid or setregid,
8835         fall back on the kludges in euidaccess.  Before, it would not work
8836         for e.g., files with ACLs, files that were marked immutable,
8837         or on file systems mounted read-only.  Nelson Beebe raised the issue.
8838         Paul Eggert suggested the new implementation.
8839
8840 2003-02-09  Jim Meyering  <jim@meyering.net>
8841
8842         * src/test.c (test_stat): Remove function.  It's job is done (only
8843         when necessary) by the wrapper in lib/stat.c.  Adjust all uses.
8844
8845 2003-02-08  Jim Meyering  <jim@meyering.net>
8846
8847         * Version 4.5.7.
8848
8849         * tests/mv/part-symlink: Don't assume that the file owner username
8850         length is less than 9 in ls output: instead, omit that field
8851         altogether.  Reported by, and suggested fix from, Ferdinand.
8852
8853         * tests/du/restore-wd: New test for just-fixed bug in ftw.c.
8854         * tests/du/Makefile.am (TESTS): Add restore-wd.
8855
8856         * src/rm.c: Correct now-invalid comment about cycle-detection.
8857
8858 2003-02-06  Jim Meyering  <jim@meyering.net>
8859
8860         * NEWS: Add entries from old/*/NEWS
8861         from fileutils-4.1 through 4.1.11 and
8862         from sh-utils-2.0 through 2.0.15.  Suggestion from Karl Berry.
8863
8864         * Version 4.5.6.
8865
8866         * src/du.c (process_file): Don't return early for excluded files
8867         or for files whose dev/inode we've already seen.
8868
8869 2003-02-05  Jim Meyering  <jim@meyering.net>
8870
8871         * tests/du/exclude: New file.
8872         * tests/du/Makefile.am (TESTS): Add exclude.
8873
8874 2003-02-04  Dmitry V. Levin  <ldv@altlinux.org>
8875
8876         * src/who.c (print_boottime, print_deadprocs, print_runlevel):
8877         Fix memory allocation arithmetic.
8878
8879 2003-02-04  Jim Meyering  <jim@meyering.net>
8880
8881         `df /dev/block-or-char-device-file--not-mounted' now reports
8882         the name of the file system on which the file resides, usually `/'.
8883         Before, it would leave the `Mounted on' field blank.
8884         * src/df.c (show_disk): Move function to precede find_mount_point.
8885         (show_disk): Add parameter: STATP.
8886         If we don't find a matching device name, then resort to calling
8887         find_mount_point.  Reported by Bob Proulx.
8888
8889 2003-02-03  Andreas Schwab  <schwab@suse.de>
8890
8891         * tests/rm/cycle: Require non-root.
8892         * tests/rm/isatty: Likewise.
8893
8894 2003-02-02  Jim Meyering  <jim@meyering.net>
8895
8896         * Version 4.5.5.
8897
8898         * man/Makefile.am (check-x-vs-1): Use @PATH_SEPARATOR@, not `:'.
8899
8900         Ensure that there are no offending uses of `:'.
8901         * Makefile.maint (makefile_path_separator_check): New rule.
8902         (local-check): Add it to the list.
8903
8904 2003-02-01  Jim Meyering  <jim@meyering.net>
8905
8906         * src/du.c (MAX_N_DESCRIPTORS): Define.
8907
8908         * src/stat.c (G_fail): New global.
8909         (human_time): Diagnose failed localtime, not failed nstrftime.
8910         (main): Fail if G_fail is set.
8911
8912 2003-01-31  Richard Dawe  <rich@phekda.freeserve.co.uk>
8913
8914         * tests/basename/Makefile.am: Use @PATH_SEPARATOR@ instead of
8915         hard-coding the path-separator.  Also double-quote the new PATH,
8916         to avoid problems when the path-separator is a semi-colon or when
8917         `pwd` contains e.g. a space.
8918         * tests/chgrp/Makefile.am: Likewise.
8919         * tests/chmod/Makefile.am: Likewise.
8920         * tests/chown/Makefile.am: Likewise.
8921         * tests/cp/Makefile.am: Likewise.
8922         * tests/dd/Makefile.am: Likewise.
8923         * tests/dircolors/Makefile.am: Likewise.
8924         * tests/du/Makefile.am: Likewise.
8925         * tests/expr/Makefile.am: Likewise.
8926         * tests/factor/Makefile.am: Likewise.
8927         * tests/fmt/Makefile.am: Likewise.
8928         * tests/install/Makefile.am: Likewise.
8929         * tests/ln/Makefile.am: Likewise.
8930         * tests/ls/Makefile.am: Likewise.
8931         * tests/ls-2/Makefile.am: Likewise.
8932         * tests/md5sum/Makefile.am: Likewise.
8933         * tests/misc/Makefile.am: Likewise.
8934         * tests/mkdir/Makefile.am: Likewise.
8935         * tests/mv/Makefile.am: Likewise.
8936         * tests/od/Makefile.am: Likewise.
8937         * tests/rm/Makefile.am: Likewise.
8938         * tests/rmdir/Makefile.am: Likewise.
8939         * tests/seq/Makefile.am: Likewise.
8940         * tests/sha1sum/Makefile.am: Likewise.
8941         * tests/shred/Makefile.am: Likewise.
8942         * tests/stty/Makefile.am: Likewise.
8943         * tests/sum/Makefile.am: Likewise.
8944         * tests/tail-2/Makefile.am: Likewise.
8945         * tests/touch/Makefile.am: Likewise.
8946         * tests/tsort/Makefile.am: Likewise.
8947         * tests/unexpand/Makefile.am: Likewise.
8948
8949 2003-01-31  Jim Meyering  <jim@meyering.net>
8950
8951         * src/stat.c: Include "file-type.h"
8952         (print_human_type): Remove function.
8953         (human_access): Rename from print_human_access.  Return a string.
8954         (human_time): Rename from print_human_time.  Return a string.
8955         (print_stat): Arrange so that field width and an alignment specifier
8956         are honored for the %A, %F, %x, %y, and %z formats.
8957         [%F]: Use file_type; this gives slightly different file type strings,
8958         e.g., `directory' instead of `Directory' and `regular file' or
8959         `regular empty file' instead of `Regular file'.
8960         Prompted by a report from Richard Dawe that the uses of
8961         S_IFSOCK and S_IFIFO in print_human_time were not portable
8962         to systems using e.g., DJGPP.
8963
8964 2003-01-31  Richard Dawe  <rich@phekda.freeserve.co.uk>
8965
8966         * src/stat.c (print_stat): Use S_ISLNK rather than an explicit
8967         test using S_IFMT and S_IFLNK.  S_IFLNK may not be defined.
8968
8969 2003-01-31  Jim Meyering  <jim@meyering.net>
8970
8971         * src/du.c (main): Upon processing an invalid option or an invalid
8972         --exclude-from or --max-depth option argument, don't exit right away,
8973         in case there are others.  Rather record the failure and exit after
8974         processing other options.
8975
8976         * GNUmakefile (TAR_OPTIONS): Set and export, in order to make
8977         tar archive easier to reproduce.
8978
8979         Rewrite to perform directory traversal using nftw.
8980
8981         * src/du.c: Include "dirname.h", "ftw.h", and "quotearg.h".
8982         (AUTHORS): Add self.
8983         (opt_one_file_system): Move global into `main'.
8984         (path, xstat, exit_status): Remove declarations.
8985         (arg_length, suffix_length): New globals.
8986         (G_fail): New global, sort of like the old `exit_status'.
8987         (IS_FTW_DIR_TYPE): Define.
8988         (print_only_size): New function.
8989         (process_file): New function.
8990         (str_init, ensure_space, str_copyc, str_concatc): Remove functions.
8991         (str_trunc, pop_dir, count_entry): Likewise.
8992         (du_files): Rewrite to use nftw.
8993
8994 2003-01-30  Jim Meyering  <jim@meyering.net>
8995
8996         * tests/du/trailing-slash: Ensure that du/ftw follows a command-line
8997         symlink-to-directory with -L, even without the trailing slash.
8998
8999 2003-01-27  Jim Meyering  <jim@meyering.net>
9000
9001         * src/Makefile.am (check-misc): Check for st_blocks, too.
9002
9003         * src/stat.c (print_stat): Use ST_NBLOCKS rather than `->st_blocks'.
9004         Reported by Richard Dawe.
9005
9006 2003-01-27  Andreas Schwab  <schwab@suse.de>
9007
9008         * src/ls.c (quote_name): Add fourth parameter, width, into which to
9009         store the screen columns, and return the number of bytes instead.
9010         (print_dir): Pass NULL as fourth parameter of quote_name.
9011         (print_name_with_quoting): Likewise.
9012         (length_of_file_name_and_frills): Get the width from the fourth
9013         parameter of quote_name instead of return value.
9014
9015 2003-01-27  Jim Meyering  <jim@meyering.net>
9016
9017         * src/ls.c (decode_switches): If `dired' is set without
9018         `format == long_format', then silently reset dired.  This doesn't
9019         change the behavior of ls (all prior uses of dired were protected
9020         by `&& format == long_format'), and lets us...
9021         (DIRED_INDENT): ... remove the `format == long_format' conjunct.
9022         (PUSH_CURRENT_DIRED_POS): Likewise.
9023         (main): Likewise.
9024
9025 2003-01-22  Jim Meyering  <jim@meyering.net>
9026
9027         * tests/du/no-x: New test, for functionality added to lib/ftw.c.
9028         * tests/du/Makefile.am (TESTS): Add no-x.
9029
9030 2003-01-21  Jim Meyering  <jim@meyering.net>
9031
9032         * src/remove.c (remove_entry) [ROOT_CAN_UNLINK_DIRS
9033         && HAVE_STRUCT_DIRENT_D_TYPE]: If a file has d_type == DT_UNKNOWN
9034         it may still be a directory -- or not (e.g., with FreeBSD on an
9035         NFS-mounted file system), so resort to calling lstat to find out.
9036         Based on a patch by Michael van Elst.
9037
9038         * tests/cp/same-file: Don't assume that the file owner username
9039         length is less than 9 in ls output: instead, omit that field
9040         altogether.  Reported by, and suggested fix from, Ferdinand.
9041
9042 2003-01-20  Jim Meyering  <jim@meyering.net>
9043
9044         * tests/date/Test.pm (wide-fmt): New test to demonstrate that
9045         large format widths no longer cause strftime to infloop.
9046
9047         * Makefile.maint (mail_gpg_sign_cookie): Remove now-unused definition.
9048
9049 2003-01-19  Jim Meyering  <jim@meyering.net>
9050
9051         * src/readlink.c: Include "canonicalize.h".
9052
9053 2003-01-18  Jim Meyering  <jim@meyering.net>
9054
9055         * src/ls.c (Dereference_symlink) [DEREF_COMMAND_LINE_SYMLINK_TO_DIR]:
9056         New member.
9057         (enum) [DEREFERENCE_COMMAND_LINE_SYMLINK_TO_DIR_OPTION]: New member.
9058         (long_options): Add option --dereference-command-line-symlink-to-dir.
9059         (main): Make DEREF_COMMAND_LINE_SYMLINK_TO_DIR be the default,
9060         rather than DEREF_COMMAND_LINE_ARGUMENTS, when none of the
9061         -d, -F, -l options is specified.
9062         (decode_switches): Handle --dereference-command-line-symlink-to-dir.
9063         (gobble_file): Honor DEREF_COMMAND_LINE_SYMLINK_TO_DIR.
9064         Change --dereference-command-line (-H) to dereference *all*
9065         command line arguments, including broken symlinks.
9066
9067 2003-01-15  Paul Eggert  <eggert@twinsun.com>
9068
9069         Change ls -H back to the way it was yesterday, since this is
9070         compatible with FreeBSD and the POSIX spec is confusing
9071         and somewhat contradictory.
9072
9073         * src/ls.c (DEREF_COMMAND_LINE_ARGUMENTS): Change name back
9074         from DEREF_COMMAND_LINE_SYMLINK_TO_DIR, updating all uses.
9075         (long_options): Change the long option name back.
9076         (usage): Change the usage back.
9077         (gobble_file): When -H is specified, dereference a top-level
9078         arg even if it points to a non-directory.
9079
9080 2003-01-15  Jim Meyering  <jim@meyering.net>
9081
9082         * src/ls.c (gobble_file): Fall back on using lstat when required:
9083         when --dereference (-L) is not specified, and
9084         - when operating on a dangling symlink
9085         - when operating on command-line-symlink-to-directories
9086         This fixes numerous problems.  Here are examples:
9087         - `ls dangling-symlink' would fail with `no such file...'
9088         Now it prints `dangling-symlink'.
9089         - `ls -i symlink' would mistakenly print the inode of the referent.
9090         Now it prints the inode of the symlink.  Likewise for --size (-s).
9091         Based on a patch from Michael Stone.
9092         Reported by Deepak Goel as Debian bug #173793.
9093
9094         Rename ls's --dereference-command-line (-H)
9095         option to   --dereference-command-line-symlink-to-dir.
9096         * src/ls.c [enum Dereference_symlink]
9097         (DEREF_COMMAND_LINE_SYMLINK_TO_DIR): Rename from
9098         DEREF_COMMAND_LINE_ARGUMENTS.  Update all uses.
9099         (long_options): Rename the long option.
9100         (usage): Say that --dereference-... changes how ls treats
9101         only symlinks to directories specified on the command line.
9102
9103 2003-01-14  Jim Meyering  <jim@meyering.net>
9104
9105         * tests/ls/dangle: New file/test, for the above fix.
9106         * tests/ls/inode: Another new file/test, for the above fix.
9107         * tests/ls/Makefile.am (TESTS): Add dangle and inode.
9108
9109         * src/ls.c (gobble_file): Fix a bug introduced in 4.5.4 that made it
9110         so that ls --color would no longer highlight the names of files with
9111         the execute bit set when not specified on the command line.
9112         Patch by Michael Stone.  Reported by Stephen Depooter as
9113         Debian bug 175135.
9114
9115         * tests/ls-2/tests (color-exe): New test, for the above fix.
9116
9117 2003-01-13  Jim Meyering  <jim@meyering.net>
9118
9119         * tests/shred/exact: Also test for just fixed bug with --zero.
9120
9121         * src/shred.c (long_opts): --zero does not require an argument.
9122         Patch by Michael Stone.  Reported by Roland Turner as Debian bug 172019.
9123
9124 2003-01-12  Jim Meyering  <jim@meyering.net>
9125
9126         * Makefile.maint (cvs-update): Skip any file with local modifications.
9127
9128         * src/unexpand.c (usage): Document --first-only and mention that
9129         --tabs=N (-t) enables --all (-a).  Reported by wiregauze@yahoo.com.
9130
9131 2002-12-01  Dmitry V. Levin  <ldv@altlinux.org>
9132
9133         * src/df.c: Include "canonicalize.h".
9134         Use canonicalize_file_name unconditionally.
9135
9136 2003-01-09  Jim Meyering  <jim@meyering.net>
9137
9138         * README: Add readlink.
9139
9140 2002-11-30  Dmitry V. Levin  <ldv@altlinux.org>
9141
9142         * src/df.c: Include "xgetcwd.h".
9143         * src/pwd.c: Likewise.
9144
9145 2002-11-30  Dmitry V. Levin  <ldv@altlinux.org>
9146
9147         * src/shred.c: Remove declaration of xstrdup.
9148         We already get it via xalloc.h which is included via system.h.
9149
9150 2002-08-27  Dmitry V. Levin  <ldv@altlinux.org>
9151
9152         New program: readlink.
9153
9154         * src/Makefile.am (bin_PROGRAMS): Add readlink.
9155         * src/readlink.c: New file.
9156
9157         * man/readlink.x: New file.
9158         * man/Makefile.am (dist_man_MANS): Add readlink.1.
9159         (readlink.1): New rule.
9160
9161 2003-01-09  Jim Meyering  <jim@meyering.net>
9162
9163         When selecting ranges of byte offsets (as opposed to ranges of fields)
9164         and when --output-delimiter=STRING is specified, output STRING between
9165         ranges of selected bytes.
9166         * src/cut.c (RANGE_START_SENTINEL): Define.
9167         (output_delimiter_specified): New global.
9168         (print_kth): Add parameter.  Adjust all callers.
9169         (set_fields): Mark each range-start index with RANGE_START_SENTINEL.
9170         (cut_bytes): When requested, output STRING between ranges of
9171         selected bytes.
9172         (main): Make a diagnostic a little clearer.
9173         Based on a patch from Jan Nieuwenhuizen.
9174
9175         * tests/cut/Test.pm: New tests for the above.
9176
9177         * src/cut.c (set_fields): Make code agree with comment:
9178         Don't merge abutting ranges like 4- and 2-3.  This makes no
9179         difference currently, but is required to support an upcoming change.
9180
9181 2003-01-07  Jim Meyering  <jim@meyering.net>
9182
9183         * src/cut.c (set_fields): Fix typo in comment.
9184
9185         * tests/touch/not-owner: New test, mostly extracted from fail-diag.
9186         * tests/touch/Makefile.am (TESTS): Add not-owner.
9187         * tests/touch/fail-diag: Remove the test for non-owner diagnostic.
9188         Now, this tests only the nonexistent-directory diagnostic.
9189         Suggestion from Michael Stone.
9190
9191         * tests/touch/fail-diag: Fix typo: s/ld/ls/.
9192
9193 2003-01-04  Jim Meyering  <jim@meyering.net>
9194
9195         * src/copy.h: Remove use of PARAMS.
9196         * src/remove.h: Likewise.
9197         * src/chown-core.h: Likewise.
9198
9199         rm could be tricked into mistakenly reporting a cycle.
9200         * src/remove.c: [cycle_check_state]: New global.
9201         (remove_cwd_entries): Adapt to new semantics of cycle_check.
9202         (rm): Call cycle_check_init and cycle_check_free for each file.
9203         * tests/rm/cycle (rm): New test, for the above fix.
9204         * tests/rm/Makefile.am (TESTS): Add cycle.
9205
9206         When rm detects a cycle, don't abort the entire command,
9207         but rather just the affected command line argument.
9208         * src/remove.c: Include <setjmp.h>
9209         (struct dirstack_state) [current_arg_jumpbuf]: New member.
9210         (remove_cwd_entries): Call longjmp if we detect a cycle.
9211         (rm): Call setjmp here.
9212
9213         * src/remove.c (cycle_check, is_power_of_two): Remove functions.
9214         Instead, include cycle-check.h and use it.
9215
9216         * src/remove.h (struct dev_ino): Remove declaration.
9217
9218         * src/remove.c (remove_cwd_entries): Fix typos in comment.
9219
9220         Don't include trailing /. in diagnostics about directories.
9221         * src/remove.c (full_filename_): When FILENAME is just `.'
9222         and there is a nonempty directory-name part, don't append `/.'.
9223         * tests/rm/unread2: Remove trailing /. from diagnostic.
9224         * tests/rm/rm2: Likewise.
9225
9226         * src/remove.c (struct dirstack_state): Define.
9227         To be used in place of these file-scoped globals ...
9228         (dir_stack, len_stack, Active_dir): Remove globals.
9229         (ds_init, ds_free): New functions.
9230         (full_filename): Define.
9231         (full_filename_): Rename from full_filename.
9232
9233         Begin to make AD_* functions more generic.
9234         * src/remove.c (AD_push_initial): Don't set status to RM_OK here.
9235         (AD_push): Likewise.
9236         (AD_INIT_OTHER_MEMBERS): Define.
9237         (remove_dir): Define the `status' member manually after each
9238         call to AD_push or AD_push_initial.
9239
9240         * src/Makefile.am (check-misc): New rule, to ensure that no more
9241         S_IS* macro definitions sneak into the code.
9242         (check): Depend on check-misc.
9243
9244         * src/remove.c [S_ISLNK]: Don't define.  It's already defined in sys2.h.
9245         * src/du.c (count_entry) [S_ISLNK]: Don't define.
9246         * src/shred.c [S_ISLNK, S_ISFIFO, S_ISSOCK]: Don't define.
9247
9248 2003-01-03  Jim Meyering  <jim@meyering.net>
9249
9250         * src/true.c: Add copyright.
9251         (AUTHORS): I suppose I've written it.
9252
9253         * src/Makefile.am (false.c): Make the generated file be read-only.
9254
9255 2003-01-04  Jim Meyering  <jim@meyering.net>
9256
9257         * src/ls.c: Include "dev-ino.h".
9258         [struct dev_ino]: Remove declaration.
9259
9260 2003-01-02  Jim Meyering  <jim@meyering.net>
9261
9262         * src/cp.c (do_copy): Tweak diagnostic to be consistent with the one
9263         from mv: s/missing file arguments/missing file argument/.
9264         With --target-directory=DIR, cp and mv work with a single file argument.
9265         Reported by Karl Berry.
9266
9267         * tests/rm/isatty: Enable this test.
9268
9269 2002-12-31  Jim Meyering  <jim@meyering.net>
9270
9271         * src/remove.c (AD_push_initial): Don't set status to RM_OK here.
9272         (AD_push): Likewise.
9273         (AD_INIT_OTHER_MEMBERS): Define.
9274         (remove_dir): Define the `status' member manually after each
9275         call to AD_push or AD_push_initial.
9276
9277         * src/ls.c [struct dev_ino]: Remove definition.
9278         Include "dev-ino.h" instead.
9279
9280 2002-12-28  Jim Meyering  <jim@meyering.net>
9281
9282         * tests/du/Makefile.am (TESTS): Add no-deref.
9283         * tests/du/no-deref: New script.
9284
9285 2002-12-23  Jim Meyering  <jim@meyering.net>
9286
9287         * src/remove.c (remove_cwd_entries): Fix typo in comment.
9288
9289 2002-12-21  Jim Meyering  <jim@meyering.net>
9290
9291         * announce-gen: Generate MML-formatted announcement.
9292         This makes it a *lot* harder to send stale MD5/SHA1 signatures.
9293
9294 2002-12-20  Jim Meyering  <jim@meyering.net>
9295
9296         * src/touch.c (touch): Change the wording of a diagnostic so
9297         that it makes sense both when the file exists and when it doesn't.
9298         Suggestion from Michael Stone.
9299
9300 2002-12-18  Jim Meyering  <jim@meyering.net>
9301
9302         * src/stty.c (valid_options): Declare to be static.
9303
9304 2002-12-15  Jim Meyering  <jim@meyering.net>
9305
9306         * Makefile.cfg: Remove rules related to generating m4/jm-glibc-io.m4.
9307
9308         * src/chmod.c, src/copy.c, src/copy.h, src/cp-hash.h, src/csplit.c:
9309         * src/date.c, src/expr.c, src/fmt.c, src/id.c, src/install.c:
9310         * src/ls.c, src/od.c, src/pathchk.c, src/pr.c, src/remove.c:
9311         * src/shred.c, src/sort.c, src/stat.c, src/stty.c, src/sum.c:
9312         * src/tee.c, src/test.c: Remove all uses of `PARAMS'.
9313
9314         * src/remove.c (PARAMS): Remove definition.
9315         * src/sys2.h: Likewise.
9316
9317         * src/ls.c, src/stat.c, src/date.c: Remove declaration of nstrftime.
9318         Include strftime.h instead.
9319
9320 2002-12-14  Jim Meyering  <jim@meyering.net>
9321
9322         * Makefile.cfg ($(url_dir_list)): Use .../coreutils, not .../fetish.
9323
9324         * src/system.h [! HAVE_DECL_MEMRCHR]: Declare memrchr.
9325         This is necessary at least for Irix6.5 when using c89.
9326         Reported by Nelson Beebe.
9327
9328         * tests/misc/Makefile.am (TESTS): Add cat-tty-eof.
9329
9330         * tests/misc/cat-tty-eof: New test.
9331
9332         * src/mknod.c (usage): Specify how major and minor mode numbers
9333         are interpreted.  Report forwarded by Kristin E Thomas.
9334         * src/mknod.c: Remove now-redundant usage-specifying comment.
9335
9336 2002-12-13  Jim Meyering  <jim@meyering.net>
9337
9338         * Version 4.5.4.
9339
9340         * tests/du/trailing-slash: Allow for a directory of size `0'.
9341         That happens at least on file systems of type tmpfs on linux-2.4.18.
9342
9343         * announce-gen: New script to begin replacing the commands
9344         associated with the rule here...
9345         * Makefile.maint (announcement): Invoke announce-gen.
9346         * Makefile.am (EXTRA_DIST): Add announce-gen.
9347
9348         * tests/cp/preserve-2: New file/test, for latest fix.
9349         * tests/cp/Makefile.am (TESTS): Add preserve-2.
9350
9351 2002-12-11  TAKAI Kousuke  <takai@vlsi.kuee.kyoto-u.ac.jp>
9352
9353         Fix a bug whereby cp would fail to parse an option like
9354         --preserve=mode,ownership.
9355         * src/cp.c (decode_preserve_arg): Advance `comma' to
9356         point the character following the comma.
9357
9358 2002-12-11  Jim Meyering  <jim@meyering.net>
9359
9360         * src/pathchk.c (NEED_PATHCONF_WRAPPER): Undefine before defining,
9361         in case it's already defined.
9362
9363 2002-12-09  Jim Meyering  <jim@meyering.net>
9364
9365         * tests/touch/fail-diag: Don't get a test failure if /no exists.
9366         Instead, evoke a framework failure if /no-$$ exists.
9367         Reported by Michael Stone.
9368
9369 2002-12-08  Jim Meyering  <jim@meyering.net>
9370
9371         * src/du.c (lstat) [! LSTAT_FOLLOWS_SLASHED_SYMLINK]:
9372         Define to rpl_lstat, so that even on systems like Solaris 5.8,
9373         du honors (per POSIX) the trailing slash on an argument referring
9374         to a symlink-to-directory.
9375
9376 2002-12-06  Jim Meyering  <jim@meyering.net>
9377
9378         * Use autoconf-2.57.  Regenerate dependent files.
9379         * Use automake-1.7.2.  Regenerate dependent files.
9380
9381         * src/ls.c (gobble_file): Also stat the file if it's a
9382         regular file and --indicator-style=classify (aka -F).
9383         Thanks to Ed Santiago for opening my eyes.
9384
9385         * tests/ls/file-type: New file.  Test for the above.
9386         A test to contrast ls -F and ls --indicator-style=file-type.
9387         * tests/ls/Makefile.am (TESTS): Add file-type.
9388
9389 2002-12-04  Jim Meyering  <jim@meyering.net>
9390
9391         * tests/ls/follow-slink: Make sure the symlink was created.
9392         Richard Dawe reported that `ln -s link link' succeeds, but creates
9393         no file on systems running some version of the DJGPP libc.
9394
9395 2002-12-03  Jim Meyering  <jim@meyering.net>
9396
9397         * src/Makefile.am (AUTOMAKE_OPTIONS): Remove definition (to ansi2knr)
9398         since this package no longer panders to K&R compilers.
9399
9400 2002-12-02  Jim Meyering  <jim@meyering.net>
9401
9402         * tests/du/slink: Skip this test if `.' is on a non-local file system.
9403
9404         * tests/Fetish.pm (_at_replace): Do the substitution only if there's
9405         something to replace.
9406
9407 2002-12-01  Jim Meyering  <jim@meyering.net>
9408
9409         * src/stat.c: Don't include <string.h> or <ctype.h>.
9410         That's already done via system.h.
9411         * src/dircolors.c: Don't include <ctype.h>.
9412
9413 2002-11-30  Jim Meyering  <jim@meyering.net>
9414
9415         * ls.c (gobble_file): Remove the block of code that caused
9416         `ls --color -F symlink-to-dir' to list the files in
9417         `symlink-to-dir/.'.  Now, it prints `symlink-to-dir@', (just
9418         like `ls -F symlink-to-dir') but with the addition of highlighting.
9419         Similarly, `ls --color -dF symlink-to-dir' would print
9420         `symlink-to-dir/';  now it prints `symlink-to-dir@'.
9421         Reported by Jeff Sheinberg as Debian bug #168203.
9422         * tests/ls-2/tests (sl-F-color, sl-dF-color): New tests for the above.
9423
9424         ls is now more efficient: with certain options, it no longer needs
9425         to stat each directory entry on systems with valid dirent.d_type.
9426         * src/ls.c (print_dir): Add DT_LNK and DT_REG.
9427         (main): Make --recursive set format_needs_type, not format_needs_stat.
9428         (gobble_file): Remove a FIXME comment, now that it's fixed.
9429
9430 2002-11-24  Jim Meyering  <jim@meyering.net>
9431
9432         * src/du.c (du_files): Don't strip any trailing slash.
9433         Rewrite so that `/' is no longer represented internally as
9434         the empty string.
9435         (count_entry): When appending a file name component,
9436         account for the fact that the current path may end in `/'.
9437         François Pinard reported that `du symlink-to-dir/' was not
9438         equivalent to `du symlink-to-dir/.'.  Now it is.
9439         * tests/du/trailing-slash: New file/test, for the above fix.
9440         * tests/du/Makefile.am (TESTS): Add trailing-slash.
9441
9442 2002-11-23  Jim Meyering  <jim@meyering.net>
9443
9444         * src/tac.c (output): Declare some local variables to be of type size_t,
9445         rather than `int' to avoid warnings from gcc.
9446
9447 2002-11-21  Paul Eggert  <eggert@twinsun.com>
9448
9449         * src/ls.c (decode_switches): Use case-sensitive matching to
9450         decode the QUOTING_STYLE environment variable.  This is more
9451         consistent with the documentation, and with --quoting-style.
9452
9453 2002-11-21  Martin Buck  <martin.buck@ascom.ch
9454
9455         * src/stty.c (struct speeds): Add support for all baud rates defined
9456         in linux-2.4.19.
9457
9458 2002-11-19  Jim Meyering  <jim@meyering.net>
9459
9460         * tests/sum/sysv: Export LC_ALL=C, to avoid failure when
9461         run in a UTF locale.  Report and suggested fix by Bruno Haible.
9462         * tests/fmt/basic: Likewise.
9463
9464 2002-11-17  Jim Meyering  <jim@meyering.net>
9465
9466         * configure.ac: Update via autoupdate.
9467         Add `AM_GNU_GETTEXT_VERSION(0.11.5)'.
9468
9469         * src/mv.c (movefile): Don't remove trailing slashes from SOURCE.
9470         Reported by Hans Ginzel.
9471
9472 2002-11-15  Jim Meyering  <jim@meyering.net>
9473
9474         * Makefile.cfg (gnu_rel_host): Define.
9475         (url_dir_list): Choose from (alpha|ftp).gnu.org depending
9476         on whether $(VERSION) looks like a major release number.
9477
9478         * Makefile.maint (mail_gpg_sign_cookie): Backslash-escape `#'.
9479         (release): Rename from `alpha'.
9480         (alpha): Depend on release.
9481
9482         * Makefile.maint (signatures): Define with ?=, so it's easy to override.
9483
9484 2002-11-14  Jim Meyering  <jim@meyering.net>
9485
9486         * Makefile.maint (mail_gpg_sign_cookie): Make optional.
9487         (announcement): Use the new variable.
9488
9489         * Makefile.maint: Sync with Bison, i.e.:
9490         (po-check): Scan .l and .y files instead of the
9491         .c and the .h files that they generate.  This fixes the bug
9492         reported by Tim Van Holder in:
9493         <http://mail.gnu.org/pipermail/bison-patches/2002-November/001352.html>
9494         Look for N_ as well as for _.  Try to avoid matching #define for
9495         N_ and _.
9496         From Paul Eggert.
9497
9498 2002-11-12  Jim Meyering  <jim@meyering.net>
9499
9500         * src/ls.c (HAVE_SYMLINKS): Remove unnecessary macro definition.
9501         Replace sole use with equivalent `#ifdef S_ISLNK'.
9502         Inconsistency reported by Dmitry V. Levin.
9503
9504 2002-11-11  Jim Meyering  <jim@meyering.net>
9505
9506         * src/stat.c (usage): Transform --help items output via s/ - /   /,
9507         so that help2man produces properly formatted man pages.
9508         Reported by Herbert Xu as Debian bug #168400.
9509
9510 2002-11-10  Jim Meyering  <jim@meyering.net>
9511
9512         * src/ls.c (sighandler): Handle SIGTSTP specially.
9513         Based on suggestions from Solar Designer and Dmitry V. Levin.
9514         Add comments.
9515
9516         * Makefile.cfg (cvs_files): Define.  From autoconf.
9517         (local_updates): Likewise.
9518
9519         * src/ls.c (restore_default_color_handler, sigtstp_handler):
9520         Remove functions.
9521         (sighandler): New function, based on the one in sort.c.
9522         (main): Use sigaction, if possible; otherwise signal.
9523         Handle these signals:
9524         SIGHUP, SIGINT, SIGPIPE, SIGQUIT, SIGTERM, SIGTSTP.
9525         Don't register our handler if the signal is already being ignored.
9526
9527         * src/dd.c (interrupt_handler): Use raise, rather than kill+getpid.
9528         * src/csplit.c (interrupt_handler): Likewise.
9529         * src/sort.c (sighandler): Likewise.
9530         (main): Declare `i' and `nsigs' to be unsigned, not int.
9531
9532 2002-11-09  Jim Meyering  <jim@meyering.net>
9533
9534         ls --color: restore terminal text color upon signal.
9535         * src/ls.c: Include "full-write.h" and <signal.h>.
9536         (restore_default_color, restore_default_color_handler): New functions.
9537         (sigtstp_handler, put_indicator_direct): New functions.
9538         (main) [print_with_color]: Register signal handlers.
9539         Patch mostly by Solar Designer and Stanislav Ievlev.
9540
9541         Update from autoconf.
9542         * Makefile.maint (AMTAR): Remove definition.
9543         (update, cvs-update, po-update, do-po-update): New rules.
9544         (wget-update): Update (thus renaming to cvs-update).
9545         (automake_repo): Use anoncvs@sources.redhat.com.
9546
9547 2002-11-06  Jim Meyering  <jim@meyering.net>
9548
9549         * tests/misc/Makefile.am (TESTS): Add printf-hex.
9550
9551         * tests/misc/printf: Be careful to test the code in this package,
9552         not the shell built-in function.
9553
9554         * src/printf.c (print_esc): A hexadecimal escape sequence has
9555         at most two hex. digits, not three.  Reported by Padraig Brady.
9556         (usage): Update description.
9557         * tests/misc/printf-hex: New file/test, for the above fix.
9558
9559 2002-10-07  Paul Eggert  <eggert@twinsun.com>
9560
9561         Add support for locale-specific size indications (e.g.,
9562         thousands-separators) and for explicit size suffixes on output.
9563
9564         * doc/coreutils.texi (Block size): Say that:
9565         This affects display format as well as block size.
9566         Fractional block counts are rounded up.
9567         ls file size blocksize defaults to 1.
9568         A block size spec preceded by ' generates thousands separators.
9569         A suffix without a preceding integer generates suffixes.
9570         (tail invocation): 32k -> 32 KiB.
9571         (What information is listed): ls -h is now equivalent to
9572         ls --block-size=human, and ls -H is now equivalent to
9573         ls --block-size=si.  Displayed file size is now always affected by
9574         --block-size.
9575
9576         * lib/inttostr.c, lib/inttostr.h, lib/imaxtostr.c, lib/offtostr.c,
9577         lib/umaxtostr.c: New files, taken from GNU tar.
9578
9579         * lib/Makefile.am (libfetish_a_SOURCES): Add imaxtostr.c, offtostr.c,
9580         umaxtostr.c.
9581         (EXTRA_DIST): Add inttostr.c.
9582
9583         * lib/human.c, lib/human.h: Rewrite to support locale-specific
9584         notations like thousands separators.
9585         Specify what includer of include.h must include beforehand.
9586         (human_group_digits, human_suppress_point_zero, human_autoscale,
9587         human_base_1024, human_SI, human_B): New enum values.
9588         (human_readable): Rename from human_readable_inexact; put the
9589         options before the sizes.  All uses changed.  The old human_readable
9590         function has been removed; use inttostr.h instead.
9591         (human_options): Renamed from human_block_size, with new signature
9592         that allows block sizes up to UINTMAX_MAX.  All callers changed.
9593
9594         * m4/prereq.m4 (jm_PREREQ_HUMAN): Check for locale.h, localeconv,
9595         AC_HEADER_STDBOOL.  No need to check for limits.h since it's in
9596         freestanding C89.  No need to check for stdlib.h or string.h since
9597         autoconf does this now.
9598
9599         * src/cksum.c (cksum): Use primitives from inttostr.h, not
9600         human.h, to print large numbers simply.
9601         * src/csplit.c (handle_line_error, parse_patterns): Likewise.
9602         * src/dd.c (print_stats, main): Likewise.
9603         * src/df.c (print_header): Likewise.
9604         * src/factor.c (print_factors): Likewise.
9605         * src/ls.c (print_long_format, print_file_name_and_frills): Likewise.
9606         * src/shred.c (dopass): Likewise.
9607         * src/sort.c (checkfp): Likewise.
9608         * src/sum.c (bsd_sum_file, sysv_sym_file): Likewise.
9609         * src/tail.c (xlseek): Likewise.
9610         * src/wc.c (write_counts, wc): Likewise.
9611
9612         * src/df.c (human_output_opts): New var.
9613         (output_block_size): Now uintmax_t, not int, to handle larger
9614         block sizes.  All uses changed.
9615         * src/du.c: Likewise.
9616         * src/ls.c: Likewise.
9617
9618         * src/df.c (print_header): In the header line, prefer SI to human
9619         representation if it's shorter; if neither is shorter, try to
9620         intuit what the user would prefer.
9621
9622         * src/expr.c (inttostr): Remove; use new imaxtostr library
9623         function instead.
9624
9625         * src/ls.c (file_output_block_size): New var, to distinguish
9626         file sizes from other sizes.
9627         (decode_switches): Set it.
9628
9629         * src/shred.c (OUTPUT_BLOCK_SIZE): remove.
9630         (dopass): When printing progress, use floor for what has been done
9631         so far (since we should be conservative there), and ceiling for
9632         what needs to be done (since that's what other programs use).
9633
9634 2002-10-19  Jim Meyering  <jim@meyering.net>
9635
9636         * src/pinky.c (print_heading): Align TTY and Name headings.
9637         Reported by Karl Eichwalder.
9638
9639 2002-10-18  Jim Meyering  <jim@meyering.net>
9640
9641         * src/split.c (cwrite): Change type of `bytes' parameter to size_t
9642         Remove now-useless cast.
9643         (stdread): Remove function.
9644         (bytes_split): Use size_t instead of int.
9645         Use safe_read, not stdread.
9646         (lines_split): Likewise.
9647         Use memchr rather than a `while' loop.
9648         (line_bytes_split): Use size_t instead of int.
9649         Use safe_read, not stdread.
9650         (main): Add some FIXME comments to remind me to remove casts.
9651
9652         * src/system.h (ST_BLKSIZE): Correct comment describing how to
9653         reproduce HPUX-11 cat failure.  From Petter Reinholdtsen.
9654
9655 2002-10-17  Jim Meyering  <jim@meyering.net>
9656
9657         Fix a problem that could make e.g., `cat' misbehave on systems which
9658         give invalid (unreasonably large) values for stat.st_blksize.
9659         * src/system.h (ST_BLKSIZE): Ensure that the result is in [1..4MB].
9660         Reported by Petter Reinholdtsen.
9661
9662 2002-10-14  Jim Meyering  <jim@meyering.net>
9663
9664         Specifying a printf conversion specifer as nl's separator string
9665         could cause nl to segfault.
9666         * src/nl.c (build_print_fmt): Don't include separator string
9667         in the printf format; it might contain `%'.
9668         Use a better bound on the length of the print_fmt buffer.
9669         (print_lineno): Print the separator here instead.
9670         Reported by Doug Coleman.
9671
9672         * tests/misc/nl: New file/tests, including a test for the above.
9673         * tests/misc/Makefile.am (TESTS): Add nl.
9674
9675         * tests/misc/split-l: New test, to make sure `split --lines=N' works.
9676         * tests/misc/Makefile.am (TESTS): Add split-l.
9677
9678 2002-10-13  Jim Meyering  <jim@meyering.net>
9679
9680         * Version 4.5.3.
9681
9682         * src/du.c (usage): Tweak description of --dereference-args/-D.
9683
9684         * src/du.c (count_entry): Also save cwd when dereferencing (via
9685         --dereference-args, -D) a command-line argument.
9686         Reported by Michal Svec.  Based on a patch by Andreas Schwab.
9687
9688         * src/Makefile.am (../AUTHORS): New target/rule.
9689
9690 2002-10-12  Jim Meyering  <jim@meyering.net>
9691
9692         * src/paste.c (paste_parallel): Declare local, `delims_saved', to be
9693         of type size_t, since that's the way it's used and avoids a warning.
9694
9695         * src/csplit.c (struct cstring) [len]: Declare to be unsigned int,
9696         since that's how it's always used and avoids a new warning from gcc.
9697         (read_input): Adapt to new safe_read ABI.
9698
9699         * src/cut.c (cut_fields): Add a temporary size_t variable, n_bytes,
9700         to avoid warnings.
9701
9702         * src/pinky.c (print_long_entry): fread returns size_t.
9703         Declare local `bytes' accordingly, to avoid warning.
9704
9705         tail -c +N would perform an extra read after encountering EOF
9706         [this change is analogous (bytes vs. lines) to the one of 2002-01-27]
9707         * src/tail.c (start_bytes): Detect EOF, inform caller.
9708         (tail_bytes): Upon EOF in start_bytes, return immediately.
9709         (file_lines): Reorganize to use memrchr rather than an explicit loop.
9710         Adapt to new safe_read ABI.
9711
9712 2002-10-11  Jim Meyering  <jim@meyering.net>
9713
9714         * tests/du/deref: New file/test, for the above fix.
9715         * tests/du/Makefile.am (TESTS): Add deref.
9716
9717 2002-10-10  Jim Meyering  <jim@meyering.net>
9718
9719         * tests/ln/Makefile.am (TESTS): Add target-1.
9720         * tests/ln/target-1: New file/test, for the fix on 2002-10-08.
9721
9722 2002-10-09  Jim Meyering  <jim@meyering.net>
9723
9724         * tests/cp/backup-is-src: Ensure that certain environment variables
9725         are not set (e.g., SIMPLE_BACKUP_SUFFIX).  Reported by Duncan Roe.
9726
9727         * tests/tail-2/big-4gb: Mark this as an expensive test; it would
9728         consume 4GB of disk space on systems without support for sparse files.
9729         Fix a logic error that'd make it `cat err' even though dd didn't fail.
9730
9731         * src/dircolors.hin (.jar): Fix typo: s/;3$/;31/.
9732         Patch by steven@magelico.net, forwarded by Michael Stone.
9733
9734         * tests/ls/dired: Ensure that ls produces English messages.
9735         Patch by Alexey Vyskubov, forwarded by Michael Stone.
9736
9737 2002-10-08  Dmitry V. Levin  <ldv@altlinux.org>
9738
9739         * src/ln.c (main): Fix target_directory parsing when n_files == 1.
9740
9741 2002-10-08  Jim Meyering  <jim@meyering.net>
9742
9743         * tests/tail-2/big-4gb: Use double quotes around diagnostic.
9744         Fix syntax in test: use =, not ==.
9745         Reported by Bob Proulx.
9746         Change all the rest like this: grep -lR "testing framework'" .\
9747         |xargs perl -pi -e 's/'\''(\$0: failure in testing framework)'\''/"$1"/'
9748
9749         * src/sum.c (sysv_sum_file): Adapt to new safe_read ABI.
9750         * src/tr.c (squeeze_filter, read_and_delete, read_and_xlate): Likewise.
9751         * src/tac.c (save_stdin, tac_stdin_to_mem): Likewise.
9752         * src/wc.c (wc): Likewise.
9753
9754 2002-10-07  Paul Eggert  <eggert@twinsun.com>
9755
9756         * src/cat.c (cat):
9757         Don't advance the write pointer past the end of the write buffer.
9758         * src/sort.c (begfield, limfield): Likewise.
9759
9760 2002-10-07  Jim Meyering  <jim@meyering.net>
9761
9762         * src/cat.c (simple_cat, cat): Adapt to new safe_read ABI.
9763         * src/head.c (head_bytes, head_lines): Likewise.
9764
9765 2002-10-06  Jim Meyering  <jim@meyering.net>
9766
9767         * src/dd.c (scanargs): Ensure that specified block sizes (specified
9768         via ibs=N, obs=N, and bs=N) are no larger than SSIZE_MAX.
9769         (skip, dd_copy): Adapt to new safe_read ABI.
9770
9771         * Makefile.maint (signatures): Define.
9772         (%.sig): New rule.
9773         (announcement): Depend on $(signatures).
9774
9775         * Makefile.maint (announcement): Output all URLs for detached
9776         signatures, not just the last one from the previous loop.
9777
9778 2002-10-05  Jim Meyering  <jim@meyering.net>
9779
9780         * Version 4.5.2.
9781
9782         * src/remove.c (remove_entry) [ROOT_CAN_UNLINK_DIRS]: With `rm -i DIR',
9783         don't recurse into directory, DIR.  Prompted by a report from
9784         Leonardo Milano.
9785
9786         * tests/rm/i-no-r: New file/test, for the above fix.
9787         * tests/rm/Makefile.am (TESTS): Add i-no-r.
9788
9789         * tests/tail-2/big-4gb: New file/test, for the fix of 2002-09-27.
9790         * tests/tail-2/Makefile.am (TESTS): Add big-4gb.
9791
9792 2002-10-03  Jim Meyering  <jim@meyering.net>
9793
9794         * src/rm.c (AUTHORS): Mark translatable string with `N_ (...)'.
9795         * src/df.c (AUTHORS): Likewise.
9796         * src/du.c (AUTHORS): Likewise.
9797         * src/tail.c (AUTHORS): Likewise.
9798         * src/touch.c (AUTHORS): Likewise.
9799
9800 2002-10-02  Jim Meyering  <jim@meyering.net>
9801
9802         * Makefile.am (SUBDIRS): Remove `old'.
9803         (EXTRA_DIST): List the files in old/.
9804         * configure.ac (AC_CONFIG_FILES): Remove old/* names.
9805         Suggestion from Akim Demaille.
9806
9807 2002-10-01  Jim Meyering  <jim@meyering.net>
9808
9809         * src/sys2.h (SSIZE_MAX): Define.
9810
9811 2002-09-30  Jim Meyering  <jim@meyering.net>
9812
9813         * src/csplit.c: Don't include stdlib.h here.  It's already included
9814         via system.h.
9815
9816 2002-09-29  Jim Meyering  <jim@meyering.net>
9817
9818         * src/tr.c (find_bracketed_repeat): Rearrange pointer/integer
9819         expression to avoid bogus warning from gcc.
9820
9821         * src/cat.c (simple_cat): Use a temporary to avoid bogus warnings.
9822         (cat): Declare insize and outsize to be of type size_t, not int.
9823         Rearrange pointer/integer expressions to avoid bogus warnings.
9824         (main): Declare insize and outsize to be of type size_t, not int.
9825
9826         * src/tail.c (parse_options): Give a sensible diagnostic for
9827         an invalid byte or line count.  Reported by Mikko Tuumanen.
9828
9829         * src/touch.c (main): Split a long line.
9830
9831         * tests/du/Makefile.am (TESTS): Add slink.
9832         * tests/du/slink: New test for system.h change of 2002-08-31.
9833
9834         In move mode, always first try to rename.  Before, upon failure to
9835         rename a directory, this code would never attempt to rename any
9836         other file in that directory, but would thenceforth always copy.
9837         On some systems (e.g., NetApp's OnTap-6.4), renaming a directory
9838         may fail with EXDEV, yet renaming files within that directory to
9839         a newly-created destination directory succeeds.
9840         * src/copy.c (copy_internal): Remove local, move_mode;
9841         use x->move_mode instead.  Based on a patch from Tom Haynes.
9842
9843 2002-09-28  Jim Meyering  <jim@meyering.net>
9844
9845         * src/split.c (FAIL_ONLY_ONE_WAY): New macro.
9846         Factor out some duplication.
9847         (main): Use it.
9848         [case 'a']: Use strtoul rather than strtol to avoid compiler warnings.
9849
9850         * src/sort.c (begfield, limfield): Rearrange comparisons to avoid
9851         compiler warnings.
9852         (fillbuf, keycompare): Cast literal `-1' to size_t in comparisons,
9853         to avoid compiler warnings.
9854
9855         * src/shred.c (dopass): Use a uintmax_t temporary to avoid bogus
9856         compiler warnings.
9857
9858         Fix things so `mkdir -p' can create very deep directories, e.g.,
9859         mkdir -p $(perl -e 'print "a/" x 40000') now works.
9860         * src/mkdir.c (main): For --parents (-p), call make_path with the
9861         entire directory name, so we don't ever require that file operations
9862         like stat or chmod be performed on the entire command line argument.
9863         * makepath.c (make_path): Restore umask *before* creating the final
9864         component.
9865
9866 2002-09-27  Andreas Schwab  <schwab@suse.de>
9867
9868         * src/tail.c (tail_bytes): Change type of bytes_remaining to off_t
9869         to avoid overflow.  Reported by Hans Lermen.
9870
9871 2002-09-26  Jim Meyering  <jim@meyering.net>
9872
9873         * src/install.c (get_ids): Use strtoul, not strtol.  Remove some casts.
9874
9875 2002-09-25  Jim Meyering  <jim@meyering.net>
9876
9877         * src/test.c (eaccess): Change type of local `euid' from int to uid_t
9878         and add a cast, to avoid a warning about `signed and unsigned type in
9879         conditional expression'.
9880
9881 2002-09-22  Jim Meyering  <jim@meyering.net>
9882
9883         * src/rmdir.c: Include "dirname.h", for declaration of
9884         strip_trailing_slashes.
9885
9886         * src/stat.c (PRIdMAX, PRIuMAX): Remove definitions.
9887         Now they're defined through system.h.
9888
9889         * src/cp-hash.c, src/dd.c, src/df.c, src/du.c, src/ls.c,
9890         * src/stat.c, src/wc.c: Remove all inclusions of inttypes.h,
9891         since it's already included from sys2.h via system.h.
9892
9893         * Use automake-1.6f.  Regenerate dependent files.
9894
9895         * src/Makefile.am (PERL): Remove duplicate definition.
9896
9897         fmt's -s, -t, -c options didn't work properly for long lines.
9898         Since get_line may end up calling put_paragraph (for long lines),
9899         be sure to set global, `other_indent', before it is used there.
9900
9901         * src/fmt.c (set_other_indent): New function, factored out of...
9902         (get_paragraph): ... here.  Call it.
9903         (get_line): Call set_other_indent before calling flush_paragraph,
9904         which calls fmt_paragraph, which in turn calls put_paragraph,
9905         which uses other_indent.
9906
9907         * tests/fmt/Makefile.am (TESTS): Add long-line.
9908         * tests/fmt/long-line: New file/test, for the above fix.
9909
9910 2002-09-21  Jim Meyering  <jim@meyering.net>
9911
9912         * src/od.c: No longer include deprecated <values.h>.
9913         It was required solely for now-removed reference to BITSPERBYTE.
9914         * src/install.c: Likewise.
9915         Suggestion from Bruno Haible.
9916
9917 2002-09-06  Andreas Schwab  <schwab@suse.de>
9918
9919         `rmdir -p dir-specified-with-trailing-slash/' would fail.
9920         * src/rmdir.c (remove_parents): Strip trailing slashes.
9921
9922 2002-09-20  Jim Meyering  <jim@meyering.net>
9923
9924         * tests/rmdir/t-slash: New file/test, for the above fix.
9925         * tests/rmdir/Makefile.am (TESTS): Add t-slash.
9926
9927         * Makefile.maint (announcement): Arrange to gpg-sign the message.
9928         Add a URL for each detached signature file.
9929
9930 2002-09-07  Bruno Haible  <bruno@clisp.org>
9931
9932         * configure.ac: Add need-ngettext to AM_GNU_GETTEXT invocation.
9933
9934 2002-09-18  Jim Meyering  <jim@meyering.net>
9935
9936         `od -t x8' used the wrong (`l'-prefixed) printf format.
9937         Likewise for the o8 and u8 formats.
9938         * src/od.c (ISPEC_TO_FORMAT): Define macro.
9939         (decode_one_format): Use PRIdMAX, PRIoMAX, etc. for LONG_LONG.
9940         Reported by Arun Sharma.
9941
9942 2002-09-17  Jim Meyering  <jim@meyering.net>
9943
9944         * src/sys2.h (PRIdMAX, PRIoMAX, PRIuMAX, PRIxMAX): Define if necessary.
9945         From gettext's intl/loadmsgcat.c.
9946
9947         * tests/od/x8: New file/test, for the above fix.
9948         * tests/od/Makefile.am (TESTS): Add x8.
9949
9950 2002-09-15  Jim Meyering  <jim@meyering.net>
9951
9952         * Use autoconf-2.54.  Regenerate dependent files.
9953
9954         * src/csplit.c (get_format_width): Add cast to avoid
9955         warning about `signed and unsigned type in conditional expression'.
9956
9957 2002-09-14  Jim Meyering  <jim@meyering.net>
9958
9959         * src/who.c (print_user): Change type of local to size_t
9960         to avoid warnings about `comparison between signed and unsigned'.
9961         * src/ptx.c (generate_all_output): Likewise.
9962
9963         * src/dd.c (main, skip): Add casts to avoid warnings about
9964         `comparison between signed and unsigned'.
9965
9966         * src/id.c (print_full_info, print_group_list): Add casts to avoid
9967         warnings about `signed and unsigned type in conditional expression'.
9968
9969         * src/md5sum.c: Change type of global, digest_hex_bytes, to size_t
9970         to avoid warnings about `comparison between signed and unsigned'.
9971         (split_3): Change parameter names to be readable and add comment.
9972         Clean up the test for whether a line may be ignored.
9973
9974 2002-09-13  Jim Meyering  <jim@meyering.net>
9975
9976         * src/printf.c (main): Handle leading command line argument of `--'.
9977         Reported by Raul: DervishD <raul@pleyades.net>
9978         * tests/misc/printf: New file: test for the above.
9979         * tests/misc/Makefile.am (TESTS): Add printf.
9980
9981         * src/date.c (usage): Explain that %S's range of [0..60] is required --
9982         rather than 0..59 -- to accommodate the occasional positive leap second.
9983         Reported by Richard Neill.
9984
9985 2002-09-12  Jim Meyering  <jim@meyering.net>
9986
9987         * src/Makefile.am (nanosec_libs): Define.
9988         (sleep_LDADD, tail_LDADD): Use it here.
9989
9990         Factor nanosleep-related code into ../lib/xnanosleep.c.
9991         * src/sleep.c: Include xnanosleep.h.
9992         Factor out fenv.h-related code.
9993         (timespec_subtract): Remove function.
9994         (main): Remove code that deals with computing start and stop times
9995         as well as the loop around nanosleep.  Now that's in xnanosleep.c.
9996
9997         Allow S (in --sleep-interval=S) to be a floating point value.
9998         * src/tail.c: Include xnanosleep.h and xstrtod.h.
9999         Move declaration of global variable, sleep_interval, to ...
10000         (main): ...here.
10001         (usage): Update description of --sleep-interval option.
10002         (tail_forever): New parameter, sleep_interval.  Update caller.
10003         Use xnanosleep, rather than sleep.
10004         (parse_options): New parameter, sleep_interval.  Update caller.
10005         Use xstrtod, now that we accept floating point values.
10006         Prompted by a patch from Augey Mikus.
10007
10008 2002-09-06  Jim Meyering  <jim@meyering.net>
10009
10010         * src/remove.c (prompt): Change comment to give a better note to
10011         translators.  From Michael Piefel.
10012
10013 2002-09-02  Jim Meyering  <jim@meyering.net>
10014
10015         * README: A good problem report/patch includes diffs against
10016         the most recent test release.
10017
10018         * src/pathchk.c (NEED_PATHCONF_WRAPPER): Define.
10019         (pathconf_wrapper): Define only if NEED_PATHCONF_WRAPPER is set.
10020
10021         * src/kill.c (print_table_row): Use an unsigned type for widths
10022         to avoid warning about comparison between signed and unsigned.
10023         (list_signals): Likewise.
10024
10025         * src/od.c (skip): Add a cast to avoid warning about comparison
10026         between signed and unsigned.
10027         * src/install.c (get_ids): Likewise.  Also rearrange range-checking
10028         comparisons to make them more readable.
10029
10030 2002-09-01  Jim Meyering  <jim@meyering.net>
10031
10032         * Version 4.5.1.
10033
10034 2002-08-31  Jim Meyering  <jim@meyering.net>
10035
10036         Symlinks were always reported as using 0 blocks.
10037         * src/system.h (ST_NBLOCKS): Don't depend on file type.
10038         This reverts the change of 2000-01-30.
10039         Based on a report and patch from Neil Brown via Michael Stone.
10040         This fixes Debian Bug#156358.
10041
10042         * Most files: Change `exit (0)' to `exit (EXIT_SUCCESS)',
10043         `exit (1)' to `exit (EXIT_FAILURE)', and
10044         `usage (1)' to `usage (EXIT_FAILURE)'.
10045
10046         * chgrp.c, chmod.c, chown.c, chroot.c, cp.c, date.c, dd.c, du.c,
10047         * hostname.c, id.c, install.c, ln.c, mkdir.c, mkfifo.c, mknod.c,
10048         * nice.c, pinky.c, printf.c, pwd.c, shred.c, sleep.c, stty.c,
10049         * su.c, tac-pipe.c, tail.c, tee.c, touch.c, uname.c, uptime.c,
10050         * users.c, who.c: Change `error (1, ...' to `error (EXIT_FAILURE, ...'.
10051         But don't change `error (0, ...' to `error (EXIT_SUCCESS, ...', since
10052         error never exits successfully.
10053
10054 2002-08-29  Jim Meyering  <jim@meyering.net>
10055
10056         * src/remove.c (remove_cwd_entries): Use closedir (not CLOSEDIR)
10057         when ignoring any return value.
10058
10059         * src/remove.c (remove_cwd_entries): Detect and diagnose readdir
10060         failures.  On some systems (at least EMC Celerra and Solaris5.8),
10061         this appears to be necessary.
10062         (is_empty_dir): Likewise.  Also, always close directory handle.
10063         * src/ls.c (print_dir): Likewise.
10064         (print_dir): Rename local variable: reading -> dirp.
10065         Reported by Mike Coleman.
10066
10067 2002-08-28  Jim Meyering  <jim@meyering.net>
10068
10069         * src/remove.c (remove_cwd_entries): Use CLOSEDIR, not closedir.
10070         Give a diagnostic and fail if closedir fails.
10071
10072 2002-08-26  Jim Meyering  <jim@meyering.net>
10073
10074         * Makefile.am (THANKS-to-translators): New rule.
10075         (EXTRA_DIST): Add both THANKS-to-translators and THANKStt.in.
10076         * THANKStt.in: New file.
10077
10078         * src/cat.c (close_stdout_wrapper): New, kludgey, function and
10079         file-scoped global.
10080         (main): Register it with atexit.
10081         Close STDOUT_FILENO, to avoid a problem when writing to
10082         /dev/audio on at least Solaris 5.7 and 5.8 systems.
10083         Reported by Shing-Shong Shei.
10084
10085 2002-08-25  Jim Meyering  <jim@meyering.net>
10086
10087         * src/cat.c (main): Close STDIN_FILENO rather than a literal `0'.
10088         * src/tac.c (main): Likewise.
10089         * src/tail.c (main): Likewise.
10090         * src/tee.c (main): Likewise.
10091         * src/tr.c (main): Likewise.
10092         * src/wc.c (main): Likewise.
10093
10094 2002-08-20  Jim Meyering  <jim@meyering.net>
10095
10096         * tests/mv/setup: Rewrite not to use `: ${VAR=not_set}' paradigm.
10097
10098 2002-08-10  Paul Eggert  <eggert@twinsun.com>
10099
10100         * src/nohup.sh: Don't use "exec --"; it's not portable and
10101         shouldn't be needed.
10102
10103 2002-08-09  Jim Meyering  <jim@meyering.net>
10104
10105         * src/pr.c (main): Don't ignore -COLUMN if it's the last option.
10106         (usage): Clarify help text for the -COLUMN option.
10107         Patch by Padraig Brady.
10108         * tests/pr/Test.pm [col-last]: New test for the above.
10109
10110         * configure.ac: Start with version 4.5.1, chosen so that it's larger
10111         than the latest version numbers of the component packages.
10112
10113         * man/Makefile.am (check-x-vs-1): Set and export PATH so we use
10114         programs in ../src.
10115
10116 2002-08-08  Jim Meyering  <jim@meyering.net>
10117
10118         * src/date.c: Guard inclusion of <langinfo.h> with
10119         `#if HAVE_LANGINFO_CODESET', not `#if HAVE_LANGINFO_H'.
10120         * src/sort.c: Likewise.
10121         Patch by GOTO Masanori.
10122
10123 2002-08-05  Paul Eggert  <eggert@twinsun.com>
10124
10125         Fix some minor time-related bugs with POSIX time arguments.
10126         Some valid time stamps were being rejected (notably -1, and
10127         time stamps before 1900 on 64-bit hosts).  And some invalid
10128         time stamps were being accepted, e.g. September 31.
10129
10130         * src/date.c (main): Adjust to posixtime signature change.
10131         * src/touch.c (main): Likewise.  Remove unnecessary initialization.
10132         Use localtime, not posixtm, to warn about obsolete "touch".
10133
10134 2002-08-05  Jim Meyering  <jim@meyering.net>
10135
10136         * tests/misc/Makefile.am (TESTS): Add nice and pathchk1.
10137
10138 2002-08-04  Jim Meyering  <jim@meyering.net>
10139
10140         * src/Makefile.am (check-README): New target/rule.
10141         (check): Depend on it.
10142
10143         * configure.ac (AC_CONFIG_FILES): Add old/Makefile and old/*/Makefile.
10144
10145 2002-08-03  Jim Meyering  <jim@meyering.net>
10146
10147         * Makefile.am (SUBDIRS): Add old.
10148         * old/: New directory, containing legacy ChangeLog* and NEWS files
10149         from the fileutils, sh-utils, and textutils packages.
10150
10151         * src/Makefile.am (AM_INSTALLCHECK_STD_OPTIONS_EXEMPT): Set to false.
10152
10153 2002-08-02  Paul Eggert  <eggert@twinsun.com>
10154
10155         * NEWS, doc/coreutils.texi: uniq now obeys LC_COLLATE.
10156
10157         * src/uniq.c: Include hard-locale.h, xmemcoll.h.
10158         (hard_LC_COLLATE): New var.
10159         (different): Args are now char *, not const char *.
10160         Use xmemcoll instead of memcmp to compare lines, so that
10161         LC_COLLATE has effect.  However, use memcmp if it is an
10162         easy locale.
10163         (check_file): Do not include newline in comparison, so that
10164         xmemcoll has a byte to stomp on temporarily.
10165         (main): Set hard_LC_COLLATE.
10166
10167 2002-07-29  Jim Meyering  <jim@meyering.net>
10168
10169         * Makefile.am (SUBDIRS): Remove djgpp, for now.
10170
10171 2002-07-20  Jim Meyering  <jim@meyering.net>
10172
10173         * Makefile.am (false.c): Convert only the final EXIT_SUCCESS
10174         into EXIT_FAILURE.  Otherwise, false --help and false --version
10175         would fail.
10176
10177 2002-07-08  Jim Meyering  <jim@meyering.net>
10178
10179         * src/Makefile.am (uninstall-local): Search for @GNU_PACKAGE@,
10180         rather than the hard-coded `sh-utils'.
10181
10182 2002-07-01  Jim Meyering  <jim@meyering.net>
10183
10184         * configure.ac: Merge the three files from fileutils,
10185         textutils, and sh-utils.
10186         * Makefile.am: Likewise.
10187         * src/Makefile.am: Likewise.