#!/bin/sh
BASE=`basename $1 .fig`
EPSTOGIFFROM=$BASE.eps
EPSTOGIFTO=`basename $2 .fig`.gif
cat > /tmp/mk$$ <<EOF
GS_LIB=/usr/lib/sdc/bin

$EPSTOGIFTO: $1
	fig2dev -L ps $1 $EPSTOGIFFROM
	/usr/lib/sdc/bin/pstogif $EPSTOGIFFROM \$@ >/dev/null 2>/dev/null
	# Now attempt to make the white invisible
	-(giftrans -t "#ffffff" -o \$@.1 \$@ && mv -f \$@.1 \$@)
EOF
make -f /tmp/mk$$ 1>&2
rm -f /tmp/mk$$ $EPSTOGIFFROM
echo "<IMG SRC=" \"$EPSTOGIFTO\" ">"