home *** CD-ROM | disk | FTP | other *** search
open in:
MacOS 8.1
|
Win98
|
DOS
browse contents |
view JSON data
|
view as text
This file was processed as: LaTeX Document
(document/latex).
Confidence | Program | Detection | Match Type | Support
|
---|
100%
| dexvert
| LaTeX Document (document/latex)
| magic
| Supported |
1%
| dexvert
| Text File (text/txt)
| fallback
| Supported |
100%
| file
| LaTeX document text
| default
| |
99%
| file
| LaTeX document, ASCII text, with CR line terminators
| default
| |
100%
| checkBytes
| Printable ASCII
| default
| |
100%
| perlTextCheck
| Likely Text (Perl)
| default
| |
100%
| siegfried
| fmt/281 LaTeX (Subdocument)
| default
| |
100%
| detectItEasy
| Format: plain text[CR]
| default (weak)
|
|
id metadata |
---|
key | value |
---|
macFileType | [TEXT] |
macFileCreator | [R*ch] |
hex view+--------+-------------------------+-------------------------+--------+--------+
|00000000| 5c 73 65 63 74 69 6f 6e | 7b 53 74 61 6e 64 61 72 |\section|{Standar|
|00000010| 64 20 4d 6f 64 75 6c 65 | 20 5c 73 65 63 74 63 6f |d Module| \sectco|
|00000020| 64 65 7b 67 65 74 6f 70 | 74 7d 7d 0d 0d 5c 73 74 |de{getop|t}}..\st|
|00000030| 6d 6f 64 69 6e 64 65 78 | 7b 67 65 74 6f 70 74 7d |modindex|{getopt}|
|00000040| 0d 54 68 69 73 20 6d 6f | 64 75 6c 65 20 68 65 6c |.This mo|dule hel|
|00000050| 70 73 20 73 63 72 69 70 | 74 73 20 74 6f 20 70 61 |ps scrip|ts to pa|
|00000060| 72 73 65 20 74 68 65 20 | 63 6f 6d 6d 61 6e 64 20 |rse the |command |
|00000070| 6c 69 6e 65 20 61 72 67 | 75 6d 65 6e 74 73 20 69 |line arg|uments i|
|00000080| 6e 0d 5c 63 6f 64 65 7b | 73 79 73 2e 61 72 67 76 |n.\code{|sys.argv|
|00000090| 7d 2e 0d 49 74 20 75 73 | 65 73 20 74 68 65 20 73 |}..It us|es the s|
|000000a0| 61 6d 65 20 63 6f 6e 76 | 65 6e 74 69 6f 6e 73 20 |ame conv|entions |
|000000b0| 61 73 20 74 68 65 20 5c | 55 4e 49 58 7b 7d 0d 5c |as the \|UNIX{}.\|
|000000c0| 63 6f 64 65 7b 67 65 74 | 6f 70 74 28 29 7d 0d 66 |code{get|opt()}.f|
|000000d0| 75 6e 63 74 69 6f 6e 20 | 28 69 6e 63 6c 75 64 69 |unction |(includi|
|000000e0| 6e 67 20 74 68 65 20 73 | 70 65 63 69 61 6c 20 6d |ng the s|pecial m|
|000000f0| 65 61 6e 69 6e 67 73 20 | 6f 66 20 61 72 67 75 6d |eanings |of argum|
|00000100| 65 6e 74 73 20 6f 66 20 | 74 68 65 20 66 6f 72 6d |ents of |the form|
|00000110| 0d 5c 73 61 6d 70 7b 2d | 7d 20 61 6e 64 20 5c 73 |.\samp{-|} and \s|
|00000120| 61 6d 70 7b 2d 2d 7d 29 | 2e 0d 49 74 20 64 65 66 |amp{--})|..It def|
|00000130| 69 6e 65 73 20 74 68 65 | 20 66 75 6e 63 74 69 6f |ines the| functio|
|00000140| 6e 0d 5c 63 6f 64 65 7b | 67 65 74 6f 70 74 2e 67 |n.\code{|getopt.g|
|00000150| 65 74 6f 70 74 28 61 72 | 67 73 2c 20 6f 70 74 69 |etopt(ar|gs, opti|
|00000160| 6f 6e 73 29 7d 0d 61 6e | 64 20 74 68 65 20 65 78 |ons)}.an|d the ex|
|00000170| 63 65 70 74 69 6f 6e 0d | 5c 63 6f 64 65 7b 67 65 |ception.|\code{ge|
|00000180| 74 6f 70 74 2e 65 72 72 | 6f 72 7d 2e 0d 0d 54 68 |topt.err|or}...Th|
|00000190| 65 20 66 69 72 73 74 20 | 61 72 67 75 6d 65 6e 74 |e first |argument|
|000001a0| 20 74 6f 0d 5c 63 6f 64 | 65 7b 67 65 74 6f 70 74 | to.\cod|e{getopt|
|000001b0| 28 29 7d 0d 69 73 20 74 | 68 65 20 61 72 67 75 6d |()}.is t|he argum|
|000001c0| 65 6e 74 20 6c 69 73 74 | 20 70 61 73 73 65 64 20 |ent list| passed |
|000001d0| 74 6f 20 74 68 65 20 73 | 63 72 69 70 74 20 77 69 |to the s|cript wi|
|000001e0| 74 68 20 69 74 73 20 66 | 69 72 73 74 20 65 6c 65 |th its f|irst ele|
|000001f0| 6d 65 6e 74 0d 63 68 6f | 70 70 65 64 20 6f 66 66 |ment.cho|pped off|
|00000200| 20 28 69 2e 65 2e 2c 0d | 5c 63 6f 64 65 7b 73 79 | (i.e.,.|\code{sy|
|00000210| 73 2e 61 72 67 76 5b 31 | 3a 5d 7d 29 2e 0d 54 68 |s.argv[1|:]})..Th|
|00000220| 65 20 73 65 63 6f 6e 64 | 20 61 72 67 75 6d 65 6e |e second| argumen|
|00000230| 74 20 69 73 20 74 68 65 | 20 73 74 72 69 6e 67 20 |t is the| string |
|00000240| 6f 66 20 6f 70 74 69 6f | 6e 20 6c 65 74 74 65 72 |of optio|n letter|
|00000250| 73 20 74 68 61 74 20 74 | 68 65 0d 73 63 72 69 70 |s that t|he.scrip|
|00000260| 74 20 77 61 6e 74 73 20 | 74 6f 20 72 65 63 6f 67 |t wants |to recog|
|00000270| 6e 69 7a 65 2c 20 77 69 | 74 68 20 6f 70 74 69 6f |nize, wi|th optio|
|00000280| 6e 73 20 74 68 61 74 20 | 72 65 71 75 69 72 65 20 |ns that |require |
|00000290| 61 6e 20 61 72 67 75 6d | 65 6e 74 0d 66 6f 6c 6c |an argum|ent.foll|
|000002a0| 6f 77 65 64 20 62 79 20 | 61 20 63 6f 6c 6f 6e 20 |owed by |a colon |
|000002b0| 28 69 2e 65 2e 2c 20 74 | 68 65 20 73 61 6d 65 20 |(i.e., t|he same |
|000002c0| 66 6f 72 6d 61 74 20 74 | 68 61 74 20 5c 55 4e 49 |format t|hat \UNI|
|000002d0| 58 7b 7d 0d 5c 63 6f 64 | 65 7b 67 65 74 6f 70 74 |X{}.\cod|e{getopt|
|000002e0| 28 29 7d 0d 75 73 65 73 | 29 2e 0d 54 68 65 20 72 |()}.uses|)..The r|
|000002f0| 65 74 75 72 6e 20 76 61 | 6c 75 65 20 63 6f 6e 73 |eturn va|lue cons|
|00000300| 69 73 74 73 20 6f 66 20 | 74 77 6f 20 65 6c 65 6d |ists of |two elem|
|00000310| 65 6e 74 73 3a 20 74 68 | 65 20 66 69 72 73 74 20 |ents: th|e first |
|00000320| 69 73 20 61 20 6c 69 73 | 74 20 6f 66 0d 6f 70 74 |is a lis|t of.opt|
|00000330| 69 6f 6e 2d 61 6e 64 2d | 76 61 6c 75 65 20 70 61 |ion-and-|value pa|
|00000340| 69 72 73 3b 20 74 68 65 | 20 73 65 63 6f 6e 64 20 |irs; the| second |
|00000350| 69 73 20 74 68 65 20 6c | 69 73 74 20 6f 66 20 70 |is the l|ist of p|
|00000360| 72 6f 67 72 61 6d 20 61 | 72 67 75 6d 65 6e 74 73 |rogram a|rguments|
|00000370| 0d 6c 65 66 74 20 61 66 | 74 65 72 20 74 68 65 20 |.left af|ter the |
|00000380| 6f 70 74 69 6f 6e 20 6c | 69 73 74 20 77 61 73 20 |option l|ist was |
|00000390| 73 74 72 69 70 70 65 64 | 20 28 74 68 69 73 20 69 |stripped| (this i|
|000003a0| 73 20 61 20 74 72 61 69 | 6c 69 6e 67 20 73 6c 69 |s a trai|ling sli|
|000003b0| 63 65 20 6f 66 20 74 68 | 65 0d 66 69 72 73 74 20 |ce of th|e.first |
|000003c0| 61 72 67 75 6d 65 6e 74 | 29 2e 0d 45 61 63 68 20 |argument|)..Each |
|000003d0| 6f 70 74 69 6f 6e 2d 61 | 6e 64 2d 76 61 6c 75 65 |option-a|nd-value|
|000003e0| 20 70 61 69 72 20 72 65 | 74 75 72 6e 65 64 20 68 | pair re|turned h|
|000003f0| 61 73 20 74 68 65 20 6f | 70 74 69 6f 6e 20 61 73 |as the o|ption as|
|00000400| 20 69 74 73 20 66 69 72 | 73 74 20 65 6c 65 6d 65 | its fir|st eleme|
|00000410| 6e 74 2c 0d 70 72 65 66 | 69 78 65 64 20 77 69 74 |nt,.pref|ixed wit|
|00000420| 68 20 61 20 68 79 70 68 | 65 6e 20 28 65 2e 67 2e |h a hyph|en (e.g.|
|00000430| 2c 0d 5c 63 6f 64 65 7b | 27 2d 78 27 7d 29 2c 0d |,.\code{|'-x'}),.|
|00000440| 61 6e 64 20 74 68 65 20 | 6f 70 74 69 6f 6e 20 61 |and the |option a|
|00000450| 72 67 75 6d 65 6e 74 20 | 61 73 20 69 74 73 20 73 |rgument |as its s|
|00000460| 65 63 6f 6e 64 20 65 6c | 65 6d 65 6e 74 2c 20 6f |econd el|ement, o|
|00000470| 72 20 61 6e 20 65 6d 70 | 74 79 20 73 74 72 69 6e |r an emp|ty strin|
|00000480| 67 20 69 66 20 74 68 65 | 0d 6f 70 74 69 6f 6e 20 |g if the|.option |
|00000490| 68 61 73 20 6e 6f 20 61 | 72 67 75 6d 65 6e 74 2e |has no a|rgument.|
|000004a0| 0d 54 68 65 20 6f 70 74 | 69 6f 6e 73 20 6f 63 63 |.The opt|ions occ|
|000004b0| 75 72 20 69 6e 20 74 68 | 65 20 6c 69 73 74 20 69 |ur in th|e list i|
|000004c0| 6e 20 74 68 65 20 73 61 | 6d 65 20 6f 72 64 65 72 |n the sa|me order|
|000004d0| 20 69 6e 20 77 68 69 63 | 68 20 74 68 65 79 20 77 | in whic|h they w|
|000004e0| 65 72 65 0d 66 6f 75 6e | 64 2c 20 74 68 75 73 20 |ere.foun|d, thus |
|000004f0| 61 6c 6c 6f 77 69 6e 67 | 20 6d 75 6c 74 69 70 6c |allowing| multipl|
|00000500| 65 20 6f 63 63 75 72 72 | 65 6e 63 65 73 2e 0d 45 |e occurr|ences..E|
|00000510| 78 61 6d 70 6c 65 3a 0d | 0d 5c 62 63 6f 64 65 5c |xample:.|.\bcode\|
|00000520| 62 65 67 69 6e 7b 76 65 | 72 62 61 74 69 6d 7d 0d |begin{ve|rbatim}.|
|00000530| 3e 3e 3e 20 69 6d 70 6f | 72 74 20 67 65 74 6f 70 |>>> impo|rt getop|
|00000540| 74 2c 20 73 74 72 69 6e | 67 0d 3e 3e 3e 20 61 72 |t, strin|g.>>> ar|
|00000550| 67 73 20 3d 20 73 74 72 | 69 6e 67 2e 73 70 6c 69 |gs = str|ing.spli|
|00000560| 74 28 27 2d 61 20 2d 62 | 20 2d 63 66 6f 6f 20 2d |t('-a -b| -cfoo -|
|00000570| 64 20 62 61 72 20 61 31 | 20 61 32 27 29 0d 3e 3e |d bar a1| a2').>>|
|00000580| 3e 20 61 72 67 73 0d 5b | 27 2d 61 27 2c 20 27 2d |> args.[|'-a', '-|
|00000590| 62 27 2c 20 27 2d 63 66 | 6f 6f 27 2c 20 27 2d 64 |b', '-cf|oo', '-d|
|000005a0| 27 2c 20 27 62 61 72 27 | 2c 20 27 61 31 27 2c 20 |', 'bar'|, 'a1', |
|000005b0| 27 61 32 27 5d 0d 3e 3e | 3e 20 6f 70 74 6c 69 73 |'a2'].>>|> optlis|
|000005c0| 74 2c 20 61 72 67 73 20 | 3d 20 67 65 74 6f 70 74 |t, args |= getopt|
|000005d0| 2e 67 65 74 6f 70 74 28 | 61 72 67 73 2c 20 27 61 |.getopt(|args, 'a|
|000005e0| 62 63 3a 64 3a 27 29 0d | 3e 3e 3e 20 6f 70 74 6c |bc:d:').|>>> optl|
|000005f0| 69 73 74 0d 5b 28 27 2d | 61 27 2c 20 27 27 29 2c |ist.[('-|a', ''),|
|00000600| 20 28 27 2d 62 27 2c 20 | 27 27 29 2c 20 28 27 2d | ('-b', |''), ('-|
|00000610| 63 27 2c 20 27 66 6f 6f | 27 29 2c 20 28 27 2d 64 |c', 'foo|'), ('-d|
|00000620| 27 2c 20 27 62 61 72 27 | 29 5d 0d 3e 3e 3e 20 61 |', 'bar'|)].>>> a|
|00000630| 72 67 73 0d 5b 27 61 31 | 27 2c 20 27 61 32 27 5d |rgs.['a1|', 'a2']|
|00000640| 0d 3e 3e 3e 20 0d 5c 65 | 6e 64 7b 76 65 72 62 61 |.>>> .\e|nd{verba|
|00000650| 74 69 6d 7d 5c 65 63 6f | 64 65 0d 0d 54 68 65 20 |tim}\eco|de..The |
|00000660| 65 78 63 65 70 74 69 6f | 6e 0d 5c 63 6f 64 65 7b |exceptio|n.\code{|
|00000670| 67 65 74 6f 70 74 2e 65 | 72 72 6f 72 20 3d 20 27 |getopt.e|rror = '|
|00000680| 67 65 74 6f 70 74 20 65 | 72 72 6f 72 27 7d 0d 69 |getopt e|rror'}.i|
|00000690| 73 20 72 61 69 73 65 64 | 20 77 68 65 6e 20 61 6e |s raised| when an|
|000006a0| 20 75 6e 72 65 63 6f 67 | 6e 69 7a 65 64 20 6f 70 | unrecog|nized op|
|000006b0| 74 69 6f 6e 20 69 73 20 | 66 6f 75 6e 64 20 69 6e |tion is |found in|
|000006c0| 20 74 68 65 20 61 72 67 | 75 6d 65 6e 74 20 6c 69 | the arg|ument li|
|000006d0| 73 74 20 6f 72 0d 77 68 | 65 6e 20 61 6e 20 6f 70 |st or.wh|en an op|
|000006e0| 74 69 6f 6e 20 72 65 71 | 75 69 72 69 6e 67 20 61 |tion req|uiring a|
|000006f0| 6e 20 61 72 67 75 6d 65 | 6e 74 20 69 73 20 67 69 |n argume|nt is gi|
|00000700| 76 65 6e 20 6e 6f 6e 65 | 2e 0d 54 68 65 20 61 72 |ven none|..The ar|
|00000710| 67 75 6d 65 6e 74 20 74 | 6f 20 74 68 65 20 65 78 |gument t|o the ex|
|00000720| 63 65 70 74 69 6f 6e 20 | 69 73 20 61 20 73 74 72 |ception |is a str|
|00000730| 69 6e 67 20 69 6e 64 69 | 63 61 74 69 6e 67 20 74 |ing indi|cating t|
|00000740| 68 65 20 63 61 75 73 65 | 20 6f 66 20 74 68 65 0d |he cause| of the.|
|00000750| 65 72 72 6f 72 2e 0d | |error.. | |
+--------+-------------------------+-------------------------+--------+--------+