options
Manual Reference Pages - OPTIONS (1)
options - a general description of the AIM tools options handler.
CONTENTS
Syntax
Description
Bugs
Copyright
SYNTAX
command line ::= <program name> [<options>] [<filename>]option ::= <flag option> | <valued option>
flag option ::= -<name> | [-]<name>=on|off
valued option ::= -<name>[=]<value> | [-]<name>=<value>
DESCRIPTION
A program may take one or more files as input, and several options to setinternal parameters. The function of the options handler is to parse thecommand line and interpret options according to the defined syntax,to assign internal default values to the internal parameters represented byeach option, and then to override these using any corresponding optionsfound on the command line.
Command line syntax
Programs which do not read input from files have a command line:
<program name> [<options>]Programs which expect to read input from one or more files have command line syntax:
<program name> [<options>] [<filenames>]The command line parser assumes that each space-separated token on the commandline is either an option or a filename.The strategy is to parse the commandline until either it is empty or a token with invalid option syntax is found.All tokens remaining on the command line after parsing are assumedto be input filenames.Programs which read from one or more files expect the filenames to be given asthe final arguments on the command line.If the command line is empty after parsing the options, but a file is expected,then input is read from the standard input, (eg. via re-direction or a pipe).The filename - is also interpreted as the standard input.
Typographical errors which cause options to have bad syntax are therefore treated aspotential filenames.The program reports the error as if it were a file not found, by printing a messageon the stderr:
<program name>: cant open <option>and quits with an exit status of 1.In the (unlikely) event that a file with a name matching the error is foundthen this file will be opened for input to the program.
Option syntax
The general syntax for flag options (which do not take a <value> part) is:
-<name> | [-]<name>=on|offThe general syntax for valued options is:
-<name>[=]<value> | [-]<name>=<value>The usual Unix notation is observed, (characters within square bracketsare optional and the bar sign denotes exclusive OR) so that flag optionsmay take any of the forms:
-<name> -<name>=on <name>=on -<name>=off <name>=offSimilarly, valued options may take any of the forms:
-<name><value> -<name>=<value> <name>=<value>Option syntax is designed to be compatible between a Unix optionsstyle and a more declarative style. This is facilitated by allowing the <name>part of each option to be given in abbreviated form provided thisis unambiguous with other options for the program.
The general option syntax in Unix and the declarative style respectively is:
-<name><value> <name>=<value>An example of the same option in both styles respectively would be:
-t10 time=10In many cases the option names are designed to be unambiguous from the firstletter to allow for complete compatibility, but in some cases the need fordeclarative option names was felt to override the need for absolute compatibility.If necessary any option name can easily be changed by changing the namegiven in the first field of the static Options structure defined near thetop of each program source code, and then re-compile the program.The change affects only the user interface via the options handler and hasno other side effects.
An exact match for option <name> is unambiguous even if the <name> matchesthe head of another option <name>.
If insufficient of the <name> part is given to disambiguate it from otheroptions, then the program prints a message on the stderr:
<program name>: ambiguous option [<option>]and quits with an exit status of 1.
For example, if a program takes options with names frames and frameshiftthen the following are synonymous for setting the frameshift to 20:
frameshift=20 framesh=20 -framesh20but the following would be ambiguous:
-f20 -frame20However an exact match is allowed to be unambiguous, so that the following wouldset the frames option to 3:
frames=3 -frames3
Option values
The <value> part may take the form of a number with optional units.Time variables may be given in s (seconds) ms (milliseconds) and p (sample points).The default with no units is interpreted as sample points.For example:
10 10 samples 10p 10 samples 10s 10 seconds 10ms 10 millisecondsValues given with time units are converted to a number of samples internallyusing the given samplerate option.
Frequency variables take Hz (Hertz) and kHz (KiloHertz).The default with no units is interpreted as Hertz..For example:
20000 20000 Hertz 20000Hz 20000 Hertz 20kHz 20000 HertzA <value> may be given as a hyphen-separated range of values with the general syntax:
<value> = a[-b]where a and b are both values or the strings "min" or "max".For example, the frame option is used to select a range of frames forprocessing:
frame=a Select just the ath frame. frame=a-b Select frames from the ath to bth inclusive. frame=min Select the first frame. frame=max Select the last frame. frame=a-max Select frames from the ath to the last inclusive. frame=min-b Select frames from the first to the bth inclusive.Values which specify a time or frequency range take units as appropriate.For example:
range=10ms-40ms
On-line help
All tools take an option called help which causes the program to printhelp information on the stdout.The following are usually synonymous calls for help:
<program name> -h <program name> -help <program name> help=onIn some cases the abbreviation -h will be ambiguous with another optionname, however -help and help=on are always unambiguous.The help printed on the stdout includes a summary of the programsapplication, its command-line syntax or usage, and a list of the programoptions with their default values and a brief comment about the use of each option.The option syntax for each option is printed in place ofoption comment line when the call for help takes the form:
<program name> help=syntaxHelp with particular named options can be called with:
<program name> help=<name>where the <name> part can be abbreviated provided it is unambiguous.Certain options are silent in the sense that they are not printed in theoptions list by the standard call for help because they are considered tobe rarely used. However they can be included in the options list by the call:
<program name> help=allSilent options are assigned on the command line in the same way as ordinaryoptions.
BUGS
A filename which matches a typographical error in option name would beopened for input, leading to unexpected results.
COPYRIGHT
Copyright (c) Applied Psychology Unit, Medical Research Council, 1995
Permission to use, copy, modify, and distribute this software without feeis hereby granted for research purposes, provided that this copyrightnotice appears in all copies and in all supporting documentation, and thatthe software is not redistributed for any fee (except for a nominalshipping charge). Anyone wanting to incorporate all or part of thissoftware in a commercial product must obtain a license from the MedicalResearch Council.
The MRC makes no representations about the suitability of thissoftware for any purpose. It is provided "as is" without express orimplied warranty.
THE MRC DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDINGALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALLTHE A.P.U. BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGESOR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THISSOFTWARE.
| SunOS 5.6 | OPTIONS (1) | 1 September 1993 |