From dd297f92d257c8d6487d5af9d29228db2fb68519 Mon Sep 17 00:00:00 2001 From: Ted Ross Date: Mon, 30 Nov 2009 15:16:21 +0000 Subject: Simplified the normalize function (as suggested by aconway) to be compatible with older shells. git-svn-id: https://svn.apache.org/repos/asf/qpid/trunk/qpid@885443 13f79535-47bb-0310-9956-ffa450edef68 --- cpp/examples/verify | 17 +++++------------ 1 file changed, 5 insertions(+), 12 deletions(-) (limited to 'cpp/examples') diff --git a/cpp/examples/verify b/cpp/examples/verify index da37857b1a..c8d1d3dfcd 100755 --- a/cpp/examples/verify +++ b/cpp/examples/verify @@ -75,22 +75,15 @@ outputs() { done } -function normalize() { - local path=${1//\/.\//\/}\/ - while [[ $path =~ ([^/][^/]*/\.\./) ]] - do - path=${path/${BASH_REMATCH[0]}/} - done - echo $path | sed 's/\/$//' -} +normalize() { echo `cd $1 && pwd`; } verify() { FAIL= - arg=$(normalize $1) + arg=$1 srcdir=$(normalize $2) builddir=$(normalize $3) - if [ -d $arg ]; then dir=$arg; script=verify; - else dir=`dirname $arg`; script=`basename $arg`; fi + if [ -d $arg ]; then dir=$(normalize $arg); script=verify; + else dir=$(normalize `dirname $arg`); script=`basename $arg`; fi # if the example is in the "cpp" area, make sure we run from the build directory, not the source dir. rundir=${dir/$srcdir\/cpp/$builddir/} @@ -120,7 +113,7 @@ topbuilddir=$2 shift 2 for example in "$@"; do - echo "== $(normalize $example)" + echo "== $example" if ( verify $example $topsrcdir $topbuilddir; ) then echo "PASS"; else echo "FAIL"; RET=1; fi done exit $RET -- cgit v1.2.1