#!/bin/sh
#-- according to the rewrite rules files ending in .xhtml
#-- will be redirected to this script. The lines below strip
#-- the xhtml suffix and seperate the filename from the path.
#-- links should point to "file.xhtml" and the text file should
#-- should be called "file.txt"
#sFileName=$(echo $QUERY_STRING | sed 's@^.*/\([^/]*\)$@\1@;s@\.[^\.]*$@@')
sFileName=$(echo $QUERY_STRING | sed 's@^.*/\([^/]*\)$@\1@;')
sDirName=$(echo $QUERY_STRING | sed 's@/[^/]*$@@')
if [ "$sDirName" = "$QUERY_STRING" ]
then
sDirName=""
fi
if [ "$sFileName" = "" ]
then
sFileName=index
fi
echo "Content-Type: text/html"
echo ""
#-- The 2>&1 idiom below is usefull for finding the cause of
#-- errors as stderr will be directed to stdout and to the
#-j- output of the cgi script.
echo ""
echo ""
echo ""
echo ""
echo ""
echo "
"
echo '
 |
♣ |
B
|
umble |
'
echo "| "
#ls ../htdocs/${QUERY_STRING} | sed -f "dir.sed" 2>&1
ls ../htdocs/${sDirName} | sed -f "dir.sed" 2>&1
echo " | "
#sed -f makehtml.sed ../htdocs/${QUERY_STRING}index.txt 2>&1
sed -f makehtml.sed ../htdocs/${sDirName}/${sFileName}.txt 2>&1
#sed -f template.sed plate.html
echo " |
"
echo ""
echo ""