-/* $NetBSD: arithmetic.c,v 1.25 2009/08/27 00:21:45 dholland Exp $ */
+/* $NetBSD: arithmetic.c,v 1.27 2012/06/19 05:46:08 dholland Exp $ */
/*
* Copyright (c) 1989, 1993
#if 0
static char sccsid[] = "@(#)arithmetic.c 8.1 (Berkeley) 5/31/93";
#else
-__RCSID("$NetBSD: arithmetic.c,v 1.25 2009/08/27 00:21:45 dholland Exp $");
+__RCSID("$NetBSD: arithmetic.c,v 1.27 2012/06/19 05:46:08 dholland Exp $");
#endif
#endif /* not lint */
usage();
/* Seed the random-number generator. */
- srandom((int)time((time_t *)NULL));
+ srandom((int)time(NULL));
(void)signal(SIGINT, intr);
/* Handle interrupt character. Print score and exit. */
static void
-intr(dummy)
- int dummy __unused;
+intr(int dummy __unused)
{
showstats(1);
exit(0);
/* Print score. Original `arithmetic' had a delay after printing it. */
static void
-showstats(bool_sigint)
- int bool_sigint;
+showstats(int bool_sigint)
{
if (nright + nwrong > 0) {
(void)printf("\n\nRights %d; Wrongs %d; Score %d%%",
* more likely to appear in subsequent problems.
*/
static int
-problem()
+problem(void)
{
char *p;
time_t start, finish;
* forget about the penalty (how likely is this, anyway?).
*/
static void
-penalise(value, op, operand)
- int value, op, operand;
+penalise(int value, int op, int operand)
{
struct penalty *p;
* we find the corresponding value and return that, decreasing its penalty.
*/
static int
-getrandom(maxval, op, operand)
- int maxval, op, operand;
+getrandom(int maxval, int op, int operand)
{
int value;
struct penalty **pp, *p;
/* Return an index for the character op, which is one of [+-x/]. */
static int
-opnum(op)
- int op;
+opnum(int op)
{
char *p;
/* Print usage message and quit. */
static void
-usage()
+usage(void)
{
(void)fprintf(stderr, "Usage: %s [-o +-x/] [-r range]\n",
getprogname());