sbase

suckless unix tools
git clone git://git.2f30.org/sbase
Log | Files | Refs | README | LICENSE

commit 2deb40290e3f8248846f8e5390b88b1a2f0dd5f2
parent 42326f7684db7cef2357319931e918dd42f11180
Author: sin <sin@2f30.org>
Date:   Tue, 28 Apr 2015 11:48:05 +0100

Use off_t in humansize() as it is more descriptive and applicable

Diffstat:
Mlibutil/human.c | 4++--
Mutil.h | 3+--
2 files changed, 3 insertions(+), 4 deletions(-)

diff --git a/libutil/human.c b/libutil/human.c @@ -6,7 +6,7 @@ #include "../util.h" char * -humansize(uintmax_t n) +humansize(off_t n) { static char buf[16]; const char postfixes[] = "BKMGTPE"; @@ -17,7 +17,7 @@ humansize(uintmax_t n) size /= 1024; if (!i) - snprintf(buf, sizeof(buf), "%ju", n); + snprintf(buf, sizeof(buf), "%ju", (uintmax_t)n); else snprintf(buf, sizeof(buf), "%.1f%c", size, postfixes[i]); diff --git a/util.h b/util.h @@ -3,7 +3,6 @@ #include <regex.h> #include <stddef.h> -#include <stdint.h> #include <stdio.h> #include "arg.h" @@ -67,7 +66,7 @@ int eregcomp(regex_t *, const char *, int); void enmasse(int, char **, int (*)(const char *, const char *, int)); void fnck(const char *, const char *, int (*)(const char *, const char *, int), int); mode_t getumask(void); -char *humansize(uintmax_t); +char *humansize(off_t); mode_t parsemode(const char *, mode_t, mode_t); void putword(FILE *, const char *); #undef strtonum