#! /bin/sh
prg="mgp2html"
mgp=$(which mgp)
fmt="png"
if [ $# -ne 1 ] || [ ! -f $1 ] || [ $1 = "default.mgp" ]; then
    echo "Usage: $prg <filenmae>"
    exit 1
fi
f="$1"
d=${f%%.mgp}
if [ ! -d $d ] && [ ! -f $d ]; then
    mkdir -p $d
fi
$mgp -E $fmt -D $d $f
exit 0
