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