1.\" $OpenBSD: quiz.6,v 1.9 2014/11/15 14:41:02 bentley Exp $ 2.\" 3.\" Copyright (c) 1991, 1993 4.\" The Regents of the University of California. All rights reserved. 5.\" 6.\" This code is derived from software contributed to Berkeley by 7.\" Jim R. Oldroyd at The Instruction Set. 8.\" 9.\" Redistribution and use in source and binary forms, with or without 10.\" modification, are permitted provided that the following conditions 11.\" are met: 12.\" 1. Redistributions of source code must retain the above copyright 13.\" notice, this list of conditions and the following disclaimer. 14.\" 2. Redistributions in binary form must reproduce the above copyright 15.\" notice, this list of conditions and the following disclaimer in the 16.\" documentation and/or other materials provided with the distribution. 17.\" 3. Neither the name of the University nor the names of its contributors 18.\" may be used to endorse or promote products derived from this software 19.\" without specific prior written permission. 20.\" 21.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND 22.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 23.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 24.\" ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE 25.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 26.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 27.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 28.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 29.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 30.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 31.\" SUCH DAMAGE. 32.\" 33.\" @(#)quiz.6 8.1 (Berkeley) 5/31/93 34.\" 35.Dd $Mdocdate: November 15 2014 $ 36.Dt QUIZ 6 37.Os 38.Sh NAME 39.Nm quiz 40.Nd random knowledge tests 41.Sh SYNOPSIS 42.Nm quiz 43.Op Fl t 44.Op Fl i Ar file 45.Ar category1 category2 46.Sh DESCRIPTION 47The 48.Nm 49utility tests your knowledge of random facts. 50It has a database of subjects from which you can choose. 51With no arguments, 52.Nm 53displays the list of available subjects. 54.Pp 55The options are as follows: 56.Bl -tag -width indent 57.It Fl i Ar file 58Specify an alternative index file. 59.It Fl t 60Use tutorial mode, in which questions are repeated later if you didn't get 61them right the first time, and new questions are presented less frequently 62to help you learn the older ones. 63.El 64.Pp 65Subjects are divided into categories. 66You can pick any two categories from the same subject. 67.Nm 68will ask questions from the first category and it expects answers from 69the second category. 70For example, the command 71.Dq quiz victim killer 72asks questions which are 73the names of victims, and expects you to answer with the cause of their 74untimely demise, whereas the command 75.Dq quiz killer victim 76works the other way around. 77.Pp 78If you get the answer wrong, 79.Nm 80lets you try again. 81To see the right answer, enter a blank line. 82.Sh INDEX AND DATA FILE SYNTAX 83The index and data files have a similar syntax. 84Lines in them consist of several categories separated by colons. 85The categories are regular expressions formed using the following 86meta-characters: 87.Pp 88.Bl -tag -width "pat|pat" -compact -offset indent 89.It pat|pat 90alternative patterns 91.It {pat} 92optional pattern 93.It [pat] 94delimiters, as in pat[pat|pat]pat 95.El 96.Pp 97In an index file, each line represents a subject. 98The first category in each subject is the pathname of the data file for 99the subject. 100The remaining categories are regular expressions for the titles of each 101category in the subject. 102.Pp 103In data files, each line represents a question/answer set. 104Each category is the information for the question/answer for that category. 105.Pp 106The backslash character 107.Pq Sq \e 108is used to quote syntactically significant 109characters, or at the end of a line to signify that a continuation line 110follows. 111.Pp 112If either a question or its answer is empty, 113.Nm 114will refrain from asking it. 115.Sh FILES 116.Bl -tag -width /usr/share/games/quiz.db -compact 117.It Pa /usr/share/games/quiz.db 118The default index and data files. 119.El 120.Sh BUGS 121.Nm 122is pretty cynical about certain subjects. 123