X-Git-Url: https://git.cameronkatri.com/bsdgames-darwin.git/blobdiff_plain/416d932935b8a3171ac05bfa2c147bcef759d6f3..db81cb3c9b81aac50cf37614d2da2f4f781d7211:/quiz/quiz.c diff --git a/quiz/quiz.c b/quiz/quiz.c index 00fff817..60a89264 100644 --- a/quiz/quiz.c +++ b/quiz/quiz.c @@ -1,3 +1,5 @@ +/* $NetBSD: quiz.c,v 1.10 1997/01/07 12:27:30 tls Exp $ */ + /*- * Copyright (c) 1991, 1993 * The Regents of the University of California. All rights reserved. @@ -42,17 +44,24 @@ static char copyright[] = #endif /* not lint */ #ifndef lint -static char sccsid[] = "@(#)quiz.c 8.2 (Berkeley) 1/3/94"; +#if 0 +static char sccsid[] = "@(#)quiz.c 8.3 (Berkeley) 5/4/95"; +#else +static char rcsid[] = "$NetBSD: quiz.c,v 1.10 1997/01/07 12:27:30 tls Exp $"; +#endif #endif /* not lint */ #include + +#include #include -#include #include #include #include #include #include +#include +#include #include "quiz.h" #include "pathnames.h" @@ -130,13 +139,13 @@ get_file(file) qp = &qlist; qsize = 0; while ((lp = fgetln(fp, &len)) != NULL) { + lp[--len] = '\0'; 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; - lp[len - 1] = '\0'; if ((qp->q_text = strdup(lp)) == NULL) err(1, NULL); qp->q_asked = qp->q_answered = FALSE; @@ -316,9 +325,10 @@ appdstr(s, tp, len) if ((m = malloc(strlen(s) + len + 1)) == NULL) err(1, NULL); for (mp = m, sp = s; *mp++ = *sp++;); - + --mp; if (*(mp - 1) == '\\') --mp; + while ((ch = *mp++ = *tp++) && ch != '\n'); *mp = '\0';