Method
GLibOptionContextset_strict_posix
since: 2.44
Declaration [src]
void
g_option_context_set_strict_posix (
GOptionContext* context,
gboolean strict_posix
)
Description [src]
Sets strict POSIX mode.
By default, this mode is disabled.
In strict POSIX mode, the first non-argument parameter encountered (eg: filename) terminates argument processing. Remaining arguments are treated as non-options and are not attempted to be parsed.
If strict POSIX mode is disabled then parsing is done in the GNU way where option arguments can be freely mixed with non-options.
As an example, consider “ls foo -l”. With GNU style parsing, this will list “foo” in long mode. In strict POSIX style, this will list the files named “foo” and “-l”.
It may be useful to force strict POSIX mode when creating “verb style” command line tools. For example, the “gsettings” command line tool supports the global option “—schemadir” as well as many subcommands (“get”, “set”, etc.) which each have their own set of arguments. Using strict POSIX mode will allow parsing the global options up to the verb name while leaving the remaining options to be parsed by the relevant subcommand (which can be determined by examining the verb name, which should be present in argv[1] after parsing).
Available since: 2.44