diff options
Diffstat (limited to 'games/quiz')
-rw-r--r-- | games/quiz/quiz.c | 34 | ||||
-rw-r--r-- | games/quiz/rxp.c | 32 |
2 files changed, 26 insertions, 40 deletions
diff --git a/games/quiz/quiz.c b/games/quiz/quiz.c index 3bd7d79ae72..665e93bc59b 100644 --- a/games/quiz/quiz.c +++ b/games/quiz/quiz.c @@ -1,4 +1,4 @@ -/* $OpenBSD: quiz.c,v 1.15 2003/07/06 02:04:03 avsm Exp $ */ +/* $OpenBSD: quiz.c,v 1.16 2004/07/10 07:26:23 deraadt Exp $ */ /* $NetBSD: quiz.c,v 1.9 1995/04/22 10:16:58 cgd Exp $ */ /*- @@ -44,7 +44,7 @@ static char copyright[] = #if 0 static char sccsid[] = "@(#)quiz.c 8.3 (Berkeley) 5/4/95"; #else -static char rcsid[] = "$OpenBSD: quiz.c,v 1.15 2003/07/06 02:04:03 avsm Exp $"; +static char rcsid[] = "$OpenBSD: quiz.c,v 1.16 2004/07/10 07:26:23 deraadt Exp $"; #endif #endif /* not lint */ @@ -75,9 +75,7 @@ void show_index(void); void usage(void); int -main(argc, argv) - int argc; - char *argv[]; +main(int argc, char *argv[]) { int ch; const char *indexfile; @@ -115,8 +113,7 @@ main(argc, argv) } void -get_file(file) - const char *file; +get_file(const char *file) { FILE *fp; QE *qp; @@ -156,7 +153,7 @@ get_file(file) } void -show_index() +show_index(void) { QE *qp; const char *p, *s; @@ -187,8 +184,7 @@ show_index() } void -get_cats(cat1, cat2) - char *cat1, *cat2; +get_cats(char *cat1, char *cat2) { QE *qp; int i; @@ -220,7 +216,7 @@ get_cats(cat1, cat2) } void -quiz() +quiz(void) { QE *qp; int i; @@ -306,8 +302,7 @@ quiz() } const char * -next_cat(s) - const char * s; +next_cat(const char *s) { int esc; @@ -332,10 +327,7 @@ next_cat(s) } char * -appdstr(s, tp, len) - char *s; - const char *tp; - size_t len; +appdstr(char *s, const char *tp, size_t len) { char *mp; const char *sp; @@ -359,8 +351,7 @@ appdstr(s, tp, len) } 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) @@ -369,8 +360,7 @@ score(r, w, g) } void -downcase(p) - char *p; +downcase(char *p) { int ch; @@ -380,7 +370,7 @@ downcase(p) } void -usage() +usage(void) { (void)fprintf(stderr, "quiz [-t] [-i file] category1 category2\n"); exit(1); diff --git a/games/quiz/rxp.c b/games/quiz/rxp.c index 68c4884e589..f3ae83bbfc3 100644 --- a/games/quiz/rxp.c +++ b/games/quiz/rxp.c @@ -1,4 +1,4 @@ -/* $OpenBSD: rxp.c,v 1.6 2003/06/03 03:01:40 millert Exp $ */ +/* $OpenBSD: rxp.c,v 1.7 2004/07/10 07:26:23 deraadt Exp $ */ /* $NetBSD: rxp.c,v 1.5 1995/04/22 10:17:00 cgd Exp $ */ /*- @@ -38,7 +38,7 @@ #if 0 static char sccsid[] = "@(#)rxp.c 8.1 (Berkeley) 5/31/93"; #else -static char rcsid[] = "$OpenBSD: rxp.c,v 1.6 2003/06/03 03:01:40 millert Exp $"; +static char rcsid[] = "$OpenBSD: rxp.c,v 1.7 2004/07/10 07:26:23 deraadt Exp $"; #endif #endif /* not lint */ @@ -86,16 +86,13 @@ static char *rxp__expand(int); static int rxp__match(const char *, int, Rxp_t *, Rxp_t *, const char *); int -rxp_compile(s) - const char * s; +rxp_compile(const char *s) { return (rxp__compile(s, TRUE)); } static int -rxp__compile(s, first) - const char *s; - int first; +rxp__compile(const char *s, int first) { static Rxp_t *rp; static const char *sp; @@ -196,19 +193,19 @@ rxp__compile(s, first) * match string against compiled regular expression */ int -rxp_match(s) - const char *s; +rxp_match(const char *s) { return (rxp__match(s, TRUE, NULL, NULL, NULL)); } +/* + * j_succ : jump here on successful alt match + * j_fail : jump here on failed match + * sp_fail: reset sp to here on failed match + */ static int -rxp__match(s, first, j_succ, j_fail, sp_fail) - const char *s; - int first; - Rxp_t *j_succ; /* jump here on successful alt match */ - Rxp_t *j_fail; /* jump here on failed match */ - const char *sp_fail; /* reset sp to here on failed match */ +rxp__match(const char *s, int first, Rxp_t *j_succ, Rxp_t *j_fail, + const char *sp_fail) { static Rxp_t *rp; static const char *sp; @@ -266,14 +263,13 @@ rxp__match(s, first, j_succ, j_fail, sp_fail) * 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; |