#!/bin/sh #set -x if [ "$punctuation" = "" ] then punctuation=hungarian fi TypeAlone="$1" # determine TypeCombined - this is actually pretty token, given that there # is hard coded hungarian stuff elsewhere. Having this here makes it a # no-brainer to use another style, tho. case "$punctuation" in hungarian) # use "struct fred" and "init hashFred". source files will be hashfred firstChar="`echo $1 | sed 's/^\(.\).*$/\1/'`" otherChars="`echo $1 | sed 's/^.\(.*\)$/\1/'`" TypeCombined=`echo $firstChar | tr '[a-z]' '[A-Z]'`$otherChars ;; underscore) # use "struct fred" and "init hash_fred". source files will be hashfred TypeCombined="_$1" ;; catentate) # use "struct fred" and "init hashfred". source files will be hashfred TypeCombined="$1" ;; esac echo "TypeAlone is $TypeAlone, TypeCombined is $TypeCombined" for ext in c h do ( # replace the "magic comment" with something informative. This # keeps the line numbers the same, between hash.? and hash*.? echo "/* Avoid editing this file. It was automatically " | tr -d '\012' echo "generated from hash.$ext */" (read dummy; cat) | \ sed -e "s/TypeAlone/$TypeAlone/g" -e "s/TypeCombined/$TypeCombined/g" ) > hash$1.$ext < hash.$ext done