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