[PATCH] games/arithmetic cleanup
--qw1jpiGhEv1c2/gd
Content-Type: multipart/mixed; boundary="XZn3P0VKTizxZG2b"
Content-Disposition: inline
--XZn3P0VKTizxZG2b
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
ANSI function declarations and WARNS6 cleanup.
--XZn3P0VKTizxZG2b
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment; filename="arithmetic.patch"
Content-Transfer-Encoding: quoted-printable
Index: Makefile
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
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=3D arithmetic
MAN=3D arithmetic.6
HIDEGAME=3Dhidegame
+WARNS?=3D 6
=20
.include <bsd.prog.mk>
Index: arithmetic.c
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
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;
=20
@@ -155,8 +153,7 @@
=20
/* Handle interrupt character. Print score and exit. */
void
-intr(sig)
- int sig;
+intr(__unused int sig)
{
showstats();
exit(0);
@@ -164,7 +161,7 @@
=20
/* 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;
=20
@@ -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 @@
=20
/* Return an index for the character op, which is one of [+-x/]. */
int
-opnum(op)
- int op;
+opnum(int op)
{
char *p;
=20
@@ -382,7 +376,7 @@
=20
/* Print usage message and quit. */
static void
-usage()
+usage(void)
{
(void)fprintf(stderr, "usage: arithmetic [-o +-x/] [-r range]\n");
exit(1);
--XZn3P0VKTizxZG2b--
--qw1jpiGhEv1c2/gd
Content-Type: application/pgp-signature
Content-Disposition: inline
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.0 (FreeBSD)
iD8DBQFCajzkKjaxugguz8URAt+sAJwPFPROEoSp7SNj+bISKnscN3xx0ACfbzXR
ncAMclAHF9O3yelu2vMtFpU=
=0oVR
-----END PGP SIGNATURE-----
--qw1jpiGhEv1c2/gd--
討論串 (同標題文章)