51 lines
1.5 KiB
Bash
51 lines
1.5 KiB
Bash
#!/bin/sh
|
|
#
|
|
# docbook2man - An SGML docbook to man pages converter using sgmlspl
|
|
#
|
|
# Copyright (c) 2005 by Silvan Calarco <silvan.calarco@qilinux.it>
|
|
#
|
|
# This program is free software; you can redistribute it and/or modify
|
|
# it under the terms of the GNU General Public License as published by
|
|
# the Free Software Foundation; either version 2 of the License, or
|
|
# (at your option) any later version.
|
|
#
|
|
# This program is distributed in the hope that it will be useful,
|
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
# GNU General Public License for more details.
|
|
|
|
function usage() {
|
|
echo "\
|
|
docbook2man - An SGML docbook to man pages converter using sgmlspl
|
|
Copyright (c) 2005 by Silvan Calarco <silvan.calarco@qilinux.it>
|
|
|
|
usage: docbook2man sourcefile [sourcefile...]
|
|
sourcefile: the SGML source file for man pages
|
|
" >&2
|
|
}
|
|
|
|
SOURCEFILES=
|
|
|
|
while test -n "$1" ; do
|
|
case $1 in
|
|
-h) usage; exit ;;
|
|
*) SOURCEFILES="$SOURCEFILES $1" ;;
|
|
esac
|
|
shift
|
|
done
|
|
|
|
[ "$SOURCEFILES" ] || { usage; exit 1; }
|
|
|
|
tmpfile=`mktemp -q -t ${0##*/}.XXXXXXXX` ||
|
|
{ echo "${0##*/}: error: cannot create temporary files." >&2
|
|
{ (exit 1); exit 1; }; }
|
|
|
|
trap "rm -f $tmpfile" 0 1 2 5 15
|
|
|
|
for source in $SOURCEFILES; do
|
|
/usr/bin/onsgmls $source > $tmpfile || \
|
|
{ echo "Error $? parsing SGML document; aborting." >&2; exit 1; }
|
|
/usr/bin/sgmlspl /usr/bin/docbook2man-spec.pl < $tmpfile > /dev/null || \
|
|
{ echo "Error $? converting $source; aborting." >&2; exit 1; }
|
|
done
|