#!/bin/sh get_lib_file() { if [ -f "sites/$SITE/_wesh/lib/$1" ]; then echo "sites/$SITE/_wesh/lib/$1" else echo "lib/$1" fi } render_page() { echo "Content-Type: text/html" echo handler "$(get_lib_file master.tpl)" } static_file() { printf "Content-Type: " select_mime "$1" echo cat "$1" } select_mime() { m='text/plain' case "$1" in *.css) m='text/css' ;; *.ico) m='image/x-icon' ;; *.png) m='image/png' ;; *.jpg) m='image/jpeg' ;; *.jpeg) m='image/jpeg' ;; *.gif) m='image/gif' ;; *.pdf) m='application/pdf' ;; esac echo $m }