diff options
author | Paul Janzen <pjanzen@cvs.openbsd.org> | 1999-03-27 04:45:27 +0000 |
---|---|---|
committer | Paul Janzen <pjanzen@cvs.openbsd.org> | 1999-03-27 04:45:27 +0000 |
commit | 41e8ac3248416145b0918cadce82cb35de96001e (patch) | |
tree | 8c3d6ff6df9fc6a660dc0c4dcc81d4d1c06efc5c /games | |
parent | 68a1d4ee25b8b412ccb0337b1ffb4c2c9fe01f27 (diff) |
use const where appropriate; jsm28@cam.ac.uk
Diffstat (limited to 'games')
-rw-r--r-- | games/quiz/quiz.c | 30 | ||||
-rw-r--r-- | games/quiz/quiz.h | 6 | ||||
-rw-r--r-- | games/quiz/rxp.c | 22 |
3 files changed, 30 insertions, 28 deletions
diff --git a/games/quiz/quiz.c b/games/quiz/quiz.c index 56208d79fbb..816b23a6812 100644 --- a/games/quiz/quiz.c +++ b/games/quiz/quiz.c @@ -1,4 +1,4 @@ -/* $OpenBSD: quiz.c,v 1.6 1998/08/19 07:40:57 pjanzen Exp $ */ +/* $OpenBSD: quiz.c,v 1.7 1999/03/27 04:45:25 pjanzen Exp $ */ /* $NetBSD: quiz.c,v 1.9 1995/04/22 10:16:58 cgd Exp $ */ /*- @@ -48,7 +48,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.6 1998/08/19 07:40:57 pjanzen Exp $"; +static char rcsid[] = "$OpenBSD: quiz.c,v 1.7 1999/03/27 04:45:25 pjanzen Exp $"; #endif #endif /* not lint */ @@ -68,11 +68,11 @@ 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 *)); -char *next_cat __P((char *)); +void get_file __P((const 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)); @@ -84,7 +84,7 @@ main(argc, argv) char *argv[]; { int ch; - char *indexfile; + const char *indexfile; /* revoke */ setegid(getgid()); @@ -124,7 +124,7 @@ main(argc, argv) void get_file(file) - char *file; + const char *file; { FILE *fp; QE *qp; @@ -166,7 +166,7 @@ void show_index() { QE *qp; - char *p, *s; + const char *p, *s; FILE *pf; if ((pf = popen(_PATH_PAGER, "w")) == NULL) @@ -194,7 +194,7 @@ get_cats(cat1, cat2) { QE *qp; int i; - char *s; + const char *s; downcase(cat1); downcase(cat2); @@ -229,7 +229,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; @@ -303,9 +304,9 @@ quiz() score(rights, wrongs, guesses); } -char * +const char * next_cat(s) - char * s; + const char * s; { int esc; @@ -330,10 +331,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/games/quiz/quiz.h b/games/quiz/quiz.h index 71805f7f7b5..63441eb2bee 100644 --- a/games/quiz/quiz.h +++ b/games/quiz/quiz.h @@ -1,4 +1,4 @@ -/* $OpenBSD: quiz.h,v 1.2 1998/08/19 07:40:59 pjanzen Exp $ */ +/* $OpenBSD: quiz.h,v 1.3 1999/03/27 04:45:26 pjanzen Exp $ */ /* $NetBSD: quiz.h,v 1.4 1995/04/22 10:16:59 cgd Exp $ */ /*- @@ -59,6 +59,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/games/quiz/rxp.c b/games/quiz/rxp.c index b3e2d5b4ac2..04df2ac5fe5 100644 --- a/games/quiz/rxp.c +++ b/games/quiz/rxp.c @@ -1,4 +1,4 @@ -/* $OpenBSD: rxp.c,v 1.2 1998/08/19 07:41:00 pjanzen Exp $ */ +/* $OpenBSD: rxp.c,v 1.3 1999/03/27 04:45:26 pjanzen Exp $ */ /* $NetBSD: rxp.c,v 1.5 1995/04/22 10:17:00 cgd Exp $ */ /*- @@ -42,7 +42,7 @@ #if 0 static char sccsid[] = "@(#)rxp.c 8.1 (Berkeley) 5/31/93"; #else -static char rcsid[] = "$OpenBSD: rxp.c,v 1.2 1998/08/19 07:41:00 pjanzen Exp $"; +static char rcsid[] = "$OpenBSD: rxp.c,v 1.3 1999/03/27 04:45:26 pjanzen 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; |