home *** CD-ROM | disk | FTP | other *** search
/ Language/OS - Multiplatform Resource Library / LANGUAGE OS.iso / a_utils / perl / mac-perl / gdbm15st.bin / gdbm / getopt1.c < prev    next >
MacBinary  |  1991-11-19  |  4.0 KB  |  [TEXT/MPS ]

open in: MacOS 8.1     |     Win98     |     DOS

browse contents    |     view JSON data     |     view as text


This file was processed as: MacBinary (archive/macBinary).

ConfidenceProgramDetectionMatch TypeSupport
66% dexvert Compact Compressed (Unix) (archive/compact) ext Supported
10% dexvert MacBinary (archive/macBinary) fallback Supported
1% dexvert Text File (text/txt) fallback Supported
100% file MacBinary II, Mon Nov 18 20:54:08 1991, modified Mon Nov 18 20:54:08 1991, creator 'MPS ', type ASCII, 3388 bytes "getopt1.c" , at 0xdbc 428 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
keyvalue
macFileType[TEXT]
macFileCreator[MPS ]



hex view
+--------+-------------------------+-------------------------+--------+--------+
|00000000| 00 09 67 65 74 6f 70 74 | 31 2e 63 00 00 00 00 00 |..getopt|1.c.....|
|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 4d 50 53 | 20 00 00 00 00 00 00 00 |.TEXTMPS| .......|
|00000050| 00 00 00 00 00 0d 3c 00 | 00 01 ac a5 4e 1f 40 a5 |......<.|....N.@.|
|00000060| 4e 1f 40 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |N.@.....|........|
|00000070| 00 00 00 00 00 00 00 00 | 00 00 81 81 bb 87 00 00 |........|........|
|00000080| 2f 2a 20 47 65 74 6f 70 | 74 20 66 6f 72 20 47 4e |/* Getop|t for GN|
|00000090| 55 2e 0d 20 20 20 43 6f | 70 79 72 69 67 68 74 20 |U.. Co|pyright |
|000000a0| 28 43 29 20 31 39 38 37 | 2c 20 31 39 38 39 20 46 |(C) 1987|, 1989 F|
|000000b0| 72 65 65 20 53 6f 66 74 | 77 61 72 65 20 46 6f 75 |ree Soft|ware Fou|
|000000c0| 6e 64 61 74 69 6f 6e 2c | 20 49 6e 63 2e 0d 0d 20 |ndation,| Inc... |
|000000d0| 20 20 54 68 69 73 20 70 | 72 6f 67 72 61 6d 20 69 | This p|rogram i|
|000000e0| 73 20 66 72 65 65 20 73 | 6f 66 74 77 61 72 65 3b |s free s|oftware;|
|000000f0| 20 79 6f 75 20 63 61 6e | 20 72 65 64 69 73 74 72 | you can| redistr|
|00000100| 69 62 75 74 65 20 69 74 | 20 61 6e 64 2f 6f 72 20 |ibute it| and/or |
|00000110| 6d 6f 64 69 66 79 0d 20 | 20 20 69 74 20 75 6e 64 |modify. | it und|
|00000120| 65 72 20 74 68 65 20 74 | 65 72 6d 73 20 6f 66 20 |er the t|erms of |
|00000130| 74 68 65 20 47 4e 55 20 | 47 65 6e 65 72 61 6c 20 |the GNU |General |
|00000140| 50 75 62 6c 69 63 20 4c | 69 63 65 6e 73 65 20 61 |Public L|icense a|
|00000150| 73 20 70 75 62 6c 69 73 | 68 65 64 20 62 79 0d 20 |s publis|hed by. |
|00000160| 20 20 74 68 65 20 46 72 | 65 65 20 53 6f 66 74 77 | the Fr|ee Softw|
|00000170| 61 72 65 20 46 6f 75 6e | 64 61 74 69 6f 6e 3b 20 |are Foun|dation; |
|00000180| 65 69 74 68 65 72 20 76 | 65 72 73 69 6f 6e 20 31 |either v|ersion 1|
|00000190| 2c 20 6f 72 20 28 61 74 | 20 79 6f 75 72 20 6f 70 |, or (at| your op|
|000001a0| 74 69 6f 6e 29 0d 20 20 | 20 61 6e 79 20 6c 61 74 |tion). | any lat|
|000001b0| 65 72 20 76 65 72 73 69 | 6f 6e 2e 0d 0d 20 20 20 |er versi|on... |
|000001c0| 54 68 69 73 20 70 72 6f | 67 72 61 6d 20 69 73 20 |This pro|gram is |
|000001d0| 64 69 73 74 72 69 62 75 | 74 65 64 20 69 6e 20 74 |distribu|ted in t|
|000001e0| 68 65 20 68 6f 70 65 20 | 74 68 61 74 20 69 74 20 |he hope |that it |
|000001f0| 77 69 6c 6c 20 62 65 20 | 75 73 65 66 75 6c 2c 0d |will be |useful,.|
|00000200| 20 20 20 62 75 74 20 57 | 49 54 48 4f 55 54 20 41 | but W|ITHOUT A|
|00000210| 4e 59 20 57 41 52 52 41 | 4e 54 59 3b 20 77 69 74 |NY WARRA|NTY; wit|
|00000220| 68 6f 75 74 20 65 76 65 | 6e 20 74 68 65 20 69 6d |hout eve|n the im|
|00000230| 70 6c 69 65 64 20 77 61 | 72 72 61 6e 74 79 20 6f |plied wa|rranty o|
|00000240| 66 0d 20 20 20 4d 45 52 | 43 48 41 4e 54 41 42 49 |f. MER|CHANTABI|
|00000250| 4c 49 54 59 20 6f 72 20 | 46 49 54 4e 45 53 53 20 |LITY or |FITNESS |
|00000260| 46 4f 52 20 41 20 50 41 | 52 54 49 43 55 4c 41 52 |FOR A PA|RTICULAR|
|00000270| 20 50 55 52 50 4f 53 45 | 2e 20 20 53 65 65 20 74 | PURPOSE|. See t|
|00000280| 68 65 0d 20 20 20 47 4e | 55 20 47 65 6e 65 72 61 |he. GN|U Genera|
|00000290| 6c 20 50 75 62 6c 69 63 | 20 4c 69 63 65 6e 73 65 |l Public| License|
|000002a0| 20 66 6f 72 20 6d 6f 72 | 65 20 64 65 74 61 69 6c | for mor|e detail|
|000002b0| 73 2e 0d 0d 20 20 20 59 | 6f 75 20 73 68 6f 75 6c |s... Y|ou shoul|
|000002c0| 64 20 68 61 76 65 20 72 | 65 63 65 69 76 65 64 20 |d have r|eceived |
|000002d0| 61 20 63 6f 70 79 20 6f | 66 20 74 68 65 20 47 4e |a copy o|f the GN|
|000002e0| 55 20 47 65 6e 65 72 61 | 6c 20 50 75 62 6c 69 63 |U Genera|l Public|
|000002f0| 20 4c 69 63 65 6e 73 65 | 0d 20 20 20 61 6c 6f 6e | License|. alon|
|00000300| 67 20 77 69 74 68 20 74 | 68 69 73 20 70 72 6f 67 |g with t|his prog|
|00000310| 72 61 6d 3b 20 69 66 20 | 6e 6f 74 2c 20 77 72 69 |ram; if |not, wri|
|00000320| 74 65 20 74 6f 20 74 68 | 65 20 46 72 65 65 20 53 |te to th|e Free S|
|00000330| 6f 66 74 77 61 72 65 0d | 20 20 20 46 6f 75 6e 64 |oftware.| Found|
|00000340| 61 74 69 6f 6e 2c 20 49 | 6e 63 2e 2c 20 36 37 35 |ation, I|nc., 675|
|00000350| 20 4d 61 73 73 20 41 76 | 65 2c 20 43 61 6d 62 72 | Mass Av|e, Cambr|
|00000360| 69 64 67 65 2c 20 4d 41 | 20 30 32 31 33 39 2c 20 |idge, MA| 02139, |
|00000370| 55 53 41 2e 20 20 2a 2f | 0d 0c 0d 23 69 6e 63 6c |USA. */|...#incl|
|00000380| 75 64 65 20 22 67 65 74 | 6f 70 74 2e 68 22 0d 0d |ude "get|opt.h"..|
|00000390| 23 69 66 64 65 66 20 5f | 5f 53 54 44 43 5f 5f 0d |#ifdef _|_STDC__.|
|000003a0| 23 64 65 66 69 6e 65 20 | 43 4f 4e 53 54 20 63 6f |#define |CONST co|
|000003b0| 6e 73 74 0d 23 65 6c 73 | 65 0d 23 64 65 66 69 6e |nst.#els|e.#defin|
|000003c0| 65 20 43 4f 4e 53 54 0d | 23 65 6e 64 69 66 0d 0d |e CONST.|#endif..|
|000003d0| 23 69 66 20 21 64 65 66 | 69 6e 65 64 20 28 4e 55 |#if !def|ined (NU|
|000003e0| 4c 4c 29 0d 23 64 65 66 | 69 6e 65 20 4e 55 4c 4c |LL).#def|ine NULL|
|000003f0| 20 30 0d 23 65 6e 64 69 | 66 0d 0d 69 6e 74 0d 67 | 0.#endi|f..int.g|
|00000400| 65 74 6f 70 74 5f 6c 6f | 6e 67 20 28 61 72 67 63 |etopt_lo|ng (argc|
|00000410| 2c 20 61 72 67 76 2c 20 | 6f 70 74 69 6f 6e 73 2c |, argv, |options,|
|00000420| 20 6c 6f 6e 67 5f 6f 70 | 74 69 6f 6e 73 2c 20 6f | long_op|tions, o|
|00000430| 70 74 5f 69 6e 64 65 78 | 29 0d 20 20 20 20 20 69 |pt_index|). i|
|00000440| 6e 74 20 61 72 67 63 3b | 0d 20 20 20 20 20 63 68 |nt argc;|. ch|
|00000450| 61 72 20 2a 2a 61 72 67 | 76 3b 0d 20 20 20 20 20 |ar **arg|v;. |
|00000460| 43 4f 4e 53 54 20 63 68 | 61 72 20 2a 6f 70 74 69 |CONST ch|ar *opti|
|00000470| 6f 6e 73 3b 0d 20 20 20 | 20 20 43 4f 4e 53 54 20 |ons;. | CONST |
|00000480| 73 74 72 75 63 74 20 6f | 70 74 69 6f 6e 20 2a 6c |struct o|ption *l|
|00000490| 6f 6e 67 5f 6f 70 74 69 | 6f 6e 73 3b 0d 20 20 20 |ong_opti|ons;. |
|000004a0| 20 20 69 6e 74 20 2a 6f | 70 74 5f 69 6e 64 65 78 | int *o|pt_index|
|000004b0| 3b 0d 7b 0d 20 20 69 6e | 74 20 76 61 6c 3b 0d 0d |;.{. in|t val;..|
|000004c0| 20 20 5f 67 65 74 6f 70 | 74 5f 6c 6f 6e 67 5f 6f | _getop|t_long_o|
|000004d0| 70 74 69 6f 6e 73 20 3d | 20 6c 6f 6e 67 5f 6f 70 |ptions =| long_op|
|000004e0| 74 69 6f 6e 73 3b 0d 20 | 20 76 61 6c 20 3d 20 67 |tions;. | val = g|
|000004f0| 65 74 6f 70 74 20 28 61 | 72 67 63 2c 20 61 72 67 |etopt (a|rgc, arg|
|00000500| 76 2c 20 6f 70 74 69 6f | 6e 73 29 3b 0d 20 20 69 |v, optio|ns);. i|
|00000510| 66 20 28 76 61 6c 20 3d | 3d 20 30 20 26 26 20 6f |f (val =|= 0 && o|
|00000520| 70 74 5f 69 6e 64 65 78 | 20 21 3d 20 4e 55 4c 4c |pt_index| != NULL|
|00000530| 29 0d 20 20 20 20 2a 6f | 70 74 5f 69 6e 64 65 78 |). *o|pt_index|
|00000540| 20 3d 20 6f 70 74 69 6f | 6e 5f 69 6e 64 65 78 3b | = optio|n_index;|
|00000550| 0d 20 20 72 65 74 75 72 | 6e 20 76 61 6c 3b 0d 7d |. retur|n val;.}|
|00000560| 0d 0d 2f 2a 20 4c 69 6b | 65 20 67 65 74 6f 70 74 |../* Lik|e getopt|
|00000570| 5f 6c 6f 6e 67 2c 20 62 | 75 74 20 27 2d 27 20 61 |_long, b|ut '-' a|
|00000580| 73 20 77 65 6c 6c 20 61 | 73 20 27 2b 27 20 63 61 |s well a|s '+' ca|
|00000590| 6e 20 69 6e 64 69 63 61 | 74 65 20 61 20 6c 6f 6e |n indica|te a lon|
|000005a0| 67 20 6f 70 74 69 6f 6e | 2e 0d 20 20 20 49 66 20 |g option|.. If |
|000005b0| 61 6e 20 6f 70 74 69 6f | 6e 20 74 68 61 74 20 73 |an optio|n that s|
|000005c0| 74 61 72 74 73 20 77 69 | 74 68 20 27 2d 27 20 64 |tarts wi|th '-' d|
|000005d0| 6f 65 73 6e 27 74 20 6d | 61 74 63 68 20 61 20 6c |oesn't m|atch a l|
|000005e0| 6f 6e 67 20 6f 70 74 69 | 6f 6e 2c 0d 20 20 20 62 |ong opti|on,. b|
|000005f0| 75 74 20 64 6f 65 73 20 | 6d 61 74 63 68 20 61 20 |ut does |match a |
|00000600| 73 68 6f 72 74 20 6f 70 | 74 69 6f 6e 2c 20 69 74 |short op|tion, it|
|00000610| 20 69 73 20 70 61 72 73 | 65 64 20 61 73 20 61 20 | is pars|ed as a |
|00000620| 73 68 6f 72 74 20 6f 70 | 74 69 6f 6e 0d 20 20 20 |short op|tion. |
|00000630| 69 6e 73 74 65 61 64 2e | 20 2a 2f 0d 0d 69 6e 74 |instead.| */..int|
|00000640| 20 0d 67 65 74 6f 70 74 | 5f 6c 6f 6e 67 5f 6f 6e | .getopt|_long_on|
|00000650| 6c 79 20 28 61 72 67 63 | 2c 20 61 72 67 76 2c 20 |ly (argc|, argv, |
|00000660| 6f 70 74 69 6f 6e 73 2c | 20 6c 6f 6e 67 5f 6f 70 |options,| long_op|
|00000670| 74 69 6f 6e 73 2c 20 6f | 70 74 5f 69 6e 64 65 78 |tions, o|pt_index|
|00000680| 29 0d 20 20 20 20 20 69 | 6e 74 20 61 72 67 63 3b |). i|nt argc;|
|00000690| 0d 20 20 20 20 20 63 68 | 61 72 20 2a 2a 61 72 67 |. ch|ar **arg|
|000006a0| 76 3b 0d 20 20 20 20 20 | 43 4f 4e 53 54 20 63 68 |v;. |CONST ch|
|000006b0| 61 72 20 2a 6f 70 74 69 | 6f 6e 73 3b 0d 20 20 20 |ar *opti|ons;. |
|000006c0| 20 20 43 4f 4e 53 54 20 | 73 74 72 75 63 74 20 6f | CONST |struct o|
|000006d0| 70 74 69 6f 6e 20 2a 6c | 6f 6e 67 5f 6f 70 74 69 |ption *l|ong_opti|
|000006e0| 6f 6e 73 3b 0d 20 20 20 | 20 20 69 6e 74 20 2a 6f |ons;. | int *o|
|000006f0| 70 74 5f 69 6e 64 65 78 | 3b 0d 7b 0d 20 20 69 6e |pt_index|;.{. in|
|00000700| 74 20 76 61 6c 3b 0d 0d | 20 20 5f 67 65 74 6f 70 |t val;..| _getop|
|00000710| 74 5f 6c 6f 6e 67 5f 6f | 70 74 69 6f 6e 73 20 3d |t_long_o|ptions =|
|00000720| 20 6c 6f 6e 67 5f 6f 70 | 74 69 6f 6e 73 3b 0d 20 | long_op|tions;. |
|00000730| 20 5f 67 65 74 6f 70 74 | 5f 6c 6f 6e 67 5f 6f 6e | _getopt|_long_on|
|00000740| 6c 79 20 3d 20 31 3b 0d | 20 20 76 61 6c 20 3d 20 |ly = 1;.| val = |
|00000750| 67 65 74 6f 70 74 20 28 | 61 72 67 63 2c 20 61 72 |getopt (|argc, ar|
|00000760| 67 76 2c 20 6f 70 74 69 | 6f 6e 73 29 3b 0d 20 20 |gv, opti|ons);. |
|00000770| 69 66 20 28 76 61 6c 20 | 3d 3d 20 30 20 26 26 20 |if (val |== 0 && |
|00000780| 6f 70 74 5f 69 6e 64 65 | 78 20 21 3d 20 4e 55 4c |opt_inde|x != NUL|
|00000790| 4c 29 0d 20 20 20 20 2a | 6f 70 74 5f 69 6e 64 65 |L). *|opt_inde|
|000007a0| 78 20 3d 20 6f 70 74 69 | 6f 6e 5f 69 6e 64 65 78 |x = opti|on_index|
|000007b0| 3b 0d 20 20 72 65 74 75 | 72 6e 20 76 61 6c 3b 0d |;. retu|rn val;.|
|000007c0| 7d 0d 0c 0d 0d 23 69 66 | 64 65 66 20 54 45 53 54 |}....#if|def TEST|
|000007d0| 0d 0d 23 69 6e 63 6c 75 | 64 65 20 3c 73 74 64 69 |..#inclu|de <stdi|
|000007e0| 6f 2e 68 3e 0d 0d 69 6e | 74 0d 6d 61 69 6e 20 28 |o.h>..in|t.main (|
|000007f0| 61 72 67 63 2c 20 61 72 | 67 76 29 0d 20 20 20 20 |argc, ar|gv). |
|00000800| 20 69 6e 74 20 61 72 67 | 63 3b 0d 20 20 20 20 20 | int arg|c;. |
|00000810| 63 68 61 72 20 2a 2a 61 | 72 67 76 3b 0d 7b 0d 20 |char **a|rgv;.{. |
|00000820| 20 69 6e 74 20 63 3b 0d | 20 20 69 6e 74 20 64 69 | int c;.| int di|
|00000830| 67 69 74 5f 6f 70 74 69 | 6e 64 20 3d 20 30 3b 0d |git_opti|nd = 0;.|
|00000840| 0d 20 20 77 68 69 6c 65 | 20 28 31 29 0d 20 20 20 |. while| (1). |
|00000850| 20 7b 0d 20 20 20 20 20 | 20 69 6e 74 20 74 68 69 | {. | int thi|
|00000860| 73 5f 6f 70 74 69 6f 6e | 5f 6f 70 74 69 6e 64 20 |s_option|_optind |
|00000870| 3d 20 6f 70 74 69 6e 64 | 20 3f 20 6f 70 74 69 6e |= optind| ? optin|
|00000880| 64 20 3a 20 31 3b 0d 20 | 20 20 20 20 20 63 68 61 |d : 1;. | cha|
|00000890| 72 20 2a 6e 61 6d 65 20 | 3d 20 27 5c 30 27 3b 0d |r *name |= '\0';.|
|000008a0| 20 20 20 20 20 20 69 6e | 74 20 6f 70 74 69 6f 6e | in|t option|
|000008b0| 5f 69 6e 64 65 78 20 3d | 20 30 3b 0d 20 20 20 20 |_index =| 0;. |
|000008c0| 20 20 73 74 61 74 69 63 | 20 73 74 72 75 63 74 20 | static| struct |
|000008d0| 6f 70 74 69 6f 6e 20 6c | 6f 6e 67 5f 6f 70 74 69 |option l|ong_opti|
|000008e0| 6f 6e 73 5b 5d 20 3d 0d | 20 20 20 20 20 20 7b 0d |ons[] =.| {.|
|000008f0| 09 7b 22 61 64 64 22 2c | 20 31 2c 20 30 2c 20 30 |.{"add",| 1, 0, 0|
|00000900| 7d 2c 0d 09 7b 22 61 70 | 70 65 6e 64 22 2c 20 30 |},..{"ap|pend", 0|
|00000910| 2c 20 30 2c 20 30 7d 2c | 0d 09 7b 22 64 65 6c 65 |, 0, 0},|..{"dele|
|00000920| 74 65 22 2c 20 31 2c 20 | 30 2c 20 30 7d 2c 0d 09 |te", 1, |0, 0},..|
|00000930| 7b 22 76 65 72 62 6f 73 | 65 22 2c 20 30 2c 20 30 |{"verbos|e", 0, 0|
|00000940| 2c 20 30 7d 2c 0d 09 7b | 22 63 72 65 61 74 65 22 |, 0},..{|"create"|
|00000950| 2c 20 30 2c 20 30 2c 20 | 30 7d 2c 0d 09 7b 22 66 |, 0, 0, |0},..{"f|
|00000960| 69 6c 65 22 2c 20 31 2c | 20 30 2c 20 30 7d 2c 0d |ile", 1,| 0, 0},.|
|00000970| 09 7b 30 2c 20 30 2c 20 | 30 2c 20 30 7d 0d 20 20 |.{0, 0, |0, 0}. |
|00000980| 20 20 20 20 7d 3b 0d 0d | 20 20 20 20 20 20 63 20 | };..| c |
|00000990| 3d 20 67 65 74 6f 70 74 | 5f 6c 6f 6e 67 20 28 61 |= getopt|_long (a|
|000009a0| 72 67 63 2c 20 61 72 67 | 76 2c 20 22 61 62 63 3a |rgc, arg|v, "abc:|
|000009b0| 64 3a 30 31 32 33 34 35 | 36 37 38 39 22 2c 0d 09 |d:012345|6789",..|
|000009c0| 09 20 20 20 20 20 20 20 | 6c 6f 6e 67 5f 6f 70 74 |. |long_opt|
|000009d0| 69 6f 6e 73 2c 20 26 6f | 70 74 69 6f 6e 5f 69 6e |ions, &o|ption_in|
|000009e0| 64 65 78 29 3b 0d 20 20 | 20 20 20 20 69 66 20 28 |dex);. | if (|
|000009f0| 63 20 3d 3d 20 45 4f 46 | 29 0d 09 62 72 65 61 6b |c == EOF|)..break|
|00000a00| 3b 0d 0d 20 20 20 20 20 | 20 73 77 69 74 63 68 20 |;.. | switch |
|00000a10| 28 63 29 0d 09 7b 0d 09 | 63 61 73 65 20 30 3a 0d |(c)..{..|case 0:.|
|00000a20| 09 20 20 70 72 69 6e 74 | 66 20 28 22 6f 70 74 69 |. print|f ("opti|
|00000a30| 6f 6e 20 25 73 22 2c 20 | 28 6c 6f 6e 67 5f 6f 70 |on %s", |(long_op|
|00000a40| 74 69 6f 6e 73 5b 6f 70 | 74 69 6f 6e 5f 69 6e 64 |tions[op|tion_ind|
|00000a50| 65 78 5d 29 2e 6e 61 6d | 65 29 3b 0d 09 20 20 69 |ex]).nam|e);.. i|
|00000a60| 66 20 28 6f 70 74 61 72 | 67 29 0d 09 20 20 20 20 |f (optar|g).. |
|00000a70| 70 72 69 6e 74 66 20 28 | 22 20 77 69 74 68 20 61 |printf (|" with a|
|00000a80| 72 67 20 25 73 22 2c 20 | 6f 70 74 61 72 67 29 3b |rg %s", |optarg);|
|00000a90| 0d 09 20 20 70 72 69 6e | 74 66 20 28 22 5c 6e 22 |.. prin|tf ("\n"|
|00000aa0| 29 3b 0d 09 20 20 62 72 | 65 61 6b 3b 0d 0d 09 63 |);.. br|eak;...c|
|00000ab0| 61 73 65 20 27 30 27 3a | 0d 09 63 61 73 65 20 27 |ase '0':|..case '|
|00000ac0| 31 27 3a 0d 09 63 61 73 | 65 20 27 32 27 3a 0d 09 |1':..cas|e '2':..|
|00000ad0| 63 61 73 65 20 27 33 27 | 3a 0d 09 63 61 73 65 20 |case '3'|:..case |
|00000ae0| 27 34 27 3a 0d 09 63 61 | 73 65 20 27 35 27 3a 0d |'4':..ca|se '5':.|
|00000af0| 09 63 61 73 65 20 27 36 | 27 3a 0d 09 63 61 73 65 |.case '6|':..case|
|00000b00| 20 27 37 27 3a 0d 09 63 | 61 73 65 20 27 38 27 3a | '7':..c|ase '8':|
|00000b10| 0d 09 63 61 73 65 20 27 | 39 27 3a 0d 09 20 20 69 |..case '|9':.. i|
|00000b20| 66 20 28 64 69 67 69 74 | 5f 6f 70 74 69 6e 64 20 |f (digit|_optind |
|00000b30| 21 3d 20 30 20 26 26 20 | 64 69 67 69 74 5f 6f 70 |!= 0 && |digit_op|
|00000b40| 74 69 6e 64 20 21 3d 20 | 74 68 69 73 5f 6f 70 74 |tind != |this_opt|
|00000b50| 69 6f 6e 5f 6f 70 74 69 | 6e 64 29 0d 09 20 20 20 |ion_opti|nd).. |
|00000b60| 20 70 72 69 6e 74 66 20 | 28 22 64 69 67 69 74 73 | printf |("digits|
|00000b70| 20 6f 63 63 75 72 20 69 | 6e 20 74 77 6f 20 64 69 | occur i|n two di|
|00000b80| 66 66 65 72 65 6e 74 20 | 61 72 67 76 2d 65 6c 65 |fferent |argv-ele|
|00000b90| 6d 65 6e 74 73 2e 5c 6e | 22 29 3b 0d 09 20 20 64 |ments.\n|");.. d|
|00000ba0| 69 67 69 74 5f 6f 70 74 | 69 6e 64 20 3d 20 74 68 |igit_opt|ind = th|
|00000bb0| 69 73 5f 6f 70 74 69 6f | 6e 5f 6f 70 74 69 6e 64 |is_optio|n_optind|
|00000bc0| 3b 0d 09 20 20 70 72 69 | 6e 74 66 20 28 22 6f 70 |;.. pri|ntf ("op|
|00000bd0| 74 69 6f 6e 20 25 63 5c | 6e 22 2c 20 63 29 3b 0d |tion %c\|n", c);.|
|00000be0| 09 20 20 62 72 65 61 6b | 3b 0d 0d 09 63 61 73 65 |. break|;...case|
|00000bf0| 20 27 61 27 3a 0d 09 20 | 20 70 72 69 6e 74 66 20 | 'a':.. | printf |
|00000c00| 28 22 6f 70 74 69 6f 6e | 20 61 5c 6e 22 29 3b 0d |("option| a\n");.|
|00000c10| 09 20 20 62 72 65 61 6b | 3b 0d 0d 09 63 61 73 65 |. break|;...case|
|00000c20| 20 27 62 27 3a 0d 09 20 | 20 70 72 69 6e 74 66 20 | 'b':.. | printf |
|00000c30| 28 22 6f 70 74 69 6f 6e | 20 62 5c 6e 22 29 3b 0d |("option| b\n");.|
|00000c40| 09 20 20 62 72 65 61 6b | 3b 0d 0d 09 63 61 73 65 |. break|;...case|
|00000c50| 20 27 63 27 3a 0d 09 20 | 20 70 72 69 6e 74 66 20 | 'c':.. | printf |
|00000c60| 28 22 6f 70 74 69 6f 6e | 20 63 20 77 69 74 68 20 |("option| c with |
|00000c70| 76 61 6c 75 65 20 60 25 | 73 27 5c 6e 22 2c 20 6f |value `%|s'\n", o|
|00000c80| 70 74 61 72 67 29 3b 0d | 09 20 20 62 72 65 61 6b |ptarg);.|. break|
|00000c90| 3b 0d 0d 09 63 61 73 65 | 20 27 3f 27 3a 0d 09 20 |;...case| '?':.. |
|00000ca0| 20 62 72 65 61 6b 3b 0d | 0d 09 64 65 66 61 75 6c | break;.|..defaul|
|00000cb0| 74 3a 0d 09 20 20 70 72 | 69 6e 74 66 20 28 22 3f |t:.. pr|intf ("?|
|00000cc0| 3f 20 67 65 74 6f 70 74 | 20 72 65 74 75 72 6e 65 |? getopt| returne|
|00000cd0| 64 20 63 68 61 72 61 63 | 74 65 72 20 63 6f 64 65 |d charac|ter code|
|00000ce0| 20 30 25 6f 20 3f 3f 5c | 6e 22 2c 20 63 29 3b 0d | 0%o ??\|n", c);.|
|00000cf0| 09 7d 0d 20 20 20 20 7d | 0d 0d 20 20 69 66 20 28 |.}. }|.. if (|
|00000d00| 6f 70 74 69 6e 64 20 3c | 20 61 72 67 63 29 0d 20 |optind <| argc). |
|00000d10| 20 20 20 7b 0d 20 20 20 | 20 20 20 70 72 69 6e 74 | {. | print|
|00000d20| 66 20 28 22 6e 6f 6e 2d | 6f 70 74 69 6f 6e 20 41 |f ("non-|option A|
|00000d30| 52 47 56 2d 65 6c 65 6d | 65 6e 74 73 3a 20 22 29 |RGV-elem|ents: ")|
|00000d40| 3b 0d 20 20 20 20 20 20 | 77 68 69 6c 65 20 28 6f |;. |while (o|
|00000d50| 70 74 69 6e 64 20 3c 20 | 61 72 67 63 29 0d 09 70 |ptind < |argc)..p|
|00000d60| 72 69 6e 74 66 20 28 22 | 25 73 20 22 2c 20 61 72 |rintf ("|%s ", ar|
|00000d70| 67 76 5b 6f 70 74 69 6e | 64 2b 2b 5d 29 3b 0d 20 |gv[optin|d++]);. |
|00000d80| 20 20 20 20 20 70 72 69 | 6e 74 66 20 28 22 5c 6e | pri|ntf ("\n|
|00000d90| 22 29 3b 0d 20 20 20 20 | 7d 0d 0d 20 20 65 78 69 |");. |}.. exi|
|00000da0| 74 20 28 30 29 3b 0d 7d | 0d 0d 23 65 6e 64 69 66 |t (0);.}|..#endif|
|00000db0| 20 2f 2a 20 54 45 53 54 | 20 2a 2f 0d 00 00 00 00 | /* TEST| */.....|
|00000dc0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00000dd0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00000de0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00000df0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00000e00| 00 00 01 00 00 00 01 6e | 00 00 00 6e 00 00 00 3e |.......n|...n...>|
|00000e10| 4f ef 00 0c 4c ee 18 00 | fe f4 4e 5e 4e 75 8a 5f |O...L...|..N^Nu._|
|00000e20| 73 79 46 41 63 63 65 73 | 73 00 00 2e 0a 64 65 76 |syFAcces|s....dev|
|00000e30| 09 67 65 74 6f 70 74 31 | 2e 63 02 00 00 00 00 00 |.getopt1|.c......|
|00000e40| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00000e50| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00000e60| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00000e70| 00 00 a6 ea ac fe 00 00 | 0d 3c 00 00 01 ac 05 08 |........|.<......|
|00000e80| 01 b0 01 b8 08 08 00 1c | 00 00 00 00 4e 56 00 00 |........|....NV..|
|00000e90| 70 00 4e 5e 4e 75 87 5f | 73 79 52 65 61 64 00 00 |p.N^Nu._|syRead..|
|00000ea0| 05 08 01 b1 01 b8 08 08 | 00 36 00 00 00 00 4e 56 |........|.6....NV|
|00000eb0| 00 00 2f 0c 28 6e 00 08 | 20 2c 00 0c d1 ac 00 10 |../.(n..| ,......|
|00000ec0| 70 00 29 40 00 0c 70 00 | 28 6e ff fc 4e 5e 4e 75 |p.)@..p.|(n..N^Nu|
|00000ed0| 88 5f 73 79 57 72 69 74 | 65 00 00 00 05 08 01 b2 |._syWrit|e.......|
|00000ee0| 01 b8 08 08 00 4a 00 00 | 00 00 4e 56 00 00 2f 0c |.....J..|..NV../.|
|00000ef0| 28 6e 00 10 20 2e 00 0c | 04 80 00 00 66 00 67 06 |(n.. ...|....f.g.|
|00000f00| 00 00 00 48 00 09 4d 6f | 6e 61 63 6f 00 00 00 00 |...H..Mo|naco....|
|00000f10| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00000f20| 00 00 00 00 00 00 00 06 | 00 03 00 64 00 1c 01 dd |........|...d....|
|00000f30| 02 3d 00 64 00 1c 01 dd | 02 3d a5 4d e7 00 00 00 |.=.d....|.=.M....|
|00000f40| 00 00 00 00 00 00 00 00 | 00 00 01 00 00 00 00 1e |........|........|
|00000f50| 00 64 00 1c 01 dd 02 3d | 00 64 00 1c 01 dd 02 3d |.d.....=|.d.....=|
|00000f60| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00000f70| 01 00 00 00 01 6e 00 00 | 00 6e 00 00 00 3e 00 54 |.....n..|.n...>.T|
|00000f80| 46 a4 09 8e 00 00 00 1c | 00 3e 00 00 4d 50 53 52 |F.......|.>..MPSR|
|00000f90| 00 01 00 0a 03 ed ff ff | 00 00 00 00 00 00 00 00 |........|........|
|00000fa0| 03 f0 ff ff 00 00 00 4c | 00 5a 6d 44 00 00 00 00 |.......L|.ZmD....|
|00000fb0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00000fc0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00000fd0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00000fe0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00000ff0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
+--------+-------------------------+-------------------------+--------+--------+