human

output numbers in human-readable formats
git clone git://z3bra.org/human
Log | Files | Refs | README | LICENSE

commit 40b4dac2617605d9985a2ec49936c48ae8d53efb
parent 696b6dd08c4c5f53b674a55a625fdbd6e2c70e58
Author: z3bra <willy@mailoo.org>
Date:   Tue Nov  4 13:42:51 2014

Added usage() function

Diffstat:
 human.c | 12 ++++++++----
 1 file changed, 8 insertions(+), 4 deletions(-)

diff --git a/human.c b/human.c @@ -28,6 +28,13 @@ #define DEFAULT_SCALE 0 +/* dumb user is dumb.. */ +void usage (char *progname) +{ + printf("usage: %s [-hkmgt] <number>\n", progname); + return; /* void */ +} + /* * calculate a power of number * disclaimers: return no more than a "long" so use wisely... @@ -97,10 +104,7 @@ int main (int argc, char **argv) /* only switches are use to force factorization */ while ((ch = getopt(argc, argv, "hkmgt")) != -1) { switch (ch) { - case 'h': - printf("usage: %s [-hkmgt] <number>\n", argv[0]); - exit(0); - break; + case 'h': usage(argv[0]); exit(0); break; case 't': fac ='T'; break; case 'g': fac ='G'; break; case 'm': fac ='M'; break;