X-Git-Url: http://erislabs.net/gitweb/?a=blobdiff_plain;f=lib%2Fhuman.h;h=4ec9f0da8602f1620291b58828ca712f2527aec0;hb=02461019940d8fa70f111461c823338a9d1284e4;hp=65a25975fc52974fa9be119efec88c868e45d0cf;hpb=1bbd61b95a3b89e7ca993880d5c44ca391d54f0a;p=gnulib.git diff --git a/lib/human.h b/lib/human.h index 65a25975f..4ec9f0da8 100644 --- a/lib/human.h +++ b/lib/human.h @@ -1,19 +1,39 @@ #ifndef HUMAN_H_ # define HUMAN_H_ 1 +# if HAVE_CONFIG_H +# include +# endif + +# if HAVE_INTTYPES_H +# include +# endif + /* A conservative bound on the maximum length of a human-readable string. The output can be the product of the largest uintmax_t and the largest int, so add their sizes before converting to a bound on digits. */ -#define LONGEST_HUMAN_READABLE ((sizeof (uintmax_t) + sizeof (int)) * CHAR_BIT / 3) +# define LONGEST_HUMAN_READABLE ((sizeof (uintmax_t) + sizeof (int)) \ + * CHAR_BIT / 3) + +# ifndef PARAMS +# if defined PROTOTYPES || (defined __STDC__ && __STDC__) +# define PARAMS(Args) Args +# else +# define PARAMS(Args) () +# endif +# endif + +enum human_inexact_style +{ + human_floor = -1, + human_round_to_even = 0, + human_ceiling = 1 +}; -#ifndef __P -# if defined (__GNUC__) || (defined (__STDC__) && __STDC__) -# define __P(args) args -# else -# define __P(args) () -# endif /* GCC. */ -#endif /* Not __P. */ +char *human_readable PARAMS ((uintmax_t, char *, int, int)); +char *human_readable_inexact PARAMS ((uintmax_t, char *, int, int, + enum human_inexact_style)); -char *human_readable __P ((uintmax_t, char *, int, int, int)); +void human_block_size PARAMS ((char const *, int, int *)); #endif /* HUMAN_H_ */