print_headers(): do not compress subjects when displaying newmail etc.
[s-mailx.git] / cc-test.sh
blobd211a6fea9b699be28c5cea92d030ee8858fc3be
1 #!/bin/sh -
2 #@ Synopsis: ./cc-test.sh --check-only [s-mailx-binary]
3 #@ ./cc-test.sh --mae-test s-mailx-binary [:TESTNAME:]
4 #@ [./cc-test.sh # Note: performs hundreds of compilations!]
5 #@ The latter generates output files.
6 #@ TODO _All_ the tests should happen in a temporary subdir.
7 # Public Domain
9 # Instead of figuring out the environment in here, require a configured build
10 # system and include that! Our makefile and configure ensure that this test
11 # does not run in the configured, but the user environment nonetheless!
13 if [ -f ./mk-config.ev ]; then
15 elif [ -f snailmail.jpg ] && [ -f .obj/mk-config.ev ]; then
16 cd .obj
17 i=../
18 else
19 echo >&2 'S-nail/S-mailx is not configured.'
20 echo >&2 'This test script requires the shell environment that only the'
21 echo >&2 'configuration script can figure out, even if it will be used to'
22 echo >&2 'test a different binary than the one that would be produced!'
23 echo >&2 '(The necessary information will be in .obj/mk-config.ev.)'
24 echo >&2 'Hit RETURN to run "make config CONFIG=null'
25 read l
26 make config CONFIG=null
28 . ./mk-config.ev
29 if [ -z "${MAILX__CC_TEST_RUNNING}" ]; then
30 MAILX__CC_TEST_RUNNING=1
31 export MAILX__CC_TEST_RUNNING
32 exec "${SHELL}" "${i}${0}" "${@}"
35 # We need *stealthmua* regardless of $SOURCE_DATE_EPOCH, the program name as
36 # such is a compile-time variable
37 ARGS='-:/ -# -Sdotlock-disable -Sexpandaddr=restrict'
38 ARGS="${ARGS}"' -Smime-encoding=quoted-printable -Snosave -Sstealthmua'
39 ADDARG_UNI=-Sttycharset=UTF-8
40 CONF=../make.rc
41 BODY=./.cc-body.txt
42 MBOX=./.cc-test.mbox
43 ERR=./.cc-test.err # Covers only some which cannot be checksummed; not quoted!
44 MAIL=/dev/null
45 #UTF8_LOCALE= autodetected unless set
47 # Note valgrind has problems with FDs in forked childs, which causes some tests
48 # to fail (the FD is rewound and thus will be dumped twice)
49 MEMTESTER=
50 #MEMTESTER='valgrind --leak-check=full --log-file=.vl-%p '
52 ## -- (>8 -- 8<) -- ##
54 msg() {
55 fmt=${1}
56 shift
57 printf >&2 -- "${fmt}\\n" "${@}"
60 ## -- >8 -- 8< -- ##
62 export ARGS ADDARG_UNI CONF BODY MBOX MAIL MAKE awk cat cksum rm sed grep
64 LC_ALL=C LANG=C
65 TZ=UTC
66 # Wed Oct 2 01:50:07 UTC 1996
67 SOURCE_DATE_EPOCH=844221007
69 export LC_ALL LANG TZ SOURCE_DATE_EPOCH
70 unset POSIXLY_CORRECT LOGNAME USER
72 usage() {
73 ${cat} >&2 <<_EOT
74 Synopsis: cc-test.sh --check-only s-mailx-binary
75 Synopsis: cc-test.sh --mae-test s-mailx-binary [:TEST:]
76 Synopsis: cc-test.sh
78 --check-only EXE run the test series, exit success or error;
79 if run in a git(1) checkout then failed tests
80 create test output data files
81 --mae-test EXE [:TEST:] run all or only the given TESTs, and create
82 test output data files; if run in a git(1)
83 checkout with the [test-out] branch available,
84 it will also create file differences
86 Without arguments as many different configurations as possible
87 will be compiled and tested.
88 _EOT
89 exit 1
92 CHECK_ONLY= MAE_TEST= GIT_REPO= MAILX=
93 if [ "${1}" = --check-only ]; then
94 [ ${#} -eq 2 ] || usage
95 CHECK_ONLY=1 MAILX=${2}
96 [ -x "${MAILX}" ] || usage
97 echo 'Mode: --check-only, binary: '"${MAILX}"
98 [ -d ../.git ] && [ -z "${MAILX__CC_TEST_NO_DATA_FILES}" ] && GIT_REPO=1
99 elif [ "${1}" = --mae-test ]; then
100 [ ${#} -ge 2 ] || usage
101 MAE_TEST=1 MAILX=${2}
102 [ -x "${MAILX}" ] || usage
103 shift 2
104 echo 'Mode: --mae-test, binary: '"${MAILX}"
105 [ -d ../.git ] && GIT_REPO=1
106 else
107 [ ${#} -eq 0 ] || usage
108 echo 'Mode: full compile test, this will take a long time...'
109 MAILX__CC_TEST_NO_DATA_FILES=1
110 export MAILX__CC_TEST_NO_DATA_FILES
113 RAWMAILX=${MAILX}
114 MAILX="${MEMTESTER}${MAILX}"
115 export RAWMAILX MAILX
117 if [ -n "${CHECK_ONLY}${MAE_TEST}" ]; then
118 if [ -z "${UTF8_LOCALE}" ]; then
119 # Try ourselfs via nl_langinfo(CODESET) first (requires a new version)
120 if command -v "${RAWMAILX}" >/dev/null 2>&1 &&
121 ("${RAWMAILX}" -:/ -Xxit) >/dev/null 2>&1; then
122 echo 'Trying to detect UTF-8 locale via '"${RAWMAILX}"
123 i=`LC_ALL=C.utf8 "${RAWMAILX}" ${ARGS} -X '
124 \define cset_test {
125 \if [ "${ttycharset}" @i=% utf ]
126 \echo $LC_ALL
127 \xit 0
128 \end
129 \if [ "${#}" -gt 0 ]
130 \wysh set LC_ALL=${1}
131 \shift
132 \eval xcall cset_test "${@}"
133 \end
134 \xit 1
136 \call cset_test C.UTF-8 POSIX.utf8 POSIX.UTF-8 \
137 en_EN.utf8 en_EN.UTF-8 en_US.utf8 en_US.UTF-8
139 [ $? -eq 0 ] && UTF8_LOCALE=$i
142 if [ -z "${UTF8_LOCALE}" ] && (locale yesexpr) >/dev/null 2>&1; then
143 echo 'Trying to detect UTF-8 locale via locale -a'
144 UTF8_LOCALE=`locale -a | { m=
145 while read n; do
146 if { echo ${n} |
147 ${grep} -i -e utf8 -e utf-8; } >/dev/null 2>&1; then
148 m=${n}
149 if { echo ${n} |
150 ${grep} -e POSIX -e en_EN -e en_US; } \
151 >/dev/null 2>&1; then
152 break
155 done
156 echo ${m}
161 if [ -n "${UTF8_LOCALE}" ]; then
162 echo 'Using Unicode locale '"${UTF8_LOCALE}"
163 else
164 echo 'No Unicode locale found, disabling Unicode tests'
168 ESTAT=0
170 TRAP_EXIT_ADDONS=
171 TEST_NAME=
172 trap "${rm} -rf \"${BODY}\" \"${MBOX}\" \"${ERR}\" \${TRAP_EXIT_ADDONS}" EXIT
173 trap "exit 1" HUP INT TERM
175 have_feat() {
176 ( "${RAWMAILX}" ${ARGS} -X'echo $features' -Xx |
177 ${grep} +${1} ) >/dev/null 2>&1
180 t_prolog() {
181 ${rm} -rf "${BODY}" "${MBOX}" ${TRAP_EXIT_ADDONS}
182 TRAP_EXIT_ADDONS=
183 if [ ${#} -gt 0 ]; then
184 TEST_NAME=${1}
185 printf '[%s]\n' "${1}"
188 t_epilog() {
189 t_prolog
192 t_xmta() {
193 [ ${#} -ge 1 ] && __from=${1} ||
194 __from='Silybum Marianum Tue Apr 17 15:55:01 2018'
195 [ ${#} -eq 2 ] && __to=${2} || __to="${MBOX}"
196 ${cat} <<-_EOT > .tmta.sh
197 #!${SHELL} -
198 ( echo 'From '"${__from}" && ${cat} && echo ) >> "${__to}"
199 _EOT
200 chmod 0755 .tmta.sh
203 check() {
204 restat=${?} tid=${1} eestat=${2} f=${3} s=${4}
205 [ "${eestat}" != - ] && [ "${restat}" != "${eestat}" ] &&
206 err "${TESTNAME}-${tid}" 'unexpected status: '"${restat} != ${eestat}"
207 csum="`${cksum} < ${f}`"
208 if [ "${csum}" = "${s}" ]; then
209 maex=
210 printf '%s-%s: ok\n' "${TEST_NAME}" "${tid}"
211 else
212 maex=yes
213 ESTAT=1
214 printf '%s-%s: error: checksum mismatch (got %s)\n' \
215 "${TEST_NAME}" "${tid}" "${csum}"
218 if [ -n "${CHECK_ONLY}${MAE_TEST}" ]; then
219 x="t.${TEST_NAME}-${tid}"
220 if [ -n "${MAE_TEST}" ] || [ -n "${maex}" -a -n "${GIT_REPO}" ]; then
221 ${cp} -f "${f}" ./"${x}"
224 if [ -n "${maex}" ] && [ -n "${GIT_REPO}" ] &&
225 command -v diff >/dev/null 2>&1 &&
226 (git rev-parse --verify test-out) >/dev/null 2>&1 &&
227 git show test-out:"${x}" > ./"${x}".old 2>/dev/null; then
228 diff -ru ./"${x}".old ./"${x}" > "${x}".diff
233 err() {
234 ESTAT=1
235 printf '%s: error: %s\n' ${1} "${2}"
238 check_ex0() {
239 # $1=test name [$2=status]
240 __qm__=${?}
241 [ ${#} -gt 1 ] && __qm__=${2}
242 if [ ${__qm__} -ne 0 ]; then
243 err "${TEST_NAME}-${1}" 'unexpected non-0 exit status'
244 return 0
245 else
246 printf '%s-%s: ok\n' "${TEST_NAME}" "${1}"
247 return 1
251 check_exn0() {
252 # $1=test name [$2=status]
253 __qm__=${?}
254 [ ${#} -gt 1 ] && __qm__=${2}
255 if [ ${__qm__} -eq 0 ]; then
256 err "${TEST_NAME}-${1}" 'unexpected 0 exit status'
257 return 1
258 else
259 printf '%s-%s: ok\n' "${TEST_NAME}" "${1}"
260 return 0
264 if ( [ "$((1 + 1))" = 2 ] ) >/dev/null 2>&1; then
265 add() {
266 echo "$((${1} + ${2}))"
268 else
269 add() {
270 echo `${awk} 'BEGIN{print '${1}' + '${2}'}'`
274 if ( [ "$((2 % 3))" = 2 ] ) >/dev/null 2>&1; then
275 modulo() {
276 echo "$((${1} % ${2}))"
278 else
279 modulo() {
280 echo `${awk} 'BEGIN{print '${1}' % '${2}'}'`
284 t_all() {
285 t_X_opt_input_command_stack
286 t_X_errexit
287 t_S_freeze
288 t_wysh
289 t_input_inject_semicolon_seq
290 t_commandalias
291 t_ifelse
292 t_localopts
293 t_local
294 t_macro_param_shift
295 t_addrcodec
296 t_vexpr
297 t_call_ret
298 t_xcall
299 t_vpospar
300 t_atxplode
301 t_read
303 t_mbox
304 t_maildir
305 t_record_a_resend
306 t_e_H_L_opts
308 t_alternates
309 t_alias
310 # FIXME t_mlist
311 t_filetype
313 t_message_injections
314 t_attachments
315 t_compose_hooks
316 t_C_opt_customhdr
317 t_quote_a_cmd_escapes
319 t_mass_recipients
320 t_mime_types_load_control
321 t_lreply_futh_rth_etc
323 t_mime_if_not_ascii
324 t_xxxheads_rfc2047
325 t_rfc2231
326 t_iconv_mbyte_base64
327 t_iconv_mainbody
328 t_binary_mainbody
329 t_q_t_etc_opts
331 t_s_mime
334 t_X_opt_input_command_stack() {
335 t_prolog X_opt_input_command_stack
337 ${cat} <<- '__EOT' > "${BODY}"
338 echo 1
339 define mac0 {
340 echo mac0-1 via1 $0
342 call mac0
343 echo 2
344 source '\
345 echo "define mac1 {";\
346 echo " echo mac1-1 via1 \$0";\
347 echo " call mac0";\
348 echo " echo mac1-2";\
349 echo " call mac2";\
350 echo " echo mac1-3";\
351 echo "}";\
352 echo "echo 1-1";\
353 echo "define mac2 {";\
354 echo " echo mac2-1 via1 \$0";\
355 echo " call mac0";\
356 echo " echo mac2-2";\
357 echo "}";\
358 echo "echo 1-2";\
359 echo "call mac1";\
360 echo "echo 1-3";\
361 echo "source \"\
362 echo echo 1-1-1 via1 \$0;\
363 echo call mac0;\
364 echo echo 1-1-2;\
365 | \"";\
366 echo "echo 1-4";\
368 echo 3
369 call mac2
370 echo 4
371 undefine *
372 __EOT
374 # The -X option supports multiline arguments, and those can internally use
375 # reverse solidus newline escaping. And all -X options are joined...
376 APO=\'
377 < "${BODY}" ${MAILX} ${ARGS} \
378 -X 'e\' \
379 -X ' c\' \
380 -X ' h\' \
381 -X ' o \' \
382 -X 1 \
384 define mac0 {
385 echo mac0-1 via2 $0
387 call mac0
388 echo 2
391 source '${APO}'\
392 echo "define mac1 {";\
393 echo " echo mac1-1 via2 \$0";\
394 echo " call mac0";\
395 echo " echo mac1-2";\
396 echo " call mac2";\
397 echo " echo mac1-3";\
398 echo "}";\
399 echo "echo 1-1";\
400 echo "define mac2 {";\
401 echo " echo mac2-1 via2 \$0";\
402 echo " call mac0";\
403 echo " echo mac2-2";\
404 echo "}";\
405 echo "echo 1-2";\
406 echo "call mac1";\
407 echo "echo 1-3";\
408 echo "source \"\
409 echo echo 1-1-1 via2 \$0;\
410 echo call mac0;\
411 echo echo 1-1-2;\
412 | \"";\
413 echo "echo 1-4";\
414 | '${APO}'
415 echo 3
418 call mac2
419 echo 4
420 undefine *
421 ' > "${MBOX}"
423 check 1 0 "${MBOX}" '1786542668 416'
425 t_epilog
428 t_X_errexit() {
429 t_prolog X_errexit
430 if have_feat uistrings; then :; else
431 echo 'x_errexit: unsupported, skipped'
432 return
435 ${cat} <<- '__EOT' > "${BODY}"
436 echo one
437 echos nono
438 echo two
439 __EOT
441 </dev/null ${MAILX} ${ARGS} -Snomemdebug \
442 -X'echo one' -X' echos nono ' -X'echo two' \
443 > "${MBOX}" 2>&1
444 check 1 0 "${MBOX}" '916157812 53'
446 </dev/null ${MAILX} ${ARGS} -X'source '"${BODY}" -Snomemdebug \
447 > "${MBOX}" 2>&1
448 check 2 0 "${MBOX}" '916157812 53'
450 </dev/null MAILRC="${BODY}" ${MAILX} ${ARGS} -:u -Snomemdebug \
451 > "${MBOX}" 2>&1
452 check 3 0 "${MBOX}" '916157812 53'
456 </dev/null ${MAILX} ${ARGS} -Serrexit -Snomemdebug \
457 -X'echo one' -X' echos nono ' -X'echo two' \
458 > "${MBOX}" 2>&1
459 check 4 1 "${MBOX}" '2118430867 49'
461 </dev/null ${MAILX} ${ARGS} -X'source '"${BODY}" -Serrexit -Snomemdebug \
462 > "${MBOX}" 2>&1
463 check 5 1 "${MBOX}" '2118430867 49'
465 </dev/null MAILRC="${BODY}" ${MAILX} ${ARGS} -:u -Serrexit -Snomemdebug \
466 > "${MBOX}" 2>&1
467 check 6 1 "${MBOX}" '12955965 172'
469 </dev/null MAILRC="${BODY}" ${MAILX} ${ARGS} -:u -Sposix -Snomemdebug \
470 > "${MBOX}" 2>&1
471 check 7 1 "${MBOX}" '12955965 172'
473 ## Repeat 4-7 with ignerr set
475 ${sed} -e 's/^echos /ignerr echos /' < "${BODY}" > "${MBOX}"
477 </dev/null ${MAILX} ${ARGS} -Serrexit -Snomemdebug \
478 -X'echo one' -X'ignerr echos nono ' -X'echo two' \
479 > "${BODY}" 2>&1
480 check 8 0 "${BODY}" '916157812 53'
482 </dev/null ${MAILX} ${ARGS} -X'source '"${MBOX}" -Serrexit -Snomemdebug \
483 > "${BODY}" 2>&1
484 check 9 0 "${BODY}" '916157812 53'
486 </dev/null MAILRC="${MBOX}" ${MAILX} ${ARGS} -:u -Serrexit -Snomemdebug \
487 > "${BODY}" 2>&1
488 check 10 0 "${BODY}" '916157812 53'
490 </dev/null MAILRC="${MBOX}" ${MAILX} ${ARGS} -:u -Sposix -Snomemdebug \
491 > "${BODY}" 2>&1
492 check 11 0 "${BODY}" '916157812 53'
494 t_epilog
497 t_S_freeze() {
498 t_prolog S_freeze
499 oterm=$TERM
500 unset TERM
502 # Test basic assumption
503 </dev/null MAILRC="${BODY}" ${MAILX} ${ARGS} \
504 -X'echo asksub<$asksub> dietcurd<$dietcurd>' \
505 -Xx > "${MBOX}" 2>&1
506 check 1 0 "${MBOX}" '270686329 21'
509 ${cat} <<- '__EOT' > "${BODY}"
510 echo asksub<$asksub>
511 set asksub
512 echo asksub<$asksub>
513 __EOT
514 </dev/null MAILRC="${BODY}" ${MAILX} ${ARGS} -:u \
515 -Snoasksub -Sasksub -Snoasksub \
516 -X'echo asksub<$asksub>' -X'set asksub' -X'echo asksub<$asksub>' \
517 -Xx > "${MBOX}" 2>&1
518 check 2 0 "${MBOX}" '3182942628 37'
520 ${cat} <<- '__EOT' > "${BODY}"
521 echo asksub<$asksub>
522 unset asksub
523 echo asksub<$asksub>
524 __EOT
525 </dev/null MAILRC="${BODY}" ${MAILX} ${ARGS} -:u \
526 -Snoasksub -Sasksub \
527 -X'echo asksub<$asksub>' -X'unset asksub' -X'echo asksub<$asksub>' \
528 -Xx > "${MBOX}" 2>&1
529 check 3 0 "${MBOX}" '2006554293 39'
532 ${cat} <<- '__EOT' > "${BODY}"
533 echo dietcurd<$dietcurd>
534 set dietcurd=cherry
535 echo dietcurd<$dietcurd>
536 __EOT
537 </dev/null MAILRC="${BODY}" ${MAILX} ${ARGS} -:u \
538 -Sdietcurd=strawberry -Snodietcurd -Sdietcurd=vanilla \
539 -X'echo dietcurd<$dietcurd>' -X'unset dietcurd' \
540 -X'echo dietcurd<$dietcurd>' \
541 -Xx > "${MBOX}" 2>&1
542 check 4 0 "${MBOX}" '1985768109 65'
544 ${cat} <<- '__EOT' > "${BODY}"
545 echo dietcurd<$dietcurd>
546 unset dietcurd
547 echo dietcurd<$dietcurd>
548 __EOT
549 </dev/null MAILRC="${BODY}" ${MAILX} ${ARGS} -:u \
550 -Sdietcurd=strawberry -Snodietcurd \
551 -X'echo dietcurd<$dietcurd>' -X'set dietcurd=vanilla' \
552 -X'echo dietcurd<$dietcurd>' \
553 -Xx > "${MBOX}" 2>&1
554 check 5 0 "${MBOX}" '151574279 51'
556 # TODO once we have a detached one with env=1..
557 if [ -n "`</dev/null ${MAILX} ${ARGS} -X'!echo \$TERM' -Xx`" ]; then
558 echo 's_freeze-{6,7}: shell sets $TERM, skipped'
559 else
560 ${cat} <<- '__EOT' > "${BODY}"
561 !echo "shell says TERM<$TERM>"
562 echo TERM<$TERM>
563 !echo "shell says TERM<$TERM>"
564 set TERM=cherry
565 !echo "shell says TERM<$TERM>"
566 echo TERM<$TERM>
567 !echo "shell says TERM<$TERM>"
568 __EOT
569 </dev/null MAILRC="${BODY}" ${MAILX} ${ARGS} -:u \
570 -STERM=strawberry -SnoTERM -STERM=vanilla \
571 -X'echo mail<$TERM>' -X'unset TERM' \
572 -X'!echo "shell says TERM<$TERM>"' -X'echo TERM<$TERM>' \
573 -Xx > "${MBOX}" 2>&1
574 check 6 0 "${MBOX}" '1211476036 167'
576 ${cat} <<- '__EOT' > "${BODY}"
577 !echo "shell says TERM<$TERM>"
578 echo TERM<$TERM>
579 !echo "shell says TERM<$TERM>"
580 set TERM=cherry
581 !echo "shell says TERM<$TERM>"
582 echo TERM<$TERM>
583 !echo "shell says TERM<$TERM>"
584 __EOT
585 </dev/null MAILRC="${BODY}" ${MAILX} ${ARGS} -:u \
586 -STERM=strawberry -SnoTERM \
587 -X'echo TERM<$TERM>' -X'set TERM=vanilla' \
588 -X'!echo "shell says TERM<$TERM>"' -X'echo TERM<$TERM>' \
589 -Xx > "${MBOX}" 2>&1
590 check 7 0 "${MBOX}" '3365080441 132'
593 TERM=$oterm
594 t_epilog
597 t_wysh() {
598 t_prolog wysh
600 ${cat} <<- '__EOT' > "${BODY}"
602 echo abcd
603 echo a'b'c'd'
604 echo a"b"c"d"
605 echo a$'b'c$'d'
606 echo 'abcd'
607 echo "abcd"
608 echo $'abcd'
609 echo a\ b\ c\ d
610 echo a 'b c' d
611 echo a "b c" d
612 echo a $'b c' d
614 echo 'a$`"\'
615 echo "a\$\`'\"\\"
616 echo $'a\$`\'\"\\'
617 echo $'a\$`\'"\\'
618 # DIET=CURD TIED=
619 echo 'a${DIET}b${TIED}c\${DIET}d\${TIED}e' # COMMENT
620 echo "a${DIET}b${TIED}c\${DIET}d\${TIED}e"
621 echo $'a${DIET}b${TIED}c\${DIET}d\${TIED}e'
623 echo a$'\101\0101\x41\u0041\u41\U00000041\U41'c
624 echo a$'\u0041\u41\u0C1\U00000041\U41'c
625 echo a$'\377'c
626 echo a$'\0377'c
627 echo a$'\400'c
628 echo a$'\0400'c
629 echo a$'\U1100001'c
631 echo a$'b\0c'd
632 echo a$'b\00c'de
633 echo a$'b\000c'df
634 echo a$'b\0000c'dg
635 echo a$'b\x0c'dh
636 echo a$'b\x00c'di
637 echo a$'b\u0'dj
638 echo a$'b\u00'dk
639 echo a$'b\u000'dl
640 echo a$'b\u0000'dm
641 echo a$'b\U0'dn
642 echo a$'b\U00'do
643 echo a$'b\U000'dp
644 echo a$'b\U0000'dq
645 echo a$'b\U00000'dr
646 echo a$'b\U000000'ds
647 echo a$'b\U0000000'dt
648 echo a$'b\U00000000'du
650 echo a$'\cI'b
651 echo a$'\011'b
652 echo a$'\x9'b
653 echo a$'\u9'b
654 echo a$'\U9'b
655 echo a$'\c@'b c d
656 __EOT
658 if [ -z "${UTF8_LOCALE}" ]; then
659 echo 'Skip wysh-unicode, no UTF8_LOCALE'
660 else
661 < "${BODY}" DIET=CURD TIED= \
662 LC_ALL=${UTF8_LOCALE} ${MAILX} ${ARGS} > "${MBOX}" 2>>${ERR}
663 check unicode 0 "${MBOX}" '475805847 317'
666 < "${BODY}" DIET=CURD TIED= ${MAILX} ${ARGS} > "${MBOX}" 2>>${ERR}
667 check c 0 "${MBOX}" '1473887148 321'
669 ${cat} <<- '__EOT' | ${MAILX} ${ARGS} > "${MBOX}"
670 wysh set mager='\hey\'
671 varshow mager
672 wysh set mager="\hey\\"
673 varshow mager
674 wysh set mager=$'\hey\\'
675 varshow mager
676 __EOT
677 check 3 0 "${MBOX}" '1289698238 69'
679 t_epilog
682 t_input_inject_semicolon_seq() {
683 t_prolog input_inject_semicolon_seq
685 ${cat} <<- '__EOT' | ${MAILX} ${ARGS} > "${MBOX}"
686 define mydeepmac {
687 echon '(mydeepmac)';
689 define mymac {
690 echon this_is_mymac;call mydeepmac;echon ';';
692 echon one';';call mymac;echon two";";call mymac;echo three$';';
693 define mymac {
694 echon this_is_mymac;call mydeepmac;echon ,TOO'!;';
696 echon one';';call mymac;echon two";";call mymac;echo three$';';
697 __EOT
699 check 1 0 "${MBOX}" '512117110 140'
701 t_epilog
704 t_commandalias() {
705 t_prolog commandalias
707 ${cat} <<- '__EOT' | ${MAILX} ${ARGS} > "${MBOX}"
708 commandalias echo echo hoho
709 echo stop.
710 commandalias X Xx
711 commandalias Xx XxX
712 commandalias XxX XxXx
713 commandalias XxXx XxXxX
714 commandalias XxXxX XxXxXx
715 commandalias XxXxXx echo huhu
716 commandalias XxXxXxX echo huhu
718 commandalias XxXxXx XxXxXxX
720 uncommandalias echo
721 commandalias XxXxXx echo huhu
723 __EOT
725 check 1 0 "${MBOX}" '1638809585 36'
727 t_epilog
730 t_ifelse() {
731 t_prolog ifelse
733 # Nestable conditions test
734 ${cat} <<- '__EOT' | ${MAILX} ${ARGS} > "${MBOX}"
735 if 0
736 echo 1.err
737 else
738 echo 1.ok
739 endif
740 if 1
741 echo 2.ok
742 else
743 echo 2.err
744 endif
745 if $dietcurd
746 echo 3.err
747 else
748 echo 3.ok
749 endif
750 set dietcurd=yoho
751 if $dietcurd
752 echo 4.ok
753 else
754 echo 4.err
755 endif
756 if $dietcurd == 'yoho'
757 echo 5.ok
758 else
759 echo 5.err
760 endif
761 if $dietcurd @== 'Yoho'
762 echo 5-1.ok
763 else
764 echo 5-1.err
765 endif
766 if $dietcurd == 'Yoho'
767 echo 5-2.err
768 else
769 echo 5-2.ok
770 endif
771 if $dietcurd != 'yoho'
772 echo 6.err
773 else
774 echo 6.ok
775 endif
776 if $dietcurd @!= 'Yoho'
777 echo 6-1.err
778 else
779 echo 6-1.ok
780 endif
781 if $dietcurd != 'Yoho'
782 echo 6-2.ok
783 else
784 echo 6-2.err
785 endif
786 # Nesting
787 if faLse
788 echo 7.err1
789 if tRue
790 echo 7.err2
791 if yEs
792 echo 7.err3
793 else
794 echo 7.err4
795 endif
796 echo 7.err5
797 endif
798 echo 7.err6
799 else
800 echo 7.ok7
801 if YeS
802 echo 7.ok8
803 if No
804 echo 7.err9
805 else
806 echo 7.ok9
807 endif
808 echo 7.ok10
809 else
810 echo 7.err11
811 if yeS
812 echo 7.err12
813 else
814 echo 7.err13
815 endif
816 endif
817 echo 7.ok14
818 endif
819 if r
820 echo 8.ok1
821 if R
822 echo 8.ok2
823 else
824 echo 8.err2
825 endif
826 echo 8.ok3
827 else
828 echo 8.err1
829 endif
830 if s
831 echo 9.err1
832 else
833 echo 9.ok1
834 if S
835 echo 9.err2
836 else
837 echo 9.ok2
838 endif
839 echo 9.ok3
840 endif
841 # `elif'
842 if $dietcurd == 'yohu'
843 echo 10.err1
844 elif $dietcurd == 'yoha'
845 echo 10.err2
846 elif $dietcurd == 'yohe'
847 echo 10.err3
848 elif $dietcurd == 'yoho'
849 echo 10.ok1
850 if $dietcurd == 'yohu'
851 echo 10.err4
852 elif $dietcurd == 'yoha'
853 echo 10.err5
854 elif $dietcurd == 'yohe'
855 echo 10.err6
856 elif $dietcurd == 'yoho'
857 echo 10.ok2
858 if $dietcurd == 'yohu'
859 echo 10.err7
860 elif $dietcurd == 'yoha'
861 echo 10.err8
862 elif $dietcurd == 'yohe'
863 echo 10.err9
864 elif $dietcurd == 'yoho'
865 echo 10.ok3
866 else
867 echo 10.err10
868 endif
869 else
870 echo 10.err11
871 endif
872 else
873 echo 10.err12
874 endif
875 # integer
876 set dietcurd=10
877 if $dietcurd -lt 11
878 echo 11.ok1
879 if $dietcurd -gt 9
880 echo 11.ok2
881 else
882 echo 11.err2
883 endif
884 if $dietcurd -eq 10
885 echo 11.ok3
886 else
887 echo 11.err3
888 endif
889 if $dietcurd -ge 10
890 echo 11.ok4
891 else
892 echo 11.err4
893 endif
894 if $dietcurd -le 10
895 echo 11.ok5
896 else
897 echo 11.err5
898 endif
899 if $dietcurd -ge 11
900 echo 11.err6
901 else
902 echo 11.ok6
903 endif
904 if $dietcurd -le 9
905 echo 11.err7
906 else
907 echo 11.ok7
908 endif
909 else
910 echo 11.err1
911 endif
912 set dietcurd=Abc
913 if $dietcurd < aBd
914 echo 12.ok1
915 if $dietcurd @> abB
916 echo 12.ok2
917 else
918 echo 12.err2
919 endif
920 if $dietcurd @== aBC
921 echo 12.ok3
922 else
923 echo 12.err3
924 endif
925 if $dietcurd @>= AbC
926 echo 12.ok4
927 else
928 echo 12.err4
929 endif
930 if $dietcurd @<= ABc
931 echo 12.ok5
932 else
933 echo 12.err5
934 endif
935 if $dietcurd @>= abd
936 echo 12.err6
937 else
938 echo 12.ok6
939 endif
940 if $dietcurd @<= abb
941 echo 12.err7
942 else
943 echo 12.ok7
944 endif
945 else
946 echo 12.err1
947 endif
948 if $dietcurd < aBc
949 echo 12-1.ok
950 else
951 echo 12-1.err
952 endif
953 if $dietcurd @< aBc
954 echo 12-2.err
955 else
956 echo 12-2.ok
957 endif
958 if $dietcurd > ABc
959 echo 12-3.ok
960 else
961 echo 12-3.err
962 endif
963 if $dietcurd @> ABc
964 echo 12-3.err
965 else
966 echo 12-3.ok
967 endif
968 if $dietcurd @i=% aB
969 echo 13.ok
970 else
971 echo 13.err
972 endif
973 if $dietcurd =% aB
974 echo 13-1.err
975 else
976 echo 13-1.ok
977 endif
978 if $dietcurd @=% bC
979 echo 14.ok
980 else
981 echo 14.err
982 endif
983 if $dietcurd !% aB
984 echo 15-1.ok
985 else
986 echo 15-1.err
987 endif
988 if $dietcurd @!% aB
989 echo 15-2.err
990 else
991 echo 15-2.ok
992 endif
993 if $dietcurd !% bC
994 echo 15-3.ok
995 else
996 echo 15-3.err
997 endif
998 if $dietcurd @!% bC
999 echo 15-4.err
1000 else
1001 echo 15-4.ok
1002 endif
1003 if $dietcurd =% Cd
1004 echo 16.err
1005 else
1006 echo 16.ok
1007 endif
1008 if $dietcurd !% Cd
1009 echo 17.ok
1010 else
1011 echo 17.err
1012 endif
1013 set diet=abc curd=abc
1014 if $diet == $curd
1015 echo 18.ok
1016 else
1017 echo 18.err
1018 endif
1019 set diet=abc curd=abcd
1020 if $diet != $curd
1021 echo 19.ok
1022 else
1023 echo 19.err
1024 endif
1025 # 1. Shitty grouping capabilities as of today
1026 unset diet curd ndefined
1027 if [ [ false ] || [ false ] || [ true ] ] && [ [ false ] || [ true ] ] && \
1028 [ yes ]
1029 echo 20.ok
1030 else
1031 echo 20.err
1032 endif
1033 if [ [ [ [ 0 ] || [ 1 ] ] && [ [ 1 ] || [ 0 ] ] ] && [ 1 ] ] && [ yes ]
1034 echo 21.ok
1035 else
1036 echo 21.err
1037 endif
1038 if [ [ 1 ] || [ 0 ] || [ 0 ] || [ 0 ] ]
1039 echo 22.ok
1040 else
1041 echo 22.err
1042 endif
1043 if [ [ 1 ] || [ 0 ] || [ 0 ] || [ 0 ] || [ [ 1 ] ] ]
1044 echo 23.ok
1045 else
1046 echo 23.err
1047 endif
1048 if [ [ 1 ] || [ 0 ] || [ 0 ] || [ 0 ] || [ [ 1 ] ] || [ 1 ] ] && [ no ]
1049 echo 24.err
1050 else
1051 echo 24.ok
1052 endif
1053 if [ [ 1 ] || [ 0 ] || [ 0 ] || [ 0 ] || [ [ 1 ] ] || [ 1 ] ] \
1054 && [ no ] || [ yes ]
1055 echo 25.ok
1056 else
1057 echo 25.err
1058 endif
1059 if [ [ [ [ [ [ [ 1 ] ] && [ 1 ] ] && [ 1 ] ] && [ 1 ] ] ] && [ 1 ] ]
1060 echo 26.ok
1061 else
1062 echo 26.err
1063 endif
1064 if [ [ [ [ [ [ [ 1 ] ] && [ 1 ] ] && [ 1 ] ] && [ 1 ] ] ] && [ 0 ] ]
1065 echo 27.err
1066 else
1067 echo 27.ok
1068 endif
1069 if [ [ [ [ [ [ [ 1 ] ] && [ 1 ] ] && [ 0 ] ] && [ 1 ] ] ] && [ 1 ] ]
1070 echo 28.err
1071 else
1072 echo 28.ok
1073 endif
1074 if [ [ [ [ [ [ [ 0 ] ] && [ 1 ] ] && [ 1 ] ] && [ 1 ] ] ] && [ 1 ] ]
1075 echo 29.err
1076 else
1077 echo 29.ok
1078 endif
1079 if [ 1 ] || [ 0 ] || [ 0 ] || [ 0 ] && [ 0 ]
1080 echo 30.err
1081 else
1082 echo 30.ok
1083 endif
1084 if [ 1 ] || [ 0 ] || [ 0 ] || [ 0 ] && [ 1 ]
1085 echo 31.ok
1086 else
1087 echo 31.err
1088 endif
1089 if [ 0 ] || [ 0 ] || [ 0 ] || [ 1 ] && [ 0 ]
1090 echo 32.err
1091 else
1092 echo 32.ok
1093 endif
1094 if [ 0 ] || [ 0 ] || [ 0 ] || [ 1 ] && [ 1 ]
1095 echo 33.ok
1096 else
1097 echo 33.err
1098 endif
1099 if [ 0 ] || [ 0 ] || [ 0 ] || [ 1 ] && [ 0 ] || [ 1 ] && [ 0 ]
1100 echo 34.err
1101 else
1102 echo 34.ok
1103 endif
1104 if [ 0 ] || [ 0 ] || [ 0 ] || [ 1 ] && [ 0 ] || [ 1 ] && [ 1 ]
1105 echo 35.ok
1106 else
1107 echo 35.err
1108 endif
1109 set diet=yo curd=ho
1110 if [ [ $diet == 'yo' ] && [ $curd == 'ho' ] ] && [ $ndefined ]
1111 echo 36.err
1112 else
1113 echo 36.ok
1114 endif
1115 set ndefined
1116 if [ [ $diet == 'yo' ] && [ $curd == 'ho' ] ] && [ $ndefined ]
1117 echo 37.ok
1118 else
1119 echo 37.err
1120 endif
1121 # 2. Shitty grouping capabilities as of today
1122 unset diet curd ndefined
1123 if [ false || false || true ] && [ false || true ] && yes
1124 echo 40.ok
1125 else
1126 echo 40.err
1127 endif
1128 if [ [ [ 0 || 1 ] && [ 1 || 0 ] ] && 1 ] && [ yes ]
1129 echo 41.ok
1130 else
1131 echo 41.err
1132 endif
1133 if [ 1 || 0 || 0 || 0 ]
1134 echo 42.ok
1135 else
1136 echo 42.err
1137 endif
1138 if [ 1 || 0 || 0 || 0 || [ 1 ] ]
1139 echo 43.ok
1140 else
1141 echo 43.err
1142 endif
1143 if [ 1 || 0 || 0 || 0 || [ 1 ] || 1 ] && no
1144 echo 44.err
1145 else
1146 echo 44.ok
1147 endif
1148 if [ 1 || 0 || 0 || 0 || 1 || [ 1 ] ] && no || [ yes ]
1149 echo 45.ok
1150 else
1151 echo 45.err
1152 endif
1153 if [ [ [ [ [ [ 1 ] && 1 ] && 1 ] && 1 ] ] && [ 1 ] ]
1154 echo 46.ok
1155 else
1156 echo 46.err
1157 endif
1158 if [ [ [ [ [ [ 1 ] && 1 ] && 1 ] && [ 1 ] ] ] && 0 ]
1159 echo 47.err
1160 else
1161 echo 47.ok
1162 endif
1163 if [ [ [ [ [ [ [ 1 ] ] && 1 ] && 0 ] && [ 1 ] ] ] && 1 ]
1164 echo 48.err
1165 else
1166 echo 48.ok
1167 endif
1168 if [ [ [ [ [ [ 0 ] && 1 ] && 1 ] && 1 ] ] && 1 ]
1169 echo 49.err
1170 else
1171 echo 49.ok
1172 endif
1173 if 1 || 0 || 0 || 0 && 0
1174 echo 50.err
1175 else
1176 echo 50.ok
1177 endif
1178 if 1 || 0 || 0 || 0 && 1
1179 echo 51.ok
1180 else
1181 echo 51.err
1182 endif
1183 if 0 || 0 || 0 || 1 && 0
1184 echo 52.err
1185 else
1186 echo 52.ok
1187 endif
1188 if 0 || 0 || 0 || 1 && 1
1189 echo 53.ok
1190 else
1191 echo 53.err
1192 endif
1193 if 0 || 0 || 0 || 1 && 0 || 1 && 0
1194 echo 54.err
1195 else
1196 echo 54.ok
1197 endif
1198 if 0 || 0 || 0 || 1 && 0 || 1 && 1
1199 echo 55.ok
1200 else
1201 echo 55.err
1202 endif
1203 set diet=yo curd=ho
1204 if [ $diet == 'yo' && $curd == 'ho' ] && $ndefined
1205 echo 56.err
1206 else
1207 echo 56.ok
1208 endif
1209 if $diet == 'yo' && $curd == 'ho' && $ndefined
1210 echo 57.err
1211 else
1212 echo 57.ok
1213 endif
1214 set ndefined
1215 if [ $diet == 'yo' && $curd == 'ho' ] && $ndefined
1216 echo 57.ok
1217 else
1218 echo 57.err
1219 endif
1220 if $diet == 'yo' && $curd == 'ho' && $ndefined
1221 echo 58.ok
1222 else
1223 echo 58.err
1224 endif
1225 if [ [ [ [ [ [ $diet == 'yo' && $curd == 'ho' && $ndefined ] ] ] ] ] ]
1226 echo 59.ok
1227 else
1228 echo 59.err
1229 endif
1230 # Some more en-braced variables
1231 set diet=yo curd=ho
1232 if ${diet} == ${curd}
1233 echo 70.err
1234 else
1235 echo 70.ok
1236 endif
1237 if ${diet} != ${curd}
1238 echo 71.ok
1239 else
1240 echo 71.err
1241 endif
1242 if $diet == ${curd}
1243 echo 72.err
1244 else
1245 echo 72.ok
1246 endif
1247 if ${diet} == $curd
1248 echo 73.err
1249 else
1250 echo 73.ok
1251 endif
1252 # Unary !
1253 if ! 0 && ! ! 1 && ! ! ! ! 2 && 3
1254 echo 80.ok
1255 else
1256 echo 80.err
1257 endif
1258 if ! 0 && ! [ ! 1 ] && ! [ ! [ ! [ ! 2 ] ] ] && 3
1259 echo 81.ok
1260 else
1261 echo 81.err
1262 endif
1263 if [ ! 0 ] && [ ! [ ! 1 ] ] && [ ! [ ! [ ! [ ! [ 2 ] ] ] ] ] && 3
1264 echo 82.ok
1265 else
1266 echo 82.err
1267 endif
1268 if [ ! 0 ] && [ ! [ ! 1 ] ] && [ ! [ ! [ ! [ ! [ 2 ] ] ] ] ] && ! 3
1269 echo 83.err
1270 else
1271 echo 83.ok
1272 endif
1273 if [ ! 0 ] && [ ! [ ! 1 ] ] && ! [ [ ! [ ! [ ! [ 2 ] ] ] ] ] && ! 3
1274 echo 84.err
1275 else
1276 echo 84.ok
1277 endif
1278 if [ ! 0 ] && ! [ ! [ ! 1 ] ] && [ ! [ ! [ ! [ ! [ 2 ] ] ] ] ] && 3
1279 echo 85.err
1280 else
1281 echo 85.ok
1282 endif
1283 if ! [ ! 0 ] && [ ! [ ! 1 ] ] && [ ! [ ! [ ! [ ! [ 2 ] ] ] ] ] && 3
1284 echo 86.err
1285 else
1286 echo 86.ok
1287 endif
1288 if [ ! 0 ] && [ ! [ ! 1 ] ] && [ ! [ ! [ ! [ ! [ 2 ] ] ] ] ] || 3
1289 echo 87.ok
1290 else
1291 echo 87.err
1292 endif
1293 if [ ! 0 ] && [ ! ! [ ! ! 1 ] ] && [ ! ! [ ! ! [ ! ! [ ! ! [ 2 ] ] ] ] ]
1294 echo 88.ok
1295 else
1296 echo 88.err
1297 endif
1298 # Unary !, odd
1299 if ! 0 && ! ! 1 && ! ! ! 0 && 3
1300 echo 90.ok
1301 else
1302 echo 90.err
1303 endif
1304 if ! 0 && ! [ ! 1 ] && ! [ ! [ ! [ 0 ] ] ] && 3
1305 echo 91.ok
1306 else
1307 echo 91.err
1308 endif
1309 if [ ! 0 ] && [ ! [ ! 1 ] ] && [ ! [ ! [ ! [ [ 0 ] ] ] ] ] && 3
1310 echo 92.ok
1311 else
1312 echo 92.err
1313 endif
1314 if [ ! 0 ] && [ ! [ ! 1 ] ] && [ ! [ ! ! [ ! [ ! 0 ] ] ] ] && ! 3
1315 echo 93.err
1316 else
1317 echo 93.ok
1318 endif
1319 if [ ! 0 ] && [ ! [ ! 1 ] ] && ! [ ! [ ! [ ! [ ! 0 ] ] ] ] && 3
1320 echo 94.ok
1321 else
1322 echo 94.err
1323 endif
1324 if [ ! 0 ] && ! [ ! [ ! 1 ] ] && [ ! ! [ ! [ ! [ ! [ 0 ] ] ] ] ] && 3
1325 echo 95.err
1326 else
1327 echo 95.ok
1328 endif
1329 if ! [ ! 0 ] && [ ! [ ! 1 ] ] && [ ! [ ! [ ! [ ! ! 0 ] ] ] ] && 3
1330 echo 96.err
1331 else
1332 echo 96.ok
1333 endif
1334 if [ ! 0 ] && [ ! [ ! 1 ] ] && [ ! [ ! [ ! [ ! [ ! 0 ] ] ] ] ] || 3
1335 echo 97.ok
1336 else
1337 echo 97.err
1338 endif
1339 if [ ! 0 ] && [ ! ! [ ! ! 1 ] ] && [ ! ! [ ! ! [ ! ! [ ! [ 0 ] ] ] ] ]
1340 echo 98.ok
1341 else
1342 echo 98.err
1343 endif
1344 __EOT
1346 check normal 0 "${MBOX}" '1688759742 719'
1348 if have_feat regex; then
1349 ${cat} <<- '__EOT' | ${MAILX} ${ARGS} > "${MBOX}"
1350 set dietcurd=yoho
1351 if $dietcurd =~ '^yo.*'
1352 echo 1.ok
1353 else
1354 echo 1.err
1355 endif
1356 if $dietcurd =~ '^Yo.*'
1357 echo 1-1.err
1358 else
1359 echo 1-1.ok
1360 endif
1361 if $dietcurd @=~ '^Yo.*'
1362 echo 1-2.ok
1363 else
1364 echo 1-2.err
1365 endif
1366 if $dietcurd =~ '^yOho.+'
1367 echo 2.err
1368 else
1369 echo 2.ok
1370 endif
1371 if $dietcurd @!~ '.*Ho$'
1372 echo 3.err
1373 else
1374 echo 3.ok
1375 endif
1376 if $dietcurd !~ '.+yohO$'
1377 echo 4.ok
1378 else
1379 echo 4.err
1380 endif
1381 if [ $dietcurd @i!~ '.+yoho$' ]
1382 echo 5.ok
1383 else
1384 echo 5.err
1385 endif
1386 if ! [ $dietcurd @i=~ '.+yoho$' ]
1387 echo 6.ok
1388 else
1389 echo 6.err
1390 endif
1391 if ! ! [ $dietcurd @i!~ '.+yoho$' ]
1392 echo 7.ok
1393 else
1394 echo 7.err
1395 endif
1396 if ! [ ! [ $dietcurd @i!~ '.+yoho$' ] ]
1397 echo 8.ok
1398 else
1399 echo 8.err
1400 endif
1401 if [ ! [ ! [ $dietcurd @i!~ '.+yoho$' ] ] ]
1402 echo 9.ok
1403 else
1404 echo 9.err
1405 endif
1406 if ! [ ! [ ! [ $dietcurd !~ '.+yoho$' ] ] ]
1407 echo 10.err
1408 else
1409 echo 10.ok
1410 endif
1411 if ! ! ! $dietcurd !~ '.+yoho$'
1412 echo 11.err
1413 else
1414 echo 11.ok
1415 endif
1416 if ! ! ! $dietcurd =~ '.+yoho$'
1417 echo 12.ok
1418 else
1419 echo 12.err
1420 endif
1421 if ! [ ! ! [ ! [ $dietcurd !~ '.+yoho$' ] ] ]
1422 echo 13.ok
1423 else
1424 echo 13.err
1425 endif
1426 set diet=abc curd='^abc$'
1427 if $diet =~ $curd
1428 echo 14.ok
1429 else
1430 echo 14.err
1431 endif
1432 set diet=abc curd='^abcd$'
1433 if $diet !~ $curd
1434 echo 15.ok
1435 else
1436 echo 15.err
1437 endif
1438 __EOT
1440 check regex 0 "${MBOX}" '1115671789 95'
1441 else
1442 printf 'if-regex: unsupported, skipped\n'
1445 t_epilog
1448 t_localopts() {
1449 t_prolog localopts
1451 # Nestable conditions test
1452 ${cat} <<- '__EOT' | ${MAILX} ${ARGS} > "${MBOX}" 2>&1
1453 define t2 {
1454 echo in: t2
1455 set t2=t2
1456 echo $t2
1458 define t1 {
1459 echo in: t1
1460 set gv1=gv1
1461 localopts on
1462 set lv1=lv1 lv2=lv2
1463 set lv3=lv3
1464 call t2
1465 localopts off
1466 set gv2=gv2
1467 echo $gv1 $lv1 ${lv2} ${lv3} ${gv2}, $t2
1469 define t0 {
1470 echo in: t0
1471 call t1
1472 echo $gv1 $lv1 ${lv2} ${lv3} ${gv2}, $t2
1473 echo "$gv1 $lv1 ${lv2} ${lv3} ${gv2}, $t2"
1475 account trouble {
1476 echo in: trouble
1477 call t0
1479 call t0
1480 unset gv1 gv2
1481 account trouble
1482 echo active trouble: $gv1 $lv1 ${lv2} ${lv3} ${gv2}, $t3
1483 account null
1484 echo active null: $gv1 $lv1 ${lv2} ${lv3} ${gv2}, $t3
1487 define ll2 {
1488 localopts $1
1489 set x=2
1490 echo ll2=$x
1492 define ll1 {
1493 wysh set y=$1; shift; eval localopts $y; localopts $1; shift
1494 set x=1
1495 echo ll1.1=$x
1496 call ll2 $1
1497 echo ll1.2=$x
1499 define ll0 {
1500 wysh set y=$1; shift; eval localopts $y; localopts $1; shift
1501 set x=0
1502 echo ll0.1=$x
1503 call ll1 $y "$@"
1504 echo ll0.2=$x
1506 define llx {
1507 echo ----- $1: $2 -> $3 -> $4
1508 echo ll-1.1=$x
1509 eval localopts $1
1510 call ll0 "$@"
1511 echo ll-1.2=$x
1512 unset x
1514 define lly {
1515 call llx 'call off' on on on
1516 call llx 'call off' off on on
1517 call llx 'call off' on off on
1518 call llx 'call off' on off off
1519 localopts call-fixate on
1520 call llx 'call-fixate on' on on on
1521 call llx 'call-fixate on' off on on
1522 call llx 'call-fixate on' on off on
1523 call llx 'call-fixate on' on off off
1524 unset x;localopts call on
1525 call llx 'call on' on on on
1526 call llx 'call on' off on on
1527 call llx 'call on' on off on
1528 call llx 'call on' on off off
1530 call lly
1531 __EOT
1533 check 1 0 "${MBOX}" '4016155249 1246'
1535 t_epilog
1538 t_local() {
1539 t_prolog local
1541 ${cat} <<- '__EOT' | ${MAILX} ${ARGS} > "${MBOX}" 2>&1
1542 define du2 {
1543 echo du2-1 du=$du
1544 local set du=$1
1545 echo du2-2 du=$du
1546 local unset du
1547 echo du2-3 du=$du
1549 define du {
1550 local set du=dudu
1551 echo du-1 du=$du
1552 call du2 du2du2
1553 echo du-2 du=$du
1554 local set nodu
1555 echo du-3 du=$du
1557 define ich {
1558 echo ich-1 du=$du
1559 call du
1560 echo ich-2 du=$du
1562 define wir {
1563 localopts $1
1564 set du=wirwir
1565 echo wir-1 du=$du
1566 call ich
1567 echo wir-2 du=$du
1569 echo ------- global-1 du=$du
1570 call ich
1571 echo ------- global-2 du=$du
1572 set du=global
1573 call ich
1574 echo ------- global-3 du=$du
1575 call wir on
1576 echo ------- global-4 du=$du
1577 call wir off
1578 echo ------- global-5 du=$du
1579 __EOT
1581 check 1 0 "${MBOX}" '2411598140 641'
1583 t_epilog
1586 t_macro_param_shift() {
1587 t_prolog macro_param_shift
1589 ${cat} <<- '__EOT' | ${MAILX} ${ARGS} > "${MBOX}" 2>>${ERR}
1590 define t2 {
1591 echo in: t2
1592 echo t2.0 has $#/${#} parameters: "$1,${2},$3" (${*}) [$@]
1593 localopts on
1594 wysh set ignerr=$1
1595 shift
1596 localopts off
1597 echo t2.1 has $#/${#} parameters: "$1,${2},$3" (${*}) [$@]
1598 if [ $# > 1 ] || [ $ignerr == '' ]
1599 shift 2
1600 else
1601 ignerr shift 2
1602 endif
1603 echo t2.2:$? has $#/${#} parameters: "$1,${2},$3" (${*}) [$@]
1604 shift 0
1605 echo t2.3:$? has $#/${#} parameters: "$1,${2},$3" (${*}) [$@]
1606 if [ $# > 0 ]
1607 shift
1608 endif
1609 echo t2.4:$? has $#/${#} parameters: "$1,${2},$3" (${*}) [$@]
1611 define t1 {
1612 set errexit
1613 echo in: t1
1614 call t2 1 you get four args
1615 echo t1.1: $?';' ignerr ($ignerr) should not exist
1616 call t2 1 you get 'three args'
1617 echo t1.2: $?';' ignerr ($ignerr) should not exist
1618 call t2 1 you 'get two args'
1619 echo t1.3: $?';' ignerr ($ignerr) should not exist
1620 call t2 1 'you get one arg'
1621 echo t1.4: $?';' ignerr ($ignerr) should not exist
1622 ignerr call t2 '' 'you get one arg'
1623 echo t1.5: $?';' ignerr ($ignerr) should not exist
1625 call t1
1626 __EOT
1628 check 1 0 "${MBOX}" '1402489146 1682'
1630 t_epilog
1633 t_addrcodec() {
1634 t_prolog addrcodec
1636 ${cat} <<- '__EOT' | ${MAILX} ${ARGS} > "${MBOX}" 2>&1
1637 vput addrcodec res e 1 <doog@def>
1638 echo $?/$^ERRNAME $res
1639 eval vput addrcodec res d $res
1640 echo $?/$^ERRNAME $res
1641 vput addrcodec res e 2 . <doog@def>
1642 echo $?/$^ERRNAME $res
1643 eval vput addrcodec res d $res
1644 echo $?/$^ERRNAME $res
1645 vput addrcodec res e 3 Sauer Dr. <doog@def>
1646 echo $?/$^ERRNAME $res
1647 eval vput addrcodec res d $res
1648 echo $?/$^ERRNAME $res
1649 vput addrcodec res e 3.50 Sauer (Ma) Dr. <doog@def>
1650 echo $?/$^ERRNAME $res
1651 eval vput addrcodec res d $res
1652 echo $?/$^ERRNAME $res
1653 vput addrcodec res e 3.51 Sauer (Ma) "Dr." <doog@def>
1654 echo $?/$^ERRNAME $res
1655 eval vput addrcodec res d $res
1656 echo $?/$^ERRNAME $res
1658 vput addrcodec res +e 4 Sauer (Ma) Dr. <doog@def>
1659 echo $?/$^ERRNAME $res
1660 eval vput addrcodec res d $res
1661 echo $?/$^ERRNAME $res
1662 vput addrcodec res +e 5 Sauer (Ma) Braten Dr. <doog@def>
1663 echo $?/$^ERRNAME $res
1664 eval vput addrcodec res d $res
1665 echo $?/$^ERRNAME $res
1666 vput addrcodec res +e 6 Sauer (Ma) Braten Dr. (Heu) <doog@def>
1667 echo $?/$^ERRNAME $res
1668 eval vput addrcodec res d $res
1669 echo $?/$^ERRNAME $res
1670 vput addrcodec res +e 7 Sauer (Ma) Braten Dr. (Heu) <doog@def> (bu)
1671 echo $?/$^ERRNAME $res
1672 eval vput addrcodec res d $res
1673 echo $?/$^ERRNAME $res
1674 vput addrcodec res +e 8 \
1675 Dr. Sauer (Ma) Braten Dr. (Heu) <doog@def> (bu) Boom. Boom
1676 echo $?/$^ERRNAME $res
1677 eval vput addrcodec res d $res
1678 echo $?/$^ERRNAME $res
1679 vput addrcodec res +e 9 Dr.Sauer(Ma)Braten Dr. (Heu) <doog@def>
1680 echo $?/$^ERRNAME $res
1681 eval vput addrcodec res d $res
1682 echo $?/$^ERRNAME $res
1683 vput addrcodec res +e 10 (Ma)Braten Dr. (Heu) <doog@def>
1684 echo $?/$^ERRNAME $res
1685 eval vput addrcodec res d $res
1686 echo $?/$^ERRNAME $res
1687 vput addrcodec res +e 11 (Ma)Braten Dr"." (Heu) <doog@def>
1688 echo $?/$^ERRNAME $res
1689 eval vput addrcodec res d $res
1690 echo $?/$^ERRNAME $res
1691 vput addrcodec res +e 12 Dr. Sauer (Ma) Braten Dr. (u) <doog@def>
1692 echo $?/$^ERRNAME $res
1693 eval vput addrcodec res d $res
1694 echo $?/$^ERRNAME $res
1695 vput addrcodec res +e 13(Ma)Braten Dr. (Heu) <doog@def>
1696 echo $?/$^ERRNAME $res
1697 eval vput addrcodec res d $res
1698 echo $?/$^ERRNAME $res
1699 vput addrcodec res +e 14 Hey, Du <doog@def> Wie() findet Dr. das? ()
1700 echo $?/$^ERRNAME $res
1701 eval vput addrcodec res d $res
1702 echo $?/$^ERRNAME $res
1703 vput addrcodec res +e 15 \
1704 Hey, Du <doog@def> Wie() findet "" Dr. "" das? ()
1705 echo $?/$^ERRNAME $res
1706 eval vput addrcodec res d $res
1707 echo $?/$^ERRNAME $res
1708 vput addrcodec res +e 16 \
1709 "Hey," "Du" <doog@def> "Wie()" findet "" Dr. "" das? ()
1710 echo $?/$^ERRNAME $res
1711 eval vput addrcodec res d $res
1712 echo $?/$^ERRNAME $res
1713 vput addrcodec res +e 17 \
1714 "Hey" Du <doog@def> "Wie() findet " " Dr. """ das? ()
1715 echo $?/$^ERRNAME $res
1716 eval vput addrcodec res d $res
1717 echo $?/$^ERRNAME $res
1718 vput addrcodec res +e 18 \
1719 <doog@def> "Hey" Du "Wie() findet " " Dr. """ das? ()
1720 echo $?/$^ERRNAME $res
1721 eval vput addrcodec res d $res
1722 echo $?/$^ERRNAME $res
1723 vput addrcodec res +e 19 Hey\,\" <doog@def> "Wie()" findet \" Dr. \" das?
1724 echo $?/$^ERRNAME $res
1725 eval vput addrcodec res d $res
1726 echo $?/$^ERRNAME $res
1728 vput addrcodec res ++e 20 Hey\,\" <doog@def> "Wie()" findet \" Dr. \" das?
1729 echo $?/$^ERRNAME $res
1730 vput addrcodec res ++e 21 Hey\,\"" <doog@def> "Wie()" findet \" Dr. \" das?
1731 echo $?/$^ERRNAME $res
1732 eval vput addrcodec res d $res
1733 echo $?/$^ERRNAME $res
1735 vput addrcodec res +++e 22 Hey\\,\" <doog@def> "Wie()" findet \" Dr. \" das?
1736 echo $?/$^ERRNAME $res
1737 eval vput addrcodec res d $res
1738 echo $?/$^ERRNAME $res
1740 vput addrcodec res s \
1741 "23 Hey\\,\\\" \"Wie" () "\" findet \\\" Dr. \\\" das?" <doog@def>
1742 echo $?/$^ERRNAME $res
1744 # Fix for [f3852f88]
1745 vput addrcodec res ++e <from2@exam.ple> 100 (comment) "Quot(e)d"
1746 echo $?/$^ERRNAME $res
1747 eval vput addrcodec res d $res
1748 echo $?/$^ERRNAME $res
1749 vput addrcodec res e <from2@exam.ple> 100 (comment) "Quot(e)d"
1750 echo $?/$^ERRNAME $res
1751 eval vput addrcodec res d $res
1752 echo $?/$^ERRNAME $res
1753 __EOT
1755 check 1 0 "${MBOX}" '1047317989 2612'
1757 ${cat} <<- '__EOT' | ${MAILX} ${ARGS} > "${MBOX}" 2>&1
1758 mlist isa1@list
1759 mlsubscribe isa2@list
1761 vput addrcodec res skin Hey\\,\" <isa0@list> "Wie()" find \" Dr. \" das?
1762 echo $?/$^ERRNAME $res
1763 vput addrcodec res skinlist Hey\\,\" <isa0@list> "Wie()" find \" Dr. \" das?
1764 echo $?/$^ERRNAME $res
1765 vput addrcodec res skin Hey\\,\" <isa1@list> "Wie()" find \" Dr. \" das?
1766 echo $?/$^ERRNAME $res
1767 vput addrcodec res skinlist Hey\\,\" <isa1@list> "Wie()" find \" Dr. \" das?
1768 echo $?/$^ERRNAME $res
1769 vput addrcodec res skin Hey\\,\" <isa2@list> "Wie()" find \" Dr. \" das?
1770 echo $?/$^ERRNAME $res
1771 vput addrcodec res skinlist Hey\\,\" <isa2@list> "Wie()" find \" Dr. \" das?
1772 echo $?/$^ERRNAME $res
1773 __EOT
1775 check 2 0 "${MBOX}" '1391779299 104'
1777 if have_feat idna; then
1778 ${cat} <<- '__EOT' | ${MAILX} ${ARGS} ${ADDARG_UNI} > "${MBOX}" 2>&1
1779 vput addrcodec res e (heu) <du@blödiän> "stroh" du
1780 echo $?/$^ERRNAME $res
1781 eval vput addrcodec res d $res
1782 echo $?/$^ERRNAME $res
1783 vput addrcodec res e <du@blödiän> du
1784 echo $?/$^ERRNAME $res
1785 eval vput addrcodec res d $res
1786 echo $?/$^ERRNAME $res
1787 vput addrcodec res e du <du@blödiän>
1788 echo $?/$^ERRNAME $res
1789 eval vput addrcodec res d $res
1790 echo $?/$^ERRNAME $res
1791 vput addrcodec res e <du@blödiän>
1792 echo $?/$^ERRNAME $res
1793 eval vput addrcodec res d $res
1794 echo $?/$^ERRNAME $res
1795 vput addrcodec res e du@blödiän
1796 echo $?/$^ERRNAME $res
1797 eval vput addrcodec res d $res
1798 echo $?/$^ERRNAME $res
1799 __EOT
1801 check idna 0 "${MBOX}" '498775983 326'
1802 else
1803 printf 'addrcodec-idna: unsupported, skipped\n'
1806 t_epilog
1809 t_vexpr() {
1810 t_prolog vexpr
1812 ${cat} <<- '__EOT' | ${MAILX} ${ARGS} > "${MBOX}" 2>>${ERR}
1813 echo ' #0.0'
1814 vput vexpr res = 9223372036854775807
1815 echo $?/$^ERRNAME $res
1816 vput vexpr res = 9223372036854775808
1817 echo $?/$^ERRNAME $res
1818 vput vexpr res = u9223372036854775808
1819 echo $?/$^ERRNAME $res
1820 vput vexpr res @= 9223372036854775808
1821 echo $?/$^ERRNAME $res
1822 vput vexpr res = -9223372036854775808
1823 echo $?/$^ERRNAME $res
1824 vput vexpr res = -9223372036854775809
1825 echo $?/$^ERRNAME $res
1826 vput vexpr res @= -9223372036854775809
1827 echo $?/$^ERRNAME $res
1828 vput vexpr res = U9223372036854775809
1829 echo $?/$^ERRNAME $res
1830 echo ' #0.1'
1831 vput vexpr res = \
1832 0b0111111111111111111111111111111111111111111111111111111111111111
1833 echo $?/$^ERRNAME $res
1834 vput vexpr res = \
1835 S0b1000000000000000000000000000000000000000000000000000000000000000
1836 echo $?/$^ERRNAME $res
1837 vput vexpr res @= \
1838 S0b1000000000000000000000000000000000000000000000000000000000000000
1839 echo $?/$^ERRNAME $res
1840 vput vexpr res = \
1841 U0b1000000000000000000000000000000000000000000000000000000000000000
1842 echo $?/$^ERRNAME $res
1843 vput vexpr res = \
1844 0b1000000000000000000000000000000000000000000000000000000000000000
1845 echo $?/$^ERRNAME $res
1846 vput vexpr res @= \
1847 0b1000000000000000000000000000000000000000000000000000000000000000
1848 echo $?/$^ERRNAME $res
1849 vput vexpr res = \
1850 -0b1000000000000000000000000000000000000000000000000000000000000000
1851 echo $?/$^ERRNAME $res
1852 vput vexpr res = \
1853 S0b1000000000000000000000000000000000000000000000000000000000000001
1854 echo $?/$^ERRNAME $res
1855 vput vexpr res @= \
1856 S0b1000000000000000000000000000000000000000000000000000000000000001
1857 echo $?/$^ERRNAME $res
1858 vput vexpr res @= \
1859 -0b1000000000000000000000000000000000000000000000000000000000000001
1860 echo $?/$^ERRNAME $res
1861 vput vexpr res = \
1862 U0b1000000000000000000000000000000000000000000000000000000000000001
1863 echo $?/$^ERRNAME $res
1864 echo ' #0.2'
1865 vput vexpr res = 0777777777777777777777
1866 echo $?/$^ERRNAME $res
1867 vput vexpr res = S01000000000000000000000
1868 echo $?/$^ERRNAME $res
1869 vput vexpr res @= S01000000000000000000000
1870 echo $?/$^ERRNAME $res
1871 vput vexpr res = U01000000000000000000000
1872 echo $?/$^ERRNAME $res
1873 vput vexpr res = 01000000000000000000000
1874 echo $?/$^ERRNAME $res
1875 vput vexpr res @= 01000000000000000000000
1876 echo $?/$^ERRNAME $res
1877 vput vexpr res = -01000000000000000000000
1878 echo $?/$^ERRNAME $res
1879 vput vexpr res = S01000000000000000000001
1880 echo $?/$^ERRNAME $res
1881 vput vexpr res @= S01000000000000000000001
1882 echo $?/$^ERRNAME $res
1883 vput vexpr res @= -01000000000000000000001
1884 echo $?/$^ERRNAME $res
1885 vput vexpr res = U01000000000000000000001
1886 echo $?/$^ERRNAME $res
1887 echo ' #0.3'
1888 vput vexpr res = 0x7FFFFFFFFFFFFFFF
1889 echo $?/$^ERRNAME $res
1890 vput vexpr res = S0x8000000000000000
1891 echo $?/$^ERRNAME $res
1892 vput vexpr res @= S0x8000000000000000
1893 echo $?/$^ERRNAME $res
1894 vput vexpr res = U0x8000000000000000
1895 echo $?/$^ERRNAME $res
1896 vput vexpr res = 0x8000000000000000
1897 echo $?/$^ERRNAME $res
1898 vput vexpr res @= 0x8000000000000000
1899 echo $?/$^ERRNAME $res
1900 vput vexpr res = -0x8000000000000000
1901 echo $?/$^ERRNAME $res
1902 vput vexpr res = S0x8000000000000001
1903 echo $?/$^ERRNAME $res
1904 vput vexpr res @= S0x8000000000000001
1905 echo $?/$^ERRNAME $res
1906 vput vexpr res @= -0x8000000000000001
1907 echo $?/$^ERRNAME $res
1908 vput vexpr res = u0x8000000000000001
1909 echo $?/$^ERRNAME $res
1910 echo ' #1'
1911 vput vexpr res ~ 0
1912 echo $?/$^ERRNAME $res
1913 vput vexpr res ~ 1
1914 echo $?/$^ERRNAME $res
1915 vput vexpr res ~ -1
1916 echo $?/$^ERRNAME $res
1917 echo ' #2'
1918 vput vexpr res + 0 0
1919 echo $?/$^ERRNAME $res
1920 vput vexpr res + 0 1
1921 echo $?/$^ERRNAME $res
1922 vput vexpr res + 1 1
1923 echo $?/$^ERRNAME $res
1924 echo ' #3'
1925 vput vexpr res + 9223372036854775807 0
1926 echo $?/$^ERRNAME $res
1927 vput vexpr res + 9223372036854775807 1
1928 echo $?/$^ERRNAME $res
1929 vput vexpr res @+ 9223372036854775807 1
1930 echo $?/$^ERRNAME $res
1931 vput vexpr res + 0 9223372036854775807
1932 echo $?/$^ERRNAME $res
1933 vput vexpr res + 1 9223372036854775807
1934 echo $?/$^ERRNAME $res
1935 vput vexpr res @+ 1 9223372036854775807
1936 echo $?/$^ERRNAME $res
1937 echo ' #4'
1938 vput vexpr res + -9223372036854775808 0
1939 echo $?/$^ERRNAME $res
1940 vput vexpr res + -9223372036854775808 -1
1941 echo $?/$^ERRNAME $res
1942 vput vexpr res @+ -9223372036854775808 -1
1943 echo $?/$^ERRNAME $res
1944 vput vexpr res + 0 -9223372036854775808
1945 echo $?/$^ERRNAME $res
1946 vput vexpr res + -1 -9223372036854775808
1947 echo $?/$^ERRNAME $res
1948 vput vexpr res @+ -1 -9223372036854775808
1949 echo $?/$^ERRNAME $res
1950 echo ' #5'
1951 vput vexpr res - 0 0
1952 echo $?/$^ERRNAME $res
1953 vput vexpr res - 0 1
1954 echo $?/$^ERRNAME $res
1955 vput vexpr res - 1 1
1956 echo $?/$^ERRNAME $res
1957 echo ' #6'
1958 vput vexpr res - 9223372036854775807 0
1959 echo $?/$^ERRNAME $res
1960 vput vexpr res - 9223372036854775807 -1
1961 echo $?/$^ERRNAME $res
1962 vput vexpr res @- 9223372036854775807 -1
1963 echo $?/$^ERRNAME $res
1964 vput vexpr res - 0 9223372036854775807
1965 echo $?/$^ERRNAME $res
1966 vput vexpr res - -1 9223372036854775807
1967 echo $?/$^ERRNAME $res
1968 vput vexpr res - -2 9223372036854775807
1969 echo $?/$^ERRNAME $res
1970 vput vexpr res @- -2 9223372036854775807
1971 echo $?/$^ERRNAME $res
1972 echo ' #7'
1973 vput vexpr res - -9223372036854775808 +0
1974 echo $?/$^ERRNAME $res
1975 vput vexpr res - -9223372036854775808 +1
1976 echo $?/$^ERRNAME $res
1977 vput vexpr res @- -9223372036854775808 +1
1978 echo $?/$^ERRNAME $res
1979 vput vexpr res - 0 -9223372036854775808
1980 echo $?/$^ERRNAME $res
1981 vput vexpr res - +1 -9223372036854775808
1982 echo $?/$^ERRNAME $res
1983 vput vexpr res @- +1 -9223372036854775808
1984 echo $?/$^ERRNAME $res
1985 echo ' #8'
1986 vput vexpr res + -13 -2
1987 echo $?/$^ERRNAME $res
1988 vput vexpr res - 0 0
1989 echo $?/$^ERRNAME $res
1990 vput vexpr res - 0 1
1991 echo $?/$^ERRNAME $res
1992 vput vexpr res - 1 1
1993 echo $?/$^ERRNAME $res
1994 vput vexpr res - -13 -2
1995 echo $?/$^ERRNAME $res
1996 echo ' #9'
1997 vput vexpr res * 0 0
1998 echo $?/$^ERRNAME $res
1999 vput vexpr res * 0 1
2000 echo $?/$^ERRNAME $res
2001 vput vexpr res * 1 1
2002 echo $?/$^ERRNAME $res
2003 vput vexpr res * -13 -2
2004 echo $?/$^ERRNAME $res
2005 echo ' #10'
2006 vput vexpr res / 0 0
2007 echo $?/$^ERRNAME $res
2008 vput vexpr res / 0 1
2009 echo $?/$^ERRNAME $res
2010 vput vexpr res / 1 1
2011 echo $?/$^ERRNAME $res
2012 vput vexpr res / -13 -2
2013 echo $?/$^ERRNAME $res
2014 echo ' #11'
2015 vput vexpr res % 0 0
2016 echo $?/$^ERRNAME $res
2017 vput vexpr res % 0 1
2018 echo $?/$^ERRNAME $res
2019 vput vexpr res % 1 1
2020 echo $?/$^ERRNAME $res
2021 vput vexpr res % -13 -2
2022 echo $?/$^ERRNAME $res
2023 __EOT
2025 check numeric 0 "${MBOX}" '960821755 1962'
2027 ${cat} <<- '__EOT' | ${MAILX} ${ARGS} > "${MBOX}" 2>&1
2028 vput vexpr res find 'bananarama' 'nana'
2029 echo $?/$^ERRNAME :$res:
2030 vput vexpr res find 'bananarama' 'bana'
2031 echo $?/$^ERRNAME :$res:
2032 vput vexpr res find 'bananarama' 'Bana'
2033 echo $?/$^ERRNAME :$res:
2034 vput vexpr res find 'bananarama' 'rama'
2035 echo $?/$^ERRNAME :$res:
2036 echo ' #1'
2037 vput vexpr res ifind 'bananarama' 'nana'
2038 echo $?/$^ERRNAME :$res:
2039 vput vexpr res ifind 'bananarama' 'bana'
2040 echo $?/$^ERRNAME :$res:
2041 vput vexpr res ifind 'bananarama' 'Bana'
2042 echo $?/$^ERRNAME :$res:
2043 vput vexpr res ifind 'bananarama' 'rama'
2044 echo $?/$^ERRNAME :$res:
2045 echo ' #2'
2046 vput vexpr res substring 'bananarama' 1
2047 echo $?/$^ERRNAME :$res:
2048 vput vexpr res substring 'bananarama' 3
2049 echo $?/$^ERRNAME :$res:
2050 vput vexpr res substring 'bananarama' 5
2051 echo $?/$^ERRNAME :$res:
2052 vput vexpr res substring 'bananarama' 7
2053 echo $?/$^ERRNAME :$res:
2054 vput vexpr res substring 'bananarama' 9
2055 echo $?/$^ERRNAME :$res:
2056 vput vexpr res substring 'bananarama' 10
2057 echo $?/$^ERRNAME :$res:
2058 vput vexpr res substring 'bananarama' 1 3
2059 echo $?/$^ERRNAME :$res:
2060 vput vexpr res substring 'bananarama' 3 3
2061 echo $?/$^ERRNAME :$res:
2062 vput vexpr res substring 'bananarama' 5 3
2063 echo $?/$^ERRNAME :$res:
2064 vput vexpr res substring 'bananarama' 7 3
2065 echo $?/$^ERRNAME :$res:
2066 vput vexpr res substring 'bananarama' 9 3
2067 echo $?/$^ERRNAME :$res:
2068 vput vexpr res substring 'bananarama' 10 3
2069 echo $?/$^ERRNAME :$res:
2070 echo ' #3'
2071 vput vexpr res substring 'bananarama' -1
2072 echo $?/$^ERRNAME :$res:
2073 vput vexpr res substring 'bananarama' -3
2074 echo $?/$^ERRNAME :$res:
2075 vput vexpr res substring 'bananarama' -5
2076 echo $?/$^ERRNAME :$res:
2077 vput vexpr res substring 'bananarama' -7
2078 echo $?/$^ERRNAME :$res:
2079 vput vexpr res substring 'bananarama' -9
2080 echo $?/$^ERRNAME :$res:
2081 vput vexpr res substring 'bananarama' -10
2082 echo $?/$^ERRNAME :$res:
2083 vput vexpr res substring 'bananarama' 1 -3
2084 echo $?/$^ERRNAME :$res:
2085 vput vexpr res substring 'bananarama' 3 -3
2086 echo $?/$^ERRNAME :$res:
2087 vput vexpr res substring 'bananarama' 5 -3
2088 echo $?/$^ERRNAME :$res:
2089 vput vexpr res substring 'bananarama' 7 -3
2090 echo $?/$^ERRNAME :$res:
2091 vput vexpr res substring 'bananarama' 9 -3
2092 echo $?/$^ERRNAME :$res:
2093 vput vexpr res substring 'bananarama' 10 -3
2094 echo $?/$^ERRNAME :$res:
2095 echo ' #4'
2096 vput vexpr res trim 'Cocoon Cocoon'
2097 echo $?/$^ERRNAME :$res:
2098 vput vexpr res trim ' Cocoon Cocoon '
2099 echo $?/$^ERRNAME :$res:
2100 vput vexpr res trim-front 'Cocoon Cocoon'
2101 echo $?/$^ERRNAME :$res:
2102 vput vexpr res trim-front ' Cocoon Cocoon '
2103 echo $?/$^ERRNAME :$res:
2104 vput vexpr res trim-end 'Cocoon Cocoon'
2105 echo $?/$^ERRNAME :$res:
2106 vput vexpr res trim-end ' Cocoon Cocoon '
2107 echo $?/$^ERRNAME :$res:
2108 __EOT
2110 check string 0 "${MBOX}" '3182004322 601'
2112 if have_feat regex; then
2113 ${cat} <<- '__EOT' | ${MAILX} ${ARGS} > "${MBOX}" 2>&1
2114 vput vexpr res regex 'bananarama' 'nana'
2115 echo $?/$^ERRNAME :$res:
2116 vput vexpr res regex 'bananarama' 'bana'
2117 echo $?/$^ERRNAME :$res:
2118 vput vexpr res regex 'bananarama' 'Bana'
2119 echo $?/$^ERRNAME :$res:
2120 vput vexpr res regex 'bananarama' 'rama'
2121 echo $?/$^ERRNAME :$res:
2122 echo ' #1'
2123 vput vexpr res iregex 'bananarama' 'nana'
2124 echo $?/$^ERRNAME :$res:
2125 vput vexpr res iregex 'bananarama' 'bana'
2126 echo $?/$^ERRNAME :$res:
2127 vput vexpr res iregex 'bananarama' 'Bana'
2128 echo $?/$^ERRNAME :$res:
2129 vput vexpr res iregex 'bananarama' 'rama'
2130 echo $?/$^ERRNAME :$res:
2131 echo ' #2'
2132 vput vexpr res regex 'bananarama' '(.*)nana(.*)' '\${1}a\${0}u{\$2}'
2133 echo $?/$^ERRNAME :$res:
2134 vput vexpr res regex 'bananarama' '(.*)bana(.*)' '\${1}a\${0}u\$2'
2135 echo $?/$^ERRNAME :$res:
2136 vput vexpr res regex 'bananarama' 'Bana(.+)' '\$1\$0'
2137 echo $?/$^ERRNAME :$res:
2138 vput vexpr res regex 'bananarama' '(.+)rama' '\$1\$0'
2139 echo $?/$^ERRNAME :$res:
2140 echo ' #3'
2141 vput vexpr res iregex 'bananarama' '(.*)nana(.*)' '\${1}a\${0}u{\$2}'
2142 echo $?/$^ERRNAME :$res:
2143 vput vexpr res iregex 'bananarama' '(.*)bana(.*)' '\${1}a\${0}u\$2'
2144 echo $?/$^ERRNAME :$res:
2145 vput vexpr res iregex 'bananarama' 'Bana(.+)' '\$1\$0'
2146 echo $?/$^ERRNAME :$res:
2147 vput vexpr res iregex 'bananarama' '(.+)rama' '\$1\$0'
2148 echo $?/$^ERRNAME :$res:
2149 echo ' #4'
2150 __EOT
2152 check regex 0 "${MBOX}" '3270360157 311'
2153 else
2154 printf 'vexpr-regex: unsupported, skipped\n'
2157 t_epilog
2160 t_call_ret() {
2161 t_prolog call_ret
2163 ${cat} <<- '__EOT' | ${MAILX} ${ARGS} -Snomemdebug > "${MBOX}" 2>&1
2164 define w1 {
2165 echon ">$1 "
2166 vput vexpr i + $1 1
2167 if [ $i -le 42 ]
2168 vput vexpr j '&' $i 7
2169 if [ $j -eq 7 ]
2170 echo .
2172 call w1 $i
2173 wysh set i=$? k=$!
2174 vput vexpr j '&' $i 7
2175 echon "<$1/$i/$k "
2176 if [ $j -eq 7 ]
2177 echo .
2179 else
2180 echo ! The end for $1
2182 return $1
2184 # Transport $?/$! up the call chain
2185 define w2 {
2186 echon ">$1 "
2187 vput vexpr i + $1 1
2188 if [ $1 -lt 42 ]
2189 call w2 $i
2190 wysh set i=$? j=$! k=$^ERRNAME
2191 echon "<$1/$i/$k "
2192 return $i $j
2193 else
2194 echo ! The end for $1
2195 return $i $^ERR-BUSY
2197 echoerr au
2199 # Up and down it goes
2200 define w3 {
2201 echon ">$1/$2 "
2202 vput vexpr i + $1 1
2203 if [ $1 -lt 42 ]
2204 call w3 $i $2
2205 wysh set i=$? j=$!
2206 vput vexpr k - $1 $2
2207 if [ $k -eq 21 ]
2208 vput vexpr i + $1 1
2209 vput vexpr j + $2 1
2210 echo "# <$i/$j> .. "
2211 call w3 $i $j
2212 wysh set i=$? j=$!
2214 eval echon "<\$1=\$i/\$^ERRNAME-$j "
2215 return $i $j
2216 else
2217 echo ! The end for $1=$i/$2
2218 if [ "$2" != "" ]
2219 return $i $^ERR-DOM
2220 else
2221 return $i $^ERR-BUSY
2224 echoerr au
2227 call w1 0; echo ?=$? !=$!; echo -----;
2228 call w2 0; echo ?=$? !=$^ERRNAME; echo -----;
2229 call w3 0 1; echo ?=$? !=$^ERRNAME; echo -----;
2230 __EOT
2232 check 1 0 "${MBOX}" '1572045517 5922'
2234 t_epilog
2237 t_xcall() {
2238 t_prolog xcall
2240 ${cat} <<- '__EOT' | ${MAILX} ${ARGS} -Snomemdebug > "${MBOX}" 2>&1
2241 define work {
2242 echon "$1 "
2243 vput vexpr i + $1 1
2244 if [ $i -le 1111 ]
2245 vput vexpr j '&' $i 7
2246 if [ $j -eq 7 ]
2247 echo .
2249 \xcall work $i $2
2251 echo ! The end for $1/$2
2252 if [ "$2" != "" ]
2253 return $i $^ERR-BUSY
2256 define xwork {
2257 \xcall work 0 $2
2259 call work 0
2260 echo ?=$? !=$!
2261 call xwork
2262 echo ?=$? !=$!
2263 xcall xwork
2264 echo ?=$? !=$^ERRNAME
2266 call work 0 yes
2267 echo ?=$? !=$^ERRNAME
2268 call xwork 0 yes
2269 echo ?=$? !=$^ERRNAME
2270 __EOT
2272 check 1 0 "${MBOX}" '2401702082 23801'
2276 if have_feat uistrings; then
2277 ${cat} <<- '__EOT' > "${BODY}"
2278 define __w {
2279 echon "$1 "
2280 vput vexpr i + $1 1
2281 if [ $i -le 111 ]
2282 vput vexpr j '&' $i 7
2283 if [ $j -eq 7 ]
2284 echo .
2286 \xcall __w $i $2
2288 echo ! The end for $1
2289 if [ $2 -eq 0 ]
2290 nonexistingcommand
2291 echo would be err with errexit
2292 return
2294 echo calling exit
2295 exit
2297 define work {
2298 echo eins
2299 call __w 0 0
2300 echo zwei, ?=$? !=$!
2301 localopts yes; set errexit
2302 ignerr call __w 0 0
2303 echo drei, ?=$? !=$^ERRNAME
2304 call __w 0 $1
2305 echo vier, ?=$? !=$^ERRNAME, this is an error
2307 ignerr call work 0
2308 echo outer 1, ?=$? !=$^ERRNAME
2309 xxxign call work 0
2310 echo outer 2, ?=$? !=$^ERRNAME, could be error if xxxign non-empty
2311 call work 1
2312 echo outer 3, ?=$? !=$^ERRNAME
2313 echo this is definitely an error
2314 __EOT
2316 < "${BODY}" ${MAILX} ${ARGS} -X'commandalias xxxign ignerr' \
2317 -Snomemdebug > "${MBOX}" 2>&1
2318 check 2 0 "${MBOX}" '3900716531 4200'
2320 < "${BODY}" ${MAILX} ${ARGS} -X'commandalias xxxign " "' \
2321 -Snomemdebug > "${MBOX}" 2>&1
2322 check 3 1 "${MBOX}" '1006776201 2799'
2323 else
2324 echo 'xcall-2: unsupported, skipped'
2325 echo 'xcall-3: unsupported, skipped'
2328 t_epilog
2331 t_vpospar() {
2332 t_prolog vpospar
2334 ${cat} <<- '__EOT' | ${MAILX} ${ARGS} > "${MBOX}" 2>&1
2335 vpospar set hey, "'you ", world!
2336 echo $?/$^ERRNAME/$#: $* / "$@" / <$1><$2><$3><$4>
2337 vput vpospar x quote; echo x<$x>
2338 vpospar clear;echo $?/$^ERRNAME/$#: $* / "$@" / <$1><$2><$3><$4>
2339 vput vpospar y quote;echo y<$y>
2340 eval vpospar set ${x};echo $?/$^ERRNAME/$#: $* / "$@" / <$1><$2><$3><$4>
2341 eval vpospar set ${y};echo $?/$^ERRNAME/$#: $* / "$@" / <$1><$2><$3><$4>
2342 eval vpospar set ${x};echo $?/$^ERRNAME/$#: $* / "$@" / <$1><$2><$3><$4>
2344 define infun2 {
2345 echo infun2:$?/$^ERRNAME/$#:$*/"$@"/<$1><$2><$3><$4>
2346 vput vpospar z quote;echo infun2:z<$z>
2349 define infun {
2350 echo infun:$?/$^ERRNAME/$#:$*/"$@"/<$1><$2><$3><$4>
2351 vput vpospar y quote;echo infun:y<$y>
2352 eval vpospar set ${x};echo infun:$?/$^ERRNAME/$#:$*/"$@"/<$1><$2><$3><$4>
2353 vpospar clear;echo infun:$?/$^ERRNAME/$#:$*/"$@"/<$1><$2><$3><$4>
2354 eval call infun2 $x
2355 echo infun:$?/$^ERRNAME/$#:$*/"$@"/<$1><$2><$3><$4>
2356 eval vpospar set ${y};echo infun:$?/$^ERRNAME/$#:$*/"$@"/<$1><$2><$3><$4>
2359 call infun This "in a" fun
2360 echo $?/$^ERRNAME/$#: $* / "$@" / <$1><$2><$3><$4>
2361 vpospar clear;echo $?/$^ERRNAME/$#: $* / "$@" / <$1><$2><$3><$4>
2362 __EOT
2363 check 1 0 "${MBOX}" '155175639 866'
2366 ${cat} <<- '__EOT' | ${MAILX} ${ARGS} > "${MBOX}" 2>&1
2367 set ifs=\'
2368 echo ifs<$ifs> ifs-ws<$ifs-ws>
2369 vpospar set hey, "'you ", world!
2370 echo $?/$^ERRNAME/$#: $* / "$@" / <$1><$2><$3><$4>
2371 vput vpospar x quote; echo x<$x>
2372 vpospar clear;echo $?/$^ERRNAME/$#: $* / "$@" / <$1><$2><$3><$4>
2373 eval vpospar set ${x};echo $?/$^ERRNAME/$#: $* / "$@" / <$1><$2><$3><$4>
2375 set ifs=,
2376 echo ifs<$ifs> ifs-ws<$ifs-ws>
2377 vpospar set hey, "'you ", world!
2378 unset ifs;echo $?/$^ERRNAME/$#: $* / "$@" / <$1><$2><$3><$4>
2379 set ifs=,
2380 vput vpospar x quote; echo x<$x>
2381 vpospar clear;echo $?/$^ERRNAME/$#: $* / "$@" / <$1><$2><$3><$4>
2382 eval vpospar set ${x};\
2383 unset ifs;echo $?/$^ERRNAME/$#: $* / "$@" / <$1><$2><$3><$4>
2385 wysh set ifs=$',\t'
2386 echo ifs<$ifs> ifs-ws<$ifs-ws>
2387 vpospar set hey, "'you ", world!
2388 unset ifs; echo $?/$^ERRNAME/$#: $* / "$@" / <$1><$2><$3><$4>
2389 wysh set ifs=$',\t'
2390 vput vpospar x quote; echo x<$x>
2391 vpospar clear;echo $?/$^ERRNAME/$#: $* / "$@" / <$1><$2><$3><$4>
2392 eval vpospar set ${x};\
2393 unset ifs;echo $?/$^ERRNAME/$#: $* / "$@" / <$1><$2><$3><$4>
2394 __EOT
2395 check ifs 0 "${MBOX}" '2015927702 706'
2397 t_epilog
2400 t_atxplode() {
2401 t_prolog atxplode
2402 TRAP_EXIT_ADDONS="./.t*"
2404 ${cat} > ./.t.sh <<- '___'; ${cat} > ./.t.rc <<- '___'
2405 x() { echo $#; }
2406 xxx() {
2407 printf " (1/$#: <$1>)"
2408 shift
2409 if [ $# -gt 0 ]; then
2410 xxx "$@"
2411 else
2412 echo
2415 yyy() {
2416 eval "$@ ' ball"
2418 set --
2419 x "$@"
2420 x "$@"''
2421 x " $@"
2422 x "$@ "
2423 printf yyy;yyy 'xxx' "b\$'\t'u ' "
2424 printf xxx;xxx arg ,b u.
2425 printf xxx;xxx arg , .
2426 printf xxx;xxx arg ,ball.
2428 define x {
2429 echo $#
2431 define xxx {
2432 echon " (1/$#: <$1>)"
2433 shift
2434 if [ $# -gt 0 ]
2435 \xcall xxx "$@"
2436 endif
2437 echo
2439 define yyy {
2440 eval "$@ ' ball"
2442 vpospar set
2443 call x "$@"
2444 call x "$@"''
2445 call x " $@"
2446 call x "$@ "
2447 echon yyy;call yyy '\call xxx' "b\$'\t'u ' "
2448 echon xxx;call xxx arg ,b u.
2449 echon xxx;call xxx arg , .
2450 echon xxx;call xxx arg ,ball.
2453 ${MAILX} ${ARGS} -X'source ./.t.rc' -Xx > "${MBOX}" 2>&1
2454 check 1 0 "${MBOX}" '41566293 164'
2456 #${SHELL} ./.t.sh > ./.tshout 2>&1
2457 #check disproof-1 0 ./.tshout '41566293 164'
2459 t_epilog
2462 t_read() {
2463 t_prolog read
2464 TRAP_EXIT_ADDONS="./.t*"
2466 ${cat} <<- '__EOT' > .tin
2467 hey1, "'you ", world!
2468 hey2, "'you ", bugs bunny!
2469 hey3, "'you ",
2470 hey4, "'you "
2471 __EOT
2473 ${cat} <<- '__EOT' |\
2474 ${MAILX} ${ARGS} -X'readctl create ./.tin' > "${MBOX}" 2>&1
2475 read a b c
2476 echo $?/$^ERRNAME / <$a><$b><$c>
2477 read a b c
2478 echo $?/$^ERRNAME / <$a><$b><$c>
2479 read a b c
2480 echo $?/$^ERRNAME / <$a><$b><$c>
2481 read a b c
2482 echo $?/$^ERRNAME / <$a><$b><$c>
2483 unset a b c;read a b c
2484 echo $?/$^ERRNAME / <$a><$b><$c>
2485 readctl remove ./.tin;echo readctl remove:$?/$^ERRNAME
2486 __EOT
2487 check 1 0 "${MBOX}" '1527910147 173'
2489 ${cat} <<- '__EOT' > .tin2
2490 hey2.0,:"'you ",:world!:mars.:
2491 hey2.1,:"'you ",:world!
2492 hey2.2,:"'you ",:bugs bunny!
2493 hey2.3,:"'you ",:
2494 hey2.4,:"'you ":
2496 __EOT
2498 ${cat} <<- '__EOT' |\
2499 6< .tin2 ${MAILX} ${ARGS} -X 'readctl create 6' > "${MBOX}" 2>&1
2500 set ifs=:
2501 read a b c
2502 echo $?/$^ERRNAME / <$a><$b><$c>
2503 read a b c
2504 echo $?/$^ERRNAME / <$a><$b><$c>
2505 read a b c
2506 echo $?/$^ERRNAME / <$a><$b><$c>
2507 read a b c
2508 echo $?/$^ERRNAME / <$a><$b><$c>
2509 read a b c
2510 echo $?/$^ERRNAME / <$a><$b><$c>
2511 read a b c
2512 echo $?/$^ERRNAME / <$a><$b><$c>
2513 unset a b c;read a b c
2514 echo $?/$^ERRNAME / <$a><$b><$c>
2515 read a b c
2516 echo $?/$^ERRNAME / <$a><$b><$c>
2517 readctl remove 6;echo readctl remove:$?/$^ERRNAME
2518 __EOT
2519 check ifs 0 "${MBOX}" '890153490 298'
2521 ${cat} <<- '__EOT' | ${MAILX} ${ARGS} > "${MBOX}" 2>&1
2522 readctl create .tin
2523 readall d; echo $?/$^ERRNAME / <$d>
2524 wysh set d;readall d;echo $?/$^ERRNAME / <$d>
2525 readctl create .tin2
2526 readall d; echo $?/$^ERRNAME / <$d>
2527 wysh set d;readall d;echo $?/$^ERRNAME / <$d>
2528 readctl remove .tin;echo $?/$^ERRNAME;\
2529 readctl remove .tin2;echo $?/$^ERRNAME
2530 echo '### now with empty lines'
2531 ! printf 'one line\n\ntwo line\n\n' > ./.temptynl
2532 readctl create .temptynl;echo $?/$^ERRNAME
2533 readall d; echo "$?/$^ERRNAME / <$d>"
2534 readctl remove .temptynl;echo $?/$^ERRNAME
2535 __EOT
2536 check readall 0 "${MBOX}" '4113506527 405'
2538 t_epilog
2541 t_mbox() {
2542 t_prolog mbox
2543 TRAP_EXIT_ADDONS="./.t*"
2547 while [ ${i} -lt 113 ]; do
2548 printf 'm file://%s\n~s Subject %s\nHello %s!\n~.\n' \
2549 "${MBOX}" "${i}" "${i}"
2550 i=`add ${i} 1`
2551 done
2552 ) | ${MAILX} ${ARGS} > .tall 2>&1
2553 check 1 0 "${MBOX}" '1872102723 13784'
2554 check 1-outerr - ./.tall '4294967295 0' # empty file
2556 printf 'File "%s"\ncopy * "%s"\nFile "%s"\nfrom*' "${MBOX}" .tmbox1 .tmbox1 |
2557 ${MAILX} ${ARGS} -Sshowlast > .tall 2>&1
2558 check 2 0 .tall '3498373999 9103'
2560 printf 'File "%s"\ncopy * "file://%s"\nFile "file://%s"\nfrom*' \
2561 "${MBOX}" .tmbox2 .tmbox2 | ${MAILX} ${ARGS} -Sshowlast > .tall 2>&1
2562 check 3 0 .tall '381610797 9110'
2564 # copy only the odd (but the first), move the even
2566 printf 'File "file://%s"\ncopy ' .tmbox2
2568 while [ ${i} -lt 113 ]; do
2569 printf '%s ' "${i}"
2570 i=`add ${i} 2`
2571 done
2572 printf 'file://%s\nFile "file://%s"\nfrom*' .tmbox3 .tmbox3
2573 ) | ${MAILX} ${ARGS} -Sshowlast > .tall 2>&1
2574 check 4 0 .tmbox3 '4145104131 6890'
2575 check 5 - .tall '361127721 4573'
2576 # ...
2578 printf 'file "file://%s"\nmove ' .tmbox2
2580 while [ ${i} -lt 113 ]; do
2581 printf '%s ' "${i}"
2582 i=`add ${i} 2`
2583 done
2584 printf 'file://%s\nFile "file://%s"\nfrom*\nFile "file://%s"\nfrom*' \
2585 .tmbox3 .tmbox3 .tmbox2
2586 ) | ${MAILX} ${ARGS} -Sshowlast > .tall 2>>${ERR}
2587 check 6 0 .tmbox3 '3249991493 13784'
2588 if have_feat uistrings; then
2589 ${sed} 2d < .tall > .tallx
2590 else
2591 ${cp} .tall .tallx
2593 check 7 - .tallx '1584413080 13645'
2595 # Invalid MBOXes (after [f4db93b3])
2596 echo > .tinvmbox
2597 printf 'copy 1 ./.tinvmbox' | ${MAILX} ${ARGS} -Rf "${MBOX}" > .tall 2>&1
2598 check 8 0 .tinvmbox '896415941 122'
2599 check 9 - ./.tall '3146754194 33'
2601 echo ' ' > .tinvmbox
2602 printf 'copy 1 ./.tinvmbox' | ${MAILX} ${ARGS} -Rf "${MBOX}" > .tall 2>&1
2603 check 10 0 .tinvmbox '4011310616 124'
2604 check 11 - ./.tall '3146754194 33'
2606 { echo; echo; } > .tinvmbox # (not invalid)
2607 printf 'copy 1 ./.tinvmbox' | ${MAILX} ${ARGS} -Rf "${MBOX}" > .tall 2>&1
2608 check 12 0 .tinvmbox '287409579 123'
2609 check 13 - ./.tall '3146754194 33'
2611 # *mbox-rfc4155*, plus
2612 ${cat} <<-_EOT > ./.tinv1
2615 From MAILER-DAEMON-1 Wed Oct 2 01:50:07 1996
2616 Date: Wed, 02 Oct 1996 01:50:07 +0000
2618 Subject: Bad bad message 1
2620 From me to you, blinde Kuh!
2622 From MAILER-DAEMON-2 Wed Oct 2 01:50:07 1996
2623 Date: Wed, 02 Oct 1996 01:50:07 +0000
2625 Subject: Bad bad message 2
2627 From me to you, blindes Kalb!
2628 _EOT
2629 ${cp} ./.tinv1 ./.tinv2
2631 printf \
2632 'define mboxfix {
2633 \\localopts yes; \\wysh set mbox-rfc4155;\\wysh File "${1}";\\
2634 \\eval copy * "${2}"
2636 call mboxfix ./.tinv1 ./.tok' | ${MAILX} ${ARGS} > .tall 2>&1
2637 check_ex0 14-estat
2638 ${cat} ./.tinv1 ./.tok >> .tall
2639 check 14 - ./.tall '739301109 616'
2641 printf \
2642 'wysh file ./.tinv1 # ^From not repaired, but missing trailing NL is
2643 wysh File ./.tok # Just move away to nowhere
2644 set mbox-rfc4155
2645 wysh file ./.tinv2 # Fully repaired
2646 File ./.tok' | ${MAILX} ${ARGS} >>${ERR} 2>&1
2647 check_ex0 15-estat
2648 check 15-1 - ./.tinv1 '3178048820 332'
2649 check 15-2 - ./.tinv2 '4151504442 314'
2651 t_epilog
2654 t_maildir() {
2655 t_prolog maildir
2656 if have_feat maildir; then :; else
2657 echo 'maildir: unsupported, skipped'
2658 return
2661 TRAP_EXIT_ADDONS="./.t*"
2665 while [ ${i} -lt 112 ]; do
2666 printf 'm file://%s\n~s Subject %s\nHello %s!\n~.\n' \
2667 "${MBOX}" "${i}" "${i}"
2668 i=`add ${i} 1`
2669 done
2670 ) | ${MAILX} ${ARGS}
2671 check 1 0 "${MBOX}" '1140119864 13780'
2673 printf 'File "%s"
2674 copy * "%s"
2675 File "%s"
2676 from*
2677 ' "${MBOX}" .tmdir1 .tmdir1 |
2678 ${MAILX} ${ARGS} -Snewfolders=maildir -Sshowlast > .tlst
2679 check 2 0 .tlst '1797938753 9103'
2681 printf 'File "%s"
2682 copy * "maildir://%s"
2683 File "maildir://%s"
2684 from*
2685 ' "${MBOX}" .tmdir2 .tmdir2 |
2686 ${MAILX} ${ARGS} -Sshowlast > .tlst
2687 check 3 0 .tlst '1155631089 9113'
2689 printf 'File "maildir://%s"
2690 copy * "file://%s"
2691 File "file://%s"
2692 from*
2693 ' .tmdir2 .tmbox1 .tmbox1 |
2694 ${MAILX} ${ARGS} -Sshowlast > .tlst
2695 check 4 0 .tmbox1 '2646131190 13220'
2696 check 5 - .tlst '3701297796 9110'
2698 # only the odd (even)
2700 printf 'File "maildir://%s"
2701 copy ' .tmdir2
2703 while [ ${i} -lt 112 ]; do
2704 j=`modulo ${i} 2`
2705 [ ${j} -eq 1 ] && printf '%s ' "${i}"
2706 i=`add ${i} 1`
2707 done
2708 printf ' file://%s
2709 File "file://%s"
2710 from*
2711 ' .tmbox2 .tmbox2
2712 ) | ${MAILX} ${ARGS} -Sshowlast > .tlst
2713 check 6 0 .tmbox2 '142890131 6610'
2714 check 7 - .tlst '960096773 4573'
2715 # ...
2717 printf 'file "maildir://%s"
2718 move ' .tmdir2
2720 while [ ${i} -lt 112 ]; do
2721 j=`modulo ${i} 2`
2722 [ ${j} -eq 0 ] && [ ${i} -ne 0 ] && printf '%s ' "${i}"
2723 i=`add ${i} 1`
2724 done
2725 printf ' file://%s
2726 File "file://%s"
2727 from*
2728 File "maildir://%s"
2729 from*
2730 ' .tmbox2 .tmbox2 .tmdir2
2731 ) | ${MAILX} ${ARGS} -Sshowlast > .tlst
2732 check 8 0 .tmbox2 '3806905791 13100'
2733 ${sed} 2d < .tlst > .tlstx
2734 check 9 - .tlstx '4216815295 13645'
2736 t_epilog
2739 t_record_a_resend() {
2740 t_prolog record_a_resend
2741 TRAP_EXIT_ADDONS="./.t.record ./.t.resent"
2743 printf '
2744 set record=%s
2745 m %s\n~s Subject 1.\nHello.\n~.
2746 set record-files add-file-recipients
2747 m %s\n~s Subject 2.\nHello.\n~.
2748 File %s
2749 resend 2 ./.t.resent
2750 Resend 1 ./.t.resent
2751 set record-resent
2752 resend 2 ./.t.resent
2753 Resend 1 ./.t.resent
2754 ' ./.t.record "${MBOX}" "${MBOX}" "${MBOX}" |
2755 ${MAILX} ${ARGS}
2757 check 1 0 "${MBOX}" '3057873538 256'
2758 check 2 - .t.record '391356429 460'
2759 check 3 - .t.resent '2685231691 648'
2761 t_epilog
2764 t_e_H_L_opts() {
2765 t_prolog e_H_L_opts
2766 TRAP_EXIT_ADDONS="./.tmta.sh ./.t.mbox"
2768 t_xmta 'Alchemilla Wed Apr 07 17:03:33 2017' ./.t.mbox
2770 touch ./.t.mbox
2771 ${MAILX} ${ARGS} -ef ./.t.mbox
2772 echo ${?} > "${MBOX}"
2774 printf 'm me@exam.ple\nLine 1.\nHello.\n~.\n' |
2775 ${MAILX} ${ARGS} -Smta=./.tmta.sh
2776 printf 'm you@exam.ple\nLine 1.\nBye.\n~.\n' |
2777 ${MAILX} ${ARGS} -Smta=./.tmta.sh
2779 ${MAILX} ${ARGS} -ef ./.t.mbox
2780 echo ${?} >> "${MBOX}"
2781 ${MAILX} ${ARGS} -efL @t@me ./.t.mbox
2782 echo ${?} >> "${MBOX}"
2783 ${MAILX} ${ARGS} -efL @t@you ./.t.mbox
2784 echo ${?} >> "${MBOX}"
2785 ${MAILX} ${ARGS} -efL '@>@Line 1' ./.t.mbox
2786 echo ${?} >> "${MBOX}"
2787 ${MAILX} ${ARGS} -efL '@>@Hello.' ./.t.mbox
2788 echo ${?} >> "${MBOX}"
2789 ${MAILX} ${ARGS} -efL '@>@Bye.' ./.t.mbox
2790 echo ${?} >> "${MBOX}"
2791 ${MAILX} ${ARGS} -efL '@>@Good bye.' ./.t.mbox
2792 echo ${?} >> "${MBOX}"
2794 ${MAILX} ${ARGS} -fH ./.t.mbox >> "${MBOX}"
2795 echo ${?} >> "${MBOX}"
2796 ${MAILX} ${ARGS} -fL @t@me ./.t.mbox >> "${MBOX}"
2797 echo ${?} >> "${MBOX}"
2798 ${MAILX} ${ARGS} -fL @t@you ./.t.mbox >> "${MBOX}"
2799 echo ${?} >> "${MBOX}"
2800 ${MAILX} ${ARGS} -fL '@>@Line 1' ./.t.mbox >> "${MBOX}"
2801 echo ${?} >> "${MBOX}"
2802 ${MAILX} ${ARGS} -fL '@>@Hello.' ./.t.mbox >> "${MBOX}"
2803 echo ${?} >> "${MBOX}"
2804 ${MAILX} ${ARGS} -fL '@>@Bye.' ./.t.mbox >> "${MBOX}"
2805 echo ${?} >> "${MBOX}"
2806 ${MAILX} ${ARGS} -fL '@>@Good bye.' ./.t.mbox >> "${MBOX}" 2>>${ERR}
2807 echo ${?} >> "${MBOX}"
2809 check 1 - "${MBOX}" '1708955574 678'
2811 t_epilog
2814 t_alternates() {
2815 t_prolog alternates
2816 TRAP_EXIT_ADDONS="./.t*"
2818 t_xmta 'Valeriana Sat Jul 08 15:54:03 2017'
2820 ${cat} <<- '__EOT' | ${MAILX} ${ARGS} -Smta=./.tmta.sh > ./.tall 2>&1
2821 echo --0
2822 alternates
2823 echo $?/$^ERRNAME
2824 alternates a1@b1 a2@b2 a3@b3
2825 echo $?/$^ERRNAME
2826 alternates
2827 echo $?/$^ERRNAME
2828 vput alternates rv
2829 echo $?/$^ERRNAME <$rv>
2831 echo --1
2832 unalternates a2@b2
2833 vput alternates rv
2834 echo $?/$^ERRNAME <$rv>
2835 unalternates a3@b3
2836 vput alternates rv
2837 echo $?/$^ERRNAME <$rv>
2838 unalternates a1@b1
2839 vput alternates rv
2840 echo $?/$^ERRNAME <$rv>
2842 echo --2
2843 unalternates *
2844 alternates a1@b1 a2@b2 a3@b3
2845 unalternates a3@b3
2846 vput alternates rv
2847 echo $?/$^ERRNAME <$rv>
2848 unalternates a2@b2
2849 vput alternates rv
2850 echo $?/$^ERRNAME <$rv>
2851 unalternates a1@b1
2852 vput alternates rv
2853 echo $?/$^ERRNAME <$rv>
2855 echo --3
2856 alternates a1@b1 a2@b2 a3@b3
2857 unalternates a1@b1
2858 vput alternates rv
2859 echo $?/$^ERRNAME <$rv>
2860 unalternates a2@b2
2861 vput alternates rv
2862 echo $?/$^ERRNAME <$rv>
2863 unalternates a3@b3
2864 vput alternates rv
2865 echo $?/$^ERRNAME <$rv>
2867 echo --4
2868 unalternates *
2869 alternates a1@b1 a2@b2 a3@b3
2870 unalternates *
2871 vput alternates rv
2872 echo $?/$^ERRNAME <$rv>
2874 echo --5
2875 unalternates *
2876 alternates a1@b1 a1@c1 a1@d1 a2@b2 a3@b3 a3@c3 a3@d3
2877 m a1@b1 a1@c1 a1@d1
2878 ~s all alternates, only a1@b1 remains
2879 ~c a2@b2
2880 ~b a3@b3 a3@c3 a3@d3
2881 ~r - '_EOT'
2882 This body is!
2883 This also body is!!
2884 _EOT
2887 echo --6
2888 unalternates *
2889 alternates a1@b1 a1@c1 a2@b2 a3@b3
2890 m a1@b1 a1@c1 a1@d1
2891 ~s a1@b1 a1@d1, and a3@c3 a3@d3 remain
2892 ~c a2@b2
2893 ~b a3@b3 a3@c3 a3@d3
2894 ~r - '_EOT'
2895 This body2 is!
2896 _EOT
2899 echo --7
2900 alternates a1@b1 a2@b2 a3; set allnet
2901 m a1@b1 a1@c1 a1@d1
2902 ~s all alternates via allnet, only a1@b1 remains
2903 ~c a2@b2
2904 ~b a3@b3 a3@c3 a3@d3
2905 ~r - '_EOT'
2906 This body3 is!
2907 _EOT
2910 echo --10
2911 unalternates *
2912 alternates a1@b1
2913 echo $?/$^ERRNAME
2914 vput alternates rv
2915 echo $?/$^ERRNAME <$rv>
2916 alternates a2@b2
2917 echo $?/$^ERRNAME
2918 vput alternates rv
2919 echo $?/$^ERRNAME <$rv>
2920 alternates a3@b3
2921 echo $?/$^ERRNAME
2922 vput alternates rv
2923 echo $?/$^ERRNAME <$rv>
2924 alternates a4@b4
2925 echo $?/$^ERRNAME
2926 vput alternates rv
2927 echo $?/$^ERRNAME <$rv>
2929 unalternates *
2930 vput alternates rv
2931 echo $?/$^ERRNAME <$rv>
2933 echo --11
2934 set posix
2935 alternates a1@b1 a2@b2
2936 echo $?/$^ERRNAME
2937 vput alternates rv
2938 echo $?/$^ERRNAME <$rv>
2939 alternates a3@b3 a4@b4
2940 echo $?/$^ERRNAME
2941 vput alternates rv
2942 echo $?/$^ERRNAME <$rv>
2943 __EOT
2945 check 1 0 "${MBOX}" '142184864 515'
2946 if have_feat uistrings; then
2947 check 2 - .tall '1878598364 505'
2948 else
2949 echo 'alternates-2: unsupported, skipped'
2952 t_epilog
2955 t_alias() {
2956 t_prolog alias
2957 TRAP_EXIT_ADDONS="./.t*"
2959 t_xmta 'Hippocastanum Mon Jun 19 15:07:07 2017'
2961 ${cat} <<- '__EOT' | ${MAILX} ${ARGS} -Smta=./.tmta.sh > ./.tall 2>&1
2962 alias a1 ex1@a1.ple
2963 alias a1 ex2@a1.ple "EX3 <ex3@a1.ple>"
2964 alias a1 ex4@a1.ple
2965 alias a2 ex1@a2.ple ex2@a2.ple ex3@a2.ple ex4@a2.ple
2966 alias a3 a4
2967 alias a4 a5 ex1@a4.ple
2968 alias a5 a6
2969 alias a6 a7 ex1@a6.ple
2970 alias a7 a8
2971 alias a8 ex1@a8.ple
2972 alias a1
2973 alias a2
2974 alias a3
2975 m a1
2976 ~c a2
2977 ~b a3
2978 ~r - '_EOT'
2979 This body is!
2980 This also body is!!
2981 _EOT
2982 __EOT
2983 check 1 0 "${MBOX}" '2496925843 272'
2984 check 2 - .tall '3548953204 152'
2986 # TODO t_alias: n_ALIAS_MAXEXP is compile-time constant,
2987 # TODO need to somehow provide its contents to the test, then test
2989 t_epilog
2992 t_filetype() {
2993 t_prolog filetype
2994 TRAP_EXIT_ADDONS="./.t*"
2996 t_xmta 'Alchemilla Wed Apr 25 15:12:13 2017'
2998 printf 'm m1@e.t\nL1\nHy1\n~.\nm m2@e.t\nL2\nHy2\n~@ %s\n~.\n' \
2999 "${SRCDIR}snailmail.jpg" | ${MAILX} ${ARGS} -Smta=./.tmta.sh
3000 check 1 0 "${MBOX}" '1594682963 13520'
3002 if (echo | gzip -c) >/dev/null 2>&1; then
3004 printf 'File "%s"\ncopy 1 ./.t.mbox.gz\ncopy 2 ./.t.mbox.gz' \
3005 "${MBOX}" | ${MAILX} ${ARGS} \
3006 -X'filetype gz gzip\ -dc gzip\ -c'
3007 printf 'File ./.t.mbox.gz\ncopy * ./.t.mbox\n' |
3008 ${MAILX} ${ARGS} -X'filetype gz gzip\ -dc gzip\ -c'
3009 } > ./.t.out 2>&1
3010 check 2 - "./.t.mbox" '1594682963 13520'
3011 check 3 - "./.t.out" '2392348396 102'
3012 else
3013 echo 'filetype-2: unsupported, skipped'
3014 echo 'filetype-3: unsupported, skipped'
3018 ${rm} ./.t.mbox*
3019 printf 'File "%s"\ncopy 1 ./.t.mbox.gz
3020 copy 2 ./.t.mbox.gz
3021 copy 1 ./.t.mbox.gz
3022 copy 2 ./.t.mbox.gz
3023 ' "${MBOX}" |
3024 ${MAILX} ${ARGS} \
3025 -X'filetype gz gzip\ -dc gzip\ -c' \
3026 -X'filetype mbox.gz "${sed} 1,3d|${cat}" \
3027 "echo eins;echo zwei;echo und mit ${sed} bist Du dabei;${cat}"'
3028 printf 'File ./.t.mbox.gz\ncopy * ./.t.mbox\n' |
3029 ${MAILX} ${ARGS} \
3030 -X'filetype gz gzip\ -dc gzip\ -c' \
3031 -X'filetype mbox.gz "${sed} 1,3d|${cat}" kill\ 0'
3032 } > ./.t.out 2>&1
3033 check 4 - "./.t.mbox" '2886541147 27060'
3034 check 5 - "./.t.out" '852335377 172'
3036 t_epilog
3039 t_message_injections() {
3040 t_prolog message_injections
3041 TRAP_EXIT_ADDONS="./.t*"
3043 t_xmta 'Echinacea Tue Jun 20 15:54:02 2017'
3045 echo mysig > ./.tmysig
3047 echo some-body | ${MAILX} ${ARGS} -Smta=./.tmta.sh \
3048 -Smessage-inject-head=head-inject \
3049 -Smessage-inject-tail=tail-inject \
3050 -Ssignature=./.tmysig \
3051 ex@am.ple > ./.tall 2>&1
3052 check 1 0 "${MBOX}" '2434746382 134'
3053 check 2 - .tall '4294967295 0' # empty file
3055 ${rm} "${MBOX}"
3056 ${cat} <<-_EOT > ./.template
3057 From: me
3058 To: ex1@am.ple
3059 Cc: ex2@am.ple
3060 Subject: This subject is
3062 Body, body, body me.
3063 _EOT
3064 < ./.template ${MAILX} ${ARGS} -t -Smta=./.tmta.sh \
3065 -Smessage-inject-head=head-inject \
3066 -Smessage-inject-tail=tail-inject \
3067 -Ssignature=./.tmysig \
3068 > ./.tall 2>&1
3069 check 3 0 "${MBOX}" '3114203412 198'
3070 check 4 - .tall '4294967295 0' # empty file
3072 t_epilog
3075 t_attachments() {
3076 t_prolog attachments
3077 TRAP_EXIT_ADDONS="./.t*"
3079 t_xmta 'Cannabis Sun Feb 18 02:02:46 2018'
3081 ${cat} <<-_EOT > ./.tx
3082 From steffen Sun Feb 18 02:48:40 2018
3083 Date: Sun, 18 Feb 2018 02:48:40 +0100
3085 Subject: m1
3086 User-Agent: s-nail v14.9.7
3089 From steffen Sun Feb 18 02:48:42 2018
3090 Date: Sun, 18 Feb 2018 02:48:42 +0100
3092 Subject: m2
3093 User-Agent: s-nail v14.9.7
3096 _EOT
3097 echo att1 > ./.t1
3098 printf 'att2-1\natt2-2\natt2-4\n' > ./'.t 2'
3099 printf 'att3-1\natt3-2\natt3-4\n' > ./.t3
3100 printf 'att4-1\natt4-2\natt4-4\n' > './.t 4'
3102 printf \
3103 '!@ ./.t3 "./.t 4" ""
3106 ./.t3
3107 "./.t 2"
3110 !.' \
3111 | ${MAILX} ${ARGS} -Sescape=! -Smta=./.tmta.sh \
3112 -a ./.t1 -a './.t 2' \
3113 -s attachment-test \
3114 ex@am.ple > ./.tall 2>&1
3115 check 1 0 "${MBOX}" '4107062253 634'
3116 if have_feat uistrings; then
3117 check 2 - .tall '1928331872 720'
3118 else
3119 echo 'attachments-2: unsupported, skipped'
3122 ${rm} "${MBOX}"
3123 printf \
3124 'mail ex@amp.ple
3125 !s This the subject is
3126 !@ ./.t3 "#2" "./.t 4" "#1" ""
3129 "./.t 4"
3130 "#2"
3134 mail ex@amp.ple
3135 !s Subject two
3136 !@ ./.t3 "#2" "./.t 4" "#1" ""
3142 mail ex@amp.ple
3143 !s Subject three
3144 !@ ./.t3 "" "#2" "" "./.t 4" "" "#1" ""
3147 ./.t3
3151 mail ex@amp.ple
3152 !s Subject Four
3153 !@ ./.t3 "" "#2" "" "./.t 4" "" "#1" ""
3156 "#1"
3160 mail ex@amp.ple
3161 !s Subject Five
3163 "#2"
3166 !.' \
3167 | ${MAILX} ${ARGS} -Sescape=! -Smta=./.tmta.sh -Rf ./.tx \
3168 > ./.tall 2>&1
3169 check 3 0 "${MBOX}" '798122412 2285'
3170 if have_feat uistrings; then
3171 check 4 - .tall '2526106274 1910'
3172 else
3173 echo 'attachments-4: unsupported, skipped'
3176 t_epilog
3179 t_compose_hooks() { # TODO monster
3180 t_prolog compose_hooks
3181 if have_feat uistrings; then :; else
3182 echo 'compose_hooks: unsupported, skipped'
3183 return
3185 TRAP_EXIT_ADDONS="./.t*"
3187 t_xmta 'PrimulaVeris Wed Apr 10 22:59:00 2017'
3189 (echo line one&&echo line two&&echo line three) > ./.treadctl
3190 (echo echo four&&echo echo five&&echo echo six) > ./.tattach
3192 ${cat} <<'__EOT__' > ./.trc
3193 define bail {
3194 echoerr "Failed: $1. Bailing out"; echo "~x"; xit
3196 define xerr {
3197 vput vexpr es substr "$1" 0 1
3198 if [ "$es" != 2 ]
3199 xcall bail "$2"
3202 define read_mline_res {
3203 read hl; wysh set len=$? es=$! en=$^ERRNAME;\
3204 echo $len/$es/$^ERRNAME: $hl
3205 if [ $es -ne $^ERR-NONE ]
3206 xcall bail read_mline_res
3207 elif [ $len -ne 0 ]
3208 \xcall read_mline_res
3211 define ins_addr {
3212 wysh set xh=$1
3213 echo "~^header list"; read hl; echo $hl;\
3214 call xerr "$hl" "in_addr ($xh) 0-1"
3216 echo "~^header insert $xh diet <$xh@exam.ple> spliced";\
3217 read es; echo $es; call xerr "$es" "ins_addr $xh 1-1"
3218 echo "~^header insert $xh <${xh}2@exam.ple>";\
3219 read es; echo $es; call xerr "$es" "ins_addr $xh 1-2"
3220 echo "~^header insert $xh ${xh}3@exam.ple";\
3221 read es; echo $es; call xerr "$es" "ins_addr $xh 1-3"
3222 echo "~^header list $xh"; read hl; echo $hl;\
3223 call xerr "$hl" "ins_addr $xh 1-4"
3224 echo "~^header show $xh"; read es; call xerr $es "ins_addr $xh 1-5"
3225 call read_mline_res
3227 if [ "$t_remove" == "" ]
3228 return
3231 echo "~^header remove $xh"; read es; call xerr $es "ins_addr $xh 2-1"
3232 echo "~^header remove $xh"; read es; vput vexpr es substr $es 0 3
3233 if [ $es != 501 ]
3234 xcall bail "ins_addr $xh 2-2"
3236 echo "~^header list $xh"; read es; vput vexpr es substr $es 0 3
3237 if [ $es != 501 ]
3238 xcall bail "ins_addr $xh 2-3"
3240 echo "~^header show $xh"; read es; vput vexpr es substr $es 0 3
3241 if [ $es != 501 ]
3242 xcall bail "ins_addr $xh 2-4"
3246 echo "~^header insert $xh diet <$xh@exam.ple> spliced";\
3247 read es; echo $es; call xerr "$es" "ins_addr $xh 3-1"
3248 echo "~^header insert $xh <${xh}2@exam.ple>";\
3249 read es; echo $es; call xerr "$es" "ins_addr $xh 3-2"
3250 echo "~^header insert $xh ${xh}3@exam.ple";\
3251 read es; echo $es; call xerr "$es" "ins_addr $xh 3-3"
3252 echo "~^header list $xh"; read hl; echo $hl;\
3253 call xerr "$hl" "ins_addr $xh 3-4"
3254 echo "~^header show $xh"; read es; call xerr $es "ins_addr $xh 3-5"
3255 call read_mline_res
3257 echo "~^header remove-at $xh 1"; read es;\
3258 call xerr $es "ins_addr $xh 3-6"
3259 echo "~^header remove-at $xh 1"; read es;\
3260 call xerr $es "ins_addr $xh 3-7"
3261 echo "~^header remove-at $xh 1"; read es;\
3262 call xerr $es "ins_addr $xh 3-8"
3263 echo "~^header remove-at $xh 1"; read es;\
3264 vput vexpr es substr $es 0 3
3265 if [ $es != 501 ]
3266 xcall bail "ins_addr $xh 3-9"
3268 echo "~^header remove-at $xh T"; read es;\
3269 vput vexpr es substr $es 0 3
3270 if [ $es != 505 ]
3271 xcall bail "ins_addr $xh 3-10"
3273 echo "~^header list $xh"; read es;\
3274 vput vexpr es substr $es 0 3
3275 if [ $es != 501 ]
3276 xcall bail "ins_addr $xh 3-11"
3278 echo "~^header show $xh"; read es;\
3279 vput vexpr es substr $es 0 3
3280 if [ $es != 501 ]
3281 xcall bail "ins_addr $xh 3-12"
3285 echo "~^header insert $xh diet <$xh@exam.ple> spliced";\
3286 read es; echo $es; call xerr "$es" "ins_addr $xh 4-1"
3287 echo "~^header insert $xh <${xh}2@exam.ple> (comment) \"Quot(e)d\"";\
3288 read es; echo $es; call xerr "$es" "ins_addr $xh 4-2"
3289 echo "~^header insert $xh ${xh}3@exam.ple";\
3290 read es; echo $es; call xerr "$es" "ins_addr $xh 4-3"
3291 echo "~^header list $xh"; read hl; echo $hl;\
3292 call xerr "$hl" "header list $xh 3-4"
3293 echo "~^header show $xh"; read es; call xerr $es "ins_addr $xh 4-5"
3294 call read_mline_res
3296 echo "~^header remove-at $xh 3"; read es;\
3297 call xerr $es "ins_addr $xh 4-6"
3298 echo "~^header remove-at $xh 2"; read es;\
3299 call xerr $es "ins_addr $xh 4-7"
3300 echo "~^header remove-at $xh 1"; read es;\
3301 call xerr $es "ins_addr $xh 4-8"
3302 echo "~^header remove-at $xh 1"; read es;\
3303 vput vexpr es substr $es 0 3
3304 if [ $es != 501 ]
3305 xcall bail "ins_addr $xh 4-9"
3307 echo "~^header remove-at $xh T"; read es;\
3308 vput vexpr es substr $es 0 3
3309 if [ $es != 505 ]
3310 xcall bail "ins_addr $xh 4-10"
3312 echo "~^header list $xh"; read es;\
3313 vput vexpr es substr $es 0 3
3314 if [ $es != 501 ]
3315 xcall bail "ins_addr $xh 4-11"
3317 echo "~^header show $xh"; read es;\
3318 vput vexpr es substr $es 0 3
3319 if [ $es != 501 ]
3320 xcall bail "ins_addr $xh 4-12"
3323 define ins_ref {
3324 wysh set xh=$1 mult=$2
3325 echo "~^header list"; read hl; echo $hl;\
3326 call xerr "$hl" "ins_ref ($xh) 0-1"
3328 echo "~^header insert $xh <$xh@exam.ple>";\
3329 read es; echo $es; call xerr "$es" "ins_ref $xh 1-1"
3330 if [ $mult -ne 0 ]
3331 echo "~^header insert $xh <${xh}2@exam.ple>";\
3332 read es; echo $es; call xerr "$es" "ins_ref $xh 1-2"
3333 echo "~^header insert $xh ${xh}3@exam.ple";\
3334 read es; echo $es; call xerr "$es" "ins_ref $xh 1-3"
3335 else
3336 echo "~^header insert $xh <${xh}2@exam.ple>"; read es;\
3337 vput vexpr es substr $es 0 3
3338 if [ $es != 506 ]
3339 xcall bail "ins_ref $xh 1-4"
3343 echo "~^header list $xh"; read hl; echo $hl;\
3344 call xerr "$hl" "ins_ref $xh 1-5"
3345 echo "~^header show $xh"; read es; call xerr $es "ins_ref $xh 1-6"
3346 call read_mline_res
3348 if [ "$t_remove" == "" ]
3349 return
3352 echo "~^header remove $xh"; read es;\
3353 call xerr $es "ins_ref $xh 2-1"
3354 echo "~^header remove $xh"; read es;\
3355 vput vexpr es substr $es 0 3
3356 if [ $es != 501 ]
3357 xcall bail "ins_ref $xh 2-2"
3359 echo "~^header list $xh"; read es;\
3360 vput vexpr es substr $es 0 3
3361 if [ $es != 501 ]
3362 xcall bail "$es ins_ref $xh 2-3"
3364 echo "~^header show $xh"; read es;\
3365 vput vexpr es substr $es 0 3
3366 if [ $es != 501 ]
3367 xcall bail "ins_ref $xh 2-4"
3371 echo "~^header insert $xh <$xh@exam.ple>";\
3372 read es; echo $es; call xerr "$es" "ins_ref $xh 3-1"
3373 if [ $mult -ne 0 ]
3374 echo "~^header insert $xh <${xh}2@exam.ple>";\
3375 read es; echo $es; call xerr "$es" "ins_ref $xh 3-2"
3376 echo "~^header insert $xh ${xh}3@exam.ple";\
3377 read es; echo $es; call xerr "$es" "ins_ref $xh 3-3"
3379 echo "~^header list $xh";\
3380 read hl; echo $hl; call xerr "$hl" "ins_ref $xh 3-4"
3381 echo "~^header show $xh";\
3382 read es; call xerr $es "ins_ref $xh 3-5"
3383 call read_mline_res
3385 echo "~^header remove-at $xh 1"; read es;\
3386 call xerr $es "ins_ref $xh 3-6"
3387 if [ $mult -ne 0 ] && [ $xh != subject ]
3388 echo "~^header remove-at $xh 1"; read es;\
3389 call xerr $es "ins_ref $xh 3-7"
3390 echo "~^header remove-at $xh 1"; read es;\
3391 call xerr $es "ins_ref $xh 3-8"
3393 echo "~^header remove-at $xh 1"; read es;\
3394 vput vexpr es substr $es 0 3
3395 if [ $es != 501 ]
3396 xcall bail "ins_ref $xh 3-9"
3398 echo "~^header remove-at $xh T"; read es;\
3399 vput vexpr es substr $es 0 3
3400 if [ $es != 505 ]
3401 xcall bail "ins_ref $xh 3-10"
3403 echo "~^header show $xh"; read es;\
3404 vput vexpr es substr $es 0 3
3405 if [ $es != 501 ]
3406 xcall bail "ins_ref $xh 3-11"
3410 echo "~^header insert $xh <$xh@exam.ple> ";\
3411 read es; echo $es; call xerr "$es" "ins_ref $xh 4-1"
3412 if [ $mult -ne 0 ]
3413 echo "~^header insert $xh <${xh}2@exam.ple> ";\
3414 read es; echo $es; call xerr "$es" "ins_ref $xh 4-2"
3415 echo "~^header insert $xh ${xh}3@exam.ple";\
3416 read es; echo $es; call xerr "$es" "ins_ref $xh 4-3"
3418 echo "~^header list $xh"; read hl; echo $hl;\
3419 call xerr "$hl" "ins_ref $xh 4-4"
3420 echo "~^header show $xh"; read es; call xerr $es "ins_ref $xh 4-5"
3421 call read_mline_res
3423 if [ $mult -ne 0 ] && [ $xh != subject ]
3424 echo "~^header remove-at $xh 3"; read es;\
3425 call xerr $es "ins_ref $xh 4-6"
3426 echo "~^header remove-at $xh 2"; read es;\
3427 call xerr $es "ins_ref $xh 4-7"
3429 echo "~^header remove-at $xh 1"; read es;\
3430 call xerr $es "ins_ref $xh 4-8"
3431 echo "~^header remove-at $xh 1"; read es;\
3432 vput vexpr es substr $es 0 3
3433 if [ $es != 501 ]
3434 xcall bail "ins_ref $xh 4-9"
3436 echo "~^header remove-at $xh T"; read es;\
3437 vput vexpr es substr $es 0 3
3438 if [ $es != 505 ]
3439 xcall bail "ins_ref $xh 4-10"
3441 echo "~^header show $xh"; read es;\
3442 vput vexpr es substr $es 0 3
3443 if [ $es != 501 ]
3444 xcall bail "ins_ref $xh 4-11"
3447 define t_header {
3448 echo t_header ENTER
3449 # In collect.c order
3450 call ins_addr from
3451 call ins_ref sender 0 # Not a "ref", but works
3452 call ins_addr To
3453 call ins_addr cC
3454 call ins_addr bCc
3455 call ins_addr reply-To
3456 call ins_addr mail-Followup-to
3457 call ins_ref messAge-id 0
3458 call ins_ref rEfErEncEs 1
3459 call ins_ref in-Reply-to 1
3460 call ins_ref subject 1 # Not a "ref", but works (with tweaks)
3461 call ins_addr freeForm1
3462 call ins_addr freeform2
3464 echo "~^header show MAILX-Command"; read es; call xerr $es "t_header 1000"
3465 call read_mline_res
3466 echo "~^header show MAILX-raw-TO"; read es; call xerr $es "t_header 1001"
3467 call read_mline_res
3469 echo t_header LEAVE
3471 define t_attach {
3472 echo t_attach ENTER
3474 echo "~^attachment";\
3475 read hl; echo $hl; vput vexpr es substr "$hl" 0 3
3476 if [ "$es" != 501 ]
3477 xcall bail "attach 0-1"
3480 echo "~^attach attribute ./.treadctl";\
3481 read hl; echo $hl; vput vexpr es substr "$hl" 0 3
3482 if [ "$es" != 501 ]
3483 xcall bail "attach 0-2"
3485 echo "~^attachment attribute-at 1";\
3486 read hl; echo $hl; vput vexpr es substr "$hl" 0 3
3487 if [ "$es" != 501 ]
3488 xcall bail "attach 0-3"
3491 echo "~^attachment insert ./.treadctl=ascii";\
3492 read hl; echo $hl; call xerr "$hl" "attach 1-1"
3493 echo "~^attachment list";\
3494 read es; echo $es;call xerr "$es" "attach 1-2"
3495 call read_mline_res
3496 echo "~^attachment attribute ./.treadctl";\
3497 read es; echo $es;call xerr "$es" "attach 1-3"
3498 call read_mline_res
3499 echo "~^attachment attribute .treadctl";\
3500 read es; echo $es;call xerr "$es" "attach 1-4"
3501 call read_mline_res
3502 echo "~^attachment attribute-at 1";\
3503 read es; echo $es;call xerr "$es" "attach 1-5"
3504 call read_mline_res
3506 echo "~^attachment attribute-set ./.treadctl filename rctl";\
3507 read es; echo $es;call xerr "$es" "attach 1-6"
3508 echo "~^attachment attribute-set .treadctl content-description Au";\
3509 read es; echo $es;call xerr "$es" "attach 1-7"
3510 echo "~^attachment attribute-set-at 1 content-id <10.du@ich>";\
3511 read es; echo $es;call xerr "$es" "attach 1-8"
3513 echo "~^attachment attribute ./.treadctl";\
3514 read es; echo $es;call xerr "$es" "attach 1-9"
3515 call read_mline_res
3516 echo "~^attachment attribute .treadctl";\
3517 read es; echo $es;call xerr "$es" "attach 1-10"
3518 call read_mline_res
3519 echo "~^attachment attribute rctl";\
3520 read es; echo $es;call xerr "$es" "attach 1-11"
3521 call read_mline_res
3522 echo "~^attachment attribute-at 1";\
3523 read es; echo $es;call xerr "$es" "attach 1-12"
3524 call read_mline_res
3527 echo "~^attachment insert ./.tattach=latin1";\
3528 read hl; echo $hl; call xerr "$hl" "attach 2-1"
3529 echo "~^attachment list";\
3530 read es; echo $es;call xerr "$es" "attach 2-2"
3531 call read_mline_res
3532 echo "~^attachment attribute ./.tattach";\
3533 read es; echo $es;call xerr "$es" "attach 2-3"
3534 call read_mline_res
3535 echo "~^attachment attribute .tattach";\
3536 read es; echo $es;call xerr "$es" "attach 2-4"
3537 call read_mline_res
3538 echo "~^attachment attribute-at 2";\
3539 read es; echo $es;call xerr "$es" "attach 2-5"
3540 call read_mline_res
3542 echo "~^attachment attribute-set ./.tattach filename tat";\
3543 read es; echo $es;call xerr "$es" "attach 2-6"
3544 echo \
3545 "~^attachment attribute-set .tattach content-description Au2";\
3546 read es; echo $es;call xerr "$es" "attach 2-7"
3547 echo "~^attachment attribute-set-at 2 content-id <20.du@wir>";\
3548 read es; echo $es;call xerr "$es" "attach 2-8"
3549 echo \
3550 "~^attachment attribute-set-at 2 content-type application/x-sh";\
3551 read es; echo $es;call xerr "$es" "attach 2-9"
3553 echo "~^attachment attribute ./.tattach";\
3554 read es; echo $es;call xerr "$es" "attach 2-10"
3555 call read_mline_res
3556 echo "~^attachment attribute .tattach";\
3557 read es; echo $es;call xerr "$es" "attach 2-11"
3558 call read_mline_res
3559 echo "~^attachment attribute tat";\
3560 read es; echo $es;call xerr "$es" "attach 2-12"
3561 call read_mline_res
3562 echo "~^attachment attribute-at 2";\
3563 read es; echo $es;call xerr "$es" "attach 2-13"
3564 call read_mline_res
3567 if [ "$t_remove" == "" ]
3568 return
3571 echo "~^attachment remove ./.treadctl"; read es;\
3572 call xerr $es "attach 3-1"
3573 echo "~^attachment remove ./.tattach"; read es;\
3574 call xerr $es "attach 3-2"
3575 echo "~^ attachment remove ./.treadctl"; read es;\
3576 vput vexpr es substr $es 0 3
3577 if [ $es != 501 ]
3578 xcall bail "attach 3-3"
3580 echo "~^ attachment remove ./.tattach"; read es;\
3581 vput vexpr es substr $es 0 3
3582 if [ $es != 501 ]
3583 xcall bail "attach 3-4"
3585 echo "~^attachment list"; read es;\
3586 vput vexpr es substr $es 0 3
3587 if [ $es != 501 ]
3588 xcall bail "attach 3-5"
3592 echo "~^attachment insert ./.tattach=latin1";\
3593 read hl; echo $hl; call xerr "$hl" "attach 4-1"
3594 echo "~^attachment insert ./.tattach=latin1";\
3595 read hl; echo $hl; call xerr "$hl" "attach 4-2"
3596 echo "~^attachment list";\
3597 read es; echo $es;call xerr "$es" "attach 4-3"
3598 call read_mline_res
3599 echo "~^ attachment remove .tattach"; read es;\
3600 vput vexpr es substr $es 0 3
3601 if [ $es != 506 ]
3602 xcall bail "attach 4-4 $es"
3604 echo "~^attachment remove-at T"; read es;\
3605 vput vexpr es substr $es 0 3
3606 if [ $es != 505 ]
3607 xcall bail "attach 4-5"
3609 echo "~^attachment remove ./.tattach"; read es;\
3610 call xerr $es "attach 4-6"
3611 echo "~^attachment remove ./.tattach"; read es;\
3612 call xerr $es "attach 4-7"
3613 echo "~^ attachment remove ./.tattach"; read es;\
3614 vput vexpr es substr $es 0 3
3615 if [ $es != 501 ]
3616 xcall bail "attach 4-8 $es"
3618 echo "~^attachment list"; read es;\
3619 vput vexpr es substr $es 0 3
3620 if [ $es != 501 ]
3621 xcall bail "attach 4-9"
3625 echo "~^attachment insert ./.tattach=latin1";\
3626 read hl; echo $hl; call xerr "$hl" "attach 5-1"
3627 echo "~^attachment insert ./.tattach=latin1";\
3628 read hl; echo $hl; call xerr "$hl" "attach 5-2"
3629 echo "~^attachment insert ./.tattach=latin1";\
3630 read hl; echo $hl; call xerr "$hl" "attach 5-3"
3631 echo "~^attachment list";\
3632 read es; echo $es;call xerr "$es" "attach 5-4"
3633 call read_mline_res
3635 echo "~^attachment remove-at 3"; read es;\
3636 call xerr $es "attach 5-5"
3637 echo "~^attachment remove-at 3"; read es;\
3638 vput vexpr es substr $es 0 3
3639 if [ $es != 501 ]
3640 xcall bail "attach 5-6"
3642 echo "~^attachment remove-at 2"; read es;\
3643 call xerr $es "attach 5-7"
3644 echo "~^attachment remove-at 2"; read es;\
3645 vput vexpr es substr $es 0 3
3646 if [ $es != 501 ]
3647 xcall bail "attach 5-8"
3649 echo "~^attachment remove-at 1"; read es;\
3650 call xerr $es "attach 5-9"
3651 echo "~^attachment remove-at 1"; read es;\
3652 vput vexpr es substr $es 0 3
3653 if [ $es != 501 ]
3654 xcall bail "attach 5-10"
3657 echo "~^attachment list"; read es;\
3658 vput vexpr es substr $es 0 3
3659 if [ $es != 501 ]
3660 xcall bail "attach 5-11"
3664 echo "~^attachment insert ./.tattach=latin1";\
3665 read hl; echo $hl; call xerr "$hl" "attach 6-1"
3666 echo "~^attachment insert ./.tattach=latin1";\
3667 read hl; echo $hl; call xerr "$hl" "attach 6-2"
3668 echo "~^attachment insert ./.tattach=latin1";\
3669 read hl; echo $hl; call xerr "$hl" "attach 6-3"
3670 echo "~^attachment list";\
3671 read es; echo $es;call xerr "$es" "attach 6-4"
3672 call read_mline_res
3674 echo "~^attachment remove-at 1"; read es;\
3675 call xerr $es "attach 6-5"
3676 echo "~^attachment remove-at 1"; read es;\
3677 call xerr $es "attach 6-6"
3678 echo "~^attachment remove-at 1"; read es;\
3679 call xerr $es "attach 6-7"
3680 echo "~^attachment remove-at 1"; read es;\
3681 vput vexpr es substr $es 0 3
3682 if [ $es != 501 ]
3683 xcall bail "attach 6-8"
3686 echo "~^attachment list"; read es;\
3687 vput vexpr es substr $es 0 3
3688 if [ $es != 501 ]
3689 xcall bail "attach 6-9"
3692 echo t_attach LEAVE
3694 define t_ocs {
3695 read ver
3696 echo t_ocs
3697 call t_header
3698 call t_attach
3700 define t_oce {
3701 echo on-compose-enter, mailx-command<$mailx-command>
3702 alternates alter1@exam.ple alter2@exam.ple
3703 alternates
3704 set autocc='alter1@exam.ple alter2@exam.ple'
3705 echo mailx-from<$mailx-from> mailx-sender<$mailx-sender>
3706 echo mailx-subject<$mailx-subject>
3707 echo mailx-to<$mailx-to> mailx-cc<$mailx-cc> mailx-bcc<$mailx-bcc>
3708 echo mailx-raw-to<$mailx-raw-to> mailx-raw-cc<$mailx-raw-cc> \
3709 mailx-raw-bcc<$mailx-raw-bcc>
3710 echo mailx-orig-from<$mailx-orig-from> mailx-orig-to<$mailx-orig-to> \
3711 mailx-orig-cc<$mailx-orig-cc> mailx-orig-bcc<$mailx-orig-bcc>
3713 define t_ocl {
3714 echo on-compose-leave, mailx-command<$mailx-command>
3715 vput alternates al
3716 eval alternates $al alter3@exam.ple alter4@exam.ple
3717 alternates
3718 set autobcc='alter3@exam.ple alter4@exam.ple'
3719 echo mailx-from<$mailx-from> mailx-sender<$mailx-sender>
3720 echo mailx-subject<$mailx-subject>
3721 echo mailx-to<$mailx-to> mailx-cc<$mailx-cc> mailx-bcc<$mailx-bcc>
3722 echo mailx-raw-to<$mailx-raw-to> mailx-raw-cc<$mailx-raw-cc> \
3723 mailx-raw-bcc<$mailx-raw-bcc>
3724 echo mailx-orig-from<$mailx-orig-from> mailx-orig-to<$mailx-orig-to> \
3725 mailx-orig-cc<$mailx-orig-cc> mailx-orig-bcc<$mailx-orig-bcc>
3727 define t_occ {
3728 echo on-compose-cleanup, mailx-command<$mailx-command>
3729 unalternates *
3730 alternates
3731 echo mailx-from<$mailx-from> mailx-sender<$mailx-sender>
3732 echo mailx-subject<$mailx-subject>
3733 echo mailx-to<$mailx-to> mailx-cc<$mailx-cc> mailx-bcc<$mailx-bcc>
3734 echo mailx-raw-to<$mailx-raw-to> mailx-raw-cc<$mailx-raw-cc> \
3735 mailx-raw-bcc<$mailx-raw-bcc>
3736 echo mailx-orig-from<$mailx-orig-from> mailx-orig-to<$mailx-orig-to> \
3737 mailx-orig-cc<$mailx-orig-cc> mailx-orig-bcc<$mailx-orig-bcc>
3739 wysh set on-compose-splice=t_ocs \
3740 on-compose-enter=t_oce on-compose-leave=t_ocl \
3741 on-compose-cleanup=t_occ
3742 __EOT__
3744 printf 'm this-goes@nowhere\nbody\n!.\n' |
3745 ${MAILX} ${ARGS} -Snomemdebug -Sescape=! -Sstealthmua=noagent \
3746 -X'source ./.trc' -Smta=./.tmta.sh \
3747 >./.tall 2>&1
3748 ${cat} ./.tall >> "${MBOX}"
3749 check 1 0 "${MBOX}" '2481823179 10101'
3751 ${rm} "${MBOX}"
3752 printf 'm this-goes@nowhere\nbody\n!.\n' |
3753 ${MAILX} ${ARGS} -Snomemdebug -Sescape=! -Sstealthmua=noagent \
3754 -St_remove=1 -X'source ./.trc' -Smta=./.tmta.sh \
3755 >./.tall 2>&1
3756 ${cat} ./.tall >> "${MBOX}"
3757 check 2 0 "${MBOX}" '3654000499 12535'
3761 # Some state machine stress, shell compose hook, localopts for hook, etc.
3762 # readctl in child. ~r as HERE document
3763 ${rm} "${MBOX}"
3764 printf 'm ex@am.ple\nbody\n!.
3765 echon ${mailx-command}${mailx-subject}
3766 echon ${mailx-from}${mailx-sender}
3767 echon ${mailx-to}${mailx-cc}${mailx-bcc}
3768 echon ${mailx-raw-to}${mailx-raw-cc}${mailx-raw-bcc}
3769 echon ${mailx-orig-from}${mailx-orig-to}${mailx-orig-gcc}${mailx-orig-bcc}
3770 var t_oce t_ocs t_ocs_sh t_ocl t_occ autocc
3771 ' | ${MAILX} ${ARGS} -Snomemdebug -Sescape=! \
3772 -Smta=./.tmta.sh \
3774 define bail {
3775 echoerr "Failed: $1. Bailing out"; echo "~x"; xit
3777 define xerr {
3778 vput vexpr es substr "$1" 0 1
3779 if [ "$es" != 2 ]
3780 xcall bail "$2"
3783 define read_mline_res {
3784 read hl; wysh set len=$? es=$! en=$^ERRNAME;\
3785 echo $len/$es/$^ERRNAME: $hl
3786 if [ $es -ne $^ERR-NONE ]
3787 xcall bail read_mline_res
3788 elif [ $len -ne 0 ]
3789 \xcall read_mline_res
3792 define _work {
3793 vput vexpr i + 1 "$2"
3794 if [ $i -lt 111 ]
3795 vput vexpr j % $i 10
3796 if [ $j -ne 0 ]
3797 set j=xcall
3798 else
3799 echon "$i.. "
3800 set j=call
3802 eval \\$j _work $1 $i
3803 return $?
3805 vput vexpr i + $i "$1"
3806 return $i
3808 define _read {
3809 wysh set line; read line;wysh set es=$? en=$^ERRNAME ;\
3810 echo read:$es/$en: $line
3811 if [ "${es}" -ne -1 ]
3812 xcall _read
3814 readctl remove $cwd/.treadctl; echo readctl remove:$?/$^ERRNAME
3816 define t_ocs {
3817 read ver
3818 echo t_ocs
3819 echo "~^header list"; read hl; echo $hl;\
3820 vput vexpr es substr "$hl" 0 1
3821 if [ "$es" != 2 ]
3822 xcall bail "header list"
3823 endif
3825 call _work 1; echo $?
3826 echo "~^header insert cc splicy diet <splice@exam.ple> spliced";\
3827 read es; echo $es; vput vexpr es substr "$es" 0 1
3828 if [ "$es" != 2 ]
3829 xcall bail "be diet"
3830 endif
3831 echo "~^header insert cc <splice2@exam.ple>";\
3832 read es; echo $es; vput vexpr es substr "$es" 0 1
3833 if [ "$es" != 2 ]
3834 xcall bail "be diet2"
3835 endif
3837 call _work 2; echo $?
3838 echo "~^header insert bcc juicy juice <juice@exam.ple> spliced";\
3839 read es; echo $es;vput vexpr es substr "$es" 0 1
3840 if [ "$es" != 2 ]
3841 xcall bail "be juicy"
3842 endif
3843 echo "~^header insert bcc juice2@exam.ple";\
3844 read es; echo $es;vput vexpr es substr "$es" 0 1
3845 if [ "$es" != 2 ]
3846 xcall bail "be juicy2"
3847 endif
3848 echo "~^header insert bcc juice3 <juice3@exam.ple>";\
3849 read es; echo $es;vput vexpr es substr "$es" 0 1
3850 if [ "$es" != 2 ]
3851 xcall bail "be juicy3"
3852 endif
3853 echo "~^header insert bcc juice4@exam.ple";\
3854 read es; echo $es;vput vexpr es substr "$es" 0 1
3855 if [ "$es" != 2 ]
3856 xcall bail "be juicy4"
3857 endif
3859 echo "~^header remove-at bcc 3";\
3860 read es; echo $es;vput vexpr es substr "$es" 0 1
3861 if [ "$es" != 2 ]
3862 xcall bail "remove juicy5"
3863 endif
3864 echo "~^header remove-at bcc 2";\
3865 read es; echo $es;vput vexpr es substr "$es" 0 1
3866 if [ "$es" != 2 ]
3867 xcall bail "remove juicy6"
3868 endif
3869 echo "~^header remove-at bcc 3";\
3870 read es; echo $es;vput vexpr es substr "$es" 0 3
3871 if [ "$es" != 501 ]
3872 xcall bail "failed to remove-at"
3873 endif
3874 # Add duplicates which ought to be removed!
3875 echo "~^header insert bcc juice4@exam.ple";\
3876 read es; echo $es;vput vexpr es substr "$es" 0 1
3877 if [ "$es" != 2 ]
3878 xcall bail "be juicy4-1"
3879 endif
3880 echo "~^header insert bcc juice4@exam.ple";\
3881 read es; echo $es;vput vexpr es substr "$es" 0 1
3882 if [ "$es" != 2 ]
3883 xcall bail "be juicy4-2"
3884 endif
3885 echo "~^header insert bcc juice4@exam.ple";\
3886 read es; echo $es;vput vexpr es substr "$es" 0 1
3887 if [ "$es" != 2 ]
3888 xcall bail "be juicy4-3"
3889 endif
3890 echo "~:set t_ocs"
3893 call _work 3; echo $?
3894 echo "~r - '__EOT'"
3895 vput ! i echo just knock if you can hear me;\
3896 i=0;\
3897 while [ $i -lt 24 ]; do printf "%s " $i; i=`expr $i + 1`; done;\
3898 echo relax
3899 echon shell-cmd says $?/$^ERRNAME: $i
3900 echo "~x will not become interpreted, we are reading until __EOT"
3901 echo "__EOT"
3902 read r_status; echo "~~r status output: $r_status"
3903 echo "~:echo $? $! $^ERRNAME"
3904 read r_status
3905 echo "~~r status from parent: $r_status"
3908 call _work 4; echo $?
3909 vput cwd cwd;echo cwd:$?
3910 readctl create $cwd/.treadctl ;echo readctl:$?/$^ERRNAME;\
3911 call _read
3914 call _work 5; echo $?
3915 echo "~^header show MAILX-Command"; read es;\
3916 call xerr $es "t_header 1000"; call read_mline_res
3917 echo "~^header show MAILX-raw-TO"; read es;\
3918 call xerr $es "t_header 1001"; xcall read_mline_res
3920 echoerr IT IS WRONG IF YOU SEE THIS
3922 define t_oce {
3923 echo on-compose-enter, mailx-command<$mailx-command>
3924 set t_oce autobcc=oce@exam.ple
3925 alternates alter1@exam.ple alter2@exam.ple
3926 alternates
3927 echo mailx-from<$mailx-from> mailx-sender<$mailx-sender>
3928 echo mailx-subject<$mailx-subject>
3929 echo mailx-to<$mailx-to> mailx-cc<$mailx-cc> mailx-bcc<$mailx-bcc>
3930 echo mailx-raw-to<$mailx-raw-to> mailx-raw-cc<$mailx-raw-cc> \
3931 mailx-raw-bcc<$mailx-raw-bcc>
3932 echo mailx-orig-from<$mailx-orig-from> \
3933 mailx-orig-to<$mailx-orig-to> \
3934 mailx-orig-cc<$mailx-orig-cc> mailx-orig-bcc<$mailx-orig-bcc>
3936 define t_ocl {
3937 echo on-compose-leave, mailx-command<$mailx-command>
3938 set t_ocl autocc=ocl@exam.ple
3939 unalternates *
3940 alternates alter3@exam.ple alter4@exam.ple
3941 alternates
3942 echo mailx-from<$mailx-from> mailx-sender<$mailx-sender>
3943 echo mailx-subject<$mailx-subject>
3944 echo mailx-to<$mailx-to> mailx-cc<$mailx-cc> mailx-bcc<$mailx-bcc>
3945 echo mailx-raw-to<$mailx-raw-to> mailx-raw-cc<$mailx-raw-cc> \
3946 mailx-raw-bcc<$mailx-raw-bcc>
3947 echo mailx-orig-from<$mailx-orig-from> \
3948 mailx-orig-to<$mailx-orig-to> \
3949 mailx-orig-cc<$mailx-orig-cc> mailx-orig-bcc<$mailx-orig-bcc>
3951 define t_occ {
3952 echo on-compose-cleanup, mailx-command<$mailx-command>
3953 set t_occ autocc=occ@exam.ple
3954 unalternates *
3955 alternates
3956 echo mailx-from<$mailx-from> mailx-sender<$mailx-sender>
3957 echo mailx-subject<$mailx-subject>
3958 echo mailx-to<$mailx-to> mailx-cc<$mailx-cc> mailx-bcc<$mailx-bcc>
3959 echo mailx-raw-to<$mailx-raw-to> mailx-raw-cc<$mailx-raw-cc> \
3960 mailx-raw-bcc<$mailx-raw-bcc>
3961 echo mailx-orig-from<$mailx-orig-from> \
3962 mailx-orig-to<$mailx-orig-to> \
3963 mailx-orig-cc<$mailx-orig-cc> mailx-orig-bcc<$mailx-orig-bcc>
3965 wysh set on-compose-splice=t_ocs \
3966 on-compose-splice-shell="read ver;echo t_ocs-shell;\
3967 echo \"~t shell@exam.ple\"; echo \"~:set t_ocs_sh\"" \
3968 on-compose-enter=t_oce on-compose-leave=t_ocl \
3969 on-compose-cleanup=t_occ
3970 ' > ./.tnotes 2>&1
3971 check_ex0 3-estat
3972 ${cat} ./.tnotes >> "${MBOX}"
3973 check 3 - "${MBOX}" '679526364 2431'
3975 # Reply, forward, resend, Resend
3977 ${rm} "${MBOX}"
3978 printf 'set from=f1@z\nm t1@z\nb1\n!.\nset from=f2@z\nm t2@z\nb2\n!.\n' |
3979 ${MAILX} ${ARGS} -Snomemdebug -Sescape=! \
3980 -Smta=./.tmta.sh
3982 printf '
3983 echo start: $? $! $^ERRNAME
3984 File %s
3985 echo File: $? $! $^ERRNAME;echo;echo
3986 reply 1
3987 this is content of reply 1
3989 echo reply 1: $? $! $^ERRNAME;echo;echo
3990 Reply 1 2
3991 this is content of Reply 1 2
3993 echo Reply 1 2: $? $! $^ERRNAME;echo;echo
3994 forward 1 fwdex@am.ple
3995 this is content of forward 1
3997 echo forward 1: $? $! $^ERRNAME;echo;echo
3998 resend 1 2 resendex@am.ple
3999 echo resend 1 2: $? $! $^ERRNAME;echo;echo
4000 Resend 1 2 Resendex@am.ple
4001 echo Resend 1 2: $? $! $^ERRNAME;echo;echo
4002 ' "${MBOX}" |
4003 ${MAILX} ${ARGS} -Snomemdebug -Sescape=! \
4004 -Smta=./.tmta.sh \
4006 define bail {
4007 echoerr "Failed: $1. Bailing out"; echo "~x"; xit
4009 define xerr {
4010 vput vexpr es substr "$1" 0 1
4011 if [ "$es" != 2 ]
4012 xcall bail "$2"
4015 define read_mline_res {
4016 read hl; wysh set len=$? es=$! en=$^ERRNAME;\
4017 echo mline_res:$len/$es/$^ERRNAME: $hl
4018 if [ $es -ne $^ERR-NONE ]
4019 xcall bail read_mline_res
4020 elif [ $len -ne 0 ]
4021 \xcall read_mline_res
4024 define work_hl {
4025 echo "~^header show $1"; read es;\
4026 call xerr $es "work_hl $1"; echo $1; call read_mline_res
4027 if [ $# -gt 1 ]
4028 shift
4029 xcall work_hl "$@"
4032 define t_ocs {
4033 read ver
4034 echo t_ocs version $ver
4035 echo "~^header list"; read hl; echo $hl;\
4036 echoerr the header list is $hl;\
4037 call xerr "$hl" "header list"
4038 eval vpospar set $hl
4039 shift
4040 xcall work_hl "$@"
4041 echoerr IT IS WRONG IF YOU SEE THIS
4043 define t_oce {
4044 echo on-XY-enter, mailx-command<$mailx-command>
4045 set t_oce autobcc=oce@exam.ple
4046 echo mailx-from<$mailx-from> mailx-sender<$mailx-sender>
4047 echo mailx-subject<$mailx-subject>
4048 echo mailx-to<$mailx-to> mailx-cc<$mailx-cc> mailx-bcc<$mailx-bcc>
4049 echo mailx-raw-to<$mailx-raw-to> mailx-raw-cc<$mailx-raw-cc> \
4050 mailx-raw-bcc<$mailx-raw-bcc>
4051 echo mailx-orig-from<$mailx-orig-from> \
4052 mailx-orig-to<$mailx-orig-to> \
4053 mailx-orig-cc<$mailx-orig-cc> mailx-orig-bcc<$mailx-orig-bcc>
4055 define t_ocl {
4056 echo on-XY-leave, mailx-command<$mailx-command>
4057 set t_ocl autocc=ocl@exam.ple
4058 echo mailx-from<$mailx-from> mailx-sender<$mailx-sender>
4059 echo mailx-subject<$mailx-subject>
4060 echo mailx-to<$mailx-to> mailx-cc<$mailx-cc> mailx-bcc<$mailx-bcc>
4061 echo mailx-raw-to<$mailx-raw-to> mailx-raw-cc<$mailx-raw-cc> \
4062 mailx-raw-bcc<$mailx-raw-bcc>
4063 echo mailx-orig-from<$mailx-orig-from> \
4064 mailx-orig-to<$mailx-orig-to> \
4065 mailx-orig-cc<$mailx-orig-cc> mailx-orig-bcc<$mailx-orig-bcc>
4067 define t_occ {
4068 echo on-XY-cleanup, mailx-command<$mailx-command>
4069 set t_occ autocc=occ@exam.ple
4070 echo mailx-from<$mailx-from> mailx-sender<$mailx-sender>
4071 echo mailx-subject<$mailx-subject>
4072 echo mailx-to<$mailx-to> mailx-cc<$mailx-cc> mailx-bcc<$mailx-bcc>
4073 echo mailx-raw-to<$mailx-raw-to> mailx-raw-cc<$mailx-raw-cc> \
4074 mailx-raw-bcc<$mailx-raw-bcc>
4075 echo mailx-orig-from<$mailx-orig-from> \
4076 mailx-orig-to<$mailx-orig-to> \
4077 mailx-orig-cc<$mailx-orig-cc> mailx-orig-bcc<$mailx-orig-bcc>
4079 wysh set on-compose-splice=t_ocs \
4080 on-compose-enter=t_oce on-compose-leave=t_ocl \
4081 on-compose-cleanup=t_occ \
4082 on-resend-enter=t_oce on-resend-cleanup=t_occ
4083 ' > ./.tnotes 2>&1
4084 check_ex0 4-estat
4085 ${cat} ./.tnotes >> "${MBOX}"
4086 check 4 - "${MBOX}" '3038884027 7516'
4088 t_epilog
4091 t_C_opt_customhdr() {
4092 t_prolog C_opt_customhdr
4093 TRAP_EXIT_ADDONS="./.t*"
4095 t_xmta 'CimicifugaRacemosa Mon Dec 25 21:33:40 2017'
4097 echo bla |
4098 ${MAILX} ${ARGS} -Smta=./.tmta.sh \
4099 -C 'C-One : Custom One Body' \
4100 -C 'C-Two:CustomTwoBody' \
4101 -S customhdr='chdr1: chdr1 body, chdr2:chdr2 body' \
4102 this-goes@nowhere >./.tall 2>&1
4103 check_ex0 1-estat
4104 ${cat} ./.tall >> "${MBOX}"
4105 check 1 0 "${MBOX}" '2400078426 195'
4107 ${rm} "${MBOX}"
4108 printf 'm this-goes@nowhere\nbody\n!.
4109 unset customhdr
4110 m this-goes2@nowhere\nbody2\n!.
4111 set customhdr=%ccustom1 : custom1 body%c
4112 m this-goes2@nowhere\nbody2\n!.
4113 set customhdr=%ccustom1 : custom1\\, body , custom2: custom2 body%c
4114 m this-goes3@nowhere\nbody3\n!.
4115 ' "'" "'" "'" "'" |
4116 ${MAILX} ${ARGS} -Smta=./.tmta.sh -Sescape=! \
4117 -C 'C-One : Custom One Body' \
4118 -C 'C-Two:CustomTwoBody' \
4119 -S customhdr='chdr1: chdr1 body, chdr2:chdr2 body' \
4120 >./.tall 2>&1
4121 check_ex0 2-estat
4122 ${cat} ./.tall >> "${MBOX}"
4123 check 2 0 "${MBOX}" '3546878678 752'
4125 t_epilog
4128 t_quote_a_cmd_escapes() {
4129 t_prolog quote_a_cmd_escapes
4130 TRAP_EXIT_ADDONS="./.t*"
4132 t_xmta
4134 echo 'included file' > ./.ttxt
4136 ${cat} <<-_EOT > ./.tmbox
4137 From neverneverland Sun Jul 23 13:46:25 2017
4138 Subject: Bugstop: five miles out 1
4139 Reply-To: mister originator1 <mr1@originator>
4140 From: mister originator1 <mr1@originator>
4141 To: bugstop-commit@five.miles.out
4142 Cc: is1@a.list
4143 In-reply-to: <20170719111113.bkcMz%laber1@backe.eu>
4144 Date: Wed, 19 Jul 2017 09:22:57 -0400
4145 Message-Id: <20170719132257.766AF781267-1@originator>
4146 Status: RO
4148 That's appalling, I.
4150 From neverneverland Sun Jul 23 13:47:25 2017
4151 Subject: Bugstop: five miles out 2
4152 Reply-To: mister originator2 <mr2@originator>
4153 From: mister originator2 <mr2@originator>
4154 To: bugstop-commit@five.miles.out
4155 Cc: is2@a.list
4156 In-reply-to: <20170719111113.bkcMz%laber2@backe.eu>
4157 Date: Wed, 19 Jul 2017 09:23:57 -0400
4158 Message-Id: <20170719132257.766AF781267-2@originator>
4159 Status: RO
4161 That's appalling, II.
4163 From neverneverland Sun Jul 23 13:48:25 2017
4164 Subject: Bugstop: five miles out 3
4165 Reply-To: mister originator3 <mr3@originator>
4166 From: mister originator3 <mr3@originator>
4167 To: bugstop-commit@five.miles.out
4168 Cc: is3@a.list
4169 In-reply-to: <20170719111113.bkcMz%laber3@backe.eu>
4170 Date: Wed, 19 Jul 2017 09:24:57 -0400
4171 Message-Id: <20170719132257.766AF781267-3@originator>
4172 Status: RO
4174 That's appalling, III.
4176 _EOT
4178 printf '#
4179 set indentprefix=" |"
4180 set quote
4181 reply 2
4183 set quote=noheading
4184 reply 2
4186 headerpick type retain cc date from message-id reply-to subject to
4187 set quote=headers
4188 reply 2
4190 set quote=allheaders
4191 reply 2
4193 ' | ${MAILX} ${ARGS} -Smta=./.tmta.sh -Rf \
4194 -Sescape=! -Sindentprefix=' >' \
4195 ./.tmbox >./.tall 2>&1
4196 check_ex0 1-estat
4197 ${cat} ./.tall >> "${MBOX}"
4198 check 1 0 "${MBOX}" '2181726970 2023'
4200 # ~@ is tested with other attachment stuff, ~^ is in compose_hooks
4201 ${rm} "${MBOX}"
4202 printf '#
4203 set Sign=SignVar sign=signvar DEAD=./.ttxt
4204 headerpick type retain Subject
4205 reply 2
4206 !!1 Not escaped. And shell test last, right before !..
4207 !: echo 2 only echoed via colon
4208 !_ echo 3 only echoed via underscore
4209 !< ./.ttxt
4210 !<! echo 5 shell echo included
4211 !| echo 6 pipecmd-pre; cat; echo 6 pipecmd-post
4212 7 and 8 are ~A and ~a:
4215 !b 9 added ~b cc <ex1@am.ple>
4216 !c 10 added ~c c <ex2@am.ple>
4217 11 next ~d / $DEAD
4219 12: ~F
4221 13: ~F 1 3
4222 !F 1 3
4223 14: ~f (headerpick: subject)
4225 15: ~f 1
4226 !f 1
4227 16, 17: ~I Sign, ~i Sign
4228 !I Sign
4229 !i Sign
4230 18: ~M
4232 19: ~M 1
4233 !M 1
4234 20: ~m
4236 21: ~m 3
4237 !m 3
4238 22: ~R ./.ttxt
4239 !R ./.ttxt
4240 23: ~r ./.ttxt
4241 !r ./.ttxt
4242 24: ~s this new subject
4243 !s 24 did new ~s ubject
4244 !t 25 added ~t o <ex3@am.ple>
4245 26: ~U
4247 27: ~U 1
4248 !U 1
4249 and i ~w rite this out to ./.tmsg
4250 !w ./.tmsg
4251 !:wysh set x=$escape;set escape=~
4252 ~!echo shell command output
4253 ~:wysh set escape=$x
4255 ' | ${MAILX} ${ARGS} -Smta=./.tmta.sh -Rf \
4256 -Sescape=! -Sindentprefix=' |' \
4257 ./.tmbox >./.tall 2>&1
4258 check_ex0 2-estat
4259 ${cat} ./.tall >> "${MBOX}"
4260 check 2 0 "${MBOX}" '639836485 3604'
4261 check 3 - ./.tmsg '2112542907 2789'
4263 t_epilog
4266 t_mass_recipients() {
4267 t_prolog mass_recipients
4268 TRAP_EXIT_ADDONS="./.t*"
4270 t_xmta 'Eucalyptus Sat Jul 08 21:14:57 2017'
4272 ${cat} <<'__EOT__' > ./.trc
4273 define bail {
4274 echoerr "Failed: $1. Bailing out"; echo "~x"; xit
4276 define ins_addr {
4277 wysh set nr=$1 hn=$2
4278 echo "~$hn $hn$nr@$hn"; echo '~:echo $?'; read es
4279 if [ "$es" -ne 0 ]
4280 xcall bail "ins_addr $hn 1-$nr"
4282 vput vexpr nr + $nr 1
4283 if [ "$nr" -le "$maximum" ]
4284 xcall ins_addr $nr $hn
4287 define bld_alter {
4288 wysh set nr=$1 hn=$2
4289 alternates $hn$nr@$hn
4290 vput vexpr nr + $nr 2
4291 if [ "$nr" -le "$maximum" ]
4292 xcall bld_alter $nr $hn
4295 define t_ocs {
4296 read ver
4297 call ins_addr 1 t
4298 call ins_addr 1 c
4299 call ins_addr 1 b
4301 define t_ocl {
4302 if [ "$t_remove" != '' ]
4303 call bld_alter 1 t
4304 call bld_alter 2 c
4307 set on-compose-splice=t_ocs on-compose-leave=t_ocl
4308 __EOT__
4310 printf 'm this-goes@nowhere\nbody\n!.\n' |
4311 ${MAILX} ${ARGS} -Snomemdebug -Sescape=! -Sstealthmua=noagent \
4312 -X'source ./.trc' -Smta=./.tmta.sh -Smaximum=2001 \
4313 >./.tall 2>&1
4314 check_ex0 1-estat
4315 ${cat} ./.tall >> "${MBOX}"
4316 check 1 - "${MBOX}" '2912243346 51526'
4318 ${rm} "${MBOX}"
4319 printf 'm this-goes@nowhere\nbody\n!.\n' |
4320 ${MAILX} ${ARGS} -Snomemdebug -Sescape=! -Sstealthmua=noagent \
4321 -St_remove=1 -X'source ./.trc' -Smta=./.tmta.sh -Smaximum=2001 \
4322 >./.tall 2>&1
4323 check_ex0 2-estat
4324 ${cat} ./.tall >> "${MBOX}"
4325 check 2 - "${MBOX}" '4097804632 34394'
4327 t_epilog
4330 t_mime_types_load_control() {
4331 t_prolog mime_types_load_control
4332 if have_feat uistrings; then :; else
4333 echo 'mime_types_load_control: unsupported, skipped'
4334 return
4336 TRAP_EXIT_ADDONS="./.t*"
4338 ${cat} <<-_EOT > ./.tmts1
4339 @ application/mathml+xml mathml
4340 _EOT
4341 ${cat} <<-_EOT > ./.tmts2
4342 @ x-conference/x-cooltalk ice
4343 @ aga-aga aga
4344 @ application/aga-aga aga
4345 _EOT
4347 ${cat} <<-_EOT > ./.tmts1.mathml
4348 <head>nonsense ML</head>
4349 _EOT
4350 ${cat} <<-_EOT > ./.tmts2.ice
4351 Icy, icy road.
4352 _EOT
4353 printf 'of which the c\x01rack is coming soon' > ./.tmtsx.doom
4354 printf 'of which the c\x01rack is coming soon' > ./.tmtsx.aga
4356 printf '
4357 m %s
4358 Schub-di-du
4359 ~@ ./.tmts1.mathml
4360 ~@ ./.tmts2.ice
4361 ~@ ./.tmtsx.doom
4362 ~@ ./.tmtsx.aga
4364 File %s
4365 from*
4366 type
4368 ' "${MBOX}" "${MBOX}" |
4369 ${MAILX} ${ARGS} \
4370 -Smimetypes-load-control=f=./.tmts1,f=./.tmts2 \
4371 > ./.tout 2>&1
4372 check_ex0 1-estat
4373 ${cat} "${MBOX}" >> ./.tout
4374 check 1 - ./.tout '1441260727 2449'
4376 echo type | ${MAILX} ${ARGS} -R \
4377 -Smimetypes-load-control=f=./.tmts1,f=./.tmts3 \
4378 -f "${MBOX}" >> ./.tout 2>&1
4379 check 2 0 ./.tout '1441391438 3646'
4381 t_epilog
4384 t_lreply_futh_rth_etc() {
4385 t_prolog lreply_futh_rth_etc
4386 TRAP_EXIT_ADDONS="./.t*"
4388 t_xmta 'HumulusLupulus Thu Jul 27 14:41:20 2017'
4390 ${cat} <<-_EOT > ./.tmbox
4391 From neverneverland Sun Jul 23 13:46:25 2017
4392 Subject: Bugstop: five miles out 1
4393 Reply-To: mister originator2 <mr2@originator>, bugstop@five.miles.out
4394 From: mister originator <mr@originator>
4395 To: bugstop-commit@five.miles.out, laber@backe.eu
4396 Cc: is@a.list
4397 Mail-Followup-To: bugstop@five.miles.out, laber@backe.eu, is@a.list
4398 In-reply-to: <20170719111113.bkcMz%laber@backe.eu>
4399 Date: Wed, 19 Jul 2017 09:22:57 -0400
4400 Message-Id: <20170719132257.766AF781267@originator>
4401 Status: RO
4403 > |Sorry, I think I misunderstand something. I would think that
4405 That's appalling.
4407 From neverneverland Fri Jul 7 22:39:11 2017
4408 Subject: Bugstop: five miles out 2
4409 Reply-To: mister originator2<mr2@originator>,bugstop@five.miles.out,is@a.list
4410 Content-Transfer-Encoding: 7bit
4411 From: mister originator <mr@originator>
4412 To: bugstop-commit@five.miles.out
4413 Cc: is@a.list
4414 Message-ID: <149945963975.28888.6950788126957753723.reportbug@five.miles.out>
4415 Date: Fri, 07 Jul 2017 16:33:59 -0400
4416 Status: R
4418 capable of changing back.
4420 From neverneverland Fri Jul 7 22:42:00 2017
4421 Subject: Bugstop: five miles out 3
4422 Reply-To: mister originator2 <mr2@originator>, bugstop@five.miles.out
4423 Content-Transfer-Encoding: 7bit
4424 From: mister originator <mr@originator>
4425 To: bugstop-commit@five.miles.out
4426 Cc: is@a.list
4427 Message-ID: <149945963975.28888.6950788126957753746.reportbug@five.miles.out>
4428 Date: Fri, 07 Jul 2017 16:33:59 -0400
4429 List-Post: <mailto:bugstop@five.miles.out>
4430 Status: R
4432 are you ready, boots?
4434 From neverneverland Sat Aug 19 23:15:00 2017
4435 Subject: Bugstop: five miles out 4
4436 Reply-To: mister originator2 <mr2@originator>, bugstop@five.miles.out
4437 Content-Transfer-Encoding: 7bit
4438 From: mister originator <mr@originator>
4439 To: bugstop@five.miles.out
4440 Cc: is@a.list
4441 Message-ID: <149945963975.28888.6950788126qtewrqwer.reportbug@five.miles.out>
4442 Date: Fri, 07 Jul 2017 16:33:59 -0400
4443 List-Post: <mailto:bugstop@five.miles.out>
4444 Status: R
4446 are you ready, boots?
4447 _EOT
4451 ${cat} <<-'_EOT' | ${MAILX} ${ARGS} -Sescape=! -Smta=./.tmta.sh \
4452 -Rf ./.tmbox >> "${MBOX}" 2>&1
4453 define r {
4454 wysh set m="This is text of \"reply ${1}."
4455 reply 1 2 3
4456 !I m
4459 !I m
4462 !I m
4465 echo -----After reply $1.1 - $1.3: $?/$^ERRNAME
4467 define R {
4468 wysh set m="This is text of \"Reply ${1}."
4469 eval Reply $2
4470 !I m
4471 !I 2
4474 echo -----After Reply $1.$2: $?/$^ERRNAME
4476 define _Lh {
4477 read protover
4478 echo '~I m'
4479 echo '~I n'
4480 echo '".'
4482 define _Ls {
4483 wysh set m="This is text of \"Lreply ${1}." on-compose-splice=_Lh n=$2
4484 eval Lreply $2
4486 define L {
4487 # We need two indirections for this test: one for the case that Lreply
4488 # fails because of missing recipients: we need to read EOF next, thus
4489 # place this in _Ls last; and second for the succeeding cases EOF is
4490 # not what these should read, so go over the backside and splice it in!
4491 call _Ls "$@"
4492 echo -----After Lreply $1.$2: $?/$^ERRNAME
4494 define x {
4495 localopts call-fixate yes
4496 call r $1
4497 call R $1 1; call R $1 2; call R $1 3; call R $1 4
4498 call L $1 1; call L $1 2; call L $1 3
4500 define tweak {
4501 echo;echo '===== CHANGING === '"$*"' =====';echo
4502 eval "$@"
4505 set from=laber@backe.eu
4506 mlist is@a.list
4507 call x 1
4508 call tweak set reply-to-honour
4509 call x 2
4510 call tweak set followup-to
4511 call x 3
4512 call tweak set followup-to-honour
4513 call x 4
4514 call tweak mlist bugstop@five.miles.out
4515 call x 5
4516 call tweak mlsubscribe bugstop@five.miles.out
4517 call x 6
4518 call tweak set recipients-in-cc
4519 call x 7
4520 _EOT
4522 check_ex0 1-estat
4523 if have_feat uistrings; then
4524 check 1 - "${MBOX}" '2950056640 29373'
4525 else
4526 echo 'lreply_futh_rth_etc-1: content test unsupported, skipped'
4531 ${cat} <<-_EOT > ./.tmbox
4532 From tom@i-i.example Thu Oct 26 03:15:55 2017
4533 Date: Wed, 25 Oct 2017 21:15:46 -0400
4534 From: tom <tom@i-i.example>
4535 To: Steffen Nurpmeso <steffen@sdaoden.eu>
4536 Cc: tom <tom@i-i.example>
4537 Subject: Re: xxxx yyyyyyyy configure does not really like a missing zzzzz
4538 Message-ID: <20171026011546.GA11643@i-i.example>
4539 Reply-To: tom@i-i.example
4540 References: <20171025214601.T2pNd%steffen@sdaoden.eu>
4541 In-Reply-To: <20171025214601.T2pNd%steffen@sdaoden.eu>
4542 Status: R
4544 The report's useful :-)
4545 _EOT
4547 # Let us test In-Reply-To: removal starts a new thread..
4548 # This needs adjustment of *stealthmua*
4549 argadd='-Sstealthmua=noagent -Shostname'
4551 ${rm} "${MBOX}"
4552 printf 'reply 1\nthread\n!.\n' |
4553 ${MAILX} ${ARGS} -Sescape=! -Smta=./.tmta.sh -Sreply-to-honour \
4554 ${argadd} -Rf ./.tmbox > .tall 2>&1
4555 check 2 0 "${MBOX}" '3321764338 429'
4556 check 3 - .tall '4294967295 0'
4558 printf 'reply 1\nnew <- thread!\n!v\n!.\n' |
4559 ${MAILX} ${ARGS} -Sescape=! -Smta=./.tmta.sh -Sreply-to-honour \
4560 -Seditheaders -S VISUAL="${sed} -i'' -e '/^In-Reply-To:/d'" \
4561 ${argadd} -Rf "${MBOX}" > .tall 2>&1
4562 check 4 0 "${MBOX}" '1682552516 763'
4563 check 5 - .tall '4294967295 0'
4565 printf 'reply 2\nold <- new <- thread!\n!.\n' |
4566 ${MAILX} ${ARGS} -Sescape=! -Smta=./.tmta.sh -Sreply-to-honour \
4567 ${argadd} -Rf "${MBOX}" > .tall 2>&1
4568 check 6 0 "${MBOX}" '2900984135 1219'
4569 check 7 - .tall '4294967295 0'
4571 printf 'reply 3\nnew <- old <- new <- thread!\n!v\n!.\n' |
4572 ${MAILX} ${ARGS} -Sescape=! -Smta=./.tmta.sh -Sreply-to-honour \
4573 -Seditheaders -S VISUAL="${sed} -i'' -e '/^In-Reply-To:/d'" \
4574 ${argadd} -Rf "${MBOX}" > .tall 2>&1
4575 check 8 0 "${MBOX}" '794031200 1567'
4576 check 9 - .tall '4294967295 0'
4578 t_epilog
4581 t_mime_if_not_ascii() {
4582 t_prolog mime_if_not_ascii
4584 </dev/null ${MAILX} ${ARGS} -s Subject "${MBOX}" >> "${MBOX}" 2>&1
4585 check 1 0 "${MBOX}" '2287855519 110'
4587 </dev/null ${MAILX} ${ARGS} -Scharset-7bit=not-ascii -s Subject "${MBOX}" \
4588 >> "${MBOX}" 2>&1
4589 check 2 0 "${MBOX}" '70754682 282'
4591 t_epilog
4594 t_xxxheads_rfc2047() {
4595 t_prolog xxxheads_rfc2047
4596 TRAP_EXIT_ADDONS="./.t*"
4598 t_xmta 'GentianaLutea Mon Dec 04 17:15:29 2017'
4600 echo | ${MAILX} ${ARGS} ${ADDARG_UNI} \
4601 -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̲' \
4602 "${MBOX}"
4603 check 1 0 "${MBOX}" '3370931614 375'
4605 # Single word (overlong line split -- bad standard! Requires injection of
4606 # artificial data!! But can be prevented by using RFC 2047 encoding)
4607 ${rm} "${MBOX}"
4608 i=`${awk} 'BEGIN{for(i=0; i<92; ++i) printf "0123456789_"}'`
4609 echo | ${MAILX} ${ARGS} -s "${i}" "${MBOX}"
4610 check 2 0 "${MBOX}" '489922370 1718'
4612 # Combination of encoded words, space and tabs of varying sort
4613 ${rm} "${MBOX}"
4614 echo | ${MAILX} ${ARGS} ${ADDARG_UNI} \
4615 -s "1Abrä Kaspas1 2Abra Katä b_kaspas2 \
4616 3Abrä Kaspas3 4Abrä Kaspas4 5Abrä Kaspas5 \
4617 6Abra Kaspas6 7Abrä Kaspas7 8Abra Kaspas8 \
4618 9Abra Kaspastäb4-3 10Abra Kaspas1 _ 11Abra Katäb1 \
4619 12Abra Kadabrä1 After Tab after Täb this is NUTS" \
4620 "${MBOX}"
4621 check 3 0 "${MBOX}" '1676887734 591'
4623 # Overlong multibyte sequence that must be forcefully split
4624 # todo This works even before v15.0, but only by accident
4625 ${rm} "${MBOX}"
4626 echo | ${MAILX} ${ARGS} ${ADDARG_UNI} \
4627 -s "✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄\
4628 ✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄\
4629 ✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄" \
4630 "${MBOX}"
4631 check 4 0 "${MBOX}" '3029301775 659'
4633 # Trailing WS
4634 ${rm} "${MBOX}"
4635 echo | ${MAILX} ${ARGS} \
4636 -s "1-1 B2 B3 B4 B5 B6 B\
4637 1-2 B2 B3 B4 B5 B6 B\
4638 1-3 B2 B3 B4 B5 B6 B\
4639 1-4 B2 B3 B4 B5 B6 B\
4640 1-5 B2 B3 B4 B5 B6 B\
4641 1-6 B2 B3 B4 B5 B6 " \
4642 "${MBOX}"
4643 check 5 0 "${MBOX}" '4126167195 297'
4645 # Leading and trailing WS
4646 ${rm} "${MBOX}"
4647 echo | ${MAILX} ${ARGS} \
4648 -s " 2-1 B2 B3 B4 B5 B6 B\
4649 1-2 B2 B3 B4 B5 B6 B\
4650 1-3 B2 B3 B4 B5 B6 B\
4651 1-4 B2 B3 B4 B5 B6 " \
4652 "${MBOX}"
4653 check 6 0 "${MBOX}" '3600624479 236'
4655 # RFC 2047 in an address field! (Missing test caused v14.9.6!)
4656 ${rm} "${MBOX}"
4657 echo "Dat Früchtchen riecht häußlich" |
4658 ${MAILX} ${ARGS} ${ADDARG_UNI} -Sfullnames -Smta=./.tmta.sh \
4659 -s Hühöttchen \
4660 'Schnödes "Früchtchen" <do@du> (Hä!)'
4661 check 7 0 "${MBOX}" '800505986 368'
4663 # RFC 2047 in an address field, and iconv involved
4664 if have_feat iconv; then
4665 ${rm} "${MBOX}"
4666 ${cat} > ./.trebox <<_EOT
4667 From zaza@exam.ple Fri Mar 2 21:31:56 2018
4668 Date: Fri, 2 Mar 2018 20:31:45 +0000
4669 From: z=?iso-8859-1?Q?=E1?=za <zaza@exam.ple>
4670 To: dude <dude@exam.ple>
4671 Subject: houston(...)
4672 Message-ID: <abra@1>
4673 MIME-Version: 1.0
4674 Content-Type: text/plain; charset=iso-8859-1
4675 Content-Disposition: inline
4676 Content-Transfer-Encoding: 8bit
4678 _EOT
4679 echo reply | ${MAILX} ${ARGS} ${ADDARG_UNI} \
4680 -Sfullnames -Sreply-in-same-charset \
4681 -Smta=./.tmta.sh -Rf ./.trebox
4682 check 8 0 "${MBOX}" '2914485741 280'
4683 else
4684 echo 'xxxheads_rfc2047-8: iconv unsupported, skipped'
4687 t_epilog
4690 t_rfc2231() {
4691 t_prolog rfc2231
4692 TRAP_EXIT_ADDONS="./.t*"
4695 mkdir ./.ttt || exit 1
4696 cd ./.ttt || exit 2
4697 : > "ma'ger.txt"
4698 : > "mä'ger.txt"
4699 : > 'diet\ is \curd.txt'
4700 : > 'diet "is" curd.txt'
4701 : > höde-tröge.txt
4702 : > 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
4703 : > höde__tröge__müde__dätte__hätte__vuelle__guelle__aese__aesse__sauerliche__kräuter__österliche__grüße__mäh.txt
4704 : > hööööööööööööööööö_nöööööööööööööööööööööö_düüüüüüüüüüüüüüüüüüü_bäääääääääääääääääääääääh.txt
4705 : > ✆✆✆✆✆✆✆✆✆✆✆✆✆✆✆✆✆✆✆✆✆✆✆✆.txt
4707 echo bla | ${MAILX} ${ARGS} ${ADDARG_UNI} \
4708 -a "./.ttt/ma'ger.txt" -a "./.ttt/mä'ger.txt" \
4709 -a './.ttt/diet\ is \curd.txt' -a './.ttt/diet "is" curd.txt' \
4710 -a ./.ttt/höde-tröge.txt \
4711 -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 \
4712 -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 \
4713 -a ./.ttt/hööööööööööööööööö_nöööööööööööööööööööööö_düüüüüüüüüüüüüüüüüüü_bäääääääääääääääääääääääh.txt \
4714 -a ./.ttt/✆✆✆✆✆✆✆✆✆✆✆✆✆✆✆✆✆✆✆✆✆✆✆✆.txt \
4715 "${MBOX}"
4716 check 1 0 "${MBOX}" '684985954 3092'
4718 # `resend' test, reusing $MBOX
4719 printf "Resend ./.t2\nx\n" | ${MAILX} ${ARGS} -Rf "${MBOX}"
4720 check 2 0 ./.t2 '684985954 3092'
4722 printf "resend ./.t3\nx\n" | ${MAILX} ${ARGS} -Rf "${MBOX}"
4723 check 3 0 ./.t3 '3130352658 3148'
4725 t_epilog
4728 t_iconv_mbyte_base64() { # TODO uses sed(1) and special *headline*!!
4729 t_prolog iconv_mbyte_base64
4730 TRAP_EXIT_ADDONS="./.t*"
4732 if [ -n "${UTF8_LOCALE}" ] && have_feat iconv; then
4733 if (</dev/null iconv -f ascii -t iso-2022-jp) >/dev/null 2>&1 ||
4734 (</dev/null iconv -f ascii -t euc-jp) >/dev/null 2>&1; then
4736 else
4737 echo 'iconv_mbyte_base64: unsupported, skipped'
4738 return
4740 else
4741 echo 'iconv_mbyte_base64: unsupported, skipped'
4742 return
4745 t_xmta 'DroseriaRotundifolia Thu Aug 03 17:26:25 2017'
4747 if (</dev/null iconv -f ascii -t iso-2022-jp) >/dev/null 2>&1; then
4748 ${cat} <<-'_EOT' | LC_ALL=${UTF8_LOCALE} ${MAILX} ${ARGS} \
4749 -Smta=./.tmta.sh \
4750 -Sescape=! -Smime-encoding=base64 2>./.terr
4751 set ttycharset=utf-8 sendcharsets=iso-2022-jp
4752 m t1@exam.ple
4753 !s Japanese from UTF-8 to ISO-2022-JP
4754 シジュウカラ科(シジュウカラか、学名 Paridae)は、鳥類スズメ目の科である。シジュウカラ(四十雀)と総称されるが、狭義にはこの1種をシジュウカラと呼ぶ。
4756 カンムリガラ(学名Parus cristatus)は、スズメ目シジュウカラ科に分類される鳥類の一種。
4759 カンムリガラ(学名Parus cristatus)は、スズメ目シジュウカラ科に分類される鳥類の一種。
4761 シジュウカラ科(シジュウカラか、学名 Paridae)は、鳥類スズメ目の科である。シジュウカラ(四十雀)と総称されるが、狭義にはこの1種をシジュウカラと呼ぶ。
4764 set ttycharset=iso-2022-jp charset-7bit=iso-2022-jp sendcharsets=utf-8
4765 m t2@exam.ple
4766 !s Japanese from ISO-2022-JP to UTF-8, eh, no, also ISO-2022-JP
4767 \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
4769 \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
4772 \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
4774 \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
4776 _EOT
4777 # May not presume iconv output as long as roundtrip possible [489a7122]
4778 check_ex0 1-estat
4779 ${awk} 'BEGIN{h=1}/^$/{++h;next}{if(h % 2 == 1)print}' \
4780 < "${MBOX}" > ./.tcksum
4781 check 1 - ./.tcksum '2694609714 520'
4782 check 2 - ./.terr '4294967295 0'
4784 printf 'eval f 1; eval write ./.twrite; eval type 1; eval type 2\n' |
4785 LC_ALL=${UTF8_LOCALE} ${MAILX} ${ARGS} \
4786 -S headline="%>%a%m %-18f %-16d %i%-s" \
4787 -Rf "${MBOX}" >./.tlog 2>&1
4788 check 3 0 ./.twrite '1259742080 686'
4789 #check 4 - ./.tlog '3214068822 2123'
4790 ${sed} -e '/^\[-- M/d' < ./.tlog > ./.txlog
4791 check 4 - ./.txlog '3659773472 2035'
4792 else
4793 echo 'iconv_mbyte_base64: ISO-2022-JP unsupported, skipping 1-4'
4796 if (</dev/null iconv -f ascii -t euc-jp) >/dev/null 2>&1; then
4797 rm -f "${MBOX}" ./.twrite
4798 ${cat} <<-'_EOT' | LC_ALL=${UTF8_LOCALE} ${MAILX} ${ARGS} \
4799 -Smta=./.tmta.sh \
4800 -Sescape=! -Smime-encoding=base64 2>./.terr
4801 set ttycharset=utf-8 sendcharsets=euc-jp
4802 m t1@exam.ple
4803 !s Japanese from UTF-8 to EUC-JP
4804 シジュウカラ科(シジュウカラか、学名 Paridae)は、鳥類スズメ目の科である。シジュウカラ(四十雀)と総称されるが、狭義にはこの1種をシジュウカラと呼ぶ。
4806 カンムリガラ(学名Parus cristatus)は、スズメ目シジュウカラ科に分類される鳥類の一種。
4809 カンムリガラ(学名Parus cristatus)は、スズメ目シジュウカラ科に分類される鳥類の一種。
4811 シジュウカラ科(シジュウカラか、学名 Paridae)は、鳥類スズメ目の科である。シジュウカラ(四十雀)と総称されるが、狭義にはこの1種をシジュウカラと呼ぶ。
4814 set ttycharset=EUC-JP sendcharsets=utf-8
4815 m t2@exam.ple
4816 !s Japanese from EUC-JP to UTF-8
4817 ¥·¥¸¥å¥¦¥«¥é²Ê¡Ê¥·¥¸¥å¥¦¥«¥é¤«¡¢³Ø̾ Paridae¡Ë¤Ï¡¢Ä»Îॹ¥º¥áÌܤβʤǤ¢¤ë¡£¥·¥¸¥å¥¦¥«¥é¡Ê»Í½½¿ý¡Ë¤ÈÁí¾Î¤µ¤ì¤ë¤¬¡¢¶¹µÁ¤Ë¤Ï¤³¤Î1¼ï¤ò¥·¥¸¥å¥¦¥«¥é¤È¸Æ¤Ö¡£
4819 ¥«¥ó¥à¥ê¥¬¥é¡Ê³Ø̾Parus cristatus¡Ë¤Ï¡¢¥¹¥º¥áÌÜ¥·¥¸¥å¥¦¥«¥é²Ê¤ËʬÎव¤ì¤ëÄ»Îà¤Î°ì¼ï¡£
4822 ¥«¥ó¥à¥ê¥¬¥é¡Ê³Ø̾Parus cristatus¡Ë¤Ï¡¢¥¹¥º¥áÌÜ¥·¥¸¥å¥¦¥«¥é²Ê¤ËʬÎव¤ì¤ëÄ»Îà¤Î°ì¼ï¡£
4824 ¥·¥¸¥å¥¦¥«¥é²Ê¡Ê¥·¥¸¥å¥¦¥«¥é¤«¡¢³Ø̾ Paridae¡Ë¤Ï¡¢Ä»Îॹ¥º¥áÌܤβʤǤ¢¤ë¡£¥·¥¸¥å¥¦¥«¥é¡Ê»Í½½¿ý¡Ë¤ÈÁí¾Î¤µ¤ì¤ë¤¬¡¢¶¹µÁ¤Ë¤Ï¤³¤Î1¼ï¤ò¥·¥¸¥å¥¦¥«¥é¤È¸Æ¤Ö¡£
4826 _EOT
4827 check_ex0 5-estat
4828 ${awk} 'BEGIN{h=1}/^$/{++h;next}{if(h % 2 == 1)print}' \
4829 < "${MBOX}" > ./.tcksum
4830 check 5 - ./.tcksum '2870183985 473'
4831 check 6 - ./.terr '4294967295 0'
4833 printf 'eval f 1; eval write ./.twrite; eval type 1; eval type 2\n' |
4834 LC_ALL=${UTF8_LOCALE} ${MAILX} ${ARGS} \
4835 -S headline="%>%a%m %-18f %-16d %i%-s" \
4836 -Rf "${MBOX}" >./.tlog 2>&1
4837 check 7 0 ./.twrite '1259742080 686'
4838 #check 8 - ./.tlog '2506063395 2075'
4839 ${sed} -e '/^\[-- M/d' < ./.tlog > ./.txlog
4840 check 8 - ./.txlog '2528199891 1988'
4841 else
4842 echo 'iconv_mbyte_base64: EUC-JP unsupported, skipping 5-8'
4845 t_epilog
4848 t_iconv_mainbody() {
4849 t_prolog iconv_mainbody
4850 TRAP_EXIT_ADDONS="./.t*"
4852 if [ -n "${UTF8_LOCALE}" ] && have_feat iconv; then
4854 else
4855 echo 'iconv_mainbody: unsupported, skipped'
4856 return
4859 t_xmta 'HamamelisVirginiana Fri Oct 20 16:23:21 2017'
4861 printf '–' | ${MAILX} ${ARGS} ${ADDARG_UNI} -Smta=./.tmta.sh \
4862 -S charset-7bit=us-ascii -S charset-8bit=utf-8 \
4863 -s '–' over-the@rain.bow 2>./.terr
4864 check 1 0 "${MBOX}" '3634015017 251'
4865 check 2 - ./.terr '4294967295 0'
4867 printf '–' | ${MAILX} ${ARGS} ${ADDARG_UNI} -Smta=./.tmta.sh \
4868 -S charset-7bit=us-ascii -S charset-8bit=us-ascii \
4869 -s '–' over-the@rain.bow 2>./.terr
4870 check_exn0 3
4871 check 3 - "${MBOX}" '3634015017 251'
4872 if have_feat uistrings; then
4873 if have_feat docstrings; then # xxx should not be like that
4874 check 4 - ./.terr '2579894983 148'
4875 else
4876 check 4 - ./.terr '271380835 121'
4878 else
4879 echo 'iconv_mainbody-4: unsupported, skipped'
4882 # The different iconv(3) implementations use different replacement sequence
4883 # types (character-wise, byte-wise, and the character(s) used differ)
4884 i="${MAILX_ICONV_MODE}"
4885 if [ -n "${i}" ]; then
4886 printf 'p\nx\n' | ${MAILX} ${ARGS} -Rf "${MBOX}" >./.tout 2>./.terr
4887 j=${?}
4888 check_ex0 5-1-estat ${j}
4889 check 5-1 - ./.terr '4294967295 0'
4890 if [ ${i} -eq 13 ]; then
4891 check 5-2 - ./.tout '189327996 283'
4892 elif [ ${i} -eq 12 ]; then
4893 check 5-3 - ./.tout '1959197095 283'
4894 elif [ ${i} -eq 3 ]; then
4895 check 5-4 - ./.tout '3196380198 279'
4896 else
4897 check 5-5 - ./.tout '3760313827 279'
4899 else
4900 echo 'iconv_mainbody-5: unsupported, skipped'
4903 t_epilog
4906 t_binary_mainbody() {
4907 t_prolog binary_mainbody
4908 TRAP_EXIT_ADDONS="./.t*"
4910 printf 'abra\0\nka\r\ndabra' |
4911 ${MAILX} ${ARGS} ${ADDARG_UNI} -s 'binary with carriage-return!' \
4912 "${MBOX}" 2>./.terr
4913 check 1 0 "${MBOX}" '2430168141 243'
4914 check 2 - ./.terr '4294967295 0'
4916 printf 'p\necho\necho writing now\nwrite ./.twrite\n' |
4917 ${MAILX} ${ARGS} -Rf \
4918 -Spipe-application/octet-stream="@* ${cat} > ./.tcat" \
4919 "${MBOX}" >./.tall 2>&1
4920 check 3 0 ./.tall '1151843761 324'
4921 check 4 - ./.tcat '3817108933 15'
4922 check 5 - ./.twrite '3817108933 15'
4924 t_epilog
4927 t_q_t_etc_opts() {
4928 t_prolog q_t_etc_opts
4929 TRAP_EXIT_ADDONS="./.t*"
4931 # Three tests for MIME encoding and (a bit) content classification.
4932 # At the same time testing -q FILE, < FILE and -t FILE
4933 t__put_body > ./.tin
4935 < ./.tin ${MAILX} ${ARGS} ${ADDARG_UNI} \
4936 -a ./.tin -s "`t__put_subject`" "${MBOX}"
4937 check 1 0 "${MBOX}" '3570973309 6646'
4939 ${rm} "${MBOX}"
4940 < /dev/null ${MAILX} ${ARGS} ${ADDARG_UNI} \
4941 -a ./.tin -s "`t__put_subject`" -q ./.tin "${MBOX}"
4942 check 2 0 "${MBOX}" '3570973309 6646'
4944 ${rm} "${MBOX}"
4945 ( echo "To: ${MBOX}" && echo "Subject: `t__put_subject`" && echo &&
4946 ${cat} ./.tin
4947 ) | ${MAILX} ${ARGS} ${ADDARG_UNI} -Snodot -a ./.tin -t
4948 check 3 0 "${MBOX}" '3570973309 6646'
4950 # Check comments in the header
4951 ${rm} "${MBOX}"
4952 ${cat} <<-_EOT | ${MAILX} ${ARGS} -Snodot -t "${MBOX}"
4953 # Ein Kommentar
4954 From: du@da
4955 # Noch ein Kommentar
4956 Subject: hey you
4957 # Nachgestelltes Kommentar
4959 BOOOM
4960 _EOT
4961 check 4 0 "${MBOX}" '3829967825 128'
4963 t_epilog
4966 t_s_mime() {
4967 have_feat smime || {
4968 echo 's_mime: unsupported, skipped'
4969 return
4972 t_prolog s_mime
4973 TRAP_EXIT_ADDONS="./.t.conf ./.tkey.pem ./.tcert.pem ./.tpair.pem"
4974 TRAP_EXIT_ADDONS="${TRAP_EXIT_ADDONS} ./.VERIFY ./.DECRYPT ./.ENCRYPT"
4975 TRAP_EXIT_ADDONS="${TRAP_EXIT_ADDONS} ./.tmta.sh"
4977 ${cat} <<-_EOT > ./.t.conf
4978 [ req ]
4979 default_bits = 1024
4980 default_keyfile = keyfile.pem
4981 distinguished_name = req_distinguished_name
4982 attributes = req_attributes
4983 prompt = no
4984 output_password =
4986 [ req_distinguished_name ]
4987 C = GB
4988 ST = Over the
4989 L = rainbow
4990 O = S-nail
4991 OU = S-nail.smime
4992 CN = S-nail.test
4993 emailAddress = test@localhost
4995 [ req_attributes ]
4996 challengePassword =
4997 _EOT
4998 openssl req -x509 -nodes -days 3650 -config ./.t.conf \
4999 -newkey rsa:1024 -keyout ./.tkey.pem -out ./.tcert.pem >>${ERR} 2>&1
5000 check_ex0 0
5001 ${cat} ./.tkey.pem ./.tcert.pem > ./.tpair.pem
5003 # Sign/verify
5004 echo bla | ${MAILX} ${ARGS} \
5005 -Ssmime-ca-file=./.tcert.pem -Ssmime-sign-cert=./.tpair.pem \
5006 -Ssmime-sign -Sfrom=test@localhost \
5007 -s 'S/MIME test' ./.VERIFY
5008 check_ex0 1-estat
5009 ${awk} '
5010 BEGIN{ skip=0 }
5011 /^Content-Description: /{ skip = 2; print; next }
5012 /^$/{ if(skip) --skip }
5013 { if(!skip) print }
5015 < ./.VERIFY > "${MBOX}"
5016 check 1 - "${MBOX}" '2900817158 648'
5018 printf 'verify\nx\n' |
5019 ${MAILX} ${ARGS} \
5020 -Ssmime-ca-file=./.tcert.pem -Ssmime-sign-cert=./.tpair.pem \
5021 -Ssmime-sign -Sfrom=test@localhost \
5022 -Serrexit -R \
5023 -f ./.VERIFY >>${ERR} 2>&1
5024 check_ex0 2
5026 openssl smime -verify -CAfile ./.tcert.pem \
5027 -in ./.VERIFY >>${ERR} 2>&1
5028 check_ex0 3
5030 # (signing +) encryption / decryption
5031 t_xmta 'Euphrasia Thu Apr 27 17:56:23 2017' ./.ENCRYPT
5033 echo bla |
5034 ${MAILX} ${ARGS} \
5035 -Ssmime-force-encryption \
5036 -Ssmime-encrypt-recei@ver.com=./.tpair.pem \
5037 -Smta=./.tmta.sh \
5038 -Ssmime-ca-file=./.tcert.pem -Ssmime-sign-cert=./.tpair.pem \
5039 -Ssmime-sign -Sfrom=test@localhost \
5040 -s 'S/MIME test' recei@ver.com
5041 check_ex0 4-estat
5042 ${sed} -e '/^$/,$d' < ./.ENCRYPT > "${MBOX}"
5043 check 4 - "${MBOX}" '1937410597 327'
5045 printf 'decrypt ./.DECRYPT\nfi ./.DECRYPT\nverify\nx\n' |
5046 ${MAILX} ${ARGS} \
5047 -Ssmime-force-encryption \
5048 -Ssmime-encrypt-recei@ver.com=./.tpair.pem \
5049 -Smta=./.tmta.sh \
5050 -Ssmime-ca-file=./.tcert.pem -Ssmime-sign-cert=./.tpair.pem \
5051 -Ssmime-sign -Sfrom=test@localhost \
5052 -Serrexit -R \
5053 -f ./.ENCRYPT >>${ERR} 2>&1
5054 check_ex0 5-estat
5055 ${awk} '
5056 BEGIN{ skip=0 }
5057 /^Content-Description: /{ skip = 2; print; next }
5058 /^$/{ if(skip) --skip }
5059 { if(!skip) print }
5061 < ./.DECRYPT > "${MBOX}"
5062 check 5 - "${MBOX}" '1720739247 931'
5064 (openssl smime -decrypt -inkey ./.tkey.pem -in ./.ENCRYPT |
5065 openssl smime -verify -CAfile ./.tcert.pem) >>${ERR} 2>&1
5066 check_ex0 6
5068 ${rm} ./.ENCRYPT
5069 echo bla | ${MAILX} ${ARGS} \
5070 -Ssmime-force-encryption \
5071 -Ssmime-encrypt-recei@ver.com=./.tpair.pem \
5072 -Smta=./.tmta.sh \
5073 -Ssmime-ca-file=./.tcert.pem -Ssmime-sign-cert=./.tpair.pem \
5074 -Sfrom=test@localhost \
5075 -s 'S/MIME test' recei@ver.com
5076 check_ex0 7-estat
5077 ${sed} -e '/^$/,$d' < ./.ENCRYPT > "${MBOX}"
5078 check 7 - "${MBOX}" '1937410597 327'
5080 ${rm} ./.DECRYPT
5081 printf 'decrypt ./.DECRYPT\nx\n' | ${MAILX} ${ARGS} \
5082 -Ssmime-force-encryption \
5083 -Ssmime-encrypt-recei@ver.com=./.tpair.pem \
5084 -Smta=./.tmta.sh \
5085 -Ssmime-ca-file=./.tcert.pem -Ssmime-sign-cert=./.tpair.pem \
5086 -Sfrom=test@localhost \
5087 -Serrexit -R \
5088 -f ./.ENCRYPT >>${ERR} 2>&1
5089 check 8 0 "./.DECRYPT" '2624716890 422'
5091 openssl smime -decrypt -inkey ./.tkey.pem \
5092 -in ./.ENCRYPT >>${ERR} 2>&1
5093 check_ex0 9
5095 t_epilog
5098 # xxx Note: t_z() was the first test (series) written. Today many
5099 # xxx aspects are (better) covered by other tests above, some are not.
5100 # xxx At some future date and time, convert the last remains not covered
5101 # xxx elsewhere to a real t_* test and drop it
5102 t_z() {
5103 t_prolog z
5105 # Test for [260e19d] (Juergen Daubert)
5106 echo body | ${MAILX} ${ARGS} "${MBOX}"
5107 check 4 0 "${MBOX}" '2917662811 98'
5109 # "Test for" [d6f316a] (Gavin Troy)
5110 ${rm} "${MBOX}"
5111 printf "m ${MBOX}\n~s subject1\nEmail body\n~.\nfi ${MBOX}\np\nx\n" |
5112 ${MAILX} ${ARGS} ${ADDARG_UNI} -Spipe-text/plain="@* ${cat}" > "${BODY}"
5113 check 6 0 "${MBOX}" '2099098650 122'
5114 check 6-1 - "${BODY}" '794542938 174'
5116 # "Test for" [c299c45] (Peter Hofmann) TODO shouldn't end up QP-encoded?
5117 ${rm} "${MBOX}"
5118 ${awk} 'BEGIN{
5119 for(i = 0; i < 10000; ++i)
5120 printf "\xC3\xBC"
5121 #printf "\xF0\x90\x87\x90"
5122 }' | ${MAILX} ${ARGS} ${ADDARG_UNI} -s TestSubject "${MBOX}"
5123 check 7 0 "${MBOX}" '534262374 61816'
5125 t_epilog
5128 t__put_subject() {
5129 # MIME encoding (QP) stress message subject
5130 printf 'Äbrä Kä?dä=brö Fü?di=bus? '\
5131 'adadaddsssssssddddddddddddddddddddd'\
5132 'ddddddddddddddddddddddddddddddddddd'\
5133 'ddddddddddddddddddddddddddddddddddd'\
5134 'dddddddddddddddddddd Hallelulja? Od'\
5135 'er?? eeeeeeeeeeeeeeeeeeeeeeeeeeeeee'\
5136 'eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee'\
5137 'eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee f'\
5138 'fffffffffffffffffffffffffffffffffff'\
5139 'fffffffffffffffffffff ggggggggggggg'\
5140 'ggggggggggggggggggggggggggggggggggg'\
5141 'ggggggggggggggggggggggggggggggggggg'\
5142 'ggggggggggggggggggggggggggggggggggg'\
5143 'gggggggggggggggg'
5146 t__put_body() {
5147 # MIME encoding (QP) stress message body
5148 printf \
5149 'Ich bin eine DÖS-Datäi mit sehr langen Zeilen und auch '\
5150 'sonst bin ich ganz schön am Schleudern, da kannste denke '\
5151 "wasde willst, gelle, gelle, gelle, gelle, gelle.\r\n"\
5152 "Ich bin eine DÖS-Datäi mit langen Zeilen und auch sonst \r\n"\
5153 "Ich bin eine DÖS-Datäi mit langen Zeilen und auch sonst 1\r\n"\
5154 "Ich bin eine DÖS-Datäi mit langen Zeilen und auch sonst 12\r\n"\
5155 "Ich bin eine DÖS-Datäi mit langen Zeilen und auch sonst 123\r\n"\
5156 "Ich bin eine DÖS-Datäi mit langen Zeilen und auch sonst 1234\r\n"\
5157 "Ich bin eine DÖS-Datäi mit langen Zeilen und auch sonst 12345\r\n"\
5158 "Ich bin eine DÖS-Datäi mit langen Zeilen und auch sonst 123456\r\n"\
5159 "Ich bin eine DÖS-Datäi mit langen Zeilen und auch sonst 1234567\r\n"\
5160 "Ich bin eine DÖS-Datäi mit langen Zeilen und auch sonst 12345678\r\n"\
5161 "Ich bin eine DÖS-Datäi mit langen Zeilen und auch sonst 123456789\r\n"\
5162 "Unn ausserdem habe ich trailing SP/HT/SP/HT whitespace \r\n"\
5163 "Unn ausserdem habe ich trailing HT/SP/HT/SP whitespace \r\n"\
5164 "auf den zeilen vorher.\r\n"\
5165 "From am Zeilenbeginn und From der Mitte gibt es auch.\r\n"\
5166 ".\r\n"\
5167 "Die letzte Zeile war nur ein Punkt.\r\n"\
5168 "..\r\n"\
5169 "Das waren deren zwei.\r\n"\
5170 " \r\n"\
5171 "Die letzte Zeile war ein Leerschritt.\n"\
5172 "=VIER = EQUAL SIGNS=ON A LINE=\r\n"\
5173 "Prösterchen.\r\n"\
5174 ".\n"\
5175 "Die letzte Zeile war nur ein Punkt, mit Unix Zeilenende.\n"\
5176 "..\n"\
5177 "Das waren deren zwei. ditto.\n"\
5178 "Prösterchen.\n"\
5179 "Unn ausseerdem habe ich trailing SP/HT/SP/HT whitespace \n"\
5180 "Unn ausseerdem habe ich trailing HT/SP/HT/SP whitespace \n"\
5181 "auf den zeilen vorher.\n"\
5182 "ditto.\n"\
5183 "Ich bin eine ziemlich lange, steile, scharfe Zeile mit Unix Zeilenende.\n"\
5184 "Ich bin eine ziemlich lange, steile, scharfe Zeile mit Unix Zeilenende.1"\
5185 "\n"\
5186 "Ich bin eine ziemlich lange, steile, scharfe Zeile mit Unix Zeilenende.12"\
5187 "\n"\
5188 "Ich bin eine ziemlich lange, steile, scharfe Zeile mit Unix Zeilenende.12"\
5189 "3\n"\
5190 "Ich bin eine ziemlich lange, steile, scharfe Zeile mit Unix Zeilenende.12"\
5191 "34\n"\
5192 "Ich bin eine ziemlich lange, steile, scharfe Zeile mit Unix Zeilenende.12"\
5193 "345\n"\
5194 "Ich bin eine ziemlich lange, steile, scharfe Zeile mit Unix Zeilenende.12"\
5195 "3456\n"\
5196 "QP am Zeilenende über soft-nl hinweg\n"\
5197 "Ich bin eine ziemlich lange, steile, scharfe Zeile mit Unix Zeilenende."\
5198 "ö123\n"\
5199 "Ich bin eine ziemlich lange, steile, scharfe Zeile mit Unix Zeilenende."\
5200 "1ö23\n"\
5201 "Ich bin eine ziemlich lange, steile, scharfe Zeile mit Unix Zeilenende."\
5202 "12ö3\n"\
5203 "Ich bin eine ziemlich lange, steile, scharfe Zeile mit Unix Zeilenende."\
5204 "123ö\n"\
5205 "=VIER = EQUAL SIGNS=ON A LINE=\n"\
5206 " \n"\
5207 "Die letzte Zeile war ein Leerschritt.\n"\
5211 # cc_all_configs()
5212 # Test all configs TODO doesn't cover all *combinations*, stupid!
5213 cc_all_configs() {
5214 < ${CONF} ${awk} '
5215 BEGIN{
5216 ALWAYS = "OPT_AUTOCC=1 OPT_AMALGAMATION=1"
5217 NOTME["OPT_ALWAYS_UNICODE_LOCALE"] = 1
5218 NOTME["OPT_CROSS_BUILD"] = 1
5219 NOTME["OPT_AUTOCC"] = 1
5220 NOTME["OPT_AMALGAMATION"] = 1
5221 NOTME["OPT_DEBUG"] = 1
5222 NOTME["OPT_DEVEL"] = 1
5223 NOTME["OPT_ASAN_ADDRESS"] = 1
5224 NOTME["OPT_ASAN_MEMORY"] = 1
5225 NOTME["OPT_FORCED_STACKPROT"] = 1
5226 NOTME["OPT_NOMEMDBG"] = 1
5227 NOTME["OPT_NYD2"] = 1
5229 #OPTVALS
5230 OPTNO = 0
5232 MULCHOICE["OPT_IDNA"] = "VAL_IDNA"
5233 MULVALS["VAL_IDNA"] = 1
5235 #VALKEYS[0] = "VAL_RANDOM"
5236 VALVALS["VAL_RANDOM"] = 1
5237 VALNO = 0
5239 /^[[:space:]]*OPT_/{
5240 sub(/^[[:space:]]*/, "")
5241 # This bails for UnixWare 7.1.4 awk(1), but preceeding = with \
5242 # does not seem to be a compliant escape for =
5243 #sub(/=.*$/, "")
5244 $1 = substr($1, 1, index($1, "=") - 1)
5245 if(!NOTME[$1])
5246 OPTVALS[OPTNO++] = $1
5247 next
5249 /^[[:space:]]*VAL_/{
5250 sub(/^[[:space:]]*/, "")
5251 val = substr($0, index($0, "=") + 1)
5252 if(val ~ /^\"/){
5253 val = substr(val, 2)
5254 val = substr(val, 1, length(val) - 1)
5256 $1 = substr($1, 1, index($1, "=") - 1)
5257 if(MULVALS[$1])
5258 MULVALS[$1] = val
5259 else if(VALVALS[$1]){
5260 VALKEYS[VALNO++] = $1
5261 VALVALS[$1] = val
5263 next
5265 function onepass(addons){
5266 a_onepass__worker(addons, "1", "0")
5267 a_onepass__worker(addons, "0", "1")
5269 function a_onepass__worker(addons, b0, b1){
5270 # Doing this completely sequentially and not doing make distclean in
5271 # between runs should effectively result in lesser compilations.
5272 # It is completely dumb nonetheless... TODO
5273 for(ono = 0; ono < OPTNO; ++ono){
5274 myconf = mula = ""
5275 for(i = 0; i < ono; ++i){
5276 myconf = myconf " " OPTVALS[i] "=" b0 " "
5277 if(b0 == "1"){
5278 j = MULCHOICE[OPTVALS[i]]
5279 if(j){
5280 if(i + 1 == ono)
5281 mula = j
5282 else
5283 myconf = myconf " " MULCHOICE[OPTVALS[i]] "=any "
5287 for(i = ono; i < OPTNO; ++i){
5288 myconf = myconf " " OPTVALS[i] "=" b1 " "
5289 if(b1 == "1"){
5290 j = MULCHOICE[OPTVALS[i]]
5291 if(j){
5292 if(i + 1 == OPTNO)
5293 mula = j;
5294 else
5295 myconf = myconf " " MULCHOICE[OPTVALS[i]] "=any "
5300 for(i in VALKEYS)
5301 myconf = VALKEYS[i] "=any " myconf
5303 myconf = myconf " " ALWAYS " " addons
5305 if(mula == "")
5306 print myconf
5307 else{
5308 i = split(MULVALS[mula], ia)
5309 j = "any"
5310 while(i >= 1){
5311 j = ia[i--] " " j
5312 print mula "=\"" j "\" " myconf
5317 END{
5318 # We cannot test NULL because of missing UI strings, which will end
5319 # up with different checksums
5320 print "CONFIG=NULLI OPT_AUTOCC=1"
5321 for(i in VALKEYS){
5322 j = split(VALVALS[VALKEYS[i]], ia)
5323 k = "any"
5324 while(j >= 1){
5325 k = ia[j--] " " k
5326 print VALKEYS[i] "=\"" k "\" CONFIG=NULLI OPT_AUTOCC=1"
5329 print "CONFIG=MINIMAL OPT_AUTOCC=1"
5330 print "CONFIG=NETSEND OPT_AUTOCC=1"
5331 print "CONFIG=MAXIMAL OPT_AUTOCC=1"
5332 for(i in VALKEYS){
5333 j = split(VALVALS[VALKEYS[i]], ia)
5334 k = "any"
5335 while(j >= 1){
5336 k = ia[j--] " " k
5337 print VALKEYS[i] "=\"" k "\" CONFIG=MAXIMAL OPT_AUTOCC=1"
5340 print "CONFIG=DEVEL OPT_AUTOCC=1"
5341 print "CONFIG=ODEVEL OPT_AUTOCC=1"
5343 onepass("OPT_DEBUG=1")
5344 onepass("")
5346 ' | while read c; do
5347 [ -f mk-config.h ] && ${cp} mk-config.h .ccac.h
5348 printf "\n\n##########\n$c\n"
5349 printf "\n\n##########\n$c\n" >&2
5350 ${SHELL} -c "cd .. && ${MAKE} ${c} config"
5351 if [ -f .ccac.h ] && ${cmp} mk-config.h .ccac.h; then
5352 printf 'Skipping after config, nothing changed\n'
5353 printf 'Skipping after config, nothing changed\n' >&2
5354 continue
5356 ${SHELL} -c "cd ../ && ${MAKE} build test"
5357 done
5358 ${rm} -f .ccac.h
5359 cd .. && ${MAKE} distclean
5362 [ -n "${ERR}" ] && echo > ${ERR}
5363 if [ -z "${CHECK_ONLY}${MAE_TEST}" ]; then
5364 cc_all_configs
5365 elif [ -z "${MAE_TEST}" ] || [ ${#} -eq 0 ]; then
5366 # if have_feat devel; then
5367 # ARGS="${ARGS} -Smemdebug"
5368 # export ARGS
5369 # fi
5370 t_all
5372 else
5373 while [ ${#} -gt 0 ]; do
5374 eval t_${1}
5375 shift
5376 done
5379 [ ${ESTAT} -eq 0 ] && echo Ok || echo >&2 'Errors occurred'
5381 exit ${ESTAT}
5382 # s-sh-mode