blob: 9791cddf27b914f2a52fecf5a5f10a5c0c3e9cd6 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
|
#ifndef _OPENBSD_COMPAT_UTIL_H_
#define _OPENBSD_COMPAT_UTIL_H_
#if defined(__FreeBSD__)
#include <libutil.h>
#endif
/*
* fmt_scaled(3) specific flags.
*/
#define FMT_SCALED_STRSIZE 7 /* minus sign, 4 digits, suffix, null byte */
#define fmt_scaled(number, result) ({ \
int64_t num = number; \
int r = humanize_number(result, \
FMT_SCALED_STRSIZE - (num < 0 ? 0 : 1), \
num, "", HN_AUTOSCALE, HN_NOSPACE | HN_B); \
r == -1 ? -1 : 0; \
})
#endif
|