Module Name: src Committed By: dholland Date: Wed Aug 12 05:40:04 UTC 2009
Modified Files: src/games/ching/castching: castching.c src/games/ching/printching: printching.c Log Message: sprinkle static To generate a diff of this commit: cvs rdiff -u -r1.2 -r1.3 src/games/ching/castching/castching.c cvs rdiff -u -r1.3 -r1.4 src/games/ching/printching/printching.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
Modified files: Index: src/games/ching/castching/castching.c diff -u src/games/ching/castching/castching.c:1.2 src/games/ching/castching/castching.c:1.3 --- src/games/ching/castching/castching.c:1.2 Sun Jul 20 01:03:21 2008 +++ src/games/ching/castching/castching.c Wed Aug 12 05:40:03 2009 @@ -1,4 +1,4 @@ -/* $NetBSD: castching.c,v 1.2 2008/07/20 01:03:21 lukem Exp $ */ +/* $NetBSD: castching.c,v 1.3 2009/08/12 05:40:03 dholland Exp $ */ /* * Copyright (c) 1988, 1993 @@ -46,7 +46,7 @@ #if 0 static char sccsid[] = "@(#)ching.cno.c 8.1 (Berkeley) 5/31/93"; #else -__RCSID("$NetBSD: castching.c,v 1.2 2008/07/20 01:03:21 lukem Exp $"); +__RCSID("$NetBSD: castching.c,v 1.3 2009/08/12 05:40:03 dholland Exp $"); #endif #endif /* not lint */ @@ -60,17 +60,18 @@ #include <unistd.h> #include "ching.h" -time_t now; /* current time */ +static time_t now; /* current time */ -unsigned seed; /* seed for random number generator */ -int getquest(void); -unsigned getrand(void); -unsigned getrnum(void); -char *change(void); +static unsigned seed; /* seed for random number generator */ -char string[6+1]; /* where the actual change string is put */ +static int getquest(void); +static unsigned getrand(void); +static unsigned getrnum(void); +static char *change(void); -int table[2][2][2] = { +static char string[6+1]; /* where the actual change string is put */ + +static int table[2][2][2] = { { { OYIN, YYANG,}, { YYANG, YYIN,} }, { { YYANG, YYIN,}, { YYIN, OYANG,} }, }; @@ -89,7 +90,7 @@ /* * Hash the question by adding all the characters together. */ -int +static int getquest(void) { int result; @@ -104,7 +105,7 @@ /* * Get a set of six lines making up a change. */ -char * +static char * change(void) { int i; @@ -118,7 +119,7 @@ /* * Get a number more random than what getrand() gives. */ -unsigned +static unsigned getrnum(void) { return((getrand())>>(getrand()%17)); @@ -127,7 +128,7 @@ /* * Get a random number. */ -unsigned +static unsigned getrand(void) { return(seed = (seed*13077) + 6925); Index: src/games/ching/printching/printching.c diff -u src/games/ching/printching/printching.c:1.3 src/games/ching/printching/printching.c:1.4 --- src/games/ching/printching/printching.c:1.3 Sun Jul 20 01:03:21 2008 +++ src/games/ching/printching/printching.c Wed Aug 12 05:40:04 2009 @@ -1,4 +1,4 @@ -/* $NetBSD: printching.c,v 1.3 2008/07/20 01:03:21 lukem Exp $ */ +/* $NetBSD: printching.c,v 1.4 2009/08/12 05:40:04 dholland Exp $ */ /* * Copyright (c) 1988, 1993 @@ -46,7 +46,7 @@ #if 0 static char sccsid[] = "@(#)ching.phx.c 8.1 (Berkeley) 5/31/93"; #else -__RCSID("$NetBSD: printching.c,v 1.3 2008/07/20 01:03:21 lukem Exp $"); +__RCSID("$NetBSD: printching.c,v 1.4 2009/08/12 05:40:04 dholland Exp $"); #endif #endif /* not lint */ @@ -59,12 +59,12 @@ #include "ching.h" #include "pathnames.h" -int changes(void); -int codem(int a); -int doahex(void); -void phx(int hexagram, int flag); +static int changes(void); +static int codem(int a); +static int doahex(void); +static void phx(int hexagram, int flag); -struct { +static const struct { int lines; /* encoded value of lines */ int trinum; /* trigram number */ } table[] = { @@ -81,7 +81,7 @@ /* * Gives hexagram number from two component trigrams. */ -int crosstab[8][8] = { +static const int crosstab[8][8] = { {1, 34, 5, 26, 11, 9, 14, 43}, {25, 51, 3, 27, 24, 42, 21, 17}, {6, 40, 29, 4, 7, 59, 64, 47}, @@ -92,10 +92,10 @@ {10, 54, 60, 41, 19, 61, 38, 58} }; -int trigrams[6]; -int moving[6]; +static int trigrams[6]; +static int moving[6]; -FILE *chingf; /* stream to read the hexagram file */ +static FILE *chingf; /* stream to read the hexagram file */ /*ARGSUSED*/ int @@ -133,7 +133,7 @@ /* * Compute the hexagram number, given the trigrams. */ -int +static int doahex(void) { int lower, upper; /* encoded values of lower and upper trigrams */ @@ -155,7 +155,7 @@ * Encode a trigram as a 3-digit number; the digits, from left to right, * represent the lines. 7 is a solid (yang) line, 8 is a broken (yin) line. */ -int +static int codem(int a) { int code, i; @@ -187,7 +187,7 @@ * Compute the changes based on moving lines; return 1 if any lines moved, * 0 if no lines moved. */ -int +static int changes(void) { int cflag; @@ -211,7 +211,7 @@ * if flag is 0, print the entire source; if flag is 1, ignore the meanings * of the lines. */ -void +static void phx(int hexagram, int flag) { char textln[128+1]; /* buffer for text line */