#! /bin/sh # @(#) ingredients.sh 2004/05/01 tablify() { if [ "$1" ] ; then TOTAL=$1 TITLE=$2 echo "$1: :$TITLE" | tablify COL1="td" PFX=" " else TOTAL=1 COL1="th" PFX= fi awk -F: ' { if ($1 > 0) { printf "<'$COL1'>'$PFX'%s %s<\/'$COL1'>", $3, $1; if ( $2 == "P" ) { percent = 100 * $1; percent /= '"$TOTAL"'; printf "%2.1f%%<\/th><\/tr>\n", percent; } else { print " "; } } }' } webpages() { echo `find . -name \*.html 2>/dev/null | wc -l` ": : static pages" echo `find . -type l 2>/dev/null | wc -l` ": : symbolic links" echo `find . -name \*.asp 2>/dev/null | wc -l` ": : scripts" echo `find . -name \*.css 2>/dev/null | wc -l` ": : style sheets" } DATE=`date` code128 1 "$DATE" > barcode.png cat - << EOF INGREDIENTS

Ingredients: Source code, images, html pages, shell scripts, perl scripts, style sheets.


Nutrition Facts
Serving size: 1 visit
Servings per day: ~3000


EOF echo `find . -type f -print 2>/dev/null | wc -l` ": : Files" | tablify webpages | tablify cat - << EOF
Amount per serving
% Daily Value


Manufactured by David Parsons,
Portland, OR 97202

Distributed by Apache and FreeBSD.

EOF exit 0