1#! /bin/sh
2
3# Merge a historical bug collection and a bug collection, producing an updated
4# historical bug collection
5
6program="$0"
7
8# Follow symlinks until we get to the actual file.
9while [ -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
20done
21
22# Assume findbugs home directory is the parent
23# of the directory containing the script (which should
24# normally be "$findbugs_home/bin").
25dir=`dirname "$program"`
26findbugs_home="$dir/.."
27
28# Handle FHS-compliant installations (e.g., Fink)
29if [ -d "$findbugs_home/share/findbugs" ]; then
30	findbugs_home="$findbugs_home/share/findbugs"
31fi
32
33# Make absolute
34findbugs_home=`cd "$findbugs_home" && pwd`
35
36fb_pathsep=':'
37
38# Handle cygwin, courtesy of Peter D. Stout
39fb_osname=`uname`
40if [ `expr "$fb_osname" : CYGWIN` -ne 0 ]; then
41	findbugs_home=`cygpath --mixed "$findbugs_home"`
42	fb_pathsep=';'
43fi
44# Handle MKS, courtesy of Kelly O'Hair
45if [ "${fb_osname}" = "Windows_NT" ]; then
46	fb_pathsep=';'
47fi
48
49if [ ! -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
54fi
55
56# Choose default java binary
57fb_javacmd=java
58if [ ! -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
64fi
65
66fb_mainclass=edu.umd.cs.findbugs.workflow.Update
67
68fb_javacmd=${fb_javacmd:-"java"}
69fb_maxheap=${fb_maxheap:-"-Xmx768m"}
70fb_appjar=${fb_appjar:-"$findbugs_home/lib/findbugs.jar"}
71set -f
72#echo command: \
73exec "$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