X-Git-Url: https://git.cameronkatri.com/bsdgames-darwin.git/blobdiff_plain/f12b51f99bbe8bb6ad7eca12b047ba9b46836ee6..3c3f8c0880fed372a83ed917c866247edb974156:/quiz/quiz.c diff --git a/quiz/quiz.c b/quiz/quiz.c index a3e01436..eb11f916 100644 --- a/quiz/quiz.c +++ b/quiz/quiz.c @@ -1,4 +1,4 @@ -/* $NetBSD: quiz.c,v 1.19 2003/08/07 09:37:34 agc Exp $ */ +/* $NetBSD: quiz.c,v 1.26 2009/08/27 00:31:12 dholland Exp $ */ /*- * Copyright (c) 1991, 1993 @@ -35,15 +35,15 @@ #include #ifndef lint -__COPYRIGHT("@(#) Copyright (c) 1991, 1993\n\ - The Regents of the University of California. All rights reserved.\n"); +__COPYRIGHT("@(#) Copyright (c) 1991, 1993\ + The Regents of the University of California. All rights reserved."); #endif /* not lint */ #ifndef lint #if 0 static char sccsid[] = "@(#)quiz.c 8.3 (Berkeley) 5/4/95"; #else -__RCSID("$NetBSD: quiz.c,v 1.19 2003/08/07 09:37:34 agc Exp $"); +__RCSID("$NetBSD: quiz.c,v 1.26 2009/08/27 00:31:12 dholland Exp $"); #endif #endif /* not lint */ @@ -54,7 +54,6 @@ __RCSID("$NetBSD: quiz.c,v 1.19 2003/08/07 09:37:34 agc Exp $"); #include #include #include -#include #include #include #include @@ -63,23 +62,20 @@ __RCSID("$NetBSD: quiz.c,v 1.19 2003/08/07 09:37:34 agc Exp $"); static QE qlist; static int catone, cattwo, tflag; -static u_int qsize; +static unsigned qsize; -char *appdstr __P((char *, const char *, size_t)); -void downcase __P((char *)); -void get_cats __P((char *, char *)); -void get_file __P((const char *)); -int main __P((int, char *[])); -const char *next_cat __P((const char *)); -void quiz __P((void)); -void score __P((u_int, u_int, u_int)); -void show_index __P((void)); -void usage __P((void)) __attribute__((__noreturn__)); +static char *appdstr(char *, const char *, size_t); +static void downcase(char *); +static void get_cats(char *, char *); +static void get_file(const char *); +static const char *next_cat(const char *); +static void quiz(void); +static void score(unsigned, unsigned, unsigned); +static void show_index(void); +static void usage(void) __dead; int -main(argc, argv) - int argc; - char *argv[]; +main(int argc, char *argv[]) { int ch; const char *indexfile; @@ -119,9 +115,8 @@ main(argc, argv) exit(0); } -void -get_file(file) - const char *file; +static void +get_file(const char *file) { FILE *fp; QE *qp; @@ -159,8 +154,8 @@ get_file(file) (void)fclose(fp); } -void -show_index() +static void +show_index(void) { QE *qp; const char *p, *s; @@ -192,9 +187,8 @@ show_index() (void)pclose(pf); } -void -get_cats(cat1, cat2) - char *cat1, *cat2; +static void +get_cats(char *cat1, char *cat2) { QE *qp; int i; @@ -225,13 +219,13 @@ get_cats(cat1, cat2) errx(1, "invalid categories"); } -void -quiz() +static void +quiz(void) { QE *qp; int i; size_t len; - u_int guesses, rights, wrongs; + unsigned guesses, rights, wrongs; int next; char *answer, *t, question[LINE_SZ]; const char *s; @@ -308,9 +302,8 @@ quiz() score(rights, wrongs, guesses); } -const char * -next_cat(s) - const char * s; +static const char * +next_cat(const char *s) { int esc; @@ -332,11 +325,8 @@ next_cat(s) /* NOTREACHED */ } -char * -appdstr(s, tp, len) - char *s; - const char *tp; - size_t len; +static char * +appdstr(char *s, const char *tp, size_t len) { char *mp; const char *sp; @@ -359,9 +349,8 @@ appdstr(s, tp, len) return (m); } -void -score(r, w, g) - u_int r, w, g; +static void +score(unsigned r, unsigned w, unsigned g) { (void)printf("Rights %d, wrongs %d,", r, w); if (g) @@ -369,9 +358,8 @@ score(r, w, g) (void)printf(" score %d%%\n", (r + w + g) ? r * 100 / (r + w + g) : 0); } -void -downcase(p) - char *p; +static void +downcase(char *p) { int ch; @@ -380,8 +368,8 @@ downcase(p) *p = tolower(ch); } -void -usage() +static void +usage(void) { (void)fprintf(stderr, "quiz [-t] [-i file] category1 category2\n"); exit(1);