diff options
author | Robin Haberkorn <robin.haberkorn@googlemail.com> | 2016-11-16 16:06:12 +0100 |
---|---|---|
committer | Robin Haberkorn <robin.haberkorn@googlemail.com> | 2016-11-18 07:05:52 +0100 |
commit | cb5e08b40d7444817c7eb6c1e4e8bf5208c2823c (patch) | |
tree | b0eb53e43e896415acf7362551a71828b6f9eaa7 /doc/grosciteco.tes | |
parent | e7867fb0d9979c550e6e3d7597ece73b680c4af6 (diff) | |
download | sciteco-cb5e08b40d7444817c7eb6c1e4e8bf5208c2823c.tar.gz |
improved command line option handling
* it turns out that option-like arguments could not be reliably passed to
SciTECO scripts for two reasons:
a) "--" arguments are not removed from argv by GOption if it detects
and following option-like argument.
"--" would thus be passed as a script argument which will disable
option parsing in scripts that interpret "--".
b) A script run via the Hash-Bang line "#!...sciteco -m" would
require an explicit "--" to turn of GOption parsing.
However it is __impossible__ to insert after the script file name
on UNIX.
* Therefore, SciTECO now removes leading "--" arguments left over by GOption.
* If possible (Glib >= 2.44), option parsing is performed in strict POSIX
mode which inhibits parsing after the first non-option argument.
This reduces the number of cases where an explicit "--" is required.
* --mung no longer takes an argument. Instead, the first non-option argument
is expected to be the script file name.
This looks weird at first but is more consistent with how other interpeters
work. Once we revise argument passing to scripts, the script name can also
be passed to the script which is more consistent with it being the first
non-option argument.
Also, with strict POSIX parsing, this fixed Hash-Bang lines since
the script file name constructed by the kernel will automatically switch
off option parsing, passing all option-like script arguments uninterpreted
to the script.
* Since we're supporting Glib < 2.44, the Hash-Bang lines are still broken
for certain builds.
Therefore, a wrapper script is installed to libexecdir (it never has to be
executed by users and Hash-Bang lines need absolute paths anyway) which
transparently inserts "--" into the SciTECO command line and should be used
as the interpreter in portable SciTECO scripts.
The wrapper script is generated and points to the exact SciTECO binary
installed. This is important when doing parallel installs of Curses and Gtk
binaries since each one will get its own working wrapper script.
The wrapper-script workaround can be removed once we depend on Glib >= 2.44
(some day...).
* The default /usr/bin/env Hash-Bang lines are no longer used in the
scripts since they are broken anyway (UNIX incl. Linux cannot pass
multiple arguments to the interpreter!).
Scripts that get installed will get a fixed-up Hash-Bang line referring
to the installed SciTECO binary anyway.
* Interface::main() has been renamed to Interface::init() and is optional
now. The Interface::main() method was introduced because of the misconception
that interfaces will find their options in the argv array and have to do
their own parsing.
This is wrong, since their option group already cares about parsing.
Therefore, gtk_init() does not have to called explicitly, too.
Diffstat (limited to 'doc/grosciteco.tes')
-rwxr-xr-x | doc/grosciteco.tes | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/doc/grosciteco.tes b/doc/grosciteco.tes index d84c6ab..7be01fb 100755 --- a/doc/grosciteco.tes +++ b/doc/grosciteco.tes @@ -1,4 +1,4 @@ -#!/usr/bin/env sciteco -m +#!/usr/local/bin/sciteco -m !* grosciteco.tes <output-woman> <output-tec> <input> *! !* Process command-line options *! |