#!/bin/sh
case "$1" in
        -t ) want=t was=T search="^CT" ; continue;;
        -T ) want=T was=t search="^Ct" ; continue;;
        * ) echo "usage: $0 [ -t / -T ]" ; exit 1 ;;
esac
if [ ! -s Sendmail.mc -o ! -w Sendmail.mc ] ; then
        echo "This should be run in the ida/cf directory - can't find writable Sendmail.mc"
        exit 1
fi
if grep -s $search Sendmail.mc ; then
        true
else
        echo "Looks like Sendmail.mc is already as required"
        exit 0
fi
( case "$want" in
        t ) echo "/^DV/s/)$/)-t/p" ;;
        T ) echo "/^DV/s/-t$//p"
esac
echo "g/	C${was}	/s//	C${want}	/gp
g/^C${was}/s//C${want}/p
g/=${was}/s//=${want}/gp
g/~${was}/s//~${want}/gp
w
q
" ) |
ed Sendmail.mc
