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