%!PS %%Version: 3.3.2 %%DocumentFonts: (atend) %%Pages: (atend) %%EndComments % % Version 3.3.2 prologue for troff files. % /#copies 1 store /aspectratio 1 def /formsperpage 1 def /landscape false def /linewidth .3 def /magnification 1 def /margin 0 def /orientation 0 def /resolution 720 def /rotation 1 def /xoffset 0 def /yoffset 0 def /roundpage true def /useclippath true def /pagebbox [0 0 612 792] def /R /Times-Roman def /I /Times-Italic def /B /Times-Bold def /BI /Times-BoldItalic def /H /Helvetica def /HI /Helvetica-Oblique def /HB /Helvetica-Bold def /HX /Helvetica-BoldOblique def /CW /Courier def /CO /Courier def /CI /Courier-Oblique def /CB /Courier-Bold def /CX /Courier-BoldOblique def /PA /Palatino-Roman def /PI /Palatino-Italic def /PB /Palatino-Bold def /PX /Palatino-BoldItalic def /Hr /Helvetica-Narrow def /Hi /Helvetica-Narrow-Oblique def /Hb /Helvetica-Narrow-Bold def /Hx /Helvetica-Narrow-BoldOblique def /KR /Bookman-Light def /KI /Bookman-LightItalic def /KB /Bookman-Demi def /KX /Bookman-DemiItalic def /AR /AvantGarde-Book def /AI /AvantGarde-BookOblique def /AB /AvantGarde-Demi def /AX /AvantGarde-DemiOblique def /NR /NewCenturySchlbk-Roman def /NI /NewCenturySchlbk-Italic def /NB /NewCenturySchlbk-Bold def /NX /NewCenturySchlbk-BoldItalic def /ZD /ZapfDingbats def /ZI /ZapfChancery-MediumItalic def /S /S def /S1 /S1 def /GR /Symbol def /inch {72 mul} bind def /min {2 copy gt {exch} if pop} bind def /show {show} bind def % so later references don't bind /widthshow {widthshow} bind def /stringwidth {stringwidth} bind def /setup { counttomark 2 idiv {def} repeat pop landscape {/orientation 90 orientation add def} if /scaling 72 resolution div def linewidth setlinewidth 1 setlinecap pagedimensions xcenter ycenter translate orientation rotation mul rotate width 2 div neg height 2 div translate xoffset inch yoffset inch neg translate margin 2 div dup neg translate magnification dup aspectratio mul scale scaling scaling scale addmetrics 0 0 moveto } def /pagedimensions { useclippath userdict /gotpagebbox known not and { /pagebbox [clippath pathbbox newpath] def roundpage currentdict /roundpagebbox known and {roundpagebbox} if } if pagebbox aload pop 4 -1 roll exch 4 1 roll 4 copy landscape {4 2 roll} if sub /width exch def sub /height exch def add 2 div /xcenter exch def add 2 div /ycenter exch def userdict /gotpagebbox true put } def /addmetrics { /Symbol /S null Sdefs cf /Times-Roman /S1 StandardEncoding dup length array copy S1defs cf } def /pagesetup { /page exch def currentdict /pagedict known currentdict page known and { page load pagedict exch get cvx exec } if } def /decodingdefs [ {counttomark 2 idiv {y moveto show} repeat} {neg /y exch def counttomark 2 idiv {y moveto show} repeat} {neg moveto {2 index stringwidth pop sub exch div 0 32 4 -1 roll widthshow} repeat} {neg moveto {spacewidth sub 0.0 32 4 -1 roll widthshow} repeat} {counttomark 2 idiv {y moveto show} repeat} {neg setfunnytext} ] def /setdecoding {/t decodingdefs 3 -1 roll get bind def} bind def /w {neg moveto show} bind def /m {neg dup /y exch def moveto} bind def /done {/lastpage where {pop lastpage} if} def /f { dup /font exch def findfont exch dup /ptsize exch def scaling div dup /size exch def scalefont setfont linewidth ptsize mul scaling 10 mul div setlinewidth /spacewidth ( ) stringwidth pop def } bind def /changefont { /fontheight exch def /fontslant exch def currentfont [ 1 0 fontheight ptsize div fontslant sin mul fontslant cos div fontheight ptsize div 0 0 ] makefont setfont } bind def /sf {f} bind def /cf { dup length 2 idiv /entries exch def /chtab exch def /newencoding exch def /newfont exch def findfont dup length 1 add dict /newdict exch def {1 index /FID ne {newdict 3 1 roll put}{pop pop} ifelse} forall newencoding type /arraytype eq {newdict /Encoding newencoding put} if newdict /Metrics entries dict put newdict /Metrics get begin chtab aload pop 1 1 entries {pop def} for newfont newdict definefont pop end } bind def % % A few arrays used to adjust reference points and character widths in some % of the printer resident fonts. If square roots are too high try changing % the lines describing /radical and /radicalex to, % % /radical [0 -75 550 0] % /radicalex [-50 -75 500 0] % % Move braceleftbt a bit - default PostScript character is off a bit. % /Sdefs [ /bracketlefttp [201 500] /bracketleftbt [201 500] /bracketrighttp [-81 380] /bracketrightbt [-83 380] /braceleftbt [203 490] /bracketrightex [220 -125 500 0] /radical [0 0 550 0] /radicalex [-50 0 500 0] /parenleftex [-20 -170 0 0] /integral [100 -50 500 0] /infinity [10 -75 730 0] ] def /S1defs [ /underscore [0 80 500 0] /endash [7 90 650 0] ] def % % Tries to round clipping path dimensions, as stored in array pagebbox, so they % match one of the known sizes in the papersizes array. Lower left coordinates % are always set to 0. % /roundpagebbox { 7 dict begin /papersizes [8.5 inch 11 inch 14 inch 17 inch] def /mappapersize { /val exch def /slop .5 inch def /diff slop def /j 0 def 0 1 papersizes length 1 sub { /i exch def papersizes i get val sub abs dup diff le {/diff exch def /j i def} {pop} ifelse } for diff slop lt {papersizes j get} {val} ifelse } def pagebbox 0 0 put pagebbox 1 0 put pagebbox dup 2 get mappapersize 2 exch put pagebbox dup 3 get mappapersize 3 exch put end } bind def %%EndProlog %%BeginSetup mark /linewidth 0.5 def /#copies 1 store /landscape false def /resolution 720 def % % Encoding vector and redefinition of findfont for the ISO Latin1 standard. % The 18 characters missing from ROM based fonts on older printers are noted % below. % /ISOLatin1Encoding [ /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /space /exclam /quotedbl /numbersign /dollar /percent /ampersand /quoteright /parenleft /parenright /asterisk /plus /comma /minus /period /slash /zero /one /two /three /four /five /six /seven /eight /nine /colon /semicolon /less /equal /greater /question /at /A /B /C /D /E /F /G /H /I /J /K /L /M /N /O /P /Q /R /S /T /U /V /W /X /Y /Z /bracketleft /backslash /bracketright /asciicircum /underscore /quoteleft /a /b /c /d /e /f /g /h /i /j /k /l /m /n /o /p /q /r /s /t /u /v /w /x /y /z /braceleft /bar /braceright /asciitilde /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /dotlessi /grave /acute /circumflex /tilde /macron /breve /dotaccent /dieresis /.notdef /ring /cedilla /.notdef /hungarumlaut /ogonek /caron /space /exclamdown /cent /sterling /currency /yen /brokenbar % missing /section /dieresis /copyright /ordfeminine /guillemotleft /logicalnot /hyphen /registered /macron /degree % missing /plusminus % missing /twosuperior % missing /threesuperior % missing /acute /mu % missing /paragraph /periodcentered /cedilla /onesuperior % missing /ordmasculine /guillemotright /onequarter % missing /onehalf % missing /threequarters % missing /questiondown /Agrave /Aacute /Acircumflex /Atilde /Adieresis /Aring /AE /Ccedilla /Egrave /Eacute /Ecircumflex /Edieresis /Igrave /Iacute /Icircumflex /Idieresis /Eth % missing /Ntilde /Ograve /Oacute /Ocircumflex /Otilde /Odieresis /multiply % missing /Oslash /Ugrave /Uacute /Ucircumflex /Udieresis /Yacute % missing /Thorn % missing /germandbls /agrave /aacute /acircumflex /atilde /adieresis /aring /ae /ccedilla /egrave /eacute /ecircumflex /edieresis /igrave /iacute /icircumflex /idieresis /eth % missing /ntilde /ograve /oacute /ocircumflex /otilde /odieresis /divide % missing /oslash /ugrave /uacute /ucircumflex /udieresis /yacute % missing /thorn % missing /ydieresis ] def /NewFontDirectory FontDirectory maxlength dict def % % Apparently no guarantee findfont is defined in systemdict so the obvious % % systemdict /findfont get exec % % can generate an error. So far the only exception is a VT600 (version 48.0). % userdict /@RealFindfont known not { userdict begin /@RealFindfont systemdict begin /findfont load end def end } if /findfont { dup NewFontDirectory exch known not { dup %dup systemdict /findfont get exec % not always in systemdict dup userdict /@RealFindfont get exec dup /Encoding get StandardEncoding eq { dup length dict begin {1 index /FID ne {def}{pop pop} ifelse} forall /Encoding ISOLatin1Encoding def currentdict end /DummyFontName exch definefont } if NewFontDirectory 3 1 roll put } if NewFontDirectory exch get } bind def setup 2 setdecoding %%EndSetup %%Page: 1 1 /saveobj save def mark 1 pagesetup 12 B f (APE)1856 1220 w 12 S1 f (\320)2125 1220 w 12 B f (The ANSI/POSIX Environment)2 1628 1 2275 1220 t 10 I f (Howard Trickey)1 652 1 2554 1480 t 10 B f (Introduction)720 2140 w 10 R f ( or exported to and from Plan 9, the)8 1495(When a large or frequently\255updated program must be imported)8 2575 2 970 2296 t ( of headers and object code)5 1093( combines the set)3 697( APE)1 241(ANSI/POSIX environment known as APE can be useful.)7 2289 4 720 2416 t ( system interface)2 678(libraries specified by the ANSI C standard \(ANSI X3.159\2551989\) with the POSIX operating)12 3642 2 720 2536 t ( cause slower compilation and marginally)5 1767( APE will)2 437( Using)1 310(standard \(IEEE 1003.1\2551990, ISO 9945\2551\).)4 1806 4 720 2656 t ( the importing or exporting happens only infrequently, due consideration)9 3061(slower execution speeds, so if)4 1259 2 720 2776 t ( factor to consider is)4 843( Another)1 384(should be given to using the usual Plan 9 compilation environment instead.)11 3093 3 720 2896 t (that the Plan 9 header organization is much simpler to remember and use.)12 2937 1 720 3016 t ( hard to simulate in)4 796(There are some aspectes of required POSIX behavior that are impossible or very)12 3274 2 970 3172 t ( has shown, however, that the simulation is adequate for the)10 2421( Experience)1 501( described below.)2 707( are)1 150( They)1 259(Plan 9.)1 282 6 720 3292 t ( use functions or head\255)4 917( much more common problem is that many programs)8 2134( The)1 206(vast majority of programs.)3 1063 4 720 3412 t ( has some extensions to POSIX to help in this regard.)10 2135( APE)1 239(ers not defined by POSIX.)4 1057 3 720 3532 t 10 B f (Pcc)720 3772 w 10 R f (The)970 3928 w 10 CW f (pcc)1161 3928 w 10 R f ( an ANSI C)3 505( runs)1 208( It)1 122(command acts as a front end to the Plan 9 C compilers and loaders.)13 2828 4 1377 3928 t (preprecessor over source files, using the APE headers to satisfy)9 2569 1 720 4048 t 10 CW f (#include <)1 604 1 3318 4048 t 10 I f (file)3922 4048 w 10 CW f (>)4050 4048 w 10 R f ( it runs)2 284(directives; then)1 617 2 4139 4048 t ( docu\255)1 257( The)1 210( to produce an executable program.)5 1432(a Plan 9 C compiler; finally, it may load with APE libraries)11 2421 4 720 4168 t (ment)720 4288 w 10 I f (How to Use the Plan 9 C Compiler)7 1473 1 956 4288 t 10 R f (explains how environment variables are used by convention to)8 2576 1 2464 4288 t ( environment variable)2 890( The)1 211(handle compilation for differing architectures.)4 1867 3 720 4408 t 10 CW f ($objtype)3720 4408 w 10 R f (controls which Plan)2 808 1 4232 4408 t (9 compiler and loader are used by)6 1382 1 720 4528 t 10 CW f (pcc)2132 4528 w 10 R f ( example, if)2 482( For)1 193( well as the location of header and library files.)9 1915(, as)1 138 4 2312 4528 t 10 CW f ($objtype)720 4648 w 10 R f (is)1253 4648 w 10 CW f (mips)1373 4648 w 10 R f (, then)1 250 1 1613 4648 t 10 CW f (pcc)1916 4648 w 10 R f (has)2149 4648 w 10 CW f (cpp)2335 4648 w 10 R f (look for headers in)3 835 1 2568 4648 t 10 CW f (/mips/include/ape)3457 4648 w 10 R f (followed by)1 509 1 4531 4648 t 10 CW f (/sys/include/ape)720 4768 w 10 R f (; then)1 234 1 1680 4768 t 10 CW f (pcc)1948 4768 w 10 R f (uses)2162 4768 w 10 CW f (vc)2368 4768 w 10 R f (to create)1 349 1 2522 4768 t 10 CW f (.v)2905 4768 w 10 R f (object files; finally,)2 798 1 3059 4768 t 10 CW f (vl)3891 4768 w 10 R f (is used to create an exe\255)5 995 1 4045 4768 t (cutable using libraries in)3 985 1 720 4888 t 10 CW f (/mips/lib/ape)1730 4888 w 10 R f (.)2510 4888 w 10 B f (Symbols)720 5128 w 10 R f ( also require)2 515( They)1 266(The C and POSIX standards require that certain symbols be defined in headers.)12 3289 3 970 5284 t ( other symbols that)3 785(that certain other classes of symbols not be defined in the headers, and specify certain)14 3535 2 720 5404 t ( defines)1 327( POSIX)1 353( defined in headers at the discretion of the implementation.)9 2478(may be)1 304 4 720 5524 t 10 I f (feature test macros)2 794 1 4221 5524 t 10 R f (,)5015 5524 w ( the program)2 538( if)1 126(which are preprocessor symbols beginning with an underscore and then a capital letter;)12 3656 3 720 5644 t 10 CW f (#define)720 5764 w 10 R f ( the inclusion of any headers, then it is requesting that certain sym\255)12 2749(s a feature test macro before)5 1151 2 1140 5764 t ( most important feature test macro is)6 1549( The)1 219(bols be visible in the headers.)5 1252 3 720 5884 t 10 CW f (_POSIX_SOURCE)3779 5884 w 10 R f (: when it is)3 481 1 4559 5884 t ( Consider)1 446( are visible in the appropriate headers.)6 1731(defined, exactly the symbols required by POSIX)6 2143 3 720 6004 t 10 CW f ()720 6124 w 10 R f (for example: ANSI defines some names that must be defined in)10 2565 1 1349 6124 t 10 CW f ()3942 6124 w 10 R f (, but POSIX)2 498 1 4542 6124 t (defines others, such as)3 904 1 720 6244 t 10 CW f (sigset_t)1651 6244 w 10 R f ( solution is to make the)5 946( The)1 208( according to ANSI.)3 813(, which are not allowed)4 942 4 2131 6244 t (additional symbols visible only when)4 1495 1 720 6364 t 10 CW f (_POSIX_SOURCE)2240 6364 w 10 R f (is defined.)1 416 1 3045 6364 t ( helps to know whether the program fits in one of the following cate\255)13 2819(When you export a program, it)5 1251 2 970 6520 t (gories:)720 6640 w ( C program. It only uses features of the language, libraries, and headers)12 3002( conforming ANSI)2 773(1. Strictly)1 545 3 720 6796 t ( depend on unspecified, undefined, or)5 1735( does not)2 455( It)1 158(explicitly required by the C standard.)5 1722 4 970 6916 t (implementation\255dependent behavior, and does not exceed any minimum implementation limit.)9 3778 1 970 7036 t ( conforming POSIX program. Similar, but for the POSIX standard.)9 2681(2. Strictly)1 545 2 720 7192 t cleartomark showpage saveobj restore %%EndPage: 1 1 %%Page: 2 2 /saveobj save def mark 2 pagesetup 10 R f (\255 2 \255)2 166 1 2797 480 t ( extension is selected by a feature test macro, so it is)11 2113( Each)1 250( superset of POSIX, with extensions.)5 1479(3. Some)1 478 4 720 840 t (clear which extensions are being used.)5 1535 1 970 960 t ( then the set of feature)5 894(With APE, if headers are always included to declare any library functions used,)12 3176 2 970 1116 t ( accom\255)1 326( To)1 169( defined by a program will show which of the above categories the program is in.)15 3364(test macros)1 461 4 720 1236 t ( it not required by the C or POSIX standard, and those)11 2368(plish this, no symbol is defined in a header if)9 1952 2 720 1356 t ( by)1 174(required by the POSIX standard are protected)6 2123 2 720 1476 t 10 CW f (#ifdef _POSIX_SOURCE)1 1249 1 3091 1476 t 10 R f ( example,)1 437(. For)1 263 2 4340 1476 t 10 CW f ()720 1596 w 10 R f (defines)1290 1596 w 10 CW f (EDOM)1608 1596 w 10 R f (,)1848 1596 w 10 CW f (ERANGE)1903 1596 w 10 R f (, and)1 199 1 2263 1596 t 10 CW f (errno)2492 1596 w 10 R f ( C standard allows)3 759( The)1 211(, as required by the C standard.)6 1278 3 2792 1596 t (more names beginning with)3 1137 1 720 1716 t 10 CW f (E)1890 1716 w 10 R f (, but our header defines only those unless)7 1709 1 1950 1716 t 10 CW f (_POSIX_SOURCE)3692 1716 w 10 R f (is defined, in)2 535 1 4505 1716 t ( means that a program which uses)6 1407( This)1 237( by POSIX are defined.)4 970(which case the 35 more symbols required)6 1706 4 720 1836 t 10 CW f (ENAMETOOLONG)720 1956 w 10 R f (cannot masquerade as a strictly conforming ANSI C program.)8 2476 1 1465 1956 t 10 CW f (Pcc)970 2112 w 10 R f ( those required by the ANSI C standard:)7 1697(does not predefine any preprocessor symbols except)6 2156 2 1187 2112 t 10 CW f (__STDC__)720 2232 w 10 R f (,)1200 2232 w 10 CW f (__LINE__)1261 2232 w 10 R f (,)1741 2232 w 10 CW f (__FILE__)1802 2232 w 10 R f (,)2282 2232 w 10 CW f (__DATE__)2342 2232 w 10 R f (, and)1 204 1 2822 2232 t 10 CW f (__TIME__)3061 2232 w 10 R f ( others must be defined in the)6 1242(. Any)1 257 2 3541 2232 t (program itself or using)3 913 1 720 2352 t 10 CW f (\255D)1658 2352 w 10 R f (on the command line.)3 866 1 1803 2352 t 10 B f (Extensions)720 2592 w 10 R f ( required names in the headers is useful for exporting pro\255)10 2437(The pedagogy enforced by only putting)5 1633 2 970 2748 t ( symbols in)2 466( compromise is to allow additional)5 1401( The)1 208(grams, but it gets in the way when importing programs.)9 2245 4 720 2868 t ( but only under control of extension feature test)8 1905(headers, additional headers, and additional library functions,)6 2415 2 720 2988 t ( unless otherwise specified, the additional library functions)7 2372( following extensions are provided;)4 1427(macros. The)1 521 3 720 3108 t (are in the default APE library.)5 1203 1 720 3228 t 10 S1 f (\261)795 3384 w 10 CW f (_LIBG_EXTENSION)970 3384 w 10 R f ( functions are as)3 708( The)1 224( graphics library.)2 717( allows the use of the Plan 9)7 1250(. This)1 271 5 1870 3384 t (described in the Plan 9 manual \(see)6 1420 1 970 3504 t 10 I f (graphics)2416 3504 w 10 R f (\(2\)\) except that)2 611 1 2766 3504 t 10 CW f (div)3402 3504 w 10 R f (had to be renamed)3 734 1 3607 3504 t 10 CW f (ptdiv)4366 3504 w 10 R f (. Include)1 374 1 4666 3504 t (the)970 3624 w 10 CW f ()1118 3624 w 10 R f ( declare the needed types and functions, and use)8 1936(header to)1 369 2 1624 3624 t 10 CW f (\255lg)3956 3624 w 10 R f (on the)1 249 1 4163 3624 t 10 CW f (pcc)4439 3624 w 10 R f (command)4646 3624 w (line to load the graphics functions.)5 1382 1 970 3744 t 10 S1 f (\261)795 3900 w 10 CW f (_LIMITS_EXTENSION)970 3900 w 10 R f ( does not require that names such as)7 1481(. POSIX)1 370 2 1990 3900 t 10 CW f (PATH_MAX)3872 3900 w 10 R f (and)4384 3900 w 10 CW f (OPEN_MAX)4560 3900 w 10 R f (be defined in)2 647 1 970 4020 t 10 CW f ()1704 4020 w 10 R f ( If)1 178(, but many programs assume they are defined there.)8 2558 2 2304 4020 t 10 CW f (_LIMITS_EXTENSION)970 4140 w 10 R f (is defined, those names will all be defined when)8 2202 1 2050 4140 t 10 CW f ()4312 4140 w 10 R f (is)4973 4140 w (included.)970 4260 w 10 S1 f (\261)795 4416 w 10 CW f (_BSDTIME_EXTENSION)970 4416 w 10 R f ( header)1 295(. The)1 235 2 2050 4416 t 10 CW f ()2610 4416 w 10 R f ( extension)1 414( This)1 234(is not defined by POSIX.)4 1032 3 3360 4416 t (allows the inclusion of that header, with its definitions of the)10 2429 1 970 4536 t 10 CW f (timeval)3424 4536 w 10 R f (and)3869 4536 w 10 CW f (timezone)4038 4536 w 10 R f (structures.)4543 4536 w 10 S1 f (\261)795 4692 w 10 CW f (_SELECT_EXTENSION)970 4692 w 10 R f ( extension allows the inclusion of the)6 1548(. This)1 263 2 1990 4692 t 10 CW f ()3836 4692 w 10 R f (header, which)1 569 1 4471 4692 t (defines the Berkeley)2 846 1 970 4812 t 10 CW f (select)1854 4812 w 10 R f ( and macros for dealing with multiple)6 1576(function and associated types)3 1212 2 2252 4812 t ( The)1 239(input sources.)1 589 2 970 4932 t 10 CW f ()1857 4932 w 10 R f (header must be included before)4 1388 1 2636 4932 t 10 CW f ()4084 4932 w 10 R f (, so the)2 356 1 4684 4932 t 10 CW f (_BSDTIME_EXTENSION)970 5052 w 10 R f (is needed too.)2 552 1 2075 5052 t 10 S1 f (\261)795 5208 w 10 CW f (_PCONS_EXTENSION)970 5208 w 10 R f ( If)1 149( defines a ``pseudo\255tty'' capability.)4 1533(. This)1 285 3 1930 5208 t 10 CW f (_PCONS_EXTENSION)3955 5208 w 10 R f (is)4973 5208 w (defined,)970 5328 w 10 CW f ()1387 5328 w 10 R f ( the functions)2 678(may be included; it defines)4 1354 2 2020 5328 t 10 CW f (pcons\(void\))4144 5328 w 10 R f (and)4896 5328 w 10 CW f (pushtty\(void\). Pcons)1 1189 1 970 5448 t 10 R f ( the)1 172(arranges for a Plan 9 file server to provide)8 1876 2 2208 5448 t 10 CW f (/dev/cons)4306 5448 w 10 R f (and)4896 5448 w 10 CW f (/dev/consctl)970 5568 w 10 R f ( also provides)2 573(files. It)1 317 2 1724 5568 t 10 CW f (/dev/mcons)2648 5568 w 10 R f ( pseudo\255)1 349(, which is the ``master end'' of the)7 1443 2 3248 5568 t (tty: characters written to)3 982 1 970 5688 t 10 CW f (/dev/mcons)1980 5688 w 10 R f ( from)1 223(can be read)2 459 2 2608 5688 t 10 CW f (/dev/cons)3319 5688 w 10 R f (\(or)3888 5688 w 10 CW f (/dev/tty)4033 5688 w 10 R f (, a synonym\))2 527 1 4513 5688 t ( the contents of a)4 694( tty line processing is supported:)5 1317( POSIX)1 343(and vice versa.)2 603 4 970 5808 t 10 CW f (termios)3955 5808 w 10 R f (structure can be)2 637 1 4403 5808 t (written to or read from the)5 1056 1 970 5928 t 10 CW f (/dev/pttyctl)2051 5928 w 10 R f (file in the format)3 674 1 2796 5928 t 9 CW f ("stty %8ux %8ux %8ux %8ux ")5 1458 1 1258 6098 t 10 R f (\(the numbers are the)3 829 1 970 6278 t 10 CW f (c_iflag)1828 6278 w 10 R f (,)2248 6278 w 10 CW f (c_oflag)2302 6278 w 10 R f (,)2722 6278 w 10 CW f (c_cflag)2776 6278 w 10 R f (, and)1 198 1 3196 6278 t 10 CW f (c_lflag)3423 6278 w 10 R f (\), followed by)2 573 1 3843 6278 t 10 CW f (NCCS)4446 6278 w 10 R f (bytes of)1 324 1 4716 6278 t 10 CW f (c_cc)970 6398 w 10 R f (data. The)1 398 1 1237 6398 t 10 CW f (pushtty)1662 6398 w 10 R f (function uses)1 532 1 2109 6398 t 10 CW f (pcons)2668 6398 w 10 R f ( the standard input, output, and error)6 1465(to arrange that)2 580 2 2995 6398 t ( done explicitly,)2 651( should not have to be)5 885( \(This)1 262(files behave as ttys are supposed to according to POSIX.)9 2272 4 970 6518 t (but the cost of supporting)4 1034 1 970 6638 t 10 CW f (tcgetattr)2032 6638 w 10 R f (and)2600 6638 w 10 CW f (tcputattr)2772 6638 w 10 R f ( high that it seemed better to)6 1150(is sufficiently)1 550 2 3340 6638 t (not make it the default.\))4 957 1 970 6758 t 10 S1 f (\261)795 6914 w 10 CW f (_NET_EXTENSION)970 6914 w 10 R f ( extension allows inclusion of)4 1202(. This)1 254 2 1810 6914 t 10 CW f ()3293 6914 w 10 R f (, which defines the network\255)4 1147 1 3893 6914 t ( page)1 214(ing functions described in the Plan 9 manual)7 1793 2 970 7034 t 10 I f (dial)3003 7034 w 10 R f ( using them must be loaded with)6 1306(\(2\). Programs)1 575 2 3159 7034 t 10 CW f (\255lnet)970 7154 w 10 R f (.)1270 7154 w 10 S1 f (\261)795 7310 w 10 CW f (_REGEXP_EXTENSION)970 7310 w 10 R f ( extension allows inclusion of)4 1214(. This)1 257 2 1990 7310 t 10 CW f ()3491 7310 w 10 R f (, which defines the)3 769 1 4271 7310 t cleartomark showpage saveobj restore %%EndPage: 2 2 %%Page: 3 3 /saveobj save def mark 3 pagesetup 10 R f (\255 3 \255)2 166 1 2797 480 t ( matching functions described in the Plan 9 manual page)9 2360(regular expression)1 746 2 970 840 t 10 I f (regexp)4112 840 w 10 R f (\(2X\). Programs)1 657 1 4383 840 t (using them must be loaded with)5 1275 1 970 960 t 10 CW f (\255lregexp)2270 960 w 10 R f (.)2750 960 w 10 S1 f (\261)795 1116 w 10 CW f (_RESEARCH_SOURCE)970 1116 w 10 R f ( Tenth Edition)2 592( extension enables a small library of functions from the)9 2259(. This)1 259 3 1930 1116 t ( functions and the types needed to use them are all defined in)12 2548( These)1 297(Unix Research System \(V10\).)3 1225 3 970 1236 t (the)970 1356 w 10 CW f ()1120 1356 w 10 R f (header, and programs using them must be loaded with)8 2185 1 1628 1356 t 10 CW f (\255lv)3841 1356 w 10 R f ( provided functions)2 785(. The)1 234 2 4021 1356 t (are:)970 1476 w 10 CW f (popen)1148 1476 w 10 R f (and)1477 1476 w 10 CW f (pclose)1650 1476 w 10 R f ( the)1 150(\(common extensions to ANSI C stdio;)5 1551 2 2039 1476 t 10 CW f ()3768 1476 w 10 R f (header must have)2 704 1 4336 1476 t (been included\);)1 638 1 970 1596 t 10 CW f (telldir)1654 1596 w 10 R f (and)2120 1596 w 10 CW f (seekdir)2310 1596 w 10 R f (\(common extensions to the ANSI C)5 1535 1 2776 1596 t 10 CW f (readdir)4357 1596 w 10 R f (suite;)4823 1596 w 10 CW f ()970 1716 w 10 R f (must have been included\);)3 1093 1 1609 1716 t 10 CW f (lstat)2741 1716 w 10 R f (,)3041 1716 w 10 CW f (symlink)3105 1716 w 10 R f (, and)1 208 1 3525 1716 t 10 CW f (readlink)3772 1716 w 10 R f (\(dummy functions)1 749 1 4291 1716 t ( 9, since there are no symbolic links\);)7 1561(for Plan)1 327 2 970 1836 t 10 CW f (srand)2892 1836 w 10 R f (,)3192 1836 w 10 CW f (rand)3251 1836 w 10 R f (,)3491 1836 w 10 CW f (nrand)3550 1836 w 10 R f (,)3850 1836 w 10 CW f (lrand)3909 1836 w 10 R f (, and)1 203 1 4209 1836 t 10 CW f (frand)4446 1836 w 10 R f (\(better)4780 1836 w (random number generators\);)2 1198 1 970 1956 t 10 CW f (getopt)2224 1956 w 10 R f (\(program argument handler\);)2 1220 1 2640 1956 t 10 CW f (getpass)3915 1956 w 10 R f (,)4335 1956 w 10 CW f (tty_echoon)4415 1956 w 10 R f (,)5015 1956 w 10 CW f (tty_echooff)970 2076 w 10 R f ( characteristics\);)1 657(\(for dealing with the common needs for mucking with terminal)9 2522 2 1655 2076 t 10 CW f (min)4860 2076 w 10 R f (and)970 2196 w 10 CW f (max)1146 2196 w 10 R f (;)1326 2196 w 10 CW f (nap)1386 2196 w 10 R f (;)1566 2196 w 10 CW f (setfields)1626 2196 w 10 R f (,)2166 2196 w 10 CW f (getfields)2223 2196 w 10 R f (, and)1 201 1 2763 2196 t 10 CW f (getmfields)2996 2196 w 10 R f (\(for parsing a line into fields\); and)6 1412 1 3628 2196 t 10 CW f (ftw)970 2316 w 10 R f ( the Research Unix Programmer's Manual for a description of these)10 2715( See)1 195(\(for walking a file tree\).)4 955 3 1175 2316 t (functions.)970 2436 w 10 B f (Common Problems)1 824 1 720 2676 t 10 R f ( prob\255)1 248( The)1 212( ported successfully to Plan 9 using APE.)7 1704(Some large systems, including X11, have been)6 1906 4 970 2832 t (lems encountered fall into three categories: \(1\) non\255 ANSI C/POSIX features used; \(2\) inadequate simula\255)14 4320 1 720 2952 t ( cat\255)1 177( far the majority of problems are in the first)9 1751( By)1 169(tion of POSIX functions; and \(3\) compiler/loader bugs.)7 2223 4 720 3072 t (egory.)720 3192 w ( existing code is written to work with one)8 1668( Most)1 257( target for programmers.)3 978(POSIX is just starting to be a)6 1167 4 970 3348 t ( is fairly close to POSIX, but there are some differences.)10 2296( V)1 102( System)1 350(or both of a BSD or a System V Unix.)9 1572 4 720 3468 t ( are)1 159( Here)1 256( some BSD features that are not part of POSIX.)9 2014(Also, many System V systems have imported)6 1891 4 720 3588 t (some common non\255POSIX things used in current programs, and what to do about them.)13 3511 1 720 3708 t 10 S1 f (\261)795 3864 w 10 CW f (sys_errlist)970 3864 w 10 R f (and)1655 3864 w 10 CW f (sys_nerr)1824 3864 w 10 R f (globals. Use)1 519 1 2329 3864 t 10 CW f (strerror)2873 3864 w 10 R f (instead.)3378 3864 w 10 S1 f (\261)795 4020 w 10 R f (Third \(environment\) argument to)3 1323 1 970 4020 t 10 CW f (main)2318 4020 w 10 R f ( the)1 147(. Use)1 230 2 2558 4020 t 10 CW f (environ)2960 4020 w 10 R f (global instead.)1 583 1 3405 4020 t 10 S1 f (\261)795 4176 w 10 CW f (OPEN_MAX)970 4176 w 10 R f (,)1450 4176 w 10 CW f (PATH_MAX)1523 4176 w 10 R f (, etc., assumed in)3 757 1 2003 4176 t 10 CW f ()2808 4176 w 10 R f ( call)1 193( to)1 126(. Rewrite)1 414 3 3408 4176 t 10 CW f (sysconf)4190 4176 w 10 R f (or define)1 381 1 4659 4176 t 10 CW f (_LIMITS_EXTENSION)970 4296 w 10 R f (.)1990 4296 w 10 S1 f (\261)795 4452 w 10 CW f (isascii)970 4452 w 10 R f (assumed in)1 452 1 1420 4452 t 10 CW f ()1902 4452 w 10 R f ( con\255)1 208( the dead codeset go: leave the test out, or better still,)11 2177(. Let)1 213 3 2442 4452 t ( define your own)3 679( Or)1 155(vert to use multibyte characters \(c.f. runes in Plan 9\).)9 2118 3 970 4572 t 10 CW f (isascii)3947 4572 w 10 R f (macro.)4392 4572 w 10 S1 f (\261)795 4728 w 10 CW f ()970 4728 w 10 R f (,)1630 4728 w 10 CW f (index)1680 4728 w 10 R f (, and)1 194 1 1980 4728 t 10 CW f (rindex)2199 4728 w 10 R f (. Use)1 230 1 2559 4728 t 10 CW f ()2814 4728 w 10 R f (,)3414 4728 w 10 CW f (strchr)3464 4728 w 10 R f (, and)1 194 1 3824 4728 t 10 CW f (strrchr)4043 4728 w 10 R f (instead.)4488 4728 w 10 S1 f (\261)795 4884 w 10 CW f (mktemp)970 4884 w 10 R f ( to use ANSI C)4 611(. Rewrite)1 391 2 1330 4884 t 10 CW f (tempnam)2357 4884 w 10 R f (or)2802 4884 w 10 CW f (tmpfile)2910 4884 w 10 R f (.)3330 4884 w 10 S1 f (\261)795 5040 w 10 CW f ()970 5040 w 10 R f ( to use)2 261(. Rewrite)1 391 2 1630 5040 t 10 CW f ()2307 5040 w 10 R f (.)2907 5040 w 10 S1 f (\261)795 5196 w 10 CW f (popen)970 5196 w 10 R f (assumed in)1 454 1 1302 5196 t 10 CW f ()1788 5196 w 10 R f (. Use)1 237 1 2328 5196 t 10 CW f (_RESEARCH_SOURCE)2597 5196 w 10 R f (extension, include)1 735 1 3590 5196 t 10 CW f ()4358 5196 w 10 R f (, and)1 202 1 4838 5196 t (load with)1 400 1 970 5316 t 10 CW f (\255lv)1420 5316 w 10 R f ( for)1 166(. Similarly)1 473 2 1600 5316 t 10 CW f (telldir)2289 5316 w 10 R f (,)2709 5316 w 10 CW f (seekdir)2784 5316 w 10 R f (,)3204 5316 w 10 CW f (lstat)3279 5316 w 10 R f (,)3579 5316 w 10 CW f (srand)3653 5316 w 10 R f (,)3953 5316 w 10 CW f (rand)4027 5316 w 10 R f (,)4267 5316 w 10 CW f (nrand)4341 5316 w 10 R f (,)4641 5316 w 10 CW f (lrand)4715 5316 w 10 R f (,)5015 5316 w 10 CW f (frand)970 5436 w 10 R f (, and)1 194 1 1270 5436 t 10 CW f (getopt)1489 5436 w 10 R f (.)1849 5436 w 10 S1 f (\261)795 5592 w 10 CW f (select)970 5592 w 10 R f (. Define)1 438 1 1330 5592 t 10 CW f (_BSDTIME_EXTENSION)1886 5592 w 10 R f (and)3084 5592 w 10 CW f (_SELECT_EXTENSION)3346 5592 w 10 R f (and include)1 556 1 4484 5592 t 10 CW f ()970 5712 w 10 R f (and)1775 5712 w 10 CW f ()1944 5712 w 10 R f (.)2544 5712 w 10 S1 f (\261)795 5868 w 10 R f ( to use the Plan 9 networking functions, define)8 1894( Rewrite)1 369(Socket or stream stuff.)3 913 3 970 5868 t 10 CW f (_NET_EXTENSION)4175 5868 w 10 R f (,)5015 5868 w (include)970 5988 w 10 CW f ()1289 5988 w 10 R f (and load with)2 544 1 1914 5988 t 10 CW f (\255lnet)2483 5988 w 10 R f (.)2783 5988 w ( in the Plan 9 simulation of POSIX func\255)8 1697(The second class of problems has to do with inadequacies)9 2373 2 970 6144 t ( way \(except, perhaps for the)5 1222( long as this list is, these shortcomings have rarely gotten in the)12 2703(tions. As)1 395 3 720 6264 t 10 CW f (link)720 6384 w 10 R f (problem\).)985 6384 w 10 S1 f (\261)795 6540 w 10 R f ( do anything)2 522(Functions for setting the userid, groupid, effective userid and effective groupid do not)12 3548 2 970 6540 t ( concept is impossible to simulate in Plan 9.)8 1759(useful. The)1 474 2 970 6660 t 10 CW f (Chown)3253 6660 w 10 R f (also does nothing.)2 725 1 3578 6660 t 10 S1 f (\261)795 6816 w 10 CW f (execlp)970 6816 w 10 R f (and the related functions do not look at the)8 1757 1 1361 6816 t 10 CW f (PATH)3149 6816 w 10 R f ( just try the)3 474( They)1 262(environment variable.)1 883 3 3421 6816 t (current directory and)2 836 1 970 6936 t 10 CW f (/bin)1831 6936 w 10 R f (if the pathname is not absolute.)5 1249 1 2096 6936 t 10 S1 f (\261)795 7092 w 10 R f (Advisory locking via)2 844 1 970 7092 t 10 CW f (fcntl)1839 7092 w 10 R f (is not implemented.)2 792 1 2164 7092 t 10 S1 f (\261)795 7248 w 10 CW f (isatty)970 7248 w 10 R f ( approximation used is to see if the file is the same as)12 2431( The)1 230( to do correctly.)3 707(is hard)1 293 4 1379 7248 t cleartomark showpage saveobj restore %%EndPage: 3 3 %%Page: 4 4 /saveobj save def mark 4 pagesetup 10 R f (\255 4 \255)2 166 1 2797 480 t 10 CW f (/dev/cons)970 840 w 10 R f ( this cannot be determined, and sometimes this is not the right test.)12 2666(. Sometimes)1 520 2 1510 840 t 10 S1 f (\261)795 996 w 10 R f (With)970 996 w 10 CW f (kill)1210 996 w 10 R f ( imple\255)1 302(, the behavior mandated for negative arguments \(killing process groups\) is not)11 3288 2 1450 996 t (mented.)970 1116 w 10 S1 f (\261)795 1272 w 10 CW f (link)970 1272 w 10 R f (always fails.)1 499 1 1235 1272 t 10 S1 f (\261)795 1428 w 10 R f (With)970 1428 w 10 CW f (open)1203 1428 w 10 R f (, the)1 180 1 1443 1428 t 10 CW f (O_NOCTTY)1656 1428 w 10 R f ( concept of a ``controlling'' tty is foreign to)8 1819( The)1 213(option has no effect.)3 839 3 2169 1428 t (Plan 9.)1 278 1 970 1548 t 10 S1 f (\261)795 1704 w 10 CW f (setsid)970 1704 w 10 R f (does a)1 252 1 1355 1704 t 10 CW f (forkpgrp)1632 1704 w 10 R f (, which is only approximately the right behavior.)7 1951 1 2112 1704 t 10 S1 f (\261)795 1860 w 10 R f (The functions dealing with stacking signals,)5 1775 1 970 1860 t 10 CW f (sigpending)2773 1860 w 10 R f (,)3373 1860 w 10 CW f (sigprocmask)3426 1860 w 10 R f (and)4114 1860 w 10 CW f (sigsuspend)4286 1860 w 10 R f (, do)1 154 1 4886 1860 t (not work.)1 383 1 970 1980 t 10 S1 f (\261)795 2136 w 10 CW f (system)970 2136 w 10 R f (uses)1360 2136 w 10 CW f (rc)1562 2136 w 10 R f (instead of)1 397 1 1713 2136 t 10 CW f (sh)2141 2136 w 10 R f ( of)1 114( Use)1 211(to interpret the argument.)3 1033 3 2292 2136 t 10 CW f (system)3681 2136 w 10 R f (is discouraged for secu\255)3 968 1 4072 2136 t (rity reasons anyway.)2 823 1 970 2256 t 10 S1 f (\261)795 2412 w 10 CW f (tcgetattr)970 2412 w 10 R f (and)1535 2412 w 10 CW f (tcsetattr)1704 2412 w 10 R f (only work if)2 494 1 2269 2412 t 10 CW f (pcons)2789 2412 w 10 R f (or)3115 2412 w 10 CW f (pushtty)3224 2412 w 10 R f (has been executed \(see the discus\255)5 1370 1 3670 2412 t (sion about the)2 561 1 970 2532 t 10 CW f (_PCONS_EXTENSION)1556 2532 w 10 R f (, above \).)2 371 1 2516 2532 t 10 S1 f (\261)795 2688 w 10 CW f (umask)970 2688 w 10 R f (has no effect, as there is no such concept in Plan 9.)11 2032 1 1295 2688 t 10 S1 f (\261)795 2844 w 10 CW f (utime)970 2844 w 10 R f (has no effect, because the time can't be changed in Plan 9.)11 2330 1 1295 2844 t cleartomark showpage saveobj restore %%EndPage: 4 4 %%Trailer done %%Pages: 4 %%DocumentFonts: Times-Roman Times-Bold Times-Italic Times-Roman Courier