platform/upstream/coreutils.git
16 years agofalse: mark "false" description for translation
Jim Meyering [Mon, 4 Aug 2008 08:12:47 +0000 (10:12 +0200)]
false: mark "false" description for translation

* src/true.c (usage): Mark both strings with N_, so that
the one for "false" is also extracted for translation.
For consistency, mark both, although only the latter one needed it.
Inspired by a patch from Benno Schulenberg.

16 years agofactor: credit Torbjörn Granlund
James Youngman [Sun, 3 Aug 2008 23:16:06 +0000 (00:16 +0100)]
factor: credit Torbjörn Granlund

* src/factor.c: Credit Torbjörn Granlund as the author of the
arbitrary-precision factorization code.

16 years agodoc: make it clear we're talking about the Linux kernel
Jim Meyering [Sun, 3 Aug 2008 06:53:30 +0000 (08:53 +0200)]
doc: make it clear we're talking about the Linux kernel

* doc/coreutils.texi (mv invocation): tweak wording

16 years agotests: fix build-aux/check.mk for non-GNU make
Ralf Wildenhues [Sat, 2 Aug 2008 11:22:32 +0000 (13:22 +0200)]
tests: fix build-aux/check.mk for non-GNU make

* build-aux/check.mk ($(TEST_LOGS)) [!GNU_MAKE]: Check for
a $(TESTS) test in the build dir, before one in srcdir.  For details,
see <http://thread.gmane.org/gmane.comp.gnu.coreutils.bugs/14198>.

16 years ago* bootstrap: Fix unportable expr usage.
Ralf Wildenhues [Sat, 2 Aug 2008 07:41:09 +0000 (09:41 +0200)]
* bootstrap: Fix unportable expr usage.

16 years agols: --color now highlights files with capabilities, too
Kamil Dudka [Fri, 1 Aug 2008 17:33:45 +0000 (19:33 +0200)]
ls: --color now highlights files with capabilities, too

* src/ls.c: [HAVE_CAP] Include <sys/capability.h>.
(has_capability): New function for capability detection.
(print_color_indicator): Colorize file with capability.
* m4/jm-macro.m4: New configure option: --disable-libcap.
Check for libcap usability.
* src/Makefile.am (dir_LDADD, ls_LDADD, ...): Append $(LIB_CAP).
* src/dircolors.c: Update color lists.
* src/dircolors.hin: Mention new CAPABILITY color attribute.
* tests/ls/capability: Test for ls - colorize file with capability.
* tests/Makefile.am (root_tests): Add ls/capability.
* NEWS: Mention the change.

16 years agofactor arbitrarily large numbers
James Youngman [Thu, 31 Jul 2008 07:58:10 +0000 (09:58 +0200)]
factor arbitrarily large numbers

* m4/gmp.m4: New file; adds cu_GMP, which detects GNU MP.
* configure.ac: Use cu_GMP.
* src/Makefile.am: Link factor against libgmp if available.
* src/factor.c: Use GNU MP if it is available.
(emit_factor, emit_ul_factor, factor_using_division,
factor_using_pollard_rho, extract_factors_multi,
sort_and_print_factors, free_factors): new functions
for the arbitrary-precision implementation, taken from an example
in GNU MP.
(factor_wheel): Renamed; was called factor.
(print_factors_single): Renamed; was called print_factors.
(print_factors): New function, chooses between the single- and
arbitrary-precision algorithms according to availability of GNU MP
and the length of the number to be factored.
(usage, main): New options --bignum and --no-bignum.
* coreutils.texi (factor invocation): Document new command-line
options for the MP implementation and update the performance
numbers to take into account the asymptotically faster algorithm.
* TODO: Remove item about factoring large primes (it's done).
* m4/gmp.m4: Add support for --without-gmp.
* NEWS: Mention the new feature.

16 years agols -U1 now uses constant memory
Kamil Dudka [Wed, 30 Jul 2008 12:31:50 +0000 (14:31 +0200)]
ls -U1 now uses constant memory

When printing one name per line and not sorting, ls now uses
constant memory per directory, no matter how many files are in
the directory.
* ls.c (print_dir): Print each file name immediately, when possible.
* NEWS: Mention the improvement.

16 years ago* timeout.c: Fix grammar in a comment. Normalize comment syntax.
Jim Meyering [Wed, 30 Jul 2008 12:29:52 +0000 (14:29 +0200)]
* timeout.c: Fix grammar in a comment. Normalize comment syntax.

16 years agobootstrap: work also when there are no .po files in po/
Jim Meyering [Mon, 28 Jul 2008 09:48:22 +0000 (11:48 +0200)]
bootstrap: work also when there are no .po files in po/

* bootstrap (update_po_files): Complete the change that I began
in 7ba2dd808232cff3ee76aaceb97f4381c3c9cde4.

16 years ago* NEWS: Move shuf --zero-terminated item into bug-fixes section.
Jim Meyering [Sun, 27 Jul 2008 20:21:14 +0000 (22:21 +0200)]
* NEWS: Move shuf --zero-terminated item into bug-fixes section.

16 years agoshuf: correctly document --head-count
Mikael Magnusson [Sun, 27 Jul 2008 15:31:18 +0000 (17:31 +0200)]
shuf: correctly document --head-count

* src/shuf.c (usage): Correct --help output.
* doc/coreutils.texi: Correct option listing.
* NEWS: Mention correction.

16 years agoshuf: honor --zero-terminated option even with --input-range=LO-HI
Jim Meyering [Sun, 27 Jul 2008 13:14:37 +0000 (15:14 +0200)]
shuf: honor --zero-terminated option even with --input-range=LO-HI

* src/shuf.c (write_permuted_output): Add EOLBYTE parameter and use
it rather than hard-coding "\n".
(main): Adjust sole caller.
* tests/misc/shuf: Add a test to exercise this bug fix.
* NEWS: Mention it.

16 years agodd: minor fullblock changes
Jim Meyering [Wed, 23 Jul 2008 12:50:52 +0000 (14:50 +0200)]
dd: minor fullblock changes

* src/dd.c (O_FULLBLOCK): Define using an enum, not #define.
Derive the value, rather than hard-coding to one that might conflict.
(usage): Mention iflag=fullblock in --help output.
(scanargs): Reset the O_FULLBLOCK bit, so that we don't try to set
an undefined attribute via fcntl (fd, F_SETFL, ...
* tests/dd/misc: Signal framework_failure when necessary.
Use "compare actual expected", so any diffs look "right".
* NEWS (dd): Alphabetize and reword.
* coreutils.texi (dd invocation): Adjust wording.

16 years agodd: new option: iflag=fullblock to accumulate full input blocks
Kamil Dudka [Wed, 23 Jul 2008 09:29:21 +0000 (11:29 +0200)]
dd: new option: iflag=fullblock to accumulate full input blocks

* src/dd.c (iread_fullblock): New function for reading full blocks.
(scanargs): Check for new parameter iflag=fullblock.
(skip): Use iread_fnc pointer instead of iread function.
(dd_copy): Use iread_fnc pointer instead of iread function.
* tests/dd/misc: Add test for dd - read full blocks.
* doc/coretuils.texi: Mention new parameter iflag=fullblock.
* NEWS: Mentioned the change.

16 years agodd: adjust --help output so help2man formats the man page properly
Jim Meyering [Wed, 23 Jul 2008 13:50:40 +0000 (15:50 +0200)]
dd: adjust --help output so help2man formats the man page properly

* src/dd.c (usage): Use two spaces (not one) to separate
"directory" from its description, so help2man formats
the derived man page properly.

16 years agodoc: add example .bashrc code for a ~/.dircolors file
Reuben Thomas [Tue, 22 Jul 2008 22:25:04 +0000 (23:25 +0100)]
doc: add example .bashrc code for a ~/.dircolors file

* coreutils.texi: Add tip for .bashrc use from Jim Meyering.

16 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.

16 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.

16 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.

16 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.

16 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.

16 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.

16 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>