#! /bin/sh
##  $Revision: 1.10 $
##  Checkgroups control-message handler.

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

case ${ACTION} in
mail)
    export FROM CONTROLPROGS NEWSUSER ARTICLE
    (
	echo "${FROM} posted the following checkgroups message."
	echo 'If you want to process it, then feed the body of the'
	echo 'message below into'
	echo "	${CONTROLPROGS}/docheckgroups"
	echo "as the \"${NEWSUSER}\" userid."
	echo ''
	echo '#! /bin/sh'
	echo 'cat <<\\EOF'
	cat ${ARTICLE}
	echo 'EOF'
    ) | ${MAILCMD} -s "checkgroups by ${FROM}" ${NEWSMASTER}
    ;;
doit)
    sed -e '1,/^$/d' <${ARTICLE} \
	| ${CONTROLPROGS}/docheckgroups \
	| ${WRITELOG} ${LOGFILE} "checkgroups by ${FROM}"
    ;;
esac

exit
