Fix (BWDIC!) `~^ header show': optionally show address type in field 1..
[s-mailx.git] / cc-test.sh
blobb33a1da9009a3dcac230f46367a9aac126584c0d
1 #!/bin/sh -
2 #@ Synopsis: ./cc-test.sh --check-only [s-mailx-binary]
3 #@ ./cc-test.sh --mae-test s-mailx-binary [:TESTNAME:]
4 #@ [./cc-test.sh # Note: performs hundreds of compilations!]
5 #@ The latter generates output files.
6 #@ TODO _All_ the tests should happen in a temporary subdir.
7 # Public Domain
9 # Instead of figuring out the environment in here, require a configured build
10 # system and include that! Our makefile and configure ensure that this test
11 # does not run in the configured, but the user environment nonetheless!
13 if [ -f ./mk-config.ev ]; then
15 elif [ -f snailmail.jpg ] && [ -f .obj/mk-config.ev ]; then
16 cd .obj
17 i=../
18 else
19 echo >&2 'S-nail/S-mailx is not configured.'
20 echo >&2 'This test script requires the shell environment that only the'
21 echo >&2 'configuration script can figure out, even if it will be used to'
22 echo >&2 'test a different binary than the one that would be produced!'
23 echo >&2 '(The necessary information will be in .obj/mk-config.ev.)'
24 echo >&2 'Hit RETURN to run "make config CONFIG=null'
25 read l
26 make config CONFIG=null
28 . ./mk-config.ev
29 if [ -z "${MAILX__CC_TEST_RUNNING}" ]; then
30 MAILX__CC_TEST_RUNNING=1
31 export MAILX__CC_TEST_RUNNING
32 exec "${SHELL}" "${i}${0}" "${@}"
35 # We need *stealthmua* regardless of $SOURCE_DATE_EPOCH, the program name as
36 # such is a compile-time variable
37 ARGS='-:/ -# -Sdotlock-disable -Sexpandaddr=restrict'
38 ARGS="${ARGS}"' -Smime-encoding=quoted-printable -Snosave -Sstealthmua'
39 ADDARG_UNI=-Sttycharset=UTF-8
40 CONF=../make.rc
41 BODY=./.cc-body.txt
42 MBOX=./.cc-test.mbox
43 ERR=./.cc-test.err # Covers only some which cannot be checksummed; not quoted!
44 MAIL=/dev/null
45 #UTF8_LOCALE= autodetected unless set
47 # Note valgrind has problems with FDs in forked childs, which causes some tests
48 # to fail (the FD is rewound and thus will be dumped twice)
49 MEMTESTER=
50 #MEMTESTER='valgrind --leak-check=full --log-file=.vl-%p '
52 ## -- (>8 -- 8<) -- ##
54 msg() {
55 fmt=${1}
56 shift
57 printf >&2 -- "${fmt}\\n" "${@}"
60 ## -- >8 -- 8< -- ##
62 export ARGS ADDARG_UNI CONF BODY MBOX MAIL MAKE awk cat cksum rm sed grep
64 LC_ALL=C LANG=C
65 TZ=UTC
66 # Wed Oct 2 01:50:07 UTC 1996
67 SOURCE_DATE_EPOCH=844221007
69 export LC_ALL LANG TZ SOURCE_DATE_EPOCH
70 unset POSIXLY_CORRECT LOGNAME USER
72 usage() {
73 ${cat} >&2 <<_EOT
74 Synopsis: cc-test.sh --check-only s-mailx-binary
75 Synopsis: cc-test.sh --mae-test s-mailx-binary [:TEST:]
76 Synopsis: cc-test.sh
78 --check-only EXE run the test series, exit success or error;
79 if run in a git(1) checkout then failed tests
80 create test output data files
81 --mae-test EXE [:TEST:] run all or only the given TESTs, and create
82 test output data files; if run in a git(1)
83 checkout with the [test-out] branch available,
84 it will also create file differences
86 Without arguments as many different configurations as possible
87 will be compiled and tested.
88 _EOT
89 exit 1
92 CHECK_ONLY= MAE_TEST= GIT_REPO= MAILX=
93 if [ "${1}" = --check-only ]; then
94 [ ${#} -eq 2 ] || usage
95 CHECK_ONLY=1 MAILX=${2}
96 [ -x "${MAILX}" ] || usage
97 echo 'Mode: --check-only, binary: '"${MAILX}"
98 [ -d ../.git ] && [ -z "${MAILX__CC_TEST_NO_DATA_FILES}" ] && GIT_REPO=1
99 elif [ "${1}" = --mae-test ]; then
100 [ ${#} -ge 2 ] || usage
101 MAE_TEST=1 MAILX=${2}
102 [ -x "${MAILX}" ] || usage
103 shift 2
104 echo 'Mode: --mae-test, binary: '"${MAILX}"
105 [ -d ../.git ] && GIT_REPO=1
106 else
107 [ ${#} -eq 0 ] || usage
108 echo 'Mode: full compile test, this will take a long time...'
109 MAILX__CC_TEST_NO_DATA_FILES=1
110 export MAILX__CC_TEST_NO_DATA_FILES
113 RAWMAILX=${MAILX}
114 MAILX="${MEMTESTER}${MAILX}"
115 export RAWMAILX MAILX
117 if [ -n "${CHECK_ONLY}${MAE_TEST}" ]; then
118 if [ -z "${UTF8_LOCALE}" ]; then
119 # Try ourselfs via nl_langinfo(CODESET) first (requires a new version)
120 if command -v "${RAWMAILX}" >/dev/null 2>&1 &&
121 ("${RAWMAILX}" -:/ -Xxit) >/dev/null 2>&1; then
122 echo 'Trying to detect UTF-8 locale via '"${RAWMAILX}"
123 i=`LC_ALL=C.utf8 "${RAWMAILX}" ${ARGS} -X '
124 \define cset_test {
125 \if [ "${ttycharset}" @i=% utf ]
126 \echo $LC_ALL
127 \xit 0
128 \end
129 \if [ "${#}" -gt 0 ]
130 \wysh set LC_ALL=${1}
131 \shift
132 \eval xcall cset_test "${@}"
133 \end
134 \xit 1
136 \call cset_test C.UTF-8 POSIX.utf8 POSIX.UTF-8 \
137 en_EN.utf8 en_EN.UTF-8 en_US.utf8 en_US.UTF-8
139 [ $? -eq 0 ] && UTF8_LOCALE=$i
142 if [ -z "${UTF8_LOCALE}" ] && (locale yesexpr) >/dev/null 2>&1; then
143 echo 'Trying to detect UTF-8 locale via locale -a'
144 UTF8_LOCALE=`locale -a | { m=
145 while read n; do
146 if { echo ${n} |
147 ${grep} -i -e utf8 -e utf-8; } >/dev/null 2>&1; then
148 m=${n}
149 if { echo ${n} |
150 ${grep} -e POSIX -e en_EN -e en_US; } \
151 >/dev/null 2>&1; then
152 break
155 done
156 echo ${m}
161 if [ -n "${UTF8_LOCALE}" ]; then
162 echo 'Using Unicode locale '"${UTF8_LOCALE}"
163 else
164 echo 'No Unicode locale found, disabling Unicode tests'
168 ESTAT=0
170 TRAP_EXIT_ADDONS=
171 TEST_NAME=
172 trap "${rm} -rf \"${BODY}\" \"${MBOX}\" \"${ERR}\" \${TRAP_EXIT_ADDONS}" EXIT
173 trap "exit 1" HUP INT TERM
175 have_feat() {
176 ( "${RAWMAILX}" ${ARGS} -X'echo $features' -Xx |
177 ${grep} +${1} ) >/dev/null 2>&1
180 t_prolog() {
181 ${rm} -rf "${BODY}" "${MBOX}" ${TRAP_EXIT_ADDONS}
182 TRAP_EXIT_ADDONS=
183 if [ ${#} -gt 0 ]; then
184 TEST_NAME=${1}
185 printf '[%s]\n' "${1}"
188 t_epilog() {
189 t_prolog
192 t_xmta() {
193 [ ${#} -ge 1 ] && __from=${1} ||
194 __from='Silybum Marianum Tue Apr 17 15:55:01 2018'
195 [ ${#} -eq 2 ] && __to=${2} || __to="${MBOX}"
196 ${cat} <<-_EOT > .tmta.sh
197 #!${SHELL} -
198 ( echo 'From '"${__from}" && ${cat} && echo ) >> "${__to}"
199 _EOT
200 chmod 0755 .tmta.sh
203 check() {
204 restat=${?} tid=${1} eestat=${2} f=${3} s=${4}
205 [ "${eestat}" != - ] && [ "${restat}" != "${eestat}" ] &&
206 err "${TESTNAME}-${tid}" 'unexpected status: '"${restat} != ${eestat}"
207 csum="`${cksum} < ${f}`"
208 if [ "${csum}" = "${s}" ]; then
209 maex=
210 printf '%s-%s: ok\n' "${TEST_NAME}" "${tid}"
211 else
212 maex=yes
213 ESTAT=1
214 printf '%s-%s: error: checksum mismatch (got %s)\n' \
215 "${TEST_NAME}" "${tid}" "${csum}"
218 if [ -n "${CHECK_ONLY}${MAE_TEST}" ]; then
219 x="t.${TEST_NAME}-${tid}"
220 if [ -n "${MAE_TEST}" ] || [ -n "${maex}" -a -n "${GIT_REPO}" ]; then
221 ${cp} -f "${f}" ./"${x}"
224 if [ -n "${maex}" ] && [ -n "${GIT_REPO}" ] &&
225 command -v diff >/dev/null 2>&1 &&
226 (git rev-parse --verify test-out) >/dev/null 2>&1 &&
227 git show test-out:"${x}" > ./"${x}".old 2>/dev/null; then
228 diff -ru ./"${x}".old ./"${x}" > "${x}".diff
233 err() {
234 ESTAT=1
235 printf '%s: error: %s\n' ${1} "${2}"
238 check_ex0() {
239 # $1=test name [$2=status]
240 __qm__=${?}
241 [ ${#} -gt 1 ] && __qm__=${2}
242 if [ ${__qm__} -ne 0 ]; then
243 err "${TEST_NAME}-${1}" 'unexpected non-0 exit status'
244 return 0
245 else
246 printf '%s-%s: ok\n' "${TEST_NAME}" "${1}"
247 return 1
251 check_exn0() {
252 # $1=test name [$2=status]
253 __qm__=${?}
254 [ ${#} -gt 1 ] && __qm__=${2}
255 if [ ${__qm__} -eq 0 ]; then
256 err "${TEST_NAME}-${1}" 'unexpected 0 exit status'
257 return 1
258 else
259 printf '%s-%s: ok\n' "${TEST_NAME}" "${1}"
260 return 0
264 if ( [ "$((1 + 1))" = 2 ] ) >/dev/null 2>&1; then
265 add() {
266 echo "$((${1} + ${2}))"
268 else
269 add() {
270 echo `${awk} 'BEGIN{print '${1}' + '${2}'}'`
274 if ( [ "$((2 % 3))" = 2 ] ) >/dev/null 2>&1; then
275 modulo() {
276 echo "$((${1} % ${2}))"
278 else
279 modulo() {
280 echo `${awk} 'BEGIN{print '${1}' % '${2}'}'`
284 t_all() {
285 t_X_opt_input_command_stack
286 t_X_errexit
287 t_S_freeze
288 t_input_inject_semicolon_seq
289 t_shcodec
290 t_wysh
291 t_commandalias
292 t_ifelse
293 t_localopts
294 t_local
295 t_macro_param_shift
296 t_addrcodec
297 t_vexpr
298 t_call_ret
299 t_xcall
300 t_vpospar
301 t_atxplode
302 t_read
304 t_mbox
305 t_maildir
306 t_record_a_resend
307 t_e_H_L_opts
309 t_alternates
310 t_alias
311 # FIXME t_mlist
312 t_filetype
314 t_message_injections
315 t_attachments
316 t_compose_hooks
317 t_C_opt_customhdr
318 t_quote_a_cmd_escapes
320 t_mass_recipients
321 t_mime_types_load_control
322 t_lreply_futh_rth_etc
324 t_mime_if_not_ascii
325 t_xxxheads_rfc2047
326 t_rfc2231
327 t_iconv_mbyte_base64
328 t_iconv_mainbody
329 t_binary_mainbody
330 t_q_t_etc_opts
332 t_s_mime
335 t_X_opt_input_command_stack() {
336 t_prolog X_opt_input_command_stack
338 ${cat} <<- '__EOT' > "${BODY}"
339 echo 1
340 define mac0 {
341 echo mac0-1 via1 $0
343 call mac0
344 echo 2
345 source '\
346 echo "define mac1 {";\
347 echo " echo mac1-1 via1 \$0";\
348 echo " call mac0";\
349 echo " echo mac1-2";\
350 echo " call mac2";\
351 echo " echo mac1-3";\
352 echo "}";\
353 echo "echo 1-1";\
354 echo "define mac2 {";\
355 echo " echo mac2-1 via1 \$0";\
356 echo " call mac0";\
357 echo " echo mac2-2";\
358 echo "}";\
359 echo "echo 1-2";\
360 echo "call mac1";\
361 echo "echo 1-3";\
362 echo "source \"\
363 echo echo 1-1-1 via1 \$0;\
364 echo call mac0;\
365 echo echo 1-1-2;\
366 | \"";\
367 echo "echo 1-4";\
369 echo 3
370 call mac2
371 echo 4
372 undefine *
373 __EOT
375 # The -X option supports multiline arguments, and those can internally use
376 # reverse solidus newline escaping. And all -X options are joined...
377 APO=\'
378 < "${BODY}" ${MAILX} ${ARGS} \
379 -X 'e\' \
380 -X ' c\' \
381 -X ' h\' \
382 -X ' o \' \
383 -X 1 \
385 define mac0 {
386 echo mac0-1 via2 $0
388 call mac0
389 echo 2
392 source '${APO}'\
393 echo "define mac1 {";\
394 echo " echo mac1-1 via2 \$0";\
395 echo " call mac0";\
396 echo " echo mac1-2";\
397 echo " call mac2";\
398 echo " echo mac1-3";\
399 echo "}";\
400 echo "echo 1-1";\
401 echo "define mac2 {";\
402 echo " echo mac2-1 via2 \$0";\
403 echo " call mac0";\
404 echo " echo mac2-2";\
405 echo "}";\
406 echo "echo 1-2";\
407 echo "call mac1";\
408 echo "echo 1-3";\
409 echo "source \"\
410 echo echo 1-1-1 via2 \$0;\
411 echo call mac0;\
412 echo echo 1-1-2;\
413 | \"";\
414 echo "echo 1-4";\
415 | '${APO}'
416 echo 3
419 call mac2
420 echo 4
421 undefine *
422 ' > "${MBOX}"
424 check 1 0 "${MBOX}" '1786542668 416'
426 t_epilog
429 t_X_errexit() {
430 t_prolog X_errexit
431 if have_feat uistrings; then :; else
432 echo 'x_errexit: unsupported, skipped'
433 return
436 ${cat} <<- '__EOT' > "${BODY}"
437 echo one
438 echos nono
439 echo two
440 __EOT
442 </dev/null ${MAILX} ${ARGS} -Snomemdebug \
443 -X'echo one' -X' echos nono ' -X'echo two' \
444 > "${MBOX}" 2>&1
445 check 1 0 "${MBOX}" '916157812 53'
447 </dev/null ${MAILX} ${ARGS} -X'source '"${BODY}" -Snomemdebug \
448 > "${MBOX}" 2>&1
449 check 2 0 "${MBOX}" '916157812 53'
451 </dev/null MAILRC="${BODY}" ${MAILX} ${ARGS} -:u -Snomemdebug \
452 > "${MBOX}" 2>&1
453 check 3 0 "${MBOX}" '916157812 53'
457 </dev/null ${MAILX} ${ARGS} -Serrexit -Snomemdebug \
458 -X'echo one' -X' echos nono ' -X'echo two' \
459 > "${MBOX}" 2>&1
460 check 4 1 "${MBOX}" '2118430867 49'
462 </dev/null ${MAILX} ${ARGS} -X'source '"${BODY}" -Serrexit -Snomemdebug \
463 > "${MBOX}" 2>&1
464 check 5 1 "${MBOX}" '2118430867 49'
466 </dev/null MAILRC="${BODY}" ${MAILX} ${ARGS} -:u -Serrexit -Snomemdebug \
467 > "${MBOX}" 2>&1
468 check 6 1 "${MBOX}" '12955965 172'
470 </dev/null MAILRC="${BODY}" ${MAILX} ${ARGS} -:u -Sposix -Snomemdebug \
471 > "${MBOX}" 2>&1
472 check 7 1 "${MBOX}" '12955965 172'
474 ## Repeat 4-7 with ignerr set
476 ${sed} -e 's/^echos /ignerr echos /' < "${BODY}" > "${MBOX}"
478 </dev/null ${MAILX} ${ARGS} -Serrexit -Snomemdebug \
479 -X'echo one' -X'ignerr echos nono ' -X'echo two' \
480 > "${BODY}" 2>&1
481 check 8 0 "${BODY}" '916157812 53'
483 </dev/null ${MAILX} ${ARGS} -X'source '"${MBOX}" -Serrexit -Snomemdebug \
484 > "${BODY}" 2>&1
485 check 9 0 "${BODY}" '916157812 53'
487 </dev/null MAILRC="${MBOX}" ${MAILX} ${ARGS} -:u -Serrexit -Snomemdebug \
488 > "${BODY}" 2>&1
489 check 10 0 "${BODY}" '916157812 53'
491 </dev/null MAILRC="${MBOX}" ${MAILX} ${ARGS} -:u -Sposix -Snomemdebug \
492 > "${BODY}" 2>&1
493 check 11 0 "${BODY}" '916157812 53'
495 t_epilog
498 t_S_freeze() {
499 t_prolog S_freeze
500 oterm=$TERM
501 unset TERM
503 # Test basic assumption
504 </dev/null MAILRC="${BODY}" ${MAILX} ${ARGS} \
505 -X'echo asksub<$asksub> dietcurd<$dietcurd>' \
506 -Xx > "${MBOX}" 2>&1
507 check 1 0 "${MBOX}" '270686329 21'
510 ${cat} <<- '__EOT' > "${BODY}"
511 echo asksub<$asksub>
512 set asksub
513 echo asksub<$asksub>
514 __EOT
515 </dev/null MAILRC="${BODY}" ${MAILX} ${ARGS} -:u \
516 -Snoasksub -Sasksub -Snoasksub \
517 -X'echo asksub<$asksub>' -X'set asksub' -X'echo asksub<$asksub>' \
518 -Xx > "${MBOX}" 2>&1
519 check 2 0 "${MBOX}" '3182942628 37'
521 ${cat} <<- '__EOT' > "${BODY}"
522 echo asksub<$asksub>
523 unset asksub
524 echo asksub<$asksub>
525 __EOT
526 </dev/null MAILRC="${BODY}" ${MAILX} ${ARGS} -:u \
527 -Snoasksub -Sasksub \
528 -X'echo asksub<$asksub>' -X'unset asksub' -X'echo asksub<$asksub>' \
529 -Xx > "${MBOX}" 2>&1
530 check 3 0 "${MBOX}" '2006554293 39'
533 ${cat} <<- '__EOT' > "${BODY}"
534 echo dietcurd<$dietcurd>
535 set dietcurd=cherry
536 echo dietcurd<$dietcurd>
537 __EOT
538 </dev/null MAILRC="${BODY}" ${MAILX} ${ARGS} -:u \
539 -Sdietcurd=strawberry -Snodietcurd -Sdietcurd=vanilla \
540 -X'echo dietcurd<$dietcurd>' -X'unset dietcurd' \
541 -X'echo dietcurd<$dietcurd>' \
542 -Xx > "${MBOX}" 2>&1
543 check 4 0 "${MBOX}" '1985768109 65'
545 ${cat} <<- '__EOT' > "${BODY}"
546 echo dietcurd<$dietcurd>
547 unset dietcurd
548 echo dietcurd<$dietcurd>
549 __EOT
550 </dev/null MAILRC="${BODY}" ${MAILX} ${ARGS} -:u \
551 -Sdietcurd=strawberry -Snodietcurd \
552 -X'echo dietcurd<$dietcurd>' -X'set dietcurd=vanilla' \
553 -X'echo dietcurd<$dietcurd>' \
554 -Xx > "${MBOX}" 2>&1
555 check 5 0 "${MBOX}" '151574279 51'
557 # TODO once we have a detached one with env=1..
558 if [ -n "`</dev/null ${MAILX} ${ARGS} -X'!echo \$TERM' -Xx`" ]; then
559 echo 's_freeze-{6,7}: shell sets $TERM, skipped'
560 else
561 ${cat} <<- '__EOT' > "${BODY}"
562 !echo "shell says TERM<$TERM>"
563 echo TERM<$TERM>
564 !echo "shell says TERM<$TERM>"
565 set TERM=cherry
566 !echo "shell says TERM<$TERM>"
567 echo TERM<$TERM>
568 !echo "shell says TERM<$TERM>"
569 __EOT
570 </dev/null MAILRC="${BODY}" ${MAILX} ${ARGS} -:u \
571 -STERM=strawberry -SnoTERM -STERM=vanilla \
572 -X'echo mail<$TERM>' -X'unset TERM' \
573 -X'!echo "shell says TERM<$TERM>"' -X'echo TERM<$TERM>' \
574 -Xx > "${MBOX}" 2>&1
575 check 6 0 "${MBOX}" '1211476036 167'
577 ${cat} <<- '__EOT' > "${BODY}"
578 !echo "shell says TERM<$TERM>"
579 echo TERM<$TERM>
580 !echo "shell says TERM<$TERM>"
581 set TERM=cherry
582 !echo "shell says TERM<$TERM>"
583 echo TERM<$TERM>
584 !echo "shell says TERM<$TERM>"
585 __EOT
586 </dev/null MAILRC="${BODY}" ${MAILX} ${ARGS} -:u \
587 -STERM=strawberry -SnoTERM \
588 -X'echo TERM<$TERM>' -X'set TERM=vanilla' \
589 -X'!echo "shell says TERM<$TERM>"' -X'echo TERM<$TERM>' \
590 -Xx > "${MBOX}" 2>&1
591 check 7 0 "${MBOX}" '3365080441 132'
594 TERM=$oterm
595 t_epilog
598 t_input_inject_semicolon_seq() {
599 t_prolog input_inject_semicolon_seq
601 ${cat} <<- '__EOT' | ${MAILX} ${ARGS} > "${MBOX}"
602 define mydeepmac {
603 echon '(mydeepmac)';
605 define mymac {
606 echon this_is_mymac;call mydeepmac;echon ';';
608 echon one';';call mymac;echon two";";call mymac;echo three$';';
609 define mymac {
610 echon this_is_mymac;call mydeepmac;echon ,TOO'!;';
612 echon one';';call mymac;echon two";";call mymac;echo three$';';
613 __EOT
615 check 1 0 "${MBOX}" '512117110 140'
617 t_epilog
620 t_shcodec() {
621 t_prolog shcodec
623 # XXX the first needs to be checked, it is quite dumb as such
624 ${cat} <<- '__EOT' | ${MAILX} ${ARGS} > "${MBOX}" 2>&1
625 shcodec e abcd
626 echo $?/$^ERRNAME
627 shcodec d abcd
628 echo $?/$^ERRNAME
629 shcodec e a'b'c'd'
630 echo $?/$^ERRNAME
631 shcodec d a'b'c'd'
632 echo $?/$^ERRNAME
633 shcodec e a"b"c"d"
634 echo $?/$^ERRNAME
635 shcodec d a"b"c"d"
636 echo $?/$^ERRNAME
637 shcodec e a$'b'c$'d'
638 echo $?/$^ERRNAME
639 shcodec d a$'b'c$'d'
640 echo $?/$^ERRNAME
641 shcodec e 'abcd'
642 echo $?/$^ERRNAME
643 shcodec d 'abcd'
644 echo $?/$^ERRNAME
645 shcodec e "abcd"
646 echo $?/$^ERRNAME
647 shcodec d "abcd"
648 echo $?/$^ERRNAME
649 shcodec e $'abcd'
650 echo $?/$^ERRNAME
651 shcodec d $'abcd'
652 echo $?/$^ERRNAME
653 # same but with vput
654 vput shcodec res e abcd
655 echo $?/$^ERRNAME $res
656 eval shcodec d $res
657 echo $?/$^ERRNAME
658 vput shcodec res d abcd
659 echo $?/$^ERRNAME $res
660 eval shcodec d $res
661 echo $?/$^ERRNAME
662 vput shcodec res e a'b'c'd'
663 echo $?/$^ERRNAME $res
664 eval shcodec d $res
665 echo $?/$^ERRNAME
666 vput shcodec res d a'b'c'd'
667 echo $?/$^ERRNAME $res
668 eval shcodec d $res
669 echo $?/$^ERRNAME
670 vput shcodec res e a"b"c"d"
671 echo $?/$^ERRNAME $res
672 eval shcodec d $res
673 echo $?/$^ERRNAME
674 vput shcodec res d a"b"c"d"
675 echo $?/$^ERRNAME $res
676 eval shcodec d $res
677 echo $?/$^ERRNAME
678 vput shcodec res e a$'b'c$'d'
679 echo $?/$^ERRNAME $res
680 eval shcodec d $res
681 echo $?/$^ERRNAME
682 vput shcodec res d a$'b'c$'d'
683 echo $?/$^ERRNAME $res
684 eval shcodec d $res
685 echo $?/$^ERRNAME
686 vput shcodec res e 'abcd'
687 echo $?/$^ERRNAME $res
688 eval shcodec d $res
689 echo $?/$^ERRNAME
690 vput shcodec res d 'abcd'
691 echo $?/$^ERRNAME $res
692 eval shcodec d $res
693 echo $?/$^ERRNAME
694 vput shcodec res e "abcd"
695 echo $?/$^ERRNAME $res
696 eval shcodec d $res
697 echo $?/$^ERRNAME
698 vput shcodec res d "abcd"
699 echo $?/$^ERRNAME $res
700 eval shcodec d $res
701 echo $?/$^ERRNAME
702 vput shcodec res e $'abcd'
703 echo $?/$^ERRNAME $res
704 eval shcodec d $res
705 echo $?/$^ERRNAME
706 vput shcodec res d $'abcd'
707 echo $?/$^ERRNAME $res
708 eval shcodec d $res
709 echo $?/$^ERRNAME
711 vput shcodec res e a b\ c d
712 echo $?/$^ERRNAME $res
713 eval shcodec d $res
714 echo $?/$^ERRNAME
715 vput shcodec res d a b\ c d
716 echo $?/$^ERRNAME $res
717 vput shcodec res e ab cd
718 echo $?/$^ERRNAME $res
719 eval shcodec d $res
720 echo $?/$^ERRNAME
721 vput shcodec res d 'ab cd'
722 echo $?/$^ERRNAME $res
723 vput shcodec res e a 'b c' d
724 echo $?/$^ERRNAME $res
725 eval shcodec d $res
726 echo $?/$^ERRNAME
727 vput shcodec res d a 'b c' d
728 echo $?/$^ERRNAME $res
729 vput shcodec res e a "b c" d
730 echo $?/$^ERRNAME $res
731 eval shcodec d $res
732 echo $?/$^ERRNAME
733 vput shcodec res d a "b c" d
734 echo $?/$^ERRNAME $res
735 vput shcodec res e a $'b c' d
736 echo $?/$^ERRNAME $res
737 eval shcodec d $res
738 echo $?/$^ERRNAME
739 vput shcodec res d a $'b c' d
740 echo $?/$^ERRNAME $res
742 vput shcodec res e 'a$`"\'
743 echo $?/$^ERRNAME $res
744 eval shcodec d $res
745 echo $?/$^ERRNAME
746 vput shcodec res d 'a$`"\'
747 echo $?/$^ERRNAME $res
748 vput shcodec res e "a\$\`'\"\\"
749 echo $?/$^ERRNAME $res
750 eval shcodec d $res
751 echo $?/$^ERRNAME
752 vput shcodec res d "a\$\`'\"\\"
753 echo $?/$^ERRNAME $res
754 vput shcodec res e $'a\$`\'\"\\'
755 echo $?/$^ERRNAME $res
756 eval shcodec d $res
757 echo $?/$^ERRNAME
758 vput shcodec res d $'a\$`\'\"\\'
759 echo $?/$^ERRNAME $res
760 vput shcodec res e $'a\$`\'"\\'
761 echo $?/$^ERRNAME $res
762 eval shcodec d $res
763 echo $?/$^ERRNAME
764 vput shcodec res d $'a\$`\'"\\'
765 echo $?/$^ERRNAME $res
767 set diet=curd
768 vput shcodec res e a${diet}c
769 echo $?/$^ERRNAME $res
770 eval shcodec d $res
771 echo $?/$^ERRNAME
772 eval vput shcodec res e a${diet}c
773 echo $?/$^ERRNAME $res
774 eval shcodec d $res
775 echo $?/$^ERRNAME
776 vput shcodec res e "a${diet}c"
777 echo $?/$^ERRNAME $res
778 eval shcodec d $res
779 echo $?/$^ERRNAME
780 eval vput shcodec res e "a${diet}c"
781 echo $?/$^ERRNAME $res
782 eval shcodec d $res
783 echo $?/$^ERRNAME
784 __EOT
785 check 1 0 "${MBOX}" '3316745312 1241'
787 if [ -z "${UTF8_LOCALE}" ]; then
788 echo 'Skip shcodec-unicode, no UTF8_LOCALE TODO CANNOT'
789 else
790 ${cat} <<- '__EOT' | LC_ALL=${UTF8_LOCALE} \
791 ${MAILX} ${ARGS} > "${MBOX}" 2>>${ERR}
793 shcodec e täst
794 shcodec +e täst
795 shcodec d $'t\u00E4st'
796 shcodec e aՍc
797 shcodec +e aՍc
798 shcodec d $'a\u054Dc'
799 shcodec e a😃c
800 shcodec +e a😃c
801 shcodec d $'a\U0001F603c'
802 __EOT
803 check unicode 0 "${MBOX}" '4233409480 77'
806 t_epilog
809 t_wysh() {
810 t_prolog wysh
812 ${cat} <<- '__EOT' > "${BODY}"
814 echo abcd
815 echo a'b'c'd'
816 echo a"b"c"d"
817 echo a$'b'c$'d'
818 echo 'abcd'
819 echo "abcd"
820 echo $'abcd'
821 echo a\ b\ c\ d
822 echo a 'b c' d
823 echo a "b c" d
824 echo a $'b c' d
826 echo 'a$`"\'
827 echo "a\$\`'\"\\"
828 echo $'a\$`\'\"\\'
829 echo $'a\$`\'"\\'
830 # DIET=CURD TIED=
831 echo 'a${DIET}b${TIED}c\${DIET}d\${TIED}e' # COMMENT
832 echo "a${DIET}b${TIED}c\${DIET}d\${TIED}e"
833 echo $'a${DIET}b${TIED}c\${DIET}d\${TIED}e'
835 echo a$'\101\0101\x41\u0041\u41\U00000041\U41'c
836 echo a$'\u0041\u41\u0C1\U00000041\U41'c
837 echo a$'\377'c
838 echo a$'\0377'c
839 echo a$'\400'c
840 echo a$'\0400'c
841 echo a$'\U1100001'c
843 echo a$'b\0c'd
844 echo a$'b\00c'de
845 echo a$'b\000c'df
846 echo a$'b\0000c'dg
847 echo a$'b\x0c'dh
848 echo a$'b\x00c'di
849 echo a$'b\u0'dj
850 echo a$'b\u00'dk
851 echo a$'b\u000'dl
852 echo a$'b\u0000'dm
853 echo a$'b\U0'dn
854 echo a$'b\U00'do
855 echo a$'b\U000'dp
856 echo a$'b\U0000'dq
857 echo a$'b\U00000'dr
858 echo a$'b\U000000'ds
859 echo a$'b\U0000000'dt
860 echo a$'b\U00000000'du
862 echo a$'\cI'b
863 echo a$'\011'b
864 echo a$'\x9'b
865 echo a$'\u9'b
866 echo a$'\U9'b
867 echo a$'\c@'b c d
868 __EOT
870 if [ -z "${UTF8_LOCALE}" ]; then
871 echo 'Skip wysh-unicode, no UTF8_LOCALE'
872 else
873 < "${BODY}" DIET=CURD TIED= \
874 LC_ALL=${UTF8_LOCALE} ${MAILX} ${ARGS} > "${MBOX}" 2>>${ERR}
875 check unicode 0 "${MBOX}" '475805847 317'
878 < "${BODY}" DIET=CURD TIED= ${MAILX} ${ARGS} > "${MBOX}" 2>>${ERR}
879 check c 0 "${MBOX}" '1473887148 321'
881 ${cat} <<- '__EOT' | ${MAILX} ${ARGS} > "${MBOX}"
882 wysh set mager='\hey\'
883 varshow mager
884 wysh set mager="\hey\\"
885 varshow mager
886 wysh set mager=$'\hey\\'
887 varshow mager
888 __EOT
889 check 3 0 "${MBOX}" '1289698238 69'
891 t_epilog
894 t_commandalias() {
895 t_prolog commandalias
897 ${cat} <<- '__EOT' | ${MAILX} ${ARGS} > "${MBOX}"
898 commandalias echo echo hoho
899 echo stop.
900 commandalias X Xx
901 commandalias Xx XxX
902 commandalias XxX XxXx
903 commandalias XxXx XxXxX
904 commandalias XxXxX XxXxXx
905 commandalias XxXxXx echo huhu
906 commandalias XxXxXxX echo huhu
908 commandalias XxXxXx XxXxXxX
910 uncommandalias echo
911 commandalias XxXxXx echo huhu
913 __EOT
915 check 1 0 "${MBOX}" '1638809585 36'
917 t_epilog
920 t_ifelse() {
921 t_prolog ifelse
923 # Nestable conditions test
924 ${cat} <<- '__EOT' | ${MAILX} ${ARGS} > "${MBOX}"
925 if 0
926 echo 1.err
927 else
928 echo 1.ok
929 endif
930 if 1
931 echo 2.ok
932 else
933 echo 2.err
934 endif
935 if $dietcurd
936 echo 3.err
937 else
938 echo 3.ok
939 endif
940 set dietcurd=yoho
941 if $dietcurd
942 echo 4.ok
943 else
944 echo 4.err
945 endif
946 if $dietcurd == 'yoho'
947 echo 5.ok
948 else
949 echo 5.err
950 endif
951 if $dietcurd @== 'Yoho'
952 echo 5-1.ok
953 else
954 echo 5-1.err
955 endif
956 if $dietcurd == 'Yoho'
957 echo 5-2.err
958 else
959 echo 5-2.ok
960 endif
961 if $dietcurd != 'yoho'
962 echo 6.err
963 else
964 echo 6.ok
965 endif
966 if $dietcurd @!= 'Yoho'
967 echo 6-1.err
968 else
969 echo 6-1.ok
970 endif
971 if $dietcurd != 'Yoho'
972 echo 6-2.ok
973 else
974 echo 6-2.err
975 endif
976 # Nesting
977 if faLse
978 echo 7.err1
979 if tRue
980 echo 7.err2
981 if yEs
982 echo 7.err3
983 else
984 echo 7.err4
985 endif
986 echo 7.err5
987 endif
988 echo 7.err6
989 else
990 echo 7.ok7
991 if YeS
992 echo 7.ok8
993 if No
994 echo 7.err9
995 else
996 echo 7.ok9
997 endif
998 echo 7.ok10
999 else
1000 echo 7.err11
1001 if yeS
1002 echo 7.err12
1003 else
1004 echo 7.err13
1005 endif
1006 endif
1007 echo 7.ok14
1008 endif
1009 if r
1010 echo 8.ok1
1011 if R
1012 echo 8.ok2
1013 else
1014 echo 8.err2
1015 endif
1016 echo 8.ok3
1017 else
1018 echo 8.err1
1019 endif
1020 if s
1021 echo 9.err1
1022 else
1023 echo 9.ok1
1024 if S
1025 echo 9.err2
1026 else
1027 echo 9.ok2
1028 endif
1029 echo 9.ok3
1030 endif
1031 # `elif'
1032 if $dietcurd == 'yohu'
1033 echo 10.err1
1034 elif $dietcurd == 'yoha'
1035 echo 10.err2
1036 elif $dietcurd == 'yohe'
1037 echo 10.err3
1038 elif $dietcurd == 'yoho'
1039 echo 10.ok1
1040 if $dietcurd == 'yohu'
1041 echo 10.err4
1042 elif $dietcurd == 'yoha'
1043 echo 10.err5
1044 elif $dietcurd == 'yohe'
1045 echo 10.err6
1046 elif $dietcurd == 'yoho'
1047 echo 10.ok2
1048 if $dietcurd == 'yohu'
1049 echo 10.err7
1050 elif $dietcurd == 'yoha'
1051 echo 10.err8
1052 elif $dietcurd == 'yohe'
1053 echo 10.err9
1054 elif $dietcurd == 'yoho'
1055 echo 10.ok3
1056 else
1057 echo 10.err10
1058 endif
1059 else
1060 echo 10.err11
1061 endif
1062 else
1063 echo 10.err12
1064 endif
1065 # integer
1066 set dietcurd=10
1067 if $dietcurd -lt 11
1068 echo 11.ok1
1069 if $dietcurd -gt 9
1070 echo 11.ok2
1071 else
1072 echo 11.err2
1073 endif
1074 if $dietcurd -eq 10
1075 echo 11.ok3
1076 else
1077 echo 11.err3
1078 endif
1079 if $dietcurd -ge 10
1080 echo 11.ok4
1081 else
1082 echo 11.err4
1083 endif
1084 if $dietcurd -le 10
1085 echo 11.ok5
1086 else
1087 echo 11.err5
1088 endif
1089 if $dietcurd -ge 11
1090 echo 11.err6
1091 else
1092 echo 11.ok6
1093 endif
1094 if $dietcurd -le 9
1095 echo 11.err7
1096 else
1097 echo 11.ok7
1098 endif
1099 else
1100 echo 11.err1
1101 endif
1102 set dietcurd=Abc
1103 if $dietcurd < aBd
1104 echo 12.ok1
1105 if $dietcurd @> abB
1106 echo 12.ok2
1107 else
1108 echo 12.err2
1109 endif
1110 if $dietcurd @== aBC
1111 echo 12.ok3
1112 else
1113 echo 12.err3
1114 endif
1115 if $dietcurd @>= AbC
1116 echo 12.ok4
1117 else
1118 echo 12.err4
1119 endif
1120 if $dietcurd @<= ABc
1121 echo 12.ok5
1122 else
1123 echo 12.err5
1124 endif
1125 if $dietcurd @>= abd
1126 echo 12.err6
1127 else
1128 echo 12.ok6
1129 endif
1130 if $dietcurd @<= abb
1131 echo 12.err7
1132 else
1133 echo 12.ok7
1134 endif
1135 else
1136 echo 12.err1
1137 endif
1138 if $dietcurd < aBc
1139 echo 12-1.ok
1140 else
1141 echo 12-1.err
1142 endif
1143 if $dietcurd @< aBc
1144 echo 12-2.err
1145 else
1146 echo 12-2.ok
1147 endif
1148 if $dietcurd > ABc
1149 echo 12-3.ok
1150 else
1151 echo 12-3.err
1152 endif
1153 if $dietcurd @> ABc
1154 echo 12-3.err
1155 else
1156 echo 12-3.ok
1157 endif
1158 if $dietcurd @i=% aB
1159 echo 13.ok
1160 else
1161 echo 13.err
1162 endif
1163 if $dietcurd =% aB
1164 echo 13-1.err
1165 else
1166 echo 13-1.ok
1167 endif
1168 if $dietcurd @=% bC
1169 echo 14.ok
1170 else
1171 echo 14.err
1172 endif
1173 if $dietcurd !% aB
1174 echo 15-1.ok
1175 else
1176 echo 15-1.err
1177 endif
1178 if $dietcurd @!% aB
1179 echo 15-2.err
1180 else
1181 echo 15-2.ok
1182 endif
1183 if $dietcurd !% bC
1184 echo 15-3.ok
1185 else
1186 echo 15-3.err
1187 endif
1188 if $dietcurd @!% bC
1189 echo 15-4.err
1190 else
1191 echo 15-4.ok
1192 endif
1193 if $dietcurd =% Cd
1194 echo 16.err
1195 else
1196 echo 16.ok
1197 endif
1198 if $dietcurd !% Cd
1199 echo 17.ok
1200 else
1201 echo 17.err
1202 endif
1203 set diet=abc curd=abc
1204 if $diet == $curd
1205 echo 18.ok
1206 else
1207 echo 18.err
1208 endif
1209 set diet=abc curd=abcd
1210 if $diet != $curd
1211 echo 19.ok
1212 else
1213 echo 19.err
1214 endif
1215 # 1. Shitty grouping capabilities as of today
1216 unset diet curd ndefined
1217 if [ [ false ] || [ false ] || [ true ] ] && [ [ false ] || [ true ] ] && \
1218 [ yes ]
1219 echo 20.ok
1220 else
1221 echo 20.err
1222 endif
1223 if [ [ [ [ 0 ] || [ 1 ] ] && [ [ 1 ] || [ 0 ] ] ] && [ 1 ] ] && [ yes ]
1224 echo 21.ok
1225 else
1226 echo 21.err
1227 endif
1228 if [ [ 1 ] || [ 0 ] || [ 0 ] || [ 0 ] ]
1229 echo 22.ok
1230 else
1231 echo 22.err
1232 endif
1233 if [ [ 1 ] || [ 0 ] || [ 0 ] || [ 0 ] || [ [ 1 ] ] ]
1234 echo 23.ok
1235 else
1236 echo 23.err
1237 endif
1238 if [ [ 1 ] || [ 0 ] || [ 0 ] || [ 0 ] || [ [ 1 ] ] || [ 1 ] ] && [ no ]
1239 echo 24.err
1240 else
1241 echo 24.ok
1242 endif
1243 if [ [ 1 ] || [ 0 ] || [ 0 ] || [ 0 ] || [ [ 1 ] ] || [ 1 ] ] \
1244 && [ no ] || [ yes ]
1245 echo 25.ok
1246 else
1247 echo 25.err
1248 endif
1249 if [ [ [ [ [ [ [ 1 ] ] && [ 1 ] ] && [ 1 ] ] && [ 1 ] ] ] && [ 1 ] ]
1250 echo 26.ok
1251 else
1252 echo 26.err
1253 endif
1254 if [ [ [ [ [ [ [ 1 ] ] && [ 1 ] ] && [ 1 ] ] && [ 1 ] ] ] && [ 0 ] ]
1255 echo 27.err
1256 else
1257 echo 27.ok
1258 endif
1259 if [ [ [ [ [ [ [ 1 ] ] && [ 1 ] ] && [ 0 ] ] && [ 1 ] ] ] && [ 1 ] ]
1260 echo 28.err
1261 else
1262 echo 28.ok
1263 endif
1264 if [ [ [ [ [ [ [ 0 ] ] && [ 1 ] ] && [ 1 ] ] && [ 1 ] ] ] && [ 1 ] ]
1265 echo 29.err
1266 else
1267 echo 29.ok
1268 endif
1269 if [ 1 ] || [ 0 ] || [ 0 ] || [ 0 ] && [ 0 ]
1270 echo 30.err
1271 else
1272 echo 30.ok
1273 endif
1274 if [ 1 ] || [ 0 ] || [ 0 ] || [ 0 ] && [ 1 ]
1275 echo 31.ok
1276 else
1277 echo 31.err
1278 endif
1279 if [ 0 ] || [ 0 ] || [ 0 ] || [ 1 ] && [ 0 ]
1280 echo 32.err
1281 else
1282 echo 32.ok
1283 endif
1284 if [ 0 ] || [ 0 ] || [ 0 ] || [ 1 ] && [ 1 ]
1285 echo 33.ok
1286 else
1287 echo 33.err
1288 endif
1289 if [ 0 ] || [ 0 ] || [ 0 ] || [ 1 ] && [ 0 ] || [ 1 ] && [ 0 ]
1290 echo 34.err
1291 else
1292 echo 34.ok
1293 endif
1294 if [ 0 ] || [ 0 ] || [ 0 ] || [ 1 ] && [ 0 ] || [ 1 ] && [ 1 ]
1295 echo 35.ok
1296 else
1297 echo 35.err
1298 endif
1299 set diet=yo curd=ho
1300 if [ [ $diet == 'yo' ] && [ $curd == 'ho' ] ] && [ $ndefined ]
1301 echo 36.err
1302 else
1303 echo 36.ok
1304 endif
1305 set ndefined
1306 if [ [ $diet == 'yo' ] && [ $curd == 'ho' ] ] && [ $ndefined ]
1307 echo 37.ok
1308 else
1309 echo 37.err
1310 endif
1311 # 2. Shitty grouping capabilities as of today
1312 unset diet curd ndefined
1313 if [ false || false || true ] && [ false || true ] && yes
1314 echo 40.ok
1315 else
1316 echo 40.err
1317 endif
1318 if [ [ [ 0 || 1 ] && [ 1 || 0 ] ] && 1 ] && [ yes ]
1319 echo 41.ok
1320 else
1321 echo 41.err
1322 endif
1323 if [ 1 || 0 || 0 || 0 ]
1324 echo 42.ok
1325 else
1326 echo 42.err
1327 endif
1328 if [ 1 || 0 || 0 || 0 || [ 1 ] ]
1329 echo 43.ok
1330 else
1331 echo 43.err
1332 endif
1333 if [ 1 || 0 || 0 || 0 || [ 1 ] || 1 ] && no
1334 echo 44.err
1335 else
1336 echo 44.ok
1337 endif
1338 if [ 1 || 0 || 0 || 0 || 1 || [ 1 ] ] && no || [ yes ]
1339 echo 45.ok
1340 else
1341 echo 45.err
1342 endif
1343 if [ [ [ [ [ [ 1 ] && 1 ] && 1 ] && 1 ] ] && [ 1 ] ]
1344 echo 46.ok
1345 else
1346 echo 46.err
1347 endif
1348 if [ [ [ [ [ [ 1 ] && 1 ] && 1 ] && [ 1 ] ] ] && 0 ]
1349 echo 47.err
1350 else
1351 echo 47.ok
1352 endif
1353 if [ [ [ [ [ [ [ 1 ] ] && 1 ] && 0 ] && [ 1 ] ] ] && 1 ]
1354 echo 48.err
1355 else
1356 echo 48.ok
1357 endif
1358 if [ [ [ [ [ [ 0 ] && 1 ] && 1 ] && 1 ] ] && 1 ]
1359 echo 49.err
1360 else
1361 echo 49.ok
1362 endif
1363 if 1 || 0 || 0 || 0 && 0
1364 echo 50.err
1365 else
1366 echo 50.ok
1367 endif
1368 if 1 || 0 || 0 || 0 && 1
1369 echo 51.ok
1370 else
1371 echo 51.err
1372 endif
1373 if 0 || 0 || 0 || 1 && 0
1374 echo 52.err
1375 else
1376 echo 52.ok
1377 endif
1378 if 0 || 0 || 0 || 1 && 1
1379 echo 53.ok
1380 else
1381 echo 53.err
1382 endif
1383 if 0 || 0 || 0 || 1 && 0 || 1 && 0
1384 echo 54.err
1385 else
1386 echo 54.ok
1387 endif
1388 if 0 || 0 || 0 || 1 && 0 || 1 && 1
1389 echo 55.ok
1390 else
1391 echo 55.err
1392 endif
1393 set diet=yo curd=ho
1394 if [ $diet == 'yo' && $curd == 'ho' ] && $ndefined
1395 echo 56.err
1396 else
1397 echo 56.ok
1398 endif
1399 if $diet == 'yo' && $curd == 'ho' && $ndefined
1400 echo 57.err
1401 else
1402 echo 57.ok
1403 endif
1404 set ndefined
1405 if [ $diet == 'yo' && $curd == 'ho' ] && $ndefined
1406 echo 57.ok
1407 else
1408 echo 57.err
1409 endif
1410 if $diet == 'yo' && $curd == 'ho' && $ndefined
1411 echo 58.ok
1412 else
1413 echo 58.err
1414 endif
1415 if [ [ [ [ [ [ $diet == 'yo' && $curd == 'ho' && $ndefined ] ] ] ] ] ]
1416 echo 59.ok
1417 else
1418 echo 59.err
1419 endif
1420 # Some more en-braced variables
1421 set diet=yo curd=ho
1422 if ${diet} == ${curd}
1423 echo 70.err
1424 else
1425 echo 70.ok
1426 endif
1427 if ${diet} != ${curd}
1428 echo 71.ok
1429 else
1430 echo 71.err
1431 endif
1432 if $diet == ${curd}
1433 echo 72.err
1434 else
1435 echo 72.ok
1436 endif
1437 if ${diet} == $curd
1438 echo 73.err
1439 else
1440 echo 73.ok
1441 endif
1442 # Unary !
1443 if ! 0 && ! ! 1 && ! ! ! ! 2 && 3
1444 echo 80.ok
1445 else
1446 echo 80.err
1447 endif
1448 if ! 0 && ! [ ! 1 ] && ! [ ! [ ! [ ! 2 ] ] ] && 3
1449 echo 81.ok
1450 else
1451 echo 81.err
1452 endif
1453 if [ ! 0 ] && [ ! [ ! 1 ] ] && [ ! [ ! [ ! [ ! [ 2 ] ] ] ] ] && 3
1454 echo 82.ok
1455 else
1456 echo 82.err
1457 endif
1458 if [ ! 0 ] && [ ! [ ! 1 ] ] && [ ! [ ! [ ! [ ! [ 2 ] ] ] ] ] && ! 3
1459 echo 83.err
1460 else
1461 echo 83.ok
1462 endif
1463 if [ ! 0 ] && [ ! [ ! 1 ] ] && ! [ [ ! [ ! [ ! [ 2 ] ] ] ] ] && ! 3
1464 echo 84.err
1465 else
1466 echo 84.ok
1467 endif
1468 if [ ! 0 ] && ! [ ! [ ! 1 ] ] && [ ! [ ! [ ! [ ! [ 2 ] ] ] ] ] && 3
1469 echo 85.err
1470 else
1471 echo 85.ok
1472 endif
1473 if ! [ ! 0 ] && [ ! [ ! 1 ] ] && [ ! [ ! [ ! [ ! [ 2 ] ] ] ] ] && 3
1474 echo 86.err
1475 else
1476 echo 86.ok
1477 endif
1478 if [ ! 0 ] && [ ! [ ! 1 ] ] && [ ! [ ! [ ! [ ! [ 2 ] ] ] ] ] || 3
1479 echo 87.ok
1480 else
1481 echo 87.err
1482 endif
1483 if [ ! 0 ] && [ ! ! [ ! ! 1 ] ] && [ ! ! [ ! ! [ ! ! [ ! ! [ 2 ] ] ] ] ]
1484 echo 88.ok
1485 else
1486 echo 88.err
1487 endif
1488 # Unary !, odd
1489 if ! 0 && ! ! 1 && ! ! ! 0 && 3
1490 echo 90.ok
1491 else
1492 echo 90.err
1493 endif
1494 if ! 0 && ! [ ! 1 ] && ! [ ! [ ! [ 0 ] ] ] && 3
1495 echo 91.ok
1496 else
1497 echo 91.err
1498 endif
1499 if [ ! 0 ] && [ ! [ ! 1 ] ] && [ ! [ ! [ ! [ [ 0 ] ] ] ] ] && 3
1500 echo 92.ok
1501 else
1502 echo 92.err
1503 endif
1504 if [ ! 0 ] && [ ! [ ! 1 ] ] && [ ! [ ! ! [ ! [ ! 0 ] ] ] ] && ! 3
1505 echo 93.err
1506 else
1507 echo 93.ok
1508 endif
1509 if [ ! 0 ] && [ ! [ ! 1 ] ] && ! [ ! [ ! [ ! [ ! 0 ] ] ] ] && 3
1510 echo 94.ok
1511 else
1512 echo 94.err
1513 endif
1514 if [ ! 0 ] && ! [ ! [ ! 1 ] ] && [ ! ! [ ! [ ! [ ! [ 0 ] ] ] ] ] && 3
1515 echo 95.err
1516 else
1517 echo 95.ok
1518 endif
1519 if ! [ ! 0 ] && [ ! [ ! 1 ] ] && [ ! [ ! [ ! [ ! ! 0 ] ] ] ] && 3
1520 echo 96.err
1521 else
1522 echo 96.ok
1523 endif
1524 if [ ! 0 ] && [ ! [ ! 1 ] ] && [ ! [ ! [ ! [ ! [ ! 0 ] ] ] ] ] || 3
1525 echo 97.ok
1526 else
1527 echo 97.err
1528 endif
1529 if [ ! 0 ] && [ ! ! [ ! ! 1 ] ] && [ ! ! [ ! ! [ ! ! [ ! [ 0 ] ] ] ] ]
1530 echo 98.ok
1531 else
1532 echo 98.err
1533 endif
1534 __EOT
1536 check normal 0 "${MBOX}" '1688759742 719'
1538 if have_feat regex; then
1539 ${cat} <<- '__EOT' | ${MAILX} ${ARGS} > "${MBOX}"
1540 set dietcurd=yoho
1541 if $dietcurd =~ '^yo.*'
1542 echo 1.ok
1543 else
1544 echo 1.err
1545 endif
1546 if $dietcurd =~ '^Yo.*'
1547 echo 1-1.err
1548 else
1549 echo 1-1.ok
1550 endif
1551 if $dietcurd @=~ '^Yo.*'
1552 echo 1-2.ok
1553 else
1554 echo 1-2.err
1555 endif
1556 if $dietcurd =~ '^yOho.+'
1557 echo 2.err
1558 else
1559 echo 2.ok
1560 endif
1561 if $dietcurd @!~ '.*Ho$'
1562 echo 3.err
1563 else
1564 echo 3.ok
1565 endif
1566 if $dietcurd !~ '.+yohO$'
1567 echo 4.ok
1568 else
1569 echo 4.err
1570 endif
1571 if [ $dietcurd @i!~ '.+yoho$' ]
1572 echo 5.ok
1573 else
1574 echo 5.err
1575 endif
1576 if ! [ $dietcurd @i=~ '.+yoho$' ]
1577 echo 6.ok
1578 else
1579 echo 6.err
1580 endif
1581 if ! ! [ $dietcurd @i!~ '.+yoho$' ]
1582 echo 7.ok
1583 else
1584 echo 7.err
1585 endif
1586 if ! [ ! [ $dietcurd @i!~ '.+yoho$' ] ]
1587 echo 8.ok
1588 else
1589 echo 8.err
1590 endif
1591 if [ ! [ ! [ $dietcurd @i!~ '.+yoho$' ] ] ]
1592 echo 9.ok
1593 else
1594 echo 9.err
1595 endif
1596 if ! [ ! [ ! [ $dietcurd !~ '.+yoho$' ] ] ]
1597 echo 10.err
1598 else
1599 echo 10.ok
1600 endif
1601 if ! ! ! $dietcurd !~ '.+yoho$'
1602 echo 11.err
1603 else
1604 echo 11.ok
1605 endif
1606 if ! ! ! $dietcurd =~ '.+yoho$'
1607 echo 12.ok
1608 else
1609 echo 12.err
1610 endif
1611 if ! [ ! ! [ ! [ $dietcurd !~ '.+yoho$' ] ] ]
1612 echo 13.ok
1613 else
1614 echo 13.err
1615 endif
1616 set diet=abc curd='^abc$'
1617 if $diet =~ $curd
1618 echo 14.ok
1619 else
1620 echo 14.err
1621 endif
1622 set diet=abc curd='^abcd$'
1623 if $diet !~ $curd
1624 echo 15.ok
1625 else
1626 echo 15.err
1627 endif
1628 __EOT
1630 check regex 0 "${MBOX}" '1115671789 95'
1631 else
1632 printf 'if-regex: unsupported, skipped\n'
1635 t_epilog
1638 t_localopts() {
1639 t_prolog localopts
1641 # Nestable conditions test
1642 ${cat} <<- '__EOT' | ${MAILX} ${ARGS} > "${MBOX}" 2>&1
1643 define t2 {
1644 echo in: t2
1645 set t2=t2
1646 echo $t2
1648 define t1 {
1649 echo in: t1
1650 set gv1=gv1
1651 localopts on
1652 set lv1=lv1 lv2=lv2
1653 set lv3=lv3
1654 call t2
1655 localopts off
1656 set gv2=gv2
1657 echo $gv1 $lv1 ${lv2} ${lv3} ${gv2}, $t2
1659 define t0 {
1660 echo in: t0
1661 call t1
1662 echo $gv1 $lv1 ${lv2} ${lv3} ${gv2}, $t2
1663 echo "$gv1 $lv1 ${lv2} ${lv3} ${gv2}, $t2"
1665 account trouble {
1666 echo in: trouble
1667 call t0
1669 call t0
1670 unset gv1 gv2
1671 account trouble
1672 echo active trouble: $gv1 $lv1 ${lv2} ${lv3} ${gv2}, $t3
1673 account null
1674 echo active null: $gv1 $lv1 ${lv2} ${lv3} ${gv2}, $t3
1677 define ll2 {
1678 localopts $1
1679 set x=2
1680 echo ll2=$x
1682 define ll1 {
1683 wysh set y=$1; shift; eval localopts $y; localopts $1; shift
1684 set x=1
1685 echo ll1.1=$x
1686 call ll2 $1
1687 echo ll1.2=$x
1689 define ll0 {
1690 wysh set y=$1; shift; eval localopts $y; localopts $1; shift
1691 set x=0
1692 echo ll0.1=$x
1693 call ll1 $y "$@"
1694 echo ll0.2=$x
1696 define llx {
1697 echo ----- $1: $2 -> $3 -> $4
1698 echo ll-1.1=$x
1699 eval localopts $1
1700 call ll0 "$@"
1701 echo ll-1.2=$x
1702 unset x
1704 define lly {
1705 call llx 'call off' on on on
1706 call llx 'call off' off on on
1707 call llx 'call off' on off on
1708 call llx 'call off' on off off
1709 localopts call-fixate on
1710 call llx 'call-fixate on' on on on
1711 call llx 'call-fixate on' off on on
1712 call llx 'call-fixate on' on off on
1713 call llx 'call-fixate on' on off off
1714 unset x;localopts call on
1715 call llx 'call on' on on on
1716 call llx 'call on' off on on
1717 call llx 'call on' on off on
1718 call llx 'call on' on off off
1720 call lly
1721 __EOT
1723 check 1 0 "${MBOX}" '4016155249 1246'
1725 t_epilog
1728 t_local() {
1729 t_prolog local
1731 ${cat} <<- '__EOT' | ${MAILX} ${ARGS} > "${MBOX}" 2>&1
1732 define du2 {
1733 echo du2-1 du=$du
1734 local set du=$1
1735 echo du2-2 du=$du
1736 local unset du
1737 echo du2-3 du=$du
1739 define du {
1740 local set du=dudu
1741 echo du-1 du=$du
1742 call du2 du2du2
1743 echo du-2 du=$du
1744 local set nodu
1745 echo du-3 du=$du
1747 define ich {
1748 echo ich-1 du=$du
1749 call du
1750 echo ich-2 du=$du
1752 define wir {
1753 localopts $1
1754 set du=wirwir
1755 echo wir-1 du=$du
1756 call ich
1757 echo wir-2 du=$du
1759 echo ------- global-1 du=$du
1760 call ich
1761 echo ------- global-2 du=$du
1762 set du=global
1763 call ich
1764 echo ------- global-3 du=$du
1765 call wir on
1766 echo ------- global-4 du=$du
1767 call wir off
1768 echo ------- global-5 du=$du
1769 __EOT
1771 check 1 0 "${MBOX}" '2411598140 641'
1773 t_epilog
1776 t_macro_param_shift() {
1777 t_prolog macro_param_shift
1779 ${cat} <<- '__EOT' | ${MAILX} ${ARGS} > "${MBOX}" 2>>${ERR}
1780 define t2 {
1781 echo in: t2
1782 echo t2.0 has $#/${#} parameters: "$1,${2},$3" (${*}) [$@]
1783 localopts on
1784 wysh set ignerr=$1
1785 shift
1786 localopts off
1787 echo t2.1 has $#/${#} parameters: "$1,${2},$3" (${*}) [$@]
1788 if [ $# > 1 ] || [ $ignerr == '' ]
1789 shift 2
1790 else
1791 ignerr shift 2
1792 endif
1793 echo t2.2:$? has $#/${#} parameters: "$1,${2},$3" (${*}) [$@]
1794 shift 0
1795 echo t2.3:$? has $#/${#} parameters: "$1,${2},$3" (${*}) [$@]
1796 if [ $# > 0 ]
1797 shift
1798 endif
1799 echo t2.4:$? has $#/${#} parameters: "$1,${2},$3" (${*}) [$@]
1801 define t1 {
1802 set errexit
1803 echo in: t1
1804 call t2 1 you get four args
1805 echo t1.1: $?';' ignerr ($ignerr) should not exist
1806 call t2 1 you get 'three args'
1807 echo t1.2: $?';' ignerr ($ignerr) should not exist
1808 call t2 1 you 'get two args'
1809 echo t1.3: $?';' ignerr ($ignerr) should not exist
1810 call t2 1 'you get one arg'
1811 echo t1.4: $?';' ignerr ($ignerr) should not exist
1812 ignerr call t2 '' 'you get one arg'
1813 echo t1.5: $?';' ignerr ($ignerr) should not exist
1815 call t1
1816 __EOT
1818 check 1 0 "${MBOX}" '1402489146 1682'
1820 t_epilog
1823 t_addrcodec() {
1824 t_prolog addrcodec
1826 ${cat} <<- '__EOT' | ${MAILX} ${ARGS} > "${MBOX}" 2>&1
1827 vput addrcodec res e 1 <doog@def>
1828 echo $?/$^ERRNAME $res
1829 eval vput addrcodec res d $res
1830 echo $?/$^ERRNAME $res
1831 vput addrcodec res e 2 . <doog@def>
1832 echo $?/$^ERRNAME $res
1833 eval vput addrcodec res d $res
1834 echo $?/$^ERRNAME $res
1835 vput addrcodec res e 3 Sauer Dr. <doog@def>
1836 echo $?/$^ERRNAME $res
1837 eval vput addrcodec res d $res
1838 echo $?/$^ERRNAME $res
1839 vput addrcodec res e 3.50 Sauer (Ma) Dr. <doog@def>
1840 echo $?/$^ERRNAME $res
1841 eval vput addrcodec res d $res
1842 echo $?/$^ERRNAME $res
1843 vput addrcodec res e 3.51 Sauer (Ma) "Dr." <doog@def>
1844 echo $?/$^ERRNAME $res
1845 eval vput addrcodec res d $res
1846 echo $?/$^ERRNAME $res
1848 vput addrcodec res +e 4 Sauer (Ma) Dr. <doog@def>
1849 echo $?/$^ERRNAME $res
1850 eval vput addrcodec res d $res
1851 echo $?/$^ERRNAME $res
1852 vput addrcodec res +e 5 Sauer (Ma) Braten Dr. <doog@def>
1853 echo $?/$^ERRNAME $res
1854 eval vput addrcodec res d $res
1855 echo $?/$^ERRNAME $res
1856 vput addrcodec res +e 6 Sauer (Ma) Braten Dr. (Heu) <doog@def>
1857 echo $?/$^ERRNAME $res
1858 eval vput addrcodec res d $res
1859 echo $?/$^ERRNAME $res
1860 vput addrcodec res +e 7 Sauer (Ma) Braten Dr. (Heu) <doog@def> (bu)
1861 echo $?/$^ERRNAME $res
1862 eval vput addrcodec res d $res
1863 echo $?/$^ERRNAME $res
1864 vput addrcodec res +e 8 \
1865 Dr. Sauer (Ma) Braten Dr. (Heu) <doog@def> (bu) Boom. Boom
1866 echo $?/$^ERRNAME $res
1867 eval vput addrcodec res d $res
1868 echo $?/$^ERRNAME $res
1869 vput addrcodec res +e 9 Dr.Sauer(Ma)Braten Dr. (Heu) <doog@def>
1870 echo $?/$^ERRNAME $res
1871 eval vput addrcodec res d $res
1872 echo $?/$^ERRNAME $res
1873 vput addrcodec res +e 10 (Ma)Braten Dr. (Heu) <doog@def>
1874 echo $?/$^ERRNAME $res
1875 eval vput addrcodec res d $res
1876 echo $?/$^ERRNAME $res
1877 vput addrcodec res +e 11 (Ma)Braten Dr"." (Heu) <doog@def>
1878 echo $?/$^ERRNAME $res
1879 eval vput addrcodec res d $res
1880 echo $?/$^ERRNAME $res
1881 vput addrcodec res +e 12 Dr. Sauer (Ma) Braten Dr. (u) <doog@def>
1882 echo $?/$^ERRNAME $res
1883 eval vput addrcodec res d $res
1884 echo $?/$^ERRNAME $res
1885 vput addrcodec res +e 13(Ma)Braten Dr. (Heu) <doog@def>
1886 echo $?/$^ERRNAME $res
1887 eval vput addrcodec res d $res
1888 echo $?/$^ERRNAME $res
1889 vput addrcodec res +e 14 Hey, Du <doog@def> Wie() findet Dr. das? ()
1890 echo $?/$^ERRNAME $res
1891 eval vput addrcodec res d $res
1892 echo $?/$^ERRNAME $res
1893 vput addrcodec res +e 15 \
1894 Hey, Du <doog@def> Wie() findet "" Dr. "" das? ()
1895 echo $?/$^ERRNAME $res
1896 eval vput addrcodec res d $res
1897 echo $?/$^ERRNAME $res
1898 vput addrcodec res +e 16 \
1899 "Hey," "Du" <doog@def> "Wie()" findet "" Dr. "" das? ()
1900 echo $?/$^ERRNAME $res
1901 eval vput addrcodec res d $res
1902 echo $?/$^ERRNAME $res
1903 vput addrcodec res +e 17 \
1904 "Hey" Du <doog@def> "Wie() findet " " Dr. """ das? ()
1905 echo $?/$^ERRNAME $res
1906 eval vput addrcodec res d $res
1907 echo $?/$^ERRNAME $res
1908 vput addrcodec res +e 18 \
1909 <doog@def> "Hey" Du "Wie() findet " " Dr. """ das? ()
1910 echo $?/$^ERRNAME $res
1911 eval vput addrcodec res d $res
1912 echo $?/$^ERRNAME $res
1913 vput addrcodec res +e 19 Hey\,\" <doog@def> "Wie()" findet \" Dr. \" das?
1914 echo $?/$^ERRNAME $res
1915 eval vput addrcodec res d $res
1916 echo $?/$^ERRNAME $res
1918 vput addrcodec res ++e 20 Hey\,\" <doog@def> "Wie()" findet \" Dr. \" das?
1919 echo $?/$^ERRNAME $res
1920 vput addrcodec res ++e 21 Hey\,\"" <doog@def> "Wie()" findet \" Dr. \" das?
1921 echo $?/$^ERRNAME $res
1922 eval vput addrcodec res d $res
1923 echo $?/$^ERRNAME $res
1925 vput addrcodec res +++e 22 Hey\\,\" <doog@def> "Wie()" findet \" Dr. \" das?
1926 echo $?/$^ERRNAME $res
1927 eval vput addrcodec res d $res
1928 echo $?/$^ERRNAME $res
1930 vput addrcodec res s \
1931 "23 Hey\\,\\\" \"Wie" () "\" findet \\\" Dr. \\\" das?" <doog@def>
1932 echo $?/$^ERRNAME $res
1934 # Fix for [f3852f88]
1935 vput addrcodec res ++e <from2@exam.ple> 100 (comment) "Quot(e)d"
1936 echo $?/$^ERRNAME $res
1937 eval vput addrcodec res d $res
1938 echo $?/$^ERRNAME $res
1939 vput addrcodec res e <from2@exam.ple> 100 (comment) "Quot(e)d"
1940 echo $?/$^ERRNAME $res
1941 eval vput addrcodec res d $res
1942 echo $?/$^ERRNAME $res
1943 __EOT
1945 check 1 0 "${MBOX}" '1047317989 2612'
1947 ${cat} <<- '__EOT' | ${MAILX} ${ARGS} > "${MBOX}" 2>&1
1948 mlist isa1@list
1949 mlsubscribe isa2@list
1951 vput addrcodec res skin Hey\\,\" <isa0@list> "Wie()" find \" Dr. \" das?
1952 echo $?/$^ERRNAME $res
1953 vput addrcodec res skinlist Hey\\,\" <isa0@list> "Wie()" find \" Dr. \" das?
1954 echo $?/$^ERRNAME $res
1955 vput addrcodec res skin Hey\\,\" <isa1@list> "Wie()" find \" Dr. \" das?
1956 echo $?/$^ERRNAME $res
1957 vput addrcodec res skinlist Hey\\,\" <isa1@list> "Wie()" find \" Dr. \" das?
1958 echo $?/$^ERRNAME $res
1959 vput addrcodec res skin Hey\\,\" <isa2@list> "Wie()" find \" Dr. \" das?
1960 echo $?/$^ERRNAME $res
1961 vput addrcodec res skinlist Hey\\,\" <isa2@list> "Wie()" find \" Dr. \" das?
1962 echo $?/$^ERRNAME $res
1963 __EOT
1965 check 2 0 "${MBOX}" '1391779299 104'
1967 if have_feat idna; then
1968 ${cat} <<- '__EOT' | ${MAILX} ${ARGS} ${ADDARG_UNI} > "${MBOX}" 2>&1
1969 vput addrcodec res e (heu) <du@blödiän> "stroh" du
1970 echo $?/$^ERRNAME $res
1971 eval vput addrcodec res d $res
1972 echo $?/$^ERRNAME $res
1973 vput addrcodec res e <du@blödiän> du
1974 echo $?/$^ERRNAME $res
1975 eval vput addrcodec res d $res
1976 echo $?/$^ERRNAME $res
1977 vput addrcodec res e du <du@blödiän>
1978 echo $?/$^ERRNAME $res
1979 eval vput addrcodec res d $res
1980 echo $?/$^ERRNAME $res
1981 vput addrcodec res e <du@blödiän>
1982 echo $?/$^ERRNAME $res
1983 eval vput addrcodec res d $res
1984 echo $?/$^ERRNAME $res
1985 vput addrcodec res e du@blödiän
1986 echo $?/$^ERRNAME $res
1987 eval vput addrcodec res d $res
1988 echo $?/$^ERRNAME $res
1989 __EOT
1991 check idna 0 "${MBOX}" '498775983 326'
1992 else
1993 printf 'addrcodec-idna: unsupported, skipped\n'
1996 t_epilog
1999 t_vexpr() {
2000 t_prolog vexpr
2002 ${cat} <<- '__EOT' | ${MAILX} ${ARGS} > "${MBOX}" 2>>${ERR}
2003 echo ' #0.0'
2004 vput vexpr res = 9223372036854775807
2005 echo $?/$^ERRNAME $res
2006 vput vexpr res = 9223372036854775808
2007 echo $?/$^ERRNAME $res
2008 vput vexpr res = u9223372036854775808
2009 echo $?/$^ERRNAME $res
2010 vput vexpr res @= 9223372036854775808
2011 echo $?/$^ERRNAME $res
2012 vput vexpr res = -9223372036854775808
2013 echo $?/$^ERRNAME $res
2014 vput vexpr res = -9223372036854775809
2015 echo $?/$^ERRNAME $res
2016 vput vexpr res @= -9223372036854775809
2017 echo $?/$^ERRNAME $res
2018 vput vexpr res = U9223372036854775809
2019 echo $?/$^ERRNAME $res
2020 echo ' #0.1'
2021 vput vexpr res = \
2022 0b0111111111111111111111111111111111111111111111111111111111111111
2023 echo $?/$^ERRNAME $res
2024 vput vexpr res = \
2025 S0b1000000000000000000000000000000000000000000000000000000000000000
2026 echo $?/$^ERRNAME $res
2027 vput vexpr res @= \
2028 S0b1000000000000000000000000000000000000000000000000000000000000000
2029 echo $?/$^ERRNAME $res
2030 vput vexpr res = \
2031 U0b1000000000000000000000000000000000000000000000000000000000000000
2032 echo $?/$^ERRNAME $res
2033 vput vexpr res = \
2034 0b1000000000000000000000000000000000000000000000000000000000000000
2035 echo $?/$^ERRNAME $res
2036 vput vexpr res @= \
2037 0b1000000000000000000000000000000000000000000000000000000000000000
2038 echo $?/$^ERRNAME $res
2039 vput vexpr res = \
2040 -0b1000000000000000000000000000000000000000000000000000000000000000
2041 echo $?/$^ERRNAME $res
2042 vput vexpr res = \
2043 S0b1000000000000000000000000000000000000000000000000000000000000001
2044 echo $?/$^ERRNAME $res
2045 vput vexpr res @= \
2046 S0b1000000000000000000000000000000000000000000000000000000000000001
2047 echo $?/$^ERRNAME $res
2048 vput vexpr res @= \
2049 -0b1000000000000000000000000000000000000000000000000000000000000001
2050 echo $?/$^ERRNAME $res
2051 vput vexpr res = \
2052 U0b1000000000000000000000000000000000000000000000000000000000000001
2053 echo $?/$^ERRNAME $res
2054 echo ' #0.2'
2055 vput vexpr res = 0777777777777777777777
2056 echo $?/$^ERRNAME $res
2057 vput vexpr res = S01000000000000000000000
2058 echo $?/$^ERRNAME $res
2059 vput vexpr res @= S01000000000000000000000
2060 echo $?/$^ERRNAME $res
2061 vput vexpr res = U01000000000000000000000
2062 echo $?/$^ERRNAME $res
2063 vput vexpr res = 01000000000000000000000
2064 echo $?/$^ERRNAME $res
2065 vput vexpr res @= 01000000000000000000000
2066 echo $?/$^ERRNAME $res
2067 vput vexpr res = -01000000000000000000000
2068 echo $?/$^ERRNAME $res
2069 vput vexpr res = S01000000000000000000001
2070 echo $?/$^ERRNAME $res
2071 vput vexpr res @= S01000000000000000000001
2072 echo $?/$^ERRNAME $res
2073 vput vexpr res @= -01000000000000000000001
2074 echo $?/$^ERRNAME $res
2075 vput vexpr res = U01000000000000000000001
2076 echo $?/$^ERRNAME $res
2077 echo ' #0.3'
2078 vput vexpr res = 0x7FFFFFFFFFFFFFFF
2079 echo $?/$^ERRNAME $res
2080 vput vexpr res = S0x8000000000000000
2081 echo $?/$^ERRNAME $res
2082 vput vexpr res @= S0x8000000000000000
2083 echo $?/$^ERRNAME $res
2084 vput vexpr res = U0x8000000000000000
2085 echo $?/$^ERRNAME $res
2086 vput vexpr res = 0x8000000000000000
2087 echo $?/$^ERRNAME $res
2088 vput vexpr res @= 0x8000000000000000
2089 echo $?/$^ERRNAME $res
2090 vput vexpr res = -0x8000000000000000
2091 echo $?/$^ERRNAME $res
2092 vput vexpr res = S0x8000000000000001
2093 echo $?/$^ERRNAME $res
2094 vput vexpr res @= S0x8000000000000001
2095 echo $?/$^ERRNAME $res
2096 vput vexpr res @= -0x8000000000000001
2097 echo $?/$^ERRNAME $res
2098 vput vexpr res = u0x8000000000000001
2099 echo $?/$^ERRNAME $res
2100 echo ' #1'
2101 vput vexpr res ~ 0
2102 echo $?/$^ERRNAME $res
2103 vput vexpr res ~ 1
2104 echo $?/$^ERRNAME $res
2105 vput vexpr res ~ -1
2106 echo $?/$^ERRNAME $res
2107 echo ' #2'
2108 vput vexpr res + 0 0
2109 echo $?/$^ERRNAME $res
2110 vput vexpr res + 0 1
2111 echo $?/$^ERRNAME $res
2112 vput vexpr res + 1 1
2113 echo $?/$^ERRNAME $res
2114 echo ' #3'
2115 vput vexpr res + 9223372036854775807 0
2116 echo $?/$^ERRNAME $res
2117 vput vexpr res + 9223372036854775807 1
2118 echo $?/$^ERRNAME $res
2119 vput vexpr res @+ 9223372036854775807 1
2120 echo $?/$^ERRNAME $res
2121 vput vexpr res + 0 9223372036854775807
2122 echo $?/$^ERRNAME $res
2123 vput vexpr res + 1 9223372036854775807
2124 echo $?/$^ERRNAME $res
2125 vput vexpr res @+ 1 9223372036854775807
2126 echo $?/$^ERRNAME $res
2127 echo ' #4'
2128 vput vexpr res + -9223372036854775808 0
2129 echo $?/$^ERRNAME $res
2130 vput vexpr res + -9223372036854775808 -1
2131 echo $?/$^ERRNAME $res
2132 vput vexpr res @+ -9223372036854775808 -1
2133 echo $?/$^ERRNAME $res
2134 vput vexpr res + 0 -9223372036854775808
2135 echo $?/$^ERRNAME $res
2136 vput vexpr res + -1 -9223372036854775808
2137 echo $?/$^ERRNAME $res
2138 vput vexpr res @+ -1 -9223372036854775808
2139 echo $?/$^ERRNAME $res
2140 echo ' #5'
2141 vput vexpr res - 0 0
2142 echo $?/$^ERRNAME $res
2143 vput vexpr res - 0 1
2144 echo $?/$^ERRNAME $res
2145 vput vexpr res - 1 1
2146 echo $?/$^ERRNAME $res
2147 echo ' #6'
2148 vput vexpr res - 9223372036854775807 0
2149 echo $?/$^ERRNAME $res
2150 vput vexpr res - 9223372036854775807 -1
2151 echo $?/$^ERRNAME $res
2152 vput vexpr res @- 9223372036854775807 -1
2153 echo $?/$^ERRNAME $res
2154 vput vexpr res - 0 9223372036854775807
2155 echo $?/$^ERRNAME $res
2156 vput vexpr res - -1 9223372036854775807
2157 echo $?/$^ERRNAME $res
2158 vput vexpr res - -2 9223372036854775807
2159 echo $?/$^ERRNAME $res
2160 vput vexpr res @- -2 9223372036854775807
2161 echo $?/$^ERRNAME $res
2162 echo ' #7'
2163 vput vexpr res - -9223372036854775808 +0
2164 echo $?/$^ERRNAME $res
2165 vput vexpr res - -9223372036854775808 +1
2166 echo $?/$^ERRNAME $res
2167 vput vexpr res @- -9223372036854775808 +1
2168 echo $?/$^ERRNAME $res
2169 vput vexpr res - 0 -9223372036854775808
2170 echo $?/$^ERRNAME $res
2171 vput vexpr res - +1 -9223372036854775808
2172 echo $?/$^ERRNAME $res
2173 vput vexpr res @- +1 -9223372036854775808
2174 echo $?/$^ERRNAME $res
2175 echo ' #8'
2176 vput vexpr res + -13 -2
2177 echo $?/$^ERRNAME $res
2178 vput vexpr res - 0 0
2179 echo $?/$^ERRNAME $res
2180 vput vexpr res - 0 1
2181 echo $?/$^ERRNAME $res
2182 vput vexpr res - 1 1
2183 echo $?/$^ERRNAME $res
2184 vput vexpr res - -13 -2
2185 echo $?/$^ERRNAME $res
2186 echo ' #9'
2187 vput vexpr res * 0 0
2188 echo $?/$^ERRNAME $res
2189 vput vexpr res * 0 1
2190 echo $?/$^ERRNAME $res
2191 vput vexpr res * 1 1
2192 echo $?/$^ERRNAME $res
2193 vput vexpr res * -13 -2
2194 echo $?/$^ERRNAME $res
2195 echo ' #10'
2196 vput vexpr res / 0 0
2197 echo $?/$^ERRNAME $res
2198 vput vexpr res / 0 1
2199 echo $?/$^ERRNAME $res
2200 vput vexpr res / 1 1
2201 echo $?/$^ERRNAME $res
2202 vput vexpr res / -13 -2
2203 echo $?/$^ERRNAME $res
2204 echo ' #11'
2205 vput vexpr res % 0 0
2206 echo $?/$^ERRNAME $res
2207 vput vexpr res % 0 1
2208 echo $?/$^ERRNAME $res
2209 vput vexpr res % 1 1
2210 echo $?/$^ERRNAME $res
2211 vput vexpr res % -13 -2
2212 echo $?/$^ERRNAME $res
2213 __EOT
2215 check numeric 0 "${MBOX}" '960821755 1962'
2217 ${cat} <<- '__EOT' | ${MAILX} ${ARGS} > "${MBOX}" 2>&1
2218 vput vexpr res find 'bananarama' 'nana'
2219 echo $?/$^ERRNAME :$res:
2220 vput vexpr res find 'bananarama' 'bana'
2221 echo $?/$^ERRNAME :$res:
2222 vput vexpr res find 'bananarama' 'Bana'
2223 echo $?/$^ERRNAME :$res:
2224 vput vexpr res find 'bananarama' 'rama'
2225 echo $?/$^ERRNAME :$res:
2226 echo ' #1'
2227 vput vexpr res ifind 'bananarama' 'nana'
2228 echo $?/$^ERRNAME :$res:
2229 vput vexpr res ifind 'bananarama' 'bana'
2230 echo $?/$^ERRNAME :$res:
2231 vput vexpr res ifind 'bananarama' 'Bana'
2232 echo $?/$^ERRNAME :$res:
2233 vput vexpr res ifind 'bananarama' 'rama'
2234 echo $?/$^ERRNAME :$res:
2235 echo ' #2'
2236 vput vexpr res substring 'bananarama' 1
2237 echo $?/$^ERRNAME :$res:
2238 vput vexpr res substring 'bananarama' 3
2239 echo $?/$^ERRNAME :$res:
2240 vput vexpr res substring 'bananarama' 5
2241 echo $?/$^ERRNAME :$res:
2242 vput vexpr res substring 'bananarama' 7
2243 echo $?/$^ERRNAME :$res:
2244 vput vexpr res substring 'bananarama' 9
2245 echo $?/$^ERRNAME :$res:
2246 vput vexpr res substring 'bananarama' 10
2247 echo $?/$^ERRNAME :$res:
2248 vput vexpr res substring 'bananarama' 1 3
2249 echo $?/$^ERRNAME :$res:
2250 vput vexpr res substring 'bananarama' 3 3
2251 echo $?/$^ERRNAME :$res:
2252 vput vexpr res substring 'bananarama' 5 3
2253 echo $?/$^ERRNAME :$res:
2254 vput vexpr res substring 'bananarama' 7 3
2255 echo $?/$^ERRNAME :$res:
2256 vput vexpr res substring 'bananarama' 9 3
2257 echo $?/$^ERRNAME :$res:
2258 vput vexpr res substring 'bananarama' 10 3
2259 echo $?/$^ERRNAME :$res:
2260 echo ' #3'
2261 vput vexpr res substring 'bananarama' -1
2262 echo $?/$^ERRNAME :$res:
2263 vput vexpr res substring 'bananarama' -3
2264 echo $?/$^ERRNAME :$res:
2265 vput vexpr res substring 'bananarama' -5
2266 echo $?/$^ERRNAME :$res:
2267 vput vexpr res substring 'bananarama' -7
2268 echo $?/$^ERRNAME :$res:
2269 vput vexpr res substring 'bananarama' -9
2270 echo $?/$^ERRNAME :$res:
2271 vput vexpr res substring 'bananarama' -10
2272 echo $?/$^ERRNAME :$res:
2273 vput vexpr res substring 'bananarama' 1 -3
2274 echo $?/$^ERRNAME :$res:
2275 vput vexpr res substring 'bananarama' 3 -3
2276 echo $?/$^ERRNAME :$res:
2277 vput vexpr res substring 'bananarama' 5 -3
2278 echo $?/$^ERRNAME :$res:
2279 vput vexpr res substring 'bananarama' 7 -3
2280 echo $?/$^ERRNAME :$res:
2281 vput vexpr res substring 'bananarama' 9 -3
2282 echo $?/$^ERRNAME :$res:
2283 vput vexpr res substring 'bananarama' 10 -3
2284 echo $?/$^ERRNAME :$res:
2285 echo ' #4'
2286 vput vexpr res trim 'Cocoon Cocoon'
2287 echo $?/$^ERRNAME :$res:
2288 vput vexpr res trim ' Cocoon Cocoon '
2289 echo $?/$^ERRNAME :$res:
2290 vput vexpr res trim-front 'Cocoon Cocoon'
2291 echo $?/$^ERRNAME :$res:
2292 vput vexpr res trim-front ' Cocoon Cocoon '
2293 echo $?/$^ERRNAME :$res:
2294 vput vexpr res trim-end 'Cocoon Cocoon'
2295 echo $?/$^ERRNAME :$res:
2296 vput vexpr res trim-end ' Cocoon Cocoon '
2297 echo $?/$^ERRNAME :$res:
2298 __EOT
2300 check string 0 "${MBOX}" '3182004322 601'
2302 if have_feat regex; then
2303 ${cat} <<- '__EOT' | ${MAILX} ${ARGS} > "${MBOX}" 2>&1
2304 vput vexpr res regex 'bananarama' 'nana'
2305 echo $?/$^ERRNAME :$res:
2306 vput vexpr res regex 'bananarama' 'bana'
2307 echo $?/$^ERRNAME :$res:
2308 vput vexpr res regex 'bananarama' 'Bana'
2309 echo $?/$^ERRNAME :$res:
2310 vput vexpr res regex 'bananarama' 'rama'
2311 echo $?/$^ERRNAME :$res:
2312 echo ' #1'
2313 vput vexpr res iregex 'bananarama' 'nana'
2314 echo $?/$^ERRNAME :$res:
2315 vput vexpr res iregex 'bananarama' 'bana'
2316 echo $?/$^ERRNAME :$res:
2317 vput vexpr res iregex 'bananarama' 'Bana'
2318 echo $?/$^ERRNAME :$res:
2319 vput vexpr res iregex 'bananarama' 'rama'
2320 echo $?/$^ERRNAME :$res:
2321 echo ' #2'
2322 vput vexpr res regex 'bananarama' '(.*)nana(.*)' '\${1}a\${0}u{\$2}'
2323 echo $?/$^ERRNAME :$res:
2324 vput vexpr res regex 'bananarama' '(.*)bana(.*)' '\${1}a\${0}u\$2'
2325 echo $?/$^ERRNAME :$res:
2326 vput vexpr res regex 'bananarama' 'Bana(.+)' '\$1\$0'
2327 echo $?/$^ERRNAME :$res:
2328 vput vexpr res regex 'bananarama' '(.+)rama' '\$1\$0'
2329 echo $?/$^ERRNAME :$res:
2330 echo ' #3'
2331 vput vexpr res iregex 'bananarama' '(.*)nana(.*)' '\${1}a\${0}u{\$2}'
2332 echo $?/$^ERRNAME :$res:
2333 vput vexpr res iregex 'bananarama' '(.*)bana(.*)' '\${1}a\${0}u\$2'
2334 echo $?/$^ERRNAME :$res:
2335 vput vexpr res iregex 'bananarama' 'Bana(.+)' '\$1\$0'
2336 echo $?/$^ERRNAME :$res:
2337 vput vexpr res iregex 'bananarama' '(.+)rama' '\$1\$0'
2338 echo $?/$^ERRNAME :$res:
2339 echo ' #4'
2340 __EOT
2342 check regex 0 "${MBOX}" '3270360157 311'
2343 else
2344 printf 'vexpr-regex: unsupported, skipped\n'
2347 t_epilog
2350 t_call_ret() {
2351 t_prolog call_ret
2353 ${cat} <<- '__EOT' | ${MAILX} ${ARGS} -Snomemdebug > "${MBOX}" 2>&1
2354 define w1 {
2355 echon ">$1 "
2356 vput vexpr i + $1 1
2357 if [ $i -le 42 ]
2358 vput vexpr j '&' $i 7
2359 if [ $j -eq 7 ]
2360 echo .
2362 call w1 $i
2363 wysh set i=$? k=$!
2364 vput vexpr j '&' $i 7
2365 echon "<$1/$i/$k "
2366 if [ $j -eq 7 ]
2367 echo .
2369 else
2370 echo ! The end for $1
2372 return $1
2374 # Transport $?/$! up the call chain
2375 define w2 {
2376 echon ">$1 "
2377 vput vexpr i + $1 1
2378 if [ $1 -lt 42 ]
2379 call w2 $i
2380 wysh set i=$? j=$! k=$^ERRNAME
2381 echon "<$1/$i/$k "
2382 return $i $j
2383 else
2384 echo ! The end for $1
2385 return $i $^ERR-BUSY
2387 echoerr au
2389 # Up and down it goes
2390 define w3 {
2391 echon ">$1/$2 "
2392 vput vexpr i + $1 1
2393 if [ $1 -lt 42 ]
2394 call w3 $i $2
2395 wysh set i=$? j=$!
2396 vput vexpr k - $1 $2
2397 if [ $k -eq 21 ]
2398 vput vexpr i + $1 1
2399 vput vexpr j + $2 1
2400 echo "# <$i/$j> .. "
2401 call w3 $i $j
2402 wysh set i=$? j=$!
2404 eval echon "<\$1=\$i/\$^ERRNAME-$j "
2405 return $i $j
2406 else
2407 echo ! The end for $1=$i/$2
2408 if [ "$2" != "" ]
2409 return $i $^ERR-DOM
2410 else
2411 return $i $^ERR-BUSY
2414 echoerr au
2417 call w1 0; echo ?=$? !=$!; echo -----;
2418 call w2 0; echo ?=$? !=$^ERRNAME; echo -----;
2419 call w3 0 1; echo ?=$? !=$^ERRNAME; echo -----;
2420 __EOT
2422 check 1 0 "${MBOX}" '1572045517 5922'
2424 t_epilog
2427 t_xcall() {
2428 t_prolog xcall
2430 ${cat} <<- '__EOT' | ${MAILX} ${ARGS} -Snomemdebug > "${MBOX}" 2>&1
2431 define work {
2432 echon "$1 "
2433 vput vexpr i + $1 1
2434 if [ $i -le 1111 ]
2435 vput vexpr j '&' $i 7
2436 if [ $j -eq 7 ]
2437 echo .
2439 \xcall work $i $2
2441 echo ! The end for $1/$2
2442 if [ "$2" != "" ]
2443 return $i $^ERR-BUSY
2446 define xwork {
2447 \xcall work 0 $2
2449 call work 0
2450 echo ?=$? !=$!
2451 call xwork
2452 echo ?=$? !=$!
2453 xcall xwork
2454 echo ?=$? !=$^ERRNAME
2456 call work 0 yes
2457 echo ?=$? !=$^ERRNAME
2458 call xwork 0 yes
2459 echo ?=$? !=$^ERRNAME
2460 __EOT
2462 check 1 0 "${MBOX}" '2401702082 23801'
2466 if have_feat uistrings; then
2467 ${cat} <<- '__EOT' > "${BODY}"
2468 define __w {
2469 echon "$1 "
2470 vput vexpr i + $1 1
2471 if [ $i -le 111 ]
2472 vput vexpr j '&' $i 7
2473 if [ $j -eq 7 ]
2474 echo .
2476 \xcall __w $i $2
2478 echo ! The end for $1
2479 if [ $2 -eq 0 ]
2480 nonexistingcommand
2481 echo would be err with errexit
2482 return
2484 echo calling exit
2485 exit
2487 define work {
2488 echo eins
2489 call __w 0 0
2490 echo zwei, ?=$? !=$!
2491 localopts yes; set errexit
2492 ignerr call __w 0 0
2493 echo drei, ?=$? !=$^ERRNAME
2494 call __w 0 $1
2495 echo vier, ?=$? !=$^ERRNAME, this is an error
2497 ignerr call work 0
2498 echo outer 1, ?=$? !=$^ERRNAME
2499 xxxign call work 0
2500 echo outer 2, ?=$? !=$^ERRNAME, could be error if xxxign non-empty
2501 call work 1
2502 echo outer 3, ?=$? !=$^ERRNAME
2503 echo this is definitely an error
2504 __EOT
2506 < "${BODY}" ${MAILX} ${ARGS} -X'commandalias xxxign ignerr' \
2507 -Snomemdebug > "${MBOX}" 2>&1
2508 check 2 0 "${MBOX}" '3900716531 4200'
2510 < "${BODY}" ${MAILX} ${ARGS} -X'commandalias xxxign " "' \
2511 -Snomemdebug > "${MBOX}" 2>&1
2512 check 3 1 "${MBOX}" '1006776201 2799'
2513 else
2514 echo 'xcall-2: unsupported, skipped'
2515 echo 'xcall-3: unsupported, skipped'
2518 t_epilog
2521 t_vpospar() {
2522 t_prolog vpospar
2524 ${cat} <<- '__EOT' | ${MAILX} ${ARGS} > "${MBOX}" 2>&1
2525 vpospar set hey, "'you ", world!
2526 echo $?/$^ERRNAME/$#: $* / "$@" / <$1><$2><$3><$4>
2527 vput vpospar x quote; echo x<$x>
2528 vpospar clear;echo $?/$^ERRNAME/$#: $* / "$@" / <$1><$2><$3><$4>
2529 vput vpospar y quote;echo y<$y>
2530 eval vpospar set ${x};echo $?/$^ERRNAME/$#: $* / "$@" / <$1><$2><$3><$4>
2531 eval vpospar set ${y};echo $?/$^ERRNAME/$#: $* / "$@" / <$1><$2><$3><$4>
2532 eval vpospar set ${x};echo $?/$^ERRNAME/$#: $* / "$@" / <$1><$2><$3><$4>
2534 define infun2 {
2535 echo infun2:$?/$^ERRNAME/$#:$*/"$@"/<$1><$2><$3><$4>
2536 vput vpospar z quote;echo infun2:z<$z>
2539 define infun {
2540 echo infun:$?/$^ERRNAME/$#:$*/"$@"/<$1><$2><$3><$4>
2541 vput vpospar y quote;echo infun:y<$y>
2542 eval vpospar set ${x};echo infun:$?/$^ERRNAME/$#:$*/"$@"/<$1><$2><$3><$4>
2543 vpospar clear;echo infun:$?/$^ERRNAME/$#:$*/"$@"/<$1><$2><$3><$4>
2544 eval call infun2 $x
2545 echo infun:$?/$^ERRNAME/$#:$*/"$@"/<$1><$2><$3><$4>
2546 eval vpospar set ${y};echo infun:$?/$^ERRNAME/$#:$*/"$@"/<$1><$2><$3><$4>
2549 call infun This "in a" fun
2550 echo $?/$^ERRNAME/$#: $* / "$@" / <$1><$2><$3><$4>
2551 vpospar clear;echo $?/$^ERRNAME/$#: $* / "$@" / <$1><$2><$3><$4>
2552 __EOT
2553 check 1 0 "${MBOX}" '155175639 866'
2556 ${cat} <<- '__EOT' | ${MAILX} ${ARGS} > "${MBOX}" 2>&1
2557 set ifs=\'
2558 echo ifs<$ifs> ifs-ws<$ifs-ws>
2559 vpospar set hey, "'you ", world!
2560 echo $?/$^ERRNAME/$#: $* / "$@" / <$1><$2><$3><$4>
2561 vput vpospar x quote; echo x<$x>
2562 vpospar clear;echo $?/$^ERRNAME/$#: $* / "$@" / <$1><$2><$3><$4>
2563 eval vpospar set ${x};echo $?/$^ERRNAME/$#: $* / "$@" / <$1><$2><$3><$4>
2565 set ifs=,
2566 echo ifs<$ifs> ifs-ws<$ifs-ws>
2567 vpospar set hey, "'you ", world!
2568 unset ifs;echo $?/$^ERRNAME/$#: $* / "$@" / <$1><$2><$3><$4>
2569 set ifs=,
2570 vput vpospar x quote; echo x<$x>
2571 vpospar clear;echo $?/$^ERRNAME/$#: $* / "$@" / <$1><$2><$3><$4>
2572 eval vpospar set ${x};\
2573 unset ifs;echo $?/$^ERRNAME/$#: $* / "$@" / <$1><$2><$3><$4>
2575 wysh set ifs=$',\t'
2576 echo ifs<$ifs> ifs-ws<$ifs-ws>
2577 vpospar set hey, "'you ", world!
2578 unset ifs; echo $?/$^ERRNAME/$#: $* / "$@" / <$1><$2><$3><$4>
2579 wysh set ifs=$',\t'
2580 vput vpospar x quote; echo x<$x>
2581 vpospar clear;echo $?/$^ERRNAME/$#: $* / "$@" / <$1><$2><$3><$4>
2582 eval vpospar set ${x};\
2583 unset ifs;echo $?/$^ERRNAME/$#: $* / "$@" / <$1><$2><$3><$4>
2584 __EOT
2585 check ifs 0 "${MBOX}" '2015927702 706'
2587 t_epilog
2590 t_atxplode() {
2591 t_prolog atxplode
2592 TRAP_EXIT_ADDONS="./.t*"
2594 ${cat} > ./.t.sh <<- '___'; ${cat} > ./.t.rc <<- '___'
2595 x() { echo $#; }
2596 xxx() {
2597 printf " (1/$#: <$1>)"
2598 shift
2599 if [ $# -gt 0 ]; then
2600 xxx "$@"
2601 else
2602 echo
2605 yyy() {
2606 eval "$@ ' ball"
2608 set --
2609 x "$@"
2610 x "$@"''
2611 x " $@"
2612 x "$@ "
2613 printf yyy;yyy 'xxx' "b\$'\t'u ' "
2614 printf xxx;xxx arg ,b u.
2615 printf xxx;xxx arg , .
2616 printf xxx;xxx arg ,ball.
2618 define x {
2619 echo $#
2621 define xxx {
2622 echon " (1/$#: <$1>)"
2623 shift
2624 if [ $# -gt 0 ]
2625 \xcall xxx "$@"
2626 endif
2627 echo
2629 define yyy {
2630 eval "$@ ' ball"
2632 vpospar set
2633 call x "$@"
2634 call x "$@"''
2635 call x " $@"
2636 call x "$@ "
2637 echon yyy;call yyy '\call xxx' "b\$'\t'u ' "
2638 echon xxx;call xxx arg ,b u.
2639 echon xxx;call xxx arg , .
2640 echon xxx;call xxx arg ,ball.
2643 ${MAILX} ${ARGS} -X'source ./.t.rc' -Xx > "${MBOX}" 2>&1
2644 check 1 0 "${MBOX}" '41566293 164'
2646 #${SHELL} ./.t.sh > ./.tshout 2>&1
2647 #check disproof-1 0 ./.tshout '41566293 164'
2649 t_epilog
2652 t_read() {
2653 t_prolog read
2654 TRAP_EXIT_ADDONS="./.t*"
2656 ${cat} <<- '__EOT' > .tin
2657 hey1, "'you ", world!
2658 hey2, "'you ", bugs bunny!
2659 hey3, "'you ",
2660 hey4, "'you "
2661 __EOT
2663 ${cat} <<- '__EOT' |\
2664 ${MAILX} ${ARGS} -X'readctl create ./.tin' > "${MBOX}" 2>&1
2665 read a b c
2666 echo $?/$^ERRNAME / <$a><$b><$c>
2667 read a b c
2668 echo $?/$^ERRNAME / <$a><$b><$c>
2669 read a b c
2670 echo $?/$^ERRNAME / <$a><$b><$c>
2671 read a b c
2672 echo $?/$^ERRNAME / <$a><$b><$c>
2673 unset a b c;read a b c
2674 echo $?/$^ERRNAME / <$a><$b><$c>
2675 readctl remove ./.tin;echo readctl remove:$?/$^ERRNAME
2676 __EOT
2677 check 1 0 "${MBOX}" '1527910147 173'
2679 ${cat} <<- '__EOT' > .tin2
2680 hey2.0,:"'you ",:world!:mars.:
2681 hey2.1,:"'you ",:world!
2682 hey2.2,:"'you ",:bugs bunny!
2683 hey2.3,:"'you ",:
2684 hey2.4,:"'you ":
2686 __EOT
2688 ${cat} <<- '__EOT' |\
2689 6< .tin2 ${MAILX} ${ARGS} -X 'readctl create 6' > "${MBOX}" 2>&1
2690 set ifs=:
2691 read a b c
2692 echo $?/$^ERRNAME / <$a><$b><$c>
2693 read a b c
2694 echo $?/$^ERRNAME / <$a><$b><$c>
2695 read a b c
2696 echo $?/$^ERRNAME / <$a><$b><$c>
2697 read a b c
2698 echo $?/$^ERRNAME / <$a><$b><$c>
2699 read a b c
2700 echo $?/$^ERRNAME / <$a><$b><$c>
2701 read a b c
2702 echo $?/$^ERRNAME / <$a><$b><$c>
2703 unset a b c;read a b c
2704 echo $?/$^ERRNAME / <$a><$b><$c>
2705 read a b c
2706 echo $?/$^ERRNAME / <$a><$b><$c>
2707 readctl remove 6;echo readctl remove:$?/$^ERRNAME
2708 __EOT
2709 check ifs 0 "${MBOX}" '890153490 298'
2711 ${cat} <<- '__EOT' | ${MAILX} ${ARGS} > "${MBOX}" 2>&1
2712 readctl create .tin
2713 readall d; echo $?/$^ERRNAME / <$d>
2714 wysh set d;readall d;echo $?/$^ERRNAME / <$d>
2715 readctl create .tin2
2716 readall d; echo $?/$^ERRNAME / <$d>
2717 wysh set d;readall d;echo $?/$^ERRNAME / <$d>
2718 readctl remove .tin;echo $?/$^ERRNAME;\
2719 readctl remove .tin2;echo $?/$^ERRNAME
2720 echo '### now with empty lines'
2721 ! printf 'one line\n\ntwo line\n\n' > ./.temptynl
2722 readctl create .temptynl;echo $?/$^ERRNAME
2723 readall d; echo "$?/$^ERRNAME / <$d>"
2724 readctl remove .temptynl;echo $?/$^ERRNAME
2725 __EOT
2726 check readall 0 "${MBOX}" '4113506527 405'
2728 t_epilog
2731 t_mbox() {
2732 t_prolog mbox
2733 TRAP_EXIT_ADDONS="./.t*"
2737 while [ ${i} -lt 113 ]; do
2738 printf 'm file://%s\n~s Subject %s\nHello %s!\n~.\n' \
2739 "${MBOX}" "${i}" "${i}"
2740 i=`add ${i} 1`
2741 done
2742 ) | ${MAILX} ${ARGS} > .tall 2>&1
2743 check 1 0 "${MBOX}" '1785801373 13336'
2744 check 1-outerr - ./.tall '4294967295 0' # empty file
2746 printf 'File "%s"\ncopy * "%s"\nFile "%s"\nfrom*' "${MBOX}" .tmbox1 .tmbox1 |
2747 ${MAILX} ${ARGS} -Sshowlast > .tall 2>&1
2748 check 2 0 .tall '3075634057 9103'
2750 printf 'File "%s"\ncopy * "file://%s"\nFile "file://%s"\nfrom*' \
2751 "${MBOX}" .tmbox2 .tmbox2 | ${MAILX} ${ARGS} -Sshowlast > .tall 2>&1
2752 check 3 0 .tall '1902668747 9110'
2754 # copy only the odd (but the first), move the even
2756 printf 'File "file://%s"\ncopy ' .tmbox2
2758 while [ ${i} -lt 113 ]; do
2759 printf '%s ' "${i}"
2760 i=`add ${i} 2`
2761 done
2762 printf 'file://%s\nFile "file://%s"\nfrom*' .tmbox3 .tmbox3
2763 ) | ${MAILX} ${ARGS} -Sshowlast > .tall 2>&1
2764 check 4 0 .tmbox3 '2554734733 6666'
2765 check 5 - .tall '3168324241 4573'
2766 # ...
2768 printf 'file "file://%s"\nmove ' .tmbox2
2770 while [ ${i} -lt 113 ]; do
2771 printf '%s ' "${i}"
2772 i=`add ${i} 2`
2773 done
2774 printf 'file://%s\nFile "file://%s"\nfrom*\nFile "file://%s"\nfrom*' \
2775 .tmbox3 .tmbox3 .tmbox2
2776 ) | ${MAILX} ${ARGS} -Sshowlast > .tall 2>>${ERR}
2777 check 6 0 .tmbox3 '1429216753 13336'
2778 if have_feat uistrings; then
2779 ${sed} 2d < .tall > .tallx
2780 else
2781 ${cp} .tall .tallx
2783 check 7 - .tallx '3604509039 13645'
2785 # Invalid MBOXes (after [f4db93b3])
2786 echo > .tinvmbox
2787 printf 'copy 1 ./.tinvmbox' | ${MAILX} ${ARGS} -Rf "${MBOX}" > .tall 2>&1
2788 check 8 0 .tinvmbox '2848412822 118'
2789 check 9 - ./.tall '461280182 33'
2791 echo ' ' > .tinvmbox
2792 printf 'copy 1 ./.tinvmbox' | ${MAILX} ${ARGS} -Rf "${MBOX}" > .tall 2>&1
2793 check 10 0 .tinvmbox '624770486 120'
2794 check 11 - ./.tall '461280182 33'
2796 { echo; echo; } > .tinvmbox # (not invalid)
2797 printf 'copy 1 ./.tinvmbox' | ${MAILX} ${ARGS} -Rf "${MBOX}" > .tall 2>&1
2798 check 12 0 .tinvmbox '1485640875 119'
2799 check 13 - ./.tall '461280182 33'
2801 # *mbox-rfc4155*, plus
2802 ${cat} <<-_EOT > ./.tinv1
2805 From MAILER-DAEMON-1 Wed Oct 2 01:50:07 1996
2806 Date: Wed, 02 Oct 1996 01:50:07 +0000
2808 Subject: Bad bad message 1
2810 From me to you, blinde Kuh!
2812 From MAILER-DAEMON-2 Wed Oct 2 01:50:07 1996
2813 Date: Wed, 02 Oct 1996 01:50:07 +0000
2815 Subject: Bad bad message 2
2817 From me to you, blindes Kalb!
2818 _EOT
2819 ${cp} ./.tinv1 ./.tinv2
2821 printf \
2822 'define mboxfix {
2823 \\localopts yes; \\wysh set mbox-rfc4155;\\wysh File "${1}";\\
2824 \\eval copy * "${2}"
2826 call mboxfix ./.tinv1 ./.tok' | ${MAILX} ${ARGS} > .tall 2>&1
2827 check_ex0 14-estat
2828 ${cat} ./.tinv1 ./.tok >> .tall
2829 check 14 - ./.tall '739301109 616'
2831 printf \
2832 'wysh file ./.tinv1 # ^From not repaired, but missing trailing NL is
2833 wysh File ./.tok # Just move away to nowhere
2834 set mbox-rfc4155
2835 wysh file ./.tinv2 # Fully repaired
2836 File ./.tok' | ${MAILX} ${ARGS} >>${ERR} 2>&1
2837 check_ex0 15-estat
2838 check 15-1 - ./.tinv1 '3178048820 332'
2839 check 15-2 - ./.tinv2 '4151504442 314'
2841 t_epilog
2844 t_maildir() {
2845 t_prolog maildir
2846 if have_feat maildir; then :; else
2847 echo 'maildir: unsupported, skipped'
2848 return
2851 TRAP_EXIT_ADDONS="./.t*"
2855 while [ ${i} -lt 112 ]; do
2856 printf 'm file://%s\n~s Subject %s\nHello %s!\n~.\n' \
2857 "${MBOX}" "${i}" "${i}"
2858 i=`add ${i} 1`
2859 done
2860 ) | ${MAILX} ${ARGS}
2861 check 1 0 "${MBOX}" '2366902811 13332'
2863 printf 'File "%s"
2864 copy * "%s"
2865 File "%s"
2866 from*
2867 ' "${MBOX}" .tmdir1 .tmdir1 |
2868 ${MAILX} ${ARGS} -Snewfolders=maildir -Sshowlast > .tlst
2869 check 2 0 .tlst '1713783045 9103'
2871 printf 'File "%s"
2872 copy * "maildir://%s"
2873 File "maildir://%s"
2874 from*
2875 ' "${MBOX}" .tmdir2 .tmdir2 |
2876 ${MAILX} ${ARGS} -Sshowlast > .tlst
2877 check 3 0 .tlst '1240307893 9113'
2879 printf 'File "maildir://%s"
2880 copy * "file://%s"
2881 File "file://%s"
2882 from*
2883 ' .tmdir2 .tmbox1 .tmbox1 |
2884 ${MAILX} ${ARGS} -Sshowlast > .tlst
2885 check 4 0 .tmbox1 '4096198846 12772'
2886 check 5 - .tlst '817337448 9110'
2888 # only the odd (even)
2890 printf 'File "maildir://%s"
2891 copy ' .tmdir2
2893 while [ ${i} -lt 112 ]; do
2894 j=`modulo ${i} 2`
2895 [ ${j} -eq 1 ] && printf '%s ' "${i}"
2896 i=`add ${i} 1`
2897 done
2898 printf ' file://%s
2899 File "file://%s"
2900 from*
2901 ' .tmbox2 .tmbox2
2902 ) | ${MAILX} ${ARGS} -Sshowlast > .tlst
2903 check 6 0 .tmbox2 '4228337024 6386'
2904 check 7 - .tlst '884389294 4573'
2905 # ...
2907 printf 'file "maildir://%s"
2908 move ' .tmdir2
2910 while [ ${i} -lt 112 ]; do
2911 j=`modulo ${i} 2`
2912 [ ${j} -eq 0 ] && [ ${i} -ne 0 ] && printf '%s ' "${i}"
2913 i=`add ${i} 1`
2914 done
2915 printf ' file://%s
2916 File "file://%s"
2917 from*
2918 File "maildir://%s"
2919 from*
2920 ' .tmbox2 .tmbox2 .tmdir2
2921 ) | ${MAILX} ${ARGS} -Sshowlast > .tlst
2922 check 8 0 .tmbox2 '978751761 12656'
2923 ${sed} 2d < .tlst > .tlstx
2924 check 9 - .tlstx '2391942957 13645'
2926 t_epilog
2929 t_record_a_resend() {
2930 t_prolog record_a_resend
2931 TRAP_EXIT_ADDONS="./.t.record ./.t.resent"
2933 printf '
2934 set record=%s
2935 m %s\n~s Subject 1.\nHello.\n~.
2936 set record-files add-file-recipients
2937 m %s\n~s Subject 2.\nHello.\n~.
2938 File %s
2939 resend 2 ./.t.resent
2940 Resend 1 ./.t.resent
2941 set record-resent
2942 resend 2 ./.t.resent
2943 Resend 1 ./.t.resent
2944 ' ./.t.record "${MBOX}" "${MBOX}" "${MBOX}" |
2945 ${MAILX} ${ARGS}
2947 check 1 0 "${MBOX}" '2632690399 252'
2948 check 2 - .t.record '3337485450 456'
2949 check 3 - .t.resent '1560890069 640'
2951 t_epilog
2954 t_e_H_L_opts() {
2955 t_prolog e_H_L_opts
2956 TRAP_EXIT_ADDONS="./.tmta.sh ./.t.mbox"
2958 t_xmta 'Alchemilla Wed Apr 07 17:03:33 2017' ./.t.mbox
2960 touch ./.t.mbox
2961 ${MAILX} ${ARGS} -ef ./.t.mbox
2962 echo ${?} > "${MBOX}"
2964 printf 'm me@exam.ple\nLine 1.\nHello.\n~.\n' |
2965 ${MAILX} ${ARGS} -Smta=./.tmta.sh
2966 printf 'm you@exam.ple\nLine 1.\nBye.\n~.\n' |
2967 ${MAILX} ${ARGS} -Smta=./.tmta.sh
2969 ${MAILX} ${ARGS} -ef ./.t.mbox
2970 echo ${?} >> "${MBOX}"
2971 ${MAILX} ${ARGS} -efL @t@me ./.t.mbox
2972 echo ${?} >> "${MBOX}"
2973 ${MAILX} ${ARGS} -efL @t@you ./.t.mbox
2974 echo ${?} >> "${MBOX}"
2975 ${MAILX} ${ARGS} -efL '@>@Line 1' ./.t.mbox
2976 echo ${?} >> "${MBOX}"
2977 ${MAILX} ${ARGS} -efL '@>@Hello.' ./.t.mbox
2978 echo ${?} >> "${MBOX}"
2979 ${MAILX} ${ARGS} -efL '@>@Bye.' ./.t.mbox
2980 echo ${?} >> "${MBOX}"
2981 ${MAILX} ${ARGS} -efL '@>@Good bye.' ./.t.mbox
2982 echo ${?} >> "${MBOX}"
2984 ${MAILX} ${ARGS} -fH ./.t.mbox >> "${MBOX}"
2985 echo ${?} >> "${MBOX}"
2986 ${MAILX} ${ARGS} -fL @t@me ./.t.mbox >> "${MBOX}"
2987 echo ${?} >> "${MBOX}"
2988 ${MAILX} ${ARGS} -fL @t@you ./.t.mbox >> "${MBOX}"
2989 echo ${?} >> "${MBOX}"
2990 ${MAILX} ${ARGS} -fL '@>@Line 1' ./.t.mbox >> "${MBOX}"
2991 echo ${?} >> "${MBOX}"
2992 ${MAILX} ${ARGS} -fL '@>@Hello.' ./.t.mbox >> "${MBOX}"
2993 echo ${?} >> "${MBOX}"
2994 ${MAILX} ${ARGS} -fL '@>@Bye.' ./.t.mbox >> "${MBOX}"
2995 echo ${?} >> "${MBOX}"
2996 ${MAILX} ${ARGS} -fL '@>@Good bye.' ./.t.mbox >> "${MBOX}" 2>>${ERR}
2997 echo ${?} >> "${MBOX}"
2999 check 1 - "${MBOX}" '1708955574 678'
3001 t_epilog
3004 t_alternates() {
3005 t_prolog alternates
3006 TRAP_EXIT_ADDONS="./.t*"
3008 t_xmta 'Valeriana Sat Jul 08 15:54:03 2017'
3010 ${cat} <<- '__EOT' | ${MAILX} ${ARGS} -Smta=./.tmta.sh > ./.tall 2>&1
3011 echo --0
3012 alternates
3013 echo $?/$^ERRNAME
3014 alternates a1@b1 a2@b2 a3@b3
3015 echo $?/$^ERRNAME
3016 alternates
3017 echo $?/$^ERRNAME
3018 vput alternates rv
3019 echo $?/$^ERRNAME <$rv>
3021 echo --1
3022 unalternates a2@b2
3023 vput alternates rv
3024 echo $?/$^ERRNAME <$rv>
3025 unalternates a3@b3
3026 vput alternates rv
3027 echo $?/$^ERRNAME <$rv>
3028 unalternates a1@b1
3029 vput alternates rv
3030 echo $?/$^ERRNAME <$rv>
3032 echo --2
3033 unalternates *
3034 alternates a1@b1 a2@b2 a3@b3
3035 unalternates a3@b3
3036 vput alternates rv
3037 echo $?/$^ERRNAME <$rv>
3038 unalternates a2@b2
3039 vput alternates rv
3040 echo $?/$^ERRNAME <$rv>
3041 unalternates a1@b1
3042 vput alternates rv
3043 echo $?/$^ERRNAME <$rv>
3045 echo --3
3046 alternates a1@b1 a2@b2 a3@b3
3047 unalternates a1@b1
3048 vput alternates rv
3049 echo $?/$^ERRNAME <$rv>
3050 unalternates a2@b2
3051 vput alternates rv
3052 echo $?/$^ERRNAME <$rv>
3053 unalternates a3@b3
3054 vput alternates rv
3055 echo $?/$^ERRNAME <$rv>
3057 echo --4
3058 unalternates *
3059 alternates a1@b1 a2@b2 a3@b3
3060 unalternates *
3061 vput alternates rv
3062 echo $?/$^ERRNAME <$rv>
3064 echo --5
3065 unalternates *
3066 alternates a1@b1 a1@c1 a1@d1 a2@b2 a3@b3 a3@c3 a3@d3
3067 m a1@b1 a1@c1 a1@d1
3068 ~s all alternates, only a1@b1 remains
3069 ~c a2@b2
3070 ~b a3@b3 a3@c3 a3@d3
3071 ~r - '_EOT'
3072 This body is!
3073 This also body is!!
3074 _EOT
3077 echo --6
3078 unalternates *
3079 alternates a1@b1 a1@c1 a2@b2 a3@b3
3080 m a1@b1 a1@c1 a1@d1
3081 ~s a1@b1 a1@d1, and a3@c3 a3@d3 remain
3082 ~c a2@b2
3083 ~b a3@b3 a3@c3 a3@d3
3084 ~r - '_EOT'
3085 This body2 is!
3086 _EOT
3089 echo --7
3090 alternates a1@b1 a2@b2 a3; set allnet
3091 m a1@b1 a1@c1 a1@d1
3092 ~s all alternates via allnet, only a1@b1 remains
3093 ~c a2@b2
3094 ~b a3@b3 a3@c3 a3@d3
3095 ~r - '_EOT'
3096 This body3 is!
3097 _EOT
3100 echo --10
3101 unalternates *
3102 alternates a1@b1
3103 echo $?/$^ERRNAME
3104 vput alternates rv
3105 echo $?/$^ERRNAME <$rv>
3106 alternates a2@b2
3107 echo $?/$^ERRNAME
3108 vput alternates rv
3109 echo $?/$^ERRNAME <$rv>
3110 alternates a3@b3
3111 echo $?/$^ERRNAME
3112 vput alternates rv
3113 echo $?/$^ERRNAME <$rv>
3114 alternates a4@b4
3115 echo $?/$^ERRNAME
3116 vput alternates rv
3117 echo $?/$^ERRNAME <$rv>
3119 unalternates *
3120 vput alternates rv
3121 echo $?/$^ERRNAME <$rv>
3123 echo --11
3124 set posix
3125 alternates a1@b1 a2@b2
3126 echo $?/$^ERRNAME
3127 vput alternates rv
3128 echo $?/$^ERRNAME <$rv>
3129 alternates a3@b3 a4@b4
3130 echo $?/$^ERRNAME
3131 vput alternates rv
3132 echo $?/$^ERRNAME <$rv>
3133 __EOT
3135 check 1 0 "${MBOX}" '142184864 515'
3136 if have_feat uistrings; then
3137 check 2 - .tall '1878598364 505'
3138 else
3139 echo 'alternates-2: unsupported, skipped'
3142 # Automatic alternates, also from command line (freezing etc.)
3143 ${rm} "${MBOX}"
3144 ${cat} <<- __EOT > ./.tin
3145 From trouble-report@desy Wed Jun 6 20:19:28 2018
3146 Date: Wed, 06 Jun 2018 19:58:02 +0200
3147 From: a@b.org, b@b.org, c@c.org
3148 Sender: a@b.org
3149 To: b@b.org
3150 Cc: a@b.org, c@c.org
3151 Subject: test
3152 Message-ID: <20180606175802.dw-cn%a@b.org>
3154 sultry
3156 __EOT
3158 printf '#
3159 reply
3161 b@b.org
3162 a@b.org b@b.org c@c.org
3165 my body
3167 ' | ${MAILX} ${ARGS} -Smta=./.tmta.sh -Sescape=! \
3168 -S from=a@b.org,b@b.org,c@c.org -S sender=a@b.org \
3169 -Rf ./.tin > ./.tall 2>&1
3170 check 3 0 "${MBOX}" '287250471 256'
3171 check 4 - .tall '4294967295 0'
3173 # same, per command
3174 printf '#
3175 set from=a@b.org,b@b.org,c@c.org sender=a@b.org
3176 reply
3178 b@b.org
3179 a@b.org b@b.org c@c.org
3182 my body
3184 ' | ${MAILX} ${ARGS} -Smta=./.tmta.sh -Sescape=! \
3185 -Rf ./.tin > ./.tall 2>&1
3186 check 5 0 "${MBOX}" '2618762028 512'
3187 check 6 - .tall '4294967295 0'
3189 # And more, with/out -r
3190 # TODO -r should be the Sender:, which should automatically propagate to
3191 # TODO From: if possible and/or necessary. It should be possible to
3192 # TODO suppres -r stuff from From: and Sender:, but fallback to special -r
3193 # TODO arg as appropriate.
3194 # TODO For now we are a bit messy
3196 ${rm} "${MBOX}"
3197 </dev/null ${MAILX} ${ARGS} -Smta=./.tmta.sh -s '-Sfrom + -r ++ test' \
3198 -c a@b.example,b@b.example,c@c.example \
3199 -S from=a@b.example,b@b.example,c@c.example \
3200 -S sender=a@b.example \
3201 -r a@b.example b@b.example ./.tout >./.tall 2>&1
3202 check 7 0 "${MBOX}" '3510981487 192'
3203 check 8 - .tout '2052716617 201'
3204 check 9 - .tall '4294967295 0'
3206 </dev/null ${MAILX} ${ARGS} -Smta=./.tmta.sh -s '-Sfrom + -r ++ test' \
3207 -c a@b.example,b@b.example,c@c.example \
3208 -S from=a@b.example,b@b.example,c@c.example \
3209 -r a@b.example b@b.example ./.tout >./.tall 2>&1
3210 check 10 0 "${MBOX}" '2282326606 364'
3211 check 11 - .tout '3213404599 382'
3212 check 12 - .tall '4294967295 0'
3214 </dev/null ${MAILX} ${ARGS} -Smta=./.tmta.sh -s '-Sfrom + -r ++ test' \
3215 -c a@b.example,b@b.example,c@c.example \
3216 -S from=a@b.example,b@b.example,c@c.example \
3217 -S sender=a@b.example \
3218 b@b.example >./.tall 2>&1
3219 check 13 0 "${MBOX}" '1460017970 582'
3220 check 14 - .tall '4294967295 0'
3222 t_epilog
3225 t_alias() {
3226 t_prolog alias
3227 TRAP_EXIT_ADDONS="./.t*"
3229 t_xmta 'Hippocastanum Mon Jun 19 15:07:07 2017'
3231 ${cat} <<- '__EOT' | ${MAILX} ${ARGS} -Smta=./.tmta.sh > ./.tall 2>&1
3232 alias a1 ex1@a1.ple
3233 alias a1 ex2@a1.ple "EX3 <ex3@a1.ple>"
3234 alias a1 ex4@a1.ple
3235 alias a2 ex1@a2.ple ex2@a2.ple ex3@a2.ple ex4@a2.ple
3236 alias a3 a4
3237 alias a4 a5 ex1@a4.ple
3238 alias a5 a6
3239 alias a6 a7 ex1@a6.ple
3240 alias a7 a8
3241 alias a8 ex1@a8.ple
3242 alias a1
3243 alias a2
3244 alias a3
3245 m a1
3246 ~c a2
3247 ~b a3
3248 ~r - '_EOT'
3249 This body is!
3250 This also body is!!
3251 _EOT
3252 __EOT
3253 check 1 0 "${MBOX}" '2496925843 272'
3254 check 2 - .tall '3548953204 152'
3256 # TODO t_alias: n_ALIAS_MAXEXP is compile-time constant,
3257 # TODO need to somehow provide its contents to the test, then test
3259 t_epilog
3262 t_filetype() {
3263 t_prolog filetype
3264 TRAP_EXIT_ADDONS="./.t*"
3266 t_xmta 'Alchemilla Wed Apr 25 15:12:13 2017'
3268 printf 'm m1@e.t\nL1\nHy1\n~.\nm m2@e.t\nL2\nHy2\n~@ %s\n~.\n' \
3269 "${SRCDIR}snailmail.jpg" | ${MAILX} ${ARGS} -Smta=./.tmta.sh
3270 check 1 0 "${MBOX}" '1594682963 13520'
3272 if (echo | gzip -c) >/dev/null 2>&1; then
3274 printf 'File "%s"\ncopy 1 ./.t.mbox.gz\ncopy 2 ./.t.mbox.gz' \
3275 "${MBOX}" | ${MAILX} ${ARGS} \
3276 -X'filetype gz gzip\ -dc gzip\ -c'
3277 printf 'File ./.t.mbox.gz\ncopy * ./.t.mbox\n' |
3278 ${MAILX} ${ARGS} -X'filetype gz gzip\ -dc gzip\ -c'
3279 } > ./.t.out 2>&1
3280 check 2 - "./.t.mbox" '1594682963 13520'
3281 check 3 - "./.t.out" '2392348396 102'
3282 else
3283 echo 'filetype-2: unsupported, skipped'
3284 echo 'filetype-3: unsupported, skipped'
3288 ${rm} ./.t.mbox*
3289 printf 'File "%s"\ncopy 1 ./.t.mbox.gz
3290 copy 2 ./.t.mbox.gz
3291 copy 1 ./.t.mbox.gz
3292 copy 2 ./.t.mbox.gz
3293 ' "${MBOX}" |
3294 ${MAILX} ${ARGS} \
3295 -X'filetype gz gzip\ -dc gzip\ -c' \
3296 -X'filetype mbox.gz "${sed} 1,3d|${cat}" \
3297 "echo eins;echo zwei;echo und mit ${sed} bist Du dabei;${cat}"'
3298 printf 'File ./.t.mbox.gz\ncopy * ./.t.mbox\n' |
3299 ${MAILX} ${ARGS} \
3300 -X'filetype gz gzip\ -dc gzip\ -c' \
3301 -X'filetype mbox.gz "${sed} 1,3d|${cat}" kill\ 0'
3302 } > ./.t.out 2>&1
3303 check 4 - "./.t.mbox" '2886541147 27060'
3304 check 5 - "./.t.out" '852335377 172'
3306 t_epilog
3309 t_message_injections() {
3310 t_prolog message_injections
3311 TRAP_EXIT_ADDONS="./.t*"
3313 t_xmta 'Echinacea Tue Jun 20 15:54:02 2017'
3315 echo mysig > ./.tmysig
3317 echo some-body | ${MAILX} ${ARGS} -Smta=./.tmta.sh \
3318 -Smessage-inject-head=head-inject \
3319 -Smessage-inject-tail=tail-inject \
3320 -Ssignature=./.tmysig \
3321 ex@am.ple > ./.tall 2>&1
3322 check 1 0 "${MBOX}" '2434746382 134'
3323 check 2 - .tall '4294967295 0' # empty file
3325 ${rm} "${MBOX}"
3326 ${cat} <<-_EOT > ./.template
3327 From: me
3328 To: ex1@am.ple
3329 Cc: ex2@am.ple
3330 Subject: This subject is
3332 Body, body, body me.
3333 _EOT
3334 < ./.template ${MAILX} ${ARGS} -t -Smta=./.tmta.sh \
3335 -Smessage-inject-head=head-inject \
3336 -Smessage-inject-tail=tail-inject \
3337 -Ssignature=./.tmysig \
3338 > ./.tall 2>&1
3339 check 3 0 "${MBOX}" '3114203412 198'
3340 check 4 - .tall '4294967295 0' # empty file
3342 t_epilog
3345 t_attachments() {
3346 t_prolog attachments
3347 TRAP_EXIT_ADDONS="./.t*"
3349 t_xmta 'Cannabis Sun Feb 18 02:02:46 2018'
3351 ${cat} <<-_EOT > ./.tx
3352 From steffen Sun Feb 18 02:48:40 2018
3353 Date: Sun, 18 Feb 2018 02:48:40 +0100
3355 Subject: m1
3356 User-Agent: s-nail v14.9.7
3359 From steffen Sun Feb 18 02:48:42 2018
3360 Date: Sun, 18 Feb 2018 02:48:42 +0100
3362 Subject: m2
3363 User-Agent: s-nail v14.9.7
3366 _EOT
3367 echo att1 > ./.t1
3368 printf 'att2-1\natt2-2\natt2-4\n' > ./'.t 2'
3369 printf 'att3-1\natt3-2\natt3-4\n' > ./.t3
3370 printf 'att4-1\natt4-2\natt4-4\n' > './.t 4'
3372 printf \
3373 '!@ ./.t3 "./.t 4" ""
3376 ./.t3
3377 "./.t 2"
3380 !.' \
3381 | ${MAILX} ${ARGS} -Sescape=! -Smta=./.tmta.sh \
3382 -a ./.t1 -a './.t 2' \
3383 -s attachment-test \
3384 ex@am.ple > ./.tall 2>&1
3385 check 1 0 "${MBOX}" '4107062253 634'
3386 if have_feat uistrings; then
3387 check 2 - .tall '1928331872 720'
3388 else
3389 echo 'attachments-2: unsupported, skipped'
3392 ${rm} "${MBOX}"
3393 printf \
3394 'mail ex@amp.ple
3395 !s This the subject is
3396 !@ ./.t3 "#2" "./.t 4" "#1" ""
3399 "./.t 4"
3400 "#2"
3404 mail ex@amp.ple
3405 !s Subject two
3406 !@ ./.t3 "#2" "./.t 4" "#1" ""
3412 mail ex@amp.ple
3413 !s Subject three
3414 !@ ./.t3 "" "#2" "" "./.t 4" "" "#1" ""
3417 ./.t3
3421 mail ex@amp.ple
3422 !s Subject Four
3423 !@ ./.t3 "" "#2" "" "./.t 4" "" "#1" ""
3426 "#1"
3430 mail ex@amp.ple
3431 !s Subject Five
3433 "#2"
3436 !.' \
3437 | ${MAILX} ${ARGS} -Sescape=! -Smta=./.tmta.sh -Rf ./.tx \
3438 > ./.tall 2>&1
3439 check 3 0 "${MBOX}" '798122412 2285'
3440 if have_feat uistrings; then
3441 check 4 - .tall '2526106274 1910'
3442 else
3443 echo 'attachments-4: unsupported, skipped'
3446 ${rm} "${MBOX}"
3447 printf \
3448 'mail ex@amp.ple
3449 !s Subject One
3450 !@ "#."
3451 Body one.
3454 from 2
3455 mail ex@amp.ple
3456 !s Subject Two
3458 "#."
3460 Body two.
3463 reply 1 2
3464 !@ "#."
3468 "#."
3471 !.' \
3472 | ${MAILX} ${ARGS} -Sescape=! -Smta=./.tmta.sh -Rf ./.tx \
3473 > ./.tall 2>&1
3474 check 5 0 "${MBOX}" '2165311808 2276'
3475 if have_feat uistrings; then
3476 check 6 - .tall '3662598562 509'
3477 else
3478 echo 'attachments-6: unsupported, skipped'
3481 t_epilog
3484 t_compose_hooks() { # TODO monster
3485 t_prolog compose_hooks
3486 if have_feat uistrings; then :; else
3487 echo 'compose_hooks: unsupported, skipped'
3488 return
3490 TRAP_EXIT_ADDONS="./.t*"
3492 t_xmta 'PrimulaVeris Wed Apr 10 22:59:00 2017'
3494 (echo line one&&echo line two&&echo line three) > ./.treadctl
3495 (echo echo four&&echo echo five&&echo echo six) > ./.tattach
3497 ${cat} <<'__EOT__' > ./.trc
3498 define bail {
3499 echoerr "Failed: $1. Bailing out"; echo "~x"; xit
3501 define xerr {
3502 vput vexpr es substr "$1" 0 1
3503 if [ "$es" != 2 ]
3504 xcall bail "$2"
3507 define read_mline_res {
3508 read hl; wysh set len=$? es=$! en=$^ERRNAME;\
3509 echo $len/$es/$^ERRNAME: $hl
3510 if [ $es -ne $^ERR-NONE ]
3511 xcall bail read_mline_res
3512 elif [ $len -ne 0 ]
3513 \xcall read_mline_res
3516 define ins_addr {
3517 wysh set xh=$1
3518 echo "~^header list"; read hl; echo $hl;\
3519 call xerr "$hl" "in_addr ($xh) 0-1"
3521 echo "~^header insert $xh diet <$xh@exam.ple> spliced";\
3522 read es; echo $es; call xerr "$es" "ins_addr $xh 1-1"
3523 echo "~^header insert $xh <${xh}2@exam.ple>";\
3524 read es; echo $es; call xerr "$es" "ins_addr $xh 1-2"
3525 echo "~^header insert $xh ${xh}3@exam.ple";\
3526 read es; echo $es; call xerr "$es" "ins_addr $xh 1-3"
3527 echo "~^header list $xh"; read hl; echo $hl;\
3528 call xerr "$hl" "ins_addr $xh 1-4"
3529 echo "~^header show $xh"; read es; call xerr $es "ins_addr $xh 1-5"
3530 call read_mline_res
3532 if [ "$t_remove" == "" ]
3533 return
3536 echo "~^header remove $xh"; read es; call xerr $es "ins_addr $xh 2-1"
3537 echo "~^header remove $xh"; read es; vput vexpr es substr $es 0 3
3538 if [ $es != 501 ]
3539 xcall bail "ins_addr $xh 2-2"
3541 echo "~^header list $xh"; read es; vput vexpr es substr $es 0 3
3542 if [ $es != 501 ]
3543 xcall bail "ins_addr $xh 2-3"
3545 echo "~^header show $xh"; read es; vput vexpr es substr $es 0 3
3546 if [ $es != 501 ]
3547 xcall bail "ins_addr $xh 2-4"
3551 echo "~^header insert $xh diet <$xh@exam.ple> spliced";\
3552 read es; echo $es; call xerr "$es" "ins_addr $xh 3-1"
3553 echo "~^header insert $xh <${xh}2@exam.ple>";\
3554 read es; echo $es; call xerr "$es" "ins_addr $xh 3-2"
3555 echo "~^header insert $xh ${xh}3@exam.ple";\
3556 read es; echo $es; call xerr "$es" "ins_addr $xh 3-3"
3557 echo "~^header list $xh"; read hl; echo $hl;\
3558 call xerr "$hl" "ins_addr $xh 3-4"
3559 echo "~^header show $xh"; read es; call xerr $es "ins_addr $xh 3-5"
3560 call read_mline_res
3562 echo "~^header remove-at $xh 1"; read es;\
3563 call xerr $es "ins_addr $xh 3-6"
3564 echo "~^header remove-at $xh 1"; read es;\
3565 call xerr $es "ins_addr $xh 3-7"
3566 echo "~^header remove-at $xh 1"; read es;\
3567 call xerr $es "ins_addr $xh 3-8"
3568 echo "~^header remove-at $xh 1"; read es;\
3569 vput vexpr es substr $es 0 3
3570 if [ $es != 501 ]
3571 xcall bail "ins_addr $xh 3-9"
3573 echo "~^header remove-at $xh T"; read es;\
3574 vput vexpr es substr $es 0 3
3575 if [ $es != 505 ]
3576 xcall bail "ins_addr $xh 3-10"
3578 echo "~^header list $xh"; read es;\
3579 vput vexpr es substr $es 0 3
3580 if [ $es != 501 ]
3581 xcall bail "ins_addr $xh 3-11"
3583 echo "~^header show $xh"; read es;\
3584 vput vexpr es substr $es 0 3
3585 if [ $es != 501 ]
3586 xcall bail "ins_addr $xh 3-12"
3590 echo "~^header insert $xh diet <$xh@exam.ple> spliced";\
3591 read es; echo $es; call xerr "$es" "ins_addr $xh 4-1"
3592 echo "~^header insert $xh <${xh}2@exam.ple> (comment) \"Quot(e)d\"";\
3593 read es; echo $es; call xerr "$es" "ins_addr $xh 4-2"
3594 echo "~^header insert $xh ${xh}3@exam.ple";\
3595 read es; echo $es; call xerr "$es" "ins_addr $xh 4-3"
3596 echo "~^header list $xh"; read hl; echo $hl;\
3597 call xerr "$hl" "header list $xh 3-4"
3598 echo "~^header show $xh"; read es; call xerr $es "ins_addr $xh 4-5"
3599 call read_mline_res
3601 echo "~^header remove-at $xh 3"; read es;\
3602 call xerr $es "ins_addr $xh 4-6"
3603 echo "~^header remove-at $xh 2"; read es;\
3604 call xerr $es "ins_addr $xh 4-7"
3605 echo "~^header remove-at $xh 1"; read es;\
3606 call xerr $es "ins_addr $xh 4-8"
3607 echo "~^header remove-at $xh 1"; read es;\
3608 vput vexpr es substr $es 0 3
3609 if [ $es != 501 ]
3610 xcall bail "ins_addr $xh 4-9"
3612 echo "~^header remove-at $xh T"; read es;\
3613 vput vexpr es substr $es 0 3
3614 if [ $es != 505 ]
3615 xcall bail "ins_addr $xh 4-10"
3617 echo "~^header list $xh"; read es;\
3618 vput vexpr es substr $es 0 3
3619 if [ $es != 501 ]
3620 xcall bail "ins_addr $xh 4-11"
3622 echo "~^header show $xh"; read es;\
3623 vput vexpr es substr $es 0 3
3624 if [ $es != 501 ]
3625 xcall bail "ins_addr $xh 4-12"
3628 define ins_ref {
3629 wysh set xh=$1 mult=$2
3630 echo "~^header list"; read hl; echo $hl;\
3631 call xerr "$hl" "ins_ref ($xh) 0-1"
3633 echo "~^header insert $xh <$xh@exam.ple>";\
3634 read es; echo $es; call xerr "$es" "ins_ref $xh 1-1"
3635 if [ $mult -ne 0 ]
3636 echo "~^header insert $xh <${xh}2@exam.ple>";\
3637 read es; echo $es; call xerr "$es" "ins_ref $xh 1-2"
3638 echo "~^header insert $xh ${xh}3@exam.ple";\
3639 read es; echo $es; call xerr "$es" "ins_ref $xh 1-3"
3640 else
3641 echo "~^header insert $xh <${xh}2@exam.ple>"; read es;\
3642 vput vexpr es substr $es 0 3
3643 if [ $es != 506 ]
3644 xcall bail "ins_ref $xh 1-4"
3648 echo "~^header list $xh"; read hl; echo $hl;\
3649 call xerr "$hl" "ins_ref $xh 1-5"
3650 echo "~^header show $xh"; read es; call xerr $es "ins_ref $xh 1-6"
3651 call read_mline_res
3653 if [ "$t_remove" == "" ]
3654 return
3657 echo "~^header remove $xh"; read es;\
3658 call xerr $es "ins_ref $xh 2-1"
3659 echo "~^header remove $xh"; read es;\
3660 vput vexpr es substr $es 0 3
3661 if [ $es != 501 ]
3662 xcall bail "ins_ref $xh 2-2"
3664 echo "~^header list $xh"; read es;\
3665 vput vexpr es substr $es 0 3
3666 if [ $es != 501 ]
3667 xcall bail "$es ins_ref $xh 2-3"
3669 echo "~^header show $xh"; read es;\
3670 vput vexpr es substr $es 0 3
3671 if [ $es != 501 ]
3672 xcall bail "ins_ref $xh 2-4"
3676 echo "~^header insert $xh <$xh@exam.ple>";\
3677 read es; echo $es; call xerr "$es" "ins_ref $xh 3-1"
3678 if [ $mult -ne 0 ]
3679 echo "~^header insert $xh <${xh}2@exam.ple>";\
3680 read es; echo $es; call xerr "$es" "ins_ref $xh 3-2"
3681 echo "~^header insert $xh ${xh}3@exam.ple";\
3682 read es; echo $es; call xerr "$es" "ins_ref $xh 3-3"
3684 echo "~^header list $xh";\
3685 read hl; echo $hl; call xerr "$hl" "ins_ref $xh 3-4"
3686 echo "~^header show $xh";\
3687 read es; call xerr $es "ins_ref $xh 3-5"
3688 call read_mline_res
3690 echo "~^header remove-at $xh 1"; read es;\
3691 call xerr $es "ins_ref $xh 3-6"
3692 if [ $mult -ne 0 ] && [ $xh != subject ]
3693 echo "~^header remove-at $xh 1"; read es;\
3694 call xerr $es "ins_ref $xh 3-7"
3695 echo "~^header remove-at $xh 1"; read es;\
3696 call xerr $es "ins_ref $xh 3-8"
3698 echo "~^header remove-at $xh 1"; read es;\
3699 vput vexpr es substr $es 0 3
3700 if [ $es != 501 ]
3701 xcall bail "ins_ref $xh 3-9"
3703 echo "~^header remove-at $xh T"; read es;\
3704 vput vexpr es substr $es 0 3
3705 if [ $es != 505 ]
3706 xcall bail "ins_ref $xh 3-10"
3708 echo "~^header show $xh"; read es;\
3709 vput vexpr es substr $es 0 3
3710 if [ $es != 501 ]
3711 xcall bail "ins_ref $xh 3-11"
3715 echo "~^header insert $xh <$xh@exam.ple> ";\
3716 read es; echo $es; call xerr "$es" "ins_ref $xh 4-1"
3717 if [ $mult -ne 0 ]
3718 echo "~^header insert $xh <${xh}2@exam.ple> ";\
3719 read es; echo $es; call xerr "$es" "ins_ref $xh 4-2"
3720 echo "~^header insert $xh ${xh}3@exam.ple";\
3721 read es; echo $es; call xerr "$es" "ins_ref $xh 4-3"
3723 echo "~^header list $xh"; read hl; echo $hl;\
3724 call xerr "$hl" "ins_ref $xh 4-4"
3725 echo "~^header show $xh"; read es; call xerr $es "ins_ref $xh 4-5"
3726 call read_mline_res
3728 if [ $mult -ne 0 ] && [ $xh != subject ]
3729 echo "~^header remove-at $xh 3"; read es;\
3730 call xerr $es "ins_ref $xh 4-6"
3731 echo "~^header remove-at $xh 2"; read es;\
3732 call xerr $es "ins_ref $xh 4-7"
3734 echo "~^header remove-at $xh 1"; read es;\
3735 call xerr $es "ins_ref $xh 4-8"
3736 echo "~^header remove-at $xh 1"; read es;\
3737 vput vexpr es substr $es 0 3
3738 if [ $es != 501 ]
3739 xcall bail "ins_ref $xh 4-9"
3741 echo "~^header remove-at $xh T"; read es;\
3742 vput vexpr es substr $es 0 3
3743 if [ $es != 505 ]
3744 xcall bail "ins_ref $xh 4-10"
3746 echo "~^header show $xh"; read es;\
3747 vput vexpr es substr $es 0 3
3748 if [ $es != 501 ]
3749 xcall bail "ins_ref $xh 4-11"
3752 define t_header {
3753 echo t_header ENTER
3754 # In collect.c order
3755 call ins_addr from
3756 call ins_ref sender 0 # Not a "ref", but works
3757 call ins_addr To
3758 call ins_addr cC
3759 call ins_addr bCc
3760 call ins_addr reply-To
3761 call ins_addr mail-Followup-to
3762 call ins_ref messAge-id 0
3763 call ins_ref rEfErEncEs 1
3764 call ins_ref in-Reply-to 1
3765 call ins_ref subject 1 # Not a "ref", but works (with tweaks)
3766 call ins_addr freeForm1
3767 call ins_addr freeform2
3769 echo "~^header show MAILX-Command"; read es; call xerr $es "t_header 1000"
3770 call read_mline_res
3771 echo "~^header show MAILX-raw-TO"; read es; call xerr $es "t_header 1001"
3772 call read_mline_res
3774 echo t_header LEAVE
3776 define t_attach {
3777 echo t_attach ENTER
3779 echo "~^attachment";\
3780 read hl; echo $hl; vput vexpr es substr "$hl" 0 3
3781 if [ "$es" != 501 ]
3782 xcall bail "attach 0-1"
3785 echo "~^attach attribute ./.treadctl";\
3786 read hl; echo $hl; vput vexpr es substr "$hl" 0 3
3787 if [ "$es" != 501 ]
3788 xcall bail "attach 0-2"
3790 echo "~^attachment attribute-at 1";\
3791 read hl; echo $hl; vput vexpr es substr "$hl" 0 3
3792 if [ "$es" != 501 ]
3793 xcall bail "attach 0-3"
3796 echo "~^attachment insert ./.treadctl=ascii";\
3797 read hl; echo $hl; call xerr "$hl" "attach 1-1"
3798 echo "~^attachment list";\
3799 read es; echo $es;call xerr "$es" "attach 1-2"
3800 call read_mline_res
3801 echo "~^attachment attribute ./.treadctl";\
3802 read es; echo $es;call xerr "$es" "attach 1-3"
3803 call read_mline_res
3804 echo "~^attachment attribute .treadctl";\
3805 read es; echo $es;call xerr "$es" "attach 1-4"
3806 call read_mline_res
3807 echo "~^attachment attribute-at 1";\
3808 read es; echo $es;call xerr "$es" "attach 1-5"
3809 call read_mline_res
3811 echo "~^attachment attribute-set ./.treadctl filename rctl";\
3812 read es; echo $es;call xerr "$es" "attach 1-6"
3813 echo "~^attachment attribute-set .treadctl content-description Au";\
3814 read es; echo $es;call xerr "$es" "attach 1-7"
3815 echo "~^attachment attribute-set-at 1 content-id <10.du@ich>";\
3816 read es; echo $es;call xerr "$es" "attach 1-8"
3818 echo "~^attachment attribute ./.treadctl";\
3819 read es; echo $es;call xerr "$es" "attach 1-9"
3820 call read_mline_res
3821 echo "~^attachment attribute .treadctl";\
3822 read es; echo $es;call xerr "$es" "attach 1-10"
3823 call read_mline_res
3824 echo "~^attachment attribute rctl";\
3825 read es; echo $es;call xerr "$es" "attach 1-11"
3826 call read_mline_res
3827 echo "~^attachment attribute-at 1";\
3828 read es; echo $es;call xerr "$es" "attach 1-12"
3829 call read_mline_res
3832 echo "~^attachment insert ./.tattach=latin1";\
3833 read hl; echo $hl; call xerr "$hl" "attach 2-1"
3834 echo "~^attachment list";\
3835 read es; echo $es;call xerr "$es" "attach 2-2"
3836 call read_mline_res
3837 echo "~^attachment attribute ./.tattach";\
3838 read es; echo $es;call xerr "$es" "attach 2-3"
3839 call read_mline_res
3840 echo "~^attachment attribute .tattach";\
3841 read es; echo $es;call xerr "$es" "attach 2-4"
3842 call read_mline_res
3843 echo "~^attachment attribute-at 2";\
3844 read es; echo $es;call xerr "$es" "attach 2-5"
3845 call read_mline_res
3847 echo "~^attachment attribute-set ./.tattach filename tat";\
3848 read es; echo $es;call xerr "$es" "attach 2-6"
3849 echo \
3850 "~^attachment attribute-set .tattach content-description Au2";\
3851 read es; echo $es;call xerr "$es" "attach 2-7"
3852 echo "~^attachment attribute-set-at 2 content-id <20.du@wir>";\
3853 read es; echo $es;call xerr "$es" "attach 2-8"
3854 echo \
3855 "~^attachment attribute-set-at 2 content-type application/x-sh";\
3856 read es; echo $es;call xerr "$es" "attach 2-9"
3858 echo "~^attachment attribute ./.tattach";\
3859 read es; echo $es;call xerr "$es" "attach 2-10"
3860 call read_mline_res
3861 echo "~^attachment attribute .tattach";\
3862 read es; echo $es;call xerr "$es" "attach 2-11"
3863 call read_mline_res
3864 echo "~^attachment attribute tat";\
3865 read es; echo $es;call xerr "$es" "attach 2-12"
3866 call read_mline_res
3867 echo "~^attachment attribute-at 2";\
3868 read es; echo $es;call xerr "$es" "attach 2-13"
3869 call read_mline_res
3872 if [ "$t_remove" == "" ]
3873 return
3876 echo "~^attachment remove ./.treadctl"; read es;\
3877 call xerr $es "attach 3-1"
3878 echo "~^attachment remove ./.tattach"; read es;\
3879 call xerr $es "attach 3-2"
3880 echo "~^ attachment remove ./.treadctl"; read es;\
3881 vput vexpr es substr $es 0 3
3882 if [ $es != 501 ]
3883 xcall bail "attach 3-3"
3885 echo "~^ attachment remove ./.tattach"; read es;\
3886 vput vexpr es substr $es 0 3
3887 if [ $es != 501 ]
3888 xcall bail "attach 3-4"
3890 echo "~^attachment list"; read es;\
3891 vput vexpr es substr $es 0 3
3892 if [ $es != 501 ]
3893 xcall bail "attach 3-5"
3897 echo "~^attachment insert ./.tattach=latin1";\
3898 read hl; echo $hl; call xerr "$hl" "attach 4-1"
3899 echo "~^attachment insert ./.tattach=latin1";\
3900 read hl; echo $hl; call xerr "$hl" "attach 4-2"
3901 echo "~^attachment list";\
3902 read es; echo $es;call xerr "$es" "attach 4-3"
3903 call read_mline_res
3904 echo "~^ attachment remove .tattach"; read es;\
3905 vput vexpr es substr $es 0 3
3906 if [ $es != 506 ]
3907 xcall bail "attach 4-4 $es"
3909 echo "~^attachment remove-at T"; read es;\
3910 vput vexpr es substr $es 0 3
3911 if [ $es != 505 ]
3912 xcall bail "attach 4-5"
3914 echo "~^attachment remove ./.tattach"; read es;\
3915 call xerr $es "attach 4-6"
3916 echo "~^attachment remove ./.tattach"; read es;\
3917 call xerr $es "attach 4-7"
3918 echo "~^ attachment remove ./.tattach"; read es;\
3919 vput vexpr es substr $es 0 3
3920 if [ $es != 501 ]
3921 xcall bail "attach 4-8 $es"
3923 echo "~^attachment list"; read es;\
3924 vput vexpr es substr $es 0 3
3925 if [ $es != 501 ]
3926 xcall bail "attach 4-9"
3930 echo "~^attachment insert ./.tattach=latin1";\
3931 read hl; echo $hl; call xerr "$hl" "attach 5-1"
3932 echo "~^attachment insert ./.tattach=latin1";\
3933 read hl; echo $hl; call xerr "$hl" "attach 5-2"
3934 echo "~^attachment insert ./.tattach=latin1";\
3935 read hl; echo $hl; call xerr "$hl" "attach 5-3"
3936 echo "~^attachment list";\
3937 read es; echo $es;call xerr "$es" "attach 5-4"
3938 call read_mline_res
3940 echo "~^attachment remove-at 3"; read es;\
3941 call xerr $es "attach 5-5"
3942 echo "~^attachment remove-at 3"; read es;\
3943 vput vexpr es substr $es 0 3
3944 if [ $es != 501 ]
3945 xcall bail "attach 5-6"
3947 echo "~^attachment remove-at 2"; read es;\
3948 call xerr $es "attach 5-7"
3949 echo "~^attachment remove-at 2"; read es;\
3950 vput vexpr es substr $es 0 3
3951 if [ $es != 501 ]
3952 xcall bail "attach 5-8"
3954 echo "~^attachment remove-at 1"; read es;\
3955 call xerr $es "attach 5-9"
3956 echo "~^attachment remove-at 1"; read es;\
3957 vput vexpr es substr $es 0 3
3958 if [ $es != 501 ]
3959 xcall bail "attach 5-10"
3962 echo "~^attachment list"; read es;\
3963 vput vexpr es substr $es 0 3
3964 if [ $es != 501 ]
3965 xcall bail "attach 5-11"
3969 echo "~^attachment insert ./.tattach=latin1";\
3970 read hl; echo $hl; call xerr "$hl" "attach 6-1"
3971 echo "~^attachment insert ./.tattach=latin1";\
3972 read hl; echo $hl; call xerr "$hl" "attach 6-2"
3973 echo "~^attachment insert ./.tattach=latin1";\
3974 read hl; echo $hl; call xerr "$hl" "attach 6-3"
3975 echo "~^attachment list";\
3976 read es; echo $es;call xerr "$es" "attach 6-4"
3977 call read_mline_res
3979 echo "~^attachment remove-at 1"; read es;\
3980 call xerr $es "attach 6-5"
3981 echo "~^attachment remove-at 1"; read es;\
3982 call xerr $es "attach 6-6"
3983 echo "~^attachment remove-at 1"; read es;\
3984 call xerr $es "attach 6-7"
3985 echo "~^attachment remove-at 1"; read es;\
3986 vput vexpr es substr $es 0 3
3987 if [ $es != 501 ]
3988 xcall bail "attach 6-8"
3991 echo "~^attachment list"; read es;\
3992 vput vexpr es substr $es 0 3
3993 if [ $es != 501 ]
3994 xcall bail "attach 6-9"
3997 echo t_attach LEAVE
3999 define t_ocs {
4000 read ver
4001 echo t_ocs
4002 call t_header
4003 call t_attach
4005 define t_oce {
4006 echo on-compose-enter, mailx-command<$mailx-command>
4007 alternates alter1@exam.ple alter2@exam.ple
4008 alternates
4009 set autocc='alter1@exam.ple alter2@exam.ple'
4010 echo mailx-from<$mailx-from> mailx-sender<$mailx-sender>
4011 echo mailx-subject<$mailx-subject>
4012 echo mailx-to<$mailx-to> mailx-cc<$mailx-cc> mailx-bcc<$mailx-bcc>
4013 echo mailx-raw-to<$mailx-raw-to> mailx-raw-cc<$mailx-raw-cc> \
4014 mailx-raw-bcc<$mailx-raw-bcc>
4015 echo mailx-orig-from<$mailx-orig-from> mailx-orig-to<$mailx-orig-to> \
4016 mailx-orig-cc<$mailx-orig-cc> mailx-orig-bcc<$mailx-orig-bcc>
4018 define t_ocl {
4019 echo on-compose-leave, mailx-command<$mailx-command>
4020 vput alternates al
4021 eval alternates $al alter3@exam.ple alter4@exam.ple
4022 alternates
4023 set autobcc='alter3@exam.ple alter4@exam.ple'
4024 echo mailx-from<$mailx-from> mailx-sender<$mailx-sender>
4025 echo mailx-subject<$mailx-subject>
4026 echo mailx-to<$mailx-to> mailx-cc<$mailx-cc> mailx-bcc<$mailx-bcc>
4027 echo mailx-raw-to<$mailx-raw-to> mailx-raw-cc<$mailx-raw-cc> \
4028 mailx-raw-bcc<$mailx-raw-bcc>
4029 echo mailx-orig-from<$mailx-orig-from> mailx-orig-to<$mailx-orig-to> \
4030 mailx-orig-cc<$mailx-orig-cc> mailx-orig-bcc<$mailx-orig-bcc>
4032 define t_occ {
4033 echo on-compose-cleanup, mailx-command<$mailx-command>
4034 unalternates *
4035 alternates
4036 echo mailx-from<$mailx-from> mailx-sender<$mailx-sender>
4037 echo mailx-subject<$mailx-subject>
4038 echo mailx-to<$mailx-to> mailx-cc<$mailx-cc> mailx-bcc<$mailx-bcc>
4039 echo mailx-raw-to<$mailx-raw-to> mailx-raw-cc<$mailx-raw-cc> \
4040 mailx-raw-bcc<$mailx-raw-bcc>
4041 echo mailx-orig-from<$mailx-orig-from> mailx-orig-to<$mailx-orig-to> \
4042 mailx-orig-cc<$mailx-orig-cc> mailx-orig-bcc<$mailx-orig-bcc>
4044 wysh set on-compose-splice=t_ocs \
4045 on-compose-enter=t_oce on-compose-leave=t_ocl \
4046 on-compose-cleanup=t_occ
4047 __EOT__
4049 printf 'm this-goes@nowhere\nbody\n!.\n' |
4050 ${MAILX} ${ARGS} -Snomemdebug -Sescape=! -Sstealthmua=noagent \
4051 -X'source ./.trc' -Smta=./.tmta.sh \
4052 >./.tall 2>&1
4053 ${cat} ./.tall >> "${MBOX}"
4054 check 1 0 "${MBOX}" '2481823179 10101'
4056 ${rm} "${MBOX}"
4057 printf 'm this-goes@nowhere\nbody\n!.\n' |
4058 ${MAILX} ${ARGS} -Snomemdebug -Sescape=! -Sstealthmua=noagent \
4059 -St_remove=1 -X'source ./.trc' -Smta=./.tmta.sh \
4060 >./.tall 2>&1
4061 ${cat} ./.tall >> "${MBOX}"
4062 check 2 0 "${MBOX}" '3654000499 12535'
4066 # Some state machine stress, shell compose hook, localopts for hook, etc.
4067 # readctl in child. ~r as HERE document
4068 ${rm} "${MBOX}"
4069 printf 'm ex@am.ple\nbody\n!.
4070 echon ${mailx-command}${mailx-subject}
4071 echon ${mailx-from}${mailx-sender}
4072 echon ${mailx-to}${mailx-cc}${mailx-bcc}
4073 echon ${mailx-raw-to}${mailx-raw-cc}${mailx-raw-bcc}
4074 echon ${mailx-orig-from}${mailx-orig-to}${mailx-orig-gcc}${mailx-orig-bcc}
4075 var t_oce t_ocs t_ocs_sh t_ocl t_occ autocc
4076 ' | ${MAILX} ${ARGS} -Snomemdebug -Sescape=! \
4077 -Smta=./.tmta.sh \
4079 define bail {
4080 echoerr "Failed: $1. Bailing out"; echo "~x"; xit
4082 define xerr {
4083 vput vexpr es substr "$1" 0 1
4084 if [ "$es" != 2 ]
4085 xcall bail "$2"
4088 define read_mline_res {
4089 read hl; wysh set len=$? es=$! en=$^ERRNAME;\
4090 echo $len/$es/$^ERRNAME: $hl
4091 if [ $es -ne $^ERR-NONE ]
4092 xcall bail read_mline_res
4093 elif [ $len -ne 0 ]
4094 \xcall read_mline_res
4097 define _work {
4098 vput vexpr i + 1 "$2"
4099 if [ $i -lt 111 ]
4100 vput vexpr j % $i 10
4101 if [ $j -ne 0 ]
4102 set j=xcall
4103 else
4104 echon "$i.. "
4105 set j=call
4107 eval \\$j _work $1 $i
4108 return $?
4110 vput vexpr i + $i "$1"
4111 return $i
4113 define _read {
4114 wysh set line; read line;wysh set es=$? en=$^ERRNAME ;\
4115 echo read:$es/$en: $line
4116 if [ "${es}" -ne -1 ]
4117 xcall _read
4119 readctl remove $cwd/.treadctl; echo readctl remove:$?/$^ERRNAME
4121 define t_ocs {
4122 read ver
4123 echo t_ocs
4124 echo "~^header list"; read hl; echo $hl;\
4125 vput vexpr es substr "$hl" 0 1
4126 if [ "$es" != 2 ]
4127 xcall bail "header list"
4128 endif
4130 call _work 1; echo $?
4131 echo "~^header insert cc splicy diet <splice@exam.ple> spliced";\
4132 read es; echo $es; vput vexpr es substr "$es" 0 1
4133 if [ "$es" != 2 ]
4134 xcall bail "be diet"
4135 endif
4136 echo "~^header insert cc <splice2@exam.ple>";\
4137 read es; echo $es; vput vexpr es substr "$es" 0 1
4138 if [ "$es" != 2 ]
4139 xcall bail "be diet2"
4140 endif
4142 call _work 2; echo $?
4143 echo "~^header insert bcc juicy juice <juice@exam.ple> spliced";\
4144 read es; echo $es;vput vexpr es substr "$es" 0 1
4145 if [ "$es" != 2 ]
4146 xcall bail "be juicy"
4147 endif
4148 echo "~^header insert bcc juice2@exam.ple";\
4149 read es; echo $es;vput vexpr es substr "$es" 0 1
4150 if [ "$es" != 2 ]
4151 xcall bail "be juicy2"
4152 endif
4153 echo "~^header insert bcc juice3 <juice3@exam.ple>";\
4154 read es; echo $es;vput vexpr es substr "$es" 0 1
4155 if [ "$es" != 2 ]
4156 xcall bail "be juicy3"
4157 endif
4158 echo "~^header insert bcc juice4@exam.ple";\
4159 read es; echo $es;vput vexpr es substr "$es" 0 1
4160 if [ "$es" != 2 ]
4161 xcall bail "be juicy4"
4162 endif
4164 echo "~^header remove-at bcc 3";\
4165 read es; echo $es;vput vexpr es substr "$es" 0 1
4166 if [ "$es" != 2 ]
4167 xcall bail "remove juicy5"
4168 endif
4169 echo "~^header remove-at bcc 2";\
4170 read es; echo $es;vput vexpr es substr "$es" 0 1
4171 if [ "$es" != 2 ]
4172 xcall bail "remove juicy6"
4173 endif
4174 echo "~^header remove-at bcc 3";\
4175 read es; echo $es;vput vexpr es substr "$es" 0 3
4176 if [ "$es" != 501 ]
4177 xcall bail "failed to remove-at"
4178 endif
4179 # Add duplicates which ought to be removed!
4180 echo "~^header insert bcc juice4@exam.ple";\
4181 read es; echo $es;vput vexpr es substr "$es" 0 1
4182 if [ "$es" != 2 ]
4183 xcall bail "be juicy4-1"
4184 endif
4185 echo "~^header insert bcc juice4@exam.ple";\
4186 read es; echo $es;vput vexpr es substr "$es" 0 1
4187 if [ "$es" != 2 ]
4188 xcall bail "be juicy4-2"
4189 endif
4190 echo "~^header insert bcc juice4@exam.ple";\
4191 read es; echo $es;vput vexpr es substr "$es" 0 1
4192 if [ "$es" != 2 ]
4193 xcall bail "be juicy4-3"
4194 endif
4195 echo "~:set t_ocs"
4198 call _work 3; echo $?
4199 echo "~r - '__EOT'"
4200 vput ! i echo just knock if you can hear me;\
4201 i=0;\
4202 while [ $i -lt 24 ]; do printf "%s " $i; i=`expr $i + 1`; done;\
4203 echo relax
4204 echon shell-cmd says $?/$^ERRNAME: $i
4205 echo "~x will not become interpreted, we are reading until __EOT"
4206 echo "__EOT"
4207 read r_status; echo "~~r status output: $r_status"
4208 echo "~:echo $? $! $^ERRNAME"
4209 read r_status
4210 echo "~~r status from parent: $r_status"
4213 call _work 4; echo $?
4214 vput cwd cwd;echo cwd:$?
4215 readctl create $cwd/.treadctl ;echo readctl:$?/$^ERRNAME;\
4216 call _read
4219 call _work 5; echo $?
4220 echo "~^header show MAILX-Command"; read es;\
4221 call xerr $es "t_header 1000"; call read_mline_res
4222 echo "~^header show MAILX-raw-TO"; read es;\
4223 call xerr $es "t_header 1001"; xcall read_mline_res
4225 echoerr IT IS WRONG IF YOU SEE THIS
4227 define t_oce {
4228 echo on-compose-enter, mailx-command<$mailx-command>
4229 set t_oce autobcc=oce@exam.ple
4230 alternates alter1@exam.ple alter2@exam.ple
4231 alternates
4232 echo mailx-from<$mailx-from> mailx-sender<$mailx-sender>
4233 echo mailx-subject<$mailx-subject>
4234 echo mailx-to<$mailx-to> mailx-cc<$mailx-cc> mailx-bcc<$mailx-bcc>
4235 echo mailx-raw-to<$mailx-raw-to> mailx-raw-cc<$mailx-raw-cc> \
4236 mailx-raw-bcc<$mailx-raw-bcc>
4237 echo mailx-orig-from<$mailx-orig-from> \
4238 mailx-orig-to<$mailx-orig-to> \
4239 mailx-orig-cc<$mailx-orig-cc> mailx-orig-bcc<$mailx-orig-bcc>
4241 define t_ocl {
4242 echo on-compose-leave, mailx-command<$mailx-command>
4243 set t_ocl autocc=ocl@exam.ple
4244 unalternates *
4245 alternates alter3@exam.ple alter4@exam.ple
4246 alternates
4247 echo mailx-from<$mailx-from> mailx-sender<$mailx-sender>
4248 echo mailx-subject<$mailx-subject>
4249 echo mailx-to<$mailx-to> mailx-cc<$mailx-cc> mailx-bcc<$mailx-bcc>
4250 echo mailx-raw-to<$mailx-raw-to> mailx-raw-cc<$mailx-raw-cc> \
4251 mailx-raw-bcc<$mailx-raw-bcc>
4252 echo mailx-orig-from<$mailx-orig-from> \
4253 mailx-orig-to<$mailx-orig-to> \
4254 mailx-orig-cc<$mailx-orig-cc> mailx-orig-bcc<$mailx-orig-bcc>
4256 define t_occ {
4257 echo on-compose-cleanup, mailx-command<$mailx-command>
4258 set t_occ autocc=occ@exam.ple
4259 unalternates *
4260 alternates
4261 echo mailx-from<$mailx-from> mailx-sender<$mailx-sender>
4262 echo mailx-subject<$mailx-subject>
4263 echo mailx-to<$mailx-to> mailx-cc<$mailx-cc> mailx-bcc<$mailx-bcc>
4264 echo mailx-raw-to<$mailx-raw-to> mailx-raw-cc<$mailx-raw-cc> \
4265 mailx-raw-bcc<$mailx-raw-bcc>
4266 echo mailx-orig-from<$mailx-orig-from> \
4267 mailx-orig-to<$mailx-orig-to> \
4268 mailx-orig-cc<$mailx-orig-cc> mailx-orig-bcc<$mailx-orig-bcc>
4270 wysh set on-compose-splice=t_ocs \
4271 on-compose-splice-shell="read ver;echo t_ocs-shell;\
4272 echo \"~t shell@exam.ple\"; echo \"~:set t_ocs_sh\"" \
4273 on-compose-enter=t_oce on-compose-leave=t_ocl \
4274 on-compose-cleanup=t_occ
4275 ' > ./.tnotes 2>&1
4276 check_ex0 3-estat
4277 ${cat} ./.tnotes >> "${MBOX}"
4278 check 3 - "${MBOX}" '679526364 2431'
4280 # Reply, forward, resend, Resend
4282 ${rm} "${MBOX}"
4283 printf '#
4284 set from="f1@z
4285 m t1@z
4288 set from="du <f2@z>" stealthmua=noagent
4289 m t2@z
4292 ' | ${MAILX} ${ARGS} -Smta=./.tmta.sh -Snomemdebug -Sescape=!
4294 printf '
4295 echo start: $? $! $^ERRNAME
4296 File %s
4297 echo File: $? $! $^ERRNAME;echo;echo
4298 reply 1
4299 this is content of reply 1
4301 echo reply 1: $? $! $^ERRNAME;echo;echo
4302 Reply 1 2
4303 this is content of Reply 1 2
4305 echo Reply 1 2: $? $! $^ERRNAME;echo;echo
4306 forward 1 fwdex@am.ple
4307 this is content of forward 1
4309 echo forward 1: $? $! $^ERRNAME;echo;echo
4310 wysh set forward-inject-head=$'"'"'-- \\
4311 forward (%%a)(%%d)(%%f)(%%i)(%%n)(%%r) --\\n'"'"'
4312 wysh set forward-inject-tail=$'"'"'-- \\
4313 end of forward (%%i) --\\n'"'"'
4314 forward 2 fwdex@am.ple
4315 this is content of forward 2
4317 echo forward 2: $? $! $^ERRNAME;echo;echo
4318 set showname
4319 forward 2 fwdex2@am.ple
4320 this is content of forward 2, 2nd, with showname set
4322 echo forward 2, 2nd: $? $! $^ERRNAME;echo;echo
4323 resend 1 2 resendex@am.ple
4324 echo resend 1 2: $? $! $^ERRNAME;echo;echo
4325 Resend 1 2 Resendex@am.ple
4326 echo Resend 1 2: $? $! $^ERRNAME;echo;echo
4327 ' "${MBOX}" |
4328 ${MAILX} ${ARGS} -Snomemdebug -Sescape=! -Sfullnames \
4329 -Smta=./.tmta.sh \
4331 define bail {
4332 echoerr "Failed: $1. Bailing out"; echo "~x"; xit
4334 define xerr {
4335 vput vexpr es substr "$1" 0 1
4336 if [ "$es" != 2 ]
4337 xcall bail "$2"
4340 define read_mline_res {
4341 read hl; wysh set len=$? es=$! en=$^ERRNAME;\
4342 echo mline_res:$len/$es/$^ERRNAME: $hl
4343 if [ $es -ne $^ERR-NONE ]
4344 xcall bail read_mline_res
4345 elif [ $len -ne 0 ]
4346 \xcall read_mline_res
4349 define work_hl {
4350 echo "~^header show $1"; read es;\
4351 call xerr $es "work_hl $1"; echo $1; call read_mline_res
4352 if [ $# -gt 1 ]
4353 shift
4354 xcall work_hl "$@"
4357 define t_ocs {
4358 read ver
4359 echo t_ocs version $ver
4360 echo "~^header list"; read hl; echo $hl;\
4361 echoerr the header list is $hl;\
4362 call xerr "$hl" "header list"
4363 eval vpospar set $hl
4364 shift
4365 xcall work_hl "$@"
4366 echoerr IT IS WRONG IF YOU SEE THIS
4368 define t_oce {
4369 echo on-XY-enter, mailx-command<$mailx-command>
4370 set t_oce autobcc=oce@exam.ple
4371 echo mailx-from<$mailx-from> mailx-sender<$mailx-sender>
4372 echo mailx-subject<$mailx-subject>
4373 echo mailx-to<$mailx-to> mailx-cc<$mailx-cc> mailx-bcc<$mailx-bcc>
4374 echo mailx-raw-to<$mailx-raw-to> mailx-raw-cc<$mailx-raw-cc> \
4375 mailx-raw-bcc<$mailx-raw-bcc>
4376 echo mailx-orig-from<$mailx-orig-from> \
4377 mailx-orig-to<$mailx-orig-to> \
4378 mailx-orig-cc<$mailx-orig-cc> mailx-orig-bcc<$mailx-orig-bcc>
4380 define t_ocl {
4381 echo on-XY-leave, mailx-command<$mailx-command>
4382 set t_ocl autocc=ocl@exam.ple
4383 echo mailx-from<$mailx-from> mailx-sender<$mailx-sender>
4384 echo mailx-subject<$mailx-subject>
4385 echo mailx-to<$mailx-to> mailx-cc<$mailx-cc> mailx-bcc<$mailx-bcc>
4386 echo mailx-raw-to<$mailx-raw-to> mailx-raw-cc<$mailx-raw-cc> \
4387 mailx-raw-bcc<$mailx-raw-bcc>
4388 echo mailx-orig-from<$mailx-orig-from> \
4389 mailx-orig-to<$mailx-orig-to> \
4390 mailx-orig-cc<$mailx-orig-cc> mailx-orig-bcc<$mailx-orig-bcc>
4392 define t_occ {
4393 echo on-XY-cleanup, mailx-command<$mailx-command>
4394 set t_occ autocc=occ@exam.ple
4395 echo mailx-from<$mailx-from> mailx-sender<$mailx-sender>
4396 echo mailx-subject<$mailx-subject>
4397 echo mailx-to<$mailx-to> mailx-cc<$mailx-cc> mailx-bcc<$mailx-bcc>
4398 echo mailx-raw-to<$mailx-raw-to> mailx-raw-cc<$mailx-raw-cc> \
4399 mailx-raw-bcc<$mailx-raw-bcc>
4400 echo mailx-orig-from<$mailx-orig-from> \
4401 mailx-orig-to<$mailx-orig-to> \
4402 mailx-orig-cc<$mailx-orig-cc> mailx-orig-bcc<$mailx-orig-bcc>
4404 wysh set on-compose-splice=t_ocs \
4405 on-compose-enter=t_oce on-compose-leave=t_ocl \
4406 on-compose-cleanup=t_occ \
4407 on-resend-enter=t_oce on-resend-cleanup=t_occ
4408 ' > ./.tnotes 2>&1
4409 check_ex0 4-estat
4410 ${cat} ./.tnotes >> "${MBOX}"
4411 check 4 - "${MBOX}" '2151712038 11184'
4413 t_epilog
4416 t_C_opt_customhdr() {
4417 t_prolog C_opt_customhdr
4418 TRAP_EXIT_ADDONS="./.t*"
4420 t_xmta 'CimicifugaRacemosa Mon Dec 25 21:33:40 2017'
4422 echo bla |
4423 ${MAILX} ${ARGS} -Smta=./.tmta.sh \
4424 -C 'C-One : Custom One Body' \
4425 -C 'C-Two:CustomTwoBody' \
4426 -S customhdr='chdr1: chdr1 body, chdr2:chdr2 body' \
4427 this-goes@nowhere >./.tall 2>&1
4428 check_ex0 1-estat
4429 ${cat} ./.tall >> "${MBOX}"
4430 check 1 0 "${MBOX}" '2400078426 195'
4432 ${rm} "${MBOX}"
4433 printf 'm this-goes@nowhere\nbody\n!.
4434 unset customhdr
4435 m this-goes2@nowhere\nbody2\n!.
4436 set customhdr=%ccustom1 : custom1 body%c
4437 m this-goes2@nowhere\nbody2\n!.
4438 set customhdr=%ccustom1 : custom1\\, body , custom2: custom2 body%c
4439 m this-goes3@nowhere\nbody3\n!.
4440 ' "'" "'" "'" "'" |
4441 ${MAILX} ${ARGS} -Smta=./.tmta.sh -Sescape=! \
4442 -C 'C-One : Custom One Body' \
4443 -C 'C-Two:CustomTwoBody' \
4444 -S customhdr='chdr1: chdr1 body, chdr2:chdr2 body' \
4445 >./.tall 2>&1
4446 check_ex0 2-estat
4447 ${cat} ./.tall >> "${MBOX}"
4448 check 2 0 "${MBOX}" '3546878678 752'
4450 t_epilog
4453 t_quote_a_cmd_escapes() {
4454 t_prolog quote_a_cmd_escapes
4455 TRAP_EXIT_ADDONS="./.t*"
4457 t_xmta
4459 echo 'included file' > ./.ttxt
4461 ${cat} <<-_EOT > ./.tmbox
4462 From neverneverland Sun Jul 23 13:46:25 2017
4463 Subject: Bugstop: five miles out 1
4464 Reply-To: mister originator1 <mr1@originator>
4465 From: mister originator1 <mr1@originator>
4466 To: bugstop-commit@five.miles.out
4467 Cc: is1@a.list
4468 In-reply-to: <20170719111113.bkcMz%laber1@backe.eu>
4469 Date: Wed, 19 Jul 2017 09:22:57 -0400
4470 Message-Id: <20170719132257.766AF781267-1@originator>
4471 Status: RO
4473 That's appalling, I.
4475 From neverneverland Sun Jul 23 13:47:25 2017
4476 Subject: Bugstop: five miles out 2
4477 Reply-To: mister originator2 <mr2@originator>
4478 From: mister originator2 <mr2@originator>
4479 To: bugstop-commit@five.miles.out
4480 Cc: is2@a.list
4481 In-reply-to: <20170719111113.bkcMz%laber2@backe.eu>
4482 Date: Wed, 19 Jul 2017 09:23:57 -0400
4483 Message-Id: <20170719132257.766AF781267-2@originator>
4484 Status: RO
4486 That's appalling, II.
4488 From neverneverland Sun Jul 23 13:48:25 2017
4489 Subject: Bugstop: five miles out 3
4490 Reply-To: mister originator3 <mr3@originator>
4491 From: mister originator3 <mr3@originator>
4492 To: bugstop-commit@five.miles.out
4493 Cc: is3@a.list
4494 In-reply-to: <20170719111113.bkcMz%laber3@backe.eu>
4495 Date: Wed, 19 Jul 2017 09:24:57 -0400
4496 Message-Id: <20170719132257.766AF781267-3@originator>
4497 Status: RO
4499 That's appalling, III.
4501 _EOT
4503 printf '#
4504 set indentprefix=" |"
4505 set quote
4506 reply 2
4508 set quote=noheading
4509 reply 2
4511 headerpick type retain cc date from message-id reply-to subject to
4512 set quote=headers
4513 reply 2
4515 set quote=allheaders
4516 reply 2
4518 ' | ${MAILX} ${ARGS} -Smta=./.tmta.sh -Rf \
4519 -Sescape=! -Sindentprefix=' >' \
4520 ./.tmbox >./.tall 2>&1
4521 check_ex0 1-estat
4522 ${cat} ./.tall >> "${MBOX}"
4523 check 1 0 "${MBOX}" '2181726970 2023'
4525 # ~@ is tested with other attachment stuff, ~^ is in compose_hooks
4526 ${rm} "${MBOX}"
4527 printf '#
4528 set Sign=SignVar sign=signvar DEAD=./.ttxt
4529 headerpick type retain Subject
4530 reply 2
4531 !!1 Not escaped. And shell test last, right before !..
4532 !: echo 2 only echoed via colon
4533 !_ echo 3 only echoed via underscore
4534 !< ./.ttxt
4535 !<! echo 5 shell echo included
4536 !| echo 6 pipecmd-pre; cat; echo 6 pipecmd-post
4537 7 and 8 are ~A and ~a:
4540 !b 9 added ~b cc <ex1@am.ple>
4541 !c 10 added ~c c <ex2@am.ple>
4542 11 next ~d / $DEAD
4544 12: ~F
4546 13: ~F 1 3
4547 !F 1 3
4548 14: ~f (headerpick: subject)
4550 15: ~f 1
4551 !f 1
4552 16, 17: ~I Sign, ~i Sign
4553 !I Sign
4554 !i Sign
4555 18: ~M
4557 19: ~M 1
4558 !M 1
4559 20: ~m
4561 21: ~m 3
4562 !m 3
4563 28-32: ~Q; 28: ~Q
4565 29: ~Q 1 3
4566 !Q 1 3
4567 set quote
4568 !:set quote
4569 30: ~Q
4571 31: ~Q 1 3
4572 !Q 1 3
4573 set quote-inject-head quote-inject-tail indentprefix
4574 !:wysh set quote-inject-head=%%a quote-inject-tail=--%%r
4575 32: ~Q
4577 unset quote stuff
4578 !:unset quote quote-inject-head quote-inject-tail
4579 22: ~R ./.ttxt
4580 !R ./.ttxt
4581 23: ~r ./.ttxt
4582 !r ./.ttxt
4583 24: ~s this new subject
4584 !s 24 did new ~s ubject
4585 !t 25 added ~t o <ex3@am.ple>
4586 26: ~U
4588 27: ~U 1
4589 !U 1
4590 and i ~w rite this out to ./.tmsg
4591 !w ./.tmsg
4592 !:wysh set x=$escape;set escape=~
4593 ~!echo shell command output
4594 ~:wysh set escape=$x
4596 ' | ${MAILX} ${ARGS} -Smta=./.tmta.sh -Rf \
4597 -Sescape=! -Sindentprefix=' |' \
4598 ./.tmbox >./.tall 2>&1
4599 check_ex0 2-estat
4600 ${cat} ./.tall >> "${MBOX}"
4601 check 2 0 "${MBOX}" '2613898218 4090'
4602 check 3 - ./.tmsg '2771314896 3186'
4604 t_epilog
4607 t_mass_recipients() {
4608 t_prolog mass_recipients
4609 TRAP_EXIT_ADDONS="./.t*"
4611 t_xmta 'Eucalyptus Sat Jul 08 21:14:57 2017'
4613 ${cat} <<'__EOT__' > ./.trc
4614 define bail {
4615 echoerr "Failed: $1. Bailing out"; echo "~x"; xit
4617 define ins_addr {
4618 wysh set nr=$1 hn=$2
4619 echo "~$hn $hn$nr@$hn"; echo '~:echo $?'; read es
4620 if [ "$es" -ne 0 ]
4621 xcall bail "ins_addr $hn 1-$nr"
4623 vput vexpr nr + $nr 1
4624 if [ "$nr" -le "$maximum" ]
4625 xcall ins_addr $nr $hn
4628 define bld_alter {
4629 wysh set nr=$1 hn=$2
4630 alternates $hn$nr@$hn
4631 vput vexpr nr + $nr 2
4632 if [ "$nr" -le "$maximum" ]
4633 xcall bld_alter $nr $hn
4636 define t_ocs {
4637 read ver
4638 call ins_addr 1 t
4639 call ins_addr 1 c
4640 call ins_addr 1 b
4642 define t_ocl {
4643 if [ "$t_remove" != '' ]
4644 call bld_alter 1 t
4645 call bld_alter 2 c
4648 set on-compose-splice=t_ocs on-compose-leave=t_ocl
4649 __EOT__
4651 printf 'm this-goes@nowhere\nbody\n!.\n' |
4652 ${MAILX} ${ARGS} -Snomemdebug -Sescape=! -Sstealthmua=noagent \
4653 -X'source ./.trc' -Smta=./.tmta.sh -Smaximum=2001 \
4654 >./.tall 2>&1
4655 check_ex0 1-estat
4656 ${cat} ./.tall >> "${MBOX}"
4657 check 1 - "${MBOX}" '2912243346 51526'
4659 ${rm} "${MBOX}"
4660 printf 'm this-goes@nowhere\nbody\n!.\n' |
4661 ${MAILX} ${ARGS} -Snomemdebug -Sescape=! -Sstealthmua=noagent \
4662 -St_remove=1 -X'source ./.trc' -Smta=./.tmta.sh -Smaximum=2001 \
4663 >./.tall 2>&1
4664 check_ex0 2-estat
4665 ${cat} ./.tall >> "${MBOX}"
4666 check 2 - "${MBOX}" '4097804632 34394'
4668 t_epilog
4671 t_mime_types_load_control() {
4672 t_prolog mime_types_load_control
4673 if have_feat uistrings; then :; else
4674 echo 'mime_types_load_control: unsupported, skipped'
4675 return
4677 TRAP_EXIT_ADDONS="./.t*"
4679 ${cat} <<-_EOT > ./.tmts1
4680 @ application/mathml+xml mathml
4681 _EOT
4682 ${cat} <<-_EOT > ./.tmts2
4683 @ x-conference/x-cooltalk ice
4684 @ aga-aga aga
4685 @ application/aga-aga aga
4686 _EOT
4688 ${cat} <<-_EOT > ./.tmts1.mathml
4689 <head>nonsense ML</head>
4690 _EOT
4691 ${cat} <<-_EOT > ./.tmts2.ice
4692 Icy, icy road.
4693 _EOT
4694 printf 'of which the c\x01rack is coming soon' > ./.tmtsx.doom
4695 printf 'of which the c\x01rack is coming soon' > ./.tmtsx.aga
4697 printf '
4698 m %s
4699 Schub-di-du
4700 ~@ ./.tmts1.mathml
4701 ~@ ./.tmts2.ice
4702 ~@ ./.tmtsx.doom
4703 ~@ ./.tmtsx.aga
4705 File %s
4706 from*
4707 type
4709 ' "${MBOX}" "${MBOX}" |
4710 ${MAILX} ${ARGS} \
4711 -Smimetypes-load-control=f=./.tmts1,f=./.tmts2 \
4712 > ./.tout 2>&1
4713 check_ex0 1-estat
4714 ${cat} "${MBOX}" >> ./.tout
4715 check 1 - ./.tout '2716124839 2441'
4717 echo type | ${MAILX} ${ARGS} -R \
4718 -Smimetypes-load-control=f=./.tmts1,f=./.tmts3 \
4719 -f "${MBOX}" >> ./.tout 2>&1
4720 check 2 0 ./.tout '2093030907 3634'
4722 t_epilog
4725 t_lreply_futh_rth_etc() {
4726 t_prolog lreply_futh_rth_etc
4727 TRAP_EXIT_ADDONS="./.t*"
4729 t_xmta 'HumulusLupulus Thu Jul 27 14:41:20 2017'
4731 ${cat} <<-_EOT > ./.tmbox
4732 From neverneverland Sun Jul 23 13:46:25 2017
4733 Subject: Bugstop: five miles out 1
4734 Reply-To: mister originator2 <mr2@originator>, bugstop@five.miles.out
4735 From: mister originator <mr@originator>
4736 To: bugstop-commit@five.miles.out, laber@backe.eu
4737 Cc: is@a.list
4738 Mail-Followup-To: bugstop@five.miles.out, laber@backe.eu, is@a.list
4739 In-reply-to: <20170719111113.bkcMz%laber@backe.eu>
4740 Date: Wed, 19 Jul 2017 09:22:57 -0400
4741 Message-Id: <20170719132257.766AF781267@originator>
4742 Status: RO
4744 > |Sorry, I think I misunderstand something. I would think that
4746 That's appalling.
4748 From neverneverland Fri Jul 7 22:39:11 2017
4749 Subject: Bugstop: five miles out 2
4750 Reply-To: mister originator2<mr2@originator>,bugstop@five.miles.out,is@a.list
4751 Content-Transfer-Encoding: 7bit
4752 From: mister originator <mr@originator>
4753 To: bugstop-commit@five.miles.out
4754 Cc: is@a.list
4755 Message-ID: <149945963975.28888.6950788126957753723.reportbug@five.miles.out>
4756 Date: Fri, 07 Jul 2017 16:33:59 -0400
4757 Status: R
4759 capable of changing back.
4761 From neverneverland Fri Jul 7 22:42:00 2017
4762 Subject: Bugstop: five miles out 3
4763 Reply-To: mister originator2 <mr2@originator>, bugstop@five.miles.out
4764 Content-Transfer-Encoding: 7bit
4765 From: mister originator <mr@originator>
4766 To: bugstop-commit@five.miles.out
4767 Cc: is@a.list
4768 Message-ID: <149945963975.28888.6950788126957753746.reportbug@five.miles.out>
4769 Date: Fri, 07 Jul 2017 16:33:59 -0400
4770 List-Post: <mailto:bugstop@five.miles.out>
4771 Status: R
4773 are you ready, boots?
4775 From neverneverland Sat Aug 19 23:15:00 2017
4776 Subject: Bugstop: five miles out 4
4777 Reply-To: mister originator2 <mr2@originator>, bugstop@five.miles.out
4778 Content-Transfer-Encoding: 7bit
4779 From: mister originator <mr@originator>
4780 To: bugstop@five.miles.out
4781 Cc: is@a.list
4782 Message-ID: <149945963975.28888.6950788126qtewrqwer.reportbug@five.miles.out>
4783 Date: Fri, 07 Jul 2017 16:33:59 -0400
4784 List-Post: <mailto:bugstop@five.miles.out>
4785 Status: R
4787 are you ready, boots?
4788 _EOT
4792 ${cat} <<-'_EOT' | ${MAILX} ${ARGS} -Sescape=! -Smta=./.tmta.sh \
4793 -Rf ./.tmbox >> "${MBOX}" 2>&1
4794 define r {
4795 wysh set m="This is text of \"reply ${1}."
4796 reply 1 2 3
4797 !I m
4800 !I m
4803 !I m
4806 echo -----After reply $1.1 - $1.3: $?/$^ERRNAME
4808 define R {
4809 wysh set m="This is text of \"Reply ${1}."
4810 eval Reply $2
4811 !I m
4812 !I 2
4815 echo -----After Reply $1.$2: $?/$^ERRNAME
4817 define _Lh {
4818 read protover
4819 echo '~I m'
4820 echo '~I n'
4821 echo '".'
4823 define _Ls {
4824 wysh set m="This is text of \"Lreply ${1}." on-compose-splice=_Lh n=$2
4825 eval Lreply $2
4827 define L {
4828 # We need two indirections for this test: one for the case that Lreply
4829 # fails because of missing recipients: we need to read EOF next, thus
4830 # place this in _Ls last; and second for the succeeding cases EOF is
4831 # not what these should read, so go over the backside and splice it in!
4832 call _Ls "$@"
4833 echo -----After Lreply $1.$2: $?/$^ERRNAME
4835 define x {
4836 localopts call-fixate yes
4837 call r $1
4838 call R $1 1; call R $1 2; call R $1 3; call R $1 4
4839 call L $1 1; call L $1 2; call L $1 3
4841 define tweak {
4842 echo;echo '===== CHANGING === '"$*"' =====';echo
4843 eval "$@"
4846 set from=laber@backe.eu
4847 mlist is@a.list
4848 call x 1
4849 call tweak set reply-to-honour
4850 call x 2
4851 call tweak set followup-to
4852 call x 3
4853 call tweak set followup-to-honour
4854 call x 4
4855 call tweak mlist bugstop@five.miles.out
4856 call x 5
4857 call tweak mlsubscribe bugstop@five.miles.out
4858 call x 6
4859 call tweak set recipients-in-cc
4860 call x 7
4861 # While here, test that *fullnames* works (also here)
4862 set fullnames
4863 reply 1
4864 This message should have *fullnames* in the header.
4866 _EOT
4868 check_ex0 1-estat
4869 if have_feat uistrings; then
4870 check 1 - "${MBOX}" '1530821219 29859'
4871 else
4872 echo 'lreply_futh_rth_etc-1: content test unsupported, skipped'
4877 ${cat} <<-_EOT > ./.tmbox
4878 From tom@i-i.example Thu Oct 26 03:15:55 2017
4879 Date: Wed, 25 Oct 2017 21:15:46 -0400
4880 From: tom <tom@i-i.example>
4881 To: Steffen Nurpmeso <steffen@sdaoden.eu>
4882 Cc: tom <tom@i-i.example>
4883 Subject: Re: xxxx yyyyyyyy configure does not really like a missing zzzzz
4884 Message-ID: <20171026011546.GA11643@i-i.example>
4885 Reply-To: tom@i-i.example
4886 References: <20171025214601.T2pNd%steffen@sdaoden.eu>
4887 In-Reply-To: <20171025214601.T2pNd%steffen@sdaoden.eu>
4888 Status: R
4890 The report's useful :-)
4891 _EOT
4893 # Let us test In-Reply-To: removal starts a new thread..
4894 # This needs adjustment of *stealthmua*
4895 argadd='-Sstealthmua=noagent -Shostname'
4897 ${rm} "${MBOX}"
4898 printf 'reply 1\nthread\n!.\n' |
4899 ${MAILX} ${ARGS} -Sescape=! -Smta=./.tmta.sh -Sreply-to-honour \
4900 ${argadd} -Rf ./.tmbox > .tall 2>&1
4901 check 2 0 "${MBOX}" '3321764338 429'
4902 check 3 - .tall '4294967295 0'
4904 printf 'reply 1\nnew <- thread!\n!v\n!.\n' |
4905 ${MAILX} ${ARGS} -Sescape=! -Smta=./.tmta.sh -Sreply-to-honour \
4906 -Seditheaders -S VISUAL="${sed} -i'' -e '/^In-Reply-To:/d'" \
4907 ${argadd} -Rf "${MBOX}" > .tall 2>&1
4908 check 4 0 "${MBOX}" '1682552516 763'
4909 check 5 - .tall '4294967295 0'
4911 printf 'reply 2\nold <- new <- thread!\n!.\n' |
4912 ${MAILX} ${ARGS} -Sescape=! -Smta=./.tmta.sh -Sreply-to-honour \
4913 ${argadd} -Rf "${MBOX}" > .tall 2>&1
4914 check 6 0 "${MBOX}" '2900984135 1219'
4915 check 7 - .tall '4294967295 0'
4917 printf 'reply 3\nnew <- old <- new <- thread!\n!v\n!.\n' |
4918 ${MAILX} ${ARGS} -Sescape=! -Smta=./.tmta.sh -Sreply-to-honour \
4919 -Seditheaders -S VISUAL="${sed} -i'' -e '/^In-Reply-To:/d'" \
4920 ${argadd} -Rf "${MBOX}" > .tall 2>&1
4921 check 8 0 "${MBOX}" '794031200 1567'
4922 check 9 - .tall '4294967295 0'
4924 t_epilog
4927 t_mime_if_not_ascii() {
4928 t_prolog mime_if_not_ascii
4930 </dev/null ${MAILX} ${ARGS} -s Subject "${MBOX}" >> "${MBOX}" 2>&1
4931 check 1 0 "${MBOX}" '3647956381 106'
4933 </dev/null ${MAILX} ${ARGS} -Scharset-7bit=not-ascii -s Subject "${MBOX}" \
4934 >> "${MBOX}" 2>&1
4935 check 2 0 "${MBOX}" '3964303752 274'
4937 t_epilog
4940 t_xxxheads_rfc2047() {
4941 t_prolog xxxheads_rfc2047
4942 TRAP_EXIT_ADDONS="./.t*"
4944 t_xmta 'GentianaLutea Mon Dec 04 17:15:29 2017'
4946 echo | ${MAILX} ${ARGS} ${ADDARG_UNI} \
4947 -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̲' \
4948 "${MBOX}"
4949 check 1 0 "${MBOX}" '3422562347 371'
4951 # Single word (overlong line split -- bad standard! Requires injection of
4952 # artificial data!! But can be prevented by using RFC 2047 encoding)
4953 ${rm} "${MBOX}"
4954 i=`${awk} 'BEGIN{for(i=0; i<92; ++i) printf "0123456789_"}'`
4955 echo | ${MAILX} ${ARGS} -s "${i}" "${MBOX}"
4956 check 2 0 "${MBOX}" '3317256266 1714'
4958 # Combination of encoded words, space and tabs of varying sort
4959 ${rm} "${MBOX}"
4960 echo | ${MAILX} ${ARGS} ${ADDARG_UNI} \
4961 -s "1Abrä Kaspas1 2Abra Katä b_kaspas2 \
4962 3Abrä Kaspas3 4Abrä Kaspas4 5Abrä Kaspas5 \
4963 6Abra Kaspas6 7Abrä Kaspas7 8Abra Kaspas8 \
4964 9Abra Kaspastäb4-3 10Abra Kaspas1 _ 11Abra Katäb1 \
4965 12Abra Kadabrä1 After Tab after Täb this is NUTS" \
4966 "${MBOX}"
4967 check 3 0 "${MBOX}" '786672837 587'
4969 # Overlong multibyte sequence that must be forcefully split
4970 # todo This works even before v15.0, but only by accident
4971 ${rm} "${MBOX}"
4972 echo | ${MAILX} ${ARGS} ${ADDARG_UNI} \
4973 -s "✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄\
4974 ✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄\
4975 ✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄" \
4976 "${MBOX}"
4977 check 4 0 "${MBOX}" '2889557767 655'
4979 # Trailing WS
4980 ${rm} "${MBOX}"
4981 echo | ${MAILX} ${ARGS} \
4982 -s "1-1 B2 B3 B4 B5 B6 B\
4983 1-2 B2 B3 B4 B5 B6 B\
4984 1-3 B2 B3 B4 B5 B6 B\
4985 1-4 B2 B3 B4 B5 B6 B\
4986 1-5 B2 B3 B4 B5 B6 B\
4987 1-6 B2 B3 B4 B5 B6 " \
4988 "${MBOX}"
4989 check 5 0 "${MBOX}" '3135161683 293'
4991 # Leading and trailing WS
4992 ${rm} "${MBOX}"
4993 echo | ${MAILX} ${ARGS} \
4994 -s " 2-1 B2 B3 B4 B5 B6 B\
4995 1-2 B2 B3 B4 B5 B6 B\
4996 1-3 B2 B3 B4 B5 B6 B\
4997 1-4 B2 B3 B4 B5 B6 " \
4998 "${MBOX}"
4999 check 6 0 "${MBOX}" '3221845405 232'
5001 # RFC 2047 in an address field! (Missing test caused v14.9.6!)
5002 ${rm} "${MBOX}"
5003 echo "Dat Früchtchen riecht häußlich" |
5004 ${MAILX} ${ARGS} ${ADDARG_UNI} -Sfullnames -Smta=./.tmta.sh \
5005 -s Hühöttchen \
5006 'Schnödes "Früchtchen" <do@du> (Hä!)'
5007 check 7 0 "${MBOX}" '800505986 368'
5009 # RFC 2047 in an address field, and iconv involved
5010 if have_feat iconv; then
5011 ${rm} "${MBOX}"
5012 ${cat} > ./.trebox <<_EOT
5013 From zaza@exam.ple Fri Mar 2 21:31:56 2018
5014 Date: Fri, 2 Mar 2018 20:31:45 +0000
5015 From: z=?iso-8859-1?Q?=E1?=za <zaza@exam.ple>
5016 To: dude <dude@exam.ple>
5017 Subject: houston(...)
5018 Message-ID: <abra@1>
5019 MIME-Version: 1.0
5020 Content-Type: text/plain; charset=iso-8859-1
5021 Content-Disposition: inline
5022 Content-Transfer-Encoding: 8bit
5024 _EOT
5025 echo reply | ${MAILX} ${ARGS} ${ADDARG_UNI} \
5026 -Sfullnames -Sreply-in-same-charset \
5027 -Smta=./.tmta.sh -Rf ./.trebox
5028 check 8 0 "${MBOX}" '2914485741 280'
5029 else
5030 echo 'xxxheads_rfc2047-8: iconv unsupported, skipped'
5033 t_epilog
5036 t_rfc2231() {
5037 t_prolog rfc2231
5038 TRAP_EXIT_ADDONS="./.t*"
5041 mkdir ./.ttt || exit 1
5042 cd ./.ttt || exit 2
5043 : > "ma'ger.txt"
5044 : > "mä'ger.txt"
5045 : > 'diet\ is \curd.txt'
5046 : > 'diet "is" curd.txt'
5047 : > höde-tröge.txt
5048 : > 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
5049 : > höde__tröge__müde__dätte__hätte__vuelle__guelle__aese__aesse__sauerliche__kräuter__österliche__grüße__mäh.txt
5050 : > hööööööööööööööööö_nöööööööööööööööööööööö_düüüüüüüüüüüüüüüüüüü_bäääääääääääääääääääääääh.txt
5051 : > ✆✆✆✆✆✆✆✆✆✆✆✆✆✆✆✆✆✆✆✆✆✆✆✆.txt
5053 echo bla | ${MAILX} ${ARGS} ${ADDARG_UNI} \
5054 -a "./.ttt/ma'ger.txt" -a "./.ttt/mä'ger.txt" \
5055 -a './.ttt/diet\ is \curd.txt' -a './.ttt/diet "is" curd.txt' \
5056 -a ./.ttt/höde-tröge.txt \
5057 -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 \
5058 -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 \
5059 -a ./.ttt/hööööööööööööööööö_nöööööööööööööööööööööö_düüüüüüüüüüüüüüüüüüü_bäääääääääääääääääääääääh.txt \
5060 -a ./.ttt/✆✆✆✆✆✆✆✆✆✆✆✆✆✆✆✆✆✆✆✆✆✆✆✆.txt \
5061 "${MBOX}"
5062 check 1 0 "${MBOX}" '3720896054 3088'
5064 # `resend' test, reusing $MBOX
5065 printf "Resend ./.t2\nx\n" | ${MAILX} ${ARGS} -Rf "${MBOX}"
5066 check 2 0 ./.t2 '3720896054 3088'
5068 printf "resend ./.t3\nx\n" | ${MAILX} ${ARGS} -Rf "${MBOX}"
5069 check 3 0 ./.t3 '3979736592 3133'
5071 t_epilog
5074 t_iconv_mbyte_base64() { # TODO uses sed(1) and special *headline*!!
5075 t_prolog iconv_mbyte_base64
5076 TRAP_EXIT_ADDONS="./.t*"
5078 if [ -n "${UTF8_LOCALE}" ] && have_feat iconv; then
5079 if (</dev/null iconv -f ascii -t iso-2022-jp) >/dev/null 2>&1 ||
5080 (</dev/null iconv -f ascii -t euc-jp) >/dev/null 2>&1; then
5082 else
5083 echo 'iconv_mbyte_base64: unsupported, skipped'
5084 return
5086 else
5087 echo 'iconv_mbyte_base64: unsupported, skipped'
5088 return
5091 t_xmta 'DroseriaRotundifolia Thu Aug 03 17:26:25 2017'
5093 if (</dev/null iconv -f ascii -t iso-2022-jp) >/dev/null 2>&1; then
5094 ${cat} <<-'_EOT' | LC_ALL=${UTF8_LOCALE} ${MAILX} ${ARGS} \
5095 -Smta=./.tmta.sh \
5096 -Sescape=! -Smime-encoding=base64 2>./.terr
5097 set ttycharset=utf-8 sendcharsets=iso-2022-jp
5098 m t1@exam.ple
5099 !s Japanese from UTF-8 to ISO-2022-JP
5100 シジュウカラ科(シジュウカラか、学名 Paridae)は、鳥類スズメ目の科である。シジュウカラ(四十雀)と総称されるが、狭義にはこの1種をシジュウカラと呼ぶ。
5102 カンムリガラ(学名Parus cristatus)は、スズメ目シジュウカラ科に分類される鳥類の一種。
5105 カンムリガラ(学名Parus cristatus)は、スズメ目シジュウカラ科に分類される鳥類の一種。
5107 シジュウカラ科(シジュウカラか、学名 Paridae)は、鳥類スズメ目の科である。シジュウカラ(四十雀)と総称されるが、狭義にはこの1種をシジュウカラと呼ぶ。
5110 set ttycharset=iso-2022-jp charset-7bit=iso-2022-jp sendcharsets=utf-8
5111 m t2@exam.ple
5112 !s Japanese from ISO-2022-JP to UTF-8, eh, no, also ISO-2022-JP
5113 \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
5115 \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
5118 \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
5120 \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
5122 _EOT
5123 # May not presume iconv output as long as roundtrip possible [489a7122]
5124 check_ex0 1-estat
5125 ${awk} 'BEGIN{h=1}/^$/{++h;next}{if(h % 2 == 1)print}' \
5126 < "${MBOX}" > ./.tcksum
5127 check 1 - ./.tcksum '2694609714 520'
5128 check 2 - ./.terr '4294967295 0'
5130 printf 'eval f 1; eval write ./.twrite; eval type 1; eval type 2\n' |
5131 LC_ALL=${UTF8_LOCALE} ${MAILX} ${ARGS} \
5132 -S headline="%>%a%m %-18f %-16d %i%-s" \
5133 -Rf "${MBOX}" >./.tlog 2>&1
5134 check 3 0 ./.twrite '1259742080 686'
5135 #check 4 - ./.tlog '3214068822 2123'
5136 ${sed} -e '/^\[-- M/d' < ./.tlog > ./.txlog
5137 check 4 - ./.txlog '3659773472 2035'
5138 else
5139 echo 'iconv_mbyte_base64: ISO-2022-JP unsupported, skipping 1-4'
5142 if (</dev/null iconv -f ascii -t euc-jp) >/dev/null 2>&1; then
5143 rm -f "${MBOX}" ./.twrite
5144 ${cat} <<-'_EOT' | LC_ALL=${UTF8_LOCALE} ${MAILX} ${ARGS} \
5145 -Smta=./.tmta.sh \
5146 -Sescape=! -Smime-encoding=base64 2>./.terr
5147 set ttycharset=utf-8 sendcharsets=euc-jp
5148 m t1@exam.ple
5149 !s Japanese from UTF-8 to EUC-JP
5150 シジュウカラ科(シジュウカラか、学名 Paridae)は、鳥類スズメ目の科である。シジュウカラ(四十雀)と総称されるが、狭義にはこの1種をシジュウカラと呼ぶ。
5152 カンムリガラ(学名Parus cristatus)は、スズメ目シジュウカラ科に分類される鳥類の一種。
5155 カンムリガラ(学名Parus cristatus)は、スズメ目シジュウカラ科に分類される鳥類の一種。
5157 シジュウカラ科(シジュウカラか、学名 Paridae)は、鳥類スズメ目の科である。シジュウカラ(四十雀)と総称されるが、狭義にはこの1種をシジュウカラと呼ぶ。
5160 set ttycharset=EUC-JP sendcharsets=utf-8
5161 m t2@exam.ple
5162 !s Japanese from EUC-JP to UTF-8
5163 ¥·¥¸¥å¥¦¥«¥é²Ê¡Ê¥·¥¸¥å¥¦¥«¥é¤«¡¢³Ø̾ Paridae¡Ë¤Ï¡¢Ä»Îॹ¥º¥áÌܤβʤǤ¢¤ë¡£¥·¥¸¥å¥¦¥«¥é¡Ê»Í½½¿ý¡Ë¤ÈÁí¾Î¤µ¤ì¤ë¤¬¡¢¶¹µÁ¤Ë¤Ï¤³¤Î1¼ï¤ò¥·¥¸¥å¥¦¥«¥é¤È¸Æ¤Ö¡£
5165 ¥«¥ó¥à¥ê¥¬¥é¡Ê³Ø̾Parus cristatus¡Ë¤Ï¡¢¥¹¥º¥áÌÜ¥·¥¸¥å¥¦¥«¥é²Ê¤ËʬÎव¤ì¤ëÄ»Îà¤Î°ì¼ï¡£
5168 ¥«¥ó¥à¥ê¥¬¥é¡Ê³Ø̾Parus cristatus¡Ë¤Ï¡¢¥¹¥º¥áÌÜ¥·¥¸¥å¥¦¥«¥é²Ê¤ËʬÎव¤ì¤ëÄ»Îà¤Î°ì¼ï¡£
5170 ¥·¥¸¥å¥¦¥«¥é²Ê¡Ê¥·¥¸¥å¥¦¥«¥é¤«¡¢³Ø̾ Paridae¡Ë¤Ï¡¢Ä»Îॹ¥º¥áÌܤβʤǤ¢¤ë¡£¥·¥¸¥å¥¦¥«¥é¡Ê»Í½½¿ý¡Ë¤ÈÁí¾Î¤µ¤ì¤ë¤¬¡¢¶¹µÁ¤Ë¤Ï¤³¤Î1¼ï¤ò¥·¥¸¥å¥¦¥«¥é¤È¸Æ¤Ö¡£
5172 _EOT
5173 check_ex0 5-estat
5174 ${awk} 'BEGIN{h=1}/^$/{++h;next}{if(h % 2 == 1)print}' \
5175 < "${MBOX}" > ./.tcksum
5176 check 5 - ./.tcksum '2870183985 473'
5177 check 6 - ./.terr '4294967295 0'
5179 printf 'eval f 1; eval write ./.twrite; eval type 1; eval type 2\n' |
5180 LC_ALL=${UTF8_LOCALE} ${MAILX} ${ARGS} \
5181 -S headline="%>%a%m %-18f %-16d %i%-s" \
5182 -Rf "${MBOX}" >./.tlog 2>&1
5183 check 7 0 ./.twrite '1259742080 686'
5184 #check 8 - ./.tlog '2506063395 2075'
5185 ${sed} -e '/^\[-- M/d' < ./.tlog > ./.txlog
5186 check 8 - ./.txlog '2528199891 1988'
5187 else
5188 echo 'iconv_mbyte_base64: EUC-JP unsupported, skipping 5-8'
5191 t_epilog
5194 t_iconv_mainbody() {
5195 t_prolog iconv_mainbody
5196 TRAP_EXIT_ADDONS="./.t*"
5198 if [ -n "${UTF8_LOCALE}" ] && have_feat iconv; then
5200 else
5201 echo 'iconv_mainbody: unsupported, skipped'
5202 return
5205 t_xmta 'HamamelisVirginiana Fri Oct 20 16:23:21 2017'
5207 printf '–' | ${MAILX} ${ARGS} ${ADDARG_UNI} -Smta=./.tmta.sh \
5208 -S charset-7bit=us-ascii -S charset-8bit=utf-8 \
5209 -s '–' over-the@rain.bow 2>./.terr
5210 check 1 0 "${MBOX}" '3634015017 251'
5211 check 2 - ./.terr '4294967295 0'
5213 printf '–' | ${MAILX} ${ARGS} ${ADDARG_UNI} -Smta=./.tmta.sh \
5214 -S charset-7bit=us-ascii -S charset-8bit=us-ascii \
5215 -s '–' over-the@rain.bow 2>./.terr
5216 check_exn0 3
5217 check 3 - "${MBOX}" '3634015017 251'
5218 if have_feat uistrings; then
5219 if have_feat docstrings; then # xxx should not be like that
5220 check 4 - ./.terr '2579894983 148'
5221 else
5222 check 4 - ./.terr '271380835 121'
5224 else
5225 echo 'iconv_mainbody-4: unsupported, skipped'
5228 # The different iconv(3) implementations use different replacement sequence
5229 # types (character-wise, byte-wise, and the character(s) used differ)
5230 i="${MAILX_ICONV_MODE}"
5231 if [ -n "${i}" ]; then
5232 printf 'p\nx\n' | ${MAILX} ${ARGS} -Rf "${MBOX}" >./.tout 2>./.terr
5233 j=${?}
5234 check_ex0 5-1-estat ${j}
5235 check 5-1 - ./.terr '4294967295 0'
5236 if [ ${i} -eq 13 ]; then
5237 check 5-2 - ./.tout '189327996 283'
5238 elif [ ${i} -eq 12 ]; then
5239 check 5-3 - ./.tout '1959197095 283'
5240 elif [ ${i} -eq 3 ]; then
5241 check 5-4 - ./.tout '3196380198 279'
5242 else
5243 check 5-5 - ./.tout '3760313827 279'
5245 else
5246 echo 'iconv_mainbody-5: unsupported, skipped'
5249 t_epilog
5252 t_binary_mainbody() {
5253 t_prolog binary_mainbody
5254 TRAP_EXIT_ADDONS="./.t*"
5256 printf 'abra\0\nka\r\ndabra' |
5257 ${MAILX} ${ARGS} ${ADDARG_UNI} -s 'binary with carriage-return!' \
5258 "${MBOX}" 2>./.terr
5259 check 1 0 "${MBOX}" '1629827 239'
5260 check 2 - ./.terr '4294967295 0'
5262 printf 'p\necho\necho writing now\nwrite ./.twrite\n' |
5263 ${MAILX} ${ARGS} -Rf \
5264 -Spipe-application/octet-stream="@* ${cat} > ./.tcat" \
5265 "${MBOX}" >./.tall 2>&1
5266 check 3 0 ./.tall '733582513 319'
5267 check 4 - ./.tcat '3817108933 15'
5268 check 5 - ./.twrite '3817108933 15'
5270 t_epilog
5273 t_q_t_etc_opts() {
5274 t_prolog q_t_etc_opts
5275 TRAP_EXIT_ADDONS="./.t*"
5277 # Three tests for MIME encoding and (a bit) content classification.
5278 # At the same time testing -q FILE, < FILE and -t FILE
5279 t__put_body > ./.tin
5281 < ./.tin ${MAILX} ${ARGS} ${ADDARG_UNI} \
5282 -a ./.tin -s "`t__put_subject`" "${MBOX}"
5283 check 1 0 "${MBOX}" '1088822685 6642'
5285 ${rm} "${MBOX}"
5286 < /dev/null ${MAILX} ${ARGS} ${ADDARG_UNI} \
5287 -a ./.tin -s "`t__put_subject`" -q ./.tin "${MBOX}"
5288 check 2 0 "${MBOX}" '1088822685 6642'
5290 ${rm} "${MBOX}"
5291 ( echo "To: ${MBOX}" && echo "Subject: `t__put_subject`" && echo &&
5292 ${cat} ./.tin
5293 ) | ${MAILX} ${ARGS} ${ADDARG_UNI} -Snodot -a ./.tin -t
5294 check 3 0 "${MBOX}" '1088822685 6642'
5296 # Check comments in the header
5297 ${rm} "${MBOX}"
5298 ${cat} <<-_EOT | ${MAILX} ${ARGS} -Snodot -t "${MBOX}"
5299 # Ein Kommentar
5300 From: du@da
5301 # Noch ein Kommentar
5302 Subject: hey you
5303 # Nachgestelltes Kommentar
5305 BOOOM
5306 _EOT
5307 check 4 0 "${MBOX}" '4161555890 124'
5309 t_epilog
5312 t_s_mime() {
5313 have_feat smime || {
5314 echo 's_mime: unsupported, skipped'
5315 return
5318 t_prolog s_mime
5319 TRAP_EXIT_ADDONS="./.t.conf ./.tkey.pem ./.tcert.pem ./.tpair.pem"
5320 TRAP_EXIT_ADDONS="${TRAP_EXIT_ADDONS} ./.VERIFY ./.DECRYPT ./.ENCRYPT"
5321 TRAP_EXIT_ADDONS="${TRAP_EXIT_ADDONS} ./.tmta.sh"
5323 ${cat} <<-_EOT > ./.t.conf
5324 [ req ]
5325 default_bits = 1024
5326 default_keyfile = keyfile.pem
5327 distinguished_name = req_distinguished_name
5328 attributes = req_attributes
5329 prompt = no
5330 output_password =
5332 [ req_distinguished_name ]
5333 C = GB
5334 ST = Over the
5335 L = rainbow
5336 O = S-nail
5337 OU = S-nail.smime
5338 CN = S-nail.test
5339 emailAddress = test@localhost
5341 [ req_attributes ]
5342 challengePassword =
5343 _EOT
5344 openssl req -x509 -nodes -days 3650 -config ./.t.conf \
5345 -newkey rsa:1024 -keyout ./.tkey.pem -out ./.tcert.pem >>${ERR} 2>&1
5346 check_ex0 0
5347 ${cat} ./.tkey.pem ./.tcert.pem > ./.tpair.pem
5349 # Sign/verify
5350 echo bla | ${MAILX} ${ARGS} \
5351 -Ssmime-sign -Ssmime-sign-cert=./.tpair.pem -Sfrom=test@localhost \
5352 -s 'S/MIME test' ./.VERIFY
5353 check_ex0 1-estat
5354 ${awk} '
5355 BEGIN{ skip=0 }
5356 /^Content-Description: /{ skip = 2; print; next }
5357 /^$/{ if(skip) --skip }
5358 { if(!skip) print }
5360 < ./.VERIFY > "${MBOX}"
5361 check 1 - "${MBOX}" '1311565262 644'
5363 printf 'verify\nx\n' |
5364 ${MAILX} ${ARGS} -Ssmime-ca-file=./.tcert.pem -Serrexit \
5365 -R -f ./.VERIFY >>${ERR} 2>&1
5366 check_ex0 2
5368 openssl smime -verify -CAfile ./.tcert.pem -in ./.VERIFY >>${ERR} 2>&1
5369 check_ex0 3
5371 # (signing +) encryption / decryption
5372 t_xmta 'Euphrasia Thu Apr 27 17:56:23 2017' ./.ENCRYPT
5374 echo bla |
5375 ${MAILX} ${ARGS} \
5376 -Smta=./.tmta.sh \
5377 -Ssmime-force-encryption -Ssmime-encrypt-recei@ver.com=./.tpair.pem \
5378 -Ssmime-sign -Ssmime-sign-cert=./.tpair.pem -Sfrom=test@localhost \
5379 -s 'S/MIME test' recei@ver.com
5380 check_ex0 4-estat
5381 ${sed} -e '/^$/,$d' < ./.ENCRYPT > "${MBOX}"
5382 check 4 - "${MBOX}" '1937410597 327'
5384 printf 'decrypt ./.DECRYPT\nfi ./.DECRYPT\nverify\nx\n' |
5385 ${MAILX} ${ARGS} \
5386 -Smta=./.tmta.sh \
5387 -Ssmime-ca-file=./.tcert.pem \
5388 -Ssmime-sign-cert=./.tpair.pem \
5389 -Serrexit -R -f ./.ENCRYPT >>${ERR} 2>&1
5390 check_ex0 5-estat
5391 ${awk} '
5392 BEGIN{ skip=0 }
5393 /^Content-Description: /{ skip = 2; print; next }
5394 /^$/{ if(skip) --skip }
5395 { if(!skip) print }
5397 < ./.DECRYPT > "${MBOX}"
5398 check 5 - "${MBOX}" '1720739247 931'
5400 (openssl smime -decrypt -inkey ./.tkey.pem -in ./.ENCRYPT |
5401 openssl smime -verify -CAfile ./.tcert.pem) >>${ERR} 2>&1
5402 check_ex0 6
5404 ${rm} ./.ENCRYPT
5405 echo bla | ${MAILX} ${ARGS} \
5406 -Smta=./.tmta.sh \
5407 -Ssmime-force-encryption -Ssmime-encrypt-recei@ver.com=./.tpair.pem \
5408 -Sfrom=test@localhost \
5409 -s 'S/MIME test' recei@ver.com
5410 check_ex0 7-estat
5411 ${sed} -e '/^$/,$d' < ./.ENCRYPT > "${MBOX}"
5412 check 7 - "${MBOX}" '1937410597 327'
5414 ${rm} ./.DECRYPT
5415 printf 'decrypt ./.DECRYPT\nx\n' | ${MAILX} ${ARGS} \
5416 -Smta=./.tmta.sh \
5417 -Ssmime-sign-cert=./.tpair.pem \
5418 -Serrexit -R -f ./.ENCRYPT >>${ERR} 2>&1
5419 check 8 0 "./.DECRYPT" '2624716890 422'
5421 openssl smime -decrypt -inkey ./.tkey.pem \
5422 -in ./.ENCRYPT >>${ERR} 2>&1
5423 check_ex0 9
5425 t_epilog
5428 # xxx Note: t_z() was the first test (series) written. Today many
5429 # xxx aspects are (better) covered by other tests above, some are not.
5430 # xxx At some future date and time, convert the last remains not covered
5431 # xxx elsewhere to a real t_* test and drop it
5432 t_z() {
5433 t_prolog z
5435 # Test for [260e19d] (Juergen Daubert)
5436 echo body | ${MAILX} ${ARGS} "${MBOX}"
5437 check 4 0 "${MBOX}" '2948857341 94'
5439 # "Test for" [d6f316a] (Gavin Troy)
5440 ${rm} "${MBOX}"
5441 printf "m ${MBOX}\n~s subject1\nEmail body\n~.\nfi ${MBOX}\np\nx\n" |
5442 ${MAILX} ${ARGS} ${ADDARG_UNI} -Spipe-text/plain="@* ${cat}" > "${BODY}"
5443 check 6 0 "${MBOX}" '3942990636 118'
5444 check 6-1 - "${BODY}" '3951695530 170'
5446 # "Test for" [c299c45] (Peter Hofmann) TODO shouldn't end up QP-encoded?
5447 ${rm} "${MBOX}"
5448 ${awk} 'BEGIN{
5449 for(i = 0; i < 10000; ++i)
5450 printf "\xC3\xBC"
5451 #printf "\xF0\x90\x87\x90"
5452 }' | ${MAILX} ${ARGS} ${ADDARG_UNI} -s TestSubject "${MBOX}"
5453 check 7 0 "${MBOX}" '1707496413 61812'
5455 t_epilog
5458 t__put_subject() {
5459 # MIME encoding (QP) stress message subject
5460 printf 'Äbrä Kä?dä=brö Fü?di=bus? '\
5461 'adadaddsssssssddddddddddddddddddddd'\
5462 'ddddddddddddddddddddddddddddddddddd'\
5463 'ddddddddddddddddddddddddddddddddddd'\
5464 'dddddddddddddddddddd Hallelulja? Od'\
5465 'er?? eeeeeeeeeeeeeeeeeeeeeeeeeeeeee'\
5466 'eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee'\
5467 'eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee f'\
5468 'fffffffffffffffffffffffffffffffffff'\
5469 'fffffffffffffffffffff ggggggggggggg'\
5470 'ggggggggggggggggggggggggggggggggggg'\
5471 'ggggggggggggggggggggggggggggggggggg'\
5472 'ggggggggggggggggggggggggggggggggggg'\
5473 'gggggggggggggggg'
5476 t__put_body() {
5477 # MIME encoding (QP) stress message body
5478 printf \
5479 'Ich bin eine DÖS-Datäi mit sehr langen Zeilen und auch '\
5480 'sonst bin ich ganz schön am Schleudern, da kannste denke '\
5481 "wasde willst, gelle, gelle, gelle, gelle, gelle.\r\n"\
5482 "Ich bin eine DÖS-Datäi mit langen Zeilen und auch sonst \r\n"\
5483 "Ich bin eine DÖS-Datäi mit langen Zeilen und auch sonst 1\r\n"\
5484 "Ich bin eine DÖS-Datäi mit langen Zeilen und auch sonst 12\r\n"\
5485 "Ich bin eine DÖS-Datäi mit langen Zeilen und auch sonst 123\r\n"\
5486 "Ich bin eine DÖS-Datäi mit langen Zeilen und auch sonst 1234\r\n"\
5487 "Ich bin eine DÖS-Datäi mit langen Zeilen und auch sonst 12345\r\n"\
5488 "Ich bin eine DÖS-Datäi mit langen Zeilen und auch sonst 123456\r\n"\
5489 "Ich bin eine DÖS-Datäi mit langen Zeilen und auch sonst 1234567\r\n"\
5490 "Ich bin eine DÖS-Datäi mit langen Zeilen und auch sonst 12345678\r\n"\
5491 "Ich bin eine DÖS-Datäi mit langen Zeilen und auch sonst 123456789\r\n"\
5492 "Unn ausserdem habe ich trailing SP/HT/SP/HT whitespace \r\n"\
5493 "Unn ausserdem habe ich trailing HT/SP/HT/SP whitespace \r\n"\
5494 "auf den zeilen vorher.\r\n"\
5495 "From am Zeilenbeginn und From der Mitte gibt es auch.\r\n"\
5496 ".\r\n"\
5497 "Die letzte Zeile war nur ein Punkt.\r\n"\
5498 "..\r\n"\
5499 "Das waren deren zwei.\r\n"\
5500 " \r\n"\
5501 "Die letzte Zeile war ein Leerschritt.\n"\
5502 "=VIER = EQUAL SIGNS=ON A LINE=\r\n"\
5503 "Prösterchen.\r\n"\
5504 ".\n"\
5505 "Die letzte Zeile war nur ein Punkt, mit Unix Zeilenende.\n"\
5506 "..\n"\
5507 "Das waren deren zwei. ditto.\n"\
5508 "Prösterchen.\n"\
5509 "Unn ausseerdem habe ich trailing SP/HT/SP/HT whitespace \n"\
5510 "Unn ausseerdem habe ich trailing HT/SP/HT/SP whitespace \n"\
5511 "auf den zeilen vorher.\n"\
5512 "ditto.\n"\
5513 "Ich bin eine ziemlich lange, steile, scharfe Zeile mit Unix Zeilenende.\n"\
5514 "Ich bin eine ziemlich lange, steile, scharfe Zeile mit Unix Zeilenende.1"\
5515 "\n"\
5516 "Ich bin eine ziemlich lange, steile, scharfe Zeile mit Unix Zeilenende.12"\
5517 "\n"\
5518 "Ich bin eine ziemlich lange, steile, scharfe Zeile mit Unix Zeilenende.12"\
5519 "3\n"\
5520 "Ich bin eine ziemlich lange, steile, scharfe Zeile mit Unix Zeilenende.12"\
5521 "34\n"\
5522 "Ich bin eine ziemlich lange, steile, scharfe Zeile mit Unix Zeilenende.12"\
5523 "345\n"\
5524 "Ich bin eine ziemlich lange, steile, scharfe Zeile mit Unix Zeilenende.12"\
5525 "3456\n"\
5526 "QP am Zeilenende über soft-nl hinweg\n"\
5527 "Ich bin eine ziemlich lange, steile, scharfe Zeile mit Unix Zeilenende."\
5528 "ö123\n"\
5529 "Ich bin eine ziemlich lange, steile, scharfe Zeile mit Unix Zeilenende."\
5530 "1ö23\n"\
5531 "Ich bin eine ziemlich lange, steile, scharfe Zeile mit Unix Zeilenende."\
5532 "12ö3\n"\
5533 "Ich bin eine ziemlich lange, steile, scharfe Zeile mit Unix Zeilenende."\
5534 "123ö\n"\
5535 "=VIER = EQUAL SIGNS=ON A LINE=\n"\
5536 " \n"\
5537 "Die letzte Zeile war ein Leerschritt.\n"\
5541 # cc_all_configs()
5542 # Test all configs TODO doesn't cover all *combinations*, stupid!
5543 cc_all_configs() {
5544 < ${CONF} ${awk} '
5545 BEGIN{
5546 ALWAYS = "OPT_AUTOCC=1 OPT_AMALGAMATION=1"
5547 NOTME["OPT_ALWAYS_UNICODE_LOCALE"] = 1
5548 NOTME["OPT_CROSS_BUILD"] = 1
5549 NOTME["OPT_AUTOCC"] = 1
5550 NOTME["OPT_AMALGAMATION"] = 1
5551 NOTME["OPT_DEBUG"] = 1
5552 NOTME["OPT_DEVEL"] = 1
5553 NOTME["OPT_ASAN_ADDRESS"] = 1
5554 NOTME["OPT_ASAN_MEMORY"] = 1
5555 NOTME["OPT_FORCED_STACKPROT"] = 1
5556 NOTME["OPT_NOMEMDBG"] = 1
5557 NOTME["OPT_NYD2"] = 1
5559 #OPTVALS
5560 OPTNO = 0
5562 MULCHOICE["OPT_IDNA"] = "VAL_IDNA"
5563 MULVALS["VAL_IDNA"] = 1
5565 #VALKEYS[0] = "VAL_RANDOM"
5566 VALVALS["VAL_RANDOM"] = 1
5567 VALNO = 0
5569 /^[[:space:]]*OPT_/{
5570 sub(/^[[:space:]]*/, "")
5571 # This bails for UnixWare 7.1.4 awk(1), but preceeding = with \
5572 # does not seem to be a compliant escape for =
5573 #sub(/=.*$/, "")
5574 $1 = substr($1, 1, index($1, "=") - 1)
5575 if(!NOTME[$1])
5576 OPTVALS[OPTNO++] = $1
5577 next
5579 /^[[:space:]]*VAL_/{
5580 sub(/^[[:space:]]*/, "")
5581 val = substr($0, index($0, "=") + 1)
5582 if(val ~ /^\"/){
5583 val = substr(val, 2)
5584 val = substr(val, 1, length(val) - 1)
5586 $1 = substr($1, 1, index($1, "=") - 1)
5587 if(MULVALS[$1])
5588 MULVALS[$1] = val
5589 else if(VALVALS[$1]){
5590 VALKEYS[VALNO++] = $1
5591 VALVALS[$1] = val
5593 next
5595 function onepass(addons){
5596 a_onepass__worker(addons, "1", "0")
5597 a_onepass__worker(addons, "0", "1")
5599 function a_onepass__worker(addons, b0, b1){
5600 # Doing this completely sequentially and not doing make distclean in
5601 # between runs should effectively result in lesser compilations.
5602 # It is completely dumb nonetheless... TODO
5603 for(ono = 0; ono < OPTNO; ++ono){
5604 myconf = mula = ""
5605 for(i = 0; i < ono; ++i){
5606 myconf = myconf " " OPTVALS[i] "=" b0 " "
5607 if(b0 == "1"){
5608 j = MULCHOICE[OPTVALS[i]]
5609 if(j){
5610 if(i + 1 == ono)
5611 mula = j
5612 else
5613 myconf = myconf " " MULCHOICE[OPTVALS[i]] "=any "
5617 for(i = ono; i < OPTNO; ++i){
5618 myconf = myconf " " OPTVALS[i] "=" b1 " "
5619 if(b1 == "1"){
5620 j = MULCHOICE[OPTVALS[i]]
5621 if(j){
5622 if(i + 1 == OPTNO)
5623 mula = j;
5624 else
5625 myconf = myconf " " MULCHOICE[OPTVALS[i]] "=any "
5630 for(i in VALKEYS)
5631 myconf = VALKEYS[i] "=any " myconf
5633 myconf = myconf " " ALWAYS " " addons
5635 if(mula == "")
5636 print myconf
5637 else{
5638 i = split(MULVALS[mula], ia)
5639 j = "any"
5640 while(i >= 1){
5641 j = ia[i--] " " j
5642 print mula "=\"" j "\" " myconf
5647 END{
5648 # We cannot test NULL because of missing UI strings, which will end
5649 # up with different checksums
5650 print "CONFIG=NULLI OPT_AUTOCC=1"
5651 for(i in VALKEYS){
5652 j = split(VALVALS[VALKEYS[i]], ia)
5653 k = "any"
5654 while(j >= 1){
5655 k = ia[j--] " " k
5656 print VALKEYS[i] "=\"" k "\" CONFIG=NULLI OPT_AUTOCC=1"
5659 print "CONFIG=MINIMAL OPT_AUTOCC=1"
5660 print "CONFIG=NETSEND OPT_AUTOCC=1"
5661 print "CONFIG=MAXIMAL OPT_AUTOCC=1"
5662 for(i in VALKEYS){
5663 j = split(VALVALS[VALKEYS[i]], ia)
5664 k = "any"
5665 while(j >= 1){
5666 k = ia[j--] " " k
5667 print VALKEYS[i] "=\"" k "\" CONFIG=MAXIMAL OPT_AUTOCC=1"
5670 print "CONFIG=DEVEL OPT_AUTOCC=1"
5671 print "CONFIG=ODEVEL OPT_AUTOCC=1"
5673 onepass("OPT_DEBUG=1")
5674 onepass("")
5676 ' | while read c; do
5677 [ -f mk-config.h ] && ${cp} mk-config.h .ccac.h
5678 printf "\n\n##########\n$c\n"
5679 printf "\n\n##########\n$c\n" >&2
5680 ${SHELL} -c "cd .. && ${MAKE} ${c} config"
5681 if [ -f .ccac.h ] && ${cmp} mk-config.h .ccac.h; then
5682 printf 'Skipping after config, nothing changed\n'
5683 printf 'Skipping after config, nothing changed\n' >&2
5684 continue
5686 ${SHELL} -c "cd ../ && ${MAKE} build test"
5687 done
5688 ${rm} -f .ccac.h
5689 cd .. && ${MAKE} distclean
5692 [ -n "${ERR}" ] && echo > ${ERR}
5693 if [ -z "${CHECK_ONLY}${MAE_TEST}" ]; then
5694 cc_all_configs
5695 elif [ -z "${MAE_TEST}" ] || [ ${#} -eq 0 ]; then
5696 # if have_feat devel; then
5697 # ARGS="${ARGS} -Smemdebug"
5698 # export ARGS
5699 # fi
5700 t_all
5702 else
5703 while [ ${#} -gt 0 ]; do
5704 eval t_${1}
5705 shift
5706 done
5709 [ ${ESTAT} -eq 0 ] && echo Ok || echo >&2 'Errors occurred'
5711 exit ${ESTAT}
5712 # s-sh-mode