sh: Fix two bugs with case and exit status:
authorPeter Avalos <pavalos@dragonflybsd.org>
Sun, 5 Feb 2012 20:02:44 +0000 (12:02 -0800)
committerPeter Avalos <pavalos@dragonflybsd.org>
Sun, 5 Feb 2012 21:03:59 +0000 (13:03 -0800)
commitd5beb8994c44107c3b207ae708c92dee6ef81740
tree5f8cf2c980ffaf725c0204891b02165eb0585f94
parent576c94488d6fdde8335abc5f77a758c70f0dcba0
sh: Fix two bugs with case and exit status:

* If no pattern is matched, POSIX says the exit status shall be 0 (even if
  there are command substitutions).
* If a pattern is matched and there are no command substitutions, the first
  command should see the $? from before the case command, not always 0.

Obtained-from:  FreeBSD 230154
(cherry picked from commit c79cd3b3a40bbcea12f869fee83c021fc6c8bf90)
bin/sh/eval.c
tools/regression/bin/sh/builtins/case14.0 [new file with mode: 0644]
tools/regression/bin/sh/builtins/case15.0 [new file with mode: 0644]
tools/regression/bin/sh/builtins/case16.0 [new file with mode: 0644]