summaryrefslogtreecommitdiffstats
path: root/docbook/sgml2man
blob: a7f71e21a28d10794dcc882d24cf994e426b1a46 (plain)
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
#!/bin/sh
#
# Copyright 2001-2002 Double Precision, Inc.  See COPYING for
# distribution information.

srcfile="$1"
dstfile="$2"

if test ! -f $srcfile
then
	echo "$srcfile: not found" >&2
	exit 1
fi

rm -rf $dstfile.tmpdir
mkdir -p $dstfile.tmpdir
xsltproc --nonet -o $dstfile.tmpdir/ /usr/share/sgml/docbook/xsl-stylesheets/manpages/docbook.xsl $srcfile

for f in $dstfile.tmpdir/*
do
    sed -n '1p' <$f >$dstfile.tmp
    sed -n '20,$d;/<!--/p' <$srcfile | sed 's/\"/ /g;s/^/\.\\\"/g' >>$dstfile.tmp || exit 1

    sed '1d' <$f >>$dstfile.tmp || exit 1
    mv $dstfile.tmp `basename $f` || exit 1
done

rm -rf $dstfile.tmpdir
#`dirname $0`/fixman "$srcfile" "$dstfile"