summaryrefslogtreecommitdiff
path: root/src/bin/tyls.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/bin/tyls.c')
-rw-r--r--src/bin/tyls.c16
1 files changed, 8 insertions, 8 deletions
diff --git a/src/bin/tyls.c b/src/bin/tyls.c
index 84761da..f381b32 100644
--- a/src/bin/tyls.c
+++ b/src/bin/tyls.c
@@ -44,20 +44,20 @@ echo_on(void)
44} 44}
45 45
46static void 46static void
47size_print(char *buf, int bufsz, char *sz, unsigned long long size) 47size_print(char *buf, int bufsz, char *sz, long long size)
48{ 48{
49 char prefixes[] = " KMGTPEZY"; 49 char *prefix = " KMGTPEZY";
50 int i = 0;
51 50
52 while (prefixes[i]) 51 while (*prefix)
53 { 52 {
54 if (size < (1024ULL << 10 * i) || !prefixes[i]) 53 if ((size < 1024) || (*prefix == 'Y'))
55 { 54 {
56 snprintf(buf, bufsz, "%4lld", size / (1024 << 10 * (i - 1))); 55 snprintf(buf, bufsz, "%4lld", size);
57 *sz = prefixes[i]; 56 *sz = *prefix;
58 return; 57 return;
59 } 58 }
60 ++i; 59 size >>= 10;
60 prefix++;
61 } 61 }
62} 62}
63 63