History log of /freebsd-current/bin/sh/trap.c
Revision Date Author Comments
# e043f372 24-Nov-2023 Warner Losh <imp@FreeBSD.org>

bin: Automated cleanup of cdefs and other formatting

Apply the following automated changes to try to eliminate
no-longer-needed sys/cdefs.h includes as well as now-empty
blank lines in a row.

Remove /^#if.*\n#endif.*\n#include\s+<sys/cdefs.h>.*\n/
Remove /\n+#include\s+<sys/cdefs.h>.*\n+#if.*\n#endif.*\n+/
Remove /\n+#if.*\n#endif.*\n+/
Remove /^#if.*\n#endif.*\n/
Remove /\n+#include\s+<sys/cdefs.h>\n#include\s+<sys/types.h>/
Remove /\n+#include\s+<sys/cdefs.h>\n#include\s+<sys/param.h>/
Remove /\n+#include\s+<sys/cdefs.h>\n#include\s+<sys/capsicum.h>/

Sponsored by: Netflix


# 90aea514 23-Nov-2023 Warner Losh <imp@FreeBSD.org>

bin: Remove ancient SCCS tags.

Remove ancient SCCS tags from the tree, automated scripting, with two
minor fixup to keep things compiling. All the common forms in the tree
were removed with a perl script.

Sponsored by: Netflix


# 1d386b48 16-Aug-2023 Warner Losh <imp@FreeBSD.org>

Remove $FreeBSD$: one-line .c pattern

Remove /^[\s*]*__FBSDID\("\$FreeBSD\$"\);?\s*\n/


# 971677d5 24-Nov-2021 Bryan Drewery <bdrewery@FreeBSD.org>

sh: Avoid some headers when NO_HISTORY is set.

This is more simpler compatibility with using this source on older
systems before libedit was made to install filecomplete.h in
commit b315a7296d2.


# 988b1bb0 30-Mar-2021 Baptiste Daroussin <bapt@FreeBSD.org>

sh: implement persistent history storage

Implement persistent history storage:
the strategy is simple at start: loads the existing .sh_history file
at exit dump it.

The implementation respects the HISTFILE variable and its POSIX
definition: ~/.sh_history is used if HISTFILE is not set.

to avoid sh to create the history file, set HISTSIZE to 0 or HISTFILE to
en empty value

Co-authored-by: pstef
Reviewed by: jilles
Differential Revision: https://reviews.freebsd.org/D29493


# 1a4e959e 11-Apr-2021 Piotr Pawel Stefaniak <pstef@FreeBSD.org>

sh: fix debug build

Approved by: jilles


# 1cffe8b8 28-Aug-2020 Jilles Tjoelker <jilles@FreeBSD.org>

sh: Keep ignored SIGINT/SIGQUIT after set in a background job

If job control is not enabled, a background job (... &) ignores SIGINT and
SIGQUIT, but this can be reverted using the trap builtin in the same shell
environment.

Using the set builtin to change options would also revert SIGINT and SIGQUIT
to their previous dispositions.

This broke due to r317298. Calling setsignal() reverts the effect of
ignoresig().

Reported by: bdrewery
MFC after: 1 week


# bd111900 09-Jul-2020 Jilles Tjoelker <jilles@FreeBSD.org>

sh: Do not ignore INTOFF during a trap

INTOFF postpones SIGINT processing and INTON enables it again. This is
important so an interactive shell can return to the top level prompt when
Ctrl+C is pressed.

Given that INTON is automatically done when a builtin completes, the part
where onsig() ignores suppressint when in_dotrap is true is both unnecessary
and unsafe. If the trap is for some other signal than SIGINT, arbitrary code
could have been interrupted.

Historically, INTOFF remained in effect for longer.

Reviewed by: bdrewery
MFC after: 2 weeks
Differential Revision: https://reviews.freebsd.org/D25270


# 8a16b7a1 20-Nov-2017 Pedro F. Giffuni <pfg@FreeBSD.org>

General further adoption of SPDX licensing ID tags.

Mainly focus on files that use BSD 3-Clause license.

The Software Package Data Exchange (SPDX) group provides a specification
to make it easier for automated tools to detect and summarize well known
opensource licenses. We are gradually adopting the specification, noting
that the tags are considered only advisory and do not, in any way,
superceed or replace the license texts.

Special thanks to Wind River for providing access to "The Duke of
Highlander" tool: an older (2014) run over FreeBSD tree was useful as a
starting point.


# 55c2cd6f 11-Jun-2017 Jilles Tjoelker <jilles@FreeBSD.org>

sh: Enable interrupts before executing EXIT trap and doing final flush.


# 3be4e97d 22-Apr-2017 Jilles Tjoelker <jilles@FreeBSD.org>

sh: Simplify setinteractive().

setsignal() does nothing if the signal disposition is already set correctly.


# fbbd9655 28-Feb-2017 Warner Losh <imp@FreeBSD.org>

Renumber copyright clause 4

Renumber cluase 4 to 3, per what everybody else did when BSD granted
them permission to remove clause 3. My insistance on keeping the same
numbering for legal reasons is too pedantic, so give up on that point.

Submitted by: Jan Schaumann <jschauma@stevens.edu>
Pull Request: https://github.com/freebsd/freebsd/pull/96


# f30e8c7e 28-Mar-2016 Jilles Tjoelker <jilles@FreeBSD.org>

sh: Fix use-after-free if a trap replaces itself.

MFC after: 1 week


# a59f8174 18-Apr-2015 Bryan Drewery <bdrewery@FreeBSD.org>

sh: Fix the trap builtin to be POSIX-compliant for 'trap exit SIG' and 'trap n n...'.

The parser considered 'trap exit INT' to reset the default for both EXIT and
INT. This beahvior is not POSIX compliant. This was avoided if a value was
specified for 'exit', but then disallows exiting with the signal received. A
possible workaround is using ' exit'.

However POSIX does allow this type of behavior if the parameters are all
integers. Fix the handling for this and clarify its support in the manpage
since it is specifically allowed by POSIX.

Differential Revision: https://reviews.freebsd.org/D2325
Reviewed by: jilles
MFC after: 2 weeks


# edebe564 31-Jan-2015 Jilles Tjoelker <jilles@FreeBSD.org>

sh: Abort a wait builtin on any trapped signal.

This is required by POSIX.

PR: 197210
Reported by: ache
MFC after: 2 weeks


# 85052e7b 21-Dec-2014 Jilles Tjoelker <jilles@FreeBSD.org>

sh: Move some code from onint() to onsig(), making onint() noreturn.

As a result, the INTON macro which is used many times generates fewer
bytes of code.


# 33c5acf0 05-Oct-2014 Jilles Tjoelker <jilles@FreeBSD.org>

sh: Eliminate some gotos.


# d78fdfde 14-Jan-2014 Jilles Tjoelker <jilles@FreeBSD.org>

sh: Remove SIGWINCH handler and just check for resize before every read.

The SIGWINCH handler triggers breakage in libedit which is hard to fix; see
PR bin/169773.

Also, window size changes while a program is in foreground (and it rather
than sh will receive SIGWINCH) will now be picked up automatically.

Downside: it is now certain that a resize is only processed after pressing
<Enter>. If libedit is fixed, sh will most likely have to be changed also.

PR: bin/180146


# efd1946c 30-Oct-2013 Jilles Tjoelker <jilles@FreeBSD.org>

sh: Allow trapping SIGINT/SIGQUIT after ignore because of '&'.

If job control is not enabled, background jobs started with ... & ignore
SIGINT and SIGQUIT so that they are not affected by such signals that are
intended for the foreground job. However, this should not prevent
reassigning a different action for these signals (as if the shell invocation
inherited these signal actions from its parent).

Austin group issue #751

Example:
{ trap - INT; exec sleep 10; } & wait
A Ctrl+C should terminate the sleep command.


# b823fb59 02-Sep-2013 Jilles Tjoelker <jilles@FreeBSD.org>

sh: Fix race condition with signals and wait or set -T.

The change in r238888 was incomplete. It was still possible for a trapped
signal to arrive before the shell went to sleep (sigsuspend()) because a
check was missing or because the signal arrived before in_waitcmd was set.

On SMP, this bug sometimes caused the builtins/wait4.0 test to take 1 second
to execute; it then might or might not fail. On UP, the test almost always
failed.


# 0bdd3871 25-Jul-2013 Jilles Tjoelker <jilles@FreeBSD.org>

sh: Remove #define MKINIT.

MKINIT only served for the removed mkinit. Many variables can be static now.


# 46c6b52d 01-Apr-2013 Jilles Tjoelker <jilles@FreeBSD.org>

sh: Fix various compiler warnings.

It now passes WARNS=7 with clang on i386.

GCC 4.2.1 does not understand setjmp() properly so will always trigger
-Wuninitialized. I will not add the volatile keywords to suppress this.


# 3fe1119f 03-Mar-2013 Jilles Tjoelker <jilles@FreeBSD.org>

sh: When executing a trap, keep exit status along with evalskip.

This ensures 'return' in a trap returns the correct status to the caller.

If evalskip is not set or if it is overridden by a previous evalskip, keep
the old behaviour of restoring the exit status from before the trap.


# 25e0f0f5 23-Feb-2013 Jilles Tjoelker <jilles@FreeBSD.org>

sh: If a SIGINT or SIGQUIT interrupts "wait", return status 128+sig.


# 1794251a 29-Jul-2012 Jilles Tjoelker <jilles@FreeBSD.org>

sh: Fix EINTR race condition in "wait" and "set -T" using sigsuspend().

When waiting for child processes using "wait" or if "set -T" is in effect, a
signal interrupts the wait. Make sure there is no window where the signal
handler may be invoked (setting a flag) just before going to sleep.

There is a similar race condition in the shell language, but scripts can
avoid it by exiting from the trap handler or enforcing synchronization using
a fifo.

If SIGCHLD is not trapped, a signal handler must be installed for it. Only
install this handler for the duration of the wait to avoid triggering
unexpected [EINTR] errors elsewhere.

Note that for some reason only SIGINT and SIGQUIT interrupt a "wait"
command. This remains the case.


# fa7ccda2 15-Jul-2012 Jilles Tjoelker <jilles@FreeBSD.org>

sh: Reset pendingsigs before checking pending traps, not after.

Otherwise, a signal arriving at exactly the right moment might not be
processed until another signal arrived.


# 01a43bcf 16-Jan-2012 Jean-Sébastien Pédron <dumbbell@FreeBSD.org>

sh: Fix execution of multiple statements in a trap when evalskip is set

Before this fix, only the first statement of the trap was executed if
evalskip was set. This is for example the case when:
o "-e" is set for this shell
o a trap is set on EXIT
o a function returns 1 and causes the script to abort

Reviewed by: jilles
MFC after: 2 weeks


# 52c45039 14-Jan-2012 Jilles Tjoelker <jilles@FreeBSD.org>

sh: Fix out of bounds array access when trap is used with an invalid signal.

MFC after: 1 week


# 454a02b3 13-Jun-2011 Jilles Tjoelker <jilles@FreeBSD.org>

sh: Fix duplicate prototypes for builtins.

Have mkbuiltins write the prototypes for the *cmd functions to builtins.h
instead of builtins.c and include builtins.h in more .c files instead of
duplicating prototypes for *cmd functions in other headers.


# 3835f47c 04-Feb-2011 Jilles Tjoelker <jilles@FreeBSD.org>

sh: Remove special code for shell scripts without magic number.

These are called "shell procedures" in the source.

If execve() failed with [ENOEXEC], the shell would reinitialize itself
and execute the program as a script. This requires a fair amount of code
which is not frequently used (most scripts have a #! magic number).
Therefore just execute a new instance of sh (_PATH_BSHELL) to run the
script.


# 12dacf62 04-Feb-2011 Jilles Tjoelker <jilles@FreeBSD.org>

Make sys_signame upper case.

This matches the constants from <signal.h> with 'SIG' removed, which POSIX
requires kill and trap to accept and 'kill -l' to write.

'kill -l', 'trap', 'trap -l' output is now upper case.

In Turkish locales, signal names with an upper case 'I' are now accepted,
while signal names with a lower case 'i' are no longer accepted, and the
output of 'killall -l' now contains proper capital 'I' without dot instead
of a dotted capital 'I'.


# ebdfd6dc 16-Jan-2011 Jilles Tjoelker <jilles@FreeBSD.org>

sh: If exit is used without args from a trap action, exit on the signal.

This is useful so that it is easier to exit on a signal than to reset the
trap to default and resend the signal. It matches ksh93. POSIX says that
'exit' without args from a trap action uses the exit status from the last
command before the trap, which is different from 'exit $?' and matches this
if the previous command is assumed to have exited on the signal.

If the signal is SIGSTOP, SIGTSTP, SIGTTIN or SIGTTOU, or if the default
action for the signal is to ignore it, a normal _exit(2) is done with exit
status 128+signal_number.


# a043cc4c 15-Jan-2011 Jilles Tjoelker <jilles@FreeBSD.org>

sh: Fix some things about -- in trap:
* Make 'trap --' do the same as 'trap' instead of nothing.
* Make '--' stop option processing (note that '-' action is not an option).

Side effect: The error message for an unknown option is different.


# 45b3c176 14-Jan-2011 Jilles Tjoelker <jilles@FreeBSD.org>

sh: Make 'trap -l' look like 'kill -l'.


# 70df11ea 08-Jan-2011 Jilles Tjoelker <jilles@FreeBSD.org>

sh: Make exit without parameters from EXIT trap POSIX-compliant.

It should use the original exit status, just like falling off the
end of the trap handler.

Outside an EXIT trap, 'exit' is still equivalent to 'exit $?'.


# 5fe9123f 21-Dec-2010 Jilles Tjoelker <jilles@FreeBSD.org>

sh: Add a function to print warnings (with command name and newline).
This is like error() but without raising an exception.
It is particularly useful as a replacement for the warnx macro in
bltin/bltin.h.


# a7d5f7eb 19-Oct-2010 Jamie Gritton <jamie@FreeBSD.org>

A new jail(8) with a configuration file, to replace the work currently done
by /etc/rc.d/jail.


# 88328642 13-Oct-2010 David E. O'Brien <obrien@FreeBSD.org>

In the spirit of r90111, depend on c89 and remove the "STATIC" macro
and its usage.


# aa7b6f82 12-Oct-2010 David E. O'Brien <obrien@FreeBSD.org>

Consistently use "STATIC" for all functions in order to be able to set
breakpoints with in a debugger. And use naked "static" for variables.

Noticed by: bde


# fe0506d7 09-Mar-2010 Marcel Moolenaar <marcel@FreeBSD.org>

Create the altix project branch. The altix project will add support
for the SGI Altix 350 to FreeBSD/ia64. The hardware used for porting
is a two-module system, consisting of a base compute module and a
CPU expansion module. SGI's NUMAFlex architecture can be an excellent
platform to test CPU affinity and NUMA-aware features in FreeBSD.


# e3c2cd72 21-Nov-2009 Jilles Tjoelker <jilles@FreeBSD.org>

trap: do not consider a bad signal name a fatal error.
POSIX explicitly prescribes this.
Continue processing any other signals and return status 1.


# 3f228d74 11-Nov-2009 Jilles Tjoelker <jilles@FreeBSD.org>

sh: Use sigaction instead of signal/siginterrupt combination.


# 6e28dacf 13-Jun-2009 Jilles Tjoelker <jilles@FreeBSD.org>

Don't skip forking for an external command if any traps are active.

Example:
sh -c '(trap "echo trapped" EXIT; sleep 3)'
now correctly prints "trapped".

With this check, it is no longer necessary to check for -T
explicitly in that case.

This is a useful bugfix by itself and also important because I plan to
skip forking more often.

PR: bin/113860 (part of)
PR: bin/74404 (part of)
Reviewed by: stefanf
Approved by: ed (mentor)


# cb806389 30-May-2009 Stefan Farfeleder <stefanf@FreeBSD.org>

Fix the eval command in combination with set -e. Before this change the shell
would always terminate if eval returned with a non-zero exit status regardless
if the status was actually tested. Unfortunately a new file-scope variable
is needed, the alternative would only be to add a new parameter to all
built-ins.

PR: 134881


# d7f03759 19-Oct-2008 Ulf Lilleengen <lulf@FreeBSD.org>

- Import the HEAD csup code which is the basis for the cvsmode work.


# 00d02f94 17-Apr-2006 Jens Schweikhardt <schweikh@FreeBSD.org>

Whitespace nits.


# 2a5e306d 08-Dec-2005 Stefan Farfeleder <stefanf@FreeBSD.org>

Correctly quote the output when showing the installed trap actions.

PR: 74043
Submitted by: Jilles Tjoelker


# f7d95a07 06-Sep-2005 Ralf S. Engelschall <rse@FreeBSD.org>

Various small code cleanups resulting from a code reviewing
and linting procedure:

1. Remove useless sub-expression:

- if (*start || (!ifsspc && start > string && (nulonly || 1))) {
+ if (*start || (!ifsspc && start > string)) {

The sub-expression "(nulonly || 1)" always evaluates to true and
according to CVS logs seems to be just a left-over from some
debugging and introduced by accident. Removing the sub-expression
doesn't change semantics and a code inspection showed that the
variable "nulonly" is also not necessary here in any way (and the
expression would require fixing instead of removing).

2. Remove dead code:

- if (backslash && c == '\\') {
- if (read(STDIN_FILENO, &c, 1) != 1) {
- status = 1;
- break;
- }
- STPUTC(c, p);
- } else if (ap[1] != NULL && strchr(ifs, c) != NULL) {
+ if (ap[1] != NULL && strchr(ifs, c) != NULL) {

Inspection of the control and data flow showed that variable
"backslash" is always false (0) when the "if"-expression is
evaluated, hence the whole block is effectively dead code.
Additionally, the skipping of characters after a backslash is already
performed correctly a few lines above, so this code is also not
needed at all. According to the CVS logs and the ASH 0.2 sources,
this code existed in this way already since its early days.

3. Cleanup Style:

- ! trap[signo][0] == '\0' &&
+ ! (trap[signo][0] == '\0') &&

The expression wants to ensure the trap is not assigned the empty
string. But the "!" operator has higher precedence than "==", so the
comparison should be put into parenthesis to form the intended way of
expression. Nevertheless the code was effectively not really broken
as both particular NUL comparisons are semantically equal, of course.
But the parenthesized version is a lot more intuitive.

4. Remove shadowing variable declaration:

- char *q;

The declaration of symbol "q" hides another identical declaration of
"q" in the same context. As the other "q" is already reused multiple
times and also can be reused again without negative side-effects,
just remove the shadowing declaration.

5. Just small cosmetics:

- if (ifsset() != 0)
+ if (ifsset())

The ifsset() macro is already coded by returning the boolean result
of a comparison operator, so no need to compare this boolean result
again against a numerical value. This also aligns the macros usage to
the remaining existing code.

Reviewed by: stefanf@


# 6195fb41 06-Apr-2004 Mark Murray <markm@FreeBSD.org>

Remove clause 3 from the UCB licenses.

OK'ed by: imp, core


# aa0b7126 11-Feb-2004 Nate Lawson <njl@FreeBSD.org>

style(9): wrap at 80 columns.


# 97054a76 11-Feb-2004 Nate Lawson <njl@FreeBSD.org>

Handle proper formatting and a buffer overrun when running an old sh on
a system that has sys_nsig > NSIG (i.e. when libc is upgraded.)

Submitted by: Matt Dillon
Reviewed by: bde


# 1b13752a 28-Jan-2004 Nate Lawson <njl@FreeBSD.org>

Use sys_nsig instead of NSIG for the length of the signal arrays. This
is important if we add new signals later. From DragonflyBSD:
jobs.c:1.4, trap.c:1.3.

Obtained from: DragonflyBSD


# be58cc48 23-Jul-2002 Tim J. Robbins <tjr@FreeBSD.org>

Avoid calling el_resize() from a signal handler, even though libedit
itself does that if you set EL_SIGNAL. Instead, set a flag and check it
before calling el_gets(). This is safer, but slower to respond to changes.

Pointed out by: mp


# 9de7305e 23-Jul-2002 Tim J. Robbins <tjr@FreeBSD.org>

Catch SIGWINCH in interactive shells and call el_resize() to update
libedit's idea of the window size.


# 2628ebdb 19-Jul-2002 Tim J. Robbins <tjr@FreeBSD.org>

Remove broken and incomplete support for old releases of System V,
don't support system that implement getcwd(3) with a pipe to /bin/pwd.


# 2749b141 29-Jun-2002 David E. O'Brien <obrien@FreeBSD.org>

Consistently use FBSDID


# 5134c3f7 01-Feb-2002 Warner Losh <imp@FreeBSD.org>

o __P has been reoved
o Old-style K&R declarations have been converted to new C89 style
o register has been removed
o prototype for main() has been removed (gcc3 makes it an error)
o int main(int argc, char *argv[]) is the preferred main definition.
o Attempt to not break style(9) conformance for declarations more than
they already are.
o Change
int
foo() {
...
to
int
foo(void)
{
...


# 2a456239 27-Aug-1999 Peter Wemm <peter@FreeBSD.org>

$Id$ -> $FreeBSD$


# 46be34b9 08-May-1999 Kris Kennaway <kris@FreeBSD.org>

Various spelling/formatting changes.

Submitted by: Philippe Charnier <charnier@xp11.frmug.org>


# c1c72a3c 01-Apr-1999 Martin Cracauer <cracauer@FreeBSD.org>

The immediate execution of traps I introduced in September 1998 (to
make /etc/rc interruptible in cases when programs hang with blocked
signals) isn't standard enough.

It is now switched off by default and a new switch -T enables it.

You should update /etc/rc to the version I'm about to commit in a few
minutes to keep it interruptible.


# 9bbfa415 10-Sep-1998 Martin Cracauer <cracauer@FreeBSD.org>

Narrow down conditions to break wait() to process traps.
Improve comments.


# e6ac45dd 10-Sep-1998 Martin Cracauer <cracauer@FreeBSD.org>

Fix an inefficiency I introduced in my last commit.
Include "expand.h" vom memalloc.c to pull function declartion into scope


# 135421dd 08-Sep-1998 Martin Cracauer <cracauer@FreeBSD.org>

If traps are set, they are now executed even when a signal-blocking
foreground child is running. Formerly, traps were exceuted after the
next child exit.

The enables the user to put a breaking wrapper around a blocking
application:
(trap 'echo trap ; exit 1' 2; ./pestyblocker; echo -n)

The "echo -n" after the child call is needed to prevent sh from
optimizing the trap-executing shell away. I'm working on this.


# 1f40b47b 25-Aug-1998 Martin Cracauer <cracauer@FreeBSD.org>

Improve bookkeeping of in_waitcmd and style fixes.
Submitted by: Bruce Evans


# 40d009a7 25-Aug-1998 Martin Cracauer <cracauer@FreeBSD.org>

Re-enable killing childs with SIGQUIT. Spotted by Bruce Evans.


# 7a8e920b 24-Aug-1998 Martin Cracauer <cracauer@FreeBSD.org>

Do not exit on SIGINT in non-interactive shells, fixes PR 1206,
i.e. this makes emacs usable from system(3). Programs called from
shellscripts are now required to exit with proper signal status. That
means, they have to kill themself. Exiting with faked numerical exit
code is not sufficient.

Exit with proper signal status if script exits on signal.

Make the wait builtin interruptable, both with and without traps set.

Use volatile sig_atomic_t where (and only where) appropriate.

(Almost) fix printing of newlines on SIGINT.

Make traps setable from trap handlers. This is needed for shellscripts
that catch SIGINT for cleanup work but intend to exit on it, hance
have to kill themself from a trap handler. I.e. mkdep.

While I'm at it, make it -Wall clean. -Wall is not enabled in
Makefile, since vararg warnx() macro calls in usr.bin/printf/printf.c
are not -Wall-able.
PR: 1206
Obtained from: Basic SIGINT fix from Bruce Evans


# 3d7b5b93 18-May-1998 Philippe Charnier <charnier@FreeBSD.org>

Add rcsid. Spelling.


# 28701136 10-Nov-1997 Bruce Evans <bde@FreeBSD.org>

Fixed some type and value mismatches. setsignal() returned a bogusly
cast value that was always ignored. Rev.1.9 of trap.c made this
more bogus by returning a semantically different value after calling
siginterrupt(). Avoid these problems by not returning a value.


# 8dd81503 05-Nov-1997 Andrey A. Chernov <ache@FreeBSD.org>

1) Fix longstanding bug:
trap 'echo xxx' 1 2 3 15
read x
is not interrupted by ^C (due to restartable read syscall) and must be
interrupted per POSIX
Worse case:
read -t 5 x
hangs forever after ^C pressed (supposed to timeout after 5 secs)
Fixed by adding siginterrupt(signo, 1) after catch handler installed

2) Do not reinstall sighandler immediately after it is called,
BSD do it for us


# b97fa2ef 22-Feb-1997 Peter Wemm <peter@FreeBSD.org>

Revert $FreeBSD$ to $Id$


# 1130b656 14-Jan-1997 Jordan K. Hubbard <jkh@FreeBSD.org>

Make the long-awaited change from $Id$ to $FreeBSD$

This will make a number of things easier in the future, as well as (finally!)
avoiding the Id-smashing problem which has plagued developers for so long.

Boy, I'm glad we're not using sup anymore. This update would have been
insane otherwise.


# f98e1b80 24-Dec-1996 Steve Price <steve@FreeBSD.org>

With these changes sh(1)'s trap command should be POSIX-compliant,
while remaining (becoming :) compatible with other popular shells.
Specifically these changes include:

1) Implement 'trap -l' to get a list of valid signals names. This
is useful if you wanted to do something like reset all signal
handlers to there defaults values, in which case something like
this will do the trick.

trap `trap -l`

2) Reformat the output of 'trap' so it can be saved and later eval'd
to restore the saved settings.

3) Allow the use of signal names as well as signal numbers.

4) Fix trap handling of SIGCHLD so that commands like the following
(albeit, contrived) won't cause sh(1) to recurse ad infinitum.

trap uname 0 20

5) Make variables static that are used only in trap.c.

6) Minor 'style(9) police' mods.


# ab0a2172 13-Dec-1996 Steve Price <steve@FreeBSD.org>

Merge in NetBSD mods and -Wall cleaning.

Obtained from: NetBSD, me


# aa9caaf6 01-Sep-1996 Peter Wemm <peter@FreeBSD.org>

Merge of 4.4-Lite2 sh source, plus some gcc -Wall cleaning. This is a
merge of parallel duplicate work by Steve Price and myself. :-]

There are some changes to the build that are my fault... mkinit.c was
trying (poorly) to duplicate some of the work that make(1) is designed to
do. The Makefile hackery is my fault too, the depend list was incomplete
because of some explicit OBJS+= entries, so mkdep wasn't picking up their
source file #includes.

This closes a pile of /bin/sh PR's, but not all of them..

Submitted by: Steve Price <steve@bonsai.hiwaay.net>, peter


# 069428af 26-May-1996 Peter Wemm <peter@FreeBSD.org>

Import the 4.4BSD-Lite2 /bin/sh sources

Requested by: joerg

(Note, this is mostly going to be conflicts, which is expected. Our entire
sh source has a mainline, so this should not change anything except for
a few new files appearing. I dont think they are a problem)


# 2162b2d2 29-May-1995 Rodney W. Grimes <rgrimes@FreeBSD.org>

Remove trailing whitespace.

Reviewed by: phk


# 89730b29 23-Sep-1994 David Greenman <dg@FreeBSD.org>

Added $Id$


# 4b88c807 26-May-1994 Rodney W. Grimes <rgrimes@FreeBSD.org>

BSD 4.4 Lite bin Sources