Source-Changes archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

CVS commit: src/bin/sh



Module Name:    src
Committed By:   kre
Date:           Thu May 18 13:53:18 UTC 2017

Modified Files:
        src/bin/sh: options.c options.h sh.1

Log Message:
Command line, and "set" command options processing cleanup.

sh +c "command string"  no longer works (it must be -c)
sh +o   and   sh -o     no longer work (if you could call what they did
                        before working.)  nb: this is without an option name.
-ooo Opt1 Opt2 Opt3     no longer works (set & cmd line), this should be
                        -o Opt1 -o Opt2 -o Opt3   (same with +ooo of course).
-oOpt                   is now supported - option value (name of option in
                        this case) immediately following -o (or +o).
                        (as with other commands that use std opt parsing)
                        Both set comamnd and command line.

In addition, the output from "set +o" has shrunk dramatically, by borrowing
a trick from ksh93 (but implemented in a more traditional syntax).
"set +o" is required to produce a command (or commands) which when executed
later, will return all options to the state they were in when "set +o"
was done.  Previously that was done by generating a set command, with
every option listed (set -o opt +o other-opt ...) to set them all back
to their current setings.   Now we have a new "magic option" ("default")
which sets all options to their default values, so now set +o output
need only be "set -o default -o changed-opt ..." (only the options that
have been changed from their default values need be explicitly mentioned.)
The definition of "default value" for this is the value the shell set the
option to, after startup, after processing the command line (with any
flags, or -o option type settings), but before beginning processing any
user input (incuding startup files, like $ENV etc).

Anyone can execute "set -o default" of course, but only from a "set"
command (it makes no sense at all as a -o option to sh).   This also
causes "set +o" to be slightly more useful as a general command, as
ignoring the "set -o default" part of the result, it lists just those
options that have been altered after sh startup.  There is no +o default.
There isn't an option called "default" at all...

This causes some of the commented out text from sh.1 to become uncommented.


To generate a diff of this commit:
cvs rdiff -u -r1.47 -r1.48 src/bin/sh/options.c
cvs rdiff -u -r1.25 -r1.26 src/bin/sh/options.h
cvs rdiff -u -r1.141 -r1.142 src/bin/sh/sh.1

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.




Home | Main Index | Thread Index | Old Index