#!/bin/csh -f
# This is a cshell for an auto substituting routine using sed for
# this is hard coded for *.c files btw
# Author: James Rhone (though it ain't all that) :) 1/2/97
set list = `ls *.c`
set numfiles=${#list}
if (! -e ./sourceword || ! -e ./targetword) then
echo "sourceword and targetword files must exist"
exit 1
endif
set src=`cat sourceword`
set trg=`cat targetword`
echo "Using command sed s/$src/$trg/g "
echo "Substituting with ${numfiles} files."
@ sofar = 1
while ( $sofar <= $numfiles )
echo "$list[$sofar]"
sed s/"$src"/"$trg"/g $list[$sofar] > $list[$sofar].tmp
mv $list[$sofar].tmp $list[$sofar]
echo -n "$list[$sofar] "
@ sofar ++
end