summaryrefslogtreecommitdiff
path: root/lib/human.h
diff options
context:
space:
mode:
authorJim Meyering <jim@meyering.net>1997-11-30 10:24:32 +0000
committerJim Meyering <jim@meyering.net>1997-11-30 10:24:32 +0000
commit240cb49efec335cd60eb65e35742ca292400fdc3 (patch)
tree4611a0f8cce0fa3a8d919dd8f5159cdf786b43c2 /lib/human.h
parent412d0aba5018ebfc39e32913e7f420ee5ffeeb1d (diff)
downloadcoreutils-240cb49efec335cd60eb65e35742ca292400fdc3.tar.xz
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.h19
1 files changed, 19 insertions, 0 deletions
diff --git a/lib/human.h b/lib/human.h
new file mode 100644
index 000000000..65a25975f
--- /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_ */