Mercurial > hg > aim92
comparison man/man1/options.1 @ 0:5242703e91d3 tip
Initial checkin for AIM92 aimR8.2 (last updated May 1997).
author | tomwalters |
---|---|
date | Fri, 20 May 2011 15:19:45 +0100 |
parents | |
children |
comparison
equal
deleted
inserted
replaced
-1:000000000000 | 0:5242703e91d3 |
---|---|
1 .TH OPTIONS 1 "1 September 1993" | |
2 | |
3 .SH NAME | |
4 options \- a general description of the AIM tools options handler. | |
5 | |
6 .SH SYNTAX | |
7 | |
8 .nf | |
9 command line ::= <program name> [<options>] [<filename>] | |
10 | |
11 option ::= <flag option> | <valued option> | |
12 | |
13 flag option ::= -<name> | [-]<name>=on|off | |
14 | |
15 valued option ::= -<name>[=]<value> | [-]<name>=<value> | |
16 .fi | |
17 | |
18 .SH DESCRIPTION | |
19 | |
20 A program may take one or more files as input, and several options to set | |
21 internal parameters. The function of the options handler is to parse the | |
22 command line and interpret options according to the defined syntax, | |
23 to assign internal default values to the internal parameters represented by | |
24 each option, and then to override these using any corresponding options | |
25 found on the command line. | |
26 | |
27 | |
28 .SH "Command line syntax" | |
29 | |
30 Programs which do not read input from files have a command line: | |
31 | |
32 .nf | |
33 <program name> [<options>] | |
34 .fi | |
35 | |
36 Programs which expect to read input from one or more files have command line syntax: | |
37 | |
38 .nf | |
39 <program name> [<options>] [<filenames>] | |
40 .fi | |
41 | |
42 The command line parser assumes that each space-separated token on the command | |
43 line is either an option or a filename. | |
44 The strategy is to parse the command | |
45 line until either it is empty or a token with invalid option syntax is found. | |
46 All tokens remaining on the command line after parsing are assumed | |
47 to be input filenames. | |
48 Programs which read from one or more files expect the filenames to be given as | |
49 the final arguments on the command line. | |
50 If the command line is empty after parsing the options, but a file is expected, | |
51 then input is read from the standard input, (eg. via re-direction or a pipe). | |
52 The filename `-' is also interpreted as the standard input. | |
53 | |
54 Typographical errors which cause options to have bad syntax are therefore treated as | |
55 potential filenames. | |
56 The program reports the error as if it were a file not found, by printing a message | |
57 on the stderr: | |
58 | |
59 .nf | |
60 <program name>: can't open <option> | |
61 .fi | |
62 | |
63 and quits with an exit status of 1. | |
64 In the (unlikely) event that a file with a name matching the error is found | |
65 then this file will be opened for input to the program. | |
66 | |
67 .SH "Option syntax" | |
68 | |
69 The general syntax for flag options (which do not take a <value> part) is: | |
70 | |
71 .nf | |
72 -<name> | [-]<name>=on|off | |
73 .fi | |
74 | |
75 The general syntax for valued options is: | |
76 | |
77 .nf | |
78 -<name>[=]<value> | [-]<name>=<value> | |
79 .fi | |
80 | |
81 The usual Unix notation is observed, (characters within square brackets | |
82 are optional and the bar sign denotes exclusive OR) so that flag options | |
83 may take any of the forms: | |
84 | |
85 .nf | |
86 -<name> | |
87 -<name>=on | |
88 <name>=on | |
89 -<name>=off | |
90 <name>=off | |
91 .fi | |
92 | |
93 Similarly, valued options may take any of the forms: | |
94 | |
95 .nf | |
96 -<name><value> | |
97 -<name>=<value> | |
98 <name>=<value> | |
99 .fi | |
100 | |
101 Option syntax is designed to be compatible between a Unix options | |
102 style and a more declarative style. This is facilitated by allowing the <name> | |
103 part of each option to be given in abbreviated form provided this | |
104 is unambiguous with other options for the program. | |
105 | |
106 The general option syntax in Unix and the declarative style respectively is: | |
107 | |
108 .nf | |
109 -<name><value> | |
110 <name>=<value> | |
111 .fi | |
112 | |
113 An example of the same option in both styles respectively would be: | |
114 | |
115 .nf | |
116 -t10 | |
117 time=10 | |
118 .fi | |
119 | |
120 | |
121 In many cases the option names are designed to be unambiguous from the first | |
122 letter to allow for complete compatibility, but in some cases the need for | |
123 declarative option names was felt to override the need for absolute compatibility. | |
124 If necessary any option name can easily be changed by changing the name | |
125 given in the first field of the static Options structure defined near the | |
126 top of each program source code, and then re-compile the program. | |
127 The change affects only the user interface via the options handler and has | |
128 no other side effects. | |
129 | |
130 An exact match for option <name> is unambiguous even if the <name> matches | |
131 the head of another option <name>. | |
132 | |
133 If insufficient of the <name> part is given to disambiguate it from other | |
134 options, then the program prints a message on the stderr: | |
135 | |
136 .nf | |
137 <program name>: ambiguous option [<option>] | |
138 .fi | |
139 | |
140 and quits with an exit status of 1. | |
141 | |
142 For example, if a program takes options with names `frames' and `frameshift' | |
143 then the following are synonymous for setting the frameshift to 20: | |
144 | |
145 .nf | |
146 frameshift=20 | |
147 framesh=20 | |
148 -framesh20 | |
149 .fi | |
150 | |
151 but the following would be ambiguous: | |
152 | |
153 .nf | |
154 -f20 | |
155 -frame20 | |
156 .fi | |
157 | |
158 However an exact match is allowed to be unambiguous, so that the following would | |
159 set the frames option to 3: | |
160 | |
161 .nf | |
162 frames=3 | |
163 -frames3 | |
164 .fi | |
165 | |
166 .SH "Option values" | |
167 | |
168 The <value> part may take the form of a number with optional units. | |
169 Time variables may be given in s (seconds) ms (milliseconds) and p (sample points). | |
170 The default with no units is interpreted as sample points. | |
171 For example: | |
172 | |
173 .nf | |
174 10 10 samples | |
175 10p 10 samples | |
176 10s 10 seconds | |
177 10ms 10 milliseconds | |
178 .fi | |
179 | |
180 Values given with time units are converted to a number of samples internally | |
181 using the given `samplerate' option. | |
182 | |
183 Frequency variables take Hz (Hertz) and kHz (KiloHertz). | |
184 The default with no units is interpreted as Hertz.. | |
185 For example: | |
186 | |
187 .nf | |
188 20000 20000 Hertz | |
189 20000Hz 20000 Hertz | |
190 20kHz 20000 Hertz | |
191 .fi | |
192 | |
193 A <value> may be given as a hyphen-separated range of values with the general syntax: | |
194 | |
195 .nf | |
196 <value> = a[-b] | |
197 .fi | |
198 | |
199 where `a' and `b' are both values or the strings "min" or "max". | |
200 For example, the `frame' option is used to select a range of frames for | |
201 processing: | |
202 | |
203 .nf | |
204 frame=a Select just the a'th frame. | |
205 frame=a-b Select frames from the a'th to b'th inclusive. | |
206 frame=min Select the first frame. | |
207 frame=max Select the last frame. | |
208 frame=a-max Select frames from the a'th to the last inclusive. | |
209 frame=min-b Select frames from the first to the b'th inclusive. | |
210 .fi | |
211 | |
212 Values which specify a time or frequency range take units as appropriate. | |
213 For example: | |
214 | |
215 .nf | |
216 range=10ms-40ms | |
217 .fi | |
218 | |
219 | |
220 .SH "On-line help" | |
221 | |
222 All tools take an option called `help' which causes the program to print | |
223 help information on the stdout. | |
224 The following are usually synonymous calls for help: | |
225 | |
226 .nf | |
227 <program name> -h | |
228 <program name> -help | |
229 <program name> help=on | |
230 .fi | |
231 | |
232 In some cases the abbreviation `-h' will be ambiguous with another option | |
233 name, however `-help' and `help=on' are always unambiguous. | |
234 The help printed on the stdout includes a summary of the program's | |
235 application, it's command-line syntax or usage, and a list of the program | |
236 options with their default values and a brief comment about the use of each option. | |
237 The option syntax for each option is printed in place of | |
238 option comment line when the call for help takes the form: | |
239 | |
240 .nf | |
241 <program name> help=syntax | |
242 .fi | |
243 | |
244 Help with particular named options can be called with: | |
245 | |
246 .nf | |
247 <program name> help=<name> | |
248 .fi | |
249 | |
250 where the <name> part can be abbreviated provided it is unambiguous. | |
251 Certain options are `silent' in the sense that they are not printed in the | |
252 options list by the standard call for help because they are considered to | |
253 be rarely used. However they can be included in the options list by the call: | |
254 | |
255 .nf | |
256 <program name> help=all | |
257 .fi | |
258 | |
259 Silent options are assigned on the command line in the same way as ordinary | |
260 options. | |
261 | |
262 .SH BUGS | |
263 | |
264 A filename which matches a typographical error in option name would be | |
265 opened for input, leading to unexpected results. | |
266 .SH COPYRIGHT | |
267 .LP | |
268 Copyright (c) Applied Psychology Unit, Medical Research Council, 1995 | |
269 .LP | |
270 Permission to use, copy, modify, and distribute this software without fee | |
271 is hereby granted for research purposes, provided that this copyright | |
272 notice appears in all copies and in all supporting documentation, and that | |
273 the software is not redistributed for any fee (except for a nominal | |
274 shipping charge). Anyone wanting to incorporate all or part of this | |
275 software in a commercial product must obtain a license from the Medical | |
276 Research Council. | |
277 .LP | |
278 The MRC makes no representations about the suitability of this | |
279 software for any purpose. It is provided "as is" without express or | |
280 implied warranty. | |
281 .LP | |
282 THE MRC DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING | |
283 ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL | |
284 THE A.P.U. BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES | |
285 OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, | |
286 WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, | |
287 ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS | |
288 SOFTWARE. | |
289 |