added quiz from net-2

This commit is contained in:
cgd 1993-04-04 10:49:24 +00:00
parent b6aa45dca4
commit 5bfb98b1c8
39 changed files with 2747 additions and 0 deletions

16
games/quiz/Makefile Normal file
View File

@ -0,0 +1,16 @@
# @(#)Makefile 5.1 (Berkeley) 11/10/91
PROG= quiz
MAN6= quiz.0
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
HIDEGAME=hidegame
beforeinstall:
(cd ${.CURDIR}/datfiles; install -c -o ${BINOWN} -g ${BINGRP} -m 444 \
${CATS} ${DESTDIR}/usr/share/games/quiz.db)
.include <bsd.prog.mk>

View File

@ -0,0 +1,43 @@
Algeria:Alg[iers|er]
Botswana:Gaberones
Burundi:Bujumbura
Cameroun:Yaound['e|e'|e]
Central Africa{n Rep{ublic}}:Bangui
Chad:Ndjamena
Congo:Brazzaville
Dahomey:Porto Novo
Ethiopia:Addis Ababa
Gabon:Libreville
Ghana:Accra
Guinea-Bissau:Bissau
Guinea:Conakry
Ivory Coast:Abidjan
Kenya:Nairobi
Lesotho:Maseru
Liberia:Monrovia
Libya:Al Bayda{'}
Malagasy{ Rep{ublic}}|Madagascar:Tananarive
Malawi:Zomba
Mali:Bamako
Mauritania:Nouakchott
Morocco:Rabat
Mo[z|,c|c,|c]ambique:Louren[,c|c,|c]o Marques
Niger:Niamey
Nigeria:Lagos
Rhodesia:Salisbury
Rwanda:Kigali
Senegal:Dakar
Sierra Leone:Freetown
Somali{ Rep{ublic}}:Mogadis[cio|hu]
Sudan:Khartoum
Swaziland:Mbabane
Tanzania:Dar es Salaam
Togo:Lom['e|e'|e]
Tunisia:Tunis
Uganda:Kampala
United Arab Rep{ublic}|Egypt:Cairo
Upper Volta:Ouagadougou
Zambia:Lusaka
Za["i|i"|i]re:Kinshasha
{Rep{ublic} of }South Africa:Pretoria
{The }Gambia:Bathurst

View File

@ -0,0 +1,27 @@
Argentina:Buenos Aires
Bahamas:Nassau
Barbados:Bridgetown
Bolivia:La Paz|Sucre
Bra[z|s]il:Brasilia
Canada:Ottawa
Chile:Santiago
Colombia:Bogot['a|a'|a]
Costa Rica:San Jose
Cuba:Ha[v|b]ana
Dominican Republic:Santo Domingo
Ecuador:Quito
El Salvador:San Salvador
Guatemala:Guatemala
Guyana:Georgetown
Haiti:Port au Prince
Honduras:Tegucigalpa
Jamaica:Kingston
Mexico:Mexico
Nicaragua:Managua
Panama:Panama
Paraguay:Asunci['o|o'|o]n
Peru:Lima
Trinidad[ and Tobago|]:Port of Spain
United States|US{A}:Washington
Uruguay:Montevideo
Venezuela:Caracas

124
games/quiz/datfiles/areas Normal file
View File

@ -0,0 +1,124 @@
201:northern new jersey|NJ:newark
202:washington d c|DC:
203:connecticut|CT:
204:manitoba:
205:alabama|AL:
206:western washington state|WA:seattle
207:maine|ME:
208:idaho|ID:
209:central california|CA:fresno
212:new york city, new york|NY:
213:los angeles, california|CA:
214:northeastern texas|TX:dallas
215:southeastern pennsylvania|PA:philadelphia
216:northeastern ohio|OH:akron
217:central illinois|IL:springfield
218:northern minnesota|MN:duluth
219:northern indiana|IN:south bend
301:maryland|MD:
302:delaware|DE:
303:colorado|CO:
304:west virginia|WV:
305:southeastern florida|FL:miami
306:saskatchewan:
307:wyoming|WY:
308:western nebraska|NE:omaha
309:northwestern illinois|IL:peoria
312:chicago, illinois|IL:
313:eastern michigan|MI:detroit
314:southeastern missouri|MO:jefferson city
315:northern central new york|NY:syracuse
316:southern kansas|KS:wichita
317:central indiana|IN:indianapolis
318:western louisiana|LA:shreveport
319:eastern iowa|IA:cedar rapids
401:rhode island|RI:
402:eastern nebraska|NE:north platte
403:alberta:
404:northern georgia|GA:atlanta
405:western oklahoma|OK:oklahoma city
406:montana|MT:
408:central coastal california|CA:san jose
412:western pennsylvania|PA:pittsburgh
413:western massachusetts|MA:springfield
414:southeastern wisconsin|WI:milwaukee
415:san francisco, california|CA:
416:southern central ontario:toronto
417:southwestern missouri|MO:springfield
418:northeastern quebec:quebec
419:northwestern ohio|OH:toledo
501:arkansas|AR:
502:western kentucky|KY:louisville
503:oregon|OR:
504:eastern louisiana|LA:new orleans
505:new mexico|NM:
506:new brunswick:
507:southern minnesota|MN:rochester
509:eastern washington state|WA:spokane
512:southern texas|TX:austin
513:southwestern ohio|OH:dayton
514:southwestern quebec:montreal
515:central iowa|IA:des moines
516:long island, new york|NY:
517:central michigan|MI:lansing
518:northeastern new york|NY:albany
519:southwestern ontario:windsor
601:mississippi|MS:
602:arizona|AZ:
603:new hampshire|NH:
604:british columbia:
605:south dakota|SD:
606:eastern kentucky|KY:ashland
607:southern central new york|NY:ithaca, binghamton
608:southwestern wisconsin|WI:madison
609:southern new jersey|NJ:trenton
612:central minnesota|MN:minneapolis
613:southeastern ontario:ottawa
614:southeastern ohio|OH:columbus
615:eastern tennessee|TN:nashville
616:western michigan|MI:grand rapids
617:eastern massachusetts|MA:boston
618:southern illinois|IL:centralia
701:north dakota|ND:
702:nevada|NV:
703:western virginia|VA:arlington
704:western north carolina:charlotte
705:northeastern ontario:sault ste. marie
707:northwestern california|CA:santa rosa
709:newfoundland:
712:western iowa|IA:council bluffs
713:southeastern texas|TX:houston
714:southern california|CA:san diego
715:northern wisconsin|WI:superior
716:northern western new york|NY:buffalo, rochester
717:eastern pennsylvania|PA:wilkes-barre, scranton
801:utah|UT:
802:vermont|VT:
803:south carolina|SC:
804:eastern virginia|VA:richmond
805:southern central coastal california|CA:bakersfield
806:panhandle texas|TX:amarillo
807:western ontario:fort william
808:hawaii|HI:
809:bermuda, puerto rico, virgin islands, caribbean:
812:southern indiana|IN:evansville
813:southwestern florida|FL:st. petersburg
814:central pennsylvania|PA:erie
815:northeastern illinois|IL:rockford
816:northern missouri|MO:kansas city
817:northern central texas|TX:fort worth
819:northwestern quebec:trois rivieres
901:western tennessee|TN:memphis
902:nova scotia, prince edward island:
903:western mexico:mexicali
904:northern florida|FL:jacksonville
905:eastern mexico:mexico city
906:upper michigan|MI:escanaba
907:alaska|AK:
912:southern georgia|GA:savannah
913:northern kansas|KS:topeka
914:southern new york|NY:westchester county
915:western texas|TX:el paso
916:northeastern california|CA:sacramento
918:eastern oklahoma|OK:tulsa
919:eastern north carolina|NC:raleigh

45
games/quiz/datfiles/arith Normal file
View File

@ -0,0 +1,45 @@
63 - ... = 55:8
147 - 3 = ...:144
614 - 9 ...:605
465 - 7 = ...:458
563 - ... = 560:3
33 - 14 = ...:19
42 - ... = 37:5
264 - 3 = ...:261
763 - 8 = ...:755
375 - 6 = ...:369
736 - ... = 728:8
62 - 34 = ...:28
75 - 8 = ...:67
244 - ... = 230:14
478 - 19 = ...:459
78 - ... = 75:3
679 - 5 = ...:674
564 - 7 = ...:557
761 - 5 = ...:756
718 - ... = 716:2
56 - 18 = ...:38
65 - ... = 48:17
748 - 5 = ...:743
856 - 8 = ...:848
763 - 5 = ...:758
445 - ... = 436:9
94 - 55 = ...:39
42 - 9 = ...:33
483 - ... = 455:28
742 - ... = 714:28
84 - ... = 75:9
569 - 7 = ...:562
856 - 7 = ...:849
324 - 6 = ...:318
437 - ... = 432:5
84 - 56 = ...:28
81 - ... = 65:16
326 - 4 = ...:322
643 - 7 = ...:636
546 - 9 = ...:537
842 - ... = 835:7
53 - 39 = ...:14
63 - 48 = ...:15
57 - 38 = ...:19
52 - 26 = ...:26

41
games/quiz/datfiles/asia Normal file
View File

@ -0,0 +1,41 @@
Afghanistan:Kabul
Australia:Canberra
Bahrein:Manama
Bangladesh:Dacca
Bhutan:Thimbu
Burma:Rangoon
China:Peking
Cyprus:Nicosia
India:New Delhi
Indonesia:Djakarta
Iran:Tehran
Iraq:Baghdad
Israel:Jerusalem
Japan:Tokyo
Jordan:Amman
Khmer|Cambodia:P{h}nom Penh
Kuwait:Al-kuwait
Laos:Vientiane
Lebanon:Beirut
Malaysia:Kuala Lumpur
Maldive Islands:Male
Mongolia:Ulan Bator
Nepal:Katmandu
North Korea:P{'}yongyang
North Yemen:San{'}a
Oman:Muscat
Pakistan:Islamabad
Papua[-| ]New Guinea:Port Moresby
Philippines:Quezon City
Qatar:Doha
Saudi Arabia:Riyadh|J{ei}ddah
Singapore:Singapore
South Korea:Seoul
South Yemen:Aden
Sri Lanka:Colombo
Syria:Damascus
Taiwan:Taipei
Thailand:Bangkok
Turkey:Ankara
United Arab Emirates:Abu Dhabi
Vietnam:Hanoi

View File

@ -0,0 +1,21 @@
cub:lion|tiger|bear
kitten:cat|fox|skunk|rabbit|bobcat|panther
gosling:goose
colt|foal:horse|donkey|zebra
puppy:dog
pup:seal|fox|beaver
duckling:duck
fawn:deer
piglet|shoat:pig
lamb:sheep
kid:goat|antelope
chick:chicken
tadpole|polliwog:frog|toad
joey:kangaroo
calf:cow|whale|moose|elephant|buffalo|giraffe
caterpillar:butterfly|moth
elver:eel
eaglet:eagle
owlet:owl
fingerling|fry:fish
nestling:bird

228
games/quiz/datfiles/bard Normal file
View File

@ -0,0 +1,228 @@
The quality of mercy is not strain['|e]d:\
It droppeth as the gentle rain from heaven:\
{The }Merchant{ of Venice{ IV-i}}:\
Portia
Friends{,} Romans{,} Countrymen:\
lend me your ears{;}:\
{Julius }Caesar{ III-ii}:\
{Mark }Antony
Neither a borrower nor a lender be:\
For loan oft loses both itself and friend{.}:\
Hamlet{ I-iii}:\
Polonius
To be{,} or not to be{\:}:\
that is the question{\:}:\
Hamlet{ III-i}:\
Hamlet
Alas{,} poor Yorick{!}:\
I knew him{,} Horatio{;}:\
Hamlet{ V-i}:\
Hamlet
Double{,} double toil and trouble{;}:\
Fire burn and cauldron bubble{.}:\
Macbeth{ IV-i}:\
Witch{es}
By the pricking of my thumbs{,}:\
Something wicked this way comes{.}:\
Macbeth{ IV-i}:\
{Second |2nd }Witch
Out, damned spot! out, I say!:\
:\
Macbeth{ V-i}:\
Lady Macbeth
Unbidden guests:\
Are often welcomest when they are gone{.}:\
{King }Henry VI{,} Part I{ I-ii}:\
She is a woman{,} therefore may be woo'd{;}:\
She is a woman{,} therefore may be [won|screw'd]{.}:\
Titus Andronicus{ II-i}:\
Demetrius
Such duty as the subject owes the prince{,}:\
Even such a woman oweth to her husband{.}:\
{The }Taming of the Shrew{ V-ii}:\
Kate
Who is Silvia{?} what is she{,}:\
That all our swains commend her{?}:\
{The }Two Gentlemen of Verona{ IV-ii}:\
Thurio
Tu-whit{,} tu-who[ - | |--]a merry note{,}:\
While greasy Joan doth keel the pot{.}:\
Love's Labo{u}r Lost{ V-ii}:\
Winter
My only love sprung from my only hate{!}:\
Too early seen unknown{,} and known too late{!}:\
Romeo{ and Juliet{ I-v}}:\
Juliet
But{,} soft{!} what light through yonder window breaks{?}:\
It is the east{,} and Juliet is the sun{!}:\
Romeo{ and Juliet{ II-ii}}:\
Romeo
What's in a name{?} That which we call a rose:\
By any other name would smell as sweet{.}:\
Romeo{ and Juliet{ II-ii}}:\
Juliet
Good night{,} good night{!} parting is such sweet sorrow{,}:\
That I shall say good night till it be morrow{.}:\
Romeo{ and Juliet{ II-ii}}:\
Juliet
A plague o['|n] both your houses{!}:\
They have made worms' meat of me{.}:\
Romeo{ and Juliet{ III-i}}:\
Mercutio
This royal throne of kings{,} this scepter['|e]d isle{,}:\
This earth of majesty{,} this seat of Mars{,}:\
{King }Richard II{ II-i}:\
John of Gaunt
Not all the water in a rough rude sea:\
Can wash the balm from an anointed king{.}:\
{King }Richard II{ III-ii}:\
{King }Richard II
I'll put a girdle round the earth:\
In forty minutes{.}:\
{A }Midsummer[-| ]Night's Dream{ II-i}:\
Puck
I can call spirits from the vasty deep{.}:\
Why{,} so can I{,} or so can any man{;}:\
{King }Henry IV{,} Part I{ II-iv}:\
There are more things in heaven and earth{,} Horatio{,}:\
Than are dream[t|ed] of in your philosophy{.}:\
Hamlet{ I-v}:\
Hamlet
The time is out of joint{;} O cursed spite{,}:\
That ever I was born to set it right{!}:\
Hamlet{ I-v}:\
Hamlet
Once more unto the breach{,} dear friends{,} once more{;}:\
Or close the wall up with our English dead{.}:\
{King }Henry V{ III-i}:\
{King }Henry V
Was ever woman in this humour woo['|e]d{?}:\
Was ever woman in this humour [won|screw'd]{?}:\
{King }Richard III{ I-ii}:\
{King }Richard III
Now is the winter of our discontent:\
Made glorious summer by this sun of York:\
{King }Richard III{ I-i}:\
{King }Richard III
There['s| is] a divinity that shapes our ends{,}:\
Rough[-| ]hew them how we will{.}:\
Hamlet{ V-ii}:\
Hamlet
There is a tide in the affairs of men:\
Which{,} taken at the flood{,} leads on to fortune{;}:\
{Julius }Caesar{ IV-iii}:\
Brutus
Never{,} never{,} never{,} never{,} never{.}:\
Pray you undo this button{.}{ Thank you{,} sir{.}}:\
{King }Lear{ V-iii}:\
{King }Lear
I grow{,} I prosper{\:}:\
Now{,} gods{,} stand up for bastards{!}:\
{King }Lear{ I-ii}:\
Edmund
The better part of valour is discretion{;}:\
in the which better part I have saved my life{.}:\
{King }Henry IV{,} Part I{ V-iv}:\
Falstaff
Asses are made to bear{,} and so are you{.}:\
Women are made to bear{,} and so are you{.}:\
{The }Taming of the Shrew{ II-i}:\
Full fathom five thy father lies{;}:\
Of his bones are coral made{;}:\
{The }Tempest{ I-ii}:\
Ariel
She lov['|e]d me for the dangers I had pass['|e]d{;}:\
And I lov['|e]d her that she did pity them{.}:\
Othello{ I-iii}:\
Othello
Uneasy lies the head that wears a crown{.}:\
Many good morrows to your Majesty{!}:\
{King }Henry IV{,} Part II{ III-i}:\
Mislike me not for my complexion{,}:\
The shadow['|e]d livery of the burnish['|e]d sun{.}:\
{The }Merchant{ of Venice{ II-i}}:\
Morocco
Cowards die many times before their deaths{;}:\
The valiant never taste of death but once{.}:\
{Julius }Caesar{ II-ii}:\
Caesar
O{h}{!|,} Pardon me{,} thou bleeding piece of earth{,}:\
That I am meek and gentle with these butchers{.}:\
{Julius }Caesar{ III-i}:\
{Mark }Antony
The play's the thing:\
Wherein I'll catch the conscience of the king{.}:\
Hamlet{ II-ii}:\
Hamlet
How sharper than a serpent's tooth it is:\
to have a thankless child{.}:\
{King }Lear{ I-iv}:\
{King }Lear
Had I but served my God with half the zeal I served my king:\
He would not in [mine|my] old age have left me naked to [mine|my] enemies{.}:\
{King }Henry VIII{ IV-ii}:\
{Cardinal }Wolsey
It seems she hangs upon the cheek of night:\
Like a rich jewel in an Ethiop's ear{.}:\
Romeo{ and Juliet{ I-v}}:\
Romeo
Where the bee sucks{,} there suck I{;}:\
In a cowslip's bell I lie{.}:\
{The }Tempest{ V-i}:\
Ariel
O brave new world{,}:\
That has such people [in't|in it]{!}:\
{The }Tempest{ V-i}:\
Miranda
Why{,} then the world's mine oyster{,}:\
Which I with sword will open{.}:\
{The }Merry Wives of Windsor{ II-ii}:\
Falstaff
A goodly apple rotten at the heart{\:}:\
O{h}{,} what a goodly outside falsehood hath{!|.}:\
{The }Merchant{ of Venice{ I-iii}}:\
Antonio
I never kill['|e]d a mouse{,} nor hurt a fly{;}:\
I trod upon a worm against my will{,}:\
Pericles{ IV-i}:\
Marina
Golden lads and girls all must{,}:\
Like chimney sweepers{,} come to dust{.}:\
Cymbeline{ IV-ii}:\
Guiderius
You blocks, you stones, you worse than senseless things!:\
O you hard hearts{,} you cruel men of Rome{.}:\
{Julius }Caesar{ I-i}:\
Marullus
A horse{!|,} a horse{!|,} my kingdom for a horse{!}:\
:\
{King }Richard III{ V-iv}:\
{King }Richard III
My salad days,:\
When I was green in judg{e}ment, cold in blood{,}:\
Antony [and|&] Cleopatra{ I-v}:\
Cleopatra
Age cannot wither her, nor custom stale:\
Her infinite variety{.}:\
Antony [and|&] Cleopatra{ II-iii}:\
Enobarbus
Give me some music\: music, moody food:\
Of us that trade in love{.}:\
Antony [and|&] Cleopatra{II-v}:\
Cleopatra
'Tis better playing with a lion's whelp,:\
Than with an old one dying{.}:\
Antony [and|&] Cleopatra:\
Enobarbus
The barge she sat in, like a burnished throne,:\
Burned on the water{.} The poop was burnished gold{;|.}:\
Antony [and|&] Cleopatra:\
Enobarbus
Done like a Frenchman - turn and turn again!:\
:\
{King }Henry VI{,} Part I{ III-iii}:\
{Joan }Pucelle|{Saint |St{.} }Joan{ of Arc}

View File

@ -0,0 +1,12 @@
rabbit:dragon
dragon:snake
snake:horse
horse:sheep
sheep:monkey
monkey:rooster
rooster:dog
dog:boar
boar:rat
rat:ox
ox:tiger
tiger:rabbit

View File

@ -0,0 +1,105 @@
actors|soldiers:company
angels:host
ants:colony|hill
apes:shrewdness
asses:pace|bunch
badgers:cete
bass:shoal
bears:sloth
bees:swarm
bees|locusts:swarm
birds:dissimulation
brats:passel
buffaloes:herd
candidates:slate
caterpillars:army
cats:clowder
cattle:drove|herd
chickens:peep|flock
crows:murder
curs:cowardice
dogs:pack
doves:dule
ducks:[pad|ba]dling
earthquakes:swarm
eggs:clutch
elephants:herd
elk:gang
engineers:corps
ferrets:business
finches:charm
firemen:brigade
fish:school
foxes:skulk
gangsters:mob
geese in flight:skein
geese on water:gaggle
goats:trip
grapes|banannas:bunch
hawks:cast
hens:brood
herons:siege
horses:haras|team
hounds:kennel
jellyfish:smack
kangaroos|monkeys:troop
kittens:kindle
lapwings:deceit
larks:exaltation|bevy
leopards:leap
lions:pride
locusts:plague
magpies:tidings
maidens|quail:bevy
martens:richness
men:band
moles:labor
monkeys|kangaroos:troop
mountains:range
mules:barren|baren
nightingales:watch
operating companies:at&t|bell system
owls:parliament
oxen:drove
partridges:covey
partridges|grouse:covey
peacocks:ostentation
people:crowd
pheasants:bouquet
plovers:congregation
ponies:string
porpoises:shoal
prisoners:gang
pups:litter
quail|maidens:bevy
rabbits:nest
ravens:unkindness
rhinoceroses:crash
robbers:band
roebucks:bevy
rooks:building
rubbish:heap
seals:pod
sheep:flock
ships:fleet
snipe:walk|wisp
sparrows:host
squirrels:dray
starlings:murmuration
stars:constellation
storks:mustering
swallows:flight
teal:spring
toads:knot
turkeys:rafter
turtledoves:pitying
whales:gam|pod
whales|fish:school
witches:coven
wolves:pack
wolves:route
woodcocks:fall
woodpeckers:descent
worshippers:congregation
{H|h}uns:horde
{wild }swine:sounder

84
games/quiz/datfiles/ed Normal file
View File

@ -0,0 +1,84 @@
prepare to add text at beginning of file:0a|1i
find name of file being edited:f
print last 3 lines of file:$-[2|-],$p
print previous line:[-|^]{p}|{.}-{1}{p}
print whole file:1,$p|g/[^|$]/p
delete this line and next:.{,|;}[{.}+{1}|.1]d
prepare to replace text from here to just before next "PP":\
.{,|;}/[PP|{^}\\.PP]/-{1}c
find next "1.2":/1\\.2/{p}
find next 2-or-more digit number:\
/\[[0|1]-9\]\[0-9\]/{p}
move rest of this paragraph (separated by "PP") to end of previous one:\
[.,|{.}+{1},|.1,]/[PP|{^}\\.PP]/-{1}m[??|?{^}{\\.}PP?]-{1}
print every "Oxygen" or "oxygen":[g|1,$g]/\[[Oo|oO]\]xygen/[p|.p]
change each "BTL" in file to "Bell Laboratories" and check:\
[g|1,$g]/BTL/[s|.s]/[/|BTL/]Bell Laboratories/gp
combine every even-numbered line with the next odd-numbered line:\
2,${-{1}}g/[^|$]/[j|.,{.}+{1}j|.,.1j]
print next "SH" and following line:\
/SH/;[{.}+{1}|.1]p|/SH/,[//|/SH/][{.}+{1}|.1]p
print from next "TS" to following "TE":/TS/;/TE/p
reverse order of lines in whole file:[g|1,$g]/^/[m|.m]0
replace each string of x's in current line by one x:\
[s|.s]/[x|\[x\]][x|\[x\]]*/x/g{p}{ (not s/x*/x/g)}
change first "hte" in current line to "the" and check:[s|.s]/hte/the/p
combine previous line and this one:\
[-,|^,|{.}-{1},].j
go to line after third "PP" ahead:\
/[PP|{^}\\.PP]/;[//|/[PP|{^}\\.PP]/];[//|/[PP|{^}\\.PP]/]\
[{+}1|+]|;[{.}+{1}|.1]{ (not ...p)}
exchange current line with previous line:\
[[-|^]m|{.}-{1}m].|{.}m[[--|^^]|{.}-2]
move everything from here through "stop." to end of file:\
.,/stop\\./m$
current line has 2 fields separated by 1 blank; exchange them:\
[s|.s]/[\\|^\\]([.|\[^ \]]*\\) \\([.|\[^ \]]*\\)[/|$/]\\2 \\1/{p}
insert a "0" after last "0" on current line:\
[s|.s]/[.*0/&0|^.*0/&0|0\\(\[^0\]*\\)$/[0&|00\1]|0\[^0\]*$/0&\
|\[^0\]*$/0&]/{p}
replace "a*b" by "a**b":s/[a\\*b|a[*]b]/a**b/{p}|\
s/\\*/**/p
attach the word "extra" to the end of the current line:\
[s|.s]/$/{ }extra/{p}
replace "ATT" in current line by "AT&T":\
[s|.s]/ATT/AT\\&T/{g}{p}
double the length of the current line by repetition:\
[s|.s]/[.*|.|^.*$]/&&/{p}
look for another line containing what you just looked for://
find the previous line that contains a capital letter:?\[A-Z\]?{p}
delete the next line that contains only capital letters:\
/^\[A-Z\]*$/d|/^\[A-Z\]\[A-Z\]*$/d
place a copy of current line at the end of the file:\
t$|.{,.}t$
find how many lines there are:=|$=
find the number of the current line:.=
delete the first 3 lines of the file:1,3d
delete every line that doesn't begin with "A":\
[v|1,$v]/^A/d{ (not g/^\[^A\]/d)}
delete every empty line from here through next "LP":\
.,/[LP|{{^}\\.}LP]/g/^$/d
print the line after each "AU":\
[g|1,$g]/[AU|{^}\\.AU]/[{.}+{1}|.1]{p}
delete everything after "proud" from current line:\
[s|.s]/proud.*/proud/{p}
delete part of current line from "alpha" through "omega":\
[s|.s]/alpha.*omega//{p}
save everything up through current line in file "prefix":1,.w prefix
prepare to add text at end of file:$a
append the contents of file "suffix" to this file:$r suffix
go back 10 lines:{.}-10{p}|----------
change every "01" in current line to "1":[s|.s]/01/1/g{p}
go to next line that contains a double capital letter:\
/\\(\[A-Z\]\\)\\1/{p}
place parens () around current line:\
[s|.s]/[.*|^.*$]/(&)/{p}
the current line is too long for your terminal; print it to fit:\
l|.l
put the work you've done back in the original file:w
append the whole file to the file "unfinished":\
[W|1,$W] unfinished
insert "\\&" at beginning of current line:\
[s|.s]/^/\\\\\\&/{p}
list your current directory:!ls
stop work on current file and shift to file "other":e other

View File

@ -0,0 +1,103 @@
H:1:1.008:Hydrogen
He:2:4.003:Helium
Li:3:6.94:Lithium
Be:4:9.013:Beryllium
B:5:10.82:Boron
C:6:12.011:Carbon
N:7:14.008:Nitrogen
O:8:16.0:Oxygen
F:9:19.0:Fluorine
Ne:10:20.183:Neon
Na:11:22.991:Sodium
Mg:12:24.32:Magnesium
Al:13:26.98:Aluminum
Si:14:28.09:Silicon
P:15:30.975:Phosphorus
S:16:32.066:Sulphur
Cl:17:35.457:Chlorine
Ar:18:39.944:Argon
K:19:39.1:Potassium
Ca:20:40.08:Calcium
Sc:21:44.96:Scandium
Ti:22:47.9:Titanium
V:23:50.95:Vanadium
Cr:24:52.01:Chromium
Mn:25:54.94:Manganese
Fe:26:55.85:Iron
Co:27:58.94:Cobalt
Ni:28:58.71:Nickel
Cu:29:63.54:Copper
Zn:30:65.38:Zinc
Ga:31:69.72:Gallium
Ge:32:72.6:Germanium
As:33:74.91:Arsenic
Se:34:78.96:Selenium
Br:35:79.916:Bromine
Kr:36:83.8:Krypton
Rb:37:85.48:Rubidium
Sr:38:87.63:Strontium
Y:39:88.92:Yttrium
Zr:40:91.22:Zirconium
Nb:41:92.91:Niobium
Mo:42:95.95:Molybdenum
Tc:43:(99):Technetium
Ru:44:101.1:Ruthenium
Rh:45:102.91:Rhodium
Pd:46:106.4:Palladium
Ag:47:107.88:Silver
Cd:48:112.41:Cadmium
In:49:114.82:Indium
Sn:50:118.7:Tin
Sb:51:121.76:Antimony
Te:52:127.61:Tellurium
I:53:126.91:Iodine
Xe:54:131.3:Xenon
Cs:55:132.91:Cesium
Ba:56:137.36:Barium
La:57:138.92:Lanthanum
Ce:58:140.13:Cerium
Pr:59:140.92:Praseodymium
Nd:60:144.27:Neodymium
Pm:61:(145):Promethium
Sm:62:150.35:Samarium
Eu:63:152.0:Europium
Gd:64:157.26:Gadolinium
Tb:65:158.93:Terbium
Dy:66:162.51:Dysprosium
Ho:67:164.94:Holmium
Er:68:167.27:Erbium
Tm:69:168.94:Thulium
Yb:70:173.04:Ytterbium
Lu:71:174.99:Lutetium
Hf:72:178.5:Hafnium
Ta:73:180.95:Tantalum
W:74:183.86:Tungsten
Re:75:186.22:Rhenium
Os:76:190.2:Osmium
Ir:77:192.2:Iridium
Pt:78:195.09:Platinum
Au:79:197.0:Gold
Hg:80:200.61:Mercury
Tl:81:204.39:Thallium
Pb:82:207.21:Lead
Bi:83:209.0:Bismuth
Po:84:(210):Polonium
At:85:(210):Astatine
Rn:86:(222):Radon
Fr:87:(223):Francium
Ra:88:(226):Radium
Ac:89:(227):Actinium
Th:90:232.05:Thorium
Pa:91:(231):Protactinium
U:92:238.07:Uranium
Np:93:(237):Neptunium
Pu:94:(242):Plutonium
Am:95:(243):Americium
Cm:96:(248):Curium
Bk:97:(247):Berkelium
Cf:98:(249):Californium
Es:99:(254):Einsteinium
Fm:100:(253):Fermium
Md:101:(256):Mendelevium
No:102:(253):Nobelium
Lw:103:(259):Lawrencium

View File

@ -0,0 +1,33 @@
Albania:Tirana|Tirane"
Andorra:Andorra la V[ell|iej]a
Austria:Vienna|Wien
Belgium:Brussel[s|]|Bruxelles
Bulgaria:Sofi[a|ya]
Czechoslovakia:Prague|Praha
Denmark:Copenhagen|K[o|o/]benhavn
East Germany:Berlin
United Kingdom|England|Great Britain|UK:London
Finland:Helsinki
France:Paris
Greece:Athens
Hungary:Budapest
Iceland:Reykjavik
Ireland|Eire:Dublin
Italy:Rom[e|a]
Liechtenstein:Vaduz
Luxembourg:Luxembourg
Malta:Valletta
Monaco:Monte Carlo
Netherlands|Holland:The Hague|'sGravenhage|den Haag|Amsterdam
Norway:Oslo
Poland:Wars[aw|zawa]
Portugal:Lisbo[n|a]
R[u|o]mania:Bucharest|Bucuresti
San Marino:San Marino
Spain:Madrid
Sweden:Stockholm
Switzerland:Bern{e}
Turkey:Ankara
USSR|Russia:Mos[cow|kva]
[West |]Germany:Bonn
Yugoslavia:Belgrade|Beograd

View File

@ -0,0 +1,7 @@
$luw$:{I} [loose|destroy]
$eluon$:{I} [loosed|destroyed|was loosing|was destroying]
$elusa$:{I} [loosed|destroyed]
$leluka$:{I} have [loosed|destroyed]
$lusw$:{I} will [loose|destroy]
$luswn$:[loosing|destroying]
$lusas$:{having} [loosed|destroyed]

12
games/quiz/datfiles/inca Normal file
View File

@ -0,0 +1,12 @@
manco capac:sinchi roca
sinchi roca:lloque yupanqui
lloque yupanqui:mayta capac
mayta capac:capac yupanqui
capac yupanqui:inca roca
inca roca:yahuar huacac
yahuar huacac:viracocha
viracocha:pachacuti
pachacuti:tupa inca yupanqui
tupa inca yupanqui:huayna capac
huayna capac:huascar
huascar:atahuallpa

31
games/quiz/datfiles/index Normal file
View File

@ -0,0 +1,31 @@
/usr/share/games/quiz.db/africa:Africa{n}:cap{ital}
/usr/share/games/quiz.db/america:America{n}:cap{ital}
/usr/share/games/quiz.db/areas:area{-code}:state{-region}:city
/usr/share/games/quiz.db/arith:arith{metic}:ans{wer}
/usr/share/games/quiz.db/asia:Asia{n}:cap{ital}
/usr/share/games/quiz.db/babies:baby:adult
/usr/share/games/quiz.db/bard:Shakespeare{{-}line{s}}|line{s}:next:work:char{acter}
/usr/share/games/quiz.db/chinese:{Chinese{-}}year:next
/usr/share/games/quiz.db/collectives:ind{ividuals}:coll{ective}
/usr/share/games/quiz.db/ed:function:ed-command
/usr/share/games/quiz.db/elements:symbol:number:weight:element
/usr/share/games/quiz.db/europe:Europe{an}:cap{ital}
/usr/share/games/quiz.db/greek:greek:english
/usr/share/games/quiz.db/inca:inca:succ{essor}
/usr/share/games/quiz.db/latin:latin:english
/usr/share/games/quiz.db/locomotive:locomotive:name
/usr/share/games/quiz.db/midearth:M[iddle{-}Earth|E]:cap{ital}
/usr/share/games/quiz.db/morse:clear|alpha{bet{ic}}:morse
/usr/share/games/quiz.db/mult:mult{iplication}:ans{wer}
/usr/share/games/quiz.db/murders:victim:killer
/usr/share/games/quiz.db/poetry:poem{-}line:next:poem:author
/usr/share/games/quiz.db/posneg:pos{itive}:neg{ative}
/usr/share/games/quiz.db/pres:pres{ident}:term:succ{essor}
/usr/share/games/quiz.db/province:province:cap{ital}
/usr/share/games/quiz.db/seq-easy:easy{-}{seq{uence}}:next:name
/usr/share/games/quiz.db/seq-hard:hard{-}{seq{uence}}:next:name
/usr/share/games/quiz.db/sexes:male:female
/usr/share/games/quiz.db/sov:sov{ereign}:cen{t{ury}}:succ{essor}
/usr/share/games/quiz.db/state:state:cap{ital}:abbr{ev{iation}}:flower
/usr/share/games/quiz.db/trek:star:trek
/usr/share/games/quiz.db/ucc:section:U{niform{-}}C{riminal{-}}C{ode}

157
games/quiz/datfiles/latin Normal file
View File

@ -0,0 +1,157 @@
condo:{I }found
condidi:{I }founded
laedo:{I }[injure|thwart]
impello:{I }[drive|force]
impulit:{he }[drove|forced]
sino:{I }permit
sinat:{he }permit{s}
dolor:pain|grief
invideo:{I }[envy|hate]
invisus:[hated|envied]
immitis:cruel|harsh
arceo:{I }[keep away|hinder|prevent]
ratis:ship
antrum:cave
freno:rein{ in}|curb|check
celsus:lofty
spelunca:cave{rn}
foedus (n.):agreement|treaty|truce
foedera:agreements|treaties
laxus:loose|free
habena:rein{s}
mulceo:soothe|calm
fluctus (n.):wave{s}
exigo:finish|spend
exegit:{he }[finished|spent]
opto (v.):desire|wish
optat:{he }[desire{s}|wish{es}]
capesso:seize|carry out
concilio (v.):secure|gain
converto:reverse
procella:blast|gust
polus:sky|heaven
mico:flash|gleam
extemplo:immediately
frigus (n.):cold|chill
ingemo:groan
os (n.):mouth
effundo:pour{ out}
corripio:snatch|catch
harena:sand
excutio:shake{ off}
nare:{to }swim
rima:crack|fissure
fatisco:gape{ open}
disjicio:scatter|disperse
dolus (n.):deceit
luo:wash{ away}|atone{ for}
cito (adv.):quickly|soon
tumidus:swollen
fugo:put to flight|drive out
adnitor:strive
seditio:riot|uprising
fax:fire{-}brand
volo (v.):fly
arrigo:prick up
cunctus:whole|entire
flecto:turn|guide
sinus:bay|fold|curve|gulf
scindo:split|divide
rupes:crag|cliff
geminus:twin
minatur:{he }threaten{s}
coruscus:flashing|waving
horreo:bristle
nemus:grove
nemora:groves
umbra:shade|shadow
intus:within
dulcis:sweet|fresh
sedile:seat|bench
fessus:weary|tired
uncus:hooked|curved
morsus:bite
artus:joint|limb
silex:flint
scintilla:spark
folium:leaf
aridus:dry
corrumpo:spoil|ruin
corrupit:{he }[spoil{ed}|ruin{ed}]
frux:grain
torreo:parch
celsus:high|lofty
cervus:stag
erro:wander
armentum:herd
pasco:feed|nourish
pascor:graze
arcus:bow
turba:crowd
sterno:strew
humus:ground|earth
vinum:wine
maereo:mourn|sorrow
ignarus:unknowing|ignorant|inexperienced
rabies:rage|fury
penitus:within
sono (v.):sound|roar
maestus:sad|gloomy
forsan:perhaps
olim:someday|sometime
memini:{I }remember
varius:different
discrimen:crisis|danger
quiesco:become quiet
refert:{he }[say{s}|tell{s}]
vultus:face|countenance
cor:heart
corda:hearts
dolor:pain|grief
daps:feast
dapes:feasts
viscus:flesh
seco:cut
tremo:quiver
pinguis:fat|rich
mensa:table
sermo:talk|discourse
dubius:doubtful|wavering
pius:dutiful|devoted|loyal
gemo:lament|moan|bemoan
crudelis:cruel|bitter
lumen:light|eye
lumina:lights|eyes
tristis:sad
lacrima:tear
niteo:shine|glisten
fulmen:thunderbolt|lightning
fulmina:thunderbolts
funus:death|disaster
funera:deaths|disasters
orbis terrarum:world
ductor:leader
dicio (n.):power
fons:spring|source
fontes:springs|sources
arvum:land
infandus:unspeakable
rideo:laugh
osculum:lip
libo:sip|touch|kiss
nata:daughter
haereo:{I }[stick to|adhere]
promitto:primise
sublimis:high|uplifted|up high
quando:since|when|because
arcanum:{a }secret
ferox:fierce|savage
contundo:crush
albus:white
donec:until
sacerdos:priest{ess}
lupus:wolf
nutrix:nurse
nutrices:nurses
fulvus:tawny|yellow
meta:limit|boundary

View File

@ -0,0 +1,11 @@
4-4-0:American
4-6-0:Mogul
4-4-2:Atlantic
4-6-2:Pacific
2-8-0:Consolidation
2-8-2:Mikado
4-8-2:Mountain
2-8-4:Berkshire
4-6-4:Hudson
4-8-4:Northern
2-10-2:Decapod

View File

@ -0,0 +1,10 @@
Shire:Michel Delving|Hobbiton
Mordor:Minas Morgul
Gondor:Minas Tirith
Umbar:{City of the }Corsairs
Rhovanion:Esgaroth{ upon the Long Lake}
Rohan:Edoras
Lothl['o|o|o']rien:Caras Galadon
Breeland:Bree
Arnor:Ann['u|u'|u]minas
Arthedain:Fornost{ Erain}|Norbury of the Kings

26
games/quiz/datfiles/morse Normal file
View File

@ -0,0 +1,26 @@
A:.-
B:-...
C:-.-.
D:-..
E:.
F:..-.
G:--.
H:....
I:..
J:.---
K:-.-
L:.-..
M:--
N:-.
O:---
P:.--.
Q:--.-
R:.-.
S:...
T:-
U:..-
V:...-
W:.--
X:-..-
Y:-.--
Z:--..

99
games/quiz/datfiles/mult Normal file
View File

@ -0,0 +1,99 @@
1 x 0:0
1 x 1:1
1 x 2:2
1 x 3:3
1 x 4:4
1 x 5:5
1 x 6:6
1 x 7:7
1 x 8:8
1 x 9:9
1 x 10:10
2 x 0:0
2 x 1:2
2 x 2:4
2 x 3:6
2 x 4:8
2 x 5:10
2 x 6:12
2 x 7:14
2 x 8:16
2 x 9:18
2 x 10:20
3 x 0:0
3 x 1:3
3 x 2:6
3 x 3:9
3 x 4:12
3 x 5:15
3 x 6:18
3 x 7:21
3 x 8:24
3 x 9:27
3 x 10:30
4 x 0:0
4 x 1:4
4 x 2:8
4 x 3:12
4 x 4:16
4 x 5:20
4 x 6:24
4 x 7:28
4 x 8:32
4 x 9:36
4 x 10:40
5 x 0:0
5 x 1:5
5 x 2:10
5 x 3:15
5 x 4:20
5 x 5:25
5 x 6:30
5 x 7:35
5 x 8:40
5 x 9:45
5 x 10:50
6 x 0:0
6 x 1:6
6 x 2:12
6 x 3:18
6 x 4:24
6 x 5:30
6 x 6:36
6 x 7:42
6 x 8:48
6 x 9:54
6 x 10:60
7 x 0:0
7 x 1:7
7 x 2:14
7 x 3:21
7 x 4:28
7 x 5:35
7 x 6:42
7 x 7:49
7 x 8:56
7 x 9:63
7 x 10:70
8 x 0:0
8 x 1:8
8 x 2:16
8 x 3:24
8 x 4:32
8 x 5:40
8 x 6:48
8 x 7:56
8 x 8:64
8 x 9:72
8 x 10:80
9 x 0:0
9 x 1:9
9 x 2:18
9 x 3:27
9 x 4:36
9 x 5:45
9 x 6:54
9 x 7:63
9 x 8:72
9 x 9:81
9 x 10:90

View File

@ -0,0 +1,25 @@
Cock Robin:{the }sparrow
sleep|Duncan:Macbeth
{the }cat:curiosity|care
{John {F{.} }}Kennedy|JFK:{Lee Harvey }Oswald|{the }FBI|{the }CIA
{Lee Harvey }Oswald:{Jack }Ruby|{the }FBI|{the }CIA
{Martin Luther }King:{James {Earl }}Ray|{the }FBI|{the }CIA
[Bobby |Robert {F{.} }]Kennedy|RFK:{Sirhan }Sirhan|{the }FBI|{the }CIA
Christ:{the }Romans|{Pontius }Pilate|{the }CIA
{Sharon }Tate:{Charles }Manson
Charles Lindbergh Jr{.}:{Bruno }Hauptman{n}
{Mr{.} }{{and }Mrs{.} }Borden|{her }parents:Lizzie{ Borden}
{Prof{essor} }{James }Moriarty:{Sherlock }Holmes
Achilles:Paris
Abel:Cain
{the }nurses:{Richard }Speck
{J{.} |Julius }Caesar:Brutus{ et al.}
Pompeii:Vesuvius
{Abraham |Abe }Lincoln:{John {Wilkes }}Booth
{Yukio }Mishima:{Yukio }Mishima
{Alexander }Hamilton:{Aaron }Burr
Cleopatra:{the |an }asp
[Ann Boleyn|Catharine Howard]:Henry{ VIII}
vaudeville:{the }movies|film
{the }movies|film:TV|television
{the }VA patients:{the }nurses

184
games/quiz/datfiles/poetry Normal file
View File

@ -0,0 +1,184 @@
Come live with me and be my love:\
And we will all the pleasures prove:\
{The }Passionate Shepherd{ to his Love}:\
{Christopher }Marlowe
Shall I compare thee to a summer's day{?}:\
Thou art more lovely and more temperate:\
Sonnet 18:\
{William }Shakespeare
Fine knacks for ladies, cheap, choice, brave, and new!:\
Good pennyworths{! }but money cannot move:\
Fine Knacks{ for Ladies}:\
{John }Dowland
My mind to me a kingdom is:\
Such perfect joy therein I find:\
My Mind to Me a Kingdom Is:\
{Sir }{Edward }Dyer
Underneath this stone doth lie:\
As much beauty as could die:\
Epitaph on Elizabeth{,} {L. H.}:\
{Ben }Jonson
Death be not proud, though some have called thee:\
Mighty and dreadful{,} for thou art not so:\
{Holy }Sonnet{s}{ 10}:\
{John }Donne
Gather ye rose-buds while ye may:\
Old Time is still a-flying:\
To the Virgins{,} {To Make Much of Time}:\
{Robert }Herrick
Why so pale and wan, fond lover?:\
Prithee{,} why so pale{?}:\
Song:\
{Sir }{John }Suckling
Stone walls do not a prison make:\
Nor iron bars a cage:\
To Althea{,} From Prison:\
{Richard }Lovelace
I could not love thee (Dear) so much,:\
Lov['|e]d I not hono{u}r more:\
To Lucasta{, Going to the Wars}:\
{Richard }Lovelace
I saw Eternity the other night:\
Like a great ring of pure and endless light:\
{The }World:\
{Henry }Vaughan
Come and trip it as you go,:\
On the light fantastic toe:\
L'Allegro:\
{John }Milton
When I consider how my light is spent:\
Ere half my days in this dark world and wide:\
On His Blindness|When I Consider:\
{John }Milton
The grave's a fine and private place{,}:\
But none{,} I think{,} do there embrace{.}:\
To His Coy Mistress:\
{Andrew }Marvel
Great wits are sure to madness near allied:\
And thin partitions do their bounds divide:\
Absalom and Achitophel|Absalom:\
{John }Dryden
A little learning is a dangerous thing{;}:\
Drink deep{,} or taste not the Pierian spring{.}:\
{An }Essay on Criticism|{On }Criticism:\
{Alexander }Pope
The curfew tolls the knell of parting day{,}:\
The lowing herd wind slowly o'er the lea:\
Elegy{ Written in a Country Church{-| }Yard:\
{Thomas }Gray
The best laid schemes o' mice an' men gang aft a-gley{,}:\
An{'|d} lea{'|v}e us nought but grief an{'|d} pain for promised joy{.}:\
To a Mouse:\
{Robert }Burns
Tiger! tiger! burning bright!:\
In the forests of the night:\
{The }Tiger:\
{William }Blake
My heart leaps up when I behold:\
A rainbow in the sky:\
My Heart Leaps Up:\
{William }Wordsworth
The world is too much with us; late and soon{,}:\
Getting and spending{,} we lay waste our powers:\
{The }World is Too Much With Us|Sonnet:\
{William }Wordsworth
A sadder and a wiser man{,}:\
He rose the morrow morn:\
{The }{Rime of }{The }Ancient Mariner:\
{Samuel }{Taylor }Coleridge
In Xanadu did Kubla Khan:\
A stately pleasure{-| }dome decree:\
Kubla Khan:\
{Samuel }{Taylor }Coleridge
She walks in beauty, like the night:\
Of cloudless climes and starry skies:\
She Walks in Beauty:\
{George Gordon, }{Lord }Byron
I want a hero- an uncommon want{,}:\
When every year and month sends forth a new one:\
Don Juan{ Canto I}:\
{George Gordon, }{Lord }Byron
A thing of beauty is a joy forever.:\
Its loveliness increases{;|.} {it will never/Pass into nothingness}:\
Endymion{ Book I}:\
{John }Keats
Matched with an aged wife, I mete and dole:\
Unequal laws unto a savage race:\
Ulysses:\
{Alfred{,} }{Lord }Tennyson
He will hold thee, when his passion shall have spent its novel force{,}:\
Something better than his dog{,} a little dearer than his horse:\
Locksley Hall:\
{Alfred{,} }{Lord }Tennyson
'Tis better to have loved and lost:\
Than never to have loved at all:\
{In }Memoriam{ A. H. H.}:\
{Alfred{,} }{Lord }Tennyson
Kind hearts are more than coronets,:\
And simple faith than Norman blood{.}:\
Lady Clara Vere de Vere:\
{Alfred{,} }{Lord }Tennyson
Oh, to be in England:\
Now that April's there:\
Home{-| }Thoughts{,} From Abroad:\
{Robert }Browning
Ah, but a man's reach should exceed his grasp{,}:\
Or what's a heaven for{?}:\
Andrea Del Sarto:\
{Robert }Browning
How do I love thee? Let me count the ways.:\
I love thee to the depth and breadth and height:\
Sonnet{s} {From the Portuguese}{ 43}:\
{Elizabeth }{Barrett }Browning
A Book of Verses underneath the Bough{,}:\
A Jug of Wine, a Loaf of Bread{-|,| }and Thou:\
{The }Rubaiyat{ of Omar Khayyam}{ 12}:\
{Edward }Fitzgerald
The Moving Finger writes; and, having writ,:\
Moves on{\:|,|.} nor all your Piety nor Wit:\
{The }Rubaiyat{ of Omar Khayyam}{ 71}:\
{Edward }Fitzgerald
Ah Love! could you and I with Him conspire:\
To grasp this sorry Scheme of Things entire:\
{The }Rubaiyat{ of Omar Khayyam}{ 99}:\
{Edward }Fitzgerald
Remember me when I am gone away,:\
Gone far away into the silent land:\
Remember:\
{Christina }Rossetti
Home is the sailor, home from the sea,:\
And the hunter home from the hill:\
Requiem:\
{Robert }{Louis }Stevenson
I fled Him, down the nights and down the days;:\
I fled Him, down the arches of the years:\
{The }Hound of Heaven:\
{Francis }Thompson
So 'ere's to you, Fuzzy-Wuzzy, at your 'ome in the Soudan;:\
You're a {pore|poor} benighted {'|h}eathen but a first class fightin{'|g} man:\
Fuzzy{-| }Wuzzy:\
{Rudyard }Kipling
Morns abed and daylight slumber:\
Were not meant for man alive:\
Reveille:\
{A{.}{ }E{.}{ }}Houseman
I will arise and go now, and go to Innisfree,:\
And a small cabin build there{,} of clay and wattles made:\
{The }{Lake Isle of }Innisfree:\
{William }{Butler }Yeats
I must go down to the seas again, to the lonely sea and the sky,:\
And all I ask is a tall ship and a star to steer her by:\
Sea{-| }Fever:\
{John }Masefield
April is the cruelest month, breeding:\
Lilacs out of the dead land:\
{The }Waste{ }Land:\
{T{.}{ }S{.}{ }}Eliot
Now as I was young and easy under the apple boughs:\
About the little house and happy as the grass was green:\
Fern Hill:\
{Dylan }Thomas
Of Man's first disobedience, and the fruit:\
Of that forbidden tree{,} whose mortal taste:\
Paradise Lost:\
{John }Milton

View File

@ -0,0 +1,50 @@
large|big:small
on:off
standing up:sitting down
inside:outside
high:low
old:new|young
hot:cold
out:in
heavy|dark:light
daytime:night[time| time]
stop|come:go
top:bottom
floor:ceiling
near:far
run:walk
empty|hungry:full
backwards:f[or|ront]wards
big|large:little|small
fat|thick:thin|skinny
bright|light:dark|dull
right:wrong|left
give:take|receive|get
buy:sell
shiny|bright:dull
dawn:dusk
fall down|go to bed:[get|stand|rise] up
asleep:awake
up:down
open[|ed|]:close[d|]
smile:frown|cry
happy|glad:sad
hard:soft|easy
boy|woman|lady:girl|man
fast:slow
wet:dry
covered|hid[den|]:uncovered|open
good:bad
always|sometimes|now:never|sometimes
beautiful|pretty:ugly
rough:smooth
hairy:bald||smooth
above:below
yin:yang
sweet:sour
if:unless
from|fro:to
with[|in|]:without|against
after:before
together:apart
plus:minus

38
games/quiz/datfiles/pres Normal file
View File

@ -0,0 +1,38 @@
{G{eorge} }Washington:1789-{17}97:{J{ohn} }Adams
{J{ohn} }Adams:1797-1801:{T{homas} }Jefferson
{T{homas} }Jefferson:1801-{{18}0}9:{J{ames} }Madison
{J{ames} }Madison:1809-{18}17:{J{ames} }Monroe
{J{ames} }Monroe:1817-1825:{J{ohn} }{Q{uincy} }Adams
{J{ohn} }{Q{uincy} }Adams:1825-{{18}2}9:{A{ndrew} }Jackson
{A{ndrew} }Jackson:1829-{18}37:{M{artin} }Van Buren
{M{artin} }Van Buren:1837-{18}41:{W{illiam|m} }{H{enry} }Harrison
{W{illiam|m} }{H{enry} }Harrison:1841:{J{ohn} }Tyler
{J{ohn} }Tyler:1841-{{18}4}5:{J{ames} }{K{nox} }Polk
{J{ames} }{K{nox} }Polk:1845-{{18}4}9:{Z{achary} }Taylor
{Z{achary} }Taylor:1849-{18}50:{M{illard} }Fillmore
{M{illard} }Fillmore:1850-{{18}5}3:{F{ranklin} }Pierce
{F{ranklin} }Pierce:1853-{{18}5}7:{J{ames} }Buchanan
{J{ames} }Buchanan:1857-{18}61:{A{braham|be} }Lincoln
{A{braham|be} }Lincoln:1861-{{18}6}5:{A{ndrew} }Johnson
{A{ndrew} }Johnson:1865-{{18}6}9:{U{lysses} }{S{impson} }Grant
{U{lysses} }{S{impson} }Grant:1869-{18}77:{R{utherford} }{B{irchard} }Hayes
{R{utherford} }{B{irchard} }Hayes:1877-{18}81:{J{ames} }{A{bram} }Garfield
{J{ames} }{A{bram} }Garfield:1881:{C{hester} }{A{lan} }Arthur
{C{hester} }{A{lan} }Arthur:1881-{{18}8}5:{G{rover} }Cleveland{ (1st term)}
{G{rover} }Cleveland{ (1st term)}:1885-{{18}8}9:{B{enjamin} }Harrison
{B{enjamin} }Harrison:1889-{18}93:{G{rover} }Cleveland{ (2nd term)}
{G{rover} }Cleveland{ (2nd term)}:1893-{18}97:{W{illiam|m} }McKinley
{W{illiam|m} }McKinley:1897-1901:{T{heodore|eddy} }Roosevelt|TR
{T{heodore|eddy} }Roosevelt|TR:1901-{{19}0}9:{W{illiam|m} }{H{oward} }Taft
{W{illiam|m} }{H{oward} }Taft:1909-{19}13:{W{oodrow} }Wilson
{W{oodrow} }Wilson:1913-{19}21:{W{arren} }{G{amaliel} }Harding
{W{arren} }{G{amaliel} }Harding:1921-{{19}2}3:{C{alvin} }Coolidge
{C{alvin} }Coolidge:1923-{{19}2}9:{H{erbert} }Hoover
{H{erbert} }Hoover:1929-{19}33:{F{ranklin} }{D{elano} }Roosevelt|FDR
{F{ranklin} }{D{elano} }Roosevelt|FDR:1933-{19}45:{H{arry} }{S }Truman
{H{arry} }{S }Truman:1945-{19}53:{D{wight} }{D{avid} }Eisenhower
{D{wight} }{D{avid} }Eisenhower:1953-{19}61:{J{ohn} }{F{itzgerald} }Kennedy|JFK
{J{ohn} }{F{itzgerald} }Kennedy|JFK:1961-{{19}6}3:{L{yndon} }{B{aines} }Johnson|LBJ
{L{yndon} }{B{aines} }Johnson|LBJ:1963-{{19}6}9:{R{ichard} }{M{ilhouse} }Nixon
{R{ichard} }{M{ilhouse} }Nixon:1969-{19}74:{G{erald} }{R{obert} }Ford
{G{erald} }{R{obert} }Ford:1974-:

View File

@ -0,0 +1,13 @@
Newfoundland{ and Labrador}:[St.|Saint] John's
New Brunswick:Fredericton
Prince Edward Island:Charlottetown
Nova Scotia:Halifax
Quebec:Quebec
Ontario:Toronto
Manitoba:Winnipeg
Saskatchewan:Regina
Alberta:Edmonton
British Columbia:Victoria
Yukon Territory:Whitehorse
Northwest Territories:Yellowknife
Canada:Ottawa

View File

@ -0,0 +1,14 @@
1,2,3,4,5,6:7{(integers)}:integers|[natural|counting] numbers
1,2,3,5,8,13:21{(Fibonacci)}:Fibonacci{ seq{ence}| numbers}
1,2,4,8,16,32:64{(powers of 2)}:powers of 2|2[**|^]n
1,2,6,24,120,720:5040{(factorials)}:factorials|n!
1,3,5,7,9,11:13{(odd nos.)}:odd [integ|numb]ers
1,3,6,10,15,21:28{(triangular)}:triangular{ numbers}|C(n,2)
1,3,9,27,81:243{(powers of 3)}:powers of 3|3[**|^]n
1,4,9,16,25:36{(squares)}:squares|n[**|^]2
1,4,16,64:256{(powers of 4)}:powers of 4|4[**|^]n
1,5,25,125:625{(powers of 5)}:powers of 5|5[**|^]n
1,8,27,64,125:216{(cubes)}:cubes|n[**|^]3
2,3,5,7,11,13:17{(primes)}:prime[ number]s
2,4,6,8,10,12:14{(even nos.)}:even [integ|numb]ers|multiples of 2|2n
3,6,9,12,15:18{(3n)}:multiples of 3|3n

View File

@ -0,0 +1,15 @@
1,1,2,1,2,2,3,1,2,2,3,2,3,3,4:1{(1's in binary nos)}:number of 1's in binary numbers
1,1,2,2,4,2,6,4,6,4,10:4{(phi(n))}:Euler's [totient|phi]{ function}|phi(n)
1,2,2,4,2,4,2,4,6,2:6{(diff of primes)}:diff{erences} [between|of] primes
1,2,4,11,34:156{(unlabeled graphs)}:{unlabeled }graphs
1,2,5,14,42,132:429{(Catalan)}:Catalan{ numbers}
1,2,5,16,61:272{(Euler)}:Euler{ numbers}
1,3,12,60,360:2520{(n!/2)}:Even permutations|n!/2
1,3,16,125,1296,16807:262144{(n**(n-2))}:{labeled }trees|n[**|^](n-2)
1,4,10,20,35,56:84{(C(n,3))}:Tetrahedral{ numbers}|C(n,3)
1,4,11,20,31,44,61:100{(n**2 base 8)}:[Squares|n[**|^]2} base 8|octal squares
1,4,16,256:65536{(2**2**n)}:{labeled }boolean functions|2[**|^]2[**|^]n
1,6,28:496{(perfect nos)}:perfect{ numbers}
2,7,1,8,2,8:1{(e)}:{digits of }e
3,1,4,1,5,9:2{(pi)}:{digits of }pi
3,7,31,127:8191{(Mersenne primes)}:Mersenne{ primes}

26
games/quiz/datfiles/sexes Normal file
View File

@ -0,0 +1,26 @@
Y|y:X|x
abbot:abbess
alumnus:alumna
ambassador:ambassadress
boar:sow
buck:doe
bull:cow
cob:pen
colt:filly
curator:curatrix
dog:bitch|vixen
duke:duchess
drake:duck
effeminate|womanish:mannish
gander:goose
gentleman:lady|gentlewoman
jack:jenny
lad:lass
manly:womanly
marquis:marchioness[|e]|marquise
monk:nun
[O|o]edipus complex:[E|e]lectra[| complex]
prince:princess
ram:ewe
rooster|cock:hen
stallion:mare

42
games/quiz/datfiles/sov Normal file
View File

@ -0,0 +1,42 @@
W[illia|]m [I|1|the Conqueror]:11:W[illia|]m [II|2|Rufus|the Red]
W[illia|]m [II|2|Rufus|the Red]:11:Hen[ry|] [I|1]
Hen[ry|] [I|1]:12:Stephen
Stephen:12:Hen[ry|] [II|2]
Hen[ry|] [II|2]:12:Rich[ard|] [I|1]
Rich[ard|] [I|1]:12:John
John:13|12-13:Hen[ry|] [III|3]
Hen[ry|] [III|3]:13:Ed[w[ard|]|] [I|1]
Ed[w[ard|]|] [I|1]:13-14|13|14:Ed[w[ard|]|] [II|2]
Ed[w[ard|]|] [II|2]:14:Ed[w[ard|]|] [III|3]
Ed[w[ard|]|] [III|3]:14:Rich[ard|] [II|2]
Rich[ard|] [II|2]:14:Hen[ry|] [IV|4] Part 1
Hen[ry|] [IV|4] Part 1:15|14-15:Hen[ry|] [IV|4] Part 2
Hen[ry|] [IV|4] Part 2:15|14-15:Hen[ry|] [V|5]
Hen[ry|] [V|5]:15:Hen[ry|] [VI|6]
Hen[ry|] [VI|6]:15:Ed[w[ard|]|] [IV|4]
Ed[w[ard|]|] [IV|4]:15:Ed[w[ard|]|] [V|5]
Ed[w[ard|]|] [V|5]:15:Rich[ard|] [III|3]
Rich[ard|] [III|3]:15:Hen[ry|] [VII|7]
Hen[ry|] [VII|7]:15-16|15|16:Hen[ry|] [VIII|8]
Hen[ry|] [VIII|8]:16:Ed[w[ard|]|] [VI|6]
Ed[w[ard|]|] [VI|6]:16:Mary
Mary:16:Eliz[abeth|][ [I|1]|]
Elizabeth[ [I|1]|]:16-17|16:Ja[me|]s [I|1]
Ja[me|]s [I|1]:17:Cha[rle|]s [I|1]
Cha[rle|]s [I|1]:17:[Oliver |]Cromwell
[Oliver |]Cromwell:17:Rich[ard|] Cromwell
Rich[ard|] Cromwell:17:Ch[arle|]s [II|2]
Cha[rle|]s [II|2]:17:Ja[me|]s [II|2]
Ja[me|]s [II|2]:17:W[illia|]m and Mary
W[illia|]m and Mary:17-18|17:Anne
Anne:18:Geo[rge|] [I|1]
Geo[rge|] [I|1]:18:Geo[rge|] [II|2]
Geo[rge|] [II|2]:18:Geo[rge|] [III|3]
Geo[rge|] [III|3]:18-19|18|19:Geo[rge|] [IV|4]
Geo[rge|] [IV|4]:19:W[illia|]m [IV|4]
W[illia|]m [IV|4]:19:Victoria
Victoria:19:Ed[w[ard|]|] [VII|7]
Ed[w[ard|]|] [VII|7]:19-20|19|20:Geo[rge|] [V|5]
Geo[rge|] [V|5]:20:Ed[w[ard|]|] [VIII|8]
Ed[w[ard|]|] [VIII|8]:20:Geo[rge|] [VI|6]
Geo[rge|] [VI|6]:20:Eliz[abeth|] [II|2]

View File

@ -0,0 +1,2 @@
The son went behind a cloud.:sun
Did you see the monky at the zoo?:monkey

50
games/quiz/datfiles/state Normal file
View File

@ -0,0 +1,50 @@
Alabama|Ala|AL:Montgomery:AL:goldenrod
Alaska|AK:Juneau:AK:forget{-| }me{-| }not
Arizona|Ariz|AZ:Phoenix:AZ:{saguaro }cactus
Arkansas|Ark|AR:Little Rock:AR:gok
Cal{if{ornia}}|CA:Sacramento:CA:{golden }poppy
Col{o{rado}}|CO:Denver:CO:columbine
Conn{ecticut}|CT:Hartford:CT:{mountain }laurel
Del{aware}|DE:Dover:DE:peach{ blossom}
Fl{orid}a|FL:Tallahassee:FL:orange{ blossom}
Georgia|Ga:Atlanta:GA:{Cherokee }rose
Hawaii|HI:Honolulu:HI:hibiscus
Idaho|Ida|ID:Boise:ID:syringa
Ill{inois}|IL:Springfield:IL:violet
Ind{iana}|IN:Indianapolis:IN:zinnia
Iowa|Ia:Des Moines:IA:{wild }rose
Kans{as}|Kan|KS:Topeka:KS:sun{ }flower
Kentucky|Ky:Frankfort:KY:goldenrod
Louisiana|La:Baton Rouge:LA:magnolia
Maine|Me:Augusta:ME:pinecone{ and}{ tassel}
Maryland|Md:Annapolis:MD:blackeyed susan
Mass{achusetts}|MA:Boston:MA:{trailing }arbutus
Mich{igan}|MI:Lansing:MI:apple{ blossom}
Minn{esota}|MN:Saint Paul|St Paul:MN:gok
Miss{issippi}|MS:Jackson:MS:magnolia
Missouri|Mo:Jefferson City:MO:hawthorn
Mont{ana}|MT:Helena:MT:bitterroot
Nebraska|Neb|NE|NB:Lincoln:NE|NB:goldenrod
Nevada|Nev|NV:Carson City:NV:sagebrush
New Hampshire|NH:Concord:NH:{purple }lilac
New Jersey|NJ:Trenton:NJ:violet
New Mexico|NM:Santa Fe:NM:yucca
New York|NY:Albany:NY:{wild }rose
N{orth} Carolina|NC:Raleigh:NC:dogwood
N{orth} Dakota|ND:Bismarck:ND:{wild }{prarie }rose
Ohio|O|OH:Columbus:OH:{scarlet }carnation
Oklahoma|Okla|OK:Oklahoma City:OK:mistletoe
Oregon|Ore|OR:Salem:OR:{Oregon }grape
Pennsylvania|Pa:Harrisburg:PA:{mountain }laurel
Rhode Island|RI:Providence:RI:violet
S{outh} Carolina|SC:Columbia:SC:{yellow }jasmine
S{outh} Dakota|SD:Pierre:SD:pasque{ flower}
Tenn{essee}|TN:Nashville:TN:iris
Texas|Tex|TX:Austin:TX:blue{-| }bonnet
Utah|UT:Salt Lake City:UT:{sego }lilly
Vermont|Vt:Montpelier:VT:{red }clover
Virginia|Va:Richmond:VA:dogwood
Wash{ington}|WA:Olympia:WA:rhododendron
W{est} Virginia|W{ }Va|WV:Charleston:WV:rhododendron
Wisconsin|Wis|WI:Madison:WI:violet
Wyo{ming}|WY:Cheyenne:WY:indian paint brush

19
games/quiz/datfiles/trek Normal file
View File

@ -0,0 +1,19 @@
captain's name:{James |Jim }{T. }Kirk|{james |jim }{t. }kirk
first officers name:Spock|spock|Mr. Spock|mr. spock
name of ship:{the }{u.s.s. }enterprise|Enterprise
name of the "good guys":{the }Federation|federation|{the }federation
name of the "bad guys":{the }klingons|{the }romulans
nickname of chief engineer:scotty|Scotty
nickname of chief medical officer:bones|Bones
machine used for transportation to surface of nearby planet:transporter|shuttlecraft
main engines of ship:warp engines|warp
number of crew:400|four hundred
hand-held weapon:phaser
type of torpedoes used on the ship:photon torpedoes|photon
name of electronic protective device on ship:shields|shield
name of device that makes a ship invisible:cloaking device|cloak|cloaking
type of voice that the on-board computer has:female|feminine|woman's
where first officer comes from:vulcan|Vulcan
rare, but very powerful enemies:romulans|Romulans
reaction that main engines operate on:matter-antimatter{ reaction}|matter/antimatter{ reaction}
slow engines used in emergencies:impulse engines|impulse

127
games/quiz/datfiles/ucc Normal file
View File

@ -0,0 +1,127 @@
1-103:supplementary general principles of law applicable
1-106:remedies to be liberally administered
1-201:general definitions
1-203:obligation of good faith
1-205:course of dealing and usage of trade
1-206:statue of frauds for kinds of personal property not otherwise covered
2-103:definitions-sales
2-201:statute of frauds
2-208:course of performance or practical consideration
2-302:unconscionable contract or clause
2-310:open time for payment or running of credit
2-319:FOB and FAS terms
2-320:CIF and C&F terms
2-323:form of bill of lading required in overseas shipment
2-401:passing of title; reservation for security
2-402:rights of seller's creditors against sold goods
2-403:powr to transfer; good faith purchase of goods; entrusting
2-501:insurable interest in goods; manner of identification of goods
2-502:buyer's right to goods on seller's insolvency
2-503:manner of seller's tender of delivery
2-506:rights of financing agency
2-507:effect of seller's tender; delivery on condition
2-508:cure by seller of improper tender or delivery; replacement
2-509:risk of loss in the absence ogf breach
2-510:effect of breach on risk of loss
2-513:buyer's right to inspection of goods
2-601:buyer's rights on improper delivery
2-602:manner and effect of rightful rejection
2-603:merchant buyer's duties as to rightfully rejected goods
2-605:waiver of buyer's objections by failure to particularize
2-606:what constitutes acceptance of goods
2-607:effect of acceptance; notice of breach
2-608:revocation of acceptance in whole or in part
2-609:right to adequate assurance of performance
2-610:anticipatory repudiation
2-611:retraction of anticipatory repudiation
2-612:installment contract; breach
2-702:seller's remedies on discovery o buyer's insolvency
2-703:seller's remedies in general
2-705:seller's stoppage of delivery in transit or otherwise
2-706:seller's resale including contract for resale
2-708:seller's damages for non-acceptance or repudiation
2-709:action for the price
2-711:buyer's remedies in general; buyer's security interest in rejected goods
2-712:cover; buyer's procurement of substitute goods
2-713:buyer's damages for on-delivery or repudiation
2-714:buyer's damages for breach in regard to accepted goods
2-715:buyer's incidental and consequential damages
2-716:buyer's right to specific performance or replevin
3-102:definitions-commercial paper
3-104:form of negotiable instruments; draft; check; certificate of deposit; note
3-110:payable to order
3-111:payable to bearer
3-201:transfer: right to indorsement
3-202:negotiation
3-204:special indorsement; blank indorsement
3-301:rights of a holder
3-302:holder in due course
3-305:rights of a holder in due course
3-306:rights of one not holder in due course
3-401:signature
3-404:unauthorized signature
3-405:impostors; signature in name of payee
3-406:negligence contributing to alteration or unauthorized signature
3-407:alteration
3-410:definition and operation of acceptance
3-411:certification of a check
3-413:contract of maker, drawer and acceptor
3-414:contract of indorser; order of liability
3-417:warranties on presentment and transfer
3-418:finality of payment or acceptance
3-419:conversion of instrument; innocent representative
3-501:when presentment, notice of dishonor, and protest necessary or permissible
3-502:unexcused delay; discharge
3-503:time or presentment
3-507:dishonor; holder's right of recourse; term allowing representment
3-508:notice of dishonor
3-511:waived or excused presentment, protest or notice of dishonor or delay therein
3-601:discharge of parties
3-802:effect of instrument on obligation for which it is given
3-804:lost,destroyed or stolen instruments
4-104:definitions-bank deposits and collections
4-105:banks-depositary, intermediary, collecting, payor, presenting, remitting
4-207:warranties of customer and collecting bank on transfer or presentment of items
4-208:security interest of collecting bank in items, accompanying documents and proceeds
4-209:when bank gives value for purposes of holder in due course
4-211:media of remittance; provision and final settlement in remittance cases
4-213:final payment of item by payor bank
4-401:when bank may charge customer's account
4-406:customer's duty to discover and report unauthorized signature or alteration
4-402:bank liability to customer for wrongful dishonor
4-407:payor bank's right to subrogation on improper payment
5-111:warranties on transfer and presentment (letters of credit)
5-114:issuer's duty and privilege to honor; right to reimbursement
5-115:remedy for improper dishonor or anticipatory repudiaion (letters of credit)
7-104:negotiable and non-negotiable warehouse receipt, bill of lading, other title
7-204:duty of care; contractual limitation of warehouseperson's liability
7-301:liability for non-receipt or misdescription
7-403:obligation of warehouseperson or carrier to deliver; excuse
7-404:no liability for good faith delivery pursuant to receipt or bill
7-501:form of negotiation and requirements of due negotiation
7-502:rights acquired by due negotiation
7-503:document of title to goods defeated in certain cases
7-504:rights acquired in absence of due negotiation; effect of diversion
7-507:warranties on negotiation or transfer of receipt or bill
7-508:warranties of collecting bank as to documents
9-105:definitions-secured transactions
9-107:definitions "purchase money security interest"
9-109:classification of goods; consumer goods; equipment; farm products; inventory
9-113:security interests arising under article on sales
9-203:attachment and enforceability of security interest; proceeds; formal requisites
9-206:agreement not to asserr defenses against assignee; modification of sales warranties
9-301:persons who take priority over unperfected security interests
9-302:when filing is required to perfect security interest
9-303:when security interest is perfected
9-304:perfection of security interest in instruments, documents
9-305:when possession by secured party perfects security interest without filing
9-306:proceeds; secured party's rights on disposition of collateral
9-307:protection of buyers of goods
9-310:periority of certain liens arising by opration of law (mechanic's liens)
9-311:alienability of debtor's rights; judicial process
9-312:priorities among conflicting security interests in the same collateral
9-405:assignment of security interest
9-501:default; procedure when security agreement covers real and personal property
9-503:secured party's right to take possession after default
9-504:secured party's right to dispose of collateral after default
9-505:compulsory disposition of collateral; acceptance of collateral as discharge of obligation

37
games/quiz/pathnames.h Normal file
View File

@ -0,0 +1,37 @@
/*-
* Copyright (c) 1990 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
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. All advertising materials mentioning features or use of this software
* must display the following acknowledgement:
* This product includes software developed by the University of
* California, Berkeley and its contributors.
* 4. Neither the name of the University nor the names of its contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* @(#)pathnames.h 5.2 (Berkeley) 11/10/91
*/
#define _PATH_PAGER "/usr/bin/more"
#define _PATH_QUIZIDX "/usr/share/games/quiz.db/index"

119
games/quiz/quiz.6 Normal file
View File

@ -0,0 +1,119 @@
.\" Copyright (c) 1991 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.
.\"
.\" Redistribution and use in source and binary forms, with or without
.\" modification, are permitted provided that the following conditions
.\" are met:
.\" 1. Redistributions of source code must retain the above copyright
.\" notice, this list of conditions and the following disclaimer.
.\" 2. Redistributions in binary form must reproduce the above copyright
.\" notice, this list of conditions and the following disclaimer in the
.\" documentation and/or other materials provided with the distribution.
.\" 3. All advertising materials mentioning features or use of this software
.\" must display the following acknowledgement:
.\" This product includes software developed by the University of
.\" California, Berkeley and its contributors.
.\" 4. Neither the name of the University nor the names of its contributors
.\" may be used to endorse or promote products derived from this software
.\" without specific prior written permission.
.\"
.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
.\" ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
.\" SUCH DAMAGE.
.\"
.\" @(#)quiz.6 6.3 (Berkeley) 11/10/91
.\"
.Dd November 10, 1991
.Dt QUIZ 6
.Os
.Sh NAME
.Nm quiz
.Nd random knowledge tests
.Sh SYNOPSIS
.Nm quiz
.Op Fl t
.Op Fl i Ar file
.Op Ar question answer
.Sh DESCRIPTION
The
.Nm quiz
utility tests your knowledge of random facts.
It has a database of subjects from which you can choose.
With no arguments,
.Nm quiz
displays the list of available subjects.
.Pp
The options are as follows:
.Bl -tag -width indent
.It Fl t
Use tutorial mode, in which questions are repeated later if you didn't get
them right the first time, and new questions are presented less frequently
to help you learn the older ones.
.It Fl i
Specify an alternate index file.
.El
.Pp
Subjects are divided into categories.
You can pick any two categories from the same subject.
.Nm Quiz
will ask questions from the first category and it expects answers from
the second category.
For example, the command ``quiz victim killer'' asks questions which are
the names of victims, and expects you to answer with the cause of their
untimely demise, whereas the command ``quiz killer victim'' works the
other way around.
.Pp
If you get the answer wrong,
.Nm quiz
lets you try again.
To see the right answer, enter a blank line.
.Sh "Index and Data File Syntax"
The index and data files have a similar syntax.
Lines in them consist of several categories separated by colons.
The categories are regular expressions formed using the following
meta-characters:
.sp
.Bl -tag -width "pat|pat" -compact -offset indent
.It pat|pat
alternate patterns
.It {pat}
optional pattern
.It [pat]
delimiters, as in pat[pat|pat]pat
.El
.Pp
In an index file, each line represents a subject.
The first category in each subject is the pathname of the data file for
the subject.
The remaining categories are regular expressions for the titles of each
category in the subject.
.Pp
In data files, each line represents a question/answer set.
Each category is the information for the question/answer for that category.
.Pp
The backslash character (``\e'') is used to quote syntactically significant
characters, or at the end of a line to signify that a continuation line
follows.
.Pp
If either a question or its answer is empty,
.Nm quiz
will refrain from asking it.
.Sh FILES
.Bl -tag -width /usr/share/games/quiz.db -compact
.It Pa /usr/share/games/quiz.db
The default index and data files.
.El
.Sh BUGS
.Nm Quiz
is pretty cynical about certain subjects.

379
games/quiz/quiz.c Normal file
View File

@ -0,0 +1,379 @@
/*-
* Copyright (c) 1991 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.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. All advertising materials mentioning features or use of this software
* must display the following acknowledgement:
* This product includes software developed by the University of
* California, Berkeley and its contributors.
* 4. Neither the name of the University nor the names of its contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*/
#ifndef lint
char copyright[] =
"@(#) Copyright (c) 1991 The Regents of the University of California.\n\
All rights reserved.\n";
#endif /* not lint */
#ifndef lint
static char sccsid[] = "@(#)quiz.c 5.1 (Berkeley) 11/10/91";
#endif /* not lint */
#include <sys/types.h>
#include <errno.h>
#include <time.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <ctype.h>
#include "quiz.h"
#include "pathnames.h"
static QE qlist;
static int catone, cattwo, tflag;
static u_int qsize;
char *appdstr __P((char *, char *));
void downcase __P((char *));
void err __P((const char *, ...));
void get_cats __P((char *, char *));
void get_file __P((char *));
char *next_cat __P((char *));
void quiz __P((void));
void score __P((u_int, u_int, u_int));
void show_index __P((void));
void usage __P((void));
int
main(argc, argv)
int argc;
char *argv[];
{
register int ch;
char *indexfile;
indexfile = _PATH_QUIZIDX;
while ((ch = getopt(argc, argv, "i:t")) != EOF)
switch(ch) {
case 'i':
indexfile = optarg;
break;
case 't':
tflag = 1;
break;
case '?':
default:
usage();
}
argc -= optind;
argv += optind;
switch(argc) {
case 0:
get_file(indexfile);
show_index();
break;
case 2:
get_file(indexfile);
get_cats(argv[0], argv[1]);
quiz();
break;
default:
usage();
}
exit(0);
}
void
get_file(file)
char *file;
{
register FILE *fp;
register QE *qp;
size_t len;
char *lp;
if ((fp = fopen(file, "r")) == NULL)
err("%s: %s", file, strerror(errno));
/*
* XXX
* Should really free up space from any earlier read list
* but there are no reverse pointers to do so with.
*/
qp = &qlist;
qsize = 0;
while ((lp = fgetline(fp, &len)) != NULL) {
if (qp->q_text && qp->q_text[strlen(qp->q_text) - 1] == '\\')
qp->q_text = appdstr(qp->q_text, lp);
else {
if ((qp->q_next = malloc(sizeof(QE))) == NULL)
err("%s", strerror(errno));
qp = qp->q_next;
if ((qp->q_text = strdup(lp)) == NULL)
err("%s", strerror(errno));
qp->q_asked = qp->q_answered = FALSE;
qp->q_next = NULL;
++qsize;
}
}
(void)fclose(fp);
}
void
show_index()
{
register QE *qp;
register char *p, *s;
FILE *pf;
if ((pf = popen(_PATH_PAGER, "w")) == NULL)
err("%s: %s", _PATH_PAGER, strerror(errno));
(void)fprintf(pf, "Subjects:\n\n");
for (qp = qlist.q_next; qp; qp = qp->q_next) {
for (s = next_cat(qp->q_text); s; s = next_cat(s)) {
if (!rxp_compile(s))
err("%s", rxperr);
if (p = rxp_expand())
(void)fprintf(pf, "%s ", p);
}
(void)fprintf(pf, "\n");
}
(void)fprintf(pf, "\n%s\n%s\n%s\n",
"For example, \"quiz victim killer\" prints a victim's name and you reply",
"with the killer, and \"quiz killer victim\" works the other way around.",
"Type an empty line to get the correct answer.");
(void)pclose(pf);
}
void
get_cats(cat1, cat2)
char *cat1, *cat2;
{
register QE *qp;
int i;
char *s;
downcase(cat1);
downcase(cat2);
for (qp = qlist.q_next; qp; qp = qp->q_next) {
s = next_cat(qp->q_text);
catone = cattwo = i = 0;
while (s) {
if (!rxp_compile(s))
err("%s", rxperr);
i++;
if (rxp_match(cat1))
catone = i;
if (rxp_match(cat2))
cattwo = i;
s = next_cat(s);
}
if (catone && cattwo && catone != cattwo) {
if (!rxp_compile(qp->q_text))
err("%s", rxperr);
get_file(rxp_expand());
return;
}
}
err("invalid categories");
}
void
quiz()
{
register QE *qp;
register int i;
u_int guesses, rights, wrongs;
int next;
char *s, *t, question[LINE_SZ];
char *answer;
srandom(time(NULL));
guesses = rights = wrongs = 0;
for (;;) {
if (qsize == 0)
break;
next = random() % qsize;
qp = qlist.q_next;
for (i = 0; i < next; i++)
qp = qp->q_next;
while (qp && qp->q_answered)
qp = qp->q_next;
if (!qp) {
qsize = next;
continue;
}
if (tflag && random() % 100 > 20) {
/* repeat questions in tutorial mode */
while (qp && (!qp->q_asked || qp->q_answered))
qp = qp->q_next;
if (!qp)
continue;
}
s = qp->q_text;
for (i = 0; i < catone - 1; i++)
s = next_cat(s);
if (!rxp_compile(s))
err("%s", rxperr);
t = rxp_expand();
if (!t || *t == '\0') {
qp->q_answered = TRUE;
continue;
}
(void)strcpy(question, t);
s = qp->q_text;
for (i = 0; i < cattwo - 1; i++)
s = next_cat(s);
if (!rxp_compile(s))
err("%s", rxperr);
t = rxp_expand();
if (!t || *t == '\0') {
qp->q_answered = TRUE;
continue;
}
qp->q_asked = TRUE;
(void)printf("%s?\n", question);
for (;; ++guesses) {
if ((answer = fgetline(stdin, NULL)) == NULL) {
score(rights, wrongs, guesses);
exit(0);
}
downcase(answer);
if (rxp_match(answer)) {
(void)printf("Right!\n");
++rights;
qp->q_answered = TRUE;
break;
}
if (*answer == '\0') {
(void)printf("%s\n", t);
++wrongs;
if (!tflag)
qp->q_answered = TRUE;
break;
}
(void)printf("What?\n");
}
}
score(rights, wrongs, guesses);
}
char *
next_cat(s)
register char * s;
{
for (;;)
switch (*s++) {
case '\0':
return (NULL);
case '\\':
break;
case ':':
return (s);
}
/* NOTREACHED */
}
char *
appdstr(s, tp)
char *s;
register char *tp;
{
register char *mp, *sp;
register int ch;
char *m;
if ((m = malloc(strlen(sp) + strlen(tp) + 1)) == NULL)
err("%s", strerror(errno));
for (mp = m, sp = s; *mp++ = *sp++;);
if (*(mp - 1) == '\\')
--mp;
while ((ch = *mp++ = *tp++) && ch != '\n');
*mp = '\0';
free(s);
return (m);
}
void
score(r, w, g)
u_int r, w, g;
{
(void)printf("Rights %d, wrongs %d,", r, w);
if (g)
(void)printf(" extra guesses %d,", g);
(void)printf(" score %d%%\n", (r + w + g) ? r * 100 / (r + w + g) : 0);
}
void
downcase(p)
register char *p;
{
register int ch;
for (; ch = *p; ++p)
if (isascii(ch) && isupper(ch))
*p = tolower(ch);
}
void
usage()
{
(void)fprintf(stderr, "quiz [-t] [-i file] category1 category2\n");
exit(1);
}
#if __STDC__
#include <stdarg.h>
#else
#include <varargs.h>
#endif
void
#if __STDC__
err(const char *fmt, ...)
#else
err(fmt, va_alist)
char *fmt;
va_dcl
#endif
{
va_list ap;
#if __STDC__
va_start(ap, fmt);
#else
va_start(ap);
#endif
(void)fprintf(stderr, "quiz: ");
(void)vfprintf(stderr, fmt, ap);
va_end(ap);
(void)fprintf(stderr, "\n");
exit(1);
}

60
games/quiz/quiz.h Normal file
View File

@ -0,0 +1,60 @@
/*-
* Copyright (c) 1991 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.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. All advertising materials mentioning features or use of this software
* must display the following acknowledgement:
* This product includes software developed by the University of
* California, Berkeley and its contributors.
* 4. Neither the name of the University nor the names of its contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* @(#)quiz.h 5.1 (Berkeley) 11/10/91
*/
#define TRUE 1
#define FALSE 0
/* Length of compiled regexp machine; increase if not big enough. */
#define RXP_LINE_SZ 8192
/* Maximum line length for data files. */
#define LINE_SZ 1024
/* Linked list for holding index and data file information. */
typedef struct qentry {
struct qentry *q_next; /* next one */
char *q_text; /* category text string from file */
int q_asked; /* TRUE if question's been asked */
int q_answered; /* TRUE if question's been answered */
} QE;
extern char rxperr[];
int rxp_compile __P((char *));
char *rxp_expand __P((void));
int rxp_match __P((char *));

312
games/quiz/rxp.c Normal file
View File

@ -0,0 +1,312 @@
/*-
* Copyright (c) 1991 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.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. All advertising materials mentioning features or use of this software
* must display the following acknowledgement:
* This product includes software developed by the University of
* California, Berkeley and its contributors.
* 4. Neither the name of the University nor the names of its contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*/
#ifndef lint
static char sccsid[] = "@(#)rxp.c 5.1 (Berkeley) 11/10/91";
#endif /* not lint */
/*
* regular expression parser
*
* external functions and return values are:
* rxp_compile(s)
* TRUE success
* FALSE parse failure; error message will be in char rxperr[]
* metas are:
* {...} optional pattern, equialent to [...|]
* | alternate pattern
* [...] pattern delimiters
*
* rxp_match(s)
* TRUE string s matches compiled pattern
* FALSE match failure or regexp error
*
* rxp_expand()
* char * reverse-engineered regular expression string
* NULL regexp error
*/
#include <stdio.h>
#include <ctype.h>
#include "quiz.h"
/* regexp tokens, arg */
#define LIT (-1) /* literal character, char */
#define SOT (-2) /* start text anchor, - */
#define EOT (-3) /* end text anchor, - */
#define GRP_S (-4) /* start alternate grp, ptr_to_end */
#define GRP_E (-5) /* end group, - */
#define ALT_S (-6) /* alternate starts, ptr_to_next */
#define ALT_E (-7) /* alternate ends, - */
#define END (-8) /* end of regexp, - */
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 */
int rxp__compile __P((char *, int));
char *rxp__expand __P((int));
int rxp__match __P((char *, int, Rxp_t *, Rxp_t *, char *));
int
rxp_compile(s)
register char * s;
{
return (rxp__compile(s, TRUE));
}
static int
rxp__compile(s, first)
register char *s;
int first;
{
static Rxp_t *rp;
static char *sp;
Rxp_t *grp_ptr;
Rxp_t *alt_ptr;
int esc, err;
esc = 0;
if (first) {
rp = rxpbuf;
sp = s;
*rp++ = SOT; /* auto-anchor: pat is really ^pat$ */
*rp++ = GRP_S; /* auto-group: ^pat$ is really ^[pat]$ */
*rp++ = 0;
}
*rp++ = ALT_S;
alt_ptr = rp;
*rp++ = 0;
for (; *sp; ++sp) {
if (rp - rxpbuf >= RXP_LINE_SZ - 4) {
(void)snprintf(rxperr, sizeof(rxperr),
"regular expression too long %s", s);
return (FALSE);
}
if (*sp == ':' && !esc)
break;
if (esc) {
*rp++ = LIT;
*rp++ = *sp;
esc = 0;
}
else switch (*sp) {
case '\\':
esc = 1;
break;
case '{':
case '[':
*rp++ = GRP_S;
grp_ptr = rp;
*rp++ = 0;
sp++;
if ((err = rxp__compile(s, FALSE)) != TRUE)
return (err);
*rp++ = GRP_E;
*grp_ptr = rp - rxpbuf;
break;
case '}':
case ']':
case '|':
*rp++ = ALT_E;
*alt_ptr = rp - rxpbuf;
if (*sp != ']') {
*rp++ = ALT_S;
alt_ptr = rp;
*rp++ = 0;
}
if (*sp != '|') {
if (*sp != ']') {
*rp++ = ALT_E;
*alt_ptr = rp - rxpbuf;
}
if (first) {
(void)snprintf(rxperr, sizeof(rxperr),
"unmatched alternator in regexp %s",
s);
return (FALSE);
}
return (TRUE);
}
break;
default:
*rp++ = LIT;
*rp++ = *sp;
esc = 0;
break;
}
}
if (!first) {
(void)snprintf(rxperr, sizeof(rxperr),
"unmatched alternator in regexp %s", s);
return (FALSE);
}
*rp++ = ALT_E;
*alt_ptr = rp - rxpbuf;
*rp++ = GRP_E;
*(rxpbuf + 2) = rp - rxpbuf;
*rp++ = EOT;
*rp = END;
return (TRUE);
}
/*
* match string against compiled regular expression
*/
int
rxp_match(s)
register char * s;
{
return (rxp__match(s, TRUE, NULL, NULL, NULL));
}
static int
rxp__match(s, first, j_succ, j_fail, sp_fail)
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 */
{
static Rxp_t *rp;
static char *sp;
register int ch;
Rxp_t *grp_end;
int err;
if (first) {
rp = rxpbuf;
sp = s;
}
while (rp < rxpbuf + RXP_LINE_SZ && *rp != END)
switch(*rp) {
case LIT:
rp++;
ch = isascii(*rp) && isupper(*rp) ? tolower(*rp) : *rp;
if (ch != *sp++) {
rp = j_fail;
sp = sp_fail;
return (TRUE);
}
rp++;
break;
case SOT:
if (sp != s)
return (FALSE);
rp++;
break;
case EOT:
if (*sp != 0)
return (FALSE);
rp++;
break;
case GRP_S:
rp++;
grp_end = rxpbuf + *rp++;
break;
case ALT_S:
rp++;
if ((err = rxp__match(sp,
FALSE, grp_end, rxpbuf + *rp++, sp)) != TRUE)
return (err);
break;
case ALT_E:
rp = j_succ;
return (TRUE);
case GRP_E:
default:
return (FALSE);
}
return (*rp != END ? FALSE : TRUE);
}
/*
* Reverse engineer the regular expression, by picking first of all alternates.
*/
char *
rxp_expand()
{
return (rxp__expand(TRUE));
}
static char *
rxp__expand(first)
int first;
{
static char buf[RXP_LINE_SZ/2];
static Rxp_t *rp;
static char *bp;
Rxp_t *grp_ptr;
char *err;
if (first) {
rp = rxpbuf;
bp = buf;
}
while (rp < rxpbuf + RXP_LINE_SZ && *rp != END)
switch(*rp) {
case LIT:
rp++;
*bp++ = *rp++;
break;
case GRP_S:
rp++;
grp_ptr = rxpbuf + *rp;
rp++;
if ((err = rxp__expand(FALSE)) == NULL)
return (err);
rp = grp_ptr;
break;
case ALT_E:
return (buf);
case ALT_S:
rp++;
/* FALLTHROUGH */
case SOT:
case EOT:
case GRP_E:
rp++;
break;
default:
return (NULL);
}
if (first) {
if (*rp != END)
return (NULL);
*bp = '\0';
}
return (buf);
}