2 #@ Synopsis: ./cc-test.sh [--check-only s-mailx-binary]
3 #@ ./cc-test.sh --mae-test s-mailx-binary [:TESTNAME:]
4 #@ The latter generates output files.
5 #@ TODO _All_ the tests should happen in a temporary subdir.
8 # We need *stealthmua* regardless of $SOURCE_DATE_EPOCH, the program name as
9 # such is a compile-time variable
10 ARGS
='-:/ -# -Sdotlock-ignore-error -Sexpandaddr=restrict'
11 ARGS
="${ARGS}"' -Smime-encoding=quoted-printable -Snosave -Sstealthmua'
12 ADDARG_UNI
=-Sttycharset=UTF-8
17 #UTF8_LOCALE= autodetected unless set
19 # Note valgrind has problems with FDs in forked childs, which causes some tests
20 # to fail (the FD is rewound and thus will be dumped twice)
22 #MEMTESTER='valgrind --leak-check=full --log-file=.vl-%p '
24 if ( command -v command ) >/dev
/null
2>&1; then :; else
31 : ${MAKE:=`command -v make`}
32 : ${awk:=`command -v awk`}
33 : ${cat:=`command -v cat`}
34 : ${cksum:=`command -v cksum`}
35 : ${rm:=`command -v rm`}
36 : ${sed:=`command -v sed`}
37 : ${grep:=`command -v grep`}
39 # Problem: force $SHELL to be a real shell. It seems some testing environments
40 # use nologin(?), but we need a real shell for command execution
41 if { echo ${SHELL} | ${grep} nologin; } >/dev
/null
2>&1; then
42 echo >&2 '$SHELL seems to be nologin, overwriting to /bin/sh!'
47 # We sometimes "fake" sendmail(1) a.k.a. *mta* with a shell wrapper, and it
48 # happens that /bin/sh is often terribly slow
49 if command -v dash
>/dev
/null
2>&1; then
50 MYSHELL
="`command -v dash`"
51 elif command -v mksh
>/dev
/null
2>&1; then
52 MYSHELL
="`command -v mksh`"
59 export ARGS ADDARG_UNI CONF BODY MBOX MAIL MAKE
awk cat cksum rm sed grep
63 # Wed Oct 2 01:50:07 UTC 1996
64 SOURCE_DATE_EPOCH
=844221007
66 export LC_ALL LANG TZ SOURCE_DATE_EPOCH
70 echo >&2 "Synopsis: ./cc-test.sh [--check-only s-mailx-binary]"
71 echo >&2 "Synopsis: ./cc-test.sh --mae-test s-mailx-binary [:TESTNAME:]"
75 CHECK_ONLY
= MAE_TEST
= MAILX
=
76 if [ "${1}" = --check-only ]; then
79 [ -x "${MAILX}" ] || usage
81 elif [ "${1}" = --mae-test ]; then
84 [ -x "${MAILX}" ] || usage
86 : ${cp:=`command -v cp`} # XXX
87 : ${tr:=`command -v tr`} # XXX
90 MAILX
="${MEMTESTER}${MAILX}"
93 if [ -n "${CHECK_ONLY}${MAE_TEST}" ] && [ -z "${UTF8_LOCALE}" ]; then
94 # Try ourselfs for nl_langinfo(CODESET) output first (requires a new version)
95 i
=`LC_ALL=C.utf8 "${RAWMAILX}" ${ARGS} -X '
97 \if [ "${ttycharset}" @i=% utf ]
102 \wysh set LC_ALL=${1}
104 \eval xcall cset_test "${@}"
108 \call cset_test C.UTF-8 POSIX.utf8 POSIX.UTF-8 en_EN.utf8 en_EN.UTF-8 \
109 en_US.utf8 en_US.UTF-8
111 [ $?
-eq 0 ] && UTF8_LOCALE
=$i
113 if [ -z "${UTF8_LOCALE}" ] && command -v locale
>/dev
/null
2>&1; then
114 UTF8_LOCALE
=`locale -a | { m=
116 if { echo ${n} | ${grep} -i 'utf-\{0,1\}8'; } >/dev/null 2>&1; then
118 if { echo ${n} | ${grep} -e POSIX -e en_EN -e en_US; }; then
132 trap "${rm} -rf \"${BODY}\" \"${MBOX}\" \${TRAP_EXIT_ADDONS}" EXIT
133 trap "exit 1" HUP INT TERM
136 # Test all configs TODO doesn't cover all *combinations*, stupid!
140 NOTME["OPT_AUTOCC"] = 1
141 NOTME["OPT_DEBUG"] = 1
142 NOTME["OPT_DEVEL"] = 1
143 NOTME["OPT_NOEXTMD5"] = 1
144 NOTME["OPT_ASAN_ADDRESS"] = 1
145 NOTME["OPT_ASAN_MEMORY"] = 1
146 NOTME["OPT_FORCED_STACKPROT"] = 1
147 NOTME["OPT_NOMEMDBG"] = 1
148 NOTME["OPT_NYD2"] = 1
151 /^[[:space:]]*OPT_/ {
152 sub(/^[[:space:]]*/, "")
153 # This bails for UnixWare 7.1.4 awk(1), but preceeding = with \
154 # does not seem to be a compliant escape for =
156 $1 = substr($1, 1, index($1, "=") - 1)
162 # Doing this completely sequentially and not doing make distclean in
163 # between runs should effectively result in lesser compilations.
164 # It is completely dumb nonetheless... TODO
165 for (j = 1; j < i; ++j) {
166 for (k = 1; k < j; ++k)
168 for (k = j; k < i; ++k)
170 printf "OPT_AUTOCC=1\n"
172 for (j = 1; j < i; ++j) {
173 for (k = 1; k < j; ++k)
175 for (k = j; k < i; ++k)
177 printf "OPT_AUTOCC=1\n"
180 for (j = 1; j < i; ++j) {
181 for (k = 1; k < j; ++k)
183 for (k = j; k < i; ++k)
185 printf "OPT_AUTOCC=1\n"
186 printf "OPT_DEBUG=1\n"
188 for (j = 1; j < i; ++j) {
189 for (k = 1; k < j; ++k)
191 for (k = j; k < i; ++k)
193 printf "OPT_AUTOCC=1\n"
194 printf "OPT_DEBUG=1\n"
197 printf "CONFIG=NULL OPT_AUTOCC=0\n"
198 printf "CONFIG=NULL OPT_AUTOCC=1\n"
199 printf "CONFIG=NULLI OPT_AUTOCC=0\n"
200 printf "CONFIG=NULLI OPT_AUTOCC=1\n"
201 printf "CONFIG=MINIMAL OPT_AUTOCC=0\n"
202 printf "CONFIG=MINIMAL OPT_AUTOCC=1\n"
203 printf "CONFIG=NETSEND OPT_AUTOCC=0\n"
204 printf "CONFIG=NETSEND OPT_AUTOCC=1\n"
205 printf "CONFIG=MAXIMAL OPT_AUTOCC=0\n"
206 printf "CONFIG=MAXIMAL OPT_AUTOCC=1\n"
207 printf "CONFIG=DEVEL OPT_AUTOCC=0\n"
208 printf "CONFIG=DEVEL OPT_AUTOCC=1\n"
209 printf "CONFIG=ODEVEL OPT_AUTOCC=0\n"
210 printf "CONFIG=ODEVEL OPT_AUTOCC=1\n"
213 printf "\n\n##########\n$c\n"
214 printf "\n\n##########\n$c\n" >&2
215 sh
-c "${MAKE} ${c} all test"
221 ( "${RAWMAILX}" ${ARGS} -X'echo $features' -Xx |
222 ${grep} +${1} ) >/dev
/null
2>&1
226 ${rm} -rf "${BODY}" "${MBOX}" ${TRAP_EXIT_ADDONS}
228 [ ${#} -gt 0 ] && printf '[%s]\n' "${1}"
235 restat
=${?} tid=${1} eestat=${2} f=${3} s=${4}
236 [ "${eestat}" != - ] && [ "${restat}" != "${eestat}" ] &&
237 err
"${tid}" 'unexpected exit status: '"${restat} != ${eestat}"
238 csum
="`${cksum} < ${f}`"
239 if [ "${csum}" = "${s}" ]; then
240 printf '%s: ok\n' "${tid}"
243 printf '%s: error: checksum mismatch (got %s)\n' "${tid}" "${csum}"
245 if [ -n "${MAE_TEST}" ]; then
246 x
=`echo ${tid} | ${tr} "/:=" "__-"`
247 ${cp} -f "${f}" ./mae-test-"${x}"
253 printf '%s: error: %s\n' ${1} "${2}"
257 [ $? -ne 0 ] && err $1 'unexpected non-0 exit status'
261 [ $? -eq 0 ] && err $1 'unexpected 0 exit status'
264 if ( [ "$
((1 + 1))" = 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}'}'`
278 if ( [ "$
((2 % 3))" = 2 ] ) >/dev/null 2>&1; then
280 echo "$
((${1} % ${2}))"
282 elif command -v expr >/dev/null 2>&1; then
284 echo `expr ${1} % ${2}`
288 echo `${awk} 'BEGIN{print '${1}' % '${2}'}'`
293 # Basic (easily testable) behaviour tests
295 t_behave_X_opt_input_command_stack
298 t_behave_input_inject_semicolon_seq
299 t_behave_commandalias
302 t_behave_macro_param_shift
314 # FIXME t_behave_mlist
317 t_behave_record_a_resend
320 t_behave_compose_hooks
321 t_behave_message_injections
322 t_behave_mime_types_load_control
327 t_behave_mass_recipients
328 t_behave_lreply_futh_rth_etc
329 t_behave_iconv_mbyte_base64
332 t_behave_X_opt_input_command_stack() {
333 t_prolog t_behave_X_opt_input_command_stack
335 ${cat} <<- '__EOT' > "${BODY}"
343 echo "define mac1
{";\
344 echo " echo mac1-1 via1 \
$0";\
346 echo " echo mac1-2
";\
348 echo " echo mac1-3
";\
351 echo "define mac2
{";\
352 echo " echo mac2-1 via1 \
$0";\
354 echo " echo mac2-2
";\
360 echo echo 1-1-1 via1 \
$0;\
372 # The -X option supports multiline arguments, and those can internally use
373 # reverse solidus newline escaping. And all -X options are joined...
375 < "${BODY}" ${MAILX} ${ARGS} \
390 echo "define mac1 {";\
391 echo " echo mac1-1 via2 \$0";\
393 echo " echo mac1-2";\
395 echo " echo mac1-3";\
398 echo "define mac2 {";\
399 echo " echo mac2-1 via2 \$0";\
401 echo " echo mac2-2";\
407 echo echo 1-1-1 via2 \$0;\
421 check behave
:x_opt_input_command_stack
0 "${MBOX}" '1786542668 416'
426 t_behave_X_errexit
() {
427 t_prolog t_behave_X_errexit
429 ${cat} <<- '__EOT' > "${BODY}"
435 </dev/null ${MAILX} ${ARGS} -Snomemdebug \
436 -X'echo one' -X' echos nono ' -X'echo two' \
438 check behave:x_errexit-1 0 "${MBOX}" '916157812 53'
440 </dev/null ${MAILX} ${ARGS} -X'source '"${BODY}" -Snomemdebug \
442 check behave:x_errexit-2 0 "${MBOX}" '916157812 53'
444 </dev/null MAILRC="${BODY}" ${MAILX} ${ARGS} -:u
-Snomemdebug \
446 check behave
:x_errexit-3
0 "${MBOX}" '916157812 53'
450 </dev
/null
${MAILX} ${ARGS} -Serrexit -Snomemdebug \
451 -X'echo one' -X' echos nono ' -X'echo two' \
453 check behave
:x_errexit-4
1 "${MBOX}" '2118430867 49'
455 </dev
/null
${MAILX} ${ARGS} -X'source '"${BODY}" -Serrexit -Snomemdebug \
457 check behave:x_errexit-5 1 "${MBOX}" '2118430867 49'
459 </dev/null MAILRC="${BODY}" ${MAILX} ${ARGS} -:u
-Serrexit -Snomemdebug \
461 check behave
:x_errexit-6
1 "${MBOX}" '12955965 172'
463 </dev
/null MAILRC
="${BODY}" ${MAILX} ${ARGS} -:u -Sposix -Snomemdebug \
465 check behave:x_errexit-7 1 "${MBOX}" '12955965 172'
467 ## Repeat 4-7 with ignerr set
469 ${sed} -e 's/^echos /ignerr echos /' < "${BODY}" > "${MBOX}"
471 </dev
/null
${MAILX} ${ARGS} -Serrexit -Snomemdebug \
472 -X'echo one' -X'ignerr echos nono ' -X'echo two' \
474 check behave
:x_errexit-8
0 "${BODY}" '916157812 53'
476 </dev
/null
${MAILX} ${ARGS} -X'source '"${MBOX}" -Serrexit -Snomemdebug \
478 check behave:x_errexit-9 0 "${BODY}" '916157812 53'
480 </dev/null MAILRC="${MBOX}" ${MAILX} ${ARGS} -:u
-Serrexit -Snomemdebug \
482 check behave
:x_errexit-10
0 "${BODY}" '916157812 53'
484 </dev
/null MAILRC
="${MBOX}" ${MAILX} ${ARGS} -:u -Sposix -Snomemdebug \
486 check behave:x_errexit-11 0 "${BODY}" '916157812 53'
492 t_prolog t_behave_wysh
494 ${cat} <<- '__EOT' > "${BODY}"
513 echo 'a${DIET}b${TIED}c\${DIET}d\${TIED}e' # COMMENT
514 echo "a${DIET}b${TIED}c\${DIET}d\${TIED}e"
515 echo $
'a${DIET}b${TIED}c\${DIET}d\${TIED}e'
517 echo a$
'\101\0101\x41\u0041\u41\U00000041\U41'c
518 echo a$
'\u0041\u41\u0C1\U00000041\U41'c
541 echo a$
'b\U0000000'dt
542 echo a$
'b\U00000000'du
552 if [ -z "${UTF8_LOCALE}" ]; then
553 echo 'Skip behave:wysh_unicode, no UTF8_LOCALE'
555 < "${BODY}" DIET
=CURD TIED
= \
556 LC_ALL
=${UTF8_LOCALE} ${MAILX} ${ARGS} 2>/dev/null > "${MBOX}"
557 check behave:wysh_unicode 0 "${MBOX}" '475805847 317'
560 < "${BODY}" DIET=CURD TIED= ${MAILX} ${ARGS} > "${MBOX}" 2>/dev/null
561 check behave:wysh_c 0 "${MBOX}" '1473887148 321'
566 t_behave_input_inject_semicolon_seq() {
567 t_prolog t_behave_input_inject_semicolon_seq
569 ${cat} <<- '__EOT' | ${MAILX} ${ARGS} > "${MBOX}"
574 echon this_is_mymac
;call mydeepmac
;echon
';';
576 echon one
';';call mymac
;echon two
";";call mymac
;echo three$
';';
578 echon this_is_mymac
;call mydeepmac
;echon
,TOO
'!;';
580 echon one
';';call mymac
;echon two
";";call mymac
;echo three$
';';
583 check behave
:input_inject_semicolon_seq
0 "${MBOX}" '512117110 140'
588 t_behave_commandalias
() {
589 t_prolog t_behave_commandalias
591 ${cat} <<- '__EOT' | ${MAILX} ${ARGS} > "${MBOX}"
592 commandalias echo echo hoho
596 commandalias XxX XxXx
597 commandalias XxXx XxXxX
598 commandalias XxXxX XxXxXx
599 commandalias XxXxXx echo huhu
600 commandalias XxXxXxX echo huhu
602 commandalias XxXxXx XxXxXxX
605 commandalias XxXxXx echo huhu
609 check behave:commandalias 0 "${MBOX}" '3694143612 31'
615 t_prolog t_behave_ifelse
617 # Nestable conditions test
618 ${cat} <<- '__EOT' | ${MAILX} ${ARGS} > "${MBOX}"
640 if $dietcurd == 'yoho'
645 if $dietcurd @
== 'Yoho'
650 if $dietcurd == 'Yoho'
655 if $dietcurd != 'yoho'
660 if $dietcurd @
!= 'Yoho'
665 if $dietcurd != 'Yoho'
726 if $dietcurd == 'yohu'
728 elif $dietcurd == 'yoha'
730 elif $dietcurd == 'yohe'
732 elif $dietcurd == 'yoho'
734 if $dietcurd == 'yohu'
736 elif $dietcurd == 'yoha'
738 elif $dietcurd == 'yohe'
740 elif $dietcurd == 'yoho'
742 if $dietcurd == 'yohu'
744 elif $dietcurd == 'yoha'
746 elif $dietcurd == 'yohe'
748 elif $dietcurd == 'yoho'
897 set diet
=abc curd
=abc
903 set diet
=abc curd
=abcd
909 # 1. Shitty grouping capabilities as of today
910 unset diet curd ndefined
911 if [ [ false
] ||
[ false
] ||
[ true
] ] && [ [ false
] ||
[ true
] ] && \
917 if [ [ [ [ 0 ] ||
[ 1 ] ] && [ [ 1 ] ||
[ 0 ] ] ] && [ 1 ] ] && [ yes ]
922 if [ [ 1 ] ||
[ 0 ] ||
[ 0 ] ||
[ 0 ] ]
927 if [ [ 1 ] ||
[ 0 ] ||
[ 0 ] ||
[ 0 ] ||
[ [ 1 ] ] ]
932 if [ [ 1 ] ||
[ 0 ] ||
[ 0 ] ||
[ 0 ] ||
[ [ 1 ] ] ||
[ 1 ] ] && [ no
]
937 if [ [ 1 ] ||
[ 0 ] ||
[ 0 ] ||
[ 0 ] ||
[ [ 1 ] ] ||
[ 1 ] ] \
943 if [ [ [ [ [ [ [ 1 ] ] && [ 1 ] ] && [ 1 ] ] && [ 1 ] ] ] && [ 1 ] ]
948 if [ [ [ [ [ [ [ 1 ] ] && [ 1 ] ] && [ 1 ] ] && [ 1 ] ] ] && [ 0 ] ]
953 if [ [ [ [ [ [ [ 1 ] ] && [ 1 ] ] && [ 0 ] ] && [ 1 ] ] ] && [ 1 ] ]
958 if [ [ [ [ [ [ [ 0 ] ] && [ 1 ] ] && [ 1 ] ] && [ 1 ] ] ] && [ 1 ] ]
963 if [ 1 ] ||
[ 0 ] ||
[ 0 ] ||
[ 0 ] && [ 0 ]
968 if [ 1 ] ||
[ 0 ] ||
[ 0 ] ||
[ 0 ] && [ 1 ]
973 if [ 0 ] ||
[ 0 ] ||
[ 0 ] ||
[ 1 ] && [ 0 ]
978 if [ 0 ] ||
[ 0 ] ||
[ 0 ] ||
[ 1 ] && [ 1 ]
983 if [ 0 ] ||
[ 0 ] ||
[ 0 ] ||
[ 1 ] && [ 0 ] ||
[ 1 ] && [ 0 ]
988 if [ 0 ] ||
[ 0 ] ||
[ 0 ] ||
[ 1 ] && [ 0 ] ||
[ 1 ] && [ 1 ]
994 if [ [ $diet == 'yo' ] && [ $curd == 'ho' ] ] && [ $ndefined ]
1000 if [ [ $diet == 'yo' ] && [ $curd == 'ho' ] ] && [ $ndefined ]
1005 # 2. Shitty grouping capabilities as of today
1006 unset diet curd ndefined
1007 if [ false || false || true
] && [ false || true
] && yes
1012 if [ [ [ 0 ||
1 ] && [ 1 ||
0 ] ] && 1 ] && [ yes ]
1017 if [ 1 ||
0 ||
0 ||
0 ]
1022 if [ 1 ||
0 ||
0 ||
0 ||
[ 1 ] ]
1027 if [ 1 ||
0 ||
0 ||
0 ||
[ 1 ] ||
1 ] && no
1032 if [ 1 ||
0 ||
0 ||
0 ||
1 ||
[ 1 ] ] && no ||
[ yes ]
1037 if [ [ [ [ [ [ 1 ] && 1 ] && 1 ] && 1 ] ] && [ 1 ] ]
1042 if [ [ [ [ [ [ 1 ] && 1 ] && 1 ] && [ 1 ] ] ] && 0 ]
1047 if [ [ [ [ [ [ [ 1 ] ] && 1 ] && 0 ] && [ 1 ] ] ] && 1 ]
1052 if [ [ [ [ [ [ 0 ] && 1 ] && 1 ] && 1 ] ] && 1 ]
1057 if 1 ||
0 ||
0 ||
0 && 0
1062 if 1 ||
0 ||
0 ||
0 && 1
1067 if 0 ||
0 ||
0 ||
1 && 0
1072 if 0 ||
0 ||
0 ||
1 && 1
1077 if 0 ||
0 ||
0 ||
1 && 0 ||
1 && 0
1082 if 0 ||
0 ||
0 ||
1 && 0 ||
1 && 1
1088 if [ $diet == 'yo' && $curd == 'ho' ] && $ndefined
1093 if $diet == 'yo' && $curd == 'ho' && $ndefined
1099 if [ $diet == 'yo' && $curd == 'ho' ] && $ndefined
1104 if $diet == 'yo' && $curd == 'ho' && $ndefined
1109 if [ [ [ [ [ [ $diet == 'yo' && $curd == 'ho' && $ndefined ] ] ] ] ] ]
1114 # Some more en-braced variables
1116 if ${diet} == ${curd}
1121 if ${diet} != ${curd}
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 ] ] ] ] ] && 3
1167 if ! [ ! 0 ] && [ ! [ ! 1 ] ] && [ ! [ ! [ ! [ ! [ 2 ] ] ] ] ] && 3
1172 if [ ! 0 ] && [ ! [ ! 1 ] ] && [ ! [ ! [ ! [ ! [ 2 ] ] ] ] ] ||
3
1177 if [ ! 0 ] && [ ! ! [ ! ! 1 ] ] && [ ! ! [ ! ! [ ! ! [ ! ! [ 2 ] ] ] ] ]
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 ] ] ] ] ] && 3
1213 if ! [ ! 0 ] && [ ! [ ! 1 ] ] && [ ! [ ! [ ! [ ! ! 0 ] ] ] ] && 3
1218 if [ ! 0 ] && [ ! [ ! 1 ] ] && [ ! [ ! [ ! [ ! [ ! 0 ] ] ] ] ] ||
3
1223 if [ ! 0 ] && [ ! ! [ ! ! 1 ] ] && [ ! ! [ ! ! [ ! ! [ ! [ 0 ] ] ] ] ]
1230 check behave
:if-normal
0 "${MBOX}" '1688759742 719'
1232 if have_feat regex
; then
1233 ${cat} <<- '__EOT' | ${MAILX} ${ARGS} > "${MBOX}"
1235 if $dietcurd =~ '^yo.*'
1240 if $dietcurd =~ '^Yo.*'
1245 if $dietcurd @=~ '^Yo.*'
1250 if $dietcurd =~ '^yOho.+'
1255 if $dietcurd @!~ '.*Ho$'
1260 if $dietcurd !~ '.+yohO$'
1265 if [ $dietcurd @i!~ '.+yoho$' ]
1270 if ! [ $dietcurd @i=~ '.+yoho$' ]
1275 if ! ! [ $dietcurd @i!~ '.+yoho$' ]
1280 if ! [ ! [ $dietcurd @i!~ '.+yoho$' ] ]
1285 if [ ! [ ! [ $dietcurd @i!~ '.+yoho$' ] ] ]
1290 if ! [ ! [ ! [ $dietcurd !~ '.+yoho$' ] ] ]
1295 if ! ! ! $dietcurd !~ '.+yoho$'
1300 if ! ! ! $dietcurd =~ '.+yoho$'
1305 if ! [ ! ! [ ! [ $dietcurd !~ '.+yoho$' ] ] ]
1310 set diet=abc curd='^abc$'
1316 set diet=abc curd='^abcd$'
1324 check behave:if-regex 0 "${MBOX}" '1115671789 95'
1326 printf 'behave:if-regex: unsupported, skipped\n'
1332 t_behave_localopts() {
1333 t_prolog t_behave_localopts
1335 # Nestable conditions test
1336 ${cat} <<- '__EOT' | ${MAILX} ${ARGS} > "${MBOX}" 2>&1
1351 echo $gv1 $lv1 ${lv2} ${lv3} ${gv2}, $t2
1356 echo $gv1 $lv1 ${lv2} ${lv3} ${gv2}, $t2
1357 echo "$gv1 $lv1 ${lv2} ${lv3} ${gv2}, $t2"
1366 echo active trouble
: $gv1 $lv1 ${lv2} ${lv3} ${gv2}, $t3
1368 echo active null
: $gv1 $lv1 ${lv2} ${lv3} ${gv2}, $t3
1377 wysh
set y
=$1; shift; eval localopts
$y; localopts
$1; shift
1384 wysh
set y
=$1; shift; eval localopts
$y; localopts
$1; shift
1391 echo ----- $1: $2 -> $3 -> $4
1399 call llx
'call off' on on on
1400 call llx
'call off' off on on
1401 call llx
'call off' on off on
1402 call llx
'call off' on off off
1403 localopts call-fixate on
1404 call llx
'call-fixate on' on on on
1405 call llx
'call-fixate on' off on on
1406 call llx
'call-fixate on' on off on
1407 call llx
'call-fixate on' on off off
1408 unset x
;localopts call on
1409 call llx
'call on' on on on
1410 call llx
'call on' off on on
1411 call llx
'call on' on off on
1412 call llx
'call on' on off off
1417 check behave
:localopts
0 "${MBOX}" '4016155249 1246'
1422 t_behave_macro_param_shift
() {
1423 t_prolog t_behave_macro_param_shift
1425 ${cat} <<- '__EOT' | ${MAILX} ${ARGS} > "${MBOX}" 2>/dev/null
1428 echo t2.0 has $#/${#} parameters: "$1,${2},$3" (${*}) [$@]
1433 echo t2.1 has $#/${#} parameters: "$1,${2},$3" (${*}) [$@]
1434 if [ $# > 1 ] || [ $ignerr == '' ]
1439 echo t2.2:$? has $#/${#} parameters: "$1,${2},$3" (${*}) [$@]
1441 echo t2.3:$? has $#/${#} parameters: "$1,${2},$3" (${*}) [$@]
1445 echo t2.4:$? has $#/${#} parameters: "$1,${2},$3" (${*}) [$@]
1450 call t2 1 you get four args
1451 echo t1.1: $?';' ignerr ($ignerr) should not exist
1452 call t2 1 you get 'three args'
1453 echo t1.2: $?';' ignerr ($ignerr) should not exist
1454 call t2 1 you 'get two args'
1455 echo t1.3: $?';' ignerr ($ignerr) should not exist
1456 call t2 1 'you get one arg'
1457 echo t1.4: $?';' ignerr ($ignerr) should not exist
1458 ignerr call t2 '' 'you get one arg'
1459 echo t1.5: $?';' ignerr ($ignerr) should not exist
1464 check behave:macro_param_shift 0 "${MBOX}" '1402489146 1682'
1469 t_behave_addrcodec() {
1470 t_prolog t_behave_addrcodec
1472 ${cat} <<- '__EOT' | ${MAILX} ${ARGS} > "${MBOX}"
1473 vput addrcodec res e
1 <doog@def
>
1474 echo $?
/$^ERRNAME
$res
1475 eval vput addrcodec res d
$res
1476 echo $?
/$^ERRNAME
$res
1477 vput addrcodec res e
2 .
<doog@def
>
1478 echo $?
/$^ERRNAME
$res
1479 eval vput addrcodec res d
$res
1480 echo $?
/$^ERRNAME
$res
1481 vput addrcodec res e
3 Sauer Dr.
<doog@def
>
1482 echo $?
/$^ERRNAME
$res
1483 eval vput addrcodec res d
$res
1484 echo $?
/$^ERRNAME
$res
1485 vput addrcodec res e
3.50 Sauer
(Ma
) Dr.
<doog@def
>
1486 echo $?
/$^ERRNAME
$res
1487 eval vput addrcodec res d
$res
1488 echo $?
/$^ERRNAME
$res
1489 vput addrcodec res e
3.51 Sauer
(Ma
) "Dr." <doog@def
>
1490 echo $?
/$^ERRNAME
$res
1491 eval vput addrcodec res d
$res
1492 echo $?
/$^ERRNAME
$res
1494 vput addrcodec res
+e
4 Sauer
(Ma
) Dr.
<doog@def
>
1495 echo $?
/$^ERRNAME
$res
1496 eval vput addrcodec res d
$res
1497 echo $?
/$^ERRNAME
$res
1498 vput addrcodec res
+e
5 Sauer
(Ma
) Braten Dr.
<doog@def
>
1499 echo $?
/$^ERRNAME
$res
1500 eval vput addrcodec res d
$res
1501 echo $?
/$^ERRNAME
$res
1502 vput addrcodec res
+e
6 Sauer
(Ma
) Braten Dr.
(Heu
) <doog@def
>
1503 echo $?
/$^ERRNAME
$res
1504 eval vput addrcodec res d
$res
1505 echo $?
/$^ERRNAME
$res
1506 vput addrcodec res
+e
7 Sauer
(Ma
) Braten Dr.
(Heu
) <doog@def
> (bu
)
1507 echo $?
/$^ERRNAME
$res
1508 eval vput addrcodec res d
$res
1509 echo $?
/$^ERRNAME
$res
1510 vput addrcodec res
+e
8 \
1511 Dr. Sauer
(Ma
) Braten Dr.
(Heu
) <doog@def
> (bu
) Boom. Boom
1512 echo $?
/$^ERRNAME
$res
1513 eval vput addrcodec res d
$res
1514 echo $?
/$^ERRNAME
$res
1515 vput addrcodec res
+e
9 Dr.Sauer
(Ma
)Braten Dr.
(Heu
) <doog@def
>
1516 echo $?
/$^ERRNAME
$res
1517 eval vput addrcodec res d
$res
1518 echo $?
/$^ERRNAME
$res
1519 vput addrcodec res
+e
10 (Ma
)Braten Dr.
(Heu
) <doog@def
>
1520 echo $?
/$^ERRNAME
$res
1521 eval vput addrcodec res d
$res
1522 echo $?
/$^ERRNAME
$res
1523 vput addrcodec res
+e
11 (Ma
)Braten Dr
"." (Heu
) <doog@def
>
1524 echo $?
/$^ERRNAME
$res
1525 eval vput addrcodec res d
$res
1526 echo $?
/$^ERRNAME
$res
1527 vput addrcodec res
+e
12 Dr. Sauer
(Ma
) Braten Dr.
(u
) <doog@def
>
1528 echo $?
/$^ERRNAME
$res
1529 eval vput addrcodec res d
$res
1530 echo $?
/$^ERRNAME
$res
1531 vput addrcodec res
+e
13(Ma
)Braten Dr.
(Heu
) <doog@def
>
1532 echo $?
/$^ERRNAME
$res
1533 eval vput addrcodec res d
$res
1534 echo $?
/$^ERRNAME
$res
1535 vput addrcodec res
+e
14 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
15 \
1540 Hey
, Du
<doog@def
> Wie
() findet
"" Dr.
"" das?
()
1541 echo $?
/$^ERRNAME
$res
1542 eval vput addrcodec res d
$res
1543 echo $?
/$^ERRNAME
$res
1544 vput addrcodec res
+e
16 \
1545 "Hey," "Du" <doog@def
> "Wie()" findet
"" Dr.
"" das?
()
1546 echo $?
/$^ERRNAME
$res
1547 eval vput addrcodec res d
$res
1548 echo $?
/$^ERRNAME
$res
1549 vput addrcodec res
+e
17 \
1550 "Hey" Du
<doog@def
> "Wie() findet " " Dr. """ das?
()
1551 echo $?
/$^ERRNAME
$res
1552 eval vput addrcodec res d
$res
1553 echo $?
/$^ERRNAME
$res
1554 vput addrcodec res
+e
18 \
1555 <doog@def
> "Hey" Du
"Wie() findet " " Dr. """ das?
()
1556 echo $?
/$^ERRNAME
$res
1557 eval vput addrcodec res d
$res
1558 echo $?
/$^ERRNAME
$res
1559 vput addrcodec res
+e
19 Hey\
,\" <doog@def
> "Wie()" findet
\" Dr.
\" das?
1560 echo $?
/$^ERRNAME
$res
1561 eval vput addrcodec res d
$res
1562 echo $?
/$^ERRNAME
$res
1564 vput addrcodec res
++e
20 Hey\
,\" <doog@def
> "Wie()" findet
\" Dr.
\" das?
1565 echo $?
/$^ERRNAME
$res
1566 vput addrcodec res
++e
21 Hey\
,\"" <doog@def> "Wie
()" findet \" Dr. \" das?
1567 echo $?/$^ERRNAME $res
1568 eval vput addrcodec res d $res
1569 echo $?/$^ERRNAME $res
1571 vput addrcodec res +++e 22 Hey\\,\" <doog@def> "Wie
()" findet \" Dr. \" das?
1572 echo $?/$^ERRNAME $res
1573 eval vput addrcodec res d $res
1574 echo $?/$^ERRNAME $res
1576 vput addrcodec res s \
1577 "23 Hey
\\,\\\" \"Wie
" () "\" findet
\\\" Dr.
\\\" das?
" <doog@def>
1578 echo $?/$^ERRNAME $res
1581 check behave:addrcodec 0 "${MBOX}" '429099645 2414'
1587 t_prolog t_behave_vexpr
1589 ${cat} <<- '__EOT' | ${MAILX} ${ARGS} > "${MBOX}" 2>/dev
/null
1590 vput vexpr res
= 9223372036854775807
1591 echo $?
/$^ERRNAME
$res
1592 vput vexpr res
= 9223372036854775808
1593 echo $?
/$^ERRNAME
$res
1594 vput vexpr res
=@
9223372036854775808
1595 echo $?
/$^ERRNAME
$res
1596 vput vexpr res
= -9223372036854775808
1597 echo $?
/$^ERRNAME
$res
1598 vput vexpr res
= -9223372036854775809
1599 echo $?
/$^ERRNAME
$res
1600 vput vexpr res
=@
-9223372036854775809
1601 echo $?
/$^ERRNAME
$res
1604 echo $?
/$^ERRNAME
$res
1606 echo $?
/$^ERRNAME
$res
1608 echo $?
/$^ERRNAME
$res
1610 vput vexpr res
+ 0 0
1611 echo $?
/$^ERRNAME
$res
1612 vput vexpr res
+ 0 1
1613 echo $?
/$^ERRNAME
$res
1614 vput vexpr res
+ 1 1
1615 echo $?
/$^ERRNAME
$res
1617 vput vexpr res
+ 9223372036854775807 0
1618 echo $?
/$^ERRNAME
$res
1619 vput vexpr res
+ 9223372036854775807 1
1620 echo $?
/$^ERRNAME
$res
1621 vput vexpr res
+@
9223372036854775807 1
1622 echo $?
/$^ERRNAME
$res
1623 vput vexpr res
+ 0 9223372036854775807
1624 echo $?
/$^ERRNAME
$res
1625 vput vexpr res
+ 1 9223372036854775807
1626 echo $?
/$^ERRNAME
$res
1627 vput vexpr res
+@
1 9223372036854775807
1628 echo $?
/$^ERRNAME
$res
1630 vput vexpr res
+ -9223372036854775808 0
1631 echo $?
/$^ERRNAME
$res
1632 vput vexpr res
+ -9223372036854775808 -1
1633 echo $?
/$^ERRNAME
$res
1634 vput vexpr res
+@
-9223372036854775808 -1
1635 echo $?
/$^ERRNAME
$res
1636 vput vexpr res
+ 0 -9223372036854775808
1637 echo $?
/$^ERRNAME
$res
1638 vput vexpr res
+ -1 -9223372036854775808
1639 echo $?
/$^ERRNAME
$res
1640 vput vexpr res
+@
-1 -9223372036854775808
1641 echo $?
/$^ERRNAME
$res
1643 vput vexpr res
- 0 0
1644 echo $?
/$^ERRNAME
$res
1645 vput vexpr res
- 0 1
1646 echo $?
/$^ERRNAME
$res
1647 vput vexpr res
- 1 1
1648 echo $?
/$^ERRNAME
$res
1650 vput vexpr res
- 9223372036854775807 0
1651 echo $?
/$^ERRNAME
$res
1652 vput vexpr res
- 9223372036854775807 -1
1653 echo $?
/$^ERRNAME
$res
1654 vput vexpr res
-@
9223372036854775807 -1
1655 echo $?
/$^ERRNAME
$res
1656 vput vexpr res
- 0 9223372036854775807
1657 echo $?
/$^ERRNAME
$res
1658 vput vexpr res
- -1 9223372036854775807
1659 echo $?
/$^ERRNAME
$res
1660 vput vexpr res
- -2 9223372036854775807
1661 echo $?
/$^ERRNAME
$res
1662 vput vexpr res
-@
-2 9223372036854775807
1663 echo $?
/$^ERRNAME
$res
1665 vput vexpr res
- -9223372036854775808 +0
1666 echo $?
/$^ERRNAME
$res
1667 vput vexpr res
- -9223372036854775808 +1
1668 echo $?
/$^ERRNAME
$res
1669 vput vexpr res
-@
-9223372036854775808 +1
1670 echo $?
/$^ERRNAME
$res
1671 vput vexpr res
- 0 -9223372036854775808
1672 echo $?
/$^ERRNAME
$res
1673 vput vexpr res
- +1 -9223372036854775808
1674 echo $?
/$^ERRNAME
$res
1675 vput vexpr res
-@
+1 -9223372036854775808
1676 echo $?
/$^ERRNAME
$res
1678 vput vexpr res
+ -13 -2
1679 echo $?
/$^ERRNAME
$res
1680 vput vexpr res
- 0 0
1681 echo $?
/$^ERRNAME
$res
1682 vput vexpr res
- 0 1
1683 echo $?
/$^ERRNAME
$res
1684 vput vexpr res
- 1 1
1685 echo $?
/$^ERRNAME
$res
1686 vput vexpr res
- -13 -2
1687 echo $?
/$^ERRNAME
$res
1689 vput vexpr res
* 0 0
1690 echo $?
/$^ERRNAME
$res
1691 vput vexpr res
* 0 1
1692 echo $?
/$^ERRNAME
$res
1693 vput vexpr res
* 1 1
1694 echo $?
/$^ERRNAME
$res
1695 vput vexpr res
* -13 -2
1696 echo $?
/$^ERRNAME
$res
1698 vput vexpr res
/ 0 0
1699 echo $?
/$^ERRNAME
$res
1700 vput vexpr res
/ 0 1
1701 echo $?
/$^ERRNAME
$res
1702 vput vexpr res
/ 1 1
1703 echo $?
/$^ERRNAME
$res
1704 vput vexpr res
/ -13 -2
1705 echo $?
/$^ERRNAME
$res
1707 vput vexpr res
% 0 0
1708 echo $?
/$^ERRNAME
$res
1709 vput vexpr res
% 0 1
1710 echo $?
/$^ERRNAME
$res
1711 vput vexpr res
% 1 1
1712 echo $?
/$^ERRNAME
$res
1713 vput vexpr res
% -13 -2
1714 echo $?
/$^ERRNAME
$res
1717 check behave
:vexpr-numeric
0 "${MBOX}" '1723609217 1048'
1719 ${cat} <<- '__EOT' | ${MAILX} ${ARGS} > "${MBOX}" #2>/dev/null
1720 vput vexpr res find 'bananarama' 'nana'
1721 echo $?/$^ERRNAME :$res:
1722 vput vexpr res find 'bananarama' 'bana'
1723 echo $?/$^ERRNAME :$res:
1724 vput vexpr res find 'bananarama' 'Bana'
1725 echo $?/$^ERRNAME :$res:
1726 vput vexpr res find 'bananarama' 'rama'
1727 echo $?/$^ERRNAME :$res:
1729 vput vexpr res ifind 'bananarama' 'nana'
1730 echo $?/$^ERRNAME :$res:
1731 vput vexpr res ifind 'bananarama' 'bana'
1732 echo $?/$^ERRNAME :$res:
1733 vput vexpr res ifind 'bananarama' 'Bana'
1734 echo $?/$^ERRNAME :$res:
1735 vput vexpr res ifind 'bananarama' 'rama'
1736 echo $?/$^ERRNAME :$res:
1738 vput vexpr res substring 'bananarama' 1
1739 echo $?/$^ERRNAME :$res:
1740 vput vexpr res substring 'bananarama' 3
1741 echo $?/$^ERRNAME :$res:
1742 vput vexpr res substring 'bananarama' 5
1743 echo $?/$^ERRNAME :$res:
1744 vput vexpr res substring 'bananarama' 7
1745 echo $?/$^ERRNAME :$res:
1746 vput vexpr res substring 'bananarama' 9
1747 echo $?/$^ERRNAME :$res:
1748 vput vexpr res substring 'bananarama' 10
1749 echo $?/$^ERRNAME :$res:
1750 vput vexpr res substring 'bananarama' 1 3
1751 echo $?/$^ERRNAME :$res:
1752 vput vexpr res substring 'bananarama' 3 3
1753 echo $?/$^ERRNAME :$res:
1754 vput vexpr res substring 'bananarama' 5 3
1755 echo $?/$^ERRNAME :$res:
1756 vput vexpr res substring 'bananarama' 7 3
1757 echo $?/$^ERRNAME :$res:
1758 vput vexpr res substring 'bananarama' 9 3
1759 echo $?/$^ERRNAME :$res:
1760 vput vexpr res substring 'bananarama' 10 3
1761 echo $?/$^ERRNAME :$res:
1763 vput vexpr res substring 'bananarama' -1
1764 echo $?/$^ERRNAME :$res:
1765 vput vexpr res substring 'bananarama' -3
1766 echo $?/$^ERRNAME :$res:
1767 vput vexpr res substring 'bananarama' -5
1768 echo $?/$^ERRNAME :$res:
1769 vput vexpr res substring 'bananarama' -7
1770 echo $?/$^ERRNAME :$res:
1771 vput vexpr res substring 'bananarama' -9
1772 echo $?/$^ERRNAME :$res:
1773 vput vexpr res substring 'bananarama' -10
1774 echo $?/$^ERRNAME :$res:
1775 vput vexpr res substring 'bananarama' 1 -3
1776 echo $?/$^ERRNAME :$res:
1777 vput vexpr res substring 'bananarama' 3 -3
1778 echo $?/$^ERRNAME :$res:
1779 vput vexpr res substring 'bananarama' 5 -3
1780 echo $?/$^ERRNAME :$res:
1781 vput vexpr res substring 'bananarama' 7 -3
1782 echo $?/$^ERRNAME :$res:
1783 vput vexpr res substring 'bananarama' 9 -3
1784 echo $?/$^ERRNAME :$res:
1785 vput vexpr res substring 'bananarama' 10 -3
1786 echo $?/$^ERRNAME :$res:
1788 vput vexpr res trim 'Cocoon Cocoon'
1789 echo $?/$^ERRNAME :$res:
1790 vput vexpr res trim ' Cocoon Cocoon '
1791 echo $?/$^ERRNAME :$res:
1792 vput vexpr res trim-front 'Cocoon Cocoon'
1793 echo $?/$^ERRNAME :$res:
1794 vput vexpr res trim-front ' Cocoon Cocoon '
1795 echo $?/$^ERRNAME :$res:
1796 vput vexpr res trim-end 'Cocoon Cocoon'
1797 echo $?/$^ERRNAME :$res:
1798 vput vexpr res trim-end ' Cocoon Cocoon '
1799 echo $?/$^ERRNAME :$res:
1802 check behave:vexpr-string 0 "${MBOX}" '3182004322 601'
1804 if have_feat regex; then
1805 ${cat} <<- '__EOT' | ${MAILX} ${ARGS} > "${MBOX}" #2>/dev/null
1806 vput vexpr res regex
'bananarama' 'nana'
1807 echo $?
/$^ERRNAME
:$res:
1808 vput vexpr res regex
'bananarama' 'bana'
1809 echo $?
/$^ERRNAME
:$res:
1810 vput vexpr res regex
'bananarama' 'Bana'
1811 echo $?
/$^ERRNAME
:$res:
1812 vput vexpr res regex
'bananarama' 'rama'
1813 echo $?
/$^ERRNAME
:$res:
1815 vput vexpr res iregex
'bananarama' 'nana'
1816 echo $?
/$^ERRNAME
:$res:
1817 vput vexpr res iregex
'bananarama' 'bana'
1818 echo $?
/$^ERRNAME
:$res:
1819 vput vexpr res iregex
'bananarama' 'Bana'
1820 echo $?
/$^ERRNAME
:$res:
1821 vput vexpr res iregex
'bananarama' 'rama'
1822 echo $?
/$^ERRNAME
:$res:
1824 vput vexpr res regex
'bananarama' '(.*)nana(.*)' '\${1}a\${0}u{\$2}'
1825 echo $?
/$^ERRNAME
:$res:
1826 vput vexpr res regex
'bananarama' '(.*)bana(.*)' '\${1}a\${0}u\$2'
1827 echo $?
/$^ERRNAME
:$res:
1828 vput vexpr res regex
'bananarama' 'Bana(.+)' '\$1\$0'
1829 echo $?
/$^ERRNAME
:$res:
1830 vput vexpr res regex
'bananarama' '(.+)rama' '\$1\$0'
1831 echo $?
/$^ERRNAME
:$res:
1833 vput vexpr res iregex
'bananarama' '(.*)nana(.*)' '\${1}a\${0}u{\$2}'
1834 echo $?
/$^ERRNAME
:$res:
1835 vput vexpr res iregex
'bananarama' '(.*)bana(.*)' '\${1}a\${0}u\$2'
1836 echo $?
/$^ERRNAME
:$res:
1837 vput vexpr res iregex
'bananarama' 'Bana(.+)' '\$1\$0'
1838 echo $?
/$^ERRNAME
:$res:
1839 vput vexpr res iregex
'bananarama' '(.+)rama' '\$1\$0'
1840 echo $?
/$^ERRNAME
:$res:
1844 check behave
:vexpr-regex
0 "${MBOX}" '3270360157 311'
1846 printf 'behave:vexpr-regex: unsupported, skipped\n'
1852 t_behave_call_ret
() {
1853 t_prolog t_behave_call_ret
1855 ${cat} <<- '__EOT' | ${MAILX} ${ARGS} -Snomemdebug > "${MBOX}" 2>&1
1860 vput vexpr j '&' $i 7
1866 vput vexpr j '&' $i 7
1872 echo ! The end for $1
1876 # Transport $?/$! up the call chain
1882 wysh set i=$? j=$! k=$^ERRNAME
1886 echo ! The end for $1
1887 return $i $^ERR-BUSY
1891 # Up and down it goes
1898 vput vexpr k - $1 $2
1902 echo "# <$i/$j> .. "
1906 eval echon
"<\$1=\$i/\$^ERRNAME-$j "
1909 echo ! The end
for $1=$i/$2
1913 return $i $^ERR-BUSY
1919 call w1
0; echo ?
=$?
!=$
!; echo -----;
1920 call w2
0; echo ?
=$?
!=$^ERRNAME
; echo -----;
1921 call w3
0 1; echo ?
=$?
!=$^ERRNAME
; echo -----;
1924 check behave
:call_ret
0 "${MBOX}" '1572045517 5922'
1930 t_prolog t_behave_xcall
1932 ${cat} <<- '__EOT' | ${MAILX} ${ARGS} -Snomemdebug > "${MBOX}" 2>&1
1937 vput vexpr j '&' $i 7
1943 echo ! The end for $1/$2
1945 return $i $^ERR-BUSY
1956 echo ?=$? !=$^ERRNAME
1959 echo ?=$? !=$^ERRNAME
1961 echo ?=$? !=$^ERRNAME
1964 check behave:xcall-1 0 "${MBOX}" '2401702082 23801'
1968 ${cat} <<- '__EOT' > "${BODY}"
1973 vput vexpr j '&' $i 7
1979 echo ! The end for $1
1982 echo would be err with errexit
1991 echo zwei, ?=$? !=$!
1992 localopts yes; set errexit
1994 echo drei, ?=$? !=$^ERRNAME
1996 echo vier, ?=$? !=$^ERRNAME, this is an error
1999 echo outer 1, ?=$? !=$^ERRNAME
2001 echo outer 2, ?=$? !=$^ERRNAME, could be error if xxxign non-empty
2003 echo outer 3, ?=$? !=$^ERRNAME
2004 echo this is definitely an error
2007 < "${BODY}" ${MAILX} ${ARGS} -X'commandalias xxxign ignerr' -Snomemdebug \
2009 check behave
:xcall-2
0 "${MBOX}" '3900716531 4200'
2011 < "${BODY}" ${MAILX} ${ARGS} -X'commandalias xxxign " "' -Snomemdebug \
2013 check behave:xcall-3 1 "${MBOX}" '1006776201 2799'
2018 t_behave_vpospar() {
2019 t_prolog t_behave_vpospar
2021 ${cat} <<- '__EOT' | ${MAILX} ${ARGS} > "${MBOX}" 2>&1
2022 vpospar
set hey
, "'you ", world
!
2023 echo $?
/$^ERRNAME
/$#: $
* / "$@" / <$1><$2><$3><$4>
2024 vput vpospar x quote
; echo x
<$x>
2025 vpospar
clear;echo $?
/$^ERRNAME
/$#: $
* / "$@" / <$1><$2><$3><$4>
2026 vput vpospar y quote
;echo y
<$y>
2027 eval vpospar
set ${x};echo $?
/$^ERRNAME
/$#: $
* / "$@" / <$1><$2><$3><$4>
2028 eval vpospar
set ${y};echo $?
/$^ERRNAME
/$#: $
* / "$@" / <$1><$2><$3><$4>
2029 eval vpospar
set ${x};echo $?
/$^ERRNAME
/$#: $
* / "$@" / <$1><$2><$3><$4>
2032 echo infun2
:$?
/$^ERRNAME
/$#:$
*/"$@"/<$1><$2><$3><$4>
2033 vput vpospar z quote
;echo infun2
:z
<$z>
2037 echo infun
:$?
/$^ERRNAME
/$#:$
*/"$@"/<$1><$2><$3><$4>
2038 vput vpospar y quote
;echo infun
:y
<$y>
2039 eval vpospar
set ${x};echo infun
:$?
/$^ERRNAME
/$#:$
*/"$@"/<$1><$2><$3><$4>
2040 vpospar
clear;echo infun
:$?
/$^ERRNAME
/$#:$
*/"$@"/<$1><$2><$3><$4>
2042 echo infun
:$?
/$^ERRNAME
/$#:$
*/"$@"/<$1><$2><$3><$4>
2043 eval vpospar
set ${y};echo infun
:$?
/$^ERRNAME
/$#:$
*/"$@"/<$1><$2><$3><$4>
2046 call infun This
"in a" fun
2047 echo $?
/$^ERRNAME
/$#: $
* / "$@" / <$1><$2><$3><$4>
2048 vpospar
clear;echo $?
/$^ERRNAME
/$#: $
* / "$@" / <$1><$2><$3><$4>
2050 check behave
:vpospar-1
0 "${MBOX}" '155175639 866'
2053 ${cat} <<- '__EOT' | ${MAILX} ${ARGS} > "${MBOX}" 2>&1
2055 echo ifs<$ifs> ifs-ws<$ifs-ws>
2056 vpospar set hey, "'you ", world!
2057 echo $?/$^ERRNAME/$#: $* / "$@" / <$1><$2><$3><$4>
2058 vput vpospar x quote; echo x<$x>
2059 vpospar clear;echo $?/$^ERRNAME/$#: $* / "$@" / <$1><$2><$3><$4>
2060 eval vpospar set ${x};echo $?/$^ERRNAME/$#: $* / "$@" / <$1><$2><$3><$4>
2063 echo ifs<$ifs> ifs-ws<$ifs-ws>
2064 vpospar set hey, "'you
", world!
2065 echo $?/$^ERRNAME/$#: $* / "$@
" / <$1><$2><$3><$4>
2066 vput vpospar x quote; echo x<$x>
2067 vpospar clear;echo $?/$^ERRNAME/$#: $* / "$@
" / <$1><$2><$3><$4>
2068 eval vpospar set ${x};echo $?/$^ERRNAME/$#: $* / "$@
" / <$1><$2><$3><$4>
2071 echo ifs<$ifs> ifs-ws<$ifs-ws>
2072 vpospar set hey, "'you ", world!
2073 echo $?/$^ERRNAME/$#: $* / "$@" / <$1><$2><$3><$4>
2074 vput vpospar x quote; echo x<$x>
2075 vpospar clear;echo $?/$^ERRNAME/$#: $* / "$@" / <$1><$2><$3><$4>
2076 eval vpospar set ${x};echo $?/$^ERRNAME/$#: $* / "$@" / <$1><$2><$3><$4>
2078 check behave:vpospar-ifs 0 "${MBOX}" '2015927702 706'
2083 t_behave_atxplode() {
2084 t_prolog t_behave_atxplode
2085 TRAP_EXIT_ADDONS="./.t*"
2087 ${cat} > ./.t.sh <<- '___
'; ${cat} > ./.t.rc <<- '___
'
2090 printf " (1/$#: <$1>)"
2092 if [ $# -gt 0 ]; then
2106 printf yyy;yyy 'xxx' "b\$
'\t'u
' "
2107 printf xxx;xxx arg ,b u.
2108 printf xxx;xxx arg , .
2109 printf xxx;xxx arg ,ball.
2115 echon " (1/$#: <$1>)"
2130 echon yyy;call yyy '\call xxx' "b\$
'\t'u
' "
2131 echon xxx;call xxx arg ,b u.
2132 echon xxx;call xxx arg , .
2133 echon xxx;call xxx arg ,ball.
2136 ${MAILX} ${ARGS} -X'source ./.t.rc' -Xx > "${MBOX}" 2>&1
2137 check behave:atxplode-1 0 "${MBOX}" '41566293 164'
2139 #${SHELL} ./.t.sh > ./.tshout 2>&1
2140 #check behave:atxplode:disproof-1 0 ./.tshout '41566293 164'
2146 t_prolog t_behave_read
2147 TRAP_EXIT_ADDONS="./.t*"
2149 ${cat} <<- '__EOT
' > .tin
2150 hey1, "'you
", world!
2151 hey2, "'you ", bugs bunny!
2156 ${cat} <<- '__EOT
' |\
2157 ${MAILX} ${ARGS} -X'readctl create ./.tin' > "${MBOX}" 2>&1
2159 echo $?/$^ERRNAME / <$a><$b><$c>
2161 echo $?/$^ERRNAME / <$a><$b><$c>
2163 echo $?/$^ERRNAME / <$a><$b><$c>
2165 echo $?/$^ERRNAME / <$a><$b><$c>
2166 unset a b c;read a b c
2167 echo $?/$^ERRNAME / <$a><$b><$c>
2168 readctl remove ./.tin;echo readctl remove:$?/$^ERRNAME
2170 check behave:read-1 0 "${MBOX}" '1527910147 173'
2172 ${cat} <<- '__EOT
' > .tin2
2173 hey2.0,:"'you
",:world!:mars.:
2174 hey2.1,:"'you ",:world!
2175 hey2.2,:"'you
",:bugs bunny!
2181 ${cat} <<- '__EOT' |\
2182 6< .tin2 ${MAILX} ${ARGS} -X 'readctl create 6' > "${MBOX}" 2>&1
2185 echo $?
/$^ERRNAME
/ <$a><$b><$c>
2187 echo $?
/$^ERRNAME
/ <$a><$b><$c>
2189 echo $?
/$^ERRNAME
/ <$a><$b><$c>
2191 echo $?
/$^ERRNAME
/ <$a><$b><$c>
2193 echo $?
/$^ERRNAME
/ <$a><$b><$c>
2195 echo $?
/$^ERRNAME
/ <$a><$b><$c>
2196 unset a b c
;read a b c
2197 echo $?
/$^ERRNAME
/ <$a><$b><$c>
2199 echo $?
/$^ERRNAME
/ <$a><$b><$c>
2200 readctl remove
6;echo readctl remove
:$?
/$^ERRNAME
2202 check behave
:read-ifs
0 "${MBOX}" '890153490 298'
2204 ${cat} <<- '__EOT' | ${MAILX} ${ARGS} > "${MBOX}" 2>&1
2206 readall d; echo $?/$^ERRNAME / <$d>
2207 wysh set d;readall d;echo $?/$^ERRNAME / <$d>
2208 readctl create .tin2
2209 readall d; echo $?/$^ERRNAME / <$d>
2210 wysh set d;readall d;echo $?/$^ERRNAME / <$d>
2211 readctl remove .tin;echo $?/$^ERRNAME;\
2212 readctl remove .tin2;echo $?/$^ERRNAME
2214 check behave:readall 0 "${MBOX}" '860434889 333'
2220 t_prolog t_behave_mbox
2221 TRAP_EXIT_ADDONS=".
/.t
*"
2225 while [ ${i} -lt 112 ]; do
2226 printf 'm file://%s\n~s Subject %s\nHello %s!\n~.\n' \
2227 "${MBOX}" "${i}" "${i}"
2230 ) | ${MAILX} ${ARGS}
2231 check behave:mbox-1 0 "${MBOX}" '1140119864 13780'
2233 printf 'File "%s
"\ncopy * "%s
"\nFile "%s
"\nfrom*' "${MBOX}" .tmbox1 .tmbox1 |
2234 ${MAILX} ${ARGS} > .tlst
2235 check behave:mbox-2 0 .tlst '2739893312 9103'
2237 printf 'File "%s
"\ncopy * "file://%s
"\nFile "file://%s
"\nfrom*' \
2238 "${MBOX}" .tmbox2 .tmbox2 | ${MAILX} ${ARGS} > .tlst
2239 check behave
:mbox-3
0 .tlst
'1702194178 9110'
2241 # only the odd (even)
2243 printf 'File "file://%s"\ncopy ' .tmbox2
2245 while [ ${i} -lt 112 ]; do
2247 [ ${j} -eq 1 ] && printf '%s ' "${i}"
2250 printf 'file://%s\nFile "file://%s"\nfrom*' .tmbox3 .tmbox3
2251 ) |
${MAILX} ${ARGS} > .tlst
2252 check behave
:mbox-4
0 .tmbox3
'631132924 6890'
2253 check behave
:mbox-5
- .tlst
'2960975049 4573'
2256 printf 'file "file://%s"\nmove ' .tmbox2
2258 while [ ${i} -lt 112 ]; do
2260 [ ${j} -eq 0 ] && [ ${i} -ne 0 ] && printf '%s ' "${i}"
2263 printf 'file://%s\nFile "file://%s
"\nfrom*\nFile "file://%s
"\nfrom*' \
2264 .tmbox3 .tmbox3 .tmbox2
2265 ) | ${MAILX} ${ARGS} > .tlst
2266 check behave:mbox-6 0 .tmbox3 '1387070539 13655'
2267 ${sed} 2d < .tlst > .tlstx
2268 check behave:mbox-7 - .tlstx '2729940494 13645'
2273 t_behave_alternates() {
2274 t_prolog t_behave_alternates
2275 TRAP_EXIT_ADDONS=".
/.t
*"
2277 ${cat} <<-_EOT > ./.tsendmail.sh
2279 (echo 'From Valeriana Sat Jul 08 15:54:03 2017' && ${cat} && echo
2282 chmod 0755 ./.tsendmail.sh
2284 ${cat} <<- '__EOT' | ${MAILX} ${ARGS} -Smta=./.tsendmail.sh > ./.tall 2>&1
2288 alternates a1@b1 a2@b2 a3@b3
2293 echo $?/$^ERRNAME <$rv>
2298 echo $?/$^ERRNAME <$rv>
2301 echo $?/$^ERRNAME <$rv>
2304 echo $?/$^ERRNAME <$rv>
2308 alternates a1@b1 a2@b2 a3@b3
2311 echo $?/$^ERRNAME <$rv>
2314 echo $?/$^ERRNAME <$rv>
2317 echo $?/$^ERRNAME <$rv>
2320 alternates a1@b1 a2@b2 a3@b3
2323 echo $?/$^ERRNAME <$rv>
2326 echo $?/$^ERRNAME <$rv>
2329 echo $?/$^ERRNAME <$rv>
2333 alternates a1@b1 a2@b2 a3@b3
2336 echo $?/$^ERRNAME <$rv>
2340 alternates a1@b1 a1@c1 a1@d1 a2@b2 a3@b3 a3@c3 a3@d3
2342 ~s all alternates, only a1@b1 remains
2344 ~b a3@b3 a3@c3 a3@d3
2353 alternates a1@b1 a1@c1 a2@b2 a3@b3
2355 ~s a1@b1 a1@d1, and a3@c3 a3@d3 remain
2357 ~b a3@b3 a3@c3 a3@d3
2364 alternates a1@b1 a2@b2 a3; set allnet
2366 ~s all alternates via allnet, only a1@b1 remains
2368 ~b a3@b3 a3@c3 a3@d3
2379 echo $?/$^ERRNAME <$rv>
2383 echo $?/$^ERRNAME <$rv>
2387 echo $?/$^ERRNAME <$rv>
2391 echo $?/$^ERRNAME <$rv>
2395 echo $?/$^ERRNAME <$rv>
2399 alternates a1@b1 a2@b2
2402 echo $?/$^ERRNAME <$rv>
2403 alternates a3@b3 a4@b4
2406 echo $?/$^ERRNAME <$rv>
2408 check behave:alternates-1 0 "${MBOX}" '142184864 515'
2409 check behave:alternates-2 - .tall '1878598364 505'
2415 t_prolog t_behave_alias
2416 TRAP_EXIT_ADDONS=".
/.t
*"
2418 ${cat} <<-_EOT > ./.tsendmail.sh
2420 (echo 'From Hippocastanum Mon Jun 19 15:07:07 2017' && ${cat} && echo
2423 chmod 0755 ./.tsendmail.sh
2425 ${cat} <<- '__EOT' | ${MAILX} ${ARGS} -Smta=./.tsendmail.sh > ./.tall 2>&1
2427 alias a1 ex2@a1.ple "EX3
<ex3@a1.ple
>"
2429 alias a2 ex1@a2.ple ex2@a2.ple ex3@a2.ple ex4@a2.ple
2431 alias a4 a5 ex1@a4.ple
2433 alias a6 a7 ex1@a6.ple
2447 check behave:alias-1 0 "${MBOX}" '2496925843 272'
2448 check behave:alias-2 - .tall '3548953204 152'
2450 # TODO t_behave_alias: n_ALIAS_MAXEXP is compile-time constant,
2451 # TODO need to somehow provide its contents to the test, then test
2456 t_behave_filetype() {
2457 t_prolog t_behave_filetype
2458 TRAP_EXIT_ADDONS=".
/.t
*"
2460 ${cat} <<-_EOT > ./.tsendmail.sh
2462 (echo 'From Alchemilla Wed Apr 25 15:12:13 2017' && ${cat} && echo
2465 chmod 0755 ./.tsendmail.sh
2467 printf 'm m1@e.t\nL1\nHy1\n~.\nm m2@e.t\nL2\nHy2\n~@ %s\n~.\n' \
2468 "${SRCDIR}snailmail.jpg" | ${MAILX} ${ARGS} -Smta=.
/.tsendmail.sh
2469 check behave
:filetype-1
0 "${MBOX}" '1594682963 13520'
2471 if command -v gzip >/dev
/null
2>&1; then
2474 printf 'File "%s"\ncopy 1 ./.t.mbox.gz\ncopy 2 ./.t.mbox.gz' \
2475 "${MBOX}" | ${MAILX} ${ARGS} \
2476 -X'filetype gz gzip\ -dc gzip\ -c'
2477 printf 'File ./.t.mbox.gz\ncopy * ./.t.mbox\n' |
2478 ${MAILX} ${ARGS} -X'filetype gz gzip\ -dc gzip\ -c'
2480 check behave:filetype-2 - ".
/.t.mbox
" '1594682963 13520'
2481 check behave:filetype-3 - ".
/.t.out
" '2494681730 102'
2483 echo 'behave:filetype-2: unsupported, skipped'
2484 echo 'behave:filetype-3: unsupported, skipped'
2489 printf 'File "%s
"\ncopy 1 ./.t.mbox.gz
2495 -X'filetype gz gzip\ -dc gzip\ -c' \
2496 -X'filetype mbox.gz "${sed} 1,3d|
${cat}" \
2497 "echo eins
;echo zwei
;echo und mit
${sed} bist Du dabei
;${cat}"'
2498 printf 'File ./.t.mbox.gz\ncopy * ./.t.mbox\n' |
2500 -X'filetype gz gzip\ -dc gzip\ -c' \
2501 -X'filetype mbox.gz "${sed} 1,3d|
${cat}" kill\ 0'
2503 check behave:filetype-4 - ".
/.t.mbox
" '2886541147 27060'
2504 check behave:filetype-5 - ".
/.t.out
" '838452520 172'
2509 t_behave_record_a_resend() {
2510 t_prolog t_behave_record_a_resend
2511 TRAP_EXIT_ADDONS=".
/.t.record .
/.t.resent
"
2515 m %s\n~s Subject 1.\nHello.\n~.
2516 set record-files add-file-recipients
2517 m %s\n~s Subject 2.\nHello.\n~.
2519 resend 2 ./.t.resent
2520 Resend 1 ./.t.resent
2522 resend 2 ./.t.resent
2523 Resend 1 ./.t.resent
2524 ' ./.t.record "${MBOX}" "${MBOX}" "${MBOX}" |
2527 check behave:record_a_resend-1 0 "${MBOX}" '3057873538 256'
2528 check behave:record_a_resend-2 - .t.record '391356429 460'
2529 check behave:record_a_resend-3 - .t.resent '2685231691 648'
2534 t_behave_e_H_L_opts() {
2535 t_prolog t_behave_e_H_L_opts
2536 TRAP_EXIT_ADDONS=".
/.tsendmail.sh .
/.t.mbox
"
2539 ${MAILX} ${ARGS} -ef ./.t.mbox
2540 echo ${?} > "${MBOX}"
2542 ${cat} <<-_EOT > ./.tsendmail.sh
2544 (echo 'From Alchemilla Wed Apr 07 17:03:33 2017' && ${cat} && echo
2547 chmod 0755 ./.tsendmail.sh
2548 printf 'm me@exam.ple\nLine 1.\nHello.\n~.\n' |
2549 ${MAILX} ${ARGS} -Smta=./.tsendmail.sh
2550 printf 'm you@exam.ple\nLine 1.\nBye.\n~.\n' |
2551 ${MAILX} ${ARGS} -Smta=./.tsendmail.sh
2553 ${MAILX} ${ARGS} -ef ./.t.mbox
2554 echo ${?} >> "${MBOX}"
2555 ${MAILX} ${ARGS} -efL @t@me ./.t.mbox
2556 echo ${?} >> "${MBOX}"
2557 ${MAILX} ${ARGS} -efL @t@you ./.t.mbox
2558 echo ${?} >> "${MBOX}"
2559 ${MAILX} ${ARGS} -efL '@>@Line 1' ./.t.mbox
2560 echo ${?} >> "${MBOX}"
2561 ${MAILX} ${ARGS} -efL '@>@Hello.' ./.t.mbox
2562 echo ${?} >> "${MBOX}"
2563 ${MAILX} ${ARGS} -efL '@>@Bye.' ./.t.mbox
2564 echo ${?} >> "${MBOX}"
2565 ${MAILX} ${ARGS} -efL '@>@Good bye.' ./.t.mbox
2566 echo ${?} >> "${MBOX}"
2568 ${MAILX} ${ARGS} -fH ./.t.mbox >> "${MBOX}"
2569 echo ${?} >> "${MBOX}"
2570 ${MAILX} ${ARGS} -fL @t@me ./.t.mbox >> "${MBOX}"
2571 echo ${?} >> "${MBOX}"
2572 ${MAILX} ${ARGS} -fL @t@you ./.t.mbox >> "${MBOX}"
2573 echo ${?} >> "${MBOX}"
2574 ${MAILX} ${ARGS} -fL '@>@Line 1' ./.t.mbox >> "${MBOX}"
2575 echo ${?} >> "${MBOX}"
2576 ${MAILX} ${ARGS} -fL '@>@Hello.' ./.t.mbox >> "${MBOX}"
2577 echo ${?} >> "${MBOX}"
2578 ${MAILX} ${ARGS} -fL '@>@Bye.' ./.t.mbox >> "${MBOX}"
2579 echo ${?} >> "${MBOX}"
2580 ${MAILX} ${ARGS} -fL '@>@Good bye.' ./.t.mbox >> "${MBOX}" 2>/dev
/null
2581 echo ${?} >> "${MBOX}"
2583 check behave
:e_H_L_opts
- "${MBOX}" '1708955574 678'
2588 t_behave_compose_hooks
() { # TODO monster
2589 t_prolog t_behave_compose_hooks
2590 TRAP_EXIT_ADDONS
="./.t*"
2592 (echo line one
&&echo line two
&&echo line three
) > .
/.treadctl
2593 (echo echo four
&&echo echo five
&&echo echo six
) > .
/.tattach
2595 ${cat} <<-_EOT > ./.tsendmail.sh
2597 (echo 'From PrimulaVeris Wed Apr 10 22:59:00 2017' && ${cat} && echo
2600 chmod 0755 .
/.tsendmail.sh
2602 ${cat} <<'__EOT__' > ./.trc
2604 echoerr "Failed: $1. Bailing out"; echo "~x"; xit
2607 vput vexpr es substr "$1" 0 1
2612 define read_mline_res {
2613 read hl; wysh set len=$? es=$! en=$^ERRNAME;\
2614 echo $len/$es/$^ERRNAME: $hl
2615 if [ $es -ne $^ERR-NONE ]
2616 xcall bail read_mline_res
2618 \xcall read_mline_res
2623 echo "~^header list"; read hl; echo $hl;\
2624 call xerr "$hl" "in_addr ($xh) 0-1"
2626 echo "~^header insert $xh diet <$xh@exam.ple> spliced";\
2627 read es; echo $es; call xerr "$es" "ins_addr $xh 1-1"
2628 echo "~^header insert $xh <${xh}2@exam.ple>";\
2629 read es; echo $es; call xerr "$es" "ins_addr $xh 1-2"
2630 echo "~^header insert $xh ${xh}3@exam.ple";\
2631 read es; echo $es; call xerr "$es" "ins_addr $xh 1-3"
2632 echo "~^header list $xh"; read hl; echo $hl;\
2633 call xerr "$hl" "ins_addr $xh 1-4"
2634 echo "~^header show $xh"; read es; call xerr $es "ins_addr $xh 1-5"
2637 if [ "$t_remove" == "" ]
2641 echo "~^header remove $xh"; read es; call xerr $es "ins_addr $xh 2-1"
2642 echo "~^header remove $xh"; read es; vput vexpr es substr $es 0 3
2644 xcall bail "ins_addr $xh 2-2"
2646 echo "~^header list $xh"; read es; vput vexpr es substr $es 0 3
2648 xcall bail "ins_addr $xh 2-3"
2650 echo "~^header show $xh"; read es; vput vexpr es substr $es 0 3
2652 xcall bail "ins_addr $xh 2-4"
2656 echo "~^header insert $xh diet <$xh@exam.ple> spliced";\
2657 read es; echo $es; call xerr "$es" "ins_addr $xh 3-1"
2658 echo "~^header insert $xh <${xh}2@exam.ple>";\
2659 read es; echo $es; call xerr "$es" "ins_addr $xh 3-2"
2660 echo "~^header insert $xh ${xh}3@exam.ple";\
2661 read es; echo $es; call xerr "$es" "ins_addr $xh 3-3"
2662 echo "~^header list $xh"; read hl; echo $hl;\
2663 call xerr "$hl" "ins_addr $xh 3-4"
2664 echo "~^header show $xh"; read es; call xerr $es "ins_addr $xh 3-5"
2667 echo "~^header remove-at $xh 1"; read es;\
2668 call xerr $es "ins_addr $xh 3-6"
2669 echo "~^header remove-at $xh 1"; read es;\
2670 call xerr $es "ins_addr $xh 3-7"
2671 echo "~^header remove-at $xh 1"; read es;\
2672 call xerr $es "ins_addr $xh 3-8"
2673 echo "~^header remove-at $xh 1"; read es;\
2674 vput vexpr es substr $es 0 3
2676 xcall bail "ins_addr $xh 3-9"
2678 echo "~^header remove-at $xh T"; read es;\
2679 vput vexpr es substr $es 0 3
2681 xcall bail "ins_addr $xh 3-10"
2683 echo "~^header list $xh"; read es;\
2684 vput vexpr es substr $es 0 3
2686 xcall bail "ins_addr $xh 3-11"
2688 echo "~^header show $xh"; read es;\
2689 vput vexpr es substr $es 0 3
2691 xcall bail "ins_addr $xh 3-12"
2695 echo "~^header insert $xh diet <$xh@exam.ple> spliced";\
2696 read es; echo $es; call xerr "$es" "ins_addr $xh 4-1"
2697 echo "~^header insert $xh <${xh}2@exam.ple> (comment) \"Quot(e)d\"";\
2698 read es; echo $es; call xerr "$es" "ins_addr $xh 4-2"
2699 echo "~^header insert $xh ${xh}3@exam.ple";\
2700 read es; echo $es; call xerr "$es" "ins_addr $xh 4-3"
2701 echo "~^header list $xh"; read hl; echo $hl;\
2702 call xerr "$hl" "header list $xh 3-4"
2703 echo "~^header show $xh"; read es; call xerr $es "ins_addr $xh 4-5"
2706 echo "~^header remove-at $xh 3"; read es;\
2707 call xerr $es "ins_addr $xh 4-6"
2708 echo "~^header remove-at $xh 2"; read es;\
2709 call xerr $es "ins_addr $xh 4-7"
2710 echo "~^header remove-at $xh 1"; read es;\
2711 call xerr $es "ins_addr $xh 4-8"
2712 echo "~^header remove-at $xh 1"; read es;\
2713 vput vexpr es substr $es 0 3
2715 xcall bail "ins_addr $xh 4-9"
2717 echo "~^header remove-at $xh T"; read es;\
2718 vput vexpr es substr $es 0 3
2720 xcall bail "ins_addr $xh 4-10"
2722 echo "~^header list $xh"; read es;\
2723 vput vexpr es substr $es 0 3
2725 xcall bail "ins_addr $xh 4-11"
2727 echo "~^header show $xh"; read es;\
2728 vput vexpr es substr $es 0 3
2730 xcall bail "ins_addr $xh 4-12"
2734 wysh set xh=$1 mult=$2
2735 echo "~^header list"; read hl; echo $hl;\
2736 call xerr "$hl" "ins_ref ($xh) 0-1"
2738 echo "~^header insert $xh <$xh@exam.ple>";\
2739 read es; echo $es; call xerr "$es" "ins_ref $xh 1-1"
2741 echo "~^header insert $xh <${xh}2@exam.ple>";\
2742 read es; echo $es; call xerr "$es" "ins_ref $xh 1-2"
2743 echo "~^header insert $xh ${xh}3@exam.ple";\
2744 read es; echo $es; call xerr "$es" "ins_ref $xh 1-3"
2746 echo "~^header insert $xh <${xh}2@exam.ple>"; read es;\
2747 vput vexpr es substr $es 0 3
2749 xcall bail "ins_ref $xh 1-4"
2753 echo "~^header list $xh"; read hl; echo $hl;\
2754 call xerr "$hl" "ins_ref $xh 1-5"
2755 echo "~^header show $xh"; read es; call xerr $es "ins_ref $xh 1-6"
2758 if [ "$t_remove" == "" ]
2762 echo "~^header remove $xh"; read es;\
2763 call xerr $es "ins_ref $xh 2-1"
2764 echo "~^header remove $xh"; read es;\
2765 vput vexpr es substr $es 0 3
2767 xcall bail "ins_ref $xh 2-2"
2769 echo "~^header list $xh"; read es;\
2770 vput vexpr es substr $es 0 3
2772 xcall bail "$es ins_ref $xh 2-3"
2774 echo "~^header show $xh"; read es;\
2775 vput vexpr es substr $es 0 3
2777 xcall bail "ins_ref $xh 2-4"
2781 echo "~^header insert $xh <$xh@exam.ple>";\
2782 read es; echo $es; call xerr "$es" "ins_ref $xh 3-1"
2784 echo "~^header insert $xh <${xh}2@exam.ple>";\
2785 read es; echo $es; call xerr "$es" "ins_ref $xh 3-2"
2786 echo "~^header insert $xh ${xh}3@exam.ple";\
2787 read es; echo $es; call xerr "$es" "ins_ref $xh 3-3"
2789 echo "~^header list $xh";\
2790 read hl; echo $hl; call xerr "$hl" "ins_ref $xh 3-4"
2791 echo "~^header show $xh";\
2792 read es; call xerr $es "ins_ref $xh 3-5"
2795 echo "~^header remove-at $xh 1"; read es;\
2796 call xerr $es "ins_ref $xh 3-6"
2797 if [ $mult -ne 0 ] && [ $xh != subject ]
2798 echo "~^header remove-at $xh 1"; read es;\
2799 call xerr $es "ins_ref $xh 3-7"
2800 echo "~^header remove-at $xh 1"; read es;\
2801 call xerr $es "ins_ref $xh 3-8"
2803 echo "~^header remove-at $xh 1"; read es;\
2804 vput vexpr es substr $es 0 3
2806 xcall bail "ins_ref $xh 3-9"
2808 echo "~^header remove-at $xh T"; read es;\
2809 vput vexpr es substr $es 0 3
2811 xcall bail "ins_ref $xh 3-10"
2813 echo "~^header show $xh"; read es;\
2814 vput vexpr es substr $es 0 3
2816 xcall bail "ins_ref $xh 3-11"
2820 echo "~^header insert $xh <$xh@exam.ple> ";\
2821 read es; echo $es; call xerr "$es" "ins_ref $xh 4-1"
2823 echo "~^header insert $xh <${xh}2@exam.ple> ";\
2824 read es; echo $es; call xerr "$es" "ins_ref $xh 4-2"
2825 echo "~^header insert $xh ${xh}3@exam.ple";\
2826 read es; echo $es; call xerr "$es" "ins_ref $xh 4-3"
2828 echo "~^header list $xh"; read hl; echo $hl;\
2829 call xerr "$hl" "ins_ref $xh 4-4"
2830 echo "~^header show $xh"; read es; call xerr $es "ins_ref $xh 4-5"
2833 if [ $mult -ne 0 ] && [ $xh != subject ]
2834 echo "~^header remove-at $xh 3"; read es;\
2835 call xerr $es "ins_ref $xh 4-6"
2836 echo "~^header remove-at $xh 2"; read es;\
2837 call xerr $es "ins_ref $xh 4-7"
2839 echo "~^header remove-at $xh 1"; read es;\
2840 call xerr $es "ins_ref $xh 4-8"
2841 echo "~^header remove-at $xh 1"; read es;\
2842 vput vexpr es substr $es 0 3
2844 xcall bail "ins_ref $xh 4-9"
2846 echo "~^header remove-at $xh T"; read es;\
2847 vput vexpr es substr $es 0 3
2849 xcall bail "ins_ref $xh 4-10"
2851 echo "~^header show $xh"; read es;\
2852 vput vexpr es substr $es 0 3
2854 xcall bail "ins_ref $xh 4-11"
2859 # In collect.c order
2861 call ins_ref sender 0 # Not a "ref", but works
2865 call ins_addr reply-To
2866 call ins_addr mail-Followup-to
2867 call ins_ref messAge-id 0
2868 call ins_ref rEfErEncEs 1
2869 call ins_ref in-Reply-to 1
2870 call ins_ref subject 1 # Not a "ref", but works (with tweaks)
2871 call ins_addr freeForm1
2872 call ins_addr freeform2
2874 echo "~^header show MAILX-Command"; read es; call xerr $es "t_header 1000"
2876 echo "~^header show MAILX-raw-TO"; read es; call xerr $es "t_header 1001"
2884 echo "~^attachment";\
2885 read hl; echo $hl; vput vexpr es substr "$hl" 0 3
2887 xcall bail "attach 0-1"
2890 echo "~^attach attribute ./.treadctl";\
2891 read hl; echo $hl; vput vexpr es substr "$hl" 0 3
2893 xcall bail "attach 0-2"
2895 echo "~^attachment attribute-at 1";\
2896 read hl; echo $hl; vput vexpr es substr "$hl" 0 3
2898 xcall bail "attach 0-3"
2901 echo "~^attachment insert ./.treadctl=ascii";\
2902 read hl; echo $hl; call xerr "$hl" "attach 1-1"
2903 echo "~^attachment list";\
2904 read es; echo $es;call xerr "$es" "attach 1-2"
2906 echo "~^attachment attribute ./.treadctl";\
2907 read es; echo $es;call xerr "$es" "attach 1-3"
2909 echo "~^attachment attribute .treadctl";\
2910 read es; echo $es;call xerr "$es" "attach 1-4"
2912 echo "~^attachment attribute-at 1";\
2913 read es; echo $es;call xerr "$es" "attach 1-5"
2916 echo "~^attachment attribute-set ./.treadctl filename rctl";\
2917 read es; echo $es;call xerr "$es" "attach 1-6"
2918 echo "~^attachment attribute-set .treadctl content-description Au";\
2919 read es; echo $es;call xerr "$es" "attach 1-7"
2920 echo "~^attachment attribute-set-at 1 content-id <10.du@ich>";\
2921 read es; echo $es;call xerr "$es" "attach 1-8"
2923 echo "~^attachment attribute ./.treadctl";\
2924 read es; echo $es;call xerr "$es" "attach 1-9"
2926 echo "~^attachment attribute .treadctl";\
2927 read es; echo $es;call xerr "$es" "attach 1-10"
2929 echo "~^attachment attribute rctl";\
2930 read es; echo $es;call xerr "$es" "attach 1-11"
2932 echo "~^attachment attribute-at 1";\
2933 read es; echo $es;call xerr "$es" "attach 1-12"
2937 echo "~^attachment insert ./.tattach=latin1";\
2938 read hl; echo $hl; call xerr "$hl" "attach 2-1"
2939 echo "~^attachment list";\
2940 read es; echo $es;call xerr "$es" "attach 2-2"
2942 echo "~^attachment attribute ./.tattach";\
2943 read es; echo $es;call xerr "$es" "attach 2-3"
2945 echo "~^attachment attribute .tattach";\
2946 read es; echo $es;call xerr "$es" "attach 2-4"
2948 echo "~^attachment attribute-at 2";\
2949 read es; echo $es;call xerr "$es" "attach 2-5"
2952 echo "~^attachment attribute-set ./.tattach filename tat";\
2953 read es; echo $es;call xerr "$es" "attach 2-6"
2955 "~^attachment attribute-set .tattach content-description Au2";\
2956 read es; echo $es;call xerr "$es" "attach 2-7"
2957 echo "~^attachment attribute-set-at 2 content-id <20.du@wir>";\
2958 read es; echo $es;call xerr "$es" "attach 2-8"
2960 "~^attachment attribute-set-at 2 content-type application/x-sh";\
2961 read es; echo $es;call xerr "$es" "attach 2-9"
2963 echo "~^attachment attribute ./.tattach";\
2964 read es; echo $es;call xerr "$es" "attach 2-10"
2966 echo "~^attachment attribute .tattach";\
2967 read es; echo $es;call xerr "$es" "attach 2-11"
2969 echo "~^attachment attribute tat";\
2970 read es; echo $es;call xerr "$es" "attach 2-12"
2972 echo "~^attachment attribute-at 2";\
2973 read es; echo $es;call xerr "$es" "attach 2-13"
2977 if [ "$t_remove" == "" ]
2981 echo "~^attachment remove ./.treadctl"; read es;\
2982 call xerr $es "attach 3-1"
2983 echo "~^attachment remove ./.tattach"; read es;\
2984 call xerr $es "attach 3-2"
2985 echo "~^ attachment remove ./.treadctl"; read es;\
2986 vput vexpr es substr $es 0 3
2988 xcall bail "attach 3-3"
2990 echo "~^ attachment remove ./.tattach"; read es;\
2991 vput vexpr es substr $es 0 3
2993 xcall bail "attach 3-4"
2995 echo "~^attachment list"; read es;\
2996 vput vexpr es substr $es 0 3
2998 xcall bail "attach 3-5"
3002 echo "~^attachment insert ./.tattach=latin1";\
3003 read hl; echo $hl; call xerr "$hl" "attach 4-1"
3004 echo "~^attachment insert ./.tattach=latin1";\
3005 read hl; echo $hl; call xerr "$hl" "attach 4-2"
3006 echo "~^attachment list";\
3007 read es; echo $es;call xerr "$es" "attach 4-3"
3009 echo "~^ attachment remove .tattach"; read es;\
3010 vput vexpr es substr $es 0 3
3012 xcall bail "attach 4-4 $es"
3014 echo "~^attachment remove-at T"; read es;\
3015 vput vexpr es substr $es 0 3
3017 xcall bail "attach 4-5"
3019 echo "~^attachment remove ./.tattach"; read es;\
3020 call xerr $es "attach 4-6"
3021 echo "~^attachment remove ./.tattach"; read es;\
3022 call xerr $es "attach 4-7"
3023 echo "~^ attachment remove ./.tattach"; read es;\
3024 vput vexpr es substr $es 0 3
3026 xcall bail "attach 4-8 $es"
3028 echo "~^attachment list"; read es;\
3029 vput vexpr es substr $es 0 3
3031 xcall bail "attach 4-9"
3035 echo "~^attachment insert ./.tattach=latin1";\
3036 read hl; echo $hl; call xerr "$hl" "attach 5-1"
3037 echo "~^attachment insert ./.tattach=latin1";\
3038 read hl; echo $hl; call xerr "$hl" "attach 5-2"
3039 echo "~^attachment insert ./.tattach=latin1";\
3040 read hl; echo $hl; call xerr "$hl" "attach 5-3"
3041 echo "~^attachment list";\
3042 read es; echo $es;call xerr "$es" "attach 5-4"
3045 echo "~^attachment remove-at 3"; read es;\
3046 call xerr $es "attach 5-5"
3047 echo "~^attachment remove-at 3"; read es;\
3048 vput vexpr es substr $es 0 3
3050 xcall bail "attach 5-6"
3052 echo "~^attachment remove-at 2"; read es;\
3053 call xerr $es "attach 5-7"
3054 echo "~^attachment remove-at 2"; read es;\
3055 vput vexpr es substr $es 0 3
3057 xcall bail "attach 5-8"
3059 echo "~^attachment remove-at 1"; read es;\
3060 call xerr $es "attach 5-9"
3061 echo "~^attachment remove-at 1"; read es;\
3062 vput vexpr es substr $es 0 3
3064 xcall bail "attach 5-10"
3067 echo "~^attachment list"; read es;\
3068 vput vexpr es substr $es 0 3
3070 xcall bail "attach 5-11"
3074 echo "~^attachment insert ./.tattach=latin1";\
3075 read hl; echo $hl; call xerr "$hl" "attach 6-1"
3076 echo "~^attachment insert ./.tattach=latin1";\
3077 read hl; echo $hl; call xerr "$hl" "attach 6-2"
3078 echo "~^attachment insert ./.tattach=latin1";\
3079 read hl; echo $hl; call xerr "$hl" "attach 6-3"
3080 echo "~^attachment list";\
3081 read es; echo $es;call xerr "$es" "attach 6-4"
3084 echo "~^attachment remove-at 1"; read es;\
3085 call xerr $es "attach 6-5"
3086 echo "~^attachment remove-at 1"; read es;\
3087 call xerr $es "attach 6-6"
3088 echo "~^attachment remove-at 1"; read es;\
3089 call xerr $es "attach 6-7"
3090 echo "~^attachment remove-at 1"; read es;\
3091 vput vexpr es substr $es 0 3
3093 xcall bail "attach 6-8"
3096 echo "~^attachment list"; read es;\
3097 vput vexpr es substr $es 0 3
3099 xcall bail "attach 6-9"
3111 echo on-compose-enter, mailx-command<$mailx-command>
3112 alternates alter1@exam.ple alter2@exam.ple
3114 set autocc='alter1@exam.ple alter2@exam.ple'
3115 echo mailx-from<$mailx-from> mailx-sender<$mailx-sender>
3116 echo mailx-subject<$mailx-subject>
3117 echo mailx-to<$mailx-to> mailx-cc<$mailx-cc> mailx-bcc<$mailx-bcc>
3118 echo mailx-raw-to<$mailx-raw-to> mailx-raw-cc<$mailx-raw-cc> \
3119 mailx-raw-bcc<$mailx-raw-bcc>
3120 echo mailx-orig-from<$mailx-orig-from> mailx-orig-to<$mailx-orig-to> \
3121 mailx-orig-cc<$mailx-orig-cc> mailx-orig-bcc<$mailx-orig-bcc>
3124 echo on-compose-leave, mailx-command<$mailx-command>
3126 eval alternates $al alter3@exam.ple alter4@exam.ple
3128 set autobcc='alter3@exam.ple alter4@exam.ple'
3129 echo mailx-from<$mailx-from> mailx-sender<$mailx-sender>
3130 echo mailx-subject<$mailx-subject>
3131 echo mailx-to<$mailx-to> mailx-cc<$mailx-cc> mailx-bcc<$mailx-bcc>
3132 echo mailx-raw-to<$mailx-raw-to> mailx-raw-cc<$mailx-raw-cc> \
3133 mailx-raw-bcc<$mailx-raw-bcc>
3134 echo mailx-orig-from<$mailx-orig-from> mailx-orig-to<$mailx-orig-to> \
3135 mailx-orig-cc<$mailx-orig-cc> mailx-orig-bcc<$mailx-orig-bcc>
3138 echo on-compose-cleanup, mailx-command<$mailx-command>
3141 echo mailx-from<$mailx-from> mailx-sender<$mailx-sender>
3142 echo mailx-subject<$mailx-subject>
3143 echo mailx-to<$mailx-to> mailx-cc<$mailx-cc> mailx-bcc<$mailx-bcc>
3144 echo mailx-raw-to<$mailx-raw-to> mailx-raw-cc<$mailx-raw-cc> \
3145 mailx-raw-bcc<$mailx-raw-bcc>
3146 echo mailx-orig-from<$mailx-orig-from> mailx-orig-to<$mailx-orig-to> \
3147 mailx-orig-cc<$mailx-orig-cc> mailx-orig-bcc<$mailx-orig-bcc>
3149 wysh set on-compose-splice=t_ocs \
3150 on-compose-enter=t_oce on-compose-leave=t_ocl \
3151 on-compose-cleanup=t_occ
3155 printf 'm this-goes@nowhere\nbody\n!.\n' |
3156 ${MAILX} ${ARGS} -Snomemdebug -Sescape=! -Sstealthmua=noagent \
3157 -X'source ./.trc' -Smta=.
/.tsendmail.sh \
3159 ${cat} .
/.tall
>> "${MBOX}"
3160 check behave
:compose_hooks-1
0 "${MBOX}" '522535560 10101'
3163 printf 'm this-goes@nowhere\nbody\n!.\n' |
3164 ${MAILX} ${ARGS} -Snomemdebug -Sescape=! -Sstealthmua=noagent \
3165 -St_remove=1 -X'source ./.trc' -Smta=.
/.tsendmail.sh \
3167 ${cat} .
/.tall
>> "${MBOX}"
3168 check behave
:compose_hooks-2
0 "${MBOX}" '3654000499 12535'
3172 # Some state machine stress, shell compose hook, localopts for hook, etc.
3173 # readctl in child. ~r as HERE document
3175 printf 'm ex@am.ple\nbody\n!.\nvar t_oce t_ocs t_ocs_sh t_ocl t_occ autocc' |
3176 ${MAILX} ${ARGS} -Snomemdebug -Sescape=! \
3177 -Smta=.
/.tsendmail.sh \
3180 echoerr "Failed: $1. Bailing out"; echo "~x"; xit
3183 vput vexpr es substr "$1" 0 1
3188 define read_mline_res {
3189 read hl; wysh set len=$? es=$! en=$^ERRNAME;\
3190 echo $len/$es/$^ERRNAME: $hl
3191 if [ $es -ne $^ERR-NONE ]
3192 xcall bail read_mline_res
3194 \xcall read_mline_res
3198 vput vexpr i + 1 "$2"
3200 vput vexpr j % $i 10
3207 eval \\$j _work $1 $i
3210 vput vexpr i + $i "$1"
3214 wysh set line; read line;wysh set es=$? en=$^ERRNAME ;\
3215 echo read:$es/$en: $line
3216 if [ "${es}" -ne -1 ]
3219 readctl remove $cwd/.treadctl; echo readctl remove:$?/$^ERRNAME
3224 echo "~^header list"; read hl; echo $hl;\
3225 vput vexpr es substr "$hl" 0 1
3227 xcall bail "header list"
3230 call _work 1; echo $?
3231 echo "~^header insert cc splicy diet <splice@exam.ple> spliced";\
3232 read es; echo $es; vput vexpr es substr "$es" 0 1
3234 xcall bail "be diet"
3236 echo "~^header insert cc <splice2@exam.ple>";\
3237 read es; echo $es; vput vexpr es substr "$es" 0 1
3239 xcall bail "be diet2"
3242 call _work 2; echo $?
3243 echo "~^header insert bcc juicy juice <juice@exam.ple> spliced";\
3244 read es; echo $es;vput vexpr es substr "$es" 0 1
3246 xcall bail "be juicy"
3248 echo "~^header insert bcc juice2@exam.ple";\
3249 read es; echo $es;vput vexpr es substr "$es" 0 1
3251 xcall bail "be juicy2"
3253 echo "~^header insert bcc juice3 <juice3@exam.ple>";\
3254 read es; echo $es;vput vexpr es substr "$es" 0 1
3256 xcall bail "be juicy3"
3258 echo "~^header insert bcc juice4@exam.ple";\
3259 read es; echo $es;vput vexpr es substr "$es" 0 1
3261 xcall bail "be juicy4"
3264 echo "~^header remove-at bcc 3";\
3265 read es; echo $es;vput vexpr es substr "$es" 0 1
3267 xcall bail "remove juicy5"
3269 echo "~^header remove-at bcc 2";\
3270 read es; echo $es;vput vexpr es substr "$es" 0 1
3272 xcall bail "remove juicy6"
3274 echo "~^header remove-at bcc 3";\
3275 read es; echo $es;vput vexpr es substr "$es" 0 3
3277 xcall bail "failed to remove-at"
3279 # Add duplicates which ought to be removed!
3280 echo "~^header insert bcc juice4@exam.ple";\
3281 read es; echo $es;vput vexpr es substr "$es" 0 1
3283 xcall bail "be juicy4-1"
3285 echo "~^header insert bcc juice4@exam.ple";\
3286 read es; echo $es;vput vexpr es substr "$es" 0 1
3288 xcall bail "be juicy4-2"
3290 echo "~^header insert bcc juice4@exam.ple";\
3291 read es; echo $es;vput vexpr es substr "$es" 0 1
3293 xcall bail "be juicy4-3"
3298 call _work 3; echo $?
3300 vput ! i echo just knock if you can hear me;\
3302 while [ $i -lt 24 ]; do printf "%s " $i; i=`expr $i + 1`; done;\
3304 echon shell-cmd says $?/$^ERRNAME: $i
3305 echo "~x will not become interpreted, we are reading until __EOT"
3307 read r_status; echo "~~r status output: $r_status"
3308 echo "~:echo $? $! $^ERRNAME"
3310 echo "~~r status from parent: $r_status"
3313 call _work 4; echo $?
3314 vput cwd cwd;echo cwd:$?
3315 readctl create $cwd/.treadctl ;echo readctl:$?/$^ERRNAME;\
3319 call _work 5; echo $?
3320 echo "~^header show MAILX-Command"; read es;\
3321 call xerr $es "t_header 1000"; call read_mline_res
3322 echo "~^header show MAILX-raw-TO"; read es;\
3323 call xerr $es "t_header 1001"; xcall read_mline_res
3325 echoerr IT IS WRONG IF YOU SEE THIS
3328 echo on-compose-enter, mailx-command<$mailx-command>
3329 set t_oce autobcc=oce@exam.ple
3330 alternates alter1@exam.ple alter2@exam.ple
3332 echo mailx-from<$mailx-from> mailx-sender<$mailx-sender>
3333 echo mailx-subject<$mailx-subject>
3334 echo mailx-to<$mailx-to> mailx-cc<$mailx-cc> mailx-bcc<$mailx-bcc>
3335 echo mailx-raw-to<$mailx-raw-to> mailx-raw-cc<$mailx-raw-cc> \
3336 mailx-raw-bcc<$mailx-raw-bcc>
3337 echo mailx-orig-from<$mailx-orig-from> \
3338 mailx-orig-to<$mailx-orig-to> \
3339 mailx-orig-cc<$mailx-orig-cc> mailx-orig-bcc<$mailx-orig-bcc>
3342 echo on-compose-leave, mailx-command<$mailx-command>
3343 set t_ocl autocc=ocl@exam.ple
3345 alternates alter3@exam.ple alter4@exam.ple
3347 echo mailx-from<$mailx-from> mailx-sender<$mailx-sender>
3348 echo mailx-subject<$mailx-subject>
3349 echo mailx-to<$mailx-to> mailx-cc<$mailx-cc> mailx-bcc<$mailx-bcc>
3350 echo mailx-raw-to<$mailx-raw-to> mailx-raw-cc<$mailx-raw-cc> \
3351 mailx-raw-bcc<$mailx-raw-bcc>
3352 echo mailx-orig-from<$mailx-orig-from> \
3353 mailx-orig-to<$mailx-orig-to> \
3354 mailx-orig-cc<$mailx-orig-cc> mailx-orig-bcc<$mailx-orig-bcc>
3357 echo on-compose-cleanup, mailx-command<$mailx-command>
3358 set t_occ autocc=occ@exam.ple
3361 echo mailx-from<$mailx-from> mailx-sender<$mailx-sender>
3362 echo mailx-subject<$mailx-subject>
3363 echo mailx-to<$mailx-to> mailx-cc<$mailx-cc> mailx-bcc<$mailx-bcc>
3364 echo mailx-raw-to<$mailx-raw-to> mailx-raw-cc<$mailx-raw-cc> \
3365 mailx-raw-bcc<$mailx-raw-bcc>
3366 echo mailx-orig-from<$mailx-orig-from> \
3367 mailx-orig-to<$mailx-orig-to> \
3368 mailx-orig-cc<$mailx-orig-cc> mailx-orig-bcc<$mailx-orig-bcc>
3370 wysh set on-compose-splice=t_ocs \
3371 on-compose-splice-shell="read ver;printf \"t_ocs-shell\\n\
3372 ~t shell@exam.ple\\n~:set t_ocs_sh\\n\"" \
3373 on-compose-enter=t_oce on-compose-leave=t_ocl \
3374 on-compose-cleanup=t_occ
3376 ex0_test behave
:compose_hooks-3
3377 ${cat} .
/.tnotes
>> "${MBOX}"
3379 check behave
:compose_hooks-3
- "${MBOX}" '679526364 2431'
3381 # Reply, forward, resend, Resend
3384 printf 'set from=f1@z\nm t1@z\nb1\n!.\nset from=f2@z\nm t2@z\nb2\n!.\n' |
3385 ${MAILX} ${ARGS} -Snomemdebug -Sescape=! \
3386 -Smta=.
/.tsendmail.sh
3389 echo start: $? $! $^ERRNAME
3391 echo File: $? $! $^ERRNAME;echo;echo
3393 this is content of reply 1
3395 echo reply 1: $? $! $^ERRNAME;echo;echo
3397 this is content of Reply 1 2
3399 echo Reply 1 2: $? $! $^ERRNAME;echo;echo
3400 forward 1 fwdex@am.ple
3401 this is content of forward 1
3403 echo forward 1: $? $! $^ERRNAME;echo;echo
3404 resend 1 2 resendex@am.ple
3405 echo resend 1 2: $? $! $^ERRNAME;echo;echo
3406 Resend 1 2 Resendex@am.ple
3407 echo Resend 1 2: $? $! $^ERRNAME;echo;echo
3409 ${MAILX} ${ARGS} -Snomemdebug -Sescape=! \
3410 -Smta=.
/.tsendmail.sh \
3413 echoerr "Failed: $1. Bailing out"; echo "~x"; xit
3416 vput vexpr es substr "$1" 0 1
3421 define read_mline_res {
3422 read hl; wysh set len=$? es=$! en=$^ERRNAME;\
3423 echo mline_res:$len/$es/$^ERRNAME: $hl
3424 if [ $es -ne $^ERR-NONE ]
3425 xcall bail read_mline_res
3427 \xcall read_mline_res
3431 echo "~^header show $1"; read es;\
3432 call xerr $es "work_hl $1"; echo $1; call read_mline_res
3440 echo t_ocs version $ver
3441 echo "~^header list"; read hl; echo $hl;\
3442 echoerr the header list is $hl;\
3443 call xerr "$hl" "header list"
3444 eval vpospar set $hl
3447 echoerr IT IS WRONG IF YOU SEE THIS
3450 echo on-XY-enter, mailx-command<$mailx-command>
3451 set t_oce autobcc=oce@exam.ple
3452 echo mailx-from<$mailx-from> mailx-sender<$mailx-sender>
3453 echo mailx-subject<$mailx-subject>
3454 echo mailx-to<$mailx-to> mailx-cc<$mailx-cc> mailx-bcc<$mailx-bcc>
3455 echo mailx-raw-to<$mailx-raw-to> mailx-raw-cc<$mailx-raw-cc> \
3456 mailx-raw-bcc<$mailx-raw-bcc>
3457 echo mailx-orig-from<$mailx-orig-from> \
3458 mailx-orig-to<$mailx-orig-to> \
3459 mailx-orig-cc<$mailx-orig-cc> mailx-orig-bcc<$mailx-orig-bcc>
3462 echo on-XY-leave, mailx-command<$mailx-command>
3463 set t_ocl autocc=ocl@exam.ple
3464 echo mailx-from<$mailx-from> mailx-sender<$mailx-sender>
3465 echo mailx-subject<$mailx-subject>
3466 echo mailx-to<$mailx-to> mailx-cc<$mailx-cc> mailx-bcc<$mailx-bcc>
3467 echo mailx-raw-to<$mailx-raw-to> mailx-raw-cc<$mailx-raw-cc> \
3468 mailx-raw-bcc<$mailx-raw-bcc>
3469 echo mailx-orig-from<$mailx-orig-from> \
3470 mailx-orig-to<$mailx-orig-to> \
3471 mailx-orig-cc<$mailx-orig-cc> mailx-orig-bcc<$mailx-orig-bcc>
3474 echo on-XY-cleanup, mailx-command<$mailx-command>
3475 set t_occ autocc=occ@exam.ple
3476 echo mailx-from<$mailx-from> mailx-sender<$mailx-sender>
3477 echo mailx-subject<$mailx-subject>
3478 echo mailx-to<$mailx-to> mailx-cc<$mailx-cc> mailx-bcc<$mailx-bcc>
3479 echo mailx-raw-to<$mailx-raw-to> mailx-raw-cc<$mailx-raw-cc> \
3480 mailx-raw-bcc<$mailx-raw-bcc>
3481 echo mailx-orig-from<$mailx-orig-from> \
3482 mailx-orig-to<$mailx-orig-to> \
3483 mailx-orig-cc<$mailx-orig-cc> mailx-orig-bcc<$mailx-orig-bcc>
3485 wysh set on-compose-splice=t_ocs \
3486 on-compose-enter=t_oce on-compose-leave=t_ocl \
3487 on-compose-cleanup=t_occ \
3488 on-resend-enter=t_oce on-resend-cleanup=t_occ
3490 ex0_test behave
:compose_hooks-4
3491 ${cat} .
/.tnotes
>> "${MBOX}"
3493 check behave
:compose_hooks-4
- "${MBOX}" '3038884027 7516'
3498 t_behave_message_injections
() {
3499 t_prolog t_behave_message_injections
3500 TRAP_EXIT_ADDONS
="./.t*"
3502 ${cat} <<-_EOT > ./.tsendmail.sh
3504 (echo 'From Echinacea Tue Jun 20 15:54:02 2017' && ${cat} && echo
3507 chmod 0755 .
/.tsendmail.sh
3509 echo mysig
> .
/.tmysig
3511 echo some-body |
${MAILX} ${ARGS} -Smta=.
/.tsendmail.sh \
3512 -Smessage-inject-head=head-inject \
3513 -Smessage-inject-tail=tail-inject \
3514 -Ssignature=.
/.tmysig \
3515 ex@am.ple
> .
/.tall
2>&1
3516 check behave
:message_injections-1
0 "${MBOX}" '2434746382 134'
3517 check behave
:message_injections-2
- .tall
'4294967295 0' # empty file
3519 ${cat} <<-_EOT > ./.template
3523 Subject: This subject is
3525 Body, body, body me.
3527 < .
/.template
${MAILX} ${ARGS} -t -Smta=.
/.tsendmail.sh \
3528 -Smessage-inject-head=head-inject \
3529 -Smessage-inject-tail=tail-inject \
3530 -Ssignature=.
/.tmysig \
3532 check behave
:message_injections-3
0 "${MBOX}" '3114203412 198'
3533 check behave
:message_injections-4
- .tall
'4294967295 0' # empty file
3538 t_behave_mime_types_load_control
() {
3539 t_prolog t_behave_mime_types_load_control
3540 TRAP_EXIT_ADDONS
="./.t*"
3542 ${cat} <<-_EOT > ./.tmts1
3543 @ application/mathml+xml mathml
3545 ${cat} <<-_EOT > ./.tmts2
3546 @ x-conference/x-cooltalk ice
3548 @ application/aga-aga aga
3551 ${cat} <<-_EOT > ./.tmts1.mathml
3552 <head>nonsense ML</head>
3554 ${cat} <<-_EOT > ./.tmts2.ice
3557 printf 'of which the c\x01rack is coming soon' > .
/.tmtsx.doom
3558 printf 'of which the c\x01rack is coming soon' > .
/.tmtsx.aga
3572 ' "${MBOX}" "${MBOX}" |
3574 -Smimetypes-load-control=f
=.
/.tmts1
,f
=.
/.tmts2 \
3576 ex0_test behave
:mime_types_load_control
3578 ${cat} "${MBOX}" >> .
/.tout
3579 check behave
:mime_types_load_control-1
- .
/.tout
'1441260727 2449'
3581 echo type |
${MAILX} ${ARGS} -R \
3582 -Smimetypes-load-control=f
=.
/.tmts1
,f
=.
/.tmts3 \
3583 -f "${MBOX}" >> .
/.tout
2>&1
3584 check behave
:mime_types_load_control-2
0 .
/.tout
'1441391438 3646'
3590 have_feat smime ||
{
3591 echo 'behave:s/mime: unsupported, skipped'
3595 t_prolog t_behave_s_mime
3596 TRAP_EXIT_ADDONS
="./.t.conf ./.tkey.pem ./.tcert.pem ./.tpair.pem"
3597 TRAP_EXIT_ADDONS
="${TRAP_EXIT_ADDONS} ./.VERIFY ./.DECRYPT ./.ENCRYPT"
3598 TRAP_EXIT_ADDONS
="${TRAP_EXIT_ADDONS} ./.tsendmail.sh"
3600 printf 'behave:s/mime: .. generating test key and certificate ..\n'
3601 ${cat} <<-_EOT > ./.t.conf
3604 default_keyfile = keyfile.pem
3605 distinguished_name = req_distinguished_name
3606 attributes = req_attributes
3610 [ req_distinguished_name ]
3617 emailAddress = test@localhost
3622 openssl req
-x509 -nodes -days 3650 -config .
/.t.conf \
3623 -newkey rsa
:1024 -keyout .
/.tkey.pem
-out .
/.tcert.pem
>/dev
/null
2>&1
3624 ${cat} .
/.tkey.pem .
/.tcert.pem
> .
/.tpair.pem
3627 printf 'behave:s/mime:sign/verify: '
3628 echo bla |
${MAILX} ${ARGS} \
3629 -Ssmime-ca-file=.
/.tcert.pem
-Ssmime-sign-cert=.
/.tpair.pem \
3630 -Ssmime-sign -Sfrom=test@localhost \
3631 -s 'S/MIME test' .
/.VERIFY
3632 if [ $?
-eq 0 ]; then
3643 /^Content-Description: /{ skip = 2; print; next }
3644 /^$/{ if(skip) --skip }
3647 < .
/.VERIFY
> "${MBOX}"
3648 check behave
:s
/mime
:sign
/verify
:checksum
- "${MBOX}" '2900817158 648'
3650 printf 'behave:s/mime:sign/verify:verify '
3651 printf 'verify\nx\n' |
3653 -Ssmime-ca-file=.
/.tcert.pem
-Ssmime-sign-cert=.
/.tpair.pem \
3654 -Ssmime-sign -Sfrom=test@localhost \
3656 -f .
/.VERIFY
>/dev
/null
2>&1
3657 if [ $?
-eq 0 ]; then
3666 printf 'behave:s/mime:sign/verify:disproof-1 '
3667 if openssl smime
-verify -CAfile .
/.tcert.pem \
3668 -in .
/.VERIFY
>/dev
/null
2>&1; then
3677 # (signing +) encryption / decryption
3678 ${cat} <<-_EOT > ./.tsendmail.sh
3680 (echo 'From Euphrasia Thu Apr 27 17:56:23 2017' && ${cat}) > ./.ENCRYPT
3682 chmod 0755 .
/.tsendmail.sh
3684 printf 'behave:s/mime:encrypt+sign: '
3687 -Ssmime-force-encryption \
3688 -Ssmime-encrypt-recei@ver.com
=.
/.tpair.pem \
3689 -Smta=.
/.tsendmail.sh \
3690 -Ssmime-ca-file=.
/.tcert.pem
-Ssmime-sign-cert=.
/.tpair.pem \
3691 -Ssmime-sign -Sfrom=test@localhost \
3692 -s 'S/MIME test' recei@ver.com
3693 if [ $?
-eq 0 ]; then
3697 printf 'error: encrypt+sign failed\n'
3700 ${sed} -e '/^$/,$d' < .
/.ENCRYPT
> "${MBOX}"
3701 check behave
:s
/mime
:encrypt
+sign
:checksum
- "${MBOX}" '1937410597 327'
3703 printf 'behave:s/mime:decrypt+verify: '
3704 printf 'decrypt ./.DECRYPT\nfi ./.DECRYPT\nverify\nx\n' |
3706 -Ssmime-force-encryption \
3707 -Ssmime-encrypt-recei@ver.com
=.
/.tpair.pem \
3708 -Smta=.
/.tsendmail.sh \
3709 -Ssmime-ca-file=.
/.tcert.pem
-Ssmime-sign-cert=.
/.tpair.pem \
3710 -Ssmime-sign -Sfrom=test@localhost \
3712 -f .
/.ENCRYPT
>/dev
/null
2>&1
3713 if [ $?
-eq 0 ]; then
3722 /^Content-Description: /{ skip = 2; print; next }
3723 /^$/{ if(skip) --skip }
3726 < .
/.DECRYPT
> "${MBOX}"
3727 check behave
:s
/mime
:decrypt
+verify
:checksum
- "${MBOX}" '1720739247 931'
3729 printf 'behave:s/mime:decrypt+verify:disproof-1: '
3730 if (openssl smime
-decrypt -inkey .
/.tkey.pem
-in .
/.ENCRYPT |
3731 openssl smime
-verify -CAfile .
/.tcert.pem
) >/dev
/null
2>&1; then
3738 printf "behave:s/mime:encrypt: "
3739 echo bla |
${MAILX} ${ARGS} \
3740 -Ssmime-force-encryption \
3741 -Ssmime-encrypt-recei@ver.com
=.
/.tpair.pem \
3742 -Smta=.
/.tsendmail.sh \
3743 -Ssmime-ca-file=.
/.tcert.pem
-Ssmime-sign-cert=.
/.tpair.pem \
3744 -Sfrom=test@localhost \
3745 -s 'S/MIME test' recei@ver.com
3746 if [ $?
-eq 0 ]; then
3753 # Same as behave:s/mime:encrypt+sign:checksum above
3754 ${sed} -e '/^$/,$d' < .
/.ENCRYPT
> "${MBOX}"
3755 check behave
:s
/mime
:encrypt
:checksum
- "${MBOX}" '1937410597 327'
3758 printf 'decrypt ./.DECRYPT\nx\n' |
${MAILX} ${ARGS} \
3759 -Ssmime-force-encryption \
3760 -Ssmime-encrypt-recei@ver.com
=.
/.tpair.pem \
3761 -Smta=.
/.tsendmail.sh \
3762 -Ssmime-ca-file=.
/.tcert.pem
-Ssmime-sign-cert=.
/.tpair.pem \
3763 -Sfrom=test@localhost \
3765 -f .
/.ENCRYPT
>/dev
/null
2>&1
3766 check behave
:s
/mime
:decrypt
0 "./.DECRYPT" '2624716890 422'
3768 printf 'behave:s/mime:decrypt:disproof-1: '
3769 if openssl smime
-decrypt -inkey .
/.tkey.pem \
3770 -in .
/.ENCRYPT
>/dev
/null
2>&1; then
3780 t_behave_maildir
() {
3781 t_prolog t_behave_maildir
3782 TRAP_EXIT_ADDONS
="./.t*"
3786 while [ ${i} -lt 112 ]; do
3787 printf 'm file://%s\n~s Subject %s\nHello %s!\n~.\n' \
3788 "${MBOX}" "${i}" "${i}"
3791 ) |
${MAILX} ${ARGS}
3792 check behave
:maildir-1
0 "${MBOX}" '1140119864 13780'
3798 ' "${MBOX}" .tmdir1 .tmdir1 |
3799 ${MAILX} ${ARGS} -Snewfolders=maildir
> .tlst
3800 check behave
:maildir-2
0 .tlst
'1797938753 9103'
3803 copy * "maildir://%s"
3806 ' "${MBOX}" .tmdir2 .tmdir2 |
3807 ${MAILX} ${ARGS} > .tlst
3808 check behave
:maildir-3
0 .tlst
'1155631089 9113'
3810 printf 'File "maildir://%s"
3814 ' .tmdir2 .tmbox1 .tmbox1 |
3815 ${MAILX} ${ARGS} > .tlst
3816 check behave
:maildir-4
0 .tmbox1
'2646131190 13220'
3817 check behave
:maildir-5
- .tlst
'3701297796 9110'
3819 # only the odd (even)
3821 printf 'File "maildir://%s"
3824 while [ ${i} -lt 112 ]; do
3826 [ ${j} -eq 1 ] && printf '%s ' "${i}"
3833 ) |
${MAILX} ${ARGS} > .tlst
3834 check behave
:maildir-6
0 .tmbox2
'142890131 6610'
3835 check behave
:maildir-7
- .tlst
'960096773 4573'
3838 printf 'file "maildir://%s"
3841 while [ ${i} -lt 112 ]; do
3843 [ ${j} -eq 0 ] && [ ${i} -ne 0 ] && printf '%s ' "${i}"
3851 ' .tmbox2 .tmbox2 .tmdir2
3852 ) | ${MAILX} ${ARGS} > .tlst
3853 check behave:maildir-8 0 .tmbox2 '3806905791 13100'
3854 ${sed} 2d < .tlst > .tlstx
3855 check behave:maildir-9 - .tlstx '4216815295 13645'
3860 t_behave_mass_recipients() {
3861 t_prolog t_behave_mass_recipients
3862 TRAP_EXIT_ADDONS=".
/.t
*"
3864 ${cat} <<-_EOT > ./.tsendmail.sh
3866 (echo 'From Eucalyptus Sat Jul 08 21:14:57 2017' && ${cat} && echo
3869 chmod 0755 ./.tsendmail.sh
3871 ${cat} <<'__EOT__' > ./.trc
3873 echoerr "Failed
: $1. Bailing out
"; echo "~x
"; xit
3876 wysh set nr=$1 hn=$2
3877 echo "~
$hn $hn$nr@
$hn"; echo '~:echo $?'; read es
3879 xcall bail "ins_addr
$hn 1-$nr"
3881 vput vexpr nr + $nr 1
3882 if [ "$nr" -le "$maximum" ]
3883 xcall ins_addr $nr $hn
3887 wysh set nr=$1 hn=$2
3888 alternates $hn$nr@$hn
3889 vput vexpr nr + $nr 2
3890 if [ "$nr" -le "$maximum" ]
3891 xcall bld_alter $nr $hn
3901 if [ "$t_remove" != '' ]
3906 set on-compose-splice=t_ocs on-compose-leave=t_ocl
3910 printf 'm this-goes@nowhere\nbody\n!.\n' |
3911 ${MAILX} ${ARGS} -Snomemdebug -Sescape=! -Sstealthmua=noagent \
3912 -X'source ./.trc' -Smta=./.tsendmail.sh -Smaximum=2001 \
3914 ${cat} ./.tall >> "${MBOX}"
3915 check behave:mass_recipients-1 0 "${MBOX}" '2912243346 51526'
3918 printf 'm this-goes@nowhere\nbody\n!.\n' |
3919 ${MAILX} ${ARGS} -Snomemdebug -Sescape=! -Sstealthmua=noagent \
3920 -St_remove=1 -X'source ./.trc' -Smta=./.tsendmail.sh -Smaximum=2001 \
3922 ${cat} ./.tall >> "${MBOX}"
3923 check behave:mass_recipients-2 0 "${MBOX}" '4097804632 34394'
3928 t_behave_lreply_futh_rth_etc() {
3929 t_prolog t_behave_lreply_futh_rth_etc
3930 TRAP_EXIT_ADDONS=".
/.t
*"
3932 ${cat} <<-_EOT > ./.tsendmail.sh
3934 (echo 'From HumulusLupulus Thu Jul 27 14:41:20 2017' && ${cat} && echo
3937 chmod 0755 ./.tsendmail.sh
3939 ${cat} <<-_EOT > ./.tmbox
3940 From neverneverland Sun Jul 23 13:46:25 2017
3941 Subject: Bugstop: five miles out 1
3942 Reply-To: mister originator2 <mr2@originator>, bugstop@five.miles.out
3943 From: mister originator <mr@originator>
3944 To: bugstop-commit@five.miles.out, laber@backe.eu
3946 Mail-Followup-To: bugstop@five.miles.out, laber@backe.eu, is@a.list
3947 In-reply-to: <20170719111113.bkcMz%laber@backe.eu>
3948 Date: Wed, 19 Jul 2017 09:22:57 -0400
3949 Message-Id: <20170719132257.766AF781267@originator>
3952 > |Sorry, I think I misunderstand something. I would think that
3956 From neverneverland Fri Jul 7 22:39:11 2017
3957 Subject: Bugstop: five miles out 2
3958 Reply-To: mister originator2<mr2@originator>,bugstop@five.miles.out,is@a.list
3959 Content-Transfer-Encoding: 7bit
3960 From: mister originator <mr@originator>
3961 To: bugstop-commit@five.miles.out
3963 Message-ID: <149945963975.28888.6950788126957753723.reportbug@five.miles.out>
3964 Date: Fri, 07 Jul 2017 16:33:59 -0400
3967 capable of changing back.
3969 From neverneverland Fri Jul 7 22:42:00 2017
3970 Subject: Bugstop: five miles out 3
3971 Reply-To: mister originator2 <mr2@originator>, bugstop@five.miles.out
3972 Content-Transfer-Encoding: 7bit
3973 From: mister originator <mr@originator>
3974 To: bugstop-commit@five.miles.out
3976 Message-ID: <149945963975.28888.6950788126957753746.reportbug@five.miles.out>
3977 Date: Fri, 07 Jul 2017 16:33:59 -0400
3978 List-Post: <mailto:bugstop@five.miles.out>
3981 are you ready, boots?
3983 From neverneverland Sat Aug 19 23:15:00 2017
3984 Subject: Bugstop: five miles out 4
3985 Reply-To: mister originator2 <mr2@originator>, bugstop@five.miles.out
3986 Content-Transfer-Encoding: 7bit
3987 From: mister originator <mr@originator>
3988 To: bugstop@five.miles.out
3990 Message-ID: <149945963975.28888.6950788126qtewrqwer.reportbug@five.miles.out>
3991 Date: Fri, 07 Jul 2017 16:33:59 -0400
3992 List-Post: <mailto:bugstop@five.miles.out>
3995 are you ready, boots?
4000 ${cat} <<-'_EOT' | ${MAILX} ${ARGS} -Sescape=! -Smta=./.tsendmail.sh \
4001 -Rf ./.tmbox >> "${MBOX}" 2>&1
4003 wysh set m="This is text of
\"reply
${1}.
"
4014 echo -----After reply
$1.1
- $1.3
: $?
/$^ERRNAME
4017 wysh
set m
="This is text of \"Reply ${1}."
4023 echo -----After Reply $1.$2: $?/$^ERRNAME
4032 wysh set m="This is text of \"Lreply ${1}." on-compose-splice=_Lh n=$2
4036 # We need two indirections for this test: one for the case that Lreply
4037 # fails because of missing recipients: we need to read EOF next, thus
4038 # place this in _Ls last; and second for the succeeding cases EOF is
4039 # not what these should read, so go over the backside and splice it in!
4041 echo -----After Lreply $1.$2: $?/$^ERRNAME
4044 localopts call-fixate yes
4046 call R $1 1; call R $1 2; call R $1 3; call R $1 4
4047 call L $1 1; call L $1 2; call L $1 3
4050 echo;echo '===== CHANGING
=== '"$*"' =====';echo
4054 set from=laber@backe.eu
4057 call tweak set reply-to-honour
4059 call tweak set followup-to
4061 call tweak set followup-to-honour
4063 call tweak mlist bugstop@five.miles.out
4065 call tweak mlsubscribe bugstop@five.miles.out
4067 call tweak set recipients-in-cc
4071 check behave:lreply_futh_rth_etc 0 "${MBOX}" '940818845 29373'
4076 t_behave_iconv_mbyte_base64() {
4077 t_prolog t_behave_iconv_mbyte_base64
4078 TRAP_EXIT_ADDONS="./.t*"
4080 if [ -n "${UTF8_LOCALE}" ] && have_feat iconv &&
4081 command -v iconv >/dev/null 2>&1 &&
4082 ( iconv -l | ${grep} -i -e iso-2022-jp -e euc-jp) >/dev/null 2>&1; then
4085 echo 'behave
:iconv_mbyte_base64
: unsupported
, skipped
'
4089 ${cat} <<-_EOT > ./.tsendmail.sh
4091 (echo 'From DroseriaRotundifolia Thu Aug
03 17:26:25 2017' && ${cat} &&
4094 chmod 0755 ./.tsendmail.sh
4096 if ( iconv -l | ${grep} -i iso-2022-jp ) >/dev/null 2>&1; then
4097 cat <<-'_EOT' | LC_ALL=${UTF8_LOCALE} ${MAILX} ${ARGS} \
4098 -Smta=./.tsendmail.sh \
4099 -Sescape=! -Smime-encoding=base64 2>./.terr
4100 set ttycharset=utf-8 sendcharsets=iso-2022-jp
4102 !s Japanese from UTF-8 to ISO-2022-JP
4103 シジュウカラ科(シジュウカラか、学名 Paridae)は、鳥類スズメ目の科である。シジュウカラ(四十雀)と総称されるが、狭義にはこの1種をシジュウカラと呼ぶ。
4105 カンムリガラ(学名Parus cristatus)は、スズメ目シジュウカラ科に分類される鳥類の一種。
4108 カンムリガラ(学名Parus cristatus)は、スズメ目シジュウカラ科に分類される鳥類の一種。
4110 シジュウカラ科(シジュウカラか、学名 Paridae)は、鳥類スズメ目の科である。シジュウカラ(四十雀)と総称されるが、狭義にはこの1種をシジュウカラと呼ぶ。
4113 set ttycharset=iso-2022-jp charset-7bit=iso-2022-jp sendcharsets=utf-8
4115 !s Japanese from ISO-2022-JP to UTF-8, eh, no, also ISO-2022-JP
4116 \e$B%7%8%e%&%+%i2J!J%7%8%e%&%+%i$+!"3XL>\e(B Paridae\e$B!K$O!"D;N`%9%:%aL\$N2J$G$"$k!#%7%8%e%&%+%i!J;M==?}!K$HAm>N$5$l$k$,!"695A$K$O$3$N\e(B1\e$B<o$r%7%8%e%&%+%i$H8F$V!#\e(B
4118 \e$B%+%s%`%j%,%i!J3XL>\e(BParus cristatus\e$B!K$O!"%9%:%aL\%7%8%e%&%+%i2J$KJ,N`$5$l$kD;N`$N0l<o!#\e(B
4121 \e$B%+%s%`%j%,%i!J3XL>\e(BParus cristatus\e$B!K$O!"%9%:%aL\%7%8%e%&%+%i2J$KJ,N`$5$l$kD;N`$N0l<o!#\e(B
4123 \e$B%7%8%e%&%+%i2J!J%7%8%e%&%+%i$+!"3XL>\e(B Paridae\e$B!K$O!"D;N`%9%:%aL\$N2J$G$"$k!#%7%8%e%&%+%i!J;M==?}!K$HAm>N$5$l$k$,!"695A$K$O$3$N\e(B1\e$B<o$r%7%8%e%&%+%i$H8F$V!#\e(B
4126 check behave:iconv_mbyte_base64-1 0 "${MBOX}" '3428985079 1976'
4127 check behave:iconv_mbyte_base64-2 - ./.terr '4294967295 0'
4129 printf 'eval f
1; write .
/.twrite
\n' |
4130 ${MAILX} ${ARGS} ${ADDARG_UNI} -Rf "${MBOX}" >./.tlog 2>&1
4131 check behave:iconv_mbyte_base64-3 0 ./.twrite '1259742080 686'
4132 check behave:iconv_mbyte_base64-4 - ./.tlog '3956097665 119'
4134 echo 'behave
:iconv_mbyte_base64
: ISO-2022-JP unsupported
, skipping
1-4'
4137 if ( iconv -l | ${grep} -i euc-jp ) >/dev/null 2>&1; then
4138 rm -f "${MBOX}" ./.twrite
4139 cat <<-'_EOT' | LC_ALL=${UTF8_LOCALE} ${MAILX} ${ARGS} \
4140 -Smta=./.tsendmail.sh \
4141 -Sescape=! -Smime-encoding=base64 2>./.terr
4142 set ttycharset=utf-8 sendcharsets=euc-jp
4144 !s Japanese from UTF-8 to EUC-JP
4145 シジュウカラ科(シジュウカラか、学名 Paridae)は、鳥類スズメ目の科である。シジュウカラ(四十雀)と総称されるが、狭義にはこの1種をシジュウカラと呼ぶ。
4147 カンムリガラ(学名Parus cristatus)は、スズメ目シジュウカラ科に分類される鳥類の一種。
4150 カンムリガラ(学名Parus cristatus)は、スズメ目シジュウカラ科に分類される鳥類の一種。
4152 シジュウカラ科(シジュウカラか、学名 Paridae)は、鳥類スズメ目の科である。シジュウカラ(四十雀)と総称されるが、狭義にはこの1種をシジュウカラと呼ぶ。
4155 set ttycharset=EUC-JP sendcharsets=utf-8
4157 !s Japanese from EUC-JP to UTF-8
4158 ¥·¥¸¥å¥¦¥«¥é²Ê¡Ê¥·¥¸¥å¥¦¥«¥é¤«¡¢³Ø̾ Paridae¡Ë¤Ï¡¢Ä»Îॹ¥º¥áÌܤβʤǤ¢¤ë¡£¥·¥¸¥å¥¦¥«¥é¡Ê»Í½½¿ý¡Ë¤ÈÁí¾Î¤µ¤ì¤ë¤¬¡¢¶¹µÁ¤Ë¤Ï¤³¤Î1¼ï¤ò¥·¥¸¥å¥¦¥«¥é¤È¸Æ¤Ö¡£
4160 ¥«¥ó¥à¥ê¥¬¥é¡Ê³Ø̾Parus cristatus¡Ë¤Ï¡¢¥¹¥º¥áÌÜ¥·¥¸¥å¥¦¥«¥é²Ê¤ËʬÎव¤ì¤ëÄ»Îà¤Î°ì¼ï¡£
4163 ¥«¥ó¥à¥ê¥¬¥é¡Ê³Ø̾Parus cristatus¡Ë¤Ï¡¢¥¹¥º¥áÌÜ¥·¥¸¥å¥¦¥«¥é²Ê¤ËʬÎव¤ì¤ëÄ»Îà¤Î°ì¼ï¡£
4165 ¥·¥¸¥å¥¦¥«¥é²Ê¡Ê¥·¥¸¥å¥¦¥«¥é¤«¡¢³Ø̾ Paridae¡Ë¤Ï¡¢Ä»Îॹ¥º¥áÌܤβʤǤ¢¤ë¡£¥·¥¸¥å¥¦¥«¥é¡Ê»Í½½¿ý¡Ë¤ÈÁí¾Î¤µ¤ì¤ë¤¬¡¢¶¹µÁ¤Ë¤Ï¤³¤Î1¼ï¤ò¥·¥¸¥å¥¦¥«¥é¤È¸Æ¤Ö¡£
4168 check behave:iconv_mbyte_base64-5 0 "${MBOX}" '1686827547 2051'
4169 check behave:iconv_mbyte_base64-6 - ./.terr '4294967295 0'
4171 printf 'eval f
1; write .
/.twrite
\n' |
4172 ${MAILX} ${ARGS} ${ADDARG_UNI} -Rf "${MBOX}" >./.tlog 2>&1
4173 check behave:iconv_mbyte_base64-7 0 ./.twrite '1259742080 686'
4174 check behave:iconv_mbyte_base64-8 - ./.tlog '500059195 119'
4176 echo 'behave
:iconv_mbyte_base64
: EUC-JP unsupported
, skipping
5-8'
4183 # Some basic tests regarding correct sending of mails, via STDIN / -t / -q,
4184 # including basic MIME Content-Transfer-Encoding correctness (quoted-printable)
4185 # Note we unfortunately need to place some statements without proper
4186 # indentation because of continuation problems
4190 # MIME encoding (QP) stress message body
4192 'Ich bin eine DÖS-Datäi mit sehr langen Zeilen und auch
'\
4193 'sonst bin ich ganz schön am Schleudern
, da kannste denke
'\
4194 "wasde willst, gelle, gelle, gelle, gelle, gelle.\r\n"\
4195 "Ich bin eine DÖS-Datäi mit langen Zeilen und auch sonst \r\n"\
4196 "Ich bin eine DÖS-Datäi mit langen Zeilen und auch sonst 1\r\n"\
4197 "Ich bin eine DÖS-Datäi mit langen Zeilen und auch sonst 12\r\n"\
4198 "Ich bin eine DÖS-Datäi mit langen Zeilen und auch sonst 123\r\n"\
4199 "Ich bin eine DÖS-Datäi mit langen Zeilen und auch sonst 1234\r\n"\
4200 "Ich bin eine DÖS-Datäi mit langen Zeilen und auch sonst 12345\r\n"\
4201 "Ich bin eine DÖS-Datäi mit langen Zeilen und auch sonst 123456\r\n"\
4202 "Ich bin eine DÖS-Datäi mit langen Zeilen und auch sonst 1234567\r\n"\
4203 "Ich bin eine DÖS-Datäi mit langen Zeilen und auch sonst 12345678\r\n"\
4204 "Ich bin eine DÖS-Datäi mit langen Zeilen und auch sonst 123456789\r\n"\
4205 "Unn ausserdem habe ich trailing SP/HT/SP/HT whitespace \r\n"\
4206 "Unn ausserdem habe ich trailing HT/SP/HT/SP whitespace \r\n"\
4207 "auf den zeilen vorher.\r\n"\
4208 "From am Zeilenbeginn und From der Mitte gibt es auch.\r\n"\
4210 "Die letzte Zeile war nur ein Punkt.\r\n"\
4212 "Das waren deren zwei.\r\n"\
4214 "Die letzte Zeile war ein Leerschritt.\n"\
4215 "=VIER = EQUAL SIGNS=ON A LINE=\r\n"\
4218 "Die letzte Zeile war nur ein Punkt, mit Unix Zeilenende.\n"\
4220 "Das waren deren zwei. ditto.\n"\
4222 "Unn ausseerdem habe ich trailing SP/HT/SP/HT whitespace \n"\
4223 "Unn ausseerdem habe ich trailing HT/SP/HT/SP whitespace \n"\
4224 "auf den zeilen vorher.\n"\
4226 "Ich bin eine ziemlich lange, steile, scharfe Zeile mit Unix Zeilenende.\n"\
4227 "Ich bin eine ziemlich lange, steile, scharfe Zeile mit Unix Zeilenende.1"\
4229 "Ich bin eine ziemlich lange, steile, scharfe Zeile mit Unix Zeilenende.12"\
4231 "Ich bin eine ziemlich lange, steile, scharfe Zeile mit Unix Zeilenende.12"\
4233 "Ich bin eine ziemlich lange, steile, scharfe Zeile mit Unix Zeilenende.12"\
4235 "Ich bin eine ziemlich lange, steile, scharfe Zeile mit Unix Zeilenende.12"\
4237 "Ich bin eine ziemlich lange, steile, scharfe Zeile mit Unix Zeilenende.12"\
4239 "QP am Zeilenende über soft-nl hinweg\n"\
4240 "Ich bin eine ziemlich lange, steile, scharfe Zeile mit Unix Zeilenende."\
4242 "Ich bin eine ziemlich lange, steile, scharfe Zeile mit Unix Zeilenende."\
4244 "Ich bin eine ziemlich lange, steile, scharfe Zeile mit Unix Zeilenende."\
4246 "Ich bin eine ziemlich lange, steile, scharfe Zeile mit Unix Zeilenende."\
4248 "=VIER = EQUAL SIGNS=ON A LINE=\n"\
4250 "Die letzte Zeile war ein Leerschritt.\n"\
4254 # MIME encoding (QP) stress message subject
4255 SUB="Äbrä Kä?dä=brö Fü?di=bus? \
4256 adadaddsssssssddddddddddddddddddddd\
4257 ddddddddddddddddddddddddddddddddddd\
4258 ddddddddddddddddddddddddddddddddddd\
4259 dddddddddddddddddddd Hallelulja? Od\
4260 er?? eeeeeeeeeeeeeeeeeeeeeeeeeeeeee\
4261 eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee\
4262 eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee f\
4263 fffffffffffffffffffffffffffffffffff\
4264 fffffffffffffffffffff ggggggggggggg\
4265 ggggggggggggggggggggggggggggggggggg\
4266 ggggggggggggggggggggggggggggggggggg\
4267 ggggggggggggggggggggggggggggggggggg\
4270 # Three tests for MIME encoding and (a bit) content classification.
4271 # At the same time testing -q FILE, < FILE and -t FILE
4274 < "${BODY}" ${MAILX} ${ARGS} ${ADDARG_UNI} \
4275 -a "${BODY}" -s "${SUB}" "${MBOX}"
4276 check content:001 0 "${MBOX}" '1145066634 6654'
4279 < /dev/null ${MAILX} ${ARGS} ${ADDARG_UNI} \
4280 -a "${BODY}" -s "${SUB}" -q "${BODY}" "${MBOX}"
4281 check content:002 0 "${MBOX}" '1145066634 6654'
4284 ( echo "To: ${MBOX}" && echo "Subject: ${SUB}" && echo &&
4286 ) | ${MAILX} ${ARGS} ${ADDARG_UNI} -Snodot -a "${BODY}" -t
4287 check content:003 0 "${MBOX}" '1145066634 6654'
4289 # Test for [260e19d] (Juergen Daubert)
4291 echo body | ${MAILX} ${ARGS} "${MBOX}"
4292 check content:004 0 "${MBOX}" '2917662811 98'
4294 # Sending of multiple mails in a single invocation
4296 ( printf "m ${MBOX}\n~s subject1\nE-Mail Körper 1\n~.\n" &&
4297 printf "m ${MBOX}\n~s subject2\nEmail body 2\n~.\n" &&
4299 ) | ${MAILX} ${ARGS} ${ADDARG_UNI}
4300 check content:005 0 "${MBOX}" '2098659767 358'
4304 # "Test for" [d6f316a] (Gavin Troy)
4306 printf "m ${MBOX}\n~s subject1\nEmail body\n~.\nfi ${MBOX}\np\nx\n" |
4307 ${MAILX} ${ARGS} ${ADDARG_UNI} -Spipe-text/plain="@* ${cat}" > "${BODY}"
4308 check content:006 0 "${MBOX}" '2099098650 122'
4309 check content:006-1 - "${BODY}" '794542938 174'
4311 # "Test for" [c299c45] (Peter Hofmann) TODO shouldn't end up QP-encoded?
4314 for(i = 0; i < 10000; ++i)
4316 #printf "\xF0\x90\x87\x90"
4317 }' |
${MAILX} ${ARGS} ${ADDARG_UNI} -s TestSubject "${MBOX}"
4318 check content:007 0 "${MBOX}" '534262374 61816'
4320 ## Test some more corner cases for header bodies (as good as we can today) ##
4324 echo | ${MAILX} ${ARGS} ${ADDARG_UNI} \
4325 -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̲' \
4327 check content:008 0 "${MBOX}" '3370931614 375'
4329 # Single word (overlong line split -- bad standard! Requires injection of
4330 # artificial data!! But can be prevented by using RFC 2047 encoding)
4332 i=`${awk} 'BEGIN{for(i=0; i<92; ++i) printf "0123456789_
"}'`
4333 echo | ${MAILX} ${ARGS} -s "${i}" "${MBOX}"
4334 check content
:009 0 "${MBOX}" '489922370 1718'
4336 # Combination of encoded words, space and tabs of varying sort
4338 echo |
${MAILX} ${ARGS} ${ADDARG_UNI} \
4339 -s "1Abrä Kaspas1 2Abra Katä b_kaspas2 \
4340 3Abrä Kaspas3 4Abrä Kaspas4 5Abrä Kaspas5 \
4341 6Abra Kaspas6 7Abrä Kaspas7 8Abra Kaspas8 \
4342 9Abra Kaspastäb4-3 10Abra Kaspas1 _ 11Abra Katäb1 \
4343 12Abra Kadabrä1 After Tab after Täb this is NUTS" \
4345 check content
:010 0 "${MBOX}" '1676887734 591'
4347 # Overlong multibyte sequence that must be forcefully split
4348 # todo This works even before v15.0, but only by accident
4350 echo |
${MAILX} ${ARGS} ${ADDARG_UNI} \
4351 -s "✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄\
4352 ✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄\
4353 ✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄" \
4355 check content
:011 0 "${MBOX}" '3029301775 659'
4359 echo |
${MAILX} ${ARGS} \
4360 -s "1-1 B2 B3 B4 B5 B6 B\
4361 1-2 B2 B3 B4 B5 B6 B\
4362 1-3 B2 B3 B4 B5 B6 B\
4363 1-4 B2 B3 B4 B5 B6 B\
4364 1-5 B2 B3 B4 B5 B6 B\
4365 1-6 B2 B3 B4 B5 B6 " \
4367 check content
:012 0 "${MBOX}" '4126167195 297'
4369 # Leading and trailing WS
4371 echo |
${MAILX} ${ARGS} \
4372 -s " 2-1 B2 B3 B4 B5 B6 B\
4373 1-2 B2 B3 B4 B5 B6 B\
4374 1-3 B2 B3 B4 B5 B6 B\
4375 1-4 B2 B3 B4 B5 B6 " \
4377 check content
:013 0 "${MBOX}" '3600624479 236'
4379 # Quick'n dirty RFC 2231 test; i had more when implementing it, but until we
4380 # have a (better) test framework materialize a quick shot
4382 TRAP_EXIT_ADDONS
=.
/.ttt
4384 mkdir .
/.ttt ||
exit 1
4388 : > 'diet\ is \curd.txt'
4389 : > 'diet "is" curd.txt'
4391 : > 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
4392 : > höde__tröge__müde__dätte__hätte__vuelle__guelle__aese__aesse__sauerliche__kräuter__österliche__grüße__mäh.txt
4393 : > hööööööööööööööööö_nöööööööööööööööööööööö_düüüüüüüüüüüüüüüüüüü_bäääääääääääääääääääääääh.txt
4394 : > ✆✆✆✆✆✆✆✆✆✆✆✆✆✆✆✆✆✆✆✆✆✆✆✆.txt
4396 echo bla |
${MAILX} ${ARGS} ${ADDARG_UNI} \
4397 -a "./.ttt/ma'ger.txt" -a "./.ttt/mä'ger.txt" \
4398 -a './.ttt/diet\ is \curd.txt' -a './.ttt/diet "is" curd.txt' \
4399 -a .
/.ttt
/höde-tröge.txt \
4400 -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 \
4401 -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 \
4402 -a .
/.ttt
/hööööööööööööööööö_nöööööööööööööööööööööö_düüüüüüüüüüüüüüüüüüü_bäääääääääääääääääääääääh.txt \
4403 -a .
/.ttt
/✆✆✆✆✆✆✆✆✆✆✆✆✆✆✆✆✆✆✆✆✆✆✆✆.txt \
4405 check content
:014-1 0 "${MBOX}" '684985954 3092'
4407 # `resend' test, reusing $MBOX
4409 printf "Resend ${BODY}\nx\n" | ${MAILX} ${ARGS} -Rf "${MBOX}"
4410 check content
:014-2 0 "${BODY}" '684985954 3092'
4413 printf "resend ${BODY}\nx\n" | ${MAILX} ${ARGS} -Rf "${MBOX}"
4414 check content
:014-3 0 "${BODY}" '3130352658 3148'
4420 # if have_feat devel; then
4421 # ARGS="${ARGS} -Smemdebug"
4425 if [ -n "${UTF8_LOCALE}" ]; then
4426 printf 'Using Unicode locale %s\n' "${UTF8_LOCALE}"
4428 printf 'No Unicode locale found, disabling Unicode tests\n'
4435 if [ -z "${CHECK_ONLY}${MAE_TEST}" ]; then
4437 elif [ -z "${MAE_TEST}" ] ||
[ ${#} -eq 0 ]; then
4440 while [ ${#} -gt 0 ]; do
4446 [ ${ESTAT} -eq 0 ] && echo Ok ||
echo >&2 'Errors occurred'