#! /bin/sh

ADMON_GRAPHICS=/usr/share/sgml/docbook/dsssl-stylesheets/images/*.gif

output=docbook2html-dir
skip=0
for arg in "$@"
do
  if [ $skip -gt 0 ]
  then
    skip=$(($skip - 1))
    continue
  fi
  case $arg in
  -h|--help|-v|--version)	break
				;;
  -n|--nostd|-u|--nochunks)	;;
  -*)				skip=1
				;;
  *)	output="$(echo $arg | sed 's,\.sgml$,,;s,\.sgm$,,;s,\.xml,,')"
	echo "output is $output"
	break
	;;
  esac
done
if [ -d ${output} ]
then
  rm -rf ${output}.junk
  mv ${output} ${output}.junk
fi
mkdir ${output}
mkdir ${output}/stylesheet-images
cp ${ADMON_GRAPHICS} ${output}/stylesheet-images
jw -f docbook -b html -o ${output} "$@"
