• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1#! /bin/sh
2
3program="$0"
4
5# Follow symlinks until we get to the actual file.
6while [ -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
17done
18
19# Assume findbugs home directory is the parent
20# of the directory containing the script (which should
21# normally be "$findbugs_home/bin").
22dir=`dirname "$program"`
23findbugs_home="$dir/.."
24
25# Handle FHS-compliant installations (e.g., Fink)
26if [ -d "$findbugs_home/share/findbugs" ]; then
27	findbugs_home="$findbugs_home/share/findbugs"
28fi
29
30# Make absolute
31findbugs_home=`cd "$findbugs_home" && pwd`
32
33fb_pathsep=':'
34
35# Handle cygwin, courtesy of Peter D. Stout
36fb_osname=`uname`
37if [ `expr "$fb_osname" : CYGWIN` -ne 0 ]; then
38	findbugs_home=`cygpath --mixed "$findbugs_home"`
39	fb_pathsep=';'
40fi
41# Handle MKS, courtesy of Kelly O'Hair
42if [ "${fb_osname}" = "Windows_NT" ]; then
43	fb_pathsep=';'
44fi
45
46if [ ! -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
51fi
52
53# Choose default java binary
54fb_javacmd=java
55if [ ! -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
61fi
62
63fb_mainclass=edu.umd.cs.findbugs.workflow.RejarClassesForAnalysis
64
65fb_javacmd=${fb_javacmd:-"java"}
66fb_maxheap=${fb_maxheap:-"-Xmx768m"}
67fb_appjar=${fb_appjar:-"$findbugs_home/lib/findbugs.jar"}
68set -f
69#echo command: \
70exec "$fb_javacmd" \
71	-classpath "$fb_appjar$fb_pathsep$CLASSPATH" \
72	-Dfindbugs.home="$findbugs_home"\
73	$fb_maxheap $fb_jvmargs $fb_mainclass ${@:+"$@"} $fb_appargs
74
75# vim:ts=3
76