Commit Graph

33 Commits

Author SHA1 Message Date
Jim Meyering
116e6fb244 Update FSF postal mail address. 2005-05-14 07:58:06 +00:00
Jim Meyering
89e0ab6c9e (humblock): Set *options even when returning due to
xstrtoumax conversion failure.  Thanks to a used-uninitialized
warning from gcc-4.
2005-04-09 12:35:41 +00:00
Paul Eggert
67f958c224 Include intprops.h.
(group_number): Use INT_STRLEN_BOUND instead of rolling it ourself.
2005-03-09 19:22:05 +00:00
Paul Eggert
364168a817 * human.c (SIZE_MAX, UINTMAX_MAX): Move these conditional
definitions to be after all include files, to avoid collisions.
2005-01-04 18:49:44 +00:00
Paul Eggert
08da1bb439 Assume <locale.h> exists.
(human_readable): Assume localeconv exists.
2004-12-02 06:52:10 +00:00
Paul Eggert
7ce1f197f3 (human_readable): Support human_space_before_unit. 2004-11-16 07:53:08 +00:00
Paul Eggert
aebe589261 unsigned -> unsigned int 2004-08-02 22:58:22 +00:00
Jim Meyering
8c5584a151 Sync from gnulib. 2004-04-04 06:51:11 +00:00
Jim Meyering
226248d531 (humblock): Support BLOCKSIZE envvar, as well as BLOCK_SIZE. 2004-03-24 17:36:57 +00:00
Jim Meyering
7edceab01c Sync with gnulib. 2003-10-15 07:26:01 +00:00
Jim Meyering
890fdbf0c4 Include <stdlib.h>, <string.h> unconditionally.
(getenv): Do not declare.
2003-09-10 08:49:12 +00:00
Jim Meyering
a42a4b7bd3 (human_readable): Fix bug that rounded 10501 to 10k.
Bug reported by Lute Kamstra in
<http://mail.gnu.org/archive/html/bug-gnulib/2003-09/msg00003.html>.
2003-09-03 20:30:25 +00:00
Jim Meyering
6118590130 Include <stdio.h>, once again, for declaration of sprintf. 2003-06-06 22:37:23 +00:00
Jim Meyering
47158d0de8 Merge from gnulib. 2003-06-06 19:15:40 +00:00
Jim Meyering
f559a4c800 (human_readable): Revamp to avoid warning about unused
variable 'amt'.  Unfortunately this means using some gotos.
2002-11-09 21:46:45 +00:00
Jim Meyering
554ecec785 (human_readable): Avoid warnings from gcc -Wshadow. 2002-11-08 15:33:30 +00:00
Jim Meyering
dce67bd261 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.
2002-10-19 13:48:04 +00:00
Jim Meyering
44dcbba28a (suffixes): Prefer K to k for 1024.
(generate_suffix_backwards): New function.
(human_readable_inexact): Use it.
2001-12-19 15:05:33 +00:00
Jim Meyering
ff5aea354f (adjust_value): New function.
(human_readable_inexact): Apply rounding style even when
printing approximate values.
2000-06-16 12:51:28 +00:00
Jim Meyering
fbc3c192c1 (human_readable_inexact): Allow an input block
size that is not a multiple of the output block size, and vice versa.
2000-06-15 12:21:10 +00:00
Jim Meyering
4fef810c37 use double quotes, not single quotes around syntax-error-evoking string 2000-02-27 17:54:25 +00:00
Jim Meyering
8041fd5301 Use #if !HAVE_DECL...' instead of #ifndef HAVE_DECL..'
now that autoconf always defines the HAVE_DECL_ symbols.

Arrange for cpp to fail if the configure-time
declaration check was not run.
2000-02-27 17:40:24 +00:00
Jim Meyering
41c5f76c2f (default_block_size): New function.
(humblock): Use it if no block size is specified.
(human_block_size): If the specified block size is zero, report an
error if report_errors is nonzero; otherwise use the default.
1999-11-07 21:06:02 +00:00
Jim Meyering
8999870c56 (human_readable): New function.
(human_readable_inexact): Renamed from human_readable, with new arg
INEXACT_STYLE.  Add support for ceiling and floor.
1999-07-04 08:47:28 +00:00
Jim Meyering
1ee4fffc88 (human_readable): Allow from_block_size to be zero. 1999-05-17 13:03:46 +00:00
Jim Meyering
c93ac403ed Include <string.h> or <strings.h> for strlen prototype. 1999-05-13 20:48:44 +00:00
Jim Meyering
e3a368948e Don't include inttypes.h here. 1999-04-25 19:18:55 +00:00
Jim Meyering
30edff7a36 Include xstrtol.h, not xstrtoul.h, since xstrtol.h now defines all the
xstrto... functions.
1999-04-18 23:18:32 +00:00
Jim Meyering
2d4f0fea3a (humblock): Use ARGMATCH in place of argmatch. 1999-01-01 06:47:04 +00:00
Jim Meyering
3b87431a69 (human_readable): amt -> damt, to fix typo when
computing which power to use after overflow occurs during
multiplication.

From Paul Eggert.
1998-07-22 18:30:16 +00:00
Jim Meyering
ea7102f120 * lib/human.c, lib/human.h (human_readable): Coalesce last two args
into one, for convenience.  All callers changed.
	(human_block_size): New function.
	* lib/human.c: Include <config.h> only if HAVE_CONFIG_H.
	Include <stdlib.h> if HAVE_STDLIB_H;
	declare getenv unless HAVE_DECL_GETENV.
	(_): New macro.
	Include <argmatch.h>, <error.h>, <xstrtoul.h>.
	(DEFAULT_BLOCK_SIZE): New macro.
	(block_size_args, block_size_types): New constants.
	(humblock): New function.
1998-06-29 15:23:04 +00:00
Jim Meyering
00c42a8936 (human_readable): Convert to ANSI-style definition.
[lint]: Define `power'.
1997-11-30 11:10:24 +00:00
Jim Meyering
240cb49efe New file. The interface is inspired
by the human_readable function that was in du.c, but it's pretty
much rewritten from scratch.
1997-11-30 10:24:32 +00:00