home *** CD-ROM | disk | FTP | other *** search
/ Source Code 1992 March / Source_Code_CD-ROM_Walnut_Creek_March_1992.iso / usenet / compsrcs / misc / volume07 / tm < prev    next >
SHell self-extracting ARchive  |  1991-08-27  |  8.7 KB

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: tm

ConfidenceProgramDetectionMatch TypeSupport
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 C source text default
99% file C source, 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 application/mbox default



hex view
+--------+-------------------------+-------------------------+--------+--------+
|00000000| 46 72 6f 6d 20 64 65 63 | 77 72 6c 21 64 65 63 76 |From dec|wrl!decv|
|00000010| 61 78 21 6d 63 6e 63 21 | 67 61 74 65 63 68 21 70 |ax!mcnc!|gatech!p|
|00000020| 75 72 64 75 65 21 74 75 | 74 2e 63 69 73 2e 6f 68 |urdue!tu|t.cis.oh|
|00000030| 69 6f 2d 73 74 61 74 65 | 2e 65 64 75 21 70 74 2e |io-state|.edu!pt.|
|00000040| 63 73 2e 63 6d 75 2e 65 | 64 75 21 72 6f 63 68 65 |cs.cmu.e|du!roche|
|00000050| 73 74 65 72 21 72 69 74 | 21 74 72 6f 70 69 78 21 |ster!rit|!tropix!|
|00000060| 6d 6f 73 63 6f 6d 21 75 | 72 2d 76 61 6c 68 61 6c |moscom!u|r-valhal|
|00000070| 6c 61 21 75 68 75 72 61 | 2e 63 63 2e 72 6f 63 68 |la!uhura|.cc.roch|
|00000080| 65 73 74 65 72 2e 65 64 | 75 21 73 75 6e 79 62 63 |ester.ed|u!sunybc|
|00000090| 73 21 72 75 74 67 65 72 | 73 21 63 73 2e 75 74 65 |s!rutger|s!cs.ute|
|000000a0| 78 61 73 2e 65 64 75 21 | 75 75 6e 65 74 21 61 6c |xas.edu!|uunet!al|
|000000b0| 6c 62 65 72 79 20 54 75 | 65 20 41 75 67 20 32 32 |lbery Tu|e Aug 22|
|000000c0| 20 30 38 3a 31 35 3a 32 | 34 20 50 44 54 20 31 39 | 08:15:2|4 PDT 19|
|000000d0| 38 39 0a 41 72 74 69 63 | 6c 65 20 31 30 34 33 20 |89.Artic|le 1043 |
|000000e0| 6f 66 20 63 6f 6d 70 2e | 73 6f 75 72 63 65 73 2e |of comp.|sources.|
|000000f0| 6d 69 73 63 3a 0a 50 61 | 74 68 3a 20 64 65 63 77 |misc:.Pa|th: decw|
|00000100| 72 6c 21 64 65 63 76 61 | 78 21 6d 63 6e 63 21 67 |rl!decva|x!mcnc!g|
|00000110| 61 74 65 63 68 21 70 75 | 72 64 75 65 21 74 75 74 |atech!pu|rdue!tut|
|00000120| 2e 63 69 73 2e 6f 68 69 | 6f 2d 73 74 61 74 65 2e |.cis.ohi|o-state.|
|00000130| 65 64 75 21 70 74 2e 63 | 73 2e 63 6d 75 2e 65 64 |edu!pt.c|s.cmu.ed|
|00000140| 75 21 72 6f 63 68 65 73 | 74 65 72 21 72 69 74 21 |u!roches|ter!rit!|
|00000150| 74 72 6f 70 69 78 21 6d | 6f 73 63 6f 6d 21 75 72 |tropix!m|oscom!ur|
|00000160| 2d 76 61 6c 68 61 6c 6c | 61 21 75 68 75 72 61 2e |-valhall|a!uhura.|
|00000170| 63 63 2e 72 6f 63 68 65 | 73 74 65 72 2e 65 64 75 |cc.roche|ster.edu|
|00000180| 21 73 75 6e 79 62 63 73 | 21 72 75 74 67 65 72 73 |!sunybcs|!rutgers|
|00000190| 21 63 73 2e 75 74 65 78 | 61 73 2e 65 64 75 21 75 |!cs.utex|as.edu!u|
|000001a0| 75 6e 65 74 21 61 6c 6c | 62 65 72 79 0a 46 72 6f |unet!all|bery.Fro|
|000001b0| 6d 3a 20 61 6c 6c 62 65 | 72 79 40 75 75 6e 65 74 |m: allbe|ry@uunet|
|000001c0| 2e 55 55 2e 4e 45 54 20 | 28 42 72 61 6e 64 6f 6e |.UU.NET |(Brandon|
|000001d0| 20 53 2e 20 41 6c 6c 62 | 65 72 79 20 2d 20 63 6f | S. Allb|ery - co|
|000001e0| 6d 70 2e 73 6f 75 72 63 | 65 73 2e 6d 69 73 63 29 |mp.sourc|es.misc)|
|000001f0| 0a 4e 65 77 73 67 72 6f | 75 70 73 3a 20 63 6f 6d |.Newsgro|ups: com|
|00000200| 70 2e 73 6f 75 72 63 65 | 73 2e 6d 69 73 63 0a 53 |p.source|s.misc.S|
|00000210| 75 62 6a 65 63 74 3a 20 | 76 30 37 69 30 35 34 3a |ubject: |v07i054:|
|00000220| 20 73 69 6d 70 6c 65 20 | 76 74 31 30 30 20 65 6d | simple |vt100 em|
|00000230| 75 6c 61 74 6f 72 20 66 | 6f 72 20 41 70 6f 6c 6c |ulator f|or Apoll|
|00000240| 6f 73 0a 4d 65 73 73 61 | 67 65 2d 49 44 3a 20 3c |os.Messa|ge-ID: <|
|00000250| 35 39 32 32 39 40 75 75 | 6e 65 74 2e 55 55 2e 4e |59229@uu|net.UU.N|
|00000260| 45 54 3e 0a 44 61 74 65 | 3a 20 38 20 41 75 67 20 |ET>.Date|: 8 Aug |
|00000270| 38 39 20 30 30 3a 30 34 | 3a 30 34 20 47 4d 54 0a |89 00:04|:04 GMT.|
|00000280| 53 65 6e 64 65 72 3a 20 | 61 6c 6c 62 65 72 79 40 |Sender: |allbery@|
|00000290| 75 75 6e 65 74 2e 55 55 | 2e 4e 45 54 0a 52 65 70 |uunet.UU|.NET.Rep|
|000002a0| 6c 79 2d 54 6f 3a 20 73 | 38 37 33 30 36 37 39 40 |ly-To: s|8730679@|
|000002b0| 73 70 65 63 74 72 75 6d | 2e 65 65 63 73 2e 75 6e |spectrum|.eecs.un|
|000002c0| 73 77 2e 6f 7a 2e 61 75 | 20 28 20 54 68 65 20 49 |sw.oz.au| ( The I|
|000002d0| 6e 71 75 69 73 69 74 6f | 72 20 29 0a 4c 69 6e 65 |nquisito|r ).Line|
|000002e0| 73 3a 20 32 38 35 0a 41 | 70 70 72 6f 76 65 64 3a |s: 285.A|pproved:|
|000002f0| 20 61 6c 6c 62 65 72 79 | 40 75 75 6e 65 74 2e 55 | allbery|@uunet.U|
|00000300| 55 2e 4e 45 54 20 28 42 | 72 61 6e 64 6f 6e 20 53 |U.NET (B|randon S|
|00000310| 2e 20 41 6c 6c 62 65 72 | 79 20 2d 20 63 6f 6d 70 |. Allber|y - comp|
|00000320| 2e 73 6f 75 72 63 65 73 | 2e 6d 69 73 63 29 0a 0a |.sources|.misc)..|
|00000330| 50 6f 73 74 69 6e 67 2d | 6e 75 6d 62 65 72 3a 20 |Posting-|number: |
|00000340| 56 6f 6c 75 6d 65 20 37 | 2c 20 49 73 73 75 65 20 |Volume 7|, Issue |
|00000350| 35 34 0a 53 75 62 6d 69 | 74 74 65 64 2d 62 79 3a |54.Submi|tted-by:|
|00000360| 20 73 38 37 33 30 36 37 | 39 40 73 70 65 63 74 72 | s873067|9@spectr|
|00000370| 75 6d 2e 65 65 63 73 2e | 75 6e 73 77 2e 6f 7a 2e |um.eecs.|unsw.oz.|
|00000380| 61 75 20 28 20 54 68 65 | 20 49 6e 71 75 69 73 69 |au ( The| Inquisi|
|00000390| 74 6f 72 20 29 0a 41 72 | 63 68 69 76 65 2d 6e 61 |tor ).Ar|chive-na|
|000003a0| 6d 65 3a 20 74 6d 0a 0a | 09 49 20 77 72 6f 74 65 |me: tm..|.I wrote|
|000003b0| 20 74 68 69 73 20 70 72 | 6f 67 72 61 6d 20 61 66 | this pr|ogram af|
|000003c0| 74 65 72 20 62 65 63 6f | 6d 69 6e 67 20 66 72 75 |ter beco|ming fru|
|000003d0| 73 74 72 61 74 65 64 20 | 61 74 20 74 68 65 0a 72 |strated |at the.r|
|000003e0| 65 67 75 6c 61 72 20 66 | 61 69 6c 75 72 65 20 6f |egular f|ailure o|
|000003f0| 6e 20 74 68 65 20 70 61 | 72 74 20 6f 66 20 74 68 |n the pa|rt of th|
|00000400| 65 20 61 70 6f 6c 6c 6f | 20 76 74 31 30 30 20 65 |e apollo| vt100 e|
|00000410| 6d 75 6c 61 74 6f 72 20 | 74 6f 0a 63 6f 6d 65 20 |mulator |to.come |
|00000420| 75 70 2e 20 49 74 20 69 | 73 20 61 20 73 69 6d 70 |up. It i|s a simp|
|00000430| 6c 65 20 74 65 72 6d 69 | 6e 61 6c 20 65 6d 75 6c |le termi|nal emul|
|00000440| 61 74 6f 72 20 77 68 69 | 63 68 20 69 73 20 73 75 |ator whi|ch is su|
|00000450| 66 66 69 63 69 65 6e 74 | 0a 74 6f 20 72 75 6e 20 |fficient|.to run |
|00000460| 76 6e 2e 20 48 61 63 6b | 20 63 72 61 73 68 65 73 |vn. Hack| crashes|
|00000470| 20 75 6e 64 65 72 20 69 | 74 20 61 6e 64 20 74 68 | under i|t and th|
|00000480| 65 72 65 20 61 72 65 20 | 62 75 67 73 2c 20 62 75 |ere are |bugs, bu|
|00000490| 74 20 69 74 20 69 73 0a | 74 68 65 20 73 68 65 6c |t it is.|the shel|
|000004a0| 6c 20 6f 66 20 61 20 64 | 65 63 65 6e 74 20 65 6d |l of a d|ecent em|
|000004b0| 75 6c 61 74 6f 72 2e 0a | 0a 09 09 54 72 6f 79 20 |ulator..|...Troy |
|000004c0| 52 6f 6c 6c 6f 0a 09 61 | 76 65 6e 67 65 72 40 72 |Rollo..a|venger@r|
|000004d0| 75 6e 78 2e 69 70 73 2e | 6f 7a 2e 61 75 0a 09 73 |unx.ips.|oz.au..s|
|000004e0| 38 37 33 30 36 37 39 40 | 73 70 65 63 74 72 75 6d |8730679@|spectrum|
|000004f0| 2e 65 65 63 73 2e 75 6e | 73 77 2e 6f 7a 2e 61 75 |.eecs.un|sw.oz.au|
|00000500| 0a 09 38 37 33 30 36 37 | 39 40 65 6c 65 63 37 30 |..873067|9@elec70|
|00000510| 61 2e 65 65 63 73 2e 75 | 6e 73 77 2e 6f 7a 2e 61 |a.eecs.u|nsw.oz.a|
|00000520| 75 0a 09 74 72 6f 79 5f | 72 6f 6c 6c 6f 40 37 31 |u..troy_|rollo@71|
|00000530| 32 2e 35 30 32 40 66 69 | 64 6f 67 61 74 65 2e 66 |2.502@fi|dogate.f|
|00000540| 69 64 6f 2e 6f 7a 2e 61 | 75 0a 0a 23 21 20 2f 62 |ido.oz.a|u..#! /b|
|00000550| 69 6e 2f 73 68 0a 23 20 | 54 68 69 73 20 69 73 20 |in/sh.# |This is |
|00000560| 61 20 73 68 65 6c 6c 20 | 61 72 63 68 69 76 65 2e |a shell |archive.|
|00000570| 20 20 52 65 6d 6f 76 65 | 20 61 6e 79 74 68 69 6e | Remove| anythin|
|00000580| 67 20 62 65 66 6f 72 65 | 20 74 68 69 73 20 6c 69 |g before| this li|
|00000590| 6e 65 2c 20 74 68 65 6e | 0a 23 20 75 6e 70 61 63 |ne, then|.# unpac|
|000005a0| 6b 20 69 74 20 62 79 20 | 73 61 76 69 6e 67 20 69 |k it by |saving i|
|000005b0| 74 20 69 6e 20 61 20 66 | 69 6c 65 20 61 6e 64 20 |t in a f|ile and |
|000005c0| 74 79 70 69 6e 67 20 22 | 73 68 20 66 69 6c 65 22 |typing "|sh file"|
|000005d0| 2e 20 20 28 46 69 6c 65 | 73 0a 23 20 75 6e 70 61 |. (File|s.# unpa|
|000005e0| 63 6b 65 64 20 77 69 6c | 6c 20 62 65 20 6f 77 6e |cked wil|l be own|
|000005f0| 65 64 20 62 79 20 79 6f | 75 20 61 6e 64 20 68 61 |ed by yo|u and ha|
|00000600| 76 65 20 64 65 66 61 75 | 6c 74 20 70 65 72 6d 69 |ve defau|lt permi|
|00000610| 73 73 69 6f 6e 73 2e 29 | 0a 23 0a 23 20 54 68 69 |ssions.)|.#.# Thi|
|00000620| 73 20 61 72 63 68 69 76 | 65 20 63 6f 6e 74 61 69 |s archiv|e contai|
|00000630| 6e 73 3a 0a 23 20 52 45 | 41 44 4d 45 20 4d 61 6b |ns:.# RE|ADME Mak|
|00000640| 65 66 69 6c 65 20 74 65 | 72 6d 63 61 70 20 74 6d |efile te|rmcap tm|
|00000650| 2e 63 0a 0a 65 63 68 6f | 20 78 20 2d 20 52 45 41 |.c..echo| x - REA|
|00000660| 44 4d 45 0a 63 61 74 20 | 3e 20 22 52 45 41 44 4d |DME.cat |> "READM|
|00000670| 45 22 20 3c 3c 20 27 2f | 2f 45 2a 4f 2a 46 20 52 |E" << '/|/E*O*F R|
|00000680| 45 41 44 4d 45 2f 2f 27 | 0a 09 09 20 54 68 69 73 |EADME//'|... This|
|00000690| 74 65 72 6d 20 74 65 72 | 6d 69 6e 61 6c 20 65 6d |term ter|minal em|
|000006a0| 75 6c 61 74 6f 72 0a 0a | 09 42 79 20 54 72 6f 79 |ulator..|.By Troy|
|000006b0| 20 52 6f 6c 6c 6f 20 31 | 39 38 39 0a 0a 09 54 68 | Rollo 1|989...Th|
|000006c0| 65 20 74 68 69 73 74 65 | 72 6d 20 74 65 72 6d 69 |e thiste|rm termi|
|000006d0| 6e 61 6c 20 65 6d 75 6c | 61 74 6f 72 20 69 73 20 |nal emul|ator is |
|000006e0| 61 20 6d 69 6e 69 6d 75 | 6d 20 74 65 72 6d 69 6e |a minimu|m termin|
|000006f0| 61 6c 0a 09 65 6d 75 6c | 61 74 6f 72 20 66 6f 72 |al..emul|ator for|
|00000700| 20 74 68 65 20 61 70 6f | 6c 6c 6f 20 64 6f 6d 61 | the apo|llo doma|
|00000710| 69 6e 73 2e 20 54 68 69 | 73 20 76 65 72 73 69 6f |ins. Thi|s versio|
|00000720| 6e 20 68 61 73 20 6f 6e | 6c 79 0a 09 74 77 6f 20 |n has on|ly..two |
|00000730| 63 6f 6e 74 72 6f 6c 20 | 73 65 71 75 65 6e 63 65 |control |sequence|
|00000740| 73 3a 0a 09 09 43 74 72 | 6c 2d 4c 20 28 61 73 63 |s:...Ctr|l-L (asc|
|00000750| 69 69 20 30 78 63 29 20 | 63 6c 65 61 72 73 20 74 |ii 0xc) |clears t|
|00000760| 68 65 20 73 63 72 65 65 | 6e 20 28 70 61 64 29 0a |he scree|n (pad).|
|00000770| 09 09 41 6e 20 65 73 63 | 61 70 65 20 63 68 61 72 |..An esc|ape char|
|00000780| 61 63 74 65 72 20 66 6f | 6c 6c 6f 77 65 64 20 62 |acter fo|llowed b|
|00000790| 79 20 78 2b 27 20 27 2c | 20 79 2b 27 20 27 20 6d |y x+' ',| y+' ' m|
|000007a0| 6f 76 65 73 0a 09 74 6f | 20 74 68 65 20 67 69 76 |oves..to| the giv|
|000007b0| 65 6e 20 6c 6f 63 61 74 | 69 6f 6e 20 69 6e 20 74 |en locat|ion in t|
|000007c0| 68 65 20 70 61 64 2e 0a | 0a 09 41 64 64 69 74 69 |he pad..|..Additi|
|000007d0| 6f 6e 61 6c 20 63 6f 6e | 74 72 6f 6c 20 73 65 71 |onal con|trol seq|
|000007e0| 75 65 6e 63 65 73 20 63 | 61 6e 20 62 65 20 63 72 |uences c|an be cr|
|000007f0| 65 61 74 65 64 20 62 79 | 20 6d 6f 64 69 66 79 69 |eated by| modifyi|
|00000800| 6e 67 0a 09 74 68 65 20 | 78 66 72 65 61 64 20 72 |ng..the |xfread r|
|00000810| 6f 75 74 69 6e 65 2e 20 | 54 68 65 20 6f 6e 65 73 |outine. |The ones|
|00000820| 20 61 6c 72 65 61 64 79 | 20 69 6e 73 74 61 6c 6c | already| install|
|00000830| 65 64 20 63 61 6e 2c 20 | 6f 66 20 63 6f 75 72 73 |ed can, |of cours|
|00000840| 65 0a 09 62 65 20 6d 6f | 64 69 66 69 65 64 2e 0a |e..be mo|dified..|
|00000850| 0a 09 54 68 69 73 74 65 | 72 6d 20 75 73 65 73 20 |..Thiste|rm uses |
|00000860| 74 68 65 20 70 73 65 75 | 64 6f 20 74 74 79 20 64 |the pseu|do tty d|
|00000870| 65 76 69 63 65 20 65 6e | 74 72 69 65 73 20 2f 64 |evice en|tries /d|
|00000880| 65 76 2f 70 74 79 70 62 | 20 61 6e 64 0a 09 2f 64 |ev/ptypb| and../d|
|00000890| 65 76 2f 74 74 79 70 62 | 2e 20 41 6e 20 69 6d 70 |ev/ttypb|. An imp|
|000008a0| 72 6f 76 65 64 20 76 65 | 72 73 69 6f 6e 20 77 6f |roved ve|rsion wo|
|000008b0| 75 6c 64 20 73 74 61 72 | 74 20 61 74 20 5b 70 74 |uld star|t at [pt|
|000008c0| 5d 74 79 70 30 20 61 6e | 64 20 77 6f 72 6b 0a 09 |]typ0 an|d work..|
|000008d0| 75 70 20 74 6f 77 61 72 | 64 73 20 5b 70 74 5d 74 |up towar|ds [pt]t|
|000008e0| 79 70 66 2c 20 61 6c 6c | 6f 77 69 6e 67 20 6d 6f |ypf, all|owing mo|
|000008f0| 72 65 20 74 68 61 6e 20 | 6f 6e 65 20 74 68 69 73 |re than |one this|
|00000900| 74 65 72 6d 0a 09 74 65 | 72 6d 69 6e 61 6c 20 65 |term..te|rminal e|
|00000910| 6d 75 6c 61 74 6f 72 20 | 74 6f 20 72 75 6e 20 61 |mulator |to run a|
|00000920| 74 20 6f 6e 63 65 2e 20 | 49 74 20 6d 69 67 68 74 |t once. |It might|
|00000930| 20 61 6c 73 6f 20 72 65 | 6d 6f 76 65 20 62 6f 72 | also re|move bor|
|00000940| 64 65 72 73 2c 0a 09 61 | 6e 64 20 75 73 65 20 70 |ders,..a|nd use p|
|00000950| 61 64 5f 24 73 65 74 5f | 66 75 6c 6c 5f 77 69 6e |ad_$set_|full_win|
|00000960| 64 6f 77 20 61 6e 64 20 | 74 68 65 20 63 75 72 72 |dow and |the curr|
|00000970| 65 6e 74 20 73 63 61 6c | 65 20 66 61 63 74 6f 72 |ent scal|e factor|
|00000980| 20 74 6f 0a 09 73 65 74 | 20 74 68 65 20 73 69 7a | to..set| the siz|
|00000990| 65 20 6f 66 20 74 68 65 | 20 77 69 6e 64 6f 77 20 |e of the| window |
|000009a0| 74 6f 20 6d 61 74 63 68 | 20 74 68 65 20 73 69 7a |to match| the siz|
|000009b0| 65 20 6f 66 20 74 68 65 | 20 70 73 65 75 64 6f 0a |e of the| pseudo.|
|000009c0| 09 73 63 72 65 65 6e 2e | 0a 0a 09 54 6f 20 75 73 |.screen.|...To us|
|000009d0| 65 20 74 68 69 73 2c 20 | 66 69 72 73 74 20 72 75 |e this, |first ru|
|000009e0| 6e 20 74 68 69 73 74 65 | 72 6d 2c 20 74 68 65 6e |n thiste|rm, then|
|000009f0| 20 73 65 74 20 74 68 65 | 20 65 6e 76 69 72 6f 6e | set the| environ|
|00000a00| 6d 65 6e 74 20 76 61 72 | 69 61 62 6c 65 73 3a 0a |ment var|iables:.|
|00000a10| 0a 09 4d 4f 52 45 3d 2d | 63 0a 09 54 45 52 4d 3d |..MORE=-|c..TERM=|
|00000a20| 74 68 69 73 0a 09 54 45 | 52 4d 43 41 50 3d 79 6f |this..TE|RMCAP=yo|
|00000a30| 75 72 5f 74 65 72 6d 63 | 61 70 5f 70 61 74 68 0a |ur_termc|ap_path.|
|00000a40| 0a 09 61 76 65 6e 67 65 | 72 40 72 75 6e 78 2e 69 |..avenge|r@runx.i|
|00000a50| 70 73 2e 6f 7a 2e 61 75 | 0a 09 73 38 37 33 30 36 |ps.oz.au|..s87306|
|00000a60| 37 39 40 73 70 65 63 74 | 72 75 6d 2e 65 65 63 73 |79@spect|rum.eecs|
|00000a70| 2e 75 6e 73 77 2e 6f 7a | 2e 61 75 20 28 73 6f 6d |.unsw.oz|.au (som|
|00000a80| 65 74 69 6d 65 73 29 0a | 09 38 37 33 30 36 37 39 |etimes).|.8730679|
|00000a90| 40 65 6c 65 63 37 30 61 | 2e 65 65 63 73 2e 75 6e |@elec70a|.eecs.un|
|00000aa0| 73 77 2e 6f 7a 2e 61 75 | 20 28 73 6f 6d 65 74 69 |sw.oz.au| (someti|
|00000ab0| 6d 65 73 29 0a 09 74 72 | 6f 79 5f 72 6f 6c 6c 6f |mes)..tr|oy_rollo|
|00000ac0| 40 37 31 32 2e 35 30 32 | 40 66 69 64 6f 67 61 74 |@712.502|@fidogat|
|00000ad0| 65 2e 66 69 64 6f 2e 6f | 7a 2e 61 75 20 28 63 61 |e.fido.o|z.au (ca|
|00000ae0| 6e 27 74 20 72 65 70 6c | 79 29 0a 2f 2f 45 2a 4f |n't repl|y).//E*O|
|00000af0| 2a 46 20 52 45 41 44 4d | 45 2f 2f 0a 0a 65 63 68 |*F READM|E//..ech|
|00000b00| 6f 20 78 20 2d 20 4d 61 | 6b 65 66 69 6c 65 0a 63 |o x - Ma|kefile.c|
|00000b10| 61 74 20 3e 20 22 4d 61 | 6b 65 66 69 6c 65 22 20 |at > "Ma|kefile" |
|00000b20| 3c 3c 20 27 2f 2f 45 2a | 4f 2a 46 20 4d 61 6b 65 |<< '//E*|O*F Make|
|00000b30| 66 69 6c 65 2f 2f 27 0a | 23 20 4d 61 6b 65 66 69 |file//'.|# Makefi|
|00000b40| 6c 65 20 66 6f 72 20 74 | 68 69 73 74 65 72 6d 0a |le for t|histerm.|
|00000b50| 23 20 56 65 72 79 20 65 | 61 73 79 3a 0a 0a 74 68 |# Very e|asy:..th|
|00000b60| 69 73 74 65 72 6d 3a 20 | 74 6d 2e 63 0a 09 63 63 |isterm: |tm.c..cc|
|00000b70| 20 2d 6f 20 74 68 69 73 | 74 65 72 6d 20 74 6d 2e | -o this|term tm.|
|00000b80| 63 0a 2f 2f 45 2a 4f 2a | 46 20 4d 61 6b 65 66 69 |c.//E*O*|F Makefi|
|00000b90| 6c 65 2f 2f 0a 0a 65 63 | 68 6f 20 78 20 2d 20 74 |le//..ec|ho x - t|
|00000ba0| 65 72 6d 63 61 70 0a 63 | 61 74 20 3e 20 22 74 65 |ermcap.c|at > "te|
|00000bb0| 72 6d 63 61 70 22 20 3c | 3c 20 27 2f 2f 45 2a 4f |rmcap" <|< '//E*O|
|00000bc0| 2a 46 20 74 65 72 6d 63 | 61 70 2f 2f 27 0a 23 0a |*F termc|ap//'.#.|
|00000bd0| 23 20 54 65 72 6d 63 61 | 70 20 66 69 6c 65 20 66 |# Termca|p file f|
|00000be0| 6f 72 20 6d 79 20 6e 65 | 77 73 20 72 65 61 64 69 |or my ne|ws readi|
|00000bf0| 6e 67 20 65 6d 75 6c 61 | 74 6f 72 0a 23 0a 23 20 |ng emula|tor.#.# |
|00000c00| 72 75 6e 20 74 6d 2c 20 | 74 68 65 6e 20 73 65 74 |run tm, |then set|
|00000c10| 3a 0a 23 0a 23 09 4d 4f | 52 45 3d 2d 63 0a 23 09 |:.#.#.MO|RE=-c.#.|
|00000c20| 54 45 52 4d 3d 74 68 69 | 73 0a 23 09 54 45 52 4d |TERM=thi|s.#.TERM|
|00000c30| 43 41 50 3d 24 48 4f 4d | 45 2f 74 65 72 6d 63 61 |CAP=$HOM|E/termca|
|00000c40| 70 0a 23 0a 74 68 7c 74 | 68 69 73 7c 74 68 69 73 |p.#.th|t|his|this|
|00000c50| 20 65 6d 75 6c 61 74 6f | 72 3a 5c 0a 09 3a 63 6d | emulato|r:\..:cm|
|00000c60| 3d 5c 45 25 72 25 2b 20 | 25 2b 20 3a 63 6c 3d 5c |=\E%r%+ |%+ :cl=\|
|00000c70| 31 34 3a 6c 69 23 32 35 | 3a 63 6f 23 38 30 3a 62 |14:li#25|:co#80:b|
|00000c80| 73 3a 0a 2f 2f 45 2a 4f | 2a 46 20 74 65 72 6d 63 |s:.//E*O|*F termc|
|00000c90| 61 70 2f 2f 0a 0a 65 63 | 68 6f 20 78 20 2d 20 74 |ap//..ec|ho x - t|
|00000ca0| 6d 2e 63 0a 63 61 74 20 | 3e 20 22 74 6d 2e 63 22 |m.c.cat |> "tm.c"|
|00000cb0| 20 3c 3c 20 27 2f 2f 45 | 2a 4f 2a 46 20 74 6d 2e | << '//E|*O*F tm.|
|00000cc0| 63 2f 2f 27 0a 2f 2a 20 | 74 68 69 73 74 65 72 6d |c//'./* |thisterm|
|00000cd0| 20 74 65 72 6d 69 6e 61 | 6c 20 65 6d 75 6c 61 74 | termina|l emulat|
|00000ce0| 6f 72 0a 09 42 79 20 54 | 72 6f 79 20 52 6f 6c 6c |or..By T|roy Roll|
|00000cf0| 6f 20 31 39 38 39 0a 0a | 09 54 68 65 20 74 68 69 |o 1989..|.The thi|
|00000d00| 73 74 65 72 6d 20 74 65 | 72 6d 69 6e 61 6c 20 65 |sterm te|rminal e|
|00000d10| 6d 75 6c 61 74 6f 72 20 | 69 73 20 61 20 6d 69 6e |mulator |is a min|
|00000d20| 69 6d 75 6d 20 74 65 72 | 6d 69 6e 61 6c 0a 09 65 |imum ter|minal..e|
|00000d30| 6d 75 6c 61 74 6f 72 20 | 66 6f 72 20 74 68 65 20 |mulator |for the |
|00000d40| 61 70 6f 6c 6c 6f 20 64 | 6f 6d 61 69 6e 73 2e 20 |apollo d|omains. |
|00000d50| 54 68 69 73 20 76 65 72 | 73 69 6f 6e 20 68 61 73 |This ver|sion has|
|00000d60| 20 6f 6e 6c 79 0a 09 74 | 77 6f 20 63 6f 6e 74 72 | only..t|wo contr|
|00000d70| 6f 6c 20 73 65 71 75 65 | 6e 63 65 73 3a 0a 09 09 |ol seque|nces:...|
|00000d80| 43 74 72 6c 2d 4c 20 28 | 61 73 63 69 69 20 30 78 |Ctrl-L (|ascii 0x|
|00000d90| 63 29 20 63 6c 65 61 72 | 73 20 74 68 65 20 73 63 |c) clear|s the sc|
|00000da0| 72 65 65 6e 20 28 70 61 | 64 29 0a 09 09 41 6e 20 |reen (pa|d)...An |
|00000db0| 65 73 63 61 70 65 20 63 | 68 61 72 61 63 74 65 72 |escape c|haracter|
|00000dc0| 20 66 6f 6c 6c 6f 77 65 | 64 20 62 79 20 78 2b 27 | followe|d by x+'|
|00000dd0| 20 27 2c 20 79 2b 27 20 | 27 20 6d 6f 76 65 73 0a | ', y+' |' moves.|
|00000de0| 09 74 6f 20 74 68 65 20 | 67 69 76 65 6e 20 6c 6f |.to the |given lo|
|00000df0| 63 61 74 69 6f 6e 20 69 | 6e 20 74 68 65 20 70 61 |cation i|n the pa|
|00000e00| 64 2e 0a 0a 09 41 64 64 | 69 74 69 6f 6e 61 6c 20 |d....Add|itional |
|00000e10| 63 6f 6e 74 72 6f 6c 20 | 73 65 71 75 65 6e 63 65 |control |sequence|
|00000e20| 73 20 63 61 6e 20 62 65 | 20 63 72 65 61 74 65 64 |s can be| created|
|00000e30| 20 62 79 20 6d 6f 64 69 | 66 79 69 6e 67 0a 09 74 | by modi|fying..t|
|00000e40| 68 65 20 78 66 72 65 61 | 64 20 72 6f 75 74 69 6e |he xfrea|d routin|
|00000e50| 65 2e 20 54 68 65 20 6f | 6e 65 73 20 61 6c 72 65 |e. The o|nes alre|
|00000e60| 61 64 79 20 69 6e 73 74 | 61 6c 6c 65 64 20 63 61 |ady inst|alled ca|
|00000e70| 6e 2c 20 6f 66 20 63 6f | 75 72 73 65 0a 09 62 65 |n, of co|urse..be|
|00000e80| 20 6d 6f 64 69 66 69 65 | 64 2e 0a 0a 09 54 68 69 | modifie|d....Thi|
|00000e90| 73 74 65 72 6d 20 75 73 | 65 73 20 74 68 65 20 70 |sterm us|es the p|
|00000ea0| 73 65 75 64 6f 20 74 74 | 79 20 64 65 76 69 63 65 |seudo tt|y device|
|00000eb0| 20 65 6e 74 72 69 65 73 | 20 2f 64 65 76 2f 70 74 | entries| /dev/pt|
|00000ec0| 79 70 62 20 61 6e 64 0a | 09 2f 64 65 76 2f 74 74 |ypb and.|./dev/tt|
|00000ed0| 79 70 62 2e 20 41 6e 20 | 69 6d 70 72 6f 76 65 64 |ypb. An |improved|
|00000ee0| 20 76 65 72 73 69 6f 6e | 20 77 6f 75 6c 64 20 73 | version| would s|
|00000ef0| 74 61 72 74 20 61 74 20 | 5b 70 74 5d 74 79 70 30 |tart at |[pt]typ0|
|00000f00| 20 61 6e 64 20 77 6f 72 | 6b 0a 09 75 70 20 74 6f | and wor|k..up to|
|00000f10| 77 61 72 64 73 20 5b 70 | 74 5d 74 79 70 66 2c 20 |wards [p|t]typf, |
|00000f20| 61 6c 6c 6f 77 69 6e 67 | 20 6d 6f 72 65 20 74 68 |allowing| more th|
|00000f30| 61 6e 20 6f 6e 65 20 74 | 68 69 73 74 65 72 6d 0a |an one t|histerm.|
|00000f40| 09 74 65 72 6d 69 6e 61 | 6c 20 65 6d 75 6c 61 74 |.termina|l emulat|
|00000f50| 6f 72 20 74 6f 20 72 75 | 6e 20 61 74 20 6f 6e 63 |or to ru|n at onc|
|00000f60| 65 2e 20 49 74 20 6d 69 | 67 68 74 20 61 6c 73 6f |e. It mi|ght also|
|00000f70| 20 72 65 6d 6f 76 65 20 | 62 6f 72 64 65 72 73 2c | remove |borders,|
|00000f80| 0a 09 61 6e 64 20 75 73 | 65 20 70 61 64 5f 24 73 |..and us|e pad_$s|
|00000f90| 65 74 5f 66 75 6c 6c 5f | 77 69 6e 64 6f 77 20 61 |et_full_|window a|
|00000fa0| 6e 64 20 74 68 65 20 63 | 75 72 72 65 6e 74 20 73 |nd the c|urrent s|
|00000fb0| 63 61 6c 65 20 66 61 63 | 74 6f 72 20 74 6f 0a 09 |cale fac|tor to..|
|00000fc0| 73 65 74 20 74 68 65 20 | 73 69 7a 65 20 6f 66 20 |set the |size of |
|00000fd0| 74 68 65 20 77 69 6e 64 | 6f 77 20 74 6f 20 6d 61 |the wind|ow to ma|
|00000fe0| 74 63 68 20 74 68 65 20 | 73 69 7a 65 20 6f 66 20 |tch the |size of |
|00000ff0| 74 68 65 20 70 73 65 75 | 64 6f 0a 09 73 63 72 65 |the pseu|do..scre|
|00001000| 65 6e 2e 0a 0a 09 61 76 | 65 6e 67 65 72 40 72 75 |en....av|enger@ru|
|00001010| 6e 78 2e 69 70 73 2e 6f | 7a 2e 61 75 0a 09 73 38 |nx.ips.o|z.au..s8|
|00001020| 37 33 30 36 37 39 40 73 | 70 65 63 74 72 75 6d 2e |730679@s|pectrum.|
|00001030| 65 65 63 73 2e 75 6e 73 | 77 2e 6f 7a 2e 61 75 20 |eecs.uns|w.oz.au |
|00001040| 28 73 6f 6d 65 74 69 6d | 65 73 29 0a 09 38 37 33 |(sometim|es)..873|
|00001050| 30 36 37 39 40 65 6c 65 | 63 37 30 61 2e 65 65 63 |0679@ele|c70a.eec|
|00001060| 73 2e 75 6e 73 77 2e 6f | 7a 2e 61 75 20 28 73 6f |s.unsw.o|z.au (so|
|00001070| 6d 65 74 69 6d 65 73 29 | 0a 09 74 72 6f 79 5f 72 |metimes)|..troy_r|
|00001080| 6f 6c 6c 6f 40 37 31 32 | 2e 35 30 32 40 66 69 64 |ollo@712|.502@fid|
|00001090| 6f 67 61 74 65 2e 66 69 | 64 6f 2e 6f 7a 2e 61 75 |ogate.fi|do.oz.au|
|000010a0| 20 28 63 61 6e 27 74 20 | 72 65 70 6c 79 29 0a 2a | (can't |reply).*|
|000010b0| 2f 0a 0a 23 69 6e 63 6c | 75 64 65 20 3c 6e 65 74 |/..#incl|ude <net|
|000010c0| 64 62 2e 68 3e 0a 23 69 | 6e 63 6c 75 64 65 20 3c |db.h>.#i|nclude <|
|000010d0| 73 74 64 69 6f 2e 68 3e | 0a 23 69 6e 63 6c 75 64 |stdio.h>|.#includ|
|000010e0| 65 20 3c 73 69 67 6e 61 | 6c 2e 68 3e 20 0a 23 69 |e <signa|l.h> .#i|
|000010f0| 6e 63 6c 75 64 65 20 3c | 66 63 6e 74 6c 2e 68 3e |nclude <|fcntl.h>|
|00001100| 0a 23 69 6e 63 6c 75 64 | 65 20 3c 61 70 6f 6c 6c |.#includ|e <apoll|
|00001110| 6f 2f 62 61 73 65 2e 68 | 3e 0a 23 69 6e 63 6c 75 |o/base.h|>.#inclu|
|00001120| 64 65 20 3c 61 70 6f 6c | 6c 6f 2f 70 61 64 2e 68 |de <apol|lo/pad.h|
|00001130| 3e 0a 23 69 6e 63 6c 75 | 64 65 20 3c 61 70 6f 6c |>.#inclu|de <apol|
|00001140| 6c 6f 2f 65 72 72 6f 72 | 2e 68 3e 0a 0a 23 64 65 |lo/error|.h>..#de|
|00001150| 66 69 6e 65 20 43 4f 4c | 55 4d 4e 53 20 38 30 0a |fine COL|UMNS 80.|
|00001160| 23 64 65 66 69 6e 65 20 | 52 4f 57 53 20 32 35 0a |#define |ROWS 25.|
|00001170| 0a 2f 2a 20 49 20 74 68 | 69 6e 6b 20 66 64 32 70 |./* I th|ink fd2p|
|00001180| 20 69 73 20 61 20 72 65 | 6c 69 63 20 66 72 6f 6d | is a re|lic from|
|00001190| 20 61 20 70 72 65 76 69 | 6f 75 73 20 6c 69 66 65 | a previ|ous life|
|000011a0| 2e 20 54 68 69 73 20 70 | 72 6f 67 72 61 6d 20 65 |. This p|rogram e|
|000011b0| 76 6f 6c 76 65 64 0a 09 | 66 72 6f 6d 20 61 6e 20 |volved..|from an |
|000011c0| 72 65 78 65 63 20 70 61 | 74 72 6f 6e 20 2a 2f 0a |rexec pa|tron */.|
|000011d0| 69 6e 74 20 66 64 32 70 | 20 3d 20 31 3b 0a 73 74 |int fd2p| = 1;.st|
|000011e0| 61 74 75 73 5f 24 74 20 | 73 74 61 74 75 73 3b 0a |atus_$t |status;.|
|000011f0| 73 74 72 65 61 6d 5f 24 | 73 6b 5f 74 20 73 6b 20 |stream_$|sk_t sk |
|00001200| 3d 20 7b 0a 09 09 30 6c | 2c 0a 09 09 30 6c 2c 0a |= {...0l|,...0l,.|
|00001210| 09 09 30 6c 0a 09 7d 3b | 0a 0a 2f 2a 20 48 6d 6d |..0l..};|../* Hmm|
|00001220| 2e 2e 2e 20 69 6e 74 65 | 72 65 73 74 69 6e 67 2e |... inte|resting.|
|00001230| 2e 2e 20 49 20 64 6f 6e | 27 74 20 61 63 74 75 61 |.. I don|'t actua|
|00001240| 6c 6c 79 20 75 73 65 20 | 61 72 67 63 20 6f 72 20 |lly use |argc or |
|00001250| 61 72 67 76 20 2a 2f 0a | 6d 61 69 6e 28 69 6e 74 |argv */.|main(int|
|00001260| 20 61 72 67 63 2c 20 63 | 68 61 72 20 2a 2a 61 72 | argc, c|har **ar|
|00001270| 67 76 29 0a 7b 0a 20 20 | 20 20 20 20 20 20 63 68 |gv).{. | ch|
|00001280| 61 72 20 63 5b 32 35 36 | 5d 3b 09 0a 20 20 20 20 |ar c[256|];.. |
|00001290| 20 20 20 20 69 6e 74 20 | 63 63 3b 0a 20 20 20 20 | int |cc;. |
|000012a0| 20 20 20 20 69 6e 74 20 | 6e 3b 0a 20 20 20 20 20 | int |n;. |
|000012b0| 20 20 20 69 6e 74 20 70 | 6e 2c 20 70 69 64 3b 0a | int p|n, pid;.|
|000012c0| 09 69 6e 74 20 72 65 6d | 2c 20 70 72 6f 63 3b 0a |.int rem|, proc;.|
|000012d0| 20 20 20 20 20 20 20 20 | 0a 0a 09 2f 2a 20 70 75 | |.../* pu|
|000012e0| 74 20 74 68 65 20 70 61 | 64 20 69 6e 20 72 61 77 |t the pa|d in raw|
|000012f0| 20 6d 6f 64 65 2e 20 54 | 68 69 73 20 69 73 20 61 | mode. T|his is a|
|00001300| 20 72 65 71 75 69 72 65 | 6d 65 6e 74 20 66 6f 72 | require|ment for|
|00001310| 20 61 6e 79 20 74 65 72 | 6d 69 6e 61 6c 0a 09 20 | any ter|minal.. |
|00001320| 20 20 65 6d 75 6c 61 74 | 6f 72 20 2a 2f 0a 09 70 | emulat|or */..p|
|00001330| 61 64 5f 24 72 61 77 28 | 31 2c 20 26 73 74 61 74 |ad_$raw(|1, &stat|
|00001340| 75 73 29 3b 0a 09 2f 2a | 20 4e 6f 77 20 6f 70 65 |us);../*| Now ope|
|00001350| 6e 20 74 68 65 20 6d 61 | 73 74 65 72 20 73 69 64 |n the ma|ster sid|
|00001360| 65 20 6f 66 20 74 68 65 | 20 70 73 65 75 64 6f 20 |e of the| pseudo |
|00001370| 74 74 79 20 2a 2f 0a 09 | 72 65 6d 3d 6f 70 65 6e |tty */..|rem=open|
|00001380| 28 22 2f 64 65 76 2f 70 | 74 79 70 62 22 2c 20 4f |("/dev/p|typb", O|
|00001390| 5f 52 44 57 52 29 3b 0a | 09 2f 2a 20 41 6e 64 20 |_RDWR);.|./* And |
|000013a0| 74 68 65 20 73 6c 61 76 | 65 20 73 69 64 65 20 2a |the slav|e side *|
|000013b0| 2f 0a 09 70 72 6f 63 3d | 6f 70 65 6e 28 22 2f 64 |/..proc=|open("/d|
|000013c0| 65 76 2f 74 74 79 70 62 | 22 2c 20 4f 5f 52 44 57 |ev/ttypb|", O_RDW|
|000013d0| 52 29 3b 0a 20 20 20 20 | 20 20 20 20 69 66 20 28 |R);. | if (|
|000013e0| 72 65 6d 3d 3d 2d 31 20 | 7c 7c 20 70 72 6f 63 3d |rem==-1 ||| proc=|
|000013f0| 3d 2d 31 29 0a 09 09 2f | 2a 20 43 6f 6d 70 6c 61 |=-1).../|* Compla|
|00001400| 69 6e 20 69 66 20 75 6e | 61 62 6c 65 20 74 6f 20 |in if un|able to |
|00001410| 6f 70 65 6e 20 65 69 74 | 68 65 72 20 2d 20 70 72 |open eit|her - pr|
|00001420| 6f 62 61 62 6c 79 20 73 | 68 6f 75 6c 64 0a 09 09 |obably s|hould...|
|00001430| 20 20 20 74 72 79 20 74 | 6f 20 66 69 6e 64 20 61 | try t|o find a|
|00001440| 6e 6f 74 68 65 72 20 6f | 6e 65 20 2a 2f 0a 09 09 |nother o|ne */...|
|00001450| 65 78 69 74 28 31 29 3b | 0a 09 69 66 28 28 70 69 |exit(1);|..if((pi|
|00001460| 64 3d 66 6f 72 6b 28 29 | 29 3d 3d 2d 31 29 20 7b |d=fork()|)==-1) {|
|00001470| 0a 09 09 66 70 72 69 6e | 74 66 28 73 74 64 65 72 |...fprin|tf(stder|
|00001480| 72 2c 20 22 25 73 3a 20 | 63 61 6e 27 74 20 66 6f |r, "%s: |can't fo|
|00001490| 72 6b 5c 6e 22 2c 20 61 | 72 67 76 5b 30 5d 29 3b |rk\n", a|rgv[0]);|
|000014a0| 0a 09 09 65 78 69 74 28 | 31 29 3b 0a 09 7d 0a 09 |...exit(|1);..}..|
|000014b0| 69 66 20 28 70 69 64 3d | 3d 30 29 20 7b 0a 09 09 |if (pid=|=0) {...|
|000014c0| 2f 2a 20 54 68 69 73 20 | 70 72 6f 63 65 73 73 20 |/* This |process |
|000014d0| 6c 69 76 65 73 20 6f 6e | 20 74 68 65 20 73 6c 61 |lives on| the sla|
|000014e0| 76 65 20 73 69 64 65 20 | 6f 66 20 74 68 65 20 70 |ve side |of the p|
|000014f0| 73 65 75 64 6f 20 74 74 | 79 0a 09 09 20 20 20 4d |seudo tt|y... M|
|00001500| 61 6b 65 20 74 68 65 20 | 70 73 65 75 64 6f 20 74 |ake the |pseudo t|
|00001510| 74 79 20 73 74 64 69 6e | 2c 20 73 74 64 6f 75 74 |ty stdin|, stdout|
|00001520| 20 61 6e 64 20 73 74 64 | 65 72 72 20 2a 2f 0a 09 | and std|err */..|
|00001530| 09 63 6c 6f 73 65 28 30 | 29 3b 0a 09 09 63 6c 6f |.close(0|);...clo|
|00001540| 73 65 28 31 29 3b 0a 09 | 09 63 6c 6f 73 65 28 32 |se(1);..|.close(2|
|00001550| 29 3b 0a 09 09 64 75 70 | 28 70 72 6f 63 29 3b 0a |);...dup|(proc);.|
|00001560| 09 09 64 75 70 28 70 72 | 6f 63 29 3b 0a 09 09 64 |..dup(pr|oc);...d|
|00001570| 75 70 28 70 72 6f 63 29 | 3b 0a 09 09 63 6c 6f 73 |up(proc)|;...clos|
|00001580| 65 28 70 72 6f 63 29 3b | 0a 09 09 63 6c 6f 73 65 |e(proc);|...close|
|00001590| 28 72 65 6d 29 3b 0a 09 | 09 2f 2a 20 49 20 75 73 |(rem);..|./* I us|
|000015a0| 65 20 6b 73 68 20 2d 20 | 79 6f 75 20 6d 69 67 68 |e ksh - |you migh|
|000015b0| 74 20 70 72 65 66 65 72 | 20 61 6e 6f 74 68 65 72 |t prefer| another|
|000015c0| 20 73 68 65 6c 6c 20 2a | 2f 0a 09 09 65 78 65 63 | shell *|/...exec|
|000015d0| 6c 28 22 2f 62 69 6e 2f | 6b 73 68 22 2c 20 22 6b |l("/bin/|ksh", "k|
|000015e0| 73 68 22 2c 20 22 2d 69 | 22 2c 20 30 29 3b 0a 09 |sh", "-i|", 0);..|
|000015f0| 7d 0a 09 63 6c 6f 73 65 | 28 70 72 6f 63 29 3b 0a |}..close|(proc);.|
|00001600| 09 2f 2a 20 43 6c 6f 73 | 65 20 74 68 65 20 73 6c |./* Clos|e the sl|
|00001610| 61 76 65 20 73 69 64 65 | 20 73 6f 20 74 68 61 74 |ave side| so that|
|00001620| 20 77 68 65 6e 20 74 68 | 65 20 6c 61 73 74 20 73 | when th|e last s|
|00001630| 6c 61 76 65 20 73 69 64 | 65 20 70 72 6f 63 65 73 |lave sid|e proces|
|00001640| 73 20 64 69 65 73 0a 09 | 20 20 20 6f 72 20 63 6c |s dies..| or cl|
|00001650| 6f 73 65 73 20 69 74 73 | 20 6c 61 73 74 20 66 69 |oses its| last fi|
|00001660| 6c 65 20 64 65 73 63 72 | 69 70 74 6f 72 20 77 65 |le descr|iptor we|
|00001670| 20 68 65 61 72 20 61 62 | 6f 75 74 20 69 74 20 6f | hear ab|out it o|
|00001680| 6e 20 74 68 65 20 6d 61 | 73 74 65 72 20 73 69 64 |n the ma|ster sid|
|00001690| 65 20 2a 2f 0a 20 20 20 | 20 20 20 20 20 69 66 20 |e */. | if |
|000016a0| 28 28 70 6e 3d 66 6f 72 | 6b 28 29 29 3d 3d 2d 31 |((pn=for|k())==-1|
|000016b0| 29 20 7b 0a 09 09 66 70 | 72 69 6e 74 66 28 73 74 |) {...fp|rintf(st|
|000016c0| 64 65 72 72 2c 20 22 25 | 73 3a 20 43 61 6e 27 74 |derr, "%|s: Can't|
|000016d0| 20 66 6f 72 6b 5c 6e 22 | 2c 20 61 72 67 76 5b 30 | fork\n"|, argv[0|
|000016e0| 5d 29 3b 0a 09 09 6b 69 | 6c 6c 28 70 69 64 2c 39 |]);...ki|ll(pid,9|
|000016f0| 29 3b 0a 09 09 65 78 69 | 74 28 31 29 3b 0a 20 20 |);...exi|t(1);. |
|00001700| 20 20 20 20 20 20 7d 0a | 09 2f 2a 20 43 72 65 61 | }.|./* Crea|
|00001710| 74 65 20 61 20 66 72 61 | 6d 65 20 74 6f 20 61 6c |te a fra|me to al|
|00001720| 6c 6f 77 20 74 68 65 20 | 63 75 72 73 6f 72 20 74 |low the |cursor t|
|00001730| 6f 20 72 6f 61 6d 20 61 | 72 6f 75 6e 64 20 74 68 |o roam a|round th|
|00001740| 65 20 70 73 65 75 64 6f | 20 73 63 72 65 65 6e 20 |e pseudo| screen |
|00001750| 2a 2f 0a 09 70 61 64 5f | 24 63 72 65 61 74 65 5f |*/..pad_|$create_|
|00001760| 66 72 61 6d 65 28 31 2c | 20 43 4f 4c 55 4d 4e 53 |frame(1,| COLUMNS|
|00001770| 2c 20 52 4f 57 53 2c 20 | 26 73 74 61 74 75 73 29 |, ROWS, |&status)|
|00001780| 3b 0a 09 2f 2a 20 54 68 | 65 20 70 61 72 65 6e 74 |;../* Th|e parent|
|00001790| 20 72 65 61 64 73 20 6f | 6e 20 74 68 65 20 6d 61 | reads o|n the ma|
|000017a0| 73 74 65 72 20 73 69 64 | 65 20 28 6f 75 74 70 75 |ster sid|e (outpu|
|000017b0| 74 20 6f 66 20 74 68 65 | 20 73 6c 61 63 65 20 73 |t of the| slace s|
|000017c0| 69 64 65 29 20 75 6e 74 | 69 6c 0a 09 20 20 20 74 |ide) unt|il.. t|
|000017d0| 68 65 72 65 20 61 72 65 | 20 6e 6f 20 6d 6f 72 65 |here are| no more|
|000017e0| 20 70 72 6f 63 65 73 73 | 65 73 20 77 72 69 74 69 | process|es writi|
|000017f0| 6e 67 20 6f 6e 20 74 68 | 65 20 70 73 65 75 64 6f |ng on th|e pseudo|
|00001800| 20 74 74 79 2e 20 41 74 | 20 74 68 69 73 20 70 6f | tty. At| this po|
|00001810| 69 6e 74 0a 09 20 20 20 | 69 74 20 65 6e 74 65 72 |int.. |it enter|
|00001820| 73 20 61 20 73 75 69 63 | 69 64 65 20 70 61 63 74 |s a suic|ide pact|
|00001830| 20 2d 20 6b 69 6c 6c 69 | 6e 67 20 74 68 65 20 63 | - killi|ng the c|
|00001840| 68 69 6c 64 20 77 69 74 | 68 20 61 20 6d 61 63 68 |hild wit|h a mach|
|00001850| 69 6e 65 20 67 75 6e 20 | 28 73 69 67 6e 61 6c 0a |ine gun |(signal.|
|00001860| 09 20 20 20 39 29 20 61 | 6e 64 20 64 69 65 69 6e |. 9) a|nd diein|
|00001870| 67 20 69 74 73 65 6c 66 | 2e 0a 09 20 20 20 49 6e |g itself|... In|
|00001880| 74 69 6c 20 69 74 20 64 | 69 65 73 2c 20 74 68 65 |til it d|ies, the|
|00001890| 20 73 6c 61 76 65 20 73 | 69 64 65 20 74 72 61 6e | slave s|ide tran|
|000018a0| 73 66 65 72 73 20 61 6c | 6c 20 73 74 64 69 6e 20 |sfers al|l stdin |
|000018b0| 74 6f 20 74 68 65 20 70 | 73 65 75 64 6f 20 74 74 |to the p|seudo tt|
|000018c0| 79 09 2a 2f 0a 20 20 20 | 20 20 20 20 20 69 66 20 |y.*/. | if |
|000018d0| 28 70 6e 21 3d 30 29 20 | 7b 0a 09 09 77 68 69 6c |(pn!=0) |{...whil|
|000018e0| 65 20 28 78 66 72 65 61 | 64 28 72 65 6d 29 20 21 |e (xfrea|d(rem) !|
|000018f0| 3d 2d 31 29 3b 0a 09 09 | 70 61 64 5f 24 63 6f 6f |=-1);...|pad_$coo|
|00001900| 6b 65 64 28 31 2c 20 26 | 73 74 61 74 75 73 29 3b |ked(1, &|status);|
|00001910| 0a 09 09 70 61 64 5f 24 | 64 65 6c 65 74 65 5f 66 |...pad_$|delete_f|
|00001920| 72 61 6d 65 28 31 2c 20 | 26 73 74 61 74 75 73 29 |rame(1, |&status)|
|00001930| 3b 0a 09 09 6b 69 6c 6c | 28 70 6e 2c 20 39 29 3b |;...kill|(pn, 9);|
|00001940| 0a 09 09 65 78 69 74 28 | 30 29 3b 0a 20 20 20 20 |...exit(|0);. |
|00001950| 20 20 20 20 7d 0a 20 20 | 20 20 20 20 20 20 65 6c | }. | el|
|00001960| 73 65 20 7b 0a 20 20 20 | 20 20 20 20 20 09 77 68 |se {. | .wh|
|00001970| 69 6c 65 20 28 28 6e 3d | 72 65 61 64 28 30 2c 20 |ile ((n=|read(0, |
|00001980| 63 2c 20 32 35 35 29 29 | 20 21 3d 20 30 29 0a 09 |c, 255))| != 0)..|
|00001990| 09 09 77 72 69 74 65 28 | 72 65 6d 2c 20 63 2c 20 |..write(|rem, c, |
|000019a0| 6e 29 3b 0a 20 20 20 20 | 20 20 20 20 7d 0a 7d 0a |n);. | }.}.|
|000019b0| 0a 0a 2f 2a 20 78 66 72 | 65 61 64 20 72 65 61 64 |../* xfr|ead read|
|000019c0| 73 20 66 72 6f 6d 20 74 | 68 65 20 70 73 65 75 64 |s from t|he pseud|
|000019d0| 6f 20 74 74 79 2c 20 61 | 6e 64 20 64 65 63 69 64 |o tty, a|nd decid|
|000019e0| 65 73 20 77 68 61 74 20 | 74 6f 20 64 6f 20 61 62 |es what |to do ab|
|000019f0| 6f 75 74 20 74 68 65 20 | 6f 75 74 70 75 74 2e 0a |out the |output..|
|00001a00| 20 20 20 49 74 27 73 20 | 66 61 69 72 6c 79 20 73 | It's |fairly s|
|00001a10| 74 72 61 69 67 68 74 20 | 66 6f 72 77 61 72 64 20 |traight |forward |
|00001a20| 2d 20 63 68 65 63 6b 73 | 20 66 6f 72 20 61 6e 79 |- checks| for any|
|00001a30| 20 73 70 65 63 69 66 69 | 65 64 20 63 6f 6e 74 72 | specifi|ed contr|
|00001a40| 6f 6c 20 63 68 61 72 61 | 63 74 65 72 2e 0a 20 20 |ol chara|cter.. |
|00001a50| 20 54 68 65 72 65 20 69 | 73 20 61 20 62 75 67 20 | There i|s a bug |
|00001a60| 69 6e 20 74 68 65 20 6e | 65 77 6c 69 6e 65 20 73 |in the n|ewline s|
|00001a70| 65 71 75 65 6e 63 65 20 | 2d 20 69 66 20 74 68 65 |equence |- if the|
|00001a80| 20 75 73 65 72 20 70 72 | 65 73 73 65 73 20 74 68 | user pr|esses th|
|00001a90| 65 20 70 61 67 65 20 75 | 70 20 6f 72 0a 20 20 20 |e page u|p or. |
|00001aa0| 73 68 69 66 74 2d 75 70 | 61 72 72 6f 77 20 6b 65 |shift-up|arrow ke|
|00001ab0| 79 73 2c 20 79 6f 75 20 | 63 61 6e 27 74 20 67 65 |ys, you |can't ge|
|00001ac0| 74 20 62 61 63 6b 20 6f | 6e 20 74 68 65 20 63 75 |t back o|n the cu|
|00001ad0| 72 72 65 6e 74 20 66 72 | 61 6d 65 2e 2e 2e 2e 20 |rrent fr|ame.... |
|00001ae0| 70 65 72 68 61 70 73 20 | 74 68 65 73 65 0a 20 20 |perhaps |these. |
|00001af0| 20 6b 65 79 73 20 73 68 | 6f 75 6c 64 20 62 65 20 | keys sh|ould be |
|00001b00| 72 65 64 65 66 69 6e 65 | 64 20 77 69 74 68 69 6e |redefine|d within|
|00001b10| 20 74 68 65 20 72 65 67 | 69 6f 6e 20 6f 66 20 74 | the reg|ion of t|
|00001b20| 68 65 20 70 61 64 2e 0a | 09 53 6f 6d 65 20 65 6e |he pad..|.Some en|
|00001b30| 68 61 6e 63 65 6d 65 6e | 74 73 20 6d 69 67 68 74 |hancemen|ts might|
|00001b40| 20 62 65 3a 0a 20 20 20 | 41 20 70 61 72 74 69 61 | be:. |A partia|
|00001b50| 6c 20 73 63 72 65 65 6e | 20 63 6c 65 61 72 69 6e |l screen| clearin|
|00001b60| 67 20 6f 70 74 69 6f 6e | 2e 0a 20 20 20 53 63 72 |g option|.. Scr|
|00001b70| 6f 6c 6c 20 66 6f 72 77 | 61 72 64 20 61 6e 64 20 |oll forw|ard and |
|00001b80| 62 61 63 6b 20 6f 6e 20 | 64 65 6d 61 6e 64 2e 0a |back on |demand..|
|00001b90| 20 20 20 43 68 61 6e 67 | 69 6e 67 20 66 6f 6e 74 | Chang|ing font|
|00001ba0| 20 28 70 65 72 68 61 70 | 73 20 6c 6f 61 64 69 6e | (perhap|s loadin|
|00001bb0| 67 20 61 6e 20 69 6e 76 | 65 72 73 65 20 66 6f 6e |g an inv|erse fon|
|00001bc0| 74 20 61 6e 64 20 75 73 | 69 6e 67 20 69 74 20 66 |t and us|ing it f|
|00001bd0| 6f 72 20 68 69 67 68 6c | 69 67 68 74 2e 0a 09 74 |or highl|ight...t|
|00001be0| 68 65 20 66 6f 6c 6c 6f | 77 69 6e 67 20 66 6f 6e |he follo|wing fon|
|00001bf0| 74 73 20 63 6f 75 6c 64 | 20 61 6c 73 6f 20 70 72 |ts could| also pr|
|00001c00| 6f 76 65 20 75 73 65 66 | 75 6c 20 61 73 20 62 75 |ove usef|ul as bu|
|00001c10| 69 6c 74 2d 69 6e 73 3a | 0a 09 20 20 69 74 61 6c |ilt-ins:|.. ital|
|00001c20| 69 63 73 0a 09 20 20 62 | 6f 6c 64 0a 09 20 20 74 |ics.. b|old.. t|
|00001c30| 69 6d 65 73 5f 72 6f 6d | 61 6e 0a 09 61 73 20 77 |imes_rom|an..as w|
|00001c40| 65 6c 6c 20 61 73 20 61 | 20 70 75 72 65 20 67 72 |ell as a| pure gr|
|00001c50| 61 70 68 69 63 73 20 66 | 6f 6e 74 20 28 73 61 79 |aphics f|ont (say|
|00001c60| 2c 20 61 20 37 78 31 20 | 66 6f 6e 74 20 77 69 74 |, a 7x1 |font wit|
|00001c70| 68 20 65 61 63 68 20 63 | 68 61 72 61 63 74 65 72 |h each c|haracter|
|00001c80| 0a 09 72 65 70 72 65 73 | 65 6e 74 69 6e 67 20 61 |..repres|enting a|
|00001c90| 20 73 65 71 75 65 6e 63 | 65 20 6f 66 20 70 69 78 | sequenc|e of pix|
|00001ca0| 65 6c 73 20 69 6e 20 61 | 20 76 65 72 74 69 63 61 |els in a| vertica|
|00001cb0| 6c 20 6c 69 6e 65 29 0a | 20 20 20 54 68 69 73 20 |l line).| This |
|00001cc0| 72 6f 75 74 69 6e 65 20 | 64 6f 65 73 6e 27 74 20 |routine |doesn't |
|00001cd0| 72 65 74 75 72 6e 20 75 | 6e 74 69 6c 20 74 68 65 |return u|ntil the|
|00001ce0| 72 65 20 61 72 65 20 6e | 6f 20 6d 6f 72 65 20 73 |re are n|o more s|
|00001cf0| 6c 61 76 65 73 20 75 73 | 69 6e 67 20 74 68 65 20 |laves us|ing the |
|00001d00| 70 73 65 75 64 6f 0a 20 | 20 20 74 74 79 0a 2a 2f |pseudo. | tty.*/|
|00001d10| 0a 69 6e 74 20 78 66 72 | 65 61 64 28 66 29 0a 69 |.int xfr|ead(f).i|
|00001d20| 6e 74 20 66 3b 0a 7b 0a | 09 63 68 61 72 20 62 3b |nt f;.{.|.char b;|
|00001d30| 0a 09 73 68 6f 72 74 20 | 78 2c 20 79 3b 0a 09 6c |..short |x, y;..l|
|00001d40| 6f 6e 67 20 6c 69 6e 65 | 2c 20 65 6f 66 3b 0a 09 |ong line|, eof;..|
|00001d50| 73 68 6f 72 74 20 78 6f | 2c 20 79 6f 3b 0a 0a 09 |short xo|, yo;...|
|00001d60| 77 68 69 6c 65 20 28 6b | 72 65 61 64 28 66 2c 26 |while (k|read(f,&|
|00001d70| 62 29 21 3d 2d 31 29 0a | 09 09 69 66 20 28 62 3d |b)!=-1).|..if (b=|
|00001d80| 3d 27 5c 30 33 33 27 29 | 20 7b 0a 09 09 09 6b 72 |='\033')| {....kr|
|00001d90| 65 61 64 28 66 2c 26 62 | 29 3b 0a 09 09 09 78 3d |ead(f,&b|);....x=|
|00001da0| 28 73 68 6f 72 74 29 20 | 28 62 2d 27 20 27 2b 31 |(short) |(b-' '+1|
|00001db0| 29 3b 0a 09 09 09 6b 72 | 65 61 64 28 66 2c 26 62 |);....kr|ead(f,&b|
|00001dc0| 29 3b 0a 09 09 09 79 3d | 28 73 68 6f 72 74 29 20 |);....y=|(short) |
|00001dd0| 28 62 2d 27 20 27 2b 31 | 29 3b 0a 09 09 09 70 61 |(b-' '+1|);....pa|
|00001de0| 64 5f 24 69 6e 71 5f 76 | 69 65 77 28 31 2c 20 31 |d_$inq_v|iew(1, 1|
|00001df0| 2c 20 26 6c 69 6e 65 2c | 20 26 65 6f 66 2c 20 26 |, &line,| &eof, &|
|00001e00| 78 6f 2c 20 26 79 6f 2c | 20 26 73 74 61 74 75 73 |xo, &yo,| &status|
|00001e10| 29 3b 0a 09 09 09 70 61 | 64 5f 24 6d 6f 76 65 28 |);....pa|d_$move(|
|00001e20| 31 2c 70 61 64 5f 24 61 | 62 73 6f 6c 75 74 65 2c |1,pad_$a|bsolute,|
|00001e30| 78 2c 79 2b 79 6f 2d 31 | 2c 26 73 74 61 74 75 73 |x,y+yo-1|,&status|
|00001e40| 29 3b 0a 09 09 09 77 72 | 69 74 65 28 31 2c 22 5c |);....wr|ite(1,"\|
|00001e50| 30 22 2c 32 29 3b 0a 09 | 09 7d 0a 09 09 65 6c 73 |0",2);..|.}...els|
|00001e60| 65 20 69 66 20 28 62 3d | 3d 27 5c 30 31 34 27 29 |e if (b=|='\014')|
|00001e70| 20 7b 0a 09 09 09 70 61 | 64 5f 24 63 6c 65 61 72 | {....pa|d_$clear|
|00001e80| 5f 66 72 61 6d 65 28 31 | 2c 20 73 6b 2c 20 26 73 |_frame(1|, sk, &s|
|00001e90| 74 61 74 75 73 29 3b 0a | 09 09 09 77 72 69 74 65 |tatus);.|...write|
|00001ea0| 28 31 2c 22 5c 30 22 2c | 32 29 3b 0a 09 09 7d 0a |(1,"\0",|2);...}.|
|00001eb0| 09 09 65 6c 73 65 20 7b | 0a 09 09 09 77 72 69 74 |..else {|....writ|
|00001ec0| 65 28 31 2c 26 62 2c 31 | 29 3b 0a 09 09 09 69 66 |e(1,&b,1|);....if|
|00001ed0| 20 28 62 3d 3d 27 5c 6e | 27 29 20 7b 0a 09 09 09 | (b=='\n|') {....|
|00001ee0| 09 70 61 64 5f 24 69 6e | 71 5f 76 69 65 77 28 31 |.pad_$in|q_view(1|
|00001ef0| 2c 20 31 2c 20 26 6c 69 | 6e 65 2c 20 26 65 6f 66 |, 1, &li|ne, &eof|
|00001f00| 2c 20 26 78 6f 2c 20 26 | 79 6f 2c 20 26 73 74 61 |, &xo, &|yo, &sta|
|00001f10| 74 75 73 29 3b 0a 09 09 | 09 09 70 61 64 5f 24 69 |tus);...|..pad_$i|
|00001f20| 6e 71 5f 70 6f 73 69 74 | 69 6f 6e 28 31 2c 20 26 |nq_posit|ion(1, &|
|00001f30| 78 2c 20 26 79 2c 20 26 | 73 74 61 74 75 73 29 3b |x, &y, &|status);|
|00001f40| 0a 09 09 09 09 69 66 20 | 28 79 2d 79 6f 2b 31 3d |.....if |(y-yo+1=|
|00001f50| 3d 32 35 29 20 7b 0a 09 | 09 09 09 09 70 61 64 5f |=25) {..|....pad_|
|00001f60| 24 73 65 74 5f 76 69 65 | 77 28 31 2c 20 31 2c 20 |$set_vie|w(1, 1, |
|00001f70| 6c 69 6e 65 2c 20 31 2c | 20 79 6f 2b 32 2c 20 26 |line, 1,| yo+2, &|
|00001f80| 73 74 61 74 75 73 29 3b | 0a 09 09 09 09 09 70 61 |status);|......pa|
|00001f90| 64 5f 24 63 72 65 61 74 | 65 5f 66 72 61 6d 65 28 |d_$creat|e_frame(|
|00001fa0| 31 2c 20 43 4f 4c 55 4d | 4e 53 2c 20 52 4f 57 53 |1, COLUM|NS, ROWS|
|00001fb0| 2c 20 26 73 74 61 74 75 | 73 29 3b 0a 09 09 09 09 |, &statu|s);.....|
|00001fc0| 7d 0a 09 09 09 7d 0a 09 | 09 7d 0a 09 72 65 74 75 |}....}..|.}..retu|
|00001fd0| 72 6e 20 28 2d 31 29 3b | 0a 7d 0a 0a 2f 2a 20 41 |rn (-1);|.}../* A|
|00001fe0| 20 62 75 66 66 65 72 65 | 64 20 72 65 61 64 20 2d | buffere|d read -|
|00001ff0| 20 72 65 74 75 72 6e 73 | 20 31 20 6f 6e 20 73 75 | returns| 1 on su|
|00002000| 63 63 65 73 73 2c 20 2d | 31 20 6f 6e 20 66 61 69 |ccess, -|1 on fai|
|00002010| 6c 75 72 65 20 28 6a 75 | 73 74 20 74 6f 20 62 65 |lure (ju|st to be|
|00002020| 20 64 69 66 66 69 63 75 | 6c 74 20 66 6f 72 0a 20 | difficu|lt for. |
|00002030| 20 20 61 6e 79 62 6f 64 | 79 20 75 73 69 6e 67 20 | anybod|y using |
|00002040| 69 74 20 61 73 20 74 68 | 65 20 61 72 67 75 6d 65 |it as th|e argume|
|00002050| 6e 74 20 74 6f 20 69 66 | 21 20 41 6e 64 20 61 6c |nt to if|! And al|
|00002060| 73 6f 20 66 6f 72 20 63 | 6f 6d 70 61 74 69 62 69 |so for c|ompatibi|
|00002070| 6c 69 74 79 20 77 69 74 | 68 20 74 68 65 0a 20 20 |lity wit|h the. |
|00002080| 20 76 61 6c 75 65 73 20 | 72 65 74 75 72 6e 65 64 | values |returned|
|00002090| 20 62 79 20 44 6f 6d 61 | 69 6e 2f 49 58 0a 20 20 | by Doma|in/IX. |
|000020a0| 20 72 65 74 75 72 6e 73 | 20 6f 6e 65 20 63 68 61 | returns| one cha|
|000020b0| 72 61 63 74 65 72 20 61 | 74 20 61 20 74 69 6d 65 |racter a|t a time|
|000020c0| 2c 20 62 75 66 66 65 72 | 69 6e 67 20 74 68 65 6d |, buffer|ing them|
|000020d0| 20 69 6e 20 61 20 73 74 | 61 74 69 63 20 32 30 34 | in a st|atic 204|
|000020e0| 38 20 62 79 74 65 20 62 | 75 66 66 65 72 2e 0a 20 |8 byte b|uffer.. |
|000020f0| 20 20 69 6e 74 65 72 65 | 73 74 69 6e 67 20 74 68 | intere|sting th|
|00002100| 69 6e 67 73 20 77 6f 75 | 6c 64 20 68 61 70 70 65 |ings wou|ld happe|
|00002110| 6e 20 69 66 20 74 77 6f | 20 64 69 66 66 65 72 65 |n if two| differe|
|00002120| 6e 74 20 66 69 6c 65 73 | 20 77 65 72 65 20 75 73 |nt files| were us|
|00002130| 65 64 20 61 73 20 61 72 | 67 75 6d 65 6e 74 73 0a |ed as ar|guments.|
|00002140| 20 20 20 69 6e 74 20 64 | 69 66 66 65 72 65 6e 74 | int d|ifferent|
|00002150| 20 70 61 72 74 73 20 6f | 66 20 74 68 65 20 70 72 | parts o|f the pr|
|00002160| 6f 67 72 61 6d 2c 20 62 | 75 74 20 69 74 27 73 20 |ogram, b|ut it's |
|00002170| 70 72 6f 62 61 62 6c 79 | 20 6e 6f 74 20 77 6f 72 |probably| not wor|
|00002180| 74 68 20 66 69 78 69 6e | 67 20 2a 2f 0a 69 6e 74 |th fixin|g */.int|
|00002190| 20 6b 72 65 61 64 28 66 | 69 6c 65 2c 20 62 75 66 | kread(f|ile, buf|
|000021a0| 66 65 72 29 0a 69 6e 74 | 20 66 69 6c 65 3b 0a 63 |fer).int| file;.c|
|000021b0| 68 61 72 20 2a 62 75 66 | 66 65 72 3b 0a 7b 0a 09 |har *buf|fer;.{..|
|000021c0| 73 74 61 74 69 63 20 63 | 68 61 72 20 42 49 47 42 |static c|har BIGB|
|000021d0| 55 46 5b 32 30 34 38 5d | 3b 0a 09 73 74 61 74 69 |UF[2048]|;..stati|
|000021e0| 63 20 69 6e 74 20 62 62 | 63 6e 74 20 3d 20 30 3b |c int bb|cnt = 0;|
|000021f0| 0a 09 73 74 61 74 69 63 | 20 69 6e 74 20 62 62 70 |..static| int bbp|
|00002200| 74 72 20 3d 20 30 3b 0a | 0a 09 69 66 20 28 62 62 |tr = 0;.|..if (bb|
|00002210| 70 74 72 3e 3d 62 62 63 | 6e 74 29 20 7b 0a 09 09 |ptr>=bbc|nt) {...|
|00002220| 62 62 63 6e 74 3d 72 65 | 61 64 28 66 69 6c 65 2c |bbcnt=re|ad(file,|
|00002230| 20 42 49 47 42 55 46 2c | 20 32 30 34 38 29 3b 0a | BIGBUF,| 2048);.|
|00002240| 09 09 69 66 20 28 62 62 | 63 6e 74 3d 3d 2d 31 29 |..if (bb|cnt==-1)|
|00002250| 0a 09 09 09 72 65 74 75 | 72 6e 28 2d 31 29 3b 0a |....retu|rn(-1);.|
|00002260| 09 09 62 62 70 74 72 3d | 30 3b 0a 09 7d 0a 09 2a |..bbptr=|0;..}..*|
|00002270| 62 75 66 66 65 72 3d 42 | 49 47 42 55 46 5b 62 62 |buffer=B|IGBUF[bb|
|00002280| 70 74 72 5d 3b 0a 09 2b | 2b 62 62 70 74 72 3b 0a |ptr];..+|+bbptr;.|
|00002290| 09 72 65 74 75 72 6e 28 | 31 29 3b 0a 7d 0a 2f 2f |.return(|1);.}.//|
|000022a0| 45 2a 4f 2a 46 20 74 6d | 2e 63 2f 2f 0a 0a 65 78 |E*O*F tm|.c//..ex|
|000022b0| 69 74 20 30 0a 0a 0a | |it 0... | |
+--------+-------------------------+-------------------------+--------+--------+