#! /bin/csh -f
#
# mkclass - make an instantiation of a "generic" class.
#
# Usage: mkclass template dest param=value ...
#

if ($#argv < 3) then
    echo $#argv
    echo "Usage: mkclass input output param=value ..."
    exit 1
endif

set template = $1
set dest = $2
set args = ""
shift
shift
set noglob
foreach i ($*:q)
    set param = `echo $i | sed -e "s/=.*//"`
    set value = `echo $i | sed -e "s/[^=]*=//"`
    set args = "-e 's@\\$param@$value@g' $args"
end
set args = "$args < $template > $dest"
sh -c "sed $args"
