]> Dogcows Code - chaz/tar/blob - lib/human.h
Initial revision
[chaz/tar] / lib / human.h
1 #ifndef HUMAN_H_
2 # define HUMAN_H_ 1
3
4 # if HAVE_CONFIG_H
5 # include <config.h>
6 # endif
7
8 # if HAVE_INTTYPES_H
9 # include <inttypes.h>
10 # endif
11
12 /* A conservative bound on the maximum length of a human-readable string.
13 The output can be the product of the largest uintmax_t and the largest int,
14 so add their sizes before converting to a bound on digits. */
15 # define LONGEST_HUMAN_READABLE ((sizeof (uintmax_t) + sizeof (int)) \
16 * CHAR_BIT / 3)
17
18 # ifndef PARAMS
19 # if defined PROTOTYPES || (defined __STDC__ && __STDC__)
20 # define PARAMS(Args) Args
21 # else
22 # define PARAMS(Args) ()
23 # endif
24 # endif
25
26 enum human_inexact_style
27 {
28 human_floor = -1,
29 human_round_to_even = 0,
30 human_ceiling = 1
31 };
32
33 char *human_readable PARAMS ((uintmax_t, char *, int, int));
34 char *human_readable_inexact PARAMS ((uintmax_t, char *, int, int,
35 enum human_inexact_style));
36
37 void human_block_size PARAMS ((char const *, int, int *));
38
39 #endif /* HUMAN_H_ */
This page took 0.039121 seconds and 5 git commands to generate.