Use -s to flag POSIX's "special built-in" utilities in builtins.def. Add a
authorPeter Avalos <pavalos@dragonflybsd.org>
Sun, 7 Jan 2007 01:14:53 +0000 (01:14 +0000)
committerPeter Avalos <pavalos@dragonflybsd.org>
Sun, 7 Jan 2007 01:14:53 +0000 (01:14 +0000)
commit0d5aaed62b36690d9c5daabebe8cc3e3ad8eb8d6
treee897e0a3d9c6f847d56da37d24e35f68ca2e2b25
parent60297eb49982b93bbcacac8f0defe0f04718ed91
Use -s to flag POSIX's "special built-in" utilities in builtins.def.  Add a
new member to struct builtincmd and set it to 1 if -s was specified.  This
is done because there are cases where special builtins must be treated
differently from other builtins.

Implement some of the differences between special built-ins and other builtins
demanded by POSIX.
- A redirection error is only fatal (meaning the execution of a shell script is
  terminated) for special built-ins.  Previously it was fatal for all shell
  builtins, causing problems like the one reported in FreeBSD PR 88845.
- Variable assignments remain in effect for special built-ins.
- Option or operand errors are only fatal for special built-ins.

Add the times builtin.  It reports the user and system time for the shell
itself and its children.  Instead of calling times() (as implied by POSIX) this
implementation directly calls getrusage() to get the times because this is more
convenient.

Print pointers with %p rather than casting them to long.

Replace home-grown dup2() implementation with actual dup2() calls.  This
should slightly reduce the number of system calls in critical portions of
the shell, and select a more efficient path through the fdalloc code.

Implement the PS4 variable which is defined by the POSIX User Portability
Utilities option.  Its value is printed at the beginning of the line if tracing
(-x) is active.  PS4 defaults to the string "+ " which is compatible with the
old behaviour to always print "+ ".

Don't crash on "<cmd> | { }".

Remove some white space at EOL.

Add the POSIX options -v and -V to the 'command' builtin.  Both describe the
type of their argument, if it is a shell function, an alias, a builtin, etc.
-V is more verbose than -v.

Do not assume there is only a space between #define and the macro name
when grepping for JOBS in mkbuiltins

Obtained-from:  FreeBSD
bin/sh/builtins.def
bin/sh/eval.c
bin/sh/eval.h
bin/sh/exec.c
bin/sh/exec.h
bin/sh/mkbuiltins
bin/sh/options.c
bin/sh/sh.1
bin/sh/var.c
bin/sh/var.h