human

convert bytes to human readable formats
git clone git://git.2f30.org/human
Log | Files | Refs | README | LICENSE

commit 696b6dd08c4c5f53b674a55a625fdbd6e2c70e58
parent b9a184f61f01aca16e52978b132f09edef80f40b
Author: z3bra <willy@mailoo.org>
Date:   Tue,  4 Nov 2014 13:28:45 +0100

Fixed a misbehaving power calculation

Diffstat:
Mhuman.c | 4++--
1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/human.c b/human.c @@ -35,7 +35,7 @@ */ long power (long number, int pow) { - return pow > 0 ? power(number * number, pow - 1) : number; + return pow > 0 ? number * power(number, pow - 1) : number; } /* @@ -111,7 +111,7 @@ int main (int argc, char **argv) /* get the number. if there is not, strtold will return 0 */ number = strtold(argv[argc - 1], NULL); - if (number < 0) { + if (number <= 0) { errx(EXIT_FAILURE, "I ain't gonna do it. Deal with it."); }