# Shell script fragment to infer the location of # $FINDBUGS_HOME and assign it to the findbugs_home shell # variable. Also sets the fb_osname shell variable, # as the output of uname. script.get.fbhome=\ program="$0"\n\ \n\ # Follow symlinks until we get to the actual file.\n\ while [ -h "$program" ]; do\n\ \tlink=`ls -ld "$program"`\n\ \tlink=`expr "$link" : '.*-> \\(.*\\)'`\n\ \tif [ "`expr "$link" : '/.*'`" = 0 ]; then\n\ \t\t# Relative\n\ \t\tdir=`dirname "$program"`\n\ \t\tprogram="$dir/$link"\n\ \telse\n\ \t\t# Absolute\n\ \t\tprogram="$link"\n\ \tfi\n\ done\n\ \n\ # Assume findbugs home directory is the parent\n\ # of the directory containing the script (which should\n\ # normally be "$findbugs_home/bin").\n\ dir=`dirname "$program"`\n\ findbugs_home="$dir/.."\n\ \n\ # Handle FHS-compliant installations (e.g., Fink)\n\ if [ -d "$findbugs_home/share/findbugs" ]; then\n\ \tfindbugs_home="$findbugs_home/share/findbugs"\n\ fi\n\ \n\ # Make absolute\n\ findbugs_home=`cd "$findbugs_home" && pwd`\n\ \n\ fb_pathsep=':'\n\ \n\ # Handle cygwin, courtesy of Peter D. Stout\n\ fb_osname=`uname`\n\ if [ `expr "$fb_osname" : CYGWIN` -ne 0 ]; then\n\ \tfindbugs_home=`cygpath --mixed "$findbugs_home"`\n\ \tfb_pathsep=';'\n\ fi\n\ # Handle MKS, courtesy of Kelly O'Hair\n\ if [ "${fb_osname}" = "Windows_NT" ]; then\n\ \tfb_pathsep=';'\n\ fi\n\ \n\ if [ ! -d "$findbugs_home" ]; then\n\ \techo "The path $findbugs_home,"\n\ \techo "which is where I think FindBugs is located,"\n\ \techo "does not seem to be a directory."\n\ \texit 1\n\ fi # Define the escape_arg function, which turns an arbitrary string into # a escaped version that may be appended to an argument list. # No quotes should be used in the construction of the # argument list string. Escapes (backslashes) are added where needed # to preserve spaces, quote characters, and special characters inside # the single argument being added. # # Usage: # my_args="$my_args `escape_arg "$first_arg"`" # my_args="$my_args `escape_arg "$second_arg"`" # ... # exec java -Xmx584m $main_class $my_args # # Bourne shell programming really, really sucks. script.define.escape_arg=\ escape_arg() {\n\ \techo "$1" | sed -e "s,\\\\([\\\\\\"' \t]\\\\),\\\\\\\\\\\\1,g"\n\ } # Pick a default Java executable. # This should be done before executing any code that # could override fb_javacmd. script.set.default.java=\ # Choose default java binary\n\ fb_javacmd=java\n\ if [ ! -z "$JAVA_HOME" ] && [ -x "$JAVA_HOME/bin/java" ]; then\n\ \tif [ `expr "$fb_osname" : CYGWIN` -ne 0 ]; then\n\ \t\tfb_javacmd=`cygpath --mixed "$JAVA_HOME"`/bin/java\n\ \telse\n\ \t\tfb_javacmd="$JAVA_HOME/bin/java"\n\ \tfi\n\ fi # Fragment to execute java, using the arguments stored # in the shell's $@ variable (and/or in the $fb_appargs variable). # Unless fb_appjar is specified, assumes the class to be executed # is in $findbugs_home/lib/findbugs.jar. script.wrap.java=\ fb_javacmd=\${fb_javacmd:-"java"}\n\ fb_maxheap=\${fb_maxheap:-"-Xmx768m"}\n\ fb_appjar=\${fb_appjar:-"$findbugs_home/lib/findbugs.jar"}\n\ set -f\n\ #echo command: \\\n\ exec "$fb_javacmd" \\\n\ \t-classpath "$fb_appjar$fb_pathsep$CLASSPATH" \\\n\ \t-Dfindbugs.home="$findbugs_home"\\\n\ \t$fb_maxheap $fb_jvmargs $fb_mainclass \${@:+"$@"} $fb_appargs # Fragment to execute java, using -jar $fb_appjar. script.wrap.jar=\ fb_javacmd=\${fb_javacmd:-"java"}\n\ fb_maxheap=\${fb_maxheap:-"-Xmx768m"}\n\ fb_appjar=\${fb_appjar:-"$findbugs_home/lib/findbugs.jar"}\n\ set -f\n\ #echo command: \\\n\ exec "$fb_javacmd" \\\n\ \t-Dfindbugs.home="$findbugs_home"\\\n\ \t$fb_maxheap $fb_jvmargs \\\n\ \t-jar "$fb_appjar"\\\n\ \t\${@:+"$@"} $fb_appargs