#!/bin/sh
# Function to find the real directory a program resides in.
# Feb. 17, 2000 - Sam Lantinga, Loki Entertainment Software
FindPath()
{
fullpath="`echo $1 | grep /`"
if [ "$fullpath" = "" ]; then
oIFS="$IFS"
IFS=:
for path in $PATH
do if [ -x "$path/$1" ]; then
if [ "$path" = "" ]; then
path="."
fi
fullpath="$path/$1"
break
fi
done
IFS="$oIFS"
fi
if [ "$fullpath" = "" ]; then
fullpath="$1"
fi
# Is the awk/ls magic portable?
if [ -L "$fullpath" ]; then
fullpath="`ls -l "$fullpath" | awk '{print $11}'`"
fi
dirname $fullpath
}
if [ "${/usr/local/games/sof}" = "" ]; then
/usr/local/games/sof=`FindPath $0`
fi
# First needed for libTitan.so. Last needed for stupid
# crap in the game like "./ref_gl.so", etc.
LD_LIBRARY_PATH=${/usr/local/games/sof/}:.
export SOF_DATA_PATH
export LD_LIBRARY_PATH
if [ -x "${/usr/local/games/sof}/sof-bin" ]; then
exec ${/usr/local/games/sof}/sof-bin $*
fi
echo "Couldn't run Soldier of Fortune (sof-bin). Is SOF_DATA_PATH set?"
exit 1
if [ "${SOF_DATA_PATH}" = "" ]; then
SOF_DATA_PATH="/usr/local/sof"
fi