#! /bin/sh # # Process a test template directory into the baseline for a new test # toggle() { case $1 in no) echo "yes" ;; yes) echo "no" ;; *) fatal "Unknown value to toggle ($1)" ;; esac } check_status() { if [ $1 -ne 0 ] ; then shift echo "FAILED: " "$*" >&2 exit 1 fi } usage() { echo "$progname -s SOURCE -d DEST -D description -n NUMBER [-v]" echo " OR" echo "$progname -c -d DEST" cat </dev/null` do cvs add -kkv ${f} done exit 0 fi test "X${source}" != "X" check_status $? No source provided test -d "${source}" check_status $? Source directory not present test "X${testNum}" != "X" check_status $? No test number provided test ! -d ${dest}/CVS check_status $? "Are you sure about ${dest}? Already a CVS directory in it" let $((shiftcount = $OPTIND - 1)) shift #shiftcount args=$* destCaps=`echo ${dest} | tr [:lower:] [:upper:]` echo ${destCaps} # Process the test rm -rf ${dest} check_status $? "Unable to remove ${dest}" mkdir ${dest} check_status $? "Unable to make ${dest}" # all the source code we know about for s in ${source}/* do if [ -r ${s} -a ! -d ${s} ] ; then b=`basename ${s}` d=`echo ${dest}/${b} | sed "s/TEST\./${dest}\./"` echo Processing ${s} to ${d} sed -e "s/@LOWER@/${dest}/g" \ -e "s/@UPPER@/${destCaps}/g" \ -e "s/@DESC@/${desc}/g" \ -e "s/@TESTNUM@/${testNum}/g" \ <${s} >${d} check_status $? "Unable to process ${d}" fi done cat <${dest}/.cvsignore Makefile Makefile.in EOF cat <