summaryrefslogtreecommitdiffstats
path: root/libutil
diff options
context:
space:
mode:
authorPawel Jakub Dawidek <pjd@FreeBSD.org>2004-05-24 22:19:27 +0000
committerPawel Jakub Dawidek <pjd@FreeBSD.org>2004-05-24 22:19:27 +0000
commit23a09eb7376beae7ffca03c3466b1fa7d003a5ca (patch)
treee55d5f6b55803c8dfc3b7b8cb3c7532a4b38c9fb /libutil
parent47742242fa3abeb1a59690c8ac494a080a0f4f2b (diff)
downloadpw-darwin-23a09eb7376beae7ffca03c3466b1fa7d003a5ca.tar.gz
pw-darwin-23a09eb7376beae7ffca03c3466b1fa7d003a5ca.tar.zst
pw-darwin-23a09eb7376beae7ffca03c3466b1fa7d003a5ca.zip
Add humanize_number(3) to libutil for formating numbers into a human
readable form. Obtained from: NetBSD
Diffstat (limited to 'libutil')
-rw-r--r--libutil/libutil.h11
1 files changed, 11 insertions, 0 deletions
diff --git a/libutil/libutil.h b/libutil/libutil.h
index fbc68c0..3042d0f 100644
--- a/libutil/libutil.h
+++ b/libutil/libutil.h
@@ -69,6 +69,8 @@ int openpty(int *_amaster, int *_aslave, char *_name,
struct termios *_termp, struct winsize *_winp);
int forkpty(int *_amaster, char *_name,
struct termios *_termp, struct winsize *_winp);
+int humanize_number(char *_buf, size_t _len, int64_t _number,
+ const char *_suffix, int _scale, int _flags);
const char *uu_lockerr(int _uu_lockresult);
int uu_lock(const char *_ttyname);
int uu_unlock(const char *_ttyname);
@@ -129,4 +131,13 @@ __END_DECLS
#define PWSCAN_MASTER 0x01
#define PWSCAN_WARN 0x02
+/* humanize_number(3) */
+#define HN_DECIMAL 0x01
+#define HN_NOSPACE 0x02
+#define HN_B 0x04
+#define HN_DIVISOR_1000 0x08
+
+#define HN_GETSCALE 0x10
+#define HN_AUTOSCALE 0x20
+
#endif /* !_LIBUTIL_H_ */