cvsdist aeda1b0
#! /bin/sh
cvsdist f00d7fd
cvsdist f00d7fd
ADMON_GRAPHICS=/usr/share/sgml/docbook/dsssl-stylesheets/images/*.gif
cvsdist f00d7fd
cvsdist aeda1b0
output=docbook2html-dir
cvsdist aeda1b0
skip=0
e1c4ee3
dbdircleanup=1
b6ea8c1
outputdone=0
cvsdist f00d7fd
for arg in "$@"
cvsdist aeda1b0
do
cvsdist aeda1b0
  if [ $skip -gt 0 ]
cvsdist aeda1b0
  then
cvsdist aeda1b0
    skip=$(($skip - 1))
cvsdist aeda1b0
    continue
cvsdist aeda1b0
  fi
cvsdist aeda1b0
  case $arg in
cvsdist aeda1b0
  -h|--help|-v|--version)	break
cvsdist aeda1b0
				;;
cvsdist aeda1b0
  -n|--nostd|-u|--nochunks)	;;
b6ea8c1
  -o|--output)   outputdone=1
b6ea8c1
	         ;;
b6ea8c1
cvsdist aeda1b0
  -*)				skip=1
cvsdist aeda1b0
				;;
b6ea8c1
  *)    dbdircleanup=0
b6ea8c1
        if [ ${outputdone} -eq 1 ];
b6ea8c1
        then
b6ea8c1
          output="$(echo $arg | sed 's,\.sgml$,,;s,\.sgm$,,;s,\.xml,,')"
b6ea8c1
          outputfile="$basename "$output""
b6ea8c1
          outputdone=2
b6ea8c1
        elif [ ${outputdone} -eq 2 ];
b6ea8c1
        then
b6ea8c1
          outputfile="$(echo $arg | sed 's,\.sgml$,,;s,\.sgm$,,;s,\.xml,,' | \
b6ea8c1
                      rev | cut -d'/' -f1 | rev)"
b6ea8c1
        else
b6ea8c1
          output="$(echo $arg | sed 's,\.sgml$,,;s,\.sgm$,,;s,\.xml,,')"
b6ea8c1
          outputfile=$(basename "$output")
b6ea8c1
        fi
cvsdist aeda1b0
	;;
cvsdist aeda1b0
  esac
cvsdist aeda1b0
done
b6ea8c1
b6ea8c1
if [ ${dbdircleanup} -eq 0 ];
b6ea8c1
then
b6ea8c1
  echo "Output is $output/$outputfile.html"
b6ea8c1
fi
cvsdist aeda1b0
if [ -d ${output} ]
cvsdist aeda1b0
then
cvsdist aeda1b0
  rm -rf ${output}.junk
cvsdist aeda1b0
  mv ${output} ${output}.junk
cvsdist aeda1b0
fi
cvsdist aeda1b0
mkdir ${output}
cvsdist f00d7fd
mkdir ${output}/stylesheet-images
cvsdist f00d7fd
cp ${ADMON_GRAPHICS} ${output}/stylesheet-images
cvsdist aeda1b0
jw -f docbook -b html -o ${output} "$@"
e1c4ee3
if [ ${dbdircleanup} -eq 1 ];
e1c4ee3
then
e1c4ee3
  rm -rf ${output}
e1c4ee3
fi