test-rcvpack, and test-rcvdist.
test/burst/test-burst \
test/comp/test-comp-format \
test/folder/test-create test/folder/test-sortm \
- test/folder/test-total test/format/test-localmbox \
- test/format/test-myname test/format/test-myhost \
- test/format/test-mymbox \
+ test/folder/test-total test/format/test-dp test/format/test-fmtdump \
+ test/format/test-localmbox test/format/test-myname \
+ test/format/test-myhost test/format/test-mymbox \
test/forw/test-forw-digest \
test/forw/test-forw-format \
test/inc/test-deb359167 test/inc/test-eom-align \
test/post/test-post-dcc test/post/test-post-fcc \
test/post/test-post-multifrom test/post/test-post-envelope \
test/post/test-post-group \
+ test/prompter/test-prompter \
+ test/rcv/test-rcvdist test/rcv/test-rcvpack test/rcv/test-rcvstore \
test/refile/test-refile \
test/repl/test-if-str test/repl/test-trailing-newline \
test/repl/test-multicomp test/repl/test-repl \
--- /dev/null
+#!/bin/sh
+######################################################
+#
+# Test dp
+#
+######################################################
+
+set -e
+
+if test -z "${MH_OBJ_DIR}"; then
+ srcdir=`dirname $0`/../..
+ MH_OBJ_DIR=`cd $srcdir && pwd`; export MH_OBJ_DIR
+fi
+
+. "$MH_OBJ_DIR/test/common.sh"
+
+setup_test
+
+# Use proper program, likely not the first one on PATH.
+dp="${MH_LIB_DIR}/dp"
+
+expected="$MH_TEST_DIR/$$.expected"
+expected_err="$MH_TEST_DIR/$$.expected_err"
+actual="$MH_TEST_DIR/$$.actual"
+actual_err="$MH_TEST_DIR/$$.actual_err"
+
+
+# check -help
+cat >"$expected" <<EOF
+Usage: dp [switches] dates ...
+ switches are:
+ -form formatfile
+ -(forma)t string
+ -width columns
+ -version
+ -help
+EOF
+
+$dp -help >"$actual" 2>&1
+check "$expected" "$actual"
+
+# check -version
+case `$dp -v` in
+ dp\ --*) ;;
+ * ) printf "$0: dp -v generated unexpected output\n" >&2
+ failed=`expr ${failed:-0} + 1`;;
+esac
+
+# check unknown switch
+run_test "$dp -nonexistent" 'dp: -nonexistent unknown'
+
+# check with no switches
+run_test "$dp" 'dp: usage: dp [switches] dates ...'
+
+# check with one valid date
+cat >"$expected" <<EOF
+Sun, 01 Jul 2012 00:00:00
+EOF
+
+$dp 'Sun Jul 1 2012' > "$actual" 2>&1
+check "$expected" "$actual"
+
+# check with two valid dates
+cat >"$expected" <<EOF
+Sun, 01 Jul 2012 00:00:00
+Mon, 02 Jul 2012 00:00:00
+EOF
+
+$dp 'Sun Jul 1 2012' 'Mon Jul 2 2012' > "$actual" 2>&1
+check "$expected" "$actual"
+
+# check with invalid date
+cat >"$expected" <<EOF
+error: not a date
+EOF
+
+cat >"$expected_err" <<EOF
+EOF
+
+$dp 'not a date' > "$actual" 2> "$actual_err"
+check "$expected" "$actual"
+check "$expected_err" "$actual_err"
+
+# check -form
+form="${MH_TEST_DIR}/Mail/dp-form"
+cat >"$form" <<'EOF'
+%(day{text})
+EOF
+
+cat >"$expected" <<EOF
+Sun
+EOF
+
+$dp -form "$form" 'Jul 1 2012' >$actual 2>&1
+check $expected $actual
+rm -f "$form"
+
+# check -format
+cat >"$expected" <<EOF
+Sun
+EOF
+
+$dp -format '%(day{text})' 'Jul 1 2012' >$actual 2>&1
+check $expected $actual
+
+# check -width
+cat >"$expected" <<EOF
+Sun, 01 Jul 2012
+EOF
+
+$dp -width 17 'Sun Jul 1 2012' > "$actual" 2>&1
+check "$expected" "$actual"
+
+
+exit ${failed:-0}
--- /dev/null
+#!/bin/sh
+######################################################
+#
+# Test fmtdump
+#
+######################################################
+
+set -e
+
+if test -z "${MH_OBJ_DIR}"; then
+ srcdir=`dirname $0`/../..
+ MH_OBJ_DIR=`cd $srcdir && pwd`; export MH_OBJ_DIR
+fi
+
+. "$MH_OBJ_DIR/test/common.sh"
+
+setup_test
+
+# Use proper program, likely not the first one on PATH.
+fmtdump="${MH_LIB_DIR}/fmtdump"
+
+expected=$MH_TEST_DIR/$$.expected
+expected_err=$MH_TEST_DIR/$$.expected_err
+actual=$MH_TEST_DIR/$$.actual
+actual_err=$MH_TEST_DIR/$$.actual_err
+
+
+# check -help
+cat >$expected <<EOF
+Usage: fmtdump [switches]
+ switches are:
+ -form formatfile
+ -(forma)t string
+ -version
+ -help
+EOF
+
+$fmtdump -help >$actual 2>&1
+check $expected $actual
+
+# check -version
+case `$fmtdump -v` in
+ fmtdump\ --*) ;;
+ * ) printf "$0: fmtdump -v generated unexpected output\n" >&2
+ failed=`expr ${failed:-0} + 1`;;
+esac
+
+# check unknown switch
+run_test "$fmtdump -nonexistent" 'fmtdump: -nonexistent unknown'
+
+# check with no switches
+cat >$expected <<EOF
+ LV_DAT, value dat[0]
+ NUMF, width 4, fill ' '
+ LV_DAT, value dat[1]
+ IF_V_NE 0 continue else goto L0
+ CHAR '+'
+ GOTO L1
+L0: CHAR ' '
+L1: LS_COMP, comp "replied"
+ IF_S continue else goto L2
+ CHAR '-'
+ GOTO L3
+L2: LS_COMP, comp "encrypted"
+ IF_S continue else goto L4
+ CHAR 'E'
+L3: GOTO L5
+L4: CHAR ' '
+L5: PARSEDATE, c_name "date", c_type <DATE>
+ LV_MON, c_name "date", c_type <DATE>
+ NUMF, width 2, fill '0'
+ CHAR '/'
+ PARSEDATE, c_name "date", c_type <DATE>
+ LV_MDAY, c_name "date", c_type <DATE>
+ NUMF, width 2, fill '0'
+ LS_COMP, comp "date", c_type <DATE>
+ IF_S continue else goto L6
+ CHAR ' '
+ GOTO L7
+L6: CHAR '*'
+L7: MYMBOX, c_name "from", c_type <ADDR>
+ LV_COMPFLAG, comp "from", c_type <ADDR>
+ IF_V_NE 0 continue else goto L8
+ LS_COMP, comp "to", c_type <ADDR>
+ IF_S continue else goto L8
+ LIT "To:"
+ PARSEADDR, c_name "to", c_type <ADDR>
+ LS_FRIENDLY, c_name "to", c_type <ADDR>
+ FT_LS_DECODE
+ STRF, width 14, fill ' '
+L8: IF_V_EQ 0 continue else goto L9
+ PARSEADDR, c_name "from", c_type <ADDR>
+ LS_FRIENDLY, c_name "from", c_type <ADDR>
+ FT_LS_DECODE
+ STRF, width 17, fill ' '
+L9: LIT " "
+ LS_COMP, comp "subject"
+ FT_LS_DECODE
+ STR
+ LS_COMP, comp "body"
+ IF_S continue else goto L10
+ LIT "<<"
+ COMP, comp "body"
+ LIT ">>"
+L10: CHAR '\n'
+ DONE
+EOF
+
+$fmtdump >$actual 2>&1
+check $expected $actual 'keep first'
+
+# check -form
+$fmtdump -form "$MH_TEST_DIR/Mail/scan.default" >$actual 2>&1
+check $expected $actual
+
+# check -format
+cat >$expected <<EOF
+ LS_LIT str "1234567890"
+ IF_S continue else goto L0
+ LV_STRLEN
+ NUM
+L0: DONE
+EOF
+
+$fmtdump -format '%<(lit 1234567890)%(strlen)%>' >$actual 2>&1
+check $expected $actual
+
+
+exit ${failed:-0}
--- /dev/null
+#!/bin/sh
+######################################################
+#
+# Test prompter
+#
+######################################################
+
+set -e
+
+if test -z "${MH_OBJ_DIR}"; then
+ srcdir=`dirname $0`/../..
+ MH_OBJ_DIR=`cd $srcdir && pwd`; export MH_OBJ_DIR
+fi
+
+. "$MH_OBJ_DIR/test/common.sh"
+
+setup_test
+
+expected=$MH_TEST_DIR/$$.expected
+expected_err=$MH_TEST_DIR/$$.expected_err
+actual=$MH_TEST_DIR/$$.actual
+actual_err=$MH_TEST_DIR/$$.actual_err
+
+
+# check -help
+cat >$expected <<EOF
+Usage: prompter [switches] file
+ switches are:
+ -erase chr
+ -kill chr
+ -[no]prepend
+ -[no]rapid
+ -[no]doteof
+ -version
+ -help
+EOF
+
+prompter -help >$actual 2>&1
+check $expected $actual
+
+# check -version
+case `prompter -v` in
+ prompter\ --*) ;;
+ * ) printf "$0: prompter -v generated unexpected output\n" >&2
+ failed=`expr ${failed:-0} + 1`;;
+esac
+
+# check unknown switch
+run_test 'prompter -nonexistent' 'prompter: -nonexistent unknown'
+
+
+# check with no switches
+run_test 'prompter' 'prompter: usage: prompter [switches] file'
+
+# check with file
+cat >$expected <<EOF
+Resent-From: sender@example.com
+Resent-To: recipient@example.com
+Resent-cc: cc@example.com
+Resent-fcc: +outbox
+--------
+message body
+EOF
+
+cat >$MH_TEST_DIR/prompter-file <<EOF
+Resent-From: sender@example.com
+Resent-To:
+Resent-cc:
+Resent-fcc:
+EOF
+
+printf "recipient@example.com\ncc@example.com\n+outbox\nmessage body\n" | \
+ prompter $MH_TEST_DIR/prompter-file > /dev/null
+
+check "$expected" "$MH_TEST_DIR/prompter-file" 'keep first'
+
+# check -doteof
+cat >$MH_TEST_DIR/prompter-file <<EOF
+Resent-From: sender@example.com
+Resent-To:
+Resent-cc:
+Resent-fcc:
+EOF
+
+printf "recipient@example.com\ncc@example.com\n+outbox\nmessage body\n.\n" | \
+ prompter -doteof $MH_TEST_DIR/prompter-file > /dev/null
+
+check "$expected" "$MH_TEST_DIR/prompter-file" 'keep first'
+
+# check -nodoteof
+cat >$MH_TEST_DIR/prompter-file <<EOF
+Resent-From: sender@example.com
+Resent-To:
+Resent-cc:
+Resent-fcc:
+EOF
+
+printf "recipient@example.com\ncc@example.com\n+outbox\nmessage body\n" | \
+ prompter -doteof -nodoteof $MH_TEST_DIR/prompter-file > /dev/null
+
+check "$expected" "$MH_TEST_DIR/prompter-file" 'keep first'
+
+# check -noprepend
+cat >$MH_TEST_DIR/prompter-file <<EOF
+Resent-From: sender@example.com
+Resent-To:
+Resent-cc:
+Resent-fcc:
+--------
+message body
+EOF
+
+printf "appendage\n" >> "$expected"
+
+printf "recipient@example.com\ncc@example.com\n+outbox\nappendage\n" | \
+ prompter -noprepend $MH_TEST_DIR/prompter-file > /dev/null
+
+check "$expected" "$MH_TEST_DIR/prompter-file"
+
+# check -prepend
+cat >$MH_TEST_DIR/prompter-file <<EOF
+Resent-From: sender@example.com
+Resent-To:
+Resent-cc:
+Resent-fcc:
+--------
+message body
+EOF
+
+cat >$expected <<EOF
+Resent-From: sender@example.com
+Resent-To: recipient@example.com
+Resent-cc: cc@example.com
+Resent-fcc: +outbox
+--------
+prependage
+message body
+EOF
+
+printf "recipient@example.com\ncc@example.com\n+outbox\nprependage\n" | \
+ prompter -noprepend -prepend $MH_TEST_DIR/prompter-file > /dev/null
+
+check "$MH_TEST_DIR/prompter-file" "$expected" 'keep first'
+
+# check -rapid
+cat >$expected <<EOF
+Resent-From: sender@example.com
+Resent-To: recipient@example.com
+Resent-cc: cc@example.com
+Resent-fcc: +outbox
+
+--------Enter initial text
+
+--------
+EOF
+
+prompter -rapid $MH_TEST_DIR/prompter-file > "$actual" < /dev/null
+
+check "$expected" "$actual"
+
+# check -norapid
+cat >$expected <<EOF
+Resent-From: sender@example.com
+Resent-To: recipient@example.com
+Resent-cc: cc@example.com
+Resent-fcc: +outbox
+
+--------Enter initial text
+
+prependage
+message body
+--------
+EOF
+
+prompter -rapid -norapid $MH_TEST_DIR/prompter-file > "$actual" < /dev/null
+
+check "$expected" "$actual"
+
+# check -erase and -kill. We can't test their effects because they
+# only affect the terminal and this test execution might not be
+# connected to one. So we can just check that the respective options
+# were set.
+cat >$expected <<EOF
+erase ^U, kill ^?, intr ^@
+Resent-From: sender@example.com
+Resent-To: recipient@example.com
+Resent-cc: cc@example.com
+Resent-fcc: +outbox
+
+--------Enter initial text
+
+prependage
+message body
+--------
+EOF
+
+printf "woot woot\n" | \
+ prompter -erase '\15' -kill '\7f' $MH_TEST_DIR/prompter-file > "$actual"
+
+check "$expected" "$actual"
+
+# check -body. It's undocumented but the default, so make sure that
+# it reverses the effect of -nobody.
+cat >$expected <<EOF
+Resent-From: sender@example.com
+Resent-To: recipient@example.com
+Resent-cc: cc@example.com
+Resent-fcc: +outbox
+
+--------Enter initial text
+
+woot woot
+prependage
+message body
+--------
+EOF
+
+prompter -nobody -body $MH_TEST_DIR/prompter-file > "$actual" < /dev/null
+
+check "$expected" "$actual"
+
+# check -nobody. It's undocumented but looks like it removes the body.
+cat >$expected <<EOF
+Resent-From: sender@example.com
+Resent-To: recipient@example.com
+Resent-cc: cc@example.com
+Resent-fcc: +outbox
+EOF
+
+printf "woot woot\n" | prompter -nobody $MH_TEST_DIR/prompter-file > /dev/null
+
+check "$expected" "$MH_TEST_DIR/prompter-file"
+
+
+exit ${failed:-0}
--- /dev/null
+#!/bin/sh
+######################################################
+#
+# Test rcvdist
+#
+######################################################
+
+set -e
+
+if test -z "${MH_OBJ_DIR}"; then
+ srcdir=`dirname $0`/../..
+ MH_OBJ_DIR=`cd $srcdir && pwd`; export MH_OBJ_DIR
+fi
+
+. "$MH_OBJ_DIR/test/common.sh"
+
+setup_test
+
+# Use proper program, likely not the first one on PATH.
+rcvdist="${MH_LIB_DIR}/rcvdist"
+
+expected=$MH_TEST_DIR/$$.expected
+actual=$MH_TEST_DIR/$$.actual
+
+
+# check -help
+cat >$expected <<EOF
+Usage: rcvdist [switches] [switches for postproc] address ...
+ switches are:
+ -(form) formfile
+ -version
+ -help
+EOF
+
+$rcvdist -help >"$actual" 2>&1
+check "$expected" "$actual"
+
+# check -version
+case `$rcvdist -v` in
+ rcvdist\ --*) ;;
+ * ) printf "$0: rcvdist -v generated unexpected output\n" >&2
+ failed=`expr ${failed:-0} + 1`;;
+esac
+
+# check unknown switch
+run_test "$rcvdist -nonexistent" \
+ 'rcvdist: usage: rcvdist [switches] [switches for postproc] address ...'
+
+# check with no switches
+run_test "$rcvdist" \
+ 'rcvdist: usage: rcvdist [switches] [switches for postproc] address ...'
+
+# check with address
+# Replace post:
+cat >"$MH_TEST_DIR/Mail/notpost" <<EOF
+cp "\$2" "$actual"
+EOF
+chmod u+x "$MH_TEST_DIR/Mail/notpost"
+sed 's/postproc:.*/#:/' "$MH" > "${MH}-new"
+printf "postproc: $MH_TEST_DIR/Mail/notpost\n" >>"${MH}-new"
+mv -f "${MH}-new" "$MH"
+
+#### An extra space gets inserted between each header field name
+#### and body. That probably should be fixed.
+cat > "$expected" <<EOF
+From: Test1 <test1@example.com>
+To: Some User <user@example.com>
+Date: Fri, 29 Sep 2006 00:00:00
+Subject: Testing message 1
+Resent-To: recipient@example.com
+
+This is message number 1
+EOF
+
+$rcvdist recipient@example.com < "$MH_TEST_DIR/Mail/inbox/1"
+check "$expected" "$actual"
+
+# check -form
+cat > "$expected" <<EOF
+From: Test1 <test1@example.com>
+To: Some User <user@example.com>
+Date: Fri, 29 Sep 2006 00:00:00
+Subject: Testing message 1
+Resent-To: recipient@example.com
+Resent-From: Some User <user@example.com>
+
+This is message number 1
+EOF
+
+cat > "$MH_TEST_DIR/Mail/rcvdistcomps" <<'EOF'
+%(lit)%(formataddr{addresses})\
+%<(nonnull)%(void(width))%(putaddr Resent-To:)%>
+%(lit)%(formataddr{to})\
+%<(nonnull)%(void(width))%(putaddr Resent-From:)\n%>
+EOF
+
+$rcvdist -form "$MH_TEST_DIR/Mail/rcvdistcomps" recipient@example.com < \
+ "$MH_TEST_DIR/Mail/inbox/1"
+check "$expected" "$actual"
+
+exit ${failed:-0}
--- /dev/null
+#!/bin/sh
+######################################################
+#
+# Test rcvpack
+#
+######################################################
+
+set -e
+
+if test -z "${MH_OBJ_DIR}"; then
+ srcdir=`dirname $0`/../..
+ MH_OBJ_DIR=`cd $srcdir && pwd`; export MH_OBJ_DIR
+fi
+
+. "$MH_OBJ_DIR/test/common.sh"
+
+setup_test
+
+# Use proper program, likely not the first one on PATH.
+rcvpack="${MH_LIB_DIR}/rcvpack"
+
+expected=$MH_TEST_DIR/$$.expected
+expected_err=$MH_TEST_DIR/$$.expected_err
+actual=$MH_TEST_DIR/$$.actual
+actual_err=$MH_TEST_DIR/$$.actual_err
+
+
+# check -help
+cat >$expected <<EOF
+Usage: rcvpack [switches] file
+ switches are:
+ -mbox
+ -mmdf
+ -version
+ -help
+EOF
+
+$rcvpack -help >$actual 2>&1
+check $expected $actual
+
+# check -version
+case `$rcvpack -v` in
+ rcvpack\ --*) ;;
+ * ) printf "$0: rcvpack -v generated unexpected output\n" >&2
+ failed=`expr ${failed:-0} + 1`;;
+esac
+
+# check unknown switch
+run_test "$rcvpack -nonexistent" 'rcvpack: -nonexistent unknown'
+
+# check with no switches
+run_test "$rcvpack" 'rcvpack: rcvpack [switches] file'
+
+# check mbox creation
+$rcvpack <${MH_TEST_DIR}/Mail/inbox/1 ${MH_TEST_DIR}/Mail/mbox
+inc -file ${MH_TEST_DIR}/Mail/mbox -silent
+check "${MH_TEST_DIR}/Mail/inbox/1" "${MH_TEST_DIR}/Mail/inbox/11" 'keep first'
+
+# check -mbox
+$rcvpack -mmdf -mbox <${MH_TEST_DIR}/Mail/inbox/1 ${MH_TEST_DIR}/Mail/mbox2
+check "${MH_TEST_DIR}/Mail/mbox" "${MH_TEST_DIR}/Mail/mbox2" 'keep first'
+
+# check append to existing mbox file
+$rcvpack <${MH_TEST_DIR}/Mail/inbox/2 ${MH_TEST_DIR}/Mail/mbox
+inc -file ${MH_TEST_DIR}/Mail/mbox -silent
+check "${MH_TEST_DIR}/Mail/inbox/2" "${MH_TEST_DIR}/Mail/inbox/12" 'keep first'
+
+# check -mmdf
+$rcvpack -mmdf <${MH_TEST_DIR}/Mail/inbox/3 ${MH_TEST_DIR}/Mail/mmdf
+inc -file ${MH_TEST_DIR}/Mail/mmdf -silent
+check "${MH_TEST_DIR}/Mail/inbox/3" "${MH_TEST_DIR}/Mail/inbox/12" 'keep first'
+
+# check append to existing mmdf file
+$rcvpack -mmdf <${MH_TEST_DIR}/Mail/inbox/4 ${MH_TEST_DIR}/Mail/mmdf
+inc -file ${MH_TEST_DIR}/Mail/mmdf -silent
+check "${MH_TEST_DIR}/Mail/inbox/4" "${MH_TEST_DIR}/Mail/inbox/13" 'keep first'
+
+
+exit ${failed:-0}
--- /dev/null
+#!/bin/sh
+######################################################
+#
+# Test rcvstore
+#
+######################################################
+
+set -e
+
+if test -z "${MH_OBJ_DIR}"; then
+ srcdir=`dirname $0`/../..
+ MH_OBJ_DIR=`cd $srcdir && pwd`; export MH_OBJ_DIR
+fi
+
+. "$MH_OBJ_DIR/test/common.sh"
+
+setup_test
+
+# Use proper program, likely not the first one on PATH.
+rcvstore="${MH_LIB_DIR}/rcvstore"
+
+expected=$MH_TEST_DIR/$$.expected
+expected_err=$MH_TEST_DIR/$$.expected_err
+actual=$MH_TEST_DIR/$$.actual
+actual_err=$MH_TEST_DIR/$$.actual_err
+
+
+# check -help
+cat >$expected <<EOF
+Usage: rcvstore [+folder] [switches]
+ switches are:
+ -[no]create
+ -[no]unseen
+ -[no]public
+ -[no]zero
+ -sequence name
+ -version
+ -help
+EOF
+
+$rcvstore -help >$actual 2>&1
+check $expected $actual
+
+# check -version
+case `$rcvstore -v` in
+ rcvstore\ --*) ;;
+ * ) printf "$0: rcvstore -v generated unexpected output\n" >&2
+ failed=`expr ${failed:-0} + 1`;;
+esac
+
+# check unknown switch
+run_test "$rcvstore -nonexistent" 'rcvstore: -nonexistent unknown'
+
+# check with no switches and zero-length input message
+cat >$expected <<EOF
+rcvstore: empty file
+EOF
+
+$rcvstore </dev/null >$actual 2>&1
+check $expected $actual
+
+# check with no switches
+cat >$expected <<EOF
+EOF
+$rcvstore <${MH_TEST_DIR}/Mail/inbox/1 >$actual 2>&1
+check $expected $actual 'keep first'
+check "${MH_TEST_DIR}/Mail/inbox/1" "${MH_TEST_DIR}/Mail/inbox/11" 'keep first'
+
+# check + of existing folder
+$rcvstore +inbox <${MH_TEST_DIR}/Mail/inbox/1 >$actual 2>&1
+check $expected $actual 'keep first'
+check "${MH_TEST_DIR}/Mail/inbox/1" "${MH_TEST_DIR}/Mail/inbox/11" 'keep first'
+
+# check + of new folder
+$rcvstore +newfolder <${MH_TEST_DIR}/Mail/inbox/1 >$actual 2>&1
+check $expected $actual 'keep first'
+check "${MH_TEST_DIR}/Mail/inbox/1" "${MH_TEST_DIR}/Mail/newfolder/1" \
+ 'keep first'
+rmdir "${MH_TEST_DIR}/Mail/newfolder"
+
+# check -nocreate
+cat >$expected_err <<EOF
+rcvstore: folder ${MH_TEST_DIR}/Mail/newfolder doesn't exist
+EOF
+
+set +e
+$rcvstore +newfolder -nocreate <${MH_TEST_DIR}/Mail/inbox/1 >$actual \
+ 2>$actual_err
+set -e
+check $expected $actual 'keep first'
+check $expected_err $actual_err
+
+# check -create
+$rcvstore +newfolder -nocreate -create <${MH_TEST_DIR}/Mail/inbox/1 \
+ >$actual 2>&1
+check $expected $actual 'keep first'
+check "${MH_TEST_DIR}/Mail/inbox/1" "${MH_TEST_DIR}/Mail/newfolder/1" \
+ 'keep first'
+rmdir "${MH_TEST_DIR}/Mail/newfolder"
+
+# check addition to unseen sequence
+printf 'Unseen-Sequence: unseen\n' >> $MH
+$rcvstore <${MH_TEST_DIR}/Mail/inbox/1 >$actual 2>&1
+check $expected $actual 'keep first'
+run_test 'mark -sequence unseen -list' 'unseen: 11'
+check "${MH_TEST_DIR}/Mail/inbox/1" "${MH_TEST_DIR}/Mail/inbox/11" 'keep first'
+#### Need to clear the unseen sequence.
+touch "${MH_TEST_DIR}/Mail/inbox/11"
+rmm 11
+
+# check -nounseen
+$rcvstore -nounseen <${MH_TEST_DIR}/Mail/inbox/1 >$actual 2>&1
+check $expected $actual 'keep first'
+run_test 'mark -sequence unseen -list' 'unseen: '
+check "${MH_TEST_DIR}/Mail/inbox/1" "${MH_TEST_DIR}/Mail/inbox/11" 'keep first'
+
+# check -unseen
+$rcvstore -nounseen -unseen <${MH_TEST_DIR}/Mail/inbox/1 >$actual 2>&1
+check $expected $actual 'keep first'
+run_test 'mark -sequence unseen -list' 'unseen: 11'
+check "${MH_TEST_DIR}/Mail/inbox/1" "${MH_TEST_DIR}/Mail/inbox/11" 'keep first'
+
+# check -sequence
+$rcvstore -sequence newseq <${MH_TEST_DIR}/Mail/inbox/1 >$actual 2>&1
+check $expected $actual 'keep first'
+run_test 'mark -sequence newseq -list' 'newseq: 11'
+check "${MH_TEST_DIR}/Mail/inbox/1" "${MH_TEST_DIR}/Mail/inbox/11" 'keep first'
+
+# check that default is -nozero
+mark -sequence newseq all
+$rcvstore -sequence newseq <${MH_TEST_DIR}/Mail/inbox/1 >$actual 2>&1
+check $expected $actual 'keep first'
+run_test 'mark -sequence newseq -list' 'newseq: 1-11'
+check "${MH_TEST_DIR}/Mail/inbox/1" "${MH_TEST_DIR}/Mail/inbox/11" 'keep first'
+
+# check -zero
+mark -sequence newseq all
+$rcvstore -sequence newseq -zero <${MH_TEST_DIR}/Mail/inbox/1 >$actual 2>&1
+check $expected $actual 'keep first'
+run_test 'mark -sequence newseq -list' 'newseq: 11'
+check "${MH_TEST_DIR}/Mail/inbox/1" "${MH_TEST_DIR}/Mail/inbox/11" 'keep first'
+
+# check -nozero
+mark -sequence newseq all
+$rcvstore -seq newseq -zero -nozero <${MH_TEST_DIR}/Mail/inbox/1 >$actual 2>&1
+check $expected $actual 'keep first'
+run_test 'mark -sequence newseq -list' 'newseq: 1-11'
+check "${MH_TEST_DIR}/Mail/inbox/1" "${MH_TEST_DIR}/Mail/inbox/11" 'keep first'
+
+# check that default is -public
+$rcvstore -sequence pubseq <${MH_TEST_DIR}/Mail/inbox/1 >$actual 2>&1
+check $expected $actual 'keep first'
+run_test 'mark -sequence pubseq -list' 'pubseq: 11'
+check "${MH_TEST_DIR}/Mail/inbox/1" "${MH_TEST_DIR}/Mail/inbox/11" 'keep first'
+
+# check -nopublic
+$rcvstore -sequence privseq -nopublic <${MH_TEST_DIR}/Mail/inbox/1 >$actual 2>&1
+check $expected $actual 'keep first'
+run_test 'mark -sequence privseq -nopublic -list' 'privseq (private): 11'
+check "${MH_TEST_DIR}/Mail/inbox/1" "${MH_TEST_DIR}/Mail/inbox/11" 'keep first'
+
+# check -public
+$rcvstore -sequence pubseq -nopublic -public <${MH_TEST_DIR}/Mail/inbox/1 \
+ >$actual 2>&1
+check $expected $actual 'keep first'
+run_test 'mark -sequence pubseq -public -list' 'pubseq: 11'
+check "${MH_TEST_DIR}/Mail/inbox/1" "${MH_TEST_DIR}/Mail/inbox/11" 'keep first'
+
+#### Windows FAT filesystems don't support file permissions that
+#### disallow read access, and chmod doesn't fail. If a test above
+#### has failed, report that failure. Otherwise, report that we're
+#### skipping the remainer of the test if chmod can't remove read
+#### permission.
+printf '\n' >${MH_TEST_DIR}/Mail/test-read-perms
+chmod 600 ${MH_TEST_DIR}/Mail/test-read-perms
+if [ "`find ${MH_TEST_DIR}/Mail/test-read-perms -perm 600`"x = ''x ]; then
+ if [ ${failed:-0} -eq 0 ]; then
+ echo "$Test $0 SKIP (cannot remove read permission on plain files)"
+ exit 77
+ else
+ exit $failed
+ fi
+else
+ rm -f ${MH_TEST_DIR}/Mail/test-read-perms
+fi
+
+# check default Msg-Protect
+msgprot=`mhparam msgprot`
+$rcvstore <${MH_TEST_DIR}/Mail/inbox/1 >$actual 2>&1
+check $expected $actual 'keep first'
+run_test "find ${MH_TEST_DIR}/Mail/inbox/11 -perm $msgprot" \
+ "${MH_TEST_DIR}/Mail/inbox/11"
+check "${MH_TEST_DIR}/Mail/inbox/1" "${MH_TEST_DIR}/Mail/inbox/11" 'keep first'
+
+# check Msg-Protect profile entry
+msgprot=640
+printf "Msg-Protect: $msgprot\n" >>$MH
+$rcvstore <${MH_TEST_DIR}/Mail/inbox/1 >$actual 2>&1
+check $expected $actual
+run_test "find ${MH_TEST_DIR}/Mail/inbox/11 -perm $msgprot" \
+ "${MH_TEST_DIR}/Mail/inbox/11"
+check "${MH_TEST_DIR}/Mail/inbox/1" "${MH_TEST_DIR}/Mail/inbox/11"
+
+
+exit ${failed:-0}