#!/bin/sh
# $Id: t-msgmod-1.sh,v 1.2 2006/10/05 04:27:40 ca Exp $
# Copyright (c) 2005 Sendmail, Inc. and its suppliers.
# All rights reserved.
#
# By using this file, you agree to the terms and conditions set
# forth in the LICENSE file which can be found at the top level of
# the sendmail distribution.
#
# ----------------------------------------
# test message body modifications for DSN
# uses t-msgmod-0
# ----------------------------------------
#
test -s stop && exit 1
#
GREP=grep
ERR=false
ERRS=0
if test X"`uname`" != "XOSF1"
then
while getopts s:V FLAG
do
case "${FLAG}" in
s) SKIP="${SKIP} ${OPTARG}";;
V) VERBOSE=true;;
esac
done
shift `expr ${OPTIND} - 1`
fi
TPRG=./t-msgmod-0
IN=msg-1.in
OK=msg-1.ok
OUT=msg-1.out
cat > ${IN} <<EOF
From: a
To: b
Subject: c
this is the body
which contains
multiple lines
.
EOF
# ----------------------------------------
# test: only header
TEST=1
if echo " ${SKIP} X" | ${GREP} -v " ${TEST} " > /dev/null
then
ERR=false
cat > ${OK} <<EOF
From: a
To: b
Subject: c
.
EOF
for i in 1 2 3 4 5 6 7 8 9 10 16 32 128 256
do
# XREF: SCTA_FL_HDR_ONLY DA_FL_HDR_ONLY
${TPRG} -b ${i} -f 1 < ${IN} > ${OUT}
if diff ${OK} ${OUT}
then
:
else
echo "$0: test ${TEST} failed for i=${i}"
ERR=true
break
fi
done
if ${ERR}
then
echo "$0: test ${TEST} failed"
ERRS=`expr ${ERRS} + 1 `
test X"${MTA_STOPONERROR}" != X && exit 1
fi
else
${VERBOSE} && echo "$0: test ${TEST} SKIPPED"
fi
# ----------------------------------------
# end
if test "${ERRS}" = "0"
then
exit 0
else
rm -f ${IN} ${OK} ${OUT}
echo "${ERRS} error(s)"
exit 1
fi
syntax highlighted by Code2HTML, v. 0.9.1