#!/bin/sh

libdir=@LIBDIR@
PL=@PL@

case "$1" in
    -pl)
	goal=welcome
	toplevel=prolog
	;;
    *)
	in=`echo "$1" | sed 's/\.tex$//'`
	if [ -z "$in" ]; then
	    echo "Usage: $0 file"
	    echo "   or: $0 -pl"
	    exit 1
	fi
	goal="latex2html('$in')"
	toplevel=halt
	;;
esac

$PL -L0 -G0 -T0 \
    -f none \
    -p library=$libdir \
    -g "load_files(library(latex2html),[silent(true)]),$goal" \
    -t "$toplevel"
