Next: getopts interface, Previous: getopts usage, Up: getopts [Contents][Index]
A set of predefined options is recognised by the library and not handed to the user defined functions.
Selects a directory for temporary files. The default value is the one in
the environment variable TMPDIR
, or /tmp/$USER if that
variable is not set. The value is stored in the variable
mbfl_option_TMPDIR
.
Signals to the library that the non–option arguments and the option values are encoded in hexadecimal strings. Encoding is useful to avoid quoting problems when invoking a script from another one.
If this option is used: the values are decoded by
mbfl_getopts_parse()
before storing them in the ARGV
array and before being stored in the option’s specific global variables.
Turns on verbose messages. If this option is used: The function
mbfl_option_verbose()
returns true. Printing
messages to the console.
Turns off verbose messages. If this option is used: The function
mbfl_option_verbose()
returns false.
If used: The --verbose option is added to the command line of
external programs that support it. The function
mbfl_option_verbose_program()
returns true or false depending on
the state of this option.
Prints the command line of executed external programs.
Turns on debugging messages. Automatically turns on verbose messages and program showing. Printing messages to the console.
Turns on test execution. Testing a script and external programs.
Signals to the script that it has to use the null character to separate
values, instead of the common newline. The global variable
mbfl_option_NULL
is set to yes
.
Signals to the script that it does not have to query the user
before doing dangerous operations, like overwriting files. The global
variable mbfl_option_INTERACTIVE
is set to no
.
Signals to the script that it does have to query the user
before doing dangerous operations, like overwriting files. The global
variable mbfl_option_INTERACTIVE
is set to yes
.
Validates the existence of all the programs needed by the script; then exits. The exit code is zero if all the programs were found, one otherwise.
Prints a list of numerical exit codes and their associated names, as declared in the script. Declaring exit codes.
Prints the numerical exit code associated to NAME
.
Prints the list of names associated to the numerical exit CODE
.
Prints to the standard output of the script the contents of the global
variable mbfl_message_VERSION
, then exits with code zero. The
variable makes use of the service variables. Required user defined variables.
Prints to the standard output of the script the contents of the global
variable script_VERSION
, then exits with code zero. Required user defined variables.
Prints to the standard output of the script the contents of one of the
global variables mbfl_message_LICENSE_*
, then exits with code
zero. The variable makes use of the service variables. Required user defined variables.
Prints to the standard output of the script: the contents of the global
variable script_USAGE
; a newline; the string options:
; a
newline; an automatically generated string describing the options
declared with mbfl_declare_option()
; a string describing the
MBFL default options; the contents of the global variable
script_EXAMPLES
. Then exits with code zero. Required user defined variables.
Prints to the standard output of the script: the contents of the global
variable script_USAGE
; a newline; the string options:
; a
newline; an automatically generated string describing the options
declared with mbfl_declare_option()
. Then exits with code zero.
The difference with --help is that predefined options and usage examples are not displayed.
Print all the long options with
mbfl_getopts_print_long_switches()
, then exit the script with code
zero.
The following functions may be used to set, unset and query the state of the predefined options.
Query/set/unset the encoded arguments option.
mbfl_option_encoded_args()
returns true if the option
--encoded-args was used on the command line.
Query/set/unset the verbose messages option.
mbfl_option_verbose()
returns true if the option
--verbose was used on the command line after all the
occurrences of --silent; it returns false if the option
--silent was used on the command line after all the occurrences
of --verbose.
Query/set/unset verbose execution for external programs.
This option, of course, is supported only for programs that are known by
MBFL (like rm
): if a program is executed with
mbfl_program_exec()
, it is responsibility of the caller to use
the option.
Print the command line of executed external program. This does not disable program execution, it just prints the command line before executing it.
Query/set/unset the test execution option.
Query/set/unset the debug messages option.
Query/set/unset the null list separator option.
Query/set/unset the interactive execution option.
mbfl_option_interactive()
returns true if the option
--interactive was used on the command line after all the
occurrences of --force; it returns false if the option
--force was used on the command line after all the occurrences
of --interactive.
The following are special option functions.
Save the current state of the test option then invokes
mbfl_unset_option_test()
.
Restore the state of the test option to the one before the invocation to
mbfl_option_test_save()
.
Next: getopts interface, Previous: getopts usage, Up: getopts [Contents][Index]