platform/upstream/coreutils.git
15 years agotests: do not run chmod on a prefix of space-embedded tmpdir
Jim Meyering [Tue, 22 Jul 2008 09:23:08 +0000 (11:23 +0200)]
tests: do not run chmod on a prefix of space-embedded tmpdir

* TESTS/test-lib.sh (remove_tmp_): New function.
(trap 0): Use it instead of open-coded (and misquoted) version.

15 years agotests: ensure "make check" w/tainted build dir no longer impacts $HOME
Jim Meyering [Tue, 22 Jul 2008 07:20:52 +0000 (09:20 +0200)]
tests: ensure "make check" w/tainted build dir no longer impacts $HOME

* maint.mk (taint-distcheck): New rule.
(maintainer-distcheck): Make it.

15 years agotests: again, do not change the mode of all directories below $HOME
Ralf Wildenhues [Tue, 22 Jul 2008 05:38:31 +0000 (07:38 +0200)]
tests: again, do not change the mode of all directories below $HOME

* tests/CuTmpdir.pm (chmod_tree): Do not run chmod on undefined
argument, can happen when the build path contains spaces.

15 years ago* THANKS: Update, now that I have a name for jemm4jemm.
Jim Meyering [Sat, 19 Jul 2008 13:42:49 +0000 (15:42 +0200)]
* THANKS: Update, now that I have a name for jemm4jemm.

15 years agomknod: correct misplaced -Z description in --help output
Andreas Schwab [Fri, 18 Jul 2008 15:37:41 +0000 (17:37 +0200)]
mknod: correct misplaced -Z description in --help output

* src/mknod.c (usage): Put it after the "Mandatory arguments..." line.

15 years agodircolors.hin: add Ogg/Theora-related extensions
Jim Meyering [Wed, 16 Jul 2008 11:01:03 +0000 (13:01 +0200)]
dircolors.hin: add Ogg/Theora-related extensions

* dircolors.hin: Add extensions from
http://wiki.xiph.org/index.php/MIME_Types_and_File_Extensions
Suggestion from jemm4jemm@yahoo.com.

15 years ago* HACKING: describe how to find a misplaced change-set
Jim Meyering [Wed, 16 Jul 2008 10:25:00 +0000 (12:25 +0200)]
* HACKING: describe how to find a misplaced change-set

16 years agofix two bugs in ptx
Jim Meyering [Tue, 15 Jul 2008 06:30:38 +0000 (08:30 +0200)]
fix two bugs in ptx

* src/ptx.c (fix_output_parameters): Don't let before_max_width
go negative -- that would cause an infloop in define_all_fields.
(main): Don't clobber name[0] with lists of two or more input files.
* tests/misc/ptx: New file.  Test for the above.
* tests/Makefile.am (TESTS): Add misc/ptx.

16 years agotests: expand: test for lines starting with both spaces and tabs
Pádraig Brady [Thu, 10 Jul 2008 08:36:49 +0000 (09:36 +0100)]
tests: expand: test for lines starting with both spaces and tabs

The expand released in current distributions (Fedora Core 4 - Fedora 9
at least), doesn't expand --initial tabs if spaces are present.

tests/misc/expand: Add test to verify --initial works correctly
with lines starting with both spaces and tabs.

16 years agomake check: accommodate stricter POSIX-conforming shells
Jim Meyering [Thu, 10 Jul 2008 06:41:28 +0000 (08:41 +0200)]
make check: accommodate stricter POSIX-conforming shells

Without this, test-related variable settings were not exported to
the shell_or_perl_ function when using dash or Solaris 11's /bin/sh.
* tests/check.mk (TESTS_ENVIRONMENT): Use an explicit "export",
so as not to rely on non-POSIX behavior of some /bin/sh (e.g.,
bash-based ones).

16 years ago* bootstrap: Remove $bt and $bt2 also when not using gettext.
Jim Meyering [Sun, 6 Jul 2008 21:15:23 +0000 (23:15 +0200)]
* bootstrap: Remove $bt and $bt2 also when not using gettext.

16 years agowho -r: don't print "last=" when the corresponding byte is unprintable
Jim Meyering [Fri, 4 Jul 2008 14:34:39 +0000 (16:34 +0200)]
who -r: don't print "last=" when the corresponding byte is unprintable

* src/who.c (print_runlevel): Print last=%c only when the "preceding
run-level" byte is printable.  Reported by Gian Piero De Lolliis in
<http://bugzilla.redhat.com/453249>.

16 years agodoc: describe who's -p, -r, and -t options
Ondřej Vašík [Wed, 2 Jul 2008 12:11:05 +0000 (14:11 +0200)]
doc: describe who's -p, -r, and -t options

* doc/coreutils.texi (who invocation):

16 years agoinstall with just-built ./ginstall only when not cross-compiling
Jim Meyering [Fri, 4 Jul 2008 07:41:57 +0000 (09:41 +0200)]
install with just-built ./ginstall only when not cross-compiling

* src/Makefile.am (install-exec-am): ...otherwise, use the default
value, $(INSTALL_PROGRAM).  Reported by Brian Silverman.

16 years ago* README-hacking: Update the section on LZMA.
Jim Meyering [Tue, 1 Jul 2008 14:19:46 +0000 (16:19 +0200)]
* README-hacking: Update the section on LZMA.

16 years agotruncate: ignore whitespace in --size parameters
Pádraig Brady [Sun, 29 Jun 2008 00:55:03 +0000 (01:55 +0100)]
truncate: ignore whitespace in --size parameters

Without this, `truncate -s '> -1' F` would truncate F to length 0,
and `truncate -s " +1" F` would truncate F to 1 byte.  Now, each
elicits a diagnostic.
* src/truncate.c: Skip leading white space in the --size option
argument and any white space after one of the relative modifiers,
so that the presence of a +/- modifier can be detected reliably.
* tests/misc/truncate-parameters: Add tests for the above.

16 years agodoc: add "..." to Usage, to indicate there may be multiple OPTIONs
Jim Meyering [Sat, 28 Jun 2008 07:53:03 +0000 (09:53 +0200)]
doc: add "..." to Usage, to indicate there may be multiple OPTIONs

* src/base64.c (usage): Likewise.
* src/cat.c (usage): Likewise.
* src/md5sum.c (usage): Likewise.
* src/mkdir.c (usage): Likewise.
* src/mkfifo.c (usage): Likewise.
* src/split.c (usage): Likewise.
* src/stat.c (usage): Likewise.
Heiko Marr reported the problem with mkdir.

16 years agomkfifo: correct misplaced -Z description in --help output
Jim Meyering [Sat, 28 Jun 2008 07:48:11 +0000 (09:48 +0200)]
mkfifo: correct misplaced -Z description in --help output

* src/mkfifo.c (usage): Put it *after* the "Mandatory arguments..." line.

16 years agouniq: remove redundant test
Jim Meyering [Fri, 27 Jun 2008 16:52:56 +0000 (18:52 +0200)]
uniq: remove redundant test

* src/uniq.c (find_field): Remove redundant test in outer loop-
termination expression. Also, add a "const" attribute.

16 years agotimeout: fix invalid argument tests
Pádraig Brady [Thu, 26 Jun 2008 22:09:28 +0000 (23:09 +0100)]
timeout: fix invalid argument tests

* tests/misc/timeout-parameters: Remove test for invalid
signal number (we don't know what signal numbers are
invalid on all systems). Also tweak the other invalid
signal check so that the rest of the arguments are correct.

16 years agoavoid a -Wsign-compare warning
Jim Meyering [Fri, 27 Jun 2008 14:34:00 +0000 (16:34 +0200)]
avoid a -Wsign-compare warning

* src/tee.c (tee_files): Swap fwrite's size/n_elem args and
compare the return value against "1".

16 years agobase64: don't rely on feof returning 0/1
Jim Meyering [Fri, 27 Jun 2008 14:26:05 +0000 (16:26 +0200)]
base64: don't rely on feof returning 0/1

* src/base64.c (do_decode): feof is specified to return nonzero,
not 0/1, so use "k < 1 + !!feof(in)" as the loop termination test.

16 years agotruncate: silence -Wsign-compare warnings
Pádraig Brady [Fri, 27 Jun 2008 07:38:42 +0000 (08:38 +0100)]
truncate: silence -Wsign-compare warnings

* src/truncate.c: Cast signed to unsigned to
confirm intent which will silence -Wsign-compare warnings

16 years agofactor out time_t-to-string conversion idiom
Jim Meyering [Fri, 27 Jun 2008 08:54:23 +0000 (10:54 +0200)]
factor out time_t-to-string conversion idiom

* src/system.h: Include "inttostr.h".
(timetostr): New function, factored out of...
* src/date.c (show_date): Use timetostr.
* src/du.c (show_date): Likewise.
* src/ls.c (print_long_format): Likewise.
* src/pinky.c (time_string): Likewise.
* src/stat.c (human_time): Likewise.
* src/*.c: Don't include inttostr.h, since system.h does.
* src/c99-to-c89.diff: Adjust offsets.

16 years agotruncate: Fix integer portability issues
Pádraig Brady [Thu, 26 Jun 2008 10:10:13 +0000 (11:10 +0100)]
truncate: Fix integer portability issues

* src/truncate.c: Explicitly convert from off_t to intmax_t
when printing numbers as they may be different types.
Also don't mix size_t and off_t types in operations as
the latter will be promoted to unsigned when these types
are the same size.

16 years agotests: adjust c99-to-c89 patch as well as the code to generate it
Jim Meyering [Thu, 26 Jun 2008 21:04:57 +0000 (23:04 +0200)]
tests: adjust c99-to-c89 patch as well as the code to generate it

* maint.mk (patch-check) [REGEN_PATCH]: Trim some trailing blanks.
* src/c99-to-c89.diff: Adjust shred.c offsets.

16 years agotests: fix make distcheck failure due to TODO change
Jim Meyering [Thu, 26 Jun 2008 20:45:33 +0000 (22:45 +0200)]
tests: fix make distcheck failure due to TODO change

* maint.mk (po-check): Limit check for e.g., _(...)-marked
messages to files matching *.? and *.??, thus excluding TODO
and *.diff.

16 years ago* TODO: Add item: remove uses of imaxtostr.
Jim Meyering [Thu, 26 Jun 2008 19:16:17 +0000 (21:16 +0200)]
* TODO: Add item: remove uses of imaxtostr.

16 years agotests: accommodate difference in an AIX 5.3 diagnostic
Peter O'Gorman [Thu, 26 Jun 2008 18:57:11 +0000 (20:57 +0200)]
tests: accommodate difference in an AIX 5.3 diagnostic

* tests/mkdir/selinux: Handle different strerror (ENOTSUP) spelling.

16 years agoshred: also ignore EISDIR upon failed fsync/fdatasync on HP-UX
Jim Meyering [Thu, 26 Jun 2008 08:02:32 +0000 (10:02 +0200)]
shred: also ignore EISDIR upon failed fsync/fdatasync on HP-UX

* src/shred.c (ignorable_sync_errno): New function.
(dosync): Use it.
Based on a patch from Peter O'Gorman.

16 years ago* HACKING: use shorter "-1" (over HEAD~1) with git format-patch
Jim Meyering [Thu, 26 Jun 2008 19:03:55 +0000 (21:03 +0200)]
* HACKING: use shorter "-1" (over HEAD~1) with git format-patch

16 years agobootstrap.conf: don't list "open" specifically
Jim Meyering [Thu, 26 Jun 2008 06:01:26 +0000 (08:01 +0200)]
bootstrap.conf: don't list "open" specifically

It is no longer necessary to list it specifically,
now that several gnulib modules depend on the "open" module.
This reverts commit 3ea1fe588e20f196cc9b9907d5943bd620c6b944.

16 years agotruncate: handle the case in which off_t != intmax_t
Jim Meyering [Wed, 25 Jun 2008 21:15:06 +0000 (23:15 +0200)]
truncate: handle the case in which off_t != intmax_t

* src/truncate.c (parse_len): Use a temporary of type intmax_t,
rather than off_t; detect out of range [OFF_T_MIN..OFF_T_MAX].
(main) [IF_LINT]: Initialize, to avoid an unwarranted
"may be used uninitialized" warning.
Reported by Michael Geng.

Signed-off-by: Pádraig Brady <P@draigBrady.com>
16 years agobasename: List David MacKenzie as the author.
Jim Meyering [Mon, 23 Jun 2008 12:54:33 +0000 (14:54 +0200)]
basename: List David MacKenzie as the author.

* src/basename.c (AUTHORS): List David as the author.
* AUTHORS: Update here, too.

16 years agoecho: use AUTHORS from bash's built-in echo
Ondřej Vašík [Mon, 23 Jun 2008 12:00:26 +0000 (14:00 +0200)]
echo: use AUTHORS from bash's built-in echo

* AUTHORS,src/echo.c: Use bash builtin echo authors instead of FIXME unknown

16 years agouse gnulib's "open" module
Jim Meyering [Sun, 22 Jun 2008 16:57:39 +0000 (18:57 +0200)]
use gnulib's "open" module

* bootstrap.conf (gnulib_modules): Add open.
This is required at least for Solaris 9 and HP-UX 11, to
avoid a truncate test failure.  For details, see this thread:
http://thread.gmane.org/gmane.comp.gnu.coreutils.bugs/13755

16 years agostat: warn that the --context (-Z) option (a no-op) is obsolete
Jim Meyering [Sun, 22 Jun 2008 10:26:53 +0000 (12:26 +0200)]
stat: warn that the --context (-Z) option (a no-op) is obsolete

* src/stat.c (main): It will be removed in a couple years.
* NEWS (Change in behavior): Mention this.

16 years agomake "make syntax-check" quieter
Jim Meyering [Fri, 20 Jun 2008 09:05:57 +0000 (11:05 +0200)]
make "make syntax-check" quieter

* maint.mk (po-check, makefile-check, sc_proper_name_utf8_requires_ICONV):
Add "@" prefix.

16 years agosort: Fix bug where --batch-size option shrank SORT_SIZE.
Bo Borgerson [Thu, 19 Jun 2008 19:37:21 +0000 (15:37 -0400)]
sort: Fix bug where --batch-size option shrank SORT_SIZE.

* src/sort.c (specify_nmerge, main): Only adjust SORT_SIZE if it's already set.
* tests/misc/sort-merge: Test bug fix.

16 years agotests: avoid test failure when root's primary group-ID is not 0
Jim Meyering [Thu, 19 Jun 2008 07:03:41 +0000 (09:03 +0200)]
tests: avoid test failure when root's primary group-ID is not 0

* tests/cp/preserve-gid: Expect a cp-without-`-p'-created file to
have a group ID of $(id -g).  Reported by Jarod Wilson.  Details in
http://thread.gmane.org/gmane.comp.gnu.coreutils.bugs/13803/focus=13837

16 years agotests: avoid root-only test failure when run in a chroot
Jim Meyering [Thu, 19 Jun 2008 06:52:08 +0000 (08:52 +0200)]
tests: avoid root-only test failure when run in a chroot

* tests/misc/runcon-no-reorder: Accept the diagnostic that is
produced when running in a chroot without /selinux/context.
Reported by Jarod Wilson.  Details in
http://thread.gmane.org/gmane.comp.gnu.coreutils.bugs/13803/focus=13837

16 years ago* tests/check.mk: Fix a typo in a comment.
Jim Meyering [Wed, 18 Jun 2008 08:01:54 +0000 (10:01 +0200)]
* tests/check.mk: Fix a typo in a comment.

16 years agodoc: fix a syntax error
Jim Meyering [Tue, 17 Jun 2008 21:34:47 +0000 (23:34 +0200)]
doc: fix a syntax error

* coreutils.texi (du invocation): Add missing comma.

16 years agosort: accept new option --batch-size=NMERGE
Bo Borgerson [Sat, 5 Apr 2008 17:33:51 +0000 (13:33 -0400)]
sort: accept new option --batch-size=NMERGE

* src/sort.c: (static unsigned int nmerge) Replace constant NMERGE.
(specify_nmerge) Validate and apply new option.
(mergefps) Replace some arrays with pointers to xnmalloc'd storage.
* tests/misc/sort-merge: Test new option.
* doc/coreutils.texi: Describe new option.
* NEWS: Advertise new option.

16 years agosort: add new option --files0-from=F
Bo Borgerson [Thu, 3 Apr 2008 22:42:57 +0000 (18:42 -0400)]
sort: add new option --files0-from=F

* src/sort.c: Support new option.
* tests/misc/sort-files0-from: Test new option.
* tests/misc/Makefile.am: Indicate new test.
* docs/coreutils.texi: Explain new option.
* NEWS: Advertise new option.

Signed-off-by: Bo Borgerson <gigabo@gmail.com>
16 years agoHACKING: Add section for tips on reducing translator workload.
Bo Borgerson [Mon, 16 Jun 2008 22:30:25 +0000 (18:30 -0400)]
HACKING: Add section for tips on reducing translator workload.

* HACKING (Be nice to translators): New section.
Add Jim's suggestion to avoid changing translatable strings if possible.

16 years ago* THANKS: Add name and email for Carl Roth.
Jim Meyering [Tue, 17 Jun 2008 06:18:49 +0000 (08:18 +0200)]
* THANKS: Add name and email for Carl Roth.

16 years agols, od: avoid redundant const
Eric Blake [Tue, 17 Jun 2008 03:16:07 +0000 (21:16 -0600)]
ls, od: avoid redundant const

* src/ls.c (long_time_format, sort_functions): Avoid redundant const.
* src/od.c (charname): Likewise.
* maint.mk (sc_redundant_const): Add rule to detect this.

16 years agojoin: improve memory management
Bo Borgerson [Tue, 22 Apr 2008 20:19:58 +0000 (16:19 -0400)]
join: improve memory management

* src/join.c (struct seq): Use a (struct line **) for `lines' rather than
one long (struct line *).  This allows individual lines to be swapped out
if necessary.
(reset_line): Get a line ready for new input.
(init_linep): Create a new line and assign it to the the pointer passed in.
(spareline[2]): Hold a spare line for each input file.
(free_spareline): Clean up.
(get_line): Take a (struct line **) instead of a (struct line *).  If the
line to be overwritten is the previous line for the current file then swap
it out for the spare.
(join): Accomodate new structure of SEQs and new parameters to get_line;
Don't free stale lines until the end -- they're re-usable now.
(dup_line): Remove function.
* NEWS: Mention the performance improvement.

16 years ago* doc/coreutils.texi (join invocation): Drop leading blanks.
Ralf Wildenhues [Mon, 16 Jun 2008 17:58:18 +0000 (19:58 +0200)]
* doc/coreutils.texi (join invocation): Drop leading blanks.

16 years agoremove redundant const directives
Jim Meyering [Mon, 16 Jun 2008 12:55:06 +0000 (14:55 +0200)]
remove redundant const directives

In 1463824d8e7f72c31f1d803d7cfe2b608ccafc5c, I added some
missing "const" directives, as well as some new, redundant ones.
This removes the redundant ones.  Pointed out by Eric Blake.
* base64.c, cat.c, chcon.c, chgrp.c, chmod.c, chown.c, comm.c:
* cp.c, csplit.c, cut.c, date.c, dd.c, df.c, dircolors.c, du.c:
* env.c, expand.c, fmt.c, fold.c, groups.c, head.c, id.c:
* install.c, join.c, kill.c, ln.c, ls.c, md5sum.c, mkdir.c:
* mkfifo.c, mknod.c, mktemp.c, mv.c, nice.c, nl.c, od.c:
* paste.c, pathchk.c, pinky.c, pr.c, ptx.c, readlink.c, rm.c:
* rmdir.c, runcon.c, seq.c, shred.c, shuf.c, sort.c, split.c:
* stat.c, stty.c, su.c, sum.c, tac.c, tail.c, tee.c, timeout.c:
* touch.c, tr.c, truncate.c, tty.c, uname.c, unexpand.c, uniq.c:
* wc.c, who.c: Remove redundant const directives.
* maint.mk (sc_const_long_option): Don't require redundant "const".

16 years agochcon: correct --verbose output to include newlines
Jim Meyering [Mon, 16 Jun 2008 11:03:07 +0000 (13:03 +0200)]
chcon: correct --verbose output to include newlines

* src/chcon.c (process_file): Append "\n" to --verbose diagnostic.
* tests/misc/chcon: Add a test for the above.
* NEWS: mention the bug fix
Reported by Carl D. Roth in http://bugzilla.redhat.com/451478.

16 years agoaddress root cause of compilation failures:
Jim Meyering [Sun, 15 Jun 2008 16:57:13 +0000 (18:57 +0200)]
address root cause of compilation failures:

The affected code wasn't even being compiled on my system,
because HAVE_NL_LANGINFO was not defined.  On other systems, where
vasnprintf.m4 determines it needs %A or %a replacement support, it
_would_ check for nl_langinfo, and expose the compilation failure.
* m4/jm-macros.m4: Check for nl_langinfo, required by sort.c.

16 years agofix the compilation failure for real
Jim Meyering [Sun, 15 Jun 2008 16:52:27 +0000 (18:52 +0200)]
fix the compilation failure for real

* src/sort.c (monthtab): Neither "const" may be added.

16 years agofix a const-related compilation failure in sort.c
Jim Meyering [Sun, 15 Jun 2008 14:28:48 +0000 (16:28 +0200)]
fix a const-related compilation failure in sort.c

* src/sort.c (monthtab): Remove overzealous "const".
Table entries are modified in an #if HAVE_NL_LANGINFO block.
Introduced by 1463824d8e7f72c31f1d803d7cfe2b608ccafc5c.

16 years agoupdate HACKING guidelines
Jim Meyering [Sun, 15 Jun 2008 14:01:04 +0000 (16:01 +0200)]
update HACKING guidelines

* HACKING: Don't suggest --signoff; it's redundant.
(log requirements): Specify preferred forms.
Mention preference for "<" over ">".
Mention the "const placement" preference.

16 years agorun gnulib-tests in parallel
Jim Meyering [Fri, 13 Jun 2008 18:31:46 +0000 (20:31 +0200)]
run gnulib-tests in parallel

* tests/Makefile.am: Define AUTOMAKE_OPTIONS, so check.mk can append.
* tests/check.mk: Define SUFFIXES, so check.mk can append.
* build-aux/check.mk (SUFFIXES): Append, so as not to evoke
automake warning the prior definition in gnulib-tests/gnulib.mk.
(AUTOMAKE_OPTIONS): Likewise.
* gnulib-tests/Makefile.am (TEST_LOGS): Define.
Include build-aux/check.mk

16 years ago* maint.mk (sc_proper_name_utf8_requires_ICONV) Fix typo in diagnostic.
Jim Meyering [Sat, 14 Jun 2008 20:26:29 +0000 (22:26 +0200)]
* maint.mk (sc_proper_name_utf8_requires_ICONV) Fix typo in diagnostic.

16 years agoadd "const" attribute, where possible
Jim Meyering [Thu, 12 Jun 2008 20:06:15 +0000 (22:06 +0200)]
add "const" attribute, where possible

* maint.mk (sc_const_long_option): New rule.  Enforce global change.
* src/base64.c (long_options): Use "const" where possible.
* src/cat.c (main): Likewise.
* src/chcon.c (long_options): Likewise.
* src/chgrp.c (long_options): Likewise.
* src/chmod.c (long_options): Likewise.
* src/chown.c (long_options): Likewise.
* src/comm.c (long_options, OUTPUT_DELIMITER_OPTION): Likewise.
* src/cp.c (long_opts): Likewise.
* src/csplit.c (longopts): Likewise.
* src/cut.c (longopts): Likewise.
* src/date.c (long_options): Likewise.
* src/dd.c (conversions, flags, statuses): Likewise.
* src/df.c (long_options): Likewise.
* src/dircolors.c (long_options): Likewise.
* src/du.c (long_options): Likewise.
* src/env.c (longopts): Likewise.
* src/expand.c (longopts): Likewise.
* src/fmt.c (long_options): Likewise.
* src/fold.c (longopts): Likewise.
* src/groups.c (longopts): Likewise.
* src/head.c (long_options): Likewise.
* src/id.c (longopts): Likewise.
* src/install.c (long_options): Likewise.
* src/join.c (longopts): Likewise.
* src/kill.c (long_options): Likewise.
* src/ln.c (long_options): Likewise.
* src/ls.c (long_time_format, long_options, sort_functions): Likewise.
* src/md5sum.c (long_options): Likewise.
* src/mkdir.c (longopts): Likewise.
* src/mkfifo.c (longopts): Likewise.
* src/mknod.c (longopts): Likewise.
* src/mktemp.c (longopts): Likewise.
* src/mv.c (long_options): Likewise.
* src/nice.c (longopts): Likewise.
* src/nl.c (longopts): Likewise.
* src/od.c (charname, long_options): Likewise.
* src/paste.c (longopts): Likewise.
* src/pathchk.c (longopts): Likewise.
* src/pinky.c (longopts): Likewise.
* src/pr.c (long_options): Likewise.
* src/ptx.c (long_options): Likewise.
* src/readlink.c (longopts): Likewise.
* src/rm.c (long_opts): Likewise.
* src/rmdir.c (longopts): Likewise.
* src/runcon.c (long_options): Likewise.
* src/seq.c (long_options): Likewise.
* src/shred.c (long_opts): Likewise.
* src/shuf.c (long_opts): Likewise.
* src/sort.c (monthtab, long_options): Likewise.
* src/split.c (longopts): Likewise.
* src/stat.c (long_options): Likewise.
* src/stty.c (mode_info, control_info, longopts, set_mode) Likewise.
(set_control_char, speeds): Likewise.
* src/su.c (longopts): Likewise.
* src/sum.c (longopts): Likewise.
* src/tac.c (longopts): Likewise.
* src/tail.c (long_options): Likewise.
* src/tee.c (long_options): Likewise.
* src/timeout.c (long_options): Likewise.
* src/touch.c (longopts): Likewise.
* src/tr.c (long_options): Likewise.
* src/truncate.c (longopts): Likewise.
* src/tty.c (longopts): Likewise.
* src/uname.c (uname_long_options, arch_long_options): Likewise.
* src/unexpand.c (longopts): Likewise.
* src/uniq.c (longopts): Likewise.
* src/wc.c (longopts): Likewise.
* src/who.c (longopts): Likewise.

16 years agorevert previous change, "don't use "const" with scalar types"
Jim Meyering [Sat, 14 Jun 2008 09:04:41 +0000 (11:04 +0200)]
revert previous change, "don't use "const" with scalar types"

* src/truncate.c: There is nothing wrong with that construct.
This reverts commit d7d80c5b7b122377fe250357a3ab182e8fbde20a.

16 years agodon't use "const" with scalar types
Jim Meyering [Sat, 14 Jun 2008 07:46:47 +0000 (09:46 +0200)]
don't use "const" with scalar types

* src/truncate.c: Several vendor compilers reject that.
See http://article.gmane.org/gmane.comp.lib.gnulib.bugs/13876

16 years agood: improve handling of padding
Eric Blake [Thu, 12 Jun 2008 17:05:09 +0000 (11:05 -0600)]
od: improve handling of padding

* src/od.c (decode_one_format): Alter the format, again.
(FMT_BYTES_ALLOCATED): Reduce size by adjusting to new format.
(MAX_INTEGRAL_TYPE_SIZE): Move earlier in the file.
(charname): Turn it into a 2D array, since there's no need for
pointers now.
(PRINT_TYPE, print_named_ascii, print_ascii): Add a width
parameter.
(write_block): Account for width parameter.
Using ideas from Paul Eggert.

16 years agood: align multiple -t specs
Eric Blake [Wed, 11 Jun 2008 15:14:26 +0000 (09:14 -0600)]
od: align multiple -t specs

* src/od.c (struct tspec): Add pad_width field, and adjust
print_function prototype.
(decode_one_format): Rewrite all fmt_string values to account for
pad width.
(FMT_BYTES_ALLOCATED): Adjust to new format style.
(main): Compute pad width per spec.
(write_block): Account for pad width.
(dump): Don't print padding-only fields.
(PRINT_TYPE, print_named_ascii, print_ascii): All print functions
adjusted to use variable pad width.
* tests/Makefile.am (TESTS): Add test.
* tests/misc/od-multiple-t: New file.
* THANKS: Update.
* NEWS: Mention the improvement.
Reported by Gary Johnson.

16 years agood: use gnulib printf replacement as necessary
Eric Blake [Wed, 11 Jun 2008 21:02:20 +0000 (15:02 -0600)]
od: use gnulib printf replacement as necessary

* src/od.c (includes): Add xprintf.h.
(PRINT_TYPE): New macro, using xprintf instead of printf.
(print_s_char, print_char, print_s_short, print_short, print_int)
(print_long, print_long_long, print_float, print_double)
(print_long_double): Factor into PRINT_TYPE macro.
(print_named_ascii, print_ascii): Use xprintf.
* NEWS: Mention this as a bug fix.

16 years agood: simplify long double support
Eric Blake [Wed, 11 Jun 2008 17:45:16 +0000 (11:45 -0600)]
od: simplify long double support

* m4/jm-macros.m4 (gl_CHECK_ALL_TYPES): Remove obsolete check for
AC_C_LONG_DOUBLE.
* src/od.c (LONG_DOUBLE): Delete.
(width_bytes, MAX_FP_TYPE_SIZE, decode_one_format, main): Just use
'long double' directly.
(print_long_double): No longer protect by HAVE_LONG_DOUBLE.

16 years agodoc: od defaults to -toS, not -td2
Eric Blake [Wed, 11 Jun 2008 14:01:31 +0000 (08:01 -0600)]
doc: od defaults to -toS, not -td2

* src/od.c (usage): Correct description of default.

16 years agoskip (don't fail) root-only tests for common set-up failures
Jim Meyering [Fri, 13 Jun 2008 20:26:15 +0000 (22:26 +0200)]
skip (don't fail) root-only tests for common set-up failures

Address 2 of 4 failures reported by Jarod Wilson in
http://bugzilla.redhat.com/442352.  More details here:
http://thread.gmane.org/gmane.comp.gnu.coreutils.bugs/13803
* tests/cp/cp-a-selinux: Skip the test if "mkfs -t ext2" fails.
* tests/rm/fail-2eperm: Skip the test if "rm" is not accessible.

16 years agotweak to conform with syntax policy
Jim Meyering [Thu, 12 Jun 2008 19:38:17 +0000 (21:38 +0200)]
tweak to conform with syntax policy

Use "<" or "<=" rather than ">" or ">=".
Use "Type const *", rather than "const Type *".

16 years agocomm: accept new option: --output-delimiter=STR
Bo Borgerson [Wed, 23 Apr 2008 03:47:42 +0000 (23:47 -0400)]
comm: accept new option: --output-delimiter=STR

* src/comm.c (delimiter): New global.
(writeline): Use delimiter string instead of single TAB character.
(main): Initialize delimiter.
* tests/misc/comm: Add tests for comm output delimiter specification.
* doc/coreutils.texi: Document new option.
* NEWS: Advertise new option.
* TODO: Remove associated item.

16 years agocomm: ensure that input files are sorted
Bo Borgerson [Mon, 21 Apr 2008 01:24:16 +0000 (21:24 -0400)]
comm: ensure that input files are sorted

* NEWS: List new behavior.
* doc/coreutils.texi (checkOrderOption) New macro for
describing `--check-order' and `--nocheck-order', used in
both join and comm.
* src/comm.c (main): Initialize new options.
(usage): Describe new options.
(compare_files): Keep an extra pair of buffers for the previous
line from each file to check the internal order.
(check_order): If an order-check is required, compare and handle
the result appropriately.
(copylinebuffer): Copy a linebuffer; used for copy before read.
* tests/misc/Makefile.am: List new test.
* tests/misc/comm: Tests for the comm program, including the
new order-checking functionality and attendant command-line options.

16 years agofix another unportable use of 'tr'
Jim Meyering [Wed, 11 Jun 2008 12:04:45 +0000 (14:04 +0200)]
fix another unportable use of 'tr'

* configure.ac [EXTRA_PROGRAMS]: Add omitted space in tr's STRING2.
Spotted by Denis Excoffier, upon Solaris 8 build failure.

16 years agotests: skip a chown test on FreeBSD 6.x
Jim Meyering [Wed, 11 Jun 2008 09:52:03 +0000 (11:52 +0200)]
tests: skip a chown test on FreeBSD 6.x

* tests/chown/separator: Skip this test if is likely to fail
due to the combination of a bogus group name and a broken
getgrnam function.

16 years agotests: remove duplicate mention of misc/selinux
Jim Meyering [Wed, 11 Jun 2008 09:02:32 +0000 (11:02 +0200)]
tests: remove duplicate mention of misc/selinux

* tests/Makefile.am (TESTS): Remove misc/selinux, since it's
already listed in $(root_tests).

16 years agofix build failure on AIX 4
Bruno Haible [Wed, 11 Jun 2008 06:06:56 +0000 (08:06 +0200)]
fix build failure on AIX 4

* configure.ac: Fix unportable invocation of 'tr', introduced on
2008-04-22.  Affects tr from at least AIX 4.3.2.

16 years agoremove test for specific diagnostic when truncating missing directory
Pádraig Brady [Mon, 9 Jun 2008 15:36:38 +0000 (16:36 +0100)]
remove test for specific diagnostic when truncating missing directory

Solaris 10 returns ENOTDIR when truncating a nonexistent directory,
whereas Linux returns EISDIR (because it has a trailing /).
* tests/misc/truncate-fail-diag: Remove the test for the specific error.

16 years agotimeout: use system-independent exit values
Pádraig Brady [Mon, 9 Jun 2008 15:10:47 +0000 (16:10 +0100)]
timeout: use system-independent exit values

Change exit values from ETIMEDOUT and ECANCELED,
the values of which are system dependent, to
124 and 125 respectively.
* src/timeout.c (EXIT_TIMEDOUT, EXIT_CANCELED): Define.
(usage, main): Adjust.
* coreutils.texi (timeout invocation): Update.
* tests/misc/timeout: Adjust.

16 years agoenforce the proper_name_utf8-requires-ICONV link rule
Jim Meyering [Mon, 9 Jun 2008 08:52:20 +0000 (10:52 +0200)]
enforce the proper_name_utf8-requires-ICONV link rule

* maint.mk (sc_proper_name_utf8_requires_ICONV): New rule.
* src/Makefile.am (timeout_LDADD, truncate_LDADD): Add $(LIBICONV).

16 years ago* NEWS (Improvements): Mention improved (via gnulib) ACL support.
Bruno Haible [Mon, 9 Jun 2008 07:10:06 +0000 (09:10 +0200)]
* NEWS (Improvements): Mention improved (via gnulib) ACL support.

16 years agomaint.mk: my-distcheck runs $(MAKE) syntax-check once again
Jim Meyering [Sun, 8 Jun 2008 10:33:28 +0000 (12:33 +0200)]
maint.mk: my-distcheck runs $(MAKE) syntax-check once again

* maint.mk (my-distcheck): Run $(MAKE) syntax-check once again.
Run "$(MAKE) check" _after_ the less expensive syntax-check.

16 years agostandardize some error messages
Bo Borgerson [Fri, 4 Apr 2008 15:13:13 +0000 (11:13 -0400)]
standardize some error messages

* maint.mk: (sc_error_message_warn_fatal, sc_error_message_uppercase):
(sc_error_message_period): Add automatic checks for non-standard error
messages.
* .x-sc_error_message_uppercase: explicit exclusion for this check
* src/cp.c: Standardize some error messages.
* src/date.c: Likewise.
* src/dircolors.c: Likewise.
* src/du.c: Likewise.
* src/expr.c: Likewise.
* src/install.c: Likewise.
* src/join.c: Likewise.
* src/ln.c: Likewise.
* src/mv.c: Likewise.
* src/od.c: Likewise.
* src/pr.c: Likewise.
* src/split.c: Likewise.
* src/truncate.c: Likewise.
* src/wc.c: Likewise.
* tests/du/files0-from: Expect new error message.
* tests/misc/join: Likewise.
* tests/misc/split-a: Likewise.
* tests/misc/wc-files0-from: Likewise.
* tests/misc/xstrtol: Likewise.
* lib/xmemxfrm.c: Likewise.

16 years agosyntax-check: detect anachronistic Perl-based tests
Jim Meyering [Sun, 8 Jun 2008 08:30:50 +0000 (10:30 +0200)]
syntax-check: detect anachronistic Perl-based tests

* maint.mk (sc_no_exec_perl_coreutils): Rename and rewrite.

16 years agoAdd new program: truncate
Pádraig Brady [Fri, 28 Mar 2008 22:55:31 +0000 (22:55 +0000)]
Add new program: truncate

* AUTHORS: Register as the author
* NEWS: Mention this change
* README: Add truncate command to list
* src/truncate.c: New command
* src/Makefile.am: Add truncate command to list to build
* src/.gitignore: Add truncate binary to list to ignore
* doc/coreutils.texi (truncate invocation): Add truncate info
* man/Makefile.am: Add truncate man page to list to build
* man/truncate.x: Add truncate man page template
* po/POTFILES.in: Add truncate to list to translate
* tests/Makefile.am: Add truncate tests
* tests/misc/help-version: Add support for new truncate command
* tests/misc/truncate-dangling-symlink: check dangling link ok
* tests/misc/truncate-dir-fail: ensure dirs fail
* tests/misc/truncate-fail-diag: validate messages for missing paths
* tests/misc/truncate-fifo: ensure fifos ignored
* tests/misc/truncate-no-create-missing: ensure -c option honoured
* tests/misc/truncate-overflow: check signed integer overflows
* tests/misc/truncate-owned-by-other: root permissions check
* tests/misc/truncate-parameters: check invalid parameter combinations
* tests/misc/truncate-relative: check invalid relative sizes

16 years agoimprove 'date +%C' documentation
Eric Blake [Fri, 6 Jun 2008 00:33:26 +0000 (18:33 -0600)]
improve 'date +%C' documentation

* src/date.c (usage): Use 20, not 21, for current century.
* THANKS: Update.
Reported by Dameon G. Rogers, fix suggested by Philip Rowlands.

Signed-off-by: Eric Blake <ebb9@byu.net>
16 years agonice.c: avoid a cast
Jim Meyering [Tue, 3 Jun 2008 11:58:07 +0000 (13:58 +0200)]
nice.c: avoid a cast

* src/nice.c (main): Use argv[0], rather than
"program_name with a cast".  Suggestion from Eric Blake.

16 years agoadjust c99-to-c89 patch as well as the code to generate it
Jim Meyering [Tue, 3 Jun 2008 08:33:17 +0000 (10:33 +0200)]
adjust c99-to-c89 patch as well as the code to generate it

* maint.mk (patch-check) [REGEN_PATCH]: Eliminate date-related
differences in generated diffs.
* src/c99-to-c89.diff: Adjust offsets.

16 years agouse gnulib's progname module
Jim Meyering [Tue, 3 Jun 2008 06:34:09 +0000 (08:34 +0200)]
use gnulib's progname module

* bootstrap.conf (gnulib_modules): Add progname.
* src/*.c (program_name): Remove declaration.
* (main): Call set_program_name rather than setting program_name.
* src/nice.c (main): Cast program_name to "(char *)".
* src/prog-fprintf.c: Include "system.h"
* src/system.h: Include "progname.h".
* maint.mk (sc_program_name): Adjust rule.
Suggestion from Eric Blake.

16 years agoremove duplicate definition of matchpathcon_init_prefix
Jim Meyering [Tue, 3 Jun 2008 05:44:09 +0000 (07:44 +0200)]
remove duplicate definition of matchpathcon_init_prefix

* gl/lib/se-selinux.in.h (matchpathcon_init_prefix): Remove definition.
It is already defined there.  Reported by Eric Blake.

16 years agofix cpp indentation policy violations
Jim Meyering [Mon, 2 Jun 2008 19:47:19 +0000 (21:47 +0200)]
fix cpp indentation policy violations

* src/copy.c (mkfifo): Indent nested "# define".
* src/timeout.c (ECANCELED): Likewise.

16 years agoaccommodate older SELinux which lacks matchpathcon_init_prefix
Jim Meyering [Mon, 2 Jun 2008 19:17:57 +0000 (21:17 +0200)]
accommodate older SELinux which lacks matchpathcon_init_prefix

* m4/jm-macros.m4: Check for matchpathcon_init_prefix.
* src/install.c [!HAVE_MATCHPATHCON_INIT_PREFIX]
(matchpathcon_init_prefix): Define away.
* gl/lib/se-selinux.in.h (matchpathcon_init_prefix): Define.
Reported by Ilya N. Golubev in
<http://thread.gmane.org/gmane.comp.gnu.coreutils.bugs/13686>.

16 years agoeach file with a "main" must also declare program_name
Jim Meyering [Mon, 2 Jun 2008 15:48:11 +0000 (17:48 +0200)]
each file with a "main" must also declare program_name

* maint.mk (sc_program_name): New rule.
* .x-sc_program_name: New file.
* Makefile.am (EXTRA_DIST): Add .x-sc_program_name.

16 years agodeclare program_name consistently
Jim Meyering [Mon, 2 Jun 2008 15:47:32 +0000 (17:47 +0200)]
declare program_name consistently

* src/base64.c: Likewise.
* src/basename.c: Likewise.
* src/cat.c: Likewise.
* src/chcon.c: Likewise.
* src/chgrp.c: Likewise.
* src/chmod.c: Likewise.
* src/chown.c: Likewise.
* src/chroot.c: Likewise.
* src/cksum.c: Likewise.
* src/comm.c: Likewise.
* src/cp.c: Likewise.
* src/csplit.c: Likewise.
* src/cut.c: Likewise.
* src/date.c: Likewise.
* src/dd.c: Likewise.
* src/df.c: Likewise.
* src/dircolors.c: Likewise.
* src/dirname.c: Likewise.
* src/du.c: Likewise.
* src/echo.c: Likewise.
* src/env.c: Likewise.
* src/expand.c: Likewise.
* src/expr.c: Likewise.
* src/factor.c: Likewise.
* src/fmt.c: Likewise.
* src/fold.c: Likewise.
* src/groups.c: Likewise.
* src/head.c: Likewise.
* src/hostid.c: Likewise.
* src/hostname.c: Likewise.
* src/id.c: Likewise.
* src/install.c: Likewise.
* src/join.c: Likewise.
* src/kill.c: Likewise.
* src/link.c: Likewise.
* src/ln.c: Likewise.
* src/logname.c: Likewise.
* src/ls.c: Likewise.
* src/md5sum.c: Likewise.
* src/mkdir.c: Likewise.
* src/mkfifo.c: Likewise.
* src/mknod.c: Likewise.
* src/mktemp.c: Likewise.
* src/mv.c: Likewise.
* src/nice.c: Likewise.
* src/nl.c: Likewise.
* src/nohup.c: Likewise.
* src/od.c: Likewise.
* src/paste.c: Likewise.
* src/pathchk.c: Likewise.
* src/pinky.c: Likewise.
* src/pr.c: Likewise.
* src/printenv.c: Likewise.
* src/printf.c: Likewise.
* src/ptx.c: Likewise.
* src/pwd.c: Likewise.
* src/readlink.c: Likewise.
* src/rm.c: Likewise.
* src/rmdir.c: Likewise.
* src/runcon.c: Likewise.
* src/seq.c: Likewise.
* src/setuidgid.c: Likewise.
* src/shuf.c: Likewise.
* src/sleep.c: Likewise.
* src/sort.c: Likewise.
* src/split.c: Likewise.
* src/stat.c: Likewise.
* src/stty.c: Likewise.
* src/su.c: Likewise.
* src/sum.c: Likewise.
* src/sync.c: Likewise.
* src/tac.c: Likewise.
* src/tail.c: Likewise.
* src/tee.c: Likewise.
* src/test.c: Likewise.
* src/timeout.c: Likewise.
* src/touch.c: Likewise.
* src/tr.c: Likewise.
* src/true.c: Likewise.
* src/tsort.c: Likewise.
* src/tty.c: Likewise.
* src/uname.c: Likewise.
* src/unexpand.c: Likewise.
* src/uniq.c: Likewise.
* src/unlink.c: Likewise.
* src/uptime.c: Likewise.
* src/users.c: Likewise.
* src/wc.c: Likewise.
* src/who.c: Likewise.
* src/whoami.c: Likewise.
* src/yes.c: Likewise.

16 years agoexport program_name, required by gnulib
Eric Blake [Mon, 2 Jun 2008 13:53:26 +0000 (07:53 -0600)]
export program_name, required by gnulib

* src/timeout.c (program_name): Export.

16 years agorevert inadvertent change in last patch
Jim Meyering [Mon, 2 Jun 2008 13:05:38 +0000 (15:05 +0200)]
revert inadvertent change in last patch

* configure.ac (AM_INIT_AUTOMAKE): Restore accidentally-modified
options.  Spotted by Eric Blake.

16 years agonew program: timeout
Pádraig Brady [Fri, 28 Mar 2008 11:05:55 +0000 (11:05 +0000)]
new program: timeout

* AUTHORS: Register as the author.
* NEWS: Mention this change.
* README: Add timeout command to list.
* src/timeout.c: New file.
* src/kill.c (operand2sig): Move function to its own file,
now that timeout.c will also use it.
* src/operand2sig.c (operand2sig): New file, extracted from kill.c.
* src/operand2sig.h (operand2sig): Declare.
* src/Makefile.am (EXTRA_PROGRAMS): Add timeout.
* src/.gitignore: Add timeout binary to list to ignore.
* doc/coreutils.texi (timeout invocation): Add timeout info.
(Signal specifications): New section, also referenced by kill.
* man/Makefile.am (timeout.1): Add dependency.
* man/timeout.x: New file.
* po/POTFILES.in: Add timeout.c and operand2sig.c to list to translate.
* tests/Makefile.am (TESTS): Add the two new tests.
* tests/misc/help-version: Add support for new timeout command.
* tests/misc/invalid-opt: Add support for new timeout command.
* tests/misc/timeout: New file: check basic timeout operation.
* tests/misc/timeout-parameters: New file: check invalid parameter
combinations.

16 years agospell author names consistently
Jim Meyering [Mon, 2 Jun 2008 12:12:59 +0000 (14:12 +0200)]
spell author names consistently

* src/comm.c (AUTHORS): Use RMS' middle initial.
* src/ls.c (AUTHORS): Likewise.
* src/rm.c (AUTHORS): Likewise.
* src/uniq.c (AUTHORS): Likewise.
* src/cut.c (AUTHORS): Use David M. Ihnat's middle initial.
* AUTHORS: Update to match.
Reported by Michael Piefel.

16 years agodoc: adjust base64 documentation
Simon Josefsson [Sun, 1 Jun 2008 11:51:14 +0000 (13:51 +0200)]
doc: adjust base64 documentation

* coreutils.texi (base64 invocation): Use RFC 4648 as the specification.
Move the URL down a bit in the text.

16 years agomd5sum: new option, --quiet, to suppress OK messages
Erik Auerswald [Sun, 1 Jun 2008 10:40:40 +0000 (12:40 +0200)]
md5sum: new option, --quiet, to suppress OK messages

sha1sum, sha224sum, sha384sum, and sha512sum accept it, too.
* src/md5sum.c: add option --quiet to suppress OK messages
* doc/coreutils.texi: document option --quiet
* tests/misc/md5sum: add test for option --quiet
* NEWS: mention new option --quiet for md5sum+sha*sum in "New
  features" section

16 years agoadd rules to commit three post-release changes automatically
Jim Meyering [Sun, 1 Jun 2008 12:48:07 +0000 (14:48 +0200)]
add rules to commit three post-release changes automatically

* maint.mk (noteworthy): Define.
(emit-commit-log): Define.
(alpha beta major): Also update NEWS and cfg.mk automatically,
and commit all three changes at once.

16 years agoupdate old_NEWS_hash
Jim Meyering [Sun, 1 Jun 2008 12:44:50 +0000 (14:44 +0200)]
update old_NEWS_hash

* cfg.mk (old_NEWS_hash): Update by running "make update-NEWS-hash".
Reported by Erik Auerswald.

16 years agosrc/base64.c: Improve comments.
Simon Josefsson [Sun, 1 Jun 2008 11:08:20 +0000 (13:08 +0200)]
src/base64.c: Improve comments.