Add exit.h, time_r.c, time_r.h.
[debian/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 # if HAVE_LIMITS_H
13 #  include <limits.h>
14 # endif
15 # ifndef CHAR_BIT
16 #  define CHAR_BIT 8
17 # endif
18
19 /* A conservative bound on the maximum length of a human-readable string.
20    The output can be the product of the largest uintmax_t and the largest int,
21    so add their sizes before converting to a bound on digits.  */
22 # define LONGEST_HUMAN_READABLE ((sizeof (uintmax_t) + sizeof (int)) \
23                                  * CHAR_BIT / 3)
24
25 # ifndef PARAMS
26 #  if defined PROTOTYPES || (defined __STDC__ && __STDC__)
27 #   define PARAMS(Args) Args
28 #  else
29 #   define PARAMS(Args) ()
30 #  endif
31 # endif
32
33 enum human_inexact_style
34 {
35   human_floor = -1,
36   human_round_to_even = 0,
37   human_ceiling = 1
38 };
39
40 char *human_readable PARAMS ((uintmax_t, char *, int, int));
41 char *human_readable_inexact PARAMS ((uintmax_t, char *, int, int,
42                                       enum human_inexact_style));
43
44 void human_block_size PARAMS ((char const *, int, int *));
45
46 #endif /* HUMAN_H_ */