#!/bin/sh
if [ $# -lt 1 ] ; then
   echo "Usage: $0 <program [program parameters]>"
   exit 1
fi

# this looks in the same directory, this
# LeakCheck script resides; modify to your
# needs:
SHLIB=`dirname $0`/LeakTracer.so
if [ ! -x $SHLIB ] ; then
    echo "$SHLIB not found"
    exit 1
fi

if [ -z "$LEAKTRACE_FILE" ] ; then
    rm -f leak.out
else
    rm -f "$LEAKTRACE_FILE"
fi
export LD_PRELOAD=$SHLIB
exec $@
