#!/usr/local/gnu/bin/bash 
# Tiny script which opens a netscape fed by the html output of axsvg.jar,
# a program dealing with Accessibilty features embedded in SVG files
# See http://www.w3.org/WAI/ER/Asvg/ for further details.


# Sets the dir where you placed the two required files: axsvg.jar and
# axsvg-schema.rdf :
FILES=~/axsvg-files/;
# Sets the browser you want to use for viewing the html output
BROWSER=amaya;

CURRENT=`pwd`;
TEMP=~/tempdescription.html;
ERROR=~/erroroutput.tmp;

if [ !  $# = 1 ] || [ $1 = '-h' ] || [ $1 = '--help' ]; then
	echo "Usage: hdesc SvgFile";	
else
	if test -f $1; then
		echo "Starting Java Virtual Machine...";
		cd $FILES;
		java -jar axsvg.jar -h $CURRENT/$1 > $TEMP 2> $ERROR;
		cd $CURRENT;
		echo "File processed";
		if test -s $ERROR; then
			cat $ERROR;
			rm -f $ERROR;
			rm -f $TEMP;
		else
			rm -f $ERROR;
			echo "Starting $BROWSER...";
			$BROWSER $TEMP;
			rm -f $TEMP;
		fi
	else
		echo "File $1 not found";
	fi
fi

