diff options
author | 2003-05-15 01:26:26 +0000 | |
---|---|---|
committer | 2003-05-15 01:26:26 +0000 | |
commit | f353b857bfd3e0b8724375e78ff1891fc4177a14 (patch) | |
tree | a399e54657fe1443806c456a5d151a4ba17c86ad /lib/libutil/util.h | |
parent | Add a -q flag to suppress all output when setting a variable, and (diff) | |
download | wireguard-openbsd-f353b857bfd3e0b8724375e78ff1891fc4177a14.tar.xz wireguard-openbsd-f353b857bfd3e0b8724375e78ff1891fc4177a14.zip |
New: fmt_scaled() and scan_scaled() convert to and from "human readable"
or scaled numbers. fmt_scaled, and the format, based on Ken Stailey's
code for "df -h"; scan_scaled is new. Significantly commented on
and reworked by pjanzen@; other comments from millert@. OK pjanzen@.
Diffstat (limited to 'lib/libutil/util.h')
-rw-r--r-- | lib/libutil/util.h | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/lib/libutil/util.h b/lib/libutil/util.h index ff388e5aa46..4a2780826d2 100644 --- a/lib/libutil/util.h +++ b/lib/libutil/util.h @@ -1,4 +1,4 @@ -/* $OpenBSD: util.h,v 1.22 2002/06/21 16:37:11 millert Exp $ */ +/* $OpenBSD: util.h,v 1.23 2003/05/15 01:26:26 ian Exp $ */ /* $NetBSD: util.h,v 1.2 1996/05/16 07:00:22 thorpej Exp $ */ /*- @@ -71,6 +71,11 @@ #define UU_LOCK_OWNER_ERR (-7) /* + * fmt_scaled(3) specific flags. + */ +#define FMT_SCALED_STRSIZE 7 /* minus sign, 4 digits, suffix, null byte */ + +/* * stub struct definitions. */ struct __sFILE; @@ -113,6 +118,8 @@ const char *uu_lockerr(int _uu_lockresult); int uu_lock(const char *_ttyname); int uu_lock_txfr(const char *_ttyname, pid_t _pid); int uu_unlock(const char *_ttyname); +int fmt_scaled(long long number, char *result); +int scan_scaled(char *scaled, long long *result); __END_DECLS #endif /* !_UTIL_H_ */ |