#! /bin/bash
##  $Revision: 1.9 $
##  Ihave control-message handler

PROG=ihave
##  Some shells don't pass in $* unless we explicitly pass it in here.
##  =()<. @<_PATH_PARSECTL>@ "$@">()=
. /usr/lib/news/bin/parsecontrol "$@"

case ${ACTION} in
mail)
    sed -e 's/^~/~~/' <${ARTICLE} \
	| ${MAILCMD} -s "ihave by ${FROM}" ${NEWSMASTER}
    ;;
doit)
    ##  Scan the message body for articles we don't have.
    ${SED} -e '1,/^$/d' <${ARTICLE} | grephistory -i >${TEMP}
    if [ -s ${TEMP} ] ; then
	export PATH                                                                                                                                                                                                                                                 