2 #@ Usage: ./cc-test.sh [--check-only s-mailx-binary]
3 #@ TODO _All_ the tests should happen in a temporary subdir.
6 # We need *stealthmua* regardless of $SOURCE_DATE_EPOCH, the program name as
7 # such is a compile-time variable
8 ARGS
='-:/ -# -Sdotlock-ignore-error -Sencoding=quoted-printable -Sstealthmua'
9 ARGS
="${ARGS}"' -Snosave -Sexpandaddr=restrict'
10 ADDARG_UNI
=-Sttycharset=UTF-8
15 #UTF8_LOCALE= autodetected unless set
18 #MEMTESTER='valgrind --leak-check=full --log-file=.vl-%p '
20 if ( command -v command ) >/dev
/null
2>&1; then :; else
27 MAKE
="${MAKE:-`command -v make`}"
28 awk=${awk:-`command -v awk`}
29 cat=${cat:-`command -v cat`}
30 cksum=${cksum:-`command -v cksum`}
31 rm=${rm:-`command -v rm`}
32 sed=${sed:-`command -v sed`}
33 grep=${grep:-`command -v grep`}
35 # Problem: force $SHELL to be a real shell. It seems some testing environments
36 # use nologin(?), but we need a real shell for command execution
37 if { echo ${SHELL} | ${grep} nologin; } >/dev
/null
2>&1; then
38 echo >&2 '$SHELL seems to be nologin, overwriting to /bin/sh!'
43 # We sometimes "fake" sendmail(1) a.k.a. *mta* with a shell wrapper, and it
44 # happens that /bin/sh is often terribly slow
45 if command -v dash
>/dev
/null
2>&1; then
46 MYSHELL
="`command -v dash`"
47 elif command -v mksh
>/dev
/null
2>&1; then
48 MYSHELL
="`command -v mksh`"
55 export ARGS ADDARG_UNI CONF BODY MBOX MAIL MAKE
awk cat cksum rm sed grep
59 # Wed Oct 2 01:50:07 UTC 1996
60 SOURCE_DATE_EPOCH
=844221007
62 export LC_ALL LANG TZ SOURCE_DATE_EPOCH
66 echo >&2 "Usage: ./cc-test.sh [--check-only s-mailx-binary]"
71 if [ "${1}" = --check-only ]; then
74 [ -x "${MAILX}" ] || usage
77 MAILX
="${MEMTESTER}${MAILX}"
80 if [ -n "${CHECK_ONLY}" ] && [ -z "${UTF8_LOCALE}" ]; then
81 # Try ourselfs for nl_langinfo(CODESET) output first (requires a new version)
82 i
=`LC_ALL=C.utf8 "${RAWMAILX}" ${ARGS} -X '
84 \if [ "${ttycharset}" @i=% utf ]
91 \eval xcall cset_test "${@}"
95 \call cset_test C.UTF-8 POSIX.utf8 POSIX.UTF-8 en_EN.utf8 en_EN.UTF-8 \
96 en_US.utf8 en_US.UTF-8
98 [ $?
-eq 0 ] && UTF8_LOCALE
=$i
100 if [ -z "${UTF8_LOCALE}" ] && command -v locale
>/dev
/null
2>&1; then
101 UTF8_LOCALE
=`locale -a | { m=
103 if { echo ${n} | ${grep} -i 'utf-\{0,1\}8'; } >/dev/null 2>&1; then
105 if { echo ${n} | ${grep} -e POSIX -e en_EN -e en_US; }; then
119 trap "${rm} -rf \"${BODY}\" \"${MBOX}\" \${TRAP_EXIT_ADDONS}" EXIT
120 trap "exit 1" HUP INT TERM
123 # Test all configs TODO doesn't cover all *combinations*, stupid!
127 NOTME["OPT_AUTOCC"] = 1
128 NOTME["OPT_DEBUG"] = 1
129 NOTME["OPT_DEVEL"] = 1
130 NOTME["OPT_NOEXTMD5"] = 1
131 NOTME["OPT_ASAN_ADDRESS"] = 1
132 NOTME["OPT_ASAN_MEMORY"] = 1
133 NOTME["OPT_FORCED_STACKPROT"] = 1
134 NOTME["OPT_NOMEMDBG"] = 1
135 NOTME["OPT_NYD2"] = 1
138 /^[[:space:]]*OPT_/ {
139 sub(/^[[:space:]]*/, "")
140 # This bails for UnixWare 7.1.4 awk(1), but preceeding = with \
141 # does not seem to be a compliant escape for =
143 $1 = substr($1, 1, index($1, "=") - 1)
149 # Doing this completely sequentially and not doing make distclean in
150 # between runs should effectively result in lesser compilations.
151 # It is completely dumb nonetheless... TODO
152 for (j = 1; j < i; ++j) {
153 for (k = 1; k < j; ++k)
155 for (k = j; k < i; ++k)
157 printf "OPT_AUTOCC=1\n"
159 for (j = 1; j < i; ++j) {
160 for (k = 1; k < j; ++k)
162 for (k = j; k < i; ++k)
164 printf "OPT_AUTOCC=1\n"
167 for (j = 1; j < i; ++j) {
168 for (k = 1; k < j; ++k)
170 for (k = j; k < i; ++k)
172 printf "OPT_AUTOCC=1\n"
173 printf "OPT_DEBUG=1\n"
175 for (j = 1; j < i; ++j) {
176 for (k = 1; k < j; ++k)
178 for (k = j; k < i; ++k)
180 printf "OPT_AUTOCC=1\n"
181 printf "OPT_DEBUG=1\n"
184 printf "CONFIG=NULL OPT_AUTOCC=0\n"
185 printf "CONFIG=NULL OPT_AUTOCC=1\n"
186 printf "CONFIG=NULLI OPT_AUTOCC=0\n"
187 printf "CONFIG=NULLI OPT_AUTOCC=1\n"
188 printf "CONFIG=MINIMAL OPT_AUTOCC=0\n"
189 printf "CONFIG=MINIMAL OPT_AUTOCC=1\n"
190 printf "CONFIG=MEDIUM OPT_AUTOCC=0\n"
191 printf "CONFIG=MEDIUM OPT_AUTOCC=1\n"
192 printf "CONFIG=NETSEND OPT_AUTOCC=0\n"
193 printf "CONFIG=NETSEND OPT_AUTOCC=1\n"
194 printf "CONFIG=MAXIMAL OPT_AUTOCC=0\n"
195 printf "CONFIG=MAXIMAL OPT_AUTOCC=1\n"
196 printf "CONFIG=DEVEL OPT_AUTOCC=0\n"
197 printf "CONFIG=DEVEL OPT_AUTOCC=1\n"
198 printf "CONFIG=ODEVEL OPT_AUTOCC=0\n"
199 printf "CONFIG=ODEVEL OPT_AUTOCC=1\n"
202 printf "\n\n##########\n$c\n"
203 printf "\n\n##########\n$c\n" >&2
204 sh
-c "${MAKE} ${c} all test"
210 ( "${RAWMAILX}" ${ARGS} -X'echo $features' -Xx |
211 ${grep} +${1} ) >/dev
/null
2>&1
215 ${rm} -rf "${BODY}" "${MBOX}" ${TRAP_EXIT_ADDONS}
223 restat
=${?} tid=${1} eestat=${2} f=${3} s=${4}
224 #x=`echo ${tid} | tr "/:=" "__-"`
225 #cp -f "${f}" "${TMPDIR}/${x}"
226 [ "${eestat}" != - ] && [ "${restat}" != "${eestat}" ] &&
227 err
"${tid}" 'unexpected exit status: '"${restat} != ${eestat}"
228 csum
="`${cksum} < ${f}`"
229 if [ "${csum}" = "${s}" ]; then
230 printf '%s: ok\n' "${tid}"
233 printf '%s: error: checksum mismatch (got %s)\n' "${tid}" "${csum}"
239 printf '%s: error: %s\n' ${1} "${2}"
243 [ $?
-ne 0 ] && err
$1 'unexpected non-0 exit status'
247 [ $?
-eq 0 ] && err
$1 'unexpected 0 exit status'
250 if ( [ "$((1 + 1))" = 2 ] ) >/dev
/null
2>&1; then
252 echo "$((${1} + ${2}))"
254 elif command -v expr >/dev
/null
2>&1; then
256 echo `expr ${1} + ${2}`
260 echo `${awk} 'BEGIN{print '${1}' + '${2}'}'`
264 if ( [ "$((2 % 3))" = 2 ] ) >/dev
/null
2>&1; then
266 echo "$((${1} % ${2}))"
268 elif command -v expr >/dev
/null
2>&1; then
270 echo `expr ${1} % ${2}`
274 echo `${awk} 'BEGIN{print '${1}' % '${2}'}'`
279 # Basic (easily testable) behaviour tests
281 t_behave_X_opt_input_command_stack
284 t_behave_input_inject_semicolon_seq
285 t_behave_commandalias
288 t_behave_macro_param_shift
300 # FIXME t_behave_mlist
303 t_behave_record_a_resend
306 t_behave_compose_hooks
307 t_behave_message_injections
308 t_behave_mime_types_load_control
313 t_behave_mass_recipients
316 t_behave_X_opt_input_command_stack
() {
319 ${cat} <<- '__EOT' > "${BODY}"
327 echo "define mac1 {";\
328 echo " echo mac1-1 via1 \$0";\
330 echo " echo mac1-2";\
332 echo " echo mac1-3";\
335 echo "define mac2 {";\
336 echo " echo mac2-1 via1 \$0";\
338 echo " echo mac2-2";\
344 echo echo 1-1-1 via1 \$0;\
356 # The -X option supports multiline arguments, and those can internally use
357 # reverse solidus newline escaping. And all -X options are joined...
359 < "${BODY}" ${MAILX} ${ARGS} \
374 echo "define mac1 {";\
375 echo " echo mac1-1 via2 \$0";\
377 echo " echo mac1-2";\
379 echo " echo mac1-3";\
382 echo "define mac2 {";\
383 echo " echo mac2-1 via2 \$0";\
385 echo " echo mac2-2";\
391 echo echo 1-1-1 via2 \$0;\
405 check behave:x_opt_input_command_stack 0 "${MBOX}" '1786542668 416'
410 t_behave_X_errexit() {
413 ${cat} <<- '__EOT' > "${BODY}"
419 </dev/null ${MAILX} ${ARGS} -Snomemdebug \
420 -X'echo one' -X' echos nono ' -X'echo two' \
422 check behave:x_errexit-1 0 "${MBOX}" '916157812 53'
424 </dev/null ${MAILX} ${ARGS} -X'source '"${BODY}" -Snomemdebug \
426 check behave:x_errexit-2 0 "${MBOX}" '916157812 53'
428 </dev/null MAILRC="${BODY}" ${MAILX} ${ARGS} -:u
-Snomemdebug \
430 check behave
:x_errexit-3
0 "${MBOX}" '916157812 53'
434 </dev
/null
${MAILX} ${ARGS} -Serrexit -Snomemdebug \
435 -X'echo one' -X' echos nono ' -X'echo two' \
437 check behave
:x_errexit-4
1 "${MBOX}" '2118430867 49'
439 </dev
/null
${MAILX} ${ARGS} -X'source '"${BODY}" -Serrexit -Snomemdebug \
441 check behave:x_errexit-5 1 "${MBOX}" '2118430867 49'
443 </dev/null MAILRC="${BODY}" ${MAILX} ${ARGS} -:u
-Serrexit -Snomemdebug \
445 check behave
:x_errexit-6
1 "${MBOX}" '12955965 172'
447 </dev
/null MAILRC
="${BODY}" ${MAILX} ${ARGS} -:u -Sposix -Snomemdebug \
449 check behave:x_errexit-7 1 "${MBOX}" '12955965 172'
451 ## Repeat 4-7 with ignerr set
453 ${sed} -e 's/^echos /ignerr echos /' < "${BODY}" > "${MBOX}"
455 </dev
/null
${MAILX} ${ARGS} -Serrexit -Snomemdebug \
456 -X'echo one' -X'ignerr echos nono ' -X'echo two' \
458 check behave
:x_errexit-8
0 "${BODY}" '916157812 53'
460 </dev
/null
${MAILX} ${ARGS} -X'source '"${MBOX}" -Serrexit -Snomemdebug \
462 check behave:x_errexit-9 0 "${BODY}" '916157812 53'
464 </dev/null MAILRC="${MBOX}" ${MAILX} ${ARGS} -:u
-Serrexit -Snomemdebug \
466 check behave
:x_errexit-10
0 "${BODY}" '916157812 53'
468 </dev
/null MAILRC
="${MBOX}" ${MAILX} ${ARGS} -:u -Sposix -Snomemdebug \
470 check behave:x_errexit-11 0 "${BODY}" '916157812 53'
478 ${cat} <<- '__EOT' > "${BODY}"
497 echo 'a${DIET}b${TIED}c\${DIET}d\${TIED}e' # COMMENT
498 echo "a${DIET}b${TIED}c\${DIET}d\${TIED}e"
499 echo $
'a${DIET}b${TIED}c\${DIET}d\${TIED}e'
501 echo a$
'\101\0101\x41\u0041\u41\U00000041\U41'c
502 echo a$
'\u0041\u41\u0C1\U00000041\U41'c
525 echo a$
'b\U0000000'dt
526 echo a$
'b\U00000000'du
536 if [ -z "${UTF8_LOCALE}" ]; then
537 echo 'Skip behave:wysh_unicode, no UTF8_LOCALE'
539 < "${BODY}" DIET
=CURD TIED
= \
540 LC_ALL
=${UTF8_LOCALE} ${MAILX} ${ARGS} 2>/dev/null > "${MBOX}"
541 check behave:wysh_unicode 0 "${MBOX}" '475805847 317'
544 < "${BODY}" DIET=CURD TIED= ${MAILX} ${ARGS} > "${MBOX}" 2>/dev/null
545 check behave:wysh_c 0 "${MBOX}" '1473887148 321'
550 t_behave_input_inject_semicolon_seq() {
553 ${cat} <<- '__EOT' | ${MAILX} ${ARGS} > "${MBOX}"
558 echon this_is_mymac
;call mydeepmac
;echon
';';
560 echon one
';';call mymac
;echon two
";";call mymac
;echo three$
';';
562 echon this_is_mymac
;call mydeepmac
;echon
,TOO
'!;';
564 echon one
';';call mymac
;echon two
";";call mymac
;echo three$
';';
567 check behave
:input_inject_semicolon_seq
0 "${MBOX}" '512117110 140'
572 t_behave_commandalias
() {
575 ${cat} <<- '__EOT' | ${MAILX} ${ARGS} > "${MBOX}"
576 commandalias echo echo hoho
580 commandalias XxX XxXx
581 commandalias XxXx XxXxX
582 commandalias XxXxX XxXxXx
583 commandalias XxXxXx echo huhu
584 commandalias XxXxXxX echo huhu
586 commandalias XxXxXx XxXxXxX
589 commandalias XxXxXx echo huhu
593 check behave:commandalias 0 "${MBOX}" '3694143612 31'
601 # Nestable conditions test
602 ${cat} <<- '__EOT' | ${MAILX} ${ARGS} > "${MBOX}"
624 if $dietcurd == 'yoho'
629 if $dietcurd @
== 'Yoho'
634 if $dietcurd == 'Yoho'
639 if $dietcurd != 'yoho'
644 if $dietcurd @
!= 'Yoho'
649 if $dietcurd != 'Yoho'
710 if $dietcurd == 'yohu'
712 elif $dietcurd == 'yoha'
714 elif $dietcurd == 'yohe'
716 elif $dietcurd == 'yoho'
718 if $dietcurd == 'yohu'
720 elif $dietcurd == 'yoha'
722 elif $dietcurd == 'yohe'
724 elif $dietcurd == 'yoho'
726 if $dietcurd == 'yohu'
728 elif $dietcurd == 'yoha'
730 elif $dietcurd == 'yohe'
732 elif $dietcurd == 'yoho'
881 set diet
=abc curd
=abc
887 set diet
=abc curd
=abcd
893 # 1. Shitty grouping capabilities as of today
894 unset diet curd ndefined
895 if [ [ false
] ||
[ false
] ||
[ true
] ] && [ [ false
] ||
[ true
] ] && \
901 if [ [ [ [ 0 ] ||
[ 1 ] ] && [ [ 1 ] ||
[ 0 ] ] ] && [ 1 ] ] && [ yes ]
906 if [ [ 1 ] ||
[ 0 ] ||
[ 0 ] ||
[ 0 ] ]
911 if [ [ 1 ] ||
[ 0 ] ||
[ 0 ] ||
[ 0 ] ||
[ [ 1 ] ] ]
916 if [ [ 1 ] ||
[ 0 ] ||
[ 0 ] ||
[ 0 ] ||
[ [ 1 ] ] ||
[ 1 ] ] && [ no
]
921 if [ [ 1 ] ||
[ 0 ] ||
[ 0 ] ||
[ 0 ] ||
[ [ 1 ] ] ||
[ 1 ] ] \
927 if [ [ [ [ [ [ [ 1 ] ] && [ 1 ] ] && [ 1 ] ] && [ 1 ] ] ] && [ 1 ] ]
932 if [ [ [ [ [ [ [ 1 ] ] && [ 1 ] ] && [ 1 ] ] && [ 1 ] ] ] && [ 0 ] ]
937 if [ [ [ [ [ [ [ 1 ] ] && [ 1 ] ] && [ 0 ] ] && [ 1 ] ] ] && [ 1 ] ]
942 if [ [ [ [ [ [ [ 0 ] ] && [ 1 ] ] && [ 1 ] ] && [ 1 ] ] ] && [ 1 ] ]
947 if [ 1 ] ||
[ 0 ] ||
[ 0 ] ||
[ 0 ] && [ 0 ]
952 if [ 1 ] ||
[ 0 ] ||
[ 0 ] ||
[ 0 ] && [ 1 ]
957 if [ 0 ] ||
[ 0 ] ||
[ 0 ] ||
[ 1 ] && [ 0 ]
962 if [ 0 ] ||
[ 0 ] ||
[ 0 ] ||
[ 1 ] && [ 1 ]
967 if [ 0 ] ||
[ 0 ] ||
[ 0 ] ||
[ 1 ] && [ 0 ] ||
[ 1 ] && [ 0 ]
972 if [ 0 ] ||
[ 0 ] ||
[ 0 ] ||
[ 1 ] && [ 0 ] ||
[ 1 ] && [ 1 ]
978 if [ [ $diet == 'yo' ] && [ $curd == 'ho' ] ] && [ $ndefined ]
984 if [ [ $diet == 'yo' ] && [ $curd == 'ho' ] ] && [ $ndefined ]
989 # 2. Shitty grouping capabilities as of today
990 unset diet curd ndefined
991 if [ false || false || true
] && [ false || true
] && yes
996 if [ [ [ 0 ||
1 ] && [ 1 ||
0 ] ] && 1 ] && [ yes ]
1001 if [ 1 ||
0 ||
0 ||
0 ]
1006 if [ 1 ||
0 ||
0 ||
0 ||
[ 1 ] ]
1011 if [ 1 ||
0 ||
0 ||
0 ||
[ 1 ] ||
1 ] && no
1016 if [ 1 ||
0 ||
0 ||
0 ||
1 ||
[ 1 ] ] && no ||
[ yes ]
1021 if [ [ [ [ [ [ 1 ] && 1 ] && 1 ] && 1 ] ] && [ 1 ] ]
1026 if [ [ [ [ [ [ 1 ] && 1 ] && 1 ] && [ 1 ] ] ] && 0 ]
1031 if [ [ [ [ [ [ [ 1 ] ] && 1 ] && 0 ] && [ 1 ] ] ] && 1 ]
1036 if [ [ [ [ [ [ 0 ] && 1 ] && 1 ] && 1 ] ] && 1 ]
1041 if 1 ||
0 ||
0 ||
0 && 0
1046 if 1 ||
0 ||
0 ||
0 && 1
1051 if 0 ||
0 ||
0 ||
1 && 0
1056 if 0 ||
0 ||
0 ||
1 && 1
1061 if 0 ||
0 ||
0 ||
1 && 0 ||
1 && 0
1066 if 0 ||
0 ||
0 ||
1 && 0 ||
1 && 1
1072 if [ $diet == 'yo' && $curd == 'ho' ] && $ndefined
1077 if $diet == 'yo' && $curd == 'ho' && $ndefined
1083 if [ $diet == 'yo' && $curd == 'ho' ] && $ndefined
1088 if $diet == 'yo' && $curd == 'ho' && $ndefined
1093 if [ [ [ [ [ [ $diet == 'yo' && $curd == 'ho' && $ndefined ] ] ] ] ] ]
1098 # Some more en-braced variables
1100 if ${diet} == ${curd}
1105 if ${diet} != ${curd}
1121 if ! 0 && ! ! 1 && ! ! ! ! 2 && 3
1126 if ! 0 && ! [ ! 1 ] && ! [ ! [ ! [ ! 2 ] ] ] && 3
1131 if [ ! 0 ] && [ ! [ ! 1 ] ] && [ ! [ ! [ ! [ ! [ 2 ] ] ] ] ] && 3
1136 if [ ! 0 ] && [ ! [ ! 1 ] ] && [ ! [ ! [ ! [ ! [ 2 ] ] ] ] ] && ! 3
1141 if [ ! 0 ] && [ ! [ ! 1 ] ] && ! [ [ ! [ ! [ ! [ 2 ] ] ] ] ] && ! 3
1146 if [ ! 0 ] && ! [ ! [ ! 1 ] ] && [ ! [ ! [ ! [ ! [ 2 ] ] ] ] ] && 3
1151 if ! [ ! 0 ] && [ ! [ ! 1 ] ] && [ ! [ ! [ ! [ ! [ 2 ] ] ] ] ] && 3
1156 if [ ! 0 ] && [ ! [ ! 1 ] ] && [ ! [ ! [ ! [ ! [ 2 ] ] ] ] ] ||
3
1161 if [ ! 0 ] && [ ! ! [ ! ! 1 ] ] && [ ! ! [ ! ! [ ! ! [ ! ! [ 2 ] ] ] ] ]
1167 if ! 0 && ! ! 1 && ! ! ! 0 && 3
1172 if ! 0 && ! [ ! 1 ] && ! [ ! [ ! [ 0 ] ] ] && 3
1177 if [ ! 0 ] && [ ! [ ! 1 ] ] && [ ! [ ! [ ! [ [ 0 ] ] ] ] ] && 3
1182 if [ ! 0 ] && [ ! [ ! 1 ] ] && [ ! [ ! ! [ ! [ ! 0 ] ] ] ] && ! 3
1187 if [ ! 0 ] && [ ! [ ! 1 ] ] && ! [ ! [ ! [ ! [ ! 0 ] ] ] ] && 3
1192 if [ ! 0 ] && ! [ ! [ ! 1 ] ] && [ ! ! [ ! [ ! [ ! [ 0 ] ] ] ] ] && 3
1197 if ! [ ! 0 ] && [ ! [ ! 1 ] ] && [ ! [ ! [ ! [ ! ! 0 ] ] ] ] && 3
1202 if [ ! 0 ] && [ ! [ ! 1 ] ] && [ ! [ ! [ ! [ ! [ ! 0 ] ] ] ] ] ||
3
1207 if [ ! 0 ] && [ ! ! [ ! ! 1 ] ] && [ ! ! [ ! ! [ ! ! [ ! [ 0 ] ] ] ] ]
1214 check behave
:if-normal
0 "${MBOX}" '1688759742 719'
1216 if have_feat regex
; then
1217 ${cat} <<- '__EOT' | ${MAILX} ${ARGS} > "${MBOX}"
1219 if $dietcurd =~ '^yo.*'
1224 if $dietcurd =~ '^Yo.*'
1229 if $dietcurd @=~ '^Yo.*'
1234 if $dietcurd =~ '^yOho.+'
1239 if $dietcurd @!~ '.*Ho$'
1244 if $dietcurd !~ '.+yohO$'
1249 if [ $dietcurd @i!~ '.+yoho$' ]
1254 if ! [ $dietcurd @i=~ '.+yoho$' ]
1259 if ! ! [ $dietcurd @i!~ '.+yoho$' ]
1264 if ! [ ! [ $dietcurd @i!~ '.+yoho$' ] ]
1269 if [ ! [ ! [ $dietcurd @i!~ '.+yoho$' ] ] ]
1274 if ! [ ! [ ! [ $dietcurd !~ '.+yoho$' ] ] ]
1279 if ! ! ! $dietcurd !~ '.+yoho$'
1284 if ! ! ! $dietcurd =~ '.+yoho$'
1289 if ! [ ! ! [ ! [ $dietcurd !~ '.+yoho$' ] ] ]
1294 set diet=abc curd='^abc$'
1300 set diet=abc curd='^abcd$'
1308 check behave:if-regex 0 "${MBOX}" '1115671789 95'
1310 printf 'behave:if-regex: unsupported, skipped\n'
1316 t_behave_localopts() {
1319 # Nestable conditions test
1320 ${cat} <<- '__EOT' | ${MAILX} ${ARGS} > "${MBOX}" 2>&1
1335 echo $gv1 $lv1 ${lv2} ${lv3} ${gv2}, $t2
1340 echo $gv1 $lv1 ${lv2} ${lv3} ${gv2}, $t2
1341 echo "$gv1 $lv1 ${lv2} ${lv3} ${gv2}, $t2"
1350 echo active trouble
: $gv1 $lv1 ${lv2} ${lv3} ${gv2}, $t3
1352 echo active null
: $gv1 $lv1 ${lv2} ${lv3} ${gv2}, $t3
1361 wysh
set y
=$1; shift; eval localopts
$y; localopts
$1; shift
1368 wysh
set y
=$1; shift; eval localopts
$y; localopts
$1; shift
1375 echo ----- $1: $2 -> $3 -> $4
1383 call llx
'call off' on on on
1384 call llx
'call off' off on on
1385 call llx
'call off' on off on
1386 call llx
'call off' on off off
1387 localopts call-fixate on
1388 call llx
'call-fixate on' on on on
1389 call llx
'call-fixate on' off on on
1390 call llx
'call-fixate on' on off on
1391 call llx
'call-fixate on' on off off
1392 unset x
;localopts call on
1393 call llx
'call on' on on on
1394 call llx
'call on' off on on
1395 call llx
'call on' on off on
1396 call llx
'call on' on off off
1401 check behave
:localopts
0 "${MBOX}" '4016155249 1246'
1406 t_behave_macro_param_shift
() {
1409 ${cat} <<- '__EOT' | ${MAILX} ${ARGS} > "${MBOX}" 2>/dev/null
1412 echo t2.0 has $#/${#} parameters: "$1,${2},$3" (${*}) [$@]
1417 echo t2.1 has $#/${#} parameters: "$1,${2},$3" (${*}) [$@]
1418 if [ $# > 1 ] || [ $ignerr == '' ]
1423 echo t2.2:$? has $#/${#} parameters: "$1,${2},$3" (${*}) [$@]
1425 echo t2.3:$? has $#/${#} parameters: "$1,${2},$3" (${*}) [$@]
1429 echo t2.4:$? has $#/${#} parameters: "$1,${2},$3" (${*}) [$@]
1434 call t2 1 you get four args
1435 echo t1.1: $?';' ignerr ($ignerr) should not exist
1436 call t2 1 you get 'three args'
1437 echo t1.2: $?';' ignerr ($ignerr) should not exist
1438 call t2 1 you 'get two args'
1439 echo t1.3: $?';' ignerr ($ignerr) should not exist
1440 call t2 1 'you get one arg'
1441 echo t1.4: $?';' ignerr ($ignerr) should not exist
1442 ignerr call t2 '' 'you get one arg'
1443 echo t1.5: $?';' ignerr ($ignerr) should not exist
1448 check behave:macro_param_shift 0 "${MBOX}" '1402489146 1682'
1453 t_behave_addrcodec() {
1456 ${cat} <<- '__EOT' | ${MAILX} ${ARGS} > "${MBOX}"
1457 vput addrcodec res e
1 <doog@def
>
1458 echo $?
/$^ERRNAME
$res
1459 eval vput addrcodec res d
$res
1460 echo $?
/$^ERRNAME
$res
1461 vput addrcodec res e
2 .
<doog@def
>
1462 echo $?
/$^ERRNAME
$res
1463 eval vput addrcodec res d
$res
1464 echo $?
/$^ERRNAME
$res
1465 vput addrcodec res e
3 Sauer Dr.
<doog@def
>
1466 echo $?
/$^ERRNAME
$res
1467 eval vput addrcodec res d
$res
1468 echo $?
/$^ERRNAME
$res
1469 vput addrcodec res e
3.50 Sauer
(Ma
) Dr.
<doog@def
>
1470 echo $?
/$^ERRNAME
$res
1471 eval vput addrcodec res d
$res
1472 echo $?
/$^ERRNAME
$res
1473 vput addrcodec res e
3.51 Sauer
(Ma
) "Dr." <doog@def
>
1474 echo $?
/$^ERRNAME
$res
1475 eval vput addrcodec res d
$res
1476 echo $?
/$^ERRNAME
$res
1478 vput addrcodec res
+e
4 Sauer
(Ma
) Dr.
<doog@def
>
1479 echo $?
/$^ERRNAME
$res
1480 eval vput addrcodec res d
$res
1481 echo $?
/$^ERRNAME
$res
1482 vput addrcodec res
+e
5 Sauer
(Ma
) Braten Dr.
<doog@def
>
1483 echo $?
/$^ERRNAME
$res
1484 eval vput addrcodec res d
$res
1485 echo $?
/$^ERRNAME
$res
1486 vput addrcodec res
+e
6 Sauer
(Ma
) Braten Dr.
(Heu
) <doog@def
>
1487 echo $?
/$^ERRNAME
$res
1488 eval vput addrcodec res d
$res
1489 echo $?
/$^ERRNAME
$res
1490 vput addrcodec res
+e
7 Sauer
(Ma
) Braten Dr.
(Heu
) <doog@def
> (bu
)
1491 echo $?
/$^ERRNAME
$res
1492 eval vput addrcodec res d
$res
1493 echo $?
/$^ERRNAME
$res
1494 vput addrcodec res
+e
8 \
1495 Dr. Sauer
(Ma
) Braten Dr.
(Heu
) <doog@def
> (bu
) Boom. Boom
1496 echo $?
/$^ERRNAME
$res
1497 eval vput addrcodec res d
$res
1498 echo $?
/$^ERRNAME
$res
1499 vput addrcodec res
+e
9 Dr.Sauer
(Ma
)Braten Dr.
(Heu
) <doog@def
>
1500 echo $?
/$^ERRNAME
$res
1501 eval vput addrcodec res d
$res
1502 echo $?
/$^ERRNAME
$res
1503 vput addrcodec res
+e
10 (Ma
)Braten Dr.
(Heu
) <doog@def
>
1504 echo $?
/$^ERRNAME
$res
1505 eval vput addrcodec res d
$res
1506 echo $?
/$^ERRNAME
$res
1507 vput addrcodec res
+e
11 (Ma
)Braten Dr
"." (Heu
) <doog@def
>
1508 echo $?
/$^ERRNAME
$res
1509 eval vput addrcodec res d
$res
1510 echo $?
/$^ERRNAME
$res
1511 vput addrcodec res
+e
12 Dr. Sauer
(Ma
) Braten Dr.
(u
) <doog@def
>
1512 echo $?
/$^ERRNAME
$res
1513 eval vput addrcodec res d
$res
1514 echo $?
/$^ERRNAME
$res
1515 vput addrcodec res
+e
13(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
14 Hey
, Du
<doog@def
> Wie
() findet Dr. das?
()
1520 echo $?
/$^ERRNAME
$res
1521 eval vput addrcodec res d
$res
1522 echo $?
/$^ERRNAME
$res
1523 vput addrcodec res
+e
15 \
1524 Hey
, Du
<doog@def
> Wie
() findet
"" Dr.
"" das?
()
1525 echo $?
/$^ERRNAME
$res
1526 eval vput addrcodec res d
$res
1527 echo $?
/$^ERRNAME
$res
1528 vput addrcodec res
+e
16 \
1529 "Hey," "Du" <doog@def
> "Wie()" findet
"" Dr.
"" das?
()
1530 echo $?
/$^ERRNAME
$res
1531 eval vput addrcodec res d
$res
1532 echo $?
/$^ERRNAME
$res
1533 vput addrcodec res
+e
17 \
1534 "Hey" Du
<doog@def
> "Wie() findet " " Dr. """ das?
()
1535 echo $?
/$^ERRNAME
$res
1536 eval vput addrcodec res d
$res
1537 echo $?
/$^ERRNAME
$res
1538 vput addrcodec res
+e
18 \
1539 <doog@def
> "Hey" Du
"Wie() findet " " Dr. """ das?
()
1540 echo $?
/$^ERRNAME
$res
1541 eval vput addrcodec res d
$res
1542 echo $?
/$^ERRNAME
$res
1543 vput addrcodec res
+e
19 Hey\
,\" <doog@def
> "Wie()" findet
\" Dr.
\" das?
1544 echo $?
/$^ERRNAME
$res
1545 eval vput addrcodec res d
$res
1546 echo $?
/$^ERRNAME
$res
1548 vput addrcodec res
++e
20 Hey\
,\" <doog@def
> "Wie()" findet
\" Dr.
\" das?
1549 echo $?
/$^ERRNAME
$res
1550 vput addrcodec res
++e
21 Hey\
,\"" <doog@def> "Wie
()" findet \" Dr. \" das?
1551 echo $?/$^ERRNAME $res
1552 eval vput addrcodec res d $res
1553 echo $?/$^ERRNAME $res
1555 vput addrcodec res +++e 22 Hey\\,\" <doog@def> "Wie
()" findet \" Dr. \" das?
1556 echo $?/$^ERRNAME $res
1557 eval vput addrcodec res d $res
1558 echo $?/$^ERRNAME $res
1560 vput addrcodec res s \
1561 "23 Hey
\\,\\\" \"Wie
" () "\" findet
\\\" Dr.
\\\" das?
" <doog@def>
1562 echo $?/$^ERRNAME $res
1565 check behave:addrcodec 0 "${MBOX}" '429099645 2414'
1573 ${cat} <<- '__EOT' | ${MAILX} ${ARGS} > "${MBOX}" 2>/dev
/null
1574 vput vexpr res
= 9223372036854775807
1575 echo $?
/$^ERRNAME
$res
1576 vput vexpr res
= 9223372036854775808
1577 echo $?
/$^ERRNAME
$res
1578 vput vexpr res
=@
9223372036854775808
1579 echo $?
/$^ERRNAME
$res
1580 vput vexpr res
= -9223372036854775808
1581 echo $?
/$^ERRNAME
$res
1582 vput vexpr res
= -9223372036854775809
1583 echo $?
/$^ERRNAME
$res
1584 vput vexpr res
=@
-9223372036854775809
1585 echo $?
/$^ERRNAME
$res
1588 echo $?
/$^ERRNAME
$res
1590 echo $?
/$^ERRNAME
$res
1592 echo $?
/$^ERRNAME
$res
1594 vput vexpr res
+ 0 0
1595 echo $?
/$^ERRNAME
$res
1596 vput vexpr res
+ 0 1
1597 echo $?
/$^ERRNAME
$res
1598 vput vexpr res
+ 1 1
1599 echo $?
/$^ERRNAME
$res
1601 vput vexpr res
+ 9223372036854775807 0
1602 echo $?
/$^ERRNAME
$res
1603 vput vexpr res
+ 9223372036854775807 1
1604 echo $?
/$^ERRNAME
$res
1605 vput vexpr res
+@
9223372036854775807 1
1606 echo $?
/$^ERRNAME
$res
1607 vput vexpr res
+ 0 9223372036854775807
1608 echo $?
/$^ERRNAME
$res
1609 vput vexpr res
+ 1 9223372036854775807
1610 echo $?
/$^ERRNAME
$res
1611 vput vexpr res
+@
1 9223372036854775807
1612 echo $?
/$^ERRNAME
$res
1614 vput vexpr res
+ -9223372036854775808 0
1615 echo $?
/$^ERRNAME
$res
1616 vput vexpr res
+ -9223372036854775808 -1
1617 echo $?
/$^ERRNAME
$res
1618 vput vexpr res
+@
-9223372036854775808 -1
1619 echo $?
/$^ERRNAME
$res
1620 vput vexpr res
+ 0 -9223372036854775808
1621 echo $?
/$^ERRNAME
$res
1622 vput vexpr res
+ -1 -9223372036854775808
1623 echo $?
/$^ERRNAME
$res
1624 vput vexpr res
+@
-1 -9223372036854775808
1625 echo $?
/$^ERRNAME
$res
1627 vput vexpr res
- 0 0
1628 echo $?
/$^ERRNAME
$res
1629 vput vexpr res
- 0 1
1630 echo $?
/$^ERRNAME
$res
1631 vput vexpr res
- 1 1
1632 echo $?
/$^ERRNAME
$res
1634 vput vexpr res
- 9223372036854775807 0
1635 echo $?
/$^ERRNAME
$res
1636 vput vexpr res
- 9223372036854775807 -1
1637 echo $?
/$^ERRNAME
$res
1638 vput vexpr res
-@
9223372036854775807 -1
1639 echo $?
/$^ERRNAME
$res
1640 vput vexpr res
- 0 9223372036854775807
1641 echo $?
/$^ERRNAME
$res
1642 vput vexpr res
- -1 9223372036854775807
1643 echo $?
/$^ERRNAME
$res
1644 vput vexpr res
- -2 9223372036854775807
1645 echo $?
/$^ERRNAME
$res
1646 vput vexpr res
-@
-2 9223372036854775807
1647 echo $?
/$^ERRNAME
$res
1649 vput vexpr res
- -9223372036854775808 +0
1650 echo $?
/$^ERRNAME
$res
1651 vput vexpr res
- -9223372036854775808 +1
1652 echo $?
/$^ERRNAME
$res
1653 vput vexpr res
-@
-9223372036854775808 +1
1654 echo $?
/$^ERRNAME
$res
1655 vput vexpr res
- 0 -9223372036854775808
1656 echo $?
/$^ERRNAME
$res
1657 vput vexpr res
- +1 -9223372036854775808
1658 echo $?
/$^ERRNAME
$res
1659 vput vexpr res
-@
+1 -9223372036854775808
1660 echo $?
/$^ERRNAME
$res
1662 vput vexpr res
+ -13 -2
1663 echo $?
/$^ERRNAME
$res
1664 vput vexpr res
- 0 0
1665 echo $?
/$^ERRNAME
$res
1666 vput vexpr res
- 0 1
1667 echo $?
/$^ERRNAME
$res
1668 vput vexpr res
- 1 1
1669 echo $?
/$^ERRNAME
$res
1670 vput vexpr res
- -13 -2
1671 echo $?
/$^ERRNAME
$res
1673 vput vexpr res
* 0 0
1674 echo $?
/$^ERRNAME
$res
1675 vput vexpr res
* 0 1
1676 echo $?
/$^ERRNAME
$res
1677 vput vexpr res
* 1 1
1678 echo $?
/$^ERRNAME
$res
1679 vput vexpr res
* -13 -2
1680 echo $?
/$^ERRNAME
$res
1682 vput vexpr res
/ 0 0
1683 echo $?
/$^ERRNAME
$res
1684 vput vexpr res
/ 0 1
1685 echo $?
/$^ERRNAME
$res
1686 vput vexpr res
/ 1 1
1687 echo $?
/$^ERRNAME
$res
1688 vput vexpr res
/ -13 -2
1689 echo $?
/$^ERRNAME
$res
1691 vput vexpr res
% 0 0
1692 echo $?
/$^ERRNAME
$res
1693 vput vexpr res
% 0 1
1694 echo $?
/$^ERRNAME
$res
1695 vput vexpr res
% 1 1
1696 echo $?
/$^ERRNAME
$res
1697 vput vexpr res
% -13 -2
1698 echo $?
/$^ERRNAME
$res
1701 check behave
:vexpr-numeric
0 "${MBOX}" '1723609217 1048'
1703 ${cat} <<- '__EOT' | ${MAILX} ${ARGS} > "${MBOX}" #2>/dev/null
1704 vput vexpr res find 'bananarama' 'nana'
1705 echo $?/$^ERRNAME :$res:
1706 vput vexpr res find 'bananarama' 'bana'
1707 echo $?/$^ERRNAME :$res:
1708 vput vexpr res find 'bananarama' 'Bana'
1709 echo $?/$^ERRNAME :$res:
1710 vput vexpr res find 'bananarama' 'rama'
1711 echo $?/$^ERRNAME :$res:
1713 vput vexpr res ifind 'bananarama' 'nana'
1714 echo $?/$^ERRNAME :$res:
1715 vput vexpr res ifind 'bananarama' 'bana'
1716 echo $?/$^ERRNAME :$res:
1717 vput vexpr res ifind 'bananarama' 'Bana'
1718 echo $?/$^ERRNAME :$res:
1719 vput vexpr res ifind 'bananarama' 'rama'
1720 echo $?/$^ERRNAME :$res:
1722 vput vexpr res substring 'bananarama' 1
1723 echo $?/$^ERRNAME :$res:
1724 vput vexpr res substring 'bananarama' 3
1725 echo $?/$^ERRNAME :$res:
1726 vput vexpr res substring 'bananarama' 5
1727 echo $?/$^ERRNAME :$res:
1728 vput vexpr res substring 'bananarama' 7
1729 echo $?/$^ERRNAME :$res:
1730 vput vexpr res substring 'bananarama' 9
1731 echo $?/$^ERRNAME :$res:
1732 vput vexpr res substring 'bananarama' 10
1733 echo $?/$^ERRNAME :$res:
1734 vput vexpr res substring 'bananarama' 1 3
1735 echo $?/$^ERRNAME :$res:
1736 vput vexpr res substring 'bananarama' 3 3
1737 echo $?/$^ERRNAME :$res:
1738 vput vexpr res substring 'bananarama' 5 3
1739 echo $?/$^ERRNAME :$res:
1740 vput vexpr res substring 'bananarama' 7 3
1741 echo $?/$^ERRNAME :$res:
1742 vput vexpr res substring 'bananarama' 9 3
1743 echo $?/$^ERRNAME :$res:
1744 vput vexpr res substring 'bananarama' 10 3
1745 echo $?/$^ERRNAME :$res:
1749 check behave:vexpr-string 0 "${MBOX}" '265398700 267'
1751 if have_feat regex; then
1752 ${cat} <<- '__EOT' | ${MAILX} ${ARGS} > "${MBOX}" #2>/dev/null
1753 vput vexpr res regex
'bananarama' 'nana'
1754 echo $?
/$^ERRNAME
:$res:
1755 vput vexpr res regex
'bananarama' 'bana'
1756 echo $?
/$^ERRNAME
:$res:
1757 vput vexpr res regex
'bananarama' 'Bana'
1758 echo $?
/$^ERRNAME
:$res:
1759 vput vexpr res regex
'bananarama' 'rama'
1760 echo $?
/$^ERRNAME
:$res:
1762 vput vexpr res iregex
'bananarama' 'nana'
1763 echo $?
/$^ERRNAME
:$res:
1764 vput vexpr res iregex
'bananarama' 'bana'
1765 echo $?
/$^ERRNAME
:$res:
1766 vput vexpr res iregex
'bananarama' 'Bana'
1767 echo $?
/$^ERRNAME
:$res:
1768 vput vexpr res iregex
'bananarama' 'rama'
1769 echo $?
/$^ERRNAME
:$res:
1771 vput vexpr res regex
'bananarama' '(.*)nana(.*)' '\${1}a\${0}u{\$2}'
1772 echo $?
/$^ERRNAME
:$res:
1773 vput vexpr res regex
'bananarama' '(.*)bana(.*)' '\${1}a\${0}u\$2'
1774 echo $?
/$^ERRNAME
:$res:
1775 vput vexpr res regex
'bananarama' 'Bana(.+)' '\$1\$0'
1776 echo $?
/$^ERRNAME
:$res:
1777 vput vexpr res regex
'bananarama' '(.+)rama' '\$1\$0'
1778 echo $?
/$^ERRNAME
:$res:
1780 vput vexpr res iregex
'bananarama' '(.*)nana(.*)' '\${1}a\${0}u{\$2}'
1781 echo $?
/$^ERRNAME
:$res:
1782 vput vexpr res iregex
'bananarama' '(.*)bana(.*)' '\${1}a\${0}u\$2'
1783 echo $?
/$^ERRNAME
:$res:
1784 vput vexpr res iregex
'bananarama' 'Bana(.+)' '\$1\$0'
1785 echo $?
/$^ERRNAME
:$res:
1786 vput vexpr res iregex
'bananarama' '(.+)rama' '\$1\$0'
1787 echo $?
/$^ERRNAME
:$res:
1791 check behave
:vexpr-regex
0 "${MBOX}" '3270360157 311'
1793 printf 'behave:vexpr-regex: unsupported, skipped\n'
1799 t_behave_call_ret
() {
1802 ${cat} <<- '__EOT' | ${MAILX} ${ARGS} -Snomemdebug > "${MBOX}" 2>&1
1807 vput vexpr j '&' $i 7
1813 vput vexpr j '&' $i 7
1819 echo ! The end for $1
1823 # Transport $?/$! up the call chain
1829 wysh set i=$? j=$! k=$^ERRNAME
1833 echo ! The end for $1
1834 return $i $^ERR-BUSY
1838 # Up and down it goes
1845 vput vexpr k - $1 $2
1849 echo "# <$i/$j> .. "
1853 eval echon
"<\$1=\$i/\$^ERRNAME-$j "
1856 echo ! The end
for $1=$i/$2
1860 return $i $^ERR-BUSY
1866 call w1
0; echo ?
=$?
!=$
!; echo -----;
1867 call w2
0; echo ?
=$?
!=$^ERRNAME
; echo -----;
1868 call w3
0 1; echo ?
=$?
!=$^ERRNAME
; echo -----;
1871 check behave
:call_ret
0 "${MBOX}" '1572045517 5922'
1879 ${cat} <<- '__EOT' | ${MAILX} ${ARGS} -Snomemdebug > "${MBOX}" 2>&1
1884 vput vexpr j '&' $i 7
1890 echo ! The end for $1/$2
1892 return $i $^ERR-BUSY
1903 echo ?=$? !=$^ERRNAME
1906 echo ?=$? !=$^ERRNAME
1908 echo ?=$? !=$^ERRNAME
1911 check behave:xcall-1 0 "${MBOX}" '2401702082 23801'
1915 ${cat} <<- '__EOT' > "${BODY}"
1920 vput vexpr j '&' $i 7
1926 echo ! The end for $1
1929 echo would be err with errexit
1938 echo zwei, ?=$? !=$!
1939 localopts yes; set errexit
1941 echo drei, ?=$? !=$^ERRNAME
1943 echo vier, ?=$? !=$^ERRNAME, this is an error
1946 echo outer 1, ?=$? !=$^ERRNAME
1948 echo outer 2, ?=$? !=$^ERRNAME, could be error if xxxign non-empty
1950 echo outer 3, ?=$? !=$^ERRNAME
1951 echo this is definitely an error
1954 < "${BODY}" ${MAILX} ${ARGS} -X'commandalias xxxign ignerr' -Snomemdebug \
1956 check behave
:xcall-2
0 "${MBOX}" '3900716531 4200'
1958 < "${BODY}" ${MAILX} ${ARGS} -X'commandalias xxxign " "' -Snomemdebug \
1960 check behave:xcall-3 1 "${MBOX}" '1006776201 2799'
1965 t_behave_vpospar() {
1968 ${cat} <<- '__EOT' | ${MAILX} ${ARGS} > "${MBOX}" 2>&1
1969 vpospar
set hey
, "'you ", world
!
1970 echo $?
/$^ERRNAME
/$#: $
* / "$@" / <$1><$2><$3><$4>
1971 vput vpospar x quote
; echo x
<$x>
1972 vpospar
clear;echo $?
/$^ERRNAME
/$#: $
* / "$@" / <$1><$2><$3><$4>
1973 vput vpospar y quote
;echo y
<$y>
1974 eval vpospar
set ${x};echo $?
/$^ERRNAME
/$#: $
* / "$@" / <$1><$2><$3><$4>
1975 eval vpospar
set ${y};echo $?
/$^ERRNAME
/$#: $
* / "$@" / <$1><$2><$3><$4>
1976 eval vpospar
set ${x};echo $?
/$^ERRNAME
/$#: $
* / "$@" / <$1><$2><$3><$4>
1979 echo infun2
:$?
/$^ERRNAME
/$#:$
*/"$@"/<$1><$2><$3><$4>
1980 vput vpospar z quote
;echo infun2
:z
<$z>
1984 echo infun
:$?
/$^ERRNAME
/$#:$
*/"$@"/<$1><$2><$3><$4>
1985 vput vpospar y quote
;echo infun
:y
<$y>
1986 eval vpospar
set ${x};echo infun
:$?
/$^ERRNAME
/$#:$
*/"$@"/<$1><$2><$3><$4>
1987 vpospar
clear;echo infun
:$?
/$^ERRNAME
/$#:$
*/"$@"/<$1><$2><$3><$4>
1989 echo infun
:$?
/$^ERRNAME
/$#:$
*/"$@"/<$1><$2><$3><$4>
1990 eval vpospar
set ${y};echo infun
:$?
/$^ERRNAME
/$#:$
*/"$@"/<$1><$2><$3><$4>
1993 call infun This
"in a" fun
1994 echo $?
/$^ERRNAME
/$#: $
* / "$@" / <$1><$2><$3><$4>
1995 vpospar
clear;echo $?
/$^ERRNAME
/$#: $
* / "$@" / <$1><$2><$3><$4>
1997 check behave
:vpospar-1
0 "${MBOX}" '155175639 866'
2000 ${cat} <<- '__EOT' | ${MAILX} ${ARGS} > "${MBOX}" 2>&1
2002 echo ifs<$ifs> ifs-ws<$ifs-ws>
2003 vpospar set hey, "'you ", world!
2004 echo $?/$^ERRNAME/$#: $* / "$@" / <$1><$2><$3><$4>
2005 vput vpospar x quote; echo x<$x>
2006 vpospar clear;echo $?/$^ERRNAME/$#: $* / "$@" / <$1><$2><$3><$4>
2007 eval vpospar set ${x};echo $?/$^ERRNAME/$#: $* / "$@" / <$1><$2><$3><$4>
2010 echo ifs<$ifs> ifs-ws<$ifs-ws>
2011 vpospar set hey, "'you
", world!
2012 echo $?/$^ERRNAME/$#: $* / "$@
" / <$1><$2><$3><$4>
2013 vput vpospar x quote; echo x<$x>
2014 vpospar clear;echo $?/$^ERRNAME/$#: $* / "$@
" / <$1><$2><$3><$4>
2015 eval vpospar set ${x};echo $?/$^ERRNAME/$#: $* / "$@
" / <$1><$2><$3><$4>
2018 echo ifs<$ifs> ifs-ws<$ifs-ws>
2019 vpospar set hey, "'you ", world!
2020 echo $?/$^ERRNAME/$#: $* / "$@" / <$1><$2><$3><$4>
2021 vput vpospar x quote; echo x<$x>
2022 vpospar clear;echo $?/$^ERRNAME/$#: $* / "$@" / <$1><$2><$3><$4>
2023 eval vpospar set ${x};echo $?/$^ERRNAME/$#: $* / "$@" / <$1><$2><$3><$4>
2025 check behave:vpospar-ifs 0 "${MBOX}" '2015927702 706'
2030 t_behave_atxplode() {
2032 TRAP_EXIT_ADDONS="./.t*"
2034 ${cat} > ./.t.sh <<- '___
'; ${cat} > ./.t.rc <<- '___
'
2052 ${SHELL} ./.t.sh > "${MBOX}" 2>&1
2053 echo ----- >> "${MBOX}"
2054 ${MAILX} ${ARGS} -X'source ./.t.rc' -Xx >> "${MBOX}" 2>&1
2055 check behave:atxplode 0 "${MBOX}" '3471687974 22'
2062 TRAP_EXIT_ADDONS="./.t*"
2064 ${cat} <<- '__EOT
' > .tin
2065 hey1, "'you
", world!
2066 hey2, "'you ", bugs bunny!
2071 ${cat} <<- '__EOT
' |\
2072 ${MAILX} ${ARGS} -X'readctl create ./.tin' > "${MBOX}" 2>&1
2074 echo $?/$^ERRNAME / <$a><$b><$c>
2076 echo $?/$^ERRNAME / <$a><$b><$c>
2078 echo $?/$^ERRNAME / <$a><$b><$c>
2080 echo $?/$^ERRNAME / <$a><$b><$c>
2082 echo $?/$^ERRNAME / <$a><$b><$c>
2083 readctl remove ./.tin;echo readctl remove:$?/$^ERRNAME
2085 check behave:read-1 0 "${MBOX}" '1527910147 173'
2087 ${cat} <<- '__EOT
' > .tin2
2088 hey2.0,:"'you
",:world!:mars.:
2089 hey2.1,:"'you ",:world!
2090 hey2.2,:"'you
",:bugs bunny!
2096 ${cat} <<- '__EOT' |\
2097 6< .tin2 ${MAILX} ${ARGS} -X 'readctl create 6' > "${MBOX}" 2>&1
2100 echo $?
/$^ERRNAME
/ <$a><$b><$c>
2102 echo $?
/$^ERRNAME
/ <$a><$b><$c>
2104 echo $?
/$^ERRNAME
/ <$a><$b><$c>
2106 echo $?
/$^ERRNAME
/ <$a><$b><$c>
2108 echo $?
/$^ERRNAME
/ <$a><$b><$c>
2110 echo $?
/$^ERRNAME
/ <$a><$b><$c>
2112 echo $?
/$^ERRNAME
/ <$a><$b><$c>
2114 echo $?
/$^ERRNAME
/ <$a><$b><$c>
2115 readctl remove
6;echo readctl remove
:$?
/$^ERRNAME
2117 check behave
:read-ifs
0 "${MBOX}" '890153490 298'
2124 TRAP_EXIT_ADDONS
="./.t*"
2128 while [ ${i} -lt 112 ]; do
2129 printf 'm file://%s\n~s Subject %s\nHello %s!\n~.\n' \
2130 "${MBOX}" "${i}" "${i}"
2133 ) |
${MAILX} ${ARGS}
2134 check behave
:mbox-1
0 "${MBOX}" '1140119864 13780'
2140 ' "${MBOX}" .tmbox1 .tmbox1 |
2141 ${MAILX} ${ARGS} > .tlst
2142 check behave
:mbox-2
0 .tlst
'2739893312 9103'
2148 ' "${MBOX}" .tmbox2 .tmbox2 |
2149 ${MAILX} ${ARGS} > .tlst
2150 check behave
:mbox-3
0 .tlst
'1702194178 9110'
2152 # only the odd (even)
2154 printf 'File "file://%s"
2157 while [ ${i} -lt 112 ]; do
2159 [ ${j} -eq 1 ] && printf '%s ' "${i}"
2166 ) |
${MAILX} ${ARGS} > .tlst
2167 check behave
:mbox-4
0 .tmbox3
'631132924 6890'
2168 check behave
:mbox-5
- .tlst
'2960975049 4573'
2171 printf 'file "file://%s"
2174 while [ ${i} -lt 112 ]; do
2176 [ ${j} -eq 0 ] && [ ${i} -ne 0 ] && printf '%s ' "${i}"
2184 ' .tmbox3 .tmbox3 .tmbox2
2185 ) | ${MAILX} ${ARGS} > .tlst
2186 check behave:mbox-6 0 .tmbox3 '1387070539 13655'
2187 ${sed} 2d < .tlst > .tlstx
2188 check behave:mbox-7 - .tlstx '2729940494 13645'
2193 t_behave_alternates() {
2195 TRAP_EXIT_ADDONS=".
/.t
*"
2197 ${cat} <<-_EOT > ./.tsendmail.sh
2199 (echo 'From Valeriana Sat Jul 08 15:54:03 2017' && ${cat} && echo
2202 chmod 0755 ./.tsendmail.sh
2204 ${cat} <<- '__EOT' | ${MAILX} ${ARGS} -Smta=./.tsendmail.sh > ./.tall 2>&1
2208 alternates a1@b1 a2@b2 a3@b3
2213 echo $?/$^ERRNAME <$rv>
2218 echo $?/$^ERRNAME <$rv>
2221 echo $?/$^ERRNAME <$rv>
2224 echo $?/$^ERRNAME <$rv>
2228 alternates a1@b1 a2@b2 a3@b3
2231 echo $?/$^ERRNAME <$rv>
2234 echo $?/$^ERRNAME <$rv>
2237 echo $?/$^ERRNAME <$rv>
2240 alternates a1@b1 a2@b2 a3@b3
2243 echo $?/$^ERRNAME <$rv>
2246 echo $?/$^ERRNAME <$rv>
2249 echo $?/$^ERRNAME <$rv>
2253 alternates a1@b1 a2@b2 a3@b3
2256 echo $?/$^ERRNAME <$rv>
2260 alternates a1@b1 a1@c1 a1@d1 a2@b2 a3@b3 a3@c3 a3@d3
2262 ~s all alternates, only a1@b1 remains
2264 ~b a3@b3 a3@c3 a3@d3
2273 alternates a1@b1 a1@c1 a2@b2 a3@b3
2275 ~s a1@b1 a1@d1, and a3@c3 a3@d3 remain
2277 ~b a3@b3 a3@c3 a3@d3
2284 alternates a1@b1 a2@b2 a3; set allnet
2286 ~s all alternates via allnet, only a1@b1 remains
2288 ~b a3@b3 a3@c3 a3@d3
2299 echo $?/$^ERRNAME <$rv>
2303 echo $?/$^ERRNAME <$rv>
2307 echo $?/$^ERRNAME <$rv>
2311 echo $?/$^ERRNAME <$rv>
2315 echo $?/$^ERRNAME <$rv>
2319 alternates a1@b1 a2@b2
2322 echo $?/$^ERRNAME <$rv>
2323 alternates a3@b3 a4@b4
2326 echo $?/$^ERRNAME <$rv>
2328 check behave:alternates-1 0 "${MBOX}" '142184864 515'
2329 check behave:alternates-2 - .tall '1878598364 505'
2336 TRAP_EXIT_ADDONS=".
/.t
*"
2338 ${cat} <<-_EOT > ./.tsendmail.sh
2340 (echo 'From Hippocastanum Mon Jun 19 15:07:07 2017' && ${cat} && echo
2343 chmod 0755 ./.tsendmail.sh
2345 ${cat} <<- '__EOT' | ${MAILX} ${ARGS} -Smta=./.tsendmail.sh > ./.tall 2>&1
2347 alias a1 ex2@a1.ple "EX3
<ex3@a1.ple
>"
2349 alias a2 ex1@a2.ple ex2@a2.ple ex3@a2.ple ex4@a2.ple
2351 alias a4 a5 ex1@a4.ple
2353 alias a6 a7 ex1@a6.ple
2367 check behave:alias-1 0 "${MBOX}" '2496925843 272'
2368 check behave:alias-2 - .tall '3548953204 152'
2370 # TODO t_behave_alias: n_ALIAS_MAXEXP is compile-time constant,
2371 # TODO need to somehow provide its contents to the test, then test
2376 t_behave_filetype() {
2378 TRAP_EXIT_ADDONS=".
/.t
*"
2380 ${cat} <<-_EOT > ./.tsendmail.sh
2382 (echo 'From Alchemilla Wed Apr 25 15:12:13 2017' && ${cat} && echo
2385 chmod 0755 ./.tsendmail.sh
2387 printf 'm m1@e.t\nL1\nHy1\n~.\nm m2@e.t\nL2\nHy2\n~@ ./snailmail.jpg\n~.\n' |
2388 ${MAILX} ${ARGS} -Smta=./.tsendmail.sh
2389 check behave:filetype-1 0 "${MBOX}" '1645747150 13536'
2391 if command -v gzip >/dev/null 2>&1; then
2394 printf 'File "%s
"\ncopy 1 ./.t.mbox.gz
2395 copy 2 ./.t.mbox.gz' "${MBOX}" |
2397 -X'filetype gz gzip\ -dc gzip\ -c'
2398 printf 'File ./.t.mbox.gz\ncopy * ./.t.mbox\n' |
2400 -X'filetype gz gzip\ -dc gzip\ -c'
2402 check behave:filetype-2 0 ".
/.t.mbox
" '1645747150 13536'
2404 echo 'behave:filetype-2: unsupported, skipped'
2409 printf 'File "%s
"\ncopy 1 ./.t.mbox.gz
2415 -X'filetype gz gzip\ -dc gzip\ -c' \
2416 -X'filetype mbox.gz "${sed} 1,3d|
${cat}" \
2417 "echo eins
;echo zwei
;echo und mit
${sed} bist Du dabei
;${cat}"'
2418 printf 'File ./.t.mbox.gz\ncopy * ./.t.mbox\n' |
2420 -X'filetype gz gzip\ -dc gzip\ -c' \
2421 -X'filetype mbox.gz "${sed} 1,3d|
${cat}" kill\ 0'
2424 check behave:filetype-3 - ".
/.t.mbox
" '238021003 27092'
2429 t_behave_record_a_resend() {
2431 TRAP_EXIT_ADDONS=".
/.t.record .
/.t.resent
"
2435 m %s\n~s Subject 1.\nHello.\n~.
2436 set record-files add-file-recipients
2437 m %s\n~s Subject 2.\nHello.\n~.
2439 resend 2 ./.t.resent
2440 Resend 1 ./.t.resent
2442 resend 2 ./.t.resent
2443 Resend 1 ./.t.resent
2444 ' ./.t.record "${MBOX}" "${MBOX}" "${MBOX}" |
2447 check behave:record_a_resend-1 0 "${MBOX}" '3057873538 256'
2448 check behave:record_a_resend-2 - .t.record '391356429 460'
2449 check behave:record_a_resend-3 - .t.resent '2685231691 648'
2454 t_behave_e_H_L_opts() {
2456 TRAP_EXIT_ADDONS=".
/.tsendmail.sh .
/.t.mbox
"
2459 ${MAILX} ${ARGS} -ef ./.t.mbox
2460 echo ${?} > "${MBOX}"
2462 ${cat} <<-_EOT > ./.tsendmail.sh
2464 (echo 'From Alchemilla Wed Apr 07 17:03:33 2017' && ${cat} && echo
2467 chmod 0755 ./.tsendmail.sh
2468 printf 'm me@exam.ple\nLine 1.\nHello.\n~.\n' |
2469 ${MAILX} ${ARGS} -Smta=./.tsendmail.sh
2470 printf 'm you@exam.ple\nLine 1.\nBye.\n~.\n' |
2471 ${MAILX} ${ARGS} -Smta=./.tsendmail.sh
2473 ${MAILX} ${ARGS} -ef ./.t.mbox
2474 echo ${?} >> "${MBOX}"
2475 ${MAILX} ${ARGS} -efL @t@me ./.t.mbox
2476 echo ${?} >> "${MBOX}"
2477 ${MAILX} ${ARGS} -efL @t@you ./.t.mbox
2478 echo ${?} >> "${MBOX}"
2479 ${MAILX} ${ARGS} -efL '@>@Line 1' ./.t.mbox
2480 echo ${?} >> "${MBOX}"
2481 ${MAILX} ${ARGS} -efL '@>@Hello.' ./.t.mbox
2482 echo ${?} >> "${MBOX}"
2483 ${MAILX} ${ARGS} -efL '@>@Bye.' ./.t.mbox
2484 echo ${?} >> "${MBOX}"
2485 ${MAILX} ${ARGS} -efL '@>@Good bye.' ./.t.mbox
2486 echo ${?} >> "${MBOX}"
2488 ${MAILX} ${ARGS} -fH ./.t.mbox >> "${MBOX}"
2489 echo ${?} >> "${MBOX}"
2490 ${MAILX} ${ARGS} -fL @t@me ./.t.mbox >> "${MBOX}"
2491 echo ${?} >> "${MBOX}"
2492 ${MAILX} ${ARGS} -fL @t@you ./.t.mbox >> "${MBOX}"
2493 echo ${?} >> "${MBOX}"
2494 ${MAILX} ${ARGS} -fL '@>@Line 1' ./.t.mbox >> "${MBOX}"
2495 echo ${?} >> "${MBOX}"
2496 ${MAILX} ${ARGS} -fL '@>@Hello.' ./.t.mbox >> "${MBOX}"
2497 echo ${?} >> "${MBOX}"
2498 ${MAILX} ${ARGS} -fL '@>@Bye.' ./.t.mbox >> "${MBOX}"
2499 echo ${?} >> "${MBOX}"
2500 ${MAILX} ${ARGS} -fL '@>@Good bye.' ./.t.mbox >> "${MBOX}" 2>/dev
/null
2501 echo ${?} >> "${MBOX}"
2503 check behave
:e_H_L_opts
- "${MBOX}" '1708955574 678'
2508 t_behave_compose_hooks
() { # TODO monster
2510 TRAP_EXIT_ADDONS
="./.t*"
2512 (echo line one
&&echo line two
&&echo line three
) > .
/.treadctl
2513 (echo echo four
&&echo echo five
&&echo echo six
) > .
/.tattach
2515 ${cat} <<-_EOT > ./.tsendmail.sh
2517 (echo 'From PrimulaVeris Wed Apr 10 22:59:00 2017' && ${cat} && echo
2520 chmod 0755 .
/.tsendmail.sh
2522 ${cat} <<'__EOT__' > ./.trc
2524 echoerr "Failed: $1. Bailing out"; echo "~x"; xit
2527 vput vexpr es substr "$1" 0 1
2532 define read_mline_res {
2533 read hl; wysh set len=$? es=$! en=$^ERRNAME;\
2534 echo $len/$es/$^ERRNAME: $hl
2535 if [ $es -ne $^ERR-NONE ]
2536 xcall bail read_mline_res
2538 \xcall read_mline_res
2543 echo "~^header list"; read hl; echo $hl;\
2544 call xerr "$hl" "in_addr ($xh) 0-1"
2546 echo "~^header insert $xh diet <$xh@exam.ple> spliced";\
2547 read es; echo $es; call xerr "$es" "ins_addr $xh 1-1"
2548 echo "~^header insert $xh <${xh}2@exam.ple>";\
2549 read es; echo $es; call xerr "$es" "ins_addr $xh 1-2"
2550 echo "~^header insert $xh ${xh}3@exam.ple";\
2551 read es; echo $es; call xerr "$es" "ins_addr $xh 1-3"
2552 echo "~^header list $xh"; read hl; echo $hl;\
2553 call xerr "$hl" "ins_addr $xh 1-4"
2554 echo "~^header show $xh"; read es; call xerr $es "ins_addr $xh 1-5"
2557 if [ "$t_remove" == "" ]
2561 echo "~^header remove $xh"; read es; call xerr $es "ins_addr $xh 2-1"
2562 echo "~^header remove $xh"; read es; vput vexpr es substr $es 0 3
2564 xcall bail "ins_addr $xh 2-2"
2566 echo "~^header list $xh"; read es; vput vexpr es substr $es 0 3
2568 xcall bail "ins_addr $xh 2-3"
2570 echo "~^header show $xh"; read es; vput vexpr es substr $es 0 3
2572 xcall bail "ins_addr $xh 2-4"
2576 echo "~^header insert $xh diet <$xh@exam.ple> spliced";\
2577 read es; echo $es; call xerr "$es" "ins_addr $xh 3-1"
2578 echo "~^header insert $xh <${xh}2@exam.ple>";\
2579 read es; echo $es; call xerr "$es" "ins_addr $xh 3-2"
2580 echo "~^header insert $xh ${xh}3@exam.ple";\
2581 read es; echo $es; call xerr "$es" "ins_addr $xh 3-3"
2582 echo "~^header list $xh"; read hl; echo $hl;\
2583 call xerr "$hl" "ins_addr $xh 3-4"
2584 echo "~^header show $xh"; read es; call xerr $es "ins_addr $xh 3-5"
2587 echo "~^header remove-at $xh 1"; read es;\
2588 call xerr $es "ins_addr $xh 3-6"
2589 echo "~^header remove-at $xh 1"; read es;\
2590 call xerr $es "ins_addr $xh 3-7"
2591 echo "~^header remove-at $xh 1"; read es;\
2592 call xerr $es "ins_addr $xh 3-8"
2593 echo "~^header remove-at $xh 1"; read es;\
2594 vput vexpr es substr $es 0 3
2596 xcall bail "ins_addr $xh 3-9"
2598 echo "~^header remove-at $xh T"; read es;\
2599 vput vexpr es substr $es 0 3
2601 xcall bail "ins_addr $xh 3-10"
2603 echo "~^header list $xh"; read es;\
2604 vput vexpr es substr $es 0 3
2606 xcall bail "ins_addr $xh 3-11"
2608 echo "~^header show $xh"; read es;\
2609 vput vexpr es substr $es 0 3
2611 xcall bail "ins_addr $xh 3-12"
2615 echo "~^header insert $xh diet <$xh@exam.ple> spliced";\
2616 read es; echo $es; call xerr "$es" "ins_addr $xh 4-1"
2617 echo "~^header insert $xh <${xh}2@exam.ple> (comment) \"Quot(e)d\"";\
2618 read es; echo $es; call xerr "$es" "ins_addr $xh 4-2"
2619 echo "~^header insert $xh ${xh}3@exam.ple";\
2620 read es; echo $es; call xerr "$es" "ins_addr $xh 4-3"
2621 echo "~^header list $xh"; read hl; echo $hl;\
2622 call xerr "$hl" "header list $xh 3-4"
2623 echo "~^header show $xh"; read es; call xerr $es "ins_addr $xh 4-5"
2626 echo "~^header remove-at $xh 3"; read es;\
2627 call xerr $es "ins_addr $xh 4-6"
2628 echo "~^header remove-at $xh 2"; read es;\
2629 call xerr $es "ins_addr $xh 4-7"
2630 echo "~^header remove-at $xh 1"; read es;\
2631 call xerr $es "ins_addr $xh 4-8"
2632 echo "~^header remove-at $xh 1"; read es;\
2633 vput vexpr es substr $es 0 3
2635 xcall bail "ins_addr $xh 4-9"
2637 echo "~^header remove-at $xh T"; read es;\
2638 vput vexpr es substr $es 0 3
2640 xcall bail "ins_addr $xh 4-10"
2642 echo "~^header list $xh"; read es;\
2643 vput vexpr es substr $es 0 3
2645 xcall bail "ins_addr $xh 4-11"
2647 echo "~^header show $xh"; read es;\
2648 vput vexpr es substr $es 0 3
2650 xcall bail "ins_addr $xh 4-12"
2654 wysh set xh=$1 mult=$2
2655 echo "~^header list"; read hl; echo $hl;\
2656 call xerr "$hl" "ins_ref ($xh) 0-1"
2658 echo "~^header insert $xh <$xh@exam.ple>";\
2659 read es; echo $es; call xerr "$es" "ins_ref $xh 1-1"
2661 echo "~^header insert $xh <${xh}2@exam.ple>";\
2662 read es; echo $es; call xerr "$es" "ins_ref $xh 1-2"
2663 echo "~^header insert $xh ${xh}3@exam.ple";\
2664 read es; echo $es; call xerr "$es" "ins_ref $xh 1-3"
2666 echo "~^header insert $xh <${xh}2@exam.ple>"; read es;\
2667 vput vexpr es substr $es 0 3
2669 xcall bail "ins_ref $xh 1-4"
2673 echo "~^header list $xh"; read hl; echo $hl;\
2674 call xerr "$hl" "ins_ref $xh 1-5"
2675 echo "~^header show $xh"; read es; call xerr $es "ins_ref $xh 1-6"
2678 if [ "$t_remove" == "" ]
2682 echo "~^header remove $xh"; read es;\
2683 call xerr $es "ins_ref $xh 2-1"
2684 echo "~^header remove $xh"; read es;\
2685 vput vexpr es substr $es 0 3
2687 xcall bail "ins_ref $xh 2-2"
2689 echo "~^header list $xh"; read es;\
2690 vput vexpr es substr $es 0 3
2692 xcall bail "$es ins_ref $xh 2-3"
2694 echo "~^header show $xh"; read es;\
2695 vput vexpr es substr $es 0 3
2697 xcall bail "ins_ref $xh 2-4"
2701 echo "~^header insert $xh <$xh@exam.ple>";\
2702 read es; echo $es; call xerr "$es" "ins_ref $xh 3-1"
2704 echo "~^header insert $xh <${xh}2@exam.ple>";\
2705 read es; echo $es; call xerr "$es" "ins_ref $xh 3-2"
2706 echo "~^header insert $xh ${xh}3@exam.ple";\
2707 read es; echo $es; call xerr "$es" "ins_ref $xh 3-3"
2709 echo "~^header list $xh";\
2710 read hl; echo $hl; call xerr "$hl" "ins_ref $xh 3-4"
2711 echo "~^header show $xh";\
2712 read es; call xerr $es "ins_ref $xh 3-5"
2715 echo "~^header remove-at $xh 1"; read es;\
2716 call xerr $es "ins_ref $xh 3-6"
2717 if [ $mult -ne 0 ] && [ $xh != subject ]
2718 echo "~^header remove-at $xh 1"; read es;\
2719 call xerr $es "ins_ref $xh 3-7"
2720 echo "~^header remove-at $xh 1"; read es;\
2721 call xerr $es "ins_ref $xh 3-8"
2723 echo "~^header remove-at $xh 1"; read es;\
2724 vput vexpr es substr $es 0 3
2726 xcall bail "ins_ref $xh 3-9"
2728 echo "~^header remove-at $xh T"; read es;\
2729 vput vexpr es substr $es 0 3
2731 xcall bail "ins_ref $xh 3-10"
2733 echo "~^header show $xh"; read es;\
2734 vput vexpr es substr $es 0 3
2736 xcall bail "ins_ref $xh 3-11"
2740 echo "~^header insert $xh <$xh@exam.ple> ";\
2741 read es; echo $es; call xerr "$es" "ins_ref $xh 4-1"
2743 echo "~^header insert $xh <${xh}2@exam.ple> ";\
2744 read es; echo $es; call xerr "$es" "ins_ref $xh 4-2"
2745 echo "~^header insert $xh ${xh}3@exam.ple";\
2746 read es; echo $es; call xerr "$es" "ins_ref $xh 4-3"
2748 echo "~^header list $xh"; read hl; echo $hl;\
2749 call xerr "$hl" "ins_ref $xh 4-4"
2750 echo "~^header show $xh"; read es; call xerr $es "ins_ref $xh 4-5"
2753 if [ $mult -ne 0 ] && [ $xh != subject ]
2754 echo "~^header remove-at $xh 3"; read es;\
2755 call xerr $es "ins_ref $xh 4-6"
2756 echo "~^header remove-at $xh 2"; read es;\
2757 call xerr $es "ins_ref $xh 4-7"
2759 echo "~^header remove-at $xh 1"; read es;\
2760 call xerr $es "ins_ref $xh 4-8"
2761 echo "~^header remove-at $xh 1"; read es;\
2762 vput vexpr es substr $es 0 3
2764 xcall bail "ins_ref $xh 4-9"
2766 echo "~^header remove-at $xh T"; read es;\
2767 vput vexpr es substr $es 0 3
2769 xcall bail "ins_ref $xh 4-10"
2771 echo "~^header show $xh"; read es;\
2772 vput vexpr es substr $es 0 3
2774 xcall bail "ins_ref $xh 4-11"
2779 # In collect.c order
2781 call ins_ref sender 0 # Not a "ref", but works
2785 call ins_addr reply-To
2786 call ins_addr mail-Followup-to
2787 call ins_ref messAge-id 0
2788 call ins_ref rEfErEncEs 1
2789 call ins_ref in-Reply-to 1
2790 call ins_ref subject 1 # Not a "ref", but works (with tweaks)
2791 call ins_addr freeForm1
2792 call ins_addr freeform2
2794 echo "~^header show MAILX-Command"; read es; call xerr $es "t_header 1000"
2796 echo "~^header show MAILX-raw-TO"; read es; call xerr $es "t_header 1001"
2804 echo "~^attachment";\
2805 read hl; echo $hl; vput vexpr es substr "$hl" 0 3
2807 xcall bail "attach 0-1"
2810 echo "~^attach attribute ./.treadctl";\
2811 read hl; echo $hl; vput vexpr es substr "$hl" 0 3
2813 xcall bail "attach 0-2"
2815 echo "~^attachment attribute-at 1";\
2816 read hl; echo $hl; vput vexpr es substr "$hl" 0 3
2818 xcall bail "attach 0-3"
2821 echo "~^attachment insert ./.treadctl=ascii";\
2822 read hl; echo $hl; call xerr "$hl" "attach 1-1"
2823 echo "~^attachment list";\
2824 read es; echo $es;call xerr "$es" "attach 1-2"
2826 echo "~^attachment attribute ./.treadctl";\
2827 read es; echo $es;call xerr "$es" "attach 1-3"
2829 echo "~^attachment attribute .treadctl";\
2830 read es; echo $es;call xerr "$es" "attach 1-4"
2832 echo "~^attachment attribute-at 1";\
2833 read es; echo $es;call xerr "$es" "attach 1-5"
2836 echo "~^attachment attribute-set ./.treadctl filename rctl";\
2837 read es; echo $es;call xerr "$es" "attach 1-6"
2838 echo "~^attachment attribute-set .treadctl content-description Au";\
2839 read es; echo $es;call xerr "$es" "attach 1-7"
2840 echo "~^attachment attribute-set-at 1 content-id <10.du@ich>";\
2841 read es; echo $es;call xerr "$es" "attach 1-8"
2843 echo "~^attachment attribute ./.treadctl";\
2844 read es; echo $es;call xerr "$es" "attach 1-9"
2846 echo "~^attachment attribute .treadctl";\
2847 read es; echo $es;call xerr "$es" "attach 1-10"
2849 echo "~^attachment attribute rctl";\
2850 read es; echo $es;call xerr "$es" "attach 1-11"
2852 echo "~^attachment attribute-at 1";\
2853 read es; echo $es;call xerr "$es" "attach 1-12"
2857 echo "~^attachment insert ./.tattach=latin1";\
2858 read hl; echo $hl; call xerr "$hl" "attach 2-1"
2859 echo "~^attachment list";\
2860 read es; echo $es;call xerr "$es" "attach 2-2"
2862 echo "~^attachment attribute ./.tattach";\
2863 read es; echo $es;call xerr "$es" "attach 2-3"
2865 echo "~^attachment attribute .tattach";\
2866 read es; echo $es;call xerr "$es" "attach 2-4"
2868 echo "~^attachment attribute-at 2";\
2869 read es; echo $es;call xerr "$es" "attach 2-5"
2872 echo "~^attachment attribute-set ./.tattach filename tat";\
2873 read es; echo $es;call xerr "$es" "attach 2-6"
2875 "~^attachment attribute-set .tattach content-description Au2";\
2876 read es; echo $es;call xerr "$es" "attach 2-7"
2877 echo "~^attachment attribute-set-at 2 content-id <20.du@wir>";\
2878 read es; echo $es;call xerr "$es" "attach 2-8"
2880 "~^attachment attribute-set-at 2 content-type application/x-sh";\
2881 read es; echo $es;call xerr "$es" "attach 2-9"
2883 echo "~^attachment attribute ./.tattach";\
2884 read es; echo $es;call xerr "$es" "attach 2-10"
2886 echo "~^attachment attribute .tattach";\
2887 read es; echo $es;call xerr "$es" "attach 2-11"
2889 echo "~^attachment attribute tat";\
2890 read es; echo $es;call xerr "$es" "attach 2-12"
2892 echo "~^attachment attribute-at 2";\
2893 read es; echo $es;call xerr "$es" "attach 2-13"
2897 if [ "$t_remove" == "" ]
2901 echo "~^attachment remove ./.treadctl"; read es;\
2902 call xerr $es "attach 3-1"
2903 echo "~^attachment remove ./.tattach"; read es;\
2904 call xerr $es "attach 3-2"
2905 echo "~^ attachment remove ./.treadctl"; read es;\
2906 vput vexpr es substr $es 0 3
2908 xcall bail "attach 3-3"
2910 echo "~^ attachment remove ./.tattach"; read es;\
2911 vput vexpr es substr $es 0 3
2913 xcall bail "attach 3-4"
2915 echo "~^attachment list"; read es;\
2916 vput vexpr es substr $es 0 3
2918 xcall bail "attach 3-5"
2922 echo "~^attachment insert ./.tattach=latin1";\
2923 read hl; echo $hl; call xerr "$hl" "attach 4-1"
2924 echo "~^attachment insert ./.tattach=latin1";\
2925 read hl; echo $hl; call xerr "$hl" "attach 4-2"
2926 echo "~^attachment list";\
2927 read es; echo $es;call xerr "$es" "attach 4-3"
2929 echo "~^ attachment remove .tattach"; read es;\
2930 vput vexpr es substr $es 0 3
2932 xcall bail "attach 4-4 $es"
2934 echo "~^attachment remove-at T"; read es;\
2935 vput vexpr es substr $es 0 3
2937 xcall bail "attach 4-5"
2939 echo "~^attachment remove ./.tattach"; read es;\
2940 call xerr $es "attach 4-6"
2941 echo "~^attachment remove ./.tattach"; read es;\
2942 call xerr $es "attach 4-7"
2943 echo "~^ attachment remove ./.tattach"; read es;\
2944 vput vexpr es substr $es 0 3
2946 xcall bail "attach 4-8 $es"
2948 echo "~^attachment list"; read es;\
2949 vput vexpr es substr $es 0 3
2951 xcall bail "attach 4-9"
2955 echo "~^attachment insert ./.tattach=latin1";\
2956 read hl; echo $hl; call xerr "$hl" "attach 5-1"
2957 echo "~^attachment insert ./.tattach=latin1";\
2958 read hl; echo $hl; call xerr "$hl" "attach 5-2"
2959 echo "~^attachment insert ./.tattach=latin1";\
2960 read hl; echo $hl; call xerr "$hl" "attach 5-3"
2961 echo "~^attachment list";\
2962 read es; echo $es;call xerr "$es" "attach 5-4"
2965 echo "~^attachment remove-at 3"; read es;\
2966 call xerr $es "attach 5-5"
2967 echo "~^attachment remove-at 3"; read es;\
2968 vput vexpr es substr $es 0 3
2970 xcall bail "attach 5-6"
2972 echo "~^attachment remove-at 2"; read es;\
2973 call xerr $es "attach 5-7"
2974 echo "~^attachment remove-at 2"; read es;\
2975 vput vexpr es substr $es 0 3
2977 xcall bail "attach 5-8"
2979 echo "~^attachment remove-at 1"; read es;\
2980 call xerr $es "attach 5-9"
2981 echo "~^attachment remove-at 1"; read es;\
2982 vput vexpr es substr $es 0 3
2984 xcall bail "attach 5-10"
2987 echo "~^attachment list"; read es;\
2988 vput vexpr es substr $es 0 3
2990 xcall bail "attach 5-11"
2994 echo "~^attachment insert ./.tattach=latin1";\
2995 read hl; echo $hl; call xerr "$hl" "attach 6-1"
2996 echo "~^attachment insert ./.tattach=latin1";\
2997 read hl; echo $hl; call xerr "$hl" "attach 6-2"
2998 echo "~^attachment insert ./.tattach=latin1";\
2999 read hl; echo $hl; call xerr "$hl" "attach 6-3"
3000 echo "~^attachment list";\
3001 read es; echo $es;call xerr "$es" "attach 6-4"
3004 echo "~^attachment remove-at 1"; read es;\
3005 call xerr $es "attach 6-5"
3006 echo "~^attachment remove-at 1"; read es;\
3007 call xerr $es "attach 6-6"
3008 echo "~^attachment remove-at 1"; read es;\
3009 call xerr $es "attach 6-7"
3010 echo "~^attachment remove-at 1"; read es;\
3011 vput vexpr es substr $es 0 3
3013 xcall bail "attach 6-8"
3016 echo "~^attachment list"; read es;\
3017 vput vexpr es substr $es 0 3
3019 xcall bail "attach 6-9"
3031 echo on-compose-enter, mailx-command<$mailx-command>
3032 alternates alter1@exam.ple alter2@exam.ple
3034 set autocc='alter1@exam.ple alter2@exam.ple'
3035 echo mailx-from<$mailx-from> mailx-sender<$mailx-sender>
3036 echo mailx-subject<$mailx-subject>
3037 echo mailx-to<$mailx-to> mailx-cc<$mailx-cc> mailx-bcc<$mailx-bcc>
3038 echo mailx-raw-to<$mailx-raw-to> mailx-raw-cc<$mailx-raw-cc> \
3039 mailx-raw-bcc<$mailx-raw-bcc>
3040 echo mailx-orig-from<$mailx-orig-from> mailx-orig-to<$mailx-orig-to> \
3041 mailx-orig-cc<$mailx-orig-cc> mailx-orig-bcc<$mailx-orig-bcc>
3044 echo on-compose-leave, mailx-command<$mailx-command>
3046 eval alternates $al alter3@exam.ple alter4@exam.ple
3048 set autobcc='alter3@exam.ple alter4@exam.ple'
3049 echo mailx-from<$mailx-from> mailx-sender<$mailx-sender>
3050 echo mailx-subject<$mailx-subject>
3051 echo mailx-to<$mailx-to> mailx-cc<$mailx-cc> mailx-bcc<$mailx-bcc>
3052 echo mailx-raw-to<$mailx-raw-to> mailx-raw-cc<$mailx-raw-cc> \
3053 mailx-raw-bcc<$mailx-raw-bcc>
3054 echo mailx-orig-from<$mailx-orig-from> mailx-orig-to<$mailx-orig-to> \
3055 mailx-orig-cc<$mailx-orig-cc> mailx-orig-bcc<$mailx-orig-bcc>
3058 echo on-compose-cleanup, mailx-command<$mailx-command>
3061 echo mailx-from<$mailx-from> mailx-sender<$mailx-sender>
3062 echo mailx-subject<$mailx-subject>
3063 echo mailx-to<$mailx-to> mailx-cc<$mailx-cc> mailx-bcc<$mailx-bcc>
3064 echo mailx-raw-to<$mailx-raw-to> mailx-raw-cc<$mailx-raw-cc> \
3065 mailx-raw-bcc<$mailx-raw-bcc>
3066 echo mailx-orig-from<$mailx-orig-from> mailx-orig-to<$mailx-orig-to> \
3067 mailx-orig-cc<$mailx-orig-cc> mailx-orig-bcc<$mailx-orig-bcc>
3069 wysh set on-compose-splice=t_ocs \
3070 on-compose-enter=t_oce on-compose-leave=t_ocl \
3071 on-compose-cleanup=t_occ
3077 printf 'm this-goes@nowhere\nbody\n!.\n' |
3078 ${MAILX} ${ARGS} -Snomemdebug -Sescape=! -Sstealthmua=noagent \
3079 -X'source ./.trc' -Smta=.
/.tsendmail.sh \
3081 ${cat} .
/.tall
>> "${MBOX}"
3082 check behave
:compose_hooks-1
0 "${MBOX}" '3667291468 10101'
3085 printf 'm this-goes@nowhere\nbody\n!.\n' |
3086 ${MAILX} ${ARGS} -Snomemdebug -Sescape=! -Sstealthmua=noagent \
3087 -St_remove=1 -X'source ./.trc' -Smta=.
/.tsendmail.sh \
3089 ${cat} .
/.tall
>> "${MBOX}"
3090 check behave
:compose_hooks-2
0 "${MBOX}" '1746765053 12535'
3092 # Some state machine stress, shell compose hook, localopts for hook, etc.
3093 # readctl in child. ~r as HERE document
3095 printf 'm ex@am.ple\nbody\n!.\nvar t_oce t_ocs t_ocs_sh t_ocl t_occ autocc' |
3096 ${MAILX} ${ARGS} -Snomemdebug -Sescape=! \
3097 -Smta=.
/.tsendmail.sh \
3100 echoerr "Failed: $1. Bailing out"; echo "~x"; xit
3103 vput vexpr es substr "$1" 0 1
3108 define read_mline_res {
3109 read hl; wysh set len=$? es=$! en=$^ERRNAME;\
3110 echo $len/$es/$^ERRNAME: $hl
3111 if [ $es -ne $^ERR-NONE ]
3112 xcall bail read_mline_res
3114 \xcall read_mline_res
3118 vput vexpr i + 1 "$2"
3120 vput vexpr j % $i 10
3127 eval \\$j _work $1 $i
3130 vput vexpr i + $i "$1"
3134 read line;wysh set es=$? en=$^ERRNAME ; echo read:$es/$en: $line
3135 if [ "${es}" -ne -1 ]
3138 readctl remove $cwd/.treadctl; echo readctl remove:$?/$^ERRNAME
3143 echo "~^header list"; read hl; echo $hl;\
3144 vput vexpr es substr "$hl" 0 1
3146 xcall bail "header list"
3149 call _work 1; echo $?
3150 echo "~^header insert cc splicy diet <splice@exam.ple> spliced";\
3151 read es; echo $es; vput vexpr es substr "$es" 0 1
3153 xcall bail "be diet"
3155 echo "~^header insert cc <splice2@exam.ple>";\
3156 read es; echo $es; vput vexpr es substr "$es" 0 1
3158 xcall bail "be diet2"
3161 call _work 2; echo $?
3162 echo "~^header insert bcc juicy juice <juice@exam.ple> spliced";\
3163 read es; echo $es;vput vexpr es substr "$es" 0 1
3165 xcall bail "be juicy"
3167 echo "~^header insert bcc juice2@exam.ple";\
3168 read es; echo $es;vput vexpr es substr "$es" 0 1
3170 xcall bail "be juicy2"
3172 echo "~^header insert bcc juice3 <juice3@exam.ple>";\
3173 read es; echo $es;vput vexpr es substr "$es" 0 1
3175 xcall bail "be juicy3"
3177 echo "~^header insert bcc juice4@exam.ple";\
3178 read es; echo $es;vput vexpr es substr "$es" 0 1
3180 xcall bail "be juicy4"
3183 echo "~^header remove-at bcc 3";\
3184 read es; echo $es;vput vexpr es substr "$es" 0 1
3186 xcall bail "remove juicy5"
3188 echo "~^header remove-at bcc 2";\
3189 read es; echo $es;vput vexpr es substr "$es" 0 1
3191 xcall bail "remove juicy6"
3193 echo "~^header remove-at bcc 3";\
3194 read es; echo $es;vput vexpr es substr "$es" 0 3
3196 xcall bail "failed to remove-at"
3198 # Add duplicates which ought to be removed!
3199 echo "~^header insert bcc juice4@exam.ple";\
3200 read es; echo $es;vput vexpr es substr "$es" 0 1
3202 xcall bail "be juicy4-1"
3204 echo "~^header insert bcc juice4@exam.ple";\
3205 read es; echo $es;vput vexpr es substr "$es" 0 1
3207 xcall bail "be juicy4-2"
3209 echo "~^header insert bcc juice4@exam.ple";\
3210 read es; echo $es;vput vexpr es substr "$es" 0 1
3212 xcall bail "be juicy4-3"
3217 call _work 3; echo $?
3219 vput ! i echo just knock if you can hear me;\
3221 while [ $i -lt 24 ]; do printf "%s " $i; i=`expr $i + 1`; done;\
3223 echon shell-cmd says $?/$^ERRNAME: $i
3224 echo "~x will not become interpreted, we are reading until __EOT"
3226 read r_status; echo "~~r status output: $r_status"
3227 echo "~:echo $? $! $^ERRNAME"
3229 echo "~~r status from parent: $r_status"
3232 call _work 4; echo $?
3233 vput cwd cwd;echo cwd:$?
3234 readctl create $cwd/.treadctl ;echo readctl:$?/$^ERRNAME;\
3238 call _work 5; echo $?
3239 echo "~^header show MAILX-Command"; read es;\
3240 call xerr $es "t_header 1000"; call read_mline_res
3241 echo "~^header show MAILX-raw-TO"; read es;\
3242 call xerr $es "t_header 1001"; xcall read_mline_res
3244 echoerr IT IS WRONG IF YOU SEE THIS
3247 echo on-compose-enter, mailx-command<$mailx-command>
3248 set t_oce autobcc=oce@exam.ple
3249 alternates alter1@exam.ple alter2@exam.ple
3251 echo mailx-from<$mailx-from> mailx-sender<$mailx-sender>
3252 echo mailx-subject<$mailx-subject>
3253 echo mailx-to<$mailx-to> mailx-cc<$mailx-cc> mailx-bcc<$mailx-bcc>
3254 echo mailx-raw-to<$mailx-raw-to> mailx-raw-cc<$mailx-raw-cc> \
3255 mailx-raw-bcc<$mailx-raw-bcc>
3256 echo mailx-orig-from<$mailx-orig-from> \
3257 mailx-orig-to<$mailx-orig-to> \
3258 mailx-orig-cc<$mailx-orig-cc> mailx-orig-bcc<$mailx-orig-bcc>
3261 echo on-compose-leave, mailx-command<$mailx-command>
3262 set t_ocl autocc=ocl@exam.ple
3264 alternates alter3@exam.ple alter4@exam.ple
3266 echo mailx-from<$mailx-from> mailx-sender<$mailx-sender>
3267 echo mailx-subject<$mailx-subject>
3268 echo mailx-to<$mailx-to> mailx-cc<$mailx-cc> mailx-bcc<$mailx-bcc>
3269 echo mailx-raw-to<$mailx-raw-to> mailx-raw-cc<$mailx-raw-cc> \
3270 mailx-raw-bcc<$mailx-raw-bcc>
3271 echo mailx-orig-from<$mailx-orig-from> \
3272 mailx-orig-to<$mailx-orig-to> \
3273 mailx-orig-cc<$mailx-orig-cc> mailx-orig-bcc<$mailx-orig-bcc>
3276 echo on-compose-cleanup, mailx-command<$mailx-command>
3277 set t_occ autocc=occ@exam.ple
3280 echo mailx-from<$mailx-from> mailx-sender<$mailx-sender>
3281 echo mailx-subject<$mailx-subject>
3282 echo mailx-to<$mailx-to> mailx-cc<$mailx-cc> mailx-bcc<$mailx-bcc>
3283 echo mailx-raw-to<$mailx-raw-to> mailx-raw-cc<$mailx-raw-cc> \
3284 mailx-raw-bcc<$mailx-raw-bcc>
3285 echo mailx-orig-from<$mailx-orig-from> \
3286 mailx-orig-to<$mailx-orig-to> \
3287 mailx-orig-cc<$mailx-orig-cc> mailx-orig-bcc<$mailx-orig-bcc>
3289 wysh set on-compose-splice=t_ocs \
3290 on-compose-splice-shell="read ver;printf \"t_ocs-shell\\n\
3291 ~t shell@exam.ple\\n~:set t_ocs_sh\\n\"" \
3292 on-compose-enter=t_oce on-compose-leave=t_ocl \
3293 on-compose-cleanup=t_occ
3295 ex0_test behave
:compose_hooks-3
3296 ${cat} .
/.tnotes
>> "${MBOX}"
3298 check behave
:compose_hooks-3
- "${MBOX}" '679526364 2431'
3300 # Reply, forward, resend, Resend
3303 printf 'set from=f1@z\nm t1@z\nb1\n!.\nset from=f2@z\nm t2@z\nb2\n!.\n' |
3304 ${MAILX} ${ARGS} -Snomemdebug -Sescape=! \
3305 -Smta=.
/.tsendmail.sh
3308 echo start: $? $! $^ERRNAME
3310 echo File: $? $! $^ERRNAME;echo;echo
3312 this is content of reply 1
3314 echo reply 1: $? $! $^ERRNAME;echo;echo
3316 this is content of Reply 1 2
3318 echo Reply 1 2: $? $! $^ERRNAME;echo;echo
3319 forward 1 fwdex@am.ple
3320 this is content of forward 1
3322 echo forward 1: $? $! $^ERRNAME;echo;echo
3323 resend 1 2 resendex@am.ple
3324 echo resend 1 2: $? $! $^ERRNAME;echo;echo
3325 Resend 1 2 Resendex@am.ple
3326 echo Resend 1 2: $? $! $^ERRNAME;echo;echo
3328 ${MAILX} ${ARGS} -Snomemdebug -Sescape=! \
3329 -Smta=.
/.tsendmail.sh \
3332 echoerr "Failed: $1. Bailing out"; echo "~x"; xit
3335 vput vexpr es substr "$1" 0 1
3340 define read_mline_res {
3341 read hl; wysh set len=$? es=$! en=$^ERRNAME;\
3342 echo mline_res:$len/$es/$^ERRNAME: $hl
3343 if [ $es -ne $^ERR-NONE ]
3344 xcall bail read_mline_res
3346 \xcall read_mline_res
3350 echo "~^header show $1"; read es;\
3351 call xerr $es "work_hl $1"; echo $1; call read_mline_res
3359 echo t_ocs version $ver
3360 echo "~^header list"; read hl; echo $hl;\
3361 echoerr the header list is $hl;\
3362 call xerr "$hl" "header list"
3363 eval vpospar set $hl
3366 echoerr IT IS WRONG IF YOU SEE THIS
3369 echo on-XY-enter, mailx-command<$mailx-command>
3370 set t_oce autobcc=oce@exam.ple
3371 echo mailx-from<$mailx-from> mailx-sender<$mailx-sender>
3372 echo mailx-subject<$mailx-subject>
3373 echo mailx-to<$mailx-to> mailx-cc<$mailx-cc> mailx-bcc<$mailx-bcc>
3374 echo mailx-raw-to<$mailx-raw-to> mailx-raw-cc<$mailx-raw-cc> \
3375 mailx-raw-bcc<$mailx-raw-bcc>
3376 echo mailx-orig-from<$mailx-orig-from> \
3377 mailx-orig-to<$mailx-orig-to> \
3378 mailx-orig-cc<$mailx-orig-cc> mailx-orig-bcc<$mailx-orig-bcc>
3381 echo on-XY-leave, mailx-command<$mailx-command>
3382 set t_ocl autocc=ocl@exam.ple
3383 echo mailx-from<$mailx-from> mailx-sender<$mailx-sender>
3384 echo mailx-subject<$mailx-subject>
3385 echo mailx-to<$mailx-to> mailx-cc<$mailx-cc> mailx-bcc<$mailx-bcc>
3386 echo mailx-raw-to<$mailx-raw-to> mailx-raw-cc<$mailx-raw-cc> \
3387 mailx-raw-bcc<$mailx-raw-bcc>
3388 echo mailx-orig-from<$mailx-orig-from> \
3389 mailx-orig-to<$mailx-orig-to> \
3390 mailx-orig-cc<$mailx-orig-cc> mailx-orig-bcc<$mailx-orig-bcc>
3393 echo on-XY-cleanup, mailx-command<$mailx-command>
3394 set t_occ autocc=occ@exam.ple
3395 echo mailx-from<$mailx-from> mailx-sender<$mailx-sender>
3396 echo mailx-subject<$mailx-subject>
3397 echo mailx-to<$mailx-to> mailx-cc<$mailx-cc> mailx-bcc<$mailx-bcc>
3398 echo mailx-raw-to<$mailx-raw-to> mailx-raw-cc<$mailx-raw-cc> \
3399 mailx-raw-bcc<$mailx-raw-bcc>
3400 echo mailx-orig-from<$mailx-orig-from> \
3401 mailx-orig-to<$mailx-orig-to> \
3402 mailx-orig-cc<$mailx-orig-cc> mailx-orig-bcc<$mailx-orig-bcc>
3404 wysh set on-compose-splice=t_ocs \
3405 on-compose-enter=t_oce on-compose-leave=t_ocl \
3406 on-compose-cleanup=t_occ \
3407 on-resend-enter=t_oce on-resend-cleanup=t_occ
3409 ex0_test behave
:compose_hooks-4
3410 ${cat} .
/.tnotes
>> "${MBOX}"
3412 check behave
:compose_hooks-4
- "${MBOX}" '2711778338 7516'
3417 t_behave_message_injections
() {
3419 TRAP_EXIT_ADDONS
="./.t*"
3421 ${cat} <<-_EOT > ./.tsendmail.sh
3423 (echo 'From Echinacea Tue Jun 20 15:54:02 2017' && ${cat} && echo
3426 chmod 0755 .
/.tsendmail.sh
3428 echo mysig
> .
/.tmysig
3430 echo some-body |
${MAILX} ${ARGS} -Smta=.
/.tsendmail.sh \
3431 -Smessage-inject-head=head-inject \
3432 -Smessage-inject-tail=tail-inject \
3433 -Ssignature=.
/.tmysig \
3434 ex@am.ple
> .
/.tall
2>&1
3435 check behave
:message_injections-1
0 "${MBOX}" '2434746382 134'
3436 check behave
:message_injections-2
- .tall
'4294967295 0' # empty file
3438 ${cat} <<-_EOT > ./.template
3442 Subject: This subject is
3444 Body, body, body me.
3446 < .
/.template
${MAILX} ${ARGS} -t -Smta=.
/.tsendmail.sh \
3447 -Smessage-inject-head=head-inject \
3448 -Smessage-inject-tail=tail-inject \
3449 -Ssignature=.
/.tmysig \
3451 check behave
:message_injections-3
0 "${MBOX}" '3114203412 198'
3452 check behave
:message_injections-4
- .tall
'4294967295 0' # empty file
3457 t_behave_mime_types_load_control
() {
3459 TRAP_EXIT_ADDONS
="./.t*"
3461 ${cat} <<-_EOT > ./.tmts1
3462 @ application/mathml+xml mathml
3464 ${cat} <<-_EOT > ./.tmts2
3465 @ x-conference/x-cooltalk ice
3467 @ application/aga-aga aga
3470 ${cat} <<-_EOT > ./.tmts1.mathml
3471 <head>nonsense ML</head>
3473 ${cat} <<-_EOT > ./.tmts2.ice
3476 printf 'of which the c\x01rack is coming soon' > .
/.tmtsx.doom
3477 printf 'of which the c\x01rack is coming soon' > .
/.tmtsx.aga
3491 ' "${MBOX}" "${MBOX}" |
3493 -Smimetypes-load-control=f
=.
/.tmts1
,f
=.
/.tmts2 \
3495 ex0_test behave
:mime_types_load_control
3497 ${cat} "${MBOX}" >> .
/.tout
3498 check behave
:mime_types_load_control-1
- .
/.tout
'529577037 2474'
3500 echo type |
${MAILX} ${ARGS} -R \
3501 -Smimetypes-load-control=f
=.
/.tmts1
,f
=.
/.tmts3 \
3502 -f "${MBOX}" >> .
/.tout
2>&1
3503 check behave
:mime_types_load_control-2
0 .
/.tout
'2025926659 3558'
3509 have_feat smime ||
{
3510 echo 'behave:s/mime: unsupported, skipped'
3515 TRAP_EXIT_ADDONS
="./.t.conf ./.tkey.pem ./.tcert.pem ./.tpair.pem"
3516 TRAP_EXIT_ADDONS
="${TRAP_EXIT_ADDONS} ./.VERIFY ./.DECRYPT ./.ENCRYPT"
3517 TRAP_EXIT_ADDONS
="${TRAP_EXIT_ADDONS} ./.tsendmail.sh"
3519 printf 'behave:s/mime: .. generating test key and certificate ..\n'
3520 ${cat} <<-_EOT > ./.t.conf
3523 default_keyfile = keyfile.pem
3524 distinguished_name = req_distinguished_name
3525 attributes = req_attributes
3529 [ req_distinguished_name ]
3536 emailAddress = test@localhost
3541 openssl req
-x509 -nodes -days 3650 -config .
/.t.conf \
3542 -newkey rsa
:1024 -keyout .
/.tkey.pem
-out .
/.tcert.pem
>/dev
/null
2>&1
3543 ${cat} .
/.tkey.pem .
/.tcert.pem
> .
/.tpair.pem
3546 printf 'behave:s/mime:sign/verify: '
3547 echo bla |
${MAILX} ${ARGS} \
3548 -Ssmime-ca-file=.
/.tcert.pem
-Ssmime-sign-cert=.
/.tpair.pem \
3549 -Ssmime-sign -Sfrom=test@localhost \
3550 -s 'S/MIME test' .
/.VERIFY
3551 if [ $?
-eq 0 ]; then
3562 /^Content-Description: /{ skip = 2; print; next }
3563 /^$/{ if(skip) --skip }
3566 < .
/.VERIFY
> "${MBOX}"
3567 check behave
:s
/mime
:sign
/verify
:checksum
- "${MBOX}" '2900817158 648'
3569 printf 'behave:s/mime:sign/verify:verify '
3570 printf 'verify\nx\n' |
3572 -Ssmime-ca-file=.
/.tcert.pem
-Ssmime-sign-cert=.
/.tpair.pem \
3573 -Ssmime-sign -Sfrom=test@localhost \
3575 -f .
/.VERIFY
>/dev
/null
2>&1
3576 if [ $?
-eq 0 ]; then
3585 printf 'behave:s/mime:sign/verify:disproof-1 '
3586 if openssl smime
-verify -CAfile .
/.tcert.pem \
3587 -in .
/.VERIFY
>/dev
/null
2>&1; then
3596 # (signing +) encryption / decryption
3597 ${cat} <<-_EOT > ./.tsendmail.sh
3599 (echo 'From Euphrasia Thu Apr 27 17:56:23 2017' && ${cat}) > ./.ENCRYPT
3601 chmod 0755 .
/.tsendmail.sh
3603 printf 'behave:s/mime:encrypt+sign: '
3606 -Ssmime-force-encryption \
3607 -Ssmime-encrypt-recei@ver.com
=.
/.tpair.pem \
3608 -Smta=.
/.tsendmail.sh \
3609 -Ssmime-ca-file=.
/.tcert.pem
-Ssmime-sign-cert=.
/.tpair.pem \
3610 -Ssmime-sign -Sfrom=test@localhost \
3611 -s 'S/MIME test' recei@ver.com
3612 if [ $?
-eq 0 ]; then
3616 printf 'error: encrypt+sign failed\n'
3619 ${sed} -e '/^$/,$d' < .
/.ENCRYPT
> "${MBOX}"
3620 check behave
:s
/mime
:encrypt
+sign
:checksum
- "${MBOX}" '1937410597 327'
3622 printf 'behave:s/mime:decrypt+verify: '
3623 printf 'decrypt ./.DECRYPT\nfi ./.DECRYPT\nverify\nx\n' |
3625 -Ssmime-force-encryption \
3626 -Ssmime-encrypt-recei@ver.com
=.
/.tpair.pem \
3627 -Smta=.
/.tsendmail.sh \
3628 -Ssmime-ca-file=.
/.tcert.pem
-Ssmime-sign-cert=.
/.tpair.pem \
3629 -Ssmime-sign -Sfrom=test@localhost \
3631 -f .
/.ENCRYPT
>/dev
/null
2>&1
3632 if [ $?
-eq 0 ]; then
3641 /^Content-Description: /{ skip = 2; print; next }
3642 /^$/{ if(skip) --skip }
3645 < .
/.DECRYPT
> "${MBOX}"
3646 check behave
:s
/mime
:decrypt
+verify
:checksum
- "${MBOX}" '1720739247 931'
3648 printf 'behave:s/mime:decrypt+verify:disproof-1: '
3649 if (openssl smime
-decrypt -inkey .
/.tkey.pem
-in .
/.ENCRYPT |
3650 openssl smime
-verify -CAfile .
/.tcert.pem
) >/dev
/null
2>&1; then
3657 printf "behave:s/mime:encrypt: "
3658 echo bla |
${MAILX} ${ARGS} \
3659 -Ssmime-force-encryption \
3660 -Ssmime-encrypt-recei@ver.com
=.
/.tpair.pem \
3661 -Smta=.
/.tsendmail.sh \
3662 -Ssmime-ca-file=.
/.tcert.pem
-Ssmime-sign-cert=.
/.tpair.pem \
3663 -Sfrom=test@localhost \
3664 -s 'S/MIME test' recei@ver.com
3665 if [ $?
-eq 0 ]; then
3672 # Same as behave:s/mime:encrypt+sign:checksum above
3673 ${sed} -e '/^$/,$d' < .
/.ENCRYPT
> "${MBOX}"
3674 check behave
:s
/mime
:encrypt
:checksum
- "${MBOX}" '1937410597 327'
3677 printf 'decrypt ./.DECRYPT\nx\n' |
${MAILX} ${ARGS} \
3678 -Ssmime-force-encryption \
3679 -Ssmime-encrypt-recei@ver.com
=.
/.tpair.pem \
3680 -Smta=.
/.tsendmail.sh \
3681 -Ssmime-ca-file=.
/.tcert.pem
-Ssmime-sign-cert=.
/.tpair.pem \
3682 -Sfrom=test@localhost \
3684 -f .
/.ENCRYPT
>/dev
/null
2>&1
3685 check behave
:s
/mime
:decrypt
0 "./.DECRYPT" '2624716890 422'
3687 printf 'behave:s/mime:decrypt:disproof-1: '
3688 if openssl smime
-decrypt -inkey .
/.tkey.pem \
3689 -in .
/.ENCRYPT
>/dev
/null
2>&1; then
3699 t_behave_maildir
() {
3701 TRAP_EXIT_ADDONS
="./.t*"
3705 while [ ${i} -lt 112 ]; do
3706 printf 'm file://%s\n~s Subject %s\nHello %s!\n~.\n' \
3707 "${MBOX}" "${i}" "${i}"
3710 ) |
${MAILX} ${ARGS}
3711 check behave
:maildir-1
0 "${MBOX}" '1140119864 13780'
3717 ' "${MBOX}" .tmdir1 .tmdir1 |
3718 ${MAILX} ${ARGS} -Snewfolders=maildir
> .tlst
3719 check behave
:maildir-2
0 .tlst
'1797938753 9103'
3722 copy * "maildir://%s"
3725 ' "${MBOX}" .tmdir2 .tmdir2 |
3726 ${MAILX} ${ARGS} > .tlst
3727 check behave
:maildir-3
0 .tlst
'1155631089 9113'
3729 printf 'File "maildir://%s"
3733 ' .tmdir2 .tmbox1 .tmbox1 |
3734 ${MAILX} ${ARGS} > .tlst
3735 check behave
:maildir-4
0 .tmbox1
'2646131190 13220'
3736 check behave
:maildir-5
- .tlst
'3701297796 9110'
3738 # only the odd (even)
3740 printf 'File "maildir://%s"
3743 while [ ${i} -lt 112 ]; do
3745 [ ${j} -eq 1 ] && printf '%s ' "${i}"
3752 ) |
${MAILX} ${ARGS} > .tlst
3753 check behave
:maildir-6
0 .tmbox2
'142890131 6610'
3754 check behave
:maildir-7
- .tlst
'960096773 4573'
3757 printf 'file "maildir://%s"
3760 while [ ${i} -lt 112 ]; do
3762 [ ${j} -eq 0 ] && [ ${i} -ne 0 ] && printf '%s ' "${i}"
3770 ' .tmbox2 .tmbox2 .tmdir2
3771 ) | ${MAILX} ${ARGS} > .tlst
3772 check behave:maildir-8 0 .tmbox2 '3806905791 13100'
3773 ${sed} 2d < .tlst > .tlstx
3774 check behave:maildir-9 - .tlstx '4216815295 13645'
3779 t_behave_mass_recipients() {
3781 TRAP_EXIT_ADDONS=".
/.t
*"
3783 ${cat} <<-_EOT > ./.tsendmail.sh
3785 (echo 'From Eucalyptus Sat Jul 08 21:14:57 2017' && ${cat} && echo
3788 chmod 0755 ./.tsendmail.sh
3790 ${cat} <<'__EOT__' > ./.trc
3792 echoerr "Failed
: $1. Bailing out
"; echo "~x
"; xit
3795 wysh set nr=$1 hn=$2
3796 echo "~
$hn $hn$nr@
$hn"; echo '~:echo $?'; read es
3798 xcall bail "ins_addr
$hn 1-$nr"
3800 vput vexpr nr + $nr 1
3801 if [ "$nr" -le "$maximum" ]
3802 xcall ins_addr $nr $hn
3806 wysh set nr=$1 hn=$2
3807 alternates $hn$nr@$hn
3808 vput vexpr nr + $nr 2
3809 if [ "$nr" -le "$maximum" ]
3810 xcall bld_alter $nr $hn
3820 if [ "$t_remove" != '' ]
3825 set on-compose-splice=t_ocs on-compose-leave=t_ocl
3829 printf 'm this-goes@nowhere\nbody\n!.\n' |
3830 ${MAILX} ${ARGS} -Snomemdebug -Sescape=! -Sstealthmua=noagent \
3831 -X'source ./.trc' -Smta=./.tsendmail.sh -Smaximum=2001 \
3833 ${cat} ./.tall >> "${MBOX}"
3834 check behave:mass_recipients-1 0 "${MBOX}" '2912243346 51526'
3837 printf 'm this-goes@nowhere\nbody\n!.\n' |
3838 ${MAILX} ${ARGS} -Snomemdebug -Sescape=! -Sstealthmua=noagent \
3839 -St_remove=1 -X'source ./.trc' -Smta=./.tsendmail.sh -Smaximum=2001 \
3841 ${cat} ./.tall >> "${MBOX}"
3842 check behave:mass_recipients-2 0 "${MBOX}" '4097804632 34394'
3848 # Some basic tests regarding correct sending of mails, via STDIN / -t / -q,
3849 # including basic MIME Content-Transfer-Encoding correctness (quoted-printable)
3850 # Note we unfortunately need to place some statements without proper
3851 # indentation because of continuation problems
3855 # MIME encoding (QP) stress message body
3857 'Ich bin eine DÖS-Datäi mit sehr langen Zeilen und auch '\
3858 'sonst bin ich ganz schön am Schleudern, da kannste denke '\
3859 "wasde willst
, gelle
, gelle
, gelle
, gelle
, gelle.
\r\n"\
3860 "Ich bin eine DÖS-Datäi mit langen Zeilen und auch sonst
\r\n"\
3861 "Ich bin eine DÖS-Datäi mit langen Zeilen und auch sonst
1\r\n"\
3862 "Ich bin eine DÖS-Datäi mit langen Zeilen und auch sonst
12\r\n"\
3863 "Ich bin eine DÖS-Datäi mit langen Zeilen und auch sonst
123\r\n"\
3864 "Ich bin eine DÖS-Datäi mit langen Zeilen und auch sonst
1234\r\n"\
3865 "Ich bin eine DÖS-Datäi mit langen Zeilen und auch sonst
12345\r\n"\
3866 "Ich bin eine DÖS-Datäi mit langen Zeilen und auch sonst
123456\r\n"\
3867 "Ich bin eine DÖS-Datäi mit langen Zeilen und auch sonst
1234567\r\n"\
3868 "Ich bin eine DÖS-Datäi mit langen Zeilen und auch sonst
12345678\r\n"\
3869 "Ich bin eine DÖS-Datäi mit langen Zeilen und auch sonst
123456789\r\n"\
3870 "Unn ausserdem habe ich trailing SP
/HT
/SP
/HT whitespace
\r\n"\
3871 "Unn ausserdem habe ich trailing HT
/SP
/HT
/SP whitespace
\r\n"\
3872 "auf den zeilen vorher.
\r\n"\
3873 "From am Zeilenbeginn und From der Mitte gibt es auch.
\r\n"\
3875 "Die letzte Zeile war nur ein Punkt.
\r\n"\
3877 "Das waren deren zwei.
\r\n"\
3879 "Die letzte Zeile war ein Leerschritt.
\n"\
3880 "=VIER
= EQUAL SIGNS
=ON A LINE
=\r\n"\
3883 "Die letzte Zeile war nur ein Punkt
, mit Unix Zeilenende.
\n"\
3885 "Das waren deren zwei. ditto.
\n"\
3887 "Unn ausseerdem habe ich trailing SP
/HT
/SP
/HT whitespace
\n"\
3888 "Unn ausseerdem habe ich trailing HT
/SP
/HT
/SP whitespace
\n"\
3889 "auf den zeilen vorher.
\n"\
3891 "Ich bin eine ziemlich lange
, steile
, scharfe Zeile mit Unix Zeilenende.
\n"\
3892 "Ich bin eine ziemlich lange
, steile
, scharfe Zeile mit Unix Zeilenende
.1"\
3894 "Ich bin eine ziemlich lange
, steile
, scharfe Zeile mit Unix Zeilenende
.12"\
3896 "Ich bin eine ziemlich lange
, steile
, scharfe Zeile mit Unix Zeilenende
.12"\
3898 "Ich bin eine ziemlich lange
, steile
, scharfe Zeile mit Unix Zeilenende
.12"\
3900 "Ich bin eine ziemlich lange
, steile
, scharfe Zeile mit Unix Zeilenende
.12"\
3902 "Ich bin eine ziemlich lange
, steile
, scharfe Zeile mit Unix Zeilenende
.12"\
3904 "QP am Zeilenende über soft-nl hinweg
\n"\
3905 "Ich bin eine ziemlich lange
, steile
, scharfe Zeile mit Unix Zeilenende.
"\
3907 "Ich bin eine ziemlich lange
, steile
, scharfe Zeile mit Unix Zeilenende.
"\
3909 "Ich bin eine ziemlich lange
, steile
, scharfe Zeile mit Unix Zeilenende.
"\
3911 "Ich bin eine ziemlich lange
, steile
, scharfe Zeile mit Unix Zeilenende.
"\
3913 "=VIER
= EQUAL SIGNS
=ON A LINE
=\n"\
3915 "Die letzte Zeile war ein Leerschritt.
\n"\
3919 # MIME encoding (QP) stress message subject
3920 SUB="Äbrä Kä?dä
=brö Fü?di
=bus? \
3921 adadaddsssssssddddddddddddddddddddd\
3922 ddddddddddddddddddddddddddddddddddd\
3923 ddddddddddddddddddddddddddddddddddd\
3924 dddddddddddddddddddd Hallelulja? Od\
3925 er?? eeeeeeeeeeeeeeeeeeeeeeeeeeeeee\
3926 eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee\
3927 eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee f\
3928 fffffffffffffffffffffffffffffffffff\
3929 fffffffffffffffffffff ggggggggggggg\
3930 ggggggggggggggggggggggggggggggggggg\
3931 ggggggggggggggggggggggggggggggggggg\
3932 ggggggggggggggggggggggggggggggggggg\
3935 # Three tests for MIME encoding and (a bit) content classification.
3936 # At the same time testing -q FILE, < FILE and -t FILE
3939 < "${BODY}" ${MAILX} ${ARGS} ${ADDARG_UNI} \
3940 -a "${BODY}" -s "${SUB}" "${MBOX}"
3941 check content
:001 0 "${MBOX}" '1145066634 6654'
3944 < /dev
/null
${MAILX} ${ARGS} ${ADDARG_UNI} \
3945 -a "${BODY}" -s "${SUB}" -q "${BODY}" "${MBOX}"
3946 check content
:002 0 "${MBOX}" '1145066634 6654'
3949 ( echo "To: ${MBOX}" && echo "Subject: ${SUB}" && echo &&
3951 ) |
${MAILX} ${ARGS} ${ADDARG_UNI} -Snodot -a "${BODY}" -t
3952 check content:003 0 "${MBOX}" '1145066634 6654'
3954 # Test for [260e19d] (Juergen Daubert)
3956 echo body | ${MAILX} ${ARGS} "${MBOX}"
3957 check content
:004 0 "${MBOX}" '2917662811 98'
3959 # Sending of multiple mails in a single invocation
3961 ( printf "m ${MBOX}\n~s subject1\nE-Mail Körper 1\n~.\n" &&
3962 printf "m ${MBOX}\n~s subject2\nEmail body 2\n~.\n" &&
3964 ) |
${MAILX} ${ARGS} ${ADDARG_UNI}
3965 check content
:005 0 "${MBOX}" '2098659767 358'
3969 # "Test for" [d6f316a] (Gavin Troy)
3971 printf "m ${MBOX}\n~s subject1\nEmail body\n~.\nfi ${MBOX}\np\nx\n" |
3972 ${MAILX} ${ARGS} ${ADDARG_UNI} -Spipe-text/plain="@* ${cat}" > "${BODY}"
3973 check content:006 0 "${MBOX}" '2099098650 122'
3974 check content:006-1 - "${BODY}" '794542938 174'
3976 # "Test
for" [c299c45] (Peter Hofmann) TODO shouldn't end up QP-encoded?
3979 for(i = 0; i < 10000; ++i)
3981 #printf "\xF0\x90\x87\x90"
3982 }' | ${MAILX} ${ARGS} ${ADDARG_UNI} -s TestSubject "${MBOX}"
3983 check content
:007 0 "${MBOX}" '534262374 61816'
3985 ## Test some more corner cases for header bodies (as good as we can today) ##
3989 echo |
${MAILX} ${ARGS} ${ADDARG_UNI} \
3990 -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̲' \
3992 check content
:008 0 "${MBOX}" '3370931614 375'
3994 # Single word (overlong line split -- bad standard! Requires injection of
3995 # artificial data!! But can be prevented by using RFC 2047 encoding)
3997 i
=`${awk} 'BEGIN{for(i=0; i<92; ++i) printf "0123456789_"}'`
3998 echo |
${MAILX} ${ARGS} -s "${i}" "${MBOX}"
3999 check content:009 0 "${MBOX}" '489922370 1718'
4001 # Combination of encoded words, space and tabs of varying sort
4003 echo | ${MAILX} ${ARGS} ${ADDARG_UNI} \
4004 -s "1Abrä Kaspas1
2Abra Katä b_kaspas2 \
4005 3Abrä Kaspas3
4Abrä Kaspas4
5Abrä Kaspas5 \
4006 6Abra Kaspas6
7Abrä Kaspas7
8Abra Kaspas8 \
4007 9Abra Kaspastäb4-3
10Abra Kaspas1 _
11Abra Katäb1 \
4008 12Abra Kadabrä
1 After Tab after Täb this is NUTS
" \
4010 check content:010 0 "${MBOX}" '1676887734 591'
4012 # Overlong multibyte sequence that must be forcefully split
4013 # todo This works even before v15.0, but only by accident
4015 echo | ${MAILX} ${ARGS} ${ADDARG_UNI} \
4016 -s "✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄\
4017 ✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄\
4018 ✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄
" \
4020 check content:011 0 "${MBOX}" '3029301775 659'
4024 echo | ${MAILX} ${ARGS} \
4025 -s "1-1 B2 B3 B4 B5 B6 B\
4026 1-2 B2 B3 B4 B5 B6 B\
4027 1-3 B2 B3 B4 B5 B6 B\
4028 1-4 B2 B3 B4 B5 B6 B\
4029 1-5 B2 B3 B4 B5 B6 B\
4030 1-6 B2 B3 B4 B5 B6
" \
4032 check content:012 0 "${MBOX}" '4126167195 297'
4034 # Leading and trailing WS
4036 echo | ${MAILX} ${ARGS} \
4037 -s " 2-1 B2 B3 B4 B5 B6 B\
4038 1-2 B2 B3 B4 B5 B6 B\
4039 1-3 B2 B3 B4 B5 B6 B\
4040 1-4 B2 B3 B4 B5 B6
" \
4042 check content:013 0 "${MBOX}" '3600624479 236'
4044 # Quick'n dirty RFC 2231 test; i had more when implementing it, but until we
4045 # have a (better) test framework materialize a quick shot
4047 TRAP_EXIT_ADDONS=./.ttt
4049 mkdir ./.ttt || exit 1
4053 : > 'diet\ is \curd.txt'
4054 : > 'diet "is
" curd.txt'
4056 : > 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
4057 : > höde__tröge__müde__dätte__hätte__vuelle__guelle__aese__aesse__sauerliche__kräuter__österliche__grüße__mäh.txt
4058 : > hööööööööööööööööö_nöööööööööööööööööööööö_düüüüüüüüüüüüüüüüüüü_bäääääääääääääääääääääääh.txt
4059 : > ✆✆✆✆✆✆✆✆✆✆✆✆✆✆✆✆✆✆✆✆✆✆✆✆.txt
4061 echo bla | ${MAILX} ${ARGS} ${ADDARG_UNI} \
4062 -a ".
/.ttt
/ma
'ger.txt" -a "./.ttt/mä'ger.txt
" \
4063 -a './.ttt/diet\ is \curd.txt' -a './.ttt/diet "is
" curd.txt' \
4064 -a ./.ttt/höde-tröge.txt \
4065 -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 \
4066 -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 \
4067 -a ./.ttt/hööööööööööööööööö_nöööööööööööööööööööööö_düüüüüüüüüüüüüüüüüüü_bäääääääääääääääääääääääh.txt \
4068 -a ./.ttt/✆✆✆✆✆✆✆✆✆✆✆✆✆✆✆✆✆✆✆✆✆✆✆✆.txt \
4070 check content:014-1 0 "${MBOX}" '684985954 3092'
4072 # `resend' test, reusing $MBOX
4074 printf "Resend
${BODY}\nx\n" | ${MAILX} ${ARGS} -Rf "${MBOX}"
4075 check content:014-2 0 "${BODY}" '684985954 3092'
4078 printf "resend
${BODY}\nx\n" | ${MAILX} ${ARGS} -Rf "${MBOX}"
4079 check content:014-3 0 "${BODY}" '3130352658 3148'
4085 # if have_feat devel; then
4086 # ARGS="${ARGS} -Smemdebug"
4093 if [ -z "${CHECK_ONLY}" ]; then
4099 [ ${ESTAT} -eq 0 ] && echo Ok || echo >&2 'Errors occurred'