home *** CD-ROM | disk | FTP | other *** search
/ Carousel Volume 2 #1 / carousel.iso / mactosh / unix / uw_term.sha < prev    next >
BinHex  |  1985-11-12  |  141.9 KB

open in: MacOS 8.1     |     Win98     |     DOS

browse contents    |     view JSON data     |     view as text


This file was processed as: BinHex (archive/binHex).

ConfidenceProgramDetectionMatch TypeSupport
100% dexvert BinHex (archive/binHex) magic Supported
66% dexvert SHell self-extracting ARchive (archive/shar) ext Supported
1% dexvert Text File (text/txt) fallback Supported
100% file ASCII text default
100% checkBytes Printable ASCII default
100% perlTextCheck Likely Text (Perl) default
100% siegfried x-fmt/111 Plain Text File default
100% lsar BinHex default
100% detectItEasy Format: plain text[LF] default (weak)



hex view
+--------+-------------------------+-------------------------+--------+--------+
|00000000| 20 39 2d 4e 6f 76 2d 38 | 35 20 31 35 3a 31 39 3a | 9-Nov-8|5 15:19:|
|00000010| 33 38 2d 50 53 54 2c 31 | 34 38 34 36 37 3b 30 30 |38-PST,1|48467;00|
|00000020| 30 30 30 30 30 30 30 30 | 30 30 0a 52 65 74 75 72 |00000000|00.Retur|
|00000030| 6e 2d 50 61 74 68 3a 20 | 3c 6a 64 62 40 73 31 2d |n-Path: |<jdb@s1-|
|00000040| 63 2e 61 72 70 61 3e 0a | 52 65 63 65 69 76 65 64 |c.arpa>.|Received|
|00000050| 3a 20 66 72 6f 6d 20 73 | 31 2d 63 2e 41 52 50 41 |: from s|1-c.ARPA|
|00000060| 20 62 79 20 53 55 4d 45 | 58 2d 41 49 4d 2e 41 52 | by SUME|X-AIM.AR|
|00000070| 50 41 20 77 69 74 68 20 | 54 43 50 3b 20 53 61 74 |PA with |TCP; Sat|
|00000080| 20 39 20 4e 6f 76 20 38 | 35 20 31 35 3a 31 35 3a | 9 Nov 8|5 15:15:|
|00000090| 33 37 2d 50 53 54 0a 52 | 65 63 65 69 76 65 64 3a |37-PST.R|eceived:|
|000000a0| 20 62 79 20 73 31 2d 63 | 2e 41 52 50 41 20 69 64 | by s1-c|.ARPA id|
|000000b0| 20 41 41 31 30 30 38 36 | 3b 20 53 61 74 2c 20 39 | AA10086|; Sat, 9|
|000000c0| 20 4e 6f 76 20 38 35 20 | 31 35 3a 31 34 3a 35 31 | Nov 85 |15:14:51|
|000000d0| 20 50 53 54 0a 09 69 64 | 20 41 41 31 30 30 38 36 | PST..id| AA10086|
|000000e0| 3b 20 53 61 74 2c 20 39 | 20 4e 6f 76 20 38 35 20 |; Sat, 9| Nov 85 |
|000000f0| 31 35 3a 31 34 3a 35 31 | 20 50 53 54 0a 44 61 74 |15:14:51| PST.Dat|
|00000100| 65 3a 20 53 61 74 2c 20 | 39 20 4e 6f 76 20 38 35 |e: Sat, |9 Nov 85|
|00000110| 20 31 35 3a 31 34 3a 35 | 31 20 50 53 54 0a 46 72 | 15:14:5|1 PST.Fr|
|00000120| 6f 6d 3a 20 4a 6f 68 6e | 20 42 72 75 6e 65 72 20 |om: John| Bruner |
|00000130| 3c 6a 64 62 40 73 31 2d | 63 2e 61 72 70 61 3e 0a |<jdb@s1-|c.arpa>.|
|00000140| 4d 65 73 73 61 67 65 2d | 49 64 3a 20 3c 38 35 31 |Message-|Id: <851|
|00000150| 31 30 39 32 33 31 34 2e | 41 41 31 30 30 38 36 40 |1092314.|AA10086@|
|00000160| 73 31 2d 63 2e 41 52 50 | 41 3e 0a 54 6f 3a 20 69 |s1-c.ARP|A>.To: i|
|00000170| 6e 66 6f 2d 6d 61 63 40 | 73 75 6d 65 78 2d 61 69 |nfo-mac@|sumex-ai|
|00000180| 6d 2e 61 72 70 61 0a 53 | 75 62 6a 65 63 74 3a 20 |m.arpa.S|ubject: |
|00000190| 55 57 20 76 32 2e 31 30 | 20 28 4d 61 63 20 6d 75 |UW v2.10| (Mac mu|
|000001a0| 6c 74 69 2d 77 69 6e 64 | 6f 77 20 55 4e 49 58 20 |lti-wind|ow UNIX |
|000001b0| 69 6e 74 65 72 66 61 63 | 65 29 0a 0a 53 6f 6d 65 |interfac|e)..Some|
|000001c0| 20 6f 66 20 79 6f 75 20 | 6d 61 79 20 72 65 63 61 | of you |may reca|
|000001d0| 6c 6c 20 6d 79 20 6d 75 | 6c 74 69 70 6c 65 2d 77 |ll my mu|ltiple-w|
|000001e0| 69 6e 64 6f 77 20 74 65 | 72 6d 69 6e 61 6c 20 65 |indow te|rminal e|
|000001f0| 6d 75 6c 61 74 6f 72 20 | 55 57 2c 0a 77 68 69 63 |mulator |UW,.whic|
|00000200| 68 20 49 20 64 69 73 74 | 72 69 62 75 74 65 64 20 |h I dist|ributed |
|00000210| 6c 61 73 74 20 4a 75 6c | 79 2e 20 20 41 66 74 65 |last Jul|y. Afte|
|00000220| 72 20 61 62 6f 75 74 20 | 73 69 78 20 77 65 65 6b |r about |six week|
|00000230| 73 20 6f 66 0a 69 6e 61 | 63 74 69 76 69 74 79 20 |s of.ina|ctivity |
|00000240| 49 20 73 74 61 72 74 65 | 64 20 77 6f 72 6b 69 6e |I starte|d workin|
|00000250| 67 20 6f 6e 20 69 6d 70 | 72 6f 76 65 6d 65 6e 74 |g on imp|rovement|
|00000260| 73 20 69 6e 20 53 65 70 | 74 65 6d 62 65 72 2e 0a |s in Sep|tember..|
|00000270| 49 20 6e 6f 77 20 68 61 | 76 65 20 61 6e 6f 74 68 |I now ha|ve anoth|
|00000280| 65 72 20 76 65 72 73 69 | 6f 6e 20 72 65 61 64 79 |er versi|on ready|
|00000290| 20 66 6f 72 20 64 69 73 | 74 72 69 62 75 74 69 6f | for dis|tributio|
|000002a0| 6e 2e 0a 0a 54 68 65 20 | 52 45 41 44 4d 45 20 66 |n...The |README f|
|000002b0| 69 6c 65 20 69 6e 20 74 | 68 65 20 66 69 72 73 74 |ile in t|he first|
|000002c0| 20 70 61 72 74 20 6f 66 | 20 74 68 65 20 64 69 73 | part of| the dis|
|000002d0| 74 72 69 62 75 74 69 6f | 6e 20 64 65 73 63 72 69 |tributio|n descri|
|000002e0| 62 65 73 0a 74 68 65 20 | 63 68 61 6e 67 65 73 20 |bes.the |changes |
|000002f0| 49 27 76 65 20 6d 61 64 | 65 2e 20 20 41 20 73 69 |I've mad|e. A si|
|00000300| 67 6e 69 66 69 63 61 6e | 74 20 66 65 61 74 75 72 |gnifican|t featur|
|00000310| 65 20 77 68 69 63 68 20 | 49 20 64 69 64 20 6e 6f |e which |I did no|
|00000320| 74 0a 69 6d 70 6c 65 6d | 65 6e 74 20 28 79 65 74 |t.implem|ent (yet|
|00000330| 29 20 69 73 20 66 69 6c | 65 20 74 72 61 6e 73 66 |) is fil|e transf|
|00000340| 65 72 2e 20 20 28 49 20 | 64 6f 20 70 6c 61 6e 20 |er. (I |do plan |
|00000350| 74 6f 20 61 64 64 20 74 | 68 69 73 0a 65 76 65 6e |to add t|his.even|
|00000360| 74 75 61 6c 6c 79 2e 29 | 0a 0a 41 73 20 62 65 66 |tually.)|..As bef|
|00000370| 6f 72 65 2c 20 74 68 65 | 20 64 69 73 74 72 69 62 |ore, the| distrib|
|00000380| 75 74 69 6f 6e 20 69 6e | 63 6c 75 64 65 73 20 74 |ution in|cludes t|
|00000390| 68 65 20 4d 61 63 69 6e | 74 6f 73 68 20 62 69 6e |he Macin|tosh bin|
|000003a0| 61 72 79 20 61 6e 64 0a | 4d 61 63 57 72 69 74 65 |ary and.|MacWrite|
|000003b0| 20 64 6f 63 75 6d 65 6e | 74 61 74 69 6f 6e 20 28 | documen|tation (|
|000003c0| 69 6e 20 42 69 6e 48 65 | 78 20 34 2e 30 20 66 6f |in BinHe|x 4.0 fo|
|000003d0| 72 6d 61 74 29 20 61 6e | 64 20 43 20 73 6f 75 72 |rmat) an|d C sour|
|000003e0| 63 65 20 63 6f 64 65 0a | 66 6f 72 20 34 2e 32 42 |ce code.|for 4.2B|
|000003f0| 53 44 2e 20 20 28 49 20 | 75 73 65 20 69 74 20 6f |SD. (I |use it o|
|00000400| 6e 20 61 20 56 41 58 3b | 20 68 6f 77 65 76 65 72 |n a VAX;| however|
|00000410| 2c 20 49 20 6b 6e 6f 77 | 20 6f 66 20 73 65 76 65 |, I know| of seve|
|00000420| 72 61 6c 20 34 2e 32 42 | 53 44 0a 73 79 73 74 65 |ral 4.2B|SD.syste|
|00000430| 6d 73 20 6f 6e 20 77 68 | 69 63 68 20 69 74 20 72 |ms on wh|ich it r|
|00000440| 75 6e 73 20 61 6e 64 20 | 6e 6f 6e 65 20 6f 6e 20 |uns and |none on |
|00000450| 77 68 69 63 68 20 69 74 | 20 64 6f 65 73 20 6e 6f |which it| does no|
|00000460| 74 2e 29 20 20 54 68 65 | 0a 64 69 73 74 72 69 62 |t.) The|.distrib|
|00000470| 75 74 69 6f 6e 20 61 6c | 73 6f 20 69 6e 63 6c 75 |ution al|so inclu|
|00000480| 64 65 73 20 61 6e 20 4d | 4c 69 73 70 20 66 69 6c |des an M|Lisp fil|
|00000490| 65 20 66 6f 72 20 75 73 | 65 20 77 69 74 68 20 28 |e for us|e with (|
|000004a0| 55 6e 69 70 72 65 73 73 | 29 0a 45 6d 61 63 73 2c |Unipress|).Emacs,|
|000004b0| 20 63 6f 75 72 74 65 73 | 79 20 6f 66 20 43 68 72 | courtes|y of Chr|
|000004c0| 69 73 20 4b 65 6e 74 20 | 28 63 61 6b 40 70 75 72 |is Kent |(cak@pur|
|000004d0| 64 75 65 29 2e 20 20 5b | 49 27 64 20 61 6c 73 6f |due). [|I'd also|
|000004e0| 20 6c 69 6b 65 20 74 6f | 0a 70 75 62 6c 69 63 6c | like to|.publicl|
|000004f0| 79 20 74 68 61 6e 6b 20 | 43 68 72 69 73 20 66 6f |y thank |Chris fo|
|00000500| 72 20 68 69 73 20 68 65 | 6c 70 20 66 69 6e 64 69 |r his he|lp findi|
|00000510| 6e 67 20 62 75 67 73 2e | 5d 0a 0a 55 57 20 69 73 |ng bugs.|]..UW is|
|00000520| 20 6e 6f 74 20 70 75 62 | 6c 69 63 20 64 6f 6d 61 | not pub|lic doma|
|00000530| 69 6e 3b 20 72 61 74 68 | 65 72 2c 20 69 74 20 69 |in; rath|er, it i|
|00000540| 73 20 63 6f 70 79 72 69 | 67 68 74 65 64 2e 20 20 |s copyri|ghted. |
|00000550| 48 6f 77 65 76 65 72 2c | 0a 79 6f 75 20 61 72 65 |However,|.you are|
|00000560| 20 70 65 72 6d 69 74 74 | 65 64 20 74 6f 20 63 6f | permitt|ed to co|
|00000570| 70 79 20 69 74 20 70 72 | 6f 76 69 64 65 64 20 74 |py it pr|ovided t|
|00000580| 68 61 74 20 74 68 65 20 | 63 6f 70 69 65 73 20 61 |hat the |copies a|
|00000590| 72 65 20 6e 6f 74 0a 73 | 6f 6c 64 20 61 6e 64 20 |re not.s|old and |
|000005a0| 74 68 65 20 63 6f 70 79 | 72 69 67 68 74 20 6e 6f |the copy|right no|
|000005b0| 74 69 63 65 20 69 73 20 | 70 65 72 73 65 72 76 65 |tice is |perserve|
|000005c0| 64 2e 20 20 28 43 68 72 | 69 73 20 4b 65 6e 74 20 |d. (Chr|is Kent |
|000005d0| 68 61 73 0a 67 69 76 65 | 6e 20 70 65 72 6d 69 73 |has.give|n permis|
|000005e0| 73 69 6f 6e 2c 20 77 69 | 74 68 20 74 68 65 20 73 |sion, wi|th the s|
|000005f0| 61 6d 65 20 73 74 69 70 | 75 6c 61 74 69 6f 6e 73 |ame stip|ulations|
|00000600| 2c 20 66 6f 72 20 64 69 | 73 74 72 69 62 75 74 69 |, for di|stributi|
|00000610| 6f 6e 0a 6f 66 20 68 69 | 73 20 4d 4c 69 73 70 20 |on.of hi|s MLisp |
|00000620| 63 6f 64 65 2e 29 20 20 | 4e 6f 74 65 20 74 68 61 |code.) |Note tha|
|00000630| 74 20 55 57 20 69 73 20 | 2a 6e 6f 74 2a 20 73 68 |t UW is |*not* sh|
|00000640| 61 72 65 77 61 72 65 2e | 20 20 28 49 66 0a 79 6f |areware.| (If.yo|
|00000650| 75 27 64 20 72 65 61 6c | 6c 79 20 6c 69 6b 65 20 |u'd real|ly like |
|00000660| 74 6f 20 73 65 6e 64 20 | 6d 6f 6e 65 79 2c 20 70 |to send |money, p|
|00000670| 6c 65 61 73 65 20 64 6f | 6e 61 74 65 20 69 74 20 |lease do|nate it |
|00000680| 74 6f 20 79 6f 75 72 0a | 66 61 76 6f 72 69 74 65 |to your.|favorite|
|00000690| 20 63 68 61 72 69 74 79 | 2e 29 20 20 49 20 61 6c | charity|.) I al|
|000006a0| 73 6f 20 61 73 6b 20 74 | 68 61 74 20 69 66 20 79 |so ask t|hat if y|
|000006b0| 6f 75 20 64 69 73 74 72 | 69 62 75 74 65 20 74 68 |ou distr|ibute th|
|000006c0| 65 0a 62 69 6e 61 72 79 | 20 79 6f 75 20 61 6c 73 |e.binary| you als|
|000006d0| 6f 20 64 69 73 74 72 69 | 62 75 74 65 20 74 68 65 |o distri|bute the|
|000006e0| 20 64 6f 63 75 6d 65 6e | 74 61 74 69 6f 6e 20 74 | documen|tation t|
|000006f0| 6f 6f 2e 20 20 28 49 20 | 72 65 63 65 69 76 65 64 |oo. (I |received|
|00000700| 0a 6c 65 74 74 65 72 73 | 20 66 72 6f 6d 20 61 20 |.letters| from a |
|00000710| 6e 75 6d 62 65 72 20 6f | 66 20 70 65 6f 70 6c 65 |number o|f people|
|00000720| 20 77 68 6f 20 68 61 64 | 20 74 68 65 20 62 69 6e | who had| the bin|
|00000730| 61 72 79 20 62 75 74 20 | 6e 6f 74 0a 74 68 65 20 |ary but |not.the |
|00000740| 64 6f 63 75 6d 65 6e 74 | 61 74 69 6f 6e 20 49 20 |document|ation I |
|00000750| 64 69 73 74 72 69 62 75 | 74 65 64 20 6c 61 73 74 |distribu|ted last|
|00000760| 20 74 69 6d 65 2e 29 0a | 0a 49 20 68 61 76 65 20 | time.).|.I have |
|00000770| 61 6c 73 6f 20 70 6f 73 | 74 65 64 20 74 68 69 73 |also pos|ted this|
|00000780| 20 64 69 73 74 72 69 62 | 75 74 69 6f 6e 20 74 6f | distrib|ution to|
|00000790| 20 74 68 65 20 55 53 45 | 4e 45 54 20 6e 65 77 73 | the USE|NET news|
|000007a0| 67 72 6f 75 70 0a 22 6e | 65 74 2e 73 6f 75 72 63 |group."n|et.sourc|
|000007b0| 65 73 2e 6d 61 63 22 2e | 0a 2d 2d 0a 20 20 4a 6f |es.mac".|.--. Jo|
|000007c0| 68 6e 20 42 72 75 6e 65 | 72 20 28 53 2d 31 20 50 |hn Brune|r (S-1 P|
|000007d0| 72 6f 6a 65 63 74 2c 20 | 4c 61 77 72 65 6e 63 65 |roject, |Lawrence|
|000007e0| 20 4c 69 76 65 72 6d 6f | 72 65 20 4e 61 74 69 6f | Livermo|re Natio|
|000007f0| 6e 61 6c 20 4c 61 62 6f | 72 61 74 6f 72 79 29 0a |nal Labo|ratory).|
|00000800| 20 20 4d 49 4c 4e 45 54 | 3a 20 6a 64 62 40 6d 6f | MILNET|: jdb@mo|
|00000810| 72 64 6f 72 20 5b 6a 64 | 62 40 73 31 2d 63 2e 41 |rdor [jd|b@s1-c.A|
|00000820| 52 50 41 5d 09 28 34 31 | 35 29 20 34 32 32 2d 30 |RPA].(41|5) 422-0|
|00000830| 37 35 38 0a 20 20 55 55 | 43 50 3a 20 2e 2e 2e 21 |758. UU|CP: ...!|
|00000840| 75 63 62 76 61 78 21 64 | 75 61 6c 21 6d 6f 72 64 |ucbvax!d|ual!mord|
|00000850| 6f 72 21 6a 64 62 20 09 | 2e 2e 2e 21 73 65 69 73 |or!jdb .|...!seis|
|00000860| 6d 6f 21 6d 6f 72 64 6f | 72 21 6a 64 62 0a 2d 2d |mo!mordo|r!jdb.--|
|00000870| 2d 2d 2d 2d 2d 2d 2d 2d | 2d 2d 2d 2d 2d 2d 2d 2d |--------|--------|
|00000880| 2d 2d 2d 2d 2d 2d 2d 2d | 2d 2d 2d 2d 2d 2d 2d 2d |--------|--------|
|00000890| 2d 2d 2d 2d 2d 2d 2d 2d | 2d 2d 2d 2d 2d 2d 2d 2d |--------|--------|
|000008a0| 2d 2d 2d 2d 2d 2d 2d 2d | 2d 2d 2d 2d 2d 2d 2d 2d |--------|--------|
|000008b0| 2d 2d 2d 2d 2d 2d 2d 0a | 3a 20 54 68 69 73 20 69 |-------.|: This i|
|000008c0| 73 20 61 20 73 68 61 72 | 20 61 72 63 68 69 76 65 |s a shar| archive|
|000008d0| 2e 20 20 45 78 74 72 61 | 63 74 20 77 69 74 68 20 |. Extra|ct with |
|000008e0| 73 68 2c 20 6e 6f 74 20 | 63 73 68 2e 0a 65 63 68 |sh, not |csh..ech|
|000008f0| 6f 20 78 20 2d 20 52 45 | 41 44 4d 45 0a 63 61 74 |o x - RE|ADME.cat|
|00000900| 20 3e 20 52 45 41 44 4d | 45 20 3c 3c 20 27 21 46 | > READM|E << '!F|
|00000910| 75 6e 6b 79 21 53 74 75 | 66 66 21 27 0a 54 68 65 |unky!Stu|ff!'.The|
|00000920| 20 70 72 6f 67 72 61 6d | 20 22 75 77 22 20 69 73 | program| "uw" is|
|00000930| 20 61 20 6d 75 6c 74 69 | 70 6c 65 2d 77 69 6e 64 | a multi|ple-wind|
|00000940| 6f 77 20 74 65 72 6d 69 | 6e 61 6c 20 65 6d 75 6c |ow termi|nal emul|
|00000950| 61 74 6f 72 20 66 6f 72 | 20 74 68 65 0a 4d 61 63 |ator for| the.Mac|
|00000960| 69 6e 74 6f 73 68 28 74 | 6d 29 20 63 6f 6d 70 75 |intosh(t|m) compu|
|00000970| 74 65 72 2e 20 20 49 74 | 20 69 73 20 64 65 73 69 |ter. It| is desi|
|00000980| 67 6e 65 64 20 66 6f 72 | 20 75 73 65 20 77 69 74 |gned for| use wit|
|00000990| 68 20 61 20 34 2e 32 42 | 53 44 0a 55 4e 49 58 28 |h a 4.2B|SD.UNIX(|
|000009a0| 74 6d 29 20 73 79 73 74 | 65 6d 2e 20 20 55 70 20 |tm) syst|em. Up |
|000009b0| 74 6f 20 73 65 76 65 6e | 20 69 6e 64 65 70 65 6e |to seven| indepen|
|000009c0| 64 65 6e 74 20 77 69 6e | 64 6f 77 73 20 6d 61 79 |dent win|dows may|
|000009d0| 20 62 65 20 63 72 65 61 | 74 65 64 2c 0a 65 61 63 | be crea|ted,.eac|
|000009e0| 68 20 6f 66 20 77 68 69 | 63 68 20 69 73 20 63 6f |h of whi|ch is co|
|000009f0| 6e 6e 65 63 74 65 64 20 | 74 6f 20 61 20 70 73 65 |nnected |to a pse|
|00000a00| 75 64 6f 2d 74 65 72 6d | 69 6e 61 6c 20 6f 6e 20 |udo-term|inal on |
|00000a10| 74 68 65 20 55 4e 49 58 | 20 6d 61 63 68 69 6e 65 |the UNIX| machine|
|00000a20| 2e 0a 41 20 73 65 72 76 | 65 72 20 70 72 6f 67 72 |..A serv|er progr|
|00000a30| 61 6d 20 77 68 69 63 68 | 20 72 75 6e 73 20 6f 6e |am which| runs on|
|00000a40| 20 74 68 65 20 55 4e 49 | 58 20 68 6f 73 74 20 6d | the UNI|X host m|
|00000a50| 75 6c 74 69 70 6c 65 78 | 65 73 20 74 68 65 20 69 |ultiplex|es the i|
|00000a60| 6e 70 75 74 0a 61 6e 64 | 20 6f 75 74 70 75 74 20 |nput.and| output |
|00000a70| 66 6f 72 20 74 68 65 73 | 65 20 74 65 72 6d 69 6e |for thes|e termin|
|00000a80| 61 6c 20 73 65 73 73 69 | 6f 6e 73 20 6f 6e 74 6f |al sessi|ons onto|
|00000a90| 20 61 20 73 69 6e 67 6c | 65 20 52 53 2d 32 33 32 | a singl|e RS-232|
|00000aa0| 20 73 65 72 69 61 6c 0a | 6c 69 6e 65 2e 0a 0a 55 | serial.|line...U|
|00000ab0| 57 20 72 65 71 75 69 72 | 65 73 20 74 68 65 20 66 |W requir|es the f|
|00000ac0| 6f 6c 6c 6f 77 69 6e 67 | 3a 0a 0a 09 61 20 4d 61 |ollowing|:...a Ma|
|00000ad0| 63 69 6e 74 6f 73 68 0a | 09 61 20 34 2e 32 42 53 |cintosh.|.a 4.2BS|
|00000ae0| 44 20 55 4e 49 58 20 68 | 6f 73 74 0a 09 74 68 65 |D UNIX h|ost..the|
|00000af0| 20 22 75 77 22 20 70 72 | 6f 67 72 61 6d 20 66 6f | "uw" pr|ogram fo|
|00000b00| 72 20 74 68 65 20 4d 61 | 63 69 6e 74 6f 73 68 0a |r the Ma|cintosh.|
|00000b10| 09 74 68 65 20 22 75 77 | 22 20 73 65 72 76 65 72 |.the "uw|" server|
|00000b20| 20 66 6f 72 20 74 68 65 | 20 55 4e 49 58 20 68 6f | for the| UNIX ho|
|00000b30| 73 74 0a 09 74 68 65 20 | 22 75 77 74 6f 6f 6c 22 |st..the |"uwtool"|
|00000b40| 20 70 72 6f 67 72 61 6d | 20 66 6f 72 20 74 68 65 | program| for the|
|00000b50| 20 55 4e 49 58 20 68 6f | 73 74 20 28 6f 70 74 69 | UNIX ho|st (opti|
|00000b60| 6f 6e 61 6c 29 0a 09 74 | 68 65 20 52 41 4d 20 73 |onal)..t|he RAM s|
|00000b70| 65 72 69 61 6c 20 64 72 | 69 76 65 72 20 28 72 65 |erial dr|iver (re|
|00000b80| 73 6f 75 72 63 65 20 53 | 45 52 44 2c 20 49 44 3d |source S|ERD, ID=|
|00000b90| 31 29 20 28 6f 70 74 69 | 6f 6e 61 6c 29 0a 0a 41 |1) (opti|onal)..A|
|00000ba0| 74 20 74 68 65 20 70 72 | 65 73 65 6e 74 20 74 69 |t the pr|esent ti|
|00000bb0| 6d 65 2c 20 55 57 20 65 | 6d 75 6c 61 74 65 73 20 |me, UW e|mulates |
|00000bc0| 61 20 4c 65 61 72 20 53 | 69 65 67 6c 65 72 20 41 |a Lear S|iegler A|
|00000bd0| 44 4d 2d 33 31 20 74 65 | 72 6d 69 6e 61 6c 2c 0a |DM-31 te|rminal,.|
|00000be0| 61 20 44 45 43 20 56 54 | 35 32 2c 20 61 6e 64 20 |a DEC VT|52, and |
|00000bf0| 61 20 54 65 6b 74 72 6f | 6e 69 78 20 34 30 31 30 |a Tektro|nix 4010|
|00000c00| 2e 0a 0a 41 6c 6c 20 70 | 6f 72 74 69 6f 6e 73 20 |...All p|ortions |
|00000c10| 6f 66 20 55 57 20 61 72 | 65 20 63 6f 70 79 72 69 |of UW ar|e copyri|
|00000c20| 67 68 74 65 64 20 31 39 | 38 35 20 62 79 20 4a 6f |ghted 19|85 by Jo|
|00000c30| 68 6e 20 44 2e 20 42 72 | 75 6e 65 72 2e 0a 50 65 |hn D. Br|uner..Pe|
|00000c40| 72 6d 69 73 73 69 6f 6e | 20 74 6f 20 63 6f 70 79 |rmission| to copy|
|00000c50| 20 69 73 20 67 69 76 65 | 6e 20 70 72 6f 76 69 64 | is give|n provid|
|00000c60| 65 64 20 74 68 61 74 20 | 74 68 65 20 63 6f 70 79 |ed that |the copy|
|00000c70| 20 69 73 20 6e 6f 74 20 | 73 6f 6c 64 0a 61 6e 64 | is not |sold.and|
|00000c80| 20 74 68 65 20 63 6f 70 | 79 72 69 67 68 74 20 6e | the cop|yright n|
|00000c90| 6f 74 69 63 65 73 20 61 | 72 65 20 69 6e 63 6c 75 |otices a|re inclu|
|00000ca0| 64 65 64 2e 0a 0a 55 57 | 20 77 61 73 20 64 65 73 |ded...UW| was des|
|00000cb0| 69 67 6e 65 64 20 74 6f | 20 75 73 65 20 74 68 65 |igned to| use the|
|00000cc0| 20 52 41 4d 20 73 65 72 | 69 61 6c 20 64 72 69 76 | RAM ser|ial driv|
|00000cd0| 65 72 20 66 72 6f 6d 20 | 74 68 65 20 41 70 70 6c |er from |the Appl|
|00000ce0| 65 20 73 6f 66 74 77 61 | 72 65 0a 73 75 70 70 6c |e softwa|re.suppl|
|00000cf0| 65 6d 65 6e 74 2e 20 20 | 53 69 6e 63 65 20 74 68 |ement. |Since th|
|00000d00| 69 73 20 64 72 69 76 65 | 72 20 69 73 20 70 72 6f |is drive|r is pro|
|00000d10| 70 72 69 65 74 61 72 79 | 20 41 70 70 6c 65 20 73 |prietary| Apple s|
|00000d20| 6f 66 74 77 61 72 65 2c | 20 69 74 20 69 73 0a 6e |oftware,| it is.n|
|00000d30| 6f 74 20 64 69 73 74 72 | 69 62 75 74 65 64 20 77 |ot distr|ibuted w|
|00000d40| 69 74 68 20 55 57 2e 20 | 20 46 6f 72 20 74 68 69 |ith UW. | For thi|
|00000d50| 73 20 72 65 61 73 6f 6e | 2c 20 55 57 20 77 69 6c |s reason|, UW wil|
|00000d60| 6c 20 75 73 65 20 74 68 | 65 20 52 4f 4d 0a 73 65 |l use th|e ROM.se|
|00000d70| 72 69 61 6c 20 64 72 69 | 76 65 72 20 69 66 20 74 |rial dri|ver if t|
|00000d80| 68 65 20 52 41 4d 20 73 | 65 72 69 61 6c 20 64 72 |he RAM s|erial dr|
|00000d90| 69 76 65 72 20 69 73 20 | 6e 6f 74 20 70 72 65 73 |iver is |not pres|
|00000da0| 65 6e 74 2c 20 61 6e 64 | 20 69 74 20 77 69 6c 6c |ent, and| it will|
|00000db0| 0a 61 74 74 65 6d 70 74 | 20 74 6f 20 70 72 6f 76 |.attempt| to prov|
|00000dc0| 69 64 65 20 66 6c 6f 77 | 20 63 6f 6e 74 72 6f 6c |ide flow| control|
|00000dd0| 20 69 74 73 65 6c 66 2e | 20 20 54 68 65 20 66 6c | itself.| The fl|
|00000de0| 6f 77 20 63 6f 6e 74 72 | 6f 6c 20 70 72 6f 76 69 |ow contr|ol provi|
|00000df0| 64 65 64 0a 69 6e 20 74 | 68 69 73 20 66 61 73 68 |ded.in t|his fash|
|00000e00| 69 6f 6e 20 69 73 20 6e | 6f 74 20 61 73 20 65 66 |ion is n|ot as ef|
|00000e10| 66 65 63 74 69 76 65 20 | 61 73 20 74 68 61 74 20 |fective |as that |
|00000e20| 77 68 69 63 68 20 74 68 | 65 20 52 41 4d 20 73 65 |which th|e RAM se|
|00000e30| 72 69 61 6c 0a 64 72 69 | 76 65 72 20 70 72 6f 76 |rial.dri|ver prov|
|00000e40| 69 64 65 73 2c 20 73 6f | 20 75 73 65 20 6f 66 20 |ides, so| use of |
|00000e50| 74 68 65 20 52 41 4d 20 | 64 72 69 76 65 72 20 69 |the RAM |driver i|
|00000e60| 73 20 72 65 63 6f 6d 6d | 65 6e 64 65 64 20 69 66 |s recomm|ended if|
|00000e70| 20 69 74 20 69 73 0a 61 | 76 61 69 6c 61 62 6c 65 | it is.a|vailable|
|00000e80| 2e 0a 0a 54 68 65 20 64 | 69 73 74 72 69 62 75 74 |...The d|istribut|
|00000e90| 69 6f 6e 20 69 6e 63 6c | 75 64 65 73 3a 0a 0a 09 |ion incl|udes:...|
|00000ea0| 52 45 41 44 4d 45 09 20 | 20 20 20 2d 20 74 68 69 |README. | - thi|
|00000eb0| 73 20 66 69 6c 65 0a 09 | 4d 61 6b 65 66 69 6c 65 |s file..|Makefile|
|00000ec0| 20 20 20 20 2d 20 74 6f | 20 62 65 20 75 73 65 64 | - to| be used|
|00000ed0| 20 74 6f 20 63 6f 6d 70 | 69 6c 65 20 74 68 65 20 | to comp|ile the |
|00000ee0| 34 2e 32 42 53 44 20 70 | 72 6f 67 72 61 6d 73 0a |4.2BSD p|rograms.|
|00000ef0| 09 75 77 2e 68 09 20 20 | 20 20 2d 20 69 6e 63 6c |.uw.h. | - incl|
|00000f00| 75 64 65 20 66 69 6c 65 | 20 28 64 65 73 63 72 69 |ude file| (descri|
|00000f10| 62 65 73 20 74 68 65 20 | 73 69 6d 70 6c 65 20 73 |bes the |simple s|
|00000f20| 65 72 69 61 6c 20 70 72 | 6f 74 6f 63 6f 6c 29 0a |erial pr|otocol).|
|00000f30| 09 75 77 2e 63 09 20 20 | 20 20 2d 20 73 6f 75 72 |.uw.c. | - sour|
|00000f40| 63 65 20 66 6f 72 20 74 | 68 65 20 34 2e 32 42 53 |ce for t|he 4.2BS|
|00000f50| 44 20 73 65 72 76 65 72 | 20 70 72 6f 67 72 61 6d |D server| program|
|00000f60| 0a 09 75 77 74 6f 6f 6c | 2e 63 20 20 20 20 2d 20 |..uwtool|.c - |
|00000f70| 73 6f 75 72 63 65 20 66 | 6f 72 20 61 20 34 2e 32 |source f|or a 4.2|
|00000f80| 42 53 44 20 22 74 6f 6f | 6c 22 20 70 72 6f 67 72 |BSD "too|l" progr|
|00000f90| 61 6d 0a 09 6f 70 65 6e | 70 74 79 2e 63 20 20 20 |am..open|pty.c |
|00000fa0| 2d 20 73 6f 75 72 63 65 | 20 66 6f 72 20 61 20 75 |- source| for a u|
|00000fb0| 74 69 6c 69 74 79 20 72 | 6f 75 74 69 6e 65 20 74 |tility r|outine t|
|00000fc0| 6f 20 66 69 6e 64 20 61 | 6e 64 20 6f 70 65 6e 20 |o find a|nd open |
|00000fd0| 70 74 79 27 73 0a 09 6f | 70 65 6e 70 74 79 2e 68 |pty's..o|penpty.h|
|00000fe0| 20 20 20 2d 20 69 6e 63 | 6c 75 64 65 20 66 69 6c | - inc|lude fil|
|00000ff0| 65 20 28 64 65 73 63 72 | 69 62 65 73 20 61 20 73 |e (descr|ibes a s|
|00001000| 74 72 75 63 74 75 72 65 | 20 75 73 65 64 20 62 79 |tructure| used by|
|00001010| 20 6f 70 65 6e 70 74 79 | 28 29 29 0a 09 6d 61 63 | openpty|())..mac|
|00001020| 6d 6f 75 73 65 2e 6d 6c | 20 2d 20 6d 6c 69 73 70 |mouse.ml| - mlisp|
|00001030| 20 66 75 6e 63 74 69 6f | 6e 73 20 66 6f 72 20 75 | functio|ns for u|
|00001040| 73 65 20 77 69 74 68 20 | 28 55 6e 69 70 72 65 73 |se with |(Unipres|
|00001050| 73 29 20 45 6d 61 63 73 | 0a 09 75 77 2e 68 71 78 |s) Emacs|..uw.hqx|
|00001060| 09 20 20 20 20 2d 20 42 | 69 6e 68 65 78 20 34 2e |. - B|inhex 4.|
|00001070| 30 20 62 69 6e 61 72 79 | 20 66 6f 72 20 74 68 65 |0 binary| for the|
|00001080| 20 4d 61 63 69 6e 74 6f | 73 68 0a 09 75 77 2e 64 | Macinto|sh..uw.d|
|00001090| 6f 63 2e 68 71 78 20 20 | 2d 20 42 69 6e 68 65 78 |oc.hqx |- Binhex|
|000010a0| 20 34 2e 30 20 4d 61 63 | 57 72 69 74 65 20 64 6f | 4.0 Mac|Write do|
|000010b0| 63 75 6d 65 6e 74 61 74 | 69 6f 6e 0a 0a 0a 43 68 |cumentat|ion...Ch|
|000010c0| 61 6e 67 65 73 20 74 6f | 20 55 57 0a 2d 2d 2d 2d |anges to| UW.----|
|000010d0| 2d 2d 2d 2d 2d 2d 2d 2d | 2d 0a 0a 54 68 69 73 20 |--------|-..This |
|000010e0| 69 73 20 55 57 20 76 65 | 72 73 69 6f 6e 20 32 2e |is UW ve|rsion 2.|
|000010f0| 31 30 2e 20 20 54 68 65 | 20 6c 61 73 74 20 64 69 |10. The| last di|
|00001100| 73 74 72 69 62 75 74 65 | 64 20 76 65 72 73 69 6f |stribute|d versio|
|00001110| 6e 20 77 61 73 20 31 2e | 36 2e 0a 0a 41 20 6e 75 |n was 1.|6...A nu|
|00001120| 6d 62 65 72 20 6f 66 20 | 63 68 61 6e 67 65 73 20 |mber of |changes |
|00001130| 68 61 76 65 20 62 65 65 | 6e 20 6d 61 64 65 20 74 |have bee|n made t|
|00001140| 6f 20 74 68 65 20 4d 61 | 63 69 6e 74 6f 73 68 20 |o the Ma|cintosh |
|00001150| 70 6f 72 74 69 6f 6e 20 | 6f 66 20 55 57 2e 0a 53 |portion |of UW..S|
|00001160| 6f 6d 65 20 6f 66 20 74 | 68 65 20 6d 6f 72 65 20 |ome of t|he more |
|00001170| 73 69 67 6e 69 66 69 63 | 61 6e 74 20 6f 6e 65 73 |signific|ant ones|
|00001180| 20 61 72 65 0a 0a 20 20 | 20 20 31 29 09 43 6f 6e | are.. | 1).Con|
|00001190| 66 69 67 75 72 61 74 69 | 6f 6e 20 66 69 6c 65 73 |figurati|on files|
|000011a0| 3a 20 20 41 20 6e 75 6d | 62 65 72 20 6f 66 20 70 |: A num|ber of p|
|000011b0| 61 72 61 6d 65 74 65 72 | 73 20 73 75 63 68 20 61 |arameter|s such a|
|000011c0| 73 20 74 68 65 0a 09 62 | 61 75 64 20 72 61 74 65 |s the..b|aud rate|
|000011d0| 2c 20 70 61 72 69 74 79 | 2c 20 6e 75 6d 62 65 72 |, parity|, number|
|000011e0| 20 6f 66 20 73 74 6f 70 | 20 62 69 74 73 2c 20 6b | of stop| bits, k|
|000011f0| 65 79 62 6f 61 72 64 20 | 6d 61 70 70 69 6e 67 2c |eyboard |mapping,|
|00001200| 0a 09 65 74 63 2e 20 63 | 61 6e 20 62 65 20 73 61 |..etc. c|an be sa|
|00001210| 76 65 64 20 74 6f 20 61 | 6e 64 20 72 65 6c 6f 61 |ved to a|nd reloa|
|00001220| 64 65 64 20 66 72 6f 6d | 20 61 20 63 6f 6e 66 69 |ded from| a confi|
|00001230| 67 75 72 61 74 69 6f 6e | 0a 09 66 69 6c 65 2e 0a |guration|..file..|
|00001240| 0a 20 20 20 20 32 29 09 | 54 65 72 6d 69 6e 61 6c |. 2).|Terminal|
|00001250| 20 65 6d 75 6c 61 74 69 | 6f 6e 73 3a 20 20 49 6e | emulati|ons: In|
|00001260| 20 61 64 64 69 74 69 6f | 6e 20 74 6f 20 61 6e 20 | additio|n to an |
|00001270| 41 44 4d 33 31 20 65 6d | 75 6c 61 74 69 6f 6e 2c |ADM31 em|ulation,|
|00001280| 0a 09 55 57 20 61 6c 73 | 6f 20 63 61 6e 20 65 6d |..UW als|o can em|
|00001290| 75 6c 61 74 65 20 74 68 | 65 20 56 54 35 32 20 61 |ulate th|e VT52 a|
|000012a0| 6e 64 20 54 65 6b 74 72 | 6f 6e 69 78 20 34 30 31 |nd Tektr|onix 401|
|000012b0| 30 2e 20 20 28 54 68 65 | 0a 09 56 54 35 32 20 65 |0. (The|..VT52 e|
|000012c0| 6d 75 6c 61 74 69 6f 6e | 20 69 73 20 70 72 6f 76 |mulation| is prov|
|000012d0| 69 73 69 6f 6e 61 6c 20 | 61 6e 64 20 6d 61 79 20 |isional |and may |
|000012e0| 62 65 20 72 65 70 6c 61 | 63 65 64 20 62 79 20 61 |be repla|ced by a|
|000012f0| 0a 09 56 54 31 30 30 20 | 65 6d 75 6c 61 74 69 6f |..VT100 |emulatio|
|00001300| 6e 20 69 6e 20 61 20 66 | 75 74 75 72 65 20 76 65 |n in a f|uture ve|
|00001310| 72 73 69 6f 6e 20 6f 66 | 20 55 57 2e 29 20 20 54 |rsion of| UW.) T|
|00001320| 68 65 20 74 65 72 6d 69 | 6e 61 6c 0a 09 65 6d 75 |he termi|nal..emu|
|00001330| 6c 61 74 69 6f 6e 20 69 | 73 20 73 65 6c 65 63 74 |lation i|s select|
|00001340| 61 62 6c 65 20 6f 6e 20 | 61 20 70 65 72 2d 77 69 |able on |a per-wi|
|00001350| 6e 64 6f 77 20 62 61 73 | 69 73 2e 0a 0a 20 20 20 |ndow bas|is... |
|00001360| 20 33 29 09 43 6c 69 70 | 62 6f 61 72 64 3a 20 20 | 3).Clip|board: |
|00001370| 44 65 73 6b 20 61 63 63 | 65 73 73 6f 72 69 65 73 |Desk acc|essories|
|00001380| 20 6d 61 79 20 75 73 65 | 20 61 6c 6c 20 6f 66 20 | may use| all of |
|00001390| 74 68 65 20 73 74 61 6e | 64 61 72 64 0a 09 63 6c |the stan|dard..cl|
|000013a0| 69 70 62 6f 61 72 64 20 | 66 75 6e 63 74 69 6f 6e |ipboard |function|
|000013b0| 73 2e 20 20 54 65 78 74 | 20 6d 61 79 20 62 65 20 |s. Text| may be |
|000013c0| 63 6f 70 69 65 64 20 66 | 72 6f 6d 20 61 20 55 57 |copied f|rom a UW|
|000013d0| 20 77 69 6e 64 6f 77 0a | 09 6f 6e 74 6f 20 74 68 | window.|.onto th|
|000013e0| 65 20 63 6c 69 70 62 6f | 61 72 64 2c 20 61 6e 64 |e clipbo|ard, and|
|000013f0| 20 74 65 78 74 20 69 6e | 20 74 68 65 20 63 6c 69 | text in| the cli|
|00001400| 70 62 6f 61 72 64 20 6d | 61 79 20 62 65 0a 09 70 |pboard m|ay be..p|
|00001410| 61 73 74 65 64 20 69 6e | 74 6f 20 61 20 77 69 6e |asted in|to a win|
|00001420| 64 6f 77 2e 0a 0a 20 20 | 20 20 34 29 09 4d 6f 75 |dow... | 4).Mou|
|00001430| 73 65 20 63 6c 69 63 6b | 73 3a 20 20 41 73 20 61 |se click|s: As a|
|00001440| 6e 20 61 6c 74 65 72 6e | 61 74 69 76 65 20 74 6f |n altern|ative to|
|00001450| 20 74 68 65 20 63 6c 69 | 70 62 6f 61 72 64 2c 20 | the cli|pboard, |
|00001460| 6d 6f 75 73 65 0a 09 28 | 75 70 2f 64 6f 77 6e 29 |mouse..(|up/down)|
|00001470| 20 65 76 65 6e 74 73 20 | 77 69 74 68 69 6e 20 61 | events |within a|
|00001480| 20 77 69 6e 64 6f 77 20 | 6d 61 79 20 62 65 20 74 | window |may be t|
|00001490| 72 61 6e 73 6c 61 74 65 | 64 20 69 6e 74 6f 20 61 |ranslate|d into a|
|000014a0| 6e 0a 09 65 73 63 61 70 | 65 20 73 65 71 75 65 6e |n..escap|e sequen|
|000014b0| 63 65 20 61 6e 64 20 74 | 72 61 6e 73 6d 69 74 74 |ce and t|ransmitt|
|000014c0| 65 64 20 61 73 20 69 6e | 70 75 74 20 64 61 74 61 |ed as in|put data|
|000014d0| 20 74 6f 20 74 68 65 20 | 68 6f 73 74 2e 0a 09 54 | to the |host...T|
|000014e0| 68 69 73 20 70 72 6f 76 | 69 64 65 73 20 61 20 72 |his prov|ides a r|
|000014f0| 75 64 69 6d 65 6e 74 61 | 72 79 20 66 61 63 69 6c |udimenta|ry facil|
|00001500| 69 74 79 20 66 6f 72 20 | 28 65 2e 67 2e 29 20 45 |ity for |(e.g.) E|
|00001510| 4d 41 43 53 20 74 6f 0a | 09 75 73 65 20 6d 6f 75 |MACS to.|.use mou|
|00001520| 73 65 20 69 6e 70 75 74 | 2e 20 20 54 68 65 20 75 |se input|. The u|
|00001530| 73 65 20 6f 66 20 6d 6f | 75 73 65 2d 74 6f 2d 68 |se of mo|use-to-h|
|00001540| 6f 73 74 20 6f 72 20 63 | 6c 69 70 62 6f 61 72 64 |ost or c|lipboard|
|00001550| 0a 09 63 6f 70 79 69 6e | 67 20 69 73 20 73 65 6c |..copyin|g is sel|
|00001560| 65 63 74 61 62 6c 65 20 | 6f 6e 20 61 20 70 65 72 |ectable |on a per|
|00001570| 2d 77 69 6e 64 6f 77 20 | 62 61 73 69 73 2e 0a 0a |-window |basis...|
|00001580| 20 20 20 20 35 29 09 4d | 75 6c 74 69 70 6c 65 20 | 5).M|ultiple |
|00001590| 66 6f 6e 74 73 3a 20 20 | 49 6e 20 61 64 64 69 74 |fonts: |In addit|
|000015a0| 69 6f 6e 20 74 6f 20 74 | 68 65 20 73 74 61 6e 64 |ion to t|he stand|
|000015b0| 61 72 64 20 39 2d 70 6f | 69 6e 74 20 4d 6f 6e 61 |ard 9-po|int Mona|
|000015c0| 63 6f 0a 09 66 6f 6e 74 | 2c 20 55 57 20 77 69 6c |co..font|, UW wil|
|000015d0| 6c 20 61 6c 73 6f 20 75 | 73 65 20 61 20 37 2d 70 |l also u|se a 7-p|
|000015e0| 6f 69 6e 74 20 66 6f 6e | 74 2e 20 20 54 68 65 20 |oint fon|t. The |
|000015f0| 66 6f 6e 74 20 73 69 7a | 65 20 69 73 0a 09 73 65 |font siz|e is..se|
|00001600| 6c 65 63 74 61 62 6c 65 | 20 6f 6e 20 61 20 70 65 |lectable| on a pe|
|00001610| 72 2d 77 69 6e 64 6f 77 | 20 62 61 73 69 73 2e 0a |r-window| basis..|
|00001620| 0a 20 20 20 20 36 29 09 | 49 6e 76 65 72 73 65 20 |. 6).|Inverse |
|00001630| 76 69 64 65 6f 3a 20 20 | 49 6e 76 65 72 73 65 20 |video: |Inverse |
|00001640| 76 69 64 65 6f 20 77 61 | 73 20 6e 6f 74 20 69 6d |video wa|s not im|
|00001650| 70 6c 65 6d 65 6e 74 65 | 64 20 69 6e 20 74 68 65 |plemente|d in the|
|00001660| 0a 09 70 72 65 76 69 6f | 75 73 20 76 65 72 73 69 |..previo|us versi|
|00001670| 6f 6e 20 6f 66 20 55 57 | 2e 20 20 49 74 20 69 73 |on of UW|. It is|
|00001680| 20 6e 6f 77 20 73 75 70 | 70 6f 72 74 65 64 20 66 | now sup|ported f|
|00001690| 6f 72 20 74 68 65 20 41 | 44 4d 33 31 2e 0a 0a 20 |or the A|DM31... |
|000016a0| 20 20 20 37 29 09 57 69 | 6e 64 6f 77 20 72 65 6e | 7).Wi|ndow ren|
|000016b0| 61 6d 69 6e 67 3a 20 20 | 57 69 6e 64 6f 77 20 74 |aming: |Window t|
|000016c0| 69 74 6c 65 73 20 6d 61 | 79 20 62 65 20 63 68 61 |itles ma|y be cha|
|000016d0| 6e 67 65 64 20 28 6f 6e | 20 74 68 65 0a 09 4d 61 |nged (on| the..Ma|
|000016e0| 63 69 6e 74 6f 73 68 29 | 2e 0a 0a 49 6e 20 63 6f |cintosh)|...In co|
|000016f0| 6e 6a 75 6e 63 74 69 6f | 6e 20 77 69 74 68 20 28 |njunctio|n with (|
|00001700| 34 29 20 61 62 6f 76 65 | 2c 20 43 68 72 69 73 20 |4) above|, Chris |
|00001710| 4b 65 6e 74 20 61 74 20 | 50 75 72 64 75 65 20 28 |Kent at |Purdue (|
|00001720| 63 61 6b 40 70 75 72 64 | 75 65 29 0a 68 61 73 20 |cak@purd|ue).has |
|00001730| 77 72 69 74 74 65 6e 20 | 6d 6c 69 73 70 20 63 6f |written |mlisp co|
|00001740| 64 65 20 66 6f 72 20 47 | 6f 73 6c 69 6e 67 73 20 |de for G|oslings |
|00001750| 45 6d 61 63 73 20 77 68 | 69 63 68 20 69 6e 74 65 |Emacs wh|ich inte|
|00001760| 72 70 72 65 74 73 20 74 | 68 65 0a 6d 6f 75 73 65 |rprets t|he.mouse|
|00001770| 2d 65 76 65 6e 74 20 65 | 6e 63 6f 64 69 6e 67 20 |-event e|ncoding |
|00001780| 74 68 61 74 20 55 57 20 | 63 61 6e 20 6f 70 74 69 |that UW |can opti|
|00001790| 6f 6e 61 6c 6c 79 20 70 | 72 6f 76 69 64 65 2e 20 |onally p|rovide. |
|000017a0| 20 48 65 20 68 61 73 0a | 67 69 76 65 6e 20 68 69 | He has.|given hi|
|000017b0| 73 20 70 65 72 6d 69 73 | 73 69 6f 6e 20 66 6f 72 |s permis|sion for|
|000017c0| 20 68 69 73 20 66 69 6c | 65 20 22 6d 61 63 6d 6f | his fil|e "macmo|
|000017d0| 75 73 65 2e 6d 6c 22 20 | 74 6f 20 62 65 20 69 6e |use.ml" |to be in|
|000017e0| 63 6c 75 64 65 64 0a 69 | 6e 20 74 68 69 73 20 64 |cluded.i|n this d|
|000017f0| 69 73 74 72 69 62 75 74 | 69 6f 6e 2e 0a 0a 54 68 |istribut|ion...Th|
|00001800| 65 72 65 20 61 72 65 20 | 6e 6f 20 63 68 61 6e 67 |ere are |no chang|
|00001810| 65 73 20 69 6e 20 74 68 | 65 20 4d 61 63 2d 68 6f |es in th|e Mac-ho|
|00001820| 73 74 20 69 6e 74 65 72 | 66 61 63 65 20 28 61 6c |st inter|face (al|
|00001830| 74 68 6f 75 67 68 20 73 | 6f 6d 65 20 70 6c 61 6e |though s|ome plan|
|00001840| 73 0a 61 72 65 20 62 65 | 69 6e 67 20 6d 61 64 65 |s.are be|ing made|
|00001850| 20 69 6e 20 74 68 69 73 | 20 61 72 65 61 29 2e 20 | in this| area). |
|00001860| 20 54 68 75 73 2c 20 6f | 6e 65 20 6f 66 20 74 68 | Thus, o|ne of th|
|00001870| 65 20 6d 6f 73 74 2d 72 | 65 71 75 65 73 74 65 64 |e most-r|equested|
|00001880| 0a 66 65 61 74 75 72 65 | 73 2c 20 66 69 6c 65 20 |.feature|s, file |
|00001890| 74 72 61 6e 73 66 65 72 | 2c 20 69 73 20 6e 6f 74 |transfer|, is not|
|000018a0| 20 69 6d 70 6c 65 6d 65 | 6e 74 65 64 20 28 79 65 | impleme|nted (ye|
|000018b0| 74 29 2e 0a 0a 4f 66 20 | 63 6f 75 72 73 65 2c 20 |t)...Of |course, |
|000018c0| 62 75 67 73 20 69 6e 20 | 74 68 65 20 70 72 65 76 |bugs in |the prev|
|000018d0| 69 6f 75 73 20 76 65 72 | 73 69 6f 6e 20 68 61 76 |ious ver|sion hav|
|000018e0| 65 20 62 65 65 6e 20 66 | 69 78 65 64 20 28 6d 6f |e been f|ixed (mo|
|000018f0| 73 74 20 6e 6f 74 61 62 | 6c 79 0a 73 6f 6d 65 20 |st notab|ly.some |
|00001900| 74 68 61 74 20 64 65 61 | 6c 74 20 77 69 74 68 20 |that dea|lt with |
|00001910| 73 63 72 6f 6c 6c 69 6e | 67 29 2e 20 20 41 6c 6d |scrollin|g). Alm|
|00001920| 6f 73 74 20 63 65 72 74 | 61 69 6e 6c 79 20 6e 65 |ost cert|ainly ne|
|00001930| 77 20 62 75 67 73 20 68 | 61 76 65 20 62 65 65 6e |w bugs h|ave been|
|00001940| 0a 69 6e 74 72 6f 64 75 | 63 65 64 20 74 6f 20 74 |.introdu|ced to t|
|00001950| 61 6b 65 20 74 68 65 20 | 70 6c 61 63 65 20 6f 66 |ake the |place of|
|00001960| 20 74 68 6f 73 65 20 77 | 68 69 63 68 20 77 65 72 | those w|hich wer|
|00001970| 65 20 65 78 70 75 6e 67 | 65 64 2e 0a 0a 53 69 6e |e expung|ed...Sin|
|00001980| 63 65 20 73 6f 6d 65 20 | 6f 66 20 74 68 65 20 63 |ce some |of the c|
|00001990| 68 61 6e 67 65 73 20 61 | 72 65 20 72 61 74 68 65 |hanges a|re rathe|
|000019a0| 72 20 73 69 67 6e 69 66 | 69 63 61 6e 74 20 28 61 |r signif|icant (a|
|000019b0| 6e 64 20 61 20 63 6f 75 | 70 6c 65 2c 0a 6c 69 6b |nd a cou|ple,.lik|
|000019c0| 65 20 74 68 65 20 6d 65 | 74 68 6f 64 20 6f 66 20 |e the me|thod of |
|000019d0| 73 65 6c 65 63 74 69 6e | 67 20 74 65 78 74 20 74 |selectin|g text t|
|000019e0| 6f 20 63 6f 70 79 20 74 | 6f 20 74 68 65 20 63 6c |o copy t|o the cl|
|000019f0| 69 70 62 6f 61 72 64 2c | 20 61 72 65 0a 73 6c 69 |ipboard,| are.sli|
|00001a00| 67 68 74 6c 79 20 6e 6f | 6e 2d 73 74 61 6e 64 61 |ghtly no|n-standa|
|00001a10| 72 64 29 2c 20 74 68 65 | 20 75 70 64 61 74 65 64 |rd), the| updated|
|00001a20| 20 64 6f 63 75 6d 65 6e | 74 61 74 69 6f 6e 20 69 | documen|tation i|
|00001a30| 73 20 72 65 63 6f 6d 6d | 65 6e 64 65 64 0a 72 65 |s recomm|ended.re|
|00001a40| 61 64 69 6e 67 20 66 6f | 72 20 61 6c 6c 20 55 57 |ading fo|r all UW|
|00001a50| 20 75 73 65 72 73 2e 0a | 0a 55 57 20 69 73 20 6d | users..|.UW is m|
|00001a60| 75 63 68 20 6c 61 72 67 | 65 72 20 74 68 61 6e 20 |uch larg|er than |
|00001a70| 69 74 20 77 61 73 20 62 | 65 66 6f 72 65 2e 20 20 |it was b|efore. |
|00001a80| 45 78 74 65 6e 73 69 76 | 65 20 75 73 65 20 6f 66 |Extensiv|e use of|
|00001a90| 20 74 68 65 0a 54 65 6b | 74 72 6f 6e 69 78 20 34 | the.Tek|tronix 4|
|00001aa0| 30 31 30 20 65 6d 75 6c | 61 74 69 6f 6e 20 77 69 |010 emul|ation wi|
|00001ab0| 6c 6c 20 61 6c 6d 6f 73 | 74 20 63 65 72 74 61 69 |ll almos|t certai|
|00001ac0| 6e 6c 79 20 65 78 68 61 | 75 73 74 20 6d 65 6d 6f |nly exha|ust memo|
|00001ad0| 72 79 0a 6f 6e 20 61 20 | 31 32 38 4b 20 4d 61 63 |ry.on a |128K Mac|
|00001ae0| 69 6e 74 6f 73 68 2e 0a | 21 46 75 6e 6b 79 21 53 |intosh..|!Funky!S|
|00001af0| 74 75 66 66 21 0a 65 63 | 68 6f 20 78 20 2d 20 4d |tuff!.ec|ho x - M|
|00001b00| 61 6b 65 66 69 6c 65 0a | 63 61 74 20 3e 20 4d 61 |akefile.|cat > Ma|
|00001b10| 6b 65 66 69 6c 65 20 3c | 3c 20 27 21 46 75 6e 6b |kefile <|< '!Funk|
|00001b20| 79 21 53 74 75 66 66 21 | 27 0a 43 43 09 3d 09 2f |y!Stuff!|'.CC.=./|
|00001b30| 62 69 6e 2f 63 63 0a 43 | 46 4c 41 47 53 09 3d 09 |bin/cc.C|FLAGS.=.|
|00001b40| 2d 4f 0a 0a 61 6c 6c 3a | 09 09 75 77 20 75 77 74 |-O..all:|..uw uwt|
|00001b50| 6f 6f 6c 0a 0a 75 77 3a | 09 09 75 77 2e 6f 20 6f |ool..uw:|..uw.o o|
|00001b60| 70 65 6e 70 74 79 2e 6f | 0a 09 24 28 43 43 29 20 |penpty.o|..$(CC) |
|00001b70| 2d 6f 20 75 77 20 75 77 | 2e 6f 20 6f 70 65 6e 70 |-o uw uw|.o openp|
|00001b80| 74 79 2e 6f 0a 0a 75 77 | 74 6f 6f 6c 3a 09 09 75 |ty.o..uw|tool:..u|
|00001b90| 77 74 6f 6f 6c 2e 6f 20 | 6f 70 65 6e 70 74 79 2e |wtool.o |openpty.|
|00001ba0| 6f 0a 09 24 28 43 43 29 | 20 2d 6f 20 75 77 74 6f |o..$(CC)| -o uwto|
|00001bb0| 6f 6c 20 75 77 74 6f 6f | 6c 2e 6f 20 6f 70 65 6e |ol uwtoo|l.o open|
|00001bc0| 70 74 79 2e 6f 0a 21 46 | 75 6e 6b 79 21 53 74 75 |pty.o.!F|unky!Stu|
|00001bd0| 66 66 21 0a 65 63 68 6f | 20 78 20 2d 20 75 77 2e |ff!.echo| x - uw.|
|00001be0| 68 0a 63 61 74 20 3e 20 | 75 77 2e 68 20 3c 3c 20 |h.cat > |uw.h << |
|00001bf0| 27 21 46 75 6e 6b 79 21 | 53 74 75 66 66 21 27 0a |'!Funky!|Stuff!'.|
|00001c00| 2f 2a 0a 20 2a 09 75 77 | 20 63 6f 6d 6d 61 6e 64 |/*. *.uw| command|
|00001c10| 20 62 79 74 65 73 0a 20 | 2a 0a 20 2a 20 43 6f 70 | bytes. |*. * Cop|
|00001c20| 79 72 69 67 68 74 20 31 | 39 38 35 20 62 79 20 4a |yright 1|985 by J|
|00001c30| 6f 68 6e 20 44 2e 20 42 | 72 75 6e 65 72 2e 20 20 |ohn D. B|runer. |
|00001c40| 41 6c 6c 20 72 69 67 68 | 74 73 20 72 65 73 65 72 |All righ|ts reser|
|00001c50| 76 65 64 2e 20 20 50 65 | 72 6d 69 73 73 69 6f 6e |ved. Pe|rmission|
|00001c60| 20 74 6f 0a 20 2a 20 63 | 6f 70 79 20 74 68 69 73 | to. * c|opy this|
|00001c70| 20 70 72 6f 67 72 61 6d | 20 69 73 20 67 69 76 65 | program| is give|
|00001c80| 6e 20 70 72 6f 76 69 64 | 65 64 20 74 68 61 74 20 |n provid|ed that |
|00001c90| 74 68 65 20 63 6f 70 79 | 20 69 73 20 6e 6f 74 20 |the copy| is not |
|00001ca0| 73 6f 6c 64 20 61 6e 64 | 20 74 68 61 74 0a 20 2a |sold and| that. *|
|00001cb0| 20 74 68 69 73 20 63 6f | 70 79 72 69 67 68 74 20 | this co|pyright |
|00001cc0| 6e 6f 74 69 63 65 20 69 | 73 20 69 6e 63 6c 75 64 |notice i|s includ|
|00001cd0| 65 64 2e 0a 20 2a 0a 20 | 2a 0a 20 2a 20 54 77 6f |ed.. *. |*. * Two|
|00001ce0| 20 74 79 70 65 73 20 6f | 66 20 69 6e 66 6f 72 6d | types o|f inform|
|00001cf0| 61 74 69 6f 6e 20 61 72 | 65 20 65 78 63 68 61 6e |ation ar|e exchan|
|00001d00| 67 65 64 20 74 68 72 6f | 75 67 68 20 74 68 65 20 |ged thro|ugh the |
|00001d10| 37 2d 62 69 74 20 73 65 | 72 69 61 6c 20 6c 69 6e |7-bit se|rial lin|
|00001d20| 65 3a 0a 20 2a 20 6f 72 | 64 69 6e 61 72 79 20 64 |e:. * or|dinary d|
|00001d30| 61 74 61 20 61 6e 64 20 | 63 6f 6d 6d 61 6e 64 20 |ata and |command |
|00001d40| 62 79 74 65 73 2e 20 20 | 43 6f 6d 6d 61 6e 64 20 |bytes. |Command |
|00001d50| 62 79 74 65 73 20 61 72 | 65 20 70 72 65 63 65 65 |bytes ar|e precee|
|00001d60| 64 65 64 20 62 79 0a 20 | 2a 20 61 6e 20 49 41 43 |ded by. |* an IAC|
|00001d70| 20 62 79 74 65 2e 20 20 | 49 41 43 20 62 79 74 65 | byte. |IAC byte|
|00001d80| 73 20 61 6e 64 20 6c 69 | 74 65 72 61 6c 20 58 4f |s and li|teral XO|
|00001d90| 4e 2f 58 4f 46 46 20 63 | 68 61 72 61 63 74 65 72 |N/XOFF c|haracter|
|00001da0| 73 20 28 74 68 6f 73 65 | 20 77 68 69 63 68 0a 20 |s (those| which. |
|00001db0| 2a 20 61 72 65 20 6e 6f | 74 20 75 73 65 64 20 66 |* are no|t used f|
|00001dc0| 6f 72 20 66 6c 6f 77 20 | 63 6f 6e 74 72 6f 6c 29 |or flow |control)|
|00001dd0| 20 61 72 65 20 73 65 6e | 74 20 62 79 20 61 20 43 | are sen|t by a C|
|00001de0| 42 5f 46 4e 5f 43 54 4c | 43 48 20 63 6f 6d 6d 61 |B_FN_CTL|CH comma|
|00001df0| 6e 64 2e 0a 20 2a 20 43 | 68 61 72 61 63 74 65 72 |nd.. * C|haracter|
|00001e00| 73 20 77 69 74 68 20 74 | 68 65 20 65 69 67 68 74 |s with t|he eight|
|00001e10| 68 20 62 69 74 20 73 65 | 74 20 28 74 68 65 20 22 |h bit se|t (the "|
|00001e20| 6d 65 74 61 22 20 62 69 | 74 29 20 61 72 65 20 70 |meta" bi|t) are p|
|00001e30| 72 65 66 69 78 65 64 20 | 77 69 74 68 0a 20 2a 20 |refixed |with. * |
|00001e40| 61 20 43 42 5f 46 4e 5f | 4d 45 54 41 20 66 75 6e |a CB_FN_|META fun|
|00001e50| 63 74 69 6f 6e 2e 0a 20 | 2a 0a 20 2a 20 54 68 65 |ction.. |*. * The|
|00001e60| 20 6e 65 78 74 20 6d 6f | 73 74 2d 73 69 67 6e 69 | next mo|st-signi|
|00001e70| 66 69 63 61 6e 74 20 62 | 69 74 20 69 6e 20 74 68 |ficant b|it in th|
|00001e80| 65 20 62 79 74 65 20 73 | 70 65 63 69 66 69 65 73 |e byte s|pecifies|
|00001e90| 20 74 68 65 20 73 65 6e | 64 65 72 20 61 6e 64 0a | the sen|der and.|
|00001ea0| 20 2a 20 72 65 63 69 70 | 69 65 6e 74 20 6f 66 20 | * recip|ient of |
|00001eb0| 74 68 65 20 63 6f 6d 6d | 61 6e 64 2e 20 20 49 66 |the comm|and. If|
|00001ec0| 20 74 68 69 73 20 62 69 | 74 20 69 73 20 63 6c 65 | this bi|t is cle|
|00001ed0| 61 72 20 28 30 29 2c 20 | 74 68 65 20 63 6f 6d 6d |ar (0), |the comm|
|00001ee0| 61 6e 64 20 62 79 74 65 | 0a 20 2a 20 77 61 73 20 |and byte|. * was |
|00001ef0| 73 65 6e 74 20 66 72 6f | 6d 20 74 68 65 20 68 6f |sent fro|m the ho|
|00001f00| 73 74 20 63 6f 6d 70 75 | 74 65 72 20 74 6f 20 74 |st compu|ter to t|
|00001f10| 68 65 20 4d 61 63 69 6e | 74 6f 73 68 3b 20 69 66 |he Macin|tosh; if|
|00001f20| 20 69 74 20 69 73 20 73 | 65 74 20 28 31 29 0a 20 | it is s|et (1). |
|00001f30| 2a 20 74 68 65 20 63 6f | 6d 6d 61 6e 64 20 62 79 |* the co|mmand by|
|00001f40| 74 65 20 77 61 73 20 73 | 65 6e 74 20 66 72 6f 6d |te was s|ent from|
|00001f50| 20 74 68 65 20 4d 61 63 | 69 6e 74 6f 73 68 20 74 | the Mac|intosh t|
|00001f60| 6f 20 74 68 65 20 68 6f | 73 74 20 63 6f 6d 70 75 |o the ho|st compu|
|00001f70| 74 65 72 2e 0a 20 2a 20 | 54 68 69 73 20 70 72 65 |ter.. * |This pre|
|00001f80| 76 65 6e 74 73 20 63 6f | 6e 66 75 73 69 6f 6e 20 |vents co|nfusion |
|00001f90| 69 6e 20 74 68 65 20 65 | 76 65 6e 74 20 74 68 61 |in the e|vent tha|
|00001fa0| 74 20 74 68 65 20 68 6f | 73 74 20 63 6f 6d 70 75 |t the ho|st compu|
|00001fb0| 74 65 72 0a 20 2a 20 28 | 69 6e 63 6f 72 72 65 63 |ter. * (|incorrec|
|00001fc0| 74 6c 79 29 20 65 63 68 | 6f 73 20 61 20 63 6f 6d |tly) ech|os a com|
|00001fd0| 6d 61 6e 64 20 62 61 63 | 6b 20 74 6f 20 74 68 65 |mand bac|k to the|
|00001fe0| 20 4d 61 63 69 6e 74 6f | 73 68 2e 0a 20 2a 0a 20 | Macinto|sh.. *. |
|00001ff0| 2a 20 54 68 65 20 72 65 | 6d 61 69 6e 69 6e 67 20 |* The re|maining |
|00002000| 73 69 78 20 62 69 74 73 | 20 61 72 65 20 70 61 72 |six bits| are par|
|00002010| 74 69 74 69 6f 6e 65 64 | 20 69 6e 74 6f 20 74 77 |titioned| into tw|
|00002020| 6f 20 66 69 65 6c 64 73 | 2e 20 20 54 68 65 20 6c |o fields|. The l|
|00002030| 6f 77 2d 6f 72 64 65 72 | 0a 20 2a 20 74 68 72 65 |ow-order|. * thre|
|00002040| 65 20 62 69 74 73 20 73 | 70 65 63 69 66 79 20 61 |e bits s|pecify a|
|00002050| 20 77 69 6e 64 6f 77 20 | 6e 75 6d 62 65 72 20 66 | window |number f|
|00002060| 72 6f 6d 20 31 2d 37 20 | 28 77 69 6e 64 6f 77 20 |rom 1-7 |(window |
|00002070| 30 20 69 73 20 72 65 73 | 65 72 76 65 64 20 66 6f |0 is res|erved fo|
|00002080| 72 0a 20 2a 20 6f 74 68 | 65 72 20 75 73 65 73 29 |r. * oth|er uses)|
|00002090| 20 6f 72 20 61 6e 6f 74 | 68 65 72 20 74 79 70 65 | or anot|her type|
|000020a0| 20 6f 66 20 63 6f 6d 6d | 61 6e 64 2d 64 65 70 65 | of comm|and-depe|
|000020b0| 6e 64 65 6e 74 20 70 61 | 72 61 6d 65 74 65 72 2e |ndent pa|rameter.|
|000020c0| 20 20 54 68 65 20 6e 65 | 78 74 0a 20 2a 20 74 68 | The ne|xt. * th|
|000020d0| 72 65 65 20 62 69 74 73 | 20 73 70 65 63 69 66 79 |ree bits| specify|
|000020e0| 20 74 68 65 20 6f 70 65 | 72 61 74 69 6f 6e 20 74 | the ope|ration t|
|000020f0| 6f 20 62 65 20 70 65 72 | 66 6f 72 6d 65 64 20 62 |o be per|formed b|
|00002100| 79 20 74 68 65 20 72 65 | 63 69 70 69 65 6e 74 20 |y the re|cipient |
|00002110| 6f 66 0a 20 2a 20 74 68 | 65 20 63 6f 6d 6d 61 6e |of. * th|e comman|
|00002120| 64 20 62 79 74 65 2e 0a | 20 2a 0a 20 2a 20 4e 6f |d byte..| *. * No|
|00002130| 74 65 20 74 68 61 74 20 | 74 68 65 20 63 68 6f 69 |te that |the choi|
|00002140| 63 65 20 6f 66 20 63 6f | 6d 6d 61 6e 64 20 62 79 |ce of co|mmand by|
|00002150| 74 65 73 20 70 72 65 76 | 65 6e 74 73 20 74 68 65 |tes prev|ents the|
|00002160| 20 41 53 43 49 49 20 58 | 4f 4e 20 28 30 32 31 29 | ASCII X|ON (021)|
|00002170| 20 61 6e 64 0a 20 2a 20 | 58 4f 46 46 20 28 30 32 | and. * |XOFF (02|
|00002180| 33 29 20 63 68 61 72 61 | 63 74 65 72 73 20 66 72 |3) chara|cters fr|
|00002190| 6f 6d 20 62 65 69 6e 67 | 20 73 65 6e 74 20 61 73 |om being| sent as|
|000021a0| 20 63 6f 6d 6d 61 6e 64 | 73 2e 20 20 43 42 5f 46 | command|s. CB_F|
|000021b0| 4e 5f 49 53 45 4c 57 20 | 63 6f 6d 6d 61 6e 64 73 |N_ISELW |commands|
|000021c0| 0a 20 2a 20 61 72 65 20 | 6f 6e 6c 79 20 73 65 6e |. * are |only sen|
|000021d0| 74 20 62 79 20 74 68 65 | 20 4d 61 63 69 6e 74 6f |t by the| Macinto|
|000021e0| 73 68 20 28 61 6e 64 20 | 74 68 75 73 20 61 72 65 |sh (and |thus are|
|000021f0| 20 74 61 67 67 65 64 20 | 77 69 74 68 20 74 68 65 | tagged |with the|
|00002200| 20 43 42 5f 44 49 52 5f | 4d 54 4f 48 0a 20 2a 20 | CB_DIR_|MTOH. * |
|00002210| 62 69 74 29 2e 20 20 53 | 69 6e 63 65 20 58 4f 4e |bit). S|ince XON|
|00002220| 20 61 6e 64 20 58 4f 46 | 46 20 64 61 74 61 20 63 | and XOF|F data c|
|00002230| 68 61 72 61 63 74 65 72 | 73 20 61 72 65 20 68 61 |haracter|s are ha|
|00002240| 6e 64 6c 65 64 20 76 69 | 61 20 43 42 5f 46 4e 5f |ndled vi|a CB_FN_|
|00002250| 43 54 4c 43 48 2c 0a 20 | 2a 20 74 68 69 73 20 61 |CTLCH,. |* this a|
|00002260| 6c 6c 6f 77 73 20 74 68 | 65 6d 20 74 6f 20 62 65 |llows th|em to be|
|00002270| 20 75 73 65 64 20 66 6f | 72 20 66 6c 6f 77 20 63 | used fo|r flow c|
|00002280| 6f 6e 74 72 6f 6c 20 70 | 75 72 70 6f 73 65 73 2e |ontrol p|urposes.|
|00002290| 0a 20 2a 2f 0a 20 0a 23 | 64 65 66 69 6e 65 09 49 |. */. .#|define.I|
|000022a0| 41 43 09 09 30 30 30 31 | 09 09 2f 2a 20 69 6e 74 |AC..0001|../* int|
|000022b0| 65 72 70 72 65 74 20 61 | 73 20 63 6f 6d 6d 61 6e |erpret a|s comman|
|000022c0| 64 20 2a 2f 0a 23 64 65 | 66 69 6e 65 09 43 42 5f |d */.#de|fine.CB_|
|000022d0| 44 49 52 09 09 30 31 30 | 30 09 09 2f 2a 20 63 6f |DIR..010|0../* co|
|000022e0| 6d 6d 61 6e 64 20 64 69 | 72 65 63 74 69 6f 6e 3a |mmand di|rection:|
|000022f0| 20 2a 2f 0a 23 64 65 66 | 69 6e 65 09 43 42 5f 44 | */.#def|ine.CB_D|
|00002300| 49 52 5f 48 54 4f 4d 09 | 30 30 30 30 09 09 2f 2a |IR_HTOM.|0000../*|
|00002310| 09 66 72 6f 6d 20 68 6f | 73 74 20 74 6f 20 4d 61 |.from ho|st to Ma|
|00002320| 63 20 2a 2f 0a 23 64 65 | 66 69 6e 65 09 43 42 5f |c */.#de|fine.CB_|
|00002330| 44 49 52 5f 4d 54 4f 48 | 09 30 31 30 30 09 09 2f |DIR_MTOH|.0100../|
|00002340| 2a 09 66 72 6f 6d 20 4d | 61 63 20 74 6f 20 68 6f |*.from M|ac to ho|
|00002350| 73 74 20 2a 2f 0a 23 64 | 65 66 69 6e 65 09 43 42 |st */.#d|efine.CB|
|00002360| 5f 46 4e 09 09 30 30 37 | 30 09 09 2f 2a 20 66 75 |_FN..007|0../* fu|
|00002370| 6e 63 74 69 6f 6e 20 63 | 6f 64 65 3a 20 2a 2f 0a |nction c|ode: */.|
|00002380| 23 64 65 66 69 6e 65 09 | 43 42 5f 46 4e 5f 4e 45 |#define.|CB_FN_NE|
|00002390| 57 57 09 30 30 30 30 09 | 09 2f 2a 09 6e 65 77 20 |WW.0000.|./*.new |
|000023a0| 77 69 6e 64 6f 77 20 2a | 2f 0a 23 64 65 66 69 6e |window *|/.#defin|
|000023b0| 65 09 43 42 5f 46 4e 5f | 4b 49 4c 4c 57 09 30 30 |e.CB_FN_|KILLW.00|
|000023c0| 31 30 09 09 2f 2a 09 6b | 69 6c 6c 20 28 64 65 6c |10../*.k|ill (del|
|000023d0| 65 74 65 29 20 77 69 6e | 64 6f 77 20 2a 2f 0a 23 |ete) win|dow */.#|
|000023e0| 64 65 66 69 6e 65 09 43 | 42 5f 46 4e 5f 49 53 45 |define.C|B_FN_ISE|
|000023f0| 4c 57 09 30 30 32 30 09 | 09 2f 2a 09 73 65 6c 65 |LW.0020.|./*.sele|
|00002400| 63 74 20 77 69 6e 64 6f | 77 20 66 6f 72 20 69 6e |ct windo|w for in|
|00002410| 70 75 74 20 2a 2f 0a 23 | 64 65 66 69 6e 65 09 43 |put */.#|define.C|
|00002420| 42 5f 46 4e 5f 4f 53 45 | 4c 57 09 30 30 33 30 09 |B_FN_OSE|LW.0030.|
|00002430| 09 2f 2a 09 73 65 6c 65 | 63 74 20 77 69 6e 64 6f |./*.sele|ct windo|
|00002440| 77 20 66 6f 72 20 6f 75 | 74 70 75 74 20 2a 2f 0a |w for ou|tput */.|
|00002450| 23 64 65 66 69 6e 65 09 | 43 42 5f 46 4e 5f 4d 45 |#define.|CB_FN_ME|
|00002460| 54 41 09 30 30 35 30 09 | 09 2f 2a 09 61 64 64 20 |TA.0050.|./*.add |
|00002470| 6d 65 74 61 20 74 6f 20 | 6e 65 78 74 20 64 61 74 |meta to |next dat|
|00002480| 61 20 63 68 61 72 20 2a | 2f 0a 23 64 65 66 69 6e |a char *|/.#defin|
|00002490| 65 09 43 42 5f 46 4e 5f | 43 54 4c 43 48 09 30 30 |e.CB_FN_|CTLCH.00|
|000024a0| 36 30 09 09 2f 2a 09 6c | 6f 77 20 33 20 62 69 74 |60../*.l|ow 3 bit|
|000024b0| 73 20 73 70 65 63 69 66 | 79 20 63 68 61 72 20 2a |s specif|y char *|
|000024c0| 2f 0a 23 64 65 66 69 6e | 65 09 43 42 5f 46 4e 5f |/.#defin|e.CB_FN_|
|000024d0| 4d 41 49 4e 54 09 30 30 | 37 30 09 09 2f 2a 09 6d |MAINT.00|70../*.m|
|000024e0| 61 69 6e 74 65 6e 61 6e | 63 65 20 66 75 6e 63 74 |aintenan|ce funct|
|000024f0| 69 6f 6e 73 20 2a 2f 0a | 23 64 65 66 69 6e 65 09 |ions */.|#define.|
|00002500| 43 42 5f 57 49 4e 44 4f | 57 09 30 30 30 37 09 09 |CB_WINDO|W.0007..|
|00002510| 2f 2a 20 77 69 6e 64 6f | 77 20 6e 75 6d 62 65 72 |/* windo|w number|
|00002520| 20 6d 61 73 6b 20 2a 2f | 0a 23 64 65 66 69 6e 65 | mask */|.#define|
|00002530| 09 43 42 5f 43 43 09 09 | 30 30 30 37 09 09 2f 2a |.CB_CC..|0007../*|
|00002540| 20 63 6f 6e 74 72 6f 6c | 20 63 68 61 72 61 63 74 | control| charact|
|00002550| 65 72 20 73 70 65 63 69 | 66 69 65 72 3a 20 2a 2f |er speci|fier: */|
|00002560| 0a 23 64 65 66 69 6e 65 | 09 43 42 5f 43 43 5f 49 |.#define|.CB_CC_I|
|00002570| 41 43 09 31 09 09 2f 2a | 09 49 41 43 20 2a 2f 0a |AC.1../*|.IAC */.|
|00002580| 23 64 65 66 69 6e 65 09 | 43 42 5f 43 43 5f 58 4f |#define.|CB_CC_XO|
|00002590| 4e 09 32 09 09 2f 2a 09 | 58 4f 4e 20 2a 2f 0a 23 |N.2../*.|XON */.#|
|000025a0| 64 65 66 69 6e 65 09 43 | 42 5f 43 43 5f 58 4f 46 |define.C|B_CC_XOF|
|000025b0| 46 09 33 09 09 2f 2a 09 | 58 4f 46 46 20 2a 2f 0a |F.3../*.|XOFF */.|
|000025c0| 23 64 65 66 69 6e 65 09 | 43 42 5f 4d 46 09 09 30 |#define.|CB_MF..0|
|000025d0| 30 30 37 09 09 2f 2a 20 | 6d 61 69 6e 74 65 6e 61 |007../* |maintena|
|000025e0| 6e 63 65 20 66 75 6e 63 | 74 69 6f 6e 73 3a 20 2a |nce func|tions: *|
|000025f0| 2f 0a 23 64 65 66 69 6e | 65 09 43 42 5f 4d 46 5f |/.#defin|e.CB_MF_|
|00002600| 45 4e 54 52 59 09 30 09 | 09 2f 2a 09 62 65 67 69 |ENTRY.0.|./*.begi|
|00002610| 6e 6e 69 6e 67 20 65 78 | 65 63 75 74 69 6f 6e 20 |nning ex|ecution |
|00002620| 2a 2f 0a 23 64 65 66 69 | 6e 65 09 43 42 5f 4d 46 |*/.#defi|ne.CB_MF|
|00002630| 5f 45 58 49 54 09 37 09 | 09 2f 2a 09 65 78 65 63 |_EXIT.7.|./*.exec|
|00002640| 75 74 69 6f 6e 20 74 65 | 72 6d 69 6e 61 74 69 6e |ution te|rminatin|
|00002650| 67 20 2a 2f 0a 23 64 65 | 66 69 6e 65 09 4e 57 49 |g */.#de|fine.NWI|
|00002660| 4e 44 4f 57 09 09 37 09 | 09 2f 2a 20 6d 61 78 69 |NDOW..7.|./* maxi|
|00002670| 6d 75 6d 20 6e 75 6d 62 | 65 72 20 6f 66 20 77 69 |mum numb|er of wi|
|00002680| 6e 64 6f 77 73 20 2a 2f | 0a 21 46 75 6e 6b 79 21 |ndows */|.!Funky!|
|00002690| 53 74 75 66 66 21 0a 65 | 63 68 6f 20 78 20 2d 20 |Stuff!.e|cho x - |
|000026a0| 75 77 2e 63 0a 63 61 74 | 20 3e 20 75 77 2e 63 20 |uw.c.cat| > uw.c |
|000026b0| 3c 3c 20 27 21 46 75 6e | 6b 79 21 53 74 75 66 66 |<< '!Fun|ky!Stuff|
|000026c0| 21 27 0a 23 0a 0a 2f 2a | 0a 20 2a 09 75 77 20 2d |!'.#../*|. *.uw -|
|000026d0| 20 55 4e 49 58 20 77 69 | 6e 64 6f 77 73 20 70 72 | UNIX wi|ndows pr|
|000026e0| 6f 67 72 61 6d 20 66 6f | 72 20 74 68 65 20 4d 61 |ogram fo|r the Ma|
|000026f0| 63 69 6e 74 6f 73 68 20 | 28 56 41 58 20 65 6e 64 |cintosh |(VAX end|
|00002700| 29 0a 20 2a 0a 20 2a 20 | 43 6f 70 79 72 69 67 68 |). *. * |Copyrigh|
|00002710| 74 20 31 39 38 35 20 62 | 79 20 4a 6f 68 6e 20 44 |t 1985 b|y John D|
|00002720| 2e 20 42 72 75 6e 65 72 | 2e 20 20 41 6c 6c 20 72 |. Bruner|. All r|
|00002730| 69 67 68 74 73 20 72 65 | 73 65 72 76 65 64 2e 20 |ights re|served. |
|00002740| 20 50 65 72 6d 69 73 73 | 69 6f 6e 20 74 6f 0a 20 | Permiss|ion to. |
|00002750| 2a 20 63 6f 70 79 20 74 | 68 69 73 20 70 72 6f 67 |* copy t|his prog|
|00002760| 72 61 6d 20 69 73 20 67 | 69 76 65 6e 20 70 72 6f |ram is g|iven pro|
|00002770| 76 69 64 65 64 20 74 68 | 61 74 20 74 68 65 20 63 |vided th|at the c|
|00002780| 6f 70 79 20 69 73 20 6e | 6f 74 20 73 6f 6c 64 20 |opy is n|ot sold |
|00002790| 61 6e 64 20 74 68 61 74 | 0a 20 2a 20 74 68 69 73 |and that|. * this|
|000027a0| 20 63 6f 70 79 72 69 67 | 68 74 20 6e 6f 74 69 63 | copyrig|ht notic|
|000027b0| 65 20 69 73 20 69 6e 63 | 6c 75 64 65 64 2e 0a 20 |e is inc|luded.. |
|000027c0| 2a 2f 0a 0a 23 69 6e 63 | 6c 75 64 65 20 3c 73 79 |*/..#inc|lude <sy|
|000027d0| 73 2f 74 79 70 65 73 2e | 68 3e 0a 23 69 6e 63 6c |s/types.|h>.#incl|
|000027e0| 75 64 65 20 3c 73 79 73 | 2f 73 74 61 74 2e 68 3e |ude <sys|/stat.h>|
|000027f0| 0a 23 69 6e 63 6c 75 64 | 65 20 3c 73 79 73 2f 73 |.#includ|e <sys/s|
|00002800| 6f 63 6b 65 74 2e 68 3e | 0a 23 69 6e 63 6c 75 64 |ocket.h>|.#includ|
|00002810| 65 20 3c 73 79 73 2f 69 | 6f 63 74 6c 2e 68 3e 0a |e <sys/i|octl.h>.|
|00002820| 23 69 6e 63 6c 75 64 65 | 20 3c 73 79 73 2f 77 61 |#include| <sys/wa|
|00002830| 69 74 2e 68 3e 0a 23 69 | 6e 63 6c 75 64 65 20 3c |it.h>.#i|nclude <|
|00002840| 73 79 73 2f 74 69 6d 65 | 2e 68 3e 0a 23 69 6e 63 |sys/time|.h>.#inc|
|00002850| 6c 75 64 65 20 3c 73 79 | 73 2f 72 65 73 6f 75 72 |lude <sy|s/resour|
|00002860| 63 65 2e 68 3e 0a 23 69 | 6e 63 6c 75 64 65 20 3c |ce.h>.#i|nclude <|
|00002870| 73 79 73 2f 75 69 6f 2e | 68 3e 0a 23 69 6e 63 6c |sys/uio.|h>.#incl|
|00002880| 75 64 65 20 3c 73 69 67 | 6e 61 6c 2e 68 3e 0a 23 |ude <sig|nal.h>.#|
|00002890| 69 6e 63 6c 75 64 65 20 | 3c 73 65 74 6a 6d 70 2e |include |<setjmp.|
|000028a0| 68 3e 0a 23 69 6e 63 6c | 75 64 65 20 3c 65 72 72 |h>.#incl|ude <err|
|000028b0| 6e 6f 2e 68 3e 0a 23 69 | 6e 63 6c 75 64 65 20 3c |no.h>.#i|nclude <|
|000028c0| 66 63 6e 74 6c 2e 68 3e | 0a 23 69 6e 63 6c 75 64 |fcntl.h>|.#includ|
|000028d0| 65 20 3c 73 74 72 69 6e | 67 73 2e 68 3e 0a 23 69 |e <strin|gs.h>.#i|
|000028e0| 6e 63 6c 75 64 65 20 3c | 73 74 64 69 6f 2e 68 3e |nclude <|stdio.h>|
|000028f0| 0a 23 69 6e 63 6c 75 64 | 65 20 22 75 77 2e 68 22 |.#includ|e "uw.h"|
|00002900| 0a 23 69 6e 63 6c 75 64 | 65 20 22 6f 70 65 6e 70 |.#includ|e "openp|
|00002910| 74 79 2e 68 22 0a 0a 23 | 64 65 66 69 6e 65 09 4d |ty.h"..#|define.M|
|00002920| 41 58 45 4e 56 09 31 32 | 38 09 09 09 2f 2a 20 6d |AXENV.12|8.../* m|
|00002930| 61 78 69 6d 75 6d 20 65 | 6e 76 69 72 6f 6e 6d 65 |aximum e|nvironme|
|00002940| 6e 74 20 73 69 7a 65 20 | 2a 2f 0a 0a 23 64 65 66 |nt size |*/..#def|
|00002950| 69 6e 65 09 57 5f 49 4e | 09 30 0a 23 64 65 66 69 |ine.W_IN|.0.#defi|
|00002960| 6e 65 09 57 5f 4f 55 54 | 09 31 0a 0a 23 64 65 66 |ne.W_OUT|.1..#def|
|00002970| 69 6e 65 09 58 4f 4e 09 | 30 30 32 31 09 09 09 2f |ine.XON.|0021.../|
|00002980| 2a 20 41 53 43 49 49 20 | 58 4f 4e 20 2a 2f 0a 23 |* ASCII |XON */.#|
|00002990| 64 65 66 69 6e 65 09 58 | 4f 46 46 09 30 30 32 33 |define.X|OFF.0023|
|000029a0| 09 09 09 2f 2a 20 41 53 | 43 49 49 20 58 4f 46 46 |.../* AS|CII XOFF|
|000029b0| 20 2a 2f 0a 23 64 65 66 | 69 6e 65 09 52 55 42 09 | */.#def|ine.RUB.|
|000029c0| 30 31 37 37 09 09 09 2f | 2a 20 41 53 43 49 49 20 |0177.../|* ASCII |
|000029d0| 52 55 42 4f 55 54 20 2a | 2f 0a 0a 23 64 65 66 69 |RUBOUT *|/..#defi|
|000029e0| 6e 65 09 4d 45 54 41 09 | 30 32 30 30 09 09 09 2f |ne.META.|0200.../|
|000029f0| 2a 20 22 6d 65 74 61 22 | 20 62 69 74 20 66 6f 72 |* "meta"| bit for|
|00002a00| 20 77 68 61 74 65 76 65 | 72 20 69 74 27 73 20 77 | whateve|r it's w|
|00002a10| 6f 72 74 68 20 2a 2f 0a | 0a 23 64 65 66 69 6e 65 |orth */.|.#define|
|00002a20| 09 52 43 56 5f 4f 4b 09 | 28 2d 31 29 09 09 09 2f |.RCV_OK.|(-1).../|
|00002a30| 2a 20 73 65 65 20 72 65 | 63 76 63 6d 64 28 29 20 |* see re|cvcmd() |
|00002a40| 2a 2f 0a 23 64 65 66 69 | 6e 65 09 52 43 56 5f 4d |*/.#defi|ne.RCV_M|
|00002a50| 45 54 41 20 28 2d 32 29 | 09 09 09 2f 2a 20 73 65 |ETA (-2)|.../* se|
|00002a60| 65 20 72 65 63 76 63 6d | 64 28 29 20 2a 2f 0a 0a |e recvcm|d() */..|
|00002a70| 23 69 66 6e 64 65 66 20 | 46 44 5f 53 45 54 0a 23 |#ifndef |FD_SET.#|
|00002a80| 64 65 66 69 6e 65 09 46 | 44 5f 53 45 54 28 6e 2c |define.F|D_SET(n,|
|00002a90| 70 29 09 28 28 70 29 2d | 3e 66 64 73 5f 62 69 74 |p).((p)-|>fds_bit|
|00002aa0| 73 5b 30 5d 20 7c 3d 20 | 28 31 20 3c 3c 20 28 6e |s[0] |= |(1 << (n|
|00002ab0| 29 29 29 0a 23 64 65 66 | 69 6e 65 09 46 44 5f 43 |))).#def|ine.FD_C|
|00002ac0| 4c 52 28 6e 2c 70 29 09 | 28 28 70 29 2d 3e 66 64 |LR(n,p).|((p)->fd|
|00002ad0| 73 5f 62 69 74 73 5b 30 | 5d 20 26 3d 20 7e 28 31 |s_bits[0|] &= ~(1|
|00002ae0| 20 3c 3c 20 28 6e 29 29 | 29 0a 23 64 65 66 69 6e | << (n))|).#defin|
|00002af0| 65 09 46 44 5f 49 53 53 | 45 54 28 6e 2c 70 29 09 |e.FD_ISS|ET(n,p).|
|00002b00| 28 28 70 29 2d 3e 66 64 | 73 5f 62 69 74 73 5b 30 |((p)->fd|s_bits[0|
|00002b10| 5d 20 26 20 28 31 20 3c | 3c 20 28 6e 29 29 29 0a |] & (1 <|< (n))).|
|00002b20| 23 64 65 66 69 6e 65 09 | 46 44 5f 5a 45 52 4f 28 |#define.|FD_ZERO(|
|00002b30| 70 29 09 28 28 70 29 2d | 3e 66 64 73 5f 62 69 74 |p).((p)-|>fds_bit|
|00002b40| 73 5b 30 5d 20 3d 20 30 | 29 0a 23 65 6e 64 69 66 |s[0] = 0|).#endif|
|00002b50| 0a 0a 74 79 70 65 64 65 | 66 20 69 6e 74 20 66 69 |..typede|f int fi|
|00002b60| 6c 64 65 73 5f 74 3b 09 | 09 09 2f 2a 20 66 69 6c |ldes_t;.|../* fil|
|00002b70| 65 20 64 65 73 63 72 69 | 70 74 6f 72 20 64 61 74 |e descri|ptor dat|
|00002b80| 61 20 74 79 70 65 20 2a | 2f 0a 74 79 70 65 64 65 |a type *|/.typede|
|00002b90| 66 20 69 6e 74 20 6e 77 | 69 6e 5f 74 3b 09 09 09 |f int nw|in_t;...|
|00002ba0| 2f 2a 20 77 69 6e 64 6f | 77 20 69 6e 64 65 78 20 |/* windo|w index |
|00002bb0| 64 61 74 61 20 74 79 70 | 65 20 2a 2f 0a 0a 73 74 |data typ|e */..st|
|00002bc0| 72 75 63 74 20 77 69 6e | 64 6f 77 20 7b 0a 09 66 |ruct win|dow {..f|
|00002bd0| 69 6c 64 65 73 5f 74 09 | 77 5f 66 64 3b 0a 09 63 |ildes_t.|w_fd;..c|
|00002be0| 68 61 72 09 09 77 5f 74 | 74 79 5b 33 32 5d 3b 0a |har..w_t|ty[32];.|
|00002bf0| 7d 3b 0a 0a 73 74 72 75 | 63 74 20 77 69 6e 64 6f |};..stru|ct windo|
|00002c00| 77 20 77 69 6e 64 6f 77 | 5b 4e 57 49 4e 44 4f 57 |w window|[NWINDOW|
|00002c10| 5d 3b 09 09 2f 2a 20 77 | 69 6e 64 6f 77 20 64 61 |];../* w|indow da|
|00002c20| 74 61 20 73 74 72 75 63 | 74 75 72 65 73 20 2a 2f |ta struc|tures */|
|00002c30| 0a 73 74 72 75 63 74 20 | 77 69 6e 64 6f 77 20 2a |.struct |window *|
|00002c40| 2a 66 64 6d 61 70 3b 09 | 09 09 2f 2a 20 6d 61 70 |*fdmap;.|../* map|
|00002c50| 70 69 6e 67 20 66 72 6f | 6d 20 66 64 27 73 20 74 |ping fro|m fd's t|
|00002c60| 6f 20 77 69 6e 64 6f 77 | 73 20 2a 2f 0a 73 74 72 |o window|s */.str|
|00002c70| 75 63 74 20 77 69 6e 64 | 6f 77 20 2a 63 75 72 77 |uct wind|ow *curw|
|00002c80| 69 6e 5b 32 5d 3b 09 09 | 2f 2a 20 63 75 72 72 65 |in[2];..|/* curre|
|00002c90| 6e 74 20 69 6e 70 75 74 | 20 61 6e 64 20 6f 75 74 |nt input| and out|
|00002ca0| 70 75 74 20 77 69 6e 64 | 6f 77 73 20 2a 2f 0a 66 |put wind|ows */.f|
|00002cb0| 69 6c 64 65 73 5f 74 20 | 6e 66 64 73 3b 09 09 09 |ildes_t |nfds;...|
|00002cc0| 09 2f 2a 20 6e 75 6d 62 | 65 72 20 6f 66 20 66 69 |./* numb|er of fi|
|00002cd0| 6c 65 20 64 65 73 63 72 | 69 70 74 6f 72 73 20 2a |le descr|iptors *|
|00002ce0| 2f 0a 0a 63 68 61 72 20 | 70 6f 72 74 61 6c 5b 5d |/..char |portal[]|
|00002cf0| 20 3d 20 22 2f 74 6d 70 | 2f 75 77 58 58 58 58 58 | = "/tmp|/uwXXXXX|
|00002d00| 58 22 3b 09 2f 2a 20 55 | 4e 49 58 2d 64 6f 6d 61 |X";./* U|NIX-doma|
|00002d10| 69 6e 20 6e 65 74 77 6f | 72 6b 20 61 64 64 72 65 |in netwo|rk addre|
|00002d20| 73 73 20 2a 2f 0a 0a 0a | 2f 2a 20 54 68 65 20 66 |ss */...|/* The f|
|00002d30| 6f 6c 6c 6f 77 69 6e 67 | 20 61 72 65 20 61 64 64 |ollowing| are add|
|00002d40| 65 64 20 74 6f 20 74 68 | 65 20 65 6e 76 69 72 6f |ed to th|e enviro|
|00002d50| 6e 6d 65 6e 74 20 6f 66 | 20 61 6c 6c 20 63 68 69 |nment of| all chi|
|00002d60| 6c 64 20 70 72 6f 63 65 | 73 73 65 73 20 2a 2f 0a |ld proce|sses */.|
|00002d70| 0a 63 68 61 72 20 65 6e | 76 5f 75 77 69 6e 5b 36 |.char en|v_uwin[6|
|00002d80| 34 5d 20 3d 20 22 55 57 | 49 4e 3d 22 3b 0a 63 68 |4] = "UW|IN=";.ch|
|00002d90| 61 72 20 2a 65 6e 76 5b | 5d 20 3d 20 7b 20 0a 09 |ar *env[|] = { ..|
|00002da0| 65 6e 76 5f 75 77 69 6e | 2c 0a 09 22 54 45 52 4d |env_uwin|,.."TERM|
|00002db0| 3d 61 64 6d 33 31 22 2c | 0a 09 22 54 45 52 4d 43 |=adm31",|.."TERMC|
|00002dc0| 41 50 3d 61 64 6d 33 31 | 3a 63 72 3d 5e 4d 3a 64 |AP=adm31|:cr=^M:d|
|00002dd0| 6f 3d 5e 4a 3a 6e 6c 3d | 5e 4a 3a 61 6c 3d 5c 5c |o=^J:nl=|^J:al=\\|
|00002de0| 45 45 3a 61 6d 3a 6c 65 | 3d 5e 48 3a 62 73 3a 63 |EE:am:le|=^H:bs:c|
|00002df0| 65 3d 5c 5c 45 54 3a 63 | 6d 3d 5c 5c 45 3d 25 2b |e=\\ET:c|m=\\E=%+|
|00002e00| 20 25 2b 20 3a 63 6c 3d | 5e 5a 3a 63 64 3d 5c 5c | %+ :cl=|^Z:cd=\\|
|00002e10| 45 59 3a 63 6f 23 38 30 | 3a 64 63 3d 5c 5c 45 57 |EY:co#80|:dc=\\EW|
|00002e20| 3a 64 6c 3d 5c 5c 45 52 | 3a 65 69 3d 5c 5c 45 72 |:dl=\\ER|:ei=\\Er|
|00002e30| 3a 68 6f 3d 5e 5e 3a 69 | 6d 3d 5c 5c 45 71 3a 6c |:ho=^^:i|m=\\Eq:l|
|00002e40| 69 23 32 34 3a 6d 69 3a | 6e 64 3d 5e 4c 3a 75 70 |i#24:mi:|nd=^L:up|
|00002e50| 3d 5e 4b 3a 4d 54 3a 6b | 6d 3a 73 6f 3d 5c 5c 45 |=^K:MT:k|m:so=\\E|
|00002e60| 47 31 3a 73 65 3d 5c 5c | 45 47 30 3a 22 2c 0a 09 |G1:se=\\|EG0:",..|
|00002e70| 4e 55 4c 4c 0a 7d 3b 0a | 0a 69 6e 74 20 63 74 6c |NULL.};.|.int ctl|
|00002e80| 63 68 5b 5d 20 3d 20 7b | 20 2d 31 2c 20 49 41 43 |ch[] = {| -1, IAC|
|00002e90| 2c 20 58 4f 4e 2c 20 58 | 4f 46 46 2c 20 2d 31 2c |, XON, X|OFF, -1,|
|00002ea0| 20 2d 31 2c 20 2d 31 2c | 20 2d 31 20 7d 3b 09 2f | -1, -1,| -1 };./|
|00002eb0| 2a 20 43 54 4c 20 63 68 | 61 72 20 6d 61 70 70 69 |* CTL ch|ar mappi|
|00002ec0| 6e 67 20 2a 2f 0a 0a 73 | 74 72 75 63 74 20 73 65 |ng */..s|truct se|
|00002ed0| 6c 6d 61 73 6b 20 7b 0a | 09 73 74 72 75 63 74 20 |lmask {.|.struct |
|00002ee0| 66 64 5f 73 65 74 09 73 | 6d 5f 72 64 3b 0a 09 73 |fd_set.s|m_rd;..s|
|00002ef0| 74 72 75 63 74 20 66 64 | 5f 73 65 74 09 73 6d 5f |truct fd|_set.sm_|
|00002f00| 77 74 3b 0a 09 73 74 72 | 75 63 74 20 66 64 5f 73 |wt;..str|uct fd_s|
|00002f10| 65 74 09 73 6d 5f 65 78 | 3b 0a 7d 20 73 65 6c 6d |et.sm_ex|;.} selm|
|00002f20| 61 73 6b 5b 32 5d 3b 0a | 0a 65 78 74 65 72 6e 20 |ask[2];.|.extern |
|00002f30| 63 68 61 72 20 2a 6d 6b | 74 65 6d 70 28 29 3b 0a |char *mk|temp();.|
|00002f40| 65 78 74 65 72 6e 20 63 | 68 61 72 20 2a 67 65 74 |extern c|har *get|
|00002f50| 65 6e 76 28 29 3b 0a 65 | 78 74 65 72 6e 20 63 68 |env();.e|xtern ch|
|00002f60| 61 72 20 2a 6d 61 6c 6c | 6f 63 28 29 3b 0a 65 78 |ar *mall|oc();.ex|
|00002f70| 74 65 72 6e 20 64 6f 6e | 65 28 29 2c 20 63 77 61 |tern don|e(), cwa|
|00002f80| 69 74 28 29 3b 0a 65 78 | 74 65 72 6e 20 69 6e 74 |it();.ex|tern int|
|00002f90| 20 65 72 72 6e 6f 3b 0a | 0a 6d 61 69 6e 28 61 72 | errno;.|.main(ar|
|00002fa0| 67 63 2c 20 61 72 67 76 | 29 0a 63 68 61 72 20 2a |gc, argv|).char *|
|00002fb0| 2a 61 72 67 76 3b 0a 7b | 0a 09 72 65 67 69 73 74 |*argv;.{|..regist|
|00002fc0| 65 72 20 66 69 6c 64 65 | 73 5f 74 20 66 64 2c 20 |er filde|s_t fd, |
|00002fd0| 73 64 3b 0a 09 72 65 67 | 69 73 74 65 72 20 73 74 |sd;..reg|ister st|
|00002fe0| 72 75 63 74 20 77 69 6e | 64 6f 77 20 2a 77 3b 0a |ruct win|dow *w;.|
|00002ff0| 09 73 74 72 75 63 74 20 | 73 6f 63 6b 61 64 64 72 |.struct |sockaddr|
|00003000| 20 73 61 3b 0a 0a 09 2f | 2a 0a 09 20 2a 20 4d 61 | sa;.../|*.. * Ma|
|00003010| 6b 65 20 73 75 72 65 20 | 77 65 20 64 6f 6e 27 74 |ke sure |we don't|
|00003020| 20 61 63 63 69 64 65 6e | 74 61 6c 6c 79 20 74 72 | acciden|tally tr|
|00003030| 79 20 74 6f 20 72 75 6e | 20 74 68 69 73 20 69 6e |y to run| this in|
|00003040| 73 69 64 65 20 69 74 73 | 65 6c 66 2e 0a 09 20 2a |side its|elf... *|
|00003050| 2f 0a 09 69 66 20 28 67 | 65 74 65 6e 76 28 22 55 |/..if (g|etenv("U|
|00003060| 57 49 4e 22 29 29 20 7b | 0a 09 09 66 70 72 69 6e |WIN")) {|...fprin|
|00003070| 74 66 28 73 74 64 65 72 | 72 2c 20 22 25 73 20 69 |tf(stder|r, "%s i|
|00003080| 73 20 61 6c 72 65 61 64 | 79 20 72 75 6e 6e 69 6e |s alread|y runnin|
|00003090| 67 5c 6e 22 2c 20 2a 61 | 72 67 76 29 3b 0a 09 09 |g\n", *a|rgv);...|
|000030a0| 65 78 69 74 28 31 29 3b | 0a 09 7d 0a 0a 09 2f 2a |exit(1);|..}.../*|
|000030b0| 0a 09 20 2a 20 43 6c 6f | 73 65 20 61 6c 6c 20 66 |.. * Clo|se all f|
|000030c0| 69 6c 65 20 64 65 73 63 | 72 69 70 74 6f 72 73 20 |ile desc|riptors |
|000030d0| 65 78 63 65 70 74 20 30 | 2c 20 31 2c 20 61 6e 64 |except 0|, 1, and|
|000030e0| 20 32 2e 0a 09 20 2a 2f | 0a 09 6e 66 64 73 20 3d | 2... */|..nfds =|
|000030f0| 20 67 65 74 64 74 61 62 | 6c 65 73 69 7a 65 28 29 | getdtab|lesize()|
|00003100| 3b 0a 09 66 6f 72 20 28 | 66 64 3d 33 3b 20 66 64 |;..for (|fd=3; fd|
|00003110| 20 3c 20 6e 66 64 73 3b | 20 66 64 2b 2b 29 0a 09 | < nfds;| fd++)..|
|00003120| 09 28 76 6f 69 64 29 63 | 6c 6f 73 65 28 66 64 29 |.(void)c|lose(fd)|
|00003130| 3b 0a 0a 09 2f 2a 0a 09 | 20 2a 20 41 6c 6c 6f 63 |;.../*..| * Alloc|
|00003140| 61 74 65 20 22 66 64 6d | 61 70 22 2e 20 20 57 65 |ate "fdm|ap". We|
|00003150| 20 63 61 6e 27 74 20 64 | 6f 20 74 68 69 73 20 61 | can't d|o this a|
|00003160| 74 20 63 6f 6d 70 69 6c | 65 20 74 69 6d 65 20 62 |t compil|e time b|
|00003170| 65 63 61 75 73 65 0a 09 | 20 2a 20 77 65 20 67 65 |ecause..| * we ge|
|00003180| 74 20 74 68 65 20 6e 75 | 6d 62 65 72 20 6f 66 20 |t the nu|mber of |
|00003190| 66 69 6c 65 20 64 65 73 | 63 72 69 70 74 6f 72 73 |file des|criptors|
|000031a0| 20 66 72 6f 6d 20 67 65 | 74 64 74 61 62 6c 65 73 | from ge|tdtables|
|000031b0| 69 7a 65 28 29 2e 0a 09 | 20 2a 2f 0a 09 69 66 20 |ize()...| */..if |
|000031c0| 28 21 28 66 64 6d 61 70 | 3d 28 73 74 72 75 63 74 |(!(fdmap|=(struct|
|000031d0| 20 77 69 6e 64 6f 77 20 | 2a 2a 29 6d 61 6c 6c 6f | window |**)mallo|
|000031e0| 63 28 6e 66 64 73 2a 73 | 69 7a 65 6f 66 28 73 74 |c(nfds*s|izeof(st|
|000031f0| 72 75 63 74 20 77 69 6e | 64 6f 77 20 2a 29 29 29 |ruct win|dow *)))|
|00003200| 29 20 7b 0a 09 09 66 70 | 72 69 6e 74 66 28 73 74 |) {...fp|rintf(st|
|00003210| 64 65 72 72 2c 20 22 63 | 61 6e 6e 6f 74 20 61 6c |derr, "c|annot al|
|00003220| 6c 6f 63 61 74 65 20 27 | 66 64 6d 61 70 27 20 61 |locate '|fdmap' a|
|00003230| 72 72 61 79 5c 6e 22 29 | 3b 0a 09 09 65 78 69 74 |rray\n")|;...exit|
|00003240| 28 31 29 3b 0a 09 7d 0a | 0a 09 2f 2a 0a 09 20 2a |(1);..}.|../*.. *|
|00003250| 20 4d 61 72 6b 20 61 6c | 6c 20 77 69 6e 64 6f 77 | Mark al|l window|
|00003260| 73 20 63 6c 6f 73 65 64 | 2e 0a 09 20 2a 2f 0a 0a |s closed|... */..|
|00003270| 09 66 6f 72 20 28 77 3d | 77 69 6e 64 6f 77 3b 20 |.for (w=|window; |
|00003280| 77 20 3c 20 77 69 6e 64 | 6f 77 2b 4e 57 49 4e 44 |w < wind|ow+NWIND|
|00003290| 4f 57 3b 20 77 2b 2b 29 | 0a 09 09 77 2d 3e 77 5f |OW; w++)|...w->w_|
|000032a0| 66 64 20 3d 20 2d 31 3b | 0a 0a 0a 09 2f 2a 0a 09 |fd = -1;|..../*..|
|000032b0| 20 2a 20 43 72 65 61 74 | 65 20 61 20 55 4e 49 58 | * Creat|e a UNIX|
|000032c0| 2d 64 6f 6d 61 69 6e 20 | 6e 65 74 77 6f 72 6b 20 |-domain |network |
|000032d0| 61 64 64 72 65 73 73 2c | 20 61 6e 64 20 70 75 74 |address,| and put|
|000032e0| 20 69 74 73 20 6e 61 6d | 65 20 69 6e 74 6f 0a 09 | its nam|e into..|
|000032f0| 20 2a 20 74 68 65 20 65 | 6e 76 69 72 6f 6e 6d 65 | * the e|nvironme|
|00003300| 6e 74 20 73 6f 20 74 68 | 61 74 20 64 65 73 63 65 |nt so th|at desce|
|00003310| 6e 64 65 6e 74 73 20 63 | 61 6e 20 63 6f 6e 74 61 |ndents c|an conta|
|00003320| 63 74 20 75 73 20 77 69 | 74 68 20 6e 65 77 0a 09 |ct us wi|th new..|
|00003330| 20 2a 20 77 69 6e 64 6f | 77 20 72 65 71 75 65 73 | * windo|w reques|
|00003340| 74 73 2e 0a 09 20 2a 2f | 0a 0a 09 28 76 6f 69 64 |ts... */|...(void|
|00003350| 29 73 74 72 6e 63 61 74 | 28 65 6e 76 5f 75 77 69 |)strncat|(env_uwi|
|00003360| 6e 2c 20 6d 6b 74 65 6d | 70 28 70 6f 72 74 61 6c |n, mktem|p(portal|
|00003370| 29 2c 20 73 69 7a 65 6f | 66 20 65 6e 76 5f 75 77 |), sizeo|f env_uw|
|00003380| 69 6e 20 2d 20 31 29 3b | 0a 09 73 65 74 65 6e 76 |in - 1);|..setenv|
|00003390| 28 65 6e 76 29 3b 0a 0a | 09 69 66 20 28 28 73 64 |(env);..|.if ((sd|
|000033a0| 3d 73 6f 63 6b 65 74 28 | 41 46 5f 55 4e 49 58 2c |=socket(|AF_UNIX,|
|000033b0| 20 53 4f 43 4b 5f 44 47 | 52 41 4d 2c 20 30 29 29 | SOCK_DG|RAM, 0))|
|000033c0| 20 3c 20 30 29 20 7b 0a | 09 09 70 65 72 72 6f 72 | < 0) {.|..perror|
|000033d0| 28 22 73 6f 63 6b 65 74 | 22 29 3b 0a 09 09 65 78 |("socket|");...ex|
|000033e0| 69 74 28 31 29 3b 0a 09 | 7d 0a 09 73 61 2e 73 61 |it(1);..|}..sa.sa|
|000033f0| 5f 66 61 6d 69 6c 79 20 | 3d 20 41 46 5f 55 4e 49 |_family |= AF_UNI|
|00003400| 58 3b 0a 09 28 76 6f 69 | 64 29 73 74 72 6e 63 70 |X;..(voi|d)strncp|
|00003410| 79 28 73 61 2e 73 61 5f | 64 61 74 61 2c 20 70 6f |y(sa.sa_|data, po|
|00003420| 72 74 61 6c 2c 20 73 69 | 7a 65 6f 66 20 73 61 2e |rtal, si|zeof sa.|
|00003430| 73 61 5f 64 61 74 61 2d | 31 29 3b 0a 09 73 61 2e |sa_data-|1);..sa.|
|00003440| 73 61 5f 64 61 74 61 5b | 73 69 7a 65 6f 66 20 73 |sa_data[|sizeof s|
|00003450| 61 2e 73 61 5f 64 61 74 | 61 2d 31 5d 20 3d 20 27 |a.sa_dat|a-1] = '|
|00003460| 5c 30 27 3b 0a 09 69 66 | 20 28 62 69 6e 64 28 73 |\0';..if| (bind(s|
|00003470| 64 2c 20 26 73 61 2c 20 | 73 69 7a 65 6f 66 20 73 |d, &sa, |sizeof s|
|00003480| 61 2e 73 61 5f 66 61 6d | 69 6c 79 20 2b 20 73 74 |a.sa_fam|ily + st|
|00003490| 72 6c 65 6e 28 73 61 2e | 73 61 5f 64 61 74 61 29 |rlen(sa.|sa_data)|
|000034a0| 29 20 3c 20 30 29 20 7b | 0a 09 09 70 65 72 72 6f |) < 0) {|...perro|
|000034b0| 72 28 22 62 69 6e 64 22 | 29 3b 0a 09 09 65 78 69 |r("bind"|);...exi|
|000034c0| 74 28 31 29 3b 0a 09 7d | 0a 09 69 66 20 28 66 63 |t(1);..}|..if (fc|
|000034d0| 6e 74 6c 28 73 64 2c 20 | 46 5f 53 45 54 46 4c 2c |ntl(sd, |F_SETFL,|
|000034e0| 20 46 4e 44 45 4c 41 59 | 29 29 0a 09 09 70 65 72 | FNDELAY|))...per|
|000034f0| 72 6f 72 28 22 66 63 6e | 74 6c 28 73 64 2c 20 46 |ror("fcn|tl(sd, F|
|00003500| 5f 53 45 54 46 4c 2c 20 | 46 4e 44 45 4c 41 59 29 |_SETFL, |FNDELAY)|
|00003510| 22 29 3b 0a 0a 0a 09 2f | 2a 0a 09 20 2a 20 49 67 |");..../|*.. * Ig|
|00003520| 6e 6f 72 65 20 69 6e 74 | 65 72 72 75 70 74 73 2c |nore int|errupts,|
|00003530| 20 71 75 69 74 73 2c 20 | 61 6e 64 20 74 65 72 6d | quits, |and term|
|00003540| 69 6e 61 6c 20 73 74 6f | 70 73 2e 20 20 43 6c 65 |inal sto|ps. Cle|
|00003550| 61 6e 20 75 70 20 61 6e | 64 20 65 78 69 74 0a 09 |an up an|d exit..|
|00003560| 20 2a 20 69 66 20 61 20 | 68 61 6e 67 75 70 20 6f | * if a |hangup o|
|00003570| 72 20 74 65 72 6d 69 6e | 61 74 69 6f 6e 20 69 73 |r termin|ation is|
|00003580| 20 72 65 63 65 69 76 65 | 64 2e 20 20 41 6c 73 6f | receive|d. Also|
|00003590| 20 63 61 74 63 68 20 63 | 68 61 6e 67 65 73 20 69 | catch c|hanges i|
|000035a0| 6e 0a 09 20 2a 20 63 68 | 69 6c 64 20 73 74 61 74 |n.. * ch|ild stat|
|000035b0| 75 73 20 28 73 6f 20 74 | 68 61 74 20 77 65 20 63 |us (so t|hat we c|
|000035c0| 61 6e 20 77 61 69 74 20 | 66 6f 72 20 74 68 65 6d |an wait |for them|
|000035d0| 29 2e 20 20 53 65 74 20 | 75 70 20 74 68 65 20 74 |). Set |up the t|
|000035e0| 65 72 6d 69 6e 61 6c 0a | 09 20 2a 20 6d 6f 64 65 |erminal.|. * mode|
|000035f0| 73 2e 0a 09 20 2a 2f 0a | 0a 09 28 76 6f 69 64 29 |s... */.|..(void)|
|00003600| 73 69 67 6e 61 6c 28 53 | 49 47 48 55 50 2c 20 64 |signal(S|IGHUP, d|
|00003610| 6f 6e 65 29 3b 0a 09 28 | 76 6f 69 64 29 73 69 67 |one);..(|void)sig|
|00003620| 6e 61 6c 28 53 49 47 49 | 4e 54 2c 20 53 49 47 5f |nal(SIGI|NT, SIG_|
|00003630| 49 47 4e 29 3b 0a 09 28 | 76 6f 69 64 29 73 69 67 |IGN);..(|void)sig|
|00003640| 6e 61 6c 28 53 49 47 51 | 55 49 54 2c 20 53 49 47 |nal(SIGQ|UIT, SIG|
|00003650| 5f 49 47 4e 29 3b 0a 09 | 28 76 6f 69 64 29 73 69 |_IGN);..|(void)si|
|00003660| 67 6e 61 6c 28 53 49 47 | 54 45 52 4d 2c 20 64 6f |gnal(SIG|TERM, do|
|00003670| 6e 65 29 3b 0a 09 28 76 | 6f 69 64 29 73 69 67 6e |ne);..(v|oid)sign|
|00003680| 61 6c 28 53 49 47 54 53 | 54 50 2c 20 53 49 47 5f |al(SIGTS|TP, SIG_|
|00003690| 49 47 4e 29 3b 0a 09 28 | 76 6f 69 64 29 73 69 67 |IGN);..(|void)sig|
|000036a0| 6e 61 6c 28 53 49 47 43 | 48 4c 44 2c 20 63 77 61 |nal(SIGC|HLD, cwa|
|000036b0| 69 74 29 3b 0a 0a 09 74 | 6d 6f 64 65 28 31 29 3b |it);...t|mode(1);|
|000036c0| 0a 0a 0a 09 2f 2a 0a 09 | 20 2a 20 54 65 6c 6c 20 |..../*..| * Tell |
|000036d0| 74 68 65 20 4d 61 63 69 | 6e 74 6f 73 68 20 74 6f |the Maci|ntosh to|
|000036e0| 20 69 6e 69 74 69 61 6c | 69 7a 65 2e 20 20 49 6e | initial|ize. In|
|000036f0| 69 74 69 61 6c 69 7a 65 | 20 74 68 65 20 63 75 72 |itialize| the cur|
|00003700| 72 65 6e 74 20 69 6e 70 | 75 74 0a 09 20 2a 20 61 |rent inp|ut.. * a|
|00003710| 6e 64 20 6f 75 74 70 75 | 74 20 77 69 6e 64 6f 77 |nd outpu|t window|
|00003720| 73 20 74 6f 20 4e 55 4c | 4c 2e 0a 09 20 2a 2f 0a |s to NUL|L... */.|
|00003730| 0a 09 78 6d 69 74 63 6d | 64 28 43 42 5f 46 4e 5f |..xmitcm|d(CB_FN_|
|00003740| 4d 41 49 4e 54 7c 43 42 | 5f 4d 46 5f 45 4e 54 52 |MAINT|CB|_MF_ENTR|
|00003750| 59 29 3b 0a 09 63 75 72 | 77 69 6e 5b 57 5f 49 4e |Y);..cur|win[W_IN|
|00003760| 5d 20 3d 20 63 75 72 77 | 69 6e 5b 57 5f 4f 55 54 |] = curw|in[W_OUT|
|00003770| 5d 20 3d 20 4e 55 4c 4c | 3b 0a 0a 09 0a 09 2f 2a |] = NULL|;...../*|
|00003780| 0a 09 20 2a 20 49 6e 69 | 74 69 61 6c 69 7a 65 20 |.. * Ini|tialize |
|00003790| 74 68 65 20 22 73 65 6c | 65 63 74 22 20 6d 61 73 |the "sel|ect" mas|
|000037a0| 6b 73 2c 20 63 72 65 61 | 74 65 20 77 69 6e 64 6f |ks, crea|te windo|
|000037b0| 77 20 31 20 28 74 6f 20 | 73 74 61 72 74 0a 09 20 |w 1 (to |start.. |
|000037c0| 2a 20 74 68 69 6e 67 73 | 20 6f 66 66 29 20 61 6e |* things| off) an|
|000037d0| 64 20 77 61 69 74 20 66 | 6f 72 20 69 6e 70 75 74 |d wait f|or input|
|000037e0| 2e 20 20 57 68 65 6e 20 | 69 6e 70 75 74 20 69 73 |. When |input is|
|000037f0| 20 61 76 61 69 6c 61 62 | 6c 65 2c 0a 09 20 2a 20 | availab|le,.. * |
|00003800| 70 72 6f 63 65 73 73 20 | 69 74 2e 0a 09 20 2a 2f |process |it... */|
|00003810| 0a 0a 09 46 44 5f 5a 45 | 52 4f 28 26 73 65 6c 6d |...FD_ZE|RO(&selm|
|00003820| 61 73 6b 5b 30 5d 2e 73 | 6d 5f 72 64 29 3b 0a 09 |ask[0].s|m_rd);..|
|00003830| 46 44 5f 5a 45 52 4f 28 | 26 73 65 6c 6d 61 73 6b |FD_ZERO(|&selmask|
|00003840| 5b 30 5d 2e 73 6d 5f 77 | 74 29 3b 0a 09 46 44 5f |[0].sm_w|t);..FD_|
|00003850| 5a 45 52 4f 28 26 73 65 | 6c 6d 61 73 6b 5b 30 5d |ZERO(&se|lmask[0]|
|00003860| 2e 73 6d 5f 65 78 29 3b | 0a 0a 09 46 44 5f 53 45 |.sm_ex);|...FD_SE|
|00003870| 54 28 30 2c 20 26 73 65 | 6c 6d 61 73 6b 5b 30 5d |T(0, &se|lmask[0]|
|00003880| 2e 73 6d 5f 72 64 29 3b | 0a 09 46 44 5f 53 45 54 |.sm_rd);|..FD_SET|
|00003890| 28 73 64 2c 20 26 73 65 | 6c 6d 61 73 6b 5b 30 5d |(sd, &se|lmask[0]|
|000038a0| 2e 73 6d 5f 72 64 29 3b | 0a 0a 09 69 66 20 28 6e |.sm_rd);|...if (n|
|000038b0| 65 77 77 69 6e 64 28 77 | 69 6e 64 6f 77 29 20 3d |ewwind(w|indow) =|
|000038c0| 3d 20 30 29 0a 09 09 78 | 6d 69 74 63 6d 64 28 43 |= 0)...x|mitcmd(C|
|000038d0| 42 5f 46 4e 5f 4e 45 57 | 57 7c 31 29 3b 0a 0a 09 |B_FN_NEW|W|1);...|
|000038e0| 77 68 69 6c 65 20 28 31 | 29 20 7b 0a 09 09 73 65 |while (1|) {...se|
|000038f0| 6c 6d 61 73 6b 5b 31 5d | 20 3d 20 73 65 6c 6d 61 |lmask[1]| = selma|
|00003900| 73 6b 5b 30 5d 3b 0a 09 | 09 69 66 20 28 73 65 6c |sk[0];..|.if (sel|
|00003910| 65 63 74 28 6e 66 64 73 | 2c 20 26 73 65 6c 6d 61 |ect(nfds|, &selma|
|00003920| 73 6b 5b 31 5d 2e 73 6d | 5f 72 64 2c 20 26 73 65 |sk[1].sm|_rd, &se|
|00003930| 6c 6d 61 73 6b 5b 31 5d | 2e 73 6d 5f 77 74 2c 0a |lmask[1]|.sm_wt,.|
|00003940| 09 09 20 20 20 20 26 73 | 65 6c 6d 61 73 6b 5b 31 |.. &s|elmask[1|
|00003950| 5d 2e 73 6d 5f 65 78 2c | 20 28 73 74 72 75 63 74 |].sm_ex,| (struct|
|00003960| 20 74 69 6d 65 76 61 6c | 20 2a 29 30 29 20 3c 20 | timeval| *)0) < |
|00003970| 30 29 20 7b 0a 09 09 09 | 69 66 20 28 65 72 72 6e |0) {....|if (errn|
|00003980| 6f 20 3d 3d 20 45 49 4e | 54 52 29 0a 09 09 09 09 |o == EIN|TR).....|
|00003990| 63 6f 6e 74 69 6e 75 65 | 3b 0a 09 09 09 70 65 72 |continue|;....per|
|000039a0| 72 6f 72 28 22 73 65 6c | 65 63 74 22 29 3b 0a 09 |ror("sel|ect");..|
|000039b0| 09 09 64 6f 6e 65 28 31 | 29 3b 09 2f 2a 20 66 6f |..done(1|);./* fo|
|000039c0| 72 20 6e 6f 77 20 2d 2d | 20 66 69 78 20 74 68 69 |r now --| fix thi|
|000039d0| 73 21 20 2a 2f 0a 09 09 | 7d 0a 09 09 66 6f 72 20 |s! */...|}...for |
|000039e0| 28 66 64 3d 30 3b 20 66 | 64 20 3c 20 6e 66 64 73 |(fd=0; f|d < nfds|
|000039f0| 3b 20 66 64 2b 2b 29 20 | 7b 0a 09 09 09 69 66 20 |; fd++) |{....if |
|00003a00| 28 46 44 5f 49 53 53 45 | 54 28 66 64 2c 20 26 73 |(FD_ISSE|T(fd, &s|
|00003a10| 65 6c 6d 61 73 6b 5b 31 | 5d 2e 73 6d 5f 72 64 29 |elmask[1|].sm_rd)|
|00003a20| 29 20 7b 0a 09 09 09 09 | 69 66 20 28 66 64 20 3c |) {.....|if (fd <|
|00003a30| 20 32 29 0a 09 09 09 09 | 09 6d 72 65 63 76 28 29 | 2).....|.mrecv()|
|00003a40| 3b 0a 09 09 09 09 65 6c | 73 65 20 69 66 20 28 66 |;.....el|se if (f|
|00003a50| 64 20 3d 3d 20 73 64 29 | 0a 09 09 09 09 09 6e 65 |d == sd)|......ne|
|00003a60| 74 72 65 63 76 28 73 64 | 29 3b 0a 09 09 09 09 65 |trecv(sd|);.....e|
|00003a70| 6c 73 65 0a 09 09 09 09 | 09 6d 78 6d 69 74 28 66 |lse.....|.mxmit(f|
|00003a80| 64 29 3b 0a 09 09 09 7d | 0a 09 09 7d 0a 09 7d 0a |d);....}|...}..}.|
|00003a90| 7d 0a 0a 6d 72 65 63 76 | 28 29 0a 7b 0a 09 72 65 |}..mrecv|().{..re|
|00003aa0| 67 69 73 74 65 72 20 69 | 6e 74 20 6c 65 6e 3b 0a |gister i|nt len;.|
|00003ab0| 09 72 65 67 69 73 74 65 | 72 20 63 68 61 72 20 2a |.registe|r char *|
|00003ac0| 63 70 2c 20 2a 63 71 3b | 0a 09 61 75 74 6f 20 69 |cp, *cq;|..auto i|
|00003ad0| 6e 74 20 6e 72 65 61 64 | 79 3b 0a 09 63 68 61 72 |nt nread|y;..char|
|00003ae0| 20 69 62 75 66 5b 35 31 | 32 5d 2c 20 6f 62 75 66 | ibuf[51|2], obuf|
|00003af0| 5b 35 31 32 5d 3b 0a 09 | 73 74 61 74 69 63 20 69 |[512];..|static i|
|00003b00| 6e 74 20 73 65 65 6e 5f | 69 61 63 2c 20 73 65 65 |nt seen_|iac, see|
|00003b10| 6e 5f 6d 65 74 61 3b 0a | 0a 09 2f 2a 0a 09 20 2a |n_meta;.|../*.. *|
|00003b20| 20 54 68 65 20 72 65 63 | 65 69 76 65 64 20 62 79 | The rec|eived by|
|00003b30| 74 65 73 74 72 65 61 6d | 20 69 73 20 65 78 61 6d |testream| is exam|
|00003b40| 69 6e 65 64 2e 20 20 4e | 6f 6e 2d 63 6f 6d 6d 61 |ined. N|on-comma|
|00003b50| 6e 64 20 62 79 74 65 73 | 20 61 72 65 0a 09 20 2a |nd bytes| are.. *|
|00003b60| 20 77 72 69 74 74 65 6e | 20 74 6f 20 74 68 65 20 | written| to the |
|00003b70| 66 69 6c 65 20 64 65 73 | 63 72 69 70 74 6f 72 20 |file des|criptor |
|00003b80| 63 6f 72 72 65 73 70 6f | 6e 64 69 6e 67 20 74 6f |correspo|nding to|
|00003b90| 20 74 68 65 20 63 75 72 | 72 65 6e 74 0a 09 20 2a | the cur|rent.. *|
|00003ba0| 20 22 69 6e 70 75 74 22 | 20 77 69 6e 64 6f 77 20 | "input"| window |
|00003bb0| 28 72 65 6c 61 74 69 76 | 65 20 74 6f 20 74 68 65 |(relativ|e to the|
|00003bc0| 20 4d 61 63 69 6e 74 6f | 73 68 20 2d 2d 20 74 68 | Macinto|sh -- th|
|00003bd0| 65 20 77 69 6e 64 6f 77 | 20 74 68 65 0a 09 20 2a |e window| the.. *|
|00003be0| 20 75 73 65 72 20 74 79 | 70 65 73 20 69 6e 70 75 | user ty|pes inpu|
|00003bf0| 74 20 74 6f 29 2e 0a 09 | 20 2a 2f 0a 0a 09 69 66 |t to)...| */...if|
|00003c00| 20 28 69 6f 63 74 6c 28 | 30 2c 20 28 69 6e 74 29 | (ioctl(|0, (int)|
|00003c10| 46 49 4f 4e 52 45 41 44 | 2c 20 28 63 68 61 72 20 |FIONREAD|, (char |
|00003c20| 2a 29 26 6e 72 65 61 64 | 79 29 20 3c 20 30 29 20 |*)&nread|y) < 0) |
|00003c30| 7b 0a 09 09 70 65 72 72 | 6f 72 28 22 46 49 4f 4e |{...perr|or("FION|
|00003c40| 52 45 41 44 22 29 3b 0a | 09 09 72 65 74 75 72 6e |READ");.|..return|
|00003c50| 3b 0a 09 7d 0a 0a 09 63 | 71 20 3d 20 6f 62 75 66 |;..}...c|q = obuf|
|00003c60| 3b 0a 09 77 68 69 6c 65 | 20 28 6e 72 65 61 64 79 |;..while| (nready|
|00003c70| 20 3e 20 30 29 20 7b 0a | 09 09 69 66 20 28 6e 72 | > 0) {.|..if (nr|
|00003c80| 65 61 64 79 20 3e 20 73 | 69 7a 65 6f 66 20 69 62 |eady > s|izeof ib|
|00003c90| 75 66 29 0a 09 09 09 6c | 65 6e 20 3d 20 72 65 61 |uf)....l|en = rea|
|00003ca0| 64 28 30 2c 20 69 62 75 | 66 2c 20 73 69 7a 65 6f |d(0, ibu|f, sizeo|
|00003cb0| 66 20 69 62 75 66 29 3b | 0a 09 09 65 6c 73 65 0a |f ibuf);|...else.|
|00003cc0| 09 09 09 6c 65 6e 20 3d | 20 72 65 61 64 28 30 2c |...len =| read(0,|
|00003cd0| 20 69 62 75 66 2c 20 6e | 72 65 61 64 79 29 3b 0a | ibuf, n|ready);.|
|00003ce0| 09 09 69 66 20 28 6c 65 | 6e 20 3c 3d 20 30 29 20 |..if (le|n <= 0) |
|00003cf0| 7b 0a 09 09 09 70 65 72 | 72 6f 72 28 22 72 65 61 |{....per|ror("rea|
|00003d00| 64 22 29 3b 0a 09 09 09 | 72 65 74 75 72 6e 3b 0a |d");....|return;.|
|00003d10| 09 09 7d 0a 09 09 66 6f | 72 20 28 63 70 3d 69 62 |..}...fo|r (cp=ib|
|00003d20| 75 66 3b 20 63 70 20 3c | 20 69 62 75 66 2b 6c 65 |uf; cp <| ibuf+le|
|00003d30| 6e 3b 20 63 70 2b 2b 29 | 20 7b 0a 09 09 09 69 66 |n; cp++)| {....if|
|00003d40| 20 28 73 65 65 6e 5f 69 | 61 63 29 20 7b 0a 09 09 | (seen_i|ac) {...|
|00003d50| 09 09 69 66 20 28 28 2a | 63 70 26 43 42 5f 44 49 |..if ((*|cp&CB_DI|
|00003d60| 52 29 20 3d 3d 20 43 42 | 5f 44 49 52 5f 4d 54 4f |R) == CB|_DIR_MTO|
|00003d70| 48 29 20 7b 0a 09 09 09 | 09 09 69 66 20 28 63 71 |H) {....|..if (cq|
|00003d80| 20 3e 20 6f 62 75 66 29 | 20 7b 0a 09 09 09 09 09 | > obuf)| {......|
|00003d90| 09 28 76 6f 69 64 29 77 | 72 69 74 65 28 63 75 72 |.(void)w|rite(cur|
|00003da0| 77 69 6e 5b 57 5f 49 4e | 5d 2d 3e 77 5f 66 64 2c |win[W_IN|]->w_fd,|
|00003db0| 0a 09 09 09 09 09 09 09 | 20 20 20 20 6f 62 75 66 |........| obuf|
|00003dc0| 2c 20 63 71 2d 6f 62 75 | 66 29 3b 0a 09 09 09 09 |, cq-obu|f);.....|
|00003dd0| 09 09 63 71 20 3d 20 6f | 62 75 66 3b 0a 09 09 09 |..cq = o|buf;....|
|00003de0| 09 09 7d 0a 09 09 09 09 | 09 73 77 69 74 63 68 20 |..}.....|.switch |
|00003df0| 28 2a 63 71 20 3d 20 72 | 65 63 76 63 6d 64 28 2a |(*cq = r|ecvcmd(*|
|00003e00| 63 70 29 29 20 7b 0a 09 | 09 09 09 09 63 61 73 65 |cp)) {..|....case|
|00003e10| 20 52 43 56 5f 4f 4b 3a | 0a 09 09 09 09 09 09 62 | RCV_OK:|.......b|
|00003e20| 72 65 61 6b 3b 0a 09 09 | 09 09 09 63 61 73 65 20 |reak;...|...case |
|00003e30| 52 43 56 5f 4d 45 54 41 | 3a 0a 09 09 09 09 09 09 |RCV_META|:.......|
|00003e40| 73 65 65 6e 5f 6d 65 74 | 61 20 3d 20 31 3b 0a 09 |seen_met|a = 1;..|
|00003e50| 09 09 09 09 09 62 72 65 | 61 6b 3b 0a 09 09 09 09 |.....bre|ak;.....|
|00003e60| 09 64 65 66 61 75 6c 74 | 3a 0a 09 09 09 09 09 09 |.default|:.......|
|00003e70| 69 66 20 28 73 65 65 6e | 5f 6d 65 74 61 29 20 7b |if (seen|_meta) {|
|00003e80| 0a 09 09 09 09 09 09 09 | 73 65 65 6e 5f 6d 65 74 |........|seen_met|
|00003e90| 61 20 3d 20 30 3b 0a 09 | 09 09 09 09 09 09 2a 63 |a = 0;..|......*c|
|00003ea0| 71 20 7c 3d 20 4d 45 54 | 41 3b 0a 09 09 09 09 09 |q |= MET|A;......|
|00003eb0| 09 7d 0a 09 09 09 09 09 | 09 69 66 20 28 63 75 72 |.}......|.if (cur|
|00003ec0| 77 69 6e 5b 57 5f 49 4e | 5d 29 0a 09 09 09 09 09 |win[W_IN|])......|
|00003ed0| 09 09 63 71 2b 2b 3b 0a | 09 09 09 09 09 09 62 72 |..cq++;.|......br|
|00003ee0| 65 61 6b 3b 0a 09 09 09 | 09 09 7d 0a 09 09 09 09 |eak;....|..}.....|
|00003ef0| 7d 0a 09 09 09 09 73 65 | 65 6e 5f 69 61 63 20 3d |}.....se|en_iac =|
|00003f00| 20 30 3b 0a 09 09 09 7d | 20 65 6c 73 65 20 69 66 | 0;....}| else if|
|00003f10| 20 28 2a 63 70 20 3d 3d | 20 49 41 43 29 0a 09 09 | (*cp ==| IAC)...|
|00003f20| 09 09 73 65 65 6e 5f 69 | 61 63 2b 2b 3b 0a 09 09 |..seen_i|ac++;...|
|00003f30| 09 65 6c 73 65 20 69 66 | 20 28 63 75 72 77 69 6e |.else if| (curwin|
|00003f40| 5b 57 5f 49 4e 5d 29 20 | 7b 0a 09 09 09 09 69 66 |[W_IN]) |{.....if|
|00003f50| 20 28 73 65 65 6e 5f 6d | 65 74 61 29 20 7b 0a 09 | (seen_m|eta) {..|
|00003f60| 09 09 09 09 73 65 65 6e | 5f 6d 65 74 61 20 3d 20 |....seen|_meta = |
|00003f70| 30 3b 0a 09 09 09 09 09 | 2a 63 71 2b 2b 20 3d 20 |0;......|*cq++ = |
|00003f80| 2a 63 70 7c 4d 45 54 41 | 3b 0a 09 09 09 09 7d 20 |*cp|META|;.....} |
|00003f90| 65 6c 73 65 0a 09 09 09 | 09 09 2a 63 71 2b 2b 20 |else....|..*cq++ |
|00003fa0| 3d 20 2a 63 70 3b 0a 09 | 09 09 09 69 66 20 28 63 |= *cp;..|...if (c|
|00003fb0| 71 20 3e 3d 20 6f 62 75 | 66 2b 73 69 7a 65 6f 66 |q >= obu|f+sizeof|
|00003fc0| 20 6f 62 75 66 29 20 7b | 0a 09 09 09 09 09 28 76 | obuf) {|......(v|
|00003fd0| 6f 69 64 29 77 72 69 74 | 65 28 63 75 72 77 69 6e |oid)writ|e(curwin|
|00003fe0| 5b 57 5f 49 4e 5d 2d 3e | 77 5f 66 64 2c 0a 09 09 |[W_IN]->|w_fd,...|
|00003ff0| 09 09 09 09 20 20 20 20 | 6f 62 75 66 2c 20 63 71 |.... |obuf, cq|
|00004000| 2d 6f 62 75 66 29 3b 0a | 09 09 09 09 09 63 71 20 |-obuf);.|.....cq |
|00004010| 3d 20 6f 62 75 66 3b 0a | 09 09 09 09 7d 0a 09 09 |= obuf;.|....}...|
|00004020| 09 7d 0a 09 09 7d 0a 09 | 09 6e 72 65 61 64 79 20 |.}...}..|.nready |
|00004030| 2d 3d 20 6c 65 6e 3b 0a | 09 7d 0a 09 69 66 20 28 |-= len;.|.}..if (|
|00004040| 63 71 20 3e 20 6f 62 75 | 66 29 0a 09 09 28 76 6f |cq > obu|f)...(vo|
|00004050| 69 64 29 77 72 69 74 65 | 28 63 75 72 77 69 6e 5b |id)write|(curwin[|
|00004060| 57 5f 49 4e 5d 2d 3e 77 | 5f 66 64 2c 20 6f 62 75 |W_IN]->w|_fd, obu|
|00004070| 66 2c 20 63 71 2d 6f 62 | 75 66 29 3b 0a 7d 0a 0a |f, cq-ob|uf);.}..|
|00004080| 72 65 63 76 63 6d 64 28 | 63 6d 64 29 0a 63 68 61 |recvcmd(|cmd).cha|
|00004090| 72 20 63 6d 64 3b 0a 7b | 0a 09 72 65 67 69 73 74 |r cmd;.{|..regist|
|000040a0| 65 72 20 69 6e 74 20 6e | 77 69 6e 2c 20 66 6e 3b |er int n|win, fn;|
|000040b0| 0a 09 72 65 67 69 73 74 | 65 72 20 73 74 72 75 63 |..regist|er struc|
|000040c0| 74 20 77 69 6e 64 6f 77 | 20 2a 77 3b 0a 0a 09 2f |t window| *w;.../|
|000040d0| 2a 0a 09 20 2a 20 50 65 | 72 66 6f 72 6d 20 74 68 |*.. * Pe|rform th|
|000040e0| 65 20 66 75 6e 63 74 69 | 6f 6e 20 74 68 65 20 4d |e functi|on the M|
|000040f0| 61 63 20 69 73 20 61 73 | 6b 69 6e 67 20 66 6f 72 |ac is as|king for|
|00004100| 2e 20 20 54 68 65 72 65 | 20 61 72 65 20 74 68 72 |. There| are thr|
|00004110| 65 65 0a 09 20 2a 20 62 | 72 6f 61 64 20 63 61 74 |ee.. * b|road cat|
|00004120| 65 67 6f 72 69 65 73 20 | 6f 66 20 74 68 65 73 65 |egories |of these|
|00004130| 20 66 75 6e 63 74 69 6f | 6e 73 3a 20 52 43 56 5f | functio|ns: RCV_|
|00004140| 4d 45 54 41 2c 20 77 68 | 69 63 68 20 74 65 6c 6c |META, wh|ich tell|
|00004150| 73 0a 09 20 2a 20 74 68 | 65 20 63 61 6c 6c 65 72 |s.. * th|e caller|
|00004160| 20 74 68 61 74 20 74 68 | 65 20 6e 65 78 74 20 63 | that th|e next c|
|00004170| 68 61 72 61 63 74 65 72 | 20 69 73 20 61 20 22 6d |haracter| is a "m|
|00004180| 65 74 61 22 20 63 68 61 | 72 61 63 74 65 72 3b 0a |eta" cha|racter;.|
|00004190| 09 20 2a 20 61 6e 20 41 | 53 43 49 49 20 64 61 74 |. * an A|SCII dat|
|000041a0| 61 20 63 68 61 72 61 63 | 74 65 72 2c 20 77 68 69 |a charac|ter, whi|
|000041b0| 63 68 20 69 73 20 70 61 | 73 73 65 64 20 62 61 63 |ch is pa|ssed bac|
|000041c0| 6b 20 74 6f 20 74 68 65 | 20 63 61 6c 6c 65 72 0a |k to the| caller.|
|000041d0| 09 20 2a 20 66 6f 72 20 | 70 72 6f 70 65 72 20 68 |. * for |proper h|
|000041e0| 61 6e 64 6c 69 6e 67 3b | 20 61 6e 64 20 52 43 56 |andling;| and RCV|
|000041f0| 5f 4f 4b 2c 20 77 68 69 | 63 68 20 6d 65 61 6e 73 |_OK, whi|ch means|
|00004200| 20 74 68 61 74 20 74 68 | 69 73 20 72 6f 75 74 69 | that th|is routi|
|00004210| 6e 65 0a 09 20 2a 20 68 | 61 73 20 64 6f 6e 65 20 |ne.. * h|as done |
|00004220| 65 76 65 72 79 74 68 69 | 6e 67 20 77 68 69 63 68 |everythi|ng which|
|00004230| 20 77 61 73 20 72 65 71 | 75 69 72 65 64 20 74 6f | was req|uired to|
|00004240| 20 70 72 6f 63 65 73 73 | 20 74 68 65 20 63 6f 6d | process| the com|
|00004250| 6d 61 6e 64 2e 0a 09 20 | 2a 2f 0a 0a 09 66 6e 20 |mand... |*/...fn |
|00004260| 3d 20 63 6d 64 26 43 42 | 5f 46 4e 3b 0a 09 73 77 |= cmd&CB|_FN;..sw|
|00004270| 69 74 63 68 20 28 66 6e | 29 20 7b 0a 09 63 61 73 |itch (fn|) {..cas|
|00004280| 65 20 43 42 5f 46 4e 5f | 4e 45 57 57 3a 0a 09 63 |e CB_FN_|NEWW:..c|
|00004290| 61 73 65 20 43 42 5f 46 | 4e 5f 4b 49 4c 4c 57 3a |ase CB_F|N_KILLW:|
|000042a0| 0a 09 63 61 73 65 20 43 | 42 5f 46 4e 5f 49 53 45 |..case C|B_FN_ISE|
|000042b0| 4c 57 3a 0a 09 09 6e 77 | 69 6e 20 3d 20 63 6d 64 |LW:...nw|in = cmd|
|000042c0| 26 43 42 5f 57 49 4e 44 | 4f 57 3b 0a 09 09 69 66 |&CB_WIND|OW;...if|
|000042d0| 20 28 21 6e 77 69 6e 29 | 0a 09 09 09 62 72 65 61 | (!nwin)|....brea|
|000042e0| 6b 3b 0a 09 09 77 20 3d | 20 26 77 69 6e 64 6f 77 |k;...w =| &window|
|000042f0| 5b 6e 77 69 6e 2d 31 5d | 3b 0a 0a 09 09 73 77 69 |[nwin-1]|;....swi|
|00004300| 74 63 68 20 28 66 6e 29 | 20 7b 0a 09 09 63 61 73 |tch (fn)| {...cas|
|00004310| 65 20 43 42 5f 46 4e 5f | 4e 45 57 57 3a 0a 09 09 |e CB_FN_|NEWW:...|
|00004320| 09 69 66 20 28 77 2d 3e | 77 5f 66 64 20 3c 20 30 |.if (w->|w_fd < 0|
|00004330| 20 26 26 20 6e 65 77 77 | 69 6e 64 28 77 29 20 3c | && neww|ind(w) <|
|00004340| 20 30 29 0a 09 09 09 09 | 78 6d 69 74 63 6d 64 28 | 0).....|xmitcmd(|
|00004350| 43 42 5f 46 4e 5f 4b 49 | 4c 4c 57 7c 6e 77 69 6e |CB_FN_KI|LLW|nwin|
|00004360| 29 3b 0a 09 09 09 62 72 | 65 61 6b 3b 0a 0a 09 09 |);....br|eak;....|
|00004370| 63 61 73 65 20 43 42 5f | 46 4e 5f 4b 49 4c 4c 57 |case CB_|FN_KILLW|
|00004380| 3a 0a 09 09 09 6b 69 6c | 6c 77 69 6e 64 28 77 2c |:....kil|lwind(w,|
|00004390| 20 30 29 3b 0a 09 09 09 | 62 72 65 61 6b 3b 0a 0a | 0);....|break;..|
|000043a0| 09 09 63 61 73 65 20 43 | 42 5f 46 4e 5f 49 53 45 |..case C|B_FN_ISE|
|000043b0| 4c 57 3a 0a 09 09 09 69 | 66 20 28 77 2d 3e 77 5f |LW:....i|f (w->w_|
|000043c0| 66 64 20 3e 3d 20 30 29 | 0a 09 09 09 09 63 75 72 |fd >= 0)|.....cur|
|000043d0| 77 69 6e 5b 57 5f 49 4e | 5d 20 3d 20 77 3b 0a 09 |win[W_IN|] = w;..|
|000043e0| 09 09 62 72 65 61 6b 3b | 0a 09 09 7d 0a 09 09 62 |..break;|...}...b|
|000043f0| 72 65 61 6b 3b 0a 0a 09 | 63 61 73 65 20 43 42 5f |reak;...|case CB_|
|00004400| 46 4e 5f 4d 45 54 41 3a | 0a 09 09 72 65 74 75 72 |FN_META:|...retur|
|00004410| 6e 28 52 43 56 5f 4d 45 | 54 41 29 3b 0a 0a 09 63 |n(RCV_ME|TA);...c|
|00004420| 61 73 65 20 43 42 5f 46 | 4e 5f 43 54 4c 43 48 3a |ase CB_F|N_CTLCH:|
|00004430| 0a 09 09 72 65 74 75 72 | 6e 28 63 74 6c 63 68 5b |...retur|n(ctlch[|
|00004440| 63 6d 64 26 43 42 5f 43 | 43 5d 29 3b 0a 0a 09 63 |cmd&CB_C|C]);...c|
|00004450| 61 73 65 20 43 42 5f 46 | 4e 5f 4d 41 49 4e 54 3a |ase CB_F|N_MAINT:|
|00004460| 0a 09 09 69 66 20 28 28 | 63 6d 64 26 43 42 5f 4d |...if ((|cmd&CB_M|
|00004470| 46 29 20 3d 3d 20 43 42 | 5f 4d 46 5f 45 58 49 54 |F) == CB|_MF_EXIT|
|00004480| 29 0a 09 09 09 64 6f 6e | 65 28 30 29 3b 0a 09 09 |)....don|e(0);...|
|00004490| 2f 2a 4e 4f 54 52 45 41 | 43 48 45 44 2a 2f 0a 09 |/*NOTREA|CHED*/..|
|000044a0| 7d 0a 09 72 65 74 75 72 | 6e 28 52 43 56 5f 4f 4b |}..retur|n(RCV_OK|
|000044b0| 29 3b 0a 7d 0a 0a 78 6d | 69 74 63 6d 64 28 63 6d |);.}..xm|itcmd(cm|
|000044c0| 64 29 0a 63 68 61 72 20 | 63 6d 64 3b 0a 7b 0a 09 |d).char |cmd;.{..|
|000044d0| 73 74 61 74 69 63 20 63 | 68 61 72 20 63 6d 64 62 |static c|har cmdb|
|000044e0| 75 66 5b 32 5d 20 3d 20 | 7b 20 49 41 43 2c 20 27 |uf[2] = |{ IAC, '|
|000044f0| 5c 30 27 20 7d 3b 0a 0a | 09 2f 2a 0a 09 20 2a 20 |\0' };..|./*.. * |
|00004500| 54 72 61 6e 73 6d 69 74 | 20 74 68 65 20 63 6f 6d |Transmit| the com|
|00004510| 6d 61 6e 64 20 22 63 6d | 64 22 20 74 6f 20 74 68 |mand "cm|d" to th|
|00004520| 65 20 4d 61 63 69 6e 74 | 6f 73 68 2e 20 20 54 68 |e Macint|osh. Th|
|00004530| 65 20 62 79 74 65 20 69 | 73 20 4f 52 65 64 0a 09 |e byte i|s ORed..|
|00004540| 20 2a 20 77 69 74 68 20 | 74 68 65 20 68 6f 73 74 | * with |the host|
|00004550| 2d 74 6f 2d 4d 61 63 20 | 64 69 72 65 63 74 69 6f |-to-Mac |directio|
|00004560| 6e 20 69 6e 64 69 63 61 | 74 6f 72 2e 0a 09 20 2a |n indica|tor... *|
|00004570| 2f 0a 0a 09 63 6d 64 62 | 75 66 5b 31 5d 20 3d 20 |/...cmdb|uf[1] = |
|00004580| 63 6d 64 7c 43 42 5f 44 | 49 52 5f 48 54 4f 4d 3b |cmd|CB_D|IR_HTOM;|
|00004590| 0a 09 28 76 6f 69 64 29 | 77 72 69 74 65 28 31 2c |..(void)|write(1,|
|000045a0| 20 63 6d 64 62 75 66 2c | 20 73 69 7a 65 6f 66 20 | cmdbuf,| sizeof |
|000045b0| 63 6d 64 62 75 66 29 3b | 0a 7d 0a 0a 6e 65 74 72 |cmdbuf);|.}..netr|
|000045c0| 65 63 76 28 73 64 29 0a | 72 65 67 69 73 74 65 72 |ecv(sd).|register|
|000045d0| 20 66 69 6c 64 65 73 5f | 74 20 73 64 3b 0a 7b 0a | fildes_|t sd;.{.|
|000045e0| 09 72 65 67 69 73 74 65 | 72 20 73 74 72 75 63 74 |.registe|r struct|
|000045f0| 20 77 69 6e 64 6f 77 20 | 2a 77 3b 0a 09 72 65 67 | window |*w;..reg|
|00004600| 69 73 74 65 72 20 69 6e | 74 20 63 6e 74 3b 0a 09 |ister in|t cnt;..|
|00004610| 73 74 72 75 63 74 20 6d | 73 67 68 64 72 20 6d 73 |struct m|sghdr ms|
|00004620| 67 3b 0a 09 61 75 74 6f | 20 69 6e 74 20 66 64 3b |g;..auto| int fd;|
|00004630| 0a 09 73 74 72 75 63 74 | 20 69 6f 76 65 63 20 69 |..struct| iovec i|
|00004640| 6f 76 3b 0a 09 73 74 72 | 75 63 74 20 73 74 61 74 |ov;..str|uct stat|
|00004650| 20 73 74 31 2c 20 73 74 | 32 3b 0a 09 73 74 61 74 | st1, st|2;..stat|
|00004660| 69 63 20 69 6e 74 20 75 | 6e 69 74 79 20 3d 20 31 |ic int u|nity = 1|
|00004670| 3b 0a 09 63 68 61 72 20 | 62 75 66 5b 32 35 36 5d |;..char |buf[256]|
|00004680| 3b 0a 0a 0a 09 2f 2a 0a | 09 20 2a 20 6d 61 69 6e |;..../*.|. * main|
|00004690| 28 29 20 63 61 6c 6c 73 | 20 74 68 69 73 20 72 6f |() calls| this ro|
|000046a0| 75 74 69 6e 65 20 77 68 | 65 6e 20 74 68 65 72 65 |utine wh|en there|
|000046b0| 20 69 73 20 61 20 6d 65 | 73 73 61 67 65 20 77 61 | is a me|ssage wa|
|000046c0| 69 74 69 6e 67 20 6f 6e | 0a 09 20 2a 20 74 68 65 |iting on|.. * the|
|000046d0| 20 55 4e 49 58 2d 64 6f | 6d 61 69 6e 20 73 6f 63 | UNIX-do|main soc|
|000046e0| 6b 65 74 2e 20 20 54 68 | 65 20 6d 65 73 73 61 67 |ket. Th|e messag|
|000046f0| 65 27 73 20 61 63 63 65 | 73 73 20 72 69 67 68 74 |e's acce|ss right|
|00004700| 73 20 61 72 65 0a 09 20 | 2a 20 65 78 70 65 63 74 |s are.. |* expect|
|00004710| 65 64 20 74 6f 20 63 6f | 6e 74 61 69 6e 20 74 68 |ed to co|ntain th|
|00004720| 65 20 66 69 6c 65 20 64 | 65 73 63 72 69 70 74 6f |e file d|escripto|
|00004730| 72 20 66 6f 72 20 74 68 | 65 20 22 6d 61 73 74 65 |r for th|e "maste|
|00004740| 72 22 20 73 69 64 65 0a | 09 20 2a 20 6f 66 20 61 |r" side.|. * of a|
|00004750| 20 70 73 65 75 64 6f 2d | 74 74 79 2e 20 20 54 68 | pseudo-|tty. Th|
|00004760| 65 20 6d 65 73 73 61 67 | 65 20 63 6f 6e 74 61 69 |e messag|e contai|
|00004770| 6e 73 20 74 68 65 20 6e | 61 6d 65 20 6f 66 20 74 |ns the n|ame of t|
|00004780| 68 65 20 70 74 79 2e 0a | 09 20 2a 20 54 68 65 20 |he pty..|. * The |
|00004790| 73 65 6e 64 65 72 20 69 | 73 20 65 78 70 65 63 74 |sender i|s expect|
|000047a0| 65 64 20 74 6f 20 73 74 | 61 72 74 20 75 70 20 61 |ed to st|art up a|
|000047b0| 20 70 72 6f 63 65 73 73 | 20 6f 6e 20 74 68 65 20 | process| on the |
|000047c0| 73 6c 61 76 65 20 73 69 | 64 65 0a 09 20 2a 20 6f |slave si|de.. * o|
|000047d0| 66 20 74 68 65 20 70 74 | 79 2e 20 20 54 68 69 73 |f the pt|y. This|
|000047e0| 20 61 6c 6c 6f 77 73 20 | 74 68 65 20 68 6f 73 74 | allows |the host|
|000047f0| 20 65 6e 64 20 74 6f 20 | 63 72 65 61 74 65 20 77 | end to |create w|
|00004800| 69 6e 64 6f 77 73 20 77 | 68 69 63 68 0a 09 20 2a |indows w|hich.. *|
|00004810| 20 72 75 6e 20 73 6f 6d | 65 74 68 69 6e 67 20 6f | run som|ething o|
|00004820| 74 68 65 72 20 74 68 61 | 6e 20 74 68 65 20 73 68 |ther tha|n the sh|
|00004830| 65 6c 6c 2e 0a 09 20 2a | 2f 0a 0a 09 66 64 20 3d |ell... *|/...fd =|
|00004840| 20 2d 31 3b 0a 0a 09 69 | 6f 76 2e 69 6f 76 5f 62 | -1;...i|ov.iov_b|
|00004850| 61 73 65 20 3d 20 28 63 | 61 64 64 72 5f 74 29 62 |ase = (c|addr_t)b|
|00004860| 75 66 3b 0a 09 69 6f 76 | 2e 69 6f 76 5f 6c 65 6e |uf;..iov|.iov_len|
|00004870| 20 3d 20 73 69 7a 65 6f | 66 20 62 75 66 20 2d 20 | = sizeo|f buf - |
|00004880| 31 3b 0a 0a 09 6d 73 67 | 2e 6d 73 67 5f 6e 61 6d |1;...msg|.msg_nam|
|00004890| 65 20 3d 20 28 63 61 64 | 64 72 5f 74 29 30 3b 0a |e = (cad|dr_t)0;.|
|000048a0| 09 6d 73 67 2e 6d 73 67 | 5f 6e 61 6d 65 6c 65 6e |.msg.msg|_namelen|
|000048b0| 20 3d 20 30 3b 0a 09 6d | 73 67 2e 6d 73 67 5f 69 | = 0;..m|sg.msg_i|
|000048c0| 6f 76 20 3d 20 26 69 6f | 76 3b 0a 09 6d 73 67 2e |ov = &io|v;..msg.|
|000048d0| 6d 73 67 5f 69 6f 76 6c | 65 6e 20 3d 20 31 3b 0a |msg_iovl|en = 1;.|
|000048e0| 09 6d 73 67 2e 6d 73 67 | 5f 61 63 63 72 69 67 68 |.msg.msg|_accrigh|
|000048f0| 74 73 20 3d 20 28 63 61 | 64 64 72 5f 74 29 26 66 |ts = (ca|ddr_t)&f|
|00004900| 64 3b 0a 09 6d 73 67 2e | 6d 73 67 5f 61 63 63 72 |d;..msg.|msg_accr|
|00004910| 69 67 68 74 73 6c 65 6e | 20 3d 20 73 69 7a 65 6f |ightslen| = sizeo|
|00004920| 66 20 66 64 3b 0a 0a 09 | 69 66 20 28 28 63 6e 74 |f fd;...|if ((cnt|
|00004930| 3d 72 65 63 76 6d 73 67 | 28 73 64 2c 20 26 6d 73 |=recvmsg|(sd, &ms|
|00004940| 67 2c 20 30 29 29 20 3c | 20 30 29 0a 09 09 70 65 |g, 0)) <| 0)...pe|
|00004950| 72 72 6f 72 28 22 72 65 | 63 76 6d 73 67 22 29 3b |rror("re|cvmsg");|
|00004960| 0a 0a 09 69 66 20 28 6d | 73 67 2e 6d 73 67 5f 61 |...if (m|sg.msg_a|
|00004970| 63 63 72 69 67 68 74 73 | 6c 65 6e 20 3e 20 30 20 |ccrights|len > 0 |
|00004980| 26 26 20 66 64 20 3e 3d | 20 30 29 20 7b 0a 09 09 |&& fd >=| 0) {...|
|00004990| 2f 2a 0a 09 09 20 2a 20 | 57 65 20 63 61 6e 27 74 |/*... * |We can't|
|000049a0| 20 74 72 75 73 74 20 74 | 68 65 20 70 72 6f 63 65 | trust t|he proce|
|000049b0| 73 73 20 77 68 69 63 68 | 20 63 6f 6e 6e 65 63 74 |ss which| connect|
|000049c0| 65 64 20 74 6f 20 75 73 | 2c 20 73 6f 0a 09 09 20 |ed to us|, so... |
|000049d0| 2a 20 77 65 20 76 65 72 | 69 66 79 20 74 68 61 74 |* we ver|ify that|
|000049e0| 20 69 74 20 72 65 61 6c | 6c 79 20 70 61 73 73 65 | it real|ly passe|
|000049f0| 64 20 75 73 20 61 20 70 | 73 65 75 64 6f 2d 74 74 |d us a p|seudo-tt|
|00004a00| 79 27 73 0a 09 09 20 2a | 20 66 69 6c 65 20 64 65 |y's... *| file de|
|00004a10| 73 63 72 69 70 74 6f 72 | 20 62 79 20 63 68 65 63 |scriptor| by chec|
|00004a20| 6b 69 6e 67 20 74 68 65 | 20 64 65 76 69 63 65 20 |king the| device |
|00004a30| 6e 61 6d 65 20 61 6e 64 | 20 69 74 73 0a 09 09 20 |name and| its... |
|00004a40| 2a 20 69 6e 6f 64 65 20 | 6e 75 6d 62 65 72 2e 20 |* inode |number. |
|00004a50| 20 5b 4f 66 20 63 6f 75 | 72 73 65 2c 20 69 66 20 | [Of cou|rse, if |
|00004a60| 73 6f 6d 65 6f 6e 65 20 | 65 6c 73 65 20 77 61 6e |someone |else wan|
|00004a70| 74 73 20 74 6f 0a 09 09 | 20 2a 20 68 61 6e 64 20 |ts to...| * hand |
|00004a80| 75 73 20 61 20 74 65 72 | 6d 69 6e 61 6c 20 73 65 |us a ter|minal se|
|00004a90| 73 73 69 6f 6e 20 72 75 | 6e 6e 69 6e 67 20 75 6e |ssion ru|nning un|
|00004aa0| 64 65 72 20 74 68 65 69 | 72 20 75 69 64 2e 2e 2e |der thei|r uid...|
|00004ab0| 2e 5d 0a 09 09 20 2a 2f | 0a 09 09 62 75 66 5b 63 |.]... */|...buf[c|
|00004ac0| 6e 74 5d 20 3d 20 30 3b | 0a 09 09 69 66 20 28 73 |nt] = 0;|...if (s|
|00004ad0| 74 72 6e 63 6d 70 28 62 | 75 66 2c 20 22 2f 64 65 |trncmp(b|uf, "/de|
|00004ae0| 76 2f 70 74 79 22 2c 20 | 73 69 7a 65 6f 66 20 22 |v/pty", |sizeof "|
|00004af0| 2f 64 65 76 2f 70 74 79 | 22 20 2d 20 31 29 20 7c |/dev/pty|" - 1) ||
|00004b00| 7c 0a 09 09 20 20 20 20 | 66 73 74 61 74 28 66 64 ||... |fstat(fd|
|00004b10| 2c 20 26 73 74 31 29 20 | 3c 20 30 20 7c 7c 20 73 |, &st1) |< 0 || s|
|00004b20| 74 61 74 28 62 75 66 2c | 20 26 73 74 32 29 20 3c |tat(buf,| &st2) <|
|00004b30| 20 30 20 7c 7c 0a 09 09 | 20 20 20 20 73 74 31 2e | 0 ||...| st1.|
|00004b40| 73 74 5f 64 65 76 20 21 | 3d 20 73 74 32 2e 73 74 |st_dev !|= st2.st|
|00004b50| 5f 64 65 76 20 7c 7c 20 | 73 74 31 2e 73 74 5f 69 |_dev || |st1.st_i|
|00004b60| 6e 6f 20 21 3d 20 73 74 | 32 2e 73 74 5f 69 6e 6f |no != st|2.st_ino|
|00004b70| 29 20 7b 0a 09 09 09 28 | 76 6f 69 64 29 63 6c 6f |) {....(|void)clo|
|00004b80| 73 65 28 66 64 29 3b 0a | 09 09 09 72 65 74 75 72 |se(fd);.|...retur|
|00004b90| 6e 3b 0a 09 09 7d 0a 09 | 09 2f 2a 0a 09 09 20 2a |n;...}..|./*... *|
|00004ba0| 20 4f 4b 2c 20 77 65 20 | 62 65 6c 69 65 76 65 20 | OK, we |believe |
|00004bb0| 74 68 65 20 73 65 6e 64 | 65 72 2e 20 20 57 65 20 |the send|er. We |
|00004bc0| 61 6c 6c 6f 63 61 74 65 | 20 61 20 77 69 6e 64 6f |allocate| a windo|
|00004bd0| 77 20 61 6e 64 0a 09 09 | 20 2a 20 74 65 6c 6c 20 |w and...| * tell |
|00004be0| 74 68 65 20 4d 61 63 69 | 6e 74 6f 73 68 20 74 6f |the Maci|ntosh to|
|00004bf0| 20 63 72 65 61 74 65 20 | 74 68 61 74 20 77 69 6e | create |that win|
|00004c00| 64 6f 77 20 6f 6e 20 69 | 74 73 20 65 6e 64 2e 0a |dow on i|ts end..|
|00004c10| 09 09 20 2a 2f 0a 09 09 | 62 75 66 5b 35 5d 20 3d |.. */...|buf[5] =|
|00004c20| 20 27 74 27 3b 09 09 2f | 2a 20 73 77 69 74 63 68 | 't';../|* switch|
|00004c30| 20 74 6f 20 22 2f 64 65 | 76 2f 74 74 79 70 3f 22 | to "/de|v/ttyp?"|
|00004c40| 20 2a 2f 0a 09 09 66 6f | 72 20 28 77 3d 77 69 6e | */...fo|r (w=win|
|00004c50| 64 6f 77 3b 20 77 20 3c | 20 77 69 6e 64 6f 77 2b |dow; w <| window+|
|00004c60| 4e 57 49 4e 44 4f 57 3b | 20 77 2b 2b 29 20 7b 0a |NWINDOW;| w++) {.|
|00004c70| 09 09 09 69 66 20 28 77 | 2d 3e 77 5f 66 64 20 3c |...if (w|->w_fd <|
|00004c80| 20 30 29 20 7b 0a 09 09 | 09 09 77 2d 3e 77 5f 66 | 0) {...|..w->w_f|
|00004c90| 64 20 3d 20 66 64 3b 0a | 09 09 09 09 66 64 6d 61 |d = fd;.|....fdma|
|00004ca0| 70 5b 66 64 5d 20 3d 20 | 77 3b 0a 09 09 09 09 46 |p[fd] = |w;.....F|
|00004cb0| 44 5f 53 45 54 28 66 64 | 2c 20 26 73 65 6c 6d 61 |D_SET(fd|, &selma|
|00004cc0| 73 6b 5b 30 5d 2e 73 6d | 5f 72 64 29 3b 0a 09 09 |sk[0].sm|_rd);...|
|00004cd0| 09 09 28 76 6f 69 64 29 | 73 74 72 6e 63 70 79 28 |..(void)|strncpy(|
|00004ce0| 77 2d 3e 77 5f 74 74 79 | 2c 20 62 75 66 2c 20 73 |w->w_tty|, buf, s|
|00004cf0| 69 7a 65 6f 66 20 77 2d | 3e 77 5f 74 74 79 2d 31 |izeof w-|>w_tty-1|
|00004d00| 29 3b 0a 09 09 09 09 78 | 6d 69 74 63 6d 64 28 43 |);.....x|mitcmd(C|
|00004d10| 42 5f 46 4e 5f 4e 45 57 | 57 7c 28 77 2d 77 69 6e |B_FN_NEW|W|(w-win|
|00004d20| 64 6f 77 2b 31 29 29 3b | 0a 09 09 09 09 62 72 65 |dow+1));|.....bre|
|00004d30| 61 6b 3b 0a 09 09 09 7d | 0a 09 09 7d 0a 09 09 2f |ak;....}|...}.../|
|00004d40| 2a 0a 09 09 20 2a 20 49 | 66 20 77 65 20 68 61 76 |*... * I|f we hav|
|00004d50| 65 20 6e 6f 20 66 72 65 | 65 20 77 69 6e 64 6f 77 |e no fre|e window|
|00004d60| 73 2c 20 74 68 65 6e 20 | 77 65 20 63 6c 6f 73 65 |s, then |we close|
|00004d70| 20 74 68 65 20 66 69 6c | 65 0a 09 09 20 2a 20 64 | the fil|e... * d|
|00004d80| 65 73 63 72 69 70 74 6f | 72 20 28 77 68 69 63 68 |escripto|r (which|
|00004d90| 20 77 69 6c 6c 20 74 65 | 72 6d 69 6e 61 74 65 20 | will te|rminate |
|00004da0| 74 68 65 20 73 6c 61 76 | 65 20 70 72 6f 63 65 73 |the slav|e proces|
|00004db0| 73 29 2e 0a 09 09 20 2a | 2f 0a 09 09 69 66 20 28 |s).... *|/...if (|
|00004dc0| 77 20 3d 3d 20 77 69 6e | 64 6f 77 2b 4e 57 49 4e |w == win|dow+NWIN|
|00004dd0| 44 4f 57 29 0a 09 09 09 | 28 76 6f 69 64 29 63 6c |DOW)....|(void)cl|
|00004de0| 6f 73 65 28 66 64 29 3b | 0a 09 09 2f 2a 0a 09 09 |ose(fd);|.../*...|
|00004df0| 20 2a 20 53 65 74 20 6e | 6f 6e 2d 62 6c 6f 63 6b | * Set n|on-block|
|00004e00| 69 6e 67 20 49 2f 4f 20 | 6f 6e 20 74 68 65 20 6d |ing I/O |on the m|
|00004e10| 61 73 74 65 72 20 73 69 | 64 65 2e 0a 09 09 20 2a |aster si|de.... *|
|00004e20| 2f 0a 09 09 28 76 6f 69 | 64 29 69 6f 63 74 6c 28 |/...(voi|d)ioctl(|
|00004e30| 66 64 2c 20 28 69 6e 74 | 29 46 49 4f 4e 42 49 4f |fd, (int|)FIONBIO|
|00004e40| 2c 20 28 63 68 61 72 20 | 2a 29 26 75 6e 69 74 79 |, (char |*)&unity|
|00004e50| 29 3b 0a 09 7d 0a 7d 0a | 0a 6d 78 6d 69 74 28 66 |);..}.}.|.mxmit(f|
|00004e60| 64 29 0a 72 65 67 69 73 | 74 65 72 20 66 69 6c 64 |d).regis|ter fild|
|00004e70| 65 73 5f 74 20 66 64 3b | 0a 7b 0a 09 72 65 67 69 |es_t fd;|.{..regi|
|00004e80| 73 74 65 72 20 63 68 61 | 72 20 2a 63 70 2c 20 2a |ster cha|r *cp, *|
|00004e90| 63 71 2c 20 69 3b 0a 09 | 72 65 67 69 73 74 65 72 |cq, i;..|register|
|00004ea0| 20 69 6e 74 20 6c 65 6e | 3b 0a 09 63 68 61 72 20 | int len|;..char |
|00004eb0| 69 62 75 66 5b 33 32 5d | 2c 20 6f 62 75 66 5b 33 |ibuf[32]|, obuf[3|
|00004ec0| 32 5d 3b 0a 0a 09 2f 2a | 0a 09 20 2a 20 43 6f 70 |2];.../*|.. * Cop|
|00004ed0| 79 20 69 6e 70 75 74 20 | 66 72 6f 6d 20 66 69 6c |y input |from fil|
|00004ee0| 65 20 22 66 64 22 20 74 | 6f 20 74 68 65 20 4d 61 |e "fd" t|o the Ma|
|00004ef0| 63 69 6e 74 6f 73 68 2e | 20 20 42 65 20 73 75 72 |cintosh.| Be sur|
|00004f00| 65 20 74 6f 20 63 6f 6e | 76 65 72 74 0a 09 20 2a |e to con|vert.. *|
|00004f10| 20 61 6e 79 20 65 6d 62 | 65 64 64 65 64 20 49 41 | any emb|edded IA|
|00004f20| 43 20 63 68 61 72 61 63 | 74 65 72 73 2e 0a 09 20 |C charac|ters... |
|00004f30| 2a 0a 09 20 2a 20 4e 6f | 74 65 20 74 68 61 74 20 |*.. * No|te that |
|00004f40| 74 68 65 20 69 6e 70 75 | 74 2f 6f 75 74 70 75 74 |the inpu|t/output|
|00004f50| 20 62 75 66 66 65 72 73 | 20 73 68 6f 75 6c 64 20 | buffers| should |
|00004f60| 4e 4f 54 20 62 65 20 76 | 65 72 79 20 6c 61 72 67 |NOT be v|ery larg|
|00004f70| 65 2e 0a 09 20 2a 20 49 | 74 20 69 73 20 75 6e 64 |e... * I|t is und|
|00004f80| 65 73 69 72 61 62 6c 65 | 20 74 6f 20 70 65 72 66 |esirable| to perf|
|00004f90| 6f 72 6d 20 6c 61 72 67 | 65 20 72 65 61 64 73 20 |orm larg|e reads |
|00004fa0| 61 6e 64 20 65 66 66 65 | 63 74 69 76 65 6c 79 0a |and effe|ctively.|
|00004fb0| 09 20 2a 20 22 6c 6f 63 | 6b 20 6f 75 74 22 20 61 |. * "loc|k out" a|
|00004fc0| 6c 6c 20 6f 74 68 65 72 | 20 66 69 6c 65 20 64 65 |ll other| file de|
|00004fd0| 73 63 72 69 70 74 6f 72 | 73 2e 20 20 54 68 65 20 |scriptor|s. The |
|00004fe0| 63 68 6f 73 65 6e 20 73 | 69 7a 65 0a 09 20 2a 20 |chosen s|ize.. * |
|00004ff0| 73 68 6f 75 6c 64 20 70 | 72 65 73 65 72 76 65 20 |should p|reserve |
|00005000| 61 20 72 65 61 73 6f 6e | 61 62 6c 65 20 61 6d 6f |a reason|able amo|
|00005010| 75 6e 74 20 6f 66 20 65 | 66 66 69 63 69 65 6e 63 |unt of e|fficienc|
|00005020| 79 2e 0a 09 20 2a 2f 0a | 0a 09 69 66 20 28 66 64 |y... */.|..if (fd|
|00005030| 6d 61 70 5b 66 64 5d 29 | 20 7b 0a 09 09 63 75 72 |map[fd])| {...cur|
|00005040| 77 69 6e 5b 57 5f 4f 55 | 54 5d 20 3d 20 66 64 6d |win[W_OU|T] = fdm|
|00005050| 61 70 5b 66 64 5d 3b 0a | 09 09 78 6d 69 74 63 6d |ap[fd];.|..xmitcm|
|00005060| 64 28 43 42 5f 46 4e 5f | 4f 53 45 4c 57 7c 28 66 |d(CB_FN_|OSELW|(f|
|00005070| 64 6d 61 70 5b 66 64 5d | 2d 77 69 6e 64 6f 77 2b |dmap[fd]|-window+|
|00005080| 31 29 29 3b 0a 09 09 63 | 71 20 3d 20 6f 62 75 66 |1));...c|q = obuf|
|00005090| 3b 0a 09 09 69 66 20 28 | 28 6c 65 6e 20 3d 20 72 |;...if (|(len = r|
|000050a0| 65 61 64 28 66 64 2c 20 | 69 62 75 66 2c 20 73 69 |ead(fd, |ibuf, si|
|000050b0| 7a 65 6f 66 20 69 62 75 | 66 29 29 20 3c 20 30 20 |zeof ibu|f)) < 0 |
|000050c0| 26 26 0a 09 09 20 20 20 | 20 65 72 72 6e 6f 20 21 |&&... | errno !|
|000050d0| 3d 20 45 57 4f 55 4c 44 | 42 4c 4f 43 4b 29 20 7b |= EWOULD|BLOCK) {|
|000050e0| 0a 09 09 09 6b 69 6c 6c | 77 69 6e 64 28 66 64 6d |....kill|wind(fdm|
|000050f0| 61 70 5b 66 64 5d 2c 20 | 31 29 3b 0a 09 09 09 72 |ap[fd], |1);....r|
|00005100| 65 74 75 72 6e 3b 0a 09 | 09 7d 0a 09 09 66 6f 72 |eturn;..|.}...for|
|00005110| 20 28 63 70 3d 69 62 75 | 66 3b 20 63 70 20 3c 20 | (cp=ibu|f; cp < |
|00005120| 69 62 75 66 2b 6c 65 6e | 3b 20 63 70 2b 2b 29 20 |ibuf+len|; cp++) |
|00005130| 7b 0a 09 09 09 69 66 20 | 28 2a 63 70 26 4d 45 54 |{....if |(*cp&MET|
|00005140| 41 29 20 7b 0a 09 09 09 | 09 69 66 20 28 63 71 20 |A) {....|.if (cq |
|00005150| 3e 20 6f 62 75 66 29 20 | 7b 0a 09 09 09 09 09 28 |> obuf) |{......(|
|00005160| 76 6f 69 64 29 77 72 69 | 74 65 28 31 2c 20 6f 62 |void)wri|te(1, ob|
|00005170| 75 66 2c 20 63 71 2d 6f | 62 75 66 29 3b 0a 09 09 |uf, cq-o|buf);...|
|00005180| 09 09 09 63 71 20 3d 20 | 6f 62 75 66 3b 0a 09 09 |...cq = |obuf;...|
|00005190| 09 09 7d 0a 09 09 09 09 | 78 6d 69 74 63 6d 64 28 |..}.....|xmitcmd(|
|000051a0| 43 42 5f 46 4e 5f 4d 45 | 54 41 29 3b 0a 09 09 09 |CB_FN_ME|TA);....|
|000051b0| 09 2a 63 70 20 26 3d 20 | 7e 4d 45 54 41 3b 0a 09 |.*cp &= |~META;..|
|000051c0| 09 09 7d 0a 09 09 09 69 | 20 3d 20 2d 31 3b 0a 09 |..}....i| = -1;..|
|000051d0| 09 09 69 66 20 28 2a 63 | 70 20 3d 3d 20 52 55 42 |..if (*c|p == RUB|
|000051e0| 20 7c 7c 20 2a 63 70 20 | 3c 20 27 20 27 29 20 7b | || *cp |< ' ') {|
|000051f0| 0a 09 09 09 09 69 20 3d | 20 73 69 7a 65 6f 66 20 |.....i =| sizeof |
|00005200| 63 74 6c 63 68 3b 0a 09 | 09 09 09 77 68 69 6c 65 |ctlch;..|...while|
|00005210| 20 28 69 20 3e 3d 20 30 | 20 26 26 20 63 74 6c 63 | (i >= 0| && ctlc|
|00005220| 68 5b 69 5d 20 21 3d 20 | 2a 63 70 29 0a 09 09 09 |h[i] != |*cp)....|
|00005230| 09 09 69 2d 2d 3b 0a 09 | 09 09 7d 0a 09 09 09 69 |..i--;..|..}....i|
|00005240| 66 20 28 69 20 3e 3d 20 | 30 29 20 7b 0a 09 09 09 |f (i >= |0) {....|
|00005250| 09 69 66 20 28 63 71 20 | 3e 20 6f 62 75 66 29 20 |.if (cq |> obuf) |
|00005260| 7b 0a 09 09 09 09 09 28 | 76 6f 69 64 29 77 72 69 |{......(|void)wri|
|00005270| 74 65 28 31 2c 20 6f 62 | 75 66 2c 20 63 71 2d 6f |te(1, ob|uf, cq-o|
|00005280| 62 75 66 29 3b 0a 09 09 | 09 09 09 63 71 20 3d 20 |buf);...|...cq = |
|00005290| 6f 62 75 66 3b 0a 09 09 | 09 09 7d 0a 09 09 09 09 |obuf;...|..}.....|
|000052a0| 78 6d 69 74 63 6d 64 28 | 43 42 5f 46 4e 5f 43 54 |xmitcmd(|CB_FN_CT|
|000052b0| 4c 43 48 7c 69 29 3b 0a | 09 09 09 7d 20 65 6c 73 |LCH|i);.|...} els|
|000052c0| 65 20 7b 0a 09 09 09 09 | 2a 63 71 2b 2b 20 3d 20 |e {.....|*cq++ = |
|000052d0| 2a 63 70 3b 0a 09 09 09 | 09 69 66 20 28 63 71 20 |*cp;....|.if (cq |
|000052e0| 3e 3d 20 6f 62 75 66 2b | 73 69 7a 65 6f 66 20 6f |>= obuf+|sizeof o|
|000052f0| 62 75 66 29 20 7b 0a 09 | 09 09 09 09 28 76 6f 69 |buf) {..|....(voi|
|00005300| 64 29 77 72 69 74 65 28 | 31 2c 20 6f 62 75 66 2c |d)write(|1, obuf,|
|00005310| 20 63 71 2d 6f 62 75 66 | 29 3b 0a 09 09 09 09 09 | cq-obuf|);......|
|00005320| 63 71 20 3d 20 6f 62 75 | 66 3b 0a 09 09 09 09 7d |cq = obu|f;.....}|
|00005330| 0a 09 09 09 7d 0a 09 09 | 7d 0a 09 7d 20 65 6c 73 |....}...|}..} els|
|00005340| 65 0a 09 09 28 76 6f 69 | 64 29 72 65 61 64 28 66 |e...(voi|d)read(f|
|00005350| 64 2c 20 69 62 75 66 2c | 20 73 69 7a 65 6f 66 20 |d, ibuf,| sizeof |
|00005360| 69 62 75 66 29 3b 0a 09 | 69 66 20 28 63 71 20 3e |ibuf);..|if (cq >|
|00005370| 20 6f 62 75 66 29 0a 09 | 09 28 76 6f 69 64 29 77 | obuf)..|.(void)w|
|00005380| 72 69 74 65 28 31 2c 20 | 6f 62 75 66 2c 20 63 71 |rite(1, |obuf, cq|
|00005390| 2d 6f 62 75 66 29 3b 0a | 7d 0a 0a 6b 69 6c 6c 77 |-obuf);.|}..killw|
|000053a0| 69 6e 64 28 77 2c 20 6e | 6f 74 69 66 79 29 0a 72 |ind(w, n|otify).r|
|000053b0| 65 67 69 73 74 65 72 20 | 73 74 72 75 63 74 20 77 |egister |struct w|
|000053c0| 69 6e 64 6f 77 20 2a 77 | 3b 0a 7b 0a 09 2f 2a 0a |indow *w|;.{../*.|
|000053d0| 09 20 2a 20 4b 69 6c 6c | 20 77 69 6e 64 6f 77 20 |. * Kill| window |
|000053e0| 22 77 22 2e 20 20 4e 6f | 74 69 66 79 20 74 68 65 |"w". No|tify the|
|000053f0| 20 4d 61 63 69 6e 74 6f | 73 68 20 74 68 61 74 20 | Macinto|sh that |
|00005400| 69 74 20 69 73 20 67 6f | 6e 65 20 69 66 0a 09 20 |it is go|ne if.. |
|00005410| 2a 20 22 6e 6f 74 69 66 | 79 22 20 69 73 20 6e 6f |* "notif|y" is no|
|00005420| 6e 7a 65 72 6f 2e 0a 09 | 20 2a 2f 0a 0a 09 46 44 |nzero...| */...FD|
|00005430| 5f 43 4c 52 28 77 2d 3e | 77 5f 66 64 2c 20 26 73 |_CLR(w->|w_fd, &s|
|00005440| 65 6c 6d 61 73 6b 5b 30 | 5d 2e 73 6d 5f 72 64 29 |elmask[0|].sm_rd)|
|00005450| 3b 0a 09 46 44 5f 43 4c | 52 28 77 2d 3e 77 5f 66 |;..FD_CL|R(w->w_f|
|00005460| 64 2c 20 26 73 65 6c 6d | 61 73 6b 5b 30 5d 2e 73 |d, &selm|ask[0].s|
|00005470| 6d 5f 77 74 29 3b 0a 09 | 46 44 5f 43 4c 52 28 77 |m_wt);..|FD_CLR(w|
|00005480| 2d 3e 77 5f 66 64 2c 20 | 26 73 65 6c 6d 61 73 6b |->w_fd, |&selmask|
|00005490| 5b 30 5d 2e 73 6d 5f 65 | 78 29 3b 0a 09 28 76 6f |[0].sm_e|x);..(vo|
|000054a0| 69 64 29 63 6c 6f 73 65 | 28 77 2d 3e 77 5f 66 64 |id)close|(w->w_fd|
|000054b0| 29 3b 0a 09 66 64 6d 61 | 70 5b 77 2d 3e 77 5f 66 |);..fdma|p[w->w_f|
|000054c0| 64 5d 20 3d 20 4e 55 4c | 4c 3b 0a 09 77 2d 3e 77 |d] = NUL|L;..w->w|
|000054d0| 5f 66 64 20 3d 20 2d 31 | 3b 0a 09 69 66 20 28 63 |_fd = -1|;..if (c|
|000054e0| 75 72 77 69 6e 5b 57 5f | 49 4e 5d 20 3d 3d 20 77 |urwin[W_|IN] == w|
|000054f0| 29 0a 09 09 63 75 72 77 | 69 6e 5b 57 5f 49 4e 5d |)...curw|in[W_IN]|
|00005500| 20 3d 20 4e 55 4c 4c 3b | 0a 09 69 66 20 28 63 75 | = NULL;|..if (cu|
|00005510| 72 77 69 6e 5b 57 5f 4f | 55 54 5d 20 3d 3d 20 77 |rwin[W_O|UT] == w|
|00005520| 29 0a 09 09 63 75 72 77 | 69 6e 5b 57 5f 4f 55 54 |)...curw|in[W_OUT|
|00005530| 5d 20 3d 20 4e 55 4c 4c | 3b 0a 09 69 66 20 28 6e |] = NULL|;..if (n|
|00005540| 6f 74 69 66 79 29 0a 09 | 09 78 6d 69 74 63 6d 64 |otify)..|.xmitcmd|
|00005550| 28 43 42 5f 46 4e 5f 4b | 49 4c 4c 57 7c 28 77 2d |(CB_FN_K|ILLW|(w-|
|00005560| 77 69 6e 64 6f 77 2b 31 | 29 29 3b 0a 7d 0a 0a 6e |window+1|));.}..n|
|00005570| 65 77 77 69 6e 64 28 77 | 29 0a 72 65 67 69 73 74 |ewwind(w|).regist|
|00005580| 65 72 20 73 74 72 75 63 | 74 20 77 69 6e 64 6f 77 |er struc|t window|
|00005590| 20 2a 77 3b 0a 7b 0a 09 | 72 65 67 69 73 74 65 72 | *w;.{..|register|
|000055a0| 20 69 6e 74 20 70 69 64 | 3b 0a 09 72 65 67 69 73 | int pid|;..regis|
|000055b0| 74 65 72 20 63 68 61 72 | 20 2a 73 68 65 6c 6c 3b |ter char| *shell;|
|000055c0| 0a 09 72 65 67 69 73 74 | 65 72 20 69 6e 74 20 66 |..regist|er int f|
|000055d0| 64 3b 0a 09 61 75 74 6f | 20 73 74 72 75 63 74 20 |d;..auto| struct |
|000055e0| 70 74 79 64 65 73 63 20 | 70 74 3b 0a 09 73 74 61 |ptydesc |pt;..sta|
|000055f0| 74 69 63 20 69 6e 74 20 | 75 6e 69 74 79 20 3d 20 |tic int |unity = |
|00005600| 31 3b 0a 09 65 78 74 65 | 72 6e 20 63 68 61 72 20 |1;..exte|rn char |
|00005610| 2a 67 65 74 65 6e 76 28 | 29 3b 0a 0a 09 2f 2a 0a |*getenv(|);.../*.|
|00005620| 09 20 2a 20 43 72 65 61 | 74 65 20 61 20 6e 65 77 |. * Crea|te a new|
|00005630| 20 77 69 6e 64 6f 77 20 | 75 73 69 6e 67 20 22 77 | window |using "w|
|00005640| 22 2e 0a 09 20 2a 2f 0a | 0a 09 69 66 20 28 6f 70 |"... */.|..if (op|
|00005650| 65 6e 70 74 79 28 26 70 | 74 29 20 3c 20 30 29 0a |enpty(&p|t) < 0).|
|00005660| 09 09 72 65 74 75 72 6e | 28 2d 31 29 3b 09 2f 2a |..return|(-1);./*|
|00005670| 20 62 65 74 74 65 72 20 | 72 65 63 6f 76 65 72 79 | better |recovery|
|00005680| 20 69 73 20 6e 65 65 64 | 65 64 20 2a 2f 0a 0a 09 | is need|ed */...|
|00005690| 28 76 6f 69 64 29 69 6f | 63 74 6c 28 70 74 2e 70 |(void)io|ctl(pt.p|
|000056a0| 74 5f 70 66 64 2c 20 28 | 69 6e 74 29 46 49 4f 4e |t_pfd, (|int)FION|
|000056b0| 42 49 4f 2c 20 28 63 68 | 61 72 20 2a 29 26 75 6e |BIO, (ch|ar *)&un|
|000056c0| 69 74 79 29 3b 0a 09 66 | 64 6d 61 70 5b 70 74 2e |ity);..f|dmap[pt.|
|000056d0| 70 74 5f 70 66 64 5d 20 | 3d 20 77 3b 0a 09 77 2d |pt_pfd] |= w;..w-|
|000056e0| 3e 77 5f 66 64 20 3d 20 | 70 74 2e 70 74 5f 70 66 |>w_fd = |pt.pt_pf|
|000056f0| 64 3b 0a 09 46 44 5f 53 | 45 54 28 70 74 2e 70 74 |d;..FD_S|ET(pt.pt|
|00005700| 5f 70 66 64 2c 20 26 73 | 65 6c 6d 61 73 6b 5b 30 |_pfd, &s|elmask[0|
|00005710| 5d 2e 73 6d 5f 72 64 29 | 3b 0a 09 28 76 6f 69 64 |].sm_rd)|;..(void|
|00005720| 29 73 74 72 6e 63 70 79 | 28 77 2d 3e 77 5f 74 74 |)strncpy|(w->w_tt|
|00005730| 79 2c 20 70 74 2e 70 74 | 5f 74 6e 61 6d 65 2c 20 |y, pt.pt|_tname, |
|00005740| 73 69 7a 65 6f 66 20 77 | 2d 3e 77 5f 74 74 79 29 |sizeof w|->w_tty)|
|00005750| 3b 0a 0a 09 2f 2a 0a 09 | 20 2a 20 57 65 20 6d 75 |;.../*..| * We mu|
|00005760| 73 74 20 73 70 61 77 6e | 20 61 20 6e 65 77 20 70 |st spawn| a new p|
|00005770| 72 6f 63 65 73 73 20 77 | 69 74 68 20 66 6f 72 6b |rocess w|ith fork|
|00005780| 28 29 2c 20 6e 6f 74 20 | 76 66 6f 72 6b 28 29 2c |(), not |vfork(),|
|00005790| 20 62 65 63 61 75 73 65 | 0a 09 20 2a 20 73 6f 6d | because|.. * som|
|000057a0| 65 20 69 6d 70 6c 65 6d | 65 6e 74 61 74 69 6f 6e |e implem|entation|
|000057b0| 73 20 28 65 2e 67 2e 20 | 53 75 6e 20 55 4e 49 58 |s (e.g. |Sun UNIX|
|000057c0| 29 20 6d 61 6e 69 70 75 | 6c 61 74 65 20 73 74 61 |) manipu|late sta|
|000057d0| 74 69 63 0a 09 20 2a 20 | 76 61 72 69 61 62 6c 65 |tic.. * |variable|
|000057e0| 73 20 77 69 74 68 69 6e | 20 74 68 65 20 73 69 67 |s within| the sig|
|000057f0| 6e 61 6c 28 29 20 73 75 | 62 72 6f 75 74 69 6e 65 |nal() su|broutine|
|00005800| 2e 20 20 49 66 20 77 65 | 20 76 66 6f 72 6b 28 29 |. If we| vfork()|
|00005810| 0a 09 20 2a 20 74 68 65 | 20 70 61 72 65 6e 74 20 |.. * the| parent |
|00005820| 77 69 6c 6c 20 64 69 65 | 20 77 68 65 6e 20 74 68 |will die| when th|
|00005830| 65 20 66 69 72 73 74 20 | 53 49 47 43 48 4c 44 20 |e first |SIGCHLD |
|00005840| 61 72 72 69 76 65 73 2e | 20 20 54 68 65 0a 09 20 |arrives.| The.. |
|00005850| 2a 20 64 61 74 61 2b 62 | 73 73 20 73 69 7a 65 20 |* data+b|ss size |
|00005860| 69 73 20 66 61 69 72 6c | 79 20 73 6d 61 6c 6c 2c |is fairl|y small,|
|00005870| 20 73 6f 20 74 68 69 73 | 20 69 73 6e 27 74 20 74 | so this| isn't t|
|00005880| 6f 6f 20 65 78 70 65 6e | 73 69 76 65 2e 0a 09 20 |oo expen|sive... |
|00005890| 2a 2f 0a 09 77 68 69 6c | 65 20 28 28 70 69 64 3d |*/..whil|e ((pid=|
|000058a0| 66 6f 72 6b 28 29 29 20 | 3c 20 30 29 0a 09 09 73 |fork()) |< 0)...s|
|000058b0| 6c 65 65 70 28 35 29 3b | 0a 09 69 66 20 28 21 70 |leep(5);|..if (!p|
|000058c0| 69 64 29 20 7b 0a 09 09 | 28 76 6f 69 64 29 73 69 |id) {...|(void)si|
|000058d0| 67 6e 61 6c 28 53 49 47 | 48 55 50 2c 20 53 49 47 |gnal(SIG|HUP, SIG|
|000058e0| 5f 44 46 4c 29 3b 0a 09 | 09 28 76 6f 69 64 29 73 |_DFL);..|.(void)s|
|000058f0| 69 67 6e 61 6c 28 53 49 | 47 49 4e 54 2c 20 53 49 |ignal(SI|GINT, SI|
|00005900| 47 5f 44 46 4c 29 3b 0a | 09 09 28 76 6f 69 64 29 |G_DFL);.|..(void)|
|00005910| 73 69 67 6e 61 6c 28 53 | 49 47 51 55 49 54 2c 20 |signal(S|IGQUIT, |
|00005920| 53 49 47 5f 44 46 4c 29 | 3b 0a 09 09 28 76 6f 69 |SIG_DFL)|;...(voi|
|00005930| 64 29 73 69 67 6e 61 6c | 28 53 49 47 54 45 52 4d |d)signal|(SIGTERM|
|00005940| 2c 20 53 49 47 5f 44 46 | 4c 29 3b 0a 09 09 28 76 |, SIG_DF|L);...(v|
|00005950| 6f 69 64 29 73 69 67 6e | 61 6c 28 53 49 47 54 53 |oid)sign|al(SIGTS|
|00005960| 54 50 2c 20 53 49 47 5f | 49 47 4e 29 3b 0a 09 09 |TP, SIG_|IGN);...|
|00005970| 28 76 6f 69 64 29 73 69 | 67 6e 61 6c 28 53 49 47 |(void)si|gnal(SIG|
|00005980| 43 48 4c 44 2c 20 53 49 | 47 5f 44 46 4c 29 3b 0a |CHLD, SI|G_DFL);.|
|00005990| 09 09 28 76 6f 69 64 29 | 69 6f 63 74 6c 28 6f 70 |..(void)|ioctl(op|
|000059a0| 65 6e 28 22 2f 64 65 76 | 2f 74 74 79 22 2c 4f 5f |en("/dev|/tty",O_|
|000059b0| 52 44 57 52 29 2c 20 28 | 69 6e 74 29 54 49 4f 43 |RDWR), (|int)TIOC|
|000059c0| 4e 4f 54 54 59 2c 20 28 | 63 68 61 72 20 2a 29 30 |NOTTY, (|char *)0|
|000059d0| 29 3b 0a 09 09 28 76 6f | 69 64 29 63 6c 6f 73 65 |);...(vo|id)close|
|000059e0| 28 6f 70 65 6e 28 70 74 | 2e 70 74 5f 74 6e 61 6d |(open(pt|.pt_tnam|
|000059f0| 65 2c 20 4f 5f 52 44 4f | 4e 4c 59 29 29 3b 20 2f |e, O_RDO|NLY)); /|
|00005a00| 2a 20 73 65 74 20 6e 65 | 77 20 63 74 72 6c 20 74 |* set ne|w ctrl t|
|00005a10| 74 79 20 2a 2f 0a 09 09 | 28 76 6f 69 64 29 73 65 |ty */...|(void)se|
|00005a20| 74 75 69 64 28 67 65 74 | 75 69 64 28 29 29 3b 09 |tuid(get|uid());.|
|00005a30| 09 2f 2a 20 73 68 6f 75 | 6c 64 6e 27 74 20 6e 65 |./* shou|ldn't ne|
|00005a40| 65 64 20 74 68 69 73 20 | 2a 2f 0a 09 09 69 66 20 |ed this |*/...if |
|00005a50| 28 21 28 73 68 65 6c 6c | 20 3d 20 67 65 74 65 6e |(!(shell| = geten|
|00005a60| 76 28 22 53 48 45 4c 4c | 22 29 29 29 0a 09 09 09 |v("SHELL|")))....|
|00005a70| 73 68 65 6c 6c 20 3d 20 | 22 2f 62 69 6e 2f 73 68 |shell = |"/bin/sh|
|00005a80| 22 3b 0a 09 09 28 76 6f | 69 64 29 64 75 70 32 28 |";...(vo|id)dup2(|
|00005a90| 70 74 2e 70 74 5f 74 66 | 64 2c 20 30 29 3b 0a 09 |pt.pt_tf|d, 0);..|
|00005aa0| 09 28 76 6f 69 64 29 64 | 75 70 32 28 30 2c 20 31 |.(void)d|up2(0, 1|
|00005ab0| 29 3b 0a 09 09 28 76 6f | 69 64 29 64 75 70 32 28 |);...(vo|id)dup2(|
|00005ac0| 30 2c 20 32 29 3b 0a 09 | 09 66 6f 72 20 28 66 64 |0, 2);..|.for (fd|
|00005ad0| 3d 33 3b 20 66 64 20 3c | 20 6e 66 64 73 3b 20 66 |=3; fd <| nfds; f|
|00005ae0| 64 2b 2b 29 0a 09 09 09 | 28 76 6f 69 64 29 63 6c |d++)....|(void)cl|
|00005af0| 6f 73 65 28 66 64 29 3b | 0a 09 09 74 6d 6f 64 65 |ose(fd);|...tmode|
|00005b00| 28 30 29 3b 09 2f 2a 20 | 48 41 43 4b 21 20 2a 2f |(0);./* |HACK! */|
|00005b10| 0a 09 09 65 78 65 63 6c | 28 73 68 65 6c 6c 2c 20 |...execl|(shell, |
|00005b20| 73 68 65 6c 6c 2c 20 28 | 63 68 61 72 20 2a 29 30 |shell, (|char *)0|
|00005b30| 29 3b 0a 09 09 5f 65 78 | 69 74 28 31 29 3b 0a 09 |);..._ex|it(1);..|
|00005b40| 7d 0a 0a 09 28 76 6f 69 | 64 29 63 6c 6f 73 65 28 |}...(voi|d)close(|
|00005b50| 70 74 2e 70 74 5f 74 66 | 64 29 3b 0a 09 72 65 74 |pt.pt_tf|d);..ret|
|00005b60| 75 72 6e 28 30 29 3b 0a | 7d 0a 0a 74 6d 6f 64 65 |urn(0);.|}..tmode|
|00005b70| 28 66 29 0a 7b 0a 09 73 | 74 61 74 69 63 20 73 74 |(f).{..s|tatic st|
|00005b80| 72 75 63 74 20 73 67 74 | 74 79 62 20 6f 73 74 74 |ruct sgt|tyb ostt|
|00005b90| 79 2c 20 6e 73 74 74 79 | 3b 0a 09 73 74 61 74 69 |y, nstty|;..stati|
|00005ba0| 63 20 73 74 72 75 63 74 | 20 74 63 68 61 72 73 20 |c struct| tchars |
|00005bb0| 6f 74 63 68 61 72 73 2c | 20 6e 74 63 68 61 72 73 |otchars,| ntchars|
|00005bc0| 3b 0a 09 73 74 61 74 69 | 63 20 73 74 72 75 63 74 |;..stati|c struct|
|00005bd0| 20 6c 74 63 68 61 72 73 | 20 6f 6c 74 63 68 61 72 | ltchars| oltchar|
|00005be0| 73 2c 20 6e 6c 74 63 68 | 61 72 73 3b 0a 09 73 74 |s, nltch|ars;..st|
|00005bf0| 61 74 69 63 20 69 6e 74 | 20 6f 6c 6d 6f 64 65 2c |atic int| olmode,|
|00005c00| 20 6e 6c 6d 6f 64 65 3b | 0a 09 73 74 61 74 69 63 | nlmode;|..static|
|00005c10| 20 73 61 76 65 64 3b 0a | 0a 09 2f 2a 0a 09 20 2a | saved;.|../*.. *|
|00005c20| 20 54 68 69 73 20 72 6f | 75 74 69 6e 65 20 65 69 | This ro|utine ei|
|00005c30| 74 68 65 72 20 73 61 76 | 65 73 20 74 68 65 20 63 |ther sav|es the c|
|00005c40| 75 72 72 65 6e 74 20 74 | 65 72 6d 69 6e 61 6c 20 |urrent t|erminal |
|00005c50| 6d 6f 64 65 73 20 61 6e | 64 20 74 68 65 6e 0a 09 |modes an|d then..|
|00005c60| 20 2a 20 73 65 74 73 20 | 75 70 20 74 68 65 20 74 | * sets |up the t|
|00005c70| 65 72 6d 69 6e 61 6c 20 | 6c 69 6e 65 20 6f 72 20 |erminal |line or |
|00005c80| 72 65 73 65 74 73 20 74 | 68 65 20 74 65 72 6d 69 |resets t|he termi|
|00005c90| 6e 61 6c 20 6d 6f 64 65 | 73 20 28 64 65 70 65 6e |nal mode|s (depen|
|00005ca0| 64 69 6e 67 0a 09 20 2a | 20 75 70 6f 6e 20 74 68 |ding.. *| upon th|
|00005cb0| 65 20 76 61 6c 75 65 20 | 6f 66 20 22 66 22 29 2e |e value |of "f").|
|00005cc0| 20 20 54 68 65 20 74 65 | 72 6d 69 6e 61 6c 20 6c | The te|rminal l|
|00005cd0| 69 6e 65 20 69 73 20 75 | 73 65 64 20 69 6e 20 22 |ine is u|sed in "|
|00005ce0| 63 62 72 65 61 6b 22 0a | 09 20 2a 20 6d 6f 64 65 |cbreak".|. * mode|
|00005cf0| 20 77 69 74 68 20 61 6c | 6c 20 73 70 65 63 69 61 | with al|l specia|
|00005d00| 6c 20 63 68 61 72 61 63 | 74 65 72 73 20 65 78 63 |l charac|ters exc|
|00005d10| 65 70 74 20 58 4f 4e 2f | 58 4f 46 46 20 64 69 73 |ept XON/|XOFF dis|
|00005d20| 61 62 6c 65 64 2e 20 20 | 54 68 65 0a 09 20 2a 20 |abled. |The.. * |
|00005d30| 68 61 74 65 64 20 28 62 | 79 20 6d 65 29 20 4c 44 |hated (b|y me) LD|
|00005d40| 45 43 43 54 51 20 6d 6f | 64 65 20 69 73 20 72 65 |ECCTQ mo|de is re|
|00005d50| 71 75 69 72 65 64 20 66 | 6f 72 20 74 68 65 20 4d |quired f|or the M|
|00005d60| 61 63 69 6e 74 6f 73 68 | 20 74 6f 0a 09 20 2a 20 |acintosh| to.. * |
|00005d70| 68 61 6e 64 6c 65 20 66 | 6c 6f 77 20 63 6f 6e 74 |handle f|low cont|
|00005d80| 72 6f 6c 20 70 72 6f 70 | 65 72 6c 79 2e 0a 09 20 |rol prop|erly... |
|00005d90| 2a 2f 0a 0a 09 69 66 20 | 28 66 20 3d 3d 20 31 29 |*/...if |(f == 1)|
|00005da0| 20 7b 0a 09 09 69 66 20 | 28 69 6f 63 74 6c 28 30 | {...if |(ioctl(0|
|00005db0| 2c 20 28 69 6e 74 29 54 | 49 4f 43 47 45 54 50 2c |, (int)T|IOCGETP,|
|00005dc0| 20 28 63 68 61 72 20 2a | 29 26 6f 73 74 74 79 29 | (char *|)&ostty)|
|00005dd0| 20 3c 20 30 29 20 7b 0a | 09 09 09 70 65 72 72 6f | < 0) {.|...perro|
|00005de0| 72 28 22 69 6f 63 74 6c | 28 28 69 6e 74 29 54 49 |r("ioctl|((int)TI|
|00005df0| 4f 43 47 45 54 50 29 22 | 29 3b 0a 09 09 09 64 6f |OCGETP)"|);....do|
|00005e00| 6e 65 28 31 29 3b 0a 09 | 09 7d 0a 09 09 69 66 20 |ne(1);..|.}...if |
|00005e10| 28 69 6f 63 74 6c 28 30 | 2c 20 28 69 6e 74 29 54 |(ioctl(0|, (int)T|
|00005e20| 49 4f 43 47 45 54 43 2c | 20 28 63 68 61 72 20 2a |IOCGETC,| (char *|
|00005e30| 29 26 6f 74 63 68 61 72 | 73 29 20 3c 20 30 29 20 |)&otchar|s) < 0) |
|00005e40| 7b 0a 09 09 09 70 65 72 | 72 6f 72 28 22 69 6f 63 |{....per|ror("ioc|
|00005e50| 74 6c 28 28 69 6e 74 29 | 54 49 4f 43 47 45 54 43 |tl((int)|TIOCGETC|
|00005e60| 29 22 29 3b 0a 09 09 09 | 64 6f 6e 65 28 31 29 3b |)");....|done(1);|
|00005e70| 0a 09 09 7d 0a 09 09 69 | 66 20 28 69 6f 63 74 6c |...}...i|f (ioctl|
|00005e80| 28 30 2c 20 28 69 6e 74 | 29 54 49 4f 43 47 4c 54 |(0, (int|)TIOCGLT|
|00005e90| 43 2c 20 28 63 68 61 72 | 20 2a 29 26 6f 6c 74 63 |C, (char| *)&oltc|
|00005ea0| 68 61 72 73 29 20 3c 20 | 30 29 20 7b 0a 09 09 09 |hars) < |0) {....|
|00005eb0| 70 65 72 72 6f 72 28 22 | 69 6f 63 74 6c 28 28 69 |perror("|ioctl((i|
|00005ec0| 6e 74 29 54 49 4f 43 47 | 4c 54 43 29 22 29 3b 0a |nt)TIOCG|LTC)");.|
|00005ed0| 09 09 09 64 6f 6e 65 28 | 31 29 3b 0a 09 09 7d 0a |...done(|1);...}.|
|00005ee0| 09 09 69 66 20 28 69 6f | 63 74 6c 28 30 2c 20 28 |..if (io|ctl(0, (|
|00005ef0| 69 6e 74 29 54 49 4f 43 | 4c 47 45 54 2c 20 28 63 |int)TIOC|LGET, (c|
|00005f00| 68 61 72 20 2a 29 26 6f | 6c 6d 6f 64 65 29 20 3c |har *)&o|lmode) <|
|00005f10| 20 30 29 20 7b 0a 09 09 | 09 70 65 72 72 6f 72 28 | 0) {...|.perror(|
|00005f20| 22 69 6f 63 74 6c 28 28 | 69 6e 74 29 54 49 4f 43 |"ioctl((|int)TIOC|
|00005f30| 4c 47 45 54 29 22 29 3b | 0a 09 09 09 64 6f 6e 65 |LGET)");|....done|
|00005f40| 28 31 29 3b 0a 09 09 7d | 0a 09 09 6e 73 74 74 79 |(1);...}|...nstty|
|00005f50| 20 3d 20 6f 73 74 74 79 | 3b 0a 09 09 6e 73 74 74 | = ostty|;...nstt|
|00005f60| 79 2e 73 67 5f 65 72 61 | 73 65 20 3d 20 6e 73 74 |y.sg_era|se = nst|
|00005f70| 74 79 2e 73 67 5f 6b 69 | 6c 6c 20 3d 20 2d 31 3b |ty.sg_ki|ll = -1;|
|00005f80| 0a 09 09 6e 73 74 74 79 | 2e 73 67 5f 66 6c 61 67 |...nstty|.sg_flag|
|00005f90| 73 20 7c 3d 20 43 42 52 | 45 41 4b 7c 54 41 4e 44 |s |= CBR|EAK|TAND|
|00005fa0| 45 4d 3b 0a 09 09 6e 73 | 74 74 79 2e 73 67 5f 66 |EM;...ns|tty.sg_f|
|00005fb0| 6c 61 67 73 20 26 3d 20 | 7e 28 52 41 57 7c 43 52 |lags &= |~(RAW|CR|
|00005fc0| 4d 4f 44 7c 45 43 48 4f | 7c 4c 43 41 53 45 7c 58 |MOD|ECHO||LCASE|X|
|00005fd0| 54 41 42 53 29 3b 0a 09 | 09 6e 74 63 68 61 72 73 |TABS);..|.ntchars|
|00005fe0| 2e 74 5f 69 6e 74 72 63 | 20 3d 20 6e 74 63 68 61 |.t_intrc| = ntcha|
|00005ff0| 72 73 2e 74 5f 71 75 69 | 74 63 20 3d 20 2d 31 3b |rs.t_qui|tc = -1;|
|00006000| 0a 09 09 6e 74 63 68 61 | 72 73 2e 74 5f 65 6f 66 |...ntcha|rs.t_eof|
|00006010| 63 20 3d 20 6e 74 63 68 | 61 72 73 2e 74 5f 62 72 |c = ntch|ars.t_br|
|00006020| 6b 63 20 3d 20 2d 31 3b | 0a 09 09 6e 74 63 68 61 |kc = -1;|...ntcha|
|00006030| 72 73 2e 74 5f 73 74 61 | 72 74 63 20 3d 20 58 4f |rs.t_sta|rtc = XO|
|00006040| 4e 3b 0a 09 09 6e 74 63 | 68 61 72 73 2e 74 5f 73 |N;...ntc|hars.t_s|
|00006050| 74 6f 70 63 20 3d 20 58 | 4f 46 46 3b 0a 09 09 6e |topc = X|OFF;...n|
|00006060| 6c 74 63 68 61 72 73 2e | 74 5f 73 75 73 70 63 20 |ltchars.|t_suspc |
|00006070| 3d 20 6e 6c 74 63 68 61 | 72 73 2e 74 5f 64 73 75 |= nltcha|rs.t_dsu|
|00006080| 73 70 63 20 3d 20 2d 31 | 3b 0a 09 09 6e 6c 74 63 |spc = -1|;...nltc|
|00006090| 68 61 72 73 2e 74 5f 72 | 70 72 6e 74 63 20 3d 20 |hars.t_r|prntc = |
|000060a0| 6e 6c 74 63 68 61 72 73 | 2e 74 5f 66 6c 75 73 68 |nltchars|.t_flush|
|000060b0| 63 20 3d 20 2d 31 3b 0a | 09 09 6e 6c 74 63 68 61 |c = -1;.|..nltcha|
|000060c0| 72 73 2e 74 5f 77 65 72 | 61 73 63 20 3d 20 6e 6c |rs.t_wer|asc = nl|
|000060d0| 74 63 68 61 72 73 2e 74 | 5f 6c 6e 65 78 74 63 20 |tchars.t|_lnextc |
|000060e0| 3d 20 2d 31 3b 0a 09 09 | 6e 6c 6d 6f 64 65 20 3d |= -1;...|nlmode =|
|000060f0| 20 6f 6c 6d 6f 64 65 20 | 7c 20 4c 44 45 43 43 54 | olmode || LDECCT|
|00006100| 51 3b 0a 09 09 69 66 20 | 28 69 6f 63 74 6c 28 30 |Q;...if |(ioctl(0|
|00006110| 2c 20 28 69 6e 74 29 54 | 49 4f 43 53 45 54 4e 2c |, (int)T|IOCSETN,|
|00006120| 20 28 63 68 61 72 20 2a | 29 26 6e 73 74 74 79 29 | (char *|)&nstty)|
|00006130| 20 3c 20 30 29 20 7b 0a | 09 09 09 70 65 72 72 6f | < 0) {.|...perro|
|00006140| 72 28 22 69 6f 63 74 6c | 28 28 69 6e 74 29 54 49 |r("ioctl|((int)TI|
|00006150| 4f 43 53 45 54 4e 29 22 | 29 3b 0a 09 09 09 64 6f |OCSETN)"|);....do|
|00006160| 6e 65 28 31 29 3b 0a 09 | 09 7d 0a 09 09 69 66 20 |ne(1);..|.}...if |
|00006170| 28 69 6f 63 74 6c 28 30 | 2c 20 28 69 6e 74 29 54 |(ioctl(0|, (int)T|
|00006180| 49 4f 43 53 45 54 43 2c | 20 28 63 68 61 72 20 2a |IOCSETC,| (char *|
|00006190| 29 26 6e 74 63 68 61 72 | 73 29 20 3c 20 30 29 20 |)&ntchar|s) < 0) |
|000061a0| 7b 0a 09 09 09 70 65 72 | 72 6f 72 28 22 69 6f 63 |{....per|ror("ioc|
|000061b0| 74 6c 28 28 69 6e 74 29 | 54 49 4f 43 53 45 54 43 |tl((int)|TIOCSETC|
|000061c0| 22 29 3b 0a 09 09 09 64 | 6f 6e 65 28 31 29 3b 0a |");....d|one(1);.|
|000061d0| 09 09 7d 0a 09 09 69 66 | 20 28 69 6f 63 74 6c 28 |..}...if| (ioctl(|
|000061e0| 30 2c 20 28 69 6e 74 29 | 54 49 4f 43 53 4c 54 43 |0, (int)|TIOCSLTC|
|000061f0| 2c 20 28 63 68 61 72 20 | 2a 29 26 6e 6c 74 63 68 |, (char |*)&nltch|
|00006200| 61 72 73 29 20 3c 20 30 | 29 20 7b 0a 09 09 09 70 |ars) < 0|) {....p|
|00006210| 65 72 72 6f 72 28 22 69 | 6f 63 74 6c 28 28 69 6e |error("i|octl((in|
|00006220| 74 29 54 49 4f 43 53 4c | 54 43 22 29 3b 0a 09 09 |t)TIOCSL|TC");...|
|00006230| 09 64 6f 6e 65 28 31 29 | 3b 0a 09 09 7d 0a 09 09 |.done(1)|;...}...|
|00006240| 69 66 20 28 69 6f 63 74 | 6c 28 30 2c 20 28 69 6e |if (ioct|l(0, (in|
|00006250| 74 29 54 49 4f 43 4c 53 | 45 54 2c 20 28 63 68 61 |t)TIOCLS|ET, (cha|
|00006260| 72 20 2a 29 26 6e 6c 6d | 6f 64 65 29 20 3c 20 30 |r *)&nlm|ode) < 0|
|00006270| 29 20 7b 0a 09 09 09 70 | 65 72 72 6f 72 28 22 69 |) {....p|error("i|
|00006280| 6f 63 74 6c 28 28 69 6e | 74 29 54 49 4f 43 4c 53 |octl((in|t)TIOCLS|
|00006290| 45 54 29 22 29 3b 0a 09 | 09 09 64 6f 6e 65 28 31 |ET)");..|..done(1|
|000062a0| 29 3b 0a 09 09 7d 0a 09 | 09 73 61 76 65 64 20 3d |);...}..|.saved =|
|000062b0| 20 31 3b 0a 09 7d 20 65 | 6c 73 65 20 69 66 20 28 | 1;..} e|lse if (|
|000062c0| 73 61 76 65 64 29 20 7b | 0a 09 09 28 76 6f 69 64 |saved) {|...(void|
|000062d0| 29 69 6f 63 74 6c 28 30 | 2c 20 28 69 6e 74 29 54 |)ioctl(0|, (int)T|
|000062e0| 49 4f 43 53 45 54 50 2c | 20 28 63 68 61 72 20 2a |IOCSETP,| (char *|
|000062f0| 29 26 6f 73 74 74 79 29 | 3b 0a 09 09 28 76 6f 69 |)&ostty)|;...(voi|
|00006300| 64 29 69 6f 63 74 6c 28 | 30 2c 20 28 69 6e 74 29 |d)ioctl(|0, (int)|
|00006310| 54 49 4f 43 53 45 54 43 | 2c 20 28 63 68 61 72 20 |TIOCSETC|, (char |
|00006320| 2a 29 26 6f 74 63 68 61 | 72 73 29 3b 0a 09 09 28 |*)&otcha|rs);...(|
|00006330| 76 6f 69 64 29 69 6f 63 | 74 6c 28 30 2c 20 28 69 |void)ioc|tl(0, (i|
|00006340| 6e 74 29 54 49 4f 43 53 | 4c 54 43 2c 20 28 63 68 |nt)TIOCS|LTC, (ch|
|00006350| 61 72 20 2a 29 26 6f 6c | 74 63 68 61 72 73 29 3b |ar *)&ol|tchars);|
|00006360| 0a 09 09 28 76 6f 69 64 | 29 69 6f 63 74 6c 28 30 |...(void|)ioctl(0|
|00006370| 2c 20 28 69 6e 74 29 54 | 49 4f 43 4c 53 45 54 2c |, (int)T|IOCLSET,|
|00006380| 20 28 63 68 61 72 20 2a | 29 26 6f 6c 6d 6f 64 65 | (char *|)&olmode|
|00006390| 29 3b 0a 09 7d 0a 7d 0a | 0a 64 6f 6e 65 28 73 29 |);..}.}.|.done(s)|
|000063a0| 0a 7b 0a 09 72 65 67 69 | 73 74 65 72 20 66 69 6c |.{..regi|ster fil|
|000063b0| 64 65 73 5f 74 20 66 64 | 3b 0a 0a 09 2f 2a 0a 09 |des_t fd|;.../*..|
|000063c0| 20 2a 20 43 6c 65 61 6e | 20 75 70 20 61 6e 64 20 | * Clean| up and |
|000063d0| 65 78 69 74 2e 20 20 49 | 74 20 69 73 20 6f 76 65 |exit. I|t is ove|
|000063e0| 72 6b 69 6c 6c 20 74 6f | 20 63 6c 6f 73 65 20 61 |rkill to| close a|
|000063f0| 6c 6c 20 6f 66 20 74 68 | 65 20 66 69 6c 65 0a 09 |ll of th|e file..|
+--------+-------------------------+-------------------------+--------+--------+
Only 25.0 KB of data is shown above.