[PATCH] games/arithmetic cleanup

Peter Avalos pavalos at theshell.com
Sat Apr 23 05:18:04 PDT 2005


ANSI function declarations and WARNS6 cleanup.
Index: Makefile
===================================================================
RCS file: /ftp/pub/DragonFly/dcvs/src/games/arithmetic/Makefile,v
retrieving revision 1.2
diff -u -r1.2 Makefile
--- Makefile	17 Jun 2003 04:25:22 -0000	1.2
+++ Makefile	23 Apr 2005 12:06:40 -0000
@@ -5,5 +5,6 @@
 PROG=	arithmetic
 MAN=	arithmetic.6
 HIDEGAME=hidegame
+WARNS?=	6
 
 .include <bsd.prog.mk>
Index: arithmetic.c
===================================================================
RCS file: /ftp/pub/DragonFly/dcvs/src/games/arithmetic/arithmetic.c,v
retrieving revision 1.3
diff -u -r1.3 arithmetic.c
--- arithmetic.c	12 Nov 2003 14:53:52 -0000	1.3
+++ arithmetic.c	23 Apr 2005 12:03:07 -0000
@@ -101,9 +101,7 @@
  * so far are printed.
  */
 int
-main(argc, argv)
-	int argc;
-	char **argv;
+main(int argc, char **argv)
 {
 	int ch, cnt;
 
@@ -155,8 +153,7 @@
 
 /* Handle interrupt character.  Print score and exit. */
 void
-intr(sig)
-	int sig;
+intr(__unused int sig)
 {
 	showstats();
 	exit(0);
@@ -164,7 +161,7 @@
 
 /* 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%%",
@@ -185,7 +182,7 @@
  * more likely to appear in subsequent problems.
  */
 int
-problem()
+problem(void)
 {
 	char *p;
 	time_t start, finish;
@@ -300,8 +297,7 @@
  * 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;
 
@@ -321,8 +317,7 @@
  * 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;
@@ -367,8 +362,7 @@
 
 /* Return an index for the character op, which is one of [+-x/]. */
 int
-opnum(op)
-	int op;
+opnum(int op)
 {
 	char *p;
 
@@ -382,7 +376,7 @@
 
 /* Print usage message and quit. */
 static void
-usage()
+usage(void)
 {
 	(void)fprintf(stderr, "usage: arithmetic [-o +-x/] [-r range]\n");
 	exit(1);
Attachment:
pgp00002.pgp
-------------- next part --------------
A non-text attachment was scrubbed...
Name: pgp00002.pgp
Type: application/octet-stream
Size: 187 bytes
Desc: "Description: PGP signature"
URL: <http://lists.dragonflybsd.org/pipermail/submit/attachments/20050423/c98cd839/attachment-0018.obj>


More information about the Submit mailing list