diff lib/human.h @ 1137:2c9059ccc457

New file. The interface is inspired by the human_readable function that was in du.c, but it's pretty much rewritten from scratch.
author Jim Meyering <jim@meyering.net>
date Sun, 30 Nov 1997 10:24:32 +0000
parents
children 8b39b9c51414
line wrap: on
line diff
new file mode 100644
--- /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_ */