initial commit: mime detection for programming files
[MIME_Type_PlainDetect.git] / tests / files / sh / file
1 #!/bin/sh
2
3 # Function to find the real directory a program resides in.
4 # Feb. 17, 2000 - Sam Lantinga, Loki Entertainment Software
5 FindPath()
6 {
7     fullpath="`echo $1 | grep /`"
8     if [ "$fullpath" = "" ]; then
9         oIFS="$IFS"
10         IFS=:
11         for path in $PATH
12         do if [ -x "$path/$1" ]; then
13             if [ "$path" = "" ]; then
14                 path="."
15             fi
16             fullpath="$path/$1"
17             break
18         fi
19     done
20     IFS="$oIFS"
21     fi
22     if [ "$fullpath" = "" ]; then
23         fullpath="$1"
24     fi
25
26     # Is the sed/ls magic portable?
27     if [ -L "$fullpath" ]; then
28         #fullpath="`ls -l "$fullpath" | awk '{print $11}'`"
29         fullpath=`ls -l "$fullpath" |sed -e 's/.* -> //' |sed -e 's/\*//'`
30     fi
31     dirname $fullpath
32 }
33
34
35 here="`FindPath $0`"
36 echo $here
37 if [ ! -f "$here/lib/patch.dat" ] ; then 
38         echo "$0: Fatal error: missing data files (*.dat) in $here/lib"
39         echo "If you have just installed the patch to the full version of the game"
40         echo "you will need to copy *.dat from your existing uplink installation"
41         exit 1
42 fi
43 export LD_LIBRARY_PATH="$here/lib:$LD_LIBRARY_PATH"
44 $here/lib/uplink.bin.x86 "$@"