4.4BSD/usr/src/contrib/news/inn/samples/ihave

#! /bin/sh
##  $Revision: 1.5 $
##  Ihave control-message handler

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

case ${ACTION} in
mail)
    ${MAILCMD} -s "ihave by ${FROM}" ${NEWSMASTER} <${ARTICLE}
    ;;
doit)
    ##  Scan the message body for articles we don't have.
    ${SED} -e '1,/^$/d' <${ARTICLE} | grephistory -i >${TEMP}
    if [ -s ${TEMP} ] ; then
	export PATHHOST TEMP
	(
	    echo Newsgroups: to.${PATHHOST}
	    echo Control: sendme `innconfval pathhost`
	    echo ''
	    cat ${TEMP}
	) | ${INEWS} -h
    fi
    rm -f ${TEMP}
    ;;
esac

exit