#!/bin/bash
echo Rebuilding the documentation directory...
# Don't want them to be world or group writable
umask 002
# Clean out the documentation directory...
# Don't do this by default as it could be dangerous to some people...
# rm ../docs/*
# Top level files
cat templ/header.txt templ/links.txt templ/title.txt src/doc-index.body templ/footer.txt > ../docs/doc-index.html
# Installation files
cat templ/header.txt templ/links-install.txt templ/title.txt src/install-index.body templ/footer.txt > ../docs/install-index.html
# Configuration files
#-----------------------------------------------------------------------------
# Build the generic flag list body.
#-----------------------------------------------------------------------------
FLAGS=`ls src/genflags | grep -v CVS`
./header "Generic Object: Flags" > tmp/config-genflags.body
echo "
| Name of Flag | Description |
" >> tmp/config-genflags.body
for flag in $FLAGS
do
echo "| ${flag} | `cat src/genflags/${flag}` |
" >> tmp/config-genflags.body
done
echo "
" >> tmp/config-genflags.body
#-----------------------------------------------------------------------------
#-----------------------------------------------------------------------------
# Build the ship flag list body.
#-----------------------------------------------------------------------------
FLAGS=`ls src/shipflags | grep -v CVS`
./header "Ships and Bases: Flags" > tmp/config-shipflags.body
echo "
| Name of Flag | Description |
" >> tmp/config-shipflags.body
for flag in $FLAGS
do
echo "| ${flag} | `cat src/shipflags/${flag}` |
" >> tmp/config-shipflags.body
done
echo "
" >> tmp/config-shipflags.body
#-----------------------------------------------------------------------------
cat templ/header.txt templ/links-config.txt templ/title.txt src/config-index.body templ/footer.txt > ../docs/config-index.html
cat templ/header.txt templ/links-config.txt templ/title.txt src/config-consoles.body templ/footer.txt > ../docs/config-consoles.html
cat templ/header.txt templ/links-config.txt templ/title.txt src/config-generic.body templ/footer.txt > ../docs/config-generic.html
cat templ/header.txt templ/links-config.txt templ/title.txt tmp/config-genflags.body templ/footer.txt > ../docs/config-genflags.html
cat templ/header.txt templ/links-config.txt templ/title.txt src/config-ships.body templ/footer.txt > ../docs/config-ships.html
cat templ/header.txt templ/links-config.txt templ/title.txt tmp/config-shipflags.body templ/footer.txt > ../docs/config-shipflags.html
cat templ/header.txt templ/links-config.txt templ/title.txt src/config-shipdamage.body templ/footer.txt > ../docs/config-shipdamage.html
# Coordinate files
cat templ/header.txt templ/links-coords.txt templ/title.txt src/coords-index.body templ/footer.txt > ../docs/coords-index.html
# Event files
cat templ/header.txt templ/links-events.txt templ/title.txt src/events-index.body templ/footer.txt > ../docs/events-index.html
cat templ/header.txt templ/links-events.txt templ/title.txt src/events-combat.body templ/footer.txt > ../docs/events-combat.html
cat templ/header.txt templ/links-events.txt templ/title.txt src/events-contact.body templ/footer.txt > ../docs/events-contact.html
cat templ/header.txt templ/links-events.txt templ/title.txt src/events-land.body templ/footer.txt > ../docs/events-land.html
cat templ/header.txt templ/links-events.txt templ/title.txt src/events-misc.body templ/footer.txt > ../docs/events-misc.html
# Spacecall files
#-----------------------------------------------------------------------------
# Build the alphabetical spacecall list body.
#-----------------------------------------------------------------------------
FLAGS=`ls src/sc | grep -v CVS`
CALLS="sc-alpha sc-object sc-coding sc-comm sc-util sc-nav sc-shield sc-damcon sc-trans sc-shipmisc sc-eng sc-tac"
./header "Spacecalls: Alphabetical" > tmp/sc-alpha.body
./header "Spacecalls: Object Calls" > tmp/sc-object.body
./header "Spacecalls: Miscellaneous Coding Calls" > tmp/sc-coding.body
./header "Spacecalls: Communication Console Calls" > tmp/sc-comm.body
./header "Spacecalls: Utility Calls" > tmp/sc-util.body
./header "Spacecalls: Navigation Console Calls" > tmp/sc-nav.body
./header "Spacecalls: Shield Console Calls" > tmp/sc-shield.body
./header "Spacecalls: Damage Control Console Calls" > tmp/sc-damcon.body
./header "Spacecalls: Transporter Console Calls" > tmp/sc-trans.body
./header "Spacecalls: General Console Calls" > tmp/sc-shipmisc.body
./header "Spacecalls: Engineering Console Calls" > tmp/sc-eng.body
./header "Spacecalls: Tactical Console Calls" > tmp/sc-tac.body
for file in $CALLS
do
echo "
| Spacecall | Return Value | Object | Ship |
" >> tmp/${file}.body
done
for flag in $FLAGS
do
KEYS=`head -n 1 src/sc/${flag}`
NAME=`head -n 2 src/sc/${flag} | tail -n 1`
RTRN=`head -n 3 src/sc/${flag} | tail -n 1`" "
DESC=`tail -n +4 src/sc/${flag}`
OBJF=" "
SHIPF=" "
echo "${KEYS}" | grep "OBJECT" > /dev/null
if test "$?" = "0"
then
OBJF="X"
fi
echo "${KEYS}" | grep "SHIP" > /dev/null
if test "$?" = "0"
then
SHIPF="X"
fi
# Alphabetical listing
echo "| ${flag}${NAME} | ${RTRN} | ${OBJF} | ${SHIPF} |
" >> tmp/sc-alpha.body
echo "| ${DESC} |
" >> tmp/sc-alpha.body
echo "${KEYS}" | grep "SCOBJ" > /dev/null
if test "$?" = "0"
then
echo "| ${flag}${NAME} | ${RTRN} | ${OBJF} | ${SHIPF} |
" >> tmp/sc-object.body
echo "| ${DESC} |
" >> tmp/sc-object.body
fi
echo "${KEYS}" | grep "CODING" > /dev/null
if test "$?" = "0"
then
echo "| ${flag}${NAME} | ${RTRN} | ${OBJF} | ${SHIPF} |
" >> tmp/sc-coding.body
echo "| ${DESC} |
" >> tmp/sc-coding.body
fi
echo "${KEYS}" | grep "COMMS" > /dev/null
if test "$?" = "0"
then
echo "| ${flag}${NAME} | ${RTRN} | ${OBJF} | ${SHIPF} |
" >> tmp/sc-comm.body
echo "| ${DESC} |
" >> tmp/sc-comm.body
fi
echo "${KEYS}" | grep "UTILITY" > /dev/null
if test "$?" = "0"
then
echo "| ${flag}${NAME} | ${RTRN} | ${OBJF} | ${SHIPF} |
" >> tmp/sc-util.body
echo "| ${DESC} |
" >> tmp/sc-util.body
fi
echo "${KEYS}" | grep "NAV" > /dev/null
if test "$?" = "0"
then
echo "| ${flag}${NAME} | ${RTRN} | ${OBJF} | ${SHIPF} |
" >> tmp/sc-nav.body
echo "| ${DESC} |
" >> tmp/sc-nav.body
fi
echo "${KEYS}" | grep "SHIELD" > /dev/null
if test "$?" = "0"
then
echo "| ${flag}${NAME} | ${RTRN} | ${OBJF} | ${SHIPF} |
" >> tmp/sc-shield.body
echo "| ${DESC} |
" >> tmp/sc-shield.body
fi
echo "${KEYS}" | grep "DAMCON" > /dev/null
if test "$?" = "0"
then
echo "| ${flag}${NAME} | ${RTRN} | ${OBJF} | ${SHIPF} |
" >> tmp/sc-damcon.body
echo "| ${DESC} |
" >> tmp/sc-damcon.body
fi
echo "${KEYS}" | grep "TRANS" > /dev/null
if test "$?" = "0"
then
echo "| ${flag}${NAME} | ${RTRN} | ${OBJF} | ${SHIPF} |
" >> tmp/sc-trans.body
echo "| ${DESC} |
" >> tmp/sc-trans.body
fi
echo "${KEYS}" | grep "MISC" > /dev/null
if test "$?" = "0"
then
echo "| ${flag}${NAME} | ${RTRN} | ${OBJF} | ${SHIPF} |
" >> tmp/sc-shipmisc.body
echo "| ${DESC} |
" >> tmp/sc-shipmisc.body
fi
echo "${KEYS}" | grep "ENG" > /dev/null
if test "$?" = "0"
then
echo "| ${flag}${NAME} | ${RTRN} | ${OBJF} | ${SHIPF} |
" >> tmp/sc-eng.body
echo "| ${DESC} |
" >> tmp/sc-eng.body
fi
echo "${KEYS}" | grep "TAC" > /dev/null
if test "$?" = "0"
then
echo "| ${flag}${NAME} | ${RTRN} | ${OBJF} | ${SHIPF} |
" >> tmp/sc-tac.body
echo "| ${DESC} |
" >> tmp/sc-tac.body
fi
done
for file in $CALLS
do
echo "
" >> tmp/${file}.body
done
#-----------------------------------------------------------------------------
for file in $CALLS
do
cat templ/header.txt templ/links-space.txt templ/title.txt tmp/${file}.body templ/footer.txt > ../docs/${file}.html
done
cat templ/header.txt templ/links-space.txt templ/title.txt src/spacecalls-index.body templ/footer.txt > ../docs/spacecalls-index.html
cp src/spacecalls-*.html ../docs/
# Debug files
cat templ/header.txt templ/links-debug.txt templ/title.txt src/debug-index.body templ/footer.txt > ../docs/debug-index.html
# Copy sample database, jpgs and gifs over
cp src/*gz ../docs/
cp src/*.jpg ../docs/
cp src/*.gif ../docs/
rm -f tmp/*
umask 007