fb959e202a6c0164de9fc6c335b9329d2b8a4c51
[mmh] / test / fakesendmail
1 #! /bin/sh
2 ##
3 # fakesendmail - A fake sendmail program used by the nmh test suite
4 #                to test the sendmail/pipe mts.
5 #
6 # This code is Copyright (c) 2012, by the authors of nmh.  See the
7 # COPYRIGHT file in the root directory of the nmh distribution for
8 # complete copyright information.
9 ##
10
11 if [ "$MH_TEST_DIR"x = x ]; then
12   printf "$0 is intended for use only by the nmh test suite\n"
13   exit 1
14 fi
15
16 found_dasht=0
17 for arg in "$@"; do
18   [ "$arg" = -t ]  &&  found_dasht=1
19 done
20
21 if [ $found_dasht -eq 0 ]; then
22   printf "$0 is intended to fake \"sendmail -t\" only, but no -t provided\n"
23   exit 1
24 fi
25
26 #### Put the message (on stdin) in a drop that the test knows about.
27 #### This will delete any lines in the message body that start with Bcc:,
28 #### so avoid those.
29 sed -e '/^[Bb][Cc][Cc]:/d' | \
30 "${MH_LIB_DIR}"/rcvpack "${MH_TEST_DIR}"/Mail/fakesendmail.mbox