sh: Save/restore changed variables in optimized command substitution.
authorPeter Avalos <pavalos@dragonflybsd.org>
Sun, 21 Aug 2011 20:54:19 +0000 (13:54 -0700)
committerPeter Avalos <pavalos@dragonflybsd.org>
Sun, 21 Aug 2011 20:54:19 +0000 (13:54 -0700)
commit329310630e302987fe923eb19b075d3cdd16a9f6
tree6a8fe7a581e33b738b2fa4f671539fc1ea514a0a
parent24fd06d29173f5a899b47eea7bbe7b75862f8cf5
sh: Save/restore changed variables in optimized command substitution.

In optimized command substitution, save and restore any variables
changed by expansions (${var=value} and $((var=assigned))), instead of
trying to determine if an expansion may cause such changes.

If $! is referenced in optimized command substitution, do not cause jobs
to be remembered longer.

This fixes $(jobs $!) again, simplifies the man page and shortens the
code.

Obtained-from:   FreeBSD 223024
bin/sh/eval.c
bin/sh/expand.c
bin/sh/expand.h
bin/sh/jobs.c
bin/sh/sh.1
bin/sh/var.c
bin/sh/var.h