-/* $NetBSD: quiz.c,v 1.25 2009/08/27 00:24:11 dholland Exp $ */
+/* $NetBSD: quiz.c,v 1.28 2019/02/03 03:19:25 mrg Exp $ */
/*-
* Copyright (c) 1991, 1993
#if 0
static char sccsid[] = "@(#)quiz.c 8.3 (Berkeley) 5/4/95";
#else
-__RCSID("$NetBSD: quiz.c,v 1.25 2009/08/27 00:24:11 dholland Exp $");
+__RCSID("$NetBSD: quiz.c,v 1.28 2019/02/03 03:19:25 mrg Exp $");
#endif
#endif /* not lint */
static int catone, cattwo, tflag;
static unsigned qsize;
-int main(int, char *[]);
static char *appdstr(char *, const char *, size_t);
static void downcase(char *);
static void get_cats(char *, char *);
static void usage(void) __dead;
int
-main(argc, argv)
- int argc;
- char *argv[];
+main(int argc, char *argv[])
{
int ch;
const char *indexfile;
}
static void
-get_file(file)
- const char *file;
+get_file(const char *file)
{
FILE *fp;
QE *qp;
}
static void
-show_index()
+show_index(void)
{
QE *qp;
const char *p, *s;
}
static void
-get_cats(cat1, cat2)
- char *cat1, *cat2;
+get_cats(char *cat1, char *cat2)
{
QE *qp;
int i;
}
static void
-quiz()
+quiz(void)
{
QE *qp;
int i;
size_t len;
unsigned guesses, rights, wrongs;
- int next;
+ unsigned next, j;
char *answer, *t, question[LINE_SZ];
const char *s;
break;
next = random() % qsize;
qp = qlist.q_next;
- for (i = 0; i < next; i++)
+ for (j = 0; j < next; j++)
qp = qp->q_next;
while (qp && qp->q_answered)
qp = qp->q_next;
}
static const char *
-next_cat(s)
- const char * s;
+next_cat(const char *s)
{
int esc;
case ':':
if (!esc)
return (s);
+ /* FALLTHROUGH */
default:
esc = 0;
break;
}
static 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;
}
static void
-score(r, w, g)
- unsigned r, w, g;
+score(unsigned r, unsigned w, unsigned g)
{
(void)printf("Rights %d, wrongs %d,", r, w);
if (g)
}
static void
-downcase(p)
- char *p;
+downcase(char *p)
{
int ch;
}
static void
-usage()
+usage(void)
{
(void)fprintf(stderr, "quiz [-t] [-i file] category1 category2\n");
exit(1);