home *** CD-ROM | disk | FTP | other *** search
MacBinary | 1993-01-10 | 37.1 KB | [ TEXT/EDIT]
open in: MacOS 8.1
extracted
|
Win98
extracted
|
DOS
extracted
browse contents |
view JSON data
|
view as text
This file was processed as: MacBinary
(archive/macBinary ).
Confidence Program Detection Match Type Support
10%
dexvert
MacBinary (archive/macBinary)
fallback
Supported
1%
dexvert
Text File (text/txt)
fallback
Supported
100%
file
MacBinary II, Sat Jan 9 21:33:48 1993, modified Sat Jan 9 21:33:48 1993, creator Macintosh Edit, type ASCII, 37126 bytes "GUSI.web" , at 0x9186 624 bytes resource
default (weak)
99%
file
data
default
74%
TrID
Macintosh plain text (MacBinary)
default
25%
TrID
MacBinary 2
default (weak)
100%
siegfried
fmt/1762 MacBinary (II)
default
100%
lsar
MacBinary
default
id metadata key value macFileType [ TEXT] macFileCreator [ EDIT]
hex view +--------+-------------------------+-------------------------+--------+--------+ |00000000| 00 08 47 55 53 49 2e 77 | 65 62 00 00 00 00 00 00 |..GUSI.w|eb......| |00000010| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........| |00000020| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........| |00000030| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........| |00000040| 00 54 45 58 54 45 44 49 | 54 00 00 00 00 00 00 00 |.TEXTEDI|T.......| |00000050| 00 00 00 00 00 91 06 00 | 00 02 70 a7 75 3b 8c a7 |........|..p.u;..| |00000060| 75 3b 8c 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |u;......|........| |00000070| 00 00 00 00 00 00 00 00 | 00 00 81 81 a1 cc 00 00 |........|........| |00000080| 25 25 25 25 25 25 25 25 | 25 25 25 25 25 25 25 25 |%%%%%%%%|%%%%%%%%| |00000090| 25 25 25 25 25 25 25 25 | 25 25 25 25 25 25 25 25 |%%%%%%%%|%%%%%%%%| |000000a0| 25 25 25 25 25 25 25 25 | 25 25 25 25 25 25 25 25 |%%%%%%%%|%%%%%%%%| |000000b0| 25 25 25 25 25 25 25 25 | 25 25 25 25 25 25 25 25 |%%%%%%%%|%%%%%%%%| |000000c0| 25 25 25 25 25 25 25 0d | 25 09 50 72 6f 6a 65 63 |%%%%%%%.|%.Projec| |000000d0| 74 09 3a 09 47 55 53 49 | 09 09 09 2d 09 47 72 61 |t.:.GUSI|...-.Gra| |000000e0| 6e 64 20 55 6e 69 66 69 | 65 64 20 53 6f 63 6b 65 |nd Unifi|ed Socke| |000000f0| 74 20 49 6e 74 65 72 66 | 61 63 65 0d 25 09 46 69 |t Interf|ace.%.Fi| |00000100| 6c 65 09 09 3a 09 47 55 | 53 49 2e 77 65 62 09 09 |le..:.GU|SI.web..| |00000110| 2d 09 44 6f 63 75 6d 65 | 6e 74 61 74 69 6f 6e 0d |-.Docume|ntation.| |00000120| 25 09 41 75 74 68 6f 72 | 09 3a 09 4d 61 74 74 68 |%.Author|.:.Matth| |00000130| 69 61 73 20 4e 65 65 72 | 61 63 68 65 72 0d 25 09 |ias Neer|acher.%.| |00000140| 53 74 61 72 74 65 64 09 | 3a 09 30 38 53 65 70 39 |Started.|:.08Sep9| |00000150| 32 09 09 09 09 09 09 09 | 09 4c 61 6e 67 75 61 67 |2.......|.Languag| |00000160| 65 09 3a 09 43 20 53 70 | 69 64 65 72 57 65 62 0d |e.:.C Sp|iderWeb.| |00000170| 25 09 4d 6f 64 69 66 69 | 65 64 09 3a 09 30 38 53 |%.Modifi|ed.:.08S| |00000180| 65 70 39 32 09 4d 4e 09 | 49 74 27 73 20 62 65 67 |ep92.MN.|It's beg| |00000190| 69 6e 6e 69 6e 67 20 74 | 6f 20 74 61 6b 65 20 73 |inning t|o take s| |000001a0| 68 61 70 65 0d 25 09 09 | 09 09 09 30 35 4f 63 74 |hape.%..|...05Oct| |000001b0| 39 32 09 4d 4e 09 4d 6f | 72 65 20 6f 72 20 6c 65 |92.MN.Mo|re or le| |000001c0| 73 73 20 63 6f 6d 70 6c | 65 74 65 20 6e 6f 77 0d |ss compl|ete now.| |000001d0| 25 09 09 09 09 09 31 33 | 44 65 63 39 32 09 4d 4e |%.....13|Dec92.MN| |000001e0| 09 42 72 75 73 68 20 69 | 74 20 75 70 20 66 6f 72 |.Brush i|t up for| |000001f0| 20 72 65 6c 65 61 73 65 | 0d 25 09 09 09 09 09 30 | release|.%.....0| |00000200| 39 4a 61 6e 39 33 09 4d | 4e 09 55 70 64 61 74 65 |9Jan93.M|N.Update| |00000210| 20 66 6f 72 20 31 2e 30 | 2e 31 0d 25 09 4c 61 73 | for 1.0|.1.%.Las| |00000220| 74 09 09 3a 09 30 39 4a | 61 6e 39 33 0d 25 25 25 |t..:.09J|an93.%%%| |00000230| 25 25 25 25 25 25 25 25 | 25 25 25 25 25 25 25 25 |%%%%%%%%|%%%%%%%%| |00000240| 25 25 25 25 25 25 25 25 | 25 25 25 25 25 25 25 25 |%%%%%%%%|%%%%%%%%| |00000250| 25 25 25 25 25 25 25 25 | 25 25 25 25 25 25 25 25 |%%%%%%%%|%%%%%%%%| |00000260| 25 25 25 25 25 25 25 25 | 25 25 25 25 25 25 25 25 |%%%%%%%%|%%%%%%%%| |00000270| 25 25 25 25 0d 0d 25 20 | 43 6f 70 79 72 69 67 68 |%%%%..% |Copyrigh| |00000280| 74 20 31 39 39 32 2c 20 | 31 39 39 33 20 4d 61 74 |t 1992, |1993 Mat| |00000290| 74 68 69 61 73 20 4e 65 | 65 72 61 63 68 65 72 20 |thias Ne|eracher | |000002a0| 3c 6e 65 65 72 69 40 40 | 69 69 73 2e 65 74 68 7a |<neeri@@|iis.ethz| |000002b0| 2e 63 68 3e 0d 0d 25 20 | 54 68 69 73 20 66 69 6c |.ch>..% |This fil| |000002c0| 65 20 69 73 20 70 61 72 | 74 20 6f 66 20 47 55 53 |e is par|t of GUS| |000002d0| 49 0d 0d 25 20 48 65 72 | 65 20 69 73 20 54 65 58 |I..% Her|e is TeX| |000002e0| 20 6d 61 74 65 72 69 61 | 6c 20 74 68 61 74 20 67 | materia|l that g| |000002f0| 65 74 73 20 69 6e 73 65 | 72 74 65 64 20 61 66 74 |ets inse|rted aft| |00000300| 65 72 20 5c 69 6e 70 75 | 74 20 77 65 62 6d 61 63 |er \inpu|t webmac| |00000310| 0d 0d 25 20 5c 6d 65 73 | 73 61 67 65 7b 4f 4b 2c |..% \mes|sage{OK,| |00000320| 20 65 6e 74 65 72 69 6e | 67 20 5c 73 74 72 69 6e | enterin|g \strin| |00000330| 67 5c 62 61 74 63 68 6d | 6f 64 65 2e 2e 2e 7d 0d |g\batchm|ode...}.| |00000340| 25 20 5c 62 61 74 63 68 | 6d 6f 64 65 0d 0d 5c 64 |% \batch|mode..\d| |00000350| 65 66 5c 68 61 6e 67 7b | 5c 68 61 6e 67 69 6e 64 |ef\hang{|\hangind| |00000360| 65 6e 74 20 33 65 6d 5c | 69 6e 64 65 6e 74 5c 69 |ent 3em\|indent\i| |00000370| 67 6e 6f 72 65 73 70 61 | 63 65 73 7d 0d 0d 5c 64 |gnorespa|ces}..\d| |00000380| 65 66 5c 74 69 74 6c 65 | 7b 47 55 53 49 20 52 65 |ef\title|{GUSI Re| |00000390| 66 65 72 65 6e 63 65 7d | 0d 5c 64 65 66 5c 63 6f |ference}|.\def\co| |000003a0| 6e 74 65 6e 74 73 70 61 | 67 65 6e 75 6d 62 65 72 |ntentspa|genumber| |000003b0| 7b 31 7d 20 25 20 73 68 | 6f 75 6c 64 20 62 65 20 |{1} % sh|ould be | |000003c0| 6f 64 64 0d 5c 64 65 66 | 5c 74 6f 70 6f 66 63 6f |odd.\def|\topofco| |000003d0| 6e 74 65 6e 74 73 7b 5c | 6e 75 6c 6c 5c 76 66 69 |ntents{\|null\vfi| |000003e0| 6c 6c 0d 20 20 5c 74 69 | 74 6c 65 66 61 6c 73 65 |ll. \ti|tlefalse| |000003f0| 20 25 20 69 6e 63 6c 75 | 64 65 20 68 65 61 64 6c | % inclu|de headl| |00000400| 69 6e 65 20 6f 6e 20 74 | 68 65 20 63 6f 6e 74 65 |ine on t|he conte| |00000410| 6e 74 73 20 70 61 67 65 | 0d 20 20 5c 64 65 66 5c |nts page|. \def\| |00000420| 72 68 65 61 64 65 72 7b | 5c 68 66 69 6c 7d 0d 20 |rheader{|\hfil}. | |00000430| 20 5c 63 65 6e 74 65 72 | 6c 69 6e 65 7b 5c 74 74 | \center|line{\tt| |00000440| 69 74 6c 65 66 6f 6e 74 | 20 47 55 53 49 20 5c 74 |itlefont| GUSI \t| |00000450| 69 74 6c 65 66 6f 6e 74 | 20 2d 2d 2d 20 47 72 61 |itlefont| --- Gra| |00000460| 6e 64 20 55 6e 69 66 69 | 65 64 20 53 6f 63 6b 65 |nd Unifi|ed Socke| |00000470| 74 20 49 6e 74 65 72 66 | 61 63 65 7d 0d 20 20 5c |t Interf|ace}. \| |00000480| 76 66 69 6c 6c 0d 7d 0d | 0d 5c 64 65 66 5c 6f 6e |vfill.}.|.\def\on| |00000490| 65 63 6f 6c 6c 69 73 74 | 23 31 7b 5c 68 61 6c 69 |ecollist|#1{\hali| |000004a0| 67 6e 7b 5c 71 75 61 64 | 24 5c 74 72 69 61 6e 67 |gn{\quad|$\triang| |000004b0| 6c 65 72 69 67 68 74 24 | 5c 20 5c 76 74 6f 70 7b |leright$|\ \vtop{| |000004c0| 0d 09 5c 68 73 69 7a 65 | 3d 31 35 63 6d 5c 73 74 |..\hsize|=15cm\st| |000004d0| 72 75 74 23 23 5c 73 74 | 72 75 74 7d 5c 68 66 69 |rut##\st|rut}\hfi| |000004e0| 6c 5c 63 72 23 31 7d 7d | 0d 5c 64 65 66 5c 74 77 |l\cr#1}}|.\def\tw| |000004f0| 6f 63 6f 6c 6c 69 73 74 | 23 31 7b 5c 68 61 6c 69 |ocollist|#1{\hali| |00000500| 67 6e 7b 5c 71 75 61 64 | 24 5c 74 72 69 61 6e 67 |gn{\quad|$\triang| |00000510| 6c 65 72 69 67 68 74 24 | 5c 62 66 5c 20 23 23 5c |leright$|\bf\ ##\| |00000520| 68 66 69 6c 26 5c 71 75 | 61 64 0d 09 5c 76 74 6f |hfil&\qu|ad..\vto| |00000530| 70 7b 5c 68 73 69 7a 65 | 3d 31 33 63 6d 5c 73 74 |p{\hsize|=13cm\st| |00000540| 72 75 74 23 23 5c 73 74 | 72 75 74 7d 5c 68 66 69 |rut##\st|rut}\hfi| |00000550| 6c 5c 63 72 23 31 7d 7d | 0d 5c 64 65 66 5c 70 6c |l\cr#1}}|.\def\pl| |00000560| 61 69 6e 6f 6e 65 63 6f | 6c 23 31 7b 5c 68 61 6c |ainoneco|l#1{\hal| |00000570| 69 67 6e 7b 5c 71 75 61 | 64 0d 09 5c 76 74 6f 70 |ign{\qua|d..\vtop| |00000580| 7b 5c 68 73 69 7a 65 3d | 31 35 63 6d 5c 73 74 72 |{\hsize=|15cm\str| |00000590| 75 74 23 23 5c 73 74 72 | 75 74 7d 5c 68 66 69 6c |ut##\str|ut}\hfil| |000005a0| 5c 63 72 23 31 7d 7d 0d | 5c 64 65 66 5c 70 6c 61 |\cr#1}}.|\def\pla| |000005b0| 69 6e 74 77 6f 63 6f 6c | 23 31 7b 5c 68 61 6c 69 |intwocol|#1{\hali| |000005c0| 67 6e 7b 5c 71 75 61 64 | 23 23 5c 68 66 69 6c 26 |gn{\quad|##\hfil&| |000005d0| 5c 71 75 61 64 0d 09 5c | 76 74 6f 70 7b 5c 68 73 |\quad..\|vtop{\hs| |000005e0| 69 7a 65 3d 31 33 63 6d | 5c 73 74 72 75 74 23 23 |ize=13cm|\strut##| |000005f0| 5c 73 74 72 75 74 7d 5c | 68 66 69 6c 5c 63 72 23 |\strut}\|hfil\cr#| |00000600| 31 7d 7d 0d 5c 64 65 66 | 5c 62 69 62 6c 69 6f 6c |1}}.\def|\bibliol| |00000610| 69 73 74 23 31 7b 5c 68 | 61 6c 69 67 6e 7b 5c 71 |ist#1{\h|align{\q| |00000620| 75 61 64 5c 62 66 24 5b | 24 23 23 24 5d 24 5c 68 |uad\bf$[|$##$]$\h| |00000630| 66 69 6c 26 5c 71 75 61 | 64 0d 09 5c 76 74 6f 70 |fil&\qua|d..\vtop| |00000640| 7b 5c 68 73 69 7a 65 3d | 31 33 63 6d 5c 73 74 72 |{\hsize=|13cm\str| |00000650| 75 74 23 23 5c 73 74 72 | 75 74 7d 5c 68 66 69 6c |ut##\str|ut}\hfil| |00000660| 5c 63 72 23 31 7d 7d 0d | 5c 70 61 72 69 6e 64 65 |\cr#1}}.|\parinde| |00000670| 6e 74 3d 30 70 74 0d 0d | 40 2a 3d 20 49 6e 74 72 |nt=0pt..|@*= Intr| |00000680| 6f 64 75 63 74 69 6f 6e | 2e 20 20 5c 2e 7b 47 55 |oduction|. \.{GU| |00000690| 53 49 7d 20 69 73 20 61 | 6e 20 65 78 74 65 6e 73 |SI} is a|n extens| |000006a0| 69 6f 6e 20 61 6e 64 20 | 70 61 72 74 69 61 6c 20 |ion and |partial | |000006b0| 72 65 70 6c 61 63 65 6d | 65 6e 74 20 6f 66 20 74 |replacem|ent of t| |000006c0| 68 65 0d 5c 2e 7b 4d 50 | 57 7d 20 72 75 6e 74 69 |he.\.{MP|W} runti| |000006d0| 6d 65 20 6c 69 62 72 61 | 72 79 2e 20 49 74 73 20 |me libra|ry. Its | |000006e0| 6d 61 69 6e 20 6f 62 6a | 65 63 74 69 76 65 20 69 |main obj|ective i| |000006f0| 73 20 74 6f 20 70 72 6f | 76 69 64 65 20 61 20 6d |s to pro|vide a m| |00000700| 6f 72 65 20 6f 72 20 6c | 65 73 73 20 73 69 6d 70 |ore or l|ess simp| |00000710| 6c 65 0d 61 6e 64 20 63 | 6f 6e 73 69 73 74 65 6e |le.and c|onsisten| |00000720| 74 20 69 6e 74 65 72 66 | 61 63 65 20 61 63 72 6f |t interf|ace acro| |00000730| 73 73 20 74 68 65 20 66 | 6f 6c 6c 6f 77 69 6e 67 |ss the f|ollowing| |00000740| 20 7b 5c 69 74 20 63 6f | 6d 6d 75 6e 69 63 61 74 | {\it co|mmunicat| |00000750| 69 6f 6e 20 64 6f 6d 61 | 69 6e 73 7d 3a 0d 0d 5c |ion doma|ins}:..\| |00000760| 6d 65 64 73 6b 69 70 5c | 74 77 6f 63 6f 6c 6c 69 |medskip\|twocolli| |00000770| 73 74 7b 0d 46 69 6c 65 | 73 26 4f 72 64 69 6e 61 |st{.File|s&Ordina| |00000780| 72 79 20 4d 61 63 69 6e | 74 6f 73 68 20 66 69 6c |ry Macin|tosh fil| |00000790| 65 73 20 61 6e 64 20 5c | 2e 7b 4d 50 57 7d 20 70 |es and \|.{MPW} p| |000007a0| 73 65 75 64 6f 20 64 65 | 76 69 63 65 73 2e 5c 63 |seudo de|vices.\c| |000007b0| 72 0d 55 6e 69 78 26 4d | 65 6d 6f 72 79 20 62 61 |r.Unix&M|emory ba| |000007c0| 73 65 64 20 63 6f 6d 6d | 75 6e 69 63 61 74 69 6f |sed comm|unicatio| |000007d0| 6e 20 77 69 74 68 69 6e | 20 61 20 73 69 6e 67 6c |n within| a singl| |000007e0| 65 20 6d 61 63 68 69 6e | 65 20 28 54 68 69 73 20 |e machin|e (This | |000007f0| 6e 61 6d 65 20 65 78 69 | 73 74 73 20 66 6f 72 0d |name exi|sts for.| |00000800| 68 69 73 74 6f 72 69 63 | 61 6c 20 72 65 61 73 6f |historic|al reaso| |00000810| 6e 73 29 2e 5c 63 72 0d | 41 70 70 6c 65 74 61 6c |ns).\cr.|Appletal| |00000820| 6b 26 5c 2e 7b 41 44 53 | 50 7d 20 28 61 6e 64 20 |k&\.{ADS|P} (and | |00000830| 70 6f 73 73 69 62 6c 79 | 20 69 6e 20 74 68 65 20 |possibly| in the | |00000840| 66 75 74 75 72 65 20 5c | 2e 7b 44 44 50 7d 29 20 |future \|.{DDP}) | |00000850| 63 6f 6d 6d 75 6e 69 63 | 61 74 69 6f 6e 20 6f 76 |communic|ation ov| |00000860| 65 72 20 61 0d 6e 65 74 | 77 6f 72 6b 2e 5c 63 72 |er a.net|work.\cr| |00000870| 0d 50 50 43 26 4c 6f 63 | 61 6c 20 61 6e 64 20 72 |.PPC&Loc|al and r| |00000880| 65 6d 6f 74 65 20 63 6f | 6e 6e 65 63 74 69 6f 6e |emote co|nnection| |00000890| 73 20 77 69 74 68 20 74 | 68 65 20 53 79 73 74 65 |s with t|he Syste| |000008a0| 6d 20 37 20 5c 2e 7b 50 | 50 43 20 54 6f 6f 6c 62 |m 7 \.{P|PC Toolb| |000008b0| 6f 78 7d 5c 63 72 0d 49 | 6e 74 65 72 6e 65 74 26 |ox}\cr.I|nternet&| |000008c0| 5c 2e 7b 54 43 50 7d 20 | 61 6e 64 20 5c 2e 7b 55 |\.{TCP} |and \.{U| |000008d0| 44 50 7d 20 63 6f 6e 6e | 65 63 74 69 6f 6e 73 20 |DP} conn|ections | |000008e0| 6f 76 65 72 20 5c 2e 7b | 4d 61 63 54 43 50 7d 2e |over \.{|MacTCP}.| |000008f0| 5c 63 72 0d 7d 0d 0d 5c | 6d 65 64 73 6b 69 70 0d |\cr.}..\|medskip.| |00000900| 41 64 64 69 74 69 6f 6e | 61 6c 6c 79 2c 20 5c 2e |Addition|ally, \.| |00000910| 7b 47 55 53 49 7d 20 61 | 64 64 73 20 73 6f 6d 65 |{GUSI} a|dds some| |00000920| 20 5c 2e 7b 55 4e 49 58 | 7d 20 6c 69 62 72 61 72 | \.{UNIX|} librar| |00000930| 79 20 63 61 6c 6c 73 20 | 64 65 61 6c 69 6e 67 20 |y calls |dealing | |00000940| 77 69 74 68 20 66 69 6c | 65 73 20 77 68 69 63 68 |with fil|es which| |00000950| 0d 77 65 72 65 20 6d 69 | 73 73 69 6e 67 2c 20 6c |.were mi|ssing, l| |00000960| 69 6b 65 20 7c 63 68 64 | 69 72 28 29 7c 2c 20 7c |ike |chd|ir()|, || |00000970| 67 65 74 63 77 64 28 29 | 7c 2c 20 7c 73 79 6d 6c |getcwd()||, |syml| |00000980| 69 6e 6b 28 29 7c 2c 20 | 61 6e 64 20 7c 72 65 61 |ink()|, |and |rea| |00000990| 64 6c 69 6e 6b 28 29 7c | 2c 20 61 6e 64 20 0d 63 |dlink()||, and .c| |000009a0| 68 61 6e 67 65 73 20 61 | 20 66 65 77 20 6f 74 68 |hanges a| few oth| |000009b0| 65 72 20 6c 69 62 72 61 | 72 79 20 63 61 6c 6c 73 |er libra|ry calls| |000009c0| 20 74 6f 20 62 65 68 61 | 76 65 20 6d 6f 72 65 20 | to beha|ve more | |000009d0| 6c 69 6b 65 20 74 68 65 | 69 72 20 5c 2e 7b 55 4e |like the|ir \.{UN| |000009e0| 49 58 7d 20 63 6f 75 6e | 74 65 72 70 61 72 74 73 |IX} coun|terparts| |000009f0| 2e 0d 0d 40 2a 32 20 43 | 6f 70 79 69 6e 67 2e 0d |...@*2 C|opying..| |00000a00| 0d 5c 6d 65 64 73 6b 69 | 70 20 43 6f 70 79 72 69 |.\medski|p Copyri| |00000a10| 67 68 74 20 5c 63 6f 70 | 79 72 69 67 68 74 5c 20 |ght \cop|yright\ | |00000a20| 31 39 39 32 2c 20 31 39 | 39 33 20 4d 61 74 74 68 |1992, 19|93 Matth| |00000a30| 69 61 73 20 4e 65 65 72 | 61 63 68 65 72 0d 0d 5c |ias Neer|acher..\| |00000a40| 6d 65 64 73 6b 69 70 20 | 50 65 72 6d 69 73 73 69 |medskip |Permissi| |00000a50| 6f 6e 20 69 73 20 67 72 | 61 6e 74 65 64 20 74 6f |on is gr|anted to| |00000a60| 20 61 6e 79 6f 6e 65 20 | 74 6f 20 75 73 65 20 74 | anyone |to use t| |00000a70| 68 69 73 20 73 6f 66 74 | 77 61 72 65 20 66 6f 72 |his soft|ware for| |00000a80| 20 61 6e 79 0d 70 75 72 | 70 6f 73 65 20 6f 6e 20 | any.pur|pose on | |00000a90| 61 6e 79 20 63 6f 6d 70 | 75 74 65 72 20 73 79 73 |any comp|uter sys| |00000aa0| 74 65 6d 2c 20 61 6e 64 | 20 74 6f 20 72 65 64 69 |tem, and| to redi| |00000ab0| 73 74 72 69 62 75 74 65 | 20 69 74 20 66 72 65 65 |stribute| it free| |00000ac0| 6c 79 2c 0d 73 75 62 6a | 65 63 74 20 74 6f 20 74 |ly,.subj|ect to t| |00000ad0| 68 65 20 66 6f 6c 6c 6f | 77 69 6e 67 20 72 65 73 |he follo|wing res| |00000ae0| 74 72 69 63 74 69 6f 6e | 73 3a 0d 0d 5c 6d 65 64 |triction|s:..\med| |00000af0| 73 6b 69 70 5c 6f 6e 65 | 63 6f 6c 6c 69 73 74 7b |skip\one|collist{| |00000b00| 0d 54 68 65 20 61 75 74 | 68 6f 72 20 69 73 20 6e |.The aut|hor is n| |00000b10| 6f 74 20 72 65 73 70 6f | 6e 73 69 62 6c 65 20 66 |ot respo|nsible f| |00000b20| 6f 72 20 74 68 65 20 63 | 6f 6e 73 65 71 75 65 6e |or the c|onsequen| |00000b30| 63 65 73 20 6f 66 20 75 | 73 65 20 6f 66 0d 74 68 |ces of u|se of.th| |00000b40| 69 73 20 73 6f 66 74 77 | 61 72 65 2c 20 6e 6f 20 |is softw|are, no | |00000b50| 6d 61 74 74 65 72 20 68 | 6f 77 20 61 77 66 75 6c |matter h|ow awful| |00000b60| 2c 20 65 76 65 6e 20 69 | 66 20 74 68 65 79 20 61 |, even i|f they a| |00000b70| 72 69 73 65 0d 66 72 6f | 6d 20 64 65 66 65 63 74 |rise.fro|m defect| |00000b80| 73 20 69 6e 20 69 74 2e | 5c 63 72 0d 54 68 65 20 |s in it.|\cr.The | |00000b90| 6f 72 69 67 69 6e 20 6f | 66 20 74 68 69 73 20 73 |origin o|f this s| |00000ba0| 6f 66 74 77 61 72 65 20 | 6d 75 73 74 20 6e 6f 74 |oftware |must not| |00000bb0| 20 62 65 20 6d 69 73 72 | 65 70 72 65 73 65 6e 74 | be misr|epresent| |00000bc0| 65 64 2c 20 65 69 74 68 | 65 72 0d 62 79 20 65 78 |ed, eith|er.by ex| |00000bd0| 70 6c 69 63 69 74 20 63 | 6c 61 69 6d 20 6f 72 20 |plicit c|laim or | |00000be0| 62 79 20 6f 6d 69 73 73 | 69 6f 6e 2e 5c 63 72 0d |by omiss|ion.\cr.| |00000bf0| 41 6c 74 65 72 65 64 20 | 76 65 72 73 69 6f 6e 73 |Altered |versions| |00000c00| 20 6d 75 73 74 20 62 65 | 20 70 6c 61 69 6e 6c 79 | must be| plainly| |00000c10| 20 6d 61 72 6b 65 64 20 | 61 73 20 73 75 63 68 2c | marked |as such,| |00000c20| 20 61 6e 64 20 6d 75 73 | 74 20 6e 6f 74 0d 62 65 | and mus|t not.be| |00000c30| 20 6d 69 73 72 65 70 72 | 65 73 65 6e 74 65 64 20 | misrepr|esented | |00000c40| 61 73 20 62 65 69 6e 67 | 20 74 68 65 20 6f 72 69 |as being| the ori| |00000c50| 67 69 6e 61 6c 20 73 6f | 66 74 77 61 72 65 2e 5c |ginal so|ftware.\| |00000c60| 63 72 0d 7d 0d 0d 40 2a | 32 20 44 65 73 69 67 6e |cr.}..@*|2 Design| |00000c70| 20 4f 62 6a 65 63 74 69 | 76 65 73 2e 20 5c 2e 7b | Objecti|ves. \.{| |00000c80| 47 55 53 49 7d 20 77 61 | 73 20 64 65 76 65 6c 6f |GUSI} wa|s develo| |00000c90| 70 65 64 20 61 63 63 6f | 72 64 69 6e 67 20 74 6f |ped acco|rding to| |00000ca0| 20 61 74 20 6c 65 61 73 | 74 20 74 68 72 65 65 0d | at leas|t three.| |00000cb0| 6d 75 74 75 61 6c 6c 79 | 20 63 6f 6e 66 6c 69 63 |mutually| conflic| |00000cc0| 74 69 6e 67 20 73 74 61 | 6e 64 61 72 64 73 3a 0d |ting sta|ndards:.| |00000cd0| 0d 5c 6d 65 64 73 6b 69 | 70 5c 6f 6e 65 63 6f 6c |.\medski|p\onecol| |00000ce0| 6c 69 73 74 7b 0d 54 68 | 65 20 64 65 66 69 6e 69 |list{.Th|e defini| |00000cf0| 74 69 6f 6e 20 6f 66 20 | 74 68 65 20 65 78 69 73 |tion of |the exis| |00000d00| 74 69 6e 67 20 43 20 6c | 69 62 72 61 72 79 2e 5c |ting C l|ibrary.\| |00000d10| 63 72 0d 54 68 65 20 62 | 65 68 61 76 69 6f 72 20 |cr.The b|ehavior | |00000d20| 6f 66 20 74 68 65 20 63 | 6f 72 72 65 73 70 6f 6e |of the c|orrespon| |00000d30| 64 69 6e 67 20 55 4e 49 | 58 20 63 61 6c 6c 73 2e |ding UNI|X calls.| |00000d40| 5c 63 72 0d 54 68 65 20 | 61 75 74 68 6f 72 27 73 |\cr.The |author's| |00000d50| 20 6a 75 64 67 65 6d 65 | 6e 74 2c 20 70 72 65 6a | judgeme|nt, prej| |00000d60| 75 64 69 63 65 73 2c 20 | 6c 61 7a 69 6e 65 73 73 |udices, |laziness| |00000d70| 2c 20 61 6e 64 20 6c 69 | 6d 69 74 65 64 20 72 65 |, and li|mited re| |00000d80| 73 6f 75 72 63 65 73 2e | 5c 63 72 0d 7d 0d 0d 5c |sources.|\cr.}..\| |00000d90| 6d 65 64 73 6b 69 70 0d | 49 6e 20 67 65 6e 65 72 |medskip.|In gener| |00000da0| 61 6c 2c 20 74 68 65 20 | 62 65 68 61 76 69 6f 72 |al, the |behavior| |00000db0| 20 6f 66 20 74 68 65 20 | 63 6f 72 72 65 73 70 6f | of the |correspo| |00000dc0| 6e 64 69 6e 67 20 55 4e | 49 58 20 6c 69 62 72 61 |nding UN|IX libra| |00000dd0| 72 79 20 63 61 6c 6c 20 | 77 61 73 20 69 6d 70 6c |ry call |was impl| |00000de0| 65 6d 65 6e 74 65 64 2c | 0d 73 69 6e 63 65 20 74 |emented,|.since t| |00000df0| 68 69 73 20 66 61 63 69 | 6c 69 61 74 65 73 20 70 |his faci|liates p| |00000e00| 6f 72 74 69 6e 67 20 55 | 4e 49 58 20 75 74 69 6c |orting U|NIX util| |00000e10| 69 74 69 65 73 20 74 6f | 20 74 68 65 20 4d 61 63 |ities to| the Mac| |00000e20| 69 6e 74 6f 73 68 2e 0d | 0d 40 2a 32 20 41 63 6b |intosh..|.@*2 Ack| |00000e30| 6e 6f 77 6c 65 64 67 65 | 6d 65 6e 74 73 2e 20 49 |nowledge|ments. I| |00000e40| 20 77 6f 75 6c 64 20 6c | 69 6b 65 20 74 6f 20 74 | would l|ike to t| |00000e50| 68 61 6e 6b 20 61 6c 6c | 20 77 68 6f 20 68 61 76 |hank all| who hav| |00000e60| 65 20 61 67 72 65 65 64 | 20 74 6f 20 62 65 74 61 |e agreed| to beta| |00000e70| 20 74 65 73 74 20 74 68 | 69 73 0d 63 6f 64 65 20 | test th|is.code | |00000e80| 61 6e 64 20 77 68 6f 20 | 68 61 76 65 20 70 72 6f |and who |have pro| |00000e90| 76 69 64 65 64 20 66 65 | 65 64 62 61 63 6b 2e 0d |vided fe|edback..| |00000ea0| 0d 5c 6d 65 64 73 6b 69 | 70 20 54 68 65 20 54 43 |.\medski|p The TC| |00000eb0| 50 2f 49 50 20 63 6f 64 | 65 20 69 6e 20 5c 2e 7b |P/IP cod|e in \.{| |00000ec0| 47 55 53 49 49 4e 45 54 | 2e 63 70 7d 2c 20 5c 2e |GUSIINET|.cp}, \.| |00000ed0| 7b 47 55 53 49 54 43 50 | 2e 63 70 7d 2c 20 61 6e |{GUSITCP|.cp}, an| |00000ee0| 64 20 5c 2e 7b 47 55 53 | 49 55 44 50 2e 63 70 7d |d \.{GUS|IUDP.cp}| |00000ef0| 20 69 73 20 0d 64 65 72 | 69 76 65 64 20 66 72 6f | is .der|ived fro| |00000f00| 6d 20 61 20 73 6f 63 6b | 65 74 20 6c 69 62 72 61 |m a sock|et libra| |00000f10| 72 79 20 77 72 69 74 74 | 65 6e 20 62 79 20 43 68 |ry writt|en by Ch| |00000f20| 61 72 6c 69 65 20 52 65 | 69 6d 61 6e 20 24 3c 24 |arlie Re|iman $<$| |00000f30| 63 72 65 69 6d 61 6e 5c | 41 54 21 6e 63 73 61 2e |creiman\|AT!ncsa.| |00000f40| 75 69 75 63 2e 65 64 75 | 24 3e 24 2c 20 0d 77 68 |uiuc.edu|$>$, .wh| |00000f50| 69 63 68 20 69 6e 20 74 | 75 72 6e 20 69 73 20 62 |ich in t|urn is b| |00000f60| 61 73 65 64 20 6f 6e 20 | 63 6f 64 65 20 77 72 69 |ased on |code wri| |00000f70| 74 74 65 6e 20 62 79 20 | 54 6f 6d 20 4d 69 6c 6c |tten by |Tom Mill| |00000f80| 69 67 61 6e 20 24 3c 24 | 6d 69 6c 6c 69 67 61 6e |igan $<$|milligan| |00000f90| 5c 41 54 21 6d 61 64 68 | 61 75 73 2e 75 74 63 73 |\AT!madh|aus.utcs| |00000fa0| 2e 75 74 6f 72 6f 6e 74 | 6f 2e 63 61 24 3e 24 2e |.utoront|o.ca$>$.| |00000fb0| 0d 0d 5c 6d 65 64 73 6b | 69 70 20 54 68 65 20 68 |..\medsk|ip The h| |00000fc0| 65 61 64 65 72 20 66 69 | 6c 65 73 20 69 6e 20 74 |eader fi|les in t| |00000fd0| 68 65 20 5c 2e 7b 3a 48 | 65 61 64 65 72 73 3a 7d |he \.{:H|eaders:}| |00000fe0| 20 73 75 62 64 69 72 65 | 63 74 6f 72 79 20 61 72 | subdire|ctory ar| |00000ff0| 65 20 62 6f 72 72 6f 77 | 65 64 20 66 72 6f 6d 20 |e borrow|ed from | |00001000| 42 53 44 20 55 6e 69 78 | 2c 0d 74 68 65 72 65 66 |BSD Unix|,.theref| |00001010| 6f 72 65 3a 20 54 68 69 | 73 20 70 72 6f 64 75 63 |ore: Thi|s produc| |00001020| 74 20 69 6e 63 6c 75 64 | 65 73 20 73 6f 66 74 77 |t includ|es softw| |00001030| 61 72 65 20 64 65 76 65 | 6c 6f 70 65 64 20 62 79 |are deve|loped by| |00001040| 20 74 68 65 20 55 6e 69 | 76 65 72 73 69 74 79 20 | the Uni|versity | |00001050| 6f 66 20 43 61 6c 69 66 | 6f 72 6e 69 61 2c 20 0d |of Calif|ornia, .| |00001060| 42 65 72 6b 65 6c 65 79 | 20 61 6e 64 20 69 74 73 |Berkeley| and its| |00001070| 20 63 6f 6e 74 72 69 62 | 75 74 6f 72 73 2e 0d 0d | contrib|utors...| |00001080| 5c 6d 65 64 73 6b 69 70 | 20 45 76 65 72 79 20 63 |\medskip| Every c| |00001090| 61 70 69 74 61 6c 69 7a | 65 64 20 77 6f 72 64 20 |apitaliz|ed word | |000010a0| 69 6e 20 74 68 69 73 20 | 64 6f 63 75 6d 65 6e 74 |in this |document| |000010b0| 61 74 69 6f 6e 20 6d 69 | 67 68 74 20 62 65 20 61 |ation mi|ght be a| |000010c0| 20 74 72 61 64 65 6d 61 | 72 6b 20 6f 66 20 73 6f | tradema|rk of so| |000010d0| 6d 65 62 6f 64 79 2e 0d | 45 76 65 72 79 74 68 69 |mebody..|Everythi| |000010e0| 6e 67 20 72 65 6c 61 74 | 69 6e 67 20 74 6f 20 4d |ng relat|ing to M| |000010f0| 61 63 73 20 69 73 20 70 | 72 6f 62 61 62 6c 79 20 |acs is p|robably | |00001100| 61 20 74 72 61 64 65 6d | 61 72 6b 20 6f 66 20 41 |a tradem|ark of A| |00001110| 70 70 6c 65 2e 20 55 4e | 49 58 20 69 73 20 61 20 |pple. UN|IX is a | |00001120| 74 72 61 64 65 6d 61 72 | 6b 20 6f 66 0d 41 54 5c |trademar|k of.AT\| |00001130| 61 6d 70 20 54 2e 20 41 | 54 5c 61 6d 70 20 54 20 |amp T. A|T\amp T | |00001140| 69 73 20 61 20 6d 6f 64 | 65 6d 20 69 6e 69 74 69 |is a mod|em initi| |00001150| 61 6c 69 7a 61 74 69 6f | 6e 20 63 6f 6d 6d 61 6e |alizatio|n comman| |00001160| 64 2e 0d 0d 40 2a 3d 20 | 49 6e 73 74 61 6c 6c 69 |d...@*= |Installi| |00001170| 6e 67 20 61 6e 64 20 75 | 73 69 6e 67 20 47 55 53 |ng and u|sing GUS| |00001180| 49 2e 20 54 68 69 73 20 | 73 65 63 74 69 6f 6e 20 |I. This |section | |00001190| 64 69 73 63 75 73 73 65 | 73 20 68 6f 77 20 79 6f |discusse|s how yo| |000011a0| 75 20 63 61 6e 20 69 6e | 73 74 61 6c 6c 0d 5c 2e |u can in|stall.\.| |000011b0| 7b 47 55 53 49 7d 20 6f | 6e 20 79 6f 75 72 20 64 |{GUSI} o|n your d| |000011c0| 69 73 6b 20 61 6e 64 20 | 75 73 65 20 69 74 20 66 |isk and |use it f| |000011d0| 6f 72 20 79 6f 75 72 20 | 70 72 6f 67 72 61 6d 73 |or your |programs| |000011e0| 2e 0d 0d 40 20 54 6f 20 | 69 6e 73 74 61 6c 6c 20 |...@ To |install | |000011f0| 5c 2e 7b 47 55 53 49 7d | 2c 20 63 68 61 6e 67 65 |\.{GUSI}|, change| |00001200| 20 69 6e 20 74 68 65 20 | 4d 50 57 20 53 68 65 6c | in the |MPW Shel| |00001210| 6c 20 74 6f 20 69 74 73 | 20 64 69 72 65 63 74 6f |l to its| directo| |00001220| 72 79 20 61 6e 64 20 74 | 79 70 65 3a 0d 5c 6d 65 |ry and t|ype:.\me| |00001230| 64 73 6b 69 70 0d 5c 2e | 7b 42 75 69 6c 64 50 72 |dskip.\.|{BuildPr| |00001240| 6f 67 72 61 6d 20 49 6e | 73 74 61 6c 6c 20 24 3c |ogram In|stall $<| |00001250| 24 45 6e 74 65 72 24 3e | 24 7d 0d 5c 6d 65 64 73 |$Enter$>|$}.\meds| |00001260| 6b 69 70 0d 54 68 69 73 | 20 77 69 6c 6c 20 69 6e |kip.This| will in| |00001270| 73 74 61 6c 6c 20 61 6c | 6c 20 6e 65 63 65 73 73 |stall al|l necess| |00001280| 61 72 79 20 68 65 61 64 | 65 72 20 66 69 6c 65 73 |ary head|er files| |00001290| 20 69 6e 20 5c 2e 7b 5c | 7b 43 49 6e 63 6c 75 64 | in \.{\|{CInclud| |000012a0| 65 73 5c 7d 7d 2c 20 61 | 6e 64 20 74 68 65 20 6c |es\}}, a|nd the l| |000012b0| 69 62 72 61 72 79 0d 66 | 69 6c 65 20 69 6e 20 5c |ibrary.f|ile in \| |000012c0| 2e 7b 5c 7b 43 4c 69 62 | 72 61 72 69 65 73 5c 7d |.{\{CLib|raries\}| |000012d0| 7d 2e 0d 0d 40 20 54 6f | 20 75 73 65 20 5c 2e 7b |}...@ To| use \.{| |000012e0| 47 55 53 49 7d 2c 20 69 | 6e 63 6c 75 64 65 20 6f |GUSI}, i|nclude o| |000012f0| 6e 65 20 6f 72 20 6d 6f | 72 65 20 6f 66 20 74 68 |ne or mo|re of th| |00001300| 65 20 66 6f 6c 6c 6f 77 | 69 6e 67 20 68 65 61 64 |e follow|ing head| |00001310| 65 72 20 66 69 6c 65 73 | 20 69 6e 20 79 6f 75 72 |er files| in your| |00001320| 0d 70 72 6f 67 72 61 6d | 3a 0d 5c 6d 65 64 73 6b |.program|:.\medsk| |00001330| 69 70 5c 70 6c 61 69 6e | 74 77 6f 63 6f 6c 7b 0d |ip\plain|twocol{.| |00001340| 5c 2e 7b 47 55 53 49 2e | 68 7d 26 54 68 65 20 6d |\.{GUSI.|h}&The m| |00001350| 61 69 6e 20 66 69 6c 65 | 2e 20 54 68 69 73 20 69 |ain file|. This i| |00001360| 6e 63 6c 75 64 65 73 20 | 61 6c 6d 6f 73 74 20 65 |ncludes |almost e| |00001370| 76 65 72 79 74 68 69 6e | 67 20 65 6c 73 65 2e 5c |verythin|g else.\| |00001380| 63 72 0d 5c 2e 7b 54 46 | 69 6c 65 53 70 65 63 2e |cr.\.{TF|ileSpec.| |00001390| 68 7d 26 7c 46 53 53 70 | 65 63 7c 20 6d 61 6e 69 |h}&|FSSp|ec| mani| |000013a0| 70 75 6c 61 74 69 6f 6e | 20 72 6f 75 74 69 6e 65 |pulation| routine| |000013b0| 73 2e 5c 63 72 0d 5c 2e | 7b 64 69 72 65 6e 74 2e |s.\cr.\.|{dirent.| |000013c0| 68 7d 26 52 6f 75 74 69 | 6e 65 73 20 74 6f 20 61 |h}&Routi|nes to a| |000013d0| 63 63 65 73 73 20 61 6c | 6c 20 65 6e 74 72 69 65 |ccess al|l entrie| |000013e0| 73 20 69 6e 20 61 20 64 | 69 72 65 63 74 6f 72 79 |s in a d|irectory| |000013f0| 2e 5c 63 72 0d 5c 2e 7b | 73 79 73 2f 73 74 61 74 |.\cr.\.{|sys/stat| |00001400| 2e 68 7d 26 47 65 74 74 | 69 6e 67 20 69 6e 66 6f |.h}&Gett|ing info| |00001410| 72 6d 61 74 69 6f 6e 20 | 61 62 6f 75 74 20 66 69 |rmation |about fi| |00001420| 6c 65 73 2e 5c 63 72 0d | 5c 2e 7b 6e 65 74 64 62 |les.\cr.|\.{netdb| |00001430| 2e 68 7d 26 4c 6f 6f 6b | 69 6e 67 20 75 70 20 54 |.h}&Look|ing up T| |00001440| 43 50 2f 49 50 20 68 6f | 73 74 20 6e 61 6d 65 73 |CP/IP ho|st names| |00001450| 2e 5c 63 72 0d 5c 2e 7b | 6e 65 74 69 6e 65 74 2f |.\cr.\.{|netinet/| |00001460| 69 6e 2e 68 7d 26 54 68 | 65 20 61 64 64 72 65 73 |in.h}&Th|e addres| |00001470| 73 20 66 6f 72 6d 61 74 | 20 66 6f 72 20 54 43 50 |s format| for TCP| |00001480| 2f 49 50 20 73 6f 63 6b | 65 74 73 2e 5c 63 72 0d |/IP sock|ets.\cr.| |00001490| 5c 2e 7b 73 79 73 2f 65 | 72 72 6e 6f 2e 68 7d 26 |\.{sys/e|rrno.h}&| |000014a0| 54 68 65 20 65 72 72 6f | 72 73 20 63 6f 64 65 73 |The erro|rs codes| |000014b0| 20 72 65 74 75 72 6e 65 | 64 20 62 79 20 47 55 53 | returne|d by GUS| |000014c0| 49 20 72 6f 75 74 69 6e | 65 73 2e 5c 63 72 0d 5c |I routin|es.\cr.\| |000014d0| 2e 7b 73 79 73 2f 69 6f | 63 74 6c 2e 68 7d 26 43 |.{sys/io|ctl.h}&C| |000014e0| 6f 64 65 73 20 74 6f 20 | 70 61 73 73 20 74 6f 20 |odes to |pass to | |000014f0| 7c 69 6f 63 74 6c 28 29 | 7c 2e 5c 63 72 0d 5c 2e ||ioctl()||.\cr.\.| |00001500| 7b 73 79 73 2f 73 6f 63 | 6b 65 74 2e 68 7d 26 44 |{sys/soc|ket.h}&D| |00001510| 61 74 61 20 74 79 70 65 | 73 20 66 6f 72 20 73 6f |ata type|s for so| |00001520| 63 6b 65 74 20 63 61 6c | 6c 73 2e 5c 63 72 0d 5c |cket cal|ls.\cr.\| |00001530| 2e 7b 73 79 73 2f 74 79 | 70 65 73 2e 68 7d 26 4d |.{sys/ty|pes.h}&M| |00001540| 6f 72 65 20 64 61 74 61 | 20 74 79 70 65 73 2e 5c |ore data| types.\| |00001550| 63 72 0d 5c 2e 7b 73 79 | 73 2f 75 69 6f 2e 68 7d |cr.\.{sy|s/uio.h}| |00001560| 26 44 61 74 61 20 74 79 | 70 65 73 20 66 6f 72 20 |&Data ty|pes for | |00001570| 73 63 61 74 74 65 72 2f | 67 61 74 68 65 72 20 63 |scatter/|gather c| |00001580| 61 6c 6c 73 2e 5c 63 72 | 0d 7d 0d 0d 40 20 47 55 |alls.\cr|.}..@ GU| |00001590| 53 49 20 65 78 70 65 63 | 74 73 20 74 68 65 20 4d |SI expec|ts the M| |000015a0| 61 63 69 6e 74 6f 73 68 | 20 54 6f 6f 6c 62 6f 78 |acintosh| Toolbox| |000015b0| 20 74 6f 20 62 65 20 69 | 6e 69 74 69 61 6c 69 7a | to be i|nitializ| |000015c0| 65 64 2e 20 54 68 69 73 | 20 77 69 6c 6c 20 68 61 |ed. This| will ha| |000015d0| 70 70 65 6e 20 61 75 74 | 6f 6d 61 74 69 63 61 6c |ppen aut|omatical| |000015e0| 6c 79 0d 69 66 20 79 6f | 75 27 72 65 20 77 72 69 |ly.if yo|u're wri| |000015f0| 74 69 6e 67 20 61 6e 20 | 5c 2e 7b 4d 50 57 7d 20 |ting an |\.{MPW} | |00001600| 74 6f 6f 6c 20 6f 72 20 | 69 66 20 79 6f 75 20 61 |tool or |if you a| |00001610| 72 65 20 6c 69 6e 6b 69 | 6e 67 20 77 69 74 68 20 |re linki|ng with | |00001620| 5c 2e 7b 53 49 4f 57 7d | 20 61 6e 64 20 61 72 65 |\.{SIOW}| and are| |00001630| 20 66 6f 72 63 69 6e 67 | 0d 61 20 77 72 69 74 65 | forcing|.a write| |00001640| 20 74 6f 20 73 74 61 6e | 64 61 72 64 20 6f 75 74 | to stan|dard out| |00001650| 70 75 74 20 6f 72 20 73 | 74 61 6e 64 61 72 64 20 |put or s|tandard | |00001660| 65 72 72 6f 72 20 62 65 | 66 6f 72 65 20 79 6f 75 |error be|fore you| |00001670| 20 61 72 65 20 75 73 69 | 6e 67 20 61 6e 79 20 6e | are usi|ng any n| |00001680| 6f 6e 2d 66 69 6c 65 20 | 5c 2e 7b 47 55 53 49 7d |on-file |\.{GUSI}| |00001690| 0d 72 6f 75 74 69 6e 65 | 73 2e 20 4f 74 68 65 72 |.routine|s. Other| |000016a0| 77 69 73 65 2c 20 79 6f | 75 20 73 68 6f 75 6c 64 |wise, yo|u should| |000016b0| 20 69 6e 69 74 20 74 68 | 65 20 54 6f 6f 6c 62 6f | init th|e Toolbo| |000016c0| 78 20 69 6e 20 74 68 65 | 20 66 6f 6c 6c 6f 77 69 |x in the| followi| |000016d0| 6e 67 20 77 61 79 3a 0d | 40 75 0d 09 49 6e 69 74 |ng way:.|@u..Init| |000016e0| 47 72 61 66 28 28 50 74 | 72 29 20 26 71 64 2e 74 |Graf((Pt|r) &qd.t| |000016f0| 68 65 50 6f 72 74 29 3b | 0d 09 49 6e 69 74 46 6f |hePort);|..InitFo| |00001700| 6e 74 73 28 29 3b 0d 09 | 49 6e 69 74 57 69 6e 64 |nts();..|InitWind| |00001710| 6f 77 73 28 29 3b 0d 09 | 49 6e 69 74 4d 65 6e 75 |ows();..|InitMenu| |00001720| 73 28 29 3b 0d 09 54 45 | 49 6e 69 74 28 29 3b 0d |s();..TE|Init();.| |00001730| 09 49 6e 69 74 44 69 61 | 6c 6f 67 73 28 6e 69 6c |.InitDia|logs(nil| |00001740| 29 3b 0d 09 49 6e 69 74 | 43 75 72 73 6f 72 28 29 |);..Init|Cursor()| |00001750| 3b 0d 0d 40 20 59 6f 75 | 20 68 61 76 65 20 74 6f |;..@ You| have to| |00001760| 20 6c 69 6e 6b 20 79 6f | 75 72 20 70 72 6f 67 72 | link yo|ur progr| |00001770| 61 6d 20 77 69 74 68 20 | 6f 6e 65 20 6f 66 20 74 |am with |one of t| |00001780| 68 65 20 76 61 72 69 61 | 6e 74 73 20 6f 66 20 74 |he varia|nts of t| |00001790| 68 65 20 5c 2e 7b 47 55 | 53 49 7d 20 6c 69 62 72 |he \.{GU|SI} libr| |000017a0| 61 72 79 2c 0d 6c 69 6b | 65 20 5c 2e 7b 60 60 5c |ary,.lik|e \.{``\| |000017b0| 7b 43 4c 69 62 72 61 72 | 69 65 73 5c 7d 47 55 53 |{CLibrar|ies\}GUS| |000017c0| 49 2e 6f 27 27 7d 2c 20 | 69 66 20 79 6f 75 20 61 |I.o''}, |if you a| |000017d0| 72 65 20 75 73 69 6e 67 | 20 73 6f 63 6b 65 74 73 |re using| sockets| |000017e0| 2c 20 6f 72 20 0d 5c 2e | 7b 60 60 5c 7b 43 4c 69 |, or .\.|{``\{CLi| |000017f0| 62 72 61 72 69 65 73 5c | 7d 47 55 53 49 5c 5f 46 |braries\|}GUSI\_F| |00001800| 2e 6f 27 27 7d 2c 20 69 | 66 20 79 6f 75 20 61 72 |.o''}, i|f you ar| |00001810| 65 20 75 73 69 6e 67 20 | 6f 6e 6c 79 20 74 68 65 |e using |only the| |00001820| 20 66 69 6c 65 20 73 79 | 73 74 65 6d 20 63 6f 6d | file sy|stem com| |00001830| 70 6f 6e 65 6e 74 2e 20 | 0d 49 74 27 73 20 69 6d |ponent. |.It's im| |00001840| 70 6f 72 74 61 6e 74 20 | 74 68 61 74 20 74 68 65 |portant |that the| |00001850| 73 65 20 66 69 6c 65 73 | 20 61 70 70 65 61 72 20 |se files| appear | |00001860| 7b 5c 69 74 20 62 65 66 | 6f 72 65 7d 20 61 6c 6c |{\it bef|ore} all| |00001870| 20 6f 74 68 65 72 20 6c | 69 62 72 61 72 69 65 73 | other l|ibraries| |00001880| 2e 20 59 6f 75 20 77 69 | 6c 6c 0d 67 65 74 20 6c |. You wi|ll.get l| |00001890| 6f 74 73 20 6f 66 20 77 | 61 72 6e 69 6e 67 20 6d |ots of w|arning m| |000018a0| 65 73 73 61 67 65 73 20 | 61 62 6f 75 74 20 64 75 |essages |about du| |000018b0| 70 6c 69 63 61 74 65 20 | 64 65 66 69 6e 69 74 69 |plicate |definiti| |000018c0| 6f 6e 73 2c 20 62 75 74 | 20 74 68 61 74 27 73 20 |ons, but| that's | |000018d0| 6f 6b 20 28 57 68 69 63 | 68 20 0d 6d 65 61 6e 73 |ok (Whic|h .means| |000018e0| 20 49 20 63 61 6e 27 74 | 20 64 6f 20 61 6e 79 74 | I can't| do anyt| |000018f0| 68 69 6e 67 20 61 62 6f | 75 74 20 69 74 29 2e 0d |hing abo|ut it)..| |00001900| 0d 40 20 59 6f 75 20 73 | 68 6f 75 6c 64 20 61 6c |.@ You s|hould al| |00001910| 73 6f 20 72 65 7a 20 79 | 6f 75 72 20 70 72 6f 67 |so rez y|our prog| |00001920| 72 61 6d 20 77 69 74 68 | 20 5c 2e 7b 47 55 53 49 |ram with| \.{GUSI| |00001930| 2e 72 7d 2e 20 54 68 65 | 20 73 65 63 74 69 6f 6e |.r}. The| section| |00001940| 20 60 60 52 65 73 6f 75 | 72 63 65 73 27 27 20 62 | ``Resou|rces'' b| |00001950| 65 6c 6f 77 0d 64 69 73 | 63 75 73 73 65 73 20 77 |elow.dis|cusses w| |00001960| 68 65 6e 20 61 6e 64 20 | 68 6f 77 20 74 6f 20 61 |hen and |how to a| |00001970| 64 64 20 79 6f 75 72 20 | 6f 77 6e 20 63 6f 6e 66 |dd your |own conf| |00001980| 69 67 75 72 61 74 69 6f | 6e 20 72 65 73 6f 75 72 |iguratio|n resour| |00001990| 63 65 20 74 6f 20 63 75 | 73 74 6f 6d 69 7a 65 20 |ce to cu|stomize | |000019a0| 5c 2e 7b 47 55 53 49 7d | 0d 64 65 66 61 75 6c 74 |\.{GUSI}|.default| |000019b0| 73 2e 0d 0d 40 2a 3d 20 | 4f 76 65 72 76 69 65 77 |s...@*= |Overview| |000019c0| 2e 20 54 68 69 73 20 73 | 65 63 74 69 6f 6e 20 64 |. This s|ection d| |000019d0| 69 73 63 75 73 73 65 73 | 20 74 68 65 20 72 6f 75 |iscusses| the rou| |000019e0| 74 69 6e 65 73 20 63 6f | 6d 6d 6f 6e 20 74 6f 20 |tines co|mmon to | |000019f0| 61 6c 6c 2c 20 6f 72 20 | 61 6c 6d 6f 73 74 20 61 |all, or |almost a| |00001a00| 6c 6c 0d 63 6f 6d 6d 75 | 6e 69 63 61 74 69 6f 6e |ll.commu|nication| |00001a10| 20 64 6f 6d 61 69 6e 73 | 2e 20 54 68 65 73 65 20 | domains|. These | |00001a20| 72 6f 75 74 69 6e 65 73 | 20 72 65 74 75 72 6e 20 |routines| return | |00001a30| 7c 2d 31 7c 20 69 66 20 | 61 6e 20 65 72 72 6f 72 ||-1| if |an error| |00001a40| 20 6f 63 63 75 72 72 65 | 64 2c 0d 61 6e 64 20 73 | occurre|d,.and s| |00001a50| 65 74 20 74 68 65 20 76 | 61 72 69 61 62 6c 65 20 |et the v|ariable | |00001a60| 7c 65 72 72 6e 6f 7c 20 | 74 6f 20 61 6e 20 65 72 ||errno| |to an er| |00001a70| 72 6f 72 20 63 6f 64 65 | 2e 20 4f 6e 20 73 75 63 |ror code|. On suc| |00001a80| 63 65 73 73 2c 20 74 68 | 65 20 72 6f 75 74 69 6e |cess, th|e routin| |00001a90| 65 73 20 72 65 74 75 72 | 6e 20 7c 30 7c 0d 6f 72 |es retur|n |0|.or| |00001aa0| 20 73 6f 6d 65 20 70 6f | 73 69 74 69 76 65 20 76 | some po|sitive v| |00001ab0| 61 6c 75 65 2e 0d 0d 5c | 6d 65 64 73 6b 69 70 0d |alue...\|medskip.| |00001ac0| 53 6f 6d 65 20 63 6f 6d | 6d 6f 6e 20 65 72 72 6f |Some com|mon erro| |00001ad0| 72 20 63 6f 64 65 73 20 | 61 72 65 3a 0d 5c 6d 65 |r codes |are:.\me| |00001ae0| 64 73 6b 69 70 5c 70 6c | 61 69 6e 74 77 6f 63 6f |dskip\pl|aintwoco| |00001af0| 6c 7b 0d 7c 45 42 41 44 | 46 7c 26 54 68 65 20 64 |l{.|EBAD|F|&The d| |00001b00| 65 73 63 72 69 70 74 6f | 72 20 6e 75 6d 62 65 72 |escripto|r number| |00001b10| 20 79 6f 75 20 70 61 73 | 73 65 64 20 64 6f 65 73 | you pas|sed does| |00001b20| 6e 27 74 20 72 65 66 65 | 72 20 74 6f 20 61 20 76 |n't refe|r to a v| |00001b30| 61 6c 69 64 20 66 69 6c | 65 20 6f 72 20 73 6f 63 |alid fil|e or soc| |00001b40| 6b 65 74 2e 5c 63 72 0d | 7c 45 4e 4f 4d 45 4d 7c |ket.\cr.||ENOMEM|| |00001b50| 26 53 6f 6d 65 20 6d 65 | 6d 6f 72 79 20 65 72 72 |&Some me|mory err| |00001b60| 6f 72 20 6f 63 63 75 72 | 72 65 64 2e 5c 63 72 0d |or occur|red.\cr.| |00001b70| 7c 45 49 4e 54 52 7c 26 | 54 68 65 20 75 73 65 72 ||EINTR|&|The user| |00001b80| 20 69 6e 74 65 72 72 75 | 70 74 65 64 20 61 20 6c | interru|pted a l| |00001b90| 65 6e 67 74 68 79 20 6f | 70 65 72 61 74 69 6f 6e |engthy o|peration| |00001ba0| 20 62 79 20 70 72 65 73 | 73 69 6e 67 20 43 6f 6d | by pres|sing Com| |00001bb0| 6d 61 6e 64 2d 50 65 72 | 69 6f 64 2e 5c 63 72 0d |mand-Per|iod.\cr.| |00001bc0| 7c 45 4e 4f 54 43 4f 4e | 4e 7c 26 54 68 65 20 73 ||ENOTCON|N|&The s| |00001bd0| 6f 63 6b 65 74 20 69 73 | 20 6e 6f 74 20 63 6f 6e |ocket is| not con| |00001be0| 6e 65 63 74 65 64 20 61 | 6e 64 20 6d 75 73 74 20 |nected a|nd must | |00001bf0| 62 65 20 63 6f 6e 6e 65 | 63 74 65 64 20 66 6f 72 |be conne|cted for| |00001c00| 20 74 68 69 73 20 6f 70 | 65 72 61 74 69 6f 6e 2e | this op|eration.| |00001c10| 5c 63 72 0d 7d 0d 0d 40 | 2a 32 20 43 72 65 61 74 |\cr.}..@|*2 Creat| |00001c20| 69 6e 67 20 61 6e 64 20 | 64 65 73 74 72 6f 79 69 |ing and |destroyi| |00001c30| 6e 67 20 73 6f 63 6b 65 | 74 73 2e 20 41 20 73 6f |ng socke|ts. A so| |00001c40| 63 6b 65 74 20 69 73 20 | 63 72 65 61 74 65 64 20 |cket is |created | |00001c50| 77 69 74 68 20 7c 73 6f | 63 6b 65 74 28 29 7c 20 |with |so|cket()| | |00001c60| 61 6e 64 20 64 65 73 74 | 72 6f 79 65 64 0d 77 69 |and dest|royed.wi| |00001c70| 74 68 20 7c 63 6c 6f 73 | 65 28 29 7c 2e 0d 0d 40 |th |clos|e()|...@| |00001c80| 20 7c 69 6e 74 20 73 6f | 63 6b 65 74 28 69 6e 74 | |int so|cket(int| |00001c90| 20 61 66 2c 20 69 6e 74 | 20 74 79 70 65 2c 20 69 | af, int| type, i| |00001ca0| 6e 74 20 70 72 6f 74 6f | 63 6f 6c 29 7c 20 63 72 |nt proto|col)| cr| |00001cb0| 65 61 74 65 73 20 61 6e | 20 65 6e 64 70 6f 69 6e |eates an| endpoin| |00001cc0| 74 20 66 6f 72 20 63 6f | 6d 6d 75 6e 69 63 61 74 |t for co|mmunicat| |00001cd0| 69 6f 6e 0d 61 6e 64 20 | 72 65 74 75 72 6e 73 20 |ion.and |returns | |00001ce0| 61 20 64 65 73 63 72 69 | 70 74 6f 72 2e 20 7c 61 |a descri|ptor. |a| |00001cf0| 66 7c 20 73 70 65 63 69 | 66 69 65 73 20 74 68 65 |f| speci|fies the| |00001d00| 20 63 6f 6d 6d 75 6e 69 | 63 61 74 69 6f 6e 20 64 | communi|cation d| |00001d10| 6f 6d 61 69 6e 20 74 6f | 20 62 65 20 75 73 65 64 |omain to| be used| |00001d20| 2e 20 56 61 6c 69 64 0d | 76 61 6c 75 65 73 20 61 |. Valid.|values a| |00001d30| 72 65 3a 0d 5c 6d 65 64 | 73 6b 69 70 5c 70 6c 61 |re:.\med|skip\pla| |00001d40| 69 6e 74 77 6f 63 6f 6c | 7b 0d 7c 41 46 5f 55 4e |intwocol|{.|AF_UN| |00001d50| 49 58 7c 26 43 6f 6d 6d | 75 6e 69 63 61 74 69 6f |IX|&Comm|unicatio| |00001d60| 6e 20 69 6e 74 65 72 6e | 61 6c 20 74 6f 20 61 20 |n intern|al to a | |00001d70| 73 69 6e 67 6c 65 20 4d | 61 63 2e 5c 63 72 0d 7c |single M|ac.\cr.|| |00001d80| 41 46 5f 49 4e 45 54 7c | 26 54 43 50 2f 49 50 2c |AF_INET||&TCP/IP,| |00001d90| 20 75 73 69 6e 67 20 5c | 2e 7b 4d 61 63 54 43 50 | using \|.{MacTCP| |00001da0| 7d 2e 5c 63 72 0d 7c 41 | 46 5f 41 50 50 4c 45 54 |}.\cr.|A|F_APPLET| |00001db0| 41 4c 4b 7c 26 41 70 70 | 6c 65 74 61 6c 6b 2c 20 |ALK|&App|letalk, | |00001dc0| 75 73 69 6e 67 20 41 44 | 53 50 2e 5c 63 72 0d 7c |using AD|SP.\cr.|| |00001dd0| 41 46 5f 50 50 43 7c 26 | 54 68 65 20 50 72 6f 67 |AF_PPC|&|The Prog| |00001de0| 72 61 6d 2d 74 6f 2d 50 | 72 6f 67 72 61 6d 20 43 |ram-to-P|rogram C| |00001df0| 6f 6d 6d 75 6e 69 63 61 | 74 69 6f 6e 20 54 6f 6f |ommunica|tion Too| |00001e00| 6c 62 6f 78 2e 5c 63 72 | 0d 7d 0d 5c 6d 65 64 73 |lbox.\cr|.}.\meds| |00001e10| 6b 69 70 0d 7c 74 79 70 | 65 7c 20 73 70 65 63 69 |kip.|typ|e| speci| |00001e20| 66 69 65 73 20 74 68 65 | 20 73 65 6d 61 6e 74 69 |fies the| semanti| |00001e30| 63 73 20 6f 66 20 74 68 | 65 20 63 6f 6d 6d 75 6e |cs of th|e commun| |00001e40| 69 63 61 74 69 6f 6e 2e | 20 54 68 65 20 66 6f 6c |ication.| The fol| |00001e50| 6c 6f 77 69 6e 67 20 74 | 77 6f 20 74 79 70 65 73 |lowing t|wo types| |00001e60| 20 61 72 65 0d 61 76 61 | 69 6c 61 62 6c 65 3a 0d | are.ava|ilable:.| |00001e70| 5c 6d 65 64 73 6b 69 70 | 5c 70 6c 61 69 6e 74 77 |\medskip|\plaintw| |00001e80| 6f 63 6f 6c 7b 0d 7c 53 | 4f 43 4b 5f 53 54 52 45 |ocol{.|S|OCK_STRE| |00001e90| 41 4d 7c 26 41 20 74 77 | 6f 20 77 61 79 2c 20 72 |AM|&A tw|o way, r| |00001ea0| 65 6c 69 61 62 6c 65 2c | 20 63 6f 6e 6e 65 63 74 |eliable,| connect| |00001eb0| 69 6f 6e 20 62 61 73 65 | 64 20 62 79 74 65 20 73 |ion base|d byte s| |00001ec0| 74 72 65 61 6d 2e 5c 63 | 72 0d 7c 53 4f 43 4b 5f |tream.\c|r.|SOCK_| |00001ed0| 44 47 52 41 4d 7c 26 43 | 6f 6e 6e 65 63 74 69 6f |DGRAM|&C|onnectio| |00001ee0| 6e 6c 65 73 73 2c 20 75 | 6e 72 65 6c 69 61 62 6c |nless, u|nreliabl| |00001ef0| 65 20 6d 65 73 73 61 67 | 65 73 20 6f 66 20 61 20 |e messag|es of a | |00001f00| 66 69 78 65 64 20 6d 61 | 78 69 6d 75 6d 20 6c 65 |fixed ma|ximum le| |00001f10| 6e 67 74 68 2e 5c 63 72 | 0d 7d 0d 5c 6d 65 64 73 |ngth.\cr|.}.\meds| |00001f20| 6b 69 70 0d 7c 70 72 6f | 74 6f 63 6f 6c 7c 20 77 |kip.|pro|tocol| w| |00001f30| 6f 75 6c 64 20 62 65 20 | 75 73 65 64 20 74 6f 20 |ould be |used to | |00001f40| 73 70 65 63 69 66 79 20 | 61 6e 20 61 6c 74 65 72 |specify |an alter| |00001f50| 6e 61 74 65 20 70 72 6f | 74 6f 63 6f 6c 20 74 6f |nate pro|tocol to| |00001f60| 20 62 65 20 75 73 65 64 | 20 77 69 74 68 20 61 20 | be used| with a | |00001f70| 73 6f 63 6b 65 74 2e 0d | 49 6e 20 5c 2e 7b 47 55 |socket..|In \.{GU| |00001f80| 53 49 7d 2c 20 68 6f 77 | 65 76 65 72 2c 20 74 68 |SI}, how|ever, th| |00001f90| 69 73 20 70 61 72 61 6d | 65 74 65 72 20 69 73 20 |is param|eter is | |00001fa0| 61 6c 77 61 79 73 20 69 | 67 6e 6f 72 65 64 2e 0d |always i|gnored..| |00001fb0| 5c 6d 65 64 73 6b 69 70 | 0d 45 72 72 6f 72 20 63 |\medskip|.Error c| |00001fc0| 6f 64 65 73 3a 0d 5c 6d | 65 64 73 6b 69 70 5c 70 |odes:.\m|edskip\p| |00001fd0| 6c 61 69 6e 74 77 6f 63 | 6f 6c 7b 0d 7c 45 49 4e |laintwoc|ol{.|EIN| |00001fe0| 56 41 4c 7c 26 54 68 65 | 20 7c 61 66 7c 20 79 6f |VAL|&The| |af| yo| |00001ff0| 75 20 73 70 65 63 69 66 | 69 65 64 20 64 6f 65 73 |u specif|ied does| |00002000| 6e 27 74 20 65 78 69 73 | 74 2e 5c 63 72 0d 7c 45 |n't exis|t.\cr.|E| |00002010| 4d 46 49 4c 45 7c 26 54 | 68 65 20 64 65 73 63 72 |MFILE|&T|he descr| |00002020| 69 70 74 6f 72 20 74 61 | 62 6c 65 20 69 73 20 66 |iptor ta|ble is f| |00002030| 75 6c 6c 2e 5c 63 72 0d | 7d 0d 0d 40 20 7c 76 6f |ull.\cr.|}..@ |vo| |00002040| 69 64 20 63 6c 6f 73 65 | 28 69 6e 74 20 66 64 29 |id close|(int fd)| |00002050| 7c 20 72 65 6d 6f 76 65 | 73 20 74 68 65 20 61 63 || remove|s the ac| |00002060| 63 65 73 73 20 70 61 74 | 68 20 61 73 73 6f 63 69 |cess pat|h associ| |00002070| 61 74 65 64 20 77 69 74 | 68 20 74 68 65 20 64 65 |ated wit|h the de| |00002080| 73 63 72 69 70 74 6f 72 | 2c 20 61 6e 64 0d 63 6c |scriptor|, and.cl| |00002090| 6f 73 65 73 20 74 68 65 | 20 66 69 6c 65 20 6f 72 |oses the| file or| |000020a0| 20 73 6f 63 6b 65 74 20 | 69 66 20 74 68 65 20 6c | socket |if the l| |000020b0| 61 73 74 20 61 63 63 65 | 73 73 20 70 61 74 68 20 |ast acce|ss path | |000020c0| 72 65 66 65 72 72 69 6e | 67 20 74 6f 20 69 74 20 |referrin|g to it | |000020d0| 77 61 73 20 72 65 6d 6f | 76 65 64 2e 0d 0d 40 2a |was remo|ved...@*| |000020e0| 32 20 50 72 6f 6d 70 74 | 69 6e 67 20 74 68 65 20 |2 Prompt|ing the | |000020f0| 75 73 65 72 20 66 6f 72 | 20 61 6e 20 61 64 64 72 |user for| an addr| |00002100| 65 73 73 2e 20 54 6f 20 | 67 69 76 65 20 74 68 65 |ess. To |give the| |00002110| 20 75 73 65 72 20 74 68 | 65 20 6f 70 70 6f 72 74 | user th|e opport| |00002120| 75 6e 69 74 79 20 6f 66 | 20 65 6e 74 65 72 69 6e |unity of| enterin| |00002130| 67 0d 61 6e 20 61 64 64 | 72 65 73 73 20 66 6f 72 |g.an add|ress for| |00002140| 20 61 20 73 6f 63 6b 65 | 74 20 74 6f 20 62 65 20 | a socke|t to be | |00002150| 62 6f 75 6e 64 20 6f 72 | 20 63 6f 6e 6e 65 63 74 |bound or| connect| |00002160| 65 64 20 74 6f 2c 20 74 | 68 65 20 7c 63 68 6f 6f |ed to, t|he |choo| |00002170| 73 65 28 29 7c 20 72 6f | 75 74 69 6e 65 20 77 61 |se()| ro|utine wa| |00002180| 73 0d 69 6e 74 72 6f 64 | 75 63 65 64 20 69 6e 20 |s.introd|uced in | |00002190| 5c 2e 7b 47 55 53 49 7d | 2e 20 54 68 69 73 20 72 |\.{GUSI}|. This r| |000021a0| 6f 75 74 69 6e 65 20 68 | 61 73 20 6e 6f 20 63 6f |outine h|as no co| |000021b0| 75 6e 74 65 72 70 61 72 | 74 20 69 6e 20 55 4e 49 |unterpar|t in UNI| |000021c0| 58 20 69 6d 70 6c 65 6d | 65 6e 74 61 74 69 6f 6e |X implem|entation| |000021d0| 73 2e 0d 0d 40 20 7c 69 | 6e 74 20 63 68 6f 6f 73 |s...@ |i|nt choos| |000021e0| 65 28 69 6e 74 20 64 6f | 6d 61 69 6e 2c 20 69 6e |e(int do|main, in| |000021f0| 74 20 74 79 70 65 2c 20 | 63 68 61 72 20 2a 20 70 |t type, |char * p| |00002200| 72 6f 6d 70 74 2c 20 76 | 6f 69 64 20 2a 20 63 6f |rompt, v|oid * co| |00002210| 6e 73 74 72 61 69 6e 74 | 2c 20 69 6e 74 20 66 6c |nstraint|, int fl| |00002220| 61 67 73 2c 0d 76 6f 69 | 64 20 2a 20 6e 61 6d 65 |ags,.voi|d * name| |00002230| 2c 20 69 6e 74 20 2a 20 | 6e 6c 65 6e 29 7c 20 70 |, int * |nlen)| p| |00002240| 75 74 73 20 75 70 20 61 | 20 6d 6f 64 61 6c 20 64 |uts up a| modal d| |00002250| 69 61 6c 6f 67 20 70 72 | 6f 6d 70 74 69 6e 67 20 |ialog pr|ompting | |00002260| 74 68 65 20 75 73 65 72 | 20 74 6f 0d 63 68 6f 6f |the user| to.choo| |00002270| 73 65 20 61 6e 20 61 64 | 64 72 65 73 73 2e 20 7c |se an ad|dress. || |00002280| 64 6f 6d 61 69 6e 7c 20 | 73 70 65 63 69 66 69 65 |domain| |specifie| |00002290| 73 20 74 68 65 20 63 6f | 6d 6d 75 6e 69 63 61 74 |s the co|mmunicat| |000022a0| 69 6f 6e 20 64 6f 6d 61 | 69 6e 2c 20 6c 69 6b 65 |ion doma|in, like| |000022b0| 20 69 6e 20 7c 73 6f 63 | 6b 65 74 7c 2e 0d 7c 74 | in |soc|ket|..|t| |000022c0| 79 70 65 7c 20 6d 61 79 | 20 62 65 20 75 73 65 64 |ype| may| be used| |000022d0| 20 62 79 20 66 75 74 75 | 72 65 20 63 6f 6d 6d 75 | by futu|re commu| |000022e0| 6e 69 63 61 74 69 6f 6e | 20 64 6f 6d 61 69 6e 73 |nication| domains| |000022f0| 20 74 6f 20 66 75 72 74 | 68 65 72 20 64 69 66 66 | to furt|her diff| |00002300| 65 72 65 6e 74 69 61 74 | 65 0d 77 69 74 68 69 6e |erentiat|e.within| |00002310| 20 61 20 64 6f 6d 61 69 | 6e 2c 20 62 75 74 20 69 | a domai|n, but i| |00002320| 73 20 69 67 6e 6f 72 65 | 64 20 62 79 20 63 75 72 |s ignore|d by cur| |00002330| 72 65 6e 74 20 64 6f 6d | 61 69 6e 73 2e 20 7c 70 |rent dom|ains. |p| |00002340| 72 6f 6d 70 74 7c 20 69 | 73 20 61 20 6d 65 73 73 |rompt| i|s a mess| |00002350| 61 67 65 20 74 68 61 74 | 20 77 69 6c 6c 0d 61 70 |age that| will.ap| |00002360| 70 65 61 72 20 69 6e 20 | 74 68 65 20 64 69 61 6c |pear in |the dial| |00002370| 6f 67 2e 20 7c 63 6f 6e | 73 74 72 61 69 6e 74 7c |og. |con|straint|| |00002380| 20 6d 61 79 20 62 65 20 | 75 73 65 64 20 74 6f 20 | may be |used to | |00002390| 72 65 73 74 72 69 63 74 | 20 74 68 65 20 74 79 70 |restrict| the typ| |000023a0| 65 73 20 6f 66 20 61 63 | 63 65 70 74 61 62 6c 65 |es of ac|ceptable| |000023b0| 0d 61 64 64 72 65 73 73 | 65 73 20 28 46 6f 72 20 |.address|es (For | |000023c0| 6d 6f 72 65 20 69 6e 66 | 6f 72 6d 61 74 69 6f 6e |more inf|ormation| |000023d0| 2c 20 63 6f 6e 73 75 6c | 74 20 74 68 65 20 73 65 |, consul|t the se| |000023e0| 63 74 69 6f 6e 20 6f 66 | 20 74 68 65 20 63 6f 6d |ction of| the com| |000023f0| 6d 75 6e 69 63 61 74 69 | 6f 6e 20 64 6f 6d 61 69 |municati|on domai| |00002400| 6e 29 2e 0d 54 68 65 20 | 66 6f 6c 6c 6f 77 69 6e |n)..The |followin| |00002410| 67 20 74 77 6f 20 7c 66 | 6c 61 67 73 7c 20 61 72 |g two |f|lags| ar| |00002420| 65 20 64 65 66 69 6e 65 | 64 20 66 6f 72 20 6d 6f |e define|d for mo| |00002430| 73 74 20 73 6f 63 6b 65 | 74 20 74 79 70 65 73 3a |st socke|t types:| |00002440| 0d 5c 6d 65 64 73 6b 69 | 70 5c 70 6c 61 69 6e 74 |.\medski|p\plaint| |00002450| 77 6f 63 6f 6c 7b 0d 7c | 43 48 4f 4f 53 45 5f 44 |wocol{.||CHOOSE_D| |00002460| 45 46 41 55 4c 54 7c 26 | 4f 66 66 65 72 20 74 68 |EFAULT|&|Offer th| |00002470| 65 20 63 6f 6e 74 65 6e | 74 73 20 70 61 73 73 65 |e conten|ts passe| |00002480| 64 20 69 6e 20 7c 6e 61 | 6d 65 7c 20 61 73 20 74 |d in |na|me| as t| |00002490| 68 65 20 64 65 66 61 75 | 6c 74 20 63 68 6f 69 63 |he defau|lt choic| |000024a0| 65 2e 5c 63 72 0d 7c 43 | 48 4f 4f 53 45 5f 4e 45 |e.\cr.|C|HOOSE_NE| |000024b0| 57 7c 26 50 72 6f 6d 70 | 74 20 66 6f 72 20 61 20 |W|&Promp|t for a | |000024c0| 6e 65 77 20 61 64 64 72 | 65 73 73 2c 20 73 75 69 |new addr|ess, sui| |000024d0| 74 61 62 6c 65 20 66 6f | 72 20 70 61 73 73 69 6e |table fo|r passin| |000024e0| 67 20 74 6f 20 7c 62 69 | 6e 64 28 29 7c 2e 20 44 |g to |bi|nd()|. D| |000024f0| 65 66 61 75 6c 74 0d 69 | 73 20 70 72 6f 6d 70 74 |efault.i|s prompt| |00002500| 69 6e 67 20 66 6f 72 20 | 61 6e 20 65 78 69 73 74 |ing for |an exist| |00002510| 69 6e 67 20 61 64 64 72 | 65 73 73 2c 20 74 6f 20 |ing addr|ess, to | |00002520| 62 65 20 75 73 65 64 20 | 62 79 20 7c 63 6f 6e 6e |be used |by |conn| |00002530| 65 63 74 28 29 7c 2e 5c | 63 72 0d 7d 0d 5c 6d 65 |ect()|.\|cr.}.\me| |00002540| 64 73 6b 69 70 0d 7c 6e | 61 6d 65 7c 20 6f 6e 20 |dskip.|n|ame| on | |00002550| 69 6e 70 75 74 20 63 6f | 6e 74 61 69 6e 73 20 61 |input co|ntains a| |00002560| 20 64 65 66 61 75 6c 74 | 20 61 64 64 72 65 73 73 | default| address| |00002570| 20 69 66 20 7c 43 48 4f | 4f 53 45 5f 44 45 46 41 | if |CHO|OSE_DEFA| |00002580| 55 4c 54 7c 20 69 73 20 | 73 65 74 2e 20 4f 6e 20 |ULT| is |set. On | |00002590| 6f 75 74 70 75 74 2c 20 | 69 74 0d 69 73 20 73 65 |output, |it.is se| |000025a0| 74 20 74 6f 20 74 68 65 | 20 61 64 64 72 65 73 73 |t to the| address| |000025b0| 20 63 68 6f 73 65 6e 2e | 0d 5c 6d 65 64 73 6b 69 | chosen.|.\medski| |000025c0| 70 0d 45 72 72 6f 72 20 | 63 6f 64 65 73 3a 0d 5c |p.Error |codes:.\| |000025d0| 6d 65 64 73 6b 69 70 5c | 70 6c 61 69 6e 74 77 6f |medskip\|plaintwo| |000025e0| 63 6f 6c 7b 0d 7c 45 49 | 4e 56 41 4c 7c 26 4f 6e |col{.|EI|NVAL|&On| |000025f0| 65 20 6f 66 20 74 68 65 | 20 7c 66 6c 61 67 73 7c |e of the| |flags|| |00002600| 20 69 73 20 6e 6f 74 20 | 28 79 65 74 29 20 73 75 | is not |(yet) su| |00002610| 70 70 6f 72 74 65 64 20 | 62 79 20 74 68 69 73 20 |pported |by this | |00002620| 63 6f 6d 6d 75 6e 69 63 | 61 74 69 6f 6e 73 0d 64 |communic|ations.d| |00002630| 6f 6d 61 69 6e 2e 20 54 | 68 69 73 20 65 72 72 6f |omain. T|his erro| |00002640| 72 20 69 73 20 6e 65 76 | 65 72 20 72 65 70 6f 72 |r is nev|er repor| |00002650| 74 65 64 20 66 6f 72 20 | 7c 43 48 4f 4f 53 45 5f |ted for ||CHOOSE_| |00002660| 44 45 46 41 55 4c 54 7c | 2c 20 77 68 69 63 68 20 |DEFAULT||, which | |00002670| 6d 69 67 68 74 20 67 65 | 74 20 73 69 6c 65 6e 74 |might ge|t silent| |00002680| 6c 79 0d 69 67 6e 6f 72 | 65 64 2e 5c 63 72 0d 7c |ly.ignor|ed.\cr.|| |00002690| 45 49 4e 54 52 7c 26 54 | 68 65 20 75 73 65 72 20 |EINTR|&T|he user | |000026a0| 63 68 6f 73 65 20 60 60 | 43 61 6e 63 65 6c 27 27 |chose ``|Cancel''| |000026b0| 20 69 6e 20 74 68 65 20 | 64 69 61 6c 6f 67 2e 5c | in the |dialog.\| |000026c0| 63 72 0d 7d 0d 0d 40 2a | 32 20 45 73 74 61 62 6c |cr.}..@*|2 Establ| |000026d0| 69 73 68 69 6e 67 20 63 | 6f 6e 6e 65 63 74 69 6f |ishing c|onnectio| |000026e0| 6e 73 20 62 65 74 77 65 | 65 6e 20 73 6f 63 6b 65 |ns betwe|en socke| |000026f0| 74 73 2e 20 42 65 66 6f | 72 65 20 79 6f 75 20 63 |ts. Befo|re you c| |00002700| 61 6e 20 74 72 61 6e 73 | 6d 69 74 20 64 61 74 61 |an trans|mit data| |00002710| 20 6f 6e 20 61 0d 73 74 | 72 65 61 6d 20 73 6f 63 | on a.st|ream soc| |00002720| 6b 65 74 2c 20 69 74 20 | 6d 75 73 74 20 62 65 20 |ket, it |must be | |00002730| 63 6f 6e 6e 65 63 74 65 | 64 20 74 6f 20 61 20 70 |connecte|d to a p| |00002740| 65 65 72 20 73 6f 63 6b | 65 74 2e 20 43 6f 6e 6e |eer sock|et. Conn| |00002750| 65 63 74 69 6f 6e 20 65 | 73 74 61 62 6c 69 73 68 |ection e|stablish| |00002760| 6d 65 6e 74 20 69 73 0d | 61 73 79 6d 6d 65 74 72 |ment is.|asymmetr| |00002770| 69 63 61 6c 3a 20 54 68 | 65 20 73 65 72 76 65 72 |ical: Th|e server| |00002780| 20 73 6f 63 6b 65 74 20 | 72 65 67 69 73 74 65 72 | socket |register| |00002790| 73 20 69 74 73 20 61 64 | 64 72 65 73 73 20 77 69 |s its ad|dress wi| |000027a0| 74 68 20 7c 62 69 6e 64 | 28 29 7c 2c 20 63 61 6c |th |bind|()|, cal| |000027b0| 6c 73 20 7c 6c 69 73 74 | 65 6e 28 29 7c 0d 74 6f |ls |list|en()|.to| |000027c0| 20 69 6e 64 69 63 61 74 | 65 20 69 74 73 20 77 69 | indicat|e its wi| |000027d0| 6c 6c 69 6e 67 6e 65 73 | 73 20 74 6f 20 61 63 63 |llingnes|s to acc| |000027e0| 65 70 74 20 63 6f 6e 6e | 65 63 74 69 6f 6e 73 20 |ept conn|ections | |000027f0| 61 6e 64 20 61 63 63 65 | 70 74 73 20 74 68 65 6d |and acce|pts them| |00002800| 20 62 79 20 63 61 6c 6c | 69 6e 67 0d 7c 61 63 63 | by call|ing.|acc| |00002810| 65 70 74 28 29 7c 2e 20 | 54 68 65 20 63 6c 69 65 |ept()|. |The clie| |00002820| 6e 74 20 73 6f 63 6b 65 | 74 2c 20 61 66 74 65 72 |nt socke|t, after| |00002830| 20 70 6f 73 73 69 62 6c | 79 20 68 61 76 69 6e 67 | possibl|y having| |00002840| 20 72 65 67 69 73 74 65 | 72 65 64 20 69 74 73 20 | registe|red its | |00002850| 61 64 64 72 65 73 73 20 | 77 69 74 68 0d 7c 62 69 |address |with.|bi| |00002860| 6e 64 28 29 7c 20 28 54 | 68 69 73 20 69 73 20 6e |nd()| (T|his is n| |00002870| 6f 74 20 6e 65 63 65 73 | 73 61 72 79 20 66 6f 72 |ot neces|sary for| |00002880| 20 61 6c 6c 20 73 6f 63 | 6b 65 74 20 66 61 6d 69 | all soc|ket fami| |00002890| 6c 69 65 73 20 61 73 20 | 73 6f 6d 65 20 77 69 6c |lies as |some wil| |000028a0| 6c 20 61 75 74 6f 6d 61 | 74 69 63 61 6c 6c 79 0d |l automa|tically.| |000028b0| 61 73 73 69 67 6e 20 61 | 6e 20 61 64 64 72 65 73 |assign a|n addres| |000028c0| 73 29 20 63 61 6c 6c 73 | 20 7c 63 6f 6e 6e 65 63 |s) calls| |connec| |000028d0| 74 28 29 7c 20 74 6f 20 | 65 73 74 61 62 6c 69 73 |t()| to |establis| |000028e0| 68 20 61 20 63 6f 6e 6e | 65 63 74 69 6f 6e 20 77 |h a conn|ection w| |000028f0| 69 74 68 20 61 20 73 65 | 72 76 65 72 2e 0d 0d 49 |ith a se|rver...I| |00002900| 74 20 69 73 20 70 6f 73 | 73 69 62 6c 65 2c 20 62 |t is pos|sible, b| |00002910| 75 74 20 6e 6f 74 20 72 | 65 71 75 69 72 65 64 2c |ut not r|equired,| |00002920| 20 74 6f 20 63 61 6c 6c | 20 7c 63 6f 6e 6e 65 63 | to call| |connec| |00002930| 74 28 29 7c 20 66 6f 72 | 20 64 61 74 61 67 72 61 |t()| for| datagra| |00002940| 6d 20 73 6f 63 6b 65 74 | 73 2e 0d 0d 40 20 7c 69 |m socket|s...@ |i| |00002950| 6e 74 20 62 69 6e 64 28 | 69 6e 74 20 73 2c 20 76 |nt bind(|int s, v| |00002960| 6f 69 64 20 2a 6e 61 6d | 65 2c 20 69 6e 74 20 6e |oid *nam|e, int n| |00002970| 61 6d 65 6c 65 6e 29 7c | 20 62 69 6e 64 73 20 61 |amelen)|| binds a| |00002980| 20 73 6f 63 6b 65 74 20 | 74 6f 20 69 74 73 20 61 | socket |to its a| |00002990| 64 64 72 65 73 73 2e 20 | 54 68 65 0d 66 6f 72 6d |ddress. |The.form| |000029a0| 61 74 20 6f 66 20 74 68 | 65 20 61 64 64 72 65 73 |at of th|e addres| |000029b0| 73 20 69 73 20 64 69 66 | 66 65 72 65 6e 74 20 66 |s is dif|ferent f| |000029c0| 6f 72 20 65 76 65 72 79 | 20 73 6f 63 6b 65 74 20 |or every| socket | |000029d0| 66 61 6d 69 6c 79 2e 20 | 46 6f 72 20 73 6f 6d 65 |family. |For some| |000029e0| 20 66 61 6d 69 6c 69 65 | 73 2c 20 79 6f 75 0d 6d | familie|s, you.m| |000029f0| 61 79 20 61 73 6b 20 74 | 68 65 20 75 73 65 72 20 |ay ask t|he user | |00002a00| 66 6f 72 20 61 6e 20 61 | 64 64 72 65 73 73 20 62 |for an a|ddress b| |00002a10| 79 20 63 61 6c 6c 69 6e | 67 20 7c 63 68 6f 6f 73 |y callin|g |choos| |00002a20| 65 28 29 7c 2e 0d 5c 6d | 65 64 73 6b 69 70 0d 45 |e()|..\m|edskip.E| |00002a30| 72 72 6f 72 20 63 6f 64 | 65 73 3a 0d 5c 6d 65 64 |rror cod|es:.\med| |00002a40| 73 6b 69 70 5c 70 6c 61 | 69 6e 74 77 6f 63 6f 6c |skip\pla|intwocol| |00002a50| 7b 0d 7c 45 41 46 4e 4f | 53 55 50 50 4f 52 54 7c |{.|EAFNO|SUPPORT|| |00002a60| 26 7c 6e 61 6d 65 7c 20 | 73 70 65 63 69 66 69 65 |&|name| |specifie| |00002a70| 73 20 61 6e 20 69 6c 6c | 65 67 61 6c 20 61 64 64 |s an ill|egal add| |00002a80| 72 65 73 73 20 66 61 6d | 69 6c 79 20 66 6f 72 20 |ress fam|ily for | |00002a90| 74 68 69 73 20 73 6f 63 | 6b 65 74 2e 5c 63 72 0d |this soc|ket.\cr.| |00002aa0| 7c 45 41 44 44 52 49 4e | 55 53 45 7c 26 54 68 65 ||EADDRIN|USE|&The| |00002ab0| 72 65 20 69 73 20 61 6c | 72 65 61 64 79 20 61 6e |re is al|ready an| |00002ac0| 6f 74 68 65 72 20 73 6f | 63 6b 65 74 20 77 69 74 |other so|cket wit| |00002ad0| 68 20 74 68 69 73 20 61 | 64 64 72 65 73 73 2e 5c |h this a|ddress.\| |00002ae0| 63 72 0d 7d 0d 0d 40 20 | 7c 69 6e 74 20 6c 69 73 |cr.}..@ ||int lis| |00002af0| 74 65 6e 28 69 6e 74 20 | 73 2c 20 69 6e 74 20 71 |ten(int |s, int q| |00002b00| 6c 65 6e 29 7c 20 74 75 | 72 6e 73 20 61 20 73 6f |len)| tu|rns a so| |00002b10| 63 6b 65 74 20 69 6e 74 | 6f 20 61 20 6c 69 73 74 |cket int|o a list| |00002b20| 65 6e 65 72 2e 20 7c 71 | 6c 65 6e 7c 20 64 65 74 |ener. |q|len| det| |00002b30| 65 72 6d 69 6e 65 73 0d | 68 6f 77 20 6d 61 6e 79 |ermines.|how many| |00002b40| 20 73 6f 63 6b 65 74 73 | 20 63 61 6e 20 63 6f 6e | sockets| can con| |00002b50| 63 75 72 72 65 6e 74 6c | 79 20 77 61 69 74 20 66 |currentl|y wait f| |00002b60| 6f 72 20 61 20 63 6f 6e | 6e 65 63 74 69 6f 6e 2c |or a con|nection,| |00002b70| 20 62 75 74 20 69 73 20 | 69 67 6e 6f 72 65 64 20 | but is |ignored | |00002b80| 66 6f 72 20 61 6c 6d 6f | 73 74 0d 61 6c 6c 20 73 |for almo|st.all s| |00002b90| 6f 63 6b 65 74 20 66 61 | 6d 69 6c 69 65 73 2e 0d |ocket fa|milies..| |00002ba0| 0d 40 20 7c 69 6e 74 20 | 61 63 63 65 70 74 28 69 |.@ |int |accept(i| |00002bb0| 6e 74 20 73 2c 20 76 6f | 69 64 20 2a 61 64 64 72 |nt s, vo|id *addr| |00002bc0| 2c 20 69 6e 74 20 2a 61 | 64 64 72 6c 65 6e 29 7c |, int *a|ddrlen)|| |00002bd0| 20 61 63 63 65 70 74 73 | 20 61 20 63 6f 6e 6e 65 | accepts| a conne| |00002be0| 63 74 69 6f 6e 20 66 6f | 72 20 61 20 73 6f 63 6b |ction fo|r a sock| |00002bf0| 65 74 0d 7b 5c 69 74 20 | 6f 6e 20 61 20 6e 65 77 |et.{\it |on a new| |00002c00| 20 73 6f 63 6b 65 74 7d | 20 61 6e 64 20 72 65 74 | socket}| and ret| |00002c10| 75 72 6e 73 20 74 68 65 | 20 64 65 73 63 72 69 70 |urns the| descrip| |00002c20| 74 6f 72 20 6f 66 20 74 | 68 65 20 6e 65 77 20 73 |tor of t|he new s| |00002c30| 6f 63 6b 65 74 2e 20 49 | 66 20 7c 61 64 64 72 7c |ocket. I|f |addr|| |00002c40| 20 69 73 20 6e 6f 74 0d | 7c 4e 55 4c 4c 7c 2c 20 | is not.||NULL|, | |00002c50| 74 68 65 20 61 64 64 72 | 65 73 73 20 6f 66 20 74 |the addr|ess of t| |00002c60| 68 65 20 63 6f 6e 6e 65 | 63 74 69 6e 67 20 73 6f |he conne|cting so| |00002c70| 63 6b 65 74 20 77 69 6c | 6c 20 62 65 20 61 73 73 |cket wil|l be ass| |00002c80| 69 67 6e 65 64 20 74 6f | 20 69 74 2e 0d 0d 59 6f |igned to| it...Yo| |00002c90| 75 20 63 61 6e 20 66 69 | 6e 64 20 6f 75 74 20 69 |u can fi|nd out i| |00002ca0| 66 20 61 20 63 6f 6e 6e | 65 63 74 69 6f 6e 20 69 |f a conn|ection i| |00002cb0| 73 20 70 65 6e 64 69 6e | 67 20 62 79 20 63 61 6c |s pendin|g by cal| |00002cc0| 6c 69 6e 67 20 7c 73 65 | 6c 65 63 74 28 29 7c 20 |ling |se|lect()| | |00002cd0| 74 6f 20 66 69 6e 64 20 | 6f 75 74 20 69 66 0d 74 |to find |out if.t| |00002ce0| 68 65 20 73 6f 63 6b 65 | 74 20 69 73 20 72 65 61 |he socke|t is rea| |00002cf0| 64 79 20 66 6f 72 20 7b | 5c 69 74 20 72 65 61 64 |dy for {|\it read| |00002d00| 69 6e 67 7d 2e 0d 5c 6d | 65 64 73 6b 69 70 0d 45 |ing}..\m|edskip.E| |00002d10| 72 72 6f 72 20 63 6f 64 | 65 73 3a 0d 5c 6d 65 64 |rror cod|es:.\med| |00002d20| 73 6b 69 70 5c 70 6c 61 | 69 6e 74 77 6f 63 6f 6c |skip\pla|intwocol| |00002d30| 7b 0d 7c 45 4e 4f 54 43 | 4f 4e 4e 7c 26 59 6f 75 |{.|ENOTC|ONN|&You| |00002d40| 20 64 69 64 20 6e 6f 74 | 20 63 61 6c 6c 20 7c 6c | did not| call |l| |00002d50| 69 73 74 65 6e 28 29 7c | 20 66 6f 72 20 74 68 69 |isten()|| for thi| |00002d60| 73 20 73 6f 63 6b 65 74 | 2e 5c 63 72 0d 7c 45 57 |s socket|.\cr.|EW| |00002d70| 4f 55 4c 44 42 4c 4f 43 | 4b 7c 26 54 68 65 20 73 |OULDBLOC|K|&The s| |00002d80| 6f 63 6b 65 74 20 69 73 | 20 6e 6f 6e 62 6c 6f 63 |ocket is| nonbloc| |00002d90| 6b 69 6e 67 20 61 6e 64 | 20 6e 6f 20 73 6f 63 6b |king and| no sock| |00002da0| 65 74 20 69 73 20 74 72 | 79 69 6e 67 20 74 6f 20 |et is tr|ying to | |00002db0| 63 6f 6e 6e 65 63 74 2e | 5c 63 72 0d 7d 0d 0d 40 |connect.|\cr.}..@| |00002dc0| 20 7c 69 6e 74 20 63 6f | 6e 6e 65 63 74 28 69 6e | |int co|nnect(in| |00002dd0| 74 20 73 2c 20 76 6f 69 | 64 20 2a 61 64 64 72 2c |t s, voi|d *addr,| |00002de0| 20 69 6e 74 20 61 64 64 | 72 6c 65 6e 29 7c 20 74 | int add|rlen)| t| |00002df0| 72 69 65 73 20 74 6f 20 | 63 6f 6e 6e 65 63 74 20 |ries to |connect | |00002e00| 74 6f 20 74 68 65 20 73 | 6f 63 6b 65 74 20 77 68 |to the s|ocket wh| |00002e10| 6f 73 65 0d 61 64 64 72 | 65 73 73 20 69 73 20 69 |ose.addr|ess is i| |00002e20| 6e 20 7c 61 64 64 72 7c | 2e 20 49 66 20 74 68 65 |n |addr||. If the| |00002e30| 20 73 6f 63 6b 65 74 20 | 69 73 20 6e 6f 6e 62 6c | socket |is nonbl| |00002e40| 6f 63 6b 69 6e 67 20 61 | 6e 64 20 74 68 65 20 63 |ocking a|nd the c| |00002e50| 6f 6e 6e 65 63 74 69 6f | 6e 20 63 61 6e 6e 6f 74 |onnectio|n cannot| |00002e60| 20 62 65 0d 6d 61 64 65 | 20 69 6d 6d 65 64 69 61 | be.made| immedia| |00002e70| 74 65 6c 79 2c 20 7c 63 | 6f 6e 6e 65 63 74 28 29 |tely, |c|onnect()| |00002e80| 7c 20 72 65 74 75 72 6e | 73 20 7c 45 49 4e 50 52 || return|s |EINPR| |00002e90| 4f 47 52 45 53 53 7c 2e | 20 59 6f 75 20 63 61 6e |OGRESS|.| You can| |00002ea0| 20 66 69 6e 64 20 6f 75 | 74 20 69 66 20 74 68 65 | find ou|t if the| |00002eb0| 0d 63 6f 6e 6e 65 63 74 | 69 6f 6e 20 68 61 73 20 |.connect|ion has | |00002ec0| 62 65 65 6e 20 65 73 74 | 61 62 6c 69 73 68 65 64 |been est|ablished| |00002ed0| 20 62 79 20 63 61 6c 6c | 69 6e 67 20 7c 73 65 6c | by call|ing |sel| |00002ee0| 65 63 74 28 29 7c 20 74 | 6f 20 66 69 6e 64 20 6f |ect()| t|o find o| |00002ef0| 75 74 20 69 66 0d 74 68 | 65 20 73 6f 63 6b 65 74 |ut if.th|e socket| |00002f00| 20 69 73 20 72 65 61 64 | 79 20 66 6f 72 20 7b 5c | is read|y for {\| |00002f10| 69 74 20 77 72 69 74 69 | 6e 67 7d 2e 0d 5c 6d 65 |it writi|ng}..\me| |00002f20| 64 73 6b 69 70 0d 45 72 | 72 6f 72 20 63 6f 64 65 |dskip.Er|ror code| |00002f30| 73 3a 0d 5c 6d 65 64 73 | 6b 69 70 5c 70 6c 61 69 |s:.\meds|kip\plai| |00002f40| 6e 74 77 6f 63 6f 6c 7b | 0d 7c 45 41 46 4e 4f 53 |ntwocol{|.|EAFNOS| |00002f50| 55 50 50 4f 52 54 7c 26 | 7c 6e 61 6d 65 7c 20 73 |UPPORT|&||name| s| |00002f60| 70 65 63 69 66 69 65 73 | 20 61 6e 20 69 6c 6c 65 |pecifies| an ille| |00002f70| 67 61 6c 20 61 64 64 72 | 65 73 73 20 66 61 6d 69 |gal addr|ess fami| |00002f80| 6c 79 20 66 6f 72 20 74 | 68 69 73 20 73 6f 63 6b |ly for t|his sock| |00002f90| 65 74 2e 5c 63 72 0d 7c | 45 49 53 43 4f 4e 4e 7c |et.\cr.||EISCONN|| |00002fa0| 26 54 68 65 20 73 6f 63 | 6b 65 74 20 69 73 20 61 |&The soc|ket is a| |00002fb0| 6c 72 65 61 64 79 20 63 | 6f 6e 6e 65 63 74 65 64 |lready c|onnected| |00002fc0| 2e 5c 63 72 0d 7c 45 41 | 44 44 52 4e 4f 41 56 41 |.\cr.|EA|DDRNOAVA| |00002fd0| 49 4c 7c 26 54 68 65 72 | 65 20 69 73 20 6e 6f 20 |IL|&Ther|e is no | |00002fe0| 73 6f 63 6b 65 74 20 77 | 69 74 68 20 74 68 65 20 |socket w|ith the | |00002ff0| 67 69 76 65 6e 20 61 64 | 64 72 65 73 73 2e 5c 63 |given ad|dress.\c| |00003000| 72 0d 7c 45 43 4f 4e 4e | 52 45 46 55 53 45 44 7c |r.|ECONN|REFUSED|| |00003010| 26 54 68 65 20 73 6f 63 | 6b 65 74 20 72 65 66 75 |&The soc|ket refu| |00003020| 73 65 64 20 74 68 65 20 | 63 6f 6e 6e 65 63 74 69 |sed the |connecti| |00003030| 6f 6e 2e 5c 63 72 0d 7c | 45 49 4e 50 52 4f 47 52 |on.\cr.||EINPROGR| |00003040| 45 53 53 7c 26 54 68 65 | 20 73 6f 63 6b 65 74 20 |ESS|&The| socket | |00003050| 69 73 20 6e 6f 6e 62 6c | 6f 63 6b 69 6e 67 20 61 |is nonbl|ocking a| |00003060| 6e 64 20 74 68 65 20 63 | 6f 6e 6e 65 63 74 69 6f |nd the c|onnectio| |00003070| 6e 20 69 73 20 62 65 69 | 6e 67 20 65 73 74 61 62 |n is bei|ng estab| |00003080| 6c 69 73 68 65 64 2e 5c | 63 72 0d 7d 0d 0d 40 2a |lished.\|cr.}..@*| |00003090| 32 20 54 72 61 6e 73 6d | 69 74 74 69 6e 67 20 64 |2 Transm|itting d| |000030a0| 61 74 61 20 62 65 74 77 | 65 65 6e 20 73 6f 63 6b |ata betw|een sock| |000030b0| 65 74 73 2e 20 59 6f 75 | 20 63 61 6e 20 77 72 69 |ets. You| can wri| |000030c0| 74 65 20 64 61 74 61 20 | 74 6f 20 61 20 73 6f 63 |te data |to a soc| |000030d0| 6b 65 74 20 75 73 69 6e | 67 20 7c 77 72 69 74 65 |ket usin|g |write| |000030e0| 28 29 7c 2c 0d 7c 77 72 | 69 74 65 76 28 29 7c 2c |()|,.|wr|itev()|,| |000030f0| 20 7c 73 65 6e 64 28 29 | 7c 2c 20 7c 73 65 6e 64 | |send()||, |send| |00003100| 74 6f 28 29 7c 2c 20 6f | 72 20 7c 73 65 6e 64 6d |to()|, o|r |sendm| |00003110| 73 67 28 29 7c 2e 20 59 | 6f 75 20 63 61 6e 20 72 |sg()|. Y|ou can r| |00003120| 65 61 64 20 64 61 74 61 | 20 66 72 6f 6d 20 61 20 |ead data| from a | |00003130| 73 6f 63 6b 65 74 0d 75 | 73 69 6e 67 20 7c 72 65 |socket.u|sing |re| |00003140| 61 64 28 29 7c 2c 20 7c | 72 65 61 64 76 28 29 7c |ad()|, ||readv()|| |00003150| 2c 20 7c 72 65 63 76 28 | 29 7c 2c 20 7c 72 65 63 |, |recv(|)|, |rec| |00003160| 76 66 72 6f 6d 28 29 7c | 2c 20 6f 72 20 7c 72 65 |vfrom()||, or |re| |00003170| 63 76 6d 73 67 28 29 7c | 2e 0d 0d 40 20 7c 69 6e |cvmsg()||...@ |in| |00003180| 74 20 72 65 61 64 28 69 | 6e 74 20 73 2c 20 63 68 |t read(i|nt s, ch| |00003190| 61 72 20 2a 62 75 66 66 | 65 72 2c 20 75 6e 73 69 |ar *buff|er, unsi| |000031a0| 67 6e 65 64 20 62 75 66 | 6c 65 6e 29 7c 20 72 65 |gned buf|len)| re| |000031b0| 61 64 73 20 75 70 20 74 | 6f 20 7c 62 75 66 6c 65 |ads up t|o |bufle| |000031c0| 6e 7c 20 62 79 74 65 73 | 20 66 72 6f 6d 0d 74 68 |n| bytes| from.th| |000031d0| 65 20 73 6f 63 6b 65 74 | 2e 20 7c 72 65 61 64 28 |e socket|. |read(| |000031e0| 29 7c 20 66 6f 72 20 73 | 6f 63 6b 65 74 73 20 64 |)| for s|ockets d| |000031f0| 69 66 66 65 72 73 20 66 | 72 6f 6d 20 7c 72 65 61 |iffers f|rom |rea| |00003200| 64 28 29 7c 20 66 6f 72 | 20 66 69 6c 65 73 20 6d |d()| for| files m| |00003210| 61 69 6e 6c 79 20 69 6e | 20 74 68 61 74 20 69 74 |ainly in| that it| |00003220| 0d 6d 61 79 20 72 65 61 | 64 20 66 65 77 65 72 20 |.may rea|d fewer | |00003230| 74 68 61 6e 20 74 68 65 | 20 72 65 71 75 65 73 74 |than the| request| |00003240| 65 64 20 6e 75 6d 62 65 | 72 20 6f 66 20 62 79 74 |ed numbe|r of byt| |00003250| 65 73 20 77 69 74 68 6f | 75 74 20 77 61 69 74 69 |es witho|ut waiti| |00003260| 6e 67 20 66 6f 72 20 74 | 68 65 20 72 65 73 74 20 |ng for t|he rest | |00003270| 74 6f 0d 61 72 72 69 76 | 65 2e 0d 5c 6d 65 64 73 |to.arriv|e..\meds| |00003280| 6b 69 70 0d 45 72 72 6f | 72 20 63 6f 64 65 73 3a |kip.Erro|r codes:| |00003290| 0d 5c 6d 65 64 73 6b 69 | 70 5c 70 6c 61 69 6e 74 |.\medski|p\plaint| |000032a0| 77 6f 63 6f 6c 7b 0d 7c | 45 57 4f 55 4c 44 42 4c |wocol{.||EWOULDBL| |000032b0| 4f 43 4b 7c 26 54 68 65 | 20 73 6f 63 6b 65 74 20 |OCK|&The| socket | |000032c0| 69 73 20 6e 6f 6e 62 6c | 6f 63 6b 69 6e 67 20 61 |is nonbl|ocking a| |000032d0| 6e 64 20 74 68 65 72 65 | 20 69 73 20 6e 6f 20 64 |nd there| is no d| |000032e0| 61 74 61 20 69 6d 6d 65 | 64 69 61 74 65 6c 79 20 |ata imme|diately | |000032f0| 61 76 61 69 6c 61 62 6c | 65 2e 5c 63 72 0d 7d 0d |availabl|e.\cr.}.| |00003300| 0d 40 20 7c 69 6e 74 20 | 72 65 61 64 76 28 69 6e |.@ |int |readv(in| |00003310| 74 20 73 2c 20 73 74 72 | 75 63 74 20 69 6f 76 65 |t s, str|uct iove| |00003320| 63 20 2a 69 6f 76 2c 20 | 69 6e 74 20 63 6f 75 6e |c *iov, |int coun| |00003330| 74 29 7c 20 70 65 72 66 | 6f 72 6d 73 20 74 68 65 |t)| perf|orms the| |00003340| 20 73 61 6d 65 0d 61 63 | 74 69 6f 6e 2c 20 62 75 | same.ac|tion, bu| |00003350| 74 20 73 63 61 74 74 65 | 72 73 20 74 68 65 20 69 |t scatte|rs the i| |00003360| 6e 70 75 74 20 64 61 74 | 61 20 69 6e 74 6f 20 74 |nput dat|a into t| |00003370| 68 65 20 7c 63 6f 75 6e | 74 7c 20 62 75 66 66 65 |he |coun|t| buffe| |00003380| 72 73 20 6f 66 20 74 68 | 65 20 7c 69 6f 76 7c ca |rs of th|e |iov|.| |00003390| 61 72 72 61 79 2c 20 61 | 6c 77 61 79 73 0d 66 69 |array, a|lways.fi| |000033a0| 6c 6c 69 6e 67 20 6f 6e | 65 20 62 75 66 66 65 72 |lling on|e buffer| |000033b0| 20 63 6f 6d 70 6c 65 74 | 65 6c 79 20 62 65 66 6f | complet|ely befo| |000033c0| 72 65 20 70 72 6f 63 65 | 65 64 69 6e 67 20 74 6f |re proce|eding to| |000033d0| 20 74 68 65 20 6e 65 78 | 74 2e 20 7c 69 6f 76 65 | the nex|t. |iove| |000033e0| 63 7c 20 69 73 20 64 65 | 66 69 6e 65 64 20 61 73 |c| is de|fined as| |000033f0| 0d 66 6f 6c 6c 6f 77 73 | 3a 0d 40 75 0d 73 74 72 |.follows|:.@u.str| |00003400| 75 63 74 20 69 6f 76 65 | 63 20 7b 0d 09 63 61 64 |uct iove|c {..cad| |00003410| 64 72 5f 74 09 69 6f 76 | 5f 62 61 73 65 3b 09 2f |dr_t.iov|_base;./| |00003420| 2a 20 41 64 64 72 65 73 | 73 20 6f 66 20 74 68 69 |* Addres|s of thi| |00003430| 73 20 62 75 66 66 65 72 | 20 2a 2f 0d 09 69 6e 74 |s buffer| */..int| |00003440| 09 69 6f 76 5f 6c 65 6e | 3b 09 09 09 2f 2a 20 4c |.iov_len|;.../* L| |00003450| 65 6e 67 74 68 20 6f 66 | 20 74 68 65 20 62 75 66 |ength of| the buf| |00003460| 66 65 72 20 2a 2f 0d 7d | 3b 0d 0d 40 20 7c 69 6e |fer */.}|;..@ |in| |00003470| 74 20 72 65 63 76 28 69 | 6e 74 20 73 2c 20 76 6f |t recv(i|nt s, vo| |00003480| 69 64 20 2a 62 75 66 66 | 65 72 2c 20 69 6e 74 20 |id *buff|er, int | |00003490| 62 75 66 6c 65 6e 2c 20 | 69 6e 74 20 66 6c 61 67 |buflen, |int flag| |000034a0| 73 29 7c 20 69 73 20 69 | 64 65 6e 74 69 63 61 6c |s)| is i|dentical| |000034b0| 20 74 6f 20 7c 72 65 61 | 64 28 29 7c 2c 0d 65 78 | to |rea|d()|,.ex| |000034c0| 63 65 70 74 20 66 6f 72 | 20 74 68 65 20 7c 66 6c |cept for| the |fl| |000034d0| 61 67 73 7c 20 70 61 72 | 61 6d 65 74 65 72 2e 20 |ags| par|ameter. | |000034e0| 49 66 20 74 68 65 20 7c | 4d 53 47 5f 4f 4f 42 7c |If the ||MSG_OOB|| |000034f0| 20 66 6c 61 67 20 69 73 | 20 73 65 74 20 66 6f 72 | flag is| set for| |00003500| 20 61 20 73 74 72 65 61 | 6d 20 73 6f 63 6b 65 74 | a strea|m socket| |00003510| 0d 74 68 61 74 20 73 75 | 70 70 6f 72 74 73 20 6f |.that su|pports o| |00003520| 75 74 2d 6f 66 2d 62 61 | 6e 64 20 64 61 74 61 2c |ut-of-ba|nd data,| |00003530| 20 7c 72 65 63 76 28 29 | 7c 20 72 65 61 64 73 20 | |recv()|| reads | |00003540| 6f 75 74 2d 6f 66 2d 62 | 61 6e 64 20 64 61 74 61 |out-of-b|and data| |00003550| 2e 0d 0d 40 20 7c 69 6e | 74 20 72 65 63 76 66 72 |...@ |in|t recvfr| |00003560| 6f 6d 28 69 6e 74 20 73 | 2c 20 76 6f 69 64 20 2a |om(int s|, void *| |00003570| 62 75 66 66 65 72 2c 20 | 69 6e 74 20 62 75 66 6c |buffer, |int bufl| |00003580| 65 6e 2c 20 69 6e 74 20 | 66 6c 61 67 73 2c 20 76 |en, int |flags, v| |00003590| 6f 69 64 20 2a 66 72 6f | 6d 2c 20 69 6e 74 20 2a |oid *fro|m, int *| |000035a0| 66 72 6f 6d 6c 65 6e 29 | 7c 0d 69 73 20 74 68 65 |fromlen)||.is the| |000035b0| 20 65 71 75 69 76 61 6c | 65 6e 74 20 6f 66 20 7c | equival|ent of || |000035c0| 72 65 63 76 28 29 7c 20 | 66 6f 72 20 75 6e 63 6f |recv()| |for unco| |000035d0| 6e 6e 65 63 74 65 64 20 | 64 61 74 61 67 72 61 6d |nnected |datagram| |000035e0| 20 73 6f 63 6b 65 74 73 | 2e 20 49 66 20 7c 66 72 | sockets|. If |fr| |000035f0| 6f 6d 7c 20 69 73 20 6e | 6f 74 0d 7c 4e 55 4c 4c |om| is n|ot.|NULL| |00003600| 7c 2c 20 69 74 20 77 69 | 6c 6c 20 62 65 20 73 65 ||, it wi|ll be se| |00003610| 74 20 74 6f 20 74 68 65 | 20 61 64 64 72 65 73 73 |t to the| address| |00003620| 20 6f 66 20 74 68 65 20 | 73 65 6e 64 65 72 20 6f | of the |sender o| |00003630| 66 20 74 68 65 20 6d 65 | 73 73 61 67 65 2e 0d 0d |f the me|ssage...| |00003640| 40 20 7c 69 6e 74 20 72 | 65 63 76 6d 73 67 28 69 |@ |int r|ecvmsg(i| |00003650| 6e 74 20 73 2c 20 73 74 | 72 75 63 74 20 6d 73 67 |nt s, st|ruct msg| |00003660| 68 64 72 20 2a 6d 73 67 | 2c 20 69 6e 74 20 66 6c |hdr *msg|, int fl| |00003670| 61 67 73 29 7c 20 69 73 | 20 74 68 65 20 6d 6f 73 |ags)| is| the mos| |00003680| 74 20 67 65 6e 65 72 61 | 6c 20 72 6f 75 74 69 6e |t genera|l routin| |00003690| 65 2c 0d 63 6f 6d 62 69 | 6e 69 6e 67 20 74 68 65 |e,.combi|ning the| |000036a0| 20 70 6f 73 73 69 62 69 | 6c 69 74 69 65 73 20 6f | possibi|lities o| |000036b0| 66 20 7c 72 65 61 64 76 | 28 29 7c 20 61 6e 64 20 |f |readv|()| and | |000036c0| 7c 72 65 63 76 66 72 6f | 6d 28 29 7c 2e 20 7c 6d ||recvfro|m()|. |m| |000036d0| 73 67 68 64 72 7c 20 69 | 73 20 64 65 66 69 6e 65 |sghdr| i|s define| |000036e0| 64 20 61 73 0d 66 6f 6c | 6c 6f 77 73 3a 0d 40 75 |d as.fol|lows:.@u| |000036f0| 0d 73 74 72 75 63 74 20 | 6d 73 67 68 64 72 20 7b |.struct |msghdr {| |00003700| 0d 09 63 61 64 64 72 5f | 74 09 6d 73 67 5f 6e 61 |..caddr_|t.msg_na| |00003710| 6d 65 3b 09 09 09 09 2f | 2a 20 4c 69 6b 65 20 7c |me;..../|* Like || |00003720| 66 72 6f 6d 7c 20 69 6e | 20 7c 72 65 63 76 66 72 |from| in| |recvfr| |00003730| 6f 6d 28 29 7c 20 2a 2f | 0d 09 69 6e 74 09 09 6d |om()| */|..int..m| |00003740| 73 67 5f 6e 61 6d 65 6c | 65 6e 3b 09 09 09 2f 2a |sg_namel|en;.../*| |00003750| 20 4c 69 6b 65 20 7c 66 | 72 6f 6d 6c 65 6e 7c 20 | Like |f|romlen| | |00003760| 69 6e 20 7c 72 65 63 76 | 66 72 6f 6d 28 29 7c 20 |in |recv|from()| | |00003770| 2a 2f 0d 09 73 74 72 75 | 63 74 09 69 6f 76 65 63 |*/..stru|ct.iovec| |00003780| 20 2a 6d 73 67 5f 69 6f | 76 3b 09 09 2f 2a 20 53 | *msg_io|v;../* S| |00003790| 63 61 74 74 65 72 2f 67 | 61 74 68 65 72 20 61 72 |catter/g|ather ar| |000037a0| 72 61 79 20 2a 2f 0d 09 | 69 6e 74 09 09 6d 73 67 |ray */..|int..msg| |000037b0| 5f 69 6f 76 6c 65 6e 3b | 09 09 09 09 2f 2a 20 4e |_iovlen;|..../* N| |000037c0| 75 6d 62 65 72 20 6f 66 | 20 65 6c 65 6d 65 6e 74 |umber of| element| |000037d0| 73 20 69 6e 20 7c 6d 73 | 67 5f 69 6f 76 7c 20 2a |s in |ms|g_iov| *| |000037e0| 2f 0d 09 63 61 64 64 72 | 5f 74 09 6d 73 67 5f 61 |/..caddr|_t.msg_a| |000037f0| 63 63 72 69 67 68 74 73 | 3b 09 09 09 2f 2a 20 41 |ccrights|;.../* A| |00003800| 63 63 65 73 73 20 72 69 | 67 68 74 73 20 73 65 6e |ccess ri|ghts sen| |00003810| 74 2f 72 65 63 65 69 76 | 65 64 2e 20 4e 6f 74 20 |t/receiv|ed. Not | |00003820| 75 73 65 64 20 69 6e 20 | 5c 2e 7b 47 55 53 49 7d |used in |\.{GUSI}| |00003830| 2a 2f 0d 09 69 6e 74 09 | 09 6d 73 67 5f 61 63 63 |*/..int.|.msg_acc| |00003840| 72 69 67 68 74 73 6c 65 | 6e 3b 0d 7d 3b 0d 0d 40 |rightsle|n;.};..@| |00003850| 20 7c 69 6e 74 20 77 72 | 69 74 65 28 69 6e 74 20 | |int wr|ite(int | |00003860| 73 2c 20 63 68 61 72 20 | 2a 62 75 66 66 65 72 2c |s, char |*buffer,| |00003870| 20 75 6e 73 69 67 6e 65 | 64 20 62 75 66 6c 65 6e | unsigne|d buflen| |00003880| 29 7c 20 77 72 69 74 65 | 73 20 75 70 20 74 6f 20 |)| write|s up to | |00003890| 7c 62 75 66 6c 65 6e 7c | 20 62 79 74 65 73 20 74 ||buflen|| bytes t| |000038a0| 6f 0d 74 68 65 20 73 6f | 63 6b 65 74 2e 20 41 73 |o.the so|cket. As| |000038b0| 20 6f 70 70 6f 73 65 64 | 20 74 6f 20 7c 72 65 61 | opposed| to |rea| |000038c0| 64 28 29 7c 2c 20 7c 77 | 72 69 74 65 28 29 7c 20 |d()|, |w|rite()| | |000038d0| 66 6f 72 20 6e 6f 6e 62 | 6c 6f 63 6b 69 6e 67 20 |for nonb|locking | |000038e0| 73 6f 63 6b 65 74 73 20 | 61 6c 77 61 79 73 20 62 |sockets |always b| |000038f0| 6c 6f 63 6b 73 0d 75 6e | 74 69 6c 20 61 6c 6c 20 |locks.un|til all | |00003900| 62 79 74 65 73 20 61 72 | 65 20 77 72 69 74 74 65 |bytes ar|e writte| |00003910| 6e 20 6f 72 20 61 6e 20 | 65 72 72 6f 72 20 6f 63 |n or an |error oc| |00003920| 63 75 72 73 2e 0d 0d 5c | 6d 65 64 73 6b 69 70 0d |curs...\|medskip.| |00003930| 45 72 72 6f 72 20 63 6f | 64 65 73 3a 0d 5c 6d 65 |Error co|des:.\me| |00003940| 64 73 6b 69 70 5c 70 6c | 61 69 6e 74 77 6f 63 6f |dskip\pl|aintwoco| |00003950| 6c 7b 0d 7c 45 57 4f 55 | 4c 44 42 4c 4f 43 4b 7c |l{.|EWOU|LDBLOCK|| |00003960| 26 54 68 65 20 73 6f 63 | 6b 65 74 20 69 73 20 6e |&The soc|ket is n| |00003970| 6f 6e 62 6c 6f 63 6b 69 | 6e 67 20 61 6e 64 20 64 |onblocki|ng and d| |00003980| 61 74 61 20 63 61 6e 27 | 74 20 62 65 20 69 6d 6d |ata can'|t be imm| |00003990| 65 64 69 61 74 65 6c 79 | 20 77 72 69 74 74 65 6e |ediately| written| |000039a0| 2e 5c 63 72 0d 7d 0d 0d | 40 20 7c 69 6e 74 20 77 |.\cr.}..|@ |int w| |000039b0| 72 69 74 65 76 28 69 6e | 74 20 73 2c 20 73 74 72 |ritev(in|t s, str| |000039c0| 75 63 74 20 69 6f 76 65 | 63 20 2a 69 6f 76 2c 20 |uct iove|c *iov, | |000039d0| 69 6e 74 20 63 6f 75 6e | 74 29 7c 20 70 65 72 66 |int coun|t)| perf| |000039e0| 6f 72 6d 73 20 74 68 65 | 20 73 61 6d 65 0d 61 63 |orms the| same.ac| |000039f0| 74 69 6f 6e 2c 20 62 75 | 74 20 67 61 74 68 65 72 |tion, bu|t gather| |00003a00| 73 20 74 68 65 20 6f 75 | 74 70 75 74 20 64 61 74 |s the ou|tput dat| |00003a10| 61 20 66 72 6f 6d 20 74 | 68 65 20 7c 63 6f 75 6e |a from t|he |coun| |00003a20| 74 7c 20 62 75 66 66 65 | 72 73 20 6f 66 20 74 68 |t| buffe|rs of th| |00003a30| 65 20 7c 69 6f 76 7c ca | 61 72 72 61 79 2c 20 61 |e |iov|.|array, a| |00003a40| 6c 77 61 79 73 0d 73 65 | 6e 64 69 6e 67 20 6f 6e |lways.se|nding on| |00003a50| 65 20 62 75 66 66 65 72 | 20 63 6f 6d 70 6c 65 74 |e buffer| complet| |00003a60| 65 6c 79 20 62 65 66 6f | 72 65 20 70 72 6f 63 65 |ely befo|re proce| |00003a70| 65 64 69 6e 67 20 74 6f | 20 74 68 65 20 6e 65 78 |eding to| the nex| |00003a80| 74 2e 0d 0d 40 20 7c 69 | 6e 74 20 73 65 6e 64 28 |t...@ |i|nt send(| |00003a90| 69 6e 74 20 73 2c 20 76 | 6f 69 64 20 2a 62 75 66 |int s, v|oid *buf| |00003aa0| 66 65 72 2c 20 69 6e 74 | 20 62 75 66 6c 65 6e 2c |fer, int| buflen,| |00003ab0| 20 69 6e 74 20 66 6c 61 | 67 73 29 7c 20 69 73 20 | int fla|gs)| is | |00003ac0| 69 64 65 6e 74 69 63 61 | 6c 20 74 6f 20 7c 77 72 |identica|l to |wr| |00003ad0| 69 74 65 28 29 7c 2c 0d | 65 78 63 65 70 74 20 66 |ite()|,.|except f| |00003ae0| 6f 72 20 74 68 65 20 7c | 66 6c 61 67 73 7c 20 70 |or the ||flags| p| |00003af0| 61 72 61 6d 65 74 65 72 | 2e 20 49 66 20 74 68 65 |arameter|. If the| |00003b00| 20 7c 4d 53 47 5f 4f 4f | 42 7c 20 66 6c 61 67 20 | |MSG_OO|B| flag | |00003b10| 69 73 20 73 65 74 20 66 | 6f 72 20 61 20 73 74 72 |is set f|or a str| |00003b20| 65 61 6d 20 73 6f 63 6b | 65 74 0d 74 68 61 74 20 |eam sock|et.that | |00003b30| 73 75 70 70 6f 72 74 73 | 20 6f 75 74 2d 6f 66 2d |supports| out-of-| |00003b40| 62 61 6e 64 20 64 61 74 | 61 2c 20 7c 73 65 6e 64 |band dat|a, |send| |00003b50| 28 29 7c 20 73 65 6e 64 | 73 20 61 6e 20 6f 75 74 |()| send|s an out| |00003b60| 2d 6f 66 2d 62 61 6e 64 | 20 6d 65 73 73 61 67 65 |-of-band| message| |00003b70| 2e 0d 0d 40 20 7c 69 6e | 74 20 73 65 6e 64 74 6f |...@ |in|t sendto| |00003b80| 28 69 6e 74 20 73 2c 20 | 76 6f 69 64 20 2a 62 75 |(int s, |void *bu| |00003b90| 66 66 65 72 2c 20 69 6e | 74 20 62 75 66 6c 65 6e |ffer, in|t buflen| |00003ba0| 2c 20 69 6e 74 20 66 6c | 61 67 73 2c 20 76 6f 69 |, int fl|ags, voi| |00003bb0| 64 20 2a 74 6f 2c 20 69 | 6e 74 20 2a 74 6f 6c 65 |d *to, i|nt *tole| |00003bc0| 6e 29 7c 0d 69 73 20 74 | 68 65 20 65 71 75 69 76 |n)|.is t|he equiv| |00003bd0| 61 6c 65 6e 74 20 6f 66 | 20 7c 73 65 6e 64 28 29 |alent of| |send()| |00003be0| 7c 20 66 6f 72 20 75 6e | 63 6f 6e 6e 65 63 74 65 || for un|connecte| |00003bf0| 64 20 64 61 74 61 67 72 | 61 6d 20 73 6f 63 6b 65 |d datagr|am socke| |00003c00| 74 73 2e 20 54 68 65 20 | 6d 65 73 73 61 67 65 20 |ts. The |message | |00003c10| 77 69 6c 6c 0d 62 65 20 | 73 65 6e 74 20 74 6f 20 |will.be |sent to | |00003c20| 74 68 65 20 73 6f 63 6b | 65 74 20 77 68 6f 73 65 |the sock|et whose| |00003c30| 20 61 64 64 72 65 73 73 | 20 69 73 20 67 69 76 65 | address| is give| |00003c40| 6e 20 69 6e 20 7c 74 6f | 7c 2e 0d 0d 40 20 7c 69 |n in |to||...@ |i| |00003c50| 6e 74 20 73 65 6e 64 6d | 73 67 28 69 6e 74 20 73 |nt sendm|sg(int s| |00003c60| 2c 20 73 74 72 75 63 74 | 20 6d 73 67 68 64 72 20 |, struct| msghdr | |00003c70| 2a 6d 73 67 2c 20 69 6e | 74 20 66 6c 61 67 73 29 |*msg, in|t flags)| |00003c80| 7c 20 63 6f 6d 62 69 6e | 65 73 20 74 68 65 20 70 || combin|es the p| |00003c90| 6f 73 73 69 62 69 6c 69 | 74 69 65 73 0d 6f 66 20 |ossibili|ties.of | |00003ca0| 7c 77 72 69 74 65 76 28 | 29 7c 20 61 6e 64 20 7c ||writev(|)| and || |00003cb0| 73 65 6e 64 74 6f 28 29 | 7c 2e 0d 0d 40 2a 32 20 |sendto()||...@*2 | |00003cc0| 49 2f 4f 20 6d 75 6c 74 | 69 70 6c 65 78 69 6e 67 |I/O mult|iplexing| |00003cd0| 2e 0d 0d 40 20 7c 69 6e | 74 20 73 65 6c 65 63 74 |...@ |in|t select| |00003ce0| 28 69 6e 74 20 77 69 64 | 74 68 2c 20 66 64 5f 73 |(int wid|th, fd_s| |00003cf0| 65 74 20 2a 72 65 61 64 | 66 64 73 2c 20 66 64 5f |et *read|fds, fd_| |00003d00| 73 65 74 20 2a 77 72 69 | 74 65 66 64 73 2c 0d 66 |set *wri|tefds,.f| |00003d10| 64 5f 73 65 74 20 2a 65 | 78 63 65 70 74 66 64 73 |d_set *e|xceptfds| |00003d20| 2c 20 73 74 72 75 63 74 | 20 74 69 6d 65 76 61 6c |, struct| timeval| |00003d30| 20 2a 74 69 6d 65 6f 75 | 74 29 7c 20 65 78 61 6d | *timeou|t)| exam| |00003d40| 69 6e 65 73 20 74 68 65 | 20 49 2f 4f 20 64 65 73 |ines the| I/O des| |00003d50| 63 72 69 70 74 6f 72 73 | 20 73 70 65 63 69 66 69 |criptors| specifi| |00003d60| 65 64 0d 62 79 20 74 68 | 65 20 62 69 74 20 6d 61 |ed.by th|e bit ma| |00003d70| 73 6b 73 20 7c 72 65 61 | 64 66 73 7c 2c 20 7c 77 |sks |rea|dfs|, |w| |00003d80| 72 69 74 65 66 73 7c 2c | 20 61 6e 64 20 7c 65 78 |ritefs|,| and |ex| |00003d90| 63 65 70 74 66 73 7c 20 | 74 6f 20 73 65 65 20 69 |ceptfs| |to see i| |00003da0| 66 20 74 68 65 79 20 61 | 72 65 20 72 65 61 64 79 |f they a|re ready| |00003db0| 20 66 6f 72 0d 72 65 61 | 64 69 6e 67 2c 20 77 72 | for.rea|ding, wr| |00003dc0| 69 74 69 6e 67 2c 20 6f | 72 20 68 61 76 65 20 61 |iting, o|r have a| |00003dd0| 6e 20 65 78 63 65 70 74 | 69 6f 6e 20 70 65 6e 64 |n except|ion pend| |00003de0| 69 6e 67 2e 20 7c 77 69 | 64 74 68 7c 20 69 73 20 |ing. |wi|dth| is | |00003df0| 74 68 65 20 6e 75 6d 62 | 65 72 20 6f 66 20 73 69 |the numb|er of si| |00003e00| 67 6e 69 66 69 63 61 6e | 74 0d 62 69 74 73 20 69 |gnifican|t.bits i| |00003e10| 6e 20 74 68 65 20 62 69 | 74 20 6d 61 73 6b 2e 20 |n the bi|t mask. | |00003e20| 7c 73 65 6c 65 63 74 28 | 29 7c 20 72 65 70 6c 61 ||select(|)| repla| |00003e30| 63 65 73 20 74 68 65 20 | 62 69 74 20 6d 61 73 6b |ces the |bit mask| |00003e40| 73 20 77 69 74 68 20 6d | 61 73 6b 73 20 6f 66 20 |s with m|asks of | |00003e50| 74 68 6f 73 65 20 64 65 | 73 63 72 69 70 74 6f 72 |those de|scriptor| |00003e60| 73 0d 77 68 69 63 68 20 | 61 72 65 20 72 65 61 64 |s.which |are read| |00003e70| 79 20 61 6e 64 20 72 65 | 74 75 72 6e 73 20 74 68 |y and re|turns th| |00003e80| 65 20 74 6f 74 61 6c 20 | 6e 75 6d 62 65 72 20 6f |e total |number o| |00003e90| 66 20 72 65 61 64 79 20 | 64 65 73 63 72 69 70 74 |f ready |descript| |00003ea0| 6f 72 73 2e 20 7c 74 69 | 6d 65 6f 75 74 7c 2c 20 |ors. |ti|meout|, | |00003eb0| 69 66 0d 6e 6f 74 20 7c | 4e 55 4c 4c 7c 2c 20 73 |if.not ||NULL|, s| |00003ec0| 70 65 63 69 66 69 65 73 | 20 74 68 65 20 6d 61 78 |pecifies| the max| |00003ed0| 69 6d 75 6d 20 74 69 6d | 65 20 74 6f 20 77 61 69 |imum tim|e to wai| |00003ee0| 74 20 66 6f 72 20 61 20 | 64 65 73 63 72 69 70 74 |t for a |descript| |00003ef0| 6f 72 20 74 6f 20 62 65 | 63 6f 6d 65 20 72 65 61 |or to be|come rea| |00003f00| 64 79 2e 20 49 66 0d 7c | 74 69 6d 65 6f 75 74 7c |dy. If.||timeout|| |00003f10| 20 69 73 20 7c 4e 55 4c | 4c 7c 2c 20 7c 73 65 6c | is |NUL|L|, |sel| |00003f20| 65 63 74 28 29 7c 20 77 | 61 69 74 73 20 69 6e 64 |ect()| w|aits ind| |00003f30| 65 66 69 6e 69 74 65 6c | 79 2e 20 54 6f 20 64 6f |efinitel|y. To do| |00003f40| 20 61 20 70 6f 6c 6c 2c | 20 70 61 73 73 20 61 20 | a poll,| pass a | |00003f50| 70 6f 69 6e 74 65 72 20 | 74 6f 0d 61 20 7a 65 72 |pointer |to.a zer| |00003f60| 6f 20 7c 74 69 6d 65 76 | 61 6c 7c 20 76 61 6c 75 |o |timev|al| valu| |00003f70| 65 20 69 6e 20 7c 74 69 | 6d 65 6f 75 74 7c 2e 20 |e in |ti|meout|. | |00003f80| 41 6e 79 20 6f 66 20 7c | 72 65 61 64 66 64 73 7c |Any of ||readfds|| |00003f90| 2c 20 7c 77 72 69 74 65 | 66 64 73 7c 2c 20 6f 72 |, |write|fds|, or| |00003fa0| 20 7c 65 78 63 65 70 74 | 66 64 73 7c 0d 6d 61 79 | |except|fds|.may| |00003fb0| 20 62 65 20 67 69 76 65 | 6e 20 61 73 20 7c 4e 55 | be give|n as |NU| |00003fc0| 4c 4c 7c 20 69 66 20 6e | 6f 20 64 65 73 63 72 69 |LL| if n|o descri| |00003fd0| 70 74 6f 72 73 20 61 72 | 65 20 6f 66 20 69 6e 74 |ptors ar|e of int| |00003fe0| 65 72 65 73 74 2e 0d 5c | 6d 65 64 73 6b 69 70 0d |erest..\|medskip.| |00003ff0| 45 72 72 6f 72 20 63 6f | 64 65 73 3a 0d 5c 6d 65 |Error co|des:.\me| |00004000| 64 73 6b 69 70 5c 70 6c | 61 69 6e 74 77 6f 63 6f |dskip\pl|aintwoco| |00004010| 6c 7b 0d 7c 45 42 41 44 | 46 7c 26 4f 6e 65 20 6f |l{.|EBAD|F|&One o| |00004020| 66 20 74 68 65 20 62 69 | 74 20 6d 61 73 6b 73 20 |f the bi|t masks | |00004030| 73 70 65 63 69 66 69 65 | 64 20 61 6e 20 69 6e 76 |specifie|d an inv| |00004040| 61 6c 69 64 20 64 65 73 | 63 72 69 70 74 6f 72 2e |alid des|criptor.| |00004050| 5c 63 72 0d 7d 0d 0d 40 | 20 54 68 65 20 64 65 73 |\cr.}..@| The des| |00004060| 63 72 69 70 74 6f 72 20 | 62 69 74 20 6d 61 73 6b |criptor |bit mask| |00004070| 73 20 63 61 6e 20 62 65 | 20 6d 61 6e 69 70 75 6c |s can be| manipul| |00004080| 61 74 65 64 20 77 69 74 | 68 20 74 68 65 20 66 6f |ated wit|h the fo| |00004090| 6c 6c 6f 77 69 6e 67 20 | 6d 61 63 72 6f 73 3a 0d |llowing |macros:.| |000040a0| 0d 40 75 0d 46 44 5f 5a | 45 52 4f 28 66 64 73 29 |.@u.FD_Z|ERO(fds)| |000040b0| 3b 09 09 2f 2a 20 43 6c | 65 61 72 20 61 6c 6c 20 |;../* Cl|ear all | |000040c0| 62 69 74 73 20 69 6e 20 | 7c 2a 66 64 73 7c 20 2a |bits in ||*fds| *| |000040d0| 2f 0d 46 44 5f 53 45 54 | 28 6e 2c 20 66 64 73 29 |/.FD_SET|(n, fds)| |000040e0| 3b 09 2f 2a 20 53 65 74 | 20 62 69 74 20 7c 6e 7c |;./* Set| bit |n|| |000040f0| 20 69 6e 20 7c 2a 66 64 | 73 7c 20 2a 2f 0d 46 44 | in |*fd|s| */.FD| |00004100| 5f 43 4c 52 28 6e 2c 20 | 66 64 73 29 3b 09 2f 2a |_CLR(n, |fds);./*| |00004110| 20 43 6c 65 61 72 20 62 | 69 74 20 7c 6e 7c 20 69 | Clear b|it |n| i| |00004120| 6e 20 7c 2a 66 64 73 7c | 20 2a 2f 0d 46 44 5f 49 |n |*fds|| */.FD_I| |00004130| 53 53 45 54 28 6e 2c 20 | 66 64 73 29 3b 09 2f 2a |SSET(n, |fds);./*| |00004140| 20 52 65 74 75 72 6e 20 | 7c 31 7c 20 69 66 20 62 | Return ||1| if b| |00004150| 69 74 20 7c 6e 7c 20 69 | 6e 20 7c 2a 66 64 73 7c |it |n| i|n |*fds|| |00004160| 20 69 73 20 73 65 74 2c | 20 65 6c 73 65 20 7c 30 | is set,| else |0| |00004170| 7c 20 2a 2f 0d 0d 40 2a | 32 20 47 65 74 74 69 6e || */..@*|2 Gettin| |00004180| 67 20 61 6e 64 20 63 68 | 61 6e 67 69 6e 67 20 70 |g and ch|anging p| |00004190| 72 6f 70 65 72 74 69 65 | 73 20 6f 66 20 73 6f 63 |ropertie|s of soc| |000041a0| 6b 65 74 73 2e 20 59 6f | 75 20 63 61 6e 20 6f 62 |kets. Yo|u can ob| |000041b0| 74 61 69 6e 20 74 68 65 | 20 61 64 64 72 65 73 73 |tain the| address| |000041c0| 20 6f 66 20 61 0d 73 6f | 63 6b 65 74 20 61 6e 64 | of a.so|cket and| |000041d0| 20 74 68 65 20 73 6f 63 | 6b 65 74 20 69 74 20 69 | the soc|ket it i| |000041e0| 73 20 63 6f 6e 6e 65 63 | 74 65 64 20 74 6f 20 62 |s connec|ted to b| |000041f0| 79 20 63 61 6c 6c 69 6e | 67 20 7c 67 65 74 73 6f |y callin|g |getso| |00004200| 63 6b 6e 61 6d 65 28 29 | 7c 20 61 6e 64 0d 7c 67 |ckname()|| and.|g| |00004210| 65 74 70 65 65 72 6e 61 | 6d 65 28 29 7c 20 72 65 |etpeerna|me()| re| |00004220| 73 70 65 63 74 69 76 65 | 6c 79 2e 20 59 6f 75 20 |spective|ly. You | |00004230| 63 61 6e 20 71 75 65 72 | 79 20 61 6e 64 20 6d 61 |can quer|y and ma| |00004240| 6e 69 70 75 6c 61 74 65 | 20 6f 74 68 65 72 20 70 |nipulate| other p| |00004250| 72 6f 70 65 72 74 69 65 | 73 20 6f 66 20 61 0d 73 |ropertie|s of a.s| |00004260| 6f 63 6b 65 74 20 62 79 | 20 63 61 6c 6c 69 6e 67 |ocket by| calling| |00004270| 20 7c 69 6f 63 74 6c 28 | 29 7c 2c 20 7c 66 63 6e | |ioctl(|)|, |fcn| |00004280| 74 6c 28 29 7c 2c 20 7c | 67 65 74 73 6f 63 6b 6f |tl()|, ||getsocko| |00004290| 70 74 28 29 7c 2c 20 61 | 6e 64 20 7c 73 65 74 73 |pt()|, a|nd |sets| |000042a0| 6f 63 6b 6f 70 74 28 29 | 7c 2e 20 59 6f 75 0d 63 |ockopt()||. You.c| |000042b0| 61 6e 20 63 72 65 61 74 | 65 20 61 64 64 69 74 69 |an creat|e additi| |000042c0| 6f 6e 61 6c 20 64 65 73 | 63 72 69 70 74 6f 72 73 |onal des|criptors| |000042d0| 20 66 6f 72 20 61 20 73 | 6f 63 6b 65 74 20 62 79 | for a s|ocket by| |000042e0| 20 63 61 6c 6c 69 6e 67 | 20 7c 64 75 70 28 29 7c | calling| |dup()|| |000042f0| 20 6f 72 20 7c 64 75 70 | 32 28 29 7c 2e 0d 0d 40 | or |dup|2()|...@| |00004300| 20 7c 69 6e 74 20 67 65 | 74 73 6f 63 6b 6e 61 6d | |int ge|tsocknam| |00004310| 65 28 69 6e 74 20 73 2c | 20 76 6f 69 64 20 2a 6e |e(int s,| void *n| |00004320| 61 6d 65 2c 20 69 6e 74 | 20 2a 6e 61 6d 65 6c 65 |ame, int| *namele| |00004330| 6e 29 7c 20 72 65 74 75 | 72 6e 73 20 69 6e 20 7c |n)| retu|rns in || |00004340| 2a 6e 61 6d 65 7c 20 74 | 68 65 20 61 64 64 72 65 |*name| t|he addre| |00004350| 73 73 0d 74 68 65 20 73 | 6f 63 6b 65 74 20 69 73 |ss.the s|ocket is| |00004360| 20 62 6f 75 6e 64 20 74 | 6f 2e 20 7c 2a 6e 61 6d | bound t|o. |*nam| |00004370| 65 6c 65 6e 7c 20 73 68 | 6f 75 6c 64 20 62 65 20 |elen| sh|ould be | |00004380| 73 65 74 20 74 6f 20 74 | 68 65 20 6d 61 78 69 6d |set to t|he maxim| |00004390| 75 6d 20 6c 65 6e 67 74 | 68 20 6f 66 20 7c 2a 6e |um lengt|h of |*n| |000043a0| 61 6d 65 7c 20 61 6e 64 | 0d 77 69 6c 6c 20 62 65 |ame| and|.will be| |000043b0| 20 73 65 74 20 62 79 20 | 7c 67 65 74 73 6f 63 6b | set by ||getsock| |000043c0| 6e 61 6d 65 28 29 7c 20 | 74 6f 20 74 68 65 20 61 |name()| |to the a| |000043d0| 63 74 75 61 6c 20 6c 65 | 6e 67 74 68 20 6f 66 20 |ctual le|ngth of | |000043e0| 74 68 65 20 6e 61 6d 65 | 2e 0d 0d 40 20 7c 69 6e |the name|...@ |in| |000043f0| 74 20 67 65 74 70 65 65 | 72 6e 61 6d 65 28 69 6e |t getpee|rname(in| |00004400| 74 20 73 2c 20 76 6f 69 | 64 20 2a 6e 61 6d 65 2c |t s, voi|d *name,| |00004410| 20 69 6e 74 20 2a 6e 61 | 6d 65 6c 65 6e 29 7c 20 | int *na|melen)| | |00004420| 72 65 74 75 72 6e 73 20 | 69 6e 20 7c 2a 6e 61 6d |returns |in |*nam| |00004430| 65 7c 20 74 68 65 20 61 | 64 64 72 65 73 73 0d 6f |e| the a|ddress.o| |00004440| 66 20 74 68 65 20 73 6f | 63 6b 65 74 20 74 68 61 |f the so|cket tha| |00004450| 74 20 74 68 69 73 20 73 | 6f 63 6b 65 74 20 69 73 |t this s|ocket is| |00004460| 20 63 6f 6e 6e 65 63 74 | 65 64 20 74 6f 2e 20 7c | connect|ed to. || |00004470| 2a 6e 61 6d 65 6c 65 6e | 7c 20 73 68 6f 75 6c 64 |*namelen|| should| |00004480| 20 62 65 20 73 65 74 20 | 74 6f 20 74 68 65 0d 6d | be set |to the.m| |00004490| 61 78 69 6d 75 6d 20 6c | 65 6e 67 74 68 20 6f 66 |aximum l|ength of| |000044a0| 20 7c 2a 6e 61 6d 65 7c | 20 61 6e 64 20 77 69 6c | |*name|| and wil| |000044b0| 6c 20 62 65 20 73 65 74 | 20 62 79 20 7c 67 65 74 |l be set| by |get| |000044c0| 70 65 65 72 6e 61 6d 65 | 28 29 7c 20 74 6f 20 74 |peername|()| to t| |000044d0| 68 65 20 61 63 74 75 61 | 6c 20 6c 65 6e 67 74 68 |he actua|l length| |000044e0| 0d 6f 66 20 74 68 65 20 | 6e 61 6d 65 2e 0d 0d 40 |.of the |name...@| |000044f0| 20 7c 69 6e 74 20 69 6f | 63 74 6c 28 69 6e 74 20 | |int io|ctl(int | |00004500| 64 2c 20 75 6e 73 69 67 | 6e 65 64 20 69 6e 74 20 |d, unsig|ned int | |00004510| 72 65 71 75 65 73 74 2c | 20 6c 6f 6e 67 20 2a 61 |request,| long *a| |00004520| 72 67 70 29 7c 20 70 65 | 72 66 6f 72 6d 73 20 76 |rgp)| pe|rforms v| |00004530| 61 72 69 6f 75 73 20 6f | 70 65 72 61 74 69 6f 6e |arious o|peration| |00004540| 73 0d 6f 6e 20 74 68 65 | 20 73 6f 63 6b 65 74 2c |s.on the| socket,| |00004550| 20 64 65 70 65 6e 64 69 | 6e 67 20 6f 6e 20 74 68 | dependi|ng on th| |00004560| 65 20 7c 72 65 71 75 65 | 73 74 7c 2e 20 54 68 65 |e |reque|st|. The| |00004570| 20 66 6f 6c 6c 6f 77 69 | 6e 67 20 63 6f 64 65 73 | followi|ng codes| |00004580| 20 61 72 65 20 76 61 6c | 69 64 20 66 6f 72 20 61 | are val|id for a| |00004590| 6c 6c 0d 73 6f 63 6b 65 | 74 20 66 61 6d 69 6c 69 |ll.socke|t famili| |000045a0| 65 73 3a 0d 5c 6d 65 64 | 73 6b 69 70 5c 70 6c 61 |es:.\med|skip\pla| |000045b0| 69 6e 74 77 6f 63 6f 6c | 7b 0d 7c 46 49 4f 4e 42 |intwocol|{.|FIONB| |000045c0| 49 4f 7c 26 4d 61 6b 65 | 20 74 68 65 20 73 6f 63 |IO|&Make| the soc| |000045d0| 6b 65 74 20 62 6c 6f 63 | 6b 69 6e 67 20 69 66 20 |ket bloc|king if | |000045e0| 74 68 65 20 7c 6c 6f 6e | 67 7c 20 70 6f 69 6e 74 |the |lon|g| point| |000045f0| 65 64 20 74 6f 20 62 79 | 20 61 72 67 70 20 69 73 |ed to by| argp is| |00004600| 20 7c 30 7c 2c 20 65 6c | 73 65 0d 6d 61 6b 65 20 | |0|, el|se.make | |00004610| 69 74 20 6e 6f 6e 62 6c | 6f 63 6b 69 6e 67 2e 5c |it nonbl|ocking.\| |00004620| 63 72 0d 7c 46 49 4f 4e | 52 45 41 44 7c 26 53 65 |cr.|FION|READ|&Se| |00004630| 74 20 7c 2a 61 72 67 70 | 7c 20 74 6f 20 74 68 65 |t |*argp|| to the| |00004640| 20 6e 75 6d 62 65 72 20 | 6f 66 20 62 79 74 65 73 | number |of bytes| |00004650| 20 77 61 69 74 69 6e 67 | 20 74 6f 20 62 65 20 72 | waiting| to be r| |00004660| 65 61 64 2e 5c 63 72 0d | 7d 0d 5c 6d 65 64 73 6b |ead.\cr.|}.\medsk| |00004670| 69 70 0d 45 72 72 6f 72 | 20 63 6f 64 65 73 3a 0d |ip.Error| codes:.| |00004680| 5c 6d 65 64 73 6b 69 70 | 5c 70 6c 61 69 6e 74 77 |\medskip|\plaintw| |00004690| 6f 63 6f 6c 7b 0d 7c 45 | 4f 50 4e 4f 54 53 55 50 |ocol{.|E|OPNOTSUP| |000046a0| 50 7c 26 54 68 65 20 6f | 70 65 72 61 74 69 6f 6e |P|&The o|peration| |000046b0| 20 79 6f 75 20 72 65 71 | 75 65 73 74 65 64 20 77 | you req|uested w| |000046c0| 69 74 68 20 7c 72 65 71 | 75 65 73 74 7c 20 69 73 |ith |req|uest| is| |000046d0| 20 6e 6f 74 20 73 75 70 | 70 6f 72 74 65 64 20 62 | not sup|ported b| |000046e0| 79 20 74 68 69 73 0d 73 | 6f 63 6b 65 74 20 66 61 |y this.s|ocket fa| |000046f0| 6d 69 6c 79 2e 5c 63 72 | 0d 7d 0d 0d 40 20 7c 69 |mily.\cr|.}..@ |i| |00004700| 6e 74 20 66 63 6e 74 6c | 28 69 6e 74 20 73 2c 20 |nt fcntl|(int s, | |00004710| 75 6e 73 69 67 6e 65 64 | 20 69 6e 74 20 63 6d 64 |unsigned| int cmd| |00004720| 2c 20 69 6e 74 20 61 72 | 67 29 7c 20 70 72 6f 76 |, int ar|g)| prov| |00004730| 69 64 65 73 20 61 64 64 | 69 74 69 6f 6e 61 6c 20 |ides add|itional | |00004740| 63 6f 6e 74 72 6f 6c 20 | 6f 76 65 72 20 61 0d 73 |control |over a.s| |00004750| 6f 63 6b 65 74 2e 20 54 | 68 65 20 66 6f 6c 6c 6f |ocket. T|he follo| |00004760| 77 69 6e 67 20 76 61 6c | 75 65 73 20 6f 66 20 7c |wing val|ues of || |00004770| 63 6d 64 7c 20 61 72 65 | 20 64 65 66 69 6e 65 64 |cmd| are| defined| |00004780| 20 66 6f 72 20 61 6c 6c | 20 73 6f 63 6b 65 74 20 | for all| socket | |00004790| 66 61 6d 69 6c 69 65 73 | 3a 0d 5c 6d 65 64 73 6b |families|:.\medsk| |000047a0| 69 70 5c 70 6c 61 69 6e | 74 77 6f 63 6f 6c 7b 0d |ip\plain|twocol{.| |000047b0| 7c 46 5f 44 55 50 46 44 | 7c 26 52 65 74 75 72 6e ||F_DUPFD||&Return| |000047c0| 20 61 20 6e 65 77 20 64 | 65 73 63 72 69 70 74 6f | a new d|escripto| |000047d0| 72 20 24 5c 67 65 24 20 | 7c 61 72 67 7c 20 77 68 |r $\ge$ ||arg| wh| |000047e0| 69 63 68 20 72 65 66 65 | 72 73 20 74 6f 20 74 68 |ich refe|rs to th| |000047f0| 65 20 73 61 6d 65 20 73 | 6f 63 6b 65 74 2e 5c 63 |e same s|ocket.\c| |00004800| 72 0d 7c 46 5f 47 45 54 | 46 4c 7c 26 52 65 74 75 |r.|F_GET|FL|&Retu| |00004810| 72 6e 20 64 65 73 63 72 | 69 70 74 6f 72 20 73 74 |rn descr|iptor st| |00004820| 61 74 75 73 20 66 6c 61 | 67 73 2e 5c 63 72 0d 7c |atus fla|gs.\cr.|| |00004830| 46 5f 53 45 54 46 4c 7c | 26 53 65 74 20 64 65 73 |F_SETFL||&Set des| |00004840| 63 72 69 70 74 6f 72 20 | 73 74 61 74 75 73 20 66 |criptor |status f| |00004850| 6c 61 67 73 20 74 6f 20 | 7c 61 72 67 7c 2e 5c 63 |lags to ||arg|.\c| |00004860| 72 0d 7d 0d 5c 6d 65 64 | 73 6b 69 70 0d 54 68 65 |r.}.\med|skip.The| |00004870| 20 6f 6e 6c 79 20 73 74 | 61 74 75 73 20 66 6c 61 | only st|atus fla| |00004880| 67 20 69 6d 70 6c 65 6d | 65 6e 74 65 64 20 69 73 |g implem|ented is| |00004890| 20 7c 46 4e 44 45 4c 41 | 59 7c 20 77 68 69 63 68 | |FNDELA|Y| which| |000048a0| 20 69 73 20 74 72 75 65 | 20 69 66 20 74 68 65 20 | is true| if the | |000048b0| 73 6f 63 6b 65 74 20 69 | 73 0d 6e 6f 6e 62 6c 6f |socket i|s.nonblo| |000048c0| 63 6b 69 6e 67 2e 0d 5c | 6d 65 64 73 6b 69 70 0d |cking..\|medskip.| |000048d0| 45 72 72 6f 72 20 63 6f | 64 65 73 3a 0d 5c 6d 65 |Error co|des:.\me| |000048e0| 64 73 6b 69 70 5c 70 6c | 61 69 6e 74 77 6f 63 6f |dskip\pl|aintwoco| |000048f0| 6c 7b 0d 7c 45 4f 50 4e | 4f 54 53 55 50 50 7c 26 |l{.|EOPN|OTSUPP|&| |00004900| 54 68 65 20 6f 70 65 72 | 61 74 69 6f 6e 20 79 6f |The oper|ation yo| |00004910| 75 20 72 65 71 75 65 73 | 74 65 64 20 77 69 74 68 |u reques|ted with| |00004920| 20 7c 63 6d 64 7c 20 69 | 73 20 6e 6f 74 20 73 75 | |cmd| i|s not su| |00004930| 70 70 6f 72 74 65 64 20 | 62 79 20 74 68 69 73 0d |pported |by this.| |00004940| 73 6f 63 6b 65 74 20 66 | 61 6d 69 6c 79 2e 5c 63 |socket f|amily.\c| |00004950| 72 0d 7d 0d 0d 40 20 7c | 69 6e 74 20 67 65 74 73 |r.}..@ ||int gets| |00004960| 6f 63 6b 6f 70 74 28 69 | 6e 74 20 73 2c 20 69 6e |ockopt(i|nt s, in| |00004970| 74 20 6c 65 76 65 6c 2c | 20 69 6e 74 20 6f 70 74 |t level,| int opt| |00004980| 6e 61 6d 65 2c 20 63 68 | 61 72 20 2a 6f 70 74 76 |name, ch|ar *optv| |00004990| 61 6c 2c 20 69 6e 74 20 | 2a 20 6f 70 74 6c 65 6e |al, int |* optlen| |000049a0| 29 7c 20 69 73 0d 75 73 | 65 64 20 74 6f 20 72 65 |)| is.us|ed to re| |000049b0| 71 75 65 73 74 20 69 6e | 66 6f 72 6d 61 74 69 6f |quest in|formatio| |000049c0| 6e 20 61 62 6f 75 74 20 | 73 6f 63 6b 65 74 73 2e |n about |sockets.| |000049d0| 20 49 74 20 69 73 20 6e | 6f 74 20 69 6d 70 6c 65 | It is n|ot imple| |000049e0| 6d 65 6e 74 65 64 20 69 | 6e 20 5c 2e 7b 47 55 53 |mented i|n \.{GUS| |000049f0| 49 7d 2e 0d 0d 40 20 7c | 69 6e 74 20 73 65 74 73 |I}...@ ||int sets| |00004a00| 6f 63 6b 6f 70 74 28 69 | 6e 74 20 73 2c 20 69 6e |ockopt(i|nt s, in| |00004a10| 74 20 6c 65 76 65 6c 2c | 20 69 6e 74 20 6f 70 74 |t level,| int opt| |00004a20| 6e 61 6d 65 2c 20 63 68 | 61 72 20 2a 6f 70 74 76 |name, ch|ar *optv| |00004a30| 61 6c 2c 20 69 6e 74 20 | 6f 70 74 6c 65 6e 29 7c |al, int |optlen)|| |00004a40| 20 69 73 20 75 73 65 64 | 0d 74 6f 20 73 65 74 20 | is used|.to set | |00004a50| 6f 70 74 69 6f 6e 73 20 | 61 73 73 6f 63 69 61 74 |options |associat| |00004a60| 65 64 20 77 69 74 68 20 | 61 20 73 6f 63 6b 65 74 |ed with |a socket| |00004a70| 2e 20 49 74 20 69 73 20 | 6e 6f 74 20 69 6d 70 6c |. It is |not impl| |00004a80| 65 6d 65 6e 74 65 64 20 | 69 6e 20 5c 2e 7b 47 55 |emented |in \.{GU| |00004a90| 53 49 7d 2e 0d 0d 40 20 | 7c 69 6e 74 20 64 75 70 |SI}...@ ||int dup| |00004aa0| 28 69 6e 74 20 66 64 29 | 7c 20 72 65 74 75 72 6e |(int fd)|| return| |00004ab0| 73 20 61 20 6e 65 77 20 | 64 65 73 63 72 69 70 74 |s a new |descript| |00004ac0| 6f 72 20 72 65 66 65 72 | 72 69 6e 67 20 74 6f 20 |or refer|ring to | |00004ad0| 74 68 65 20 73 61 6d 65 | 20 73 6f 63 6b 65 74 20 |the same| socket | |00004ae0| 61 73 20 7c 66 64 7c 2e | 0d 54 68 65 20 6f 6c 64 |as |fd|.|.The old| |00004af0| 20 61 6e 64 20 6e 65 77 | 20 64 65 73 63 72 69 70 | and new| descrip| |00004b00| 74 6f 72 73 20 61 72 65 | 20 69 6e 64 69 73 74 69 |tors are| indisti| |00004b10| 6e 67 75 69 73 68 69 62 | 6c 65 2e 20 54 68 65 20 |nguishib|le. The | |00004b20| 6e 65 77 20 64 65 73 63 | 72 69 70 74 6f 72 20 77 |new desc|riptor w| |00004b30| 69 6c 6c 20 61 6c 77 61 | 79 73 0d 62 65 20 74 68 |ill alwa|ys.be th| |00004b40| 65 20 73 6d 61 6c 6c 65 | 73 74 20 66 72 65 65 20 |e smalle|st free | |00004b50| 64 65 73 63 72 69 70 74 | 6f 72 2e 0d 0d 40 20 7c |descript|or...@ || |00004b60| 69 6e 74 20 64 75 70 32 | 28 69 6e 74 20 6f 6c 64 |int dup2|(int old| |00004b70| 66 64 2c 20 69 6e 74 20 | 6e 65 77 66 64 29 7c 20 |fd, int |newfd)| | |00004b80| 63 6c 6f 73 65 73 20 7c | 6e 65 77 66 64 7c 20 69 |closes ||newfd| i| |00004b90| 66 20 69 74 20 77 61 73 | 20 6f 70 65 6e 20 61 6e |f it was| open an| |00004ba0| 64 20 6d 61 6b 65 73 20 | 69 74 0d 61 20 64 75 70 |d makes |it.a dup| |00004bb0| 6c 69 63 61 74 65 20 6f | 66 20 7c 6f 6c 64 66 64 |licate o|f |oldfd| |00004bc0| 7c 2e 20 54 68 65 20 6f | 6c 64 20 61 6e 64 20 6e ||. The o|ld and n| |00004bd0| 65 77 20 64 65 73 63 72 | 69 70 74 6f 72 73 20 61 |ew descr|iptors a| |00004be0| 72 65 20 69 6e 64 69 73 | 74 69 6e 67 75 69 73 68 |re indis|tinguish| |00004bf0| 69 62 6c 65 2e 0d 0d 40 | 2a 3d 20 44 65 74 61 69 |ible...@|*= Detai| |00004c00| 6c 20 44 65 73 63 72 69 | 70 74 69 6f 6e 2e 20 54 |l Descri|ption. T| |00004c10| 68 69 73 20 73 65 63 74 | 69 6f 6e 20 64 69 73 63 |his sect|ion disc| |00004c20| 75 73 73 65 73 20 66 6f | 72 20 65 61 63 68 20 73 |usses fo|r each s| |00004c30| 6f 63 6b 65 74 20 64 6f | 6d 61 69 6e 20 74 68 65 |ocket do|main the| |00004c40| 20 72 6f 75 74 69 6e 65 | 73 0d 74 68 61 74 20 62 | routine|s.that b| |00004c50| 65 68 61 76 65 20 64 69 | 66 66 65 72 65 6e 74 20 |ehave di|fferent | |00004c60| 66 72 6f 6d 20 74 68 65 | 69 72 20 64 65 73 63 72 |from the|ir descr| |00004c70| 69 70 74 69 6f 6e 20 69 | 6e 20 74 68 65 20 70 72 |iption i|n the pr| |00004c80| 65 76 69 6f 75 73 20 73 | 65 63 74 69 6f 6e 20 61 |evious s|ection a| |00004c90| 6e 64 20 61 20 66 65 77 | 20 63 61 6c 6c 73 0d 73 |nd a few| calls.s| |00004ca0| 70 65 63 69 66 69 63 20 | 74 6f 20 6f 6e 65 20 64 |pecific |to one d| |00004cb0| 6f 6d 61 69 6e 2e 0d 0d | 40 2a 32 20 46 69 6c 65 |omain...|@*2 File| |00004cc0| 20 73 79 73 74 65 6d 20 | 63 61 6c 6c 73 2e 20 46 | system |calls. F| |00004cd0| 69 6c 65 73 20 61 72 65 | 20 75 6e 6c 69 6b 65 20 |iles are| unlike | |00004ce0| 73 6f 63 6b 65 74 73 20 | 69 6e 20 6d 61 6e 79 20 |sockets |in many | |00004cf0| 72 65 73 70 65 63 74 73 | 3a 20 54 68 65 69 72 20 |respects|: Their | |00004d00| 6c 65 6e 67 74 68 20 69 | 73 0d 6e 65 76 65 72 20 |length i|s.never | |00004d10| 63 68 61 6e 67 65 64 20 | 62 79 20 6f 74 68 65 72 |changed |by other| |00004d20| 20 70 72 6f 63 65 73 73 | 65 73 2c 20 74 68 65 79 | process|es, they| |00004d30| 20 63 61 6e 20 62 65 20 | 72 65 77 6f 75 6e 64 2e | can be |rewound.| |00004d40| 20 54 68 65 72 65 20 61 | 72 65 20 61 6c 73 6f 20 | There a|re also | |00004d50| 6d 61 6e 79 20 63 61 6c | 6c 73 20 77 68 69 63 68 |many cal|ls which| |00004d60| 0d 61 72 65 20 73 70 65 | 63 69 66 69 63 20 74 6f |.are spe|cific to| |00004d70| 20 66 69 6c 65 73 2e 0d | 0d 40 2a 34 20 44 69 66 | files..|.@*4 Dif| |00004d80| 66 65 72 65 6e 63 65 73 | 20 74 6f 20 67 65 6e 65 |ferences| to gene| |00004d90| 72 69 63 20 62 65 68 61 | 76 69 6f 72 2e 0d 0d 40 |ric beha|vior...@| |00004da0| 20 54 68 65 20 66 6f 6c | 6c 6f 77 69 6e 67 20 63 | The fol|lowing c| |00004db0| 61 6c 6c 73 20 6d 61 6b | 65 20 6e 6f 20 73 65 6e |alls mak|e no sen| |00004dc0| 73 65 20 66 6f 72 20 66 | 69 6c 65 73 20 61 6e 64 |se for f|iles and| |00004dd0| 20 72 65 74 75 72 6e 20 | 61 6e 20 65 72 72 6f 72 | return |an error| |00004de0| 20 6f 66 20 7c 45 4f 50 | 4e 4f 54 53 55 50 50 7c | of |EOP|NOTSUPP|| |00004df0| 3a 0d 5c 6d 65 64 73 6b | 69 70 5c 70 6c 61 69 6e |:.\medsk|ip\plain| |00004e00| 6f 6e 65 63 6f 6c 7b 0d | 7c 73 6f 63 6b 65 74 28 |onecol{.||socket(| |00004e10| 29 7c 5c 63 72 0d 7c 62 | 69 6e 64 28 29 7c 5c 63 |)|\cr.|b|ind()|\c| |00004e20| 72 0d 7c 6c 69 73 74 65 | 6e 28 29 7c 5c 63 72 0d |r.|liste|n()|\cr.| |00004e30| 7c 61 63 63 65 70 74 28 | 29 7c 5c 63 72 0d 7c 63 ||accept(|)|\cr.|c| |00004e40| 6f 6e 6e 65 63 74 28 29 | 7c 5c 63 72 0d 7c 67 65 |onnect()||\cr.|ge| |00004e50| 74 73 6f 63 6b 6e 61 6d | 65 28 29 7c 5c 63 72 0d |tsocknam|e()|\cr.| |00004e60| 7c 67 65 74 70 65 65 72 | 6e 61 6d 65 28 29 7c 5c ||getpeer|name()|\| |00004e70| 63 72 0d 7c 67 65 74 73 | 6f 63 6b 6f 70 74 28 29 |cr.|gets|ockopt()| |00004e80| 7c 5c 63 72 0d 7c 73 65 | 74 73 6f 63 6b 6f 70 74 ||\cr.|se|tsockopt| |00004e90| 28 29 7c 5c 63 72 0d 7d | 0d 0d 40 20 54 68 65 20 |()|\cr.}|..@ The | |00004ea0| 66 6f 6c 6c 6f 77 69 6e | 67 20 63 61 6c 6c 73 20 |followin|g calls | |00004eb0| 7b 5c 69 74 20 77 69 6c | 6c 7d 20 77 6f 72 6b 2c |{\it wil|l} work,| |00004ec0| 20 62 75 74 20 6d 69 67 | 68 74 20 62 65 20 66 72 | but mig|ht be fr| |00004ed0| 6f 77 6e 65 64 20 75 70 | 6f 6e 20 62 79 20 79 6f |owned up|on by yo| |00004ee0| 75 72 20 66 72 69 65 6e | 64 73 0d 28 62 65 73 69 |ur frien|ds.(besi| |00004ef0| 64 65 73 2c 20 55 4e 49 | 58 20 73 79 73 74 65 6d |des, UNI|X system| |00004f00| 73 20 67 65 6e 65 72 61 | 6c 6c 79 20 77 6f 75 6c |s genera|lly woul| |00004f10| 64 6e 27 74 20 6c 69 6b | 65 20 74 68 65 6d 29 3a |dn't lik|e them):| |00004f20| 0d 5c 6d 65 64 73 6b 69 | 70 5c 70 6c 61 69 6e 6f |.\medski|p\plaino| |00004f30| 6e 65 63 6f 6c 7b 0d 7c | 72 65 63 76 28 29 7c 5c |necol{.||recv()|\| |00004f40| 63 72 0d 7c 72 65 63 76 | 66 72 6f 6d 28 29 7c 5c |cr.|recv|from()|\| |00004f50| 63 72 0d 7c 72 65 63 76 | 6d 73 67 28 29 7c 5c 63 |cr.|recv|msg()|\c| |00004f60| 72 0d 7c 73 65 6e 64 28 | 29 7c 5c 63 72 0d 7c 73 |r.|send(|)|\cr.|s| |00004f70| 65 6e 64 74 6f 28 29 7c | 5c 63 72 0d 7c 73 65 6e |endto()||\cr.|sen| |00004f80| 64 6d 73 67 28 29 7c 5c | 63 72 0d 7d 0d 0d 40 20 |dmsg()|\|cr.}..@ | |00004f90| 7c 63 68 6f 6f 73 65 28 | 29 7c 20 72 65 74 75 72 ||choose(|)| retur| |00004fa0| 6e 73 20 7a 65 72 6f 20 | 74 65 72 6d 69 6e 61 74 |ns zero |terminat| |00004fb0| 65 64 20 43 20 73 74 72 | 69 6e 67 73 20 69 6e 20 |ed C str|ings in | |00004fc0| 7c 6e 61 6d 65 7c 2e 0d | 49 74 20 61 63 63 65 70 ||name|..|It accep| |00004fd0| 74 73 20 61 6e 20 61 64 | 64 69 74 69 6f 6e 61 6c |ts an ad|ditional| |00004fe0| 20 66 6c 61 67 20 7c 43 | 48 4f 4f 53 45 5f 44 49 | flag |C|HOOSE_DI| |00004ff0| 52 7c 2e 20 49 66 20 74 | 68 69 73 20 69 73 20 73 |R|. If t|his is s| |00005000| 65 74 2c 20 7c 63 68 6f | 6f 73 65 28 29 7c 0d 77 |et, |cho|ose()|.w| |00005010| 69 6c 6c 20 73 65 6c 65 | 63 74 20 64 69 72 65 63 |ill sele|ct direc| |00005020| 74 6f 72 69 65 73 20 69 | 6e 73 74 65 61 64 20 6f |tories i|nstead o| |00005030| 66 20 66 69 6c 65 73 2e | 0d 5c 6d 65 64 73 6b 69 |f files.|.\medski| |00005040| 70 20 59 6f 75 20 6d 61 | 79 20 72 65 73 74 72 69 |p You ma|y restri| |00005050| 63 74 20 74 68 65 20 66 | 69 6c 65 73 20 70 72 65 |ct the f|iles pre| |00005060| 73 65 6e 74 65 64 20 66 | 6f 72 20 63 68 6f 6f 73 |sented f|or choos| |00005070| 69 6e 67 20 62 79 20 70 | 61 73 73 69 6e 67 20 61 |ing by p|assing a| |00005080| 20 70 6f 69 6e 74 65 72 | 20 74 6f 0d 74 68 65 20 | pointer| to.the | |00005090| 66 6f 6c 6c 6f 77 69 6e | 67 20 73 74 72 75 63 74 |followin|g struct| |000050a0| 75 72 65 20 66 6f 72 20 | 74 68 65 20 7c 63 6f 6e |ure for |the |con| |000050b0| 73 74 72 61 69 6e 74 7c | 20 61 72 67 75 6d 65 6e |straint|| argumen| |000050c0| 74 3a 0d 40 75 0d 74 79 | 70 65 64 65 66 20 73 74 |t:.@u.ty|pedef st| |000050d0| 72 75 63 74 20 7b 0d 09 | 73 68 6f 72 74 09 09 09 |ruct {..|short...| |000050e0| 6e 75 6d 54 79 70 65 73 | 3b 09 2f 2a 20 4e 75 6d |numTypes|;./* Num| |000050f0| 62 65 72 20 6f 66 20 6c | 65 67 69 74 69 6d 61 74 |ber of l|egitimat| |00005100| 65 20 66 69 6c 65 20 74 | 79 70 65 73 20 2a 2f 0d |e file t|ypes */.| |00005110| 09 53 46 54 79 70 65 4c | 69 73 74 09 74 79 70 65 |.SFTypeL|ist.type| |00005120| 73 3b 09 09 2f 2a 20 54 | 68 65 20 74 79 70 65 73 |s;../* T|he types| |00005130| 2c 20 6c 69 6b 65 20 27 | 54 45 58 54 27 20 2a 2f |, like '|TEXT' */| |00005140| 0d 7d 20 73 61 5f 63 6f | 6e 73 74 72 5f 66 69 6c |.} sa_co|nstr_fil| |00005150| 65 3b 0d 0d 40 20 7c 73 | 65 6c 65 63 74 28 29 7c |e;..@ |s|elect()|| |00005160| 20 77 69 6c 6c 20 67 69 | 76 65 20 62 6f 72 69 6e | will gi|ve borin| |00005170| 67 20 72 65 73 75 6c 74 | 73 2e 20 46 69 6c 65 20 |g result|s. File | |00005180| 64 65 73 63 72 69 70 74 | 6f 72 73 20 61 72 65 20 |descript|ors are | |00005190| 7b 5c 69 74 20 61 6c 77 | 61 79 73 7d 20 63 6f 6e |{\it alw|ays} con| |000051a0| 73 69 64 65 72 65 64 0d | 72 65 61 64 79 20 74 6f |sidered.|ready to| |000051b0| 20 72 65 61 64 20 6f 72 | 20 77 72 69 74 65 2c 20 | read or| write, | |000051c0| 61 6e 64 20 7b 5c 69 74 | 20 6e 65 76 65 72 7d 20 |and {\it| never} | |000051d0| 67 69 76 65 20 65 78 63 | 65 70 74 69 6f 6e 73 2e |give exc|eptions.| |000051e0| 0d 0d 40 20 7c 69 6f 63 | 74 6c 28 29 7c 20 61 6e |..@ |ioc|tl()| an| |000051f0| 64 20 7c 66 63 6e 74 6c | 28 29 7c 20 64 6f 6e 27 |d |fcntl|()| don'| |00005200| 74 20 73 75 70 70 6f 72 | 74 20 6d 61 6e 69 70 75 |t suppor|t manipu| |00005210| 6c 61 74 69 6e 67 20 74 | 68 65 20 62 6c 6f 63 6b |lating t|he block| |00005220| 69 6e 67 20 73 74 61 74 | 65 20 6f 66 20 61 20 66 |ing stat|e of a f| |00005230| 69 6c 65 0d 64 65 73 63 | 72 69 70 74 6f 72 20 6f |ile.desc|riptor o| |00005240| 72 20 72 65 61 64 69 6e | 67 20 74 68 65 20 6e 75 |r readin|g the nu| |00005250| 6d 62 65 72 20 6f 66 20 | 62 79 74 65 73 20 61 76 |mber of |bytes av| |00005260| 61 69 6c 61 62 6c 65 20 | 66 6f 72 20 72 65 61 64 |ailable |for read| |00005270| 69 6e 67 2c 20 62 75 74 | 20 77 69 6c 6c 20 61 63 |ing, but| will ac| |00005280| 63 65 70 74 0d 6c 6f 74 | 73 20 6f 66 20 6f 74 68 |cept.lot|s of oth| |00005290| 65 72 20 72 65 71 75 65 | 73 74 73 2d 2d 2d 43 68 |er reque|sts---Ch| |000052a0| 65 63 6b 20 77 69 74 68 | 20 79 6f 75 72 20 74 72 |eck with| your tr| |000052b0| 75 73 74 79 20 4d 50 57 | 20 43 20 64 6f 63 75 6d |usty MPW| C docum| |000052c0| 65 6e 74 61 74 69 6f 6e | 2e 0d 0d 40 2a 34 20 52 |entation|...@*4 R| |000052d0| 6f 75 74 69 6e 65 73 20 | 73 70 65 63 69 66 69 63 |outines |specific| |000052e0| 20 74 6f 20 74 68 65 20 | 66 69 6c 65 20 73 79 73 | to the |file sys| |000052f0| 74 65 6d 2e 20 49 6e 20 | 74 68 69 73 20 73 65 63 |tem. In |this sec| |00005300| 74 69 6f 6e 2c 20 79 6f | 75 27 6c 6c 20 6d 65 65 |tion, yo|u'll mee| |00005310| 74 20 6c 6f 74 73 20 6f | 66 20 67 6f 6f 64 0d 6f |t lots o|f good.o| |00005320| 6c 64 20 66 72 69 65 6e | 64 73 2e 0d 0d 40 20 7c |ld frien|ds...@ || |00005330| 69 6e 74 20 73 74 61 74 | 28 63 68 61 72 20 2a 20 |int stat|(char * | |00005340| 70 61 74 68 2c 20 73 74 | 72 75 63 74 20 73 74 61 |path, st|ruct sta| |00005350| 74 20 2a 20 62 75 66 29 | 7c 20 72 65 74 75 72 6e |t * buf)|| return| |00005360| 73 20 69 6e 66 6f 72 6d | 61 74 69 6f 6e 20 61 62 |s inform|ation ab| |00005370| 6f 75 74 20 61 20 66 69 | 6c 65 2e 0d 7c 73 74 72 |out a fi|le..|str| |00005380| 75 63 74 20 73 74 61 74 | 7c 20 69 73 20 64 65 66 |uct stat|| is def| |00005390| 69 6e 65 64 20 61 73 20 | 66 6f 6c 6c 6f 77 73 3a |ined as |follows:| |000053a0| 0d 40 75 0d 73 74 72 75 | 63 74 20 73 74 61 74 09 |.@u.stru|ct stat.| |000053b0| 7b 0d 09 64 65 76 5f 74 | 09 09 73 74 5f 64 65 76 |{..dev_t|..st_dev| |000053c0| 3b 09 09 2f 2a 20 56 6f | 6c 75 6d 65 20 72 65 66 |;../* Vo|lume ref| |000053d0| 65 72 65 6e 63 65 20 6e | 75 6d 62 65 72 20 6f 66 |erence n|umber of| |000053e0| 20 66 69 6c 65 20 09 2a | 2f 0d 09 69 6e 6f 5f 74 | file .*|/..ino_t| |000053f0| 09 09 73 74 5f 69 6e 6f | 3b 09 09 2f 2a 20 46 69 |..st_ino|;../* Fi| |00005400| 6c 65 20 6f 72 20 64 69 | 72 65 63 74 6f 72 79 20 |le or di|rectory | |00005410| 49 44 20 20 20 20 20 20 | 09 09 09 2a 2f 0d 09 75 |ID |...*/..u| |00005420| 5f 73 68 6f 72 74 09 73 | 74 5f 6d 6f 64 65 3b 09 |_short.s|t_mode;.| |00005430| 09 2f 2a 20 54 79 70 65 | 20 61 6e 64 20 70 65 72 |./* Type| and per| |00005440| 6d 69 73 73 69 6f 6e 20 | 6f 66 20 66 69 6c 65 09 |mission |of file.| |00005450| 09 2a 2f 0d 09 73 68 6f | 72 74 09 09 73 74 5f 6e |.*/..sho|rt..st_n| |00005460| 6c 69 6e 6b 3b 09 2f 2a | 20 41 6c 77 61 79 73 20 |link;./*| Always | |00005470| 31 09 09 09 09 09 2a 2f | 0d 09 73 68 6f 72 74 09 |1.....*/|..short.| |00005480| 09 73 74 5f 75 69 64 3b | 09 09 2f 2a 20 53 65 74 |.st_uid;|../* Set| |00005490| 20 74 6f 20 30 09 09 09 | 09 09 2a 2f 0d 09 73 68 | to 0...|..*/..sh| |000054a0| 6f 72 74 09 09 73 74 5f | 67 69 64 3b 09 09 2f 2a |ort..st_|gid;../*| |000054b0| 20 53 65 74 20 74 6f 20 | 30 09 09 09 09 09 2a 2f | Set to |0.....*/| |000054c0| 0d 09 64 65 76 5f 74 09 | 09 73 74 5f 72 64 65 76 |..dev_t.|.st_rdev| |000054d0| 3b 09 09 2f 2a 20 53 65 | 74 20 74 6f 20 30 09 09 |;../* Se|t to 0..| |000054e0| 09 09 09 2a 2f 0d 09 6f | 66 66 5f 74 09 09 73 74 |...*/..o|ff_t..st| |000054f0| 5f 73 69 7a 65 3b 0d 09 | 74 69 6d 65 5f 74 09 73 |_size;..|time_t.s| |00005500| 74 5f 61 74 69 6d 65 3b | 09 2f 2a 20 53 65 74 20 |t_atime;|./* Set | |00005510| 74 6f 20 7c 73 74 5f 6d | 74 69 6d 65 7c 20 09 2a |to |st_m|time| .*| |00005520| 2f 0d 09 74 69 6d 65 5f | 74 09 73 74 5f 6d 74 69 |/..time_|t.st_mti| |00005530| 6d 65 3b 0d 09 74 69 6d | 65 5f 74 09 73 74 5f 63 |me;..tim|e_t.st_c| |00005540| 74 69 6d 65 3b 0d 09 6c | 6f 6e 67 09 09 73 74 5f |time;..l|ong..st_| |00005550| 62 6c 6b 73 69 7a 65 3b | 0d 09 6c 6f 6e 67 09 09 |blksize;|..long..| |00005560| 73 74 5f 62 6c 6f 63 6b | 73 3b 0d 7d 3b 0d 0d 40 |st_block|s;.};..@| |00005570| 20 7c 73 74 5f 6d 6f 64 | 65 7c 20 69 73 20 63 6f | |st_mod|e| is co| |00005580| 6d 70 6f 73 65 64 20 6f | 66 20 61 20 66 69 6c 65 |mposed o|f a file| |00005590| 20 74 79 70 65 20 61 6e | 64 20 6f 66 20 66 69 6c | type an|d of fil| |000055a0| 65 20 70 65 72 6d 69 73 | 73 69 6f 6e 73 2e 20 54 |e permis|sions. T| |000055b0| 68 65 20 66 69 6c 65 20 | 74 79 70 65 0d 6d 61 79 |he file |type.may| |000055c0| 20 62 65 20 6f 6e 65 20 | 6f 66 20 74 68 65 20 66 | be one |of the f| |000055d0| 6f 6c 6c 6f 77 69 6e 67 | 3a 0d 5c 6d 65 64 73 6b |ollowing|:.\medsk| |000055e0| 69 70 5c 70 6c 61 69 6e | 74 77 6f 63 6f 6c 7b 0d |ip\plain|twocol{.| |000055f0| 7c 53 5f 49 46 52 45 47 | 7c 26 41 20 72 65 67 75 ||S_IFREG||&A regu| |00005600| 6c 61 72 20 66 69 6c 65 | 2e 5c 63 72 0d 7c 53 5f |lar file|.\cr.|S_| |00005610| 49 46 44 49 52 7c 26 41 | 20 64 69 72 65 63 74 6f |IFDIR|&A| directo| |00005620| 72 79 2e 5c 63 72 0d 7c | 53 5f 49 46 43 48 52 7c |ry.\cr.||S_IFCHR|| |00005630| 26 41 20 63 6f 6e 73 6f | 6c 65 20 66 69 6c 65 20 |&A conso|le file | |00005640| 75 6e 64 65 72 20 4d 50 | 57 20 6f 72 20 53 49 4f |under MP|W or SIO| |00005650| 57 2e 5c 63 72 0d 7c 53 | 5f 49 46 53 4f 43 4b 7c |W.\cr.|S|_IFSOCK|| |00005660| 26 41 20 66 69 6c 65 20 | 72 65 70 72 65 73 65 6e |&A file |represen| |00005670| 74 69 6e 67 20 61 20 55 | 4e 49 58 20 64 6f 6d 61 |ting a U|NIX doma| |00005680| 69 6e 20 73 6f 63 6b 65 | 74 2e 5c 63 72 0d 7d 0d |in socke|t.\cr.}.| |00005690| 5c 6d 65 64 73 6b 69 70 | 20 50 65 72 6d 69 73 73 |\medskip| Permiss| |000056a0| 69 6f 6e 73 20 63 6f 6e | 73 69 73 74 20 6f 66 20 |ions con|sist of | |000056b0| 61 6e 20 6f 63 74 61 6c | 20 64 69 67 69 74 20 72 |an octal| digit r| |000056c0| 65 70 65 61 74 65 64 20 | 74 68 72 65 65 20 74 69 |epeated |three ti| |000056d0| 6d 65 73 2e 20 54 68 65 | 20 74 68 72 65 65 20 62 |mes. The| three b| |000056e0| 69 74 73 0d 69 6e 20 74 | 68 65 20 64 69 67 69 74 |its.in t|he digit| |000056f0| 20 68 61 76 65 20 74 68 | 65 20 66 6f 6c 6c 6f 77 | have th|e follow| |00005700| 69 6e 67 20 6d 65 61 6e | 69 6e 67 3a 0d 5c 6d 65 |ing mean|ing:.\me| |00005710| 64 73 6b 69 70 5c 70 6c | 61 69 6e 74 77 6f 63 6f |dskip\pl|aintwoco| |00005720| 6c 7b 0d 7c 34 7c 26 46 | 69 6c 65 20 63 61 6e 20 |l{.|4|&F|ile can | |00005730| 62 65 20 72 65 61 64 2e | 5c 63 72 0d 7c 32 7c 26 |be read.|\cr.|2|&| |00005740| 46 69 6c 65 20 63 61 6e | 20 62 65 20 77 72 69 74 |File can| be writ| |00005750| 74 65 6e 2e 5c 63 72 0d | 7c 31 7c 26 46 69 6c 65 |ten.\cr.||1|&File| |00005760| 20 63 61 6e 20 62 65 20 | 65 78 65 63 75 74 65 64 | can be |executed| |00005770| 2c 20 69 2e 65 2e 2c 20 | 69 74 73 20 74 79 70 65 |, i.e., |its type| |00005780| 20 69 73 20 60 41 50 50 | 4c 27 2c 20 60 4d 50 53 | is `APP|L', `MPS| |00005790| 54 27 20 6f 72 20 60 54 | 45 58 54 27 5c 63 72 0d |T' or `T|EXT'\cr.| |000057a0| 7d 0d 0d 40 20 7c 69 6e | 74 20 6c 73 74 61 74 28 |}..@ |in|t lstat(| |000057b0| 63 68 61 72 20 2a 20 70 | 61 74 68 2c 20 73 74 72 |char * p|ath, str| |000057c0| 75 63 74 20 73 74 61 74 | 20 2a 20 62 75 66 29 7c |uct stat| * buf)|| |000057d0| 20 77 6f 72 6b 73 20 6a | 75 73 74 20 6c 69 6b 65 | works j|ust like| |000057e0| 20 7c 73 74 61 74 28 29 | 7c 2c 20 62 75 74 20 69 | |stat()||, but i| |000057f0| 66 20 7c 70 61 74 68 7c | 0d 69 73 20 61 20 73 79 |f |path||.is a sy| |00005800| 6d 62 6f 6c 69 63 20 6c | 69 6e 6b 2c 20 7c 6c 73 |mbolic l|ink, |ls| |00005810| 74 61 74 28 29 7c 20 77 | 69 6c 6c 20 72 65 74 75 |tat()| w|ill retu| |00005820| 72 6e 20 69 6e 66 6f 72 | 6d 61 74 69 6f 6e 20 61 |rn infor|mation a| |00005830| 62 6f 75 74 20 74 68 65 | 20 6c 69 6e 6b 20 61 6e |bout the| link an| |00005840| 64 20 6e 6f 74 20 61 62 | 6f 75 74 0d 74 68 65 20 |d not ab|out.the | |00005850| 66 69 6c 65 20 69 74 20 | 70 6f 69 6e 74 73 20 74 |file it |points t| |00005860| 6f 2e 0d 0d 40 20 7c 69 | 6e 74 20 66 73 74 61 74 |o...@ |i|nt fstat| |00005870| 28 69 6e 74 20 66 64 2c | 20 73 74 72 75 63 74 20 |(int fd,| struct | |00005880| 73 74 61 74 20 2a 20 62 | 75 66 29 7c 20 69 73 20 |stat * b|uf)| is | |00005890| 74 68 65 20 65 71 75 69 | 76 61 6c 65 6e 74 20 6f |the equi|valent o| |000058a0| 66 20 7c 73 74 61 74 28 | 29 7c 20 66 6f 72 20 64 |f |stat(|)| for d| |000058b0| 65 73 63 72 69 70 74 6f | 72 73 0d 72 65 70 72 65 |escripto|rs.repre| |000058c0| 73 65 6e 74 69 6e 67 20 | 6f 70 65 6e 20 66 69 6c |senting |open fil| |000058d0| 65 73 2e 20 57 68 69 6c | 65 20 69 74 20 69 73 20 |es. Whil|e it is | |000058e0| 6c 65 67 61 6c 20 74 6f | 20 63 61 6c 6c 20 7c 66 |legal to| call |f| |000058f0| 73 74 61 74 28 29 7c 20 | 66 6f 72 20 73 6f 63 6b |stat()| |for sock| |00005900| 65 74 73 2c 20 74 68 65 | 0d 69 6e 66 6f 72 6d 61 |ets, the|.informa| |00005910| 74 69 6f 6e 20 72 65 74 | 75 72 6e 65 64 20 69 73 |tion ret|urned is| |00005920| 20 6e 6f 74 20 72 65 61 | 6c 6c 79 20 69 6e 74 65 | not rea|lly inte| |00005930| 72 65 73 74 69 6e 67 2e | 0d 0d 40 20 7c 69 6e 74 |resting.|..@ |int| |00005940| 20 69 73 61 74 74 79 28 | 69 6e 74 20 66 64 29 7c | isatty(|int fd)|| |00005950| 20 72 65 74 75 72 6e 73 | 20 7c 31 7c 20 69 66 20 | returns| |1| if | |00005960| 7c 66 64 7c 20 72 65 70 | 72 65 73 65 6e 74 73 20 ||fd| rep|resents | |00005970| 61 20 74 65 72 6d 69 6e | 61 6c 20 28 69 2e 65 2e |a termin|al (i.e.| |00005980| 20 69 73 20 63 6f 6e 6e | 65 63 74 65 64 0d 74 6f | is conn|ected.to| |00005990| 20 22 44 65 76 3a 53 74 | 64 49 6e 22 20 61 6e 64 | "Dev:St|dIn" and| |000059a0| 20 74 68 65 20 6c 69 6b | 65 29 2c 20 7c 30 7c 20 | the lik|e), |0| | |000059b0| 6f 74 68 65 72 77 69 73 | 65 2e 0d 0d 40 20 7c 6c |otherwis|e...@ |l| |000059c0| 6f 6e 67 20 6c 73 65 65 | 6b 28 69 6e 74 2c 20 6c |ong lsee|k(int, l| |000059d0| 6f 6e 67 2c 20 69 6e 74 | 29 7c 20 77 6f 72 6b 73 |ong, int|)| works| |000059e0| 20 74 68 65 20 73 61 6d | 65 20 61 73 20 74 68 65 | the sam|e as the| |000059f0| 20 5c 2e 7b 4d 50 57 7d | 20 72 6f 75 74 69 6e 65 | \.{MPW}| routine| |00005a00| 2c 20 61 6e 64 20 77 69 | 6c 6c 0d 72 65 74 75 72 |, and wi|ll.retur| |00005a10| 6e 20 7c 45 53 50 49 50 | 45 7c 20 69 66 20 63 61 |n |ESPIP|E| if ca| |00005a20| 6c 6c 65 64 20 66 6f 72 | 20 61 20 73 6f 63 6b 65 |lled for| a socke| |00005a30| 74 2e 0d 0d 40 20 7c 69 | 6e 74 20 72 65 6d 6f 76 |t...@ |i|nt remov| |00005a40| 65 28 63 6f 6e 73 74 20 | 63 68 61 72 20 2a 66 69 |e(const |char *fi| |00005a50| 6c 65 6e 61 6d 65 29 7c | 20 72 65 6d 6f 76 65 73 |lename)|| removes| |00005a60| 20 74 68 65 20 6e 61 6d | 65 64 20 66 69 6c 65 2e | the nam|ed file.| |00005a70| 20 49 66 20 7c 66 69 6c | 65 6e 61 6d 65 7c 20 69 | If |fil|ename| i| |00005a80| 73 20 61 0d 73 79 6d 62 | 6f 6c 69 63 20 6c 69 6e |s a.symb|olic lin| |00005a90| 6b 2c 20 74 68 65 20 6c | 69 6e 6b 20 77 69 6c 6c |k, the l|ink will| |00005aa0| 20 62 65 20 72 65 6d 6f | 76 65 64 20 61 6e 64 20 | be remo|ved and | |00005ab0| 6e 6f 74 20 74 68 65 20 | 66 69 6c 65 2e 0d 0d 40 |not the |file...@| |00005ac0| 20 7c 69 6e 74 20 75 6e | 6c 69 6e 6b 28 63 6f 6e | |int un|link(con| |00005ad0| 73 74 20 63 68 61 72 20 | 2a 66 69 6c 65 6e 61 6d |st char |*filenam| |00005ae0| 65 29 7c 20 69 73 20 69 | 64 65 6e 74 69 63 61 6c |e)| is i|dentical| |00005af0| 20 74 6f 20 7c 72 65 6d | 6f 76 65 28 29 7c 2e 20 | to |rem|ove()|. | |00005b00| 4e 6f 74 65 20 74 68 61 | 74 0d 6f 6e 20 74 68 65 |Note tha|t.on the| |00005b10| 20 4d 61 63 2c 20 7c 75 | 6e 6c 69 6e 6b 28 29 7c | Mac, |u|nlink()|| |00005b20| 20 6f 6e 20 6f 70 65 6e | 20 66 69 6c 65 73 20 62 | on open| files b| |00005b30| 65 68 61 76 65 73 20 64 | 69 66 66 65 72 65 6e 74 |ehaves d|ifferent| |00005b40| 6c 79 20 66 72 6f 6d 20 | 5c 2e 7b 55 4e 49 58 7d |ly from |\.{UNIX}| |00005b50| 2e 0d 0d 40 20 7c 69 6e | 74 20 72 65 6e 61 6d 65 |...@ |in|t rename| |00005b60| 28 63 6f 6e 73 74 20 63 | 68 61 72 20 2a 6f 6c 64 |(const c|har *old| |00005b70| 6e 61 6d 65 2c 20 63 6f | 6e 73 74 20 63 68 61 72 |name, co|nst char| |00005b80| 20 2a 6e 65 77 6e 61 6d | 65 29 7c 20 72 65 6e 61 | *newnam|e)| rena| |00005b90| 6d 65 73 20 61 6e 64 2f | 6f 72 20 6d 6f 76 65 73 |mes and/|or moves| |00005ba0| 20 61 0d 66 69 6c 65 2e | 20 7c 6f 6c 64 6e 61 6d | a.file.| |oldnam| |00005bb0| 65 7c 20 61 6e 64 20 7c | 6e 65 77 6e 61 6d 65 7c |e| and ||newname|| |00005bc0| 20 6d 75 73 74 20 73 70 | 65 63 69 66 79 20 74 68 | must sp|ecify th| |00005bd0| 65 20 73 61 6d 65 20 76 | 6f 6c 75 6d 65 2c 20 62 |e same v|olume, b| |00005be0| 75 74 20 61 73 20 6f 70 | 70 6f 73 65 64 20 74 6f |ut as op|posed to| |00005bf0| 0d 74 68 65 20 5c 2e 7b | 4d 50 57 7d 20 72 6f 75 |.the \.{|MPW} rou| |00005c00| 74 69 6e 65 2c 20 74 68 | 65 79 20 6d 61 79 20 73 |tine, th|ey may s| |00005c10| 70 65 63 69 66 79 20 64 | 69 66 66 65 72 65 6e 74 |pecify d|ifferent| |00005c20| 20 66 6f 6c 64 65 72 73 | 2e 0d 0d 40 20 7c 69 6e | folders|...@ |in| |00005c30| 74 20 6f 70 65 6e 28 63 | 6f 6e 73 74 20 63 68 61 |t open(c|onst cha| |00005c40| 72 2a 2c 20 69 6e 74 20 | 66 6c 61 67 73 29 7c 20 |r*, int |flags)| | |00005c50| 6f 70 65 6e 73 20 61 20 | 6e 61 6d 65 64 20 66 69 |opens a |named fi| |00005c60| 6c 65 2e 20 54 68 65 20 | 7c 66 6c 61 67 73 7c 20 |le. The ||flags| | |00005c70| 63 6f 6e 73 69 73 74 0d | 6f 66 20 6f 6e 65 20 6f |consist.|of one o| |00005c80| 66 20 74 68 65 20 66 6f | 6c 6c 6f 77 69 6e 67 20 |f the fo|llowing | |00005c90| 6d 6f 64 65 73 3a 0d 5c | 6d 65 64 73 6b 69 70 5c |modes:.\|medskip\| |00005ca0| 70 6c 61 69 6e 74 77 6f | 63 6f 6c 7b 0d 7c 4f 5f |plaintwo|col{.|O_| |00005cb0| 52 44 4f 4e 4c 59 7c 26 | 4f 70 65 6e 20 66 6f 72 |RDONLY|&|Open for| |00005cc0| 20 72 65 61 64 69 6e 67 | 20 6f 6e 6c 79 2e 5c 63 | reading| only.\c| |00005cd0| 72 0d 7c 57 52 5f 4f 4e | 4c 59 7c 26 4f 70 65 6e |r.|WR_ON|LY|&Open| |00005ce0| 20 66 6f 72 20 77 72 69 | 74 69 6e 67 20 6f 6e 6c | for wri|ting onl| |00005cf0| 79 2e 5c 63 72 0d 7c 4f | 5f 52 44 57 52 7c 26 4f |y.\cr.|O|_RDWR|&O| |00005d00| 70 65 6e 20 66 6f 72 20 | 72 65 61 64 69 6e 67 20 |pen for |reading | |00005d10| 61 6e 64 20 77 72 69 74 | 69 6e 67 2e 5c 63 72 0d |and writ|ing.\cr.| |00005d20| 7d 0d 5c 6d 65 64 73 6b | 69 70 20 4f 70 74 69 6f |}.\medsk|ip Optio| |00005d30| 6e 61 6c 6c 79 20 63 6f | 6d 62 69 6e 65 64 20 77 |nally co|mbined w| |00005d40| 69 74 68 20 6f 6e 65 20 | 6f 72 20 6d 6f 72 65 20 |ith one |or more | |00005d50| 6f 66 3a 0d 5c 6d 65 64 | 73 6b 69 70 5c 70 6c 61 |of:.\med|skip\pla| |00005d60| 69 6e 74 77 6f 63 6f 6c | 7b 0d 7c 4f 5f 41 50 50 |intwocol|{.|O_APP| |00005d70| 45 4e 44 7c 26 54 68 65 | 20 66 69 6c 65 20 70 6f |END|&The| file po| |00005d80| 69 6e 74 65 72 20 69 73 | 20 73 65 74 20 74 6f 20 |inter is| set to | |00005d90| 74 68 65 20 65 6e 64 20 | 6f 66 20 74 68 65 20 66 |the end |of the f| |00005da0| 69 6c 65 20 62 65 66 6f | 72 65 20 65 61 63 68 20 |ile befo|re each | |00005db0| 77 72 69 74 65 2e 5c 63 | 72 0d 7c 4f 5f 52 53 52 |write.\c|r.|O_RSR| |00005dc0| 43 7c 26 4f 70 65 6e 20 | 72 65 73 6f 75 72 63 65 |C|&Open |resource| |00005dd0| 20 66 6f 72 6b 2e 5c 63 | 72 0d 7c 4f 5f 43 52 45 | fork.\c|r.|O_CRE| |00005de0| 41 54 7c 26 49 66 20 74 | 68 65 20 66 69 6c 65 20 |AT|&If t|he file | |00005df0| 64 6f 65 73 20 6e 6f 74 | 20 65 78 69 73 74 2c 20 |does not| exist, | |00005e00| 69 74 20 69 73 20 63 72 | 65 61 74 65 64 2e 5c 63 |it is cr|eated.\c| |00005e10| 72 0d 7c 4f 5f 45 58 43 | 4c 7c 26 49 6e 20 63 6f |r.|O_EXC|L|&In co| |00005e20| 6d 62 69 6e 61 74 69 6f | 6e 20 77 69 74 68 20 7c |mbinatio|n with || |00005e30| 4f 5f 43 52 45 41 54 7c | 2c 20 72 65 74 75 72 6e |O_CREAT||, return| |00005e40| 20 61 6e 20 65 72 72 6f | 72 20 69 66 20 66 69 6c | an erro|r if fil| |00005e50| 65 20 61 6c 72 65 61 64 | 79 20 65 78 69 73 74 73 |e alread|y exists| |00005e60| 2e 5c 63 72 0d 7c 4f 5f | 54 52 55 4e 43 7c 26 49 |.\cr.|O_|TRUNC|&I| |00005e70| 66 20 74 68 65 20 66 69 | 6c 65 20 65 78 69 73 74 |f the fi|le exist| |00005e80| 73 2c 20 69 74 73 20 6c | 65 6e 67 74 68 20 69 73 |s, its l|ength is| |00005e90| 20 74 72 75 6e 63 61 74 | 65 64 20 74 6f 20 30 3b | truncat|ed to 0;| |00005ea0| 20 74 68 65 20 6d 6f 64 | 65 20 69 73 20 75 6e 63 | the mod|e is unc| |00005eb0| 68 61 6e 67 65 64 2e 5c | 63 72 0d 7c 4f 5f 41 4c |hanged.\|cr.|O_AL| |00005ec0| 49 41 53 7c 26 49 66 20 | 74 68 65 20 6e 61 6d 65 |IAS|&If |the name| |00005ed0| 64 20 66 69 6c 65 20 69 | 73 20 61 20 73 79 6d 62 |d file i|s a symb| |00005ee0| 6f 6c 69 63 20 6c 69 6e | 6b 2c 20 6f 70 65 6e 20 |olic lin|k, open | |00005ef0| 74 68 65 20 6c 69 6e 6b | 2c 20 6e 6f 74 20 74 68 |the link|, not th| |00005f00| 65 20 66 69 6c 65 20 69 | 74 20 70 6f 69 6e 74 73 |e file i|t points| |00005f10| 0d 74 6f 20 28 54 68 69 | 73 20 69 73 20 6d 6f 73 |.to (Thi|s is mos| |00005f20| 74 20 6c 69 6b 65 6c 79 | 20 61 6e 20 69 6e 63 72 |t likely| an incr| |00005f30| 65 64 69 62 6c 79 20 62 | 61 64 20 69 64 65 61 29 |edibly b|ad idea)| |00005f40| 2e 5c 63 72 0d 7d 0d 0d | 40 20 7c 69 6e 74 20 63 |.\cr.}..|@ |int c| |00005f50| 72 65 61 74 28 63 68 61 | 72 20 2a 20 66 69 6c 65 |reat(cha|r * file| |00005f60| 6e 61 6d 65 29 7c 20 69 | 73 20 69 64 65 6e 74 69 |name)| i|s identi| |00005f70| 63 61 6c 20 74 6f 20 7c | 6f 70 65 6e 28 66 69 6c |cal to ||open(fil| |00005f80| 65 6e 61 6d 65 2c 20 4f | 5f 57 52 4f 4e 4c 59 2b |ename, O|_WRONLY+| |00005f90| 4f 5f 54 52 55 4e 43 2b | 4f 5f 43 52 45 41 54 29 |O_TRUNC+|O_CREAT)| |00005fa0| 7c 2e 0d 0d 40 20 7c 69 | 6e 74 20 66 61 63 63 65 ||...@ |i|nt facce| |00005fb0| 73 73 28 63 6f 6e 73 74 | 20 63 68 61 72 20 2a 66 |ss(const| char *f| |00005fc0| 69 6c 65 6e 61 6d 65 2c | 20 75 6e 73 69 67 6e 65 |ilename,| unsigne| |00005fd0| 64 20 69 6e 74 20 63 6d | 64 2c 20 6c 6f 6e 67 20 |d int cm|d, long | |00005fe0| 2a 61 72 67 29 7c 20 77 | 6f 72 6b 73 20 74 68 65 |*arg)| w|orks the| |00005ff0| 20 73 61 6d 65 0d 61 73 | 20 74 68 65 20 63 6f 72 | same.as| the cor| |00006000| 72 65 73 70 6f 6e 64 69 | 6e 67 20 5c 2e 7b 4d 50 |respondi|ng \.{MP| |00006010| 57 7d 20 72 6f 75 74 69 | 6e 65 2c 20 62 75 74 20 |W} routi|ne, but | |00006020| 72 65 73 70 65 63 74 73 | 20 63 61 6c 6c 73 20 74 |respects| calls t| |00006030| 6f 20 7c 63 68 64 69 72 | 28 29 7c 20 66 6f 72 20 |o |chdir|()| for | |00006040| 70 61 72 74 69 61 6c 0d | 66 69 6c 65 6e 61 6d 65 |partial.|filename| |00006050| 73 2e 0d 0d 40 20 7c 76 | 6f 69 64 20 66 73 65 74 |s...@ |v|oid fset| |00006060| 66 69 6c 65 69 6e 66 6f | 28 63 68 61 72 20 2a 66 |fileinfo|(char *f| |00006070| 69 6c 65 6e 61 6d 65 2c | 20 75 6e 73 69 67 6e 65 |ilename,| unsigne| |00006080| 64 20 6c 6f 6e 67 20 6e | 65 77 63 72 65 61 74 6f |d long n|ewcreato| |00006090| 72 2c 20 75 6e 73 69 67 | 6e 65 64 20 6c 6f 6e 67 |r, unsig|ned long| |000060a0| 20 6e 65 77 74 79 70 65 | 29 7c 0d 73 65 74 73 20 | newtype|)|.sets | |000060b0| 74 68 65 20 66 69 6c 65 | 20 74 79 70 65 20 61 6e |the file| type an| |000060c0| 64 20 63 72 65 61 74 6f | 72 20 6f 66 20 61 20 66 |d creato|r of a f| |000060d0| 69 6c 65 20 74 6f 20 74 | 68 65 20 67 69 76 65 6e |ile to t|he given| |000060e0| 20 76 61 6c 75 65 73 2e | 0d 0d 40 20 7c 69 6e 74 | values.|..@ |int| |000060f0| 20 73 79 6d 6c 69 6e 6b | 28 63 68 61 72 2a 20 6c | symlink|(char* l| |00006100| 69 6e 6b 74 6f 2c 20 63 | 68 61 72 2a 20 6c 69 6e |inkto, c|har* lin| |00006110| 6b 6e 61 6d 65 29 7c 20 | 63 72 65 61 74 65 73 20 |kname)| |creates | |00006120| 61 20 66 69 6c 65 20 6e | 61 6d 65 64 20 7c 6c 69 |a file n|amed |li| |00006130| 6e 6b 6e 61 6d 65 7c 20 | 74 68 61 74 0d 63 6f 6e |nkname| |that.con| |00006140| 74 61 69 6e 73 20 61 6e | 20 61 6c 69 61 73 20 72 |tains an| alias r| |00006150| 65 73 6f 75 72 63 65 20 | 70 6f 69 6e 74 69 6e 67 |esource |pointing| |00006160| 20 74 6f 20 7c 6c 69 6e | 6b 74 6f 7c 2e 20 54 68 | to |lin|kto|. Th| |00006170| 65 20 63 72 65 61 74 65 | 64 20 66 69 6c 65 20 73 |e create|d file s| |00006180| 68 6f 75 6c 64 20 62 65 | 0d 69 6e 64 69 73 74 69 |hould be|.indisti| |00006190| 6e 67 75 69 73 68 69 62 | 6c 65 20 66 72 6f 6d 20 |nguishib|le from | |000061a0| 61 6e 20 61 6c 69 61 73 | 20 66 69 6c 65 20 63 72 |an alias| file cr| |000061b0| 65 61 74 65 64 20 62 79 | 20 74 68 65 20 53 79 73 |eated by| the Sys| |000061c0| 74 65 6d 20 37 20 46 69 | 6e 64 65 72 2e 20 4e 6f |tem 7 Fi|nder. No| |000061d0| 74 65 20 74 68 61 74 0d | 61 6c 69 61 73 65 73 20 |te that.|aliases | |000061e0| 62 65 61 72 20 6f 6e 6c | 79 20 73 75 70 65 72 66 |bear onl|y superf| |000061f0| 69 63 69 61 6c 20 73 69 | 6d 69 6c 69 61 72 69 74 |icial si|miliarit| |00006200| 69 65 73 20 74 6f 20 5c | 2e 7b 55 4e 49 58 7d 20 |ies to \|.{UNIX} | |00006210| 73 79 6d 62 6f 6c 69 63 | 20 6c 69 6e 6b 73 2c 20 |symbolic| links, | |00006220| 65 73 70 65 63 69 61 6c | 6c 79 0d 6f 6e 63 65 20 |especial|ly.once | |00006230| 79 6f 75 20 73 74 61 72 | 74 20 72 65 6e 61 6d 69 |you star|t renami| |00006240| 6e 67 20 66 69 6c 65 73 | 2e 0d 0d 40 20 7c 69 6e |ng files|...@ |in| |00006250| 74 20 72 65 61 64 6c 69 | 6e 6b 28 63 68 61 72 2a |t readli|nk(char*| |00006260| 20 70 61 74 68 2c 20 63 | 68 61 72 2a 20 62 75 66 | path, c|har* buf| |00006270| 2c 20 69 6e 74 20 62 75 | 66 73 69 7a 29 7c 20 72 |, int bu|fsiz)| r| |00006280| 65 74 75 72 6e 73 20 69 | 6e 20 7c 62 75 66 7c 20 |eturns i|n |buf| | |00006290| 74 68 65 20 6e 61 6d 65 | 20 6f 66 20 74 68 65 0d |the name| of the.| |000062a0| 66 69 6c 65 20 74 68 61 | 74 20 7c 70 61 74 68 7c |file tha|t |path|| |000062b0| 20 70 6f 69 6e 74 73 20 | 74 6f 2e 0d 0d 40 20 7c | points |to...@ || |000062c0| 69 6e 74 20 6d 6b 64 69 | 72 28 63 68 61 72 20 2a |int mkdi|r(char *| |000062d0| 20 70 61 74 68 29 7c 20 | 63 72 65 61 74 65 73 20 | path)| |creates | |000062e0| 61 20 6e 65 77 20 64 69 | 72 65 63 74 6f 72 79 2e |a new di|rectory.| |000062f0| 0d 0d 40 20 7c 69 6e 74 | 20 72 6d 64 69 72 28 63 |..@ |int| rmdir(c| |00006300| 68 61 72 20 2a 20 70 61 | 74 68 29 7c 20 64 65 6c |har * pa|th)| del| |00006310| 65 74 65 73 20 61 6e 20 | 65 6d 70 74 79 20 64 69 |etes an |empty di| |00006320| 72 65 63 74 6f 72 79 2e | 0d 0d 40 20 7c 69 6e 74 |rectory.|..@ |int| |00006330| 20 63 68 64 69 72 28 63 | 68 61 72 20 2a 20 70 61 | chdir(c|har * pa| |00006340| 74 68 29 7c 20 6d 61 6b | 65 73 20 61 6c 6c 20 66 |th)| mak|es all f| |00006350| 75 74 75 72 65 20 70 61 | 72 74 69 61 6c 20 70 61 |uture pa|rtial pa| |00006360| 74 68 6e 61 6d 65 73 20 | 72 65 6c 61 74 69 76 65 |thnames |relative| |00006370| 20 66 72 6f 6d 20 74 68 | 69 73 0d 64 69 72 65 63 | from th|is.direc| |00006380| 74 6f 72 79 2e 0d 0d 40 | 20 7c 63 68 61 72 20 2a |tory...@| |char *| |00006390| 20 67 65 74 63 77 64 28 | 63 68 61 72 20 2a 20 62 | getcwd(|char * b| |000063a0| 75 66 2c 20 69 6e 74 20 | 73 69 7a 65 29 7c 20 72 |uf, int |size)| r| |000063b0| 65 74 75 72 6e 73 20 61 | 20 70 6f 69 6e 74 65 72 |eturns a| pointer| |000063c0| 20 74 6f 20 74 68 65 20 | 63 75 72 72 65 6e 74 20 | to the |current | |000063d0| 64 69 72 65 63 74 6f 72 | 79 0d 70 61 74 68 6e 61 |director|y.pathna| |000063e0| 6d 65 2e 20 49 66 20 7c | 62 75 66 7c 20 69 73 20 |me. If ||buf| is | |000063f0| 7c 4e 55 4c 4c 7c 2c 20 | 7c 73 69 7a 65 7c 20 62 ||NULL|, ||size| b| +--------+-------------------------+-------------------------+--------+--------+ Only 25.0 KB of data is shown above.