# check -version
case `anno -v` in
anno\ --*) ;;
- * ) printf "$0: anno -v generated unexpected output\n" >&2
+ * ) printf '%s: anno -v generated unexpected output\n' "$0" >&2
failed=`expr ${failed:-0} + 1`;;
esac
D=.
fi
if [ -f "$D/$PROG" -a -x "$D/$PROG" ]; then
- printf "$D/$PROG"
+ printf '%s\n' "$D/$PROG"
break
fi
done
# this automatically rounds to nearest integer
arith_eval 100 \* $PROG / $RANGE; PERC=$arith_val
# note \r so next update will overwrite
- printf "%3d%%\r" $PERC
+ printf '%3d%%\r' $PERC
}
progress_done ()
{
- printf "100%%\n"
+ printf '100%%\n'
}
check_for_hard_links () {
#### Use sendmail/pipe below to override default mts.
mts_fakesendmail="${MHMTSCONF}-fakesendmail"
sed -e 's/^mts:.*/mts: sendmail\/pipe/' "${MHMTSCONF}" > "$mts_fakesendmail"
-printf "sendmail: ${srcdir}/test/fakesendmail\n" >>"$mts_fakesendmail"
+printf 'sendmail: %s/test/fakesendmail\n' "$srcdir" >>"$mts_fakesendmail"
MHMTSCONF="$mts_fakesendmail"
# arguments: dist switches
test_dist ()
{
- printf "send\n" | dist "$@" >/dev/null
+ printf 'send\n' | dist "$@" >/dev/null
# fakesendmail drops the message and any cc's into this mbox.
mbox="${MH_TEST_DIR}"/Mail/fakesendmail.mbox
# check -version
case `dist -v` in
dist\ --*) ;;
- * ) printf "$0: dist -v generated unexpected output\n" >&2
+ * ) printf '%s: dist -v generated unexpected output\n' "$0" >&2
failed=`expr ${failed:-0} + 1`;;
esac
arith_eval $i + 1
i=$arith_val
if [ $i -gt 60 ]; then
- printf "$0: -annotate failed, will not wait any longer\n"
+ printf '%s: -annotate failed, will not wait any longer\n' "$0"
break
fi
done
##
if [ "$MH_TEST_DIR"x = x ]; then
- printf "$0 is intended for use only by the nmh test suite\n"
+ printf '%s is intended for use only by the nmh test suite\n' "$0"
exit 1
fi
#### Puts message on stdin in a drop that the test knows about.
-deliver="${MH_LIB_DIR}/rcvpack ${MH_TEST_DIR}/Mail/fakesendmail.mbox"
+deliver="$MH_LIB_DIR/rcvpack $MH_TEST_DIR/Mail/fakesendmail.mbox"
found_dasht=0
for arg in "$@"; do
msg=
datamode=0
- printf "220 If it can't be done in Bourne shell it's not worth doing\n"
+ printf '%s\n' "220 If it can't be done in Bourne shell it's not worth doing"
while read line; do
#### Strip off carriage returns, they confuse the pattern matching.
- line=`printf "$line" | tr -d '\r'`
+ line=`printf %s "$line" | tr -d '\r'`
case "$line" in
- DATA) printf "354 do tell\n"; datamode=1 ;;
- .) printf "250 done\n"; datamode=0; printf "$msg" | $deliver; msg= ;;
- QUIT) printf "221 byenow\n"; break ;;
+ DATA) printf '354 do tell\n'; datamode=1 ;;
+ .) printf '250 done\n'; datamode=0;
+ printf %s "$msg" | $deliver; msg= ;;
+ QUIT) printf '221 byenow\n'; break ;;
*) [ $datamode -eq 1 ] && msg="${msg}${line}
-" || printf "250 OK\n"
+" || printf '250 OK\n'
esac
done
else
# check -version
case `packf -v` in
packf\ --*) ;;
- * ) printf "$0: packf -v generated unexpected output\n" >&2
- failed=`expr ${failed:-0} + 1`;;
+ * ) printf '%s: packf -v generated unexpected output\n' "$0" >&2
+ failed=`expr ${failed:-0} + 1`;;
esac
# check unknown switch
# check -version
case `$dp -v` in
dp\ --*) ;;
- * ) printf "$0: dp -v generated unexpected output\n" >&2
- failed=`expr ${failed:-0} + 1`;;
+ * ) printf '%s: dp -v generated unexpected output\n' "$0" >&2
+ failed=`expr ${failed:-0} + 1`;;
esac
# check unknown switch
# check -version
case `$fmtdump -v` in
fmtdump\ --*) ;;
- * ) printf "$0: fmtdump -v generated unexpected output\n" >&2
+ * ) printf '%s: fmtdump -v generated unexpected output\n' "$0" >&2
failed=`expr ${failed:-0} + 1`;;
esac
# Add an Alternate-Mailbox. This caused ismymbox() to lose the
# Local-Mailbox, Bug #36635: -nocc me doesn't account for
# Alternate-Mailboxes.
-printf "Alternate-Mailboxes: user@example.com\n" >> $MH
+printf 'Alternate-Mailboxes: user@example.com\n' >> $MH
run_test "echo `${MH_LIB_DIR}/ap -format '%(mymbox{text})' "${myname}"`" \
1 "Local-Mailbox with Alternate-Mailbox test"
# check -version
case `msgchk -v` in
msgchk\ --*) ;;
- * ) printf "$0: msgchk -v generated unexpected output\n" >&2
+ * ) printf '%s: msgchk -v generated unexpected output\n' "$0" >&2
failed=`expr ${failed:-0} + 1`;;
esac
#### Rely on sendmail/pipe below to override default mts.
mts_fakesendmail="${MHMTSCONF}-fakesendmail"
cp "${MHMTSCONF}" "$mts_fakesendmail"
-printf "sendmail: ${srcdir}/test/fakesendmail\n" >>"$mts_fakesendmail"
+printf 'sendmail: %s/test/fakesendmail\n' "$srcdir" >>"$mts_fakesendmail"
MHMTSCONF="$mts_fakesendmail"
# argument: expected output
# $1 is expected output file, provided by caller
# $2 is mhmail switches, except for -body
# $3 of -b signifies use -body switch, | signifies provide body on stdin
-# $4 contains message body. When using stdin, can contain printf(1) format
-# specifiers.
+# $4 contains the message body.
test_mhmail ()
{
"${MH_OBJ_DIR}/test/fakesmtp" "$actual" $localport &
status=1
for i in 0 1 2 3 4 5 6 7 8 9; do
if [ $3 = '|' ]; then
- if printf "$4" | mhmail recipient@example.com $2 \
+ if printf '%s' "$4" | mhmail recipient@example.com $2 \
-server 127.0.0.1 -port $localport; then
status=0
break
# Verified same behavior as compiled mhmail.
case `mhmail -v` in
mhmail\ --*) ;;
- * ) echo "$0: mhmail -v generated unexpected output" 1>&2
- failed=`expr ${failed:-0} + 1`;;
+ * ) printf '%s: mhmail -v generated unexpected output\n' "$0" >&2
+ failed=`expr ${failed:-0} + 1`;;
esac
# check for missing argument to switches that require them
# That will just run inc, which we don't want to do anything,
# so tell inc to just display its version.
# Verified same behavior as compiled mhmail.
-printf "inc: -version\n" >> $MH
+printf 'inc: -version\n' >> $MH
case `mhmail` in
inc\ --*) ;;
* ) echo "$0: mhmail generated unexpected output" 1>&2
# 2) use send(1) by added a send switch to the profile and
# verifying that it gets used.
# Not supported by compiled mhmail.
-printf "send: -msgid\n" >> $MH
+printf 'send: -msgid\n' >> $MH
cat > "$expected" <<EOF
EHLO nosuchhost.example.com
QUIT
EOF
-test_mhmail "$expected" '-from sender@localhost' '|' '\n'
+test_mhmail "$expected" '-from sender@localhost' '|' '
+'
[ ${failed:-0} -eq 0 ] || exit ${failed:-0}
QUIT
EOF
-test_mhmail "$expected" '-from sender@localhost' '|' '\n\n\n'
+test_mhmail "$expected" '-from sender@localhost' '|' '
+
+
+'
[ ${failed:-0} -eq 0 ] || exit ${failed:-0}
QUIT
EOF
-test_mhmail "$expected" '-from sender@localhost' '|' "here's some text\n\n\n"
+test_mhmail "$expected" '-from sender@localhost' '|' "here's some text
+
+
+"
[ ${failed:-0} -eq 0 ] || exit ${failed:-0}
#### 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: %s/test/fakesendmail\n' "$srcdir" >>"$mts_fakesendmail"
MHMTSCONF="$mts_fakesendmail"
# $1: -messageid switch selection
# e.g., Message-ID: <5364-1342884222.165897@ldYM.FXwU.bBqK>
id='^Message-ID: <[0-9]\{1,\}-[0-9]\{1,\}\.[0-9]\{6,6\}@[-_0-9A-Za-z]\{4,4\}\.[-_0-9A-Za-z]\{4,4\}\.[-_0-9A-Za-z]\{4,4\}'
;;
- *) printf "$0: unexpected messageid: $msgid_style"; exit 1;;
+ *) printf '%s: unexpected messageid: %s\n' "$0" "$msgid_style"; exit 1 ;;
esac
if grep "$id" "$cur" >/dev/null; then
:
else
mv "$cur" "${testname}.actual"
- printf "$0: unexpected "$msgid_style" Message-ID format, \
-see ${testname}.actual\n"
+ printf '%s: unexpected %s Message-ID format, see %s\n' "$0" \
+ "$msgid_style" "${testname}.actual"
exit 1
fi
#### Rely on sendmail/smtp or sendmail/pipe below to override default mts.
mts_fakesendmail="${MHMTSCONF}-fakesendmail"
cp "${MHMTSCONF}" "$mts_fakesendmail"
-printf "sendmail: ${srcdir}/test/fakesendmail\n" >>"$mts_fakesendmail"
+printf 'sendmail: %s/test/fakesendmail\n' "$srcdir" >>"$mts_fakesendmail"
MHMTSCONF="$mts_fakesendmail"
# $1: -mts switch selection
#### Rely on sendmail/smtp or sendmail/pipe below to override default mts.
mts_fakesendmail="${MHMTSCONF}-fakesendmail"
cp "${MHMTSCONF}" "$mts_fakesendmail"
-printf "sendmail: ${srcdir}/test/fakesendmail\n" >>"$mts_fakesendmail"
+printf 'sendmail: %s/test/fakesendmail\n' "$srcdir" >>"$mts_fakesendmail"
MHMTSCONF="$mts_fakesendmail"
# $1: -mts switch selection
send -draft -alias "${MH_TEST_DIR}/Mail/aliases" -mts sendmail/pipe \
>"${testname}.actual" 2>&1
if [ $? -eq 0 ]; then
- printf "$0: sendmail/pipe should have failed but didn't\n"
+ printf '%s: sendmail/pipe should have failed but didn'"'"'t\n' "$0"
else
set -e
check "${testname}.actual" "$2"
fi
else
- printf "$0: invalid -mts switch selection\n"
+ printf '%s: invalid -mts switch selection\n' "$0"
exit 1
fi
}
# check -version
case `prompter -v` in
prompter\ --*) ;;
- * ) printf "$0: prompter -v generated unexpected output\n" >&2
- failed=`expr ${failed:-0} + 1`;;
+ * ) printf '%s: prompter -v generated unexpected output\n' "$0" >&2
+ failed=`expr ${failed:-0} + 1`;;
esac
# check unknown switch
# check -version
case `$rcvdist -v` in
rcvdist\ --*) ;;
- * ) printf "$0: rcvdist -v generated unexpected output\n" >&2
+ * ) printf '%s: rcvdist -v generated unexpected output\n' "$0" >&2
failed=`expr ${failed:-0} + 1`;;
esac
#### Use sendmail/pipe below to override default mts.
mts_fakesendmail="${MHMTSCONF}-fakesendmail"
sed -e 's/^mts:.*/mts: sendmail\/pipe/' "${MHMTSCONF}" > "$mts_fakesendmail"
-printf "sendmail: ${srcdir}/test/fakesendmail\n" >>"$mts_fakesendmail"
+printf 'sendmail: %s/test/fakesendmail\n' "$srcdir" >>"$mts_fakesendmail"
MHMTSCONF="$mts_fakesendmail"
# arguments: rcvdist switches
# check -version
case `$rcvpack -v` in
rcvpack\ --*) ;;
- * ) printf "$0: rcvpack -v generated unexpected output\n" >&2
+ * ) printf '%s: rcvpack -v generated unexpected output\n' "$0" >&2
failed=`expr ${failed:-0} + 1`;;
esac
# check -version
case `$rcvstore -v` in
rcvstore\ --*) ;;
- * ) printf "$0: rcvstore -v generated unexpected output\n" >&2
- failed=`expr ${failed:-0} + 1`;;
+ * ) printf '%s: rcvstore -v generated unexpected output\n' "$0" >&2
+ failed=`expr ${failed:-0} + 1`;;
esac
# check unknown switch
# check Msg-Protect profile entry
msgprot=640
-printf "Msg-Protect: $msgprot\n" >>$MH
+printf 'Msg-Protect: %s\n' "$msgprot" >>$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" \
# check -version
case `$rcvtty -v` in
rcvtty\ --*) ;;
- * ) printf "$0: rcvtty -v generated unexpected output\n" >&2
+ * ) printf '%s: rcvtty -v generated unexpected output\n' "$0" >&2
failed=`expr ${failed:-0} + 1`;;
esac
# check -version
case `repl -v` in
repl\ --*) ;;
- * ) printf "$0: repl -v generated unexpected output\n" >&2
- failed=`expr ${failed:-0} + 1`;;
+ * ) printf '%s: repl -v generated unexpected output\n' "$0" >&2
+ failed=`expr ${failed:-0} + 1`;;
esac
# check unknown switch
run_test "repl" 'repl: no cur message'
-printf "Local-Mailbox: mymailbox@localhost%s\n" >> $MH
+printf 'Local-Mailbox: mymailbox@localhost\n' >> $MH
# check -cc me
cat >$expected <<EOF
# check -cc me with Local- and Alternate-Mailbox addtions, Bug #36635:
# -nocc me doesn't account for Alternate-Mailboxes.
-printf "Alternate-Mailboxes: user@example.com\n" >> $MH
+printf 'Alternate-Mailboxes: user@example.com\n' >> $MH
cat >$expected <<EOF
From: mymailbox@localhost
# ||true to ignore whatnow's exit status
# watch the quoting -- shell and printf and then the shell run inside whatnow
-printf "cd $MH_TEST_DIR/foo\\\\'s\\\\ bar\npwd\n" | \
+printf 'cd %s/foo\\'"'"'s\\ bar\npwd\n' "$MH_TEST_DIR" | \
TERM=dumb whatnow -noedit -prompt '' 2> "$actualerr" > "$actual" || true
check "$expectederr" "$actualerr"