File: human.h

package info (click to toggle)
dcfldd 1.3.4.1-6
  • links: PTS, VCS
  • area: main
  • in suites: jessie, jessie-kfreebsd
  • size: 972 kB
  • ctags: 1,006
  • sloc: ansic: 7,840; sh: 3,338; makefile: 13
file content (39 lines) | stat: -rw-r--r-- 958 bytes parent folder | download | duplicates (19)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
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_ */