sh: Fix some bugs with exit status from case containing ;&.
authorPeter Avalos <pavalos@dragonflybsd.org>
Sun, 5 Feb 2012 20:04:53 +0000 (12:04 -0800)
committerPeter Avalos <pavalos@dragonflybsd.org>
Sun, 5 Feb 2012 21:04:01 +0000 (13:04 -0800)
commit4181c918716ab3dbca834e418290b3f961fd9bbc
tree50022586c538230d348e7c8ef9cbd5049ea6d8f4
parentd5beb8994c44107c3b207ae708c92dee6ef81740
sh: Fix some bugs with exit status from case containing ;&.

Also, rework evalcase() to not evaluate any tree. Instead, return the
NCLISTFALLTHRU node and handle it in evaltree().

Fixed bugs:

* If a ;& list with non-zero exit status is followed by an empty ;; or final
  list, the exit status of the case command should be equal to the exit
  status of the ;& list, not 0.

* An empty ;& case should not reset $?.

Obtained-from:  FreeBSD 230161
(cherry picked from commit b88d2fafe2e2a6d776e70cb6d6cca1533087b699)
bin/sh/eval.c
tools/regression/bin/sh/builtins/case17.0 [new file with mode: 0644]
tools/regression/bin/sh/builtins/case18.0 [new file with mode: 0644]
tools/regression/bin/sh/builtins/case19.0 [new file with mode: 0644]