config.tests/unix/makeabs
author Craig Heath <craigh@symbian.org>
Wed, 16 Jun 2010 16:18:05 +0100
branchGCC_SURGE
changeset 26 8776df5ac359
parent 0 1918ee327afb
permissions -rw-r--r--
Bug 2955. Workaround for lack of atomic operations in GCCE standard libraries (fall back to default use of Mutex)

#!/bin/sh

FILE="$1"
RES="$FILE"

CUT_ARG="-b1"
if [ `uname -s` = "QNX" ]; then
    # QNX does not understand "-b1"
    CUT_ARG="-c1"
fi

if [ `echo $FILE | cut $CUT_ARG` = "/" ]; then
    true
else
    RES="$PWD/$FILE"
    test -d "$RES" && RES="$RES/"
    RES=`echo "$RES" | sed "s,/\(\./\)*,/,g"`

# note: this will only strip 1 /path/../ from RES, i.e. given /a/b/c/../../../, it returns /a/b/../../
    RES=`echo "$RES" | sed "s,\(/[^/]*/\)\.\./,/,g"` 

    RES=`echo "$RES" | sed "s,//,/,g" | sed "s,/$,,"`
fi
echo $RES #return