diff options
author | jsm <jsm@NetBSD.org> | 1999-09-08 21:17:44 +0000 |
---|---|---|
committer | jsm <jsm@NetBSD.org> | 1999-09-08 21:17:44 +0000 |
commit | 04f4d7044367099914cf1906ae27ac20c24e44cf (patch) | |
tree | c17cb5c2f270bbb70eeba18cbe2bcfa43cfd8e10 /number | |
parent | f9706028dd6e2afabb6bd63d02d7bc90f78e4aab (diff) | |
download | bsdgames-darwin-04f4d7044367099914cf1906ae27ac20c24e44cf.tar.gz bsdgames-darwin-04f4d7044367099914cf1906ae27ac20c24e44cf.tar.zst bsdgames-darwin-04f4d7044367099914cf1906ae27ac20c24e44cf.zip |
Add use of `const' where appropriate to the games.
This merges in all such remaining changes from the Linux port of the
NetBSD games, except in hunt (where substantial changes from OpenBSD
need to be looked at).
Some such changes were previously covered in PRs bin/6041, bin/6146,
bin/6148, bin/6150, bin/6151, bin/6580, bin/6660, bin/7993, bin/7994,
bin/8039, bin/8057 and bin/8093.
Diffstat (limited to 'number')
-rw-r--r-- | number/number.c | 21 |
1 files changed, 10 insertions, 11 deletions
diff --git a/number/number.c b/number/number.c index e3727344..97112544 100644 --- a/number/number.c +++ b/number/number.c @@ -1,4 +1,4 @@ -/* $NetBSD: number.c,v 1.6 1998/09/13 15:24:57 hubertf Exp $ */ +/* $NetBSD: number.c,v 1.7 1999/09/08 21:17:53 jsm Exp $ */ /* * Copyright (c) 1988, 1993, 1994 @@ -43,7 +43,7 @@ __COPYRIGHT("@(#) Copyright (c) 1988, 1993, 1994\n\ #if 0 static char sccsid[] = "@(#)number.c 8.3 (Berkeley) 5/4/95"; #else -__RCSID("$NetBSD: number.c,v 1.6 1998/09/13 15:24:57 hubertf Exp $"); +__RCSID("$NetBSD: number.c,v 1.7 1999/09/08 21:17:53 jsm Exp $"); #endif #endif /* not lint */ @@ -58,19 +58,19 @@ __RCSID("$NetBSD: number.c,v 1.6 1998/09/13 15:24:57 hubertf Exp $"); #define MAXNUM 65 /* Biggest number we handle. */ -static char *name1[] = { +static const char *const name1[] = { "", "one", "two", "three", "four", "five", "six", "seven", "eight", "nine", "ten", "eleven", "twelve", "thirteen", "fourteen", "fifteen", "sixteen", "seventeen", "eighteen", "nineteen", }, - *name2[] = { + *const name2[] = { "", "ten", "twenty", "thirty", "forty", "fifty", "sixty", "seventy", "eighty", "ninety", }, - *name3[] = { + *const name3[] = { "hundred", "thousand", "million", "billion", "trillion", "quadrillion", "quintillion", "sextillion", "septillion", "octillion", "nonillion", "decillion", @@ -82,10 +82,9 @@ static char *name1[] = { void convert __P((char *)); int main __P((int, char *[])); -int number __P((char *, int)); +int number __P((const char *, int)); void pfract __P((int)); -void toobig __P((void)); -int unit __P((int, char *)); +int unit __P((int, const char *)); void usage __P((void)) __attribute__((__noreturn__)); int lflag; @@ -201,7 +200,7 @@ badnum: errx(1, "illegal number: %s", line); int unit(len, p) int len; - char *p; + const char *p; { int off, rval; @@ -236,7 +235,7 @@ unit(len, p) int number(p, len) - char *p; + const char *p; int len; { int val, rval; @@ -278,7 +277,7 @@ void pfract(len) int len; { - static char *pref[] = { "", "ten-", "hundred-" }; + static const char *const pref[] = { "", "ten-", "hundred-" }; switch(len) { case 1: |