#!/bin/ksh
phlogdir=/home/ckeen/gopher/phlog/
post=$1
index=index.gph
archive=archive.gph
year=`date +%Y`
feed="alilipona.atom"

cd $phlogdir


if [ ! -f $index.template ]; then
       echo "Cannot find index template file $index.template in " $(pwd)
       exit 1
fi

if [ ! -f $archive.template ]; then
       echo "Cannot find archive template file $archive.template in " $(pwd)
       exit 1
fi

rm $index
cat $index.template >> $index
./tools/listposts.sh | head -n 10 >> $index
printf '\n' >> $index

rm $archive
cat $archive.template >> $archive
./tools/listposts.sh >> $archive
printf '\n' >> $archive

./tools/feed.sh > $feed

cd - > /dev/null