#! /bin/sh
echo 'dude, assuming you are running this script from the ecos-docs/tcpip directory'
MANPAGE_LIST=`find manpages -type f -name '*.?'`
echo "MANPAGE_LIST is $MANPAGE_LIST"
echo 'removing the previous file tcpip-manpages.sgml'
/bin/rm -f tcpip-manpages.sgml
touch tcpip-manpages.sgml
echo '' >> tcpip-manpages.sgml
echo '' >> tcpip-manpages.sgml
echo '' >> tcpip-manpages.sgml
echo '' >> tcpip-manpages.sgml
echo >> tcpip-manpages.sgml
echo >> tcpip-manpages.sgml
echo "" >> tcpip-manpages.sgml
echo " TCP/IP Library Reference" >> tcpip-manpages.sgml
echo >> tcpip-manpages.sgml
echo >> tcpip-manpages.sgml
for manpage in $MANPAGE_LIST
do
echo "processing $manpage"
# get the title for this section
manpage_title=`egrep '^\.Dt' $manpage | awk '{print $2}' | tr 'A-Z' 'a-z'`
# note that _ is illegal in an id, so we canonicalize it to -
docbook_section_id=`echo $manpage_title | sed 's/_/-/g'`
# now prepare out a section and title
echo " " >> tcpip-manpages.sgml
echo " $manpage_title" >> tcpip-manpages.sgml
# we make it so that it is a monospaced font
echo " " >> tcpip-manpages.sgml
# now put the contents into this section
cat $manpage | groff -Tascii -mandoc | sed 's/\_\(.\)/\1/g' \
| sed 's/\(.\)\(.\)/\1/g' \
| sed 's/\&/\&/g' \
| sed 's/\</g' \
| sed 's/+o/o/g' >> tcpip-manpages.sgml
# now close out the section
echo " " >> tcpip-manpages.sgml
echo " " >> tcpip-manpages.sgml
echo >> tcpip-manpages.sgml
done
echo >> tcpip-manpages.sgml
echo "" >> tcpip-manpages.sgml
cat <> tcpip-manpages.sgml
EOF