summaryrefslogtreecommitdiffstats
path: root/quiz
diff options
context:
space:
mode:
Diffstat (limited to 'quiz')
-rw-r--r--quiz/quiz.c30
-rw-r--r--quiz/quiz.h6
-rw-r--r--quiz/rxp.c22
3 files changed, 30 insertions, 28 deletions
diff --git a/quiz/quiz.c b/quiz/quiz.c
index e9026ba5..96ede113 100644
--- a/quiz/quiz.c
+++ b/quiz/quiz.c
@@ -1,4 +1,4 @@
-/* $NetBSD: quiz.c,v 1.13 1998/09/13 15:27:29 hubertf Exp $ */
+/* $NetBSD: quiz.c,v 1.14 1999/09/08 21:17:56 jsm Exp $ */
/*-
* Copyright (c) 1991, 1993
@@ -47,7 +47,7 @@ __COPYRIGHT("@(#) Copyright (c) 1991, 1993\n\
#if 0
static char sccsid[] = "@(#)quiz.c 8.3 (Berkeley) 5/4/95";
#else
-__RCSID("$NetBSD: quiz.c,v 1.13 1998/09/13 15:27:29 hubertf Exp $");
+__RCSID("$NetBSD: quiz.c,v 1.14 1999/09/08 21:17:56 jsm Exp $");
#endif
#endif /* not lint */
@@ -69,12 +69,12 @@ static QE qlist;
static int catone, cattwo, tflag;
static u_int qsize;
-char *appdstr __P((char *, char *, size_t));
+char *appdstr __P((char *, const char *, size_t));
void downcase __P((char *));
void get_cats __P((char *, char *));
-void get_file __P((char *));
+void get_file __P((const char *));
int main __P((int, char *[]));
-char *next_cat __P((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));
@@ -86,7 +86,7 @@ main(argc, argv)
char *argv[];
{
int ch;
- char *indexfile;
+ const char *indexfile;
indexfile = _PATH_QUIZIDX;
while ((ch = getopt(argc, argv, "i:t")) != -1)
@@ -122,7 +122,7 @@ main(argc, argv)
void
get_file(file)
- char *file;
+ const char *file;
{
FILE *fp;
QE *qp;
@@ -164,7 +164,7 @@ void
show_index()
{
QE *qp;
- char *p, *s;
+ const char *p, *s;
FILE *pf;
if ((pf = popen(_PATH_PAGER, "w")) == NULL)
@@ -192,7 +192,7 @@ get_cats(cat1, cat2)
{
QE *qp;
int i;
- char *s;
+ const char *s;
downcase(cat1);
downcase(cat2);
@@ -227,7 +227,8 @@ quiz()
size_t len;
u_int guesses, rights, wrongs;
int next;
- char *answer, *s, *t, question[LINE_SZ];
+ char *answer, *t, question[LINE_SZ];
+ const char *s;
srandom(time(NULL));
guesses = rights = wrongs = 0;
@@ -301,9 +302,9 @@ quiz()
score(rights, wrongs, guesses);
}
-char *
+const char *
next_cat(s)
- char * s;
+ const char * s;
{
int esc;
@@ -328,10 +329,11 @@ next_cat(s)
char *
appdstr(s, tp, len)
char *s;
- char *tp;
+ const char *tp;
size_t len;
{
- char *mp, *sp;
+ char *mp;
+ const char *sp;
int ch;
char *m;
diff --git a/quiz/quiz.h b/quiz/quiz.h
index ff7e4ded..f8123b39 100644
--- a/quiz/quiz.h
+++ b/quiz/quiz.h
@@ -1,4 +1,4 @@
-/* $NetBSD: quiz.h,v 1.4 1995/04/22 10:16:59 cgd Exp $ */
+/* $NetBSD: quiz.h,v 1.5 1999/09/08 21:17:56 jsm Exp $ */
/*-
* Copyright (c) 1991, 1993
@@ -58,6 +58,6 @@ typedef struct qentry {
extern char rxperr[];
-int rxp_compile __P((char *));
+int rxp_compile __P((const char *));
char *rxp_expand __P((void));
-int rxp_match __P((char *));
+int rxp_match __P((const char *));
diff --git a/quiz/rxp.c b/quiz/rxp.c
index 19a31bf6..8531718b 100644
--- a/quiz/rxp.c
+++ b/quiz/rxp.c
@@ -1,4 +1,4 @@
-/* $NetBSD: rxp.c,v 1.6 1997/09/20 14:28:19 lukem Exp $ */
+/* $NetBSD: rxp.c,v 1.7 1999/09/08 21:17:56 jsm Exp $ */
/*-
* Copyright (c) 1991, 1993
@@ -42,7 +42,7 @@
#if 0
static char sccsid[] = "@(#)rxp.c 8.1 (Berkeley) 5/31/93";
#else
-__RCSID("$NetBSD: rxp.c,v 1.6 1997/09/20 14:28:19 lukem Exp $");
+__RCSID("$NetBSD: rxp.c,v 1.7 1999/09/08 21:17:56 jsm Exp $");
#endif
#endif /* not lint */
@@ -85,24 +85,24 @@ typedef short Rxp_t; /* type for regexp tokens */
static Rxp_t rxpbuf[RXP_LINE_SZ]; /* compiled regular expression buffer */
char rxperr[128]; /* parser error message */
-static int rxp__compile __P((char *, int));
+static int rxp__compile __P((const char *, int));
static char *rxp__expand __P((int));
-static int rxp__match __P((char *, int, Rxp_t *, Rxp_t *, char *));
+static int rxp__match __P((const char *, int, Rxp_t *, Rxp_t *, const char *));
int
rxp_compile(s)
- char * s;
+ const char * s;
{
return (rxp__compile(s, TRUE));
}
static int
rxp__compile(s, first)
- char *s;
+ const char *s;
int first;
{
static Rxp_t *rp;
- static char *sp;
+ static const char *sp;
Rxp_t *grp_ptr;
Rxp_t *alt_ptr;
int esc, err;
@@ -196,21 +196,21 @@ rxp__compile(s, first)
*/
int
rxp_match(s)
- char * s;
+ const char * s;
{
return (rxp__match(s, TRUE, NULL, NULL, NULL));
}
static int
rxp__match(s, first, j_succ, j_fail, sp_fail)
- char *s;
+ const 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 */
+ const char *sp_fail; /* reset sp to here on failed match */
{
static Rxp_t *rp;
- static char *sp;
+ static const char *sp;
int ch;
Rxp_t *grp_end = NULL;
int err;