will prompt the user for the name of field for the annotation.
.PP
The field specified must be a valid 2822-style message field name,
-which means that it may only consist of alphanumerics and dashes,
+which means that it may only consist of alphanumerics and dashes.
The body specified is arbitrary text.
.PP
Normally
# portable implementation of 'which' utility
findprog()
{
- FOUND=
PROG="$1"
- IFS_SAVE="$IFS"
+ #### Don't need to save current IFS because this function is run in
+ #### a subshell.
IFS=:
for D in $PATH; do
if [ -z "$D" ]; then
D=.
fi
- if [ -f "$D/$PROG" ] && [ -x "$D/$PROG" ]; then
- printf '%s\n' "$D/$PROG"
+ if [ -f "$D/$PROG" -a -x "$D/$PROG" ]; then
+ printf "$D/$PROG"
break
fi
done
- IFS="$IFS_SAVE"
}
require_prog ()
printf "100%%\n"
}
+check_for_hard_links () {
+ set +e
+
+ printf '' > "${MH_TEST_DIR}/$$-1"
+ if link "${MH_TEST_DIR}/$$-1" "${MH_TEST_DIR}/$$-2" 2>/dev/null; then
+ hard_links_supported=1
+ else
+ hard_links_supported=0
+ fi
+ rm -f "${MH_TEST_DIR}/$$-1" "${MH_TEST_DIR}/$$-2"
+
+ set -e
+}
+
#### check() requires two arguments, each the name of a file to be
#### diff'ed.
#### If the same, the second file is removed. And the first file is
#### Don't test with sendmail because it would really send the
#### mail. If configured to use sendmail, change to smtp instead
#### so that we use fakesmtp.
- sed -e 's/mts: *.*/mts: smtp/' "${MHMTSCONF}" >"${MHMTSCONF}.new"
+ #### And set up the maildrop in the test directory so tests don't
+ #### use the user's real maildrop.
+ sed -e 's/mts: *.*/mts: smtp/' \
+ -e "s%mmdfldir: *.*%mmdfldir: ${MH_TEST_DIR}/Mail%" \
+ -e 's%mmdflfil: *.*%mmdflfil: maildrop%' \
+ "${MHMTSCONF}" >"${MHMTSCONF}.new"
mv -f "${MHMTSCONF}.new" "${MHMTSCONF}"
fi
#### Rely on sendmail/pipe below to override default mts.
mts_fakesendmail="${MHMTSCONF}-fakesendmail"
cp "${MHMTSCONF}" "$mts_fakesendmail"
-printf "%s\n" "sendmail: ${srcdir}/test/fakesendmail" >>"$mts_fakesendmail"
+printf "sendmail: ${srcdir}/test/fakesendmail\n" >>"$mts_fakesendmail"
MHMTSCONF="$mts_fakesendmail"
# argument: expected output
#### Rely on sendmail/smtp or sendmail/pipe below to override default mts.
mts_fakesendmail="${MHMTSCONF}-fakesendmail"
cp "${MHMTSCONF}" "$mts_fakesendmail"
-printf "%s\n" "sendmail: ${srcdir}/test/fakesendmail" >>"$mts_fakesendmail"
+printf "sendmail: ${srcdir}/test/fakesendmail\n" >>"$mts_fakesendmail"
MHMTSCONF="$mts_fakesendmail"
# $1: -mts switch selection
#### Use sendmail/pipe below to override default mts.
mts_fakesendmail="${MHMTSCONF}-fakesendmail"
sed -e 's/^mts:.*/mts: sendmail\/pipe/' "${MHMTSCONF}" > "$mts_fakesendmail"
-printf "%s\n" "sendmail: ${srcdir}/test/fakesendmail" >>"$mts_fakesendmail"
+printf "sendmail: ${srcdir}/test/fakesendmail\n" >>"$mts_fakesendmail"
MHMTSCONF="$mts_fakesendmail"
# arguments: rcvdist switches
TOTAL = 11 messages in 2 folders.'
-printf '' > $$.txt
-set +e
-if link $$.txt $$-2.txt 2>/dev/null; then
- # Hard links are supported.
+check_for_hard_links
+if [ $hard_links_supported -eq 1 ]; then
# check -link
run_test 'refile 7 -src +inbox +other -link' ''
run_test 'folders -noheader' \
cp -p Mail/inbox/7 Mail/other/2
folder -f +inbox 7 >/dev/null
fi
-set -e
-rm -f $$.txt $$-2.txt
# check -nolink
run_test 'refile 7 +other -link -nolink' ''