From 416d932935b8a3171ac05bfa2c147bcef759d6f3 Mon Sep 17 00:00:00 2001 From: cgd Date: Sat, 22 Apr 1995 09:06:33 +0000 Subject: un-munge import. --- quiz/Makefile | 11 +++++------ quiz/pathnames.h | 7 +++---- quiz/quiz.6 | 9 ++++----- quiz/quiz.c | 37 ++++++++++++++++++------------------- quiz/quiz.h | 10 +++++----- quiz/rxp.c | 10 +++++----- 6 files changed, 40 insertions(+), 44 deletions(-) diff --git a/quiz/Makefile b/quiz/Makefile index d3f96a55..5d1ed547 100644 --- a/quiz/Makefile +++ b/quiz/Makefile @@ -1,17 +1,16 @@ -# from: @(#)Makefile 5.1 (Berkeley) 11/10/91 -# $Id: Makefile,v 1.6 1994/12/22 09:35:38 cgd Exp $ +# @(#)Makefile 8.1 (Berkeley) 5/31/93 PROG= quiz MAN= quiz.6 SRCS= quiz.c rxp.c CATS= africa america areas arith asia babies bard chinese collectives \ - ed elements europe greek inca index latin locomotive midearth morse \ - mult murders poetry posneg pres province seq-easy seq-hard sexes sov \ - spell state trek ucc + ed elements europe flowers greek inca index latin locomotive \ + midearth morse murders poetry posneg pres province seq-easy seq-hard \ + sexes sov spell state trek ucc HIDEGAME=hidegame beforeinstall: (cd ${.CURDIR}/datfiles; install -c -o ${BINOWN} -g ${BINGRP} -m 444 \ - ${CATS} ${DESTDIR}/usr/share/games/quiz.db) + ${CATS} ${DESTDIR}/usr/share/games/quiz.db) .include diff --git a/quiz/pathnames.h b/quiz/pathnames.h index 955ba047..08f4a6b0 100644 --- a/quiz/pathnames.h +++ b/quiz/pathnames.h @@ -1,6 +1,6 @@ /*- - * Copyright (c) 1990 The Regents of the University of California. - * All rights reserved. + * Copyright (c) 1990, 1993 + * The Regents of the University of California. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions @@ -30,8 +30,7 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * - * from: @(#)pathnames.h 5.2 (Berkeley) 11/10/91 - * $Id: pathnames.h,v 1.2 1993/08/01 18:53:01 mycroft Exp $ + * @(#)pathnames.h 8.1 (Berkeley) 5/31/93 */ #define _PATH_PAGER "/usr/bin/more" diff --git a/quiz/quiz.6 b/quiz/quiz.6 index 03233770..d658703c 100644 --- a/quiz/quiz.6 +++ b/quiz/quiz.6 @@ -1,5 +1,5 @@ -.\" Copyright (c) 1991 The Regents of the University of California. -.\" All rights reserved. +.\" Copyright (c) 1991, 1993 +.\" The Regents of the University of California. All rights reserved. .\" .\" This code is derived from software contributed to Berkeley by .\" Jim R. Oldroyd at The Instruction Set. @@ -32,10 +32,9 @@ .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF .\" SUCH DAMAGE. .\" -.\" from: @(#)quiz.6 6.3 (Berkeley) 11/10/91 -.\" $Id: quiz.6,v 1.2 1993/08/01 07:46:26 mycroft Exp $ +.\" @(#)quiz.6 8.1 (Berkeley) 5/31/93 .\" -.Dd November 10, 1991 +.Dd May 31, 1993 .Dt QUIZ 6 .Os .Sh NAME diff --git a/quiz/quiz.c b/quiz/quiz.c index 00e2e2a4..00fff817 100644 --- a/quiz/quiz.c +++ b/quiz/quiz.c @@ -1,9 +1,10 @@ /*- - * Copyright (c) 1991 The Regents of the University of California. - * All rights reserved. + * Copyright (c) 1991, 1993 + * The Regents of the University of California. All rights reserved. * * This code is derived from software contributed to Berkeley by - * Jim R. Oldroyd at The Instruction Set. + * Jim R. Oldroyd at The Instruction Set and Keith Gabryelski at + * Commodore Business Machines. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions @@ -35,14 +36,13 @@ */ #ifndef lint -char copyright[] = -"@(#) Copyright (c) 1991 The Regents of the University of California.\n\ - All rights reserved.\n"; +static char copyright[] = +"@(#) Copyright (c) 1991, 1993\n\ + The Regents of the University of California. All rights reserved.\n"; #endif /* not lint */ #ifndef lint -/*static char sccsid[] = "from: @(#)quiz.c 5.1 (Berkeley) 11/10/91";*/ -static char rcsid[] = "$Id: quiz.c,v 1.6 1994/04/08 08:33:13 pk Exp $"; +static char sccsid[] = "@(#)quiz.c 8.2 (Berkeley) 1/3/94"; #endif /* not lint */ #include @@ -60,7 +60,7 @@ static QE qlist; static int catone, cattwo, tflag; static u_int qsize; -char *appdstr __P((char *, char *)); +char *appdstr __P((char *, char *, size_t)); void downcase __P((char *)); void get_cats __P((char *, char *)); void get_file __P((char *)); @@ -130,10 +130,9 @@ get_file(file) qp = &qlist; qsize = 0; while ((lp = fgetln(fp, &len)) != NULL) { - if (qp->q_text && qp->q_text[strlen(qp->q_text) - 1] == '\\') { - lp[len - 1] = '\0'; - qp->q_text = appdstr(qp->q_text, lp); - } else { + if (qp->q_text && qp->q_text[strlen(qp->q_text) - 1] == '\\') + qp->q_text = appdstr(qp->q_text, lp, len); + else { if ((qp->q_next = malloc(sizeof(QE))) == NULL) err(1, NULL); qp = qp->q_next; @@ -212,10 +211,10 @@ quiz() { register QE *qp; register int i; + size_t len; u_int guesses, rights, wrongs; - int len, next; - char *s, *t, question[LINE_SZ]; - char *answer; + int next; + char *answer, *s, *t, question[LINE_SZ]; srandom(time(NULL)); guesses = rights = wrongs = 0; @@ -305,18 +304,18 @@ next_cat(s) } char * -appdstr(s, tp) +appdstr(s, tp, len) char *s; register char *tp; + size_t len; { register char *mp, *sp; register int ch; char *m; - if ((m = malloc(strlen(s) + strlen(tp) + 1)) == NULL) + if ((m = malloc(strlen(s) + len + 1)) == NULL) err(1, NULL); for (mp = m, sp = s; *mp++ = *sp++;); - --mp; if (*(mp - 1) == '\\') --mp; diff --git a/quiz/quiz.h b/quiz/quiz.h index d3c65ea0..8923c8f7 100644 --- a/quiz/quiz.h +++ b/quiz/quiz.h @@ -1,9 +1,10 @@ /*- - * Copyright (c) 1991 The Regents of the University of California. - * All rights reserved. + * Copyright (c) 1991, 1993 + * The Regents of the University of California. All rights reserved. * * This code is derived from software contributed to Berkeley by - * Jim R. Oldroyd at The Instruction Set. + * Jim R. Oldroyd at The Instruction Set and Keith Gabryelski at + * Commodore Business Machines. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions @@ -33,8 +34,7 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * - * from: @(#)quiz.h 5.1 (Berkeley) 11/10/91 - * $Id: quiz.h,v 1.2 1993/08/01 18:53:00 mycroft Exp $ + * @(#)quiz.h 8.1 (Berkeley) 5/31/93 */ #define TRUE 1 diff --git a/quiz/rxp.c b/quiz/rxp.c index bd9a0c1d..4b6a74f7 100644 --- a/quiz/rxp.c +++ b/quiz/rxp.c @@ -1,9 +1,10 @@ /*- - * Copyright (c) 1991 The Regents of the University of California. - * All rights reserved. + * Copyright (c) 1991, 1993 + * The Regents of the University of California. All rights reserved. * * This code is derived from software contributed to Berkeley by - * Jim R. Oldroyd at The Instruction Set. + * Jim R. Oldroyd at The Instruction Set and Keith Gabryelski at + * Commodore Business Machines. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions @@ -35,8 +36,7 @@ */ #ifndef lint -/*static char sccsid[] = "from: @(#)rxp.c 5.1 (Berkeley) 11/10/91";*/ -static char rcsid[] = "$Id: rxp.c,v 1.3 1993/08/01 18:52:58 mycroft Exp $"; +static char sccsid[] = "@(#)rxp.c 8.1 (Berkeley) 5/31/93"; #endif /* not lint */ /* -- cgit v1.2.3-56-ge451