From ae271365b029dbf18dbdc93763cb6fda6db7f559 Mon Sep 17 00:00:00 2001 From: dholland Date: Wed, 12 Aug 2009 05:35:44 +0000 Subject: sprinkle static --- ching/castching/castching.c | 29 +++++++++++++++-------------- ching/printching/printching.c | 30 +++++++++++++++--------------- 2 files changed, 30 insertions(+), 29 deletions(-) (limited to 'ching') diff --git a/ching/castching/castching.c b/ching/castching/castching.c index 9024806d..351037a4 100644 --- a/ching/castching/castching.c +++ b/ching/castching/castching.c @@ -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 @@ __COPYRIGHT("@(#) Copyright (c) 1988, 1993\ #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 @@ __RCSID("$NetBSD: castching.c,v 1.2 2008/07/20 01:03:21 lukem Exp $"); #include #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 @@ main(int argc, char **argv) /* * Hash the question by adding all the characters together. */ -int +static int getquest(void) { int result; @@ -104,7 +105,7 @@ getquest(void) /* * Get a set of six lines making up a change. */ -char * +static char * change(void) { int i; @@ -118,7 +119,7 @@ change(void) /* * Get a number more random than what getrand() gives. */ -unsigned +static unsigned getrnum(void) { return((getrand())>>(getrand()%17)); @@ -127,7 +128,7 @@ getrnum(void) /* * Get a random number. */ -unsigned +static unsigned getrand(void) { return(seed = (seed*13077) + 6925); diff --git a/ching/printching/printching.c b/ching/printching/printching.c index 42c5dc3c..54c08921 100644 --- a/ching/printching/printching.c +++ b/ching/printching/printching.c @@ -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 @@ __COPYRIGHT("@(#) Copyright (c) 1988, 1993\ #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 @@ __RCSID("$NetBSD: printching.c,v 1.3 2008/07/20 01:03:21 lukem Exp $"); #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 @@ struct { /* * 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 @@ int crosstab[8][8] = { {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 @@ main(int argc, char **argv) /* * 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 @@ doahex(void) * 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 @@ codem(int a) * 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 @@ changes(void) * 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 */ -- cgit v1.2.3-56-ge451