b3efe6b525057f7072d70f93091b6418dc8d5ee3
[platform/upstream/coreutils.git] / ChangeLog
1 2004-04-13  Jim Meyering  <jim@meyering.net>
2
3         * Version 5.3.0.
4
5         * configure.ac: Change `jm_' in AC_DEFINE'd names to `gl_'.
6
7 2004-03-27  Paul Eggert  <eggert@twinsun.com>
8
9         * NEWS: cp -pu and mv -u (when copying) now take the destination
10         file system time stamp resolution into account.
11         * doc/coreutils.texi (mv invocation): Document this.
12         (cp invocation): Document -u (it was missing!) with new behavior.
13
14         * src/copy.c: Include "utimecmp.h".
15         (copy_internal): Compare time stamps using utimecmp rather than
16         MTIME_CMP.
17
18 2004-04-09  Jim Meyering  <jim@meyering.net>
19
20         * Makefile.maint (.re-list): New rule/file, to replace
21         hard-coded list of header file names.
22         (sc_system_h_headers): Use the new file.
23         Don't look for sys2.h anymore.
24
25         * src/system.h: Include new "stat-macros.h" rather than hard-coding
26         all of its macro definitions -- the list was slightly out of date.
27         Suggestion from Dmitry V. Levin.
28
29 2004-04-08  Paul Eggert  <eggert@cs.ucla.edu>
30
31         * NEWS: Remove noctty flag from dd.  Suggested by Philippe Troin.
32         * doc/coreutils.texi (dd invocation): Likewise.
33         * src/shred.c (O_NOCTTY): Remove redundant decl.
34         * src/dd.c (flags, usage): Remove noctty flag.
35         (main): Always use O_NOCTTY when opening files.
36
37 2004-04-08  Jim Meyering  <jim@meyering.net>
38
39         * src/dd.c (dd_copy): Mark two diagnostics for translations.
40         (set_fd_flags): Undo part of today's change: it's a little
41         cleaner -- and more efficient in the common case -- to go
42         ahead and OR in the -1 when fcntl fails.
43
44         * Makefile.maint (sc_dd_max_sym_length): New target.
45         (syntax-check-rules): Add it.
46
47         * src/md5sum.c (PROGRAM_NAME) [algorithm == ALG_SHA1]:
48         Correct spelling: s/shasum/sha1sum.  Reported by Jesse Kornblum.
49
50         * src/dd.c (set_fd_flags): Don't OR in -1 when fcntl fails.
51         Rename parameter, flags, to avoid shadowing global.
52         (LONGEST_SYMBOL): Tweak comment.
53
54 2004-04-07  Paul Eggert  <eggert@twinsun.com>
55
56         * NEWS: New dd conv= symbols nocreat, excl, fdatasync, fsync,
57         and new dd options iflag= and oflag=.
58         * src/dd.c (usage): Likewise.
59         * src/Makefile.am (dd_LDADD, shred_LDADD): Add fdatasync's lib.
60         * src/dd.c (fdatasync) [!HAVE_FDATASYNC]: New macro.
61         (C_NOCREAT, C_EXCL, C_FDATASYNC, C_FSYNC): New macros.
62         (input_flags, output_flags): New vars.
63         (LONGEST_SYMBOL): New macro.
64         (struct symbol_value): Renamed from struct conversion.  Members
65         symbol and value renamed from convname and conversion.  The
66         symbol value is now an array instead of a pointer; this saves
67         a bit of space and time in practice.  All uses changed.
68         (conversions): Add nocreat, excl, fdatasync, fsync.  Now const.
69         (flags): New constant array.
70         (iflag_error_msgid, oflag_error_msgid): New constants.
71         (parse_symbols): Renamed from parse_conversion and generalized
72         to handle either conversion or flag symbols.
73         (scanargs): Adjust uses of parse_symbols accodingly.  Add
74         support for iflag= and oflag=.  Reject attempts to use
75         both excl and nocreat.
76         (set_fd_flags): New function.
77         (dd_copy): Just return X rather than calling quit (X), since our
78         caller invokes quit with the returned value.  Add support for
79         fdatasync and fsync.
80         (main): Add support for iflag=, oflag=, and new conv= symbols.
81         * src/system.h (O_DIRECT, O_DSYNC, O_NDELAY, O_NOFOLLOW,
82         O_RSYNC, O_SYNC): Define to 0 if not already defined.
83
84         * NEWS: Remove duplicate mention of BLOCKSIZE.
85
86 2004-04-02  Andreas Schwab  <schwab@suse.de>
87
88         * src/stty.c: Add support for IUTF8 input flag.
89
90 2004-04-06  Jim Meyering  <jim@meyering.net>
91
92         * src/system.h (makedev) [mkdev && !makedev]: Define in terms of mkdev.
93         Interix spells it `mkdev'.  Reported by Mark Funkenhauser.
94
95 2004-04-04  Jim Meyering  <jim@meyering.net>
96
97         A specified format is no longer automatically newline terminated.
98         If you want a newline at the end of your format, use `\n'.
99         * src/stat.c (print_it): Don't print a newline at the end of
100         every format.
101         (do_statfs): Add a newline at end of each default format string.
102
103 2004-03-30  Paul Eggert  <eggert@twinsun.com>
104
105         * src/nohup.c (main): Adjust to new calling convention
106         for set_cloexec_flag.
107
108 2004-03-31  Jim Meyering  <jim@meyering.net>
109
110         * tests/Fetish.pm (run_tests): Remove `.orig' file.
111         Remove debugging diagnostic.
112
113         Specifying an invalid --width=N (-w) or --gap-size=N (-g)
114         would not elicit an error.
115         * src/ptx.c: Include "xstrtol.h" and "quotearg.h".
116         (main): Don't use atoi.  Use xstrtoul instead.
117
118 2004-03-30  Jim Meyering  <jim@meyering.net>
119
120         * Makefile.maint (sc_prohibit_atoi_atof): New rule.
121         (syntax-check-rules): Add it.
122         * .x-sc_prohibit_atoi_atof: New file.
123
124 2004-03-29  Jim Meyering  <jim@meyering.net>
125
126         * tests/du/files0-from: Use new OUT_SUBST directive, so that this
127         test is not sensitive to system-dependent block size differences.
128         Prompted by a report of Solaris 8 differences from Paul Eggert.
129
130         * tests/Fetish.pm: Accept new directives: OUT_SUBST, ERR_SUBST.
131         Rename `%tmp' to `%actual'.  Reverse order of last two args to
132         _compare_files (to $actual, $expected) so as to match declaration.
133
134 2004-03-28  Paul Eggert  <eggert@twinsun.com>
135
136         Fix some gotchas encountered when porting to Solaris 8, using
137         the Forte 6u2 compiler.
138
139         * src/hostname.c [HAVE_SETHOSTNAME && !defined sethostname]:
140         Declare sethostname, since no Solaris header does it.
141         * src/who.c: Include "vasprintf.h", for asprintf.
142
143 2004-03-28  Jim Meyering  <jim@meyering.net>
144
145         Minor optimization:
146         * src/du.c (process_file): Don't record dev/inode for directories.
147
148         Under some circumstances, without -c, du would mistakenly count the
149         space of hard-linked files, not just the first one it encountered.
150         Reported by Anthony Thyssen.
151         * src/du.c (du_files): Don't ever clear the set of `seen' dev/inodes.
152
153         * src/du.c: Rename global `print_totals' to `print_grand_total'.
154
155         * src/du.c (main): Rearrange filtering loop to be a tiny bit
156         more efficient.
157
158         * src/chown-core.c: Don't include savedir.h -- no longer needed.
159         * src/chmod.c: Likewise.
160
161 2004-03-25  Jim Meyering  <jim@meyering.net>
162
163         * src/du.c (main): Remove now-unused declaration of `i'.
164
165 2004-03-24  Paul Eggert  <eggert@twinsun.com>
166
167         * src/du.c (main): Filter out file names of length zero before
168         invoking fts, so that they don't cause fatal errors.
169
170 2004-03-25  Jim Meyering  <jim@meyering.net>
171
172         * tests/du/files0-from (zero-len): Add a test for the above.
173
174 2004-02-25  Paul Eggert  <eggert@twinsun.com>
175
176         * NEWS: New environment var BLOCKSIZE.
177         * lib/human.c (humblock): Support BLOCKSIZE as well as BLOCK_SIZE.
178         * tests/envvar-check: Test for it.  Factor the code to simplify it.
179
180 2004-03-23  Paul Eggert  <eggert@twinsun.com>
181
182         * NEWS: Shorten the du --files0-from announcement, and say
183         "NUL-terminated" rather than "NUL-separated".
184         * src/du.c (EXPECTED_BYTES_PER_FILE_NAME, DEFAULT_PROJECTED_N_FILES):
185         Remove: not used.
186         (usage): Say "NUL-terminated", not "NUL-separated".
187         (main): Check for I/O error when istream is closed.
188         Allow --files0-from=F even if F is empty; this specifies no files.
189         (du_files): Now that we allow the list of files to be empty,
190         handle that case.
191         * tests/du/files0-from: Adjust to above changes to src/du.c.
192
193 2004-03-24  Jim Meyering  <jim@meyering.net>
194
195         * tests/tail-2/assert: Avoid race condition that could cause
196         spurious failure.  Based on a patch from Andreas Schwab.
197
198 2004-03-23  Jim Meyering  <jim@meyering.net>
199
200         * src/du.c (main): Free the hash table, too.
201
202 2004-03-22  Jim Meyering  <jim@meyering.net>
203
204         * man/Makefile.am (.x.1): Remove --info-page= option, reverting
205         the change of 2004-01-22.  I can no longer reproduce the problem
206         that prompted that change, and `info coreutils pr' would display the
207         `printing text' section of the manual, not the one on `pr invocation'.
208
209         * tests/du/files0-from (nul-1, nul-2): Adjust expected diagnostics
210         to match corrected output.
211
212         * src/du.c: Include "readtokens0.h" rather than "readtokens.h".
213         (main): Use readtoken0 functions rather than readtokens.
214         Don't use errno when diagnosing readtokens0 failure.
215         Fix off-by-one error in the token number reported in a diagnostic.
216         (du_files): Return bool, rather than int.
217         (main): Call readtokens0_free.
218
219 2004-03-21  Jim Meyering  <jim@meyering.net>
220
221         * src/remove.c (ds_free): Plug a small leak.
222
223         * tests/Fetish.pm: Fix typo in comment.
224
225 2004-03-07  Jim Meyering  <jim@meyering.net>
226
227         * NEWS: du accepts a new option --files0-from=FILE, where FILE
228         contains a list of NUL-separated file names.
229
230         * src/du.c: Include "readtokens.h".
231         (usage): Describe the new option, and adjust the `Usage':
232         with this option, no FILE may be specified on the command line.
233         (main): Handle the new option.
234
235         * tests/du/files0-from: New tests, for the above.
236         * tests/du/Makefile.am (TESTS): Add files0-from.
237
238         * src/factor.c (do_stdin): Reflect changes in use of readtoken.
239         * src/tsort.c (tsort): Likewise.
240
241 2004-02-29  Paul Eggert  <eggert@twinsun.com>
242
243         * NEWS: Add support for a new notation @N to get_date to represent
244         the time stamp with numeric value N.  Improve support for
245         fractional time stamps.  date's -d and -f options now accept them.
246         Likewise for touch -t.  date has a new option --iso-8601=ns.
247
248         * doc/coreutils.texi (touch invocation):
249         Describe use of fractional seconds.
250         (date invocation, Options for date): Likewise.
251         * doc/getdate.texi (General date syntax, Time of day items): Likewise.
252         * doc/coreutils.texi (date invocation): Mention effect of LC_TIME.
253         (Options for date): Describe new --iso-8601=ns option.
254
255         * doc/getdate.texi: Add copyright notice.  Change getdate to
256         get_date when talking about the function name.
257         (Seconds since the Epoch): New section, containing the time_t
258         info moved from Date input formats section, along with new
259         info about the @ syntax.  Mention negative time stamps,
260         fractional time stamps, and leap seconds.
261         (General date syntax): Modernize examples a bit to reflect new
262         features.
263         (General date syntax, Relative items in date strings):
264         Use ' rather than " to quote formats.
265         (Time of day items): Add an example with fractional seconds.
266         Describe fractional-second syntax.
267
268         * src/Makefile.am (touch_LDADD): New macro, since `touch' now
269         needs clock_gettime.
270
271         * src/date.c (enum Time_spec): New enum TIME_SPEC_NS.
272         (time_spec_string, time_spec, show_date): Support it.
273         (usage): Remove description of -ITIMESPEC, as it's obsolete and
274         confusing.  Mention --iso-8601=ns.
275         (batch_convert): getline returns ssize_t, not int.
276
277         * src/touch.c (newtime): Now an array of two timespecs, one
278         for access and one for modification.
279         (ref_stats): Remove.
280         (get_reldate): Use get_date's parameter profile.
281         (touch, main): Adjust to above changes.
282         (main): Work even if tm_year == INT_MAX (so long as long int is wider).
283         Use gettime instead of gettimeofday, for new get_date signature.
284
285         * tests/date/Test.pm (test_vector): New tests epoch, ns-10, ns-max32,
286         ns-relative.
287
288 2004-03-15  Jim Meyering  <jim@meyering.net>
289
290         * Makefile.maint (alpha beta major): `Make' the emit_upload_commands
291         target before updating $(prev_version_file).
292
293         * tests/misc/date-sec: New file, to test for just-fixed bug in date.
294         See today's change in lib/getdate.y.
295         * tests/misc/Makefile.am (TESTS): Add date-sec.
296
297 2004-03-14  Jim Meyering  <jim@meyering.net>
298
299         * announce-gen (print_changelog_deltas): Use `.sig' suffix for
300         signature files, not `.asc'.  Reported by angico@yahoo.com.
301
302 2004-03-13  Jim Meyering  <jim@meyering.net>
303
304         * src/cp.c (do_copy): Tweak wording in a diagnostic.
305         Suggestion from Karl Berry.
306         Include "quoatearg.h".
307         (do_copy): Use quotearg_colon (not quote) for diagnostics
308         that begin with `"%s:'.
309
310         * src/nl.c (usage): Specify that nl uses _basic_ regular expressions.
311         Suggestion from Dan Jacobson.
312
313 2004-03-12  Jim Meyering  <jim@meyering.net>
314
315         * Version 5.2.1.
316
317         Sometimes, when source and destination partition are different,
318         mv mistakenly fails to preserve a hard link.  Reported by IIDA Yosiaki.
319
320         * src/copy.c: When moving a set of N hard-linked files between
321         partitions, via two or more command line arguments where the
322         command line argument containing the Nth link contains no other
323         link to that same file, mv would mistakenly copy the file, rather
324         than hard-linking it to the other(s).  That happens because when the
325         final link is processed, its link count has been reduced to 1 since
326         the other links have been `copied' to the destination partition
327         and the source links have been removed.
328         (copy_internal): When in move mode, use the source dev/inode
329         pair to look up destination name even when st_nlink == 1.
330         * src/cp-hash.c (src_to_dest_lookup): New function.
331         * src/cp-hash.h (src_to_dest_lookup): Add prototype.
332         * tests/mv/part-hardlink: New file.  Test for the above fix.
333         * tests/mv/Makefile.am (TESTS): Add part-hardlink.
334
335         * announce-gen: Sync with autoconf.
336
337         * tests/ls/time-1: Exit 77 (not 1) if we can't set up for the test.
338         This was triggered on a Linux-2.2.19 system using a file system
339         NFS-mounted from some sort of Sun.
340
341 2004-03-11  Jim Meyering  <jim@meyering.net>
342
343         * Use automake-1.8.3.  Regenerate dependent files.
344
345 2004-03-10  Jim Meyering  <jim@meyering.net>
346
347         * tests/du/deref-args: Also convert sizes in the 70-79 kB range,
348         so that this test works with SELinux-enabled systems.
349         Based on a patch from Tim Waugh.
350
351         `join -1 x' would give a misleading diagnostic
352         * src/join.c (string_to_join_field): Report that a non-numeric field
353         number is invalid, rather than `so large that it is not representable'.
354         * tests/join/Test.pm (invalid-j): New partial test for the above fix.
355
356 2004-03-06  Jim Meyering  <jim@meyering.net>
357
358         cp --sparse=always sparse-image-file.img /dev/hda1 could
359         produce an invalid copy on the destination device.
360
361         * src/copy.c (copy_reg): Even with --sparse=always, try to
362         make `holes' only if the destination is a regular file.
363         Reported by Szakacsits Szabolcs.
364
365 2004-03-03  Paul Eggert  <eggert@twinsun.com>
366
367         * src/nohup.c (main): Don't invoke set_cloexec_flag with
368         a file descriptor of -1.
369
370 2004-03-02  Dmitry V. Levin  <ldv@altlinux.org>
371
372         * src/nohup.c: Include "cloexec.h".
373         (main): Set the copy of stderr to close on exec.
374
375 2004-03-01  Paul Eggert  <eggert@twinsun.com>
376
377         * configure.ac: Include <signal.h> when checking for strsignal,
378         sys_siglist, and friends.  Problem reported by Tony Leneis in
379         <http://mail.gnu.org/archive/html/bug-coreutils/2004-02/msg00136.html>.
380
381 2004-02-25  Paul Eggert  <eggert@twinsun.com>
382
383         * tests/du/deref-args, tests/du/exclude, tests/du/slash:
384         * tests/du/trailing-slash: Run envvar-check in case BLOCK_SIZE
385         etc. are set.
386
387 2004-02-23  Paul Eggert  <eggert@twinsun.com>
388
389         * NEWS: Document how chown's USER.GROUP argument is now parsed.
390
391 2004-02-23  Jim Meyering  <jim@meyering.net>
392
393         * src/seq.c (usage): Remove stray space after \n in --help output.
394
395 2004-02-22  Jim Meyering  <jim@meyering.net>
396
397         * src/du.c (usage): Separate -H and --si.  Say that the meaning
398         of -H will soon change to that of --dereference-args (-D).
399
400 2004-02-21  Jim Meyering  <jim@meyering.net>
401
402         * src/comm.c (usage): Tell what comm does when there are no options.
403         Reword in terms of FILE1 and FILE2 rather than `left file' and
404         `right file'.  Suggestion from Dan Jacobson.
405
406 2004-02-15  Paul Eggert  <eggert@twinsun.com>
407
408         Fix some POSIX-conformance bugs in expr.
409
410         * NEWS: document the following changes to src/expr.c.
411         * doc/coreutils.texi (expr invocation): Likewise.
412         Document what forms integers may take, and say "integer"
413         consistently instead of "number".  Warn about operands
414         that "expr" can misinterpret, and how to work around the
415         problem.
416         * src/expr.c (eval, eval7, eval6, eval5, eval4, eval3, eval2, eval1):
417         Accept a bool argument specifying whether to evaluate the
418         expression.  This is to allow short-circuit evaluation.  All
419         callers changed.
420         (null): Report that a string is zero even if it has
421         a form like "-0" or "00".
422         (eval1, eval): Use short-circuit evaluation for | and &.
423         (eval): Return 0 if both arguments are null or zero, instead
424         of returning the first argument.
425         * tests/expr/basic: Add some tests for the above.
426
427 2004-02-17  Jim Meyering  <jim@meyering.net>
428
429         * Version 5.2.0.
430
431         `make check' from a build inside a chroot environment would fail
432         * tests/help-version: Specify an argument (`/') for df, in the
433         unusual event that there is no valid entry in /etc/mtab.
434         Likewise for id: add the -u option, so we don't get spurious
435         failures when there are no user or group names.
436         Patch by Tim Waugh.
437
438         * src/sort.c (usage) [-u]: Add punctuation so that the description in
439         the help2man-generated (line-joined) man page is more readable.
440         Reported by Tim Waugh.
441         [-T]: Add a semicolon, for the same reason.
442
443 2004-02-15  Jim Meyering  <jim@meyering.net>
444
445         * Makefile.am (dist-hook): Qualify target with $(srcdir)/ prefix.
446
447 2004-02-11  Jim Meyering  <jim@meyering.net>
448
449         * tests/Makefile.am.in ($(srcdir)/Makefile.am): Use more portable
450         $(srcdir)/../Makefile.am.in, rather than $<.
451         Suggestion from Michael Elizabeth Chastain.
452
453 2004-02-10  Jim Meyering  <jim@meyering.net>
454
455         * config/install-sh: Make this script executable.
456         * Makefile.am (dist-hook): New target, to ensure that config/install-sh
457         is executable.  Otherwise, on systems that lack a suitable install
458         binary, `make install' would fail, because of the way this script
459         is invoked (without `$SHELL ' prefix).
460         Reported by Bob Proulx.
461
462 2004-02-08  Jim Meyering  <jim@meyering.net>
463
464         * Version 5.1.3.
465
466         * tests/rm/rm5: Avoid triggering a bug in OSF/Tru64's sed
467         that would cause an unwarranted test failure.
468         * tests/rm/rm3: Likewise.
469
470 2004-02-07  Jim Meyering  <jim@meyering.net>
471
472         Remove xstat function pointer member.  The way it was used was not
473         portable, since some systems (OSF V5.1, Solaris 2.5.1) provide static
474         inline `stat' and `lstat' functions, thus making the tests of
475         `xstat == lstat' in copy.c always fail.
476         * src/copy.h (struct cp_options) [xstat]: Remove member.
477         (XSTAT): New macro.
478         * src/copy.c (copy_dir): Set `.dereference' member, not .xstat.
479         (copy_internal): Use `XSTAT (x, ...)' in place of `*(x->xstat) (...)'.
480         Use `x->dereference == DEREF_NEVER' in place of `x->xstat == lstat'.
481         (valid_options): Remove now-obsolete FIXME comments.
482
483         * src/cp.c (re_protect): Use `XSTAT (x, ...)' in place of
484         `*(x->xstat) (...)'.
485         (do_copy): Declare/use local xstat rather than x->xstat.
486         (main): Remove code that set x.xstat.
487         * src/mv.c (cp_option_init): Don't initialize xstat member.
488         * src/install.c (cp_option_init): Likewise.
489
490         * Makefile.cfg (gnu_ftp_host-alpha, etc.): Un-factor .gnu.org suffix,
491         so that emit_upload_commands can use these variables, too.
492
493 2004-02-06  Jim Meyering  <jim@meyering.net>
494
495         * tests/rm/deep-1: Remove `du' stack space test.
496         Apparently, `ulimit -s N' isn't portable enough.
497         This test will be restored (with a guard against losing ulimit)
498         in its own file later.
499
500         * tests/rm/deep-1 (deep): Remove progress-style diagnostics,
501         since this test doesn't take long enough to merit them.
502         Run du on $tmp (the containing dir), not $deep, the full path to leaf.
503
504         * Makefile.maint (signatures): Remove definition.
505         Now, automake's gnupload handles this.
506         (%.sig: %): Remove now-unused rule.
507         (rel-files): Use automake's $(DIST_ARCHIVES), rather than
508         `$(distdir).tar.bz2 $(distdir).tar.gz'.
509         (emit-upload-commands): Adjust to use gnupload.
510
511 2004-02-05  Jim Meyering  <jim@meyering.net>
512
513         * src/system.h (ST_TIME_CMP_NS, ST_TIME_CMP): Remove definitions.
514         (ATIME_CMP, CTIME_CMP, MTIME_CMP, TIMESPEC_NS): Likewise.
515         Now, those are all defined in timespec.h.
516         Include timespec.h.
517
518         * src/date.c: Don't include timespec.h, now that system.h does it.
519
520 2004-02-02  Paul Eggert  <eggert@twinsun.com>
521
522         Don't dump core if localtime returns NULL (possible on
523         hosts with 64-bit time_t and 32-bit int).
524         * src/date.c: Include "inttostr.h".
525         (batch_convert, main):
526         If time conversion fails, exit with nonzero status.
527         (show_date): Return int to report conversion failure.
528         Print the time as an int if localtime fails.
529         * src/uptime.c: Print "??" if the current clock can't
530         be converted by localtime.  This won't happen until the year
531         2*31 + 1900, but we don't want to dump core even if the current
532         clock has the wrong value.
533
534         * src/stat.c: Include "inttostr.h".
535         (human_time): Print the date/time as a number of seconds since the
536         epoch if it can't be converted by localtime.  This is better than
537         just saying "invalid", and is consistent with what "ls" does.
538         Don't dump core if the year has more than 48 digits; this isn't
539         possible on any contemporary host, but we might as well do it right.
540
541 2004-01-31  Paul Eggert  <eggert@twinsun.com>
542
543         * src/stat.c (human_time): Accept time rather than
544         pointer-to-const-time parameter, for clarity.  All callers changed.
545
546 2004-02-02  Jim Meyering  <jim@meyering.net>
547
548         * src/stat.c (do_stat): Remove extra trailing newline from
549         default formats.  Reported by Nelson H. F. Beebe.
550
551         Print actual fractional seconds in time stamps, not just `.00000000'.
552         * src/stat.c (human_time): Add and use new parameter, t_ns.
553         (print_stat): Update callers.
554         * src/ls.c (TIMESPEC_NS): Remove definition.
555         * src/system.h (TIMESPEC_NS): Define here, instead, now that stat.c
556         also uses this macro.
557         Nelson H. F. Beebe noticed that ls --full-time printed nonzero
558         fractional seconds for files on an XFS file system, but that stat's
559         fractional seconds were always zero.
560
561 2004-01-28  Paul Eggert  <eggert@twinsun.com>
562
563         * src/seq.c (print_numbers): Use 'double' for loop index, not
564         'int', to avoid problems with integer overflow.  On almost all
565         machines 'double' works in every case where 'int' works, and
566         it works on other cases besides.
567
568 2004-01-27  Jim Meyering  <jim@meyering.net>
569
570         * src/seq.c (usage): Mention that if INCREMENT is omitted,
571         it defaults to 1, even when FIRST is larger than LAST.
572         Reword so as not to exclude the possibility that INCREMENT be zero.
573
574 2004-01-25  Jim Meyering  <jim@meyering.net>
575
576         * Version 5.1.2.
577
578         * Makefile.maint (signatures): Comment out definition.
579
580 2004-01-23  Jim Meyering  <jim@meyering.net>
581
582         * Makefile.maint (header_regexp): Add exitfail.
583
584         * man/Makefile.am (EXTRA_DIST): Add help2man.
585         Reported by Nelson H. F. Beebe.
586
587         * man/Makefile.am (.x.1): Prefix help2man invocation with `$(PERL) --'
588         so it works on systems with Perl installed somewhere other than in
589         /usr/bin.
590
591         * src/paste.c (paste_parallel): Declare local, chr, to be of type
592         `int', not `char', since it must hold EOF.  This bug would make
593         paste infloop on some systems.  Test failures reported by
594         Nelson H. F. Beebe and Christian Krackowizer.
595
596 2004-01-22  Jim Meyering  <jim@meyering.net>
597
598         * tests/rmdir/fail-perm: New file.  Test for just-fixed rmdir bug.
599         * tests/rmdir/Makefile.am (TESTS): Add fail-perm.
600
601         * man/help2man: Fix it so using --info-page='coreutils PROG' works.
602         * man/Makefile.am (.x.1): Invoke our own (tweaked) copy of help2man.
603         Use --info-page='coreutils PROG' option.
604         Now, readlink.1 refers the user to `info coreutils readlink'
605         rather than to `info readlink'.  Reported by Matt Swift.
606
607 2004-01-21  Paul Eggert  <eggert@twinsun.com>
608
609         Exit status cleanup.
610
611         * src/basename.c (usage): Use EXIT_SUCCESS, not 0, for clarity.
612         * src/cat.c, src/chgrp.c, src/chmod.c, src/chown.c, src/chroot.c,
613         * src/cksum.c, src/comm.c, src/cp.c, src/csplit.c, src/cut.c,
614         * src/date.c, src/dd.c, src/df.c, src/dircolors.c, src/dirname.c,
615         * src/du.c, src/echo.c, src/env.c, src/expand.c, src/expr.c,
616         * src/factor.c, src/fmt.c, src/fold.c, src/head.c, src/hostid.c,
617         * src/hostname.c, src/id.c, src/install.c, src/join.c, src/kill.c,
618         * src/link.c, src/ln.c, src/logname.c, src/ls.c, src/md5sum.c,
619         * src/mkdir.c, src/mkfifo.c, src/mknod.c, src/mv.c, src/nice.c,
620         * src/nl.c, src/nohup.c, src/od.c, src/paste.c, src/pathchk.c,
621         * src/pinky.c, src/pr.c, src/printenv.c, src/printf.c, src/pwd.c,
622         * src/rm.c, src/rmdir.c, src/seq.c, src/setuidgid.c, src/shred.c,
623         * src/sleep.c, src/sort.c, src/split.c, src/stat.c, src/stty.c,
624         * src/su.c, src/sum.c, src/sync.c, src/tac.c, src/tail.c, src/tee.c,
625         * src/test.c, src/touch.c, src/tr.c, src/tsort.c, src/tty.c,
626         * src/uname.c, src/unexpand.c, src/uniq.c, src/unlink.c, src/uptime.c,
627         * src/users.c, src/wc.c, src/who.c, src/whoami.c, src/yes.c: Likewise.
628
629         * src/cat.c (usage): Don't bother normalizing exit status
630         since the arg is already the correct exit status now.
631         * src/cksum.c, src/comm.c, src/csplit.c, src/cut.c,
632         * src/dircolors.c, src/expand.c, src/fmt.c, src/fold.c, src/head.c,
633         * src/join.c, src/md5sum.c, src/nl.c, src/od.c, src/paste.c,
634         * src/pr.c, src/split.c, src/sum.c, src/tac.c, src/tail.c, src/tr.c,
635         * src/tsort.c, unexpand.c, src/src/uniq.c, src/src/wc.c: Likewise.
636
637         * src/chown.c (main): Removed unused local 'fail'.
638
639         * src/chroot.c (CHROOT_FOUND_BUT_CANNOT_INVOKE, CHROOT_FAILURE):
640         Remove.
641
642         * src/chroot.c (main): Initialize exit_failure to EXIT_FAIL.
643         * src/env.c, src/nice.c, src/su.c: Likewise.
644         * src/nohup.c (main): Likewise, to NOHUP_FAILURE.
645         * src/setuidgid.c (main): Likewise, to SETUIDGID_FAILURE.
646         * src/expr.c (main): Use initialize_exit_failure rather than
647         setting exit_failure directly; this optimizes away redundant
648         assignments.
649         * src/printenv.c, src/sort.c, src/test.c, src/tty.c: Likewise.
650
651         * src/chroot.c (main): Exit with status 1 rather than 127
652         if chroot itself fails, as per documentation.
653
654         * src/chroot.c (main): Use EXIT_ENOENT and EXIT_CANNOT_INVOKE
655         rather than roll-your-own symbols or integers.
656         * src/env.c (main): Likewise.
657         * src/nohup.c (main): Likewise.
658         * src/su.c (run_shell): Likewise.
659
660         * src/cp.c (exit_status): Remove static var....
661         (main): Making it local here instead.  Use =, not |=, to set it.
662
663         * src/cut.c (FATAL_ERROR, main): Exit with status EXIT_FAILURE,
664         not 2, on errors.
665         * src/date.c (batch_convert, main): Likewise.
666         * src/dd.c (dd_copy): Likewise.
667         * src/pr.c (first_last_page, main, getoptarg): Likewise.
668         * src/tr.c (main): Likewise.
669         * src/date.c (main): Don't assume EXIT_FAILURE == 1, as
670         POSIX doesn't require it.
671         * src/dd.c (write_output, skip, dd_copy): Likewise.
672         * src/df.c (main): Likewise.
673         * src/id.c (main): Likewise.
674         * src/install.c (main): Likewise.
675         * src/ln.c (main): Likewise.
676         * src/ls.c (main): Likewise.
677         * src/mv.c (main): Likewise.
678         * src/shred.c (main): Likewise.
679
680         * src/env.c (main): Exit with status 1, not 2, on errors detected
681         by env proper.
682         * src/hostname.c (main): Likewise.
683         * src/nl.c (main): Likewise.
684         * src/stty.c (main): Likewise.
685
686         * src/expr.c (EXPR_FAILURE): Renamed from EXPR_ERROR, for
687         consistency with the other programs' naming conventions.
688         All uses changed.
689
690         * src/factor.c (main): Do not report a usage error simply
691         because stdin has bad numbers.
692
693         * src/id.c (problems): Now a boolean int, not a counter,
694         so that we don't have to worry about int overflow.  All uses changed.
695         * src/touch.c (err): Likewise.
696
697         * src/md5sum.c (main): Use int, not size_t, to store boolean int.
698
699         * src/mkfifo.c (main): Exit with status 1, not 4, if not implemented.
700         * src/mknod.c: Likewise.
701
702         * src/nice.c (main): Exit with status EXIT_FAIL, not EXIT_FAILURE,
703         on error; this is in case EXIT_FAILURE is unusual.
704         * src/su.c (main): Likewise.
705
706         * src/nohup.c (NOHUP_FOUND_BUT_CANNOT_INVOKE): Remove; all uses
707         changed to EXIT_CANNOT_INVOKE.
708
709         * src/printenv.c (PRINTENV_FAILURE): New constant.
710         (main): Exit with status PRINTENV_FAILURE, not EXIT_FAILURE, on
711         command-line syntax problems.
712
713         * src/rmdir.c (remove_parents): Don't set 'fail' to a negative number.
714         (main): Avoid integer overflow when seeing whether errors occurred.
715
716         * src/seq.c (print_numbers): Now returns void, not (zero) int.
717         All callers changed.
718         (main): Remove unused local variable 'errs'.  Always exit successfully
719         if we reach the end.
720
721         * src/setuidgid.c (SETUIDGID_FAILURE): Renamed from FAIL_STATUS,
722         for consistency with other programs here.  All uses changed.
723         (main): Use 'error' to exit rather than invoking 'exit' here.
724
725         * src/sort.c: Don't include <assert.h>.
726         (SORT_OUT_OF_ORDER,  SORT_FAILURE): Now enums, not macros.
727         (usage): Don't use 'assert'.
728         (main): Remove redundant assignment to exit_failure.
729
730         * src/system.h (EXIT_FAIL, EXIT_CANNOT_INVOKE, EXIT_ENOENT):
731         New enum values.
732         (initialize_exit_failure): New inline function.
733         Include exitfail.h here, since we refer to exit_failure.
734         All callers changed to not include exitfail.h.
735
736         * src/tty.c (TTY_FAILURE, TTY_WRITE_ERROR): New enum values;
737         substitute them for the corresponding integer constants.
738
739         * tests/help-version (expected_failure_status_date): Remove, as
740         'date' is now normal.
741         (expected_failure_status_nohup): New var.
742
743 2004-01-21  Jim Meyering  <jim@meyering.net>
744
745         * tests/touch/relative: Remove `command' syntax.
746         Thanks to Nelson H. F. Beebe and Paul Eggert.
747
748         * tests/touch/relative: Test only year/month/day, not hours/min/sec,
749         so as to avoid problems with systems using TAI clocks.
750         Although it's no longer necessary, set TZ=UTC0 also for the
751         initial touch command.  Reported by Paul Jarc here:
752         http://article.gmane.org/gmane.comp.gnu.core-utils.bugs/1504
753
754 2004-01-20  Diego Biurrun  <diego@biurrun.de>
755
756         * src/dircolors.hin: Add .mov to the list of media files.
757
758 2004-01-19  Paul Eggert  <eggert@twinsun.com>
759
760         * tests/touch/relative: Use TZ=UTC0, not TZ=utc (which isn't
761         portable).  Problem reported by Christian Krackowizer.  Also, use
762         +0000 rather than +0 to specify a time zone, as the documentation
763         requires four digits.
764
765 2004-01-19  Jim Meyering  <jim@meyering.net>
766
767         * tests/mv/hard-4: Run envvar-check in case SIMPLE_BACKUP_SUFFIX is set.
768         * tests/mv/backup-is-src: Likewise.
769         Problem reported by Peter Horst
770
771 2004-01-17  Jim Meyering  <jim@meyering.net>
772
773         * announce-gen (print_changelog_deltas): Use .sig suffix, not .asc.
774
775         * Version 5.1.1.
776
777 2003-12-15  Paul Eggert  <eggert@twinsun.com>
778
779         * NEWS, doc/coreutils.texi: touch -r and -d can now both be specified,
780         with -r specifying the origin for -d.
781         * src/touch.c (flexible_date): Remove static var.
782         (get_reldate): New function.
783         (main): Use it, to implement this new behavior.
784
785 2004-01-16  Jim Meyering  <jim@meyering.net>
786
787         * tests/touch/relative: New test for the above.
788         * tests/touch/Makefile.am (TESTS): Add relative.
789
790 2004-01-13  Jim Meyering  <jim@meyering.net>
791
792         * src/system.h: Include contents of sys2.h.
793         * src/sys2.h: Remove file.
794         * src/Makefile.am (noinst_HEADERS): Remove sys2.h.
795
796         * Use automake-1.8.2.  Regenerate dependent files.
797
798         * Update to gettext-0.13.1.
799         * configure.ac: Use gettext-0.13.1.
800         * .x-sc_space_tab: Add m4/po.m4 to the list of exceptions.
801
802 2004-01-12  Jim Meyering  <jim@meyering.net>
803
804         * Makefile.maint (%.sig): Use .sig suffix rather than .asc.
805
806         * Makefile.maint (po-check): Ensure that cvsu works before using it.
807         Reported by Alexandre Duret-Lutz.
808
809         * src/tail.c (main): Warn about following stdin only when it's a tty.
810
811         * configure.ac: Use gl_DEFAULT_POSIX2_VERSION.
812
813 2004-01-10  Jim Meyering  <jim@meyering.net>
814
815         * tests/misc/stat-fmt: Use backticks, not `$()' notation.
816
817 2004-01-09  Jim Meyering  <jim@meyering.net>
818
819         * configure.ac: Quote underquoted `jm_DUMMY_1' to avoid new warning.
820
821 2004-01-08  Jim Meyering  <jim@meyering.net>
822
823         * src/stat.c (human_fstype): Use %lx, not %x format for `unsigned long'.
824         From Andreas Schwab.
825
826         * tests/Makefile.am (TESTS_ENVIRONMENT): Remove `/vg' (prerelease test
827         remnant) from PATH component.  That would cause tests in this directory
828         not to run the just-built binaries, but rather whatever happened
829         to be in one's PATH.  Reported by Christian Krackowizer.
830
831 2004-01-04  Jim Meyering  <jim@meyering.net>
832
833         * src/csplit.c (new_control_record): Use x2nrealloc
834         rather than xrealloc.
835
836         * src/cp.c (re_protect): Use ASSIGN_STRDUPA rather than
837         alloca and strcpy.
838         (make_path_private): Likewise.
839
840 2004-01-03  Jim Meyering  <jim@meyering.net>
841
842         * src/paste.c: Use `bool' (not int) as the type for a few
843         global variables.
844         (collapse_escapes): Rewrite to set globals rather than modifying
845         its parameter.
846         Use size_t (not int) for all counters and related index variables.
847         (paste_parallel): Remove needless complexity of
848         using xrealloc in the loop;  just allocate the buffers up front.
849         Free the two temporary buffers.
850         Move declarations of locals `down' into scope where used.
851         (paste_serial): Remove `register' attributes.
852         (main): Simplify delim-related code.
853         Free `delims', now that it's malloc'd.
854
855 2004-01-02  Jim Meyering  <jim@meyering.net>
856
857         * src/chroot.c: Include "quote.h".
858         (CHROOT_FOUND_BUT_CANNOT_INVOKE, CHROOT_FAILURE): Define.
859         (main): Exit with status of 127, not 1, for too-few-args,
860         chroot failure, or chdir failure.
861         Give a better diagnostic upon execvp failure.
862
863         * src/du.c (usage): Mention that, with its current meaning,
864         -H is deprecated.
865
866         * src/tail.c (main): Warn about following stdin when it's a tty.
867         Fail when following by name but no names are specified.
868
869 2003-12-30  Jim Meyering  <jim@meyering.net>
870
871         * src/fold.c (main): Use memcpy, not strcpy.
872
873         * src/copy.c (copy_internal): Use ASSIGN_STRDUPA rather than
874         alloca and strcpy.
875
876 2003-12-28  Jim Meyering  <jim@meyering.net>
877
878         * src/unexpand.c (n_tabs_allocated): New global.
879         (add_tabstop): Use x2nrealloc rather than xrealloc.
880         * src/expand.c: Likewise.
881
882         * tests/misc/expand: New file.
883         * tests/misc/Makefile.am (TESTS): Add expand.
884
885         * src/sort.c (add_temp_dir): Use x2nrealloc rather than xrealloc.
886         (fillbuf): Use x2nrealloc rather than xrealloc.
887         (sort): Use xnmalloc rather than xmalloc.
888         (main): Likewise.
889
890 2003-12-27  Jim Meyering  <jim@meyering.net>
891
892         * src/tee.c (tee): Use xnmalloc rather than xmalloc.
893
894 2003-12-29  Paul Eggert  <eggert@twinsun.com>
895
896         * NEWS: Remove support for join -j1 FIELD, -j2 FIELD, and -o LIST1
897         LIST2 in POSIX 1003.1-2001 hosts, as required by POSIX.
898
899         * doc/coreutils.texi (join invocation): Remove documentation
900         accordingly.  Document that -t makes all separators significant.
901
902         * src/join.c: Include posixver.h.
903         (obsolete_usage): New var.
904         (longopts): Put obsolete options first.
905         (OBSOLETE_LONG_OPTIONS): New constant.
906         (get_option, add_file_name): New functions.
907         (main): Use them to support new behavior.
908         (usage): Remove documentation for -j1 FIELD and -j2 FIELD.
909         Do not mark -j FIELD as obsolescent; it is longstanding
910         UNIX tradition and is a valid extension to POSIX.
911
912         * tests/join/Test.pm (tv): Avoid obsolete -o usage.
913
914 2003-12-28  Paul Eggert  <eggert@twinsun.com>
915
916         * src/join.c (add_field_list): Don't use alloca with unbounded
917         size; just modify the argument, which is no longer const *.
918
919         Various other minor cleanups, mostly to avoid the need for casts.
920
921         (extract_field): Renamed from ADD_FIELD, as it's now a function.
922
923         (struct field.beg): Now char *, not unsigned char const *.  All
924         uses changed.  It shouldn't be const since xmemcoll writes on its
925         arguments.
926         (extract_field): Likewise, for 2nd arg.
927         (keycmp): Remove now-unnecessary cast of xmemcoll args.
928
929         (is_blank): New function, to avoid need to cast arg to unsigned char.
930         (extract_field): Use it.
931
932         (xfields): Rewrite pretty much from scratch.
933
934         (hard_LC_COLLATE): Now bool, not int.
935         (get_line, getseq, add_field_list): Now returns bool, not int.
936         (decode_field_spec, add_field_list): Return true on success (not
937         false), for consistency with the rest of the code.  All uses changed.
938
939         (tab): Now char, not unsigned char.  This wasn't 100% necessary
940         but is slightly cleaner.
941         (prjoin): Hoist (tab ? tab : ' ') expression, to help the compiler.
942
943         (empty_filler): Now const *.
944
945         (make_blank): Remove; wasn't needed.  Remove all calls.
946         (main): Don't set uni_blank.nfields; zero is fine.
947
948 2003-12-27  Jim Meyering  <jim@meyering.net>
949
950         * src/join.c: Include "quote.h".
951         (min, max): Remove definitions.
952         Make a few function parameters and corresponding
953         locals `const'.  Use bool for boolean variables.
954         Use size_t (not int) for all counters and related index variables.
955         (prjoin): Remove now-useless assertion.
956         (string_to_join_field): New function.
957         (main): Accept join fields as large as SIZE_MAX.
958         (keycmp): Rename `min' to MIN and max to MAX.
959
960 2003-12-26  Jim Meyering  <jim@meyering.net>
961
962         fold -s didn't work on e.g., alpha-based systems.
963         * src/fold.c (fold_file): Adjust types (int->size_t) so that using
964         x2nrealloc works properly on systems with differing sizes for int
965         and size_t.  Reported by Nelson Beebe.
966
967         * src/fold.c: Use `bool' (not int) as the type for a few
968         global variables.
969
970 2003-12-23  Paul Eggert  <eggert@twinsun.com>
971
972         * src/ls.c (length_of_file_names_and_frills):
973         Remove forward decl; not needed.
974         (print_file_name_and_frills, length_of_file_name_and_frills):
975         With -m, don't output spaces before inum or size.
976         (print_with_commas): Don't output space just before newline.
977
978 2003-12-24  Jim Meyering  <jim@meyering.net>
979
980         * tests/ls/Makefile.am (TESTS): Add m-option.
981         * tests/ls/m-option: New file.  Test for above fixes.
982
983 2003-12-20  Jim Meyering  <jim@meyering.net>
984
985         * Version 5.1.0.
986
987         * src/pr.c: Change type of global, buff_allocated, to size_t.
988
989         * src/join.c [struct seq]: Change types of members count and alloc
990         from `int' to `size_t'.
991
992         * tests/Makefile.am (root-hint): Tweak wording.
993
994         * src/du.c: Accept new option (-0, --null) that makes it so each
995         output line is NUL-terminated rather than newline-terminated.
996
997         * src/dd.c (apply_translations): Don't prohibit conv=unblock,sync.
998         Reported by Volker Paul.
999         * tests/dd/Makefile.am (TESTS): Add unblock-sync.
1000         * tests/dd/unblock-sync: New test for the above.
1001
1002 2003-12-19  Jim Meyering  <jim@meyering.net>
1003
1004         * tests/misc/nohup: Double quote back-ticked expression,
1005         in case it ends up having an unexpected value.
1006
1007         * tests/ls/no-arg: Use ls's -1 option in both runs.
1008
1009         * src/du.c (fts_debug): New global.
1010         (FTS_CROSS_CHECK, DEBUG_OPT): Define.
1011         (main): Make fts use FTS_TIGHT_CYCLE_CHECK.
1012         (main) [DU_DEBUG]: Accept -d option.
1013
1014 2003-12-18  Jim Meyering  <jim@meyering.net>
1015
1016         * src/ls.c (format_user): Increment dired_pos via two statements,
1017         `dired_pos += width; dired_pos++;' rather than one,
1018         `dired_pos += width + 1;' since the latter could conceivably overflow.
1019         (format_group): Likewise.
1020         From Paul Eggert.
1021
1022         * configure.ac: Require automake-1.8.
1023
1024 2003-12-12  Jim Meyering  <jim@meyering.net>
1025
1026         * Use automake-1.8.  Regenerate dependent files.
1027
1028 2003-12-08  Jim Meyering  <jim@meyering.net>
1029
1030         * Makefile.maint (news-date-check): New rule.
1031         (alpha beta major): Depend on it.
1032
1033 2003-12-03  Paul Eggert  <eggert@twinsun.com>
1034
1035         * NEWS: ls -l (and similar options) now adjust all columns to
1036         fit the data.  Generalized from a suggestion by Leah Q for file sizes.
1037         * src/ls.c (INODE_DIGITS, LOGIN_NAME_MAX, ID_LENGTH_MAX): Remove.
1038         (format_user_width, format_group_width, unsigned_file_size,
1039         format_group): New functions.
1040         (block_size_width): Renamed from block_size_size.
1041         (inode_number_width, nlink_width, owner_width, group_width,
1042         author_width, major_device_number_width, minor_device_number_width,
1043         file_size_width): New vars.
1044         (clear_files): Initialize them.
1045         (gobble_file): Set them.  Don't ceiling block_size_width to 7.
1046         (print_long_file): Use them.
1047         (gobble_file): Use a new local variable 'f' to make the code
1048         smaller and more consistent with other functions.
1049         (format_user): Output to stdout, not to a buffer, so that we
1050         don't have to worry about buffer overrun.  Update dired_pos.
1051         (print_long_file): Don't put owner, group, author into buffer;
1052         just print them directly.  Don't assume link counts and
1053         major and minor numbers fit into unsigned long int.
1054         * tests/cp/same-file, tests/mv/part-symlink: Don't assume that
1055         'ls' output is fixed-width.
1056
1057 2003-12-02  Jim Meyering  <jim@meyering.net>
1058
1059         * src/md5sum.c: Include sha1.h (reflect renaming: sha.h -> sha1.h.
1060
1061 2003-11-27  Jim Meyering  <jim@meyering.net>
1062
1063         * Use automake-1.7f.  Regenerate dependent files.
1064
1065 2003-11-24  Paul Eggert  <eggert@twinsun.com>
1066
1067         Parse floating-point operands and options in the C locale.
1068         POSIX requires this for printf, and we might as well be
1069         consistent elsewhere (tail, sleep, seq).
1070
1071         * src/printf.c: Remove decls of strtod, strtol, strtoul; no longer
1072         needed now that we assume C89.  Include "c-strtod.h".
1073         (xstrtod): Call c_strtod, not strtod.
1074         * src/sleep.c: Include "c-strtod.h".
1075         (main): Update xstrtod call to include new argument, c_strtod.
1076         * src/seq.c (scan_double_arg): Likewise.
1077         * src/tail.c (parse_options): Likewise.
1078
1079 2003-11-24  Jim Meyering  <jim@meyering.net>
1080
1081         * tests/rm/fail-2eperm: Handle another errno variant (HPUX, EPERM).
1082         Reported by Mark Conty.
1083
1084 2003-11-22  Jim Meyering  <jim@meyering.net>
1085
1086         * Makefile.maint (sc_xalloc_h_in_src): Remove rule.  Subsumed by...
1087         (sc_system_h_headers): Do this test only if sys2.h exists.
1088
1089 2003-11-20  Jim Meyering  <jim@meyering.net>
1090
1091         * tests/help-version: Ensure that the bug-reporting address is
1092         included in the --help output for every program.
1093         * tests/Makefile.am (TESTS_ENVIRONMENT): Add $PACKAGE_BUGREPORT.
1094
1095         * src/ptx.c (usage): Output bug-reporting address.
1096         Reported by Dan Jacobson.
1097
1098 2003-11-19  Jim Meyering  <jim@meyering.net>
1099
1100         * src/join.c (usage): Mention that FILE1 and FILE2 must be sorted
1101         on the join fields.  Suggestion from Bruce Robertson.
1102
1103 2003-11-18  Jim Meyering  <jim@meyering.net>
1104
1105         `od -c -w9999999' could segfault
1106         * src/od.c (dump): Use xnmalloc/free, not alloca.
1107
1108 2003-11-16  Jim Meyering  <jim@meyering.net>
1109
1110         * Use autoconf-2.59.  Regenerate dependent files.
1111
1112         * tests/du/hard-link: Minor tweak: use mkdir -p.
1113
1114         Fix read-from-free'd-buffer error detected by valgrind.
1115         * src/csplit.c (remove_line): Don't return a pointer to data in
1116         a freed buffer.  Instead, arrange to free the buffer on the
1117         subsequent call.
1118
1119         * tests/misc/csplit: New test for above fix.
1120
1121 2003-11-11  Jim Meyering  <jim@meyering.net>
1122
1123         * src/ls.c (extract_dirs_from_files): Avoid useless copy operations.
1124         This avoids a warning from valgrind about memcpy with overlapping
1125         source and destination.
1126
1127         * configure.ac: Require automake-1.7.8.
1128
1129 2003-11-09  Jim Meyering  <jim@meyering.net>
1130
1131         * Use automake-1.7.9.  Regenerate dependent files.
1132
1133         * src/rm.c: Support new options: --preserve-root and --no-preserve-root.
1134         * src/chown.c: Likewise.
1135
1136         * src/chown-core.c: Include "root-dev-ino.h".
1137         (chopt_init): Initialize new member.
1138         (change_file_owner): Support rm's new --preserve-root option.
1139
1140         * src/remove.c: Include "root-dev-ino.h".
1141         (remove_cwd_entries): Remove now-obsolete FIXME comment.
1142         (remove_dir): Support rm's new --preserve-root option.
1143
1144         * src/chown.c: Include "root-dev-ino.h".
1145         Add new options: --preserve-root and --no-preserve-root.
1146
1147         * src/chmod.c: Include "root-dev-ino.h".
1148         (process_file): Use newly-factored-out ROOT_DEV_INO_CHECK and
1149         ROOT_DEV_INO_WARN macros.
1150         (get_root_dev_ino): Remove function definition, now that it's
1151         been moved to a separate file.
1152         (usage): Describe new options.
1153
1154         * src/mv.c (rm_option_init): Initialized new member.
1155
1156         * src/remove.h: Include "dev-ino.h".
1157         (struct rm_options): Add new member: root_dev_ino.
1158         * src/chown-core.h: Include "dev-ino.h".
1159         (struct Chown_option): Add new member: root_dev_ino.
1160
1161 2003-11-06  Jim Meyering  <jim@meyering.net>
1162
1163         * src/paste.c (paste_parallel): Use `sizeof *var' rather than
1164         hard-coding `sizeof FILE*'.
1165
1166 2003-11-05  Dennis Smit  <ds@nerds-incorporated.org>
1167
1168         * src/wc.c (main): Free `fstatus' so there is no confusion about
1169         whether it's leaked or not.
1170         * src/who.c (who): Likewise for `utmp_buf'.
1171
1172 2003-11-05  Paul Eggert  <eggert@twinsun.com>
1173
1174         Fix 'cut' problems with size_t overflow and unsigned int.
1175         More generally, resize integer variables to fit use more precisely.
1176         * src/cut.c (ADD_RANGE_PAIR): Remove unnecessary parens.
1177         (struct range_pair): Make members to be of type size_t, not unsigned.
1178         (max_range_endpoint, eol_range_start): Now size_t, not unsigned.
1179         (suppress_non_delimited, output_delimiter_specified,
1180         have_read_stdin, print_kth, set_fields): Now bool, nt int.
1181         (delim): Now unsigned char, not int.
1182         (mark_printable_field, is_printable_field, is_range_start_index,
1183         set_fields, set_fields, cut_bytes, cut_fields):
1184         Use size_t, not unsigned, for field and byte counts.
1185         (hash_int): Use uintptr_t, not unsigned, for pointers converted
1186         to integers.  This squeezes more info out of them.
1187         (set_fields, cut_bytes, cut_fields, main):
1188         Use bool, not int, for booleans.
1189         (set_fields): Allocate zeroed byte array with xzalloc, not xcalloc.
1190
1191 2003-11-05  Paul Eggert  <eggert@twinsun.com>
1192
1193         * man/Makefile.am (check-programs-vs-x):
1194         Work even if $(programs) contains '$'.
1195         Work even if 'missing=1' in environment.
1196         Don't report an error simply because $(programs) outputs nothing.
1197
1198 2003-11-05  Jim Meyering  <jim@meyering.net>
1199
1200         * Use autoconf-2.58.  Regenerate dependent files.
1201
1202         * src/tr.c (spec_init): Fix typo in last change.
1203
1204         * src/sys2.h (case_GETOPT_VERSION_CHAR): Cast NULL to `(char *)' in
1205         call to variadic version_etc function, so that it works even on systems
1206         for which sizeof char* != sizeof int.
1207         * src/true.c (main): Likewise.
1208         * basename.c, chroot.c, cksum.c, dd.c, dirname.c, echo.c, expr.c:
1209         * factor.c, hostid.c, hostname.c, link.c, logname.c, nice.c, nohup.c:
1210         * pathchk.c, printenv.c, printf.c, pwd.c, setuidgid.c, sleep.c, stty.c:
1211         * sync.c, test.c, tsort.c, unlink.c, uptime.c, users.c, whoami.c, yes.c:
1212         Similarly, cast NULL to `(char *)' in call to variadic function,
1213         parse_long_options, so that it works even on systems for which
1214         sizeof char* != sizeof int.
1215         A similar problem was reported by Harti Brandt in
1216         http://mail.gnu.org/archive/html/bug-gnu-utils/2003-10/msg00320.html.
1217
1218         * src/users.c (users): Free `utmp_buf' explicitly so that people
1219         don't mistake this for a real leak.
1220         Patch by Dennis Smit <ds@nerds-incorporated.org.
1221
1222 2003-11-04  Paul Eggert  <eggert@twinsun.com>
1223
1224         * README: Document _POSIX2_VERSION.
1225
1226 2003-11-04  Jim Meyering  <jim@meyering.net>
1227
1228         * src/tac.c (memrchr): Remove #if-0'd function.
1229         (tac_stdin_to_mem): Clean up #if-0'd code.
1230
1231         * src/od.c (decode_format_string): Remove unnecessary casts.
1232         Use more maintainable `sizeof *var'.
1233         (main): Call decode_format_string rather than decode_one_format,
1234         now that `spec' may be NULL.
1235
1236         * src/chmod.c (AUTHORS): Add my name.
1237
1238         * src/split.c (next_file_name): Use `sizeof *var' rather than
1239         hard-coding `sizeof size_t'.
1240
1241         * src/sort.c (new_key): Use xzalloc, not xcalloc (1, ...).
1242
1243         * src/cut.c (ADD_RANGE_PAIR): Use x2nrealloc rather than xrealloc,
1244         to avoid potential overflow in pointer arithmetic.
1245         (set_fields): Use not `1', but rather `sizeof *printable_field' as
1246         second argument to xcalloc.
1247         * src/od.c (decode_format_string, dump_strings): Use x2nrealloc
1248         rather than xrealloc.
1249         * src/date.c (show_date): Likewise.
1250         * src/join.c (ADD_FIELD, initseq, getseq): Likewise.
1251         * src/pr.c (store_char): Likewise.
1252         * src/fold.c (fold_file): Likewise.
1253
1254         * src/copy.c (triple_hash, triple_hash_no_name): Adjust to reflect
1255         type changes (unsigned int -> size_t) in hash.c.
1256         * src/cp-hash.c (src_to_dest_hash): Likewise.
1257         * src/du.c (entry_hash): Likewise.
1258         * src/ls.c (dev_ino_hash): Likewise.
1259         * src/cut.c (hash_int): Likewise.  Declare function as static.
1260
1261 2003-11-03  Jim Meyering  <jim@meyering.net>
1262
1263         * tests/misc/Makefile.am (TESTS_ENVIRONMENT): Define PACKAGE_VERSION.
1264         * tests/misc/fold: Fail the test immediately if we're not running
1265         the expected version of fold.
1266
1267 2003-11-02  Jim Meyering  <jim@meyering.net>
1268
1269         * src/tr.c (append_normal_char, append_range, append_char_class)
1270         (append_repeated_char, append_equiv_class, spec_init): Use `sizeof *var'
1271         rather than `sizeof EXPLICIT_TYPE'.  The former is more maintainable
1272         and usually shorter.
1273         * src/copy.c (copy_internal): Likewise.
1274         * src/join.c (initseq, add_field, make_blank): Likewise.
1275         * src/od.c (main): Likewise.
1276         * src/cp.c (make_path_private): Likewise.
1277         * src/tsort.c (new_item, record_relation): Likewise.
1278
1279         * src/df.c (add_fs_type, add_excluded_fs_type, main): Likewise.
1280         (main): Also remove anachronistic cast of xmalloc return value.
1281         * src/ptx.c (alloc_and_compile_regex, main): Likewise.
1282         (main): Also remove anachronistic cast of xmalloc return value.
1283         * src/sort.c (inittables): Likewise.
1284         (sort): Also Split a long line.
1285
1286 2003-10-25  Jim Meyering  <jim@meyering.net>
1287
1288         * src/copy.c (triple_hash, triple_hash_no_name): Adjust to reflect
1289         type changes (unsigned int -> size_t) in hash.c.
1290         * src/cp-hash.c (src_to_dest_hash): Likewise.
1291         * src/du.c (entry_hash): Likewise.
1292         * src/ls.c (dev_ino_hash): Likewise.
1293         * src/cut.c (hash_int): Likewise.  Declare function as static.
1294
1295 2003-10-21  Jim Meyering  <jim@meyering.net>
1296
1297         Don't fail when run with VERBOSE=yes.
1298         * tests/chgrp/basic: Do `set +x' before starting the subshell
1299         from which we invoke chgrp.  Otherwise, the output from the
1300         VERBOSE=yes-induced `set -x' would result in spurious differences.
1301         Reported by Russel Coker via Michael Stone.
1302
1303 2003-10-19  Jim Meyering  <jim@meyering.net>
1304
1305         chmod now uses fts to perform a directory traversal when -R is
1306         specified.  Before, it operated on full path names, and as such
1307         would encounter the PATH_MAX (often 4096) limit.
1308
1309         * src/chmod.c: Include "xfts.h".
1310         (process_file): Rename from change_file_mode.
1311         Adapt to be used with fts.
1312         (process_files): New function.
1313
1314 2003-10-18  Jim Meyering  <jim@meyering.net>
1315
1316         * tests/du/deref-args: Ensure that du -D now dereferences all
1317         symlinks specified on the command line, not just those that
1318         reference directories.
1319
1320         * basename.c, cat.c, chroot.c, cksum.c, comm.c, cp.c, csplit.c, cut.c:
1321         * dd.c, df.c, dirname.c, du.c, echo.c, env.c, expr.c, factor.c, head.c:
1322         * hostid.c, hostname.c, id.c, link.c, ln.c, logname.c, ls.c, md5sum.c:
1323         * mv.c, nice.c, nl.c, nohup.c, paste.c, pathchk.c, pinky.c, pr.c:
1324         * printenv.c, printf.c, pwd.c, rm.c, setuidgid.c, sleep.c, sort.c:
1325         * split.c, stty.c, sum.c, sync.c, tac.c, tail.c, tee.c, test.c:
1326         * touch.c, tsort.c, uniq.c, unlink.c, uptime.c, users.c, wc.c:
1327         * who.c, whoami.c, yes.c (AUTHORS): Revert the WRITTEN_BY/AUTHORS change
1328         of 2003-09-19.  Now, AUTHORS is a comma-separated list of strings.
1329         Update the call to parse_long_options so that `AUTHORS, NULL' are the
1330         last parameters.
1331         * src/true.c (main): Append NULL to version_etc argument list.
1332         * src/sys2.h (case_GETOPT_VERSION_CHAR): Likewise.
1333
1334 2003-10-17  Andreas Schwab  <schwab@suse.de>
1335
1336         * tests/mk-script: Get $srcdir from first parameter instead of
1337         hardcoding it.
1338         (main): Update usage.
1339
1340         * tests/Makefile.am.in ($(srcdir)/$x-tests): Pass $(srcdir) as
1341         first argument of mk-script.
1342         ($(srcdir)/Makefile.am): Likewise.  Prepend $(srcdir) to target.
1343
1344 2003-10-17  Jim Meyering  <jim@meyering.net>
1345
1346         * src/mv.c (usage): Tweak descriptions of -i and -f so that the
1347         generated `man' page is more readable.  Suggestion from Dan Jacobson.
1348
1349         * src/chown-core.c (change_file_owner): Handle the cases in
1350         which fts_info indicates an error with the given entry.
1351
1352         * src/du.c (main): Simply assign to bit_flags.
1353         Don't bother with bit arithmetic.
1354
1355         * tests/chmod/no-x: New file.
1356         * tests/chgrp/no-x: New file.
1357         * tests/chmod/Makefile.am (TESTS): Add no-x.
1358         * tests/chgrp/Makefile.am (TESTS): Likewise.
1359
1360         * src/du.c: Include "xfts.h".
1361         (du_files): Use xfts_open, rather than fts_open.
1362         * src/chown-core.c (chown_files): Likewise.
1363
1364 2003-10-16  Jim Meyering  <jim@meyering.net>
1365
1366         * src/chgrp.c (main): Simply assign to bit_flags.
1367         Don't bother with bit arithmetic.
1368         * src/chown.c (main): Likewise.
1369         Rename a couple of local variables.
1370         Remove unnecessary casts.
1371
1372         * src/tail.c (start_bytes): Rename local, remainder, to avoid
1373         gcc's warning about shadowing a global.
1374
1375 2003-10-15  Jim Meyering  <jim@meyering.net>
1376
1377         chown and chgrp now accept POSIX-mandated -H, -L, -P options and
1378         use fts to perform a directory traversal when -R is specified.
1379         Before, they operated on full path names, and as such would
1380         encounter the PATH_MAX (often 4096) limit.
1381         They are more efficient.  For example, before, chgrp -R would
1382         take almost 5 seconds to change about 2000 directories and fail
1383         (with `File name too long'), while now it succeeds on a hierarchy
1384         of depth 20,000 in 1/10 the time.
1385
1386         * src/chown.c: Include "userspec.h" and "fts_.h".
1387         (WRITTEN_BY): Add my name.
1388         (getpwnam, getgrnam, getgrgid): Remove declarations.
1389         (endpwent): Remove definition.
1390         (usage): Update.
1391         (main): Handle new options.
1392         Call new function, chown_files rather than change_file_owner.
1393
1394         * src/chgrp.c: Include "fts_.h".
1395         (WRITTEN_BY): Add my name.
1396         (MAXUID, MAXGID): Remove definitions.  Use GID_T_MAX instead of
1397         the latter.
1398         (usage): Update.
1399         (main): Handle new options.
1400         Call new function, chown_files rather than change_file_owner.
1401
1402         Rewrite to iterate through hierarchies using fts rather than
1403         via explicit recursion.
1404         * src/chown-core.c: Include "fts_.h"
1405         (change_file_owner): Rewrite to use FTS* and FTSENT* and to operate
1406         on a single file at a time.
1407         (chown_files): New function.
1408         * src/chown-core.h [enum Dereference_symlink]: Remove declaration.
1409         [struct Chown_option] (recurse, force_silent): Change type to `bool'.
1410         [struct Chown_option] (dereference): Remove member with ambiguous name.
1411         [struct Chown_option] (affect_symlink_referent): New member.
1412         (chown_files): New prototype.
1413
1414         * tests/chgrp/recurse: Update tests accordingly.
1415         * tests/chgrp/posix-H: New tests for the above.
1416         * tests/chgrp/Makefile.am (TESTS): Add posix-H.
1417
1418         * src/ln.c (usage): Clarify that --directory, -d, -F probably won't
1419         work even for superuser.  Suggestion from Dan Jacobson.
1420
1421 2003-10-14  Paul Eggert  <eggert@twinsun.com>
1422
1423         Fix some number-parsing bugs, e.g., "head -n 100k@" wasn't
1424         properly diagnosed.
1425         * lib/human.c, lib/xstrtoimax.c, lib/xstrtol.c, lib/xstrtol.h,
1426         lib/xstrtoul.c, lib/xstrtoumax.c: Sync with gnulib.
1427         * src/sort.c (parse_field_count): Handle the case where overflow
1428         and invalid suffix char are both reported.
1429
1430 2003-10-14  Jim Meyering  <jim@meyering.net>
1431
1432         * src/ls.c (decode_switches) [TIOCGWINSZ]: Comment out the
1433         warning-inducing test, ws.ws_col <= SIZE_MAX, since it was always
1434         true on Linux.
1435
1436 2003-10-13  Paul Eggert  <eggert@twinsun.com>
1437
1438         Fix to avoid a denial-of-service attack if the display width is
1439         enormous.  Also, clean up the code a bit by removing duplicate code.
1440
1441         * src/ls.c (init_column_info): Remove forward decl; no longer needed.
1442         (calculate_columns): New function, that contains code that used
1443         to be common to print_many_per_line and print_horizontal.
1444         (print_many_per_line, print_horizontal): Use it.
1445         (decode_switches): Set max_idx here, not in calculate_columns.
1446         (print_current_files): Don't call init_column_info; calculate_columns
1447         now does that.
1448         (init_column_info): Don't allocate a lot more space than is needed
1449         to represent the current set of files.  Allocate all the new
1450         size_t cells in one call to xnmalloc, rather than a row at a time.
1451
1452 2003-10-13  Jim Meyering  <jim@meyering.net>
1453
1454         * src/ls.c (init_column_info): Add another FIXME comment.
1455
1456 2003-10-13  Paul Eggert  <eggert@twinsun.com>
1457
1458         Fix address-arithmetic bug in 'ls', reported by Georgi Guninski.
1459         Remove several arbitrary limits on hosts where int cannot represent
1460         all size_t values.
1461
1462         * src/ls.c (struct bin_str.len, length_of_file_name_and_frills, indent,
1463         nfiles, files_index, tabsize, line_length, struct column_info.line_len,
1464         struct column_info.col_arr[0], max_idx):
1465         Now size_t, not int.
1466         (get_funky_string): Return bool indicating success, instead of
1467         a negative count to indicate failure.  Store number of columns
1468         through new parameter OUTPUT_COUNT; that way, they can never
1469         go negative.  Change equals_end from int to bool.  All uses
1470         changed.
1471         (struct column_info.valid_len): Now bool, not int.  All uses changed.
1472         (dired_dump_obstack, get_funky_string, clear_files,
1473         extract_dirs_from_files, print_current_files,
1474         print_many_per_line, print_horizontal, init_column_info,
1475         put_indicator, length_of_file_name_and_frills,
1476         print_with_commas): Use size_t, not int, for local variables
1477         that count sizes.
1478         (decode_switches): Decode sizes using xstrtoul, not xstrtol.
1479         Check for TIOCGWINSZ returing negative values (or values greater
1480         than SIZE_MAX!).
1481         (visit_dir, main, parse_ls_color, queue_directory, add_ignore_pattern,
1482         init_column_info):
1483         Use xmalloc and xnmalloc, not XMALLOC.
1484         (gobble_file): Use xnrealloc, not XREALLOC.
1485         (print_color_indicator): Remove now-unnecessary cast to size_t.
1486
1487 2003-10-12  Paul Eggert  <eggert@twinsun.com>
1488
1489         * tests/du/no-x: Change wording of diagnostic to match latest du.c.
1490         * tests/sort/sort-tests: Remove from CVS; assume that people
1491         brave enough to check coreutils out from CVS can rebuild it.
1492
1493 2003-10-12  Jim Meyering  <jim@meyering.net>
1494
1495         New options: --preserve-root and --no-preserve-root.
1496         * src/chmod.c (change_file_mode): Honor new option.
1497         (change_file_mode): Strip trailing slashes on directory
1498         argument passed to change_dir_mode.
1499         (get_root_dev_ino): New function.
1500         (main): Initialize global, root_dev_ino.
1501
1502         * src/copy.c (copy_internal): Don't #ifdef-out simple uses of
1503         S_ISLNK or S_ISSOCK.  The S_IS* macros are guaranteed to be defined
1504         via system.h.
1505         * src/chmod.c (change_file_mode): Likewise.
1506
1507 2003-10-08  Jim Meyering  <jim@meyering.net>
1508
1509         * src/csplit.c (main): Remove obsolete FIXME.
1510
1511 2003-10-07  Jim Meyering  <jim@meyering.net>
1512
1513         * Use automake-1.7.8.  Regenerate dependent files.
1514
1515 2003-09-29  Paul Eggert  <eggert@twinsun.com>
1516
1517         csplit cleanup.
1518
1519         * doc/coreutils.texi (csplit invocation):
1520         The regexp offset need not have a sign; POSIX requires support
1521         for signless offets.
1522
1523         Be more careful about int widths.  For example, remove some
1524         arbitrary limits by replacing 'unsigned' with 'size_t',
1525         'uintmax_t', etc.  Use standard bool rather than a homegrown type.
1526         * lib/Makefile.am (libfetish_a_SOURCES): Add xstrtoimax.c.
1527         * src/csplit.c (FALSE, TRUE, boolean): Remove.  All uses changed
1528         to <stdbool.h> usage.
1529         (struct control): offset is now intmax_t, not int.
1530         repeat_forever is now bool, not int.
1531         (struct cstring): len is now size_t, not unsigned int.
1532         (struct buffer_record): bytes_alloc, bytes_used, num_lines are now
1533         size_t, not unsigned.  start_line, first_available are now
1534         uintmax_t, not unsigned.
1535         (hold_count, control_used): Now size_t, not unsigned.
1536         (last_line_number, current_line, bytes_written):
1537         Now uintmax_t, not unsigned.
1538         (save_to_hold_area, red_input, keep_new_line, record_line_starts,
1539         create_new_buffer, get_new_buffer, load_buffer, find_line,
1540         process_regexp, split_file, new_control_record, extract_regexp,
1541         get_format_width, get_format_prec, max_out):
1542         size args, locals, and returned values are now size_t, not unsigned
1543         or int.
1544         (get_first_line_in_buffer, find_line, write_to_file,
1545         handle_line_error, process_line_count, regexp_error, process_regexp,
1546         split_file):
1547         File line, byte, and repetition counts are now uintmax_t, not unsigned.
1548         (check_for_offset): Don't require a sign before the offset.
1549         Use xstrtoimax to do the real work.
1550         (extract_regexp): Remove harmful cast of size to unsigned.
1551         256 -> 1<<CHAR_BIT, for clarity.
1552         (get_format_flags): Return at most 3, to avoid worries about overflow.
1553
1554         (bytes_to_octal_digits): Remove.
1555
1556         (cleanup): Don't check whether output_stream is NULL, since
1557         close_output_file does that for us.
1558
1559         (new_line_control, create_new_buffer): Use "foo *p = xmalloc
1560         (sizeof *p);" instead of the more long-winded alternatives.
1561
1562         (get_new_buffer): Use O(1) algorithm for resizing a buffer
1563         to a much larger size, instead of an O(N) algorithm.
1564
1565         (process_regexp): Use plain NULL rather than casted 0.
1566
1567         (make_filename): Use %u, not %d, to format unsigned file number.
1568
1569         (new_control_record): Use xrealloc exclusively, since it handles
1570         NULL reliably.
1571
1572         (extract_regexp): Change misspelled word in diagnostic.
1573
1574         (get_format_width): Even if a minimum field width is specified,
1575         allow room for enough octal digits to represent the value of
1576         the maximum representible integer.  This fixes a potential
1577         buffer overrun.  Calculate this room at compile-time, not
1578         at run-time; this removes the need for bytes_to_octal_digits.
1579         Check for overflow; this removes a FIXME.
1580
1581         (get_format_prec): Don't allow precision to be signed; it's
1582         not ANSI.  Check for overflow.  Remove hardcoded "11" as
1583         default precision; this fixes a potential buffer overrun
1584         on hosts with wider size_t.
1585
1586         (get_format_conv_type): Change local variable to be of type
1587         unsigned char, not int; this removes a potential subscript
1588         violation on hosts where char is signed.
1589
1590         (max_out): Replace "for (;*p;)" with more-standard "while (*p)".
1591         Allow "%%" in format.  Don't overflow when
1592         counting lots of percents.
1593
1594         (usage): Default sprintf format is %02u, not %d.
1595
1596 2003-10-05  Jim Meyering  <jim@meyering.net>
1597
1598         * src/chown-core.c (change_file_owner): Remove set-but-not-used local.
1599
1600         * src/du.c (du_files): Mark diagnostic for translation.
1601
1602 2003-10-04  Jim Meyering  <jim@meyering.net>
1603
1604         * src/du.c (du_files): Ignore any failure of fts_close.
1605         Give better diagnostics for failed fts_open.
1606
1607         * src/du.c (MAX_N_DESCRIPTORS): Remove now-unused definition.
1608
1609         Deprecate existing use of -H (aka --si).
1610         * src/du.c (enum) [HUMAN_SI_OPTION]: New member.
1611         [long_options]: Use HUMAN_SI_OPTION, not 'H'.
1612         (main): Warn that the meaning of -H will soon change to be
1613         POSIX compliant.
1614
1615 2003-10-03  Jim Meyering  <jim@meyering.net>
1616
1617         * src/du.c: Accept --no-dereference (-P).
1618
1619 2003-10-02  Jim Meyering  <jim@meyering.net>
1620
1621         * tests/du/trailing-slash: Adjust for slightly different output.
1622
1623         Rewrite du.c to use fts.
1624         * src/du.c: Include "fts_.h", not ftw.h.
1625         (opt_dereference_arguments, arg_length, suffix_length): Remove globals.
1626         (IS_FTW_DIR_TYPE): Remove definition.
1627         (IS_DIR_TYPE): Define.
1628         (is_symlink_to_dir): Remove now-unnecessary function.
1629         (process_file, du_files): Rewrite to use fts.
1630
1631         * tests/du/inaccessible-cwd: Ensure that even when run from an
1632         inaccessible directory, du can still operate on accessible
1633         directories elsewhere.
1634         * tests/du/Makefile.am (TESTS): Add inaccessible-cwd.
1635
1636         * tests/rm/deep-1: Ensure that du can process a hierarchy
1637         of depth 400 while using no more than 50KB of stack space.
1638
1639 2003-10-01  Akim Demaille  <akim@epita.fr>
1640
1641         * announce-gen (print_news_deltas): New function, extracted from main.
1642         (main): Make `news_file' an array.
1643         Use '...=s' => \@var for --news and --url-directory specs.
1644         Before there were a couple of portability problems.
1645
1646 2003-09-28  Jim Meyering  <jim@meyering.net>
1647
1648         * Makefile.maint (sc_cast_of_alloca_return_value): New rule.
1649         (syntax-check-rules): Add it.
1650
1651         * src/copy.c: Remove unnecessary cast of alloca, since now it's
1652         guaranteed to be (void *).
1653         * src/cp.c: Likewise.
1654         * src/join.c: Likewise.
1655         * src/ln.c: Likewise.
1656         * src/ls.c: Likewise.
1657         * src/od.c: Likewise.
1658         * src/sys2.h (ASSIGN_STRDUPA): Likewise.
1659
1660 2003-09-27  Jim Meyering  <jim@meyering.net>
1661
1662         Don't exhaust virtual memory when processing large inputs.
1663         Fix this by removing csplit's internal free-list management;
1664         instead rely on malloc for that.
1665
1666         * src/csplit.c (free_list): Remove global.
1667         (clear_all_line_control): Remove function.
1668         (get_new_buffer): Always use create_new_buffer to obtain a
1669         new buffer, rather than searching free_list.
1670         (free_buffer): Just call free.
1671         Reported by Nikola Milutinovic.
1672
1673 2003-09-26  Jim Meyering  <jim@meyering.net>
1674
1675         * man/rm.x: Also list `chattr' in SEE ALSO section.
1676         Suggestion from Mark Hubbart.
1677
1678 2003-09-25  Jim Meyering  <jim@meyering.net>
1679
1680         * configure.ac: Don't invoke AC_AIX or AC_MINIX explicitly, now
1681         that we use gl_USE_SYSTEM_EXTENSIONS, since it AC_REQUIREs them.
1682
1683         * Use autoconf-2.57d.  Regenerate dependent files.
1684
1685 2003-09-24  Jim Meyering  <jim@meyering.net>
1686
1687         Minor efficiency tweak.
1688         * src/ln.c (PATH_BASENAME_CONCAT): Use memcpy rather than strcpy.
1689         (do_link): Likewise.
1690
1691 2003-09-23  Jim Meyering  <jim@meyering.net>
1692
1693         * src/paste.c (paste_serial): Save errno after input error,
1694         to report proper errno value.
1695         Based on a patch from Paul Eggert.
1696
1697         * src/tee.c (tee): Adjust fwrite arguments so that the return
1698         value is the number of bytes written.
1699
1700 2003-09-16  Paul Eggert  <eggert@twinsun.com>
1701
1702         Don't assume ferror sets errno.  Bug reported by Bruno Haible.
1703
1704         * src/comm.c (compare_files): Save errno after input error,
1705         to report proper errno value.
1706         * src/fold.c (fold_file): Likewise.
1707         * src/od.c (check_and_close, skip, read_char, read_block): Likewise.
1708         * src/unexpand.c (unexpand): Likewise.
1709
1710         * src/csplit.c (close_output_file): Don't report bogus errno value
1711         after ferror discovers an output error.  We don't know the proper
1712         errno value, since it might have been caused by any of a whole
1713         bunch of calls, and it might have been trashed in the meantime.
1714         Fixing this problem will require much more extensive changes;
1715         in the meantime just say "write error".
1716         * src/od.c (check_and_close, dump, dump_strings): Likewise.
1717         * src/uniq.c (check_file): Likewise.
1718
1719         * src/join.c (get_line): Report error right away if I/O fails,
1720         so that the proper errno value is used.
1721         * src/tac.c (tac_seekable, tac_file, save_stdin): Likewise.
1722         * src/tee.c (tee): Likewise.
1723         * src/uniq.c (check_file): Likewise.
1724
1725         * src/od.c (skip): If a read fails, don't retry it later, so
1726         that we report the proper errno.
1727
1728         * src/tac.c (tac_mem): Don't return a value; nobody uses it.
1729
1730         * src/tee.c (tee): Once a write failure has occurred, don't bother
1731         writing anything more to that stream.
1732
1733         * src/uniq.c (check_file): Check for ferror (stdout) even if
1734         ostream == stdout.
1735
1736         * src/yes.c (UNROLL): Remove.
1737         (main): Exit immediately when write failure is detected.
1738         Simplify code by assigning to argv when argc == 1.
1739
1740 2003-09-21  Paul Eggert  <eggert@twinsun.com>
1741
1742         * src/ptx.c: Switch encoding from Latin-1 to UTF-8.
1743         (WRITTEN_BY): Change "Franc,ois" (actually using
1744         c-with-cedilla in Latin-1) to "F.", so that it's ASCII, as
1745         xgettext requires.
1746
1747 2003-09-19  Jim Meyering  <jim@meyering.net>
1748
1749         `du -D symlink-to-dir' would mistakenly omit the slash in
1750         lines like this: 24     symlink-to-dir/subdir
1751         * src/du.c (process_file): Fix offset calculation.
1752         Reported by Jeff Sheinberg as Debian bug #211591;
1753         http://bugs.debian.org/205251
1754
1755         * tests/du/deref-args: New file/test for the above.
1756         * tests/du/Makefile.am (TESTS): Add deref-args.
1757
1758         * src/du.c (process_file): Remove useless disjunct.
1759
1760         * src/sys2.h (case_GETOPT_VERSION_CHAR): Rename parameter, Authors,
1761         to Written_by.
1762         * nearly all src/*.c files (WRITTEN_BY): Rename from AUTHORS.
1763         Begin each WRITTEN_BY string with `Written by ' and end it with `.'.
1764         Mark each WRITTEN_BY string as translatable.
1765
1766         * basename.c, cat.c, chroot.c, cksum.c, comm.c, cp.c, csplit.c, cut.c:
1767         * dd.c, df.c, dirname.c, du.c, echo.c, env.c, expr.c, factor.c, head.c:
1768         * hostid.c, hostname.c, id.c, link.c, ln.c, logname.c, ls.c, md5sum.c:
1769         * mv.c, nice.c, nl.c, nohup.c, paste.c, pathchk.c, pinky.c, pr.c:
1770         * printenv.c, printf.c, pwd.c, rm.c, setuidgid.c, sleep.c, sort.c:
1771         * split.c, stty.c, sum.c, sync.c, tac.c, tail.c, tee.c, test.c:
1772         * touch.c, tsort.c, uniq.c, unlink.c, uptime.c, users.c, wc.c:
1773         * who.c, whoami.c, yes.c: Revert yesterday's changes.
1774         Instead, a subsequent change will embed `Written by ' in
1775         each string along with the author names.
1776
1777         * src/true.c: Revert yesterday's changes.
1778         * src/sys2.h: Likewise.
1779
1780 2003-09-18  Jim Meyering  <jim@meyering.net>
1781
1782         * basename.c, cat.c, chroot.c, cksum.c, comm.c, cp.c, csplit.c, cut.c:
1783         * dd.c, df.c, dirname.c, du.c, echo.c, env.c, expr.c, factor.c, head.c:
1784         * hostid.c, hostname.c, id.c, link.c, ln.c, logname.c, ls.c, md5sum.c:
1785         * mv.c, nice.c, nl.c, nohup.c, paste.c, pathchk.c, pinky.c, pr.c:
1786         * printenv.c, printf.c, pwd.c, rm.c, setuidgid.c, sleep.c, sort.c:
1787         * split.c, stty.c, sum.c, sync.c, tac.c, tail.c, tee.c, test.c:
1788         * touch.c, tsort.c, uniq.c, unlink.c, uptime.c, users.c, wc.c:
1789         * who.c, whoami.c, yes.c: Update AUTHORS definition to be a
1790         comma-separated list of strings and/or update the call to
1791         parse_long_options so that `AUTHORS, NULL' are the last parameters.
1792         * src/true.c (main): Append NULL to version_etc argument list.
1793         * src/sys2.h (case_GETOPT_VERSION_CHAR): Likewise.
1794
1795         * src/sort.c (numcompare): Rename local, logb, to log_b to avoid
1796         shadowing the math function name.  Also rename loga to log_a.
1797
1798 2003-09-14  Jim Meyering  <jim@meyering.net>
1799
1800         * src/factor.c (print_factors): Give a separate diagnostic
1801         for numbers that are too large, but otherwise valid.
1802         Reported by Dániel Varga.
1803
1804 2003-09-10  Jim Meyering  <jim@meyering.net>
1805
1806         * Use automake-1.7.7.  Regenerate dependent files.
1807
1808         * tests/Makefile.am (all_programs): Use ../src/tr -s ' ' '\n' in place
1809         of `fmt -1'.  Using the just-built tr is a little cleaner.
1810         Christian Krackowizer reported that HPUX 10.20 doesn't have fmt.
1811         * man/Makefile.am (programs, check-x-vs-1): Likewise.
1812
1813 2003-09-09  Jim Meyering  <jim@meyering.net>
1814
1815         * src/copy.c: Alphabetize includes.
1816         Remove duplicate inclusion of "same.h".
1817
1818 2003-09-08  Jim Meyering  <jim@meyering.net>
1819
1820         * Makefile.maint (GZIP_ENV): Remove --rsyncable.
1821         Didn't give enough of a benefit, mainly because it's not yet
1822         in wide enough use.
1823
1824         * Version 5.0.91.
1825
1826         * man/Makefile.am (programs): Use ../src, not $(srcdir)/../src.
1827         (check-programs-vs-x): Fail if $(programs) is empty.
1828
1829         * src/remove.c: Add a comment.
1830
1831 2003-09-07  Jim Meyering  <jim@meyering.net>
1832
1833         * src/remove.c (D_INO, ENABLE_CYCLE_CHECK) [D_INO_IN_DIRENT]:
1834         Don't define.  These symbols are no longer used.
1835
1836         * tests/misc/tty-eof: Write ^D as \cD.
1837         Complete the change of 2003-08-02.
1838
1839         * Makefile.maint (po-check): Use cvsu, so that a temporary source
1840         file in lib/ or src/ doesn't induce an unwarranted failure.
1841         Add a kludge to filter out the sole generated source file that
1842         also has translatable messages: src/false.c.
1843
1844 2003-09-06  Jim Meyering  <jim@meyering.net>
1845
1846         * src/tail.c (enum): Add ALLOW_MISSING_OPTION.
1847         (parse_options): Give a diagnostic for (but still accept) the
1848         deprecated --allow-missing option.
1849
1850 2003-09-04  Paul Eggert  <eggert@twinsun.com>
1851
1852         Don't ignore -S if input is a pipe.  Bug report by Michael McFarland in
1853         <http://mail.gnu.org/archive/html/bug-coreutils/2003-09/msg00008.html>.
1854
1855         * src/sort.c (sort_buffer_size): Omit SIZE_BOUND arg.  Compute the
1856         size_bound ourselves. if an input file is a pipe and the user
1857         specified a size, use that size instead of trying to guess the
1858         pipe size.  This has the beneficial side effect of avoiding the
1859         overhead of default_sort_size in that case.  All callers changed.
1860         (sort): Remove static var size; now done by sort_buffer_size.
1861
1862 2003-09-05  Jim Meyering  <jim@meyering.net>
1863
1864         * Use automake-1.7.6b and autoconf-2.57b.  Regenerate dependent files.
1865
1866         * tests/tail-2/tail-n0f: Wait .5 seconds for backgrounded process
1867         to start, rather than just .1.  Upon failure, print unexpected state.
1868
1869 2003-09-04  Paul Eggert  <eggert@twinsun.com>
1870
1871         * src/head.c (elide_tail_lines_pipe): Don't assign 0 or
1872         SAFE_READ_ERROR to tmp->nbytes.
1873         * src/tail.c (pipe_lines, pipe_bytes): Likewise.
1874
1875         * src/head.c (struct linebuffer): Change nbytes and nlines
1876         from unsigned int to size_t.  unsigned int is safe (after the
1877         2003-09-03 patch) but size_t is cleaner.
1878         * src/tail.c (struct linebuffer, struct charbuffer): Likewise.
1879         (pipe_bytes): Likewise for local variable 'i', which was 'int'.
1880
1881         Standardize on BUFSIZ as opposed to other macro names and values.
1882         * src/head.c (BUFSIZE): Remove.  All uses changed to BUFSIZ.
1883         * src/tail.c (BUFSIZ) [!defined BUFSIZ]: Remove.
1884         stdio.h has always defined it,
1885         and other code already assumes it's defined.
1886         * src/tr.c (BUFSIZ) [!defined BUFSIZ]: Likewise.
1887         (IO_BUF_SIZE): Remove; replace all uses with sizeof io_buf.
1888         (io_buf): IO_BUF_SIZE -> BUFSIZ.
1889
1890 2003-09-04  Paul Eggert  <eggert@twinsun.com>
1891
1892         * src/seq.c (step): Default to 1.
1893         (print_numbers): Allow the output to be empty.
1894         (main): The default step is 1, even if LAST < FIRST;
1895         as per documentation.
1896         * tests/seq/basic (onearg-2): Output should be empty.
1897
1898 2003-09-05  Jim Meyering  <jim@meyering.net>
1899
1900         * Makefile.cfg (wget_files): Temporarily disable, until master
1901         versions are restored to ftp.gnu.org.
1902
1903         * configure.ac (AM_INIT_AUTOMAKE): Specify automake-1.7.6.
1904
1905         Make seq's --width (-w) option work properly even when the
1906         endpoint requiring the larger width is negative and smaller than
1907         the other endpoint.
1908         * src/seq.c (get_width_format): Include `-' in the set of bytes
1909         allowed in a `simple' number (no decimal point, no exponent).
1910         Reported by Patrick Mauritz.
1911
1912 2003-09-02  Paul Eggert  <eggert@twinsun.com>
1913
1914         * NEWS: sort -t '\0' now uses a NUL tab.
1915         sort option order no longer matters, unless POSIX requires it.
1916         * src/sort.c (usage): Say "blanks" instead of "whitespace",
1917         Similar fixes for many comments.
1918         (TAB_DEFAULT): New constant, so that we can support NUL as
1919         the field separator.
1920         (tab): Now int, not char.  Initialize to TAB_DEFAULT.
1921         (specify_sort_size): If multiple sizes are specified, use the largest.
1922         (begfield, limfield): Support NUL tab char.
1923         (set_ordering): Do not let -i override -d.
1924         (main): Report an error if incompatible -o or -t options are given.
1925         Report an error for "-t ''".  Allow "-t '\0'" to specify a NUL tab.
1926
1927 2003-09-05  Jim Meyering  <jim@meyering.net>
1928
1929         * tests/sort/Test.pm [o2, nul-tab]: New tests for the above.
1930
1931 2003-09-03  Andreas Schwab  <schwab@suse.de>
1932
1933         Bug report and patch here:
1934         <http://mail.gnu.org/archive/html/bug-coreutils/2003-09/msg00009.html>
1935         * src/tail.c (pipe_lines): Don't truncate return value from safe_read.
1936         * src/head.c (elide_tail_lines_pipe): Likewise.
1937
1938 2003-09-03  Jim Meyering  <jim@meyering.net>
1939
1940         * src/du.c (AUTHORS): Remove Larry McVoy's name, since the relatively
1941         small amount of code from him was first moved to lib/human.c, and was
1942         subsequently rewritten entirely.
1943         * src/df.c (AUTHORS): Likewise.
1944
1945 2003-08-22  Lawrence Teo  <lcteo@uncc.edu>
1946
1947         * src/md5sum.c (split_3): Accept the BSD format for generic
1948         message digest modes.  Currently works with BSD's MD5 and SHA1
1949         formats since these are the two algorithms presently used in
1950         coreutils.  Updated comments to reflect this change.
1951         (bsd_split_3): Updated comments.
1952
1953         * tests/md5sum/basic-1: New test to make sure that
1954         `md5sum --check' doesn't accept the BSD SHA1 format (adapted
1955         from `check-bsd' test in tests/sha1sum/basic-1).
1956
1957         * tests/sha1sum/basic-1 (check-bsd2, check-bsd3): New tests for
1958         --check exit status and BSD SHA1 format (adapted from tests
1959         in tests/md5sum/basic-1).
1960
1961 2003-08-30  Jim Meyering  <jim@meyering.net>
1962
1963         * src/ln.c (do_link): Use SAME_INODE rather than open-coding it.
1964
1965         When source and destination arguments refer to the same file, reside
1966         on a partition (e.g. VFAT) on which distinct names may refer to the
1967         same directory entry (often due to variations in case), and when the
1968         link count for the file is 1, mv no longer unlinks the file.  Instead,
1969         it gives the expected diagnostic that the source and destination are
1970         the same.  WARNING: this is an incomplete fix.  If the file happens
1971         to have a link count of 2 or greater, such an erroneous mv command
1972         will still unlink it.
1973         Although that is not possible on vfat or umsdos, it is possible on
1974         other file system types, e.g., ntfs, and hpfs.
1975         * src/copy.c (same_file_ok): Invoke same_name (which might still
1976         return false for names that refer to the same directory entry)
1977         only if the link count is 2 or more.
1978         * tests/mv/vfat: Show how to demonstrate the above problem.
1979         This test is not run.
1980         * tests/mv/Makefile.am (EXTRA_DIST): Add vfat.
1981
1982 2003-08-27  Jim Meyering  <jim@meyering.net>
1983
1984         * src/who.c: Change meaning of -l from --lookup to --login, per POSIX.
1985         who's -l option has been eliciting an unconditional warning about
1986         this impending change since sh-utils-2.0.12 (April 2002).
1987
1988         * src/paste.c (paste_parallel): Don't output `EOF' (aka -1) as a `char'.
1989         This would happen for nonempty files not ending with a newline.
1990         Reported by Dan Jacobson.
1991         * tests/misc/paste-no-nl: New file.  Test for above-fixed bug.
1992         * tests/misc/Makefile.am (TESTS): Add paste-no-nl.
1993
1994         * src/stat.c (print_it): Avoid buffer overrun that would
1995         occur when the user-specified format string ends with `%'.
1996         Patch by Tommi Kyntola.
1997         * tests/misc/stat-fmt: New file.  Test for above-fixed bug.
1998         * tests/misc/Makefile.am (TESTS): Add stat-fmt.
1999
2000 2003-08-26  Jim Meyering  <jim@meyering.net>
2001
2002         Apply changes from bison.
2003         * GNUmakefile (SHELL): Define to `sh', if necessary.
2004         Add copyright.
2005         * Makefile.maint (WGETFLAGS): Define to `-C off'.
2006         Update all uses of $(WGET).
2007
2008 2003-08-22  Akim Demaille  <akim@epita.fr>
2009
2010         * Makefile.cfg (local-checks-to-skip): New.
2011         * Makefile.maint (local-check): Rename as...
2012         (local-checks-available): this.
2013         (local-check): New.
2014
2015 2003-08-26  Akim Demaille  <akim@epita.fr>
2016
2017         * announce-gen (print_changelog_deltas): Neutralize "<#" as
2018         "<\#" to avoid magic from Gnus when posting parts of this script.
2019
2020 2003-08-25  Jim Meyering  <jim@meyering.net>
2021
2022         * src/stat.c (main): Warn about use of deprecated `-l' option.
2023
2024 2003-08-22  Jim Meyering  <jim@meyering.net>
2025
2026         * src/stat.c (do_stat): For link count at end of line, use %h format,
2027         instead of %-5h.  The latter would make stat emit trailing spaces.
2028         Reported by Dan Jacobson.
2029
2030 2003-08-20  Jim Meyering  <jim@meyering.net>
2031
2032         * Makefile.am (EXTRA_DIST): Add .x-sc_space_tab .x-sc_sun_os_names
2033
2034 2003-08-19  Jim Meyering  <jim@meyering.net>
2035
2036         * src/system.h: Include stdlib.h unconditionally,
2037         as we're now assuming that part of hosted C89.
2038
2039 2003-08-18  Jim Meyering  <jim@meyering.net>
2040
2041         * src/sys2.h (textdomain, bindtextdomain) [! ENABLE_NLS]: Define away,
2042         to avoid warnings from gcc.
2043
2044 2003-08-17  Jim Meyering  <jim@meyering.net>
2045
2046         Avoid unnecessary and sometimes time-consuming hostname lookups.
2047         * src/who.c (print_user): Use strchr, not strrchr.
2048         * src/pinky.c (print_entry): Likewise.
2049         Patch by Michael Stone.
2050         This fixes a typo I introduced in who-users.c on 1996-02-23.
2051
2052         * Makefile.maint (makefile-check): Add 0-9 to the range of characters
2053         disallowed between `@...@'.
2054
2055 2003-08-16  Paul Eggert  <eggert@twinsun.com>
2056
2057         * configure.ac (fu_cv_sys_truncating_statfs): Remove; now
2058         done by gnulib .m4 files.
2059         (jm_DUMMY_1): Require gl_READUTMP, not jm_PREREQ_READUTMP.
2060         * src/sys2.h (strtoull): Remove unused declaration.
2061
2062 2003-08-16  Jim Meyering  <jim@meyering.net>
2063
2064         * man/Makefile.am (.x.1): Ensure that generated PROGRAM.1 files
2065         are read-only.
2066
2067         * src/tail.c (tail_lines): Fix a potential (but very hard to exercise)
2068         race condition bug.  The bug would be triggered when tailing a file
2069         with file pointer not at beginning of file, and where the file was
2070         truncated to have a length of less than the initial offset at just
2071         the right moment (between the two lseek calls in this function).
2072
2073         An invalid initial value for *read_pos would result in
2074         `tail -n0 -f FILE' and `tail -c0 -f FILE' doing what amounted to a
2075         busy-wait rather than sleeping between iterations.  The bug manifests
2076         itself only when tailing regular files that are initially nonempty.
2077         * src/tail.c (tail_bytes): Set *read_pos to new file offset after
2078         each xlseek call.
2079         (tail_lines): Likewise, after lseek calls.
2080         Reported by Nick Estes.  See http://bugs.debian.org/205251 for details.
2081         * tests/tail-2/tail-n0f: New file.  Test for above fix.
2082         * tests/tail-2/Makefile.am (TESTS): Add tail-n0f.
2083
2084 2003-08-15  Jim Meyering  <jim@meyering.net>
2085
2086         * Makefile.maint (sc_space_tab): Use exclusion list in separate file.
2087         (sc_sun_os_names): Likewise.
2088         * .x-sc_space_tab, .x-sc_sun_os_names: New files.
2089
2090         * man/help2man: Remove some SPACEs before TAB.
2091
2092 2003-08-14  Paul Eggert  <eggert@twinsun.com>
2093
2094         * Makefile.maint (LC_ALL): Set to C.
2095         * man/Makefile.am (ASSORT): New var.
2096         (check-x-vs-1, programs): Use it.
2097         * src/Makefile.am (ASSORT, check-README, ../AUTHORS): Likewise.
2098         * tests/Makefile.am (ASSORT, all_programs): Likewise.
2099
2100 2003-08-11  Jim Meyering  <jim@meyering.net>
2101
2102         fold -s -wN would infloop for N < 8 with TABs in the input.
2103         E.g., this would not terminate: printf 'a\tb' | fold -w2 -s
2104         * src/fold.c (fold_file): Move contents of `else'-block
2105         out of conditional so it's used also for --spaces (-s).
2106         * tests/misc/fold: Test for the above fix.
2107         * tests/misc/Makefile.am (TESTS): Add fold.
2108
2109 2003-08-10  Jim Meyering  <jim@meyering.net>
2110
2111         * src/nice.c [!NICE_PRIORITY]: Include <sys/resource.h> after
2112         system.h so the types from time.h and sys/time.h are available.
2113         It appears that this is necessary for OpenBSD, NetBSD, and
2114         Darwin 6.5 (MacOS 10.2.5).  Reported by Nelson Beebe.
2115
2116 2003-08-06  Paul Eggert  <eggert@twinsun.com>
2117
2118         * NEWS: Add support for setting file timestamps to microsecond
2119         resolution, on hosts that support this.
2120         * src/copy.c, src/cp.c, src/install.c, src/touch.c: Include utimens.h.
2121         * src/copy.c (copy_internal):
2122         Set file timestamps with utimens, not utime.
2123         * src/cp.c (re_protect): Likewise.
2124         * src/install.c (change_timestamps): Likewise.
2125         * src/touch.c (newtime, touch, main): Likewise.
2126
2127 2003-08-09  Jim Meyering  <jim@meyering.net>
2128
2129         * Makefile.maint (sc_sun_os_names): New rule based on a regexp
2130         from Paul Eggert.
2131         (syntax-check-rules): Add it.
2132
2133         * src/tail.c (main): Tweak Solaris OS version number in comment.
2134         * src/wc.c (wc): Likewise
2135         * tests/tail-2/fflush: Likewise.
2136
2137         * src/tail.c: Add new undocumented option, --presume-input-pipe.
2138         (pipe_lines): Use memchr to skip lines, rather than an explicit loop.
2139
2140 2003-08-08  Paul Eggert  <eggert@twinsun.com>
2141
2142         Use new gnulib 'extensions' module.
2143         * configure.ac: Invoke gl_USE_SYSTEM_EXTENSIONS instead of
2144         AC_GNU_SOURCE.
2145
2146 2003-08-08  Paul Eggert  <eggert@twinsun.com>
2147
2148         * tests/du/basic: Ensure that a/b/F has at least 65 bytes too.
2149
2150 2003-08-09  Jim Meyering  <jim@meyering.net>
2151
2152         * tests/misc/split-fail: Reflect that `split -a 0' is now accepted.
2153         For tests of obsolete behavior, don't presume that unsetting
2154         _POSIX2_VERSION is equivalent to _POSIX2_VERSION=199209.
2155
2156 2003-08-07  Paul Eggert  <eggert@twinsun.com>
2157
2158         * doc/coreutils.texi (split invocation):
2159         Add -d or --numeric-suffixes option to 'split'.
2160         From a suggestion by Jesse Kornblum.
2161         * src/split.c (suffix_alphabet): New var.
2162         (longopts, usage, next_file_name, main): Support -d.
2163         (next_file_name, main): Allow -a0, as POSIX requires.
2164         (next_file_name): Don't assume ASCII-like encoding;
2165         'a' through 'z' are not contiguous in EBCDIC.
2166
2167 2003-08-05  Paul Eggert  <eggert@twinsun.com>
2168
2169         Merge getline from gnulib.
2170         * lib/getline.h, lib/getline.c, m4/getline.m4: Merge from gnulib.
2171         * lib/getndelim2.h, lib/getndelim2.c, m4/getndelim2.m4, m4/ssize_t.m4:
2172         New files, from gnulib.
2173         * lib/getdelim2.c, lib/getdelim2.h: Remove.
2174         * lib/Makefile.am (libfetish_a_SOURCES): Change getdelim2.c and
2175         getdelim2.h to getndelim2.c and getndelim2.h.
2176         * m4/jm-macros.m4 (jm_MACROS): Use gl_GETNDELIM2 rather than
2177         checking for getdelim.
2178         (jm_CHECK_ALL_TYPES): Use gt_TYPE_SSIZE_T for ssize_t rather
2179         than rolling our own.
2180         * src/cut.c: Include getndelim2.h rather than getdelim2.h.
2181         (cut_fields): Invoke getndelim2 rather than getdelim2.
2182
2183 2003-08-04  Jim Meyering  <jim@meyering.net>
2184
2185         * src/sort.c (main): Use unsigned int instead of int for `nsigs'
2186         and for the indices to iterate through nsigs.
2187
2188 2003-08-02  Paul Eggert  <eggert@twinsun.com>
2189
2190         * src/sort.c: Minor code cleanups, mostly to use more accurate
2191         types and to remove unnecessary casts.
2192         (min, max): Remove.  All uses changed to MIN and MAX.
2193         (hard_lc_collate, hard_LC_TIME, struct buffer.eof, struct
2194         keyfield.skipsblanks, struct keyfield.skipeblanks, struct
2195         keyfield.numeric, struct keyfield.general_numeric, struct
2196         keyfield.month, struct keyfield.reverse, reverse, unique,
2197         have_read_stdin): Now bool, not int.  All uses changed.
2198         (eolchar): Now char, not int.
2199         (struct keyfield.ignore): Now bool const *, not int *.
2200         (struct keyfield.translate): Now char const *, not char *.
2201         (struct month.name): Likewise.
2202         (blanks, nonprinting, nondictionary): Now bool[], not int[].
2203         (cleanup, inittables, keycompare, check, mergefps, first_same_file,
2204         check, sort, main): Use const * pointers when possible.
2205         (month_cmp): Rewrite to avoid casts.
2206         (inittables): Initialize tables unconditionally, to avoid branches.
2207         (fillbuf): Return bool, not int.  All uses changed.
2208         (fillbuf, keycompare, new_key, main):
2209         Use SIZE_MAX rather than (size_t) -1.
2210         (trailing_blanks): Renamed from trim_trailing_blanks.
2211         Return the number of blanks to trim.  All uses changed.
2212         (getmonth): Use trailing_blanks rather than open code.
2213         (keycompare): Do not cast char * to unsigned char *; not needed.
2214         CMP_WITH_IGNORE converts args to UCHAR, so no need to convert it
2215         ourselves.
2216         (compare, main): Use | rather than || to avoid jumps.
2217         Replace "diff = NONZERO (alen)" with "diff = 1", since alen must
2218         be nonzero there.
2219         (check, first_same_file, sort, main):
2220         Use bool instead of int local vars when possible.
2221         (check): Merge the old 'checkfp' and 'check' into a single function,
2222         that returns a boolean (true if the file was ordered).
2223         All uses changed.
2224         (main): Use int instead of unsigned for iterating through nsigs.
2225         Rename local var "posix_pedantic" to "posixly_correct".
2226
2227 2003-08-02  Jim Meyering  <jim@meyering.net>
2228
2229         * src/nice.c [!NICE_PRIORITY]: Include <time.h> before <sys/resource.h>
2230         to avoid compilation error on Ultrix. Reported by Christian Krackowizer.
2231
2232         * src/cut.c (cut_fields): Don't read again after encountering an
2233         initial EOF.  E.g., `cut -f2' would do so.
2234         * tests/misc/tty-eof: Add a test for the above fix.
2235
2236         * src/sort.c (sortlines): Add description and references.
2237         From Paul Eggert.
2238
2239         * tests/Makefile.am (TESTS_ENVIRONMENT): Set PATH so that
2240         the tests in help-version will use the just-built binaries.
2241         Reported by Christian Krackowizer.
2242
2243 2003-07-31  Paul Eggert  <eggert@twinsun.com>
2244
2245         * NEWS: Add --rfc-2822 option to GNU date.
2246         * doc/coreutils.texi (Time directives, Options for date, Examples
2247         of date): Likewise.
2248         * src/date.c (long_options, usage, main): Likewise.
2249         * doc/getdate.texi (General date syntax): Likewise.
2250         * doc/coreutils.texi (Options for date): Fix a typo in format:
2251         it's now %d not %_d.  Add URLs.
2252
2253 2003-08-01  Jim Meyering  <jim@meyering.net>
2254
2255         * tests/shred/remove: Ensure that $? is 0 for the final `exit 0'.
2256         Otherwise, with at least the /bin/sh from HPUX 10.20,
2257         the trap code would end up converting that to exit 1 and thus an
2258         unexpected test failure.  Reported by Christian Krackowizer.
2259
2260 2003-07-31  Paul Eggert  <eggert@twinsun.com>
2261
2262         * src/ptx.c: Do not include bumpalloc.h.
2263         (WORD_TABLE): New member alloc.
2264         (ALLOC_NEW_WORD): Remove.
2265         (occurs_alloc): New var.
2266         (digest_word_file, find_occurs_in_text): Check for arithmetic
2267         overflow when computing table size.  Use xrealloc rather than
2268         bumpalloc primitives.
2269
2270 2003-07-29  Jim Meyering  <jim@meyering.net>
2271
2272         * Version 5.0.90.
2273
2274         * README: When running tests as root, suggest using
2275         sudo with NON_ROOT_USERNAME=$USER.
2276
2277         * tests/Makefile.am (all_programs): Makefile is in ../src, not
2278         $(srcdir)/../src.
2279
2280 2003-07-28  Jim Meyering  <jim@meyering.net>
2281
2282         * Makefile.maint (GZIP_ENV): Try Debian/gzip's new --rsyncable option.
2283
2284 2003-07-28  Paul Eggert  <eggert@twinsun.com>
2285
2286         * lib/stdbool.hin (_Bool): Make it signed char, instead of
2287         an enum type, so that it's guaranteed to promote to int.
2288         * src/sort.c (sortlines_temp): Undo previous change.
2289
2290 2003-07-28  Jim Meyering  <jim@meyering.net>
2291
2292         * src/sort.c (sortlines_temp): Declare local `swap' to be `int', not
2293         `bool'.  Otherwise, at least one buggy compiler (alpha gcc-2.95.4)
2294         would cause lines[-1 - swap] (with swap = false) to evaluate to
2295         lines[4294967295].
2296
2297 2003-07-27  Jim Meyering  <jim@meyering.net>
2298
2299         * tests/priv-check (my_uid): Use `!', not `^' in case pattern `[!0-9]',
2300         since /bin/sh of at least NetBSD 1.6 and OpenBSD 3.2 don't accept `^'.
2301
2302         * src/remove.c (prompt) [! recursive]: Don't prompt about unwritable
2303         directories, as required by POSIX.   Reported by Karl Berry.
2304         * tests/rm/dir-no-w: New file.  Test for the above fix.
2305         * tests/rm/Makefile.am (TESTS): Add dir-no-w.
2306
2307         * tests/mk-script: Emit `$xx', not its expansion.
2308
2309 2003-07-27  Paul Eggert  <eggert@twinsun.com>
2310
2311         This change was inspired by a similar proposal by Stepan Kasal.
2312         * src/sort.c (mergelines, sortlines_temp): New functions.
2313         (sortlines): Use them, to reduce the number of times that
2314         we need to copy 'struct line' values.  This improved CPU
2315         performance by about 30% on one 18 MB test.
2316         (sort): Don't invoke sortlines unless we have 2 or more lines.
2317
2318 2003-07-26  Stepan Kasal  <kasal@ucw.cz>
2319
2320         * src/sort.c (sort): Don't require two `struct line's per text line,
2321         the new sort algorithm requires just 1.5.
2322
2323 2003-07-27  Jim Meyering  <jim@meyering.net>
2324
2325         * src/pathchk.c (validate_path): Use %lu, not %ld.
2326         From Paul Eggert.
2327         * src/cut.c (is_printable_field): Simplify bit arithmetic.
2328         From Paul Eggert.
2329         * src/ls.c (sort_files): Put `volatile' in the right place.
2330         From Paul Eggert.
2331
2332 2003-07-26  Jim Meyering  <jim@meyering.net>
2333
2334         Use only one bit per field/offset in array, not one `int'.
2335         * src/cut.c (printable_field): Change type to `unsigned char'.
2336         (mark_printable_field, is_printable_field): New functions.
2337         Use them in place of all direct accesses of `printable_field'.
2338
2339         * src/expand.c (parse_tabstops): Detect overflow properly.
2340         * src/cut.c (set_fields): Likewise.
2341
2342         * src/rm.c: Include "dirname.h".
2343         (usage): Use base_name (program_name) in body of --help output.
2344         This lets me...
2345         * man/Makefile.am (.x.1): ...back out the kludge of 2003-07-22.
2346         Idea from Brendan O'Dea, who suggested using
2347         `program_name = basename (argv[0]);' everywhere --
2348         can't do that, but using base_name works just fine here.
2349
2350         * src/Makefile.am (AM_INSTALLCHECK_STD_OPTIONS_EXEMPT): Exempt test.
2351
2352 2003-07-24  Paul Eggert  <eggert@twinsun.com>
2353
2354         Fix some POSIX-compliance problems with 'test'.  This makes
2355         'test' more compatible with Bash.
2356
2357         * NEWS, doc/coreutils.texi: Document the following.
2358         * src/test.c: Include exitfail.h.
2359         (TEST_FAILURE): New constant, used for exit status if 'test' fails.
2360         (test-syntax_error): Use it.
2361         (binary_operator): Now takes bool arg specifying whether left operand
2362         is -l ARG, so that caller determines this rather than us.
2363         All uses changed.
2364         (term): Use posixtest to evaluate parenthesized subexpressions.
2365         (unary_operator, one_argument): Remove support for -t without operand.
2366         (one_argument): Take argument from argv[pos].
2367         (one_argument, two_arguments, three_arguments): Advance pos.
2368         All callers changed.
2369         (three_arguments): Look for binary ops before "!".  Then look
2370         for parenthesized one_argument expressions, instead of trusting
2371         expr () to do the right thing.
2372         (posixtest): Now takes number of args.  All callers changed.
2373         Treat "( A B )" like "A B".
2374         (main): Set exit_failure to TEST_FAILURE.  Don't depend on
2375         POSIXLY_CORRECT, as we now conform to POSIX by default.
2376         (main) [!LBRACKET]: Do not recognize "--help" or "--verbose" unless.
2377         * tests/test/Test.pm (test_vector): Add several tests to check
2378         the above.  Syntax errors now exit with status 2, not 1.
2379         * man/Makefile.am (mapped_name): Use `../src/[' binary to create test.1.
2380
2381 2003-07-26  Jim Meyering  <jim@meyering.net>
2382
2383         * tests/help-version: Adjust for above change in test behavior:
2384         `[' exits with 2, not 1, and test doesn't accept --help or --version.
2385
2386         * Makefile.maint (ME): Don't use trick suggested in Make manual.
2387         It doesn't work for make-3.79.1.  Reported by Christian Krackowizer.
2388
2389         * Makefile.maint (sc_system_h_headers): Another syntax check.
2390         (syntax-check-rules): Add it to the list.
2391
2392         * src/pathchk.c (validate_path): Cast strlen value to `unsigned long'
2393         so it matches `%ld' format even on 32-bit systems.
2394
2395         * src/fmt.c (flush_paragraph): Cast field width to `int' to
2396         avoid warning on 64-bit systems.
2397
2398         * src/ls.c (sort_files): Make `func' volatile, so it can't be
2399         clobbered by a `longjmp' into this function.
2400
2401 2003-07-25  Jim Meyering  <jim@meyering.net>
2402
2403         * src/pathchk.c (validate_path): Use %ld format (not %d) for size_t
2404         value.
2405
2406         * tests/misc/split-fail: Disable the --line-bytes=$_4gb test,
2407         because it'd evoke spurious failure on 64-bit systems.
2408
2409 2003-07-24  Jim Meyering  <jim@meyering.net>
2410
2411         * src/dd.c (usage): Document the fact that SIGUSR1 makes dd
2412         output its current record counts.  Reported by Jurriaan.
2413
2414         * tests/wc/Test.pm (test_vector): Disable the `PIPE' tests when running
2415         `wc' with no options.  This goes along with the change of 2003-07-20.
2416
2417 2003-07-23  Jim Meyering  <jim@meyering.net>
2418
2419         Don't include headers already included by system.h:
2420         * src/tr.c: Don't include errno.h.
2421         * src/true.c: Don't include version-etc.h.
2422         * src/test.c: Don't include limits.h or error.h.
2423         * src/stat.c: Don't include unistd.h or time.h.
2424         * src/readlink.c: Don't include stdlib.h, unistd.h, or limits.h.
2425         * src/pr.c: Don't include time.h.
2426         * src/pathchk.c: Don't include errno.h.
2427         * src/nice.c: Don't include sys/time.h.
2428         * src/ls.c: Don't include stdlib.h.
2429
2430         * basename.c, cat.c, chroot.c, cksum.c, comm.c, csplit.c, cut.c, date.c:
2431         * dd.c, dirname.c, echo.c, env.c, expand.c, expr.c, factor.c, fmt.c:
2432         * fold.c, head.c, hostid.c, hostname.c, id.c, join.c, kill.c, logname.c:
2433         * md5sum.c, nice.c, nl.c, nohup.c, od.c, paste.c, pathchk.c, pinky.c:
2434         * pr.c, printenv.c, printf.c, ptx.c, pwd.c, seq.c, setuidgid.c, shred.c:
2435         * sleep.c, sort.c, split.c, stat.c, stty.c, su.c, sum.c, tac.c, tail.c:
2436         * tee.c, test.c, tr.c, true.c, tsort.c, tty.c, uname.c, unexpand.c:
2437         * uniq.c, uptime.c, users.c, wc.c, who.c, whoami.c, yes.c:
2438         Don't include closeout.h.
2439
2440         * tests/rm/fail-2eperm: Add a check for whether $NON_ROOT_USERNAME
2441         can access the required version of rm.
2442         * tests/rm/Makefile.am (TESTS_ENVIRONMENT): Define PACKAGE_VERSION.
2443
2444         * tests/cut/Test.pm (out-delim3a): New test.
2445
2446         * man/help2man: Update to version 1.33.
2447
2448         * src/expand.c (parse_tabstops): Detect overflow in tabstop sizes.
2449
2450         * src/dircolors.c: Include xstrndup.h.
2451         (xstrndup): Remove function, now that it's been factored out into
2452         it's own file.
2453
2454 2003-07-22  Paul Eggert  <eggert@twinsun.com>
2455
2456         * src/wc.c (wc): Fix typo in computation of file from file_x,
2457         which caused the former to be used uninitialized if file_x was
2458         nonzero.
2459
2460 2003-07-22  Jim Meyering  <jim@meyering.net>
2461
2462         * src/cut.c (set_fields): Use xcalloc in place of xmalloc+memset.
2463
2464         * man/Makefile.am (.x.1): Substitute 's,$t/$*,$*,' on output of
2465         help2man, to avoid having `rm.td/rm' appear in rm.1.  Reported by
2466         Thomas Luzat.  See http://bugs.debian.org/202413 for details.
2467
2468         * src/cut.c (main) [lint]: Initialize spec_list_string to avoid warning.
2469
2470         * src/hostid.c: Don't include <unistd.h>.  system.h already does that.
2471
2472         * src/cut.c (set_fields): Mark all selected indices before trying to
2473         determine range endpoints.
2474         * tests/cut/Test.pm: New test for the above fix.
2475
2476         Begin to address this comment: What if someone wants to
2477         extract the 1,000,000-th field of some huge input file?
2478         The first step is to rearrange things so that the values
2479         in the printable_field array are all 0/1 rather than 0/1/2.
2480         * src/cut.c (RANGE_START_SENTINEL): Remove.
2481         Store range-start indices in a hash table, rather than
2482         overloading the `printable_field' array.
2483         (range_start_ht): New global.
2484         (hash_int, hash_compare_ints, is_range_start_index): New functions.
2485         (print_kth): Use is_range_start_index; don't test printable_field.
2486         (set_fields): Detect overflow.
2487         (set_fields): Insert each range-start index into range_start_ht.
2488         (main): Call set_fields only once, and only after
2489         output_delimiter_specified and (if required) range_start_ht have
2490         been defined.
2491
2492 2003-07-20  Paul Eggert  <eggert@twinsun.com>
2493
2494         * src/wc.c (get_input_fstatus): Fix typo: `stat' was being
2495         invoked with a null pointer when there were no file arguments.
2496
2497 2003-07-20  Jim Meyering  <jim@meyering.net>
2498
2499         * Makefile.maint (sc_changelog): Add another nit-picky check.
2500
2501         * src/wc.c (write_counts): Add a comment.
2502         (wc): Rename `file' parameter.
2503         Set new local, `file', to be the file name, or (when it's NULL)
2504         _("standard output") so that all uses of `file' use the proper value.
2505         Use STREQ, not strcmp.
2506
2507 2003-07-20  Paul Eggert  <eggert@twinsun.com>
2508
2509         wc count field widths now are heuristically adjusted depending
2510         on the input size, if known.  If only one count is printed, it
2511         is guaranteed to be printed without leading spaces.
2512
2513         Previously, wc did not align the count fields if
2514         POSIXLY_CORRECT was set, but POSIX did not actually require
2515         this undesirable behavior, so it has been removed.
2516
2517         * NEWS: Document this.
2518         * doc/coreutils.texi (wc invocation): Likewise.
2519
2520         * src/wc.c (number_width): New var.
2521         (posixly_correct): Remove.
2522         (struct fstatus): New struct.
2523         (write_counts): Output fields of width number_width.
2524         Do not worry about POSIXLY_CORRECT.
2525         Use null file, not empty-string file, to denote stdin,
2526         since "" is a valid file name on some hosts.
2527         (wc, wc_file): New arg fstatus.  Use it to avoid invoking fstat
2528         if possible.
2529         (wc):  Avoid problems if end_pos - current_pos overflows.
2530         Do not print odd message if stdin has a read error.
2531         (get_input_fstatus, compute_number_width): New functions.
2532         (main): Use them to implement the new behavior.
2533         Ignore POSIXLY_CORRECT.
2534
2535         * tests/wc/Test.pm: Adjust to the new output widths.
2536
2537 2003-07-19  Jim Meyering  <jim@meyering.net>
2538
2539         * tests/rm/fail-eperm: Don't create temporary directory --
2540         we don't use it.
2541
2542         * tests/shred/remove: Don't open-code test for UID != 0.
2543         Use priv-check's require-non-root instead.
2544         Update to use newer framework.
2545
2546         * tests/help-version (expected_failure_status_expr): Record that
2547         expr exits with status of 3 for e.g., a write error.
2548
2549         * tests/priv-check: Use `id -u' to see if we're running as root,
2550         rather than trying go write to an write-protected file.
2551         When running as root, ensure $NON_ROOT_USERNAME is valid.
2552         When running as root with `require-non-root', ensure that `.'
2553         is writable by $NON_ROOT_USERNAME, then reinvoke $0 set-user-ID
2554         to $NON_ROOT_USERNAME.  If `.' is not writable, then skip the test.
2555
2556         * src/printenv.c: Include "exitfail.h".
2557         (main): Set exit_failure rather than calling close_stdout_set_status.
2558         * src/date.c: Likewise.
2559         * src/sort.c: Likewise.
2560         * src/tty.c: Likewise.
2561
2562 2003-07-18  Jim Meyering  <jim@meyering.net>
2563
2564         * tests/touch/not-owner: Update to use newer framework.
2565
2566         * tests/rm/fail-eperm: Use $srcdir/../priv-check, create a temporary
2567         directory, and remove Perl-coded `you may not run as root' test.
2568         * tests/cp/fail-perm: Use $srcdir/../priv-check, rather than
2569         hard-coding something not quite equivalent.
2570         Paul Jarc reported the inconsistent diagnostics.
2571
2572         * src/sort.c (main): Use close_stdout via atexit.
2573         Now `sort --version' and `sort --help' fail, as they should
2574         when their output is redirected to /dev/full.
2575
2576         * src/su.c (usage): Don't call close_stdout here.
2577         (main): Use close_stdout via atexit.
2578         Now `su --version > /dev/full' fails, as it should.
2579         Somehow, the change of 2000-05-07 that purports to fix this
2580         was not checked in.
2581
2582         * tests/help-version (--help/--version vs. /dev/full): Special-case
2583         `[' to protect it from expected_failure_status-`eval'.
2584
2585         * src/uniq.c (writeline): Use a SPACE, not a TAB between the
2586         count and the corresponding line, as required by POSIX.
2587         Reported by Clement Wang.
2588         * tests/uniq/Test.pm (101, 102): Update tests of -c accordingly.
2589
2590         * tests/expr/basic: Add tests for when exit status is 2.
2591
2592         * src/nohup.c (NOHUP_FOUND_BUT_CANNOT_INVOKE, NOHUP_FAILURE):
2593         Use an anonymous `enum', rather than #define.
2594
2595 2003-07-17  Paul Eggert  <eggert@twinsun.com>
2596
2597         * src/expr.c: Include "exitfail.h", "quotearg.h".
2598         (EXPR_INVALID, EXPR_ERROR): New constants.
2599         (nomoreargs, null, toarith, nextarg): Return bool, not int.
2600         (syntax_error): New function, exiting with status 2.  Use it
2601         insteading of printing "syntax error" ourselves.
2602         (main): Initialize exit_failure to EXPR_ERROR.
2603         Exit with EXPR_INVALID on syntax error (too few arguments).
2604         (nextarg): Use strcmp, not strcoll; strcoll might return
2605         an undesirable 0, or might fail.
2606         (docolon, eval4, eval3): Exit with status 3 on invalid argument type
2607         or other such error.
2608         (eval2): Report an error if strcoll fails in a string comparison.
2609         * src/sort.c: Include "exitfail.h".
2610         (main): Set exit_failure, not xalloc_exit_failure and
2611         xmemcoll_exit_failure.
2612         * tests/expr/basic: Invalid value exits with status 3, not 2.
2613
2614 2003-07-16  Jim Meyering  <jim@meyering.net>
2615
2616         * configure.ac (AC_INIT): Use 5.0.90 as the version, rather than 5.0.2,
2617         per GNU maintainer guidelines.  The next non-beta release will be 5.1.
2618
2619         This script would have caught at least two recent bugs:
2620         those in [ and kill.
2621         * tests/help-version: Revive this script.
2622         It wasn't doing anything useful, since $all_programs wasn't being
2623         defined by the invoking Makefile.am.
2624         Reflect that nohup is no longer a script, so don't exclude it.
2625         Add framework to handle the programs added since it was last run:
2626         kill, stat, unlink, [, link, readlink.
2627         Fix path-related problems deriving from the move of this script
2628         from src/ to its present location.
2629         * tests/Makefile.am (all_programs): Define.
2630         (TESTS_ENVIRONMENT): Use it.
2631
2632         * src/kill.c (main): Fix bug introduced on 2003-05-10 (for 5.0.1)
2633         whereby kill would always attempt to operate on argv[0] and fail.
2634
2635         * src/test.c (integer_expected_error): Improve diagnostic -- now,
2636         it also matches the one from bash's builtin test.
2637         (binary_operator): Add \n at end of diagnostic.
2638
2639         * tests/rm/fail-2eperm: Remove setuidgid-related code.  Move it to ...
2640         * tests/priv-check: Move setuidgid-related and
2641         NON_ROOT_USERNAME-checking code to this file.
2642
2643         * README: Update section on testing as `root'.
2644         Suggestion from Paul Jarc.
2645
2646         * src/test.c (AUTHORS): Replace 3-letter usernames with the actual
2647         names of authors that I just found in bash's builtins/test.def.
2648
2649         Running `[' with no arguments would evoke a segfault.
2650         * src/test.c (main) [LBRACKET]: Move initialization of argv to
2651         precede potential use via test_syntax_error.
2652
2653         * src/Makefile.am (AM_CPPFLAGS): Rename from `INCLUDES', to avoid
2654         warning from automake -Wall.
2655
2656 2003-07-15  Jim Meyering  <jim@meyering.net>
2657
2658         * Version 5.0.1.
2659
2660         * Makefile.maint (%.asc): Remove target first, so gpg doesn't
2661         prompt us about it.
2662
2663         * announce-gen (print_changelog_deltas): Relax tests for matching
2664         version-number line in NEWS.
2665         Change the .sig suffix to .asc here, too.
2666
2667 2003-07-14  Jim Meyering  <jim@meyering.net>
2668
2669         * Makefile.maint (%.asc): Renamed from %.sig.
2670         Generate and use ascii-armored signatures.
2671         Use gpg's -o option.
2672
2673 2003-07-13  Jim Meyering  <jim@meyering.net>
2674
2675         * src/nohup.c (NOHUP_FAILURE, NOHUP_FOUND_BUT_CANNOT_INVOKE): Define.
2676         (main): Use them.
2677
2678         * Makefile.maint (syntax-check): Move each individual check into
2679         its own target.
2680         (syntax-check-rules): This is the list of syntax-check targets.
2681         (sc_unmarked_diagnostics, sc_cast_of_argument_to_free):
2682         (sc_cast_of_x_alloc_return_value, sc_space_tab):
2683         (sc_error_exit_success, sc_xalloc_h_in_src):  New targets.
2684
2685 2003-07-12  Jim Meyering  <jim@meyering.net>
2686
2687         * configure.ac: Remove uses of OPTIONAL_BIN_ZCRIPTS and last
2688         traces of the nohup script.
2689
2690         * src/Makefile.am (bin_SCRIPTS): Remove use of just-removed
2691         $(OPTIONAL_BIN_ZCRIPTS).
2692
2693         * src/Makefile.am (localedir.h): Put the `2>&1' after the redirect
2694         target, not before the `>'.
2695
2696         * src/remove.c (remove_dir): Give a diagnostic upon failed save_cwd,
2697         now that that function no longer calls `error'.
2698
2699         * src/df.c (find_mount_point): Emit a diagnostic for each
2700         failed syscall, rather than relying on caller to do that.
2701         The caller couldn't do a good job, anyhow -- too many different
2702         ways to fail (each with a different referent).
2703         Give a diagnostic upon failed save_cwd, now that that function
2704         no longer calls `error'.
2705         (show_point): Don't diagnose find_mount_point's errors, now that
2706         it handles them itself.
2707
2708         * src/df.c (find_mount_point): Don't let free clobber errno upon
2709         failed chdir.
2710
2711         * src/sys2.h: Remove alloca-related block.
2712         * src/system.h: Include <alloca.h> here, instead.
2713
2714         It appears that the `#pragma alloca' included via "system.h" is
2715         adequate, since join.c uses alloca, yet lacked an in-file #pragma.
2716         * src/copy.c, src/cp.c, src/df.c, src/install.c, src/ln.c:
2717         * src/ls.c, src/mv.c, src/remove.c: Remove `#pragma alloca'.
2718
2719         * src/chown-core.c (change_file_owner): Do not restore any special
2720         permission bits (e.g., set-user-ID, set-group-ID) that are reset
2721         by chown(2) on some systems.  Suggestion and insistence :-) from
2722         Michael Stone.
2723
2724         * tests/input-tty: Also check `test -t 1'.
2725         This is necessary on linux-2.4.21.  Otherwise, the stty/basic-1
2726         test would block when run in the background.
2727
2728 2003-07-11  Jim Meyering  <jim@meyering.net>
2729
2730         * tests/sample-test: Also fail if cat-to-create-expected-output
2731         fails.  Otherwise, if both `exp' and `out' were to end up empty
2732         because of e.g., a full disk, they would mistakenly compare equal.
2733
2734         * src/nohup.c: New file.  Rewrite of nohup.sh in C.
2735         This solves a portability problem: on at least Solaris systems,
2736         when nohup.sh used the vendor /bin/sh, it would exit with status
2737         of `1' rather than the required 126 or 127 upon failure to exec
2738         the specified program.
2739
2740         * src/Makefile.am (EXTRA_SCRIPTS): Remove definition.
2741         (bin_PROGRAMS): Add nohup.
2742         (EXTRA_DIST): Remove nohup.sh.
2743         (all_programs): Remove use of $(EXTRA_SCRIPTS).
2744         * src/nohup.sh: Remove file.
2745         * man/Makefile.am (nohup.1): Depend on nohup.c, rather than nohup.sh.
2746
2747         * tests/misc/nohup: Tests for the above.
2748         * tests/misc/Makefile.am (TESTS): Add nohup.
2749
2750         * src/head.c (diagnose_copy_fd_failure): New function, renamed from
2751         the macro, COPY_FD_DIAGNOSE.
2752         (diagnose_copy_fd_failure): Enclose diagnostic in _(...).
2753         (head_file): Likewise.
2754
2755         * src/date.c: Include "quote.h".
2756         (batch_convert): Use the quote function rather than using literal `...'
2757         in a diagnostic.
2758
2759         * src/setuidgid.c (main): Enclose diagnostic in _(...).
2760         * src/fmt.c (main): Likewise.
2761         * src/mknod.c (main): Likewise.
2762         * src/tac.c (tac_seekable): Likewise.
2763         * src/yes.c (main): Likewise.
2764         * src/od.c (main): Likewise.
2765         * src/install.c (change_attributes): Likewise.
2766
2767 2003-07-10  Jim Meyering  <jim@meyering.net>
2768
2769         * src/head.c (usage): Use 1024*1024 in place of 1048576.
2770         * src/tail.c (usage): Likewise.
2771
2772         * tests/rm/fail-2eperm: Now that we have setuidgid, use it in
2773         place of the kludge in this test.  Suggestion from Paul Jarc.
2774
2775         * src/Makefile.am (noinst_PROGRAMS): Define to setuidgid.
2776         * src/setuidgid.c: New program, solely for testing (not installed).
2777
2778         * src/chown-core.c (change_file_owner): Don't leak file descriptors
2779         when dereferencing symlinks.
2780
2781 2003-07-09  Jim Meyering  <jim@meyering.net>
2782
2783         * tests/du/slash: New file/test for today's lib/ftw.c fix.
2784         * tests/du/Makefile.am (TESTS): Add slash
2785
2786         * src/tail.c (xlseek): Avoid warning about ``return without value
2787         from function returning non-void''.
2788
2789 2003-07-08  Jim Meyering  <jim@meyering.net>
2790
2791         * man/help2man: Update to version 1.29.
2792
2793         * man/help2man: Add END handler to close STDOUT and check for errors.
2794
2795 2003-06-30  Paul Eggert  <eggert@twinsun.com>
2796
2797         Add support for a "[" that conforms to the GNU coding standards,
2798         i.e., that does not depend on its name.
2799         * src/lbracket.c: New file.
2800         * README: Add "[".
2801         * man/Makefile.am (programs): Ignore "[", since it doesn't have
2802         a separate man page.
2803         * src/Makefile.am (bin_PROGRAMS): Add "[".
2804         (__SOURCES): New var.
2805         * src/test.c (LBRACKET): Define to 0 if not defined.
2806         (main): Use LBRACKET rather than argv[0].
2807
2808         * src/test.c (one_argument): Do not check for -t if POSIXLY_CORRECT.
2809         Reported by Paul Jarc and Dan Jacobson.
2810
2811         * src/test.c (main): Do not recognize --help or --version if
2812         POSIXLY_CORRECT, when invoked as "test".  Handle "[ ]" correctly.
2813         Do not bother testing that margv[margc] is non-null.
2814
2815 2003-07-04  Jim Meyering  <jim@meyering.net>
2816
2817         * src/who.c (print_line): Rewrite to use asprintf, in order to be
2818         able to avoid emitting trailing spaces.  Reported by Dan Jacobson.
2819
2820         * tests/misc/head-elide-tail: Add tests of head's new --lines=-N
2821         option, and perform the +1600 invocations of head IFF the envvar
2822         RUN_EXPENSIVE_TESTS is set.
2823
2824 2003-07-03  Jim Meyering  <jim@meyering.net>
2825
2826         * src/cp.c (do_copy): Give a better diagnostic when failing due
2827         to nonexistent destination directory.  Reported by Dmitry Rutsky.
2828         See http://bugs.debian.org/199730 for details.
2829
2830 2003-06-27  Jim Meyering  <jim@meyering.net>
2831
2832         split's --verbose option did nothing [broken in 4.5.10 and 5.0]
2833         * src/split.c (longopts): Use `1', not `0' as the value for
2834         for &verbose.  Reported by Keith Thompson.
2835
2836         Test for the above fix.
2837         * tests/misc/split-a: Also use --verbose and compare stderr
2838         output with what we'd expect.
2839
2840 2003-06-20  Jim Meyering  <jim@meyering.net>
2841
2842         * src/copy.c (copy_internal) [HAVE_STRUCT_STAT_ST_AUTHOR]:
2843         Use `error_t' (rather than int) as type for local `err'.
2844         From Alfred M. Szmidt.
2845
2846 2003-06-19  Marcus Brinkmann  <marcus@gnu.org>
2847
2848         * src/copy.c (copy_internal) [HAVE_STRUCT_STAT_ST_AUTHOR]:
2849         Fix author preservation code.
2850
2851 2003-06-19  Jim Meyering  <jim@meyering.net>
2852
2853         * src/ln.c (ENABLE_HARD_LINK_TO_SYMLINK_WARNING): Define to 0.
2854         (do_link): Don't warn about hard link to symlink.
2855
2856 2003-06-18  Jim Meyering  <jim@meyering.net>
2857
2858         * src/cut.c: Include "getdelim2.h", not "getstr.h".
2859         Reflect renaming: getstr -> getdelim2.
2860
2861         * src/comm.c, src/join.c, src/nl.c, src/uniq.c: Reflect renaming:
2862         readline -> readlinebuffer.
2863
2864 2003-06-09  John David Anglin  <dave.anglin@nrc-cnrc.gc.ca>
2865
2866         * src/readlink.c: Include <sys/types.h> before system.h (because
2867         the latter includes <sys/stat.h>).  Required on Ultrix 4.3.
2868
2869 2003-06-17  Jim Meyering  <jim@meyering.net>
2870
2871         * src/system.h (initialize_main): Define.
2872         Use it in every `main'.  Applied via this:
2873         p='initialize_main (&argc, &argv);'
2874         perl -ni -e '/program_name.=.argv.0/ and print "  '"$p"'\n"; print' \
2875           $(grep -l program_name.=.argv.0 *.c)
2876         test.c uses margc/margv, so I made the change manually for that file.
2877         Based on a patch from Bernard Giroud.
2878
2879 2003-06-09  John David Anglin  <dave.anglin@nrc-cnrc.gc.ca>
2880
2881         Fix for build failure on Ultrix 4.3.
2882         * src/stat.c: Include sys/statvfs.h in preference to sys/vfs.h.
2883         Include sys/param.h and sys/mount.h on ultrix.
2884
2885 2003-06-16  Jim Meyering  <jim@meyering.net>
2886
2887         * src/touch.c (O_NDELAY, O_NONBLOCK, O_NOCTTY, EISDIR): Remove
2888         definitions.
2889         * src/system.h (O_NDELAY, O_NONBLOCK, O_NOCTTY, EISDIR): Define
2890         them here instead, but with one change: define EISDIR to -1, not 0.
2891
2892         * src/cat.c (cat): Remove `#ifndef ENOSYS', now that it's
2893         guaranteed to be defined.
2894         * src/system.h (ENOSYS, ENOTSUP): Define to -1 if not defined.
2895
2896         * README: Mention the CVS repository.
2897         Encourage addition of test cases.
2898
2899 2003-06-12  Jim Meyering  <jim@meyering.net>
2900
2901         * src/touch.c (touch): Call close only if necessary.
2902         From Bruno Haible.
2903
2904         * src/wc.c (usage): Correct wording: wc prints counts in the order
2905         `newline, word, byte'.  Reported by Keith M. Briggs.
2906         * man/wc.x: Fix it here, too.  And change `lines' to `newlines'.
2907
2908 2003-06-10  Jim Meyering  <jim@meyering.net>
2909
2910         * tests/date/Test.pm: Add a test for the new format, e.g., May-23-2003.
2911
2912 2003-06-07  Jim Meyering  <jim@meyering.net>
2913
2914         * Makefile.maint (syntax-check): Add commented-out (over-aggressive)
2915         rule.
2916
2917 2003-06-06  Jim Meyering  <jim@meyering.net>
2918
2919         * src/extract-magic (main): Avoid newer 3-arg form of open,
2920         so this script works also with e.g., perl5.005_03.
2921         Patch by John David Anglin.
2922
2923 2003-06-04  Paul Eggert  <eggert@twinsun.com>
2924
2925         * src/system.h: Include <stdbool.h> unconditionally.
2926
2927 2003-06-04  Jim Meyering  <jim@meyering.net>
2928
2929         * man/Makefile.am (check-programs-vs-x): Rename target
2930         from check-programs-vs-1.  Adjust rule to check for the
2931         primary (.x) file, not the generated one (.1).
2932
2933 2003-06-03  Tim Mooney <mooney@dogbert.cc.ndsu.NoDak.edu>
2934
2935         * man/kill.x: New file.
2936         * man/Makefile.am (dist_man_MANS): Add kill.1.
2937         (kill.1): New rule.
2938
2939 2003-06-04  Jim Meyering  <jim@meyering.net>
2940
2941         Ensure that the .x file for a new program is never forgotten again.
2942         * man/Makefile.am (programs): Define.
2943         (check-programs-vs-1): New phony target.
2944         (check-local): Depend on it.
2945
2946 2003-06-03  Jim Meyering  <jim@meyering.net>
2947
2948         Avoid unnecessary copying of environment.
2949         * src/env.c (main): Rather than clearing the environment and --
2950         unless told to ignore environment -- copying all settings from
2951         the saved, original environment, clear the environment only when
2952         that is requested.  Suggested by Jens Elkner.
2953
2954 2003-06-02  Jim Meyering  <jim@meyering.net>
2955
2956         * src/system.h: Always include <string.h>, since we assume C89.
2957         Include <limits.h> without checking for HAVE_LIMITS_H.
2958
2959         * src/test.c [!TEST_STANDALONE]: Remove #if-0'd block.
2960         (STREQ, S_IXUGO): Remove redundant (in system.h) definitions.
2961
2962 2003-06-01  Jim Meyering  <jim@meyering.net>
2963
2964         Avoid a race condition in `tail -f' described by Ken Raeburn in
2965         http://mail.gnu.org/archive/html/bug-textutils/2003-05/msg00007.html
2966         * src/tail.c (file_lines): Add new parameter, *read_pos, and set it.
2967         (pipe_lines, pipe_bytes, start_bytes, start_lines): Likewise.
2968         (tail_bytes, tail_lines, tail): Likewise.
2969         (tail_file): Use the new `read_pos' value as the size,
2970         rather than stats.st_size from the fstat call.
2971
2972 2003-05-28  Jim Meyering  <jim@meyering.net>
2973
2974         * src/extract-magic: Allow expansion of `$file' in the here-
2975         document corresponding to the comment at the top of fs.h.
2976
2977 2003-05-26  Jim Meyering  <jim@meyering.net>
2978
2979         * src/stat.c: Fix portability problem on FreeBSD5.0: don't include
2980         <sys/statvfs.h> on systems without HAVE_STRUCT_STATVFS_F_BASETYPE.
2981         Use #if/#elif/... cascade so we get only one set of include files.
2982         Reported by Nelson Beebe.
2983
2984 2003-05-24  Jim Meyering  <jim@meyering.net>
2985
2986         * src/md5sum.c (split_3): Accept the BSD format only when in MD5 mode.
2987         * tests/sha1sum/basic-1: Make sure `sha1sum --check' doesn't
2988         accept the BSD format.
2989
2990 2003-03-28  Joe Orton  <jorton@redhat.com>
2991
2992         * src/md5sum.c (bsd_split_3): New function.
2993         (split_3): Detect checksums from BSD 'md5' command and handle them
2994         using bsd_split_3.
2995
2996         * tests/md5sum/basic-1: New tests for --check exit status, and for
2997         BSD-style checksum files.
2998
2999 2003-05-21  Jim Meyering  <jim@meyering.net>
3000
3001         * src/head.c (elide_tail_lines_pipe): Fix a thinko.
3002         This sort of thing is why it'd be *Really Good* to factor
3003         out the common code used here and in tail.c.
3004
3005 2003-05-14  Jim Meyering  <jim@meyering.net>
3006
3007         * src/head.c (usage): Document new feature: --bytes=-N and --lines=-N.
3008
3009         * tests/du/slink: Skip this test if `.' is on an XFS file system.
3010
3011         * tests/du/fd-leak: New file.  Test for the bug in du that
3012         was fixed by the 2003-05-12 change to lib/ftw.c.
3013         * tests/du/Makefile.am (TESTS): Add fd-leak.
3014
3015         * src/head.c (AUTHORS): Enclose string in N_(...), now that it
3016         includes a translatable word, `and'.
3017
3018         * src/dd.c (usage): Don't use `,' as the thousands separator
3019         in e.g. 1,000,000 and 1,048,576.  Instead, do this:
3020         `SIZE may be ..., MB 1000*1000, M 1024*1024 and so on...'
3021         * src/df.c (usage): Likewise.
3022         * src/du.c (usage): Likewise.
3023         * src/ls.c (usage): Likewise.
3024
3025         * Makefile.maint (syntax-check): Add another check.
3026
3027 2003-05-13  Paul Eggert  <eggert@twinsun.com>
3028
3029         Fix uniq to conform to POSIX, which requires that "uniq -d -u"
3030         must output nothing.  Problem reported by Josh Hyman.
3031
3032         * src/uniq.c (enum output_mode, mode): Remove, replacing with:
3033         (output_unique, output_first_repeated, output_later_repeated):
3034         New vars.  All uses of "mode" changed to use these variables,
3035         which are not mutually exclusive as "mode" was.
3036         (writeline): New arg "match", used to control whether to
3037         obey output_first_repeated or output_later_repeated.
3038         All callers changed.
3039         (check_file, main): Adjust to above changes.
3040
3041         * tests/uniq/Test.pm: Test that 'uniq -d -u' outputs nothing.
3042
3043 2003-05-14  Jim Meyering  <jim@meyering.net>
3044
3045         * tests/rm/rm3: Use tr's \n notation rather than \012.
3046         This package can afford to do that, since its tests are guaranteed use
3047         GNU tr, which has accepted the more modern notation for 10 years.
3048         * tests/rm/rm5: Likewise.
3049         * tests/cp/same-file: Likewise.
3050         * tests/stty/row-col-1: Likewise.
3051         * tests/stty/basic-1: Likewise.
3052         * tests/rm/deep-1: Likewise.
3053         * tests/mv/part-symlink: Likewise.
3054         * tests/mkdir/perm: Likewise.
3055         * tests/misc/nice: Likewise.
3056
3057 2003-05-13  Jim Meyering  <jim@meyering.net>
3058
3059         * src/copy.c (struct F_triple) [name]: Remove const attribute.
3060         (triple_free): Don't apply cast to argument of free.
3061         (seen_file): Add cast here instead.
3062
3063         * src/cp-hash.c (struct Src_to_dest) [name]: Remove const attribute.
3064         (src_to_dest_free): Don't apply cast to argument of free.
3065
3066         * src/sort.c (zaptemp): Don't apply cast to argument of free.
3067         * src/pr.c (init_fps, init_store_cols): Likewise.
3068         * src/join.c (delseq, freeline): Likewise.
3069         * src/expr.c (OLD): Likewise.
3070         * src/sort.c (sort): Likewise.
3071         * src/head.c (elide_tail_lines_pipe): Likewise.
3072
3073         * src/tail.c: Include "quote.h".
3074         Use quote in diagnostics.  Change many error format strings
3075         from just `%s' to e.g., `error reading %s'.
3076         (pipe_lines): Change type of parameter, n_lines, to uintmax_t.
3077         Rewrite newline-counting loop to use memchr.
3078
3079         * src/head.c (elide_tail_lines_pipe): Use `if', not assert.
3080         Now that assert is no longer used, don't include <assert.h>.
3081
3082 2003-05-12  Jim Meyering  <jim@meyering.net>
3083
3084         * src/head.c: Include <assert.h>.
3085         (AUTHORS): Add my name.
3086         (elide_tail_lines_pipe): New function.
3087
3088 2003-05-10  Jim Meyering  <jim@meyering.net>
3089
3090         * Makefile.maint (syntax-check): Check for `error (EXIT_SUCCESS,'.
3091
3092         * src/readlink.c (main): Set program_name before first use.
3093         Remove that (redundant) first use.
3094         Don't exit successfully just because --verbose was specified.
3095         Pass 0, not EXIT_SUCCESS, as first argument to error; when that
3096         parameter is 0, error does not exit.
3097
3098         * src/uname.c (main): When failing due to too many arguments, also say
3099         that, rather than just "Try `uname --help' for more information.".
3100         * src/comm.c (main): Likewise, but for too few arguments.
3101         * src/logname.c: Include error.h.
3102         (main): Say why we're failing.
3103
3104         * src/uniq.c (main): Don't segfault when argc < optind.
3105         * src/who.c (main): Handle argc < optind.
3106         * src/df.c (main): Likewise.
3107         * src/install.c (main): Likewise.
3108         * src/mv.c (main): Likewise.
3109         * src/pwd.c (main): Likewise.
3110         * src/tty.c (main): Likewise.
3111         * src/chroot.c (main): Likewise.
3112         * src/hostname.c: Likewise.
3113         * src/du.c (main): Likewise.
3114         * src/expand.c (main): Likewise.
3115         * src/env.c (main): Likewise.
3116         * src/unexpand.c (main): Likewise.
3117         * src/printenv.c (main): Likewise.
3118         * src/sync.c (main): Handle argc == 0.
3119         * src/expr.c (main): Likewise.
3120         * src/printf.c (main): Likewise.
3121         * src/basename.c (main): Likewise.
3122         * src/ln.c (main): Test for `missing argument' before computing n_files.
3123         * src/tail.c (main): Test for the case of no arguments before
3124         computing n_files.
3125
3126         * src/kill.c (send_signals): Don't check command line arguments here.
3127         (main): Check them here instead.  Handle argc < optind.
3128
3129         * src/logname.c (main): Use error, rather than fprintf, for the sake
3130         of consistency.
3131
3132         * src/rm.c (main): Don't overrun array bound if argc is 0.
3133
3134 2003-05-09  Jim Meyering  <jim@meyering.net>
3135
3136         * src/sort.c (main): Don't overrun array bound if argc is 0.
3137         That would happen when invoked via: execl ("/usr/bin/sort", NULL);
3138         Reported by Wartan Hachaturow.
3139
3140 2003-05-07  Jim Meyering  <jim@meyering.net>
3141
3142         Implement support so that `head --lines=-N' works on seekable files.
3143         * src/head.c (enum Copy_fd_status): Define.
3144         (COPY_FD_DIAGNOSE): New macro.
3145         (elide_tail_lines_seekable): New funtion.
3146         (elide_tail_lines_file): Call it here.
3147
3148 2003-05-06  Jim Meyering  <jim@meyering.net>
3149
3150         * src/sys2.h (CHAR_BIT): Remove duplicate definition.
3151
3152 2003-05-04  Jim Meyering  <jim@meyering.net>
3153
3154         * tests/head/Test.pm: Remove tests of --bytes=-N; using that framework
3155         caused the addition of thousands of small files to the tar archive.
3156         * tests/misc/head-elide-tail: New file.  Add them here instead.
3157         * tests/misc/Makefile.am (TESTS): Add head-elide-tail.
3158
3159 2003-05-04  Paul Eggert  <eggert@twinsun.com>
3160
3161         * src/remove.c (HAVE_WORKING_READDIR): Define to 0 if not defined.
3162         (IF_READDIR_NEEDS_REWINDDIR): Remove.
3163         (remove_cwd_entries): Rewrite to avoid IF_READDIR_NEEDS_REWINDDIR,
3164         which was a bit weird because it couldn't be emulated by a function.
3165
3166 2003-05-03  Jim Meyering  <jim@meyering.net>
3167
3168         Extend head to accept --lines=-N (--bytes=-N) and to print all
3169         but the N lines (bytes) at the end of the file.
3170         * src/head.c: Include full-write.h, full-read.h, inttostr.h, quote.h.
3171         Use quote() in diagnostics, rather than literal `' marks.
3172         (copy_fd, elide_tail_bytes_pipe, elide_tail_bytes_file):
3173         New functions.
3174         (elide_tail_lines_pipe, elide_tail_lines_file): New functions.
3175         (head_file): Reorganize so as to call head from only one place.
3176         (main): Likewise, for head_file.
3177         Handle new, undocumented option, --presume-input-pipe.
3178         Handle negative line and byte counts.
3179         * tests/head/Test.pm: Add lots of tests to exercise --bytes=-N.
3180
3181         * tests/du/8gb: Skip test if the file system of `.' doesn't support
3182         sparse files -- otherwise it'd create a file of size 8GB.
3183
3184 2003-05-02  Jim Meyering  <jim@meyering.net>
3185
3186         * src/fmt.c (usage): Don't mention obsolescent -WIDTH option.
3187         Instead explain about `-' and standard input.
3188         (main): Give a proper diagnostic for e.g., `fmt -c -72'.
3189         Reported by Keith Thompson.
3190         * tests/fmt/basic: Add test for the above fix.
3191
3192         * src/fmt.c: Include "quote.h".
3193         Use quote() in diagnostics, rather than literal `' marks.
3194         (main): Exit nonzero when unable to open an input file.
3195         * tests/fmt/basic: Add test for the above fix.
3196
3197         * src/fmt.c (main): Diagnose invalid suffix on obsolescent width
3198         specifications like `-72x'.
3199         * tests/fmt/basic: Add test for the above fix.
3200
3201         Work around nasty readdir bug on Darwin6.5.
3202         * src/remove.c (IF_READDIR_NEEDS_REWINDDIR): Define.
3203         [! HAVE_WORKING_READDIR] (remove_cwd_entries): If readdir has just
3204         returned NULL and there has been at least one successful unlink or
3205         rmdir call since the opendir or previous rewinddir, then call
3206         rewinddir and reiterate the loop.
3207
3208         Factor out common code.
3209         * src/remove.c (readdir_ignoring_dotdirs): New function.
3210         (is_empty_dir): Use it here.
3211         (remove_cwd_entries): Use it here.
3212
3213 2003-05-01  Jim Meyering  <jim@meyering.net>
3214
3215         * tests/rm/r-3: Create 500 rather than just 300 files.
3216         There's a bug in Darwin6.5's readdir that shows up only with
3217         338 or more files.
3218         Fix a bug in this test: `cd $pwd' (not to `..'), now that $tmp
3219         has two components.
3220
3221         * src/tail.c:
3222         Change type of n_units, n_bytes, n_lines to be `uintmax_t'.
3223         (dump_remainder): Move two declarations `down' into the scope
3224         where they are used.
3225         (xlseek): Return the resulting offset.
3226         (file_lines): Rename parameter, file_length, to end_pos.
3227         (pipe_lines): Don't coerce safe_read return value to `int'.
3228         Adapt tests accordingly.
3229         (pipe_bytes) [struct charbuffer] (nbytes): Change type from `int'
3230         to `unsigned int'.
3231         Change type of `total_bytes' from `int' to `size_t',
3232         since the former wouldn't always be wide enough.
3233         Don't coerce safe_read return value to `int',
3234         and adapt tests accordingly.
3235         Now that testing for a read error no longer involves
3236         using `tmp', handle that case *after* freeing `tmp'.
3237         (start_bytes): Clean up.
3238         (tail_bytes): Now that `n_bytes' may be larger than
3239         OFF_T_MAX, test for that condition and, if it's true, don't
3240         use lseek optimizations.
3241         (parse_options): Don't fail just because N_UNITS is larger than
3242         the maximum size of a file -- tail may be applied to an input
3243         stream (e.g., a pipe) with more data than that.
3244
3245         * Makefile.maint (syntax-check): Rename from alloc-check.
3246         Also check for SPACE-TAB sequences.
3247         Also check for malloc/calloc/realloc casts.
3248
3249 2003-05-01  Jim Meyering  <jim@meyering.net>
3250
3251         * src/tail.c (start_lines): Rewrite to use memchr.  Clean up.
3252
3253 2003-04-28  Jim Meyering  <jim@meyering.net>
3254
3255         * tests/misc/tty-eof: Send two tokens, not just one, so we don't
3256         make the now-more-picky tsort fail.
3257
3258 2003-04-24  Jim Meyering  <jim@meyering.net>
3259
3260         * src/tsort.c (tsort): Remove unnecessary test of have_read_stdin.
3261         (main): Minor syntactic clean-up.
3262
3263         * src/tsort.c (tsort): Fail if the input contains an odd number of
3264         tokens.  Reported by junkio@cox.net.
3265
3266         * tests/tsort/basic-1: Test for the above fix.
3267
3268 2003-04-21  Jim Meyering  <jim@meyering.net>
3269
3270         * tests/misc/printf: Add tests for the printf fixes below.
3271
3272         * Makefile.cfg (cvs_files): Add $(srcdir)/config/depcomp to the list.
3273
3274 2003-04-20  Paul Eggert  <eggert@twinsun.com>
3275
3276         Fix printf POSIX compatibility bug reported by Ben Harris in
3277         <http://mail.gnu.org/archive/html/bug-coreutils/2003-04/msg00070.html>.
3278         * doc/coreutils.texi (printf invocation): It's \NNN in the format,
3279         \0NNN in the %b operand.
3280         * src/printf.c (usage): Likewise.
3281         (print_esc): New arg OCTAL0 to specify whether \0NNN or \NNN
3282         is desired.  All uses changed.  Behave like Bash printf if %b
3283         operand uses \NNN where the initial N is not 0.
3284
3285 2003-04-17  Jim Meyering  <jim@meyering.net>
3286
3287         * src/stty.c: Remove uses of PROTOTYPE macro.
3288
3289 2003-04-15  Jim Meyering  <jim@meyering.net>
3290
3291         * Makefile.maint: Remove (or replace-with-TAB(s) to retain alignment)
3292         each sequence of spaces before a TAB character.
3293
3294 2003-04-13  Jim Meyering  <jim@meyering.net>
3295
3296         * src/remove.c (is_empty_dir): Don't closedir (NULL).
3297
3298 2003-04-12  Jim Meyering  <jim@meyering.net>
3299
3300         Giving nl an invalid STYLE argument (in --header-numbering=STYLE (-h),
3301         --body-numbering=STYLE (-b), or --footer-numbering=STYLE (-f)) or
3302         FORMAT (--number-format=FORMAT (-n)) would not give a useful diagnostic.
3303         * src/nl.c (main): Fix those problems and remove literal quote marks
3304         (e.g., "`%s'") from format string; instead use "%s" in each format
3305         string and `quote (optarg)' as the corresponding argument.
3306         Also, diagnose all invalid command line options before failing.
3307
3308         * src/nl.c (proc_text): Fix a bug that would make nl output extra
3309         newlines in some cases.  Details here: http://bugs.debian.org/177256.
3310         This bug was introduced on 2001-11-10 for textutils-2.0.17.
3311         * tests/misc/nl: Add test for the above-fixed bug.
3312
3313         * tests/misc/readlink: New file.  Test the --canonicalize option.
3314         * tests/misc/Makefile.am (TESTS): Add readlink.
3315
3316 2003-04-11  Jim Meyering  <jim@meyering.net>
3317
3318         Clean up.
3319         * src/chown.c, src/cp.c, src/dircolors.hin, src/du.c, src/ln.c:
3320         * src/mkfifo.c, src/ptx.c, src/spline.c, src/stty.c, src/tail.c:
3321         * src/test.c, src/unexpand.c: Remove (or replace-with-TAB(s) to
3322         retain alignment) each sequence of spaces before a TAB character.
3323
3324         * src/ls.c: Include <stdlib.h> unconditionally.
3325
3326         * Makefile.maint (xalloc-check): Rename from header-check.
3327
3328         * src/yes.c: Include error.h after system.h, not before.
3329
3330         Clean up.
3331         * src/copy.c, src/cp-hash.c, src/cp.c, src/csplit.c, src/cut.c:
3332         * src/date.c, src/df.c, src/du.c, src/expand.c, src/expr.c, src/id.c:
3333         * src/join.c, src/md5sum.c, src/nl.c, src/od.c, src/paste.c, src/pr.c:
3334         * src/ptx.c, src/sort.c, src/split.c, src/su.c, src/tail.c, src/tee.c:
3335         * src/tr.c: * src/unexpand.c, src/users.c:
3336         Remove anachronistic casts of xmalloc, xrealloc, and xcalloc
3337         return values and of xrealloc's first argument.
3338         Fix the former with this:
3339         perl -pi -e 's/\([^(]*?\*\) *(x(m|c|re)alloc)\b/$1/'
3340
3341 2003-04-10  Jim Meyering  <jim@meyering.net>
3342
3343         * src/stty.c (wrapf): Declare with format attribute.
3344
3345         The S_MAGIC_... names shouldn't be maintained in two places (prior
3346         to this change, one would have to keep stat.c and fs.h in sync).
3347         This change makes it so those names and the corresponding
3348         hexadecimal constants all reside in stat.c.  fs.h is now generated.
3349         * src/Makefile.am (fs.h): New rule to generate fs.h from stat.c.
3350         (BUILT_SOURCES): Add fs.h, now that it's generated.
3351         (EXTRA_DIST): Add extract-magic.
3352         * src/extract-magic: New script to extract fs.h definitions from stat.c.
3353         * src/stat.c (human_fstype) [__linux__]: Append each hex constant from
3354         fs.h in a comment after the corresponding `case S_MAGIC_...:' statement.
3355
3356         * tests/tail-2/big-4gb: Skip this test (don't fail) if creating a
3357         file with nominal length > 4GB fails.  Reported by Michael Deutschmann.
3358
3359         * man/unexpand.x: Add `SEE ALSO' reference to expand.
3360         * man/expand.x: Add `SEE ALSO' reference to unexpand.
3361         Suggestion from Dan Jacobson.
3362
3363 2003-04-10  Maciej W. Rozycki  <macro@ds2.pg.gda.pl>
3364
3365         * src/fs.h (S_MAGIC_DEVPTS): New magic for Linux's devpts.
3366         * src/stat.c (human_fstype): Handle Linux's devpts.
3367
3368 2003-04-09  Paul Eggert  <eggert@twinsun.com>
3369
3370         * src/split.c (line_bytes_split): Arg is of type size_t, since
3371         that's all that is supported for now.
3372         (main): Check for overflow in obsolescent line count option.
3373
3374 2003-04-09  Jim Meyering  <jim@meyering.net>
3375
3376         * tests/misc/split-fail: Add a new test for the above fix.
3377
3378         * src/split.c (bytes_split): Use size_t temporary (rather than
3379         uintmax_t original) in remaining computations.  From Paul Eggert.
3380
3381         Handle command line option arguments larger than 2^31.
3382         This allows e.g., splitting into files of size 2GB and larger,
3383         and running split --lines=N with N=2^31 or more.
3384         But for --line-bytes=N, the restriction that N <= SIZE_MAX
3385         remains (for now), due to the way it is implemented.
3386
3387         * src/split.c: Include "inttostr.h".
3388         (bytes_split, lines_split, line_bytes_split, main):
3389         Use uintmax_t, not size_t, for file sizes.
3390         (main): Give a better diagnostic for option arguments == 0.
3391         Use umaxtostr to print file sizes.
3392         Reported by Luke Hassell.
3393
3394 2003-04-08  Jim Meyering  <jim@meyering.net>
3395
3396         * src/rm.c (usage): Mention that --directory (-d) works only
3397         on some systems.  Suggestion from Samuel Tardieu.
3398
3399         * tests/basename/basic: Run $PERL to see if it is available,
3400         rather than testing its value.
3401         * tests/sum/sysv, tests/tsort/basic-1, tests/unexpand/basic-1:
3402         * tests/basename/basic, tests/dd/skip-seek, tests/dircolors/simple:
3403         * tests/expr/basic, tests/factor/basic, tests/fmt/basic:
3404         * tests/ls-2/tests, tests/md5sum/basic-1, tests/md5sum/newline-1:
3405         * tests/misc/sort, tests/misc/tty-eof, tests/mv/i-1:
3406         * tests/rm/empty-name, tests/rm/fail-eperm, tests/rm/unreadable:
3407         * tests/seq/basic, tests/sha1sum/basic-1, tests/sha1sum/sample-vec:
3408         * tests/sum/basic-1, tests/seq/basic: Likewise.
3409
3410         * tests/misc/Makefile.am (TESTS): Add split-fail.
3411         * tests/misc/split-fail: New file.
3412
3413         * src/split.c: Rename local variables: nchars -> n_bytes.
3414         (lines_split): Rename local, nlines -> n_lines.
3415         (main): Rename local variable: s/accum/n_units/.
3416         (main): Use STDIN_FILENO, not literal `0'.
3417
3418 2003-04-07  Jim Meyering  <jim@meyering.net>
3419
3420         * src/stat.c: Add #include directives for Ultrix 4.4.
3421         Based on a suggested change from Bert Deknuydt.
3422
3423 2003-04-06  Jim Meyering  <jim@meyering.net>
3424
3425         * Makefile.maint (makefile-check): New rule.
3426         (local-check): Add it.
3427
3428 2003-04-05  Jim Meyering  <jim@meyering.net>
3429
3430         * Makefile.am (nearly all of them):
3431         Use $(VAR) rather than @VAR@, now that we can rely on automake to
3432         emit a definition for each substituted variable.
3433         * tests/Makefile.am.in: Likewise.
3434
3435         * tests/rm/rm5: Add a comment explaining why this test fails when
3436         using Tru64's broken sed.
3437         * tests/rm/rm3: Likewise.
3438
3439         Make `kill -t' output signal descriptions (not `?') on Tru64.
3440         * src/kill.c (sys_siglist): Also check for __sys_siglist.
3441         Patch by Tony Leneis.
3442         * configure.ac: Also check for declaration of __sys_siglist.
3443         Required for Tru64 4.0D, 4.0F, and 5.1.
3444         Reported by Tony Leneis.
3445
3446 2003-04-04  Jim Meyering  <jim@meyering.net>
3447
3448         * src/Makefile.am (PERL): Remove unnecessary definition.
3449
3450         Because of inappropriate (but POSIX-mandated) behavior of rename,
3451         `mv a b' would not remove `a' in some unusual cases.  Work around
3452         this by unlinking `a' when necessary.
3453
3454         * src/copy.c (same_file_ok): Add an output parameter.
3455         Set it in the offending case.
3456         (copy_internal): When necessary, unlink SRC_PATH and inform caller.
3457         Reported by Ed Avis.
3458         * tests/mv/hard-4: New test for the above.
3459         * tests/mv/Makefile.am (TESTS): Add hard-4.
3460
3461         Clean up rules for automatically generated sources:
3462         * src/Makefile.am (dircolors.h, wheel-size.h, wheel.h, false.c):
3463         Make each generated file be read-only.
3464         Add each file name to BUILT_SOURCES separately.
3465         (MAINTAINERCLEANFILES): Set to $(BUILT_SOURCES).
3466
3467         Put LOCALEDIR macro definition in new file: localedir.h.
3468         * src/Makefile.am (DEFS): Remove definition.
3469         (localedir.h): New rule.
3470         (BUILT_SOURCES, DISTCLEANFILES): Add localedir.h.
3471         * src/system.h: Include "localedir.h".
3472
3473 2003-04-02  Jim Meyering  <jim@meyering.net>
3474
3475         * Version 5.0.
3476
3477         * tests/misc/Makefile.am (TESTS): Add false.
3478
3479         * Makefile.maint (TMPDIR): Make sure it's defined.
3480         (my-distcheck): Build in $(TMPDIR), not `.'.
3481
3482         * src/Makefile.am (false.c): Change all occurrences of
3483         `(EXIT_SUCCESS)' to `(EXIT_FAILURE)' so that false exits
3484         unsuccessfully also with --help.  Reported by Paul Jarc,
3485         * tests/misc/false: New test for the above.
3486
3487 2003-03-30  Jim Meyering  <jim@meyering.net>
3488
3489         * NEWS: Note the location of older NEWS files.
3490
3491         * src/remove.c (is_empty_dir): Don't let a failing closedir
3492         clobber errno.  Spotted by Arnold Robbins.
3493
3494         * src/env.c: Fix typo in comment.  From Arnold Robbins.
3495
3496 2003-03-29  Jim Meyering  <jim@meyering.net>
3497
3498         * Version 4.5.12.
3499
3500         * README: Note to expect build problems for stat.c on Ultrix 4.3.
3501         Note that there are some harmless test failures when running
3502         `make check' as root on some systems.
3503
3504 2003-03-28  Jim Meyering  <jim@meyering.net>
3505
3506         * tests/stty/row-col-1: Skip this test if stty can't get window size.
3507         This happens when connecting to sparc-solaris5.7 via ssh from within
3508         emacs.  Reported by Karl Berry.
3509
3510         * tests/du/basic: Use seq, not `yes' to generate 4KB of data.
3511         Otherwise, on systems (DJGPP) that emulate pipes using files,
3512         this test would never complete, waiting for `yes' to terminate.
3513         * tests/du/slink: As above, use seq, not `yes' to generate link target.
3514         * tests/rm/hash: As above, use seq, not `yes' to generate dir name.
3515         Reported by Rich Dawe.
3516
3517 2003-03-27  Jim Meyering  <jim@meyering.net>
3518
3519         * src/id.c: Remove Arnold Robbins' obsolete e-mail address
3520         from `written by...' comment, at his request.
3521
3522 2003-03-24  Paul Eggert  <eggert@twinsun.com>
3523
3524         Fix buffer overrun problem reported by TAKAI Kousuke, along
3525         with some other POSIX incompatibilities.
3526
3527         * src/printf.c (print_esc): Do not treat \x specially if
3528         POSIXLY_CORRECT.  Avoid buffer overrun if the format ends
3529         in backslash.  Treat incomplete escape sequences as strings
3530         of characters, as POSIX requires.
3531         (print_formatted): Allow multiple flags.  Avoid buffer overrun
3532         if the format is incomplete.
3533
3534 2003-03-24  Jim Meyering  <jim@meyering.net>
3535
3536         * tests/misc/printf: Add tests for the above fixes and changes.
3537
3538 2003-03-26  Jim Meyering  <jim@meyering.net>
3539
3540         * src/copy.h (struct cp_options): Add a comment.
3541
3542 2003-03-23  Jim Meyering  <jim@meyering.net>
3543
3544         * README: Describe problem with 64-bit mode on HPUX 11.x,
3545         with patch for /usr/include/inttypes.h.
3546         * TODO: Plan to add an autoconf test to work around the bug.
3547
3548 2003-03-22  Jim Meyering  <jim@meyering.net>
3549
3550         * src/stat.c: Don't include <sys/sysmacros.h>.
3551         That is already done via system.h.  Otherwise, the multiple
3552         inclusion would evoke redefinition warnings from Cray's /bin/cc,
3553         aka Cray Standard C Version 4.0.3  (057126) Mar 22 2003  22:02:28.
3554         (human_fstype): Factor some directives `up', out of this function.
3555         Cast away `const' to avoid error from Cray's /bin/cc.
3556
3557 2003-03-20  Jim Meyering  <jim@meyering.net>
3558
3559         * announce-gen (print_changelog_deltas): Ensure that a newline
3560         precedes each row of `*'s.
3561
3562 2003-03-20  Jim Meyering  <jim@meyering.net>
3563
3564         * Version 4.5.11.
3565
3566         * src/seq.c (valid_format): Also accept ` ' and `'' as valid
3567         format flag characters.
3568         Do not require that a field width be specified.
3569         Do not fail when given a field width of `0'.
3570         Reported by Dan Jacobson.
3571         * tests/seq/basic: Add new tests for the above-fixed bug.
3572
3573         * src/Makefile.am (all-local): Append $(EXEEXT) to use of `su'
3574         (install-root): Likewise.
3575         (install-exec-local): Likewise.
3576         Based on a patch from Richard Dawe.
3577
3578 2003-03-19  Jim Meyering  <jim@meyering.net>
3579
3580         * man/Makefile.am (.x.1): Use $(LN_S) instead of 'ln -s',
3581         because the DJGPP 2.03 port of 'ln -s' doesn't work.
3582         Include $(EXEEXT) in program names.
3583         Since $(LN_S) may degenerate to `cp -p', be careful
3584         to invoke it from the destination directory.
3585         Mostly from Richard Dawe.
3586         * configure.ac: Use AC_PROG_LN_S.
3587
3588         * tests/mv/part-symlink: Unset CDPATH.  Otherwise, having the
3589         CDPATH shell variable set could cause this test to fail.
3590         Reported by Karl Berry.
3591
3592 2003-03-18  Jim Meyering  <jim@meyering.net>
3593
3594         * src/fmt.c [struct Word] (paren, period, punct, final): Change the
3595         type of each member from bool <MEMBER>:1 to unsigned int <MEMBER>:1.
3596         AIX 5.1's xlc could not compile the former.
3597         Patch by Petter Reinholdtsen.  Also reported by Mike Jetzer.
3598
3599 2003-03-17  Richard Dawe  <rich@phekda.freeserve.co.uk>
3600
3601         * configure.ac: Include $(EXEEXT) in OPTIONAL_BIN_PROGS'
3602         program names, since automake only adds $(EXEEXT) to programs
3603         in its *_PROGRAMS.
3604
3605 2003-03-16  Jim Meyering  <jim@meyering.net>
3606
3607         * src/remove.c (rm): Put two local variables in static storage,
3608         so they can't be clobbered by the potential longjmp.
3609
3610 2003-03-15  Jim Meyering  <jim@meyering.net>
3611
3612         * Makefile.cfg (gnu_rel_host): Fix code to match the comment
3613         so that a version number with a two-digit component can still count
3614         as an alpha release.  Reported by Richard A Downing.
3615         (gnu_rel_host): Define in terms of $(RELEASE_TYPE) instead.
3616
3617 2003-03-14  Jim Meyering  <jim@meyering.net>
3618
3619         * src/ansi2knr.c: Remove no-longer-used file.
3620         * src/ansi2knr.1: Likewise.
3621
3622         * Makefile.maint (prev_version_file): Don't use ?= for this particular
3623         assignment, since it causes trouble with old versions of GNU make
3624         (e.g. 3.76.1).  The other uses of `?=' are inoffensive.  Details here.
3625         http://mail.gnu.org/archive/html/bug-coreutils/2003-03/msg00028.html
3626         Patch from Alexandre Duret-Lutz.
3627
3628         * Use patched automake-1.7.3.  Regenerate Makefile.in files in
3629         subdirectories so that each includes a definition of ACLOCAL_M4.
3630
3631         * announce-gen (main): Label the compressed source URLs.
3632
3633         * Version 4.5.10.
3634
3635         * tests/du/slink: Relax the test for the `local'ness of a file system,
3636         so that now it works also for tmpfs.
3637
3638         * tests/du/hard-link: Transform output from first du, so that this
3639         test doesn't fail on file systems like tmpfs that order directory
3640         entries differently.
3641
3642 2003-03-13  Jim Meyering  <jim@meyering.net>
3643
3644         * tests/du/8gb: Work around what appears to be an NFS failure that
3645         would make this test fail on some systems.
3646
3647 2003-03-11  Jim Meyering  <jim@meyering.net>
3648
3649         * tests/du/basic: Make the test file exactly 4k bytes long.
3650
3651         * src/split.c (longopts): Don't hard-code `2' here.
3652         Instead, just specify `&verbose', and ...
3653         (main): ... remove the `case 2:' block for --verbose.
3654
3655         * tests/du/basic: Make the test file larger than 64 bytes, so that
3656         we don't immediately disqualify file systems (e.g., NetApp) on which
3657         smaller files take up zero disk blocks.  Reported by Vin Shelton.
3658
3659 2003-03-10  Jim Meyering  <jim@meyering.net>
3660
3661         Don't segfault for a negative field width or precision in format string.
3662         Note that this is just a stopgap fix.  The longer term solution may
3663         involve adapting bash's builtins/printf.def.
3664
3665         * src/printf.c: (UNSPECIFIED): Define.
3666         (print_direc): Use the special value, UNSPECIFIED, to indicate
3667         that field_width or precision has not been specified.
3668         (print_formatted): Fail if field_width or precision is the
3669         special value, UNSPECIFIED.
3670         Reported by Oliver Kiddle <okiddle@yahoo.co.uk>
3671
3672         * src/sys2.h (INT_MIN): Define, if necessary.
3673         * tests/misc/printf: Add a test for the above-fixed bug.
3674
3675 2003-03-09  Jim Meyering  <jim@meyering.net>
3676
3677         * src/remove.c (AD_stack_pop): Cast sizeof... to int before
3678         changing its sign.  This avoids a warning from gcc on 64-bit systems.
3679         Reported by Bob Proulx.
3680         (pop_dir): Reverse order of sign change and cast, to be consistent
3681         with the above.
3682
3683 2003-03-08  Jim Meyering  <jim@meyering.net>
3684
3685         * tests/Makefile.am (evar-check): Check for POSIXLY_CORRECT not as a
3686         shell variable, but only in the environment.  With /bin/sh->bash, the
3687         shell variable is set to `y', and that would cause a spurious warning.
3688         Reported by Bob Proulx.
3689
3690         * tests/Makefile.am (check-root): Remove touch/fifo.
3691         It doesn't appear to have to be run as root.
3692
3693         * tests/rm/fail-2eperm: Rather than simply using the first non-root
3694         user name, make sure that the selected user name has a usable shell.
3695         Reported by Paul Jarc.
3696
3697         Before, when using shred on a device, one had to specify --exact,
3698         or be careful to choose a size that would not be rounded up and
3699         exceed the maximum value;  that could result in a failure of
3700         the final write.
3701         * src/shred.c (do_wipefd): --exact is now the default for non-regular
3702         files.  Suggestion from Ben Elliston.
3703         (usage): Say it.
3704
3705         * tests/misc/tty-eof: Require at least version 1.11 of Expect.pm.
3706         Old versions of Expect.pm (e.g., 1.07) lack the log_user function.
3707         Patch by Bob Proulx.
3708
3709         * src/Makefile.am (check-misc): Check for use of `defined' in
3710         #define directives.
3711         Change to $(srcdir) before running grep.
3712
3713         * src/sleep.c: Remove now-unused #include and #define directives.
3714
3715         * src/du.c (process_file): If a file's size is not being counted
3716         e.g., because it's a hard link to a file we've already counted,
3717         then don't print a line for it.
3718
3719         * tests/du/hard-link: New test for the above-fixed bug.
3720         * tests/du/Makefile.am (TESTS): Add hard-link.
3721
3722         `du -S' didn't work
3723         * src/du.c: Revert most of the `reorganization' change of 2003-02-20,
3724         and make the two-array approach work.
3725
3726         * tests/du/basic: Correct/add tests for the above fix.
3727         Set LC_ALL, etc., now that we use sort.
3728         Check the block/size of a small file, too.
3729         Correct expected results for simple dir1/dir2/file case.
3730         Add another test of du -S.
3731
3732 2003-03-07  John David Anglin  <dave.anglin@nrc-cnrc.gc.ca>
3733
3734         Avoid build failure with gcc on hppa1.1-hp-hpux10.20 (see GCC PR
3735         middle-end/9986).  As one of GCC's optimizations, it transforms a
3736         fputs_unlocked call to a fputc_unlocked call when the string is
3737         one character long.  However, hpux doesn't have fputc_unlocked.
3738
3739         * expr.c (usage): Use putchar, not fputs, to output a single character.
3740         * ls.c (dired_dump_obstack): Likewise.
3741         * ptx.c (output_one_tex_line, output_one_dumb_line): Likewise.
3742         * stat.c (print_it): Likewise.
3743
3744 2003-03-07  Jim Meyering  <jim@meyering.net>
3745
3746         * src/cp.c: Remove everything associated with mmap-stack.c.
3747         This reverts the two changes of 2003-02-21.
3748         * src/du.c: Remove everything associated with mmap-stack.c.
3749         This reverts the change of 2003-02-19.
3750
3751 2003-03-06  Jim Meyering  <jim@meyering.net>
3752
3753         * tests/cp/same-file: Unset CDPATH.  Otherwise, having the
3754         CDPATH shell variable set could cause this test to fail.
3755         Reported by Karl Berry.
3756
3757 2003-03-05  Jim Meyering  <jim@meyering.net>
3758
3759         * Version 4.5.9.
3760
3761         * src/printf.c (print_esc): Remove pointless comparison of unsigned
3762         integer with zero, to avoid a warning from Intel's ecc.
3763         Reported by Nelson Beebe.
3764
3765         * src/du.c (process_file): Sizes must all be of type uintmax_t.
3766         Otherwise, for files or totals that are too big, numbers would
3767         be truncated.  Patch mostly by Michael Stone.
3768         Reported by Ingo Saitz as Debian bug #183210.
3769
3770         * tests/du/8gb: New test for the above-fixed bug.
3771         * tests/du/Makefile.am (TESTS): Add 8gb.
3772
3773         * src/du.c (MAX_N_DESCRIPTORS): Use 3 * UTILS_OPEN_MAX / 4
3774         rather than UTILS_OPEN_MAX - 10.
3775
3776 2003-03-04  Jim Meyering  <jim@meyering.net>
3777
3778         * README: Refer new feature discussion to bug-coreutils@gnu.org,
3779         rather than bug-gnu-utils, now that the former is better known.
3780         Suggestion from Göran Uddeborg.
3781
3782         * src/stat.c (usage): Capitalize consistently.
3783         Reported by Göran Uddeborg.
3784
3785         * Makefile.maint (rel-files): Include $(signatures), so that
3786         those files are also copied into $(release_archive_dir).
3787
3788         * src/df.c (find_mount_point): Call error here, now that restore_cwd
3789         no longer does it.
3790         * src/remove.c (AD_pop_and_chdir): Likewise.
3791
3792         * tests/Makefile.am (check-root): Add fail-2eperm.
3793
3794 2003-03-03  Jim Meyering  <jim@meyering.net>
3795
3796         * src/remove.c (remove_cwd_entries): Include the full filename of
3797         the offending file, not just the basename.
3798
3799         * tests/misc/tty-eof: Set $ME properly.
3800
3801         * Makefile.maint (THIS_VERSION_REGEXP, PREV_VERSION_REGEXP):
3802         Remove now-unused variables.
3803         (tag-prev-version, prev-cvs-tag): Likewise.
3804
3805         * src/remove.c (remove_cwd_entries) [!ROOT_CAN_UNLINK_DIRS]: Give an
3806         accurate diagnostic when failing to remove a file owned by some other
3807         user.  Reported by Ivo Timmermans via Michael Stone.
3808         This fixes Debian bug# 178471.
3809
3810         * tests/rm/Makefile.am (TESTS): Add fail-2eperm.
3811         * tests/rm/fail-2eperm: New test, for the above-fixed bug.
3812         Based on a report from Ivo Timmermans.
3813
3814 2003-03-02  Jim Meyering  <jim@meyering.net>
3815
3816         * src/copy.c (copy_internal) [un_backup]: When recovering from a
3817         failure to create a hard link, do not remove the entry associating
3818         the source dev/ino with the destination file name.
3819         * tests/mv/Makefile.am (TESTS): Add hard-3.
3820         * tests/mv/hard-3: New test, for the above-fixed bug.
3821         Inspired by a report from Iida Yosiaki.
3822
3823 2003-03-01  Jim Meyering  <jim@meyering.net>
3824
3825         * src/df.c (print_header): Don't embed spaces in a separate `Type'
3826         header string.  Instead, put `Filesystem' and `Type' headers in the
3827         same string, so translators can use horizontal space as needed.
3828         Reported by Jean Charles Delepine.
3829
3830 2003-02-28  Jim Meyering  <jim@meyering.net>
3831
3832         * src/copy.c (copy_internal): When link fails because of an
3833         existing destination file, unlink that file and try again.
3834         Reported by Iida Yosiaki.
3835
3836         * tests/mv/Makefile.am (TESTS): Add hard-2.
3837         * tests/mv/hard-2: New test for the above-fixed bug.
3838         Based on a test case from Iida Yosiaki.
3839
3840 2003-02-26  Jim Meyering  <jim@meyering.net>
3841
3842         * tests/du/basic: Don't test du's -b option here.  Directory byte
3843         counts are smaller (512 rather than 4096) on at least OSF/1 5.1
3844         and IBM AIX 4.2.  Reported by Nelson Beebe.
3845
3846 2003-02-25  Jim Meyering  <jim@meyering.net>
3847
3848         * Makefile.maint (announcement): Now that ChangeLog entries
3849         are output by announce-gen, don't do it here.
3850         * announce-gen (print_changelog_deltas): New function.
3851         (main): Use it.
3852
3853 2003-02-22  Jim Meyering  <jim@meyering.net>
3854
3855         * announce-gen: New option: --release-type=TYPE
3856         * Makefile.maint (beta, major): New targets.  Remove `release'.
3857         Put them all together on a line.
3858         Pass the release type (via RELEASE_TYPE envvar) to the MAKE
3859         invocation of `announcement'.
3860         (announcement): Invoke announce-gen with --release-type=$RELEASE_TYPE.
3861
3862         * announce-gen: New option: --news=NEWS_FILE.
3863         Extract NEWS entries here, not via rules in Makefile.maint.
3864         * Makefile.maint (announcement): Now that NEWS entries are
3865         extracted by announce-gen, don't do it here.
3866         (news-r1, news-r2): Remove now-unused definitions.
3867
3868 2003-02-21  Jim Meyering  <jim@meyering.net>
3869
3870         * Version 4.5.8.
3871
3872         Merge in changes from autoconf's version of this file.
3873         * Makefile.maint (www-gnu): Define.
3874         (standards.texi-url_prefix): Use $(www-gnu).
3875         (make-stds.texi-url_prefix): Likewise.
3876
3877         * src/cp.c: Include "mmap-stack.h".
3878         (main): Invoke `run' through a macro that (when possible) runs it
3879         with a large, mmap'd stack.
3880
3881         * src/cp.c (run): New function, preparing for the above.
3882         Exit from this function, not from main
3883         (main): Call run.
3884
3885         * src/du.c: New option: --apparent-size.
3886         (enum) [APPARENT_SIZE_OPTION]: New member.
3887         (long_options): Add it.
3888         (usage): Describe it.
3889         (main): Handle it.
3890         ['b']: Set apparent_size.
3891         David Eisner reported that the behavior of --bytes had changed.
3892         Paul Eggert proposed the use of a new option, --apparent-size.
3893
3894         * src/du.c (apparent_size): New global.
3895         (print_only_size): Reflect the fact that we're printing byte counts,
3896         not ST_NBLOCKSIZE-byte-block counts.
3897         (print_size): Call print_only_size rather than duplicating its code.
3898         (process_file): Accumulate byte counts, rather than block counts.
3899
3900         * src/du.c (process_file): Always reset size_to_propagate_to_parent
3901         for --separate-dirs (-S).
3902
3903 2003-02-20  Jim Meyering  <jim@meyering.net>
3904
3905         * Use automake-1.7.3.  Regenerate dependent files.
3906
3907         * src/stat.c (print_stat): New format: %B (to print ST_NBLOCKSIZE).
3908         This makes %b (number of ST_NBLOCKSIZE-byte blocks) more useful.
3909         (usage) [%B]: Describe it.
3910         [%b]: Refer to %B.
3911
3912         * src/du.c (process_file): Reorganize the code to use only
3913         one `sum' array, and change how -S works back to the way it was
3914         before 2003-01-31.  Patch by Bruno Haible.
3915
3916         * tests/du/basic: New test.
3917         * tests/du/Makefile.am (TESTS): Add basic.
3918
3919         * tests/envvar-check: Add checks for the following:
3920         BLOCK_SIZE, DU_BLOCK_SIZE, DF_BLOCK_SIZE, LS_BLOCK_SIZE.
3921
3922         * tests/Makefile.am: Rename phony target envvar-check to evar-check
3923         so as not to conflict with the distributed file by the same name.
3924
3925         * src/du.c (process_file): Set info->skip before any possible return.
3926
3927         Report correct usage for directories, not 0.
3928         * src/du.c (process_file): Return for `file_type == FTW_DPRE'
3929         _before_ recording the dev/ino of a directory.
3930         Reported by Bruno Haible.
3931
3932         Now, df always displays the device file name corresponding to the
3933         listed mount point under `Filesystem'.  Before, for an unmounted
3934         block- or character-special file argument, it would display the
3935         command-line argument instead.
3936         * src/df.c (show_disk): Return a value indicating whether
3937         there was a match.  Don't try to find a mount point here.
3938         (show_entry): If show_disk doesn't find a match, call show_point.
3939
3940 2003-02-19  Jim Meyering  <jim@meyering.net>
3941
3942         * src/du.c: Include "mmap-stack.h".
3943         (du_files): Add prototype with ATTRIBUTE_NORETURN.
3944         Exit from this function, not from...
3945         (main): ...here.
3946         Instead, if possible, invoke du_files through a macro that
3947         runs it with a large, mmap'd stack.
3948
3949         * src/join.c (usage): Change wording in --help output:
3950         use FILENUM instead of `SIDE' and say what FILENUM means.
3951         Reported by Bernhard Gabler.
3952
3953         * src/df.c (print_header): Rather than using a hard-coded literal
3954         string of spaces matching the length of the English `...Type' header,
3955         output the right number of spaces to match the selected translation.
3956         Reported by Yann Dirson and Jean Charles Delepine as Debian bug 131113.
3957
3958         * src/split.c (bytes_split): Remove unnecessary `else' after break.
3959         (lines_split): Likewise.  and correct misleading indentation.
3960
3961         * src/split.c: Include "full-read.h".
3962         (bytes_split, lines_split, line_bytes_split): Use full_read,
3963         not safe_read.   The way split was using the latter, a short read
3964         could cause split to terminate before EOF.
3965
3966         * tests/misc/tty-eof: Test all programs that can read stdin,
3967         requiring no arguments and that write to standard output.
3968
3969         * tests/misc/tty-eof: New file.  Renamed from ...
3970         * tests/misc/cat-tty-eof: Remove file.  Rename to tty-eof.
3971         * tests/misc/Makefile.am (TESTS): Reflect renaming.
3972
3973 2003-02-18  Jim Meyering  <jim@meyering.net>
3974
3975         cksum would perform an extra read after encountering EOF
3976         * src/cksum.c (cksum): Exit the loop upon EOF, too.
3977         Patch by Michael Bacarella.
3978
3979         Test for the bug fixed today in cksum, md5sum, and sha1sum.
3980         * tests/misc/cat-tty-eof: Generalize, clean-up, and test for
3981         cat, cksum, md5sum, and sha1sum all in the same loop.
3982
3983 2003-02-14  Jim Meyering  <jim@meyering.net>
3984
3985         * src/remove.c: Include "euidaccess.h".
3986         Remove declaration of euidaccess.
3987
3988 2003-02-12  Jim Meyering  <jim@meyering.net>
3989
3990         * src/pathchk.c (portable_chars_only): Remove unnecessary `const'
3991         in cast to avoid warning from icc.  Reported by Alexandre Duret-Lutz.
3992
3993 2003-02-10  Jim Meyering  <jim@meyering.net>
3994
3995         * src/test.c: Don't include group-member.h.
3996         Include euidaccess.h.
3997         (eaccess): Rewrite function to set the real uid and gid temporarily
3998         to the effective uid and gid, then invoke 'access', and then set the
3999         real uid and gid back.  On systems that lack setreuid or setregid,
4000         fall back on the kludges in euidaccess.  Before, it would not work
4001         for e.g., files with ACLs, files that were marked immutable,
4002         or on file systems mounted read-only.  Nelson Beebe raised the issue.
4003         Paul Eggert suggested the new implementation.
4004
4005 2003-02-09  Jim Meyering  <jim@meyering.net>
4006
4007         * src/test.c (test_stat): Remove function.  It's job is done (only
4008         when necessary) by the wrapper in lib/stat.c.  Adjust all uses.
4009
4010 2003-02-08  Jim Meyering  <jim@meyering.net>
4011
4012         * Version 4.5.7.
4013
4014         * tests/mv/part-symlink: Don't assume that the file owner username
4015         length is less than 9 in ls output: instead, omit that field
4016         altogether.  Reported by, and suggested fix from, Ferdinand.
4017
4018         * tests/du/restore-wd: New test for just-fixed bug in ftw.c.
4019         * tests/du/Makefile.am (TESTS): Add restore-wd.
4020
4021         * src/rm.c: Correct now-invalid comment about cycle-detection.
4022
4023 2003-02-06  Jim Meyering  <jim@meyering.net>
4024
4025         * NEWS: Add entries from old/*/NEWS
4026         from fileutils-4.1 through 4.1.11 and
4027         from sh-utils-2.0 through 2.0.15.  Suggestion from Karl Berry.
4028
4029         * Version 4.5.6.
4030
4031         * src/du.c (process_file): Don't return early for excluded files
4032         or for files whose dev/inode we've already seen.
4033
4034 2003-02-05  Jim Meyering  <jim@meyering.net>
4035
4036         * tests/du/exclude: New file.
4037         * tests/du/Makefile.am (TESTS): Add exclude.
4038
4039 2003-02-04  Dmitry V. Levin  <ldv@altlinux.org>
4040
4041         * src/who.c (print_boottime, print_deadprocs, print_runlevel):
4042         Fix memory allocation arithmetic.
4043
4044 2003-02-04  Jim Meyering  <jim@meyering.net>
4045
4046         `df /dev/block-or-char-device-file--not-mounted' now reports
4047         the name of the file system on which the file resides, usually `/'.
4048         Before, it would leave the `Mounted on' field blank.
4049         * src/df.c (show_disk): Move function to precede find_mount_point.
4050         (show_disk): Add parameter: STATP.
4051         If we don't find a matching device name, then resort to calling
4052         find_mount_point.  Reported by Bob Proulx.
4053
4054 2003-02-03  Andreas Schwab  <schwab@suse.de>
4055
4056         * tests/rm/cycle: Require non-root.
4057         * tests/rm/isatty: Likewise.
4058
4059 2003-02-02  Jim Meyering  <jim@meyering.net>
4060
4061         * Version 4.5.5.
4062
4063         * man/Makefile.am (check-x-vs-1): Use @PATH_SEPARATOR@, not `:'.
4064
4065         Ensure that there are no offending uses of `:'.
4066         * Makefile.maint (makefile_path_separator_check): New rule.
4067         (local-check): Add it to the list.
4068
4069 2003-02-01  Jim Meyering  <jim@meyering.net>
4070
4071         * src/du.c (MAX_N_DESCRIPTORS): Define.
4072
4073         * src/stat.c (G_fail): New global.
4074         (human_time): Diagnose failed localtime, not failed nstrftime.
4075         (main): Fail if G_fail is set.
4076
4077 2003-01-31  Richard Dawe  <rich@phekda.freeserve.co.uk>
4078
4079         * tests/basename/Makefile.am: Use @PATH_SEPARATOR@ instead of
4080         hard-coding the path-separator.  Also double-quote the new PATH,
4081         to avoid problems when the path-separator is a semi-colon or when
4082         `pwd` contains e.g. a space.
4083         * tests/chgrp/Makefile.am: Likewise.
4084         * tests/chmod/Makefile.am: Likewise.
4085         * tests/chown/Makefile.am: Likewise.
4086         * tests/cp/Makefile.am: Likewise.
4087         * tests/dd/Makefile.am: Likewise.
4088         * tests/dircolors/Makefile.am: Likewise.
4089         * tests/du/Makefile.am: Likewise.
4090         * tests/expr/Makefile.am: Likewise.
4091         * tests/factor/Makefile.am: Likewise.
4092         * tests/fmt/Makefile.am: Likewise.
4093         * tests/install/Makefile.am: Likewise.
4094         * tests/ln/Makefile.am: Likewise.
4095         * tests/ls/Makefile.am: Likewise.
4096         * tests/ls-2/Makefile.am: Likewise.
4097         * tests/md5sum/Makefile.am: Likewise.
4098         * tests/misc/Makefile.am: Likewise.
4099         * tests/mkdir/Makefile.am: Likewise.
4100         * tests/mv/Makefile.am: Likewise.
4101         * tests/od/Makefile.am: Likewise.
4102         * tests/rm/Makefile.am: Likewise.
4103         * tests/rmdir/Makefile.am: Likewise.
4104         * tests/seq/Makefile.am: Likewise.
4105         * tests/sha1sum/Makefile.am: Likewise.
4106         * tests/shred/Makefile.am: Likewise.
4107         * tests/stty/Makefile.am: Likewise.
4108         * tests/sum/Makefile.am: Likewise.
4109         * tests/tail-2/Makefile.am: Likewise.
4110         * tests/touch/Makefile.am: Likewise.
4111         * tests/tsort/Makefile.am: Likewise.
4112         * tests/unexpand/Makefile.am: Likewise.
4113
4114 2003-01-31  Jim Meyering  <jim@meyering.net>
4115
4116         * src/stat.c: Include "file-type.h"
4117         (print_human_type): Remove function.
4118         (human_access): Rename from print_human_access.  Return a string.
4119         (human_time): Rename from print_human_time.  Return a string.
4120         (print_stat): Arrange so that field width and an alignment specifier
4121         are honored for the %A, %F, %x, %y, and %z formats.
4122         [%F]: Use file_type; this gives slightly different file type strings,
4123         e.g., `directory' instead of `Directory' and `regular file' or
4124         `regular empty file' instead of `Regular file'.
4125         Prompted by a report from Richard Dawe that the uses of
4126         S_IFSOCK and S_IFIFO in print_human_time were not portable
4127         to systems using e.g., DJGPP.
4128
4129 2003-01-31  Richard Dawe  <rich@phekda.freeserve.co.uk>
4130
4131         * src/stat.c (print_stat): Use S_ISLNK rather than an explicit
4132         test using S_IFMT and S_IFLNK.  S_IFLNK may not be defined.
4133
4134 2003-01-31  Jim Meyering  <jim@meyering.net>
4135
4136         * src/du.c (main): Upon processing an invalid option or an invalid
4137         --exclude-from or --max-depth option argument, don't exit right away,
4138         in case there are others.  Rather record the failure and exit after
4139         processing other options.
4140
4141         * GNUmakefile (TAR_OPTIONS): Set and export, in order to make
4142         tar archive easier to reproduce.
4143
4144         Rewrite to perform directory traversal using nftw.
4145
4146         * src/du.c: Include "dirname.h", "ftw.h", and "quotearg.h".
4147         (AUTHORS): Add self.
4148         (opt_one_file_system): Move global into `main'.
4149         (path, xstat, exit_status): Remove declarations.
4150         (arg_length, suffix_length): New globals.
4151         (G_fail): New global, sort of like the old `exit_status'.
4152         (IS_FTW_DIR_TYPE): Define.
4153         (print_only_size): New function.
4154         (process_file): New function.
4155         (str_init, ensure_space, str_copyc, str_concatc): Remove functions.
4156         (str_trunc, pop_dir, count_entry): Likewise.
4157         (du_files): Rewrite to use nftw.
4158
4159 2003-01-30  Jim Meyering  <jim@meyering.net>
4160
4161         * tests/du/trailing-slash: Ensure that du/ftw follows a command-line
4162         symlink-to-directory with -L, even without the trailing slash.
4163
4164 2003-01-27  Jim Meyering  <jim@meyering.net>
4165
4166         * src/Makefile.am (check-misc): Check for st_blocks, too.
4167
4168         * src/stat.c (print_stat): Use ST_NBLOCKS rather than `->st_blocks'.
4169         Reported by Richard Dawe.
4170
4171 2003-01-27  Andreas Schwab  <schwab@suse.de>
4172
4173         * src/ls.c (quote_name): Add fourth parameter, width, into which to
4174         store the screen columns, and return the number of bytes instead.
4175         (print_dir): Pass NULL as fourth parameter of quote_name.
4176         (print_name_with_quoting): Likewise.
4177         (length_of_file_name_and_frills): Get the width from the fourth
4178         parameter of quote_name instead of return value.
4179
4180 2003-01-27  Jim Meyering  <jim@meyering.net>
4181
4182         * src/ls.c (decode_switches): If `dired' is set without
4183         `format == long_format', then silently reset dired.  This doesn't
4184         change the behavior of ls (all prior uses of dired were protected
4185         by `&& format == long_format'), and lets us...
4186         (DIRED_INDENT): ... remove the `format == long_format' conjunct.
4187         (PUSH_CURRENT_DIRED_POS): Likewise.
4188         (main): Likewise.
4189
4190 2003-01-22  Jim Meyering  <jim@meyering.net>
4191
4192         * tests/du/no-x: New test, for functionality added to lib/ftw.c.
4193         * tests/du/Makefile.am (TESTS): Add no-x.
4194
4195 2003-01-21  Jim Meyering  <jim@meyering.net>
4196
4197         * src/remove.c (remove_entry) [ROOT_CAN_UNLINK_DIRS
4198         && HAVE_STRUCT_DIRENT_D_TYPE]: If a file has d_type == DT_UNKNOWN
4199         it may still be a directory -- or not (e.g., with FreeBSD on an
4200         NFS-mounted file system), so resort to calling lstat to find out.
4201         Based on a patch by Michael van Elst.
4202
4203         * tests/cp/same-file: Don't assume that the file owner username
4204         length is less than 9 in ls output: instead, omit that field
4205         altogether.  Reported by, and suggested fix from, Ferdinand.
4206
4207 2003-01-20  Jim Meyering  <jim@meyering.net>
4208
4209         * tests/date/Test.pm (wide-fmt): New test to demonstrate that
4210         large format widths no longer cause strftime to infloop.
4211
4212         * Makefile.maint (mail_gpg_sign_cookie): Remove now-unused definition.
4213
4214 2003-01-19  Jim Meyering  <jim@meyering.net>
4215
4216         * src/readlink.c: Include "canonicalize.h".
4217
4218 2003-01-18  Jim Meyering  <jim@meyering.net>
4219
4220         * src/ls.c (Dereference_symlink) [DEREF_COMMAND_LINE_SYMLINK_TO_DIR]:
4221         New member.
4222         (enum) [DEREFERENCE_COMMAND_LINE_SYMLINK_TO_DIR_OPTION]: New member.
4223         (long_options): Add option --dereference-command-line-symlink-to-dir.
4224         (main): Make DEREF_COMMAND_LINE_SYMLINK_TO_DIR be the default,
4225         rather than DEREF_COMMAND_LINE_ARGUMENTS, when none of the
4226         -d, -F, -l options is specified.
4227         (decode_switches): Handle --dereference-command-line-symlink-to-dir.
4228         (gobble_file): Honor DEREF_COMMAND_LINE_SYMLINK_TO_DIR.
4229         Change --dereference-command-line (-H) to dereference *all*
4230         command line arguments, including broken symlinks.
4231
4232 2003-01-15  Paul Eggert  <eggert@twinsun.com>
4233
4234         Change ls -H back to the way it was yesterday, since this is
4235         compatible with FreeBSD and the POSIX spec is confusing
4236         and somewhat contradictory.
4237
4238         * src/ls.c (DEREF_COMMAND_LINE_ARGUMENTS): Change name back
4239         from DEREF_COMMAND_LINE_SYMLINK_TO_DIR, updating all uses.
4240         (long_options): Change the long option name back.
4241         (usage): Change the usage back.
4242         (gobble_file): When -H is specified, dereference a top-level
4243         arg even if it points to a non-directory.
4244
4245 2003-01-15  Jim Meyering  <jim@meyering.net>
4246
4247         * src/ls.c (gobble_file): Fall back on using lstat when required:
4248         when --dereference (-L) is not specified, and
4249         - when operating on a dangling symlink
4250         - when operating on command-line-symlink-to-directories
4251         This fixes numerous problems.  Here are examples:
4252         - `ls dangling-symlink' would fail with `no such file...'
4253         Now it prints `dangling-symlink'.
4254         - `ls -i symlink' would mistakenly print the inode of the referent.
4255         Now it prints the inode of the symlink.  Likewise for --size (-s).
4256         Based on a patch from Michael Stone.
4257         Reported by Deepak Goel as Debian bug #173793.
4258
4259         Rename ls's --dereference-command-line (-H)
4260         option to   --dereference-command-line-symlink-to-dir.
4261         * src/ls.c [enum Dereference_symlink]
4262         (DEREF_COMMAND_LINE_SYMLINK_TO_DIR): Rename from
4263         DEREF_COMMAND_LINE_ARGUMENTS.  Update all uses.
4264         (long_options): Rename the long option.
4265         (usage): Say that --dereference-... changes how ls treats
4266         only symlinks to directories specified on the command line.
4267
4268 2003-01-14  Jim Meyering  <jim@meyering.net>
4269
4270         * tests/ls/dangle: New file/test, for the above fix.
4271         * tests/ls/inode: Another new file/test, for the above fix.
4272         * tests/ls/Makefile.am (TESTS): Add dangle and inode.
4273
4274         * src/ls.c (gobble_file): Fix a bug introduced in 4.5.4 that made it
4275         so that ls --color would no longer highlight the names of files with
4276         the execute bit set when not specified on the command line.
4277         Patch by Michael Stone.  Reported by Stephen Depooter as
4278         Debian bug 175135.
4279
4280         * tests/ls-2/tests (color-exe): New test, for the above fix.
4281
4282 2003-01-13  Jim Meyering  <jim@meyering.net>
4283
4284         * tests/shred/exact: Also test for just fixed bug with --zero.
4285
4286         * src/shred.c (long_opts): --zero does not require an argument.
4287         Patch by Michael Stone.  Reported by Roland Turner as Debian bug 172019.
4288
4289 2003-01-12  Jim Meyering  <jim@meyering.net>
4290
4291         * Makefile.maint (cvs-update): Skip any file with local modifications.
4292
4293         * src/unexpand.c (usage): Document --first-only and mention that
4294         --tabs=N (-t) enables --all (-a).  Reported by wiregauze@yahoo.com.
4295
4296 2002-12-01  Dmitry V. Levin  <ldv@altlinux.org>
4297
4298         * src/df.c: Include "canonicalize.h".
4299         Use canonicalize_file_name unconditionally.
4300
4301 2003-01-09  Jim Meyering  <jim@meyering.net>
4302
4303         * README: Add readlink.
4304
4305 2002-11-30  Dmitry V. Levin  <ldv@altlinux.org>
4306
4307         * src/df.c: Include "xgetcwd.h".
4308         * src/pwd.c: Likewise.
4309
4310 2002-11-30  Dmitry V. Levin  <ldv@altlinux.org>
4311
4312         * src/shred.c: Remove declaration of xstrdup.
4313         We already get it via xalloc.h which is included via system.h.
4314
4315 2002-08-27  Dmitry V. Levin  <ldv@altlinux.org>
4316
4317         New program: readlink.
4318
4319         * src/Makefile.am (bin_PROGRAMS): Add readlink.
4320         * src/readlink.c: New file.
4321
4322         * man/readlink.x: New file.
4323         * man/Makefile.am (dist_man_MANS): Add readlink.1.
4324         (readlink.1): New rule.
4325
4326 2003-01-09  Jim Meyering  <jim@meyering.net>
4327
4328         When selecting ranges of byte offsets (as opposed to ranges of fields)
4329         and when --output-delimiter=STRING is specified, output STRING between
4330         ranges of selected bytes.
4331         * src/cut.c (RANGE_START_SENTINEL): Define.
4332         (output_delimiter_specified): New global.
4333         (print_kth): Add parameter.  Adjust all callers.
4334         (set_fields): Mark each range-start index with RANGE_START_SENTINEL.
4335         (cut_bytes): When requested, output STRING between ranges of
4336         selected bytes.
4337         (main): Make a diagnostic a little clearer.
4338         Based on a patch from Jan Nieuwenhuizen.
4339
4340         * tests/cut/Test.pm: New tests for the above.
4341
4342         * src/cut.c (set_fields): Make code agree with comment:
4343         Don't merge abutting ranges like 4- and 2-3.  This makes no
4344         difference currently, but is required to support an upcoming change.
4345
4346 2003-01-07  Jim Meyering  <jim@meyering.net>
4347
4348         * src/cut.c (set_fields): Fix typo in comment.
4349
4350         * tests/touch/not-owner: New test, mostly extracted from fail-diag.
4351         * tests/touch/Makefile.am (TESTS): Add not-owner.
4352         * tests/touch/fail-diag: Remove the test for non-owner diagnostic.
4353         Now, this tests only the nonexistent-directory diagnostic.
4354         Suggestion from Michael Stone.
4355
4356         * tests/touch/fail-diag: Fix typo: s/ld/ls/.
4357
4358 2003-01-04  Jim Meyering  <jim@meyering.net>
4359
4360         * src/copy.h: Remove use of PARAMS.
4361         * src/remove.h: Likewise.
4362         * src/chown-core.h: Likewise.
4363
4364         rm could be tricked into mistakenly reporting a cycle.
4365         * src/remove.c: [cycle_check_state]: New global.
4366         (remove_cwd_entries): Adapt to new semantics of cycle_check.
4367         (rm): Call cycle_check_init and cycle_check_free for each file.
4368         * tests/rm/cycle (rm): New test, for the above fix.
4369         * tests/rm/Makefile.am (TESTS): Add cycle.
4370
4371         When rm detects a cycle, don't abort the entire command,
4372         but rather just the affected command line argument.
4373         * src/remove.c: Include <setjmp.h>
4374         (struct dirstack_state) [current_arg_jumpbuf]: New member.
4375         (remove_cwd_entries): Call longjmp if we detect a cycle.
4376         (rm): Call setjmp here.
4377
4378         * src/remove.c (cycle_check, is_power_of_two): Remove functions.
4379         Instead, include cycle-check.h and use it.
4380
4381         * src/remove.h (struct dev_ino): Remove declaration.
4382
4383         * src/remove.c (remove_cwd_entries): Fix typos in comment.
4384
4385         Don't include trailing /. in diagnostics about directories.
4386         * src/remove.c (full_filename_): When FILENAME is just `.'
4387         and there is a nonempty directory-name part, don't append `/.'.
4388         * tests/rm/unread2: Remove trailing /. from diagnostic.
4389         * tests/rm/rm2: Likewise.
4390
4391         * src/remove.c (struct dirstack_state): Define.
4392         To be used in place of these file-scoped globals ...
4393         (dir_stack, len_stack, Active_dir): Remove globals.
4394         (ds_init, ds_free): New functions.
4395         (full_filename): Define.
4396         (full_filename_): Rename from full_filename.
4397
4398         Begin to make AD_* functions more generic.
4399         * src/remove.c (AD_push_initial): Don't set status to RM_OK here.
4400         (AD_push): Likewise.
4401         (AD_INIT_OTHER_MEMBERS): Define.
4402         (remove_dir): Define the `status' member manually after each
4403         call to AD_push or AD_push_initial.
4404
4405         * src/Makefile.am (check-misc): New rule, to ensure that no more
4406         S_IS* macro definitions sneak into the code.
4407         (check): Depend on check-misc.
4408
4409         * src/remove.c [S_ISLNK]: Don't define.  It's already defined in sys2.h.
4410         * src/du.c (count_entry) [S_ISLNK]: Don't define.
4411         * src/shred.c [S_ISLNK, S_ISFIFO, S_ISSOCK]: Don't define.
4412
4413 2003-01-03  Jim Meyering  <jim@meyering.net>
4414
4415         * src/true.c: Add copyright.
4416         (AUTHORS): I suppose I've written it.
4417
4418         * src/Makefile.am (false.c): Make the generated file be read-only.
4419
4420 2003-01-04  Jim Meyering  <jim@meyering.net>
4421
4422         * src/ls.c: Include "dev-ino.h".
4423         [struct dev_ino]: Remove declaration.
4424
4425 2003-01-02  Jim Meyering  <jim@meyering.net>
4426
4427         * src/cp.c (do_copy): Tweak diagnostic to be consistent with the one
4428         from mv: s/missing file arguments/missing file argument/.
4429         With --target-directory=DIR, cp and mv work with a single file argument.
4430         Reported by Karl Berry.
4431
4432         * tests/rm/isatty: Enable this test.
4433
4434 2002-12-31  Jim Meyering  <jim@meyering.net>
4435
4436         * src/remove.c (AD_push_initial): Don't set status to RM_OK here.
4437         (AD_push): Likewise.
4438         (AD_INIT_OTHER_MEMBERS): Define.
4439         (remove_dir): Define the `status' member manually after each
4440         call to AD_push or AD_push_initial.
4441
4442         * src/ls.c [struct dev_ino]: Remove definition.
4443         Include "dev-ino.h" instead.
4444
4445 2002-12-28  Jim Meyering  <jim@meyering.net>
4446
4447         * tests/du/Makefile.am (TESTS): Add no-deref.
4448         * tests/du/no-deref: New script.
4449
4450 2002-12-23  Jim Meyering  <jim@meyering.net>
4451
4452         * src/remove.c (remove_cwd_entries): Fix typo in comment.
4453
4454 2002-12-21  Jim Meyering  <jim@meyering.net>
4455
4456         * announce-gen: Generate MML-formatted announcement.
4457         This makes it a *lot* harder to send stale MD5/SHA1 signatures.
4458
4459 2002-12-20  Jim Meyering  <jim@meyering.net>
4460
4461         * src/touch.c (touch): Change the wording of a diagnostic so
4462         that it makes sense both when the file exists and when it doesn't.
4463         Suggestion from Michael Stone.
4464
4465 2002-12-18  Jim Meyering  <jim@meyering.net>
4466
4467         * src/stty.c (valid_options): Declare to be static.
4468
4469 2002-12-15  Jim Meyering  <jim@meyering.net>
4470
4471         * Makefile.cfg: Remove rules related to generating m4/jm-glibc-io.m4.
4472
4473         * src/chmod.c, src/copy.c, src/copy.h, src/cp-hash.h, src/csplit.c:
4474         * src/date.c, src/expr.c, src/fmt.c, src/id.c, src/install.c:
4475         * src/ls.c, src/od.c, src/pathchk.c, src/pr.c, src/remove.c:
4476         * src/shred.c, src/sort.c, src/stat.c, src/stty.c, src/sum.c:
4477         * src/tee.c, src/test.c: Remove all uses of `PARAMS'.
4478
4479         * src/remove.c (PARAMS): Remove definition.
4480         * src/sys2.h: Likewise.
4481
4482         * src/ls.c, src/stat.c, src/date.c: Remove declaration of nstrftime.
4483         Include strftime.h instead.
4484
4485 2002-12-14  Jim Meyering  <jim@meyering.net>
4486
4487         * Makefile.cfg ($(url_dir_list)): Use .../coreutils, not .../fetish.
4488
4489         * src/system.h [! HAVE_DECL_MEMRCHR]: Declare memrchr.
4490         This is necessary at least for Irix6.5 when using c89.
4491         Reported by Nelson Beebe.
4492
4493         * tests/misc/Makefile.am (TESTS): Add cat-tty-eof.
4494
4495         * tests/misc/cat-tty-eof: New test.
4496
4497         * src/mknod.c (usage): Specify how major and minor mode numbers
4498         are interpreted.  Report forwarded by Kristin E Thomas.
4499         * src/mknod.c: Remove now-redundant usage-specifying comment.
4500
4501 2002-12-13  Jim Meyering  <jim@meyering.net>
4502
4503         * Version 4.5.4.
4504
4505         * tests/du/trailing-slash: Allow for a directory of size `0'.
4506         That happens at least on file systems of type tmpfs on linux-2.4.18.
4507
4508         * announce-gen: New script to begin replacing the commands
4509         associated with the rule here...
4510         * Makefile.maint (announcement): Invoke announce-gen.
4511         * Makefile.am (EXTRA_DIST): Add announce-gen.
4512
4513         * tests/cp/preserve-2: New file/test, for latest fix.
4514         * tests/cp/Makefile.am (TESTS): Add preserve-2.
4515
4516 2002-12-11  TAKAI Kousuke  <takai@vlsi.kuee.kyoto-u.ac.jp>
4517
4518         Fix a bug whereby cp would fail to parse an option like
4519         --preserve=mode,ownership.
4520         * src/cp.c (decode_preserve_arg): Advance `comma' to
4521         point the character following the comma.
4522
4523 2002-12-11  Jim Meyering  <jim@meyering.net>
4524
4525         * src/pathchk.c (NEED_PATHCONF_WRAPPER): Undefine before defining,
4526         in case it's already defined.
4527
4528 2002-12-09  Jim Meyering  <jim@meyering.net>
4529
4530         * tests/touch/fail-diag: Don't get a test failure if /no exists.
4531         Instead, evoke a framework failure if /no-$$ exists.
4532         Reported by Michael Stone.
4533
4534 2002-12-08  Jim Meyering  <jim@meyering.net>
4535
4536         * src/du.c (lstat) [! LSTAT_FOLLOWS_SLASHED_SYMLINK]:
4537         Define to rpl_lstat, so that even on systems like Solaris 5.8,
4538         du honors (per POSIX) the trailing slash on an argument referring
4539         to a symlink-to-directory.
4540
4541 2002-12-06  Jim Meyering  <jim@meyering.net>
4542
4543         * Use autoconf-2.57.  Regenerate dependent files.
4544         * Use automake-1.7.2.  Regenerate dependent files.
4545
4546         * src/ls.c (gobble_file): Also stat the file if it's a
4547         regular file and --indicator-style=classify (aka -F).
4548         Thanks to Ed Santiago for opening my eyes.
4549
4550         * tests/ls/file-type: New file.  Test for the above.
4551         A test to contrast ls -F and ls --indicator-style=file-type.
4552         * tests/ls/Makefile.am (TESTS): Add file-type.
4553
4554 2002-12-04  Jim Meyering  <jim@meyering.net>
4555
4556         * tests/ls/follow-slink: Make sure the symlink was created.
4557         Richard Dawe reported that `ln -s link link' succeeds, but creates
4558         no file on systems running some version of the DJGPP libc.
4559
4560 2002-12-03  Jim Meyering  <jim@meyering.net>
4561
4562         * src/Makefile.am (AUTOMAKE_OPTIONS): Remove definition (to ansi2knr)
4563         since this package no longer panders to K&R compilers.
4564
4565 2002-12-02  Jim Meyering  <jim@meyering.net>
4566
4567         * tests/du/slink: Skip this test if `.' is on a non-local file system.
4568
4569         * tests/Fetish.pm (_at_replace): Do the substitution only if there's
4570         something to replace.
4571
4572 2002-12-01  Jim Meyering  <jim@meyering.net>
4573
4574         * src/stat.c: Don't include <string.h> or <ctype.h>.
4575         That's already done via system.h.
4576         * src/dircolors.c: Don't include <ctype.h>.
4577
4578 2002-11-30  Jim Meyering  <jim@meyering.net>
4579
4580         * ls.c (gobble_file): Remove the block of code that caused
4581         `ls --color -F symlink-to-dir' to list the files in
4582         `symlink-to-dir/.'.  Now, it prints `symlink-to-dir@', (just
4583         like `ls -F symlink-to-dir') but with the addition of highlighting.
4584         Similarly, `ls --color -dF symlink-to-dir' would print
4585         `symlink-to-dir/';  now it prints `symlink-to-dir@'.
4586         Reported by Jeff Sheinberg as Debian bug #168203.
4587         * tests/ls-2/tests (sl-F-color, sl-dF-color): New tests for the above.
4588
4589         ls is now more efficient: with certain options, it no longer needs
4590         to stat each directory entry on systems with valid dirent.d_type.
4591         * src/ls.c (print_dir): Add DT_LNK and DT_REG.
4592         (main): Make --recursive set format_needs_type, not format_needs_stat.
4593         (gobble_file): Remove a FIXME comment, now that it's fixed.
4594
4595 2002-11-24  Jim Meyering  <jim@meyering.net>
4596
4597         * src/du.c (du_files): Don't strip any trailing slash.
4598         Rewrite so that `/' is no longer represented internally as
4599         the empty string.
4600         (count_entry): When appending a file name component,
4601         account for the fact that the current path may end in `/'.
4602         François Pinard reported that `du symlink-to-dir/' was not
4603         equivalent to `du symlink-to-dir/.'.  Now it is.
4604         * tests/du/trailing-slash: New file/test, for the above fix.
4605         * tests/du/Makefile.am (TESTS): Add trailing-slash.
4606
4607 2002-11-23  Jim Meyering  <jim@meyering.net>
4608
4609         * src/tac.c (output): Declare some local variables to be of type size_t,
4610         rather than `int' to avoid warnings from gcc.
4611
4612 2002-11-21  Paul Eggert  <eggert@twinsun.com>
4613
4614         * src/ls.c (decode_switches): Use case-sensitive matching to
4615         decode the QUOTING_STYLE environment variable.  This is more
4616         consistent with the documentation, and with --quoting-style.
4617
4618 2002-11-21  Martin Buck  <martin.buck@ascom.ch
4619
4620         * src/stty.c (struct speeds): Add support for all baud rates defined
4621         in linux-2.4.19.
4622
4623 2002-11-19  Jim Meyering  <jim@meyering.net>
4624
4625         * tests/sum/sysv: Export LC_ALL=C, to avoid failure when
4626         run in a UTF locale.  Report and suggested fix by Bruno Haible.
4627         * tests/fmt/basic: Likewise.
4628
4629 2002-11-17  Jim Meyering  <jim@meyering.net>
4630
4631         * configure.ac: Update via autoupdate.
4632         Add `AM_GNU_GETTEXT_VERSION(0.11.5)'.
4633
4634         * src/mv.c (movefile): Don't remove trailing slashes from SOURCE.
4635         Reported by Hans Ginzel.
4636
4637 2002-11-15  Jim Meyering  <jim@meyering.net>
4638
4639         * Makefile.cfg (gnu_rel_host): Define.
4640         (url_dir_list): Choose from (alpha|ftp).gnu.org depending
4641         on whether $(VERSION) looks like a major release number.
4642
4643         * Makefile.maint (mail_gpg_sign_cookie): Backslash-escape `#'.
4644         (release): Rename from `alpha'.
4645         (alpha): Depend on release.
4646
4647         * Makefile.maint (signatures): Define with ?=, so it's easy to override.
4648
4649 2002-11-14  Jim Meyering  <jim@meyering.net>
4650
4651         * Makefile.maint (mail_gpg_sign_cookie): Make optional.
4652         (announcement): Use the new variable.
4653
4654         * Makefile.maint: Sync with Bison, i.e.:
4655         (po-check): Scan .l and .y files instead of the
4656         .c and the .h files that they generate.  This fixes the bug
4657         reported by Tim Van Holder in:
4658         <http://mail.gnu.org/pipermail/bison-patches/2002-November/001352.html>
4659         Look for N_ as well as for _.  Try to avoid matching #define for
4660         N_ and _.
4661         From Paul Eggert.
4662
4663 2002-11-12  Jim Meyering  <jim@meyering.net>
4664
4665         * src/ls.c (HAVE_SYMLINKS): Remove unnecessary macro definition.
4666         Replace sole use with equivalent `#ifdef S_ISLNK'.
4667         Inconsistency reported by Dmitry V. Levin.
4668
4669 2002-11-11  Jim Meyering  <jim@meyering.net>
4670
4671         * src/stat.c (usage): Transform --help items output via s/ - /   /,
4672         so that help2man produces properly formatted man pages.
4673         Reported by Herbert Xu as Debian bug #168400.
4674
4675 2002-11-10  Jim Meyering  <jim@meyering.net>
4676
4677         * src/ls.c (sighandler): Handle SIGTSTP specially.
4678         Based on suggestions from Solar Designer and Dmitry V. Levin.
4679         Add comments.
4680
4681         * Makefile.cfg (cvs_files): Define.  From autoconf.
4682         (local_updates): Likewise.
4683
4684         * src/ls.c (restore_default_color_handler, sigtstp_handler):
4685         Remove functions.
4686         (sighandler): New function, based on the one in sort.c.
4687         (main): Use sigaction, if possible; otherwise signal.
4688         Handle these signals:
4689         SIGHUP, SIGINT, SIGPIPE, SIGQUIT, SIGTERM, SIGTSTP.
4690         Don't register our handler if the signal is already being ignored.
4691
4692         * src/dd.c (interrupt_handler): Use raise, rather than kill+getpid.
4693         * src/csplit.c (interrupt_handler): Likewise.
4694         * src/sort.c (sighandler): Likewise.
4695         (main): Declare `i' and `nsigs' to be unsigned, not int.
4696
4697 2002-11-09  Jim Meyering  <jim@meyering.net>
4698
4699         ls --color: restore terminal text color upon signal.
4700         * src/ls.c: Include "full-write.h" and <signal.h>.
4701         (restore_default_color, restore_default_color_handler): New functions.
4702         (sigtstp_handler, put_indicator_direct): New functions.
4703         (main) [print_with_color]: Register signal handlers.
4704         Patch mostly by Solar Designer and Stanislav Ievlev.
4705
4706         Update from autoconf.
4707         * Makefile.maint (AMTAR): Remove definition.
4708         (update, cvs-update, po-update, do-po-update): New rules.
4709         (wget-update): Update (thus renaming to cvs-update).
4710         (automake_repo): Use anoncvs@sources.redhat.com.
4711
4712 2002-11-06  Jim Meyering  <jim@meyering.net>
4713
4714         * tests/misc/Makefile.am (TESTS): Add printf-hex.
4715
4716         * tests/misc/printf: Be careful to test the code in this package,
4717         not the shell built-in function.
4718
4719         * src/printf.c (print_esc): A hexadecimal escape sequence has
4720         at most two hex. digits, not three.  Reported by Padraig Brady.
4721         (usage): Update description.
4722         * tests/misc/printf-hex: New file/test, for the above fix.
4723
4724 2002-10-07  Paul Eggert  <eggert@twinsun.com>
4725
4726         Add support for locale-specific size indications (e.g.,
4727         thousands-separators) and for explicit size suffixes on output.
4728
4729         * doc/coreutils.texi (Block size): Say that:
4730         This affects display format as well as block size.
4731         Fractional block counts are rounded up.
4732         ls file size blocksize defaults to 1.
4733         A block size spec preceded by ' generates thousands separators.
4734         A suffix without a preceding integer generates suffixes.
4735         (tail invocation): 32k -> 32 KiB.
4736         (What information is listed): ls -h is now equivalent to
4737         ls --block-size=human, and ls -H is now equivalent to
4738         ls --block-size=si.  Displayed file size is now always affected by
4739         --block-size.
4740
4741         * lib/inttostr.c, lib/inttostr.h, lib/imaxtostr.c, lib/offtostr.c,
4742         lib/umaxtostr.c: New files, taken from GNU tar.
4743
4744         * lib/Makefile.am (libfetish_a_SOURCES): Add imaxtostr.c, offtostr.c,
4745         umaxtostr.c.
4746         (EXTRA_DIST): Add inttostr.c.
4747
4748         * lib/human.c, lib/human.h: Rewrite to support locale-specific
4749         notations like thousands separators.
4750         Specify what includer of include.h must include beforehand.
4751         (human_group_digits, human_suppress_point_zero, human_autoscale,
4752         human_base_1024, human_SI, human_B): New enum values.
4753         (human_readable): Rename from human_readable_inexact; put the
4754         options before the sizes.  All uses changed.  The old human_readable
4755         function has been removed; use inttostr.h instead.
4756         (human_options): Renamed from human_block_size, with new signature
4757         that allows block sizes up to UINTMAX_MAX.  All callers changed.
4758
4759         * m4/prereq.m4 (jm_PREREQ_HUMAN): Check for locale.h, localeconv,
4760         AC_HEADER_STDBOOL.  No need to check for limits.h since it's in
4761         freestanding C89.  No need to check for stdlib.h or string.h since
4762         autoconf does this now.
4763
4764         * src/cksum.c (cksum): Use primitives from inttostr.h, not
4765         human.h, to print large numbers simply.
4766         * src/csplit.c (handle_line_error, parse_patterns): Likewise.
4767         * src/dd.c (print_stats, main): Likewise.
4768         * src/df.c (print_header): Likewise.
4769         * src/factor.c (print_factors): Likewise.
4770         * src/ls.c (print_long_format, print_file_name_and_frills): Likewise.
4771         * src/shred.c (dopass): Likewise.
4772         * src/sort.c (checkfp): Likewise.
4773         * src/sum.c (bsd_sum_file, sysv_sym_file): Likewise.
4774         * src/tail.c (xlseek): Likewise.
4775         * src/wc.c (write_counts, wc): Likewise.
4776
4777         * src/df.c (human_output_opts): New var.
4778         (output_block_size): Now uintmax_t, not int, to handle larger
4779         block sizes.  All uses changed.
4780         * src/du.c: Likewise.
4781         * src/ls.c: Likewise.
4782
4783         * src/df.c (print_header): In the header line, prefer SI to human
4784         representation if it's shorter; if neither is shorter, try to
4785         intuit what the user would prefer.
4786
4787         * src/expr.c (inttostr): Remove; use new imaxtostr library
4788         function instead.
4789
4790         * src/ls.c (file_output_block_size): New var, to distinguish
4791         file sizes from other sizes.
4792         (decode_switches): Set it.
4793
4794         * src/shred.c (OUTPUT_BLOCK_SIZE): remove.
4795         (dopass): When printing progress, use floor for what has been done
4796         so far (since we should be conservative there), and ceiling for
4797         what needs to be done (since that's what other programs use).
4798
4799 2002-10-19  Jim Meyering  <jim@meyering.net>
4800
4801         * src/pinky.c (print_heading): Align TTY and Name headings.
4802         Reported by Karl Eichwalder.
4803
4804 2002-10-18  Jim Meyering  <jim@meyering.net>
4805
4806         * src/split.c (cwrite): Change type of `bytes' parameter to size_t
4807         Remove now-useless cast.
4808         (stdread): Remove function.
4809         (bytes_split): Use size_t instead of int.
4810         Use safe_read, not stdread.
4811         (lines_split): Likewise.
4812         Use memchr rather than a `while' loop.
4813         (line_bytes_split): Use size_t instead of int.
4814         Use safe_read, not stdread.
4815         (main): Add some FIXME comments to remind me to remove casts.
4816
4817         * src/system.h (ST_BLKSIZE): Correct comment describing how to
4818         reproduce HPUX-11 cat failure.  From Petter Reinholdtsen.
4819
4820 2002-10-17  Jim Meyering  <jim@meyering.net>
4821
4822         Fix a problem that could make e.g., `cat' misbehave on systems which
4823         give invalid (unreasonably large) values for stat.st_blksize.
4824         * src/system.h (ST_BLKSIZE): Ensure that the result is in [1..4MB].
4825         Reported by Petter Reinholdtsen.
4826
4827 2002-10-14  Jim Meyering  <jim@meyering.net>
4828
4829         Specifying a printf conversion specifer as nl's separator string
4830         could cause nl to segfault.
4831         * src/nl.c (build_print_fmt): Don't include separator string
4832         in the printf format; it might contain `%'.
4833         Use a better bound on the length of the print_fmt buffer.
4834         (print_lineno): Print the separator here instead.
4835         Reported by Doug Coleman.
4836
4837         * tests/misc/nl: New file/tests, including a test for the above.
4838         * tests/misc/Makefile.am (TESTS): Add nl.
4839
4840         * tests/misc/split-l: New test, to make sure `split --lines=N' works.
4841         * tests/misc/Makefile.am (TESTS): Add split-l.
4842
4843 2002-10-13  Jim Meyering  <jim@meyering.net>
4844
4845         * Version 4.5.3.
4846
4847         * src/du.c (usage): Tweak description of --dereference-args/-D.
4848
4849         * src/du.c (count_entry): Also save cwd when dereferencing (via
4850         --dereference-args, -D) a command-line argument.
4851         Reported by Michal Svec.  Based on a patch by Andreas Schwab.
4852
4853         * src/Makefile.am (../AUTHORS): New target/rule.
4854
4855 2002-10-12  Jim Meyering  <jim@meyering.net>
4856
4857         * src/paste.c (paste_parallel): Declare local, `delims_saved', to be
4858         of type size_t, since that's the way it's used and avoids a warning.
4859
4860         * src/csplit.c (struct cstring) [len]: Declare to be unsigned int,
4861         since that's how it's always used and avoids a new warning from gcc.
4862         (read_input): Adapt to new safe_read ABI.
4863
4864         * src/cut.c (cut_fields): Add a temporary size_t variable, n_bytes,
4865         to avoid warnings.
4866
4867         * src/pinky.c (print_long_entry): fread returns size_t.
4868         Declare local `bytes' accordingly, to avoid warning.
4869
4870         tail -c +N would perform an extra read after encountering EOF
4871         [this change is analogous (bytes vs. lines) to the one of 2002-01-27]
4872         * src/tail.c (start_bytes): Detect EOF, inform caller.
4873         (tail_bytes): Upon EOF in start_bytes, return immediately.
4874         (file_lines): Reorganize to use memrchr rather than an explicit loop.
4875         Adapt to new safe_read ABI.
4876
4877 2002-10-11  Jim Meyering  <jim@meyering.net>
4878
4879         * tests/du/deref: New file/test, for the above fix.
4880         * tests/du/Makefile.am (TESTS): Add deref.
4881
4882 2002-10-10  Jim Meyering  <jim@meyering.net>
4883
4884         * tests/ln/Makefile.am (TESTS): Add target-1.
4885         * tests/ln/target-1: New file/test, for the fix on 2002-10-08.
4886
4887 2002-10-09  Jim Meyering  <jim@meyering.net>
4888
4889         * tests/cp/backup-is-src: Ensure that certain environment variables
4890         are not set (e.g., SIMPLE_BACKUP_SUFFIX).  Reported by Duncan Roe.
4891
4892         * tests/tail-2/big-4gb: Mark this as an expensive test; it would
4893         consume 4GB of disk space on systems without support for sparse files.
4894         Fix a logic error that'd make it `cat err' even though dd didn't fail.
4895
4896         * src/dircolors.hin (.jar): Fix typo: s/;3$/;31/.
4897         Patch by steven@magelico.net, forwarded by Michael Stone.
4898
4899         * tests/ls/dired: Ensure that ls produces English messages.
4900         Patch by Alexey Vyskubov, forwarded by Michael Stone.
4901
4902 2002-10-08  Dmitry V. Levin  <ldv@altlinux.org>
4903
4904         * src/ln.c (main): Fix target_directory parsing when n_files == 1.
4905
4906 2002-10-08  Jim Meyering  <jim@meyering.net>
4907
4908         * tests/tail-2/big-4gb: Use double quotes around diagnostic.
4909         Fix syntax in test: use =, not ==.
4910         Reported by Bob Proulx.
4911         Change all the rest like this: grep -lR "testing framework'" .\
4912         |xargs perl -pi -e 's/'\''(\$0: failure in testing framework)'\''/"$1"/'
4913
4914         * src/sum.c (sysv_sum_file): Adapt to new safe_read ABI.
4915         * src/tr.c (squeeze_filter, read_and_delete, read_and_xlate): Likewise.
4916         * src/tac.c (save_stdin, tac_stdin_to_mem): Likewise.
4917         * src/wc.c (wc): Likewise.
4918
4919 2002-10-07  Paul Eggert  <eggert@twinsun.com>
4920
4921         * src/cat.c (cat):
4922         Don't advance the write pointer past the end of the write buffer.
4923         * src/sort.c (begfield, limfield): Likewise.
4924
4925 2002-10-07  Jim Meyering  <jim@meyering.net>
4926
4927         * src/cat.c (simple_cat, cat): Adapt to new safe_read ABI.
4928         * src/head.c (head_bytes, head_lines): Likewise.
4929
4930 2002-10-06  Jim Meyering  <jim@meyering.net>
4931
4932         * src/dd.c (scanargs): Ensure that specified block sizes (specified
4933         via ibs=N, obs=N, and bs=N) are no larger than SSIZE_MAX.
4934         (skip, dd_copy): Adapt to new safe_read ABI.
4935
4936         * Makefile.maint (signatures): Define.
4937         (%.sig): New rule.
4938         (announcement): Depend on $(signatures).
4939
4940         * Makefile.maint (announcement): Output all URLs for detached
4941         signatures, not just the last one from the previous loop.
4942
4943 2002-10-05  Jim Meyering  <jim@meyering.net>
4944
4945         * Version 4.5.2.
4946
4947         * src/remove.c (remove_entry) [ROOT_CAN_UNLINK_DIRS]: With `rm -i DIR',
4948         don't recurse into directory, DIR.  Prompted by a report from
4949         Leonardo Milano.
4950
4951         * tests/rm/i-no-r: New file/test, for the above fix.
4952         * tests/rm/Makefile.am (TESTS): Add i-no-r.
4953
4954         * tests/tail-2/big-4gb: New file/test, for the fix of 2002-09-27.
4955         * tests/tail-2/Makefile.am (TESTS): Add big-4gb.
4956
4957 2002-10-03  Jim Meyering  <jim@meyering.net>
4958
4959         * src/rm.c (AUTHORS): Mark translatable string with `N_ (...)'.
4960         * src/df.c (AUTHORS): Likewise.
4961         * src/du.c (AUTHORS): Likewise.
4962         * src/tail.c (AUTHORS): Likewise.
4963         * src/touch.c (AUTHORS): Likewise.
4964
4965 2002-10-02  Jim Meyering  <jim@meyering.net>
4966
4967         * Makefile.am (SUBDIRS): Remove `old'.
4968         (EXTRA_DIST): List the files in old/.
4969         * configure.ac (AC_CONFIG_FILES): Remove old/* names.
4970         Suggestion from Akim Demaille.
4971
4972 2002-10-01  Jim Meyering  <jim@meyering.net>
4973
4974         * src/sys2.h (SSIZE_MAX): Define.
4975
4976 2002-09-30  Jim Meyering  <jim@meyering.net>
4977
4978         * src/csplit.c: Don't include stdlib.h here.  It's already included
4979         via system.h.
4980
4981 2002-09-29  Jim Meyering  <jim@meyering.net>
4982
4983         * src/tr.c (find_bracketed_repeat): Rearrange pointer/integer
4984         expression to avoid bogus warning from gcc.
4985
4986         * src/cat.c (simple_cat): Use a temporary to avoid bogus warnings.
4987         (cat): Declare insize and outsize to be of type size_t, not int.
4988         Rearrange pointer/integer expressions to avoid bogus warnings.
4989         (main): Declare insize and outsize to be of type size_t, not int.
4990
4991         * src/tail.c (parse_options): Give a sensible diagnostic for
4992         an invalid byte or line count.  Reported by Mikko Tuumanen.
4993
4994         * src/touch.c (main): Split a long line.
4995
4996         * tests/du/Makefile.am (TESTS): Add slink.
4997         * tests/du/slink: New test for system.h change of 2002-08-31.
4998
4999         In move mode, always first try to rename.  Before, upon failure to
5000         rename a directory, this code would never attempt to rename any
5001         other file in that directory, but would thenceforth always copy.
5002         On some systems (e.g., NetApp's OnTap-6.4), renaming a directory
5003         may fail with EXDEV, yet renaming files within that directory to
5004         a newly-created destination directory succeeds.
5005         * src/copy.c (copy_internal): Remove local, move_mode;
5006         use x->move_mode instead.  Based on a patch from Tom Haynes.
5007
5008 2002-09-28  Jim Meyering  <jim@meyering.net>
5009
5010         * src/split.c (FAIL_ONLY_ONE_WAY): New macro.
5011         Factor out some duplication.
5012         (main): Use it.
5013         [case 'a']: Use strtoul rather than strtol to avoid compiler warnings.
5014
5015         * src/sort.c (begfield, limfield): Rearrange comparisons to avoid
5016         compiler warnings.
5017         (fillbuf, keycompare): Cast literal `-1' to size_t in comparisons,
5018         to avoid compiler warnings.
5019
5020         * src/shred.c (dopass): Use a uintmax_t temporary to avoid bogus
5021         compiler warnings.
5022
5023         Fix things so `mkdir -p' can create very deep directories, e.g.,
5024         mkdir -p $(perl -e 'print "a/" x 40000') now works.
5025         * src/mkdir.c (main): For --parents (-p), call make_path with the
5026         entire directory name, so we don't ever require that file operations
5027         like stat or chmod be performed on the entire command line argument.
5028         * makepath.c (make_path): Restore umask *before* creating the final
5029         component.
5030
5031 2002-09-27  Andreas Schwab  <schwab@suse.de>
5032
5033         * src/tail.c (tail_bytes): Change type of bytes_remaining to off_t
5034         to avoid overflow.  Reported by Hans Lermen.
5035
5036 2002-09-26  Jim Meyering  <jim@meyering.net>
5037
5038         * src/install.c (get_ids): Use strtoul, not strtol.  Remove some casts.
5039
5040 2002-09-25  Jim Meyering  <jim@meyering.net>
5041
5042         * src/test.c (eaccess): Change type of local `euid' from int to uid_t
5043         and add a cast, to avoid a warning about `signed and unsigned type in
5044         conditional expression'.
5045
5046 2002-09-22  Jim Meyering  <jim@meyering.net>
5047
5048         * src/rmdir.c: Include "dirname.h", for declaration of
5049         strip_trailing_slashes.
5050
5051         * src/stat.c (PRIdMAX, PRIuMAX): Remove definitions.
5052         Now they're defined through system.h.
5053
5054         * src/cp-hash.c, src/dd.c, src/df.c, src/du.c, src/ls.c,
5055         * src/stat.c, src/wc.c: Remove all inclusions of inttypes.h,
5056         since it's already included from sys2.h via system.h.
5057
5058         * Use automake-1.6f.  Regenerate dependent files.
5059
5060         * src/Makefile.am (PERL): Remove duplicate definition.
5061
5062         fmt's -s, -t, -c options didn't work properly for long lines.
5063         Since get_line may end up calling put_paragraph (for long lines),
5064         be sure to set global, `other_indent', before it is used there.
5065
5066         * src/fmt.c (set_other_indent): New function, factored out of...
5067         (get_paragraph): ... here.  Call it.
5068         (get_line): Call set_other_indent before calling flush_paragraph,
5069         which calls fmt_paragraph, which in turn calls put_paragraph,
5070         which uses other_indent.
5071
5072         * tests/fmt/Makefile.am (TESTS): Add long-line.
5073         * tests/fmt/long-line: New file/test, for the above fix.
5074
5075 2002-09-21  Jim Meyering  <jim@meyering.net>
5076
5077         * src/od.c: No longer include deprecated <values.h>.
5078         It was required solely for now-removed reference to BITSPERBYTE.
5079         * src/install.c: Likewise.
5080         Suggestion from Bruno Haible.
5081
5082 2002-09-06  Andreas Schwab  <schwab@suse.de>
5083
5084         `rmdir -p dir-specified-with-trailing-slash/' would fail.
5085         * src/rmdir.c (remove_parents): Strip trailing slashes.
5086
5087 2002-09-20  Jim Meyering  <jim@meyering.net>
5088
5089         * tests/rmdir/t-slash: New file/test, for the above fix.
5090         * tests/rmdir/Makefile.am (TESTS): Add t-slash.
5091
5092         * Makefile.maint (announcement): Arrange to gpg-sign the message.
5093         Add a URL for each detached signature file.
5094
5095 2002-09-07  Bruno Haible  <bruno@clisp.org>
5096
5097         * configure.ac: Add need-ngettext to AM_GNU_GETTEXT invocation.
5098
5099 2002-09-18  Jim Meyering  <jim@meyering.net>
5100
5101         `od -t x8' used the wrong (`l'-prefixed) printf format.
5102         Likewise for the o8 and u8 formats.
5103         * src/od.c (ISPEC_TO_FORMAT): Define macro.
5104         (decode_one_format): Use PRIdMAX, PRIoMAX, etc. for LONG_LONG.
5105         Reported by Arun Sharma.
5106
5107 2002-09-17  Jim Meyering  <jim@meyering.net>
5108
5109         * src/sys2.h (PRIdMAX, PRIoMAX, PRIuMAX, PRIxMAX): Define if necessary.
5110         From gettext's intl/loadmsgcat.c.
5111
5112         * tests/od/x8: New file/test, for the above fix.
5113         * tests/od/Makefile.am (TESTS): Add x8.
5114
5115 2002-09-15  Jim Meyering  <jim@meyering.net>
5116
5117         * Use autoconf-2.54.  Regenerate dependent files.
5118
5119         * src/csplit.c (get_format_width): Add cast to avoid
5120         warning about `signed and unsigned type in conditional expression'.
5121
5122 2002-09-14  Jim Meyering  <jim@meyering.net>
5123
5124         * src/who.c (print_user): Change type of local to size_t
5125         to avoid warnings about `comparison between signed and unsigned'.
5126         * src/ptx.c (generate_all_output): Likewise.
5127
5128         * src/dd.c (main, skip): Add casts to avoid warnings about
5129         `comparison between signed and unsigned'.
5130
5131         * src/id.c (print_full_info, print_group_list): Add casts to avoid
5132         warnings about `signed and unsigned type in conditional expression'.
5133
5134         * src/md5sum.c: Change type of global, digest_hex_bytes, to size_t
5135         to avoid warnings about `comparison between signed and unsigned'.
5136         (split_3): Change parameter names to be readable and add comment.
5137         Clean up the test for whether a line may be ignored.
5138
5139 2002-09-13  Jim Meyering  <jim@meyering.net>
5140
5141         * src/printf.c (main): Handle leading command line argument of `--'.
5142         Reported by Raul: DervishD <raul@pleyades.net>
5143         * tests/misc/printf: New file: test for the above.
5144         * tests/misc/Makefile.am (TESTS): Add printf.
5145
5146         * src/date.c (usage): Explain that %S's range of [0..60] is required --
5147         rather than 0..59 -- to accommodate the occasional positive leap second.
5148         Reported by Richard Neill.
5149
5150 2002-09-12  Jim Meyering  <jim@meyering.net>
5151
5152         * src/Makefile.am (nanosec_libs): Define.
5153         (sleep_LDADD, tail_LDADD): Use it here.
5154
5155         Factor nanosleep-related code into ../lib/xnanosleep.c.
5156         * src/sleep.c: Include xnanosleep.h.
5157         Factor out fenv.h-related code.
5158         (timespec_subtract): Remove function.
5159         (main): Remove code that deals with computing start and stop times
5160         as well as the loop around nanosleep.  Now that's in xnanosleep.c.
5161
5162         Allow S (in --sleep-interval=S) to be a floating point value.
5163         * src/tail.c: Include xnanosleep.h and xstrtod.h.
5164         Move declaration of global variable, sleep_interval, to ...
5165         (main): ...here.
5166         (usage): Update description of --sleep-interval option.
5167         (tail_forever): New parameter, sleep_interval.  Update caller.
5168         Use xnanosleep, rather than sleep.
5169         (parse_options): New parameter, sleep_interval.  Update caller.
5170         Use xstrtod, now that we accept floating point values.
5171         Prompted by a patch from Augey Mikus.
5172
5173 2002-09-06  Jim Meyering  <jim@meyering.net>
5174
5175         * src/remove.c (prompt): Change comment to give a better note to
5176         translators.  From Michael Piefel.
5177
5178 2002-09-02  Jim Meyering  <jim@meyering.net>
5179
5180         * README: A good problem report/patch includes diffs against
5181         the most recent test release.
5182
5183         * src/pathchk.c (NEED_PATHCONF_WRAPPER): Define.
5184         (pathconf_wrapper): Define only if NEED_PATHCONF_WRAPPER is set.
5185
5186         * src/kill.c (print_table_row): Use an unsigned type for widths
5187         to avoid warning about comparison between signed and unsigned.
5188         (list_signals): Likewise.
5189
5190         * src/od.c (skip): Add a cast to avoid warning about comparison
5191         between signed and unsigned.
5192         * src/install.c (get_ids): Likewise.  Also rearrange range-checking
5193         comparisons to make them more readable.
5194
5195 2002-09-01  Jim Meyering  <jim@meyering.net>
5196
5197         * Version 4.5.1.
5198
5199 2002-08-31  Jim Meyering  <jim@meyering.net>
5200
5201         Symlinks were always reported as using 0 blocks.
5202         * src/system.h (ST_NBLOCKS): Don't depend on file type.
5203         This reverts the change of 2000-01-30.
5204         Based on a report and patch from Neil Brown via Michael Stone.
5205         This fixes Debian Bug#156358.
5206
5207         * Most files: Change `exit (0)' to `exit (EXIT_SUCCESS)',
5208         `exit (1)' to `exit (EXIT_FAILURE)', and
5209         `usage (1)' to `usage (EXIT_FAILURE)'.
5210
5211         * chgrp.c, chmod.c, chown.c, chroot.c, cp.c, date.c, dd.c, du.c,
5212         * hostname.c, id.c, install.c, ln.c, mkdir.c, mkfifo.c, mknod.c,
5213         * nice.c, pinky.c, printf.c, pwd.c, shred.c, sleep.c, stty.c,
5214         * su.c, tac-pipe.c, tail.c, tee.c, touch.c, uname.c, uptime.c,
5215         * users.c, who.c: Change `error (1, ...' to `error (EXIT_FAILURE, ...'.
5216         But don't change `error (0, ...' to `error (EXIT_SUCCESS, ...', since
5217         error never exits successfully.
5218
5219 2002-08-29  Jim Meyering  <jim@meyering.net>
5220
5221         * src/remove.c (remove_cwd_entries): Use closedir (not CLOSEDIR)
5222         when ignoring any return value.
5223
5224         * src/remove.c (remove_cwd_entries): Detect and diagnose readdir
5225         failures.  On some systems (at least EMC Celerra and Solaris5.8),
5226         this appears to be necessary.
5227         (is_empty_dir): Likewise.  Also, always close directory handle.
5228         * src/ls.c (print_dir): Likewise.
5229         (print_dir): Rename local variable: reading -> dirp.
5230         Reported by Mike Coleman.
5231
5232 2002-08-28  Jim Meyering  <jim@meyering.net>
5233
5234         * src/remove.c (remove_cwd_entries): Use CLOSEDIR, not closedir.
5235         Give a diagnostic and fail if closedir fails.
5236
5237 2002-08-26  Jim Meyering  <jim@meyering.net>
5238
5239         * Makefile.am (THANKS-to-translators): New rule.
5240         (EXTRA_DIST): Add both THANKS-to-translators and THANKStt.in.
5241         * THANKStt.in: New file.
5242
5243         * src/cat.c (close_stdout_wrapper): New, kludgey, function and
5244         file-scoped global.
5245         (main): Register it with atexit.
5246         Close STDOUT_FILENO, to avoid a problem when writing to
5247         /dev/audio on at least Solaris 5.7 and 5.8 systems.
5248         Reported by Shing-Shong Shei.
5249
5250 2002-08-25  Jim Meyering  <jim@meyering.net>
5251
5252         * src/cat.c (main): Close STDIN_FILENO rather than a literal `0'.
5253         * src/tac.c (main): Likewise.
5254         * src/tail.c (main): Likewise.
5255         * src/tee.c (main): Likewise.
5256         * src/tr.c (main): Likewise.
5257         * src/wc.c (main): Likewise.
5258
5259 2002-08-20  Jim Meyering  <jim@meyering.net>
5260
5261         * tests/mv/setup: Rewrite not to use `: ${VAR=not_set}' paradigm.
5262
5263 2002-08-10  Paul Eggert  <eggert@twinsun.com>
5264
5265         * src/nohup.sh: Don't use "exec --"; it's not portable and
5266         shouldn't be needed.
5267
5268 2002-08-09  Jim Meyering  <jim@meyering.net>
5269
5270         * src/pr.c (main): Don't ignore -COLUMN if it's the last option.
5271         (usage): Clarify help text for the -COLUMN option.
5272         Patch by Padraig Brady.
5273         * tests/pr/Test.pm [col-last]: New test for the above.
5274
5275         * configure.ac: Start with version 4.5.1, chosen so that it's larger
5276         than the latest version numbers of the component packages.
5277
5278         * man/Makefile.am (check-x-vs-1): Set and export PATH so we use
5279         programs in ../src.
5280
5281 2002-08-08  Jim Meyering  <jim@meyering.net>
5282
5283         * src/date.c: Guard inclusion of <langinfo.h> with
5284         `#if HAVE_LANGINFO_CODESET', not `#if HAVE_LANGINFO_H'.
5285         * src/sort.c: Likewise.
5286         Patch by GOTO Masanori.
5287
5288 2002-08-05  Paul Eggert  <eggert@twinsun.com>
5289
5290         Fix some minor time-related bugs with POSIX time arguments.
5291         Some valid time stamps were being rejected (notably -1, and
5292         time stamps before 1900 on 64-bit hosts).  And some invalid
5293         time stamps were being accepted, e.g. September 31.
5294
5295         * src/date.c (main): Adjust to posixtime signature change.
5296         * src/touch.c (main): Likewise.  Remove unnecessary initialization.
5297         Use localtime, not posixtm, to warn about obsolete "touch".
5298
5299 2002-08-05  Jim Meyering  <jim@meyering.net>
5300
5301         * tests/misc/Makefile.am (TESTS): Add nice and pathchk1.
5302
5303 2002-08-04  Jim Meyering  <jim@meyering.net>
5304
5305         * src/Makefile.am (check-README): New target/rule.
5306         (check): Depend on it.
5307
5308         * configure.ac (AC_CONFIG_FILES): Add old/Makefile and old/*/Makefile.
5309
5310 2002-08-03  Jim Meyering  <jim@meyering.net>
5311
5312         * Makefile.am (SUBDIRS): Add old.
5313         * old/: New directory, containing legacy ChangeLog* and NEWS files
5314         from the fileutils, sh-utils, and textutils packages.
5315
5316         * src/Makefile.am (AM_INSTALLCHECK_STD_OPTIONS_EXEMPT): Set to false.
5317
5318 2002-08-02  Paul Eggert  <eggert@twinsun.com>
5319
5320         * NEWS, doc/coreutils.texi: uniq now obeys LC_COLLATE.
5321
5322         * src/uniq.c: Include hard-locale.h, xmemcoll.h.
5323         (hard_LC_COLLATE): New var.
5324         (different): Args are now char *, not const char *.
5325         Use xmemcoll instead of memcmp to compare lines, so that
5326         LC_COLLATE has effect.  However, use memcmp if it is an
5327         easy locale.
5328         (check_file): Do not include newline in comparison, so that
5329         xmemcoll has a byte to stomp on temporarily.
5330         (main): Set hard_LC_COLLATE.
5331
5332 2002-07-29  Jim Meyering  <jim@meyering.net>
5333
5334         * Makefile.am (SUBDIRS): Remove djgpp, for now.
5335
5336 2002-07-20  Jim Meyering  <jim@meyering.net>
5337
5338         * Makefile.am (false.c): Convert only the final EXIT_SUCCESS
5339         into EXIT_FAILURE.  Otherwise, false --help and false --version
5340         would fail.
5341
5342 2002-07-08  Jim Meyering  <jim@meyering.net>
5343
5344         * src/Makefile.am (uninstall-local): Search for @GNU_PACKAGE@,
5345         rather than the hard-coded `sh-utils'.
5346
5347 2002-07-01  Jim Meyering  <jim@meyering.net>
5348
5349         * configure.ac: Merge the three files from fileutils,
5350         textutils, and sh-utils.
5351         * Makefile.am: Likewise.
5352         * src/Makefile.am: Likewise.