📄 getopt.3
字号:
%!PS-Adobe-1.0%%Creator: devps (Pipeline Associates, Inc.)%%CreationDate: Fri Sep 13 13:06:46 1996%%Pages: (atend)%%DocumentFonts: (atend)/devps 180 dict def devps begin/res 10.000000 def/y_offset 843 def/X{exch}bind def/mm {transform round X round X itransform} bind def/r{rmoveto}bind def/m{moveto}bind def/l{lineto}bind def/rl{rlineto}bind def/st{stroke}bind def/gs{gsave}bind def/gr{grestore}bind def/cp{currentpoint}bind def/np{newpath}bind def/ct{curveto}bind defsystemdict /setpacking known { /savepacking currentpacking def true setpacking } if/m0{0 0 moveto}bind def/xc{//res div}bind def/yc{//res neg div //y_offset add}bind def/lc{yc X xc X l st}bind def/mc{yc X xc X m}bind def/el{gs /a X def a div 1 X scale cp np a xc 2 div 0 360 arc st gr}bind def/ar{cp 7 2 roll np xc 5 1 roll atan 3 1 roll atan X arc st}bind def/sp{yc X xc X 6 2 roll yc X xc X 6 2 roll yc X xc X 6 2 roll ct}bind def/V{//res neg div //y_offset addcurrentpoint pop Xm}bind def/H{//res div0 transform X round X itransform popcurrentpoint X popmoveto}bind def/h{//res div 0 r}bind def/v{//res neg div 0 X r}bind def/S{X H show}bind def/A{H //res div 1 index stringwidth pop sub 1 index length div 0 3 2 roll ashow}bind def/psize 10 def/height 0 def/cheight { height 0 ne { height } { psize } ifelse } bind def/slant 0 def/FF{findfont X dup 30 div 0 mm pop setlinewidth /psize X def [psize 0 cheight slant sin slant cos div mul cheight 0 0] makefont setfont}bind def/shade{gs /dy X def /dx X def np m 0 /dy rl /dx 0 rl 0 /dy neg rl /dx neg 0 rl closepath .9 setgray fillgr}bind def1 setlinecap/resolution res 72 mul def/startFig { /SavedState save def userdict maxlength dict begin currentpoint transform DocumentInitState setmiterlimit setgray setdash setlinejoin setlinecap setlinewidth setmatrix itransform moveto /ury exch def /urx exch def /lly exch def /llx exch def /y exch 72 mul resolution div def /x exch 72 mul resolution div def currentpoint /cy exch def /cx exch def /sx x urx llx sub div def /sy y ury lly sub div def sx sy scale cx sx div llx sub cy sy div ury sub translate /DefFigCTM matrix currentmatrix def /initmatrix { DefFigCTM setmatrix } def /defaultmatrix { DefFigCTM exch copy } def /initgraphics { DocumentInitState setmiterlimit setgray setdash setlinejoin setlinecap setlinewidth setmatrix DefFigCTM setmatrix } def /showpage { initgraphics } def}bind def/clipFig { currentpoint 6 2 roll newpath 4 copy 4 2 roll moveto 6 -1 roll exch lineto exch lineto exch lineto closepath clip newpath moveto}bind def/doclip { llx lly urx ury clipFig } def/endFig { end SavedState restore}bind def/globalstart { fontnum psize slant height resolution currentpoint pagesave restore gsave }bind def/globalend { grestore moveto /resolution exch def /height exch def /slant exch def /psize exch def /fontnum exch def F /pagesave save def}bind def/fontnum 1 def systemdict /setpacking known { savepacking setpacking} ifend/BP{save mark devps begin m0/DocumentInitState [ matrix currentmatrix currentlinewidth currentlinecapcurrentlinejoin currentdash currentgray currentmiterlimit ] cvx def}bind def/EP{end cleartomark restore showpage}def/Encoding-1 256 array def0 1 255 {Encoding-1 exch /.notdef put} forEncoding-1 8#301 StandardEncoding 8#101 26 getinterval putinterval %A-BEncoding-1 8#341 StandardEncoding 8#141 26 getinterval putinterval %a-bEncoding-1 8#241 StandardEncoding 8#301 16 getinterval putinterval %accentsEncoding-1 8#373 StandardEncoding 8#365 1 getinterval putinterval %dotlessiEncoding-1dup 8#41 /copyright putdup 8#42 /registered putdup 8#43 /trademark putdup 8#44 /logicalnot putdup 8#45 /Eth putdup 8#46 /eth putdup 8#47 /Thorn putdup 8#50 /thorn putdup 8#51 /brokenbar putdup 8#52 /degree putdup 8#53 /divide putdup 8#54 /multiply putdup 8#55 /minus putdup 8#56 /onehalf putdup 8#57 /onequarter putdup 8#60 /threequarters putdup 8#101 /Aacute putdup 8#102 /Acircumflex putdup 8#103 /Adieresis putdup 8#104 /Agrave putdup 8#105 /Aring putdup 8#106 /Atilde putdup 8#107 /Ccedilla putdup 8#110 /Eacute putdup 8#111 /Ecircumflex putdup 8#112 /Edieresis putdup 8#113 /Egrave putdup 8#114 /Iacute putdup 8#115 /Icircumflex putdup 8#116 /Idieresis putdup 8#117 /Igrave putdup 8#120 /Ntilde putdup 8#121 /Oacute putdup 8#122 /Ocircumflex putdup 8#123 /Odieresis putdup 8#124 /Ograve putdup 8#125 /Otilde putdup 8#126 /Scaron putdup 8#127 /Uacute putdup 8#130 /Ucircumflex putdup 8#131 /Udieresis putdup 8#132 /Ugrave putdup 8#133 /Ydieresis putdup 8#134 /Zcaron putdup 8#135 /aacute putdup 8#136 /acircumflex putdup 8#137 /adieresis putdup 8#140 /agrave putdup 8#141 /aring putdup 8#142 /atilde putdup 8#143 /ccedilla putdup 8#144 /eacute putdup 8#145 /ecircumflex putdup 8#146 /edieresis putdup 8#147 /egrave putdup 8#150 /iacute putdup 8#151 /icircumflex putdup 8#152 /idieresis putdup 8#153 /igrave putdup 8#154 /ntilde putdup 8#155 /oacute putdup 8#156 /ocircumflex putdup 8#157 /odieresis putdup 8#160 /ograve putdup 8#161 /otilde putdup 8#162 /scaron putdup 8#163 /uacute putdup 8#164 /ucircumflex putdup 8#165 /udieresis putdup 8#166 /ugrave putdup 8#167 /ydieresis putdup 8#170 /zcaron putpop/Enc-dict 30 dict defEnc-dict /tmpstr1 50 string putEnc-dict /tmpstr2 50 string putEnc-dict /tmpstr3 50 string dup (Encoding-) exch cvs pop put/AEnc-def { % arguments: the original font's name, encoding nrEnc-dict begintmpstr2 cvs /Enc-no exch def % Remember the number in a stringdup /OrigName exch def % remember the namefindfont dup maxlength dict /newdict exch def % get dictionary for new font{ exch dup /FID ne { exch newdict 3 1 roll put } { pop pop } % Ignore FID ifelse} forallnewdict begin/Encoding tmpstr3 9 Enc-no putinterval tmpstr3 0 9 Enc-no length add getinterval cvn load def % Replace encodingcurrentdict /UniqueID known{ /UniqueID UniqueID Enc-no cvi 49999 mul add def } if % Derive New UniqueIDend % newdict/FNlength OrigName tmpstr1 cvs length def % convert name, remember lengthFNlength 1 add Enc-no length add stringdup 0 OrigName tmpstr1 cvs putintervaldup FNlength (-) putintervaldup FNlength 1 add Enc-no putintervaldup 0 tmpstr1 0 FNlength getinterval putinterval % Add old namecvn dup newdict /FontName 3 2 roll put newdict definefontend % Enc-dict} def/Times-Roman 1 AEnc-def pop/R-1{/Times-Roman-1 FF}def/Times-Bold 1 AEnc-def pop/B-1{/Times-Bold-1 FF}def/R{/Times-Roman FF}def/B{/Times-Bold FF}def/I{/Times-Italic FF}def%%EndProlog%%Page: 1 1BP/slant 0 def/height 0 def480 V10 R720(GETOPT)S1116(\()S1158(3)S1216(\))S2696(Eighth)S(Edition)296 2989 A4731(GETOPT)S5127(\()S5169(3)S5227(\))S960 V9 R720(N)S722(NA)S790(AM)S858(ME)S940(E)S1080 V10 R1080(getopt)S10 R-11356(-)S10 R1438(get)S1586(option)S1867(letter)S2100(from)S2321(argv)S1248 V9 R720(S)S722(SY)S774(YN)S842(NO)S910(OP)S978(PS)S1030(SI)S1082(IS)S1115(S)S1368 V10 B1080(int)S1236(getopt\(argc,)S1792(argv,)S2050(optstring\))S1488 V1080(int)S1236(argc;)S1608 V1080(char)S(**argv;)329 1314 A1728 V1080(char)S1314(*optstring;)S1968 V1080(extern)S1393(char)S1627(*optarg;)S2088 V1080(extern)S1393(int)S1549(optind;)S2256 V9 R720(D)S722(DE)S790(ES)S848(SC)S900(CR)S962(RI)S1024(IP)S1057(PT)S1109(TI)S1167(IO)S1200(ON)S1268(N)S2376 V10 I1080(Getopt)S10 R1385(returns)S1696(the)S1850(next)S2054(option)S2341(letter)S2580(in)S10 I2689(argv)S10 R2904(that)S3086(matches)S3447(a)S3523(letter)S3762(in)S10 I3871(optstring)S10 R4241(.)S10 I4323(Optstring)S10 R4740(is)S4839(a)S4916(string)S5177(of)S2496 V(recognized)442 1080 A1552(option)S1838(letters;)S2143(if)S2235(a)S2310(letter)S2548(is)S2644(followed)S3031(by)S3160(a)S3234(colon,)S3511(the)S3663(option)S3948(is)S4044(expected)S4431(to)S4538(have)S4757(an)S4881(argument)S2616 V1080(that)S1256(may)S1454(or)S1563(may)S1761(not)S1914(be)S2034(separated)S2440(from)S2661(it)S2742(by)S2867(white)S(space.)249 3116 A10 I3415(Optarg)S10 R3730(is)S3822(set)S3959(to)S4062(point)S4293(to)S4397(the)S4546(start)S4746(of)S4856(the)S5005(option)S2736 V1080(argument)S1485(on)S1610(return)S1876(from)S10 I2097(getopt)S10 R2356(.)S2904 V10 I1080(Getopt)S10 R(places)252 1384 A1666(in)S10 I1774(optind)S10 R2060(the)S10 I2213(argv)S10 R2427(index)S2680(of)S2794(the)S2947(next)S3150(argument)S3560(to)S3669(be)S3795(processed.)S(Because)336 4273 A10 I4640(optind)S10 R4927(is)S5025(exter-)S3024 V1080(nal,)S1253(it)S1334(is)S1426(normally)S(initialized)403 1814 A2242(to)S2345(zero)S2544(automatically)S3117(before)S3400(the)S3548(\256rst)S3730(call)S3901(to)S10 I4004(getopt)S10 R4263(.)S3192 V1080(When)S1352(all)S1485(options)S1812(have)S2034(been)S2256(processed)S2685(\(i.e.,)S2899(up)S3031(to)S3141(the)S3297(\256rst)S(non-option)440 3487 A3960(argument\),)S10 I4432(getopt)S10 R4716(returns)S10 B5029(EOF)S10 R5236(.)S3312 V1080(The)S1264(special)S1571(option)S10 B-11854(--)S10 R1995(may)S2195(be)S2316(used)S2526(to)S2630(delimit)S2941(the)S3090(end)S3261(of)S3371(the)S3520(options;)S10 B3869(EOF)S10 R(will)157 4102 A4285(be)S4406(returned,)S4793(and)S10 B-14964(--)S10 R(will)157 5104 A3432 V1080(be)S1200(skipped.)S3600 V9 R720(D)S722(DI)S790(IA)S823(AG)S891(GN)S959(NO)S1027(OS)S1095(ST)S1147(TI)S1205(IC)S1238(CS)S1300(S)S3720 V10 I1080(Getopt)S10 R1382(prints)S1639(an)S1762(error)S1987(message)S2356(on)S10 I2484(stderr)S10 R2752(and)S2925(returns)S3233(a)S3307(question)S3676(mark)S3912(\()S10 B3946(?)S10 R3996(\))S4084(when)S4331(it)S(encounters)436 4416 A4881(an)S5005(option)S3840 V1080(letter)S1313(not)S1466(included)S1837(in)S10 I1940(optstring)S10 R2310(.)S4008 V9 R720(E)S722(EX)S780(XA)S848(AM)S916(MP)S998(PL)S1050(LE)S1108(E)S4128 V10 R1080(The)S1262(following)S1678(code)S1894(fragment)S2284(shows)S2561(how)S2760(one)S2931(might)S3191(process)S3519(the)S3668(arguments)S4113(for)S4257(a)S4328(command)S4750(that)S4927(can)S5093(take)S4248 V1080(the)S1228(mutually)S1610(exclusive)S2015(options)S10 B2335(a)S10 R2410(and)S10 B2580(b)S10 R2636(,)S2686(and)S2856(the)S3004(options)S10 B3324(f)S10 R3383(and)S10 B3553(o)S10 R3603(,)S3653(both)S3856(of)S3965(which)S4236(require)S4547(arguments:)S4416 V1440(main\(argc,)S1899(argv\))S4536 V1440(int)S1571(argc;)S4656 V1440(char)S1639(**argv;)S4776 V1440({)S4896 V1800(int)S1931(c;)S5016 V1800(extern)S2077(int)S2208(optind;)S5136 V1800(extern)S2077(char)S(*optarg;)335 2276 A5256 V1800(.)S5376 V1800(.)S5496 V1800(.)S5616 V1800(while)S2049(\(\(c)S2187(=)S2269(getopt\(argc,)S2778(argv,)S3007("abf:o:"\)\))S3417(!=)S3533(EOF\))S5736 V2160(switch)S2448(\(c\))S2586({)S5856 V2160(case)S2359(`a':)S5976 V2520(if)S2607(\(b\257g\))S6096 V2880(err\257g++;)S6216 V2520(else)S6336 V2880(a\257g++;)S6456 V2520(break;)S6576 V2160(case)S2359(`b':)S6696 V2520(if)S2607(\(a\257g\))S6816 V2880(err\257g++;)S6936 V2520(else)S7056 V2880(bproc\(\);)S7176 V2520(break;)S7296 V2160(case)S(`f':)130 2359 A7416 V2520(i\256le)S2702(=)S2784(optarg;)S7536 V2520(break;)S7903 V720(Page)S941(1)S2669(\()S2711(May)S2920(27,)S(1986)200 3070 A3278(\))S4455(September)S4911(13,)S(1996)200 5061 A8143 VEP%%Page: 2 2BP/slant 0 def/height 0 def480 V10 R720(GETOPT)S1116(\()S1158(3)S1216(\))S2696(Eighth)S(Edition)296 2989 A4731(GETOPT)S5127(\()S5169(3)S5227(\))S960 V2160(case)S2359(`o':)S1080 V2520(o\256le)S2724(=)S2806(optarg;)S1200 V2520(break;)S1320 V2160(case)S2359(`?':)S1440 V(default:)308 2160 A1560 V2520(err\257g++;)S1680 V2520(break;)S1800 V2160(})S1920 V1800(if)S1887(\(err\257g\))S2199({)S2040 V2160(fprintf\(stderr,)S2732("Usage:)S(..."\);)178 3078 A2160 V2160(exit\(2\);)S2280 V1800(})S2400 V1800(for)S1943(\(;)S2030(optind)S2311(<)S2393(argc;)S2620(optind++\))S3049({)S2520 V2160(.)S2640 V2160(.)S2760 V2160(.)S2880 V1800(})S3000 V1800(.)S3120 V1800(.)S3240 V1800(.)S3360 V1440(})S3528 V9 R720(H)S722(HI)S790(IS)S823(ST)S875(TO)S933(OR)S1001(RY)S1063(Y)S3648 V10 R(Written)308 1080 A1432(by)S1576(Henry)S1872(Spencer,)S2266(working)S2645(from)S2885(a)S2974(Bell)S3187(Labs)S3428(manual)S3769(page.)S4054(Modi\256ed)S4467(by)S4612(Keith)S4881(Bostic)S5183(to)S3768 V1080(behave)S1390(more)S1622(like)S1798(the)S1946(System)S2267(V)S2365(version.)S3936 V9 R720(B)S722(BU)S784(UG)S852(GS)S920(S)S4056 V10 R1080(It)S1173(is)S1271(not)S(obvious)317 1430 A1778(how)S1982(`)S10 R-12016(-)S10 R2073(')S2138(standing)S2509(alone)S(should)267 2758 A3056(be)S3182(treated;)S3541(this)S3717(version)S4044(treats)S4295(it)S4383(as)S4499(a)S(non-option)440 4576 A5048(argu-)S4176 V1080(ment,)S1331(which)S1602(is)S1694(not)S1847(always)S2152(right.)S4344 V1080(Option)S1397(arguments)S1855(are)S2018(allowed)S2376(to)S2493(begin)S2755(with)S2973(`)S10 R-13007(-)S10 R3064(';)S3165(this)S3349(is)S3455(reasonable)S3925(but)S4092(reduces)S4439(the)S(amount)301 4601 A4941(of)S5064(error)S4464 V1080(checking)S1468(possible.)S4632 V10 I1080(Getopt)S10 R1379(is)S1471(quite)S1697(\257exible)S2024(but)S2177(the)S(obvious)317 2325 A2667(price)S2894(must)S3114(be)S3234(paid:)S3485(there)S3712(is)S3804(much)S4052(it)S4133(could)S4381(do)S4506(that)S4682(it)S4763(doesn't,)S5110(like)S4752 V1080(checking)S1468(mutually)S1850(exclusive)S2255(options,)S2600(checking)S2988(type)S3186(of)S3295(option)S3576(arguments,)S4045(etc.)S7903 V720(September)S1176(13,)S(1996)200 1326 A2669(\()S2711(May)S2920(27,)S(1986)200 3070 A3278(\))S4990(Page)S5211(2)S8143 VEP%%Trailer%%DocumentFonts: Times-Roman Times-Bold Times-Italic%%Pages: 2
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -