2 #@ Usage: ./cc-test.sh [--check-only s-mailx-binary]
3 #@ TODO _All_ the tests should happen in a temporary subdir.
6 # We need *stealthmua* regardless of $SOURCE_DATE_EPOCH, the program name as
7 # such is a compile-time variable
8 ARGS
='-:/ -# -Sdotlock-ignore-error -Sexpandaddr=restrict'
9 ARGS
="${ARGS}"' -Smime-encoding=quoted-printable -Snosave -Sstealthmua'
10 ADDARG_UNI
=-Sttycharset=UTF-8
15 #UTF8_LOCALE= autodetected unless set
18 #MEMTESTER='valgrind --leak-check=full --log-file=.vl-%p '
20 if ( command -v command ) >/dev
/null
2>&1; then :; else
27 MAKE
="${MAKE:-`command -v make`}"
28 awk=${awk:-`command -v awk`}
29 cat=${cat:-`command -v cat`}
30 cksum=${cksum:-`command -v cksum`}
31 rm=${rm:-`command -v rm`}
32 sed=${sed:-`command -v sed`}
33 grep=${grep:-`command -v grep`}
35 # Problem: force $SHELL to be a real shell. It seems some testing environments
36 # use nologin(?), but we need a real shell for command execution
37 if { echo ${SHELL} | ${grep} nologin; } >/dev
/null
2>&1; then
38 echo >&2 '$SHELL seems to be nologin, overwriting to /bin/sh!'
43 # We sometimes "fake" sendmail(1) a.k.a. *mta* with a shell wrapper, and it
44 # happens that /bin/sh is often terribly slow
45 if command -v dash
>/dev
/null
2>&1; then
46 MYSHELL
="`command -v dash`"
47 elif command -v mksh
>/dev
/null
2>&1; then
48 MYSHELL
="`command -v mksh`"
55 export ARGS ADDARG_UNI CONF BODY MBOX MAIL MAKE
awk cat cksum rm sed grep
59 # Wed Oct 2 01:50:07 UTC 1996
60 SOURCE_DATE_EPOCH
=844221007
62 export LC_ALL LANG TZ SOURCE_DATE_EPOCH
66 echo >&2 "Usage: ./cc-test.sh [--check-only s-mailx-binary]"
71 if [ "${1}" = --check-only ]; then
74 [ -x "${MAILX}" ] || usage
77 MAILX
="${MEMTESTER}${MAILX}"
80 if [ -n "${CHECK_ONLY}" ] && [ -z "${UTF8_LOCALE}" ]; then
81 # Try ourselfs for nl_langinfo(CODESET) output first (requires a new version)
82 i
=`LC_ALL=C.utf8 "${RAWMAILX}" ${ARGS} -X '
84 \if [ "${ttycharset}" @i=% utf ]
91 \eval xcall cset_test "${@}"
95 \call cset_test C.UTF-8 POSIX.utf8 POSIX.UTF-8 en_EN.utf8 en_EN.UTF-8 \
96 en_US.utf8 en_US.UTF-8
98 [ $?
-eq 0 ] && UTF8_LOCALE
=$i
100 if [ -z "${UTF8_LOCALE}" ] && command -v locale
>/dev
/null
2>&1; then
101 UTF8_LOCALE
=`locale -a | { m=
103 if { echo ${n} | ${grep} -i 'utf-\{0,1\}8'; } >/dev/null 2>&1; then
105 if { echo ${n} | ${grep} -e POSIX -e en_EN -e en_US; }; then
119 trap "${rm} -rf \"${BODY}\" \"${MBOX}\" \${TRAP_EXIT_ADDONS}" EXIT
120 trap "exit 1" HUP INT TERM
123 # Test all configs TODO doesn't cover all *combinations*, stupid!
127 NOTME["OPT_AUTOCC"] = 1
128 NOTME["OPT_DEBUG"] = 1
129 NOTME["OPT_DEVEL"] = 1
130 NOTME["OPT_NOEXTMD5"] = 1
131 NOTME["OPT_ASAN_ADDRESS"] = 1
132 NOTME["OPT_ASAN_MEMORY"] = 1
133 NOTME["OPT_FORCED_STACKPROT"] = 1
134 NOTME["OPT_NOMEMDBG"] = 1
135 NOTME["OPT_NYD2"] = 1
138 /^[[:space:]]*OPT_/ {
139 sub(/^[[:space:]]*/, "")
140 # This bails for UnixWare 7.1.4 awk(1), but preceeding = with \
141 # does not seem to be a compliant escape for =
143 $1 = substr($1, 1, index($1, "=") - 1)
149 # Doing this completely sequentially and not doing make distclean in
150 # between runs should effectively result in lesser compilations.
151 # It is completely dumb nonetheless... TODO
152 for (j = 1; j < i; ++j) {
153 for (k = 1; k < j; ++k)
155 for (k = j; k < i; ++k)
157 printf "OPT_AUTOCC=1\n"
159 for (j = 1; j < i; ++j) {
160 for (k = 1; k < j; ++k)
162 for (k = j; k < i; ++k)
164 printf "OPT_AUTOCC=1\n"
167 for (j = 1; j < i; ++j) {
168 for (k = 1; k < j; ++k)
170 for (k = j; k < i; ++k)
172 printf "OPT_AUTOCC=1\n"
173 printf "OPT_DEBUG=1\n"
175 for (j = 1; j < i; ++j) {
176 for (k = 1; k < j; ++k)
178 for (k = j; k < i; ++k)
180 printf "OPT_AUTOCC=1\n"
181 printf "OPT_DEBUG=1\n"
184 printf "CONFIG=NULL OPT_AUTOCC=0\n"
185 printf "CONFIG=NULL OPT_AUTOCC=1\n"
186 printf "CONFIG=NULLI OPT_AUTOCC=0\n"
187 printf "CONFIG=NULLI OPT_AUTOCC=1\n"
188 printf "CONFIG=MINIMAL OPT_AUTOCC=0\n"
189 printf "CONFIG=MINIMAL OPT_AUTOCC=1\n"
190 printf "CONFIG=MEDIUM OPT_AUTOCC=0\n"
191 printf "CONFIG=MEDIUM OPT_AUTOCC=1\n"
192 printf "CONFIG=NETSEND OPT_AUTOCC=0\n"
193 printf "CONFIG=NETSEND OPT_AUTOCC=1\n"
194 printf "CONFIG=MAXIMAL OPT_AUTOCC=0\n"
195 printf "CONFIG=MAXIMAL OPT_AUTOCC=1\n"
196 printf "CONFIG=DEVEL OPT_AUTOCC=0\n"
197 printf "CONFIG=DEVEL OPT_AUTOCC=1\n"
198 printf "CONFIG=ODEVEL OPT_AUTOCC=0\n"
199 printf "CONFIG=ODEVEL OPT_AUTOCC=1\n"
202 printf "\n\n##########\n$c\n"
203 printf "\n\n##########\n$c\n" >&2
204 sh
-c "${MAKE} ${c} all test"
210 ( "${RAWMAILX}" ${ARGS} -X'echo $features' -Xx |
211 ${grep} +${1} ) >/dev
/null
2>&1
215 ${rm} -rf "${BODY}" "${MBOX}" ${TRAP_EXIT_ADDONS}
223 restat
=${?} tid=${1} eestat=${2} f=${3} s=${4}
224 #x=`echo ${tid} | tr "/:=" "__-"`
225 #cp -f "${f}" "${TMPDIR}/${x}"
226 [ "${eestat}" != - ] && [ "${restat}" != "${eestat}" ] &&
227 err
"${tid}" 'unexpected exit status: '"${restat} != ${eestat}"
228 csum
="`${cksum} < ${f}`"
229 if [ "${csum}" = "${s}" ]; then
230 printf '%s: ok\n' "${tid}"
233 printf '%s: error: checksum mismatch (got %s)\n' "${tid}" "${csum}"
239 printf '%s: error: %s\n' ${1} "${2}"
243 [ $?
-ne 0 ] && err
$1 'unexpected non-0 exit status'
247 [ $?
-eq 0 ] && err
$1 'unexpected 0 exit status'
250 if ( [ "$((1 + 1))" = 2 ] ) >/dev
/null
2>&1; then
252 echo "$((${1} + ${2}))"
254 elif command -v expr >/dev
/null
2>&1; then
256 echo `expr ${1} + ${2}`
260 echo `${awk} 'BEGIN{print '${1}' + '${2}'}'`
264 if ( [ "$((2 % 3))" = 2 ] ) >/dev
/null
2>&1; then
266 echo "$((${1} % ${2}))"
268 elif command -v expr >/dev
/null
2>&1; then
270 echo `expr ${1} % ${2}`
274 echo `${awk} 'BEGIN{print '${1}' % '${2}'}'`
279 # Basic (easily testable) behaviour tests
281 t_behave_X_opt_input_command_stack
284 t_behave_input_inject_semicolon_seq
285 t_behave_commandalias
288 t_behave_macro_param_shift
300 # FIXME t_behave_mlist
303 t_behave_record_a_resend
306 t_behave_compose_hooks
307 t_behave_message_injections
308 t_behave_mime_types_load_control
313 t_behave_mass_recipients
314 t_behave_lreply_futh_rth_etc
317 t_behave_X_opt_input_command_stack
() {
320 ${cat} <<- '__EOT' > "${BODY}"
328 echo "define mac1 {";\
329 echo " echo mac1-1 via1 \$0";\
331 echo " echo mac1-2";\
333 echo " echo mac1-3";\
336 echo "define mac2 {";\
337 echo " echo mac2-1 via1 \$0";\
339 echo " echo mac2-2";\
345 echo echo 1-1-1 via1 \$0;\
357 # The -X option supports multiline arguments, and those can internally use
358 # reverse solidus newline escaping. And all -X options are joined...
360 < "${BODY}" ${MAILX} ${ARGS} \
375 echo "define mac1 {";\
376 echo " echo mac1-1 via2 \$0";\
378 echo " echo mac1-2";\
380 echo " echo mac1-3";\
383 echo "define mac2 {";\
384 echo " echo mac2-1 via2 \$0";\
386 echo " echo mac2-2";\
392 echo echo 1-1-1 via2 \$0;\
406 check behave:x_opt_input_command_stack 0 "${MBOX}" '1786542668 416'
411 t_behave_X_errexit() {
414 ${cat} <<- '__EOT' > "${BODY}"
420 </dev/null ${MAILX} ${ARGS} -Snomemdebug \
421 -X'echo one' -X' echos nono ' -X'echo two' \
423 check behave:x_errexit-1 0 "${MBOX}" '916157812 53'
425 </dev/null ${MAILX} ${ARGS} -X'source '"${BODY}" -Snomemdebug \
427 check behave:x_errexit-2 0 "${MBOX}" '916157812 53'
429 </dev/null MAILRC="${BODY}" ${MAILX} ${ARGS} -:u
-Snomemdebug \
431 check behave
:x_errexit-3
0 "${MBOX}" '916157812 53'
435 </dev
/null
${MAILX} ${ARGS} -Serrexit -Snomemdebug \
436 -X'echo one' -X' echos nono ' -X'echo two' \
438 check behave
:x_errexit-4
1 "${MBOX}" '2118430867 49'
440 </dev
/null
${MAILX} ${ARGS} -X'source '"${BODY}" -Serrexit -Snomemdebug \
442 check behave:x_errexit-5 1 "${MBOX}" '2118430867 49'
444 </dev/null MAILRC="${BODY}" ${MAILX} ${ARGS} -:u
-Serrexit -Snomemdebug \
446 check behave
:x_errexit-6
1 "${MBOX}" '12955965 172'
448 </dev
/null MAILRC
="${BODY}" ${MAILX} ${ARGS} -:u -Sposix -Snomemdebug \
450 check behave:x_errexit-7 1 "${MBOX}" '12955965 172'
452 ## Repeat 4-7 with ignerr set
454 ${sed} -e 's/^echos /ignerr echos /' < "${BODY}" > "${MBOX}"
456 </dev
/null
${MAILX} ${ARGS} -Serrexit -Snomemdebug \
457 -X'echo one' -X'ignerr echos nono ' -X'echo two' \
459 check behave
:x_errexit-8
0 "${BODY}" '916157812 53'
461 </dev
/null
${MAILX} ${ARGS} -X'source '"${MBOX}" -Serrexit -Snomemdebug \
463 check behave:x_errexit-9 0 "${BODY}" '916157812 53'
465 </dev/null MAILRC="${MBOX}" ${MAILX} ${ARGS} -:u
-Serrexit -Snomemdebug \
467 check behave
:x_errexit-10
0 "${BODY}" '916157812 53'
469 </dev
/null MAILRC
="${MBOX}" ${MAILX} ${ARGS} -:u -Sposix -Snomemdebug \
471 check behave:x_errexit-11 0 "${BODY}" '916157812 53'
479 ${cat} <<- '__EOT' > "${BODY}"
498 echo 'a${DIET}b${TIED}c\${DIET}d\${TIED}e' # COMMENT
499 echo "a${DIET}b${TIED}c\${DIET}d\${TIED}e"
500 echo $
'a${DIET}b${TIED}c\${DIET}d\${TIED}e'
502 echo a$
'\101\0101\x41\u0041\u41\U00000041\U41'c
503 echo a$
'\u0041\u41\u0C1\U00000041\U41'c
526 echo a$
'b\U0000000'dt
527 echo a$
'b\U00000000'du
537 if [ -z "${UTF8_LOCALE}" ]; then
538 echo 'Skip behave:wysh_unicode, no UTF8_LOCALE'
540 < "${BODY}" DIET
=CURD TIED
= \
541 LC_ALL
=${UTF8_LOCALE} ${MAILX} ${ARGS} 2>/dev/null > "${MBOX}"
542 check behave:wysh_unicode 0 "${MBOX}" '475805847 317'
545 < "${BODY}" DIET=CURD TIED= ${MAILX} ${ARGS} > "${MBOX}" 2>/dev/null
546 check behave:wysh_c 0 "${MBOX}" '1473887148 321'
551 t_behave_input_inject_semicolon_seq() {
554 ${cat} <<- '__EOT' | ${MAILX} ${ARGS} > "${MBOX}"
559 echon this_is_mymac
;call mydeepmac
;echon
';';
561 echon one
';';call mymac
;echon two
";";call mymac
;echo three$
';';
563 echon this_is_mymac
;call mydeepmac
;echon
,TOO
'!;';
565 echon one
';';call mymac
;echon two
";";call mymac
;echo three$
';';
568 check behave
:input_inject_semicolon_seq
0 "${MBOX}" '512117110 140'
573 t_behave_commandalias
() {
576 ${cat} <<- '__EOT' | ${MAILX} ${ARGS} > "${MBOX}"
577 commandalias echo echo hoho
581 commandalias XxX XxXx
582 commandalias XxXx XxXxX
583 commandalias XxXxX XxXxXx
584 commandalias XxXxXx echo huhu
585 commandalias XxXxXxX echo huhu
587 commandalias XxXxXx XxXxXxX
590 commandalias XxXxXx echo huhu
594 check behave:commandalias 0 "${MBOX}" '3694143612 31'
602 # Nestable conditions test
603 ${cat} <<- '__EOT' | ${MAILX} ${ARGS} > "${MBOX}"
625 if $dietcurd == 'yoho'
630 if $dietcurd @
== 'Yoho'
635 if $dietcurd == 'Yoho'
640 if $dietcurd != 'yoho'
645 if $dietcurd @
!= 'Yoho'
650 if $dietcurd != 'Yoho'
711 if $dietcurd == 'yohu'
713 elif $dietcurd == 'yoha'
715 elif $dietcurd == 'yohe'
717 elif $dietcurd == 'yoho'
719 if $dietcurd == 'yohu'
721 elif $dietcurd == 'yoha'
723 elif $dietcurd == 'yohe'
725 elif $dietcurd == 'yoho'
727 if $dietcurd == 'yohu'
729 elif $dietcurd == 'yoha'
731 elif $dietcurd == 'yohe'
733 elif $dietcurd == 'yoho'
882 set diet
=abc curd
=abc
888 set diet
=abc curd
=abcd
894 # 1. Shitty grouping capabilities as of today
895 unset diet curd ndefined
896 if [ [ false
] ||
[ false
] ||
[ true
] ] && [ [ false
] ||
[ true
] ] && \
902 if [ [ [ [ 0 ] ||
[ 1 ] ] && [ [ 1 ] ||
[ 0 ] ] ] && [ 1 ] ] && [ yes ]
907 if [ [ 1 ] ||
[ 0 ] ||
[ 0 ] ||
[ 0 ] ]
912 if [ [ 1 ] ||
[ 0 ] ||
[ 0 ] ||
[ 0 ] ||
[ [ 1 ] ] ]
917 if [ [ 1 ] ||
[ 0 ] ||
[ 0 ] ||
[ 0 ] ||
[ [ 1 ] ] ||
[ 1 ] ] && [ no
]
922 if [ [ 1 ] ||
[ 0 ] ||
[ 0 ] ||
[ 0 ] ||
[ [ 1 ] ] ||
[ 1 ] ] \
928 if [ [ [ [ [ [ [ 1 ] ] && [ 1 ] ] && [ 1 ] ] && [ 1 ] ] ] && [ 1 ] ]
933 if [ [ [ [ [ [ [ 1 ] ] && [ 1 ] ] && [ 1 ] ] && [ 1 ] ] ] && [ 0 ] ]
938 if [ [ [ [ [ [ [ 1 ] ] && [ 1 ] ] && [ 0 ] ] && [ 1 ] ] ] && [ 1 ] ]
943 if [ [ [ [ [ [ [ 0 ] ] && [ 1 ] ] && [ 1 ] ] && [ 1 ] ] ] && [ 1 ] ]
948 if [ 1 ] ||
[ 0 ] ||
[ 0 ] ||
[ 0 ] && [ 0 ]
953 if [ 1 ] ||
[ 0 ] ||
[ 0 ] ||
[ 0 ] && [ 1 ]
958 if [ 0 ] ||
[ 0 ] ||
[ 0 ] ||
[ 1 ] && [ 0 ]
963 if [ 0 ] ||
[ 0 ] ||
[ 0 ] ||
[ 1 ] && [ 1 ]
968 if [ 0 ] ||
[ 0 ] ||
[ 0 ] ||
[ 1 ] && [ 0 ] ||
[ 1 ] && [ 0 ]
973 if [ 0 ] ||
[ 0 ] ||
[ 0 ] ||
[ 1 ] && [ 0 ] ||
[ 1 ] && [ 1 ]
979 if [ [ $diet == 'yo' ] && [ $curd == 'ho' ] ] && [ $ndefined ]
985 if [ [ $diet == 'yo' ] && [ $curd == 'ho' ] ] && [ $ndefined ]
990 # 2. Shitty grouping capabilities as of today
991 unset diet curd ndefined
992 if [ false || false || true
] && [ false || true
] && yes
997 if [ [ [ 0 ||
1 ] && [ 1 ||
0 ] ] && 1 ] && [ yes ]
1002 if [ 1 ||
0 ||
0 ||
0 ]
1007 if [ 1 ||
0 ||
0 ||
0 ||
[ 1 ] ]
1012 if [ 1 ||
0 ||
0 ||
0 ||
[ 1 ] ||
1 ] && no
1017 if [ 1 ||
0 ||
0 ||
0 ||
1 ||
[ 1 ] ] && no ||
[ yes ]
1022 if [ [ [ [ [ [ 1 ] && 1 ] && 1 ] && 1 ] ] && [ 1 ] ]
1027 if [ [ [ [ [ [ 1 ] && 1 ] && 1 ] && [ 1 ] ] ] && 0 ]
1032 if [ [ [ [ [ [ [ 1 ] ] && 1 ] && 0 ] && [ 1 ] ] ] && 1 ]
1037 if [ [ [ [ [ [ 0 ] && 1 ] && 1 ] && 1 ] ] && 1 ]
1042 if 1 ||
0 ||
0 ||
0 && 0
1047 if 1 ||
0 ||
0 ||
0 && 1
1052 if 0 ||
0 ||
0 ||
1 && 0
1057 if 0 ||
0 ||
0 ||
1 && 1
1062 if 0 ||
0 ||
0 ||
1 && 0 ||
1 && 0
1067 if 0 ||
0 ||
0 ||
1 && 0 ||
1 && 1
1073 if [ $diet == 'yo' && $curd == 'ho' ] && $ndefined
1078 if $diet == 'yo' && $curd == 'ho' && $ndefined
1084 if [ $diet == 'yo' && $curd == 'ho' ] && $ndefined
1089 if $diet == 'yo' && $curd == 'ho' && $ndefined
1094 if [ [ [ [ [ [ $diet == 'yo' && $curd == 'ho' && $ndefined ] ] ] ] ] ]
1099 # Some more en-braced variables
1101 if ${diet} == ${curd}
1106 if ${diet} != ${curd}
1122 if ! 0 && ! ! 1 && ! ! ! ! 2 && 3
1127 if ! 0 && ! [ ! 1 ] && ! [ ! [ ! [ ! 2 ] ] ] && 3
1132 if [ ! 0 ] && [ ! [ ! 1 ] ] && [ ! [ ! [ ! [ ! [ 2 ] ] ] ] ] && 3
1137 if [ ! 0 ] && [ ! [ ! 1 ] ] && [ ! [ ! [ ! [ ! [ 2 ] ] ] ] ] && ! 3
1142 if [ ! 0 ] && [ ! [ ! 1 ] ] && ! [ [ ! [ ! [ ! [ 2 ] ] ] ] ] && ! 3
1147 if [ ! 0 ] && ! [ ! [ ! 1 ] ] && [ ! [ ! [ ! [ ! [ 2 ] ] ] ] ] && 3
1152 if ! [ ! 0 ] && [ ! [ ! 1 ] ] && [ ! [ ! [ ! [ ! [ 2 ] ] ] ] ] && 3
1157 if [ ! 0 ] && [ ! [ ! 1 ] ] && [ ! [ ! [ ! [ ! [ 2 ] ] ] ] ] ||
3
1162 if [ ! 0 ] && [ ! ! [ ! ! 1 ] ] && [ ! ! [ ! ! [ ! ! [ ! ! [ 2 ] ] ] ] ]
1168 if ! 0 && ! ! 1 && ! ! ! 0 && 3
1173 if ! 0 && ! [ ! 1 ] && ! [ ! [ ! [ 0 ] ] ] && 3
1178 if [ ! 0 ] && [ ! [ ! 1 ] ] && [ ! [ ! [ ! [ [ 0 ] ] ] ] ] && 3
1183 if [ ! 0 ] && [ ! [ ! 1 ] ] && [ ! [ ! ! [ ! [ ! 0 ] ] ] ] && ! 3
1188 if [ ! 0 ] && [ ! [ ! 1 ] ] && ! [ ! [ ! [ ! [ ! 0 ] ] ] ] && 3
1193 if [ ! 0 ] && ! [ ! [ ! 1 ] ] && [ ! ! [ ! [ ! [ ! [ 0 ] ] ] ] ] && 3
1198 if ! [ ! 0 ] && [ ! [ ! 1 ] ] && [ ! [ ! [ ! [ ! ! 0 ] ] ] ] && 3
1203 if [ ! 0 ] && [ ! [ ! 1 ] ] && [ ! [ ! [ ! [ ! [ ! 0 ] ] ] ] ] ||
3
1208 if [ ! 0 ] && [ ! ! [ ! ! 1 ] ] && [ ! ! [ ! ! [ ! ! [ ! [ 0 ] ] ] ] ]
1215 check behave
:if-normal
0 "${MBOX}" '1688759742 719'
1217 if have_feat regex
; then
1218 ${cat} <<- '__EOT' | ${MAILX} ${ARGS} > "${MBOX}"
1220 if $dietcurd =~ '^yo.*'
1225 if $dietcurd =~ '^Yo.*'
1230 if $dietcurd @=~ '^Yo.*'
1235 if $dietcurd =~ '^yOho.+'
1240 if $dietcurd @!~ '.*Ho$'
1245 if $dietcurd !~ '.+yohO$'
1250 if [ $dietcurd @i!~ '.+yoho$' ]
1255 if ! [ $dietcurd @i=~ '.+yoho$' ]
1260 if ! ! [ $dietcurd @i!~ '.+yoho$' ]
1265 if ! [ ! [ $dietcurd @i!~ '.+yoho$' ] ]
1270 if [ ! [ ! [ $dietcurd @i!~ '.+yoho$' ] ] ]
1275 if ! [ ! [ ! [ $dietcurd !~ '.+yoho$' ] ] ]
1280 if ! ! ! $dietcurd !~ '.+yoho$'
1285 if ! ! ! $dietcurd =~ '.+yoho$'
1290 if ! [ ! ! [ ! [ $dietcurd !~ '.+yoho$' ] ] ]
1295 set diet=abc curd='^abc$'
1301 set diet=abc curd='^abcd$'
1309 check behave:if-regex 0 "${MBOX}" '1115671789 95'
1311 printf 'behave:if-regex: unsupported, skipped\n'
1317 t_behave_localopts() {
1320 # Nestable conditions test
1321 ${cat} <<- '__EOT' | ${MAILX} ${ARGS} > "${MBOX}" 2>&1
1336 echo $gv1 $lv1 ${lv2} ${lv3} ${gv2}, $t2
1341 echo $gv1 $lv1 ${lv2} ${lv3} ${gv2}, $t2
1342 echo "$gv1 $lv1 ${lv2} ${lv3} ${gv2}, $t2"
1351 echo active trouble
: $gv1 $lv1 ${lv2} ${lv3} ${gv2}, $t3
1353 echo active null
: $gv1 $lv1 ${lv2} ${lv3} ${gv2}, $t3
1362 wysh
set y
=$1; shift; eval localopts
$y; localopts
$1; shift
1369 wysh
set y
=$1; shift; eval localopts
$y; localopts
$1; shift
1376 echo ----- $1: $2 -> $3 -> $4
1384 call llx
'call off' on on on
1385 call llx
'call off' off on on
1386 call llx
'call off' on off on
1387 call llx
'call off' on off off
1388 localopts call-fixate on
1389 call llx
'call-fixate on' on on on
1390 call llx
'call-fixate on' off on on
1391 call llx
'call-fixate on' on off on
1392 call llx
'call-fixate on' on off off
1393 unset x
;localopts call on
1394 call llx
'call on' on on on
1395 call llx
'call on' off on on
1396 call llx
'call on' on off on
1397 call llx
'call on' on off off
1402 check behave
:localopts
0 "${MBOX}" '4016155249 1246'
1407 t_behave_macro_param_shift
() {
1410 ${cat} <<- '__EOT' | ${MAILX} ${ARGS} > "${MBOX}" 2>/dev/null
1413 echo t2.0 has $#/${#} parameters: "$1,${2},$3" (${*}) [$@]
1418 echo t2.1 has $#/${#} parameters: "$1,${2},$3" (${*}) [$@]
1419 if [ $# > 1 ] || [ $ignerr == '' ]
1424 echo t2.2:$? has $#/${#} parameters: "$1,${2},$3" (${*}) [$@]
1426 echo t2.3:$? has $#/${#} parameters: "$1,${2},$3" (${*}) [$@]
1430 echo t2.4:$? has $#/${#} parameters: "$1,${2},$3" (${*}) [$@]
1435 call t2 1 you get four args
1436 echo t1.1: $?';' ignerr ($ignerr) should not exist
1437 call t2 1 you get 'three args'
1438 echo t1.2: $?';' ignerr ($ignerr) should not exist
1439 call t2 1 you 'get two args'
1440 echo t1.3: $?';' ignerr ($ignerr) should not exist
1441 call t2 1 'you get one arg'
1442 echo t1.4: $?';' ignerr ($ignerr) should not exist
1443 ignerr call t2 '' 'you get one arg'
1444 echo t1.5: $?';' ignerr ($ignerr) should not exist
1449 check behave:macro_param_shift 0 "${MBOX}" '1402489146 1682'
1454 t_behave_addrcodec() {
1457 ${cat} <<- '__EOT' | ${MAILX} ${ARGS} > "${MBOX}"
1458 vput addrcodec res e
1 <doog@def
>
1459 echo $?
/$^ERRNAME
$res
1460 eval vput addrcodec res d
$res
1461 echo $?
/$^ERRNAME
$res
1462 vput addrcodec res e
2 .
<doog@def
>
1463 echo $?
/$^ERRNAME
$res
1464 eval vput addrcodec res d
$res
1465 echo $?
/$^ERRNAME
$res
1466 vput addrcodec res e
3 Sauer Dr.
<doog@def
>
1467 echo $?
/$^ERRNAME
$res
1468 eval vput addrcodec res d
$res
1469 echo $?
/$^ERRNAME
$res
1470 vput addrcodec res e
3.50 Sauer
(Ma
) Dr.
<doog@def
>
1471 echo $?
/$^ERRNAME
$res
1472 eval vput addrcodec res d
$res
1473 echo $?
/$^ERRNAME
$res
1474 vput addrcodec res e
3.51 Sauer
(Ma
) "Dr." <doog@def
>
1475 echo $?
/$^ERRNAME
$res
1476 eval vput addrcodec res d
$res
1477 echo $?
/$^ERRNAME
$res
1479 vput addrcodec res
+e
4 Sauer
(Ma
) Dr.
<doog@def
>
1480 echo $?
/$^ERRNAME
$res
1481 eval vput addrcodec res d
$res
1482 echo $?
/$^ERRNAME
$res
1483 vput addrcodec res
+e
5 Sauer
(Ma
) Braten Dr.
<doog@def
>
1484 echo $?
/$^ERRNAME
$res
1485 eval vput addrcodec res d
$res
1486 echo $?
/$^ERRNAME
$res
1487 vput addrcodec res
+e
6 Sauer
(Ma
) Braten Dr.
(Heu
) <doog@def
>
1488 echo $?
/$^ERRNAME
$res
1489 eval vput addrcodec res d
$res
1490 echo $?
/$^ERRNAME
$res
1491 vput addrcodec res
+e
7 Sauer
(Ma
) Braten Dr.
(Heu
) <doog@def
> (bu
)
1492 echo $?
/$^ERRNAME
$res
1493 eval vput addrcodec res d
$res
1494 echo $?
/$^ERRNAME
$res
1495 vput addrcodec res
+e
8 \
1496 Dr. Sauer
(Ma
) Braten Dr.
(Heu
) <doog@def
> (bu
) Boom. Boom
1497 echo $?
/$^ERRNAME
$res
1498 eval vput addrcodec res d
$res
1499 echo $?
/$^ERRNAME
$res
1500 vput addrcodec res
+e
9 Dr.Sauer
(Ma
)Braten Dr.
(Heu
) <doog@def
>
1501 echo $?
/$^ERRNAME
$res
1502 eval vput addrcodec res d
$res
1503 echo $?
/$^ERRNAME
$res
1504 vput addrcodec res
+e
10 (Ma
)Braten Dr.
(Heu
) <doog@def
>
1505 echo $?
/$^ERRNAME
$res
1506 eval vput addrcodec res d
$res
1507 echo $?
/$^ERRNAME
$res
1508 vput addrcodec res
+e
11 (Ma
)Braten Dr
"." (Heu
) <doog@def
>
1509 echo $?
/$^ERRNAME
$res
1510 eval vput addrcodec res d
$res
1511 echo $?
/$^ERRNAME
$res
1512 vput addrcodec res
+e
12 Dr. Sauer
(Ma
) Braten Dr.
(u
) <doog@def
>
1513 echo $?
/$^ERRNAME
$res
1514 eval vput addrcodec res d
$res
1515 echo $?
/$^ERRNAME
$res
1516 vput addrcodec res
+e
13(Ma
)Braten Dr.
(Heu
) <doog@def
>
1517 echo $?
/$^ERRNAME
$res
1518 eval vput addrcodec res d
$res
1519 echo $?
/$^ERRNAME
$res
1520 vput addrcodec res
+e
14 Hey
, Du
<doog@def
> Wie
() findet Dr. das?
()
1521 echo $?
/$^ERRNAME
$res
1522 eval vput addrcodec res d
$res
1523 echo $?
/$^ERRNAME
$res
1524 vput addrcodec res
+e
15 \
1525 Hey
, Du
<doog@def
> Wie
() findet
"" Dr.
"" das?
()
1526 echo $?
/$^ERRNAME
$res
1527 eval vput addrcodec res d
$res
1528 echo $?
/$^ERRNAME
$res
1529 vput addrcodec res
+e
16 \
1530 "Hey," "Du" <doog@def
> "Wie()" findet
"" Dr.
"" das?
()
1531 echo $?
/$^ERRNAME
$res
1532 eval vput addrcodec res d
$res
1533 echo $?
/$^ERRNAME
$res
1534 vput addrcodec res
+e
17 \
1535 "Hey" Du
<doog@def
> "Wie() findet " " Dr. """ das?
()
1536 echo $?
/$^ERRNAME
$res
1537 eval vput addrcodec res d
$res
1538 echo $?
/$^ERRNAME
$res
1539 vput addrcodec res
+e
18 \
1540 <doog@def
> "Hey" Du
"Wie() findet " " Dr. """ das?
()
1541 echo $?
/$^ERRNAME
$res
1542 eval vput addrcodec res d
$res
1543 echo $?
/$^ERRNAME
$res
1544 vput addrcodec res
+e
19 Hey\
,\" <doog@def
> "Wie()" findet
\" Dr.
\" das?
1545 echo $?
/$^ERRNAME
$res
1546 eval vput addrcodec res d
$res
1547 echo $?
/$^ERRNAME
$res
1549 vput addrcodec res
++e
20 Hey\
,\" <doog@def
> "Wie()" findet
\" Dr.
\" das?
1550 echo $?
/$^ERRNAME
$res
1551 vput addrcodec res
++e
21 Hey\
,\"" <doog@def> "Wie
()" findet \" Dr. \" das?
1552 echo $?/$^ERRNAME $res
1553 eval vput addrcodec res d $res
1554 echo $?/$^ERRNAME $res
1556 vput addrcodec res +++e 22 Hey\\,\" <doog@def> "Wie
()" findet \" Dr. \" das?
1557 echo $?/$^ERRNAME $res
1558 eval vput addrcodec res d $res
1559 echo $?/$^ERRNAME $res
1561 vput addrcodec res s \
1562 "23 Hey
\\,\\\" \"Wie
" () "\" findet
\\\" Dr.
\\\" das?
" <doog@def>
1563 echo $?/$^ERRNAME $res
1566 check behave:addrcodec 0 "${MBOX}" '429099645 2414'
1574 ${cat} <<- '__EOT' | ${MAILX} ${ARGS} > "${MBOX}" 2>/dev
/null
1575 vput vexpr res
= 9223372036854775807
1576 echo $?
/$^ERRNAME
$res
1577 vput vexpr res
= 9223372036854775808
1578 echo $?
/$^ERRNAME
$res
1579 vput vexpr res
=@
9223372036854775808
1580 echo $?
/$^ERRNAME
$res
1581 vput vexpr res
= -9223372036854775808
1582 echo $?
/$^ERRNAME
$res
1583 vput vexpr res
= -9223372036854775809
1584 echo $?
/$^ERRNAME
$res
1585 vput vexpr res
=@
-9223372036854775809
1586 echo $?
/$^ERRNAME
$res
1589 echo $?
/$^ERRNAME
$res
1591 echo $?
/$^ERRNAME
$res
1593 echo $?
/$^ERRNAME
$res
1595 vput vexpr res
+ 0 0
1596 echo $?
/$^ERRNAME
$res
1597 vput vexpr res
+ 0 1
1598 echo $?
/$^ERRNAME
$res
1599 vput vexpr res
+ 1 1
1600 echo $?
/$^ERRNAME
$res
1602 vput vexpr res
+ 9223372036854775807 0
1603 echo $?
/$^ERRNAME
$res
1604 vput vexpr res
+ 9223372036854775807 1
1605 echo $?
/$^ERRNAME
$res
1606 vput vexpr res
+@
9223372036854775807 1
1607 echo $?
/$^ERRNAME
$res
1608 vput vexpr res
+ 0 9223372036854775807
1609 echo $?
/$^ERRNAME
$res
1610 vput vexpr res
+ 1 9223372036854775807
1611 echo $?
/$^ERRNAME
$res
1612 vput vexpr res
+@
1 9223372036854775807
1613 echo $?
/$^ERRNAME
$res
1615 vput vexpr res
+ -9223372036854775808 0
1616 echo $?
/$^ERRNAME
$res
1617 vput vexpr res
+ -9223372036854775808 -1
1618 echo $?
/$^ERRNAME
$res
1619 vput vexpr res
+@
-9223372036854775808 -1
1620 echo $?
/$^ERRNAME
$res
1621 vput vexpr res
+ 0 -9223372036854775808
1622 echo $?
/$^ERRNAME
$res
1623 vput vexpr res
+ -1 -9223372036854775808
1624 echo $?
/$^ERRNAME
$res
1625 vput vexpr res
+@
-1 -9223372036854775808
1626 echo $?
/$^ERRNAME
$res
1628 vput vexpr res
- 0 0
1629 echo $?
/$^ERRNAME
$res
1630 vput vexpr res
- 0 1
1631 echo $?
/$^ERRNAME
$res
1632 vput vexpr res
- 1 1
1633 echo $?
/$^ERRNAME
$res
1635 vput vexpr res
- 9223372036854775807 0
1636 echo $?
/$^ERRNAME
$res
1637 vput vexpr res
- 9223372036854775807 -1
1638 echo $?
/$^ERRNAME
$res
1639 vput vexpr res
-@
9223372036854775807 -1
1640 echo $?
/$^ERRNAME
$res
1641 vput vexpr res
- 0 9223372036854775807
1642 echo $?
/$^ERRNAME
$res
1643 vput vexpr res
- -1 9223372036854775807
1644 echo $?
/$^ERRNAME
$res
1645 vput vexpr res
- -2 9223372036854775807
1646 echo $?
/$^ERRNAME
$res
1647 vput vexpr res
-@
-2 9223372036854775807
1648 echo $?
/$^ERRNAME
$res
1650 vput vexpr res
- -9223372036854775808 +0
1651 echo $?
/$^ERRNAME
$res
1652 vput vexpr res
- -9223372036854775808 +1
1653 echo $?
/$^ERRNAME
$res
1654 vput vexpr res
-@
-9223372036854775808 +1
1655 echo $?
/$^ERRNAME
$res
1656 vput vexpr res
- 0 -9223372036854775808
1657 echo $?
/$^ERRNAME
$res
1658 vput vexpr res
- +1 -9223372036854775808
1659 echo $?
/$^ERRNAME
$res
1660 vput vexpr res
-@
+1 -9223372036854775808
1661 echo $?
/$^ERRNAME
$res
1663 vput vexpr res
+ -13 -2
1664 echo $?
/$^ERRNAME
$res
1665 vput vexpr res
- 0 0
1666 echo $?
/$^ERRNAME
$res
1667 vput vexpr res
- 0 1
1668 echo $?
/$^ERRNAME
$res
1669 vput vexpr res
- 1 1
1670 echo $?
/$^ERRNAME
$res
1671 vput vexpr res
- -13 -2
1672 echo $?
/$^ERRNAME
$res
1674 vput vexpr res
* 0 0
1675 echo $?
/$^ERRNAME
$res
1676 vput vexpr res
* 0 1
1677 echo $?
/$^ERRNAME
$res
1678 vput vexpr res
* 1 1
1679 echo $?
/$^ERRNAME
$res
1680 vput vexpr res
* -13 -2
1681 echo $?
/$^ERRNAME
$res
1683 vput vexpr res
/ 0 0
1684 echo $?
/$^ERRNAME
$res
1685 vput vexpr res
/ 0 1
1686 echo $?
/$^ERRNAME
$res
1687 vput vexpr res
/ 1 1
1688 echo $?
/$^ERRNAME
$res
1689 vput vexpr res
/ -13 -2
1690 echo $?
/$^ERRNAME
$res
1692 vput vexpr res
% 0 0
1693 echo $?
/$^ERRNAME
$res
1694 vput vexpr res
% 0 1
1695 echo $?
/$^ERRNAME
$res
1696 vput vexpr res
% 1 1
1697 echo $?
/$^ERRNAME
$res
1698 vput vexpr res
% -13 -2
1699 echo $?
/$^ERRNAME
$res
1702 check behave
:vexpr-numeric
0 "${MBOX}" '1723609217 1048'
1704 ${cat} <<- '__EOT' | ${MAILX} ${ARGS} > "${MBOX}" #2>/dev/null
1705 vput vexpr res find 'bananarama' 'nana'
1706 echo $?/$^ERRNAME :$res:
1707 vput vexpr res find 'bananarama' 'bana'
1708 echo $?/$^ERRNAME :$res:
1709 vput vexpr res find 'bananarama' 'Bana'
1710 echo $?/$^ERRNAME :$res:
1711 vput vexpr res find 'bananarama' 'rama'
1712 echo $?/$^ERRNAME :$res:
1714 vput vexpr res ifind 'bananarama' 'nana'
1715 echo $?/$^ERRNAME :$res:
1716 vput vexpr res ifind 'bananarama' 'bana'
1717 echo $?/$^ERRNAME :$res:
1718 vput vexpr res ifind 'bananarama' 'Bana'
1719 echo $?/$^ERRNAME :$res:
1720 vput vexpr res ifind 'bananarama' 'rama'
1721 echo $?/$^ERRNAME :$res:
1723 vput vexpr res substring 'bananarama' 1
1724 echo $?/$^ERRNAME :$res:
1725 vput vexpr res substring 'bananarama' 3
1726 echo $?/$^ERRNAME :$res:
1727 vput vexpr res substring 'bananarama' 5
1728 echo $?/$^ERRNAME :$res:
1729 vput vexpr res substring 'bananarama' 7
1730 echo $?/$^ERRNAME :$res:
1731 vput vexpr res substring 'bananarama' 9
1732 echo $?/$^ERRNAME :$res:
1733 vput vexpr res substring 'bananarama' 10
1734 echo $?/$^ERRNAME :$res:
1735 vput vexpr res substring 'bananarama' 1 3
1736 echo $?/$^ERRNAME :$res:
1737 vput vexpr res substring 'bananarama' 3 3
1738 echo $?/$^ERRNAME :$res:
1739 vput vexpr res substring 'bananarama' 5 3
1740 echo $?/$^ERRNAME :$res:
1741 vput vexpr res substring 'bananarama' 7 3
1742 echo $?/$^ERRNAME :$res:
1743 vput vexpr res substring 'bananarama' 9 3
1744 echo $?/$^ERRNAME :$res:
1745 vput vexpr res substring 'bananarama' 10 3
1746 echo $?/$^ERRNAME :$res:
1750 check behave:vexpr-string 0 "${MBOX}" '265398700 267'
1752 if have_feat regex; then
1753 ${cat} <<- '__EOT' | ${MAILX} ${ARGS} > "${MBOX}" #2>/dev/null
1754 vput vexpr res regex
'bananarama' 'nana'
1755 echo $?
/$^ERRNAME
:$res:
1756 vput vexpr res regex
'bananarama' 'bana'
1757 echo $?
/$^ERRNAME
:$res:
1758 vput vexpr res regex
'bananarama' 'Bana'
1759 echo $?
/$^ERRNAME
:$res:
1760 vput vexpr res regex
'bananarama' 'rama'
1761 echo $?
/$^ERRNAME
:$res:
1763 vput vexpr res iregex
'bananarama' 'nana'
1764 echo $?
/$^ERRNAME
:$res:
1765 vput vexpr res iregex
'bananarama' 'bana'
1766 echo $?
/$^ERRNAME
:$res:
1767 vput vexpr res iregex
'bananarama' 'Bana'
1768 echo $?
/$^ERRNAME
:$res:
1769 vput vexpr res iregex
'bananarama' 'rama'
1770 echo $?
/$^ERRNAME
:$res:
1772 vput vexpr res regex
'bananarama' '(.*)nana(.*)' '\${1}a\${0}u{\$2}'
1773 echo $?
/$^ERRNAME
:$res:
1774 vput vexpr res regex
'bananarama' '(.*)bana(.*)' '\${1}a\${0}u\$2'
1775 echo $?
/$^ERRNAME
:$res:
1776 vput vexpr res regex
'bananarama' 'Bana(.+)' '\$1\$0'
1777 echo $?
/$^ERRNAME
:$res:
1778 vput vexpr res regex
'bananarama' '(.+)rama' '\$1\$0'
1779 echo $?
/$^ERRNAME
:$res:
1781 vput vexpr res iregex
'bananarama' '(.*)nana(.*)' '\${1}a\${0}u{\$2}'
1782 echo $?
/$^ERRNAME
:$res:
1783 vput vexpr res iregex
'bananarama' '(.*)bana(.*)' '\${1}a\${0}u\$2'
1784 echo $?
/$^ERRNAME
:$res:
1785 vput vexpr res iregex
'bananarama' 'Bana(.+)' '\$1\$0'
1786 echo $?
/$^ERRNAME
:$res:
1787 vput vexpr res iregex
'bananarama' '(.+)rama' '\$1\$0'
1788 echo $?
/$^ERRNAME
:$res:
1792 check behave
:vexpr-regex
0 "${MBOX}" '3270360157 311'
1794 printf 'behave:vexpr-regex: unsupported, skipped\n'
1800 t_behave_call_ret
() {
1803 ${cat} <<- '__EOT' | ${MAILX} ${ARGS} -Snomemdebug > "${MBOX}" 2>&1
1808 vput vexpr j '&' $i 7
1814 vput vexpr j '&' $i 7
1820 echo ! The end for $1
1824 # Transport $?/$! up the call chain
1830 wysh set i=$? j=$! k=$^ERRNAME
1834 echo ! The end for $1
1835 return $i $^ERR-BUSY
1839 # Up and down it goes
1846 vput vexpr k - $1 $2
1850 echo "# <$i/$j> .. "
1854 eval echon
"<\$1=\$i/\$^ERRNAME-$j "
1857 echo ! The end
for $1=$i/$2
1861 return $i $^ERR-BUSY
1867 call w1
0; echo ?
=$?
!=$
!; echo -----;
1868 call w2
0; echo ?
=$?
!=$^ERRNAME
; echo -----;
1869 call w3
0 1; echo ?
=$?
!=$^ERRNAME
; echo -----;
1872 check behave
:call_ret
0 "${MBOX}" '1572045517 5922'
1880 ${cat} <<- '__EOT' | ${MAILX} ${ARGS} -Snomemdebug > "${MBOX}" 2>&1
1885 vput vexpr j '&' $i 7
1891 echo ! The end for $1/$2
1893 return $i $^ERR-BUSY
1904 echo ?=$? !=$^ERRNAME
1907 echo ?=$? !=$^ERRNAME
1909 echo ?=$? !=$^ERRNAME
1912 check behave:xcall-1 0 "${MBOX}" '2401702082 23801'
1916 ${cat} <<- '__EOT' > "${BODY}"
1921 vput vexpr j '&' $i 7
1927 echo ! The end for $1
1930 echo would be err with errexit
1939 echo zwei, ?=$? !=$!
1940 localopts yes; set errexit
1942 echo drei, ?=$? !=$^ERRNAME
1944 echo vier, ?=$? !=$^ERRNAME, this is an error
1947 echo outer 1, ?=$? !=$^ERRNAME
1949 echo outer 2, ?=$? !=$^ERRNAME, could be error if xxxign non-empty
1951 echo outer 3, ?=$? !=$^ERRNAME
1952 echo this is definitely an error
1955 < "${BODY}" ${MAILX} ${ARGS} -X'commandalias xxxign ignerr' -Snomemdebug \
1957 check behave
:xcall-2
0 "${MBOX}" '3900716531 4200'
1959 < "${BODY}" ${MAILX} ${ARGS} -X'commandalias xxxign " "' -Snomemdebug \
1961 check behave:xcall-3 1 "${MBOX}" '1006776201 2799'
1966 t_behave_vpospar() {
1969 ${cat} <<- '__EOT' | ${MAILX} ${ARGS} > "${MBOX}" 2>&1
1970 vpospar
set hey
, "'you ", world
!
1971 echo $?
/$^ERRNAME
/$#: $
* / "$@" / <$1><$2><$3><$4>
1972 vput vpospar x quote
; echo x
<$x>
1973 vpospar
clear;echo $?
/$^ERRNAME
/$#: $
* / "$@" / <$1><$2><$3><$4>
1974 vput vpospar y quote
;echo y
<$y>
1975 eval vpospar
set ${x};echo $?
/$^ERRNAME
/$#: $
* / "$@" / <$1><$2><$3><$4>
1976 eval vpospar
set ${y};echo $?
/$^ERRNAME
/$#: $
* / "$@" / <$1><$2><$3><$4>
1977 eval vpospar
set ${x};echo $?
/$^ERRNAME
/$#: $
* / "$@" / <$1><$2><$3><$4>
1980 echo infun2
:$?
/$^ERRNAME
/$#:$
*/"$@"/<$1><$2><$3><$4>
1981 vput vpospar z quote
;echo infun2
:z
<$z>
1985 echo infun
:$?
/$^ERRNAME
/$#:$
*/"$@"/<$1><$2><$3><$4>
1986 vput vpospar y quote
;echo infun
:y
<$y>
1987 eval vpospar
set ${x};echo infun
:$?
/$^ERRNAME
/$#:$
*/"$@"/<$1><$2><$3><$4>
1988 vpospar
clear;echo infun
:$?
/$^ERRNAME
/$#:$
*/"$@"/<$1><$2><$3><$4>
1990 echo infun
:$?
/$^ERRNAME
/$#:$
*/"$@"/<$1><$2><$3><$4>
1991 eval vpospar
set ${y};echo infun
:$?
/$^ERRNAME
/$#:$
*/"$@"/<$1><$2><$3><$4>
1994 call infun This
"in a" fun
1995 echo $?
/$^ERRNAME
/$#: $
* / "$@" / <$1><$2><$3><$4>
1996 vpospar
clear;echo $?
/$^ERRNAME
/$#: $
* / "$@" / <$1><$2><$3><$4>
1998 check behave
:vpospar-1
0 "${MBOX}" '155175639 866'
2001 ${cat} <<- '__EOT' | ${MAILX} ${ARGS} > "${MBOX}" 2>&1
2003 echo ifs<$ifs> ifs-ws<$ifs-ws>
2004 vpospar set hey, "'you ", world!
2005 echo $?/$^ERRNAME/$#: $* / "$@" / <$1><$2><$3><$4>
2006 vput vpospar x quote; echo x<$x>
2007 vpospar clear;echo $?/$^ERRNAME/$#: $* / "$@" / <$1><$2><$3><$4>
2008 eval vpospar set ${x};echo $?/$^ERRNAME/$#: $* / "$@" / <$1><$2><$3><$4>
2011 echo ifs<$ifs> ifs-ws<$ifs-ws>
2012 vpospar set hey, "'you
", world!
2013 echo $?/$^ERRNAME/$#: $* / "$@
" / <$1><$2><$3><$4>
2014 vput vpospar x quote; echo x<$x>
2015 vpospar clear;echo $?/$^ERRNAME/$#: $* / "$@
" / <$1><$2><$3><$4>
2016 eval vpospar set ${x};echo $?/$^ERRNAME/$#: $* / "$@
" / <$1><$2><$3><$4>
2019 echo ifs<$ifs> ifs-ws<$ifs-ws>
2020 vpospar set hey, "'you ", world!
2021 echo $?/$^ERRNAME/$#: $* / "$@" / <$1><$2><$3><$4>
2022 vput vpospar x quote; echo x<$x>
2023 vpospar clear;echo $?/$^ERRNAME/$#: $* / "$@" / <$1><$2><$3><$4>
2024 eval vpospar set ${x};echo $?/$^ERRNAME/$#: $* / "$@" / <$1><$2><$3><$4>
2026 check behave:vpospar-ifs 0 "${MBOX}" '2015927702 706'
2031 t_behave_atxplode() {
2033 TRAP_EXIT_ADDONS="./.t*"
2035 ${cat} > ./.t.sh <<- '___
'; ${cat} > ./.t.rc <<- '___
'
2038 printf " (1/$#: <$1>)"
2040 if [ $# -gt 0 ]; then
2054 printf yyy;yyy 'xxx' "b\$
'\t'u
' "
2055 printf xxx;xxx arg ,b u.
2056 printf xxx;xxx arg , .
2057 printf xxx;xxx arg ,ball.
2063 echon " (1/$#: <$1>)"
2078 echon yyy;call yyy '\call xxx' "b\$
'\t'u
' "
2079 echon xxx;call xxx arg ,b u.
2080 echon xxx;call xxx arg , .
2081 echon xxx;call xxx arg ,ball.
2084 ${MAILX} ${ARGS} -X'source ./.t.rc' -Xx > "${MBOX}" 2>&1
2085 check behave:atxplode-1 0 "${MBOX}" '41566293 164'
2087 #${SHELL} ./.t.sh > ./.tshout 2>&1
2088 #check behave:atxplode:disproof-1 0 ./.tshout '41566293 164'
2095 TRAP_EXIT_ADDONS="./.t*"
2097 ${cat} <<- '__EOT
' > .tin
2098 hey1, "'you
", world!
2099 hey2, "'you ", bugs bunny!
2104 ${cat} <<- '__EOT
' |\
2105 ${MAILX} ${ARGS} -X'readctl create ./.tin' > "${MBOX}" 2>&1
2107 echo $?/$^ERRNAME / <$a><$b><$c>
2109 echo $?/$^ERRNAME / <$a><$b><$c>
2111 echo $?/$^ERRNAME / <$a><$b><$c>
2113 echo $?/$^ERRNAME / <$a><$b><$c>
2115 echo $?/$^ERRNAME / <$a><$b><$c>
2116 readctl remove ./.tin;echo readctl remove:$?/$^ERRNAME
2118 check behave:read-1 0 "${MBOX}" '1527910147 173'
2120 ${cat} <<- '__EOT
' > .tin2
2121 hey2.0,:"'you
",:world!:mars.:
2122 hey2.1,:"'you ",:world!
2123 hey2.2,:"'you
",:bugs bunny!
2129 ${cat} <<- '__EOT' |\
2130 6< .tin2 ${MAILX} ${ARGS} -X 'readctl create 6' > "${MBOX}" 2>&1
2133 echo $?
/$^ERRNAME
/ <$a><$b><$c>
2135 echo $?
/$^ERRNAME
/ <$a><$b><$c>
2137 echo $?
/$^ERRNAME
/ <$a><$b><$c>
2139 echo $?
/$^ERRNAME
/ <$a><$b><$c>
2141 echo $?
/$^ERRNAME
/ <$a><$b><$c>
2143 echo $?
/$^ERRNAME
/ <$a><$b><$c>
2145 echo $?
/$^ERRNAME
/ <$a><$b><$c>
2147 echo $?
/$^ERRNAME
/ <$a><$b><$c>
2148 readctl remove
6;echo readctl remove
:$?
/$^ERRNAME
2150 check behave
:read-ifs
0 "${MBOX}" '890153490 298'
2157 TRAP_EXIT_ADDONS
="./.t*"
2161 while [ ${i} -lt 112 ]; do
2162 printf 'm file://%s\n~s Subject %s\nHello %s!\n~.\n' \
2163 "${MBOX}" "${i}" "${i}"
2166 ) |
${MAILX} ${ARGS}
2167 check behave
:mbox-1
0 "${MBOX}" '1140119864 13780'
2173 ' "${MBOX}" .tmbox1 .tmbox1 |
2174 ${MAILX} ${ARGS} > .tlst
2175 check behave
:mbox-2
0 .tlst
'2739893312 9103'
2181 ' "${MBOX}" .tmbox2 .tmbox2 |
2182 ${MAILX} ${ARGS} > .tlst
2183 check behave
:mbox-3
0 .tlst
'1702194178 9110'
2185 # only the odd (even)
2187 printf 'File "file://%s"
2190 while [ ${i} -lt 112 ]; do
2192 [ ${j} -eq 1 ] && printf '%s ' "${i}"
2199 ) |
${MAILX} ${ARGS} > .tlst
2200 check behave
:mbox-4
0 .tmbox3
'631132924 6890'
2201 check behave
:mbox-5
- .tlst
'2960975049 4573'
2204 printf 'file "file://%s"
2207 while [ ${i} -lt 112 ]; do
2209 [ ${j} -eq 0 ] && [ ${i} -ne 0 ] && printf '%s ' "${i}"
2217 ' .tmbox3 .tmbox3 .tmbox2
2218 ) | ${MAILX} ${ARGS} > .tlst
2219 check behave:mbox-6 0 .tmbox3 '1387070539 13655'
2220 ${sed} 2d < .tlst > .tlstx
2221 check behave:mbox-7 - .tlstx '2729940494 13645'
2226 t_behave_alternates() {
2228 TRAP_EXIT_ADDONS=".
/.t
*"
2230 ${cat} <<-_EOT > ./.tsendmail.sh
2232 (echo 'From Valeriana Sat Jul 08 15:54:03 2017' && ${cat} && echo
2235 chmod 0755 ./.tsendmail.sh
2237 ${cat} <<- '__EOT' | ${MAILX} ${ARGS} -Smta=./.tsendmail.sh > ./.tall 2>&1
2241 alternates a1@b1 a2@b2 a3@b3
2246 echo $?/$^ERRNAME <$rv>
2251 echo $?/$^ERRNAME <$rv>
2254 echo $?/$^ERRNAME <$rv>
2257 echo $?/$^ERRNAME <$rv>
2261 alternates a1@b1 a2@b2 a3@b3
2264 echo $?/$^ERRNAME <$rv>
2267 echo $?/$^ERRNAME <$rv>
2270 echo $?/$^ERRNAME <$rv>
2273 alternates a1@b1 a2@b2 a3@b3
2276 echo $?/$^ERRNAME <$rv>
2279 echo $?/$^ERRNAME <$rv>
2282 echo $?/$^ERRNAME <$rv>
2286 alternates a1@b1 a2@b2 a3@b3
2289 echo $?/$^ERRNAME <$rv>
2293 alternates a1@b1 a1@c1 a1@d1 a2@b2 a3@b3 a3@c3 a3@d3
2295 ~s all alternates, only a1@b1 remains
2297 ~b a3@b3 a3@c3 a3@d3
2306 alternates a1@b1 a1@c1 a2@b2 a3@b3
2308 ~s a1@b1 a1@d1, and a3@c3 a3@d3 remain
2310 ~b a3@b3 a3@c3 a3@d3
2317 alternates a1@b1 a2@b2 a3; set allnet
2319 ~s all alternates via allnet, only a1@b1 remains
2321 ~b a3@b3 a3@c3 a3@d3
2332 echo $?/$^ERRNAME <$rv>
2336 echo $?/$^ERRNAME <$rv>
2340 echo $?/$^ERRNAME <$rv>
2344 echo $?/$^ERRNAME <$rv>
2348 echo $?/$^ERRNAME <$rv>
2352 alternates a1@b1 a2@b2
2355 echo $?/$^ERRNAME <$rv>
2356 alternates a3@b3 a4@b4
2359 echo $?/$^ERRNAME <$rv>
2361 check behave:alternates-1 0 "${MBOX}" '142184864 515'
2362 check behave:alternates-2 - .tall '1878598364 505'
2369 TRAP_EXIT_ADDONS=".
/.t
*"
2371 ${cat} <<-_EOT > ./.tsendmail.sh
2373 (echo 'From Hippocastanum Mon Jun 19 15:07:07 2017' && ${cat} && echo
2376 chmod 0755 ./.tsendmail.sh
2378 ${cat} <<- '__EOT' | ${MAILX} ${ARGS} -Smta=./.tsendmail.sh > ./.tall 2>&1
2380 alias a1 ex2@a1.ple "EX3
<ex3@a1.ple
>"
2382 alias a2 ex1@a2.ple ex2@a2.ple ex3@a2.ple ex4@a2.ple
2384 alias a4 a5 ex1@a4.ple
2386 alias a6 a7 ex1@a6.ple
2400 check behave:alias-1 0 "${MBOX}" '2496925843 272'
2401 check behave:alias-2 - .tall '3548953204 152'
2403 # TODO t_behave_alias: n_ALIAS_MAXEXP is compile-time constant,
2404 # TODO need to somehow provide its contents to the test, then test
2409 t_behave_filetype() {
2411 TRAP_EXIT_ADDONS=".
/.t
*"
2413 ${cat} <<-_EOT > ./.tsendmail.sh
2415 (echo 'From Alchemilla Wed Apr 25 15:12:13 2017' && ${cat} && echo
2418 chmod 0755 ./.tsendmail.sh
2420 printf 'm m1@e.t\nL1\nHy1\n~.\nm m2@e.t\nL2\nHy2\n~@ ./snailmail.jpg\n~.\n' |
2421 ${MAILX} ${ARGS} -Smta=./.tsendmail.sh
2422 check behave:filetype-1 0 "${MBOX}" '1645747150 13536'
2424 if command -v gzip >/dev/null 2>&1; then
2427 printf 'File "%s
"\ncopy 1 ./.t.mbox.gz
2428 copy 2 ./.t.mbox.gz' "${MBOX}" |
2430 -X'filetype gz gzip\ -dc gzip\ -c'
2431 printf 'File ./.t.mbox.gz\ncopy * ./.t.mbox\n' |
2433 -X'filetype gz gzip\ -dc gzip\ -c'
2435 check behave:filetype-2 0 ".
/.t.mbox
" '1645747150 13536'
2437 echo 'behave:filetype-2: unsupported, skipped'
2442 printf 'File "%s
"\ncopy 1 ./.t.mbox.gz
2448 -X'filetype gz gzip\ -dc gzip\ -c' \
2449 -X'filetype mbox.gz "${sed} 1,3d|
${cat}" \
2450 "echo eins
;echo zwei
;echo und mit
${sed} bist Du dabei
;${cat}"'
2451 printf 'File ./.t.mbox.gz\ncopy * ./.t.mbox\n' |
2453 -X'filetype gz gzip\ -dc gzip\ -c' \
2454 -X'filetype mbox.gz "${sed} 1,3d|
${cat}" kill\ 0'
2457 check behave:filetype-3 - ".
/.t.mbox
" '238021003 27092'
2462 t_behave_record_a_resend() {
2464 TRAP_EXIT_ADDONS=".
/.t.record .
/.t.resent
"
2468 m %s\n~s Subject 1.\nHello.\n~.
2469 set record-files add-file-recipients
2470 m %s\n~s Subject 2.\nHello.\n~.
2472 resend 2 ./.t.resent
2473 Resend 1 ./.t.resent
2475 resend 2 ./.t.resent
2476 Resend 1 ./.t.resent
2477 ' ./.t.record "${MBOX}" "${MBOX}" "${MBOX}" |
2480 check behave:record_a_resend-1 0 "${MBOX}" '3057873538 256'
2481 check behave:record_a_resend-2 - .t.record '391356429 460'
2482 check behave:record_a_resend-3 - .t.resent '2685231691 648'
2487 t_behave_e_H_L_opts() {
2489 TRAP_EXIT_ADDONS=".
/.tsendmail.sh .
/.t.mbox
"
2492 ${MAILX} ${ARGS} -ef ./.t.mbox
2493 echo ${?} > "${MBOX}"
2495 ${cat} <<-_EOT > ./.tsendmail.sh
2497 (echo 'From Alchemilla Wed Apr 07 17:03:33 2017' && ${cat} && echo
2500 chmod 0755 ./.tsendmail.sh
2501 printf 'm me@exam.ple\nLine 1.\nHello.\n~.\n' |
2502 ${MAILX} ${ARGS} -Smta=./.tsendmail.sh
2503 printf 'm you@exam.ple\nLine 1.\nBye.\n~.\n' |
2504 ${MAILX} ${ARGS} -Smta=./.tsendmail.sh
2506 ${MAILX} ${ARGS} -ef ./.t.mbox
2507 echo ${?} >> "${MBOX}"
2508 ${MAILX} ${ARGS} -efL @t@me ./.t.mbox
2509 echo ${?} >> "${MBOX}"
2510 ${MAILX} ${ARGS} -efL @t@you ./.t.mbox
2511 echo ${?} >> "${MBOX}"
2512 ${MAILX} ${ARGS} -efL '@>@Line 1' ./.t.mbox
2513 echo ${?} >> "${MBOX}"
2514 ${MAILX} ${ARGS} -efL '@>@Hello.' ./.t.mbox
2515 echo ${?} >> "${MBOX}"
2516 ${MAILX} ${ARGS} -efL '@>@Bye.' ./.t.mbox
2517 echo ${?} >> "${MBOX}"
2518 ${MAILX} ${ARGS} -efL '@>@Good bye.' ./.t.mbox
2519 echo ${?} >> "${MBOX}"
2521 ${MAILX} ${ARGS} -fH ./.t.mbox >> "${MBOX}"
2522 echo ${?} >> "${MBOX}"
2523 ${MAILX} ${ARGS} -fL @t@me ./.t.mbox >> "${MBOX}"
2524 echo ${?} >> "${MBOX}"
2525 ${MAILX} ${ARGS} -fL @t@you ./.t.mbox >> "${MBOX}"
2526 echo ${?} >> "${MBOX}"
2527 ${MAILX} ${ARGS} -fL '@>@Line 1' ./.t.mbox >> "${MBOX}"
2528 echo ${?} >> "${MBOX}"
2529 ${MAILX} ${ARGS} -fL '@>@Hello.' ./.t.mbox >> "${MBOX}"
2530 echo ${?} >> "${MBOX}"
2531 ${MAILX} ${ARGS} -fL '@>@Bye.' ./.t.mbox >> "${MBOX}"
2532 echo ${?} >> "${MBOX}"
2533 ${MAILX} ${ARGS} -fL '@>@Good bye.' ./.t.mbox >> "${MBOX}" 2>/dev
/null
2534 echo ${?} >> "${MBOX}"
2536 check behave
:e_H_L_opts
- "${MBOX}" '1708955574 678'
2541 t_behave_compose_hooks
() { # TODO monster
2543 TRAP_EXIT_ADDONS
="./.t*"
2545 (echo line one
&&echo line two
&&echo line three
) > .
/.treadctl
2546 (echo echo four
&&echo echo five
&&echo echo six
) > .
/.tattach
2548 ${cat} <<-_EOT > ./.tsendmail.sh
2550 (echo 'From PrimulaVeris Wed Apr 10 22:59:00 2017' && ${cat} && echo
2553 chmod 0755 .
/.tsendmail.sh
2555 ${cat} <<'__EOT__' > ./.trc
2557 echoerr "Failed: $1. Bailing out"; echo "~x"; xit
2560 vput vexpr es substr "$1" 0 1
2565 define read_mline_res {
2566 read hl; wysh set len=$? es=$! en=$^ERRNAME;\
2567 echo $len/$es/$^ERRNAME: $hl
2568 if [ $es -ne $^ERR-NONE ]
2569 xcall bail read_mline_res
2571 \xcall read_mline_res
2576 echo "~^header list"; read hl; echo $hl;\
2577 call xerr "$hl" "in_addr ($xh) 0-1"
2579 echo "~^header insert $xh diet <$xh@exam.ple> spliced";\
2580 read es; echo $es; call xerr "$es" "ins_addr $xh 1-1"
2581 echo "~^header insert $xh <${xh}2@exam.ple>";\
2582 read es; echo $es; call xerr "$es" "ins_addr $xh 1-2"
2583 echo "~^header insert $xh ${xh}3@exam.ple";\
2584 read es; echo $es; call xerr "$es" "ins_addr $xh 1-3"
2585 echo "~^header list $xh"; read hl; echo $hl;\
2586 call xerr "$hl" "ins_addr $xh 1-4"
2587 echo "~^header show $xh"; read es; call xerr $es "ins_addr $xh 1-5"
2590 if [ "$t_remove" == "" ]
2594 echo "~^header remove $xh"; read es; call xerr $es "ins_addr $xh 2-1"
2595 echo "~^header remove $xh"; read es; vput vexpr es substr $es 0 3
2597 xcall bail "ins_addr $xh 2-2"
2599 echo "~^header list $xh"; read es; vput vexpr es substr $es 0 3
2601 xcall bail "ins_addr $xh 2-3"
2603 echo "~^header show $xh"; read es; vput vexpr es substr $es 0 3
2605 xcall bail "ins_addr $xh 2-4"
2609 echo "~^header insert $xh diet <$xh@exam.ple> spliced";\
2610 read es; echo $es; call xerr "$es" "ins_addr $xh 3-1"
2611 echo "~^header insert $xh <${xh}2@exam.ple>";\
2612 read es; echo $es; call xerr "$es" "ins_addr $xh 3-2"
2613 echo "~^header insert $xh ${xh}3@exam.ple";\
2614 read es; echo $es; call xerr "$es" "ins_addr $xh 3-3"
2615 echo "~^header list $xh"; read hl; echo $hl;\
2616 call xerr "$hl" "ins_addr $xh 3-4"
2617 echo "~^header show $xh"; read es; call xerr $es "ins_addr $xh 3-5"
2620 echo "~^header remove-at $xh 1"; read es;\
2621 call xerr $es "ins_addr $xh 3-6"
2622 echo "~^header remove-at $xh 1"; read es;\
2623 call xerr $es "ins_addr $xh 3-7"
2624 echo "~^header remove-at $xh 1"; read es;\
2625 call xerr $es "ins_addr $xh 3-8"
2626 echo "~^header remove-at $xh 1"; read es;\
2627 vput vexpr es substr $es 0 3
2629 xcall bail "ins_addr $xh 3-9"
2631 echo "~^header remove-at $xh T"; read es;\
2632 vput vexpr es substr $es 0 3
2634 xcall bail "ins_addr $xh 3-10"
2636 echo "~^header list $xh"; read es;\
2637 vput vexpr es substr $es 0 3
2639 xcall bail "ins_addr $xh 3-11"
2641 echo "~^header show $xh"; read es;\
2642 vput vexpr es substr $es 0 3
2644 xcall bail "ins_addr $xh 3-12"
2648 echo "~^header insert $xh diet <$xh@exam.ple> spliced";\
2649 read es; echo $es; call xerr "$es" "ins_addr $xh 4-1"
2650 echo "~^header insert $xh <${xh}2@exam.ple> (comment) \"Quot(e)d\"";\
2651 read es; echo $es; call xerr "$es" "ins_addr $xh 4-2"
2652 echo "~^header insert $xh ${xh}3@exam.ple";\
2653 read es; echo $es; call xerr "$es" "ins_addr $xh 4-3"
2654 echo "~^header list $xh"; read hl; echo $hl;\
2655 call xerr "$hl" "header list $xh 3-4"
2656 echo "~^header show $xh"; read es; call xerr $es "ins_addr $xh 4-5"
2659 echo "~^header remove-at $xh 3"; read es;\
2660 call xerr $es "ins_addr $xh 4-6"
2661 echo "~^header remove-at $xh 2"; read es;\
2662 call xerr $es "ins_addr $xh 4-7"
2663 echo "~^header remove-at $xh 1"; read es;\
2664 call xerr $es "ins_addr $xh 4-8"
2665 echo "~^header remove-at $xh 1"; read es;\
2666 vput vexpr es substr $es 0 3
2668 xcall bail "ins_addr $xh 4-9"
2670 echo "~^header remove-at $xh T"; read es;\
2671 vput vexpr es substr $es 0 3
2673 xcall bail "ins_addr $xh 4-10"
2675 echo "~^header list $xh"; read es;\
2676 vput vexpr es substr $es 0 3
2678 xcall bail "ins_addr $xh 4-11"
2680 echo "~^header show $xh"; read es;\
2681 vput vexpr es substr $es 0 3
2683 xcall bail "ins_addr $xh 4-12"
2687 wysh set xh=$1 mult=$2
2688 echo "~^header list"; read hl; echo $hl;\
2689 call xerr "$hl" "ins_ref ($xh) 0-1"
2691 echo "~^header insert $xh <$xh@exam.ple>";\
2692 read es; echo $es; call xerr "$es" "ins_ref $xh 1-1"
2694 echo "~^header insert $xh <${xh}2@exam.ple>";\
2695 read es; echo $es; call xerr "$es" "ins_ref $xh 1-2"
2696 echo "~^header insert $xh ${xh}3@exam.ple";\
2697 read es; echo $es; call xerr "$es" "ins_ref $xh 1-3"
2699 echo "~^header insert $xh <${xh}2@exam.ple>"; read es;\
2700 vput vexpr es substr $es 0 3
2702 xcall bail "ins_ref $xh 1-4"
2706 echo "~^header list $xh"; read hl; echo $hl;\
2707 call xerr "$hl" "ins_ref $xh 1-5"
2708 echo "~^header show $xh"; read es; call xerr $es "ins_ref $xh 1-6"
2711 if [ "$t_remove" == "" ]
2715 echo "~^header remove $xh"; read es;\
2716 call xerr $es "ins_ref $xh 2-1"
2717 echo "~^header remove $xh"; read es;\
2718 vput vexpr es substr $es 0 3
2720 xcall bail "ins_ref $xh 2-2"
2722 echo "~^header list $xh"; read es;\
2723 vput vexpr es substr $es 0 3
2725 xcall bail "$es ins_ref $xh 2-3"
2727 echo "~^header show $xh"; read es;\
2728 vput vexpr es substr $es 0 3
2730 xcall bail "ins_ref $xh 2-4"
2734 echo "~^header insert $xh <$xh@exam.ple>";\
2735 read es; echo $es; call xerr "$es" "ins_ref $xh 3-1"
2737 echo "~^header insert $xh <${xh}2@exam.ple>";\
2738 read es; echo $es; call xerr "$es" "ins_ref $xh 3-2"
2739 echo "~^header insert $xh ${xh}3@exam.ple";\
2740 read es; echo $es; call xerr "$es" "ins_ref $xh 3-3"
2742 echo "~^header list $xh";\
2743 read hl; echo $hl; call xerr "$hl" "ins_ref $xh 3-4"
2744 echo "~^header show $xh";\
2745 read es; call xerr $es "ins_ref $xh 3-5"
2748 echo "~^header remove-at $xh 1"; read es;\
2749 call xerr $es "ins_ref $xh 3-6"
2750 if [ $mult -ne 0 ] && [ $xh != subject ]
2751 echo "~^header remove-at $xh 1"; read es;\
2752 call xerr $es "ins_ref $xh 3-7"
2753 echo "~^header remove-at $xh 1"; read es;\
2754 call xerr $es "ins_ref $xh 3-8"
2756 echo "~^header remove-at $xh 1"; read es;\
2757 vput vexpr es substr $es 0 3
2759 xcall bail "ins_ref $xh 3-9"
2761 echo "~^header remove-at $xh T"; read es;\
2762 vput vexpr es substr $es 0 3
2764 xcall bail "ins_ref $xh 3-10"
2766 echo "~^header show $xh"; read es;\
2767 vput vexpr es substr $es 0 3
2769 xcall bail "ins_ref $xh 3-11"
2773 echo "~^header insert $xh <$xh@exam.ple> ";\
2774 read es; echo $es; call xerr "$es" "ins_ref $xh 4-1"
2776 echo "~^header insert $xh <${xh}2@exam.ple> ";\
2777 read es; echo $es; call xerr "$es" "ins_ref $xh 4-2"
2778 echo "~^header insert $xh ${xh}3@exam.ple";\
2779 read es; echo $es; call xerr "$es" "ins_ref $xh 4-3"
2781 echo "~^header list $xh"; read hl; echo $hl;\
2782 call xerr "$hl" "ins_ref $xh 4-4"
2783 echo "~^header show $xh"; read es; call xerr $es "ins_ref $xh 4-5"
2786 if [ $mult -ne 0 ] && [ $xh != subject ]
2787 echo "~^header remove-at $xh 3"; read es;\
2788 call xerr $es "ins_ref $xh 4-6"
2789 echo "~^header remove-at $xh 2"; read es;\
2790 call xerr $es "ins_ref $xh 4-7"
2792 echo "~^header remove-at $xh 1"; read es;\
2793 call xerr $es "ins_ref $xh 4-8"
2794 echo "~^header remove-at $xh 1"; read es;\
2795 vput vexpr es substr $es 0 3
2797 xcall bail "ins_ref $xh 4-9"
2799 echo "~^header remove-at $xh T"; read es;\
2800 vput vexpr es substr $es 0 3
2802 xcall bail "ins_ref $xh 4-10"
2804 echo "~^header show $xh"; read es;\
2805 vput vexpr es substr $es 0 3
2807 xcall bail "ins_ref $xh 4-11"
2812 # In collect.c order
2814 call ins_ref sender 0 # Not a "ref", but works
2818 call ins_addr reply-To
2819 call ins_addr mail-Followup-to
2820 call ins_ref messAge-id 0
2821 call ins_ref rEfErEncEs 1
2822 call ins_ref in-Reply-to 1
2823 call ins_ref subject 1 # Not a "ref", but works (with tweaks)
2824 call ins_addr freeForm1
2825 call ins_addr freeform2
2827 echo "~^header show MAILX-Command"; read es; call xerr $es "t_header 1000"
2829 echo "~^header show MAILX-raw-TO"; read es; call xerr $es "t_header 1001"
2837 echo "~^attachment";\
2838 read hl; echo $hl; vput vexpr es substr "$hl" 0 3
2840 xcall bail "attach 0-1"
2843 echo "~^attach attribute ./.treadctl";\
2844 read hl; echo $hl; vput vexpr es substr "$hl" 0 3
2846 xcall bail "attach 0-2"
2848 echo "~^attachment attribute-at 1";\
2849 read hl; echo $hl; vput vexpr es substr "$hl" 0 3
2851 xcall bail "attach 0-3"
2854 echo "~^attachment insert ./.treadctl=ascii";\
2855 read hl; echo $hl; call xerr "$hl" "attach 1-1"
2856 echo "~^attachment list";\
2857 read es; echo $es;call xerr "$es" "attach 1-2"
2859 echo "~^attachment attribute ./.treadctl";\
2860 read es; echo $es;call xerr "$es" "attach 1-3"
2862 echo "~^attachment attribute .treadctl";\
2863 read es; echo $es;call xerr "$es" "attach 1-4"
2865 echo "~^attachment attribute-at 1";\
2866 read es; echo $es;call xerr "$es" "attach 1-5"
2869 echo "~^attachment attribute-set ./.treadctl filename rctl";\
2870 read es; echo $es;call xerr "$es" "attach 1-6"
2871 echo "~^attachment attribute-set .treadctl content-description Au";\
2872 read es; echo $es;call xerr "$es" "attach 1-7"
2873 echo "~^attachment attribute-set-at 1 content-id <10.du@ich>";\
2874 read es; echo $es;call xerr "$es" "attach 1-8"
2876 echo "~^attachment attribute ./.treadctl";\
2877 read es; echo $es;call xerr "$es" "attach 1-9"
2879 echo "~^attachment attribute .treadctl";\
2880 read es; echo $es;call xerr "$es" "attach 1-10"
2882 echo "~^attachment attribute rctl";\
2883 read es; echo $es;call xerr "$es" "attach 1-11"
2885 echo "~^attachment attribute-at 1";\
2886 read es; echo $es;call xerr "$es" "attach 1-12"
2890 echo "~^attachment insert ./.tattach=latin1";\
2891 read hl; echo $hl; call xerr "$hl" "attach 2-1"
2892 echo "~^attachment list";\
2893 read es; echo $es;call xerr "$es" "attach 2-2"
2895 echo "~^attachment attribute ./.tattach";\
2896 read es; echo $es;call xerr "$es" "attach 2-3"
2898 echo "~^attachment attribute .tattach";\
2899 read es; echo $es;call xerr "$es" "attach 2-4"
2901 echo "~^attachment attribute-at 2";\
2902 read es; echo $es;call xerr "$es" "attach 2-5"
2905 echo "~^attachment attribute-set ./.tattach filename tat";\
2906 read es; echo $es;call xerr "$es" "attach 2-6"
2908 "~^attachment attribute-set .tattach content-description Au2";\
2909 read es; echo $es;call xerr "$es" "attach 2-7"
2910 echo "~^attachment attribute-set-at 2 content-id <20.du@wir>";\
2911 read es; echo $es;call xerr "$es" "attach 2-8"
2913 "~^attachment attribute-set-at 2 content-type application/x-sh";\
2914 read es; echo $es;call xerr "$es" "attach 2-9"
2916 echo "~^attachment attribute ./.tattach";\
2917 read es; echo $es;call xerr "$es" "attach 2-10"
2919 echo "~^attachment attribute .tattach";\
2920 read es; echo $es;call xerr "$es" "attach 2-11"
2922 echo "~^attachment attribute tat";\
2923 read es; echo $es;call xerr "$es" "attach 2-12"
2925 echo "~^attachment attribute-at 2";\
2926 read es; echo $es;call xerr "$es" "attach 2-13"
2930 if [ "$t_remove" == "" ]
2934 echo "~^attachment remove ./.treadctl"; read es;\
2935 call xerr $es "attach 3-1"
2936 echo "~^attachment remove ./.tattach"; read es;\
2937 call xerr $es "attach 3-2"
2938 echo "~^ attachment remove ./.treadctl"; read es;\
2939 vput vexpr es substr $es 0 3
2941 xcall bail "attach 3-3"
2943 echo "~^ attachment remove ./.tattach"; read es;\
2944 vput vexpr es substr $es 0 3
2946 xcall bail "attach 3-4"
2948 echo "~^attachment list"; read es;\
2949 vput vexpr es substr $es 0 3
2951 xcall bail "attach 3-5"
2955 echo "~^attachment insert ./.tattach=latin1";\
2956 read hl; echo $hl; call xerr "$hl" "attach 4-1"
2957 echo "~^attachment insert ./.tattach=latin1";\
2958 read hl; echo $hl; call xerr "$hl" "attach 4-2"
2959 echo "~^attachment list";\
2960 read es; echo $es;call xerr "$es" "attach 4-3"
2962 echo "~^ attachment remove .tattach"; read es;\
2963 vput vexpr es substr $es 0 3
2965 xcall bail "attach 4-4 $es"
2967 echo "~^attachment remove-at T"; read es;\
2968 vput vexpr es substr $es 0 3
2970 xcall bail "attach 4-5"
2972 echo "~^attachment remove ./.tattach"; read es;\
2973 call xerr $es "attach 4-6"
2974 echo "~^attachment remove ./.tattach"; read es;\
2975 call xerr $es "attach 4-7"
2976 echo "~^ attachment remove ./.tattach"; read es;\
2977 vput vexpr es substr $es 0 3
2979 xcall bail "attach 4-8 $es"
2981 echo "~^attachment list"; read es;\
2982 vput vexpr es substr $es 0 3
2984 xcall bail "attach 4-9"
2988 echo "~^attachment insert ./.tattach=latin1";\
2989 read hl; echo $hl; call xerr "$hl" "attach 5-1"
2990 echo "~^attachment insert ./.tattach=latin1";\
2991 read hl; echo $hl; call xerr "$hl" "attach 5-2"
2992 echo "~^attachment insert ./.tattach=latin1";\
2993 read hl; echo $hl; call xerr "$hl" "attach 5-3"
2994 echo "~^attachment list";\
2995 read es; echo $es;call xerr "$es" "attach 5-4"
2998 echo "~^attachment remove-at 3"; read es;\
2999 call xerr $es "attach 5-5"
3000 echo "~^attachment remove-at 3"; read es;\
3001 vput vexpr es substr $es 0 3
3003 xcall bail "attach 5-6"
3005 echo "~^attachment remove-at 2"; read es;\
3006 call xerr $es "attach 5-7"
3007 echo "~^attachment remove-at 2"; read es;\
3008 vput vexpr es substr $es 0 3
3010 xcall bail "attach 5-8"
3012 echo "~^attachment remove-at 1"; read es;\
3013 call xerr $es "attach 5-9"
3014 echo "~^attachment remove-at 1"; read es;\
3015 vput vexpr es substr $es 0 3
3017 xcall bail "attach 5-10"
3020 echo "~^attachment list"; read es;\
3021 vput vexpr es substr $es 0 3
3023 xcall bail "attach 5-11"
3027 echo "~^attachment insert ./.tattach=latin1";\
3028 read hl; echo $hl; call xerr "$hl" "attach 6-1"
3029 echo "~^attachment insert ./.tattach=latin1";\
3030 read hl; echo $hl; call xerr "$hl" "attach 6-2"
3031 echo "~^attachment insert ./.tattach=latin1";\
3032 read hl; echo $hl; call xerr "$hl" "attach 6-3"
3033 echo "~^attachment list";\
3034 read es; echo $es;call xerr "$es" "attach 6-4"
3037 echo "~^attachment remove-at 1"; read es;\
3038 call xerr $es "attach 6-5"
3039 echo "~^attachment remove-at 1"; read es;\
3040 call xerr $es "attach 6-6"
3041 echo "~^attachment remove-at 1"; read es;\
3042 call xerr $es "attach 6-7"
3043 echo "~^attachment remove-at 1"; read es;\
3044 vput vexpr es substr $es 0 3
3046 xcall bail "attach 6-8"
3049 echo "~^attachment list"; read es;\
3050 vput vexpr es substr $es 0 3
3052 xcall bail "attach 6-9"
3064 echo on-compose-enter, mailx-command<$mailx-command>
3065 alternates alter1@exam.ple alter2@exam.ple
3067 set autocc='alter1@exam.ple alter2@exam.ple'
3068 echo mailx-from<$mailx-from> mailx-sender<$mailx-sender>
3069 echo mailx-subject<$mailx-subject>
3070 echo mailx-to<$mailx-to> mailx-cc<$mailx-cc> mailx-bcc<$mailx-bcc>
3071 echo mailx-raw-to<$mailx-raw-to> mailx-raw-cc<$mailx-raw-cc> \
3072 mailx-raw-bcc<$mailx-raw-bcc>
3073 echo mailx-orig-from<$mailx-orig-from> mailx-orig-to<$mailx-orig-to> \
3074 mailx-orig-cc<$mailx-orig-cc> mailx-orig-bcc<$mailx-orig-bcc>
3077 echo on-compose-leave, mailx-command<$mailx-command>
3079 eval alternates $al alter3@exam.ple alter4@exam.ple
3081 set autobcc='alter3@exam.ple alter4@exam.ple'
3082 echo mailx-from<$mailx-from> mailx-sender<$mailx-sender>
3083 echo mailx-subject<$mailx-subject>
3084 echo mailx-to<$mailx-to> mailx-cc<$mailx-cc> mailx-bcc<$mailx-bcc>
3085 echo mailx-raw-to<$mailx-raw-to> mailx-raw-cc<$mailx-raw-cc> \
3086 mailx-raw-bcc<$mailx-raw-bcc>
3087 echo mailx-orig-from<$mailx-orig-from> mailx-orig-to<$mailx-orig-to> \
3088 mailx-orig-cc<$mailx-orig-cc> mailx-orig-bcc<$mailx-orig-bcc>
3091 echo on-compose-cleanup, mailx-command<$mailx-command>
3094 echo mailx-from<$mailx-from> mailx-sender<$mailx-sender>
3095 echo mailx-subject<$mailx-subject>
3096 echo mailx-to<$mailx-to> mailx-cc<$mailx-cc> mailx-bcc<$mailx-bcc>
3097 echo mailx-raw-to<$mailx-raw-to> mailx-raw-cc<$mailx-raw-cc> \
3098 mailx-raw-bcc<$mailx-raw-bcc>
3099 echo mailx-orig-from<$mailx-orig-from> mailx-orig-to<$mailx-orig-to> \
3100 mailx-orig-cc<$mailx-orig-cc> mailx-orig-bcc<$mailx-orig-bcc>
3102 wysh set on-compose-splice=t_ocs \
3103 on-compose-enter=t_oce on-compose-leave=t_ocl \
3104 on-compose-cleanup=t_occ
3110 printf 'm this-goes@nowhere\nbody\n!.\n' |
3111 ${MAILX} ${ARGS} -Snomemdebug -Sescape=! -Sstealthmua=noagent \
3112 -X'source ./.trc' -Smta=.
/.tsendmail.sh \
3114 ${cat} .
/.tall
>> "${MBOX}"
3115 check behave
:compose_hooks-1
0 "${MBOX}" '3667291468 10101'
3118 printf 'm this-goes@nowhere\nbody\n!.\n' |
3119 ${MAILX} ${ARGS} -Snomemdebug -Sescape=! -Sstealthmua=noagent \
3120 -St_remove=1 -X'source ./.trc' -Smta=.
/.tsendmail.sh \
3122 ${cat} .
/.tall
>> "${MBOX}"
3123 check behave
:compose_hooks-2
0 "${MBOX}" '1746765053 12535'
3125 # Some state machine stress, shell compose hook, localopts for hook, etc.
3126 # readctl in child. ~r as HERE document
3128 printf 'm ex@am.ple\nbody\n!.\nvar t_oce t_ocs t_ocs_sh t_ocl t_occ autocc' |
3129 ${MAILX} ${ARGS} -Snomemdebug -Sescape=! \
3130 -Smta=.
/.tsendmail.sh \
3133 echoerr "Failed: $1. Bailing out"; echo "~x"; xit
3136 vput vexpr es substr "$1" 0 1
3141 define read_mline_res {
3142 read hl; wysh set len=$? es=$! en=$^ERRNAME;\
3143 echo $len/$es/$^ERRNAME: $hl
3144 if [ $es -ne $^ERR-NONE ]
3145 xcall bail read_mline_res
3147 \xcall read_mline_res
3151 vput vexpr i + 1 "$2"
3153 vput vexpr j % $i 10
3160 eval \\$j _work $1 $i
3163 vput vexpr i + $i "$1"
3167 read line;wysh set es=$? en=$^ERRNAME ; echo read:$es/$en: $line
3168 if [ "${es}" -ne -1 ]
3171 readctl remove $cwd/.treadctl; echo readctl remove:$?/$^ERRNAME
3176 echo "~^header list"; read hl; echo $hl;\
3177 vput vexpr es substr "$hl" 0 1
3179 xcall bail "header list"
3182 call _work 1; echo $?
3183 echo "~^header insert cc splicy diet <splice@exam.ple> spliced";\
3184 read es; echo $es; vput vexpr es substr "$es" 0 1
3186 xcall bail "be diet"
3188 echo "~^header insert cc <splice2@exam.ple>";\
3189 read es; echo $es; vput vexpr es substr "$es" 0 1
3191 xcall bail "be diet2"
3194 call _work 2; echo $?
3195 echo "~^header insert bcc juicy juice <juice@exam.ple> spliced";\
3196 read es; echo $es;vput vexpr es substr "$es" 0 1
3198 xcall bail "be juicy"
3200 echo "~^header insert bcc juice2@exam.ple";\
3201 read es; echo $es;vput vexpr es substr "$es" 0 1
3203 xcall bail "be juicy2"
3205 echo "~^header insert bcc juice3 <juice3@exam.ple>";\
3206 read es; echo $es;vput vexpr es substr "$es" 0 1
3208 xcall bail "be juicy3"
3210 echo "~^header insert bcc juice4@exam.ple";\
3211 read es; echo $es;vput vexpr es substr "$es" 0 1
3213 xcall bail "be juicy4"
3216 echo "~^header remove-at bcc 3";\
3217 read es; echo $es;vput vexpr es substr "$es" 0 1
3219 xcall bail "remove juicy5"
3221 echo "~^header remove-at bcc 2";\
3222 read es; echo $es;vput vexpr es substr "$es" 0 1
3224 xcall bail "remove juicy6"
3226 echo "~^header remove-at bcc 3";\
3227 read es; echo $es;vput vexpr es substr "$es" 0 3
3229 xcall bail "failed to remove-at"
3231 # Add duplicates which ought to be removed!
3232 echo "~^header insert bcc juice4@exam.ple";\
3233 read es; echo $es;vput vexpr es substr "$es" 0 1
3235 xcall bail "be juicy4-1"
3237 echo "~^header insert bcc juice4@exam.ple";\
3238 read es; echo $es;vput vexpr es substr "$es" 0 1
3240 xcall bail "be juicy4-2"
3242 echo "~^header insert bcc juice4@exam.ple";\
3243 read es; echo $es;vput vexpr es substr "$es" 0 1
3245 xcall bail "be juicy4-3"
3250 call _work 3; echo $?
3252 vput ! i echo just knock if you can hear me;\
3254 while [ $i -lt 24 ]; do printf "%s " $i; i=`expr $i + 1`; done;\
3256 echon shell-cmd says $?/$^ERRNAME: $i
3257 echo "~x will not become interpreted, we are reading until __EOT"
3259 read r_status; echo "~~r status output: $r_status"
3260 echo "~:echo $? $! $^ERRNAME"
3262 echo "~~r status from parent: $r_status"
3265 call _work 4; echo $?
3266 vput cwd cwd;echo cwd:$?
3267 readctl create $cwd/.treadctl ;echo readctl:$?/$^ERRNAME;\
3271 call _work 5; echo $?
3272 echo "~^header show MAILX-Command"; read es;\
3273 call xerr $es "t_header 1000"; call read_mline_res
3274 echo "~^header show MAILX-raw-TO"; read es;\
3275 call xerr $es "t_header 1001"; xcall read_mline_res
3277 echoerr IT IS WRONG IF YOU SEE THIS
3280 echo on-compose-enter, mailx-command<$mailx-command>
3281 set t_oce autobcc=oce@exam.ple
3282 alternates alter1@exam.ple alter2@exam.ple
3284 echo mailx-from<$mailx-from> mailx-sender<$mailx-sender>
3285 echo mailx-subject<$mailx-subject>
3286 echo mailx-to<$mailx-to> mailx-cc<$mailx-cc> mailx-bcc<$mailx-bcc>
3287 echo mailx-raw-to<$mailx-raw-to> mailx-raw-cc<$mailx-raw-cc> \
3288 mailx-raw-bcc<$mailx-raw-bcc>
3289 echo mailx-orig-from<$mailx-orig-from> \
3290 mailx-orig-to<$mailx-orig-to> \
3291 mailx-orig-cc<$mailx-orig-cc> mailx-orig-bcc<$mailx-orig-bcc>
3294 echo on-compose-leave, mailx-command<$mailx-command>
3295 set t_ocl autocc=ocl@exam.ple
3297 alternates alter3@exam.ple alter4@exam.ple
3299 echo mailx-from<$mailx-from> mailx-sender<$mailx-sender>
3300 echo mailx-subject<$mailx-subject>
3301 echo mailx-to<$mailx-to> mailx-cc<$mailx-cc> mailx-bcc<$mailx-bcc>
3302 echo mailx-raw-to<$mailx-raw-to> mailx-raw-cc<$mailx-raw-cc> \
3303 mailx-raw-bcc<$mailx-raw-bcc>
3304 echo mailx-orig-from<$mailx-orig-from> \
3305 mailx-orig-to<$mailx-orig-to> \
3306 mailx-orig-cc<$mailx-orig-cc> mailx-orig-bcc<$mailx-orig-bcc>
3309 echo on-compose-cleanup, mailx-command<$mailx-command>
3310 set t_occ autocc=occ@exam.ple
3313 echo mailx-from<$mailx-from> mailx-sender<$mailx-sender>
3314 echo mailx-subject<$mailx-subject>
3315 echo mailx-to<$mailx-to> mailx-cc<$mailx-cc> mailx-bcc<$mailx-bcc>
3316 echo mailx-raw-to<$mailx-raw-to> mailx-raw-cc<$mailx-raw-cc> \
3317 mailx-raw-bcc<$mailx-raw-bcc>
3318 echo mailx-orig-from<$mailx-orig-from> \
3319 mailx-orig-to<$mailx-orig-to> \
3320 mailx-orig-cc<$mailx-orig-cc> mailx-orig-bcc<$mailx-orig-bcc>
3322 wysh set on-compose-splice=t_ocs \
3323 on-compose-splice-shell="read ver;printf \"t_ocs-shell\\n\
3324 ~t shell@exam.ple\\n~:set t_ocs_sh\\n\"" \
3325 on-compose-enter=t_oce on-compose-leave=t_ocl \
3326 on-compose-cleanup=t_occ
3328 ex0_test behave
:compose_hooks-3
3329 ${cat} .
/.tnotes
>> "${MBOX}"
3331 check behave
:compose_hooks-3
- "${MBOX}" '679526364 2431'
3333 # Reply, forward, resend, Resend
3336 printf 'set from=f1@z\nm t1@z\nb1\n!.\nset from=f2@z\nm t2@z\nb2\n!.\n' |
3337 ${MAILX} ${ARGS} -Snomemdebug -Sescape=! \
3338 -Smta=.
/.tsendmail.sh
3341 echo start: $? $! $^ERRNAME
3343 echo File: $? $! $^ERRNAME;echo;echo
3345 this is content of reply 1
3347 echo reply 1: $? $! $^ERRNAME;echo;echo
3349 this is content of Reply 1 2
3351 echo Reply 1 2: $? $! $^ERRNAME;echo;echo
3352 forward 1 fwdex@am.ple
3353 this is content of forward 1
3355 echo forward 1: $? $! $^ERRNAME;echo;echo
3356 resend 1 2 resendex@am.ple
3357 echo resend 1 2: $? $! $^ERRNAME;echo;echo
3358 Resend 1 2 Resendex@am.ple
3359 echo Resend 1 2: $? $! $^ERRNAME;echo;echo
3361 ${MAILX} ${ARGS} -Snomemdebug -Sescape=! \
3362 -Smta=.
/.tsendmail.sh \
3365 echoerr "Failed: $1. Bailing out"; echo "~x"; xit
3368 vput vexpr es substr "$1" 0 1
3373 define read_mline_res {
3374 read hl; wysh set len=$? es=$! en=$^ERRNAME;\
3375 echo mline_res:$len/$es/$^ERRNAME: $hl
3376 if [ $es -ne $^ERR-NONE ]
3377 xcall bail read_mline_res
3379 \xcall read_mline_res
3383 echo "~^header show $1"; read es;\
3384 call xerr $es "work_hl $1"; echo $1; call read_mline_res
3392 echo t_ocs version $ver
3393 echo "~^header list"; read hl; echo $hl;\
3394 echoerr the header list is $hl;\
3395 call xerr "$hl" "header list"
3396 eval vpospar set $hl
3399 echoerr IT IS WRONG IF YOU SEE THIS
3402 echo on-XY-enter, mailx-command<$mailx-command>
3403 set t_oce autobcc=oce@exam.ple
3404 echo mailx-from<$mailx-from> mailx-sender<$mailx-sender>
3405 echo mailx-subject<$mailx-subject>
3406 echo mailx-to<$mailx-to> mailx-cc<$mailx-cc> mailx-bcc<$mailx-bcc>
3407 echo mailx-raw-to<$mailx-raw-to> mailx-raw-cc<$mailx-raw-cc> \
3408 mailx-raw-bcc<$mailx-raw-bcc>
3409 echo mailx-orig-from<$mailx-orig-from> \
3410 mailx-orig-to<$mailx-orig-to> \
3411 mailx-orig-cc<$mailx-orig-cc> mailx-orig-bcc<$mailx-orig-bcc>
3414 echo on-XY-leave, mailx-command<$mailx-command>
3415 set t_ocl autocc=ocl@exam.ple
3416 echo mailx-from<$mailx-from> mailx-sender<$mailx-sender>
3417 echo mailx-subject<$mailx-subject>
3418 echo mailx-to<$mailx-to> mailx-cc<$mailx-cc> mailx-bcc<$mailx-bcc>
3419 echo mailx-raw-to<$mailx-raw-to> mailx-raw-cc<$mailx-raw-cc> \
3420 mailx-raw-bcc<$mailx-raw-bcc>
3421 echo mailx-orig-from<$mailx-orig-from> \
3422 mailx-orig-to<$mailx-orig-to> \
3423 mailx-orig-cc<$mailx-orig-cc> mailx-orig-bcc<$mailx-orig-bcc>
3426 echo on-XY-cleanup, mailx-command<$mailx-command>
3427 set t_occ autocc=occ@exam.ple
3428 echo mailx-from<$mailx-from> mailx-sender<$mailx-sender>
3429 echo mailx-subject<$mailx-subject>
3430 echo mailx-to<$mailx-to> mailx-cc<$mailx-cc> mailx-bcc<$mailx-bcc>
3431 echo mailx-raw-to<$mailx-raw-to> mailx-raw-cc<$mailx-raw-cc> \
3432 mailx-raw-bcc<$mailx-raw-bcc>
3433 echo mailx-orig-from<$mailx-orig-from> \
3434 mailx-orig-to<$mailx-orig-to> \
3435 mailx-orig-cc<$mailx-orig-cc> mailx-orig-bcc<$mailx-orig-bcc>
3437 wysh set on-compose-splice=t_ocs \
3438 on-compose-enter=t_oce on-compose-leave=t_ocl \
3439 on-compose-cleanup=t_occ \
3440 on-resend-enter=t_oce on-resend-cleanup=t_occ
3442 ex0_test behave
:compose_hooks-4
3443 ${cat} .
/.tnotes
>> "${MBOX}"
3445 check behave
:compose_hooks-4
- "${MBOX}" '3038884027 7516'
3450 t_behave_message_injections
() {
3452 TRAP_EXIT_ADDONS
="./.t*"
3454 ${cat} <<-_EOT > ./.tsendmail.sh
3456 (echo 'From Echinacea Tue Jun 20 15:54:02 2017' && ${cat} && echo
3459 chmod 0755 .
/.tsendmail.sh
3461 echo mysig
> .
/.tmysig
3463 echo some-body |
${MAILX} ${ARGS} -Smta=.
/.tsendmail.sh \
3464 -Smessage-inject-head=head-inject \
3465 -Smessage-inject-tail=tail-inject \
3466 -Ssignature=.
/.tmysig \
3467 ex@am.ple
> .
/.tall
2>&1
3468 check behave
:message_injections-1
0 "${MBOX}" '2434746382 134'
3469 check behave
:message_injections-2
- .tall
'4294967295 0' # empty file
3471 ${cat} <<-_EOT > ./.template
3475 Subject: This subject is
3477 Body, body, body me.
3479 < .
/.template
${MAILX} ${ARGS} -t -Smta=.
/.tsendmail.sh \
3480 -Smessage-inject-head=head-inject \
3481 -Smessage-inject-tail=tail-inject \
3482 -Ssignature=.
/.tmysig \
3484 check behave
:message_injections-3
0 "${MBOX}" '3114203412 198'
3485 check behave
:message_injections-4
- .tall
'4294967295 0' # empty file
3490 t_behave_mime_types_load_control
() {
3492 TRAP_EXIT_ADDONS
="./.t*"
3494 ${cat} <<-_EOT > ./.tmts1
3495 @ application/mathml+xml mathml
3497 ${cat} <<-_EOT > ./.tmts2
3498 @ x-conference/x-cooltalk ice
3500 @ application/aga-aga aga
3503 ${cat} <<-_EOT > ./.tmts1.mathml
3504 <head>nonsense ML</head>
3506 ${cat} <<-_EOT > ./.tmts2.ice
3509 printf 'of which the c\x01rack is coming soon' > .
/.tmtsx.doom
3510 printf 'of which the c\x01rack is coming soon' > .
/.tmtsx.aga
3524 ' "${MBOX}" "${MBOX}" |
3526 -Smimetypes-load-control=f
=.
/.tmts1
,f
=.
/.tmts2 \
3528 ex0_test behave
:mime_types_load_control
3530 ${cat} "${MBOX}" >> .
/.tout
3531 check behave
:mime_types_load_control-1
- .
/.tout
'529577037 2474'
3533 echo type |
${MAILX} ${ARGS} -R \
3534 -Smimetypes-load-control=f
=.
/.tmts1
,f
=.
/.tmts3 \
3535 -f "${MBOX}" >> .
/.tout
2>&1
3536 check behave
:mime_types_load_control-2
0 .
/.tout
'2025926659 3558'
3542 have_feat smime ||
{
3543 echo 'behave:s/mime: unsupported, skipped'
3548 TRAP_EXIT_ADDONS
="./.t.conf ./.tkey.pem ./.tcert.pem ./.tpair.pem"
3549 TRAP_EXIT_ADDONS
="${TRAP_EXIT_ADDONS} ./.VERIFY ./.DECRYPT ./.ENCRYPT"
3550 TRAP_EXIT_ADDONS
="${TRAP_EXIT_ADDONS} ./.tsendmail.sh"
3552 printf 'behave:s/mime: .. generating test key and certificate ..\n'
3553 ${cat} <<-_EOT > ./.t.conf
3556 default_keyfile = keyfile.pem
3557 distinguished_name = req_distinguished_name
3558 attributes = req_attributes
3562 [ req_distinguished_name ]
3569 emailAddress = test@localhost
3574 openssl req
-x509 -nodes -days 3650 -config .
/.t.conf \
3575 -newkey rsa
:1024 -keyout .
/.tkey.pem
-out .
/.tcert.pem
>/dev
/null
2>&1
3576 ${cat} .
/.tkey.pem .
/.tcert.pem
> .
/.tpair.pem
3579 printf 'behave:s/mime:sign/verify: '
3580 echo bla |
${MAILX} ${ARGS} \
3581 -Ssmime-ca-file=.
/.tcert.pem
-Ssmime-sign-cert=.
/.tpair.pem \
3582 -Ssmime-sign -Sfrom=test@localhost \
3583 -s 'S/MIME test' .
/.VERIFY
3584 if [ $?
-eq 0 ]; then
3595 /^Content-Description: /{ skip = 2; print; next }
3596 /^$/{ if(skip) --skip }
3599 < .
/.VERIFY
> "${MBOX}"
3600 check behave
:s
/mime
:sign
/verify
:checksum
- "${MBOX}" '2900817158 648'
3602 printf 'behave:s/mime:sign/verify:verify '
3603 printf 'verify\nx\n' |
3605 -Ssmime-ca-file=.
/.tcert.pem
-Ssmime-sign-cert=.
/.tpair.pem \
3606 -Ssmime-sign -Sfrom=test@localhost \
3608 -f .
/.VERIFY
>/dev
/null
2>&1
3609 if [ $?
-eq 0 ]; then
3618 printf 'behave:s/mime:sign/verify:disproof-1 '
3619 if openssl smime
-verify -CAfile .
/.tcert.pem \
3620 -in .
/.VERIFY
>/dev
/null
2>&1; then
3629 # (signing +) encryption / decryption
3630 ${cat} <<-_EOT > ./.tsendmail.sh
3632 (echo 'From Euphrasia Thu Apr 27 17:56:23 2017' && ${cat}) > ./.ENCRYPT
3634 chmod 0755 .
/.tsendmail.sh
3636 printf 'behave:s/mime:encrypt+sign: '
3639 -Ssmime-force-encryption \
3640 -Ssmime-encrypt-recei@ver.com
=.
/.tpair.pem \
3641 -Smta=.
/.tsendmail.sh \
3642 -Ssmime-ca-file=.
/.tcert.pem
-Ssmime-sign-cert=.
/.tpair.pem \
3643 -Ssmime-sign -Sfrom=test@localhost \
3644 -s 'S/MIME test' recei@ver.com
3645 if [ $?
-eq 0 ]; then
3649 printf 'error: encrypt+sign failed\n'
3652 ${sed} -e '/^$/,$d' < .
/.ENCRYPT
> "${MBOX}"
3653 check behave
:s
/mime
:encrypt
+sign
:checksum
- "${MBOX}" '1937410597 327'
3655 printf 'behave:s/mime:decrypt+verify: '
3656 printf 'decrypt ./.DECRYPT\nfi ./.DECRYPT\nverify\nx\n' |
3658 -Ssmime-force-encryption \
3659 -Ssmime-encrypt-recei@ver.com
=.
/.tpair.pem \
3660 -Smta=.
/.tsendmail.sh \
3661 -Ssmime-ca-file=.
/.tcert.pem
-Ssmime-sign-cert=.
/.tpair.pem \
3662 -Ssmime-sign -Sfrom=test@localhost \
3664 -f .
/.ENCRYPT
>/dev
/null
2>&1
3665 if [ $?
-eq 0 ]; then
3674 /^Content-Description: /{ skip = 2; print; next }
3675 /^$/{ if(skip) --skip }
3678 < .
/.DECRYPT
> "${MBOX}"
3679 check behave
:s
/mime
:decrypt
+verify
:checksum
- "${MBOX}" '1720739247 931'
3681 printf 'behave:s/mime:decrypt+verify:disproof-1: '
3682 if (openssl smime
-decrypt -inkey .
/.tkey.pem
-in .
/.ENCRYPT |
3683 openssl smime
-verify -CAfile .
/.tcert.pem
) >/dev
/null
2>&1; then
3690 printf "behave:s/mime:encrypt: "
3691 echo bla |
${MAILX} ${ARGS} \
3692 -Ssmime-force-encryption \
3693 -Ssmime-encrypt-recei@ver.com
=.
/.tpair.pem \
3694 -Smta=.
/.tsendmail.sh \
3695 -Ssmime-ca-file=.
/.tcert.pem
-Ssmime-sign-cert=.
/.tpair.pem \
3696 -Sfrom=test@localhost \
3697 -s 'S/MIME test' recei@ver.com
3698 if [ $?
-eq 0 ]; then
3705 # Same as behave:s/mime:encrypt+sign:checksum above
3706 ${sed} -e '/^$/,$d' < .
/.ENCRYPT
> "${MBOX}"
3707 check behave
:s
/mime
:encrypt
:checksum
- "${MBOX}" '1937410597 327'
3710 printf 'decrypt ./.DECRYPT\nx\n' |
${MAILX} ${ARGS} \
3711 -Ssmime-force-encryption \
3712 -Ssmime-encrypt-recei@ver.com
=.
/.tpair.pem \
3713 -Smta=.
/.tsendmail.sh \
3714 -Ssmime-ca-file=.
/.tcert.pem
-Ssmime-sign-cert=.
/.tpair.pem \
3715 -Sfrom=test@localhost \
3717 -f .
/.ENCRYPT
>/dev
/null
2>&1
3718 check behave
:s
/mime
:decrypt
0 "./.DECRYPT" '2624716890 422'
3720 printf 'behave:s/mime:decrypt:disproof-1: '
3721 if openssl smime
-decrypt -inkey .
/.tkey.pem \
3722 -in .
/.ENCRYPT
>/dev
/null
2>&1; then
3732 t_behave_maildir
() {
3734 TRAP_EXIT_ADDONS
="./.t*"
3738 while [ ${i} -lt 112 ]; do
3739 printf 'm file://%s\n~s Subject %s\nHello %s!\n~.\n' \
3740 "${MBOX}" "${i}" "${i}"
3743 ) |
${MAILX} ${ARGS}
3744 check behave
:maildir-1
0 "${MBOX}" '1140119864 13780'
3750 ' "${MBOX}" .tmdir1 .tmdir1 |
3751 ${MAILX} ${ARGS} -Snewfolders=maildir
> .tlst
3752 check behave
:maildir-2
0 .tlst
'1797938753 9103'
3755 copy * "maildir://%s"
3758 ' "${MBOX}" .tmdir2 .tmdir2 |
3759 ${MAILX} ${ARGS} > .tlst
3760 check behave
:maildir-3
0 .tlst
'1155631089 9113'
3762 printf 'File "maildir://%s"
3766 ' .tmdir2 .tmbox1 .tmbox1 |
3767 ${MAILX} ${ARGS} > .tlst
3768 check behave
:maildir-4
0 .tmbox1
'2646131190 13220'
3769 check behave
:maildir-5
- .tlst
'3701297796 9110'
3771 # only the odd (even)
3773 printf 'File "maildir://%s"
3776 while [ ${i} -lt 112 ]; do
3778 [ ${j} -eq 1 ] && printf '%s ' "${i}"
3785 ) |
${MAILX} ${ARGS} > .tlst
3786 check behave
:maildir-6
0 .tmbox2
'142890131 6610'
3787 check behave
:maildir-7
- .tlst
'960096773 4573'
3790 printf 'file "maildir://%s"
3793 while [ ${i} -lt 112 ]; do
3795 [ ${j} -eq 0 ] && [ ${i} -ne 0 ] && printf '%s ' "${i}"
3803 ' .tmbox2 .tmbox2 .tmdir2
3804 ) | ${MAILX} ${ARGS} > .tlst
3805 check behave:maildir-8 0 .tmbox2 '3806905791 13100'
3806 ${sed} 2d < .tlst > .tlstx
3807 check behave:maildir-9 - .tlstx '4216815295 13645'
3812 t_behave_mass_recipients() {
3814 TRAP_EXIT_ADDONS=".
/.t
*"
3816 ${cat} <<-_EOT > ./.tsendmail.sh
3818 (echo 'From Eucalyptus Sat Jul 08 21:14:57 2017' && ${cat} && echo
3821 chmod 0755 ./.tsendmail.sh
3823 ${cat} <<'__EOT__' > ./.trc
3825 echoerr "Failed
: $1. Bailing out
"; echo "~x
"; xit
3828 wysh set nr=$1 hn=$2
3829 echo "~
$hn $hn$nr@
$hn"; echo '~:echo $?'; read es
3831 xcall bail "ins_addr
$hn 1-$nr"
3833 vput vexpr nr + $nr 1
3834 if [ "$nr" -le "$maximum" ]
3835 xcall ins_addr $nr $hn
3839 wysh set nr=$1 hn=$2
3840 alternates $hn$nr@$hn
3841 vput vexpr nr + $nr 2
3842 if [ "$nr" -le "$maximum" ]
3843 xcall bld_alter $nr $hn
3853 if [ "$t_remove" != '' ]
3858 set on-compose-splice=t_ocs on-compose-leave=t_ocl
3862 printf 'm this-goes@nowhere\nbody\n!.\n' |
3863 ${MAILX} ${ARGS} -Snomemdebug -Sescape=! -Sstealthmua=noagent \
3864 -X'source ./.trc' -Smta=./.tsendmail.sh -Smaximum=2001 \
3866 ${cat} ./.tall >> "${MBOX}"
3867 check behave:mass_recipients-1 0 "${MBOX}" '2912243346 51526'
3870 printf 'm this-goes@nowhere\nbody\n!.\n' |
3871 ${MAILX} ${ARGS} -Snomemdebug -Sescape=! -Sstealthmua=noagent \
3872 -St_remove=1 -X'source ./.trc' -Smta=./.tsendmail.sh -Smaximum=2001 \
3874 ${cat} ./.tall >> "${MBOX}"
3875 check behave:mass_recipients-2 0 "${MBOX}" '4097804632 34394'
3880 t_behave_lreply_futh_rth_etc() {
3882 TRAP_EXIT_ADDONS=".
/.t
*"
3884 ${cat} <<-_EOT > ./.tsendmail.sh
3886 (echo 'From HumulusLupulus Thu Jul 27 14:41:20 2017' && ${cat} && echo
3889 chmod 0755 ./.tsendmail.sh
3891 ${cat} <<-_EOT > ./.tmbox
3892 From neverneverland Sun Jul 23 13:46:25 2017
3893 Subject: Bugstop: five miles out 1
3894 Reply-To: mister originator2 <mr2@originator>, bugstop@five.miles.out
3895 From: mister originator <mr@originator>
3896 To: bugstop-commit@five.miles.out, laber@backe.eu
3898 Mail-Followup-To: bugstop@five.miles.out, laber@backe.eu, is@a.list
3899 In-reply-to: <20170719111113.bkcMz%laber@backe.eu>
3900 Date: Wed, 19 Jul 2017 09:22:57 -0400
3901 Message-Id: <20170719132257.766AF781267@originator>
3904 > |Sorry, I think I misunderstand something. I would think that
3908 From neverneverland Fri Jul 7 22:39:11 2017
3909 Subject: Bugstop: five miles out 2
3910 Reply-To: mister originator2<mr2@originator>,bugstop@five.miles.out,is@a.list
3911 Content-Transfer-Encoding: 7bit
3912 From: mister originator <mr@originator>
3913 To: bugstop-commit@five.miles.out
3915 Message-ID: <149945963975.28888.6950788126957753723.reportbug@five.miles.out>
3916 Date: Fri, 07 Jul 2017 16:33:59 -0400
3919 capable of changing back.
3921 From neverneverland Fri Jul 7 22:42:00 2017
3922 Subject: Bugstop: five miles out 3
3923 Reply-To: mister originator2 <mr2@originator>, bugstop@five.miles.out
3924 Content-Transfer-Encoding: 7bit
3925 From: mister originator <mr@originator>
3926 To: bugstop-commit@five.miles.out
3928 Message-ID: <149945963975.28888.6950788126957753746.reportbug@five.miles.out>
3929 Date: Fri, 07 Jul 2017 16:33:59 -0400
3930 List-Post: <mailto:bugstop@five.miles.out>
3933 are you ready, boots?
3941 wysh set m="This is text of
\\\"reply
${1}.
"
3952 echo -----After reply
$1.1
- $1.3
: $?
/$^ERRNAME
3955 wysh
set m
="This is text of \\\"Reply ${1}."
3961 echo -----After Reply $1.$2: $?/$^ERRNAME
3970 wysh
set m
="This is text of \\\"Lreply ${1}." \
3971 on-compose-splice
=_Lh n
=$2
3975 # We need two indirections for this test: one for the case that Lreply
3976 # fails because if missing recipients, we need to read EOF next, thus
3977 # place this in _Ls last, and second for the succeeding cases EOF is
3978 # not what these should read, so go over the backside and splice it in!
3980 echo -----After Lreply
$1.
$2: $?
/$^ERRNAME
3983 localopts call-fixate
yes
3985 call R
$1 1; call R
$1 2; call R
$1 3
3986 call L
$1 1; call L
$1 2; call L
$1 3
3989 echo;echo '"'"'===== CHANGING === '"'"'"$*"'"'"' ====='"'"';echo
3993 set from
=laber@backe.eu
3996 call tweak
set reply-to-honour
3998 call tweak
set followup-to
4000 call tweak
set followup-to-honour
4002 call tweak mlist bugstop@five.miles.out
4004 call tweak mlsubscribe bugstop@five.miles.out
4006 call tweak
set recipients-in-cc
4008 ' | ${MAILX} ${ARGS} -Sescape=! -Smta=./.tsendmail.sh \
4009 -Rf ./.tmbox >> "${MBOX}" 2>&1
4011 check behave:lreply_futh_rth_etc 0 "${MBOX}" '2491739775 22062'
4017 # Some basic tests regarding correct sending of mails, via STDIN / -t / -q,
4018 # including basic MIME Content-Transfer-Encoding correctness (quoted-printable)
4019 # Note we unfortunately need to place some statements without proper
4020 # indentation because of continuation problems
4024 # MIME encoding (QP) stress message body
4026 'Ich bin eine DÖS-Datäi mit sehr langen Zeilen und auch
'\
4027 'sonst bin ich ganz schön am Schleudern
, da kannste denke
'\
4028 "wasde willst, gelle, gelle, gelle, gelle, gelle.\r\n"\
4029 "Ich bin eine DÖS-Datäi mit langen Zeilen und auch sonst \r\n"\
4030 "Ich bin eine DÖS-Datäi mit langen Zeilen und auch sonst 1\r\n"\
4031 "Ich bin eine DÖS-Datäi mit langen Zeilen und auch sonst 12\r\n"\
4032 "Ich bin eine DÖS-Datäi mit langen Zeilen und auch sonst 123\r\n"\
4033 "Ich bin eine DÖS-Datäi mit langen Zeilen und auch sonst 1234\r\n"\
4034 "Ich bin eine DÖS-Datäi mit langen Zeilen und auch sonst 12345\r\n"\
4035 "Ich bin eine DÖS-Datäi mit langen Zeilen und auch sonst 123456\r\n"\
4036 "Ich bin eine DÖS-Datäi mit langen Zeilen und auch sonst 1234567\r\n"\
4037 "Ich bin eine DÖS-Datäi mit langen Zeilen und auch sonst 12345678\r\n"\
4038 "Ich bin eine DÖS-Datäi mit langen Zeilen und auch sonst 123456789\r\n"\
4039 "Unn ausserdem habe ich trailing SP/HT/SP/HT whitespace \r\n"\
4040 "Unn ausserdem habe ich trailing HT/SP/HT/SP whitespace \r\n"\
4041 "auf den zeilen vorher.\r\n"\
4042 "From am Zeilenbeginn und From der Mitte gibt es auch.\r\n"\
4044 "Die letzte Zeile war nur ein Punkt.\r\n"\
4046 "Das waren deren zwei.\r\n"\
4048 "Die letzte Zeile war ein Leerschritt.\n"\
4049 "=VIER = EQUAL SIGNS=ON A LINE=\r\n"\
4052 "Die letzte Zeile war nur ein Punkt, mit Unix Zeilenende.\n"\
4054 "Das waren deren zwei. ditto.\n"\
4056 "Unn ausseerdem habe ich trailing SP/HT/SP/HT whitespace \n"\
4057 "Unn ausseerdem habe ich trailing HT/SP/HT/SP whitespace \n"\
4058 "auf den zeilen vorher.\n"\
4060 "Ich bin eine ziemlich lange, steile, scharfe Zeile mit Unix Zeilenende.\n"\
4061 "Ich bin eine ziemlich lange, steile, scharfe Zeile mit Unix Zeilenende.1"\
4063 "Ich bin eine ziemlich lange, steile, scharfe Zeile mit Unix Zeilenende.12"\
4065 "Ich bin eine ziemlich lange, steile, scharfe Zeile mit Unix Zeilenende.12"\
4067 "Ich bin eine ziemlich lange, steile, scharfe Zeile mit Unix Zeilenende.12"\
4069 "Ich bin eine ziemlich lange, steile, scharfe Zeile mit Unix Zeilenende.12"\
4071 "Ich bin eine ziemlich lange, steile, scharfe Zeile mit Unix Zeilenende.12"\
4073 "QP am Zeilenende über soft-nl hinweg\n"\
4074 "Ich bin eine ziemlich lange, steile, scharfe Zeile mit Unix Zeilenende."\
4076 "Ich bin eine ziemlich lange, steile, scharfe Zeile mit Unix Zeilenende."\
4078 "Ich bin eine ziemlich lange, steile, scharfe Zeile mit Unix Zeilenende."\
4080 "Ich bin eine ziemlich lange, steile, scharfe Zeile mit Unix Zeilenende."\
4082 "=VIER = EQUAL SIGNS=ON A LINE=\n"\
4084 "Die letzte Zeile war ein Leerschritt.\n"\
4088 # MIME encoding (QP) stress message subject
4089 SUB="Äbrä Kä?dä=brö Fü?di=bus? \
4090 adadaddsssssssddddddddddddddddddddd\
4091 ddddddddddddddddddddddddddddddddddd\
4092 ddddddddddddddddddddddddddddddddddd\
4093 dddddddddddddddddddd Hallelulja? Od\
4094 er?? eeeeeeeeeeeeeeeeeeeeeeeeeeeeee\
4095 eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee\
4096 eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee f\
4097 fffffffffffffffffffffffffffffffffff\
4098 fffffffffffffffffffff ggggggggggggg\
4099 ggggggggggggggggggggggggggggggggggg\
4100 ggggggggggggggggggggggggggggggggggg\
4101 ggggggggggggggggggggggggggggggggggg\
4104 # Three tests for MIME encoding and (a bit) content classification.
4105 # At the same time testing -q FILE, < FILE and -t FILE
4108 < "${BODY}" ${MAILX} ${ARGS} ${ADDARG_UNI} \
4109 -a "${BODY}" -s "${SUB}" "${MBOX}"
4110 check content:001 0 "${MBOX}" '1145066634 6654'
4113 < /dev/null ${MAILX} ${ARGS} ${ADDARG_UNI} \
4114 -a "${BODY}" -s "${SUB}" -q "${BODY}" "${MBOX}"
4115 check content:002 0 "${MBOX}" '1145066634 6654'
4118 ( echo "To: ${MBOX}" && echo "Subject: ${SUB}" && echo &&
4120 ) | ${MAILX} ${ARGS} ${ADDARG_UNI} -Snodot -a "${BODY}" -t
4121 check content:003 0 "${MBOX}" '1145066634 6654'
4123 # Test for [260e19d] (Juergen Daubert)
4125 echo body | ${MAILX} ${ARGS} "${MBOX}"
4126 check content:004 0 "${MBOX}" '2917662811 98'
4128 # Sending of multiple mails in a single invocation
4130 ( printf "m ${MBOX}\n~s subject1\nE-Mail Körper 1\n~.\n" &&
4131 printf "m ${MBOX}\n~s subject2\nEmail body 2\n~.\n" &&
4133 ) | ${MAILX} ${ARGS} ${ADDARG_UNI}
4134 check content:005 0 "${MBOX}" '2098659767 358'
4138 # "Test for" [d6f316a] (Gavin Troy)
4140 printf "m ${MBOX}\n~s subject1\nEmail body\n~.\nfi ${MBOX}\np\nx\n" |
4141 ${MAILX} ${ARGS} ${ADDARG_UNI} -Spipe-text/plain="@* ${cat}" > "${BODY}"
4142 check content:006 0 "${MBOX}" '2099098650 122'
4143 check content:006-1 - "${BODY}" '794542938 174'
4145 # "Test for" [c299c45] (Peter Hofmann) TODO shouldn't end up QP-encoded?
4148 for(i = 0; i < 10000; ++i)
4150 #printf "\xF0\x90\x87\x90"
4151 }' |
${MAILX} ${ARGS} ${ADDARG_UNI} -s TestSubject "${MBOX}"
4152 check content:007 0 "${MBOX}" '534262374 61816'
4154 ## Test some more corner cases for header bodies (as good as we can today) ##
4158 echo | ${MAILX} ${ARGS} ${ADDARG_UNI} \
4159 -s 'a̲b̲c̲d̲e̲f̲h̲i̲k̲l̲m̲n̲o̲r̲s̲t̲u̲v̲w̲x̲z̲a̲b̲c̲d̲e̲f̲h̲i̲k̲l̲m̲n̲o̲r̲s̲t̲u̲v̲w̲x̲z̲' \
4161 check content:008 0 "${MBOX}" '3370931614 375'
4163 # Single word (overlong line split -- bad standard! Requires injection of
4164 # artificial data!! But can be prevented by using RFC 2047 encoding)
4166 i=`${awk} 'BEGIN{for(i=0; i<92; ++i) printf "0123456789_
"}'`
4167 echo | ${MAILX} ${ARGS} -s "${i}" "${MBOX}"
4168 check content
:009 0 "${MBOX}" '489922370 1718'
4170 # Combination of encoded words, space and tabs of varying sort
4172 echo |
${MAILX} ${ARGS} ${ADDARG_UNI} \
4173 -s "1Abrä Kaspas1 2Abra Katä b_kaspas2 \
4174 3Abrä Kaspas3 4Abrä Kaspas4 5Abrä Kaspas5 \
4175 6Abra Kaspas6 7Abrä Kaspas7 8Abra Kaspas8 \
4176 9Abra Kaspastäb4-3 10Abra Kaspas1 _ 11Abra Katäb1 \
4177 12Abra Kadabrä1 After Tab after Täb this is NUTS" \
4179 check content
:010 0 "${MBOX}" '1676887734 591'
4181 # Overlong multibyte sequence that must be forcefully split
4182 # todo This works even before v15.0, but only by accident
4184 echo |
${MAILX} ${ARGS} ${ADDARG_UNI} \
4185 -s "✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄\
4186 ✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄\
4187 ✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄" \
4189 check content
:011 0 "${MBOX}" '3029301775 659'
4193 echo |
${MAILX} ${ARGS} \
4194 -s "1-1 B2 B3 B4 B5 B6 B\
4195 1-2 B2 B3 B4 B5 B6 B\
4196 1-3 B2 B3 B4 B5 B6 B\
4197 1-4 B2 B3 B4 B5 B6 B\
4198 1-5 B2 B3 B4 B5 B6 B\
4199 1-6 B2 B3 B4 B5 B6 " \
4201 check content
:012 0 "${MBOX}" '4126167195 297'
4203 # Leading and trailing WS
4205 echo |
${MAILX} ${ARGS} \
4206 -s " 2-1 B2 B3 B4 B5 B6 B\
4207 1-2 B2 B3 B4 B5 B6 B\
4208 1-3 B2 B3 B4 B5 B6 B\
4209 1-4 B2 B3 B4 B5 B6 " \
4211 check content
:013 0 "${MBOX}" '3600624479 236'
4213 # Quick'n dirty RFC 2231 test; i had more when implementing it, but until we
4214 # have a (better) test framework materialize a quick shot
4216 TRAP_EXIT_ADDONS
=.
/.ttt
4218 mkdir .
/.ttt ||
exit 1
4222 : > 'diet\ is \curd.txt'
4223 : > 'diet "is" curd.txt'
4225 : > höde__tröge__müde__dätte__hätte__vülle__gülle__äse__äße__säuerliche__kräuter__österliche__grüße__mäh.txt
4226 : > höde__tröge__müde__dätte__hätte__vuelle__guelle__aese__aesse__sauerliche__kräuter__österliche__grüße__mäh.txt
4227 : > hööööööööööööööööö_nöööööööööööööööööööööö_düüüüüüüüüüüüüüüüüüü_bäääääääääääääääääääääääh.txt
4228 : > ✆✆✆✆✆✆✆✆✆✆✆✆✆✆✆✆✆✆✆✆✆✆✆✆.txt
4230 echo bla |
${MAILX} ${ARGS} ${ADDARG_UNI} \
4231 -a "./.ttt/ma'ger.txt" -a "./.ttt/mä'ger.txt" \
4232 -a './.ttt/diet\ is \curd.txt' -a './.ttt/diet "is" curd.txt' \
4233 -a .
/.ttt
/höde-tröge.txt \
4234 -a .
/.ttt
/höde__tröge__müde__dätte__hätte__vülle__gülle__äse__äße__säuerliche__kräuter__österliche__grüße__mäh.txt \
4235 -a .
/.ttt
/höde__tröge__müde__dätte__hätte__vuelle__guelle__aese__aesse__sauerliche__kräuter__österliche__grüße__mäh.txt \
4236 -a .
/.ttt
/hööööööööööööööööö_nöööööööööööööööööööööö_düüüüüüüüüüüüüüüüüüü_bäääääääääääääääääääääääh.txt \
4237 -a .
/.ttt
/✆✆✆✆✆✆✆✆✆✆✆✆✆✆✆✆✆✆✆✆✆✆✆✆.txt \
4239 check content
:014-1 0 "${MBOX}" '684985954 3092'
4241 # `resend' test, reusing $MBOX
4243 printf "Resend ${BODY}\nx\n" | ${MAILX} ${ARGS} -Rf "${MBOX}"
4244 check content
:014-2 0 "${BODY}" '684985954 3092'
4247 printf "resend ${BODY}\nx\n" | ${MAILX} ${ARGS} -Rf "${MBOX}"
4248 check content
:014-3 0 "${BODY}" '3130352658 3148'
4254 # if have_feat devel; then
4255 # ARGS="${ARGS} -Smemdebug"
4259 if [ -n "${UTF8_LOCALE}" ]; then
4260 printf 'Using Unicode locale %s\n' "${UTF8_LOCALE}"
4262 printf 'No Unicode locale found, disabling Unicode tests\n'
4269 if [ -z "${CHECK_ONLY}" ]; then
4275 [ ${ESTAT} -eq 0 ] && echo Ok ||
echo >&2 'Errors occurred'