lib/human.c


Log

Author Commit Date CI Message
Paul Eggert ba21d44f 2003-08-14T23:00:25 Include stdio.h, for sprintf.
Paul Eggert ac600b55 2003-06-05T04:35:13 Merge human.c changes from coreutils.
Paul Eggert 552a680f 2003-05-29T07:21:59 in lib: * addext.c, backupfile.c, fsusage.c, human.c, pathmax.h, rpmatch.c, userspec.c, xreadlink.c, xstrtol.c: Include <limits.h> without checking for HAVE_LIMITS_H. * backupfile.c, fsusage.c, hash.c, human.c, safe-read.c, userspec.c, xstrtol.c (CHAR_BIT) : Don't define, since <limits.h> is guaranteed to do that. * fatal.c: Include <stdarg.h> without checking for __STDC__. * exclude.c: Include <stdbool.h> unconditionally. * tempname.c: Include <stddef.h> unconditionally. * hash.c: Include <limits.h>, since we no longer define CHAR_BIT. * modechange.c, rpmatch.c (NULL): Don't define, since <stddef.h> does that. * quote.c: Dont include <stddef.h> or <sys/types.h>; not needed. * safe-read.c (INT_MAX): Don't define, since <limits.h> does that. * safe-read.c (TYPE_MINIMUM, TYPE_MAXIMUM): Remove; no longer needed. * xstrtol.c: Likewise. * safe-read.c: Remove TYPE_SIGNED; no longer needed. * savedir.c: Include <stddef.h> instead of defining NULL. in m4: * backupfile.m4 (gl_BACKUPFILE): Don't check for limits.h. * fsusage.m4 (gl_PREREQ_FSUSAGE_EXTRA): Likewise. * human.m4 (gl_HUMAN): Likewise. * pathmax.m4 (gl_PATHMAX): Likewise. * rpmatch.m4 (gl_FUNC_RPMATCH): Likewise. * userspec.m4 (gl_USERSPEC): Likewise. * xreadlink.m4 (gl_XREADLINK): Likewise. * m4/xstrtol.m4 (gl_PREREQ_XSTRTOL): Likewise. * quote.m4 (gl_QUOTE): Don't check for stddef.h.
Bruno Haible f9fa25dc 2002-11-05T21:45:29 Include gettext.h instead of <libintl.h> with #ifdefs.
Jim Meyering 71625244 2001-12-19T15:05:33 (suffixes): Prefer K to k for 1024. (generate_suffix_backwards): New function. (human_readable_inexact): Use it.
Jim Meyering e7c9de64 2000-06-16T12:51:28 (adjust_value): New function. (human_readable_inexact): Apply rounding style even when printing approximate values.
Jim Meyering d3551c3d 2000-06-15T12:21:10 (human_readable_inexact): Allow an input block size that is not a multiple of the output block size, and vice versa.
Jim Meyering de1b0c61 2000-02-27T17:54:25 use double quotes, not single quotes around syntax-error-evoking string
Jim Meyering d9f6701e 2000-02-27T17:39:52 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.
Jim Meyering 0599e5c9 1999-11-07T21:06:02 (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.
Jim Meyering f1d77440 1999-07-04T08:47:28 (human_readable): New function. (human_readable_inexact): Renamed from human_readable, with new arg INEXACT_STYLE. Add support for ceiling and floor.
Jim Meyering 615e02f2 1999-05-17T13:03:46 (human_readable): Allow from_block_size to be zero.
Jim Meyering 150e3921 1999-05-13T20:48:44 Include <string.h> or <strings.h> for strlen prototype.
Jim Meyering 4abb9676 1999-04-25T19:18:55 Don't include inttypes.h here.
Jim Meyering 7cc21036 1999-04-18T23:18:32 Include xstrtol.h, not xstrtoul.h, since xstrtol.h now defines all the xstrto... functions.
Jim Meyering f8715f3a 1999-01-01T06:47:04 (humblock): Use ARGMATCH in place of argmatch.
Jim Meyering 23360fcb 1998-07-22T18:30:16 (human_readable): amt -> damt, to fix typo when computing which power to use after overflow occurs during multiplication. From Paul Eggert.
Jim Meyering 96e78d1f 1998-06-29T15:23:04 * 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.
Jim Meyering 42313b42 1997-11-30T11:10:24 (human_readable): Convert to ANSI-style definition. [lint]: Define `power'.
Jim Meyering 1bbd61b9 1997-11-30T10:24:32 New file. The interface is inspired by the human_readable function that was in du.c, but it's pretty much rewritten from scratch.