sh: Sync with FreeBSD:

* Expand assignment-like words specially for export/readonly/local.
* Remove unused variables.
* Reset pendingsigs before checking pending traps, not after.
* Track continued jobs (even if not continued by bg or fg).
* Inline waitproc() into its only caller.
* Fix EINTR race condition in "wait" and "set -T" using sigsuspend().
* use setinputfile instead of open/setinputfd.
* Prefer internal nextopt() to libc getopt().
* Use C99 flexible array instead of accessing array beyond bounds.
* Fix two issues when an alias is redefined.
* Detect and flag write errors on stdout in builtins.
* Prefer strsignal() to accessing sys_siglist directly.
* Don't lose $? when backquoted command ends with semicolon or newline.
* Fix crash when parsing '{ } &'.
* Pass $? to command substitution containing compound/multiple commands.
* Simplify cd-hash interaction.
* Remove mkinit's initialization routine.
* Move some stackmarks to fix high memory usage in some loops.
* Show negated commands (!) in jobs output.
* Prefer our character classification functions to <ctype.h>.
* Expand here documents in the current process.
* Do not test for digit_contig in mksyntax.
* Simplify mksyntax
* Fix a crash with the stackmark code.
* If a SIGINT or SIGQUIT interrupts "wait", return status 128+sig.
* When executing a trap, keep exit status along with evalskip.
* Update $FreeBSD$ to include SVN id.

Obtained-from:   FreeBSD