[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
/usr/src/games/quiz/quiz.c
Hello,
this patch makes quiz(6) work correctly when called
$ quiz function ed-command
Some lines in /usr/shared/games/quiz.db/ed are broken into 3 parts,
quiz could not handle that.
For exmaple:
$ quiz function ed-command
...
print from next "TS" to following "TE"?
/TS/;/TE/p
quiz: too few fields in data file, line "[{+}1|+]|;[{.}+{1}|.1]{ (not ...p)}"
$
Alf
--- games/quiz/quiz.c.orig Sat Jun 19 16:36:59 2004
+++ games/quiz/quiz.c Sat Jun 19 16:37:11 2004
@@ -352,6 +352,10 @@
while ((ch = *mp++ = *tp++) && ch != '\n')
;
+
+ if (*(mp - 1) == '\n')
+ --mp;
+
*mp = '\0';
free(s);