xiteStdOpt

[ XITE Reference Manual | XITE home ]

Name

xiteStdOpt - process standard XITE options

Syntax

xiteStdOpt <min_opts> <max_opts> <program-name> [<option>...] <usage>

Description

Process any standard XITE options, given by option.

Standard XITE options are those treated by InitMessage. usage is the program usage text.

xiteStdOpt is a shell script, only to be used by programs which themselves are shell scripts.

The calling shell should use eval on the output from xiteStdOpt.

min_opts is the minimum number of words required in the command calling program-name (not counting program-name itself).

max_opts is the maximum number of words allowed in the command calling program-name (not counting program-name itself). A value of -1 means no limit.

Restrictions

The shell (/bin/sh) command set must accept the argument --.

Output

An sh command which should be evaluated by the calling shell. Help/usage/man output is printed to stderr.

Return value

0
No action because of standard options. Remaining options prepended with the text "set args " is printed to stdout.

1
One of the options -help, -usage, -man or -whatis found. Result is printed to stderr, "exit 1" is printed to stdout.

2
Illegal use of xiteStdOpt. Error message is printed to stderr, "exit 1" is printed to stdout.

See also

InitMessage(3)

Example

From inside an XITE script:
 eval `xiteStdOpt 2 4 $0 $@ "$usage"`
where usage is a variable containing the usage text.

Author

Svein Bøe

Id

$Id: xiteStdOpt.sh,v 1.5 1997/06/05 11:28:46 svein Exp $