Use only HAVE_SYS_IOCTL_H to decide whether to include sys/ioctl.h.
[platform/upstream/coreutils.git] / ChangeLog
1 2005-07-08  Paul Eggert  <eggert@cs.ucla.edu>
2
3         * Version 5.3.1.
4
5         Fix porting problems reported by Eric Blake.
6
7         * configure.ac: Remove check for AC_HEADER_TIOCGWINSZ.
8         * src/cat.c, src/ls.c, src/stty.c: Include stropts.h if available,
9         because POSIX says that's where ioctl is declared.
10         * src/cat.c: Use HAVE_SYS_IOCTL_H instead of _POSIX_SOURCE
11         to decide whether to include <sys/ioctl.h>.
12         * src/stty.c: Use only HAVE_SYS_IOCTL_H to decide whether
13         to include <sys/ioctl.h>.
14
15         * src/id.c (print_user): Don't assume uid fits in unsigned int.
16         (print_group): Likewise, for gid.
17
18 2005-07-05  Paul Eggert  <eggert@cs.ucla.edu>
19
20         * src/system.h (DECIMAL_DIGIT_ACCUMULATE): Generate a hard error
21         (not just a warning) if GCC is used and the types don't match.
22
23 2005-07-04  Paul Eggert  <eggert@cs.ucla.edu>
24
25         * src/system.h (VERIFY_W_TYPEOF): Remove; no longer needed.
26         (DECIMAL_DIGIT_ACCUMULATE): Change last arg from T's maximum value
27         to T itself.  All callers changed.  Check that T is unsigned, and
28         that Accum is of type T.  This fixes a bug in the unlikely case
29         where SIZE_MAX <= INT_MAX, and it no longer requires typeof to do
30         the proper validity checks.
31
32         * src/od.c: Adjust to verify.h change.
33         * src/system.h (VERIFY_W_TYPEOF): Likewise.
34
35 2005-07-04  Jim Meyering  <jim@meyering.net>
36
37         * src/system.h: Include "verify.h".
38
39         * src/system.h (verify): Rename from VERIFY_EXPR, to be lower case,
40         like assert.  Use sizeof, rather than equivalent ((...)0), for
41         it's slightly simpler syntax.  Suggestions from Paul Eggert.
42         (verify_decl): Rename from VERIFY.
43         * src/od.c: Reflect name change.
44
45 2005-07-03  Jim Meyering  <jim@meyering.net>
46
47         * NEWS: cp and mv: the --reply=X option is deprecated
48         Suggested by Bob Proulx, after numerous user complaints
49         about how --reply=no appeared not to work.
50         * src/mv.c (main): Using --reply now evokes a warning.
51         (usage): Remove description of --reply.
52         * src/cp.c (main): Using --reply now evokes a warning.
53         (usage): Remove description of --reply.
54         * tests/mv/i-link-no: Adjust for new diagnostic.
55         * tests/mv/reply-no: Likewise.
56
57         * src/printf.c (verify_numeric): Rename from verify.
58         Update caller.
59
60 2005-07-03  Paul Eggert  <eggert@cs.ucla.edu>
61
62         * src/copy.h: Include "lstat.h" rather than rolling our own.
63         * src/ls.c: Likewise.
64         * src/remove.c: Likewise.
65
66 2005-07-02  Paul Eggert  <eggert@cs.ucla.edu>
67
68         Cleanup to isolate "safer" functions to a small part of the code.
69         * src/comm.c: Include stdio--.h, not stdio-safer.h.
70         (compare_files): Use fopen, not fopen_safer.
71         * src/copy.c: Include fcntl--.h, not unistd-safer.h.
72         (copy_reg): Don't call fd_safer; no longer needed
73         now that we include fcntl--.h.
74         * src/csplit.c: Include fd-reopen.h.
75         Include stdio--.h, not stdio-safer.h.
76         (input_desc): Remove.  All uses changed to STDIN_FILENO.
77         (set_input_file): Reopen stdin, to simplify code.
78         (create_output_file): Use fopen, not fopen_safer.
79         * src/dd.c: Include fd-reopen.h.
80         (open_fd): Remove.  All callers changed to use fd_reopen instead.
81         * src/join.c: Include stdio--.h, not stdio-safer.h.
82         (main): Use fopen, not fopen_safer.
83         * src/md5sum.c: Include stdio--.h.
84         (digest_check): Don't try to read both checksums and data from stdin.
85         * src/nohup.c: Include fd-reopen.h.
86         Include unistd--.h, not unistd-safer.h.
87         (main): Use fd_reopen to simplify code.  When replacing stdin,
88         use "/dev/null" not "/", as that's less likely to go wrong these days.
89         (main): Use dup, not dup_safer.
90         * src/pr.c: Include stdio--.h, not stdio-safer.h.
91         (open_file): Invoke fopen, not fopen_safer.
92         * src/shred.c: Include fcntl--.h, not unistd-safer.h.
93         (wipename, wipe_file): Don't use fd_safer; no longer needed
94         now that we include fcntl--.h.
95         * src/sort.c: Include stdio--.h rather than stdio-safer.h.
96         Include stdlib--.h.  Do not include unistd-safer.h.
97         (create_temp_file): Don't call fd_safer; no longer needed
98         now that we include *--.h files.
99         (xfopen): Don't call fopen_safer, for similar reasons.
100         * src/split.c: Include fcntl--.h rather than unistd-safer.h.
101         Include fd-reopen.h.
102         (input_desc): Remove.  All uses replaced by STDIN_FILENO.
103         (cwrite): Don't call fd_safer; no longer needed now that
104         we include fcntl--.h.
105         (main): Reuse stdin rather than opening a new one.  This
106         saves a file descriptor.
107         * src/stty.c: Include fd-reopen.h.
108         (display_all, display_settings, display_window_size, set_window_size):
109         Remove fd arg, since we now assume stdin.  All callers changed.
110         (main): Reuse stdin rather than opening a new one.  This
111         saves a file descriptor.
112         * src/tac.c: Include stdlib--.h rather than unistd-safer.h.
113         (copy_to_temp): Don't call fd_safer; no longer needed now
114         that we include stdlib--.h.
115         * src/tail.c: Include fcntl--.h, not unistd-safer.h.
116         (recheck, tail_file): Don't call fd_safer; no longer needed
117         now that we include fcntl--.h.
118         * src/tee.c: Include stdio--.h, not stdio-safer.h.
119         (tee): Don't call fopen_safer; no longer needed now that we
120         include stdio--.h.
121         * src/touch.c: Include fcntl--.h, not unistd-safer.h.
122         (touch): Don't call fd_safer; no longer needed now that
123         we include fcntl--.h.
124
125         * src/du.c (main): Reuse stdin rather than opening a new stream.
126         This saves a file descriptor.
127         * src/uniq.c: Don't include stdio-safer.h; no longer needed.
128         (writeline): Remove stream arg; we now always output to stdout.
129         All callers changed.
130         (check_file): Reuse stdout rather than opening a new stream.
131         This saves a file descriptor.
132
133 2005-07-02  Jim Meyering  <jim@meyering.net>
134
135         * Makefile.maint (sc_obsolete_symbols): New rule.
136         (syntax-check-rules): Add it to the list.
137         * Makefile.am (EXTRA_DIST): Add .x-sc_obsolete_symbols.
138         * .x-sc_obsolete_symbols: New file.
139
140 2005-07-01  Jim Meyering  <jim@meyering.net>
141
142         * src/system.h: Assume HAVE_FCNTL_H (i.e., include <fcntl.h>
143         unconditionally, and don't include <sys/file.h>).
144         * src/system.h: Likewise for HAVE_UNISTD_H.
145
146 2005-06-30  Jim Meyering  <jim@meyering.net>
147
148         * src/cp.c: Add uses of ARGMATCH_VERIFY to ensure that
149         corresponding option string and value arrays are consistent.
150         * src/date.c: Likewise.
151         * src/du.c: Likewise.
152         * src/ls.c: Likewise.
153         cp.c and date.c each had a harmless trailing `, 0' (now-removed)
154         in a value list.
155
156         * src/system.h (VERIFY): Guard definition with #ifndef.
157         (VERIFY_EXPR): Undef before defining.
158
159 2005-06-29  Jim Meyering  <jim@meyering.net>
160
161         * src/pr.c (main, store_char): Use X2REALLOC rather than x2realloc.
162         * src/du.c (show_date): Likewise.
163         * src/date.c (show_date): Likewise.
164         * src/od.c (dump_strings): Likewise.
165         * src/sort.c (fillbuf): Likewise.
166         * src/chmod.c (main): Likewise.
167
168         * src/system.h (VERIFY): Rewrite to use string-concatenation
169         and __LINE__ so as not to require a struct name parameter.
170         (GL_CONCAT, GL_CONCAT2): Define helper macros.
171         * src/od.c: Update sole use.
172
173         * src/ls.c (gobble_file): Use stat.st_author, not stat.st_uid
174         when computing the --author column width.  This bug might have
175         resulted in misaligned columns when using the --author option
176         on the Hurd.  Spotted by Arnold Robbins.
177
178 2005-06-28  Jim Meyering  <jim@meyering.net>
179
180         * src/pr.c (main, store_char): Use x2realloc on 1-byte base types,
181         not x2nrealloc.  The former is a little more concise and readable.
182         N.B. this sort of transformation is ok only when the base type is
183         unlikely ever to change to a multibyte type.
184         * src/du.c (show_date): Likewise.
185         * src/date.c (show_date): Likewise.
186         * src/od.c (dump_strings): Likewise.
187         * src/sort.c (fillbuf): Likewise.
188
189 2005-06-24  Jim Meyering  <jim@meyering.net>
190
191         * src/mv.c (usage): Clarify how --reply=no works.
192
193 2005-06-23  Paul Eggert  <eggert@cs.ucla.edu>
194
195         Address the following "du" issues:
196
197         - The option name "--last-time=TYPE" is different from the ls's option
198           "--time=TYPE" with a similar meaning.  I assume this wasn't intended.
199
200         - --time-style implies --time, but this is not true for "ls".  It's
201           better to be consistent.
202
203         - Since we don't have POSIX compatibility concerns, there's no need
204           for the "posix-" styles, or for support of styles with newlines, or
205           for the "locale" style, except for parsing the TIME_STYLE
206           environment variable.
207
208         - It's cleaner (and these days, no less efficient) to use functions
209           rather than macros when possible.
210
211         - struct duinfo doesn't need a 'valid' flag; you can simply use a time
212           stamp that is less than all valid time stamps.
213
214         - The code needs a bit of reformatting to fit the usual GNU style.
215
216         * NEWS: du's --last-time option is now --time.
217         * doc/coreutils.texi (ls invocation): Fix typo: --time=use is
218         equivalent to --time=atime, not --time=ctime.
219         (ls invocation, du invocation): Fix typo: --time-style=long-iso
220         is equivalent to a time style with a leading "+".
221         (du invocation): --last-time is now --time.
222         --time-style no longer implies --time.
223         The locale and posix- stuff now works only for TIME_STYLE, not
224         for --time-style.  Give equivalent format for --time-style=iso.
225         * src/du.c: Do not include hard-locale.h.
226         (struct duinfo): Remove 'valid' member.  All uses changed to use
227         negative nsec instead.
228         (DUIINFO_INI, DUINFO_SET, DUINFO_ADD): Remove.
229         (duinfo_init, duinfo_set, duinfo_add): New functions, taking the
230         role of the removed macros.
231         (opt_time): Renamed from opt_last_time.  All uses changed.
232         (TIME_OPTION): Renamed from LAST_TIME_OPTION.  All uses changed.
233         (long_options, usage): Rename --last-time to --time.
234         (locale_time_style): Remove.
235         (time_style_args, time_style_types, usage): Remove support for
236         --time-style=locale.
237         (show_date): Now returns void, since nobody looked at the result.
238         Assume FORMAT is not null.  An empty FORMAT now outputs an empty time.
239         Simplify nstrftime invocation.
240         (main): Put in ls compatibility workarounds only for TIME_STYLE,
241         not for --time-style.  Omit unnecessary space in iso time style.
242
243 2005-06-23  Jim Meyering  <jim@meyering.net>
244
245         * src/du.c (time_format): Add `const' attribute.
246
247         * src/date.c (show_date): Use puts rather than printf ("%s\n",.
248
249         * src/du.c (show_date): Rename local `time_format' so as not to
250         shadow the file-scoped global by that name.
251         (show_date): Add a FIXME comment.
252
253         * src/du.c: Include hard-locale.h and strftime.h.
254         (DUINFO_INI, DUINFO_SET, DUINFO_ADD):
255         Enclose body in `do {...} while (0)', not just `{...}'.
256         Adjust uses (add semicolons).
257         Adjust formatting, indentation.
258         (usage): Tweak formatting to maintain more or less constant indentation.
259
260 2005-06-14  William Brendling  <wbrendling@gmail.com>
261
262         * src/du.c: Add --last-time and --time-style options.
263
264 2005-06-22  Paul Eggert  <eggert@cs.ucla.edu>
265
266         * tests/umask-check: New file.
267         * tests/Makefile.am (EXTRA_DIST): Add umask-check.
268         * tests/mkdir/perm: Use umask-check.
269         * tests/cp/cp-parents: Likewise, instead of using chmod
270         as described below.  Problem reported by Kevin Mudrick.
271
272 2005-06-22  Jim Meyering  <jim@meyering.net>
273
274         Make rmdir produce diagnostics like this:
275         rmdir: /tmp: Permission denied
276         not like this:
277         rmdir: `/tmp': Permission denied
278
279         * src/rmdir.c: Include "quotearg.h", not "quote.h".
280         (remove_parents, main): Use quotearg_colon, not quote.
281
282 2005-06-22  Paul Eggert  <eggert@cs.ucla.edu>
283
284         * tests/cp/cp-parents: Use chmod to work around some hosts with
285         ACL problems.  Problem reported by Kevin Mudrick.
286
287 2005-06-21  Jim Meyering  <jim@meyering.net>
288
289         * tests/du/deref-args: Use --apparent-size to avoid the vagaries
290         of counting blocks.  Kevin Mudrick reported that this test would
291         fail on an nfs-mounted directory where attribute-caching is
292         turned on.
293
294 2005-06-19  Jim Meyering  <jim@meyering.net>
295
296         * src/tac.c (tac_mem, tac_stdin_to_mem): Remove #if-0'd functions.
297
298         * src/shred.c (usage): Use `file system', not `filesystem'.
299
300 2005-06-18  Jim Meyering  <jim@meyering.net>
301
302         * src/tr.c (unquote): Remove unnecessary `' quotes from a diagnostic.
303
304 2005-06-17  Jim Meyering  <jim@meyering.net>
305
306         * src/shred.c (usage): Clarify that shred works on an ext3 file
307         system as long as it's not in data=journal mode.
308         Tiny change by Mark Melahn.
309
310 2005-06-16  Paul Eggert  <eggert@cs.ucla.edu>
311
312         * src/hostid.c (main): Don't print fewer than 8 digits, or spurious
313         leading "f"s.  "f" problem reported by Tim Waugh.
314         * NEWS: Document this.
315
316 2005-06-16  Jim Meyering  <jim@meyering.net>
317
318         Don't embed `this'-style quotes in format strings.
319         * src/tr.c: Rather than this: error (..., "...`%s'...", arg);
320         do this:                      error (..., "...%s...", quote (arg));
321         * src/od.c, src/tr.c, src/csplit.c, src/date.c, src/hostname.c:
322         * src/join.c, src/ptx.c, src/seq.c, src/sort.c, src/split.c:
323         * src/split.c, src/tail.c: Likewise.
324
325         * src/sleep.c: Include "quote.h".  Remove hard-coded quotes, as above.
326         * src/nice.c, src/printf.c, src/fold.c, src/pr.c: Likewise.
327         * src/factor.c, src/cat.c, src/expr.c, src/stty.c: Likewise.
328
329         * src/mv.c: Finally remove support for --version-control=S (-V).
330         It was deprecated nearly 6 years ago and has been warning
331         users to switch to --backup=S since fileutils-4.0j.
332         * src/cp.c, src/install.c, src/ln.c: Likewise.
333
334 2005-06-15  Jim Meyering  <jim@meyering.net>
335
336         * src/install.c (main): Fix my typo: s/argv[optind]/file[i]/.
337         * tests/install/basic-1: Ensure that each `-d'-specified directory
338         is created.  Ensure that rel-named dirs are not created when
339         chdir($PWD) fails.
340
341         * tests/mkdir/p-3: Add a test for just-fixed bug in mkdir-p.c.
342
343 2005-06-14  Paul Eggert  <eggert@cs.ucla.edu>
344
345         Improve diagnostics for restore_cwd failure.
346         * src/install.c (main): Standardize on a diagnostic for
347         restore_cwd failure, and report errno.
348         (install_file_in_file_parents): Fail if restore_cwd fails and
349         one of the files is relative.  This fixes a bug (albeit unlikely).
350         * src/mkdir.c (create_parents): Remove static var (now local to 'main').
351         (main): Standardize on a diagnostic for restore_cwd failure,
352         and report errno.
353         Don't bother to check cwd_errno unless create_parents.
354         Use mkdir rather than make_dir; it's simpler.
355
356         * src/install.c (main): Adjust to new make_dir_parents convention.
357         * src/mkdir.c (main): Likewise.
358
359 2005-06-14  Jim Meyering  <jim@meyering.net>
360
361         * tests/mkdir/p-3: Ensure mkdir succeeds if the following argument
362         is an absolute directory name.
363
364         * Makefile.maint (my-distcheck): Add -Wall to the list of options that
365         are used with -Werror.  This target is not intended for general use.
366
367 2005-06-13  Jim Meyering  <jim@meyering.net>
368
369         * src/mkdir.c (main): Give a diagnostic for -- and skip -- each
370         relative directory name after make_dir_parents fails to restore
371         the working directory.  Before, `mkdir -p' could create directories
372         in the wrong place in unusual circumstances.
373         * src/install.c (main): Likewise.
374         (install_file_in_file_parents): Update make_dir_parents caller.
375         * tests/mkdir/p-3: New test for today's mkdir.c/mkdir-p.c bug fixes.
376         * tests/mkdir/Makefile.am (TESTS): Add p-3.
377
378 2005-06-10  Paul Eggert  <eggert@cs.ucla.edu>
379
380         Act on the Austin Group's response yesterday to XCU ERN 63; see
381         <http://www.opengroup.org/austin/docs/austin_260.txt>.
382         * NEWS: ls no longer outputs an extra space between mode and link count.
383         * doc/coreutils.texi: Remove the extra spaces in "ls -l" output.
384         * src/ls.c (any_has_acl): New var.
385         (clear_files): Clear it.
386         (gobble_file): Set it if a file has an ACL.
387         (print_long_format): Omit needless space unless some file has an ACL.
388
389 2005-06-10  Jim Meyering  <jim@meyering.net>
390
391         * src/system.h (VERIFY_W_TYPEOF): Add parentheses.
392
393 2005-06-02  Jim Meyering  <jim@meyering.net>
394
395         * src/sort.c (usage): Put `Ordering options:' line where it belongs.
396
397 2005-06-01  Paul Eggert  <eggert@cs.ucla.edu>
398
399         Use "file name" when talking about file names, instead of "filename"
400         or "path", as per the GNU coding standards.
401         * src/basename.c: Don't use "path" or "filename".
402         * src/copy.c: Likewise.
403         * src/copy.h: Likewise.
404         * src/cp-hash.c: Likewise.
405         * src/cp.c: Likewise.
406         * src/df.c: Likewise.
407         * src/install.c: Likewise.
408         * src/ls.c: Likewise.
409         * src/pinky.c: Likewise.
410         * src/pr.c: Likewise.
411         * src/pwd.c: Likewise.
412         * src/remove.c: Likewise.
413         * src/rmdir.c: Likewise.
414         * src/sort.c: Likewise.
415         * src/system.h: Likewise.
416         * src/tty.c: Likewise.
417         * src/who.c: Likewise.
418         * src/cp.c (parents_option): Renamed from flag_path.  All uses changed.
419         (make_dir_parents_private): Renamed from make_path_private.
420         All uses changed.
421         * src/cp.c (usage): Don't use "path" to describe a file name.
422         * src/readlink.c (usage): Likewise.
423         * src/rmdir.c (usage): Likewise.
424         * src/df.c: Don't include "path-concat.h"; not needed.
425         * src/install.c (install_file_in_file_parents): Renamed from
426         install_file_to_path.  All uses changed.
427         * src/ln.c (FILE_BASENAME_CONCAT): Renamed from PATH_BASENAME_CONCAT.
428         All uses changed.
429         * src/ls.c (make_link_name): Renamed from make_link_path.
430         All uses changed.
431         * src/pwd.c (struct file_name): Renamed from struct Path.
432         All uses changed.
433         (file_name_free): Renamed from path_free.  All uses changed.
434         (file_name_init): Renamed from path_init.  All uses changed.
435         (file_name_prepend): Renamed from path_prepend.  All uses changed.
436         * src/rmdir.c (remove_empty_parents): Renamed from empty_paths.
437         All uses changed.
438         (longopts): Add comment that --path is deprecated.
439
440 2005-05-31  Jim Meyering  <jim@meyering.net>
441
442         * src/copy.c (chown_privileges, chown_failure_ok): Mark as `extern'.
443         This is a crutch so that `make distcheck's sc_tight_scope rule
444         knows that they really are deliberately declared that way.
445
446 2005-05-30  Paul Eggert  <eggert@cs.ucla.edu>
447
448         Port to Solaris 10's rules for whether programs can chown files.
449         * src/copy.c [HAVE_PRIV_H]: Include <priv.h>.
450         (DO_CHOWN): Remove.  Replaced by chown_failure_ok.  All callers
451         changed.
452         (copy_internal): If chown failed, don't worry about what happened
453         to the mode bits; they can't have changed.
454         (chown_privileges, chown_failure_ok): New functions.
455         * src/copy.h: Add copyright notice.
456         (struct cp_options): Remove myeuid member.  Add chown_privileges
457         member.
458         (chown_privileges, chown_failure_ok): New function decls.
459         * src/cp.c (re_protect): Remove unnecessary call to geteuid.
460         Use chown_failure_ok rather than our own code.
461         * src/cp.c (cp_options_init): Use chown_privileges rather than geteuid.
462         * src/install.c (cp_option_init): Likewise.
463         * src/mv.c (cp_option_init): Likewise.
464
465 2005-05-29  Paul Eggert  <eggert@cs.ucla.edu>
466
467         * src/chgrp.c (getgrnam) [!defined _POSIX_VERSION]: Remove decl.
468         * src/chown-core.c (getgrnam, getgrgid) [!defined _POSIX_VERSION]:
469         Remove decls.
470         * src/cp.c (geteuid) [!defined _POSIX_VERSION]: Remove decl.
471         * src/id.c (getpwuid, getgrgid, getuid, getgid, geteuid, getegid)
472         [!defined _POSIX_VERSION]: Remove decls.
473         * src/install.c (getpwnam, getgrnam): Remove decl.
474         (getuid, getgid) [!defined _POSIX_VERSION]: Remove decls.
475         * src/md5sum.c (OPENOPTS, TEXT1T01, TEXTCNVT): Remove.
476         (digest_file): Use O_BINARY-using expr instead of OPENOPTS.
477         * src/system.h: Don't bother mentioning _POSIX_VERSION in comment.
478         * src/test.c: Include sys/param.h if it exists, not if _POSIX_VERSION
479         isn't defined.
480         Don't include <sys/file.h>; no longer needed.
481         (getegid, geteuid): Remove no-longer-necessary decls.
482
483         * src/pathchk.c (_POSIX_PATH_MAX) [!defined _POSIX_PATH_MAX]:
484         Define to 256, not 255, as per modern POSIX.
485
486 2005-05-27  Paul Eggert  <eggert@cs.ucla.edu>
487
488         * NEWS: dd seek=N now conforms to POSIX if the output isn't seekable.
489         * src/dd.c (skip): Return the number of records that were not
490         skipped due to encountering EOF.
491         (dd_copy): If the file wasn't seekable and EOF was encountered,
492         write zeros past EOF until the desired offset is reached.
493
494         * NEWS: expr and test now correctly compare integers of unlimited size.
495         (Also, correct a comment that claimed that expr detects integer
496         overflow; it does so only when converting from strings.)
497         * src/expr.c: Include strnumcmp.h, xstrtol.h.
498         (looks_like_integer): New function.
499         (toarith): Use it.  Also, use xstrtoimax rather than rolling our
500         own diagnostics.
501         (eval2): Don't look for trouble if !evaluate; this simplifies things.
502         Compare numbers using string comparison, so that overflow is
503         not possible.
504         * src/sort.c: Refactor so that others can use large-integer
505         comparison functions.
506         Include "strnumcmp.h".
507         (NEGATION_SIGN, NUMERIC_ZERO, fraccompare):
508         Remove; moved to strnumcmp.
509         (decimal_point): Now int, to simplify converison overhead with
510         new API.  All uses changed.
511         (thousands_sep): Now -1 if there isn't one, as per new API.
512         All uses changed.
513         (numcompare): Move contents to strnumcmp module, except for
514         skipping blanks.
515         * src/test.c: Include inttostr.h, strnumcmp.h.
516         (whitespace, digit, digit_value, integer_expected_error): Remove.
517         (is_int): Remove; replaced by...
518         (find_int): New function.
519         (binary_operator): Don't let integers overflow in comparisons;
520         return the correct answer instead.  Simplify the code.
521         (unary_operator): Convert the integer ourself, since find_int
522         no longer does so.
523         * tests/expr/basic (bigcmp): New test.
524         * tests/test/Test.pm (eq-6, gt-5, lt-5): New tests.
525
526 2005-05-26  Paul Eggert  <eggert@cs.ucla.edu>
527
528         * NEWS: nohup now redirects a tty stdin to an unreadable fd
529         instead of closing it.
530         * doc/coreutils.texi (nohup invocation): Document this.
531         * src/nohup.c (main): Implement this.
532
533 2005-05-26  Jim Meyering  <jim@meyering.net>
534
535         * src/expr.c (toarith): Fix a sign error introduced on 2005-01-14.
536         Reported by David Alan Gilbert.
537         * tests/expr/basic: Add tests using arithmetic on negative integers.
538
539 2005-05-19  Jim Meyering  <jim@meyering.net>
540
541         * src/remove.c (AD_mark_helper, AD_mark_current_as_unremovable):
542         Remove inaccurate-but-harmless `const' attributes.
543
544         * src/join.c (decode_field_spec): Add an abort after
545         `error (EXIT_FAILURE, ...' to avoid a gcc warning in caller,
546         about variables being used uninitialized.
547
548 2005-05-18  Paul Eggert  <eggert@cs.ucla.edu>
549
550         * configure.ac: Add copyright notice.  gl_LIB_CHECK -> cu_LIB_CHECK.
551         * src/Makefile.am: Add copyright notice.
552         (factor_LDADD): Remove, as factor no longer needs sqrt.
553         * src/hostname.c: Remove test for HAVE_LIMITS_H; we can assume
554         it's always true now.
555
556 2005-05-16  Paul Eggert  <eggert@cs.ucla.edu>
557
558         Fix Cygwin porting problem reported by Eric Blake.
559         * src/remove.c (DT_IS_DIR): Remove.
560         (DT_IS_KNOWN, DT_MUST_BE): New macros.
561         (remove_entry): Use them.
562
563 2005-05-14  Paul Eggert  <eggert@cs.ucla.edu>
564
565         * src/remove.c: Include unlinkdir.h.
566         (UNLINK_CAN_UNLINK_DIRS): Remove.
567         (remove_entry): Use cannot_unlink_dirs () rather than
568         UNLINK_CAN_UNLINK_DIRS.
569
570 2005-05-14  Jim Meyering  <jim@meyering.net>
571
572         Update FSF postal mail address.
573         * Makefile.maint, Makefile.cfg, gnupload
574         * src/basename.c, src/cat.c, src/checksum.h, src/chgrp.c
575         * src/chmod.c, src/chown-core.c, src/chown-core.h, src/chown.c
576         * src/chroot.c, src/cksum.c, src/comm.c, src/copy.c, src/copy.h
577         * src/cp-hash.c, src/cp-hash.h, src/cp.c, src/csplit.c, src/cut.c
578         * src/date.c, src/dcgen, src/dd.c, src/df.c, src/dircolors.c
579         * src/dirname.c, src/du.c, src/echo.c, src/env.c, src/expand.c
580         * src/expr.c, src/factor.c, src/fmt.c, src/fold.c, src/fs.h
581         * src/groups.sh, src/head.c, src/hostid.c, src/hostname.c, src/id.c
582         * src/install.c, src/join.c, src/kill.c, src/lbracket.c, src/link.c
583         * src/ln.c, src/logname.c, src/ls-dir.c, src/ls-ls.c, src/ls-vdir.c
584         * src/ls.c, src/ls.h, src/md5.c, src/md5sum.c, src/mkdir.c
585         * src/mkfifo.c, src/mknod.c, src/mv.c, src/nice.c, src/nl.c
586         * src/nohup.c, src/od.c, src/paste.c, src/pathchk.c, src/pinky.c
587         * src/pr.c, src/printenv.c, src/printf.c, src/ptx.c, src/pwd.c
588         * src/readlink.c, src/remove.c, src/remove.h, src/rm.c, src/rmdir.c
589         * src/seq.c, src/setuidgid.c, src/sha1sum.c, src/shred.c
590         * src/sleep.c, src/sort.c, src/split.c, src/stat.c, src/stty.c
591         * src/su.c, src/sum.c, src/sync.c, src/system.h, src/tac-pipe.c
592         * src/tac.c, src/tail.c, src/tee.c, src/test.c, src/touch.c
593         * src/tr.c, src/true.c, src/tsort.c, src/tty.c, src/uname.c
594         * src/unexpand.c, src/uniq.c, src/unlink.c, src/uptime.c
595         * src/users.c, src/wc.c, src/who.c, src/whoami.c, src/yes.c
596
597 2005-05-13  Jim Meyering  <jim@meyering.net>
598
599         * NEWS: `rm -r' now removes all of the files it should, even on
600         systems with a buggy readdir affecting file systems inaccessible
601         at configure time.
602
603         In some unusual circumstances `rm -r' would fail to remove --
604         or even consider -- all entries in a directory with more than 254
605         (SunOS) or 338 (Darwin) entries.  This could cause trouble even on
606         other types of systems when using an affected file system via e.g.,
607         NFS.  The underlying cause was a bug in readdir on those systems.
608         Coreutils-5.2.1 and earlier used a configure-time test designed
609         to detect precisely those problem systems, but it would detect
610         the problem and enable remove.c's work-around code only when its
611         configure-time test was run on a losing file system.  Obviously,
612         it couldn't detect a problem if the offending file system wasn't
613         tested or even mounted at coreutils configure time.  Now, rm itself
614         performs a minimal-cost run-time test to detect the problem.
615
616         * src/remove.c (CONSECUTIVE_READDIR_UNLINK_THRESHOLD): Define.
617         (remove_cwd_entries):  When readdir returns NULL for a directory from
618         which we've removed more than CONSECUTIVE_READDIR_UNLINK_THRESHOLD
619         entries, call rewinddir and then resume the readdir/unlink loop.
620         (UNLINK_CAN_UNLINK_DIRS): Rename from ROOT_CAN_UNLINK_DIRS.
621
622 2005-05-12  Paul Eggert  <eggert@cs.ucla.edu>
623
624         * NEWS: nohup now closes stdin if it is a terminal, unless
625         POSIXLY_CORRECT is set.  This fixes a glitch noted by Wayne Pollock in
626         <https://www.opengroup.org/sophocles/show_mail.tpl?
627         source=L&listname=austin-group-l&id=8341>.
628         * doc/coreutils.texi (nohup invocation): Document this.
629         * src/nohup.c (main): Implement this.
630
631 2005-05-12  Jim Meyering  <jim@meyering.net>
632
633         * src/date.c: Assume `free (NULL)' works.
634         * src/dd.c: Likewise.
635         * src/df.c:Likewise.
636         * src/dircolors.c:Likewise.
637         * src/head.c: Likewise.
638         * src/ls.c: Likewise.
639         * src/md5sum.c: Likewise.
640         * src/pr.c: Likewise.
641         * src/sort.c: Likewise.
642
643 2005-05-10  Jim Meyering  <jim@meyering.net>
644
645         * tests/touch/not-owner: Skip this test if the user running it
646         owns `/' or has write access to it.
647
648         * src/copy.c (abandon_move): Remove erroneous UNWRITABLE check.
649         This makes `mv -i --reply=no f1 f2' work as expected (in not
650         performing the move operation).  But note that specifying `-i'
651         after `--reply=no' does *not* work.
652         Tiny patch from Vlada Macek.
653         Correct a comment.
654         * tests/mv/reply-no: New file.  Test for the above fix.
655         * tests/mv/Makefile.am (TESTS): Add reply-no.
656
657         * tests/ls-2/tests: Don't print PATH to stderr.
658
659 2005-05-08  Paul Eggert  <eggert@cs.ucla.edu>
660
661         * NEWS: cp, ln, mv, rm no longer discard white space when intepreting
662         responses.
663
664 2005-05-06  Paul Eggert  <eggert@cs.ucla.edu>
665
666         * NEWS: dd has new iflag= and oflag= flags "binary" and "text".
667         * src/dd.c (flags, usage): Add support for "binary" and "text".
668
669 2005-05-04  Paul Eggert  <eggert@cs.ucla.edu>
670
671         * NEWS: chmod -w now complains if it differs from chmod a-w.
672         * src/chmod.c: Include quotearg.h.
673         (diagnose_surprises): New var.
674         (process_file): Diagnose surprises.  Simplify the logic a bit,
675         while we're at it.
676         (main): Prepare to diagnose surprises.  Remove useless code for
677         '-' option.
678         * tests/chmod/Makefile.am (TESTS): Add umask-x.
679         * tests/chmod/umask-x: New file.
680
681 2005-05-02  Paul Eggert  <eggert@cs.ucla.edu>
682
683         * NEWS: ls --indicator-style=directory renamed to ls
684         --indicator-style=slash, to avoid confusion with ls --directory.
685         * src/ls.c (usage): Likewise.
686         (slash): Renamed from directory_only.  All uses changed.
687
688 2005-05-01  Paul Eggert  <eggert@cs.ucla.edu>
689
690         * NEWS: "chmod +1 foo" is now diagnosed.
691
692 2005-04-29  Paul Eggert  <eggert@cs.ucla.edu>
693
694         * NEWS: ls -p now marks only directories.  New option
695         --indicator-style=directory equivalent to -p.
696         * doc/coreutils.texi (ls invocation): Document this.
697         Also, mention ">" is for doors.
698         * src/ls.c (enum indicator_style): New constant directory_only,
699         for -p.
700         (indicator_style_args, indicator_style_types): Set it appropriately.
701         (decode_switches, gobble_file, print_type_indicator):
702         (length_of_file_name_and_frills):
703         Implement the change described in NEWS.
704         (decode_switches): Quote ">", too.
705         (usage): Update to match the new behavior.  Describe ">".
706         * tests/ls/file-type: Test for new behavior.  Omit -1 option.
707         The "ls --color" test wasn't being checked; add a check for
708         "ls --color=auto" instead.
709
710         * tests/head/Test.pm: Don't set _POSIX2_VERSION; no longer needed.
711         * tests/misc/split-fail: Likewise.
712         * tests/pr/Test.pm: Likewise.
713         * tests/sort/Test.pm: Fix comment to match new behavior of "sort".
714         * tests/tail/Test.pm (tv): Rename tests from obs to obs-plus
715         if they use file names starting with +.
716         (test_vector): Don't set _POSIX2_VERSION if obs but not obs-plus.
717         * tests/uniq/Test.pm (tv, test_vector): Likewise.
718
719         The following was partly derived from a tiny change by Eric Blake:
720         * tests/misc/nice: Don't use 'set -'.  It's not portable to strict
721         POSIX 1003.1-2001 hosts.  Also, don't set _POSIX2_VERSION.
722         * tests/mkdir/perm: Don't use 'set -'.  Simplify test construction.
723         Work even if the underyling system attaches ACLs to new dirs.
724         * tests/mv/part-hardlink: Don't use 'set -'.
725         * tests/stty/row-col-1: Don't use 'set -'.
726
727 2005-04-28  Paul Eggert  <eggert@cs.ucla.edu>
728
729         * NEWS: Document fixes described below.
730         * src/chmod.c (change, umask_value): New static vars.
731         (reference_file): Move this static var to inside "main".
732         (process_file, process_files): Remove CHANGES arg; now taken from
733         static var.  All uses changed.
734         (usage): Fix incorrect description of MODE operand.
735         (main): For invalid mode usages, output a brief usage message.
736         Adjust to new modechange API.
737         * install.c (main): Adjust to new modechange API.
738         Also, free the mode_change object when done.
739         * mkdir.c (main): Likewise.
740         * mkfifo.c (main): Likewise.
741         * mknod.c (main): Likewise.
742         * tests/chmod/equal-X: Check for =xX bug.
743         * tests/chmod/equals: Check for =u bug.
744         * tests/chmod/usage: Check for u+gr and ug,+x bugs.
745
746 2005-04-26  Paul Eggert  <eggert@cs.ucla.edu>
747
748         Restore support for usages like "head -1" and "tail -1",
749         even when conforming to POSIX 1003.1-2001.
750         Fix bug with "POSIXLY_CORRECT=1 fold file -3".
751         join now supports a NUL field separator, e.g., "join -t '\0'".
752         join now detects and reports incompatible options, e.g.,
753         "join -t x -t y",
754         * NEWS: Document this.
755         * src/date.c: Remove posixver.h and its uses.
756         (COMMON_SHORT_OPTIONS): Remove.
757         (short_options): New constant.
758         (short_options, usage): -I now always takes an optional arg.
759         * src/expand.c: Remove posixver.h and its uses.
760         (shortopts): New constant.  -DIGIT now always takes an optional arg.
761         (main): Revamp parsing of -DIGIT to let parse_tab_stops handle it.
762         Don't complain about -DIGIT.
763         * src/fold.c: Remove posixver.h and its uses.
764         (shortopts): New constant.  -DIGIT now always takes an optional arg.
765         (main): Don't preprocess arg list; that was buggy.  Use method
766         similar to expand.
767         * src/head.c: Remove posixver.h and its uses.
768         (header_mode_option): Remove.
769         (main): Don't complain about obsolete -NUM args.
770         * src/join.c: Remove posixver.h and its uses.
771         (obsolete_usage): Remove.
772         (join_field_1, join_field_2): Initialize to SIZE_MAX to indicate
773         they haven't been set yet.
774         (tab): Now int, not char.  Initialize to -1 to indicate white space
775         separates columns, so that we can use NUL as a separator.
776         All uses changed.
777         (OBSOLETE_LONG_OPTIONS, get_option): Remove.
778         (string_to_join_field): Remove ERR_MSG_FMT arg; a single format
779         suffices.  Use xstrtoul for sizes; it suffices.
780         (decode_field_spec): Report an error and exit on failure.  Return void,
781         not bool.
782         (add_field_list): Likewise.
783         (set_join_field): New function.
784         (enum operand_status): New enum.
785         (add_file_name): New args OPERAND_STATUS, JOPTION_COUNT,
786         PREV_OPTC_STATUS, OPTC_STATUS to handle the bewildering array of
787         possibilities with obsolete option parsing.
788         (main): Use it.  Do not depend on POSIX version.
789         Check for conflicting options.  Parse obsolete options -j1 and -j2
790         so that it is a pure extension to POSIX 1003.1-2001.
791         Allow '-t\0' to specify a NUL tab, stealing the code from 'sort'.
792         * src/nice.c: Remove posixver.h and its uses.
793         (main): Always support -NUM option.
794         * src/od.c: Remove posixver.h and its uses.
795         (short_options): New constant, which always supports -w[num].
796         (COMMON_SHORT_OPTIONS): Remove.
797         * src/pr.c: Remove posixver.h and its uses.
798         (short_options): New constant, which always supports -S[string].
799         (COMMON_SHORT_OPTIONS): Remove.
800         * src/sort.c: Remove posixver.h and its uses.
801         (short_options): New constant, which always supports -y arg.
802         (COMMON_SHORT_OPTIONS): Remove.
803         (main): Redo workaround for Solaris compatibility with -y.
804         This change isn't visible to the user; it just cleans up the
805         code so that we don't need posixver.h.
806         * src/split.c: Remove posixver.h and its uses.
807         (main): Don't complain about -NUM option.
808         * src/tail.c (parse_obsolete_option): Don't complain about -NUM.
809         * src/unexpand.c: Remove posixver.h and its uses.
810         (main): Don't complain about -TAB.
811         * src/uniq.c (main): Don't complain about -NUM.
812
813 2005-04-22  Paul Eggert  <eggert@cs.ucla.edu>
814
815         * src/nohup.c (main): If getopt fails, exit with status 127,
816         not status 1.  POSIX requires this.
817         * NEWS: Document this.
818
819         * src/nice.c (main): Report proper program name when getopt finds
820         trouble.  Problem reported by Behdad Esfahbod.
821
822         * NEWS: Fix bug with "mkdir -m =+x dir"; the umask was being ignored
823         when the "+x" was being evaluated.
824         * mkdir.c (main): Compile mode with MODE_MASK_ALL and initial umask.
825         * mkfifo.c (main): Likewise.
826         * mknod.c (main): Likewise.
827         * tests/mkdir/perm: Test for the above bug.
828
829 2005-04-20  Paul Eggert  <eggert@cs.ucla.edu>
830
831         Port test cases to Microsoft-Windows-related environments,
832         following suggestions from Eric Blake.
833         * tests/install/Makefile.am (TESTS_ENVIRONMENT): Add EXEEXT.
834         * tests/install/basic-1: Undo previous change.
835         (dd, dd2): New vars, which use $EXEEXT.  All uses of dd and dd2 changed.
836         * tests/install/trap: Undo previous change.
837         (sig): New var.  Use it insted of "trap '' CHLD".
838         Append $EXEEXT to executable name.
839
840         "fetish" -> "coreutils" in more places.
841         * tests/Coreutils.pm: Renamed from tests/Fetish.pm.
842         (package Coreutils): Renamed from package Fetish.  All uses changed.
843         * tests/Makefile.am (EXTRA_DIST): Add Coreutils.pm and
844         remove Fetish.pm.
845
846 2005-04-19  Paul Eggert  <eggert@cs.ucla.edu>
847
848         * tests/mv/setup (dot_mount_point): Use stat -L, in case the
849         directory is actually a symbolic link.  Problem reported by
850         Eric Blake.
851
852         * tests/mv/mv-special-1: Use test -p to test for fifos, rather
853         than the (incorrect) test -f and the (inadequate) ls.  ls is
854         inadequate because on some hosts a buggy mv will create a file of
855         the wrong type (problem reported by Eric Blake).  Skip this test
856         if test -p doesn't work.
857
858         * tests/chmod/setgid: Use numeric group ids, not symbolic group names,
859         since the latter can have shell metacharacters in them (e.g., spaces).
860         This follows up to the 2005-01-17 patch, which missed this occurrence.
861
862 2005-04-18  Paul Eggert  <eggert@cs.ucla.edu>
863
864         "fetish" -> "coreutils" in several places.
865         * Makefile.cfg (ftp): Remove fetish.sf.net.
866         * Makefile.maint (emit_upload_commands): Likewise.
867         * src/Makefile.am (LDADD, $(PROGRAMS)): fetish -> coreutils.
868         * tests/group-names (COREUTILS_GROUPS): Renamed from FETISH_GROUPS.
869         * tests/chmod/setgid (FETISH_GROUP): Renamed from COREUTILS_GROUP.
870
871         * tests/install/basic-1: Use "cat", not "test", to test for
872         ../../src/dd.  Problem reported by Eric Blake.
873
874 2005-04-18  Jim Meyering  <jim@meyering.net>
875
876         * src/dd.c: Don't include stat-macros.h directly.  system.h does that.
877
878 2005-04-17  Paul Eggert  <eggert@cs.ucla.edu>
879
880         Work around a couple of "make check" failures reported for Cygwin
881         and ash by Eric Blake.
882         * tests/install/basic-1: Skip this test if ../../src/dd isn't readable.
883         * tests/install/trap: Skip this test if "trap '' CHLD" doesn't work.
884
885 2005-04-16  Jim Meyering  <jim@meyering.net>
886
887         * src/dd.c (S_TYPEISSHM): Remove definition.
888         Get the definition by including "stat-macros.h", instead.
889
890 2005-04-14  Paul Eggert  <eggert@cs.ucla.edu>
891
892         Fix test suite problems reported by Eric Blake on Cygwin.
893         * tests/mv/mv-special-1: Ignore chatter about when files are removed,
894         since POSIX doesn't require rename to fail across file systems.
895         * tests/mv/setup (dot_mount_point): Use stat rather than df, as
896         it's more reliable.
897         (other_partition_tmpdir): Remove df from name as that would be
898         misleading now.
899
900 2005-04-14  Jim Meyering  <jim@meyering.net>
901
902         * src/chown-core.c: Correct typo, fchmod -> fchown, in a comment.
903
904 2005-04-12  Paul Eggert  <eggert@cs.ucla.edu>
905
906         * src/ls.c (usage): "uid" -> "user ID".
907
908 2005-04-12  Jim Meyering  <jim@meyering.net>
909
910         * src/tsort.c (tsort): Use "%s" as the format string,
911         rather than a diagnostic or a file name.
912
913         * src/comm.c (compare_files): Remove declaration of unused local.
914
915         * src/chown-core.c (chopt_free): Mark parameter as unused.
916
917 2005-04-11  Paul Eggert  <eggert@cs.ucla.edu>
918
919         * man/chown.x: Reword to match user manual.
920         * man/id.x: Likewise.
921         * src/setuidgid.c (usage): Use "user ID", not "UID", and similarly
922         for "group ID".
923         * src/whoami.c (usage, main): Likewise.
924
925         Add bulletproofing for cases where stdin, stdout, or stderr are closed.
926         * src/comm.c: Include stdio-safer.h.
927         (compare_files): Exit right away on I/O error rather than continuing
928         and producing confusing output and error messages.
929         Return void, not int; all callers changed.
930         Use fopen_safer to avoid confusion with file descriptors.
931         * src/copy.c: Include unistd-safer.h.
932         (copy_reg): Use fd_safer.
933         * src/csplit.c: Include stdio-safer.h.
934         (input_desc): Remove unnecessary static initialization.
935         (set_input_file): Use STDIN_FILENO, not 0.
936         (create_output_file): Use fopen_safer.
937         * src/dircolors.c (dc_parse_file): Don't assume fopen does not
938         return stdin.
939         * src/head.c (head_file): Don't assume open does not return 0.
940         * src/join.c: Include stdio-safer.h.
941         (main): Use fopen_safer.  Simplify the resulting code.
942         * src/md5sum.c (digest_file, digest_check):
943         Don't assume that fopen does not return stdin.
944         * src/nohup.c: Include unistd-safer.h.
945         (main): Don't dup stderr to stdin or stdout by mistake.
946         * src/od.c (check_and_close): Don't assume fopen does not return stdin.
947         * src/paste.c (paste_serial): Likewise.
948         * src/pr.c: Include stdio-safer.h.
949         (open_file): Use fopen_safer.
950         (close_file): Don't assume fopen does not return stdin.
951         * src/ptx.c (main): Don't assume fopen returns stdout after closing
952         stdout.  Use freopen instead.
953         * src/shred.c: Include unistd-safer.h.
954         (wipename): Use fd_safer on directory file descriptor.
955         (wipefile): Remove special case for /dev/fd/* on older hosts.
956         It didn't work in general, and wasn't documented.
957         Use fd_safer.
958         * src/sort.c: Include unistd-safer.h.
959         (create_temp_file): Use fd_safer.
960         (xfclose): Don't assume fileno (stdin) == STDIN_FILENO, etc.
961         * src/split.c: Include unistd-safer.h.
962         (cwrite): Use fd_safer.  Replace mystery constant 0666 with symbolic
963         version, as POSIX requires.
964         * src/sum.c (bsd_sum_file, sysv_sym_file):
965         Use same pattern as elsewhere for checking for stdin.
966         * src/tac.c: Include unistd-safer.h.
967         (copy_to_temp): Use fd_safer.
968         (tac_file): Don't assume fopen cannot return stdin.
969         * src/tail.c: Include unistd-safer.h rather than fcntl-safer.h.
970         (recheck, tail_file): Use fd_safer rather than open_safer.
971         * src/tee.c: Include stdio-safer.h.
972         (tee): Use fopen_safer.
973         * src/touch.c: Include unistd-safer.h.
974         (touch): Use fd_safer.
975         * src/tsort.c (have_read_stdin): Remove; no longer needed.  All uses
976         removed.
977         (tsort): Do not assume fopen can't return stdin.
978         Close stdin before returning.  All uses changed.
979         * src/unexpand.c (next_file): Don't assume fopen cannot return stdin.
980         * src/uniq.c: Include stdio_safer.h.
981         (check_file): Don't assume fopen cannot return stdin or stdout.
982
983 2005-04-09  Jim Meyering  <jim@meyering.net>
984
985         * src/dd.c (quit): Define with ATTRIBUTE_NORETURN.
986
987         Now that close_stdout closes standard output unconditionally,
988         these workarounds for dd and cat are no longer necessary.
989         * src/dd.c (close_stdout_wrapper): Remove function.
990         (main): Call atexit with close_stdout, instead.
991         * src/cat.c (close_stdout_wrapper): Likewise.
992         Don't close STDOUT_FILENO explicitly; close_stdout does it.
993
994         * src/system.h (__attribute__): Readability nit:
995         Change this:
996         #  define __attribute__(x)
997         to this:
998         #  define __attribute__(x) /* empty */
999
1000 2005-04-09  Jim Meyering  <jim@meyering.net>
1001
1002         * src/rm.c (usage): Mention that --recursive removes listed
1003         directories too, not just their contents.
1004         Say that by default, rm does not remove directories.
1005
1006         * src/pr.c: Don't include "timespec.h".  system.h does that.
1007         * Makefile.maint (sc_system_h_headers): Propagate exit status
1008         through trap.
1009
1010 2005-04-08  Paul Eggert  <eggert@cs.ucla.edu>
1011
1012         * NEWS: Document that dd no longer treats QUIT or PIPE specially,
1013         and when conforming to POSIX no longer treats USR1 specially.
1014         Document that dd no longer dumps core when handling signals.
1015         * src/system.h (RETSIGTYPE): Remove; no longer needed.  All uses
1016         replaced with void.
1017         * src/csplit.c (SA_NOCLDSTOP): Define to 0 if not defined.
1018         All uses changed.
1019         (siginterrupt) [!HAVE_SIGINTERRUPT]: New macro.
1020         (delete_all_files): New arg IN_SIGNAL_HANDLER, to avoid undefined
1021         behavior when called from a signal handler.  All uses changed.
1022         (main) [!defined SA_NOCLDSTOP]:
1023         Use siginterrupt to specify that system calls should be interrupted.
1024         * src/dd.c: Do not include safe-read.h or full-write.h; no longer needed.
1025         (process_signals): Add forward decl.
1026         (SA_NOCLDSTOP, sigprocmask, sigset_t) [!defined SA_NOCLDSTOP]:
1027         New macros.
1028         (siginterrupt) [! HAVE_SIGINTERRUPT]: New macro.
1029         (SA_NODEFER) [!defined SA_NODEFER]: New macro.
1030         (SA_RESETHAND) [!defined SA_RESETHAND]: New macro.
1031         (caught_signals, interrupt_signal, info_signal_count, catch_siginfo):
1032         New vars.
1033         (usage): Mention -USR1 versus -INFO.
1034         (cleanup): Don't invoke print_stats; the caller must do it now.
1035         All callers changed.
1036         (quit): Process signals just before exiting.
1037         (interrupt_handler): Simply record the signal and return.
1038         (siginfo_handler): Simply increment the signal counter and return.
1039         (install_handler): Remove, replacing with:
1040         (install_signal_handlers, process_signals, iread, iwrite):
1041         New functions.  All callers to safe_read and full_write replaced
1042         by iread and iwrite.  All callers to install_handler replaced by
1043         install_handlers.
1044         * src/ls.c (SA_NOCLDSTOP): Define to 0 if not defined.
1045         All uses changed.
1046         (siginterrupt) [! HAVE_SIGINTERRUPT]: New macro.
1047         (main) [! SA_NOCLDSTOP]: Use it.
1048         * src/shred.c: Remove all uses of signals; modern hosts have
1049         /dev/random and don't need this gorp.
1050         Do not include signal.h.
1051         (env, sigill_handler, isaac_seed_machdep): Remove.  All uses removed.
1052         * src/sort.c (SA_NOCLDSTOP): Define to 0 if not defined.
1053         All uses changed.
1054         (siginterrupt) [! HAVE_SIGINTERRUPT]: New macro.
1055         (main) [! SA_NOCLDSTOP]: Use it.
1056
1057         * src/dd.c: Do not include inttostr.h, no longer needed.
1058         (print_stats, main): Rewrite and simplify formats to use PRIuMAX
1059         instead of umaxtostr.
1060         (print_stats): Work even in languages that have special
1061         forms for two of things, for r_truncate and w_bytes.  We can't
1062         fix delta_s in this way, since ngettext doesn't support floating-point.
1063         (main): Rewrite to avoid casts.
1064
1065 2005-04-07  Jim Meyering  <jim@meyering.net>
1066
1067         Placate gcc-4's -Wuninitialized.
1068         * src/md5sum.c (digest_check) [lint]: Initialize hex_digest to NULL.
1069         * src/test.c (binary_operator) [lint]: Initialize lt and rt to 0.
1070
1071         * src/test.c (is_int, age_of, binop): Declare `char *' parameters to
1072         be `const'.
1073         (binop): Move function definition to precede first use so we can...
1074         (binop): ...remove prototype.
1075
1076 2005-04-05  Paul Eggert  <eggert@cs.ucla.edu>
1077
1078         * man/Makefile.am (.x.1): Remove "COMMAND.td/" from examples.
1079         * src/basename.c (usage): Add examples.
1080         * src/cat.c (usage): Likewise.
1081         * src/chgrp.c (usage): Likewise.
1082         * src/chown.c (usage): Likewise.
1083         * src/dirname.c (usage): Likewise.
1084
1085 2005-04-05  Jim Meyering  <jim@meyering.net>
1086
1087         * src/nice.c (usage): Mention that some shells provide a
1088         built-in function by the same name.
1089         * src/nohup.c (usage): Likewise.
1090         * src/printenv.c (usage):Likewise.
1091
1092 2005-04-04  Dmitry V. Levin  <ldv@altlinux.org>
1093
1094         * src/tee.c (tee): When closing files, do not close stdout,
1095         leave this job to close_stdout() instead.
1096         * configure.ac (AC_CONFIG_FILES): Add tests/tee/Makefile.
1097         * tests/Makefile.am (SUBDIRS): Add tee.
1098         * tests/tee/Makefile.am: New file.
1099         * tests/tee/.cvsignore: Likewise.
1100         * tests/tee/{basic,dash}: New tee tests.
1101
1102 2005-04-04  Jim Meyering  <jim@meyering.net>
1103
1104         * src/echo.c (usage): Mention that some shells provide a
1105         built-in function by the same name.
1106         * src/kill.c (usage): Likewise
1107         * src/printf.c (usage): Likewise.
1108         * src/pwd.c (usage): Likewise.
1109         * src/stat.c (usage): Likewise.
1110         * src/test.c (usage): Likewise.
1111         * src/true.c (usage):
1112         * src/system.h (USAGE_BUILTIN_WARNING): New macro.
1113
1114         * man/echo.x: Remove `DESCRIPTION' section, now that --help includes it.
1115         * man/printf.x: Likewise.
1116         * man/pwd.x: Likewise.
1117
1118 2005-04-03  Jim Meyering  <jim@meyering.net>
1119
1120         * src/pr.c (main): Fix off-by-one error.
1121         pr -$(perl -e 'print "0"x63 . 1') would write one byte beyond the
1122         end of a malloc'd buffer.
1123
1124 2005-04-01  Jim Meyering  <jim@meyering.net>
1125
1126         * src/pr.c (main): Free column_count_string when done with it.
1127
1128         Don't let pr treat +1:-1 like +1:18446744073709551615.
1129         * src/pr.c (strtoumax): Remove declaration.
1130         (first_last_page): Use xstrtoumax in place of strtoumax,
1131         so we don't interpret a negative page number (e.g., in an option
1132         like --pages=1:-1) as valid.
1133         * tests/pr/Test.pm (neg-page): Add a test for this.
1134
1135 2005-03-30  Paul Eggert  <eggert@cs.ucla.edu>
1136
1137         * src/pinky.c (short_pinky): Adjust to read_utmp signature change.
1138         * src/uptime.c (uptime): New arg OPTIONS.  All uses changed.
1139         * src/users.c (users): Likewise.
1140         * src/who.c (who): Likewise.
1141         * src/uptime.c (main): Check PIDs when invoked with zero arguments.
1142         * src/users.c (main): Likewise.
1143         * src/who.c (main): Likewise.  Also with two arguments.
1144         Omit duplicate code in 2-arg case.
1145         (UT_PID): Moved to ../lib/readutmp.h.
1146
1147 2005-03-29  Jim Meyering  <jim@meyering.net>
1148
1149         * src/system.h (ptr_align): Declare `ptr' parameter to be a
1150         `const' pointer, since this function never writes through it.
1151
1152         * src/uname.c: Indent cpp directives to reflect nesting.
1153
1154 2005-03-28  Jim Meyering  <jim@meyering.net>
1155
1156         * src/seq.c (get_width_format) [HAVE_RINT && HAVE_MODF && HAVE_FLOOR]:
1157         Add `void' to make this an ANSI-style function declaration.
1158         * src/remove.c (ds_init): Likewise.
1159         * src/pr.c (print_sep_string): Likewise.
1160
1161         * src/stty.c (speeds): Declare this array to be static.
1162         * src/Makefile.am (sc_tight_scope): Adjust to catch any
1163         new declarations like that of stty.c's `speeds'.
1164
1165         * src/system.h (GETOPT_HELP_OPTION_DECL): Use NULL, not `0'.
1166         (GETOPT_VERSION_OPTION_DECL): Likewise.
1167         * src/chown.c (long_options): Likewise.
1168         * src/chgrp.c (long_options): Likewise.
1169         * src/chmod.c (long_options): Likewise.
1170         * src/cp.c (sparse_type_string, reply_args, decode_preserve_arg):
1171         Likewise.
1172         * src/chown-core.c (chopt_init): Likewise.
1173         * src/comm.c (long_options): Likewise.
1174         * src/copy.c (copy_reg): Likewise.
1175         * src/csplit.c (extract_regexp): Likewise.
1176         * src/cut.c (longopts): Likewise.
1177         * src/date.c (time_spec_string): Likewise.
1178         * src/df.c (find_mount_point, show_point): Likewise.
1179         * src/expr.c (docolon): Likewise.
1180         * src/fmt.c (long_options): Likewise.
1181         * src/ls.c (time_style_args, indicator_style_args, long_options)
1182         (format_args, sort_args, time_args, decode_switches)
1183         (gobble_file): Likewise.
1184         * src/md5sum.c (long_options): Likewise.
1185         * src/mv.c (reply_args): Likewise.
1186         * src/paste.c (longopts): Likewise.
1187         * src/pinky.c (print_entry): Likewise.
1188         * src/pr.c (long_options): Likewise.
1189         * src/ptx.c (long_options, format_args): Likewise.
1190         * src/readlink.c (longopts): Likewise.
1191         * src/sort.c (long_options, mergefps): Likewise.
1192         * src/stat.c (long_options): Likewise.
1193         * src/tac.c (main): Likewise.
1194         * src/tail.c (follow_mode_string): Likewise.
1195         * src/touch.c (longopts, time_args): Likewise.
1196         * src/uniq.c (delimit_method_string): Likewise.
1197         * src/uptime.c (print_uptime): Likewise.
1198         * src/who.c (print_user): Likewise.
1199
1200 2005-03-27  Jim Meyering  <jim@meyering.net>
1201
1202         * src/dcgen: Simplify further, clean up.
1203         Add a standard-output-closing global destructor.
1204         Require perl-5.002.
1205         * src/wheel-gen.pl: Use the same global destructor as dcgen.
1206
1207 2005-03-26  Paul Eggert  <eggert@cs.ucla.edu>
1208
1209         * src/dcgen: Squeeze multiple blanks into one.  Output a simple
1210         array of adjacent strings rather than a more complicated data
1211         structure; this saves space in the dircolors executable.
1212         * src/dircolors.c (parse_line): Use char *, not unsigned char *.
1213         This avoids casts.
1214         (dc_parse_stream, main): Avoid casts.
1215         Adjust to simpler data structure generated by new dcgen.
1216
1217 2005-03-25  Eric Blake  <ebb9@byu.net>  (tiny change)
1218
1219         * src/ls.c (usage): Document usage of LS_COLORS.
1220
1221 2005-03-25  Paul Eggert  <eggert@cs.ucla.edu>
1222
1223         * src/dircolors.hin: Add "TERM cygwin".
1224
1225 2005-03-25  Jim Meyering  <jim@meyering.net>
1226
1227         * src/system.h (DECIMAL_DIGIT_ACCUMULATE): Reverse the sense of
1228         the return value, and update callers:
1229         * src/cut.c (set_fields): Update use of DECIMAL_DIGIT_ACCUMULATE.
1230         * src/expand.c (parse_tab_stops, main): Likewise.
1231         * src/split.c (main): Likewise.
1232         * src/unexpand.c (parse_tab_stops, main): Likewise.
1233         * src/uniq.c (main): Likewise.
1234
1235 2005-03-22  Jim Meyering  <jim@meyering.net>
1236
1237         * build-aux: New directory.  Renamed from config.
1238         * configure.ac: Reflect renaming: config -> build-aux.
1239         * Makefile.am (dist-hook): Likewise.
1240         * Makefile.maint: Likewise.
1241         * Makefile.cfg (cvs_files): Likewise.
1242         * .x-sc_sun_os_names: Likewise.
1243         * .x-sc_trailing_blank: Likewise.
1244
1245         * src/ls.c (get_funky_string): Use '\a', rather than 7, for
1246         portability to EBCDIC hosts.
1247
1248 2005-03-20  Jim Meyering  <jim@meyering.net>
1249
1250         * src/pr.c (init_header): Add missing `%' in new format string.
1251         (init_header): Use zero-filled `.%09d' format, not space-filled `.%9d'.
1252
1253 2005-03-19  Jim Meyering  <jim@meyering.net>
1254
1255         * src/Makefile.am (pr_LDADD): Now that pr uses gettime, add
1256         $(LIB_CLOCK_GETTIME) to get the required -lrt on newer Linux systems.
1257
1258 2005-03-18  Paul Eggert  <eggert@cs.ucla.edu>
1259
1260         * NEWS: pr -D "FORMAT" now accepts the same formats that
1261         date +"FORMAT" does.
1262         * src/pr.c: Include strftime.h, timespec.h.
1263         (init_header): Obtain and format nanosecond part of time stamp.
1264
1265         * NEWS: nohup now ignores the umask when creating nohup.out.
1266         nohup now closes stderr if it is a terminal and stdout is closed.
1267         * src/nohup.c (main): Likewise.  Be a little more paranoid about
1268         return values; e.g., check for any negative return from open.
1269         Assume free (NULL) works.
1270         Close file descriptor leak when redirecting standard output to a file.
1271
1272 2005-03-17  Jim Meyering  <jim@meyering.net>
1273
1274         * src/cut.c (set_fields): Use DECIMAL_DIGIT_ACCUMULATE macro,
1275         in place of functionally-equivalent code.
1276         * src/expand.c (parse_tab_stops, main): Likewise.
1277         * src/split.c (main): Likewise.
1278         * src/unexpand.c (parse_tab_stops, main): Likewise.
1279         * src/uniq.c (main): Likewise.
1280         * src/od.c: Use VERIFY macro in place of an equivalent open-coded
1281         declaration.
1282         * src/system.h (VERIFY, VERIFY_EXPR, DECIMAL_DIGIT_ACCUMULATE):
1283         New macros.
1284
1285         Before, this command would make uniq skip 11 fields and print
1286         only the first line:
1287         $ _POSIX2_VERSION=1 ./uniq -f1 -1 <(seq --format='1 %g' 2)
1288         1 1
1289         1 2
1290         * src/uniq.c (main): Interpret `uniq -f1 -1' like `uniq -f1',
1291         not like `uniq -f11'.
1292
1293 2005-03-15  Jim Meyering  <jim@meyering.net>
1294
1295         Both `pr -0' and e.g., `pr -03' would evoke `column count too large'.
1296         `pr -0' should give a better diagnostic and `pr -03' should be
1297         equivalent to `pr -3'.
1298         * src/pr.c (parse_column_count): Change return type to void.
1299         Call error (EXIT_FAILURE, ... for an invalid string.
1300         (main): Allocate space for column_count_string using malloc.
1301         Accumulate all old-style column-count digits before converting.
1302         When the number of columns is specified via both old-style,
1303         (e.g., -3), and a long option (--columns=5), ensure that only
1304         the last one specified takes effect.
1305         * tests/pr/Test.pm: Add tests for the above.
1306
1307 2005-03-15  Corinna Vinschen  <corinna@vinschen.de>  (tiny change)
1308
1309         * src/copy.c (copy_reg): Copy regular files in binary mode.
1310
1311 2005-03-14  Paul Eggert  <eggert@cs.ucla.edu>
1312
1313         * NEWS: Restate why ls limits time stamp lengths.
1314
1315 2005-03-12  Jim Meyering  <jim@meyering.net>
1316
1317         Add a little infrastructure to help prevent future bugs like the
1318         one fixed below.
1319         * src/stat.c (xstrcat): New function.
1320         (print_statfs, print_stat): Add buf_len parameter and convert all
1321         uses of strcat to xstrcat.  Update callers.
1322         (print_it): Call print_func with buf_len parameter.
1323
1324         Invoking stat -c FMT with a lone format directive of %s, %f, %h, %s,
1325         could cause a buffer overrun error.
1326         * src/stat.c (print_it): Allocate 2 more bytes, to accommodate our
1327         conversion of the stat %s format string to the longer printf %llu one.
1328         Patch from Guochun Shi.
1329
1330 2005-03-11  Paul Eggert  <eggert@cs.ucla.edu>
1331
1332         * src/ls.c (TIME_STAMP_LEN_MAXIMUM): New constant.
1333         (long_time_expected_width, print_long_format): Use it, to avoid
1334         some possible denial-of-service attacks.
1335         * NEWS: Document this.
1336
1337 2005-03-11  Jim Meyering  <jim@meyering.net>
1338
1339         Prompt once again for `mv -i A B' when A and B are hard links
1340         to the same file.  This fixes a bug introduced by my 2003-04-04
1341         (coreutils-5.0.1) change.  Reported by Thomas Wolff via Eric Blake.
1342         * src/copy.c (abandon_move): New function, factored out of
1343         copy_internal, now that this code is being used from two places.
1344         (copy_internal): Perform the same interactive-related test for
1345         whether it's alright to proceed and (usually) overwrite the
1346         destination file.
1347         * tests/mv/i-4: Add tests for the above.
1348
1349         Don't segfault for a very long date format string, e.g.,
1350         ls -ld --time-style=+%99999999H .
1351         * src/ls.c (long_time_expected_width): Use x2nrealloc, not alloca,
1352         so format string abuse cannot provoke stack overflow.
1353         (print_long_format): Likewise.
1354
1355         Don't segfault for a long header date string, e.g.,
1356         echo a|pr -D +%9999999A
1357         * src/pr.c (init_header): Use x2nrealloc, rather than alloca.
1358         Don't bother with fixed-sized initial buffer;  always use x*alloc.
1359
1360         * src/pr.c (init_header): Use slightly clearer INT_BUFSIZE_BOUND
1361         in place of equivalent INT_STRLEN_BOUND + 1.
1362         * src/expr.c (tostring, printv): Likewise.
1363
1364 2005-03-09  Paul Eggert  <eggert@cs.ucla.edu>
1365
1366         * src/system.h: Include intprops.h.
1367         (TYPE_SIGNED, TYPE_MINIMUM, TYPE_MAXIMUM, INT_STRLEN_BOUND): Remove;
1368         they are now defined in intprops.h.
1369
1370 2005-03-09  Jim Meyering  <jim@meyering.net>
1371
1372         * TODO: Remove entry about named pipes.  It was fixed in 5.3.0.
1373
1374 2005-03-08  Paul Eggert  <eggert@cs.ucla.edu>
1375
1376         * src/date.c (usage): Redo to match recent documentation changes.
1377         Don't bother documenting which usages are GNU extensions; the list
1378         wasn't correct, and is better left to the printed manual anyway.
1379
1380 2005-03-06  Jim Meyering  <jim@meyering.net>
1381
1382         Factor out column-count processing.
1383         * src/pr.c: Include "inttostr.h".
1384         (parse_column_count): New function.
1385         (main): Use the new function for both old-style, -9, and long,
1386         --columns=-9, options.
1387
1388         * src/cksum.c: Remove `register' keyword.
1389         * src/cut.c: Likewise.
1390         * src/dd.c: Likewise.
1391         * src/env.c: Likewise.
1392         * src/factor.c: Likewise.
1393         * src/fmt.c: Likewise.
1394         * src/fold.c: Likewise.
1395         * src/id.c: Likewise.
1396         * src/logname.c: Likewise.
1397         * src/ls.c: Likewise.
1398         * src/pr.c: Likewise.
1399         * src/printf.c: Likewise.
1400         * src/shred.c: Likewise.
1401         * src/sort.c: Likewise.
1402         * src/sum.c: Likewise.
1403         * src/test.c: Likewise.
1404         * src/tsort.c: Likewise.
1405         * src/uniq.c: Likewise.
1406         * src/wc.c: Likewise.
1407         * src/whoami.c: Likewise.
1408
1409 2005-03-01  Paul Eggert  <eggert@cs.ucla.edu>
1410
1411         * src/Makefile.am (nanosec_libs): Remove $(LIB_XANOSLEEP); no
1412         longer needed.
1413
1414 2005-03-01  Jim Meyering  <jim@meyering.net>
1415
1416         * src/copy.c (copy_internal): Change test of source type from
1417         !S_ISREG to S_ISLNK.  Reported by Paul Eggert in
1418         http://lists.gnu.org/archive/html/bug-coreutils/2004-10/msg00050.html.
1419
1420 2005-02-28  Jim Meyering  <jim@meyering.net>
1421
1422         * NEWS: Mention that xnanosleep fixes sleep failure on linux-2.6.8.1.
1423
1424 2005-02-21  Paul Eggert  <eggert@cs.ucla.edu>
1425
1426         * src/Makefile.am (dd_LDADD, shred_LDADD): Add $(LIB_GETHRXTIME).
1427         (nanosec_libs): Add $(LIB_XNANOSLEEP).  Needed for newer GNU/Linux
1428         hosts with clock_gettime.
1429
1430 2005-02-20  Paul Eggert  <eggert@cs.ucla.edu>
1431
1432         * NEWS: Describe user-visible change to dd.
1433         * src/Makefile.am (dd_LDADD, shred_LDADD, nanosec_libs):
1434         Remove $(LIB_CLOCK_GETTIME).  These functions now use
1435         gethrxtime instead.
1436         * src/dd.c: Include gethrxtime.h, xtime.h.
1437         (start_time): Now of type xtime_t, not struct timespec.
1438         (print_stats, main): Use gethrxtime rather than gettime.
1439         * src/ls.c (time): Remove obsolete decl.
1440         (get_current_time): gettimeofday always returns 0, so don't
1441         check its result.
1442         * src/shred.c: Include gethrxtime.h.
1443         (isaac_seed): Use gethrxtime rather than a mishmash.
1444         * src/touch.c (time): Remove obsolete decl.
1445
1446         * tests/misc/split-fail: Don't assume that the current host
1447         supports integers wider than 32 bits.  Fix comment typo.
1448         * tests/od/x8: Likewise.
1449
1450         * src/chown-core.c (enum RCH_status): Remove trailing comma,
1451         as it's not valid in standard C89.
1452
1453 2005-02-15  Jim Meyering  <jim@meyering.net>
1454
1455         * src/stat.c (human_fstype): Add case/definition for S_MAGIC_XFS
1456         so that file systems of type `xfs' are recognized as such.
1457         * src/fs.h: Regenerate.
1458         Reported by Bernd Eckenfels.
1459         * src/stat.c (human_fstype): Likewise for S_MAGIC_JFS/jfs.
1460         * src/fs.h: Regenerate.
1461         Reported by Andreas Schwab.
1462
1463         * src/nice.c (NZERO) [NZERO == 0]: Undefine and define to 20,
1464         to work around the invalid definition from Darwin 7.7.0.
1465         Test failure reported by Sébastien Maret.
1466
1467 2005-02-14  Paul Eggert  <eggert@cs.ucla.edu>
1468
1469         * src/sort.c (mergefps): Use binary search rather than linear one
1470         when comparing new line to lines already in main memory.
1471         Idea suggested by James Lemley.
1472
1473 2005-02-09  Jim Meyering  <jim@meyering.net>
1474
1475         * src/copy.c (valid_options): Add an assertion that
1476         not both hard_link and symbolic_link are set.
1477
1478 2005-02-08  Paul Eggert  <eggert@cs.ucla.edu>
1479
1480         * NEWS: Document stat -f -c %S, plus changes to default formats.
1481         * doc/coreutils.texi (stat invocation): Normalize terminology,
1482         capitalization, and sort order to match --help output.  Mention %c
1483         for file systems.  Add new -f -c format %S, and document %s versus %S;
1484         problem reported by Jeroen van Wolffelaar.
1485         * src/stat.c (usage): Likewise.
1486         (STATFS_FRSIZE): New macro.
1487         (print_statfs): Use it, for stat -f -c %S.
1488         (do_statfs): Change default formats to output %S.
1489
1490 2005-02-03  Paul Eggert  <eggert@cs.ucla.edu>
1491
1492         * src/system.h: Include "memrchr.h".
1493         (memrchr) [!HAVE_DECL_MEMRCHR]: Remove decl.
1494
1495 2005-02-02  Jim Meyering  <jim@meyering.net>
1496
1497         * tests/du/8gb: Also adjust the test (s/64/128/) to detect
1498         systems that don't support sparse files.
1499         Check for $2 -ge 128, rather than $2 = 128, in case
1500         there is a file system type that doesn't support sparse files,
1501         yet for which metadata takes up additional space.
1502         Both reported by Andreas Schwab.
1503
1504 2005-02-01  Eric Blake  <ebb9@byu.net>  (tiny change)
1505
1506         * tests/du/8gb: Create a larger test file, so we properly
1507         detect that sparse files can be created on NTFS under cygwin.
1508
1509 2005-01-30  Jim Meyering  <jim@meyering.net>
1510
1511         * src/head.c (elide_tail_bytes_pipe): Correct wording in diagnostic.
1512
1513         * src/stty.c: Remove unnecessary parentheses in all #if directives.
1514
1515 2005-01-29  Eric Blake  <ebb9@byu.net>  (tiny change)
1516
1517         * .cvsignore: Ignore config.cache and config.status.lineno.
1518         * src/stty.c [VSWTCH]: Some systems, like Cygwin, use VSWTC
1519         instead of VSWTCH, for use with CSWTCH.
1520
1521 2005-01-29  Eric Blake  <ebb9@byu.net>  (tiny change)
1522
1523         * tests/Makefile.am (.PHONY): Add check-root and root-hint.
1524         * tests/rwx-to-mode: Ignore ACL designation.
1525         * tests/setgid-check: Likewise.
1526         * tests/chown/separator: Quote user and group names.
1527
1528 2005-01-24  Jim Meyering  <jim@meyering.net>
1529
1530         * src/cp.c (usage): Merge the descriptions of --no-dereference and -P.
1531         Suggestion from Johan Boule.
1532
1533 2005-01-17  Eric Blake  <ebb9@byu.net>  (tiny change)
1534
1535         * src/Makefile.am (all_programs.list): Strip $(EXEEXT) and remove
1536         duplicates.
1537         * man/Makefile.am (all_programs): Revert previous patch; updated
1538         all_programs.list fixes this.
1539         (.x.1): No need to add $(EXEEXT).
1540
1541 2005-01-03  Corinna Vinschen  <corinna@vinschen.de>  (tiny change)
1542
1543         * src/system.h: Use S_BLKSIZE value for ST_NBLOCKSIZE where
1544         available.
1545
1546 2005-01-22  Jim Meyering  <jim@meyering.net>
1547
1548         * Makefile.maint (v_etc_file): The version string has moved to
1549         version-etc-fsf.c, search that new file, not version-etc.c.
1550
1551 2005-01-17  Paul Eggert  <eggert@cs.ucla.edu>
1552
1553         * tests/group-names: Use numeric group ids, not symbolic group names,
1554         since the latter can have shell metacharacters in them (e.g., spaces).
1555         Problem reported by Eric Blake.
1556         * tests/chgrp/basic: Assume groups are numeric, not symbolic.
1557         * tests/chgrp/deref: Likewise.
1558         * tests/chgrp/posix-H: Likewise.
1559         * tests/chgrp/recurse: Likewise.
1560
1561 2005-01-15  Jim Meyering  <jim@meyering.net>
1562
1563         * src/shred.c (isaac_seed) [HAVE_GETHRTIME]: #if-0 this block,
1564         because just calling gethrtime evokes an `illegal instruction'
1565         failure when compiled with Sun's c89 on Solaris 8 and 9.
1566         Reported by Nelson Beebe.
1567
1568         * src/shred.c (isaac_seed) [HAVE_GETHRTIME]: Don't call ISAAC_SEED
1569         twice with the same value of `t'.
1570         Replace nested #if-#else blocks with #if-#elif-#elif chain.
1571
1572 2005-01-14  Jim Meyering  <jim@meyering.net>
1573
1574         The test, tests/tail/f-1, failed on powerpc-apple-darwin7.7.0.
1575         * src/tail.c (IS_TAILABLE_FILE_TYPE): Adjust definition also to include
1576         sockets, since that's what you get when reading from a command-line-
1577         supplied pipe on Darwin 7.7.
1578         (IS_PIPE_LIKE_FILE_TYPE): Define.
1579         (main): Use new IS_PIPE_LIKE_FILE_TYPE rather than simply S_ISFIFO.
1580         Reported by Nelson Beebe.
1581         This same change is also required on NetBSD/sparc-1.5.
1582         Reported by Adrian Bunk.
1583
1584         * src/expr.c (toarith): Rewrite to detect/diagnose integer overflow,
1585         rather than suffering silently.
1586         Before, expr would silently overflow and wrap around:
1587           $ expr 9223372036854775808 = 0   # $(echo 2^63|bc)
1588           1
1589         Now it detects the problem and exits nonzero:
1590           $ ./expr $(echo 2^63|bc) = 0
1591           ./expr: 9223372036854775808: integer is too large
1592
1593         * tests/chown/separator (id_gn): Exit 77, not 1, for a test-framework
1594         failure, so that doesn't cause `make check' to stop.  Nelson Beebe
1595         reported that this test would fail with the diagnostic,
1596         `cannot find name for group ID 10', on one of his systems.
1597
1598 2005-01-13  Jim Meyering  <jim@meyering.net>
1599
1600         * src/test.c (is_int): Don't overflow when evaluating integer
1601         constants.  Before, ./test $(echo 2^64|bc) -eq 0 && echo FAIL
1602         would print `FAIL'.
1603
1604         * tests/Fetish.pm (run_tests): Add code (if-0'd out) to detect
1605         names of temporary files that would clash on 8.3 file systems.
1606         * tests/mk-script (validate): Likewise.
1607
1608 2005-01-12  Jim Meyering  <jim@meyering.net>
1609
1610         * tests/dd/skip-seek: Shorten test names to accommodate 8.3 systems.
1611
1612         * tests/tr/Test.pm (repeat-xC): Change test name from
1613         `repeat-Compl', to avoid 8.3 conflict with `repeat-compl'.
1614         Reported by Eric Blake.
1615         (repeat-000): Rename to `repeat-zeros' for the same reason.
1616
1617 2005-01-11  Jim Meyering  <jim@meyering.net>
1618
1619         * configure.ac: Update version to 5.3.1.
1620
1621 2005-01-11  Eric Blake  <ebb9@byu.net>
1622
1623         * src/Makefile.am (check-README, check-AUTHORS): Account for $(EXEEXT).
1624         * man/Makefile.am (all_programs): Account for $(EXEEXT).
1625
1626 2005-01-11  Jim Meyering  <jim@meyering.net>
1627
1628         * src/unexpand.c (add_tab_stop): Properly diagnose a tabstop list
1629         with decreasing values.
1630
1631         * src/expand.c (main): Likewise.
1632         * src/unexpand.c (main): Check for overflow in tabstop values
1633         specified via the obsolete form.  E.g., now this command fails:
1634         _POSIX2_VERSION=1 ./unexpand -$(echo '2^64+1'|bc)
1635         Before it would act like `_POSIX2_VERSION=1 ./unexpand -1'.
1636         * tests/unexpand/basic-1 (obs-ovflo): New test for this.
1637
1638 2005-01-10  Paul Eggert  <eggert@cs.ucla.edu>
1639
1640         Respond to POSIX interpretations about pathchk -p dated 2005-01-06.
1641         * NEWS: Document the changes.
1642         * doc/coreutils.texi (pathchk invocation): Likewise.
1643         * src/pathchk.c (PORTABILITY_OPTION): New constant.
1644         (longopts, usage, main, validate_file_name):
1645         Add support for new -P option.
1646         Reject empty file names (unless -p is not specified and the
1647         current system allows empty file names).
1648         Change --portability so that is now equivalent to -p -P.
1649         Don't test whether file name is too long, if it is known to exist.
1650         (no_leading_hyphen): New function.
1651         * tests/misc/pathchk1: Add tests for empty file names and
1652         pathchk -P.
1653
1654 2005-01-08  Jim Meyering  <jim@meyering.net>
1655
1656         * Version 5.3.0.
1657
1658         `pr --columns=N' was not equivalent to `pr -N' when also using
1659         either -s or -w.
1660
1661         * src/pr.c (main): Set `explicit_columns' for --columns=N,
1662         not just for -N.  This bug has existed since the introduction
1663         of the --columns=N option on 1998-08-15.
1664         * NEWS: Document this.
1665         * tests/pr/Test.pm (test_vector): For each -N test, automatically
1666         create a new test vector using --columns=N.
1667
1668 2005-01-07  Paul Eggert  <eggert@twinsun.com>
1669
1670         * src/pr.c (main): Check for column count overflow with
1671         usages like "pr -2147483648".
1672
1673 2005-01-07  Jim Meyering  <jim@meyering.net>
1674
1675         * src/pr.c (init_fps): Use xnmalloc, rather than xmalloc.
1676
1677 2005-01-06  Jim Meyering  <jim@meyering.net>
1678
1679         * README: List the precise HP-UX version numbers that are affected.
1680         Suggestion from Bob Proulx.
1681
1682         * Makefile.maint (sc_changelog): Specify find's `-maxdepth 2'
1683         predicate before `-name ChangeLog' to avoid a harmless warning
1684         from find-4.2.10.
1685
1686 2005-01-05  Jim Meyering  <jim@meyering.net>
1687
1688         * tests/help-version: Punt on the uptime test, since it fails when
1689         it can't get boot time, and I don't want that to stop `make check'.
1690
1691         * src/du.c (process_file): Evaluate exclusion rules against
1692         the entire file name, not just the last component.
1693         Reported by Robert Lindgren.
1694         * tests/du/exclude: Test for this.
1695         * NEWS: Document this.
1696
1697         Ensure that tests/Makefile.am's check-root actions stay up to date.
1698         * Makefile.maint (sc_root_tests): New rule.
1699         (syntax-check-rules): Add it to the list.
1700
1701 2005-01-04  Jim Meyering  <jim@meyering.net>
1702
1703         * man/shred.x: Change one-line summary to reflect that shred does
1704         not remove files by default.  Suggestion from Helen Faulkner in
1705         http://bugs.debian.org/288552
1706
1707         * README: Request VERBOSE=yes output when reporting test failures.
1708         Other minor changes.
1709
1710         * tests/Makefile.am (check-root): Update.
1711
1712 2005-01-03  Paul Eggert  <eggert@cs.ucla.edu>
1713
1714         * src/system.h: Undo previous change; we now use Autoconf.
1715
1716 2005-01-03  Jim Meyering  <jim@meyering.net>
1717
1718         * tests/stty/row-col-1: Don't set rows or columns to zero, to avoid
1719         a bug in the TIOCGWINSZ ioctl on at least Solaris5.9 systems.  Setting
1720         either (or both) to zero would succeed, but subsequent `stty size'
1721         would say `no size information for this device' due to the ioctl
1722         failing with EINVAL.
1723
1724         * src/system.h: If PRIdMAX, PRIoMAX, PRIuMAX, and PRIxMAX are
1725         not all defined and either ULONG_MAX or ULLONG_MAX is not defined,
1726         then fail at compile-time rather than let tools like od produce
1727         invalid results at run time.
1728
1729 2004-12-21  Jim Meyering  <jim@meyering.net>
1730
1731         * src/csplit.c (usage): Say the default names are `xx00, xx01, ...',
1732         not `xx01, xx02, ...'.
1733         Reported by Matt Kraai in http://bugs.debian.org/286605
1734
1735         * tests/misc/split-fail: Avoid spurious failure on x86 Solaris5.9
1736         when using c89.
1737
1738 2004-12-20  Paul Eggert  <eggert@cs.ucla.edu>
1739
1740         * src/split.c (usage): Mention default size.  Suggested by Dan Jacobson.
1741
1742 2004-12-19  Paul Eggert  <eggert@cs.ucla.edu>
1743
1744         * NEWS: Mention that one should eval "`dircolors`" rather than
1745         `dircolors`.
1746
1747 2004-12-17  Jim Meyering  <jim@meyering.net>
1748
1749         * tests/mv/hard-link-1: Rearrange to use newer trap-handling code,
1750         so temporary directories aren't left behind upon e.g., interrupt.
1751
1752 2004-12-16  Paul Eggert  <eggert@cs.ucla.edu>
1753
1754         * src/ls.c (print_dir): Use "%s: not listing already-listed
1755         directory", not "not listing already-listed directory: %s", to
1756         format already-listed directories, to be consistent with other
1757         diagnostics involving file names and colons.
1758
1759 2004-12-15  Jim Meyering  <jim@meyering.net>
1760
1761         * src/Makefile.am (__LDADD): Define, so that building `[' on
1762         Solaris still uses the -lgen library that it requires in order
1763         to get a definition of eaccess.
1764
1765 2004-12-14  Jim Meyering  <jim@meyering.net>
1766
1767         tac would exit immediately upon I/O or temp-file creation failure.
1768         Now it continues on, processing any remaining command line arguments.
1769
1770         * src/tac.c: Include quotearg.h.
1771         Use quotearg_colon in most diagnostics.
1772         (copy_to_temp): Rewrite not to exit upon I/O or temp-file-creation
1773         failure.  Before, this command (with /full/tmp being a full partition)
1774           TMPDIR=/full/tmp ./tac /proc/modules tac.c
1775         would exit immediately upon the write error while trying to copy
1776         non-seekable /proc/modules to the full partition.  Now it still
1777         reports the failure but continues on with the remaining file.
1778         (tac_nonseekable): Return false also if copy_to_temp fails.
1779         [DONT_UNLINK_WHILE_OPEN]: Add a FIXME comment explaining that
1780         using atexit like this is wrong.
1781         * NEWS: Document this.
1782         * tests/misc/tac-continue: New test for this.
1783         * tests/misc/Makefile.am (TESTS): Add tac-continue.
1784
1785         * tests/chown/basic: Add a few more tests.
1786
1787 2004-12-13  Paul Eggert  <eggert@cs.ucla.edu>
1788
1789         * src/ls.c (gobble_file): Change arg name to be command_line_arg
1790         rather than explicit_arg, for consistency with copy.c.
1791         (extract_dirs_from_files): Remove ignore_dot_and_dot_dot arg, since
1792         it is deducible from dirname arg.  All callers changed.
1793         (extract_dirs_from_files, print_dir, queue_directory):
1794         Add command_line_arg arg.  All callers changed.
1795         (struct pending): Add command_line_arg member.
1796         (main): Use NULL rather than 0 when appropriate.
1797         (set_exit_status, file_failure): New functions.
1798         (queue_directory): Store command_line_arg into new structure.
1799         (print_dir, gobble_file, get_link_name):
1800         Use file_failure to report problems in accessing files,
1801         so that the exit status is set consistently.
1802         (print_dir): Simplify readdir failure code yet again.
1803         If closedir fails, report "closing directory" rather than "reading
1804         directory" failure.
1805         (xstrcoll): Use set_exit_status to set status on failure.
1806         * tests/ls-2/tests (no-a-isdir-b): This now exits with status 2,
1807         not status 1.
1808
1809 2004-12-11  Jim Meyering  <jim@meyering.net>
1810
1811         Avoid a race condition vulnerability in chown, when used with
1812         --from=O:G and without the (-h) --no-dereference option.
1813         * src/chown-core.c (restricted_chown): New function.
1814         (change_file_owner): Call it.
1815         Reported by Ulrich Drepper.
1816         * NEWS: Mention this.
1817
1818 2004-12-09  Paul Eggert  <eggert@cs.ucla.edu>
1819
1820         * ls now exits with status 1 on minor problems, 2 if serious trouble.
1821         * NEWS: Document this.
1822         * src/ls.c (LS_MINOR_PROBLEM, LS_FAILURE): New constants.
1823         All uses of EXIT_FAILURE replaced with LS_FAILURE, unless
1824         specified below.
1825         (main): Initialize exit failure to LS_FAILURE.
1826         (print_dir, gobble_file, get_link_name, xstrcoll):
1827         Set exit status to LS_MINOR_PROBLEM if the failure is minor.
1828         (print_dir): Do not give up on entire directory merely because readdir
1829         returns EOVERFLOW.
1830         (usage): Explain exit status.
1831         * tests/help-version: ls and variants now exit with status 2
1832         on serious trouble.
1833
1834 2004-12-08  Paul Eggert  <eggert@cs.ucla.edu>
1835
1836         * NEWS: Document new UTC+HH:MM date syntax, and put date changes
1837         together.
1838
1839 2004-12-07  Paul Eggert  <eggert@cs.ucla.edu>
1840
1841         * src/factor.c (factor): Don't list 1 as a factor of 1.
1842         Problem reported by Thomas Folz-Donahue.
1843
1844 2004-12-06  Jim Meyering  <jim@meyering.net>
1845
1846         * tests/du/files0-from: Sanitize environment.
1847         Otherwise, e.g., BLOCKSIZE=k would cause a failure, and that
1848         setting is the default (exported from /etc/profile) on at least one
1849         NetBSD 1.6 system.
1850         * tests/du/no-deref: Likewise.
1851         * tests/cp/symlink-slash: Likewise.
1852         * tests/ls/symlink-slash: Likewise
1853
1854 2004-12-05  Jim Meyering  <jim@meyering.net>
1855
1856         * tests/tail/Test.pm (err-6) ["tail -c"]: Avoid test failure when
1857         _POSIX2_VERSION=199209 is in the environment, or when building on
1858         e.g., OpenBSD 3.2.
1859
1860 2004-12-04  Jim Meyering  <jim@meyering.net>
1861
1862         * NEWS: Mention cut's new --complement option.
1863
1864 2004-10-01  Paolo Bonzini  <bonzini@gnu.org>
1865
1866         * cut.c (complement, COMPLEMENT_OPTION): New.
1867         (longopts): Add --complement.
1868         (usage): Say not that -b, -c, and -f `print' fields,
1869         but rather that they `select' fields for printing.
1870         Describe the new --complement option.
1871         (mark_range_start): Extracted from set_fields.
1872         (print_kth): Support --complement.
1873         (compare_ranges): New function.
1874         (set_fields): Rewrite the part that populates range_start_ht,
1875         merging it with the part that populates printable_field.
1876         (main): Handle --complement.
1877
1878 2004-12-03  Paul Eggert  <eggert@cs.ucla.edu>
1879
1880         * src/tail.c (tail_file): Set errnum to -1 if the initial "tail"
1881         failed.  This works around an assertion failure reported by
1882         Roberto Nibali in:
1883         http://lists.gnu.org/archive/html/bug-coreutils/2004-12/msg00012.html
1884
1885 2004-12-02  Jim Meyering  <jim@meyering.net>
1886
1887         With using --color and with LS_COLORS saying not to color
1888         executables, don't stat every file.
1889         * src/ls.c (is_colored): New function.
1890         (gobble_file): Use it.
1891         (main): Use it here, in place of too-strict tests against NULL:
1892         if either ORPHAN or MISSING was set to 0 from LS_COLORS, the
1893         old test would fail.
1894
1895 2004-12-01  Paul Eggert  <eggert@cs.ucla.edu>
1896
1897         * src/comm.c (compare_files): Assume setlocale exists.
1898         * src/join.c (keycmp): Likewise.
1899         * src/seq.c (decimal_point): Treat like sort.  Now char.
1900         All uses changed.
1901         (main): Assume localeconv exists.  Use same code as sort.
1902         * src/sort.c (C_DECIMAL_POINT): Remove.  Use changed to '.'.
1903         Assume setlocale exists.
1904         (thousands_sep): Renamed from th_sep.
1905         (IS_THOUSANDS_SEP): Remove.  All uses replaced by comparisons.
1906         (NONZERO): Parenthesize use of arg.
1907         (numcompare): Avoid duplicate loads.  Use ISDIGIT as boolean, for
1908         consistency.  Avoid unnecessary negation by reversing
1909         fraccompare args.
1910         (main): Rewrite localeconv call to match seq.c.
1911         * src/system.h: Assume locale.h exists.
1912         (HAVE_SETLOCALE): Remove.
1913         * src/uniq.c (different): Assume setlocale exists.
1914
1915         * src/ls.c (sort_files): Minor cleanup.  Remove an unnecessary
1916         'volatile' on a local variable.  Rewrite to avoid unnecessary
1917         double-assignment to 'func' in the usual case where strcoll does
1918         not fail.
1919
1920 2004-11-30  Paul Eggert  <eggert@cs.ucla.edu>
1921
1922         * src/pinky.c (gethostname): Remove decl.
1923         (scan_entries): Use IS_USER_PROCESS instead of by-hand code.
1924         * src/uptime.c (print_uptime): Use IS_USER_PROCESS and
1925         UT_TYPE_BOOT_TIME instead of by-hand code.
1926         * src/users.c (list_entries_users): Use IS_USER_PROCESS
1927         instead of by-hand code.
1928         * src/who.c (USER_PROCESS, RUN_LVL, INIT_PROCESS, LOGIN_PROCESS,
1929         DEAD_PROCESS, BOOT_TIME, NEW_TIME, UT_TYPE_UNDEF, UT_TYPE): Remove.
1930         (IS_USER_PROCESS): Move to ../lib/readutmp.h.
1931         (UT_TYPE_RUN_LVL, UT_TYPE_INIT_PROCESS, UT_TYPE_LOGIN_PROCESS,
1932         UT_TYPE_DEAD_PROCESS, UT_TYPE_NEW_TIME): New macros.
1933         (gethostname): Remove decl.
1934         (list_entries_who, scan_entries): Use the new macros defined above,
1935         for consistency with pinky, uptime, and users.
1936
1937 2004-11-25  Paul Eggert  <eggert@cs.ucla.edu>
1938
1939         Fix problem reported by Scott S. Tinsley for HP-UX 11.11 using
1940         HP's ANSI C compiler.  Declaring int functions causes warnings on
1941         some modern systems and shouldn't be needed to compile on ancient
1942         ones.
1943         * src/copy.h (stat, lstat, rename): Remove decls.
1944         * src/install.c (stat): Remove decl.
1945         * src/ln.c (link, symlink): Remove decls.
1946
1947 2004-11-25  Jim Meyering  <jim@meyering.net>
1948
1949         * man/help2man: Import help2man-1.35.1.
1950         * man/Makefile.am (.x.1): Remove now-unnecessary use of
1951         locally-added --program-name=NAME option.  Now, help2man gets
1952         the name from the [NAME] section (i.e. from our .x file).
1953         * man/install.x: Use `install', not `ginstall' in the one-line
1954         description.  Reported by Brendan O'Dea.
1955         * man/sha1sum.x: Use `sha1sum', not `shasum'.
1956
1957 2004-11-24  Jim Meyering  <jim@meyering.net>
1958
1959         Since the changes of 2004-05-22, the u.saved_cwd member at
1960         the bottom of the active-directory stack was no longer
1961         strictly necessary.  This change removes that member and uses
1962         the newer cwd_state parameter for the final restore_cwd.
1963
1964         * src/remove.c (struct AD_ent) [u]: Remove now-unnecessary union.
1965         [dev_ino]: Rename from `a'.
1966         (AD_pop_and_chdir): Add a parameter to play the role of just-removed
1967         bottom-of-stack cwd-state member.
1968         (AD_pop_and_chdir): No longer return boolean.  Adjust caller.
1969         (AD_push_initial): Remove CWD parameter.  Adjust caller.
1970
1971 2004-11-23  Paul Eggert  <eggert@cs.ucla.edu>
1972
1973         Minor performance improvements and cleanups for "touch".
1974         * src/touch.c (posix_date): Remove; not needed as a static var.
1975         All uses rewritten.
1976         (touch): Use new futimens function to operate more efficiently
1977         in some cases.  Don't stat/fstat existing file when
1978         (!amtime_now && change_times == (CH_ATIME | CH_MTIME)); the
1979         old time stamps aren't needed in that case.
1980         (main): change_times is int, not bool.  Simplify test for
1981         change_times.
1982
1983 2004-11-20  Paul Eggert  <eggert@cs.ucla.edu>
1984
1985         * src/install.c (usage): Avoid usage that runs afoul of Docbook
1986         translation.  Problem reported by Eric S. Raymond.
1987
1988         Restore dd's noctty flag, reverting the change of 2004-04-08.
1989         POSIX does not allow "dd" to use O_NOCTTY by default.
1990         * NEWS: Add noctty flag to dd.
1991         * doc/coreutils.texi (dd invocation): Likewise.
1992         * src/dd.c (flags, usage, main): Likewise.
1993
1994 2004-11-19  Alfred M. Szmidt  <ams@gnu.org>
1995
1996         * src/ls.c (usage): Clarified description of --no-group (-G),
1997         --human-readable (-h), --inode (-i), --size (-s), --time,
1998         and --time-style.
1999
2000 2004-11-19  Jim Meyering  <jim@meyering.net>
2001
2002         * src/ls.c (usage): Clarify description of --author.
2003         Tweak indentation so that help2man creates better nroff.
2004         Reported by Dan Jacobson.
2005
2006         * src/uniq.c (check_file): Don't check stdout for errors here.
2007
2008         * src/pwd.c (find_dir_entry): Update comment to match reality.
2009
2010 2004-11-18  Jim Meyering  <jim@meyering.net>
2011
2012         * src/pwd.c (robust_getcwd): Correct the comment: this function
2013         constructs the directory name.  The caller prints it.
2014
2015 2004-11-16  Paul Eggert  <eggert@cs.ucla.edu>
2016
2017         * src/stat.c (STATFS): New macro, for portability to Solaris 9.
2018         (do_statfs): Use it.
2019
2020         * src/basename.c, src/chroot.c, src/cksum.c, src/dd.c, src/dirname.c,
2021         src/factor.c, src/hostid.c, src/hostname.c, src/link.c, src/logname.c,
2022         src/nohup.c, src/printenv.c, src/pwd.c, src/setuidgid.c, src/sleep.c,
2023         src/sync.c, src/tsort.c, src/unlink.c, src/uptime.c, src/users.c,
2024         src/whoami.c, src/yes.c (main): Use getopt_long rather than getopt.
2025         * src/readlink.c (main): argv is not const.
2026
2027         * src/cut.c (usage): Improve documentation along the lines suggested
2028         by Debian 5.2.1-2.
2029         * src/echo.c (usage): Likewise.
2030         * src/expr.c (usage): Likewise.
2031
2032         * src/dircolors.hin: Add putty, screen-bce.
2033
2034         * src/pinky.c (print_entry): Fix memory leak.
2035         * src/who.c (print_user): Likewise.
2036
2037 2004-11-15  Paul Eggert  <eggert@cs.ucla.edu>
2038
2039         * NEWS: New dd operand "status=noxfer".
2040         * src/dd.c (C_ASCII, C_EBCDIC, C_IBM, C_BLOCK, C_UNBLOCK,
2041         C_LCASE, C_UCASE, C_SWAB, C_NOERROR, C_NOTRUNC, C_SYNC, C_TWOBUFS,
2042         C_NOCREAT, C_EXCL, C_FDATASYNC, C_FSYNC): Now constants, not
2043         macros.
2044         (STATUS_NOXFER, statuses): New constants.
2045         (usage, print_stats, scanargs): Add support for status=noxfer.
2046         (usage): Update status output to match new behavior.
2047         (print_stats): Always output complete byte count.
2048         Put space between numbers and units, as SI requires.
2049         Use ngettext so that i18n can use plurals for "byte" and "second".
2050         Don't multiply by 1e-9 (inexact); divide by 1e9 (which is exact).
2051         (iflag_error_msgid, oflag_error_msgid): Remove; replace uses by
2052         the string.
2053         * tests/dd/skip-seek (@Tests): Use status=noxfer to avoid
2054         problems with regression testing.
2055
2056 2004-11-14  Paul Eggert  <eggert@cs.ucla.edu>
2057
2058         * NEWS: dd now outputs total bytes, seconds, and bytes per second.
2059         * src/Makefile.am (dd_LDADD): Add $(LIB_CLOCK_GETTIME).
2060         * src/dd.c: Include "human.h".
2061         (w_bytes, start_time): New vars.
2062         (usage): Document new I/O statistics output
2063         (print_stats): Output new I/O statistics.
2064         (cleanup): Do statistics after closing stdin and stdout, so that
2065         the times are more accurate.
2066         (write_output, dd_copy): Count output bytes.
2067         (main): Get initial value of clock.
2068
2069 2004-11-14  Jim Meyering  <jim@meyering.net>
2070
2071         Backslash-escape `-'s in email addresses, so that they are
2072         rendered properly in UTF-locales.
2073         * man/help2man (escape_hyphens): New function.
2074         (main): Call it on email addresses.
2075
2076         * src/sort.c (zaptemp): Mark new diagnostic for translation.
2077
2078         * tests/misc/close-stdout: New file.  Test today's closeout.c change.
2079         * tests/misc/Makefile.am (TESTS): Add close-stdout.
2080
2081 2004-11-13  Jim Meyering  <jim@meyering.net>
2082
2083         * src/test.c (usage): Put the description of `[-n] STRING'
2084         on two lines, one for `-n STRING' and one for `STRING' so that
2085         help2man properly escapes the `-'.  Otherwise, the hyphen is
2086         rendered inappropriately in UTF-8 locales.
2087         Reported by Uwe Zeisberger in http://bugs.debian.org/281069.
2088
2089 2004-11-12  Paul Eggert  <eggert@cs.ucla.edu>
2090
2091         * NEWS: Document the following changes.
2092
2093         * src/sort.c: Avoid O(N**2) behavior when there are many temporary
2094         files.
2095         (temptail): New variable, so that we can easily append to list.
2096         (create_temp_file): Create new files at end of list, so that
2097         searching the list has O(N*NMERGE) behavior instead of O(N**2).
2098         (zaptemp): Update temptail if needed.
2099         (mergefps, merge): Accept new arg that counts temp files, and keep it
2100         up to date as we create and remove temporaries.  This is for
2101         efficiency, so that we don't call zaptemp so often.
2102         All callers changed.
2103         (sort): Don't create array in reverse order, since the list of
2104         temporaries is now in the correct order.
2105
2106         (zaptemp): Protect against race condition: if 'sort' is
2107         interrupted in the middle of zaptemp, it might unlink the
2108         temporary file twice, and the second time this happens the file
2109         might already have been created by some other process.
2110
2111         (zaptemp): Warn if a temporary file is not removed.
2112
2113         (create_temp_file): Use offsetof for clarity.
2114         (die): Move it up earlier, to clean up the code a bit.
2115
2116         * src/pr.c (strtoumax): Declare if not declared.
2117         (skip_to_page, first_page_number, last_page_number, page_number,
2118         first_last_page, print_header):
2119         Use uintmax_t for page numbers.
2120         (first_last_page): Remove unnecessary forward declaration.
2121         Do not modify arg (it is now a const pointer).
2122         Return a true if successful, false (without print a diagnostic)
2123         otherwise.
2124         (main): If +XXX does not specify a valid page range, treat it
2125         as a file name.  This follows the response to Open Group XCU ERN 41
2126         <http://www.opengroup.org/sophocles/show_mail.tpl?source=L&listname=austin-group-l&id=7717>,
2127         which says the behavior is allowed.
2128         (skip_to_page): When starting page number exceeds page count,
2129         print both numbers in the diagnostic.
2130         (print_header): Detect page number overflow.
2131
2132 2004-11-07  Jim Meyering  <jim@meyering.net>
2133
2134         * src/uname.c [__APPLE__]: Include <mach/machine.h> and <mach-o/arch.h>.
2135         (main) [__APPLE__]: Get the processor type via syscall rather than
2136         hard-coding "powerpc".  From Toby Peterson.
2137
2138         * src/sort.c (merge): Remove declarations of now-unused variables.
2139
2140 2004-11-06  Paul Eggert  <eggert@cs.ucla.edu>
2141
2142         * src/sort.c (first_same_file): Remove.  Move most of the code to....
2143         (avoid_trashing_input): New function.
2144         (merge): Avoid some silly merges, e.g., copying a single file to
2145         a temporary file when there are exactly 17 input files to merge.
2146         Take a count of temporary files rather than a max_merge arg.
2147         All uses changed.
2148
2149 2004-11-06  Jim Meyering  <jim@meyering.net>
2150
2151         * src/sort.c (xfclose): Don't close stdout here (just flush it),
2152         since close_stdout now closes stdout unconditionally.
2153
2154 2004-11-05  Paul Eggert  <eggert@cs.ucla.edu>
2155
2156         * src/sort.c (inittables, sort_buffer_size, getmonth, mergefps,
2157         first_same_file, merge, sort, main): Use size_t for indexes to arrays.
2158         This fixes some unlikely havoc-wreaking bugs (e.g., more than INT_MAX
2159         temporary files).
2160         (getmonth, keycompare, compare): Rewrite to avoid need for alloca,
2161         thus avoiding unchecked stack overflow in some cases.  As a side
2162         effect this improve the performance of "sort -M" by a factor of 4
2163         on my benchmarks.
2164
2165 2004-11-03  Paul Eggert  <eggert@cs.ucla.edu>
2166
2167         * src/stty.c: Include "vasprintf.h" since we use vasprintf now.
2168
2169         * src/Makefile.am (check-AUTHORS): Don't assume \? works in a sed
2170         expression; it's not portable.  Problem reported by Albert Chin.
2171         Don't invoke a program more than once.
2172         * src/groups.sh (version): New variable, containing author info,
2173         for benefit of AUTHORS check.  Use it when acting on --version option.
2174         * AUTHORS: Remove duplicate lines.  Remove bogus "chroot:"
2175         in groups line.
2176
2177         * src/system.h: Don't #define and #undef getopt around <stdlib.h>,
2178         as this breaks the new regime that does "#define getopt rpl_getopt".
2179         Problem reported by Albert Chin for Solaris 9 with Sun cc in:
2180         http://lists.gnu.org/archive/html/bug-gnulib/2004-11/msg00019.html
2181         I suppose this may cause problems on ancient hosts with
2182         incompatible getopt declarations, but we'll cross that bridge if
2183         the problem gets reported to us by someone who can test the fix.
2184
2185 2004-11-03  Jim Meyering  <jim@meyering.net>
2186
2187         * src/tac.c: quote(...) file names in diagnostics.
2188
2189 2004-10-29  Paul Eggert  <eggert@cs.ucla.edu>
2190
2191         * NEWS: Document getdate changes.
2192
2193 2004-10-29  Jim Meyering  <jim@meyering.net>
2194
2195         * src/tac.c (tac_file): Remove temporary prototype and move this
2196         function `down' so that it precedes definition of tac_nonseekable.
2197
2198         `tac /proc/modules' would print nothing
2199         Reported by Harald Dunkel in http://bugs.debian.org/278604.
2200
2201         * src/tac.c (copy_to_temp): Renamed from save_stdin, since
2202         now it copies a general file descriptor, not just stdin.
2203         (tac_nonseekable): Renamed/adapted from tac_stdin.
2204         (tac_file): Get fd via `open' directly rather than via fopen/fileno,
2205         since we never used the stream.  Perform "-" to stdin mapping here
2206         rather than in main.  Determine whether a file is seekable,
2207         by trying to `lseek' to its end, and dispatch to tac_seekable or
2208         tac_nonseekable accordingly.
2209         (main): Rewrite argument handling now that it uses only tac_file.
2210         * NEWS: Mention it here.
2211
2212 2004-10-21  Jim Meyering  <jim@meyering.net>
2213
2214         * tests/mv/leak-fd: New file.
2215         * tests/mv/Makefile.am (TESTS): Add it.
2216         * tests/rm/dot-rel: New file.
2217         * tests/rm/Makefile.am (TESTS): Add it.
2218
2219         Correct my patch of 2004-10-18.
2220         * src/remove.c (rm): Destroy the saved_cwd here (via cwd_state),
2221         if necessary, not in remove_dir.  Otherwise, removing multiple
2222         `.'-relative nonempty directories no longer worked.
2223
2224 2004-10-20  Paul Eggert  <eggert@cs.ucla.edu>
2225
2226         * src/fmt.c (usage): Improve description of --prefix.
2227         Problem reported by Edward Welbourne.
2228
2229         * man/uniq.x: Change summary so that it doesn't imply that
2230         uniq writes to its input file.  Problem reported by
2231         Dan Jacobson.
2232
2233 2004-10-18  Jim Meyering  <jim@meyering.net>
2234
2235         Plug a leak that would cause a cross-device mv to fail when
2236         operating on too many command-line-specified nonempty directories.
2237         * src/remove.c (remove_dir): Destroy the `struct saved_cwd' on the
2238         top of the stack before returning.  This usually closes the file
2239         descriptor that was used to return to the original working directory.
2240         Reported by Cyril Bouthors in
2241         http://article.gmane.org/gmane.comp.gnu.core-utils.bugs/3048
2242         * NEWS: Mention it here.
2243
2244         * src/pathchk.c (validate_file_name): Give a more descriptive
2245         diagnostic when pathconf fails.  This also avoids an unwarranted
2246         warning from gcc-3.3.5 about a format not being a string literal.
2247
2248         * src/sleep.c (main): Remove declaration of unused local, c.
2249         * src/printenv.c (main): Likewise.
2250         * src/logname.c (main): Likewise.
2251         * src/uptime.c (main): Likewise, for optc.
2252         * src/tsort.c (main): Likewise, for opt.
2253
2254 2004-10-17  Paul Eggert  <eggert@cs.ucla.edu>
2255
2256         * AUTHORS: Add self to pathchk.
2257         * src/pathchk.c (AUTHORS): Add self.
2258         Change "path" to "file name" whenever possible.
2259         Remove usage comment, as it was a duplication of the code or doc.
2260         Include <wchar.h> if available.
2261         (mbrlen, mbstate_t) [! (HAVE_MBRLEN && HAVE_MBSTATE_T)]: Define.
2262         (NEED_PATHCONF_WRAPPER, PATH_MAX, PATH_MAX_FOR, NAME_MAX,
2263         pathconf_wrapper, portable_chars, dir_ok): Remove.
2264         (NAME_MAX_MINIMUM, PATH_MAX_MINIMUM): New macros.
2265         (pathconf, _PC_NAME_MAX, _PC_PATH_MAX): Define if nonexistent.
2266         (portable_chars_only): New arg FILELEN.
2267         Don't assume ASCII; we might be on an EBCDIC host.
2268         Don't assume unibyte locale in diagnostic.
2269         (component_start, component_len): New functions.
2270         (validate_file_name): Renamed from validate_path.  All uses changed.
2271         Pretty much a complete rewrite.
2272         Don't make copy of file arg.  Always append trailing slash to
2273         pathconf arg, just in case it's a symlink (this is pure paranoia;
2274         we don't know of any hosts where the trailing slash is required).
2275         Use size_t instead of long int when possible.
2276         Avoid need to call pathconf in most practical cases.
2277         Don't use euidaccess several times to test searchability;
2278         just use lstat once.  Reword diagnostic to put the (often very long)
2279         file names last.
2280
2281 2004-10-15  Paul Eggert  <eggert@cs.ucla.edu>
2282
2283         * src/printf.c (usage): Mention Unicode, and use H for hex digits.
2284
2285 2004-10-13  Jim Meyering  <jim@meyering.net>
2286
2287         * NEWS: Mention today's fts.c fix.
2288
2289 2004-10-13  Paul Eggert  <eggert@cs.ucla.edu>
2290
2291         * tests/stty/row-col-1: Set LC_ALL=C.
2292
2293 2004-10-12  Jim Meyering  <jim@meyering.net>
2294
2295         * src/dircolors.hin: Add .flac and .mpc as audio suffixes.
2296         From Jesus Climent in http://bugs.debian.org/276149.
2297
2298 2004-10-05  Paul Eggert  <eggert@cs.ucla.edu>
2299
2300         * src/ls.c (ignore_mode): Renamed from ignore, to avoid shadowing
2301         problems.  All uses changed.
2302
2303 2004-10-05  Jim Meyering  <jim@meyering.net>
2304
2305         * .x-sc_trailing_blank: Add an exclusion for config/texinfo.tex,
2306         since Karl says its trailing blanks are there to stay :-)
2307
2308 2004-10-04  Paul Eggert  <eggert@cs.ucla.edu>
2309
2310         * src/expr.c (NEW, OLD): Remove, partly to avoid
2311         reference to obsolescent macro XMALLOC.
2312         All uses replaced by xmalloc and free.
2313
2314 2004-09-28  Jim Meyering  <jim@meyering.net>
2315
2316         * src/tail.c (usage): Clarify: --retry works only with --follow=name.
2317         Reported by Nik A. Melchior in http://bugs.debian.org/273781.
2318
2319 2004-09-27  Paul Eggert  <eggert@cs.ucla.edu>
2320
2321         * src/od.c (format_address_paren): c is optional, so don't output
2322         it if it's '\0'.
2323
2324 2004-09-26  Paul Eggert  <eggert@cs.ucla.edu>
2325
2326         Add support for ls --hide.  Idea suggested by Bardur Arantsson.
2327         * NEWS: Document this.
2328         * src/ls.c (file_ignored): Renamed from file_interesting, with
2329         inverted return value.  Accept the file name, not a struct dirent *.
2330         All uses changed.  Avoid the expense of calling fnmatch if the
2331         file is ignorable due to leading '.'.
2332         (all_files, really_all_files): Removed; replaced by:
2333         (ignore): New variable.  All uses changed.
2334         (IGNORE_DEFAULT, IGNORE_DOT_AND_DOTDOT, IGNORE_MINIMAL, HIDE_OPTION):
2335         New constants.
2336         (hide_patterns): New variable.
2337         (long_options, decode_switches, file_ignored, usage):
2338         Add support for --hide.
2339         (patterns_match): New function.
2340         (usage): Replace "hide" with "ignore" in explanation, to avoid
2341         confusion.
2342
2343 2004-09-25  Paul Eggert  <eggert@cs.ucla.edu>
2344
2345         * src/ls.c (gobble_file, print_long_format): Don't assume that
2346         human-readable output has a byte count equal to its column width;
2347         this isn't always true in locales where the radix character is not
2348         '.' or ','.
2349         (format_user_or_group): Revamp code to match the above fix;
2350         this avoids the (very faint) possibility of integer overflow.
2351
2352 2004-09-24  Paul Eggert  <eggert@cs.ucla.edu>
2353
2354         * NEWS: Mention that "chmod -r -w x" now works as expected.
2355         * src/chmod.c (main): Revamp option processing to support this.
2356         * tests/chmod/Makefile.am (TESTS): Add 'usage'.
2357         * tests/chmod/usage: New set of tests for usage like that.
2358
2359 2004-09-24  Jim Meyering  <jim@meyering.net>
2360
2361         * Makefile.maint (CVS_LIST): Use --types=AFGM option so that
2362         it lists only cvs-controlled regular files.
2363
2364         * src/csplit.c (xalloc_die): Declare to be `extern', not `static'
2365         to avoid a warning from gcc-3.4.1.  Reported by Paul Eggert.
2366
2367 2004-09-23  Paul Eggert  <eggert@cs.ucla.edu>
2368
2369         * Makefile.maint (CVS_LIST): New macro.
2370         (sc_space_tab, sc_prohibit_atoi_atof, sc_file_system,
2371         sc_prohibit_jm_in_m4, sc_system_h_headers, sc_sun_os_names,
2372         sc_trailing_blank, po-check): Use it instead of the
2373         nonstandard "cvsu --list".
2374
2375         * src/tail.c (parse_obsolete_option): Bring back support
2376         for obsolete option followed by non-obsolete, or by more
2377         than one file.  When obsolete, conform to SUSv2 rather than
2378         original POSIX 1003.2-1992, as SUSv2 corrected the case of
2379         "tail -c".  Add support for the SUSv2 "b" modifier.
2380         * NEWS: Mention the above.
2381         * tests/tail/Test.pm: New test case obs-b to check the above.
2382         err-[134] no longer need _POSIX2_VERSION=199209.
2383         Fix comments to match revised behavior.
2384
2385 2004-09-22  Jim Meyering  <jim@meyering.net>
2386
2387         * Use automake-1.9.2.  Regenerate dependent files.
2388
2389         * src/remove.c (struct dirstack_state) [current_arg_jumpbuf]:
2390         Improve the comment.
2391
2392         Clean up scoping etc. so that some make `distcheck' tests pass.
2393         * src/csplit.c (xalloc_die): Declare to be static.
2394         * src/chown-core.c (chown_files): Declare as `extern'.
2395         * src/cp-hash.c (remember_created): Likewise.
2396         * src/copy.c (copy): Likewise.
2397         * src/checksum.h (enum) [ALG_MD5]: Define to be 1, not 0.
2398
2399         * src/id.c, src/nl.c, src/expand.c: Remove trailing blanks.
2400         * src/unexpand.c: Likewise.
2401
2402         * src/Makefile.am (check-AUTHORS): New rule.
2403         (check): Depend on it.
2404         * AUTHORS: Update.
2405
2406         * Makefile.maint (syntax-check-rules): Remove duplicate sc_tight_scope.
2407         (sc_system_h_headers): Also exclude copy.h; it includes <stdbool.h>.
2408
2409 2004-09-22  Paul Eggert  <eggert@cs.ucla.edu>
2410
2411         * src/ls.c (decode_switches): Don't compare a short value
2412         to SIZE_MAX: GCC sometimes complains.
2413
2414 2004-09-21  Paul Eggert  <eggert@cs.ucla.edu>
2415
2416         * NEWS: The following commands now reject unknown options:
2417         basename dirname factor hostname link nohup sync unlink yes
2418         Also, pathchk no longer accepts trailing options.
2419
2420         * src/basename.c: Include <getopt.h>.
2421         * src/chroot.c: Likewise.
2422         * src/dirname.c: Likewise.
2423         * src/factor.c: Likewise.
2424         * src/hostid.c: Likewise.
2425         * src/hostname.c: Likewise.
2426         * src/nohup.c: Likewise.
2427         * src/pwd.c: Likewise.
2428         * src/setuidgid.c: Likewise.
2429         * src/sync.c: Likewise.
2430
2431         * src/basename.c (main): Reject unknown options.
2432         * src/dirname.c (main): Likewise.
2433         * src/factor.c (main): Likewise.
2434         * src/hostid.c (main): Likewise.
2435         * src/hostname.c (main): Likewise.
2436         * src/link.c (main): Likewise.
2437         * src/nohup.c (main): Likewise.
2438         * src/pwd.c (main): Likewise.
2439         * src/setuidgid.c (main): Likewise.
2440         * src/sync.c (main): Likewise.
2441         * src/unlink.c (main): Likewise.
2442         * src/yes.c (main): Likewise.
2443
2444         * src/cat.c (main): Remove unused "case 0".
2445         * src/chgrp.c (main): Likewise.
2446         * src/chmod.c (main): Likewise.
2447         * src/chown.c (main): Likewise.
2448         * src/comm.c (main): Likewise.
2449         * src/cp.c (main): Likewise.
2450         * src/csplit.c (main): Likewise.
2451         * src/cut.c (main): Likewise.
2452         * src/date.c (main): Likewise.
2453         * src/df.c (main): Likewise.
2454         * src/du.c (main): Likewise.
2455         * src/env.c (main): Likewise.
2456         * src/expand.c (main): Likewise.
2457         * src/fold.c (main): Likewise.
2458         * src/head.c (main): Likewise.
2459         * src/id.c (main): Likewise.
2460         * src/install.c (main): Likewise.
2461         * src/join.c (main): Likewise.
2462         * src/ln.c (main): Likewise.
2463         * src/ls.c (decode_switches): Likewise.
2464         * src/mkdir.c (main): Likewise.
2465         * src/mkfifo.c (main): Likewise.
2466         * src/mknode.c (main): Likewise.
2467         * src/mv.c (main): Likewise.
2468         * src/nl.c (main): Likewise.
2469         * src/paste.c (main): Likewise.
2470         * src/pinky.c (main): Likewise.
2471         * src/pr.c (main): Likewise.
2472         * src/ptx.c (main): Likewise.
2473         * src/readlink.c (main): Likewise.
2474         * src/rm.c (main): Likewise.
2475         * src/rmdir.c (main): Likewise.
2476         * src/seq.c (main): Likewise.
2477         * src/shred.c (main): Likewise.
2478         * src/split.c (main): Likewise.
2479         * src/sum.c (main): Likewise.
2480         * src/tac.c (main): Likewise.
2481         * src/tail.c (main): Likewise.
2482         * src/tee.c (main): Likewise.
2483         * src/touch.c (main): Likewise.
2484         * src/tr.c (main): Likewise.
2485         * src/tty.c (main): Likewise.
2486         * src/uname.c (main): Likewise.
2487         * src/unexpand.c (main): Likewise.
2488         * src/wc.c (main): Likewise.
2489         * src/who.c (main): Likewise.
2490
2491         * src/chroot.c (main): Use getopt where it suffices, not getopt_long.
2492         * src/cksum.c (main): Likewise.
2493         * src/dd.c (main): Likewise.
2494         * src/logname.c (main): Likewise.
2495         * src/printenv.c (main): Likewise.
2496         * src/sleep.c (main): Likewise.
2497         * src/tsort.c (main): Likewise.
2498         * src/uptime.c (main): Likewise.
2499         * src/users.c (main): Likewise.
2500         * src/whoami.c (main): Likewise.
2501
2502         * src/du.c (long_options): Standardize on NULL vs 0.
2503         * src/rm.c (long_opts): Likewise.
2504
2505         * src/logname.c (long_options): Remove.
2506         * src/printenv.c (long_options): Likewise.
2507         * src/sleep.c (long_options): Likewise.
2508         * src/tsort.c (long_options): Likewise.
2509         * src/uptime.c (longopts): Likewise.
2510         * src/users.c (longopts): Likewise.
2511         * src/whoami.c (long_options): Likewise.
2512
2513         * src/pathchk.c (longopts): Add --help, --version.
2514         (main): Use longopts rather than parse_long_options.
2515         * src/stty.c (longpts, main): Likewise.
2516
2517         * src/pathchk.c (main): Don't reorder arguments, so that
2518         we can check weird file names.
2519
2520         * src/readlink.c: Don't include "long-options.h".
2521         * src/sort.c: Likewise.
2522         * src/stty.c: Likewise.
2523
2524         * src/split.c (verbose): Now bool, not int.
2525         (VERBOSE_OPTION): New enum.
2526         (longopts, main): Use it.
2527
2528         * tests/factor/basic: Adjust to new wording in diagnostic
2529         that results from the above changes.
2530
2531 2004-09-21  Jim Meyering  <jim@meyering.net>
2532
2533         * man/rm.x: Say "the response is affirmative" rather than "the
2534         response begins with y or Y", so that the documentation is
2535         accurate in non-English locales.  Problem reported by Munzir Taha.
2536
2537 2004-09-19  Paul Eggert  <eggert@cs.ucla.edu>
2538
2539         * src/echo.c (main): Don't pass NULL to strcmp when
2540         POSIXLY_CORRECT and given no arguments.
2541
2542         * src/md5sum.c (STRING_OPTION): Remove.
2543         (long_options, main): Remove support for undocumented and
2544         obsolete --string option, as suggested in the 1996-09-26 patch.
2545         * NEWS: Document this.
2546
2547         * tests/rm/fail-eperm: Don't try to remove writeable files in a
2548         sticky /tmp directory, as SVR4-like systems (e.g., Solaris 9) let
2549         you remove such files.  Problem reported by Bert Fischer in:
2550         http://lists.gnu.org/archive/html/bug-coreutils/2004-09/msg00074.html
2551
2552 2004-09-18  Paul Eggert  <eggert@cs.ucla.edu>
2553
2554         * src/md5sum.c (STATUS_OPTION, STRING_OPTION): New enums.
2555         (long_options, main): Use them instead of magic numbers 2 and 1.
2556         For --string, optarg can't possibly be NULL.
2557
2558         * src/dd.c (usage): Distinguish between options and operands.
2559         (scanargs): Don't mess with argc, argv; getopt_long handles this now.
2560         Say "operands" for operands, not "options".
2561         (main): Use getopt_long, so that "dd --" works as POSIX requires.
2562         * tests/dd/misc: Check for "dd --".
2563
2564         * src/chroot.c (main): Reject unknown options instead of
2565         interpreting them as a directory to chroot to.
2566
2567         * src/cksum.c: Remove obsolete comment about POSIX 1003.2/D11.2.
2568         The current standard (POSIX 1003.1-2004) is correct.
2569         (crc_remainder) [defined CRCTAB]: Renamed from "remainder" to avoid
2570         collision with builtin function.
2571         (main) [defined CRCTAB]: Output in lowercase hexadecimal, and
2572         output the first 0 as 8 digits, to make it easier to compare to
2573         the text of the standard.  Output crctab to be a const array.
2574         (crctab): Use result of above changes.
2575         (long_options): Remove; not needed if empty.
2576         (main): getopt_long can't return 0 here, so simplify the code.
2577
2578 2004-09-13  Jim Meyering  <jim@meyering.net>
2579
2580         * src/Makefile.am (localedir.h): Don't redirect directly to target.
2581
2582 2004-09-13  Paul Eggert  <eggert@cs.ucla.edu>
2583
2584         * src/id.c (print_full_info): Don't exit with failure status simply
2585         because a user or group number can't be turned into a name.
2586         Problem reported by Felipe Kellermann in:
2587         http://lists.gnu.org/archive/html/bug-coreutils/2004-09/msg00081.html
2588
2589 2004-09-12  Jim Meyering  <jim@meyering.net>
2590
2591         * Makefile.maint (my-distcheck): When building with -Werror, also
2592         require -Wshadow.
2593
2594 2004-09-10  Paul Eggert  <eggert@cs.ucla.edu>
2595
2596         * NEWS: "tail" now handles obscure POSIX 1003.2-1992 cases better.
2597         * src/tail.c (parse_obsolete_option): Renamed from
2598         parse_obsolescent_option, since the options are obsolete now.
2599         Remove bool *arg; just exit if there's an error.  Revamp to follow
2600         POSIX 1003.2-1992 more precisely, to handle cases like "tail -
2601         file" and "tail -10 -- file" correctly when we are conforming to
2602         the older standard.
2603         (main): Adjust to this change.
2604         * tests/tail/Test.pm (test_vector): minus-* requires
2605         _POSIX2_VERSION=199209 now, to work correctly if there is
2606         an input file.  err-1 and err-3 no longer errors if there
2607         is another file.
2608
2609 2004-09-09  Paul Eggert  <eggert@cs.ucla.edu>
2610
2611         * src/test.c (usage): Document -r, -w, -x more carefully.
2612
2613 2004-09-08  Paul Eggert  <eggert@cs.ucla.edu>
2614
2615         * src/test.c (usage): Document "test" (with no args) and "[ ]".
2616         Document that -h and -L don't dereference.
2617
2618         * NEWS: Document that "tr xy -z" now works as per POSIX.
2619         Sort the descriptions.
2620         * src/tr.c (main): Don't reorder options.
2621         * tests/tr/Test.pm (fowler-1): New test case.
2622
2623 2004-09-06  Paul Eggert  <eggert@cs.ucla.edu>
2624
2625         * src/touch.c (main): Fix POSIX-conformance bug: "touch --
2626         MMDDhhmm file" must be treated like "touch MMDDhhmm file" when
2627         conforming to pre-2001 POSIX.
2628         * NEWS: Document this.
2629         * tests/touch/obsolescent: Test for this bug.  Also, set
2630         _POSIX2_VERSION=199209 and POSIXLY_CORRECT=1 so that it's
2631         a better test for obsolescent features.
2632
2633         * src/sort.c (main): Emulate Solaris 8 and 9 "sort -y", so that
2634         "sort -y abc" is like "sort abc" whereas "sort -y 100" is like
2635         plain "sort".
2636
2637         * src/od.c: Several changes for POSIX and FreeBSD compatibility.
2638         (COMMON_SHORT_OPTIONS): Add -B, -D, -e, -F, -H, -I, -L, -O, -s, -X.
2639         (long_options, main): --strings is now -S, not -s.
2640         (usage): Reflect the usage changes.
2641         (parse_old_offset): Do not issue a diagnostic on failure;
2642         callers now do this as necessary.
2643         (main): Support POSIX syntax.  Remove unused case 0 from getopt_long.
2644         Add support for new short options (many undocumented) for
2645         compatibility with FreeBSD.  Remove FIXME for -s; it's now
2646         POSIX-compatible.  Default format is now oS, not o2.
2647         * NEWS: Describe the above.
2648
2649 2004-09-05  Paul Eggert  <eggert@cs.ucla.edu>
2650
2651         * src/stty.c (valid_options): Remove.
2652         (main): Fix some bugs in handling invalid option-combinations
2653         like "stty -F".
2654         (recover_mode): Arg is now char const *, not char *.
2655         (main): Use STDIN_FILENO, not 0.
2656         Simplify option-parsing code a tad.
2657         * tests/stty/basic-1: Check for the fixed bugs.
2658
2659 2004-09-03  Paul Eggert  <eggert@cs.ucla.edu>
2660
2661         * src/stat.c (HAVE_STRUCT_STATXFS_F_TYPE): Fix typo that prevented
2662         it from ever being nonzero.  Reported by Pozsar Balazs in:
2663         http://lists.gnu.org/archive/html/bug-coreutils/2004-08/msg00189.html
2664         (human_fstype): Add ramfs, squashfs, sysfs.
2665         Reported by Pozsar Balazs in:
2666         http://lists.gnu.org/archive/html/bug-coreutils/2004-08/msg00188.html
2667         (human_fstype): Return char const *, not char *.
2668         Simplify internals a bit, and avoid casts.
2669
2670         * src/dd.c (usage): "alternated EBCDIC" -> "alternate EBCDIC".
2671         (bit_count): Remove.  All uses changed to....
2672         (multiple_bits_set): New function.
2673         (scanargs): Use it, and check separately for each set of
2674         incompatible options, to improve diagnostics.
2675         (MX): Remove.
2676         (apply_translations): Move checks for incompatible options
2677         to scanargs, so that they're done consistently.
2678
2679 2004-09-02  Paul Eggert  <eggert@cs.ucla.edu>
2680
2681         Output correct errno-related diagnostic on "paste" I/O errors.
2682         * src/paste.c (write_error, xputchar): New functions.
2683         (paste_parallel): Use correct errno value after input error.
2684         (paste_parallel, paste_serial): Report errno value after output error.
2685
2686         Port to diet libc.  Problem reported by Felix von Leitner in:
2687         http://lists.gnu.org/archive/html/bug-coreutils/2004-08/msg00171.html
2688         * src/paste.c (dummy_closed, CLOSED, dummy_endlist, ENDLIST): Remove;
2689         it's not portable C to assume FILE is a complete type.
2690         (paste_parallel): Use index test instead of ENDLIST, and NULL
2691         instead of CLOSED.
2692
2693 2004-08-24  Paul Eggert  <eggert@cs.ucla.edu>
2694
2695         POSIX-conformance fixes for "expand" and "unexpand".
2696         Also, consistently use "tab stop" rather than "tabstop".
2697         * NEWS: Document fixes.
2698         * src/expand.c: Revamp to resemble the new unexpand.c better.
2699         (usage): -i does not convert tabs after non-tabs.
2700         (add_tab_stop): Renamed from add_tabstop.  All uses changed.
2701         (parse_tab_stop): Renamed from parse_tabstop.  All uses changed.
2702         (validate_tab_stop): Renamed from validate_tabstop.  All uses changed.
2703         (next_file, main): Check fclose against 0, not EOF.
2704         (expand): Remove unnecessary casts.
2705         Add another loop nesting level, for lines, so that per-line variables
2706         are initialized cleanly.
2707         Revamp tab checking.  Check for write error immediately, rather
2708         than just once at the end of the program.
2709         * src/unexpand.c: Lkewise (for the expand.c changes).
2710         (TAB_STOP_SENTINEL): Remove.
2711         (tab_size): Now size_t, not uintmax_t, since we need to store
2712         the sequences of blanks.
2713         (max_column_width): New var.
2714         (usage): Say "blank" where POSIX requires this.
2715         (add_tab_stop): Calculate maximum column width.
2716         (unexpand): Store the pending blanks, instead of merely counting them.
2717         Follow POSIX's rules about -a requiring two blanks before a tab stop.
2718         Get rid of internal label and goto.
2719         * tests/unexpand/basic-1: Fix infloop-3 to match POSIX.
2720         Add blanks-1 through blanks-13.
2721
2722 2004-08-19  Paul Eggert  <eggert@cs.ucla.edu>
2723
2724         * NEWS: "chown : file", "chown '' file", and "chgrp '' file" now
2725         succeed without changing the uid and gid, like FreeBSD.
2726         * src/chgrp.c (parse_group): Return gid_t rather than storing it
2727         through a pointer.  Treat "chgrp '' file" as a no-op change,
2728         as FreeBSD does.
2729         (main): Set chopt.group_name to NULL if the group is the empty
2730         string.
2731         * src/chown-core.c (describe_change): Describe changes to -1:-1
2732         without using "to OWNERSHIP" phrase.
2733         * src/chown.c (usage): "chown '' file" is now allowed.
2734         (main): Do not set user name to the empty string if the group
2735         name is null.
2736         * tests/chgrp/basic: Test "chgrp '' file".
2737         * tests/chown/Makefile.am (TESTS): Add separator.
2738         * tests/chown/separator: New file, partly taken from
2739         Dmitry V. Levin's suggestion in
2740         <http://lists.gnu.org/archive/html/bug-coreutils/2004-08/msg00102.html>
2741
2742 2004-08-11  Paul Eggert  <eggert@cs.ucla.edu>
2743
2744         * tests/install/basic-1: Test for the -d regression.
2745
2746 2004-08-11  Dmitry V. Levin  <ldv@altlinux.org>
2747
2748         * src/install.c (main): Fix -d regression introduced with
2749         --target-directory support at 2004-06-25.
2750
2751 2004-08-11  Paul Eggert  <eggert@cs.ucla.edu>
2752
2753         * src/copy.c (copy_internal): When preserving links, unlink
2754         a destination with link count greater than one.  This is so
2755         that commands like "cp -a" don't get confused when copying into
2756         a destination that already contains many hard links.  Problem
2757         reported by Tim Waugh in:
2758         http://lists.gnu.org/archive/html/bug-coreutils/2004-08/msg00053.html
2759
2760 2004-08-10  Paul Eggert  <eggert@cs.ucla.edu>
2761
2762         Convert all files to UTF-8.
2763         * tests/fmt/basic (8-bit-pfx): Use UTF-8, not Latin-1.
2764         * tests/sort/Test.pm (16a): Likewise.
2765         * tests/uniq/Test.pm (8): Likewise.
2766         * tests/misc/printf-hex: Use ASCII, not Latin-1.
2767
2768         * NEWS: Document "sort -o -" and "tee -" POSIX-conformance fixes.
2769         * src/shred.c (usage): "-" is an operand, not an option.
2770         * src/sort.c (die, xfopen, mergefps, first_same_file, merge):
2771         A null file arg means standard output.
2772         (main): "-o -" means to write to a file named "-",
2773         not to standard output.
2774         * src/tee.c (usage, tee): "tee -" writes to standard output, not
2775         to a file named "-".
2776
2777 2004-08-10  Dmitry V. Levin  <ldv@altlinux.org>
2778
2779         * src/install.c (change_timestamps): Fix int->bool conversion
2780         bugs introduced on 2004-07-29.
2781
2782 2004-08-09  Paul Eggert  <eggert@cs.ucla.edu>
2783
2784         * src/shred.c (wipename): Work even if the directory is writeable
2785         and not readable.  Prefer write access, since this should work
2786         better with fdatasync.
2787
2788         * src/csplit.c (xalloc_die): New function.
2789         (main): Remove now-obsolete initialization of xalloc_fail_func.
2790
2791         * src/md5sum.c: Adjust to sha->sha1 renaming.
2792
2793 2004-08-08  Dmitry V. Levin  <ldv@altlinux.org>
2794
2795         Minor code cleanup.
2796         * src/readlink.c (canonicalize_fname): Remove unneeded proxy function.
2797         (can_mode): Make variable local.
2798
2799 2004-08-07  Paul Eggert  <eggert@cs.ucla.edu>
2800
2801         * src/system.h (O_BINARY) [!O_BINARY && defined O_BINARY]:
2802         Do not define, to avoid annoying compiler messages on QNX 6.3.
2803         Problem reported by Johan in:
2804         http://lists.gnu.org/archive/html/bug-coreutils/2004-08/msg00050.html
2805
2806 2004-08-04  Paul Eggert  <eggert@cs.ucla.edu>
2807
2808         * src/system.h (PRIdMAX, PRIoMAX, PRIuMAX, PRIxMAX):
2809         Define to a concatenation of string literals, not to an expression;
2810         needed for concatenation contexts.
2811         (INTMAX_MAX, INTMAX_MIN): New macros.
2812
2813         * src/stat.c (print_stat): Don't assume st_ino / st_dev fits in
2814         unsigned long; this isn't true for st_ino on Solaris 9.
2815
2816 2004-08-03  Paul Eggert  <eggert@cs.ucla.edu>
2817
2818         * src/uname.c: Do not depend on HAVE_SYSCTL when deciding
2819         whether to include files.  Include <sys/param.h> if
2820         HAVE_SYS_PARAM_H (not HAVE_SYSCTL).
2821         (main) [defined __POWERPC__]: Add a kludge to work around a
2822         Mac OS X bug, so that uname -p defaults to "powerpc" if
2823         sysctl ((int[]) {CTL_HW, HW_MACHINE_ARCH}, 2, buffer, &bufsize, 0, 0)
2824         fails.  Problem reported by Petter Reinholdtsen in:
2825         http://lists.gnu.org/archive/html/bug-gnu-utils/2003-02/msg00201.html
2826
2827         * src/uniq.c (hard_LC_COLLATE, ignore_case, different, check_file,
2828         main): Use bool for booleans.
2829         (writeline, check_file): Use uintmax_t for line counts.
2830         (check_file): Check for and report line number overflow,
2831         when that matters.
2832         * src/wc.c (iswspace, wc): Use to_uchar rather than a cast.
2833         (print_lines, print_words, print_chars, print_bytes, print_linelength,
2834         have_read_stdin, wc, wc_file, main):
2835         Use bool for booleans.
2836         (exit_status): Remove.
2837         (wc, wc_file): Return bool status.  All callers changed.
2838         * src/who.c (scan_entries): 0 -> STDIN_FILENO.
2839         * src/whoami.c (main): Print uids using unsigned long int, not
2840         unsigned int.
2841
2842         * src/unexpand.c: Int cleanup and minor reorganization to be more
2843         like src/expand.c.
2844         Include quote.h, xstrndup.h.
2845         (TAB_STOP_SENTINEL): Increase from INT_MAX to INTMAX_MAX.
2846         (convert_entire_line, have_read_stdin, parse_tabstops, next_file,
2847         unexpand, main):
2848         Use bool for booleans.
2849         (tab_size, tab_list, add_tabstop, validate_tabstops, unexpand):
2850         Use uintmax_t for column counts.
2851         (first_free_tab, validate_tabstops, unexpand): Use size_t for sizes.
2852         (add_tabstop, parse_tabstops, main): Don't reserve UINTMAX_MAX
2853         as a tab stop.
2854         (parse_tabstops): Don't use ISBLANK on possibly-signed char.
2855         Detect overflow in tab stop string.
2856         (next_file, main): Use EXIT_FAILURE/EXIT_SUCCESS instead of 1/0.
2857         (unexpand): Concatenate input files the same way expand does.
2858
2859         * src/touch.c (no_create, use_ref, posix_date, amtime_now,
2860         touch, main): Use bool for booleans.
2861         (main): Avoid integer overflow when given more than INT_MAX
2862         options.
2863         * src/tsort.c (struct item, n_strings): Use size_t for sizes.
2864         (have_read_stdin, count_items, scan_zeros, detect_loop,
2865         recurse_tree, walk_tree, tsort, main):
2866         Use bool for booleans.
2867         (exit_status): Remove.
2868         (tsort): Return a success flag instead of storing into a global.
2869         (main): Use it.
2870         * src/tty.c (silent, main): Use bool for booleans.
2871         (main): 0 -> STDIN_FILENO.
2872         * src/uname.c (print_element): Use bool for booleans.
2873
2874         * src/test.c (TRUE, FALSE, SHELL_BOOLEAN, TRUTH_OR, TRUTH_AND):
2875         Remove.  All uses replaced by C99 boolean primitives.
2876         (TEST_TRUE, TEST_FALSE): New constants, for readability.
2877         (test_unop, binop, unary_operator, binary_operator, two_arguments,
2878         three_arguments, posixtest, expr, term, and, or, is_int, age_of,
2879         one_argument, main): Use bool for booleans.
2880         (advance, unary_advance): Now inline procedures rather than a macros.
2881         (is_int): Renamed from isint, to avoid namespace clash with ctype.h.
2882         (term, and, or): When it's easy, loop instead of recursing.
2883         (term): Avoid integer overflow if there are INT_MAX-3 args (!).
2884         (binary_operator, unary_operator): Simplify by systematically rewriting
2885         true==FOO to FOO (where FOO is a boolean).
2886         (unary_operator): Don't consider a file to be a regular file
2887         merely because its mode&S_IFMT is zero.  Just use S_ISREG.
2888         Remove unnecessary casts.  Remove ifdefs for things like
2889         S_ISSOCK that are no longer needed, since stat-macros.h always
2890         defines them now.
2891
2892         * src/tac-pipe.c (buf_init_from_stdin, find_bol, tac_mem):
2893         Use bool for booleans.
2894         (buf_init_from_stdin, buf_free, find_bol, print_line):
2895         Use size_t for sizes.
2896         * src/tac.c (separator_ends_record, tac_seekable, tac_file,
2897         tac_stdin, tac_stdin_to_mem, main): Use bool for booleans.
2898         (match_length, G_buffer_size, tac_seekable, main): Use size_t for sizes.
2899         (tac_seekable): Use ptrdiff_t for pointer subtraction.
2900         Report an error if the result is out of range.
2901         (tac_seekable, main): Check for integer overflow in buffer size
2902         calculations.
2903         (main): Remove unnecessary casts.
2904
2905         * src/su.c (run_shell): Pass a new n_additional_args arg, so that
2906         the callee doesn't have to count 'em.  All callers changed.
2907         Don't allocate more space for the arg vector than we'll need.
2908         Use memcpy to copy the args rather than rolling our own loop.
2909         Use size_t for sizes.
2910         (fast_startup, simulate_login, change_environment, log_su,
2911         correct_password, restricted_shell, main): Use bool for booleans.
2912         (longopts): Don't assume change_environment is an int.
2913         Use NULL, not 0, for pointers.
2914         (xsetenv): New function, replacing xputenv and concat.
2915         All callers changed.
2916         (elements): Remove; no longer needed.
2917         (log_su, correct_passwd, main): Prefer !x to x==NULL.
2918         (log_su): 2 -> STDERR_FILENO.
2919         (modify_environment, main): Don't assume that getenv's returned value
2920         has an indefinite lifetime.
2921         (modify_environment): Allocate a larger environ.
2922         (main): Remove an impossible 'case 0'; if it happens now, it'll
2923         get diagnosed.  Don't assume getpwnam results outlive endpwent.
2924         Check for null or empty pw_name, pw_dir and for null pw_passwd.
2925
2926         * src/stty.c (VA_START): Remove.  All callers now use va_start.
2927         (_POSIX_VDISABLE): Remove unnecessary cast.
2928         (struct control_info, visible): Use cc_t for control chars.
2929         (struct control_info): Use size_t for sizes.
2930         (recover_mode, set_mode, display_speed, display_window_size,
2931         valid_options, main, display_changed):
2932         Use bool for booleans.
2933         (integer_arg): Return unsigned long int, not long int.
2934         Accept new max arg; all callers changed, to specify a maximum
2935         value for integer parameters instead of silently overflowing.
2936         (wrap): Do not overrun the stack buffer if the output contains
2937         more than 1024 bytes.  Instead, malloc a buffer.
2938         (main): Remove a "what is this?!?" FIXME.  Nobody knows what it is.
2939         Remove unnecessary casts.
2940         (set_control_char): Allow int values only up to cc_t range.
2941         (screen_columns): Don't reject INT_MAX.
2942         (display_changed, display_all, display_speed, recover_mode):
2943         Don't assume cc_t fits in int.
2944
2945         * src/remove.h: Add copyright notice.
2946         (struct rm_options): Use bool for booleans.
2947         * src/rmdir.c (empty_paths, ignore_fail_on_non_empty, verbose,
2948         errno_rmdir_non_empty, remove_parents, main): Likewise.
2949         * src/sum.c (have_read_stdin, bsd_sum_file, sysv_sum_file,
2950         main): Likewise.
2951         (main): Don't dump core if invoked with argv[0]==NULL.
2952         * src/tee.c (tee, append, ignore_interrupts, main, tee):
2953         Use bool for booleans.
2954         (tee): Use ssize_t for read returns.
2955
2956         * src/ptx.c: Add a FIXME mentioning that there are many
2957         unchecked integer overflows in this file.
2958         (gnu_extensions, auto_reference, input_reference, right_reference,
2959         ignore_case, initialize_regex, fix_output_parameters,
2960         output_one_roff_line, output_one_text_line, output_one_dumb_line, main):
2961         Use bool for booleans.
2962         (SKIP_SOMETHING, compare_words, digest_break_file,
2963         find_occurs_in_text, fix_output_parameters):
2964         Use to_uchar instead of a caset.
2965         (print_field): Rewrite to avoid cast.
2966
2967         * src/printf.c (posixly_correct): Use bool for booleans.
2968         (verify, main): Use EXIT_FAILURE/EXIT_SUCCESS instead of 1/0.
2969         (STRTOX): Rewrite to avoid casts.
2970         (print_esc_char): Arg is char, not int.
2971         * src/readlink.c (canonicalize): Remove.  All uses now merely inspect
2972         can_mode.
2973         (no_newline, verbose): Use bool for booleans.
2974         (can_mode): Now of type int; use -1 to denote otherwise-uninitialized.
2975         * src/shred.c (struct Options, main): Use bool for booleans.
2976         (isaac_seed_data, fillpattern, wipefile): Rewrite to avoid casts.
2977         * src/split.c (cwrite, bytes_split, lines_split, line_bytes_split):
2978         Use bool for booleans.
2979         * src/stat.c (G_fail): Remove.
2980         (print_statfs): Print various gotta-be-nonnegative values using
2981         unsigned long int, not long int or int.
2982         (do_statfs, do_stat): Return a boolean success flag.
2983         (do_stat, main): Use bool for booleans.
2984
2985         * src/pr.c: Add a FIXME mentioning that there are many
2986         unchecked integer overflows in this file.
2987         (TRUE, FALSE): Remove.  All uses replaced by true and false.
2988         (struct COLUMN, read_line, print_page, print_stored, open_file,
2989         skip_to_page, init_fps, parallel_files, align_empty_cols,
2990         empty_line, FF_only, explicit_columns, extremities, keep_FF,
2991         print_a_FF, print_a_header, use_form_feed, have_read_stdin,
2992         print_across_flag, storing_columns, balance_columns,
2993         truncate_lines, join_lines, untabify_input, failed_opens,
2994         numbered_lines, skip_count, use_esc_sequence, use_cntrl_prefix,
2995         double_space, ignore_failed_opens, use_col_separator,
2996         pad_vertically, last_line, main, init_parameters, skip_read,
2997         read_line, print_stored):
2998         Use bool for booleans.
2999         (struct COLUMN, char_to_clump, store_char, print_char):
3000         Use char for chars.
3001         (clump_buff, print_clump): Use char[], not int[], for an array whose
3002         elements are always chars.
3003         (first_last_page, main, getoptarg, balance, add_line_number,
3004         char_to_uclump): Remove unnecessary casts.
3005         (init_parameters): Allocate chars, not ints, for clump_buff.
3006         (print_char): Use to_uchar before invoking ISPRINT.
3007         (char_to_clump): Convert to unsigned char before invoking ISPRINT.
3008
3009         * src/nohup.c (main): Use bool for booleans.
3010         * src/paste.c (paste_parallel, paste_serial, main): Likewise.
3011         * src/pathchk.c (validate-path, main, portable_chars_only): Likewise.
3012         (portable_chars_only): Use to_uchar rather than a cast.
3013         * src/printenv.c (main): Use bool for booleans.
3014         Do not assume that the environ has at most one matching entry
3015         for each option (integer overflow was possible otherwise).
3016
3017         * src/od.c (FMT_BYTES_ALLOCATED): Now an enum, not a decimal
3018         constant.  Do not assume PRIdMAX etc. are strings of length 3 or
3019         less.
3020         (struct tspec): Use it.  fmt_string is now an array, not
3021         a pointer, as there's little point to the indirection here.
3022         (struct tspec, flag_dump_strings,
3023         traditional, flag_pseudo_start, limit_bytes_to_format,
3024         abbreviate_duplicate_blocks, have_read_stdin, simple_strtoul,
3025         decode_one_format, open_next_file, check_and_close,
3026         decode_format_string, skip, write_block, read_char, read_block,
3027         parse_old_offset, dump, dump_strings, main):
3028         Use bool for booleans.
3029         (struct tspec): Use void *, not char *, for generic pointers.
3030         (bytes_to_oct_digits, bytes_to_signed_dec_digits,
3031         bytes_to_unsigned_dec_digits, bytes_to_hex_digits):
3032         Use char, not unsigned int, since char suffices.
3033         (print_s_char, print_char, print_s_short, print_short,
3034         print_int, print_long, print_long_long, print_float,
3035         print_double, print_long_double): Rewrite to avoid casts.
3036         These now take void * arguments, instead of char *.
3037         Use the same body for all functions, except for the choice
3038         of type.  Assume C89 to simplify handling of signed char.
3039         (dump_hexl_mode_trailer, print_named_ascii, print_ascii):
3040         Rewrite to avoid casts.
3041         (print_named_ascii, print_ascii): Now takes void *, not char *.
3042         (decode_one_format): Use int for printf field widths, not
3043         unsigned int.  Pass void * to subsidiary printers,
3044         not char *.  Simplify handling of floating-point formats
3045         by factoring out common code dealing with precision and field width.
3046         (decode_format_string): Avoid need for temporary copy of
3047         each decoded struct tspec.
3048         (get_lcm): Remove unnecessary cast.
3049         (main): Fix bug where more than INT_MAX failed decodes were ignored.
3050
3051 2004-08-02  Paul Eggert  <eggert@cs.ucla.edu>
3052
3053         * src/nl.c (TRUE, FALSE): Remove; all uses changed to true, false.
3054         (enum number_format): Remove.
3055         (FORMAT_RIGHT_NOLZ, FORMAT_RIGHT_LZ, FORMAT_LEFT): Now strings,
3056         not enum values.
3057         (DEFAULT_SECTION_DELIMITERS): Now an array constant, not a macro.
3058         (section_del): Now const.
3059         (print_fmt): Remove.
3060         (starting_line_number, page_incr, blank_join, line_no,
3061         print_lineno, proc_text, main):
3062         Use intmax_t for line numbers.
3063         (reset_numbers, have_read_stdin, build_type_arg, nl_file, main):
3064         Use bool for booleans.
3065         (lineno_format): Now a string, not an enum value.
3066         (build_print_fmt): Remove.  All calls removed.  This work is
3067         now done within print_lineno.
3068         (build_type_arg): Use size_t for sizes.
3069         (print_lineno): Check for line number overflow.
3070         (proc_text, main): Remove unnecessary cast.
3071
3072         * src/ln.c (symbolic_link, interactive, remove_existing_files,
3073         verbose, hard_dir_link, dereference_dest_dir_symlinks,
3074         do_link, main): Use bool for booleans.
3075
3076         * src/ls.c (struct fileinfo, file_interesting,
3077         extract_dirs_from_files, color_symlink_as_referent,
3078         FILE_OR_LINK_MODE, sort_reverse, print_owner, print_group,
3079         numeric_ids, print_block_size, dired, print_with_color,
3080         check_symlink_color, print_inode, recursive, immediate_dirs,
3081         all_files, really_all_files, qmark_funny_chars,
3082         print_dir_name, format_needs_stat, format_needs_type, visit_dir,
3083         main, decode_switches, parse_ls_color, print_dir, file_interesting,
3084         gobble_file, make_link_path, basename_is_dot_or_dotdot,
3085         extract_dirs_from_files, print_long_format):
3086         Use bool for booleans.
3087         (dir_defaulted): Remove; no longer needed.
3088         (main): Use int to count files, since it suffices for argv.
3089         Rewrite to avoid need for dir_defaulted.
3090         (main, print_dir, gobble_file, get_link_name,
3091         xstrcoll):
3092         Set exit status to EXIT_SUCCES/EXIT_FAILURE rather than 0/1.
3093         (decode_switches): Put back check for ws.ws_col <= SIZE_MAX.
3094         Remove unnecessary cast to int.  Use int instead of unsigned
3095         int to count from 0 to 1.
3096         (get_funky_string, print_type_indicator): Use char for bytes, not int.
3097         (make_link_path): Use NULL for null pointers.
3098         (quote_name): Use to_uchar instead of cast.
3099
3100         * src/id.c (use_name, main, print_user, xgetgroups, print_group_list,
3101         print_full_info): Use bool for booleans.
3102         (problems): Remove, replacing with....
3103         (ok): New var (inverted from old sense).
3104         (print_user, print_group, print_full_info):
3105         Print uids/gids with %lu, not %u.
3106         (xgetgroups): Don't run out of memory if getgroups or getugroups
3107         returns -1.
3108         * src/setuidgid.c (main): Print uids/gids with %lu, not %ld.
3109
3110         * src/factor.c (wheel_tab): Use unsigned char instead of unsigned
3111         int, since it suffices.
3112         (factor, print_factors): Use size_t for sizes.
3113         (print_factors, do_stdin, main): Use bool for booleans.
3114         * src/fold.c (TAB_WIDTH): New macro; use it instead of "8".
3115         (fold_file, main): Use bool for booleans.
3116         (fold_file, main): Use size_t for sizes.
3117         (main): Allow -w options up to SIZE_MAX - TAB_WIDTH - 1, instead
3118         of prohibiting widths greater than INT_MAX.
3119         * src/head.c (presume_input_pipe, print_headers, have_read_stdin,
3120         write_header, elide_tail_bytes_pipe, elide_tail_bytes_file,
3121         elide_tail_lines_pipe, elide_tail_lines_seekable,
3122         elide_tail_lines_file, head_bytes, head_lines, head, head_file,
3123         string_to_integer, main):
3124         Use bool for booleans.
3125         (main): Rewrite to avoid cast.
3126
3127         * src/csplit.c (struct line): Use size_t for sizes.
3128         (main): Remove unnecessary cast.
3129         * src/cut.c (cut_fields): Use to_uchar rather than a cast.
3130         * src/cut.c (cut_file, main): Use bool for booleans.
3131         * src/date.c (show_date, rfc_format, batch_convert, main): Likewise.
3132         * src/env.c (main): Likewise.
3133         * src/expr.c (nextarg): Likewise.
3134         * src/env.c (main): Remove unused and nonstandard envp arg.
3135
3136         * src/fmt.c (COST, MAXWORDS): Add a comment describing some of
3137         fmt's arbitrary limits.
3138         (TRUE, FALSE): Remove; all uses changed to (true, false).
3139         (main): Use bool for booleans.
3140         Limit maximum width to MAXCHARS / 2.  Use xstrtoul, not xstrtol,
3141         to parse width.
3142         (copy_rest): Remove unnecessary cast.
3143         (get_prefix): Rewrite to avoid cast.
3144         (check_punctuation): Use char *, not unsigned char *; C89 requires
3145         this.  Avoid off-by-one buffer read overrun when line is empty.
3146         (flush_paragraph): Don't assume wptr-parabuf is <= INT_MAX.
3147         Remove unnecessary casts.
3148         * tests/fmt/basic (wide-1, wide-2, bad-suffix): Adjust to above
3149         changes.
3150
3151         * src/expand.c (convert_entire_line, have_read_stdin, parse_tabstops,
3152         next_file, expand, main):
3153         Use bool for booleans.
3154         (tab_size, tab_list, add_tabstop, parse_tabstops, validate_tabstops,
3155         expand, main):
3156         Use uintmax_t for column counts.
3157         (add_tabstop): Don't reserve -1 (now UINTMAX_MAX) as a special value.
3158         All callers changed.
3159         (parse_tabstops): Don't pass a negative char to isblank.
3160         Avoid memory leak with large tab stops.
3161         (validate_tabstops, expand): Don't assume number of tab stops is
3162         <= INT_MAX.
3163         (next_file, main): Use EXIT_SUCCESS/EXIT_FAILURE rather than 0/1 when
3164         storing values into exit_status.
3165         (expand): Use same pattern as unexpand for reading chars.
3166         Report an error when input line is too long, instead of silently
3167         screwing up.  Do not mishandle tab stops when backspacing left
3168         over start of line.
3169
3170         * src/dircolors.c (have_read_stdin, append_quoted,
3171         dc_parse_stream, dc_parse_file, main): Use bool for booleans.
3172         (dc_parse_stream): Use enum for state, rather than int.
3173         Use ssize_t to store getline result.
3174
3175         * src/dd.c (translation_needed, parse_integer, scanargs,
3176         apply_translations, char_is_saved, swab_buffer, skip_via_lseek):
3177         Use bool for booleans.
3178         (translate_buffer): Use to_uchar rather than a cast.
3179         (swab_buffer, copy_simple, copy_with_unblock):
3180         Use size_t for sizes.
3181
3182         * src/seq.c (equal_width, valid_format, main): Use bool for booleans.
3183         * src/sleep.c (apply_suffix): Likewise.
3184         * src/tail.c (struct File_spec, reopen_inaccessible_files, count_lines,
3185         forever, from_start, print_headers, have_read_stdin, valid_file_spec,
3186         write_header, file_lines, pipe_lines, pipe_bytes, recheck,
3187         tail_forever, tail_bytes, tail_lines, tail, tail_file,
3188         parse_obsolescent_option, parse_options, main): Likewise.
3189         * src/sleep.c (apply_suffix): Invert sense of result.
3190         Use int (not unsigned int) for multiplier, as this generates better
3191         code with some compilers.  Simplify code a bit.
3192         * src/tail.c (struct File_spec, max_n_unchanged_stats_between_opens,
3193         parse_options): Use uintmax_t, not unsigned int or unsigned long int,
3194         for state counters.
3195         (tail_bytes, tail_lines): Redo test of return value (-1, 0, 1) to
3196         make it a bit clearer.
3197
3198         * src/hostname.c: Include "xgethostname.h".
3199         (xgethostname): Remove decl; xgethostname.h has it.
3200         (sethostname) [!defined(HAVE_SETHOSTNAME) && defined(HAVE_SYSINFO)
3201         && defined (HAVE_SYS_SYSTEMINFO_H) && defined(HAVE_LIMITS_H)]: Use
3202         prototypes rather than K&R form.  Assume any negative value from
3203         sysinfo denotes failure, not just -1.
3204         (main): Simplify use of sethostname.
3205
3206         * src/pinky.c (include_idle, include_heading, include_fullname,
3207         include_project, include_plan, include_home_and_shell, do_short_format,
3208         include_where, main): Use bool for booleans.
3209         (count_ampersands, create_fullname, scan_entries, short_pinky):
3210         Use size_t for sizes.
3211         (create_fullname): Check for overflow in size calculations.
3212         (idle_string): Don't assume that the number of idle days
3213         is less than 10**8 and/or INT_MAX/(24*60*60).
3214         (main): No need to pass a non-NULL last arg to getopt_long.
3215         * src/uptime.c (print_uptime, uptime): Use size_t for sizes.
3216         (print_uptime): Remove unused local variable.
3217         (main): No need to pass a non-NULL last arg to getopt_long.
3218         * src/users.c (list_entries_users, users): Use size_t for sizes.
3219         (list_entries_users): Use char for bytes.
3220         (main): No need to pass a non-NULL last arg to getopt_long.
3221         * src/who.c (do_lookup, short_list, short_output, include_idle,
3222         include_heading, include_mesg, include_exit, need_boottime,
3223         need_deadprocs, need_login, need_initspawn, need_clockchange,
3224         need_runlevel, need_users, my_line_only, main): Use bool for booleans.
3225         (print_runlevel): Use unsigned char for bytes.
3226         (list_entries_who, scan_entries, who): Use size_t for sizes.
3227         (main): No need to pass a non-NULL last arg to getopt_long.
3228
3229         * src/install.c (isdir): Remove decl.
3230         (install_file_to_path): Rely on make_path to fail if the destination
3231         is not a directory, by passing preserve_existing==true to it.
3232         Hence we no longer need to call isdir.
3233         Free dest_dir immediately when it's no longer needed, rather than
3234         waiting until the end of the function.
3235         (copy_file): Don't bother calling isdir, as copy will do the
3236         right thing if the destination is a directory.
3237
3238         * src/du.c (fts_debug, opt_all, apparent_size, opt_count_all,
3239         print_grand_total, opt_separate_dirs, hash_ins, process_file, main):
3240         Use bool for booleans.
3241         (max_depth): Now size_t, not int, to avoid an arbitrary limit
3242         of INT_MAX on depth.
3243         (G_fail): Remove: no longer needed, now that the relevant
3244         functions return bool.
3245         (process_file): Use return value to signal success rather than
3246         setting a global.  Remove first_call static var; not needed, since
3247         we can look at n_alloc.  Use size_t for depths.  Remove FIXME
3248         about size_t casts, as it's now fixed.  Use xnrealloc rather
3249         than the obsolescent XREALLOC.  Don't bother to check whether
3250         reallocation is needed unless level > prev_level.
3251         (du_files): Invert sense of result, for consistency with
3252         other coreutils code.  All callers changed.
3253         (main): Allow --max-depth values up to SIZE_MAX.
3254
3255         * src/df.c (inode_format, show_all_fs, show_local_fs,
3256         show_listed_fs, posix_format, require_sync, print_type,
3257         selected_fstype, excluded_fstype, show_dev, show_point, main):
3258         Use bool for booleans.
3259         (df_readable, show_dev): Use UINTMAX_MAX instead of -1.
3260         (show_dev, show_point, main):
3261         Use EXIT_SUCCESS/EXIT_FAILURE instead of 0/1.
3262         Don't assume disk name lengths are <= INT_MAX.
3263         Rewrite pct calculation to avoid cast.
3264         (show_point): Don't assume resolved length is <= SSIZE_MAX.
3265
3266         * src/cut.c (hash_int) [!defined UINTPTR_MAX]: Use size_t
3267         instead of uintptr_t.
3268         * src/shred.c (UINT_MAX_32_BITS): Remove.
3269         (word32): Remove.  All uses changed to uint32_t.
3270         (isaac_seed_data): Remove unnecessary cast.
3271         * src/system.h (ptr_align): Use size_t; in practice, this is just as
3272         good as uintptr_t in checking for alignments, and has fewer
3273         configuration hassles.
3274
3275         * src/Makefile.am (localedir.h): Make it readonly; this
3276         undoes part of the 2004-07-27 patch.
3277
3278 2004-07-30  Paul Eggert  <eggert@cs.ucla.edu>
3279
3280         * src/sort.c (UCHAR): Remove; all uses changed to to_uchar.
3281         (IS_THOUSANDS_SEP): Use bool when appropriate.
3282         (numcompare, main): Use char, not int, when the value is always a char.
3283         (numcompare): Remove "register"; compilers are smart enough these days.
3284         * src/system.h (errno, CHAR_BIT): Remove decls;
3285         no longer needed now we assume C89 or better.
3286         Include <inttypes.h> before <stdint.h>, as it's the
3287         Autoconf-recommended pattern.
3288         (to_uchar): New inline function, moved here from tr.c.
3289         Use full names for int types, e.g. "long int" rather than "long".
3290         * src/tr.c (to_uchar): Remove; now in system.h.
3291         (is_char_class_member): Use bool when appropriate.
3292
3293         * src/mkdir.c (create_parents, main): Use bool when appropriate.
3294         (main): Use EXIT_SUCCESS/EXIT_FAILURE instead of 0/1.
3295
3296 2004-07-29  Paul Eggert  <eggert@cs.ucla.edu>
3297
3298         * src/mkfifo.c (main): Use EXIT_SUCCESS and EXIT_FAILURE, not 0 and 1.
3299
3300         * src/chmod.c (recurse, force_silent, process_file, process_files,
3301         main): Use bool when appropriate.
3302         * src/cksum.c (cksum, main): Likewise.
3303         * src/comm.c (hard_LC_COLLATE, only_file_1, only_file_2, both,
3304         compare_files, main): Likewise.
3305
3306         * src/copy.h (struct cp_options): Likewise.
3307         * src/copy.c (copy_internal, is_ancestor, copy_dir, copy_reg,
3308         same_file_ok, seen_file, copy_internal, valid_options, copy): Likewise.
3309         * src/cp-hash.h (remember_created): Likewise.
3310         * src/cp-hash.c (remember_created): Likewise.
3311         * src/cp.c (struct dir_attr, flag_path, remove_trailing_slashes,
3312         re_protect, make_path_private, target_directory_operand, do_copy,
3313         cp_option_init, decode_preserve_arg, main): Likewise.
3314         * src/install.c (isdir, change_timestamps, change_attributes,
3315         copy_file, install_file_to_path, install_file_in_dir,
3316         install_file_in_file, strip_files, dir_arg, cp_option_init, main,
3317         change_attributes, change_timestamps): Likewise.
3318         * src/mv.c (remove_trailing_slashes, rm_option_init,
3319         cp_option_init, do_move, movefile, main): Likewise.
3320         * src/remove.c (right_justify), full_filename_, AD_pop_and_chdir,
3321         AD_push, prompt, remove_dir): Likewise.
3322         * src/rm.c (rm_option_init, main): Likewise.
3323
3324         * src/remove.c (top_dir, pop_dir, full_filename_):
3325         Use size_t for sizes.
3326         * src/cp.c (target_directory_operand): Do not clear *NEW_DST if stat
3327         succeeds.  It's not necessary in that case, as *NEW_DST is always
3328         false already.
3329         (do_copy): Rewrite slightly to avoid need for "unreachable" comment.
3330         (main): Use EXIT_SUCCESS, EXIT_FAILURE instead of 0, 1.
3331         * src/rm.c (main): Likewise.
3332
3333         md5sum, sha1sum integer cleanups.
3334
3335         * src/checksum.h: Don't include config.h, sys/types.h, stdio.h:
3336         not needed.
3337         (ALG_UNSPECIFIED): Remove.
3338         (ALG_MDT): Don't make it equal to CHAR_MAX + 1; this isn't necessary.
3339         * src/md5.c: Don't include any files other than checksum.h.
3340         * src/sha1sum.c: Likewise.
3341         * src/md5sum.c (OPENOPTS, have_read_stdin, status_only, warn,
3342         bsd_split_3, split_3, hex_digits, digest_file, digest_check, main):
3343         Use bool when appropriate.
3344         (digest_check): Increase limit of number of input lines to
3345         UINTMAX_MAX from INT_MAX.  Diagnose any overflows of this counter.
3346         Use ngettext instead of hard-to-i18nize hardcoded stuff for plurals.
3347
3348 2004-07-28  Paul Eggert  <eggert@cs.ucla.edu>
3349
3350         * src/cat.c (exit_status): Remove.  Now done by passing a boolean
3351         'ok' flag around.
3352         (simple_cat, cat): Return true if successful.  All callers changed.
3353         (simple_cat, cat, main): Use bool for booleans.
3354         (simple_cat): Use size_t for sizes.
3355         (cat, main): Use the same names for parameters that we use for
3356         long options, to avoid confusion.  This inverts the sense of the
3357         show_tabs (formerly output_tabs) and number_nonblank
3358         (formerly numbers_at_empty_lines) variables.
3359         (main): Don't mess up (due to integer overflow) if we are given
3360         INT_MAX - INT_MIN + 1 options.
3361         [O_BINARY]: Don't invoke isatty unless the other options require it.
3362         (main): When deciding whether to use simple_cat, don't worry
3363         about binary option; it's irrelevant.
3364
3365         * src/dcgen: Remove comments, trailing white space, and empty
3366         lines from the output strings, to save space.
3367         Use a narrower type like 'unsigned char' for line lengths, if
3368         that will do.
3369         Make the output variables static, not extern.
3370
3371         * src/chgrp.c (parse_group): Require base 10 when parsing
3372         groups as integers.
3373         (main): int -> bool when appropriate.
3374         * src/chown.c (main): Likewise.
3375         * src/chown-core.c: Include inttostr.h.
3376         (UINT_MAX_DECIMAL_DIGITS, uint_to_string): Remove.
3377         (gid_to_name, uid_to_name): Use imaxtostr/umaxtostr
3378         instead of uint_to_string).
3379         (describe_change): Instead of an int flag, use a char *
3380         auxiliary; this avoids the need for casts.
3381         Assume free (NULL) works.
3382         (change_file_owner): Return true/false, not 0/-1, since
3383         we don't set errno.  All callers changed.
3384         Use bool when appropriate.
3385         (chown_files): Likewise.
3386         * src/chown-core.h (chown_files): Likewise.
3387
3388         * tests/chown/basic: Test for proper handling of uids like
3389         "010", which must be parsed as decimal.
3390
3391         * tests/misc/pwd: Don't assume that Perl's getpwd agrees with our
3392         pwd when there are multiple names for the working directory
3393         (which can happen with an automounter, sigh).
3394
3395         * src/Makefile.am ($(SCRIPTS)): Don't depend on Makefile;
3396         this causes Solaris 8 'make' to refuse to build "groups".
3397         (localedir.h): Don't depend on Makefile: this causes Solaris
3398         8 'make' to build localedir.h unnecessarily.  The dependence
3399         on Makefile is ineffective anyway, since $(localedir) might
3400         change even if Makefile hasn't.
3401
3402         * src/remove.c (remove_dir): If we can't save the state of the
3403         working directory, pretend we started from "/", not ".".
3404         This avoids a bug on hosts like Solaris that don't let you
3405         remove the working directory.
3406
3407 2004-07-27  Paul Eggert  <eggert@cs.ucla.edu>
3408
3409         * src/printf.c (strtiomax, strtoumax): Declare if not already
3410         declared: this fixes a portability bug with Solaris 8 + GCC.
3411         (STRTOX): Parenthesize use of macro arg as expression.
3412         (vstrtoimax, vstrtoumax, vstrtold): Remove now-unnecessary
3413         parentheses.
3414         * configure.ac: Check for declaration of strtoumax, for
3415         src/printf.c.
3416
3417         * src/Makefile.am (cp_LDADD, ginstall_LDADD, mv_LDADD,
3418         pathchk_LDADD, rm_LDADD, test_LDADD): New vars, for eaccess.
3419
3420         * tests/readlink/can-e: Don't assume that we can remove the
3421         working directory: this isn't possible under Solaris 8, say.
3422         * tests/readlink/can-f: Likewise.
3423         * tests/readlink/can-m: Likewise.
3424
3425         * src/copy.c (copy_internal): find_backup_file_name no longer
3426         returns NULL, so don't bother to check for this.
3427         * src/cp.c (do_copy): Likewise.
3428         * src/ln.c (do_link): Likewise.
3429
3430 2004-07-25  Paul Eggert  <eggert@cs.ucla.edu>
3431
3432         * src/nice.c (GET_NICE_VALUE): Renamed from GET_PRIORITY.
3433         All uses changed.
3434         (NZERO): New macro, if system doesn't define it already.
3435         (usage): Distinguish priorities from nice values.
3436         Don't assume NZERO is 20.
3437         (main): Use bool instead of int where appropriate.
3438         If user specifies an adjustment out of range, always truncate it
3439         to an inrange value instead of sometimes giving an error message
3440         and sometimes not.
3441         Do not assume that -1 is an error return from "nice" or
3442         "getpriority", as it might be the current nice value minus NZERO.
3443         If nice/setpriority fails with errno == EPERM, go ahead and run
3444         the command anyway; POSIX requires this.
3445
3446         * src/pathchk.c: Include euidaccess.h.
3447         (dir_ok): Use euidaccess, not access.
3448         * src/test.c (R_OK, W_OK, X_OK, FOK): Remove; system.h defines them.
3449         (eaccess): Remove.  All users changed to use euidaccess instead.
3450
3451 2004-07-24  Paul Eggert  <eggert@cs.ucla.edu>
3452
3453         * src/uptime.c (print_uptime) [defined BOOT_MSG]:
3454         Don't assume ut_line is null-terminated.
3455         * src/who.c (print_line): New arguments USERLEN and LINELEN,
3456         since USER and LINE might not be null terminated.  All callers
3457         changed.
3458
3459 2004-07-23  Paul Eggert  <eggert@cs.ucla.edu>
3460
3461         Fix bug with "tail -f" reported by Rob Holland in
3462         <http://lists.gnu.org/archive/html/bug-coreutils/2004-07/msg00054.html>.
3463         Also, remove the undocumented and unsupported-since-2000
3464         --max-consecutive-size-changes options.  Fix another related bug:
3465         "tail" got confused if stdin, stdout, or stderr were closed.
3466         Also, use output buffering even with "tail -f".
3467
3468         * NEWS: Document this, plus yesterday's patch.
3469         * doc/coreutils.texi (tail invocation): "size has remained the same"
3470         -> "file has not changed", which is more accurate for fifos.
3471         * src/tail.c: Include fcntl-safer.h.
3472         (COPY_TO_EOF): Set to UINTMAX_MAX, not OFF_T_MAX (which was wrong).
3473         (COPY_A_BUFFER): New macro.
3474         (struct File_spec): New members mtime, mode, blocking.
3475         Remove member n_consecutive_size_changes.
3476         (DEFAULT_MAX_N_CONSECUTIVE_SIZE_CHANGES,
3477         max_n_consecutive_size_changes_between_opens,
3478         MAX_CONSECUTIVE_SIZE_CHANGES_OPTION): Remove.
3479         (long_options, tail_forever, parse_options):
3480         Remove (non-)support for --max-consecutive-size-changes.
3481         (record_open_fd): New function.
3482         (recheck, tail_file): Use it.  Don't assume that stdin is open.
3483         (dump_remainder): Add support for new COPY_A_BUFFER special value.
3484         Treat errno==EAGAIN like EOF, since it might be a nonblocking read.
3485         (recheck): New arg BLOCKING, specifying whether to use blocking reads.
3486         All uses changed.
3487         (n_live_files): Remove, replacing with...
3488         (any_live_files): New function.  All uses changed.
3489         (tail_forever): Use nonblocking I/O unless we know that blocking I/O
3490         is safe; this avoids some hangs when reading from a fifo.
3491         Avoid invoking fstat or sleep when using blocking I/O.
3492         Do not check for changes to size if the file is not a regular file,
3493         as the size is undefined in that case.
3494         Check for changes to mtime or mode, too; this works for non-regular
3495         files.
3496         (tail_forever, main): Redo fflush strategy to work even when input
3497         is nonblocking.  Don't use unbuffered output; just flush when needed.
3498
3499 2004-07-22  Paul Eggert  <eggert@cs.ucla.edu>
3500
3501         * src/tail.c (main): Ignore -f if no file operand is specified
3502         and standard input is a pipe.
3503         * doc/coreutils.texi (tail invocation): Do not ignore -f for
3504         all pipes, just for when standard input is a pipe and no
3505         file operand is specified.
3506         * tests/tail/Test.pm: Reinstate f-1 test, since we now pass.
3507         Add a new commented-out f-2 test, which we still fail.
3508         (test_vector): All f-* tests are special cases, not just f-1.
3509
3510 2004-07-12  Paul Eggert  <eggert@cs.ucla.edu>
3511
3512         * src/uptime.c: Include c-strtod.h.
3513         (print_uptime): Use c_strtod instead of setlocale and sscanf.
3514         Use long int rather than int to count days (for 64-bit hosts),
3515         and check for arithmetic overflow when converting double to time_t.
3516
3517 2004-07-11  Paul Eggert  <eggert@cs.ucla.edu>
3518
3519         * src/printf.c (vstrtold): Renamed from vstrtod.
3520         Now returns long double.  All uses changed.
3521         (print_direc): Use "L" length modifier when printing floating point
3522         numbers, since we're now printing long double.
3523
3524 2004-07-06  Paul Eggert  <eggert@cs.ucla.edu>
3525
3526         printf cleanup, to avoid undefined behavior, to add support for
3527         formats that Bash supports, and to support wide integers like
3528         Bash does.
3529
3530         * NEWS: Document this.
3531         * src/printf.c (UNSPECIFIED): Remove.  All uses now replaced by
3532         booleans, so that we don't reserve any values for precision or
3533         width (like Bash).
3534         (STRTOX): Use prototype, not K&R-style definition.
3535         (vstrtoimax): Renamed from xstrtol (to avoid confusion with xstrtol
3536         in ../lib), with type change to intmax_t.
3537         All uses changed.
3538         (vstrtoumax): Renamed from xstrtoul, with type change to uintmax_t.
3539         All uses changed.
3540         (vstrtod): Renamed from xstrtod.  All uses changed.
3541         (print_direc): Use boolean arg instead of special value to indicate
3542         a missing precision or width.  LENGTH no longer includes
3543         length modifiers or conversion character.  New arg CONVERSION
3544         now specifies conversion character.
3545         Use intmax_t-width formatting for integers (like Bash).
3546         Add support for C99 %a, %A, %F (like Bash).
3547         Add support for field width with %c (POSIX requires this).
3548         Add a FIXME for lack of support for field width and precision
3549         for %b.
3550         Add support for '\'', '0' flags.
3551         Check for invalid combinations of flags, field width, precision,
3552         and conversion, to prevent use of undefined behavior.
3553         Allow multiple length modifiers, for formats like "%lld" (like Bash).
3554         Add support for C99 'j', 't', 'z' length modifiers (like Bash).
3555         In error message, output entire invalid conversion specification,
3556         instead of merely outputting % followed by the conversion char.
3557         * tests/misc/printf: Add tests for the above.
3558
3559 2004-04-03  Dmitry V. Levin  <ldv@altlinux.org>
3560
3561         Change "readlink -f" to be more compatible with prior implementations.
3562         Add more canonicalize options, -e and -m.
3563         Add comprehensive tests for all readlink modes.
3564
3565         * m4/canonicalize.m4 (AC_FUNC_CANONICALIZE_FILE_NAME):
3566         Do not add canonicalize.c here.
3567
3568         * src/readlink.c (longopts): Add new options.
3569         (usage): Document them.
3570         (canonicalize_fname): New proxy function.
3571         (main): Handle new options.
3572         * doc/coreutils.texi (readlink invocation): Document new
3573         "readlink -f" behaviour and new canonicalize options, -e and -m.
3574
3575         * configure.ac (AC_CONFIG_FILES): Add tests/readlink/Makefile.
3576         * tests/Makefile.am (SUBDIRS): Add readlink.
3577         * tests/readlink/Makefile.am: New file.
3578         * tests/readlink/{rl-1,can-e,can-f,can-m}: New readlink tests.
3579         * tests/misc/Makefile.am (TESTS): Remove basic readlink test.
3580         * tests/misc/readlink: Remove file.
3581
3582 2004-07-04  Jim Meyering  <jim@meyering.net>
3583
3584         * src/copy.c (copy_internal): Add a FIXME comment.
3585
3586 2004-07-02  Paul Eggert  <eggert@cs.ucla.edu>
3587
3588         * src/copy.c (copy_dir): Assume path_concat returns non-NULL.
3589         * src/cp.c (do_copy): Likewise.
3590         * src/mv.c (movefile): Likewise.
3591
3592         * src/cp.c (make_path_private): 2nd arg is now size_t, not int,
3593         to avoid problem when path_concat dir name is longer than 2 GiB (!).
3594
3595         * src/nohup.c (main): Don't pass NULL first argument to path_concat.
3596         This cleans up the semantics a bit, as we no longer try to open the
3597         same file twice.
3598
3599 2004-07-01  Paul Eggert  <eggert@cs.ucla.edu>
3600
3601         * NEWS: Add short names -t and -T for --target-directory
3602         and --no-target-directory options, respectively.
3603
3604         * src/cp.c (NO_TARGET_DIRECTORY_OPTION, TARGET_DIRECTORY_OPTION):
3605         Remove.  All uses changed to 'T' and 't', respectively.
3606         * src/install.c, src/ln.c, src/mv.c: Likewise.
3607
3608         * src/cp.c (long_opts, usage, do_copy, main): Add -t and -T as
3609         aliases for --target-directory and --no-target-directory,
3610         respectively.
3611         * src/install.c (long_options, main, usage): Likewise.
3612         * src/ln.c, src/mv.c: Likewise.
3613
3614 2004-07-01  Jim Meyering  <jim@meyering.net>
3615
3616         * Makefile.maint (sc_file_system): New target.
3617         (syntax-check-rules): Add it.
3618         .x-sc_file_system: New file.
3619         * Makefile.am (EXTRA_DIST): Add it.
3620
3621         * man/sync.x: Use "file system" rather than "filesystem".
3622         * man/stat.x, man/df.x: Likewise.
3623
3624 2004-06-30  Paul Eggert  <eggert@cs.ucla.edu>
3625
3626         * src/df.c (usage, main): Output "file system" rather than
3627         "filesystem".
3628         * src/du.c (usage): Likewise.
3629         * src/shred.c (usage): Likewise.
3630         * src/stat.c (usage): Likewise.
3631         * src/stat.c (long_options, usage): Rename "--filesystem" to
3632         "--file-system".  But keep the old name around, for compatibility
3633         reasons.
3634
3635 2004-06-29  Paul Eggert  <eggert@cs.ucla.edu>
3636
3637         Add support for --no-target-directory option.
3638
3639         * NEWS: Document it.
3640         * doc/coreutils.texi (Common options, Target directory, cp
3641         invocation, install invocation, mv invocation, ln invocation):
3642         Likewise.
3643         (link invocation): Explain how to rewrite link using ln now
3644         that we have --no-target-directory.
3645         (ln invocation): Explain that --no-target-directory subsumes
3646         --no-dereference.
3647         (unlink invocation): Modify wording to match new wording in
3648         link invocation.
3649
3650         * src/cp.c (NO_TARGET_DIRECTORY_OPTION): New constant.
3651         (long_opts, usage, do_copy, main): Add support for
3652         --no-target-directory,
3653         * src/install.c (NO_TARGET_DIRECTORY_OPTION, long_options, main,
3654         usage): Likewise.
3655         * src/ln.c (NO_TARGET_DIRECTORY_OPTION, long_options, usage,
3656         main): Likewise.
3657         * src/mv.c (NO_TARGET_DIRECTORY_OPTION, long_options, usage,
3658         main): Likewise.
3659         * src/mv.c (enum): Sort values.
3660
3661 2004-06-29  Jim Meyering  <jim@meyering.net>
3662
3663         Don't let verbose-mode output from a subshell obscure actual differences.
3664         * tests/rm/inaccessible: Turn off command-echoing just before
3665         invoking subshell, then turn it back on if VERBOSE=yes afterward.
3666
3667 2004-06-25  Paul Eggert  <eggert@cs.ucla.edu>
3668
3669         Add support for 'install --target-directory', an option
3670         that has been documented for years but not implemented (!).
3671         * doc/coreutils.texi (install invocation): Document
3672         --target-directory in synopsis, too.
3673         * src/install.c (TARGET_DIRECTORY_OPTION): New var.
3674         (long_options, main, usage): Add --target-directory.
3675         (target_directory_operand): New function, stolen from mv.c.
3676         (main): Use it.  Check for -d and --target-directory.
3677         Alter wording of diagnostics to match other programs.
3678
3679 2004-06-28  Jim Meyering  <jim@meyering.net>
3680
3681         * src/cp.c (usage): Fix copy+paste error in description of
3682         --target-directory: s/move/copy/.  From Paul Jarc.
3683
3684 2004-06-27  Paul Eggert  <eggert@cs.ucla.edu>
3685
3686         Use more-consistent rules among cp, ln, and mv when dealing with
3687         last operands that are (or look like) directories.
3688
3689         * src/cp.c (target_directory_operand): New, nearly-common function,
3690         It reports an error if the destination appears to be a directory
3691         (e.g., because it has a trailing slash) but is not.
3692         * src/ln.c, src/mv.c: Likewise.
3693         * src/cp.c (do_copy): Use it.
3694         * src/ln.c (main): Likewise.
3695         * src/mv.c (main): Likewise.
3696
3697         * src/cp.c (do_copy): Don't assume argc is positive.
3698         Don't bother to lstat dest, since copy() will do that for us.
3699         Use "const" to avoid the need for cast.
3700
3701         * src/cp.c (do_copy): Don't output a usage message because of file
3702         problems (e.g., an operand is not a directory).  Use it only for
3703         syntax.  Standardize on "target %s is not a directory" for the
3704         diagnostic.
3705         * src/ln.c (main): Likewise.
3706         * src/mv.c (main): Likewise.
3707
3708         * src/cp.c (do_copy): Remove test for trailing slash, since
3709         target_directory_operand now does this.
3710         * src/ln.c (main): Likewise.
3711         * src/mv.c (movefile): Likewise.
3712
3713         * src/cp.c (main): Reject multiple target directories.
3714         Check whether a specified target is a directory when parsing the
3715         options, using stat.  This gives more-accurate diagnostics.
3716         * src/ln.c (main): Likewise.
3717
3718         * src/ln.c (isdir): Remove decl; no longer needed.
3719         * src/mv.c (isdir, lstat): Likewise.
3720
3721         * src/ln.c (do_link): New arg dest_is_dir.  All uses changed.
3722         Don't check the destination ourself; rely on dest_is_dir.
3723         This way we can avoid lstatting the destination in the
3724         usual case, and in the worst case we lstat 1, not 3 times.
3725         Don't bother to unlink unless link failed; this saves a syscall.
3726         Remove unnecessary backup_succeeded flag;
3727         it was identical to "dest_backup != NULL".
3728
3729         * src/ln.c (main): Use int to count to argc, not unsigned int.
3730         This handles negative operand counts.
3731         * src/mv.c (main): Likewise.
3732
3733         * src/mv.c (do_move): Don't call hash_init; expect the caller to
3734         do it, for consistency with cp.c and ln.c.  All callers changed.
3735         (movefile): dest_is_dir parameter is now bool, not int.
3736         (main): Standardize on "missing destination file operand after %s"
3737         for the diagnostic, for consistency with cp.c.
3738
3739         * tests/mv/diag: Don't assume "mv --target=nonexistentdir"
3740         will complain about the arg count.
3741         Adjust to new (briefer) diagnostics.
3742         * tests/cp/fail-perm: Add a test to verify that we get the new
3743         diagnostic when failing to copy through a symlink-to-inaccessible-dir.
3744
3745 2004-06-27  Paul Eggert  <eggert@cs.ucla.edu>
3746
3747         Fix a bug: formerly, if d/x was a directory and x a file, "ln x
3748         d/" incorrectly created a link d/x/x.  It also saves some system
3749         calls.
3750
3751         * NEWS: Document the fix.
3752
3753         * src/ln.c (main): Don't append basename to dest if this
3754         results in an existing directory name.
3755         * tests/ln/misc: See whether a trailing slash is followed too far.
3756
3757 2004-06-26  Jim Meyering  <jim@meyering.net>
3758
3759         * src/printf.c (main): When given no arguments, print the standard
3760         "missing operand\nTry printf --help..." message -- to be consistent.
3761
3762 2004-06-26  Jim Meyering  <jim@meyering.net>
3763
3764         * src/mknod.c (main): Add \n at the end of message output via fprintf.
3765
3766 2004-06-25  Jim Meyering  <jim@meyering.net>
3767
3768         * tests/ln/misc: Add test for ln subscript error.
3769
3770 2004-06-23  Paul Eggert  <eggert@cs.ucla.edu>
3771
3772         * src/ln.c (do_link): Remove unnecessary call to lstat.
3773         (main): Avoid subscript error when the destination is "".
3774
3775 2004-06-23  Jim Meyering  <jim@meyering.net>
3776
3777         * tests/*: Replace all occurrences of `(exit N); exit' with
3778         `(exit N); exit N'.  Otherwise, those many tests could exit with
3779         improper exit status when exiting via e.g., a trapped interrupt.
3780         Thanks to a report from Bob Proulx.
3781
3782 2004-06-22  Paul Eggert  <eggert@cs.ucla.edu>
3783
3784         * src/who.c (idle_string, print_user): New arg boottime,
3785         specifying the most recent boot time.  All uses changed.
3786         (idle_string) Consider a line to be "old" if it hasn't been used
3787         since the last boot time.  Watch out for overflow when computing
3788         times, and for times in the future.
3789         (idle_string): Record latest boot time.
3790
3791 2004-06-22  Jim Meyering  <jim@meyering.net>
3792
3793         * src/test.c (usage): Correct description of `-t FD'.  The file
3794         descriptor, FD, is no longer optional.  Reported by Ton Nijkes.
3795
3796 2004-06-21  Paul Eggert  <eggert@cs.ucla.edu>
3797
3798         The 2004-06-19 fix for who and pinky was incomplete, as ctime
3799         has undefined behavior if the year precedes -999 or follows 9999.
3800         Since we have to stop using ctime anyway, we might as well use
3801         strftime and fix the FIXME, and support internationalized dates.
3802
3803         * NEWS: Document the new behavior.
3804         * src/who.c: Include "hard-locale.h".
3805         (time_format, time_format_width): New vars.
3806         (time_string, print_line): Use them.
3807         (main): Set them.
3808         (time_string): Use localtime + strftime instead of
3809         ctime, to avoid problems with years before -999 or after 9999.
3810         * src/pinky.c: Likewise.
3811
3812 2004-06-21  Paul Eggert  <eggert@cs.ucla.edu>
3813
3814         Fix bug: GNU 'ls' didn't count columns correctly if user or group
3815         names contained multibyte characters where the column count
3816         differed from the byte count.  This patch also corrects
3817         some comments.
3818
3819         * src/ls.c (format_user_or_group): New function, which counts
3820         columns correctly.
3821         (format_user, format_group): Use it.
3822         (format_user_or_group_width): New function, which counts columns
3823         correctly.
3824         (format_user_width, format_group_width): Use it.
3825
3826 2004-06-21  Jim Meyering  <jim@meyering.net>
3827
3828         * tests/priv-check: Quote "$PATH" in PATH=$PATH.
3829         Suggestion from Andreas Schwab.
3830
3831         * tests/priv-check: When running as root, be sure to propagate
3832         PATH through to the process we exec as non-root.
3833         Reported by michael@aplatform.com.
3834
3835         * src/mknod.c (main): Don't segfault when calculating the
3836         expected number of operands for `mknod NAME'.
3837
3838 2004-06-20  Jim Meyering  <jim@meyering.net>
3839
3840         * src/dd.c (input_seek_errno): Declare file-scoped variable as static.
3841
3842 2004-06-20  Paul Eggert  <eggert@cs.ucla.edu>
3843
3844         * src/basename.c (main):
3845         Standardize on the diagnostics given when someone gives
3846         too few operands ("missing operand after `xxx'") or
3847         too many operands ("extra operand `xxx'").
3848         Include "quote.h" and/or "error.h" if it wasn't already being included.
3849         * src/chgrp.c (main): Likewise.
3850         * src/chmod.c (main): Likewise.
3851         * src/chown.c (main): Likewise.
3852         * src/chroot.c (main): Likewise.
3853         * src/comm.c (main): Likewise.
3854         * src/cp.c (do_copy): Likewise.
3855         * src/csplit.c (main): Likewise.
3856         * src/date.c (main): Likewise.
3857         * src/dircolors.c (main): Likewise.
3858         * src/dirname.c (main): Likewise.
3859         * src/du.c (main): Likewise.
3860         * src/expr.c (main): Likewise.
3861         * src/hostid.c (main): Likewise.
3862         * src/hostname.c (main): Likewise.
3863         * src/id.c (main): Likewise.
3864         * src/install.c (main): Likewise.
3865         * src/join.c (add_file_name, main): Likewise.
3866         * src/link.c (main): Likewise.
3867         * src/ln.c (main): Likewise.
3868         * src/logname.c (main): Likewise.
3869         * src/md5sum.c (main): Likewise.
3870         * src/mkdir.c (main): Likewise.
3871         * src/mkfifo.c (main): Likewise.
3872         * src/mknod.c (main): Likewise.
3873         * src/mv.c (main): Likewise.
3874         * src/nohup.c (main): Likewise.
3875         * src/od.c (main): Likewise.
3876         * src/pathchk.c (main): Likewise.
3877         * src/ptx.c (main): Likewise.
3878         * src/readlink.c (main): Likewise.
3879         * src/rm.c (main): Likewise.
3880         * src/rmdir.c (main): Likewise.
3881         * src/seq.c (main): Likewise.
3882         * src/setuidgid.c (main): Likewise.
3883         * src/shred.c (main): Likewise.
3884         * src/sleep.c (main): Likewise.
3885         * src/sort.c (main): Likewise.
3886         * src/split.c (main): Likewise.
3887         * src/stat.c (main): Likewise.
3888         * src/test.c (beyond, main): Likewise.
3889         * src/touch.c (main): Likewise.
3890         * src/tr.c (main): Likewise.
3891         * src/tsort.c (main): Likewise.
3892         * src/tty.c (main): Likewise.
3893         * src/uname.c (main): Likewise.
3894         * src/uniq.c (main): Likewise.
3895         * src/unlink.c (main): Likewise.
3896         * src/uptime.c (main): Likewise.
3897         * src/users.c (main): Likewise.
3898         * src/who.c (main): Likewise.
3899         * src/whoami.c (main): Likewise.
3900
3901         * tests/basename/basic: Adjust to new diagnostics.
3902         * tests/du/files0-from: Likewise.
3903         * tests/expr/basic: Likewise.
3904         * tests/mv/diag: Likewise.
3905         * tests/tsort/basic-1: Likewise.
3906
3907 2004-06-20  Jim Meyering  <jim@meyering.net>
3908
3909         * src/ln.c: Remove declaration of yesno.
3910         Instead, include yesno.h.
3911         * src/copy.c: Likewise.
3912
3913         * src/remove.c: Remove declaration of yesno.
3914         Instead, include yesno.h.
3915         (top_dir): Remove now-unnecessary cast of obstack_base.
3916         (pop_dir): Likewise.
3917         (full_filename_): Likewise.
3918
3919 2004-06-19  Paul Eggert  <eggert@cs.ucla.edu>
3920
3921         Don't dump core if ctime returns NULL; this is possible on
3922         hosts with 64-bit time_t and 32-bit int.
3923         * src/who.c: Include "inttostr.h".
3924         (time_string): If ctime fails, print the raw time as an integer
3925         instead of dumping core.
3926         * src/pinky.c: Likewise, as follows:
3927         Include "inttostr.h".
3928         (time_string): New function, copied from who.c.
3929         (print_entry): Use it.
3930
3931 2004-06-19  Paul Eggert  <eggert@cs.ucla.edu>
3932
3933         * src/who.c (print_line): Don't truncate user names at 8 bytes.
3934         Problem reported by Guido Leenders in:
3935         http://lists.gnu.org/archive/html/bug-coreutils/2004-06/msg00056.html
3936         * NEWS: document this.
3937
3938 2004-06-19  Jim Meyering  <jim@meyering.net>
3939
3940         * src/system.h (case_GETOPT_VERSION_CHAR): Switch back to
3941         using GNU_PACKAGE (from PACKAGE) once again.  This restores
3942         `GNU' to the parenthesized package name in --version output.
3943         Before, the first argument from AC_INIT, `GNU coreutils', would
3944         be propagated to the PACKAGE variable.  Now, `GNU ' is trimmed.
3945         Reported by Richard Stallman.
3946
3947 2004-06-17  Jim Meyering  <jim@meyering.net>
3948
3949         * src/tr.c (to_uchar): Rename function from `uchar'.  The latter
3950         would clash with a typedef in Tru64's <sys/types.h>.  From Albert Chin.
3951
3952 2004-06-15  Paul Eggert  <eggert@cs.ucla.edu>
3953
3954         * NEWS: Remove more special cases for POSIXLY_CORRECT when POSIX
3955         allows the GNU behavior.  "--" is now supported by chroot, hostid,
3956         hosname, pwd, sync, yes.
3957         * doc/coreutils.texi (yes invocation, false invocation,
3958         true invocation): Document this.
3959         * src/chroot.c (main): Handle "--".
3960         * src/hostid.c (main): Likewise.
3961         * src/hostname.c (main): Likewise.
3962         * src/pwd.c (main): Likewise.
3963         * src/sync.c (main): Likewise.
3964         * src/yes.c (main): Likewise.
3965         * src/true.c (main): Recognize --help and --version even if
3966         POSIXLY_CORRECT is set.
3967         * src/yes.c (main): Likewise.
3968
3969 2004-06-09  Paul Eggert  <eggert@cs.ucla.edu>
3970
3971         * NEWS: Remove special cases for POSIXLY_CORRECT when POSIX allows
3972         the GNU behavior.
3973         * doc/coreutils.texi (pr invocation, unlink invocation): Document this.
3974         * src/ls.c (decode_switches): Pay attention to TABSIZE even if
3975         POSIXLY_CORRECT is set.  POSIX reserves upper-case environment
3976         variables to the implementation, so it's OK for ls to depend on
3977         TABSIZE.
3978         * src/pr.c: Include "hard-locale.h".
3979         (main): When in a non-POSIX locale, ignore POSIXLY_CORRECT, since
3980         POSIX specifies the behavior only in the POSIX locale.
3981         * src/printf.c (print_esc): Support \x, \u, \U even if POSIXLY_CORRECT,
3982         since POSIX says the behavior is unspecified here.
3983         * src/tail.c (parse_obsolescent_option): Support multiple file operands
3984         even if POSIXLY_CORRECT, since POSIX does not require a diagnostic.
3985         * src/printf.c (main): Recognize --help, --version even if
3986         POSIXLY_CORRECT.  POSIX does not specify any options, but it
3987         does not prohibit options either, so "printf" is like "expr" here.
3988         * src/unlink.c (main): Likewise.
3989         * tests/misc/printf: Adjust to the new semantics for \x if
3990         POSIXLY_CORRECT.
3991
3992 2004-06-14  Jim Meyering  <jim@meyering.net>
3993
3994         * tests/misc/pwd: New test, for fix of 2004-04-19.
3995         * tests/misc/Makefile.am (TESTS): Add pwd.
3996         (BUILD_SRC_DIR): Define BUILD_SRC_DIR.
3997
3998         * src/copy.c: Remove declaration of euidaccess.
3999         Instead, include "euidaccess.h".
4000
4001 2004-06-13  Paul Eggert  <eggert@cs.ucla.edu>
4002
4003         * src/who.c (PIDSTR_DECL_AND_INIT): Don't assume pid_t fits in int.
4004         (UT_ID) [!HAVE_STRUCT_XTMP_UT_ID]: Remove bogus comment,
4005         as (sizeof "??") reliably returns 3.
4006         (print_line): Guard against idle and pid being too long
4007         (which is possible when printing headers).
4008         (print_user): Allocate enough bytes for idlestr.  Use IDLESTR_LEN.
4009         Avoid unnecessary cast of sizeof to int.
4010         (make_id_equals_comment): Do not assume that UT_ID returns
4011         a string; it might return a non-null-terminated array.
4012         Use strncat instead.  It's not very often where strncat is
4013         exactly what you want, but this is one of those rare cases.
4014
4015 2004-06-11  Paul Eggert  <eggert@cs.ucla.edu>
4016
4017         * src/who.c (list_entries_who): Don't output a trailing space.
4018
4019 2004-06-09  Jim Meyering  <jim@meyering.net>
4020
4021         * src/touch.c (usage): Improve wording in description of the
4022         --time=WORD option.  Reported by Dan Jacobson.
4023
4024         * src/chown-core.c (change_file_owner): Change names of parameters
4025         old_uid and old_gid to required_uid and required_gid respectively.
4026
4027         * src/chmod.c (mode_changed): Return false, not 0, now that the
4028         function returns `bool'.
4029
4030 2004-06-08  Paul Eggert  <eggert@cs.ucla.edu>
4031
4032         Adjust chmod and chown to be similar if -c or -v are given.  In
4033         particular, a no-op chown is no longer reported as a change; this
4034         reverts to previous behavior.  Also, fix both commands so that -v
4035         report failures even if the failure is not due to the chmod or
4036         chown syscalls.
4037
4038         * src/chmod.c (CH_NOT_APPLIED): New constant.
4039         (describe_change): Handle it.
4040         (process_file): Use it, if a symlink wasn't changed.
4041         (mode_changed): Return bool, not int.  Accept new argument
4042         NEW_MODE; all callers changed.  This lets us avoid statting the
4043         file unless the new mode has unusual bits.
4044         (process_file): Return -1 on error.  With -v, report all errors
4045         verbosely, not just some.
4046
4047         * src/chown-core.c (change_file_owner): Return -1 on error, not
4048         1 sometimes and -1 on others.  Our caller ORs together our results,
4049         and (-1 | 1) == 0 on ones-complement hosts.
4050         With -v report all errors verbosely, not just some.
4051         Fix bug when chopt->root_dev_ino && !chopt->affect_symlink_referent:
4052         file_stats wasn't set properly in that case.
4053
4054         * tests/chgrp/basic: Adjust to above changes.
4055
4056 2004-05-20  Paul Eggert  <eggert@cs.ucla.edu>
4057
4058         * tests/chgrp/basic: Test that chgrp -h does not fail on
4059         symlinks, even on hosts where that's not supported.
4060         Test that if -R is specified without -H or L, -h is assumed.
4061         Test that chown() is not optimized away.
4062
4063 2004-05-18  Paul Eggert  <eggert@cs.ucla.edu>
4064
4065         Several fixes to chgrp and chown for compatibility with POSIX and BSD:
4066
4067           Check for incompatible options.  When -R and --dereference are
4068           both used, then either -H or -L must also be used.  When -R and -h
4069           are both used, then -P must be in effect.
4070
4071           -H, -L, and -P have no effect unless -R is also specified.
4072           If -P and -R are both specified, -h is assumed.
4073
4074           Do not optimize away the chown() system call when the file's owner
4075           and group already have the desired value.  This optimization was
4076           incorrect, as it failed to updated the last-changed time and reset
4077           special permission bits, as POSIX requires.
4078
4079           Do not report an error if the owner or group of a
4080           recursively-encountered symbolic link cannot be updated because
4081           the file system does not support it.
4082
4083         * NEWS: Document the above.
4084
4085         * src/chgrp.c (main): Check for incompatible options.  -R --dereference
4086         requires either -H or -L, and -R -h requires -P.  If -H, specify
4087         FTS_PHYSICAL as well as FTS_COMFOLLOW; this is faster.  Make this
4088         file as much like chown.c as possible.
4089         * src/chown.c (main): Likewise.
4090
4091         * src/chown-core.c (change_file_owner): Use ent->fts_statp only if
4092         needed.  Chown a directory only after chowning its children; this
4093         avoids problems if the new directory ownership doesn't permit
4094         access to the children.  Dereference symlinks before doing
4095         ROOT_DEV_INO_CHECK, not after, so that we catch symlinks to /.
4096         Do not optimize away the chown() system call when the file's owner
4097         and group already have the desired value.  POSIX does not permit
4098         this optimization.  Rely on chown and lchown to do the right
4099         thing with symlinks and/or -1 arguments, now that we have wrappers
4100         to do this.  Use ENOTSUPP not ENOSYS, and ignore all ENOTSUPP
4101         errors, not just command-line errors.
4102         (chown_files): Pass FTS_NOSTAT to xfts_open if we don't need file status.
4103
4104         * src/system.h (ENOTSUP): Remove.
4105
4106         * tests/chgrp/basic: Use chown --from to discover whether the
4107         group changed, since chgrp now changes unconditionally.  This
4108         complicates the sed script a bit.  Do not specify --dereference,
4109         since it's the default (and we want to test this).  Adjust output
4110         to match the fact that chgrp no longer optimizes the case of
4111         changing a file's group to the same value as before.
4112         * tests/chgrp/posix-H: Do not attempt to combine -h and -H; these
4113         options are incompatible, and their behavior is undefined with POSIX.
4114         (changed, not_changed): Adjust to match the fact that -h is no longer
4115         specified.  Sort names.
4116         * tests/chown/deref: Adjust error-diagnostic spelling to match new
4117         behavior.
4118
4119 2004-06-07  Paul Eggert  <eggert@cs.ucla.edu>
4120
4121         * src/uname.c (main): Fix typo introduced on 2003-05-10 that
4122         prevented a diagnostic of any operands.
4123
4124 2004-06-08  Jim Meyering  <jim@meyering.net>
4125
4126         * src/shred.c (direct_mode): Turn it on/off with directio, too.
4127
4128 2004-06-07  Jim Meyering  <jim@meyering.net>
4129
4130         Enable direct-mode I/O (bypassing the buffer cache), if possible.
4131         Prompted by a suggestion from Kalle Olavi Niemitalo
4132         in http://bugs.debian.org/207035.
4133         * src/shred.c (direct_mode): New function.
4134         (do_wipefd): Turn on direct-mode I/O.
4135         (dopass): If a file's first write fails with EINVAL,
4136         turn off direct-mode I/O and retry the write.
4137
4138 2004-06-05  Paul Eggert  <eggert@cs.ucla.edu>
4139
4140         * src/tr.c (main): "tr -d a b" is now a fatal error even if
4141         POSIXLY_CORRECT is set.  The POSIX SYNOPSIS does not allow this
4142         option combination.
4143
4144 2004-06-04  Paul Eggert  <eggert@cs.ucla.edu>
4145
4146         * src/shred.c (dopass): Don't subtract 1 from the offset after
4147         a write error.  Problem reported by Jon Peatfield in:
4148         http://lists.gnu.org/archive/html/bug-coreutils/2004-06/msg00020.html
4149
4150 2004-06-02  Paul Eggert  <eggert@cs.ucla.edu>
4151
4152         Fix bug reported by Buciuman Adrian in
4153         <http://mail.gnu.org/archive/html/bug-coreutils/2003-08/msg00105.html>
4154         where 'dd' created a file that was too large.  The bug was that dd
4155         assumed that the input file offset does not advance after a failed
4156         read; but POSIX says that the input file offset is undefined after
4157         a failed read.
4158
4159         * src/dd.c (MAX_BLOCKSIZE): New macro.
4160         (input_seekable, input_seek_errno, input_offset,
4161         input_offset_overflow): New vars.
4162         (scanargs): Reject block sizes greater than MAX_BLOCKSIZE.
4163         (advance_input_offset): New function.
4164         (skip_via_lseek): Set errno to zero when reporting our failure,
4165         so that we don't report based on garbage errno.
4166         (skip): If fdesc is standard input, advance the input offset.
4167         Do not quit if reading, and if noerror was specified;
4168         POSIX seems to require this.
4169         If read fails on output file, report the earlier lseek failure
4170         instead; this fixes a FIXME in dd_copy.
4171         (advance_input_after_read_error): New function.
4172         (dd_copy): Use it, instead of assuming that failed reads
4173         do not advance the file pointer.  Advance input offset
4174         after nonfailed reads.  Advance only a partial block if
4175         the previous read (before the failed read) succeeded, and
4176         do not generate an output block of zeros in this case.
4177         (main): Determine initial input offset, seekability of input,
4178         and error if it wasn't seekable.
4179
4180 2004-06-02  Jim Meyering  <jim@meyering.net>
4181
4182         rm (without -f) could hang unnecessarily when attempting to
4183         remove a symlink to a file on an off-line NFS-mounted partition.
4184         Reported by David Howells in https://bugzilla.redhat.com/124699.
4185         * src/remove.c (write_protected_non_symlink): New function.
4186         Don't invoke euidaccess on symlinks.
4187         (prompt): Use write_protected_non_symlink rather than using
4188         euidaccess directly, being careful not to call lstat twice for a file.
4189
4190         Fix a bug in how the --output-delimiter=D option works with
4191         abutting byte or character ranges.  Reported by David Krider in
4192         http://lists.gnu.org/archive/html/bug-coreutils/2004-05/msg00132.html
4193         * src/cut.c (print_kth): Remove special case for open-ended range.
4194         (set_fields): Record the range start index for an interval even
4195         when it abuts another interval on its low side.
4196         Also record the range start index of the longest right-open-interval.
4197         * tests/cut/Test.pm: Add tests of --output-delimiter=S with
4198         abutting and overlapping byte ranges.
4199
4200 2004-06-01  Paul Eggert  <eggert@cs.ucla.edu>
4201
4202         Some POSIX-conformance cleanups for tr.
4203
4204         * src/tr.c (posix_pedantic): Remove; no longer needed since
4205         we need to test this in just one place now.
4206         (usage): Mention -C.
4207         (unquote): Note that \055, \n, etc are escaped.
4208         Do not worry about POSIXLY_CORRECT when warning about ambiguous
4209         escape sequences.
4210         \ at end of string stands for itself.
4211         Do not diagnose invalid backslash escapes: POSIX says the behavior
4212         is unspecified in this case, so we don't need to diagnose it.
4213         (main): Add support for -C (currently an alias for -c).
4214         Do not diagnose 'tr [:upper:] [:upper:], as POSIX does not require
4215         a diagnostic here.
4216         * tests/tr/Test.pm: New tests bs-055, bs-at-end, repeat-Compl.
4217         Fix comment for range-a-a.
4218
4219 2004-05-25  Paul Eggert  <eggert@cs.ucla.edu>
4220
4221         Improve the efficiency (and in one case, correctness) of code
4222         that reads symlinks.
4223
4224         * src/copy.c (copy_internal): Don't use alloca, as it can mess up
4225         royally if the link length is long (e.g., GNU/Hurd).  Use
4226         xreadlink instead, it's safer.  Don't bother to read the link if
4227         it's the wrong size.  Add a FIXME because this area is a bit murky
4228         and undocumented.
4229         * src/ls.c (get_link_name): Update use of xreadlink.
4230         * src/readlink.c (main): Likewise.
4231         * src/stat.c (print_stat): Likewise.
4232
4233 2004-06-01  Jim Meyering  <jim@meyering.net>
4234
4235         * src/env.c (main): Prefer the notation `STREQ (a, b)'
4236         over `!strcmp (a, b)'.
4237         * src/sort.c (main, sort_buffer_size): Prefer the notation
4238         `STREQ (a, b)' over `strcmp (a, b) == 0'.
4239         * src/date.c (batch_convert): Likewise.
4240         * src/expr.c (nextarg): Likewise.
4241         * src/su.c (correct_password, restricted_shell, main): Likewise.
4242         * src/ptx.c (swallow_file_in_memory, main): Likewise.
4243         * src/test.c (binary_operator, and, or, main): Likewise.
4244
4245 2004-05-13  Paul Eggert  <eggert@cs.ucla.edu>
4246
4247         * NEWS: echo compatibility cleanup.
4248         * doc/coreutils.texi (echo invocation): Document the changes.
4249         * src/echo.c (V9_ECHO): Remove; always enabled.
4250         (DEFAULT_ECHO_TO_XPG): Renamed from V9_DEFAULT, so that
4251         we use the same naming convention as bash.  Now an enum,
4252         not a macro.
4253         (usage): Reword to mention -e/-E more accurately.
4254         Mention \0NNN (the POSIX syntax) rather than \NNN (nonstandard).
4255         (hextobin): New function.
4256         (main): Use bool rather than int for local vars when appropriate.
4257         Do not allow options if POSIXLY_CORRECT, unless we are using
4258         BSD semantics and the first argument is "-n".
4259         Don't pass unnecessary extra arg to parse_long_options.
4260         do_v9 now defaults to DEFAULT_ECHO_TO_XPG, not to allow_options.
4261         Do not look for options if !allow_options.
4262         Use size_t rather than int when appropriate.
4263         Open-code option test rather than using strrchr.
4264         Use faster test for "-".
4265         Avoid redundant argc test.
4266         Add support for \x, for Bash compatibility.
4267         Use e.g. '\a' rather than '\007', for portability to EBCDIC hosts.
4268         When '\c' is encountered, stop printing immediately, as POSIX
4269         requires.
4270         Add support for \xhh syntax.
4271         Add support for \0ooo syntax; POSIX requires this.
4272
4273 2004-06-01  Jim Meyering  <jim@meyering.net>
4274
4275         * Use automake-1.8b.  Regenerate dependent files.
4276
4277 2004-05-31  Jim Meyering  <jim@meyering.net>
4278
4279         * tests/Makefile.am.in (TESTS_ENVIRONMENT): Define PATH to include
4280         the build src/ directory -- at the front.
4281         ($(srcdir)/$x-tests): Depend on Makefile.am.
4282         Use $x as the program name, except when it would be `test' (test is
4283         the sole program tested via mk-script that is also a shell built-in).
4284         In that case, use the old ../../src/$x.
4285
4286 2004-05-30  Jim Meyering  <jim@meyering.net>
4287
4288         Work around HPUX /bin/cc compiler bug that is exposed, now that
4289         sets are arrays of type `bool'.  More details here:
4290         http://lists.gnu.org/archive/html/bug-gnulib/2004-05/msg00094.html
4291         FIXME: verify that the above URL points to the right message
4292
4293         * src/tr.c (card_of_complement): Use cleaner `sizeof in_set'
4294         rather than `N_CHARS * sizeof(in_set[0])'.  Using HPUX's /bin/cc
4295         (aC++/ANSI C B3910B A.05.55 [Dec 04 2003]) on an ia64-hp-hpux11.22
4296         system, those two expressions are not the same (256 vs. 1024).
4297         The effect of this problem was that `tr -c x y' would fail:
4298         tr: when not truncating set1, string2 must be non-empty
4299         (set_initialize): Remove unnecessary initialization of the `in_set'
4300         buffer; that initialization triggered the same compiler bug as above.
4301
4302 2004-05-29  Paul Eggert  <eggert@cs.ucla.edu>
4303
4304         tr cleanup, mostly having to do with integer type ranges.
4305         Remove all casts.
4306
4307         * tests/tr/Test.pm: Add a few tests for the below.  Alas, most of
4308         the test cases wouldn't be portable, or would take too much CPU
4309         time, or both.
4310
4311         * src/tr.c (N_CHARS, N_CHAR_CLASSES): Now an enum, not a macro.
4312         This is safe since the code already assumes N_CHARS fits in int.
4313         (Filter): Remove: we want to prototype everything.
4314         (ORD, CHR): Remove.  All uses removed.  Some replaced with:
4315         (uchar): New function.  All places where a char must be converted
4316         to an unsigned char are now done this way, not by ad-hoc methods.
4317         (count): New type.  Use it whenever counts or states are needed.
4318         (BEGIN_STATE): Increase from INT_MAX - 1 (which was bogus, anyway,
4319         since we used it in an unsigned int context) to UINTMAX_MAX - 1.
4320         (REPEAT_COUNT_MAXIMUM): New macro.  Use it in place of BEGIN_STATE
4321         whenever appropriate.
4322         (NOT_A_CHAR): Remove global macro; now a local enum.
4323         (UL_LOWER, UL_UPPER, UL_NONE): No longer specify values, since
4324         the rest of the code no longer depends on them.
4325         (class_ok): Remove; all uses changed to use inline comparisons.
4326         (RE_NO_TYPE): Remove; wasn't used or needed.
4327         (struct List_element): normal_char and equiv_code are now unsigned
4328         char, not int.
4329         first_char, last_char, and the_repeated_char are now unsigned char,
4330         not unsigned int.  repeat_count is now count, not size_t.
4331         All uses changed.
4332         (struct Spec_list): state is now count, not unsigned int.
4333         lengthis now count, not size_t.
4334         n_indefinite_repeats is now size_t, not int.
4335         has_equiv_class, has_char_class, and has_restricted_char_class
4336         are now bool, not int.  All uses changed.
4337         (struct E_string): s is now char *, not unsigned char *.
4338         escaped is now bool *, not int *.  All uses changed.
4339         (ES_MATCH): Remove macro, replacing with:
4340         (es_match): New inline function.  All uses changed.
4341         (squeeze_repeats, complement, posix_pedantic, truncate_set1,
4342         translating): Now bool, not int.
4343         (io_buf): Now char array, not unsigned char.
4344         (SET_TYPE): Remove.  All uses replaced with bool.
4345         (is_equiv_class_member, unquote, append_range, append_char_class,
4346         append_equiv_class, find_closing_delim, star_digits_closebracket,
4347         build_spec_list, parse_str, homogeneous_spec_list):
4348         Now returns bool, not int.  All uses changed.
4349         (is_equiv_class_member): Now inline.
4350         (is_equiv_class_member, is_char_class_member, make_printable_str,
4351         append_normal_char, append_range, append_repeated_char,
4352         get_s2_spec_stats):
4353         Args are now of proper integer type.
4354         (unquote, look_up_char_class, make_printable_str,
4355         append_equiv_class, build_spec_list, squeeze_filter):
4356         Avoid unsigned char *p; gently convert *p to unsigned char instead.
4357         (unquote, get_spec_stats): Do not jump past declarations and then
4358         use them; C doesn't allow this in portable programs.
4359         (make_printable_str): Check for overflow in size calculations.
4360         (xmemdup): Remove.  All uses rewritten.
4361         (find_bracketed_repeat): Args are now of proper pointer-to-integer
4362         type.  Do not reject [c*0].  Use xstrtoumax, not xstrtoul.
4363         (find_bracketed_repeat, star_digits_closebracket): Check that the
4364         digits are not escaped.
4365         (build_spec_list): Don't bother to copy opnd_str; not needed.
4366         (build_spec_list, get_next): Simplify internal logic a bit.
4367         (card_of_complement): Fix bug due to char overflow.
4368         (get_spec_stats): Don't assume len fits into int.
4369         Check for integer overflow.  Use abort() rather than assert(0).
4370         (string2_extend): Fix subscript error: is_char_class_member (..., 255)
4371         was being invoked.
4372         (squeeze_filter): READER is never null now; simplify code.
4373         READER arg now has a simpler type.  Remove unnecessary casts.
4374         (squeeze_filter, main): Calls to fwrite improperly checked result
4375         against zero, rather than against requested size.
4376         (plain_read): New function.
4377         (read_and_delete, read_and_xlate):
4378         Remove unused filter arg, and don't worry about hit_eof.
4379         Simplify by using plain_read.
4380         (set_initialize): Args are bool and bool *, not int and SET_TYPE *.
4381         (main): Always pass a non-null procedure to squeeze_filter.
4382         Rewrite so that class_ok isn't needed.
4383
4384 2004-05-29  Paul Eggert  <eggert@cs.ucla.edu>
4385
4386         * src/shred.c (dosync): Ignore EBADF errors, as IRIX 6.5
4387         fdatasync reports EBADF when syncing (unwritable) directories.
4388         Problem reported by Albert Chin-A-Young in:
4389         http://lists.gnu.org/archive/html/bug-coreutils/2004-05/msg00165.html
4390
4391 2004-05-29  Jim Meyering  <jim@meyering.net>
4392
4393         * tests/chown/deref: Fix typo: use ls -ldo, not ls -ldg.
4394         Patch from Albert Chin.
4395
4396         * src/ptx.c (text_buffer_maxend): Remove declaration of unused variable.
4397
4398         * src/remove.c (push_dir): Merge declaration and adjacent assignment
4399         into a single statement.
4400
4401 2004-05-28  Jim Meyering  <jim@meyering.net>
4402
4403         * src/remove.c (AD_mark_helper): Eliminate an unnecessary comparison.
4404
4405 2004-05-22  Jim Meyering  <jim@meyering.net>
4406
4407         rm -r would get a failed assertion when run from an inaccessible
4408         directory and with two or more command line arguments including an
4409         absolute-named directory followed by a relative-named directory.
4410
4411         * src/remove.h (struct rm_options) [require_restore_cwd]: New member.
4412         * src/remove.c (struct cwd_state): Define.
4413         (AD_pop_and_chdir): Redesign interface so that a restore_cwd failure
4414         can be detected by the caller.  Instead of returning a malloc'd
4415         directory name, communicate it to caller via a new parameter, and
4416         return an indication of whether restore_cwd failed.  Update caller.
4417         Eliminate an unnecessary call to AC_stack_top.
4418         (remove_dir): Change type of cwd_state parameter to `struct cwd_state'
4419         so we can now communicate to caller whether/how functions like
4420         restore_cwd have failed.  Update caller.
4421         (rm_1): Fail if we've failed to restore the working directory
4422         and the name of the next file to remove is `.'-relative.
4423         (rm): Fail if the require_restore_cwd flag is true and we've
4424         failed to restore the working directory.
4425         * src/mv.c (rm_option_init): Initialize new member,
4426         x->require_restore_cwd.
4427         * src/rm.c (rm_option_init): Likewise.
4428
4429 2004-05-21  Jim Meyering  <jim@meyering.net>
4430
4431         * tests/rm/inaccessible: New test for the above fix.
4432         * tests/rm/Makefile.am (TESTS): Add inaccessible.
4433
4434         * src/remove.c (rm): Use free rather than XFREE.
4435         (remove_dir): Use xmalloc, not XMALLOC.
4436         (ds_init): Likewise.
4437
4438 2004-05-20  Jim Meyering  <jim@meyering.net>
4439
4440         * Makefile.maint (sc_unmarked_diagnostics): Now that the unmarked
4441         diagnostics in shred.c have been fixed, don't exempt shred.c from
4442         this check.
4443
4444         * src/shred.c: Use translatable diagnostics, e.g.
4445         change "%s: remove" to _("%s: failed to remove") and
4446         change "%s: close"  to _("%s: failed to close").
4447
4448 2004-05-17  Paul Eggert  <eggert@cs.ucla.edu>
4449
4450         * src/shred.c (names): Bring back lower-case letters, "_", and
4451         ".".  But continue to omit +, =, %, @, #, as they're either
4452         shell metacharacters (for some shells) or are not in some
4453         character sets, or (in the case of '%') must be a
4454         metacharacter somewhere.
4455
4456 2004-05-16  Paul Eggert  <eggert@cs.ucla.edu>
4457
4458         * src/cut.c (cut_fields): Adjust to new signature of getndelim2.
4459
4460 2004-05-17  Jim Meyering  <jim@meyering.net>
4461
4462         * src/shred.c (incname): Decrement `len' only once per loop iteration.
4463
4464         chgrp and chown now dereference symlinks by default, per POSIX.
4465         Reported by Michal Politowski as http://bugs.debian.org/249177.
4466
4467         * src/chown-core.c (chopt_init): Affect each symlink referent by default.
4468         * src/chown.c (usage): Update to reflect this.
4469         * src/chgrp.c (usage): Likewise.
4470         * NEWS: Describe the change.
4471         Adapt tests accordingly.
4472         * tests/chgrp/basic: Use -h where necessary to retain semantics.
4473         * tests/chgrp/deref: Likewise.
4474         * tests/chgrp/posix-H: Likewise.
4475
4476 2004-05-15  Paul Eggert  <eggert@cs.ucla.edu>
4477
4478         In shred, check for errors from fdatasync more carefully.  If
4479         fdatasync fails with errno==EINVAL, it means this implementation
4480         does not support synchronized I/O for this file.  Do not report
4481         this as an error, as (for example) AIX 5.2 fdatasync reports it
4482         for raw disk devices.  Problem reported by Albert Chin in
4483         <http://mail.gnu.org/archive/html/bug-gnu-utils/2004-05/msg00028.html>.
4484
4485         Check for write errors, though: the old code ignored them.
4486         Improve error checking in a few other cases, too (e.g., close of a
4487         directory).
4488
4489         Also, change several 'int' values to 'bool', so that the error
4490         checking is a bit clearer.  Similarly, change unsigned values
4491         to size_t where appropriate.
4492
4493         * src/shred.c: Include "dirname.h".
4494         (datasync) [!HAVE_FDATASYNC]: Remove.
4495         (dosync): New function.
4496         (dopass): Use it.  Return 1 on write error, -1 on other error.
4497         All callers changed.  Report write error if dosync does.
4498         (do_wipefd, wipefd, wipename, wipefile): Return bool (true/false),
4499         not int (0/-1).  All callers changed.  Return false if there's a
4500         write error.
4501         (incname): Return bool (true/false), not int (0/1).  Accept
4502         size_t length, not unsigned.  All callers changed.  Do not
4503         bother checking for non-digits; it can't happen.  Replace
4504         recursion with iteration.
4505         (wipename): Use dir_name, base_name, etc. instead of assuming
4506         Unix file names.  Use size_t for length, not unsigned.
4507         Report error if unlink or close fails.
4508         (wipename, main): Use bool for booleans.
4509
4510         (names): Use only digits and uppercase letters, for greater
4511         portability.
4512
4513 2004-05-16  Jim Meyering  <jim@meyering.net>
4514
4515         * tests/chown/deref: New test for the yesterday's change.
4516         * tests/chown/Makefile.am (TESTS): Add deref.
4517
4518 2004-05-15  Jim Meyering  <jim@meyering.net>
4519
4520         chown --dereference did nothing when the owner/group of a
4521         symlink matched the desired owner/group.  Reported by David Malone.
4522         Also reported in 1999 as http://bugs.debian.org/39642.
4523
4524         * src/chown-core.c (change_file_owner): When --dereference has
4525         been specified, and when processing a symlink, stat it to get the
4526         owner and group of the referent.
4527
4528 2004-05-14  Jim Meyering  <jim@meyering.net>
4529
4530         * man/pwd.x, man/echo.x, man/printf.x: Fix typo:
4531         s/supercede/supersede/ reported by Andrew Fabbro.
4532
4533 2004-05-13  Paul Eggert  <eggert@cs.ucla.edu>
4534
4535         Improve performance of `sort -m' on large files, at the cost of
4536         making some contrived examples unsafe.  POSIX allows this
4537         optimization.  Performance problem reported by Jonathan Baker in
4538         <http://mail.gnu.org/archive/html/bug-coreutils/2004-05/msg00071.html>.
4539
4540         * src/sort.c (first_same_file): Do not treat input pipes
4541         differently from other files.
4542         * doc/coreutils.texi (sort invocation): Document that "sort -m -o F"
4543         might write F before reading all the input.
4544         * NEWS: Likewise.
4545
4546 2004-05-12  Paul Eggert  <eggert@cs.ucla.edu>
4547
4548         * src/od.c (print_ascii, dump_strings): Use e.g. '\a' rather than
4549         '\007', for portability to EBCDIC hosts.
4550         * src/printf.c (print_esc_char): Likewise.
4551         * src/tr.c (unquote, make_printable_str): Likewise.
4552
4553 2004-05-12  Jim Meyering  <jim@meyering.net>
4554
4555         * src/remove.c (AD_pop_and_chdir): Move lstat-`.' into if-block
4556         where the result is used.  This avoids one unnecessary lstat call
4557         per command line argument.
4558
4559 2004-05-12  Paul Eggert  <eggert@cs.ucla.edu>
4560
4561         Don't assume that "make -C" works; Solaris "make" doesn't have -C.
4562
4563         * src/Makefile.am (all_programs.list): New rule, copied from
4564         man/Makefile.am and tests/Makefile.am, except that we use the
4565         system tr rather than ./tr and we don't use tr -s.
4566         * tests/Makefile.am (all_programs): Use it.
4567         * man/Makefile.am (all_programs): Likewise.  Renamed from programs,
4568         for consistency.  All uses changed.
4569
4570 2004-05-11  Jim Meyering  <jim@meyering.net>
4571
4572         * tests/rm/unread3: New test, for the above fix and today's
4573         lib/save-cwd.c improvement.
4574         * tests/rm/Makefile.am (TESTS): Add unread3.
4575
4576         * src/rm.c: Don't include "save-cwd.h".  It's no longer used.
4577
4578 2004-05-10  Jim Meyering  <jim@meyering.net>
4579
4580         * tests/install/trap: New file.  Test for bug fix of 2004-04-18.
4581         * tests/install/Makefile.am (TESTS): Add trap.
4582
4583         * src/remove.c (AD_push): Don't use errno in diagnostic about
4584         `changed dev/ino'.
4585
4586         Remove these generated files from CVS.
4587         * tests/cut/cut-tests, tests/date/date-tests, tests/join/join-tests:
4588         * tests/ls/ls-tests, tests/pr/pr-tests, tests/tac/tac-tests:
4589         * tests/tail/tail-tests, tests/test/test-tests, tests/tr/range-tests:
4590         * tests/tr/tr-tests, tests/wc/wc-tests:
4591
4592 2004-05-09  Jim Meyering  <jim@meyering.net>
4593
4594         * src/tr.c (unquote): Use xcalloc rather than xmalloc and
4595         a loop initializing the just-allocated memory to zero.
4596
4597 2004-05-08  Jim Meyering  <jim@meyering.net>
4598
4599         * tests/rm/no-give-up: New file; check for today's fix.
4600         * tests/rm/Makefile.am (TESTS): Add no-give-up.
4601
4602 2004-05-08  Paul Eggert  <eggert@cs.ucla.edu>
4603
4604         Fix bug where "rm" gave up too easily, reported by Dan Jacobsen in
4605         <http://mail.gnu.org/archive/html/bug-coreutils/2004-05/msg00013.html>.
4606
4607         * src/remove.c (remove_entry): Check for errno values like ENOENT
4608         that show the file cannot be directory, instead of for errno
4609         values like EPERM that show the file might be a directory.  This
4610         is necessary because, when a single unlink() call has multiple
4611         reasons to fail, it can set errno to any of those reasons; it's
4612         only the rare errno value like ENOENT that excludes all the other
4613         possible reasons to fail even when the file is a directory.
4614         (remove_cwd_entries): Don't attempt chdir if the file is known
4615         to not be a directory.
4616         (remove_dir): Use the same method that remove_cwd_entries uses
4617         (for some reason they differed).  Don't assert that saved_errno
4618         must be EPERM; it might be just about anything.
4619
4620 2004-05-06  Jim Meyering  <jim@meyering.net>
4621
4622         * src/id.c (xgetgroups): Use xnmalloc, rather than xmalloc.
4623         Don't add `1' to the buffer size (it was to protect against malloc
4624         implementations that fail to allocate a buffer of size zero).
4625         That is no longer necessary, since we use a malloc wrapper
4626         on such systems.
4627
4628         * src/wc.c (get_input_fstatus): Use xnmalloc, rather than xmalloc.
4629         * src/head.c (elide_tail_bytes_pipe): Likewise.
4630         * src/df.c (main): Likewise.
4631         * src/shred.c (do_wipefd): Likewise.
4632         * src/users.c (list_entries_users): Likewise.
4633         * src/tail.c (main): Likewise.
4634         * src/md5sum.c (main): Likewise.
4635
4636 2004-04-29  Paul Eggert  <eggert@cs.ucla.edu>
4637
4638         * src/df.c (show_disk, show_point): If several filesystems are
4639         mounted on the same mount point, prefer the last one, not the first.
4640         Problem reported by Christian Jones in
4641         <http://mail.gnu.org/archive/html/bug-coreutils/2004-04/msg00200.html>.
4642         (show_disk): Remove unused statp arg.  Return bool, not int.
4643         (show_point): Rewrite to avoid gotos.  Use the same algorithm
4644         for lofs and dummies for each pass through the mount table,
4645         rather than subtly different algorithms (which are probably
4646         inadvertent).
4647
4648 2004-05-03  Jim Meyering  <jim@meyering.net>
4649
4650         * Makefile.am (EXTRA_DIST): Add m4/ChangeLog, now that we no longer
4651         have m4/Makefile*.
4652
4653 2004-05-01  Jim Meyering  <jim@meyering.net>
4654
4655         When chown or chgrp is modifying the referent of a symlink,
4656         use the chown(2) function, if possible.
4657         * src/chown-core.c (change_file_owner): Don't hard-code the
4658         open/fchown/close kludge here.  Use `chown' instead.
4659         The chown function works just fine on conforming systems.
4660         Other systems now go through the new chown wrapper that
4661         resorts to the old kludge.
4662
4663         * src/chown-core.c (change_file_owner): Add a comment.
4664
4665 2004-04-27  Jim Meyering  <jim@meyering.net>
4666
4667         * src/ptx.c: Make over 40 global extern variables `static'.
4668         (syntax_table, re_syntax_table): Remove declarations of two unused
4669         variables (they were exposed by the above change).
4670
4671         * src/du.c (G_fail, opt_nul_terminate_output): Declare `static'.
4672         * src/ln.c (backup_type): Likewise.
4673
4674         * src/remove.c (rm): Add `extern' keyword.
4675         * src/cp-hash.c (forget_created, remember_created)
4676         (src_to_dest_lookup, remember_copied, hash_init, forget_all): Likewise.
4677         * src/copy.c (dest_info_init, src_info_init, copy): Likewise.
4678         * src/chown-core.c (chopt_init, chopt_free, gid_to_name)
4679         (uid_to_name, chown_files): Likewise.
4680
4681         * src/Makefile.am (sc_tight_scope): New rule.
4682         * Makefile.maint (sc_tight_scope): New rule.
4683         (syntax-check-rules): Add it.
4684
4685 2004-04-26  Jim Meyering  <jim@meyering.net>
4686
4687         * Use automake-1.8.4.  Regenerate dependent files.
4688
4689         * src/sort.c (limfield): Make a comment clearer.
4690
4691 2004-04-25  Paul Eggert  <eggert@twinsun.com>
4692
4693         Fix POSIX-conformance bug: "sort -k 3,3.5b" is supposed to skip
4694         leading blanks when computing the location of the field end;
4695         it is not supposed to skip trailing blanks.  Solaris 8 "sort"
4696         does conform to POSIX.  Also fix the documentation to clarify
4697         this and related issues.
4698
4699         * doc/coreutils.texi (sort invocation): Mention -k earlier, so
4700         that the options are in alphabetical order.  Describe how -b works
4701         more-accurately; this involves fixing some examples, too.  Mention
4702         what happens if the start field falls after an end field or after
4703         a line end.  Warn about using -k without -b, -g, -M, -n, or -t.
4704         Add an example of how to sort IPv4 addresses and Apache Common
4705         Log Format dates.  Remove a duplicate example.
4706         (Putting the tools together): Use separate options rather
4707         than agglomerating them.
4708         * src/sort.c (limfield): Use skipeblanks, not skipsblanks, to
4709         decode whether to skip leading blanks.
4710         (trailing_blanks): Remove.
4711         (fillbuf, getmonth, keycompare): Don't trim trailing blanks.
4712
4713         * tests/pr/Test.pm: Fix typo in env_default comment.
4714         * tests/sort/Test.pm: Likewise.
4715         (18c, 18d): Reverse the order of output lines, so that the
4716         test cases conform to POSIX.
4717
4718 2004-04-22  Paul Eggert  <eggert@twinsun.com>
4719
4720         More signal-handling cleanup for ls.c.  Do not allow signals to
4721         happen between arbitrary output bytes, as the
4722         restore-default-color sequence can bollix up multibyte chars or
4723         color-change sequences in the ordinary output.  Instead, process
4724         signals only between printing a file name and changing the color
4725         back to non_filename_text color.  That way, if the signal handler
4726         changes the color (to the default), 'ls' will change it back when
4727         'ls' continues (after being suspended).
4728
4729         Also, do not bother with signal-handling unless stdout is a
4730         controlling terminal; this lets stdio buffer better when "ls
4731         --color" is piped or sent to a file.
4732
4733         * src/ls.c (sigprocmask, sigset_t) [!defined SA_NOCLDSTOP]: New macros.
4734         Do not include "full-write.h"; no longer needed.
4735         (tcgetpgrp) [! HAVE_TCGETPGRP]: New macro.
4736         (put_indicator_direct): Remove.  All callers changed to use
4737         put_indicator.
4738         (caught_signals, interrupt_signal, stop_signal_count): New vars.
4739         (restore_default_color): Don't bother checking for put_indicator
4740         failure.
4741         (sighandler): Don't handle SIGTSTP; that's another handler now.
4742         Simply set interrupt_signal to the signal, then exit.
4743         (stophandler, process_signals): New functions.
4744         (main): Don't output any color changes until _after_ the signal
4745         handlers are set up.  This fixes a race condition where 'ls'
4746         could be interrupted while initializing colors, and leaving the
4747         terminal in an undesirable state.
4748         Don't mess with signal-handling if standard output is not a
4749         controlling terminal.
4750         When exiting, restore the default color, then restore the
4751         default signal handling, then act on any signals that weren't
4752         acted on yet.
4753         Do not print //DIRED// etc. in colors; this avoids the need
4754         to catch signals when printing them.
4755         (print_name_with_quoting): Process signals just before switching
4756         color back to non_filename_text.
4757
4758 2004-04-23  Jim Meyering  <jim@meyering.net>
4759
4760         Avoid segfault on systems for which SIZE_MAX != (size_t) -1.
4761         * src/ls.c (quote_name): Use SIZE_MAX, not -1, in calls
4762         of quotearg_buffer.  Patch by Mikulas Patocka.
4763
4764 2004-04-18  Paul Eggert  <eggert@twinsun.com>
4765
4766         tee ignored SIGPIPE, but POSIX doesn't allow this.
4767
4768         * src/tee.c (main): Do not ignore SIGPIPE, as POSIX 1003.1-2001
4769         does not allow this.  This undoes the 1996-10-24 patch.
4770
4771 2004-04-18  Paul Eggert  <eggert@twinsun.com>
4772
4773         Signal-handling cleanup for coreutils.  Here are the highlights:
4774
4775          - csplit sometimes failed to remove files when interrupted.
4776          - csplit didn't clean up if two signals arrived nearly simultaneously.
4777          - install -s would infloop on System V if SIGCHLD was ignored.
4778          - ls could incorrectly restore color if multiple signals
4779            arrived nearly simultaneously.
4780
4781         * src/csplit.c (sigprocmask, sigset_t) [!defined SA_NOCLDSTOP]:
4782         Define.
4783         (filename_space, prefix, suffix, digits, files_created, remove_files):
4784         Now volatile.
4785         (caught_signals): New var.
4786         (cleanup): Block signals while deleting all files.
4787         (cleanup_fatal, handle_line_error, regexp_error):
4788         Mark with ATTRIBUTE_NORETURN.
4789         (create_output_file, close_output_file, interrupt_handler):
4790         Block signals while changing the number of output files,
4791         to fix some race conditions.
4792         (delete_all_files): Do nothing if remove_files is zero.
4793         Clear files_created.
4794         (main): Don't mess with signals until after argument processing
4795         is done.
4796
4797         * src/csplit.c (main): Rewrite signal-catching code to make it
4798         similar to other coreutils programs.  When processing signals,
4799         block all signals that we catch, but do not block signals that we
4800         don't catch.  Avoid problems with unsigned int warnings.
4801         * src/ls.c (main): Likewise.
4802         * src/sort.c (main): Likewise.
4803
4804         * src/csplit.c (interrupt_handler):
4805         Use void, not (obsolete) RETSIGTYPE.
4806         * src/shred.c (sigill_handler, isaac_seed_machdep): Likewise.
4807
4808         * src/csplit.c (interrupt_handler) [defined SA_NOCLDSTOP]:
4809         Use simpler "signal (sig, SIG_DFL)" rather than sigaction equivalent.
4810         * src/ls.c (sighandler) [defined SA_NOCLDSTOP]: Likewise.
4811         * src/sort.c (sighandler) [defined SA_NOCLDSTOP]: Likewise.
4812         * src/nohup.c (main) [!defined _POSIX_SOURCE]: Likewise, except
4813         for SIG_IGN.
4814         * src/tee.c (main) [!defined _POSIX_SOURCE]: Likewise.
4815
4816         * src/install.c: Include <signal.h>.
4817         (main) [defined SIGCHLD]: Set SIGCHLD handler to the default, if -s is
4818         given, since System V fork+wait does not work if SIGCHLD is ignored.
4819
4820         * src/ls.c (sighandler) [!defined SA_NOCLDSTOP]: Reset signal
4821         handler to self, not to SIG_IGN, since SIGTSTP can be received
4822         more than once.
4823         (main): Use SA_RESTART, as that is simpler than checking for EINTR
4824         failures all over the place.
4825
4826 2004-04-20  Jim Meyering  <jim@meyering.net>
4827
4828         * src/remove.c (is_empty_dir): Clarify comment.
4829
4830         * man/help2man: Accept new option: --program-name=NAME, so that we
4831         can override the one in --version output.  This is needed solely
4832         so that test.1 doesn't refer to `[' as the program name.
4833         Reported by Benjamin Cutler as http://bugs.debian.org/205251.
4834         * man/Makefile.am (.x.1): Use help2man's new --program-name option.
4835
4836         * src/pwd.c: Don't include pathmax.h; system.h already does it.
4837
4838         * src/cut.c (cut_fields): Free buffer upon getndelim2 failure.
4839
4840 2004-04-19  Jim Meyering  <jim@meyering.net>
4841
4842         * src/shred.c (isaac_seed_start) [AVOID_USED_UNINITIALIZED_WARNINGS]:
4843         Initialize a buffer to avoid warnings from tools like valgrind.
4844
4845         * Makefile.maint (sc_trailing_blank): New rule.
4846         (syntax-check-rules): Add it.
4847         * .x-sc_trailing_blank: New file.
4848
4849         Make pwd work even if the resulting name is so long that getcwd fails.
4850         * src/pwd.c: (path_free, path_init, path_prepend): New functions.
4851         (nth_parent, find_dir_entry, robust_getcwd): New functions.
4852         (main): First try getcwd, then, upon failure, robust_getcwd.
4853
4854 2004-04-18  Jim Meyering  <jim@meyering.net>
4855
4856         * src/who.c (print_user): Use xrealloc here, rather than
4857         unchecked realloc.  Remove anachronistic casts.
4858
4859         * src/remove.c (full_filename_): Don't leak upon failed realloc.
4860
4861         * src/system.h (readdir_ignoring_dot_and_dotdot): New inline function,
4862         from remove.c.
4863         * src/remove.c (readdir_ignoring_dotdirs): Move function to system.h,
4864         renaming it.  Update uses.
4865
4866 2004-04-17  Jim Meyering  <jim@meyering.net>
4867
4868         * configure.ac: Depend on automake-1.8.3.
4869
4870         * src/join.c (add_file_name): Declare function to be `static'.
4871         (string_to_join_field): Likewise.
4872         * src/remove.c (ds_init, ds_free): Likewise.
4873
4874         * Makefile.maint (sc_prohibit_jm_in_m4): New rule.
4875         (syntax-check-rules): Add to the list.
4876
4877 2004-04-13  Paul Eggert  <eggert@twinsun.com>
4878
4879         Use page-aligned buffers whenever we bother to do I/O using buffer
4880         sizes that are tailored for the files.
4881
4882         * src/cat.c: Include getpagesize.h.
4883         * src/copy.c: Likewise.
4884         * src/shred.c: Likewise.
4885         * src/split.c: Likewise.
4886         * src/cat.c (main): Align I/O buffers to page boundaries.
4887         * src/copy.c (copy_reg): Likewise.
4888         * src/shred.c (dopass): Likewise.
4889         * src/split.c (main): Likewise.
4890         * src/dd.c (ROUND_UP_OFFSET, PTR_ALIGN): Remove.
4891         All uses replaced by ptr_align.
4892         * src/od.c (gcd, lcm): Remove; now in system.h.
4893         * src/system.h (gcd, lcm, ptr_align): New functions, moved from od.c.
4894
4895 2004-04-14  Jim Meyering  <jim@meyering.net>
4896
4897         Remove m4/Makefile.am: it's no longer needed, with newer automake
4898         * configure.ac (AC_CONFIG_FILES): Remove m4/Makefile.in from the list.
4899         * Makefile.am (SUBDIRS): Remove `m4' from the list.
4900
4901 2004-04-13  Jim Meyering  <jim@meyering.net>
4902
4903         * configure.ac: Change `jm_' in AC_DEFINE'd names to `gl_'.
4904
4905 2004-03-27  Paul Eggert  <eggert@twinsun.com>
4906
4907         * NEWS: cp -pu and mv -u (when copying) now take the destination
4908         file system time stamp resolution into account.
4909         * doc/coreutils.texi (mv invocation): Document this.
4910         (cp invocation): Document -u (it was missing!) with new behavior.
4911
4912         * src/copy.c: Include "utimecmp.h".
4913         (copy_internal): Compare time stamps using utimecmp rather than
4914         MTIME_CMP.
4915
4916 2004-04-09  Jim Meyering  <jim@meyering.net>
4917
4918         * Makefile.maint (.re-list): New rule/file, to replace
4919         hard-coded list of header file names.
4920         (sc_system_h_headers): Use the new file.
4921         Don't look for sys2.h anymore.
4922
4923         * src/system.h: Include new "stat-macros.h" rather than hard-coding
4924         all of its macro definitions -- the list was slightly out of date.
4925         Suggestion from Dmitry V. Levin.
4926
4927 2004-04-08  Paul Eggert  <eggert@cs.ucla.edu>
4928
4929         * NEWS: Remove noctty flag from dd.  Suggested by Philippe Troin.
4930         * doc/coreutils.texi (dd invocation): Likewise.
4931         * src/shred.c (O_NOCTTY): Remove redundant decl.
4932         * src/dd.c (flags, usage): Remove noctty flag.
4933         (main): Always use O_NOCTTY when opening files.
4934
4935 2004-04-08  Jim Meyering  <jim@meyering.net>
4936
4937         * src/dd.c (dd_copy): Mark two diagnostics for translations.
4938         (set_fd_flags): Undo part of today's change: it's a little
4939         cleaner -- and more efficient in the common case -- to go
4940         ahead and OR in the -1 when fcntl fails.
4941
4942         * Makefile.maint (sc_dd_max_sym_length): New target.
4943         (syntax-check-rules): Add it.
4944
4945         * src/md5sum.c (PROGRAM_NAME) [algorithm == ALG_SHA1]:
4946         Correct spelling: s/shasum/sha1sum.  Reported by Jesse Kornblum.
4947
4948         * src/dd.c (set_fd_flags): Don't OR in -1 when fcntl fails.
4949         Rename parameter, flags, to avoid shadowing global.
4950         (LONGEST_SYMBOL): Tweak comment.
4951
4952 2004-04-07  Paul Eggert  <eggert@twinsun.com>
4953
4954         * NEWS: New dd conv= symbols nocreat, excl, fdatasync, fsync,
4955         and new dd options iflag= and oflag=.
4956         * src/dd.c (usage): Likewise.
4957         * src/Makefile.am (dd_LDADD, shred_LDADD): Add fdatasync's lib.
4958         * src/dd.c (fdatasync) [!HAVE_FDATASYNC]: New macro.
4959         (C_NOCREAT, C_EXCL, C_FDATASYNC, C_FSYNC): New macros.
4960         (input_flags, output_flags): New vars.
4961         (LONGEST_SYMBOL): New macro.
4962         (struct symbol_value): Renamed from struct conversion.  Members
4963         symbol and value renamed from convname and conversion.  The
4964         symbol value is now an array instead of a pointer; this saves
4965         a bit of space and time in practice.  All uses changed.
4966         (conversions): Add nocreat, excl, fdatasync, fsync.  Now const.
4967         (flags): New constant array.
4968         (iflag_error_msgid, oflag_error_msgid): New constants.
4969         (parse_symbols): Renamed from parse_conversion and generalized
4970         to handle either conversion or flag symbols.
4971         (scanargs): Adjust uses of parse_symbols accodingly.  Add
4972         support for iflag= and oflag=.  Reject attempts to use
4973         both excl and nocreat.
4974         (set_fd_flags): New function.
4975         (dd_copy): Just return X rather than calling quit (X), since our
4976         caller invokes quit with the returned value.  Add support for
4977         fdatasync and fsync.
4978         (main): Add support for iflag=, oflag=, and new conv= symbols.
4979         * src/system.h (O_DIRECT, O_DSYNC, O_NDELAY, O_NOFOLLOW,
4980         O_RSYNC, O_SYNC): Define to 0 if not already defined.
4981
4982         * NEWS: Remove duplicate mention of BLOCKSIZE.
4983
4984 2004-04-02  Andreas Schwab  <schwab@suse.de>
4985
4986         * src/stty.c: Add support for IUTF8 input flag.
4987
4988 2004-04-06  Jim Meyering  <jim@meyering.net>
4989
4990         * src/system.h (makedev) [mkdev && !makedev]: Define in terms of mkdev.
4991         Interix spells it `mkdev'.  Reported by Mark Funkenhauser.
4992
4993 2004-04-04  Jim Meyering  <jim@meyering.net>
4994
4995         A specified format is no longer automatically newline terminated.
4996         If you want a newline at the end of your format, use `\n'.
4997         * src/stat.c (print_it): Don't print a newline at the end of
4998         every format.
4999         (do_statfs): Add a newline at end of each default format string.
5000
5001 2004-03-30  Paul Eggert  <eggert@twinsun.com>
5002
5003         * src/nohup.c (main): Adjust to new calling convention
5004         for set_cloexec_flag.
5005
5006 2004-03-31  Jim Meyering  <jim@meyering.net>
5007
5008         * tests/Fetish.pm (run_tests): Remove `.orig' file.
5009         Remove debugging diagnostic.
5010
5011         Specifying an invalid --width=N (-w) or --gap-size=N (-g)
5012         would not elicit an error.
5013         * src/ptx.c: Include "xstrtol.h" and "quotearg.h".
5014         (main): Don't use atoi.  Use xstrtoul instead.
5015
5016 2004-03-30  Jim Meyering  <jim@meyering.net>
5017
5018         * Makefile.maint (sc_prohibit_atoi_atof): New rule.
5019         (syntax-check-rules): Add it.
5020         * .x-sc_prohibit_atoi_atof: New file.
5021
5022 2004-03-29  Jim Meyering  <jim@meyering.net>
5023
5024         * tests/du/files0-from: Use new OUT_SUBST directive, so that this
5025         test is not sensitive to system-dependent block size differences.
5026         Prompted by a report of Solaris 8 differences from Paul Eggert.
5027
5028         * tests/Fetish.pm: Accept new directives: OUT_SUBST, ERR_SUBST.
5029         Rename `%tmp' to `%actual'.  Reverse order of last two args to
5030         _compare_files (to $actual, $expected) so as to match declaration.
5031
5032 2004-03-28  Paul Eggert  <eggert@twinsun.com>
5033
5034         Fix some gotchas encountered when porting to Solaris 8, using
5035         the Forte 6u2 compiler.
5036
5037         * src/hostname.c [HAVE_SETHOSTNAME && !defined sethostname]:
5038         Declare sethostname, since no Solaris header does it.
5039         * src/who.c: Include "vasprintf.h", for asprintf.
5040
5041 2004-03-28  Jim Meyering  <jim@meyering.net>
5042
5043         Minor optimization:
5044         * src/du.c (process_file): Don't record dev/inode for directories.
5045
5046         Under some circumstances, without -c, du would mistakenly count the
5047         space of hard-linked files, not just the first one it encountered.
5048         Reported by Anthony Thyssen.
5049         * src/du.c (du_files): Don't ever clear the set of `seen' dev/inodes.
5050
5051         * src/du.c: Rename global `print_totals' to `print_grand_total'.
5052
5053         * src/du.c (main): Rearrange filtering loop to be a tiny bit
5054         more efficient.
5055
5056         * src/chown-core.c: Don't include savedir.h -- no longer needed.
5057         * src/chmod.c: Likewise.
5058
5059 2004-03-25  Jim Meyering  <jim@meyering.net>
5060
5061         * src/du.c (main): Remove now-unused declaration of `i'.
5062
5063 2004-03-24  Paul Eggert  <eggert@twinsun.com>
5064
5065         * src/du.c (main): Filter out file names of length zero before
5066         invoking fts, so that they don't cause fatal errors.
5067
5068 2004-03-25  Jim Meyering  <jim@meyering.net>
5069
5070         * tests/du/files0-from (zero-len): Add a test for the above.
5071
5072 2004-02-25  Paul Eggert  <eggert@twinsun.com>
5073
5074         * NEWS: New environment var BLOCKSIZE.
5075         * lib/human.c (humblock): Support BLOCKSIZE as well as BLOCK_SIZE.
5076         * tests/envvar-check: Test for it.  Factor the code to simplify it.
5077
5078 2004-03-23  Paul Eggert  <eggert@twinsun.com>
5079
5080         * NEWS: Shorten the du --files0-from announcement, and say
5081         "NUL-terminated" rather than "NUL-separated".
5082         * src/du.c (EXPECTED_BYTES_PER_FILE_NAME, DEFAULT_PROJECTED_N_FILES):
5083         Remove: not used.
5084         (usage): Say "NUL-terminated", not "NUL-separated".
5085         (main): Check for I/O error when istream is closed.
5086         Allow --files0-from=F even if F is empty; this specifies no files.
5087         (du_files): Now that we allow the list of files to be empty,
5088         handle that case.
5089         * tests/du/files0-from: Adjust to above changes to src/du.c.
5090
5091 2004-03-24  Jim Meyering  <jim@meyering.net>
5092
5093         * tests/tail-2/assert: Avoid race condition that could cause
5094         spurious failure.  Based on a patch from Andreas Schwab.
5095
5096 2004-03-23  Jim Meyering  <jim@meyering.net>
5097
5098         * src/du.c (main): Free the hash table, too.
5099
5100 2004-03-22  Jim Meyering  <jim@meyering.net>
5101
5102         * man/Makefile.am (.x.1): Remove --info-page= option, reverting
5103         the change of 2004-01-22.  I can no longer reproduce the problem
5104         that prompted that change, and `info coreutils pr' would display the
5105         `printing text' section of the manual, not the one on `pr invocation'.
5106
5107         * tests/du/files0-from (nul-1, nul-2): Adjust expected diagnostics
5108         to match corrected output.
5109
5110         * src/du.c: Include "readtokens0.h" rather than "readtokens.h".
5111         (main): Use readtoken0 functions rather than readtokens.
5112         Don't use errno when diagnosing readtokens0 failure.
5113         Fix off-by-one error in the token number reported in a diagnostic.
5114         (du_files): Return bool, rather than int.
5115         (main): Call readtokens0_free.
5116
5117 2004-03-21  Jim Meyering  <jim@meyering.net>
5118
5119         * src/remove.c (ds_free): Plug a small leak.
5120
5121         * tests/Fetish.pm: Fix typo in comment.
5122
5123 2004-03-07  Jim Meyering  <jim@meyering.net>
5124
5125         * NEWS: du accepts a new option --files0-from=FILE, where FILE
5126         contains a list of NUL-separated file names.
5127
5128         * src/du.c: Include "readtokens.h".
5129         (usage): Describe the new option, and adjust the `Usage':
5130         with this option, no FILE may be specified on the command line.
5131         (main): Handle the new option.
5132
5133         * tests/du/files0-from: New tests, for the above.
5134         * tests/du/Makefile.am (TESTS): Add files0-from.
5135
5136         * src/factor.c (do_stdin): Reflect changes in use of readtoken.
5137         * src/tsort.c (tsort): Likewise.
5138
5139 2004-02-29  Paul Eggert  <eggert@twinsun.com>
5140
5141         * NEWS: Add support for a new notation @N to get_date to represent
5142         the time stamp with numeric value N.  Improve support for
5143         fractional time stamps.  date's -d and -f options now accept them.
5144         Likewise for touch -t.  date has a new option --iso-8601=ns.
5145
5146         * doc/coreutils.texi (touch invocation):
5147         Describe use of fractional seconds.
5148         (date invocation, Options for date): Likewise.
5149         * doc/getdate.texi (General date syntax, Time of day items): Likewise.
5150         * doc/coreutils.texi (date invocation): Mention effect of LC_TIME.
5151         (Options for date): Describe new --iso-8601=ns option.
5152
5153         * doc/getdate.texi: Add copyright notice.  Change getdate to
5154         get_date when talking about the function name.
5155         (Seconds since the Epoch): New section, containing the time_t
5156         info moved from Date input formats section, along with new
5157         info about the @ syntax.  Mention negative time stamps,
5158         fractional time stamps, and leap seconds.
5159         (General date syntax): Modernize examples a bit to reflect new
5160         features.
5161         (General date syntax, Relative items in date strings):
5162         Use ' rather than " to quote formats.
5163         (Time of day items): Add an example with fractional seconds.
5164         Describe fractional-second syntax.
5165
5166         * src/Makefile.am (touch_LDADD): New macro, since `touch' now
5167         needs clock_gettime.
5168
5169         * src/date.c (enum Time_spec): New enum TIME_SPEC_NS.
5170         (time_spec_string, time_spec, show_date): Support it.
5171         (usage): Remove description of -ITIMESPEC, as it's obsolete and
5172         confusing.  Mention --iso-8601=ns.
5173         (batch_convert): getline returns ssize_t, not int.
5174
5175         * src/touch.c (newtime): Now an array of two timespecs, one
5176         for access and one for modification.
5177         (ref_stats): Remove.
5178         (get_reldate): Use get_date's parameter profile.
5179         (touch, main): Adjust to above changes.
5180         (main): Work even if tm_year == INT_MAX (so long as long int is wider).
5181         Use gettime instead of gettimeofday, for new get_date signature.
5182
5183         * tests/date/Test.pm (test_vector): New tests epoch, ns-10, ns-max32,
5184         ns-relative.
5185
5186 2004-03-15  Jim Meyering  <jim@meyering.net>
5187
5188         * Makefile.maint (alpha beta major): `Make' the emit_upload_commands
5189         target before updating $(prev_version_file).
5190
5191         * tests/misc/date-sec: New file, to test for just-fixed bug in date.
5192         See today's change in lib/getdate.y.
5193         * tests/misc/Makefile.am (TESTS): Add date-sec.
5194
5195 2004-03-14  Jim Meyering  <jim@meyering.net>
5196
5197         * announce-gen (print_changelog_deltas): Use `.sig' suffix for
5198         signature files, not `.asc'.  Reported by angico@yahoo.com.
5199
5200 2004-03-13  Jim Meyering  <jim@meyering.net>
5201
5202         * src/cp.c (do_copy): Tweak wording in a diagnostic.
5203         Suggestion from Karl Berry.
5204         Include "quoatearg.h".
5205         (do_copy): Use quotearg_colon (not quote) for diagnostics
5206         that begin with `"%s:'.
5207
5208         * src/nl.c (usage): Specify that nl uses _basic_ regular expressions.
5209         Suggestion from Dan Jacobson.
5210
5211 2004-03-12  Jim Meyering  <jim@meyering.net>
5212
5213         * Version 5.2.1.
5214
5215         Sometimes, when source and destination partition are different,
5216         mv mistakenly fails to preserve a hard link.  Reported by IIDA Yosiaki.
5217
5218         * src/copy.c: When moving a set of N hard-linked files between
5219         partitions, via two or more command line arguments where the
5220         command line argument containing the Nth link contains no other
5221         link to that same file, mv would mistakenly copy the file, rather
5222         than hard-linking it to the other(s).  That happens because when the
5223         final link is processed, its link count has been reduced to 1 since
5224         the other links have been `copied' to the destination partition
5225         and the source links have been removed.
5226         (copy_internal): When in move mode, use the source dev/inode
5227         pair to look up destination name even when st_nlink == 1.
5228         * src/cp-hash.c (src_to_dest_lookup): New function.
5229         * src/cp-hash.h (src_to_dest_lookup): Add prototype.
5230         * tests/mv/part-hardlink: New file.  Test for the above fix.
5231         * tests/mv/Makefile.am (TESTS): Add part-hardlink.
5232
5233         * announce-gen: Sync with autoconf.
5234
5235         * tests/ls/time-1: Exit 77 (not 1) if we can't set up for the test.
5236         This was triggered on a Linux-2.2.19 system using a file system
5237         NFS-mounted from some sort of Sun.
5238
5239 2004-03-11  Jim Meyering  <jim@meyering.net>
5240
5241         * Use automake-1.8.3.  Regenerate dependent files.
5242
5243 2004-03-10  Jim Meyering  <jim@meyering.net>
5244
5245         * tests/du/deref-args: Also convert sizes in the 70-79 kB range,
5246         so that this test works with SELinux-enabled systems.
5247         Based on a patch from Tim Waugh.
5248
5249         `join -1 x' would give a misleading diagnostic
5250         * src/join.c (string_to_join_field): Report that a non-numeric field
5251         number is invalid, rather than `so large that it is not representable'.
5252         * tests/join/Test.pm (invalid-j): New partial test for the above fix.
5253
5254 2004-03-06  Jim Meyering  <jim@meyering.net>
5255
5256         cp --sparse=always sparse-image-file.img /dev/hda1 could
5257         produce an invalid copy on the destination device.
5258
5259         * src/copy.c (copy_reg): Even with --sparse=always, try to
5260         make `holes' only if the destination is a regular file.
5261         Reported by Szakacsits Szabolcs.
5262
5263 2004-03-03  Paul Eggert  <eggert@twinsun.com>
5264
5265         * src/nohup.c (main): Don't invoke set_cloexec_flag with
5266         a file descriptor of -1.
5267
5268 2004-03-02  Dmitry V. Levin  <ldv@altlinux.org>
5269
5270         * src/nohup.c: Include "cloexec.h".
5271         (main): Set the copy of stderr to close on exec.
5272
5273 2004-03-01  Paul Eggert  <eggert@twinsun.com>
5274
5275         * configure.ac: Include <signal.h> when checking for strsignal,
5276         sys_siglist, and friends.  Problem reported by Tony Leneis in
5277         <http://mail.gnu.org/archive/html/bug-coreutils/2004-02/msg00136.html>.
5278
5279 2004-02-25  Paul Eggert  <eggert@twinsun.com>
5280
5281         * tests/du/deref-args, tests/du/exclude, tests/du/slash:
5282         * tests/du/trailing-slash: Run envvar-check in case BLOCK_SIZE
5283         etc. are set.
5284
5285 2004-02-23  Paul Eggert  <eggert@twinsun.com>
5286
5287         * NEWS: Document how chown's USER.GROUP argument is now parsed.
5288
5289 2004-02-23  Jim Meyering  <jim@meyering.net>
5290
5291         * src/seq.c (usage): Remove stray space after \n in --help output.
5292
5293 2004-02-22  Jim Meyering  <jim@meyering.net>
5294
5295         * src/du.c (usage): Separate -H and --si.  Say that the meaning
5296         of -H will soon change to that of --dereference-args (-D).
5297
5298 2004-02-21  Jim Meyering  <jim@meyering.net>
5299
5300         * src/comm.c (usage): Tell what comm does when there are no options.
5301         Reword in terms of FILE1 and FILE2 rather than `left file' and
5302         `right file'.  Suggestion from Dan Jacobson.
5303
5304 2004-02-15  Paul Eggert  <eggert@twinsun.com>
5305
5306         Fix some POSIX-conformance bugs in expr.
5307
5308         * NEWS: document the following changes to src/expr.c.
5309         * doc/coreutils.texi (expr invocation): Likewise.
5310         Document what forms integers may take, and say "integer"
5311         consistently instead of "number".  Warn about operands
5312         that "expr" can misinterpret, and how to work around the
5313         problem.
5314         * src/expr.c (eval, eval7, eval6, eval5, eval4, eval3, eval2, eval1):
5315         Accept a bool argument specifying whether to evaluate the
5316         expression.  This is to allow short-circuit evaluation.  All
5317         callers changed.
5318         (null): Report that a string is zero even if it has
5319         a form like "-0" or "00".
5320         (eval1, eval): Use short-circuit evaluation for | and &.
5321         (eval): Return 0 if both arguments are null or zero, instead
5322         of returning the first argument.
5323         * tests/expr/basic: Add some tests for the above.
5324
5325 2004-02-17  Jim Meyering  <jim@meyering.net>
5326
5327         * Version 5.2.0.
5328
5329         `make check' from a build inside a chroot environment would fail
5330         * tests/help-version: Specify an argument (`/') for df, in the
5331         unusual event that there is no valid entry in /etc/mtab.
5332         Likewise for id: add the -u option, so we don't get spurious
5333         failures when there are no user or group names.
5334         Patch by Tim Waugh.
5335
5336         * src/sort.c (usage) [-u]: Add punctuation so that the description in
5337         the help2man-generated (line-joined) man page is more readable.
5338         Reported by Tim Waugh.
5339         [-T]: Add a semicolon, for the same reason.
5340
5341 2004-02-15  Jim Meyering  <jim@meyering.net>
5342
5343         * Makefile.am (dist-hook): Qualify target with $(srcdir)/ prefix.
5344
5345 2004-02-11  Jim Meyering  <jim@meyering.net>
5346
5347         * tests/Makefile.am.in ($(srcdir)/Makefile.am): Use more portable
5348         $(srcdir)/../Makefile.am.in, rather than $<.
5349         Suggestion from Michael Elizabeth Chastain.
5350
5351 2004-02-10  Jim Meyering  <jim@meyering.net>
5352
5353         * config/install-sh: Make this script executable.
5354         * Makefile.am (dist-hook): New target, to ensure that config/install-sh
5355         is executable.  Otherwise, on systems that lack a suitable install
5356         binary, `make install' would fail, because of the way this script
5357         is invoked (without `$SHELL ' prefix).
5358         Reported by Bob Proulx.
5359
5360 2004-02-08  Jim Meyering  <jim@meyering.net>
5361
5362         * Version 5.1.3.
5363
5364         * tests/rm/rm5: Avoid triggering a bug in OSF/Tru64's sed
5365         that would cause an unwarranted test failure.
5366         * tests/rm/rm3: Likewise.
5367
5368 2004-02-07  Jim Meyering  <jim@meyering.net>
5369
5370         Remove xstat function pointer member.  The way it was used was not
5371         portable, since some systems (OSF V5.1, Solaris 2.5.1) provide static
5372         inline `stat' and `lstat' functions, thus making the tests of
5373         `xstat == lstat' in copy.c always fail.
5374         * src/copy.h (struct cp_options) [xstat]: Remove member.
5375         (XSTAT): New macro.
5376         * src/copy.c (copy_dir): Set `.dereference' member, not .xstat.
5377         (copy_internal): Use `XSTAT (x, ...)' in place of `*(x->xstat) (...)'.
5378         Use `x->dereference == DEREF_NEVER' in place of `x->xstat == lstat'.
5379         (valid_options): Remove now-obsolete FIXME comments.
5380
5381         * src/cp.c (re_protect): Use `XSTAT (x, ...)' in place of
5382         `*(x->xstat) (...)'.
5383         (do_copy): Declare/use local xstat rather than x->xstat.
5384         (main): Remove code that set x.xstat.
5385         * src/mv.c (cp_option_init): Don't initialize xstat member.
5386         * src/install.c (cp_option_init): Likewise.
5387
5388         * Makefile.cfg (gnu_ftp_host-alpha, etc.): Un-factor .gnu.org suffix,
5389         so that emit_upload_commands can use these variables, too.
5390
5391 2004-02-06  Jim Meyering  <jim@meyering.net>
5392
5393         * tests/rm/deep-1: Remove `du' stack space test.
5394         Apparently, `ulimit -s N' isn't portable enough.
5395         This test will be restored (with a guard against losing ulimit)
5396         in its own file later.
5397
5398         * tests/rm/deep-1 (deep): Remove progress-style diagnostics,
5399         since this test doesn't take long enough to merit them.
5400         Run du on $tmp (the containing dir), not $deep, the full path to leaf.
5401
5402         * Makefile.maint (signatures): Remove definition.
5403         Now, automake's gnupload handles this.
5404         (%.sig: %): Remove now-unused rule.
5405         (rel-files): Use automake's $(DIST_ARCHIVES), rather than
5406         `$(distdir).tar.bz2 $(distdir).tar.gz'.
5407         (emit-upload-commands): Adjust to use gnupload.
5408
5409 2004-02-05  Jim Meyering  <jim@meyering.net>
5410
5411         * src/system.h (ST_TIME_CMP_NS, ST_TIME_CMP): Remove definitions.
5412         (ATIME_CMP, CTIME_CMP, MTIME_CMP, TIMESPEC_NS): Likewise.
5413         Now, those are all defined in timespec.h.
5414         Include timespec.h.
5415
5416         * src/date.c: Don't include timespec.h, now that system.h does it.
5417
5418 2004-02-02  Paul Eggert  <eggert@twinsun.com>
5419
5420         Don't dump core if localtime returns NULL (possible on
5421         hosts with 64-bit time_t and 32-bit int).
5422         * src/date.c: Include "inttostr.h".
5423         (batch_convert, main):
5424         If time conversion fails, exit with nonzero status.
5425         (show_date): Return int to report conversion failure.
5426         Print the time as an int if localtime fails.
5427         * src/uptime.c: Print "??" if the current clock can't
5428         be converted by localtime.  This won't happen until the year
5429         2*31 + 1900, but we don't want to dump core even if the current
5430         clock has the wrong value.
5431
5432         * src/stat.c: Include "inttostr.h".
5433         (human_time): Print the date/time as a number of seconds since the
5434         epoch if it can't be converted by localtime.  This is better than
5435         just saying "invalid", and is consistent with what "ls" does.
5436         Don't dump core if the year has more than 48 digits; this isn't
5437         possible on any contemporary host, but we might as well do it right.
5438
5439 2004-01-31  Paul Eggert  <eggert@twinsun.com>
5440
5441         * src/stat.c (human_time): Accept time rather than
5442         pointer-to-const-time parameter, for clarity.  All callers changed.
5443
5444 2004-02-02  Jim Meyering  <jim@meyering.net>
5445
5446         * src/stat.c (do_stat): Remove extra trailing newline from
5447         default formats.  Reported by Nelson H. F. Beebe.
5448
5449         Print actual fractional seconds in time stamps, not just `.00000000'.
5450         * src/stat.c (human_time): Add and use new parameter, t_ns.
5451         (print_stat): Update callers.
5452         * src/ls.c (TIMESPEC_NS): Remove definition.
5453         * src/system.h (TIMESPEC_NS): Define here, instead, now that stat.c
5454         also uses this macro.
5455         Nelson H. F. Beebe noticed that ls --full-time printed nonzero
5456         fractional seconds for files on an XFS file system, but that stat's
5457         fractional seconds were always zero.
5458
5459 2004-01-28  Paul Eggert  <eggert@twinsun.com>
5460
5461         * src/seq.c (print_numbers): Use 'double' for loop index, not
5462         'int', to avoid problems with integer overflow.  On almost all
5463         machines 'double' works in every case where 'int' works, and
5464         it works on other cases besides.
5465
5466 2004-01-27  Jim Meyering  <jim@meyering.net>
5467
5468         * src/seq.c (usage): Mention that if INCREMENT is omitted,
5469         it defaults to 1, even when FIRST is larger than LAST.
5470         Reword so as not to exclude the possibility that INCREMENT be zero.
5471
5472 2004-01-25  Jim Meyering  <jim@meyering.net>
5473
5474         * Version 5.1.2.
5475
5476         * Makefile.maint (signatures): Comment out definition.
5477
5478 2004-01-23  Jim Meyering  <jim@meyering.net>
5479
5480         * Makefile.maint (header_regexp): Add exitfail.
5481
5482         * man/Makefile.am (EXTRA_DIST): Add help2man.
5483         Reported by Nelson H. F. Beebe.
5484
5485         * man/Makefile.am (.x.1): Prefix help2man invocation with `$(PERL) --'
5486         so it works on systems with Perl installed somewhere other than in
5487         /usr/bin.
5488
5489         * src/paste.c (paste_parallel): Declare local, chr, to be of type
5490         `int', not `char', since it must hold EOF.  This bug would make
5491         paste infloop on some systems.  Test failures reported by
5492         Nelson H. F. Beebe and Christian Krackowizer.
5493
5494 2004-01-22  Jim Meyering  <jim@meyering.net>
5495
5496         * tests/rmdir/fail-perm: New file.  Test for just-fixed rmdir bug.
5497         * tests/rmdir/Makefile.am (TESTS): Add fail-perm.
5498
5499         * man/help2man: Fix it so using --info-page='coreutils PROG' works.
5500         * man/Makefile.am (.x.1): Invoke our own (tweaked) copy of help2man.
5501         Use --info-page='coreutils PROG' option.
5502         Now, readlink.1 refers the user to `info coreutils readlink'
5503         rather than to `info readlink'.  Reported by Matt Swift.
5504
5505 2004-01-21  Paul Eggert  <eggert@twinsun.com>
5506
5507         Exit status cleanup.
5508
5509         * src/basename.c (usage): Use EXIT_SUCCESS, not 0, for clarity.
5510         * src/cat.c, src/chgrp.c, src/chmod.c, src/chown.c, src/chroot.c,
5511         * src/cksum.c, src/comm.c, src/cp.c, src/csplit.c, src/cut.c,
5512         * src/date.c, src/dd.c, src/df.c, src/dircolors.c, src/dirname.c,
5513         * src/du.c, src/echo.c, src/env.c, src/expand.c, src/expr.c,
5514         * src/factor.c, src/fmt.c, src/fold.c, src/head.c, src/hostid.c,
5515         * src/hostname.c, src/id.c, src/install.c, src/join.c, src/kill.c,
5516         * src/link.c, src/ln.c, src/logname.c, src/ls.c, src/md5sum.c,
5517         * src/mkdir.c, src/mkfifo.c, src/mknod.c, src/mv.c, src/nice.c,
5518         * src/nl.c, src/nohup.c, src/od.c, src/paste.c, src/pathchk.c,
5519         * src/pinky.c, src/pr.c, src/printenv.c, src/printf.c, src/pwd.c,
5520         * src/rm.c, src/rmdir.c, src/seq.c, src/setuidgid.c, src/shred.c,
5521         * src/sleep.c, src/sort.c, src/split.c, src/stat.c, src/stty.c,
5522         * src/su.c, src/sum.c, src/sync.c, src/tac.c, src/tail.c, src/tee.c,
5523         * src/test.c, src/touch.c, src/tr.c, src/tsort.c, src/tty.c,
5524         * src/uname.c, src/unexpand.c, src/uniq.c, src/unlink.c, src/uptime.c,
5525         * src/users.c, src/wc.c, src/who.c, src/whoami.c, src/yes.c: Likewise.
5526
5527         * src/cat.c (usage): Don't bother normalizing exit status
5528         since the arg is already the correct exit status now.
5529         * src/cksum.c, src/comm.c, src/csplit.c, src/cut.c,
5530         * src/dircolors.c, src/expand.c, src/fmt.c, src/fold.c, src/head.c,
5531         * src/join.c, src/md5sum.c, src/nl.c, src/od.c, src/paste.c,
5532         * src/pr.c, src/split.c, src/sum.c, src/tac.c, src/tail.c, src/tr.c,
5533         * src/tsort.c, unexpand.c, src/src/uniq.c, src/src/wc.c: Likewise.
5534
5535         * src/chown.c (main): Removed unused local 'fail'.
5536
5537         * src/chroot.c (CHROOT_FOUND_BUT_CANNOT_INVOKE, CHROOT_FAILURE):
5538         Remove.
5539
5540         * src/chroot.c (main): Initialize exit_failure to EXIT_FAIL.
5541         * src/env.c, src/nice.c, src/su.c: Likewise.
5542         * src/nohup.c (main): Likewise, to NOHUP_FAILURE.
5543         * src/setuidgid.c (main): Likewise, to SETUIDGID_FAILURE.
5544         * src/expr.c (main): Use initialize_exit_failure rather than
5545         setting exit_failure directly; this optimizes away redundant
5546         assignments.
5547         * src/printenv.c, src/sort.c, src/test.c, src/tty.c: Likewise.
5548
5549         * src/chroot.c (main): Exit with status 1 rather than 127
5550         if chroot itself fails, as per documentation.
5551
5552         * src/chroot.c (main): Use EXIT_ENOENT and EXIT_CANNOT_INVOKE
5553         rather than roll-your-own symbols or integers.
5554         * src/env.c (main): Likewise.
5555         * src/nohup.c (main): Likewise.
5556         * src/su.c (run_shell): Likewise.
5557
5558         * src/cp.c (exit_status): Remove static var....
5559         (main): Making it local here instead.  Use =, not |=, to set it.
5560
5561         * src/cut.c (FATAL_ERROR, main): Exit with status EXIT_FAILURE,
5562         not 2, on errors.
5563         * src/date.c (batch_convert, main): Likewise.
5564         * src/dd.c (dd_copy): Likewise.
5565         * src/pr.c (first_last_page, main, getoptarg): Likewise.
5566         * src/tr.c (main): Likewise.
5567         * src/date.c (main): Don't assume EXIT_FAILURE == 1, as
5568         POSIX doesn't require it.
5569         * src/dd.c (write_output, skip, dd_copy): Likewise.
5570         * src/df.c (main): Likewise.
5571         * src/id.c (main): Likewise.
5572         * src/install.c (main): Likewise.
5573         * src/ln.c (main): Likewise.
5574         * src/ls.c (main): Likewise.
5575         * src/mv.c (main): Likewise.
5576         * src/shred.c (main): Likewise.
5577
5578         * src/env.c (main): Exit with status 1, not 2, on errors detected
5579         by env proper.
5580         * src/hostname.c (main): Likewise.
5581         * src/nl.c (main): Likewise.
5582         * src/stty.c (main): Likewise.
5583
5584         * src/expr.c (EXPR_FAILURE): Renamed from EXPR_ERROR, for
5585         consistency with the other programs' naming conventions.
5586         All uses changed.
5587
5588         * src/factor.c (main): Do not report a usage error simply
5589         because stdin has bad numbers.
5590
5591         * src/id.c (problems): Now a boolean int, not a counter,
5592         so that we don't have to worry about int overflow.  All uses changed.
5593         * src/touch.c (err): Likewise.
5594
5595         * src/md5sum.c (main): Use int, not size_t, to store boolean int.
5596
5597         * src/mkfifo.c (main): Exit with status 1, not 4, if not implemented.
5598         * src/mknod.c: Likewise.
5599
5600         * src/nice.c (main): Exit with status EXIT_FAIL, not EXIT_FAILURE,
5601         on error; this is in case EXIT_FAILURE is unusual.
5602         * src/su.c (main): Likewise.
5603
5604         * src/nohup.c (NOHUP_FOUND_BUT_CANNOT_INVOKE): Remove; all uses
5605         changed to EXIT_CANNOT_INVOKE.
5606
5607         * src/printenv.c (PRINTENV_FAILURE): New constant.
5608         (main): Exit with status PRINTENV_FAILURE, not EXIT_FAILURE, on
5609         command-line syntax problems.
5610
5611         * src/rmdir.c (remove_parents): Don't set 'fail' to a negative number.
5612         (main): Avoid integer overflow when seeing whether errors occurred.
5613
5614         * src/seq.c (print_numbers): Now returns void, not (zero) int.
5615         All callers changed.
5616         (main): Remove unused local variable 'errs'.  Always exit successfully
5617         if we reach the end.
5618
5619         * src/setuidgid.c (SETUIDGID_FAILURE): Renamed from FAIL_STATUS,
5620         for consistency with other programs here.  All uses changed.
5621         (main): Use 'error' to exit rather than invoking 'exit' here.
5622
5623         * src/sort.c: Don't include <assert.h>.
5624         (SORT_OUT_OF_ORDER,  SORT_FAILURE): Now enums, not macros.
5625         (usage): Don't use 'assert'.
5626         (main): Remove redundant assignment to exit_failure.
5627
5628         * src/system.h (EXIT_FAIL, EXIT_CANNOT_INVOKE, EXIT_ENOENT):
5629         New enum values.
5630         (initialize_exit_failure): New inline function.
5631         Include exitfail.h here, since we refer to exit_failure.
5632         All callers changed to not include exitfail.h.
5633
5634         * src/tty.c (TTY_FAILURE, TTY_WRITE_ERROR): New enum values;
5635         substitute them for the corresponding integer constants.
5636
5637         * tests/help-version (expected_failure_status_date): Remove, as
5638         'date' is now normal.
5639         (expected_failure_status_nohup): New var.
5640
5641 2004-01-21  Jim Meyering  <jim@meyering.net>
5642
5643         * tests/touch/relative: Remove `command' syntax.
5644         Thanks to Nelson H. F. Beebe and Paul Eggert.
5645
5646         * tests/touch/relative: Test only year/month/day, not hours/min/sec,
5647         so as to avoid problems with systems using TAI clocks.
5648         Although it's no longer necessary, set TZ=UTC0 also for the
5649         initial touch command.  Reported by Paul Jarc here:
5650         http://article.gmane.org/gmane.comp.gnu.core-utils.bugs/1504
5651
5652 2004-01-20  Diego Biurrun  <diego@biurrun.de>
5653
5654         * src/dircolors.hin: Add .mov to the list of media files.
5655
5656 2004-01-19  Paul Eggert  <eggert@twinsun.com>
5657
5658         * tests/touch/relative: Use TZ=UTC0, not TZ=utc (which isn't
5659         portable).  Problem reported by Christian Krackowizer.  Also, use
5660         +0000 rather than +0 to specify a time zone, as the documentation
5661         requires four digits.
5662
5663 2004-01-19  Jim Meyering  <jim@meyering.net>
5664
5665         * tests/mv/hard-4: Run envvar-check in case SIMPLE_BACKUP_SUFFIX is set.
5666         * tests/mv/backup-is-src: Likewise.
5667         Problem reported by Peter Horst
5668
5669 2004-01-17  Jim Meyering  <jim@meyering.net>
5670
5671         * announce-gen (print_changelog_deltas): Use .sig suffix, not .asc.
5672
5673         * Version 5.1.1.
5674
5675 2003-12-15  Paul Eggert  <eggert@twinsun.com>
5676
5677         * NEWS, doc/coreutils.texi: touch -r and -d can now both be specified,
5678         with -r specifying the origin for -d.
5679         * src/touch.c (flexible_date): Remove static var.
5680         (get_reldate): New function.
5681         (main): Use it, to implement this new behavior.
5682
5683 2004-01-16  Jim Meyering  <jim@meyering.net>
5684
5685         * tests/touch/relative: New test for the above.
5686         * tests/touch/Makefile.am (TESTS): Add relative.
5687
5688 2004-01-13  Jim Meyering  <jim@meyering.net>
5689
5690         * src/system.h: Include contents of sys2.h.
5691         * src/sys2.h: Remove file.
5692         * src/Makefile.am (noinst_HEADERS): Remove sys2.h.
5693
5694         * Use automake-1.8.2.  Regenerate dependent files.
5695
5696         * Update to gettext-0.13.1.
5697         * configure.ac: Use gettext-0.13.1.
5698         * .x-sc_space_tab: Add m4/po.m4 to the list of exceptions.
5699
5700 2004-01-12  Jim Meyering  <jim@meyering.net>
5701
5702         * Makefile.maint (%.sig): Use .sig suffix rather than .asc.
5703
5704         * Makefile.maint (po-check): Ensure that cvsu works before using it.
5705         Reported by Alexandre Duret-Lutz.
5706
5707         * src/tail.c (main): Warn about following stdin only when it's a tty.
5708
5709         * configure.ac: Use gl_DEFAULT_POSIX2_VERSION.
5710
5711 2004-01-10  Jim Meyering  <jim@meyering.net>
5712
5713         * tests/misc/stat-fmt: Use backticks, not `$()' notation.
5714
5715 2004-01-09  Jim Meyering  <jim@meyering.net>
5716
5717         * configure.ac: Quote underquoted `jm_DUMMY_1' to avoid new warning.
5718
5719 2004-01-08  Jim Meyering  <jim@meyering.net>
5720
5721         * src/stat.c (human_fstype): Use %lx, not %x format for `unsigned long'.
5722         From Andreas Schwab.
5723
5724         * tests/Makefile.am (TESTS_ENVIRONMENT): Remove `/vg' (prerelease test
5725         remnant) from PATH component.  That would cause tests in this directory
5726         not to run the just-built binaries, but rather whatever happened
5727         to be in one's PATH.  Reported by Christian Krackowizer.
5728
5729 2004-01-04  Jim Meyering  <jim@meyering.net>
5730
5731         * src/csplit.c (new_control_record): Use x2nrealloc
5732         rather than xrealloc.
5733
5734         * src/cp.c (re_protect): Use ASSIGN_STRDUPA rather than
5735         alloca and strcpy.
5736         (make_path_private): Likewise.
5737
5738 2004-01-03  Jim Meyering  <jim@meyering.net>
5739
5740         * src/paste.c: Use `bool' (not int) as the type for a few
5741         global variables.
5742         (collapse_escapes): Rewrite to set globals rather than modifying
5743         its parameter.
5744         Use size_t (not int) for all counters and related index variables.
5745         (paste_parallel): Remove needless complexity of
5746         using xrealloc in the loop;  just allocate the buffers up front.
5747         Free the two temporary buffers.
5748         Move declarations of locals `down' into scope where used.
5749         (paste_serial): Remove `register' attributes.
5750         (main): Simplify delim-related code.
5751         Free `delims', now that it's malloc'd.
5752
5753 2004-01-02  Jim Meyering  <jim@meyering.net>
5754
5755         * src/chroot.c: Include "quote.h".
5756         (CHROOT_FOUND_BUT_CANNOT_INVOKE, CHROOT_FAILURE): Define.
5757         (main): Exit with status of 127, not 1, for too-few-args,
5758         chroot failure, or chdir failure.
5759         Give a better diagnostic upon execvp failure.
5760
5761         * src/du.c (usage): Mention that, with its current meaning,
5762         -H is deprecated.
5763
5764         * src/tail.c (main): Warn about following stdin when it's a tty.
5765         Fail when following by name but no names are specified.
5766
5767 2003-12-30  Jim Meyering  <jim@meyering.net>
5768
5769         * src/fold.c (main): Use memcpy, not strcpy.
5770
5771         * src/copy.c (copy_internal): Use ASSIGN_STRDUPA rather than
5772         alloca and strcpy.
5773
5774 2003-12-28  Jim Meyering  <jim@meyering.net>
5775
5776         * src/unexpand.c (n_tabs_allocated): New global.
5777         (add_tabstop): Use x2nrealloc rather than xrealloc.
5778         * src/expand.c: Likewise.
5779
5780         * tests/misc/expand: New file.
5781         * tests/misc/Makefile.am (TESTS): Add expand.
5782
5783         * src/sort.c (add_temp_dir): Use x2nrealloc rather than xrealloc.
5784         (fillbuf): Use x2nrealloc rather than xrealloc.
5785         (sort): Use xnmalloc rather than xmalloc.
5786         (main): Likewise.
5787
5788 2003-12-27  Jim Meyering  <jim@meyering.net>
5789
5790         * src/tee.c (tee): Use xnmalloc rather than xmalloc.
5791
5792 2003-12-29  Paul Eggert  <eggert@twinsun.com>
5793
5794         * NEWS: Remove support for join -j1 FIELD, -j2 FIELD, and -o LIST1
5795         LIST2 in POSIX 1003.1-2001 hosts, as required by POSIX.
5796
5797         * doc/coreutils.texi (join invocation): Remove documentation
5798         accordingly.  Document that -t makes all separators significant.
5799
5800         * src/join.c: Include posixver.h.
5801         (obsolete_usage): New var.
5802         (longopts): Put obsolete options first.
5803         (OBSOLETE_LONG_OPTIONS): New constant.
5804         (get_option, add_file_name): New functions.
5805         (main): Use them to support new behavior.
5806         (usage): Remove documentation for -j1 FIELD and -j2 FIELD.
5807         Do not mark -j FIELD as obsolescent; it is longstanding
5808         UNIX tradition and is a valid extension to POSIX.
5809
5810         * tests/join/Test.pm (tv): Avoid obsolete -o usage.
5811
5812 2003-12-28  Paul Eggert  <eggert@twinsun.com>
5813
5814         * src/join.c (add_field_list): Don't use alloca with unbounded
5815         size; just modify the argument, which is no longer const *.
5816
5817         Various other minor cleanups, mostly to avoid the need for casts.
5818
5819         (extract_field): Renamed from ADD_FIELD, as it's now a function.
5820
5821         (struct field.beg): Now char *, not unsigned char const *.  All
5822         uses changed.  It shouldn't be const since xmemcoll writes on its
5823         arguments.
5824         (extract_field): Likewise, for 2nd arg.
5825         (keycmp): Remove now-unnecessary cast of xmemcoll args.
5826
5827         (is_blank): New function, to avoid need to cast arg to unsigned char.
5828         (extract_field): Use it.
5829
5830         (xfields): Rewrite pretty much from scratch.
5831
5832         (hard_LC_COLLATE): Now bool, not int.
5833         (get_line, getseq, add_field_list): Now returns bool, not int.
5834         (decode_field_spec, add_field_list): Return true on success (not
5835         false), for consistency with the rest of the code.  All uses changed.
5836
5837         (tab): Now char, not unsigned char.  This wasn't 100% necessary
5838         but is slightly cleaner.
5839         (prjoin): Hoist (tab ? tab : ' ') expression, to help the compiler.
5840
5841         (empty_filler): Now const *.
5842
5843         (make_blank): Remove; wasn't needed.  Remove all calls.
5844         (main): Don't set uni_blank.nfields; zero is fine.
5845
5846 2003-12-27  Jim Meyering  <jim@meyering.net>
5847
5848         * src/join.c: Include "quote.h".
5849         (min, max): Remove definitions.
5850         Make a few function parameters and corresponding
5851         locals `const'.  Use bool for boolean variables.
5852         Use size_t (not int) for all counters and related index variables.
5853         (prjoin): Remove now-useless assertion.
5854         (string_to_join_field): New function.
5855         (main): Accept join fields as large as SIZE_MAX.
5856         (keycmp): Rename `min' to MIN and max to MAX.
5857
5858 2003-12-26  Jim Meyering  <jim@meyering.net>
5859
5860         fold -s didn't work on e.g., alpha-based systems.
5861         * src/fold.c (fold_file): Adjust types (int->size_t) so that using
5862         x2nrealloc works properly on systems with differing sizes for int
5863         and size_t.  Reported by Nelson Beebe.
5864
5865         * src/fold.c: Use `bool' (not int) as the type for a few
5866         global variables.
5867
5868 2003-12-23  Paul Eggert  <eggert@twinsun.com>
5869
5870         * src/ls.c (length_of_file_names_and_frills):
5871         Remove forward decl; not needed.
5872         (print_file_name_and_frills, length_of_file_name_and_frills):
5873         With -m, don't output spaces before inum or size.
5874         (print_with_commas): Don't output space just before newline.
5875
5876 2003-12-24  Jim Meyering  <jim@meyering.net>
5877
5878         * tests/ls/Makefile.am (TESTS): Add m-option.
5879         * tests/ls/m-option: New file.  Test for above fixes.
5880
5881 2003-12-20  Jim Meyering  <jim@meyering.net>
5882
5883         * Version 5.1.0.
5884
5885         * src/pr.c: Change type of global, buff_allocated, to size_t.
5886
5887         * src/join.c [struct seq]: Change types of members count and alloc
5888         from `int' to `size_t'.
5889
5890         * tests/Makefile.am (root-hint): Tweak wording.
5891
5892         * src/du.c: Accept new option (-0, --null) that makes it so each
5893         output line is NUL-terminated rather than newline-terminated.
5894
5895         * src/dd.c (apply_translations): Don't prohibit conv=unblock,sync.
5896         Reported by Volker Paul.
5897         * tests/dd/Makefile.am (TESTS): Add unblock-sync.
5898         * tests/dd/unblock-sync: New test for the above.
5899
5900 2003-12-19  Jim Meyering  <jim@meyering.net>
5901
5902         * tests/misc/nohup: Double quote back-ticked expression,
5903         in case it ends up having an unexpected value.
5904
5905         * tests/ls/no-arg: Use ls's -1 option in both runs.
5906
5907         * src/du.c (fts_debug): New global.
5908         (FTS_CROSS_CHECK, DEBUG_OPT): Define.
5909         (main): Make fts use FTS_TIGHT_CYCLE_CHECK.
5910         (main) [DU_DEBUG]: Accept -d option.
5911
5912 2003-12-18  Jim Meyering  <jim@meyering.net>
5913
5914         * src/ls.c (format_user): Increment dired_pos via two statements,
5915         `dired_pos += width; dired_pos++;' rather than one,
5916         `dired_pos += width + 1;' since the latter could conceivably overflow.
5917         (format_group): Likewise.
5918         From Paul Eggert.
5919
5920         * configure.ac: Require automake-1.8.
5921
5922 2003-12-12  Jim Meyering  <jim@meyering.net>
5923
5924         * Use automake-1.8.  Regenerate dependent files.
5925
5926 2003-12-08  Jim Meyering  <jim@meyering.net>
5927
5928         * Makefile.maint (news-date-check): New rule.
5929         (alpha beta major): Depend on it.
5930
5931 2003-12-03  Paul Eggert  <eggert@twinsun.com>
5932
5933         * NEWS: ls -l (and similar options) now adjust all columns to
5934         fit the data.  Generalized from a suggestion by Leah Q for file sizes.
5935         * src/ls.c (INODE_DIGITS, LOGIN_NAME_MAX, ID_LENGTH_MAX): Remove.
5936         (format_user_width, format_group_width, unsigned_file_size,
5937         format_group): New functions.
5938         (block_size_width): Renamed from block_size_size.
5939         (inode_number_width, nlink_width, owner_width, group_width,
5940         author_width, major_device_number_width, minor_device_number_width,
5941         file_size_width): New vars.
5942         (clear_files): Initialize them.
5943         (gobble_file): Set them.  Don't ceiling block_size_width to 7.
5944         (print_long_file): Use them.
5945         (gobble_file): Use a new local variable 'f' to make the code
5946         smaller and more consistent with other functions.
5947         (format_user): Output to stdout, not to a buffer, so that we
5948         don't have to worry about buffer overrun.  Update dired_pos.
5949         (print_long_file): Don't put owner, group, author into buffer;
5950         just print them directly.  Don't assume link counts and
5951         major and minor numbers fit into unsigned long int.
5952         * tests/cp/same-file, tests/mv/part-symlink: Don't assume that
5953         'ls' output is fixed-width.
5954
5955 2003-12-02  Jim Meyering  <jim@meyering.net>
5956
5957         * src/md5sum.c: Include sha1.h (reflect renaming: sha.h -> sha1.h.
5958
5959 2003-11-27  Jim Meyering  <jim@meyering.net>
5960
5961         * Use automake-1.7f.  Regenerate dependent files.
5962
5963 2003-11-24  Paul Eggert  <eggert@twinsun.com>
5964
5965         Parse floating-point operands and options in the C locale.
5966         POSIX requires this for printf, and we might as well be
5967         consistent elsewhere (tail, sleep, seq).
5968
5969         * src/printf.c: Remove decls of strtod, strtol, strtoul; no longer
5970         needed now that we assume C89.  Include "c-strtod.h".
5971         (xstrtod): Call c_strtod, not strtod.
5972         * src/sleep.c: Include "c-strtod.h".
5973         (main): Update xstrtod call to include new argument, c_strtod.
5974         * src/seq.c (scan_double_arg): Likewise.
5975         * src/tail.c (parse_options): Likewise.
5976
5977 2003-11-24  Jim Meyering  <jim@meyering.net>
5978
5979         * tests/rm/fail-2eperm: Handle another errno variant (HPUX, EPERM).
5980         Reported by Mark Conty.
5981
5982 2003-11-22  Jim Meyering  <jim@meyering.net>
5983
5984         * Makefile.maint (sc_xalloc_h_in_src): Remove rule.  Subsumed by...
5985         (sc_system_h_headers): Do this test only if sys2.h exists.
5986
5987 2003-11-20  Jim Meyering  <jim@meyering.net>
5988
5989         * tests/help-version: Ensure that the bug-reporting address is
5990         included in the --help output for every program.
5991         * tests/Makefile.am (TESTS_ENVIRONMENT): Add $PACKAGE_BUGREPORT.
5992
5993         * src/ptx.c (usage): Output bug-reporting address.
5994         Reported by Dan Jacobson.
5995
5996 2003-11-19  Jim Meyering  <jim@meyering.net>
5997
5998         * src/join.c (usage): Mention that FILE1 and FILE2 must be sorted
5999         on the join fields.  Suggestion from Bruce Robertson.
6000
6001 2003-11-18  Jim Meyering  <jim@meyering.net>
6002
6003         `od -c -w9999999' could segfault
6004         * src/od.c (dump): Use xnmalloc/free, not alloca.
6005
6006 2003-11-16  Jim Meyering  <jim@meyering.net>
6007
6008         * Use autoconf-2.59.  Regenerate dependent files.
6009
6010         * tests/du/hard-link: Minor tweak: use mkdir -p.
6011
6012         Fix read-from-free'd-buffer error detected by valgrind.
6013         * src/csplit.c (remove_line): Don't return a pointer to data in
6014         a freed buffer.  Instead, arrange to free the buffer on the
6015         subsequent call.
6016
6017         * tests/misc/csplit: New test for above fix.
6018
6019 2003-11-11  Jim Meyering  <jim@meyering.net>
6020
6021         * src/ls.c (extract_dirs_from_files): Avoid useless copy operations.
6022         This avoids a warning from valgrind about memcpy with overlapping
6023         source and destination.
6024
6025         * configure.ac: Require automake-1.7.8.
6026
6027 2003-11-09  Jim Meyering  <jim@meyering.net>
6028
6029         * Use automake-1.7.9.  Regenerate dependent files.
6030
6031         * src/rm.c: Support new options: --preserve-root and --no-preserve-root.
6032         * src/chown.c: Likewise.
6033
6034         * src/chown-core.c: Include "root-dev-ino.h".
6035         (chopt_init): Initialize new member.
6036         (change_file_owner): Support rm's new --preserve-root option.
6037
6038         * src/remove.c: Include "root-dev-ino.h".
6039         (remove_cwd_entries): Remove now-obsolete FIXME comment.
6040         (remove_dir): Support rm's new --preserve-root option.
6041
6042         * src/chown.c: Include "root-dev-ino.h".
6043         Add new options: --preserve-root and --no-preserve-root.
6044
6045         * src/chmod.c: Include "root-dev-ino.h".
6046         (process_file): Use newly-factored-out ROOT_DEV_INO_CHECK and
6047         ROOT_DEV_INO_WARN macros.
6048         (get_root_dev_ino): Remove function definition, now that it's
6049         been moved to a separate file.
6050         (usage): Describe new options.
6051
6052         * src/mv.c (rm_option_init): Initialized new member.
6053
6054         * src/remove.h: Include "dev-ino.h".
6055         (struct rm_options): Add new member: root_dev_ino.
6056         * src/chown-core.h: Include "dev-ino.h".
6057         (struct Chown_option): Add new member: root_dev_ino.
6058
6059 2003-11-06  Jim Meyering  <jim@meyering.net>
6060
6061         * src/paste.c (paste_parallel): Use `sizeof *var' rather than
6062         hard-coding `sizeof FILE*'.
6063
6064 2003-11-05  Dennis Smit  <ds@nerds-incorporated.org>
6065
6066         * src/wc.c (main): Free `fstatus' so there is no confusion about
6067         whether it's leaked or not.
6068         * src/who.c (who): Likewise for `utmp_buf'.
6069
6070 2003-11-05  Paul Eggert  <eggert@twinsun.com>
6071
6072         Fix 'cut' problems with size_t overflow and unsigned int.
6073         More generally, resize integer variables to fit use more precisely.
6074         * src/cut.c (ADD_RANGE_PAIR): Remove unnecessary parens.
6075         (struct range_pair): Make members to be of type size_t, not unsigned.
6076         (max_range_endpoint, eol_range_start): Now size_t, not unsigned.
6077         (suppress_non_delimited, output_delimiter_specified,
6078         have_read_stdin, print_kth, set_fields): Now bool, nt int.
6079         (delim): Now unsigned char, not int.
6080         (mark_printable_field, is_printable_field, is_range_start_index,
6081         set_fields, set_fields, cut_bytes, cut_fields):
6082         Use size_t, not unsigned, for field and byte counts.
6083         (hash_int): Use uintptr_t, not unsigned, for pointers converted
6084         to integers.  This squeezes more info out of them.
6085         (set_fields, cut_bytes, cut_fields, main):
6086         Use bool, not int, for booleans.
6087         (set_fields): Allocate zeroed byte array with xzalloc, not xcalloc.
6088
6089 2003-11-05  Paul Eggert  <eggert@twinsun.com>
6090
6091         * man/Makefile.am (check-programs-vs-x):
6092         Work even if $(programs) contains '$'.
6093         Work even if 'missing=1' in environment.
6094         Don't report an error simply because $(programs) outputs nothing.
6095
6096 2003-11-05  Jim Meyering  <jim@meyering.net>
6097
6098         * Use autoconf-2.58.  Regenerate dependent files.
6099
6100         * src/tr.c (spec_init): Fix typo in last change.
6101
6102         * src/sys2.h (case_GETOPT_VERSION_CHAR): Cast NULL to `(char *)' in
6103         call to variadic version_etc function, so that it works even on systems
6104         for which sizeof char* != sizeof int.
6105         * src/true.c (main): Likewise.
6106         * basename.c, chroot.c, cksum.c, dd.c, dirname.c, echo.c, expr.c:
6107         * factor.c, hostid.c, hostname.c, link.c, logname.c, nice.c, nohup.c:
6108         * pathchk.c, printenv.c, printf.c, pwd.c, setuidgid.c, sleep.c, stty.c:
6109         * sync.c, test.c, tsort.c, unlink.c, uptime.c, users.c, whoami.c, yes.c:
6110         Similarly, cast NULL to `(char *)' in call to variadic function,
6111         parse_long_options, so that it works even on systems for which
6112         sizeof char* != sizeof int.
6113         A similar problem was reported by Harti Brandt in
6114         http://mail.gnu.org/archive/html/bug-gnu-utils/2003-10/msg00320.html.
6115
6116         * src/users.c (users): Free `utmp_buf' explicitly so that people
6117         don't mistake this for a real leak.
6118         Patch by Dennis Smit <ds@nerds-incorporated.org.
6119
6120 2003-11-04  Paul Eggert  <eggert@twinsun.com>
6121
6122         * README: Document _POSIX2_VERSION.
6123
6124 2003-11-04  Jim Meyering  <jim@meyering.net>
6125
6126         * src/tac.c (memrchr): Remove #if-0'd function.
6127         (tac_stdin_to_mem): Clean up #if-0'd code.
6128
6129         * src/od.c (decode_format_string): Remove unnecessary casts.
6130         Use more maintainable `sizeof *var'.
6131         (main): Call decode_format_string rather than decode_one_format,
6132         now that `spec' may be NULL.
6133
6134         * src/chmod.c (AUTHORS): Add my name.
6135
6136         * src/split.c (next_file_name): Use `sizeof *var' rather than
6137         hard-coding `sizeof size_t'.
6138
6139         * src/sort.c (new_key): Use xzalloc, not xcalloc (1, ...).
6140
6141         * src/cut.c (ADD_RANGE_PAIR): Use x2nrealloc rather than xrealloc,
6142         to avoid potential overflow in pointer arithmetic.
6143         (set_fields): Use not `1', but rather `sizeof *printable_field' as
6144         second argument to xcalloc.
6145         * src/od.c (decode_format_string, dump_strings): Use x2nrealloc
6146         rather than xrealloc.
6147         * src/date.c (show_date): Likewise.
6148         * src/join.c (ADD_FIELD, initseq, getseq): Likewise.
6149         * src/pr.c (store_char): Likewise.
6150         * src/fold.c (fold_file): Likewise.
6151
6152         * src/copy.c (triple_hash, triple_hash_no_name): Adjust to reflect
6153         type changes (unsigned int -> size_t) in hash.c.
6154         * src/cp-hash.c (src_to_dest_hash): Likewise.
6155         * src/du.c (entry_hash): Likewise.
6156         * src/ls.c (dev_ino_hash): Likewise.
6157         * src/cut.c (hash_int): Likewise.  Declare function as static.
6158
6159 2003-11-03  Jim Meyering  <jim@meyering.net>
6160
6161         * tests/misc/Makefile.am (TESTS_ENVIRONMENT): Define PACKAGE_VERSION.
6162         * tests/misc/fold: Fail the test immediately if we're not running
6163         the expected version of fold.
6164
6165 2003-11-02  Jim Meyering  <jim@meyering.net>
6166
6167         * src/tr.c (append_normal_char, append_range, append_char_class)
6168         (append_repeated_char, append_equiv_class, spec_init): Use `sizeof *var'
6169         rather than `sizeof EXPLICIT_TYPE'.  The former is more maintainable
6170         and usually shorter.
6171         * src/copy.c (copy_internal): Likewise.
6172         * src/join.c (initseq, add_field, make_blank): Likewise.
6173         * src/od.c (main): Likewise.
6174         * src/cp.c (make_path_private): Likewise.
6175         * src/tsort.c (new_item, record_relation): Likewise.
6176
6177         * src/df.c (add_fs_type, add_excluded_fs_type, main): Likewise.
6178         (main): Also remove anachronistic cast of xmalloc return value.
6179         * src/ptx.c (alloc_and_compile_regex, main): Likewise.
6180         (main): Also remove anachronistic cast of xmalloc return value.
6181         * src/sort.c (inittables): Likewise.
6182         (sort): Also Split a long line.
6183
6184 2003-10-25  Jim Meyering  <jim@meyering.net>
6185
6186         * src/copy.c (triple_hash, triple_hash_no_name): Adjust to reflect
6187         type changes (unsigned int -> size_t) in hash.c.
6188         * src/cp-hash.c (src_to_dest_hash): Likewise.
6189         * src/du.c (entry_hash): Likewise.
6190         * src/ls.c (dev_ino_hash): Likewise.
6191         * src/cut.c (hash_int): Likewise.  Declare function as static.
6192
6193 2003-10-21  Jim Meyering  <jim@meyering.net>
6194
6195         Don't fail when run with VERBOSE=yes.
6196         * tests/chgrp/basic: Do `set +x' before starting the subshell
6197         from which we invoke chgrp.  Otherwise, the output from the
6198         VERBOSE=yes-induced `set -x' would result in spurious differences.
6199         Reported by Russel Coker via Michael Stone.
6200
6201 2003-10-19  Jim Meyering  <jim@meyering.net>
6202
6203         chmod now uses fts to perform a directory traversal when -R is
6204         specified.  Before, it operated on full path names, and as such
6205         would encounter the PATH_MAX (often 4096) limit.
6206
6207         * src/chmod.c: Include "xfts.h".
6208         (process_file): Rename from change_file_mode.
6209         Adapt to be used with fts.
6210         (process_files): New function.
6211
6212 2003-10-18  Jim Meyering  <jim@meyering.net>
6213
6214         * tests/du/deref-args: Ensure that du -D now dereferences all
6215         symlinks specified on the command line, not just those that
6216         reference directories.
6217
6218         * basename.c, cat.c, chroot.c, cksum.c, comm.c, cp.c, csplit.c, cut.c:
6219         * dd.c, df.c, dirname.c, du.c, echo.c, env.c, expr.c, factor.c, head.c:
6220         * hostid.c, hostname.c, id.c, link.c, ln.c, logname.c, ls.c, md5sum.c:
6221         * mv.c, nice.c, nl.c, nohup.c, paste.c, pathchk.c, pinky.c, pr.c:
6222         * printenv.c, printf.c, pwd.c, rm.c, setuidgid.c, sleep.c, sort.c:
6223         * split.c, stty.c, sum.c, sync.c, tac.c, tail.c, tee.c, test.c:
6224         * touch.c, tsort.c, uniq.c, unlink.c, uptime.c, users.c, wc.c:
6225         * who.c, whoami.c, yes.c (AUTHORS): Revert the WRITTEN_BY/AUTHORS change
6226         of 2003-09-19.  Now, AUTHORS is a comma-separated list of strings.
6227         Update the call to parse_long_options so that `AUTHORS, NULL' are the
6228         last parameters.
6229         * src/true.c (main): Append NULL to version_etc argument list.
6230         * src/sys2.h (case_GETOPT_VERSION_CHAR): Likewise.
6231
6232 2003-10-17  Andreas Schwab  <schwab@suse.de>
6233
6234         * tests/mk-script: Get $srcdir from first parameter instead of
6235         hardcoding it.
6236         (main): Update usage.
6237
6238         * tests/Makefile.am.in ($(srcdir)/$x-tests): Pass $(srcdir) as
6239         first argument of mk-script.
6240         ($(srcdir)/Makefile.am): Likewise.  Prepend $(srcdir) to target.
6241
6242 2003-10-17  Jim Meyering  <jim@meyering.net>
6243
6244         * src/mv.c (usage): Tweak descriptions of -i and -f so that the
6245         generated `man' page is more readable.  Suggestion from Dan Jacobson.
6246
6247         * src/chown-core.c (change_file_owner): Handle the cases in
6248         which fts_info indicates an error with the given entry.
6249
6250         * src/du.c (main): Simply assign to bit_flags.
6251         Don't bother with bit arithmetic.
6252
6253         * tests/chmod/no-x: New file.
6254         * tests/chgrp/no-x: New file.
6255         * tests/chmod/Makefile.am (TESTS): Add no-x.
6256         * tests/chgrp/Makefile.am (TESTS): Likewise.
6257
6258         * src/du.c: Include "xfts.h".
6259         (du_files): Use xfts_open, rather than fts_open.
6260         * src/chown-core.c (chown_files): Likewise.
6261
6262 2003-10-16  Jim Meyering  <jim@meyering.net>
6263
6264         * src/chgrp.c (main): Simply assign to bit_flags.
6265         Don't bother with bit arithmetic.
6266         * src/chown.c (main): Likewise.
6267         Rename a couple of local variables.
6268         Remove unnecessary casts.
6269
6270         * src/tail.c (start_bytes): Rename local, remainder, to avoid
6271         gcc's warning about shadowing a global.
6272
6273 2003-10-15  Jim Meyering  <jim@meyering.net>
6274
6275         chown and chgrp now accept POSIX-mandated -H, -L, -P options and
6276         use fts to perform a directory traversal when -R is specified.
6277         Before, they operated on full path names, and as such would
6278         encounter the PATH_MAX (often 4096) limit.
6279         They are more efficient.  For example, before, chgrp -R would
6280         take almost 5 seconds to change about 2000 directories and fail
6281         (with `File name too long'), while now it succeeds on a hierarchy
6282         of depth 20,000 in 1/10 the time.
6283
6284         * src/chown.c: Include "userspec.h" and "fts_.h".
6285         (WRITTEN_BY): Add my name.
6286         (getpwnam, getgrnam, getgrgid): Remove declarations.
6287         (endpwent): Remove definition.
6288         (usage): Update.
6289         (main): Handle new options.
6290         Call new function, chown_files rather than change_file_owner.
6291
6292         * src/chgrp.c: Include "fts_.h".
6293         (WRITTEN_BY): Add my name.
6294         (MAXUID, MAXGID): Remove definitions.  Use GID_T_MAX instead of
6295         the latter.
6296         (usage): Update.
6297         (main): Handle new options.
6298         Call new function, chown_files rather than change_file_owner.
6299
6300         Rewrite to iterate through hierarchies using fts rather than
6301         via explicit recursion.
6302         * src/chown-core.c: Include "fts_.h"
6303         (change_file_owner): Rewrite to use FTS* and FTSENT* and to operate
6304         on a single file at a time.
6305         (chown_files): New function.
6306         * src/chown-core.h [enum Dereference_symlink]: Remove declaration.
6307         [struct Chown_option] (recurse, force_silent): Change type to `bool'.
6308         [struct Chown_option] (dereference): Remove member with ambiguous name.
6309         [struct Chown_option] (affect_symlink_referent): New member.
6310         (chown_files): New prototype.
6311
6312         * tests/chgrp/recurse: Update tests accordingly.
6313         * tests/chgrp/posix-H: New tests for the above.
6314         * tests/chgrp/Makefile.am (TESTS): Add posix-H.
6315
6316         * src/ln.c (usage): Clarify that --directory, -d, -F probably won't
6317         work even for superuser.  Suggestion from Dan Jacobson.
6318
6319 2003-10-14  Paul Eggert  <eggert@twinsun.com>
6320
6321         Fix some number-parsing bugs, e.g., "head -n 100k@" wasn't
6322         properly diagnosed.
6323         * lib/human.c, lib/xstrtoimax.c, lib/xstrtol.c, lib/xstrtol.h,
6324         lib/xstrtoul.c, lib/xstrtoumax.c: Sync with gnulib.
6325         * src/sort.c (parse_field_count): Handle the case where overflow
6326         and invalid suffix char are both reported.
6327
6328 2003-10-14  Jim Meyering  <jim@meyering.net>
6329
6330         * src/ls.c (decode_switches) [TIOCGWINSZ]: Comment out the
6331         warning-inducing test, ws.ws_col <= SIZE_MAX, since it was always
6332         true on Linux.
6333
6334 2003-10-13  Paul Eggert  <eggert@twinsun.com>
6335
6336         Fix to avoid a denial-of-service attack if the display width is
6337         enormous.  Also, clean up the code a bit by removing duplicate code.
6338
6339         * src/ls.c (init_column_info): Remove forward decl; no longer needed.
6340         (calculate_columns): New function, that contains code that used
6341         to be common to print_many_per_line and print_horizontal.
6342         (print_many_per_line, print_horizontal): Use it.
6343         (decode_switches): Set max_idx here, not in calculate_columns.
6344         (print_current_files): Don't call init_column_info; calculate_columns
6345         now does that.
6346         (init_column_info): Don't allocate a lot more space than is needed
6347         to represent the current set of files.  Allocate all the new
6348         size_t cells in one call to xnmalloc, rather than a row at a time.
6349
6350 2003-10-13  Jim Meyering  <jim@meyering.net>
6351
6352         * src/ls.c (init_column_info): Add another FIXME comment.
6353
6354 2003-10-13  Paul Eggert  <eggert@twinsun.com>
6355
6356         Fix address-arithmetic bug in 'ls', reported by Georgi Guninski.
6357         Remove several arbitrary limits on hosts where int cannot represent
6358         all size_t values.
6359
6360         * src/ls.c (struct bin_str.len, length_of_file_name_and_frills, indent,
6361         nfiles, files_index, tabsize, line_length, struct column_info.line_len,
6362         struct column_info.col_arr[0], max_idx):
6363         Now size_t, not int.
6364         (get_funky_string): Return bool indicating success, instead of
6365         a negative count to indicate failure.  Store number of columns
6366         through new parameter OUTPUT_COUNT; that way, they can never
6367         go negative.  Change equals_end from int to bool.  All uses
6368         changed.
6369         (struct column_info.valid_len): Now bool, not int.  All uses changed.
6370         (dired_dump_obstack, get_funky_string, clear_files,
6371         extract_dirs_from_files, print_current_files,
6372         print_many_per_line, print_horizontal, init_column_info,
6373         put_indicator, length_of_file_name_and_frills,
6374         print_with_commas): Use size_t, not int, for local variables
6375         that count sizes.
6376         (decode_switches): Decode sizes using xstrtoul, not xstrtol.
6377         Check for TIOCGWINSZ returing negative values (or values greater
6378         than SIZE_MAX!).
6379         (visit_dir, main, parse_ls_color, queue_directory, add_ignore_pattern,
6380         init_column_info):
6381         Use xmalloc and xnmalloc, not XMALLOC.
6382         (gobble_file): Use xnrealloc, not XREALLOC.
6383         (print_color_indicator): Remove now-unnecessary cast to size_t.
6384
6385 2003-10-12  Paul Eggert  <eggert@twinsun.com>
6386
6387         * tests/du/no-x: Change wording of diagnostic to match latest du.c.
6388         * tests/sort/sort-tests: Remove from CVS; assume that people
6389         brave enough to check coreutils out from CVS can rebuild it.
6390
6391 2003-10-12  Jim Meyering  <jim@meyering.net>
6392
6393         New options: --preserve-root and --no-preserve-root.
6394         * src/chmod.c (change_file_mode): Honor new option.
6395         (change_file_mode): Strip trailing slashes on directory
6396         argument passed to change_dir_mode.
6397         (get_root_dev_ino): New function.
6398         (main): Initialize global, root_dev_ino.
6399
6400         * src/copy.c (copy_internal): Don't #ifdef-out simple uses of
6401         S_ISLNK or S_ISSOCK.  The S_IS* macros are guaranteed to be defined
6402         via system.h.
6403         * src/chmod.c (change_file_mode): Likewise.
6404
6405 2003-10-08  Jim Meyering  <jim@meyering.net>
6406
6407         * src/csplit.c (main): Remove obsolete FIXME.
6408
6409 2003-10-07  Jim Meyering  <jim@meyering.net>
6410
6411         * Use automake-1.7.8.  Regenerate dependent files.
6412
6413 2003-09-29  Paul Eggert  <eggert@twinsun.com>
6414
6415         csplit cleanup.
6416
6417         * doc/coreutils.texi (csplit invocation):
6418         The regexp offset need not have a sign; POSIX requires support
6419         for signless offets.
6420
6421         Be more careful about int widths.  For example, remove some
6422         arbitrary limits by replacing 'unsigned' with 'size_t',
6423         'uintmax_t', etc.  Use standard bool rather than a homegrown type.
6424         * lib/Makefile.am (libfetish_a_SOURCES): Add xstrtoimax.c.
6425         * src/csplit.c (FALSE, TRUE, boolean): Remove.  All uses changed
6426         to <stdbool.h> usage.
6427         (struct control): offset is now intmax_t, not int.
6428         repeat_forever is now bool, not int.
6429         (struct cstring): len is now size_t, not unsigned int.
6430         (struct buffer_record): bytes_alloc, bytes_used, num_lines are now
6431         size_t, not unsigned.  start_line, first_available are now
6432         uintmax_t, not unsigned.
6433         (hold_count, control_used): Now size_t, not unsigned.
6434         (last_line_number, current_line, bytes_written):
6435         Now uintmax_t, not unsigned.
6436         (save_to_hold_area, red_input, keep_new_line, record_line_starts,
6437         create_new_buffer, get_new_buffer, load_buffer, find_line,
6438         process_regexp, split_file, new_control_record, extract_regexp,
6439         get_format_width, get_format_prec, max_out):
6440         size args, locals, and returned values are now size_t, not unsigned
6441         or int.
6442         (get_first_line_in_buffer, find_line, write_to_file,
6443         handle_line_error, process_line_count, regexp_error, process_regexp,
6444         split_file):
6445         File line, byte, and repetition counts are now uintmax_t, not unsigned.
6446         (check_for_offset): Don't require a sign before the offset.
6447         Use xstrtoimax to do the real work.
6448         (extract_regexp): Remove harmful cast of size to unsigned.
6449         256 -> 1<<CHAR_BIT, for clarity.
6450         (get_format_flags): Return at most 3, to avoid worries about overflow.
6451
6452         (bytes_to_octal_digits): Remove.
6453
6454         (cleanup): Don't check whether output_stream is NULL, since
6455         close_output_file does that for us.
6456
6457         (new_line_control, create_new_buffer): Use "foo *p = xmalloc
6458         (sizeof *p);" instead of the more long-winded alternatives.
6459
6460         (get_new_buffer): Use O(1) algorithm for resizing a buffer
6461         to a much larger size, instead of an O(N) algorithm.
6462
6463         (process_regexp): Use plain NULL rather than casted 0.
6464
6465         (make_filename): Use %u, not %d, to format unsigned file number.
6466
6467         (new_control_record): Use xrealloc exclusively, since it handles
6468         NULL reliably.
6469
6470         (extract_regexp): Change misspelled word in diagnostic.
6471
6472         (get_format_width): Even if a minimum field width is specified,
6473         allow room for enough octal digits to represent the value of
6474         the maximum representible integer.  This fixes a potential
6475         buffer overrun.  Calculate this room at compile-time, not
6476         at run-time; this removes the need for bytes_to_octal_digits.
6477         Check for overflow; this removes a FIXME.
6478
6479         (get_format_prec): Don't allow precision to be signed; it's
6480         not ANSI.  Check for overflow.  Remove hardcoded "11" as
6481         default precision; this fixes a potential buffer overrun
6482         on hosts with wider size_t.
6483
6484         (get_format_conv_type): Change local variable to be of type
6485         unsigned char, not int; this removes a potential subscript
6486         violation on hosts where char is signed.
6487
6488         (max_out): Replace "for (;*p;)" with more-standard "while (*p)".
6489         Allow "%%" in format.  Don't overflow when
6490         counting lots of percents.
6491
6492         (usage): Default sprintf format is %02u, not %d.
6493
6494 2003-10-05  Jim Meyering  <jim@meyering.net>
6495
6496         * src/chown-core.c (change_file_owner): Remove set-but-not-used local.
6497
6498         * src/du.c (du_files): Mark diagnostic for translation.
6499
6500 2003-10-04  Jim Meyering  <jim@meyering.net>
6501
6502         * src/du.c (du_files): Ignore any failure of fts_close.
6503         Give better diagnostics for failed fts_open.
6504
6505         * src/du.c (MAX_N_DESCRIPTORS): Remove now-unused definition.
6506
6507         Deprecate existing use of -H (aka --si).
6508         * src/du.c (enum) [HUMAN_SI_OPTION]: New member.
6509         [long_options]: Use HUMAN_SI_OPTION, not 'H'.
6510         (main): Warn that the meaning of -H will soon change to be
6511         POSIX compliant.
6512
6513 2003-10-03  Jim Meyering  <jim@meyering.net>
6514
6515         * src/du.c: Accept --no-dereference (-P).
6516
6517 2003-10-02  Jim Meyering  <jim@meyering.net>
6518
6519         * tests/du/trailing-slash: Adjust for slightly different output.
6520
6521         Rewrite du.c to use fts.
6522         * src/du.c: Include "fts_.h", not ftw.h.
6523         (opt_dereference_arguments, arg_length, suffix_length): Remove globals.
6524         (IS_FTW_DIR_TYPE): Remove definition.
6525         (IS_DIR_TYPE): Define.
6526         (is_symlink_to_dir): Remove now-unnecessary function.
6527         (process_file, du_files): Rewrite to use fts.
6528
6529         * tests/du/inaccessible-cwd: Ensure that even when run from an
6530         inaccessible directory, du can still operate on accessible
6531         directories elsewhere.
6532         * tests/du/Makefile.am (TESTS): Add inaccessible-cwd.
6533
6534         * tests/rm/deep-1: Ensure that du can process a hierarchy
6535         of depth 400 while using no more than 50KB of stack space.
6536
6537 2003-10-01  Akim Demaille  <akim@epita.fr>
6538
6539         * announce-gen (print_news_deltas): New function, extracted from main.
6540         (main): Make `news_file' an array.
6541         Use '...=s' => \@var for --news and --url-directory specs.
6542         Before there were a couple of portability problems.
6543
6544 2003-09-28  Jim Meyering  <jim@meyering.net>
6545
6546         * Makefile.maint (sc_cast_of_alloca_return_value): New rule.
6547         (syntax-check-rules): Add it.
6548
6549         * src/copy.c: Remove unnecessary cast of alloca, since now it's
6550         guaranteed to be (void *).
6551         * src/cp.c: Likewise.
6552         * src/join.c: Likewise.
6553         * src/ln.c: Likewise.
6554         * src/ls.c: Likewise.
6555         * src/od.c: Likewise.
6556         * src/sys2.h (ASSIGN_STRDUPA): Likewise.
6557
6558 2003-09-27  Jim Meyering  <jim@meyering.net>
6559
6560         Don't exhaust virtual memory when processing large inputs.
6561         Fix this by removing csplit's internal free-list management;
6562         instead rely on malloc for that.
6563
6564         * src/csplit.c (free_list): Remove global.
6565         (clear_all_line_control): Remove function.
6566         (get_new_buffer): Always use create_new_buffer to obtain a
6567         new buffer, rather than searching free_list.
6568         (free_buffer): Just call free.
6569         Reported by Nikola Milutinovic.
6570
6571 2003-09-26  Jim Meyering  <jim@meyering.net>
6572
6573         * man/rm.x: Also list `chattr' in SEE ALSO section.
6574         Suggestion from Mark Hubbart.
6575
6576 2003-09-25  Jim Meyering  <jim@meyering.net>
6577
6578         * configure.ac: Don't invoke AC_AIX or AC_MINIX explicitly, now
6579         that we use gl_USE_SYSTEM_EXTENSIONS, since it AC_REQUIREs them.
6580
6581         * Use autoconf-2.57d.  Regenerate dependent files.
6582
6583 2003-09-24  Jim Meyering  <jim@meyering.net>
6584
6585         Minor efficiency tweak.
6586         * src/ln.c (PATH_BASENAME_CONCAT): Use memcpy rather than strcpy.
6587         (do_link): Likewise.
6588
6589 2003-09-23  Jim Meyering  <jim@meyering.net>
6590
6591         * src/paste.c (paste_serial): Save errno after input error,
6592         to report proper errno value.
6593         Based on a patch from Paul Eggert.
6594
6595         * src/tee.c (tee): Adjust fwrite arguments so that the return
6596         value is the number of bytes written.
6597
6598 2003-09-16  Paul Eggert  <eggert@twinsun.com>
6599
6600         Don't assume ferror sets errno.  Bug reported by Bruno Haible.
6601
6602         * src/comm.c (compare_files): Save errno after input error,
6603         to report proper errno value.
6604         * src/fold.c (fold_file): Likewise.
6605         * src/od.c (check_and_close, skip, read_char, read_block): Likewise.
6606         * src/unexpand.c (unexpand): Likewise.
6607
6608         * src/csplit.c (close_output_file): Don't report bogus errno value
6609         after ferror discovers an output error.  We don't know the proper
6610         errno value, since it might have been caused by any of a whole
6611         bunch of calls, and it might have been trashed in the meantime.
6612         Fixing this problem will require much more extensive changes;
6613         in the meantime just say "write error".
6614         * src/od.c (check_and_close, dump, dump_strings): Likewise.
6615         * src/uniq.c (check_file): Likewise.
6616
6617         * src/join.c (get_line): Report error right away if I/O fails,
6618         so that the proper errno value is used.
6619         * src/tac.c (tac_seekable, tac_file, save_stdin): Likewise.
6620         * src/tee.c (tee): Likewise.
6621         * src/uniq.c (check_file): Likewise.
6622
6623         * src/od.c (skip): If a read fails, don't retry it later, so
6624         that we report the proper errno.
6625
6626         * src/tac.c (tac_mem): Don't return a value; nobody uses it.
6627
6628         * src/tee.c (tee): Once a write failure has occurred, don't bother
6629         writing anything more to that stream.
6630
6631         * src/uniq.c (check_file): Check for ferror (stdout) even if
6632         ostream == stdout.
6633
6634         * src/yes.c (UNROLL): Remove.
6635         (main): Exit immediately when write failure is detected.
6636         Simplify code by assigning to argv when argc == 1.
6637
6638 2003-09-21  Paul Eggert  <eggert@twinsun.com>
6639
6640         * src/ptx.c: Switch encoding from Latin-1 to UTF-8.
6641         (WRITTEN_BY): Change "Franc,ois" (actually using
6642         c-with-cedilla in Latin-1) to "F.", so that it's ASCII, as
6643         xgettext requires.
6644
6645 2003-09-19  Jim Meyering  <jim@meyering.net>
6646
6647         `du -D symlink-to-dir' would mistakenly omit the slash in
6648         lines like this: 24     symlink-to-dir/subdir
6649         * src/du.c (process_file): Fix offset calculation.
6650         Reported by Jeff Sheinberg as Debian bug #211591;
6651         http://bugs.debian.org/205251
6652
6653         * tests/du/deref-args: New file/test for the above.
6654         * tests/du/Makefile.am (TESTS): Add deref-args.
6655
6656         * src/du.c (process_file): Remove useless disjunct.
6657
6658         * src/sys2.h (case_GETOPT_VERSION_CHAR): Rename parameter, Authors,
6659         to Written_by.
6660         * nearly all src/*.c files (WRITTEN_BY): Rename from AUTHORS.
6661         Begin each WRITTEN_BY string with `Written by ' and end it with `.'.
6662         Mark each WRITTEN_BY string as translatable.
6663
6664         * basename.c, cat.c, chroot.c, cksum.c, comm.c, cp.c, csplit.c, cut.c:
6665         * dd.c, df.c, dirname.c, du.c, echo.c, env.c, expr.c, factor.c, head.c:
6666         * hostid.c, hostname.c, id.c, link.c, ln.c, logname.c, ls.c, md5sum.c:
6667         * mv.c, nice.c, nl.c, nohup.c, paste.c, pathchk.c, pinky.c, pr.c:
6668         * printenv.c, printf.c, pwd.c, rm.c, setuidgid.c, sleep.c, sort.c:
6669         * split.c, stty.c, sum.c, sync.c, tac.c, tail.c, tee.c, test.c:
6670         * touch.c, tsort.c, uniq.c, unlink.c, uptime.c, users.c, wc.c:
6671         * who.c, whoami.c, yes.c: Revert yesterday's changes.
6672         Instead, a subsequent change will embed `Written by ' in
6673         each string along with the author names.
6674
6675         * src/true.c: Revert yesterday's changes.
6676         * src/sys2.h: Likewise.
6677
6678 2003-09-18  Jim Meyering  <jim@meyering.net>
6679
6680         * basename.c, cat.c, chroot.c, cksum.c, comm.c, cp.c, csplit.c, cut.c:
6681         * dd.c, df.c, dirname.c, du.c, echo.c, env.c, expr.c, factor.c, head.c:
6682         * hostid.c, hostname.c, id.c, link.c, ln.c, logname.c, ls.c, md5sum.c:
6683         * mv.c, nice.c, nl.c, nohup.c, paste.c, pathchk.c, pinky.c, pr.c:
6684         * printenv.c, printf.c, pwd.c, rm.c, setuidgid.c, sleep.c, sort.c:
6685         * split.c, stty.c, sum.c, sync.c, tac.c, tail.c, tee.c, test.c:
6686         * touch.c, tsort.c, uniq.c, unlink.c, uptime.c, users.c, wc.c:
6687         * who.c, whoami.c, yes.c: Update AUTHORS definition to be a
6688         comma-separated list of strings and/or update the call to
6689         parse_long_options so that `AUTHORS, NULL' are the last parameters.
6690         * src/true.c (main): Append NULL to version_etc argument list.
6691         * src/sys2.h (case_GETOPT_VERSION_CHAR): Likewise.
6692
6693         * src/sort.c (numcompare): Rename local, logb, to log_b to avoid
6694         shadowing the math function name.  Also rename loga to log_a.
6695
6696 2003-09-14  Jim Meyering  <jim@meyering.net>
6697
6698         * src/factor.c (print_factors): Give a separate diagnostic
6699         for numbers that are too large, but otherwise valid.
6700         Reported by Dániel Varga.
6701
6702 2003-09-10  Jim Meyering  <jim@meyering.net>
6703
6704         * Use automake-1.7.7.  Regenerate dependent files.
6705
6706         * tests/Makefile.am (all_programs): Use ../src/tr -s ' ' '\n' in place
6707         of `fmt -1'.  Using the just-built tr is a little cleaner.
6708         Christian Krackowizer reported that HPUX 10.20 doesn't have fmt.
6709         * man/Makefile.am (programs, check-x-vs-1): Likewise.
6710
6711 2003-09-09  Jim Meyering  <jim@meyering.net>
6712
6713         * src/copy.c: Alphabetize includes.
6714         Remove duplicate inclusion of "same.h".
6715
6716 2003-09-08  Jim Meyering  <jim@meyering.net>
6717
6718         * Makefile.maint (GZIP_ENV): Remove --rsyncable.
6719         Didn't give enough of a benefit, mainly because it's not yet
6720         in wide enough use.
6721
6722         * Version 5.0.91.
6723
6724         * man/Makefile.am (programs): Use ../src, not $(srcdir)/../src.
6725         (check-programs-vs-x): Fail if $(programs) is empty.
6726
6727         * src/remove.c: Add a comment.
6728
6729 2003-09-07  Jim Meyering  <jim@meyering.net>
6730
6731         * src/remove.c (D_INO, ENABLE_CYCLE_CHECK) [D_INO_IN_DIRENT]:
6732         Don't define.  These symbols are no longer used.
6733
6734         * tests/misc/tty-eof: Write ^D as \cD.
6735         Complete the change of 2003-08-02.
6736
6737         * Makefile.maint (po-check): Use cvsu, so that a temporary source
6738         file in lib/ or src/ doesn't induce an unwarranted failure.
6739         Add a kludge to filter out the sole generated source file that
6740         also has translatable messages: src/false.c.
6741
6742 2003-09-06  Jim Meyering  <jim@meyering.net>
6743
6744         * src/tail.c (enum): Add ALLOW_MISSING_OPTION.
6745         (parse_options): Give a diagnostic for (but still accept) the
6746         deprecated --allow-missing option.
6747
6748 2003-09-04  Paul Eggert  <eggert@twinsun.com>
6749
6750         Don't ignore -S if input is a pipe.  Bug report by Michael McFarland in
6751         <http://mail.gnu.org/archive/html/bug-coreutils/2003-09/msg00008.html>.
6752
6753         * src/sort.c (sort_buffer_size): Omit SIZE_BOUND arg.  Compute the
6754         size_bound ourselves. if an input file is a pipe and the user
6755         specified a size, use that size instead of trying to guess the
6756         pipe size.  This has the beneficial side effect of avoiding the
6757         overhead of default_sort_size in that case.  All callers changed.
6758         (sort): Remove static var size; now done by sort_buffer_size.
6759
6760 2003-09-05  Jim Meyering  <jim@meyering.net>
6761
6762         * Use automake-1.7.6b and autoconf-2.57b.  Regenerate dependent files.
6763
6764         * tests/tail-2/tail-n0f: Wait .5 seconds for backgrounded process
6765         to start, rather than just .1.  Upon failure, print unexpected state.
6766
6767 2003-09-04  Paul Eggert  <eggert@twinsun.com>
6768
6769         * src/head.c (elide_tail_lines_pipe): Don't assign 0 or
6770         SAFE_READ_ERROR to tmp->nbytes.
6771         * src/tail.c (pipe_lines, pipe_bytes): Likewise.
6772
6773         * src/head.c (struct linebuffer): Change nbytes and nlines
6774         from unsigned int to size_t.  unsigned int is safe (after the
6775         2003-09-03 patch) but size_t is cleaner.
6776         * src/tail.c (struct linebuffer, struct charbuffer): Likewise.
6777         (pipe_bytes): Likewise for local variable 'i', which was 'int'.
6778
6779         Standardize on BUFSIZ as opposed to other macro names and values.
6780         * src/head.c (BUFSIZE): Remove.  All uses changed to BUFSIZ.
6781         * src/tail.c (BUFSIZ) [!defined BUFSIZ]: Remove.
6782         stdio.h has always defined it,
6783         and other code already assumes it's defined.
6784         * src/tr.c (BUFSIZ) [!defined BUFSIZ]: Likewise.
6785         (IO_BUF_SIZE): Remove; replace all uses with sizeof io_buf.
6786         (io_buf): IO_BUF_SIZE -> BUFSIZ.
6787
6788 2003-09-04  Paul Eggert  <eggert@twinsun.com>
6789
6790         * src/seq.c (step): Default to 1.
6791         (print_numbers): Allow the output to be empty.
6792         (main): The default step is 1, even if LAST < FIRST;
6793         as per documentation.
6794         * tests/seq/basic (onearg-2): Output should be empty.
6795
6796 2003-09-05  Jim Meyering  <jim@meyering.net>
6797
6798         * Makefile.cfg (wget_files): Temporarily disable, until master
6799         versions are restored to ftp.gnu.org.
6800
6801         * configure.ac (AM_INIT_AUTOMAKE): Specify automake-1.7.6.
6802
6803         Make seq's --width (-w) option work properly even when the
6804         endpoint requiring the larger width is negative and smaller than
6805         the other endpoint.
6806         * src/seq.c (get_width_format): Include `-' in the set of bytes
6807         allowed in a `simple' number (no decimal point, no exponent).
6808         Reported by Patrick Mauritz.
6809
6810 2003-09-02  Paul Eggert  <eggert@twinsun.com>
6811
6812         * NEWS: sort -t '\0' now uses a NUL tab.
6813         sort option order no longer matters, unless POSIX requires it.
6814         * src/sort.c (usage): Say "blanks" instead of "whitespace",
6815         Similar fixes for many comments.
6816         (TAB_DEFAULT): New constant, so that we can support NUL as
6817         the field separator.
6818         (tab): Now int, not char.  Initialize to TAB_DEFAULT.
6819         (specify_sort_size): If multiple sizes are specified, use the largest.
6820         (begfield, limfield): Support NUL tab char.
6821         (set_ordering): Do not let -i override -d.
6822         (main): Report an error if incompatible -o or -t options are given.
6823         Report an error for "-t ''".  Allow "-t '\0'" to specify a NUL tab.
6824
6825 2003-09-05  Jim Meyering  <jim@meyering.net>
6826
6827         * tests/sort/Test.pm [o2, nul-tab]: New tests for the above.
6828
6829 2003-09-03  Andreas Schwab  <schwab@suse.de>
6830
6831         Bug report and patch here:
6832         <http://mail.gnu.org/archive/html/bug-coreutils/2003-09/msg00009.html>
6833         * src/tail.c (pipe_lines): Don't truncate return value from safe_read.
6834         * src/head.c (elide_tail_lines_pipe): Likewise.
6835
6836 2003-09-03  Jim Meyering  <jim@meyering.net>
6837
6838         * src/du.c (AUTHORS): Remove Larry McVoy's name, since the relatively
6839         small amount of code from him was first moved to lib/human.c, and was
6840         subsequently rewritten entirely.
6841         * src/df.c (AUTHORS): Likewise.
6842
6843 2003-08-22  Lawrence Teo  <lcteo@uncc.edu>
6844
6845         * src/md5sum.c (split_3): Accept the BSD format for generic
6846         message digest modes.  Currently works with BSD's MD5 and SHA1
6847         formats since these are the two algorithms presently used in
6848         coreutils.  Updated comments to reflect this change.
6849         (bsd_split_3): Updated comments.
6850
6851         * tests/md5sum/basic-1: New test to make sure that
6852         `md5sum --check' doesn't accept the BSD SHA1 format (adapted
6853         from `check-bsd' test in tests/sha1sum/basic-1).
6854
6855         * tests/sha1sum/basic-1 (check-bsd2, check-bsd3): New tests for
6856         --check exit status and BSD SHA1 format (adapted from tests
6857         in tests/md5sum/basic-1).
6858
6859 2003-08-30  Jim Meyering  <jim@meyering.net>
6860
6861         * src/ln.c (do_link): Use SAME_INODE rather than open-coding it.
6862
6863         When source and destination arguments refer to the same file, reside
6864         on a partition (e.g. VFAT) on which distinct names may refer to the
6865         same directory entry (often due to variations in case), and when the
6866         link count for the file is 1, mv no longer unlinks the file.  Instead,
6867         it gives the expected diagnostic that the source and destination are
6868         the same.  WARNING: this is an incomplete fix.  If the file happens
6869         to have a link count of 2 or greater, such an erroneous mv command
6870         will still unlink it.
6871         Although that is not possible on vfat or umsdos, it is possible on
6872         other file system types, e.g., ntfs, and hpfs.
6873         * src/copy.c (same_file_ok): Invoke same_name (which might still
6874         return false for names that refer to the same directory entry)
6875         only if the link count is 2 or more.
6876         * tests/mv/vfat: Show how to demonstrate the above problem.
6877         This test is not run.
6878         * tests/mv/Makefile.am (EXTRA_DIST): Add vfat.
6879
6880 2003-08-27  Jim Meyering  <jim@meyering.net>
6881
6882         * src/who.c: Change meaning of -l from --lookup to --login, per POSIX.
6883         who's -l option has been eliciting an unconditional warning about
6884         this impending change since sh-utils-2.0.12 (April 2002).
6885
6886         * src/paste.c (paste_parallel): Don't output `EOF' (aka -1) as a `char'.
6887         This would happen for nonempty files not ending with a newline.
6888         Reported by Dan Jacobson.
6889         * tests/misc/paste-no-nl: New file.  Test for above-fixed bug.
6890         * tests/misc/Makefile.am (TESTS): Add paste-no-nl.
6891
6892         * src/stat.c (print_it): Avoid buffer overrun that would
6893         occur when the user-specified format string ends with `%'.
6894         Patch by Tommi Kyntola.
6895         * tests/misc/stat-fmt: New file.  Test for above-fixed bug.
6896         * tests/misc/Makefile.am (TESTS): Add stat-fmt.
6897
6898 2003-08-26  Jim Meyering  <jim@meyering.net>
6899
6900         Apply changes from bison.
6901         * GNUmakefile (SHELL): Define to `sh', if necessary.
6902         Add copyright.
6903         * Makefile.maint (WGETFLAGS): Define to `-C off'.
6904         Update all uses of $(WGET).
6905
6906 2003-08-22  Akim Demaille  <akim@epita.fr>
6907
6908         * Makefile.cfg (local-checks-to-skip): New.
6909         * Makefile.maint (local-check): Rename as...
6910         (local-checks-available): this.
6911         (local-check): New.
6912
6913 2003-08-26  Akim Demaille  <akim@epita.fr>
6914
6915         * announce-gen (print_changelog_deltas): Neutralize "<#" as
6916         "<\#" to avoid magic from Gnus when posting parts of this script.
6917
6918 2003-08-25  Jim Meyering  <jim@meyering.net>
6919
6920         * src/stat.c (main): Warn about use of deprecated `-l' option.
6921
6922 2003-08-22  Jim Meyering  <jim@meyering.net>
6923
6924         * src/stat.c (do_stat): For link count at end of line, use %h format,
6925         instead of %-5h.  The latter would make stat emit trailing spaces.
6926         Reported by Dan Jacobson.
6927
6928 2003-08-20  Jim Meyering  <jim@meyering.net>
6929
6930         * Makefile.am (EXTRA_DIST): Add .x-sc_space_tab .x-sc_sun_os_names
6931
6932 2003-08-19  Jim Meyering  <jim@meyering.net>
6933
6934         * src/system.h: Include stdlib.h unconditionally,
6935         as we're now assuming that part of hosted C89.
6936
6937 2003-08-18  Jim Meyering  <jim@meyering.net>
6938
6939         * src/sys2.h (textdomain, bindtextdomain) [! ENABLE_NLS]: Define away,
6940         to avoid warnings from gcc.
6941
6942 2003-08-17  Jim Meyering  <jim@meyering.net>
6943
6944         Avoid unnecessary and sometimes time-consuming hostname lookups.
6945         * src/who.c (print_user): Use strchr, not strrchr.
6946         * src/pinky.c (print_entry): Likewise.
6947         Patch by Michael Stone.
6948         This fixes a typo I introduced in who-users.c on 1996-02-23.
6949
6950         * Makefile.maint (makefile-check): Add 0-9 to the range of characters
6951         disallowed between `@...@'.
6952
6953 2003-08-16  Paul Eggert  <eggert@twinsun.com>
6954
6955         * configure.ac (fu_cv_sys_truncating_statfs): Remove; now
6956         done by gnulib .m4 files.
6957         (jm_DUMMY_1): Require gl_READUTMP, not jm_PREREQ_READUTMP.
6958         * src/sys2.h (strtoull): Remove unused declaration.
6959
6960 2003-08-16  Jim Meyering  <jim@meyering.net>
6961
6962         * man/Makefile.am (.x.1): Ensure that generated PROGRAM.1 files
6963         are read-only.
6964
6965         * src/tail.c (tail_lines): Fix a potential (but very hard to exercise)
6966         race condition bug.  The bug would be triggered when tailing a file
6967         with file pointer not at beginning of file, and where the file was
6968         truncated to have a length of less than the initial offset at just
6969         the right moment (between the two lseek calls in this function).
6970
6971         An invalid initial value for *read_pos would result in
6972         `tail -n0 -f FILE' and `tail -c0 -f FILE' doing what amounted to a
6973         busy-wait rather than sleeping between iterations.  The bug manifests
6974         itself only when tailing regular files that are initially nonempty.
6975         * src/tail.c (tail_bytes): Set *read_pos to new file offset after
6976         each xlseek call.
6977         (tail_lines): Likewise, after lseek calls.
6978         Reported by Nick Estes.  See http://bugs.debian.org/205251 for details.
6979         * tests/tail-2/tail-n0f: New file.  Test for above fix.
6980         * tests/tail-2/Makefile.am (TESTS): Add tail-n0f.
6981
6982 2003-08-15  Jim Meyering  <jim@meyering.net>
6983
6984         * Makefile.maint (sc_space_tab): Use exclusion list in separate file.
6985         (sc_sun_os_names): Likewise.
6986         * .x-sc_space_tab, .x-sc_sun_os_names: New files.
6987
6988         * man/help2man: Remove some SPACEs before TAB.
6989
6990 2003-08-14  Paul Eggert  <eggert@twinsun.com>
6991
6992         * Makefile.maint (LC_ALL): Set to C.
6993         * man/Makefile.am (ASSORT): New var.
6994         (check-x-vs-1, programs): Use it.
6995         * src/Makefile.am (ASSORT, check-README, ../AUTHORS): Likewise.
6996         * tests/Makefile.am (ASSORT, all_programs): Likewise.
6997
6998 2003-08-11  Jim Meyering  <jim@meyering.net>
6999
7000         fold -s -wN would infloop for N < 8 with TABs in the input.
7001         E.g., this would not terminate: printf 'a\tb' | fold -w2 -s
7002         * src/fold.c (fold_file): Move contents of `else'-block
7003         out of conditional so it's used also for --spaces (-s).
7004         * tests/misc/fold: Test for the above fix.
7005         * tests/misc/Makefile.am (TESTS): Add fold.
7006
7007 2003-08-10  Jim Meyering  <jim@meyering.net>
7008
7009         * src/nice.c [!NICE_PRIORITY]: Include <sys/resource.h> after
7010         system.h so the types from time.h and sys/time.h are available.
7011         It appears that this is necessary for OpenBSD, NetBSD, and
7012         Darwin 6.5 (MacOS 10.2.5).  Reported by Nelson Beebe.
7013
7014 2003-08-06  Paul Eggert  <eggert@twinsun.com>
7015
7016         * NEWS: Add support for setting file timestamps to microsecond
7017         resolution, on hosts that support this.
7018         * src/copy.c, src/cp.c, src/install.c, src/touch.c: Include utimens.h.
7019         * src/copy.c (copy_internal):
7020         Set file timestamps with utimens, not utime.
7021         * src/cp.c (re_protect): Likewise.
7022         * src/install.c (change_timestamps): Likewise.
7023         * src/touch.c (newtime, touch, main): Likewise.
7024
7025 2003-08-09  Jim Meyering  <jim@meyering.net>
7026
7027         * Makefile.maint (sc_sun_os_names): New rule based on a regexp
7028         from Paul Eggert.
7029         (syntax-check-rules): Add it.
7030
7031         * src/tail.c (main): Tweak Solaris OS version number in comment.
7032         * src/wc.c (wc): Likewise
7033         * tests/tail-2/fflush: Likewise.
7034
7035         * src/tail.c: Add new undocumented option, --presume-input-pipe.
7036         (pipe_lines): Use memchr to skip lines, rather than an explicit loop.
7037
7038 2003-08-08  Paul Eggert  <eggert@twinsun.com>
7039
7040         Use new gnulib 'extensions' module.
7041         * configure.ac: Invoke gl_USE_SYSTEM_EXTENSIONS instead of
7042         AC_GNU_SOURCE.
7043
7044 2003-08-08  Paul Eggert  <eggert@twinsun.com>
7045
7046         * tests/du/basic: Ensure that a/b/F has at least 65 bytes too.
7047
7048 2003-08-09  Jim Meyering  <jim@meyering.net>
7049
7050         * tests/misc/split-fail: Reflect that `split -a 0' is now accepted.
7051         For tests of obsolete behavior, don't presume that unsetting
7052         _POSIX2_VERSION is equivalent to _POSIX2_VERSION=199209.
7053
7054 2003-08-07  Paul Eggert  <eggert@twinsun.com>
7055
7056         * doc/coreutils.texi (split invocation):
7057         Add -d or --numeric-suffixes option to 'split'.
7058         From a suggestion by Jesse Kornblum.
7059         * src/split.c (suffix_alphabet): New var.
7060         (longopts, usage, next_file_name, main): Support -d.
7061         (next_file_name, main): Allow -a0, as POSIX requires.
7062         (next_file_name): Don't assume ASCII-like encoding;
7063         'a' through 'z' are not contiguous in EBCDIC.
7064
7065 2003-08-05  Paul Eggert  <eggert@twinsun.com>
7066
7067         Merge getline from gnulib.
7068         * lib/getline.h, lib/getline.c, m4/getline.m4: Merge from gnulib.
7069         * lib/getndelim2.h, lib/getndelim2.c, m4/getndelim2.m4, m4/ssize_t.m4:
7070         New files, from gnulib.
7071         * lib/getdelim2.c, lib/getdelim2.h: Remove.
7072         * lib/Makefile.am (libfetish_a_SOURCES): Change getdelim2.c and
7073         getdelim2.h to getndelim2.c and getndelim2.h.
7074         * m4/jm-macros.m4 (jm_MACROS): Use gl_GETNDELIM2 rather than
7075         checking for getdelim.
7076         (jm_CHECK_ALL_TYPES): Use gt_TYPE_SSIZE_T for ssize_t rather
7077         than rolling our own.
7078         * src/cut.c: Include getndelim2.h rather than getdelim2.h.
7079         (cut_fields): Invoke getndelim2 rather than getdelim2.
7080
7081 2003-08-04  Jim Meyering  <jim@meyering.net>
7082
7083         * src/sort.c (main): Use unsigned int instead of int for `nsigs'
7084         and for the indices to iterate through nsigs.
7085
7086 2003-08-02  Paul Eggert  <eggert@twinsun.com>
7087
7088         * src/sort.c: Minor code cleanups, mostly to use more accurate
7089         types and to remove unnecessary casts.
7090         (min, max): Remove.  All uses changed to MIN and MAX.
7091         (hard_lc_collate, hard_LC_TIME, struct buffer.eof, struct
7092         keyfield.skipsblanks, struct keyfield.skipeblanks, struct
7093         keyfield.numeric, struct keyfield.general_numeric, struct
7094         keyfield.month, struct keyfield.reverse, reverse, unique,
7095         have_read_stdin): Now bool, not int.  All uses changed.
7096         (eolchar): Now char, not int.
7097         (struct keyfield.ignore): Now bool const *, not int *.
7098         (struct keyfield.translate): Now char const *, not char *.
7099         (struct month.name): Likewise.
7100         (blanks, nonprinting, nondictionary): Now bool[], not int[].
7101         (cleanup, inittables, keycompare, check, mergefps, first_same_file,
7102         check, sort, main): Use const * pointers when possible.
7103         (month_cmp): Rewrite to avoid casts.
7104         (inittables): Initialize tables unconditionally, to avoid branches.
7105         (fillbuf): Return bool, not int.  All uses changed.
7106         (fillbuf, keycompare, new_key, main):
7107         Use SIZE_MAX rather than (size_t) -1.
7108         (trailing_blanks): Renamed from trim_trailing_blanks.
7109         Return the number of blanks to trim.  All uses changed.
7110         (getmonth): Use trailing_blanks rather than open code.
7111         (keycompare): Do not cast char * to unsigned char *; not needed.
7112         CMP_WITH_IGNORE converts args to UCHAR, so no need to convert it
7113         ourselves.
7114         (compare, main): Use | rather than || to avoid jumps.
7115         Replace "diff = NONZERO (alen)" with "diff = 1", since alen must
7116         be nonzero there.
7117         (check, first_same_file, sort, main):
7118         Use bool instead of int local vars when possible.
7119         (check): Merge the old 'checkfp' and 'check' into a single function,
7120         that returns a boolean (true if the file was ordered).
7121         All uses changed.
7122         (main): Use int instead of unsigned for iterating through nsigs.
7123         Rename local var "posix_pedantic" to "posixly_correct".
7124
7125 2003-08-02  Jim Meyering  <jim@meyering.net>
7126
7127         * src/nice.c [!NICE_PRIORITY]: Include <time.h> before <sys/resource.h>
7128         to avoid compilation error on Ultrix. Reported by Christian Krackowizer.
7129
7130         * src/cut.c (cut_fields): Don't read again after encountering an
7131         initial EOF.  E.g., `cut -f2' would do so.
7132         * tests/misc/tty-eof: Add a test for the above fix.
7133
7134         * src/sort.c (sortlines): Add description and references.
7135         From Paul Eggert.
7136
7137         * tests/Makefile.am (TESTS_ENVIRONMENT): Set PATH so that
7138         the tests in help-version will use the just-built binaries.
7139         Reported by Christian Krackowizer.
7140
7141 2003-07-31  Paul Eggert  <eggert@twinsun.com>
7142
7143         * NEWS: Add --rfc-2822 option to GNU date.
7144         * doc/coreutils.texi (Time directives, Options for date, Examples
7145         of date): Likewise.
7146         * src/date.c (long_options, usage, main): Likewise.
7147         * doc/getdate.texi (General date syntax): Likewise.
7148         * doc/coreutils.texi (Options for date): Fix a typo in format:
7149         it's now %d not %_d.  Add URLs.
7150
7151 2003-08-01  Jim Meyering  <jim@meyering.net>
7152
7153         * tests/shred/remove: Ensure that $? is 0 for the final `exit 0'.
7154         Otherwise, with at least the /bin/sh from HPUX 10.20,
7155         the trap code would end up converting that to exit 1 and thus an
7156         unexpected test failure.  Reported by Christian Krackowizer.
7157
7158 2003-07-31  Paul Eggert  <eggert@twinsun.com>
7159
7160         * src/ptx.c: Do not include bumpalloc.h.
7161         (WORD_TABLE): New member alloc.
7162         (ALLOC_NEW_WORD): Remove.
7163         (occurs_alloc): New var.
7164         (digest_word_file, find_occurs_in_text): Check for arithmetic
7165         overflow when computing table size.  Use xrealloc rather than
7166         bumpalloc primitives.
7167
7168 2003-07-29  Jim Meyering  <jim@meyering.net>
7169
7170         * Version 5.0.90.
7171
7172         * README: When running tests as root, suggest using
7173         sudo with NON_ROOT_USERNAME=$USER.
7174
7175         * tests/Makefile.am (all_programs): Makefile is in ../src, not
7176         $(srcdir)/../src.
7177
7178 2003-07-28  Jim Meyering  <jim@meyering.net>
7179
7180         * Makefile.maint (GZIP_ENV): Try Debian/gzip's new --rsyncable option.
7181
7182 2003-07-28  Paul Eggert  <eggert@twinsun.com>
7183
7184         * lib/stdbool.hin (_Bool): Make it signed char, instead of
7185         an enum type, so that it's guaranteed to promote to int.
7186         * src/sort.c (sortlines_temp): Undo previous change.
7187
7188 2003-07-28  Jim Meyering  <jim@meyering.net>
7189
7190         * src/sort.c (sortlines_temp): Declare local `swap' to be `int', not
7191         `bool'.  Otherwise, at least one buggy compiler (alpha gcc-2.95.4)
7192         would cause lines[-1 - swap] (with swap = false) to evaluate to
7193         lines[4294967295].
7194
7195 2003-07-27  Jim Meyering  <jim@meyering.net>
7196
7197         * tests/priv-check (my_uid): Use `!', not `^' in case pattern `[!0-9]',
7198         since /bin/sh of at least NetBSD 1.6 and OpenBSD 3.2 don't accept `^'.
7199
7200         * src/remove.c (prompt) [! recursive]: Don't prompt about unwritable
7201         directories, as required by POSIX.   Reported by Karl Berry.
7202         * tests/rm/dir-no-w: New file.  Test for the above fix.
7203         * tests/rm/Makefile.am (TESTS): Add dir-no-w.
7204
7205         * tests/mk-script: Emit `$xx', not its expansion.
7206
7207 2003-07-27  Paul Eggert  <eggert@twinsun.com>
7208
7209         This change was inspired by a similar proposal by Stepan Kasal.
7210         * src/sort.c (mergelines, sortlines_temp): New functions.
7211         (sortlines): Use them, to reduce the number of times that
7212         we need to copy 'struct line' values.  This improved CPU
7213         performance by about 30% on one 18 MB test.
7214         (sort): Don't invoke sortlines unless we have 2 or more lines.
7215
7216 2003-07-26  Stepan Kasal  <kasal@ucw.cz>
7217
7218         * src/sort.c (sort): Don't require two `struct line's per text line,
7219         the new sort algorithm requires just 1.5.
7220
7221 2003-07-27  Jim Meyering  <jim@meyering.net>
7222
7223         * src/pathchk.c (validate_path): Use %lu, not %ld.
7224         From Paul Eggert.
7225         * src/cut.c (is_printable_field): Simplify bit arithmetic.
7226         From Paul Eggert.
7227         * src/ls.c (sort_files): Put `volatile' in the right place.
7228         From Paul Eggert.
7229
7230 2003-07-26  Jim Meyering  <jim@meyering.net>
7231
7232         Use only one bit per field/offset in array, not one `int'.
7233         * src/cut.c (printable_field): Change type to `unsigned char'.
7234         (mark_printable_field, is_printable_field): New functions.
7235         Use them in place of all direct accesses of `printable_field'.
7236
7237         * src/expand.c (parse_tabstops): Detect overflow properly.
7238         * src/cut.c (set_fields): Likewise.
7239
7240         * src/rm.c: Include "dirname.h".
7241         (usage): Use base_name (program_name) in body of --help output.
7242         This lets me...
7243         * man/Makefile.am (.x.1): ...back out the kludge of 2003-07-22.
7244         Idea from Brendan O'Dea, who suggested using
7245         `program_name = basename (argv[0]);' everywhere --
7246         can't do that, but using base_name works just fine here.
7247
7248         * src/Makefile.am (AM_INSTALLCHECK_STD_OPTIONS_EXEMPT): Exempt test.
7249
7250 2003-07-24  Paul Eggert  <eggert@twinsun.com>
7251
7252         Fix some POSIX-compliance problems with 'test'.  This makes
7253         'test' more compatible with Bash.
7254
7255         * NEWS, doc/coreutils.texi: Document the following.
7256         * src/test.c: Include exitfail.h.
7257         (TEST_FAILURE): New constant, used for exit status if 'test' fails.
7258         (test-syntax_error): Use it.
7259         (binary_operator): Now takes bool arg specifying whether left operand
7260         is -l ARG, so that caller determines this rather than us.
7261         All uses changed.
7262         (term): Use posixtest to evaluate parenthesized subexpressions.
7263         (unary_operator, one_argument): Remove support for -t without operand.
7264         (one_argument): Take argument from argv[pos].
7265         (one_argument, two_arguments, three_arguments): Advance pos.
7266         All callers changed.
7267         (three_arguments): Look for binary ops before "!".  Then look
7268         for parenthesized one_argument expressions, instead of trusting
7269         expr () to do the right thing.
7270         (posixtest): Now takes number of args.  All callers changed.
7271         Treat "( A B )" like "A B".
7272         (main): Set exit_failure to TEST_FAILURE.  Don't depend on
7273         POSIXLY_CORRECT, as we now conform to POSIX by default.
7274         (main) [!LBRACKET]: Do not recognize "--help" or "--verbose" unless.
7275         * tests/test/Test.pm (test_vector): Add several tests to check
7276         the above.  Syntax errors now exit with status 2, not 1.
7277         * man/Makefile.am (mapped_name): Use `../src/[' binary to create test.1.
7278
7279 2003-07-26  Jim Meyering  <jim@meyering.net>
7280
7281         * tests/help-version: Adjust for above change in test behavior:
7282         `[' exits with 2, not 1, and test doesn't accept --help or --version.
7283
7284         * Makefile.maint (ME): Don't use trick suggested in Make manual.
7285         It doesn't work for make-3.79.1.  Reported by Christian Krackowizer.
7286
7287         * Makefile.maint (sc_system_h_headers): Another syntax check.
7288         (syntax-check-rules): Add it to the list.
7289
7290         * src/pathchk.c (validate_path): Cast strlen value to `unsigned long'
7291         so it matches `%ld' format even on 32-bit systems.
7292
7293         * src/fmt.c (flush_paragraph): Cast field width to `int' to
7294         avoid warning on 64-bit systems.
7295
7296         * src/ls.c (sort_files): Make `func' volatile, so it can't be
7297         clobbered by a `longjmp' into this function.
7298
7299 2003-07-25  Jim Meyering  <jim@meyering.net>
7300
7301         * src/pathchk.c (validate_path): Use %ld format (not %d) for size_t
7302         value.
7303
7304         * tests/misc/split-fail: Disable the --line-bytes=$_4gb test,
7305         because it'd evoke spurious failure on 64-bit systems.
7306
7307 2003-07-24  Jim Meyering  <jim@meyering.net>
7308
7309         * src/dd.c (usage): Document the fact that SIGUSR1 makes dd
7310         output its current record counts.  Reported by Jurriaan.
7311
7312         * tests/wc/Test.pm (test_vector): Disable the `PIPE' tests when running
7313         `wc' with no options.  This goes along with the change of 2003-07-20.
7314
7315 2003-07-23  Jim Meyering  <jim@meyering.net>
7316
7317         Don't include headers already included by system.h:
7318         * src/tr.c: Don't include errno.h.
7319         * src/true.c: Don't include version-etc.h.
7320         * src/test.c: Don't include limits.h or error.h.
7321         * src/stat.c: Don't include unistd.h or time.h.
7322         * src/readlink.c: Don't include stdlib.h, unistd.h, or limits.h.
7323         * src/pr.c: Don't include time.h.
7324         * src/pathchk.c: Don't include errno.h.
7325         * src/nice.c: Don't include sys/time.h.
7326         * src/ls.c: Don't include stdlib.h.
7327
7328         * basename.c, cat.c, chroot.c, cksum.c, comm.c, csplit.c, cut.c, date.c:
7329         * dd.c, dirname.c, echo.c, env.c, expand.c, expr.c, factor.c, fmt.c:
7330         * fold.c, head.c, hostid.c, hostname.c, id.c, join.c, kill.c, logname.c:
7331         * md5sum.c, nice.c, nl.c, nohup.c, od.c, paste.c, pathchk.c, pinky.c:
7332         * pr.c, printenv.c, printf.c, ptx.c, pwd.c, seq.c, setuidgid.c, shred.c:
7333         * sleep.c, sort.c, split.c, stat.c, stty.c, su.c, sum.c, tac.c, tail.c:
7334         * tee.c, test.c, tr.c, true.c, tsort.c, tty.c, uname.c, unexpand.c:
7335         * uniq.c, uptime.c, users.c, wc.c, who.c, whoami.c, yes.c:
7336         Don't include closeout.h.
7337
7338         * tests/rm/fail-2eperm: Add a check for whether $NON_ROOT_USERNAME
7339         can access the required version of rm.
7340         * tests/rm/Makefile.am (TESTS_ENVIRONMENT): Define PACKAGE_VERSION.
7341
7342         * tests/cut/Test.pm (out-delim3a): New test.
7343
7344         * man/help2man: Update to version 1.33.
7345
7346         * src/expand.c (parse_tabstops): Detect overflow in tabstop sizes.
7347
7348         * src/dircolors.c: Include xstrndup.h.
7349         (xstrndup): Remove function, now that it's been factored out into
7350         it's own file.
7351
7352 2003-07-22  Paul Eggert  <eggert@twinsun.com>
7353
7354         * src/wc.c (wc): Fix typo in computation of file from file_x,
7355         which caused the former to be used uninitialized if file_x was
7356         nonzero.
7357
7358 2003-07-22  Jim Meyering  <jim@meyering.net>
7359
7360         * src/cut.c (set_fields): Use xcalloc in place of xmalloc+memset.
7361
7362         * man/Makefile.am (.x.1): Substitute 's,$t/$*,$*,' on output of
7363         help2man, to avoid having `rm.td/rm' appear in rm.1.  Reported by
7364         Thomas Luzat.  See http://bugs.debian.org/202413 for details.
7365
7366         * src/cut.c (main) [lint]: Initialize spec_list_string to avoid warning.
7367
7368         * src/hostid.c: Don't include <unistd.h>.  system.h already does that.
7369
7370         * src/cut.c (set_fields): Mark all selected indices before trying to
7371         determine range endpoints.
7372         * tests/cut/Test.pm: New test for the above fix.
7373
7374         Begin to address this comment: What if someone wants to
7375         extract the 1,000,000-th field of some huge input file?
7376         The first step is to rearrange things so that the values
7377         in the printable_field array are all 0/1 rather than 0/1/2.
7378         * src/cut.c (RANGE_START_SENTINEL): Remove.
7379         Store range-start indices in a hash table, rather than
7380         overloading the `printable_field' array.
7381         (range_start_ht): New global.
7382         (hash_int, hash_compare_ints, is_range_start_index): New functions.
7383         (print_kth): Use is_range_start_index; don't test printable_field.
7384         (set_fields): Detect overflow.
7385         (set_fields): Insert each range-start index into range_start_ht.
7386         (main): Call set_fields only once, and only after
7387         output_delimiter_specified and (if required) range_start_ht have
7388         been defined.
7389
7390 2003-07-20  Paul Eggert  <eggert@twinsun.com>
7391
7392         * src/wc.c (get_input_fstatus): Fix typo: `stat' was being
7393         invoked with a null pointer when there were no file arguments.
7394
7395 2003-07-20  Jim Meyering  <jim@meyering.net>
7396
7397         * Makefile.maint (sc_changelog): Add another nit-picky check.
7398
7399         * src/wc.c (write_counts): Add a comment.
7400         (wc): Rename `file' parameter.
7401         Set new local, `file', to be the file name, or (when it's NULL)
7402         _("standard output") so that all uses of `file' use the proper value.
7403         Use STREQ, not strcmp.
7404
7405 2003-07-20  Paul Eggert  <eggert@twinsun.com>
7406
7407         wc count field widths now are heuristically adjusted depending
7408         on the input size, if known.  If only one count is printed, it
7409         is guaranteed to be printed without leading spaces.
7410
7411         Previously, wc did not align the count fields if
7412         POSIXLY_CORRECT was set, but POSIX did not actually require
7413         this undesirable behavior, so it has been removed.
7414
7415         * NEWS: Document this.
7416         * doc/coreutils.texi (wc invocation): Likewise.
7417
7418         * src/wc.c (number_width): New var.
7419         (posixly_correct): Remove.
7420         (struct fstatus): New struct.
7421         (write_counts): Output fields of width number_width.
7422         Do not worry about POSIXLY_CORRECT.
7423         Use null file, not empty-string file, to denote stdin,
7424         since "" is a valid file name on some hosts.
7425         (wc, wc_file): New arg fstatus.  Use it to avoid invoking fstat
7426         if possible.
7427         (wc):  Avoid problems if end_pos - current_pos overflows.
7428         Do not print odd message if stdin has a read error.
7429         (get_input_fstatus, compute_number_width): New functions.
7430         (main): Use them to implement the new behavior.
7431         Ignore POSIXLY_CORRECT.
7432
7433         * tests/wc/Test.pm: Adjust to the new output widths.
7434
7435 2003-07-19  Jim Meyering  <jim@meyering.net>
7436
7437         * tests/rm/fail-eperm: Don't create temporary directory --
7438         we don't use it.
7439
7440         * tests/shred/remove: Don't open-code test for UID != 0.
7441         Use priv-check's require-non-root instead.
7442         Update to use newer framework.
7443
7444         * tests/help-version (expected_failure_status_expr): Record that
7445         expr exits with status of 3 for e.g., a write error.
7446
7447         * tests/priv-check: Use `id -u' to see if we're running as root,
7448         rather than trying go write to an write-protected file.
7449         When running as root, ensure $NON_ROOT_USERNAME is valid.
7450         When running as root with `require-non-root', ensure that `.'
7451         is writable by $NON_ROOT_USERNAME, then reinvoke $0 set-user-ID
7452         to $NON_ROOT_USERNAME.  If `.' is not writable, then skip the test.
7453
7454         * src/printenv.c: Include "exitfail.h".
7455         (main): Set exit_failure rather than calling close_stdout_set_status.
7456         * src/date.c: Likewise.
7457         * src/sort.c: Likewise.
7458         * src/tty.c: Likewise.
7459
7460 2003-07-18  Jim Meyering  <jim@meyering.net>
7461
7462         * tests/touch/not-owner: Update to use newer framework.
7463
7464         * tests/rm/fail-eperm: Use $srcdir/../priv-check, create a temporary
7465         directory, and remove Perl-coded `you may not run as root' test.
7466         * tests/cp/fail-perm: Use $srcdir/../priv-check, rather than
7467         hard-coding something not quite equivalent.
7468         Paul Jarc reported the inconsistent diagnostics.
7469
7470         * src/sort.c (main): Use close_stdout via atexit.
7471         Now `sort --version' and `sort --help' fail, as they should
7472         when their output is redirected to /dev/full.
7473
7474         * src/su.c (usage): Don't call close_stdout here.
7475         (main): Use close_stdout via atexit.
7476         Now `su --version > /dev/full' fails, as it should.
7477         Somehow, the change of 2000-05-07 that purports to fix this
7478         was not checked in.
7479
7480         * tests/help-version (--help/--version vs. /dev/full): Special-case
7481         `[' to protect it from expected_failure_status-`eval'.
7482
7483         * src/uniq.c (writeline): Use a SPACE, not a TAB between the
7484         count and the corresponding line, as required by POSIX.
7485         Reported by Clement Wang.
7486         * tests/uniq/Test.pm (101, 102): Update tests of -c accordingly.
7487
7488         * tests/expr/basic: Add tests for when exit status is 2.
7489
7490         * src/nohup.c (NOHUP_FOUND_BUT_CANNOT_INVOKE, NOHUP_FAILURE):
7491         Use an anonymous `enum', rather than #define.
7492
7493 2003-07-17  Paul Eggert  <eggert@twinsun.com>
7494
7495         * src/expr.c: Include "exitfail.h", "quotearg.h".
7496         (EXPR_INVALID, EXPR_ERROR): New constants.
7497         (nomoreargs, null, toarith, nextarg): Return bool, not int.
7498         (syntax_error): New function, exiting with status 2.  Use it
7499         insteading of printing "syntax error" ourselves.
7500         (main): Initialize exit_failure to EXPR_ERROR.
7501         Exit with EXPR_INVALID on syntax error (too few arguments).
7502         (nextarg): Use strcmp, not strcoll; strcoll might return
7503         an undesirable 0, or might fail.
7504         (docolon, eval4, eval3): Exit with status 3 on invalid argument type
7505         or other such error.
7506         (eval2): Report an error if strcoll fails in a string comparison.
7507         * src/sort.c: Include "exitfail.h".
7508         (main): Set exit_failure, not xalloc_exit_failure and
7509         xmemcoll_exit_failure.
7510         * tests/expr/basic: Invalid value exits with status 3, not 2.
7511
7512 2003-07-16  Jim Meyering  <jim@meyering.net>
7513
7514         * configure.ac (AC_INIT): Use 5.0.90 as the version, rather than 5.0.2,
7515         per GNU maintainer guidelines.  The next non-beta release will be 5.1.
7516
7517         This script would have caught at least two recent bugs:
7518         those in [ and kill.
7519         * tests/help-version: Revive this script.
7520         It wasn't doing anything useful, since $all_programs wasn't being
7521         defined by the invoking Makefile.am.
7522         Reflect that nohup is no longer a script, so don't exclude it.
7523         Add framework to handle the programs added since it was last run:
7524         kill, stat, unlink, [, link, readlink.
7525         Fix path-related problems deriving from the move of this script
7526         from src/ to its present location.
7527         * tests/Makefile.am (all_programs): Define.
7528         (TESTS_ENVIRONMENT): Use it.
7529
7530         * src/kill.c (main): Fix bug introduced on 2003-05-10 (for 5.0.1)
7531         whereby kill would always attempt to operate on argv[0] and fail.
7532
7533         * src/test.c (integer_expected_error): Improve diagnostic -- now,
7534         it also matches the one from bash's builtin test.
7535         (binary_operator): Add \n at end of diagnostic.
7536
7537         * tests/rm/fail-2eperm: Remove setuidgid-related code.  Move it to ...
7538         * tests/priv-check: Move setuidgid-related and
7539         NON_ROOT_USERNAME-checking code to this file.
7540
7541         * README: Update section on testing as `root'.
7542         Suggestion from Paul Jarc.
7543
7544         * src/test.c (AUTHORS): Replace 3-letter usernames with the actual
7545         names of authors that I just found in bash's builtins/test.def.
7546
7547         Running `[' with no arguments would evoke a segfault.
7548         * src/test.c (main) [LBRACKET]: Move initialization of argv to
7549         precede potential use via test_syntax_error.
7550
7551         * src/Makefile.am (AM_CPPFLAGS): Rename from `INCLUDES', to avoid
7552         warning from automake -Wall.
7553
7554 2003-07-15  Jim Meyering  <jim@meyering.net>
7555
7556         * Version 5.0.1.
7557
7558         * Makefile.maint (%.asc): Remove target first, so gpg doesn't
7559         prompt us about it.
7560
7561         * announce-gen (print_changelog_deltas): Relax tests for matching
7562         version-number line in NEWS.
7563         Change the .sig suffix to .asc here, too.
7564
7565 2003-07-14  Jim Meyering  <jim@meyering.net>
7566
7567         * Makefile.maint (%.asc): Renamed from %.sig.
7568         Generate and use ascii-armored signatures.
7569         Use gpg's -o option.
7570
7571 2003-07-13  Jim Meyering  <jim@meyering.net>
7572
7573         * src/nohup.c (NOHUP_FAILURE, NOHUP_FOUND_BUT_CANNOT_INVOKE): Define.
7574         (main): Use them.
7575
7576         * Makefile.maint (syntax-check): Move each individual check into
7577         its own target.
7578         (syntax-check-rules): This is the list of syntax-check targets.
7579         (sc_unmarked_diagnostics, sc_cast_of_argument_to_free):
7580         (sc_cast_of_x_alloc_return_value, sc_space_tab):
7581         (sc_error_exit_success, sc_xalloc_h_in_src):  New targets.
7582
7583 2003-07-12  Jim Meyering  <jim@meyering.net>
7584
7585         * configure.ac: Remove uses of OPTIONAL_BIN_ZCRIPTS and last
7586         traces of the nohup script.
7587
7588         * src/Makefile.am (bin_SCRIPTS): Remove use of just-removed
7589         $(OPTIONAL_BIN_ZCRIPTS).
7590
7591         * src/Makefile.am (localedir.h): Put the `2>&1' after the redirect
7592         target, not before the `>'.
7593
7594         * src/remove.c (remove_dir): Give a diagnostic upon failed save_cwd,
7595         now that that function no longer calls `error'.
7596
7597         * src/df.c (find_mount_point): Emit a diagnostic for each
7598         failed syscall, rather than relying on caller to do that.
7599         The caller couldn't do a good job, anyhow -- too many different
7600         ways to fail (each with a different referent).
7601         Give a diagnostic upon failed save_cwd, now that that function
7602         no longer calls `error'.
7603         (show_point): Don't diagnose find_mount_point's errors, now that
7604         it handles them itself.
7605
7606         * src/df.c (find_mount_point): Don't let free clobber errno upon
7607         failed chdir.
7608
7609         * src/sys2.h: Remove alloca-related block.
7610         * src/system.h: Include <alloca.h> here, instead.
7611
7612         It appears that the `#pragma alloca' included via "system.h" is
7613         adequate, since join.c uses alloca, yet lacked an in-file #pragma.
7614         * src/copy.c, src/cp.c, src/df.c, src/install.c, src/ln.c:
7615         * src/ls.c, src/mv.c, src/remove.c: Remove `#pragma alloca'.
7616
7617         * src/chown-core.c (change_file_owner): Do not restore any special
7618         permission bits (e.g., set-user-ID, set-group-ID) that are reset
7619         by chown(2) on some systems.  Suggestion and insistence :-) from
7620         Michael Stone.
7621
7622         * tests/input-tty: Also check `test -t 1'.
7623         This is necessary on linux-2.4.21.  Otherwise, the stty/basic-1
7624         test would block when run in the background.
7625
7626 2003-07-11  Jim Meyering  <jim@meyering.net>
7627
7628         * tests/sample-test: Also fail if cat-to-create-expected-output
7629         fails.  Otherwise, if both `exp' and `out' were to end up empty
7630         because of e.g., a full disk, they would mistakenly compare equal.
7631
7632         * src/nohup.c: New file.  Rewrite of nohup.sh in C.
7633         This solves a portability problem: on at least Solaris systems,
7634         when nohup.sh used the vendor /bin/sh, it would exit with status
7635         of `1' rather than the required 126 or 127 upon failure to exec
7636         the specified program.
7637
7638         * src/Makefile.am (EXTRA_SCRIPTS): Remove definition.
7639         (bin_PROGRAMS): Add nohup.
7640         (EXTRA_DIST): Remove nohup.sh.
7641         (all_programs): Remove use of $(EXTRA_SCRIPTS).
7642         * src/nohup.sh: Remove file.
7643         * man/Makefile.am (nohup.1): Depend on nohup.c, rather than nohup.sh.
7644
7645         * tests/misc/nohup: Tests for the above.
7646         * tests/misc/Makefile.am (TESTS): Add nohup.
7647
7648         * src/head.c (diagnose_copy_fd_failure): New function, renamed from
7649         the macro, COPY_FD_DIAGNOSE.
7650         (diagnose_copy_fd_failure): Enclose diagnostic in _(...).
7651         (head_file): Likewise.
7652
7653         * src/date.c: Include "quote.h".
7654         (batch_convert): Use the quote function rather than using literal `...'
7655         in a diagnostic.
7656
7657         * src/setuidgid.c (main): Enclose diagnostic in _(...).
7658         * src/fmt.c (main): Likewise.
7659         * src/mknod.c (main): Likewise.
7660         * src/tac.c (tac_seekable): Likewise.
7661         * src/yes.c (main): Likewise.
7662         * src/od.c (main): Likewise.
7663         * src/install.c (change_attributes): Likewise.
7664
7665 2003-07-10  Jim Meyering  <jim@meyering.net>
7666
7667         * src/head.c (usage): Use 1024*1024 in place of 1048576.
7668         * src/tail.c (usage): Likewise.
7669
7670         * tests/rm/fail-2eperm: Now that we have setuidgid, use it in
7671         place of the kludge in this test.  Suggestion from Paul Jarc.
7672
7673         * src/Makefile.am (noinst_PROGRAMS): Define to setuidgid.
7674         * src/setuidgid.c: New program, solely for testing (not installed).
7675
7676         * src/chown-core.c (change_file_owner): Don't leak file descriptors
7677         when dereferencing symlinks.
7678
7679 2003-07-09  Jim Meyering  <jim@meyering.net>
7680
7681         * tests/du/slash: New file/test for today's lib/ftw.c fix.
7682         * tests/du/Makefile.am (TESTS): Add slash
7683
7684         * src/tail.c (xlseek): Avoid warning about ``return without value
7685         from function returning non-void''.
7686
7687 2003-07-08  Jim Meyering  <jim@meyering.net>
7688
7689         * man/help2man: Update to version 1.29.
7690
7691         * man/help2man: Add END handler to close STDOUT and check for errors.
7692
7693 2003-06-30  Paul Eggert  <eggert@twinsun.com>
7694
7695         Add support for a "[" that conforms to the GNU coding standards,
7696         i.e., that does not depend on its name.
7697         * src/lbracket.c: New file.
7698         * README: Add "[".
7699         * man/Makefile.am (programs): Ignore "[", since it doesn't have
7700         a separate man page.
7701         * src/Makefile.am (bin_PROGRAMS): Add "[".
7702         (__SOURCES): New var.
7703         * src/test.c (LBRACKET): Define to 0 if not defined.
7704         (main): Use LBRACKET rather than argv[0].
7705
7706         * src/test.c (one_argument): Do not check for -t if POSIXLY_CORRECT.
7707         Reported by Paul Jarc and Dan Jacobson.
7708
7709         * src/test.c (main): Do not recognize --help or --version if
7710         POSIXLY_CORRECT, when invoked as "test".  Handle "[ ]" correctly.
7711         Do not bother testing that margv[margc] is non-null.
7712
7713 2003-07-04  Jim Meyering  <jim@meyering.net>
7714
7715         * src/who.c (print_line): Rewrite to use asprintf, in order to be
7716         able to avoid emitting trailing spaces.  Reported by Dan Jacobson.
7717
7718         * tests/misc/head-elide-tail: Add tests of head's new --lines=-N
7719         option, and perform the +1600 invocations of head IFF the envvar
7720         RUN_EXPENSIVE_TESTS is set.
7721
7722 2003-07-03  Jim Meyering  <jim@meyering.net>
7723
7724         * src/cp.c (do_copy): Give a better diagnostic when failing due
7725         to nonexistent destination directory.  Reported by Dmitry Rutsky.
7726         See http://bugs.debian.org/199730 for details.
7727
7728 2003-06-27  Jim Meyering  <jim@meyering.net>
7729
7730         split's --verbose option did nothing [broken in 4.5.10 and 5.0]
7731         * src/split.c (longopts): Use `1', not `0' as the value for
7732         for &verbose.  Reported by Keith Thompson.
7733
7734         Test for the above fix.
7735         * tests/misc/split-a: Also use --verbose and compare stderr
7736         output with what we'd expect.
7737
7738 2003-06-20  Jim Meyering  <jim@meyering.net>
7739
7740         * src/copy.c (copy_internal) [HAVE_STRUCT_STAT_ST_AUTHOR]:
7741         Use `error_t' (rather than int) as type for local `err'.
7742         From Alfred M. Szmidt.
7743
7744 2003-06-19  Marcus Brinkmann  <marcus@gnu.org>
7745
7746         * src/copy.c (copy_internal) [HAVE_STRUCT_STAT_ST_AUTHOR]:
7747         Fix author preservation code.
7748
7749 2003-06-19  Jim Meyering  <jim@meyering.net>
7750
7751         * src/ln.c (ENABLE_HARD_LINK_TO_SYMLINK_WARNING): Define to 0.
7752         (do_link): Don't warn about hard link to symlink.
7753
7754 2003-06-18  Jim Meyering  <jim@meyering.net>
7755
7756         * src/cut.c: Include "getdelim2.h", not "getstr.h".
7757         Reflect renaming: getstr -> getdelim2.
7758
7759         * src/comm.c, src/join.c, src/nl.c, src/uniq.c: Reflect renaming:
7760         readline -> readlinebuffer.
7761
7762 2003-06-09  John David Anglin  <dave.anglin@nrc-cnrc.gc.ca>
7763
7764         * src/readlink.c: Include <sys/types.h> before system.h (because
7765         the latter includes <sys/stat.h>).  Required on Ultrix 4.3.
7766
7767 2003-06-17  Jim Meyering  <jim@meyering.net>
7768
7769         * src/system.h (initialize_main): Define.
7770         Use it in every `main'.  Applied via this:
7771         p='initialize_main (&argc, &argv);'
7772         perl -ni -e '/program_name.=.argv.0/ and print "  '"$p"'\n"; print' \
7773           $(grep -l program_name.=.argv.0 *.c)
7774         test.c uses margc/margv, so I made the change manually for that file.
7775         Based on a patch from Bernard Giroud.
7776
7777 2003-06-09  John David Anglin  <dave.anglin@nrc-cnrc.gc.ca>
7778
7779         Fix for build failure on Ultrix 4.3.
7780         * src/stat.c: Include sys/statvfs.h in preference to sys/vfs.h.
7781         Include sys/param.h and sys/mount.h on ultrix.
7782
7783 2003-06-16  Jim Meyering  <jim@meyering.net>
7784
7785         * src/touch.c (O_NDELAY, O_NONBLOCK, O_NOCTTY, EISDIR): Remove
7786         definitions.
7787         * src/system.h (O_NDELAY, O_NONBLOCK, O_NOCTTY, EISDIR): Define
7788         them here instead, but with one change: define EISDIR to -1, not 0.
7789
7790         * src/cat.c (cat): Remove `#ifndef ENOSYS', now that it's
7791         guaranteed to be defined.
7792         * src/system.h (ENOSYS, ENOTSUP): Define to -1 if not defined.
7793
7794         * README: Mention the CVS repository.
7795         Encourage addition of test cases.
7796
7797 2003-06-12  Jim Meyering  <jim@meyering.net>
7798
7799         * src/touch.c (touch): Call close only if necessary.
7800         From Bruno Haible.
7801
7802         * src/wc.c (usage): Correct wording: wc prints counts in the order
7803         `newline, word, byte'.  Reported by Keith M. Briggs.
7804         * man/wc.x: Fix it here, too.  And change `lines' to `newlines'.
7805
7806 2003-06-10  Jim Meyering  <jim@meyering.net>
7807
7808         * tests/date/Test.pm: Add a test for the new format, e.g., May-23-2003.
7809
7810 2003-06-07  Jim Meyering  <jim@meyering.net>
7811
7812         * Makefile.maint (syntax-check): Add commented-out (over-aggressive)
7813         rule.
7814
7815 2003-06-06  Jim Meyering  <jim@meyering.net>
7816
7817         * src/extract-magic (main): Avoid newer 3-arg form of open,
7818         so this script works also with e.g., perl5.005_03.
7819         Patch by John David Anglin.
7820
7821 2003-06-04  Paul Eggert  <eggert@twinsun.com>
7822
7823         * src/system.h: Include <stdbool.h> unconditionally.
7824
7825 2003-06-04  Jim Meyering  <jim@meyering.net>
7826
7827         * man/Makefile.am (check-programs-vs-x): Rename target
7828         from check-programs-vs-1.  Adjust rule to check for the
7829         primary (.x) file, not the generated one (.1).
7830
7831 2003-06-03  Tim Mooney <mooney@dogbert.cc.ndsu.NoDak.edu>
7832
7833         * man/kill.x: New file.
7834         * man/Makefile.am (dist_man_MANS): Add kill.1.
7835         (kill.1): New rule.
7836
7837 2003-06-04  Jim Meyering  <jim@meyering.net>
7838
7839         Ensure that the .x file for a new program is never forgotten again.
7840         * man/Makefile.am (programs): Define.
7841         (check-programs-vs-1): New phony target.
7842         (check-local): Depend on it.
7843
7844 2003-06-03  Jim Meyering  <jim@meyering.net>
7845
7846         Avoid unnecessary copying of environment.
7847         * src/env.c (main): Rather than clearing the environment and --
7848         unless told to ignore environment -- copying all settings from
7849         the saved, original environment, clear the environment only when
7850         that is requested.  Suggested by Jens Elkner.
7851
7852 2003-06-02  Jim Meyering  <jim@meyering.net>
7853
7854         * src/system.h: Always include <string.h>, since we assume C89.
7855         Include <limits.h> without checking for HAVE_LIMITS_H.
7856
7857         * src/test.c [!TEST_STANDALONE]: Remove #if-0'd block.
7858         (STREQ, S_IXUGO): Remove redundant (in system.h) definitions.
7859
7860 2003-06-01  Jim Meyering  <jim@meyering.net>
7861
7862         Avoid a race condition in `tail -f' described by Ken Raeburn in
7863         http://mail.gnu.org/archive/html/bug-textutils/2003-05/msg00007.html
7864         * src/tail.c (file_lines): Add new parameter, *read_pos, and set it.
7865         (pipe_lines, pipe_bytes, start_bytes, start_lines): Likewise.
7866         (tail_bytes, tail_lines, tail): Likewise.
7867         (tail_file): Use the new `read_pos' value as the size,
7868         rather than stats.st_size from the fstat call.
7869
7870 2003-05-28  Jim Meyering  <jim@meyering.net>
7871
7872         * src/extract-magic: Allow expansion of `$file' in the here-
7873         document corresponding to the comment at the top of fs.h.
7874
7875 2003-05-26  Jim Meyering  <jim@meyering.net>
7876
7877         * src/stat.c: Fix portability problem on FreeBSD5.0: don't include
7878         <sys/statvfs.h> on systems without HAVE_STRUCT_STATVFS_F_BASETYPE.
7879         Use #if/#elif/... cascade so we get only one set of include files.
7880         Reported by Nelson Beebe.
7881
7882 2003-05-24  Jim Meyering  <jim@meyering.net>
7883
7884         * src/md5sum.c (split_3): Accept the BSD format only when in MD5 mode.
7885         * tests/sha1sum/basic-1: Make sure `sha1sum --check' doesn't
7886         accept the BSD format.
7887
7888 2003-03-28  Joe Orton  <jorton@redhat.com>
7889
7890         * src/md5sum.c (bsd_split_3): New function.
7891         (split_3): Detect checksums from BSD 'md5' command and handle them
7892         using bsd_split_3.
7893
7894         * tests/md5sum/basic-1: New tests for --check exit status, and for
7895         BSD-style checksum files.
7896
7897 2003-05-21  Jim Meyering  <jim@meyering.net>
7898
7899         * src/head.c (elide_tail_lines_pipe): Fix a thinko.
7900         This sort of thing is why it'd be *Really Good* to factor
7901         out the common code used here and in tail.c.
7902
7903 2003-05-14  Jim Meyering  <jim@meyering.net>
7904
7905         * src/head.c (usage): Document new feature: --bytes=-N and --lines=-N.
7906
7907         * tests/du/slink: Skip this test if `.' is on an XFS file system.
7908
7909         * tests/du/fd-leak: New file.  Test for the bug in du that
7910         was fixed by the 2003-05-12 change to lib/ftw.c.
7911         * tests/du/Makefile.am (TESTS): Add fd-leak.
7912
7913         * src/head.c (AUTHORS): Enclose string in N_(...), now that it
7914         includes a translatable word, `and'.
7915
7916         * src/dd.c (usage): Don't use `,' as the thousands separator
7917         in e.g. 1,000,000 and 1,048,576.  Instead, do this:
7918         `SIZE may be ..., MB 1000*1000, M 1024*1024 and so on...'
7919         * src/df.c (usage): Likewise.
7920         * src/du.c (usage): Likewise.
7921         * src/ls.c (usage): Likewise.
7922
7923         * Makefile.maint (syntax-check): Add another check.
7924
7925 2003-05-13  Paul Eggert  <eggert@twinsun.com>
7926
7927         Fix uniq to conform to POSIX, which requires that "uniq -d -u"
7928         must output nothing.  Problem reported by Josh Hyman.
7929
7930         * src/uniq.c (enum output_mode, mode): Remove, replacing with:
7931         (output_unique, output_first_repeated, output_later_repeated):
7932         New vars.  All uses of "mode" changed to use these variables,
7933         which are not mutually exclusive as "mode" was.
7934         (writeline): New arg "match", used to control whether to
7935         obey output_first_repeated or output_later_repeated.
7936         All callers changed.
7937         (check_file, main): Adjust to above changes.
7938
7939         * tests/uniq/Test.pm: Test that 'uniq -d -u' outputs nothing.
7940
7941 2003-05-14  Jim Meyering  <jim@meyering.net>
7942
7943         * tests/rm/rm3: Use tr's \n notation rather than \012.
7944         This package can afford to do that, since its tests are guaranteed use
7945         GNU tr, which has accepted the more modern notation for 10 years.
7946         * tests/rm/rm5: Likewise.
7947         * tests/cp/same-file: Likewise.
7948         * tests/stty/row-col-1: Likewise.
7949         * tests/stty/basic-1: Likewise.
7950         * tests/rm/deep-1: Likewise.
7951         * tests/mv/part-symlink: Likewise.
7952         * tests/mkdir/perm: Likewise.
7953         * tests/misc/nice: Likewise.
7954
7955 2003-05-13  Jim Meyering  <jim@meyering.net>
7956
7957         * src/copy.c (struct F_triple) [name]: Remove const attribute.
7958         (triple_free): Don't apply cast to argument of free.
7959         (seen_file): Add cast here instead.
7960
7961         * src/cp-hash.c (struct Src_to_dest) [name]: Remove const attribute.
7962         (src_to_dest_free): Don't apply cast to argument of free.
7963
7964         * src/sort.c (zaptemp): Don't apply cast to argument of free.
7965         * src/pr.c (init_fps, init_store_cols): Likewise.
7966         * src/join.c (delseq, freeline): Likewise.
7967         * src/expr.c (OLD): Likewise.
7968         * src/sort.c (sort): Likewise.
7969         * src/head.c (elide_tail_lines_pipe): Likewise.
7970
7971         * src/tail.c: Include "quote.h".
7972         Use quote in diagnostics.  Change many error format strings
7973         from just `%s' to e.g., `error reading %s'.
7974         (pipe_lines): Change type of parameter, n_lines, to uintmax_t.
7975         Rewrite newline-counting loop to use memchr.
7976
7977         * src/head.c (elide_tail_lines_pipe): Use `if', not assert.
7978         Now that assert is no longer used, don't include <assert.h>.
7979
7980 2003-05-12  Jim Meyering  <jim@meyering.net>
7981
7982         * src/head.c: Include <assert.h>.
7983         (AUTHORS): Add my name.
7984         (elide_tail_lines_pipe): New function.
7985
7986 2003-05-10  Jim Meyering  <jim@meyering.net>
7987
7988         * Makefile.maint (syntax-check): Check for `error (EXIT_SUCCESS,'.
7989
7990         * src/readlink.c (main): Set program_name before first use.
7991         Remove that (redundant) first use.
7992         Don't exit successfully just because --verbose was specified.
7993         Pass 0, not EXIT_SUCCESS, as first argument to error; when that
7994         parameter is 0, error does not exit.
7995
7996         * src/uname.c (main): When failing due to too many arguments, also say
7997         that, rather than just "Try `uname --help' for more information.".
7998         * src/comm.c (main): Likewise, but for too few arguments.
7999         * src/logname.c: Include error.h.
8000         (main): Say why we're failing.
8001
8002         * src/uniq.c (main): Don't segfault when argc < optind.
8003         * src/who.c (main): Handle argc < optind.
8004         * src/df.c (main): Likewise.
8005         * src/install.c (main): Likewise.
8006         * src/mv.c (main): Likewise.
8007         * src/pwd.c (main): Likewise.
8008         * src/tty.c (main): Likewise.
8009         * src/chroot.c (main): Likewise.
8010         * src/hostname.c: Likewise.
8011         * src/du.c (main): Likewise.
8012         * src/expand.c (main): Likewise.
8013         * src/env.c (main): Likewise.
8014         * src/unexpand.c (main): Likewise.
8015         * src/printenv.c (main): Likewise.
8016         * src/sync.c (main): Handle argc == 0.
8017         * src/expr.c (main): Likewise.
8018         * src/printf.c (main): Likewise.
8019         * src/basename.c (main): Likewise.
8020         * src/ln.c (main): Test for `missing argument' before computing n_files.
8021         * src/tail.c (main): Test for the case of no arguments before
8022         computing n_files.
8023
8024         * src/kill.c (send_signals): Don't check command line arguments here.
8025         (main): Check them here instead.  Handle argc < optind.
8026
8027         * src/logname.c (main): Use error, rather than fprintf, for the sake
8028         of consistency.
8029
8030         * src/rm.c (main): Don't overrun array bound if argc is 0.
8031
8032 2003-05-09  Jim Meyering  <jim@meyering.net>
8033
8034         * src/sort.c (main): Don't overrun array bound if argc is 0.
8035         That would happen when invoked via: execl ("/usr/bin/sort", NULL);
8036         Reported by Wartan Hachaturow.
8037
8038 2003-05-07  Jim Meyering  <jim@meyering.net>
8039
8040         Implement support so that `head --lines=-N' works on seekable files.
8041         * src/head.c (enum Copy_fd_status): Define.
8042         (COPY_FD_DIAGNOSE): New macro.
8043         (elide_tail_lines_seekable): New funtion.
8044         (elide_tail_lines_file): Call it here.
8045
8046 2003-05-06  Jim Meyering  <jim@meyering.net>
8047
8048         * src/sys2.h (CHAR_BIT): Remove duplicate definition.
8049
8050 2003-05-04  Jim Meyering  <jim@meyering.net>
8051
8052         * tests/head/Test.pm: Remove tests of --bytes=-N; using that framework
8053         caused the addition of thousands of small files to the tar archive.
8054         * tests/misc/head-elide-tail: New file.  Add them here instead.
8055         * tests/misc/Makefile.am (TESTS): Add head-elide-tail.
8056
8057 2003-05-04  Paul Eggert  <eggert@twinsun.com>
8058
8059         * src/remove.c (HAVE_WORKING_READDIR): Define to 0 if not defined.
8060         (IF_READDIR_NEEDS_REWINDDIR): Remove.
8061         (remove_cwd_entries): Rewrite to avoid IF_READDIR_NEEDS_REWINDDIR,
8062         which was a bit weird because it couldn't be emulated by a function.
8063
8064 2003-05-03  Jim Meyering  <jim@meyering.net>
8065
8066         Extend head to accept --lines=-N (--bytes=-N) and to print all
8067         but the N lines (bytes) at the end of the file.
8068         * src/head.c: Include full-write.h, full-read.h, inttostr.h, quote.h.
8069         Use quote() in diagnostics, rather than literal `' marks.
8070         (copy_fd, elide_tail_bytes_pipe, elide_tail_bytes_file):
8071         New functions.
8072         (elide_tail_lines_pipe, elide_tail_lines_file): New functions.
8073         (head_file): Reorganize so as to call head from only one place.
8074         (main): Likewise, for head_file.
8075         Handle new, undocumented option, --presume-input-pipe.
8076         Handle negative line and byte counts.
8077         * tests/head/Test.pm: Add lots of tests to exercise --bytes=-N.
8078
8079         * tests/du/8gb: Skip test if the file system of `.' doesn't support
8080         sparse files -- otherwise it'd create a file of size 8GB.
8081
8082 2003-05-02  Jim Meyering  <jim@meyering.net>
8083
8084         * src/fmt.c (usage): Don't mention obsolescent -WIDTH option.
8085         Instead explain about `-' and standard input.
8086         (main): Give a proper diagnostic for e.g., `fmt -c -72'.
8087         Reported by Keith Thompson.
8088         * tests/fmt/basic: Add test for the above fix.
8089
8090         * src/fmt.c: Include "quote.h".
8091         Use quote() in diagnostics, rather than literal `' marks.
8092         (main): Exit nonzero when unable to open an input file.
8093         * tests/fmt/basic: Add test for the above fix.
8094
8095         * src/fmt.c (main): Diagnose invalid suffix on obsolescent width
8096         specifications like `-72x'.
8097         * tests/fmt/basic: Add test for the above fix.
8098
8099         Work around nasty readdir bug on Darwin6.5.
8100         * src/remove.c (IF_READDIR_NEEDS_REWINDDIR): Define.
8101         [! HAVE_WORKING_READDIR] (remove_cwd_entries): If readdir has just
8102         returned NULL and there has been at least one successful unlink or
8103         rmdir call since the opendir or previous rewinddir, then call
8104         rewinddir and reiterate the loop.
8105
8106         Factor out common code.
8107         * src/remove.c (readdir_ignoring_dotdirs): New function.
8108         (is_empty_dir): Use it here.
8109         (remove_cwd_entries): Use it here.
8110
8111 2003-05-01  Jim Meyering  <jim@meyering.net>
8112
8113         * tests/rm/r-3: Create 500 rather than just 300 files.
8114         There's a bug in Darwin6.5's readdir that shows up only with
8115         338 or more files.
8116         Fix a bug in this test: `cd $pwd' (not to `..'), now that $tmp
8117         has two components.
8118
8119         * src/tail.c:
8120         Change type of n_units, n_bytes, n_lines to be `uintmax_t'.
8121         (dump_remainder): Move two declarations `down' into the scope
8122         where they are used.
8123         (xlseek): Return the resulting offset.
8124         (file_lines): Rename parameter, file_length, to end_pos.
8125         (pipe_lines): Don't coerce safe_read return value to `int'.
8126         Adapt tests accordingly.
8127         (pipe_bytes) [struct charbuffer] (nbytes): Change type from `int'
8128         to `unsigned int'.
8129         Change type of `total_bytes' from `int' to `size_t',
8130         since the former wouldn't always be wide enough.
8131         Don't coerce safe_read return value to `int',
8132         and adapt tests accordingly.
8133         Now that testing for a read error no longer involves
8134         using `tmp', handle that case *after* freeing `tmp'.
8135         (start_bytes): Clean up.
8136         (tail_bytes): Now that `n_bytes' may be larger than
8137         OFF_T_MAX, test for that condition and, if it's true, don't
8138         use lseek optimizations.
8139         (parse_options): Don't fail just because N_UNITS is larger than
8140         the maximum size of a file -- tail may be applied to an input
8141         stream (e.g., a pipe) with more data than that.
8142
8143         * Makefile.maint (syntax-check): Rename from alloc-check.
8144         Also check for SPACE-TAB sequences.
8145         Also check for malloc/calloc/realloc casts.
8146
8147 2003-05-01  Jim Meyering  <jim@meyering.net>
8148
8149         * src/tail.c (start_lines): Rewrite to use memchr.  Clean up.
8150
8151 2003-04-28  Jim Meyering  <jim@meyering.net>
8152
8153         * tests/misc/tty-eof: Send two tokens, not just one, so we don't
8154         make the now-more-picky tsort fail.
8155
8156 2003-04-24  Jim Meyering  <jim@meyering.net>
8157
8158         * src/tsort.c (tsort): Remove unnecessary test of have_read_stdin.
8159         (main): Minor syntactic clean-up.
8160
8161         * src/tsort.c (tsort): Fail if the input contains an odd number of
8162         tokens.  Reported by junkio@cox.net.
8163
8164         * tests/tsort/basic-1: Test for the above fix.
8165
8166 2003-04-21  Jim Meyering  <jim@meyering.net>
8167
8168         * tests/misc/printf: Add tests for the printf fixes below.
8169
8170         * Makefile.cfg (cvs_files): Add $(srcdir)/config/depcomp to the list.
8171
8172 2003-04-20  Paul Eggert  <eggert@twinsun.com>
8173
8174         Fix printf POSIX compatibility bug reported by Ben Harris in
8175         <http://mail.gnu.org/archive/html/bug-coreutils/2003-04/msg00070.html>.
8176         * doc/coreutils.texi (printf invocation): It's \NNN in the format,
8177         \0NNN in the %b operand.
8178         * src/printf.c (usage): Likewise.
8179         (print_esc): New arg OCTAL0 to specify whether \0NNN or \NNN
8180         is desired.  All uses changed.  Behave like Bash printf if %b
8181         operand uses \NNN where the initial N is not 0.
8182
8183 2003-04-17  Jim Meyering  <jim@meyering.net>
8184
8185         * src/stty.c: Remove uses of PROTOTYPE macro.
8186
8187 2003-04-15  Jim Meyering  <jim@meyering.net>
8188
8189         * Makefile.maint: Remove (or replace-with-TAB(s) to retain alignment)
8190         each sequence of spaces before a TAB character.
8191
8192 2003-04-13  Jim Meyering  <jim@meyering.net>
8193
8194         * src/remove.c (is_empty_dir): Don't closedir (NULL).
8195
8196 2003-04-12  Jim Meyering  <jim@meyering.net>
8197
8198         Giving nl an invalid STYLE argument (in --header-numbering=STYLE (-h),
8199         --body-numbering=STYLE (-b), or --footer-numbering=STYLE (-f)) or
8200         FORMAT (--number-format=FORMAT (-n)) would not give a useful diagnostic.
8201         * src/nl.c (main): Fix those problems and remove literal quote marks
8202         (e.g., "`%s'") from format string; instead use "%s" in each format
8203         string and `quote (optarg)' as the corresponding argument.
8204         Also, diagnose all invalid command line options before failing.
8205
8206         * src/nl.c (proc_text): Fix a bug that would make nl output extra
8207         newlines in some cases.  Details here: http://bugs.debian.org/177256.
8208         This bug was introduced on 2001-11-10 for textutils-2.0.17.
8209         * tests/misc/nl: Add test for the above-fixed bug.
8210
8211         * tests/misc/readlink: New file.  Test the --canonicalize option.
8212         * tests/misc/Makefile.am (TESTS): Add readlink.
8213
8214 2003-04-11  Jim Meyering  <jim@meyering.net>
8215
8216         Clean up.
8217         * src/chown.c, src/cp.c, src/dircolors.hin, src/du.c, src/ln.c:
8218         * src/mkfifo.c, src/ptx.c, src/spline.c, src/stty.c, src/tail.c:
8219         * src/test.c, src/unexpand.c: Remove (or replace-with-TAB(s) to
8220         retain alignment) each sequence of spaces before a TAB character.
8221
8222         * src/ls.c: Include <stdlib.h> unconditionally.
8223
8224         * Makefile.maint (xalloc-check): Rename from header-check.
8225
8226         * src/yes.c: Include error.h after system.h, not before.
8227
8228         Clean up.
8229         * src/copy.c, src/cp-hash.c, src/cp.c, src/csplit.c, src/cut.c:
8230         * src/date.c, src/df.c, src/du.c, src/expand.c, src/expr.c, src/id.c:
8231         * src/join.c, src/md5sum.c, src/nl.c, src/od.c, src/paste.c, src/pr.c:
8232         * src/ptx.c, src/sort.c, src/split.c, src/su.c, src/tail.c, src/tee.c:
8233         * src/tr.c: * src/unexpand.c, src/users.c:
8234         Remove anachronistic casts of xmalloc, xrealloc, and xcalloc
8235         return values and of xrealloc's first argument.
8236         Fix the former with this:
8237         perl -pi -e 's/\([^(]*?\*\) *(x(m|c|re)alloc)\b/$1/'
8238
8239 2003-04-10  Jim Meyering  <jim@meyering.net>
8240
8241         * src/stty.c (wrapf): Declare with format attribute.
8242
8243         The S_MAGIC_... names shouldn't be maintained in two places (prior
8244         to this change, one would have to keep stat.c and fs.h in sync).
8245         This change makes it so those names and the corresponding
8246         hexadecimal constants all reside in stat.c.  fs.h is now generated.
8247         * src/Makefile.am (fs.h): New rule to generate fs.h from stat.c.
8248         (BUILT_SOURCES): Add fs.h, now that it's generated.
8249         (EXTRA_DIST): Add extract-magic.
8250         * src/extract-magic: New script to extract fs.h definitions from stat.c.
8251         * src/stat.c (human_fstype) [__linux__]: Append each hex constant from
8252         fs.h in a comment after the corresponding `case S_MAGIC_...:' statement.
8253
8254         * tests/tail-2/big-4gb: Skip this test (don't fail) if creating a
8255         file with nominal length > 4GB fails.  Reported by Michael Deutschmann.
8256
8257         * man/unexpand.x: Add `SEE ALSO' reference to expand.
8258         * man/expand.x: Add `SEE ALSO' reference to unexpand.
8259         Suggestion from Dan Jacobson.
8260
8261 2003-04-10  Maciej W. Rozycki  <macro@ds2.pg.gda.pl>
8262
8263         * src/fs.h (S_MAGIC_DEVPTS): New magic for Linux's devpts.
8264         * src/stat.c (human_fstype): Handle Linux's devpts.
8265
8266 2003-04-09  Paul Eggert  <eggert@twinsun.com>
8267
8268         * src/split.c (line_bytes_split): Arg is of type size_t, since
8269         that's all that is supported for now.
8270         (main): Check for overflow in obsolescent line count option.
8271
8272 2003-04-09  Jim Meyering  <jim@meyering.net>
8273
8274         * tests/misc/split-fail: Add a new test for the above fix.
8275
8276         * src/split.c (bytes_split): Use size_t temporary (rather than
8277         uintmax_t original) in remaining computations.  From Paul Eggert.
8278
8279         Handle command line option arguments larger than 2^31.
8280         This allows e.g., splitting into files of size 2GB and larger,
8281         and running split --lines=N with N=2^31 or more.
8282         But for --line-bytes=N, the restriction that N <= SIZE_MAX
8283         remains (for now), due to the way it is implemented.
8284
8285         * src/split.c: Include "inttostr.h".
8286         (bytes_split, lines_split, line_bytes_split, main):
8287         Use uintmax_t, not size_t, for file sizes.
8288         (main): Give a better diagnostic for option arguments == 0.
8289         Use umaxtostr to print file sizes.
8290         Reported by Luke Hassell.
8291
8292 2003-04-08  Jim Meyering  <jim@meyering.net>
8293
8294         * src/rm.c (usage): Mention that --directory (-d) works only
8295         on some systems.  Suggestion from Samuel Tardieu.
8296
8297         * tests/basename/basic: Run $PERL to see if it is available,
8298         rather than testing its value.
8299         * tests/sum/sysv, tests/tsort/basic-1, tests/unexpand/basic-1:
8300         * tests/basename/basic, tests/dd/skip-seek, tests/dircolors/simple:
8301         * tests/expr/basic, tests/factor/basic, tests/fmt/basic:
8302         * tests/ls-2/tests, tests/md5sum/basic-1, tests/md5sum/newline-1:
8303         * tests/misc/sort, tests/misc/tty-eof, tests/mv/i-1:
8304         * tests/rm/empty-name, tests/rm/fail-eperm, tests/rm/unreadable:
8305         * tests/seq/basic, tests/sha1sum/basic-1, tests/sha1sum/sample-vec:
8306         * tests/sum/basic-1, tests/seq/basic: Likewise.
8307
8308         * tests/misc/Makefile.am (TESTS): Add split-fail.
8309         * tests/misc/split-fail: New file.
8310
8311         * src/split.c: Rename local variables: nchars -> n_bytes.
8312         (lines_split): Rename local, nlines -> n_lines.
8313         (main): Rename local variable: s/accum/n_units/.
8314         (main): Use STDIN_FILENO, not literal `0'.
8315
8316 2003-04-07  Jim Meyering  <jim@meyering.net>
8317
8318         * src/stat.c: Add #include directives for Ultrix 4.4.
8319         Based on a suggested change from Bert Deknuydt.
8320
8321 2003-04-06  Jim Meyering  <jim@meyering.net>
8322
8323         * Makefile.maint (makefile-check): New rule.
8324         (local-check): Add it.
8325
8326 2003-04-05  Jim Meyering  <jim@meyering.net>
8327
8328         * Makefile.am (nearly all of them):
8329         Use $(VAR) rather than @VAR@, now that we can rely on automake to
8330         emit a definition for each substituted variable.
8331         * tests/Makefile.am.in: Likewise.
8332
8333         * tests/rm/rm5: Add a comment explaining why this test fails when
8334         using Tru64's broken sed.
8335         * tests/rm/rm3: Likewise.
8336
8337         Make `kill -t' output signal descriptions (not `?') on Tru64.
8338         * src/kill.c (sys_siglist): Also check for __sys_siglist.
8339         Patch by Tony Leneis.
8340         * configure.ac: Also check for declaration of __sys_siglist.
8341         Required for Tru64 4.0D, 4.0F, and 5.1.
8342         Reported by Tony Leneis.
8343
8344 2003-04-04  Jim Meyering  <jim@meyering.net>
8345
8346         * src/Makefile.am (PERL): Remove unnecessary definition.
8347
8348         Because of inappropriate (but POSIX-mandated) behavior of rename,
8349         `mv a b' would not remove `a' in some unusual cases.  Work around
8350         this by unlinking `a' when necessary.
8351
8352         * src/copy.c (same_file_ok): Add an output parameter.
8353         Set it in the offending case.
8354         (copy_internal): When necessary, unlink SRC_PATH and inform caller.
8355         Reported by Ed Avis.
8356         * tests/mv/hard-4: New test for the above.
8357         * tests/mv/Makefile.am (TESTS): Add hard-4.
8358
8359         Clean up rules for automatically generated sources:
8360         * src/Makefile.am (dircolors.h, wheel-size.h, wheel.h, false.c):
8361         Make each generated file be read-only.
8362         Add each file name to BUILT_SOURCES separately.
8363         (MAINTAINERCLEANFILES): Set to $(BUILT_SOURCES).
8364
8365         Put LOCALEDIR macro definition in new file: localedir.h.
8366         * src/Makefile.am (DEFS): Remove definition.
8367         (localedir.h): New rule.
8368         (BUILT_SOURCES, DISTCLEANFILES): Add localedir.h.
8369         * src/system.h: Include "localedir.h".
8370
8371 2003-04-02  Jim Meyering  <jim@meyering.net>
8372
8373         * Version 5.0.
8374
8375         * tests/misc/Makefile.am (TESTS): Add false.
8376
8377         * Makefile.maint (TMPDIR): Make sure it's defined.
8378         (my-distcheck): Build in $(TMPDIR), not `.'.
8379
8380         * src/Makefile.am (false.c): Change all occurrences of
8381         `(EXIT_SUCCESS)' to `(EXIT_FAILURE)' so that false exits
8382         unsuccessfully also with --help.  Reported by Paul Jarc,
8383         * tests/misc/false: New test for the above.
8384
8385 2003-03-30  Jim Meyering  <jim@meyering.net>
8386
8387         * NEWS: Note the location of older NEWS files.
8388
8389         * src/remove.c (is_empty_dir): Don't let a failing closedir
8390         clobber errno.  Spotted by Arnold Robbins.
8391
8392         * src/env.c: Fix typo in comment.  From Arnold Robbins.
8393
8394 2003-03-29  Jim Meyering  <jim@meyering.net>
8395
8396         * Version 4.5.12.
8397
8398         * README: Note to expect build problems for stat.c on Ultrix 4.3.
8399         Note that there are some harmless test failures when running
8400         `make check' as root on some systems.
8401
8402 2003-03-28  Jim Meyering  <jim@meyering.net>
8403
8404         * tests/stty/row-col-1: Skip this test if stty can't get window size.
8405         This happens when connecting to sparc-solaris5.7 via ssh from within
8406         emacs.  Reported by Karl Berry.
8407
8408         * tests/du/basic: Use seq, not `yes' to generate 4KB of data.
8409         Otherwise, on systems (DJGPP) that emulate pipes using files,
8410         this test would never complete, waiting for `yes' to terminate.
8411         * tests/du/slink: As above, use seq, not `yes' to generate link target.
8412         * tests/rm/hash: As above, use seq, not `yes' to generate dir name.
8413         Reported by Rich Dawe.
8414
8415 2003-03-27  Jim Meyering  <jim@meyering.net>
8416
8417         * src/id.c: Remove Arnold Robbins' obsolete e-mail address
8418         from `written by...' comment, at his request.
8419
8420 2003-03-24  Paul Eggert  <eggert@twinsun.com>
8421
8422         Fix buffer overrun problem reported by TAKAI Kousuke, along
8423         with some other POSIX incompatibilities.
8424
8425         * src/printf.c (print_esc): Do not treat \x specially if
8426         POSIXLY_CORRECT.  Avoid buffer overrun if the format ends
8427         in backslash.  Treat incomplete escape sequences as strings
8428         of characters, as POSIX requires.
8429         (print_formatted): Allow multiple flags.  Avoid buffer overrun
8430         if the format is incomplete.
8431
8432 2003-03-24  Jim Meyering  <jim@meyering.net>
8433
8434         * tests/misc/printf: Add tests for the above fixes and changes.
8435
8436 2003-03-26  Jim Meyering  <jim@meyering.net>
8437
8438         * src/copy.h (struct cp_options): Add a comment.
8439
8440 2003-03-23  Jim Meyering  <jim@meyering.net>
8441
8442         * README: Describe problem with 64-bit mode on HPUX 11.x,
8443         with patch for /usr/include/inttypes.h.
8444         * TODO: Plan to add an autoconf test to work around the bug.
8445
8446 2003-03-22  Jim Meyering  <jim@meyering.net>
8447
8448         * src/stat.c: Don't include <sys/sysmacros.h>.
8449         That is already done via system.h.  Otherwise, the multiple
8450         inclusion would evoke redefinition warnings from Cray's /bin/cc,
8451         aka Cray Standard C Version 4.0.3  (057126) Mar 22 2003  22:02:28.
8452         (human_fstype): Factor some directives `up', out of this function.
8453         Cast away `const' to avoid error from Cray's /bin/cc.
8454
8455 2003-03-20  Jim Meyering  <jim@meyering.net>
8456
8457         * announce-gen (print_changelog_deltas): Ensure that a newline
8458         precedes each row of `*'s.
8459
8460 2003-03-20  Jim Meyering  <jim@meyering.net>
8461
8462         * Version 4.5.11.
8463
8464         * src/seq.c (valid_format): Also accept ` ' and `'' as valid
8465         format flag characters.
8466         Do not require that a field width be specified.
8467         Do not fail when given a field width of `0'.
8468         Reported by Dan Jacobson.
8469         * tests/seq/basic: Add new tests for the above-fixed bug.
8470
8471         * src/Makefile.am (all-local): Append $(EXEEXT) to use of `su'
8472         (install-root): Likewise.
8473         (install-exec-local): Likewise.
8474         Based on a patch from Richard Dawe.
8475
8476 2003-03-19  Jim Meyering  <jim@meyering.net>
8477
8478         * man/Makefile.am (.x.1): Use $(LN_S) instead of 'ln -s',
8479         because the DJGPP 2.03 port of 'ln -s' doesn't work.
8480         Include $(EXEEXT) in program names.
8481         Since $(LN_S) may degenerate to `cp -p', be careful
8482         to invoke it from the destination directory.
8483         Mostly from Richard Dawe.
8484         * configure.ac: Use AC_PROG_LN_S.
8485
8486         * tests/mv/part-symlink: Unset CDPATH.  Otherwise, having the
8487         CDPATH shell variable set could cause this test to fail.
8488         Reported by Karl Berry.
8489
8490 2003-03-18  Jim Meyering  <jim@meyering.net>
8491
8492         * src/fmt.c [struct Word] (paren, period, punct, final): Change the
8493         type of each member from bool <MEMBER>:1 to unsigned int <MEMBER>:1.
8494         AIX 5.1's xlc could not compile the former.
8495         Patch by Petter Reinholdtsen.  Also reported by Mike Jetzer.
8496
8497 2003-03-17  Richard Dawe  <rich@phekda.freeserve.co.uk>
8498
8499         * configure.ac: Include $(EXEEXT) in OPTIONAL_BIN_PROGS'
8500         program names, since automake only adds $(EXEEXT) to programs
8501         in its *_PROGRAMS.
8502
8503 2003-03-16  Jim Meyering  <jim@meyering.net>
8504
8505         * src/remove.c (rm): Put two local variables in static storage,
8506         so they can't be clobbered by the potential longjmp.
8507
8508 2003-03-15  Jim Meyering  <jim@meyering.net>
8509
8510         * Makefile.cfg (gnu_rel_host): Fix code to match the comment
8511         so that a version number with a two-digit component can still count
8512         as an alpha release.  Reported by Richard A Downing.
8513         (gnu_rel_host): Define in terms of $(RELEASE_TYPE) instead.
8514
8515 2003-03-14  Jim Meyering  <jim@meyering.net>
8516
8517         * src/ansi2knr.c: Remove no-longer-used file.
8518         * src/ansi2knr.1: Likewise.
8519
8520         * Makefile.maint (prev_version_file): Don't use ?= for this particular
8521         assignment, since it causes trouble with old versions of GNU make
8522         (e.g. 3.76.1).  The other uses of `?=' are inoffensive.  Details here.
8523         http://mail.gnu.org/archive/html/bug-coreutils/2003-03/msg00028.html
8524         Patch from Alexandre Duret-Lutz.
8525
8526         * Use patched automake-1.7.3.  Regenerate Makefile.in files in
8527         subdirectories so that each includes a definition of ACLOCAL_M4.
8528
8529         * announce-gen (main): Label the compressed source URLs.
8530
8531         * Version 4.5.10.
8532
8533         * tests/du/slink: Relax the test for the `local'ness of a file system,
8534         so that now it works also for tmpfs.
8535
8536         * tests/du/hard-link: Transform output from first du, so that this
8537         test doesn't fail on file systems like tmpfs that order directory
8538         entries differently.
8539
8540 2003-03-13  Jim Meyering  <jim@meyering.net>
8541
8542         * tests/du/8gb: Work around what appears to be an NFS failure that
8543         would make this test fail on some systems.
8544
8545 2003-03-11  Jim Meyering  <jim@meyering.net>
8546
8547         * tests/du/basic: Make the test file exactly 4k bytes long.
8548
8549         * src/split.c (longopts): Don't hard-code `2' here.
8550         Instead, just specify `&verbose', and ...
8551         (main): ... remove the `case 2:' block for --verbose.
8552
8553         * tests/du/basic: Make the test file larger than 64 bytes, so that
8554         we don't immediately disqualify file systems (e.g., NetApp) on which
8555         smaller files take up zero disk blocks.  Reported by Vin Shelton.
8556
8557 2003-03-10  Jim Meyering  <jim@meyering.net>
8558
8559         Don't segfault for a negative field width or precision in format string.
8560         Note that this is just a stopgap fix.  The longer term solution may
8561         involve adapting bash's builtins/printf.def.
8562
8563         * src/printf.c: (UNSPECIFIED): Define.
8564         (print_direc): Use the special value, UNSPECIFIED, to indicate
8565         that field_width or precision has not been specified.
8566         (print_formatted): Fail if field_width or precision is the
8567         special value, UNSPECIFIED.
8568         Reported by Oliver Kiddle <okiddle@yahoo.co.uk>
8569
8570         * src/sys2.h (INT_MIN): Define, if necessary.
8571         * tests/misc/printf: Add a test for the above-fixed bug.
8572
8573 2003-03-09  Jim Meyering  <jim@meyering.net>
8574
8575         * src/remove.c (AD_stack_pop): Cast sizeof... to int before
8576         changing its sign.  This avoids a warning from gcc on 64-bit systems.
8577         Reported by Bob Proulx.
8578         (pop_dir): Reverse order of sign change and cast, to be consistent
8579         with the above.
8580
8581 2003-03-08  Jim Meyering  <jim@meyering.net>
8582
8583         * tests/Makefile.am (evar-check): Check for POSIXLY_CORRECT not as a
8584         shell variable, but only in the environment.  With /bin/sh->bash, the
8585         shell variable is set to `y', and that would cause a spurious warning.
8586         Reported by Bob Proulx.
8587
8588         * tests/Makefile.am (check-root): Remove touch/fifo.
8589         It doesn't appear to have to be run as root.
8590
8591         * tests/rm/fail-2eperm: Rather than simply using the first non-root
8592         user name, make sure that the selected user name has a usable shell.
8593         Reported by Paul Jarc.
8594
8595         Before, when using shred on a device, one had to specify --exact,
8596         or be careful to choose a size that would not be rounded up and
8597         exceed the maximum value;  that could result in a failure of
8598         the final write.
8599         * src/shred.c (do_wipefd): --exact is now the default for non-regular
8600         files.  Suggestion from Ben Elliston.
8601         (usage): Say it.
8602
8603         * tests/misc/tty-eof: Require at least version 1.11 of Expect.pm.
8604         Old versions of Expect.pm (e.g., 1.07) lack the log_user function.
8605         Patch by Bob Proulx.
8606
8607         * src/Makefile.am (check-misc): Check for use of `defined' in
8608         #define directives.
8609         Change to $(srcdir) before running grep.
8610
8611         * src/sleep.c: Remove now-unused #include and #define directives.
8612
8613         * src/du.c (process_file): If a file's size is not being counted
8614         e.g., because it's a hard link to a file we've already counted,
8615         then don't print a line for it.
8616
8617         * tests/du/hard-link: New test for the above-fixed bug.
8618         * tests/du/Makefile.am (TESTS): Add hard-link.
8619
8620         `du -S' didn't work
8621         * src/du.c: Revert most of the `reorganization' change of 2003-02-20,
8622         and make the two-array approach work.
8623
8624         * tests/du/basic: Correct/add tests for the above fix.
8625         Set LC_ALL, etc., now that we use sort.
8626         Check the block/size of a small file, too.
8627         Correct expected results for simple dir1/dir2/file case.
8628         Add another test of du -S.
8629
8630 2003-03-07  John David Anglin  <dave.anglin@nrc-cnrc.gc.ca>
8631
8632         Avoid build failure with gcc on hppa1.1-hp-hpux10.20 (see GCC PR
8633         middle-end/9986).  As one of GCC's optimizations, it transforms a
8634         fputs_unlocked call to a fputc_unlocked call when the string is
8635         one character long.  However, hpux doesn't have fputc_unlocked.
8636
8637         * expr.c (usage): Use putchar, not fputs, to output a single character.
8638         * ls.c (dired_dump_obstack): Likewise.
8639         * ptx.c (output_one_tex_line, output_one_dumb_line): Likewise.
8640         * stat.c (print_it): Likewise.
8641
8642 2003-03-07  Jim Meyering  <jim@meyering.net>
8643
8644         * src/cp.c: Remove everything associated with mmap-stack.c.
8645         This reverts the two changes of 2003-02-21.
8646         * src/du.c: Remove everything associated with mmap-stack.c.
8647         This reverts the change of 2003-02-19.
8648
8649 2003-03-06  Jim Meyering  <jim@meyering.net>
8650
8651         * tests/cp/same-file: Unset CDPATH.  Otherwise, having the
8652         CDPATH shell variable set could cause this test to fail.
8653         Reported by Karl Berry.
8654
8655 2003-03-05  Jim Meyering  <jim@meyering.net>
8656
8657         * Version 4.5.9.
8658
8659         * src/printf.c (print_esc): Remove pointless comparison of unsigned
8660         integer with zero, to avoid a warning from Intel's ecc.
8661         Reported by Nelson Beebe.
8662
8663         * src/du.c (process_file): Sizes must all be of type uintmax_t.
8664         Otherwise, for files or totals that are too big, numbers would
8665         be truncated.  Patch mostly by Michael Stone.
8666         Reported by Ingo Saitz as Debian bug #183210.
8667
8668         * tests/du/8gb: New test for the above-fixed bug.
8669         * tests/du/Makefile.am (TESTS): Add 8gb.
8670
8671         * src/du.c (MAX_N_DESCRIPTORS): Use 3 * UTILS_OPEN_MAX / 4
8672         rather than UTILS_OPEN_MAX - 10.
8673
8674 2003-03-04  Jim Meyering  <jim@meyering.net>
8675
8676         * README: Refer new feature discussion to bug-coreutils@gnu.org,
8677         rather than bug-gnu-utils, now that the former is better known.
8678         Suggestion from Göran Uddeborg.
8679
8680         * src/stat.c (usage): Capitalize consistently.
8681         Reported by Göran Uddeborg.
8682
8683         * Makefile.maint (rel-files): Include $(signatures), so that
8684         those files are also copied into $(release_archive_dir).
8685
8686         * src/df.c (find_mount_point): Call error here, now that restore_cwd
8687         no longer does it.
8688         * src/remove.c (AD_pop_and_chdir): Likewise.
8689
8690         * tests/Makefile.am (check-root): Add fail-2eperm.
8691
8692 2003-03-03  Jim Meyering  <jim@meyering.net>
8693
8694         * src/remove.c (remove_cwd_entries): Include the full filename of
8695         the offending file, not just the basename.
8696
8697         * tests/misc/tty-eof: Set $ME properly.
8698
8699         * Makefile.maint (THIS_VERSION_REGEXP, PREV_VERSION_REGEXP):
8700         Remove now-unused variables.
8701         (tag-prev-version, prev-cvs-tag): Likewise.
8702
8703         * src/remove.c (remove_cwd_entries) [!ROOT_CAN_UNLINK_DIRS]: Give an
8704         accurate diagnostic when failing to remove a file owned by some other
8705         user.  Reported by Ivo Timmermans via Michael Stone.
8706         This fixes Debian bug# 178471.
8707
8708         * tests/rm/Makefile.am (TESTS): Add fail-2eperm.
8709         * tests/rm/fail-2eperm: New test, for the above-fixed bug.
8710         Based on a report from Ivo Timmermans.
8711
8712 2003-03-02  Jim Meyering  <jim@meyering.net>
8713
8714         * src/copy.c (copy_internal) [un_backup]: When recovering from a
8715         failure to create a hard link, do not remove the entry associating
8716         the source dev/ino with the destination file name.
8717         * tests/mv/Makefile.am (TESTS): Add hard-3.
8718         * tests/mv/hard-3: New test, for the above-fixed bug.
8719         Inspired by a report from Iida Yosiaki.
8720
8721 2003-03-01  Jim Meyering  <jim@meyering.net>
8722
8723         * src/df.c (print_header): Don't embed spaces in a separate `Type'
8724         header string.  Instead, put `Filesystem' and `Type' headers in the
8725         same string, so translators can use horizontal space as needed.
8726         Reported by Jean Charles Delepine.
8727
8728 2003-02-28  Jim Meyering  <jim@meyering.net>
8729
8730         * src/copy.c (copy_internal): When link fails because of an
8731         existing destination file, unlink that file and try again.
8732         Reported by Iida Yosiaki.
8733
8734         * tests/mv/Makefile.am (TESTS): Add hard-2.
8735         * tests/mv/hard-2: New test for the above-fixed bug.
8736         Based on a test case from Iida Yosiaki.
8737
8738 2003-02-26  Jim Meyering  <jim@meyering.net>
8739
8740         * tests/du/basic: Don't test du's -b option here.  Directory byte
8741         counts are smaller (512 rather than 4096) on at least OSF/1 5.1
8742         and IBM AIX 4.2.  Reported by Nelson Beebe.
8743
8744 2003-02-25  Jim Meyering  <jim@meyering.net>
8745
8746         * Makefile.maint (announcement): Now that ChangeLog entries
8747         are output by announce-gen, don't do it here.
8748         * announce-gen (print_changelog_deltas): New function.
8749         (main): Use it.
8750
8751 2003-02-22  Jim Meyering  <jim@meyering.net>
8752
8753         * announce-gen: New option: --release-type=TYPE
8754         * Makefile.maint (beta, major): New targets.  Remove `release'.
8755         Put them all together on a line.
8756         Pass the release type (via RELEASE_TYPE envvar) to the MAKE
8757         invocation of `announcement'.
8758         (announcement): Invoke announce-gen with --release-type=$RELEASE_TYPE.
8759
8760         * announce-gen: New option: --news=NEWS_FILE.
8761         Extract NEWS entries here, not via rules in Makefile.maint.
8762         * Makefile.maint (announcement): Now that NEWS entries are
8763         extracted by announce-gen, don't do it here.
8764         (news-r1, news-r2): Remove now-unused definitions.
8765
8766 2003-02-21  Jim Meyering  <jim@meyering.net>
8767
8768         * Version 4.5.8.
8769
8770         Merge in changes from autoconf's version of this file.
8771         * Makefile.maint (www-gnu): Define.
8772         (standards.texi-url_prefix): Use $(www-gnu).
8773         (make-stds.texi-url_prefix): Likewise.
8774
8775         * src/cp.c: Include "mmap-stack.h".
8776         (main): Invoke `run' through a macro that (when possible) runs it
8777         with a large, mmap'd stack.
8778
8779         * src/cp.c (run): New function, preparing for the above.
8780         Exit from this function, not from main
8781         (main): Call run.
8782
8783         * src/du.c: New option: --apparent-size.
8784         (enum) [APPARENT_SIZE_OPTION]: New member.
8785         (long_options): Add it.
8786         (usage): Describe it.
8787         (main): Handle it.
8788         ['b']: Set apparent_size.
8789         David Eisner reported that the behavior of --bytes had changed.
8790         Paul Eggert proposed the use of a new option, --apparent-size.
8791
8792         * src/du.c (apparent_size): New global.
8793         (print_only_size): Reflect the fact that we're printing byte counts,
8794         not ST_NBLOCKSIZE-byte-block counts.
8795         (print_size): Call print_only_size rather than duplicating its code.
8796         (process_file): Accumulate byte counts, rather than block counts.
8797
8798         * src/du.c (process_file): Always reset size_to_propagate_to_parent
8799         for --separate-dirs (-S).
8800
8801 2003-02-20  Jim Meyering  <jim@meyering.net>
8802
8803         * Use automake-1.7.3.  Regenerate dependent files.
8804
8805         * src/stat.c (print_stat): New format: %B (to print ST_NBLOCKSIZE).
8806         This makes %b (number of ST_NBLOCKSIZE-byte blocks) more useful.
8807         (usage) [%B]: Describe it.
8808         [%b]: Refer to %B.
8809
8810         * src/du.c (process_file): Reorganize the code to use only
8811         one `sum' array, and change how -S works back to the way it was
8812         before 2003-01-31.  Patch by Bruno Haible.
8813
8814         * tests/du/basic: New test.
8815         * tests/du/Makefile.am (TESTS): Add basic.
8816
8817         * tests/envvar-check: Add checks for the following:
8818         BLOCK_SIZE, DU_BLOCK_SIZE, DF_BLOCK_SIZE, LS_BLOCK_SIZE.
8819
8820         * tests/Makefile.am: Rename phony target envvar-check to evar-check
8821         so as not to conflict with the distributed file by the same name.
8822
8823         * src/du.c (process_file): Set info->skip before any possible return.
8824
8825         Report correct usage for directories, not 0.
8826         * src/du.c (process_file): Return for `file_type == FTW_DPRE'
8827         _before_ recording the dev/ino of a directory.
8828         Reported by Bruno Haible.
8829
8830         Now, df always displays the device file name corresponding to the
8831         listed mount point under `Filesystem'.  Before, for an unmounted
8832         block- or character-special file argument, it would display the
8833         command-line argument instead.
8834         * src/df.c (show_disk): Return a value indicating whether
8835         there was a match.  Don't try to find a mount point here.
8836         (show_entry): If show_disk doesn't find a match, call show_point.
8837
8838 2003-02-19  Jim Meyering  <jim@meyering.net>
8839
8840         * src/du.c: Include "mmap-stack.h".
8841         (du_files): Add prototype with ATTRIBUTE_NORETURN.
8842         Exit from this function, not from...
8843         (main): ...here.
8844         Instead, if possible, invoke du_files through a macro that
8845         runs it with a large, mmap'd stack.
8846
8847         * src/join.c (usage): Change wording in --help output:
8848         use FILENUM instead of `SIDE' and say what FILENUM means.
8849         Reported by Bernhard Gabler.
8850
8851         * src/df.c (print_header): Rather than using a hard-coded literal
8852         string of spaces matching the length of the English `...Type' header,
8853         output the right number of spaces to match the selected translation.
8854         Reported by Yann Dirson and Jean Charles Delepine as Debian bug 131113.
8855
8856         * src/split.c (bytes_split): Remove unnecessary `else' after break.
8857         (lines_split): Likewise.  and correct misleading indentation.
8858
8859         * src/split.c: Include "full-read.h".
8860         (bytes_split, lines_split, line_bytes_split): Use full_read,
8861         not safe_read.   The way split was using the latter, a short read
8862         could cause split to terminate before EOF.
8863
8864         * tests/misc/tty-eof: Test all programs that can read stdin,
8865         requiring no arguments and that write to standard output.
8866
8867         * tests/misc/tty-eof: New file.  Renamed from ...
8868         * tests/misc/cat-tty-eof: Remove file.  Rename to tty-eof.
8869         * tests/misc/Makefile.am (TESTS): Reflect renaming.
8870
8871 2003-02-18  Jim Meyering  <jim@meyering.net>
8872
8873         cksum would perform an extra read after encountering EOF
8874         * src/cksum.c (cksum): Exit the loop upon EOF, too.
8875         Patch by Michael Bacarella.
8876
8877         Test for the bug fixed today in cksum, md5sum, and sha1sum.
8878         * tests/misc/cat-tty-eof: Generalize, clean-up, and test for
8879         cat, cksum, md5sum, and sha1sum all in the same loop.
8880
8881 2003-02-14  Jim Meyering  <jim@meyering.net>
8882
8883         * src/remove.c: Include "euidaccess.h".
8884         Remove declaration of euidaccess.
8885
8886 2003-02-12  Jim Meyering  <jim@meyering.net>
8887
8888         * src/pathchk.c (portable_chars_only): Remove unnecessary `const'
8889         in cast to avoid warning from icc.  Reported by Alexandre Duret-Lutz.
8890
8891 2003-02-10  Jim Meyering  <jim@meyering.net>
8892
8893         * src/test.c: Don't include group-member.h.
8894         Include euidaccess.h.
8895         (eaccess): Rewrite function to set the real uid and gid temporarily
8896         to the effective uid and gid, then invoke 'access', and then set the
8897         real uid and gid back.  On systems that lack setreuid or setregid,
8898         fall back on the kludges in euidaccess.  Before, it would not work
8899         for e.g., files with ACLs, files that were marked immutable,
8900         or on file systems mounted read-only.  Nelson Beebe raised the issue.
8901         Paul Eggert suggested the new implementation.
8902
8903 2003-02-09  Jim Meyering  <jim@meyering.net>
8904
8905         * src/test.c (test_stat): Remove function.  It's job is done (only
8906         when necessary) by the wrapper in lib/stat.c.  Adjust all uses.
8907
8908 2003-02-08  Jim Meyering  <jim@meyering.net>
8909
8910         * Version 4.5.7.
8911
8912         * tests/mv/part-symlink: Don't assume that the file owner username
8913         length is less than 9 in ls output: instead, omit that field
8914         altogether.  Reported by, and suggested fix from, Ferdinand.
8915
8916         * tests/du/restore-wd: New test for just-fixed bug in ftw.c.
8917         * tests/du/Makefile.am (TESTS): Add restore-wd.
8918
8919         * src/rm.c: Correct now-invalid comment about cycle-detection.
8920
8921 2003-02-06  Jim Meyering  <jim@meyering.net>
8922
8923         * NEWS: Add entries from old/*/NEWS
8924         from fileutils-4.1 through 4.1.11 and
8925         from sh-utils-2.0 through 2.0.15.  Suggestion from Karl Berry.
8926
8927         * Version 4.5.6.
8928
8929         * src/du.c (process_file): Don't return early for excluded files
8930         or for files whose dev/inode we've already seen.
8931
8932 2003-02-05  Jim Meyering  <jim@meyering.net>
8933
8934         * tests/du/exclude: New file.
8935         * tests/du/Makefile.am (TESTS): Add exclude.
8936
8937 2003-02-04  Dmitry V. Levin  <ldv@altlinux.org>
8938
8939         * src/who.c (print_boottime, print_deadprocs, print_runlevel):
8940         Fix memory allocation arithmetic.
8941
8942 2003-02-04  Jim Meyering  <jim@meyering.net>
8943
8944         `df /dev/block-or-char-device-file--not-mounted' now reports
8945         the name of the file system on which the file resides, usually `/'.
8946         Before, it would leave the `Mounted on' field blank.
8947         * src/df.c (show_disk): Move function to precede find_mount_point.
8948         (show_disk): Add parameter: STATP.
8949         If we don't find a matching device name, then resort to calling
8950         find_mount_point.  Reported by Bob Proulx.
8951
8952 2003-02-03  Andreas Schwab  <schwab@suse.de>
8953
8954         * tests/rm/cycle: Require non-root.
8955         * tests/rm/isatty: Likewise.
8956
8957 2003-02-02  Jim Meyering  <jim@meyering.net>
8958
8959         * Version 4.5.5.
8960
8961         * man/Makefile.am (check-x-vs-1): Use @PATH_SEPARATOR@, not `:'.
8962
8963         Ensure that there are no offending uses of `:'.
8964         * Makefile.maint (makefile_path_separator_check): New rule.
8965         (local-check): Add it to the list.
8966
8967 2003-02-01  Jim Meyering  <jim@meyering.net>
8968
8969         * src/du.c (MAX_N_DESCRIPTORS): Define.
8970
8971         * src/stat.c (G_fail): New global.
8972         (human_time): Diagnose failed localtime, not failed nstrftime.
8973         (main): Fail if G_fail is set.
8974
8975 2003-01-31  Richard Dawe  <rich@phekda.freeserve.co.uk>
8976
8977         * tests/basename/Makefile.am: Use @PATH_SEPARATOR@ instead of
8978         hard-coding the path-separator.  Also double-quote the new PATH,
8979         to avoid problems when the path-separator is a semi-colon or when
8980         `pwd` contains e.g. a space.
8981         * tests/chgrp/Makefile.am: Likewise.
8982         * tests/chmod/Makefile.am: Likewise.
8983         * tests/chown/Makefile.am: Likewise.
8984         * tests/cp/Makefile.am: Likewise.
8985         * tests/dd/Makefile.am: Likewise.
8986         * tests/dircolors/Makefile.am: Likewise.
8987         * tests/du/Makefile.am: Likewise.
8988         * tests/expr/Makefile.am: Likewise.
8989         * tests/factor/Makefile.am: Likewise.
8990         * tests/fmt/Makefile.am: Likewise.
8991         * tests/install/Makefile.am: Likewise.
8992         * tests/ln/Makefile.am: Likewise.
8993         * tests/ls/Makefile.am: Likewise.
8994         * tests/ls-2/Makefile.am: Likewise.
8995         * tests/md5sum/Makefile.am: Likewise.
8996         * tests/misc/Makefile.am: Likewise.
8997         * tests/mkdir/Makefile.am: Likewise.
8998         * tests/mv/Makefile.am: Likewise.
8999         * tests/od/Makefile.am: Likewise.
9000         * tests/rm/Makefile.am: Likewise.
9001         * tests/rmdir/Makefile.am: Likewise.
9002         * tests/seq/Makefile.am: Likewise.
9003         * tests/sha1sum/Makefile.am: Likewise.
9004         * tests/shred/Makefile.am: Likewise.
9005         * tests/stty/Makefile.am: Likewise.
9006         * tests/sum/Makefile.am: Likewise.
9007         * tests/tail-2/Makefile.am: Likewise.
9008         * tests/touch/Makefile.am: Likewise.
9009         * tests/tsort/Makefile.am: Likewise.
9010         * tests/unexpand/Makefile.am: Likewise.
9011
9012 2003-01-31  Jim Meyering  <jim@meyering.net>
9013
9014         * src/stat.c: Include "file-type.h"
9015         (print_human_type): Remove function.
9016         (human_access): Rename from print_human_access.  Return a string.
9017         (human_time): Rename from print_human_time.  Return a string.
9018         (print_stat): Arrange so that field width and an alignment specifier
9019         are honored for the %A, %F, %x, %y, and %z formats.
9020         [%F]: Use file_type; this gives slightly different file type strings,
9021         e.g., `directory' instead of `Directory' and `regular file' or
9022         `regular empty file' instead of `Regular file'.
9023         Prompted by a report from Richard Dawe that the uses of
9024         S_IFSOCK and S_IFIFO in print_human_time were not portable
9025         to systems using e.g., DJGPP.
9026
9027 2003-01-31  Richard Dawe  <rich@phekda.freeserve.co.uk>
9028
9029         * src/stat.c (print_stat): Use S_ISLNK rather than an explicit
9030         test using S_IFMT and S_IFLNK.  S_IFLNK may not be defined.
9031
9032 2003-01-31  Jim Meyering  <jim@meyering.net>
9033
9034         * src/du.c (main): Upon processing an invalid option or an invalid
9035         --exclude-from or --max-depth option argument, don't exit right away,
9036         in case there are others.  Rather record the failure and exit after
9037         processing other options.
9038
9039         * GNUmakefile (TAR_OPTIONS): Set and export, in order to make
9040         tar archive easier to reproduce.
9041
9042         Rewrite to perform directory traversal using nftw.
9043
9044         * src/du.c: Include "dirname.h", "ftw.h", and "quotearg.h".
9045         (AUTHORS): Add self.
9046         (opt_one_file_system): Move global into `main'.
9047         (path, xstat, exit_status): Remove declarations.
9048         (arg_length, suffix_length): New globals.
9049         (G_fail): New global, sort of like the old `exit_status'.
9050         (IS_FTW_DIR_TYPE): Define.
9051         (print_only_size): New function.
9052         (process_file): New function.
9053         (str_init, ensure_space, str_copyc, str_concatc): Remove functions.
9054         (str_trunc, pop_dir, count_entry): Likewise.
9055         (du_files): Rewrite to use nftw.
9056
9057 2003-01-30  Jim Meyering  <jim@meyering.net>
9058
9059         * tests/du/trailing-slash: Ensure that du/ftw follows a command-line
9060         symlink-to-directory with -L, even without the trailing slash.
9061
9062 2003-01-27  Jim Meyering  <jim@meyering.net>
9063
9064         * src/Makefile.am (check-misc): Check for st_blocks, too.
9065
9066         * src/stat.c (print_stat): Use ST_NBLOCKS rather than `->st_blocks'.
9067         Reported by Richard Dawe.
9068
9069 2003-01-27  Andreas Schwab  <schwab@suse.de>
9070
9071         * src/ls.c (quote_name): Add fourth parameter, width, into which to
9072         store the screen columns, and return the number of bytes instead.
9073         (print_dir): Pass NULL as fourth parameter of quote_name.
9074         (print_name_with_quoting): Likewise.
9075         (length_of_file_name_and_frills): Get the width from the fourth
9076         parameter of quote_name instead of return value.
9077
9078 2003-01-27  Jim Meyering  <jim@meyering.net>
9079
9080         * src/ls.c (decode_switches): If `dired' is set without
9081         `format == long_format', then silently reset dired.  This doesn't
9082         change the behavior of ls (all prior uses of dired were protected
9083         by `&& format == long_format'), and lets us...
9084         (DIRED_INDENT): ... remove the `format == long_format' conjunct.
9085         (PUSH_CURRENT_DIRED_POS): Likewise.
9086         (main): Likewise.
9087
9088 2003-01-22  Jim Meyering  <jim@meyering.net>
9089
9090         * tests/du/no-x: New test, for functionality added to lib/ftw.c.
9091         * tests/du/Makefile.am (TESTS): Add no-x.
9092
9093 2003-01-21  Jim Meyering  <jim@meyering.net>
9094
9095         * src/remove.c (remove_entry) [ROOT_CAN_UNLINK_DIRS
9096         && HAVE_STRUCT_DIRENT_D_TYPE]: If a file has d_type == DT_UNKNOWN
9097         it may still be a directory -- or not (e.g., with FreeBSD on an
9098         NFS-mounted file system), so resort to calling lstat to find out.
9099         Based on a patch by Michael van Elst.
9100
9101         * tests/cp/same-file: Don't assume that the file owner username
9102         length is less than 9 in ls output: instead, omit that field
9103         altogether.  Reported by, and suggested fix from, Ferdinand.
9104
9105 2003-01-20  Jim Meyering  <jim@meyering.net>
9106
9107         * tests/date/Test.pm (wide-fmt): New test to demonstrate that
9108         large format widths no longer cause strftime to infloop.
9109
9110         * Makefile.maint (mail_gpg_sign_cookie): Remove now-unused definition.
9111
9112 2003-01-19  Jim Meyering  <jim@meyering.net>
9113
9114         * src/readlink.c: Include "canonicalize.h".
9115
9116 2003-01-18  Jim Meyering  <jim@meyering.net>
9117
9118         * src/ls.c (Dereference_symlink) [DEREF_COMMAND_LINE_SYMLINK_TO_DIR]:
9119         New member.
9120         (enum) [DEREFERENCE_COMMAND_LINE_SYMLINK_TO_DIR_OPTION]: New member.
9121         (long_options): Add option --dereference-command-line-symlink-to-dir.
9122         (main): Make DEREF_COMMAND_LINE_SYMLINK_TO_DIR be the default,
9123         rather than DEREF_COMMAND_LINE_ARGUMENTS, when none of the
9124         -d, -F, -l options is specified.
9125         (decode_switches): Handle --dereference-command-line-symlink-to-dir.
9126         (gobble_file): Honor DEREF_COMMAND_LINE_SYMLINK_TO_DIR.
9127         Change --dereference-command-line (-H) to dereference *all*
9128         command line arguments, including broken symlinks.
9129
9130 2003-01-15  Paul Eggert  <eggert@twinsun.com>
9131
9132         Change ls -H back to the way it was yesterday, since this is
9133         compatible with FreeBSD and the POSIX spec is confusing
9134         and somewhat contradictory.
9135
9136         * src/ls.c (DEREF_COMMAND_LINE_ARGUMENTS): Change name back
9137         from DEREF_COMMAND_LINE_SYMLINK_TO_DIR, updating all uses.
9138         (long_options): Change the long option name back.
9139         (usage): Change the usage back.
9140         (gobble_file): When -H is specified, dereference a top-level
9141         arg even if it points to a non-directory.
9142
9143 2003-01-15  Jim Meyering  <jim@meyering.net>
9144
9145         * src/ls.c (gobble_file): Fall back on using lstat when required:
9146         when --dereference (-L) is not specified, and
9147         - when operating on a dangling symlink
9148         - when operating on command-line-symlink-to-directories
9149         This fixes numerous problems.  Here are examples:
9150         - `ls dangling-symlink' would fail with `no such file...'
9151         Now it prints `dangling-symlink'.
9152         - `ls -i symlink' would mistakenly print the inode of the referent.
9153         Now it prints the inode of the symlink.  Likewise for --size (-s).
9154         Based on a patch from Michael Stone.
9155         Reported by Deepak Goel as Debian bug #173793.
9156
9157         Rename ls's --dereference-command-line (-H)
9158         option to   --dereference-command-line-symlink-to-dir.
9159         * src/ls.c [enum Dereference_symlink]
9160         (DEREF_COMMAND_LINE_SYMLINK_TO_DIR): Rename from
9161         DEREF_COMMAND_LINE_ARGUMENTS.  Update all uses.
9162         (long_options): Rename the long option.
9163         (usage): Say that --dereference-... changes how ls treats
9164         only symlinks to directories specified on the command line.
9165
9166 2003-01-14  Jim Meyering  <jim@meyering.net>
9167
9168         * tests/ls/dangle: New file/test, for the above fix.
9169         * tests/ls/inode: Another new file/test, for the above fix.
9170         * tests/ls/Makefile.am (TESTS): Add dangle and inode.
9171
9172         * src/ls.c (gobble_file): Fix a bug introduced in 4.5.4 that made it
9173         so that ls --color would no longer highlight the names of files with
9174         the execute bit set when not specified on the command line.
9175         Patch by Michael Stone.  Reported by Stephen Depooter as
9176         Debian bug 175135.
9177
9178         * tests/ls-2/tests (color-exe): New test, for the above fix.
9179
9180 2003-01-13  Jim Meyering  <jim@meyering.net>
9181
9182         * tests/shred/exact: Also test for just fixed bug with --zero.
9183
9184         * src/shred.c (long_opts): --zero does not require an argument.
9185         Patch by Michael Stone.  Reported by Roland Turner as Debian bug 172019.
9186
9187 2003-01-12  Jim Meyering  <jim@meyering.net>
9188
9189         * Makefile.maint (cvs-update): Skip any file with local modifications.
9190
9191         * src/unexpand.c (usage): Document --first-only and mention that
9192         --tabs=N (-t) enables --all (-a).  Reported by wiregauze@yahoo.com.
9193
9194 2002-12-01  Dmitry V. Levin  <ldv@altlinux.org>
9195
9196         * src/df.c: Include "canonicalize.h".
9197         Use canonicalize_file_name unconditionally.
9198
9199 2003-01-09  Jim Meyering  <jim@meyering.net>
9200
9201         * README: Add readlink.
9202
9203 2002-11-30  Dmitry V. Levin  <ldv@altlinux.org>
9204
9205         * src/df.c: Include "xgetcwd.h".
9206         * src/pwd.c: Likewise.
9207
9208 2002-11-30  Dmitry V. Levin  <ldv@altlinux.org>
9209
9210         * src/shred.c: Remove declaration of xstrdup.
9211         We already get it via xalloc.h which is included via system.h.
9212
9213 2002-08-27  Dmitry V. Levin  <ldv@altlinux.org>
9214
9215         New program: readlink.
9216
9217         * src/Makefile.am (bin_PROGRAMS): Add readlink.
9218         * src/readlink.c: New file.
9219
9220         * man/readlink.x: New file.
9221         * man/Makefile.am (dist_man_MANS): Add readlink.1.
9222         (readlink.1): New rule.
9223
9224 2003-01-09  Jim Meyering  <jim@meyering.net>
9225
9226         When selecting ranges of byte offsets (as opposed to ranges of fields)
9227         and when --output-delimiter=STRING is specified, output STRING between
9228         ranges of selected bytes.
9229         * src/cut.c (RANGE_START_SENTINEL): Define.
9230         (output_delimiter_specified): New global.
9231         (print_kth): Add parameter.  Adjust all callers.
9232         (set_fields): Mark each range-start index with RANGE_START_SENTINEL.
9233         (cut_bytes): When requested, output STRING between ranges of
9234         selected bytes.
9235         (main): Make a diagnostic a little clearer.
9236         Based on a patch from Jan Nieuwenhuizen.
9237
9238         * tests/cut/Test.pm: New tests for the above.
9239
9240         * src/cut.c (set_fields): Make code agree with comment:
9241         Don't merge abutting ranges like 4- and 2-3.  This makes no
9242         difference currently, but is required to support an upcoming change.
9243
9244 2003-01-07  Jim Meyering  <jim@meyering.net>
9245
9246         * src/cut.c (set_fields): Fix typo in comment.
9247
9248         * tests/touch/not-owner: New test, mostly extracted from fail-diag.
9249         * tests/touch/Makefile.am (TESTS): Add not-owner.
9250         * tests/touch/fail-diag: Remove the test for non-owner diagnostic.
9251         Now, this tests only the nonexistent-directory diagnostic.
9252         Suggestion from Michael Stone.
9253
9254         * tests/touch/fail-diag: Fix typo: s/ld/ls/.
9255
9256 2003-01-04  Jim Meyering  <jim@meyering.net>
9257
9258         * src/copy.h: Remove use of PARAMS.
9259         * src/remove.h: Likewise.
9260         * src/chown-core.h: Likewise.
9261
9262         rm could be tricked into mistakenly reporting a cycle.
9263         * src/remove.c: [cycle_check_state]: New global.
9264         (remove_cwd_entries): Adapt to new semantics of cycle_check.
9265         (rm): Call cycle_check_init and cycle_check_free for each file.
9266         * tests/rm/cycle (rm): New test, for the above fix.
9267         * tests/rm/Makefile.am (TESTS): Add cycle.
9268
9269         When rm detects a cycle, don't abort the entire command,
9270         but rather just the affected command line argument.
9271         * src/remove.c: Include <setjmp.h>
9272         (struct dirstack_state) [current_arg_jumpbuf]: New member.
9273         (remove_cwd_entries): Call longjmp if we detect a cycle.
9274         (rm): Call setjmp here.
9275
9276         * src/remove.c (cycle_check, is_power_of_two): Remove functions.
9277         Instead, include cycle-check.h and use it.
9278
9279         * src/remove.h (struct dev_ino): Remove declaration.
9280
9281         * src/remove.c (remove_cwd_entries): Fix typos in comment.
9282
9283         Don't include trailing /. in diagnostics about directories.
9284         * src/remove.c (full_filename_): When FILENAME is just `.'
9285         and there is a nonempty directory-name part, don't append `/.'.
9286         * tests/rm/unread2: Remove trailing /. from diagnostic.
9287         * tests/rm/rm2: Likewise.
9288
9289         * src/remove.c (struct dirstack_state): Define.
9290         To be used in place of these file-scoped globals ...
9291         (dir_stack, len_stack, Active_dir): Remove globals.
9292         (ds_init, ds_free): New functions.
9293         (full_filename): Define.
9294         (full_filename_): Rename from full_filename.
9295
9296         Begin to make AD_* functions more generic.
9297         * src/remove.c (AD_push_initial): Don't set status to RM_OK here.
9298         (AD_push): Likewise.
9299         (AD_INIT_OTHER_MEMBERS): Define.
9300         (remove_dir): Define the `status' member manually after each
9301         call to AD_push or AD_push_initial.
9302
9303         * src/Makefile.am (check-misc): New rule, to ensure that no more
9304         S_IS* macro definitions sneak into the code.
9305         (check): Depend on check-misc.
9306
9307         * src/remove.c [S_ISLNK]: Don't define.  It's already defined in sys2.h.
9308         * src/du.c (count_entry) [S_ISLNK]: Don't define.
9309         * src/shred.c [S_ISLNK, S_ISFIFO, S_ISSOCK]: Don't define.
9310
9311 2003-01-03  Jim Meyering  <jim@meyering.net>
9312
9313         * src/true.c: Add copyright.
9314         (AUTHORS): I suppose I've written it.
9315
9316         * src/Makefile.am (false.c): Make the generated file be read-only.
9317
9318 2003-01-04  Jim Meyering  <jim@meyering.net>
9319
9320         * src/ls.c: Include "dev-ino.h".
9321         [struct dev_ino]: Remove declaration.
9322
9323 2003-01-02  Jim Meyering  <jim@meyering.net>
9324
9325         * src/cp.c (do_copy): Tweak diagnostic to be consistent with the one
9326         from mv: s/missing file arguments/missing file argument/.
9327         With --target-directory=DIR, cp and mv work with a single file argument.
9328         Reported by Karl Berry.
9329
9330         * tests/rm/isatty: Enable this test.
9331
9332 2002-12-31  Jim Meyering  <jim@meyering.net>
9333
9334         * src/remove.c (AD_push_initial): Don't set status to RM_OK here.
9335         (AD_push): Likewise.
9336         (AD_INIT_OTHER_MEMBERS): Define.
9337         (remove_dir): Define the `status' member manually after each
9338         call to AD_push or AD_push_initial.
9339
9340         * src/ls.c [struct dev_ino]: Remove definition.
9341         Include "dev-ino.h" instead.
9342
9343 2002-12-28  Jim Meyering  <jim@meyering.net>
9344
9345         * tests/du/Makefile.am (TESTS): Add no-deref.
9346         * tests/du/no-deref: New script.
9347
9348 2002-12-23  Jim Meyering  <jim@meyering.net>
9349
9350         * src/remove.c (remove_cwd_entries): Fix typo in comment.
9351
9352 2002-12-21  Jim Meyering  <jim@meyering.net>
9353
9354         * announce-gen: Generate MML-formatted announcement.
9355         This makes it a *lot* harder to send stale MD5/SHA1 signatures.
9356
9357 2002-12-20  Jim Meyering  <jim@meyering.net>
9358
9359         * src/touch.c (touch): Change the wording of a diagnostic so
9360         that it makes sense both when the file exists and when it doesn't.
9361         Suggestion from Michael Stone.
9362
9363 2002-12-18  Jim Meyering  <jim@meyering.net>
9364
9365         * src/stty.c (valid_options): Declare to be static.
9366
9367 2002-12-15  Jim Meyering  <jim@meyering.net>
9368
9369         * Makefile.cfg: Remove rules related to generating m4/jm-glibc-io.m4.
9370
9371         * src/chmod.c, src/copy.c, src/copy.h, src/cp-hash.h, src/csplit.c:
9372         * src/date.c, src/expr.c, src/fmt.c, src/id.c, src/install.c:
9373         * src/ls.c, src/od.c, src/pathchk.c, src/pr.c, src/remove.c:
9374         * src/shred.c, src/sort.c, src/stat.c, src/stty.c, src/sum.c:
9375         * src/tee.c, src/test.c: Remove all uses of `PARAMS'.
9376
9377         * src/remove.c (PARAMS): Remove definition.
9378         * src/sys2.h: Likewise.
9379
9380         * src/ls.c, src/stat.c, src/date.c: Remove declaration of nstrftime.
9381         Include strftime.h instead.
9382
9383 2002-12-14  Jim Meyering  <jim@meyering.net>
9384
9385         * Makefile.cfg ($(url_dir_list)): Use .../coreutils, not .../fetish.
9386
9387         * src/system.h [! HAVE_DECL_MEMRCHR]: Declare memrchr.
9388         This is necessary at least for Irix6.5 when using c89.
9389         Reported by Nelson Beebe.
9390
9391         * tests/misc/Makefile.am (TESTS): Add cat-tty-eof.
9392
9393         * tests/misc/cat-tty-eof: New test.
9394
9395         * src/mknod.c (usage): Specify how major and minor mode numbers
9396         are interpreted.  Report forwarded by Kristin E Thomas.
9397         * src/mknod.c: Remove now-redundant usage-specifying comment.
9398
9399 2002-12-13  Jim Meyering  <jim@meyering.net>
9400
9401         * Version 4.5.4.
9402
9403         * tests/du/trailing-slash: Allow for a directory of size `0'.
9404         That happens at least on file systems of type tmpfs on linux-2.4.18.
9405
9406         * announce-gen: New script to begin replacing the commands
9407         associated with the rule here...
9408         * Makefile.maint (announcement): Invoke announce-gen.
9409         * Makefile.am (EXTRA_DIST): Add announce-gen.
9410
9411         * tests/cp/preserve-2: New file/test, for latest fix.
9412         * tests/cp/Makefile.am (TESTS): Add preserve-2.
9413
9414 2002-12-11  TAKAI Kousuke  <takai@vlsi.kuee.kyoto-u.ac.jp>
9415
9416         Fix a bug whereby cp would fail to parse an option like
9417         --preserve=mode,ownership.
9418         * src/cp.c (decode_preserve_arg): Advance `comma' to
9419         point the character following the comma.
9420
9421 2002-12-11  Jim Meyering  <jim@meyering.net>
9422
9423         * src/pathchk.c (NEED_PATHCONF_WRAPPER): Undefine before defining,
9424         in case it's already defined.
9425
9426 2002-12-09  Jim Meyering  <jim@meyering.net>
9427
9428         * tests/touch/fail-diag: Don't get a test failure if /no exists.
9429         Instead, evoke a framework failure if /no-$$ exists.
9430         Reported by Michael Stone.
9431
9432 2002-12-08  Jim Meyering  <jim@meyering.net>
9433
9434         * src/du.c (lstat) [! LSTAT_FOLLOWS_SLASHED_SYMLINK]:
9435         Define to rpl_lstat, so that even on systems like Solaris 5.8,
9436         du honors (per POSIX) the trailing slash on an argument referring
9437         to a symlink-to-directory.
9438
9439 2002-12-06  Jim Meyering  <jim@meyering.net>
9440
9441         * Use autoconf-2.57.  Regenerate dependent files.
9442         * Use automake-1.7.2.  Regenerate dependent files.
9443
9444         * src/ls.c (gobble_file): Also stat the file if it's a
9445         regular file and --indicator-style=classify (aka -F).
9446         Thanks to Ed Santiago for opening my eyes.
9447
9448         * tests/ls/file-type: New file.  Test for the above.
9449         A test to contrast ls -F and ls --indicator-style=file-type.
9450         * tests/ls/Makefile.am (TESTS): Add file-type.
9451
9452 2002-12-04  Jim Meyering  <jim@meyering.net>
9453
9454         * tests/ls/follow-slink: Make sure the symlink was created.
9455         Richard Dawe reported that `ln -s link link' succeeds, but creates
9456         no file on systems running some version of the DJGPP libc.
9457
9458 2002-12-03  Jim Meyering  <jim@meyering.net>
9459
9460         * src/Makefile.am (AUTOMAKE_OPTIONS): Remove definition (to ansi2knr)
9461         since this package no longer panders to K&R compilers.
9462
9463 2002-12-02  Jim Meyering  <jim@meyering.net>
9464
9465         * tests/du/slink: Skip this test if `.' is on a non-local file system.
9466
9467         * tests/Fetish.pm (_at_replace): Do the substitution only if there's
9468         something to replace.
9469
9470 2002-12-01  Jim Meyering  <jim@meyering.net>
9471
9472         * src/stat.c: Don't include <string.h> or <ctype.h>.
9473         That's already done via system.h.
9474         * src/dircolors.c: Don't include <ctype.h>.
9475
9476 2002-11-30  Jim Meyering  <jim@meyering.net>
9477
9478         * ls.c (gobble_file): Remove the block of code that caused
9479         `ls --color -F symlink-to-dir' to list the files in
9480         `symlink-to-dir/.'.  Now, it prints `symlink-to-dir@', (just
9481         like `ls -F symlink-to-dir') but with the addition of highlighting.
9482         Similarly, `ls --color -dF symlink-to-dir' would print
9483         `symlink-to-dir/';  now it prints `symlink-to-dir@'.
9484         Reported by Jeff Sheinberg as Debian bug #168203.
9485         * tests/ls-2/tests (sl-F-color, sl-dF-color): New tests for the above.
9486
9487         ls is now more efficient: with certain options, it no longer needs
9488         to stat each directory entry on systems with valid dirent.d_type.
9489         * src/ls.c (print_dir): Add DT_LNK and DT_REG.
9490         (main): Make --recursive set format_needs_type, not format_needs_stat.
9491         (gobble_file): Remove a FIXME comment, now that it's fixed.
9492
9493 2002-11-24  Jim Meyering  <jim@meyering.net>
9494
9495         * src/du.c (du_files): Don't strip any trailing slash.
9496         Rewrite so that `/' is no longer represented internally as
9497         the empty string.
9498         (count_entry): When appending a file name component,
9499         account for the fact that the current path may end in `/'.
9500         François Pinard reported that `du symlink-to-dir/' was not
9501         equivalent to `du symlink-to-dir/.'.  Now it is.
9502         * tests/du/trailing-slash: New file/test, for the above fix.
9503         * tests/du/Makefile.am (TESTS): Add trailing-slash.
9504
9505 2002-11-23  Jim Meyering  <jim@meyering.net>
9506
9507         * src/tac.c (output): Declare some local variables to be of type size_t,
9508         rather than `int' to avoid warnings from gcc.
9509
9510 2002-11-21  Paul Eggert  <eggert@twinsun.com>
9511
9512         * src/ls.c (decode_switches): Use case-sensitive matching to
9513         decode the QUOTING_STYLE environment variable.  This is more
9514         consistent with the documentation, and with --quoting-style.
9515
9516 2002-11-21  Martin Buck  <martin.buck@ascom.ch
9517
9518         * src/stty.c (struct speeds): Add support for all baud rates defined
9519         in linux-2.4.19.
9520
9521 2002-11-19  Jim Meyering  <jim@meyering.net>
9522
9523         * tests/sum/sysv: Export LC_ALL=C, to avoid failure when
9524         run in a UTF locale.  Report and suggested fix by Bruno Haible.
9525         * tests/fmt/basic: Likewise.
9526
9527 2002-11-17  Jim Meyering  <jim@meyering.net>
9528
9529         * configure.ac: Update via autoupdate.
9530         Add `AM_GNU_GETTEXT_VERSION(0.11.5)'.
9531
9532         * src/mv.c (movefile): Don't remove trailing slashes from SOURCE.
9533         Reported by Hans Ginzel.
9534
9535 2002-11-15  Jim Meyering  <jim@meyering.net>
9536
9537         * Makefile.cfg (gnu_rel_host): Define.
9538         (url_dir_list): Choose from (alpha|ftp).gnu.org depending
9539         on whether $(VERSION) looks like a major release number.
9540
9541         * Makefile.maint (mail_gpg_sign_cookie): Backslash-escape `#'.
9542         (release): Rename from `alpha'.
9543         (alpha): Depend on release.
9544
9545         * Makefile.maint (signatures): Define with ?=, so it's easy to override.
9546
9547 2002-11-14  Jim Meyering  <jim@meyering.net>
9548
9549         * Makefile.maint (mail_gpg_sign_cookie): Make optional.
9550         (announcement): Use the new variable.
9551
9552         * Makefile.maint: Sync with Bison, i.e.:
9553         (po-check): Scan .l and .y files instead of the
9554         .c and the .h files that they generate.  This fixes the bug
9555         reported by Tim Van Holder in:
9556         <http://mail.gnu.org/pipermail/bison-patches/2002-November/001352.html>
9557         Look for N_ as well as for _.  Try to avoid matching #define for
9558         N_ and _.
9559         From Paul Eggert.
9560
9561 2002-11-12  Jim Meyering  <jim@meyering.net>
9562
9563         * src/ls.c (HAVE_SYMLINKS): Remove unnecessary macro definition.
9564         Replace sole use with equivalent `#ifdef S_ISLNK'.
9565         Inconsistency reported by Dmitry V. Levin.
9566
9567 2002-11-11  Jim Meyering  <jim@meyering.net>
9568
9569         * src/stat.c (usage): Transform --help items output via s/ - /   /,
9570         so that help2man produces properly formatted man pages.
9571         Reported by Herbert Xu as Debian bug #168400.
9572
9573 2002-11-10  Jim Meyering  <jim@meyering.net>
9574
9575         * src/ls.c (sighandler): Handle SIGTSTP specially.
9576         Based on suggestions from Solar Designer and Dmitry V. Levin.
9577         Add comments.
9578
9579         * Makefile.cfg (cvs_files): Define.  From autoconf.
9580         (local_updates): Likewise.
9581
9582         * src/ls.c (restore_default_color_handler, sigtstp_handler):
9583         Remove functions.
9584         (sighandler): New function, based on the one in sort.c.
9585         (main): Use sigaction, if possible; otherwise signal.
9586         Handle these signals:
9587         SIGHUP, SIGINT, SIGPIPE, SIGQUIT, SIGTERM, SIGTSTP.
9588         Don't register our handler if the signal is already being ignored.
9589
9590         * src/dd.c (interrupt_handler): Use raise, rather than kill+getpid.
9591         * src/csplit.c (interrupt_handler): Likewise.
9592         * src/sort.c (sighandler): Likewise.
9593         (main): Declare `i' and `nsigs' to be unsigned, not int.
9594
9595 2002-11-09  Jim Meyering  <jim@meyering.net>
9596
9597         ls --color: restore terminal text color upon signal.
9598         * src/ls.c: Include "full-write.h" and <signal.h>.
9599         (restore_default_color, restore_default_color_handler): New functions.
9600         (sigtstp_handler, put_indicator_direct): New functions.
9601         (main) [print_with_color]: Register signal handlers.
9602         Patch mostly by Solar Designer and Stanislav Ievlev.
9603
9604         Update from autoconf.
9605         * Makefile.maint (AMTAR): Remove definition.
9606         (update, cvs-update, po-update, do-po-update): New rules.
9607         (wget-update): Update (thus renaming to cvs-update).
9608         (automake_repo): Use anoncvs@sources.redhat.com.
9609
9610 2002-11-06  Jim Meyering  <jim@meyering.net>
9611
9612         * tests/misc/Makefile.am (TESTS): Add printf-hex.
9613
9614         * tests/misc/printf: Be careful to test the code in this package,
9615         not the shell built-in function.
9616
9617         * src/printf.c (print_esc): A hexadecimal escape sequence has
9618         at most two hex. digits, not three.  Reported by Padraig Brady.
9619         (usage): Update description.
9620         * tests/misc/printf-hex: New file/test, for the above fix.
9621
9622 2002-10-07  Paul Eggert  <eggert@twinsun.com>
9623
9624         Add support for locale-specific size indications (e.g.,
9625         thousands-separators) and for explicit size suffixes on output.
9626
9627         * doc/coreutils.texi (Block size): Say that:
9628         This affects display format as well as block size.
9629         Fractional block counts are rounded up.
9630         ls file size blocksize defaults to 1.
9631         A block size spec preceded by ' generates thousands separators.
9632         A suffix without a preceding integer generates suffixes.
9633         (tail invocation): 32k -> 32 KiB.
9634         (What information is listed): ls -h is now equivalent to
9635         ls --block-size=human, and ls -H is now equivalent to
9636         ls --block-size=si.  Displayed file size is now always affected by
9637         --block-size.
9638
9639         * lib/inttostr.c, lib/inttostr.h, lib/imaxtostr.c, lib/offtostr.c,
9640         lib/umaxtostr.c: New files, taken from GNU tar.
9641
9642         * lib/Makefile.am (libfetish_a_SOURCES): Add imaxtostr.c, offtostr.c,
9643         umaxtostr.c.
9644         (EXTRA_DIST): Add inttostr.c.
9645
9646         * lib/human.c, lib/human.h: Rewrite to support locale-specific
9647         notations like thousands separators.
9648         Specify what includer of include.h must include beforehand.
9649         (human_group_digits, human_suppress_point_zero, human_autoscale,
9650         human_base_1024, human_SI, human_B): New enum values.
9651         (human_readable): Rename from human_readable_inexact; put the
9652         options before the sizes.  All uses changed.  The old human_readable
9653         function has been removed; use inttostr.h instead.
9654         (human_options): Renamed from human_block_size, with new signature
9655         that allows block sizes up to UINTMAX_MAX.  All callers changed.
9656
9657         * m4/prereq.m4 (jm_PREREQ_HUMAN): Check for locale.h, localeconv,
9658         AC_HEADER_STDBOOL.  No need to check for limits.h since it's in
9659         freestanding C89.  No need to check for stdlib.h or string.h since
9660         autoconf does this now.
9661
9662         * src/cksum.c (cksum): Use primitives from inttostr.h, not
9663         human.h, to print large numbers simply.
9664         * src/csplit.c (handle_line_error, parse_patterns): Likewise.
9665         * src/dd.c (print_stats, main): Likewise.
9666         * src/df.c (print_header): Likewise.
9667         * src/factor.c (print_factors): Likewise.
9668         * src/ls.c (print_long_format, print_file_name_and_frills): Likewise.
9669         * src/shred.c (dopass): Likewise.
9670         * src/sort.c (checkfp): Likewise.
9671         * src/sum.c (bsd_sum_file, sysv_sym_file): Likewise.
9672         * src/tail.c (xlseek): Likewise.
9673         * src/wc.c (write_counts, wc): Likewise.
9674
9675         * src/df.c (human_output_opts): New var.
9676         (output_block_size): Now uintmax_t, not int, to handle larger
9677         block sizes.  All uses changed.
9678         * src/du.c: Likewise.
9679         * src/ls.c: Likewise.
9680
9681         * src/df.c (print_header): In the header line, prefer SI to human
9682         representation if it's shorter; if neither is shorter, try to
9683         intuit what the user would prefer.
9684
9685         * src/expr.c (inttostr): Remove; use new imaxtostr library
9686         function instead.
9687
9688         * src/ls.c (file_output_block_size): New var, to distinguish
9689         file sizes from other sizes.
9690         (decode_switches): Set it.
9691
9692         * src/shred.c (OUTPUT_BLOCK_SIZE): remove.
9693         (dopass): When printing progress, use floor for what has been done
9694         so far (since we should be conservative there), and ceiling for
9695         what needs to be done (since that's what other programs use).
9696
9697 2002-10-19  Jim Meyering  <jim@meyering.net>
9698
9699         * src/pinky.c (print_heading): Align TTY and Name headings.
9700         Reported by Karl Eichwalder.
9701
9702 2002-10-18  Jim Meyering  <jim@meyering.net>
9703
9704         * src/split.c (cwrite): Change type of `bytes' parameter to size_t
9705         Remove now-useless cast.
9706         (stdread): Remove function.
9707         (bytes_split): Use size_t instead of int.
9708         Use safe_read, not stdread.
9709         (lines_split): Likewise.
9710         Use memchr rather than a `while' loop.
9711         (line_bytes_split): Use size_t instead of int.
9712         Use safe_read, not stdread.
9713         (main): Add some FIXME comments to remind me to remove casts.
9714
9715         * src/system.h (ST_BLKSIZE): Correct comment describing how to
9716         reproduce HPUX-11 cat failure.  From Petter Reinholdtsen.
9717
9718 2002-10-17  Jim Meyering  <jim@meyering.net>
9719
9720         Fix a problem that could make e.g., `cat' misbehave on systems which
9721         give invalid (unreasonably large) values for stat.st_blksize.
9722         * src/system.h (ST_BLKSIZE): Ensure that the result is in [1..4MB].
9723         Reported by Petter Reinholdtsen.
9724
9725 2002-10-14  Jim Meyering  <jim@meyering.net>
9726
9727         Specifying a printf conversion specifer as nl's separator string
9728         could cause nl to segfault.
9729         * src/nl.c (build_print_fmt): Don't include separator string
9730         in the printf format; it might contain `%'.
9731         Use a better bound on the length of the print_fmt buffer.
9732         (print_lineno): Print the separator here instead.
9733         Reported by Doug Coleman.
9734
9735         * tests/misc/nl: New file/tests, including a test for the above.
9736         * tests/misc/Makefile.am (TESTS): Add nl.
9737
9738         * tests/misc/split-l: New test, to make sure `split --lines=N' works.
9739         * tests/misc/Makefile.am (TESTS): Add split-l.
9740
9741 2002-10-13  Jim Meyering  <jim@meyering.net>
9742
9743         * Version 4.5.3.
9744
9745         * src/du.c (usage): Tweak description of --dereference-args/-D.
9746
9747         * src/du.c (count_entry): Also save cwd when dereferencing (via
9748         --dereference-args, -D) a command-line argument.
9749         Reported by Michal Svec.  Based on a patch by Andreas Schwab.
9750
9751         * src/Makefile.am (../AUTHORS): New target/rule.
9752
9753 2002-10-12  Jim Meyering  <jim@meyering.net>
9754
9755         * src/paste.c (paste_parallel): Declare local, `delims_saved', to be
9756         of type size_t, since that's the way it's used and avoids a warning.
9757
9758         * src/csplit.c (struct cstring) [len]: Declare to be unsigned int,
9759         since that's how it's always used and avoids a new warning from gcc.
9760         (read_input): Adapt to new safe_read ABI.
9761
9762         * src/cut.c (cut_fields): Add a temporary size_t variable, n_bytes,
9763         to avoid warnings.
9764
9765         * src/pinky.c (print_long_entry): fread returns size_t.
9766         Declare local `bytes' accordingly, to avoid warning.
9767
9768         tail -c +N would perform an extra read after encountering EOF
9769         [this change is analogous (bytes vs. lines) to the one of 2002-01-27]
9770         * src/tail.c (start_bytes): Detect EOF, inform caller.
9771         (tail_bytes): Upon EOF in start_bytes, return immediately.
9772         (file_lines): Reorganize to use memrchr rather than an explicit loop.
9773         Adapt to new safe_read ABI.
9774
9775 2002-10-11  Jim Meyering  <jim@meyering.net>
9776
9777         * tests/du/deref: New file/test, for the above fix.
9778         * tests/du/Makefile.am (TESTS): Add deref.
9779
9780 2002-10-10  Jim Meyering  <jim@meyering.net>
9781
9782         * tests/ln/Makefile.am (TESTS): Add target-1.
9783         * tests/ln/target-1: New file/test, for the fix on 2002-10-08.
9784
9785 2002-10-09  Jim Meyering  <jim@meyering.net>
9786
9787         * tests/cp/backup-is-src: Ensure that certain environment variables
9788         are not set (e.g., SIMPLE_BACKUP_SUFFIX).  Reported by Duncan Roe.
9789
9790         * tests/tail-2/big-4gb: Mark this as an expensive test; it would
9791         consume 4GB of disk space on systems without support for sparse files.
9792         Fix a logic error that'd make it `cat err' even though dd didn't fail.
9793
9794         * src/dircolors.hin (.jar): Fix typo: s/;3$/;31/.
9795         Patch by steven@magelico.net, forwarded by Michael Stone.
9796
9797         * tests/ls/dired: Ensure that ls produces English messages.
9798         Patch by Alexey Vyskubov, forwarded by Michael Stone.
9799
9800 2002-10-08  Dmitry V. Levin  <ldv@altlinux.org>
9801
9802         * src/ln.c (main): Fix target_directory parsing when n_files == 1.
9803
9804 2002-10-08  Jim Meyering  <jim@meyering.net>
9805
9806         * tests/tail-2/big-4gb: Use double quotes around diagnostic.
9807         Fix syntax in test: use =, not ==.
9808         Reported by Bob Proulx.
9809         Change all the rest like this: grep -lR "testing framework'" .\
9810         |xargs perl -pi -e 's/'\''(\$0: failure in testing framework)'\''/"$1"/'
9811
9812         * src/sum.c (sysv_sum_file): Adapt to new safe_read ABI.
9813         * src/tr.c (squeeze_filter, read_and_delete, read_and_xlate): Likewise.
9814         * src/tac.c (save_stdin, tac_stdin_to_mem): Likewise.
9815         * src/wc.c (wc): Likewise.
9816
9817 2002-10-07  Paul Eggert  <eggert@twinsun.com>
9818
9819         * src/cat.c (cat):
9820         Don't advance the write pointer past the end of the write buffer.
9821         * src/sort.c (begfield, limfield): Likewise.
9822
9823 2002-10-07  Jim Meyering  <jim@meyering.net>
9824
9825         * src/cat.c (simple_cat, cat): Adapt to new safe_read ABI.
9826         * src/head.c (head_bytes, head_lines): Likewise.
9827
9828 2002-10-06  Jim Meyering  <jim@meyering.net>
9829
9830         * src/dd.c (scanargs): Ensure that specified block sizes (specified
9831         via ibs=N, obs=N, and bs=N) are no larger than SSIZE_MAX.
9832         (skip, dd_copy): Adapt to new safe_read ABI.
9833
9834         * Makefile.maint (signatures): Define.
9835         (%.sig): New rule.
9836         (announcement): Depend on $(signatures).
9837
9838         * Makefile.maint (announcement): Output all URLs for detached
9839         signatures, not just the last one from the previous loop.
9840
9841 2002-10-05  Jim Meyering  <jim@meyering.net>
9842
9843         * Version 4.5.2.
9844
9845         * src/remove.c (remove_entry) [ROOT_CAN_UNLINK_DIRS]: With `rm -i DIR',
9846         don't recurse into directory, DIR.  Prompted by a report from
9847         Leonardo Milano.
9848
9849         * tests/rm/i-no-r: New file/test, for the above fix.
9850         * tests/rm/Makefile.am (TESTS): Add i-no-r.
9851
9852         * tests/tail-2/big-4gb: New file/test, for the fix of 2002-09-27.
9853         * tests/tail-2/Makefile.am (TESTS): Add big-4gb.
9854
9855 2002-10-03  Jim Meyering  <jim@meyering.net>
9856
9857         * src/rm.c (AUTHORS): Mark translatable string with `N_ (...)'.
9858         * src/df.c (AUTHORS): Likewise.
9859         * src/du.c (AUTHORS): Likewise.
9860         * src/tail.c (AUTHORS): Likewise.
9861         * src/touch.c (AUTHORS): Likewise.
9862
9863 2002-10-02  Jim Meyering  <jim@meyering.net>
9864
9865         * Makefile.am (SUBDIRS): Remove `old'.
9866         (EXTRA_DIST): List the files in old/.
9867         * configure.ac (AC_CONFIG_FILES): Remove old/* names.
9868         Suggestion from Akim Demaille.
9869
9870 2002-10-01  Jim Meyering  <jim@meyering.net>
9871
9872         * src/sys2.h (SSIZE_MAX): Define.
9873
9874 2002-09-30  Jim Meyering  <jim@meyering.net>
9875
9876         * src/csplit.c: Don't include stdlib.h here.  It's already included
9877         via system.h.
9878
9879 2002-09-29  Jim Meyering  <jim@meyering.net>
9880
9881         * src/tr.c (find_bracketed_repeat): Rearrange pointer/integer
9882         expression to avoid bogus warning from gcc.
9883
9884         * src/cat.c (simple_cat): Use a temporary to avoid bogus warnings.
9885         (cat): Declare insize and outsize to be of type size_t, not int.
9886         Rearrange pointer/integer expressions to avoid bogus warnings.
9887         (main): Declare insize and outsize to be of type size_t, not int.
9888
9889         * src/tail.c (parse_options): Give a sensible diagnostic for
9890         an invalid byte or line count.  Reported by Mikko Tuumanen.
9891
9892         * src/touch.c (main): Split a long line.
9893
9894         * tests/du/Makefile.am (TESTS): Add slink.
9895         * tests/du/slink: New test for system.h change of 2002-08-31.
9896
9897         In move mode, always first try to rename.  Before, upon failure to
9898         rename a directory, this code would never attempt to rename any
9899         other file in that directory, but would thenceforth always copy.
9900         On some systems (e.g., NetApp's OnTap-6.4), renaming a directory
9901         may fail with EXDEV, yet renaming files within that directory to
9902         a newly-created destination directory succeeds.
9903         * src/copy.c (copy_internal): Remove local, move_mode;
9904         use x->move_mode instead.  Based on a patch from Tom Haynes.
9905
9906 2002-09-28  Jim Meyering  <jim@meyering.net>
9907
9908         * src/split.c (FAIL_ONLY_ONE_WAY): New macro.
9909         Factor out some duplication.
9910         (main): Use it.
9911         [case 'a']: Use strtoul rather than strtol to avoid compiler warnings.
9912
9913         * src/sort.c (begfield, limfield): Rearrange comparisons to avoid
9914         compiler warnings.
9915         (fillbuf, keycompare): Cast literal `-1' to size_t in comparisons,
9916         to avoid compiler warnings.
9917
9918         * src/shred.c (dopass): Use a uintmax_t temporary to avoid bogus
9919         compiler warnings.
9920
9921         Fix things so `mkdir -p' can create very deep directories, e.g.,
9922         mkdir -p $(perl -e 'print "a/" x 40000') now works.
9923         * src/mkdir.c (main): For --parents (-p), call make_path with the
9924         entire directory name, so we don't ever require that file operations
9925         like stat or chmod be performed on the entire command line argument.
9926         * makepath.c (make_path): Restore umask *before* creating the final
9927         component.
9928
9929 2002-09-27  Andreas Schwab  <schwab@suse.de>
9930
9931         * src/tail.c (tail_bytes): Change type of bytes_remaining to off_t
9932         to avoid overflow.  Reported by Hans Lermen.
9933
9934 2002-09-26  Jim Meyering  <jim@meyering.net>
9935
9936         * src/install.c (get_ids): Use strtoul, not strtol.  Remove some casts.
9937
9938 2002-09-25  Jim Meyering  <jim@meyering.net>
9939
9940         * src/test.c (eaccess): Change type of local `euid' from int to uid_t
9941         and add a cast, to avoid a warning about `signed and unsigned type in
9942         conditional expression'.
9943
9944 2002-09-22  Jim Meyering  <jim@meyering.net>
9945
9946         * src/rmdir.c: Include "dirname.h", for declaration of
9947         strip_trailing_slashes.
9948
9949         * src/stat.c (PRIdMAX, PRIuMAX): Remove definitions.
9950         Now they're defined through system.h.
9951
9952         * src/cp-hash.c, src/dd.c, src/df.c, src/du.c, src/ls.c,
9953         * src/stat.c, src/wc.c: Remove all inclusions of inttypes.h,
9954         since it's already included from sys2.h via system.h.
9955
9956         * Use automake-1.6f.  Regenerate dependent files.
9957
9958         * src/Makefile.am (PERL): Remove duplicate definition.
9959
9960         fmt's -s, -t, -c options didn't work properly for long lines.
9961         Since get_line may end up calling put_paragraph (for long lines),
9962         be sure to set global, `other_indent', before it is used there.
9963
9964         * src/fmt.c (set_other_indent): New function, factored out of...
9965         (get_paragraph): ... here.  Call it.
9966         (get_line): Call set_other_indent before calling flush_paragraph,
9967         which calls fmt_paragraph, which in turn calls put_paragraph,
9968         which uses other_indent.
9969
9970         * tests/fmt/Makefile.am (TESTS): Add long-line.
9971         * tests/fmt/long-line: New file/test, for the above fix.
9972
9973 2002-09-21  Jim Meyering  <jim@meyering.net>
9974
9975         * src/od.c: No longer include deprecated <values.h>.
9976         It was required solely for now-removed reference to BITSPERBYTE.
9977         * src/install.c: Likewise.
9978         Suggestion from Bruno Haible.
9979
9980 2002-09-06  Andreas Schwab  <schwab@suse.de>
9981
9982         `rmdir -p dir-specified-with-trailing-slash/' would fail.
9983         * src/rmdir.c (remove_parents): Strip trailing slashes.
9984
9985 2002-09-20  Jim Meyering  <jim@meyering.net>
9986
9987         * tests/rmdir/t-slash: New file/test, for the above fix.
9988         * tests/rmdir/Makefile.am (TESTS): Add t-slash.
9989
9990         * Makefile.maint (announcement): Arrange to gpg-sign the message.
9991         Add a URL for each detached signature file.
9992
9993 2002-09-07  Bruno Haible  <bruno@clisp.org>
9994
9995         * configure.ac: Add need-ngettext to AM_GNU_GETTEXT invocation.
9996
9997 2002-09-18  Jim Meyering  <jim@meyering.net>
9998
9999         `od -t x8' used the wrong (`l'-prefixed) printf format.
10000         Likewise for the o8 and u8 formats.
10001         * src/od.c (ISPEC_TO_FORMAT): Define macro.
10002         (decode_one_format): Use PRIdMAX, PRIoMAX, etc. for LONG_LONG.
10003         Reported by Arun Sharma.
10004
10005 2002-09-17  Jim Meyering  <jim@meyering.net>
10006
10007         * src/sys2.h (PRIdMAX, PRIoMAX, PRIuMAX, PRIxMAX): Define if necessary.
10008         From gettext's intl/loadmsgcat.c.
10009
10010         * tests/od/x8: New file/test, for the above fix.
10011         * tests/od/Makefile.am (TESTS): Add x8.
10012
10013 2002-09-15  Jim Meyering  <jim@meyering.net>
10014
10015         * Use autoconf-2.54.  Regenerate dependent files.
10016
10017         * src/csplit.c (get_format_width): Add cast to avoid
10018         warning about `signed and unsigned type in conditional expression'.
10019
10020 2002-09-14  Jim Meyering  <jim@meyering.net>
10021
10022         * src/who.c (print_user): Change type of local to size_t
10023         to avoid warnings about `comparison between signed and unsigned'.
10024         * src/ptx.c (generate_all_output): Likewise.
10025
10026         * src/dd.c (main, skip): Add casts to avoid warnings about
10027         `comparison between signed and unsigned'.
10028
10029         * src/id.c (print_full_info, print_group_list): Add casts to avoid
10030         warnings about `signed and unsigned type in conditional expression'.
10031
10032         * src/md5sum.c: Change type of global, digest_hex_bytes, to size_t
10033         to avoid warnings about `comparison between signed and unsigned'.
10034         (split_3): Change parameter names to be readable and add comment.
10035         Clean up the test for whether a line may be ignored.
10036
10037 2002-09-13  Jim Meyering  <jim@meyering.net>
10038
10039         * src/printf.c (main): Handle leading command line argument of `--'.
10040         Reported by Raul: DervishD <raul@pleyades.net>
10041         * tests/misc/printf: New file: test for the above.
10042         * tests/misc/Makefile.am (TESTS): Add printf.
10043
10044         * src/date.c (usage): Explain that %S's range of [0..60] is required --
10045         rather than 0..59 -- to accommodate the occasional positive leap second.
10046         Reported by Richard Neill.
10047
10048 2002-09-12  Jim Meyering  <jim@meyering.net>
10049
10050         * src/Makefile.am (nanosec_libs): Define.
10051         (sleep_LDADD, tail_LDADD): Use it here.
10052
10053         Factor nanosleep-related code into ../lib/xnanosleep.c.
10054         * src/sleep.c: Include xnanosleep.h.
10055         Factor out fenv.h-related code.
10056         (timespec_subtract): Remove function.
10057         (main): Remove code that deals with computing start and stop times
10058         as well as the loop around nanosleep.  Now that's in xnanosleep.c.
10059
10060         Allow S (in --sleep-interval=S) to be a floating point value.
10061         * src/tail.c: Include xnanosleep.h and xstrtod.h.
10062         Move declaration of global variable, sleep_interval, to ...
10063         (main): ...here.
10064         (usage): Update description of --sleep-interval option.
10065         (tail_forever): New parameter, sleep_interval.  Update caller.
10066         Use xnanosleep, rather than sleep.
10067         (parse_options): New parameter, sleep_interval.  Update caller.
10068         Use xstrtod, now that we accept floating point values.
10069         Prompted by a patch from Augey Mikus.
10070
10071 2002-09-06  Jim Meyering  <jim@meyering.net>
10072
10073         * src/remove.c (prompt): Change comment to give a better note to
10074         translators.  From Michael Piefel.
10075
10076 2002-09-02  Jim Meyering  <jim@meyering.net>
10077
10078         * README: A good problem report/patch includes diffs against
10079         the most recent test release.
10080
10081         * src/pathchk.c (NEED_PATHCONF_WRAPPER): Define.
10082         (pathconf_wrapper): Define only if NEED_PATHCONF_WRAPPER is set.
10083
10084         * src/kill.c (print_table_row): Use an unsigned type for widths
10085         to avoid warning about comparison between signed and unsigned.
10086         (list_signals): Likewise.
10087
10088         * src/od.c (skip): Add a cast to avoid warning about comparison
10089         between signed and unsigned.
10090         * src/install.c (get_ids): Likewise.  Also rearrange range-checking
10091         comparisons to make them more readable.
10092
10093 2002-09-01  Jim Meyering  <jim@meyering.net>
10094
10095         * Version 4.5.1.
10096
10097 2002-08-31  Jim Meyering  <jim@meyering.net>
10098
10099         Symlinks were always reported as using 0 blocks.
10100         * src/system.h (ST_NBLOCKS): Don't depend on file type.
10101         This reverts the change of 2000-01-30.
10102         Based on a report and patch from Neil Brown via Michael Stone.
10103         This fixes Debian Bug#156358.
10104
10105         * Most files: Change `exit (0)' to `exit (EXIT_SUCCESS)',
10106         `exit (1)' to `exit (EXIT_FAILURE)', and
10107         `usage (1)' to `usage (EXIT_FAILURE)'.
10108
10109         * chgrp.c, chmod.c, chown.c, chroot.c, cp.c, date.c, dd.c, du.c,
10110         * hostname.c, id.c, install.c, ln.c, mkdir.c, mkfifo.c, mknod.c,
10111         * nice.c, pinky.c, printf.c, pwd.c, shred.c, sleep.c, stty.c,
10112         * su.c, tac-pipe.c, tail.c, tee.c, touch.c, uname.c, uptime.c,
10113         * users.c, who.c: Change `error (1, ...' to `error (EXIT_FAILURE, ...'.
10114         But don't change `error (0, ...' to `error (EXIT_SUCCESS, ...', since
10115         error never exits successfully.
10116
10117 2002-08-29  Jim Meyering  <jim@meyering.net>
10118
10119         * src/remove.c (remove_cwd_entries): Use closedir (not CLOSEDIR)
10120         when ignoring any return value.
10121
10122         * src/remove.c (remove_cwd_entries): Detect and diagnose readdir
10123         failures.  On some systems (at least EMC Celerra and Solaris5.8),
10124         this appears to be necessary.
10125         (is_empty_dir): Likewise.  Also, always close directory handle.
10126         * src/ls.c (print_dir): Likewise.
10127         (print_dir): Rename local variable: reading -> dirp.
10128         Reported by Mike Coleman.
10129
10130 2002-08-28  Jim Meyering  <jim@meyering.net>
10131
10132         * src/remove.c (remove_cwd_entries): Use CLOSEDIR, not closedir.
10133         Give a diagnostic and fail if closedir fails.
10134
10135 2002-08-26  Jim Meyering  <jim@meyering.net>
10136
10137         * Makefile.am (THANKS-to-translators): New rule.
10138         (EXTRA_DIST): Add both THANKS-to-translators and THANKStt.in.
10139         * THANKStt.in: New file.
10140
10141         * src/cat.c (close_stdout_wrapper): New, kludgey, function and
10142         file-scoped global.
10143         (main): Register it with atexit.
10144         Close STDOUT_FILENO, to avoid a problem when writing to
10145         /dev/audio on at least Solaris 5.7 and 5.8 systems.
10146         Reported by Shing-Shong Shei.
10147
10148 2002-08-25  Jim Meyering  <jim@meyering.net>
10149
10150         * src/cat.c (main): Close STDIN_FILENO rather than a literal `0'.
10151         * src/tac.c (main): Likewise.
10152         * src/tail.c (main): Likewise.
10153         * src/tee.c (main): Likewise.
10154         * src/tr.c (main): Likewise.
10155         * src/wc.c (main): Likewise.
10156
10157 2002-08-20  Jim Meyering  <jim@meyering.net>
10158
10159         * tests/mv/setup: Rewrite not to use `: ${VAR=not_set}' paradigm.
10160
10161 2002-08-10  Paul Eggert  <eggert@twinsun.com>
10162
10163         * src/nohup.sh: Don't use "exec --"; it's not portable and
10164         shouldn't be needed.
10165
10166 2002-08-09  Jim Meyering  <jim@meyering.net>
10167
10168         * src/pr.c (main): Don't ignore -COLUMN if it's the last option.
10169         (usage): Clarify help text for the -COLUMN option.
10170         Patch by Padraig Brady.
10171         * tests/pr/Test.pm [col-last]: New test for the above.
10172
10173         * configure.ac: Start with version 4.5.1, chosen so that it's larger
10174         than the latest version numbers of the component packages.
10175
10176         * man/Makefile.am (check-x-vs-1): Set and export PATH so we use
10177         programs in ../src.
10178
10179 2002-08-08  Jim Meyering  <jim@meyering.net>
10180
10181         * src/date.c: Guard inclusion of <langinfo.h> with
10182         `#if HAVE_LANGINFO_CODESET', not `#if HAVE_LANGINFO_H'.
10183         * src/sort.c: Likewise.
10184         Patch by GOTO Masanori.
10185
10186 2002-08-05  Paul Eggert  <eggert@twinsun.com>
10187
10188         Fix some minor time-related bugs with POSIX time arguments.
10189         Some valid time stamps were being rejected (notably -1, and
10190         time stamps before 1900 on 64-bit hosts).  And some invalid
10191         time stamps were being accepted, e.g. September 31.
10192
10193         * src/date.c (main): Adjust to posixtime signature change.
10194         * src/touch.c (main): Likewise.  Remove unnecessary initialization.
10195         Use localtime, not posixtm, to warn about obsolete "touch".
10196
10197 2002-08-05  Jim Meyering  <jim@meyering.net>
10198
10199         * tests/misc/Makefile.am (TESTS): Add nice and pathchk1.
10200
10201 2002-08-04  Jim Meyering  <jim@meyering.net>
10202
10203         * src/Makefile.am (check-README): New target/rule.
10204         (check): Depend on it.
10205
10206         * configure.ac (AC_CONFIG_FILES): Add old/Makefile and old/*/Makefile.
10207
10208 2002-08-03  Jim Meyering  <jim@meyering.net>
10209
10210         * Makefile.am (SUBDIRS): Add old.
10211         * old/: New directory, containing legacy ChangeLog* and NEWS files
10212         from the fileutils, sh-utils, and textutils packages.
10213
10214         * src/Makefile.am (AM_INSTALLCHECK_STD_OPTIONS_EXEMPT): Set to false.
10215
10216 2002-08-02  Paul Eggert  <eggert@twinsun.com>
10217
10218         * NEWS, doc/coreutils.texi: uniq now obeys LC_COLLATE.
10219
10220         * src/uniq.c: Include hard-locale.h, xmemcoll.h.
10221         (hard_LC_COLLATE): New var.
10222         (different): Args are now char *, not const char *.
10223         Use xmemcoll instead of memcmp to compare lines, so that
10224         LC_COLLATE has effect.  However, use memcmp if it is an
10225         easy locale.
10226         (check_file): Do not include newline in comparison, so that
10227         xmemcoll has a byte to stomp on temporarily.
10228         (main): Set hard_LC_COLLATE.
10229
10230 2002-07-29  Jim Meyering  <jim@meyering.net>
10231
10232         * Makefile.am (SUBDIRS): Remove djgpp, for now.
10233
10234 2002-07-20  Jim Meyering  <jim@meyering.net>
10235
10236         * Makefile.am (false.c): Convert only the final EXIT_SUCCESS
10237         into EXIT_FAILURE.  Otherwise, false --help and false --version
10238         would fail.
10239
10240 2002-07-08  Jim Meyering  <jim@meyering.net>
10241
10242         * src/Makefile.am (uninstall-local): Search for @GNU_PACKAGE@,
10243         rather than the hard-coded `sh-utils'.
10244
10245 2002-07-01  Jim Meyering  <jim@meyering.net>
10246
10247         * configure.ac: Merge the three files from fileutils,
10248         textutils, and sh-utils.
10249         * Makefile.am: Likewise.
10250         * src/Makefile.am: Likewise.