summaryrefslogtreecommitdiffstats
path: root/contrib/gnu-sort/lib/human.h
diff options
context:
space:
mode:
authorache <ache@FreeBSD.org>2002-06-08 07:47:23 +0000
committerache <ache@FreeBSD.org>2002-06-08 07:47:23 +0000
commit0ec16ad8f3387117932b28e20a6db5928a4fde52 (patch)
treedf6286a6fcf07f34f9d04f5eb0fb2d7fa679a09c /contrib/gnu-sort/lib/human.h
downloadFreeBSD-src-0ec16ad8f3387117932b28e20a6db5928a4fde52.zip
FreeBSD-src-0ec16ad8f3387117932b28e20a6db5928a4fde52.tar.gz
Virgin import (trimmed) of GNU Sort, textutils 2.0.21
Diffstat (limited to 'contrib/gnu-sort/lib/human.h')
-rw-r--r--contrib/gnu-sort/lib/human.h39
1 files changed, 39 insertions, 0 deletions
diff --git a/contrib/gnu-sort/lib/human.h b/contrib/gnu-sort/lib/human.h
new file mode 100644
index 0000000..4ec9f0d
--- /dev/null
+++ b/contrib/gnu-sort/lib/human.h
@@ -0,0 +1,39 @@
+#ifndef HUMAN_H_
+# define HUMAN_H_ 1
+
+# if HAVE_CONFIG_H
+# include <config.h>
+# endif
+
+# if HAVE_INTTYPES_H
+# include <inttypes.h>
+# 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)
+
+# 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
+};
+
+char *human_readable PARAMS ((uintmax_t, char *, int, int));
+char *human_readable_inexact PARAMS ((uintmax_t, char *, int, int,
+ enum human_inexact_style));
+
+void human_block_size PARAMS ((char const *, int, int *));
+
+#endif /* HUMAN_H_ */
OpenPOWER on IntegriCloud