#!/bin/sh


# Script usage: http://yourserver/htbin/view-source/dir1/foo.c
# This will send back the document $DOCUMENT_ROOT/dir1/foo.c as
# plaintext. $DOCUMENT_ROOT is an env. variable set by the server.

if [ $# = 1 ]; then
	echo Content-type: text/plain
	echo
	cat $DOCUMENT_ROOT/$1
else 
	echo Content-type: text/html
	echo
	cat << EOM 
<TITLE>Source viewer</TITLE>
<H1>Source Viewer</H1>

This script is a simple way to use the extra-path feature of scripts. You
should not call it directly.

EOM
fi
