Commit Graph

9 Commits

Author SHA1 Message Date
kre 30bfb81c65 Avoid long option names that differ only in character case.
Change Xtrace (the name) to xlock instead.  Aside from the different
name, there is no change to functionality.
2018-11-23 20:40:06 +00:00
kre ae40879b6d Remove the -X option from SMALL shells (as used on boot floppies,
some other install media, mini-roots, etc.)   It is unlikely that
such a shell will be used for much script debugging (and the old -x
still exists of course) and it adds a little bloat, so, zap...

The ancient unused (unrelated) xioctl() function is gone as well
(from all shells).
2017-11-21 03:42:39 +00:00
kre ffc64c6374 Implement the -X option - an apparent variant of -x which sends all trace
output to the stderr which existed when the -X option was (last) enabled.
It also enables tracing by enabling -x (and when reset, +X, also resets
the 'x' flag (+x)).  Note that it is still -x/+x which actually
enables/disables the trace output.   Hence "apparent variant" - what -X
actually does (aside from setting -x) is just to lock the trace output,
rather than having it follow wherever stderr is later redirected.
2017-11-19 03:23:01 +00:00
kre ed2c7aaa15 Implement the "pipefail" option (same semantics as in other shells)
to cause (when set, which it is not by default) the exit status of a
pipe to be 0 iff all commands in the pipe exited with status 0, and
otherwise, the status of the rightmost command to exit with a non-0
status.

In the doc, while describing this, also reword some of the text about
commands in general, how they are structured, and when they are executed.
2017-07-24 14:17:11 +00:00
kre 1fca9bbf62 Implement PS1, PS2 and PS4 expansions (variable expansions, arithmetic
expansions, and if enabled by the promptcmds option, command substitutions.)
2017-06-30 23:02:56 +00:00
kre cf8ba701af Changed the long name for the -L option from lineno_fn_relative
to local_lineno as the latter seemed to be marginally more popular,
and perhaps more importantly, is the same length as the peviously
existing quietprofile option, which means the man page indentation
for the list of options can return to (about) what it was before...
(That is, less indented, which means more data/line, which means less
lines of man page - a good thing!)
2017-06-17 07:50:35 +00:00
kre 727a69dc1d A better LINENO implementation. This version deletes (well, #if 0's out)
the LINENO hack, and uses the LINENO var for both ${LINENO} and $((LINENO)).
(Code to invert the LINENO hack when required, like when de-compiling the
execution tree to provide the "jobs" command strings, is still included,
that can be deleted when the LINENO hack is completely removed - look for
refs to VSLINENO throughout the code.  The var funclinno in parser.c can
also be removed, it is used only for the LINENO hack.)

This version produces accurate results: $((LINENO)) was made as accurate
as the LINENO hack made ${LINENO} which is very good.  That's why the
LINENO hack is not yet completely removed, so it can be easily re-enabled.
If you can tell the difference when it is in use, or not in use, then
something has broken (or I managed to miss a case somewhere.)

The way that LINENO works is documented in its own (new) section in the
man page, so nothing more about that, or the new options, etc, here.

This version introduces the possibility of having a "reference" function
associated with a variable, which gets called whenever the value of the
variable is required (that's what implements LINENO).  There is just
one function pointer however, so any particular variable gets at most
one of the set function (as used for PATH, etc) or the reference function.
The VFUNCREF bit in the var flags indicates which func the variable in
question uses (if any - the func ptr, as before, can be NULL).

I would not call the results of this perfect yet, but it is close.
2017-06-07 05:08:32 +00:00
kre d6a4153fe2 Redo mkoptions.sh .. much better this way, now fully automated
option sorting (no longer required option.list to be manually
sorted by long option name) and properly handles conditional
options.   Cleaner output format as well.

This allows option.list to be reordered to group related options
together ... also added more comments to it.
2017-05-28 14:14:22 +00:00
kre f359a311bc Arrange for set -o and $- output to be sorted, rather than more
or less random (and becoming worse as more options are added.)
Since the data is known at compile time, sort at compile time,
rather than at run time.
2017-05-28 00:38:01 +00:00