#!/bin/sh ###################################################################### # tirindex - Generate tir directory index. # Created 2006-8-13 David Meyer. # 2007-05-09 Version 0.2 # 2009-01-03 Version 0.3 # Read customization from .tir_config ###################################################################### # Identification ##################################################### program='tirindex' version=0.3 copyright='Copyright (C) 2009 David Meyer' description='Generate tir directory index.' usage="Usage: $0 [-Vh] [DIRECTORY]" contact='David Meyer ' # Initialize environment ############################################# unset IFS PATH=/bin:/usr/bin : ${TIRROOT:=/home/zaurus/cave/green} : ${TIRCONFIG:=.tir_config} : ${TIRCSS:=$TIRROOT/.tir.css} # Arguments ########################################################## while getopts Vh option do case $option in V ) echo "$program $version" echo $copyright exit 0 ;; h ) cat << ENDHELP $usage $description DIRECTORY defaults to current directory. Options: -V Display version number -h Display this help message Report bugs to $contact. ENDHELP exit 0 ;; * ) echo $usage >&2 exit 1 ;; esac done shift $(( $OPTIND-1 )) HERE=${1:-$(pwd)} # Functions ########################################################## # Main driver ######################################################## if [ $HERE = '.' ]; then HERE=$(pwd) fi # Read configuration. Inherit root configuration, but local configuration takes precedence. # (The following test decides whether or not we're generating nexus index.) if [ ! $HERE -ef $TIRROOT ]; then test -f $TIRROOT/$TIRCONFIG && . $TIRROOT/$TIRCONFIG # (adjust relative path for file names in config inherited from TIR root...) : ${tir_nameplate:+../$tir_nameplate} : ${tir_stylesheet:+../$tir_stylesheet} : ${tir_exit_icon:+../$tir_exit_icon} : ${tir_object_icon:+../$tir_object_icon} : ${tir_favicon:+../$tir_favicon} fi test -f $HERE/$TIRCONFIG && . $HERE/$TIRCONFIG : ${tir_title:=$(basename $HERE)} if [ $HERE -ef $TIRROOT ]; then echo "

$tir_site_title

" else echo "

$tir_title

" fi if [ -n "$tir_image" -a -f "$tir_image" ]; then echo '
' echo "" echo '
' fi if [ -n "$tir_description" ]; then echo '
' echo "$tir_description" echo '
' fi objects='' exits='' #for name in *; do for name in $(ls -t $HERE/); do if [ -f $HERE/$name ]; then case $name in index.html | *~ | \#*\# ) : ;; *.blink ) exits="$exits$name " ;; * ) objects="$objects$name " ;; esac elif [ -d $name ]; then exits="$exits$name " fi done if [ -n "$objects" ]; then echo '
You see here: