#! /bin/sh

# Copyright (c) Christopher M. R. Lowth - chris@lowth.com
# Written by Christopher M. R. Lowth
#
# Permission is granted to anyone to use this software for any purpose on
# any computer system, and to alter it and redistribute it freely, subject
# to the following restrictions:
#
# 1. The author is not responsible for the consequences of use of this
#    software, no matter how awful, even if they arise from flaws in it.
#
# 2. The origin of this software must not be misrepresented, either by
#    explicit claim or by omission.  Since few users ever read sources,
#    credits must appear in the documentation.
#
# 3. Altered versions must be plainly marked as such, and must not be
#    misrepresented as being the original software.  Since few users
#    ever read sources, credits must appear in the documentation.
#
# 4. This notice may not be removed or altered.

trap 'rm -f /tmp/pp.$$.a /tmp/pp.$$.b' 0
cat > /tmp/pp.$$.a

/usr/lib/protector/bin/protector /tmp/pp.$$.a > /tmp/pp.$$.b
stat1=$?

/usr/bin/procmail "$@" < /tmp/pp.$$.b
stat2=$?

# Auto_reply is work in progress. Chopped out for now, in order to satisfy
# demand for an early release -- Chris.
#
# 97	- waitpid() on part_filter failed
# 98	- part_filter crashed
# 99	- error execl() the part_filter
# 111	- a part replaced

# case $stat1 in
#	2|97|98|99|111)
#		/usr/lib/protector/bin/auto_reply /tmp/pp.$$ $stat1 $stat2 "$@"
#		;;
# esac

exit $stat2
