diff options
author | Jim Meyering <jim@meyering.net> | 1997-11-30 10:24:32 +0000 |
---|---|---|
committer | Jim Meyering <jim@meyering.net> | 1997-11-30 10:24:32 +0000 |
commit | 1bbd61b95a3b89e7ca993880d5c44ca391d54f0a (patch) | |
tree | ca73e2e3f91ccc62835477ceda08f578aa00afbf /lib/human.h | |
parent | d79fd750b103b0c7734cd599ffd358de79bbe13f (diff) | |
download | gnulib-1bbd61b95a3b89e7ca993880d5c44ca391d54f0a.tar.gz |
New file. The interface is inspired
by the human_readable function that was in du.c, but it's pretty
much rewritten from scratch.
Diffstat (limited to 'lib/human.h')
-rw-r--r-- | lib/human.h | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/lib/human.h b/lib/human.h new file mode 100644 index 0000000000..65a25975fc --- /dev/null +++ b/lib/human.h @@ -0,0 +1,19 @@ +#ifndef HUMAN_H_ +# define HUMAN_H_ 1 + +/* 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) + +#ifndef __P +# if defined (__GNUC__) || (defined (__STDC__) && __STDC__) +# define __P(args) args +# else +# define __P(args) () +# endif /* GCC. */ +#endif /* Not __P. */ + +char *human_readable __P ((uintmax_t, char *, int, int, int)); + +#endif /* HUMAN_H_ */ |