DragonFly BSD
DragonFly submit List (threaded) for 2005-04
[Date Prev][Date Next]  [Thread Prev][Thread Next]  [Date Index][Thread Index]

[PATCH] games/quiz cleanup


From: Peter Avalos <pavalos@xxxxxxxxxxxx>
Date: Sun, 24 Apr 2005 21:49:00 -0700

ANSI function declarations.

WARNS6 cleanup.


Index: Makefile
===================================================================
RCS file: /ftp/pub/DragonFly/dcvs/src/games/quiz/Makefile,v
retrieving revision 1.2
diff -u -r1.2 Makefile
--- Makefile	17 Jun 2003 04:25:24 -0000	1.2
+++ Makefile	25 Apr 2005 04:35:08 -0000
@@ -11,6 +11,7 @@
 	sexes sov spell state trek ucc
 FILESDIR=	${SHAREDIR}/games/quiz.db
 HIDEGAME=hidegame
+WARNS?=	6
 
 .PATH: ${.CURDIR}/datfiles
 
Index: quiz.c
===================================================================
RCS file: /ftp/pub/DragonFly/dcvs/src/games/quiz/quiz.c,v
retrieving revision 1.4
diff -u -r1.4 quiz.c
--- quiz.c	27 Jul 2004 07:37:39 -0000	1.4
+++ quiz.c	25 Apr 2005 04:41:30 -0000
@@ -61,7 +61,7 @@
 void	 downcase (char *);
 void	 err (const char *, ...);
 void	 get_cats (char *, char *);
-void	 get_file (char *);
+void	 get_file (const char *);
 char	*next_cat (char *);
 void	 quiz (void);
 void	 score (u_int, u_int, u_int);
@@ -69,12 +69,10 @@
 void	 usage (void);
 
 int
-main(argc, argv)
-	int argc;
-	char *argv[];
+main(int argc, char **argv)
 {
 	int ch;
-	char *indexfile;
+	const char *indexfile;
 
 	/* revoke */
 	setgid(getgid());
@@ -112,8 +110,7 @@
 }
 
 void
-get_file(file)
-	char *file;
+get_file(const char *file)
 {
 	FILE *fp;
 	QE *qp;
@@ -149,7 +146,7 @@
 }
 
 void
-show_index()
+show_index(void)
 {
 	QE *qp;
 	char *p, *s;
@@ -175,8 +172,7 @@
 }
 
 void
-get_cats(cat1, cat2)
-	char *cat1, *cat2;
+get_cats(char *cat1, char *cat2)
 {
 	QE *qp;
 	int i;
@@ -208,7 +204,7 @@
 }
 
 void
-quiz()
+quiz(void)
 {
 	QE *qp;
 	int i;
@@ -289,8 +285,7 @@
 }
 
 char *
-next_cat(s)
-	char *	s;
+next_cat(char *s)
 {
 	for (;;)
 		switch (*s++) {
@@ -306,10 +301,7 @@
 }
 
 char *
-appdstr(s, tp, len)
-	char *s;
-	char *tp;
-	size_t len;
+appdstr(char *s, char *tp, size_t len)
 {
 	char *mp, *sp;
 	char *m;
@@ -333,8 +325,7 @@
 }
 
 void
-score(r, w, g)
-	u_int r, w, g;
+score(u_int r, u_int w, u_int g)
 {
 	(void)printf("Rights %d, wrongs %d,", r, w);
 	if (g)
@@ -343,8 +334,7 @@
 }
 
 void
-downcase(p)
-	char *p;
+downcase(char *p)
 {
 	int ch;
 
@@ -354,7 +344,7 @@
 }
 
 void
-usage()
+usage(void)
 {
 	(void)fprintf(stderr, "quiz [-t] [-i file] category1 category2\n");
 	exit(1);
Index: rxp.c
===================================================================
RCS file: /ftp/pub/DragonFly/dcvs/src/games/quiz/rxp.c,v
retrieving revision 1.3
diff -u -r1.3 rxp.c
--- rxp.c	12 Nov 2003 14:53:54 -0000	1.3
+++ rxp.c	25 Apr 2005 04:46:06 -0000
@@ -83,16 +83,13 @@
 static int	 rxp__match (char *, int, Rxp_t *, Rxp_t *, char *);
 
 int
-rxp_compile(s)
-	char *	s;
+rxp_compile(char *s)
 {
 	return (rxp__compile(s, TRUE));
 }
 
 static int
-rxp__compile(s, first)
-	char *s;
-	int first;
+rxp__compile(char *s, int first)
 {
 	static Rxp_t *rp;
 	static char *sp;
@@ -188,19 +185,18 @@
  * match string against compiled regular expression
  */
 int
-rxp_match(s)
-	char *	s;
+rxp_match(char *s)
 {
 	return (rxp__match(s, TRUE, NULL, NULL, NULL));
 }
 
+/*
+ * jump to j_succ on successful alt match
+ * jump to j_fail on failed match
+ * reset sp to sp_fail on failed match
+ */
 static int
-rxp__match(s, first, j_succ, j_fail, sp_fail)
-	char *s;
-	int first;
-	Rxp_t *j_succ;		/* jump here on successful alt match */
-	Rxp_t *j_fail;		/* jump here on failed match */
-	char *sp_fail;		/* reset sp to here on failed match */
+rxp__match(char *s, int first, Rxp_t *j_succ, Rxp_t *j_fail, char *sp_fail)
 {
 	static Rxp_t *rp;
 	static char *sp;
@@ -259,14 +255,13 @@
  * Reverse engineer the regular expression, by picking first of all alternates.
  */
 char *
-rxp_expand()
+rxp_expand(void)
 {
 	return (rxp__expand(TRUE));
 }
 
 static char *
-rxp__expand(first)
-	int first;
+rxp__expand(int first)
 {
 	static char buf[RXP_LINE_SZ/2];
 	static Rxp_t *rp;

Attachment: pgp00009.pgp
Description: PGP signature



[Date Prev][Date Next]  [Thread Prev][Thread Next]  [Date Index][Thread Index]