Jim Meyering [Wed, 6 Nov 2002 10:32:41 +0000 (10:32 +0000)]
Add support for locale-specific size indications (e.g.,
thousands-separators) and for explicit size suffixes on output.
(Block size): Say that:
This affects display format as well as block size.
Fractional block counts are rounded up.
ls file size blocksize defaults to 1.
A block size spec preceded by ' generates thousands separators.
A suffix without a preceding integer generates suffixes.
(tail invocation): 32k -> 32 KiB.
(What information is listed): ls -h is now equivalent to
ls --block-size=human, and ls -H is now equivalent to
ls --block-size=si. Displayed file size is now always affected by
--block-size.
Jim Meyering [Tue, 5 Nov 2002 20:28:36 +0000 (20:28 +0000)]
(dopass):
Use primitives from inttostr.h, not human.h, to print large numbers simply.
(OUTPUT_BLOCK_SIZE): remove.
(dopass): When printing progress, use floor for what has been done
so far (since we should be conservative there), and ceiling for
what needs to be done (since that's what other programs use).
Jim Meyering [Sat, 19 Oct 2002 16:34:25 +0000 (16:34 +0000)]
(cwrite): Change type of `bytes' parameter to size_t
Remove now-useless cast.
(stdread): Remove function.
(bytes_split): Use size_t instead of int.
Use safe_read, not stdread.
(lines_split): Likewise.
Use memchr rather than a `while' loop.
(line_bytes_split): Use size_t instead of int.
Use safe_read, not stdread.
(main): Add some FIXME comments to remind me to remove casts.
Jim Meyering [Sat, 19 Oct 2002 13:48:04 +0000 (13:48 +0000)]
Rewrite to support locale-specific
notations like thousands separators.
Specify what includer of include.h must include beforehand.
(human_group_digits, human_suppress_point_zero, human_autoscale,
human_base_1024, human_SI, human_B): New enum values.
(human_readable): Rename from human_readable_inexact; put the
options before the sizes. All uses changed. The old human_readable
function has been removed; use inttostr.h instead.
(human_options): Renamed from human_block_size, with new signature
that allows block sizes up to UINTMAX_MAX. All callers changed.
Jim Meyering [Thu, 17 Oct 2002 15:06:36 +0000 (15:06 +0000)]
Fix a problem that could make cat misbehave on systems which
give invalid (unreasonably large) values for stat.st_blksize.
(ST_BLKSIZE): Ensure that the result is in [1..4MB].
Jim Meyering [Mon, 14 Oct 2002 08:29:41 +0000 (08:29 +0000)]
Specifying a printf conversion specifer as nl's separator string
could cause nl to segfault.
(build_print_fmt): Don't include separator string
in the printf format; it might contain `%'.
Use a better bound on the length of the print_fmt buffer.
(print_lineno): Print the separator here instead.
Jim Meyering [Sun, 13 Oct 2002 13:59:25 +0000 (13:59 +0000)]
(count_entry): Also save cwd when dereferencing (via --dereference-args, -D)
a command-line argument.
Reported by Michal Svec. Based on a patch by Andreas Schwab.
Jim Meyering [Sun, 13 Oct 2002 12:22:26 +0000 (12:22 +0000)]
There's no need to futz with the rounding mode,
since the code should work properly even in the default rounding mode.
(<fenv.h>): Do not include.
(#pragma STDC FENV_ACCESS ON): Remove.
(xnanosleep): Don't futz with rounding state.
Jim Meyering [Sat, 12 Oct 2002 09:44:06 +0000 (09:44 +0000)]
(struct cstring) [len]: Declare to be unsigned int,
since that's how it's always used and avoids a new warning from gcc.
(read_input): Adapt to new safe_read ABI.
Jim Meyering [Sat, 12 Oct 2002 08:39:12 +0000 (08:39 +0000)]
tail -c +N would perform an extra read after encountering EOF
[this change is analogous (bytes vs. lines) to the one of 2002-01-27]
(start_bytes): Detect EOF, inform caller.
(tail_bytes): Upon EOF in start_bytes, return immediately.
(file_lines): Reorganize to use memrchr rather than an explicit loop.
Adapt to new safe_read ABI.