1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84
|
#!/bin/sh
set -e
PATH=@@@pathlibdir@@@:$PATH
export PATH
[ "$DEBIANDOCSGMLSPEC" ] || DEBIANDOCSGMLSPEC=@@@speclibdir@@@
export DEBIANDOCSGMLSPEC
PERL5LIB=@@@speclibdir@@@:$PERL5LIB
export PERL5LIB
usageversion () {
cat >&2 <<'END'
debiandoc2@@@type@@@ version 1.1
Copyright (C) 1998 Ardo van Rangelrooij
Copyright (C) 1996 Ian Jackson
This is free software; see the GNU General Public Licence
version 2 or later for copying conditions. There is NO warranty.
usage: debiandoc2@@@type@@@ [options] <filename>.sgml
options: -k keep intermediate files
@@@stdout@@@
-O send output to stdout instead of <filename>.@@@type@@@
@@@endstdout@@@
END
}
usageerror () { echo >&2 "debiandoc2@@@type@@@: $@"; exit 2; }
keep=false
stdout=false
while [ $# != 0 ]
do
case "$1" in
-k) keep=true ;;
@@@stdout@@@
-O) stdout=true ;;
@@@endstdout@@@
-?*) usageerror "unknown option \`$1'" ;;
--) shift; break ;;
*) break ;;
esac
shift
done
[ $# = 1 ] || usageerror "need exactly one input filename"
case "$1" in
-) nsgmlsi="-"
@@@stdout@@@
stdout=true
@@@endstdout@@@
$stdout || usageerror "stdin not allowed with debiandoc2@@@type@@@"
! $keep || usageerror "-k not allowed with input from stdin"
;;
-?*) nsgmlsi="./$1"
bn="`basename \"$1\" .sgml`"
;;
*) nsgmlsi="$1"
bn="`basename \"$1\" .sgml`"
;;
esac
case "$bn" in -*) bn="./$bn" ;; esac
tf1="$bn.sasp"
tf2="$bn.sasp-@@@sasp@@@"
tf3="$bn.sasp-@@@sasp@@@2"
nsgmls -l "$nsgmlsi" >"$tf1"
saspconvert @@@toc@@@ <"$tf1" >"$tf2"
saspconvert2 @@@fnotes@@@ <"$tf2" >"$tf3"
@@@stdout@@@
$stdout || exec >"$bn.@@@type@@@"
@@@endstdout@@@
sgmlspl "$DEBIANDOCSGMLSPEC"/@@@spec@@@ "@@@argument@@@" <"$tf3"
if ! $keep
then
rm -f $tf1 $tf2 $tf3
fi
|