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