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.
Jim Meyering [Wed, 9 Oct 2002 07:28:11 +0000 (07:28 +0000)]
Mark this as an expensive test; it would
consume 4GB of disk space on systems without support for sparse files.
Fix a logic error that'd make it `cat err' even though dd didn't fail.
Jim Meyering [Sun, 6 Oct 2002 16:17:56 +0000 (16:17 +0000)]
(scanargs): Ensure that specified block sizes (specified
via ibs=N, obs=N, and bs=N) are no larger than SSIZE_MAX.
(skip, dd_copy): Adapt to new safe_read ABI.