History log of /netbsd-current/bin/sh/options.h
Revision (<<< Hide revision tags) (Show revision tags >>>) Date Author Comments
# 1.27 28-May-2017 kre

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.


Revision tags: prg-localcount2-base3
# 1.26 18-May-2017 kre

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.


Revision tags: prg-localcount2-base2 prg-localcount2-base1 prg-localcount2-base pgoyette-localcount-20170426 bouyer-socketcan-base1 pgoyette-localcount-20170320 bouyer-socketcan-base pgoyette-localcount-20170107 pgoyette-localcount-20161104 localcount-20160914 pgoyette-localcount-20160806 pgoyette-localcount-20160726 pgoyette-localcount-base
# 1.25 31-Mar-2016 christos

branches: 1.25.6;
Implement the NETBSD_SHELL readonly unexportable unimportable
variable (with its current value set at 20160401) as discussed on
current-users and tech-userlevel. This also includes the necessary
support to implement it properly (particularly the unexportable
part) and adds options to the export command to support unexportable
variables. Also implement the "posix" option (no single letter
equivalent) which gets its default value from whether or not
POSIXLY_CORRECT is set in the environment when the shell starts
(but can be changed just like any other option using -o and +o on
the command line, or the set builtin command.) While there, fix
all uses of options so it is possible to have options that have a
short (one char) name, and no long name, just as it has been possible
to have options with a long name and no short name, though there
are currently none (with no long name). For now, the only use of
the posix option is to control whether ${ENV} is read at startup
by a non-interactive shell, so changing it with set is not usful
- that might change in the future. (from kre@)


# 1.24 23-Feb-2016 christos

name the long option after the ksh name (trackall) to indicate the intended
posix behavior not the bash one.


# 1.23 23-Feb-2016 christos

update that -n is implemented and add -h using the long name that bash
uses. (from kre, long name from me)


# 1.22 26-May-2015 christos

Drop privileges when executed set{u,g}id unless -p is specified like other
shells do to avoid system() and popen() abuse.


# 1.21 02-Jan-2015 christos

Define an undocumented -F option to only use fork instead of vfork for
debugging purposes.


Revision tags: netbsd-7-1-RELEASE netbsd-7-1-RC2 netbsd-7-nhusb-base-20170116 netbsd-7-1-RC1 netbsd-7-0-2-RELEASE netbsd-7-nhusb-base netbsd-7-0-1-RELEASE netbsd-7-0-RELEASE netbsd-7-0-RC3 netbsd-7-0-RC2 netbsd-7-0-RC1 netbsd-6-0-6-RELEASE netbsd-6-1-5-RELEASE netbsd-7-base yamt-pagecache-base9 yamt-pagecache-tag8 netbsd-6-1-4-RELEASE netbsd-6-0-5-RELEASE tls-earlyentropy-base riastradh-xf86-video-intel-2-7-1-pre-2-21-15 riastradh-drm2-base3 netbsd-6-1-3-RELEASE netbsd-6-0-4-RELEASE netbsd-6-1-2-RELEASE netbsd-6-0-3-RELEASE netbsd-6-1-1-RELEASE riastradh-drm2-base2 riastradh-drm2-base1 riastradh-drm2-base netbsd-6-0-2-RELEASE netbsd-6-1-RELEASE netbsd-6-1-RC4 netbsd-6-1-RC3 agc-symver-base netbsd-6-1-RC2 netbsd-6-1-RC1 yamt-pagecache-base8 netbsd-6-0-1-RELEASE yamt-pagecache-base7 matt-nb6-plus-nbase yamt-pagecache-base6 netbsd-6-0-RELEASE netbsd-6-0-RC2 tls-maxphys-base matt-nb6-plus-base netbsd-6-0-RC1 yamt-pagecache-base5 yamt-pagecache-base4 netbsd-6-base yamt-pagecache-base3 yamt-pagecache-base2 yamt-pagecache-base
# 1.20 18-Jun-2011 christos

PR/45069: Henning Petersen: Use prototypes from builtins.h .


Revision tags: netbsd-5-2-3-RELEASE netbsd-5-1-5-RELEASE netbsd-5-2-2-RELEASE netbsd-5-1-4-RELEASE netbsd-5-2-1-RELEASE netbsd-5-1-3-RELEASE netbsd-5-2-RELEASE netbsd-5-2-RC1 netbsd-5-1-2-RELEASE netbsd-5-1-1-RELEASE cherry-xenmp-base bouyer-quota2-nbase bouyer-quota2-base matt-mips64-premerge-20101231 matt-nb5-mips64-premerge-20101231 matt-nb5-pq3-base netbsd-5-1-RELEASE netbsd-5-1-RC4 matt-nb5-mips64-k15 netbsd-5-1-RC3 netbsd-5-1-RC2 netbsd-5-1-RC1 netbsd-5-0-2-RELEASE matt-nb5-mips64-premerge-20091211 matt-premerge-20091211 matt-nb5-mips64-u2-k2-k4-k7-k8-k9 matt-nb4-mips64-k7-u2a-k9b matt-nb5-mips64-u1-k1-k5 netbsd-5-0-1-RELEASE jym-xensuspend-nbase netbsd-5-0-RELEASE netbsd-5-0-RC4 netbsd-5-0-RC3 netbsd-5-0-RC2 jym-xensuspend-base netbsd-5-0-RC1 netbsd-5-base matt-mips64-base2 mjf-devfs2-base netbsd-4-0-1-RELEASE wrstuden-revivesa-base-3 wrstuden-revivesa-base-2 wrstuden-fixsa-newbase wrstuden-revivesa-base-1 yamt-pf42-base4 yamt-pf42-base3 hpcarm-cleanup-nbase yamt-pf42-baseX yamt-pf42-base2 wrstuden-revivesa-base yamt-pf42-base keiichi-mipv6-base matt-armv6-nbase matt-armv6-prevmlocking wrstuden-fixsa-base-1 netbsd-4-0-RELEASE cube-autoconf-base netbsd-4-0-RC5 netbsd-4-0-RC4 netbsd-4-0-RC3 netbsd-4-0-RC2 netbsd-4-0-RC1 matt-armv6-base matt-mips64-base hpcarm-cleanup-base wrstuden-fixsa-base abandoned-netbsd-4-base netbsd-4-base
# 1.19 13-Dec-2005 dsl

branches: 1.19.40;
TOG require that 'set +o' output the options in a form suitable for
restoring them - make it so.


# 1.18 07-May-2005 dsl

If 'set -o tabcomplete' it set, then bind <tab> to the libedit filename
completion function.
Note that the libedit code will probably want fine-tuning!
While editing the man page, add a note that non-whitespace IFS chars are
terminators and can generate null arguments.


Revision tags: netbsd-3-1-1-RELEASE netbsd-3-0-3-RELEASE netbsd-3-1-RELEASE netbsd-3-0-2-RELEASE netbsd-3-1-RC4 netbsd-3-1-RC3 netbsd-3-1-RC2 netbsd-3-1-RC1 netbsd-3-0-1-RELEASE netbsd-3-0-RELEASE netbsd-3-0-RC6 netbsd-3-0-RC5 netbsd-3-0-RC4 netbsd-3-0-RC3 netbsd-3-0-RC2 netbsd-3-0-RC1 netbsd-2-0-3-RELEASE netbsd-2-1-RELEASE netbsd-2-1-RC6 netbsd-2-1-RC5 netbsd-2-1-RC4 netbsd-2-1-RC3 netbsd-2-1-RC2 netbsd-2-1-RC1 netbsd-2-0-2-RELEASE netbsd-3-base netbsd-2-0-1-RELEASE netbsd-2-base netbsd-2-0-RELEASE netbsd-2-0-RC5 netbsd-2-0-RC4 netbsd-2-0-RC3 netbsd-2-0-RC2 netbsd-2-0-RC1 netbsd-2-0-base
# 1.17 07-Aug-2003 agc

Move UCB-licensed code from 4-clause to 3-clause licence.

Patches provided by Joel Baker in PR 22249, verified by myself.


# 1.16 22-Jan-2003 dsl

Support command -p, -v and -V as posix
Stop temporary PATH assigments messing up hash table
Fix sh -c -e "echo $0 $*" -a x (as posix)
(agreed by christos)


Revision tags: fvdl_fs64_base
# 1.15 24-Nov-2002 christos

Fixes from David Laight:
- ansification
- format of output of jobs command (etc)
- job identiers %+, %- etc
- $? and $(...)
- correct quoting of output of set, export -p and readonly -p
- differentiation between nornal and 'posix special' builtins
- correct behaviour (posix) for errors on builtins and special builtins
- builtin printf and kill
- set -o debug (if compiled with DEBUG)
- cd src obj (as ksh - too useful to do without)
- unset -e name, remove non-readonly variable from export list.
(so I could unset -e PS1 before running the test shell...)


Revision tags: netbsd-1-6-PATCH002-RELEASE netbsd-1-6-PATCH002 netbsd-1-6-PATCH002-RC4 netbsd-1-6-PATCH002-RC3 netbsd-1-6-PATCH002-RC2 netbsd-1-6-PATCH002-RC1 netbsd-1-6-PATCH001 netbsd-1-6-PATCH001-RELEASE netbsd-1-6-PATCH001-RC3 netbsd-1-6-PATCH001-RC2 netbsd-1-6-PATCH001-RC1 netbsd-1-6-RELEASE netbsd-1-6-RC3 netbsd-1-6-RC2 netbsd-1-6-RC1 netbsd-1-6-base ELRICshvfork-base
# 1.14 04-Feb-2001 christos

remove redundant declarations and nexted externs.


Revision tags: netbsd-1-5-PATCH003 netbsd-1-5-PATCH002 netbsd-1-5-PATCH001 netbsd-1-5-RELEASE netbsd-1-5-BETA2 netbsd-1-5-BETA netbsd-1-5-ALPHA2 netbsd-1-5-base minoura-xpg4dl-base wrstuden-devbsize-19991221 wrstuden-devbsize-base comdex-fall-1999-base
# 1.13 09-Jul-1999 christos

compile with WARNS = 2


Revision tags: netbsd-1-4-PATCH003 netbsd-1-4-PATCH002 netbsd-1-4-PATCH001 netbsd-1-4-RELEASE netbsd-1-4-base
# 1.12 04-Feb-1999 cjs

Add -q option, which when used with -v and/or -x, turns off the tracing
during the execution of /etc/profile, .profile and $ENV.


Revision tags: netbsd-1-3-PATCH003 netbsd-1-3-PATCH003-CANDIDATE2 netbsd-1-3-PATCH003-CANDIDATE1 netbsd-1-3-PATCH003-CANDIDATE0 netbsd-1-3-PATCH002 netbsd-1-3-PATCH001 netbsd-1-3-RELEASE netbsd-1-3-BETA netbsd-1-3-base
# 1.11 06-Nov-1996 christos

Fix miscellaneous getopts problems:
- the 3 argument version of getopts would not reset properly
- OPTARG did not get cleared after a non argument option was found
- OPTIND was not set properly after a non argument option.


# 1.10 16-Oct-1996 christos

PR/2808: Remove trailing whitespace (from FreeBSD)


# 1.9 25-Jun-1996 christos

- Add getoptsreset to be used as a callback function when OPTIND is set.
This is used to implement the POSIX behavior when OPTIND=1
- Call setvarsafe instead of setvar. If one ran
"getopts optstr badvariable"
where badvariable contained an illegal variable name, there was no way
to recover, since setvar() would longjmp on the error.


Revision tags: netbsd-1-2-RELEASE netbsd-1-2-BETA netbsd-1-2-base netbsd-1-1-PATCH001 netbsd-1-1-RELEASE netbsd-1-1-base
# 1.8 11-May-1995 christos

branches: 1.8.6;
Merge in my changes from vangogh, and fix the x=`false`; echo $? == 0
bug.


# 1.7 21-Mar-1995 cgd

convert to new RCS id conventions.


Revision tags: netbsd-1-0-PATCH06 netbsd-1-0-PATCH05 netbsd-1-0-PATCH04 netbsd-1-0-PATCH03 netbsd-1-0-PATCH02 netbsd-1-0-PATCH1 netbsd-1-0-PATCH0 netbsd-1-0-RELEASE netbsd-1-0-base
# 1.6 11-Jun-1994 mycroft

Add RCS ids.


# 1.5 11-May-1994 jtc

sync with 4.4lite


# 1.4 01-Aug-1993 mycroft

Add RCS identifiers.


Revision tags: netbsd-0-9-RELEASE netbsd-0-9-BETA netbsd-0-9-ALPHA2 netbsd-0-9-ALPHA netbsd-0-9-base netbsd-0-8 netbsd-alpha-1
# 1.3 23-Mar-1993 cgd

changed "Id" to "Header" for rcsids


# 1.2 22-Mar-1993 cgd

added rcs ids to all files


# 1.1 21-Mar-1993 cgd

branches: 1.1.1;
Initial revision


Revision tags: prg-localcount2-base3
# 1.26 18-May-2017 kre

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.


Revision tags: prg-localcount2-base2 prg-localcount2-base1 prg-localcount2-base pgoyette-localcount-20170426 bouyer-socketcan-base1 pgoyette-localcount-20170320 bouyer-socketcan-base pgoyette-localcount-20170107 pgoyette-localcount-20161104 localcount-20160914 pgoyette-localcount-20160806 pgoyette-localcount-20160726 pgoyette-localcount-base
# 1.25 31-Mar-2016 christos

branches: 1.25.6;
Implement the NETBSD_SHELL readonly unexportable unimportable
variable (with its current value set at 20160401) as discussed on
current-users and tech-userlevel. This also includes the necessary
support to implement it properly (particularly the unexportable
part) and adds options to the export command to support unexportable
variables. Also implement the "posix" option (no single letter
equivalent) which gets its default value from whether or not
POSIXLY_CORRECT is set in the environment when the shell starts
(but can be changed just like any other option using -o and +o on
the command line, or the set builtin command.) While there, fix
all uses of options so it is possible to have options that have a
short (one char) name, and no long name, just as it has been possible
to have options with a long name and no short name, though there
are currently none (with no long name). For now, the only use of
the posix option is to control whether ${ENV} is read at startup
by a non-interactive shell, so changing it with set is not usful
- that might change in the future. (from kre@)


# 1.24 23-Feb-2016 christos

name the long option after the ksh name (trackall) to indicate the intended
posix behavior not the bash one.


# 1.23 23-Feb-2016 christos

update that -n is implemented and add -h using the long name that bash
uses. (from kre, long name from me)


# 1.22 26-May-2015 christos

Drop privileges when executed set{u,g}id unless -p is specified like other
shells do to avoid system() and popen() abuse.


# 1.21 02-Jan-2015 christos

Define an undocumented -F option to only use fork instead of vfork for
debugging purposes.


Revision tags: netbsd-7-1-RELEASE netbsd-7-1-RC2 netbsd-7-nhusb-base-20170116 netbsd-7-1-RC1 netbsd-7-0-2-RELEASE netbsd-7-nhusb-base netbsd-7-0-1-RELEASE netbsd-7-0-RELEASE netbsd-7-0-RC3 netbsd-7-0-RC2 netbsd-7-0-RC1 netbsd-6-0-6-RELEASE netbsd-6-1-5-RELEASE netbsd-7-base yamt-pagecache-base9 yamt-pagecache-tag8 netbsd-6-1-4-RELEASE netbsd-6-0-5-RELEASE tls-earlyentropy-base riastradh-xf86-video-intel-2-7-1-pre-2-21-15 riastradh-drm2-base3 netbsd-6-1-3-RELEASE netbsd-6-0-4-RELEASE netbsd-6-1-2-RELEASE netbsd-6-0-3-RELEASE netbsd-6-1-1-RELEASE riastradh-drm2-base2 riastradh-drm2-base1 riastradh-drm2-base netbsd-6-0-2-RELEASE netbsd-6-1-RELEASE netbsd-6-1-RC4 netbsd-6-1-RC3 agc-symver-base netbsd-6-1-RC2 netbsd-6-1-RC1 yamt-pagecache-base8 netbsd-6-0-1-RELEASE yamt-pagecache-base7 matt-nb6-plus-nbase yamt-pagecache-base6 netbsd-6-0-RELEASE netbsd-6-0-RC2 tls-maxphys-base matt-nb6-plus-base netbsd-6-0-RC1 yamt-pagecache-base5 yamt-pagecache-base4 netbsd-6-base yamt-pagecache-base3 yamt-pagecache-base2 yamt-pagecache-base
# 1.20 18-Jun-2011 christos

PR/45069: Henning Petersen: Use prototypes from builtins.h .


Revision tags: netbsd-5-2-3-RELEASE netbsd-5-1-5-RELEASE netbsd-5-2-2-RELEASE netbsd-5-1-4-RELEASE netbsd-5-2-1-RELEASE netbsd-5-1-3-RELEASE netbsd-5-2-RELEASE netbsd-5-2-RC1 netbsd-5-1-2-RELEASE netbsd-5-1-1-RELEASE cherry-xenmp-base bouyer-quota2-nbase bouyer-quota2-base matt-mips64-premerge-20101231 matt-nb5-mips64-premerge-20101231 matt-nb5-pq3-base netbsd-5-1-RELEASE netbsd-5-1-RC4 matt-nb5-mips64-k15 netbsd-5-1-RC3 netbsd-5-1-RC2 netbsd-5-1-RC1 netbsd-5-0-2-RELEASE matt-nb5-mips64-premerge-20091211 matt-premerge-20091211 matt-nb5-mips64-u2-k2-k4-k7-k8-k9 matt-nb4-mips64-k7-u2a-k9b matt-nb5-mips64-u1-k1-k5 netbsd-5-0-1-RELEASE jym-xensuspend-nbase netbsd-5-0-RELEASE netbsd-5-0-RC4 netbsd-5-0-RC3 netbsd-5-0-RC2 jym-xensuspend-base netbsd-5-0-RC1 netbsd-5-base matt-mips64-base2 mjf-devfs2-base netbsd-4-0-1-RELEASE wrstuden-revivesa-base-3 wrstuden-revivesa-base-2 wrstuden-fixsa-newbase wrstuden-revivesa-base-1 yamt-pf42-base4 yamt-pf42-base3 hpcarm-cleanup-nbase yamt-pf42-baseX yamt-pf42-base2 wrstuden-revivesa-base yamt-pf42-base keiichi-mipv6-base matt-armv6-nbase matt-armv6-prevmlocking wrstuden-fixsa-base-1 netbsd-4-0-RELEASE cube-autoconf-base netbsd-4-0-RC5 netbsd-4-0-RC4 netbsd-4-0-RC3 netbsd-4-0-RC2 netbsd-4-0-RC1 matt-armv6-base matt-mips64-base hpcarm-cleanup-base wrstuden-fixsa-base abandoned-netbsd-4-base netbsd-4-base
# 1.19 13-Dec-2005 dsl

branches: 1.19.40;
TOG require that 'set +o' output the options in a form suitable for
restoring them - make it so.


# 1.18 07-May-2005 dsl

If 'set -o tabcomplete' it set, then bind <tab> to the libedit filename
completion function.
Note that the libedit code will probably want fine-tuning!
While editing the man page, add a note that non-whitespace IFS chars are
terminators and can generate null arguments.


Revision tags: netbsd-3-1-1-RELEASE netbsd-3-0-3-RELEASE netbsd-3-1-RELEASE netbsd-3-0-2-RELEASE netbsd-3-1-RC4 netbsd-3-1-RC3 netbsd-3-1-RC2 netbsd-3-1-RC1 netbsd-3-0-1-RELEASE netbsd-3-0-RELEASE netbsd-3-0-RC6 netbsd-3-0-RC5 netbsd-3-0-RC4 netbsd-3-0-RC3 netbsd-3-0-RC2 netbsd-3-0-RC1 netbsd-2-0-3-RELEASE netbsd-2-1-RELEASE netbsd-2-1-RC6 netbsd-2-1-RC5 netbsd-2-1-RC4 netbsd-2-1-RC3 netbsd-2-1-RC2 netbsd-2-1-RC1 netbsd-2-0-2-RELEASE netbsd-3-base netbsd-2-0-1-RELEASE netbsd-2-base netbsd-2-0-RELEASE netbsd-2-0-RC5 netbsd-2-0-RC4 netbsd-2-0-RC3 netbsd-2-0-RC2 netbsd-2-0-RC1 netbsd-2-0-base
# 1.17 07-Aug-2003 agc

Move UCB-licensed code from 4-clause to 3-clause licence.

Patches provided by Joel Baker in PR 22249, verified by myself.


# 1.16 22-Jan-2003 dsl

Support command -p, -v and -V as posix
Stop temporary PATH assigments messing up hash table
Fix sh -c -e "echo $0 $*" -a x (as posix)
(agreed by christos)


Revision tags: fvdl_fs64_base
# 1.15 24-Nov-2002 christos

Fixes from David Laight:
- ansification
- format of output of jobs command (etc)
- job identiers %+, %- etc
- $? and $(...)
- correct quoting of output of set, export -p and readonly -p
- differentiation between nornal and 'posix special' builtins
- correct behaviour (posix) for errors on builtins and special builtins
- builtin printf and kill
- set -o debug (if compiled with DEBUG)
- cd src obj (as ksh - too useful to do without)
- unset -e name, remove non-readonly variable from export list.
(so I could unset -e PS1 before running the test shell...)


Revision tags: netbsd-1-6-PATCH002-RELEASE netbsd-1-6-PATCH002 netbsd-1-6-PATCH002-RC4 netbsd-1-6-PATCH002-RC3 netbsd-1-6-PATCH002-RC2 netbsd-1-6-PATCH002-RC1 netbsd-1-6-PATCH001 netbsd-1-6-PATCH001-RELEASE netbsd-1-6-PATCH001-RC3 netbsd-1-6-PATCH001-RC2 netbsd-1-6-PATCH001-RC1 netbsd-1-6-RELEASE netbsd-1-6-RC3 netbsd-1-6-RC2 netbsd-1-6-RC1 netbsd-1-6-base ELRICshvfork-base
# 1.14 04-Feb-2001 christos

remove redundant declarations and nexted externs.


Revision tags: netbsd-1-5-PATCH003 netbsd-1-5-PATCH002 netbsd-1-5-PATCH001 netbsd-1-5-RELEASE netbsd-1-5-BETA2 netbsd-1-5-BETA netbsd-1-5-ALPHA2 netbsd-1-5-base minoura-xpg4dl-base wrstuden-devbsize-19991221 wrstuden-devbsize-base comdex-fall-1999-base
# 1.13 09-Jul-1999 christos

compile with WARNS = 2


Revision tags: netbsd-1-4-PATCH003 netbsd-1-4-PATCH002 netbsd-1-4-PATCH001 netbsd-1-4-RELEASE netbsd-1-4-base
# 1.12 04-Feb-1999 cjs

Add -q option, which when used with -v and/or -x, turns off the tracing
during the execution of /etc/profile, .profile and $ENV.


Revision tags: netbsd-1-3-PATCH003 netbsd-1-3-PATCH003-CANDIDATE2 netbsd-1-3-PATCH003-CANDIDATE1 netbsd-1-3-PATCH003-CANDIDATE0 netbsd-1-3-PATCH002 netbsd-1-3-PATCH001 netbsd-1-3-RELEASE netbsd-1-3-BETA netbsd-1-3-base
# 1.11 06-Nov-1996 christos

Fix miscellaneous getopts problems:
- the 3 argument version of getopts would not reset properly
- OPTARG did not get cleared after a non argument option was found
- OPTIND was not set properly after a non argument option.


# 1.10 16-Oct-1996 christos

PR/2808: Remove trailing whitespace (from FreeBSD)


# 1.9 25-Jun-1996 christos

- Add getoptsreset to be used as a callback function when OPTIND is set.
This is used to implement the POSIX behavior when OPTIND=1
- Call setvarsafe instead of setvar. If one ran
"getopts optstr badvariable"
where badvariable contained an illegal variable name, there was no way
to recover, since setvar() would longjmp on the error.


Revision tags: netbsd-1-2-RELEASE netbsd-1-2-BETA netbsd-1-2-base netbsd-1-1-PATCH001 netbsd-1-1-RELEASE netbsd-1-1-base
# 1.8 11-May-1995 christos

branches: 1.8.6;
Merge in my changes from vangogh, and fix the x=`false`; echo $? == 0
bug.


# 1.7 21-Mar-1995 cgd

convert to new RCS id conventions.


Revision tags: netbsd-1-0-PATCH06 netbsd-1-0-PATCH05 netbsd-1-0-PATCH04 netbsd-1-0-PATCH03 netbsd-1-0-PATCH02 netbsd-1-0-PATCH1 netbsd-1-0-PATCH0 netbsd-1-0-RELEASE netbsd-1-0-base
# 1.6 11-Jun-1994 mycroft

Add RCS ids.


# 1.5 11-May-1994 jtc

sync with 4.4lite


# 1.4 01-Aug-1993 mycroft

Add RCS identifiers.


Revision tags: netbsd-0-9-RELEASE netbsd-0-9-BETA netbsd-0-9-ALPHA2 netbsd-0-9-ALPHA netbsd-0-9-base netbsd-0-8 netbsd-alpha-1
# 1.3 23-Mar-1993 cgd

changed "Id" to "Header" for rcsids


# 1.2 22-Mar-1993 cgd

added rcs ids to all files


# 1.1 21-Mar-1993 cgd

branches: 1.1.1;
Initial revision


Revision tags: pgoyette-localcount-20161104 localcount-20160914 pgoyette-localcount-20160806 pgoyette-localcount-20160726 pgoyette-localcount-base
# 1.25 31-Mar-2016 christos

Implement the NETBSD_SHELL readonly unexportable unimportable
variable (with its current value set at 20160401) as discussed on
current-users and tech-userlevel. This also includes the necessary
support to implement it properly (particularly the unexportable
part) and adds options to the export command to support unexportable
variables. Also implement the "posix" option (no single letter
equivalent) which gets its default value from whether or not
POSIXLY_CORRECT is set in the environment when the shell starts
(but can be changed just like any other option using -o and +o on
the command line, or the set builtin command.) While there, fix
all uses of options so it is possible to have options that have a
short (one char) name, and no long name, just as it has been possible
to have options with a long name and no short name, though there
are currently none (with no long name). For now, the only use of
the posix option is to control whether ${ENV} is read at startup
by a non-interactive shell, so changing it with set is not usful
- that might change in the future. (from kre@)


# 1.24 23-Feb-2016 christos

name the long option after the ksh name (trackall) to indicate the intended
posix behavior not the bash one.


# 1.23 23-Feb-2016 christos

update that -n is implemented and add -h using the long name that bash
uses. (from kre, long name from me)


# 1.22 26-May-2015 christos

Drop privileges when executed set{u,g}id unless -p is specified like other
shells do to avoid system() and popen() abuse.


# 1.21 02-Jan-2015 christos

Define an undocumented -F option to only use fork instead of vfork for
debugging purposes.


Revision tags: netbsd-7-0-2-RELEASE netbsd-7-nhusb-base netbsd-7-0-1-RELEASE netbsd-7-0-RELEASE netbsd-7-0-RC3 netbsd-7-0-RC2 netbsd-7-0-RC1 netbsd-6-0-6-RELEASE netbsd-6-1-5-RELEASE netbsd-7-base yamt-pagecache-base9 yamt-pagecache-tag8 netbsd-6-1-4-RELEASE netbsd-6-0-5-RELEASE tls-earlyentropy-base riastradh-xf86-video-intel-2-7-1-pre-2-21-15 riastradh-drm2-base3 netbsd-6-1-3-RELEASE netbsd-6-0-4-RELEASE netbsd-6-1-2-RELEASE netbsd-6-0-3-RELEASE netbsd-6-1-1-RELEASE riastradh-drm2-base2 riastradh-drm2-base1 riastradh-drm2-base netbsd-6-0-2-RELEASE netbsd-6-1-RELEASE netbsd-6-1-RC4 netbsd-6-1-RC3 agc-symver-base netbsd-6-1-RC2 netbsd-6-1-RC1 yamt-pagecache-base8 netbsd-6-0-1-RELEASE yamt-pagecache-base7 matt-nb6-plus-nbase yamt-pagecache-base6 netbsd-6-0-RELEASE netbsd-6-0-RC2 tls-maxphys-base matt-nb6-plus-base netbsd-6-0-RC1 yamt-pagecache-base5 yamt-pagecache-base4 netbsd-6-base yamt-pagecache-base3 yamt-pagecache-base2 yamt-pagecache-base
# 1.20 18-Jun-2011 christos

PR/45069: Henning Petersen: Use prototypes from builtins.h .


Revision tags: netbsd-5-2-3-RELEASE netbsd-5-1-5-RELEASE netbsd-5-2-2-RELEASE netbsd-5-1-4-RELEASE netbsd-5-2-1-RELEASE netbsd-5-1-3-RELEASE netbsd-5-2-RELEASE netbsd-5-2-RC1 netbsd-5-1-2-RELEASE netbsd-5-1-1-RELEASE cherry-xenmp-base bouyer-quota2-nbase bouyer-quota2-base matt-mips64-premerge-20101231 matt-nb5-mips64-premerge-20101231 matt-nb5-pq3-base netbsd-5-1-RELEASE netbsd-5-1-RC4 matt-nb5-mips64-k15 netbsd-5-1-RC3 netbsd-5-1-RC2 netbsd-5-1-RC1 netbsd-5-0-2-RELEASE matt-nb5-mips64-premerge-20091211 matt-premerge-20091211 matt-nb5-mips64-u2-k2-k4-k7-k8-k9 matt-nb4-mips64-k7-u2a-k9b matt-nb5-mips64-u1-k1-k5 netbsd-5-0-1-RELEASE jym-xensuspend-nbase netbsd-5-0-RELEASE netbsd-5-0-RC4 netbsd-5-0-RC3 netbsd-5-0-RC2 jym-xensuspend-base netbsd-5-0-RC1 netbsd-5-base matt-mips64-base2 mjf-devfs2-base netbsd-4-0-1-RELEASE wrstuden-revivesa-base-3 wrstuden-revivesa-base-2 wrstuden-fixsa-newbase wrstuden-revivesa-base-1 yamt-pf42-base4 yamt-pf42-base3 hpcarm-cleanup-nbase yamt-pf42-baseX yamt-pf42-base2 wrstuden-revivesa-base yamt-pf42-base keiichi-mipv6-base matt-armv6-nbase matt-armv6-prevmlocking wrstuden-fixsa-base-1 netbsd-4-0-RELEASE cube-autoconf-base netbsd-4-0-RC5 netbsd-4-0-RC4 netbsd-4-0-RC3 netbsd-4-0-RC2 netbsd-4-0-RC1 matt-armv6-base matt-mips64-base hpcarm-cleanup-base wrstuden-fixsa-base abandoned-netbsd-4-base netbsd-4-base
# 1.19 13-Dec-2005 dsl

branches: 1.19.40;
TOG require that 'set +o' output the options in a form suitable for
restoring them - make it so.


# 1.18 07-May-2005 dsl

If 'set -o tabcomplete' it set, then bind <tab> to the libedit filename
completion function.
Note that the libedit code will probably want fine-tuning!
While editing the man page, add a note that non-whitespace IFS chars are
terminators and can generate null arguments.


Revision tags: netbsd-3-1-1-RELEASE netbsd-3-0-3-RELEASE netbsd-3-1-RELEASE netbsd-3-0-2-RELEASE netbsd-3-1-RC4 netbsd-3-1-RC3 netbsd-3-1-RC2 netbsd-3-1-RC1 netbsd-3-0-1-RELEASE netbsd-3-0-RELEASE netbsd-3-0-RC6 netbsd-3-0-RC5 netbsd-3-0-RC4 netbsd-3-0-RC3 netbsd-3-0-RC2 netbsd-3-0-RC1 netbsd-2-0-3-RELEASE netbsd-2-1-RELEASE netbsd-2-1-RC6 netbsd-2-1-RC5 netbsd-2-1-RC4 netbsd-2-1-RC3 netbsd-2-1-RC2 netbsd-2-1-RC1 netbsd-2-0-2-RELEASE netbsd-3-base netbsd-2-0-1-RELEASE netbsd-2-base netbsd-2-0-RELEASE netbsd-2-0-RC5 netbsd-2-0-RC4 netbsd-2-0-RC3 netbsd-2-0-RC2 netbsd-2-0-RC1 netbsd-2-0-base
# 1.17 07-Aug-2003 agc

Move UCB-licensed code from 4-clause to 3-clause licence.

Patches provided by Joel Baker in PR 22249, verified by myself.


# 1.16 22-Jan-2003 dsl

Support command -p, -v and -V as posix
Stop temporary PATH assigments messing up hash table
Fix sh -c -e "echo $0 $*" -a x (as posix)
(agreed by christos)


Revision tags: fvdl_fs64_base
# 1.15 24-Nov-2002 christos

Fixes from David Laight:
- ansification
- format of output of jobs command (etc)
- job identiers %+, %- etc
- $? and $(...)
- correct quoting of output of set, export -p and readonly -p
- differentiation between nornal and 'posix special' builtins
- correct behaviour (posix) for errors on builtins and special builtins
- builtin printf and kill
- set -o debug (if compiled with DEBUG)
- cd src obj (as ksh - too useful to do without)
- unset -e name, remove non-readonly variable from export list.
(so I could unset -e PS1 before running the test shell...)


Revision tags: netbsd-1-6-PATCH002-RELEASE netbsd-1-6-PATCH002 netbsd-1-6-PATCH002-RC4 netbsd-1-6-PATCH002-RC3 netbsd-1-6-PATCH002-RC2 netbsd-1-6-PATCH002-RC1 netbsd-1-6-PATCH001 netbsd-1-6-PATCH001-RELEASE netbsd-1-6-PATCH001-RC3 netbsd-1-6-PATCH001-RC2 netbsd-1-6-PATCH001-RC1 netbsd-1-6-RELEASE netbsd-1-6-RC3 netbsd-1-6-RC2 netbsd-1-6-RC1 netbsd-1-6-base ELRICshvfork-base
# 1.14 04-Feb-2001 christos

remove redundant declarations and nexted externs.


Revision tags: netbsd-1-5-PATCH003 netbsd-1-5-PATCH002 netbsd-1-5-PATCH001 netbsd-1-5-RELEASE netbsd-1-5-BETA2 netbsd-1-5-BETA netbsd-1-5-ALPHA2 netbsd-1-5-base minoura-xpg4dl-base wrstuden-devbsize-19991221 wrstuden-devbsize-base comdex-fall-1999-base
# 1.13 08-Jul-1999 christos

compile with WARNS = 2


Revision tags: netbsd-1-4-PATCH003 netbsd-1-4-PATCH002 netbsd-1-4-PATCH001 netbsd-1-4-RELEASE netbsd-1-4-base
# 1.12 03-Feb-1999 cjs

Add -q option, which when used with -v and/or -x, turns off the tracing
during the execution of /etc/profile, .profile and $ENV.


Revision tags: netbsd-1-3-PATCH003 netbsd-1-3-PATCH003-CANDIDATE2 netbsd-1-3-PATCH003-CANDIDATE1 netbsd-1-3-PATCH003-CANDIDATE0 netbsd-1-3-PATCH002 netbsd-1-3-PATCH001 netbsd-1-3-RELEASE netbsd-1-3-BETA netbsd-1-3-base
# 1.11 05-Nov-1996 christos

Fix miscellaneous getopts problems:
- the 3 argument version of getopts would not reset properly
- OPTARG did not get cleared after a non argument option was found
- OPTIND was not set properly after a non argument option.


# 1.10 16-Oct-1996 christos

PR/2808: Remove trailing whitespace (from FreeBSD)


# 1.9 25-Jun-1996 christos

- Add getoptsreset to be used as a callback function when OPTIND is set.
This is used to implement the POSIX behavior when OPTIND=1
- Call setvarsafe instead of setvar. If one ran
"getopts optstr badvariable"
where badvariable contained an illegal variable name, there was no way
to recover, since setvar() would longjmp on the error.


Revision tags: netbsd-1-2-RELEASE netbsd-1-2-BETA netbsd-1-2-base netbsd-1-1-PATCH001 netbsd-1-1-RELEASE netbsd-1-1-base
# 1.8 11-May-1995 christos

branches: 1.8.6;
Merge in my changes from vangogh, and fix the x=`false`; echo $? == 0
bug.


# 1.7 21-Mar-1995 cgd

convert to new RCS id conventions.


Revision tags: netbsd-1-0-PATCH06 netbsd-1-0-PATCH05 netbsd-1-0-PATCH04 netbsd-1-0-PATCH03 netbsd-1-0-PATCH02 netbsd-1-0-PATCH1 netbsd-1-0-PATCH0 netbsd-1-0-RELEASE netbsd-1-0-base
# 1.6 11-Jun-1994 mycroft

Add RCS ids.


# 1.5 11-May-1994 jtc

sync with 4.4lite


# 1.4 01-Aug-1993 mycroft

Add RCS identifiers.


Revision tags: netbsd-0-9-RELEASE netbsd-0-9-BETA netbsd-0-9-ALPHA2 netbsd-0-9-ALPHA netbsd-0-9-base netbsd-0-8 netbsd-alpha-1
# 1.3 22-Mar-1993 cgd

changed "Id" to "Header" for rcsids


# 1.2 22-Mar-1993 cgd

added rcs ids to all files


# 1.1 21-Mar-1993 cgd

branches: 1.1.1;
Initial revision


# 1.22 26-May-2015 christos

Drop privileges when executed set{u,g}id unless -p is specified like other
shells do to avoid system() and popen() abuse.


# 1.21 02-Jan-2015 christos

Define an undocumented -F option to only use fork instead of vfork for
debugging purposes.


# 1.20 18-Jun-2011 christos

PR/45069: Henning Petersen: Use prototypes from builtins.h .


# 1.19 12-Dec-2005 dsl

branches: 1.19.40;
TOG require that 'set +o' output the options in a form suitable for
restoring them - make it so.


# 1.18 07-May-2005 dsl

If 'set -o tabcomplete' it set, then bind <tab> to the libedit filename
completion function.
Note that the libedit code will probably want fine-tuning!
While editing the man page, add a note that non-whitespace IFS chars are
terminators and can generate null arguments.


# 1.17 07-Aug-2003 agc

Move UCB-licensed code from 4-clause to 3-clause licence.

Patches provided by Joel Baker in PR 22249, verified by myself.


# 1.16 22-Jan-2003 dsl

Support command -p, -v and -V as posix
Stop temporary PATH assigments messing up hash table
Fix sh -c -e "echo $0 $*" -a x (as posix)
(agreed by christos)


# 1.15 24-Nov-2002 christos

Fixes from David Laight:
- ansification
- format of output of jobs command (etc)
- job identiers %+, %- etc
- $? and $(...)
- correct quoting of output of set, export -p and readonly -p
- differentiation between nornal and 'posix special' builtins
- correct behaviour (posix) for errors on builtins and special builtins
- builtin printf and kill
- set -o debug (if compiled with DEBUG)
- cd src obj (as ksh - too useful to do without)
- unset -e name, remove non-readonly variable from export list.
(so I could unset -e PS1 before running the test shell...)


# 1.14 04-Feb-2001 christos

remove redundant declarations and nexted externs.


# 1.13 08-Jul-1999 christos

compile with WARNS = 2


# 1.12 03-Feb-1999 cjs

Add -q option, which when used with -v and/or -x, turns off the tracing
during the execution of /etc/profile, .profile and $ENV.


# 1.11 05-Nov-1996 christos

Fix miscellaneous getopts problems:
- the 3 argument version of getopts would not reset properly
- OPTARG did not get cleared after a non argument option was found
- OPTIND was not set properly after a non argument option.


# 1.10 16-Oct-1996 christos

PR/2808: Remove trailing whitespace (from FreeBSD)


# 1.9 24-Jun-1996 christos

- Add getoptsreset to be used as a callback function when OPTIND is set.
This is used to implement the POSIX behavior when OPTIND=1
- Call setvarsafe instead of setvar. If one ran
"getopts optstr badvariable"
where badvariable contained an illegal variable name, there was no way
to recover, since setvar() would longjmp on the error.


# 1.8 11-May-1995 christos

branches: 1.8.6;
Merge in my changes from vangogh, and fix the x=`false`; echo $? == 0
bug.


# 1.7 21-Mar-1995 cgd

convert to new RCS id conventions.


# 1.6 10-Jun-1994 mycroft

Add RCS ids.


# 1.5 11-May-1994 jtc

sync with 4.4lite


# 1.4 01-Aug-1993 mycroft

Add RCS identifiers.


# 1.3 22-Mar-1993 cgd

changed "Id" to "Header" for rcsids


# 1.2 22-Mar-1993 cgd

added rcs ids to all files


# 1.1 21-Mar-1993 cgd

branches: 1.1.1;
Initial revision


# 1.1.1.2 11-May-1994 jtc

44lite code


# 1.1.1.1 21-Mar-1993 cgd

initial import of 386bsd-0.1 sources


# 1.8.6.1 25-Jan-1997 rat

Update /bin/sh from trunk per request of Christos Zoulas. Fixes
many bugs.


# 1.19.40.1 23-Jun-2011 cherry

Catchup with rmind-uvmplock merge.