From 5f52223f6088b971c2ebfa3f7b4ab0199fbfca59 Mon Sep 17 00:00:00 2001 From: "tony@chromium.org" Date: Tue, 11 Dec 2012 18:00:15 +0000 Subject: [PATCH] Clean up the style in the ninja shell wrapper. Use case rather than inconsistently using [ and [[. Review URL: https://chromiumcodereview.appspot.com/11522008 git-svn-id: svn://svn.chromium.org/chrome/trunk/tools/depot_tools@172343 0039d316-1c4b-4281-b951-d872f2087c98 --- ninja | 36 +++++++++++++++--------------------- 1 file changed, 15 insertions(+), 21 deletions(-) diff --git a/ninja b/ninja index e4e710e393..b9cd0d1b20 100755 --- a/ninja +++ b/ninja @@ -7,24 +7,18 @@ OS="$(uname -s)" THIS_DIR="$(dirname "${0}")" -if [ "${OS}" = "Linux" ]; then - machine=$(getconf LONG_BIT) - if [[ "$machine" = "64" ]]; then - exec "${THIS_DIR}/ninja-linux64" "$@" - elif [[ "$machine" = "32" ]]; then - exec "${THIS_DIR}/ninja-linux32" "$@" - else - echo Unknown architecture \($machine\) -- unable to run ninja. - exit 1 - fi -elif [ "${OS}" = "Darwin" ]; then - exec "${THIS_DIR}/ninja-mac" "$@" -elif [[ ${OS} == CYGWIN* ]]; then - exec cmd.exe /c `cygpath -t windows $0`.exe "$@" -elif [[ ${OS} == MINGW32* ]]; then - cmd.exe //c $0.exe "$@" -else - echo "Unsupported OS ${OS}" - exit 1 -fi - +case "$OS" in + Linux) + MACHINE=$(getconf LONG_BIT) + case "$MACHINE" in + 32|64) exec "${THIS_DIR}/ninja-linux${MACHINE}" "$@";; + *) echo Unknown architecture \($MACHINE\) -- unable to run ninja. + exit 1;; + esac + ;; + Darwin) exec "${THIS_DIR}/ninja-mac" "$@";; + CYGWIN*) exec cmd.exe /c $(cygpath -t windows $0).exe "$@";; + MINGW32*) cmd.exe //c $0.exe "$@";; + *) echo "Unsupported OS ${OS}" + exit 1;; +esac