The NetBSD Project

CVS log for src/bin/sh/sh.1

[BACK] Up to [cvs.NetBSD.org] / src / bin / sh

Request diff between arbitrary revisions


Default branch: MAIN


Revision 1.259 / (download) - annotate - [select for diffs], Tue Jan 16 14:30:22 2024 UTC (6 weeks, 2 days ago) by kre
Branch: MAIN
CVS Tags: HEAD
Changes since 1.258: +2 -5 lines
Diff to previous 1.258 (colored)


Remove an ancient incorrect notion which somehow survived intact for ages.
"$@" is (as it is in double quotes) not subject to field splitting.  "$@"
generates (potentially) multiple words, but field splitting has nothing
to do with it.

While here, rename the section from "White Space Splitting (Field Splitting)"
to simply be "Field Splitting" as white space is only relevant if it happens
to occur in IFS (which is the default case, but IFS can be anything, and
isn't required to contain any white space at all).

Revision 1.258 / (download) - annotate - [select for diffs], Thu Oct 12 01:45:07 2023 UTC (4 months, 2 weeks ago) by uwe
Branch: MAIN
Changes since 1.257: +5 -5 lines
Diff to previous 1.257 (colored)

sh(1): touch up markup for the ENV example

Don't use Dq in a literal display, ascii quotes are \*q
While here mark up as literal a few things around this example.

Revision 1.257 / (download) - annotate - [select for diffs], Fri Sep 1 01:57:54 2023 UTC (5 months, 4 weeks ago) by kre
Branch: MAIN
Changes since 1.256: +35 -10 lines
Diff to previous 1.256 (colored)


At the request of bad@ enhance the synopsis of the set built-in
command to include explicit mention of the -o opt and +o opt forms.

Fix the synopsis to have the 4 forms that the description of the
utility discusses, rather than expecting users to understand that
the 3rd and 4th forms of the command were combined into the 3rd
synopsis format.   After doing that, the options in the 3rd format
no longer need to be optional, so now all 4 formats are distinct
(previously, the third, omitting everything that was optional, and
the first, could not be distinguished).

While here, some wording and formatting "improvements" as well (nothing
too serious).

Revision 1.256 / (download) - annotate - [select for diffs], Fri Aug 4 15:31:40 2023 UTC (6 months, 3 weeks ago) by jschauma
Branch: MAIN
Changes since 1.255: +3 -3 lines
Diff to previous 1.255 (colored)

tyops:
* redicection -> redirection
* escaoed -> escaped

Noted by J. Lewis Muir on netbsd-docs@

Revision 1.255 / (download) - annotate - [select for diffs], Tue Dec 20 17:51:54 2022 UTC (14 months, 1 week ago) by kre
Branch: MAIN
Changes since 1.254: +3 -3 lines
Diff to previous 1.254 (colored)


More markup errors.   \+ was intended to be \&+ and .EV .Ev of course.
As best I can tell, the rest of what mandoc -Wall complains about is
incorrect (it could probably be avoided by adding more markup, but
there doesn't seem to be any point).

Revision 1.254 / (download) - annotate - [select for diffs], Tue Dec 20 16:48:57 2022 UTC (14 months, 1 week ago) by kre
Branch: MAIN
Changes since 1.253: +2 -2 lines
Diff to previous 1.253 (colored)


Using .Cm Cm makes no sense at all - no idea what I was thinking there
(perhaps just an editing error).

Revision 1.252.2.1 / (download) - annotate - [select for diffs], Tue Dec 20 09:51:47 2022 UTC (14 months, 1 week ago) by martin
Branch: netbsd-10
CVS Tags: netbsd-10-0-RC5, netbsd-10-0-RC4, netbsd-10-0-RC3, netbsd-10-0-RC2, netbsd-10-0-RC1
Changes since 1.252: +3 -3 lines
Diff to previous 1.252 (colored) next main 1.253 (colored)

Pull up following revision(s) (requested by uwe in ticket #11):

	bin/sh/sh.1: revision 1.253

sh(1): Fix markup.  -compact must be last.

Revision 1.253 / (download) - annotate - [select for diffs], Tue Dec 20 01:18:42 2022 UTC (14 months, 1 week ago) by uwe
Branch: MAIN
Changes since 1.252: +3 -3 lines
Diff to previous 1.252 (colored)

sh(1): Fix markup.  -compact must be last.

Revision 1.252 / (download) - annotate - [select for diffs], Sun Dec 11 08:23:10 2022 UTC (14 months, 2 weeks ago) by kre
Branch: MAIN
CVS Tags: netbsd-10-base
Branch point for: netbsd-10
Changes since 1.251: +42 -13 lines
Diff to previous 1.251 (colored)


It appears that POSIX intends to add a -d X option to the read command
in its next version, so it can be used as -d '' (to specify a \0 end
character for the record read, rather than the default \n) to accompany
find -print0 and xargs -0 options (also likely to be added).

Add support for -d now.   While here fix a bug where escaped nul
chars (\ \0) in non-raw mode were not being dropped, as they are
when not escaped (if not dropped, they're still not used in any
useful way, they just ended the value at that point).

Revision 1.251 / (download) - annotate - [select for diffs], Sun Oct 30 01:19:08 2022 UTC (16 months ago) by kre
Branch: MAIN
Changes since 1.250: +6 -2 lines
Diff to previous 1.250 (colored)


Note in the description of "jobs -p" that the process id returned is
also the process group identifier (that's a requirement from POSIX, and
is what we have always done - just not been explicit about in sh.1).
Add a note that this value and $! are not necessarily the same (currently,
and perhaps forever, never the same in a pipeline with 2 or more elements).

Revision 1.250 / (download) - annotate - [select for diffs], Sun Sep 18 06:03:19 2022 UTC (17 months, 1 week ago) by kre
Branch: MAIN
Changes since 1.249: +170 -5 lines
Diff to previous 1.249 (colored)

Add the -l option (aka -o login): be a login shell.   Meaningful only on
the command line (with both - and + forms) - overrides the presence (or
otherwise) of a '-' as argv[0][0].

Since this allows any shell to be a login shell (which simply means that
it runs /etc/profile and ~/.profile at shell startup - there are no other
side effects) add a new, always set at startup, variable NBSH_INVOCATION
which has a char string as its value, where each char has a meaning,
more or less related to how the shell was started.   See sh(1).
This is intended to allow those startup scripts to tailor their behaviour
to the nature of this particular login shell (it is possible to detect
whether a shell is a login shell merely because of -l, or whether it would
have been anyway, before the -l option was added - and more).   The
var could also be used to set different values for $ENV for different
uses of the shell.

Revision 1.249 / (download) - annotate - [select for diffs], Fri Sep 16 19:25:09 2022 UTC (17 months, 1 week ago) by kre
Branch: MAIN
Changes since 1.248: +29 -11 lines
Diff to previous 1.248 (colored)


More wording improvements.   There might be more to come.

Revision 1.248 / (download) - annotate - [select for diffs], Fri Sep 16 17:32:18 2022 UTC (17 months, 1 week ago) by kre
Branch: MAIN
Changes since 1.247: +7 -7 lines
Diff to previous 1.247 (colored)


Minor wording improvements.

Note these do not alter anything about what the man page specifies,
just say a couple of things in a slightly better way, hence no Dd
update accompanies this change (deliberately).

Revision 1.247 / (download) - annotate - [select for diffs], Fri Sep 16 17:29:21 2022 UTC (17 months, 1 week ago) by kre
Branch: MAIN
Changes since 1.246: +4 -2 lines
Diff to previous 1.246 (colored)


Move a comment that used to be in the correct place, once upon a time,
back where it belongs, and make it stand out more, so other text is
less likely to find itself pushed between the comment and the text
to which it appears.   This change should make no visible difference
to the man page displayed.

Revision 1.246 / (download) - annotate - [select for diffs], Fri Sep 16 17:25:09 2022 UTC (17 months, 1 week ago) by kre
Branch: MAIN
Changes since 1.245: +3 -3 lines
Diff to previous 1.245 (colored)


Whitespace.

Revision 1.245 / (download) - annotate - [select for diffs], Thu Sep 15 18:00:36 2022 UTC (17 months, 2 weeks ago) by kre
Branch: MAIN
Changes since 1.244: +2 -2 lines
Diff to previous 1.244 (colored)


Correct spelling of terminal (it doesn't have a 2nd m).

Revision 1.244 / (download) - annotate - [select for diffs], Fri Aug 19 13:37:03 2022 UTC (18 months, 1 week ago) by kre
Branch: MAIN
Changes since 1.243: +20 -8 lines
Diff to previous 1.243 (colored)


Improve the description of the read builtin command.

Revision 1.243 / (download) - annotate - [select for diffs], Fri Jan 7 05:30:30 2022 UTC (2 years, 1 month ago) by lukem
Branch: MAIN
Changes since 1.242: +26 -9 lines
Diff to previous 1.242 (colored)

sh(1): improve getopts docs for optstring leading :

getopts has different behaviour if the leading character
of optstring is `:', so describe in more detail:
- no errors are printed (already there)
- unknown options set var to `?' and OPTARG to the unknown option
- missing arguments set var to `:' and OPTARG to the option name

Slight rewording of other paragraphs for more clarity.

Revision 1.242 / (download) - annotate - [select for diffs], Fri Jan 7 05:10:30 2022 UTC (2 years, 1 month ago) by lukem
Branch: MAIN
Changes since 1.241: +4 -4 lines
Diff to previous 1.241 (colored)

sh(1): fix formatting warnings

Revision 1.241 / (download) - annotate - [select for diffs], Sun Nov 21 16:23:20 2021 UTC (2 years, 3 months ago) by kre
Branch: MAIN
Changes since 1.240: +3 -3 lines
Diff to previous 1.240 (colored)


Improve the however-many-negatives wording even more.

Revision 1.240 / (download) - annotate - [select for diffs], Sat Nov 20 17:18:31 2021 UTC (2 years, 3 months ago) by rillig
Branch: MAIN
Changes since 1.239: +3 -4 lines
Diff to previous 1.239 (colored)

sh.1: replace triple negation with single negation, fix typo

Revision 1.239 / (download) - annotate - [select for diffs], Sat Nov 20 01:52:51 2021 UTC (2 years, 3 months ago) by kre
Branch: MAIN
Changes since 1.238: +62 -11 lines
Diff to previous 1.238 (colored)


Improve the wording of the "Argument List Processing" section (where
all the sh options, also used with "set", are listed) in response to
a discussion on icb conveyed to me by Darrin B. Jewell.
A few improvements to the description of the "set" built-in as well.

Bump Dd to cover all of this month's changes (so far).

Revision 1.238 / (download) - annotate - [select for diffs], Tue Nov 16 23:39:34 2021 UTC (2 years, 3 months ago) by rillig
Branch: MAIN
Changes since 1.237: +6 -6 lines
Diff to previous 1.237 (colored)

sh.1: fix typos

Revision 1.237 / (download) - annotate - [select for diffs], Tue Nov 16 11:28:29 2021 UTC (2 years, 3 months ago) by kre
Branch: MAIN
Changes since 1.236: +174 -38 lines
Diff to previous 1.236 (colored)

PR bin/56491

Make "hash" exit(!=0) (ie: exit(1)) if it writes an error message to
stderr as required by POSIX (it was writing "not found" errors, yet
still doing exit(0)).

Whether, when doing "hash foobar", and "foobar" is not found as a command
(not a built-in, not a function, and not found via a PATH search), that
should be considered an error differs between shells.  All of the ksh
descendant shells say "no", write no error message in this case, and
exit(0) if no other errors occur.   Other shells (essentially all) do
consider it an error, write a message to stderr, and exit(1) when this happens.

POSIX isn't clear, the bug report:
     https://austingroupbugs.net/view.php?id=1460
which is not yet resolved, suggests that the outcome will be that
this is to be unspecified.   Given the diversity, there might be no
other choice.

Have a foot in both camps - default to the "other shell" behaviour,
but add a -e option (no errors ... applies only to these "not found"
errors) to generate the ksh behaviour.   Without other errors (like an
unknown option, etc) "hash -e anyname" will always exit(0).

See the PR for details on how it all works now, or read the updated man page.

While here, when hash is in its other mode (reporting what is in the
table) check for I/O errors on stdout, and exit(1) (with an error
message!) if any occurred.   This does not apply to output generated
by the -v option when command names are given (that output is incidental).

In sh.1 document all of this.   Also add documentation for a bunch of
other options the hash command has had for years, but which were never
documented.   And while there, clean up some other sections I noticed
needed improving (either formatting or content or both).

Revision 1.223.2.2 / (download) - annotate - [select for diffs], Sat Nov 6 13:42:18 2021 UTC (2 years, 3 months ago) by martin
Branch: netbsd-9
CVS Tags: netbsd-9-3-RELEASE
Changes since 1.223.2.1: +58 -20 lines
Diff to previous 1.223.2.1 (colored) to branchpoint 1.223 (colored) next main 1.224 (colored)

Pull up following revision(s) (requested by kre in ticket #1372):

	bin/sh/sh.1: revision 1.236 (patch)
	bin/sh/cd.c: revision 1.51

PR bin/45390 - fix for folly four

In the pwd builtin, verify that curdir names '.' before
simply printing it.   Never alter PWD or OLDPWD in the
pwd command.

Also while here, implement the (new: coming in POSIX, but has existed
for a while in several other shells) -e option to cd (with -e, cd -P
will exit(1) if the chdir() succeeds, but PWD cannot be discovered).
cd now prints the directory name used (if different from that given,
or cdprint is on) if interactive or (the new bit)in posix mode.

Some additional/changed comments added, and a DEBUG mode trace call
that was accidentally put inside an #if 0 block moved to where it
can do some good.

XXX pullup -9

PR bin/45390

Be explicit about what happens to PWD after a successful cd command.
Also be very clear  that "cd" and "cd -P" are the same thing, and
the only cd variant implemented.
Also, when it is appropriate to print the new directory after a cd
command, note that it happens if interactive (as it always has here)
and also if the posix option is set (for POSIX compat, where "interactive"
is irrelevant).  Mention that "cd -" is a case where the new directory
is printed (along with paths relative to a non-empty CDPATH entry,
and where the "cd old new" (string replacement in curdir) is used.

While here document the new -e option to cd.

XXX pullup -9

Revision 1.223.2.1 / (download) - annotate - [select for diffs], Sat Nov 6 13:35:43 2021 UTC (2 years, 3 months ago) by martin
Branch: netbsd-9
Changes since 1.223: +32 -8 lines
Diff to previous 1.223 (colored)

Pull up following revision(s) (requested by kre in ticket #1371):

	bin/sh/main.c: revision 1.87
	bin/sh/main.c: revision 1.88
	bin/sh/memalloc.h: revision 1.20
	bin/sh/sh.1: revision 1.235
	bin/sh/memalloc.c: revision 1.34
	bin/sh/memalloc.c: revision 1.35
	bin/sh/memalloc.h: revision 1.19
	bin/sh/shell.h: revision 1.31
	bin/sh/options.c: revision 1.56

PR bin/56464

After almost 30 years, finally do the right thing and read $HOME/.profile
rather than .profile in the initial directory (it was that way in version
1.1 ...)   All other ash descendants seem to have fixed this long ago.
While here, copy a feature from FreeBSD which allows "set +p" (if a
shell run by a setuid process with the -p flag is privileged) to reset
the privileges.  Once done (the set +p) it cannot be undone (a later
set -p sets the 'p' flag, but that's all it does) - that just becomes a
one bit storage location.

We do this, as (also copying from FreeBSD, and because it is the right
thing to do) we don't run .profile in a privileged shell - FreeBSD run
/etc/suid_profile in that case (not a good name, it also applies to setgid
shells) but I see no real need for that, we run /etc/profile in any case,
anything that would go in /etc/suid_profile can just go in /etc/profile
instead (with suitable guards so the commands only run in priv'd shells).

One or two minor DEBUG mode changes (notably having priv'd shells identify
themselves in the DEBUG trace) and sh.1 changes with doc of the "set +p"
change, the effect that has on $PSc and a few other wording tweaks.

XXX pullup -9   (not -8, this isn't worth it for the short lifetime
that has left - if it took 28+ years for anyone to notice this, it
cannot be having all that much effect).

Use a type-correct end marker for strstrcat() rather than NULL, as
for a function with unknown number & types of args, the compiler isn't
able to automatically convert to the correct type.   Issue pointed out
in off list e-mail by Rolland Illig ... Thanks.

The first arg (pointer to where to put length of result) is of a known
type, so doesn't have the same issue - we can keep using NULL for that
one when the length isn't needed.
Also, make sure to return a correctly null terminated null string in
the (absurd) case that there are no non-null args to strstrcat() (though
there are much better ways to generate "" on the stack).  Since there is
currently just one call in the code, and it has real string args, this
isn't an issue for now, but who knows, some day.

NFCI - if there is any real change, then it is a change that is required.

XXX pullup -9 (together with the previous changes)

Revision 1.236 / (download) - annotate - [select for diffs], Sun Oct 31 02:12:08 2021 UTC (2 years, 3 months ago) by kre
Branch: MAIN
Changes since 1.235: +58 -20 lines
Diff to previous 1.235 (colored)

PR bin/45390

Be explicit about what happens to PWD after a successful cd command.
Also be very clear  that "cd" and "cd -P" are the same thing, and
the only cd variant implemented.

Also, when it is appropriate to print the new directory after a cd
command, note that it happens if interactive (as it always has here)
and also if the posix option is set (for POSIX compat, where "interactive"
is irrelevant).  Mention that "cd -" is a case where the new directory
is printed (along with paths relative to a non-empty CDPATH entry,
and where the "cd old new" (string replacement in curdir) is used.

While here document the new -e option to cd.

XXX pullup -9

Revision 1.235 / (download) - annotate - [select for diffs], Tue Oct 26 00:05:38 2021 UTC (2 years, 4 months ago) by kre
Branch: MAIN
Changes since 1.234: +32 -8 lines
Diff to previous 1.234 (colored)

PR bin/56464

After almost 30 years, finally do the right thing and read $HOME/.profile
rather than .profile in the initial directory (it was that way in version
1.1 ...)   All other ash descendants seem to have fixed this long ago.

While here, copy a feature from FreeBSD which allows "set +p" (if a
shell run by a setuid process with the -p flag is privileged) to reset
the privileges.  Once done (the set +p) it cannot be undone (a later
set -p sets the 'p' flag, but that's all it does) - that just becomes a
one bit storage location.

We do this, as (also copying from FreeBSD, and because it is the right
thing to do) we don't run .profile in a privileged shell - FreeBSD run
/etc/suid_profile in that case (not a good name, it also applies to setgid
shells) but I see no real need for that, we run /etc/profile in any case,
anything that would go in /etc/suid_profile can just go in /etc/profile
instead (with suitable guards so the commands only run in priv'd shells).

One or two minor DEBUG mode changes (notably having priv'd shells identify
themselves in the DEBUG trace) and sh.1 changes with doc of the "set +p"
change, the effect that has on $PSc and a few other wording tweaks.

XXX pullup -9   (not -8, this isn't worth it for the short lifetime
that has left - if it took 28+ years for anyone to notice this, it
cannot be having all that much effect).

Revision 1.234 / (download) - annotate - [select for diffs], Wed Sep 15 18:30:57 2021 UTC (2 years, 5 months ago) by kre
Branch: MAIN
Changes since 1.233: +10 -3 lines
Diff to previous 1.233 (colored)

Have the ulimit command watch for ulimit -n (alter number of available fds)
and keep the rest of the shell aware of any changes.

While here, modify 'ulimit -aSH' to print both the soft and hard limits
for the resources, rather than just (in this case, as H comes last) the
hard limit.   In any other case when both S and H are present, and we're
examining a limit, use the soft limit (just as if neither were given).

No change for setting limits (both are set, unless exactly one of -H
or -S is given).   However, we now check for overflow when converting
the value to be assigned, rather than just truncating the value however
it happens to work out...

Revision 1.233 / (download) - annotate - [select for diffs], Sun Sep 12 06:53:08 2021 UTC (2 years, 5 months ago) by wiz
Branch: MAIN
Changes since 1.232: +4 -2 lines
Diff to previous 1.232 (colored)

Mark up NULL with Dv.

Revision 1.232 / (download) - annotate - [select for diffs], Sun Sep 12 02:20:36 2021 UTC (2 years, 5 months ago) by kre
Branch: MAIN
Changes since 1.231: +40 -2 lines
Diff to previous 1.231 (colored)


Improve the formatting of the list of Built-in commands for those
commands with multiple synopsis lines (eg: trap).

But there really must be a better way to achieve this effect than
the way it is accomplished here, and I'm hoping some wizard who
understands mdoc much better than I do will revert this change and
do it using some inspired magic incantation instead.

Revision 1.231 / (download) - annotate - [select for diffs], Sun Sep 12 01:30:41 2021 UTC (2 years, 5 months ago) by kre
Branch: MAIN
Changes since 1.230: +18 -2 lines
Diff to previous 1.230 (colored)


Don't dereference NULL on "jobs -Z" (with no title given), instead
do setproctitle(NULL) (which is not the same thing at all).  Do the
same with jobs -Z '' as setting the title to "sh: " isn't useful.

Improve the way this is documented, and note that it is only done
this way because zsh did it first (ie: pass on the balme, doing this
in the jobs command is simply absurd.)

Revision 1.230 / (download) - annotate - [select for diffs], Sat Sep 11 20:43:32 2021 UTC (2 years, 5 months ago) by christos
Branch: MAIN
Changes since 1.229: +8 -3 lines
Diff to previous 1.229 (colored)

Add jobs -Z (like in zsh(1)) to setproctitle(3).

Revision 1.229 / (download) - annotate - [select for diffs], Fri Sep 18 07:21:26 2020 UTC (3 years, 5 months ago) by wiz
Branch: MAIN
CVS Tags: cjep_sun2x-base1, cjep_sun2x-base, cjep_sun2x, cjep_staticlib_x-base1, cjep_staticlib_x-base, cjep_staticlib_x
Changes since 1.228: +1 -2 lines
Diff to previous 1.228 (colored)

Remove superfluous Ed.

Revision 1.228 / (download) - annotate - [select for diffs], Fri Sep 18 06:48:28 2020 UTC (3 years, 5 months ago) by kre
Branch: MAIN
Changes since 1.227: +42 -6 lines
Diff to previous 1.227 (colored)


Correct an incorrectly quoted (unquoted, but should be) example used in
the "local" built-in command description (pointed out by mrg@ via uwe@ in
private e-mail).

Add a description to the export command of why this quoting is required,
and then refer to it from local and readonly (explained in export as that
one comes first).

Note that some shells parse export/local/readonly (and often more) as
"declarative" commands, and this quoting isn't needed (provided the
command name is literal and not the result of an expansion) making
X=$Y type args not require quoting, as they often don't in a regular
variable assignment (preceding, or not part of, another command).
POSIX is going to allow, but not require, that behaviour.  We do not
implement it.

Revision 1.227 / (download) - annotate - [select for diffs], Tue Aug 25 19:42:02 2020 UTC (3 years, 6 months ago) by kre
Branch: MAIN
Changes since 1.226: +2 -2 lines
Diff to previous 1.226 (colored)


Idiot typo, generated by an idiot, fixed by the same one.

Revision 1.226 / (download) - annotate - [select for diffs], Fri Aug 21 08:14:45 2020 UTC (3 years, 6 months ago) by wiz
Branch: MAIN
Changes since 1.225: +4 -3 lines
Diff to previous 1.225 (colored)

Remove unmatched .El and mark up signal name with Dv.

Revision 1.225 / (download) - annotate - [select for diffs], Thu Aug 20 23:19:34 2020 UTC (3 years, 6 months ago) by kre
Branch: MAIN
Changes since 1.224: +75 -23 lines
Diff to previous 1.224 (colored)


Man page enhancements.

Better describe the command search procedure.
Document "trap -P"
Describe what works as a function name.
More accurate description of reserved word recognition.
Be more accurate about when field splittng happens after
expansions (and in particular note that tilde expansions are
not subject to field splitting).   Be clear that "$@" is
not field split, it simply produces multiple fields as part
of its expansion (hence IFS is irrelevant to this), but if
used as $@ (unquoted) each field produced is potentially subject
to field splitting.   Other minor wording changes.

Revision 1.206.2.4 / (download) - annotate - [select for diffs], Tue Apr 21 19:37:34 2020 UTC (3 years, 10 months ago) by martin
Branch: phil-wifi
Changes since 1.206.2.3: +1 -1 lines
Diff to previous 1.206.2.3 (colored) to branchpoint 1.206 (colored) next main 1.207 (colored)

Ooops, restore accidently removed files from merge mishap

Revision 1.206.2.3, Tue Apr 21 18:41:06 2020 UTC (3 years, 10 months ago) by martin
Branch: phil-wifi
Changes since 1.206.2.2: +1 -1 lines
FILE REMOVED

Sync with HEAD

Revision 1.206.2.2 / (download) - annotate - [select for diffs], Wed Apr 8 14:03:04 2020 UTC (3 years, 10 months ago) by martin
Branch: phil-wifi
Changes since 1.206.2.1: +3 -3 lines
Diff to previous 1.206.2.1 (colored) to branchpoint 1.206 (colored)

Merge changes from current as of 20200406

Revision 1.224 / (download) - annotate - [select for diffs], Thu Feb 20 18:24:20 2020 UTC (4 years ago) by pgoyette
Branch: MAIN
CVS Tags: phil-wifi-20200421, phil-wifi-20200411, phil-wifi-20200406, is-mlppp-base, is-mlppp
Changes since 1.223: +3 -3 lines
Diff to previous 1.223 (colored)

Typo: s/./,/

Revision 1.206.2.1 / (download) - annotate - [select for diffs], Mon Jun 10 21:41:04 2019 UTC (4 years, 8 months ago) by christos
Branch: phil-wifi
Changes since 1.206: +436 -88 lines
Diff to previous 1.206 (colored)

Sync with HEAD

Revision 1.223 / (download) - annotate - [select for diffs], Mon Apr 22 04:10:33 2019 UTC (4 years, 10 months ago) by kre
Branch: MAIN
CVS Tags: phil-wifi-20191119, phil-wifi-20190609, netbsd-9-base, netbsd-9-2-RELEASE, netbsd-9-1-RELEASE, netbsd-9-0-RELEASE, netbsd-9-0-RC2, netbsd-9-0-RC1
Branch point for: netbsd-9
Changes since 1.222: +2 -2 lines
Diff to previous 1.222 (colored)


Bump date for previous.

Revision 1.222 / (download) - annotate - [select for diffs], Mon Apr 22 04:04:35 2019 UTC (4 years, 10 months ago) by kre
Branch: MAIN
Changes since 1.221: +49 -14 lines
Diff to previous 1.221 (colored)


PR standards/40554

Update the description of the <& and >& redirection operators
(as indicated would happen in a message appended to the PR a week ago,
which received no opposition - no feedback).

Some rewriting of the section on redirects (including how the word
expansion of the "file" works) to make this simpler & more accurate.

Revision 1.221 / (download) - annotate - [select for diffs], Mon Apr 15 20:35:25 2019 UTC (4 years, 10 months ago) by uwe
Branch: MAIN
Changes since 1.220: +2 -2 lines
Diff to previous 1.220 (colored)

-compact must come last

Revision 1.220 / (download) - annotate - [select for diffs], Thu Feb 14 11:15:24 2019 UTC (5 years ago) by kre
Branch: MAIN
Changes since 1.219: +47 -2 lines
Diff to previous 1.219 (colored)


Add the "specialvar" built-in command.   Discussed (well, mentioned
anway) on tech-userlevel with no adverse response.

This allows the magic of vars like HOSTNAME SECONDS, ToD (etc) to be
restored should it be lost - perhaps by having a var of the same name
imported from the environment (which needs to remove the magic in case
a set of scripts are using the env to pass data, and the var name chosen
happens to be one of our magic ones).

No change to SMALL shells (or smaller) - none of the magic vars (except
LINENO, which is exempt from all of this) exist in those, hence such a
shell has no need for this command either.

Revision 1.219 / (download) - annotate - [select for diffs], Mon Feb 4 12:18:36 2019 UTC (5 years ago) by wiz
Branch: MAIN
Changes since 1.218: +2 -2 lines
Diff to previous 1.218 (colored)

Remove leading zero from date.

Revision 1.218 / (download) - annotate - [select for diffs], Mon Feb 4 11:16:41 2019 UTC (5 years ago) by kre
Branch: MAIN
Changes since 1.217: +30 -12 lines
Diff to previous 1.217 (colored)

PR bin/53919

Suppress shell error messages while expanding $ENV (which also causes
errors while expanding $PS1 $PS2 and $PS4 to be suppressed as well).

This allows any random garbage that happens to be in ENV to not
cause noise when the shell starts (which is effectively all it did).

On a parse error (for any of those vars) we also use "" as the result,
which will be a null prompt, and avoid attempting to open any file for ENV.

This does not in any way change what happens for a correctly parsed command
substitution (either when it is executed when permitted for one of the
prompts, or when it is not (which is always for ENV)) and commands run
from those can still produce error output (but shell errors remain suppressed).

Revision 1.175.2.7 / (download) - annotate - [select for diffs], Sat Jan 26 21:58:12 2019 UTC (5 years, 1 month ago) by pgoyette
Branch: pgoyette-compat
CVS Tags: pgoyette-compat-merge-20190127
Changes since 1.175.2.6: +9 -1 lines
Diff to previous 1.175.2.6 (colored) to branchpoint 1.175 (colored) next main 1.176 (colored)

Sync with HEAD

Revision 1.217 / (download) - annotate - [select for diffs], Mon Jan 21 14:09:24 2019 UTC (5 years, 1 month ago) by kre
Branch: MAIN
CVS Tags: pgoyette-compat-20190127
Changes since 1.216: +9 -1 lines
Diff to previous 1.216 (colored)


Add an explanation of the error (warning)
	RANDOM initialisation failed
when the shell might print after RANDOM has been reseeded
(which includes at sh startup) the next time RANDOM is accessed.
It indicates that /dev/urandom was not available or did not
provide data - in that case, sh uses a (weak) seed made out of
the pid and time (but otherwise nothing else changes).

Revision 1.175.2.6 / (download) - annotate - [select for diffs], Wed Dec 26 14:01:03 2018 UTC (5 years, 2 months ago) by pgoyette
Branch: pgoyette-compat
Changes since 1.175.2.5: +194 -45 lines
Diff to previous 1.175.2.5 (colored) to branchpoint 1.175 (colored)

Sync with HEAD, resolve a few conflicts

Revision 1.216 / (download) - annotate - [select for diffs], Wed Dec 12 20:22:43 2018 UTC (5 years, 2 months ago) by kre
Branch: MAIN
CVS Tags: pgoyette-compat-20190118, pgoyette-compat-1226
Changes since 1.215: +7 -2 lines
Diff to previous 1.215 (colored)

Reverse a decision made when the printsignals() routines from
kill and sh were merged so that the shell (for trap -l) and
kill (for kill -l) can use the same routine, and site that function
in the shell, rather than in kill (use the code that is in kill as
the basis for that routine).   This allows access to sh internals,
and in particular to the posix option, so the builtin kill can
operate in posix mode where the standard requires just a single
character (space of newline) between successive signal names (and
we prefer nicely aligned columns instead)..

In a SMALL shell, use the ancient sh printsignals routine instead,
it is smaller (and very much dumber).

/bin/kill still uses the routine that is in its source, and is
not posix compliant.   A task for some other day...

Revision 1.215 / (download) - annotate - [select for diffs], Wed Dec 12 12:56:17 2018 UTC (5 years, 2 months ago) by kre
Branch: MAIN
Changes since 1.214: +4 -4 lines
Diff to previous 1.214 (colored)


More fixes for the SYNPOSIS of the readonly built-in.
The SYNOPSIS for "readonly -q" cannot have the -q be
optional ...   Also harmonise the output appearance with
that of the export command.

wiz: have at it...

Revision 1.214 / (download) - annotate - [select for diffs], Wed Dec 12 12:30:59 2018 UTC (5 years, 2 months ago) by kre
Branch: MAIN
Changes since 1.213: +2 -2 lines
Diff to previous 1.213 (colored)


Fix Oo Op Oc syntax error (which seemed to work OK to me....)
Pointed out by wiz@

Revision 1.213 / (download) - annotate - [select for diffs], Wed Dec 12 11:51:33 2018 UTC (5 years, 2 months ago) by kre
Branch: MAIN
Changes since 1.212: +105 -18 lines
Diff to previous 1.212 (colored)

Implement:
	readonly -q VAR...
	readonly -p VAR...
	export -q [-x] VAR...
	export -p [-x] VAR...

all available only in !SMALL shells - and while here, limit
"export -x" to full sized shells as well.

Also, do a better job of arg checking and validating of the
export and readonly commands (which is really just one built-in)
and of issuing error messages when something bogus is detected.

Since these commands are special builtin commands, any error
causes shell exit (for non-interactive shells).

Revision 1.212 / (download) - annotate - [select for diffs], Tue Dec 11 13:31:20 2018 UTC (5 years, 2 months ago) by kre
Branch: MAIN
Changes since 1.211: +21 -7 lines
Diff to previous 1.211 (colored)

PR standards/42829

Implement parameter and arithmetic expansion of $ENV
before using it as the name of a file from which to
read startup commands for the shell.   This continues
to happen for all interactive shells, and non-interactive
shells for which the posix option is not set (-o posix).

On any actual error, or if an attempt is made to use
command substitution, then the value of ENV is used
unchanged as the file name.

The expansion complies with POSIX XCU 2.5.3, though that
only requires parameter expansion - arithmetic expansion
is an extension (but for us, it is much easier to do, than
not to do, and it allows some weird stuff, if you're so
inclined....)   Note that there is no ~ expansion (use $HOME).

Revision 1.146.2.6 / (download) - annotate - [select for diffs], Fri Dec 7 13:23:49 2018 UTC (5 years, 2 months ago) by martin
Branch: netbsd-8
CVS Tags: netbsd-8-2-RELEASE, netbsd-8-1-RELEASE, netbsd-8-1-RC1
Changes since 1.146.2.5: +60 -7 lines
Diff to previous 1.146.2.5 (colored) to branchpoint 1.146 (colored) next main 1.147 (colored)

Pull up following revision(s) (requested by kre in ticket #1127):

	bin/sh/var.h: revision 1.38 (via patch)
	bin/sh/var.c: revision 1.72
	bin/sh/sh.1: revision 1.211 (via patch)

Alter a design botch when magic (self modifying) variables
were added to sh ... in other shells, setting such a variable
(for most of them) causes it to lose its special properties,
and act the same as any other variable.   I had assumed that
was just implementor laziness...   I was wrong.

From now on the NetBSD shell will act like the others, and if vars
like HOSTNAME (and SECONDS, etc) are used as variables in a script
or whatever, they will act just like normal variables (and unless
this happens when they have been made local, or as a variable-assignment
as a prefix to a command, the special properties they would have had
otherwise are lost for the remainder of the life of the (sub-)shell
in which the variables were set).

Importing a value from the environment counts as setting the
value for this purpose (so if HOSTNAME is set in the environment,
the value there will be the value $HOSTNAME expands to).
The two exceptions to this are LINENO and RANDOM.   RANDOM
needs to be able to be set to (re-)set its seed.  LINENO needs to
be able to be set (at least in the "local" command) to achieve
the desired functionality.   It is unlikely that any (sane) script
is going to want to use those two as normal vars however.

While here, fix a minor bug in popping local vars (fn return) that need
to notify the shell of changes in value (like PATH).
Change sh(1) to reflect this alteration.  Also add doc of the
(forgotten) magic var EUSER (which has been there since the others
were added), and add a few more vars (which are documented
in other places in sh(1) - like ENV) into the defined or used
variable list (as well as wherever else they appear).

XXX pullup -8

Revision 1.211 / (download) - annotate - [select for diffs], Tue Dec 4 14:03:30 2018 UTC (5 years, 2 months ago) by kre
Branch: MAIN
Changes since 1.210: +61 -8 lines
Diff to previous 1.210 (colored)

Alter a design botch when magic (self modifying) variables
were added to sh ... in other shells, setting such a variable
(for most of them) causes it to lose its special properties,
and act the same as any other variable.   I had assumed that
was just implementor laziness...   I was wrong.

From now on the NetBSD shell will act like the others, and if vars
like HOSTNAME (and SECONDS, etc) are used as variables in a script
or whatever, they will act just like normal variables (and unless
this happens when they have been made local, or as a variable-assignment
as a prefix to a command, the special properties they would have had
otherwise are lost for the remainder of the life of the (sub-)shell
in which the variables were set).

Importing a value from the environment counts as setting the
value for this purpose (so if HOSTNAME is set in the environment,
the value there will be the value $HOSTNAME expands to).

The two exceptions to this are LINENO and RANDOM.   RANDOM
needs to be able to be set to (re-)set its seed.  LINENO needs to
be able to be set (at least in the "local" command) to achieve
the desired functionality.   It is unlikely that any (sane) script
is going to want to use those two as normal vars however.

While here, fix a minor bug in popping local vars (fn return) that need
to notify the shell of changes in value (like PATH).

Change sh(1) to reflect this alteration.  Also add doc of the
(forgotten) magic var EUSER (which has been there since the others
were added), and add a few more vars (which are documented
in other places in sh(1) - like ENV) into the defined or used
variable list (as well as wherever else they appear).

XXX pullup -8

Revision 1.210 / (download) - annotate - [select for diffs], Mon Dec 3 06:43:19 2018 UTC (5 years, 2 months ago) by kre
Branch: MAIN
Changes since 1.209: +6 -16 lines
Diff to previous 1.209 (colored)

Cleanup traps a bit - attempt to handle weird uses in traps, such
as traps that issue break/continue/return to cause the loop/function
executing when the trap occurred to break/continue/return, and
generating the correct exit code from the shell including when a
signal is caught, but the trap handler for it exits.

All that from FreeBSD.

Also make
	T=$(trap)
work as it is supposed to (also trap -p).

For now this is handled by the same technique as $(jobs) - rather
than clearing the traps in subshells, just mark them invalid, and
then whenever they're invalid, clear them before executing anything
other than the special blessed "trap" command.   Eventually we will
handle these using non-subshell command substitution instead (not
creating a subshell environ when the commands in a command-sub alter
nothing in the environment).

Revision 1.175.2.5 / (download) - annotate - [select for diffs], Mon Nov 26 01:49:54 2018 UTC (5 years, 3 months ago) by pgoyette
Branch: pgoyette-compat
Changes since 1.175.2.4: +2 -2 lines
Diff to previous 1.175.2.4 (colored) to branchpoint 1.175 (colored)

Sync with HEAD, resolve a couple of conflicts

Revision 1.209 / (download) - annotate - [select for diffs], Fri Nov 23 20:40:06 2018 UTC (5 years, 3 months ago) by kre
Branch: MAIN
CVS Tags: pgoyette-compat-1126
Changes since 1.208: +2 -2 lines
Diff to previous 1.208 (colored)


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.

Revision 1.175.2.4 / (download) - annotate - [select for diffs], Thu Sep 6 06:51:32 2018 UTC (5 years, 5 months ago) by pgoyette
Branch: pgoyette-compat
Changes since 1.175.2.3: +118 -25 lines
Diff to previous 1.175.2.3 (colored) to branchpoint 1.175 (colored)

Sync with HEAD

Resolve a couple of conflicts (result of the uimin/uimax changes)

Revision 1.208 / (download) - annotate - [select for diffs], Tue Sep 4 23:16:30 2018 UTC (5 years, 5 months ago) by kre
Branch: MAIN
CVS Tags: pgoyette-compat-1020, pgoyette-compat-0930, pgoyette-compat-0906
Changes since 1.207: +10 -9 lines
Diff to previous 1.207 (colored)

Change the way the pipefail option works.   Now it is the setting of
the option when a pipeline is created that controls the way the exit
status of the pipeline is calculated.  Previously it was the state of
the option when the exit status of the pipeline was collected.

This makes no difference at all for foreground pipelines (there is
no way to change the option between starting and completing the
pipeline) but it does for asynchronous (background) pipelines.

This was always the right way to implement it - it was originally
done the other way as I could not find any other shell implemented
this way - they all seemed to do it our previous way, and I could
not see a good reason to be the sole different shell.

However, now I know that ksh93 works as we will now work, and I
am told that if the option is added to the FreeBSD shell (apparently
the code exists, uncommitted) it will be the same.

Revision 1.207 / (download) - annotate - [select for diffs], Sat Aug 25 17:35:31 2018 UTC (5 years, 6 months ago) by kre
Branch: MAIN
Changes since 1.206: +109 -17 lines
Diff to previous 1.206 (colored)


PR bin/48875

Add a paragraph (briefer than previously posted to mailing lists)
to explain that there is no guarantee that the results of a command
substitution will be available before all commands started by the
cmdsub have completed.

Include the original proposed text (much longer) as *roff comments, so
it will at least be available to those who browse the man page sources.

While here, clean up the existing text about command substitutions to
make it a little more accurate (and to advise against using the `` form).

Revision 1.175.2.3 / (download) - annotate - [select for diffs], Mon May 21 04:35:48 2018 UTC (5 years, 9 months ago) by pgoyette
Branch: pgoyette-compat
Changes since 1.175.2.2: +3 -9 lines
Diff to previous 1.175.2.2 (colored) to branchpoint 1.175 (colored)

Sync with HEAD

Revision 1.206 / (download) - annotate - [select for diffs], Thu May 3 05:11:43 2018 UTC (5 years, 9 months ago) by wiz
Branch: MAIN
CVS Tags: phil-wifi-base, pgoyette-compat-0728, pgoyette-compat-0625, pgoyette-compat-0521
Branch point for: phil-wifi
Changes since 1.205: +1 -4 lines
Diff to previous 1.205 (colored)

Remove Pps without effect.

Revision 1.205 / (download) - annotate - [select for diffs], Thu May 3 00:32:11 2018 UTC (5 years, 9 months ago) by kre
Branch: MAIN
Changes since 1.204: +2 -5 lines
Diff to previous 1.204 (colored)


Simplify convoluted language, and remove incorrect statement
(that I added a while ago) about what is required by POSIX.

Revision 1.204 / (download) - annotate - [select for diffs], Wed May 2 21:43:38 2018 UTC (5 years, 9 months ago) by pgoyette
Branch: MAIN
Changes since 1.203: +3 -3 lines
Diff to previous 1.203 (colored)

Minor grammatical correction (don't end a sentence/phrase with a
preposition).

Revision 1.175.2.2 / (download) - annotate - [select for diffs], Thu Mar 22 01:44:39 2018 UTC (5 years, 11 months ago) by pgoyette
Branch: pgoyette-compat
Changes since 1.175.2.1: +156 -143 lines
Diff to previous 1.175.2.1 (colored) to branchpoint 1.175 (colored)

Synch with HEAD, resolve conflicts

Revision 1.203 / (download) - annotate - [select for diffs], Sat Mar 17 01:53:06 2018 UTC (5 years, 11 months ago) by uwe
Branch: MAIN
CVS Tags: pgoyette-compat-0502, pgoyette-compat-0422, pgoyette-compat-0415, pgoyette-compat-0407, pgoyette-compat-0330, pgoyette-compat-0322
Changes since 1.202: +19 -17 lines
Diff to previous 1.202 (colored)

Drop "show or set the limit on" legalese from the description of each
and every option to ulimit built-in.  The show-or-set text is already
supplied *both* before and after the list.  Pedantically repeating it
for each option just adds a lot of visual clutter that gets in the way
of actually using this fragment of the manual page as a quick
reference.

Revision 1.202 / (download) - annotate - [select for diffs], Sat Mar 17 01:40:28 2018 UTC (5 years, 11 months ago) by uwe
Branch: MAIN
Changes since 1.201: +4 -3 lines
Diff to previous 1.201 (colored)

Tweak "ulimit" synopsis.

Revision 1.201 / (download) - annotate - [select for diffs], Sat Mar 17 01:32:42 2018 UTC (5 years, 11 months ago) by uwe
Branch: MAIN
Changes since 1.200: +34 -31 lines
Diff to previous 1.200 (colored)

Cleanup markup in the "Command Line Editing" section.

Revision 1.200 / (download) - annotate - [select for diffs], Sat Mar 17 01:03:08 2018 UTC (5 years, 11 months ago) by uwe
Branch: MAIN
Changes since 1.199: +34 -22 lines
Diff to previous 1.199 (colored)

Cleanup markup in the "Job Control" section.

Revision 1.199 / (download) - annotate - [select for diffs], Sat Mar 17 00:03:25 2018 UTC (5 years, 11 months ago) by uwe
Branch: MAIN
Changes since 1.198: +37 -37 lines
Diff to previous 1.198 (colored)

Use .Dv, not .Ev, to refer to LINENO, it's not an environment variable.

Revision 1.198 / (download) - annotate - [select for diffs], Fri Mar 16 23:56:13 2018 UTC (5 years, 11 months ago) by uwe
Branch: MAIN
Changes since 1.197: +6 -6 lines
Diff to previous 1.197 (colored)

Default values of PS1 and friends have only single space.  Use .Li to
typeset them to make that space more visible in PostScript output.

Revision 1.197 / (download) - annotate - [select for diffs], Fri Mar 16 23:36:13 2018 UTC (5 years, 11 months ago) by uwe
Branch: MAIN
Changes since 1.196: +7 -13 lines
Diff to previous 1.196 (colored)

Use .Bd -literal for code example.

Revision 1.196 / (download) - annotate - [select for diffs], Fri Mar 16 12:06:18 2018 UTC (5 years, 11 months ago) by kre
Branch: MAIN
Changes since 1.195: +16 -16 lines
Diff to previous 1.195 (colored)


Markup fixes (partly from uwe@) and change some tabs to spaces, they
seem to work better...

Revision 1.195 / (download) - annotate - [select for diffs], Fri Mar 16 11:53:57 2018 UTC (5 years, 11 months ago) by kre
Branch: MAIN
Changes since 1.194: +16 -16 lines
Diff to previous 1.194 (colored)


Restore some (*roff) comments deleted in previous (partially unshave
the yak) for which the purpose was misunderstood.   But trim one more hair.

Revision 1.194 / (download) - annotate - [select for diffs], Fri Mar 16 11:19:24 2018 UTC (5 years, 11 months ago) by kre
Branch: MAIN
Changes since 1.193: +20 -19 lines
Diff to previous 1.193 (colored)


Give the yak a quick trim and shave, and make one or two minor
wording changes (which are, hopefully, improvements).

Revision 1.175.2.1 / (download) - annotate - [select for diffs], Thu Mar 15 09:11:52 2018 UTC (5 years, 11 months ago) by pgoyette
Branch: pgoyette-compat
Changes since 1.175: +661 -399 lines
Diff to previous 1.175 (colored)

Synch with HEAD

Revision 1.193 / (download) - annotate - [select for diffs], Thu Mar 15 01:20:43 2018 UTC (5 years, 11 months ago) by uwe
Branch: MAIN
CVS Tags: pgoyette-compat-0315
Changes since 1.192: +249 -132 lines
Diff to previous 1.192 (colored)

Start adding more gaudy markup.  Use .Li or .Dv when referring to
parameters.  Use more .Ic and .Ar when defining syntax.

The manual is still rather inconsistent e.g. when referring to
parameters where it randomly uses both $0 and 0 or $@ and @ - but I'm
not shaving that yak at least for now.

Revision 1.192 / (download) - annotate - [select for diffs], Wed Mar 14 10:38:52 2018 UTC (5 years, 11 months ago) by uwe
Branch: MAIN
Changes since 1.191: +3 -6 lines
Diff to previous 1.191 (colored)

Compute tag width for the list of options in Argument List Processing,
mandoc *is* up to that.  Remove the part of the comment before the
list that was wondering about that.

Revision 1.191 / (download) - annotate - [select for diffs], Wed Mar 14 10:30:40 2018 UTC (5 years, 11 months ago) by uwe
Branch: MAIN
Changes since 1.190: +8 -5 lines
Diff to previous 1.190 (colored)

Small markup tweaks in Argument List Processing

Revision 1.190 / (download) - annotate - [select for diffs], Wed Mar 14 09:46:45 2018 UTC (5 years, 11 months ago) by uwe
Branch: MAIN
Changes since 1.189: +6 -6 lines
Diff to previous 1.189 (colored)

Instead of .Oo/.Oc use .Op directly where possible.

Revision 1.189 / (download) - annotate - [select for diffs], Wed Mar 14 09:42:37 2018 UTC (5 years, 11 months ago) by uwe
Branch: MAIN
Changes since 1.188: +2 -2 lines
Diff to previous 1.188 (colored)

Revert previous.  Fix the real problem properly.

Revision 1.188 / (download) - annotate - [select for diffs], Wed Mar 14 07:53:14 2018 UTC (5 years, 11 months ago) by wiz
Branch: MAIN
Changes since 1.187: +2 -2 lines
Diff to previous 1.187 (colored)

Remove Ic macro without effect.

Revision 1.187 / (download) - annotate - [select for diffs], Tue Mar 13 23:03:21 2018 UTC (5 years, 11 months ago) by uwe
Branch: MAIN
Changes since 1.186: +216 -148 lines
Diff to previous 1.186 (colored)

Try to improve markup in the Built-ins section.
Mostly sprinkle missing .Ic and .Ar

Revision 1.186 / (download) - annotate - [select for diffs], Tue Mar 13 21:49:15 2018 UTC (5 years, 11 months ago) by uwe
Branch: MAIN
Changes since 1.185: +121 -61 lines
Diff to previous 1.185 (colored)

Try to improve markup in the Parameter Expansion section.

Revision 1.185 / (download) - annotate - [select for diffs], Tue Mar 13 21:04:57 2018 UTC (5 years, 11 months ago) by uwe
Branch: MAIN
Changes since 1.184: +24 -19 lines
Diff to previous 1.184 (colored)

Try to improve markup of the redirections definitions.

Revision 1.184 / (download) - annotate - [select for diffs], Tue Mar 13 20:48:00 2018 UTC (5 years, 11 months ago) by uwe
Branch: MAIN
Changes since 1.183: +10 -10 lines
Diff to previous 1.183 (colored)

Fix horrendous markup abuse in the here-document example.
Consistently spell "here-document" in full.

Revision 1.183 / (download) - annotate - [select for diffs], Tue Mar 13 20:40:52 2018 UTC (5 years, 11 months ago) by uwe
Branch: MAIN
Changes since 1.182: +2 -3 lines
Diff to previous 1.182 (colored)

Spell "here-document" with a hyphen, don't mark it up as a command.

Revision 1.182 / (download) - annotate - [select for diffs], Tue Mar 13 20:39:25 2018 UTC (5 years, 11 months ago) by uwe
Branch: MAIN
Changes since 1.181: +3 -3 lines
Diff to previous 1.181 (colored)

Mark up "in" (of the "for" command) appropriately.

Revision 1.181 / (download) - annotate - [select for diffs], Tue Mar 13 20:29:13 2018 UTC (5 years, 11 months ago) by uwe
Branch: MAIN
Changes since 1.180: +2 -2 lines
Diff to previous 1.180 (colored)

Use \(or not \*(Ba when discussing case patterns.

Revision 1.180 / (download) - annotate - [select for diffs], Tue Mar 13 20:18:16 2018 UTC (5 years, 11 months ago) by uwe
Branch: MAIN
Changes since 1.179: +7 -7 lines
Diff to previous 1.179 (colored)

Use \(em for em-dash

Revision 1.179 / (download) - annotate - [select for diffs], Tue Mar 13 20:08:11 2018 UTC (5 years, 11 months ago) by uwe
Branch: MAIN
Changes since 1.178: +4 -4 lines
Diff to previous 1.178 (colored)

Standalone | means \[ba] while we want \[or] so add \& protection to
the few places where it was missing.

Revision 1.178 / (download) - annotate - [select for diffs], Tue Mar 13 19:43:52 2018 UTC (5 years, 11 months ago) by uwe
Branch: MAIN
Changes since 1.177: +25 -13 lines
Diff to previous 1.177 (colored)

.Dl is a a single line .Bd -literal -offset indent so don't abuse
multiple consecutive .Dl and use proper .Bd instead.

Revision 1.177 / (download) - annotate - [select for diffs], Tue Mar 13 19:35:46 2018 UTC (5 years, 11 months ago) by uwe
Branch: MAIN
Changes since 1.176: +3 -3 lines
Diff to previous 1.176 (colored)

.Bd expects the display type to come first, so move -compact to the end.

Revision 1.176 / (download) - annotate - [select for diffs], Tue Mar 13 19:18:53 2018 UTC (5 years, 11 months ago) by uwe
Branch: MAIN
Changes since 1.175: +4 -3 lines
Diff to previous 1.175 (colored)

Add missing word.

Revision 1.175 / (download) - annotate - [select for diffs], Mon Jan 15 11:27:39 2018 UTC (6 years, 1 month ago) by kre
Branch: MAIN
CVS Tags: pgoyette-compat-base
Branch point for: pgoyette-compat
Changes since 1.174: +11 -9 lines
Diff to previous 1.174 (colored)


Paul Goyette suggested improvements to parts of the description of
LINENO ... this is what resulted (with thanks for the grammar lessons,
and sundry references provided!)

No date (Dd) bump - there is no change of substance here, just (hopefully)
a clearer way of saying the same thing.

Revision 1.174 / (download) - annotate - [select for diffs], Sun Nov 19 03:23:01 2017 UTC (6 years, 3 months ago) by kre
Branch: MAIN
Changes since 1.173: +38 -2 lines
Diff to previous 1.173 (colored)

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.

Revision 1.173 / (download) - annotate - [select for diffs], Wed Nov 15 08:50:07 2017 UTC (6 years, 3 months ago) by kre
Branch: MAIN
Changes since 1.172: +2 -2 lines
Diff to previous 1.172 (colored)


Correct a typo:  s/ at / an /

Revision 1.172 / (download) - annotate - [select for diffs], Mon Oct 30 15:37:41 2017 UTC (6 years, 4 months ago) by wiz
Branch: MAIN
Changes since 1.171: +9 -9 lines
Diff to previous 1.171 (colored)

Minor spellchecking changes.

Revision 1.171 / (download) - annotate - [select for diffs], Sun Oct 29 00:20:42 2017 UTC (6 years, 4 months ago) by kre
Branch: MAIN
Changes since 1.170: +2 -2 lines
Diff to previous 1.170 (colored)


Correct a markup typo (Sv -> Dv)

Revision 1.170 / (download) - annotate - [select for diffs], Sat Oct 28 06:36:17 2017 UTC (6 years, 4 months ago) by kre
Branch: MAIN
Changes since 1.169: +75 -8 lines
Diff to previous 1.169 (colored)

Add '-n' and '-p var' args to the wait command (-n: wait for any,
-p var: set var to identifier, from arg list, or PID if no job args)
of the job for which status is returned (becomes $? after wait.)

Note: var is unset if the status returned from wait came from wait
itself rather than from some job exiting (so it is now possible to
tell whether 127 means "no such job" or "job did exit(127)", and
whether $? > 128 means "wait was interrupted" or "job was killed
by a signal or did exit(>128)".   ($? is too limited to to allow
indicating whether the job died with a signal, or exited with a
status such that it looks like it did...)

Revision 1.146.2.5 / (download) - annotate - [select for diffs], Wed Oct 25 07:03:10 2017 UTC (6 years, 4 months ago) by snj
Branch: netbsd-8
CVS Tags: netbsd-8-0-RELEASE, netbsd-8-0-RC2, netbsd-8-0-RC1, matt-nb8-mediatek-base, matt-nb8-mediatek
Changes since 1.146.2.4: +2 -2 lines
Diff to previous 1.146.2.4 (colored) to branchpoint 1.146 (colored)

Pull up following revision(s) (requested by kre in ticket #323):
	bin/sh/sh.1: revision 1.168
Fix typo: s/one or mode/one or more/

Revision 1.146.2.4 / (download) - annotate - [select for diffs], Wed Oct 25 06:51:36 2017 UTC (6 years, 4 months ago) by snj
Branch: netbsd-8
Changes since 1.146.2.3: +17 -5 lines
Diff to previous 1.146.2.3 (colored) to branchpoint 1.146 (colored)

Pull up following revision(s) (requested by kre in ticket #310):
	bin/sh/expand.c: revision 1.121
	bin/sh/sh.1: revision 1.167 via patch
Three fixes and a change to ~ expansions
1. A serious bug introduced 3 1/2 months ago (approx) (rev 1.116) which
   broke all but the simple cases of ~ expansions is fixed (amazingly,
   given the magnitude of this problem, no-one noticed!)
2. An ancient bug (probably from when ~ expansion was first addedin 1994, and
   certainly is in NetBSD-6 vintage shells) where ${UnSeT:-~} (and similar)
   does not expand the ~ is fixed (note that ${UnSeT:-~/} does expand,
   this should give a clue to the cause of the problem.
3. A fix/change to make the effects of ~ expansions on ${UnSeT:=whatever}
   identical to those in UnSeT=whatever   In particular, with HOME=/foo
   ${UnSeT:=~:~} now assigns, and expands to, /foo:/foo rather than ~:~
   just as VAR=~:~ assigns /foo:/foo to VAR.   Note this is even after the
   previous fix (ie: appending a '/' would not change the results here.)
   It is hard to call this one a bug fix for certain (though I believe it is)
   as many other shells also produce different results for the ${V:=...}
   expansions than  they do for V=... (though not all the same as we did).
   POSIX is not clear about this, expanding ~ after : in VAR=whatever
   assignments is clear, whether ${U:=whatever} assignments should be
   treated the same way is not stated, one way or the other.
4. Change to make ':' terminate the user name in a ~ expansion in all cases,
   not only in assignments.   This makes sense, as ':' is one character that
   cannot occur in user names, no matter how otherwise weird they become.
   bash (incl in posix mode) ksh93 and bosh all act this way, whereas most
   other shells (and POSIX) do not.   Because this is clearly an extension
   to POSIX, do this one only when not in posix mode (not set -o posix).

Revision 1.169 / (download) - annotate - [select for diffs], Wed Oct 25 05:42:56 2017 UTC (6 years, 4 months ago) by kre
Branch: MAIN
Changes since 1.168: +229 -6 lines
Diff to previous 1.168 (colored)

Add options to the builtin jobid command to allow discovering the
process group (-g), the process leader pid (-p) ($! if the job was &'d)
and the job identifier (-j) (the %n that refers to the job) in addition to
(default) the list of all pids in the job (which it has always done).
No change to the (single) "job" arg, which is a specifier of the job:
the process leader pid, or one of the % forms, and defaults to %% (aka %+).
(This is all now documented in sh(1))

Also document the jobs command properly (no change to the command, just
document what it actually is.)

And while here, a whole new section in sh(1) "Job Control".  It probably
needs better wording, but this is (perhaps) better than the nothing that
was there before.

Revision 1.168 / (download) - annotate - [select for diffs], Sun Oct 15 12:01:43 2017 UTC (6 years, 4 months ago) by pgoyette
Branch: MAIN
Changes since 1.167: +2 -2 lines
Diff to previous 1.167 (colored)

Fix typo: s/one or mode/one or more/

Revision 1.167 / (download) - annotate - [select for diffs], Fri Oct 6 21:09:45 2017 UTC (6 years, 4 months ago) by kre
Branch: MAIN
Changes since 1.166: +17 -5 lines
Diff to previous 1.166 (colored)

Three fixes and a change to ~ expansions

1. A serious bug introduced 3 1/2 months ago (approx) (rev 1.116) which
   broke all but the simple cases of ~ expansions is fixed (amazingly,
   given the magnitude of this problem, no-one noticed!)

2. An ancient bug (probably from when ~ expansion was first addedin 1994, and
   certainly is in NetBSD-6 vintage shells) where ${UnSeT:-~} (and similar)
   does not expand the ~ is fixed (note that ${UnSeT:-~/} does expand,
   this should give a clue to the cause of the problem.

3. A fix/change to make the effects of ~ expansions on ${UnSeT:=whatever}
   identical to those in UnSeT=whatever   In particular, with HOME=/foo
   ${UnSeT:=~:~} now assigns, and expands to, /foo:/foo rather than ~:~
   just as VAR=~:~ assigns /foo:/foo to VAR.   Note this is even after the
   previous fix (ie: appending a '/' would not change the results here.)

   It is hard to call this one a bug fix for certain (though I believe it is)
   as many other shells also produce different results for the ${V:=...}
   expansions than  they do for V=... (though not all the same as we did).

   POSIX is not clear about this, expanding ~ after : in VAR=whatever
   assignments is clear, whether ${U:=whatever} assignments should be
   treated the same way is not stated, one way or the other.

4. Change to make ':' terminate the user name in a ~ expansion in all cases,
   not only in assignments.   This makes sense, as ':' is one character that
   cannot occur in user names, no matter how otherwise weird they become.
   bash (incl in posix mode) ksh93 and bosh all act this way, whereas most
   other shells (and POSIX) do not.   Because this is clearly an extension
   to POSIX, do this one only when not in posix mode (not set -o posix).

Revision 1.166 / (download) - annotate - [select for diffs], Sun Aug 27 20:37:59 2017 UTC (6 years, 6 months ago) by wiz
Branch: MAIN
Changes since 1.165: +6 -7 lines
Diff to previous 1.165 (colored)

Whitespace fixes. Fix a typo. Refer to emacs using Ic, since emacs(1)
does not exist in the base system.

Revision 1.165 / (download) - annotate - [select for diffs], Sun Aug 27 20:32:20 2017 UTC (6 years, 6 months ago) by wiz
Branch: MAIN
Changes since 1.164: +12 -31 lines
Diff to previous 1.164 (colored)

Remove unnecessary Tn macro.

Revision 1.164 / (download) - annotate - [select for diffs], Mon Aug 21 13:20:49 2017 UTC (6 years, 6 months ago) by kre
Branch: MAIN
Changes since 1.163: +195 -5 lines
Diff to previous 1.163 (colored)

Add support for $'...' quoting (based upon C "..." strings, with \ expansions.)

Implementation largely obtained from FreeBSD, with adaptations to meet the
needs and style of this sh, some updates to agree with the current POSIX spec,
and a few other minor changes.

The POSIX spec for this ( http://austingroupbugs.net/view.php?id=249 )
[see note 2809 for the current proposed text] is yet to be approved,
so might change.  It currently leaves several aspects as unspecified,
this implementation handles those as:

Where more than 2 hex digits follow \x this implementation processes the
first two as hex, the following characters are processed as if the \x
sequence was not present.  The value obtained from a \nnn octal sequence
is truncated to the low 8 bits (if a bigger value is written, eg: \456.)
Invalid escape sequences are errors.  Invalid \u (or \U) code points are
errors if known to be invalid, otherwise can generate a '?' character.
Where any escape sequence generates nul ('\0') that char, and the rest of
the $'...' string is discarded, but anything remaining in the word is
processed, ie: aaa$'bbb\0ccc'ddd produces the same as aaa'bbb'ddd.

Differences from FreeBSD:
  FreeBSD allows only exactly 4 or 8 hex digits for \u and \U (as does C,
  but the current sh proposal differs.) reeBSD also continues consuming
  as many hex digits as exist after \x (permitted by the spec, but insane),
  and reject \u0000 as invalid).  Some of this is possibly because that
  their implementation is based upon an earlier proposal, perhaps note 590 -
  though that has been updated several times.

Differences from the current POSIX proposal:
  We currently always generate UTF-8 for the \u & \U escapes.   We should
  generate the equivalent character from the current locale's character set
  (and UTF8 only if that is what the current locale uses.)
  If anyone would like to correct that, go ahead.

  We (and FreeBSD) generate (X & 0x1F) for \cX escapes where we should generate
  the appropriate control character (SOH for \cA for example) with whatever
  value that has in the current character set.   Apart from EBCDIC, which
  we do not support, I've never seen a case where they differ, so ...

Revision 1.163 / (download) - annotate - [select for diffs], Tue Jul 25 08:37:48 2017 UTC (6 years, 7 months ago) by wiz
Branch: MAIN
Changes since 1.162: +3 -3 lines
Diff to previous 1.162 (colored)

Remove trailing whitespace.

Revision 1.162 / (download) - annotate - [select for diffs], Mon Jul 24 14:17:11 2017 UTC (6 years, 7 months ago) by kre
Branch: MAIN
Changes since 1.161: +111 -52 lines
Diff to previous 1.161 (colored)

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.

Revision 1.161 / (download) - annotate - [select for diffs], Mon Jul 24 13:21:14 2017 UTC (6 years, 7 months ago) by kre
Branch: MAIN
Changes since 1.160: +19 -8 lines
Diff to previous 1.160 (colored)

Add support for ++ and -- (pre & post) and ',' to arithmetic.

Revision 1.160 / (download) - annotate - [select for diffs], Mon Jul 24 12:36:02 2017 UTC (6 years, 7 months ago) by kre
Branch: MAIN
Changes since 1.159: +25 -7 lines
Diff to previous 1.159 (colored)

Document the times builtin command, reported as lost in space
by rudolf at eq.cz on tech-userlevel (July 15, 2017.)

Also correct a typo, de-correct some entirely proper English so
the doc remains written in American instead.  And note that
interactive mode is set when stdin & stderr are terminals, not
stding and stdout.

Revision 1.146.2.3 / (download) - annotate - [select for diffs], Sun Jul 23 14:58:14 2017 UTC (6 years, 7 months ago) by snj
Branch: netbsd-8
Changes since 1.146.2.2: +620 -104 lines
Diff to previous 1.146.2.2 (colored) to branchpoint 1.146 (colored)

Pull up following revision(s) (requested by kre in ticket #103):
	bin/kill/kill.c: 1.28
	bin/sh/Makefile: 1.111-1.113
	bin/sh/arith_token.c: 1.5
	bin/sh/arith_tokens.h: 1.2
	bin/sh/arithmetic.c: 1.3
	bin/sh/arithmetic.h: 1.2
	bin/sh/bltin/bltin.h: 1.15
	bin/sh/cd.c: 1.49-1.50
	bin/sh/error.c: 1.40
	bin/sh/eval.c: 1.142-1.151
	bin/sh/exec.c: 1.49-1.51
	bin/sh/exec.h: 1.26
	bin/sh/expand.c: 1.113-1.119
	bin/sh/expand.h: 1.23
	bin/sh/histedit.c: 1.49-1.52
	bin/sh/input.c: 1.57-1.60
	bin/sh/input.h: 1.19-1.20
	bin/sh/jobs.c: 1.86-1.87
	bin/sh/main.c: 1.71-1.72
	bin/sh/memalloc.c: 1.30
	bin/sh/memalloc.h: 1.17
	bin/sh/mknodenames.sh: 1.4
	bin/sh/mkoptions.sh: 1.3-1.4
	bin/sh/myhistedit.h: 1.12-1.13
	bin/sh/nodetypes: 1.16-1.18
	bin/sh/option.list: 1.3-1.5
	bin/sh/parser.c: 1.133-1.141
	bin/sh/parser.h: 1.22-1.23
	bin/sh/redir.c: 1.58
	bin/sh/redir.h: 1.24
	bin/sh/sh.1: 1.149-1.159
	bin/sh/shell.h: 1.24
	bin/sh/show.c: 1.43-1.47
	bin/sh/show.h: 1.11
	bin/sh/syntax.c: 1.4
	bin/sh/syntax.h: 1.8
	bin/sh/trap.c: 1.41
	bin/sh/var.c: 1.56-1.65
	bin/sh/var.h: 1.29-1.35
An initial attempt at implementing LINENO to meet the specs.
Aside from one problem (not too hard to fix if it was ever needed) this version
does about as well as most other shell implementations when expanding
$((LINENO)) and better for ${LINENO} as it retains the "LINENO hack" for the
latter, and that is very accurate.
Unfortunately that means that ${LINENO} and $((LINENO)) do not always produce
the same value when used on the same line (a defect that other shells do not
share - aside from the FreeBSD sh as it is today, where only the LINENO hack
exists and so (like for us before this commit) $((LINENO)) is always either
0, or at least whatever value was last set, perhaps by
	LINENO=${LINENO}
which does actually work ... for that one line...)
This could be corrected by simply removing the LINENO hack (look for the string
LINENO in parser.c) in which case ${LINENO} and $((LINENO)) would give the
same (not perfectly accurate) values, as do most other shells.
POSIX requires that LINENO be set before each command, and this implementation
does that fairly literally - except that we only bother before the commands
which actually expand words (for, case and simple commands).   Unfortunately
this forgot that expansions also occur in redirects, and the other compound
commands can also have redirects, so if a redirect on one of the other compound
commands wants to use the value of $((LINENO)) as a part of a generated file
name, then it will get an incorrect value.  This is the "one problem" above.
(Because the LINENO hack is still enabled, using ${LINENO} works.)
This could be fixed, but as this version of the LINENO implementation is just
for reference purposes (it will be superseded within minutes by a better one)
I won't bother.  However should anyone else decide that this is a better choice
(it is probably a smaller implementation, in terms of code & data space then
the replacement, but also I would expect, slower, and definitely less accurate)
this defect is something to bear in mind, and fix.
This version retains the *BSD historical practice that line numbers in functions
(all functions) count from 1 from the start of the function, and elsewhere,
start from 1 from where the shell started reading the input file/stream in
question.  In an "eval" expression the line number starts at the line of the
"eval" (and then increases if the input is a multi-line string).
Note: this version is not documented (beyond as much as LINENO was before)
hence this slightly longer than usual commit message.
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.
Unbreak (at least) i386 build .... I have no idea why this built for me on
amd64 (problem was missing prototype for snprintf witout <stdio.h>)
While here, add some (DEBUG mode only) tracing that proved useful in
solving another problem.
Set the line number before expanding args, not after.   As the line_number
would have usually been set earlier, this change is mostly an effective
no-op, but it is better this way (just in case) - not observed to have
caused any problems.
Undo some over agressive fixes for a (pre-commit) bug that did not
need these changes to be fixed - and these cause problems in another
absurd use case.   Either of these issues is unlikely to be seen by
anyone who isn't an idiot masochist...
PR bin/52280
removescapes_nl in expari() even when not quoted,
CRTNONL's appear regardless of quoting (unlike CTLESC).
New sentence, new line. Whitespace.
Improve the (new) LINENO section, markup changes (with thanks to wiz@ for
assistace) and some better wording in a few placed.
I am an idiot...  revert the previous unintended commit.
Remove some left over baggage from the LINENO v1 implementation that
didn't get removed with v2, and should have.   This would have had
(I think, without having tested it) one very minor effect on the way
LINENO worked in the v2 implementation, but my guess is it would have
taken a long time before anyone noticed...
Correct spelling in comments of DEBUG only code...
(Perhaps) temporary fix to pkgtools (cwrappers) build (configure).
Expanding  `` containing \ \n sequences looks to have been giving
problems.   I don't think this is the correct fix, but it will do
no worse harm than (perhaps) incorrectly calculating LINENO in this
kind of (rare) circumstance.   I'll look and see if there should be
a better fix later.
s/volatile/const/ -- wonderful how opposites attract like this.
NFC (normal use) - DEBUG only change, when showing empty arg list don't
omit terminating \n.
Free stack memory in a couple of obscure cases where it wasn't
being done (one in probably dead code that is never compiled, the other
in a very rare error case.)   Since it is stack memory it wasn't lost
in any case, just held longer than needed.
Many internal memory management type fixes.
PR bin/52302   (core dump with interactive shell, here doc and error
on same line) is fixed.   (An old bug.)
echo "$( echo x; for a in $( seq 1000 ); do printf '%s\n'; done; echo y )"
consistently prints 1002 lines (x, 1000 empty ones, then y) as it should
(And you don't want to know what it did before, or why.) (Another old one.)
(Recently added) Problems with ~ expansion fixed (mem management related).
Proper fix for the cwrappers configure problem (which includes the quick
fix that was done earlier, but extends upon that to be correct). (This was
another newly added problem.)
And the really devious (and rare) old bug - if STACKSTRNUL() needs to
allocate a new buffer in which to store the \0, calculate the size of
the string space remaining correctly, unlike when SPUTC() grows the
buffer, there is no actual data being stored in the STACKSTRNUL()
case - the string space remaining was calculated as one byte too few.
That would be harmless, unless the next buffer also filled, in which
case it was assumed that it was really full, not one byte less, meaning
one junk char (a nul, or anything) was being copied into the next (even
bigger buffer) corrupting the data.
Consistent use of stalloc() to allocate a new block of (stack) memory,
and grabstackstr() to claim a block of (stack) memory that had already
been occupied but not claimed as in use.  Since grabstackstr is implemented
as just a call to stalloc() this is a no-op change in practice, but makes
it much easier to comprehend what is really happening.  Previous code
sometimes used stalloc() when the use case was really for grabstackstr().
Change grabstackstr() to actually use the arg passed to it, instead of
(not much better than) guessing how much space to claim,
More care when using unstalloc()/ungrabstackstr() to return space, and in
particular when the stack must be returned to its previous state, rather than
just returning no-longer needed space, neither of those work.  They also don't
work properly if there have been (really, even might have been) any stack mem
allocations since the last stalloc()/grabstackstr().   (If we know there
cannot have been then the alloc/release sequence is kind of pointless.)
To work correctly in general we must use setstackmark()/popstackmark() so
do that when needed.  Have those also save/restore the top of stack string
space remaining.
	[Aside: for those reading this, the "stack" mentioned is not
	in any way related to the thing used for maintaining the C
	function call state, ie: the "stack segment" of the program,
	but the shell's internal memory management strategy.]
More comments to better explain what is happening in some cases.
Also cleaned up some hopelessly broken DEBUG mode data that were
recently added (no effect on anyone but the poor semi-human attempting
to make sense of it...).
User visible changes:
Proper counting of line numbers when a here document is delimited
by a multi-line end-delimiter, as in
	cat << 'REALLY
	END'
	here doc line 1
	here doc line 2
	REALLY
	END
(which is an obscure case, but nothing says should not work.)  The \n
in the end-delimiter of the here doc (the last one) was not incrementing
the line number, which from that point on in the script would be 1 too
low (or more, for end-delimiters with more than one \n in them.)
With tilde expansion:
	unset HOME; echo ~
changed to return getpwuid(getuid())->pw_home instead of failing (returning ~)
POSIX says this is unspecified, which makes it difficult for a script to
compensate for being run without HOME set (as in env -i sh script), so
while not able to be used portably, this seems like a useful extension
(and is implemented the same way by some other shells).
Further, with
	HOME=; printf %s ~
we now write nothing (which is required by POSIX - which requires ~ to
expand to the value of $HOME if it is set) previously if $HOME (in this
case) or a user's directory in the passwd file (for ~user) were a null
STRING, We failed the ~ expansion and left behind '~' or '~user'.
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!)
Cosmetic changes to variable flags - make their values more suited
to my delicate sensibilities...  (NFC).
Arrange not to barf (ever) if some turkey makes _ readonly.  Do this
by adding a VNOERROR flag that causes errors in var setting to be
ignored (intended use is only for internal shell var setting, like of "_").
(nb: invalid var name errors ignore this flag, but those should never
occur on a var set by the shell itself.)
From FreeBSD: don't simply discard memory if a variable is not set for
any reason (including because it is readonly) if the var's value had
been malloc'd.  Free it instead...
NFC - DEBUG changes, update this to new TRACE method.
KNF - white space and comment formatting.
NFC - DEBUG mode only change - convert this to the new TRACE() format.
NFC - DEBUG mode only change - complete a change made earlier (marking
the line number when included in the trace line tag to show whether it
comes from the parser, or the elsewhere as they tend to be quite different).
Initially only one case was changed, while I pondered whether I liked it
or not.  Now it is all done...   Also when there is a line tag at all,
always include the root/sub-shell indicator character, not only when the
pid is included.
NFC: DEBUG related comment change - catch up with reality.
NFC: DEBUG mode only change.  Fix botched cleanup of one TRACE().
"b" more forgiving when sorting options to allow reasonable (and intended)
flexibility in option.list format.   Changes nothing for current option.list.
Now that excessive use of STACKSTRNUL has served its purpose (well, accidental
purpose) in exposing the bug in its implementation, go back to not using
it when not needed for DEBUG TRACE purposes.   This change should have no
practical effect on either a DEBUG shell (where the STACKSTRNUL() calls
remain) or a non DEBUG shell where they are not needed.
Correct the initial line number used for processing -c arg strings.
(It was inheriting the value from end of profile file processing) - I didn't
notice before as I usually test with empty or no profile files to avoid
complications.   Trivial change which should have very limited impact.
Fix from FreeBSD (applied there in July 2008...)
Don't dump core with input like sh -c 'x=; echo >&$x' - that is where
the word after a >& or <& redirect expands to nothing at all.
Another fix from FreeBSD (this one from April 2009).
When processing a string (as in eval, trap, or sh -c) don't allow
trailing \n's to destroy the exit status of the last command executed.
That is:
	sh -c 'false
	'
	echo $?
should produce 1, not 0.
It is amazing what nonsense appears to work sometimes... (all my nonsense too!)
Two bugs here, one benign because of the way the script is used.
The other hidden by NetBSD's sort being stable, and the data not really
requiring sorting at all...
So as it happens these fixes change nothing, but they are needed anyway.
(The contents of the generated file are only used in DEBUG shells, so
this is really even less important than it seems.)
Another ancient (highly improbable) bug bites the dust.   This one
caused by incorrect macro usage (ie: using the wrong one) which has
been in the sources since version 1.1 (ie: forever).
Like the previous (STACKSTRNUL) bug, the probability of this one
actually occurring has been infinitesimal but the LINENO code increases
that to infinitesimal and a smidgen... (or a few, depending upon usage).
Still, apparently that was enough, Kamil Rytarowski discovered that the
zsh configure script (damn competition!) managed to trigger this problem.
source .editrc after we initialize so that commands persist!
Make arg parsing in kill POSIX compatible with POSIX (XBD 2.12) by
parsing the way getopt(3) would, if only it could handle the (required)
-signumber and -signame options.  This adds two "features" to kill,
-ssigname and -lstatus now work (ie: one word with all of the '-', the
option letter, and its value) and "--" also now works (kill -- -pid1 pid2
will not attempt to send the pid1 signal to pid2, but rather SIGTERM
to the pid1 process group and pid2).  It is still the case that (apart
from --) at most 1 option is permitted (-l, -s, -signame, or -signumber.)
Note that we now have an ambiguity, -sname might mean "-s name" or
send the signal "sname" - if one of those turns out to be valid, that
will be accepted, otherwise the error message will indicate that "sname"
is not a valid signal name, not that "name" is not.   Keeping the "-s"
and signal name as separate words avoids this issue.
Also caution: should someone be weird enough to define a new signal
name (as in the part after SIG) which is almost the same name as an
existing name that starts with 'S' by adding an extra 'S' prepended
(eg: adding a SIGSSYS) then the ambiguity problem becomes much worse.
In that case "kill -ssys" will be resolved in favour of the "-s"
flag being used (the more modern syntax) and would send a SIGSYS, rather
that a SIGSSYS.    So don't do that.
While here, switch to using signalname(3) (bye bye NSIG, et. al.), add
some constipation, and show a little pride in formatting the signal names
for "kill -l" (and in the usage when appropriate -- same routine.)   Respect
COLUMNS (POSIX XBD 8.3) as primary specification of the width (terminal width,
not number of columns to print) for kill -l, a very small value for COLUMNS
will cause kill -l output to list signals one per line, a very large
value will cause them all to be listed on one line.) (eg: "COLUMNS=1 kill -l")
TODO: the signal printing for "trap -l" and that for "kill -l"
should be switched to use a common routine (for the sh builtin versions.)
All changes of relevance here are to bin/kill - the (minor) changes to bin/sh
are only to properly expose the builtin version of getenv(3) so the builtin
version of kill can use it (ie: make its prototype available.)
Properly support EDITRC - use it as (naming) the file when setting
up libedit, and re-do the config whenever EDITRC is set.
Get rid of workarounds for ancient groff html backend.
Simplify macro usage.
Make one example more like a real world possibility (it still isn't, but
is closer) - though the actual content is irrelevant to the point being made.
Add literal prompt support this allows one to do:
CA="$(printf '\1')"
PS1="${CA}$(tput bold)${CA}\$${CA}$(tput sgr0)${CA} "
Now libedit supports embedded mode switch sequence, improve sh
support for them (adds PSlit variable to set the magic character).
NFC: DEBUG only change - provide an externally visible (to the DEBUG sh
internals) interface to one of the internal (private to trace code) functions
Include redirections in trace output from "set -x"
Implement PS1, PS2 and PS4 expansions (variable expansions, arithmetic
expansions, and if enabled by the promptcmds option, command substitutions.)
Implement a bunch of new shell environment variables. many mostly useful
in prompts when expanded at prompt time, but all available for general use.
Many of the new ones are not available in SMALL shells (they work as normal
if assigned, but the shell does not set or use them - and there is no magic
in a SMALL shell (usually for install media.))
Omnibus manual update for prompt expansions and new variables.  Throw in
some random cleanups as a bonus.
Correct a markup typo (why did I not see this before the prev commit??)
Sort options (our default is 0..9AaBbZz).
Fix markup problems and a typo.
Make $- list flags in the same order they appear in sh(1)
Do a better job of detecting the error in pkgsrc/devel/libbson-1.6.3's
configure script, ie: $(( which is intended to be a sub-shell in a
command substitution, but is an arith subst instead, it needs to be
written $( ( to do as intended.   Instead of just blindly carrying on to
find the missing )) somewhere, anywhere, give up as soon as we have seen
an unbalanced ')' that isn't immediately followed by another ')' which
in a valid arith subst it always would be.
While here, there has been a comment in the code for quite a while noting a
difference in the standard between the text descr & grammar when it comes to
the syntax of case statements.   Add more comments to explain why parsing it
as we do is in fact definitely the correct way (ie: the grammar wins arguments
like this...).
DEBUG and white space changes only.   Convert TRACE() calls for DEBUg mode
to the new style.   NFC (when not debugging sh).
Mostly DEBUG and white space changes.   Convert DEEBUG TRACE() calls to
the new format.   Also #if 0 a function definition that is used nowhere.
While here, change the function of pushfile() slightly - it now sets
the buf pointer in the top (new) input descriptor to NULL, instead of
simply leaving it - code that needs a buffer always (before and after)
must malloc() one and assign it after the call.  But code which does not
(which will be reading from a string or similar) now does not have to
explicitly set it to NULL (cleaner interface.)   NFC intended (or observed.)
DEBUG changes: convert DEBUG TRACE() calls to new format.
ALso, cause exec failures to always cause the shell to exit with
status 126 or 127, whatever the cause.  127 is intended for lookup
failures (and is used that way), 126 is used for anything else that
goes wrong (as in several other shells.)  We no longer use 2 (more easily
confused with an exit status of the command exec'd) for shell exec failures.
DEBUG only changes.  Convert the TRACE() calls in the remaining files
that still used it to the new format.   NFC.
Fix a reference after free (and consequent nonsense diagnostic for
attempts to set readonly variables) I added in 1.60 by incompletely
copying the FreeBSD fix for the lost memory issue.

Revision 1.159 / (download) - annotate - [select for diffs], Sat Jul 1 05:11:57 2017 UTC (6 years, 8 months ago) by wiz
Branch: MAIN
CVS Tags: perseant-stdc-iso10646-base, perseant-stdc-iso10646
Changes since 1.158: +31 -30 lines
Diff to previous 1.158 (colored)

Sort options (our default is 0..9AaBbZz).
Fix markup problems and a typo.

Revision 1.158 / (download) - annotate - [select for diffs], Fri Jun 30 23:48:50 2017 UTC (6 years, 8 months ago) by kre
Branch: MAIN
Changes since 1.157: +2 -2 lines
Diff to previous 1.157 (colored)


Correct a markup typo (why did I not see this before the prev commit??)

Revision 1.157 / (download) - annotate - [select for diffs], Fri Jun 30 23:07:29 2017 UTC (6 years, 8 months ago) by kre
Branch: MAIN
Changes since 1.156: +230 -40 lines
Diff to previous 1.156 (colored)


Omnibus manual update for prompt expansions and new variables.  Throw in
some random cleanups as a bonus.

Revision 1.156 / (download) - annotate - [select for diffs], Wed Jun 28 13:46:06 2017 UTC (6 years, 8 months ago) by kre
Branch: MAIN
Changes since 1.155: +119 -3 lines
Diff to previous 1.155 (colored)


Now libedit supports embedded mode switch sequence, improve sh
support for them (adds PSlit variable to set the magic character).

Revision 1.155 / (download) - annotate - [select for diffs], Tue Jun 27 12:43:44 2017 UTC (6 years, 8 months ago) by kre
Branch: MAIN
Changes since 1.154: +2 -2 lines
Diff to previous 1.154 (colored)


Make one example more like a real world possibility (it still isn't, but
is closer) - though the actual content is irrelevant to the point being made.

Revision 1.154 / (download) - annotate - [select for diffs], Tue Jun 27 08:30:40 2017 UTC (6 years, 8 months ago) by wiz
Branch: MAIN
Changes since 1.153: +33 -33 lines
Diff to previous 1.153 (colored)

Get rid of workarounds for ancient groff html backend.
Simplify macro usage.

Revision 1.153 / (download) - annotate - [select for diffs], Tue Jun 27 02:22:08 2017 UTC (6 years, 8 months ago) by kre
Branch: MAIN
Changes since 1.152: +35 -1 lines
Diff to previous 1.152 (colored)


Properly support EDITRC - use it as (naming) the file when setting
up libedit, and re-do the config whenever EDITRC is set.

Revision 1.152 / (download) - annotate - [select for diffs], Sat Jun 17 07:50:35 2017 UTC (6 years, 8 months ago) by kre
Branch: MAIN
Changes since 1.151: +15 -6 lines
Diff to previous 1.151 (colored)

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!)

Revision 1.146.2.2 / (download) - annotate - [select for diffs], Fri Jun 9 16:53:39 2017 UTC (6 years, 8 months ago) by snj
Branch: netbsd-8
Changes since 1.146.2.1: +2 -2 lines
Diff to previous 1.146.2.1 (colored) to branchpoint 1.146 (colored)

Pull up following revision(s) (requested by kre in ticket #15):
	bin/sh/sh.1: revision 1.148
Fix a typo (or rather a remnant of an earlier intent).

Revision 1.151 / (download) - annotate - [select for diffs], Thu Jun 8 02:23:51 2017 UTC (6 years, 8 months ago) by kre
Branch: MAIN
Changes since 1.150: +18 -11 lines
Diff to previous 1.150 (colored)


Improve the (new) LINENO section, markup changes (with thanks to wiz@ for
assistace) and some better wording in a few placed.

Revision 1.150 / (download) - annotate - [select for diffs], Wed Jun 7 13:49:48 2017 UTC (6 years, 8 months ago) by wiz
Branch: MAIN
Changes since 1.149: +4 -3 lines
Diff to previous 1.149 (colored)

New sentence, new line. Whitespace.

Revision 1.149 / (download) - annotate - [select for diffs], Wed Jun 7 05:08:32 2017 UTC (6 years, 8 months ago) by kre
Branch: MAIN
Changes since 1.148: +174 -16 lines
Diff to previous 1.148 (colored)

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.

Revision 1.148 / (download) - annotate - [select for diffs], Tue Jun 6 22:38:52 2017 UTC (6 years, 8 months ago) by kre
Branch: MAIN
Changes since 1.147: +2 -2 lines
Diff to previous 1.147 (colored)


Fix a typo (or rather a remnant of an earlier intent).

Revision 1.146.2.1 / (download) - annotate - [select for diffs], Mon Jun 5 08:10:24 2017 UTC (6 years, 8 months ago) by snj
Branch: netbsd-8
Changes since 1.146: +16 -8 lines
Diff to previous 1.146 (colored)

Pull up following revision(s) (requested by kre in ticket #5):
	bin/sh/cd.c: revision 1.48
	bin/sh/eval.c: revision 1.141
	bin/sh/exec.c: revision 1.48
	bin/sh/exec.h: revision 1.25
	bin/sh/mail.c: revisions 1.17, 1.18
	bin/sh/sh.1: revision 1.147
Make cd (really) do cd -P, and not just claim that is what it is doing
while doing a half-hearted, broken, partial, version of cd -L instead.
The latter (as the manual says) is not supported, what's more, it is an
abomination, and should never be supported (anywhere.)
Fix the doc so that the pretense that we notice when a path given crosses
a symlink (and turns on printing of the destination directory) is claimed
no more (that used to be true until late Dec 2016, but was changed).  Now
the print happens if -o cdprint is set, or if an entry from CDPATH that is
not "" or "." is used (or if the "cd dest repl" cd cmd variant is used.)
Fix CDPATH processing: avoid the magic '%' processing that is used for
PATH and MAILPATH from corrupting CDPATH.  The % magic (both variants)
remains undocumented.
Also, don't double the '/' if an entry in PATH or CDPATH ends in '/'
(as in CDPATH=":/usr/src/").  A "cd usr.bin" used to do
chdir("/usr/src//usr.bin").  No more.  This is almost invisible,
and relatively harmless, either way....
Also fix a bug where if a plausible destination directory in CDPATH
was located, but the chdir() failed (eg: permission denied) and then
a later "." or "" CDPATH entry succeeded, "print" mode was turned on.
That is:
	cd /tmp; mkdir bin
	mkdir -p P/bin; chmod 0 P/bin
	CDPATH=/tmp/P:
	cd bin
would cd to /tmp/bin (correctly) but print it (incorrectly).
Also when in "cd dest replace" mode, if the result of the replacement
generates '-' as the path named, as in:
	cd $PWD -
then simply change to '-' (or attempt to, with CDPATH search), rather
than having this being equivalent to "cd -")
Because of these changes, the pwd command (and $PWD) essentially
always acts as pwd -P, even when called as pwd -L (which is still
the default.)   That is, even more than it did before.
Also fixed a (kind of minor) mem management error (CDPATH related)
"whosoever shall padvance must stunalloc before repeating" (and the
same for MAILPATH).
--
If we are going to keep the MAILPATH % hack, then at least do something
rational.  Since it isn't documented, what "rational" is is up for
discussion, but what it did before was not it (it was nonsense...).

Revision 1.147 / (download) - annotate - [select for diffs], Sun Jun 4 20:27:14 2017 UTC (6 years, 8 months ago) by kre
Branch: MAIN
Changes since 1.146: +16 -8 lines
Diff to previous 1.146 (colored)

Make cd (really) do cd -P, and not just claim that is what it is doing
while doing a half-hearted, broken, partial, version of cd -L instead.
The latter (as the manual says) is not supported, what's more, it is an
abomination, and should never be supported (anywhere.)

Fix the doc so that the pretense that we notice when a path given crosses
a symlink (and turns on printing of the destination directory) is claimed
no more (that used to be true until late Dec 2016, but was changed).  Now
the print happens if -o cdprint is set, or if an entry from CDPATH that is
not "" or "." is used (or if the "cd dest repl" cd cmd variant is used.)

Fix CDPATH processing: avoid the magic '%' processing that is used for
PATH and MAILPATH from corrupting CDPATH.  The % magic (both variants)
remains undocumented.

Also, don't double the '/' if an entry in PATH or CDPATH ends in '/'
(as in CDPATH=":/usr/src/").  A "cd usr.bin" used to do
chdir("/usr/src//usr.bin").  No more.  This is almost invisible,
and relatively harmless, either way....

Also fix a bug where if a plausible destination directory in CDPATH
was located, but the chdir() failed (eg: permission denied) and then
a later "." or "" CDPATH entry succeeded, "print" mode was turned on.
That is:
	cd /tmp; mkdir bin
	mkdir -p P/bin; chmod 0 P/bin
	CDPATH=/tmp/P:
	cd bin
would cd to /tmp/bin (correctly) but print it (incorrectly).

Also when in "cd dest replace" mode, if the result of the replacement
generates '-' as the path named, as in:
	cd $PWD -
then simply change to '-' (or attempt to, with CDPATH search), rather
than having this being equivalent to "cd -")

Because of these changes, the pwd command (and $PWD) essentially
always acts as pwd -P, even when called as pwd -L (which is still
the default.)   That is, even more than it did before.

Also fixed a (kind of minor) mem management error (CDPATH related)
"whosoever shall padvance must stunalloc before repeating" (and the
same for MAILPATH).

Revision 1.146 / (download) - annotate - [select for diffs], Fri Jun 2 17:42:51 2017 UTC (6 years, 8 months ago) by abhinav
Branch: MAIN
CVS Tags: netbsd-8-base
Branch point for: netbsd-8
Changes since 1.145: +2 -2 lines
Diff to previous 1.145 (colored)

Fix typo

Revision 1.145 / (download) - annotate - [select for diffs], Sat May 27 11:19:57 2017 UTC (6 years, 9 months ago) by kre
Branch: MAIN
Changes since 1.144: +10 -5 lines
Diff to previous 1.144 (colored)

More standard (and saner) implementation of the ! reserved word.
Unless the shell is compiled with the (compilation time) option
BOGUS_NOT_COMMAND (as in CFLAGS+=-DBOGUS_NOT_COMMAND) which it
will not normally be, the ! command (reserved word) will only
be permitted at the start of a pipeline (which includes the
degenerate pipeline with no '|'s in it of course - ie: a simple cmd)
and not in the middle of a pipeline sequence (no "cmd | ! cmd" nonsense.)
If the latter is really required, then "cmd | { ! cmd; }" works as
a standard equivalent.

In POSIX mode, permit only one !  ("! pipeline" is ok. "! ! pipeline" is not).
Again, if needed (and POSIX conformance is wanted) "! { ! pipeline; }"
works as an alternative - and is safer, some shells treat "! ! cmd" as
being identical to "cmd" (this one did until recently.)

Revision 1.144 / (download) - annotate - [select for diffs], Sat May 27 06:32:12 2017 UTC (6 years, 9 months ago) by kre
Branch: MAIN
Changes since 1.143: +181 -82 lines
Diff to previous 1.143 (colored)


It turns out that most shells do not do variable value/attribute
inheritance when a variable is declared local, but instead leave
the local var unset (if not given a value) in the function.
Only ash derived shells do inheritance it seems.

So, to compensate for that, and get one step closer to making
"local" part of POSIX, so we can really rely upon it, a compromise
has been suggested, where "local x" is implementation defined
when it comes to this issue, and we add "local -I x" to specify
inheritance, and "local -N x" to specify "not" (something...)
(not inherited, or not set, or whatever you prefer to imagine!)
The option names took a lot of hunting to find something reasonable
that no shell (we know of) had already used for some other purpose...
The I was easy, but 'u' 'U' 'X' ... all in use somewhere.

This implements that (well, semi-) agreement.

While here, add "local -x" (which many other shells already have)
which causes the local variable to be made exported.  Not a lot
of gain in that (since "export x" can always be done immediately
after "local x") but it is very cheap to add and allows more other
scripts to work with out shell.

Note that while 'local x="${x}"' always works to specify inheritance
(while making the shell work harder), "local x; unset x" does not
always work to specify the alternative, as some shells have
"re-interpreted" unset of a local variable to mean something that
would best be described as "unlocal" instead - ie: after the unset
you might be back with the variable from the outer scope, rather
than with an unset local variable.

Also add "unset -x" to allow unsetting a variable without removing
any exported status it has.

There are gazillions of other options that are not supported here!

Revision 1.131.2.3 / (download) - annotate - [select for diffs], Fri May 19 00:22:51 2017 UTC (6 years, 9 months ago) by pgoyette
Branch: prg-localcount2
Changes since 1.131.2.2: +490 -216 lines
Diff to previous 1.131.2.2 (colored) to branchpoint 1.131 (colored) next main 1.132 (colored)

Resolve conflicts from previous merge (all resulting from $NetBSD
keywork expansion)

Revision 1.143 / (download) - annotate - [select for diffs], Thu May 18 13:56:58 2017 UTC (6 years, 9 months ago) by kre
Branch: MAIN
CVS Tags: prg-localcount2-base3
Changes since 1.142: +18 -4 lines
Diff to previous 1.142 (colored)


Allow abbreviations of option names for the "fdflags -s" command.
While documenting that, cleanup markup of the fdflags section of the
man page.

Revision 1.142 / (download) - annotate - [select for diffs], Thu May 18 13:53:18 2017 UTC (6 years, 9 months ago) by kre
Branch: MAIN
Changes since 1.141: +28 -21 lines
Diff to previous 1.141 (colored)


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 1.141 / (download) - annotate - [select for diffs], Sun May 14 17:27:05 2017 UTC (6 years, 9 months ago) by kre
Branch: MAIN
Changes since 1.140: +18 -5 lines
Diff to previous 1.140 (colored)


When opening a file descritor with "exec n>/file" (and similar) only
set the close-on-exec bit when not in posix mode (to comply with posix...)
OK: christos@

Revision 1.140 / (download) - annotate - [select for diffs], Sun May 14 14:14:39 2017 UTC (6 years, 9 months ago) by kre
Branch: MAIN
Changes since 1.139: +25 -17 lines
Diff to previous 1.139 (colored)


Add mention of ;& in the list of control operators (forgotten before).
Document the (slightly) enhanced NETBSD_SHELL.
Fix a typo (one of my typos...)
Move a commented out section to align with current planned changes
(and fix its commented out markup.)

Revision 1.139 / (download) - annotate - [select for diffs], Sun May 14 10:53:26 2017 UTC (6 years, 9 months ago) by wiz
Branch: MAIN
Changes since 1.138: +104 -57 lines
Diff to previous 1.138 (colored)

Use more, or more appropriate, markup.

Revision 1.138 / (download) - annotate - [select for diffs], Fri May 12 08:55:38 2017 UTC (6 years, 9 months ago) by kre
Branch: MAIN
Changes since 1.137: +55 -7 lines
Diff to previous 1.137 (colored)


Improve the description of option processing (including the shell's
arg list processing), and the set command in general.
Also add some (new) commented out text related to options which may
be commented back in sometime soon...

Revision 1.137 / (download) - annotate - [select for diffs], Fri May 12 08:39:47 2017 UTC (6 years, 9 months ago) by kre
Branch: MAIN
Changes since 1.136: +301 -164 lines
Diff to previous 1.136 (colored)


Corrected some typos, added some (hopefully improving) extra text,
sorted stuff that needed sorting, and added some (probably incorrect)
markup...

Revision 1.131.2.2 / (download) - annotate - [select for diffs], Thu May 11 02:58:28 2017 UTC (6 years, 9 months ago) by pgoyette
Branch: prg-localcount2
Changes since 1.131.2.1: +99 -20 lines
Diff to previous 1.131.2.1 (colored) to branchpoint 1.131 (colored)

Sync with HEAD

Revision 1.136 / (download) - annotate - [select for diffs], Sun May 7 15:01:18 2017 UTC (6 years, 9 months ago) by kre
Branch: MAIN
CVS Tags: prg-localcount2-base2
Changes since 1.135: +65 -11 lines
Diff to previous 1.135 (colored)


Enhance the trap command to make it possible to do what POSIX wants
(even if no shell in existence, that I am aware of, does that).

That is, POSIX says ... [of the trap command with no args]

	The shell shall format the output, including the proper use of
	quoting, so that it is suitable for re-input to the shell as commands
	that achieve the same trapping results. For example:

	save_traps=$(trap)

	...

	eval "$save_traps"

It is obvious what the intent is there.  But no shell makes it work.

An example using bash (as the NetBSD shell, still does not do the save_traps=
stuff correctly - but that is a problem for a different time and place...)

Given this script

	printf 'At start: '; trap
	printf '\n'

	traps=$(trap)
	trap 'echo hello' INT
	printf 'inside  : '; trap
	printf '\n'
	eval "${traps}"

	printf 'At end  : '; trap
	printf '\n'

One would expect that (assuming no traps are set at the start, and
there aren't) that the first trap will print nothing, then the inside
trap will show the trap that was set, and then when we get to the
end everything will be back to nothing again.

But:

At start:
inside  : trap -- 'echo hello' SIGINT

At end  : trap -- 'echo hello' SIGINT

And of course. when you think about it, it is obvious why this happens.
The first "trap" command prints nothing ... nothing has changed when we
get to the "traps=$(trap)" command ... that trap command also prints
nothing.  So this does traps=''.  When we do eval "${traps}" we are
doing eval "", and it is hardly surprising that this accomplishes nothing!

Now we cannot rationally change the "trap" command without args to
behave in a way that would make it useful for the posix purpose (and
here, what they're aiming for is good, it should be possible to
accomplish that objective) so is there some other way?

I think I have seen some shell (but I do not remember which one) that
actually has "trap -" that resets all traps to the default, so with that,
if we changed the 'eval "${traps}"' line to 'trap -; eval "${traps}"'
then things would actually work - kind of - that version has race conditions,
so is not really safe to use (it will work, most of the time...)

But, both ksh93 and bash have a -p arg to "trap" that allows information
about the current trap status of named signals to be reported.  Unfortunately
they don't do quite the same thing, but that's not important right now,
either would be usable, and they are, but it is a lot of effort, not
nearly as simple as the posix example.

First, while "trap -p" (with no signals specified) works, it works just
the same (in both bash and ksh93, aside from output format) as "trap".
That is, that is useless.   But we can to

	trap_int=$(trap -p int)
	trap_hup=$(trap -p hup)
	...

and then reset them all, one by one, later...

(bash syntax)
	test -n "${trap_int}" && eval "${trap_int}" || trap - int
	test -n "${trap_hup}" && eval "${trap_hup}" || trap - hup
(ksh93 syntax)
	trap "${trap_int:-}" int
	trap "${trap_hup:-}" hup

the test (for bash) and  variable with default for ksh93, is needed
because they both still print nothing if the signal action is the default.

So, this modification attempts to fix all of that...

1) we add trap -p, but make it always output something for every signal
   listed (all of the signals if none are given) even if the signal
   action is the default.

2) choose the bash output format for trap -p, over the ksh93 format,
   even though the simpler usage just above makes the ksh93 form seem
   better.   But it isn't.  Consider:

	ksh93$ trap -p int hup
	echo hello

   One of the two traps has "echo hello" as its action, the other is
   still at the default, but which?

   From bash...
	bash$ trap -p int hup
	trap -- 'echo hello' SIGINT

   And now we know!  Given the bash 'trap -p' format, the following function
   produces ksh93 format output (for use with named signals only) instead...

	ksh93_trap_p() {
		for _ARG_ do
			_TRAP_=$(trap -p "${_ARG_}") || return 1
			eval set -- "${_TRAP_}"
			printf '%s' "$3${3:+
	}"
		done
		return 0
	}

  [ It needs to be entered without the indentation, that '}"' line has to be
    at the margin.   If the shell running that has local vars (bash does) then
    _ARG_ and _TRAP_ should be made local. ]

  So the bash format was chosen (except we do not include the "SIG" on the
  signal names.  That's irrelevant.)

  If no traps are set, "trap -p" will say (on NetBSD of course)...

trap -- - EXIT HUP INT QUIT ILL TRAP ABRT EMT FPE KILL BUS SEGV SYS
trap -- - PIPE ALRM TERM URG STOP TSTP CONT CHLD TTIN TTOU IO XCPU XFSZ
trap -- - VTALRM PROF WINCH INFO USR1 USR2 PWR RT0 RT1 RT2 RT3 RT4 RT5
trap -- - RT6 RT7 RT8 RT9 RT10 RT11 RT12 RT13 RT14 RT15 RT16 RT17 RT18
trap -- - RT19 RT20 RT21 RT22 RT23 RT24 RT25 RT26 RT27 RT28 RT29 RT30

  Obviously if traps are set, the relevant signal names will be removed from
  that list, and additional lines added for the trapped signals.

  With args, the signals names are listed, one line each, whatever
  the status of the trap for that signal is:

$ trap -p HUP INT QUIT
trap -- - HUP
trap -- 'echo interrupted' INT
trap -- - QUIT

3) we add "trap -" to reset all traps to default.   (It is easy, and seems
   useful.)

4) While here, lots of generic cleanup.   In particular, get rid of the
   NSIG+1 nonsense, and anything that ever believes a signo == NSIG
   is in any way rational.   Before there was a bunch of confusion,
   as we need all the signals for traps, plus one more for the EXIT
   trap, which looks like we then need NSIG+1.  But EXIT is 0, NSIG
   includes signals from 0..NSIG-1 but there is no signal 0, EXIT
   uses that slot, so we do not need to add and extra one, NSIG is
   enough.   (To see the effect of this, use a /bin/sh from before
   this fix, and compare the output from

	trap '' 64
   and  trap '' 65

   both invalid signal numbers.

   Then try just "trap" and watch your shell drop core...)

   Eventually NSIG needs to go away completely (from user apps), it
   is not POSIX, it isn't really useful (unless we make lots of
   assumptions about how signals are numbered, which are not guaranteed,
   so even if apps, like this sh, work on NetBSD, they're not portable,)
   and it isn't necessary (or will not be, soon.)

   But that is for another day...

5) As is kind of obvious above, when listing "all" traps, list all the
   ones still at their defaults, and all the ignored signals, on as
   few lines as possible (it could all be on one line - technically it
   would work as well, but it would have made this cvs log message
   really ugly...)   Signals with a non-null action still get listed
   one to a line (even if several do have the exact same action.)

6) Man page updates as well.

After this change, the following script:

	printf 'At start: '; trap
	printf '\n'

	trap -p >/tmp/out.$$
	trap 'echo hello' INT
	printf 'inside  : '; trap
	printf '\n'
	. /tmp/out.$$; rm /tmp/out.$$

	printf 'At end  : '; trap
	printf '\n'

which is just the example from above,
using "trap -p" instead of just "trap" to save the traps,
and modified to a form that will work with the NetBSD shell today
produces:

At start:
inside  : trap -- 'echo hello' INT

At end  :

[Do I get a prize for longest commit log message of the year?]

Revision 1.135 / (download) - annotate - [select for diffs], Thu May 4 04:37:51 2017 UTC (6 years, 9 months ago) by kre
Branch: MAIN
Changes since 1.134: +23 -3 lines
Diff to previous 1.134 (colored)


Implement the ';&' (used instead of ';;') case statement list terminator
which causes fall through the to command list of the following pattern
(wuthout evaluating that pattern).   This has been approved for inclusion
in the next major version of the POSIX standard (Issue 8), and is
implemented by most other shells.

Now all form a circle and together attempt to summon the great wizd
in the hopes that his magic spells can transform the poor attempt
at documenting this feature into something rational...

Revision 1.134 / (download) - annotate - [select for diffs], Wed May 3 00:43:22 2017 UTC (6 years, 9 months ago) by kre
Branch: MAIN
Changes since 1.133: +14 -9 lines
Diff to previous 1.133 (colored)


Undocument (comment out) the description of the unimplemented MAILCHECK
variable, and while here, enhance the description of MAIL a little.

Revision 1.131.2.1 / (download) - annotate - [select for diffs], Tue May 2 03:19:14 2017 UTC (6 years, 10 months ago) by pgoyette
Branch: prg-localcount2
Changes since 1.131: +31 -9 lines
Diff to previous 1.131 (colored)

Sync with HEAD - tag prg-localcount2-base1

Revision 1.133 / (download) - annotate - [select for diffs], Sun Apr 30 16:02:48 2017 UTC (6 years, 10 months ago) by wiz
Branch: MAIN
CVS Tags: prg-localcount2-base1
Changes since 1.132: +3 -3 lines
Diff to previous 1.132 (colored)

Uppercase UID. Fix typo.

Revision 1.132 / (download) - annotate - [select for diffs], Sat Apr 29 15:26:44 2017 UTC (6 years, 10 months ago) by kre
Branch: MAIN
Changes since 1.131: +30 -8 lines
Diff to previous 1.131 (colored)


Correct description of the trap command (make it posix compatible)
and add a couple more examples.   Also terminate a few sentences...

Revision 1.123.2.2 / (download) - annotate - [select for diffs], Wed Apr 26 02:52:13 2017 UTC (6 years, 10 months ago) by pgoyette
Branch: pgoyette-localcount
Changes since 1.123.2.1: +64 -14 lines
Diff to previous 1.123.2.1 (colored) to branchpoint 1.123 (colored) next main 1.124 (colored)

Sync with HEAD

Revision 1.123.4.1 / (download) - annotate - [select for diffs], Fri Apr 21 16:50:42 2017 UTC (6 years, 10 months ago) by bouyer
Branch: bouyer-socketcan
Changes since 1.123: +86 -14 lines
Diff to previous 1.123 (colored) next main 1.124 (colored)

Sync with HEAD

Revision 1.131 / (download) - annotate - [select for diffs], Fri Apr 14 08:48:01 2017 UTC (6 years, 10 months ago) by abhinav
Branch: MAIN
CVS Tags: prg-localcount2-base, pgoyette-localcount-20170426, bouyer-socketcan-base1
Branch point for: prg-localcount2
Changes since 1.130: +2 -4 lines
Diff to previous 1.130 (colored)

Fix mandoc -Tlint warnings:
	s/PP/Pp
	Remove Pp before It

Revision 1.130 / (download) - annotate - [select for diffs], Fri Apr 14 08:40:30 2017 UTC (6 years, 10 months ago) by abhinav
Branch: MAIN
Changes since 1.129: +3 -3 lines
Diff to previous 1.129 (colored)

Instead of removing markup as I did in the last commit, use markup but properly.
Hint taken from FreeBSD man page.

ok wiz@

Revision 1.129 / (download) - annotate - [select for diffs], Mon Apr 3 14:08:37 2017 UTC (6 years, 10 months ago) by abhinav
Branch: MAIN
Changes since 1.128: +2 -2 lines
Diff to previous 1.128 (colored)

Use \- instead of .Fl for the -number argument.

.Fl causes the -number argument to be rendered in bold, which causes confusion
with the [+]number argument right above it.

ok wiz@

Revision 1.128 / (download) - annotate - [select for diffs], Thu Mar 23 12:10:53 2017 UTC (6 years, 11 months ago) by kre
Branch: MAIN
Changes since 1.127: +10 -1 lines
Diff to previous 1.127 (colored)


PR bin/14578

Add a reference to editline(7) so we document the "-o vi" and "-o emacs"
bindings (defaults, and what can be set.)

Revision 1.127 / (download) - annotate - [select for diffs], Mon Mar 20 22:17:56 2017 UTC (6 years, 11 months ago) by kre
Branch: MAIN
Changes since 1.126: +20 -10 lines
Diff to previous 1.126 (colored)


At the suggestion of Matthew Sporleder (on current-users@) reword some
of the description of arithmetic expressions to make it a bit more
human friendly.

While here fix a few other minor errors, and bump date.

Revision 1.126 / (download) - annotate - [select for diffs], Mon Mar 20 11:26:07 2017 UTC (6 years, 11 months ago) by kre
Branch: MAIN
Changes since 1.125: +34 -1 lines
Diff to previous 1.125 (colored)



Finish support for all required $(( )) (shell arithmetic) operators,
closing PR bin/50958

That meant adding the assignment operators ('=', and all of the +=, *= ...)
Currently, ++, --, and ',' are not implemented (none of those are required
by posix) but support for them (most likely ',' first) might be added later.

To do this, I removed the yacc/lex arithmetic parser completely, and
replaced it with a hand written recursive descent parser, that I obtained
from FreeBSD, who earlier had obtained it from dash (Herbert Xu).

While doing the import, I cleaned up the sources (changed some file names
to avoid requiring a clean build, or signifigant surgery to the obj
directories if "build.sh -u" was to be used - "build.sh -u" should work
fine as it is now) removed some dashisms, applied some KNF, ...

Revision 1.123.2.1 / (download) - annotate - [select for diffs], Mon Mar 20 06:51:32 2017 UTC (6 years, 11 months ago) by pgoyette
Branch: pgoyette-localcount
Changes since 1.123: +24 -2 lines
Diff to previous 1.123 (colored)

Sync with HEAD

Revision 1.125 / (download) - annotate - [select for diffs], Sat Feb 4 23:35:15 2017 UTC (7 years ago) by wiz
Branch: MAIN
CVS Tags: pgoyette-localcount-20170320
Changes since 1.124: +2 -2 lines
Diff to previous 1.124 (colored)

Remove trailing space.

Revision 1.124 / (download) - annotate - [select for diffs], Thu Feb 2 20:00:40 2017 UTC (7 years ago) by christos
Branch: MAIN
Changes since 1.123: +24 -2 lines
Diff to previous 1.123 (colored)

Add fdflags builtin. Discussed with Chet and he has implemented it for
bash too.

Revision 1.123 / (download) - annotate - [select for diffs], Thu May 12 13:15:43 2016 UTC (7 years, 9 months ago) by kre
Branch: MAIN
CVS Tags: pgoyette-localcount-base, pgoyette-localcount-20170107, pgoyette-localcount-20161104, pgoyette-localcount-20160806, pgoyette-localcount-20160726, localcount-20160914, bouyer-socketcan-base
Branch point for: pgoyette-localcount, bouyer-socketcan
Changes since 1.122: +11 -1 lines
Diff to previous 1.122 (colored)


Document that a N>&N (or N<&N) redirection turns off close-on-exec for N
(where N is a decimal fd number) either when used as
	some-command N>&N
(where fd N is passed, open, to some-command - which is obviously what is
wanted)

Or as
	exec N>&N
which effects fd N for all future commands.

Note that this means
	exec N>foo N>&N
returns to the old behaviour of leaving the file descriptor open
when commands are run (as do most shells, other than ksh) and works for
both new and old NetBSD shells (old ones never set close-on-exec, and treat
N>&N as a rather meaingless no-op request, and just ignore it), new ones
set close-on-exec on the first redirection, then disable it again on the
second.

Everything here about >& for output fds applies to <& for input ones.

OK christos@

Revision 1.122 / (download) - annotate - [select for diffs], Mon May 9 20:36:07 2016 UTC (7 years, 9 months ago) by kre
Branch: MAIN
Changes since 1.121: +2 -13 lines
Diff to previous 1.121 (colored)


PR bin/48489 -- Shell "simple commands" are now not allowed to be
completely empty, they must have something (var assignment, redirect,
or command, or multiple of those) to avoid a syntax error.  This
matches the requirements of the grammar in the standard.   Correct the
parser (using FreeBSD's sh as a guide) and update the man page to
remove text that noted a couple of places this was previously OK.

OK christos@

Revision 1.121 / (download) - annotate - [select for diffs], Mon Apr 4 13:05:56 2016 UTC (7 years, 10 months ago) by wiz
Branch: MAIN
Changes since 1.120: +3 -3 lines
Diff to previous 1.120 (colored)

Remove some double quotes.

Parity is kept.

Revision 1.120 / (download) - annotate - [select for diffs], Thu Mar 31 16:18:22 2016 UTC (7 years, 11 months ago) by christos
Branch: MAIN
Changes since 1.119: +316 -65 lines
Diff to previous 1.119 (colored)

Document the NETBSD_SHELL variable, the enhancements to export,
the posix option, and a whole bunch of miscellaneous updates and
corrections. (from kre@)

Revision 1.119 / (download) - annotate - [select for diffs], Wed Feb 24 15:28:36 2016 UTC (8 years ago) by wiz
Branch: MAIN
Changes since 1.118: +3 -3 lines
Diff to previous 1.118 (colored)

file system police.

Revision 1.118 / (download) - annotate - [select for diffs], Wed Feb 24 14:35:51 2016 UTC (8 years ago) by christos
Branch: MAIN
Changes since 1.117: +55 -9 lines
Diff to previous 1.117 (colored)

Make sh.1 catch up with reality. Document -h (such as it is...)
and also added doc for some other stuff that was missing.

Take the opportunity to clean up the way the flags are set in the
man page, so every new flag doesn't have to be added 6 times!
(Some of the lists were different from others, in ordering, and
content, for no good reason at all.)

Make a few other cleanups ... Add text about AND-OR lists,
This can be also used to justify closing an open PR:
(that "sh -c 'command &&'" is not a syntax error...).

Add doc for -F, which should default to set if the shell somehow
gets compiled without DO_SHAREDVFORK defined, (to be committed
separately)

XXX: Consider disabling DO_SHAREDVFORK if SMALL is defined?

From kre

Revision 1.117 / (download) - annotate - [select for diffs], Wed Jan 6 00:22:21 2016 UTC (8 years, 1 month ago) by wiz
Branch: MAIN
Changes since 1.116: +2 -2 lines
Diff to previous 1.116 (colored)

Whitespace.

Revision 1.116 / (download) - annotate - [select for diffs], Tue Jan 5 18:16:20 2016 UTC (8 years, 1 month ago) by christos
Branch: MAIN
Changes since 1.115: +16 -2 lines
Diff to previous 1.115 (colored)

Document close-on-exec redirection behavior.

Revision 1.115 / (download) - annotate - [select for diffs], Tue May 26 21:35:15 2015 UTC (8 years, 9 months ago) by christos
Branch: MAIN
Changes since 1.114: +13 -6 lines
Diff to previous 1.114 (colored)

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

Revision 1.108.2.3 / (download) - annotate - [select for diffs], Tue Aug 19 23:45:11 2014 UTC (9 years, 6 months ago) by tls
Branch: tls-maxphys
Changes since 1.108.2.2: +43 -3 lines
Diff to previous 1.108.2.2 (colored) next main 1.109 (colored)

Rebase to HEAD as of a few days ago.

Revision 1.112.2.1 / (download) - annotate - [select for diffs], Sun Aug 10 06:41:18 2014 UTC (9 years, 6 months ago) by tls
Branch: tls-earlyentropy
Changes since 1.112: +33 -4 lines
Diff to previous 1.112 (colored) next main 1.113 (colored)

Rebase.

Revision 1.114 / (download) - annotate - [select for diffs], Sun Jun 1 17:46:06 2014 UTC (9 years, 9 months ago) by christos
Branch: MAIN
CVS Tags: tls-maxphys-base, tls-earlyentropy-base, netbsd-7-nhusb-base-20170116, netbsd-7-nhusb-base, netbsd-7-nhusb, netbsd-7-base, netbsd-7-2-RELEASE, netbsd-7-1-RELEASE, netbsd-7-1-RC2, netbsd-7-1-RC1, netbsd-7-1-2-RELEASE, netbsd-7-1-1-RELEASE, netbsd-7-1, netbsd-7-0-RELEASE, netbsd-7-0-RC3, netbsd-7-0-RC2, netbsd-7-0-RC1, netbsd-7-0-2-RELEASE, netbsd-7-0-1-RELEASE, netbsd-7-0, netbsd-7
Changes since 1.113: +13 -10 lines
Diff to previous 1.113 (colored)

PR/48843: Jarmo Jaakkola: Soften the language in the manual page,
making less promises about behavior not explicitly stated in the standard.

Revision 1.113 / (download) - annotate - [select for diffs], Sat May 31 14:42:18 2014 UTC (9 years, 9 months ago) by christos
Branch: MAIN
Changes since 1.112: +29 -3 lines
Diff to previous 1.112 (colored)

PR/48843: Jarmo Jaakkola: dot commands mess up scope nesting tracking

Evaluation of commands goes completely haywire if a file containing
a break/continue/return command outside its "intended" scope is sourced
using a dot command inside its "intended" scope.  The main symptom is
not exiting from the sourced file when supposed to, leading to evaluation
of commands that were not supposed to be evaluated.  A secondary symptom
is that these extra commands are not evaluated correctly, as some of them
are skipped.  Some examples are listed in the How-To-Repeat section.

According to the POSIX standard, this is how it should work:
    dot:
        The shell shall execute commands from the file in the current
        environment.
    break:
        The break utility shall exit from the smallest enclosing for, while,
        or until loop, [...]
    continue:
        The continue utility shall return to the top of the smallest
        enclosing for, while, or until loop, [...]
    return:
        The return utility shall cause the shell to stop executing
        the current function or dot script.  If the shell is not currently
        executing a function or dot script, the results are unspecified.

It is clear that return should return from a sourced file, which
it does not do.  Whether break and continue should work from the sourced
file might be debatable.  Because the dot command says "in the current
environment", I'd say yes.  In any case, it should not fail in weird
ways like it does now!

The problems occur with return (a) and break/continue (b) because:
    1)  dotcmd() does not record the function nesting level prior to
        sourcing the file nor does it touch the loopnest variable,
        leading to either
    2   a) returncmd() being unable to detect that it should not set
           evalskip to SKIPFUNC but SKIPFILE, or
        b) breakcmd() setting evalskip to SKIPCONT or SKIPBREAK,
        leading to
    3)  cmdloop() not detecting that it should skip the rest of
        the file, due to only checking for SKIPFILE.
The result is that cmdloop() keeps executing lines from the file
whilst evalskip is set, which is the main symptom.  Because
evalskip is checked in multiple places in eval.c, the secondary
symptom appears.
>How-To-Repeat:
Run the following script:

    printf "break\necho break1; echo break2" >break
    printf "continue\necho continue1; echo continue2" >continue
    printf "return\necho return1; echo return2" >return

    while true; do . ./break; done

    for i in 1 2; do . ./continue; done

    func() {
        . ./return
    }
    func

No output should be produced, but instead this is the result:
    break1
    continue1
    continue1
    return1

The main symptom is evident from the unexpected output and the secondary
one from the fact that there are no lines with '2' in them.
>Fix:
Here is patch to src/bin/sh to fix the above problems.  It keeps
track of the function nesting level at the beginning of a dot command
to enable the return command to work properly.

I also changed the undefined-by-standard functionality of the return
command when it's not in a dot command or function from (indirectly)
exiting the shell to being silently ignored.  This was done because
the previous way has at least one bug: the shell exits without asking
for confirmation when there are stopped jobs.

Because I read the standard to mean that break and continue should have
an effect outside the sourced file, that's how I implemented it.  For what
it's worth, this also seems to be what bash does.  Also laziness, because
this way required no changes to loopnesting tracking.  If this is not
wanted, it might make sense to move the nesting tracking to the inputfile
stack.

The patch also does some clean-up to reduce the amount of global
variables by moving the dotcmd() and the find_dot_file() functions from
main.c to eval.c and making in_function() a proper function.

Revision 1.106.2.2 / (download) - annotate - [select for diffs], Thu May 22 11:26:23 2014 UTC (9 years, 9 months ago) by yamt
Branch: yamt-pagecache
Changes since 1.106.2.1: +16 -5 lines
Diff to previous 1.106.2.1 (colored) to branchpoint 1.106 (colored) next main 1.107 (colored)

sync with head.

for a reference, the tree before this commit was tagged
as yamt-pagecache-tag8.

this commit was splitted into small chunks to avoid
a limitation of cvs.  ("Protocol error: too many arguments")

Revision 1.112 / (download) - annotate - [select for diffs], Mon Jan 20 14:05:51 2014 UTC (10 years, 1 month ago) by roy
Branch: MAIN
CVS Tags: yamt-pagecache-base9, riastradh-xf86-video-intel-2-7-1-pre-2-21-15, riastradh-drm2-base3
Branch point for: tls-earlyentropy
Changes since 1.111: +11 -2 lines
Diff to previous 1.111 (colored)

Add wctype(3) support to Shell Patterns.
Obtained from FreeBSD.

Revision 1.111 / (download) - annotate - [select for diffs], Wed Oct 2 20:42:56 2013 UTC (10 years, 4 months ago) by christos
Branch: MAIN
Changes since 1.110: +4 -2 lines
Diff to previous 1.110 (colored)

document LINENO
XXX: someone should fix all the .Ev stuff because some of them are just
shell variables .Va and are not really exported to the environment. See
the FreeBSD man page.

Revision 1.108.2.2 / (download) - annotate - [select for diffs], Sun Jun 23 06:26:13 2013 UTC (10 years, 8 months ago) by tls
Branch: tls-maxphys
Changes since 1.108.2.1: +5 -5 lines
Diff to previous 1.108.2.1 (colored)

resync from head

Revision 1.110 / (download) - annotate - [select for diffs], Thu May 9 11:43:27 2013 UTC (10 years, 9 months ago) by simonb
Branch: MAIN
CVS Tags: riastradh-drm2-base2, riastradh-drm2-base1, riastradh-drm2-base, riastradh-drm2
Changes since 1.109: +5 -5 lines
Diff to previous 1.109 (colored)

Document that a here-document can finish at an EOF as well as at the
delimiter.

Revision 1.108.2.1 / (download) - annotate - [select for diffs], Tue Nov 20 02:57:28 2012 UTC (11 years, 3 months ago) by tls
Branch: tls-maxphys
Changes since 1.108: +21 -16 lines
Diff to previous 1.108 (colored)

Resync to 2012-11-19 00:00:00 UTC

Revision 1.106.2.1 / (download) - annotate - [select for diffs], Tue Oct 30 18:46:08 2012 UTC (11 years, 4 months ago) by yamt
Branch: yamt-pagecache
CVS Tags: yamt-pagecache-tag8
Changes since 1.106: +50 -41 lines
Diff to previous 1.106 (colored)

sync with head

Revision 1.109 / (download) - annotate - [select for diffs], Wed Oct 3 19:37:36 2012 UTC (11 years, 4 months ago) by wiz
Branch: MAIN
CVS Tags: yamt-pagecache-base8, yamt-pagecache-base7, yamt-pagecache-base6, khorben-n900, agc-symver-base, agc-symver
Changes since 1.108: +21 -16 lines
Diff to previous 1.108 (colored)

- Correct macro usage;
- improve wording, including creating more consistency therein.

From Bug Hunting.

Revision 1.108 / (download) - annotate - [select for diffs], Sun Aug 26 14:30:38 2012 UTC (11 years, 6 months ago) by wiz
Branch: MAIN
Branch point for: tls-maxphys
Changes since 1.107: +26 -25 lines
Diff to previous 1.107 (colored)

- improve punctuation;
- improve (create more consistency in) spelling;
- remove unnecessary (and in part ignored) macros, as well as an
  unnecessary argument to `.Bl' (fixes mandoc(1) warnings);
- improve wording;
- bump date.

Patch from Bug Hunting.

Revision 1.107 / (download) - annotate - [select for diffs], Mon Jun 11 18:28:10 2012 UTC (11 years, 8 months ago) by njoly
Branch: MAIN
Changes since 1.106: +6 -3 lines
Diff to previous 1.106 (colored)

Allow thread limit queries by adding the new -r flag to ulimit. Add
the corresponding documentation in the man page.

Revision 1.106 / (download) - annotate - [select for diffs], Wed Oct 5 13:15:30 2011 UTC (12 years, 4 months ago) by christos
Branch: MAIN
CVS Tags: yamt-pagecache-base5, yamt-pagecache-base4, yamt-pagecache-base3, yamt-pagecache-base2, yamt-pagecache-base, netbsd-6-base, netbsd-6-1-RELEASE, netbsd-6-1-RC4, netbsd-6-1-RC3, netbsd-6-1-RC2, netbsd-6-1-RC1, netbsd-6-1-5-RELEASE, netbsd-6-1-4-RELEASE, netbsd-6-1-3-RELEASE, netbsd-6-1-2-RELEASE, netbsd-6-1-1-RELEASE, netbsd-6-1, netbsd-6-0-RELEASE, netbsd-6-0-RC2, netbsd-6-0-RC1, netbsd-6-0-6-RELEASE, netbsd-6-0-5-RELEASE, netbsd-6-0-4-RELEASE, netbsd-6-0-3-RELEASE, netbsd-6-0-2-RELEASE, netbsd-6-0-1-RELEASE, netbsd-6-0, netbsd-6, matt-nb6-plus-nbase, matt-nb6-plus-base, matt-nb6-plus
Branch point for: yamt-pagecache
Changes since 1.105: +3 -6 lines
Diff to previous 1.105 (colored)

Merge duplicate information.

Revision 1.105 / (download) - annotate - [select for diffs], Tue Oct 4 18:11:27 2011 UTC (12 years, 4 months ago) by apb
Branch: MAIN
Changes since 1.104: +2 -2 lines
Diff to previous 1.104 (colored)

.Dq Dv \&:

Revision 1.104 / (download) - annotate - [select for diffs], Tue Oct 4 18:07:39 2011 UTC (12 years, 4 months ago) by christos
Branch: MAIN
Changes since 1.103: +6 -2 lines
Diff to previous 1.103 (colored)

Mention what happens when we don't include :. It would be nice to use
.Dv :
but it produces ``'':

Revision 1.103 / (download) - annotate - [select for diffs], Sun Sep 11 06:02:20 2011 UTC (12 years, 5 months ago) by dholland
Branch: MAIN
Changes since 1.102: +2 -2 lines
Diff to previous 1.102 (colored)

A feature that wasn't implemented for 4.4alpha and still isn't implemented
is just plain not implemented.

Revision 1.99.4.1 / (download) - annotate - [select for diffs], Thu Jun 23 14:17:48 2011 UTC (12 years, 8 months ago) by cherry
Branch: cherry-xenmp
Changes since 1.99: +28 -15 lines
Diff to previous 1.99 (colored) next main 1.100 (colored)

Catchup with rmind-uvmplock merge.

Revision 1.102 / (download) - annotate - [select for diffs], Mon Jun 13 20:41:00 2011 UTC (12 years, 8 months ago) by wiz
Branch: MAIN
Changes since 1.101: +11 -11 lines
Diff to previous 1.101 (colored)

Sort sections. Remove trailing whitespace.

Revision 1.101 / (download) - annotate - [select for diffs], Mon Jun 13 00:17:15 2011 UTC (12 years, 8 months ago) by uebayasi
Branch: MAIN
Changes since 1.100: +4 -3 lines
Diff to previous 1.100 (colored)

Typos.

Revision 1.100 / (download) - annotate - [select for diffs], Sat Jun 11 14:37:36 2011 UTC (12 years, 8 months ago) by christos
Branch: MAIN
Changes since 1.99: +18 -6 lines
Diff to previous 1.99 (colored)

document OLDPWD and cd -

Revision 1.99 / (download) - annotate - [select for diffs], Thu Jun 3 02:05:02 2010 UTC (13 years, 9 months ago) by dholland
Branch: MAIN
CVS Tags: matt-mips64-premerge-20101231, cherry-xenmp-base, bouyer-quota2-nbase, bouyer-quota2-base, bouyer-quota2
Branch point for: cherry-xenmp
Changes since 1.98: +7 -2 lines
Diff to previous 1.98 (colored)

Note that set -o tabcomplete requires either set -o emacs or set -o vi
to work.

Revision 1.87.18.1.4.1 / (download) - annotate - [select for diffs], Wed Apr 21 05:15:28 2010 UTC (13 years, 10 months ago) by matt
Branch: matt-nb5-mips64
CVS Tags: matt-nb5-mips64-premerge-20101231, matt-nb5-mips64-k15
Changes since 1.87.18.1: +20 -7 lines
Diff to previous 1.87.18.1 (colored) next main 1.87.18.2 (colored)

sync to netbsd-5

Revision 1.98 / (download) - annotate - [select for diffs], Mon Mar 1 21:53:58 2010 UTC (14 years ago) by joerg
Branch: MAIN
Changes since 1.97: +2 -2 lines
Diff to previous 1.97 (colored)

\\ -> \e

Revision 1.87.18.3 / (download) - annotate - [select for diffs], Sat Jan 30 19:26:39 2010 UTC (14 years, 1 month ago) by snj
Branch: netbsd-5
CVS Tags: netbsd-5-2-RELEASE, netbsd-5-2-RC1, netbsd-5-2-3-RELEASE, netbsd-5-2-2-RELEASE, netbsd-5-2-1-RELEASE, netbsd-5-2, netbsd-5-1-RELEASE, netbsd-5-1-RC4, netbsd-5-1-RC3, netbsd-5-1-RC2, netbsd-5-1-RC1, netbsd-5-1-5-RELEASE, netbsd-5-1-4-RELEASE, netbsd-5-1-3-RELEASE, netbsd-5-1-2-RELEASE, netbsd-5-1-1-RELEASE, netbsd-5-1, matt-nb5-pq3-base, matt-nb5-pq3
Changes since 1.87.18.2: +2 -2 lines
Diff to previous 1.87.18.2 (colored) to branchpoint 1.87 (colored) next main 1.88 (colored)

Pull up following revision(s) (requested by dholland in ticket #1274):
	bin/sh/sh.1: revision 1.97 via patch
Bump date for cd -P support.

Revision 1.87.18.2 / (download) - annotate - [select for diffs], Sat Jan 30 19:24:32 2010 UTC (14 years, 1 month ago) by snj
Branch: netbsd-5
Changes since 1.87.18.1: +19 -6 lines
Diff to previous 1.87.18.1 (colored) to branchpoint 1.87 (colored)

Pull up following revision(s) (requested by dholland in ticket #1274):
	bin/sh/cd.c: revision 1.40
	bin/sh/sh.1: revision 1.95
Make the cd builtin accept and ignore -P, which is a kshism that has been
allowed to leak into POSIX and selects the behavior cd already implements.
Closes PR bin/42557 and also relevant to PR pkg/42168.
I suppose this should probably be pulled up to both -4 and -5...

Revision 1.85.2.2 / (download) - annotate - [select for diffs], Wed Jan 27 21:01:58 2010 UTC (14 years, 1 month ago) by bouyer
Branch: netbsd-4
Changes since 1.85.2.1: +19 -6 lines
Diff to previous 1.85.2.1 (colored) to branchpoint 1.85 (colored) next main 1.86 (colored)

Pull up following revision(s) (requested by dholland in ticket #1380):
	bin/sh/cd.c: revision 1.40
	bin/sh/sh.1: revision 1.95
	bin/sh/sh.1: revision 1.97
Make the cd builtin accept and ignore -P, which is a kshism that has been
allowed to leak into POSIX and selects the behavior cd already implements.
Closes PR bin/42557 and also relevant to PR pkg/42168.
I suppose this should probably be pulled up to both -4 and -5...
Bump date for cd -P support.

Revision 1.97 / (download) - annotate - [select for diffs], Fri Jan 1 21:46:31 2010 UTC (14 years, 2 months ago) by wiz
Branch: MAIN
Changes since 1.96: +2 -2 lines
Diff to previous 1.96 (colored)

Bump date for cd -P support.

Revision 1.96 / (download) - annotate - [select for diffs], Fri Jan 1 19:51:19 2010 UTC (14 years, 2 months ago) by dholland
Branch: MAIN
Changes since 1.95: +2 -2 lines
Diff to previous 1.95 (colored)

fix another typo

Revision 1.95 / (download) - annotate - [select for diffs], Fri Jan 1 19:34:59 2010 UTC (14 years, 2 months ago) by dholland
Branch: MAIN
Changes since 1.94: +19 -6 lines
Diff to previous 1.94 (colored)

Make the cd builtin accept and ignore -P, which is a kshism that has been
allowed to leak into POSIX and selects the behavior cd already implements.
Closes PR bin/42557 and also relevant to PR pkg/42168.

I suppose this should probably be pulled up to both -4 and -5...

Revision 1.94 / (download) - annotate - [select for diffs], Fri Jan 1 18:09:16 2010 UTC (14 years, 2 months ago) by dholland
Branch: MAIN
Changes since 1.93: +2 -2 lines
Diff to previous 1.93 (colored)

fix typo

Revision 1.88.2.1 / (download) - annotate - [select for diffs], Wed May 13 19:15:51 2009 UTC (14 years, 9 months ago) by jym
Branch: jym-xensuspend
Changes since 1.88: +17 -47 lines
Diff to previous 1.88 (colored) next main 1.89 (colored)

Sync with HEAD.

Third (and last) commit. See http://mail-index.netbsd.org/source-changes/2009/05/13/msg221222.html

Revision 1.87.18.1 / (download) - annotate - [select for diffs], Wed Apr 1 00:25:21 2009 UTC (14 years, 11 months ago) by snj
Branch: netbsd-5
CVS Tags: netbsd-5-0-RELEASE, netbsd-5-0-RC4, netbsd-5-0-2-RELEASE, netbsd-5-0-1-RELEASE, netbsd-5-0, matt-nb5-mips64-u2-k2-k4-k7-k8-k9, matt-nb5-mips64-u1-k1-k5, matt-nb5-mips64-premerge-20091211, matt-nb4-mips64-k7-u2a-k9b
Branch point for: matt-nb5-mips64
Changes since 1.87: +4 -2 lines
Diff to previous 1.87 (colored)

Pull up following revision(s) (requested by mrg in ticket #622):
	bin/csh/csh.1: revision 1.46
	bin/csh/func.c: revision 1.37
	bin/ps/print.c: revision 1.111
	bin/ps/ps.c: revision 1.74
	bin/sh/miscbltin.c: revision 1.38
	bin/sh/sh.1: revision 1.92 via patch
	external/bsd/top/dist/machine/m_netbsd.c: revision 1.7
	lib/libkvm/kvm_proc.c: revision 1.82
	sys/arch/mips/mips/cpu_exec.c: revision 1.55
	sys/compat/darwin/darwin_exec.c: revision 1.57
	sys/compat/ibcs2/ibcs2_exec.c: revision 1.73
	sys/compat/irix/irix_resource.c: revision 1.15
	sys/compat/linux/arch/amd64/linux_exec_machdep.c: revision 1.16
	sys/compat/linux/arch/i386/linux_exec_machdep.c: revision 1.12
	sys/compat/linux/common/linux_limit.h: revision 1.5
	sys/compat/osf1/osf1_resource.c: revision 1.14
	sys/compat/svr4/svr4_resource.c: revision 1.18
	sys/compat/svr4_32/svr4_32_resource.c: revision 1.17
	sys/kern/exec_subr.c: revision 1.62
	sys/kern/init_sysctl.c: revision 1.160
	sys/kern/kern_exec.c: revision 1.288
	sys/kern/kern_resource.c: revision 1.151
	sys/sys/param.h: patch
	sys/sys/resource.h: revision 1.31
	sys/sys/sysctl.h: revision 1.184
	sys/uvm/uvm_extern.h: revision 1.153
	sys/uvm/uvm_glue.c: revision 1.136
	sys/uvm/uvm_mmap.c: revision 1.128
	usr.bin/systat/ps.c: revision 1.32
- - add new RLIMIT_AS (aka RLIMIT_VMEM) resource that limits the total
address space available to processes.  this limit exists in most other
modern unix variants, and like most of them, our defaults are unlimited.
remove the old mmap / rlimit.datasize hack.
- - adds the VMCMD_STACK flag to all the stack-creation vmcmd callers.
it is currently unused, but was added a few years ago.
- - add a pair of new process size values to kinfo_proc2{}. one is the
total size of the process memory map, and the other is the total size
adjusted for unused stack space (since most processes have a lot of
this...)
- - patch sh, and csh to notice RLIMIT_AS.  (in some cases, the alias
RLIMIT_VMEM was already present and used if availble.)
- - patch ps, top and systat to notice the new k_vm_vsize member of
kinfo_proc2{}.
- - update irix, svr4, svr4_32, linux and osf1 emulations to support
this information.  (freebsd could be done, but that it's best left
as part of the full-update of compat/freebsd.)
this addresses PR 7897.  it also gives correct memory usage values,
which have never been entirely correct (since mmap), and have been
very incorrect since jemalloc() was enabled.
tested on i386 and sparc64, build tested on several other platforms.
thanks to many folks for feedback and testing but most espcially
chuq and yamt for critical suggestions that lead to this patch not
having a special ugliness i wasn't happy with anyway :-)

Revision 1.93 / (download) - annotate - [select for diffs], Sun Mar 29 08:55:27 2009 UTC (14 years, 11 months ago) by wiz
Branch: MAIN
CVS Tags: matt-premerge-20091211, jym-xensuspend-nbase, jym-xensuspend-base
Changes since 1.92: +2 -2 lines
Diff to previous 1.92 (colored)

Bump date for previous.

Revision 1.92 / (download) - annotate - [select for diffs], Sun Mar 29 01:02:49 2009 UTC (14 years, 11 months ago) by mrg
Branch: MAIN
Changes since 1.91: +4 -2 lines
Diff to previous 1.91 (colored)

- add new RLIMIT_AS (aka RLIMIT_VMEM) resource that limits the total
address space available to processes.  this limit exists in most other
modern unix variants, and like most of them, our defaults are unlimited.
remove the old mmap / rlimit.datasize hack.

- adds the VMCMD_STACK flag to all the stack-creation vmcmd callers.
it is currently unused, but was added a few years ago.

- add a pair of new process size values to kinfo_proc2{}. one is the
total size of the process memory map, and the other is the total size
adjusted for unused stack space (since most processes have a lot of
this...)

- patch sh, and csh to notice RLIMIT_AS.  (in some cases, the alias
RLIMIT_VMEM was already present and used if availble.)

- patch ps, top and systat to notice the new k_vm_vsize member of
kinfo_proc2{}.

- update irix, svr4, svr4_32, linux and osf1 emulations to support
this information.  (freebsd could be done, but that it's best left
as part of the full-update of compat/freebsd.)


this addresses PR 7897.  it also gives correct memory usage values,
which have never been entirely correct (since mmap), and have been
very incorrect since jemalloc() was enabled.

tested on i386 and sparc64, build tested on several other platforms.

thanks to many folks for feedback and testing but most espcially
chuq and yamt for critical suggestions that lead to this patch not
having a special ugliness i wasn't happy with anyway :-)

Revision 1.91 / (download) - annotate - [select for diffs], Tue Mar 10 15:14:28 2009 UTC (14 years, 11 months ago) by joerg
Branch: MAIN
Changes since 1.90: +2 -2 lines
Diff to previous 1.90 (colored)

Explicitly escape -- as it is not an argment to the Cm macro.

Revision 1.90 / (download) - annotate - [select for diffs], Tue Mar 10 14:18:52 2009 UTC (14 years, 11 months ago) by joerg
Branch: MAIN
Changes since 1.89: +13 -45 lines
Diff to previous 1.89 (colored)

Don't use .Xo/.Xc to workaround ancient macro argument limit.

Revision 1.89 / (download) - annotate - [select for diffs], Mon Mar 9 19:24:26 2009 UTC (14 years, 11 months ago) by joerg
Branch: MAIN
Changes since 1.88: +2 -2 lines
Diff to previous 1.88 (colored)

Fix preamble to match order set out by mdoc(7). Discussed with wiz.

Revision 1.88 / (download) - annotate - [select for diffs], Thu Dec 11 04:34:45 2008 UTC (15 years, 2 months ago) by yamt
Branch: MAIN
Branch point for: jym-xensuspend
Changes since 1.87: +3 -2 lines
Diff to previous 1.87 (colored)

document "EXIT" pseudo signal.

Revision 1.87 / (download) - annotate - [select for diffs], Sun Jun 24 17:57:56 2007 UTC (16 years, 8 months ago) by christos
Branch: MAIN
CVS Tags: yamt-pf42-baseX, yamt-pf42-base4, yamt-pf42-base3, yamt-pf42-base2, yamt-pf42-base, yamt-pf42, wrstuden-revivesa-base-3, wrstuden-revivesa-base-2, wrstuden-revivesa-base-1, wrstuden-revivesa-base, wrstuden-revivesa, netbsd-5-base, netbsd-5-0-RC3, netbsd-5-0-RC2, netbsd-5-0-RC1, mjf-devfs2-base, mjf-devfs2, matt-mips64-base2, matt-mips64-base, matt-mips64, matt-armv6-prevmlocking, matt-armv6-nbase, matt-armv6-base, matt-armv6, keiichi-mipv6-base, keiichi-mipv6, hpcarm-cleanup-nbase, hpcarm-cleanup-base, hpcarm-cleanup, cube-autoconf-base, cube-autoconf
Branch point for: netbsd-5
Changes since 1.86: +37 -16 lines
Diff to previous 1.86 (colored)

PR/36533: Greg A. Woods: minor doc fixes for sh(1)

Revision 1.85.2.1 / (download) - annotate - [select for diffs], Mon Apr 16 19:33:51 2007 UTC (16 years, 10 months ago) by bouyer
Branch: netbsd-4
CVS Tags: wrstuden-fixsa-newbase, wrstuden-fixsa-base-1, wrstuden-fixsa-base, wrstuden-fixsa, netbsd-4-0-RELEASE, netbsd-4-0-RC5, netbsd-4-0-RC4, netbsd-4-0-RC3, netbsd-4-0-RC2, netbsd-4-0-RC1, netbsd-4-0-1-RELEASE, netbsd-4-0
Changes since 1.85: +15 -2 lines
Diff to previous 1.85 (colored)

Pull up following revision(s) (requested by apb in ticket #570):
	bin/sh/expand.c: revision 1.78
	bin/sh/arith.y: revision 1.18
	bin/sh/expand.h: revision 1.17
	regress/bin/sh/expand.sh: revision 1.4
	bin/sh/sh.1: revision 1.86
	bin/sh/arith_lex.l: revision 1.14
Make /bin/sh use intmax_t (instead of int) for arithmetic in $((...)).

Revision 1.86 / (download) - annotate - [select for diffs], Sun Mar 25 06:56:43 2007 UTC (16 years, 11 months ago) by apb
Branch: MAIN
Changes since 1.85: +15 -2 lines
Diff to previous 1.85 (colored)

Document that shell arithmetic now uses intmax_t.  Document that
variables in shell arithmetic don't need "$" signs.

Revision 1.85 / (download) - annotate - [select for diffs], Mon Sep 4 20:30:36 2006 UTC (17 years, 5 months ago) by dsl
Branch: MAIN
CVS Tags: netbsd-4-base
Branch point for: netbsd-4
Changes since 1.84: +3 -3 lines
Diff to previous 1.84 (colored)

Fix typo, update date.
Fixes PR/34472

Revision 1.84 / (download) - annotate - [select for diffs], Sat Sep 10 22:09:43 2005 UTC (18 years, 5 months ago) by wiz
Branch: MAIN
CVS Tags: abandoned-netbsd-4-base, abandoned-netbsd-4
Changes since 1.83: +2 -2 lines
Diff to previous 1.83 (colored)

In mdoc, use .Pp for new paragraphs, not .br.

Revision 1.83 / (download) - annotate - [select for diffs], Sat Aug 20 21:07:42 2005 UTC (18 years, 6 months ago) by dsl
Branch: MAIN
Changes since 1.82: +6 -4 lines
Diff to previous 1.82 (colored)

Don't apply CDPATH if the the first component of the target is "." or "..".
Fixes PR/30973 and applies the principle of least surprise.
Update documentation to match (including date).
(matches behaviour of pdksh - if not it's documentation)

Revision 1.82 / (download) - annotate - [select for diffs], Fri Jul 15 22:33:48 2005 UTC (18 years, 7 months ago) by wiz
Branch: MAIN
Changes since 1.81: +46 -46 lines
Diff to previous 1.81 (colored)

Aspell, fix an Xref, drop trailing whitespace.

Revision 1.81 / (download) - annotate - [select for diffs], Fri Jul 15 17:23:48 2005 UTC (18 years, 7 months ago) by christos
Branch: MAIN
Changes since 1.80: +6 -3 lines
Diff to previous 1.80 (colored)

Allow trap to work on ignored signals when the shell is interactive.

Revision 1.80 / (download) - annotate - [select for diffs], Tue May 24 00:03:52 2005 UTC (18 years, 9 months ago) by wiz
Branch: MAIN
Changes since 1.79: +5 -5 lines
Diff to previous 1.79 (colored)

Whitespace and punctuation fixes.

Revision 1.79 / (download) - annotate - [select for diffs], Sat May 7 19:52:17 2005 UTC (18 years, 9 months ago) by dsl
Branch: MAIN
Changes since 1.78: +24 -3 lines
Diff to previous 1.78 (colored)

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 1.78 / (download) - annotate - [select for diffs], Thu Jun 3 19:54:37 2004 UTC (19 years, 9 months ago) by hubertf
Branch: MAIN
CVS Tags: netbsd-3-base, netbsd-3-1-RELEASE, netbsd-3-1-RC4, netbsd-3-1-RC3, netbsd-3-1-RC2, netbsd-3-1-RC1, netbsd-3-1-1-RELEASE, netbsd-3-1, 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-3-0-3-RELEASE, netbsd-3-0-2-RELEASE, netbsd-3-0-1-RELEASE, netbsd-3-0, netbsd-3
Changes since 1.77: +2 -2 lines
Diff to previous 1.77 (colored)

Fix typo: and the -> and then

Revision 1.77 / (download) - annotate - [select for diffs], Fri Apr 23 13:28:15 2004 UTC (19 years, 10 months ago) by wiz
Branch: MAIN
Changes since 1.76: +2 -2 lines
Diff to previous 1.76 (colored)

Fix typo noted by Patrick Welche.

Revision 1.76 / (download) - annotate - [select for diffs], Sat Apr 17 15:42:42 2004 UTC (19 years, 10 months ago) by wiz
Branch: MAIN
Changes since 1.75: +2 -2 lines
Diff to previous 1.75 (colored)

Bump date for previous.

Revision 1.75 / (download) - annotate - [select for diffs], Sat Apr 17 15:41:29 2004 UTC (19 years, 10 months ago) by christos
Branch: MAIN
Changes since 1.74: +3 -1 lines
Diff to previous 1.74 (colored)

understand rlimit sbsize

Revision 1.74 / (download) - annotate - [select for diffs], Sun Dec 21 11:16:23 2003 UTC (20 years, 2 months ago) by wiz
Branch: MAIN
CVS Tags: netbsd-2-base, 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-1, netbsd-2-0-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-3-RELEASE, netbsd-2-0-2-RELEASE, netbsd-2-0-1-RELEASE, netbsd-2-0, netbsd-2
Changes since 1.73: +5 -2 lines
Diff to previous 1.73 (colored)

Fix example added in previous.

Revision 1.73 / (download) - annotate - [select for diffs], Sun Dec 21 08:40:29 2003 UTC (20 years, 2 months ago) by jdolecek
Branch: MAIN
Changes since 1.72: +5 -2 lines
Diff to previous 1.72 (colored)

add a note to Short-Circuit operators section about the somewhat
nonintuitive evaluation in case there is both || and && specified
pointed out in bin/23814 by VaX#n8

Revision 1.72 / (download) - annotate - [select for diffs], Thu Dec 18 15:52:31 2003 UTC (20 years, 2 months ago) by heas
Branch: MAIN
Changes since 1.71: +3 -3 lines
Diff to previous 1.71 (colored)

correct 2 typos

Revision 1.71 / (download) - annotate - [select for diffs], Fri Nov 14 20:00:28 2003 UTC (20 years, 3 months ago) by dsl
Branch: MAIN
Changes since 1.70: +56 -11 lines
Diff to previous 1.70 (colored)

Posix requires that 'pwd -P' reset the shells saved cwd value - so a
subsequent 'pwd -L' will report the same value.
Update man page to be a closer match to reality.

Revision 1.70 / (download) - annotate - [select for diffs], Mon Oct 27 08:23:40 2003 UTC (20 years, 4 months ago) by wiz
Branch: MAIN
Changes since 1.69: +2 -2 lines
Diff to previous 1.69 (colored)

passwd(5), not passwd(4). From Igor Sobrado in PR 23278.

Revision 1.69 / (download) - annotate - [select for diffs], Mon Oct 27 08:22:21 2003 UTC (20 years, 4 months ago) by wiz
Branch: MAIN
Changes since 1.68: +2 -2 lines
Diff to previous 1.68 (colored)

Do not xref alias(1) since that points to csh(1).
Noted by Igor Sobrado in PR 23278, fixed following a suggestion by Greg A. Woods.

Revision 1.68 / (download) - annotate - [select for diffs], Thu Aug 7 09:05:37 2003 UTC (20 years, 6 months ago) by agc
Branch: MAIN
Changes since 1.67: +2 -6 lines
Diff to previous 1.67 (colored)

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

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

Revision 1.67 / (download) - annotate - [select for diffs], Fri Jun 27 09:11:12 2003 UTC (20 years, 8 months ago) by wiz
Branch: MAIN
Changes since 1.66: +8 -8 lines
Diff to previous 1.66 (colored)

Quote some punctuation.

Revision 1.66 / (download) - annotate - [select for diffs], Tue May 6 08:33:08 2003 UTC (20 years, 10 months ago) by wiz
Branch: MAIN
Changes since 1.65: +3 -3 lines
Diff to previous 1.65 (colored)

Drop trailing space.

Revision 1.65 / (download) - annotate - [select for diffs], Sun May 4 01:05:24 2003 UTC (20 years, 10 months ago) by gmcgarry
Branch: MAIN
Changes since 1.64: +7 -2 lines
Diff to previous 1.64 (colored)

Add new builtin 'inputrc' which allows keybindings to be redefined
for the current shell.  From Arne H Juul in PR#10097.

Revision 1.64 / (download) - annotate - [select for diffs], Fri May 2 09:00:14 2003 UTC (20 years, 10 months ago) by gmcgarry
Branch: MAIN
Changes since 1.63: +32 -8 lines
Diff to previous 1.63 (colored)

Expand documentation of emacs and vi modes.  From
Jeremy C. Reed in PR#14578.

Revision 1.63 / (download) - annotate - [select for diffs], Sat Apr 12 16:39:19 2003 UTC (20 years, 10 months ago) by zuntum
Branch: MAIN
Changes since 1.62: +2 -2 lines
Diff to previous 1.62 (colored)

add missing parenthesis

Revision 1.62 / (download) - annotate - [select for diffs], Sat Mar 22 11:37:49 2003 UTC (20 years, 11 months ago) by kristerw
Branch: MAIN
Changes since 1.61: +5 -5 lines
Diff to previous 1.61 (colored)

Change "if" to "if and only if" per discussion in PR 20794.

Revision 1.61 / (download) - annotate - [select for diffs], Tue Feb 25 10:34:41 2003 UTC (21 years ago) by wiz
Branch: MAIN
Changes since 1.60: +4 -4 lines
Diff to previous 1.60 (colored)

.Nm does not need a dummy argument ("") before punctuation or
for correct formatting of the SYNOPSIS any longer.

Revision 1.60 / (download) - annotate - [select for diffs], Wed Feb 12 19:00:08 2003 UTC (21 years ago) by wiz
Branch: MAIN
Changes since 1.59: +4 -3 lines
Diff to previous 1.59 (colored)

New sentence, new line; bump date for last change.

Revision 1.59 / (download) - annotate - [select for diffs], Wed Feb 12 02:55:14 2003 UTC (21 years ago) by gmcgarry
Branch: MAIN
Changes since 1.58: +9 -4 lines
Diff to previous 1.58 (colored)

Introduce LANG environment variable and Xref to nls(7).
Comment out the statement: "We expect POSIX conformance
by the time 4.4BSD is released."

Revision 1.58 / (download) - annotate - [select for diffs], Thu Jan 23 18:32:07 2003 UTC (21 years, 1 month ago) by wiz
Branch: MAIN
Changes since 1.57: +2 -2 lines
Diff to previous 1.57 (colored)

Fix indentation of continuation of first line in SYNOPSIS.

Revision 1.57 / (download) - annotate - [select for diffs], Wed Jan 22 22:05:45 2003 UTC (21 years, 1 month ago) by wiz
Branch: MAIN
Changes since 1.56: +12 -9 lines
Diff to previous 1.56 (colored)

More markup, more commas, less typos.

Revision 1.56 / (download) - annotate - [select for diffs], Wed Jan 22 20:36:04 2003 UTC (21 years, 1 month ago) by dsl
Branch: MAIN
Changes since 1.55: +79 -9 lines
Diff to previous 1.55 (colored)

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 1.55 / (download) - annotate - [select for diffs], Sat Dec 28 05:08:27 2002 UTC (21 years, 2 months ago) by uebayasi
Branch: MAIN
CVS Tags: fvdl_fs64_base
Changes since 1.54: +2 -2 lines
Diff to previous 1.54 (colored)

trap '' SIGINT -> trap '' INT.

Revision 1.54 / (download) - annotate - [select for diffs], Thu Dec 19 18:04:41 2002 UTC (21 years, 2 months ago) by kleink
Branch: MAIN
Changes since 1.53: +2 -2 lines
Diff to previous 1.53 (colored)

Another it's -> its.

Revision 1.53 / (download) - annotate - [select for diffs], Thu Dec 12 11:50:40 2002 UTC (21 years, 2 months ago) by uebayasi
Branch: MAIN
Changes since 1.52: +2 -2 lines
Diff to previous 1.52 (colored)

``	[n1]>&n2	Duplicate standard output (or n1) _TO_ n2.''

Revision 1.52 / (download) - annotate - [select for diffs], Wed Oct 2 10:01:46 2002 UTC (21 years, 5 months ago) by wiz
Branch: MAIN
Changes since 1.51: +3 -3 lines
Diff to previous 1.51 (colored)

filesystem -> file system, automaticly -> automatically.

Revision 1.51 / (download) - annotate - [select for diffs], Tue Oct 1 15:06:31 2002 UTC (21 years, 5 months ago) by wiz
Branch: MAIN
Changes since 1.50: +32 -15 lines
Diff to previous 1.50 (colored)

Use more mdoc, particularly to get rid of some \*[Lt] and \*[Gt].

Revision 1.50 / (download) - annotate - [select for diffs], Wed Sep 25 15:18:42 2002 UTC (21 years, 5 months ago) by wiz
Branch: MAIN
Changes since 1.49: +362 -252 lines
Diff to previous 1.49 (colored)

New policy: New sentences start on a new line.
Patches by Robert Elz <kre at munnari oz au>, with minimal changes by me.

Revision 1.49 / (download) - annotate - [select for diffs], Wed May 15 19:43:29 2002 UTC (21 years, 9 months ago) by bjh21
Branch: MAIN
CVS Tags: netbsd-1-6-base, netbsd-1-6-RELEASE, netbsd-1-6-RC3, netbsd-1-6-RC2, netbsd-1-6-RC1, netbsd-1-6-PATCH002-RELEASE, netbsd-1-6-PATCH002-RC4, netbsd-1-6-PATCH002-RC3, netbsd-1-6-PATCH002-RC2, netbsd-1-6-PATCH002-RC1, netbsd-1-6-PATCH002, netbsd-1-6-PATCH001-RELEASE, netbsd-1-6-PATCH001-RC3, netbsd-1-6-PATCH001-RC2, netbsd-1-6-PATCH001-RC1, netbsd-1-6-PATCH001, netbsd-1-6
Changes since 1.48: +2 -2 lines
Diff to previous 1.48 (colored)

Implement sh -a (allexport).  Code (all two lines of it) from FreeBSD
(FreeBSD var.c 1.13, sh.1 1.27).

Revision 1.48 / (download) - annotate - [select for diffs], Wed May 15 16:33:35 2002 UTC (21 years, 9 months ago) by christos
Branch: MAIN
Changes since 1.47: +1 -2 lines
Diff to previous 1.47 (colored)

implement noclobber. From Ben Harris, with minor tweaks from me. Two
unimplemented comments to go. Go Ben!

Revision 1.47 / (download) - annotate - [select for diffs], Wed May 15 14:59:21 2002 UTC (21 years, 9 months ago) by christos
Branch: MAIN
Changes since 1.46: +1 -2 lines
Diff to previous 1.46 (colored)

Implement unset variable error messages from Ben Harris.

Revision 1.46 / (download) - annotate - [select for diffs], Sun Feb 24 21:41:52 2002 UTC (22 years ago) by lukem
Branch: MAIN
CVS Tags: ELRICshvfork-base, ELRICshvfork
Changes since 1.45: +4 -3 lines
Diff to previous 1.45 (colored)

first variable argument to "read" is not optional

Revision 1.33.4.7 / (download) - annotate - [select for diffs], Sat Feb 23 15:54:10 2002 UTC (22 years ago) by he
Branch: netbsd-1-5
CVS Tags: netbsd-1-5-PATCH003
Changes since 1.33.4.6: +41 -7 lines
Diff to previous 1.33.4.6 (colored) to branchpoint 1.33 (colored) next main 1.34 (colored)

Pull up revision 1.41 (requested by jonb):
  Extend functionality of the trap builtin, which now more closely
  follows POSIX recommendations:
   o accept signal names as well as signal numbers
   o add ``-l'' option which outputs list of valid signals
   o add signal EXIT to list of valid signals
   o an ``-'' in the action part will reset signal to default behaviour
   o changed standard output of ``trap'' to make it suitable as
     subsequent input

Revision 1.45 / (download) - annotate - [select for diffs], Fri Feb 8 01:21:59 2002 UTC (22 years ago) by ross
Branch: MAIN
Changes since 1.44: +37 -37 lines
Diff to previous 1.44 (colored)

Generate <>& symbolically. I'm avoiding .../dist/... directories for now.

Revision 1.44 / (download) - annotate - [select for diffs], Thu Dec 20 20:07:40 2001 UTC (22 years, 2 months ago) by wiz
Branch: MAIN
Changes since 1.43: +20 -25 lines
Diff to previous 1.43 (colored)

Punctuation nits, drop unnecessary .Pps, sort sections.

Revision 1.33.4.6 / (download) - annotate - [select for diffs], Wed Apr 4 16:15:24 2001 UTC (22 years, 11 months ago) by he
Branch: netbsd-1-5
CVS Tags: netbsd-1-5-PATCH002, netbsd-1-5-PATCH001
Changes since 1.33.4.5: +13 -12 lines
Diff to previous 1.33.4.5 (colored) to branchpoint 1.33 (colored)

Pull up revision 1.43 (via patch, requested by wiz):
  Don't xref set(1) and case(1), since they are builtins and we don't
  have separate man pages for them.
  Xref passwd 5 instead of 4, environ 7 instead of 5, and comment out xref
  to profile(4), which we don't have.
  Improve markup of SYNOPSIS.
  Some whitespace fixes while I'm here.

Revision 1.43 / (download) - annotate - [select for diffs], Tue Apr 3 10:56:03 2001 UTC (22 years, 11 months ago) by wiz
Branch: MAIN
Changes since 1.42: +14 -13 lines
Diff to previous 1.42 (colored)

Don't xref set(1) and case(1), since they are builtins and we don't
have separate man pages for them.
Xref passwd 5 instead of 4, environ 7 instead of 5, and comment out xref
to profile(4), which we don't have.
Improve markup of SYNOPSIS.
Some whitespace fixes while I'm here.

Revision 1.42 / (download) - annotate - [select for diffs], Sun Apr 1 02:15:45 2001 UTC (22 years, 11 months ago) by toddpw
Branch: MAIN
Changes since 1.41: +10 -4 lines
Diff to previous 1.41 (colored)

Correct {list;} example and fix formatting/typo in the operator lists.

Revision 1.41 / (download) - annotate - [select for diffs], Sun Mar 18 04:04:23 2001 UTC (22 years, 11 months ago) by wulf
Branch: MAIN
Changes since 1.40: +41 -7 lines
Diff to previous 1.40 (colored)

Extended functionality of the trap builtin, which now closely follows
POSIX recommendations.

	- trap now accepts signal names and signal numbers
	  e.g. INT, SIGINT, 2
	- added option -l that outputs a list of valid signals
	- added signal EXIT to list of valid signals
	- a `-' in the action part will reset specified signal to their
	  default behaviour
	- changed standard output format to make it suitable as an input
	  to another shell that achieves the same trapping results

Revision 1.33.4.5 / (download) - annotate - [select for diffs], Sun Mar 18 03:20:12 2001 UTC (22 years, 11 months ago) by wulf
Branch: netbsd-1-5
Changes since 1.33.4.4: +6 -40 lines
Diff to previous 1.33.4.4 (colored) to branchpoint 1.33 (colored)

Reversed submission of trap.c and sh.1 to wrong branch

Revision 1.33.4.4 / (download) - annotate - [select for diffs], Sat Mar 17 10:21:33 2001 UTC (22 years, 11 months ago) by wulf
Branch: netbsd-1-5
Changes since 1.33.4.3: +41 -7 lines
Diff to previous 1.33.4.3 (colored) to branchpoint 1.33 (colored)

Extended functionality of the trap builtin, which now closely follows
POSIX recommendations.

	- trap now accepts signal names and signal numbers
	  e.g. INT, SIGINT, 2
	- added option -l that outputs a list of valid signals
	- added signal EXIT to list of valid signals
	- a `-' in the action part will reset specified signal to their
	  default behaviour
	- changed standard output format to make it suitable as an input
	  to another shell that achieves the same trapping results

Revision 1.40 / (download) - annotate - [select for diffs], Mon Nov 20 17:48:05 2000 UTC (23 years, 3 months ago) by christos
Branch: MAIN
Changes since 1.39: +4 -4 lines
Diff to previous 1.39 (colored)

fix typo.

Revision 1.39 / (download) - annotate - [select for diffs], Mon Nov 20 16:59:56 2000 UTC (23 years, 3 months ago) by christos
Branch: MAIN
Changes since 1.38: +31 -1 lines
Diff to previous 1.38 (colored)

Add an example on how to use getopts, stolen from the getopt manual page :-)

Revision 1.33.4.3 / (download) - annotate - [select for diffs], Thu Sep 21 21:32:35 2000 UTC (23 years, 5 months ago) by phil
Branch: netbsd-1-5
CVS Tags: netbsd-1-5-RELEASE, netbsd-1-5-BETA2, netbsd-1-5-BETA
Changes since 1.33.4.2: +4 -4 lines
Diff to previous 1.33.4.2 (colored) to branchpoint 1.33 (colored)

.Bl argument is "-offset indent", not "-indent" (Approved thropej.)

Revision 1.38 / (download) - annotate - [select for diffs], Thu Sep 21 21:04:56 2000 UTC (23 years, 5 months ago) by phil
Branch: MAIN
Changes since 1.37: +3 -3 lines
Diff to previous 1.37 (colored)

.Bl takes parameter "-offset indent", not "-indent".

Revision 1.37 / (download) - annotate - [select for diffs], Mon Sep 4 07:30:12 2000 UTC (23 years, 6 months ago) by kleink
Branch: MAIN
Changes since 1.36: +2 -2 lines
Diff to previous 1.36 (colored)

For commands and utilities, use EXIT STATUS rather than RETURN VALUES as
appropriate (and documented in mdoc(7)).

Revision 1.33.4.2 / (download) - annotate - [select for diffs], Mon Aug 28 04:25:47 2000 UTC (23 years, 6 months ago) by hubertf
Branch: netbsd-1-5
Changes since 1.33.4.1: +2 -2 lines
Diff to previous 1.33.4.1 (colored) to branchpoint 1.33 (colored)

Pull up to netbsd-1-5 branch, OK'd by thorpej:

Log Message:
 > Add 'RETURN VALUE' section header.

Files & Revisionis:
 > cvs rdiff -r1.19 -r1.20 basesrc/bin/cat/cat.1
 > cvs rdiff -r1.12 -r1.13 basesrc/bin/chmod/chmod.1
 > cvs rdiff -r1.14 -r1.15 basesrc/bin/cp/cp.1
 > cvs rdiff -r1.8 -r1.9 basesrc/bin/dd/dd.1
 > cvs rdiff -r1.9 -r1.10 basesrc/bin/echo/echo.1
 > cvs rdiff -r1.11 -r1.12 basesrc/bin/expr/expr.1
 > cvs rdiff -r1.25 -r1.26 basesrc/bin/ls/ls.1
 > cvs rdiff -r1.10 -r1.11 basesrc/bin/mkdir/mkdir.1
 > cvs rdiff -r1.23 -r1.24 basesrc/bin/mt/mt.1
 > cvs rdiff -r1.12 -r1.13 basesrc/bin/mv/mv.1
 > cvs rdiff -r1.16 -r1.17 basesrc/bin/pwd/pwd.1
 > cvs rdiff -r1.9 -r1.10 basesrc/bin/rm/rm.1
 > cvs rdiff -r1.11 -r1.12 basesrc/bin/rmdir/rmdir.1
 > cvs rdiff -r1.35 -r1.36 basesrc/bin/sh/sh.1
 > cvs rdiff -r1.11 -r1.12 basesrc/bin/sleep/sleep.1
 > cvs rdiff -r1.20 -r1.21 basesrc/bin/stty/stty.1

Revision 1.36 / (download) - annotate - [select for diffs], Mon Aug 28 02:11:06 2000 UTC (23 years, 6 months ago) by hubertf
Branch: MAIN
Changes since 1.35: +2 -2 lines
Diff to previous 1.35 (colored)

Add 'RETURN VALUE' section header.

Revision 1.33.4.1 / (download) - annotate - [select for diffs], Tue Jul 18 01:59:14 2000 UTC (23 years, 7 months ago) by jhawk
Branch: netbsd-1-5
CVS Tags: netbsd-1-5-ALPHA2
Changes since 1.33: +89 -41 lines
Diff to previous 1.33 (colored)

Pullup revs 1.34, 1.35, approved by jhawk.
rev 1.34:
  Note the meaning of 'trap 0' (execute on exit from shell)
rev 1.35:
  Various mandoc updates to the Builtins
  section; mostly .Ic, a few other nits.

Revision 1.35 / (download) - annotate - [select for diffs], Tue Jul 18 01:55:48 2000 UTC (23 years, 7 months ago) by jhawk
Branch: MAIN
Changes since 1.34: +80 -39 lines
Diff to previous 1.34 (colored)

Various mandoc updates to the Builtins
section; mostly .Ic, a few other nits.

Revision 1.34 / (download) - annotate - [select for diffs], Mon Jul 17 21:18:47 2000 UTC (23 years, 7 months ago) by jhawk
Branch: MAIN
Changes since 1.33: +10 -3 lines
Diff to previous 1.33 (colored)

Note the meaning of 'trap 0' (execute on exit from shell)

Revision 1.30.2.1 / (download) - annotate - [select for diffs], Mon Dec 27 18:27:12 1999 UTC (24 years, 2 months ago) by wrstuden
Branch: wrstuden-devbsize
Changes since 1.30: +16 -3 lines
Diff to previous 1.30 (colored) next main 1.31 (colored)

Pull up to last week's -current.

Revision 1.33 / (download) - annotate - [select for diffs], Tue Nov 16 22:03:25 1999 UTC (24 years, 3 months ago) by hubertf
Branch: MAIN
CVS Tags: wrstuden-devbsize-base, wrstuden-devbsize-19991221, netbsd-1-5-base, minoura-xpg4dl-base, minoura-xpg4dl
Branch point for: netbsd-1-5
Changes since 1.32: +3 -1 lines
Diff to previous 1.32 (colored)

Add under which conditions the "read" builtin returns success/failure.

Suggested in PR 8813 by Eric Mumpower <nocturne@arepa.com>

Revision 1.32 / (download) - annotate - [select for diffs], Tue Sep 28 14:54:43 1999 UTC (24 years, 5 months ago) by bouyer
Branch: MAIN
CVS Tags: comdex-fall-1999-base, comdex-fall-1999
Changes since 1.31: +6 -1 lines
Diff to previous 1.31 (colored)

xref sysctl(8) (for proc.<pid>.rlimits)

Revision 1.31 / (download) - annotate - [select for diffs], Mon Sep 27 19:34:25 1999 UTC (24 years, 5 months ago) by mjl
Branch: MAIN
Changes since 1.30: +9 -3 lines
Diff to previous 1.30 (colored)

Mention -c option to sh(1), noticed by Matthew Aldous in PR/8499.

Revision 1.30 / (download) - annotate - [select for diffs], Tue Jul 6 14:01:01 1999 UTC (24 years, 8 months ago) by christos
Branch: MAIN
Branch point for: wrstuden-devbsize
Changes since 1.29: +2 -2 lines
Diff to previous 1.29 (colored)

add -q in the synopsis line

Revision 1.29 / (download) - annotate - [select for diffs], Tue Mar 23 02:29:29 1999 UTC (24 years, 11 months ago) by ross
Branch: MAIN
CVS Tags: netbsd-1-4-base, netbsd-1-4-RELEASE, netbsd-1-4-PATCH003, netbsd-1-4-PATCH002, netbsd-1-4-PATCH001, netbsd-1-4
Changes since 1.28: +11 -11 lines
Diff to previous 1.28 (colored)

Make the `...' actually appear in the case/esac syntax section.
Fix a space botch in the $@ example.
Kill warnings caused by the effective but wrong use of \[ and \] to
perform the function of \&[ and \&].

Revision 1.28 / (download) - annotate - [select for diffs], Thu Feb 4 00:27:07 1999 UTC (25 years, 1 month ago) by cjs
Branch: MAIN
Changes since 1.27: +13 -1 lines
Diff to previous 1.27 (colored)

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 1.27 / (download) - annotate - [select for diffs], Thu Jan 28 18:11:50 1999 UTC (25 years, 1 month ago) by kleink
Branch: MAIN
Changes since 1.26: +10 -1 lines
Diff to previous 1.26 (colored)

Add support for the export and readonly -p option.

Revision 1.26 / (download) - annotate - [select for diffs], Mon Jan 11 19:34:53 1999 UTC (25 years, 1 month ago) by garbled
Branch: MAIN
Changes since 1.25: +1221 -1232 lines
Diff to previous 1.25 (colored)

Massive fixup:
Rewrite man page in mandoc format rather than nasty man format.
Fix a ton of parsing errors, and generate proper .Xr's.
document all known environment variables.
suggest ksh rather than bash.

The last two fix PR #1966.  Wheee!

Somebody with access to the POSIX spec needs to go in here, and document
our adherence, or lack thereof.

Revision 1.25 / (download) - annotate - [select for diffs], Tue Nov 17 14:16:32 1998 UTC (25 years, 3 months ago) by msaitoh
Branch: MAIN
Changes since 1.24: +5 -3 lines
Diff to previous 1.24 (colored)

fix some bugs

Revision 1.24 / (download) - annotate - [select for diffs], Thu Oct 29 23:23:36 1998 UTC (25 years, 4 months ago) by garbled
Branch: MAIN
Changes since 1.23: +72 -12 lines
Diff to previous 1.23 (colored)

Modify to better document getopts.  This fixes PR# 704.  Much thanks to
Christos for helping me out with this.

Revision 1.23 / (download) - annotate - [select for diffs], Sat Jul 4 06:52:07 1998 UTC (25 years, 8 months ago) by ross
Branch: MAIN
Changes since 1.22: +2 -3 lines
Diff to previous 1.22 (colored)

Small edit to n1>&n2 description.

Revision 1.21.2.1 / (download) - annotate - [select for diffs], Thu Nov 6 07:01:19 1997 UTC (26 years, 3 months ago) by mellon
Branch: netbsd-1-3
CVS Tags: netbsd-1-3-RELEASE, netbsd-1-3-PATCH003-CANDIDATE2, netbsd-1-3-PATCH003-CANDIDATE1, netbsd-1-3-PATCH003-CANDIDATE0, netbsd-1-3-PATCH003, netbsd-1-3-PATCH002, netbsd-1-3-PATCH001, netbsd-1-3-BETA
Changes since 1.21: +6 -9 lines
Diff to previous 1.21 (colored) next main 1.22 (colored)

Pull rev 1.22 up from trunk (kleink)

Revision 1.22 / (download) - annotate - [select for diffs], Wed Nov 5 14:05:31 1997 UTC (26 years, 4 months ago) by kleink
Branch: MAIN
Changes since 1.21: +6 -9 lines
Diff to previous 1.21 (colored)

Per 1003.2, the (builtin) read utility shall treat the backslash as an
escape character (including line continuation), unless the `-r' option
is specified:
* adopt to this behaviour, add the `-r' option to disable it;
* remove the `-e' option, which was previously necessary to get this behaviour.

Revision 1.21 / (download) - annotate - [select for diffs], Thu Jul 10 23:07:04 1997 UTC (26 years, 7 months ago) by phil
Branch: MAIN
CVS Tags: netbsd-1-3-base
Branch point for: netbsd-1-3
Changes since 1.20: +2 -2 lines
Diff to previous 1.20 (colored)

Add a missing ) in the description of the builtin "set".

Revision 1.20 / (download) - annotate - [select for diffs], Fri May 23 19:40:30 1997 UTC (26 years, 9 months ago) by cjs
Branch: MAIN
Changes since 1.19: +62 -1 lines
Diff to previous 1.19 (colored)

Add documentation for ulimit command, courtsey of
Eric Fischer <eric@fudge.uchicago.edu>.

Revision 1.19 / (download) - annotate - [select for diffs], Sat Mar 8 13:28:45 1997 UTC (26 years, 11 months ago) by mouse
Branch: MAIN
Changes since 1.18: +2 -2 lines
Diff to previous 1.18 (colored)

alternate -> alternative, per PR 2643

Revision 1.15.6.2 / (download) - annotate - [select for diffs], Tue Mar 4 15:18:16 1997 UTC (27 years ago) by mycroft
Branch: netbsd-1-2
CVS Tags: netbsd-1-2-PATCH001
Changes since 1.15.6.1: +9 -1 lines
Diff to previous 1.15.6.1 (colored) to branchpoint 1.15 (colored) next main 1.16 (colored)

Pull up latest sh(1).  Fixes yet more bugs.

Revision 1.18 / (download) - annotate - [select for diffs], Thu Feb 6 23:24:54 1997 UTC (27 years ago) by christos
Branch: MAIN
Changes since 1.17: +9 -1 lines
Diff to previous 1.17 (colored)

add type builtin.

Revision 1.15.6.1 / (download) - annotate - [select for diffs], Sun Jan 26 04:57:39 1997 UTC (27 years, 1 month ago) by rat
Branch: netbsd-1-2
Changes since 1.15: +123 -52 lines
Diff to previous 1.15 (colored)

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

Revision 1.17 / (download) - annotate - [select for diffs], Wed Oct 16 15:20:01 1996 UTC (27 years, 4 months ago) by christos
Branch: MAIN
Changes since 1.16: +30 -17 lines
Diff to previous 1.16 (colored)

PR/2808: Add HISTORY section and documentation of getopts. (from FreeBSD)

Revision 1.16 / (download) - annotate - [select for diffs], Mon Sep 2 21:28:21 1996 UTC (27 years, 6 months ago) by christos
Branch: MAIN
Changes since 1.15: +96 -38 lines
Diff to previous 1.15 (colored)

Apply PR#2721 from VaX#n8: make man page more lucid in places.

Revision 1.15 / (download) - annotate - [select for diffs], Thu May 11 21:30:18 1995 UTC (28 years, 9 months ago) by christos
Branch: MAIN
CVS Tags: netbsd-1-2-base, netbsd-1-2-RELEASE, netbsd-1-2-BETA, netbsd-1-1-base, netbsd-1-1-RELEASE, netbsd-1-1-PATCH001, netbsd-1-1
Branch point for: netbsd-1-2
Changes since 1.14: +1 -2 lines
Diff to previous 1.14 (colored)

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

Revision 1.14 / (download) - annotate - [select for diffs], Tue Mar 21 09:10:12 1995 UTC (28 years, 11 months ago) by cgd
Branch: MAIN
Changes since 1.13: +3 -2 lines
Diff to previous 1.13 (colored)

convert to new RCS id conventions.

Revision 1.13 / (download) - annotate - [select for diffs], Mon Jan 23 06:33:08 1995 UTC (29 years, 1 month ago) by christos
Branch: MAIN
Changes since 1.12: +1 -2 lines
Diff to previous 1.12 (colored)

I added the documented in the manual but not implemented variable expansions:

    ${#WORD}
    ${WORD%PAT}
    ${WORD%%PAT}
    ${WORD#PAT}
    ${WORD##PAT}

Revision 1.12 / (download) - annotate - [select for diffs], Thu Jan 12 23:35:56 1995 UTC (29 years, 1 month ago) by jtc
Branch: MAIN
Changes since 1.11: +7 -4 lines
Diff to previous 1.11 (colored)

Describe the : shell builtin.
Fixes PR #712.

Revision 1.11 / (download) - annotate - [select for diffs], Sat Jun 11 16:12:33 1994 UTC (29 years, 8 months ago) by mycroft
Branch: MAIN
CVS Tags: netbsd-1-0-base, netbsd-1-0-RELEASE, netbsd-1-0-PATCH1, netbsd-1-0-PATCH06, netbsd-1-0-PATCH05, netbsd-1-0-PATCH04, netbsd-1-0-PATCH03, netbsd-1-0-PATCH02, netbsd-1-0-PATCH0, netbsd-1-0
Changes since 1.10: +2 -1 lines
Diff to previous 1.10 (colored)

Add RCS ids.

Revision 1.10 / (download) - annotate - [select for diffs], Wed May 11 17:10:41 1994 UTC (29 years, 9 months ago) by jtc
Branch: MAIN
Changes since 1.9: +1266 -1089 lines
Diff to previous 1.9 (colored)

sync with 4.4lite

Revision 1.1.1.2 / (download) - annotate - [select for diffs] (vendor branch), Wed May 11 17:02:26 1994 UTC (29 years, 9 months ago) by jtc
Branch: WFJ-920714, CSRG
CVS Tags: lite-1
Changes since 1.1.1.1: +1265 -1084 lines
Diff to previous 1.1.1.1 (colored)

44lite code

Revision 1.9 / (download) - annotate - [select for diffs], Wed May 4 23:49:12 1994 UTC (29 years, 10 months ago) by jtc
Branch: MAIN
Changes since 1.8: +38 -33 lines
Diff to previous 1.8 (colored)

Comment out sections of the manpages that are not, and will probably never
be, appropriate for ash as configured for NetBSD.  In particular the /u
"magic" directory, and atty(1) support.

Revision 1.8 / (download) - annotate - [select for diffs], Thu Feb 3 17:47:48 1994 UTC (30 years, 1 month ago) by jtc
Branch: MAIN
Changes since 1.7: +6 -6 lines
Diff to previous 1.7 (colored)

spelling mistakes

Revision 1.7 / (download) - annotate - [select for diffs], Thu Jan 27 17:53:28 1994 UTC (30 years, 1 month ago) by jtc
Branch: MAIN
Changes since 1.6: +1 -3 lines
Diff to previous 1.6 (colored)

Remove text describing how the dot command does not do a $PATH search,
since we added that behavior to get closer to POSIX.2.

Revision 1.6 / (download) - annotate - [select for diffs], Sun Aug 1 07:58:14 1993 UTC (30 years, 7 months ago) by mycroft
Branch: MAIN
Changes since 1.5: +2 -3 lines
Diff to previous 1.5 (colored)

Add RCS identifiers.

Revision 1.5 / (download) - annotate - [select for diffs], Sun May 2 23:08:42 1993 UTC (30 years, 10 months ago) by mycroft
Branch: MAIN
CVS Tags: netbsd-0-9-base, netbsd-0-9-RELEASE, netbsd-0-9-BETA, netbsd-0-9-ALPHA2, netbsd-0-9-ALPHA, netbsd-0-9
Changes since 1.4: +2 -2 lines
Diff to previous 1.4 (colored)

Fix typo.

Revision 1.4 / (download) - annotate - [select for diffs], Thu Apr 22 03:27:28 1993 UTC (30 years, 10 months ago) by mycroft
Branch: MAIN
Changes since 1.3: +2 -2 lines
Diff to previous 1.3 (colored)

Fix various bugs in man pages (from 386BSD patch 130).

Revision 1.3 / (download) - annotate - [select for diffs], Tue Mar 23 00:29:20 1993 UTC (30 years, 11 months ago) by cgd
Branch: MAIN
CVS Tags: netbsd-alpha-1, netbsd-0-8
Changes since 1.2: +1 -1 lines
Diff to previous 1.2 (colored)

changed "Id" to "Header" for rcsids

Revision 1.2 / (download) - annotate - [select for diffs], Mon Mar 22 08:04:00 1993 UTC (30 years, 11 months ago) by cgd
Branch: MAIN
Changes since 1.1: +2 -0 lines
Diff to previous 1.1 (colored)

added rcs ids to all files

Revision 1.1.1.1 / (download) - annotate - [select for diffs] (vendor branch), Sun Mar 21 09:45:37 1993 UTC (30 years, 11 months ago) by cgd
Branch: WFJ-920714, CSRG
CVS Tags: patchkit-0-2-2, WFJ-386bsd-01
Changes since 1.1: +0 -0 lines
Diff to previous 1.1 (colored)

initial import of 386bsd-0.1 sources

Revision 1.1 / (download) - annotate - [select for diffs], Sun Mar 21 09:45:37 1993 UTC (30 years, 11 months ago) by cgd
Branch: MAIN

Initial revision

This form allows you to request diff's between any two revisions of a file. You may select a symbolic revision name using the selection box or you may type in a numeric name using the type-in text box.




CVSweb <webmaster@jp.NetBSD.org>