X-Git-Url: https://git.cameronkatri.com/bsdgames-darwin.git/blobdiff_plain/9649fe0209de88926626165951e2db3043b73ee6..c2997b6e22cfa183e7e73501ecdb2d5020434c9a:/number/number.c?ds=sidebyside diff --git a/number/number.c b/number/number.c index 954359fe..5cf41705 100644 --- a/number/number.c +++ b/number/number.c @@ -1,4 +1,4 @@ -/* $NetBSD: number.c,v 1.10 2004/11/05 21:30:32 dsl Exp $ */ +/* $NetBSD: number.c,v 1.15 2012/06/19 05:46:09 dholland Exp $ */ /* * Copyright (c) 1988, 1993, 1994 @@ -31,15 +31,15 @@ #include #ifndef lint -__COPYRIGHT("@(#) Copyright (c) 1988, 1993, 1994\n\ - The Regents of the University of California. All rights reserved.\n"); +__COPYRIGHT("@(#) Copyright (c) 1988, 1993, 1994\ + The Regents of the University of California. All rights reserved."); #endif /* not lint */ #ifndef lint #if 0 static char sccsid[] = "@(#)number.c 8.3 (Berkeley) 5/4/95"; #else -__RCSID("$NetBSD: number.c,v 1.10 2004/11/05 21:30:32 dsl Exp $"); +__RCSID("$NetBSD: number.c,v 1.15 2012/06/19 05:46:09 dholland Exp $"); #endif #endif /* not lint */ @@ -76,19 +76,17 @@ static const char *const name1[] = { "novemdecillion", "vigintillion", }; -void convert(char *); int main(int, char *[]); -int number(const char *, int); -void pfract(int); -int unit(int, const char *); -void usage(void) __attribute__((__noreturn__)); +static void convert(char *); +static int number(const char *, int); +static void pfract(int); +static int unit(int, const char *); +static void usage(void) __dead; -int lflag; +static int lflag; int -main(argc, argv) - int argc; - char *argv[]; +main(int argc, char *argv[]) { int ch, first; char line[256]; @@ -125,8 +123,7 @@ main(argc, argv) } void -convert(line) - char *line; +convert(char *line) { int flen, len, rval; char *p, *fraction; @@ -134,7 +131,7 @@ convert(line) flen = 0; fraction = NULL; for (p = line; *p != '\0' && *p != '\n'; ++p) { - if (isblank(*p)) { + if (isblank((unsigned char)*p)) { if (p == line) { ++line; continue; @@ -194,9 +191,7 @@ badnum: errx(1, "illegal number: %s", line); } int -unit(len, p) - int len; - const char *p; +unit(int len, const char *p) { int off, rval; @@ -230,9 +225,7 @@ unit(len, p) } int -number(p, len) - const char *p; - int len; +number(const char *p, int len) { int val, rval; @@ -270,8 +263,7 @@ number(p, len) } void -pfract(len) - int len; +pfract(int len) { static const char *const pref[] = { "", "ten-", "hundred-" }; @@ -289,7 +281,7 @@ pfract(len) } void -usage() +usage(void) { (void)fprintf(stderr, "usage: number [# ...]\n"); exit(1);