summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorbillf <billf@FreeBSD.org>2002-02-23 10:21:19 +0000
committerbillf <billf@FreeBSD.org>2002-02-23 10:21:19 +0000
commit1bc6f85fc6b5a27ba36f65975e6614d5ce61bf12 (patch)
tree95a0e2ee4970e5f25b332f5b16155dc052805e66
parenta79402e12e0f01b5ada818d4126c191668d1740f (diff)
downloadFreeBSD-src-1bc6f85fc6b5a27ba36f65975e6614d5ce61bf12.zip
FreeBSD-src-1bc6f85fc6b5a27ba36f65975e6614d5ce61bf12.tar.gz
KNF to ANSI function declaration, silence a warning
-rw-r--r--games/arithmetic/arithmetic.c23
1 files changed, 9 insertions, 14 deletions
diff --git a/games/arithmetic/arithmetic.c b/games/arithmetic/arithmetic.c
index 6aee828..68cd045 100644
--- a/games/arithmetic/arithmetic.c
+++ b/games/arithmetic/arithmetic.c
@@ -110,9 +110,7 @@ void showstats(void);
* so far are printed.
*/
int
-main(argc, argv)
- int argc;
- char **argv;
+main(int argc, char **argv)
{
int ch, cnt;
@@ -164,16 +162,16 @@ main(argc, argv)
/* Handle interrupt character. Print score and exit. */
void
-intr(sig)
- int sig;
+intr(int sig)
{
+ sig = 0;
showstats();
exit(0);
}
/* Print score. Original `arithmetic' had a delay after printing it. */
void
-showstats()
+showstats(void)
{
if (nright + nwrong > 0) {
(void)printf("\n\nRights %d; Wrongs %d; Score %d%%",
@@ -194,7 +192,7 @@ showstats()
* more likely to appear in subsequent problems.
*/
int
-problem()
+problem(void)
{
char *p;
time_t start, finish;
@@ -309,8 +307,7 @@ struct penalty {
* forget about the penalty (how likely is this, anyway?).
*/
void
-penalise(value, op, operand)
- int value, op, operand;
+penalise(int value, int op, int operand)
{
struct penalty *p;
@@ -330,8 +327,7 @@ penalise(value, op, operand)
* we find the corresponding value and return that, decreasing its penalty.
*/
int
-getrandom(maxval, op, operand)
- int maxval, op, operand;
+getrandom(int maxval, int op, int operand)
{
int value;
struct penalty **pp, *p;
@@ -376,8 +372,7 @@ getrandom(maxval, op, operand)
/* Return an index for the character op, which is one of [+-x/]. */
int
-opnum(op)
- int op;
+opnum(int op)
{
char *p;
@@ -391,7 +386,7 @@ opnum(op)
/* Print usage message and quit. */
static void
-usage()
+usage(void)
{
(void)fprintf(stderr, "usage: arithmetic [-o +-x/] [-r range]\n");
exit(1);
OpenPOWER on IntegriCloud