make-config.in: complete path (leftover of [807f64e2], 2015-12-26!)
[s-mailx.git] / cc-test.sh
blobfc49b7dbb2274c50d2fe1d594d9d29fc6c4dbd77
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 vput vexpr res regex 'banana' '(club )?(.*)(nana)(.*)' \
2366 '\$1\${2}\$4\${3}rama'
2367 echo $?/$^ERRNAME :$res:
2368 vput vexpr res regex 'Banana' '(club )?(.*)(nana)(.*)' \
2369 '\$1\$2\${2}\$2\$4\${3}rama'
2370 echo $?/$^ERRNAME :$res:
2371 vput vexpr res regex 'Club banana' '(club )?(.*)(nana)(.*)' \
2372 '\$1\${2}\$4\${3}rama'
2373 echo $?/$^ERRNAME :$res:
2374 echo ' #5'
2375 __EOT
2377 check regex 0 "${MBOX}" '3949279959 384'
2378 else
2379 printf 'vexpr-regex: unsupported, skipped\n'
2382 t_epilog
2385 t_call_ret() {
2386 t_prolog call_ret
2388 ${cat} <<- '__EOT' | ${MAILX} ${ARGS} -Snomemdebug > "${MBOX}" 2>&1
2389 define w1 {
2390 echon ">$1 "
2391 vput vexpr i + $1 1
2392 if [ $i -le 42 ]
2393 vput vexpr j '&' $i 7
2394 if [ $j -eq 7 ]
2395 echo .
2397 call w1 $i
2398 wysh set i=$? k=$!
2399 vput vexpr j '&' $i 7
2400 echon "<$1/$i/$k "
2401 if [ $j -eq 7 ]
2402 echo .
2404 else
2405 echo ! The end for $1
2407 return $1
2409 # Transport $?/$! up the call chain
2410 define w2 {
2411 echon ">$1 "
2412 vput vexpr i + $1 1
2413 if [ $1 -lt 42 ]
2414 call w2 $i
2415 wysh set i=$? j=$! k=$^ERRNAME
2416 echon "<$1/$i/$k "
2417 return $i $j
2418 else
2419 echo ! The end for $1
2420 return $i $^ERR-BUSY
2422 echoerr au
2424 # Up and down it goes
2425 define w3 {
2426 echon ">$1/$2 "
2427 vput vexpr i + $1 1
2428 if [ $1 -lt 42 ]
2429 call w3 $i $2
2430 wysh set i=$? j=$!
2431 vput vexpr k - $1 $2
2432 if [ $k -eq 21 ]
2433 vput vexpr i + $1 1
2434 vput vexpr j + $2 1
2435 echo "# <$i/$j> .. "
2436 call w3 $i $j
2437 wysh set i=$? j=$!
2439 eval echon "<\$1=\$i/\$^ERRNAME-$j "
2440 return $i $j
2441 else
2442 echo ! The end for $1=$i/$2
2443 if [ "$2" != "" ]
2444 return $i $^ERR-DOM
2445 else
2446 return $i $^ERR-BUSY
2449 echoerr au
2452 call w1 0; echo ?=$? !=$!; echo -----;
2453 call w2 0; echo ?=$? !=$^ERRNAME; echo -----;
2454 call w3 0 1; echo ?=$? !=$^ERRNAME; echo -----;
2455 __EOT
2457 check 1 0 "${MBOX}" '1572045517 5922'
2459 t_epilog
2462 t_xcall() {
2463 t_prolog xcall
2465 ${cat} <<- '__EOT' | ${MAILX} ${ARGS} -Snomemdebug > "${MBOX}" 2>&1
2466 define work {
2467 echon "$1 "
2468 vput vexpr i + $1 1
2469 if [ $i -le 1111 ]
2470 vput vexpr j '&' $i 7
2471 if [ $j -eq 7 ]
2472 echo .
2474 \xcall work $i $2
2476 echo ! The end for $1/$2
2477 if [ "$2" != "" ]
2478 return $i $^ERR-BUSY
2481 define xwork {
2482 \xcall work 0 $2
2484 call work 0
2485 echo ?=$? !=$!
2486 call xwork
2487 echo ?=$? !=$!
2488 xcall xwork
2489 echo ?=$? !=$^ERRNAME
2491 call work 0 yes
2492 echo ?=$? !=$^ERRNAME
2493 call xwork 0 yes
2494 echo ?=$? !=$^ERRNAME
2495 __EOT
2497 check 1 0 "${MBOX}" '2401702082 23801'
2501 if have_feat uistrings; then
2502 ${cat} <<- '__EOT' > "${BODY}"
2503 define __w {
2504 echon "$1 "
2505 vput vexpr i + $1 1
2506 if [ $i -le 111 ]
2507 vput vexpr j '&' $i 7
2508 if [ $j -eq 7 ]
2509 echo .
2511 \xcall __w $i $2
2513 echo ! The end for $1
2514 if [ $2 -eq 0 ]
2515 nonexistingcommand
2516 echo would be err with errexit
2517 return
2519 echo calling exit
2520 exit
2522 define work {
2523 echo eins
2524 call __w 0 0
2525 echo zwei, ?=$? !=$!
2526 localopts yes; set errexit
2527 ignerr call __w 0 0
2528 echo drei, ?=$? !=$^ERRNAME
2529 call __w 0 $1
2530 echo vier, ?=$? !=$^ERRNAME, this is an error
2532 ignerr call work 0
2533 echo outer 1, ?=$? !=$^ERRNAME
2534 xxxign call work 0
2535 echo outer 2, ?=$? !=$^ERRNAME, could be error if xxxign non-empty
2536 call work 1
2537 echo outer 3, ?=$? !=$^ERRNAME
2538 echo this is definitely an error
2539 __EOT
2541 < "${BODY}" ${MAILX} ${ARGS} -X'commandalias xxxign ignerr' \
2542 -Snomemdebug > "${MBOX}" 2>&1
2543 check 2 0 "${MBOX}" '3900716531 4200'
2545 < "${BODY}" ${MAILX} ${ARGS} -X'commandalias xxxign " "' \
2546 -Snomemdebug > "${MBOX}" 2>&1
2547 check 3 1 "${MBOX}" '1006776201 2799'
2548 else
2549 echo 'xcall-2: unsupported, skipped'
2550 echo 'xcall-3: unsupported, skipped'
2553 t_epilog
2556 t_vpospar() {
2557 t_prolog vpospar
2559 ${cat} <<- '__EOT' | ${MAILX} ${ARGS} > "${MBOX}" 2>&1
2560 vpospar set hey, "'you ", world!
2561 echo $?/$^ERRNAME/$#: $* / "$@" / <$1><$2><$3><$4>
2562 vput vpospar x quote; echo x<$x>
2563 vpospar clear;echo $?/$^ERRNAME/$#: $* / "$@" / <$1><$2><$3><$4>
2564 vput vpospar y quote;echo y<$y>
2565 eval vpospar set ${x};echo $?/$^ERRNAME/$#: $* / "$@" / <$1><$2><$3><$4>
2566 eval vpospar set ${y};echo $?/$^ERRNAME/$#: $* / "$@" / <$1><$2><$3><$4>
2567 eval vpospar set ${x};echo $?/$^ERRNAME/$#: $* / "$@" / <$1><$2><$3><$4>
2569 define infun2 {
2570 echo infun2:$?/$^ERRNAME/$#:$*/"$@"/<$1><$2><$3><$4>
2571 vput vpospar z quote;echo infun2:z<$z>
2574 define infun {
2575 echo infun:$?/$^ERRNAME/$#:$*/"$@"/<$1><$2><$3><$4>
2576 vput vpospar y quote;echo infun:y<$y>
2577 eval vpospar set ${x};echo infun:$?/$^ERRNAME/$#:$*/"$@"/<$1><$2><$3><$4>
2578 vpospar clear;echo infun:$?/$^ERRNAME/$#:$*/"$@"/<$1><$2><$3><$4>
2579 eval call infun2 $x
2580 echo infun:$?/$^ERRNAME/$#:$*/"$@"/<$1><$2><$3><$4>
2581 eval vpospar set ${y};echo infun:$?/$^ERRNAME/$#:$*/"$@"/<$1><$2><$3><$4>
2584 call infun This "in a" fun
2585 echo $?/$^ERRNAME/$#: $* / "$@" / <$1><$2><$3><$4>
2586 vpospar clear;echo $?/$^ERRNAME/$#: $* / "$@" / <$1><$2><$3><$4>
2587 __EOT
2588 check 1 0 "${MBOX}" '155175639 866'
2591 ${cat} <<- '__EOT' | ${MAILX} ${ARGS} > "${MBOX}" 2>&1
2592 set ifs=\'
2593 echo ifs<$ifs> ifs-ws<$ifs-ws>
2594 vpospar set hey, "'you ", world!
2595 echo $?/$^ERRNAME/$#: $* / "$@" / <$1><$2><$3><$4>
2596 vput vpospar x quote; echo x<$x>
2597 vpospar clear;echo $?/$^ERRNAME/$#: $* / "$@" / <$1><$2><$3><$4>
2598 eval vpospar set ${x};echo $?/$^ERRNAME/$#: $* / "$@" / <$1><$2><$3><$4>
2600 set ifs=,
2601 echo ifs<$ifs> ifs-ws<$ifs-ws>
2602 vpospar set hey, "'you ", world!
2603 unset ifs;echo $?/$^ERRNAME/$#: $* / "$@" / <$1><$2><$3><$4>
2604 set ifs=,
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>
2610 wysh set ifs=$',\t'
2611 echo ifs<$ifs> ifs-ws<$ifs-ws>
2612 vpospar set hey, "'you ", world!
2613 unset ifs; echo $?/$^ERRNAME/$#: $* / "$@" / <$1><$2><$3><$4>
2614 wysh set ifs=$',\t'
2615 vput vpospar x quote; echo x<$x>
2616 vpospar clear;echo $?/$^ERRNAME/$#: $* / "$@" / <$1><$2><$3><$4>
2617 eval vpospar set ${x};\
2618 unset ifs;echo $?/$^ERRNAME/$#: $* / "$@" / <$1><$2><$3><$4>
2619 __EOT
2620 check ifs 0 "${MBOX}" '2015927702 706'
2622 t_epilog
2625 t_atxplode() {
2626 t_prolog atxplode
2627 TRAP_EXIT_ADDONS="./.t*"
2629 ${cat} > ./.t.sh <<- '___'; ${cat} > ./.t.rc <<- '___'
2630 x() { echo $#; }
2631 xxx() {
2632 printf " (1/$#: <$1>)"
2633 shift
2634 if [ $# -gt 0 ]; then
2635 xxx "$@"
2636 else
2637 echo
2640 yyy() {
2641 eval "$@ ' ball"
2643 set --
2644 x "$@"
2645 x "$@"''
2646 x " $@"
2647 x "$@ "
2648 printf yyy;yyy 'xxx' "b\$'\t'u ' "
2649 printf xxx;xxx arg ,b u.
2650 printf xxx;xxx arg , .
2651 printf xxx;xxx arg ,ball.
2653 define x {
2654 echo $#
2656 define xxx {
2657 echon " (1/$#: <$1>)"
2658 shift
2659 if [ $# -gt 0 ]
2660 \xcall xxx "$@"
2661 endif
2662 echo
2664 define yyy {
2665 eval "$@ ' ball"
2667 vpospar set
2668 call x "$@"
2669 call x "$@"''
2670 call x " $@"
2671 call x "$@ "
2672 echon yyy;call yyy '\call xxx' "b\$'\t'u ' "
2673 echon xxx;call xxx arg ,b u.
2674 echon xxx;call xxx arg , .
2675 echon xxx;call xxx arg ,ball.
2678 ${MAILX} ${ARGS} -X'source ./.t.rc' -Xx > "${MBOX}" 2>&1
2679 check 1 0 "${MBOX}" '41566293 164'
2681 #${SHELL} ./.t.sh > ./.tshout 2>&1
2682 #check disproof-1 0 ./.tshout '41566293 164'
2684 t_epilog
2687 t_read() {
2688 t_prolog read
2689 TRAP_EXIT_ADDONS="./.t*"
2691 ${cat} <<- '__EOT' > .tin
2692 hey1, "'you ", world!
2693 hey2, "'you ", bugs bunny!
2694 hey3, "'you ",
2695 hey4, "'you "
2696 __EOT
2698 ${cat} <<- '__EOT' |\
2699 ${MAILX} ${ARGS} -X'readctl create ./.tin' > "${MBOX}" 2>&1
2700 read a b c
2701 echo $?/$^ERRNAME / <$a><$b><$c>
2702 read a b c
2703 echo $?/$^ERRNAME / <$a><$b><$c>
2704 read a b c
2705 echo $?/$^ERRNAME / <$a><$b><$c>
2706 read a b c
2707 echo $?/$^ERRNAME / <$a><$b><$c>
2708 unset a b c;read a b c
2709 echo $?/$^ERRNAME / <$a><$b><$c>
2710 readctl remove ./.tin;echo readctl remove:$?/$^ERRNAME
2711 __EOT
2712 check 1 0 "${MBOX}" '1527910147 173'
2714 ${cat} <<- '__EOT' > .tin2
2715 hey2.0,:"'you ",:world!:mars.:
2716 hey2.1,:"'you ",:world!
2717 hey2.2,:"'you ",:bugs bunny!
2718 hey2.3,:"'you ",:
2719 hey2.4,:"'you ":
2721 __EOT
2723 ${cat} <<- '__EOT' |\
2724 6< .tin2 ${MAILX} ${ARGS} -X 'readctl create 6' > "${MBOX}" 2>&1
2725 set ifs=:
2726 read a b c
2727 echo $?/$^ERRNAME / <$a><$b><$c>
2728 read a b c
2729 echo $?/$^ERRNAME / <$a><$b><$c>
2730 read a b c
2731 echo $?/$^ERRNAME / <$a><$b><$c>
2732 read a b c
2733 echo $?/$^ERRNAME / <$a><$b><$c>
2734 read a b c
2735 echo $?/$^ERRNAME / <$a><$b><$c>
2736 read a b c
2737 echo $?/$^ERRNAME / <$a><$b><$c>
2738 unset a b c;read a b c
2739 echo $?/$^ERRNAME / <$a><$b><$c>
2740 read a b c
2741 echo $?/$^ERRNAME / <$a><$b><$c>
2742 readctl remove 6;echo readctl remove:$?/$^ERRNAME
2743 __EOT
2744 check ifs 0 "${MBOX}" '890153490 298'
2746 ${cat} <<- '__EOT' | ${MAILX} ${ARGS} > "${MBOX}" 2>&1
2747 readctl create .tin
2748 readall d; echo $?/$^ERRNAME / <$d>
2749 wysh set d;readall d;echo $?/$^ERRNAME / <$d>
2750 readctl create .tin2
2751 readall d; echo $?/$^ERRNAME / <$d>
2752 wysh set d;readall d;echo $?/$^ERRNAME / <$d>
2753 readctl remove .tin;echo $?/$^ERRNAME;\
2754 readctl remove .tin2;echo $?/$^ERRNAME
2755 echo '### now with empty lines'
2756 ! printf 'one line\n\ntwo line\n\n' > ./.temptynl
2757 readctl create .temptynl;echo $?/$^ERRNAME
2758 readall d; echo "$?/$^ERRNAME / <$d>"
2759 readctl remove .temptynl;echo $?/$^ERRNAME
2760 __EOT
2761 check readall 0 "${MBOX}" '4113506527 405'
2763 t_epilog
2765 # }}}
2767 # VFS {{{
2768 t_mbox() {
2769 t_prolog mbox
2770 TRAP_EXIT_ADDONS="./.t*"
2774 while [ ${i} -lt 113 ]; do
2775 printf 'm file://%s\n~s Subject %s\nHello %s!\n~.\n' \
2776 "${MBOX}" "${i}" "${i}"
2777 i=`add ${i} 1`
2778 done
2779 ) | ${MAILX} ${ARGS} > .tall 2>&1
2780 check 1 0 "${MBOX}" '1785801373 13336'
2781 check 1-outerr - ./.tall '4294967295 0' # empty file
2783 printf 'File "%s"\ncopy * "%s"\nFile "%s"\nfrom*' "${MBOX}" .tmbox1 .tmbox1 |
2784 ${MAILX} ${ARGS} -Sshowlast > .tall 2>&1
2785 check 2 0 .tall '3075634057 9103'
2787 printf 'File "%s"\ncopy * "file://%s"\nFile "file://%s"\nfrom*' \
2788 "${MBOX}" .tmbox2 .tmbox2 | ${MAILX} ${ARGS} -Sshowlast > .tall 2>&1
2789 check 3 0 .tall '1902668747 9110'
2791 # copy only the odd (but the first), move the even
2793 printf 'File "file://%s"\ncopy ' .tmbox2
2795 while [ ${i} -lt 113 ]; do
2796 printf '%s ' "${i}"
2797 i=`add ${i} 2`
2798 done
2799 printf 'file://%s\nFile "file://%s"\nfrom*' .tmbox3 .tmbox3
2800 ) | ${MAILX} ${ARGS} -Sshowlast > .tall 2>&1
2801 check 4 0 .tmbox3 '2554734733 6666'
2802 check 5 - .tall '3168324241 4573'
2803 # ...
2805 printf 'file "file://%s"\nmove ' .tmbox2
2807 while [ ${i} -lt 113 ]; do
2808 printf '%s ' "${i}"
2809 i=`add ${i} 2`
2810 done
2811 printf 'file://%s\nFile "file://%s"\nfrom*\nFile "file://%s"\nfrom*' \
2812 .tmbox3 .tmbox3 .tmbox2
2813 ) | ${MAILX} ${ARGS} -Sshowlast > .tall 2>>${ERR}
2814 check 6 0 .tmbox3 '1429216753 13336'
2815 if have_feat uistrings; then
2816 ${sed} 2d < .tall > .tallx
2817 else
2818 ${cp} .tall .tallx
2820 check 7 - .tallx '3604509039 13645'
2822 # Invalid MBOXes (after [f4db93b3])
2823 echo > .tinvmbox
2824 printf 'copy 1 ./.tinvmbox' | ${MAILX} ${ARGS} -Rf "${MBOX}" > .tall 2>&1
2825 check 8 0 .tinvmbox '2848412822 118'
2826 check 9 - ./.tall '461280182 33'
2828 echo ' ' > .tinvmbox
2829 printf 'copy 1 ./.tinvmbox' | ${MAILX} ${ARGS} -Rf "${MBOX}" > .tall 2>&1
2830 check 10 0 .tinvmbox '624770486 120'
2831 check 11 - ./.tall '461280182 33'
2833 { echo; echo; } > .tinvmbox # (not invalid)
2834 printf 'copy 1 ./.tinvmbox' | ${MAILX} ${ARGS} -Rf "${MBOX}" > .tall 2>&1
2835 check 12 0 .tinvmbox '1485640875 119'
2836 check 13 - ./.tall '461280182 33'
2838 # *mbox-rfc4155*, plus
2839 ${cat} <<-_EOT > ./.tinv1
2842 From MAILER-DAEMON-1 Wed Oct 2 01:50:07 1996
2843 Date: Wed, 02 Oct 1996 01:50:07 +0000
2845 Subject: Bad bad message 1
2847 From me to you, blinde Kuh!
2849 From MAILER-DAEMON-2 Wed Oct 2 01:50:07 1996
2850 Date: Wed, 02 Oct 1996 01:50:07 +0000
2852 Subject: Bad bad message 2
2854 From me to you, blindes Kalb!
2855 _EOT
2856 ${cp} ./.tinv1 ./.tinv2
2858 printf \
2859 'define mboxfix {
2860 \\localopts yes; \\wysh set mbox-rfc4155;\\wysh File "${1}";\\
2861 \\eval copy * "${2}"
2863 call mboxfix ./.tinv1 ./.tok' | ${MAILX} ${ARGS} > .tall 2>&1
2864 check_ex0 14-estat
2865 ${cat} ./.tinv1 ./.tok >> .tall
2866 check 14 - ./.tall '739301109 616'
2868 printf \
2869 'wysh file ./.tinv1 # ^From not repaired, but missing trailing NL is
2870 wysh File ./.tok # Just move away to nowhere
2871 set mbox-rfc4155
2872 wysh file ./.tinv2 # Fully repaired
2873 File ./.tok' | ${MAILX} ${ARGS} >>${ERR} 2>&1
2874 check_ex0 15-estat
2875 check 15-1 - ./.tinv1 '3178048820 332'
2876 check 15-2 - ./.tinv2 '4151504442 314'
2878 t_epilog
2881 t_maildir() {
2882 t_prolog maildir
2883 if have_feat maildir; then :; else
2884 echo 'maildir: unsupported, skipped'
2885 return
2888 TRAP_EXIT_ADDONS="./.t*"
2892 while [ ${i} -lt 112 ]; do
2893 printf 'm file://%s\n~s Subject %s\nHello %s!\n~.\n' \
2894 "${MBOX}" "${i}" "${i}"
2895 i=`add ${i} 1`
2896 done
2897 ) | ${MAILX} ${ARGS}
2898 check 1 0 "${MBOX}" '2366902811 13332'
2900 printf 'File "%s"
2901 copy * "%s"
2902 File "%s"
2903 from*
2904 ' "${MBOX}" .tmdir1 .tmdir1 |
2905 ${MAILX} ${ARGS} -Snewfolders=maildir -Sshowlast > .tlst
2906 check 2 0 .tlst '1713783045 9103'
2908 printf 'File "%s"
2909 copy * "maildir://%s"
2910 File "maildir://%s"
2911 from*
2912 ' "${MBOX}" .tmdir2 .tmdir2 |
2913 ${MAILX} ${ARGS} -Sshowlast > .tlst
2914 check 3 0 .tlst '1240307893 9113'
2916 printf 'File "maildir://%s"
2917 copy * "file://%s"
2918 File "file://%s"
2919 from*
2920 ' .tmdir2 .tmbox1 .tmbox1 |
2921 ${MAILX} ${ARGS} -Sshowlast > .tlst
2922 check 4 0 .tmbox1 '4096198846 12772'
2923 check 5 - .tlst '817337448 9110'
2925 # only the odd (even)
2927 printf 'File "maildir://%s"
2928 copy ' .tmdir2
2930 while [ ${i} -lt 112 ]; do
2931 j=`modulo ${i} 2`
2932 [ ${j} -eq 1 ] && printf '%s ' "${i}"
2933 i=`add ${i} 1`
2934 done
2935 printf ' file://%s
2936 File "file://%s"
2937 from*
2938 ' .tmbox2 .tmbox2
2939 ) | ${MAILX} ${ARGS} -Sshowlast > .tlst
2940 check 6 0 .tmbox2 '4228337024 6386'
2941 check 7 - .tlst '884389294 4573'
2942 # ...
2944 printf 'file "maildir://%s"
2945 move ' .tmdir2
2947 while [ ${i} -lt 112 ]; do
2948 j=`modulo ${i} 2`
2949 [ ${j} -eq 0 ] && [ ${i} -ne 0 ] && printf '%s ' "${i}"
2950 i=`add ${i} 1`
2951 done
2952 printf ' file://%s
2953 File "file://%s"
2954 from*
2955 File "maildir://%s"
2956 from*
2957 ' .tmbox2 .tmbox2 .tmdir2
2958 ) | ${MAILX} ${ARGS} -Sshowlast > .tlst
2959 check 8 0 .tmbox2 '978751761 12656'
2960 ${sed} 2d < .tlst > .tlstx
2961 check 9 - .tlstx '2391942957 13645'
2963 t_epilog
2965 # }}}
2967 # MIME and RFC basics {{{
2968 t_mime_if_not_ascii() {
2969 t_prolog mime_if_not_ascii
2971 </dev/null ${MAILX} ${ARGS} -s Subject "${MBOX}" >> "${MBOX}" 2>&1
2972 check 1 0 "${MBOX}" '3647956381 106'
2974 </dev/null ${MAILX} ${ARGS} -Scharset-7bit=not-ascii -s Subject "${MBOX}" \
2975 >> "${MBOX}" 2>&1
2976 check 2 0 "${MBOX}" '3964303752 274'
2978 t_epilog
2981 t_xxxheads_rfc2047() {
2982 t_prolog xxxheads_rfc2047
2983 TRAP_EXIT_ADDONS="./.t*"
2985 t_xmta 'GentianaLutea Mon Dec 04 17:15:29 2017'
2987 echo | ${MAILX} ${ARGS} ${ADDARG_UNI} \
2988 -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̲' \
2989 "${MBOX}"
2990 check 1 0 "${MBOX}" '3422562347 371'
2992 # Single word (overlong line split -- bad standard! Requires injection of
2993 # artificial data!! But can be prevented by using RFC 2047 encoding)
2994 ${rm} "${MBOX}"
2995 i=`${awk} 'BEGIN{for(i=0; i<92; ++i) printf "0123456789_"}'`
2996 echo | ${MAILX} ${ARGS} -s "${i}" "${MBOX}"
2997 check 2 0 "${MBOX}" '3317256266 1714'
2999 # Combination of encoded words, space and tabs of varying sort
3000 ${rm} "${MBOX}"
3001 echo | ${MAILX} ${ARGS} ${ADDARG_UNI} \
3002 -s "1Abrä Kaspas1 2Abra Katä b_kaspas2 \
3003 3Abrä Kaspas3 4Abrä Kaspas4 5Abrä Kaspas5 \
3004 6Abra Kaspas6 7Abrä Kaspas7 8Abra Kaspas8 \
3005 9Abra Kaspastäb4-3 10Abra Kaspas1 _ 11Abra Katäb1 \
3006 12Abra Kadabrä1 After Tab after Täb this is NUTS" \
3007 "${MBOX}"
3008 check 3 0 "${MBOX}" '786672837 587'
3010 # Overlong multibyte sequence that must be forcefully split
3011 # todo This works even before v15.0, but only by accident
3012 ${rm} "${MBOX}"
3013 echo | ${MAILX} ${ARGS} ${ADDARG_UNI} \
3014 -s "✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄\
3015 ✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄\
3016 ✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄" \
3017 "${MBOX}"
3018 check 4 0 "${MBOX}" '2889557767 655'
3020 # Trailing WS
3021 ${rm} "${MBOX}"
3022 echo | ${MAILX} ${ARGS} \
3023 -s "1-1 B2 B3 B4 B5 B6 B\
3024 1-2 B2 B3 B4 B5 B6 B\
3025 1-3 B2 B3 B4 B5 B6 B\
3026 1-4 B2 B3 B4 B5 B6 B\
3027 1-5 B2 B3 B4 B5 B6 B\
3028 1-6 B2 B3 B4 B5 B6 " \
3029 "${MBOX}"
3030 check 5 0 "${MBOX}" '3135161683 293'
3032 # Leading and trailing WS
3033 ${rm} "${MBOX}"
3034 echo | ${MAILX} ${ARGS} \
3035 -s " 2-1 B2 B3 B4 B5 B6 B\
3036 1-2 B2 B3 B4 B5 B6 B\
3037 1-3 B2 B3 B4 B5 B6 B\
3038 1-4 B2 B3 B4 B5 B6 " \
3039 "${MBOX}"
3040 check 6 0 "${MBOX}" '3221845405 232'
3042 # RFC 2047 in an address field! (Missing test caused v14.9.6!)
3043 ${rm} "${MBOX}"
3044 echo "Dat Früchtchen riecht häußlich" |
3045 ${MAILX} ${ARGS} ${ADDARG_UNI} -Sfullnames -Smta=./.tmta.sh \
3046 -s Hühöttchen \
3047 'Schnödes "Früchtchen" <do@du> (Hä!)'
3048 check 7 0 "${MBOX}" '800505986 368'
3050 # RFC 2047 in an address field, and iconv involved
3051 if have_feat iconv; then
3052 ${rm} "${MBOX}"
3053 ${cat} > ./.trebox <<_EOT
3054 From zaza@exam.ple Fri Mar 2 21:31:56 2018
3055 Date: Fri, 2 Mar 2018 20:31:45 +0000
3056 From: z=?iso-8859-1?Q?=E1?=za <zaza@exam.ple>
3057 To: dude <dude@exam.ple>
3058 Subject: houston(...)
3059 Message-ID: <abra@1>
3060 MIME-Version: 1.0
3061 Content-Type: text/plain; charset=iso-8859-1
3062 Content-Disposition: inline
3063 Content-Transfer-Encoding: 8bit
3065 _EOT
3066 echo reply | ${MAILX} ${ARGS} ${ADDARG_UNI} \
3067 -Sfullnames -Sreply-in-same-charset \
3068 -Smta=./.tmta.sh -Rf ./.trebox
3069 check 8 0 "${MBOX}" '2914485741 280'
3070 else
3071 echo 'xxxheads_rfc2047-8: iconv unsupported, skipped'
3074 t_epilog
3077 t_iconv_mbyte_base64() { # TODO uses sed(1) and special *headline*!!
3078 t_prolog iconv_mbyte_base64
3079 TRAP_EXIT_ADDONS="./.t*"
3081 if [ -n "${UTF8_LOCALE}" ] && have_feat iconv; then
3082 if (</dev/null iconv -f ascii -t iso-2022-jp) >/dev/null 2>&1 ||
3083 (</dev/null iconv -f ascii -t euc-jp) >/dev/null 2>&1; then
3085 else
3086 echo 'iconv_mbyte_base64: unsupported, skipped'
3087 return
3089 else
3090 echo 'iconv_mbyte_base64: unsupported, skipped'
3091 return
3094 t_xmta 'DroseriaRotundifolia Thu Aug 03 17:26:25 2017'
3096 if (</dev/null iconv -f ascii -t iso-2022-jp) >/dev/null 2>&1; then
3097 ${cat} <<-'_EOT' | LC_ALL=${UTF8_LOCALE} ${MAILX} ${ARGS} \
3098 -Smta=./.tmta.sh \
3099 -Sescape=! -Smime-encoding=base64 2>./.terr
3100 set ttycharset=utf-8 sendcharsets=iso-2022-jp
3101 m t1@exam.ple
3102 !s Japanese from UTF-8 to ISO-2022-JP
3103 シジュウカラ科(シジュウカラか、学名 Paridae)は、鳥類スズメ目の科である。シジュウカラ(四十雀)と総称されるが、狭義にはこの1種をシジュウカラと呼ぶ。
3105 カンムリガラ(学名Parus cristatus)は、スズメ目シジュウカラ科に分類される鳥類の一種。
3108 カンムリガラ(学名Parus cristatus)は、スズメ目シジュウカラ科に分類される鳥類の一種。
3110 シジュウカラ科(シジュウカラか、学名 Paridae)は、鳥類スズメ目の科である。シジュウカラ(四十雀)と総称されるが、狭義にはこの1種をシジュウカラと呼ぶ。
3113 set ttycharset=iso-2022-jp charset-7bit=iso-2022-jp sendcharsets=utf-8
3114 m t2@exam.ple
3115 !s Japanese from ISO-2022-JP to UTF-8, eh, no, also ISO-2022-JP
3116 \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
3118 \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
3121 \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
3123 \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
3125 _EOT
3126 # May not presume iconv output as long as roundtrip possible [489a7122]
3127 check_ex0 1-estat
3128 ${awk} 'BEGIN{h=1}/^$/{++h;next}{if(h % 2 == 1)print}' \
3129 < "${MBOX}" > ./.tcksum
3130 check 1 - ./.tcksum '2694609714 520'
3131 check 2 - ./.terr '4294967295 0'
3133 printf 'eval f 1; eval write ./.twrite; eval type 1; eval type 2\n' |
3134 LC_ALL=${UTF8_LOCALE} ${MAILX} ${ARGS} \
3135 -S headline="%>%a%m %-18f %-16d %i%-s" \
3136 -Rf "${MBOX}" >./.tlog 2>&1
3137 check 3 0 ./.twrite '1259742080 686'
3138 #check 4 - ./.tlog '3214068822 2123'
3139 ${sed} -e '/^\[-- M/d' < ./.tlog > ./.txlog
3140 check 4 - ./.txlog '3659773472 2035'
3141 else
3142 echo 'iconv_mbyte_base64: ISO-2022-JP unsupported, skipping 1-4'
3145 if (</dev/null iconv -f ascii -t euc-jp) >/dev/null 2>&1; then
3146 rm -f "${MBOX}" ./.twrite
3147 ${cat} <<-'_EOT' | LC_ALL=${UTF8_LOCALE} ${MAILX} ${ARGS} \
3148 -Smta=./.tmta.sh \
3149 -Sescape=! -Smime-encoding=base64 2>./.terr
3150 set ttycharset=utf-8 sendcharsets=euc-jp
3151 m t1@exam.ple
3152 !s Japanese from UTF-8 to EUC-JP
3153 シジュウカラ科(シジュウカラか、学名 Paridae)は、鳥類スズメ目の科である。シジュウカラ(四十雀)と総称されるが、狭義にはこの1種をシジュウカラと呼ぶ。
3155 カンムリガラ(学名Parus cristatus)は、スズメ目シジュウカラ科に分類される鳥類の一種。
3158 カンムリガラ(学名Parus cristatus)は、スズメ目シジュウカラ科に分類される鳥類の一種。
3160 シジュウカラ科(シジュウカラか、学名 Paridae)は、鳥類スズメ目の科である。シジュウカラ(四十雀)と総称されるが、狭義にはこの1種をシジュウカラと呼ぶ。
3163 set ttycharset=EUC-JP sendcharsets=utf-8
3164 m t2@exam.ple
3165 !s Japanese from EUC-JP to UTF-8
3166 ¥·¥¸¥å¥¦¥«¥é²Ê¡Ê¥·¥¸¥å¥¦¥«¥é¤«¡¢³Ø̾ Paridae¡Ë¤Ï¡¢Ä»Îॹ¥º¥áÌܤβʤǤ¢¤ë¡£¥·¥¸¥å¥¦¥«¥é¡Ê»Í½½¿ý¡Ë¤ÈÁí¾Î¤µ¤ì¤ë¤¬¡¢¶¹µÁ¤Ë¤Ï¤³¤Î1¼ï¤ò¥·¥¸¥å¥¦¥«¥é¤È¸Æ¤Ö¡£
3168 ¥«¥ó¥à¥ê¥¬¥é¡Ê³Ø̾Parus cristatus¡Ë¤Ï¡¢¥¹¥º¥áÌÜ¥·¥¸¥å¥¦¥«¥é²Ê¤ËʬÎव¤ì¤ëÄ»Îà¤Î°ì¼ï¡£
3171 ¥«¥ó¥à¥ê¥¬¥é¡Ê³Ø̾Parus cristatus¡Ë¤Ï¡¢¥¹¥º¥áÌÜ¥·¥¸¥å¥¦¥«¥é²Ê¤ËʬÎव¤ì¤ëÄ»Îà¤Î°ì¼ï¡£
3173 ¥·¥¸¥å¥¦¥«¥é²Ê¡Ê¥·¥¸¥å¥¦¥«¥é¤«¡¢³Ø̾ Paridae¡Ë¤Ï¡¢Ä»Îॹ¥º¥áÌܤβʤǤ¢¤ë¡£¥·¥¸¥å¥¦¥«¥é¡Ê»Í½½¿ý¡Ë¤ÈÁí¾Î¤µ¤ì¤ë¤¬¡¢¶¹µÁ¤Ë¤Ï¤³¤Î1¼ï¤ò¥·¥¸¥å¥¦¥«¥é¤È¸Æ¤Ö¡£
3175 _EOT
3176 check_ex0 5-estat
3177 ${awk} 'BEGIN{h=1}/^$/{++h;next}{if(h % 2 == 1)print}' \
3178 < "${MBOX}" > ./.tcksum
3179 check 5 - ./.tcksum '2870183985 473'
3180 check 6 - ./.terr '4294967295 0'
3182 printf 'eval f 1; eval write ./.twrite; eval type 1; eval type 2\n' |
3183 LC_ALL=${UTF8_LOCALE} ${MAILX} ${ARGS} \
3184 -S headline="%>%a%m %-18f %-16d %i%-s" \
3185 -Rf "${MBOX}" >./.tlog 2>&1
3186 check 7 0 ./.twrite '1259742080 686'
3187 #check 8 - ./.tlog '2506063395 2075'
3188 ${sed} -e '/^\[-- M/d' < ./.tlog > ./.txlog
3189 check 8 - ./.txlog '2528199891 1988'
3190 else
3191 echo 'iconv_mbyte_base64: EUC-JP unsupported, skipping 5-8'
3194 t_epilog
3197 t_iconv_mainbody() {
3198 t_prolog iconv_mainbody
3199 TRAP_EXIT_ADDONS="./.t*"
3201 if [ -n "${UTF8_LOCALE}" ] && have_feat iconv; then
3203 else
3204 echo 'iconv_mainbody: unsupported, skipped'
3205 return
3208 t_xmta 'HamamelisVirginiana Fri Oct 20 16:23:21 2017'
3210 printf '–' | ${MAILX} ${ARGS} ${ADDARG_UNI} -Smta=./.tmta.sh \
3211 -S charset-7bit=us-ascii -S charset-8bit=utf-8 \
3212 -s '–' over-the@rain.bow 2>./.terr
3213 check 1 0 "${MBOX}" '3634015017 251'
3214 check 2 - ./.terr '4294967295 0'
3216 printf '–' | ${MAILX} ${ARGS} ${ADDARG_UNI} -Smta=./.tmta.sh \
3217 -S charset-7bit=us-ascii -S charset-8bit=us-ascii \
3218 -s '–' over-the@rain.bow 2>./.terr
3219 check_exn0 3
3220 check 3 - "${MBOX}" '3634015017 251'
3221 if have_feat uistrings; then
3222 if have_feat docstrings; then # xxx should not be like that
3223 check 4 - ./.terr '2579894983 148'
3224 else
3225 check 4 - ./.terr '271380835 121'
3227 else
3228 echo 'iconv_mainbody-4: unsupported, skipped'
3231 # The different iconv(3) implementations use different replacement sequence
3232 # types (character-wise, byte-wise, and the character(s) used differ)
3233 i="${MAILX_ICONV_MODE}"
3234 if [ -n "${i}" ]; then
3235 printf 'p\nx\n' | ${MAILX} ${ARGS} -Rf "${MBOX}" >./.tout 2>./.terr
3236 j=${?}
3237 check_ex0 5-1-estat ${j}
3238 check 5-1 - ./.terr '4294967295 0'
3239 if [ ${i} -eq 13 ]; then
3240 check 5-2 - ./.tout '189327996 283'
3241 elif [ ${i} -eq 12 ]; then
3242 check 5-3 - ./.tout '1959197095 283'
3243 elif [ ${i} -eq 3 ]; then
3244 check 5-4 - ./.tout '3196380198 279'
3245 else
3246 check 5-5 - ./.tout '3760313827 279'
3248 else
3249 echo 'iconv_mainbody-5: unsupported, skipped'
3252 t_epilog
3255 t_binary_mainbody() {
3256 t_prolog binary_mainbody
3257 TRAP_EXIT_ADDONS="./.t*"
3259 printf 'abra\0\nka\r\ndabra' |
3260 ${MAILX} ${ARGS} ${ADDARG_UNI} -s 'binary with carriage-return!' \
3261 "${MBOX}" 2>./.terr
3262 check 1 0 "${MBOX}" '1629827 239'
3263 check 2 - ./.terr '4294967295 0'
3265 printf 'p\necho\necho writing now\nwrite ./.twrite\n' |
3266 ${MAILX} ${ARGS} -Rf \
3267 -Spipe-application/octet-stream="@* ${cat} > ./.tcat" \
3268 "${MBOX}" >./.tall 2>&1
3269 check 3 0 ./.tall '733582513 319'
3270 check 4 - ./.tcat '3817108933 15'
3271 check 5 - ./.twrite '3817108933 15'
3273 t_epilog
3276 t_C_opt_customhdr() {
3277 t_prolog C_opt_customhdr
3278 TRAP_EXIT_ADDONS="./.t*"
3280 t_xmta 'CimicifugaRacemosa Mon Dec 25 21:33:40 2017'
3282 echo bla |
3283 ${MAILX} ${ARGS} -Smta=./.tmta.sh \
3284 -C 'C-One : Custom One Body' \
3285 -C 'C-Two:CustomTwoBody' \
3286 -S customhdr='chdr1: chdr1 body, chdr2:chdr2 body' \
3287 this-goes@nowhere >./.tall 2>&1
3288 check_ex0 1-estat
3289 ${cat} ./.tall >> "${MBOX}"
3290 check 1 0 "${MBOX}" '2400078426 195'
3292 ${rm} "${MBOX}"
3293 printf 'm this-goes@nowhere\nbody\n!.
3294 unset customhdr
3295 m this-goes2@nowhere\nbody2\n!.
3296 set customhdr=%ccustom1 : custom1 body%c
3297 m this-goes2@nowhere\nbody2\n!.
3298 set customhdr=%ccustom1 : custom1\\, body , custom2: custom2 body%c
3299 m this-goes3@nowhere\nbody3\n!.
3300 ' "'" "'" "'" "'" |
3301 ${MAILX} ${ARGS} -Smta=./.tmta.sh -Sescape=! \
3302 -C 'C-One : Custom One Body' \
3303 -C 'C-Two:CustomTwoBody' \
3304 -S customhdr='chdr1: chdr1 body, chdr2:chdr2 body' \
3305 >./.tall 2>&1
3306 check_ex0 2-estat
3307 ${cat} ./.tall >> "${MBOX}"
3308 check 2 0 "${MBOX}" '3546878678 752'
3310 t_epilog
3312 # }}}
3314 # Operational basics with easy tests {{{
3315 t_alias() {
3316 t_prolog alias
3317 TRAP_EXIT_ADDONS="./.t*"
3319 t_xmta 'Hippocastanum Mon Jun 19 15:07:07 2017'
3321 ${cat} <<- '__EOT' | ${MAILX} ${ARGS} -Smta=./.tmta.sh > ./.tall 2>&1
3322 alias a1 ex1@a1.ple
3323 alias a1 ex2@a1.ple "EX3 <ex3@a1.ple>"
3324 alias a1 ex4@a1.ple
3325 alias a2 ex1@a2.ple ex2@a2.ple ex3@a2.ple ex4@a2.ple
3326 alias a3 a4
3327 alias a4 a5 ex1@a4.ple
3328 alias a5 a6
3329 alias a6 a7 ex1@a6.ple
3330 alias a7 a8
3331 alias a8 ex1@a8.ple
3332 alias a1
3333 alias a2
3334 alias a3
3335 m a1
3336 ~c a2
3337 ~b a3
3338 ~r - '_EOT'
3339 This body is!
3340 This also body is!!
3341 _EOT
3342 __EOT
3343 check 1 0 "${MBOX}" '2496925843 272'
3344 check 2 - .tall '3548953204 152'
3346 # TODO t_alias: n_ALIAS_MAXEXP is compile-time constant,
3347 # TODO need to somehow provide its contents to the test, then test
3349 t_epilog
3352 t_filetype() {
3353 t_prolog filetype
3354 TRAP_EXIT_ADDONS="./.t*"
3356 t_xmta 'Alchemilla Wed Apr 25 15:12:13 2017'
3358 printf 'm m1@e.t\nL1\nHy1\n~.\nm m2@e.t\nL2\nHy2\n~@ %s\n~.\n' \
3359 "${SRCDIR}snailmail.jpg" | ${MAILX} ${ARGS} -Smta=./.tmta.sh
3360 check 1 0 "${MBOX}" '1594682963 13520'
3362 if (echo | gzip -c) >/dev/null 2>&1; then
3364 printf 'File "%s"\ncopy 1 ./.t.mbox.gz\ncopy 2 ./.t.mbox.gz' \
3365 "${MBOX}" | ${MAILX} ${ARGS} \
3366 -X'filetype gz gzip\ -dc gzip\ -c'
3367 printf 'File ./.t.mbox.gz\ncopy * ./.t.mbox\n' |
3368 ${MAILX} ${ARGS} -X'filetype gz gzip\ -dc gzip\ -c'
3369 } > ./.t.out 2>&1
3370 check 2 - "./.t.mbox" '1594682963 13520'
3371 check 3 - "./.t.out" '2392348396 102'
3372 else
3373 echo 'filetype-2: unsupported, skipped'
3374 echo 'filetype-3: unsupported, skipped'
3378 ${rm} ./.t.mbox*
3379 printf 'File "%s"\ncopy 1 ./.t.mbox.gz
3380 copy 2 ./.t.mbox.gz
3381 copy 1 ./.t.mbox.gz
3382 copy 2 ./.t.mbox.gz
3383 ' "${MBOX}" |
3384 ${MAILX} ${ARGS} \
3385 -X'filetype gz gzip\ -dc gzip\ -c' \
3386 -X'filetype mbox.gz "${sed} 1,3d|${cat}" \
3387 "echo eins;echo zwei;echo und mit ${sed} bist Du dabei;${cat}"'
3388 printf 'File ./.t.mbox.gz\ncopy * ./.t.mbox\n' |
3389 ${MAILX} ${ARGS} \
3390 -X'filetype gz gzip\ -dc gzip\ -c' \
3391 -X'filetype mbox.gz "${sed} 1,3d|${cat}" kill\ 0'
3392 } > ./.t.out 2>&1
3393 check 4 - "./.t.mbox" '2886541147 27060'
3394 check 5 - "./.t.out" '852335377 172'
3396 t_epilog
3399 t_record_a_resend() {
3400 t_prolog record_a_resend
3401 TRAP_EXIT_ADDONS="./.t.record ./.t.resent"
3403 printf '
3404 set record=%s
3405 m %s\n~s Subject 1.\nHello.\n~.
3406 set record-files add-file-recipients
3407 m %s\n~s Subject 2.\nHello.\n~.
3408 File %s
3409 resend 2 ./.t.resent
3410 Resend 1 ./.t.resent
3411 set record-resent
3412 resend 2 ./.t.resent
3413 Resend 1 ./.t.resent
3414 ' ./.t.record "${MBOX}" "${MBOX}" "${MBOX}" |
3415 ${MAILX} ${ARGS}
3417 check 1 0 "${MBOX}" '2632690399 252'
3418 check 2 - .t.record '3337485450 456'
3419 check 3 - .t.resent '1560890069 640'
3421 t_epilog
3424 t_e_H_L_opts() {
3425 t_prolog e_H_L_opts
3426 TRAP_EXIT_ADDONS="./.tmta.sh ./.t.mbox"
3428 t_xmta 'Alchemilla Wed Apr 07 17:03:33 2017' ./.t.mbox
3430 touch ./.t.mbox
3431 ${MAILX} ${ARGS} -ef ./.t.mbox
3432 echo ${?} > "${MBOX}"
3434 printf 'm me@exam.ple\nLine 1.\nHello.\n~.\n' |
3435 ${MAILX} ${ARGS} -Smta=./.tmta.sh
3436 printf 'm you@exam.ple\nLine 1.\nBye.\n~.\n' |
3437 ${MAILX} ${ARGS} -Smta=./.tmta.sh
3439 ${MAILX} ${ARGS} -ef ./.t.mbox 2>> "${MBOX}"
3440 echo ${?} >> "${MBOX}"
3441 ${MAILX} ${ARGS} -efL @t@me ./.t.mbox 2>> "${MBOX}"
3442 echo ${?} >> "${MBOX}"
3443 ${MAILX} ${ARGS} -efL @t@you ./.t.mbox 2>> "${MBOX}"
3444 echo ${?} >> "${MBOX}"
3445 ${MAILX} ${ARGS} -efL '@>@Line 1' ./.t.mbox 2>> "${MBOX}"
3446 echo ${?} >> "${MBOX}"
3447 ${MAILX} ${ARGS} -efL '@>@Hello.' ./.t.mbox 2>> "${MBOX}"
3448 echo ${?} >> "${MBOX}"
3449 ${MAILX} ${ARGS} -efL '@>@Bye.' ./.t.mbox 2>> "${MBOX}"
3450 echo ${?} >> "${MBOX}"
3451 ${MAILX} ${ARGS} -efL '@>@Good bye.' ./.t.mbox 2>> "${MBOX}"
3452 echo ${?} >> "${MBOX}"
3454 ${MAILX} ${ARGS} -fH ./.t.mbox >> "${MBOX}" 2>&1
3455 echo ${?} >> "${MBOX}"
3456 ${MAILX} ${ARGS} -fL @t@me ./.t.mbox >> "${MBOX}" 2>&1
3457 echo ${?} >> "${MBOX}"
3458 ${MAILX} ${ARGS} -fL @t@you ./.t.mbox >> "${MBOX}" 2>&1
3459 echo ${?} >> "${MBOX}"
3460 ${MAILX} ${ARGS} -fL '@>@Line 1' ./.t.mbox >> "${MBOX}" 2>&1
3461 echo ${?} >> "${MBOX}"
3462 ${MAILX} ${ARGS} -fL '@>@Hello.' ./.t.mbox >> "${MBOX}" 2>&1
3463 echo ${?} >> "${MBOX}"
3464 ${MAILX} ${ARGS} -fL '@>@Bye.' ./.t.mbox >> "${MBOX}" 2>&1
3465 echo ${?} >> "${MBOX}"
3466 ${MAILX} ${ARGS} -fL '@>@Good bye.' ./.t.mbox >> "${MBOX}" 2>>${ERR}
3467 echo ${?} >> "${MBOX}"
3469 check 1 - "${MBOX}" '1708955574 678'
3473 printf 'm me1@exam.ple\n~s subject cab\nLine 1.\n~.\n' |
3474 ${MAILX} ${ARGS} -Smta=./.tmta.sh \
3475 -r '' -X 'wysh set from=pony1@$LOGNAME'
3476 printf 'm me2@exam.ple\n~s subject bac\nLine 12.\n~.\n' |
3477 ${MAILX} ${ARGS} -Smta=./.tmta.sh \
3478 -r '' -X 'wysh set from=pony2@$LOGNAME'
3479 printf 'm me3@exam.ple\n~s subject abc\nLine 123.\n~.\n' |
3480 ${MAILX} ${ARGS} -Smta=./.tmta.sh \
3481 -r '' -X 'wysh set from=pony3@$LOGNAME'
3483 ${MAILX} ${ARGS} -S folder-hook=fh-test -X 'define fh-test {
3484 echo fh-test size; set autosort=size showname showto
3485 }' -fH ./.t.mbox > "${MBOX}" 2>&1
3486 check 2-1 0 "${MBOX}" '512787278 418'
3488 ${MAILX} ${ARGS} -S folder-hook=fh-test -X 'define fh-test {
3489 echo fh-test subject; set autosort=subject showname showto
3490 }' -fH ./.t.mbox > "${MBOX}" 2>&1
3491 check 2-2 0 "${MBOX}" '3606067531 421'
3493 ${MAILX} ${ARGS} -S folder-hook=fh-test -X 'define fh-test {
3494 echo fh-test from; set autosort=from showto
3495 }' -fH ./.t.mbox > "${MBOX}" 2>&1
3496 check 2-3 0 "${MBOX}" '2506148572 418'
3498 ${MAILX} ${ARGS} -S folder-hook=fh-test -X 'define fh-test {
3499 echo fh-test to; set autosort=to showto
3500 }' -fH ./.t.mbox > "${MBOX}" 2>&1
3501 check 2-4 0 "${MBOX}" '1221542854 416'
3503 t_epilog
3506 t_q_t_etc_opts() {
3507 # Simple, if we need more here, place in a later vim fold!
3508 t_prolog q_t_etc_opts
3509 TRAP_EXIT_ADDONS="./.t*"
3511 # Three tests for MIME encoding and (a bit) content classification.
3512 # At the same time testing -q FILE, < FILE and -t FILE
3513 t__put_body > ./.tin
3515 < ./.tin ${MAILX} ${ARGS} ${ADDARG_UNI} \
3516 -a ./.tin -s "`t__put_subject`" "${MBOX}"
3517 check 1 0 "${MBOX}" '1088822685 6642'
3519 ${rm} "${MBOX}"
3520 < /dev/null ${MAILX} ${ARGS} ${ADDARG_UNI} \
3521 -a ./.tin -s "`t__put_subject`" -q ./.tin "${MBOX}"
3522 check 2 0 "${MBOX}" '1088822685 6642'
3524 ${rm} "${MBOX}"
3525 ( echo "To: ${MBOX}" && echo "Subject: `t__put_subject`" && echo &&
3526 ${cat} ./.tin
3527 ) | ${MAILX} ${ARGS} ${ADDARG_UNI} -Snodot -a ./.tin -t
3528 check 3 0 "${MBOX}" '1088822685 6642'
3530 # Check comments in the header
3531 ${rm} "${MBOX}"
3532 ${cat} <<-_EOT | ${MAILX} ${ARGS} -Snodot -t "${MBOX}"
3533 # Ein Kommentar
3534 From: du@da
3535 # Noch ein Kommentar
3536 Subject: hey you
3537 # Nachgestelltes Kommentar
3539 BOOOM
3540 _EOT
3541 check 4 0 "${MBOX}" '4161555890 124'
3543 t_epilog
3546 t_message_injections() {
3547 # Simple, if we need more here, place in a later vim fold!
3548 t_prolog message_injections
3549 TRAP_EXIT_ADDONS="./.t*"
3551 t_xmta 'Echinacea Tue Jun 20 15:54:02 2017'
3553 echo mysig > ./.tmysig
3555 echo some-body | ${MAILX} ${ARGS} -Smta=./.tmta.sh \
3556 -Smessage-inject-head=head-inject \
3557 -Smessage-inject-tail=tail-inject \
3558 -Ssignature=./.tmysig \
3559 ex@am.ple > ./.tall 2>&1
3560 check 1 0 "${MBOX}" '2434746382 134'
3561 check 2 - .tall '4294967295 0' # empty file
3563 ${rm} "${MBOX}"
3564 ${cat} <<-_EOT > ./.template
3565 From: me
3566 To: ex1@am.ple
3567 Cc: ex2@am.ple
3568 Subject: This subject is
3570 Body, body, body me.
3571 _EOT
3572 < ./.template ${MAILX} ${ARGS} -t -Smta=./.tmta.sh \
3573 -Smessage-inject-head=head-inject \
3574 -Smessage-inject-tail=tail-inject \
3575 -Ssignature=./.tmysig \
3576 > ./.tall 2>&1
3577 check 3 0 "${MBOX}" '3114203412 198'
3578 check 4 - .tall '4294967295 0' # empty file
3580 t_epilog
3583 t_attachments() {
3584 # Relatively Simple, if we need more here, place in a later vim fold!
3585 t_prolog attachments
3586 TRAP_EXIT_ADDONS="./.t*"
3588 t_xmta 'Cannabis Sun Feb 18 02:02:46 2018'
3590 ${cat} <<-_EOT > ./.tx
3591 From steffen Sun Feb 18 02:48:40 2018
3592 Date: Sun, 18 Feb 2018 02:48:40 +0100
3594 Subject: m1
3595 User-Agent: s-nail v14.9.7
3598 From steffen Sun Feb 18 02:48:42 2018
3599 Date: Sun, 18 Feb 2018 02:48:42 +0100
3601 Subject: m2
3602 User-Agent: s-nail v14.9.7
3605 _EOT
3606 echo att1 > ./.t1
3607 printf 'att2-1\natt2-2\natt2-4\n' > ./'.t 2'
3608 printf 'att3-1\natt3-2\natt3-4\n' > ./.t3
3609 printf 'att4-1\natt4-2\natt4-4\n' > './.t 4'
3611 printf \
3612 '!@ ./.t3 "./.t 4" ""
3615 ./.t3
3616 "./.t 2"
3619 !.' \
3620 | ${MAILX} ${ARGS} -Sescape=! -Smta=./.tmta.sh \
3621 -a ./.t1 -a './.t 2' \
3622 -s attachment-test \
3623 ex@am.ple > ./.tall 2>&1
3624 check 1 0 "${MBOX}" '4107062253 634'
3625 if have_feat uistrings; then
3626 check 2 - .tall '1928331872 720'
3627 else
3628 echo 'attachments-2: unsupported, skipped'
3631 ${rm} "${MBOX}"
3632 printf \
3633 'mail ex@amp.ple
3634 !s This the subject is
3635 !@ ./.t3 "#2" "./.t 4" "#1" ""
3638 "./.t 4"
3639 "#2"
3643 mail ex@amp.ple
3644 !s Subject two
3645 !@ ./.t3 "#2" "./.t 4" "#1" ""
3651 mail ex@amp.ple
3652 !s Subject three
3653 !@ ./.t3 "" "#2" "" "./.t 4" "" "#1" ""
3656 ./.t3
3660 mail ex@amp.ple
3661 !s Subject Four
3662 !@ ./.t3 "" "#2" "" "./.t 4" "" "#1" ""
3665 "#1"
3669 mail ex@amp.ple
3670 !s Subject Five
3672 "#2"
3675 !.' \
3676 | ${MAILX} ${ARGS} -Sescape=! -Smta=./.tmta.sh -Rf ./.tx \
3677 > ./.tall 2>&1
3678 check 3 0 "${MBOX}" '798122412 2285'
3679 if have_feat uistrings; then
3680 check 4 - .tall '2526106274 1910'
3681 else
3682 echo 'attachments-4: unsupported, skipped'
3685 ${rm} "${MBOX}"
3686 printf \
3687 'mail ex@amp.ple
3688 !s Subject One
3689 !@ "#."
3690 Body one.
3693 from 2
3694 mail ex@amp.ple
3695 !s Subject Two
3697 "#."
3699 Body two.
3702 reply 1 2
3703 !@ "#."
3707 "#."
3710 !.' \
3711 | ${MAILX} ${ARGS} -Sescape=! -Smta=./.tmta.sh -Rf ./.tx \
3712 > ./.tall 2>&1
3713 check 5 0 "${MBOX}" '2165311808 2276'
3714 if have_feat uistrings; then
3715 check 6 - .tall '3662598562 509'
3716 else
3717 echo 'attachments-6: unsupported, skipped'
3720 t_epilog
3723 t_rfc2231() {
3724 # (after attachments)
3725 t_prolog rfc2231
3726 TRAP_EXIT_ADDONS="./.t*"
3729 mkdir ./.ttt || exit 1
3730 cd ./.ttt || exit 2
3731 : > "ma'ger.txt"
3732 : > "'ger.txt"
3733 : > 'diet\ is \curd.txt'
3734 : > 'diet "is" curd.txt'
3735 : > höde-tröge.txt
3736 : > 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
3737 : > höde__tröge__müde__dätte__hätte__vuelle__guelle__aese__aesse__sauerliche__kräuter__österliche__grüße__mäh.txt
3738 : > hööööööööööööööööö_nöööööööööööööööööööööö_düüüüüüüüüüüüüüüüüüü_bäääääääääääääääääääääääh.txt
3739 : > ✆✆✆✆✆✆✆✆✆✆✆✆✆✆✆✆✆✆✆✆✆✆✆✆.txt
3741 echo bla | ${MAILX} ${ARGS} ${ADDARG_UNI} \
3742 -a "./.ttt/ma'ger.txt" -a "./.ttt/'ger.txt" \
3743 -a './.ttt/diet\ is \curd.txt' -a './.ttt/diet "is" curd.txt' \
3744 -a ./.ttt/höde-tröge.txt \
3745 -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 \
3746 -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 \
3747 -a ./.ttt/hööööööööööööööööö_nöööööööööööööööööööööö_düüüüüüüüüüüüüüüüüüü_bäääääääääääääääääääääääh.txt \
3748 -a ./.ttt/✆✆✆✆✆✆✆✆✆✆✆✆✆✆✆✆✆✆✆✆✆✆✆✆.txt \
3749 "${MBOX}"
3750 check 1 0 "${MBOX}" '3720896054 3088'
3752 # `resend' test, reusing $MBOX
3753 printf "Resend ./.t2\nx\n" | ${MAILX} ${ARGS} -Rf "${MBOX}"
3754 check 2 0 ./.t2 '3720896054 3088'
3756 printf "resend ./.t3\nx\n" | ${MAILX} ${ARGS} -Rf "${MBOX}"
3757 check 3 0 ./.t3 '3979736592 3133'
3759 t_epilog
3762 t_mime_types_load_control() {
3763 t_prolog mime_types_load_control
3764 if have_feat uistrings; then :; else
3765 echo 'mime_types_load_control: unsupported, skipped'
3766 return
3768 TRAP_EXIT_ADDONS="./.t*"
3770 ${cat} <<-_EOT > ./.tmts1
3771 @ application/mathml+xml mathml
3772 _EOT
3773 ${cat} <<-_EOT > ./.tmts2
3774 @ x-conference/x-cooltalk ice
3775 @ aga-aga aga
3776 @ application/aga-aga aga
3777 _EOT
3779 ${cat} <<-_EOT > ./.tmts1.mathml
3780 <head>nonsense ML</head>
3781 _EOT
3782 ${cat} <<-_EOT > ./.tmts2.ice
3783 Icy, icy road.
3784 _EOT
3785 printf 'of which the c\x01rack is coming soon' > ./.tmtsx.doom
3786 printf 'of which the c\x01rack is coming soon' > ./.tmtsx.aga
3788 printf '
3789 m %s
3790 Schub-di-du
3791 ~@ ./.tmts1.mathml
3792 ~@ ./.tmts2.ice
3793 ~@ ./.tmtsx.doom
3794 ~@ ./.tmtsx.aga
3796 File %s
3797 from*
3798 type
3800 ' "${MBOX}" "${MBOX}" |
3801 ${MAILX} ${ARGS} \
3802 -Smimetypes-load-control=f=./.tmts1,f=./.tmts2 \
3803 > ./.tout 2>&1
3804 check_ex0 1-estat
3805 ${cat} "${MBOX}" >> ./.tout
3806 check 1 - ./.tout '2716124839 2441'
3808 echo type | ${MAILX} ${ARGS} -R \
3809 -Smimetypes-load-control=f=./.tmts1,f=./.tmts3 \
3810 -f "${MBOX}" >> ./.tout 2>&1
3811 check 2 0 ./.tout '2093030907 3634'
3813 t_epilog
3815 # }}}
3817 # Around state machine, after basics {{{
3818 t_alternates() {
3819 t_prolog alternates
3820 TRAP_EXIT_ADDONS="./.t*"
3822 t_xmta 'Valeriana Sat Jul 08 15:54:03 2017'
3824 ${cat} <<- '__EOT' | ${MAILX} ${ARGS} -Smta=./.tmta.sh > ./.tall 2>&1
3825 echo --0
3826 alternates
3827 echo $?/$^ERRNAME
3828 alternates a1@b1 a2@b2 a3@b3
3829 echo $?/$^ERRNAME
3830 alternates
3831 echo $?/$^ERRNAME
3832 vput alternates rv
3833 echo $?/$^ERRNAME <$rv>
3835 echo --1
3836 unalternates a2@b2
3837 vput alternates rv
3838 echo $?/$^ERRNAME <$rv>
3839 unalternates a3@b3
3840 vput alternates rv
3841 echo $?/$^ERRNAME <$rv>
3842 unalternates a1@b1
3843 vput alternates rv
3844 echo $?/$^ERRNAME <$rv>
3846 echo --2
3847 unalternates *
3848 alternates a1@b1 a2@b2 a3@b3
3849 unalternates a3@b3
3850 vput alternates rv
3851 echo $?/$^ERRNAME <$rv>
3852 unalternates a2@b2
3853 vput alternates rv
3854 echo $?/$^ERRNAME <$rv>
3855 unalternates a1@b1
3856 vput alternates rv
3857 echo $?/$^ERRNAME <$rv>
3859 echo --3
3860 alternates a1@b1 a2@b2 a3@b3
3861 unalternates a1@b1
3862 vput alternates rv
3863 echo $?/$^ERRNAME <$rv>
3864 unalternates a2@b2
3865 vput alternates rv
3866 echo $?/$^ERRNAME <$rv>
3867 unalternates a3@b3
3868 vput alternates rv
3869 echo $?/$^ERRNAME <$rv>
3871 echo --4
3872 unalternates *
3873 alternates a1@b1 a2@b2 a3@b3
3874 unalternates *
3875 vput alternates rv
3876 echo $?/$^ERRNAME <$rv>
3878 echo --5
3879 unalternates *
3880 alternates a1@b1 a1@c1 a1@d1 a2@b2 a3@b3 a3@c3 a3@d3
3881 m a1@b1 a1@c1 a1@d1
3882 ~s all alternates, only a1@b1 remains
3883 ~c a2@b2
3884 ~b a3@b3 a3@c3 a3@d3
3885 ~r - '_EOT'
3886 This body is!
3887 This also body is!!
3888 _EOT
3891 echo --6
3892 unalternates *
3893 alternates a1@b1 a1@c1 a2@b2 a3@b3
3894 m a1@b1 a1@c1 a1@d1
3895 ~s a1@b1 a1@d1, and a3@c3 a3@d3 remain
3896 ~c a2@b2
3897 ~b a3@b3 a3@c3 a3@d3
3898 ~r - '_EOT'
3899 This body2 is!
3900 _EOT
3903 echo --7
3904 alternates a1@b1 a2@b2 a3; set allnet
3905 m a1@b1 a1@c1 a1@d1
3906 ~s all alternates via allnet, only a1@b1 remains
3907 ~c a2@b2
3908 ~b a3@b3 a3@c3 a3@d3
3909 ~r - '_EOT'
3910 This body3 is!
3911 _EOT
3914 echo --10
3915 unalternates *
3916 alternates a1@b1
3917 echo $?/$^ERRNAME
3918 vput alternates rv
3919 echo $?/$^ERRNAME <$rv>
3920 alternates a2@b2
3921 echo $?/$^ERRNAME
3922 vput alternates rv
3923 echo $?/$^ERRNAME <$rv>
3924 alternates a3@b3
3925 echo $?/$^ERRNAME
3926 vput alternates rv
3927 echo $?/$^ERRNAME <$rv>
3928 alternates a4@b4
3929 echo $?/$^ERRNAME
3930 vput alternates rv
3931 echo $?/$^ERRNAME <$rv>
3933 unalternates *
3934 vput alternates rv
3935 echo $?/$^ERRNAME <$rv>
3937 echo --11
3938 set posix
3939 alternates a1@b1 a2@b2
3940 echo $?/$^ERRNAME
3941 vput alternates rv
3942 echo $?/$^ERRNAME <$rv>
3943 alternates a3@b3 a4@b4
3944 echo $?/$^ERRNAME
3945 vput alternates rv
3946 echo $?/$^ERRNAME <$rv>
3947 __EOT
3949 check 1 0 "${MBOX}" '142184864 515'
3950 if have_feat uistrings; then
3951 check 2 - .tall '1878598364 505'
3952 else
3953 echo 'alternates-2: unsupported, skipped'
3956 # Automatic alternates, also from command line (freezing etc.)
3957 ${rm} "${MBOX}"
3958 ${cat} <<- __EOT > ./.tin
3959 From trouble-report@desy Wed Jun 6 20:19:28 2018
3960 Date: Wed, 06 Jun 2018 19:58:02 +0200
3961 From: a@b.org, b@b.org, c@c.org
3962 Sender: a@b.org
3963 To: b@b.org
3964 Cc: a@b.org, c@c.org
3965 Subject: test
3966 Message-ID: <20180606175802.dw-cn%a@b.org>
3968 sultry
3970 __EOT
3972 printf '#
3973 reply
3975 b@b.org
3976 a@b.org b@b.org c@c.org
3979 my body
3981 ' | ${MAILX} ${ARGS} -Smta=./.tmta.sh -Sescape=! \
3982 -S from=a@b.org,b@b.org,c@c.org -S sender=a@b.org \
3983 -Rf ./.tin > ./.tall 2>&1
3984 check 3 0 "${MBOX}" '287250471 256'
3985 check 4 - .tall '4294967295 0'
3987 # same, per command
3988 printf '#
3989 set from=a@b.org,b@b.org,c@c.org sender=a@b.org
3990 reply
3992 b@b.org
3993 a@b.org b@b.org c@c.org
3996 my body
3998 ' | ${MAILX} ${ARGS} -Smta=./.tmta.sh -Sescape=! \
3999 -Rf ./.tin > ./.tall 2>&1
4000 check 5 0 "${MBOX}" '2618762028 512'
4001 check 6 - .tall '4294967295 0'
4003 # And more, with/out -r
4004 # TODO -r should be the Sender:, which should automatically propagate to
4005 # TODO From: if possible and/or necessary. It should be possible to
4006 # TODO suppres -r stuff from From: and Sender:, but fallback to special -r
4007 # TODO arg as appropriate.
4008 # TODO For now we are a bit messy
4010 ${rm} "${MBOX}"
4011 </dev/null ${MAILX} ${ARGS} -Smta=./.tmta.sh -s '-Sfrom + -r ++ test' \
4012 -c a@b.example,b@b.example,c@c.example \
4013 -S from=a@b.example,b@b.example,c@c.example \
4014 -S sender=a@b.example \
4015 -r a@b.example b@b.example ./.tout >./.tall 2>&1
4016 check 7 0 "${MBOX}" '3510981487 192'
4017 check 8 - .tout '2052716617 201'
4018 check 9 - .tall '4294967295 0'
4020 </dev/null ${MAILX} ${ARGS} -Smta=./.tmta.sh -s '-Sfrom + -r ++ test' \
4021 -c a@b.example,b@b.example,c@c.example \
4022 -S from=a@b.example,b@b.example,c@c.example \
4023 -r a@b.example b@b.example ./.tout >./.tall 2>&1
4024 check 10 0 "${MBOX}" '2282326606 364'
4025 check 11 - .tout '3213404599 382'
4026 check 12 - .tall '4294967295 0'
4028 </dev/null ${MAILX} ${ARGS} -Smta=./.tmta.sh -s '-Sfrom + -r ++ test' \
4029 -c a@b.example,b@b.example,c@c.example \
4030 -S from=a@b.example,b@b.example,c@c.example \
4031 -S sender=a@b.example \
4032 b@b.example >./.tall 2>&1
4033 check 13 0 "${MBOX}" '1460017970 582'
4034 check 14 - .tall '4294967295 0'
4036 t_epilog
4039 t_quote_a_cmd_escapes() {
4040 t_prolog quote_a_cmd_escapes
4041 TRAP_EXIT_ADDONS="./.t*"
4043 t_xmta
4045 echo 'included file' > ./.ttxt
4047 ${cat} <<-_EOT > ./.tmbox
4048 From neverneverland Sun Jul 23 13:46:25 2017
4049 Subject: Bugstop: five miles out 1
4050 Reply-To: mister originator1 <mr1@originator>
4051 From: mister originator1 <mr1@originator>
4052 To: bugstop-commit@five.miles.out
4053 Cc: is1@a.list
4054 In-reply-to: <20170719111113.bkcMz%laber1@backe.eu>
4055 Date: Wed, 19 Jul 2017 09:22:57 -0400
4056 Message-Id: <20170719132257.766AF781267-1@originator>
4057 Status: RO
4059 That's appalling, I.
4061 From neverneverland Sun Jul 23 13:47:25 2017
4062 Subject: Bugstop: five miles out 2
4063 Reply-To: mister originator2 <mr2@originator>
4064 From: mister originator2 <mr2@originator>
4065 To: bugstop-commit@five.miles.out
4066 Cc: is2@a.list
4067 In-reply-to: <20170719111113.bkcMz%laber2@backe.eu>
4068 Date: Wed, 19 Jul 2017 09:23:57 -0400
4069 Message-Id: <20170719132257.766AF781267-2@originator>
4070 Status: RO
4072 That's appalling, II.
4074 From neverneverland Sun Jul 23 13:48:25 2017
4075 Subject: Bugstop: five miles out 3
4076 Reply-To: mister originator3 <mr3@originator>
4077 From: mister originator3 <mr3@originator>
4078 To: bugstop-commit@five.miles.out
4079 Cc: is3@a.list
4080 In-reply-to: <20170719111113.bkcMz%laber3@backe.eu>
4081 Date: Wed, 19 Jul 2017 09:24:57 -0400
4082 Message-Id: <20170719132257.766AF781267-3@originator>
4083 Status: RO
4085 That's appalling, III.
4087 _EOT
4089 printf '#
4090 set indentprefix=" |"
4091 set quote
4092 reply 2
4094 set quote=noheading
4095 reply 2
4097 headerpick type retain cc date from message-id reply-to subject to
4098 set quote=headers
4099 reply 2
4101 set quote=allheaders
4102 reply 2
4104 ' | ${MAILX} ${ARGS} -Smta=./.tmta.sh -Rf \
4105 -Sescape=! -Sindentprefix=' >' \
4106 ./.tmbox >./.tall 2>&1
4107 check_ex0 1-estat
4108 ${cat} ./.tall >> "${MBOX}"
4109 check 1 0 "${MBOX}" '2181726970 2023'
4111 # ~@ is tested with other attachment stuff, ~^ is in compose_hooks
4112 ${rm} "${MBOX}"
4113 printf '#
4114 set Sign=SignVar sign=signvar DEAD=./.ttxt
4115 headerpick type retain Subject
4116 reply 2
4117 !!1 Not escaped. And shell test last, right before !..
4118 !: echo 2 only echoed via colon
4119 !_ echo 3 only echoed via underscore
4120 !< ./.ttxt
4121 !<! echo 5 shell echo included
4122 !| echo 6 pipecmd-pre; cat; echo 6 pipecmd-post
4123 7 and 8 are ~A and ~a:
4126 !b 9 added ~b cc <ex1@am.ple>
4127 !c 10 added ~c c <ex2@am.ple>
4128 11 next ~d / $DEAD
4130 12: ~F
4132 13: ~F 1 3
4133 !F 1 3
4134 14: ~f (headerpick: subject)
4136 15: ~f 1
4137 !f 1
4138 16, 17: ~I Sign, ~i Sign
4139 !I Sign
4140 !i Sign
4141 18: ~M
4143 19: ~M 1
4144 !M 1
4145 20: ~m
4147 21: ~m 3
4148 !m 3
4149 28-32: ~Q; 28: ~Q
4151 29: ~Q 1 3
4152 !Q 1 3
4153 set quote
4154 !:set quote
4155 30: ~Q
4157 31: ~Q 1 3
4158 !Q 1 3
4159 set quote-inject-head quote-inject-tail indentprefix
4160 !:wysh set quote-inject-head=%%a quote-inject-tail=--%%r
4161 32: ~Q
4163 unset quote stuff
4164 !:unset quote quote-inject-head quote-inject-tail
4165 22: ~R ./.ttxt
4166 !R ./.ttxt
4167 23: ~r ./.ttxt
4168 !r ./.ttxt
4169 24: ~s this new subject
4170 !s 24 did new ~s ubject
4171 !t 25 added ~t o <ex3@am.ple>
4172 26: ~U
4174 27: ~U 1
4175 !U 1
4176 and i ~w rite this out to ./.tmsg
4177 !w ./.tmsg
4178 !:wysh set x=$escape;set escape=~
4179 ~!echo shell command output
4180 ~:wysh set escape=$x
4182 ' | ${MAILX} ${ARGS} -Smta=./.tmta.sh -Rf \
4183 -Sescape=! -Sindentprefix=' |' \
4184 ./.tmbox >./.tall 2>&1
4185 check_ex0 2-estat
4186 ${cat} ./.tall >> "${MBOX}"
4187 check 2 - "${MBOX}" '2613898218 4090'
4188 check 3 - ./.tmsg '2771314896 3186'
4190 t_epilog
4193 t_compose_edits() { # XXX very rudimentary
4194 t_prolog compose_edits
4195 TRAP_EXIT_ADDONS="./.t*"
4197 ${cat} <<-_EOT > ./.ted.sh
4198 #!${SHELL}
4199 ${cat} <<-__EOT > \${1}
4200 Fcc: .tout1
4202 Fcc: .tout2
4203 Subject: Fcc test 1
4204 Fcc: .tout3
4206 A body
4207 __EOT
4208 exit 0
4209 _EOT
4210 chmod 0755 .ted.sh
4212 # > All these are in-a-row!
4214 printf 'mail ./.tout\n~s This subject is\nThis body is\n~.' |
4215 ${MAILX} ${ARGS} -Seditheaders >./.tall 2>&1
4216 check 1 0 ./.tout '3993703854 127'
4217 check 2 - ./.tall '4294967295 0'
4219 ${mv} ./.tall ./.tout
4220 printf 'mail ./.tout\n~s This subject is\nThis body is\n~e\n~.' |
4221 ${MAILX} ${ARGS} -Seditheaders -SEDITOR=./.ted.sh >./.tall 2>&1
4222 check 3 0 ./.tout1 '285981670 116'
4223 check 4 - ./.tout2 '285981670 116'
4224 check 5 - ./.tout3 '285981670 116'
4225 check 6 - ./.tout '4294967295 0'
4226 check 7 - ./.tall '4294967295 0'
4227 ${rm} ./.tout1 ./.tout2 ./.tout3
4229 # t_compose_hooks will test ~^ at edge
4230 ${mv} ./.tout ./.tout1
4231 ${mv} ./.tall ./.tout2
4232 printf '#
4233 mail ./.tout\n!s This subject is\nThis body is
4234 !^header list
4235 !^header list fcc
4236 !^header show fcc
4237 !^header remove to
4238 !^header insert fcc ./.tout
4239 !^header insert fcc .tout1
4240 !^header insert fcc ./.tout2
4241 !^header list
4242 !^header show fcc
4243 !^header remove-at fcc 2
4244 !^header remove-at fcc 2
4245 !^header show fcc
4246 !^head remove fcc
4247 !^header show fcc
4248 !^header insert fcc ./.tout
4249 !^header show fcc
4250 !^header list
4252 ' | ${MAILX} ${ARGS} -Sescape=! >./.tall 2>&1
4253 check 8 0 ./.tout '3993703854 127'
4254 check 9 - ./.tout1 '4294967295 0'
4255 check 10 - ./.tout2 '4294967295 0'
4256 check 11 - ./.tall '4280910245 300'
4258 # < No longer in-a-row
4260 ${cat} <<-_EOT | ${MAILX} ${ARGS} -t >./.tall 2>&1
4261 Fcc: .ttout
4262 Subject: Fcc via -t test
4264 My body
4265 _EOT
4266 check 12 0 ./.ttout '1289478830 122'
4267 check 13 - ./.tall '4294967295 0'
4269 t_epilog
4272 t_digmsg() { # XXX rudimentary
4273 t_prolog digmsg
4274 TRAP_EXIT_ADDONS="./.t*"
4276 printf '#
4277 mail ./.tout\n!s This subject is\nThis body is
4278 !:echo --one
4279 !:digmsg create - -
4280 !:digmsg - header list
4281 !:digmsg - header show subject
4282 !:digmsg - header show to
4283 !:digmsg - header remove to
4284 !:digmsg - header list
4285 !:digmsg - header show to
4286 !:digmsg remove -
4287 !:echo --two
4288 !:digmsg create -
4289 !:digmsg - header list; readall x; echon "<$x>";
4290 !:digmsg - header show subject;readall x;echon "<$x>";;
4291 !:digmsg remove -
4292 !:echo --three
4293 !: # nothing here as is comment
4294 !^header insert fcc ./.tbox
4295 !:echo --four
4296 !:digmsg create - -
4297 !:digmsg - header list
4298 !:digmsg - header show fcc
4299 !:echo --five
4300 !^head remove fcc
4301 !:echo --six
4302 !:digmsg - header list
4303 !:digmsg - header show fcc
4304 !:digmsg - header insert fcc ./.tfcc
4305 !:echo --seven
4306 !:digmsg remove -
4307 !:echo bye
4309 echo --hello again
4310 File ./.tfcc
4311 echo --one
4312 digmsg create 1 -
4313 digmsg 1 header list
4314 digmsg 1 header show subject
4315 echo --two
4316 ! : > ./.tempty
4317 File ./.tempty
4318 echo --three
4319 digmsg 1 header list; echo $?/$^ERRNAME
4320 digmsg create -; echo $?/$^ERRNAME
4321 echo ==========
4322 ! %s ./.tfcc > ./.tcat
4323 ! %s "s/This subject is/There subject was/" < ./.tfcc >> ./.tcat
4324 File ./.tcat
4325 mail nowhere@exam.ple
4326 !:echo ===1
4327 !:digmsg create -; echo $?/$^ERRNAME;\\
4328 digmsg create 1; echo $?/$^ERRNAME;\\
4329 digmsg create 2; echo $?/$^ERRNAME
4330 !:echo ===2.1
4331 !:digmsg - h l;echo $?/$^ERRNAME;readall d;echo "$?/$^ERRNAME <$d>"
4332 !:echo =2.2
4333 !:digmsg 1 h l;echo $?/$^ERRNAME;readall d;echo "$?/$^ERRNAME <$d>"
4334 !:echo =2.3
4335 !^ h l
4336 !:echo =2.4
4337 !:digmsg 2 h l;echo $?/$^ERRNAME;readall d;echo "$?/$^ERRNAME <$d>"
4338 !:echo ===3.1
4339 !:digmsg - h s to;echo $?/$^ERRNAME;readall d;echo "$?/$^ERRNAME <$d>"
4340 !:echo =3.2
4341 !:digmsg 1 h s subject;echo $?/$^ERRNAME;readall d;echo "$?/$^ERRNAME <$d>"
4342 !:echo =3.3
4343 !^ h s to
4344 !:echo =3.4
4345 !:digmsg 2 h s subject;echo $?/$^ERRNAME;readall d;echo "$?/$^ERRNAME <$d>"
4346 !:echo ==4.1
4347 !:digmsg remove -; echo $?/$^ERRNAME;\\
4348 digmsg remove 1; echo $?/$^ERRNAME;\\
4349 digmsg remove 2; echo $?/$^ERRNAME;
4351 echo --bye
4352 ' "${cat}" "${sed}" | ${MAILX} ${ARGS} -Sescape=! >./.tall 2>&1
4353 check_ex0 1-estat
4354 if have_feat uistrings; then
4355 check 1 - ./.tall '362777535 1087'
4356 else
4357 check 1 - ./.tall '4281367066 967'
4359 check 2 - ./.tfcc '3993703854 127'
4360 check 3 - ./.tempty '4294967295 0'
4361 check 4 - ./.tcat '2157992522 256'
4363 t_epilog
4366 # }}}
4368 # Heavy use of/rely on state machine (behaviour) and basics {{{
4369 t_compose_hooks() { # {{{ TODO monster
4370 t_prolog compose_hooks
4371 if have_feat uistrings; then :; else
4372 echo 'compose_hooks: unsupported, skipped'
4373 return
4375 TRAP_EXIT_ADDONS="./.t*"
4377 t_xmta 'PrimulaVeris Wed Apr 10 22:59:00 2017'
4379 (echo line one&&echo line two&&echo line three) > ./.treadctl
4380 (echo echo four&&echo echo five&&echo echo six) > ./.tattach
4382 ${cat} <<'__EOT__' > ./.trc
4383 define bail {
4384 echoerr "Failed: $1. Bailing out"; echo "~x"; xit
4386 define xerr {
4387 vput vexpr es substr "$1" 0 1
4388 if [ "$es" != 2 ]
4389 xcall bail "$2"
4392 define read_mline_res {
4393 read hl; wysh set len=$? es=$! en=$^ERRNAME;\
4394 echo $len/$es/$^ERRNAME: $hl
4395 if [ $es -ne $^ERR-NONE ]
4396 xcall bail read_mline_res
4397 elif [ $len -ne 0 ]
4398 \xcall read_mline_res
4401 define ins_addr {
4402 wysh set xh=$1
4403 echo "~^header list"; read hl; echo $hl;\
4404 call xerr "$hl" "in_addr ($xh) 0-1"
4406 echo "~^header insert $xh diet <$xh@exam.ple> spliced";\
4407 read es; echo $es; call xerr "$es" "ins_addr $xh 1-1"
4408 echo "~^header insert $xh <${xh}2@exam.ple>";\
4409 read es; echo $es; call xerr "$es" "ins_addr $xh 1-2"
4410 echo "~^header insert $xh ${xh}3@exam.ple";\
4411 read es; echo $es; call xerr "$es" "ins_addr $xh 1-3"
4412 echo "~^header list $xh"; read hl; echo $hl;\
4413 call xerr "$hl" "ins_addr $xh 1-4"
4414 echo "~^header show $xh"; read es; call xerr $es "ins_addr $xh 1-5"
4415 call read_mline_res
4417 if [ "$t_remove" == "" ]
4418 return
4421 echo "~^header remove $xh"; read es; call xerr $es "ins_addr $xh 2-1"
4422 echo "~^header remove $xh"; read es; vput vexpr es substr $es 0 3
4423 if [ $es != 501 ]
4424 xcall bail "ins_addr $xh 2-2"
4426 echo "~^header list $xh"; read es; vput vexpr es substr $es 0 3
4427 if [ $es != 501 ]
4428 xcall bail "ins_addr $xh 2-3"
4430 echo "~^header show $xh"; read es; vput vexpr es substr $es 0 3
4431 if [ $es != 501 ]
4432 xcall bail "ins_addr $xh 2-4"
4436 echo "~^header insert $xh diet <$xh@exam.ple> spliced";\
4437 read es; echo $es; call xerr "$es" "ins_addr $xh 3-1"
4438 echo "~^header insert $xh <${xh}2@exam.ple>";\
4439 read es; echo $es; call xerr "$es" "ins_addr $xh 3-2"
4440 echo "~^header insert $xh ${xh}3@exam.ple";\
4441 read es; echo $es; call xerr "$es" "ins_addr $xh 3-3"
4442 echo "~^header list $xh"; read hl; echo $hl;\
4443 call xerr "$hl" "ins_addr $xh 3-4"
4444 echo "~^header show $xh"; read es; call xerr $es "ins_addr $xh 3-5"
4445 call read_mline_res
4447 echo "~^header remove-at $xh 1"; read es;\
4448 call xerr $es "ins_addr $xh 3-6"
4449 echo "~^header remove-at $xh 1"; read es;\
4450 call xerr $es "ins_addr $xh 3-7"
4451 echo "~^header remove-at $xh 1"; read es;\
4452 call xerr $es "ins_addr $xh 3-8"
4453 echo "~^header remove-at $xh 1"; read es;\
4454 vput vexpr es substr $es 0 3
4455 if [ $es != 501 ]
4456 xcall bail "ins_addr $xh 3-9"
4458 echo "~^header remove-at $xh T"; read es;\
4459 vput vexpr es substr $es 0 3
4460 if [ $es != 505 ]
4461 xcall bail "ins_addr $xh 3-10"
4463 echo "~^header list $xh"; read es;\
4464 vput vexpr es substr $es 0 3
4465 if [ $es != 501 ]
4466 xcall bail "ins_addr $xh 3-11"
4468 echo "~^header show $xh"; read es;\
4469 vput vexpr es substr $es 0 3
4470 if [ $es != 501 ]
4471 xcall bail "ins_addr $xh 3-12"
4475 echo "~^header insert $xh diet <$xh@exam.ple> spliced";\
4476 read es; echo $es; call xerr "$es" "ins_addr $xh 4-1"
4477 echo "~^header insert $xh <${xh}2@exam.ple> (comment) \"Quot(e)d\"";\
4478 read es; echo $es; call xerr "$es" "ins_addr $xh 4-2"
4479 echo "~^header insert $xh ${xh}3@exam.ple";\
4480 read es; echo $es; call xerr "$es" "ins_addr $xh 4-3"
4481 echo "~^header list $xh"; read hl; echo $hl;\
4482 call xerr "$hl" "header list $xh 3-4"
4483 echo "~^header show $xh"; read es; call xerr $es "ins_addr $xh 4-5"
4484 call read_mline_res
4486 echo "~^header remove-at $xh 3"; read es;\
4487 call xerr $es "ins_addr $xh 4-6"
4488 echo "~^header remove-at $xh 2"; read es;\
4489 call xerr $es "ins_addr $xh 4-7"
4490 echo "~^header remove-at $xh 1"; read es;\
4491 call xerr $es "ins_addr $xh 4-8"
4492 echo "~^header remove-at $xh 1"; read es;\
4493 vput vexpr es substr $es 0 3
4494 if [ $es != 501 ]
4495 xcall bail "ins_addr $xh 4-9"
4497 echo "~^header remove-at $xh T"; read es;\
4498 vput vexpr es substr $es 0 3
4499 if [ $es != 505 ]
4500 xcall bail "ins_addr $xh 4-10"
4502 echo "~^header list $xh"; read es;\
4503 vput vexpr es substr $es 0 3
4504 if [ $es != 501 ]
4505 xcall bail "ins_addr $xh 4-11"
4507 echo "~^header show $xh"; read es;\
4508 vput vexpr es substr $es 0 3
4509 if [ $es != 501 ]
4510 xcall bail "ins_addr $xh 4-12"
4513 define ins_ref {
4514 wysh set xh=$1 mult=$2
4515 echo "~^header list"; read hl; echo $hl;\
4516 call xerr "$hl" "ins_ref ($xh) 0-1"
4518 echo "~^header insert $xh <$xh@exam.ple>";\
4519 read es; echo $es; call xerr "$es" "ins_ref $xh 1-1"
4520 if [ $mult -ne 0 ]
4521 echo "~^header insert $xh <${xh}2@exam.ple>";\
4522 read es; echo $es; call xerr "$es" "ins_ref $xh 1-2"
4523 echo "~^header insert $xh ${xh}3@exam.ple";\
4524 read es; echo $es; call xerr "$es" "ins_ref $xh 1-3"
4525 else
4526 echo "~^header insert $xh <${xh}2@exam.ple>"; read es;\
4527 vput vexpr es substr $es 0 3
4528 if [ $es != 506 ]
4529 xcall bail "ins_ref $xh 1-4"
4533 echo "~^header list $xh"; read hl; echo $hl;\
4534 call xerr "$hl" "ins_ref $xh 1-5"
4535 echo "~^header show $xh"; read es; call xerr $es "ins_ref $xh 1-6"
4536 call read_mline_res
4538 if [ "$t_remove" == "" ]
4539 return
4542 echo "~^header remove $xh"; read es;\
4543 call xerr $es "ins_ref $xh 2-1"
4544 echo "~^header remove $xh"; read es;\
4545 vput vexpr es substr $es 0 3
4546 if [ $es != 501 ]
4547 xcall bail "ins_ref $xh 2-2"
4549 echo "~^header list $xh"; read es;\
4550 vput vexpr es substr $es 0 3
4551 if [ $es != 501 ]
4552 xcall bail "$es ins_ref $xh 2-3"
4554 echo "~^header show $xh"; read es;\
4555 vput vexpr es substr $es 0 3
4556 if [ $es != 501 ]
4557 xcall bail "ins_ref $xh 2-4"
4561 echo "~^header insert $xh <$xh@exam.ple>";\
4562 read es; echo $es; call xerr "$es" "ins_ref $xh 3-1"
4563 if [ $mult -ne 0 ]
4564 echo "~^header insert $xh <${xh}2@exam.ple>";\
4565 read es; echo $es; call xerr "$es" "ins_ref $xh 3-2"
4566 echo "~^header insert $xh ${xh}3@exam.ple";\
4567 read es; echo $es; call xerr "$es" "ins_ref $xh 3-3"
4569 echo "~^header list $xh";\
4570 read hl; echo $hl; call xerr "$hl" "ins_ref $xh 3-4"
4571 echo "~^header show $xh";\
4572 read es; call xerr $es "ins_ref $xh 3-5"
4573 call read_mline_res
4575 echo "~^header remove-at $xh 1"; read es;\
4576 call xerr $es "ins_ref $xh 3-6"
4577 if [ $mult -ne 0 ] && [ $xh != subject ]
4578 echo "~^header remove-at $xh 1"; read es;\
4579 call xerr $es "ins_ref $xh 3-7"
4580 echo "~^header remove-at $xh 1"; read es;\
4581 call xerr $es "ins_ref $xh 3-8"
4583 echo "~^header remove-at $xh 1"; read es;\
4584 vput vexpr es substr $es 0 3
4585 if [ $es != 501 ]
4586 xcall bail "ins_ref $xh 3-9"
4588 echo "~^header remove-at $xh T"; read es;\
4589 vput vexpr es substr $es 0 3
4590 if [ $es != 505 ]
4591 xcall bail "ins_ref $xh 3-10"
4593 echo "~^header show $xh"; read es;\
4594 vput vexpr es substr $es 0 3
4595 if [ $es != 501 ]
4596 xcall bail "ins_ref $xh 3-11"
4600 echo "~^header insert $xh <$xh@exam.ple> ";\
4601 read es; echo $es; call xerr "$es" "ins_ref $xh 4-1"
4602 if [ $mult -ne 0 ]
4603 echo "~^header insert $xh <${xh}2@exam.ple> ";\
4604 read es; echo $es; call xerr "$es" "ins_ref $xh 4-2"
4605 echo "~^header insert $xh ${xh}3@exam.ple";\
4606 read es; echo $es; call xerr "$es" "ins_ref $xh 4-3"
4608 echo "~^header list $xh"; read hl; echo $hl;\
4609 call xerr "$hl" "ins_ref $xh 4-4"
4610 echo "~^header show $xh"; read es; call xerr $es "ins_ref $xh 4-5"
4611 call read_mline_res
4613 if [ $mult -ne 0 ] && [ $xh != subject ]
4614 echo "~^header remove-at $xh 3"; read es;\
4615 call xerr $es "ins_ref $xh 4-6"
4616 echo "~^header remove-at $xh 2"; read es;\
4617 call xerr $es "ins_ref $xh 4-7"
4619 echo "~^header remove-at $xh 1"; read es;\
4620 call xerr $es "ins_ref $xh 4-8"
4621 echo "~^header remove-at $xh 1"; read es;\
4622 vput vexpr es substr $es 0 3
4623 if [ $es != 501 ]
4624 xcall bail "ins_ref $xh 4-9"
4626 echo "~^header remove-at $xh T"; read es;\
4627 vput vexpr es substr $es 0 3
4628 if [ $es != 505 ]
4629 xcall bail "ins_ref $xh 4-10"
4631 echo "~^header show $xh"; read es;\
4632 vput vexpr es substr $es 0 3
4633 if [ $es != 501 ]
4634 xcall bail "ins_ref $xh 4-11"
4637 define t_header {
4638 echo t_header ENTER
4639 # In collect.c order
4640 call ins_addr from
4641 call ins_ref sender 0 # Not a "ref", but works
4642 call ins_addr To
4643 call ins_addr cC
4644 call ins_addr bCc
4645 call ins_addr reply-To
4646 call ins_addr mail-Followup-to
4647 call ins_ref messAge-id 0
4648 call ins_ref rEfErEncEs 1
4649 call ins_ref in-Reply-to 1
4650 call ins_ref subject 1 # Not a "ref", but works (with tweaks)
4651 call ins_addr freeForm1
4652 call ins_addr freeform2
4654 echo "~^header show MAILX-Command"; read es; call xerr $es "t_header 1000"
4655 call read_mline_res
4656 echo "~^header show MAILX-raw-TO"; read es; call xerr $es "t_header 1001"
4657 call read_mline_res
4659 echo t_header LEAVE
4661 define t_attach {
4662 echo t_attach ENTER
4664 echo "~^attachment";\
4665 read hl; echo $hl; vput vexpr es substr "$hl" 0 3
4666 if [ "$es" != 501 ]
4667 xcall bail "attach 0-1"
4670 echo "~^attach attribute ./.treadctl";\
4671 read hl; echo $hl; vput vexpr es substr "$hl" 0 3
4672 if [ "$es" != 501 ]
4673 xcall bail "attach 0-2"
4675 echo "~^attachment attribute-at 1";\
4676 read hl; echo $hl; vput vexpr es substr "$hl" 0 3
4677 if [ "$es" != 501 ]
4678 xcall bail "attach 0-3"
4681 echo "~^attachment insert ./.treadctl=ascii";\
4682 read hl; echo $hl; call xerr "$hl" "attach 1-1"
4683 echo "~^attachment list";\
4684 read es; echo $es;call xerr "$es" "attach 1-2"
4685 call read_mline_res
4686 echo "~^attachment attribute ./.treadctl";\
4687 read es; echo $es;call xerr "$es" "attach 1-3"
4688 call read_mline_res
4689 echo "~^attachment attribute .treadctl";\
4690 read es; echo $es;call xerr "$es" "attach 1-4"
4691 call read_mline_res
4692 echo "~^attachment attribute-at 1";\
4693 read es; echo $es;call xerr "$es" "attach 1-5"
4694 call read_mline_res
4696 echo "~^attachment attribute-set ./.treadctl filename rctl";\
4697 read es; echo $es;call xerr "$es" "attach 1-6"
4698 echo "~^attachment attribute-set .treadctl content-description Au";\
4699 read es; echo $es;call xerr "$es" "attach 1-7"
4700 echo "~^attachment attribute-set-at 1 content-id <10.du@ich>";\
4701 read es; echo $es;call xerr "$es" "attach 1-8"
4703 echo "~^attachment attribute ./.treadctl";\
4704 read es; echo $es;call xerr "$es" "attach 1-9"
4705 call read_mline_res
4706 echo "~^attachment attribute .treadctl";\
4707 read es; echo $es;call xerr "$es" "attach 1-10"
4708 call read_mline_res
4709 echo "~^attachment attribute rctl";\
4710 read es; echo $es;call xerr "$es" "attach 1-11"
4711 call read_mline_res
4712 echo "~^attachment attribute-at 1";\
4713 read es; echo $es;call xerr "$es" "attach 1-12"
4714 call read_mline_res
4717 echo "~^attachment insert ./.tattach=latin1";\
4718 read hl; echo $hl; call xerr "$hl" "attach 2-1"
4719 echo "~^attachment list";\
4720 read es; echo $es;call xerr "$es" "attach 2-2"
4721 call read_mline_res
4722 echo "~^attachment attribute ./.tattach";\
4723 read es; echo $es;call xerr "$es" "attach 2-3"
4724 call read_mline_res
4725 echo "~^attachment attribute .tattach";\
4726 read es; echo $es;call xerr "$es" "attach 2-4"
4727 call read_mline_res
4728 echo "~^attachment attribute-at 2";\
4729 read es; echo $es;call xerr "$es" "attach 2-5"
4730 call read_mline_res
4732 echo "~^attachment attribute-set ./.tattach filename tat";\
4733 read es; echo $es;call xerr "$es" "attach 2-6"
4734 echo \
4735 "~^attachment attribute-set .tattach content-description Au2";\
4736 read es; echo $es;call xerr "$es" "attach 2-7"
4737 echo "~^attachment attribute-set-at 2 content-id <20.du@wir>";\
4738 read es; echo $es;call xerr "$es" "attach 2-8"
4739 echo \
4740 "~^attachment attribute-set-at 2 content-type application/x-sh";\
4741 read es; echo $es;call xerr "$es" "attach 2-9"
4743 echo "~^attachment attribute ./.tattach";\
4744 read es; echo $es;call xerr "$es" "attach 2-10"
4745 call read_mline_res
4746 echo "~^attachment attribute .tattach";\
4747 read es; echo $es;call xerr "$es" "attach 2-11"
4748 call read_mline_res
4749 echo "~^attachment attribute tat";\
4750 read es; echo $es;call xerr "$es" "attach 2-12"
4751 call read_mline_res
4752 echo "~^attachment attribute-at 2";\
4753 read es; echo $es;call xerr "$es" "attach 2-13"
4754 call read_mline_res
4757 if [ "$t_remove" == "" ]
4758 return
4761 echo "~^attachment remove ./.treadctl"; read es;\
4762 call xerr $es "attach 3-1"
4763 echo "~^attachment remove ./.tattach"; read es;\
4764 call xerr $es "attach 3-2"
4765 echo "~^ attachment remove ./.treadctl"; read es;\
4766 vput vexpr es substr $es 0 3
4767 if [ $es != 501 ]
4768 xcall bail "attach 3-3"
4770 echo "~^ attachment remove ./.tattach"; read es;\
4771 vput vexpr es substr $es 0 3
4772 if [ $es != 501 ]
4773 xcall bail "attach 3-4"
4775 echo "~^attachment list"; read es;\
4776 vput vexpr es substr $es 0 3
4777 if [ $es != 501 ]
4778 xcall bail "attach 3-5"
4782 echo "~^attachment insert ./.tattach=latin1";\
4783 read hl; echo $hl; call xerr "$hl" "attach 4-1"
4784 echo "~^attachment insert ./.tattach=latin1";\
4785 read hl; echo $hl; call xerr "$hl" "attach 4-2"
4786 echo "~^attachment list";\
4787 read es; echo $es;call xerr "$es" "attach 4-3"
4788 call read_mline_res
4789 echo "~^ attachment remove .tattach"; read es;\
4790 vput vexpr es substr $es 0 3
4791 if [ $es != 506 ]
4792 xcall bail "attach 4-4 $es"
4794 echo "~^attachment remove-at T"; read es;\
4795 vput vexpr es substr $es 0 3
4796 if [ $es != 505 ]
4797 xcall bail "attach 4-5"
4799 echo "~^attachment remove ./.tattach"; read es;\
4800 call xerr $es "attach 4-6"
4801 echo "~^attachment remove ./.tattach"; read es;\
4802 call xerr $es "attach 4-7"
4803 echo "~^ attachment remove ./.tattach"; read es;\
4804 vput vexpr es substr $es 0 3
4805 if [ $es != 501 ]
4806 xcall bail "attach 4-8 $es"
4808 echo "~^attachment list"; read es;\
4809 vput vexpr es substr $es 0 3
4810 if [ $es != 501 ]
4811 xcall bail "attach 4-9"
4815 echo "~^attachment insert ./.tattach=latin1";\
4816 read hl; echo $hl; call xerr "$hl" "attach 5-1"
4817 echo "~^attachment insert ./.tattach=latin1";\
4818 read hl; echo $hl; call xerr "$hl" "attach 5-2"
4819 echo "~^attachment insert ./.tattach=latin1";\
4820 read hl; echo $hl; call xerr "$hl" "attach 5-3"
4821 echo "~^attachment list";\
4822 read es; echo $es;call xerr "$es" "attach 5-4"
4823 call read_mline_res
4825 echo "~^attachment remove-at 3"; read es;\
4826 call xerr $es "attach 5-5"
4827 echo "~^attachment remove-at 3"; read es;\
4828 vput vexpr es substr $es 0 3
4829 if [ $es != 501 ]
4830 xcall bail "attach 5-6"
4832 echo "~^attachment remove-at 2"; read es;\
4833 call xerr $es "attach 5-7"
4834 echo "~^attachment remove-at 2"; read es;\
4835 vput vexpr es substr $es 0 3
4836 if [ $es != 501 ]
4837 xcall bail "attach 5-8"
4839 echo "~^attachment remove-at 1"; read es;\
4840 call xerr $es "attach 5-9"
4841 echo "~^attachment remove-at 1"; read es;\
4842 vput vexpr es substr $es 0 3
4843 if [ $es != 501 ]
4844 xcall bail "attach 5-10"
4847 echo "~^attachment list"; read es;\
4848 vput vexpr es substr $es 0 3
4849 if [ $es != 501 ]
4850 xcall bail "attach 5-11"
4854 echo "~^attachment insert ./.tattach=latin1";\
4855 read hl; echo $hl; call xerr "$hl" "attach 6-1"
4856 echo "~^attachment insert ./.tattach=latin1";\
4857 read hl; echo $hl; call xerr "$hl" "attach 6-2"
4858 echo "~^attachment insert ./.tattach=latin1";\
4859 read hl; echo $hl; call xerr "$hl" "attach 6-3"
4860 echo "~^attachment list";\
4861 read es; echo $es;call xerr "$es" "attach 6-4"
4862 call read_mline_res
4864 echo "~^attachment remove-at 1"; read es;\
4865 call xerr $es "attach 6-5"
4866 echo "~^attachment remove-at 1"; read es;\
4867 call xerr $es "attach 6-6"
4868 echo "~^attachment remove-at 1"; read es;\
4869 call xerr $es "attach 6-7"
4870 echo "~^attachment remove-at 1"; read es;\
4871 vput vexpr es substr $es 0 3
4872 if [ $es != 501 ]
4873 xcall bail "attach 6-8"
4876 echo "~^attachment list"; read es;\
4877 vput vexpr es substr $es 0 3
4878 if [ $es != 501 ]
4879 xcall bail "attach 6-9"
4882 echo t_attach LEAVE
4884 define t_ocs {
4885 read ver
4886 echo t_ocs
4887 call t_header
4888 call t_attach
4890 define t_oce {
4891 echo on-compose-enter, mailx-command<$mailx-command>
4892 alternates alter1@exam.ple alter2@exam.ple
4893 alternates
4894 set autocc='alter1@exam.ple alter2@exam.ple'
4895 echo mailx-from<$mailx-from> mailx-sender<$mailx-sender>
4896 echo mailx-subject<$mailx-subject>
4897 echo mailx-to<$mailx-to> mailx-cc<$mailx-cc> mailx-bcc<$mailx-bcc>
4898 echo mailx-raw-to<$mailx-raw-to> mailx-raw-cc<$mailx-raw-cc> \
4899 mailx-raw-bcc<$mailx-raw-bcc>
4900 echo mailx-orig-from<$mailx-orig-from> mailx-orig-to<$mailx-orig-to> \
4901 mailx-orig-cc<$mailx-orig-cc> mailx-orig-bcc<$mailx-orig-bcc>
4902 digmsg create - -;echo $?/$!/$^ERRNAME;\
4903 digmsg - header list;\
4904 digmsg remove -;echo $?/$!/$^ERRNAME
4905 digmsg create -;echo $?/$!/$^ERRNAME;\
4906 digmsg - header list;readall x;echon $x;\
4907 digmsg remove -;echo $?/$!/$^ERRNAME
4909 define t_ocl {
4910 echo on-compose-leave, mailx-command<$mailx-command>
4911 vput alternates al
4912 eval alternates $al alter3@exam.ple alter4@exam.ple
4913 alternates
4914 set autobcc='alter3@exam.ple alter4@exam.ple'
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 digmsg create - -;echo $?/$!/$^ERRNAME;\
4923 digmsg - header list;\
4924 digmsg remove -;echo $?/$!/$^ERRNAME
4925 digmsg create -;echo $?/$!/$^ERRNAME;\
4926 digmsg - header list;readall x;echon $x;\
4927 digmsg remove -;echo $?/$!/$^ERRNAME
4929 define t_occ {
4930 echo on-compose-cleanup, mailx-command<$mailx-command>
4931 unalternates *
4932 alternates
4933 echo mailx-from<$mailx-from> mailx-sender<$mailx-sender>
4934 echo mailx-subject<$mailx-subject>
4935 echo mailx-to<$mailx-to> mailx-cc<$mailx-cc> mailx-bcc<$mailx-bcc>
4936 echo mailx-raw-to<$mailx-raw-to> mailx-raw-cc<$mailx-raw-cc> \
4937 mailx-raw-bcc<$mailx-raw-bcc>
4938 echo mailx-orig-from<$mailx-orig-from> mailx-orig-to<$mailx-orig-to> \
4939 mailx-orig-cc<$mailx-orig-cc> mailx-orig-bcc<$mailx-orig-bcc>
4940 # XXX error message variable digmsg create - -;echo $?/$!/$^ERRNAME;\
4941 digmsg - header list;\
4942 digmsg remove -;echo $?/$!/$^ERRNAME
4943 # ditto digmsg create -;echo $?/$!/$^ERRNAME;\
4944 digmsg - header list;readall x;echon $x;\
4945 digmsg remove -;echo $?/$!/$^ERRNAME
4947 wysh set on-compose-splice=t_ocs \
4948 on-compose-enter=t_oce on-compose-leave=t_ocl \
4949 on-compose-cleanup=t_occ
4950 __EOT__
4952 printf 'm this-goes@nowhere\nbody\n!.\n' |
4953 ${MAILX} ${ARGS} -Snomemdebug -Sescape=! -Sstealthmua=noagent \
4954 -X'source ./.trc' -Smta=./.tmta.sh \
4955 >./.tall 2>&1
4956 ${cat} ./.tall >> "${MBOX}"
4957 check 1 0 "${MBOX}" '3049397940 10523'
4959 ${rm} "${MBOX}"
4960 printf 'm this-goes@nowhere\nbody\n!.\n' |
4961 ${MAILX} ${ARGS} -Snomemdebug -Sescape=! -Sstealthmua=noagent \
4962 -St_remove=1 -X'source ./.trc' -Smta=./.tmta.sh \
4963 >./.tall 2>&1
4964 ${cat} ./.tall >> "${MBOX}"
4965 check 2 0 "${MBOX}" '2131370361 12737'
4969 # Some state machine stress, shell compose hook, localopts for hook, etc.
4970 # readctl in child. ~r as HERE document
4971 ${rm} "${MBOX}"
4972 printf 'm ex@am.ple\nbody\n!.
4973 echon ${mailx-command}${mailx-subject}
4974 echon ${mailx-from}${mailx-sender}
4975 echon ${mailx-to}${mailx-cc}${mailx-bcc}
4976 echon ${mailx-raw-to}${mailx-raw-cc}${mailx-raw-bcc}
4977 echon ${mailx-orig-from}${mailx-orig-to}${mailx-orig-gcc}${mailx-orig-bcc}
4978 var t_oce t_ocs t_ocs_sh t_ocl t_occ autocc
4979 ' | ${MAILX} ${ARGS} -Snomemdebug -Sescape=! \
4980 -Smta=./.tmta.sh \
4982 define bail {
4983 echoerr "Failed: $1. Bailing out"; echo "~x"; xit
4985 define xerr {
4986 vput vexpr es substr "$1" 0 1
4987 if [ "$es" != 2 ]
4988 xcall bail "$2"
4991 define read_mline_res {
4992 read hl; wysh set len=$? es=$! en=$^ERRNAME;\
4993 echo $len/$es/$^ERRNAME: $hl
4994 if [ $es -ne $^ERR-NONE ]
4995 xcall bail read_mline_res
4996 elif [ $len -ne 0 ]
4997 \xcall read_mline_res
5000 define _work {
5001 vput vexpr i + 1 "$2"
5002 if [ $i -lt 111 ]
5003 vput vexpr j % $i 10
5004 if [ $j -ne 0 ]
5005 set j=xcall
5006 else
5007 echon "$i.. "
5008 set j=call
5010 eval \\$j _work $1 $i
5011 return $?
5013 vput vexpr i + $i "$1"
5014 return $i
5016 define _read {
5017 wysh set line; read line;wysh set es=$? en=$^ERRNAME ;\
5018 echo read:$es/$en: $line
5019 if [ "${es}" -ne -1 ]
5020 xcall _read
5022 readctl remove $cwd/.treadctl; echo readctl remove:$?/$^ERRNAME
5024 define t_ocs {
5025 read ver
5026 echo t_ocs
5027 echo "~^header list"; read hl; echo $hl;\
5028 vput vexpr es substr "$hl" 0 1
5029 if [ "$es" != 2 ]
5030 xcall bail "header list"
5031 endif
5033 call _work 1; echo $?
5034 echo "~^header insert cc splicy diet <splice@exam.ple> spliced";\
5035 read es; echo $es; vput vexpr es substr "$es" 0 1
5036 if [ "$es" != 2 ]
5037 xcall bail "be diet"
5038 endif
5039 echo "~^header insert cc <splice2@exam.ple>";\
5040 read es; echo $es; vput vexpr es substr "$es" 0 1
5041 if [ "$es" != 2 ]
5042 xcall bail "be diet2"
5043 endif
5045 call _work 2; echo $?
5046 echo "~^header insert bcc juicy juice <juice@exam.ple> spliced";\
5047 read es; echo $es;vput vexpr es substr "$es" 0 1
5048 if [ "$es" != 2 ]
5049 xcall bail "be juicy"
5050 endif
5051 echo "~^header insert bcc juice2@exam.ple";\
5052 read es; echo $es;vput vexpr es substr "$es" 0 1
5053 if [ "$es" != 2 ]
5054 xcall bail "be juicy2"
5055 endif
5056 echo "~^header insert bcc juice3 <juice3@exam.ple>";\
5057 read es; echo $es;vput vexpr es substr "$es" 0 1
5058 if [ "$es" != 2 ]
5059 xcall bail "be juicy3"
5060 endif
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"
5065 endif
5067 echo "~^header remove-at bcc 3";\
5068 read es; echo $es;vput vexpr es substr "$es" 0 1
5069 if [ "$es" != 2 ]
5070 xcall bail "remove juicy5"
5071 endif
5072 echo "~^header remove-at bcc 2";\
5073 read es; echo $es;vput vexpr es substr "$es" 0 1
5074 if [ "$es" != 2 ]
5075 xcall bail "remove juicy6"
5076 endif
5077 echo "~^header remove-at bcc 3";\
5078 read es; echo $es;vput vexpr es substr "$es" 0 3
5079 if [ "$es" != 501 ]
5080 xcall bail "failed to remove-at"
5081 endif
5082 # Add duplicates which ought to be removed!
5083 echo "~^header insert bcc juice4@exam.ple";\
5084 read es; echo $es;vput vexpr es substr "$es" 0 1
5085 if [ "$es" != 2 ]
5086 xcall bail "be juicy4-1"
5087 endif
5088 echo "~^header insert bcc juice4@exam.ple";\
5089 read es; echo $es;vput vexpr es substr "$es" 0 1
5090 if [ "$es" != 2 ]
5091 xcall bail "be juicy4-2"
5092 endif
5093 echo "~^header insert bcc juice4@exam.ple";\
5094 read es; echo $es;vput vexpr es substr "$es" 0 1
5095 if [ "$es" != 2 ]
5096 xcall bail "be juicy4-3"
5097 endif
5098 echo "~:set t_ocs"
5101 call _work 3; echo $?
5102 echo "~r - '__EOT'"
5103 vput ! i echo just knock if you can hear me;\
5104 i=0;\
5105 while [ $i -lt 24 ]; do printf "%s " $i; i=`expr $i + 1`; done;\
5106 echo relax
5107 echon shell-cmd says $?/$^ERRNAME: $i
5108 echo "~x will not become interpreted, we are reading until __EOT"
5109 echo "__EOT"
5110 read r_status; echo "~~r status output: $r_status"
5111 echo "~:echo $? $! $^ERRNAME"
5112 read r_status
5113 echo "~~r status from parent: $r_status"
5116 call _work 4; echo $?
5117 vput cwd cwd;echo cwd:$?
5118 readctl create $cwd/.treadctl ;echo readctl:$?/$^ERRNAME;\
5119 call _read
5122 call _work 5; echo $?
5123 echo "~^header show MAILX-Command"; read es;\
5124 call xerr $es "t_header 1000"; call read_mline_res
5125 echo "~^header show MAILX-raw-TO"; read es;\
5126 call xerr $es "t_header 1001"; xcall read_mline_res
5128 echoerr IT IS WRONG IF YOU SEE THIS
5130 define t_oce {
5131 echo on-compose-enter, mailx-command<$mailx-command>
5132 set t_oce autobcc=oce@exam.ple
5133 alternates alter1@exam.ple alter2@exam.ple
5134 alternates
5135 echo mailx-from<$mailx-from> mailx-sender<$mailx-sender>
5136 echo mailx-subject<$mailx-subject>
5137 echo mailx-to<$mailx-to> mailx-cc<$mailx-cc> mailx-bcc<$mailx-bcc>
5138 echo mailx-raw-to<$mailx-raw-to> mailx-raw-cc<$mailx-raw-cc> \
5139 mailx-raw-bcc<$mailx-raw-bcc>
5140 echo mailx-orig-from<$mailx-orig-from> \
5141 mailx-orig-to<$mailx-orig-to> \
5142 mailx-orig-cc<$mailx-orig-cc> mailx-orig-bcc<$mailx-orig-bcc>
5144 define t_ocl {
5145 echo on-compose-leave, mailx-command<$mailx-command>
5146 set t_ocl autocc=ocl@exam.ple
5147 unalternates *
5148 alternates alter3@exam.ple alter4@exam.ple
5149 alternates
5150 echo mailx-from<$mailx-from> mailx-sender<$mailx-sender>
5151 echo mailx-subject<$mailx-subject>
5152 echo mailx-to<$mailx-to> mailx-cc<$mailx-cc> mailx-bcc<$mailx-bcc>
5153 echo mailx-raw-to<$mailx-raw-to> mailx-raw-cc<$mailx-raw-cc> \
5154 mailx-raw-bcc<$mailx-raw-bcc>
5155 echo mailx-orig-from<$mailx-orig-from> \
5156 mailx-orig-to<$mailx-orig-to> \
5157 mailx-orig-cc<$mailx-orig-cc> mailx-orig-bcc<$mailx-orig-bcc>
5159 define t_occ {
5160 echo on-compose-cleanup, mailx-command<$mailx-command>
5161 set t_occ autocc=occ@exam.ple
5162 unalternates *
5163 alternates
5164 echo mailx-from<$mailx-from> mailx-sender<$mailx-sender>
5165 echo mailx-subject<$mailx-subject>
5166 echo mailx-to<$mailx-to> mailx-cc<$mailx-cc> mailx-bcc<$mailx-bcc>
5167 echo mailx-raw-to<$mailx-raw-to> mailx-raw-cc<$mailx-raw-cc> \
5168 mailx-raw-bcc<$mailx-raw-bcc>
5169 echo mailx-orig-from<$mailx-orig-from> \
5170 mailx-orig-to<$mailx-orig-to> \
5171 mailx-orig-cc<$mailx-orig-cc> mailx-orig-bcc<$mailx-orig-bcc>
5173 wysh set on-compose-splice=t_ocs \
5174 on-compose-splice-shell="read ver;echo t_ocs-shell;\
5175 echo \"~t shell@exam.ple\"; echo \"~:set t_ocs_sh\"" \
5176 on-compose-enter=t_oce on-compose-leave=t_ocl \
5177 on-compose-cleanup=t_occ
5178 ' > ./.tnotes 2>&1
5179 check_ex0 3-estat
5180 ${cat} ./.tnotes >> "${MBOX}"
5181 check 3 - "${MBOX}" '679526364 2431'
5183 # Reply, forward, resend, Resend
5185 ${rm} "${MBOX}"
5186 printf '#
5187 set from="f1@z
5188 m t1@z
5191 set from="du <f2@z>" stealthmua=noagent
5192 m t2@z
5195 ' | ${MAILX} ${ARGS} -Smta=./.tmta.sh -Snomemdebug -Sescape=!
5197 printf '
5198 echo start: $? $! $^ERRNAME
5199 File %s
5200 echo File: $? $! $^ERRNAME;echo;echo
5201 reply 1
5202 this is content of reply 1
5204 echo reply 1: $? $! $^ERRNAME;echo;echo
5205 Reply 1 2
5206 this is content of Reply 1 2
5208 echo Reply 1 2: $? $! $^ERRNAME;echo;echo
5209 forward 1 fwdex@am.ple
5210 this is content of forward 1
5212 echo forward 1: $? $! $^ERRNAME;echo;echo
5213 wysh set forward-inject-head=$'"'"'-- \\
5214 forward (%%a)(%%d)(%%f)(%%i)(%%n)(%%r) --\\n'"'"'
5215 wysh set forward-inject-tail=$'"'"'-- \\
5216 end of forward (%%i) --\\n'"'"'
5217 forward 2 fwdex@am.ple
5218 this is content of forward 2
5220 echo forward 2: $? $! $^ERRNAME;echo;echo
5221 set showname
5222 forward 2 fwdex2@am.ple
5223 this is content of forward 2, 2nd, with showname set
5225 echo forward 2, 2nd: $? $! $^ERRNAME;echo;echo
5226 resend 1 2 resendex@am.ple
5227 echo resend 1 2: $? $! $^ERRNAME;echo;echo
5228 Resend 1 2 Resendex@am.ple
5229 echo Resend 1 2: $? $! $^ERRNAME;echo;echo
5230 ' "${MBOX}" |
5231 ${MAILX} ${ARGS} -Snomemdebug -Sescape=! -Sfullnames \
5232 -Smta=./.tmta.sh \
5234 define bail {
5235 echoerr "Failed: $1. Bailing out"; echo "~x"; xit
5237 define xerr {
5238 vput vexpr es substr "$1" 0 1
5239 if [ "$es" != 2 ]
5240 xcall bail "$2"
5243 define read_mline_res {
5244 read hl; wysh set len=$? es=$! en=$^ERRNAME;\
5245 echo mline_res:$len/$es/$^ERRNAME: $hl
5246 if [ $es -ne $^ERR-NONE ]
5247 xcall bail read_mline_res
5248 elif [ $len -ne 0 ]
5249 \xcall read_mline_res
5252 define work_hl {
5253 echo "~^header show $1"; read es;\
5254 call xerr $es "work_hl $1"; echo $1; call read_mline_res
5255 if [ $# -gt 1 ]
5256 shift
5257 xcall work_hl "$@"
5260 define t_ocs {
5261 read ver
5262 echo t_ocs version $ver
5263 echo "~^header list"; read hl; echo $hl;\
5264 echoerr the header list is $hl;\
5265 call xerr "$hl" "header list"
5266 eval vpospar set $hl
5267 shift
5268 xcall work_hl "$@"
5269 echoerr IT IS WRONG IF YOU SEE THIS
5271 define t_oce {
5272 echo on-XY-enter, mailx-command<$mailx-command>
5273 set t_oce autobcc=oce@exam.ple
5274 echo mailx-from<$mailx-from> mailx-sender<$mailx-sender>
5275 echo mailx-subject<$mailx-subject>
5276 echo mailx-to<$mailx-to> mailx-cc<$mailx-cc> mailx-bcc<$mailx-bcc>
5277 echo mailx-raw-to<$mailx-raw-to> mailx-raw-cc<$mailx-raw-cc> \
5278 mailx-raw-bcc<$mailx-raw-bcc>
5279 echo mailx-orig-from<$mailx-orig-from> \
5280 mailx-orig-to<$mailx-orig-to> \
5281 mailx-orig-cc<$mailx-orig-cc> mailx-orig-bcc<$mailx-orig-bcc>
5283 define t_ocl {
5284 echo on-XY-leave, mailx-command<$mailx-command>
5285 set t_ocl autocc=ocl@exam.ple
5286 echo mailx-from<$mailx-from> mailx-sender<$mailx-sender>
5287 echo mailx-subject<$mailx-subject>
5288 echo mailx-to<$mailx-to> mailx-cc<$mailx-cc> mailx-bcc<$mailx-bcc>
5289 echo mailx-raw-to<$mailx-raw-to> mailx-raw-cc<$mailx-raw-cc> \
5290 mailx-raw-bcc<$mailx-raw-bcc>
5291 echo mailx-orig-from<$mailx-orig-from> \
5292 mailx-orig-to<$mailx-orig-to> \
5293 mailx-orig-cc<$mailx-orig-cc> mailx-orig-bcc<$mailx-orig-bcc>
5295 define t_occ {
5296 echo on-XY-cleanup, mailx-command<$mailx-command>
5297 set t_occ autocc=occ@exam.ple
5298 echo mailx-from<$mailx-from> mailx-sender<$mailx-sender>
5299 echo mailx-subject<$mailx-subject>
5300 echo mailx-to<$mailx-to> mailx-cc<$mailx-cc> mailx-bcc<$mailx-bcc>
5301 echo mailx-raw-to<$mailx-raw-to> mailx-raw-cc<$mailx-raw-cc> \
5302 mailx-raw-bcc<$mailx-raw-bcc>
5303 echo mailx-orig-from<$mailx-orig-from> \
5304 mailx-orig-to<$mailx-orig-to> \
5305 mailx-orig-cc<$mailx-orig-cc> mailx-orig-bcc<$mailx-orig-bcc>
5307 wysh set on-compose-splice=t_ocs \
5308 on-compose-enter=t_oce on-compose-leave=t_ocl \
5309 on-compose-cleanup=t_occ \
5310 on-resend-enter=t_oce on-resend-cleanup=t_occ
5311 ' > ./.tnotes 2>&1
5312 check_ex0 4-estat
5313 ${cat} ./.tnotes >> "${MBOX}"
5314 check 4 - "${MBOX}" '2151712038 11184'
5316 t_epilog
5317 } # }}}
5319 t_mass_recipients() {
5320 t_prolog mass_recipients
5321 TRAP_EXIT_ADDONS="./.t*"
5323 t_xmta 'Eucalyptus Sat Jul 08 21:14:57 2017'
5325 ${cat} <<'__EOT__' > ./.trc
5326 define bail {
5327 echoerr "Failed: $1. Bailing out"; echo "~x"; xit
5329 define ins_addr {
5330 wysh set nr=$1 hn=$2
5331 echo "~$hn $hn$nr@$hn"; echo '~:echo $?'; read es
5332 if [ "$es" -ne 0 ]
5333 xcall bail "ins_addr $hn 1-$nr"
5335 vput vexpr nr + $nr 1
5336 if [ "$nr" -le "$maximum" ]
5337 xcall ins_addr $nr $hn
5340 define bld_alter {
5341 wysh set nr=$1 hn=$2
5342 alternates $hn$nr@$hn
5343 vput vexpr nr + $nr 2
5344 if [ "$nr" -le "$maximum" ]
5345 xcall bld_alter $nr $hn
5348 define t_ocs {
5349 read ver
5350 call ins_addr 1 t
5351 call ins_addr 1 c
5352 call ins_addr 1 b
5354 define t_ocl {
5355 if [ "$t_remove" != '' ]
5356 call bld_alter 1 t
5357 call bld_alter 2 c
5360 set on-compose-splice=t_ocs on-compose-leave=t_ocl
5361 __EOT__
5363 printf 'm this-goes@nowhere\nbody\n!.\n' |
5364 ${MAILX} ${ARGS} -Snomemdebug -Sescape=! -Sstealthmua=noagent \
5365 -X'source ./.trc' -Smta=./.tmta.sh -Smaximum=2001 \
5366 >./.tall 2>&1
5367 check_ex0 1-estat
5368 ${cat} ./.tall >> "${MBOX}"
5369 check 1 - "${MBOX}" '2912243346 51526'
5371 ${rm} "${MBOX}"
5372 printf 'm this-goes@nowhere\nbody\n!.\n' |
5373 ${MAILX} ${ARGS} -Snomemdebug -Sescape=! -Sstealthmua=noagent \
5374 -St_remove=1 -X'source ./.trc' -Smta=./.tmta.sh -Smaximum=2001 \
5375 >./.tall 2>&1
5376 check_ex0 2-estat
5377 ${cat} ./.tall >> "${MBOX}"
5378 check 2 - "${MBOX}" '4097804632 34394'
5380 t_epilog
5383 t_lreply_futh_rth_etc() {
5384 t_prolog lreply_futh_rth_etc
5385 TRAP_EXIT_ADDONS="./.t*"
5387 t_xmta 'HumulusLupulus Thu Jul 27 14:41:20 2017'
5389 ${cat} <<-_EOT > ./.tmbox
5390 From neverneverland Sun Jul 23 13:46:25 2017
5391 Subject: Bugstop: five miles out 1
5392 Reply-To: mister originator2 <mr2@originator>, bugstop@five.miles.out
5393 From: mister originator <mr@originator>
5394 To: bugstop-commit@five.miles.out, laber@backe.eu
5395 Cc: is@a.list
5396 Mail-Followup-To: bugstop@five.miles.out, laber@backe.eu, is@a.list
5397 In-reply-to: <20170719111113.bkcMz%laber@backe.eu>
5398 Date: Wed, 19 Jul 2017 09:22:57 -0400
5399 Message-Id: <20170719132257.766AF781267@originator>
5400 Status: RO
5402 > |Sorry, I think I misunderstand something. I would think that
5404 That's appalling.
5406 From neverneverland Fri Jul 7 22:39:11 2017
5407 Subject: Bugstop: five miles out 2
5408 Reply-To: mister originator2<mr2@originator>,bugstop@five.miles.out,is@a.list
5409 Content-Transfer-Encoding: 7bit
5410 From: mister originator <mr@originator>
5411 To: bugstop-commit@five.miles.out
5412 Cc: is@a.list
5413 Message-ID: <149945963975.28888.6950788126957753723.reportbug@five.miles.out>
5414 Date: Fri, 07 Jul 2017 16:33:59 -0400
5415 Status: R
5417 capable of changing back.
5419 From neverneverland Fri Jul 7 22:42:00 2017
5420 Subject: Bugstop: five miles out 3
5421 Reply-To: mister originator2 <mr2@originator>, bugstop@five.miles.out
5422 Content-Transfer-Encoding: 7bit
5423 From: mister originator <mr@originator>
5424 To: bugstop-commit@five.miles.out
5425 Cc: is@a.list
5426 Message-ID: <149945963975.28888.6950788126957753746.reportbug@five.miles.out>
5427 Date: Fri, 07 Jul 2017 16:33:59 -0400
5428 List-Post: <mailto:bugstop@five.miles.out>
5429 Status: R
5431 are you ready, boots?
5433 From neverneverland Sat Aug 19 23:15:00 2017
5434 Subject: Bugstop: five miles out 4
5435 Reply-To: mister originator2 <mr2@originator>, bugstop@five.miles.out
5436 Content-Transfer-Encoding: 7bit
5437 From: mister originator <mr@originator>
5438 To: bugstop@five.miles.out
5439 Cc: is@a.list
5440 Message-ID: <149945963975.28888.6950788126qtewrqwer.reportbug@five.miles.out>
5441 Date: Fri, 07 Jul 2017 16:33:59 -0400
5442 List-Post: <mailto:bugstop@five.miles.out>
5443 Status: R
5445 are you ready, boots?
5446 _EOT
5450 ${cat} <<-'_EOT' | ${MAILX} ${ARGS} -Sescape=! -Smta=./.tmta.sh \
5451 -Rf ./.tmbox >> "${MBOX}" 2>&1
5452 define r {
5453 wysh set m="This is text of \"reply ${1}."
5454 reply 1 2 3
5455 !I m
5458 !I m
5461 !I m
5464 echo -----After reply $1.1 - $1.3: $?/$^ERRNAME
5466 define R {
5467 wysh set m="This is text of \"Reply ${1}."
5468 eval Reply $2
5469 !I m
5470 !I 2
5473 echo -----After Reply $1.$2: $?/$^ERRNAME
5475 define _Lh {
5476 read protover
5477 echo '~I m'
5478 echo '~I n'
5479 echo '".'
5481 define _Ls {
5482 wysh set m="This is text of \"Lreply ${1}." on-compose-splice=_Lh n=$2
5483 eval Lreply $2
5485 define L {
5486 # We need two indirections for this test: one for the case that Lreply
5487 # fails because of missing recipients: we need to read EOF next, thus
5488 # place this in _Ls last; and second for the succeeding cases EOF is
5489 # not what these should read, so go over the backside and splice it in!
5490 call _Ls "$@"
5491 echo -----After Lreply $1.$2: $?/$^ERRNAME
5493 define x {
5494 localopts call-fixate yes
5495 call r $1
5496 call R $1 1; call R $1 2; call R $1 3; call R $1 4
5497 call L $1 1; call L $1 2; call L $1 3
5499 define tweak {
5500 echo;echo '===== CHANGING === '"$*"' =====';echo
5501 eval "$@"
5504 set from=laber@backe.eu
5505 mlist is@a.list
5506 call x 1
5507 call tweak set reply-to-honour
5508 call x 2
5509 call tweak set followup-to
5510 call x 3
5511 call tweak set followup-to-honour
5512 call x 4
5513 call tweak mlist bugstop@five.miles.out
5514 call x 5
5515 call tweak mlsubscribe bugstop@five.miles.out
5516 call x 6
5517 call tweak set recipients-in-cc
5518 call x 7
5519 # While here, test that *fullnames* works (also here)
5520 set fullnames
5521 reply 1
5522 This message should have *fullnames* in the header.
5524 _EOT
5526 check_ex0 1-estat
5527 if have_feat uistrings; then
5528 check 1 - "${MBOX}" '1530821219 29859'
5529 else
5530 echo 'lreply_futh_rth_etc-1: content test unsupported, skipped'
5535 ${cat} <<-_EOT > ./.tmbox
5536 From tom@i-i.example Thu Oct 26 03:15:55 2017
5537 Date: Wed, 25 Oct 2017 21:15:46 -0400
5538 From: tom <tom@i-i.example>
5539 To: Steffen Nurpmeso <steffen@sdaoden.eu>
5540 Cc: tom <tom@i-i.example>
5541 Subject: Re: xxxx yyyyyyyy configure does not really like a missing zzzzz
5542 Message-ID: <20171026011546.GA11643@i-i.example>
5543 Reply-To: tom@i-i.example
5544 References: <20171025214601.T2pNd%steffen@sdaoden.eu>
5545 In-Reply-To: <20171025214601.T2pNd%steffen@sdaoden.eu>
5546 Status: R
5548 The report's useful :-)
5549 _EOT
5551 # Let us test In-Reply-To: removal starts a new thread..
5552 # This needs adjustment of *stealthmua*
5553 argadd='-Sstealthmua=noagent -Shostname'
5555 ${rm} "${MBOX}"
5556 printf 'reply 1\nthread\n!.\n' |
5557 ${MAILX} ${ARGS} -Sescape=! -Smta=./.tmta.sh -Sreply-to-honour \
5558 ${argadd} -Rf ./.tmbox > .tall 2>&1
5559 check 2 0 "${MBOX}" '3321764338 429'
5560 check 3 - .tall '4294967295 0'
5562 printf 'reply 1\nnew <- thread!\n!||%s -e "%s"\n!.\n' \
5563 "${sed}" '/^In-Reply-To:/d' |
5564 ${MAILX} ${ARGS} -Sescape=! -Smta=./.tmta.sh -Sreply-to-honour \
5565 ${argadd} -Rf "${MBOX}" > .tall 2>&1
5566 check 4 0 "${MBOX}" '1682552516 763'
5567 check 5 - .tall '4294967295 0'
5569 printf 'reply 2\nold <- new <- thread!\n!.\n' |
5570 ${MAILX} ${ARGS} -Sescape=! -Smta=./.tmta.sh -Sreply-to-honour \
5571 ${argadd} -Rf "${MBOX}" > .tall 2>&1
5572 check 6 0 "${MBOX}" '2900984135 1219'
5573 check 7 - .tall '4294967295 0'
5575 printf 'reply 3\nnew <- old <- new <- thread!\n!|| %s -e "%s"\n!.\n' \
5576 "${sed}" '/^In-Reply-To:/d' |
5577 ${MAILX} ${ARGS} -Sescape=! -Smta=./.tmta.sh -Sreply-to-honour \
5578 ${argadd} -Rf "${MBOX}" > .tall 2>&1
5579 check 8 0 "${MBOX}" '794031200 1567'
5580 check 9 - .tall '4294967295 0'
5582 t_epilog
5584 # }}}
5586 # Rest {{{
5587 t_s_mime() {
5588 have_feat smime || {
5589 echo 's_mime: unsupported, skipped'
5590 return
5593 t_prolog s_mime
5594 TRAP_EXIT_ADDONS="./.t.conf ./.tkey.pem ./.tcert.pem ./.tpair.pem"
5595 TRAP_EXIT_ADDONS="${TRAP_EXIT_ADDONS} ./.VERIFY ./.DECRYPT ./.ENCRYPT"
5596 TRAP_EXIT_ADDONS="${TRAP_EXIT_ADDONS} ./.tmta.sh"
5598 ${cat} <<-_EOT > ./.t.conf
5599 [ req ]
5600 default_bits = 1024
5601 default_keyfile = keyfile.pem
5602 distinguished_name = req_distinguished_name
5603 attributes = req_attributes
5604 prompt = no
5605 output_password =
5607 [ req_distinguished_name ]
5608 C = GB
5609 ST = Over the
5610 L = rainbow
5611 O = S-nail
5612 OU = S-nail.smime
5613 CN = S-nail.test
5614 emailAddress = test@localhost
5616 [ req_attributes ]
5617 challengePassword =
5618 _EOT
5619 openssl req -x509 -nodes -days 3650 -config ./.t.conf \
5620 -newkey rsa:1024 -keyout ./.tkey.pem -out ./.tcert.pem >>${ERR} 2>&1
5621 check_ex0 0
5622 ${cat} ./.tkey.pem ./.tcert.pem > ./.tpair.pem
5624 # Sign/verify
5625 echo bla | ${MAILX} ${ARGS} \
5626 -Ssmime-sign -Ssmime-sign-cert=./.tpair.pem -Sfrom=test@localhost \
5627 -Ssmime-sign-digest=sha1 \
5628 -s 'S/MIME test' ./.VERIFY
5629 check_ex0 1-estat
5630 ${awk} '
5631 BEGIN{ skip=0 }
5632 /^Content-Description: /{ skip = 2; print; next }
5633 /^$/{ if(skip) --skip }
5634 { if(!skip) print }
5636 < ./.VERIFY > "${MBOX}"
5637 check 1 - "${MBOX}" '335634014 644'
5639 printf 'verify\nx\n' |
5640 ${MAILX} ${ARGS} -Ssmime-ca-file=./.tcert.pem -Serrexit \
5641 -R -f ./.VERIFY >>${ERR} 2>&1
5642 check_ex0 2
5644 openssl smime -verify -CAfile ./.tcert.pem -in ./.VERIFY >>${ERR} 2>&1
5645 check_ex0 3
5647 # (signing +) encryption / decryption
5648 t_xmta 'Euphrasia Thu Apr 27 17:56:23 2017' ./.ENCRYPT
5650 echo bla |
5651 ${MAILX} ${ARGS} \
5652 -Smta=./.tmta.sh \
5653 -Ssmime-force-encryption -Ssmime-encrypt-recei@ver.com=./.tpair.pem \
5654 -Ssmime-sign-digest=sha1 \
5655 -Ssmime-sign -Ssmime-sign-cert=./.tpair.pem -Sfrom=test@localhost \
5656 -s 'S/MIME test' recei@ver.com
5657 check_ex0 4-estat
5658 ${sed} -e '/^$/,$d' < ./.ENCRYPT > "${MBOX}"
5659 check 4 - "${MBOX}" '1937410597 327'
5661 printf 'decrypt ./.DECRYPT\nfi ./.DECRYPT\nverify\nx\n' |
5662 ${MAILX} ${ARGS} \
5663 -Smta=./.tmta.sh \
5664 -Ssmime-ca-file=./.tcert.pem \
5665 -Ssmime-sign-cert=./.tpair.pem \
5666 -Serrexit -R -f ./.ENCRYPT >>${ERR} 2>&1
5667 check_ex0 5-estat
5668 ${awk} '
5669 BEGIN{ skip=0 }
5670 /^Content-Description: /{ skip = 2; print; next }
5671 /^$/{ if(skip) --skip }
5672 { if(!skip) print }
5674 < ./.DECRYPT > "${MBOX}"
5675 check 5 - "${MBOX}" '1019076159 931'
5677 (openssl smime -decrypt -inkey ./.tkey.pem -in ./.ENCRYPT |
5678 openssl smime -verify -CAfile ./.tcert.pem) >>${ERR} 2>&1
5679 check_ex0 6
5681 ${rm} ./.ENCRYPT
5682 echo bla | ${MAILX} ${ARGS} \
5683 -Smta=./.tmta.sh \
5684 -Ssmime-force-encryption -Ssmime-encrypt-recei@ver.com=./.tpair.pem \
5685 -Sfrom=test@localhost \
5686 -s 'S/MIME test' recei@ver.com
5687 check_ex0 7-estat
5688 ${sed} -e '/^$/,$d' < ./.ENCRYPT > "${MBOX}"
5689 check 7 - "${MBOX}" '1937410597 327'
5691 ${rm} ./.DECRYPT
5692 printf 'decrypt ./.DECRYPT\nx\n' | ${MAILX} ${ARGS} \
5693 -Smta=./.tmta.sh \
5694 -Ssmime-sign-cert=./.tpair.pem \
5695 -Serrexit -R -f ./.ENCRYPT >>${ERR} 2>&1
5696 check 8 0 "./.DECRYPT" '2624716890 422'
5698 openssl smime -decrypt -inkey ./.tkey.pem \
5699 -in ./.ENCRYPT >>${ERR} 2>&1
5700 check_ex0 9
5702 t_epilog
5704 # }}}
5706 # xxx Note: t_z() was the first test (series) written. Today many
5707 # xxx aspects are (better) covered by other tests above, some are not.
5708 # xxx At some future date and time, convert the last remains not covered
5709 # xxx elsewhere to a real t_* test and drop it
5710 t_z() {
5711 t_prolog z
5713 # Test for [260e19d] (Juergen Daubert)
5714 echo body | ${MAILX} ${ARGS} "${MBOX}"
5715 check 4 0 "${MBOX}" '2948857341 94'
5717 # "Test for" [d6f316a] (Gavin Troy)
5718 ${rm} "${MBOX}"
5719 printf "m ${MBOX}\n~s subject1\nEmail body\n~.\nfi ${MBOX}\np\nx\n" |
5720 ${MAILX} ${ARGS} ${ADDARG_UNI} -Spipe-text/plain="@* ${cat}" > "${BODY}"
5721 check 6 0 "${MBOX}" '3942990636 118'
5722 check 6-1 - "${BODY}" '3951695530 170'
5724 # "Test for" [c299c45] (Peter Hofmann) TODO shouldn't end up QP-encoded?
5725 ${rm} "${MBOX}"
5726 ${awk} 'BEGIN{
5727 for(i = 0; i < 10000; ++i)
5728 printf "\xC3\xBC"
5729 #printf "\xF0\x90\x87\x90"
5730 }' | ${MAILX} ${ARGS} ${ADDARG_UNI} -s TestSubject "${MBOX}"
5731 check 7 0 "${MBOX}" '1707496413 61812'
5733 t_epilog
5736 t__put_subject() {
5737 # MIME encoding (QP) stress message subject
5738 printf 'Äbrä Kä?dä=brö Fü?di=bus? '\
5739 'adadaddsssssssddddddddddddddddddddd'\
5740 'ddddddddddddddddddddddddddddddddddd'\
5741 'ddddddddddddddddddddddddddddddddddd'\
5742 'dddddddddddddddddddd Hallelulja? Od'\
5743 'er?? eeeeeeeeeeeeeeeeeeeeeeeeeeeeee'\
5744 'eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee'\
5745 'eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee f'\
5746 'fffffffffffffffffffffffffffffffffff'\
5747 'fffffffffffffffffffff ggggggggggggg'\
5748 'ggggggggggggggggggggggggggggggggggg'\
5749 'ggggggggggggggggggggggggggggggggggg'\
5750 'ggggggggggggggggggggggggggggggggggg'\
5751 'gggggggggggggggg'
5754 t__put_body() {
5755 # MIME encoding (QP) stress message body
5756 printf \
5757 'Ich bin eine DÖS-Datäi mit sehr langen Zeilen und auch '\
5758 'sonst bin ich ganz schön am Schleudern, da kannste denke '\
5759 "wasde willst, gelle, gelle, gelle, gelle, gelle.\r\n"\
5760 "Ich bin eine DÖS-Datäi mit langen Zeilen und auch sonst \r\n"\
5761 "Ich bin eine DÖS-Datäi mit langen Zeilen und auch sonst 1\r\n"\
5762 "Ich bin eine DÖS-Datäi mit langen Zeilen und auch sonst 12\r\n"\
5763 "Ich bin eine DÖS-Datäi mit langen Zeilen und auch sonst 123\r\n"\
5764 "Ich bin eine DÖS-Datäi mit langen Zeilen und auch sonst 1234\r\n"\
5765 "Ich bin eine DÖS-Datäi mit langen Zeilen und auch sonst 12345\r\n"\
5766 "Ich bin eine DÖS-Datäi mit langen Zeilen und auch sonst 123456\r\n"\
5767 "Ich bin eine DÖS-Datäi mit langen Zeilen und auch sonst 1234567\r\n"\
5768 "Ich bin eine DÖS-Datäi mit langen Zeilen und auch sonst 12345678\r\n"\
5769 "Ich bin eine DÖS-Datäi mit langen Zeilen und auch sonst 123456789\r\n"\
5770 "Unn ausserdem habe ich trailing SP/HT/SP/HT whitespace \r\n"\
5771 "Unn ausserdem habe ich trailing HT/SP/HT/SP whitespace \r\n"\
5772 "auf den zeilen vorher.\r\n"\
5773 "From am Zeilenbeginn und From der Mitte gibt es auch.\r\n"\
5774 ".\r\n"\
5775 "Die letzte Zeile war nur ein Punkt.\r\n"\
5776 "..\r\n"\
5777 "Das waren deren zwei.\r\n"\
5778 " \r\n"\
5779 "Die letzte Zeile war ein Leerschritt.\n"\
5780 "=VIER = EQUAL SIGNS=ON A LINE=\r\n"\
5781 "Prösterchen.\r\n"\
5782 ".\n"\
5783 "Die letzte Zeile war nur ein Punkt, mit Unix Zeilenende.\n"\
5784 "..\n"\
5785 "Das waren deren zwei. ditto.\n"\
5786 "Prösterchen.\n"\
5787 "Unn ausseerdem habe ich trailing SP/HT/SP/HT whitespace \n"\
5788 "Unn ausseerdem habe ich trailing HT/SP/HT/SP whitespace \n"\
5789 "auf den zeilen vorher.\n"\
5790 "ditto.\n"\
5791 "Ich bin eine ziemlich lange, steile, scharfe Zeile mit Unix Zeilenende.\n"\
5792 "Ich bin eine ziemlich lange, steile, scharfe Zeile mit Unix Zeilenende.1"\
5793 "\n"\
5794 "Ich bin eine ziemlich lange, steile, scharfe Zeile mit Unix Zeilenende.12"\
5795 "\n"\
5796 "Ich bin eine ziemlich lange, steile, scharfe Zeile mit Unix Zeilenende.12"\
5797 "3\n"\
5798 "Ich bin eine ziemlich lange, steile, scharfe Zeile mit Unix Zeilenende.12"\
5799 "34\n"\
5800 "Ich bin eine ziemlich lange, steile, scharfe Zeile mit Unix Zeilenende.12"\
5801 "345\n"\
5802 "Ich bin eine ziemlich lange, steile, scharfe Zeile mit Unix Zeilenende.12"\
5803 "3456\n"\
5804 "QP am Zeilenende über soft-nl hinweg\n"\
5805 "Ich bin eine ziemlich lange, steile, scharfe Zeile mit Unix Zeilenende."\
5806 "ö123\n"\
5807 "Ich bin eine ziemlich lange, steile, scharfe Zeile mit Unix Zeilenende."\
5808 "1ö23\n"\
5809 "Ich bin eine ziemlich lange, steile, scharfe Zeile mit Unix Zeilenende."\
5810 "12ö3\n"\
5811 "Ich bin eine ziemlich lange, steile, scharfe Zeile mit Unix Zeilenende."\
5812 "123ö\n"\
5813 "=VIER = EQUAL SIGNS=ON A LINE=\n"\
5814 " \n"\
5815 "Die letzte Zeile war ein Leerschritt.\n"\
5819 # cc_all_configs()
5820 # Test all configs TODO doesn't cover all *combinations*, stupid!
5821 cc_all_configs() {
5822 < ${CONF} ${awk} '
5823 BEGIN{
5824 ALWAYS = "OPT_AUTOCC=1 OPT_AMALGAMATION=1"
5825 NOTME["OPT_ALWAYS_UNICODE_LOCALE"] = 1
5826 NOTME["OPT_CROSS_BUILD"] = 1
5827 NOTME["OPT_AUTOCC"] = 1
5828 NOTME["OPT_AMALGAMATION"] = 1
5829 NOTME["OPT_DEBUG"] = 1
5830 NOTME["OPT_DEVEL"] = 1
5831 NOTME["OPT_ASAN_ADDRESS"] = 1
5832 NOTME["OPT_ASAN_MEMORY"] = 1
5833 NOTME["OPT_FORCED_STACKPROT"] = 1
5834 NOTME["OPT_NOMEMDBG"] = 1
5835 NOTME["OPT_NYD2"] = 1
5837 #OPTVALS
5838 OPTNO = 0
5840 MULCHOICE["OPT_IDNA"] = "VAL_IDNA"
5841 MULVALS["VAL_IDNA"] = 1
5843 #VALKEYS[0] = "VAL_RANDOM"
5844 VALVALS["VAL_RANDOM"] = 1
5845 VALNO = 0
5847 /^[[:space:]]*OPT_/{
5848 sub(/^[[:space:]]*/, "")
5849 # This bails for UnixWare 7.1.4 awk(1), but preceeding = with \
5850 # does not seem to be a compliant escape for =
5851 #sub(/=.*$/, "")
5852 $1 = substr($1, 1, index($1, "=") - 1)
5853 if(!NOTME[$1])
5854 OPTVALS[OPTNO++] = $1
5855 next
5857 /^[[:space:]]*VAL_/{
5858 sub(/^[[:space:]]*/, "")
5859 val = substr($0, index($0, "=") + 1)
5860 if(val ~ /^\"/){
5861 val = substr(val, 2)
5862 val = substr(val, 1, length(val) - 1)
5864 $1 = substr($1, 1, index($1, "=") - 1)
5865 if(MULVALS[$1])
5866 MULVALS[$1] = val
5867 else if(VALVALS[$1]){
5868 VALKEYS[VALNO++] = $1
5869 VALVALS[$1] = val
5871 next
5873 function onepass(addons){
5874 a_onepass__worker(addons, "1", "0")
5875 a_onepass__worker(addons, "0", "1")
5877 function a_onepass__worker(addons, b0, b1){
5878 # Doing this completely sequentially and not doing make distclean in
5879 # between runs should effectively result in lesser compilations.
5880 # It is completely dumb nonetheless... TODO
5881 for(ono = 0; ono < OPTNO; ++ono){
5882 myconf = mula = ""
5883 for(i = 0; i < ono; ++i){
5884 myconf = myconf " " OPTVALS[i] "=" b0 " "
5885 if(b0 == "1"){
5886 j = MULCHOICE[OPTVALS[i]]
5887 if(j){
5888 if(i + 1 == ono)
5889 mula = j
5890 else
5891 myconf = myconf " " MULCHOICE[OPTVALS[i]] "=any "
5895 for(i = ono; i < OPTNO; ++i){
5896 myconf = myconf " " OPTVALS[i] "=" b1 " "
5897 if(b1 == "1"){
5898 j = MULCHOICE[OPTVALS[i]]
5899 if(j){
5900 if(i + 1 == OPTNO)
5901 mula = j;
5902 else
5903 myconf = myconf " " MULCHOICE[OPTVALS[i]] "=any "
5908 for(i in VALKEYS)
5909 myconf = VALKEYS[i] "=any " myconf
5911 myconf = myconf " " ALWAYS " " addons
5913 if(mula == "")
5914 print myconf
5915 else{
5916 i = split(MULVALS[mula], ia)
5917 j = "any"
5918 while(i >= 1){
5919 j = ia[i--] " " j
5920 print mula "=\"" j "\" " myconf
5925 END{
5926 # We cannot test NULL because of missing UI strings, which will end
5927 # up with different checksums
5928 print "CONFIG=NULLI OPT_AUTOCC=1"
5929 for(i in VALKEYS){
5930 j = split(VALVALS[VALKEYS[i]], ia)
5931 k = "any"
5932 while(j >= 1){
5933 k = ia[j--] " " k
5934 print VALKEYS[i] "=\"" k "\" CONFIG=NULLI OPT_AUTOCC=1"
5937 print "CONFIG=MINIMAL OPT_AUTOCC=1"
5938 print "CONFIG=NETSEND OPT_AUTOCC=1"
5939 print "CONFIG=MAXIMAL OPT_AUTOCC=1"
5940 for(i in VALKEYS){
5941 j = split(VALVALS[VALKEYS[i]], ia)
5942 k = "any"
5943 while(j >= 1){
5944 k = ia[j--] " " k
5945 print VALKEYS[i] "=\"" k "\" CONFIG=MAXIMAL OPT_AUTOCC=1"
5948 print "CONFIG=DEVEL OPT_AUTOCC=1"
5949 print "CONFIG=ODEVEL OPT_AUTOCC=1"
5951 onepass("OPT_DEBUG=1")
5952 onepass("")
5954 ' | while read c; do
5955 [ -f mk-config.h ] && ${cp} mk-config.h .ccac.h
5956 printf "\n\n##########\n$c\n"
5957 printf "\n\n##########\n$c\n" >&2
5958 ${SHELL} -c "cd .. && ${MAKE} ${c} config"
5959 if [ -f .ccac.h ] && ${cmp} mk-config.h .ccac.h; then
5960 printf 'Skipping after config, nothing changed\n'
5961 printf 'Skipping after config, nothing changed\n' >&2
5962 continue
5964 ${SHELL} -c "cd ../ && ${MAKE} build test"
5965 done
5966 ${rm} -f .ccac.h
5967 cd .. && ${MAKE} distclean
5970 [ -n "${ERR}" ] && echo > ${ERR}
5971 if [ -z "${CHECK_ONLY}${MAE_TEST}" ]; then
5972 cc_all_configs
5973 elif [ -z "${MAE_TEST}" ] || [ ${#} -eq 0 ]; then
5974 # if have_feat devel; then
5975 # ARGS="${ARGS} -Smemdebug"
5976 # export ARGS
5977 # fi
5978 t_all
5980 else
5981 while [ ${#} -gt 0 ]; do
5982 eval t_${1}
5983 shift
5984 done
5987 [ ${ESTAT} -eq 0 ] && echo Ok || echo >&2 'Errors occurred'
5989 exit ${ESTAT}
5990 # s-sh-mode