cc-test.sh:t_compose_hooks(): add some simple digmsg usage
[s-mailx.git] / cc-test.sh
blob69a599cdc93fa1874c051eb7ff16fa1b5484cfe4
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 while true; do
14 if [ -f ./mk-config.ev ]; then
15 break
16 elif [ -f snailmail.jpg ] && [ -f .obj/mk-config.ev ]; then
17 cd .obj
18 i=../
19 break
20 else
21 echo >&2 'S-nail/S-mailx is not configured.'
22 echo >&2 'This test script requires the shell environment that only the'
23 echo >&2 'configuration script can figure out, even if it will be used to'
24 echo >&2 'test a different binary than the one that would be produced!'
25 echo >&2 '(The necessary information will be in .obj/mk-config.ev.)'
26 echo >&2 'Hit RETURN to run "make config CONFIG=null'
27 read l
28 make config CONFIG=null
30 done
31 . ./mk-config.ev
32 if [ -z "${MAILX__CC_TEST_RUNNING}" ]; then
33 MAILX__CC_TEST_RUNNING=1
34 export MAILX__CC_TEST_RUNNING
35 exec "${SHELL}" "${i}${0}" "${@}"
38 # We need *stealthmua* regardless of $SOURCE_DATE_EPOCH, the program name as
39 # such is a compile-time variable
40 ARGS='-Sv15-compat -:/ -# -Sdotlock-disable -Sexpandaddr=restrict'
41 ARGS="${ARGS}"' -Smime-encoding=quoted-printable -Snosave -Sstealthmua'
42 ADDARG_UNI=-Sttycharset=UTF-8
43 CONF=../make.rc
44 BODY=./.cc-body.txt
45 MBOX=./.cc-test.mbox
46 ERR=./.cc-test.err # Covers only some which cannot be checksummed; not quoted!
47 MAIL=/dev/null
48 #UTF8_LOCALE= autodetected unless set
50 # Note valgrind has problems with FDs in forked childs, which causes some tests
51 # to fail (the FD is rewound and thus will be dumped twice)
52 MEMTESTER=
53 #MEMTESTER='valgrind --leak-check=full --log-file=.vl-%p '
55 ## -- (>8 -- 8<) -- ##
57 msg() {
58 fmt=${1}
59 shift
60 printf >&2 -- "${fmt}\\n" "${@}"
63 ## -- >8 -- 8< -- ##
65 export ARGS ADDARG_UNI CONF BODY MBOX MAIL MAKE awk cat cksum rm sed grep
67 LC_ALL=C LANG=C
68 TZ=UTC
69 # Wed Oct 2 01:50:07 UTC 1996
70 SOURCE_DATE_EPOCH=844221007
72 export LC_ALL LANG TZ SOURCE_DATE_EPOCH
73 unset POSIXLY_CORRECT LOGNAME USER
75 usage() {
76 ${cat} >&2 <<_EOT
77 Synopsis: cc-test.sh --check-only s-mailx-binary
78 Synopsis: cc-test.sh --mae-test s-mailx-binary [:TEST:]
79 Synopsis: cc-test.sh
81 --check-only EXE run the test series, exit success or error;
82 if run in a git(1) checkout then failed tests
83 create test output data files
84 --mae-test EXE [:TEST:] run all or only the given TESTs, and create
85 test output data files; if run in a git(1)
86 checkout with the [test-out] branch available,
87 it will also create file differences
89 Without arguments as many different configurations as possible
90 will be compiled and tested.
91 _EOT
92 exit 1
95 CHECK_ONLY= MAE_TEST= GIT_REPO= MAILX=
96 if [ "${1}" = --check-only ]; then
97 [ ${#} -eq 2 ] || usage
98 CHECK_ONLY=1 MAILX=${2}
99 [ -x "${MAILX}" ] || usage
100 echo 'Mode: --check-only, binary: '"${MAILX}"
101 [ -d ../.git ] && [ -z "${MAILX__CC_TEST_NO_DATA_FILES}" ] && GIT_REPO=1
102 elif [ "${1}" = --mae-test ]; then
103 [ ${#} -ge 2 ] || usage
104 MAE_TEST=1 MAILX=${2}
105 [ -x "${MAILX}" ] || usage
106 shift 2
107 echo 'Mode: --mae-test, binary: '"${MAILX}"
108 [ -d ../.git ] && GIT_REPO=1
109 else
110 [ ${#} -eq 0 ] || usage
111 echo 'Mode: full compile test, this will take a long time...'
112 MAILX__CC_TEST_NO_DATA_FILES=1
113 export MAILX__CC_TEST_NO_DATA_FILES
116 RAWMAILX=${MAILX}
117 MAILX="${MEMTESTER}${MAILX}"
118 export RAWMAILX MAILX
120 if [ -n "${CHECK_ONLY}${MAE_TEST}" ]; then
121 if [ -z "${UTF8_LOCALE}" ]; then
122 # Try ourselfs via nl_langinfo(CODESET) first (requires a new version)
123 if command -v "${RAWMAILX}" >/dev/null 2>&1 &&
124 ("${RAWMAILX}" -:/ -Xxit) >/dev/null 2>&1; then
125 echo 'Trying to detect UTF-8 locale via '"${RAWMAILX}"
126 i=`LC_ALL=C.utf8 "${RAWMAILX}" ${ARGS} -X '
127 \define cset_test {
128 \if [ "${ttycharset}" @i=% utf ]
129 \echo $LC_ALL
130 \xit 0
131 \end
132 \if [ "${#}" -gt 0 ]
133 \wysh set LC_ALL=${1}
134 \shift
135 \eval xcall cset_test "${@}"
136 \end
137 \xit 1
139 \call cset_test C.UTF-8 POSIX.utf8 POSIX.UTF-8 \
140 en_EN.utf8 en_EN.UTF-8 en_US.utf8 en_US.UTF-8
142 [ $? -eq 0 ] && UTF8_LOCALE=$i
145 if [ -z "${UTF8_LOCALE}" ] && (locale yesexpr) >/dev/null 2>&1; then
146 echo 'Trying to detect UTF-8 locale via locale -a'
147 UTF8_LOCALE=`locale -a | { m=
148 while read n; do
149 if { echo ${n} |
150 ${grep} -i -e utf8 -e utf-8; } >/dev/null 2>&1; then
151 m=${n}
152 if { echo ${n} |
153 ${grep} -e POSIX -e en_EN -e en_US; } \
154 >/dev/null 2>&1; then
155 break
158 done
159 echo ${m}
164 if [ -n "${UTF8_LOCALE}" ]; then
165 echo 'Using Unicode locale '"${UTF8_LOCALE}"
166 else
167 echo 'No Unicode locale found, disabling Unicode tests'
171 ESTAT=0
173 TRAP_EXIT_ADDONS=
174 TEST_NAME=
175 trap "${rm} -rf \"${BODY}\" \"${MBOX}\" \"${ERR}\" \${TRAP_EXIT_ADDONS}" EXIT
176 trap "exit 1" HUP INT TERM
178 have_feat() {
179 ( "${RAWMAILX}" ${ARGS} -X'echo $features' -Xx |
180 ${grep} +${1} ) >/dev/null 2>&1
183 t_prolog() {
184 ${rm} -rf "${BODY}" "${MBOX}" ${TRAP_EXIT_ADDONS}
185 TRAP_EXIT_ADDONS=
186 if [ ${#} -gt 0 ]; then
187 TEST_NAME=${1}
188 printf '[%s]\n' "${1}"
191 t_epilog() {
192 t_prolog
195 t_xmta() {
196 [ ${#} -ge 1 ] && __from=${1} ||
197 __from='Silybum Marianum Tue Apr 17 15:55:01 2018'
198 [ ${#} -eq 2 ] && __to=${2} || __to="${MBOX}"
199 ${cat} <<-_EOT > .tmta.sh
200 #!${SHELL} -
201 ( echo 'From '"${__from}" && ${cat} && echo ) >> "${__to}"
202 _EOT
203 chmod 0755 .tmta.sh
206 check() {
207 restat=${?} tid=${1} eestat=${2} f=${3} s=${4}
208 [ "${eestat}" != - ] && [ "${restat}" != "${eestat}" ] &&
209 err "${TESTNAME}-${tid}" 'unexpected status: '"${restat} != ${eestat}"
210 csum="`${cksum} < ${f} | ${sed} -e 's/[ ]\{1,\}/ /g'`"
211 if [ "${csum}" = "${s}" ]; then
212 maex=
213 printf '%s-%s: ok\n' "${TEST_NAME}" "${tid}"
214 else
215 maex=yes
216 ESTAT=1
217 printf '%s-%s: error: checksum mismatch (got %s)\n' \
218 "${TEST_NAME}" "${tid}" "${csum}"
221 if [ -n "${CHECK_ONLY}${MAE_TEST}" ]; then
222 x="t.${TEST_NAME}-${tid}"
223 if [ -n "${MAE_TEST}" ] || [ -n "${maex}" -a -n "${GIT_REPO}" ]; then
224 ${cp} -f "${f}" ./"${x}"
227 if [ -n "${maex}" ] && [ -n "${GIT_REPO}" ] &&
228 command -v diff >/dev/null 2>&1 &&
229 (git rev-parse --verify test-out) >/dev/null 2>&1 &&
230 git show test-out:"${x}" > ./"${x}".old 2>/dev/null; then
231 diff -ru ./"${x}".old ./"${x}" > "${x}".diff
236 err() {
237 ESTAT=1
238 printf '%s: error: %s\n' ${1} "${2}"
241 check_ex0() {
242 # $1=test name [$2=status]
243 __qm__=${?}
244 [ ${#} -gt 1 ] && __qm__=${2}
245 if [ ${__qm__} -ne 0 ]; then
246 err "${TEST_NAME}-${1}" 'unexpected non-0 exit status'
247 return 0
248 else
249 printf '%s-%s: ok\n' "${TEST_NAME}" "${1}"
250 return 1
254 check_exn0() {
255 # $1=test name [$2=status]
256 __qm__=${?}
257 [ ${#} -gt 1 ] && __qm__=${2}
258 if [ ${__qm__} -eq 0 ]; then
259 err "${TEST_NAME}-${1}" 'unexpected 0 exit status'
260 return 1
261 else
262 printf '%s-%s: ok\n' "${TEST_NAME}" "${1}"
263 return 0
267 if ( [ "$((1 + 1))" = 2 ] ) >/dev/null 2>&1; then
268 add() {
269 echo "$((${1} + ${2}))"
271 else
272 add() {
273 echo `${awk} 'BEGIN{print '${1}' + '${2}'}'`
277 if ( [ "$((2 % 3))" = 2 ] ) >/dev/null 2>&1; then
278 modulo() {
279 echo "$((${1} % ${2}))"
281 else
282 modulo() {
283 echo `${awk} 'BEGIN{print '${1}' % '${2}'}'`
287 t_all() {
288 # Basics
289 t_X_opt_input_command_stack
290 t_X_errexit
291 t_S_freeze
292 t_input_inject_semicolon_seq
293 t_shcodec
294 t_wysh
295 t_commandalias
296 t_ifelse
297 t_localopts
298 t_local
299 t_macro_param_shift
300 t_addrcodec
301 t_vexpr
302 t_call_ret
303 t_xcall
304 t_vpospar
305 t_atxplode
306 t_read
308 # VFS
309 t_mbox
310 t_maildir
312 # MIME and RFC basics
313 t_mime_if_not_ascii
314 t_xxxheads_rfc2047
315 t_iconv_mbyte_base64
316 t_iconv_mainbody
317 t_binary_mainbody
318 t_C_opt_customhdr
320 # Operational basics with easy tests
321 t_alias
322 t_filetype
323 t_record_a_resend
324 t_e_H_L_opts
325 t_q_t_etc_opts
326 t_message_injections
327 t_attachments
328 t_rfc2231 # (after attachments)
329 t_mime_types_load_control
331 # Around state machine, after basics
332 t_alternates
333 t_quote_a_cmd_escapes
334 t_compose_edits
335 t_digmsg
337 # Heavy use of/rely on state machine (behaviour) and basics
338 t_compose_hooks
339 t_mass_recipients
340 t_lreply_futh_rth_etc
342 # Rest
343 t_s_mime
346 # Basics {{{
347 t_X_opt_input_command_stack() {
348 t_prolog X_opt_input_command_stack
349 TRAP_EXIT_ADDONS="./.t*"
351 ${cat} <<- '__EOT' > "${BODY}"
352 echo 1
353 define mac0 {
354 echo mac0-1 via1 $0
356 call mac0
357 echo 2
358 source '\
359 echo "define mac1 {";\
360 echo " echo mac1-1 via1 \$0";\
361 echo " call mac0";\
362 echo " echo mac1-2";\
363 echo " call mac2";\
364 echo " echo mac1-3";\
365 echo "}";\
366 echo "echo 1-1";\
367 echo "define mac2 {";\
368 echo " echo mac2-1 via1 \$0";\
369 echo " call mac0";\
370 echo " echo mac2-2";\
371 echo "}";\
372 echo "echo 1-2";\
373 echo "call mac1";\
374 echo "echo 1-3";\
375 echo "source \"\
376 echo echo 1-1-1 via1 \$0;\
377 echo call mac0;\
378 echo echo 1-1-2;\
379 | \"";\
380 echo "echo 1-4";\
382 echo 3
383 call mac2
384 echo 4
385 undefine *
386 __EOT
388 # The -X option supports multiline arguments, and those can internally use
389 # reverse solidus newline escaping. And all -X options are joined...
390 APO=\'
391 < "${BODY}" ${MAILX} ${ARGS} \
392 -X 'e\' \
393 -X ' c\' \
394 -X ' h\' \
395 -X ' o \' \
396 -X 1 \
398 define mac0 {
399 echo mac0-1 via2 $0
401 call mac0
402 echo 2
405 source '${APO}'\
406 echo "define mac1 {";\
407 echo " echo mac1-1 via2 \$0";\
408 echo " call mac0";\
409 echo " echo mac1-2";\
410 echo " call mac2";\
411 echo " echo mac1-3";\
412 echo "}";\
413 echo "echo 1-1";\
414 echo "define mac2 {";\
415 echo " echo mac2-1 via2 \$0";\
416 echo " call mac0";\
417 echo " echo mac2-2";\
418 echo "}";\
419 echo "echo 1-2";\
420 echo "call mac1";\
421 echo "echo 1-3";\
422 echo "source \"\
423 echo echo 1-1-1 via2 \$0;\
424 echo call mac0;\
425 echo echo 1-1-2;\
426 | \"";\
427 echo "echo 1-4";\
428 | '${APO}'
429 echo 3
432 call mac2
433 echo 4
434 undefine *
435 ' > "${MBOX}"
437 check 1 0 "${MBOX}" '1786542668 416'
439 # Test for [8412796a] (n_cmd_arg_parse(): FIX token error -> crash, e.g.
440 # "-RX 'bind;echo $?' -Xx".., 2018-08-02)
441 if have_feat key-bindings; then
442 ${MAILX} ${ARGS} -RX'bind;echo $?' -Xx > ./.tall 2>&1
443 ${MAILX} ${ARGS} -RX'bind ;echo $?' -Xx >> ./.tall 2>&1
444 ${MAILX} ${ARGS} -RX'bind ;echo $?' -Xx >> ./.tall 2>&1
445 ${MAILX} ${ARGS} -RX'bind ;echo $?' -Xx >> ./.tall 2>&1
446 check cmdline 0 ./.tall '1867586969 8'
447 else
448 echo 'X_opt_input_command_stack-cmdline: unsupported, skipped'
451 t_epilog
454 t_X_errexit() {
455 t_prolog X_errexit
456 if have_feat uistrings; then :; else
457 echo 'X_errexit: unsupported, skipped'
458 return
461 ${cat} <<- '__EOT' > "${BODY}"
462 echo one
463 echos nono
464 echo two
465 __EOT
467 </dev/null ${MAILX} ${ARGS} -Snomemdebug \
468 -X'echo one' -X' echos nono ' -X'echo two' \
469 > "${MBOX}" 2>&1
470 check 1 0 "${MBOX}" '916157812 53'
472 </dev/null ${MAILX} ${ARGS} -X'source '"${BODY}" -Snomemdebug \
473 > "${MBOX}" 2>&1
474 check 2 0 "${MBOX}" '916157812 53'
476 </dev/null MAILRC="${BODY}" ${MAILX} ${ARGS} -:u -Snomemdebug \
477 > "${MBOX}" 2>&1
478 check 3 0 "${MBOX}" '916157812 53'
482 </dev/null ${MAILX} ${ARGS} -Serrexit -Snomemdebug \
483 -X'echo one' -X' echos nono ' -X'echo two' \
484 > "${MBOX}" 2>&1
485 check 4 1 "${MBOX}" '2118430867 49'
487 </dev/null ${MAILX} ${ARGS} -X'source '"${BODY}" -Serrexit -Snomemdebug \
488 > "${MBOX}" 2>&1
489 check 5 1 "${MBOX}" '2118430867 49'
491 </dev/null MAILRC="${BODY}" ${MAILX} ${ARGS} -:u -Serrexit -Snomemdebug \
492 > "${MBOX}" 2>&1
493 check 6 1 "${MBOX}" '12955965 172'
495 </dev/null MAILRC="${BODY}" ${MAILX} ${ARGS} -:u -Sposix -Snomemdebug \
496 > "${MBOX}" 2>&1
497 check 7 1 "${MBOX}" '12955965 172'
499 ## Repeat 4-7 with ignerr set
501 ${sed} -e 's/^echos /ignerr echos /' < "${BODY}" > "${MBOX}"
503 </dev/null ${MAILX} ${ARGS} -Serrexit -Snomemdebug \
504 -X'echo one' -X'ignerr echos nono ' -X'echo two' \
505 > "${BODY}" 2>&1
506 check 8 0 "${BODY}" '916157812 53'
508 </dev/null ${MAILX} ${ARGS} -X'source '"${MBOX}" -Serrexit -Snomemdebug \
509 > "${BODY}" 2>&1
510 check 9 0 "${BODY}" '916157812 53'
512 </dev/null MAILRC="${MBOX}" ${MAILX} ${ARGS} -:u -Serrexit -Snomemdebug \
513 > "${BODY}" 2>&1
514 check 10 0 "${BODY}" '916157812 53'
516 </dev/null MAILRC="${MBOX}" ${MAILX} ${ARGS} -:u -Sposix -Snomemdebug \
517 > "${BODY}" 2>&1
518 check 11 0 "${BODY}" '916157812 53'
520 t_epilog
523 t_S_freeze() {
524 t_prolog S_freeze
525 oterm=$TERM
526 unset TERM
528 # Test basic assumption
529 </dev/null MAILRC="${BODY}" ${MAILX} ${ARGS} \
530 -X'echo asksub<$asksub> dietcurd<$dietcurd>' \
531 -Xx > "${MBOX}" 2>&1
532 check 1 0 "${MBOX}" '270686329 21'
535 ${cat} <<- '__EOT' > "${BODY}"
536 echo asksub<$asksub>
537 set asksub
538 echo asksub<$asksub>
539 __EOT
540 </dev/null MAILRC="${BODY}" ${MAILX} ${ARGS} -:u \
541 -Snoasksub -Sasksub -Snoasksub \
542 -X'echo asksub<$asksub>' -X'set asksub' -X'echo asksub<$asksub>' \
543 -Xx > "${MBOX}" 2>&1
544 check 2 0 "${MBOX}" '3182942628 37'
546 ${cat} <<- '__EOT' > "${BODY}"
547 echo asksub<$asksub>
548 unset asksub
549 echo asksub<$asksub>
550 __EOT
551 </dev/null MAILRC="${BODY}" ${MAILX} ${ARGS} -:u \
552 -Snoasksub -Sasksub \
553 -X'echo asksub<$asksub>' -X'unset asksub' -X'echo asksub<$asksub>' \
554 -Xx > "${MBOX}" 2>&1
555 check 3 0 "${MBOX}" '2006554293 39'
558 ${cat} <<- '__EOT' > "${BODY}"
559 echo dietcurd<$dietcurd>
560 set dietcurd=cherry
561 echo dietcurd<$dietcurd>
562 __EOT
563 </dev/null MAILRC="${BODY}" ${MAILX} ${ARGS} -:u \
564 -Sdietcurd=strawberry -Snodietcurd -Sdietcurd=vanilla \
565 -X'echo dietcurd<$dietcurd>' -X'unset dietcurd' \
566 -X'echo dietcurd<$dietcurd>' \
567 -Xx > "${MBOX}" 2>&1
568 check 4 0 "${MBOX}" '1985768109 65'
570 ${cat} <<- '__EOT' > "${BODY}"
571 echo dietcurd<$dietcurd>
572 unset dietcurd
573 echo dietcurd<$dietcurd>
574 __EOT
575 </dev/null MAILRC="${BODY}" ${MAILX} ${ARGS} -:u \
576 -Sdietcurd=strawberry -Snodietcurd \
577 -X'echo dietcurd<$dietcurd>' -X'set dietcurd=vanilla' \
578 -X'echo dietcurd<$dietcurd>' \
579 -Xx > "${MBOX}" 2>&1
580 check 5 0 "${MBOX}" '151574279 51'
582 # TODO once we have a detached one with env=1..
583 if [ -n "`</dev/null ${MAILX} ${ARGS} -X'!echo \$TERM' -Xx`" ]; then
584 echo 's_freeze-{6,7}: shell sets $TERM, skipped'
585 else
586 ${cat} <<- '__EOT' > "${BODY}"
587 !echo "shell says TERM<$TERM>"
588 echo TERM<$TERM>
589 !echo "shell says TERM<$TERM>"
590 set TERM=cherry
591 !echo "shell says TERM<$TERM>"
592 echo TERM<$TERM>
593 !echo "shell says TERM<$TERM>"
594 __EOT
595 </dev/null MAILRC="${BODY}" ${MAILX} ${ARGS} -:u \
596 -STERM=strawberry -SnoTERM -STERM=vanilla \
597 -X'echo mail<$TERM>' -X'unset TERM' \
598 -X'!echo "shell says TERM<$TERM>"' -X'echo TERM<$TERM>' \
599 -Xx > "${MBOX}" 2>&1
600 check 6 0 "${MBOX}" '1211476036 167'
602 ${cat} <<- '__EOT' > "${BODY}"
603 !echo "shell says TERM<$TERM>"
604 echo TERM<$TERM>
605 !echo "shell says TERM<$TERM>"
606 set TERM=cherry
607 !echo "shell says TERM<$TERM>"
608 echo TERM<$TERM>
609 !echo "shell says TERM<$TERM>"
610 __EOT
611 </dev/null MAILRC="${BODY}" ${MAILX} ${ARGS} -:u \
612 -STERM=strawberry -SnoTERM \
613 -X'echo TERM<$TERM>' -X'set TERM=vanilla' \
614 -X'!echo "shell says TERM<$TERM>"' -X'echo TERM<$TERM>' \
615 -Xx > "${MBOX}" 2>&1
616 check 7 0 "${MBOX}" '3365080441 132'
619 TERM=$oterm
620 t_epilog
623 t_input_inject_semicolon_seq() {
624 t_prolog input_inject_semicolon_seq
626 ${cat} <<- '__EOT' | ${MAILX} ${ARGS} > "${MBOX}"
627 define mydeepmac {
628 echon '(mydeepmac)';
630 define mymac {
631 echon this_is_mymac;call mydeepmac;echon ';';
633 echon one';';call mymac;echon two";";call mymac;echo three$';';
634 define mymac {
635 echon this_is_mymac;call mydeepmac;echon ,TOO'!;';
637 echon one';';call mymac;echon two";";call mymac;echo three$';';
638 __EOT
640 check 1 0 "${MBOX}" '512117110 140'
642 t_epilog
645 t_shcodec() {
646 t_prolog shcodec
648 # XXX the first needs to be checked, it is quite dumb as such
649 ${cat} <<- '__EOT' | ${MAILX} ${ARGS} > "${MBOX}" 2>&1
650 shcodec e abcd
651 echo $?/$^ERRNAME
652 shcodec d abcd
653 echo $?/$^ERRNAME
654 shcodec e a'b'c'd'
655 echo $?/$^ERRNAME
656 shcodec d a'b'c'd'
657 echo $?/$^ERRNAME
658 shcodec e a"b"c"d"
659 echo $?/$^ERRNAME
660 shcodec d a"b"c"d"
661 echo $?/$^ERRNAME
662 shcodec e a$'b'c$'d'
663 echo $?/$^ERRNAME
664 shcodec d a$'b'c$'d'
665 echo $?/$^ERRNAME
666 shcodec e 'abcd'
667 echo $?/$^ERRNAME
668 shcodec d 'abcd'
669 echo $?/$^ERRNAME
670 shcodec e "abcd"
671 echo $?/$^ERRNAME
672 shcodec d "abcd"
673 echo $?/$^ERRNAME
674 shcodec e $'abcd'
675 echo $?/$^ERRNAME
676 shcodec d $'abcd'
677 echo $?/$^ERRNAME
678 # same but with vput
679 vput shcodec res e abcd
680 echo $?/$^ERRNAME $res
681 eval shcodec d $res
682 echo $?/$^ERRNAME
683 vput shcodec res d abcd
684 echo $?/$^ERRNAME $res
685 eval shcodec d $res
686 echo $?/$^ERRNAME
687 vput shcodec res e a'b'c'd'
688 echo $?/$^ERRNAME $res
689 eval shcodec d $res
690 echo $?/$^ERRNAME
691 vput shcodec res d a'b'c'd'
692 echo $?/$^ERRNAME $res
693 eval shcodec d $res
694 echo $?/$^ERRNAME
695 vput shcodec res e a"b"c"d"
696 echo $?/$^ERRNAME $res
697 eval shcodec d $res
698 echo $?/$^ERRNAME
699 vput shcodec res d a"b"c"d"
700 echo $?/$^ERRNAME $res
701 eval shcodec d $res
702 echo $?/$^ERRNAME
703 vput shcodec res e a$'b'c$'d'
704 echo $?/$^ERRNAME $res
705 eval shcodec d $res
706 echo $?/$^ERRNAME
707 vput shcodec res d a$'b'c$'d'
708 echo $?/$^ERRNAME $res
709 eval shcodec d $res
710 echo $?/$^ERRNAME
711 vput shcodec res e 'abcd'
712 echo $?/$^ERRNAME $res
713 eval shcodec d $res
714 echo $?/$^ERRNAME
715 vput shcodec res d 'abcd'
716 echo $?/$^ERRNAME $res
717 eval shcodec d $res
718 echo $?/$^ERRNAME
719 vput shcodec res e "abcd"
720 echo $?/$^ERRNAME $res
721 eval shcodec d $res
722 echo $?/$^ERRNAME
723 vput shcodec res d "abcd"
724 echo $?/$^ERRNAME $res
725 eval shcodec d $res
726 echo $?/$^ERRNAME
727 vput shcodec res e $'abcd'
728 echo $?/$^ERRNAME $res
729 eval shcodec d $res
730 echo $?/$^ERRNAME
731 vput shcodec res d $'abcd'
732 echo $?/$^ERRNAME $res
733 eval shcodec d $res
734 echo $?/$^ERRNAME
736 vput shcodec res e a b\ c d
737 echo $?/$^ERRNAME $res
738 eval shcodec d $res
739 echo $?/$^ERRNAME
740 vput shcodec res d a b\ c d
741 echo $?/$^ERRNAME $res
742 vput shcodec res e ab cd
743 echo $?/$^ERRNAME $res
744 eval shcodec d $res
745 echo $?/$^ERRNAME
746 vput shcodec res d 'ab cd'
747 echo $?/$^ERRNAME $res
748 vput shcodec res e a 'b c' d
749 echo $?/$^ERRNAME $res
750 eval shcodec d $res
751 echo $?/$^ERRNAME
752 vput shcodec res d a 'b c' d
753 echo $?/$^ERRNAME $res
754 vput shcodec res e a "b c" d
755 echo $?/$^ERRNAME $res
756 eval shcodec d $res
757 echo $?/$^ERRNAME
758 vput shcodec res d a "b c" d
759 echo $?/$^ERRNAME $res
760 vput shcodec res e a $'b c' d
761 echo $?/$^ERRNAME $res
762 eval shcodec d $res
763 echo $?/$^ERRNAME
764 vput shcodec res d a $'b c' d
765 echo $?/$^ERRNAME $res
767 vput shcodec res e 'a$`"\'
768 echo $?/$^ERRNAME $res
769 eval shcodec d $res
770 echo $?/$^ERRNAME
771 vput shcodec res d 'a$`"\'
772 echo $?/$^ERRNAME $res
773 vput shcodec res e "a\$\`'\"\\"
774 echo $?/$^ERRNAME $res
775 eval shcodec d $res
776 echo $?/$^ERRNAME
777 vput shcodec res d "a\$\`'\"\\"
778 echo $?/$^ERRNAME $res
779 vput shcodec res e $'a\$`\'\"\\'
780 echo $?/$^ERRNAME $res
781 eval shcodec d $res
782 echo $?/$^ERRNAME
783 vput shcodec res d $'a\$`\'\"\\'
784 echo $?/$^ERRNAME $res
785 vput shcodec res e $'a\$`\'"\\'
786 echo $?/$^ERRNAME $res
787 eval shcodec d $res
788 echo $?/$^ERRNAME
789 vput shcodec res d $'a\$`\'"\\'
790 echo $?/$^ERRNAME $res
792 set diet=curd
793 vput shcodec res e a${diet}c
794 echo $?/$^ERRNAME $res
795 eval shcodec d $res
796 echo $?/$^ERRNAME
797 eval vput shcodec res e a${diet}c
798 echo $?/$^ERRNAME $res
799 eval shcodec d $res
800 echo $?/$^ERRNAME
801 vput shcodec res e "a${diet}c"
802 echo $?/$^ERRNAME $res
803 eval shcodec d $res
804 echo $?/$^ERRNAME
805 eval vput shcodec res e "a${diet}c"
806 echo $?/$^ERRNAME $res
807 eval shcodec d $res
808 echo $?/$^ERRNAME
809 __EOT
810 check 1 0 "${MBOX}" '3316745312 1241'
812 if [ -z "${UTF8_LOCALE}" ]; then
813 echo 'Skip shcodec-unicode, no UTF8_LOCALE TODO CANNOT'
814 else
815 ${cat} <<- '__EOT' | LC_ALL=${UTF8_LOCALE} \
816 ${MAILX} ${ARGS} > "${MBOX}" 2>>${ERR}
818 shcodec e täst
819 shcodec +e täst
820 shcodec d $'t\u00E4st'
821 shcodec e aՍc
822 shcodec +e aՍc
823 shcodec d $'a\u054Dc'
824 shcodec e a😃c
825 shcodec +e a😃c
826 shcodec d $'a\U0001F603c'
827 __EOT
828 check unicode 0 "${MBOX}" '4233409480 77'
831 t_epilog
834 t_wysh() {
835 t_prolog wysh
837 ${cat} <<- '__EOT' > "${BODY}"
839 echo abcd
840 echo a'b'c'd'
841 echo a"b"c"d"
842 echo a$'b'c$'d'
843 echo 'abcd'
844 echo "abcd"
845 echo $'abcd'
846 echo a\ b\ c\ d
847 echo a 'b c' d
848 echo a "b c" d
849 echo a $'b c' d
851 echo 'a$`"\'
852 echo "a\$\`'\"\\"
853 echo $'a\$`\'\"\\'
854 echo $'a\$`\'"\\'
855 # DIET=CURD TIED=
856 echo 'a${DIET}b${TIED}c\${DIET}d\${TIED}e' # COMMENT
857 echo "a${DIET}b${TIED}c\${DIET}d\${TIED}e"
858 echo $'a${DIET}b${TIED}c\${DIET}d\${TIED}e'
860 echo a$'\101\0101\x41\u0041\u41\U00000041\U41'c
861 echo a$'\u0041\u41\u0C1\U00000041\U41'c
862 echo a$'\377'c
863 echo a$'\0377'c
864 echo a$'\400'c
865 echo a$'\0400'c
866 echo a$'\U1100001'c
868 echo a$'b\0c'd
869 echo a$'b\00c'de
870 echo a$'b\000c'df
871 echo a$'b\0000c'dg
872 echo a$'b\x0c'dh
873 echo a$'b\x00c'di
874 echo a$'b\u0'dj
875 echo a$'b\u00'dk
876 echo a$'b\u000'dl
877 echo a$'b\u0000'dm
878 echo a$'b\U0'dn
879 echo a$'b\U00'do
880 echo a$'b\U000'dp
881 echo a$'b\U0000'dq
882 echo a$'b\U00000'dr
883 echo a$'b\U000000'ds
884 echo a$'b\U0000000'dt
885 echo a$'b\U00000000'du
887 echo a$'\cI'b
888 echo a$'\011'b
889 echo a$'\x9'b
890 echo a$'\u9'b
891 echo a$'\U9'b
892 echo a$'\c@'b c d
893 __EOT
895 if [ -z "${UTF8_LOCALE}" ]; then
896 echo 'Skip wysh-unicode, no UTF8_LOCALE'
897 else
898 < "${BODY}" DIET=CURD TIED= \
899 LC_ALL=${UTF8_LOCALE} ${MAILX} ${ARGS} > "${MBOX}" 2>>${ERR}
900 check unicode 0 "${MBOX}" '475805847 317'
903 < "${BODY}" DIET=CURD TIED= ${MAILX} ${ARGS} > "${MBOX}" 2>>${ERR}
904 check c 0 "${MBOX}" '1473887148 321'
906 ${cat} <<- '__EOT' | ${MAILX} ${ARGS} > "${MBOX}"
907 wysh set mager='\hey\'
908 varshow mager
909 wysh set mager="\hey\\"
910 varshow mager
911 wysh set mager=$'\hey\\'
912 varshow mager
913 __EOT
914 check 3 0 "${MBOX}" '1289698238 69'
916 t_epilog
919 t_commandalias() {
920 t_prolog commandalias
922 ${cat} <<- '__EOT' | ${MAILX} ${ARGS} > "${MBOX}"
923 commandalias echo echo hoho
924 echo stop.
925 commandalias X Xx
926 commandalias Xx XxX
927 commandalias XxX XxXx
928 commandalias XxXx XxXxX
929 commandalias XxXxX XxXxXx
930 commandalias XxXxXx echo huhu
931 commandalias XxXxXxX echo huhu
933 commandalias XxXxXx XxXxXxX
935 uncommandalias echo
936 commandalias XxXxXx echo huhu
938 __EOT
940 check 1 0 "${MBOX}" '1638809585 36'
942 t_epilog
945 t_ifelse() {
946 t_prolog ifelse
948 # Nestable conditions test
949 ${cat} <<- '__EOT' | ${MAILX} ${ARGS} > "${MBOX}"
950 if 0
951 echo 1.err
952 else
953 echo 1.ok
954 endif
955 if 1
956 echo 2.ok
957 else
958 echo 2.err
959 endif
960 if $dietcurd
961 echo 3.err
962 else
963 echo 3.ok
964 endif
965 set dietcurd=yoho
966 if $dietcurd
967 echo 4.ok
968 else
969 echo 4.err
970 endif
971 if $dietcurd == 'yoho'
972 echo 5.ok
973 else
974 echo 5.err
975 endif
976 if $dietcurd @== 'Yoho'
977 echo 5-1.ok
978 else
979 echo 5-1.err
980 endif
981 if $dietcurd == 'Yoho'
982 echo 5-2.err
983 else
984 echo 5-2.ok
985 endif
986 if $dietcurd != 'yoho'
987 echo 6.err
988 else
989 echo 6.ok
990 endif
991 if $dietcurd @!= 'Yoho'
992 echo 6-1.err
993 else
994 echo 6-1.ok
995 endif
996 if $dietcurd != 'Yoho'
997 echo 6-2.ok
998 else
999 echo 6-2.err
1000 endif
1001 # Nesting
1002 if faLse
1003 echo 7.err1
1004 if tRue
1005 echo 7.err2
1006 if yEs
1007 echo 7.err3
1008 else
1009 echo 7.err4
1010 endif
1011 echo 7.err5
1012 endif
1013 echo 7.err6
1014 else
1015 echo 7.ok7
1016 if YeS
1017 echo 7.ok8
1018 if No
1019 echo 7.err9
1020 else
1021 echo 7.ok9
1022 endif
1023 echo 7.ok10
1024 else
1025 echo 7.err11
1026 if yeS
1027 echo 7.err12
1028 else
1029 echo 7.err13
1030 endif
1031 endif
1032 echo 7.ok14
1033 endif
1034 if r
1035 echo 8.ok1
1036 if R
1037 echo 8.ok2
1038 else
1039 echo 8.err2
1040 endif
1041 echo 8.ok3
1042 else
1043 echo 8.err1
1044 endif
1045 if s
1046 echo 9.err1
1047 else
1048 echo 9.ok1
1049 if S
1050 echo 9.err2
1051 else
1052 echo 9.ok2
1053 endif
1054 echo 9.ok3
1055 endif
1056 # `elif'
1057 if $dietcurd == 'yohu'
1058 echo 10.err1
1059 elif $dietcurd == 'yoha'
1060 echo 10.err2
1061 elif $dietcurd == 'yohe'
1062 echo 10.err3
1063 elif $dietcurd == 'yoho'
1064 echo 10.ok1
1065 if $dietcurd == 'yohu'
1066 echo 10.err4
1067 elif $dietcurd == 'yoha'
1068 echo 10.err5
1069 elif $dietcurd == 'yohe'
1070 echo 10.err6
1071 elif $dietcurd == 'yoho'
1072 echo 10.ok2
1073 if $dietcurd == 'yohu'
1074 echo 10.err7
1075 elif $dietcurd == 'yoha'
1076 echo 10.err8
1077 elif $dietcurd == 'yohe'
1078 echo 10.err9
1079 elif $dietcurd == 'yoho'
1080 echo 10.ok3
1081 else
1082 echo 10.err10
1083 endif
1084 else
1085 echo 10.err11
1086 endif
1087 else
1088 echo 10.err12
1089 endif
1090 # integer
1091 set dietcurd=10
1092 if $dietcurd -lt 11
1093 echo 11.ok1
1094 if $dietcurd -gt 9
1095 echo 11.ok2
1096 else
1097 echo 11.err2
1098 endif
1099 if $dietcurd -eq 10
1100 echo 11.ok3
1101 else
1102 echo 11.err3
1103 endif
1104 if $dietcurd -ge 10
1105 echo 11.ok4
1106 else
1107 echo 11.err4
1108 endif
1109 if $dietcurd -le 10
1110 echo 11.ok5
1111 else
1112 echo 11.err5
1113 endif
1114 if $dietcurd -ge 11
1115 echo 11.err6
1116 else
1117 echo 11.ok6
1118 endif
1119 if $dietcurd -le 9
1120 echo 11.err7
1121 else
1122 echo 11.ok7
1123 endif
1124 else
1125 echo 11.err1
1126 endif
1127 set dietcurd=Abc
1128 if $dietcurd < aBd
1129 echo 12.ok1
1130 if $dietcurd @> abB
1131 echo 12.ok2
1132 else
1133 echo 12.err2
1134 endif
1135 if $dietcurd @== aBC
1136 echo 12.ok3
1137 else
1138 echo 12.err3
1139 endif
1140 if $dietcurd @>= AbC
1141 echo 12.ok4
1142 else
1143 echo 12.err4
1144 endif
1145 if $dietcurd @<= ABc
1146 echo 12.ok5
1147 else
1148 echo 12.err5
1149 endif
1150 if $dietcurd @>= abd
1151 echo 12.err6
1152 else
1153 echo 12.ok6
1154 endif
1155 if $dietcurd @<= abb
1156 echo 12.err7
1157 else
1158 echo 12.ok7
1159 endif
1160 else
1161 echo 12.err1
1162 endif
1163 if $dietcurd < aBc
1164 echo 12-1.ok
1165 else
1166 echo 12-1.err
1167 endif
1168 if $dietcurd @< aBc
1169 echo 12-2.err
1170 else
1171 echo 12-2.ok
1172 endif
1173 if $dietcurd > ABc
1174 echo 12-3.ok
1175 else
1176 echo 12-3.err
1177 endif
1178 if $dietcurd @> ABc
1179 echo 12-3.err
1180 else
1181 echo 12-3.ok
1182 endif
1183 if $dietcurd @i=% aB
1184 echo 13.ok
1185 else
1186 echo 13.err
1187 endif
1188 if $dietcurd =% aB
1189 echo 13-1.err
1190 else
1191 echo 13-1.ok
1192 endif
1193 if $dietcurd @=% bC
1194 echo 14.ok
1195 else
1196 echo 14.err
1197 endif
1198 if $dietcurd !% aB
1199 echo 15-1.ok
1200 else
1201 echo 15-1.err
1202 endif
1203 if $dietcurd @!% aB
1204 echo 15-2.err
1205 else
1206 echo 15-2.ok
1207 endif
1208 if $dietcurd !% bC
1209 echo 15-3.ok
1210 else
1211 echo 15-3.err
1212 endif
1213 if $dietcurd @!% bC
1214 echo 15-4.err
1215 else
1216 echo 15-4.ok
1217 endif
1218 if $dietcurd =% Cd
1219 echo 16.err
1220 else
1221 echo 16.ok
1222 endif
1223 if $dietcurd !% Cd
1224 echo 17.ok
1225 else
1226 echo 17.err
1227 endif
1228 set diet=abc curd=abc
1229 if $diet == $curd
1230 echo 18.ok
1231 else
1232 echo 18.err
1233 endif
1234 set diet=abc curd=abcd
1235 if $diet != $curd
1236 echo 19.ok
1237 else
1238 echo 19.err
1239 endif
1240 # 1. Shitty grouping capabilities as of today
1241 unset diet curd ndefined
1242 if [ [ false ] || [ false ] || [ true ] ] && [ [ false ] || [ true ] ] && \
1243 [ yes ]
1244 echo 20.ok
1245 else
1246 echo 20.err
1247 endif
1248 if [ [ [ [ 0 ] || [ 1 ] ] && [ [ 1 ] || [ 0 ] ] ] && [ 1 ] ] && [ yes ]
1249 echo 21.ok
1250 else
1251 echo 21.err
1252 endif
1253 if [ [ 1 ] || [ 0 ] || [ 0 ] || [ 0 ] ]
1254 echo 22.ok
1255 else
1256 echo 22.err
1257 endif
1258 if [ [ 1 ] || [ 0 ] || [ 0 ] || [ 0 ] || [ [ 1 ] ] ]
1259 echo 23.ok
1260 else
1261 echo 23.err
1262 endif
1263 if [ [ 1 ] || [ 0 ] || [ 0 ] || [ 0 ] || [ [ 1 ] ] || [ 1 ] ] && [ no ]
1264 echo 24.err
1265 else
1266 echo 24.ok
1267 endif
1268 if [ [ 1 ] || [ 0 ] || [ 0 ] || [ 0 ] || [ [ 1 ] ] || [ 1 ] ] \
1269 && [ no ] || [ yes ]
1270 echo 25.ok
1271 else
1272 echo 25.err
1273 endif
1274 if [ [ [ [ [ [ [ 1 ] ] && [ 1 ] ] && [ 1 ] ] && [ 1 ] ] ] && [ 1 ] ]
1275 echo 26.ok
1276 else
1277 echo 26.err
1278 endif
1279 if [ [ [ [ [ [ [ 1 ] ] && [ 1 ] ] && [ 1 ] ] && [ 1 ] ] ] && [ 0 ] ]
1280 echo 27.err
1281 else
1282 echo 27.ok
1283 endif
1284 if [ [ [ [ [ [ [ 1 ] ] && [ 1 ] ] && [ 0 ] ] && [ 1 ] ] ] && [ 1 ] ]
1285 echo 28.err
1286 else
1287 echo 28.ok
1288 endif
1289 if [ [ [ [ [ [ [ 0 ] ] && [ 1 ] ] && [ 1 ] ] && [ 1 ] ] ] && [ 1 ] ]
1290 echo 29.err
1291 else
1292 echo 29.ok
1293 endif
1294 if [ 1 ] || [ 0 ] || [ 0 ] || [ 0 ] && [ 0 ]
1295 echo 30.err
1296 else
1297 echo 30.ok
1298 endif
1299 if [ 1 ] || [ 0 ] || [ 0 ] || [ 0 ] && [ 1 ]
1300 echo 31.ok
1301 else
1302 echo 31.err
1303 endif
1304 if [ 0 ] || [ 0 ] || [ 0 ] || [ 1 ] && [ 0 ]
1305 echo 32.err
1306 else
1307 echo 32.ok
1308 endif
1309 if [ 0 ] || [ 0 ] || [ 0 ] || [ 1 ] && [ 1 ]
1310 echo 33.ok
1311 else
1312 echo 33.err
1313 endif
1314 if [ 0 ] || [ 0 ] || [ 0 ] || [ 1 ] && [ 0 ] || [ 1 ] && [ 0 ]
1315 echo 34.err
1316 else
1317 echo 34.ok
1318 endif
1319 if [ 0 ] || [ 0 ] || [ 0 ] || [ 1 ] && [ 0 ] || [ 1 ] && [ 1 ]
1320 echo 35.ok
1321 else
1322 echo 35.err
1323 endif
1324 set diet=yo curd=ho
1325 if [ [ $diet == 'yo' ] && [ $curd == 'ho' ] ] && [ $ndefined ]
1326 echo 36.err
1327 else
1328 echo 36.ok
1329 endif
1330 set ndefined
1331 if [ [ $diet == 'yo' ] && [ $curd == 'ho' ] ] && [ $ndefined ]
1332 echo 37.ok
1333 else
1334 echo 37.err
1335 endif
1336 # 2. Shitty grouping capabilities as of today
1337 unset diet curd ndefined
1338 if [ false || false || true ] && [ false || true ] && yes
1339 echo 40.ok
1340 else
1341 echo 40.err
1342 endif
1343 if [ [ [ 0 || 1 ] && [ 1 || 0 ] ] && 1 ] && [ yes ]
1344 echo 41.ok
1345 else
1346 echo 41.err
1347 endif
1348 if [ 1 || 0 || 0 || 0 ]
1349 echo 42.ok
1350 else
1351 echo 42.err
1352 endif
1353 if [ 1 || 0 || 0 || 0 || [ 1 ] ]
1354 echo 43.ok
1355 else
1356 echo 43.err
1357 endif
1358 if [ 1 || 0 || 0 || 0 || [ 1 ] || 1 ] && no
1359 echo 44.err
1360 else
1361 echo 44.ok
1362 endif
1363 if [ 1 || 0 || 0 || 0 || 1 || [ 1 ] ] && no || [ yes ]
1364 echo 45.ok
1365 else
1366 echo 45.err
1367 endif
1368 if [ [ [ [ [ [ 1 ] && 1 ] && 1 ] && 1 ] ] && [ 1 ] ]
1369 echo 46.ok
1370 else
1371 echo 46.err
1372 endif
1373 if [ [ [ [ [ [ 1 ] && 1 ] && 1 ] && [ 1 ] ] ] && 0 ]
1374 echo 47.err
1375 else
1376 echo 47.ok
1377 endif
1378 if [ [ [ [ [ [ [ 1 ] ] && 1 ] && 0 ] && [ 1 ] ] ] && 1 ]
1379 echo 48.err
1380 else
1381 echo 48.ok
1382 endif
1383 if [ [ [ [ [ [ 0 ] && 1 ] && 1 ] && 1 ] ] && 1 ]
1384 echo 49.err
1385 else
1386 echo 49.ok
1387 endif
1388 if 1 || 0 || 0 || 0 && 0
1389 echo 50.err
1390 else
1391 echo 50.ok
1392 endif
1393 if 1 || 0 || 0 || 0 && 1
1394 echo 51.ok
1395 else
1396 echo 51.err
1397 endif
1398 if 0 || 0 || 0 || 1 && 0
1399 echo 52.err
1400 else
1401 echo 52.ok
1402 endif
1403 if 0 || 0 || 0 || 1 && 1
1404 echo 53.ok
1405 else
1406 echo 53.err
1407 endif
1408 if 0 || 0 || 0 || 1 && 0 || 1 && 0
1409 echo 54.err
1410 else
1411 echo 54.ok
1412 endif
1413 if 0 || 0 || 0 || 1 && 0 || 1 && 1
1414 echo 55.ok
1415 else
1416 echo 55.err
1417 endif
1418 set diet=yo curd=ho
1419 if [ $diet == 'yo' && $curd == 'ho' ] && $ndefined
1420 echo 56.err
1421 else
1422 echo 56.ok
1423 endif
1424 if $diet == 'yo' && $curd == 'ho' && $ndefined
1425 echo 57.err
1426 else
1427 echo 57.ok
1428 endif
1429 set ndefined
1430 if [ $diet == 'yo' && $curd == 'ho' ] && $ndefined
1431 echo 57.ok
1432 else
1433 echo 57.err
1434 endif
1435 if $diet == 'yo' && $curd == 'ho' && $ndefined
1436 echo 58.ok
1437 else
1438 echo 58.err
1439 endif
1440 if [ [ [ [ [ [ $diet == 'yo' && $curd == 'ho' && $ndefined ] ] ] ] ] ]
1441 echo 59.ok
1442 else
1443 echo 59.err
1444 endif
1445 # Some more en-braced variables
1446 set diet=yo curd=ho
1447 if ${diet} == ${curd}
1448 echo 70.err
1449 else
1450 echo 70.ok
1451 endif
1452 if ${diet} != ${curd}
1453 echo 71.ok
1454 else
1455 echo 71.err
1456 endif
1457 if $diet == ${curd}
1458 echo 72.err
1459 else
1460 echo 72.ok
1461 endif
1462 if ${diet} == $curd
1463 echo 73.err
1464 else
1465 echo 73.ok
1466 endif
1467 # Unary !
1468 if ! 0 && ! ! 1 && ! ! ! ! 2 && 3
1469 echo 80.ok
1470 else
1471 echo 80.err
1472 endif
1473 if ! 0 && ! [ ! 1 ] && ! [ ! [ ! [ ! 2 ] ] ] && 3
1474 echo 81.ok
1475 else
1476 echo 81.err
1477 endif
1478 if [ ! 0 ] && [ ! [ ! 1 ] ] && [ ! [ ! [ ! [ ! [ 2 ] ] ] ] ] && 3
1479 echo 82.ok
1480 else
1481 echo 82.err
1482 endif
1483 if [ ! 0 ] && [ ! [ ! 1 ] ] && [ ! [ ! [ ! [ ! [ 2 ] ] ] ] ] && ! 3
1484 echo 83.err
1485 else
1486 echo 83.ok
1487 endif
1488 if [ ! 0 ] && [ ! [ ! 1 ] ] && ! [ [ ! [ ! [ ! [ 2 ] ] ] ] ] && ! 3
1489 echo 84.err
1490 else
1491 echo 84.ok
1492 endif
1493 if [ ! 0 ] && ! [ ! [ ! 1 ] ] && [ ! [ ! [ ! [ ! [ 2 ] ] ] ] ] && 3
1494 echo 85.err
1495 else
1496 echo 85.ok
1497 endif
1498 if ! [ ! 0 ] && [ ! [ ! 1 ] ] && [ ! [ ! [ ! [ ! [ 2 ] ] ] ] ] && 3
1499 echo 86.err
1500 else
1501 echo 86.ok
1502 endif
1503 if [ ! 0 ] && [ ! [ ! 1 ] ] && [ ! [ ! [ ! [ ! [ 2 ] ] ] ] ] || 3
1504 echo 87.ok
1505 else
1506 echo 87.err
1507 endif
1508 if [ ! 0 ] && [ ! ! [ ! ! 1 ] ] && [ ! ! [ ! ! [ ! ! [ ! ! [ 2 ] ] ] ] ]
1509 echo 88.ok
1510 else
1511 echo 88.err
1512 endif
1513 # Unary !, odd
1514 if ! 0 && ! ! 1 && ! ! ! 0 && 3
1515 echo 90.ok
1516 else
1517 echo 90.err
1518 endif
1519 if ! 0 && ! [ ! 1 ] && ! [ ! [ ! [ 0 ] ] ] && 3
1520 echo 91.ok
1521 else
1522 echo 91.err
1523 endif
1524 if [ ! 0 ] && [ ! [ ! 1 ] ] && [ ! [ ! [ ! [ [ 0 ] ] ] ] ] && 3
1525 echo 92.ok
1526 else
1527 echo 92.err
1528 endif
1529 if [ ! 0 ] && [ ! [ ! 1 ] ] && [ ! [ ! ! [ ! [ ! 0 ] ] ] ] && ! 3
1530 echo 93.err
1531 else
1532 echo 93.ok
1533 endif
1534 if [ ! 0 ] && [ ! [ ! 1 ] ] && ! [ ! [ ! [ ! [ ! 0 ] ] ] ] && 3
1535 echo 94.ok
1536 else
1537 echo 94.err
1538 endif
1539 if [ ! 0 ] && ! [ ! [ ! 1 ] ] && [ ! ! [ ! [ ! [ ! [ 0 ] ] ] ] ] && 3
1540 echo 95.err
1541 else
1542 echo 95.ok
1543 endif
1544 if ! [ ! 0 ] && [ ! [ ! 1 ] ] && [ ! [ ! [ ! [ ! ! 0 ] ] ] ] && 3
1545 echo 96.err
1546 else
1547 echo 96.ok
1548 endif
1549 if [ ! 0 ] && [ ! [ ! 1 ] ] && [ ! [ ! [ ! [ ! [ ! 0 ] ] ] ] ] || 3
1550 echo 97.ok
1551 else
1552 echo 97.err
1553 endif
1554 if [ ! 0 ] && [ ! ! [ ! ! 1 ] ] && [ ! ! [ ! ! [ ! ! [ ! [ 0 ] ] ] ] ]
1555 echo 98.ok
1556 else
1557 echo 98.err
1558 endif
1559 __EOT
1561 check normal 0 "${MBOX}" '1688759742 719'
1563 if have_feat regex; then
1564 ${cat} <<- '__EOT' | ${MAILX} ${ARGS} > "${MBOX}"
1565 set dietcurd=yoho
1566 if $dietcurd =~ '^yo.*'
1567 echo 1.ok
1568 else
1569 echo 1.err
1570 endif
1571 if $dietcurd =~ '^Yo.*'
1572 echo 1-1.err
1573 else
1574 echo 1-1.ok
1575 endif
1576 if $dietcurd @=~ '^Yo.*'
1577 echo 1-2.ok
1578 else
1579 echo 1-2.err
1580 endif
1581 if $dietcurd =~ '^yOho.+'
1582 echo 2.err
1583 else
1584 echo 2.ok
1585 endif
1586 if $dietcurd @!~ '.*Ho$'
1587 echo 3.err
1588 else
1589 echo 3.ok
1590 endif
1591 if $dietcurd !~ '.+yohO$'
1592 echo 4.ok
1593 else
1594 echo 4.err
1595 endif
1596 if [ $dietcurd @i!~ '.+yoho$' ]
1597 echo 5.ok
1598 else
1599 echo 5.err
1600 endif
1601 if ! [ $dietcurd @i=~ '.+yoho$' ]
1602 echo 6.ok
1603 else
1604 echo 6.err
1605 endif
1606 if ! ! [ $dietcurd @i!~ '.+yoho$' ]
1607 echo 7.ok
1608 else
1609 echo 7.err
1610 endif
1611 if ! [ ! [ $dietcurd @i!~ '.+yoho$' ] ]
1612 echo 8.ok
1613 else
1614 echo 8.err
1615 endif
1616 if [ ! [ ! [ $dietcurd @i!~ '.+yoho$' ] ] ]
1617 echo 9.ok
1618 else
1619 echo 9.err
1620 endif
1621 if ! [ ! [ ! [ $dietcurd !~ '.+yoho$' ] ] ]
1622 echo 10.err
1623 else
1624 echo 10.ok
1625 endif
1626 if ! ! ! $dietcurd !~ '.+yoho$'
1627 echo 11.err
1628 else
1629 echo 11.ok
1630 endif
1631 if ! ! ! $dietcurd =~ '.+yoho$'
1632 echo 12.ok
1633 else
1634 echo 12.err
1635 endif
1636 if ! [ ! ! [ ! [ $dietcurd !~ '.+yoho$' ] ] ]
1637 echo 13.ok
1638 else
1639 echo 13.err
1640 endif
1641 set diet=abc curd='^abc$'
1642 if $diet =~ $curd
1643 echo 14.ok
1644 else
1645 echo 14.err
1646 endif
1647 set diet=abc curd='^abcd$'
1648 if $diet !~ $curd
1649 echo 15.ok
1650 else
1651 echo 15.err
1652 endif
1653 __EOT
1655 check regex 0 "${MBOX}" '1115671789 95'
1656 else
1657 printf 'if-regex: unsupported, skipped\n'
1660 t_epilog
1663 t_localopts() {
1664 t_prolog localopts
1666 # Nestable conditions test
1667 ${cat} <<- '__EOT' | ${MAILX} ${ARGS} > "${MBOX}" 2>&1
1668 define t2 {
1669 echo in: t2
1670 set t2=t2
1671 echo $t2
1673 define t1 {
1674 echo in: t1
1675 set gv1=gv1
1676 localopts on
1677 set lv1=lv1 lv2=lv2
1678 set lv3=lv3
1679 call t2
1680 localopts off
1681 set gv2=gv2
1682 echo $gv1 $lv1 ${lv2} ${lv3} ${gv2}, $t2
1684 define t0 {
1685 echo in: t0
1686 call t1
1687 echo $gv1 $lv1 ${lv2} ${lv3} ${gv2}, $t2
1688 echo "$gv1 $lv1 ${lv2} ${lv3} ${gv2}, $t2"
1690 account trouble {
1691 echo in: trouble
1692 call t0
1694 call t0
1695 unset gv1 gv2
1696 account trouble
1697 echo active trouble: $gv1 $lv1 ${lv2} ${lv3} ${gv2}, $t3
1698 account null
1699 echo active null: $gv1 $lv1 ${lv2} ${lv3} ${gv2}, $t3
1702 define ll2 {
1703 localopts $1
1704 set x=2
1705 echo ll2=$x
1707 define ll1 {
1708 wysh set y=$1; shift; eval localopts $y; localopts $1; shift
1709 set x=1
1710 echo ll1.1=$x
1711 call ll2 $1
1712 echo ll1.2=$x
1714 define ll0 {
1715 wysh set y=$1; shift; eval localopts $y; localopts $1; shift
1716 set x=0
1717 echo ll0.1=$x
1718 call ll1 $y "$@"
1719 echo ll0.2=$x
1721 define llx {
1722 echo ----- $1: $2 -> $3 -> $4
1723 echo ll-1.1=$x
1724 eval localopts $1
1725 call ll0 "$@"
1726 echo ll-1.2=$x
1727 unset x
1729 define lly {
1730 call llx 'call off' on on on
1731 call llx 'call off' off on on
1732 call llx 'call off' on off on
1733 call llx 'call off' on off off
1734 localopts call-fixate on
1735 call llx 'call-fixate on' on on on
1736 call llx 'call-fixate on' off on on
1737 call llx 'call-fixate on' on off on
1738 call llx 'call-fixate on' on off off
1739 unset x;localopts call on
1740 call llx 'call on' on on on
1741 call llx 'call on' off on on
1742 call llx 'call on' on off on
1743 call llx 'call on' on off off
1745 call lly
1746 __EOT
1748 check 1 0 "${MBOX}" '4016155249 1246'
1750 t_epilog
1753 t_local() {
1754 t_prolog local
1756 ${cat} <<- '__EOT' | ${MAILX} ${ARGS} > "${MBOX}" 2>&1
1757 define du2 {
1758 echo du2-1 du=$du
1759 local set du=$1
1760 echo du2-2 du=$du
1761 local unset du
1762 echo du2-3 du=$du
1764 define du {
1765 local set du=dudu
1766 echo du-1 du=$du
1767 call du2 du2du2
1768 echo du-2 du=$du
1769 local set nodu
1770 echo du-3 du=$du
1772 define ich {
1773 echo ich-1 du=$du
1774 call du
1775 echo ich-2 du=$du
1777 define wir {
1778 localopts $1
1779 set du=wirwir
1780 echo wir-1 du=$du
1781 call ich
1782 echo wir-2 du=$du
1784 echo ------- global-1 du=$du
1785 call ich
1786 echo ------- global-2 du=$du
1787 set du=global
1788 call ich
1789 echo ------- global-3 du=$du
1790 call wir on
1791 echo ------- global-4 du=$du
1792 call wir off
1793 echo ------- global-5 du=$du
1794 __EOT
1796 check 1 0 "${MBOX}" '2411598140 641'
1798 t_epilog
1801 t_macro_param_shift() {
1802 t_prolog macro_param_shift
1804 ${cat} <<- '__EOT' | ${MAILX} ${ARGS} > "${MBOX}" 2>>${ERR}
1805 define t2 {
1806 echo in: t2
1807 echo t2.0 has $#/${#} parameters: "$1,${2},$3" (${*}) [$@]
1808 localopts on
1809 wysh set ignerr=$1
1810 shift
1811 localopts off
1812 echo t2.1 has $#/${#} parameters: "$1,${2},$3" (${*}) [$@]
1813 if [ $# > 1 ] || [ $ignerr == '' ]
1814 shift 2
1815 else
1816 ignerr shift 2
1817 endif
1818 echo t2.2:$? has $#/${#} parameters: "$1,${2},$3" (${*}) [$@]
1819 shift 0
1820 echo t2.3:$? has $#/${#} parameters: "$1,${2},$3" (${*}) [$@]
1821 if [ $# > 0 ]
1822 shift
1823 endif
1824 echo t2.4:$? has $#/${#} parameters: "$1,${2},$3" (${*}) [$@]
1826 define t1 {
1827 set errexit
1828 echo in: t1
1829 call t2 1 you get four args
1830 echo t1.1: $?';' ignerr ($ignerr) should not exist
1831 call t2 1 you get 'three args'
1832 echo t1.2: $?';' ignerr ($ignerr) should not exist
1833 call t2 1 you 'get two args'
1834 echo t1.3: $?';' ignerr ($ignerr) should not exist
1835 call t2 1 'you get one arg'
1836 echo t1.4: $?';' ignerr ($ignerr) should not exist
1837 ignerr call t2 '' 'you get one arg'
1838 echo t1.5: $?';' ignerr ($ignerr) should not exist
1840 call t1
1841 __EOT
1843 check 1 0 "${MBOX}" '1402489146 1682'
1845 t_epilog
1848 t_addrcodec() {
1849 t_prolog addrcodec
1851 ${cat} <<- '__EOT' | ${MAILX} ${ARGS} > "${MBOX}" 2>&1
1852 vput addrcodec res e 1 <doog@def>
1853 echo $?/$^ERRNAME $res
1854 eval vput addrcodec res d $res
1855 echo $?/$^ERRNAME $res
1856 vput addrcodec res e 2 . <doog@def>
1857 echo $?/$^ERRNAME $res
1858 eval vput addrcodec res d $res
1859 echo $?/$^ERRNAME $res
1860 vput addrcodec res e 3 Sauer Dr. <doog@def>
1861 echo $?/$^ERRNAME $res
1862 eval vput addrcodec res d $res
1863 echo $?/$^ERRNAME $res
1864 vput addrcodec res e 3.50 Sauer (Ma) Dr. <doog@def>
1865 echo $?/$^ERRNAME $res
1866 eval vput addrcodec res d $res
1867 echo $?/$^ERRNAME $res
1868 vput addrcodec res e 3.51 Sauer (Ma) "Dr." <doog@def>
1869 echo $?/$^ERRNAME $res
1870 eval vput addrcodec res d $res
1871 echo $?/$^ERRNAME $res
1873 vput addrcodec res +e 4 Sauer (Ma) Dr. <doog@def>
1874 echo $?/$^ERRNAME $res
1875 eval vput addrcodec res d $res
1876 echo $?/$^ERRNAME $res
1877 vput addrcodec res +e 5 Sauer (Ma) Braten Dr. <doog@def>
1878 echo $?/$^ERRNAME $res
1879 eval vput addrcodec res d $res
1880 echo $?/$^ERRNAME $res
1881 vput addrcodec res +e 6 Sauer (Ma) Braten Dr. (Heu) <doog@def>
1882 echo $?/$^ERRNAME $res
1883 eval vput addrcodec res d $res
1884 echo $?/$^ERRNAME $res
1885 vput addrcodec res +e 7 Sauer (Ma) Braten Dr. (Heu) <doog@def> (bu)
1886 echo $?/$^ERRNAME $res
1887 eval vput addrcodec res d $res
1888 echo $?/$^ERRNAME $res
1889 vput addrcodec res +e 8 \
1890 Dr. Sauer (Ma) Braten Dr. (Heu) <doog@def> (bu) Boom. Boom
1891 echo $?/$^ERRNAME $res
1892 eval vput addrcodec res d $res
1893 echo $?/$^ERRNAME $res
1894 vput addrcodec res +e 9 Dr.Sauer(Ma)Braten Dr. (Heu) <doog@def>
1895 echo $?/$^ERRNAME $res
1896 eval vput addrcodec res d $res
1897 echo $?/$^ERRNAME $res
1898 vput addrcodec res +e 10 (Ma)Braten Dr. (Heu) <doog@def>
1899 echo $?/$^ERRNAME $res
1900 eval vput addrcodec res d $res
1901 echo $?/$^ERRNAME $res
1902 vput addrcodec res +e 11 (Ma)Braten Dr"." (Heu) <doog@def>
1903 echo $?/$^ERRNAME $res
1904 eval vput addrcodec res d $res
1905 echo $?/$^ERRNAME $res
1906 vput addrcodec res +e 12 Dr. Sauer (Ma) Braten Dr. (u) <doog@def>
1907 echo $?/$^ERRNAME $res
1908 eval vput addrcodec res d $res
1909 echo $?/$^ERRNAME $res
1910 vput addrcodec res +e 13(Ma)Braten Dr. (Heu) <doog@def>
1911 echo $?/$^ERRNAME $res
1912 eval vput addrcodec res d $res
1913 echo $?/$^ERRNAME $res
1914 vput addrcodec res +e 14 Hey, Du <doog@def> Wie() findet Dr. das? ()
1915 echo $?/$^ERRNAME $res
1916 eval vput addrcodec res d $res
1917 echo $?/$^ERRNAME $res
1918 vput addrcodec res +e 15 \
1919 Hey, Du <doog@def> Wie() findet "" Dr. "" das? ()
1920 echo $?/$^ERRNAME $res
1921 eval vput addrcodec res d $res
1922 echo $?/$^ERRNAME $res
1923 vput addrcodec res +e 16 \
1924 "Hey," "Du" <doog@def> "Wie()" findet "" Dr. "" das? ()
1925 echo $?/$^ERRNAME $res
1926 eval vput addrcodec res d $res
1927 echo $?/$^ERRNAME $res
1928 vput addrcodec res +e 17 \
1929 "Hey" Du <doog@def> "Wie() findet " " Dr. """ das? ()
1930 echo $?/$^ERRNAME $res
1931 eval vput addrcodec res d $res
1932 echo $?/$^ERRNAME $res
1933 vput addrcodec res +e 18 \
1934 <doog@def> "Hey" Du "Wie() findet " " Dr. """ das? ()
1935 echo $?/$^ERRNAME $res
1936 eval vput addrcodec res d $res
1937 echo $?/$^ERRNAME $res
1938 vput addrcodec res +e 19 Hey\,\" <doog@def> "Wie()" findet \" Dr. \" das?
1939 echo $?/$^ERRNAME $res
1940 eval vput addrcodec res d $res
1941 echo $?/$^ERRNAME $res
1943 vput addrcodec res ++e 20 Hey\,\" <doog@def> "Wie()" findet \" Dr. \" das?
1944 echo $?/$^ERRNAME $res
1945 vput addrcodec res ++e 21 Hey\,\"" <doog@def> "Wie()" findet \" Dr. \" das?
1946 echo $?/$^ERRNAME $res
1947 eval vput addrcodec res d $res
1948 echo $?/$^ERRNAME $res
1950 vput addrcodec res +++e 22 Hey\\,\" <doog@def> "Wie()" findet \" Dr. \" das?
1951 echo $?/$^ERRNAME $res
1952 eval vput addrcodec res d $res
1953 echo $?/$^ERRNAME $res
1955 vput addrcodec res s \
1956 "23 Hey\\,\\\" \"Wie" () "\" findet \\\" Dr. \\\" das?" <doog@def>
1957 echo $?/$^ERRNAME $res
1959 # Fix for [f3852f88]
1960 vput addrcodec res ++e <from2@exam.ple> 100 (comment) "Quot(e)d"
1961 echo $?/$^ERRNAME $res
1962 eval vput addrcodec res d $res
1963 echo $?/$^ERRNAME $res
1964 vput addrcodec res e <from2@exam.ple> 100 (comment) "Quot(e)d"
1965 echo $?/$^ERRNAME $res
1966 eval vput addrcodec res d $res
1967 echo $?/$^ERRNAME $res
1968 __EOT
1970 check 1 0 "${MBOX}" '1047317989 2612'
1972 ${cat} <<- '__EOT' | ${MAILX} ${ARGS} > "${MBOX}" 2>&1
1973 mlist isa1@list
1974 mlsubscribe isa2@list
1976 vput addrcodec res skin Hey\\,\" <isa0@list> "Wie()" find \" Dr. \" das?
1977 echo $?/$^ERRNAME $res
1978 vput addrcodec res skinlist Hey\\,\" <isa0@list> "Wie()" find \" Dr. \" das?
1979 echo $?/$^ERRNAME $res
1980 vput addrcodec res skin Hey\\,\" <isa1@list> "Wie()" find \" Dr. \" das?
1981 echo $?/$^ERRNAME $res
1982 vput addrcodec res skinlist Hey\\,\" <isa1@list> "Wie()" find \" Dr. \" das?
1983 echo $?/$^ERRNAME $res
1984 vput addrcodec res skin Hey\\,\" <isa2@list> "Wie()" find \" Dr. \" das?
1985 echo $?/$^ERRNAME $res
1986 vput addrcodec res skinlist Hey\\,\" <isa2@list> "Wie()" find \" Dr. \" das?
1987 echo $?/$^ERRNAME $res
1988 __EOT
1990 check 2 0 "${MBOX}" '1391779299 104'
1992 if have_feat idna; then
1993 ${cat} <<- '__EOT' | ${MAILX} ${ARGS} ${ADDARG_UNI} > "${MBOX}" 2>&1
1994 vput addrcodec res e (heu) <du@blödiän> "stroh" du
1995 echo $?/$^ERRNAME $res
1996 eval vput addrcodec res d $res
1997 echo $?/$^ERRNAME $res
1998 vput addrcodec res e <du@blödiän> du
1999 echo $?/$^ERRNAME $res
2000 eval vput addrcodec res d $res
2001 echo $?/$^ERRNAME $res
2002 vput addrcodec res e du <du@blödiän>
2003 echo $?/$^ERRNAME $res
2004 eval vput addrcodec res d $res
2005 echo $?/$^ERRNAME $res
2006 vput addrcodec res e <du@blödiän>
2007 echo $?/$^ERRNAME $res
2008 eval vput addrcodec res d $res
2009 echo $?/$^ERRNAME $res
2010 vput addrcodec res e du@blödiän
2011 echo $?/$^ERRNAME $res
2012 eval vput addrcodec res d $res
2013 echo $?/$^ERRNAME $res
2014 __EOT
2016 check idna 0 "${MBOX}" '498775983 326'
2017 else
2018 printf 'addrcodec-idna: unsupported, skipped\n'
2021 t_epilog
2024 t_vexpr() {
2025 t_prolog vexpr
2027 ${cat} <<- '__EOT' | ${MAILX} ${ARGS} > "${MBOX}" 2>>${ERR}
2028 echo ' #0.0'
2029 vput vexpr res = 9223372036854775807
2030 echo $?/$^ERRNAME $res
2031 vput vexpr res = 9223372036854775808
2032 echo $?/$^ERRNAME $res
2033 vput vexpr res = u9223372036854775808
2034 echo $?/$^ERRNAME $res
2035 vput vexpr res @= 9223372036854775808
2036 echo $?/$^ERRNAME $res
2037 vput vexpr res = -9223372036854775808
2038 echo $?/$^ERRNAME $res
2039 vput vexpr res = -9223372036854775809
2040 echo $?/$^ERRNAME $res
2041 vput vexpr res @= -9223372036854775809
2042 echo $?/$^ERRNAME $res
2043 vput vexpr res = U9223372036854775809
2044 echo $?/$^ERRNAME $res
2045 echo ' #0.1'
2046 vput vexpr res = \
2047 0b0111111111111111111111111111111111111111111111111111111111111111
2048 echo $?/$^ERRNAME $res
2049 vput vexpr res = \
2050 S0b1000000000000000000000000000000000000000000000000000000000000000
2051 echo $?/$^ERRNAME $res
2052 vput vexpr res @= \
2053 S0b1000000000000000000000000000000000000000000000000000000000000000
2054 echo $?/$^ERRNAME $res
2055 vput vexpr res = \
2056 U0b1000000000000000000000000000000000000000000000000000000000000000
2057 echo $?/$^ERRNAME $res
2058 vput vexpr res = \
2059 0b1000000000000000000000000000000000000000000000000000000000000000
2060 echo $?/$^ERRNAME $res
2061 vput vexpr res @= \
2062 0b1000000000000000000000000000000000000000000000000000000000000000
2063 echo $?/$^ERRNAME $res
2064 vput vexpr res = \
2065 -0b1000000000000000000000000000000000000000000000000000000000000000
2066 echo $?/$^ERRNAME $res
2067 vput vexpr res = \
2068 S0b1000000000000000000000000000000000000000000000000000000000000001
2069 echo $?/$^ERRNAME $res
2070 vput vexpr res @= \
2071 S0b1000000000000000000000000000000000000000000000000000000000000001
2072 echo $?/$^ERRNAME $res
2073 vput vexpr res @= \
2074 -0b1000000000000000000000000000000000000000000000000000000000000001
2075 echo $?/$^ERRNAME $res
2076 vput vexpr res = \
2077 U0b1000000000000000000000000000000000000000000000000000000000000001
2078 echo $?/$^ERRNAME $res
2079 echo ' #0.2'
2080 vput vexpr res = 0777777777777777777777
2081 echo $?/$^ERRNAME $res
2082 vput vexpr res = S01000000000000000000000
2083 echo $?/$^ERRNAME $res
2084 vput vexpr res @= S01000000000000000000000
2085 echo $?/$^ERRNAME $res
2086 vput vexpr res = U01000000000000000000000
2087 echo $?/$^ERRNAME $res
2088 vput vexpr res = 01000000000000000000000
2089 echo $?/$^ERRNAME $res
2090 vput vexpr res @= 01000000000000000000000
2091 echo $?/$^ERRNAME $res
2092 vput vexpr res = -01000000000000000000000
2093 echo $?/$^ERRNAME $res
2094 vput vexpr res = S01000000000000000000001
2095 echo $?/$^ERRNAME $res
2096 vput vexpr res @= S01000000000000000000001
2097 echo $?/$^ERRNAME $res
2098 vput vexpr res @= -01000000000000000000001
2099 echo $?/$^ERRNAME $res
2100 vput vexpr res = U01000000000000000000001
2101 echo $?/$^ERRNAME $res
2102 echo ' #0.3'
2103 vput vexpr res = 0x7FFFFFFFFFFFFFFF
2104 echo $?/$^ERRNAME $res
2105 vput vexpr res = S0x8000000000000000
2106 echo $?/$^ERRNAME $res
2107 vput vexpr res @= S0x8000000000000000
2108 echo $?/$^ERRNAME $res
2109 vput vexpr res = U0x8000000000000000
2110 echo $?/$^ERRNAME $res
2111 vput vexpr res = 0x8000000000000000
2112 echo $?/$^ERRNAME $res
2113 vput vexpr res @= 0x8000000000000000
2114 echo $?/$^ERRNAME $res
2115 vput vexpr res = -0x8000000000000000
2116 echo $?/$^ERRNAME $res
2117 vput vexpr res = S0x8000000000000001
2118 echo $?/$^ERRNAME $res
2119 vput vexpr res @= S0x8000000000000001
2120 echo $?/$^ERRNAME $res
2121 vput vexpr res @= -0x8000000000000001
2122 echo $?/$^ERRNAME $res
2123 vput vexpr res = u0x8000000000000001
2124 echo $?/$^ERRNAME $res
2125 echo ' #1'
2126 vput vexpr res ~ 0
2127 echo $?/$^ERRNAME $res
2128 vput vexpr res ~ 1
2129 echo $?/$^ERRNAME $res
2130 vput vexpr res ~ -1
2131 echo $?/$^ERRNAME $res
2132 echo ' #2'
2133 vput vexpr res + 0 0
2134 echo $?/$^ERRNAME $res
2135 vput vexpr res + 0 1
2136 echo $?/$^ERRNAME $res
2137 vput vexpr res + 1 1
2138 echo $?/$^ERRNAME $res
2139 echo ' #3'
2140 vput vexpr res + 9223372036854775807 0
2141 echo $?/$^ERRNAME $res
2142 vput vexpr res + 9223372036854775807 1
2143 echo $?/$^ERRNAME $res
2144 vput vexpr res @+ 9223372036854775807 1
2145 echo $?/$^ERRNAME $res
2146 vput vexpr res + 0 9223372036854775807
2147 echo $?/$^ERRNAME $res
2148 vput vexpr res + 1 9223372036854775807
2149 echo $?/$^ERRNAME $res
2150 vput vexpr res @+ 1 9223372036854775807
2151 echo $?/$^ERRNAME $res
2152 echo ' #4'
2153 vput vexpr res + -9223372036854775808 0
2154 echo $?/$^ERRNAME $res
2155 vput vexpr res + -9223372036854775808 -1
2156 echo $?/$^ERRNAME $res
2157 vput vexpr res @+ -9223372036854775808 -1
2158 echo $?/$^ERRNAME $res
2159 vput vexpr res + 0 -9223372036854775808
2160 echo $?/$^ERRNAME $res
2161 vput vexpr res + -1 -9223372036854775808
2162 echo $?/$^ERRNAME $res
2163 vput vexpr res @+ -1 -9223372036854775808
2164 echo $?/$^ERRNAME $res
2165 echo ' #5'
2166 vput vexpr res - 0 0
2167 echo $?/$^ERRNAME $res
2168 vput vexpr res - 0 1
2169 echo $?/$^ERRNAME $res
2170 vput vexpr res - 1 1
2171 echo $?/$^ERRNAME $res
2172 echo ' #6'
2173 vput vexpr res - 9223372036854775807 0
2174 echo $?/$^ERRNAME $res
2175 vput vexpr res - 9223372036854775807 -1
2176 echo $?/$^ERRNAME $res
2177 vput vexpr res @- 9223372036854775807 -1
2178 echo $?/$^ERRNAME $res
2179 vput vexpr res - 0 9223372036854775807
2180 echo $?/$^ERRNAME $res
2181 vput vexpr res - -1 9223372036854775807
2182 echo $?/$^ERRNAME $res
2183 vput vexpr res - -2 9223372036854775807
2184 echo $?/$^ERRNAME $res
2185 vput vexpr res @- -2 9223372036854775807
2186 echo $?/$^ERRNAME $res
2187 echo ' #7'
2188 vput vexpr res - -9223372036854775808 +0
2189 echo $?/$^ERRNAME $res
2190 vput vexpr res - -9223372036854775808 +1
2191 echo $?/$^ERRNAME $res
2192 vput vexpr res @- -9223372036854775808 +1
2193 echo $?/$^ERRNAME $res
2194 vput vexpr res - 0 -9223372036854775808
2195 echo $?/$^ERRNAME $res
2196 vput vexpr res - +1 -9223372036854775808
2197 echo $?/$^ERRNAME $res
2198 vput vexpr res @- +1 -9223372036854775808
2199 echo $?/$^ERRNAME $res
2200 echo ' #8'
2201 vput vexpr res + -13 -2
2202 echo $?/$^ERRNAME $res
2203 vput vexpr res - 0 0
2204 echo $?/$^ERRNAME $res
2205 vput vexpr res - 0 1
2206 echo $?/$^ERRNAME $res
2207 vput vexpr res - 1 1
2208 echo $?/$^ERRNAME $res
2209 vput vexpr res - -13 -2
2210 echo $?/$^ERRNAME $res
2211 echo ' #9'
2212 vput vexpr res * 0 0
2213 echo $?/$^ERRNAME $res
2214 vput vexpr res * 0 1
2215 echo $?/$^ERRNAME $res
2216 vput vexpr res * 1 1
2217 echo $?/$^ERRNAME $res
2218 vput vexpr res * -13 -2
2219 echo $?/$^ERRNAME $res
2220 echo ' #10'
2221 vput vexpr res / 0 0
2222 echo $?/$^ERRNAME $res
2223 vput vexpr res / 0 1
2224 echo $?/$^ERRNAME $res
2225 vput vexpr res / 1 1
2226 echo $?/$^ERRNAME $res
2227 vput vexpr res / -13 -2
2228 echo $?/$^ERRNAME $res
2229 echo ' #11'
2230 vput vexpr res % 0 0
2231 echo $?/$^ERRNAME $res
2232 vput vexpr res % 0 1
2233 echo $?/$^ERRNAME $res
2234 vput vexpr res % 1 1
2235 echo $?/$^ERRNAME $res
2236 vput vexpr res % -13 -2
2237 echo $?/$^ERRNAME $res
2238 __EOT
2240 check numeric 0 "${MBOX}" '960821755 1962'
2242 ${cat} <<- '__EOT' | ${MAILX} ${ARGS} > "${MBOX}" 2>&1
2243 vput vexpr res find 'bananarama' 'nana'
2244 echo $?/$^ERRNAME :$res:
2245 vput vexpr res find 'bananarama' 'bana'
2246 echo $?/$^ERRNAME :$res:
2247 vput vexpr res find 'bananarama' 'Bana'
2248 echo $?/$^ERRNAME :$res:
2249 vput vexpr res find 'bananarama' 'rama'
2250 echo $?/$^ERRNAME :$res:
2251 echo ' #1'
2252 vput vexpr res ifind 'bananarama' 'nana'
2253 echo $?/$^ERRNAME :$res:
2254 vput vexpr res ifind 'bananarama' 'bana'
2255 echo $?/$^ERRNAME :$res:
2256 vput vexpr res ifind 'bananarama' 'Bana'
2257 echo $?/$^ERRNAME :$res:
2258 vput vexpr res ifind 'bananarama' 'rama'
2259 echo $?/$^ERRNAME :$res:
2260 echo ' #2'
2261 vput vexpr res substring 'bananarama' 1
2262 echo $?/$^ERRNAME :$res:
2263 vput vexpr res substring 'bananarama' 3
2264 echo $?/$^ERRNAME :$res:
2265 vput vexpr res substring 'bananarama' 5
2266 echo $?/$^ERRNAME :$res:
2267 vput vexpr res substring 'bananarama' 7
2268 echo $?/$^ERRNAME :$res:
2269 vput vexpr res substring 'bananarama' 9
2270 echo $?/$^ERRNAME :$res:
2271 vput vexpr res substring 'bananarama' 10
2272 echo $?/$^ERRNAME :$res:
2273 vput vexpr res substring 'bananarama' 1 3
2274 echo $?/$^ERRNAME :$res:
2275 vput vexpr res substring 'bananarama' 3 3
2276 echo $?/$^ERRNAME :$res:
2277 vput vexpr res substring 'bananarama' 5 3
2278 echo $?/$^ERRNAME :$res:
2279 vput vexpr res substring 'bananarama' 7 3
2280 echo $?/$^ERRNAME :$res:
2281 vput vexpr res substring 'bananarama' 9 3
2282 echo $?/$^ERRNAME :$res:
2283 vput vexpr res substring 'bananarama' 10 3
2284 echo $?/$^ERRNAME :$res:
2285 echo ' #3'
2286 vput vexpr res substring 'bananarama' -1
2287 echo $?/$^ERRNAME :$res:
2288 vput vexpr res substring 'bananarama' -3
2289 echo $?/$^ERRNAME :$res:
2290 vput vexpr res substring 'bananarama' -5
2291 echo $?/$^ERRNAME :$res:
2292 vput vexpr res substring 'bananarama' -7
2293 echo $?/$^ERRNAME :$res:
2294 vput vexpr res substring 'bananarama' -9
2295 echo $?/$^ERRNAME :$res:
2296 vput vexpr res substring 'bananarama' -10
2297 echo $?/$^ERRNAME :$res:
2298 vput vexpr res substring 'bananarama' 1 -3
2299 echo $?/$^ERRNAME :$res:
2300 vput vexpr res substring 'bananarama' 3 -3
2301 echo $?/$^ERRNAME :$res:
2302 vput vexpr res substring 'bananarama' 5 -3
2303 echo $?/$^ERRNAME :$res:
2304 vput vexpr res substring 'bananarama' 7 -3
2305 echo $?/$^ERRNAME :$res:
2306 vput vexpr res substring 'bananarama' 9 -3
2307 echo $?/$^ERRNAME :$res:
2308 vput vexpr res substring 'bananarama' 10 -3
2309 echo $?/$^ERRNAME :$res:
2310 echo ' #4'
2311 vput vexpr res trim 'Cocoon Cocoon'
2312 echo $?/$^ERRNAME :$res:
2313 vput vexpr res trim ' Cocoon Cocoon '
2314 echo $?/$^ERRNAME :$res:
2315 vput vexpr res trim-front 'Cocoon Cocoon'
2316 echo $?/$^ERRNAME :$res:
2317 vput vexpr res trim-front ' Cocoon Cocoon '
2318 echo $?/$^ERRNAME :$res:
2319 vput vexpr res trim-end 'Cocoon Cocoon'
2320 echo $?/$^ERRNAME :$res:
2321 vput vexpr res trim-end ' Cocoon Cocoon '
2322 echo $?/$^ERRNAME :$res:
2323 __EOT
2325 check string 0 "${MBOX}" '3182004322 601'
2327 if have_feat regex; then
2328 ${cat} <<- '__EOT' | ${MAILX} ${ARGS} > "${MBOX}" 2>&1
2329 vput vexpr res regex 'bananarama' 'nana'
2330 echo $?/$^ERRNAME :$res:
2331 vput vexpr res regex 'bananarama' 'bana'
2332 echo $?/$^ERRNAME :$res:
2333 vput vexpr res regex 'bananarama' 'Bana'
2334 echo $?/$^ERRNAME :$res:
2335 vput vexpr res regex 'bananarama' 'rama'
2336 echo $?/$^ERRNAME :$res:
2337 echo ' #1'
2338 vput vexpr res iregex 'bananarama' 'nana'
2339 echo $?/$^ERRNAME :$res:
2340 vput vexpr res iregex 'bananarama' 'bana'
2341 echo $?/$^ERRNAME :$res:
2342 vput vexpr res iregex 'bananarama' 'Bana'
2343 echo $?/$^ERRNAME :$res:
2344 vput vexpr res iregex 'bananarama' 'rama'
2345 echo $?/$^ERRNAME :$res:
2346 echo ' #2'
2347 vput vexpr res regex 'bananarama' '(.*)nana(.*)' '\${1}a\${0}u{\$2}'
2348 echo $?/$^ERRNAME :$res:
2349 vput vexpr res regex 'bananarama' '(.*)bana(.*)' '\${1}a\${0}u\$2'
2350 echo $?/$^ERRNAME :$res:
2351 vput vexpr res regex 'bananarama' 'Bana(.+)' '\$1\$0'
2352 echo $?/$^ERRNAME :$res:
2353 vput vexpr res regex 'bananarama' '(.+)rama' '\$1\$0'
2354 echo $?/$^ERRNAME :$res:
2355 echo ' #3'
2356 vput vexpr res iregex 'bananarama' '(.*)nana(.*)' '\${1}a\${0}u{\$2}'
2357 echo $?/$^ERRNAME :$res:
2358 vput vexpr res iregex 'bananarama' '(.*)bana(.*)' '\${1}a\${0}u\$2'
2359 echo $?/$^ERRNAME :$res:
2360 vput vexpr res iregex 'bananarama' 'Bana(.+)' '\$1\$0'
2361 echo $?/$^ERRNAME :$res:
2362 vput vexpr res iregex 'bananarama' '(.+)rama' '\$1\$0'
2363 echo $?/$^ERRNAME :$res:
2364 echo ' #4'
2365 __EOT
2367 check regex 0 "${MBOX}" '3270360157 311'
2368 else
2369 printf 'vexpr-regex: unsupported, skipped\n'
2372 t_epilog
2375 t_call_ret() {
2376 t_prolog call_ret
2378 ${cat} <<- '__EOT' | ${MAILX} ${ARGS} -Snomemdebug > "${MBOX}" 2>&1
2379 define w1 {
2380 echon ">$1 "
2381 vput vexpr i + $1 1
2382 if [ $i -le 42 ]
2383 vput vexpr j '&' $i 7
2384 if [ $j -eq 7 ]
2385 echo .
2387 call w1 $i
2388 wysh set i=$? k=$!
2389 vput vexpr j '&' $i 7
2390 echon "<$1/$i/$k "
2391 if [ $j -eq 7 ]
2392 echo .
2394 else
2395 echo ! The end for $1
2397 return $1
2399 # Transport $?/$! up the call chain
2400 define w2 {
2401 echon ">$1 "
2402 vput vexpr i + $1 1
2403 if [ $1 -lt 42 ]
2404 call w2 $i
2405 wysh set i=$? j=$! k=$^ERRNAME
2406 echon "<$1/$i/$k "
2407 return $i $j
2408 else
2409 echo ! The end for $1
2410 return $i $^ERR-BUSY
2412 echoerr au
2414 # Up and down it goes
2415 define w3 {
2416 echon ">$1/$2 "
2417 vput vexpr i + $1 1
2418 if [ $1 -lt 42 ]
2419 call w3 $i $2
2420 wysh set i=$? j=$!
2421 vput vexpr k - $1 $2
2422 if [ $k -eq 21 ]
2423 vput vexpr i + $1 1
2424 vput vexpr j + $2 1
2425 echo "# <$i/$j> .. "
2426 call w3 $i $j
2427 wysh set i=$? j=$!
2429 eval echon "<\$1=\$i/\$^ERRNAME-$j "
2430 return $i $j
2431 else
2432 echo ! The end for $1=$i/$2
2433 if [ "$2" != "" ]
2434 return $i $^ERR-DOM
2435 else
2436 return $i $^ERR-BUSY
2439 echoerr au
2442 call w1 0; echo ?=$? !=$!; echo -----;
2443 call w2 0; echo ?=$? !=$^ERRNAME; echo -----;
2444 call w3 0 1; echo ?=$? !=$^ERRNAME; echo -----;
2445 __EOT
2447 check 1 0 "${MBOX}" '1572045517 5922'
2449 t_epilog
2452 t_xcall() {
2453 t_prolog xcall
2455 ${cat} <<- '__EOT' | ${MAILX} ${ARGS} -Snomemdebug > "${MBOX}" 2>&1
2456 define work {
2457 echon "$1 "
2458 vput vexpr i + $1 1
2459 if [ $i -le 1111 ]
2460 vput vexpr j '&' $i 7
2461 if [ $j -eq 7 ]
2462 echo .
2464 \xcall work $i $2
2466 echo ! The end for $1/$2
2467 if [ "$2" != "" ]
2468 return $i $^ERR-BUSY
2471 define xwork {
2472 \xcall work 0 $2
2474 call work 0
2475 echo ?=$? !=$!
2476 call xwork
2477 echo ?=$? !=$!
2478 xcall xwork
2479 echo ?=$? !=$^ERRNAME
2481 call work 0 yes
2482 echo ?=$? !=$^ERRNAME
2483 call xwork 0 yes
2484 echo ?=$? !=$^ERRNAME
2485 __EOT
2487 check 1 0 "${MBOX}" '2401702082 23801'
2491 if have_feat uistrings; then
2492 ${cat} <<- '__EOT' > "${BODY}"
2493 define __w {
2494 echon "$1 "
2495 vput vexpr i + $1 1
2496 if [ $i -le 111 ]
2497 vput vexpr j '&' $i 7
2498 if [ $j -eq 7 ]
2499 echo .
2501 \xcall __w $i $2
2503 echo ! The end for $1
2504 if [ $2 -eq 0 ]
2505 nonexistingcommand
2506 echo would be err with errexit
2507 return
2509 echo calling exit
2510 exit
2512 define work {
2513 echo eins
2514 call __w 0 0
2515 echo zwei, ?=$? !=$!
2516 localopts yes; set errexit
2517 ignerr call __w 0 0
2518 echo drei, ?=$? !=$^ERRNAME
2519 call __w 0 $1
2520 echo vier, ?=$? !=$^ERRNAME, this is an error
2522 ignerr call work 0
2523 echo outer 1, ?=$? !=$^ERRNAME
2524 xxxign call work 0
2525 echo outer 2, ?=$? !=$^ERRNAME, could be error if xxxign non-empty
2526 call work 1
2527 echo outer 3, ?=$? !=$^ERRNAME
2528 echo this is definitely an error
2529 __EOT
2531 < "${BODY}" ${MAILX} ${ARGS} -X'commandalias xxxign ignerr' \
2532 -Snomemdebug > "${MBOX}" 2>&1
2533 check 2 0 "${MBOX}" '3900716531 4200'
2535 < "${BODY}" ${MAILX} ${ARGS} -X'commandalias xxxign " "' \
2536 -Snomemdebug > "${MBOX}" 2>&1
2537 check 3 1 "${MBOX}" '1006776201 2799'
2538 else
2539 echo 'xcall-2: unsupported, skipped'
2540 echo 'xcall-3: unsupported, skipped'
2543 t_epilog
2546 t_vpospar() {
2547 t_prolog vpospar
2549 ${cat} <<- '__EOT' | ${MAILX} ${ARGS} > "${MBOX}" 2>&1
2550 vpospar set hey, "'you ", world!
2551 echo $?/$^ERRNAME/$#: $* / "$@" / <$1><$2><$3><$4>
2552 vput vpospar x quote; echo x<$x>
2553 vpospar clear;echo $?/$^ERRNAME/$#: $* / "$@" / <$1><$2><$3><$4>
2554 vput vpospar y quote;echo y<$y>
2555 eval vpospar set ${x};echo $?/$^ERRNAME/$#: $* / "$@" / <$1><$2><$3><$4>
2556 eval vpospar set ${y};echo $?/$^ERRNAME/$#: $* / "$@" / <$1><$2><$3><$4>
2557 eval vpospar set ${x};echo $?/$^ERRNAME/$#: $* / "$@" / <$1><$2><$3><$4>
2559 define infun2 {
2560 echo infun2:$?/$^ERRNAME/$#:$*/"$@"/<$1><$2><$3><$4>
2561 vput vpospar z quote;echo infun2:z<$z>
2564 define infun {
2565 echo infun:$?/$^ERRNAME/$#:$*/"$@"/<$1><$2><$3><$4>
2566 vput vpospar y quote;echo infun:y<$y>
2567 eval vpospar set ${x};echo infun:$?/$^ERRNAME/$#:$*/"$@"/<$1><$2><$3><$4>
2568 vpospar clear;echo infun:$?/$^ERRNAME/$#:$*/"$@"/<$1><$2><$3><$4>
2569 eval call infun2 $x
2570 echo infun:$?/$^ERRNAME/$#:$*/"$@"/<$1><$2><$3><$4>
2571 eval vpospar set ${y};echo infun:$?/$^ERRNAME/$#:$*/"$@"/<$1><$2><$3><$4>
2574 call infun This "in a" fun
2575 echo $?/$^ERRNAME/$#: $* / "$@" / <$1><$2><$3><$4>
2576 vpospar clear;echo $?/$^ERRNAME/$#: $* / "$@" / <$1><$2><$3><$4>
2577 __EOT
2578 check 1 0 "${MBOX}" '155175639 866'
2581 ${cat} <<- '__EOT' | ${MAILX} ${ARGS} > "${MBOX}" 2>&1
2582 set ifs=\'
2583 echo ifs<$ifs> ifs-ws<$ifs-ws>
2584 vpospar set hey, "'you ", world!
2585 echo $?/$^ERRNAME/$#: $* / "$@" / <$1><$2><$3><$4>
2586 vput vpospar x quote; echo x<$x>
2587 vpospar clear;echo $?/$^ERRNAME/$#: $* / "$@" / <$1><$2><$3><$4>
2588 eval vpospar set ${x};echo $?/$^ERRNAME/$#: $* / "$@" / <$1><$2><$3><$4>
2590 set ifs=,
2591 echo ifs<$ifs> ifs-ws<$ifs-ws>
2592 vpospar set hey, "'you ", world!
2593 unset ifs;echo $?/$^ERRNAME/$#: $* / "$@" / <$1><$2><$3><$4>
2594 set ifs=,
2595 vput vpospar x quote; echo x<$x>
2596 vpospar clear;echo $?/$^ERRNAME/$#: $* / "$@" / <$1><$2><$3><$4>
2597 eval vpospar set ${x};\
2598 unset ifs;echo $?/$^ERRNAME/$#: $* / "$@" / <$1><$2><$3><$4>
2600 wysh set ifs=$',\t'
2601 echo ifs<$ifs> ifs-ws<$ifs-ws>
2602 vpospar set hey, "'you ", world!
2603 unset ifs; echo $?/$^ERRNAME/$#: $* / "$@" / <$1><$2><$3><$4>
2604 wysh set ifs=$',\t'
2605 vput vpospar x quote; echo x<$x>
2606 vpospar clear;echo $?/$^ERRNAME/$#: $* / "$@" / <$1><$2><$3><$4>
2607 eval vpospar set ${x};\
2608 unset ifs;echo $?/$^ERRNAME/$#: $* / "$@" / <$1><$2><$3><$4>
2609 __EOT
2610 check ifs 0 "${MBOX}" '2015927702 706'
2612 t_epilog
2615 t_atxplode() {
2616 t_prolog atxplode
2617 TRAP_EXIT_ADDONS="./.t*"
2619 ${cat} > ./.t.sh <<- '___'; ${cat} > ./.t.rc <<- '___'
2620 x() { echo $#; }
2621 xxx() {
2622 printf " (1/$#: <$1>)"
2623 shift
2624 if [ $# -gt 0 ]; then
2625 xxx "$@"
2626 else
2627 echo
2630 yyy() {
2631 eval "$@ ' ball"
2633 set --
2634 x "$@"
2635 x "$@"''
2636 x " $@"
2637 x "$@ "
2638 printf yyy;yyy 'xxx' "b\$'\t'u ' "
2639 printf xxx;xxx arg ,b u.
2640 printf xxx;xxx arg , .
2641 printf xxx;xxx arg ,ball.
2643 define x {
2644 echo $#
2646 define xxx {
2647 echon " (1/$#: <$1>)"
2648 shift
2649 if [ $# -gt 0 ]
2650 \xcall xxx "$@"
2651 endif
2652 echo
2654 define yyy {
2655 eval "$@ ' ball"
2657 vpospar set
2658 call x "$@"
2659 call x "$@"''
2660 call x " $@"
2661 call x "$@ "
2662 echon yyy;call yyy '\call xxx' "b\$'\t'u ' "
2663 echon xxx;call xxx arg ,b u.
2664 echon xxx;call xxx arg , .
2665 echon xxx;call xxx arg ,ball.
2668 ${MAILX} ${ARGS} -X'source ./.t.rc' -Xx > "${MBOX}" 2>&1
2669 check 1 0 "${MBOX}" '41566293 164'
2671 #${SHELL} ./.t.sh > ./.tshout 2>&1
2672 #check disproof-1 0 ./.tshout '41566293 164'
2674 t_epilog
2677 t_read() {
2678 t_prolog read
2679 TRAP_EXIT_ADDONS="./.t*"
2681 ${cat} <<- '__EOT' > .tin
2682 hey1, "'you ", world!
2683 hey2, "'you ", bugs bunny!
2684 hey3, "'you ",
2685 hey4, "'you "
2686 __EOT
2688 ${cat} <<- '__EOT' |\
2689 ${MAILX} ${ARGS} -X'readctl create ./.tin' > "${MBOX}" 2>&1
2690 read a b c
2691 echo $?/$^ERRNAME / <$a><$b><$c>
2692 read a b c
2693 echo $?/$^ERRNAME / <$a><$b><$c>
2694 read a b c
2695 echo $?/$^ERRNAME / <$a><$b><$c>
2696 read a b c
2697 echo $?/$^ERRNAME / <$a><$b><$c>
2698 unset a b c;read a b c
2699 echo $?/$^ERRNAME / <$a><$b><$c>
2700 readctl remove ./.tin;echo readctl remove:$?/$^ERRNAME
2701 __EOT
2702 check 1 0 "${MBOX}" '1527910147 173'
2704 ${cat} <<- '__EOT' > .tin2
2705 hey2.0,:"'you ",:world!:mars.:
2706 hey2.1,:"'you ",:world!
2707 hey2.2,:"'you ",:bugs bunny!
2708 hey2.3,:"'you ",:
2709 hey2.4,:"'you ":
2711 __EOT
2713 ${cat} <<- '__EOT' |\
2714 6< .tin2 ${MAILX} ${ARGS} -X 'readctl create 6' > "${MBOX}" 2>&1
2715 set ifs=:
2716 read a b c
2717 echo $?/$^ERRNAME / <$a><$b><$c>
2718 read a b c
2719 echo $?/$^ERRNAME / <$a><$b><$c>
2720 read a b c
2721 echo $?/$^ERRNAME / <$a><$b><$c>
2722 read a b c
2723 echo $?/$^ERRNAME / <$a><$b><$c>
2724 read a b c
2725 echo $?/$^ERRNAME / <$a><$b><$c>
2726 read a b c
2727 echo $?/$^ERRNAME / <$a><$b><$c>
2728 unset a b c;read a b c
2729 echo $?/$^ERRNAME / <$a><$b><$c>
2730 read a b c
2731 echo $?/$^ERRNAME / <$a><$b><$c>
2732 readctl remove 6;echo readctl remove:$?/$^ERRNAME
2733 __EOT
2734 check ifs 0 "${MBOX}" '890153490 298'
2736 ${cat} <<- '__EOT' | ${MAILX} ${ARGS} > "${MBOX}" 2>&1
2737 readctl create .tin
2738 readall d; echo $?/$^ERRNAME / <$d>
2739 wysh set d;readall d;echo $?/$^ERRNAME / <$d>
2740 readctl create .tin2
2741 readall d; echo $?/$^ERRNAME / <$d>
2742 wysh set d;readall d;echo $?/$^ERRNAME / <$d>
2743 readctl remove .tin;echo $?/$^ERRNAME;\
2744 readctl remove .tin2;echo $?/$^ERRNAME
2745 echo '### now with empty lines'
2746 ! printf 'one line\n\ntwo line\n\n' > ./.temptynl
2747 readctl create .temptynl;echo $?/$^ERRNAME
2748 readall d; echo "$?/$^ERRNAME / <$d>"
2749 readctl remove .temptynl;echo $?/$^ERRNAME
2750 __EOT
2751 check readall 0 "${MBOX}" '4113506527 405'
2753 t_epilog
2755 # }}}
2757 # VFS {{{
2758 t_mbox() {
2759 t_prolog mbox
2760 TRAP_EXIT_ADDONS="./.t*"
2764 while [ ${i} -lt 113 ]; do
2765 printf 'm file://%s\n~s Subject %s\nHello %s!\n~.\n' \
2766 "${MBOX}" "${i}" "${i}"
2767 i=`add ${i} 1`
2768 done
2769 ) | ${MAILX} ${ARGS} > .tall 2>&1
2770 check 1 0 "${MBOX}" '1785801373 13336'
2771 check 1-outerr - ./.tall '4294967295 0' # empty file
2773 printf 'File "%s"\ncopy * "%s"\nFile "%s"\nfrom*' "${MBOX}" .tmbox1 .tmbox1 |
2774 ${MAILX} ${ARGS} -Sshowlast > .tall 2>&1
2775 check 2 0 .tall '3075634057 9103'
2777 printf 'File "%s"\ncopy * "file://%s"\nFile "file://%s"\nfrom*' \
2778 "${MBOX}" .tmbox2 .tmbox2 | ${MAILX} ${ARGS} -Sshowlast > .tall 2>&1
2779 check 3 0 .tall '1902668747 9110'
2781 # copy only the odd (but the first), move the even
2783 printf 'File "file://%s"\ncopy ' .tmbox2
2785 while [ ${i} -lt 113 ]; do
2786 printf '%s ' "${i}"
2787 i=`add ${i} 2`
2788 done
2789 printf 'file://%s\nFile "file://%s"\nfrom*' .tmbox3 .tmbox3
2790 ) | ${MAILX} ${ARGS} -Sshowlast > .tall 2>&1
2791 check 4 0 .tmbox3 '2554734733 6666'
2792 check 5 - .tall '3168324241 4573'
2793 # ...
2795 printf 'file "file://%s"\nmove ' .tmbox2
2797 while [ ${i} -lt 113 ]; do
2798 printf '%s ' "${i}"
2799 i=`add ${i} 2`
2800 done
2801 printf 'file://%s\nFile "file://%s"\nfrom*\nFile "file://%s"\nfrom*' \
2802 .tmbox3 .tmbox3 .tmbox2
2803 ) | ${MAILX} ${ARGS} -Sshowlast > .tall 2>>${ERR}
2804 check 6 0 .tmbox3 '1429216753 13336'
2805 if have_feat uistrings; then
2806 ${sed} 2d < .tall > .tallx
2807 else
2808 ${cp} .tall .tallx
2810 check 7 - .tallx '3604509039 13645'
2812 # Invalid MBOXes (after [f4db93b3])
2813 echo > .tinvmbox
2814 printf 'copy 1 ./.tinvmbox' | ${MAILX} ${ARGS} -Rf "${MBOX}" > .tall 2>&1
2815 check 8 0 .tinvmbox '2848412822 118'
2816 check 9 - ./.tall '461280182 33'
2818 echo ' ' > .tinvmbox
2819 printf 'copy 1 ./.tinvmbox' | ${MAILX} ${ARGS} -Rf "${MBOX}" > .tall 2>&1
2820 check 10 0 .tinvmbox '624770486 120'
2821 check 11 - ./.tall '461280182 33'
2823 { echo; echo; } > .tinvmbox # (not invalid)
2824 printf 'copy 1 ./.tinvmbox' | ${MAILX} ${ARGS} -Rf "${MBOX}" > .tall 2>&1
2825 check 12 0 .tinvmbox '1485640875 119'
2826 check 13 - ./.tall '461280182 33'
2828 # *mbox-rfc4155*, plus
2829 ${cat} <<-_EOT > ./.tinv1
2832 From MAILER-DAEMON-1 Wed Oct 2 01:50:07 1996
2833 Date: Wed, 02 Oct 1996 01:50:07 +0000
2835 Subject: Bad bad message 1
2837 From me to you, blinde Kuh!
2839 From MAILER-DAEMON-2 Wed Oct 2 01:50:07 1996
2840 Date: Wed, 02 Oct 1996 01:50:07 +0000
2842 Subject: Bad bad message 2
2844 From me to you, blindes Kalb!
2845 _EOT
2846 ${cp} ./.tinv1 ./.tinv2
2848 printf \
2849 'define mboxfix {
2850 \\localopts yes; \\wysh set mbox-rfc4155;\\wysh File "${1}";\\
2851 \\eval copy * "${2}"
2853 call mboxfix ./.tinv1 ./.tok' | ${MAILX} ${ARGS} > .tall 2>&1
2854 check_ex0 14-estat
2855 ${cat} ./.tinv1 ./.tok >> .tall
2856 check 14 - ./.tall '739301109 616'
2858 printf \
2859 'wysh file ./.tinv1 # ^From not repaired, but missing trailing NL is
2860 wysh File ./.tok # Just move away to nowhere
2861 set mbox-rfc4155
2862 wysh file ./.tinv2 # Fully repaired
2863 File ./.tok' | ${MAILX} ${ARGS} >>${ERR} 2>&1
2864 check_ex0 15-estat
2865 check 15-1 - ./.tinv1 '3178048820 332'
2866 check 15-2 - ./.tinv2 '4151504442 314'
2868 t_epilog
2871 t_maildir() {
2872 t_prolog maildir
2873 if have_feat maildir; then :; else
2874 echo 'maildir: unsupported, skipped'
2875 return
2878 TRAP_EXIT_ADDONS="./.t*"
2882 while [ ${i} -lt 112 ]; do
2883 printf 'm file://%s\n~s Subject %s\nHello %s!\n~.\n' \
2884 "${MBOX}" "${i}" "${i}"
2885 i=`add ${i} 1`
2886 done
2887 ) | ${MAILX} ${ARGS}
2888 check 1 0 "${MBOX}" '2366902811 13332'
2890 printf 'File "%s"
2891 copy * "%s"
2892 File "%s"
2893 from*
2894 ' "${MBOX}" .tmdir1 .tmdir1 |
2895 ${MAILX} ${ARGS} -Snewfolders=maildir -Sshowlast > .tlst
2896 check 2 0 .tlst '1713783045 9103'
2898 printf 'File "%s"
2899 copy * "maildir://%s"
2900 File "maildir://%s"
2901 from*
2902 ' "${MBOX}" .tmdir2 .tmdir2 |
2903 ${MAILX} ${ARGS} -Sshowlast > .tlst
2904 check 3 0 .tlst '1240307893 9113'
2906 printf 'File "maildir://%s"
2907 copy * "file://%s"
2908 File "file://%s"
2909 from*
2910 ' .tmdir2 .tmbox1 .tmbox1 |
2911 ${MAILX} ${ARGS} -Sshowlast > .tlst
2912 check 4 0 .tmbox1 '4096198846 12772'
2913 check 5 - .tlst '817337448 9110'
2915 # only the odd (even)
2917 printf 'File "maildir://%s"
2918 copy ' .tmdir2
2920 while [ ${i} -lt 112 ]; do
2921 j=`modulo ${i} 2`
2922 [ ${j} -eq 1 ] && printf '%s ' "${i}"
2923 i=`add ${i} 1`
2924 done
2925 printf ' file://%s
2926 File "file://%s"
2927 from*
2928 ' .tmbox2 .tmbox2
2929 ) | ${MAILX} ${ARGS} -Sshowlast > .tlst
2930 check 6 0 .tmbox2 '4228337024 6386'
2931 check 7 - .tlst '884389294 4573'
2932 # ...
2934 printf 'file "maildir://%s"
2935 move ' .tmdir2
2937 while [ ${i} -lt 112 ]; do
2938 j=`modulo ${i} 2`
2939 [ ${j} -eq 0 ] && [ ${i} -ne 0 ] && printf '%s ' "${i}"
2940 i=`add ${i} 1`
2941 done
2942 printf ' file://%s
2943 File "file://%s"
2944 from*
2945 File "maildir://%s"
2946 from*
2947 ' .tmbox2 .tmbox2 .tmdir2
2948 ) | ${MAILX} ${ARGS} -Sshowlast > .tlst
2949 check 8 0 .tmbox2 '978751761 12656'
2950 ${sed} 2d < .tlst > .tlstx
2951 check 9 - .tlstx '2391942957 13645'
2953 t_epilog
2955 # }}}
2957 # MIME and RFC basics {{{
2958 t_mime_if_not_ascii() {
2959 t_prolog mime_if_not_ascii
2961 </dev/null ${MAILX} ${ARGS} -s Subject "${MBOX}" >> "${MBOX}" 2>&1
2962 check 1 0 "${MBOX}" '3647956381 106'
2964 </dev/null ${MAILX} ${ARGS} -Scharset-7bit=not-ascii -s Subject "${MBOX}" \
2965 >> "${MBOX}" 2>&1
2966 check 2 0 "${MBOX}" '3964303752 274'
2968 t_epilog
2971 t_xxxheads_rfc2047() {
2972 t_prolog xxxheads_rfc2047
2973 TRAP_EXIT_ADDONS="./.t*"
2975 t_xmta 'GentianaLutea Mon Dec 04 17:15:29 2017'
2977 echo | ${MAILX} ${ARGS} ${ADDARG_UNI} \
2978 -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̲' \
2979 "${MBOX}"
2980 check 1 0 "${MBOX}" '3422562347 371'
2982 # Single word (overlong line split -- bad standard! Requires injection of
2983 # artificial data!! But can be prevented by using RFC 2047 encoding)
2984 ${rm} "${MBOX}"
2985 i=`${awk} 'BEGIN{for(i=0; i<92; ++i) printf "0123456789_"}'`
2986 echo | ${MAILX} ${ARGS} -s "${i}" "${MBOX}"
2987 check 2 0 "${MBOX}" '3317256266 1714'
2989 # Combination of encoded words, space and tabs of varying sort
2990 ${rm} "${MBOX}"
2991 echo | ${MAILX} ${ARGS} ${ADDARG_UNI} \
2992 -s "1Abrä Kaspas1 2Abra Katä b_kaspas2 \
2993 3Abrä Kaspas3 4Abrä Kaspas4 5Abrä Kaspas5 \
2994 6Abra Kaspas6 7Abrä Kaspas7 8Abra Kaspas8 \
2995 9Abra Kaspastäb4-3 10Abra Kaspas1 _ 11Abra Katäb1 \
2996 12Abra Kadabrä1 After Tab after Täb this is NUTS" \
2997 "${MBOX}"
2998 check 3 0 "${MBOX}" '786672837 587'
3000 # Overlong multibyte sequence that must be forcefully split
3001 # todo This works even before v15.0, but only by accident
3002 ${rm} "${MBOX}"
3003 echo | ${MAILX} ${ARGS} ${ADDARG_UNI} \
3004 -s "✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄\
3005 ✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄\
3006 ✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄" \
3007 "${MBOX}"
3008 check 4 0 "${MBOX}" '2889557767 655'
3010 # Trailing WS
3011 ${rm} "${MBOX}"
3012 echo | ${MAILX} ${ARGS} \
3013 -s "1-1 B2 B3 B4 B5 B6 B\
3014 1-2 B2 B3 B4 B5 B6 B\
3015 1-3 B2 B3 B4 B5 B6 B\
3016 1-4 B2 B3 B4 B5 B6 B\
3017 1-5 B2 B3 B4 B5 B6 B\
3018 1-6 B2 B3 B4 B5 B6 " \
3019 "${MBOX}"
3020 check 5 0 "${MBOX}" '3135161683 293'
3022 # Leading and trailing WS
3023 ${rm} "${MBOX}"
3024 echo | ${MAILX} ${ARGS} \
3025 -s " 2-1 B2 B3 B4 B5 B6 B\
3026 1-2 B2 B3 B4 B5 B6 B\
3027 1-3 B2 B3 B4 B5 B6 B\
3028 1-4 B2 B3 B4 B5 B6 " \
3029 "${MBOX}"
3030 check 6 0 "${MBOX}" '3221845405 232'
3032 # RFC 2047 in an address field! (Missing test caused v14.9.6!)
3033 ${rm} "${MBOX}"
3034 echo "Dat Früchtchen riecht häußlich" |
3035 ${MAILX} ${ARGS} ${ADDARG_UNI} -Sfullnames -Smta=./.tmta.sh \
3036 -s Hühöttchen \
3037 'Schnödes "Früchtchen" <do@du> (Hä!)'
3038 check 7 0 "${MBOX}" '800505986 368'
3040 # RFC 2047 in an address field, and iconv involved
3041 if have_feat iconv; then
3042 ${rm} "${MBOX}"
3043 ${cat} > ./.trebox <<_EOT
3044 From zaza@exam.ple Fri Mar 2 21:31:56 2018
3045 Date: Fri, 2 Mar 2018 20:31:45 +0000
3046 From: z=?iso-8859-1?Q?=E1?=za <zaza@exam.ple>
3047 To: dude <dude@exam.ple>
3048 Subject: houston(...)
3049 Message-ID: <abra@1>
3050 MIME-Version: 1.0
3051 Content-Type: text/plain; charset=iso-8859-1
3052 Content-Disposition: inline
3053 Content-Transfer-Encoding: 8bit
3055 _EOT
3056 echo reply | ${MAILX} ${ARGS} ${ADDARG_UNI} \
3057 -Sfullnames -Sreply-in-same-charset \
3058 -Smta=./.tmta.sh -Rf ./.trebox
3059 check 8 0 "${MBOX}" '2914485741 280'
3060 else
3061 echo 'xxxheads_rfc2047-8: iconv unsupported, skipped'
3064 t_epilog
3067 t_iconv_mbyte_base64() { # TODO uses sed(1) and special *headline*!!
3068 t_prolog iconv_mbyte_base64
3069 TRAP_EXIT_ADDONS="./.t*"
3071 if [ -n "${UTF8_LOCALE}" ] && have_feat iconv; then
3072 if (</dev/null iconv -f ascii -t iso-2022-jp) >/dev/null 2>&1 ||
3073 (</dev/null iconv -f ascii -t euc-jp) >/dev/null 2>&1; then
3075 else
3076 echo 'iconv_mbyte_base64: unsupported, skipped'
3077 return
3079 else
3080 echo 'iconv_mbyte_base64: unsupported, skipped'
3081 return
3084 t_xmta 'DroseriaRotundifolia Thu Aug 03 17:26:25 2017'
3086 if (</dev/null iconv -f ascii -t iso-2022-jp) >/dev/null 2>&1; then
3087 ${cat} <<-'_EOT' | LC_ALL=${UTF8_LOCALE} ${MAILX} ${ARGS} \
3088 -Smta=./.tmta.sh \
3089 -Sescape=! -Smime-encoding=base64 2>./.terr
3090 set ttycharset=utf-8 sendcharsets=iso-2022-jp
3091 m t1@exam.ple
3092 !s Japanese from UTF-8 to ISO-2022-JP
3093 シジュウカラ科(シジュウカラか、学名 Paridae)は、鳥類スズメ目の科である。シジュウカラ(四十雀)と総称されるが、狭義にはこの1種をシジュウカラと呼ぶ。
3095 カンムリガラ(学名Parus cristatus)は、スズメ目シジュウカラ科に分類される鳥類の一種。
3098 カンムリガラ(学名Parus cristatus)は、スズメ目シジュウカラ科に分類される鳥類の一種。
3100 シジュウカラ科(シジュウカラか、学名 Paridae)は、鳥類スズメ目の科である。シジュウカラ(四十雀)と総称されるが、狭義にはこの1種をシジュウカラと呼ぶ。
3103 set ttycharset=iso-2022-jp charset-7bit=iso-2022-jp sendcharsets=utf-8
3104 m t2@exam.ple
3105 !s Japanese from ISO-2022-JP to UTF-8, eh, no, also ISO-2022-JP
3106 \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
3108 \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
3111 \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
3113 \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
3115 _EOT
3116 # May not presume iconv output as long as roundtrip possible [489a7122]
3117 check_ex0 1-estat
3118 ${awk} 'BEGIN{h=1}/^$/{++h;next}{if(h % 2 == 1)print}' \
3119 < "${MBOX}" > ./.tcksum
3120 check 1 - ./.tcksum '2694609714 520'
3121 check 2 - ./.terr '4294967295 0'
3123 printf 'eval f 1; eval write ./.twrite; eval type 1; eval type 2\n' |
3124 LC_ALL=${UTF8_LOCALE} ${MAILX} ${ARGS} \
3125 -S headline="%>%a%m %-18f %-16d %i%-s" \
3126 -Rf "${MBOX}" >./.tlog 2>&1
3127 check 3 0 ./.twrite '1259742080 686'
3128 #check 4 - ./.tlog '3214068822 2123'
3129 ${sed} -e '/^\[-- M/d' < ./.tlog > ./.txlog
3130 check 4 - ./.txlog '3659773472 2035'
3131 else
3132 echo 'iconv_mbyte_base64: ISO-2022-JP unsupported, skipping 1-4'
3135 if (</dev/null iconv -f ascii -t euc-jp) >/dev/null 2>&1; then
3136 rm -f "${MBOX}" ./.twrite
3137 ${cat} <<-'_EOT' | LC_ALL=${UTF8_LOCALE} ${MAILX} ${ARGS} \
3138 -Smta=./.tmta.sh \
3139 -Sescape=! -Smime-encoding=base64 2>./.terr
3140 set ttycharset=utf-8 sendcharsets=euc-jp
3141 m t1@exam.ple
3142 !s Japanese from UTF-8 to EUC-JP
3143 シジュウカラ科(シジュウカラか、学名 Paridae)は、鳥類スズメ目の科である。シジュウカラ(四十雀)と総称されるが、狭義にはこの1種をシジュウカラと呼ぶ。
3145 カンムリガラ(学名Parus cristatus)は、スズメ目シジュウカラ科に分類される鳥類の一種。
3148 カンムリガラ(学名Parus cristatus)は、スズメ目シジュウカラ科に分類される鳥類の一種。
3150 シジュウカラ科(シジュウカラか、学名 Paridae)は、鳥類スズメ目の科である。シジュウカラ(四十雀)と総称されるが、狭義にはこの1種をシジュウカラと呼ぶ。
3153 set ttycharset=EUC-JP sendcharsets=utf-8
3154 m t2@exam.ple
3155 !s Japanese from EUC-JP to UTF-8
3156 ¥·¥¸¥å¥¦¥«¥é²Ê¡Ê¥·¥¸¥å¥¦¥«¥é¤«¡¢³Ø̾ Paridae¡Ë¤Ï¡¢Ä»Îॹ¥º¥áÌܤβʤǤ¢¤ë¡£¥·¥¸¥å¥¦¥«¥é¡Ê»Í½½¿ý¡Ë¤ÈÁí¾Î¤µ¤ì¤ë¤¬¡¢¶¹µÁ¤Ë¤Ï¤³¤Î1¼ï¤ò¥·¥¸¥å¥¦¥«¥é¤È¸Æ¤Ö¡£
3158 ¥«¥ó¥à¥ê¥¬¥é¡Ê³Ø̾Parus cristatus¡Ë¤Ï¡¢¥¹¥º¥áÌÜ¥·¥¸¥å¥¦¥«¥é²Ê¤ËʬÎव¤ì¤ëÄ»Îà¤Î°ì¼ï¡£
3161 ¥«¥ó¥à¥ê¥¬¥é¡Ê³Ø̾Parus cristatus¡Ë¤Ï¡¢¥¹¥º¥áÌÜ¥·¥¸¥å¥¦¥«¥é²Ê¤ËʬÎव¤ì¤ëÄ»Îà¤Î°ì¼ï¡£
3163 ¥·¥¸¥å¥¦¥«¥é²Ê¡Ê¥·¥¸¥å¥¦¥«¥é¤«¡¢³Ø̾ Paridae¡Ë¤Ï¡¢Ä»Îॹ¥º¥áÌܤβʤǤ¢¤ë¡£¥·¥¸¥å¥¦¥«¥é¡Ê»Í½½¿ý¡Ë¤ÈÁí¾Î¤µ¤ì¤ë¤¬¡¢¶¹µÁ¤Ë¤Ï¤³¤Î1¼ï¤ò¥·¥¸¥å¥¦¥«¥é¤È¸Æ¤Ö¡£
3165 _EOT
3166 check_ex0 5-estat
3167 ${awk} 'BEGIN{h=1}/^$/{++h;next}{if(h % 2 == 1)print}' \
3168 < "${MBOX}" > ./.tcksum
3169 check 5 - ./.tcksum '2870183985 473'
3170 check 6 - ./.terr '4294967295 0'
3172 printf 'eval f 1; eval write ./.twrite; eval type 1; eval type 2\n' |
3173 LC_ALL=${UTF8_LOCALE} ${MAILX} ${ARGS} \
3174 -S headline="%>%a%m %-18f %-16d %i%-s" \
3175 -Rf "${MBOX}" >./.tlog 2>&1
3176 check 7 0 ./.twrite '1259742080 686'
3177 #check 8 - ./.tlog '2506063395 2075'
3178 ${sed} -e '/^\[-- M/d' < ./.tlog > ./.txlog
3179 check 8 - ./.txlog '2528199891 1988'
3180 else
3181 echo 'iconv_mbyte_base64: EUC-JP unsupported, skipping 5-8'
3184 t_epilog
3187 t_iconv_mainbody() {
3188 t_prolog iconv_mainbody
3189 TRAP_EXIT_ADDONS="./.t*"
3191 if [ -n "${UTF8_LOCALE}" ] && have_feat iconv; then
3193 else
3194 echo 'iconv_mainbody: unsupported, skipped'
3195 return
3198 t_xmta 'HamamelisVirginiana Fri Oct 20 16:23:21 2017'
3200 printf '–' | ${MAILX} ${ARGS} ${ADDARG_UNI} -Smta=./.tmta.sh \
3201 -S charset-7bit=us-ascii -S charset-8bit=utf-8 \
3202 -s '–' over-the@rain.bow 2>./.terr
3203 check 1 0 "${MBOX}" '3634015017 251'
3204 check 2 - ./.terr '4294967295 0'
3206 printf '–' | ${MAILX} ${ARGS} ${ADDARG_UNI} -Smta=./.tmta.sh \
3207 -S charset-7bit=us-ascii -S charset-8bit=us-ascii \
3208 -s '–' over-the@rain.bow 2>./.terr
3209 check_exn0 3
3210 check 3 - "${MBOX}" '3634015017 251'
3211 if have_feat uistrings; then
3212 if have_feat docstrings; then # xxx should not be like that
3213 check 4 - ./.terr '2579894983 148'
3214 else
3215 check 4 - ./.terr '271380835 121'
3217 else
3218 echo 'iconv_mainbody-4: unsupported, skipped'
3221 # The different iconv(3) implementations use different replacement sequence
3222 # types (character-wise, byte-wise, and the character(s) used differ)
3223 i="${MAILX_ICONV_MODE}"
3224 if [ -n "${i}" ]; then
3225 printf 'p\nx\n' | ${MAILX} ${ARGS} -Rf "${MBOX}" >./.tout 2>./.terr
3226 j=${?}
3227 check_ex0 5-1-estat ${j}
3228 check 5-1 - ./.terr '4294967295 0'
3229 if [ ${i} -eq 13 ]; then
3230 check 5-2 - ./.tout '189327996 283'
3231 elif [ ${i} -eq 12 ]; then
3232 check 5-3 - ./.tout '1959197095 283'
3233 elif [ ${i} -eq 3 ]; then
3234 check 5-4 - ./.tout '3196380198 279'
3235 else
3236 check 5-5 - ./.tout '3760313827 279'
3238 else
3239 echo 'iconv_mainbody-5: unsupported, skipped'
3242 t_epilog
3245 t_binary_mainbody() {
3246 t_prolog binary_mainbody
3247 TRAP_EXIT_ADDONS="./.t*"
3249 printf 'abra\0\nka\r\ndabra' |
3250 ${MAILX} ${ARGS} ${ADDARG_UNI} -s 'binary with carriage-return!' \
3251 "${MBOX}" 2>./.terr
3252 check 1 0 "${MBOX}" '1629827 239'
3253 check 2 - ./.terr '4294967295 0'
3255 printf 'p\necho\necho writing now\nwrite ./.twrite\n' |
3256 ${MAILX} ${ARGS} -Rf \
3257 -Spipe-application/octet-stream="@* ${cat} > ./.tcat" \
3258 "${MBOX}" >./.tall 2>&1
3259 check 3 0 ./.tall '733582513 319'
3260 check 4 - ./.tcat '3817108933 15'
3261 check 5 - ./.twrite '3817108933 15'
3263 t_epilog
3266 t_C_opt_customhdr() {
3267 t_prolog C_opt_customhdr
3268 TRAP_EXIT_ADDONS="./.t*"
3270 t_xmta 'CimicifugaRacemosa Mon Dec 25 21:33:40 2017'
3272 echo bla |
3273 ${MAILX} ${ARGS} -Smta=./.tmta.sh \
3274 -C 'C-One : Custom One Body' \
3275 -C 'C-Two:CustomTwoBody' \
3276 -S customhdr='chdr1: chdr1 body, chdr2:chdr2 body' \
3277 this-goes@nowhere >./.tall 2>&1
3278 check_ex0 1-estat
3279 ${cat} ./.tall >> "${MBOX}"
3280 check 1 0 "${MBOX}" '2400078426 195'
3282 ${rm} "${MBOX}"
3283 printf 'm this-goes@nowhere\nbody\n!.
3284 unset customhdr
3285 m this-goes2@nowhere\nbody2\n!.
3286 set customhdr=%ccustom1 : custom1 body%c
3287 m this-goes2@nowhere\nbody2\n!.
3288 set customhdr=%ccustom1 : custom1\\, body , custom2: custom2 body%c
3289 m this-goes3@nowhere\nbody3\n!.
3290 ' "'" "'" "'" "'" |
3291 ${MAILX} ${ARGS} -Smta=./.tmta.sh -Sescape=! \
3292 -C 'C-One : Custom One Body' \
3293 -C 'C-Two:CustomTwoBody' \
3294 -S customhdr='chdr1: chdr1 body, chdr2:chdr2 body' \
3295 >./.tall 2>&1
3296 check_ex0 2-estat
3297 ${cat} ./.tall >> "${MBOX}"
3298 check 2 0 "${MBOX}" '3546878678 752'
3300 t_epilog
3302 # }}}
3304 # Operational basics with easy tests {{{
3305 t_alias() {
3306 t_prolog alias
3307 TRAP_EXIT_ADDONS="./.t*"
3309 t_xmta 'Hippocastanum Mon Jun 19 15:07:07 2017'
3311 ${cat} <<- '__EOT' | ${MAILX} ${ARGS} -Smta=./.tmta.sh > ./.tall 2>&1
3312 alias a1 ex1@a1.ple
3313 alias a1 ex2@a1.ple "EX3 <ex3@a1.ple>"
3314 alias a1 ex4@a1.ple
3315 alias a2 ex1@a2.ple ex2@a2.ple ex3@a2.ple ex4@a2.ple
3316 alias a3 a4
3317 alias a4 a5 ex1@a4.ple
3318 alias a5 a6
3319 alias a6 a7 ex1@a6.ple
3320 alias a7 a8
3321 alias a8 ex1@a8.ple
3322 alias a1
3323 alias a2
3324 alias a3
3325 m a1
3326 ~c a2
3327 ~b a3
3328 ~r - '_EOT'
3329 This body is!
3330 This also body is!!
3331 _EOT
3332 __EOT
3333 check 1 0 "${MBOX}" '2496925843 272'
3334 check 2 - .tall '3548953204 152'
3336 # TODO t_alias: n_ALIAS_MAXEXP is compile-time constant,
3337 # TODO need to somehow provide its contents to the test, then test
3339 t_epilog
3342 t_filetype() {
3343 t_prolog filetype
3344 TRAP_EXIT_ADDONS="./.t*"
3346 t_xmta 'Alchemilla Wed Apr 25 15:12:13 2017'
3348 printf 'm m1@e.t\nL1\nHy1\n~.\nm m2@e.t\nL2\nHy2\n~@ %s\n~.\n' \
3349 "${SRCDIR}snailmail.jpg" | ${MAILX} ${ARGS} -Smta=./.tmta.sh
3350 check 1 0 "${MBOX}" '1594682963 13520'
3352 if (echo | gzip -c) >/dev/null 2>&1; then
3354 printf 'File "%s"\ncopy 1 ./.t.mbox.gz\ncopy 2 ./.t.mbox.gz' \
3355 "${MBOX}" | ${MAILX} ${ARGS} \
3356 -X'filetype gz gzip\ -dc gzip\ -c'
3357 printf 'File ./.t.mbox.gz\ncopy * ./.t.mbox\n' |
3358 ${MAILX} ${ARGS} -X'filetype gz gzip\ -dc gzip\ -c'
3359 } > ./.t.out 2>&1
3360 check 2 - "./.t.mbox" '1594682963 13520'
3361 check 3 - "./.t.out" '2392348396 102'
3362 else
3363 echo 'filetype-2: unsupported, skipped'
3364 echo 'filetype-3: unsupported, skipped'
3368 ${rm} ./.t.mbox*
3369 printf 'File "%s"\ncopy 1 ./.t.mbox.gz
3370 copy 2 ./.t.mbox.gz
3371 copy 1 ./.t.mbox.gz
3372 copy 2 ./.t.mbox.gz
3373 ' "${MBOX}" |
3374 ${MAILX} ${ARGS} \
3375 -X'filetype gz gzip\ -dc gzip\ -c' \
3376 -X'filetype mbox.gz "${sed} 1,3d|${cat}" \
3377 "echo eins;echo zwei;echo und mit ${sed} bist Du dabei;${cat}"'
3378 printf 'File ./.t.mbox.gz\ncopy * ./.t.mbox\n' |
3379 ${MAILX} ${ARGS} \
3380 -X'filetype gz gzip\ -dc gzip\ -c' \
3381 -X'filetype mbox.gz "${sed} 1,3d|${cat}" kill\ 0'
3382 } > ./.t.out 2>&1
3383 check 4 - "./.t.mbox" '2886541147 27060'
3384 check 5 - "./.t.out" '852335377 172'
3386 t_epilog
3389 t_record_a_resend() {
3390 t_prolog record_a_resend
3391 TRAP_EXIT_ADDONS="./.t.record ./.t.resent"
3393 printf '
3394 set record=%s
3395 m %s\n~s Subject 1.\nHello.\n~.
3396 set record-files add-file-recipients
3397 m %s\n~s Subject 2.\nHello.\n~.
3398 File %s
3399 resend 2 ./.t.resent
3400 Resend 1 ./.t.resent
3401 set record-resent
3402 resend 2 ./.t.resent
3403 Resend 1 ./.t.resent
3404 ' ./.t.record "${MBOX}" "${MBOX}" "${MBOX}" |
3405 ${MAILX} ${ARGS}
3407 check 1 0 "${MBOX}" '2632690399 252'
3408 check 2 - .t.record '3337485450 456'
3409 check 3 - .t.resent '1560890069 640'
3411 t_epilog
3414 t_e_H_L_opts() {
3415 t_prolog e_H_L_opts
3416 TRAP_EXIT_ADDONS="./.tmta.sh ./.t.mbox"
3418 t_xmta 'Alchemilla Wed Apr 07 17:03:33 2017' ./.t.mbox
3420 touch ./.t.mbox
3421 ${MAILX} ${ARGS} -ef ./.t.mbox
3422 echo ${?} > "${MBOX}"
3424 printf 'm me@exam.ple\nLine 1.\nHello.\n~.\n' |
3425 ${MAILX} ${ARGS} -Smta=./.tmta.sh
3426 printf 'm you@exam.ple\nLine 1.\nBye.\n~.\n' |
3427 ${MAILX} ${ARGS} -Smta=./.tmta.sh
3429 ${MAILX} ${ARGS} -ef ./.t.mbox 2>> "${MBOX}"
3430 echo ${?} >> "${MBOX}"
3431 ${MAILX} ${ARGS} -efL @t@me ./.t.mbox 2>> "${MBOX}"
3432 echo ${?} >> "${MBOX}"
3433 ${MAILX} ${ARGS} -efL @t@you ./.t.mbox 2>> "${MBOX}"
3434 echo ${?} >> "${MBOX}"
3435 ${MAILX} ${ARGS} -efL '@>@Line 1' ./.t.mbox 2>> "${MBOX}"
3436 echo ${?} >> "${MBOX}"
3437 ${MAILX} ${ARGS} -efL '@>@Hello.' ./.t.mbox 2>> "${MBOX}"
3438 echo ${?} >> "${MBOX}"
3439 ${MAILX} ${ARGS} -efL '@>@Bye.' ./.t.mbox 2>> "${MBOX}"
3440 echo ${?} >> "${MBOX}"
3441 ${MAILX} ${ARGS} -efL '@>@Good bye.' ./.t.mbox 2>> "${MBOX}"
3442 echo ${?} >> "${MBOX}"
3444 ${MAILX} ${ARGS} -fH ./.t.mbox >> "${MBOX}" 2>&1
3445 echo ${?} >> "${MBOX}"
3446 ${MAILX} ${ARGS} -fL @t@me ./.t.mbox >> "${MBOX}" 2>&1
3447 echo ${?} >> "${MBOX}"
3448 ${MAILX} ${ARGS} -fL @t@you ./.t.mbox >> "${MBOX}" 2>&1
3449 echo ${?} >> "${MBOX}"
3450 ${MAILX} ${ARGS} -fL '@>@Line 1' ./.t.mbox >> "${MBOX}" 2>&1
3451 echo ${?} >> "${MBOX}"
3452 ${MAILX} ${ARGS} -fL '@>@Hello.' ./.t.mbox >> "${MBOX}" 2>&1
3453 echo ${?} >> "${MBOX}"
3454 ${MAILX} ${ARGS} -fL '@>@Bye.' ./.t.mbox >> "${MBOX}" 2>&1
3455 echo ${?} >> "${MBOX}"
3456 ${MAILX} ${ARGS} -fL '@>@Good bye.' ./.t.mbox >> "${MBOX}" 2>>${ERR}
3457 echo ${?} >> "${MBOX}"
3459 check 1 - "${MBOX}" '1708955574 678'
3463 printf 'm me1@exam.ple\n~s subject cab\nLine 1.\n~.\n' |
3464 ${MAILX} ${ARGS} -Smta=./.tmta.sh \
3465 -r '' -X 'wysh set from=pony1@$LOGNAME'
3466 printf 'm me2@exam.ple\n~s subject bac\nLine 12.\n~.\n' |
3467 ${MAILX} ${ARGS} -Smta=./.tmta.sh \
3468 -r '' -X 'wysh set from=pony2@$LOGNAME'
3469 printf 'm me3@exam.ple\n~s subject abc\nLine 123.\n~.\n' |
3470 ${MAILX} ${ARGS} -Smta=./.tmta.sh \
3471 -r '' -X 'wysh set from=pony3@$LOGNAME'
3473 ${MAILX} ${ARGS} -S folder-hook=fh-test -X 'define fh-test {
3474 echo fh-test size; set autosort=size showname showto
3475 }' -fH ./.t.mbox > "${MBOX}" 2>&1
3476 check 2-1 0 "${MBOX}" '512787278 418'
3478 ${MAILX} ${ARGS} -S folder-hook=fh-test -X 'define fh-test {
3479 echo fh-test subject; set autosort=subject showname showto
3480 }' -fH ./.t.mbox > "${MBOX}" 2>&1
3481 check 2-2 0 "${MBOX}" '3606067531 421'
3483 ${MAILX} ${ARGS} -S folder-hook=fh-test -X 'define fh-test {
3484 echo fh-test from; set autosort=from showto
3485 }' -fH ./.t.mbox > "${MBOX}" 2>&1
3486 check 2-3 0 "${MBOX}" '2506148572 418'
3488 ${MAILX} ${ARGS} -S folder-hook=fh-test -X 'define fh-test {
3489 echo fh-test to; set autosort=to showto
3490 }' -fH ./.t.mbox > "${MBOX}" 2>&1
3491 check 2-4 0 "${MBOX}" '1221542854 416'
3493 t_epilog
3496 t_q_t_etc_opts() {
3497 # Simple, if we need more here, place in a later vim fold!
3498 t_prolog q_t_etc_opts
3499 TRAP_EXIT_ADDONS="./.t*"
3501 # Three tests for MIME encoding and (a bit) content classification.
3502 # At the same time testing -q FILE, < FILE and -t FILE
3503 t__put_body > ./.tin
3505 < ./.tin ${MAILX} ${ARGS} ${ADDARG_UNI} \
3506 -a ./.tin -s "`t__put_subject`" "${MBOX}"
3507 check 1 0 "${MBOX}" '1088822685 6642'
3509 ${rm} "${MBOX}"
3510 < /dev/null ${MAILX} ${ARGS} ${ADDARG_UNI} \
3511 -a ./.tin -s "`t__put_subject`" -q ./.tin "${MBOX}"
3512 check 2 0 "${MBOX}" '1088822685 6642'
3514 ${rm} "${MBOX}"
3515 ( echo "To: ${MBOX}" && echo "Subject: `t__put_subject`" && echo &&
3516 ${cat} ./.tin
3517 ) | ${MAILX} ${ARGS} ${ADDARG_UNI} -Snodot -a ./.tin -t
3518 check 3 0 "${MBOX}" '1088822685 6642'
3520 # Check comments in the header
3521 ${rm} "${MBOX}"
3522 ${cat} <<-_EOT | ${MAILX} ${ARGS} -Snodot -t "${MBOX}"
3523 # Ein Kommentar
3524 From: du@da
3525 # Noch ein Kommentar
3526 Subject: hey you
3527 # Nachgestelltes Kommentar
3529 BOOOM
3530 _EOT
3531 check 4 0 "${MBOX}" '4161555890 124'
3533 t_epilog
3536 t_message_injections() {
3537 # Simple, if we need more here, place in a later vim fold!
3538 t_prolog message_injections
3539 TRAP_EXIT_ADDONS="./.t*"
3541 t_xmta 'Echinacea Tue Jun 20 15:54:02 2017'
3543 echo mysig > ./.tmysig
3545 echo some-body | ${MAILX} ${ARGS} -Smta=./.tmta.sh \
3546 -Smessage-inject-head=head-inject \
3547 -Smessage-inject-tail=tail-inject \
3548 -Ssignature=./.tmysig \
3549 ex@am.ple > ./.tall 2>&1
3550 check 1 0 "${MBOX}" '2434746382 134'
3551 check 2 - .tall '4294967295 0' # empty file
3553 ${rm} "${MBOX}"
3554 ${cat} <<-_EOT > ./.template
3555 From: me
3556 To: ex1@am.ple
3557 Cc: ex2@am.ple
3558 Subject: This subject is
3560 Body, body, body me.
3561 _EOT
3562 < ./.template ${MAILX} ${ARGS} -t -Smta=./.tmta.sh \
3563 -Smessage-inject-head=head-inject \
3564 -Smessage-inject-tail=tail-inject \
3565 -Ssignature=./.tmysig \
3566 > ./.tall 2>&1
3567 check 3 0 "${MBOX}" '3114203412 198'
3568 check 4 - .tall '4294967295 0' # empty file
3570 t_epilog
3573 t_attachments() {
3574 # Relatively Simple, if we need more here, place in a later vim fold!
3575 t_prolog attachments
3576 TRAP_EXIT_ADDONS="./.t*"
3578 t_xmta 'Cannabis Sun Feb 18 02:02:46 2018'
3580 ${cat} <<-_EOT > ./.tx
3581 From steffen Sun Feb 18 02:48:40 2018
3582 Date: Sun, 18 Feb 2018 02:48:40 +0100
3584 Subject: m1
3585 User-Agent: s-nail v14.9.7
3588 From steffen Sun Feb 18 02:48:42 2018
3589 Date: Sun, 18 Feb 2018 02:48:42 +0100
3591 Subject: m2
3592 User-Agent: s-nail v14.9.7
3595 _EOT
3596 echo att1 > ./.t1
3597 printf 'att2-1\natt2-2\natt2-4\n' > ./'.t 2'
3598 printf 'att3-1\natt3-2\natt3-4\n' > ./.t3
3599 printf 'att4-1\natt4-2\natt4-4\n' > './.t 4'
3601 printf \
3602 '!@ ./.t3 "./.t 4" ""
3605 ./.t3
3606 "./.t 2"
3609 !.' \
3610 | ${MAILX} ${ARGS} -Sescape=! -Smta=./.tmta.sh \
3611 -a ./.t1 -a './.t 2' \
3612 -s attachment-test \
3613 ex@am.ple > ./.tall 2>&1
3614 check 1 0 "${MBOX}" '4107062253 634'
3615 if have_feat uistrings; then
3616 check 2 - .tall '1928331872 720'
3617 else
3618 echo 'attachments-2: unsupported, skipped'
3621 ${rm} "${MBOX}"
3622 printf \
3623 'mail ex@amp.ple
3624 !s This the subject is
3625 !@ ./.t3 "#2" "./.t 4" "#1" ""
3628 "./.t 4"
3629 "#2"
3633 mail ex@amp.ple
3634 !s Subject two
3635 !@ ./.t3 "#2" "./.t 4" "#1" ""
3641 mail ex@amp.ple
3642 !s Subject three
3643 !@ ./.t3 "" "#2" "" "./.t 4" "" "#1" ""
3646 ./.t3
3650 mail ex@amp.ple
3651 !s Subject Four
3652 !@ ./.t3 "" "#2" "" "./.t 4" "" "#1" ""
3655 "#1"
3659 mail ex@amp.ple
3660 !s Subject Five
3662 "#2"
3665 !.' \
3666 | ${MAILX} ${ARGS} -Sescape=! -Smta=./.tmta.sh -Rf ./.tx \
3667 > ./.tall 2>&1
3668 check 3 0 "${MBOX}" '798122412 2285'
3669 if have_feat uistrings; then
3670 check 4 - .tall '2526106274 1910'
3671 else
3672 echo 'attachments-4: unsupported, skipped'
3675 ${rm} "${MBOX}"
3676 printf \
3677 'mail ex@amp.ple
3678 !s Subject One
3679 !@ "#."
3680 Body one.
3683 from 2
3684 mail ex@amp.ple
3685 !s Subject Two
3687 "#."
3689 Body two.
3692 reply 1 2
3693 !@ "#."
3697 "#."
3700 !.' \
3701 | ${MAILX} ${ARGS} -Sescape=! -Smta=./.tmta.sh -Rf ./.tx \
3702 > ./.tall 2>&1
3703 check 5 0 "${MBOX}" '2165311808 2276'
3704 if have_feat uistrings; then
3705 check 6 - .tall '3662598562 509'
3706 else
3707 echo 'attachments-6: unsupported, skipped'
3710 t_epilog
3713 t_rfc2231() {
3714 # (after attachments)
3715 t_prolog rfc2231
3716 TRAP_EXIT_ADDONS="./.t*"
3719 mkdir ./.ttt || exit 1
3720 cd ./.ttt || exit 2
3721 : > "ma'ger.txt"
3722 : > "'ger.txt"
3723 : > 'diet\ is \curd.txt'
3724 : > 'diet "is" curd.txt'
3725 : > höde-tröge.txt
3726 : > 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
3727 : > höde__tröge__müde__dätte__hätte__vuelle__guelle__aese__aesse__sauerliche__kräuter__österliche__grüße__mäh.txt
3728 : > hööööööööööööööööö_nöööööööööööööööööööööö_düüüüüüüüüüüüüüüüüüü_bäääääääääääääääääääääääh.txt
3729 : > ✆✆✆✆✆✆✆✆✆✆✆✆✆✆✆✆✆✆✆✆✆✆✆✆.txt
3731 echo bla | ${MAILX} ${ARGS} ${ADDARG_UNI} \
3732 -a "./.ttt/ma'ger.txt" -a "./.ttt/'ger.txt" \
3733 -a './.ttt/diet\ is \curd.txt' -a './.ttt/diet "is" curd.txt' \
3734 -a ./.ttt/höde-tröge.txt \
3735 -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 \
3736 -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 \
3737 -a ./.ttt/hööööööööööööööööö_nöööööööööööööööööööööö_düüüüüüüüüüüüüüüüüüü_bäääääääääääääääääääääääh.txt \
3738 -a ./.ttt/✆✆✆✆✆✆✆✆✆✆✆✆✆✆✆✆✆✆✆✆✆✆✆✆.txt \
3739 "${MBOX}"
3740 check 1 0 "${MBOX}" '3720896054 3088'
3742 # `resend' test, reusing $MBOX
3743 printf "Resend ./.t2\nx\n" | ${MAILX} ${ARGS} -Rf "${MBOX}"
3744 check 2 0 ./.t2 '3720896054 3088'
3746 printf "resend ./.t3\nx\n" | ${MAILX} ${ARGS} -Rf "${MBOX}"
3747 check 3 0 ./.t3 '3979736592 3133'
3749 t_epilog
3752 t_mime_types_load_control() {
3753 t_prolog mime_types_load_control
3754 if have_feat uistrings; then :; else
3755 echo 'mime_types_load_control: unsupported, skipped'
3756 return
3758 TRAP_EXIT_ADDONS="./.t*"
3760 ${cat} <<-_EOT > ./.tmts1
3761 @ application/mathml+xml mathml
3762 _EOT
3763 ${cat} <<-_EOT > ./.tmts2
3764 @ x-conference/x-cooltalk ice
3765 @ aga-aga aga
3766 @ application/aga-aga aga
3767 _EOT
3769 ${cat} <<-_EOT > ./.tmts1.mathml
3770 <head>nonsense ML</head>
3771 _EOT
3772 ${cat} <<-_EOT > ./.tmts2.ice
3773 Icy, icy road.
3774 _EOT
3775 printf 'of which the c\x01rack is coming soon' > ./.tmtsx.doom
3776 printf 'of which the c\x01rack is coming soon' > ./.tmtsx.aga
3778 printf '
3779 m %s
3780 Schub-di-du
3781 ~@ ./.tmts1.mathml
3782 ~@ ./.tmts2.ice
3783 ~@ ./.tmtsx.doom
3784 ~@ ./.tmtsx.aga
3786 File %s
3787 from*
3788 type
3790 ' "${MBOX}" "${MBOX}" |
3791 ${MAILX} ${ARGS} \
3792 -Smimetypes-load-control=f=./.tmts1,f=./.tmts2 \
3793 > ./.tout 2>&1
3794 check_ex0 1-estat
3795 ${cat} "${MBOX}" >> ./.tout
3796 check 1 - ./.tout '2716124839 2441'
3798 echo type | ${MAILX} ${ARGS} -R \
3799 -Smimetypes-load-control=f=./.tmts1,f=./.tmts3 \
3800 -f "${MBOX}" >> ./.tout 2>&1
3801 check 2 0 ./.tout '2093030907 3634'
3803 t_epilog
3805 # }}}
3807 # Around state machine, after basics {{{
3808 t_alternates() {
3809 t_prolog alternates
3810 TRAP_EXIT_ADDONS="./.t*"
3812 t_xmta 'Valeriana Sat Jul 08 15:54:03 2017'
3814 ${cat} <<- '__EOT' | ${MAILX} ${ARGS} -Smta=./.tmta.sh > ./.tall 2>&1
3815 echo --0
3816 alternates
3817 echo $?/$^ERRNAME
3818 alternates a1@b1 a2@b2 a3@b3
3819 echo $?/$^ERRNAME
3820 alternates
3821 echo $?/$^ERRNAME
3822 vput alternates rv
3823 echo $?/$^ERRNAME <$rv>
3825 echo --1
3826 unalternates a2@b2
3827 vput alternates rv
3828 echo $?/$^ERRNAME <$rv>
3829 unalternates a3@b3
3830 vput alternates rv
3831 echo $?/$^ERRNAME <$rv>
3832 unalternates a1@b1
3833 vput alternates rv
3834 echo $?/$^ERRNAME <$rv>
3836 echo --2
3837 unalternates *
3838 alternates a1@b1 a2@b2 a3@b3
3839 unalternates a3@b3
3840 vput alternates rv
3841 echo $?/$^ERRNAME <$rv>
3842 unalternates a2@b2
3843 vput alternates rv
3844 echo $?/$^ERRNAME <$rv>
3845 unalternates a1@b1
3846 vput alternates rv
3847 echo $?/$^ERRNAME <$rv>
3849 echo --3
3850 alternates a1@b1 a2@b2 a3@b3
3851 unalternates a1@b1
3852 vput alternates rv
3853 echo $?/$^ERRNAME <$rv>
3854 unalternates a2@b2
3855 vput alternates rv
3856 echo $?/$^ERRNAME <$rv>
3857 unalternates a3@b3
3858 vput alternates rv
3859 echo $?/$^ERRNAME <$rv>
3861 echo --4
3862 unalternates *
3863 alternates a1@b1 a2@b2 a3@b3
3864 unalternates *
3865 vput alternates rv
3866 echo $?/$^ERRNAME <$rv>
3868 echo --5
3869 unalternates *
3870 alternates a1@b1 a1@c1 a1@d1 a2@b2 a3@b3 a3@c3 a3@d3
3871 m a1@b1 a1@c1 a1@d1
3872 ~s all alternates, only a1@b1 remains
3873 ~c a2@b2
3874 ~b a3@b3 a3@c3 a3@d3
3875 ~r - '_EOT'
3876 This body is!
3877 This also body is!!
3878 _EOT
3881 echo --6
3882 unalternates *
3883 alternates a1@b1 a1@c1 a2@b2 a3@b3
3884 m a1@b1 a1@c1 a1@d1
3885 ~s a1@b1 a1@d1, and a3@c3 a3@d3 remain
3886 ~c a2@b2
3887 ~b a3@b3 a3@c3 a3@d3
3888 ~r - '_EOT'
3889 This body2 is!
3890 _EOT
3893 echo --7
3894 alternates a1@b1 a2@b2 a3; set allnet
3895 m a1@b1 a1@c1 a1@d1
3896 ~s all alternates via allnet, only a1@b1 remains
3897 ~c a2@b2
3898 ~b a3@b3 a3@c3 a3@d3
3899 ~r - '_EOT'
3900 This body3 is!
3901 _EOT
3904 echo --10
3905 unalternates *
3906 alternates a1@b1
3907 echo $?/$^ERRNAME
3908 vput alternates rv
3909 echo $?/$^ERRNAME <$rv>
3910 alternates a2@b2
3911 echo $?/$^ERRNAME
3912 vput alternates rv
3913 echo $?/$^ERRNAME <$rv>
3914 alternates a3@b3
3915 echo $?/$^ERRNAME
3916 vput alternates rv
3917 echo $?/$^ERRNAME <$rv>
3918 alternates a4@b4
3919 echo $?/$^ERRNAME
3920 vput alternates rv
3921 echo $?/$^ERRNAME <$rv>
3923 unalternates *
3924 vput alternates rv
3925 echo $?/$^ERRNAME <$rv>
3927 echo --11
3928 set posix
3929 alternates a1@b1 a2@b2
3930 echo $?/$^ERRNAME
3931 vput alternates rv
3932 echo $?/$^ERRNAME <$rv>
3933 alternates a3@b3 a4@b4
3934 echo $?/$^ERRNAME
3935 vput alternates rv
3936 echo $?/$^ERRNAME <$rv>
3937 __EOT
3939 check 1 0 "${MBOX}" '142184864 515'
3940 if have_feat uistrings; then
3941 check 2 - .tall '1878598364 505'
3942 else
3943 echo 'alternates-2: unsupported, skipped'
3946 # Automatic alternates, also from command line (freezing etc.)
3947 ${rm} "${MBOX}"
3948 ${cat} <<- __EOT > ./.tin
3949 From trouble-report@desy Wed Jun 6 20:19:28 2018
3950 Date: Wed, 06 Jun 2018 19:58:02 +0200
3951 From: a@b.org, b@b.org, c@c.org
3952 Sender: a@b.org
3953 To: b@b.org
3954 Cc: a@b.org, c@c.org
3955 Subject: test
3956 Message-ID: <20180606175802.dw-cn%a@b.org>
3958 sultry
3960 __EOT
3962 printf '#
3963 reply
3965 b@b.org
3966 a@b.org b@b.org c@c.org
3969 my body
3971 ' | ${MAILX} ${ARGS} -Smta=./.tmta.sh -Sescape=! \
3972 -S from=a@b.org,b@b.org,c@c.org -S sender=a@b.org \
3973 -Rf ./.tin > ./.tall 2>&1
3974 check 3 0 "${MBOX}" '287250471 256'
3975 check 4 - .tall '4294967295 0'
3977 # same, per command
3978 printf '#
3979 set from=a@b.org,b@b.org,c@c.org sender=a@b.org
3980 reply
3982 b@b.org
3983 a@b.org b@b.org c@c.org
3986 my body
3988 ' | ${MAILX} ${ARGS} -Smta=./.tmta.sh -Sescape=! \
3989 -Rf ./.tin > ./.tall 2>&1
3990 check 5 0 "${MBOX}" '2618762028 512'
3991 check 6 - .tall '4294967295 0'
3993 # And more, with/out -r
3994 # TODO -r should be the Sender:, which should automatically propagate to
3995 # TODO From: if possible and/or necessary. It should be possible to
3996 # TODO suppres -r stuff from From: and Sender:, but fallback to special -r
3997 # TODO arg as appropriate.
3998 # TODO For now we are a bit messy
4000 ${rm} "${MBOX}"
4001 </dev/null ${MAILX} ${ARGS} -Smta=./.tmta.sh -s '-Sfrom + -r ++ test' \
4002 -c a@b.example,b@b.example,c@c.example \
4003 -S from=a@b.example,b@b.example,c@c.example \
4004 -S sender=a@b.example \
4005 -r a@b.example b@b.example ./.tout >./.tall 2>&1
4006 check 7 0 "${MBOX}" '3510981487 192'
4007 check 8 - .tout '2052716617 201'
4008 check 9 - .tall '4294967295 0'
4010 </dev/null ${MAILX} ${ARGS} -Smta=./.tmta.sh -s '-Sfrom + -r ++ test' \
4011 -c a@b.example,b@b.example,c@c.example \
4012 -S from=a@b.example,b@b.example,c@c.example \
4013 -r a@b.example b@b.example ./.tout >./.tall 2>&1
4014 check 10 0 "${MBOX}" '2282326606 364'
4015 check 11 - .tout '3213404599 382'
4016 check 12 - .tall '4294967295 0'
4018 </dev/null ${MAILX} ${ARGS} -Smta=./.tmta.sh -s '-Sfrom + -r ++ test' \
4019 -c a@b.example,b@b.example,c@c.example \
4020 -S from=a@b.example,b@b.example,c@c.example \
4021 -S sender=a@b.example \
4022 b@b.example >./.tall 2>&1
4023 check 13 0 "${MBOX}" '1460017970 582'
4024 check 14 - .tall '4294967295 0'
4026 t_epilog
4029 t_quote_a_cmd_escapes() {
4030 t_prolog quote_a_cmd_escapes
4031 TRAP_EXIT_ADDONS="./.t*"
4033 t_xmta
4035 echo 'included file' > ./.ttxt
4037 ${cat} <<-_EOT > ./.tmbox
4038 From neverneverland Sun Jul 23 13:46:25 2017
4039 Subject: Bugstop: five miles out 1
4040 Reply-To: mister originator1 <mr1@originator>
4041 From: mister originator1 <mr1@originator>
4042 To: bugstop-commit@five.miles.out
4043 Cc: is1@a.list
4044 In-reply-to: <20170719111113.bkcMz%laber1@backe.eu>
4045 Date: Wed, 19 Jul 2017 09:22:57 -0400
4046 Message-Id: <20170719132257.766AF781267-1@originator>
4047 Status: RO
4049 That's appalling, I.
4051 From neverneverland Sun Jul 23 13:47:25 2017
4052 Subject: Bugstop: five miles out 2
4053 Reply-To: mister originator2 <mr2@originator>
4054 From: mister originator2 <mr2@originator>
4055 To: bugstop-commit@five.miles.out
4056 Cc: is2@a.list
4057 In-reply-to: <20170719111113.bkcMz%laber2@backe.eu>
4058 Date: Wed, 19 Jul 2017 09:23:57 -0400
4059 Message-Id: <20170719132257.766AF781267-2@originator>
4060 Status: RO
4062 That's appalling, II.
4064 From neverneverland Sun Jul 23 13:48:25 2017
4065 Subject: Bugstop: five miles out 3
4066 Reply-To: mister originator3 <mr3@originator>
4067 From: mister originator3 <mr3@originator>
4068 To: bugstop-commit@five.miles.out
4069 Cc: is3@a.list
4070 In-reply-to: <20170719111113.bkcMz%laber3@backe.eu>
4071 Date: Wed, 19 Jul 2017 09:24:57 -0400
4072 Message-Id: <20170719132257.766AF781267-3@originator>
4073 Status: RO
4075 That's appalling, III.
4077 _EOT
4079 printf '#
4080 set indentprefix=" |"
4081 set quote
4082 reply 2
4084 set quote=noheading
4085 reply 2
4087 headerpick type retain cc date from message-id reply-to subject to
4088 set quote=headers
4089 reply 2
4091 set quote=allheaders
4092 reply 2
4094 ' | ${MAILX} ${ARGS} -Smta=./.tmta.sh -Rf \
4095 -Sescape=! -Sindentprefix=' >' \
4096 ./.tmbox >./.tall 2>&1
4097 check_ex0 1-estat
4098 ${cat} ./.tall >> "${MBOX}"
4099 check 1 0 "${MBOX}" '2181726970 2023'
4101 # ~@ is tested with other attachment stuff, ~^ is in compose_hooks
4102 ${rm} "${MBOX}"
4103 printf '#
4104 set Sign=SignVar sign=signvar DEAD=./.ttxt
4105 headerpick type retain Subject
4106 reply 2
4107 !!1 Not escaped. And shell test last, right before !..
4108 !: echo 2 only echoed via colon
4109 !_ echo 3 only echoed via underscore
4110 !< ./.ttxt
4111 !<! echo 5 shell echo included
4112 !| echo 6 pipecmd-pre; cat; echo 6 pipecmd-post
4113 7 and 8 are ~A and ~a:
4116 !b 9 added ~b cc <ex1@am.ple>
4117 !c 10 added ~c c <ex2@am.ple>
4118 11 next ~d / $DEAD
4120 12: ~F
4122 13: ~F 1 3
4123 !F 1 3
4124 14: ~f (headerpick: subject)
4126 15: ~f 1
4127 !f 1
4128 16, 17: ~I Sign, ~i Sign
4129 !I Sign
4130 !i Sign
4131 18: ~M
4133 19: ~M 1
4134 !M 1
4135 20: ~m
4137 21: ~m 3
4138 !m 3
4139 28-32: ~Q; 28: ~Q
4141 29: ~Q 1 3
4142 !Q 1 3
4143 set quote
4144 !:set quote
4145 30: ~Q
4147 31: ~Q 1 3
4148 !Q 1 3
4149 set quote-inject-head quote-inject-tail indentprefix
4150 !:wysh set quote-inject-head=%%a quote-inject-tail=--%%r
4151 32: ~Q
4153 unset quote stuff
4154 !:unset quote quote-inject-head quote-inject-tail
4155 22: ~R ./.ttxt
4156 !R ./.ttxt
4157 23: ~r ./.ttxt
4158 !r ./.ttxt
4159 24: ~s this new subject
4160 !s 24 did new ~s ubject
4161 !t 25 added ~t o <ex3@am.ple>
4162 26: ~U
4164 27: ~U 1
4165 !U 1
4166 and i ~w rite this out to ./.tmsg
4167 !w ./.tmsg
4168 !:wysh set x=$escape;set escape=~
4169 ~!echo shell command output
4170 ~:wysh set escape=$x
4172 ' | ${MAILX} ${ARGS} -Smta=./.tmta.sh -Rf \
4173 -Sescape=! -Sindentprefix=' |' \
4174 ./.tmbox >./.tall 2>&1
4175 check_ex0 2-estat
4176 ${cat} ./.tall >> "${MBOX}"
4177 check 2 - "${MBOX}" '2613898218 4090'
4178 check 3 - ./.tmsg '2771314896 3186'
4180 t_epilog
4183 t_compose_edits() { # XXX very rudimentary
4184 t_prolog compose_edits
4185 TRAP_EXIT_ADDONS="./.t*"
4187 ${cat} <<-_EOT > ./.ted.sh
4188 #!${SHELL}
4189 ${cat} <<-__EOT > \${1}
4190 Fcc: .tout1
4192 Fcc: .tout2
4193 Subject: Fcc test 1
4194 Fcc: .tout3
4196 A body
4197 __EOT
4198 exit 0
4199 _EOT
4200 chmod 0755 .ted.sh
4202 # > All these are in-a-row!
4204 printf 'mail ./.tout\n~s This subject is\nThis body is\n~.' |
4205 ${MAILX} ${ARGS} -Seditheaders >./.tall 2>&1
4206 check 1 0 ./.tout '3993703854 127'
4207 check 2 - ./.tall '4294967295 0'
4209 ${mv} ./.tall ./.tout
4210 printf 'mail ./.tout\n~s This subject is\nThis body is\n~e\n~.' |
4211 ${MAILX} ${ARGS} -Seditheaders -SEDITOR=./.ted.sh >./.tall 2>&1
4212 check 3 0 ./.tout1 '285981670 116'
4213 check 4 - ./.tout2 '285981670 116'
4214 check 5 - ./.tout3 '285981670 116'
4215 check 6 - ./.tout '4294967295 0'
4216 check 7 - ./.tall '4294967295 0'
4217 ${rm} ./.tout1 ./.tout2 ./.tout3
4219 # t_compose_hooks will test ~^ at edge
4220 ${mv} ./.tout ./.tout1
4221 ${mv} ./.tall ./.tout2
4222 printf '#
4223 mail ./.tout\n!s This subject is\nThis body is
4224 !^header list
4225 !^header list fcc
4226 !^header show fcc
4227 !^header remove to
4228 !^header insert fcc ./.tout
4229 !^header insert fcc .tout1
4230 !^header insert fcc ./.tout2
4231 !^header list
4232 !^header show fcc
4233 !^header remove-at fcc 2
4234 !^header remove-at fcc 2
4235 !^header show fcc
4236 !^head remove fcc
4237 !^header show fcc
4238 !^header insert fcc ./.tout
4239 !^header show fcc
4240 !^header list
4242 ' | ${MAILX} ${ARGS} -Sescape=! >./.tall 2>&1
4243 check 8 0 ./.tout '3993703854 127'
4244 check 9 - ./.tout1 '4294967295 0'
4245 check 10 - ./.tout2 '4294967295 0'
4246 check 11 - ./.tall '4280910245 300'
4248 # < No longer in-a-row
4250 ${cat} <<-_EOT | ${MAILX} ${ARGS} -t >./.tall 2>&1
4251 Fcc: .ttout
4252 Subject: Fcc via -t test
4254 My body
4255 _EOT
4256 check 12 0 ./.ttout '1289478830 122'
4257 check 13 - ./.tall '4294967295 0'
4259 t_epilog
4262 t_digmsg() { # XXX rudimentary
4263 t_prolog digmsg
4264 TRAP_EXIT_ADDONS="./.t*"
4266 printf '#
4267 mail ./.tout\n!s This subject is\nThis body is
4268 !:echo --one
4269 !:digmsg create - -
4270 !:digmsg - header list
4271 !:digmsg - header show subject
4272 !:digmsg - header show to
4273 !:digmsg - header remove to
4274 !:digmsg - header list
4275 !:digmsg - header show to
4276 !:digmsg remove -
4277 !:echo --two
4278 !:digmsg create -
4279 !:digmsg - header list; readall x; echon "<$x>";
4280 !:digmsg - header show subject;readall x;echon "<$x>";;
4281 !:digmsg remove -
4282 !:echo --three
4283 !: # nothing here as is comment
4284 !^header insert fcc ./.tbox
4285 !:echo --four
4286 !:digmsg create - -
4287 !:digmsg - header list
4288 !:digmsg - header show fcc
4289 !:echo --five
4290 !^head remove fcc
4291 !:echo --six
4292 !:digmsg - header list
4293 !:digmsg - header show fcc
4294 !:digmsg - header insert fcc ./.tfcc
4295 !:echo --seven
4296 !:digmsg remove -
4297 !:echo bye
4299 echo --hello again
4300 File ./.tfcc
4301 echo --one
4302 digmsg create 1 -
4303 digmsg 1 header list
4304 digmsg 1 header show subject
4305 echo --two
4306 ! : > ./.tempty
4307 File ./.tempty
4308 echo --three
4309 digmsg 1 header list; echo $?/$^ERRNAME
4310 digmsg create -; echo $?/$^ERRNAME
4311 echo ==========
4312 ! %s ./.tfcc > ./.tcat
4313 ! %s "s/This subject is/There subject was/" < ./.tfcc >> ./.tcat
4314 File ./.tcat
4315 mail nowhere@exam.ple
4316 !:echo ===1
4317 !:digmsg create -; echo $?/$^ERRNAME;\\
4318 digmsg create 1; echo $?/$^ERRNAME;\\
4319 digmsg create 2; echo $?/$^ERRNAME
4320 !:echo ===2.1
4321 !:digmsg - h l;echo $?/$^ERRNAME;readall d;echo "$?/$^ERRNAME <$d>"
4322 !:echo =2.2
4323 !:digmsg 1 h l;echo $?/$^ERRNAME;readall d;echo "$?/$^ERRNAME <$d>"
4324 !:echo =2.3
4325 !^ h l
4326 !:echo =2.4
4327 !:digmsg 2 h l;echo $?/$^ERRNAME;readall d;echo "$?/$^ERRNAME <$d>"
4328 !:echo ===3.1
4329 !:digmsg - h s to;echo $?/$^ERRNAME;readall d;echo "$?/$^ERRNAME <$d>"
4330 !:echo =3.2
4331 !:digmsg 1 h s subject;echo $?/$^ERRNAME;readall d;echo "$?/$^ERRNAME <$d>"
4332 !:echo =3.3
4333 !^ h s to
4334 !:echo =3.4
4335 !:digmsg 2 h s subject;echo $?/$^ERRNAME;readall d;echo "$?/$^ERRNAME <$d>"
4336 !:echo ==4.1
4337 !:digmsg remove -; echo $?/$^ERRNAME;\\
4338 digmsg remove 1; echo $?/$^ERRNAME;\\
4339 digmsg remove 2; echo $?/$^ERRNAME;
4341 echo --bye
4342 ' "${cat}" "${sed}" | ${MAILX} ${ARGS} -Sescape=! >./.tall 2>&1
4343 check_ex0 1-estat
4344 if have_feat uistrings; then
4345 check 1 - ./.tall '362777535 1087'
4346 else
4347 check 1 - ./.tall '4281367066 967'
4349 check 2 - ./.tfcc '3993703854 127'
4350 check 3 - ./.tempty '4294967295 0'
4351 check 4 - ./.tcat '2157992522 256'
4353 t_epilog
4356 # }}}
4358 # Heavy use of/rely on state machine (behaviour) and basics {{{
4359 t_compose_hooks() { # {{{ TODO monster
4360 t_prolog compose_hooks
4361 if have_feat uistrings; then :; else
4362 echo 'compose_hooks: unsupported, skipped'
4363 return
4365 TRAP_EXIT_ADDONS="./.t*"
4367 t_xmta 'PrimulaVeris Wed Apr 10 22:59:00 2017'
4369 (echo line one&&echo line two&&echo line three) > ./.treadctl
4370 (echo echo four&&echo echo five&&echo echo six) > ./.tattach
4372 ${cat} <<'__EOT__' > ./.trc
4373 define bail {
4374 echoerr "Failed: $1. Bailing out"; echo "~x"; xit
4376 define xerr {
4377 vput vexpr es substr "$1" 0 1
4378 if [ "$es" != 2 ]
4379 xcall bail "$2"
4382 define read_mline_res {
4383 read hl; wysh set len=$? es=$! en=$^ERRNAME;\
4384 echo $len/$es/$^ERRNAME: $hl
4385 if [ $es -ne $^ERR-NONE ]
4386 xcall bail read_mline_res
4387 elif [ $len -ne 0 ]
4388 \xcall read_mline_res
4391 define ins_addr {
4392 wysh set xh=$1
4393 echo "~^header list"; read hl; echo $hl;\
4394 call xerr "$hl" "in_addr ($xh) 0-1"
4396 echo "~^header insert $xh diet <$xh@exam.ple> spliced";\
4397 read es; echo $es; call xerr "$es" "ins_addr $xh 1-1"
4398 echo "~^header insert $xh <${xh}2@exam.ple>";\
4399 read es; echo $es; call xerr "$es" "ins_addr $xh 1-2"
4400 echo "~^header insert $xh ${xh}3@exam.ple";\
4401 read es; echo $es; call xerr "$es" "ins_addr $xh 1-3"
4402 echo "~^header list $xh"; read hl; echo $hl;\
4403 call xerr "$hl" "ins_addr $xh 1-4"
4404 echo "~^header show $xh"; read es; call xerr $es "ins_addr $xh 1-5"
4405 call read_mline_res
4407 if [ "$t_remove" == "" ]
4408 return
4411 echo "~^header remove $xh"; read es; call xerr $es "ins_addr $xh 2-1"
4412 echo "~^header remove $xh"; read es; vput vexpr es substr $es 0 3
4413 if [ $es != 501 ]
4414 xcall bail "ins_addr $xh 2-2"
4416 echo "~^header list $xh"; read es; vput vexpr es substr $es 0 3
4417 if [ $es != 501 ]
4418 xcall bail "ins_addr $xh 2-3"
4420 echo "~^header show $xh"; read es; vput vexpr es substr $es 0 3
4421 if [ $es != 501 ]
4422 xcall bail "ins_addr $xh 2-4"
4426 echo "~^header insert $xh diet <$xh@exam.ple> spliced";\
4427 read es; echo $es; call xerr "$es" "ins_addr $xh 3-1"
4428 echo "~^header insert $xh <${xh}2@exam.ple>";\
4429 read es; echo $es; call xerr "$es" "ins_addr $xh 3-2"
4430 echo "~^header insert $xh ${xh}3@exam.ple";\
4431 read es; echo $es; call xerr "$es" "ins_addr $xh 3-3"
4432 echo "~^header list $xh"; read hl; echo $hl;\
4433 call xerr "$hl" "ins_addr $xh 3-4"
4434 echo "~^header show $xh"; read es; call xerr $es "ins_addr $xh 3-5"
4435 call read_mline_res
4437 echo "~^header remove-at $xh 1"; read es;\
4438 call xerr $es "ins_addr $xh 3-6"
4439 echo "~^header remove-at $xh 1"; read es;\
4440 call xerr $es "ins_addr $xh 3-7"
4441 echo "~^header remove-at $xh 1"; read es;\
4442 call xerr $es "ins_addr $xh 3-8"
4443 echo "~^header remove-at $xh 1"; read es;\
4444 vput vexpr es substr $es 0 3
4445 if [ $es != 501 ]
4446 xcall bail "ins_addr $xh 3-9"
4448 echo "~^header remove-at $xh T"; read es;\
4449 vput vexpr es substr $es 0 3
4450 if [ $es != 505 ]
4451 xcall bail "ins_addr $xh 3-10"
4453 echo "~^header list $xh"; read es;\
4454 vput vexpr es substr $es 0 3
4455 if [ $es != 501 ]
4456 xcall bail "ins_addr $xh 3-11"
4458 echo "~^header show $xh"; read es;\
4459 vput vexpr es substr $es 0 3
4460 if [ $es != 501 ]
4461 xcall bail "ins_addr $xh 3-12"
4465 echo "~^header insert $xh diet <$xh@exam.ple> spliced";\
4466 read es; echo $es; call xerr "$es" "ins_addr $xh 4-1"
4467 echo "~^header insert $xh <${xh}2@exam.ple> (comment) \"Quot(e)d\"";\
4468 read es; echo $es; call xerr "$es" "ins_addr $xh 4-2"
4469 echo "~^header insert $xh ${xh}3@exam.ple";\
4470 read es; echo $es; call xerr "$es" "ins_addr $xh 4-3"
4471 echo "~^header list $xh"; read hl; echo $hl;\
4472 call xerr "$hl" "header list $xh 3-4"
4473 echo "~^header show $xh"; read es; call xerr $es "ins_addr $xh 4-5"
4474 call read_mline_res
4476 echo "~^header remove-at $xh 3"; read es;\
4477 call xerr $es "ins_addr $xh 4-6"
4478 echo "~^header remove-at $xh 2"; read es;\
4479 call xerr $es "ins_addr $xh 4-7"
4480 echo "~^header remove-at $xh 1"; read es;\
4481 call xerr $es "ins_addr $xh 4-8"
4482 echo "~^header remove-at $xh 1"; read es;\
4483 vput vexpr es substr $es 0 3
4484 if [ $es != 501 ]
4485 xcall bail "ins_addr $xh 4-9"
4487 echo "~^header remove-at $xh T"; read es;\
4488 vput vexpr es substr $es 0 3
4489 if [ $es != 505 ]
4490 xcall bail "ins_addr $xh 4-10"
4492 echo "~^header list $xh"; read es;\
4493 vput vexpr es substr $es 0 3
4494 if [ $es != 501 ]
4495 xcall bail "ins_addr $xh 4-11"
4497 echo "~^header show $xh"; read es;\
4498 vput vexpr es substr $es 0 3
4499 if [ $es != 501 ]
4500 xcall bail "ins_addr $xh 4-12"
4503 define ins_ref {
4504 wysh set xh=$1 mult=$2
4505 echo "~^header list"; read hl; echo $hl;\
4506 call xerr "$hl" "ins_ref ($xh) 0-1"
4508 echo "~^header insert $xh <$xh@exam.ple>";\
4509 read es; echo $es; call xerr "$es" "ins_ref $xh 1-1"
4510 if [ $mult -ne 0 ]
4511 echo "~^header insert $xh <${xh}2@exam.ple>";\
4512 read es; echo $es; call xerr "$es" "ins_ref $xh 1-2"
4513 echo "~^header insert $xh ${xh}3@exam.ple";\
4514 read es; echo $es; call xerr "$es" "ins_ref $xh 1-3"
4515 else
4516 echo "~^header insert $xh <${xh}2@exam.ple>"; read es;\
4517 vput vexpr es substr $es 0 3
4518 if [ $es != 506 ]
4519 xcall bail "ins_ref $xh 1-4"
4523 echo "~^header list $xh"; read hl; echo $hl;\
4524 call xerr "$hl" "ins_ref $xh 1-5"
4525 echo "~^header show $xh"; read es; call xerr $es "ins_ref $xh 1-6"
4526 call read_mline_res
4528 if [ "$t_remove" == "" ]
4529 return
4532 echo "~^header remove $xh"; read es;\
4533 call xerr $es "ins_ref $xh 2-1"
4534 echo "~^header remove $xh"; read es;\
4535 vput vexpr es substr $es 0 3
4536 if [ $es != 501 ]
4537 xcall bail "ins_ref $xh 2-2"
4539 echo "~^header list $xh"; read es;\
4540 vput vexpr es substr $es 0 3
4541 if [ $es != 501 ]
4542 xcall bail "$es ins_ref $xh 2-3"
4544 echo "~^header show $xh"; read es;\
4545 vput vexpr es substr $es 0 3
4546 if [ $es != 501 ]
4547 xcall bail "ins_ref $xh 2-4"
4551 echo "~^header insert $xh <$xh@exam.ple>";\
4552 read es; echo $es; call xerr "$es" "ins_ref $xh 3-1"
4553 if [ $mult -ne 0 ]
4554 echo "~^header insert $xh <${xh}2@exam.ple>";\
4555 read es; echo $es; call xerr "$es" "ins_ref $xh 3-2"
4556 echo "~^header insert $xh ${xh}3@exam.ple";\
4557 read es; echo $es; call xerr "$es" "ins_ref $xh 3-3"
4559 echo "~^header list $xh";\
4560 read hl; echo $hl; call xerr "$hl" "ins_ref $xh 3-4"
4561 echo "~^header show $xh";\
4562 read es; call xerr $es "ins_ref $xh 3-5"
4563 call read_mline_res
4565 echo "~^header remove-at $xh 1"; read es;\
4566 call xerr $es "ins_ref $xh 3-6"
4567 if [ $mult -ne 0 ] && [ $xh != subject ]
4568 echo "~^header remove-at $xh 1"; read es;\
4569 call xerr $es "ins_ref $xh 3-7"
4570 echo "~^header remove-at $xh 1"; read es;\
4571 call xerr $es "ins_ref $xh 3-8"
4573 echo "~^header remove-at $xh 1"; read es;\
4574 vput vexpr es substr $es 0 3
4575 if [ $es != 501 ]
4576 xcall bail "ins_ref $xh 3-9"
4578 echo "~^header remove-at $xh T"; read es;\
4579 vput vexpr es substr $es 0 3
4580 if [ $es != 505 ]
4581 xcall bail "ins_ref $xh 3-10"
4583 echo "~^header show $xh"; read es;\
4584 vput vexpr es substr $es 0 3
4585 if [ $es != 501 ]
4586 xcall bail "ins_ref $xh 3-11"
4590 echo "~^header insert $xh <$xh@exam.ple> ";\
4591 read es; echo $es; call xerr "$es" "ins_ref $xh 4-1"
4592 if [ $mult -ne 0 ]
4593 echo "~^header insert $xh <${xh}2@exam.ple> ";\
4594 read es; echo $es; call xerr "$es" "ins_ref $xh 4-2"
4595 echo "~^header insert $xh ${xh}3@exam.ple";\
4596 read es; echo $es; call xerr "$es" "ins_ref $xh 4-3"
4598 echo "~^header list $xh"; read hl; echo $hl;\
4599 call xerr "$hl" "ins_ref $xh 4-4"
4600 echo "~^header show $xh"; read es; call xerr $es "ins_ref $xh 4-5"
4601 call read_mline_res
4603 if [ $mult -ne 0 ] && [ $xh != subject ]
4604 echo "~^header remove-at $xh 3"; read es;\
4605 call xerr $es "ins_ref $xh 4-6"
4606 echo "~^header remove-at $xh 2"; read es;\
4607 call xerr $es "ins_ref $xh 4-7"
4609 echo "~^header remove-at $xh 1"; read es;\
4610 call xerr $es "ins_ref $xh 4-8"
4611 echo "~^header remove-at $xh 1"; read es;\
4612 vput vexpr es substr $es 0 3
4613 if [ $es != 501 ]
4614 xcall bail "ins_ref $xh 4-9"
4616 echo "~^header remove-at $xh T"; read es;\
4617 vput vexpr es substr $es 0 3
4618 if [ $es != 505 ]
4619 xcall bail "ins_ref $xh 4-10"
4621 echo "~^header show $xh"; read es;\
4622 vput vexpr es substr $es 0 3
4623 if [ $es != 501 ]
4624 xcall bail "ins_ref $xh 4-11"
4627 define t_header {
4628 echo t_header ENTER
4629 # In collect.c order
4630 call ins_addr from
4631 call ins_ref sender 0 # Not a "ref", but works
4632 call ins_addr To
4633 call ins_addr cC
4634 call ins_addr bCc
4635 call ins_addr reply-To
4636 call ins_addr mail-Followup-to
4637 call ins_ref messAge-id 0
4638 call ins_ref rEfErEncEs 1
4639 call ins_ref in-Reply-to 1
4640 call ins_ref subject 1 # Not a "ref", but works (with tweaks)
4641 call ins_addr freeForm1
4642 call ins_addr freeform2
4644 echo "~^header show MAILX-Command"; read es; call xerr $es "t_header 1000"
4645 call read_mline_res
4646 echo "~^header show MAILX-raw-TO"; read es; call xerr $es "t_header 1001"
4647 call read_mline_res
4649 echo t_header LEAVE
4651 define t_attach {
4652 echo t_attach ENTER
4654 echo "~^attachment";\
4655 read hl; echo $hl; vput vexpr es substr "$hl" 0 3
4656 if [ "$es" != 501 ]
4657 xcall bail "attach 0-1"
4660 echo "~^attach attribute ./.treadctl";\
4661 read hl; echo $hl; vput vexpr es substr "$hl" 0 3
4662 if [ "$es" != 501 ]
4663 xcall bail "attach 0-2"
4665 echo "~^attachment attribute-at 1";\
4666 read hl; echo $hl; vput vexpr es substr "$hl" 0 3
4667 if [ "$es" != 501 ]
4668 xcall bail "attach 0-3"
4671 echo "~^attachment insert ./.treadctl=ascii";\
4672 read hl; echo $hl; call xerr "$hl" "attach 1-1"
4673 echo "~^attachment list";\
4674 read es; echo $es;call xerr "$es" "attach 1-2"
4675 call read_mline_res
4676 echo "~^attachment attribute ./.treadctl";\
4677 read es; echo $es;call xerr "$es" "attach 1-3"
4678 call read_mline_res
4679 echo "~^attachment attribute .treadctl";\
4680 read es; echo $es;call xerr "$es" "attach 1-4"
4681 call read_mline_res
4682 echo "~^attachment attribute-at 1";\
4683 read es; echo $es;call xerr "$es" "attach 1-5"
4684 call read_mline_res
4686 echo "~^attachment attribute-set ./.treadctl filename rctl";\
4687 read es; echo $es;call xerr "$es" "attach 1-6"
4688 echo "~^attachment attribute-set .treadctl content-description Au";\
4689 read es; echo $es;call xerr "$es" "attach 1-7"
4690 echo "~^attachment attribute-set-at 1 content-id <10.du@ich>";\
4691 read es; echo $es;call xerr "$es" "attach 1-8"
4693 echo "~^attachment attribute ./.treadctl";\
4694 read es; echo $es;call xerr "$es" "attach 1-9"
4695 call read_mline_res
4696 echo "~^attachment attribute .treadctl";\
4697 read es; echo $es;call xerr "$es" "attach 1-10"
4698 call read_mline_res
4699 echo "~^attachment attribute rctl";\
4700 read es; echo $es;call xerr "$es" "attach 1-11"
4701 call read_mline_res
4702 echo "~^attachment attribute-at 1";\
4703 read es; echo $es;call xerr "$es" "attach 1-12"
4704 call read_mline_res
4707 echo "~^attachment insert ./.tattach=latin1";\
4708 read hl; echo $hl; call xerr "$hl" "attach 2-1"
4709 echo "~^attachment list";\
4710 read es; echo $es;call xerr "$es" "attach 2-2"
4711 call read_mline_res
4712 echo "~^attachment attribute ./.tattach";\
4713 read es; echo $es;call xerr "$es" "attach 2-3"
4714 call read_mline_res
4715 echo "~^attachment attribute .tattach";\
4716 read es; echo $es;call xerr "$es" "attach 2-4"
4717 call read_mline_res
4718 echo "~^attachment attribute-at 2";\
4719 read es; echo $es;call xerr "$es" "attach 2-5"
4720 call read_mline_res
4722 echo "~^attachment attribute-set ./.tattach filename tat";\
4723 read es; echo $es;call xerr "$es" "attach 2-6"
4724 echo \
4725 "~^attachment attribute-set .tattach content-description Au2";\
4726 read es; echo $es;call xerr "$es" "attach 2-7"
4727 echo "~^attachment attribute-set-at 2 content-id <20.du@wir>";\
4728 read es; echo $es;call xerr "$es" "attach 2-8"
4729 echo \
4730 "~^attachment attribute-set-at 2 content-type application/x-sh";\
4731 read es; echo $es;call xerr "$es" "attach 2-9"
4733 echo "~^attachment attribute ./.tattach";\
4734 read es; echo $es;call xerr "$es" "attach 2-10"
4735 call read_mline_res
4736 echo "~^attachment attribute .tattach";\
4737 read es; echo $es;call xerr "$es" "attach 2-11"
4738 call read_mline_res
4739 echo "~^attachment attribute tat";\
4740 read es; echo $es;call xerr "$es" "attach 2-12"
4741 call read_mline_res
4742 echo "~^attachment attribute-at 2";\
4743 read es; echo $es;call xerr "$es" "attach 2-13"
4744 call read_mline_res
4747 if [ "$t_remove" == "" ]
4748 return
4751 echo "~^attachment remove ./.treadctl"; read es;\
4752 call xerr $es "attach 3-1"
4753 echo "~^attachment remove ./.tattach"; read es;\
4754 call xerr $es "attach 3-2"
4755 echo "~^ attachment remove ./.treadctl"; read es;\
4756 vput vexpr es substr $es 0 3
4757 if [ $es != 501 ]
4758 xcall bail "attach 3-3"
4760 echo "~^ attachment remove ./.tattach"; read es;\
4761 vput vexpr es substr $es 0 3
4762 if [ $es != 501 ]
4763 xcall bail "attach 3-4"
4765 echo "~^attachment list"; read es;\
4766 vput vexpr es substr $es 0 3
4767 if [ $es != 501 ]
4768 xcall bail "attach 3-5"
4772 echo "~^attachment insert ./.tattach=latin1";\
4773 read hl; echo $hl; call xerr "$hl" "attach 4-1"
4774 echo "~^attachment insert ./.tattach=latin1";\
4775 read hl; echo $hl; call xerr "$hl" "attach 4-2"
4776 echo "~^attachment list";\
4777 read es; echo $es;call xerr "$es" "attach 4-3"
4778 call read_mline_res
4779 echo "~^ attachment remove .tattach"; read es;\
4780 vput vexpr es substr $es 0 3
4781 if [ $es != 506 ]
4782 xcall bail "attach 4-4 $es"
4784 echo "~^attachment remove-at T"; read es;\
4785 vput vexpr es substr $es 0 3
4786 if [ $es != 505 ]
4787 xcall bail "attach 4-5"
4789 echo "~^attachment remove ./.tattach"; read es;\
4790 call xerr $es "attach 4-6"
4791 echo "~^attachment remove ./.tattach"; read es;\
4792 call xerr $es "attach 4-7"
4793 echo "~^ attachment remove ./.tattach"; read es;\
4794 vput vexpr es substr $es 0 3
4795 if [ $es != 501 ]
4796 xcall bail "attach 4-8 $es"
4798 echo "~^attachment list"; read es;\
4799 vput vexpr es substr $es 0 3
4800 if [ $es != 501 ]
4801 xcall bail "attach 4-9"
4805 echo "~^attachment insert ./.tattach=latin1";\
4806 read hl; echo $hl; call xerr "$hl" "attach 5-1"
4807 echo "~^attachment insert ./.tattach=latin1";\
4808 read hl; echo $hl; call xerr "$hl" "attach 5-2"
4809 echo "~^attachment insert ./.tattach=latin1";\
4810 read hl; echo $hl; call xerr "$hl" "attach 5-3"
4811 echo "~^attachment list";\
4812 read es; echo $es;call xerr "$es" "attach 5-4"
4813 call read_mline_res
4815 echo "~^attachment remove-at 3"; read es;\
4816 call xerr $es "attach 5-5"
4817 echo "~^attachment remove-at 3"; read es;\
4818 vput vexpr es substr $es 0 3
4819 if [ $es != 501 ]
4820 xcall bail "attach 5-6"
4822 echo "~^attachment remove-at 2"; read es;\
4823 call xerr $es "attach 5-7"
4824 echo "~^attachment remove-at 2"; read es;\
4825 vput vexpr es substr $es 0 3
4826 if [ $es != 501 ]
4827 xcall bail "attach 5-8"
4829 echo "~^attachment remove-at 1"; read es;\
4830 call xerr $es "attach 5-9"
4831 echo "~^attachment remove-at 1"; read es;\
4832 vput vexpr es substr $es 0 3
4833 if [ $es != 501 ]
4834 xcall bail "attach 5-10"
4837 echo "~^attachment list"; read es;\
4838 vput vexpr es substr $es 0 3
4839 if [ $es != 501 ]
4840 xcall bail "attach 5-11"
4844 echo "~^attachment insert ./.tattach=latin1";\
4845 read hl; echo $hl; call xerr "$hl" "attach 6-1"
4846 echo "~^attachment insert ./.tattach=latin1";\
4847 read hl; echo $hl; call xerr "$hl" "attach 6-2"
4848 echo "~^attachment insert ./.tattach=latin1";\
4849 read hl; echo $hl; call xerr "$hl" "attach 6-3"
4850 echo "~^attachment list";\
4851 read es; echo $es;call xerr "$es" "attach 6-4"
4852 call read_mline_res
4854 echo "~^attachment remove-at 1"; read es;\
4855 call xerr $es "attach 6-5"
4856 echo "~^attachment remove-at 1"; read es;\
4857 call xerr $es "attach 6-6"
4858 echo "~^attachment remove-at 1"; read es;\
4859 call xerr $es "attach 6-7"
4860 echo "~^attachment remove-at 1"; read es;\
4861 vput vexpr es substr $es 0 3
4862 if [ $es != 501 ]
4863 xcall bail "attach 6-8"
4866 echo "~^attachment list"; read es;\
4867 vput vexpr es substr $es 0 3
4868 if [ $es != 501 ]
4869 xcall bail "attach 6-9"
4872 echo t_attach LEAVE
4874 define t_ocs {
4875 read ver
4876 echo t_ocs
4877 call t_header
4878 call t_attach
4880 define t_oce {
4881 echo on-compose-enter, mailx-command<$mailx-command>
4882 alternates alter1@exam.ple alter2@exam.ple
4883 alternates
4884 set autocc='alter1@exam.ple alter2@exam.ple'
4885 echo mailx-from<$mailx-from> mailx-sender<$mailx-sender>
4886 echo mailx-subject<$mailx-subject>
4887 echo mailx-to<$mailx-to> mailx-cc<$mailx-cc> mailx-bcc<$mailx-bcc>
4888 echo mailx-raw-to<$mailx-raw-to> mailx-raw-cc<$mailx-raw-cc> \
4889 mailx-raw-bcc<$mailx-raw-bcc>
4890 echo mailx-orig-from<$mailx-orig-from> mailx-orig-to<$mailx-orig-to> \
4891 mailx-orig-cc<$mailx-orig-cc> mailx-orig-bcc<$mailx-orig-bcc>
4892 digmsg create - -;echo $?/$!/$^ERRNAME;\
4893 digmsg - header list;digmsg remove -;echo $?/$!/$^ERRNAME
4895 define t_ocl {
4896 echo on-compose-leave, mailx-command<$mailx-command>
4897 vput alternates al
4898 eval alternates $al alter3@exam.ple alter4@exam.ple
4899 alternates
4900 set autobcc='alter3@exam.ple alter4@exam.ple'
4901 echo mailx-from<$mailx-from> mailx-sender<$mailx-sender>
4902 echo mailx-subject<$mailx-subject>
4903 echo mailx-to<$mailx-to> mailx-cc<$mailx-cc> mailx-bcc<$mailx-bcc>
4904 echo mailx-raw-to<$mailx-raw-to> mailx-raw-cc<$mailx-raw-cc> \
4905 mailx-raw-bcc<$mailx-raw-bcc>
4906 echo mailx-orig-from<$mailx-orig-from> mailx-orig-to<$mailx-orig-to> \
4907 mailx-orig-cc<$mailx-orig-cc> mailx-orig-bcc<$mailx-orig-bcc>
4908 digmsg create - -;echo $?/$!/$^ERRNAME;\
4909 digmsg - header list;digmsg remove -;echo $?/$!/$^ERRNAME
4911 define t_occ {
4912 echo on-compose-cleanup, mailx-command<$mailx-command>
4913 unalternates *
4914 alternates
4915 echo mailx-from<$mailx-from> mailx-sender<$mailx-sender>
4916 echo mailx-subject<$mailx-subject>
4917 echo mailx-to<$mailx-to> mailx-cc<$mailx-cc> mailx-bcc<$mailx-bcc>
4918 echo mailx-raw-to<$mailx-raw-to> mailx-raw-cc<$mailx-raw-cc> \
4919 mailx-raw-bcc<$mailx-raw-bcc>
4920 echo mailx-orig-from<$mailx-orig-from> mailx-orig-to<$mailx-orig-to> \
4921 mailx-orig-cc<$mailx-orig-cc> mailx-orig-bcc<$mailx-orig-bcc>
4922 # XXX error message variable digmsg create - -;echo $?/$!/$^ERRNAME;\
4923 digmsg - header list;digmsg remove -;echo $?/$!/$^ERRNAME
4925 wysh set on-compose-splice=t_ocs \
4926 on-compose-enter=t_oce on-compose-leave=t_ocl \
4927 on-compose-cleanup=t_occ
4928 __EOT__
4930 printf 'm this-goes@nowhere\nbody\n!.\n' |
4931 ${MAILX} ${ARGS} -Snomemdebug -Sescape=! -Sstealthmua=noagent \
4932 -X'source ./.trc' -Smta=./.tmta.sh \
4933 >./.tall 2>&1
4934 ${cat} ./.tall >> "${MBOX}"
4935 check 1 0 "${MBOX}" '337505021 10312'
4937 ${rm} "${MBOX}"
4938 printf 'm this-goes@nowhere\nbody\n!.\n' |
4939 ${MAILX} ${ARGS} -Snomemdebug -Sescape=! -Sstealthmua=noagent \
4940 -St_remove=1 -X'source ./.trc' -Smta=./.tmta.sh \
4941 >./.tall 2>&1
4942 ${cat} ./.tall >> "${MBOX}"
4943 check 2 0 "${MBOX}" '1328241067 12636'
4947 # Some state machine stress, shell compose hook, localopts for hook, etc.
4948 # readctl in child. ~r as HERE document
4949 ${rm} "${MBOX}"
4950 printf 'm ex@am.ple\nbody\n!.
4951 echon ${mailx-command}${mailx-subject}
4952 echon ${mailx-from}${mailx-sender}
4953 echon ${mailx-to}${mailx-cc}${mailx-bcc}
4954 echon ${mailx-raw-to}${mailx-raw-cc}${mailx-raw-bcc}
4955 echon ${mailx-orig-from}${mailx-orig-to}${mailx-orig-gcc}${mailx-orig-bcc}
4956 var t_oce t_ocs t_ocs_sh t_ocl t_occ autocc
4957 ' | ${MAILX} ${ARGS} -Snomemdebug -Sescape=! \
4958 -Smta=./.tmta.sh \
4960 define bail {
4961 echoerr "Failed: $1. Bailing out"; echo "~x"; xit
4963 define xerr {
4964 vput vexpr es substr "$1" 0 1
4965 if [ "$es" != 2 ]
4966 xcall bail "$2"
4969 define read_mline_res {
4970 read hl; wysh set len=$? es=$! en=$^ERRNAME;\
4971 echo $len/$es/$^ERRNAME: $hl
4972 if [ $es -ne $^ERR-NONE ]
4973 xcall bail read_mline_res
4974 elif [ $len -ne 0 ]
4975 \xcall read_mline_res
4978 define _work {
4979 vput vexpr i + 1 "$2"
4980 if [ $i -lt 111 ]
4981 vput vexpr j % $i 10
4982 if [ $j -ne 0 ]
4983 set j=xcall
4984 else
4985 echon "$i.. "
4986 set j=call
4988 eval \\$j _work $1 $i
4989 return $?
4991 vput vexpr i + $i "$1"
4992 return $i
4994 define _read {
4995 wysh set line; read line;wysh set es=$? en=$^ERRNAME ;\
4996 echo read:$es/$en: $line
4997 if [ "${es}" -ne -1 ]
4998 xcall _read
5000 readctl remove $cwd/.treadctl; echo readctl remove:$?/$^ERRNAME
5002 define t_ocs {
5003 read ver
5004 echo t_ocs
5005 echo "~^header list"; read hl; echo $hl;\
5006 vput vexpr es substr "$hl" 0 1
5007 if [ "$es" != 2 ]
5008 xcall bail "header list"
5009 endif
5011 call _work 1; echo $?
5012 echo "~^header insert cc splicy diet <splice@exam.ple> spliced";\
5013 read es; echo $es; vput vexpr es substr "$es" 0 1
5014 if [ "$es" != 2 ]
5015 xcall bail "be diet"
5016 endif
5017 echo "~^header insert cc <splice2@exam.ple>";\
5018 read es; echo $es; vput vexpr es substr "$es" 0 1
5019 if [ "$es" != 2 ]
5020 xcall bail "be diet2"
5021 endif
5023 call _work 2; echo $?
5024 echo "~^header insert bcc juicy juice <juice@exam.ple> spliced";\
5025 read es; echo $es;vput vexpr es substr "$es" 0 1
5026 if [ "$es" != 2 ]
5027 xcall bail "be juicy"
5028 endif
5029 echo "~^header insert bcc juice2@exam.ple";\
5030 read es; echo $es;vput vexpr es substr "$es" 0 1
5031 if [ "$es" != 2 ]
5032 xcall bail "be juicy2"
5033 endif
5034 echo "~^header insert bcc juice3 <juice3@exam.ple>";\
5035 read es; echo $es;vput vexpr es substr "$es" 0 1
5036 if [ "$es" != 2 ]
5037 xcall bail "be juicy3"
5038 endif
5039 echo "~^header insert bcc juice4@exam.ple";\
5040 read es; echo $es;vput vexpr es substr "$es" 0 1
5041 if [ "$es" != 2 ]
5042 xcall bail "be juicy4"
5043 endif
5045 echo "~^header remove-at bcc 3";\
5046 read es; echo $es;vput vexpr es substr "$es" 0 1
5047 if [ "$es" != 2 ]
5048 xcall bail "remove juicy5"
5049 endif
5050 echo "~^header remove-at bcc 2";\
5051 read es; echo $es;vput vexpr es substr "$es" 0 1
5052 if [ "$es" != 2 ]
5053 xcall bail "remove juicy6"
5054 endif
5055 echo "~^header remove-at bcc 3";\
5056 read es; echo $es;vput vexpr es substr "$es" 0 3
5057 if [ "$es" != 501 ]
5058 xcall bail "failed to remove-at"
5059 endif
5060 # Add duplicates which ought to be removed!
5061 echo "~^header insert bcc juice4@exam.ple";\
5062 read es; echo $es;vput vexpr es substr "$es" 0 1
5063 if [ "$es" != 2 ]
5064 xcall bail "be juicy4-1"
5065 endif
5066 echo "~^header insert bcc juice4@exam.ple";\
5067 read es; echo $es;vput vexpr es substr "$es" 0 1
5068 if [ "$es" != 2 ]
5069 xcall bail "be juicy4-2"
5070 endif
5071 echo "~^header insert bcc juice4@exam.ple";\
5072 read es; echo $es;vput vexpr es substr "$es" 0 1
5073 if [ "$es" != 2 ]
5074 xcall bail "be juicy4-3"
5075 endif
5076 echo "~:set t_ocs"
5079 call _work 3; echo $?
5080 echo "~r - '__EOT'"
5081 vput ! i echo just knock if you can hear me;\
5082 i=0;\
5083 while [ $i -lt 24 ]; do printf "%s " $i; i=`expr $i + 1`; done;\
5084 echo relax
5085 echon shell-cmd says $?/$^ERRNAME: $i
5086 echo "~x will not become interpreted, we are reading until __EOT"
5087 echo "__EOT"
5088 read r_status; echo "~~r status output: $r_status"
5089 echo "~:echo $? $! $^ERRNAME"
5090 read r_status
5091 echo "~~r status from parent: $r_status"
5094 call _work 4; echo $?
5095 vput cwd cwd;echo cwd:$?
5096 readctl create $cwd/.treadctl ;echo readctl:$?/$^ERRNAME;\
5097 call _read
5100 call _work 5; echo $?
5101 echo "~^header show MAILX-Command"; read es;\
5102 call xerr $es "t_header 1000"; call read_mline_res
5103 echo "~^header show MAILX-raw-TO"; read es;\
5104 call xerr $es "t_header 1001"; xcall read_mline_res
5106 echoerr IT IS WRONG IF YOU SEE THIS
5108 define t_oce {
5109 echo on-compose-enter, mailx-command<$mailx-command>
5110 set t_oce autobcc=oce@exam.ple
5111 alternates alter1@exam.ple alter2@exam.ple
5112 alternates
5113 echo mailx-from<$mailx-from> mailx-sender<$mailx-sender>
5114 echo mailx-subject<$mailx-subject>
5115 echo mailx-to<$mailx-to> mailx-cc<$mailx-cc> mailx-bcc<$mailx-bcc>
5116 echo mailx-raw-to<$mailx-raw-to> mailx-raw-cc<$mailx-raw-cc> \
5117 mailx-raw-bcc<$mailx-raw-bcc>
5118 echo mailx-orig-from<$mailx-orig-from> \
5119 mailx-orig-to<$mailx-orig-to> \
5120 mailx-orig-cc<$mailx-orig-cc> mailx-orig-bcc<$mailx-orig-bcc>
5122 define t_ocl {
5123 echo on-compose-leave, mailx-command<$mailx-command>
5124 set t_ocl autocc=ocl@exam.ple
5125 unalternates *
5126 alternates alter3@exam.ple alter4@exam.ple
5127 alternates
5128 echo mailx-from<$mailx-from> mailx-sender<$mailx-sender>
5129 echo mailx-subject<$mailx-subject>
5130 echo mailx-to<$mailx-to> mailx-cc<$mailx-cc> mailx-bcc<$mailx-bcc>
5131 echo mailx-raw-to<$mailx-raw-to> mailx-raw-cc<$mailx-raw-cc> \
5132 mailx-raw-bcc<$mailx-raw-bcc>
5133 echo mailx-orig-from<$mailx-orig-from> \
5134 mailx-orig-to<$mailx-orig-to> \
5135 mailx-orig-cc<$mailx-orig-cc> mailx-orig-bcc<$mailx-orig-bcc>
5137 define t_occ {
5138 echo on-compose-cleanup, mailx-command<$mailx-command>
5139 set t_occ autocc=occ@exam.ple
5140 unalternates *
5141 alternates
5142 echo mailx-from<$mailx-from> mailx-sender<$mailx-sender>
5143 echo mailx-subject<$mailx-subject>
5144 echo mailx-to<$mailx-to> mailx-cc<$mailx-cc> mailx-bcc<$mailx-bcc>
5145 echo mailx-raw-to<$mailx-raw-to> mailx-raw-cc<$mailx-raw-cc> \
5146 mailx-raw-bcc<$mailx-raw-bcc>
5147 echo mailx-orig-from<$mailx-orig-from> \
5148 mailx-orig-to<$mailx-orig-to> \
5149 mailx-orig-cc<$mailx-orig-cc> mailx-orig-bcc<$mailx-orig-bcc>
5151 wysh set on-compose-splice=t_ocs \
5152 on-compose-splice-shell="read ver;echo t_ocs-shell;\
5153 echo \"~t shell@exam.ple\"; echo \"~:set t_ocs_sh\"" \
5154 on-compose-enter=t_oce on-compose-leave=t_ocl \
5155 on-compose-cleanup=t_occ
5156 ' > ./.tnotes 2>&1
5157 check_ex0 3-estat
5158 ${cat} ./.tnotes >> "${MBOX}"
5159 check 3 - "${MBOX}" '679526364 2431'
5161 # Reply, forward, resend, Resend
5163 ${rm} "${MBOX}"
5164 printf '#
5165 set from="f1@z
5166 m t1@z
5169 set from="du <f2@z>" stealthmua=noagent
5170 m t2@z
5173 ' | ${MAILX} ${ARGS} -Smta=./.tmta.sh -Snomemdebug -Sescape=!
5175 printf '
5176 echo start: $? $! $^ERRNAME
5177 File %s
5178 echo File: $? $! $^ERRNAME;echo;echo
5179 reply 1
5180 this is content of reply 1
5182 echo reply 1: $? $! $^ERRNAME;echo;echo
5183 Reply 1 2
5184 this is content of Reply 1 2
5186 echo Reply 1 2: $? $! $^ERRNAME;echo;echo
5187 forward 1 fwdex@am.ple
5188 this is content of forward 1
5190 echo forward 1: $? $! $^ERRNAME;echo;echo
5191 wysh set forward-inject-head=$'"'"'-- \\
5192 forward (%%a)(%%d)(%%f)(%%i)(%%n)(%%r) --\\n'"'"'
5193 wysh set forward-inject-tail=$'"'"'-- \\
5194 end of forward (%%i) --\\n'"'"'
5195 forward 2 fwdex@am.ple
5196 this is content of forward 2
5198 echo forward 2: $? $! $^ERRNAME;echo;echo
5199 set showname
5200 forward 2 fwdex2@am.ple
5201 this is content of forward 2, 2nd, with showname set
5203 echo forward 2, 2nd: $? $! $^ERRNAME;echo;echo
5204 resend 1 2 resendex@am.ple
5205 echo resend 1 2: $? $! $^ERRNAME;echo;echo
5206 Resend 1 2 Resendex@am.ple
5207 echo Resend 1 2: $? $! $^ERRNAME;echo;echo
5208 ' "${MBOX}" |
5209 ${MAILX} ${ARGS} -Snomemdebug -Sescape=! -Sfullnames \
5210 -Smta=./.tmta.sh \
5212 define bail {
5213 echoerr "Failed: $1. Bailing out"; echo "~x"; xit
5215 define xerr {
5216 vput vexpr es substr "$1" 0 1
5217 if [ "$es" != 2 ]
5218 xcall bail "$2"
5221 define read_mline_res {
5222 read hl; wysh set len=$? es=$! en=$^ERRNAME;\
5223 echo mline_res:$len/$es/$^ERRNAME: $hl
5224 if [ $es -ne $^ERR-NONE ]
5225 xcall bail read_mline_res
5226 elif [ $len -ne 0 ]
5227 \xcall read_mline_res
5230 define work_hl {
5231 echo "~^header show $1"; read es;\
5232 call xerr $es "work_hl $1"; echo $1; call read_mline_res
5233 if [ $# -gt 1 ]
5234 shift
5235 xcall work_hl "$@"
5238 define t_ocs {
5239 read ver
5240 echo t_ocs version $ver
5241 echo "~^header list"; read hl; echo $hl;\
5242 echoerr the header list is $hl;\
5243 call xerr "$hl" "header list"
5244 eval vpospar set $hl
5245 shift
5246 xcall work_hl "$@"
5247 echoerr IT IS WRONG IF YOU SEE THIS
5249 define t_oce {
5250 echo on-XY-enter, mailx-command<$mailx-command>
5251 set t_oce autobcc=oce@exam.ple
5252 echo mailx-from<$mailx-from> mailx-sender<$mailx-sender>
5253 echo mailx-subject<$mailx-subject>
5254 echo mailx-to<$mailx-to> mailx-cc<$mailx-cc> mailx-bcc<$mailx-bcc>
5255 echo mailx-raw-to<$mailx-raw-to> mailx-raw-cc<$mailx-raw-cc> \
5256 mailx-raw-bcc<$mailx-raw-bcc>
5257 echo mailx-orig-from<$mailx-orig-from> \
5258 mailx-orig-to<$mailx-orig-to> \
5259 mailx-orig-cc<$mailx-orig-cc> mailx-orig-bcc<$mailx-orig-bcc>
5261 define t_ocl {
5262 echo on-XY-leave, mailx-command<$mailx-command>
5263 set t_ocl autocc=ocl@exam.ple
5264 echo mailx-from<$mailx-from> mailx-sender<$mailx-sender>
5265 echo mailx-subject<$mailx-subject>
5266 echo mailx-to<$mailx-to> mailx-cc<$mailx-cc> mailx-bcc<$mailx-bcc>
5267 echo mailx-raw-to<$mailx-raw-to> mailx-raw-cc<$mailx-raw-cc> \
5268 mailx-raw-bcc<$mailx-raw-bcc>
5269 echo mailx-orig-from<$mailx-orig-from> \
5270 mailx-orig-to<$mailx-orig-to> \
5271 mailx-orig-cc<$mailx-orig-cc> mailx-orig-bcc<$mailx-orig-bcc>
5273 define t_occ {
5274 echo on-XY-cleanup, mailx-command<$mailx-command>
5275 set t_occ autocc=occ@exam.ple
5276 echo mailx-from<$mailx-from> mailx-sender<$mailx-sender>
5277 echo mailx-subject<$mailx-subject>
5278 echo mailx-to<$mailx-to> mailx-cc<$mailx-cc> mailx-bcc<$mailx-bcc>
5279 echo mailx-raw-to<$mailx-raw-to> mailx-raw-cc<$mailx-raw-cc> \
5280 mailx-raw-bcc<$mailx-raw-bcc>
5281 echo mailx-orig-from<$mailx-orig-from> \
5282 mailx-orig-to<$mailx-orig-to> \
5283 mailx-orig-cc<$mailx-orig-cc> mailx-orig-bcc<$mailx-orig-bcc>
5285 wysh set on-compose-splice=t_ocs \
5286 on-compose-enter=t_oce on-compose-leave=t_ocl \
5287 on-compose-cleanup=t_occ \
5288 on-resend-enter=t_oce on-resend-cleanup=t_occ
5289 ' > ./.tnotes 2>&1
5290 check_ex0 4-estat
5291 ${cat} ./.tnotes >> "${MBOX}"
5292 check 4 - "${MBOX}" '2151712038 11184'
5294 t_epilog
5295 } # }}}
5297 t_mass_recipients() {
5298 t_prolog mass_recipients
5299 TRAP_EXIT_ADDONS="./.t*"
5301 t_xmta 'Eucalyptus Sat Jul 08 21:14:57 2017'
5303 ${cat} <<'__EOT__' > ./.trc
5304 define bail {
5305 echoerr "Failed: $1. Bailing out"; echo "~x"; xit
5307 define ins_addr {
5308 wysh set nr=$1 hn=$2
5309 echo "~$hn $hn$nr@$hn"; echo '~:echo $?'; read es
5310 if [ "$es" -ne 0 ]
5311 xcall bail "ins_addr $hn 1-$nr"
5313 vput vexpr nr + $nr 1
5314 if [ "$nr" -le "$maximum" ]
5315 xcall ins_addr $nr $hn
5318 define bld_alter {
5319 wysh set nr=$1 hn=$2
5320 alternates $hn$nr@$hn
5321 vput vexpr nr + $nr 2
5322 if [ "$nr" -le "$maximum" ]
5323 xcall bld_alter $nr $hn
5326 define t_ocs {
5327 read ver
5328 call ins_addr 1 t
5329 call ins_addr 1 c
5330 call ins_addr 1 b
5332 define t_ocl {
5333 if [ "$t_remove" != '' ]
5334 call bld_alter 1 t
5335 call bld_alter 2 c
5338 set on-compose-splice=t_ocs on-compose-leave=t_ocl
5339 __EOT__
5341 printf 'm this-goes@nowhere\nbody\n!.\n' |
5342 ${MAILX} ${ARGS} -Snomemdebug -Sescape=! -Sstealthmua=noagent \
5343 -X'source ./.trc' -Smta=./.tmta.sh -Smaximum=2001 \
5344 >./.tall 2>&1
5345 check_ex0 1-estat
5346 ${cat} ./.tall >> "${MBOX}"
5347 check 1 - "${MBOX}" '2912243346 51526'
5349 ${rm} "${MBOX}"
5350 printf 'm this-goes@nowhere\nbody\n!.\n' |
5351 ${MAILX} ${ARGS} -Snomemdebug -Sescape=! -Sstealthmua=noagent \
5352 -St_remove=1 -X'source ./.trc' -Smta=./.tmta.sh -Smaximum=2001 \
5353 >./.tall 2>&1
5354 check_ex0 2-estat
5355 ${cat} ./.tall >> "${MBOX}"
5356 check 2 - "${MBOX}" '4097804632 34394'
5358 t_epilog
5361 t_lreply_futh_rth_etc() {
5362 t_prolog lreply_futh_rth_etc
5363 TRAP_EXIT_ADDONS="./.t*"
5365 t_xmta 'HumulusLupulus Thu Jul 27 14:41:20 2017'
5367 ${cat} <<-_EOT > ./.tmbox
5368 From neverneverland Sun Jul 23 13:46:25 2017
5369 Subject: Bugstop: five miles out 1
5370 Reply-To: mister originator2 <mr2@originator>, bugstop@five.miles.out
5371 From: mister originator <mr@originator>
5372 To: bugstop-commit@five.miles.out, laber@backe.eu
5373 Cc: is@a.list
5374 Mail-Followup-To: bugstop@five.miles.out, laber@backe.eu, is@a.list
5375 In-reply-to: <20170719111113.bkcMz%laber@backe.eu>
5376 Date: Wed, 19 Jul 2017 09:22:57 -0400
5377 Message-Id: <20170719132257.766AF781267@originator>
5378 Status: RO
5380 > |Sorry, I think I misunderstand something. I would think that
5382 That's appalling.
5384 From neverneverland Fri Jul 7 22:39:11 2017
5385 Subject: Bugstop: five miles out 2
5386 Reply-To: mister originator2<mr2@originator>,bugstop@five.miles.out,is@a.list
5387 Content-Transfer-Encoding: 7bit
5388 From: mister originator <mr@originator>
5389 To: bugstop-commit@five.miles.out
5390 Cc: is@a.list
5391 Message-ID: <149945963975.28888.6950788126957753723.reportbug@five.miles.out>
5392 Date: Fri, 07 Jul 2017 16:33:59 -0400
5393 Status: R
5395 capable of changing back.
5397 From neverneverland Fri Jul 7 22:42:00 2017
5398 Subject: Bugstop: five miles out 3
5399 Reply-To: mister originator2 <mr2@originator>, bugstop@five.miles.out
5400 Content-Transfer-Encoding: 7bit
5401 From: mister originator <mr@originator>
5402 To: bugstop-commit@five.miles.out
5403 Cc: is@a.list
5404 Message-ID: <149945963975.28888.6950788126957753746.reportbug@five.miles.out>
5405 Date: Fri, 07 Jul 2017 16:33:59 -0400
5406 List-Post: <mailto:bugstop@five.miles.out>
5407 Status: R
5409 are you ready, boots?
5411 From neverneverland Sat Aug 19 23:15:00 2017
5412 Subject: Bugstop: five miles out 4
5413 Reply-To: mister originator2 <mr2@originator>, bugstop@five.miles.out
5414 Content-Transfer-Encoding: 7bit
5415 From: mister originator <mr@originator>
5416 To: bugstop@five.miles.out
5417 Cc: is@a.list
5418 Message-ID: <149945963975.28888.6950788126qtewrqwer.reportbug@five.miles.out>
5419 Date: Fri, 07 Jul 2017 16:33:59 -0400
5420 List-Post: <mailto:bugstop@five.miles.out>
5421 Status: R
5423 are you ready, boots?
5424 _EOT
5428 ${cat} <<-'_EOT' | ${MAILX} ${ARGS} -Sescape=! -Smta=./.tmta.sh \
5429 -Rf ./.tmbox >> "${MBOX}" 2>&1
5430 define r {
5431 wysh set m="This is text of \"reply ${1}."
5432 reply 1 2 3
5433 !I m
5436 !I m
5439 !I m
5442 echo -----After reply $1.1 - $1.3: $?/$^ERRNAME
5444 define R {
5445 wysh set m="This is text of \"Reply ${1}."
5446 eval Reply $2
5447 !I m
5448 !I 2
5451 echo -----After Reply $1.$2: $?/$^ERRNAME
5453 define _Lh {
5454 read protover
5455 echo '~I m'
5456 echo '~I n'
5457 echo '".'
5459 define _Ls {
5460 wysh set m="This is text of \"Lreply ${1}." on-compose-splice=_Lh n=$2
5461 eval Lreply $2
5463 define L {
5464 # We need two indirections for this test: one for the case that Lreply
5465 # fails because of missing recipients: we need to read EOF next, thus
5466 # place this in _Ls last; and second for the succeeding cases EOF is
5467 # not what these should read, so go over the backside and splice it in!
5468 call _Ls "$@"
5469 echo -----After Lreply $1.$2: $?/$^ERRNAME
5471 define x {
5472 localopts call-fixate yes
5473 call r $1
5474 call R $1 1; call R $1 2; call R $1 3; call R $1 4
5475 call L $1 1; call L $1 2; call L $1 3
5477 define tweak {
5478 echo;echo '===== CHANGING === '"$*"' =====';echo
5479 eval "$@"
5482 set from=laber@backe.eu
5483 mlist is@a.list
5484 call x 1
5485 call tweak set reply-to-honour
5486 call x 2
5487 call tweak set followup-to
5488 call x 3
5489 call tweak set followup-to-honour
5490 call x 4
5491 call tweak mlist bugstop@five.miles.out
5492 call x 5
5493 call tweak mlsubscribe bugstop@five.miles.out
5494 call x 6
5495 call tweak set recipients-in-cc
5496 call x 7
5497 # While here, test that *fullnames* works (also here)
5498 set fullnames
5499 reply 1
5500 This message should have *fullnames* in the header.
5502 _EOT
5504 check_ex0 1-estat
5505 if have_feat uistrings; then
5506 check 1 - "${MBOX}" '1530821219 29859'
5507 else
5508 echo 'lreply_futh_rth_etc-1: content test unsupported, skipped'
5513 ${cat} <<-_EOT > ./.tmbox
5514 From tom@i-i.example Thu Oct 26 03:15:55 2017
5515 Date: Wed, 25 Oct 2017 21:15:46 -0400
5516 From: tom <tom@i-i.example>
5517 To: Steffen Nurpmeso <steffen@sdaoden.eu>
5518 Cc: tom <tom@i-i.example>
5519 Subject: Re: xxxx yyyyyyyy configure does not really like a missing zzzzz
5520 Message-ID: <20171026011546.GA11643@i-i.example>
5521 Reply-To: tom@i-i.example
5522 References: <20171025214601.T2pNd%steffen@sdaoden.eu>
5523 In-Reply-To: <20171025214601.T2pNd%steffen@sdaoden.eu>
5524 Status: R
5526 The report's useful :-)
5527 _EOT
5529 # Let us test In-Reply-To: removal starts a new thread..
5530 # This needs adjustment of *stealthmua*
5531 argadd='-Sstealthmua=noagent -Shostname'
5533 ${rm} "${MBOX}"
5534 printf 'reply 1\nthread\n!.\n' |
5535 ${MAILX} ${ARGS} -Sescape=! -Smta=./.tmta.sh -Sreply-to-honour \
5536 ${argadd} -Rf ./.tmbox > .tall 2>&1
5537 check 2 0 "${MBOX}" '3321764338 429'
5538 check 3 - .tall '4294967295 0'
5540 printf 'reply 1\nnew <- thread!\n!||%s -e "%s"\n!.\n' \
5541 "${sed}" '/^In-Reply-To:/d' |
5542 ${MAILX} ${ARGS} -Sescape=! -Smta=./.tmta.sh -Sreply-to-honour \
5543 ${argadd} -Rf "${MBOX}" > .tall 2>&1
5544 check 4 0 "${MBOX}" '1682552516 763'
5545 check 5 - .tall '4294967295 0'
5547 printf 'reply 2\nold <- new <- thread!\n!.\n' |
5548 ${MAILX} ${ARGS} -Sescape=! -Smta=./.tmta.sh -Sreply-to-honour \
5549 ${argadd} -Rf "${MBOX}" > .tall 2>&1
5550 check 6 0 "${MBOX}" '2900984135 1219'
5551 check 7 - .tall '4294967295 0'
5553 printf 'reply 3\nnew <- old <- new <- thread!\n!|| %s -e "%s"\n!.\n' \
5554 "${sed}" '/^In-Reply-To:/d' |
5555 ${MAILX} ${ARGS} -Sescape=! -Smta=./.tmta.sh -Sreply-to-honour \
5556 ${argadd} -Rf "${MBOX}" > .tall 2>&1
5557 check 8 0 "${MBOX}" '794031200 1567'
5558 check 9 - .tall '4294967295 0'
5560 t_epilog
5562 # }}}
5564 # Rest {{{
5565 t_s_mime() {
5566 have_feat smime || {
5567 echo 's_mime: unsupported, skipped'
5568 return
5571 t_prolog s_mime
5572 TRAP_EXIT_ADDONS="./.t.conf ./.tkey.pem ./.tcert.pem ./.tpair.pem"
5573 TRAP_EXIT_ADDONS="${TRAP_EXIT_ADDONS} ./.VERIFY ./.DECRYPT ./.ENCRYPT"
5574 TRAP_EXIT_ADDONS="${TRAP_EXIT_ADDONS} ./.tmta.sh"
5576 ${cat} <<-_EOT > ./.t.conf
5577 [ req ]
5578 default_bits = 1024
5579 default_keyfile = keyfile.pem
5580 distinguished_name = req_distinguished_name
5581 attributes = req_attributes
5582 prompt = no
5583 output_password =
5585 [ req_distinguished_name ]
5586 C = GB
5587 ST = Over the
5588 L = rainbow
5589 O = S-nail
5590 OU = S-nail.smime
5591 CN = S-nail.test
5592 emailAddress = test@localhost
5594 [ req_attributes ]
5595 challengePassword =
5596 _EOT
5597 openssl req -x509 -nodes -days 3650 -config ./.t.conf \
5598 -newkey rsa:1024 -keyout ./.tkey.pem -out ./.tcert.pem >>${ERR} 2>&1
5599 check_ex0 0
5600 ${cat} ./.tkey.pem ./.tcert.pem > ./.tpair.pem
5602 # Sign/verify
5603 echo bla | ${MAILX} ${ARGS} \
5604 -Ssmime-sign -Ssmime-sign-cert=./.tpair.pem -Sfrom=test@localhost \
5605 -Ssmime-sign-digest=sha1 \
5606 -s 'S/MIME test' ./.VERIFY
5607 check_ex0 1-estat
5608 ${awk} '
5609 BEGIN{ skip=0 }
5610 /^Content-Description: /{ skip = 2; print; next }
5611 /^$/{ if(skip) --skip }
5612 { if(!skip) print }
5614 < ./.VERIFY > "${MBOX}"
5615 check 1 - "${MBOX}" '335634014 644'
5617 printf 'verify\nx\n' |
5618 ${MAILX} ${ARGS} -Ssmime-ca-file=./.tcert.pem -Serrexit \
5619 -R -f ./.VERIFY >>${ERR} 2>&1
5620 check_ex0 2
5622 openssl smime -verify -CAfile ./.tcert.pem -in ./.VERIFY >>${ERR} 2>&1
5623 check_ex0 3
5625 # (signing +) encryption / decryption
5626 t_xmta 'Euphrasia Thu Apr 27 17:56:23 2017' ./.ENCRYPT
5628 echo bla |
5629 ${MAILX} ${ARGS} \
5630 -Smta=./.tmta.sh \
5631 -Ssmime-force-encryption -Ssmime-encrypt-recei@ver.com=./.tpair.pem \
5632 -Ssmime-sign-digest=sha1 \
5633 -Ssmime-sign -Ssmime-sign-cert=./.tpair.pem -Sfrom=test@localhost \
5634 -s 'S/MIME test' recei@ver.com
5635 check_ex0 4-estat
5636 ${sed} -e '/^$/,$d' < ./.ENCRYPT > "${MBOX}"
5637 check 4 - "${MBOX}" '1937410597 327'
5639 printf 'decrypt ./.DECRYPT\nfi ./.DECRYPT\nverify\nx\n' |
5640 ${MAILX} ${ARGS} \
5641 -Smta=./.tmta.sh \
5642 -Ssmime-ca-file=./.tcert.pem \
5643 -Ssmime-sign-cert=./.tpair.pem \
5644 -Serrexit -R -f ./.ENCRYPT >>${ERR} 2>&1
5645 check_ex0 5-estat
5646 ${awk} '
5647 BEGIN{ skip=0 }
5648 /^Content-Description: /{ skip = 2; print; next }
5649 /^$/{ if(skip) --skip }
5650 { if(!skip) print }
5652 < ./.DECRYPT > "${MBOX}"
5653 check 5 - "${MBOX}" '1019076159 931'
5655 (openssl smime -decrypt -inkey ./.tkey.pem -in ./.ENCRYPT |
5656 openssl smime -verify -CAfile ./.tcert.pem) >>${ERR} 2>&1
5657 check_ex0 6
5659 ${rm} ./.ENCRYPT
5660 echo bla | ${MAILX} ${ARGS} \
5661 -Smta=./.tmta.sh \
5662 -Ssmime-force-encryption -Ssmime-encrypt-recei@ver.com=./.tpair.pem \
5663 -Sfrom=test@localhost \
5664 -s 'S/MIME test' recei@ver.com
5665 check_ex0 7-estat
5666 ${sed} -e '/^$/,$d' < ./.ENCRYPT > "${MBOX}"
5667 check 7 - "${MBOX}" '1937410597 327'
5669 ${rm} ./.DECRYPT
5670 printf 'decrypt ./.DECRYPT\nx\n' | ${MAILX} ${ARGS} \
5671 -Smta=./.tmta.sh \
5672 -Ssmime-sign-cert=./.tpair.pem \
5673 -Serrexit -R -f ./.ENCRYPT >>${ERR} 2>&1
5674 check 8 0 "./.DECRYPT" '2624716890 422'
5676 openssl smime -decrypt -inkey ./.tkey.pem \
5677 -in ./.ENCRYPT >>${ERR} 2>&1
5678 check_ex0 9
5680 t_epilog
5682 # }}}
5684 # xxx Note: t_z() was the first test (series) written. Today many
5685 # xxx aspects are (better) covered by other tests above, some are not.
5686 # xxx At some future date and time, convert the last remains not covered
5687 # xxx elsewhere to a real t_* test and drop it
5688 t_z() {
5689 t_prolog z
5691 # Test for [260e19d] (Juergen Daubert)
5692 echo body | ${MAILX} ${ARGS} "${MBOX}"
5693 check 4 0 "${MBOX}" '2948857341 94'
5695 # "Test for" [d6f316a] (Gavin Troy)
5696 ${rm} "${MBOX}"
5697 printf "m ${MBOX}\n~s subject1\nEmail body\n~.\nfi ${MBOX}\np\nx\n" |
5698 ${MAILX} ${ARGS} ${ADDARG_UNI} -Spipe-text/plain="@* ${cat}" > "${BODY}"
5699 check 6 0 "${MBOX}" '3942990636 118'
5700 check 6-1 - "${BODY}" '3951695530 170'
5702 # "Test for" [c299c45] (Peter Hofmann) TODO shouldn't end up QP-encoded?
5703 ${rm} "${MBOX}"
5704 ${awk} 'BEGIN{
5705 for(i = 0; i < 10000; ++i)
5706 printf "\xC3\xBC"
5707 #printf "\xF0\x90\x87\x90"
5708 }' | ${MAILX} ${ARGS} ${ADDARG_UNI} -s TestSubject "${MBOX}"
5709 check 7 0 "${MBOX}" '1707496413 61812'
5711 t_epilog
5714 t__put_subject() {
5715 # MIME encoding (QP) stress message subject
5716 printf 'Äbrä Kä?dä=brö Fü?di=bus? '\
5717 'adadaddsssssssddddddddddddddddddddd'\
5718 'ddddddddddddddddddddddddddddddddddd'\
5719 'ddddddddddddddddddddddddddddddddddd'\
5720 'dddddddddddddddddddd Hallelulja? Od'\
5721 'er?? eeeeeeeeeeeeeeeeeeeeeeeeeeeeee'\
5722 'eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee'\
5723 'eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee f'\
5724 'fffffffffffffffffffffffffffffffffff'\
5725 'fffffffffffffffffffff ggggggggggggg'\
5726 'ggggggggggggggggggggggggggggggggggg'\
5727 'ggggggggggggggggggggggggggggggggggg'\
5728 'ggggggggggggggggggggggggggggggggggg'\
5729 'gggggggggggggggg'
5732 t__put_body() {
5733 # MIME encoding (QP) stress message body
5734 printf \
5735 'Ich bin eine DÖS-Datäi mit sehr langen Zeilen und auch '\
5736 'sonst bin ich ganz schön am Schleudern, da kannste denke '\
5737 "wasde willst, gelle, gelle, gelle, gelle, gelle.\r\n"\
5738 "Ich bin eine DÖS-Datäi mit langen Zeilen und auch sonst \r\n"\
5739 "Ich bin eine DÖS-Datäi mit langen Zeilen und auch sonst 1\r\n"\
5740 "Ich bin eine DÖS-Datäi mit langen Zeilen und auch sonst 12\r\n"\
5741 "Ich bin eine DÖS-Datäi mit langen Zeilen und auch sonst 123\r\n"\
5742 "Ich bin eine DÖS-Datäi mit langen Zeilen und auch sonst 1234\r\n"\
5743 "Ich bin eine DÖS-Datäi mit langen Zeilen und auch sonst 12345\r\n"\
5744 "Ich bin eine DÖS-Datäi mit langen Zeilen und auch sonst 123456\r\n"\
5745 "Ich bin eine DÖS-Datäi mit langen Zeilen und auch sonst 1234567\r\n"\
5746 "Ich bin eine DÖS-Datäi mit langen Zeilen und auch sonst 12345678\r\n"\
5747 "Ich bin eine DÖS-Datäi mit langen Zeilen und auch sonst 123456789\r\n"\
5748 "Unn ausserdem habe ich trailing SP/HT/SP/HT whitespace \r\n"\
5749 "Unn ausserdem habe ich trailing HT/SP/HT/SP whitespace \r\n"\
5750 "auf den zeilen vorher.\r\n"\
5751 "From am Zeilenbeginn und From der Mitte gibt es auch.\r\n"\
5752 ".\r\n"\
5753 "Die letzte Zeile war nur ein Punkt.\r\n"\
5754 "..\r\n"\
5755 "Das waren deren zwei.\r\n"\
5756 " \r\n"\
5757 "Die letzte Zeile war ein Leerschritt.\n"\
5758 "=VIER = EQUAL SIGNS=ON A LINE=\r\n"\
5759 "Prösterchen.\r\n"\
5760 ".\n"\
5761 "Die letzte Zeile war nur ein Punkt, mit Unix Zeilenende.\n"\
5762 "..\n"\
5763 "Das waren deren zwei. ditto.\n"\
5764 "Prösterchen.\n"\
5765 "Unn ausseerdem habe ich trailing SP/HT/SP/HT whitespace \n"\
5766 "Unn ausseerdem habe ich trailing HT/SP/HT/SP whitespace \n"\
5767 "auf den zeilen vorher.\n"\
5768 "ditto.\n"\
5769 "Ich bin eine ziemlich lange, steile, scharfe Zeile mit Unix Zeilenende.\n"\
5770 "Ich bin eine ziemlich lange, steile, scharfe Zeile mit Unix Zeilenende.1"\
5771 "\n"\
5772 "Ich bin eine ziemlich lange, steile, scharfe Zeile mit Unix Zeilenende.12"\
5773 "\n"\
5774 "Ich bin eine ziemlich lange, steile, scharfe Zeile mit Unix Zeilenende.12"\
5775 "3\n"\
5776 "Ich bin eine ziemlich lange, steile, scharfe Zeile mit Unix Zeilenende.12"\
5777 "34\n"\
5778 "Ich bin eine ziemlich lange, steile, scharfe Zeile mit Unix Zeilenende.12"\
5779 "345\n"\
5780 "Ich bin eine ziemlich lange, steile, scharfe Zeile mit Unix Zeilenende.12"\
5781 "3456\n"\
5782 "QP am Zeilenende über soft-nl hinweg\n"\
5783 "Ich bin eine ziemlich lange, steile, scharfe Zeile mit Unix Zeilenende."\
5784 "ö123\n"\
5785 "Ich bin eine ziemlich lange, steile, scharfe Zeile mit Unix Zeilenende."\
5786 "1ö23\n"\
5787 "Ich bin eine ziemlich lange, steile, scharfe Zeile mit Unix Zeilenende."\
5788 "12ö3\n"\
5789 "Ich bin eine ziemlich lange, steile, scharfe Zeile mit Unix Zeilenende."\
5790 "123ö\n"\
5791 "=VIER = EQUAL SIGNS=ON A LINE=\n"\
5792 " \n"\
5793 "Die letzte Zeile war ein Leerschritt.\n"\
5797 # cc_all_configs()
5798 # Test all configs TODO doesn't cover all *combinations*, stupid!
5799 cc_all_configs() {
5800 < ${CONF} ${awk} '
5801 BEGIN{
5802 ALWAYS = "OPT_AUTOCC=1 OPT_AMALGAMATION=1"
5803 NOTME["OPT_ALWAYS_UNICODE_LOCALE"] = 1
5804 NOTME["OPT_CROSS_BUILD"] = 1
5805 NOTME["OPT_AUTOCC"] = 1
5806 NOTME["OPT_AMALGAMATION"] = 1
5807 NOTME["OPT_DEBUG"] = 1
5808 NOTME["OPT_DEVEL"] = 1
5809 NOTME["OPT_ASAN_ADDRESS"] = 1
5810 NOTME["OPT_ASAN_MEMORY"] = 1
5811 NOTME["OPT_FORCED_STACKPROT"] = 1
5812 NOTME["OPT_NOMEMDBG"] = 1
5813 NOTME["OPT_NYD2"] = 1
5815 #OPTVALS
5816 OPTNO = 0
5818 MULCHOICE["OPT_IDNA"] = "VAL_IDNA"
5819 MULVALS["VAL_IDNA"] = 1
5821 #VALKEYS[0] = "VAL_RANDOM"
5822 VALVALS["VAL_RANDOM"] = 1
5823 VALNO = 0
5825 /^[[:space:]]*OPT_/{
5826 sub(/^[[:space:]]*/, "")
5827 # This bails for UnixWare 7.1.4 awk(1), but preceeding = with \
5828 # does not seem to be a compliant escape for =
5829 #sub(/=.*$/, "")
5830 $1 = substr($1, 1, index($1, "=") - 1)
5831 if(!NOTME[$1])
5832 OPTVALS[OPTNO++] = $1
5833 next
5835 /^[[:space:]]*VAL_/{
5836 sub(/^[[:space:]]*/, "")
5837 val = substr($0, index($0, "=") + 1)
5838 if(val ~ /^\"/){
5839 val = substr(val, 2)
5840 val = substr(val, 1, length(val) - 1)
5842 $1 = substr($1, 1, index($1, "=") - 1)
5843 if(MULVALS[$1])
5844 MULVALS[$1] = val
5845 else if(VALVALS[$1]){
5846 VALKEYS[VALNO++] = $1
5847 VALVALS[$1] = val
5849 next
5851 function onepass(addons){
5852 a_onepass__worker(addons, "1", "0")
5853 a_onepass__worker(addons, "0", "1")
5855 function a_onepass__worker(addons, b0, b1){
5856 # Doing this completely sequentially and not doing make distclean in
5857 # between runs should effectively result in lesser compilations.
5858 # It is completely dumb nonetheless... TODO
5859 for(ono = 0; ono < OPTNO; ++ono){
5860 myconf = mula = ""
5861 for(i = 0; i < ono; ++i){
5862 myconf = myconf " " OPTVALS[i] "=" b0 " "
5863 if(b0 == "1"){
5864 j = MULCHOICE[OPTVALS[i]]
5865 if(j){
5866 if(i + 1 == ono)
5867 mula = j
5868 else
5869 myconf = myconf " " MULCHOICE[OPTVALS[i]] "=any "
5873 for(i = ono; i < OPTNO; ++i){
5874 myconf = myconf " " OPTVALS[i] "=" b1 " "
5875 if(b1 == "1"){
5876 j = MULCHOICE[OPTVALS[i]]
5877 if(j){
5878 if(i + 1 == OPTNO)
5879 mula = j;
5880 else
5881 myconf = myconf " " MULCHOICE[OPTVALS[i]] "=any "
5886 for(i in VALKEYS)
5887 myconf = VALKEYS[i] "=any " myconf
5889 myconf = myconf " " ALWAYS " " addons
5891 if(mula == "")
5892 print myconf
5893 else{
5894 i = split(MULVALS[mula], ia)
5895 j = "any"
5896 while(i >= 1){
5897 j = ia[i--] " " j
5898 print mula "=\"" j "\" " myconf
5903 END{
5904 # We cannot test NULL because of missing UI strings, which will end
5905 # up with different checksums
5906 print "CONFIG=NULLI OPT_AUTOCC=1"
5907 for(i in VALKEYS){
5908 j = split(VALVALS[VALKEYS[i]], ia)
5909 k = "any"
5910 while(j >= 1){
5911 k = ia[j--] " " k
5912 print VALKEYS[i] "=\"" k "\" CONFIG=NULLI OPT_AUTOCC=1"
5915 print "CONFIG=MINIMAL OPT_AUTOCC=1"
5916 print "CONFIG=NETSEND OPT_AUTOCC=1"
5917 print "CONFIG=MAXIMAL OPT_AUTOCC=1"
5918 for(i in VALKEYS){
5919 j = split(VALVALS[VALKEYS[i]], ia)
5920 k = "any"
5921 while(j >= 1){
5922 k = ia[j--] " " k
5923 print VALKEYS[i] "=\"" k "\" CONFIG=MAXIMAL OPT_AUTOCC=1"
5926 print "CONFIG=DEVEL OPT_AUTOCC=1"
5927 print "CONFIG=ODEVEL OPT_AUTOCC=1"
5929 onepass("OPT_DEBUG=1")
5930 onepass("")
5932 ' | while read c; do
5933 [ -f mk-config.h ] && ${cp} mk-config.h .ccac.h
5934 printf "\n\n##########\n$c\n"
5935 printf "\n\n##########\n$c\n" >&2
5936 ${SHELL} -c "cd .. && ${MAKE} ${c} config"
5937 if [ -f .ccac.h ] && ${cmp} mk-config.h .ccac.h; then
5938 printf 'Skipping after config, nothing changed\n'
5939 printf 'Skipping after config, nothing changed\n' >&2
5940 continue
5942 ${SHELL} -c "cd ../ && ${MAKE} build test"
5943 done
5944 ${rm} -f .ccac.h
5945 cd .. && ${MAKE} distclean
5948 [ -n "${ERR}" ] && echo > ${ERR}
5949 if [ -z "${CHECK_ONLY}${MAE_TEST}" ]; then
5950 cc_all_configs
5951 elif [ -z "${MAE_TEST}" ] || [ ${#} -eq 0 ]; then
5952 # if have_feat devel; then
5953 # ARGS="${ARGS} -Smemdebug"
5954 # export ARGS
5955 # fi
5956 t_all
5958 else
5959 while [ ${#} -gt 0 ]; do
5960 eval t_${1}
5961 shift
5962 done
5965 [ ${ESTAT} -eq 0 ] && echo Ok || echo >&2 'Errors occurred'
5967 exit ${ESTAT}
5968 # s-sh-mode