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