Home | History | Annotate | Download | only in bin
      1 #! /bin/sh
      2 
      3 program="$0"
      4 
      5 # Follow symlinks until we get to the actual file.
      6 while [ -h "$program" ]; do
      7 	link=`ls -ld "$program"`
      8 	link=`expr "$link" : '.*-> \(.*\)'`
      9 	if [ "`expr "$link" : '/.*'`" = 0 ]; then
     10 		# Relative
     11 		dir=`dirname "$program"`
     12 		program="$dir/$link"
     13 	else
     14 		# Absolute
     15 		program="$link"
     16 	fi
     17 done
     18 
     19 # Assume findbugs home directory is the parent
     20 # of the directory containing the script (which should
     21 # normally be "$findbugs_home/bin").
     22 dir=`dirname "$program"`
     23 findbugs_home="$dir/.."
     24 
     25 # Handle FHS-compliant installations (e.g., Fink)
     26 if [ -d "$findbugs_home/share/findbugs" ]; then
     27 	findbugs_home="$findbugs_home/share/findbugs"
     28 fi
     29 
     30 # Make absolute
     31 findbugs_home=`cd "$findbugs_home" && pwd`
     32 
     33 fb_pathsep=':'
     34 
     35 # Handle cygwin, courtesy of Peter D. Stout
     36 fb_osname=`uname`
     37 if [ `expr "$fb_osname" : CYGWIN` -ne 0 ]; then
     38 	findbugs_home=`cygpath --mixed "$findbugs_home"`
     39 	fb_pathsep=';'
     40 fi
     41 # Handle MKS, courtesy of Kelly O'Hair
     42 if [ "${fb_osname}" = "Windows_NT" ]; then
     43 	fb_pathsep=';'
     44 fi
     45 
     46 if [ ! -d "$findbugs_home" ]; then
     47 	echo "The path $findbugs_home,"
     48 	echo "which is where I think FindBugs is located,"
     49 	echo "does not seem to be a directory."
     50 	exit 1
     51 fi
     52 
     53 # Choose default java binary
     54 fb_javacmd=java
     55 if [ ! -z "$JAVA_HOME" ] && [ -x "$JAVA_HOME/bin/java" ]; then
     56 	if [ `expr "$fb_osname" : CYGWIN` -ne 0 ]; then
     57 		fb_javacmd=`cygpath --mixed "$JAVA_HOME"`/bin/java
     58 	else
     59 		fb_javacmd="$JAVA_HOME/bin/java"
     60 	fi
     61 fi
     62 
     63 fb_mainclass=edu.umd.cs.findbugs.visitclass.PrintClass
     64 
     65 fb_javacmd=${fb_javacmd:-"java"}
     66 fb_maxheap=${fb_maxheap:-"-Xmx768m"}
     67 fb_appjar=${fb_appjar:-"$findbugs_home/lib/findbugs.jar"}
     68 set -f
     69 #echo command: \
     70 exec "$fb_javacmd" \
     71 	-classpath "$fb_appjar$fb_pathsep$CLASSPATH" \
     72 	-Dfindbugs.home="$findbugs_home"\
     73 	$fb_maxheap $fb_jvmargs $fb_mainclass ${@:+"$@"} $fb_appargs
     74