|
|
DataMuseum.dkPresents historical artifacts from the history of: RC9000 |
This is an automatic "excavation" of a thematic subset of
See our Wiki for more about RC9000 Excavated with: AutoArchaeologist - Free & Open Source Software. |
top - downloadIndex: g
Length: 4821 (0x12d5)
Names: »getopt.3c«
└─⟦50656ff4a⟧ Bits:30010538 TX 3.1 Coldstart
└─⟦bbf173f5c⟧ »0004«
└─⟦this⟧ »./usr/man/cat3/getopt.3c«
0x0000…0020 0a 0a 0a 5f 08 4f 5f 08 6e 5f 08 6c 5f 08 69 5f 08 6e 5f 08 65 20 5f 08 4d 5f 08 61 5f 08 6e 5f ┆ _ O_ n_ l_ i_ n_ e _ M_ a_ n_┆
0x0020…0040 08 75 5f 08 61 5f 08 6c 20 20 20 20 20 20 20 20 20 20 20 4c 69 62 72 61 72 79 20 46 75 6e 63 74 ┆ u_ a_ l Library Funct┆
0x0040…0060 69 6f 6e 73 20 20 20 20 20 20 20 20 20 20 20 20 20 20 67 65 74 6f 70 74 28 33 63 29 0a 0a 0a 0a ┆ions getopt(3c) ┆
0x0060…0080 4e 08 4e 08 4e 08 4e 41 08 41 08 41 08 41 4d 08 4d 08 4d 08 4d 45 08 45 08 45 08 45 0a 20 20 20 ┆N N N NA A A AM M M ME E E E ┆
0x0080…00a0 20 20 67 65 74 6f 70 74 2c 20 6f 70 74 61 72 67 2c 20 6f 70 74 65 72 72 2c 20 6f 70 74 69 6e 64 ┆ getopt, optarg, opterr, optind┆
0x00a0…00c0 20 2d 20 67 65 74 20 6f 70 74 69 6f 6e 20 6c 65 74 74 65 72 20 66 72 6f 6d 0a 20 20 20 20 20 61 ┆ - get option letter from a┆
0x00c0…00e0 72 67 75 6d 65 6e 74 20 76 65 63 74 6f 72 0a 0a 53 08 53 08 53 08 53 59 08 59 08 59 08 59 4e 08 ┆rgument vector S S S SY Y Y YN ┆
0x00e0…0100 4e 08 4e 08 4e 54 08 54 08 54 08 54 41 08 41 08 41 08 41 58 08 58 08 58 08 58 0a 20 20 20 20 20 ┆N N NT T T TA A A AX X X X ┆
0x0100…0120 23 08 23 08 23 08 23 69 08 69 08 69 08 69 6e 08 6e 08 6e 08 6e 63 08 63 08 63 08 63 6c 08 6c 08 ┆# # # #i i i in n n nc c c cl l ┆
0x0120…0140 6c 08 6c 75 08 75 08 75 08 75 64 08 64 08 64 08 64 65 08 65 08 65 08 65 20 3c 08 3c 08 3c 08 3c ┆l lu u u ud d d de e e e < < < <┆
0x0140…0160 73 08 73 08 73 08 73 74 08 74 08 74 08 74 64 08 64 08 64 08 64 69 08 69 08 69 08 69 6f 08 6f 08 ┆s s s st t t td d d di i i io o ┆
0x0160…0180 6f 08 6f 2e 08 2e 08 2e 08 2e 68 08 68 08 68 08 68 3e 08 3e 08 3e 08 3e 0a 0a 20 20 20 20 20 69 ┆o o. . . .h h h h> > > > i┆
0x0180…01a0 08 69 08 69 08 69 6e 08 6e 08 6e 08 6e 74 08 74 08 74 08 74 20 67 08 67 08 67 08 67 65 08 65 08 ┆ i i in n n nt t t t g g g ge e ┆
0x01a0…01c0 65 08 65 74 08 74 08 74 08 74 6f 08 6f 08 6f 08 6f 70 08 70 08 70 08 70 74 08 74 08 74 08 74 28 ┆e et t t to o o op p p pt t t t(┆
0x01c0…01e0 08 28 08 28 08 28 61 08 61 08 61 08 61 72 08 72 08 72 08 72 67 08 67 08 67 08 67 63 08 63 08 63 ┆ ( ( (a a a ar r r rg g g gc c c┆
0x01e0…0200 08 63 2c 08 2c 08 2c 08 2c 20 61 08 61 08 61 08 61 72 08 72 08 72 08 72 67 08 67 08 67 08 67 76 ┆ c, , , , a a a ar r r rg g g gv┆
0x0200…0220 08 76 08 76 08 76 2c 08 2c 08 2c 08 2c 20 6f 08 6f 08 6f 08 6f 70 08 70 08 70 08 70 74 08 74 08 ┆ v v v, , , , o o o op p p pt t ┆
0x0220…0240 74 08 74 73 08 73 08 73 08 73 74 08 74 08 74 08 74 72 08 72 08 72 08 72 69 08 69 08 69 08 69 6e ┆t ts s s st t t tr r r ri i i in┆
0x0240…0260 08 6e 08 6e 08 6e 67 08 67 08 67 08 67 29 08 29 08 29 08 29 0a 20 20 20 20 20 69 08 69 08 69 08 ┆ n n ng g g g) ) ) ) i i i ┆
0x0260…0280 69 6e 08 6e 08 6e 08 6e 74 08 74 08 74 08 74 20 61 08 61 08 61 08 61 72 08 72 08 72 08 72 67 08 ┆in n n nt t t t a a a ar r r rg ┆
0x0280…02a0 67 08 67 08 67 63 08 63 08 63 08 63 3b 08 3b 08 3b 08 3b 0a 20 20 20 20 20 63 08 63 08 63 08 63 ┆g g gc c c c; ; ; ; c c c c┆
0x02a0…02c0 68 08 68 08 68 08 68 61 08 61 08 61 08 61 72 08 72 08 72 08 72 20 2a 08 2a 08 2a 08 2a 2a 08 2a ┆h h h ha a a ar r r r * * * ** *┆
0x02c0…02e0 08 2a 08 2a 61 08 61 08 61 08 61 72 08 72 08 72 08 72 67 08 67 08 67 08 67 76 08 76 08 76 08 76 ┆ * *a a a ar r r rg g g gv v v v┆
0x02e0…0300 2c 08 2c 08 2c 08 2c 20 2a 08 2a 08 2a 08 2a 6f 08 6f 08 6f 08 6f 70 08 70 08 70 08 70 74 08 74 ┆, , , , * * * *o o o op p p pt t┆
0x0300…0320 08 74 08 74 73 08 73 08 73 08 73 74 08 74 08 74 08 74 72 08 72 08 72 08 72 69 08 69 08 69 08 69 ┆ t ts s s st t t tr r r ri i i i┆
0x0320…0340 6e 08 6e 08 6e 08 6e 67 08 67 08 67 08 67 3b 08 3b 08 3b 08 3b 0a 0a 20 20 20 20 20 65 08 65 08 ┆n n n ng g g g; ; ; ; e e ┆
0x0340…0360 65 08 65 78 08 78 08 78 08 78 74 08 74 08 74 08 74 65 08 65 08 65 08 65 72 08 72 08 72 08 72 6e ┆e ex x x xt t t te e e er r r rn┆
0x0360…0380 08 6e 08 6e 08 6e 20 63 08 63 08 63 08 63 68 08 68 08 68 08 68 61 08 61 08 61 08 61 72 08 72 08 ┆ n n n c c c ch h h ha a a ar r ┆
0x0380…03a0 72 08 72 20 2a 08 2a 08 2a 08 2a 6f 08 6f 08 6f 08 6f 70 08 70 08 70 08 70 74 08 74 08 74 08 74 ┆r r * * * *o o o op p p pt t t t┆
0x03a0…03c0 61 08 61 08 61 08 61 72 08 72 08 72 08 72 67 08 67 08 67 08 67 3b 08 3b 08 3b 08 3b 0a 20 20 20 ┆a a a ar r r rg g g g; ; ; ; ┆
0x03c0…03e0 20 20 65 08 65 08 65 08 65 78 08 78 08 78 08 78 74 08 74 08 74 08 74 65 08 65 08 65 08 65 72 08 ┆ e e e ex x x xt t t te e e er ┆
0x03e0…0400 72 08 72 08 72 6e 08 6e 08 6e 08 6e 20 69 08 69 08 69 08 69 6e 08 6e 08 6e 08 6e 74 08 74 08 74 ┆r r rn n n n i i i in n n nt t t┆
0x0400…0420 08 74 20 6f 08 6f 08 6f 08 6f 70 08 70 08 70 08 70 74 08 74 08 74 08 74 69 08 69 08 69 08 69 6e ┆ t o o o op p p pt t t ti i i in┆
0x0420…0440 08 6e 08 6e 08 6e 64 08 64 08 64 08 64 2c 08 2c 08 2c 08 2c 20 6f 08 6f 08 6f 08 6f 70 08 70 08 ┆ n n nd d d d, , , , o o o op p ┆
0x0440…0460 70 08 70 74 08 74 08 74 08 74 65 08 65 08 65 08 65 72 08 72 08 72 08 72 72 08 72 08 72 08 72 3b ┆p pt t t te e e er r r rr r r r;┆
0x0460…0480 08 3b 08 3b 08 3b 0a 0a 44 08 44 08 44 08 44 45 08 45 08 45 08 45 53 08 53 08 53 08 53 43 08 43 ┆ ; ; ; D D D DE E E ES S S SC C┆
0x0480…04a0 08 43 08 43 52 08 52 08 52 08 52 49 08 49 08 49 08 49 50 08 50 08 50 08 50 54 08 54 08 54 08 54 ┆ C CR R R RI I I IP P P PT T T T┆
0x04a0…04c0 49 08 49 08 49 08 49 4f 08 4f 08 4f 08 4f 4e 08 4e 08 4e 08 4e 0a 20 20 20 20 20 5f 08 67 5f 08 ┆I I I IO O O ON N N N _ g_ ┆
0x04c0…04e0 65 5f 08 74 5f 08 6f 5f 08 70 5f 08 74 20 72 65 74 75 72 6e 73 20 74 68 65 20 6e 65 78 74 20 6f ┆e_ t_ o_ p_ t returns the next o┆
0x04e0…0500 70 74 69 6f 6e 20 6c 65 74 74 65 72 20 69 6e 20 5f 08 61 5f 08 72 5f 08 67 5f 08 76 20 74 68 61 ┆ption letter in _ a_ r_ g_ v tha┆
0x0500…0520 74 20 6d 61 74 63 68 65 73 20 61 0a 20 20 20 20 20 6c 65 74 74 65 72 20 69 6e 20 5f 08 6f 5f 08 ┆t matches a letter in _ o_ ┆
0x0520…0540 70 5f 08 74 5f 08 73 5f 08 74 5f 08 72 5f 08 69 5f 08 6e 5f 08 67 2e 20 20 5f 08 6f 5f 08 70 5f ┆p_ t_ s_ t_ r_ i_ n_ g. _ o_ p_┆
0x0540…0560 08 74 5f 08 73 5f 08 74 5f 08 72 5f 08 69 5f 08 6e 5f 08 67 20 69 73 20 61 20 73 74 72 69 6e 67 ┆ t_ s_ t_ r_ i_ n_ g is a string┆
0x0560…0580 20 6f 66 20 72 65 63 6f 67 6e 69 7a 65 64 0a 20 20 20 20 20 6f 70 74 69 6f 6e 20 6c 65 74 74 65 ┆ of recognized option lette┆
0x0580…05a0 72 73 3b 20 69 66 20 61 20 6c 65 74 74 65 72 20 69 73 20 66 6f 6c 6c 6f 77 65 64 20 62 79 20 61 ┆rs; if a letter is followed by a┆
0x05a0…05c0 20 63 6f 6c 6f 6e 2c 20 74 68 65 0a 20 20 20 20 20 6f 70 74 69 6f 6e 20 69 73 20 65 78 70 65 63 ┆ colon, the option is expec┆
0x05c0…05e0 74 65 64 20 74 6f 20 68 61 76 65 20 61 6e 20 61 72 67 75 6d 65 6e 74 20 74 68 61 74 20 6d 61 79 ┆ted to have an argument that may┆
0x05e0…0600 20 6f 72 20 6d 61 79 20 6e 6f 74 0a 20 20 20 20 20 62 65 20 73 65 70 61 72 61 74 65 64 20 66 72 ┆ or may not be separated fr┆
0x0600…0620 6f 6d 20 69 74 20 62 79 20 77 68 69 74 65 20 73 70 61 63 65 2e 20 20 5f 08 6f 5f 08 70 5f 08 74 ┆om it by white space. _ o_ p_ t┆
0x0620…0640 5f 08 61 5f 08 72 5f 08 67 20 69 73 20 73 65 74 20 74 6f 20 70 6f 69 6e 74 0a 20 20 20 20 20 74 ┆_ a_ r_ g is set to point t┆
0x0640…0660 6f 20 74 68 65 20 73 74 61 72 74 20 6f 66 20 74 68 65 20 6f 70 74 69 6f 6e 20 61 72 67 75 6d 65 ┆o the start of the option argume┆
0x0660…0680 6e 74 20 6f 6e 20 72 65 74 75 72 6e 20 66 72 6f 6d 20 5f 08 67 5f 08 65 5f 08 74 5f 08 6f 5f 08 ┆nt on return from _ g_ e_ t_ o_ ┆
0x0680…06a0 70 5f 08 74 2e 0a 0a 20 20 20 20 20 5f 08 67 5f 08 65 5f 08 74 5f 08 6f 5f 08 70 5f 08 74 20 70 ┆p_ t. _ g_ e_ t_ o_ p_ t p┆
0x06a0…06c0 6c 61 63 65 73 20 69 6e 20 5f 08 6f 5f 08 70 5f 08 74 5f 08 69 5f 08 6e 5f 08 64 20 74 68 65 20 ┆laces in _ o_ p_ t_ i_ n_ d the ┆
0x06c0…06e0 5f 08 61 5f 08 72 5f 08 67 5f 08 76 20 69 6e 64 65 78 20 6f 66 20 74 68 65 20 6e 65 78 74 20 61 ┆_ a_ r_ g_ v index of the next a┆
0x06e0…0700 72 67 75 6d 65 6e 74 0a 20 20 20 20 20 74 6f 20 62 65 20 70 72 6f 63 65 73 73 65 64 2e 20 20 42 ┆rgument to be processed. B┆
0x0700…0720 65 63 61 75 73 65 20 5f 08 6f 5f 08 70 5f 08 74 5f 08 69 5f 08 6e 5f 08 64 20 69 73 20 65 78 74 ┆ecause _ o_ p_ t_ i_ n_ d is ext┆
0x0720…0740 65 72 6e 61 6c 2c 20 69 74 20 69 73 20 6e 6f 72 6d 61 6c 6c 79 0a 20 20 20 20 20 69 6e 69 74 69 ┆ernal, it is normally initi┆
0x0740…0760 61 6c 69 7a 65 64 20 74 6f 20 7a 65 72 6f 20 61 75 74 6f 6d 61 74 69 63 61 6c 6c 79 20 62 65 66 ┆alized to zero automatically bef┆
0x0760…0780 6f 72 65 20 74 68 65 20 66 69 72 73 74 20 63 61 6c 6c 20 74 6f 0a 20 20 20 20 20 5f 08 67 5f 08 ┆ore the first call to _ g_ ┆
0x0780…07a0 65 5f 08 74 5f 08 6f 5f 08 70 5f 08 74 2e 0a 0a 20 20 20 20 20 57 68 65 6e 20 61 6c 6c 20 6f 70 ┆e_ t_ o_ p_ t. When all op┆
0x07a0…07c0 74 69 6f 6e 73 20 68 61 76 65 20 62 65 65 6e 20 70 72 6f 63 65 73 73 65 64 20 28 69 2e 65 2e 2c ┆tions have been processed (i.e.,┆
0x07c0…07e0 20 75 70 20 74 6f 20 74 68 65 20 66 69 72 73 74 0a 20 20 20 20 20 6e 6f 6e 2d 6f 70 74 69 6f 6e ┆ up to the first non-option┆
0x07e0…0800 20 61 72 67 75 6d 65 6e 74 29 2c 20 5f 08 67 5f 08 65 5f 08 74 5f 08 6f 5f 08 70 5f 08 74 20 72 ┆ argument), _ g_ e_ t_ o_ p_ t r┆
0x0800…0820 65 74 75 72 6e 73 20 45 08 45 08 45 08 45 4f 08 4f 08 4f 08 4f 46 08 46 08 46 08 46 2e 20 20 54 ┆eturns E E E EO O O OF F F F. T┆
0x0820…0840 68 65 20 73 70 65 63 69 61 6c 0a 20 20 20 20 20 6f 70 74 69 6f 6e 20 2d 08 2d 08 2d 08 2d 2d 08 ┆he special option - - - -- ┆
0x0840…0860 2d 08 2d 08 2d 20 6d 61 79 20 62 65 20 75 73 65 64 20 74 6f 20 64 65 6c 69 6d 69 74 20 74 68 65 ┆- - - may be used to delimit the┆
0x0860…0880 20 65 6e 64 20 6f 66 20 74 68 65 20 6f 70 74 69 6f 6e 73 3b 20 45 08 45 08 45 08 45 4f 08 4f 08 ┆ end of the options; E E E EO O ┆
0x0880…08a0 4f 08 4f 46 08 46 08 46 08 46 0a 20 20 20 20 20 77 69 6c 6c 20 62 65 20 72 65 74 75 72 6e 65 64 ┆O OF F F F will be returned┆
0x08a0…08c0 2c 20 61 6e 64 20 2d 08 2d 08 2d 08 2d 2d 08 2d 08 2d 08 2d 20 77 69 6c 6c 20 62 65 20 73 6b 69 ┆, and - - - -- - - - will be ski┆
0x08c0…08e0 70 70 65 64 2e 0a 0a 44 08 44 08 44 08 44 49 08 49 08 49 08 49 41 08 41 08 41 08 41 47 08 47 08 ┆pped. D D D DI I I IA A A AG G ┆
0x08e0…0900 47 08 47 4e 08 4e 08 4e 08 4e 4f 08 4f 08 4f 08 4f 53 08 53 08 53 08 53 54 08 54 08 54 08 54 49 ┆G GN N N NO O O OS S S ST T T TI┆
0x0900…0920 08 49 08 49 08 49 43 08 43 08 43 08 43 53 08 53 08 53 08 53 0a 20 20 20 20 20 5f 08 67 5f 08 65 ┆ I I IC C C CS S S S _ g_ e┆
0x0920…0940 5f 08 74 5f 08 6f 5f 08 70 5f 08 74 20 70 72 69 6e 74 73 20 61 6e 20 65 72 72 6f 72 20 6d 65 73 ┆_ t_ o_ p_ t prints an error mes┆
0x0940…0960 73 61 67 65 20 6f 6e 20 5f 08 73 5f 08 74 5f 08 64 5f 08 65 5f 08 72 5f 08 72 20 61 6e 64 20 72 ┆sage on _ s_ t_ d_ e_ r_ r and r┆
0x0960…0980 65 74 75 72 6e 73 20 61 20 71 75 65 73 2d 0a 20 20 20 20 20 74 69 6f 6e 20 6d 61 72 6b 20 28 3f ┆eturns a ques- tion mark (?┆
0x0980…09a0 08 3f 08 3f 08 3f 29 20 77 68 65 6e 20 69 74 20 65 6e 63 6f 75 6e 74 65 72 73 20 61 6e 20 6f 70 ┆ ? ? ?) when it encounters an op┆
0x09a0…09c0 74 69 6f 6e 20 6c 65 74 74 65 72 20 6e 6f 74 0a 20 20 20 20 20 69 6e 63 6c 75 64 65 64 20 69 6e ┆tion letter not included in┆
0x09c0…09e0 20 5f 08 6f 5f 08 70 5f 08 74 5f 08 73 5f 08 74 5f 08 72 5f 08 69 5f 08 6e 5f 08 67 2e 0a 0a 20 ┆ _ o_ p_ t_ s_ t_ r_ i_ n_ g. ┆
0x09e0…0a00 20 20 20 20 54 68 65 20 65 72 72 6f 72 20 6d 65 73 73 61 67 65 20 63 61 6e 20 62 65 20 64 69 73 ┆ The error message can be dis┆
0x0a00…0a20 61 62 6c 65 64 20 62 79 20 73 65 74 74 69 6e 67 20 5f 08 6f 5f 08 70 5f 08 74 5f 08 65 5f 08 72 ┆abled by setting _ o_ p_ t_ e_ r┆
0x0a20…0a40 5f 08 72 20 74 6f 20 30 2e 0a 20 20 20 20 20 4f 74 68 65 72 77 69 73 65 2c 20 69 74 20 72 65 74 ┆_ r to 0. Otherwise, it ret┆
0x0a40…0a60 75 72 6e 73 20 74 68 65 20 6f 70 74 69 6f 6e 20 63 68 61 72 61 63 74 65 72 20 74 68 61 74 20 77 ┆urns the option character that w┆
0x0a60…0a80 61 73 0a 20 20 20 20 20 64 65 74 65 63 74 65 64 2e 0a 0a 45 08 45 08 45 08 45 58 08 58 08 58 08 ┆as detected. E E E EX X X ┆
0x0a80…0aa0 58 41 08 41 08 41 08 41 4d 08 4d 08 4d 08 4d 50 08 50 08 50 08 50 4c 08 4c 08 4c 08 4c 45 08 45 ┆XA A A AM M M MP P P PL L L LE E┆
0x0aa0…0ac0 08 45 08 45 0a 20 20 20 20 20 54 68 65 20 66 6f 6c 6c 6f 77 69 6e 67 20 63 6f 64 65 20 66 72 61 ┆ E E The following code fra┆
0x0ac0…0ae0 67 6d 65 6e 74 20 73 68 6f 77 73 20 68 6f 77 20 6f 6e 65 20 6d 69 67 68 74 20 70 72 6f 63 65 73 ┆gment shows how one might proces┆
0x0ae0…0b00 73 20 74 68 65 0a 20 20 20 20 20 61 72 72 67 75 6d 65 6e 74 73 20 66 6f 72 20 61 20 63 6f 6d 6d ┆s the arrguments for a comm┆
0x0b00…0b20 61 6e 64 20 74 68 61 6e 20 63 61 6e 20 74 61 6b 65 20 74 68 65 20 6d 75 74 75 61 6c 6c 79 0a 20 ┆and than can take the mutually ┆
0x0b20…0b40 20 20 20 20 65 78 63 6c 75 73 69 76 65 20 6f 70 74 69 6f 6e 73 20 2d 5f 08 61 20 61 6e 64 20 2d ┆ exclusive options -_ a and -┆
0x0b40…0b60 5f 08 62 2c 20 61 6e 64 20 74 68 65 20 6f 70 74 69 6f 6e 73 20 2d 5f 08 66 20 61 6e 64 20 2d 5f ┆_ b, and the options -_ f and -_┆
0x0b60…0b80 08 6f 2c 20 62 6f 74 68 0a 20 20 20 20 20 6f 66 20 77 68 69 63 68 20 72 65 71 75 69 72 65 20 61 ┆ o, both of which require a┆
0x0b80…0ba0 72 67 75 6d 65 6e 74 73 3a 0a 0a 20 20 20 20 20 20 20 20 20 20 23 69 6e 63 6c 75 64 65 20 3c 73 ┆rguments: #include <s┆
0x0ba0…0bc0 74 64 69 6f 2e 68 3e 0a 20 20 20 20 20 20 20 20 20 20 23 69 6e 63 6c 75 64 65 20 3c 73 79 73 2f ┆tdio.h> #include <sys/┆
0x0bc0…0be0 74 79 70 65 73 2e 68 3e 0a 20 20 20 20 20 20 20 20 20 20 23 69 6e 63 6c 75 64 65 20 3c 75 6e 69 ┆types.h> #include <uni┆
0x0be0…0c00 73 74 64 2e 68 3e 0a 0a 20 20 20 20 20 20 20 20 20 20 6d 61 69 6e 28 61 72 67 63 2c 20 61 72 67 ┆std.h> main(argc, arg┆
0x0c00…0c20 76 29 0a 20 20 20 20 20 20 20 20 20 20 69 6e 74 20 61 72 67 63 3b 0a 20 20 20 20 20 20 20 20 20 ┆v) int argc; ┆
0x0c20…0c40 20 63 68 61 72 20 2a 2a 61 72 67 76 3b 0a 20 20 20 20 20 20 20 20 20 20 7b 0a 20 20 20 20 20 20 ┆ char **argv; { ┆
0x0c40…0c60 20 20 20 20 20 20 20 20 20 69 6e 74 20 63 3b 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 69 ┆ int c; i┆
0x0c60…0c80 6e 74 20 61 66 6c 67 2c 20 62 66 6c 67 2c 20 65 72 72 66 6c 67 3b 0a 20 20 20 20 20 20 20 20 20 ┆nt aflg, bflg, errflg; ┆
0x0c80…0ca0 20 20 20 20 20 20 63 68 61 72 20 2a 69 66 69 6c 65 20 3d 20 4e 55 4c 4c 3b 0a 20 20 20 20 20 20 ┆ char *ifile = NULL; ┆
0x0ca0…0cc0 20 20 20 20 20 20 20 20 20 63 68 61 72 20 2a 6f 66 69 6c 65 20 3d 20 4e 55 4c 4c 3b 0a 0a 0a 0a ┆ char *ofile = NULL; ┆
0x0cc0…0ce0 0a 0a 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 65 78 74 65 72 6e 20 63 68 61 72 20 2a 6f ┆ extern char *o┆
0x0ce0…0d00 70 74 61 72 67 3b 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 65 78 74 65 72 6e 20 69 6e 74 ┆ptarg; extern int┆
0x0d00…0d20 20 6f 70 74 69 6e 64 3b 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 2e 0a 20 20 20 20 20 20 ┆ optind; . ┆
0x0d20…0d40 20 20 20 20 20 20 20 20 20 2e 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 2e 0a 20 20 20 20 ┆ . . ┆
0x0d40…0d60 20 20 20 20 20 20 20 20 20 20 20 61 66 6c 67 20 3d 20 62 66 6c 67 20 3d 20 65 72 72 66 6c 67 20 ┆ aflg = bflg = errflg ┆
0x0d60…0d80 3d 20 30 3b 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 77 68 69 6c 65 20 28 28 63 20 3d 20 ┆= 0; while ((c = ┆
0x0d80…0da0 67 65 74 6f 70 74 28 61 72 67 63 2c 20 61 72 67 76 2c 20 22 61 62 66 3a 6f 3a 22 29 29 20 21 3d ┆getopt(argc, argv, "abf:o:")) !=┆
0x0da0…0dc0 20 45 4f 46 29 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 73 77 69 74 63 68 ┆ EOF) switch┆
0x0dc0…0de0 20 28 63 29 20 7b 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 63 61 73 65 20 ┆ (c) { case ┆
0x0de0…0e00 27 61 27 3a 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 69 66 ┆'a': if┆
0x0e00…0e20 20 28 62 66 6c 67 29 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 ┆ (bflg) ┆
0x0e20…0e40 20 20 20 20 20 20 65 72 72 66 6c 67 2b 2b 3b 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 ┆ errflg++; ┆
0x0e40…0e60 20 20 20 20 20 20 20 20 20 65 6c 73 65 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 ┆ else ┆
0x0e60…0e80 20 20 20 20 20 20 20 20 20 20 20 20 61 66 6c 67 2b 2b 3b 0a 20 20 20 20 20 20 20 20 20 20 20 20 ┆ aflg++; ┆
0x0e80…0ea0 20 20 20 20 20 20 20 20 20 20 20 20 20 62 72 65 61 6b 3b 0a 20 20 20 20 20 20 20 20 20 20 20 20 ┆ break; ┆
0x0ea0…0ec0 20 20 20 20 20 20 20 20 63 61 73 65 20 27 62 27 3a 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 ┆ case 'b': ┆
0x0ec0…0ee0 20 20 20 20 20 20 20 20 20 20 20 69 66 20 28 61 66 6c 67 29 0a 20 20 20 20 20 20 20 20 20 20 20 ┆ if (aflg) ┆
0x0ee0…0f00 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 65 72 72 66 6c 67 2b 2b 3b 0a 20 20 20 ┆ errflg++; ┆
0x0f00…0f20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 65 6c 73 65 0a 20 20 20 20 20 ┆ else ┆
0x0f20…0f40 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 62 66 6c 67 2b 2b 3b ┆ bflg++;┆
0x0f40…0f60 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 62 72 65 61 6b 3b ┆ break;┆
0x0f60…0f80 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 63 61 73 65 20 27 66 27 3a 0a 20 ┆ case 'f': ┆
0x0f80…0fa0 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 69 66 69 6c 65 20 3d 20 ┆ ifile = ┆
0x0fa0…0fc0 6f 70 74 61 72 67 3b 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 ┆optarg; ┆
0x0fc0…0fe0 20 62 72 65 61 6b 3b 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 63 61 73 65 ┆ break; case┆
0x0fe0…1000 20 27 6f 27 3a 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 6f ┆ 'o': o┆
0x1000…1020 66 69 6c 65 20 3d 20 6f 70 74 61 72 67 3b 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 ┆file = optarg; ┆
0x1020…1040 20 20 20 20 20 20 20 20 62 72 65 61 6b 3b 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 ┆ break; ┆
0x1040…1060 20 20 20 63 61 73 65 20 27 3f 27 3a 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 ┆ case '?': ┆
0x1060…1080 20 20 20 20 20 20 65 72 72 66 6c 67 2b 2b 3b 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 ┆ errflg++; ┆
0x1080…10a0 20 20 20 20 20 20 20 20 20 62 72 65 61 6b 3b 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 ┆ break; ┆
0x10a0…10c0 20 20 20 20 7d 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 69 66 20 28 65 72 72 66 6c 67 29 ┆ } if (errflg)┆
0x10c0…10e0 20 7b 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 66 70 72 69 6e 74 66 28 73 ┆ { fprintf(s┆
0x10e0…1100 74 64 65 72 72 2c 20 22 55 73 61 67 65 3a 20 2e 2e 2e 22 29 3b 0a 20 20 20 20 20 20 20 20 20 20 ┆tderr, "Usage: ..."); ┆
0x1100…1120 20 20 20 20 20 20 20 20 20 20 65 78 69 74 28 32 29 3b 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 ┆ exit(2); ┆
0x1120…1140 20 20 7d 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 66 6f 72 20 28 3b 20 6f 70 74 69 6e 64 ┆ } for (; optind┆
0x1140…1160 20 3c 20 61 72 67 63 3b 20 6f 70 74 69 6e 64 2b 2b 29 20 7b 0a 20 20 20 20 20 20 20 20 20 20 20 ┆ < argc; optind++) { ┆
0x1160…1180 20 20 20 20 20 20 20 20 20 69 66 20 28 61 63 63 65 73 73 28 61 72 67 76 5b 6f 70 74 69 6e 64 5d ┆ if (access(argv[optind]┆
0x1180…11a0 2c 20 52 5f 4f 4b 29 20 7b 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 2e 0a ┆, R_OK) { . ┆
0x11a0…11c0 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 2e 0a 20 20 20 20 20 20 20 20 20 20 ┆ . ┆
0x11c0…11e0 20 20 20 20 20 20 20 20 20 20 2e 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 7d 0a 0a 4e 08 ┆ . } N ┆
0x11e0…1200 4e 08 4e 08 4e 4f 08 4f 08 4f 08 4f 54 08 54 08 54 08 54 45 08 45 08 45 08 45 53 08 53 08 53 08 ┆N N NO O O OT T T TE E E ES S S ┆
0x1200…1220 53 0a 20 20 20 20 20 54 68 65 20 63 68 61 72 61 63 74 65 72 73 20 2d 08 2d 08 2d 08 2d 20 61 6e ┆S The characters - - - - an┆
0x1220…1240 64 20 3f 08 3f 08 3f 08 3f 20 73 68 6f 75 6c 64 20 6e 6f 74 20 62 65 20 75 73 65 64 20 66 6f 72 ┆d ? ? ? ? should not be used for┆
0x1240…1260 20 6f 70 74 69 6f 6e 73 20 61 73 0a 20 20 20 20 20 74 68 65 79 20 61 72 65 20 75 73 65 64 20 66 ┆ options as they are used f┆
0x1260…1280 6f 72 20 6f 74 68 65 72 20 70 75 72 70 6f 73 65 73 20 69 6e 20 74 68 69 73 20 66 75 6e 63 74 69 ┆or other purposes in this functi┆
0x1280…12a0 6f 6e 2e 0a 0a 0a 0a 4d 61 72 63 68 20 31 39 38 39 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 ┆on. March 1989 ┆
0x12a0…12c0 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 54 58 20 50 72 6f 67 72 61 6d 6d 65 72 27 73 20 52 ┆ TX Programmer's R┆
0x12c0…12d5 65 66 65 72 65 6e 63 65 0a 0a 0a 0a 0a 0a 0a 0a 0a 0a 0a 0a 0a ┆eference ┆