#!/bin/sh #get the extension from the last argument if [ $# -lt 1 ] ; then echo "You must supply an argument" exit 1 else if [ $# -ge 10 ] ; then lastarg=$9 else eval lastarg=\$$# fi echo "Last argument was $lastarg" lastext=`echo $lastarg | sed -e 's/.*\.//'` if [ -z "$lastext" ] ; then echo "Could not determine an extension from $lastarg" exit 1 else if [ "$lastext" = "cc" -o "$lastext" = "cpp" -o "$lastext" = "h" ] ; then echo "$lastext looks like a C or C++ file. Using c as highlighter" lastext="c" else echo "Last extension is $lastext. Using $lastext as highlighter" fi fi fi OPTIONS="-G --mark-wrapped-lines=arrow --word-wrap -C -DDuplex:true" if [ $# -gt 1 ] ; then OPTIONS="$OPTIONS --toc" fi COMMAND="/usr/cs3/tapted/bin/enscript -E$lastext $OPTIONS $@" echo "Running $COMMAND > $lastarg-all.ps" $COMMAND > "$lastarg-all.ps" echo "Now try \`ghostview $lastarg-all.ps\` or \`lpr -Ppr1-XXX $lastarg-all.ps\`" echo 'You can change the font size by giving a "-fCourier#" option, where # is the font size'