diff options
author | Rob Landley <rob@landley.net> | 2015-09-03 20:36:44 -0500 |
---|---|---|
committer | Rob Landley <rob@landley.net> | 2015-09-03 20:36:44 -0500 |
commit | d06ea3708d12e3e87fa26441715ac47f6dc63032 (patch) | |
tree | 18a517dd614a27ec99b36f51822a90d3a1155736 /lib/lib.h | |
parent | 5640847b0328c5319f353eed985781e166547ef7 (diff) | |
download | toybox-d06ea3708d12e3e87fa26441715ac47f6dc63032.tar.gz |
Make human_readable() handle base 1024 units without floating point.
Rounds correctly via brute force, displayed digits are decimal even when
working with powers of 2, shows at most 3 significant (decimal) digits.
(So no "1023M" nonsense, that's 1.0G.)
Diffstat (limited to 'lib/lib.h')
-rw-r--r-- | lib/lib.h | 8 |
1 files changed, 5 insertions, 3 deletions
@@ -177,12 +177,14 @@ void replace_tempfile(int fdin, int fdout, char **tempname); void crc_init(unsigned int *crc_table, int little_endian); void base64_init(char *p); int yesno(char *prompt, int def); -#define HR_SPACE 1 -#define HR_B 2 -int human_readable(char *buf, unsigned long long num, int style); int qstrcmp(const void *a, const void *b); int xpoll(struct pollfd *fds, int nfds, int timeout); +#define HR_SPACE 1 +#define HR_B 2 +#define HR_SI 4 +int human_readable(char *buf, unsigned long long num, int style); + // interestingtimes.c int xgettty(void); int terminal_size(unsigned *xx, unsigned *yy); |