home *** CD-ROM | disk | FTP | other *** search
open in:
MacOS 8.1
|
Win98
|
DOS
view JSON data
|
view as text
This file was processed as: SHell self-extracting ARchive
(archive/shar).
You can browse this item here: 2292
Confidence | Program | Detection | Match Type | Support
|
---|
100%
| dexvert
| Newsgroup Content (archive/news)
| magic
| Supported |
100%
| dexvert
| SHell self-extracting ARchive (archive/shar)
| magic
| Supported |
100%
| dexvert
| Internet Message Format (text/imf)
| magic
| Supported |
1%
| dexvert
| Text File (text/txt)
| fallback
| Supported |
100%
| file
| news or mail, ASCII text
| default
| |
100%
| TrID
| E-Mail message (Var. 2)
| default
| |
100%
| checkBytes
| Printable ASCII
| default
| |
100%
| perlTextCheck
| Likely Text (Perl)
| default
| |
100%
| siegfried
| fmt/329 Shell Archive Format
| default
| |
100%
| detectItEasy
| Format: plain text[LF]
| default (weak)
| |
100%
| xdgMime
| message/rfc822
| default
|
|
hex view+--------+-------------------------+-------------------------+--------+--------+
|00000000| 46 72 6f 6d 3a 20 6a 6f | 73 68 75 61 40 61 74 68 |From: jo|shua@ath|
|00000010| 65 72 74 6e 2e 41 74 68 | 65 72 74 6f 6e 2e 43 4f |ertn.Ath|erton.CO|
|00000020| 4d 20 28 46 6c 61 6d 65 | 20 42 61 69 74 29 0a 4e |M (Flame| Bait).N|
|00000030| 65 77 73 67 72 6f 75 70 | 73 3a 20 61 6c 74 2e 73 |ewsgroup|s: alt.s|
|00000040| 6f 75 72 63 65 73 0a 53 | 75 62 6a 65 63 74 3a 20 |ources.S|ubject: |
|00000050| 52 50 47 20 74 61 62 6c | 65 20 68 61 6e 64 6c 69 |RPG tabl|e handli|
|00000060| 6e 67 20 72 6f 75 74 69 | 6e 65 73 20 28 31 2f 32 |ng routi|nes (1/2|
|00000070| 29 0a 4d 65 73 73 61 67 | 65 2d 49 44 3a 20 3c 33 |).Messag|e-ID: <3|
|00000080| 33 39 30 37 40 6a 6f 73 | 68 75 61 2e 61 74 68 65 |3907@jos|hua.athe|
|00000090| 72 74 6e 2e 41 74 68 65 | 72 74 6f 6e 2e 43 4f 4d |rtn.Athe|rton.COM|
|000000a0| 3e 0a 44 61 74 65 3a 20 | 31 33 20 44 65 63 20 39 |>.Date: |13 Dec 9|
|000000b0| 30 20 31 37 3a 35 31 3a | 34 38 20 47 4d 54 0a 0a |0 17:51:|48 GMT..|
|000000c0| 0a 54 68 65 20 72 6f 75 | 74 69 6e 65 73 20 61 72 |.The rou|tines ar|
|000000d0| 65 20 64 65 73 69 67 6e | 65 64 20 74 6f 20 77 72 |e design|ed to wr|
|000000e0| 69 74 65 20 63 68 61 72 | 61 63 74 65 72 20 67 65 |ite char|acter ge|
|000000f0| 6e 65 72 61 74 69 6f 6e | 20 70 72 6f 67 72 61 6d |neration| program|
|00000100| 73 2c 20 62 75 74 0a 73 | 68 6f 75 6c 64 20 62 65 |s, but.s|hould be|
|00000110| 20 75 73 65 66 75 6c 20 | 66 6f 72 20 6c 6f 74 73 | useful |for lots|
|00000120| 20 6f 66 20 6f 74 68 65 | 72 20 52 50 47 20 74 79 | of othe|r RPG ty|
|00000130| 70 65 20 61 70 70 6c 69 | 63 61 74 69 6f 6e 73 2e |pe appli|cations.|
|00000140| 20 20 54 68 65 72 65 20 | 61 72 65 0a 72 6f 75 74 | There |are.rout|
|00000150| 69 6e 65 73 20 74 6f 20 | 72 65 61 64 20 69 6e 20 |ines to |read in |
|00000160| 74 61 62 6c 65 73 2c 20 | 70 72 69 6e 74 20 74 68 |tables, |print th|
|00000170| 65 6d 2c 20 66 72 65 65 | 20 74 68 65 6d 2c 20 61 |em, free| them, a|
|00000180| 6e 64 20 75 73 65 20 74 | 68 65 6d 20 69 6e 20 0a |nd use t|hem in .|
|00000190| 73 65 76 65 72 61 6c 20 | 64 69 66 66 65 72 65 6e |several |differen|
|000001a0| 74 20 77 61 79 73 2e 20 | 20 49 6e 20 61 64 64 69 |t ways. | In addi|
|000001b0| 74 69 6f 6e 20 74 68 65 | 72 65 20 61 72 65 20 73 |tion the|re are s|
|000001c0| 6f 6d 65 20 72 6f 6c 6c | 69 6e 67 20 72 6f 75 74 |ome roll|ing rout|
|000001d0| 69 6e 65 73 0a 77 68 69 | 63 68 20 74 61 6b 65 20 |ines.whi|ch take |
|000001e0| 74 65 78 74 20 73 74 72 | 69 6e 67 73 20 6c 69 6b |text str|ings lik|
|000001f0| 65 20 22 32 64 34 2b 32 | 22 20 6f 72 20 22 31 64 |e "2d4+2|" or "1d|
|00000200| 31 30 30 22 20 61 6e 64 | 20 72 6f 6c 6c 20 74 68 |100" and| roll th|
|00000210| 65 6d 2e 20 20 54 68 65 | 0a 74 61 62 6c 65 20 72 |em. The|.table r|
|00000220| 6f 75 74 69 6e 65 73 20 | 61 72 65 20 64 65 73 69 |outines |are desi|
|00000230| 67 6e 65 64 20 74 6f 20 | 62 65 20 6f 62 6a 65 63 |gned to |be objec|
|00000240| 74 20 6f 72 69 65 6e 74 | 65 64 2c 20 73 6f 20 79 |t orient|ed, so y|
|00000250| 6f 75 20 63 61 6e 20 61 | 64 64 20 6e 65 77 0a 74 |ou can a|dd new.t|
|00000260| 79 70 65 73 20 6f 66 20 | 74 61 62 6c 65 73 2c 20 |ypes of |tables, |
|00000270| 61 6e 64 20 6e 65 77 20 | 6f 70 65 72 61 74 69 6f |and new |operatio|
|00000280| 6e 73 20 6f 6e 20 74 61 | 62 6c 65 73 20 66 61 69 |ns on ta|bles fai|
|00000290| 72 6c 79 20 65 61 73 69 | 6c 79 2e 0a 46 69 6e 61 |rly easi|ly..Fina|
|000002a0| 6c 6c 79 2c 20 74 68 65 | 72 65 20 61 72 65 20 74 |lly, the|re are t|
|000002b0| 77 6f 20 73 69 6d 70 6c | 65 20 61 70 70 6c 69 63 |wo simpl|e applic|
|000002c0| 61 74 69 6f 6e 73 2c 20 | 61 20 63 6f 6d 70 75 74 |ations, |a comput|
|000002d0| 65 72 20 62 75 7a 7a 70 | 68 61 73 65 20 67 65 6e |er buzzp|hase gen|
|000002e0| 65 72 61 74 6f 72 0a 61 | 6e 64 20 61 20 63 79 62 |erator.a|nd a cyb|
|000002f0| 65 72 70 75 6e 6b 20 73 | 74 79 6c 65 20 6e 61 6d |erpunk s|tyle nam|
|00000300| 65 20 67 65 6e 65 72 61 | 74 6f 72 2e 0a 0a 49 27 |e genera|tor...I'|
|00000310| 6d 20 70 6c 61 6e 6e 69 | 6e 67 20 61 20 30 2e 35 |m planni|ng a 0.5|
|00000320| 20 72 65 6c 65 61 73 65 | 20 74 6f 20 62 65 20 66 | release| to be f|
|00000330| 6f 6c 6c 6f 77 65 64 20 | 62 79 20 61 20 31 2e 30 |ollowed |by a 1.0|
|00000340| 20 72 65 6c 65 61 73 65 | 2c 20 73 6f 20 70 6c 65 | release|, so ple|
|00000350| 61 73 65 20 0a 65 6d 61 | 69 6c 20 6d 65 20 61 6e |ase .ema|il me an|
|00000360| 79 20 70 72 6f 62 6c 65 | 6d 73 20 79 6f 75 20 68 |y proble|ms you h|
|00000370| 61 76 65 20 6f 72 20 69 | 6d 70 72 6f 76 65 6d 65 |ave or i|mproveme|
|00000380| 6e 74 73 20 79 6f 75 20 | 6d 61 6b 65 2e 20 20 49 |nts you |make. I|
|00000390| 66 20 79 6f 75 20 75 73 | 65 20 74 68 65 73 65 0a |f you us|e these.|
|000003a0| 72 6f 75 74 69 6e 65 73 | 20 74 6f 20 77 72 69 74 |routines| to writ|
|000003b0| 65 20 61 20 70 72 6f 67 | 72 61 6d 20 6c 6f 6e 67 |e a prog|ram long|
|000003c0| 65 72 20 74 68 61 6e 20 | 32 30 30 20 6c 69 6e 65 |er than |200 line|
|000003d0| 73 2c 20 70 6c 65 61 73 | 65 20 73 65 6e 64 20 6d |s, pleas|e send m|
|000003e0| 65 20 69 74 73 20 73 6f | 75 72 63 65 2c 0a 73 6f |e its so|urce,.so|
|000003f0| 20 49 20 63 61 6e 20 69 | 6e 63 6c 75 64 65 20 69 | I can i|nclude i|
|00000400| 74 20 69 6e 20 6d 79 20 | 72 65 67 72 65 73 73 69 |t in my |regressi|
|00000410| 6f 6e 20 74 65 73 74 69 | 6e 67 2c 20 61 6e 64 20 |on testi|ng, and |
|00000420| 61 6c 73 6f 20 73 6f 20 | 49 20 63 61 6e 20 67 65 |also so |I can ge|
|00000430| 74 20 61 20 66 65 65 6c | 20 0a 66 6f 72 20 68 6f |t a feel| .for ho|
|00000440| 77 20 70 65 6f 70 6c 65 | 20 61 72 65 20 75 73 69 |w people| are usi|
|00000450| 6e 67 20 74 68 69 73 20 | 70 61 63 6b 61 67 65 2e |ng this |package.|
|00000460| 20 20 54 68 61 6e 6b 73 | 2e 0a 0a 4a 6f 73 68 75 | Thanks|...Joshu|
|00000470| 61 20 4c 65 76 79 20 28 | 6a 6f 73 68 75 61 40 61 |a Levy (|joshua@a|
|00000480| 74 68 65 72 74 6f 6e 2e | 63 6f 6d 29 20 20 28 34 |therton.|com) (4|
|00000490| 30 38 29 20 37 33 34 2d | 39 38 32 32 0a 0a 23 21 |08) 734-|9822..#!|
|000004a0| 20 2f 62 69 6e 2f 73 68 | 0a 23 20 54 68 69 73 20 | /bin/sh|.# This |
|000004b0| 69 73 20 61 20 73 68 65 | 6c 6c 20 61 72 63 68 69 |is a she|ll archi|
|000004c0| 76 65 2c 20 6d 65 61 6e | 69 6e 67 3a 0a 23 20 31 |ve, mean|ing:.# 1|
|000004d0| 2e 20 52 65 6d 6f 76 65 | 20 65 76 65 72 79 74 68 |. Remove| everyth|
|000004e0| 69 6e 67 20 61 62 6f 76 | 65 20 74 68 65 20 23 21 |ing abov|e the #!|
|000004f0| 20 2f 62 69 6e 2f 73 68 | 20 6c 69 6e 65 2e 0a 23 | /bin/sh| line..#|
|00000500| 20 32 2e 20 53 61 76 65 | 20 74 68 65 20 72 65 73 | 2. Save| the res|
|00000510| 75 6c 74 69 6e 67 20 74 | 65 78 74 20 69 6e 20 61 |ulting t|ext in a|
|00000520| 20 66 69 6c 65 2e 0a 23 | 20 33 2e 20 45 78 65 63 | file..#| 3. Exec|
|00000530| 75 74 65 20 74 68 65 20 | 66 69 6c 65 20 77 69 74 |ute the |file wit|
|00000540| 68 20 2f 62 69 6e 2f 73 | 68 20 28 6e 6f 74 20 63 |h /bin/s|h (not c|
|00000550| 73 68 29 20 74 6f 20 63 | 72 65 61 74 65 3a 0a 23 |sh) to c|reate:.#|
|00000560| 09 4d 61 6b 65 66 69 6c | 65 0a 23 09 52 41 4e 44 |.Makefil|e.#.RAND|
|00000570| 4f 4d 0a 23 09 52 45 41 | 44 4d 45 0a 23 09 55 50 |OM.#.REA|DME.#.UP|
|00000580| 44 41 54 45 53 0a 23 09 | 64 6f 63 0a 23 09 61 70 |DATES.#.|doc.#.ap|
|00000590| 70 73 0a 23 20 54 68 69 | 73 20 61 72 63 68 69 76 |ps.# Thi|s archiv|
|000005a0| 65 20 63 72 65 61 74 65 | 64 3a 20 46 72 69 20 4e |e create|d: Fri N|
|000005b0| 6f 76 20 33 30 20 31 32 | 3a 30 37 3a 31 34 20 31 |ov 30 12|:07:14 1|
|000005c0| 39 39 30 0a 23 20 42 79 | 3a 09 46 6c 61 6d 65 20 |990.# By|:.Flame |
|000005d0| 42 61 69 74 20 28 29 0a | 65 78 70 6f 72 74 20 50 |Bait ().|export P|
|000005e0| 41 54 48 3b 20 50 41 54 | 48 3d 2f 62 69 6e 3a 2f |ATH; PAT|H=/bin:/|
|000005f0| 75 73 72 2f 62 69 6e 3a | 24 50 41 54 48 0a 69 66 |usr/bin:|$PATH.if|
|00000600| 20 74 65 73 74 20 2d 66 | 20 27 4d 61 6b 65 66 69 | test -f| 'Makefi|
|00000610| 6c 65 27 0a 74 68 65 6e | 0a 09 65 63 68 6f 20 73 |le'.then|..echo s|
|00000620| 68 61 72 3a 20 22 77 69 | 6c 6c 20 6e 6f 74 20 6f |har: "wi|ll not o|
|00000630| 76 65 72 2d 77 72 69 74 | 65 20 65 78 69 73 74 69 |ver-writ|e existi|
|00000640| 6e 67 20 66 69 6c 65 20 | 27 4d 61 6b 65 66 69 6c |ng file |'Makefil|
|00000650| 65 27 22 0a 65 6c 73 65 | 0a 73 65 64 20 27 73 2f |e'".else|.sed 's/|
|00000660| 5e 58 2f 2f 27 20 3c 3c | 20 5c 53 48 41 52 5f 45 |^X//' <<| \SHAR_E|
|00000670| 4f 46 20 3e 20 27 4d 61 | 6b 65 66 69 6c 65 27 0a |OF > 'Ma|kefile'.|
|00000680| 58 23 0a 58 23 20 4d 61 | 6b 65 66 69 6c 65 20 66 |X#.X# Ma|kefile f|
|00000690| 6f 72 20 74 68 65 20 74 | 61 62 6c 65 20 61 6e 64 |or the t|able and|
|000006a0| 20 72 61 6e 64 6f 6d 20 | 75 74 69 6c 69 74 79 20 | random |utility |
|000006b0| 70 61 63 6b 61 67 65 73 | 0a 58 23 20 61 6e 64 20 |packages|.X# and |
|000006c0| 73 6f 6d 65 20 70 72 6f | 67 72 61 6d 73 20 77 68 |some pro|grams wh|
|000006d0| 69 63 68 20 75 73 65 20 | 74 68 65 6d 2e 0a 58 23 |ich use |them..X#|
|000006e0| 20 62 79 20 4a 6f 73 68 | 75 61 20 4c 65 76 79 0a | by Josh|ua Levy.|
|000006f0| 58 23 0a 58 0a 58 73 65 | 74 75 70 3a 0a 58 09 63 |X#.X.Xse|tup:.X.c|
|00000700| 64 20 73 72 63 20 3b 20 | 6d 61 6b 65 20 6c 69 62 |d src ; |make lib|
|00000710| 73 0a 58 09 63 64 20 73 | 72 63 20 3b 20 6d 61 6b |s.X.cd s|rc ; mak|
|00000720| 65 20 65 78 65 63 73 0a | 58 09 63 64 20 74 73 74 |e execs.|X.cd tst|
|00000730| 20 3b 20 6d 61 6b 65 0a | 58 09 63 64 20 61 70 70 | ; make.|X.cd app|
|00000740| 73 20 3b 20 6d 61 6b 65 | 0a 58 0a 58 63 6c 65 61 |s ; make|.X.Xclea|
|00000750| 6e 3a 0a 58 09 63 64 20 | 73 72 63 20 3b 20 6d 61 |n:.X.cd |src ; ma|
|00000760| 6b 65 20 63 6c 65 61 6e | 0a 58 09 63 64 20 61 70 |ke clean|.X.cd ap|
|00000770| 70 73 20 3b 20 6d 61 6b | 65 20 63 6c 65 61 6e 0a |ps ; mak|e clean.|
|00000780| 58 09 63 64 20 74 73 74 | 20 3b 20 6d 61 6b 65 20 |X.cd tst| ; make |
|00000790| 63 6c 65 61 6e 0a 58 09 | 63 64 20 64 6f 63 20 3b |clean.X.|cd doc ;|
|000007a0| 20 6d 61 6b 65 20 63 6c | 65 61 6e 0a 58 09 72 6d | make cl|ean.X.rm|
|000007b0| 20 2d 66 20 2a 7e 20 22 | 2a 2f 2a 7e 22 20 63 6f | -f *~ "|*/*~" co|
|000007c0| 72 65 0a 58 0a 58 73 68 | 61 72 3a 20 63 6c 65 61 |re.X.Xsh|ar: clea|
|000007d0| 6e 0a 58 09 73 68 61 72 | 20 2d 70 20 58 20 5b 41 |n.X.shar| -p X [A|
|000007e0| 2d 5a 5d 2a 20 64 6f 63 | 20 61 70 70 73 20 3e 20 |-Z]* doc| apps > |
|000007f0| 74 61 62 6c 65 61 2e 73 | 68 61 72 0a 58 09 73 68 |tablea.s|har.X.sh|
|00000800| 61 72 20 2d 70 20 59 20 | 73 72 63 20 74 73 74 20 |ar -p Y |src tst |
|00000810| 3e 20 74 61 62 6c 65 62 | 2e 73 68 61 72 0a 58 0a |> tableb|.shar.X.|
|00000820| 53 48 41 52 5f 45 4f 46 | 0a 66 69 0a 69 66 20 74 |SHAR_EOF|.fi.if t|
|00000830| 65 73 74 20 2d 66 20 27 | 52 41 4e 44 4f 4d 27 0a |est -f '|RANDOM'.|
|00000840| 74 68 65 6e 0a 09 65 63 | 68 6f 20 73 68 61 72 3a |then..ec|ho shar:|
|00000850| 20 22 77 69 6c 6c 20 6e | 6f 74 20 6f 76 65 72 2d | "will n|ot over-|
|00000860| 77 72 69 74 65 20 65 78 | 69 73 74 69 6e 67 20 66 |write ex|isting f|
|00000870| 69 6c 65 20 27 52 41 4e | 44 4f 4d 27 22 0a 65 6c |ile 'RAN|DOM'".el|
|00000880| 73 65 0a 73 65 64 20 27 | 73 2f 5e 58 2f 2f 27 20 |se.sed '|s/^X//' |
|00000890| 3c 3c 20 5c 53 48 41 52 | 5f 45 4f 46 20 3e 20 27 |<< \SHAR|_EOF > '|
|000008a0| 52 41 4e 44 4f 4d 27 0a | 58 0a 58 54 68 69 73 20 |RANDOM'.|X.XThis |
|000008b0| 69 73 20 61 20 76 65 72 | 79 20 62 72 69 65 66 20 |is a ver|y brief |
|000008c0| 69 6e 74 6f 20 74 6f 20 | 74 68 65 20 72 61 6e 64 |into to |the rand|
|000008d0| 6f 6d 20 6e 75 6d 62 65 | 72 20 72 6f 75 74 69 6e |om numbe|r routin|
|000008e0| 65 73 2e 20 56 65 72 73 | 69 6f 6e 20 30 2e 33 0a |es. Vers|ion 0.3.|
|000008f0| 58 42 79 20 4a 6f 73 68 | 75 61 20 4c 65 76 79 0a |XBy Josh|ua Levy.|
|00000900| 58 0a 58 4e 6f 74 65 20 | 74 68 61 74 20 74 68 69 |X.XNote |that thi|
|00000910| 73 20 69 73 20 61 20 22 | 70 72 65 73 65 6e 74 61 |s is a "|presenta|
|00000920| 74 69 6f 6e 20 6c 61 79 | 65 72 22 20 72 61 6e 64 |tion lay|er" rand|
|00000930| 6f 6d 20 6e 75 6d 62 65 | 72 20 70 61 63 6b 61 67 |om numbe|r packag|
|00000940| 65 2e 0a 58 49 74 20 72 | 65 6c 69 65 73 20 6f 6e |e..XIt r|elies on|
|00000950| 20 72 61 6e 64 6f 6d 28 | 33 29 20 74 6f 20 67 65 | random(|3) to ge|
|00000960| 6e 65 72 61 74 65 20 72 | 61 6e 64 6f 6d 20 6e 75 |nerate r|andom nu|
|00000970| 6d 62 65 72 2c 20 62 75 | 74 20 70 72 65 73 65 6e |mber, bu|t presen|
|00000980| 74 73 0a 58 74 68 65 6d | 20 74 6f 20 74 68 65 20 |ts.Xthem| to the |
|00000990| 75 73 65 72 20 69 6e 20 | 61 20 6d 6f 72 65 20 75 |user in |a more u|
|000009a0| 73 65 66 75 6c 20 77 61 | 79 2c 20 61 73 20 77 65 |seful wa|y, as we|
|000009b0| 6c 6c 20 61 73 20 70 72 | 6f 76 69 64 69 6e 67 0a |ll as pr|oviding.|
|000009c0| 58 6c 6f 67 67 69 6e 67 | 20 66 61 63 69 6c 69 74 |Xlogging| facilit|
|000009d0| 69 65 73 2e 0a 58 0a 58 | 54 6f 20 6d 61 6b 65 20 |ies..X.X|To make |
|000009e0| 74 68 65 20 2a 2e 6f 20 | 66 69 6c 65 3a 20 63 63 |the *.o |file: cc|
|000009f0| 20 2d 63 20 72 61 6e 64 | 6f 6d 2e 63 0a 58 54 6f | -c rand|om.c.XTo|
|00000a00| 20 6d 61 6b 65 20 61 20 | 74 65 73 74 20 65 78 65 | make a |test exe|
|00000a10| 63 75 74 61 62 6c 65 3a | 20 63 63 20 2d 44 54 45 |cutable:| cc -DTE|
|00000a20| 53 54 20 2d 6f 20 72 6e | 64 74 65 73 74 20 72 61 |ST -o rn|dtest ra|
|00000a30| 6e 64 6f 6d 2e 63 0a 58 | 0a 58 49 6e 63 6c 75 64 |ndom.c.X|.XInclud|
|00000a40| 65 20 74 68 65 20 68 65 | 61 64 65 72 20 66 69 6c |e the he|ader fil|
|00000a50| 65 20 28 72 61 6e 64 6f | 6d 2e 68 29 20 69 6e 20 |e (rando|m.h) in |
|00000a60| 79 6f 75 20 70 72 6f 67 | 72 61 6d 73 2e 0a 58 0a |you prog|rams..X.|
|00000a70| 58 54 6f 20 74 65 73 74 | 20 74 68 65 20 72 6f 75 |XTo test| the rou|
|00000a80| 74 69 6e 65 73 20 6d 61 | 6b 65 20 72 6e 64 74 65 |tines ma|ke rndte|
|00000a90| 73 74 20 61 6e 64 20 74 | 72 79 20 74 68 65 73 65 |st and t|ry these|
|00000aa0| 20 74 77 6f 20 55 4e 49 | 58 20 63 6f 6d 6d 61 6e | two UNI|X comman|
|00000ab0| 64 73 3a 0a 58 20 20 20 | 72 6e 64 74 65 73 74 20 |ds:.X |rndtest |
|00000ac0| 3c 72 6e 64 74 6e 6f 72 | 6d 2e 74 73 0a 58 20 20 |<rndtnor|m.ts.X |
|00000ad0| 20 72 6e 64 74 65 73 74 | 20 3c 72 6e 64 74 61 63 | rndtest| <rndtac|
|00000ae0| 69 64 2e 74 73 0a 53 48 | 41 52 5f 45 4f 46 0a 66 |id.ts.SH|AR_EOF.f|
|00000af0| 69 0a 69 66 20 74 65 73 | 74 20 2d 66 20 27 52 45 |i.if tes|t -f 'RE|
|00000b00| 41 44 4d 45 27 0a 74 68 | 65 6e 0a 09 65 63 68 6f |ADME'.th|en..echo|
|00000b10| 20 73 68 61 72 3a 20 22 | 77 69 6c 6c 20 6e 6f 74 | shar: "|will not|
|00000b20| 20 6f 76 65 72 2d 77 72 | 69 74 65 20 65 78 69 73 | over-wr|ite exis|
|00000b30| 74 69 6e 67 20 66 69 6c | 65 20 27 52 45 41 44 4d |ting fil|e 'READM|
|00000b40| 45 27 22 0a 65 6c 73 65 | 0a 73 65 64 20 27 73 2f |E'".else|.sed 's/|
|00000b50| 5e 58 2f 2f 27 20 3c 3c | 20 5c 53 48 41 52 5f 45 |^X//' <<| \SHAR_E|
|00000b60| 4f 46 20 3e 20 27 52 45 | 41 44 4d 45 27 0a 58 0a |OF > 'RE|ADME'.X.|
|00000b70| 58 52 45 41 44 4d 45 20 | 66 69 6c 65 20 66 6f 72 |XREADME |file for|
|00000b80| 20 74 61 62 6c 65 3a 20 | 61 20 70 61 63 6b 61 67 | table: |a packag|
|00000b90| 65 20 74 6f 20 6d 61 6e | 69 70 75 6c 61 74 65 20 |e to man|ipulate |
|00000ba0| 74 61 62 6c 65 73 20 28 | 56 65 72 73 69 6f 6e 20 |tables (|Version |
|00000bb0| 30 2e 33 29 0a 58 42 79 | 20 4a 6f 73 68 75 61 20 |0.3).XBy| Joshua |
|00000bc0| 4c 65 76 79 0a 58 0a 58 | 54 68 69 73 20 69 73 20 |Levy.X.X|This is |
|00000bd0| 61 20 73 65 74 20 6f 66 | 20 73 75 62 72 6f 75 74 |a set of| subrout|
|00000be0| 69 6e 65 73 20 74 6f 20 | 68 61 6e 64 6c 65 20 74 |ines to |handle t|
|00000bf0| 61 62 6c 65 73 2c 20 73 | 75 63 68 20 61 73 20 61 |ables, s|uch as a|
|00000c00| 72 65 20 63 6f 6d 6d 6f | 6e 6c 79 20 75 73 65 64 |re commo|nly used|
|00000c10| 20 69 6e 20 0a 58 46 52 | 50 20 61 6e 64 20 63 6f | in .XFR|P and co|
|00000c20| 6d 70 75 74 65 72 20 67 | 61 6d 65 73 2e 20 20 49 |mputer g|ames. I|
|00000c30| 74 20 61 6c 73 6f 20 69 | 6e 63 6c 75 64 65 73 20 |t also i|ncludes |
|00000c40| 73 6f 6d 65 20 72 61 6e | 64 6f 6d 20 6e 75 6d 62 |some ran|dom numb|
|00000c50| 65 72 20 72 6f 75 74 69 | 6e 65 73 2e 0a 58 0a 58 |er routi|nes..X.X|
|00000c60| 54 6f 20 6d 61 6b 65 20 | 74 68 69 73 20 73 74 75 |To make |this stu|
|00000c70| 66 66 2c 20 75 6e 73 68 | 61 72 20 74 68 65 20 74 |ff, unsh|ar the t|
|00000c80| 77 6f 20 66 69 6c 65 73 | 20 61 6e 64 20 72 75 6e |wo files| and run|
|00000c90| 20 6d 61 6b 65 2e 20 20 | 54 68 69 73 20 73 68 6f | make. |This sho|
|00000ca0| 75 6c 64 20 70 72 6f 64 | 75 63 65 20 0a 58 73 65 |uld prod|uce .Xse|
|00000cb0| 76 65 72 61 6c 20 65 78 | 65 63 75 74 61 62 6c 65 |veral ex|ecutable|
|00000cc0| 73 3a 20 0a 58 20 20 20 | 20 69 6e 20 74 68 65 20 |s: .X | in the |
|00000cd0| 61 70 70 73 20 64 69 72 | 65 63 74 6f 72 79 2c 20 |apps dir|ectory, |
|00000ce0| 62 77 20 61 6e 64 20 63 | 6e 61 6d 65 0a 58 20 20 |bw and c|name.X |
|00000cf0| 20 20 69 6e 20 74 68 65 | 20 73 72 63 20 64 69 72 | in the| src dir|
|00000d00| 65 63 74 6f 72 79 20 74 | 62 74 65 73 74 2c 20 72 |ectory t|btest, r|
|00000d10| 6e 64 74 65 73 74 2c 20 | 61 6e 64 20 74 62 32 74 |ndtest, |and tb2t|
|00000d20| 62 6c 0a 58 0a 58 54 6f | 20 75 73 65 20 74 68 65 |bl.X.XTo| use the|
|00000d30| 73 65 20 72 6f 75 74 69 | 6e 65 73 20 69 6e 20 79 |se routi|nes in y|
|00000d40| 6f 75 72 20 6f 77 6e 20 | 70 72 6f 67 72 61 6d 2c |our own |program,|
|00000d50| 20 79 6f 75 20 6d 75 73 | 74 20 6c 69 6e 6b 20 77 | you mus|t link w|
|00000d60| 69 74 68 20 74 61 62 6c | 65 2e 61 0a 58 61 6e 64 |ith tabl|e.a.Xand|
|00000d70| 20 72 61 6e 64 6f 6d 2e | 6f 2c 20 77 68 69 63 68 | random.|o, which|
|00000d80| 20 61 72 65 20 69 6e 20 | 74 68 65 20 73 72 63 20 | are in |the src |
|00000d90| 64 69 72 65 63 74 6f 72 | 79 2e 0a 58 0a 58 54 68 |director|y..X.XTh|
|00000da0| 65 72 65 20 69 73 20 64 | 6f 63 75 6d 65 6e 74 61 |ere is d|ocumenta|
|00000db0| 74 69 6f 6e 20 69 6e 20 | 74 68 65 20 64 6f 63 20 |tion in |the doc |
|00000dc0| 64 69 72 65 63 74 6f 72 | 79 2c 20 61 6e 64 20 74 |director|y, and t|
|00000dd0| 65 73 74 69 6e 67 20 73 | 68 65 6c 6c 20 73 63 72 |esting s|hell scr|
|00000de0| 69 70 74 73 20 69 6e 0a | 58 74 68 65 20 74 73 74 |ipts in.|Xthe tst|
|00000df0| 20 64 69 72 65 63 74 6f | 72 79 2e 20 20 0a 58 0a | directo|ry. .X.|
|00000e00| 58 52 65 61 64 20 74 68 | 65 20 66 69 6c 65 20 63 |XRead th|e file c|
|00000e10| 61 6c 6c 65 64 20 55 50 | 44 41 54 45 53 20 66 6f |alled UP|DATES fo|
|00000e20| 72 20 73 6f 6d 65 20 63 | 68 61 6e 67 65 20 68 69 |r some c|hange hi|
|00000e30| 73 74 6f 72 79 2c 20 62 | 75 74 20 69 74 20 69 73 |story, b|ut it is|
|00000e40| 20 6e 6f 74 20 63 6f 6d | 70 6c 65 74 65 2e 0a 58 | not com|plete..X|
|00000e50| 0a 58 49 66 20 79 6f 75 | 20 66 69 6e 64 20 74 68 |.XIf you| find th|
|00000e60| 65 73 65 20 72 6f 75 74 | 69 6e 65 20 75 73 65 66 |ese rout|ine usef|
|00000e70| 75 6c 2c 20 70 6c 65 61 | 73 65 20 68 65 6c 70 20 |ul, plea|se help |
|00000e80| 6d 65 20 6d 61 69 6e 74 | 61 69 6e 20 74 68 65 6d |me maint|ain them|
|00000e90| 20 62 79 20 64 6f 69 6e | 67 20 6f 6e 65 0a 58 6f | by doin|g one.Xo|
|00000ea0| 66 20 74 68 65 20 66 6f | 6c 6c 6f 77 69 6e 67 20 |f the fo|llowing |
|00000eb0| 74 68 69 6e 67 73 3a 0a | 58 20 20 20 20 57 72 69 |things:.|X Wri|
|00000ec0| 74 65 20 61 20 6e 65 77 | 20 74 65 73 74 20 73 75 |te a new| test su|
|00000ed0| 69 74 65 2c 20 77 68 69 | 63 68 20 74 65 73 74 73 |ite, whi|ch tests|
|00000ee0| 20 73 74 75 66 66 20 63 | 75 72 72 65 6e 74 6c 79 | stuff c|urrently|
|00000ef0| 20 75 6e 74 65 73 74 65 | 64 2c 20 6f 72 20 61 63 | unteste|d, or ac|
|00000f00| 69 64 20 0a 58 09 74 65 | 73 74 73 20 73 6f 6d 65 |id .X.te|sts some|
|00000f10| 74 68 69 6e 67 2e 0a 58 | 20 20 20 20 41 64 64 20 |thing..X| Add |
|00000f20| 61 20 6e 65 77 20 74 61 | 62 6c 65 20 74 79 70 65 |a new ta|ble type|
|00000f30| 2e 0a 58 20 20 20 20 41 | 64 64 20 61 20 6e 65 77 |..X A|dd a new|
|00000f40| 20 6d 65 73 73 61 67 65 | 20 74 79 70 65 2c 20 6f | message| type, o|
|00000f50| 72 20 61 20 6e 65 77 20 | 6f 70 74 69 6f 6e 20 74 |r a new |option t|
|00000f60| 6f 20 74 68 65 20 70 72 | 69 6e 74 20 6d 65 73 73 |o the pr|int mess|
|00000f70| 61 67 65 2c 20 28 61 20 | 70 72 69 6e 74 0a 58 09 |age, (a |print.X.|
|00000f80| 69 6e 20 4c 61 54 65 58 | 20 6d 65 73 73 61 67 65 |in LaTeX| message|
|00000f90| 20 77 6f 75 6c 64 20 62 | 65 20 67 72 65 61 74 2c | would b|e great,|
|00000fa0| 20 73 6f 20 77 6f 75 6c | 64 20 70 72 65 20 6c 6f | so woul|d pre lo|
|00000fb0| 61 64 65 64 20 43 20 63 | 6f 64 65 29 2e 0a 58 20 |aded C c|ode)..X |
|00000fc0| 20 20 20 53 65 6e 64 20 | 6d 65 20 61 20 73 61 6d | Send |me a sam|
|00000fd0| 70 6c 65 20 61 70 70 6c | 69 63 61 74 69 6f 6e 2e |ple appl|ication.|
|00000fe0| 0a 58 20 20 20 20 45 78 | 74 65 6e 64 20 74 68 65 |.X Ex|tend the|
|00000ff0| 20 72 61 6e 64 6f 6d 20 | 72 6f 75 74 69 6e 65 73 | random |routines|
|00001000| 2e 0a 58 0a 58 54 68 61 | 6e 6b 73 2e 0a 58 0a 58 |..X.XTha|nks..X.X|
|00001010| 4a 6f 73 68 75 61 20 4c | 65 76 79 0a 58 39 30 35 |Joshua L|evy.X905|
|00001020| 20 57 2e 20 4d 69 64 64 | 6c 65 66 69 65 6c 64 20 | W. Midd|lefield |
|00001030| 41 70 74 2e 20 39 34 36 | 0a 58 4d 6f 75 6e 74 61 |Apt. 946|.XMounta|
|00001040| 69 6e 20 56 69 65 77 2c | 20 43 41 0a 58 39 34 30 |in View,| CA.X940|
|00001050| 34 33 0a 58 28 34 30 38 | 29 20 37 33 34 2d 39 38 |43.X(408|) 734-98|
|00001060| 32 32 0a 58 6a 6f 73 68 | 75 61 40 61 74 68 65 72 |22.Xjosh|ua@ather|
|00001070| 74 6f 6e 2e 63 6f 6d 0a | 58 0a 58 4c 65 67 61 6c |ton.com.|X.XLegal|
|00001080| 20 53 74 75 66 66 3a 0a | 58 0a 58 54 68 69 73 20 | Stuff:.|X.XThis |
|00001090| 70 61 63 6b 61 67 65 20 | 28 73 6f 75 72 63 65 20 |package |(source |
|000010a0| 63 6f 64 65 20 61 6e 64 | 20 64 6f 63 75 6d 65 6e |code and| documen|
|000010b0| 74 61 74 69 6f 6e 29 20 | 69 73 20 63 6f 76 65 72 |tation) |is cover|
|000010c0| 65 64 20 62 79 20 74 68 | 65 20 47 4e 55 20 0a 58 |ed by th|e GNU .X|
|000010d0| 47 45 4e 45 52 41 4c 20 | 41 47 52 45 45 4d 45 4e |GENERAL |AGREEMEN|
|000010e0| 54 2c 20 63 6f 6d 6d 6f | 6e 6c 79 20 6b 6e 6f 77 |T, commo|nly know|
|000010f0| 6e 20 61 73 20 74 68 65 | 20 22 63 6f 70 79 6c 65 |n as the| "copyle|
|00001100| 66 74 22 2e 20 20 49 66 | 20 79 6f 75 20 77 61 6e |ft". If| you wan|
|00001110| 74 0a 58 74 6f 20 64 6f | 20 73 6f 6d 65 74 68 69 |t.Xto do| somethi|
|00001120| 6e 67 20 6e 6f 74 20 61 | 6c 6c 6f 77 65 64 20 62 |ng not a|llowed b|
|00001130| 79 20 74 68 65 20 63 6f | 70 79 6c 65 66 74 2c 20 |y the co|pyleft, |
|00001140| 63 6f 6e 74 61 63 74 20 | 74 68 65 20 61 75 74 68 |contact |the auth|
|00001150| 6f 72 0a 58 74 6f 20 61 | 72 72 61 6e 67 65 20 61 |or.Xto a|rrange a|
|00001160| 20 73 65 70 65 72 61 74 | 65 20 61 67 72 65 65 6d | seperat|e agreem|
|00001170| 65 6e 74 2e 0a 58 0a 58 | 0a 58 0a 53 48 41 52 5f |ent..X.X|.X.SHAR_|
|00001180| 45 4f 46 0a 66 69 0a 69 | 66 20 74 65 73 74 20 2d |EOF.fi.i|f test -|
|00001190| 66 20 27 55 50 44 41 54 | 45 53 27 0a 74 68 65 6e |f 'UPDAT|ES'.then|
|000011a0| 0a 09 65 63 68 6f 20 73 | 68 61 72 3a 20 22 77 69 |..echo s|har: "wi|
|000011b0| 6c 6c 20 6e 6f 74 20 6f | 76 65 72 2d 77 72 69 74 |ll not o|ver-writ|
|000011c0| 65 20 65 78 69 73 74 69 | 6e 67 20 66 69 6c 65 20 |e existi|ng file |
|000011d0| 27 55 50 44 41 54 45 53 | 27 22 0a 65 6c 73 65 0a |'UPDATES|'".else.|
|000011e0| 73 65 64 20 27 73 2f 5e | 58 2f 2f 27 20 3c 3c 20 |sed 's/^|X//' << |
|000011f0| 5c 53 48 41 52 5f 45 4f | 46 20 3e 20 27 55 50 44 |\SHAR_EO|F > 'UPD|
|00001200| 41 54 45 53 27 0a 58 0a | 58 43 68 61 6e 67 65 73 |ATES'.X.|XChanges|
|00001210| 20 74 6f 20 74 68 65 20 | 54 61 62 6c 65 20 61 6e | to the |Table an|
|00001220| 64 20 52 61 6e 64 6f 6d | 20 72 6f 75 74 69 6e 65 |d Random| routine|
|00001230| 73 20 73 69 6e 63 65 20 | 76 65 72 73 69 6f 6e 20 |s since |version |
|00001240| 30 2e 31 2e 0a 58 4c 69 | 73 74 65 64 20 6e 65 77 |0.1..XLi|sted new|
|00001250| 65 73 74 20 63 68 61 6e | 67 65 73 20 74 6f 20 6f |est chan|ges to o|
|00001260| 6c 64 65 73 74 2e 0a 58 | 42 79 20 4a 6f 73 68 75 |ldest..X|By Joshu|
|00001270| 61 20 4c 65 76 79 0a 58 | 0a 58 4b 6e 6f 77 6e 20 |a Levy.X|.XKnown |
|00001280| 70 72 6f 62 6c 65 6d 73 | 20 77 69 74 68 20 30 2e |problems| with 0.|
|00001290| 33 3a 0a 58 0a 58 53 68 | 6f 75 6c 64 20 62 65 20 |3:.X.XSh|ould be |
|000012a0| 61 62 6c 65 20 74 6f 20 | 70 75 74 20 63 6f 6d 6d |able to |put comm|
|000012b0| 65 6e 74 73 20 69 6e 20 | 74 61 62 6c 65 20 66 69 |ents in |table fi|
|000012c0| 6c 65 73 20 28 73 74 61 | 72 74 69 6e 67 20 77 69 |les (sta|rting wi|
|000012d0| 74 68 20 27 23 27 29 0a | 58 0a 58 54 68 65 20 72 |th '#').|X.XThe r|
|000012e0| 61 5f 72 6f 6c 6c 20 72 | 6f 75 74 69 6e 65 20 6e |a_roll r|outine n|
|000012f0| 65 65 64 73 20 74 6f 20 | 61 63 63 65 70 74 20 6d |eeds to |accept m|
|00001300| 6f 72 65 20 74 79 70 65 | 73 20 6f 66 20 64 69 63 |ore type|s of dic|
|00001310| 65 20 72 6f 6c 6c 73 2e | 20 20 46 6f 72 20 65 78 |e rolls.| For ex|
|00001320| 61 6d 70 6c 65 2c 0a 58 | 20 20 20 20 69 74 20 73 |ample,.X| it s|
|00001330| 68 6f 75 6c 64 20 6b 6e | 6f 77 20 61 62 6f 75 74 |hould kn|ow about|
|00001340| 20 22 64 69 73 63 61 72 | 64 20 74 68 65 20 77 6f | "discar|d the wo|
|00001350| 72 73 74 20 64 69 63 65 | 20 72 6f 6c 6c 22 2c 20 |rst dice| roll", |
|00001360| 22 69 67 6e 6f 72 65 20 | 72 6f 6c 6c 73 20 75 6e |"ignore |rolls un|
|00001370| 64 65 72 20 4e 22 2c 0a | 58 20 20 20 20 61 6e 64 |der N",.|X and|
|00001380| 20 73 6f 20 6f 6e 2e 0a | 58 0a 58 0a 58 0a 58 43 | so on..|X.X.X.XC|
|00001390| 68 61 6e 67 65 73 20 66 | 72 6f 6d 20 30 2e 32 20 |hanges f|rom 0.2 |
|000013a0| 74 6f 20 30 2e 33 3a 0a | 58 0a 58 41 64 64 65 64 |to 0.3:.|X.XAdded|
|000013b0| 20 6e 65 77 20 6d 65 73 | 73 61 67 65 20 74 62 5f | new mes|sage tb_|
|000013c0| 6d 61 6e 79 2c 20 74 6f | 20 72 6f 6c 6c 20 6d 61 |many, to| roll ma|
|000013d0| 6e 79 20 74 69 6d 65 73 | 20 6f 6e 20 74 68 65 20 |ny times| on the |
|000013e0| 73 61 6d 65 20 74 61 62 | 6c 65 2c 20 72 65 74 75 |same tab|le, retu|
|000013f0| 72 69 6e 67 0a 58 64 69 | 66 66 65 72 65 6e 74 20 |ring.Xdi|fferent |
|00001400| 61 6e 73 77 65 72 73 20 | 65 61 63 68 20 74 69 6d |answers |each tim|
|00001410| 65 2e 0a 58 0a 58 54 68 | 65 72 65 20 69 73 20 6e |e..X.XTh|ere is n|
|00001420| 6f 77 20 64 6f 63 75 6d | 65 6e 61 74 69 6f 6e 20 |ow docum|enation |
|00001430| 73 70 65 63 69 66 69 63 | 61 6c 6c 79 20 64 65 73 |specific|ally des|
|00001440| 63 72 69 62 69 6e 67 20 | 68 6f 77 20 74 6f 20 61 |cribing |how to a|
|00001450| 64 64 20 6e 65 77 20 74 | 61 62 6c 65 20 74 79 70 |dd new t|able typ|
|00001460| 65 73 2e 0a 58 0a 58 41 | 64 64 65 64 20 61 20 6e |es..X.XA|dded a n|
|00001470| 65 77 20 74 61 62 6c 65 | 20 74 79 70 65 2c 20 74 |ew table| type, t|
|00001480| 68 65 20 53 69 6d 70 6c | 65 42 69 67 20 74 79 70 |he Simpl|eBig typ|
|00001490| 65 2e 0a 58 0a 58 54 68 | 65 20 72 61 5f 72 61 6e |e..X.XTh|e ra_ran|
|000014a0| 64 6f 6d 20 6d 61 6e 20 | 70 61 67 65 20 64 6f 65 |dom man |page doe|
|000014b0| 73 20 64 6f 63 75 6d 65 | 6e 74 73 20 74 68 65 20 |s docume|nts the |
|000014c0| 72 61 5f 6c 6f 67 67 69 | 6e 67 20 61 6e 64 20 72 |ra_loggi|ng and r|
|000014d0| 61 5f 66 6c 6f 61 74 20 | 63 61 6c 6c 2e 0a 58 0a |a_float |call..X.|
|000014e0| 58 4e 65 65 64 20 61 6e | 20 72 61 5f 71 75 65 72 |XNeed an| ra_quer|
|000014f0| 79 20 72 6f 75 74 69 6e | 65 20 74 6f 20 72 65 74 |y routin|e to ret|
|00001500| 75 72 6e 20 61 20 72 6f | 6c 6c 27 73 20 6d 69 6e |urn a ro|ll's min|
|00001510| 2c 20 6d 61 78 2c 20 61 | 76 65 72 61 67 65 2c 20 |, max, a|verage, |
|00001520| 61 6e 64 20 6c 65 67 61 | 6c 69 74 79 2e 0a 58 0a |and lega|lity..X.|
|00001530| 58 43 68 61 6e 67 65 73 | 20 66 72 6f 6d 20 30 2e |XChanges| from 0.|
|00001540| 31 20 74 6f 20 30 2e 32 | 3a 0a 58 41 64 64 65 64 |1 to 0.2|:.XAdded|
|00001550| 20 6c 6f 67 2f 72 65 70 | 6c 61 63 65 20 66 61 63 | log/rep|lace fac|
|00001560| 69 6c 69 74 79 20 74 6f | 20 72 61 6e 64 6f 6d 20 |ility to| random |
|00001570| 6e 75 6d 62 65 72 20 67 | 65 6e 65 72 61 74 6f 72 |number g|enerator|
|00001580| 2e 20 0a 58 41 64 64 65 | 64 20 63 72 75 64 65 20 |. .XAdde|d crude |
|00001590| 66 6c 6f 61 74 69 6e 67 | 20 70 6f 69 6e 74 20 67 |floating| point g|
|000015a0| 65 6e 65 72 61 74 6f 72 | 2e 0a 58 52 65 6d 6f 76 |enerator|..XRemov|
|000015b0| 65 64 20 73 6f 6d 65 20 | 75 6e 74 65 73 74 65 64 |ed some |untested|
|000015c0| 20 6d 61 63 72 6f 73 20 | 66 72 6f 6d 20 74 68 65 | macros |from the|
|000015d0| 20 74 61 62 6c 65 2e 68 | 20 66 69 6c 65 2e 0a 58 | table.h| file..X|
|000015e0| 43 6c 65 61 6e 65 64 20 | 61 6e 64 20 63 6f 6d 6d |Cleaned |and comm|
|000015f0| 65 6e 74 65 64 20 74 68 | 65 20 63 6f 64 65 2e 0a |ented th|e code..|
|00001600| 58 46 69 78 65 64 20 62 | 75 67 73 20 69 6e 20 61 |XFixed b|ugs in a|
|00001610| 6e 64 20 69 6d 70 72 6f | 76 65 64 20 74 68 65 20 |nd impro|ved the |
|00001620| 74 61 62 6c 65 2e 6d 61 | 6e 20 6d 61 6e 75 61 6c |table.ma|n manual|
|00001630| 20 70 61 67 65 2e 0a 58 | 52 65 70 6c 61 63 65 64 | page..X|Replaced|
|00001640| 20 74 68 65 20 72 61 6e | 64 6f 6d 20 6e 75 6d 62 | the ran|dom numb|
|00001650| 65 72 20 74 65 73 74 20 | 70 72 6f 67 72 61 6d 20 |er test |program |
|00001660| 77 69 74 68 20 61 20 62 | 65 74 74 65 72 20 6f 6e |with a b|etter on|
|00001670| 65 2e 0a 58 53 74 61 72 | 74 65 64 20 61 20 74 65 |e..XStar|ted a te|
|00001680| 73 74 20 73 75 69 74 65 | 20 66 6f 72 20 74 68 65 |st suite| for the|
|00001690| 20 72 61 6e 64 6f 6d 20 | 6e 75 6d 62 65 72 20 67 | random |number g|
|000016a0| 65 6e 65 72 61 74 6f 72 | 2e 0a 53 48 41 52 5f 45 |enerator|..SHAR_E|
|000016b0| 4f 46 0a 66 69 0a 69 66 | 20 74 65 73 74 20 21 20 |OF.fi.if| test ! |
|000016c0| 2d 64 20 27 64 6f 63 27 | 0a 74 68 65 6e 0a 09 6d |-d 'doc'|.then..m|
|000016d0| 6b 64 69 72 20 27 64 6f | 63 27 0a 66 69 0a 63 64 |kdir 'do|c'.fi.cd|
|000016e0| 20 27 64 6f 63 27 0a 69 | 66 20 74 65 73 74 20 2d | 'doc'.i|f test -|
|000016f0| 66 20 27 72 61 6e 64 6f | 6d 2e 6d 61 6e 27 0a 74 |f 'rando|m.man'.t|
|00001700| 68 65 6e 0a 09 65 63 68 | 6f 20 73 68 61 72 3a 20 |hen..ech|o shar: |
|00001710| 22 77 69 6c 6c 20 6e 6f | 74 20 6f 76 65 72 2d 77 |"will no|t over-w|
|00001720| 72 69 74 65 20 65 78 69 | 73 74 69 6e 67 20 66 69 |rite exi|sting fi|
|00001730| 6c 65 20 27 72 61 6e 64 | 6f 6d 2e 6d 61 6e 27 22 |le 'rand|om.man'"|
|00001740| 0a 65 6c 73 65 0a 73 65 | 64 20 27 73 2f 5e 58 2f |.else.se|d 's/^X/|
|00001750| 2f 27 20 3c 3c 20 5c 53 | 48 41 52 5f 45 4f 46 20 |/' << \S|HAR_EOF |
|00001760| 3e 20 27 72 61 6e 64 6f | 6d 2e 6d 61 6e 27 0a 58 |> 'rando|m.man'.X|
|00001770| 2e 69 67 20 58 43 0a 58 | 25 20 20 6e 72 6f 66 66 |.ig XC.X|% nroff|
|00001780| 20 2d 6d 61 6e 20 72 61 | 6e 64 6f 6d 2e 6d 61 6e | -man ra|ndom.man|
|00001790| 20 7c 20 6d 6f 72 65 0a | 58 25 6e 20 6e 72 6f 66 | | more.|X%n nrof|
|000017a0| 66 20 2d 6d 61 6e 20 72 | 61 6e 64 6f 6d 2e 6d 61 |f -man r|andom.ma|
|000017b0| 6e 20 7c 20 6c 70 72 0a | 58 25 74 20 70 74 72 6f |n | lpr.|X%t ptro|
|000017c0| 66 66 20 2d 6d 61 6e 20 | 72 61 6e 64 6f 6d 2e 6d |ff -man |random.m|
|000017d0| 61 6e 20 2d 50 6c 77 0a | 58 2e 58 43 0a 58 2e 54 |an -Plw.|X.XC.X.T|
|000017e0| 48 20 52 41 5f 52 41 4e | 44 4f 4d 20 33 20 22 4e |H RA_RAN|DOM 3 "N|
|000017f0| 6f 76 65 6d 62 65 72 20 | 31 39 39 30 22 0a 58 2e |ovember |1990".X.|
|00001800| 53 48 20 4e 41 4d 45 20 | 0a 58 72 61 5f 72 61 6e |SH NAME |.Xra_ran|
|00001810| 64 6f 6d 20 5c 2d 20 72 | 61 6e 64 6f 6d 20 6e 75 |dom \- r|andom nu|
|00001820| 6d 62 65 72 20 67 65 6e | 65 72 61 74 69 6f 6e 20 |mber gen|eration |
|00001830| 72 6f 75 74 69 6e 65 73 | 0a 58 2e 53 48 20 53 59 |routines|.X.SH SY|
|00001840| 4e 4f 50 53 49 53 0a 58 | 2e 6e 66 0a 58 23 69 6e |NOPSIS.X|.nf.X#in|
|00001850| 63 6c 75 64 65 20 22 72 | 61 6e 64 6f 6d 2e 68 22 |clude "r|andom.h"|
|00001860| 0a 58 0a 58 69 6e 74 20 | 72 61 5f 72 6f 6c 6c 28 |.X.Xint |ra_roll(|
|00001870| 73 74 72 29 20 63 68 61 | 72 20 2a 73 74 72 20 3b |str) cha|r *str ;|
|00001880| 20 0a 58 0a 58 63 68 61 | 72 20 2a 72 61 5f 63 61 | .X.Xcha|r *ra_ca|
|00001890| 72 64 28 29 0a 58 0a 58 | 69 6e 74 20 72 61 5f 72 |rd().X.X|int ra_r|
|000018a0| 61 6e 64 6f 6d 28 6d 61 | 78 29 20 69 6e 74 20 6d |andom(ma|x) int m|
|000018b0| 61 78 20 3b 0a 58 0a 58 | 69 6e 74 20 72 61 5f 73 |ax ;.X.X|int ra_s|
|000018c0| 65 65 64 28 73 65 65 64 | 29 20 69 6e 74 20 73 65 |eed(seed|) int se|
|000018d0| 65 64 20 3b 0a 58 0a 58 | 64 6f 75 62 6c 65 20 72 |ed ;.X.X|double r|
|000018e0| 61 5f 66 6c 6f 61 74 28 | 29 0a 58 0a 58 69 6e 74 |a_float(|).X.Xint|
|000018f0| 20 72 61 5f 71 75 65 72 | 79 28 73 74 72 2c 77 68 | ra_quer|y(str,wh|
|00001900| 61 74 29 20 63 68 61 72 | 20 2a 73 74 72 20 3b 20 |at) char| *str ; |
|00001910| 69 6e 74 20 77 68 61 74 | 20 3b 0a 58 0a 58 69 6e |int what| ;.X.Xin|
|00001920| 74 20 72 61 5f 6c 6f 67 | 67 69 6e 67 28 73 74 61 |t ra_log|ging(sta|
|00001930| 74 65 2c 66 69 6c 65 6e | 61 6d 65 29 20 69 6e 74 |te,filen|ame) int|
|00001940| 20 73 74 61 74 65 20 3b | 20 63 68 61 72 20 2a 66 | state ;| char *f|
|00001950| 69 6c 65 6e 61 6d 65 20 | 3b 0a 58 2e 66 69 0a 58 |ilename |;.X.fi.X|
|00001960| 2e 53 48 20 44 45 53 43 | 52 49 50 54 49 4f 4e 0a |.SH DESC|RIPTION.|
|00001970| 58 2e 49 50 20 72 61 5f | 72 6f 6c 6c 0a 58 54 68 |X.IP ra_|roll.XTh|
|00001980| 69 73 20 72 6f 75 74 69 | 6e 65 20 74 61 6b 65 73 |is routi|ne takes|
|00001990| 20 61 20 74 65 78 74 20 | 72 65 70 72 65 73 65 6e | a text |represen|
|000019a0| 74 61 74 69 6f 6e 20 6f | 66 20 61 20 64 69 63 65 |tation o|f a dice|
|000019b0| 20 72 6f 6c 6c 2c 20 61 | 6e 64 20 72 65 74 75 72 | roll, a|nd retur|
|000019c0| 6e 73 20 61 20 0a 58 6e | 75 6d 62 65 72 20 72 6f |ns a .Xn|umber ro|
|000019d0| 6c 6c 65 64 2e 20 20 53 | 61 6d 70 6c 65 20 64 69 |lled. S|ample di|
|000019e0| 63 65 20 72 6f 6c 6c 73 | 20 61 72 65 20 22 31 64 |ce rolls| are "1d|
|000019f0| 31 30 22 2c 20 22 32 64 | 34 22 2c 20 22 33 64 31 |10", "2d|4", "3d1|
|00001a00| 30 2b 32 22 2c 20 6f 72 | 20 22 34 64 34 2d 31 22 |0+2", or| "4d4-1"|
|00001a10| 2e 0a 58 2e 49 50 20 72 | 61 5f 63 61 72 64 0a 58 |..X.IP r|a_card.X|
|00001a20| 54 68 69 73 20 63 61 6c | 6c 20 72 65 74 75 72 6e |This cal|l return|
|00001a30| 73 20 61 20 72 61 6e 64 | 6f 6d 20 63 61 72 64 20 |s a rand|om card |
|00001a40| 66 72 6f 6d 20 61 20 70 | 6c 61 79 69 6e 67 20 64 |from a p|laying d|
|00001a50| 65 63 6b 20 28 6d 69 6e | 75 73 20 6a 6f 6b 65 72 |eck (min|us joker|
|00001a60| 73 29 2e 0a 58 54 68 65 | 20 72 65 74 75 72 6e 65 |s)..XThe| returne|
|00001a70| 64 20 70 6f 69 6e 74 65 | 72 20 69 73 20 74 6f 20 |d pointe|r is to |
|00001a80| 61 20 73 74 61 74 69 63 | 20 73 74 72 69 6e 67 20 |a static| string |
|00001a90| 63 6f 6e 74 61 69 6e 69 | 6e 67 20 61 20 6e 75 6d |containi|ng a num|
|00001aa0| 62 65 72 20 61 6e 64 20 | 61 20 6c 6f 77 65 72 0a |ber and |a lower.|
|00001ab0| 58 63 61 73 65 20 6c 65 | 74 74 65 72 2c 20 66 6f |Xcase le|tter, fo|
|00001ac0| 72 20 65 78 61 6d 70 6c | 65 20 22 34 73 22 20 6f |r exampl|e "4s" o|
|00001ad0| 72 20 22 31 32 64 22 20 | 66 6f 72 20 74 68 65 20 |r "12d" |for the |
|00001ae0| 66 6f 75 72 20 6f 66 20 | 73 70 61 64 65 73 20 61 |four of |spades a|
|00001af0| 6e 64 20 71 75 65 65 6e | 0a 58 6f 66 20 64 69 61 |nd queen|.Xof dia|
|00001b00| 6d 6f 6e 64 73 2c 20 72 | 65 73 70 65 63 74 69 76 |monds, r|espectiv|
|00001b10| 65 6c 79 2e 20 20 0a 58 | 2e 49 50 20 72 61 5f 72 |ely. .X|.IP ra_r|
|00001b20| 61 6e 64 6f 6d 0a 58 54 | 61 6b 65 73 20 61 20 6e |andom.XT|akes a n|
|00001b30| 75 6d 62 65 72 20 61 6e | 64 20 72 65 74 75 72 6e |umber an|d return|
|00001b40| 73 20 61 20 72 61 6e 64 | 6f 6d 20 6e 75 6d 62 65 |s a rand|om numbe|
|00001b50| 72 20 62 65 74 77 65 65 | 6e 20 31 20 61 6e 64 20 |r betwee|n 1 and |
|00001b60| 74 68 65 20 6e 75 6d 62 | 65 72 20 70 61 73 73 65 |the numb|er passe|
|00001b70| 64 20 0a 58 69 6e 2e 0a | 58 2e 49 50 20 72 61 5f |d .Xin..|X.IP ra_|
|00001b80| 73 65 65 64 0a 58 49 6e | 69 74 69 61 6c 69 7a 65 |seed.XIn|itialize|
|00001b90| 73 20 74 68 65 20 72 61 | 6e 64 6f 6d 20 6e 75 6d |s the ra|ndom num|
|00001ba0| 62 65 72 20 73 74 72 65 | 61 6d 2e 20 20 49 74 27 |ber stre|am. It'|
|00001bb0| 73 20 6f 6e 65 20 61 72 | 67 75 6d 65 6e 74 20 69 |s one ar|gument i|
|00001bc0| 73 20 74 68 65 20 6e 65 | 77 20 73 65 65 64 2e 0a |s the ne|w seed..|
|00001bd0| 58 55 73 65 20 61 20 73 | 65 65 64 20 6f 66 20 7a |XUse a s|eed of z|
|00001be0| 65 72 6f 20 66 6f 72 20 | 64 65 62 75 67 67 69 6e |ero for |debuggin|
|00001bf0| 67 20 28 66 6f 72 20 72 | 65 70 72 6f 64 75 63 61 |g (for r|eproduca|
|00001c00| 62 6c 69 74 79 29 20 62 | 75 74 20 73 6f 6d 65 20 |blity) b|ut some |
|00001c10| 6f 74 68 65 72 20 6e 75 | 6d 62 65 72 0a 58 66 6f |other nu|mber.Xfo|
|00001c20| 72 20 72 65 61 6c 20 75 | 73 65 2e 0a 58 2e 49 50 |r real u|se..X.IP|
|00001c30| 20 72 61 5f 66 6c 6f 61 | 74 0a 58 54 68 69 73 20 | ra_floa|t.XThis |
|00001c40| 63 61 6c 6c 20 72 65 74 | 75 72 6e 73 20 61 20 72 |call ret|urns a r|
|00001c50| 61 6e 64 6f 6d 20 66 6c | 6f 61 74 69 6e 67 20 70 |andom fl|oating p|
|00001c60| 6f 69 6e 74 20 6e 75 6d | 62 65 72 20 62 65 74 77 |oint num|ber betw|
|00001c70| 65 65 6e 20 30 20 61 6e | 64 20 31 2e 20 20 49 27 |een 0 an|d 1. I'|
|00001c80| 6d 20 6e 6f 74 0a 58 72 | 65 61 6c 6c 79 20 73 75 |m not.Xr|eally su|
|00001c90| 72 65 20 68 6f 77 20 72 | 61 6e 64 6f 6d 20 69 74 |re how r|andom it|
|00001ca0| 20 69 73 20 74 68 6f 75 | 67 68 3b 20 69 74 20 69 | is thou|gh; it i|
|00001cb0| 73 20 65 78 70 65 72 69 | 6d 65 6e 74 61 6c 2e 0a |s experi|mental..|
|00001cc0| 58 2e 49 50 20 72 61 5f | 71 75 65 72 79 0a 58 54 |X.IP ra_|query.XT|
|00001cd0| 68 69 73 20 66 75 6e 63 | 74 69 6f 6e 20 72 65 74 |his func|tion ret|
|00001ce0| 75 72 6e 73 20 69 6e 66 | 6f 72 6d 61 74 69 6f 6e |urns inf|ormation|
|00001cf0| 20 61 62 6f 75 74 20 61 | 20 64 69 63 65 20 72 6f | about a| dice ro|
|00001d00| 6c 6c 2e 20 20 54 68 65 | 20 72 6f 6c 6c 20 79 6f |ll. The| roll yo|
|00001d10| 75 20 61 72 65 0a 58 61 | 73 6b 69 6e 67 20 61 62 |u are.Xa|sking ab|
|00001d20| 6f 75 74 20 69 73 20 74 | 68 65 20 66 69 72 73 74 |out is t|he first|
|00001d30| 20 61 72 67 75 6d 65 6e | 74 2e 20 20 54 68 65 20 | argumen|t. The |
|00001d40| 73 65 63 6f 6e 64 20 61 | 72 67 75 6d 65 6e 74 20 |second a|rgument |
|00001d50| 63 6f 6e 74 72 6f 6c 73 | 20 77 68 61 74 0a 58 69 |controls| what.Xi|
|00001d60| 73 20 72 65 74 75 72 6e | 65 64 3a 0a 58 2e 52 53 |s return|ed:.X.RS|
|00001d70| 0a 58 2e 49 50 20 52 41 | 5f 4d 41 58 0a 58 52 65 |.X.IP RA|_MAX.XRe|
|00001d80| 74 75 72 6e 73 20 74 68 | 65 20 6c 61 72 67 65 73 |turns th|e larges|
|00001d90| 74 20 6e 75 6d 62 65 72 | 20 74 68 69 73 20 72 6f |t number| this ro|
|00001da0| 6c 6c 20 63 61 6e 20 67 | 65 6e 65 72 61 74 65 2e |ll can g|enerate.|
|00001db0| 0a 58 2e 49 50 20 52 41 | 5f 4d 49 4e 0a 58 52 65 |.X.IP RA|_MIN.XRe|
|00001dc0| 74 75 72 6e 73 20 74 68 | 65 20 73 6d 61 6c 6c 20 |turns th|e small |
|00001dd0| 6e 75 6d 62 65 72 20 74 | 68 69 73 20 72 6f 6c 6c |number t|his roll|
|00001de0| 20 63 61 6e 20 67 65 6e | 65 72 61 74 65 2e 0a 58 | can gen|erate..X|
|00001df0| 2e 49 50 20 52 41 5f 41 | 56 45 0a 58 52 65 74 75 |.IP RA_A|VE.XRetu|
|00001e00| 72 6e 73 20 74 68 65 20 | 61 76 65 72 61 67 65 20 |rns the |average |
|00001e10| 6e 75 6d 62 65 72 20 77 | 68 69 63 68 20 74 68 69 |number w|hich thi|
|00001e20| 73 20 72 6f 6c 6c 20 77 | 69 6c 6c 20 67 65 6e 65 |s roll w|ill gene|
|00001e30| 72 61 74 65 2e 0a 58 2e | 49 50 20 52 41 5f 4c 45 |rate..X.|IP RA_LE|
|00001e40| 47 41 4c 0a 58 52 65 74 | 75 72 6e 73 20 74 72 75 |GAL.XRet|urns tru|
|00001e50| 65 20 28 31 29 20 69 66 | 20 74 68 65 20 73 74 72 |e (1) if| the str|
|00001e60| 69 6e 67 20 70 61 73 73 | 65 64 20 69 6e 20 69 73 |ing pass|ed in is|
|00001e70| 20 61 20 6c 65 67 61 6c | 20 64 69 63 65 20 72 6f | a legal| dice ro|
|00001e80| 6c 6c 2e 20 20 52 65 74 | 75 72 6e 73 0a 58 66 61 |ll. Ret|urns.Xfa|
|00001e90| 6c 73 65 20 28 30 29 20 | 69 66 20 69 74 20 69 73 |lse (0) |if it is|
|00001ea0| 20 6e 6f 74 2e 0a 58 2e | 52 45 0a 58 2e 73 70 20 | not..X.|RE.X.sp |
|00001eb0| 31 0a 58 2e 49 50 20 72 | 61 5f 6c 6f 67 67 69 6e |1.X.IP r|a_loggin|
|00001ec0| 67 0a 58 54 68 69 73 20 | 72 6f 75 74 69 6e 65 20 |g.XThis |routine |
|00001ed0| 65 6e 61 62 6c 65 73 20 | 6f 72 20 64 69 73 61 62 |enables |or disab|
|00001ee0| 6c 65 73 20 6c 6f 67 67 | 69 6e 67 20 61 6e 20 70 |les logg|ing an p|
|00001ef0| 6c 61 79 62 61 63 6b 20 | 6f 66 20 72 61 6e 64 6f |layback |of rando|
|00001f00| 6d 20 6e 75 6d 62 65 72 | 73 2e 0a 58 49 74 20 69 |m number|s..XIt i|
|00001f10| 73 20 64 65 73 69 67 6e | 65 64 20 68 65 6c 70 20 |s design|ed help |
|00001f20| 74 65 73 74 69 6e 67 2f | 64 65 62 75 67 67 69 6e |testing/|debuggin|
|00001f30| 67 20 62 79 20 72 65 63 | 72 65 61 74 69 6e 67 20 |g by rec|reating |
|00001f40| 74 68 65 20 73 61 6d 65 | 20 72 61 6e 64 6f 6d 20 |the same| random |
|00001f50| 6e 75 6d 62 65 72 20 0a | 58 73 74 72 65 61 6d 20 |number .|Xstream |
|00001f60| 6f 76 65 72 20 61 6e 64 | 20 6f 76 65 72 2e 20 20 |over and| over. |
|00001f70| 54 68 65 20 66 69 72 73 | 74 20 61 72 67 75 6d 65 |The firs|t argume|
|00001f80| 6e 74 20 69 73 20 74 68 | 65 20 63 6f 6d 6d 61 6e |nt is th|e comman|
|00001f90| 64 2c 20 74 68 65 20 73 | 65 63 6f 6e 64 20 69 73 |d, the s|econd is|
|00001fa0| 0a 58 61 20 66 69 6c 65 | 20 6e 61 6d 65 2e 20 20 |.Xa file| name. |
|00001fb0| 54 68 65 20 63 6f 6d 6d | 61 6e 64 73 20 61 72 65 |The comm|ands are|
|00001fc0| 20 69 6e 20 72 61 6e 64 | 6f 6d 2e 68 3a 0a 58 2e | in rand|om.h:.X.|
|00001fd0| 52 53 0a 58 2e 49 50 20 | 52 41 5f 4e 4f 52 4d 41 |RS.X.IP |RA_NORMA|
|00001fe0| 4c 0a 58 52 65 74 75 72 | 6e 73 20 74 6f 20 74 68 |L.XRetur|ns to th|
|00001ff0| 65 20 6e 6f 72 6d 61 6c | 20 73 74 61 74 65 2e 20 |e normal| state. |
|00002000| 20 52 61 6e 64 6f 6d 20 | 6e 75 6d 62 65 72 20 61 | Random |number a|
|00002010| 72 65 20 67 65 6e 65 72 | 61 74 65 64 20 6f 6e 20 |re gener|ated on |
|00002020| 74 68 65 20 66 6c 79 20 | 61 6e 64 0a 58 6e 6f 74 |the fly |and.Xnot|
|00002030| 20 6c 6f 67 67 65 64 2e | 20 20 54 68 65 20 73 65 | logged.| The se|
|00002040| 63 6f 6e 64 20 61 72 67 | 75 6d 65 6e 74 20 69 73 |cond arg|ument is|
|00002050| 20 69 67 6e 6f 72 65 64 | 2e 0a 58 2e 49 50 20 52 | ignored|..X.IP R|
|00002060| 41 5f 50 4c 41 59 0a 58 | 52 61 6e 64 6f 6d 20 6e |A_PLAY.X|Random n|
|00002070| 75 6d 62 65 72 73 20 61 | 72 65 20 6e 6f 74 20 67 |umbers a|re not g|
|00002080| 65 6e 65 72 61 74 65 64 | 2c 20 62 75 74 20 72 65 |enerated|, but re|
|00002090| 61 64 20 66 72 6f 6d 20 | 74 68 65 20 66 69 6c 65 |ad from |the file|
|000020a0| 20 70 61 73 73 65 64 20 | 69 6e 20 61 73 20 74 68 | passed |in as th|
|000020b0| 65 0a 58 73 65 63 6f 6e | 64 20 61 72 67 75 6d 65 |e.Xsecon|d argume|
|000020c0| 6e 74 2e 20 20 42 79 20 | 63 6f 6e 76 65 6e 74 69 |nt. By |conventi|
|000020d0| 6f 6e 20 74 68 65 73 65 | 20 66 69 6c 65 73 20 65 |on these| files e|
|000020e0| 6e 64 20 69 6e 20 22 2e | 72 6c 22 20 66 6f 72 20 |nd in ".|rl" for |
|000020f0| 72 61 6e 64 6f 6d 20 6c | 6f 67 2e 0a 58 2e 49 50 |random l|og..X.IP|
|00002100| 20 52 41 5f 4c 4f 47 0a | 58 52 61 6e 64 6f 6d 20 | RA_LOG.|XRandom |
|00002110| 6e 75 6d 62 65 72 20 61 | 72 65 20 67 65 6e 65 72 |number a|re gener|
|00002120| 61 74 65 64 20 6f 6e 20 | 74 68 65 20 66 6c 79 20 |ated on |the fly |
|00002130| 61 6e 64 20 73 74 6f 72 | 65 64 20 69 6e 20 61 20 |and stor|ed in a |
|00002140| 72 61 6e 64 6f 6d 20 6c | 6f 67 20 66 69 6c 65 0a |random l|og file.|
|00002150| 58 66 6f 72 20 6c 61 74 | 65 72 20 70 6c 61 79 62 |Xfor lat|er playb|
|00002160| 61 63 6b 2e 20 20 54 68 | 65 20 6c 6f 67 20 66 69 |ack. Th|e log fi|
|00002170| 6c 65 20 6e 61 6d 65 20 | 69 73 20 74 68 65 20 73 |le name |is the s|
|00002180| 65 63 6f 6e 64 20 63 6f | 6d 6d 61 6e 64 2e 20 20 |econd co|mmand. |
|00002190| 0a 58 2e 52 45 0a 58 2e | 73 70 20 31 0a 58 49 6e |.X.RE.X.|sp 1.XIn|
|000021a0| 20 74 68 65 6f 72 79 2c | 20 62 6f 74 68 20 70 6c | theory,| both pl|
|000021b0| 61 79 20 61 6e 64 20 6c | 6f 67 20 63 61 6e 20 62 |ay and l|og can b|
|000021c0| 65 20 61 63 74 69 76 65 | 20 61 74 20 74 68 65 20 |e active| at the |
|000021d0| 73 61 6d 65 20 74 69 6d | 65 2c 20 62 75 74 20 74 |same tim|e, but t|
|000021e0| 68 69 73 20 69 73 0a 58 | 61 6e 20 75 6e 74 65 73 |his is.X|an untes|
|000021f0| 74 65 64 20 63 6f 6e 66 | 69 67 75 72 61 74 69 6f |ted conf|iguratio|
|00002200| 6e 2e 20 20 42 6f 74 68 | 20 70 6c 61 79 20 61 6e |n. Both| play an|
|00002210| 64 20 6c 6f 67 20 61 72 | 65 20 74 75 72 6e 65 64 |d log ar|e turned|
|00002220| 20 6f 66 66 20 62 79 20 | 6e 6f 72 6d 61 6c 2e 0a | off by |normal..|
|00002230| 58 2e 49 50 20 72 61 5f | 73 74 64 64 65 76 0a 58 |X.IP ra_|stddev.X|
|00002240| 3c 3c 4e 4f 54 20 59 45 | 54 20 49 4d 50 4c 45 4d |<<NOT YE|T IMPLEM|
|00002250| 45 4e 54 45 44 3e 3e 0a | 58 2e 53 48 20 22 45 58 |ENTED>>.|X.SH "EX|
|00002260| 41 4d 50 4c 45 53 22 0a | 58 2e 6e 66 0a 58 4e 6f |AMPLES".|X.nf.XNo|
|00002270| 74 20 64 6f 6e 65 20 79 | 65 74 2e 20 20 4c 6f 6f |t done y|et. Loo|
|00002280| 6b 20 61 74 20 72 61 6e | 64 6f 6d 2e 63 2c 20 74 |k at ran|dom.c, t|
|00002290| 61 62 6c 65 73 69 6d 70 | 6c 65 2e 63 20 61 6e 64 |ablesimp|le.c and|
|000022a0| 20 74 61 62 6c 65 6d 75 | 6c 74 69 2e 63 2e 0a 58 | tablemu|lti.c..X|
|000022b0| 2e 66 69 0a 58 2e 53 48 | 20 22 53 45 45 20 41 4c |.fi.X.SH| "SEE AL|
|000022c0| 53 4f 22 0a 58 2e 50 50 | 0a 58 54 68 65 73 65 20 |SO".X.PP|.XThese |
|000022d0| 72 6f 75 74 69 6e 65 73 | 20 75 73 65 20 72 61 6e |routines| use ran|
|000022e0| 64 6f 6d 28 33 29 20 74 | 6f 20 67 65 6e 65 72 61 |dom(3) t|o genera|
|000022f0| 74 65 20 72 61 6e 64 6f | 6d 20 6e 75 6d 62 65 72 |te rando|m number|
|00002300| 73 2e 0a 58 2e 53 48 20 | 22 42 55 47 53 22 0a 58 |s..X.SH |"BUGS".X|
|00002310| 2e 49 50 20 5c 28 62 75 | 0a 58 54 68 65 73 65 20 |.IP \(bu|.XThese |
|00002320| 72 6f 75 74 69 6e 65 73 | 20 72 65 6c 79 20 6f 6e |routines| rely on|
|00002330| 20 74 68 65 20 6c 6f 63 | 61 6c 20 43 20 6c 69 62 | the loc|al C lib|
|00002340| 72 61 72 79 20 74 6f 20 | 70 72 6f 76 69 64 65 20 |rary to |provide |
|00002350| 72 61 77 20 72 61 6e 64 | 6f 6d 20 6e 75 6d 62 65 |raw rand|om numbe|
|00002360| 72 73 2e 0a 58 54 68 65 | 79 20 73 68 6f 75 6c 64 |rs..XThe|y should|
|00002370| 20 63 6f 6d 65 20 77 69 | 74 68 20 74 68 65 72 65 | come wi|th there|
|00002380| 20 6f 77 6e 20 67 65 6e | 65 72 61 74 6f 72 2e 0a | own gen|erator..|
|00002390| 58 2e 53 48 20 41 55 54 | 48 4f 52 0a 58 2e 50 50 |X.SH AUT|HOR.X.PP|
|000023a0| 0a 58 54 68 65 20 72 61 | 6e 64 6f 6d 20 72 6f 75 |.XThe ra|ndom rou|
|000023b0| 74 69 6e 65 73 20 77 65 | 72 65 20 77 72 69 74 74 |tines we|re writt|
|000023c0| 65 6e 20 62 79 20 4a 6f | 73 68 75 61 20 4c 65 76 |en by Jo|shua Lev|
|000023d0| 79 2e 0a 58 2e 62 72 0a | 58 6a 6f 73 68 75 61 40 |y..X.br.|Xjoshua@|
|000023e0| 61 74 68 65 72 74 6f 6e | 2e 63 6f 6d 20 20 20 48 |atherton|.com H|
|000023f0| 6f 6d 65 3a 20 28 34 31 | 35 29 20 39 36 38 2d 33 |ome: (41|5) 968-3|
|00002400| 37 31 38 20 20 20 57 6f | 72 6b 3a 20 28 34 30 38 |718 Wo|rk: (408|
|00002410| 29 20 37 33 34 2d 39 38 | 32 32 0a 58 2e 49 50 20 |) 734-98|22.X.IP |
|00002420| 22 5c 28 63 6f 20 31 39 | 38 39 20 4a 6f 73 68 75 |"\(co 19|89 Joshu|
|00002430| 61 20 4c 65 76 79 22 0a | 58 54 68 69 73 20 6d 61 |a Levy".|XThis ma|
|00002440| 6e 20 70 61 67 65 20 61 | 6e 64 20 74 68 65 20 63 |n page a|nd the c|
|00002450| 6f 64 65 20 69 74 20 64 | 65 73 63 72 69 62 65 73 |ode it d|escribes|
|00002460| 20 69 73 20 63 6f 76 65 | 72 65 64 20 62 79 20 74 | is cove|red by t|
|00002470| 68 65 20 47 4e 55 20 67 | 65 6e 65 72 61 6c 0a 58 |he GNU g|eneral.X|
|00002480| 70 75 62 6c 69 63 20 6c | 69 63 65 6e 73 65 2c 20 |public l|icense, |
|00002490| 63 6f 6d 6d 6f 6e 6c 79 | 20 63 61 6c 6c 65 64 20 |commonly| called |
|000024a0| 74 68 65 20 22 63 6f 70 | 79 6c 65 66 74 22 2e 20 |the "cop|yleft". |
|000024b0| 20 49 74 20 63 61 6e 20 | 6f 6e 6c 79 20 62 65 20 | It can |only be |
|000024c0| 75 73 65 64 20 6f 72 0a | 58 72 65 64 69 73 74 72 |used or.|Xredistr|
|000024d0| 69 62 75 74 65 64 20 75 | 6e 64 65 72 20 74 68 65 |ibuted u|nder the|
|000024e0| 20 74 65 72 6d 73 20 6f | 66 20 74 68 61 74 20 61 | terms o|f that a|
|000024f0| 67 72 65 65 6d 65 6e 74 | 2e 20 20 50 65 72 73 6f |greement|. Perso|
|00002500| 6e 73 20 6f 72 20 63 6f | 72 70 6f 72 61 74 69 6f |ns or co|rporatio|
|00002510| 6e 73 0a 58 77 69 73 68 | 69 6e 67 20 74 6f 20 75 |ns.Xwish|ing to u|
|00002520| 73 65 20 74 68 69 73 20 | 63 6f 64 65 20 69 6e 20 |se this |code in |
|00002530| 77 61 79 73 20 6e 6f 74 | 20 61 6c 6c 6f 77 65 64 |ways not| allowed|
|00002540| 20 62 79 20 74 68 65 20 | 47 4e 55 20 6c 69 63 65 | by the |GNU lice|
|00002550| 6e 73 65 20 73 68 6f 75 | 6c 64 20 0a 58 63 6f 6e |nse shou|ld .Xcon|
|00002560| 74 61 63 74 20 74 68 65 | 20 61 75 74 68 6f 72 20 |tact the| author |
|00002570| 74 6f 20 64 69 73 63 75 | 73 73 20 6f 74 68 65 72 |to discu|ss other|
|00002580| 20 6c 69 63 65 6e 73 69 | 6e 67 20 61 67 72 65 65 | licensi|ng agree|
|00002590| 6d 65 6e 74 73 2e 0a 58 | 2e 62 72 0a 53 48 41 52 |ments..X|.br.SHAR|
|000025a0| 5f 45 4f 46 0a 66 69 0a | 69 66 20 74 65 73 74 20 |_EOF.fi.|if test |
|000025b0| 2d 66 20 27 74 62 2d 65 | 78 65 63 73 2e 6d 61 6e |-f 'tb-e|xecs.man|
|000025c0| 27 0a 74 68 65 6e 0a 09 | 65 63 68 6f 20 73 68 61 |'.then..|echo sha|
|000025d0| 72 3a 20 22 77 69 6c 6c | 20 6e 6f 74 20 6f 76 65 |r: "will| not ove|
|000025e0| 72 2d 77 72 69 74 65 20 | 65 78 69 73 74 69 6e 67 |r-write |existing|
|000025f0| 20 66 69 6c 65 20 27 74 | 62 2d 65 78 65 63 73 2e | file 't|b-execs.|
|00002600| 6d 61 6e 27 22 0a 65 6c | 73 65 0a 73 65 64 20 27 |man'".el|se.sed '|
|00002610| 73 2f 5e 58 2f 2f 27 20 | 3c 3c 20 5c 53 48 41 52 |s/^X//' |<< \SHAR|
|00002620| 5f 45 4f 46 20 3e 20 27 | 74 62 2d 65 78 65 63 73 |_EOF > '|tb-execs|
|00002630| 2e 6d 61 6e 27 0a 58 2e | 69 67 20 58 43 0a 58 25 |.man'.X.|ig XC.X%|
|00002640| 20 20 6e 72 6f 66 66 20 | 2d 6d 61 6e 20 74 62 2d | nroff |-man tb-|
|00002650| 65 78 65 63 73 2e 6d 61 | 6e 20 7c 20 6d 6f 72 65 |execs.ma|n | more|
|00002660| 0a 58 25 6e 20 6e 72 6f | 66 66 20 2d 6d 61 6e 20 |.X%n nro|ff -man |
|00002670| 74 62 2d 65 78 65 63 73 | 2e 6d 61 6e 20 7c 20 6c |tb-execs|.man | l|
|00002680| 70 72 0a 58 25 74 20 70 | 74 72 6f 66 66 20 2d 6d |pr.X%t p|troff -m|
|00002690| 61 6e 20 74 62 2d 65 78 | 65 63 73 2e 6d 61 6e 20 |an tb-ex|ecs.man |
|000026a0| 2d 50 6c 77 0a 58 2e 58 | 43 0a 58 2e 54 48 20 54 |-Plw.X.X|C.X.TH T|
|000026b0| 41 42 4c 45 2d 45 58 45 | 43 53 20 31 20 22 44 65 |ABLE-EXE|CS 1 "De|
|000026c0| 63 20 32 37 74 68 20 31 | 39 38 39 22 0a 58 2e 53 |c 27th 1|989".X.S|
|000026d0| 48 20 4e 41 4d 45 20 0a | 58 74 61 62 6c 65 2d 65 |H NAME .|Xtable-e|
|000026e0| 78 65 63 20 5c 2d 20 74 | 68 65 20 65 78 65 63 75 |xec \- t|he execu|
|000026f0| 74 61 62 6c 65 73 20 73 | 68 69 70 70 65 64 20 77 |tables s|hipped w|
|00002700| 69 74 68 20 74 61 62 6c | 65 3a 20 74 61 62 6c 65 |ith tabl|e: table|
|00002710| 2c 20 74 62 32 74 62 6c | 2c 20 72 6e 64 74 65 73 |, tb2tbl|, rndtes|
|00002720| 74 2c 20 62 77 0a 58 2e | 53 48 20 53 59 4e 4f 50 |t, bw.X.|SH SYNOP|
|00002730| 53 49 53 0a 58 2e 6e 66 | 0a 58 74 61 62 6c 65 20 |SIS.X.nf|.Xtable |
|00002740| 3c 74 61 62 6c 65 2e 66 | 69 6c 65 3e 20 3c 6e 75 |<table.f|ile> <nu|
|00002750| 6d 62 65 72 3e 0a 58 74 | 62 32 74 62 6c 20 3c 74 |mber>.Xt|b2tbl <t|
|00002760| 61 62 6c 65 2e 66 69 6c | 65 3e 0a 58 72 6e 64 74 |able.fil|e>.Xrndt|
|00002770| 65 73 74 0a 58 74 62 74 | 65 73 74 0a 58 62 77 20 |est.Xtbt|est.Xbw |
|00002780| 3c 73 65 65 64 3e 20 3c | 6e 75 6d 62 65 72 3e 0a |<seed> <|number>.|
|00002790| 58 2e 66 69 0a 58 2e 53 | 48 20 44 45 53 43 52 49 |X.fi.X.S|H DESCRI|
|000027a0| 50 54 49 4f 4e 0a 58 2e | 49 50 20 74 61 62 6c 65 |PTION.X.|IP table|
|000027b0| 0a 58 54 68 69 73 20 69 | 73 20 61 20 73 69 6d 70 |.XThis i|s a simp|
|000027c0| 6c 65 20 66 72 6f 6e 74 | 20 65 6e 64 20 74 6f 20 |le front| end to |
|000027d0| 74 68 65 20 74 61 62 6c | 65 20 72 6f 75 74 69 6e |the tabl|e routin|
|000027e0| 65 73 2c 20 64 65 73 69 | 67 6e 65 64 20 66 6f 72 |es, desi|gned for|
|000027f0| 20 74 65 73 74 69 6e 67 | 2e 0a 58 54 61 62 6c 65 | testing|..XTable|
|00002800| 20 74 61 6b 65 73 20 74 | 77 6f 20 61 72 67 75 6d | takes t|wo argum|
|00002810| 65 6e 74 73 2e 20 20 54 | 68 65 20 6e 61 6d 65 20 |ents. T|he name |
|00002820| 6f 66 20 74 68 65 20 66 | 69 6c 65 20 63 6f 6e 74 |of the f|ile cont|
|00002830| 61 69 6e 69 6e 67 20 74 | 68 65 20 74 61 62 6c 65 |aining t|he table|
|00002840| 2c 0a 58 61 6e 64 20 74 | 68 65 20 6e 75 6d 62 65 |,.Xand t|he numbe|
|00002850| 72 20 6f 66 20 74 69 6d | 65 73 20 74 6f 20 72 6f |r of tim|es to ro|
|00002860| 6c 6c 20 6f 6e 20 74 68 | 61 74 20 74 61 62 6c 65 |ll on th|at table|
|00002870| 2e 20 20 4e 65 69 74 68 | 65 72 20 6f 66 20 74 68 |. Neith|er of th|
|00002880| 65 73 65 20 61 72 67 75 | 6d 65 6e 74 73 0a 58 61 |ese argu|ments.Xa|
|00002890| 72 65 20 6f 70 74 69 6f | 6e 61 6c 2e 0a 58 2e 49 |re optio|nal..X.I|
|000028a0| 50 20 74 62 32 74 62 6c | 0a 58 54 68 69 73 20 70 |P tb2tbl|.XThis p|
|000028b0| 72 6f 67 72 61 6d 20 74 | 61 6b 65 73 20 6f 6e 65 |rogram t|akes one|
|000028c0| 20 61 72 67 75 6d 65 6e | 74 2c 20 61 20 74 61 62 | argumen|t, a tab|
|000028d0| 6c 65 20 66 69 6c 65 2c | 20 77 68 69 63 68 20 69 |le file,| which i|
|000028e0| 74 20 74 72 61 6e 73 6c | 61 74 65 73 20 0a 58 69 |t transl|ates .Xi|
|000028f0| 6e 74 6f 20 74 72 6f 66 | 66 2f 74 62 6c 20 66 6f |nto trof|f/tbl fo|
|00002900| 72 6d 61 74 20 61 6e 64 | 20 77 72 69 74 65 20 74 |rmat and| write t|
|00002910| 6f 20 74 68 65 20 73 74 | 61 6e 64 61 72 64 20 6f |o the st|andard o|
|00002920| 75 74 70 75 74 2e 0a 58 | 2e 49 50 20 72 6e 64 74 |utput..X|.IP rndt|
|00002930| 65 73 74 0a 58 54 68 69 | 73 20 69 73 20 61 20 73 |est.XThi|s is a s|
|00002940| 69 6d 70 6c 65 20 66 72 | 6f 6e 74 20 65 6e 64 20 |imple fr|ont end |
|00002950| 74 6f 20 74 68 65 20 72 | 61 6e 64 6f 6d 20 6e 75 |to the r|andom nu|
|00002960| 6d 62 65 72 20 67 65 6e | 65 72 61 74 69 6f 6e 20 |mber gen|eration |
|00002970| 72 6f 75 74 69 6e 65 73 | 2c 0a 58 64 65 73 69 67 |routines|,.Xdesig|
|00002980| 6e 65 64 20 66 6f 72 20 | 74 65 73 74 69 6e 67 2e |ned for |testing.|
|00002990| 20 20 49 74 20 74 61 6b | 65 73 20 6e 6f 20 61 72 | It tak|es no ar|
|000029a0| 67 75 6d 65 6e 74 73 2c | 20 62 75 74 20 69 6e 74 |guments,| but int|
|000029b0| 65 72 61 63 74 69 76 65 | 6c 79 20 72 65 61 64 73 |eractive|ly reads|
|000029c0| 20 69 6e 0a 58 61 6e 20 | 65 78 65 63 75 74 65 73 | in.Xan |executes|
|000029d0| 20 63 6f 6d 6d 61 6e 64 | 73 2c 20 75 6e 74 69 6c | command|s, until|
|000029e0| 6c 20 69 74 20 72 65 61 | 64 73 20 61 20 71 75 69 |l it rea|ds a qui|
|000029f0| 74 20 6f 72 20 61 6e 20 | 45 4f 46 2e 20 20 54 68 |t or an |EOF. Th|
|00002a00| 65 20 63 6f 6d 6d 61 6e | 64 73 20 69 74 0a 58 61 |e comman|ds it.Xa|
|00002a10| 63 63 65 70 74 73 20 61 | 72 65 3a 0a 58 2e 52 53 |ccepts a|re:.X.RS|
|00002a20| 0a 58 2e 49 50 20 22 73 | 65 65 64 20 3c 6e 65 77 |.X.IP "s|eed <new|
|00002a30| 2d 73 65 65 64 3e 22 0a | 58 54 68 69 73 20 63 61 |-seed>".|XThis ca|
|00002a40| 6c 6c 73 20 74 68 65 20 | 72 61 5f 73 65 65 64 20 |lls the |ra_seed |
|00002a50| 72 6f 75 74 69 6e 65 2c | 20 77 68 69 63 68 20 63 |routine,| which c|
|00002a60| 68 61 6e 67 65 73 20 74 | 68 65 20 73 65 65 64 20 |hanges t|he seed |
|00002a70| 6e 75 6d 62 65 72 20 75 | 73 65 64 20 62 79 20 74 |number u|sed by t|
|00002a80| 68 65 0a 58 75 6e 64 65 | 72 6c 69 65 69 6e 67 20 |he.Xunde|rlieing |
|00002a90| 72 61 6e 64 6f 6d 20 6e | 75 6d 62 65 72 20 67 65 |random n|umber ge|
|00002aa0| 6e 65 72 61 74 6f 72 2e | 0a 58 2e 49 50 20 22 72 |nerator.|.X.IP "r|
|00002ab0| 6f 6c 6c 20 3c 6e 75 6d | 62 65 72 3e 20 3c 64 69 |oll <num|ber> <di|
|00002ac0| 63 65 3e 22 0a 58 54 68 | 69 73 20 63 61 6c 6c 73 |ce>".XTh|is calls|
|00002ad0| 20 74 68 65 20 72 61 5f | 72 6f 6c 6c 20 72 6f 75 | the ra_|roll rou|
|00002ae0| 74 69 6e 65 20 3c 6e 75 | 6d 62 65 72 3e 20 74 69 |tine <nu|mber> ti|
|00002af0| 6d 65 73 2e 20 20 3c 44 | 69 63 65 3e 20 69 73 20 |mes. <D|ice> is |
|00002b00| 74 68 65 20 64 69 63 65 | 20 72 6f 6c 6c 20 74 6f |the dice| roll to|
|00002b10| 0a 58 75 73 65 2e 0a 58 | 2e 49 50 20 22 63 61 72 |.Xuse..X|.IP "car|
|00002b20| 64 20 3c 6e 75 6d 62 65 | 72 3e 22 0a 58 54 68 69 |d <numbe|r>".XThi|
|00002b30| 73 20 63 61 6c 6c 73 20 | 74 68 65 20 72 61 5f 63 |s calls |the ra_c|
|00002b40| 61 72 64 20 72 6f 75 74 | 69 6e 65 20 3c 6e 75 6d |ard rout|ine <num|
|00002b50| 62 65 72 3e 20 74 69 6d | 65 73 2e 0a 58 2e 49 50 |ber> tim|es..X.IP|
|00002b60| 20 22 6c 6f 67 20 3c 77 | 68 61 74 3e 20 3c 77 68 | "log <w|hat> <wh|
|00002b70| 65 72 65 3e 22 0a 58 54 | 68 69 73 20 63 61 6c 6c |ere>".XT|his call|
|00002b80| 73 20 74 68 65 20 72 61 | 5f 6c 6f 67 67 69 6e 67 |s the ra|_logging|
|00002b90| 20 72 6f 75 74 69 6e 65 | 2e 0a 58 2e 52 45 0a 58 | routine|..X.RE.X|
|00002ba0| 2e 49 50 20 74 62 74 65 | 73 74 0a 58 54 68 69 73 |.IP tbte|st.XThis|
|00002bb0| 20 69 73 20 61 20 73 69 | 6d 70 6c 65 20 66 72 6f | is a si|mple fro|
|00002bc0| 6e 74 20 65 6e 64 20 74 | 6f 20 74 68 65 20 74 61 |nt end t|o the ta|
|00002bd0| 62 6c 65 20 72 6f 75 74 | 69 6e 65 73 2c 20 64 65 |ble rout|ines, de|
|00002be0| 73 69 67 6e 65 64 20 66 | 6f 72 20 74 65 73 74 69 |signed f|or testi|
|00002bf0| 6e 67 2e 0a 58 49 74 20 | 74 61 6b 65 73 20 6e 6f |ng..XIt |takes no|
|00002c00| 20 61 72 67 75 6d 65 6e | 74 73 2c 20 62 75 74 20 | argumen|ts, but |
|00002c10| 72 65 61 64 73 20 63 6f | 6d 6d 61 6e 64 73 20 66 |reads co|mmands f|
|00002c20| 72 6f 6d 20 61 20 73 63 | 72 69 70 74 2e 20 20 54 |rom a sc|ript. T|
|00002c30| 68 65 20 63 6f 6d 6d 61 | 6e 64 73 20 0a 58 69 74 |he comma|nds .Xit|
|00002c40| 20 6b 6e 6f 77 73 20 61 | 62 6f 75 74 20 61 72 65 | knows a|bout are|
|00002c50| 3a 0a 58 2e 52 53 0a 58 | 2e 49 50 20 22 72 65 61 |:.X.RS.X|.IP "rea|
|00002c60| 64 22 0a 58 52 65 61 64 | 73 20 69 6e 20 61 20 74 |d".XRead|s in a t|
|00002c70| 61 62 6c 65 20 61 6e 64 | 20 6d 61 6b 65 73 20 69 |able and| makes i|
|00002c80| 74 20 74 68 65 20 63 75 | 72 72 65 6e 74 20 74 61 |t the cu|rrent ta|
|00002c90| 62 6c 65 2e 20 20 49 74 | 20 74 61 6b 65 73 20 6f |ble. It| takes o|
|00002ca0| 6e 65 20 61 72 67 75 6d | 65 6e 74 2c 0a 58 74 68 |ne argum|ent,.Xth|
|00002cb0| 65 20 66 69 6c 65 20 74 | 6f 20 72 65 61 64 20 69 |e file t|o read i|
|00002cc0| 6e 20 74 68 65 20 74 61 | 62 6c 65 20 66 72 6f 6d |n the ta|ble from|
|00002cd0| 2e 0a 58 2e 49 50 20 22 | 66 72 65 65 22 0a 58 46 |..X.IP "|free".XF|
|00002ce0| 72 65 65 73 20 74 68 65 | 20 63 75 72 72 65 6e 74 |rees the| current|
|00002cf0| 20 74 61 62 6c 65 2e 0a | 58 2e 49 50 20 22 75 73 | table..|X.IP "us|
|00002d00| 65 22 0a 58 55 73 65 73 | 20 74 68 65 20 63 75 72 |e".XUses| the cur|
|00002d10| 72 65 6e 74 20 74 61 62 | 6c 65 2e 0a 58 2e 49 50 |rent tab|le..X.IP|
|00002d20| 20 22 6d 61 6e 79 22 0a | 58 55 73 65 73 20 74 68 | "many".|XUses th|
|00002d30| 65 20 63 75 72 72 65 6e | 74 20 74 61 62 6c 65 20 |e curren|t table |
|00002d40| 6d 61 6e 79 20 74 69 6d | 65 73 2e 0a 58 2e 49 50 |many tim|es..X.IP|
|00002d50| 20 22 62 61 63 6b 22 0a | 58 2e 49 50 20 22 70 72 | "back".|X.IP "pr|
|00002d60| 69 6e 74 22 0a 58 50 72 | 69 6e 74 73 20 6f 75 74 |int".XPr|ints out|
|00002d70| 20 74 68 65 20 63 75 72 | 72 65 6e 74 20 74 61 62 | the cur|rent tab|
|00002d80| 6c 65 2e 0a 58 2e 49 50 | 20 22 68 65 6c 70 22 0a |le..X.IP| "help".|
|00002d90| 58 50 72 69 6e 74 73 20 | 6f 75 74 20 73 6f 6d 65 |XPrints |out some|
|00002da0| 20 68 65 6c 70 2e 0a 58 | 2e 49 50 20 22 71 75 69 | help..X|.IP "qui|
|00002db0| 74 22 0a 58 54 6f 20 65 | 78 69 74 20 66 72 6f 6d |t".XTo e|xit from|
|00002dc0| 20 74 68 65 20 70 72 6f | 67 72 61 6d 2e 0a 58 2e | the pro|gram..X.|
|00002dd0| 52 45 0a 58 2e 49 50 20 | 62 77 0a 58 41 20 62 75 |RE.X.IP |bw.XA bu|
|00002de0| 7a 7a 70 68 61 73 65 20 | 67 65 6e 65 72 61 74 6f |zzphase |generato|
|00002df0| 72 2e 20 20 49 74 73 20 | 66 69 72 73 74 20 61 72 |r. Its |first ar|
|00002e00| 67 75 6d 65 6e 74 20 69 | 73 20 61 20 72 61 6e 64 |gument i|s a rand|
|00002e10| 6f 6d 20 6e 75 6d 62 65 | 72 20 73 65 65 64 2c 20 |om numbe|r seed, |
|00002e20| 0a 58 61 6e 64 20 69 74 | 73 20 73 65 63 6f 6e 64 |.Xand it|s second|
|00002e30| 20 69 73 20 74 68 65 20 | 6e 75 6d 62 65 72 20 6f | is the |number o|
|00002e40| 66 20 70 68 72 61 73 65 | 73 20 69 74 20 73 68 6f |f phrase|s it sho|
|00002e50| 75 6c 64 20 67 65 6e 65 | 72 61 74 65 2e 20 20 54 |uld gene|rate. T|
|00002e60| 68 65 79 0a 58 61 72 65 | 20 77 72 69 74 74 65 6e |hey.Xare| written|
|00002e70| 20 74 6f 20 74 68 65 20 | 73 74 61 6e 64 61 72 64 | to the |standard|
|00002e80| 20 6f 75 74 70 75 74 2c | 20 6f 6e 65 20 70 65 72 | output,| one per|
|00002e90| 20 6c 69 6e 65 2e 0a 58 | 2e 53 48 20 45 58 41 4d | line..X|.SH EXAM|
|00002ea0| 50 4c 45 53 0a 58 2e 6e | 66 0a 58 74 61 62 6c 65 |PLES.X.n|f.Xtable|
|00002eb0| 20 73 69 6d 70 31 2e 74 | 61 62 20 31 30 0a 58 74 | simp1.t|ab 10.Xt|
|00002ec0| 61 62 6c 65 20 6d 75 6c | 74 69 31 2e 74 61 62 20 |able mul|ti1.tab |
|00002ed0| 35 0a 58 74 62 32 74 62 | 6c 20 62 77 32 2e 74 61 |5.Xtb2tb|l bw2.ta|
|00002ee0| 62 20 7c 20 74 62 6c 20 | 7c 20 6e 72 6f 66 66 20 |b | tbl || nroff |
|00002ef0| 2d 6d 65 20 7c 20 63 6f | 6c 20 7c 20 6d 6f 72 65 |-me | co|l | more|
|00002f00| 0a 58 62 77 20 30 20 31 | 30 0a 58 62 77 20 31 30 |.Xbw 0 1|0.Xbw 10|
|00002f10| 20 31 30 0a 58 2e 66 69 | 0a 58 2e 53 48 20 22 53 | 10.X.fi|.X.SH "S|
|00002f20| 45 45 20 41 4c 53 4f 22 | 0a 58 2e 50 50 0a 58 72 |EE ALSO"|.X.PP.Xr|
|00002f30| 61 5f 72 61 6e 64 6f 6d | 28 33 29 2c 20 74 61 62 |a_random|(3), tab|
|00002f40| 6c 65 28 33 29 2e 0a 58 | 2e 53 48 20 22 42 55 47 |le(3)..X|.SH "BUG|
|00002f50| 53 22 0a 58 2e 53 48 20 | 41 55 54 48 4f 52 0a 58 |S".X.SH |AUTHOR.X|
|00002f60| 2e 50 50 0a 58 54 68 65 | 73 65 20 70 72 6f 67 72 |.PP.XThe|se progr|
|00002f70| 61 6d 73 20 77 65 72 65 | 20 77 72 69 74 74 65 6e |ams were| written|
|00002f80| 20 62 79 20 4a 6f 73 68 | 75 61 20 4c 65 76 79 20 | by Josh|ua Levy |
|00002f90| 61 74 20 41 74 68 65 72 | 74 6f 6e 20 54 65 63 68 |at Ather|ton Tech|
|00002fa0| 6e 6f 6c 6f 67 79 2e 0a | 58 2e 62 72 0a 58 6a 6f |nology..|X.br.Xjo|
|00002fb0| 73 68 75 61 40 61 74 68 | 65 72 74 6f 6e 2e 63 6f |shua@ath|erton.co|
|00002fc0| 6d 20 20 20 48 6f 6d 65 | 3a 20 28 34 31 35 29 20 |m Home|: (415) |
|00002fd0| 39 36 38 2d 33 37 31 38 | 20 20 20 57 6f 72 6b 3a |968-3718| Work:|
|00002fe0| 20 28 34 30 38 29 20 37 | 33 34 2d 39 38 32 32 0a | (408) 7|34-9822.|
|00002ff0| 58 2e 49 50 20 22 5c 28 | 63 6f 20 31 39 38 39 20 |X.IP "\(|co 1989 |
|00003000| 4a 6f 73 68 75 61 20 4c | 65 76 79 22 0a 58 54 68 |Joshua L|evy".XTh|
|00003010| 69 73 20 6d 61 6e 20 70 | 61 67 65 20 61 6e 64 20 |is man p|age and |
|00003020| 74 68 65 20 63 6f 64 65 | 20 69 74 20 64 65 73 63 |the code| it desc|
|00003030| 72 69 62 65 73 20 69 73 | 20 63 6f 76 65 72 65 64 |ribes is| covered|
|00003040| 20 62 79 20 74 68 65 20 | 47 4e 55 20 67 65 6e 65 | by the |GNU gene|
|00003050| 72 61 6c 0a 58 70 75 62 | 6c 69 63 20 6c 69 63 65 |ral.Xpub|lic lice|
|00003060| 6e 73 65 2c 20 63 6f 6d | 6d 6f 6e 6c 79 20 63 61 |nse, com|monly ca|
|00003070| 6c 6c 65 64 20 74 68 65 | 20 22 63 6f 70 79 6c 65 |lled the| "copyle|
|00003080| 66 74 22 2e 20 20 49 74 | 20 63 61 6e 20 6f 6e 6c |ft". It| can onl|
|00003090| 79 20 62 65 20 75 73 65 | 64 20 6f 72 0a 58 72 65 |y be use|d or.Xre|
|000030a0| 64 69 73 74 72 69 62 75 | 74 65 64 20 75 6e 64 65 |distribu|ted unde|
|000030b0| 72 20 74 68 65 20 74 65 | 72 6d 73 20 6f 66 20 74 |r the te|rms of t|
|000030c0| 68 61 74 20 61 67 72 65 | 65 6d 65 6e 74 2e 20 20 |hat agre|ement. |
|000030d0| 50 65 72 73 6f 6e 73 20 | 6f 72 20 63 6f 72 70 6f |Persons |or corpo|
|000030e0| 72 61 74 69 6f 6e 73 0a | 58 77 69 73 68 69 6e 67 |rations.|Xwishing|
|000030f0| 20 74 6f 20 75 73 65 20 | 74 68 69 73 20 63 6f 64 | to use |this cod|
|00003100| 65 20 69 6e 20 77 61 79 | 73 20 6e 6f 74 20 61 6c |e in way|s not al|
|00003110| 6c 6f 77 65 64 20 62 79 | 20 74 68 65 20 47 4e 55 |lowed by| the GNU|
|00003120| 20 6c 69 63 65 6e 73 65 | 20 73 68 6f 75 6c 64 20 | license| should |
|00003130| 0a 58 63 6f 6e 74 61 63 | 74 20 74 68 65 20 61 75 |.Xcontac|t the au|
|00003140| 74 68 6f 72 20 74 6f 20 | 64 69 73 63 75 73 73 20 |thor to |discuss |
|00003150| 6f 74 68 65 72 20 6c 69 | 63 65 6e 73 69 6e 67 20 |other li|censing |
|00003160| 61 67 72 65 65 6d 65 6e | 74 73 2e 0a 58 2e 62 72 |agreemen|ts..X.br|
|00003170| 0a 53 48 41 52 5f 45 4f | 46 0a 66 69 0a 69 66 20 |.SHAR_EO|F.fi.if |
|00003180| 74 65 73 74 20 2d 66 20 | 27 4d 61 6b 65 66 69 6c |test -f |'Makefil|
|00003190| 65 27 0a 74 68 65 6e 0a | 09 65 63 68 6f 20 73 68 |e'.then.|.echo sh|
|000031a0| 61 72 3a 20 22 77 69 6c | 6c 20 6e 6f 74 20 6f 76 |ar: "wil|l not ov|
|000031b0| 65 72 2d 77 72 69 74 65 | 20 65 78 69 73 74 69 6e |er-write| existin|
|000031c0| 67 20 66 69 6c 65 20 27 | 4d 61 6b 65 66 69 6c 65 |g file '|Makefile|
|000031d0| 27 22 0a 65 6c 73 65 0a | 73 65 64 20 27 73 2f 5e |'".else.|sed 's/^|
|000031e0| 58 2f 2f 27 20 3c 3c 20 | 5c 53 48 41 52 5f 45 4f |X//' << |\SHAR_EO|
|000031f0| 46 20 3e 20 27 4d 61 6b | 65 66 69 6c 65 27 0a 58 |F > 'Mak|efile'.X|
|00003200| 0a 58 63 6c 65 61 6e 3a | 0a 58 09 72 6d 20 2d 66 |.Xclean:|.X.rm -f|
|00003210| 20 2a 7e 20 2a 2e 62 61 | 6b 20 23 2a 23 0a 53 48 | *~ *.ba|k #*#.SH|
|00003220| 41 52 5f 45 4f 46 0a 66 | 69 0a 69 66 20 74 65 73 |AR_EOF.f|i.if tes|
|00003230| 74 20 2d 66 20 27 74 61 | 62 6c 65 2e 6d 61 6e 27 |t -f 'ta|ble.man'|
|00003240| 0a 74 68 65 6e 0a 09 65 | 63 68 6f 20 73 68 61 72 |.then..e|cho shar|
|00003250| 3a 20 22 77 69 6c 6c 20 | 6e 6f 74 20 6f 76 65 72 |: "will |not over|
|00003260| 2d 77 72 69 74 65 20 65 | 78 69 73 74 69 6e 67 20 |-write e|xisting |
|00003270| 66 69 6c 65 20 27 74 61 | 62 6c 65 2e 6d 61 6e 27 |file 'ta|ble.man'|
|00003280| 22 0a 65 6c 73 65 0a 73 | 65 64 20 27 73 2f 5e 58 |".else.s|ed 's/^X|
|00003290| 2f 2f 27 20 3c 3c 20 5c | 53 48 41 52 5f 45 4f 46 |//' << \|SHAR_EOF|
|000032a0| 20 3e 20 27 74 61 62 6c | 65 2e 6d 61 6e 27 0a 58 | > 'tabl|e.man'.X|
|000032b0| 2e 69 67 20 58 43 0a 58 | 25 20 20 6e 72 6f 66 66 |.ig XC.X|% nroff|
|000032c0| 20 2d 6d 61 6e 20 74 61 | 62 6c 65 2e 6d 61 6e 20 | -man ta|ble.man |
|000032d0| 7c 20 6d 6f 72 65 0a 58 | 25 6e 20 6e 72 6f 66 66 || more.X|%n nroff|
|000032e0| 20 2d 6d 61 6e 20 74 61 | 62 6c 65 2e 6d 61 6e 20 | -man ta|ble.man |
|000032f0| 7c 20 6c 70 72 0a 58 25 | 74 20 70 74 72 6f 66 66 || lpr.X%|t ptroff|
|00003300| 20 2d 6d 61 6e 20 74 61 | 62 6c 65 2e 6d 61 6e 20 | -man ta|ble.man |
|00003310| 2d 50 6c 77 0a 58 2e 58 | 43 0a 58 2e 54 48 20 54 |-Plw.X.X|C.X.TH T|
|00003320| 41 42 4c 45 20 33 20 22 | 46 65 62 20 32 32 74 68 |ABLE 3 "|Feb 22th|
|00003330| 20 31 39 39 30 22 0a 58 | 2e 53 48 20 4e 41 4d 45 | 1990".X|.SH NAME|
|00003340| 20 0a 58 74 61 62 6c 65 | 20 5c 2d 20 74 61 62 6c | .Xtable| \- tabl|
|00003350| 65 20 68 61 6e 64 6c 69 | 6e 67 20 72 6f 75 74 69 |e handli|ng routi|
|00003360| 6e 65 73 20 66 6f 72 20 | 72 6f 6c 65 20 70 6c 61 |nes for |role pla|
|00003370| 79 69 6e 67 20 61 6e 64 | 20 63 6f 6d 70 75 74 65 |ying and| compute|
|00003380| 72 20 67 61 6d 65 73 0a | 58 2e 53 48 20 53 59 4e |r games.|X.SH SYN|
|00003390| 4f 50 53 49 53 0a 58 2e | 6e 66 0a 58 23 69 6e 63 |OPSIS.X.|nf.X#inc|
|000033a0| 6c 75 64 65 20 22 74 61 | 62 6c 65 2e 68 22 0a 58 |lude "ta|ble.h".X|
|000033b0| 0a 58 69 6e 74 20 74 62 | 5f 72 65 61 64 28 66 69 |.Xint tb|_read(fi|
|000033c0| 6c 65 6e 61 6d 65 2c 74 | 61 62 6c 65 29 20 63 68 |lename,t|able) ch|
|000033d0| 61 72 20 2a 66 69 6c 65 | 6e 61 6d 65 20 3b 20 74 |ar *file|name ; t|
|000033e0| 61 62 6c 65 5f 74 20 2a | 2a 74 61 62 6c 65 20 3b |able_t *|*table ;|
|000033f0| 20 0a 58 0a 58 69 6e 74 | 20 74 62 5f 75 73 65 28 | .X.Xint| tb_use(|
|00003400| 74 61 62 6c 65 2c 2e 2e | 2e 2c 72 65 73 75 6c 74 |table,..|.,result|
|00003410| 29 20 74 61 62 6c 65 5f | 74 20 2a 74 61 62 6c 65 |) table_|t *table|
|00003420| 20 3b 20 2e 2e 2e 20 63 | 68 61 72 20 2a 2a 72 65 | ; ... c|har **re|
|00003430| 73 75 6c 74 20 3b 0a 58 | 0a 58 69 6e 74 20 74 62 |sult ;.X|.Xint tb|
|00003440| 5f 70 72 69 6e 74 28 74 | 61 62 6c 65 2c 66 69 6c |_print(t|able,fil|
|00003450| 65 6e 61 6d 65 2c 77 61 | 79 29 20 74 61 62 6c 65 |ename,wa|y) table|
|00003460| 5f 74 20 2a 74 61 62 6c | 65 20 3b 20 63 68 61 72 |_t *tabl|e ; char|
|00003470| 20 2a 66 69 6c 65 6e 61 | 6d 65 20 3b 20 69 6e 74 | *filena|me ; int|
|00003480| 20 77 61 79 20 3b 0a 58 | 0a 58 69 6e 74 20 74 62 | way ;.X|.Xint tb|
|00003490| 5f 6d 61 6e 79 28 74 61 | 62 6c 65 2c 6e 75 6d 2c |_many(ta|ble,num,|
|000034a0| 2e 2e 2e 2c 72 65 73 75 | 6c 74 29 20 74 61 62 6c |...,resu|lt) tabl|
|000034b0| 65 5f 74 20 2a 74 61 62 | 6c 65 20 3b 20 69 6e 74 |e_t *tab|le ; int|
|000034c0| 20 6e 75 6d 20 3b 20 2e | 2e 2e 20 63 68 61 72 20 | num ; .|.. char |
|000034d0| 2a 2a 72 65 73 75 6c 74 | 20 3b 20 0a 58 69 6e 74 |**result| ; .Xint|
|000034e0| 20 74 62 5f 66 72 65 65 | 28 74 61 62 6c 65 29 20 | tb_free|(table) |
|000034f0| 74 61 62 6c 65 5f 74 20 | 2a 74 61 62 6c 65 20 3b |table_t |*table ;|
|00003500| 20 0a 58 0a 58 69 6e 74 | 20 74 62 5f 71 75 65 72 | .X.Xint| tb_quer|
|00003510| 79 28 74 61 62 6c 65 2c | 71 75 65 72 79 2c 72 65 |y(table,|query,re|
|00003520| 73 75 6c 74 29 20 74 61 | 62 6c 65 5f 74 20 2a 74 |sult) ta|ble_t *t|
|00003530| 61 62 6c 65 20 3b 20 69 | 6e 74 20 71 75 65 72 79 |able ; i|nt query|
|00003540| 20 3b 20 69 6e 74 20 2a | 72 65 73 75 6c 74 20 3b | ; int *|result ;|
|00003550| 0a 58 2e 66 69 0a 58 2e | 53 48 20 44 45 53 43 52 |.X.fi.X.|SH DESCR|
|00003560| 49 50 54 49 4f 4e 0a 58 | 2e 49 50 20 74 62 5f 72 |IPTION.X|.IP tb_r|
|00003570| 65 61 64 0a 58 47 69 76 | 65 6e 20 61 20 70 6f 69 |ead.XGiv|en a poi|
|00003580| 6e 74 65 72 20 74 6f 20 | 61 20 70 6f 69 6e 74 65 |nter to |a pointe|
|00003590| 72 20 74 6f 20 61 20 74 | 61 62 6c 65 2c 20 61 6e |r to a t|able, an|
|000035a0| 64 20 74 68 65 20 6e 61 | 6d 65 20 6f 66 20 61 20 |d the na|me of a |
|000035b0| 66 69 6c 65 2c 20 74 68 | 69 73 20 0a 58 72 6f 75 |file, th|is .Xrou|
|000035c0| 74 69 6e 65 20 72 65 61 | 64 73 20 74 68 65 20 74 |tine rea|ds the t|
|000035d0| 65 78 74 20 72 65 70 72 | 65 73 65 6e 74 61 74 69 |ext repr|esentati|
|000035e0| 6f 6e 20 6f 66 20 61 20 | 74 61 62 6c 65 20 69 6e |on of a |table in|
|000035f0| 74 6f 20 74 68 65 20 74 | 61 62 6c 65 20 76 61 72 |to the t|able var|
|00003600| 69 61 62 6c 65 2c 0a 58 | 75 73 69 6e 67 20 6d 61 |iable,.X|using ma|
|00003610| 6c 6c 6f 63 28 33 29 20 | 74 6f 20 61 6c 6c 6f 63 |lloc(3) |to alloc|
|00003620| 61 74 65 20 6d 65 6d 6f | 72 79 20 61 73 20 6e 65 |ate memo|ry as ne|
|00003630| 65 64 65 64 2e 0a 58 2e | 49 50 20 74 62 5f 75 73 |eded..X.|IP tb_us|
|00003640| 65 0a 58 47 69 76 65 6e | 20 61 20 70 6f 6e 69 74 |e.XGiven| a ponit|
|00003650| 65 72 20 74 6f 20 61 20 | 74 61 62 6c 65 2c 20 61 |er to a |table, a|
|00003660| 20 70 6f 69 6e 74 65 72 | 20 74 6f 20 61 20 70 6f | pointer| to a po|
|00003670| 69 6e 74 65 72 20 74 6f | 20 63 68 61 72 61 63 74 |inter to| charact|
|00003680| 65 72 73 2c 20 61 6e 64 | 0a 58 28 6f 70 74 69 6f |ers, and|.X(optio|
|00003690| 6e 61 6c 6c 79 29 20 6f | 74 68 65 72 20 61 72 67 |nally) o|ther arg|
|000036a0| 75 6d 65 6e 74 73 2c 20 | 74 68 69 73 20 72 6f 75 |uments, |this rou|
|000036b0| 74 69 6e 65 20 75 73 65 | 73 20 74 68 65 20 74 61 |tine use|s the ta|
|000036c0| 62 6c 65 20 61 6e 64 20 | 61 20 72 61 6e 64 6f 6d |ble and |a random|
|000036d0| 0a 58 6e 75 6d 62 65 72 | 20 67 65 6e 65 72 61 74 |.Xnumber| generat|
|000036e0| 6f 72 20 74 6f 20 22 72 | 6f 6c 6c 22 20 6f 6e 20 |or to "r|oll" on |
|000036f0| 74 68 65 20 74 61 62 6c | 65 2e 20 20 54 68 65 20 |the tabl|e. The |
|00003700| 6e 75 6d 62 65 72 20 61 | 6e 64 20 74 79 70 65 20 |number a|nd type |
|00003710| 6f 66 20 6f 70 74 69 6f | 6e 61 6c 0a 58 61 72 67 |of optio|nal.Xarg|
|00003720| 75 6d 65 6e 74 73 20 64 | 65 70 65 6e 64 73 20 6f |uments d|epends o|
|00003730| 6e 20 74 68 65 20 74 79 | 70 65 20 6f 66 20 74 61 |n the ty|pe of ta|
|00003740| 62 6c 65 20 62 65 69 6e | 67 20 75 73 65 64 2e 20 |ble bein|g used. |
|00003750| 20 53 69 6d 70 6c 65 20 | 74 61 62 6c 65 73 0a 58 | Simple |tables.X|
|00003760| 72 65 71 75 69 72 65 20 | 6e 6f 20 65 78 74 72 61 |require |no extra|
|00003770| 20 61 72 67 75 6d 65 6e | 74 73 2c 20 62 75 74 20 | argumen|ts, but |
|00003780| 6d 75 6c 74 69 20 61 6e | 64 20 63 68 61 6e 67 65 |multi an|d change|
|00003790| 20 74 61 62 6c 65 73 20 | 72 65 71 75 69 72 65 20 | tables |require |
|000037a0| 61 20 0a 58 73 74 72 69 | 6e 67 20 77 68 69 63 68 |a .Xstri|ng which|
|000037b0| 20 64 65 74 65 72 6d 69 | 6e 65 73 20 77 68 69 63 | determi|nes whic|
|000037c0| 68 20 63 6f 6c 75 6d 6e | 20 6f 6e 20 74 68 65 20 |h column| on the |
|000037d0| 74 61 62 6c 65 20 74 6f | 20 75 73 65 2e 20 20 46 |table to| use. F|
|000037e0| 6f 72 20 65 78 61 6d 70 | 6c 65 3a 0a 58 0a 58 2e |or examp|le:.X.X.|
|000037f0| 6e 66 0a 58 74 61 62 6c | 65 5f 74 20 2a 66 6f 6f |nf.Xtabl|e_t *foo|
|00003800| 20 3b 0a 58 63 68 61 72 | 20 2a 72 65 73 75 6c 74 | ;.Xchar| *result|
|00003810| 20 3b 0a 58 74 62 5f 75 | 73 65 28 66 6f 6f 2c 26 | ;.Xtb_u|se(foo,&|
|00003820| 72 65 73 75 6c 74 29 20 | 3b 20 20 20 20 20 20 20 |result) |; |
|00003830| 20 20 20 20 2f 2a 20 61 | 73 73 75 6d 65 73 20 66 | /* a|ssumes f|
|00003840| 6f 6f 20 69 73 20 61 20 | 73 69 6d 70 6c 65 20 74 |oo is a |simple t|
|00003850| 61 62 6c 65 20 2a 2f 0a | 58 74 62 5f 75 73 65 28 |able */.|Xtb_use(|
|00003860| 66 6f 6f 2c 22 63 6f 6c | 75 6d 6e 31 22 2c 26 72 |foo,"col|umn1",&r|
|00003870| 65 73 75 6c 74 29 20 3b | 20 2f 2a 20 61 73 73 75 |esult) ;| /* assu|
|00003880| 6d 65 73 20 66 6f 6f 20 | 69 73 20 61 20 6d 75 6c |mes foo |is a mul|
|00003890| 74 69 20 74 61 62 6c 65 | 20 2a 2f 0a 58 74 62 5f |ti table| */.Xtb_|
|000038a0| 75 73 65 28 66 6f 6f 2c | 22 63 6f 6c 75 6d 6e 31 |use(foo,|"column1|
|000038b0| 22 2c 26 72 65 73 75 6c | 74 29 20 3b 20 2f 2a 20 |",&resul|t) ; /* |
|000038c0| 61 73 73 75 6d 65 73 20 | 66 6f 6f 20 69 73 20 61 |assumes |foo is a|
|000038d0| 20 63 68 61 6e 67 65 20 | 74 61 62 6c 65 20 2a 2f | change |table */|
|000038e0| 0a 58 2e 66 69 0a 58 0a | 58 4e 6f 74 65 20 74 68 |.X.fi.X.|XNote th|
|000038f0| 61 74 20 74 68 65 20 72 | 65 73 75 6c 74 20 70 6f |at the r|esult po|
|00003900| 69 6e 74 73 20 61 74 20 | 61 20 73 74 61 74 69 63 |ints at |a static|
|00003910| 20 62 75 66 66 65 72 2c | 20 77 68 69 63 68 20 6d | buffer,| which m|
|00003920| 75 73 74 20 6e 6f 74 20 | 62 65 20 63 68 61 6e 67 |ust not |be chang|
|00003930| 65 64 0a 58 61 6e 64 20 | 77 68 69 63 68 20 6d 61 |ed.Xand |which ma|
|00003940| 79 20 64 69 73 61 70 70 | 65 61 72 20 64 75 72 69 |y disapp|ear duri|
|00003950| 6e 67 20 74 68 65 20 6e | 65 78 74 20 74 62 5f 75 |ng the n|ext tb_u|
|00003960| 73 65 20 63 61 6c 6c 2e | 20 20 0a 58 2e 49 50 20 |se call.| .X.IP |
|00003970| 74 62 5f 70 72 69 6e 74 | 0a 58 47 69 76 65 6e 20 |tb_print|.XGiven |
|00003980| 61 20 70 6f 69 6e 74 65 | 72 20 74 6f 20 61 20 74 |a pointe|r to a t|
|00003990| 61 62 6c 65 20 61 6e 64 | 20 61 20 66 69 6c 65 20 |able and| a file |
|000039a0| 6e 61 6d 65 2c 20 74 68 | 69 73 20 72 6f 75 74 69 |name, th|is routi|
|000039b0| 6e 65 20 70 72 69 6e 74 | 73 20 6f 75 74 20 61 0a |ne print|s out a.|
|000039c0| 58 63 6f 70 79 20 6f 66 | 20 74 68 65 20 66 69 6c |Xcopy of| the fil|
|000039d0| 65 2e 20 20 54 68 65 20 | 74 68 69 72 64 20 61 72 |e. The |third ar|
|000039e0| 67 75 6d 65 6e 74 20 64 | 65 74 65 72 6d 69 6e 65 |gument d|etermine|
|000039f0| 73 20 74 68 65 20 66 6f | 72 6d 20 74 68 65 20 74 |s the fo|rm the t|
|00003a00| 61 62 6c 65 20 69 73 0a | 58 70 72 69 6e 74 65 64 |able is.|Xprinted|
|00003a10| 20 6f 75 74 20 69 6e 2e | 20 20 52 69 67 68 74 20 | out in.| Right |
|00003a20| 6e 6f 77 2c 20 31 20 70 | 72 69 6e 74 73 20 69 74 |now, 1 p|rints it|
|00003a30| 20 6f 75 74 20 69 6e 20 | 74 72 6f 66 66 2f 74 62 | out in |troff/tb|
|00003a40| 6c 20 66 6f 72 6d 61 74 | 2c 20 61 6e 64 0a 58 30 |l format|, and.X0|
|00003a50| 20 69 73 20 72 65 73 65 | 72 76 65 64 20 66 6f 72 | is rese|rved for|
|00003a60| 20 66 75 74 75 72 65 20 | 77 6f 72 6b 2e 20 20 54 | future |work. T|
|00003a70| 68 69 73 20 72 6f 75 74 | 69 6e 65 20 69 73 20 75 |his rout|ine is u|
|00003a80| 73 65 66 75 6c 20 66 6f | 72 20 64 65 62 75 67 67 |seful fo|r debugg|
|00003a90| 69 6e 67 2c 20 61 73 0a | 58 77 65 6c 6c 20 61 73 |ing, as.|Xwell as|
|00003aa0| 20 74 6f 20 67 65 6e 65 | 72 61 74 65 20 64 6f 63 | to gene|rate doc|
|00003ab0| 75 6d 65 6e 74 61 74 69 | 6f 6e 2e 0a 58 2e 49 50 |umentati|on..X.IP|
|00003ac0| 20 74 62 5f 6d 61 6e 79 | 0a 58 54 68 69 73 20 72 | tb_many|.XThis r|
|00003ad0| 6f 75 74 69 6e 65 20 69 | 73 20 73 69 6d 69 6c 61 |outine i|s simila|
|00003ae0| 72 20 74 6f 20 74 62 5f | 75 73 65 2c 20 65 78 65 |r to tb_|use, exe|
|00003af0| 63 70 74 20 74 68 61 74 | 20 69 74 20 72 65 74 75 |cpt that| it retu|
|00003b00| 72 6e 73 20 73 65 76 65 | 72 61 6c 20 72 6f 6c 6c |rns seve|ral roll|
|00003b10| 73 0a 58 66 72 6f 6d 20 | 74 68 65 20 74 61 62 6c |s.Xfrom |the tabl|
|00003b20| 65 20 77 68 69 63 68 20 | 61 72 65 20 64 69 66 66 |e which |are diff|
|00003b30| 65 72 65 6e 74 2e 20 20 | 54 68 65 20 65 78 74 72 |erent. |The extr|
|00003b40| 61 20 61 72 67 75 6d 65 | 6e 74 20 60 60 6e 75 6d |a argume|nt ``num|
|00003b50| 27 27 20 69 73 20 74 68 | 65 0a 58 6e 75 6d 62 65 |'' is th|e.Xnumbe|
|00003b60| 72 20 6f 66 20 72 6f 6c | 6c 73 2e 20 20 54 68 65 |r of rol|ls. The|
|00003b70| 20 72 65 73 75 6c 74 20 | 73 68 6f 75 6c 64 20 62 | result |should b|
|00003b80| 65 20 61 6e 20 61 72 72 | 61 79 20 6f 66 20 63 68 |e an arr|ay of ch|
|00003b90| 61 72 61 63 74 65 72 20 | 70 6f 69 6e 74 65 72 73 |aracter |pointers|
|00003ba0| 0a 58 6c 61 72 67 65 20 | 65 6e 6f 75 67 68 20 74 |.Xlarge |enough t|
|00003bb0| 6f 20 68 6f 6c 64 20 61 | 6c 6c 20 74 68 65 20 61 |o hold a|ll the a|
|00003bc0| 6e 73 77 65 72 73 2e 20 | 20 0a 58 2e 49 50 20 74 |nswers. | .X.IP t|
|00003bd0| 62 5f 66 72 65 65 0a 58 | 47 69 76 65 6e 20 61 20 |b_free.X|Given a |
|00003be0| 70 6f 69 6e 74 65 72 20 | 74 6f 20 61 20 74 61 62 |pointer |to a tab|
|00003bf0| 6c 65 2c 20 74 68 69 73 | 20 72 6f 75 74 69 6e 65 |le, this| routine|
|00003c00| 73 20 66 72 65 65 73 20 | 74 68 65 20 73 70 61 63 |s frees |the spac|
|00003c10| 65 20 61 73 73 6f 63 69 | 61 74 65 64 20 0a 58 77 |e associ|ated .Xw|
|00003c20| 69 74 68 20 74 68 65 20 | 74 61 62 6c 65 2e 20 20 |ith the |table. |
|00003c30| 41 66 74 65 72 20 63 61 | 6c 6c 69 6e 67 20 74 68 |After ca|lling th|
|00003c40| 69 73 20 72 6f 75 74 69 | 6e 65 20 74 68 65 20 6f |is routi|ne the o|
|00003c50| 6e 6c 79 20 66 75 6e 63 | 74 69 6f 6e 20 63 61 6c |nly func|tion cal|
|00003c60| 6c 20 77 68 69 63 68 0a | 58 69 73 20 6c 65 67 61 |l which.|Xis lega|
|00003c70| 6c 20 6f 6e 20 74 68 65 | 20 74 61 62 6c 65 20 69 |l on the| table i|
|00003c80| 73 20 74 62 5f 72 65 61 | 64 2e 20 20 54 68 69 73 |s tb_rea|d. This|
|00003c90| 20 72 6f 75 74 69 6e 65 | 20 63 61 6c 6c 73 20 66 | routine| calls f|
|00003ca0| 72 65 65 28 33 29 2e 0a | 58 2e 49 50 20 74 62 5f |ree(3)..|X.IP tb_|
|00003cb0| 71 75 65 72 79 0a 58 47 | 69 76 65 6e 20 61 20 70 |query.XG|iven a p|
|00003cc0| 6f 69 6e 74 65 72 20 74 | 6f 20 61 20 74 61 62 6c |ointer t|o a tabl|
|00003cd0| 65 2c 20 61 6e 64 20 61 | 20 71 75 65 73 74 69 6f |e, and a| questio|
|00003ce0| 6e 20 61 62 6f 75 74 20 | 74 68 61 74 20 74 61 62 |n about |that tab|
|00003cf0| 6c 65 2c 20 72 65 73 75 | 6c 74 20 77 69 6c 6c 0a |le, resu|lt will.|
|00003d00| 58 62 65 20 66 69 6c 6c | 65 64 20 77 69 74 68 20 |Xbe fill|ed with |
|00003d10| 74 68 65 20 61 6e 73 77 | 65 72 20 74 6f 20 74 68 |the answ|er to th|
|00003d20| 65 20 71 75 65 73 74 69 | 6f 6e 2e 20 20 43 75 72 |e questi|on. Cur|
|00003d30| 72 65 6e 74 6c 79 20 73 | 75 70 70 6f 72 74 65 64 |rently s|upported|
|00003d40| 20 71 75 65 72 69 65 73 | 20 0a 58 69 6e 63 6c 75 | queries| .Xinclu|
|00003d50| 64 65 3a 0a 58 2e 52 53 | 0a 58 2e 49 50 20 54 42 |de:.X.RS|.X.IP TB|
|00003d60| 5f 51 5f 4d 41 58 0a 58 | 52 65 74 75 72 6e 73 20 |_Q_MAX.X|Returns |
|00003d70| 74 68 65 20 6c 61 72 67 | 65 73 74 20 72 6f 6c 6c |the larg|est roll|
|00003d80| 20 77 68 69 63 68 20 63 | 61 6e 20 62 65 20 6d 61 | which c|an be ma|
|00003d90| 64 65 20 6f 6e 20 74 68 | 69 73 20 74 61 62 6c 65 |de on th|is table|
|00003da0| 2e 0a 58 2e 49 50 20 54 | 42 5f 51 5f 4d 49 4e 0a |..X.IP T|B_Q_MIN.|
|00003db0| 58 52 65 74 75 72 6e 73 | 20 74 68 65 20 73 6d 61 |XReturns| the sma|
|00003dc0| 6c 6c 65 73 74 20 72 6f | 6c 6c 20 77 68 69 63 68 |llest ro|ll which|
|00003dd0| 20 63 61 6e 20 62 65 20 | 6d 61 64 65 20 6f 6e 20 | can be |made on |
|00003de0| 74 68 69 73 20 74 61 62 | 6c 65 2e 0a 58 2e 49 50 |this tab|le..X.IP|
|00003df0| 20 54 42 5f 51 5f 41 56 | 45 0a 58 52 65 74 75 72 | TB_Q_AV|E.XRetur|
|00003e00| 6e 73 20 74 68 65 20 61 | 76 65 72 61 67 65 20 72 |ns the a|verage r|
|00003e10| 6f 6c 6c 20 6d 61 64 65 | 20 6f 6e 20 74 68 69 73 |oll made| on this|
|00003e20| 20 74 61 62 6c 65 2e 0a | 58 2e 52 45 0a 58 2e 62 | table..|X.RE.X.b|
|00003e30| 70 0a 58 2e 53 48 20 22 | 54 41 42 4c 45 20 54 59 |p.X.SH "|TABLE TY|
|00003e40| 50 45 53 22 0a 58 2e 50 | 50 0a 58 54 68 69 73 20 |PES".X.P|P.XThis |
|00003e50| 70 61 63 6b 61 67 65 20 | 73 75 70 70 6f 72 74 20 |package |support |
|00003e60| 73 65 76 65 72 61 6c 20 | 64 69 66 66 65 72 65 6e |several |differen|
|00003e70| 74 20 74 79 70 65 73 20 | 6f 66 20 74 61 62 6c 65 |t types |of table|
|00003e80| 73 2c 20 61 6e 64 20 6e | 65 77 20 74 79 70 65 73 |s, and n|ew types|
|00003e90| 20 0a 58 63 61 6e 20 62 | 65 20 61 64 64 65 64 20 | .Xcan b|e added |
|00003ea0| 77 69 74 68 20 61 20 72 | 65 63 6f 6d 70 69 6c 65 |with a r|ecompile|
|00003eb0| 20 28 73 65 65 20 74 68 | 65 20 6d 61 6e 20 70 61 | (see th|e man pa|
|00003ec0| 67 65 20 6f 6e 20 74 61 | 62 6c 65 2d 61 64 64 29 |ge on ta|ble-add)|
|00003ed0| 2e 20 20 48 65 72 65 0a | 58 69 73 20 61 20 64 65 |. Here.|Xis a de|
|00003ee0| 73 63 72 69 70 74 69 6f | 6e 20 6f 66 20 61 6c 6c |scriptio|n of all|
|00003ef0| 20 6f 66 20 74 68 65 20 | 74 61 62 6c 65 20 74 79 | of the |table ty|
|00003f00| 70 65 73 20 77 68 69 63 | 68 20 61 72 65 20 63 75 |pes whic|h are cu|
|00003f10| 72 72 65 6e 74 6c 79 20 | 73 75 70 70 6f 72 74 65 |rrently |supporte|
|00003f20| 64 2e 0a 58 2e 49 50 20 | 22 53 69 6d 70 6c 65 22 |d..X.IP |"Simple"|
|00003f30| 0a 58 54 68 69 73 20 69 | 73 20 74 68 65 20 73 69 |.XThis i|s the si|
|00003f40| 6d 70 6c 65 73 74 20 66 | 6f 72 6d 20 6f 66 20 74 |mplest f|orm of t|
|00003f50| 61 62 6c 65 2e 20 20 49 | 74 20 69 73 20 61 20 6c |able. I|t is a l|
|00003f60| 69 73 74 20 6f 66 20 72 | 6f 6c 6c 73 20 61 6e 64 |ist of r|olls and|
|00003f70| 20 74 68 65 20 72 65 73 | 75 6c 74 73 0a 58 66 6f | the res|ults.Xfo|
|00003f80| 72 20 65 61 63 68 20 72 | 6f 6c 6c 2e 20 20 41 6e |r each r|oll. An|
|00003f90| 20 65 78 61 6d 70 6c 65 | 20 77 6f 75 6c 64 20 62 | example| would b|
|00003fa0| 65 20 61 20 74 61 62 6c | 65 20 6f 66 20 70 6f 73 |e a tabl|e of pos|
|00003fb0| 73 69 62 6c 65 20 72 61 | 63 65 73 20 66 6f 72 20 |sible ra|ces for |
|00003fc0| 4e 50 43 73 2c 20 6f 72 | 0a 58 61 20 6c 69 73 74 |NPCs, or|.Xa list|
|00003fd0| 20 6f 66 20 70 6f 73 73 | 69 62 6c 65 20 68 6f 6d | of poss|ible hom|
|00003fe0| 65 20 74 6f 77 6e 73 2e | 0a 58 2e 49 50 20 22 4d |e towns.|.X.IP "M|
|00003ff0| 75 6c 74 69 70 6c 65 22 | 0a 58 54 68 65 73 65 20 |ultiple"|.XThese |
|00004000| 74 61 62 6c 65 73 20 63 | 6f 6e 74 61 69 6e 20 6f |tables c|ontain o|
|00004010| 6e 65 20 63 6f 6c 75 6d | 6e 20 66 6f 72 20 74 68 |ne colum|n for th|
|00004020| 65 20 64 69 63 65 20 72 | 6f 6c 6c 2c 20 62 75 74 |e dice r|oll, but|
|00004030| 20 73 65 76 65 72 61 6c | 20 63 6f 6c 75 6d 6e 73 | several| columns|
|00004040| 20 0a 58 65 61 63 68 20 | 6f 66 20 77 68 69 63 68 | .Xeach |of which|
|00004050| 20 63 6f 6e 74 61 69 6e | 73 20 61 20 72 65 73 75 | contain|s a resu|
|00004060| 6c 74 20 69 6e 20 64 69 | 66 66 65 72 65 6e 74 20 |lt in di|fferent |
|00004070| 73 69 74 75 61 74 69 6f | 6e 73 2e 20 20 41 6e 20 |situatio|ns. An |
|00004080| 65 78 61 6d 70 6c 65 0a | 58 6d 69 67 68 74 20 62 |example.|Xmight b|
|00004090| 65 20 61 20 50 43 20 68 | 69 67 68 74 20 74 61 62 |e a PC h|ight tab|
|000040a0| 6c 65 2c 20 77 69 74 68 | 20 64 69 66 66 65 72 65 |le, with| differe|
|000040b0| 6e 74 20 63 6f 6c 75 6d | 6e 73 20 66 6f 72 20 65 |nt colum|ns for e|
|000040c0| 61 63 68 20 72 61 63 65 | 2e 20 20 4f 72 20 61 0a |ach race|. Or a.|
|000040d0| 58 79 65 61 72 6c 79 20 | 69 6e 63 6f 6d 65 20 74 |Xyearly |income t|
|000040e0| 61 62 6c 65 2c 20 77 69 | 74 68 20 64 69 66 66 65 |able, wi|th diffe|
|000040f0| 72 65 6e 74 20 63 6f 6c | 75 6d 6e 73 20 66 6f 72 |rent col|umns for|
|00004100| 20 65 61 63 68 20 63 6c | 61 73 73 2e 20 20 57 68 | each cl|ass. Wh|
|00004110| 65 6e 20 75 73 69 6e 67 | 0a 58 74 68 65 73 65 20 |en using|.Xthese |
|00004120| 74 61 62 6c 65 73 2c 20 | 79 6f 75 20 6d 75 73 74 |tables, |you must|
|00004130| 20 73 70 65 63 69 66 79 | 20 77 68 69 63 68 20 63 | specify| which c|
|00004140| 6f 6c 75 6d 6e 20 69 73 | 20 69 6d 70 6f 72 74 61 |olumn is| importa|
|00004150| 6e 74 2e 0a 58 2e 49 50 | 20 22 53 69 6d 70 6c 65 |nt..X.IP| "Simple|
|00004160| 42 69 67 22 0a 58 54 68 | 69 73 20 74 61 62 6c 65 |Big".XTh|is table|
|00004170| 20 69 73 20 76 65 72 79 | 20 73 69 6d 69 6c 61 72 | is very| similar|
|00004180| 20 74 6f 20 74 68 65 20 | 73 69 6d 70 6c 65 20 74 | to the |simple t|
|00004190| 61 62 6c 65 2e 20 20 54 | 68 65 20 64 69 66 66 65 |able. T|he diffe|
|000041a0| 72 65 6e 63 65 20 69 73 | 20 69 6e 0a 58 66 6f 72 |rence is| in.Xfor|
|000041b0| 6d 61 74 74 69 6e 67 2e | 20 20 54 68 69 73 20 74 |matting.| This t|
|000041c0| 61 62 6c 65 20 69 73 20 | 64 65 73 69 67 6e 65 64 |able is |designed|
|000041d0| 20 74 6f 20 72 65 74 75 | 72 6e 20 6c 61 72 67 65 | to retu|rn large|
|000041e0| 20 63 68 75 6e 63 6b 73 | 20 6f 66 20 74 65 78 74 | chuncks| of text|
|000041f0| 2c 0a 58 6c 69 6b 65 20 | 73 65 6e 74 65 6e 63 65 |,.Xlike |sentence|
|00004200| 73 20 61 6e 64 20 70 61 | 72 61 67 72 61 70 68 73 |s and pa|ragraphs|
|00004210| 2e 20 20 54 68 65 20 73 | 69 6d 70 6c 65 20 74 61 |. The s|imple ta|
|00004220| 62 6c 65 73 20 61 72 65 | 20 64 65 73 69 67 6e 65 |bles are| designe|
|00004230| 64 20 74 6f 20 72 65 74 | 75 72 6e 0a 58 77 6f 72 |d to ret|urn.Xwor|
|00004240| 64 73 20 6f 72 20 6c 69 | 6e 65 73 2e 0a 58 2e 62 |ds or li|nes..X.b|
|00004250| 70 0a 58 2e 53 48 20 22 | 46 49 4c 45 20 46 4f 52 |p.X.SH "|FILE FOR|
|00004260| 4d 41 54 53 22 0a 58 2e | 50 50 0a 58 54 68 65 20 |MATS".X.|PP.XThe |
|00004270| 66 69 6c 65 73 20 72 65 | 61 64 20 62 79 20 74 62 |files re|ad by tb|
|00004280| 5f 72 65 61 64 20 6d 75 | 73 74 20 62 65 20 66 6f |_read mu|st be fo|
|00004290| 72 6d 61 74 74 65 64 20 | 63 6f 72 72 65 63 74 6c |rmatted |correctl|
|000042a0| 79 2e 20 20 54 68 65 20 | 66 6f 72 6d 61 74 20 66 |y. The |format f|
|000042b0| 6f 72 0a 58 65 61 63 68 | 20 74 79 70 65 20 6f 66 |or.Xeach| type of|
|000042c0| 20 74 61 62 6c 65 20 28 | 73 69 6d 70 6c 65 2c 20 | table (|simple, |
|000042d0| 6d 75 6c 74 69 2c 20 65 | 74 63 2e 29 20 69 73 20 |multi, e|tc.) is |
|000042e0| 64 69 66 66 65 72 65 6e | 74 2c 20 62 75 74 20 74 |differen|t, but t|
|000042f0| 68 65 20 66 69 72 73 74 | 0a 58 6c 69 6e 65 20 69 |he first|.Xline i|
|00004300| 73 20 61 6c 77 61 79 73 | 20 74 68 65 20 73 61 6d |s always| the sam|
|00004310| 65 3a 20 20 74 68 65 20 | 6e 61 6d 65 20 6f 66 20 |e: the |name of |
|00004320| 74 68 65 20 74 61 62 6c | 65 20 66 6f 6c 6c 6f 77 |the tabl|e follow|
|00004330| 65 64 20 62 79 20 69 74 | 73 20 74 79 70 65 2e 0a |ed by it|s type..|
|00004340| 58 2e 50 50 0a 58 53 69 | 6d 70 6c 65 20 74 61 62 |X.PP.XSi|mple tab|
|00004350| 6c 65 73 20 68 61 76 65 | 20 61 20 6c 69 6e 65 20 |les have| a line |
|00004360| 77 69 74 68 20 74 68 65 | 20 74 79 70 65 20 6f 66 |with the| type of|
|00004370| 20 72 6f 6c 6c 20 74 6f | 20 6d 61 6b 65 20 61 6e | roll to| make an|
|00004380| 64 20 74 68 65 20 6e 75 | 6d 62 65 72 0a 58 6f 66 |d the nu|mber.Xof|
|00004390| 20 72 6f 77 73 20 69 6e | 20 74 68 65 20 74 61 62 | rows in| the tab|
|000043a0| 6c 65 2c 20 73 65 70 65 | 72 61 74 65 64 20 62 79 |le, sepe|rated by|
|000043b0| 20 61 20 74 61 62 2e 20 | 20 54 68 65 20 74 68 69 | a tab. | The thi|
|000043c0| 72 64 20 6c 69 6e 65 20 | 69 73 20 74 68 65 20 73 |rd line |is the s|
|000043d0| 6f 75 72 63 65 0a 58 6f | 66 20 74 68 65 20 74 61 |ource.Xo|f the ta|
|000043e0| 62 6c 65 2e 20 20 54 68 | 65 20 66 6f 75 72 74 68 |ble. Th|e fourth|
|000043f0| 2c 20 61 6e 64 20 61 6c | 6c 20 66 6f 6c 6c 6f 77 |, and al|l follow|
|00004400| 69 6e 67 20 6c 69 6e 65 | 73 2c 20 61 72 65 20 72 |ing line|s, are r|
|00004410| 6f 77 73 20 6f 66 20 74 | 68 65 20 74 61 62 6c 65 |ows of t|he table|
|00004420| 2c 0a 58 65 61 63 68 20 | 72 6f 77 20 63 6f 6e 74 |,.Xeach |row cont|
|00004430| 61 69 6e 73 20 61 20 6e | 75 6d 62 65 72 20 28 6f |ains a n|umber (o|
|00004440| 72 20 74 77 6f 20 6e 75 | 6d 62 65 72 73 20 73 65 |r two nu|mbers se|
|00004450| 70 65 72 61 74 65 64 20 | 62 79 20 61 20 64 61 73 |perated |by a das|
|00004460| 68 29 20 66 6f 6c 6c 6f | 77 65 64 0a 58 62 79 20 |h) follo|wed.Xby |
|00004470| 61 20 74 61 62 2c 20 61 | 6e 64 20 74 68 65 20 72 |a tab, a|nd the r|
|00004480| 65 73 75 6c 74 2e 0a 58 | 2e 50 50 0a 58 4d 75 6c |esult..X|.PP.XMul|
|00004490| 74 69 70 6c 65 20 74 61 | 62 6c 65 73 20 61 72 65 |tiple ta|bles are|
|000044a0| 20 6d 6f 72 65 20 63 6f | 6d 70 6c 69 63 61 74 65 | more co|mplicate|
|000044b0| 64 2e 20 20 54 68 65 69 | 72 20 73 65 63 6f 6e 64 |d. Thei|r second|
|000044c0| 20 72 6f 77 20 69 73 20 | 74 68 65 20 72 6f 6c 6c | row is |the roll|
|000044d0| 2c 20 74 68 65 0a 58 6e | 75 6d 62 65 72 20 6f 66 |, the.Xn|umber of|
|000044e0| 20 72 6f 77 73 2c 20 61 | 6e 64 20 74 68 65 20 6e | rows, a|nd the n|
|000044f0| 75 6d 62 65 72 20 6f 66 | 20 63 6f 6c 75 6d 6e 73 |umber of| columns|
|00004500| 3b 20 61 6c 6c 20 73 65 | 70 61 72 61 74 65 64 20 |; all se|parated |
|00004510| 62 79 20 74 61 62 73 2e | 20 20 54 68 65 20 6e 75 |by tabs.| The nu|
|00004520| 6d 62 65 72 0a 58 6f 66 | 20 63 6f 6c 75 6d 6e 73 |mber.Xof| columns|
|00004530| 20 64 6f 65 73 20 6e 6f | 74 20 69 6e 63 6c 75 64 | does no|t includ|
|00004540| 65 20 74 68 65 20 72 65 | 73 75 6c 74 73 20 63 6f |e the re|sults co|
|00004550| 6c 75 6d 6e 2e 20 20 54 | 68 65 20 74 68 69 72 64 |lumn. T|he third|
|00004560| 20 6c 69 6e 65 20 69 73 | 20 74 68 65 20 73 6f 75 | line is| the sou|
|00004570| 72 63 65 0a 58 6f 66 20 | 74 68 65 20 74 61 62 6c |rce.Xof |the tabl|
|00004580| 65 2e 20 20 54 68 65 20 | 66 6f 75 72 74 68 20 6c |e. The |fourth l|
|00004590| 69 6e 65 20 61 72 65 20 | 74 68 65 20 63 6f 6c 75 |ine are |the colu|
|000045a0| 6d 6e 20 68 65 61 64 65 | 72 73 3b 20 65 61 63 68 |mn heade|rs; each|
|000045b0| 20 68 65 61 64 65 72 20 | 69 73 20 0a 58 73 65 70 | header |is .Xsep|
|000045c0| 61 72 61 74 65 64 20 62 | 79 20 61 20 74 61 62 2e |arated b|y a tab.|
|000045d0| 20 20 54 68 65 20 66 69 | 72 73 74 20 63 6f 6c 75 | The fi|rst colu|
|000045e0| 6d 6e 20 69 73 20 75 73 | 65 64 20 66 6f 72 20 74 |mn is us|ed for t|
|000045f0| 68 65 20 72 6f 6c 6c 2c | 20 73 6f 20 69 74 20 69 |he roll,| so it i|
|00004600| 73 20 0a 58 75 6e 74 69 | 74 6c 65 64 2e 20 20 54 |s .Xunti|tled. T|
|00004610| 68 65 20 66 69 66 74 68 | 20 6c 69 6e 65 2c 20 61 |he fifth| line, a|
|00004620| 6e 64 20 61 6c 6c 20 6f | 74 68 65 72 20 72 6f 77 |nd all o|ther row|
|00004630| 73 20 61 72 65 20 72 6f | 77 73 20 6f 66 20 74 68 |s are ro|ws of th|
|00004640| 65 20 74 61 62 6c 65 3b | 20 74 68 65 79 0a 58 73 |e table;| they.Xs|
|00004650| 74 61 72 74 20 77 69 74 | 68 20 74 68 65 20 72 6f |tart wit|h the ro|
|00004660| 6c 6c 20 61 6e 64 20 74 | 68 65 6e 20 68 61 76 65 |ll and t|hen have|
|00004670| 20 65 61 63 68 20 72 65 | 73 75 6c 74 2e 20 20 45 | each re|sult. E|
|00004680| 61 63 68 20 66 69 65 6c | 64 20 69 73 20 73 65 70 |ach fiel|d is sep|
|00004690| 61 72 61 74 65 64 20 62 | 79 0a 58 61 20 74 61 62 |arated b|y.Xa tab|
|000046a0| 2e 0a 58 2e 62 70 0a 58 | 2e 53 48 20 22 45 58 41 |..X.bp.X|.SH "EXA|
|000046b0| 4d 50 4c 45 20 46 49 4c | 45 53 22 0a 58 2e 4c 50 |MPLE FIL|ES".X.LP|
|000046c0| 0a 58 48 65 72 65 20 69 | 73 20 61 20 73 61 6d 70 |.XHere i|s a samp|
|000046d0| 6c 65 20 73 69 6d 70 6c | 65 20 74 61 62 6c 65 20 |le simpl|e table |
|000046e0| 66 69 6c 65 20 28 54 68 | 65 20 60 3a 3a 27 20 63 |file (Th|e `::' c|
|000046f0| 68 61 72 61 74 65 72 73 | 20 61 72 65 20 74 61 62 |haraters| are tab|
|00004700| 73 29 3a 0a 58 2e 6e 66 | 0a 58 50 61 79 2d 6f 66 |s):.X.nf|.XPay-of|
|00004710| 66 20 72 65 73 75 6c 74 | 73 20 74 61 62 6c 65 3a |f result|s table:|
|00004720| 3a 53 69 6d 70 6c 65 0a | 58 32 64 36 3a 3a 39 0a |:Simple.|X2d6::9.|
|00004730| 58 70 31 33 20 6f 66 20 | 54 68 65 20 43 6f 6d 70 |Xp13 of |The Comp|
|00004740| 6c 65 74 65 20 54 61 76 | 65 72 6e 0a 58 32 3a 3a |lete Tav|ern.X2::|
|00004750| 42 61 6e 6b 65 72 20 6c | 6f 73 65 73 20 74 72 69 |Banker l|oses tri|
|00004760| 70 6c 65 2c 20 70 61 73 | 73 65 73 20 64 69 63 65 |ple, pas|ses dice|
|00004770| 0a 58 33 3a 3a 42 61 6e | 6b 65 72 20 6c 6f 73 65 |.X3::Ban|ker lose|
|00004780| 73 20 64 6f 75 62 6c 65 | 2c 20 70 61 73 73 65 73 |s double|, passes|
|00004790| 20 64 69 63 65 0a 58 34 | 3a 3a 42 61 6e 6b 65 72 | dice.X4|::Banker|
|000047a0| 20 6c 6f 73 65 73 20 64 | 6f 75 62 6c 65 0a 58 35 | loses d|ouble.X5|
|000047b0| 3a 3a 42 61 6e 6b 65 72 | 20 6c 6f 73 65 73 0a 58 |::Banker| loses.X|
|000047c0| 36 3a 3a 42 61 6e 6b 65 | 72 20 6c 6f 73 65 73 20 |6::Banke|r loses |
|000047d0| 68 61 6c 66 20 6f 66 20 | 62 65 74 0a 58 37 3a 3a |half of |bet.X7::|
|000047e0| 53 74 61 6e 64 20 6f 66 | 66 2c 20 72 65 74 68 72 |Stand of|f, rethr|
|000047f0| 6f 77 0a 58 38 2d 39 3a | 3a 42 61 6e 6b 65 72 20 |ow.X8-9:|:Banker |
|00004800| 77 69 6e 73 20 62 65 74 | 0a 58 31 30 2d 31 31 3a |wins bet|.X10-11:|
|00004810| 3a 42 61 6e 6b 65 72 20 | 64 6f 75 62 6c 65 20 62 |:Banker |double b|
|00004820| 65 74 0a 58 31 32 3a 3a | 42 61 6e 6b 65 72 20 74 |et.X12::|Banker t|
|00004830| 72 69 70 6c 65 20 62 65 | 74 0a 58 2e 66 69 0a 58 |riple be|t.X.fi.X|
|00004840| 2e 4c 50 0a 58 48 65 72 | 65 20 69 73 20 61 6e 20 |.LP.XHer|e is an |
|00004850| 65 78 61 6d 70 6c 65 20 | 6d 75 6c 74 69 70 6c 65 |example |multiple|
|00004860| 20 74 61 62 6c 65 20 66 | 69 6c 65 20 28 22 3a 3a | table f|ile ("::|
|00004870| 22 20 61 72 65 20 74 61 | 62 73 29 3a 0a 58 2e 6e |" are ta|bs):.X.n|
|00004880| 66 0a 58 42 61 73 69 63 | 20 54 65 73 74 3a 3a 4d |f.XBasic| Test::M|
|00004890| 75 6c 74 69 70 6c 65 0a | 58 32 64 36 3a 3a 36 3a |ultiple.|X2d6::6:|
|000048a0| 3a 34 09 0a 58 6d 79 20 | 6d 69 6e 64 0a 58 2d 3a |:4..Xmy |mind.X-:|
|000048b0| 3a 45 6c 66 3a 3a 48 75 | 6d 61 6e 3a 3a 44 77 61 |:Elf::Hu|man::Dwa|
|000048c0| 72 66 3a 3a 54 72 6f 6c | 6c 09 0a 58 32 3a 3a 65 |rf::Trol|l..X2::e|
|000048d0| 32 3a 3a 68 32 3a 3a 64 | 32 3a 3a 74 32 0a 58 33 |2::h2::d|2::t2.X3|
|000048e0| 3a 3a 65 33 3a 3a 68 33 | 3a 3a 64 33 3a 3a 74 33 |::e3::h3|::d3::t3|
|000048f0| 0a 58 34 2d 37 3a 3a 65 | 34 3a 3a 68 34 3a 3a 64 |.X4-7::e|4::h4::d|
|00004900| 34 3a 3a 74 34 0a 58 38 | 2d 39 3a 3a 65 38 3a 3a |4::t4.X8|-9::e8::|
|00004910| 68 38 3a 3a 64 38 3a 3a | 74 38 0a 58 31 30 3a 3a |h8::d8::|t8.X10::|
|00004920| 65 31 30 3a 3a 68 31 30 | 3a 3a 64 31 30 3a 3a 74 |e10::h10|::d10::t|
|00004930| 31 30 0a 58 31 31 2d 31 | 32 3a 3a 65 31 31 3a 3a |10.X11-1|2::e11::|
|00004940| 68 31 31 3a 3a 64 31 31 | 3a 3a 74 31 31 0a 58 2e |h11::d11|::t11.X.|
|00004950| 66 69 0a 58 2e 62 70 0a | 58 2e 53 48 20 22 45 58 |fi.X.bp.|X.SH "EX|
|00004960| 41 4d 50 4c 45 20 43 4f | 44 45 22 0a 58 2e 6e 66 |AMPLE CO|DE".X.nf|
|00004970| 0a 58 2f 2a 0a 58 20 2a | 20 52 6f 75 74 69 6e 65 |.X/*.X *| Routine|
|00004980| 20 74 6f 20 74 72 61 6c | 61 74 65 20 61 20 74 61 | to tral|ate a ta|
|00004990| 62 6c 65 20 73 74 6f 72 | 65 64 20 69 6e 20 66 69 |ble stor|ed in fi|
|000049a0| 6c 65 20 69 6e 66 69 6c | 65 20 69 6e 74 6f 20 61 |le infil|e into a|
|000049b0| 20 74 72 6f 66 66 2f 74 | 62 6c 0a 58 20 2a 20 64 | troff/t|bl.X * d|
|000049c0| 6f 63 75 6d 65 6e 74 2c | 20 77 68 69 63 68 20 69 |ocument,| which i|
|000049d0| 73 20 69 6e 20 6f 75 74 | 66 69 6c 65 2e 0a 58 20 |s in out|file..X |
|000049e0| 2a 2f 0a 58 74 62 32 74 | 62 6c 28 69 6e 66 69 6c |*/.Xtb2t|bl(infil|
|000049f0| 65 2c 6f 75 74 66 69 6c | 65 29 20 63 68 61 72 20 |e,outfil|e) char |
|00004a00| 2a 69 6e 66 69 6c 65 20 | 3b 20 63 68 61 72 20 2a |*infile |; char *|
|00004a10| 6f 75 74 66 69 6c 65 20 | 3b 0a 58 7b 0a 58 20 20 |outfile |;.X{.X |
|00004a20| 20 20 74 61 62 6c 65 5f | 74 20 2a 74 61 62 20 3b | table_|t *tab ;|
|00004a30| 0a 58 20 20 20 20 69 6e | 74 20 73 74 73 20 3b 0a |.X in|t sts ;.|
|00004a40| 58 0a 58 20 20 20 20 73 | 74 73 20 3d 20 74 62 5f |X.X s|ts = tb_|
|00004a50| 72 65 61 64 28 69 6e 66 | 69 6c 65 2c 26 74 61 62 |read(inf|ile,&tab|
|00004a60| 29 20 3b 20 20 61 73 73 | 65 72 74 28 73 74 73 3d |) ; ass|ert(sts=|
|00004a70| 3d 54 42 5f 45 5f 4f 4b | 29 20 3b 0a 58 20 20 20 |=TB_E_OK|) ;.X |
|00004a80| 20 73 74 73 20 3d 20 74 | 62 5f 70 72 69 6e 74 28 | sts = t|b_print(|
|00004a90| 74 61 62 2c 6f 75 74 66 | 69 6c 65 2c 31 29 20 3b |tab,outf|ile,1) ;|
|00004aa0| 20 20 61 73 73 65 72 74 | 28 73 74 73 3d 3d 54 42 | assert|(sts==TB|
|00004ab0| 5f 45 5f 4f 4b 29 20 3b | 0a 58 20 20 20 20 73 74 |_E_OK) ;|.X st|
|00004ac0| 73 20 3d 20 74 62 5f 66 | 72 65 65 28 74 61 62 29 |s = tb_f|ree(tab)|
|00004ad0| 20 3b 20 20 20 20 20 20 | 20 20 20 20 61 73 73 65 | ; | asse|
|00004ae0| 72 74 28 73 74 73 3d 3d | 54 42 5f 45 5f 4f 4b 29 |rt(sts==|TB_E_OK)|
|00004af0| 20 3b 0a 58 7d 0a 58 2f | 2a 0a 58 20 2a 20 52 6f | ;.X}.X/|*.X * Ro|
|00004b00| 75 74 69 6e 65 20 72 65 | 61 64 20 69 6e 20 61 20 |utine re|ad in a |
|00004b10| 74 61 62 6c 65 2c 20 61 | 6e 64 20 74 68 65 6e 20 |table, a|nd then |
|00004b20| 72 6f 6c 6c 73 20 6f 6e | 20 69 74 20 72 65 70 65 |rolls on| it repe|
|00004b30| 61 74 65 64 6c 79 2c 20 | 70 72 69 6e 74 69 6e 67 |atedly, |printing|
|00004b40| 0a 58 20 2a 20 74 68 65 | 20 72 65 73 75 6c 74 20 |.X * the| result |
|00004b50| 6f 66 20 65 61 63 68 20 | 72 6f 6c 6c 20 74 6f 20 |of each |roll to |
|00004b60| 74 68 65 20 73 63 72 65 | 65 6e 2e 0a 58 20 2a 2f |the scre|en..X */|
|00004b70| 0a 58 0a 58 72 6f 6c 6c | 28 74 61 62 66 69 6c 65 |.X.Xroll|(tabfile|
|00004b80| 2c 74 69 6d 65 73 29 20 | 63 68 61 72 20 2a 74 61 |,times) |char *ta|
|00004b90| 62 66 69 6c 65 20 3b 20 | 69 6e 74 20 74 69 6d 65 |bfile ; |int time|
|00004ba0| 73 20 3b 0a 58 7b 0a 58 | 20 20 20 20 74 61 62 6c |s ;.X{.X| tabl|
|00004bb0| 65 5f 74 20 2a 74 61 62 | 20 3b 09 0a 58 20 20 20 |e_t *tab| ;..X |
|00004bc0| 20 63 68 61 72 20 2a 73 | 74 72 20 3b 0a 58 20 20 | char *s|tr ;.X |
|00004bd0| 20 20 69 6e 74 20 73 74 | 73 20 3b 0a 58 20 20 20 | int st|s ;.X |
|00004be0| 20 69 6e 74 20 69 20 3b | 0a 58 0a 58 20 20 20 20 | int i ;|.X.X |
|00004bf0| 73 74 73 20 3d 20 74 62 | 5f 72 65 61 64 28 69 6e |sts = tb|_read(in|
|00004c00| 66 69 6c 65 2c 26 74 61 | 62 29 20 20 3b 20 20 61 |file,&ta|b) ; a|
|00004c10| 73 73 65 72 74 28 73 74 | 73 3d 3d 54 42 5f 45 5f |ssert(st|s==TB_E_|
|00004c20| 4f 4b 29 20 3b 0a 58 20 | 20 20 20 66 6f 72 28 69 |OK) ;.X | for(i|
|00004c30| 3d 30 20 3b 20 69 3c 74 | 69 6d 65 73 20 3b 20 69 |=0 ; i<t|imes ; i|
|00004c40| 2b 2b 29 20 7b 0a 58 20 | 20 20 20 20 20 20 20 73 |++) {.X | s|
|00004c50| 74 73 20 3d 20 74 62 5f | 75 73 65 28 74 61 62 2c |ts = tb_|use(tab,|
|00004c60| 26 73 74 72 29 20 3b 0a | 58 09 70 72 69 6e 74 66 |&str) ;.|X.printf|
|00004c70| 28 22 72 65 73 75 6c 74 | 20 25 64 20 77 61 73 20 |("result| %d was |
|00004c80| 25 73 5c 5c 6e 22 2c 69 | 2b 31 2c 73 74 72 29 20 |%s\\n",i|+1,str) |
|00004c90| 3b 0a 58 20 20 20 20 7d | 0a 58 20 20 20 20 73 74 |;.X }|.X st|
|00004ca0| 73 20 3d 20 74 62 5f 66 | 72 65 65 28 74 61 62 29 |s = tb_f|ree(tab)|
|00004cb0| 20 3b 20 20 20 20 20 20 | 20 20 20 20 61 73 73 65 | ; | asse|
|00004cc0| 72 74 28 73 74 73 3d 3d | 54 42 5f 45 5f 4f 4b 29 |rt(sts==|TB_E_OK)|
|00004cd0| 20 3b 0a 58 7d 0a 58 2e | 66 69 0a 58 2e 62 70 0a | ;.X}.X.|fi.X.bp.|
|00004ce0| 58 2e 53 48 20 44 49 41 | 47 4e 4f 53 54 49 43 53 |X.SH DIA|GNOSTICS|
|00004cf0| 0a 58 2e 54 50 20 31 35 | 0a 58 54 42 5f 45 5f 4f |.X.TP 15|.XTB_E_O|
|00004d00| 4b 0a 58 45 76 65 72 79 | 74 68 69 6e 67 20 77 6f |K.XEvery|thing wo|
|00004d10| 72 6b 65 64 20 66 69 6e | 65 2e 0a 58 2e 54 50 20 |rked fin|e..X.TP |
|00004d20| 31 35 0a 58 54 42 5f 45 | 5f 4d 49 53 43 09 0a 58 |15.XTB_E|_MISC..X|
|00004d30| 47 65 6e 65 72 61 6c 20 | 70 75 72 70 6f 73 65 20 |General |purpose |
|00004d40| 65 72 72 6f 72 20 6d 65 | 73 73 61 67 65 2e 20 20 |error me|ssage. |
|00004d50| 53 6f 6d 65 74 68 69 6e | 67 20 77 65 6e 74 20 77 |Somethin|g went w|
|00004d60| 72 6f 6e 67 2e 0a 58 2e | 54 50 20 31 35 0a 58 54 |rong..X.|TP 15.XT|
|00004d70| 42 5f 45 5f 4e 4f 54 59 | 45 54 0a 58 46 65 61 74 |B_E_NOTY|ET.XFeat|
|00004d80| 75 72 65 20 6e 6f 74 20 | 79 65 74 20 69 6d 70 6c |ure not |yet impl|
|00004d90| 65 6d 65 6e 74 65 64 2e | 20 20 0a 58 2e 54 50 20 |emented.| .X.TP |
|00004da0| 31 35 0a 58 54 42 5f 45 | 5f 4e 4f 46 49 4c 45 0a |15.XTB_E|_NOFILE.|
|00004db0| 58 54 68 65 20 65 78 74 | 65 72 6e 61 6c 20 74 61 |XThe ext|ernal ta|
|00004dc0| 62 6c 65 20 66 69 6c 65 | 20 79 6f 75 20 77 61 6e |ble file| you wan|
|00004dd0| 74 65 64 20 74 6f 20 72 | 65 61 64 20 64 6f 65 73 |ted to r|ead does|
|00004de0| 20 6e 6f 74 20 65 78 69 | 73 74 2e 0a 58 2e 54 50 | not exi|st..X.TP|
|00004df0| 20 31 35 0a 58 54 42 5f | 45 5f 4e 4f 5f 43 4f 4c | 15.XTB_|E_NO_COL|
|00004e00| 0a 58 4e 6f 20 63 6f 6c | 75 6d 6e 20 69 6e 20 74 |.XNo col|umn in t|
|00004e10| 68 65 20 74 61 62 6c 65 | 20 69 77 74 68 20 74 68 |he table| iwth th|
|00004e20| 61 74 20 6e 61 6d 65 2e | 20 20 46 6f 72 20 6d 75 |at name.| For mu|
|00004e30| 6c 74 69 70 6c 65 20 63 | 6f 6c 75 6d 6e 20 74 61 |ltiple c|olumn ta|
|00004e40| 62 6c 65 73 2c 20 79 6f | 75 0a 58 6d 75 73 74 20 |bles, yo|u.Xmust |
|00004e50| 70 61 73 73 20 61 20 63 | 6f 6c 75 6d 6e 20 6e 61 |pass a c|olumn na|
|00004e60| 6d 65 20 74 6f 20 74 62 | 5f 75 73 65 20 6f 72 20 |me to tb|_use or |
|00004e70| 74 62 5f 63 68 6f 6f 73 | 65 2c 20 62 75 74 20 79 |tb_choos|e, but y|
|00004e80| 6f 75 72 20 6e 61 6d 65 | 20 64 6f 65 73 20 6e 6f |our name| does no|
|00004e90| 74 0a 58 6d 61 74 63 68 | 20 6f 6e 65 20 69 6e 20 |t.Xmatch| one in |
|00004ea0| 74 68 65 20 74 61 62 6c | 65 2e 0a 58 2e 54 50 20 |the tabl|e..X.TP |
|00004eb0| 31 35 0a 58 54 42 5f 45 | 5f 4e 4f 54 59 50 45 0a |15.XTB_E|_NOTYPE.|
|00004ec0| 58 54 68 65 20 74 79 70 | 65 20 6f 66 20 74 68 65 |XThe typ|e of the|
|00004ed0| 20 74 61 62 6c 65 20 79 | 6f 75 20 70 61 73 73 65 | table y|ou passe|
|00004ee0| 64 20 74 6f 20 61 20 74 | 62 5f 20 72 6f 75 74 69 |d to a t|b_ routi|
|00004ef0| 6e 65 20 69 73 20 6e 6f | 74 20 61 20 6c 65 67 61 |ne is no|t a lega|
|00004f00| 6c 20 74 79 70 65 2e 0a | 58 43 75 72 72 65 6e 74 |l type..|XCurrent|
|00004f10| 6c 79 20 74 68 65 20 6c | 65 67 61 6c 20 74 79 70 |ly the l|egal typ|
|00004f20| 65 73 20 61 72 65 20 31 | 20 28 53 69 6d 70 6c 65 |es are 1| (Simple|
|00004f30| 29 20 61 6e 64 20 32 20 | 28 4d 75 6c 74 69 29 2e |) and 2 |(Multi).|
|00004f40| 20 20 45 69 74 68 65 72 | 20 79 6f 75 20 61 72 65 | Either| you are|
|00004f50| 0a 58 65 78 70 65 72 69 | 6d 65 6e 74 69 6e 67 20 |.Xexperi|menting |
|00004f60| 77 69 74 68 20 6e 65 77 | 20 74 79 70 65 73 2c 20 |with new| types, |
|00004f70| 6f 72 20 28 6d 6f 72 65 | 20 6c 69 6b 65 6c 79 29 |or (more| likely)|
|00004f80| 20 74 68 65 20 74 61 62 | 6c 65 20 70 6f 69 6e 74 | the tab|le point|
|00004f90| 65 72 20 79 6f 75 0a 58 | 70 61 73 73 65 64 20 74 |er you.X|passed t|
|00004fa0| 6f 20 61 20 74 62 5f 72 | 6f 75 74 69 6e 65 20 70 |o a tb_r|outine p|
|00004fb0| 6f 69 6e 74 73 20 74 6f | 20 67 61 72 62 61 67 65 |oints to| garbage|
|00004fc0| 2e 0a 58 2e 54 50 20 31 | 35 0a 58 54 42 5f 45 5f |..X.TP 1|5.XTB_E_|
|00004fd0| 54 4f 4f 4d 41 4e 59 0a | 58 59 6f 75 20 68 61 76 |TOOMANY.|XYou hav|
|00004fe0| 65 20 61 73 6b 65 64 20 | 74 68 65 20 74 62 5f 6d |e asked |the tb_m|
|00004ff0| 61 6e 79 20 72 6f 75 74 | 69 6e 65 20 66 6f 72 20 |any rout|ine for |
|00005000| 74 6f 6f 20 6d 61 6e 79 | 20 61 6e 73 77 65 72 73 |too many| answers|
|00005010| 2e 20 20 54 68 65 20 74 | 68 65 20 74 61 62 6c 65 |. The t|he table|
|00005020| 20 0a 58 6f 6e 6c 79 20 | 63 6f 6e 74 61 69 6e 73 | .Xonly |contains|
|00005030| 20 31 30 20 70 6f 73 73 | 69 62 6c 65 20 61 6e 73 | 10 poss|ible ans|
|00005040| 77 65 72 73 20 28 66 6f | 72 20 65 78 61 6d 70 6c |wers (fo|r exampl|
|00005050| 65 29 20 61 6e 64 20 79 | 6f 75 20 61 73 6b 20 66 |e) and y|ou ask f|
|00005060| 6f 72 20 31 32 2c 0a 58 | 79 6f 75 20 77 69 6c 6c |or 12,.X|you will|
|00005070| 20 67 65 74 20 74 68 69 | 73 20 65 72 72 6f 72 2e | get thi|s error.|
|00005080| 20 20 53 69 6e 63 65 20 | 74 62 5f 6d 61 6e 79 20 | Since |tb_many |
|00005090| 6d 75 73 74 20 72 65 74 | 75 72 6e 20 61 73 20 6d |must ret|urn as m|
|000050a0| 61 6e 79 20 75 6e 69 71 | 75 65 20 61 6e 73 77 65 |any uniq|ue answe|
|000050b0| 72 73 0a 58 61 73 20 79 | 6f 75 20 61 73 6b 20 66 |rs.Xas y|ou ask f|
|000050c0| 6f 72 2c 20 69 74 20 77 | 69 6c 6c 20 72 65 74 75 |or, it w|ill retu|
|000050d0| 72 6e 20 74 68 69 73 20 | 65 72 72 6f 72 20 69 66 |rn this |error if|
|000050e0| 20 74 68 65 72 65 20 61 | 72 65 20 6e 6f 74 20 74 | there a|re not t|
|000050f0| 68 61 74 20 6d 61 6e 79 | 20 0a 58 75 6e 69 71 75 |hat many| .Xuniqu|
|00005100| 65 20 61 6e 73 77 65 72 | 73 20 69 6e 20 74 68 65 |e answer|s in the|
|00005110| 20 74 61 62 6c 65 2e 0a | 58 2e 53 48 20 22 53 45 | table..|X.SH "SE|
|00005120| 45 20 41 4c 53 4f 22 0a | 58 2e 50 50 0a 58 54 68 |E ALSO".|X.PP.XTh|
|00005130| 65 73 65 20 72 6f 75 74 | 69 6e 65 73 20 75 73 65 |ese rout|ines use|
|00005140| 20 72 61 5f 72 61 6e 64 | 6f 6d 28 33 29 20 74 6f | ra_rand|om(3) to|
|00005150| 20 67 65 6e 65 72 61 74 | 65 20 72 61 6e 64 6f 6d | generat|e random|
|00005160| 20 6e 75 6d 62 65 72 73 | 2e 0a 58 2e 53 48 20 22 | numbers|..X.SH "|
|00005170| 42 55 47 53 22 0a 58 2e | 49 50 20 5c 28 62 75 0a |BUGS".X.|IP \(bu.|
|00005180| 58 55 73 69 6e 67 20 73 | 74 72 61 6e 67 65 20 66 |XUsing s|trange f|
|00005190| 69 6c 65 20 6e 61 6d 65 | 73 20 74 6f 20 73 70 65 |ile name|s to spe|
|000051a0| 63 69 66 79 20 73 74 64 | 6f 75 74 20 61 6e 64 20 |cify std|out and |
|000051b0| 73 74 64 65 72 72 20 69 | 6e 20 74 62 5f 70 72 69 |stderr i|n tb_pri|
|000051c0| 6e 74 20 69 73 0a 58 61 | 20 73 6c 65 65 7a 79 20 |nt is.Xa| sleezy |
|000051d0| 68 61 63 6b 2e 20 20 41 | 6c 73 6f 2c 20 74 68 65 |hack. A|lso, the|
|000051e0| 72 65 20 69 73 20 6e 6f | 20 77 61 79 20 74 6f 20 |re is no| way to |
|000051f0| 77 72 69 74 65 20 74 68 | 69 73 20 74 6f 20 61 20 |write th|is to a |
|00005200| 66 69 6c 65 20 64 65 73 | 63 72 69 70 74 6f 72 0a |file des|criptor.|
|00005210| 58 77 68 69 63 68 20 69 | 73 20 61 6c 72 65 61 64 |Xwhich i|s alread|
|00005220| 79 20 6f 70 65 6e 2e 0a | 58 2e 53 48 20 41 55 54 |y open..|X.SH AUT|
|00005230| 48 4f 52 0a 58 2e 50 50 | 0a 58 54 68 65 20 74 61 |HOR.X.PP|.XThe ta|
|00005240| 62 6c 65 20 72 6f 75 74 | 69 6e 65 73 20 77 65 72 |ble rout|ines wer|
|00005250| 65 20 77 72 69 74 74 65 | 6e 20 62 79 20 4a 6f 73 |e writte|n by Jos|
|00005260| 68 75 61 20 4c 65 76 79 | 20 61 74 20 41 74 68 65 |hua Levy| at Athe|
|00005270| 72 74 6f 6e 20 54 65 63 | 68 6e 6f 6c 6f 67 79 2e |rton Tec|hnology.|
|00005280| 0a 58 2e 62 72 0a 58 6a | 6f 73 68 75 61 40 61 74 |.X.br.Xj|oshua@at|
|00005290| 68 65 72 74 6f 6e 2e 63 | 6f 6d 20 20 20 48 6f 6d |herton.c|om Hom|
|000052a0| 65 3a 20 28 34 31 35 29 | 20 39 36 38 2d 33 37 31 |e: (415)| 968-371|
|000052b0| 38 20 20 20 57 6f 72 6b | 3a 20 28 34 30 38 29 20 |8 Work|: (408) |
|000052c0| 37 33 34 2d 39 38 32 32 | 0a 58 2e 49 50 20 22 5c |734-9822|.X.IP "\|
|000052d0| 28 63 6f 20 31 39 38 39 | 20 4a 6f 73 68 75 61 20 |(co 1989| Joshua |
|000052e0| 4c 65 76 79 22 0a 58 54 | 68 69 73 20 6d 61 6e 20 |Levy".XT|his man |
|000052f0| 70 61 67 65 20 61 6e 64 | 20 74 68 65 20 63 6f 64 |page and| the cod|
|00005300| 65 20 69 74 20 64 65 73 | 63 72 69 62 65 73 20 69 |e it des|cribes i|
|00005310| 73 20 63 6f 76 65 72 65 | 64 20 62 79 20 74 68 65 |s covere|d by the|
|00005320| 20 47 4e 55 20 67 65 6e | 65 72 61 6c 0a 58 70 75 | GNU gen|eral.Xpu|
|00005330| 62 6c 69 63 20 6c 69 63 | 65 6e 73 65 2c 20 63 6f |blic lic|ense, co|
|00005340| 6d 6d 6f 6e 6c 79 20 63 | 61 6c 6c 65 64 20 74 68 |mmonly c|alled th|
|00005350| 65 20 22 63 6f 70 79 6c | 65 66 74 22 2e 20 20 49 |e "copyl|eft". I|
|00005360| 74 20 63 61 6e 20 6f 6e | 6c 79 20 62 65 20 75 73 |t can on|ly be us|
|00005370| 65 64 20 6f 72 0a 58 72 | 65 64 69 73 74 72 69 62 |ed or.Xr|edistrib|
|00005380| 75 74 65 64 20 75 6e 64 | 65 72 20 74 68 65 20 74 |uted und|er the t|
|00005390| 65 72 6d 73 20 6f 66 20 | 74 68 61 74 20 61 67 72 |erms of |that agr|
|000053a0| 65 65 6d 65 6e 74 2e 20 | 20 50 65 72 73 6f 6e 73 |eement. | Persons|
|000053b0| 20 6f 72 20 63 6f 72 70 | 6f 72 61 74 69 6f 6e 73 | or corp|orations|
|000053c0| 0a 58 77 69 73 68 69 6e | 67 20 74 6f 20 75 73 65 |.Xwishin|g to use|
|000053d0| 20 74 68 69 73 20 63 6f | 64 65 20 69 6e 20 77 61 | this co|de in wa|
|000053e0| 79 73 20 6e 6f 74 20 61 | 6c 6c 6f 77 65 64 20 62 |ys not a|llowed b|
|000053f0| 79 20 74 68 65 20 47 4e | 55 20 6c 69 63 65 6e 73 |y the GN|U licens|
|00005400| 65 20 73 68 6f 75 6c 64 | 20 0a 58 63 6f 6e 74 61 |e should| .Xconta|
|00005410| 63 74 20 74 68 65 20 61 | 75 74 68 6f 72 20 74 6f |ct the a|uthor to|
|00005420| 20 64 69 73 63 75 73 73 | 20 6f 74 68 65 72 20 6c | discuss| other l|
|00005430| 69 63 65 6e 73 69 6e 67 | 20 61 67 72 65 65 6d 65 |icensing| agreeme|
|00005440| 6e 74 73 2e 0a 58 2e 62 | 72 0a 58 0a 58 0a 53 48 |nts..X.b|r.X.X.SH|
|00005450| 41 52 5f 45 4f 46 0a 66 | 69 0a 69 66 20 74 65 73 |AR_EOF.f|i.if tes|
|00005460| 74 20 2d 66 20 27 74 62 | 2d 61 64 64 2e 6d 61 6e |t -f 'tb|-add.man|
|00005470| 27 0a 74 68 65 6e 0a 09 | 65 63 68 6f 20 73 68 61 |'.then..|echo sha|
|00005480| 72 3a 20 22 77 69 6c 6c | 20 6e 6f 74 20 6f 76 65 |r: "will| not ove|
|00005490| 72 2d 77 72 69 74 65 20 | 65 78 69 73 74 69 6e 67 |r-write |existing|
|000054a0| 20 66 69 6c 65 20 27 74 | 62 2d 61 64 64 2e 6d 61 | file 't|b-add.ma|
|000054b0| 6e 27 22 0a 65 6c 73 65 | 0a 73 65 64 20 27 73 2f |n'".else|.sed 's/|
|000054c0| 5e 58 2f 2f 27 20 3c 3c | 20 5c 53 48 41 52 5f 45 |^X//' <<| \SHAR_E|
|000054d0| 4f 46 20 3e 20 27 74 62 | 2d 61 64 64 2e 6d 61 6e |OF > 'tb|-add.man|
|000054e0| 27 0a 58 2e 69 67 20 58 | 43 0a 58 25 20 20 6e 72 |'.X.ig X|C.X% nr|
|000054f0| 6f 66 66 20 2d 6d 61 6e | 20 74 62 2d 61 64 64 2e |off -man| tb-add.|
|00005500| 6d 61 6e 20 7c 20 6d 6f | 72 65 0a 58 25 6e 20 6e |man | mo|re.X%n n|
|00005510| 72 6f 66 66 20 2d 6d 61 | 6e 20 74 62 2d 61 64 64 |roff -ma|n tb-add|
|00005520| 2e 6d 61 6e 20 7c 20 6c | 70 72 0a 58 25 74 20 70 |.man | l|pr.X%t p|
|00005530| 74 72 6f 66 66 20 2d 6d | 61 6e 20 74 62 2d 61 64 |troff -m|an tb-ad|
|00005540| 64 2e 6d 61 6e 20 2d 50 | 6c 77 0a 58 2e 58 43 0a |d.man -P|lw.X.XC.|
|00005550| 58 2e 54 48 20 54 41 42 | 4c 45 2d 41 44 44 20 33 |X.TH TAB|LE-ADD 3|
|00005560| 20 22 46 65 62 20 32 32 | 74 68 20 31 39 39 30 22 | "Feb 22|th 1990"|
|00005570| 0a 58 2e 53 48 20 4e 41 | 4d 45 20 0a 58 74 61 62 |.X.SH NA|ME .Xtab|
|00005580| 6c 65 2d 61 64 64 20 5c | 2d 20 69 6e 73 74 72 75 |le-add \|- instru|
|00005590| 63 74 69 6f 6e 73 20 66 | 6f 72 20 61 64 64 69 6e |ctions f|or addin|
|000055a0| 67 20 6e 65 77 20 74 61 | 62 6c 65 20 61 6e 64 20 |g new ta|ble and |
|000055b0| 6d 65 73 73 61 67 74 65 | 20 74 79 70 65 73 20 74 |messagte| types t|
|000055c0| 6f 20 74 68 65 20 74 61 | 62 6c 65 20 72 6f 75 74 |o the ta|ble rout|
|000055d0| 69 6e 65 73 0a 58 2e 53 | 48 20 53 59 4e 4f 50 53 |ines.X.S|H SYNOPS|
|000055e0| 49 53 0a 58 2e 50 50 0a | 58 54 68 69 73 20 70 61 |IS.X.PP.|XThis pa|
|000055f0| 67 65 20 64 65 73 63 72 | 69 62 65 73 20 68 6f 77 |ge descr|ibes how|
|00005600| 20 74 6f 20 61 64 64 20 | 6e 65 77 20 74 61 62 6c | to add |new tabl|
|00005610| 65 20 74 79 70 65 73 20 | 74 6f 20 74 68 65 20 74 |e types |to the t|
|00005620| 61 62 6c 65 20 70 61 63 | 6b 61 67 65 2e 0a 58 49 |able pac|kage..XI|
|00005630| 74 20 61 6c 73 6f 20 64 | 69 73 63 75 73 73 65 73 |t also d|iscusses|
|00005640| 20 68 6f 77 20 74 6f 20 | 61 64 64 20 6e 65 77 20 | how to |add new |
|00005650| 6d 65 73 73 61 67 65 73 | 2e 0a 58 28 49 74 20 69 |messages|..X(It i|
|00005660| 73 20 6e 6f 74 20 72 65 | 61 6c 6c 79 20 74 65 73 |s not re|ally tes|
|00005670| 74 65 64 2c 20 62 75 74 | 20 73 68 6f 75 6c 64 20 |ted, but| should |
|00005680| 67 69 76 65 20 79 6f 75 | 20 61 20 66 6c 61 76 6f |give you| a flavo|
|00005690| 72 20 6f 66 20 77 68 61 | 74 20 74 6f 20 64 6f 2e |r of wha|t to do.|
|000056a0| 29 0a 58 2e 53 48 20 4f | 56 45 52 56 49 45 57 0a |).X.SH O|VERVIEW.|
|000056b0| 58 2e 50 50 0a 58 54 68 | 65 20 63 6f 64 65 20 69 |X.PP.XTh|e code i|
|000056c0| 6e 20 74 61 62 6c 65 2e | 63 20 69 73 20 61 20 76 |n table.|c is a v|
|000056d0| 65 72 79 20 73 69 6d 70 | 6c 65 20 64 69 73 70 61 |ery simp|le dispa|
|000056e0| 74 63 68 20 6d 65 63 68 | 61 6e 69 73 6d 20 66 6f |tch mech|anism fo|
|000056f0| 72 20 61 20 76 65 72 79 | 20 0a 58 73 69 6d 70 6c |r a very| .Xsimpl|
|00005700| 65 20 6f 62 6a 65 63 74 | 20 6f 72 69 65 6e 74 65 |e object| oriente|
|00005710| 64 20 73 79 73 74 65 6d | 2e 20 20 54 6f 20 61 64 |d system|. To ad|
|00005720| 64 20 61 20 6e 65 77 20 | 74 61 62 6c 65 20 74 79 |d a new |table ty|
|00005730| 70 65 20 79 6f 75 20 6d | 75 73 74 0a 58 66 69 72 |pe you m|ust.Xfir|
|00005740| 73 74 20 74 65 6c 6c 20 | 74 68 65 20 64 69 73 70 |st tell |the disp|
|00005750| 61 74 63 68 20 73 79 73 | 74 65 6d 20 61 62 6f 75 |atch sys|tem abou|
|00005760| 74 20 69 74 2c 20 61 6e | 64 20 74 68 65 6e 20 77 |t it, an|d then w|
|00005770| 72 69 74 65 20 74 68 65 | 20 22 6d 65 73 73 61 67 |rite the| "messag|
|00005780| 65 0a 58 68 61 6e 64 6c | 69 6e 67 22 20 6f 72 20 |e.Xhandl|ing" or |
|00005790| 6d 65 74 68 6f 64 20 72 | 6f 75 74 69 6e 65 73 2c |method r|outines,|
|000057a0| 20 77 68 69 63 68 20 74 | 68 65 20 64 69 73 70 61 | which t|he dispa|
|000057b0| 74 63 68 65 72 20 77 69 | 6c 6c 20 63 61 6c 6c 20 |tcher wi|ll call |
|000057c0| 66 6f 72 20 79 6f 75 2e | 0a 58 2e 50 50 0a 58 54 |for you.|.X.PP.XT|
|000057d0| 68 65 20 6d 6f 73 74 20 | 63 6f 6d 70 6c 69 63 61 |he most |complica|
|000057e0| 74 65 64 20 6f 66 20 74 | 68 65 73 65 20 72 6f 75 |ted of t|hese rou|
|000057f0| 74 69 6e 65 73 20 69 73 | 20 74 68 65 20 72 65 61 |tines is| the rea|
|00005800| 64 20 72 6f 75 74 69 6e | 65 2c 20 77 68 69 63 68 |d routin|e, which|
|00005810| 20 0a 58 72 65 61 64 73 | 20 74 68 65 20 74 61 62 | .Xreads| the tab|
|00005820| 6c 65 20 66 72 6f 6d 20 | 61 20 64 69 73 6b 20 66 |le from |a disk f|
|00005830| 69 6c 65 2e 20 20 54 68 | 69 73 20 72 6f 75 74 69 |ile. Th|is routi|
|00005840| 6e 65 20 69 6d 70 6c 69 | 63 69 74 6c 79 20 64 65 |ne impli|citly de|
|00005850| 66 69 6e 65 73 0a 58 74 | 68 65 20 74 65 78 74 20 |fines.Xt|he text |
|00005860| 66 6f 72 6d 61 74 20 75 | 73 65 64 20 74 6f 20 73 |format u|sed to s|
|00005870| 74 6f 72 65 20 74 68 65 | 20 6e 65 77 20 74 61 62 |tore the| new tab|
|00005880| 6c 65 20 74 79 70 65 2e | 20 20 54 68 65 20 66 6f |le type.| The fo|
|00005890| 72 6d 61 74 20 69 73 0a | 58 76 65 72 79 20 69 6d |rmat is.|Xvery im|
|000058a0| 70 6f 72 74 61 6e 74 2c | 20 73 69 6e 63 65 20 74 |portant,| since t|
|000058b0| 68 61 74 20 69 73 20 68 | 6f 77 20 74 61 62 6c 65 |hat is h|ow table|
|000058c0| 73 20 61 72 65 20 63 72 | 65 61 74 65 64 20 61 6e |s are cr|eated an|
|000058d0| 64 20 6d 6f 64 69 66 69 | 65 64 0a 58 62 79 20 70 |d modifi|ed.Xby p|
|000058e0| 65 6f 70 6c 65 2e 0a 58 | 2e 53 48 20 44 45 53 43 |eople..X|.SH DESC|
|000058f0| 52 49 50 54 49 4f 4e 0a | 58 2e 49 50 20 22 43 72 |RIPTION.|X.IP "Cr|
|00005900| 65 61 74 65 20 61 20 73 | 61 6d 70 6c 65 20 74 61 |eate a s|ample ta|
|00005910| 62 6c 65 20 66 69 6c 65 | 2e 22 0a 58 49 20 61 6c |ble file|.".XI al|
|00005920| 77 61 79 73 20 73 74 61 | 72 74 20 77 69 74 68 20 |ways sta|rt with |
|00005930| 74 68 65 20 66 6f 72 6d | 61 74 20 6f 66 20 74 68 |the form|at of th|
|00005940| 65 20 74 61 62 6c 65 20 | 66 69 6c 65 2e 20 20 49 |e table |file. I|
|00005950| 0a 58 63 72 65 61 74 65 | 20 61 20 73 61 6d 70 6c |.Xcreate| a sampl|
|00005960| 65 20 77 68 69 63 68 20 | 77 69 6c 6c 20 62 65 20 |e which |will be |
|00005970| 75 73 65 64 20 61 73 20 | 74 68 65 20 66 69 72 73 |used as |the firs|
|00005980| 74 20 74 65 73 74 20 63 | 61 73 65 2e 20 20 54 68 |t test c|ase. Th|
|00005990| 65 20 63 61 74 0a 58 63 | 6f 6d 6d 61 6e 64 20 77 |e cat.Xc|ommand w|
|000059a0| 69 74 68 20 74 68 65 20 | 2d 65 20 61 6e 64 20 2d |ith the |-e and -|
|000059b0| 74 20 66 6c 61 67 73 20 | 69 73 20 67 72 65 61 74 |t flags |is great|
|000059c0| 20 66 6f 72 20 6d 61 6b | 69 6e 67 20 73 75 72 65 | for mak|ing sure|
|000059d0| 20 79 6f 75 20 70 75 74 | 0a 58 74 61 62 73 20 69 | you put|.Xtabs i|
|000059e0| 6e 20 61 6c 6c 20 74 68 | 65 20 72 69 67 68 74 20 |n all th|e right |
|000059f0| 70 72 69 63 65 2e 20 20 | 48 65 72 65 20 61 72 65 |price. |Here are|
|00005a00| 20 74 68 65 20 67 75 69 | 64 65 6c 69 6e 65 73 20 | the gui|delines |
|00005a10| 49 20 75 73 65 20 69 6e | 20 64 65 73 69 67 6e 69 |I use in| designi|
|00005a20| 6e 67 0a 58 74 68 65 73 | 65 20 66 69 6c 65 73 3a |ng.Xthes|e files:|
|00005a30| 0a 58 2e 52 53 0a 58 2e | 49 50 20 31 0a 58 54 68 |.X.RS.X.|IP 1.XTh|
|00005a40| 65 20 66 69 72 73 74 20 | 6c 69 6e 65 20 73 68 6f |e first |line sho|
|00005a50| 75 6c 64 20 63 6f 6e 74 | 61 69 6e 20 74 68 65 20 |uld cont|ain the |
|00005a60| 74 61 62 6c 65 27 73 20 | 74 69 74 6c 65 20 61 6e |table's |title an|
|00005a70| 64 20 69 74 73 20 74 79 | 70 65 2e 0a 58 2e 49 50 |d its ty|pe..X.IP|
|00005a80| 20 32 0a 58 54 68 65 20 | 73 65 63 6f 6e 64 20 6c | 2.XThe |second l|
|00005a90| 69 6e 65 20 73 68 6f 75 | 6c 64 20 63 6f 6e 74 61 |ine shou|ld conta|
|00005aa0| 69 6e 20 74 68 65 20 64 | 69 63 65 20 72 6f 6c 6c |in the d|ice roll|
|00005ab0| 20 75 73 65 64 20 6f 6e | 20 74 68 69 73 20 74 61 | used on| this ta|
|00005ac0| 62 65 6c 2c 0a 58 61 6e | 64 20 61 6c 6c 20 69 6e |bel,.Xan|d all in|
|00005ad0| 66 6f 72 6d 61 74 69 6f | 6e 20 61 62 6f 75 74 20 |formatio|n about |
|00005ae0| 74 68 65 20 73 69 7a 65 | 20 6f 66 20 74 68 65 20 |the size| of the |
|00005af0| 74 61 62 6c 65 2e 20 20 | 41 66 74 65 72 20 72 65 |table. |After re|
|00005b00| 61 64 69 6e 67 0a 58 74 | 68 65 20 66 69 72 73 74 |ading.Xt|he first|
|00005b10| 20 74 77 6f 20 6c 69 6e | 65 73 2c 20 74 68 65 20 | two lin|es, the |
|00005b20| 74 62 5f 72 65 61 64 20 | 72 6f 75 74 69 6e 65 20 |tb_read |routine |
|00005b30| 73 68 6f 75 6c 64 20 68 | 61 76 65 20 65 6e 6f 75 |should h|ave enou|
|00005b40| 67 68 20 0a 58 69 6e 66 | 6f 72 6d 61 74 69 6f 6e |gh .Xinf|ormation|
|00005b50| 20 74 6f 20 61 6c 6c 6f | 63 61 74 65 20 73 70 61 | to allo|cate spa|
|00005b60| 63 65 20 66 6f 72 20 74 | 68 65 20 74 61 62 6c 65 |ce for t|he table|
|00005b70| 20 73 74 72 75 63 74 75 | 72 65 2e 0a 58 2e 49 50 | structu|re..X.IP|
|00005b80| 20 33 0a 58 54 68 65 20 | 74 68 69 72 64 20 6c 69 | 3.XThe |third li|
|00005b90| 6e 65 20 73 68 6f 75 6c | 64 20 63 6f 6e 74 61 69 |ne shoul|d contai|
|00005ba0| 6e 20 74 68 65 20 73 6f | 75 72 63 65 20 6f 66 20 |n the so|urce of |
|00005bb0| 74 68 69 73 20 74 61 62 | 6c 65 2e 20 20 41 20 74 |this tab|le. A t|
|00005bc0| 69 74 6c 65 20 61 6e 64 | 0a 58 70 61 67 65 20 6e |itle and|.Xpage n|
|00005bd0| 75 6d 62 65 72 2c 20 6f | 72 20 74 68 65 20 70 65 |umber, o|r the pe|
|00005be0| 72 73 6f 6e 20 77 68 6f | 20 63 61 6d 65 20 75 70 |rson who| came up|
|00005bf0| 20 77 69 74 68 20 74 68 | 65 20 74 61 62 6c 65 20 | with th|e table |
|00005c00| 61 72 65 20 66 69 6e 65 | 20 68 65 72 65 2e 0a 58 |are fine| here..X|
|00005c10| 2e 49 50 20 34 0a 58 4f | 74 68 65 72 20 6c 69 6e |.IP 4.XO|ther lin|
|00005c20| 65 73 20 6d 69 67 68 74 | 20 63 6f 6e 74 61 69 6e |es might| contain|
|00005c30| 20 6f 74 68 65 72 20 63 | 6f 6e 74 72 6f 6c 20 74 | other c|ontrol t|
|00005c40| 79 70 65 20 69 6e 66 6f | 72 6d 61 74 69 6f 6e 2e |ype info|rmation.|
|00005c50| 0a 58 2e 49 50 20 35 0a | 58 46 69 6e 61 6c 6c 79 |.X.IP 5.|XFinally|
|00005c60| 2c 20 74 68 65 20 6c 69 | 6e 65 73 20 77 68 69 63 |, the li|nes whic|
|00005c70| 68 20 64 65 73 63 72 69 | 62 65 20 74 68 65 20 61 |h descri|be the a|
|00005c80| 63 74 75 61 6c 20 74 61 | 62 6c 65 2e 20 20 49 64 |ctual ta|ble. Id|
|00005c90| 65 61 6c 6c 79 2c 20 74 | 68 65 0a 58 66 69 6c 65 |eally, t|he.Xfile|
|00005ca0| 20 73 68 6f 75 6c 64 20 | 6c 6f 6f 6b 20 6c 69 6b | should |look lik|
|00005cb0| 65 20 74 68 65 20 74 61 | 62 6c 65 2c 20 73 6f 20 |e the ta|ble, so |
|00005cc0| 74 68 61 74 20 69 74 20 | 69 73 20 61 73 20 65 61 |that it |is as ea|
|00005cd0| 73 79 20 61 73 20 70 6f | 73 73 69 62 6c 65 0a 58 |sy as po|ssible.X|
|00005ce0| 74 6f 20 63 6f 70 79 20 | 74 61 62 6c 65 73 20 66 |to copy |tables f|
|00005cf0| 72 6f 6d 20 62 6f 6f 6b | 73 20 61 6e 64 20 6d 61 |rom book|s and ma|
|00005d00| 67 61 7a 69 6e 65 20 61 | 72 74 69 63 6c 65 73 2e |gazine a|rticles.|
|00005d10| 0a 58 2e 52 45 0a 58 2e | 49 50 20 22 41 64 64 20 |.X.RE.X.|IP "Add |
|00005d20| 61 20 6e 65 77 20 74 79 | 70 65 20 74 6f 20 74 68 |a new ty|pe to th|
|00005d30| 65 20 74 62 61 5f 74 79 | 70 65 20 74 61 62 6c 65 |e tba_ty|pe table|
|00005d40| 2e 22 0a 58 41 62 6f 75 | 74 20 61 20 74 68 69 72 |.".XAbou|t a thir|
|00005d50| 64 20 6f 66 20 74 68 65 | 20 77 61 79 20 64 6f 77 |d of the| way dow|
|00005d60| 6e 20 74 68 65 20 74 61 | 62 6c 65 2e 63 20 66 69 |n the ta|ble.c fi|
|00005d70| 6c 65 20 69 73 20 61 6e | 20 61 72 72 61 79 20 6f |le is an| array o|
|00005d80| 66 20 73 74 72 75 63 74 | 75 72 65 73 0a 58 63 61 |f struct|ures.Xca|
|00005d90| 6c 6c 65 64 20 74 62 61 | 5f 74 79 70 65 2e 20 20 |lled tba|_type. |
|00005da0| 41 64 64 20 61 20 6e 65 | 77 20 73 74 72 75 63 74 |Add a ne|w struct|
|00005db0| 75 72 65 20 74 6f 20 74 | 68 69 73 20 61 72 72 61 |ure to t|his arra|
|00005dc0| 79 20 61 6e 64 20 74 68 | 65 20 73 65 63 6f 6e 64 |y and th|e second|
|00005dd0| 20 74 6f 20 6c 61 73 74 | 0a 58 69 74 65 6d 2e 20 | to last|.Xitem. |
|00005de0| 20 54 68 65 20 66 69 72 | 73 74 20 66 69 65 6c 64 | The fir|st field|
|00005df0| 20 69 6e 20 74 68 65 20 | 73 74 72 75 63 74 75 72 | in the |structur|
|00005e00| 65 20 73 68 6f 75 6c 64 | 20 62 65 20 74 68 65 20 |e should| be the |
|00005e10| 28 63 61 70 69 74 61 6c | 69 7a 65 64 29 20 6e 61 |(capital|ized) na|
|00005e20| 6d 65 0a 58 6f 66 20 79 | 6f 75 72 20 6e 65 77 20 |me.Xof y|our new |
|00005e30| 74 61 62 6c 65 20 74 79 | 70 65 2e 20 20 54 68 65 |table ty|pe. The|
|00005e40| 20 73 65 63 6f 6e 64 20 | 66 69 65 6c 64 20 73 68 | second |field sh|
|00005e50| 6f 75 6c 64 20 62 65 20 | 69 74 27 73 20 75 6e 69 |ould be |it's uni|
|00005e60| 71 75 65 20 6e 75 6d 62 | 65 72 2e 0a 58 41 20 73 |que numb|er..XA s|
|00005e70| 61 6d 70 6c 65 20 6e 65 | 77 20 73 74 72 75 63 74 |ample ne|w struct|
|00005e80| 75 72 65 20 69 73 20 22 | 7b 22 4e 65 77 22 2c 31 |ure is "|{"New",1|
|00005e90| 30 7d 22 2e 20 20 54 68 | 65 20 6e 65 77 20 6c 69 |0}". Th|e new li|
|00005ea0| 73 74 20 77 6f 75 6c 64 | 20 6c 69 6b 65 20 6c 69 |st would| like li|
|00005eb0| 6b 65 20 74 68 69 73 3a | 0a 58 7b 22 53 69 6d 70 |ke this:|.X{"Simp|
|00005ec0| 6c 65 22 2c 20 31 7d 2c | 20 7b 22 4d 75 6c 74 69 |le", 1},| {"Multi|
|00005ed0| 70 6c 65 22 2c 32 7d 2c | 20 7b 22 4e 65 77 22 2c |ple",2},| {"New",|
|00005ee0| 33 7d 2c 20 7b 4e 55 4c | 4c 2c 20 30 7d 2e 20 20 |3}, {NUL|L, 0}. |
|00005ef0| 54 68 65 20 6e 75 6d 62 | 65 72 20 79 6f 75 20 75 |The numb|er you u|
|00005f00| 73 65 64 20 0a 58 73 68 | 6f 75 6c 64 20 62 65 20 |sed .Xsh|ould be |
|00005f10| 6f 6e 65 20 6d 6f 72 65 | 20 74 68 61 6e 20 74 68 |one more| than th|
|00005f20| 65 20 6e 75 6d 62 65 72 | 20 63 75 72 72 65 6e 74 |e number| current|
|00005f30| 6c 79 20 69 6e 20 75 73 | 65 2e 0a 58 2e 49 50 20 |ly in us|e..X.IP |
|00005f40| 22 41 64 64 20 6e 65 77 | 20 6d 65 74 68 6f 64 73 |"Add new| methods|
|00005f50| 20 74 6f 20 74 68 65 20 | 64 69 73 70 61 74 63 68 | to the |dispatch|
|00005f60| 20 74 61 62 6c 65 73 2e | 22 0a 58 52 69 67 68 74 | tables.|".XRight|
|00005f70| 20 61 66 74 65 72 20 74 | 68 65 20 74 62 61 5f 74 | after t|he tba_t|
|00005f80| 79 70 65 20 61 72 72 61 | 79 20 61 72 65 20 74 68 |ype arra|y are th|
|00005f90| 65 20 61 72 72 61 79 73 | 20 75 73 65 64 20 74 6f |e arrays| used to|
|00005fa0| 20 64 69 73 70 61 74 63 | 68 20 6d 65 73 73 61 67 | dispatc|h messag|
|00005fb0| 65 73 2e 0a 58 41 64 64 | 20 79 6f 75 72 20 72 6f |es..XAdd| your ro|
|00005fc0| 75 74 69 6e 65 73 20 61 | 66 74 65 72 20 74 68 65 |utines a|fter the|
|00005fd0| 20 72 6f 75 74 69 6e 65 | 73 20 61 6c 72 65 61 64 | routine|s alread|
|00005fe0| 79 20 74 68 65 72 65 2e | 20 20 49 66 20 61 20 67 |y there.| If a g|
|00005ff0| 69 76 65 6e 20 6d 65 73 | 73 61 67 65 0a 58 69 73 |iven mes|sage.Xis|
|00006000| 20 6c 65 67 61 6c 2c 20 | 74 68 65 6e 20 70 75 74 | legal, |then put|
|00006010| 20 69 6e 20 69 6c 6c 65 | 67 61 6c 2e 20 20 4e 6f | in ille|gal. No|
|00006020| 74 65 20 74 68 61 74 20 | 74 61 62 6c 65 20 74 79 |te that |table ty|
|00006030| 70 65 20 30 20 64 6f 65 | 73 20 6e 6f 74 20 65 78 |pe 0 doe|s not ex|
|00006040| 69 73 74 2c 0a 58 73 6f | 20 61 6e 20 6d 65 73 73 |ist,.Xso| an mess|
|00006050| 61 67 65 20 73 65 6e 74 | 20 74 6f 20 30 20 69 73 |age sent| to 0 is|
|00006060| 20 69 6c 6c 65 67 61 6c | 2e 20 20 54 68 61 74 20 | illegal|. That |
|00006070| 69 73 20 77 68 79 20 74 | 68 65 20 66 69 72 73 74 |is why t|he first|
|00006080| 20 65 6e 74 72 79 20 69 | 6e 20 65 61 63 68 0a 58 | entry i|n each.X|
|00006090| 61 72 72 61 79 20 69 73 | 20 69 6c 6c 65 67 61 6c |array is| illegal|
|000060a0| 2e 0a 58 2e 49 50 20 22 | 43 72 65 61 74 65 20 74 |..X.IP "|Create t|
|000060b0| 68 65 20 6e 65 77 20 64 | 61 74 61 20 73 74 72 75 |he new d|ata stru|
|000060c0| 63 74 75 72 65 2e 22 0a | 58 54 68 69 73 20 69 73 |cture.".|XThis is|
|000060d0| 20 70 72 65 74 74 79 20 | 65 61 73 79 2e 20 20 4d | pretty |easy. M|
|000060e0| 61 6b 65 20 73 75 72 65 | 20 74 68 65 20 66 69 72 |ake sure| the fir|
|000060f0| 73 74 20 66 69 65 6c 64 | 20 69 73 20 61 6e 20 69 |st field| is an i|
|00006100| 6e 74 65 67 65 72 20 63 | 61 6c 6c 65 64 0a 58 74 |nteger c|alled.Xt|
|00006110| 79 70 65 2c 20 73 6f 20 | 74 68 61 74 20 74 68 65 |ype, so |that the|
|00006120| 20 73 74 72 75 63 74 75 | 72 65 20 6f 76 65 72 6c | structu|re overl|
|00006130| 61 79 20 63 6f 64 65 20 | 77 6f 72 6b 73 20 63 6f |ay code |works co|
|00006140| 72 72 65 63 74 6c 79 2e | 20 20 54 68 65 79 20 6a |rrectly.| They j|
|00006150| 75 73 74 0a 58 74 72 61 | 6e 73 6c 61 74 65 20 65 |ust.Xtra|nslate e|
|00006160| 61 63 68 20 66 69 65 6c | 64 20 66 72 6f 6d 20 79 |ach fiel|d from y|
|00006170| 6f 75 20 74 61 62 6c 65 | 20 66 69 6c 65 20 74 6f |ou table| file to|
|00006180| 20 62 65 20 61 20 66 69 | 65 6c 64 20 69 6e 20 79 | be a fi|eld in y|
|00006190| 6f 75 72 20 73 74 72 75 | 63 74 75 72 65 2e 0a 58 |our stru|cture..X|
|000061a0| 57 68 65 72 65 20 70 6f | 73 73 69 62 6c 65 2c 20 |Where po|ssible, |
|000061b0| 74 72 79 20 74 6f 20 68 | 61 76 65 20 73 69 6d 69 |try to h|ave simi|
|000061c0| 6c 61 72 20 66 69 65 6c | 64 73 20 69 6e 20 6f 74 |lar fiel|ds in ot|
|000061d0| 68 65 72 20 74 61 62 6c | 65 20 73 74 72 75 63 74 |her tabl|e struct|
|000061e0| 75 72 65 73 0a 58 6f 76 | 65 72 6c 61 79 20 77 69 |ures.Xov|erlay wi|
|000061f0| 74 68 20 66 69 65 6c 64 | 73 20 69 6e 20 79 6f 75 |th field|s in you|
|00006200| 72 20 73 74 72 75 63 74 | 75 72 65 2e 20 20 54 68 |r struct|ure. Th|
|00006210| 69 73 20 64 61 74 61 20 | 73 74 72 75 63 74 75 72 |is data |structur|
|00006220| 65 2c 20 61 73 20 77 65 | 6c 6c 0a 58 61 73 20 74 |e, as we|ll.Xas t|
|00006230| 68 65 20 64 65 63 6c 61 | 72 61 74 69 6f 6e 73 20 |he decla|rations |
|00006240| 66 6f 72 20 79 6f 75 72 | 20 6e 65 77 20 6d 65 74 |for your| new met|
|00006250| 68 6f 64 20 66 75 6e 63 | 74 69 6f 6e 73 20 73 68 |hod func|tions sh|
|00006260| 6f 75 6c 64 20 62 65 20 | 70 75 74 20 69 6e 20 61 |ould be |put in a|
|00006270| 0a 58 66 69 6c 65 20 63 | 61 6c 6c 65 64 20 74 61 |.Xfile c|alled ta|
|00006280| 62 6c 65 6e 65 77 2e 68 | 2e 20 20 41 64 64 20 74 |blenew.h|. Add t|
|00006290| 68 69 73 20 66 69 6c 65 | 20 74 6f 20 74 68 65 20 |his file| to the |
|000062a0| 6f 74 68 65 72 20 2e 68 | 20 66 69 6c 65 73 20 69 |other .h| files i|
|000062b0| 6e 63 6c 75 64 65 64 0a | 58 69 6e 20 74 61 62 6c |ncluded.|Xin tabl|
|000062c0| 65 2e 68 2e 20 20 59 6f | 75 72 20 73 74 72 75 63 |e.h. Yo|ur struc|
|000062d0| 74 75 72 65 20 73 68 6f | 75 6c 64 20 62 65 20 63 |ture sho|uld be c|
|000062e0| 61 6c 6c 65 64 20 74 61 | 62 6c 65 6e 65 77 5f 74 |alled ta|blenew_t|
|000062f0| 2e 0a 58 2e 49 50 20 22 | 4e 61 6d 69 6e 67 20 43 |..X.IP "|Naming C|
|00006300| 6f 6e 76 65 6e 73 69 6f | 6e 73 22 0a 58 2e 50 50 |onvensio|ns".X.PP|
|00006310| 0a 58 54 68 65 20 66 69 | 6c 65 20 77 68 69 63 68 |.XThe fi|le which|
|00006320| 20 63 6f 6e 74 61 69 6e | 73 20 79 6f 75 72 20 6d | contain|s your m|
|00006330| 65 74 68 6f 64 73 20 73 | 68 6f 75 6c 64 20 62 65 |ethods s|hould be|
|00006340| 20 6e 61 6d 65 64 20 74 | 61 62 6c 65 6e 65 77 2e | named t|ablenew.|
|00006350| 63 2c 20 61 73 73 75 6d | 69 6e 67 0a 58 79 6f 75 |c, assum|ing.Xyou|
|00006360| 72 20 66 69 6c 65 20 74 | 79 70 65 20 69 73 20 63 |r file t|ype is c|
|00006370| 61 6c 6c 65 64 20 6e 65 | 77 2e 20 20 54 68 65 20 |alled ne|w. The |
|00006380| 61 6e 79 20 70 75 62 6c | 69 63 20 66 75 6e 63 74 |any publ|ic funct|
|00006390| 69 6f 6e 73 20 77 68 69 | 63 68 20 79 6f 75 20 77 |ions whi|ch you w|
|000063a0| 72 69 74 65 2c 0a 58 65 | 73 70 65 63 69 61 6c 6c |rite,.Xe|speciall|
|000063b0| 79 20 6d 65 74 68 6f 64 | 20 66 75 6e 63 74 69 6f |y method| functio|
|000063c0| 6e 73 2c 20 73 68 6f 75 | 6c 64 20 62 65 20 6e 61 |ns, shou|ld be na|
|000063d0| 6d 65 64 20 74 62 5f 6e | 65 77 5f 20 66 6f 6c 6c |med tb_n|ew_ foll|
|000063e0| 6f 77 65 64 20 62 79 20 | 74 68 65 20 6e 61 6d 65 |owed by |the name|
|000063f0| 20 0a 58 6f 66 20 74 68 | 65 20 6d 65 73 73 61 67 | .Xof th|e messag|
+--------+-------------------------+-------------------------+--------+--------+
Only 25.0 KB of data is shown above.