c_verify(): better error on X509_STORE_load_locations() failure
[s-mailx.git] / cc-test.sh
blob8e6dcc44a797305d7dfb34eed908a2b1a682a785
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 ex0_test should say TESTNUMBER-estat instead of having own numbers
7 #@ TODO _All_ the tests should happen in a temporary subdir.
8 # Public Domain
10 # Instead of figuring out the environment in here, require a configured build
11 # system and include that! Our makefile and configure ensure that this test
12 # does not run in the configured, but the user environment nonetheless!
14 if [ -f ./mk-config.ev ]; then
16 elif [ -f snailmail.jpg ] && [ -f .obj/mk-config.ev ]; then
17 cd .obj
18 i=../
19 else
20 echo >&2 'S-nail/S-mailx is not configured.'
21 echo >&2 'This test script requires the shell environment that only the'
22 echo >&2 'configuration script can figure out, even if it will be used to'
23 echo >&2 'test a different binary than the one that would be produced!'
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-ignore-error -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 echo >&2 'Synopsis: ./cc-test.sh --check-only s-mailx-binary'
74 echo >&2 'Synopsis: ./cc-test.sh --mae-test s-mailx-binary [:TESTNAME:]'
75 echo >&2 'Synopsis: ./cc-test.sh # (hundreds of compilation tests)'
76 exit 1
79 CHECK_ONLY= MAE_TEST= MAILX=
80 if [ "${1}" = --check-only ]; then
81 CHECK_ONLY=1
82 MAILX=${2}
83 [ -x "${MAILX}" ] || usage
84 shift 2
85 elif [ "${1}" = --mae-test ]; then
86 MAE_TEST=1
87 MAILX=${2}
88 [ -x "${MAILX}" ] || usage
89 shift 2
91 RAWMAILX=${MAILX}
92 MAILX="${MEMTESTER}${MAILX}"
93 export RAWMAILX MAILX
95 if [ -n "${CHECK_ONLY}${MAE_TEST}" ] && [ -z "${UTF8_LOCALE}" ]; then
96 # Try ourselfs via nl_langinfo(CODESET) first (requires a new version)
97 if command -v "${RAWMAILX}" >/dev/null 2>&1 &&
98 ("${RAWMAILX}" -:/ -Xxit) >/dev/null 2>&1; then
99 i=`LC_ALL=C.utf8 "${RAWMAILX}" ${ARGS} -X '
100 \define cset_test {
101 \if [ "${ttycharset}" @i=% utf ]
102 \echo $LC_ALL
103 \xit 0
104 \end
105 \if [ "${#}" -gt 0 ]
106 \wysh set LC_ALL=${1}
107 \shift
108 \eval xcall cset_test "${@}"
109 \end
110 \xit 1
112 \call cset_test C.UTF-8 POSIX.utf8 POSIX.UTF-8 \
113 en_EN.utf8 en_EN.UTF-8 en_US.utf8 en_US.UTF-8
115 [ $? -eq 0 ] && UTF8_LOCALE=$i
118 if [ -z "${UTF8_LOCALE}" ] && (locale yesexpr) >/dev/null 2>&1; then
119 UTF8_LOCALE=`locale -a | { m=
120 while read n; do
121 if { echo ${n} |
122 ${grep} -i -e utf8 -e utf-8; } >/dev/null 2>&1; then
123 m=${n}
124 if { echo ${n} |
125 ${grep} -e POSIX -e en_EN -e en_US; } >/dev/null 2>&1; then
126 break
129 done
130 echo ${m}
135 ESTAT=0
137 TRAP_EXIT_ADDONS=
138 trap "${rm} -rf \"${BODY}\" \"${MBOX}\" \"${ERR}\" \${TRAP_EXIT_ADDONS}" EXIT
139 trap "exit 1" HUP INT TERM
141 have_feat() {
142 ( "${RAWMAILX}" ${ARGS} -X'echo $features' -Xx |
143 ${grep} +${1} ) >/dev/null 2>&1
146 t_prolog() {
147 ${rm} -rf "${BODY}" "${MBOX}" ${TRAP_EXIT_ADDONS}
148 TRAP_EXIT_ADDONS=
149 [ ${#} -gt 0 ] && printf '[%s]\n' "${1}"
151 t_epilog() {
152 t_prolog
155 t_xmta() {
156 [ ${#} -ge 1 ] && __from=${1} ||
157 __from='Silybum Marianum Tue Apr 17 15:55:01 2018'
158 [ ${#} -eq 2 ] && __to=${2} || __to="${MBOX}"
159 ${cat} <<-_EOT > .tmta.sh
160 #!${SHELL} -
161 ( echo 'From '"${__from}" && ${cat} && echo ) >> "${__to}"
162 _EOT
163 chmod 0755 .tmta.sh
166 check() {
167 restat=${?} tid=${1} eestat=${2} f=${3} s=${4}
168 [ "${eestat}" != - ] && [ "${restat}" != "${eestat}" ] &&
169 err "${tid}" 'unexpected exit status: '"${restat} != ${eestat}"
170 csum="`${cksum} < ${f}`"
171 if [ "${csum}" = "${s}" ]; then
172 maex=
173 printf '%s: ok\n' "${tid}"
174 else
175 maex=yes
176 ESTAT=1
177 printf '%s: error: checksum mismatch (got %s)\n' "${tid}" "${csum}"
180 if [ -n "${MAE_TEST}" ]; then
181 x=mae-test-`echo ${tid} | ${tr} "/:=" "__-"`
182 ${cp} -f "${f}" ./"${x}"
184 if [ -n "${maex}" ] && [ -d ../.git ] &&
185 command -v diff >/dev/null 2>&1 &&
186 (git rev-parse --verify test-out) >/dev/null 2>&1 &&
187 git show test-out:"${x}" > ./"${x}".old 2>/dev/null; then
188 diff -ru ./"${x}".old ./"${x}" > "${x}".diff
193 err() {
194 ESTAT=1
195 printf '%s: error: %s\n' ${1} "${2}"
198 ex0_test() {
199 # $1=test name [$2=status]
200 __qm__=${?}
201 [ ${#} -gt 1 ] && __qm__=${2}
202 if [ ${__qm__} -ne 0 ]; then
203 err $1 'unexpected non-0 exit status'
204 else
205 printf '%s: ok\n' "${1}"
209 exn0_test() {
210 # $1=test name [$2=status]
211 __qm__=${?}
212 [ ${#} -gt 1 ] && __qm__=${2}
213 if [ ${__qm__} -eq 0 ]; then
214 err $1 'unexpected 0 exit status'
215 else
216 printf '%s: ok\n' "${1}"
220 if ( [ "$((1 + 1))" = 2 ] ) >/dev/null 2>&1; then
221 add() {
222 echo "$((${1} + ${2}))"
224 else
225 add() {
226 echo `${awk} 'BEGIN{print '${1}' + '${2}'}'`
230 if ( [ "$((2 % 3))" = 2 ] ) >/dev/null 2>&1; then
231 modulo() {
232 echo "$((${1} % ${2}))"
234 else
235 modulo() {
236 echo `${awk} 'BEGIN{print '${1}' % '${2}'}'`
240 # t_behave()
241 # Basic behaviour tests
242 t_behave() {
243 t_behave_X_opt_input_command_stack
244 t_behave_X_errexit
245 t_behave_S_freeze
246 t_behave_wysh
247 t_behave_input_inject_semicolon_seq
248 t_behave_commandalias
249 t_behave_ifelse
250 t_behave_localopts
251 t_behave_local
252 t_behave_macro_param_shift
253 t_behave_addrcodec
254 t_behave_vexpr
255 t_behave_call_ret
256 t_behave_xcall
257 t_behave_vpospar
258 t_behave_atxplode
259 t_behave_read
261 t_behave_mbox
262 t_behave_maildir
263 t_behave_record_a_resend
264 t_behave_e_H_L_opts
266 t_behave_alternates
267 t_behave_alias
268 # FIXME t_behave_mlist
269 t_behave_filetype
271 t_behave_message_injections
272 t_behave_attachments
273 t_behave_compose_hooks
274 t_behave_C_opt_customhdr
275 t_behave_quote_a_cmd_escapes
277 t_behave_mass_recipients
278 t_behave_mime_types_load_control
279 t_behave_lreply_futh_rth_etc
281 t_behave_mime_if_not_ascii
282 t_behave_xxxheads_rfc2047
283 t_behave_rfc2231
284 t_behave_iconv_mbyte_base64
285 t_behave_iconv_mainbody
286 t_behave_binary_mainbody
287 t_behave_q_t_etc_opts
289 t_behave_s_mime
292 t_behave_X_opt_input_command_stack() {
293 t_prolog t_behave_X_opt_input_command_stack
295 ${cat} <<- '__EOT' > "${BODY}"
296 echo 1
297 define mac0 {
298 echo mac0-1 via1 $0
300 call mac0
301 echo 2
302 source '\
303 echo "define mac1 {";\
304 echo " echo mac1-1 via1 \$0";\
305 echo " call mac0";\
306 echo " echo mac1-2";\
307 echo " call mac2";\
308 echo " echo mac1-3";\
309 echo "}";\
310 echo "echo 1-1";\
311 echo "define mac2 {";\
312 echo " echo mac2-1 via1 \$0";\
313 echo " call mac0";\
314 echo " echo mac2-2";\
315 echo "}";\
316 echo "echo 1-2";\
317 echo "call mac1";\
318 echo "echo 1-3";\
319 echo "source \"\
320 echo echo 1-1-1 via1 \$0;\
321 echo call mac0;\
322 echo echo 1-1-2;\
323 | \"";\
324 echo "echo 1-4";\
326 echo 3
327 call mac2
328 echo 4
329 undefine *
330 __EOT
332 # The -X option supports multiline arguments, and those can internally use
333 # reverse solidus newline escaping. And all -X options are joined...
334 APO=\'
335 < "${BODY}" ${MAILX} ${ARGS} \
336 -X 'e\' \
337 -X ' c\' \
338 -X ' h\' \
339 -X ' o \' \
340 -X 1 \
342 define mac0 {
343 echo mac0-1 via2 $0
345 call mac0
346 echo 2
349 source '${APO}'\
350 echo "define mac1 {";\
351 echo " echo mac1-1 via2 \$0";\
352 echo " call mac0";\
353 echo " echo mac1-2";\
354 echo " call mac2";\
355 echo " echo mac1-3";\
356 echo "}";\
357 echo "echo 1-1";\
358 echo "define mac2 {";\
359 echo " echo mac2-1 via2 \$0";\
360 echo " call mac0";\
361 echo " echo mac2-2";\
362 echo "}";\
363 echo "echo 1-2";\
364 echo "call mac1";\
365 echo "echo 1-3";\
366 echo "source \"\
367 echo echo 1-1-1 via2 \$0;\
368 echo call mac0;\
369 echo echo 1-1-2;\
370 | \"";\
371 echo "echo 1-4";\
372 | '${APO}'
373 echo 3
376 call mac2
377 echo 4
378 undefine *
379 ' > "${MBOX}"
381 check behave:x_opt_input_command_stack 0 "${MBOX}" '1786542668 416'
383 t_epilog
386 t_behave_X_errexit() {
387 t_prolog t_behave_X_errexit
388 if have_feat uistrings; then :; else
389 echo 'behave:x_errexit: unsupported, skipped'
390 return
393 ${cat} <<- '__EOT' > "${BODY}"
394 echo one
395 echos nono
396 echo two
397 __EOT
399 </dev/null ${MAILX} ${ARGS} -Snomemdebug \
400 -X'echo one' -X' echos nono ' -X'echo two' \
401 > "${MBOX}" 2>&1
402 check behave:x_errexit-1 0 "${MBOX}" '916157812 53'
404 </dev/null ${MAILX} ${ARGS} -X'source '"${BODY}" -Snomemdebug \
405 > "${MBOX}" 2>&1
406 check behave:x_errexit-2 0 "${MBOX}" '916157812 53'
408 </dev/null MAILRC="${BODY}" ${MAILX} ${ARGS} -:u -Snomemdebug \
409 > "${MBOX}" 2>&1
410 check behave:x_errexit-3 0 "${MBOX}" '916157812 53'
414 </dev/null ${MAILX} ${ARGS} -Serrexit -Snomemdebug \
415 -X'echo one' -X' echos nono ' -X'echo two' \
416 > "${MBOX}" 2>&1
417 check behave:x_errexit-4 1 "${MBOX}" '2118430867 49'
419 </dev/null ${MAILX} ${ARGS} -X'source '"${BODY}" -Serrexit -Snomemdebug \
420 > "${MBOX}" 2>&1
421 check behave:x_errexit-5 1 "${MBOX}" '2118430867 49'
423 </dev/null MAILRC="${BODY}" ${MAILX} ${ARGS} -:u -Serrexit -Snomemdebug \
424 > "${MBOX}" 2>&1
425 check behave:x_errexit-6 1 "${MBOX}" '12955965 172'
427 </dev/null MAILRC="${BODY}" ${MAILX} ${ARGS} -:u -Sposix -Snomemdebug \
428 > "${MBOX}" 2>&1
429 check behave:x_errexit-7 1 "${MBOX}" '12955965 172'
431 ## Repeat 4-7 with ignerr set
433 ${sed} -e 's/^echos /ignerr echos /' < "${BODY}" > "${MBOX}"
435 </dev/null ${MAILX} ${ARGS} -Serrexit -Snomemdebug \
436 -X'echo one' -X'ignerr echos nono ' -X'echo two' \
437 > "${BODY}" 2>&1
438 check behave:x_errexit-8 0 "${BODY}" '916157812 53'
440 </dev/null ${MAILX} ${ARGS} -X'source '"${MBOX}" -Serrexit -Snomemdebug \
441 > "${BODY}" 2>&1
442 check behave:x_errexit-9 0 "${BODY}" '916157812 53'
444 </dev/null MAILRC="${MBOX}" ${MAILX} ${ARGS} -:u -Serrexit -Snomemdebug \
445 > "${BODY}" 2>&1
446 check behave:x_errexit-10 0 "${BODY}" '916157812 53'
448 </dev/null MAILRC="${MBOX}" ${MAILX} ${ARGS} -:u -Sposix -Snomemdebug \
449 > "${BODY}" 2>&1
450 check behave:x_errexit-11 0 "${BODY}" '916157812 53'
452 t_epilog
455 t_behave_S_freeze() {
456 t_prolog t_behave_S_freeze
457 oterm=$TERM
458 unset TERM
460 # Test basic assumption
461 </dev/null MAILRC="${BODY}" ${MAILX} ${ARGS} \
462 -X'echo asksub<$asksub> dietcurd<$dietcurd>' \
463 -Xx > "${MBOX}" 2>&1
464 check behave:s_freeze-1 0 "${MBOX}" '270686329 21'
467 ${cat} <<- '__EOT' > "${BODY}"
468 echo asksub<$asksub>
469 set asksub
470 echo asksub<$asksub>
471 __EOT
472 </dev/null MAILRC="${BODY}" ${MAILX} ${ARGS} -:u \
473 -Snoasksub -Sasksub -Snoasksub \
474 -X'echo asksub<$asksub>' -X'set asksub' -X'echo asksub<$asksub>' \
475 -Xx > "${MBOX}" 2>&1
476 check behave:s_freeze-2 0 "${MBOX}" '3182942628 37'
478 ${cat} <<- '__EOT' > "${BODY}"
479 echo asksub<$asksub>
480 unset asksub
481 echo asksub<$asksub>
482 __EOT
483 </dev/null MAILRC="${BODY}" ${MAILX} ${ARGS} -:u \
484 -Snoasksub -Sasksub \
485 -X'echo asksub<$asksub>' -X'unset asksub' -X'echo asksub<$asksub>' \
486 -Xx > "${MBOX}" 2>&1
487 check behave:s_freeze-3 0 "${MBOX}" '2006554293 39'
490 ${cat} <<- '__EOT' > "${BODY}"
491 echo dietcurd<$dietcurd>
492 set dietcurd=cherry
493 echo dietcurd<$dietcurd>
494 __EOT
495 </dev/null MAILRC="${BODY}" ${MAILX} ${ARGS} -:u \
496 -Sdietcurd=strawberry -Snodietcurd -Sdietcurd=vanilla \
497 -X'echo dietcurd<$dietcurd>' -X'unset dietcurd' \
498 -X'echo dietcurd<$dietcurd>' \
499 -Xx > "${MBOX}" 2>&1
500 check behave:s_freeze-4 0 "${MBOX}" '1985768109 65'
502 ${cat} <<- '__EOT' > "${BODY}"
503 echo dietcurd<$dietcurd>
504 unset dietcurd
505 echo dietcurd<$dietcurd>
506 __EOT
507 </dev/null MAILRC="${BODY}" ${MAILX} ${ARGS} -:u \
508 -Sdietcurd=strawberry -Snodietcurd \
509 -X'echo dietcurd<$dietcurd>' -X'set dietcurd=vanilla' \
510 -X'echo dietcurd<$dietcurd>' \
511 -Xx > "${MBOX}" 2>&1
512 check behave:s_freeze-5 0 "${MBOX}" '151574279 51'
514 # TODO once we have a detached one with env=1..
515 if [ -n "`</dev/null ${MAILX} ${ARGS} -X'!echo \$TERM' -Xx`" ]; then
516 echo 'behave:s_freeze-{6,7}: shell sets $TERM, skipped'
517 else
518 ${cat} <<- '__EOT' > "${BODY}"
519 !echo "shell says TERM<$TERM>"
520 echo TERM<$TERM>
521 !echo "shell says TERM<$TERM>"
522 set TERM=cherry
523 !echo "shell says TERM<$TERM>"
524 echo TERM<$TERM>
525 !echo "shell says TERM<$TERM>"
526 __EOT
527 </dev/null MAILRC="${BODY}" ${MAILX} ${ARGS} -:u \
528 -STERM=strawberry -SnoTERM -STERM=vanilla \
529 -X'echo mail<$TERM>' -X'unset TERM' \
530 -X'!echo "shell says TERM<$TERM>"' -X'echo TERM<$TERM>' \
531 -Xx > "${MBOX}" 2>&1
532 check behave:s_freeze-6 0 "${MBOX}" '1211476036 167'
534 ${cat} <<- '__EOT' > "${BODY}"
535 !echo "shell says TERM<$TERM>"
536 echo TERM<$TERM>
537 !echo "shell says TERM<$TERM>"
538 set TERM=cherry
539 !echo "shell says TERM<$TERM>"
540 echo TERM<$TERM>
541 !echo "shell says TERM<$TERM>"
542 __EOT
543 </dev/null MAILRC="${BODY}" ${MAILX} ${ARGS} -:u \
544 -STERM=strawberry -SnoTERM \
545 -X'echo TERM<$TERM>' -X'set TERM=vanilla' \
546 -X'!echo "shell says TERM<$TERM>"' -X'echo TERM<$TERM>' \
547 -Xx > "${MBOX}" 2>&1
548 check behave:s_freeze-7 0 "${MBOX}" '3365080441 132'
551 TERM=$oterm
552 t_epilog
555 t_behave_wysh() {
556 t_prolog t_behave_wysh
558 ${cat} <<- '__EOT' > "${BODY}"
560 echo abcd
561 echo a'b'c'd'
562 echo a"b"c"d"
563 echo a$'b'c$'d'
564 echo 'abcd'
565 echo "abcd"
566 echo $'abcd'
567 echo a\ b\ c\ d
568 echo a 'b c' d
569 echo a "b c" d
570 echo a $'b c' d
572 echo 'a$`"\'
573 echo "a\$\`'\"\\"
574 echo $'a\$`\'\"\\'
575 echo $'a\$`\'"\\'
576 # DIET=CURD TIED=
577 echo 'a${DIET}b${TIED}c\${DIET}d\${TIED}e' # COMMENT
578 echo "a${DIET}b${TIED}c\${DIET}d\${TIED}e"
579 echo $'a${DIET}b${TIED}c\${DIET}d\${TIED}e'
581 echo a$'\101\0101\x41\u0041\u41\U00000041\U41'c
582 echo a$'\u0041\u41\u0C1\U00000041\U41'c
583 echo a$'\377'c
584 echo a$'\0377'c
585 echo a$'\400'c
586 echo a$'\0400'c
587 echo a$'\U1100001'c
589 echo a$'b\0c'd
590 echo a$'b\00c'de
591 echo a$'b\000c'df
592 echo a$'b\0000c'dg
593 echo a$'b\x0c'dh
594 echo a$'b\x00c'di
595 echo a$'b\u0'dj
596 echo a$'b\u00'dk
597 echo a$'b\u000'dl
598 echo a$'b\u0000'dm
599 echo a$'b\U0'dn
600 echo a$'b\U00'do
601 echo a$'b\U000'dp
602 echo a$'b\U0000'dq
603 echo a$'b\U00000'dr
604 echo a$'b\U000000'ds
605 echo a$'b\U0000000'dt
606 echo a$'b\U00000000'du
608 echo a$'\cI'b
609 echo a$'\011'b
610 echo a$'\x9'b
611 echo a$'\u9'b
612 echo a$'\U9'b
613 echo a$'\c@'b c d
614 __EOT
616 if [ -z "${UTF8_LOCALE}" ]; then
617 echo 'Skip behave:wysh_unicode, no UTF8_LOCALE'
618 else
619 < "${BODY}" DIET=CURD TIED= \
620 LC_ALL=${UTF8_LOCALE} ${MAILX} ${ARGS} > "${MBOX}" 2>>${ERR}
621 check behave:wysh_unicode 0 "${MBOX}" '475805847 317'
624 < "${BODY}" DIET=CURD TIED= ${MAILX} ${ARGS} > "${MBOX}" 2>>${ERR}
625 check behave:wysh_c 0 "${MBOX}" '1473887148 321'
627 ${cat} <<- '__EOT' | ${MAILX} ${ARGS} > "${MBOX}"
628 wysh set mager='\hey\'
629 varshow mager
630 wysh set mager="\hey\\"
631 varshow mager
632 wysh set mager=$'\hey\\'
633 varshow mager
634 __EOT
635 check behave:wysh-3 0 "${MBOX}" '1289698238 69'
637 t_epilog
640 t_behave_input_inject_semicolon_seq() {
641 t_prolog t_behave_input_inject_semicolon_seq
643 ${cat} <<- '__EOT' | ${MAILX} ${ARGS} > "${MBOX}"
644 define mydeepmac {
645 echon '(mydeepmac)';
647 define mymac {
648 echon this_is_mymac;call mydeepmac;echon ';';
650 echon one';';call mymac;echon two";";call mymac;echo three$';';
651 define mymac {
652 echon this_is_mymac;call mydeepmac;echon ,TOO'!;';
654 echon one';';call mymac;echon two";";call mymac;echo three$';';
655 __EOT
657 check behave:input_inject_semicolon_seq 0 "${MBOX}" '512117110 140'
659 t_epilog
662 t_behave_commandalias() {
663 t_prolog t_behave_commandalias
665 ${cat} <<- '__EOT' | ${MAILX} ${ARGS} > "${MBOX}"
666 commandalias echo echo hoho
667 echo stop.
668 commandalias X Xx
669 commandalias Xx XxX
670 commandalias XxX XxXx
671 commandalias XxXx XxXxX
672 commandalias XxXxX XxXxXx
673 commandalias XxXxXx echo huhu
674 commandalias XxXxXxX echo huhu
676 commandalias XxXxXx XxXxXxX
678 uncommandalias echo
679 commandalias XxXxXx echo huhu
681 __EOT
683 check behave:commandalias 0 "${MBOX}" '1638809585 36'
685 t_epilog
688 t_behave_ifelse() {
689 t_prolog t_behave_ifelse
691 # Nestable conditions test
692 ${cat} <<- '__EOT' | ${MAILX} ${ARGS} > "${MBOX}"
693 if 0
694 echo 1.err
695 else
696 echo 1.ok
697 endif
698 if 1
699 echo 2.ok
700 else
701 echo 2.err
702 endif
703 if $dietcurd
704 echo 3.err
705 else
706 echo 3.ok
707 endif
708 set dietcurd=yoho
709 if $dietcurd
710 echo 4.ok
711 else
712 echo 4.err
713 endif
714 if $dietcurd == 'yoho'
715 echo 5.ok
716 else
717 echo 5.err
718 endif
719 if $dietcurd @== 'Yoho'
720 echo 5-1.ok
721 else
722 echo 5-1.err
723 endif
724 if $dietcurd == 'Yoho'
725 echo 5-2.err
726 else
727 echo 5-2.ok
728 endif
729 if $dietcurd != 'yoho'
730 echo 6.err
731 else
732 echo 6.ok
733 endif
734 if $dietcurd @!= 'Yoho'
735 echo 6-1.err
736 else
737 echo 6-1.ok
738 endif
739 if $dietcurd != 'Yoho'
740 echo 6-2.ok
741 else
742 echo 6-2.err
743 endif
744 # Nesting
745 if faLse
746 echo 7.err1
747 if tRue
748 echo 7.err2
749 if yEs
750 echo 7.err3
751 else
752 echo 7.err4
753 endif
754 echo 7.err5
755 endif
756 echo 7.err6
757 else
758 echo 7.ok7
759 if YeS
760 echo 7.ok8
761 if No
762 echo 7.err9
763 else
764 echo 7.ok9
765 endif
766 echo 7.ok10
767 else
768 echo 7.err11
769 if yeS
770 echo 7.err12
771 else
772 echo 7.err13
773 endif
774 endif
775 echo 7.ok14
776 endif
777 if r
778 echo 8.ok1
779 if R
780 echo 8.ok2
781 else
782 echo 8.err2
783 endif
784 echo 8.ok3
785 else
786 echo 8.err1
787 endif
788 if s
789 echo 9.err1
790 else
791 echo 9.ok1
792 if S
793 echo 9.err2
794 else
795 echo 9.ok2
796 endif
797 echo 9.ok3
798 endif
799 # `elif'
800 if $dietcurd == 'yohu'
801 echo 10.err1
802 elif $dietcurd == 'yoha'
803 echo 10.err2
804 elif $dietcurd == 'yohe'
805 echo 10.err3
806 elif $dietcurd == 'yoho'
807 echo 10.ok1
808 if $dietcurd == 'yohu'
809 echo 10.err4
810 elif $dietcurd == 'yoha'
811 echo 10.err5
812 elif $dietcurd == 'yohe'
813 echo 10.err6
814 elif $dietcurd == 'yoho'
815 echo 10.ok2
816 if $dietcurd == 'yohu'
817 echo 10.err7
818 elif $dietcurd == 'yoha'
819 echo 10.err8
820 elif $dietcurd == 'yohe'
821 echo 10.err9
822 elif $dietcurd == 'yoho'
823 echo 10.ok3
824 else
825 echo 10.err10
826 endif
827 else
828 echo 10.err11
829 endif
830 else
831 echo 10.err12
832 endif
833 # integer
834 set dietcurd=10
835 if $dietcurd -lt 11
836 echo 11.ok1
837 if $dietcurd -gt 9
838 echo 11.ok2
839 else
840 echo 11.err2
841 endif
842 if $dietcurd -eq 10
843 echo 11.ok3
844 else
845 echo 11.err3
846 endif
847 if $dietcurd -ge 10
848 echo 11.ok4
849 else
850 echo 11.err4
851 endif
852 if $dietcurd -le 10
853 echo 11.ok5
854 else
855 echo 11.err5
856 endif
857 if $dietcurd -ge 11
858 echo 11.err6
859 else
860 echo 11.ok6
861 endif
862 if $dietcurd -le 9
863 echo 11.err7
864 else
865 echo 11.ok7
866 endif
867 else
868 echo 11.err1
869 endif
870 set dietcurd=Abc
871 if $dietcurd < aBd
872 echo 12.ok1
873 if $dietcurd @> abB
874 echo 12.ok2
875 else
876 echo 12.err2
877 endif
878 if $dietcurd @== aBC
879 echo 12.ok3
880 else
881 echo 12.err3
882 endif
883 if $dietcurd @>= AbC
884 echo 12.ok4
885 else
886 echo 12.err4
887 endif
888 if $dietcurd @<= ABc
889 echo 12.ok5
890 else
891 echo 12.err5
892 endif
893 if $dietcurd @>= abd
894 echo 12.err6
895 else
896 echo 12.ok6
897 endif
898 if $dietcurd @<= abb
899 echo 12.err7
900 else
901 echo 12.ok7
902 endif
903 else
904 echo 12.err1
905 endif
906 if $dietcurd < aBc
907 echo 12-1.ok
908 else
909 echo 12-1.err
910 endif
911 if $dietcurd @< aBc
912 echo 12-2.err
913 else
914 echo 12-2.ok
915 endif
916 if $dietcurd > ABc
917 echo 12-3.ok
918 else
919 echo 12-3.err
920 endif
921 if $dietcurd @> ABc
922 echo 12-3.err
923 else
924 echo 12-3.ok
925 endif
926 if $dietcurd @i=% aB
927 echo 13.ok
928 else
929 echo 13.err
930 endif
931 if $dietcurd =% aB
932 echo 13-1.err
933 else
934 echo 13-1.ok
935 endif
936 if $dietcurd @=% bC
937 echo 14.ok
938 else
939 echo 14.err
940 endif
941 if $dietcurd !% aB
942 echo 15-1.ok
943 else
944 echo 15-1.err
945 endif
946 if $dietcurd @!% aB
947 echo 15-2.err
948 else
949 echo 15-2.ok
950 endif
951 if $dietcurd !% bC
952 echo 15-3.ok
953 else
954 echo 15-3.err
955 endif
956 if $dietcurd @!% bC
957 echo 15-4.err
958 else
959 echo 15-4.ok
960 endif
961 if $dietcurd =% Cd
962 echo 16.err
963 else
964 echo 16.ok
965 endif
966 if $dietcurd !% Cd
967 echo 17.ok
968 else
969 echo 17.err
970 endif
971 set diet=abc curd=abc
972 if $diet == $curd
973 echo 18.ok
974 else
975 echo 18.err
976 endif
977 set diet=abc curd=abcd
978 if $diet != $curd
979 echo 19.ok
980 else
981 echo 19.err
982 endif
983 # 1. Shitty grouping capabilities as of today
984 unset diet curd ndefined
985 if [ [ false ] || [ false ] || [ true ] ] && [ [ false ] || [ true ] ] && \
986 [ yes ]
987 echo 20.ok
988 else
989 echo 20.err
990 endif
991 if [ [ [ [ 0 ] || [ 1 ] ] && [ [ 1 ] || [ 0 ] ] ] && [ 1 ] ] && [ yes ]
992 echo 21.ok
993 else
994 echo 21.err
995 endif
996 if [ [ 1 ] || [ 0 ] || [ 0 ] || [ 0 ] ]
997 echo 22.ok
998 else
999 echo 22.err
1000 endif
1001 if [ [ 1 ] || [ 0 ] || [ 0 ] || [ 0 ] || [ [ 1 ] ] ]
1002 echo 23.ok
1003 else
1004 echo 23.err
1005 endif
1006 if [ [ 1 ] || [ 0 ] || [ 0 ] || [ 0 ] || [ [ 1 ] ] || [ 1 ] ] && [ no ]
1007 echo 24.err
1008 else
1009 echo 24.ok
1010 endif
1011 if [ [ 1 ] || [ 0 ] || [ 0 ] || [ 0 ] || [ [ 1 ] ] || [ 1 ] ] \
1012 && [ no ] || [ yes ]
1013 echo 25.ok
1014 else
1015 echo 25.err
1016 endif
1017 if [ [ [ [ [ [ [ 1 ] ] && [ 1 ] ] && [ 1 ] ] && [ 1 ] ] ] && [ 1 ] ]
1018 echo 26.ok
1019 else
1020 echo 26.err
1021 endif
1022 if [ [ [ [ [ [ [ 1 ] ] && [ 1 ] ] && [ 1 ] ] && [ 1 ] ] ] && [ 0 ] ]
1023 echo 27.err
1024 else
1025 echo 27.ok
1026 endif
1027 if [ [ [ [ [ [ [ 1 ] ] && [ 1 ] ] && [ 0 ] ] && [ 1 ] ] ] && [ 1 ] ]
1028 echo 28.err
1029 else
1030 echo 28.ok
1031 endif
1032 if [ [ [ [ [ [ [ 0 ] ] && [ 1 ] ] && [ 1 ] ] && [ 1 ] ] ] && [ 1 ] ]
1033 echo 29.err
1034 else
1035 echo 29.ok
1036 endif
1037 if [ 1 ] || [ 0 ] || [ 0 ] || [ 0 ] && [ 0 ]
1038 echo 30.err
1039 else
1040 echo 30.ok
1041 endif
1042 if [ 1 ] || [ 0 ] || [ 0 ] || [ 0 ] && [ 1 ]
1043 echo 31.ok
1044 else
1045 echo 31.err
1046 endif
1047 if [ 0 ] || [ 0 ] || [ 0 ] || [ 1 ] && [ 0 ]
1048 echo 32.err
1049 else
1050 echo 32.ok
1051 endif
1052 if [ 0 ] || [ 0 ] || [ 0 ] || [ 1 ] && [ 1 ]
1053 echo 33.ok
1054 else
1055 echo 33.err
1056 endif
1057 if [ 0 ] || [ 0 ] || [ 0 ] || [ 1 ] && [ 0 ] || [ 1 ] && [ 0 ]
1058 echo 34.err
1059 else
1060 echo 34.ok
1061 endif
1062 if [ 0 ] || [ 0 ] || [ 0 ] || [ 1 ] && [ 0 ] || [ 1 ] && [ 1 ]
1063 echo 35.ok
1064 else
1065 echo 35.err
1066 endif
1067 set diet=yo curd=ho
1068 if [ [ $diet == 'yo' ] && [ $curd == 'ho' ] ] && [ $ndefined ]
1069 echo 36.err
1070 else
1071 echo 36.ok
1072 endif
1073 set ndefined
1074 if [ [ $diet == 'yo' ] && [ $curd == 'ho' ] ] && [ $ndefined ]
1075 echo 37.ok
1076 else
1077 echo 37.err
1078 endif
1079 # 2. Shitty grouping capabilities as of today
1080 unset diet curd ndefined
1081 if [ false || false || true ] && [ false || true ] && yes
1082 echo 40.ok
1083 else
1084 echo 40.err
1085 endif
1086 if [ [ [ 0 || 1 ] && [ 1 || 0 ] ] && 1 ] && [ yes ]
1087 echo 41.ok
1088 else
1089 echo 41.err
1090 endif
1091 if [ 1 || 0 || 0 || 0 ]
1092 echo 42.ok
1093 else
1094 echo 42.err
1095 endif
1096 if [ 1 || 0 || 0 || 0 || [ 1 ] ]
1097 echo 43.ok
1098 else
1099 echo 43.err
1100 endif
1101 if [ 1 || 0 || 0 || 0 || [ 1 ] || 1 ] && no
1102 echo 44.err
1103 else
1104 echo 44.ok
1105 endif
1106 if [ 1 || 0 || 0 || 0 || 1 || [ 1 ] ] && no || [ yes ]
1107 echo 45.ok
1108 else
1109 echo 45.err
1110 endif
1111 if [ [ [ [ [ [ 1 ] && 1 ] && 1 ] && 1 ] ] && [ 1 ] ]
1112 echo 46.ok
1113 else
1114 echo 46.err
1115 endif
1116 if [ [ [ [ [ [ 1 ] && 1 ] && 1 ] && [ 1 ] ] ] && 0 ]
1117 echo 47.err
1118 else
1119 echo 47.ok
1120 endif
1121 if [ [ [ [ [ [ [ 1 ] ] && 1 ] && 0 ] && [ 1 ] ] ] && 1 ]
1122 echo 48.err
1123 else
1124 echo 48.ok
1125 endif
1126 if [ [ [ [ [ [ 0 ] && 1 ] && 1 ] && 1 ] ] && 1 ]
1127 echo 49.err
1128 else
1129 echo 49.ok
1130 endif
1131 if 1 || 0 || 0 || 0 && 0
1132 echo 50.err
1133 else
1134 echo 50.ok
1135 endif
1136 if 1 || 0 || 0 || 0 && 1
1137 echo 51.ok
1138 else
1139 echo 51.err
1140 endif
1141 if 0 || 0 || 0 || 1 && 0
1142 echo 52.err
1143 else
1144 echo 52.ok
1145 endif
1146 if 0 || 0 || 0 || 1 && 1
1147 echo 53.ok
1148 else
1149 echo 53.err
1150 endif
1151 if 0 || 0 || 0 || 1 && 0 || 1 && 0
1152 echo 54.err
1153 else
1154 echo 54.ok
1155 endif
1156 if 0 || 0 || 0 || 1 && 0 || 1 && 1
1157 echo 55.ok
1158 else
1159 echo 55.err
1160 endif
1161 set diet=yo curd=ho
1162 if [ $diet == 'yo' && $curd == 'ho' ] && $ndefined
1163 echo 56.err
1164 else
1165 echo 56.ok
1166 endif
1167 if $diet == 'yo' && $curd == 'ho' && $ndefined
1168 echo 57.err
1169 else
1170 echo 57.ok
1171 endif
1172 set ndefined
1173 if [ $diet == 'yo' && $curd == 'ho' ] && $ndefined
1174 echo 57.ok
1175 else
1176 echo 57.err
1177 endif
1178 if $diet == 'yo' && $curd == 'ho' && $ndefined
1179 echo 58.ok
1180 else
1181 echo 58.err
1182 endif
1183 if [ [ [ [ [ [ $diet == 'yo' && $curd == 'ho' && $ndefined ] ] ] ] ] ]
1184 echo 59.ok
1185 else
1186 echo 59.err
1187 endif
1188 # Some more en-braced variables
1189 set diet=yo curd=ho
1190 if ${diet} == ${curd}
1191 echo 70.err
1192 else
1193 echo 70.ok
1194 endif
1195 if ${diet} != ${curd}
1196 echo 71.ok
1197 else
1198 echo 71.err
1199 endif
1200 if $diet == ${curd}
1201 echo 72.err
1202 else
1203 echo 72.ok
1204 endif
1205 if ${diet} == $curd
1206 echo 73.err
1207 else
1208 echo 73.ok
1209 endif
1210 # Unary !
1211 if ! 0 && ! ! 1 && ! ! ! ! 2 && 3
1212 echo 80.ok
1213 else
1214 echo 80.err
1215 endif
1216 if ! 0 && ! [ ! 1 ] && ! [ ! [ ! [ ! 2 ] ] ] && 3
1217 echo 81.ok
1218 else
1219 echo 81.err
1220 endif
1221 if [ ! 0 ] && [ ! [ ! 1 ] ] && [ ! [ ! [ ! [ ! [ 2 ] ] ] ] ] && 3
1222 echo 82.ok
1223 else
1224 echo 82.err
1225 endif
1226 if [ ! 0 ] && [ ! [ ! 1 ] ] && [ ! [ ! [ ! [ ! [ 2 ] ] ] ] ] && ! 3
1227 echo 83.err
1228 else
1229 echo 83.ok
1230 endif
1231 if [ ! 0 ] && [ ! [ ! 1 ] ] && ! [ [ ! [ ! [ ! [ 2 ] ] ] ] ] && ! 3
1232 echo 84.err
1233 else
1234 echo 84.ok
1235 endif
1236 if [ ! 0 ] && ! [ ! [ ! 1 ] ] && [ ! [ ! [ ! [ ! [ 2 ] ] ] ] ] && 3
1237 echo 85.err
1238 else
1239 echo 85.ok
1240 endif
1241 if ! [ ! 0 ] && [ ! [ ! 1 ] ] && [ ! [ ! [ ! [ ! [ 2 ] ] ] ] ] && 3
1242 echo 86.err
1243 else
1244 echo 86.ok
1245 endif
1246 if [ ! 0 ] && [ ! [ ! 1 ] ] && [ ! [ ! [ ! [ ! [ 2 ] ] ] ] ] || 3
1247 echo 87.ok
1248 else
1249 echo 87.err
1250 endif
1251 if [ ! 0 ] && [ ! ! [ ! ! 1 ] ] && [ ! ! [ ! ! [ ! ! [ ! ! [ 2 ] ] ] ] ]
1252 echo 88.ok
1253 else
1254 echo 88.err
1255 endif
1256 # Unary !, odd
1257 if ! 0 && ! ! 1 && ! ! ! 0 && 3
1258 echo 90.ok
1259 else
1260 echo 90.err
1261 endif
1262 if ! 0 && ! [ ! 1 ] && ! [ ! [ ! [ 0 ] ] ] && 3
1263 echo 91.ok
1264 else
1265 echo 91.err
1266 endif
1267 if [ ! 0 ] && [ ! [ ! 1 ] ] && [ ! [ ! [ ! [ [ 0 ] ] ] ] ] && 3
1268 echo 92.ok
1269 else
1270 echo 92.err
1271 endif
1272 if [ ! 0 ] && [ ! [ ! 1 ] ] && [ ! [ ! ! [ ! [ ! 0 ] ] ] ] && ! 3
1273 echo 93.err
1274 else
1275 echo 93.ok
1276 endif
1277 if [ ! 0 ] && [ ! [ ! 1 ] ] && ! [ ! [ ! [ ! [ ! 0 ] ] ] ] && 3
1278 echo 94.ok
1279 else
1280 echo 94.err
1281 endif
1282 if [ ! 0 ] && ! [ ! [ ! 1 ] ] && [ ! ! [ ! [ ! [ ! [ 0 ] ] ] ] ] && 3
1283 echo 95.err
1284 else
1285 echo 95.ok
1286 endif
1287 if ! [ ! 0 ] && [ ! [ ! 1 ] ] && [ ! [ ! [ ! [ ! ! 0 ] ] ] ] && 3
1288 echo 96.err
1289 else
1290 echo 96.ok
1291 endif
1292 if [ ! 0 ] && [ ! [ ! 1 ] ] && [ ! [ ! [ ! [ ! [ ! 0 ] ] ] ] ] || 3
1293 echo 97.ok
1294 else
1295 echo 97.err
1296 endif
1297 if [ ! 0 ] && [ ! ! [ ! ! 1 ] ] && [ ! ! [ ! ! [ ! ! [ ! [ 0 ] ] ] ] ]
1298 echo 98.ok
1299 else
1300 echo 98.err
1301 endif
1302 __EOT
1304 check behave:if-normal 0 "${MBOX}" '1688759742 719'
1306 if have_feat regex; then
1307 ${cat} <<- '__EOT' | ${MAILX} ${ARGS} > "${MBOX}"
1308 set dietcurd=yoho
1309 if $dietcurd =~ '^yo.*'
1310 echo 1.ok
1311 else
1312 echo 1.err
1313 endif
1314 if $dietcurd =~ '^Yo.*'
1315 echo 1-1.err
1316 else
1317 echo 1-1.ok
1318 endif
1319 if $dietcurd @=~ '^Yo.*'
1320 echo 1-2.ok
1321 else
1322 echo 1-2.err
1323 endif
1324 if $dietcurd =~ '^yOho.+'
1325 echo 2.err
1326 else
1327 echo 2.ok
1328 endif
1329 if $dietcurd @!~ '.*Ho$'
1330 echo 3.err
1331 else
1332 echo 3.ok
1333 endif
1334 if $dietcurd !~ '.+yohO$'
1335 echo 4.ok
1336 else
1337 echo 4.err
1338 endif
1339 if [ $dietcurd @i!~ '.+yoho$' ]
1340 echo 5.ok
1341 else
1342 echo 5.err
1343 endif
1344 if ! [ $dietcurd @i=~ '.+yoho$' ]
1345 echo 6.ok
1346 else
1347 echo 6.err
1348 endif
1349 if ! ! [ $dietcurd @i!~ '.+yoho$' ]
1350 echo 7.ok
1351 else
1352 echo 7.err
1353 endif
1354 if ! [ ! [ $dietcurd @i!~ '.+yoho$' ] ]
1355 echo 8.ok
1356 else
1357 echo 8.err
1358 endif
1359 if [ ! [ ! [ $dietcurd @i!~ '.+yoho$' ] ] ]
1360 echo 9.ok
1361 else
1362 echo 9.err
1363 endif
1364 if ! [ ! [ ! [ $dietcurd !~ '.+yoho$' ] ] ]
1365 echo 10.err
1366 else
1367 echo 10.ok
1368 endif
1369 if ! ! ! $dietcurd !~ '.+yoho$'
1370 echo 11.err
1371 else
1372 echo 11.ok
1373 endif
1374 if ! ! ! $dietcurd =~ '.+yoho$'
1375 echo 12.ok
1376 else
1377 echo 12.err
1378 endif
1379 if ! [ ! ! [ ! [ $dietcurd !~ '.+yoho$' ] ] ]
1380 echo 13.ok
1381 else
1382 echo 13.err
1383 endif
1384 set diet=abc curd='^abc$'
1385 if $diet =~ $curd
1386 echo 14.ok
1387 else
1388 echo 14.err
1389 endif
1390 set diet=abc curd='^abcd$'
1391 if $diet !~ $curd
1392 echo 15.ok
1393 else
1394 echo 15.err
1395 endif
1396 __EOT
1398 check behave:if-regex 0 "${MBOX}" '1115671789 95'
1399 else
1400 printf 'behave:if-regex: unsupported, skipped\n'
1403 t_epilog
1406 t_behave_localopts() {
1407 t_prolog t_behave_localopts
1409 # Nestable conditions test
1410 ${cat} <<- '__EOT' | ${MAILX} ${ARGS} > "${MBOX}" 2>&1
1411 define t2 {
1412 echo in: t2
1413 set t2=t2
1414 echo $t2
1416 define t1 {
1417 echo in: t1
1418 set gv1=gv1
1419 localopts on
1420 set lv1=lv1 lv2=lv2
1421 set lv3=lv3
1422 call t2
1423 localopts off
1424 set gv2=gv2
1425 echo $gv1 $lv1 ${lv2} ${lv3} ${gv2}, $t2
1427 define t0 {
1428 echo in: t0
1429 call t1
1430 echo $gv1 $lv1 ${lv2} ${lv3} ${gv2}, $t2
1431 echo "$gv1 $lv1 ${lv2} ${lv3} ${gv2}, $t2"
1433 account trouble {
1434 echo in: trouble
1435 call t0
1437 call t0
1438 unset gv1 gv2
1439 account trouble
1440 echo active trouble: $gv1 $lv1 ${lv2} ${lv3} ${gv2}, $t3
1441 account null
1442 echo active null: $gv1 $lv1 ${lv2} ${lv3} ${gv2}, $t3
1445 define ll2 {
1446 localopts $1
1447 set x=2
1448 echo ll2=$x
1450 define ll1 {
1451 wysh set y=$1; shift; eval localopts $y; localopts $1; shift
1452 set x=1
1453 echo ll1.1=$x
1454 call ll2 $1
1455 echo ll1.2=$x
1457 define ll0 {
1458 wysh set y=$1; shift; eval localopts $y; localopts $1; shift
1459 set x=0
1460 echo ll0.1=$x
1461 call ll1 $y "$@"
1462 echo ll0.2=$x
1464 define llx {
1465 echo ----- $1: $2 -> $3 -> $4
1466 echo ll-1.1=$x
1467 eval localopts $1
1468 call ll0 "$@"
1469 echo ll-1.2=$x
1470 unset x
1472 define lly {
1473 call llx 'call off' on on on
1474 call llx 'call off' off on on
1475 call llx 'call off' on off on
1476 call llx 'call off' on off off
1477 localopts call-fixate on
1478 call llx 'call-fixate on' on on on
1479 call llx 'call-fixate on' off on on
1480 call llx 'call-fixate on' on off on
1481 call llx 'call-fixate on' on off off
1482 unset x;localopts call on
1483 call llx 'call on' on on on
1484 call llx 'call on' off on on
1485 call llx 'call on' on off on
1486 call llx 'call on' on off off
1488 call lly
1489 __EOT
1491 check behave:localopts 0 "${MBOX}" '4016155249 1246'
1493 t_epilog
1496 t_behave_local() {
1497 t_prolog t_behave_local
1499 ${cat} <<- '__EOT' | ${MAILX} ${ARGS} > "${MBOX}" 2>&1
1500 define du2 {
1501 echo du2-1 du=$du
1502 local set du=$1
1503 echo du2-2 du=$du
1504 local unset du
1505 echo du2-3 du=$du
1507 define du {
1508 local set du=dudu
1509 echo du-1 du=$du
1510 call du2 du2du2
1511 echo du-2 du=$du
1512 local set nodu
1513 echo du-3 du=$du
1515 define ich {
1516 echo ich-1 du=$du
1517 call du
1518 echo ich-2 du=$du
1520 define wir {
1521 localopts $1
1522 set du=wirwir
1523 echo wir-1 du=$du
1524 call ich
1525 echo wir-2 du=$du
1527 echo ------- global-1 du=$du
1528 call ich
1529 echo ------- global-2 du=$du
1530 set du=global
1531 call ich
1532 echo ------- global-3 du=$du
1533 call wir on
1534 echo ------- global-4 du=$du
1535 call wir off
1536 echo ------- global-5 du=$du
1537 __EOT
1539 check behave:local-1 0 "${MBOX}" '2411598140 641'
1541 t_epilog
1544 t_behave_macro_param_shift() {
1545 t_prolog t_behave_macro_param_shift
1547 ${cat} <<- '__EOT' | ${MAILX} ${ARGS} > "${MBOX}" 2>>${ERR}
1548 define t2 {
1549 echo in: t2
1550 echo t2.0 has $#/${#} parameters: "$1,${2},$3" (${*}) [$@]
1551 localopts on
1552 wysh set ignerr=$1
1553 shift
1554 localopts off
1555 echo t2.1 has $#/${#} parameters: "$1,${2},$3" (${*}) [$@]
1556 if [ $# > 1 ] || [ $ignerr == '' ]
1557 shift 2
1558 else
1559 ignerr shift 2
1560 endif
1561 echo t2.2:$? has $#/${#} parameters: "$1,${2},$3" (${*}) [$@]
1562 shift 0
1563 echo t2.3:$? has $#/${#} parameters: "$1,${2},$3" (${*}) [$@]
1564 if [ $# > 0 ]
1565 shift
1566 endif
1567 echo t2.4:$? has $#/${#} parameters: "$1,${2},$3" (${*}) [$@]
1569 define t1 {
1570 set errexit
1571 echo in: t1
1572 call t2 1 you get four args
1573 echo t1.1: $?';' ignerr ($ignerr) should not exist
1574 call t2 1 you get 'three args'
1575 echo t1.2: $?';' ignerr ($ignerr) should not exist
1576 call t2 1 you 'get two args'
1577 echo t1.3: $?';' ignerr ($ignerr) should not exist
1578 call t2 1 'you get one arg'
1579 echo t1.4: $?';' ignerr ($ignerr) should not exist
1580 ignerr call t2 '' 'you get one arg'
1581 echo t1.5: $?';' ignerr ($ignerr) should not exist
1583 call t1
1584 __EOT
1586 check behave:macro_param_shift 0 "${MBOX}" '1402489146 1682'
1588 t_epilog
1591 t_behave_addrcodec() {
1592 t_prolog t_behave_addrcodec
1594 ${cat} <<- '__EOT' | ${MAILX} ${ARGS} > "${MBOX}" 2>&1
1595 vput addrcodec res e 1 <doog@def>
1596 echo $?/$^ERRNAME $res
1597 eval vput addrcodec res d $res
1598 echo $?/$^ERRNAME $res
1599 vput addrcodec res e 2 . <doog@def>
1600 echo $?/$^ERRNAME $res
1601 eval vput addrcodec res d $res
1602 echo $?/$^ERRNAME $res
1603 vput addrcodec res e 3 Sauer Dr. <doog@def>
1604 echo $?/$^ERRNAME $res
1605 eval vput addrcodec res d $res
1606 echo $?/$^ERRNAME $res
1607 vput addrcodec res e 3.50 Sauer (Ma) Dr. <doog@def>
1608 echo $?/$^ERRNAME $res
1609 eval vput addrcodec res d $res
1610 echo $?/$^ERRNAME $res
1611 vput addrcodec res e 3.51 Sauer (Ma) "Dr." <doog@def>
1612 echo $?/$^ERRNAME $res
1613 eval vput addrcodec res d $res
1614 echo $?/$^ERRNAME $res
1616 vput addrcodec res +e 4 Sauer (Ma) Dr. <doog@def>
1617 echo $?/$^ERRNAME $res
1618 eval vput addrcodec res d $res
1619 echo $?/$^ERRNAME $res
1620 vput addrcodec res +e 5 Sauer (Ma) Braten Dr. <doog@def>
1621 echo $?/$^ERRNAME $res
1622 eval vput addrcodec res d $res
1623 echo $?/$^ERRNAME $res
1624 vput addrcodec res +e 6 Sauer (Ma) Braten Dr. (Heu) <doog@def>
1625 echo $?/$^ERRNAME $res
1626 eval vput addrcodec res d $res
1627 echo $?/$^ERRNAME $res
1628 vput addrcodec res +e 7 Sauer (Ma) Braten Dr. (Heu) <doog@def> (bu)
1629 echo $?/$^ERRNAME $res
1630 eval vput addrcodec res d $res
1631 echo $?/$^ERRNAME $res
1632 vput addrcodec res +e 8 \
1633 Dr. Sauer (Ma) Braten Dr. (Heu) <doog@def> (bu) Boom. Boom
1634 echo $?/$^ERRNAME $res
1635 eval vput addrcodec res d $res
1636 echo $?/$^ERRNAME $res
1637 vput addrcodec res +e 9 Dr.Sauer(Ma)Braten Dr. (Heu) <doog@def>
1638 echo $?/$^ERRNAME $res
1639 eval vput addrcodec res d $res
1640 echo $?/$^ERRNAME $res
1641 vput addrcodec res +e 10 (Ma)Braten Dr. (Heu) <doog@def>
1642 echo $?/$^ERRNAME $res
1643 eval vput addrcodec res d $res
1644 echo $?/$^ERRNAME $res
1645 vput addrcodec res +e 11 (Ma)Braten Dr"." (Heu) <doog@def>
1646 echo $?/$^ERRNAME $res
1647 eval vput addrcodec res d $res
1648 echo $?/$^ERRNAME $res
1649 vput addrcodec res +e 12 Dr. Sauer (Ma) Braten Dr. (u) <doog@def>
1650 echo $?/$^ERRNAME $res
1651 eval vput addrcodec res d $res
1652 echo $?/$^ERRNAME $res
1653 vput addrcodec res +e 13(Ma)Braten Dr. (Heu) <doog@def>
1654 echo $?/$^ERRNAME $res
1655 eval vput addrcodec res d $res
1656 echo $?/$^ERRNAME $res
1657 vput addrcodec res +e 14 Hey, Du <doog@def> Wie() findet Dr. das? ()
1658 echo $?/$^ERRNAME $res
1659 eval vput addrcodec res d $res
1660 echo $?/$^ERRNAME $res
1661 vput addrcodec res +e 15 \
1662 Hey, Du <doog@def> Wie() findet "" Dr. "" das? ()
1663 echo $?/$^ERRNAME $res
1664 eval vput addrcodec res d $res
1665 echo $?/$^ERRNAME $res
1666 vput addrcodec res +e 16 \
1667 "Hey," "Du" <doog@def> "Wie()" findet "" Dr. "" das? ()
1668 echo $?/$^ERRNAME $res
1669 eval vput addrcodec res d $res
1670 echo $?/$^ERRNAME $res
1671 vput addrcodec res +e 17 \
1672 "Hey" Du <doog@def> "Wie() findet " " Dr. """ das? ()
1673 echo $?/$^ERRNAME $res
1674 eval vput addrcodec res d $res
1675 echo $?/$^ERRNAME $res
1676 vput addrcodec res +e 18 \
1677 <doog@def> "Hey" Du "Wie() findet " " Dr. """ das? ()
1678 echo $?/$^ERRNAME $res
1679 eval vput addrcodec res d $res
1680 echo $?/$^ERRNAME $res
1681 vput addrcodec res +e 19 Hey\,\" <doog@def> "Wie()" findet \" Dr. \" das?
1682 echo $?/$^ERRNAME $res
1683 eval vput addrcodec res d $res
1684 echo $?/$^ERRNAME $res
1686 vput addrcodec res ++e 20 Hey\,\" <doog@def> "Wie()" findet \" Dr. \" das?
1687 echo $?/$^ERRNAME $res
1688 vput addrcodec res ++e 21 Hey\,\"" <doog@def> "Wie()" findet \" Dr. \" das?
1689 echo $?/$^ERRNAME $res
1690 eval vput addrcodec res d $res
1691 echo $?/$^ERRNAME $res
1693 vput addrcodec res +++e 22 Hey\\,\" <doog@def> "Wie()" findet \" Dr. \" das?
1694 echo $?/$^ERRNAME $res
1695 eval vput addrcodec res d $res
1696 echo $?/$^ERRNAME $res
1698 vput addrcodec res s \
1699 "23 Hey\\,\\\" \"Wie" () "\" findet \\\" Dr. \\\" das?" <doog@def>
1700 echo $?/$^ERRNAME $res
1702 # Fix for [f3852f88]
1703 vput addrcodec res ++e <from2@exam.ple> 100 (comment) "Quot(e)d"
1704 echo $?/$^ERRNAME $res
1705 eval vput addrcodec res d $res
1706 echo $?/$^ERRNAME $res
1707 vput addrcodec res e <from2@exam.ple> 100 (comment) "Quot(e)d"
1708 echo $?/$^ERRNAME $res
1709 eval vput addrcodec res d $res
1710 echo $?/$^ERRNAME $res
1711 __EOT
1713 check behave:addrcodec-1 0 "${MBOX}" '1047317989 2612'
1715 ${cat} <<- '__EOT' | ${MAILX} ${ARGS} > "${MBOX}" 2>&1
1716 mlist isa1@list
1717 mlsubscribe isa2@list
1719 vput addrcodec res skin Hey\\,\" <isa0@list> "Wie()" find \" Dr. \" das?
1720 echo $?/$^ERRNAME $res
1721 vput addrcodec res skinlist Hey\\,\" <isa0@list> "Wie()" find \" Dr. \" das?
1722 echo $?/$^ERRNAME $res
1723 vput addrcodec res skin Hey\\,\" <isa1@list> "Wie()" find \" Dr. \" das?
1724 echo $?/$^ERRNAME $res
1725 vput addrcodec res skinlist Hey\\,\" <isa1@list> "Wie()" find \" Dr. \" das?
1726 echo $?/$^ERRNAME $res
1727 vput addrcodec res skin Hey\\,\" <isa2@list> "Wie()" find \" Dr. \" das?
1728 echo $?/$^ERRNAME $res
1729 vput addrcodec res skinlist Hey\\,\" <isa2@list> "Wie()" find \" Dr. \" das?
1730 echo $?/$^ERRNAME $res
1731 __EOT
1733 check behave:addrcodec-2 0 "${MBOX}" '1391779299 104'
1735 if have_feat idna; then
1736 ${cat} <<- '__EOT' | ${MAILX} ${ARGS} ${ADDARG_UNI} > "${MBOX}" 2>&1
1737 vput addrcodec res e (heu) <du@blödiän> "stroh" du
1738 echo $?/$^ERRNAME $res
1739 eval vput addrcodec res d $res
1740 echo $?/$^ERRNAME $res
1741 vput addrcodec res e <du@blödiän> du
1742 echo $?/$^ERRNAME $res
1743 eval vput addrcodec res d $res
1744 echo $?/$^ERRNAME $res
1745 vput addrcodec res e du <du@blödiän>
1746 echo $?/$^ERRNAME $res
1747 eval vput addrcodec res d $res
1748 echo $?/$^ERRNAME $res
1749 vput addrcodec res e <du@blödiän>
1750 echo $?/$^ERRNAME $res
1751 eval vput addrcodec res d $res
1752 echo $?/$^ERRNAME $res
1753 vput addrcodec res e du@blödiän
1754 echo $?/$^ERRNAME $res
1755 eval vput addrcodec res d $res
1756 echo $?/$^ERRNAME $res
1757 __EOT
1759 check behave:addrcodec-idna 0 "${MBOX}" '498775983 326'
1760 else
1761 printf 'behave:addrcodec-idna: unsupported, skipped\n'
1764 t_epilog
1767 t_behave_vexpr() {
1768 t_prolog t_behave_vexpr
1770 ${cat} <<- '__EOT' | ${MAILX} ${ARGS} > "${MBOX}" 2>>${ERR}
1771 echo ' #0.0'
1772 vput vexpr res = 9223372036854775807
1773 echo $?/$^ERRNAME $res
1774 vput vexpr res = 9223372036854775808
1775 echo $?/$^ERRNAME $res
1776 vput vexpr res = u9223372036854775808
1777 echo $?/$^ERRNAME $res
1778 vput vexpr res @= 9223372036854775808
1779 echo $?/$^ERRNAME $res
1780 vput vexpr res = -9223372036854775808
1781 echo $?/$^ERRNAME $res
1782 vput vexpr res = -9223372036854775809
1783 echo $?/$^ERRNAME $res
1784 vput vexpr res @= -9223372036854775809
1785 echo $?/$^ERRNAME $res
1786 vput vexpr res = U9223372036854775809
1787 echo $?/$^ERRNAME $res
1788 echo ' #0.1'
1789 vput vexpr res = \
1790 0b0111111111111111111111111111111111111111111111111111111111111111
1791 echo $?/$^ERRNAME $res
1792 vput vexpr res = \
1793 S0b1000000000000000000000000000000000000000000000000000000000000000
1794 echo $?/$^ERRNAME $res
1795 vput vexpr res @= \
1796 S0b1000000000000000000000000000000000000000000000000000000000000000
1797 echo $?/$^ERRNAME $res
1798 vput vexpr res = \
1799 U0b1000000000000000000000000000000000000000000000000000000000000000
1800 echo $?/$^ERRNAME $res
1801 vput vexpr res = \
1802 0b1000000000000000000000000000000000000000000000000000000000000000
1803 echo $?/$^ERRNAME $res
1804 vput vexpr res @= \
1805 0b1000000000000000000000000000000000000000000000000000000000000000
1806 echo $?/$^ERRNAME $res
1807 vput vexpr res = \
1808 -0b1000000000000000000000000000000000000000000000000000000000000000
1809 echo $?/$^ERRNAME $res
1810 vput vexpr res = \
1811 S0b1000000000000000000000000000000000000000000000000000000000000001
1812 echo $?/$^ERRNAME $res
1813 vput vexpr res @= \
1814 S0b1000000000000000000000000000000000000000000000000000000000000001
1815 echo $?/$^ERRNAME $res
1816 vput vexpr res @= \
1817 -0b1000000000000000000000000000000000000000000000000000000000000001
1818 echo $?/$^ERRNAME $res
1819 vput vexpr res = \
1820 U0b1000000000000000000000000000000000000000000000000000000000000001
1821 echo $?/$^ERRNAME $res
1822 echo ' #0.2'
1823 vput vexpr res = 0777777777777777777777
1824 echo $?/$^ERRNAME $res
1825 vput vexpr res = S01000000000000000000000
1826 echo $?/$^ERRNAME $res
1827 vput vexpr res @= S01000000000000000000000
1828 echo $?/$^ERRNAME $res
1829 vput vexpr res = U01000000000000000000000
1830 echo $?/$^ERRNAME $res
1831 vput vexpr res = 01000000000000000000000
1832 echo $?/$^ERRNAME $res
1833 vput vexpr res @= 01000000000000000000000
1834 echo $?/$^ERRNAME $res
1835 vput vexpr res = -01000000000000000000000
1836 echo $?/$^ERRNAME $res
1837 vput vexpr res = S01000000000000000000001
1838 echo $?/$^ERRNAME $res
1839 vput vexpr res @= S01000000000000000000001
1840 echo $?/$^ERRNAME $res
1841 vput vexpr res @= -01000000000000000000001
1842 echo $?/$^ERRNAME $res
1843 vput vexpr res = U01000000000000000000001
1844 echo $?/$^ERRNAME $res
1845 echo ' #0.3'
1846 vput vexpr res = 0x7FFFFFFFFFFFFFFF
1847 echo $?/$^ERRNAME $res
1848 vput vexpr res = S0x8000000000000000
1849 echo $?/$^ERRNAME $res
1850 vput vexpr res @= S0x8000000000000000
1851 echo $?/$^ERRNAME $res
1852 vput vexpr res = U0x8000000000000000
1853 echo $?/$^ERRNAME $res
1854 vput vexpr res = 0x8000000000000000
1855 echo $?/$^ERRNAME $res
1856 vput vexpr res @= 0x8000000000000000
1857 echo $?/$^ERRNAME $res
1858 vput vexpr res = -0x8000000000000000
1859 echo $?/$^ERRNAME $res
1860 vput vexpr res = S0x8000000000000001
1861 echo $?/$^ERRNAME $res
1862 vput vexpr res @= S0x8000000000000001
1863 echo $?/$^ERRNAME $res
1864 vput vexpr res @= -0x8000000000000001
1865 echo $?/$^ERRNAME $res
1866 vput vexpr res = u0x8000000000000001
1867 echo $?/$^ERRNAME $res
1868 echo ' #1'
1869 vput vexpr res ~ 0
1870 echo $?/$^ERRNAME $res
1871 vput vexpr res ~ 1
1872 echo $?/$^ERRNAME $res
1873 vput vexpr res ~ -1
1874 echo $?/$^ERRNAME $res
1875 echo ' #2'
1876 vput vexpr res + 0 0
1877 echo $?/$^ERRNAME $res
1878 vput vexpr res + 0 1
1879 echo $?/$^ERRNAME $res
1880 vput vexpr res + 1 1
1881 echo $?/$^ERRNAME $res
1882 echo ' #3'
1883 vput vexpr res + 9223372036854775807 0
1884 echo $?/$^ERRNAME $res
1885 vput vexpr res + 9223372036854775807 1
1886 echo $?/$^ERRNAME $res
1887 vput vexpr res @+ 9223372036854775807 1
1888 echo $?/$^ERRNAME $res
1889 vput vexpr res + 0 9223372036854775807
1890 echo $?/$^ERRNAME $res
1891 vput vexpr res + 1 9223372036854775807
1892 echo $?/$^ERRNAME $res
1893 vput vexpr res @+ 1 9223372036854775807
1894 echo $?/$^ERRNAME $res
1895 echo ' #4'
1896 vput vexpr res + -9223372036854775808 0
1897 echo $?/$^ERRNAME $res
1898 vput vexpr res + -9223372036854775808 -1
1899 echo $?/$^ERRNAME $res
1900 vput vexpr res @+ -9223372036854775808 -1
1901 echo $?/$^ERRNAME $res
1902 vput vexpr res + 0 -9223372036854775808
1903 echo $?/$^ERRNAME $res
1904 vput vexpr res + -1 -9223372036854775808
1905 echo $?/$^ERRNAME $res
1906 vput vexpr res @+ -1 -9223372036854775808
1907 echo $?/$^ERRNAME $res
1908 echo ' #5'
1909 vput vexpr res - 0 0
1910 echo $?/$^ERRNAME $res
1911 vput vexpr res - 0 1
1912 echo $?/$^ERRNAME $res
1913 vput vexpr res - 1 1
1914 echo $?/$^ERRNAME $res
1915 echo ' #6'
1916 vput vexpr res - 9223372036854775807 0
1917 echo $?/$^ERRNAME $res
1918 vput vexpr res - 9223372036854775807 -1
1919 echo $?/$^ERRNAME $res
1920 vput vexpr res @- 9223372036854775807 -1
1921 echo $?/$^ERRNAME $res
1922 vput vexpr res - 0 9223372036854775807
1923 echo $?/$^ERRNAME $res
1924 vput vexpr res - -1 9223372036854775807
1925 echo $?/$^ERRNAME $res
1926 vput vexpr res - -2 9223372036854775807
1927 echo $?/$^ERRNAME $res
1928 vput vexpr res @- -2 9223372036854775807
1929 echo $?/$^ERRNAME $res
1930 echo ' #7'
1931 vput vexpr res - -9223372036854775808 +0
1932 echo $?/$^ERRNAME $res
1933 vput vexpr res - -9223372036854775808 +1
1934 echo $?/$^ERRNAME $res
1935 vput vexpr res @- -9223372036854775808 +1
1936 echo $?/$^ERRNAME $res
1937 vput vexpr res - 0 -9223372036854775808
1938 echo $?/$^ERRNAME $res
1939 vput vexpr res - +1 -9223372036854775808
1940 echo $?/$^ERRNAME $res
1941 vput vexpr res @- +1 -9223372036854775808
1942 echo $?/$^ERRNAME $res
1943 echo ' #8'
1944 vput vexpr res + -13 -2
1945 echo $?/$^ERRNAME $res
1946 vput vexpr res - 0 0
1947 echo $?/$^ERRNAME $res
1948 vput vexpr res - 0 1
1949 echo $?/$^ERRNAME $res
1950 vput vexpr res - 1 1
1951 echo $?/$^ERRNAME $res
1952 vput vexpr res - -13 -2
1953 echo $?/$^ERRNAME $res
1954 echo ' #9'
1955 vput vexpr res * 0 0
1956 echo $?/$^ERRNAME $res
1957 vput vexpr res * 0 1
1958 echo $?/$^ERRNAME $res
1959 vput vexpr res * 1 1
1960 echo $?/$^ERRNAME $res
1961 vput vexpr res * -13 -2
1962 echo $?/$^ERRNAME $res
1963 echo ' #10'
1964 vput vexpr res / 0 0
1965 echo $?/$^ERRNAME $res
1966 vput vexpr res / 0 1
1967 echo $?/$^ERRNAME $res
1968 vput vexpr res / 1 1
1969 echo $?/$^ERRNAME $res
1970 vput vexpr res / -13 -2
1971 echo $?/$^ERRNAME $res
1972 echo ' #11'
1973 vput vexpr res % 0 0
1974 echo $?/$^ERRNAME $res
1975 vput vexpr res % 0 1
1976 echo $?/$^ERRNAME $res
1977 vput vexpr res % 1 1
1978 echo $?/$^ERRNAME $res
1979 vput vexpr res % -13 -2
1980 echo $?/$^ERRNAME $res
1981 __EOT
1983 check behave:vexpr-numeric 0 "${MBOX}" '960821755 1962'
1985 ${cat} <<- '__EOT' | ${MAILX} ${ARGS} > "${MBOX}" 2>&1
1986 vput vexpr res find 'bananarama' 'nana'
1987 echo $?/$^ERRNAME :$res:
1988 vput vexpr res find 'bananarama' 'bana'
1989 echo $?/$^ERRNAME :$res:
1990 vput vexpr res find 'bananarama' 'Bana'
1991 echo $?/$^ERRNAME :$res:
1992 vput vexpr res find 'bananarama' 'rama'
1993 echo $?/$^ERRNAME :$res:
1994 echo ' #1'
1995 vput vexpr res ifind 'bananarama' 'nana'
1996 echo $?/$^ERRNAME :$res:
1997 vput vexpr res ifind 'bananarama' 'bana'
1998 echo $?/$^ERRNAME :$res:
1999 vput vexpr res ifind 'bananarama' 'Bana'
2000 echo $?/$^ERRNAME :$res:
2001 vput vexpr res ifind 'bananarama' 'rama'
2002 echo $?/$^ERRNAME :$res:
2003 echo ' #2'
2004 vput vexpr res substring 'bananarama' 1
2005 echo $?/$^ERRNAME :$res:
2006 vput vexpr res substring 'bananarama' 3
2007 echo $?/$^ERRNAME :$res:
2008 vput vexpr res substring 'bananarama' 5
2009 echo $?/$^ERRNAME :$res:
2010 vput vexpr res substring 'bananarama' 7
2011 echo $?/$^ERRNAME :$res:
2012 vput vexpr res substring 'bananarama' 9
2013 echo $?/$^ERRNAME :$res:
2014 vput vexpr res substring 'bananarama' 10
2015 echo $?/$^ERRNAME :$res:
2016 vput vexpr res substring 'bananarama' 1 3
2017 echo $?/$^ERRNAME :$res:
2018 vput vexpr res substring 'bananarama' 3 3
2019 echo $?/$^ERRNAME :$res:
2020 vput vexpr res substring 'bananarama' 5 3
2021 echo $?/$^ERRNAME :$res:
2022 vput vexpr res substring 'bananarama' 7 3
2023 echo $?/$^ERRNAME :$res:
2024 vput vexpr res substring 'bananarama' 9 3
2025 echo $?/$^ERRNAME :$res:
2026 vput vexpr res substring 'bananarama' 10 3
2027 echo $?/$^ERRNAME :$res:
2028 echo ' #3'
2029 vput vexpr res substring 'bananarama' -1
2030 echo $?/$^ERRNAME :$res:
2031 vput vexpr res substring 'bananarama' -3
2032 echo $?/$^ERRNAME :$res:
2033 vput vexpr res substring 'bananarama' -5
2034 echo $?/$^ERRNAME :$res:
2035 vput vexpr res substring 'bananarama' -7
2036 echo $?/$^ERRNAME :$res:
2037 vput vexpr res substring 'bananarama' -9
2038 echo $?/$^ERRNAME :$res:
2039 vput vexpr res substring 'bananarama' -10
2040 echo $?/$^ERRNAME :$res:
2041 vput vexpr res substring 'bananarama' 1 -3
2042 echo $?/$^ERRNAME :$res:
2043 vput vexpr res substring 'bananarama' 3 -3
2044 echo $?/$^ERRNAME :$res:
2045 vput vexpr res substring 'bananarama' 5 -3
2046 echo $?/$^ERRNAME :$res:
2047 vput vexpr res substring 'bananarama' 7 -3
2048 echo $?/$^ERRNAME :$res:
2049 vput vexpr res substring 'bananarama' 9 -3
2050 echo $?/$^ERRNAME :$res:
2051 vput vexpr res substring 'bananarama' 10 -3
2052 echo $?/$^ERRNAME :$res:
2053 echo ' #4'
2054 vput vexpr res trim 'Cocoon Cocoon'
2055 echo $?/$^ERRNAME :$res:
2056 vput vexpr res trim ' Cocoon Cocoon '
2057 echo $?/$^ERRNAME :$res:
2058 vput vexpr res trim-front 'Cocoon Cocoon'
2059 echo $?/$^ERRNAME :$res:
2060 vput vexpr res trim-front ' Cocoon Cocoon '
2061 echo $?/$^ERRNAME :$res:
2062 vput vexpr res trim-end 'Cocoon Cocoon'
2063 echo $?/$^ERRNAME :$res:
2064 vput vexpr res trim-end ' Cocoon Cocoon '
2065 echo $?/$^ERRNAME :$res:
2066 __EOT
2068 check behave:vexpr-string 0 "${MBOX}" '3182004322 601'
2070 if have_feat regex; then
2071 ${cat} <<- '__EOT' | ${MAILX} ${ARGS} > "${MBOX}" 2>&1
2072 vput vexpr res regex 'bananarama' 'nana'
2073 echo $?/$^ERRNAME :$res:
2074 vput vexpr res regex 'bananarama' 'bana'
2075 echo $?/$^ERRNAME :$res:
2076 vput vexpr res regex 'bananarama' 'Bana'
2077 echo $?/$^ERRNAME :$res:
2078 vput vexpr res regex 'bananarama' 'rama'
2079 echo $?/$^ERRNAME :$res:
2080 echo ' #1'
2081 vput vexpr res iregex 'bananarama' 'nana'
2082 echo $?/$^ERRNAME :$res:
2083 vput vexpr res iregex 'bananarama' 'bana'
2084 echo $?/$^ERRNAME :$res:
2085 vput vexpr res iregex 'bananarama' 'Bana'
2086 echo $?/$^ERRNAME :$res:
2087 vput vexpr res iregex 'bananarama' 'rama'
2088 echo $?/$^ERRNAME :$res:
2089 echo ' #2'
2090 vput vexpr res regex 'bananarama' '(.*)nana(.*)' '\${1}a\${0}u{\$2}'
2091 echo $?/$^ERRNAME :$res:
2092 vput vexpr res regex 'bananarama' '(.*)bana(.*)' '\${1}a\${0}u\$2'
2093 echo $?/$^ERRNAME :$res:
2094 vput vexpr res regex 'bananarama' 'Bana(.+)' '\$1\$0'
2095 echo $?/$^ERRNAME :$res:
2096 vput vexpr res regex 'bananarama' '(.+)rama' '\$1\$0'
2097 echo $?/$^ERRNAME :$res:
2098 echo ' #3'
2099 vput vexpr res iregex 'bananarama' '(.*)nana(.*)' '\${1}a\${0}u{\$2}'
2100 echo $?/$^ERRNAME :$res:
2101 vput vexpr res iregex 'bananarama' '(.*)bana(.*)' '\${1}a\${0}u\$2'
2102 echo $?/$^ERRNAME :$res:
2103 vput vexpr res iregex 'bananarama' 'Bana(.+)' '\$1\$0'
2104 echo $?/$^ERRNAME :$res:
2105 vput vexpr res iregex 'bananarama' '(.+)rama' '\$1\$0'
2106 echo $?/$^ERRNAME :$res:
2107 echo ' #4'
2108 __EOT
2110 check behave:vexpr-regex 0 "${MBOX}" '3270360157 311'
2111 else
2112 printf 'behave:vexpr-regex: unsupported, skipped\n'
2115 t_epilog
2118 t_behave_call_ret() {
2119 t_prolog t_behave_call_ret
2121 ${cat} <<- '__EOT' | ${MAILX} ${ARGS} -Snomemdebug > "${MBOX}" 2>&1
2122 define w1 {
2123 echon ">$1 "
2124 vput vexpr i + $1 1
2125 if [ $i -le 42 ]
2126 vput vexpr j '&' $i 7
2127 if [ $j -eq 7 ]
2128 echo .
2130 call w1 $i
2131 wysh set i=$? k=$!
2132 vput vexpr j '&' $i 7
2133 echon "<$1/$i/$k "
2134 if [ $j -eq 7 ]
2135 echo .
2137 else
2138 echo ! The end for $1
2140 return $1
2142 # Transport $?/$! up the call chain
2143 define w2 {
2144 echon ">$1 "
2145 vput vexpr i + $1 1
2146 if [ $1 -lt 42 ]
2147 call w2 $i
2148 wysh set i=$? j=$! k=$^ERRNAME
2149 echon "<$1/$i/$k "
2150 return $i $j
2151 else
2152 echo ! The end for $1
2153 return $i $^ERR-BUSY
2155 echoerr au
2157 # Up and down it goes
2158 define w3 {
2159 echon ">$1/$2 "
2160 vput vexpr i + $1 1
2161 if [ $1 -lt 42 ]
2162 call w3 $i $2
2163 wysh set i=$? j=$!
2164 vput vexpr k - $1 $2
2165 if [ $k -eq 21 ]
2166 vput vexpr i + $1 1
2167 vput vexpr j + $2 1
2168 echo "# <$i/$j> .. "
2169 call w3 $i $j
2170 wysh set i=$? j=$!
2172 eval echon "<\$1=\$i/\$^ERRNAME-$j "
2173 return $i $j
2174 else
2175 echo ! The end for $1=$i/$2
2176 if [ "$2" != "" ]
2177 return $i $^ERR-DOM
2178 else
2179 return $i $^ERR-BUSY
2182 echoerr au
2185 call w1 0; echo ?=$? !=$!; echo -----;
2186 call w2 0; echo ?=$? !=$^ERRNAME; echo -----;
2187 call w3 0 1; echo ?=$? !=$^ERRNAME; echo -----;
2188 __EOT
2190 check behave:call_ret 0 "${MBOX}" '1572045517 5922'
2192 t_epilog
2195 t_behave_xcall() {
2196 t_prolog t_behave_xcall
2198 ${cat} <<- '__EOT' | ${MAILX} ${ARGS} -Snomemdebug > "${MBOX}" 2>&1
2199 define work {
2200 echon "$1 "
2201 vput vexpr i + $1 1
2202 if [ $i -le 1111 ]
2203 vput vexpr j '&' $i 7
2204 if [ $j -eq 7 ]
2205 echo .
2207 \xcall work $i $2
2209 echo ! The end for $1/$2
2210 if [ "$2" != "" ]
2211 return $i $^ERR-BUSY
2214 define xwork {
2215 \xcall work 0 $2
2217 call work 0
2218 echo ?=$? !=$!
2219 call xwork
2220 echo ?=$? !=$!
2221 xcall xwork
2222 echo ?=$? !=$^ERRNAME
2224 call work 0 yes
2225 echo ?=$? !=$^ERRNAME
2226 call xwork 0 yes
2227 echo ?=$? !=$^ERRNAME
2228 __EOT
2230 check behave:xcall-1 0 "${MBOX}" '2401702082 23801'
2234 if have_feat uistrings; then
2235 ${cat} <<- '__EOT' > "${BODY}"
2236 define __w {
2237 echon "$1 "
2238 vput vexpr i + $1 1
2239 if [ $i -le 111 ]
2240 vput vexpr j '&' $i 7
2241 if [ $j -eq 7 ]
2242 echo .
2244 \xcall __w $i $2
2246 echo ! The end for $1
2247 if [ $2 -eq 0 ]
2248 nonexistingcommand
2249 echo would be err with errexit
2250 return
2252 echo calling exit
2253 exit
2255 define work {
2256 echo eins
2257 call __w 0 0
2258 echo zwei, ?=$? !=$!
2259 localopts yes; set errexit
2260 ignerr call __w 0 0
2261 echo drei, ?=$? !=$^ERRNAME
2262 call __w 0 $1
2263 echo vier, ?=$? !=$^ERRNAME, this is an error
2265 ignerr call work 0
2266 echo outer 1, ?=$? !=$^ERRNAME
2267 xxxign call work 0
2268 echo outer 2, ?=$? !=$^ERRNAME, could be error if xxxign non-empty
2269 call work 1
2270 echo outer 3, ?=$? !=$^ERRNAME
2271 echo this is definitely an error
2272 __EOT
2274 < "${BODY}" ${MAILX} ${ARGS} -X'commandalias xxxign ignerr' \
2275 -Snomemdebug > "${MBOX}" 2>&1
2276 check behave:xcall-2 0 "${MBOX}" '3900716531 4200'
2278 < "${BODY}" ${MAILX} ${ARGS} -X'commandalias xxxign " "' \
2279 -Snomemdebug > "${MBOX}" 2>&1
2280 check behave:xcall-3 1 "${MBOX}" '1006776201 2799'
2281 else
2282 echo 'behave:xcall-2: unsupported, skipped'
2283 echo 'behave:xcall-3: unsupported, skipped'
2286 t_epilog
2289 t_behave_vpospar() {
2290 t_prolog t_behave_vpospar
2292 ${cat} <<- '__EOT' | ${MAILX} ${ARGS} > "${MBOX}" 2>&1
2293 vpospar set hey, "'you ", world!
2294 echo $?/$^ERRNAME/$#: $* / "$@" / <$1><$2><$3><$4>
2295 vput vpospar x quote; echo x<$x>
2296 vpospar clear;echo $?/$^ERRNAME/$#: $* / "$@" / <$1><$2><$3><$4>
2297 vput vpospar y quote;echo y<$y>
2298 eval vpospar set ${x};echo $?/$^ERRNAME/$#: $* / "$@" / <$1><$2><$3><$4>
2299 eval vpospar set ${y};echo $?/$^ERRNAME/$#: $* / "$@" / <$1><$2><$3><$4>
2300 eval vpospar set ${x};echo $?/$^ERRNAME/$#: $* / "$@" / <$1><$2><$3><$4>
2302 define infun2 {
2303 echo infun2:$?/$^ERRNAME/$#:$*/"$@"/<$1><$2><$3><$4>
2304 vput vpospar z quote;echo infun2:z<$z>
2307 define infun {
2308 echo infun:$?/$^ERRNAME/$#:$*/"$@"/<$1><$2><$3><$4>
2309 vput vpospar y quote;echo infun:y<$y>
2310 eval vpospar set ${x};echo infun:$?/$^ERRNAME/$#:$*/"$@"/<$1><$2><$3><$4>
2311 vpospar clear;echo infun:$?/$^ERRNAME/$#:$*/"$@"/<$1><$2><$3><$4>
2312 eval call infun2 $x
2313 echo infun:$?/$^ERRNAME/$#:$*/"$@"/<$1><$2><$3><$4>
2314 eval vpospar set ${y};echo infun:$?/$^ERRNAME/$#:$*/"$@"/<$1><$2><$3><$4>
2317 call infun This "in a" fun
2318 echo $?/$^ERRNAME/$#: $* / "$@" / <$1><$2><$3><$4>
2319 vpospar clear;echo $?/$^ERRNAME/$#: $* / "$@" / <$1><$2><$3><$4>
2320 __EOT
2321 check behave:vpospar-1 0 "${MBOX}" '155175639 866'
2324 ${cat} <<- '__EOT' | ${MAILX} ${ARGS} > "${MBOX}" 2>&1
2325 set ifs=\'
2326 echo ifs<$ifs> ifs-ws<$ifs-ws>
2327 vpospar set hey, "'you ", world!
2328 echo $?/$^ERRNAME/$#: $* / "$@" / <$1><$2><$3><$4>
2329 vput vpospar x quote; echo x<$x>
2330 vpospar clear;echo $?/$^ERRNAME/$#: $* / "$@" / <$1><$2><$3><$4>
2331 eval vpospar set ${x};echo $?/$^ERRNAME/$#: $* / "$@" / <$1><$2><$3><$4>
2333 set ifs=,
2334 echo ifs<$ifs> ifs-ws<$ifs-ws>
2335 vpospar set hey, "'you ", world!
2336 unset ifs;echo $?/$^ERRNAME/$#: $* / "$@" / <$1><$2><$3><$4>
2337 set ifs=,
2338 vput vpospar x quote; echo x<$x>
2339 vpospar clear;echo $?/$^ERRNAME/$#: $* / "$@" / <$1><$2><$3><$4>
2340 eval vpospar set ${x};\
2341 unset ifs;echo $?/$^ERRNAME/$#: $* / "$@" / <$1><$2><$3><$4>
2343 wysh set ifs=$',\t'
2344 echo ifs<$ifs> ifs-ws<$ifs-ws>
2345 vpospar set hey, "'you ", world!
2346 unset ifs; echo $?/$^ERRNAME/$#: $* / "$@" / <$1><$2><$3><$4>
2347 wysh set ifs=$',\t'
2348 vput vpospar x quote; echo x<$x>
2349 vpospar clear;echo $?/$^ERRNAME/$#: $* / "$@" / <$1><$2><$3><$4>
2350 eval vpospar set ${x};\
2351 unset ifs;echo $?/$^ERRNAME/$#: $* / "$@" / <$1><$2><$3><$4>
2352 __EOT
2353 check behave:vpospar-ifs 0 "${MBOX}" '2015927702 706'
2355 t_epilog
2358 t_behave_atxplode() {
2359 t_prolog t_behave_atxplode
2360 TRAP_EXIT_ADDONS="./.t*"
2362 ${cat} > ./.t.sh <<- '___'; ${cat} > ./.t.rc <<- '___'
2363 x() { echo $#; }
2364 xxx() {
2365 printf " (1/$#: <$1>)"
2366 shift
2367 if [ $# -gt 0 ]; then
2368 xxx "$@"
2369 else
2370 echo
2373 yyy() {
2374 eval "$@ ' ball"
2376 set --
2377 x "$@"
2378 x "$@"''
2379 x " $@"
2380 x "$@ "
2381 printf yyy;yyy 'xxx' "b\$'\t'u ' "
2382 printf xxx;xxx arg ,b u.
2383 printf xxx;xxx arg , .
2384 printf xxx;xxx arg ,ball.
2386 define x {
2387 echo $#
2389 define xxx {
2390 echon " (1/$#: <$1>)"
2391 shift
2392 if [ $# -gt 0 ]
2393 \xcall xxx "$@"
2394 endif
2395 echo
2397 define yyy {
2398 eval "$@ ' ball"
2400 vpospar set
2401 call x "$@"
2402 call x "$@"''
2403 call x " $@"
2404 call x "$@ "
2405 echon yyy;call yyy '\call xxx' "b\$'\t'u ' "
2406 echon xxx;call xxx arg ,b u.
2407 echon xxx;call xxx arg , .
2408 echon xxx;call xxx arg ,ball.
2411 ${MAILX} ${ARGS} -X'source ./.t.rc' -Xx > "${MBOX}" 2>&1
2412 check behave:atxplode-1 0 "${MBOX}" '41566293 164'
2414 #${SHELL} ./.t.sh > ./.tshout 2>&1
2415 #check behave:atxplode:disproof-1 0 ./.tshout '41566293 164'
2417 t_epilog
2420 t_behave_read() {
2421 t_prolog t_behave_read
2422 TRAP_EXIT_ADDONS="./.t*"
2424 ${cat} <<- '__EOT' > .tin
2425 hey1, "'you ", world!
2426 hey2, "'you ", bugs bunny!
2427 hey3, "'you ",
2428 hey4, "'you "
2429 __EOT
2431 ${cat} <<- '__EOT' |\
2432 ${MAILX} ${ARGS} -X'readctl create ./.tin' > "${MBOX}" 2>&1
2433 read a b c
2434 echo $?/$^ERRNAME / <$a><$b><$c>
2435 read a b c
2436 echo $?/$^ERRNAME / <$a><$b><$c>
2437 read a b c
2438 echo $?/$^ERRNAME / <$a><$b><$c>
2439 read a b c
2440 echo $?/$^ERRNAME / <$a><$b><$c>
2441 unset a b c;read a b c
2442 echo $?/$^ERRNAME / <$a><$b><$c>
2443 readctl remove ./.tin;echo readctl remove:$?/$^ERRNAME
2444 __EOT
2445 check behave:read-1 0 "${MBOX}" '1527910147 173'
2447 ${cat} <<- '__EOT' > .tin2
2448 hey2.0,:"'you ",:world!:mars.:
2449 hey2.1,:"'you ",:world!
2450 hey2.2,:"'you ",:bugs bunny!
2451 hey2.3,:"'you ",:
2452 hey2.4,:"'you ":
2454 __EOT
2456 ${cat} <<- '__EOT' |\
2457 6< .tin2 ${MAILX} ${ARGS} -X 'readctl create 6' > "${MBOX}" 2>&1
2458 set ifs=:
2459 read a b c
2460 echo $?/$^ERRNAME / <$a><$b><$c>
2461 read a b c
2462 echo $?/$^ERRNAME / <$a><$b><$c>
2463 read a b c
2464 echo $?/$^ERRNAME / <$a><$b><$c>
2465 read a b c
2466 echo $?/$^ERRNAME / <$a><$b><$c>
2467 read a b c
2468 echo $?/$^ERRNAME / <$a><$b><$c>
2469 read a b c
2470 echo $?/$^ERRNAME / <$a><$b><$c>
2471 unset a b c;read a b c
2472 echo $?/$^ERRNAME / <$a><$b><$c>
2473 read a b c
2474 echo $?/$^ERRNAME / <$a><$b><$c>
2475 readctl remove 6;echo readctl remove:$?/$^ERRNAME
2476 __EOT
2477 check behave:read-ifs 0 "${MBOX}" '890153490 298'
2479 ${cat} <<- '__EOT' | ${MAILX} ${ARGS} > "${MBOX}" 2>&1
2480 readctl create .tin
2481 readall d; echo $?/$^ERRNAME / <$d>
2482 wysh set d;readall d;echo $?/$^ERRNAME / <$d>
2483 readctl create .tin2
2484 readall d; echo $?/$^ERRNAME / <$d>
2485 wysh set d;readall d;echo $?/$^ERRNAME / <$d>
2486 readctl remove .tin;echo $?/$^ERRNAME;\
2487 readctl remove .tin2;echo $?/$^ERRNAME
2488 echo '### now with empty lines'
2489 ! printf 'one line\n\ntwo line\n\n' > ./.temptynl
2490 readctl create .temptynl;echo $?/$^ERRNAME
2491 readall d; echo "$?/$^ERRNAME / <$d>"
2492 readctl remove .temptynl;echo $?/$^ERRNAME
2493 __EOT
2494 check readall 0 "${MBOX}" '4113506527 405'
2496 t_epilog
2499 t_behave_mbox() {
2500 t_prolog t_behave_mbox
2501 TRAP_EXIT_ADDONS="./.t*"
2505 while [ ${i} -lt 113 ]; do
2506 printf 'm file://%s\n~s Subject %s\nHello %s!\n~.\n' \
2507 "${MBOX}" "${i}" "${i}"
2508 i=`add ${i} 1`
2509 done
2510 ) | ${MAILX} ${ARGS} > .tall 2>&1
2511 check behave:mbox-1 0 "${MBOX}" '1872102723 13784'
2512 check behave:mbox-1-outerr - ./.tall '4294967295 0' # empty file
2514 printf 'File "%s"\ncopy * "%s"\nFile "%s"\nfrom*' "${MBOX}" .tmbox1 .tmbox1 |
2515 ${MAILX} ${ARGS} -Sshowlast > .tall 2>&1
2516 check behave:mbox-2 0 .tall '3498373999 9103'
2518 printf 'File "%s"\ncopy * "file://%s"\nFile "file://%s"\nfrom*' \
2519 "${MBOX}" .tmbox2 .tmbox2 | ${MAILX} ${ARGS} -Sshowlast > .tall 2>&1
2520 check behave:mbox-3 0 .tall '381610797 9110'
2522 # copy only the odd (but the first), move the even
2524 printf 'File "file://%s"\ncopy ' .tmbox2
2526 while [ ${i} -lt 113 ]; do
2527 printf '%s ' "${i}"
2528 i=`add ${i} 2`
2529 done
2530 printf 'file://%s\nFile "file://%s"\nfrom*' .tmbox3 .tmbox3
2531 ) | ${MAILX} ${ARGS} -Sshowlast > .tall 2>&1
2532 check behave:mbox-4 0 .tmbox3 '4145104131 6890'
2533 check behave:mbox-5 - .tall '361127721 4573'
2534 # ...
2536 printf 'file "file://%s"\nmove ' .tmbox2
2538 while [ ${i} -lt 113 ]; do
2539 printf '%s ' "${i}"
2540 i=`add ${i} 2`
2541 done
2542 printf 'file://%s\nFile "file://%s"\nfrom*\nFile "file://%s"\nfrom*' \
2543 .tmbox3 .tmbox3 .tmbox2
2544 ) | ${MAILX} ${ARGS} -Sshowlast > .tall 2>>${ERR}
2545 check behave:mbox-6 0 .tmbox3 '3249991493 13784'
2546 if have_feat uistrings; then
2547 ${sed} 2d < .tall > .tallx
2548 else
2549 ${cp} .tall .tallx
2551 check behave:mbox-7 - .tallx '1584413080 13645'
2553 # Invalid MBOXes (after [f4db93b3])
2554 echo > .tinvmbox
2555 printf 'copy 1 ./.tinvmbox' | ${MAILX} ${ARGS} -Rf "${MBOX}" > .tall 2>&1
2556 check behave:mbox-8 0 .tinvmbox '896415941 122'
2557 check behave:mbox-9 - ./.tall '3146754194 33'
2559 echo ' ' > .tinvmbox
2560 printf 'copy 1 ./.tinvmbox' | ${MAILX} ${ARGS} -Rf "${MBOX}" > .tall 2>&1
2561 check behave:mbox-10 0 .tinvmbox '4011310616 124'
2562 check behave:mbox-11 - ./.tall '3146754194 33'
2564 { echo; echo; } > .tinvmbox # (not invalid)
2565 printf 'copy 1 ./.tinvmbox' | ${MAILX} ${ARGS} -Rf "${MBOX}" > .tall 2>&1
2566 check behave:mbox-12 0 .tinvmbox '287409579 123'
2567 check behave:mbox-13 - ./.tall '3146754194 33'
2569 # *mbox-rfc4155*, plus
2570 ${cat} <<-_EOT > ./.tinv1
2573 From MAILER-DAEMON-1 Wed Oct 2 01:50:07 1996
2574 Date: Wed, 02 Oct 1996 01:50:07 +0000
2576 Subject: Bad bad message 1
2578 From me to you, blinde Kuh!
2580 From MAILER-DAEMON-2 Wed Oct 2 01:50:07 1996
2581 Date: Wed, 02 Oct 1996 01:50:07 +0000
2583 Subject: Bad bad message 2
2585 From me to you, blindes Kalb!
2586 _EOT
2587 ${cp} ./.tinv1 ./.tinv2
2589 printf \
2590 'define mboxfix {
2591 \\localopts yes; \\wysh set mbox-rfc4155;\\wysh File "${1}";\\
2592 \\eval copy * "${2}"
2594 call mboxfix ./.tinv1 ./.tok' | ${MAILX} ${ARGS} > .tall 2>&1
2595 ex0_test behave:mbox-14-estat
2596 ${cat} ./.tinv1 ./.tok >> .tall
2597 check behave:mbox-14 - ./.tall '739301109 616'
2599 printf \
2600 'wysh file ./.tinv1 # ^From not repaired, but missing trailing NL is
2601 wysh File ./.tok # Just move away to nowhere
2602 set mbox-rfc4155
2603 wysh file ./.tinv2 # Fully repaired
2604 File ./.tok' | ${MAILX} ${ARGS} >>${ERR} 2>&1
2605 ex0_test behave:mbox-15-estat
2606 check behave:mbox-15-1 - ./.tinv1 '3178048820 332'
2607 check behave:mbox-15-2 - ./.tinv2 '4151504442 314'
2609 t_epilog
2612 t_behave_maildir() {
2613 t_prolog t_behave_maildir
2614 TRAP_EXIT_ADDONS="./.t*"
2618 while [ ${i} -lt 112 ]; do
2619 printf 'm file://%s\n~s Subject %s\nHello %s!\n~.\n' \
2620 "${MBOX}" "${i}" "${i}"
2621 i=`add ${i} 1`
2622 done
2623 ) | ${MAILX} ${ARGS}
2624 check behave:maildir-1 0 "${MBOX}" '1140119864 13780'
2626 printf 'File "%s"
2627 copy * "%s"
2628 File "%s"
2629 from*
2630 ' "${MBOX}" .tmdir1 .tmdir1 |
2631 ${MAILX} ${ARGS} -Snewfolders=maildir -Sshowlast > .tlst
2632 check behave:maildir-2 0 .tlst '1797938753 9103'
2634 printf 'File "%s"
2635 copy * "maildir://%s"
2636 File "maildir://%s"
2637 from*
2638 ' "${MBOX}" .tmdir2 .tmdir2 |
2639 ${MAILX} ${ARGS} -Sshowlast > .tlst
2640 check behave:maildir-3 0 .tlst '1155631089 9113'
2642 printf 'File "maildir://%s"
2643 copy * "file://%s"
2644 File "file://%s"
2645 from*
2646 ' .tmdir2 .tmbox1 .tmbox1 |
2647 ${MAILX} ${ARGS} -Sshowlast > .tlst
2648 check behave:maildir-4 0 .tmbox1 '2646131190 13220'
2649 check behave:maildir-5 - .tlst '3701297796 9110'
2651 # only the odd (even)
2653 printf 'File "maildir://%s"
2654 copy ' .tmdir2
2656 while [ ${i} -lt 112 ]; do
2657 j=`modulo ${i} 2`
2658 [ ${j} -eq 1 ] && printf '%s ' "${i}"
2659 i=`add ${i} 1`
2660 done
2661 printf ' file://%s
2662 File "file://%s"
2663 from*
2664 ' .tmbox2 .tmbox2
2665 ) | ${MAILX} ${ARGS} -Sshowlast > .tlst
2666 check behave:maildir-6 0 .tmbox2 '142890131 6610'
2667 check behave:maildir-7 - .tlst '960096773 4573'
2668 # ...
2670 printf 'file "maildir://%s"
2671 move ' .tmdir2
2673 while [ ${i} -lt 112 ]; do
2674 j=`modulo ${i} 2`
2675 [ ${j} -eq 0 ] && [ ${i} -ne 0 ] && printf '%s ' "${i}"
2676 i=`add ${i} 1`
2677 done
2678 printf ' file://%s
2679 File "file://%s"
2680 from*
2681 File "maildir://%s"
2682 from*
2683 ' .tmbox2 .tmbox2 .tmdir2
2684 ) | ${MAILX} ${ARGS} -Sshowlast > .tlst
2685 check behave:maildir-8 0 .tmbox2 '3806905791 13100'
2686 ${sed} 2d < .tlst > .tlstx
2687 check behave:maildir-9 - .tlstx '4216815295 13645'
2689 t_epilog
2692 t_behave_record_a_resend() {
2693 t_prolog t_behave_record_a_resend
2694 TRAP_EXIT_ADDONS="./.t.record ./.t.resent"
2696 printf '
2697 set record=%s
2698 m %s\n~s Subject 1.\nHello.\n~.
2699 set record-files add-file-recipients
2700 m %s\n~s Subject 2.\nHello.\n~.
2701 File %s
2702 resend 2 ./.t.resent
2703 Resend 1 ./.t.resent
2704 set record-resent
2705 resend 2 ./.t.resent
2706 Resend 1 ./.t.resent
2707 ' ./.t.record "${MBOX}" "${MBOX}" "${MBOX}" |
2708 ${MAILX} ${ARGS}
2710 check behave:record_a_resend-1 0 "${MBOX}" '3057873538 256'
2711 check behave:record_a_resend-2 - .t.record '391356429 460'
2712 check behave:record_a_resend-3 - .t.resent '2685231691 648'
2714 t_epilog
2717 t_behave_e_H_L_opts() {
2718 t_prolog t_behave_e_H_L_opts
2719 TRAP_EXIT_ADDONS="./.tmta.sh ./.t.mbox"
2721 t_xmta 'Alchemilla Wed Apr 07 17:03:33 2017' ./.t.mbox
2723 touch ./.t.mbox
2724 ${MAILX} ${ARGS} -ef ./.t.mbox
2725 echo ${?} > "${MBOX}"
2727 printf 'm me@exam.ple\nLine 1.\nHello.\n~.\n' |
2728 ${MAILX} ${ARGS} -Smta=./.tmta.sh
2729 printf 'm you@exam.ple\nLine 1.\nBye.\n~.\n' |
2730 ${MAILX} ${ARGS} -Smta=./.tmta.sh
2732 ${MAILX} ${ARGS} -ef ./.t.mbox
2733 echo ${?} >> "${MBOX}"
2734 ${MAILX} ${ARGS} -efL @t@me ./.t.mbox
2735 echo ${?} >> "${MBOX}"
2736 ${MAILX} ${ARGS} -efL @t@you ./.t.mbox
2737 echo ${?} >> "${MBOX}"
2738 ${MAILX} ${ARGS} -efL '@>@Line 1' ./.t.mbox
2739 echo ${?} >> "${MBOX}"
2740 ${MAILX} ${ARGS} -efL '@>@Hello.' ./.t.mbox
2741 echo ${?} >> "${MBOX}"
2742 ${MAILX} ${ARGS} -efL '@>@Bye.' ./.t.mbox
2743 echo ${?} >> "${MBOX}"
2744 ${MAILX} ${ARGS} -efL '@>@Good bye.' ./.t.mbox
2745 echo ${?} >> "${MBOX}"
2747 ${MAILX} ${ARGS} -fH ./.t.mbox >> "${MBOX}"
2748 echo ${?} >> "${MBOX}"
2749 ${MAILX} ${ARGS} -fL @t@me ./.t.mbox >> "${MBOX}"
2750 echo ${?} >> "${MBOX}"
2751 ${MAILX} ${ARGS} -fL @t@you ./.t.mbox >> "${MBOX}"
2752 echo ${?} >> "${MBOX}"
2753 ${MAILX} ${ARGS} -fL '@>@Line 1' ./.t.mbox >> "${MBOX}"
2754 echo ${?} >> "${MBOX}"
2755 ${MAILX} ${ARGS} -fL '@>@Hello.' ./.t.mbox >> "${MBOX}"
2756 echo ${?} >> "${MBOX}"
2757 ${MAILX} ${ARGS} -fL '@>@Bye.' ./.t.mbox >> "${MBOX}"
2758 echo ${?} >> "${MBOX}"
2759 ${MAILX} ${ARGS} -fL '@>@Good bye.' ./.t.mbox >> "${MBOX}" 2>>${ERR}
2760 echo ${?} >> "${MBOX}"
2762 check behave:e_H_L_opts - "${MBOX}" '1708955574 678'
2764 t_epilog
2767 t_behave_alternates() {
2768 t_prolog t_behave_alternates
2769 TRAP_EXIT_ADDONS="./.t*"
2771 t_xmta 'Valeriana Sat Jul 08 15:54:03 2017'
2773 ${cat} <<- '__EOT' | ${MAILX} ${ARGS} -Smta=./.tmta.sh > ./.tall 2>&1
2774 echo --0
2775 alternates
2776 echo $?/$^ERRNAME
2777 alternates a1@b1 a2@b2 a3@b3
2778 echo $?/$^ERRNAME
2779 alternates
2780 echo $?/$^ERRNAME
2781 vput alternates rv
2782 echo $?/$^ERRNAME <$rv>
2784 echo --1
2785 unalternates a2@b2
2786 vput alternates rv
2787 echo $?/$^ERRNAME <$rv>
2788 unalternates a3@b3
2789 vput alternates rv
2790 echo $?/$^ERRNAME <$rv>
2791 unalternates a1@b1
2792 vput alternates rv
2793 echo $?/$^ERRNAME <$rv>
2795 echo --2
2796 unalternates *
2797 alternates a1@b1 a2@b2 a3@b3
2798 unalternates a3@b3
2799 vput alternates rv
2800 echo $?/$^ERRNAME <$rv>
2801 unalternates a2@b2
2802 vput alternates rv
2803 echo $?/$^ERRNAME <$rv>
2804 unalternates a1@b1
2805 vput alternates rv
2806 echo $?/$^ERRNAME <$rv>
2808 echo --3
2809 alternates a1@b1 a2@b2 a3@b3
2810 unalternates a1@b1
2811 vput alternates rv
2812 echo $?/$^ERRNAME <$rv>
2813 unalternates a2@b2
2814 vput alternates rv
2815 echo $?/$^ERRNAME <$rv>
2816 unalternates a3@b3
2817 vput alternates rv
2818 echo $?/$^ERRNAME <$rv>
2820 echo --4
2821 unalternates *
2822 alternates a1@b1 a2@b2 a3@b3
2823 unalternates *
2824 vput alternates rv
2825 echo $?/$^ERRNAME <$rv>
2827 echo --5
2828 unalternates *
2829 alternates a1@b1 a1@c1 a1@d1 a2@b2 a3@b3 a3@c3 a3@d3
2830 m a1@b1 a1@c1 a1@d1
2831 ~s all alternates, only a1@b1 remains
2832 ~c a2@b2
2833 ~b a3@b3 a3@c3 a3@d3
2834 ~r - '_EOT'
2835 This body is!
2836 This also body is!!
2837 _EOT
2840 echo --6
2841 unalternates *
2842 alternates a1@b1 a1@c1 a2@b2 a3@b3
2843 m a1@b1 a1@c1 a1@d1
2844 ~s a1@b1 a1@d1, and a3@c3 a3@d3 remain
2845 ~c a2@b2
2846 ~b a3@b3 a3@c3 a3@d3
2847 ~r - '_EOT'
2848 This body2 is!
2849 _EOT
2852 echo --7
2853 alternates a1@b1 a2@b2 a3; set allnet
2854 m a1@b1 a1@c1 a1@d1
2855 ~s all alternates via allnet, only a1@b1 remains
2856 ~c a2@b2
2857 ~b a3@b3 a3@c3 a3@d3
2858 ~r - '_EOT'
2859 This body3 is!
2860 _EOT
2863 echo --10
2864 unalternates *
2865 alternates a1@b1
2866 echo $?/$^ERRNAME
2867 vput alternates rv
2868 echo $?/$^ERRNAME <$rv>
2869 alternates a2@b2
2870 echo $?/$^ERRNAME
2871 vput alternates rv
2872 echo $?/$^ERRNAME <$rv>
2873 alternates a3@b3
2874 echo $?/$^ERRNAME
2875 vput alternates rv
2876 echo $?/$^ERRNAME <$rv>
2877 alternates a4@b4
2878 echo $?/$^ERRNAME
2879 vput alternates rv
2880 echo $?/$^ERRNAME <$rv>
2882 unalternates *
2883 vput alternates rv
2884 echo $?/$^ERRNAME <$rv>
2886 echo --11
2887 set posix
2888 alternates a1@b1 a2@b2
2889 echo $?/$^ERRNAME
2890 vput alternates rv
2891 echo $?/$^ERRNAME <$rv>
2892 alternates a3@b3 a4@b4
2893 echo $?/$^ERRNAME
2894 vput alternates rv
2895 echo $?/$^ERRNAME <$rv>
2896 __EOT
2898 check behave:alternates-1 0 "${MBOX}" '142184864 515'
2899 if have_feat uistrings; then
2900 check behave:alternates-2 - .tall '1878598364 505'
2901 else
2902 echo 'behave:alternates-2: unsupported, skipped'
2905 t_epilog
2908 t_behave_alias() {
2909 t_prolog t_behave_alias
2910 TRAP_EXIT_ADDONS="./.t*"
2912 t_xmta 'Hippocastanum Mon Jun 19 15:07:07 2017'
2914 ${cat} <<- '__EOT' | ${MAILX} ${ARGS} -Smta=./.tmta.sh > ./.tall 2>&1
2915 alias a1 ex1@a1.ple
2916 alias a1 ex2@a1.ple "EX3 <ex3@a1.ple>"
2917 alias a1 ex4@a1.ple
2918 alias a2 ex1@a2.ple ex2@a2.ple ex3@a2.ple ex4@a2.ple
2919 alias a3 a4
2920 alias a4 a5 ex1@a4.ple
2921 alias a5 a6
2922 alias a6 a7 ex1@a6.ple
2923 alias a7 a8
2924 alias a8 ex1@a8.ple
2925 alias a1
2926 alias a2
2927 alias a3
2928 m a1
2929 ~c a2
2930 ~b a3
2931 ~r - '_EOT'
2932 This body is!
2933 This also body is!!
2934 _EOT
2935 __EOT
2936 check behave:alias-1 0 "${MBOX}" '2496925843 272'
2937 check behave:alias-2 - .tall '3548953204 152'
2939 # TODO t_behave_alias: n_ALIAS_MAXEXP is compile-time constant,
2940 # TODO need to somehow provide its contents to the test, then test
2942 t_epilog
2945 t_behave_filetype() {
2946 t_prolog t_behave_filetype
2947 TRAP_EXIT_ADDONS="./.t*"
2949 t_xmta 'Alchemilla Wed Apr 25 15:12:13 2017'
2951 printf 'm m1@e.t\nL1\nHy1\n~.\nm m2@e.t\nL2\nHy2\n~@ %s\n~.\n' \
2952 "${SRCDIR}snailmail.jpg" | ${MAILX} ${ARGS} -Smta=./.tmta.sh
2953 check behave:filetype-1 0 "${MBOX}" '1594682963 13520'
2955 if (echo | gzip -c) >/dev/null 2>&1; then
2957 printf 'File "%s"\ncopy 1 ./.t.mbox.gz\ncopy 2 ./.t.mbox.gz' \
2958 "${MBOX}" | ${MAILX} ${ARGS} \
2959 -X'filetype gz gzip\ -dc gzip\ -c'
2960 printf 'File ./.t.mbox.gz\ncopy * ./.t.mbox\n' |
2961 ${MAILX} ${ARGS} -X'filetype gz gzip\ -dc gzip\ -c'
2962 } > ./.t.out 2>&1
2963 check behave:filetype-2 - "./.t.mbox" '1594682963 13520'
2964 check behave:filetype-3 - "./.t.out" '2392348396 102'
2965 else
2966 echo 'behave:filetype-2: unsupported, skipped'
2967 echo 'behave:filetype-3: unsupported, skipped'
2971 ${rm} ./.t.mbox*
2972 printf 'File "%s"\ncopy 1 ./.t.mbox.gz
2973 copy 2 ./.t.mbox.gz
2974 copy 1 ./.t.mbox.gz
2975 copy 2 ./.t.mbox.gz
2976 ' "${MBOX}" |
2977 ${MAILX} ${ARGS} \
2978 -X'filetype gz gzip\ -dc gzip\ -c' \
2979 -X'filetype mbox.gz "${sed} 1,3d|${cat}" \
2980 "echo eins;echo zwei;echo und mit ${sed} bist Du dabei;${cat}"'
2981 printf 'File ./.t.mbox.gz\ncopy * ./.t.mbox\n' |
2982 ${MAILX} ${ARGS} \
2983 -X'filetype gz gzip\ -dc gzip\ -c' \
2984 -X'filetype mbox.gz "${sed} 1,3d|${cat}" kill\ 0'
2985 } > ./.t.out 2>&1
2986 check behave:filetype-4 - "./.t.mbox" '2886541147 27060'
2987 check behave:filetype-5 - "./.t.out" '852335377 172'
2989 t_epilog
2992 t_behave_message_injections() {
2993 t_prolog t_behave_message_injections
2994 TRAP_EXIT_ADDONS="./.t*"
2996 t_xmta 'Echinacea Tue Jun 20 15:54:02 2017'
2998 echo mysig > ./.tmysig
3000 echo some-body | ${MAILX} ${ARGS} -Smta=./.tmta.sh \
3001 -Smessage-inject-head=head-inject \
3002 -Smessage-inject-tail=tail-inject \
3003 -Ssignature=./.tmysig \
3004 ex@am.ple > ./.tall 2>&1
3005 check behave:message_injections-1 0 "${MBOX}" '2434746382 134'
3006 check behave:message_injections-2 - .tall '4294967295 0' # empty file
3008 ${rm} "${MBOX}"
3009 ${cat} <<-_EOT > ./.template
3010 From: me
3011 To: ex1@am.ple
3012 Cc: ex2@am.ple
3013 Subject: This subject is
3015 Body, body, body me.
3016 _EOT
3017 < ./.template ${MAILX} ${ARGS} -t -Smta=./.tmta.sh \
3018 -Smessage-inject-head=head-inject \
3019 -Smessage-inject-tail=tail-inject \
3020 -Ssignature=./.tmysig \
3021 > ./.tall 2>&1
3022 check behave:message_injections-3 0 "${MBOX}" '3114203412 198'
3023 check behave:message_injections-4 - .tall '4294967295 0' # empty file
3025 t_epilog
3028 t_behave_attachments() {
3029 t_prolog t_behave_attachments
3030 TRAP_EXIT_ADDONS="./.t*"
3032 t_xmta 'Cannabis Sun Feb 18 02:02:46 2018'
3034 ${cat} <<-_EOT > ./.tx
3035 From steffen Sun Feb 18 02:48:40 2018
3036 Date: Sun, 18 Feb 2018 02:48:40 +0100
3038 Subject: m1
3039 User-Agent: s-nail v14.9.7
3042 From steffen Sun Feb 18 02:48:42 2018
3043 Date: Sun, 18 Feb 2018 02:48:42 +0100
3045 Subject: m2
3046 User-Agent: s-nail v14.9.7
3049 _EOT
3050 echo att1 > ./.t1
3051 printf 'att2-1\natt2-2\natt2-4\n' > ./'.t 2'
3052 printf 'att3-1\natt3-2\natt3-4\n' > ./.t3
3053 printf 'att4-1\natt4-2\natt4-4\n' > './.t 4'
3055 printf \
3056 '!@ ./.t3 "./.t 4" ""
3059 ./.t3
3060 "./.t 2"
3063 !.' \
3064 | ${MAILX} ${ARGS} -Sescape=! -Smta=./.tmta.sh \
3065 -a ./.t1 -a './.t 2' \
3066 -s attachment-test \
3067 ex@am.ple > ./.tall 2>&1
3068 check behave:attachments-1 0 "${MBOX}" '4107062253 634'
3069 if have_feat uistrings; then
3070 check behave:attachments-2 - .tall '1928331872 720'
3071 else
3072 echo 'behave:attachments-2: unsupported, skipped'
3075 ${rm} "${MBOX}"
3076 printf \
3077 'mail ex@amp.ple
3078 !s This the subject is
3079 !@ ./.t3 "#2" "./.t 4" "#1" ""
3082 "./.t 4"
3083 "#2"
3087 mail ex@amp.ple
3088 !s Subject two
3089 !@ ./.t3 "#2" "./.t 4" "#1" ""
3095 mail ex@amp.ple
3096 !s Subject three
3097 !@ ./.t3 "" "#2" "" "./.t 4" "" "#1" ""
3100 ./.t3
3104 mail ex@amp.ple
3105 !s Subject Four
3106 !@ ./.t3 "" "#2" "" "./.t 4" "" "#1" ""
3109 "#1"
3113 mail ex@amp.ple
3114 !s Subject Five
3116 "#2"
3119 !.' \
3120 | ${MAILX} ${ARGS} -Sescape=! -Smta=./.tmta.sh -Rf ./.tx \
3121 > ./.tall 2>&1
3122 check behave:attachments-3 0 "${MBOX}" '798122412 2285'
3123 if have_feat uistrings; then
3124 check behave:attachments-4 - .tall '2526106274 1910'
3125 else
3126 echo 'behave:attachments-4: unsupported, skipped'
3129 t_epilog
3132 t_behave_compose_hooks() { # TODO monster
3133 t_prolog t_behave_compose_hooks
3134 if have_feat uistrings; then :; else
3135 echo 'behave:compose_hooks: unsupported, skipped'
3136 return
3138 TRAP_EXIT_ADDONS="./.t*"
3140 t_xmta 'PrimulaVeris Wed Apr 10 22:59:00 2017'
3142 (echo line one&&echo line two&&echo line three) > ./.treadctl
3143 (echo echo four&&echo echo five&&echo echo six) > ./.tattach
3145 ${cat} <<'__EOT__' > ./.trc
3146 define bail {
3147 echoerr "Failed: $1. Bailing out"; echo "~x"; xit
3149 define xerr {
3150 vput vexpr es substr "$1" 0 1
3151 if [ "$es" != 2 ]
3152 xcall bail "$2"
3155 define read_mline_res {
3156 read hl; wysh set len=$? es=$! en=$^ERRNAME;\
3157 echo $len/$es/$^ERRNAME: $hl
3158 if [ $es -ne $^ERR-NONE ]
3159 xcall bail read_mline_res
3160 elif [ $len -ne 0 ]
3161 \xcall read_mline_res
3164 define ins_addr {
3165 wysh set xh=$1
3166 echo "~^header list"; read hl; echo $hl;\
3167 call xerr "$hl" "in_addr ($xh) 0-1"
3169 echo "~^header insert $xh diet <$xh@exam.ple> spliced";\
3170 read es; echo $es; call xerr "$es" "ins_addr $xh 1-1"
3171 echo "~^header insert $xh <${xh}2@exam.ple>";\
3172 read es; echo $es; call xerr "$es" "ins_addr $xh 1-2"
3173 echo "~^header insert $xh ${xh}3@exam.ple";\
3174 read es; echo $es; call xerr "$es" "ins_addr $xh 1-3"
3175 echo "~^header list $xh"; read hl; echo $hl;\
3176 call xerr "$hl" "ins_addr $xh 1-4"
3177 echo "~^header show $xh"; read es; call xerr $es "ins_addr $xh 1-5"
3178 call read_mline_res
3180 if [ "$t_remove" == "" ]
3181 return
3184 echo "~^header remove $xh"; read es; call xerr $es "ins_addr $xh 2-1"
3185 echo "~^header remove $xh"; read es; vput vexpr es substr $es 0 3
3186 if [ $es != 501 ]
3187 xcall bail "ins_addr $xh 2-2"
3189 echo "~^header list $xh"; read es; vput vexpr es substr $es 0 3
3190 if [ $es != 501 ]
3191 xcall bail "ins_addr $xh 2-3"
3193 echo "~^header show $xh"; read es; vput vexpr es substr $es 0 3
3194 if [ $es != 501 ]
3195 xcall bail "ins_addr $xh 2-4"
3199 echo "~^header insert $xh diet <$xh@exam.ple> spliced";\
3200 read es; echo $es; call xerr "$es" "ins_addr $xh 3-1"
3201 echo "~^header insert $xh <${xh}2@exam.ple>";\
3202 read es; echo $es; call xerr "$es" "ins_addr $xh 3-2"
3203 echo "~^header insert $xh ${xh}3@exam.ple";\
3204 read es; echo $es; call xerr "$es" "ins_addr $xh 3-3"
3205 echo "~^header list $xh"; read hl; echo $hl;\
3206 call xerr "$hl" "ins_addr $xh 3-4"
3207 echo "~^header show $xh"; read es; call xerr $es "ins_addr $xh 3-5"
3208 call read_mline_res
3210 echo "~^header remove-at $xh 1"; read es;\
3211 call xerr $es "ins_addr $xh 3-6"
3212 echo "~^header remove-at $xh 1"; read es;\
3213 call xerr $es "ins_addr $xh 3-7"
3214 echo "~^header remove-at $xh 1"; read es;\
3215 call xerr $es "ins_addr $xh 3-8"
3216 echo "~^header remove-at $xh 1"; read es;\
3217 vput vexpr es substr $es 0 3
3218 if [ $es != 501 ]
3219 xcall bail "ins_addr $xh 3-9"
3221 echo "~^header remove-at $xh T"; read es;\
3222 vput vexpr es substr $es 0 3
3223 if [ $es != 505 ]
3224 xcall bail "ins_addr $xh 3-10"
3226 echo "~^header list $xh"; read es;\
3227 vput vexpr es substr $es 0 3
3228 if [ $es != 501 ]
3229 xcall bail "ins_addr $xh 3-11"
3231 echo "~^header show $xh"; read es;\
3232 vput vexpr es substr $es 0 3
3233 if [ $es != 501 ]
3234 xcall bail "ins_addr $xh 3-12"
3238 echo "~^header insert $xh diet <$xh@exam.ple> spliced";\
3239 read es; echo $es; call xerr "$es" "ins_addr $xh 4-1"
3240 echo "~^header insert $xh <${xh}2@exam.ple> (comment) \"Quot(e)d\"";\
3241 read es; echo $es; call xerr "$es" "ins_addr $xh 4-2"
3242 echo "~^header insert $xh ${xh}3@exam.ple";\
3243 read es; echo $es; call xerr "$es" "ins_addr $xh 4-3"
3244 echo "~^header list $xh"; read hl; echo $hl;\
3245 call xerr "$hl" "header list $xh 3-4"
3246 echo "~^header show $xh"; read es; call xerr $es "ins_addr $xh 4-5"
3247 call read_mline_res
3249 echo "~^header remove-at $xh 3"; read es;\
3250 call xerr $es "ins_addr $xh 4-6"
3251 echo "~^header remove-at $xh 2"; read es;\
3252 call xerr $es "ins_addr $xh 4-7"
3253 echo "~^header remove-at $xh 1"; read es;\
3254 call xerr $es "ins_addr $xh 4-8"
3255 echo "~^header remove-at $xh 1"; read es;\
3256 vput vexpr es substr $es 0 3
3257 if [ $es != 501 ]
3258 xcall bail "ins_addr $xh 4-9"
3260 echo "~^header remove-at $xh T"; read es;\
3261 vput vexpr es substr $es 0 3
3262 if [ $es != 505 ]
3263 xcall bail "ins_addr $xh 4-10"
3265 echo "~^header list $xh"; read es;\
3266 vput vexpr es substr $es 0 3
3267 if [ $es != 501 ]
3268 xcall bail "ins_addr $xh 4-11"
3270 echo "~^header show $xh"; read es;\
3271 vput vexpr es substr $es 0 3
3272 if [ $es != 501 ]
3273 xcall bail "ins_addr $xh 4-12"
3276 define ins_ref {
3277 wysh set xh=$1 mult=$2
3278 echo "~^header list"; read hl; echo $hl;\
3279 call xerr "$hl" "ins_ref ($xh) 0-1"
3281 echo "~^header insert $xh <$xh@exam.ple>";\
3282 read es; echo $es; call xerr "$es" "ins_ref $xh 1-1"
3283 if [ $mult -ne 0 ]
3284 echo "~^header insert $xh <${xh}2@exam.ple>";\
3285 read es; echo $es; call xerr "$es" "ins_ref $xh 1-2"
3286 echo "~^header insert $xh ${xh}3@exam.ple";\
3287 read es; echo $es; call xerr "$es" "ins_ref $xh 1-3"
3288 else
3289 echo "~^header insert $xh <${xh}2@exam.ple>"; read es;\
3290 vput vexpr es substr $es 0 3
3291 if [ $es != 506 ]
3292 xcall bail "ins_ref $xh 1-4"
3296 echo "~^header list $xh"; read hl; echo $hl;\
3297 call xerr "$hl" "ins_ref $xh 1-5"
3298 echo "~^header show $xh"; read es; call xerr $es "ins_ref $xh 1-6"
3299 call read_mline_res
3301 if [ "$t_remove" == "" ]
3302 return
3305 echo "~^header remove $xh"; read es;\
3306 call xerr $es "ins_ref $xh 2-1"
3307 echo "~^header remove $xh"; read es;\
3308 vput vexpr es substr $es 0 3
3309 if [ $es != 501 ]
3310 xcall bail "ins_ref $xh 2-2"
3312 echo "~^header list $xh"; read es;\
3313 vput vexpr es substr $es 0 3
3314 if [ $es != 501 ]
3315 xcall bail "$es ins_ref $xh 2-3"
3317 echo "~^header show $xh"; read es;\
3318 vput vexpr es substr $es 0 3
3319 if [ $es != 501 ]
3320 xcall bail "ins_ref $xh 2-4"
3324 echo "~^header insert $xh <$xh@exam.ple>";\
3325 read es; echo $es; call xerr "$es" "ins_ref $xh 3-1"
3326 if [ $mult -ne 0 ]
3327 echo "~^header insert $xh <${xh}2@exam.ple>";\
3328 read es; echo $es; call xerr "$es" "ins_ref $xh 3-2"
3329 echo "~^header insert $xh ${xh}3@exam.ple";\
3330 read es; echo $es; call xerr "$es" "ins_ref $xh 3-3"
3332 echo "~^header list $xh";\
3333 read hl; echo $hl; call xerr "$hl" "ins_ref $xh 3-4"
3334 echo "~^header show $xh";\
3335 read es; call xerr $es "ins_ref $xh 3-5"
3336 call read_mline_res
3338 echo "~^header remove-at $xh 1"; read es;\
3339 call xerr $es "ins_ref $xh 3-6"
3340 if [ $mult -ne 0 ] && [ $xh != subject ]
3341 echo "~^header remove-at $xh 1"; read es;\
3342 call xerr $es "ins_ref $xh 3-7"
3343 echo "~^header remove-at $xh 1"; read es;\
3344 call xerr $es "ins_ref $xh 3-8"
3346 echo "~^header remove-at $xh 1"; read es;\
3347 vput vexpr es substr $es 0 3
3348 if [ $es != 501 ]
3349 xcall bail "ins_ref $xh 3-9"
3351 echo "~^header remove-at $xh T"; read es;\
3352 vput vexpr es substr $es 0 3
3353 if [ $es != 505 ]
3354 xcall bail "ins_ref $xh 3-10"
3356 echo "~^header show $xh"; read es;\
3357 vput vexpr es substr $es 0 3
3358 if [ $es != 501 ]
3359 xcall bail "ins_ref $xh 3-11"
3363 echo "~^header insert $xh <$xh@exam.ple> ";\
3364 read es; echo $es; call xerr "$es" "ins_ref $xh 4-1"
3365 if [ $mult -ne 0 ]
3366 echo "~^header insert $xh <${xh}2@exam.ple> ";\
3367 read es; echo $es; call xerr "$es" "ins_ref $xh 4-2"
3368 echo "~^header insert $xh ${xh}3@exam.ple";\
3369 read es; echo $es; call xerr "$es" "ins_ref $xh 4-3"
3371 echo "~^header list $xh"; read hl; echo $hl;\
3372 call xerr "$hl" "ins_ref $xh 4-4"
3373 echo "~^header show $xh"; read es; call xerr $es "ins_ref $xh 4-5"
3374 call read_mline_res
3376 if [ $mult -ne 0 ] && [ $xh != subject ]
3377 echo "~^header remove-at $xh 3"; read es;\
3378 call xerr $es "ins_ref $xh 4-6"
3379 echo "~^header remove-at $xh 2"; read es;\
3380 call xerr $es "ins_ref $xh 4-7"
3382 echo "~^header remove-at $xh 1"; read es;\
3383 call xerr $es "ins_ref $xh 4-8"
3384 echo "~^header remove-at $xh 1"; read es;\
3385 vput vexpr es substr $es 0 3
3386 if [ $es != 501 ]
3387 xcall bail "ins_ref $xh 4-9"
3389 echo "~^header remove-at $xh T"; read es;\
3390 vput vexpr es substr $es 0 3
3391 if [ $es != 505 ]
3392 xcall bail "ins_ref $xh 4-10"
3394 echo "~^header show $xh"; read es;\
3395 vput vexpr es substr $es 0 3
3396 if [ $es != 501 ]
3397 xcall bail "ins_ref $xh 4-11"
3400 define t_header {
3401 echo t_header ENTER
3402 # In collect.c order
3403 call ins_addr from
3404 call ins_ref sender 0 # Not a "ref", but works
3405 call ins_addr To
3406 call ins_addr cC
3407 call ins_addr bCc
3408 call ins_addr reply-To
3409 call ins_addr mail-Followup-to
3410 call ins_ref messAge-id 0
3411 call ins_ref rEfErEncEs 1
3412 call ins_ref in-Reply-to 1
3413 call ins_ref subject 1 # Not a "ref", but works (with tweaks)
3414 call ins_addr freeForm1
3415 call ins_addr freeform2
3417 echo "~^header show MAILX-Command"; read es; call xerr $es "t_header 1000"
3418 call read_mline_res
3419 echo "~^header show MAILX-raw-TO"; read es; call xerr $es "t_header 1001"
3420 call read_mline_res
3422 echo t_header LEAVE
3424 define t_attach {
3425 echo t_attach ENTER
3427 echo "~^attachment";\
3428 read hl; echo $hl; vput vexpr es substr "$hl" 0 3
3429 if [ "$es" != 501 ]
3430 xcall bail "attach 0-1"
3433 echo "~^attach attribute ./.treadctl";\
3434 read hl; echo $hl; vput vexpr es substr "$hl" 0 3
3435 if [ "$es" != 501 ]
3436 xcall bail "attach 0-2"
3438 echo "~^attachment attribute-at 1";\
3439 read hl; echo $hl; vput vexpr es substr "$hl" 0 3
3440 if [ "$es" != 501 ]
3441 xcall bail "attach 0-3"
3444 echo "~^attachment insert ./.treadctl=ascii";\
3445 read hl; echo $hl; call xerr "$hl" "attach 1-1"
3446 echo "~^attachment list";\
3447 read es; echo $es;call xerr "$es" "attach 1-2"
3448 call read_mline_res
3449 echo "~^attachment attribute ./.treadctl";\
3450 read es; echo $es;call xerr "$es" "attach 1-3"
3451 call read_mline_res
3452 echo "~^attachment attribute .treadctl";\
3453 read es; echo $es;call xerr "$es" "attach 1-4"
3454 call read_mline_res
3455 echo "~^attachment attribute-at 1";\
3456 read es; echo $es;call xerr "$es" "attach 1-5"
3457 call read_mline_res
3459 echo "~^attachment attribute-set ./.treadctl filename rctl";\
3460 read es; echo $es;call xerr "$es" "attach 1-6"
3461 echo "~^attachment attribute-set .treadctl content-description Au";\
3462 read es; echo $es;call xerr "$es" "attach 1-7"
3463 echo "~^attachment attribute-set-at 1 content-id <10.du@ich>";\
3464 read es; echo $es;call xerr "$es" "attach 1-8"
3466 echo "~^attachment attribute ./.treadctl";\
3467 read es; echo $es;call xerr "$es" "attach 1-9"
3468 call read_mline_res
3469 echo "~^attachment attribute .treadctl";\
3470 read es; echo $es;call xerr "$es" "attach 1-10"
3471 call read_mline_res
3472 echo "~^attachment attribute rctl";\
3473 read es; echo $es;call xerr "$es" "attach 1-11"
3474 call read_mline_res
3475 echo "~^attachment attribute-at 1";\
3476 read es; echo $es;call xerr "$es" "attach 1-12"
3477 call read_mline_res
3480 echo "~^attachment insert ./.tattach=latin1";\
3481 read hl; echo $hl; call xerr "$hl" "attach 2-1"
3482 echo "~^attachment list";\
3483 read es; echo $es;call xerr "$es" "attach 2-2"
3484 call read_mline_res
3485 echo "~^attachment attribute ./.tattach";\
3486 read es; echo $es;call xerr "$es" "attach 2-3"
3487 call read_mline_res
3488 echo "~^attachment attribute .tattach";\
3489 read es; echo $es;call xerr "$es" "attach 2-4"
3490 call read_mline_res
3491 echo "~^attachment attribute-at 2";\
3492 read es; echo $es;call xerr "$es" "attach 2-5"
3493 call read_mline_res
3495 echo "~^attachment attribute-set ./.tattach filename tat";\
3496 read es; echo $es;call xerr "$es" "attach 2-6"
3497 echo \
3498 "~^attachment attribute-set .tattach content-description Au2";\
3499 read es; echo $es;call xerr "$es" "attach 2-7"
3500 echo "~^attachment attribute-set-at 2 content-id <20.du@wir>";\
3501 read es; echo $es;call xerr "$es" "attach 2-8"
3502 echo \
3503 "~^attachment attribute-set-at 2 content-type application/x-sh";\
3504 read es; echo $es;call xerr "$es" "attach 2-9"
3506 echo "~^attachment attribute ./.tattach";\
3507 read es; echo $es;call xerr "$es" "attach 2-10"
3508 call read_mline_res
3509 echo "~^attachment attribute .tattach";\
3510 read es; echo $es;call xerr "$es" "attach 2-11"
3511 call read_mline_res
3512 echo "~^attachment attribute tat";\
3513 read es; echo $es;call xerr "$es" "attach 2-12"
3514 call read_mline_res
3515 echo "~^attachment attribute-at 2";\
3516 read es; echo $es;call xerr "$es" "attach 2-13"
3517 call read_mline_res
3520 if [ "$t_remove" == "" ]
3521 return
3524 echo "~^attachment remove ./.treadctl"; read es;\
3525 call xerr $es "attach 3-1"
3526 echo "~^attachment remove ./.tattach"; read es;\
3527 call xerr $es "attach 3-2"
3528 echo "~^ attachment remove ./.treadctl"; read es;\
3529 vput vexpr es substr $es 0 3
3530 if [ $es != 501 ]
3531 xcall bail "attach 3-3"
3533 echo "~^ attachment remove ./.tattach"; read es;\
3534 vput vexpr es substr $es 0 3
3535 if [ $es != 501 ]
3536 xcall bail "attach 3-4"
3538 echo "~^attachment list"; read es;\
3539 vput vexpr es substr $es 0 3
3540 if [ $es != 501 ]
3541 xcall bail "attach 3-5"
3545 echo "~^attachment insert ./.tattach=latin1";\
3546 read hl; echo $hl; call xerr "$hl" "attach 4-1"
3547 echo "~^attachment insert ./.tattach=latin1";\
3548 read hl; echo $hl; call xerr "$hl" "attach 4-2"
3549 echo "~^attachment list";\
3550 read es; echo $es;call xerr "$es" "attach 4-3"
3551 call read_mline_res
3552 echo "~^ attachment remove .tattach"; read es;\
3553 vput vexpr es substr $es 0 3
3554 if [ $es != 506 ]
3555 xcall bail "attach 4-4 $es"
3557 echo "~^attachment remove-at T"; read es;\
3558 vput vexpr es substr $es 0 3
3559 if [ $es != 505 ]
3560 xcall bail "attach 4-5"
3562 echo "~^attachment remove ./.tattach"; read es;\
3563 call xerr $es "attach 4-6"
3564 echo "~^attachment remove ./.tattach"; read es;\
3565 call xerr $es "attach 4-7"
3566 echo "~^ attachment remove ./.tattach"; read es;\
3567 vput vexpr es substr $es 0 3
3568 if [ $es != 501 ]
3569 xcall bail "attach 4-8 $es"
3571 echo "~^attachment list"; read es;\
3572 vput vexpr es substr $es 0 3
3573 if [ $es != 501 ]
3574 xcall bail "attach 4-9"
3578 echo "~^attachment insert ./.tattach=latin1";\
3579 read hl; echo $hl; call xerr "$hl" "attach 5-1"
3580 echo "~^attachment insert ./.tattach=latin1";\
3581 read hl; echo $hl; call xerr "$hl" "attach 5-2"
3582 echo "~^attachment insert ./.tattach=latin1";\
3583 read hl; echo $hl; call xerr "$hl" "attach 5-3"
3584 echo "~^attachment list";\
3585 read es; echo $es;call xerr "$es" "attach 5-4"
3586 call read_mline_res
3588 echo "~^attachment remove-at 3"; read es;\
3589 call xerr $es "attach 5-5"
3590 echo "~^attachment remove-at 3"; read es;\
3591 vput vexpr es substr $es 0 3
3592 if [ $es != 501 ]
3593 xcall bail "attach 5-6"
3595 echo "~^attachment remove-at 2"; read es;\
3596 call xerr $es "attach 5-7"
3597 echo "~^attachment remove-at 2"; read es;\
3598 vput vexpr es substr $es 0 3
3599 if [ $es != 501 ]
3600 xcall bail "attach 5-8"
3602 echo "~^attachment remove-at 1"; read es;\
3603 call xerr $es "attach 5-9"
3604 echo "~^attachment remove-at 1"; read es;\
3605 vput vexpr es substr $es 0 3
3606 if [ $es != 501 ]
3607 xcall bail "attach 5-10"
3610 echo "~^attachment list"; read es;\
3611 vput vexpr es substr $es 0 3
3612 if [ $es != 501 ]
3613 xcall bail "attach 5-11"
3617 echo "~^attachment insert ./.tattach=latin1";\
3618 read hl; echo $hl; call xerr "$hl" "attach 6-1"
3619 echo "~^attachment insert ./.tattach=latin1";\
3620 read hl; echo $hl; call xerr "$hl" "attach 6-2"
3621 echo "~^attachment insert ./.tattach=latin1";\
3622 read hl; echo $hl; call xerr "$hl" "attach 6-3"
3623 echo "~^attachment list";\
3624 read es; echo $es;call xerr "$es" "attach 6-4"
3625 call read_mline_res
3627 echo "~^attachment remove-at 1"; read es;\
3628 call xerr $es "attach 6-5"
3629 echo "~^attachment remove-at 1"; read es;\
3630 call xerr $es "attach 6-6"
3631 echo "~^attachment remove-at 1"; read es;\
3632 call xerr $es "attach 6-7"
3633 echo "~^attachment remove-at 1"; read es;\
3634 vput vexpr es substr $es 0 3
3635 if [ $es != 501 ]
3636 xcall bail "attach 6-8"
3639 echo "~^attachment list"; read es;\
3640 vput vexpr es substr $es 0 3
3641 if [ $es != 501 ]
3642 xcall bail "attach 6-9"
3645 echo t_attach LEAVE
3647 define t_ocs {
3648 read ver
3649 echo t_ocs
3650 call t_header
3651 call t_attach
3653 define t_oce {
3654 echo on-compose-enter, mailx-command<$mailx-command>
3655 alternates alter1@exam.ple alter2@exam.ple
3656 alternates
3657 set autocc='alter1@exam.ple alter2@exam.ple'
3658 echo mailx-from<$mailx-from> mailx-sender<$mailx-sender>
3659 echo mailx-subject<$mailx-subject>
3660 echo mailx-to<$mailx-to> mailx-cc<$mailx-cc> mailx-bcc<$mailx-bcc>
3661 echo mailx-raw-to<$mailx-raw-to> mailx-raw-cc<$mailx-raw-cc> \
3662 mailx-raw-bcc<$mailx-raw-bcc>
3663 echo mailx-orig-from<$mailx-orig-from> mailx-orig-to<$mailx-orig-to> \
3664 mailx-orig-cc<$mailx-orig-cc> mailx-orig-bcc<$mailx-orig-bcc>
3666 define t_ocl {
3667 echo on-compose-leave, mailx-command<$mailx-command>
3668 vput alternates al
3669 eval alternates $al alter3@exam.ple alter4@exam.ple
3670 alternates
3671 set autobcc='alter3@exam.ple alter4@exam.ple'
3672 echo mailx-from<$mailx-from> mailx-sender<$mailx-sender>
3673 echo mailx-subject<$mailx-subject>
3674 echo mailx-to<$mailx-to> mailx-cc<$mailx-cc> mailx-bcc<$mailx-bcc>
3675 echo mailx-raw-to<$mailx-raw-to> mailx-raw-cc<$mailx-raw-cc> \
3676 mailx-raw-bcc<$mailx-raw-bcc>
3677 echo mailx-orig-from<$mailx-orig-from> mailx-orig-to<$mailx-orig-to> \
3678 mailx-orig-cc<$mailx-orig-cc> mailx-orig-bcc<$mailx-orig-bcc>
3680 define t_occ {
3681 echo on-compose-cleanup, mailx-command<$mailx-command>
3682 unalternates *
3683 alternates
3684 echo mailx-from<$mailx-from> mailx-sender<$mailx-sender>
3685 echo mailx-subject<$mailx-subject>
3686 echo mailx-to<$mailx-to> mailx-cc<$mailx-cc> mailx-bcc<$mailx-bcc>
3687 echo mailx-raw-to<$mailx-raw-to> mailx-raw-cc<$mailx-raw-cc> \
3688 mailx-raw-bcc<$mailx-raw-bcc>
3689 echo mailx-orig-from<$mailx-orig-from> mailx-orig-to<$mailx-orig-to> \
3690 mailx-orig-cc<$mailx-orig-cc> mailx-orig-bcc<$mailx-orig-bcc>
3692 wysh set on-compose-splice=t_ocs \
3693 on-compose-enter=t_oce on-compose-leave=t_ocl \
3694 on-compose-cleanup=t_occ
3695 __EOT__
3697 printf 'm this-goes@nowhere\nbody\n!.\n' |
3698 ${MAILX} ${ARGS} -Snomemdebug -Sescape=! -Sstealthmua=noagent \
3699 -X'source ./.trc' -Smta=./.tmta.sh \
3700 >./.tall 2>&1
3701 ${cat} ./.tall >> "${MBOX}"
3702 check behave:compose_hooks-1 0 "${MBOX}" '522535560 10101'
3704 ${rm} "${MBOX}"
3705 printf 'm this-goes@nowhere\nbody\n!.\n' |
3706 ${MAILX} ${ARGS} -Snomemdebug -Sescape=! -Sstealthmua=noagent \
3707 -St_remove=1 -X'source ./.trc' -Smta=./.tmta.sh \
3708 >./.tall 2>&1
3709 ${cat} ./.tall >> "${MBOX}"
3710 check behave:compose_hooks-2 0 "${MBOX}" '3654000499 12535'
3714 # Some state machine stress, shell compose hook, localopts for hook, etc.
3715 # readctl in child. ~r as HERE document
3716 ${rm} "${MBOX}"
3717 printf 'm ex@am.ple\nbody\n!.
3718 echon ${mailx-command}${mailx-subject}
3719 echon ${mailx-from}${mailx-sender}
3720 echon ${mailx-to}${mailx-cc}${mailx-bcc}
3721 echon ${mailx-raw-to}${mailx-raw-cc}${mailx-raw-bcc}
3722 echon ${mailx-orig-from}${mailx-orig-to}${mailx-orig-gcc}${mailx-orig-bcc}
3723 var t_oce t_ocs t_ocs_sh t_ocl t_occ autocc
3724 ' | ${MAILX} ${ARGS} -Snomemdebug -Sescape=! \
3725 -Smta=./.tmta.sh \
3727 define bail {
3728 echoerr "Failed: $1. Bailing out"; echo "~x"; xit
3730 define xerr {
3731 vput vexpr es substr "$1" 0 1
3732 if [ "$es" != 2 ]
3733 xcall bail "$2"
3736 define read_mline_res {
3737 read hl; wysh set len=$? es=$! en=$^ERRNAME;\
3738 echo $len/$es/$^ERRNAME: $hl
3739 if [ $es -ne $^ERR-NONE ]
3740 xcall bail read_mline_res
3741 elif [ $len -ne 0 ]
3742 \xcall read_mline_res
3745 define _work {
3746 vput vexpr i + 1 "$2"
3747 if [ $i -lt 111 ]
3748 vput vexpr j % $i 10
3749 if [ $j -ne 0 ]
3750 set j=xcall
3751 else
3752 echon "$i.. "
3753 set j=call
3755 eval \\$j _work $1 $i
3756 return $?
3758 vput vexpr i + $i "$1"
3759 return $i
3761 define _read {
3762 wysh set line; read line;wysh set es=$? en=$^ERRNAME ;\
3763 echo read:$es/$en: $line
3764 if [ "${es}" -ne -1 ]
3765 xcall _read
3767 readctl remove $cwd/.treadctl; echo readctl remove:$?/$^ERRNAME
3769 define t_ocs {
3770 read ver
3771 echo t_ocs
3772 echo "~^header list"; read hl; echo $hl;\
3773 vput vexpr es substr "$hl" 0 1
3774 if [ "$es" != 2 ]
3775 xcall bail "header list"
3776 endif
3778 call _work 1; echo $?
3779 echo "~^header insert cc splicy diet <splice@exam.ple> spliced";\
3780 read es; echo $es; vput vexpr es substr "$es" 0 1
3781 if [ "$es" != 2 ]
3782 xcall bail "be diet"
3783 endif
3784 echo "~^header insert cc <splice2@exam.ple>";\
3785 read es; echo $es; vput vexpr es substr "$es" 0 1
3786 if [ "$es" != 2 ]
3787 xcall bail "be diet2"
3788 endif
3790 call _work 2; echo $?
3791 echo "~^header insert bcc juicy juice <juice@exam.ple> spliced";\
3792 read es; echo $es;vput vexpr es substr "$es" 0 1
3793 if [ "$es" != 2 ]
3794 xcall bail "be juicy"
3795 endif
3796 echo "~^header insert bcc juice2@exam.ple";\
3797 read es; echo $es;vput vexpr es substr "$es" 0 1
3798 if [ "$es" != 2 ]
3799 xcall bail "be juicy2"
3800 endif
3801 echo "~^header insert bcc juice3 <juice3@exam.ple>";\
3802 read es; echo $es;vput vexpr es substr "$es" 0 1
3803 if [ "$es" != 2 ]
3804 xcall bail "be juicy3"
3805 endif
3806 echo "~^header insert bcc juice4@exam.ple";\
3807 read es; echo $es;vput vexpr es substr "$es" 0 1
3808 if [ "$es" != 2 ]
3809 xcall bail "be juicy4"
3810 endif
3812 echo "~^header remove-at bcc 3";\
3813 read es; echo $es;vput vexpr es substr "$es" 0 1
3814 if [ "$es" != 2 ]
3815 xcall bail "remove juicy5"
3816 endif
3817 echo "~^header remove-at bcc 2";\
3818 read es; echo $es;vput vexpr es substr "$es" 0 1
3819 if [ "$es" != 2 ]
3820 xcall bail "remove juicy6"
3821 endif
3822 echo "~^header remove-at bcc 3";\
3823 read es; echo $es;vput vexpr es substr "$es" 0 3
3824 if [ "$es" != 501 ]
3825 xcall bail "failed to remove-at"
3826 endif
3827 # Add duplicates which ought to be removed!
3828 echo "~^header insert bcc juice4@exam.ple";\
3829 read es; echo $es;vput vexpr es substr "$es" 0 1
3830 if [ "$es" != 2 ]
3831 xcall bail "be juicy4-1"
3832 endif
3833 echo "~^header insert bcc juice4@exam.ple";\
3834 read es; echo $es;vput vexpr es substr "$es" 0 1
3835 if [ "$es" != 2 ]
3836 xcall bail "be juicy4-2"
3837 endif
3838 echo "~^header insert bcc juice4@exam.ple";\
3839 read es; echo $es;vput vexpr es substr "$es" 0 1
3840 if [ "$es" != 2 ]
3841 xcall bail "be juicy4-3"
3842 endif
3843 echo "~:set t_ocs"
3846 call _work 3; echo $?
3847 echo "~r - '__EOT'"
3848 vput ! i echo just knock if you can hear me;\
3849 i=0;\
3850 while [ $i -lt 24 ]; do printf "%s " $i; i=`expr $i + 1`; done;\
3851 echo relax
3852 echon shell-cmd says $?/$^ERRNAME: $i
3853 echo "~x will not become interpreted, we are reading until __EOT"
3854 echo "__EOT"
3855 read r_status; echo "~~r status output: $r_status"
3856 echo "~:echo $? $! $^ERRNAME"
3857 read r_status
3858 echo "~~r status from parent: $r_status"
3861 call _work 4; echo $?
3862 vput cwd cwd;echo cwd:$?
3863 readctl create $cwd/.treadctl ;echo readctl:$?/$^ERRNAME;\
3864 call _read
3867 call _work 5; echo $?
3868 echo "~^header show MAILX-Command"; read es;\
3869 call xerr $es "t_header 1000"; call read_mline_res
3870 echo "~^header show MAILX-raw-TO"; read es;\
3871 call xerr $es "t_header 1001"; xcall read_mline_res
3873 echoerr IT IS WRONG IF YOU SEE THIS
3875 define t_oce {
3876 echo on-compose-enter, mailx-command<$mailx-command>
3877 set t_oce autobcc=oce@exam.ple
3878 alternates alter1@exam.ple alter2@exam.ple
3879 alternates
3880 echo mailx-from<$mailx-from> mailx-sender<$mailx-sender>
3881 echo mailx-subject<$mailx-subject>
3882 echo mailx-to<$mailx-to> mailx-cc<$mailx-cc> mailx-bcc<$mailx-bcc>
3883 echo mailx-raw-to<$mailx-raw-to> mailx-raw-cc<$mailx-raw-cc> \
3884 mailx-raw-bcc<$mailx-raw-bcc>
3885 echo mailx-orig-from<$mailx-orig-from> \
3886 mailx-orig-to<$mailx-orig-to> \
3887 mailx-orig-cc<$mailx-orig-cc> mailx-orig-bcc<$mailx-orig-bcc>
3889 define t_ocl {
3890 echo on-compose-leave, mailx-command<$mailx-command>
3891 set t_ocl autocc=ocl@exam.ple
3892 unalternates *
3893 alternates alter3@exam.ple alter4@exam.ple
3894 alternates
3895 echo mailx-from<$mailx-from> mailx-sender<$mailx-sender>
3896 echo mailx-subject<$mailx-subject>
3897 echo mailx-to<$mailx-to> mailx-cc<$mailx-cc> mailx-bcc<$mailx-bcc>
3898 echo mailx-raw-to<$mailx-raw-to> mailx-raw-cc<$mailx-raw-cc> \
3899 mailx-raw-bcc<$mailx-raw-bcc>
3900 echo mailx-orig-from<$mailx-orig-from> \
3901 mailx-orig-to<$mailx-orig-to> \
3902 mailx-orig-cc<$mailx-orig-cc> mailx-orig-bcc<$mailx-orig-bcc>
3904 define t_occ {
3905 echo on-compose-cleanup, mailx-command<$mailx-command>
3906 set t_occ autocc=occ@exam.ple
3907 unalternates *
3908 alternates
3909 echo mailx-from<$mailx-from> mailx-sender<$mailx-sender>
3910 echo mailx-subject<$mailx-subject>
3911 echo mailx-to<$mailx-to> mailx-cc<$mailx-cc> mailx-bcc<$mailx-bcc>
3912 echo mailx-raw-to<$mailx-raw-to> mailx-raw-cc<$mailx-raw-cc> \
3913 mailx-raw-bcc<$mailx-raw-bcc>
3914 echo mailx-orig-from<$mailx-orig-from> \
3915 mailx-orig-to<$mailx-orig-to> \
3916 mailx-orig-cc<$mailx-orig-cc> mailx-orig-bcc<$mailx-orig-bcc>
3918 wysh set on-compose-splice=t_ocs \
3919 on-compose-splice-shell="read ver;echo t_ocs-shell;\
3920 echo \"~t shell@exam.ple\"; echo \"~:set t_ocs_sh\"" \
3921 on-compose-enter=t_oce on-compose-leave=t_ocl \
3922 on-compose-cleanup=t_occ
3923 ' > ./.tnotes 2>&1
3924 ex0_test behave:compose_hooks-3-estat
3925 ${cat} ./.tnotes >> "${MBOX}"
3927 check behave:compose_hooks-3 - "${MBOX}" '679526364 2431'
3929 # Reply, forward, resend, Resend
3931 ${rm} "${MBOX}"
3932 printf 'set from=f1@z\nm t1@z\nb1\n!.\nset from=f2@z\nm t2@z\nb2\n!.\n' |
3933 ${MAILX} ${ARGS} -Snomemdebug -Sescape=! \
3934 -Smta=./.tmta.sh
3936 printf '
3937 echo start: $? $! $^ERRNAME
3938 File %s
3939 echo File: $? $! $^ERRNAME;echo;echo
3940 reply 1
3941 this is content of reply 1
3943 echo reply 1: $? $! $^ERRNAME;echo;echo
3944 Reply 1 2
3945 this is content of Reply 1 2
3947 echo Reply 1 2: $? $! $^ERRNAME;echo;echo
3948 forward 1 fwdex@am.ple
3949 this is content of forward 1
3951 echo forward 1: $? $! $^ERRNAME;echo;echo
3952 resend 1 2 resendex@am.ple
3953 echo resend 1 2: $? $! $^ERRNAME;echo;echo
3954 Resend 1 2 Resendex@am.ple
3955 echo Resend 1 2: $? $! $^ERRNAME;echo;echo
3956 ' "${MBOX}" |
3957 ${MAILX} ${ARGS} -Snomemdebug -Sescape=! \
3958 -Smta=./.tmta.sh \
3960 define bail {
3961 echoerr "Failed: $1. Bailing out"; echo "~x"; xit
3963 define xerr {
3964 vput vexpr es substr "$1" 0 1
3965 if [ "$es" != 2 ]
3966 xcall bail "$2"
3969 define read_mline_res {
3970 read hl; wysh set len=$? es=$! en=$^ERRNAME;\
3971 echo mline_res:$len/$es/$^ERRNAME: $hl
3972 if [ $es -ne $^ERR-NONE ]
3973 xcall bail read_mline_res
3974 elif [ $len -ne 0 ]
3975 \xcall read_mline_res
3978 define work_hl {
3979 echo "~^header show $1"; read es;\
3980 call xerr $es "work_hl $1"; echo $1; call read_mline_res
3981 if [ $# -gt 1 ]
3982 shift
3983 xcall work_hl "$@"
3986 define t_ocs {
3987 read ver
3988 echo t_ocs version $ver
3989 echo "~^header list"; read hl; echo $hl;\
3990 echoerr the header list is $hl;\
3991 call xerr "$hl" "header list"
3992 eval vpospar set $hl
3993 shift
3994 xcall work_hl "$@"
3995 echoerr IT IS WRONG IF YOU SEE THIS
3997 define t_oce {
3998 echo on-XY-enter, mailx-command<$mailx-command>
3999 set t_oce autobcc=oce@exam.ple
4000 echo mailx-from<$mailx-from> mailx-sender<$mailx-sender>
4001 echo mailx-subject<$mailx-subject>
4002 echo mailx-to<$mailx-to> mailx-cc<$mailx-cc> mailx-bcc<$mailx-bcc>
4003 echo mailx-raw-to<$mailx-raw-to> mailx-raw-cc<$mailx-raw-cc> \
4004 mailx-raw-bcc<$mailx-raw-bcc>
4005 echo mailx-orig-from<$mailx-orig-from> \
4006 mailx-orig-to<$mailx-orig-to> \
4007 mailx-orig-cc<$mailx-orig-cc> mailx-orig-bcc<$mailx-orig-bcc>
4009 define t_ocl {
4010 echo on-XY-leave, mailx-command<$mailx-command>
4011 set t_ocl autocc=ocl@exam.ple
4012 echo mailx-from<$mailx-from> mailx-sender<$mailx-sender>
4013 echo mailx-subject<$mailx-subject>
4014 echo mailx-to<$mailx-to> mailx-cc<$mailx-cc> mailx-bcc<$mailx-bcc>
4015 echo mailx-raw-to<$mailx-raw-to> mailx-raw-cc<$mailx-raw-cc> \
4016 mailx-raw-bcc<$mailx-raw-bcc>
4017 echo mailx-orig-from<$mailx-orig-from> \
4018 mailx-orig-to<$mailx-orig-to> \
4019 mailx-orig-cc<$mailx-orig-cc> mailx-orig-bcc<$mailx-orig-bcc>
4021 define t_occ {
4022 echo on-XY-cleanup, mailx-command<$mailx-command>
4023 set t_occ autocc=occ@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> \
4030 mailx-orig-to<$mailx-orig-to> \
4031 mailx-orig-cc<$mailx-orig-cc> mailx-orig-bcc<$mailx-orig-bcc>
4033 wysh set on-compose-splice=t_ocs \
4034 on-compose-enter=t_oce on-compose-leave=t_ocl \
4035 on-compose-cleanup=t_occ \
4036 on-resend-enter=t_oce on-resend-cleanup=t_occ
4037 ' > ./.tnotes 2>&1
4038 ex0_test behave:compose_hooks-4-estat
4039 ${cat} ./.tnotes >> "${MBOX}"
4041 check behave:compose_hooks-4 - "${MBOX}" '3038884027 7516'
4043 t_epilog
4046 t_behave_C_opt_customhdr() {
4047 t_prolog t_behave_C_opt_customhdr
4048 TRAP_EXIT_ADDONS="./.t*"
4050 t_xmta 'CimicifugaRacemosa Mon Dec 25 21:33:40 2017'
4052 echo bla |
4053 ${MAILX} ${ARGS} -Smta=./.tmta.sh \
4054 -C 'C-One : Custom One Body' \
4055 -C 'C-Two:CustomTwoBody' \
4056 -S customhdr='chdr1: chdr1 body, chdr2:chdr2 body' \
4057 this-goes@nowhere >./.tall 2>&1
4058 ex0_test behave:C_opt_customhdr-1-estat
4059 ${cat} ./.tall >> "${MBOX}"
4060 check behave:C_opt_customhdr-1 0 "${MBOX}" '2400078426 195'
4062 ${rm} "${MBOX}"
4063 printf 'm this-goes@nowhere\nbody\n!.
4064 unset customhdr
4065 m this-goes2@nowhere\nbody2\n!.
4066 set customhdr=%ccustom1 : custom1 body%c
4067 m this-goes2@nowhere\nbody2\n!.
4068 set customhdr=%ccustom1 : custom1\\, body , custom2: custom2 body%c
4069 m this-goes3@nowhere\nbody3\n!.
4070 ' "'" "'" "'" "'" |
4071 ${MAILX} ${ARGS} -Smta=./.tmta.sh -Sescape=! \
4072 -C 'C-One : Custom One Body' \
4073 -C 'C-Two:CustomTwoBody' \
4074 -S customhdr='chdr1: chdr1 body, chdr2:chdr2 body' \
4075 >./.tall 2>&1
4076 ex0_test behave:C_opt_customhdr-2-estat
4077 ${cat} ./.tall >> "${MBOX}"
4078 check behave:C_opt_customhdr-2 0 "${MBOX}" '3546878678 752'
4080 t_epilog
4083 t_behave_quote_a_cmd_escapes() {
4084 t_prolog t_behave_quote_a_cmd_escapes
4085 TRAP_EXIT_ADDONS="./.t*"
4087 t_xmta
4089 echo 'included file' > ./.ttxt
4091 ${cat} <<-_EOT > ./.tmbox
4092 From neverneverland Sun Jul 23 13:46:25 2017
4093 Subject: Bugstop: five miles out 1
4094 Reply-To: mister originator1 <mr1@originator>
4095 From: mister originator1 <mr1@originator>
4096 To: bugstop-commit@five.miles.out
4097 Cc: is1@a.list
4098 In-reply-to: <20170719111113.bkcMz%laber1@backe.eu>
4099 Date: Wed, 19 Jul 2017 09:22:57 -0400
4100 Message-Id: <20170719132257.766AF781267-1@originator>
4101 Status: RO
4103 That's appalling, I.
4105 From neverneverland Sun Jul 23 13:47:25 2017
4106 Subject: Bugstop: five miles out 2
4107 Reply-To: mister originator2 <mr2@originator>
4108 From: mister originator2 <mr2@originator>
4109 To: bugstop-commit@five.miles.out
4110 Cc: is2@a.list
4111 In-reply-to: <20170719111113.bkcMz%laber2@backe.eu>
4112 Date: Wed, 19 Jul 2017 09:23:57 -0400
4113 Message-Id: <20170719132257.766AF781267-2@originator>
4114 Status: RO
4116 That's appalling, II.
4118 From neverneverland Sun Jul 23 13:48:25 2017
4119 Subject: Bugstop: five miles out 3
4120 Reply-To: mister originator3 <mr3@originator>
4121 From: mister originator3 <mr3@originator>
4122 To: bugstop-commit@five.miles.out
4123 Cc: is3@a.list
4124 In-reply-to: <20170719111113.bkcMz%laber3@backe.eu>
4125 Date: Wed, 19 Jul 2017 09:24:57 -0400
4126 Message-Id: <20170719132257.766AF781267-3@originator>
4127 Status: RO
4129 That's appalling, III.
4131 _EOT
4133 printf '#
4134 set indentprefix=" |"
4135 set quote
4136 reply 2
4138 set quote=noheading
4139 reply 2
4141 headerpick type retain cc date from message-id reply-to subject to
4142 set quote=headers
4143 reply 2
4145 set quote=allheaders
4146 reply 2
4148 ' | ${MAILX} ${ARGS} -Smta=./.tmta.sh -Rf \
4149 -Sescape=! -Sindentprefix=' >' \
4150 ./.tmbox >./.tall 2>&1
4151 ex0_test behave:quote_a_cmd_escapes-1-estat
4152 ${cat} ./.tall >> "${MBOX}"
4153 check behave:quote_a_cmd_escapes-1 0 "${MBOX}" '3048941846 2023'
4155 # ~@ is tested with other attachment stuff, ~^ is in compose_hooks
4156 ${rm} "${MBOX}"
4157 printf '#
4158 set Sign=SignVar sign=signvar DEAD=./.ttxt
4159 headerpick type retain Subject
4160 reply 2
4161 !!1 Not escaped. And shell test last, right before !..
4162 !: echo 2 only echoed via colon
4163 !_ echo 3 only echoed via underscore
4164 !< ./.ttxt
4165 !<! echo 5 shell echo included
4166 !| echo 6 pipecmd-pre; cat; echo 6 pipecmd-post
4167 7 and 8 are ~A and ~a:
4170 !b 9 added ~b cc <ex1@am.ple>
4171 !c 10 added ~c c <ex2@am.ple>
4172 11 next ~d / $DEAD
4174 12: ~F
4176 13: ~F 1 3
4177 !F 1 3
4178 14: ~f (headerpick: subject)
4180 15: ~f 1
4181 !f 1
4182 16, 17: ~I Sign, ~i Sign
4183 !I Sign
4184 !i Sign
4185 18: ~M
4187 19: ~M 1
4188 !M 1
4189 20: ~m
4191 21: ~m 3
4192 !m 3
4193 22: ~R ./.ttxt
4194 !R ./.ttxt
4195 23: ~r ./.ttxt
4196 !r ./.ttxt
4197 24: ~s this new subject
4198 !s 24 did new ~s ubject
4199 !t 25 added ~t o <ex3@am.ple>
4200 26: ~U
4202 27: ~U 1
4203 !U 1
4204 and i ~w rite this out to ./.tmsg
4205 !w ./.tmsg
4206 !:wysh set x=$escape;set escape=~
4207 ~!echo shell command output
4208 ~:wysh set escape=$x
4210 ' | ${MAILX} ${ARGS} -Smta=./.tmta.sh -Rf \
4211 -Sescape=! -Sindentprefix=' |' \
4212 ./.tmbox >./.tall 2>&1
4213 ex0_test behave:quote_a_cmd_escapes-2-estat
4214 ${cat} ./.tall >> "${MBOX}"
4215 check behave:quote_a_cmd_escapes-2 0 "${MBOX}" '375879934 3604'
4216 check behave:quote_a_cmd_escapes-3 - ./.tmsg '2112542907 2789'
4218 t_epilog
4221 t_behave_mass_recipients() {
4222 t_prolog t_behave_mass_recipients
4223 TRAP_EXIT_ADDONS="./.t*"
4225 t_xmta 'Eucalyptus Sat Jul 08 21:14:57 2017'
4227 ${cat} <<'__EOT__' > ./.trc
4228 define bail {
4229 echoerr "Failed: $1. Bailing out"; echo "~x"; xit
4231 define ins_addr {
4232 wysh set nr=$1 hn=$2
4233 echo "~$hn $hn$nr@$hn"; echo '~:echo $?'; read es
4234 if [ "$es" -ne 0 ]
4235 xcall bail "ins_addr $hn 1-$nr"
4237 vput vexpr nr + $nr 1
4238 if [ "$nr" -le "$maximum" ]
4239 xcall ins_addr $nr $hn
4242 define bld_alter {
4243 wysh set nr=$1 hn=$2
4244 alternates $hn$nr@$hn
4245 vput vexpr nr + $nr 2
4246 if [ "$nr" -le "$maximum" ]
4247 xcall bld_alter $nr $hn
4250 define t_ocs {
4251 read ver
4252 call ins_addr 1 t
4253 call ins_addr 1 c
4254 call ins_addr 1 b
4256 define t_ocl {
4257 if [ "$t_remove" != '' ]
4258 call bld_alter 1 t
4259 call bld_alter 2 c
4262 set on-compose-splice=t_ocs on-compose-leave=t_ocl
4263 __EOT__
4265 printf 'm this-goes@nowhere\nbody\n!.\n' |
4266 ${MAILX} ${ARGS} -Snomemdebug -Sescape=! -Sstealthmua=noagent \
4267 -X'source ./.trc' -Smta=./.tmta.sh -Smaximum=2001 \
4268 >./.tall 2>&1
4269 ex0_test behave:mass_recipients-1-estat
4270 ${cat} ./.tall >> "${MBOX}"
4271 check behave:mass_recipients-1 - "${MBOX}" '2912243346 51526'
4273 ${rm} "${MBOX}"
4274 printf 'm this-goes@nowhere\nbody\n!.\n' |
4275 ${MAILX} ${ARGS} -Snomemdebug -Sescape=! -Sstealthmua=noagent \
4276 -St_remove=1 -X'source ./.trc' -Smta=./.tmta.sh -Smaximum=2001 \
4277 >./.tall 2>&1
4278 ex0_test behave:mass_recipients-2-estat
4279 ${cat} ./.tall >> "${MBOX}"
4280 check behave:mass_recipients-2 - "${MBOX}" '4097804632 34394'
4282 t_epilog
4285 t_behave_mime_types_load_control() {
4286 t_prolog t_behave_mime_types_load_control
4287 if have_feat uistrings; then :; else
4288 echo 'behave:mime_types_load_control: unsupported, skipped'
4289 return
4291 TRAP_EXIT_ADDONS="./.t*"
4293 ${cat} <<-_EOT > ./.tmts1
4294 @ application/mathml+xml mathml
4295 _EOT
4296 ${cat} <<-_EOT > ./.tmts2
4297 @ x-conference/x-cooltalk ice
4298 @ aga-aga aga
4299 @ application/aga-aga aga
4300 _EOT
4302 ${cat} <<-_EOT > ./.tmts1.mathml
4303 <head>nonsense ML</head>
4304 _EOT
4305 ${cat} <<-_EOT > ./.tmts2.ice
4306 Icy, icy road.
4307 _EOT
4308 printf 'of which the c\x01rack is coming soon' > ./.tmtsx.doom
4309 printf 'of which the c\x01rack is coming soon' > ./.tmtsx.aga
4311 printf '
4312 m %s
4313 Schub-di-du
4314 ~@ ./.tmts1.mathml
4315 ~@ ./.tmts2.ice
4316 ~@ ./.tmtsx.doom
4317 ~@ ./.tmtsx.aga
4319 File %s
4320 from*
4321 type
4323 ' "${MBOX}" "${MBOX}" |
4324 ${MAILX} ${ARGS} \
4325 -Smimetypes-load-control=f=./.tmts1,f=./.tmts2 \
4326 > ./.tout 2>&1
4327 ex0_test behave:mime_types_load_control-1-estat
4328 ${cat} "${MBOX}" >> ./.tout
4329 check behave:mime_types_load_control-1 - ./.tout '1441260727 2449'
4331 echo type | ${MAILX} ${ARGS} -R \
4332 -Smimetypes-load-control=f=./.tmts1,f=./.tmts3 \
4333 -f "${MBOX}" >> ./.tout 2>&1
4334 check behave:mime_types_load_control-2 0 ./.tout '1441391438 3646'
4336 t_epilog
4339 t_behave_lreply_futh_rth_etc() {
4340 t_prolog t_behave_lreply_futh_rth_etc
4341 TRAP_EXIT_ADDONS="./.t*"
4343 t_xmta 'HumulusLupulus Thu Jul 27 14:41:20 2017'
4345 ${cat} <<-_EOT > ./.tmbox
4346 From neverneverland Sun Jul 23 13:46:25 2017
4347 Subject: Bugstop: five miles out 1
4348 Reply-To: mister originator2 <mr2@originator>, bugstop@five.miles.out
4349 From: mister originator <mr@originator>
4350 To: bugstop-commit@five.miles.out, laber@backe.eu
4351 Cc: is@a.list
4352 Mail-Followup-To: bugstop@five.miles.out, laber@backe.eu, is@a.list
4353 In-reply-to: <20170719111113.bkcMz%laber@backe.eu>
4354 Date: Wed, 19 Jul 2017 09:22:57 -0400
4355 Message-Id: <20170719132257.766AF781267@originator>
4356 Status: RO
4358 > |Sorry, I think I misunderstand something. I would think that
4360 That's appalling.
4362 From neverneverland Fri Jul 7 22:39:11 2017
4363 Subject: Bugstop: five miles out 2
4364 Reply-To: mister originator2<mr2@originator>,bugstop@five.miles.out,is@a.list
4365 Content-Transfer-Encoding: 7bit
4366 From: mister originator <mr@originator>
4367 To: bugstop-commit@five.miles.out
4368 Cc: is@a.list
4369 Message-ID: <149945963975.28888.6950788126957753723.reportbug@five.miles.out>
4370 Date: Fri, 07 Jul 2017 16:33:59 -0400
4371 Status: R
4373 capable of changing back.
4375 From neverneverland Fri Jul 7 22:42:00 2017
4376 Subject: Bugstop: five miles out 3
4377 Reply-To: mister originator2 <mr2@originator>, bugstop@five.miles.out
4378 Content-Transfer-Encoding: 7bit
4379 From: mister originator <mr@originator>
4380 To: bugstop-commit@five.miles.out
4381 Cc: is@a.list
4382 Message-ID: <149945963975.28888.6950788126957753746.reportbug@five.miles.out>
4383 Date: Fri, 07 Jul 2017 16:33:59 -0400
4384 List-Post: <mailto:bugstop@five.miles.out>
4385 Status: R
4387 are you ready, boots?
4389 From neverneverland Sat Aug 19 23:15:00 2017
4390 Subject: Bugstop: five miles out 4
4391 Reply-To: mister originator2 <mr2@originator>, bugstop@five.miles.out
4392 Content-Transfer-Encoding: 7bit
4393 From: mister originator <mr@originator>
4394 To: bugstop@five.miles.out
4395 Cc: is@a.list
4396 Message-ID: <149945963975.28888.6950788126qtewrqwer.reportbug@five.miles.out>
4397 Date: Fri, 07 Jul 2017 16:33:59 -0400
4398 List-Post: <mailto:bugstop@five.miles.out>
4399 Status: R
4401 are you ready, boots?
4402 _EOT
4406 ${cat} <<-'_EOT' | ${MAILX} ${ARGS} -Sescape=! -Smta=./.tmta.sh \
4407 -Rf ./.tmbox >> "${MBOX}" 2>&1
4408 define r {
4409 wysh set m="This is text of \"reply ${1}."
4410 reply 1 2 3
4411 !I m
4414 !I m
4417 !I m
4420 echo -----After reply $1.1 - $1.3: $?/$^ERRNAME
4422 define R {
4423 wysh set m="This is text of \"Reply ${1}."
4424 eval Reply $2
4425 !I m
4426 !I 2
4429 echo -----After Reply $1.$2: $?/$^ERRNAME
4431 define _Lh {
4432 read protover
4433 echo '~I m'
4434 echo '~I n'
4435 echo '".'
4437 define _Ls {
4438 wysh set m="This is text of \"Lreply ${1}." on-compose-splice=_Lh n=$2
4439 eval Lreply $2
4441 define L {
4442 # We need two indirections for this test: one for the case that Lreply
4443 # fails because of missing recipients: we need to read EOF next, thus
4444 # place this in _Ls last; and second for the succeeding cases EOF is
4445 # not what these should read, so go over the backside and splice it in!
4446 call _Ls "$@"
4447 echo -----After Lreply $1.$2: $?/$^ERRNAME
4449 define x {
4450 localopts call-fixate yes
4451 call r $1
4452 call R $1 1; call R $1 2; call R $1 3; call R $1 4
4453 call L $1 1; call L $1 2; call L $1 3
4455 define tweak {
4456 echo;echo '===== CHANGING === '"$*"' =====';echo
4457 eval "$@"
4460 set from=laber@backe.eu
4461 mlist is@a.list
4462 call x 1
4463 call tweak set reply-to-honour
4464 call x 2
4465 call tweak set followup-to
4466 call x 3
4467 call tweak set followup-to-honour
4468 call x 4
4469 call tweak mlist bugstop@five.miles.out
4470 call x 5
4471 call tweak mlsubscribe bugstop@five.miles.out
4472 call x 6
4473 call tweak set recipients-in-cc
4474 call x 7
4475 _EOT
4477 ex0_test behave:lreply_futh_rth_etc-1-estat
4478 if have_feat uistrings; then # xxx should not be so, skip??
4479 check behave:lreply_futh_rth_etc-1 - "${MBOX}" '940818845 29373'
4480 else
4481 check behave:lreply_futh_rth_etc-1 - "${MBOX}" '3917430455 29259'
4486 ${cat} <<-_EOT > ./.tmbox
4487 From tom@i-i.example Thu Oct 26 03:15:55 2017
4488 Date: Wed, 25 Oct 2017 21:15:46 -0400
4489 From: tom <tom@i-i.example>
4490 To: Steffen Nurpmeso <steffen@sdaoden.eu>
4491 Cc: tom <tom@i-i.example>
4492 Subject: Re: xxxx yyyyyyyy configure does not really like a missing zzzzz
4493 Message-ID: <20171026011546.GA11643@i-i.example>
4494 Reply-To: tom@i-i.example
4495 References: <20171025214601.T2pNd%steffen@sdaoden.eu>
4496 In-Reply-To: <20171025214601.T2pNd%steffen@sdaoden.eu>
4497 Status: R
4499 The report's useful :-)
4500 _EOT
4502 printf 'reply 1\nthank you\n!.\n' |
4503 ${MAILX} ${ARGS} -Sescape=! -Smta=./.tmta.sh -Sreply-to-honour \
4504 -Rf ./.tmbox > "${MBOX}" 2>&1
4505 check behave:lreply_futh_rth_etc-2 0 "${MBOX}" '1045866991 331'
4507 t_epilog
4510 t_behave_mime_if_not_ascii() {
4511 t_prolog t_behave_mime_if_not_ascii
4513 </dev/null ${MAILX} ${ARGS} -s Subject "${MBOX}" >> "${MBOX}" 2>&1
4514 check behave:mime_if_not_ascii-1 0 "${MBOX}" '2287855519 110'
4516 </dev/null ${MAILX} ${ARGS} -Scharset-7bit=not-ascii -s Subject "${MBOX}" \
4517 >> "${MBOX}" 2>&1
4518 check behave:mime_if_not_ascii-2 0 "${MBOX}" '70754682 282'
4520 t_epilog
4523 t_behave_xxxheads_rfc2047() {
4524 t_prolog t_behave_xxxheads_rfc2047
4525 TRAP_EXIT_ADDONS="./.t*"
4527 t_xmta 'GentianaLutea Mon Dec 04 17:15:29 2017'
4529 echo | ${MAILX} ${ARGS} ${ADDARG_UNI} \
4530 -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̲' \
4531 "${MBOX}"
4532 check behave:xxxheads_rfc2047-1 0 "${MBOX}" '3370931614 375'
4534 # Single word (overlong line split -- bad standard! Requires injection of
4535 # artificial data!! But can be prevented by using RFC 2047 encoding)
4536 ${rm} "${MBOX}"
4537 i=`${awk} 'BEGIN{for(i=0; i<92; ++i) printf "0123456789_"}'`
4538 echo | ${MAILX} ${ARGS} -s "${i}" "${MBOX}"
4539 check behave:xxxheads_rfc2047-2 0 "${MBOX}" '489922370 1718'
4541 # Combination of encoded words, space and tabs of varying sort
4542 ${rm} "${MBOX}"
4543 echo | ${MAILX} ${ARGS} ${ADDARG_UNI} \
4544 -s "1Abrä Kaspas1 2Abra Katä b_kaspas2 \
4545 3Abrä Kaspas3 4Abrä Kaspas4 5Abrä Kaspas5 \
4546 6Abra Kaspas6 7Abrä Kaspas7 8Abra Kaspas8 \
4547 9Abra Kaspastäb4-3 10Abra Kaspas1 _ 11Abra Katäb1 \
4548 12Abra Kadabrä1 After Tab after Täb this is NUTS" \
4549 "${MBOX}"
4550 check behave:xxxheads_rfc2047-3 0 "${MBOX}" '1676887734 591'
4552 # Overlong multibyte sequence that must be forcefully split
4553 # todo This works even before v15.0, but only by accident
4554 ${rm} "${MBOX}"
4555 echo | ${MAILX} ${ARGS} ${ADDARG_UNI} \
4556 -s "✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄\
4557 ✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄\
4558 ✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄" \
4559 "${MBOX}"
4560 check behave:xxxheads_rfc2047-4 0 "${MBOX}" '3029301775 659'
4562 # Trailing WS
4563 ${rm} "${MBOX}"
4564 echo | ${MAILX} ${ARGS} \
4565 -s "1-1 B2 B3 B4 B5 B6 B\
4566 1-2 B2 B3 B4 B5 B6 B\
4567 1-3 B2 B3 B4 B5 B6 B\
4568 1-4 B2 B3 B4 B5 B6 B\
4569 1-5 B2 B3 B4 B5 B6 B\
4570 1-6 B2 B3 B4 B5 B6 " \
4571 "${MBOX}"
4572 check behave:xxxheads_rfc2047-5 0 "${MBOX}" '4126167195 297'
4574 # Leading and trailing WS
4575 ${rm} "${MBOX}"
4576 echo | ${MAILX} ${ARGS} \
4577 -s " 2-1 B2 B3 B4 B5 B6 B\
4578 1-2 B2 B3 B4 B5 B6 B\
4579 1-3 B2 B3 B4 B5 B6 B\
4580 1-4 B2 B3 B4 B5 B6 " \
4581 "${MBOX}"
4582 check behave:xxxheads_rfc2047-6 0 "${MBOX}" '3600624479 236'
4584 # RFC 2047 in an address field! (Missing test caused v14.9.6!)
4585 ${rm} "${MBOX}"
4586 echo "Dat Früchtchen riecht häußlich" |
4587 ${MAILX} ${ARGS} ${ADDARG_UNI} -Sfullnames -Smta=./.tmta.sh \
4588 -s Hühöttchen \
4589 'Schnödes "Früchtchen" <do@du> (Hä!)'
4590 check behave:xxxheads_rfc2047-7 0 "${MBOX}" '800505986 368'
4592 # RFC 2047 in an address field, and iconv involved
4593 if have_feat iconv; then
4594 ${rm} "${MBOX}"
4595 ${cat} > ./.trebox <<_EOT
4596 From zaza@exam.ple Fri Mar 2 21:31:56 2018
4597 Date: Fri, 2 Mar 2018 20:31:45 +0000
4598 From: z=?iso-8859-1?Q?=E1?=za <zaza@exam.ple>
4599 To: dude <dude@exam.ple>
4600 Subject: houston(...)
4601 Message-ID: <abra@1>
4602 MIME-Version: 1.0
4603 Content-Type: text/plain; charset=iso-8859-1
4604 Content-Disposition: inline
4605 Content-Transfer-Encoding: 8bit
4607 _EOT
4608 echo reply | ${MAILX} ${ARGS} ${ADDARG_UNI} \
4609 -Sfullnames -Sreply-in-same-charset \
4610 -Smta=./.tmta.sh -Rf ./.trebox
4611 check behave:xxxheads_rfc2047-8 0 "${MBOX}" '2821484185 280'
4612 else
4613 echo 'behave:xxxheads_rfc2047-8: iconv unsupported, skipped'
4616 t_epilog
4619 t_behave_rfc2231() {
4620 t_prolog t_behave_rfc2231
4621 TRAP_EXIT_ADDONS="./.t*"
4624 mkdir ./.ttt || exit 1
4625 cd ./.ttt || exit 2
4626 : > "ma'ger.txt"
4627 : > "mä'ger.txt"
4628 : > 'diet\ is \curd.txt'
4629 : > 'diet "is" curd.txt'
4630 : > höde-tröge.txt
4631 : > 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
4632 : > höde__tröge__müde__dätte__hätte__vuelle__guelle__aese__aesse__sauerliche__kräuter__österliche__grüße__mäh.txt
4633 : > hööööööööööööööööö_nöööööööööööööööööööööö_düüüüüüüüüüüüüüüüüüü_bäääääääääääääääääääääääh.txt
4634 : > ✆✆✆✆✆✆✆✆✆✆✆✆✆✆✆✆✆✆✆✆✆✆✆✆.txt
4636 echo bla | ${MAILX} ${ARGS} ${ADDARG_UNI} \
4637 -a "./.ttt/ma'ger.txt" -a "./.ttt/mä'ger.txt" \
4638 -a './.ttt/diet\ is \curd.txt' -a './.ttt/diet "is" curd.txt' \
4639 -a ./.ttt/höde-tröge.txt \
4640 -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 \
4641 -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 \
4642 -a ./.ttt/hööööööööööööööööö_nöööööööööööööööööööööö_düüüüüüüüüüüüüüüüüüü_bäääääääääääääääääääääääh.txt \
4643 -a ./.ttt/✆✆✆✆✆✆✆✆✆✆✆✆✆✆✆✆✆✆✆✆✆✆✆✆.txt \
4644 "${MBOX}"
4645 check behave:rfc2231-1 0 "${MBOX}" '684985954 3092'
4647 # `resend' test, reusing $MBOX
4648 printf "Resend ./.t2\nx\n" | ${MAILX} ${ARGS} -Rf "${MBOX}"
4649 check behave:rfc2231-2 0 ./.t2 '684985954 3092'
4651 printf "resend ./.t3\nx\n" | ${MAILX} ${ARGS} -Rf "${MBOX}"
4652 check behave:rfc2231-3 0 ./.t3 '3130352658 3148'
4654 t_epilog
4657 t_behave_iconv_mbyte_base64() { # TODO uses sed(1) and special *headline*!!
4658 t_prolog t_behave_iconv_mbyte_base64
4659 TRAP_EXIT_ADDONS="./.t*"
4661 if [ -n "${UTF8_LOCALE}" ] && have_feat iconv; then
4662 if (</dev/null iconv -f ascii -t iso-2022-jp) >/dev/null 2>&1 ||
4663 (</dev/null iconv -f ascii -t euc-jp) >/dev/null 2>&1; then
4665 else
4666 echo 'behave:iconv_mbyte_base64: unsupported, skipped'
4667 return
4669 else
4670 echo 'behave:iconv_mbyte_base64: unsupported, skipped'
4671 return
4674 t_xmta 'DroseriaRotundifolia Thu Aug 03 17:26:25 2017'
4676 if (</dev/null iconv -f ascii -t iso-2022-jp) >/dev/null 2>&1; then
4677 ${cat} <<-'_EOT' | LC_ALL=${UTF8_LOCALE} ${MAILX} ${ARGS} \
4678 -Smta=./.tmta.sh \
4679 -Sescape=! -Smime-encoding=base64 2>./.terr
4680 set ttycharset=utf-8 sendcharsets=iso-2022-jp
4681 m t1@exam.ple
4682 !s Japanese from UTF-8 to ISO-2022-JP
4683 シジュウカラ科(シジュウカラか、学名 Paridae)は、鳥類スズメ目の科である。シジュウカラ(四十雀)と総称されるが、狭義にはこの1種をシジュウカラと呼ぶ。
4685 カンムリガラ(学名Parus cristatus)は、スズメ目シジュウカラ科に分類される鳥類の一種。
4688 カンムリガラ(学名Parus cristatus)は、スズメ目シジュウカラ科に分類される鳥類の一種。
4690 シジュウカラ科(シジュウカラか、学名 Paridae)は、鳥類スズメ目の科である。シジュウカラ(四十雀)と総称されるが、狭義にはこの1種をシジュウカラと呼ぶ。
4693 set ttycharset=iso-2022-jp charset-7bit=iso-2022-jp sendcharsets=utf-8
4694 m t2@exam.ple
4695 !s Japanese from ISO-2022-JP to UTF-8, eh, no, also ISO-2022-JP
4696 \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
4698 \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
4701 \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
4703 \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
4705 _EOT
4706 # May not presume iconv output as long as roundtrip possible [489a7122]
4707 ex0_test behave:iconv_mbyte_base64-1-estat
4708 ${awk} 'BEGIN{h=1}/^$/{++h;next}{if(h % 2 == 1)print}' \
4709 < "${MBOX}" > ./.tcksum
4710 check behave:iconv_mbyte_base64-1 - ./.tcksum '2694609714 520'
4711 check behave:iconv_mbyte_base64-2 - ./.terr '4294967295 0'
4713 printf 'eval f 1; eval write ./.twrite; eval type 1; eval type 2\n' |
4714 LC_ALL=${UTF8_LOCALE} ${MAILX} ${ARGS} \
4715 -S headline="%>%a%m %-18f %-16d %i%-s" \
4716 -Rf "${MBOX}" >./.tlog 2>&1
4717 check behave:iconv_mbyte_base64-3 0 ./.twrite '1259742080 686'
4718 #check behave:iconv_mbyte_base64-4 - ./.tlog '3214068822 2123'
4719 ${sed} -e '/^\[-- M/d' < ./.tlog > ./.txlog
4720 check behave:iconv_mbyte_base64-4 - ./.txlog '3659773472 2035'
4721 else
4722 echo 'behave:iconv_mbyte_base64: ISO-2022-JP unsupported, skipping 1-4'
4725 if (</dev/null iconv -f ascii -t euc-jp) >/dev/null 2>&1; then
4726 rm -f "${MBOX}" ./.twrite
4727 ${cat} <<-'_EOT' | LC_ALL=${UTF8_LOCALE} ${MAILX} ${ARGS} \
4728 -Smta=./.tmta.sh \
4729 -Sescape=! -Smime-encoding=base64 2>./.terr
4730 set ttycharset=utf-8 sendcharsets=euc-jp
4731 m t1@exam.ple
4732 !s Japanese from UTF-8 to EUC-JP
4733 シジュウカラ科(シジュウカラか、学名 Paridae)は、鳥類スズメ目の科である。シジュウカラ(四十雀)と総称されるが、狭義にはこの1種をシジュウカラと呼ぶ。
4735 カンムリガラ(学名Parus cristatus)は、スズメ目シジュウカラ科に分類される鳥類の一種。
4738 カンムリガラ(学名Parus cristatus)は、スズメ目シジュウカラ科に分類される鳥類の一種。
4740 シジュウカラ科(シジュウカラか、学名 Paridae)は、鳥類スズメ目の科である。シジュウカラ(四十雀)と総称されるが、狭義にはこの1種をシジュウカラと呼ぶ。
4743 set ttycharset=EUC-JP sendcharsets=utf-8
4744 m t2@exam.ple
4745 !s Japanese from EUC-JP to UTF-8
4746 ¥·¥¸¥å¥¦¥«¥é²Ê¡Ê¥·¥¸¥å¥¦¥«¥é¤«¡¢³Ø̾ Paridae¡Ë¤Ï¡¢Ä»Îॹ¥º¥áÌܤβʤǤ¢¤ë¡£¥·¥¸¥å¥¦¥«¥é¡Ê»Í½½¿ý¡Ë¤ÈÁí¾Î¤µ¤ì¤ë¤¬¡¢¶¹µÁ¤Ë¤Ï¤³¤Î1¼ï¤ò¥·¥¸¥å¥¦¥«¥é¤È¸Æ¤Ö¡£
4748 ¥«¥ó¥à¥ê¥¬¥é¡Ê³Ø̾Parus cristatus¡Ë¤Ï¡¢¥¹¥º¥áÌÜ¥·¥¸¥å¥¦¥«¥é²Ê¤ËʬÎव¤ì¤ëÄ»Îà¤Î°ì¼ï¡£
4751 ¥«¥ó¥à¥ê¥¬¥é¡Ê³Ø̾Parus cristatus¡Ë¤Ï¡¢¥¹¥º¥áÌÜ¥·¥¸¥å¥¦¥«¥é²Ê¤ËʬÎव¤ì¤ëÄ»Îà¤Î°ì¼ï¡£
4753 ¥·¥¸¥å¥¦¥«¥é²Ê¡Ê¥·¥¸¥å¥¦¥«¥é¤«¡¢³Ø̾ Paridae¡Ë¤Ï¡¢Ä»Îॹ¥º¥áÌܤβʤǤ¢¤ë¡£¥·¥¸¥å¥¦¥«¥é¡Ê»Í½½¿ý¡Ë¤ÈÁí¾Î¤µ¤ì¤ë¤¬¡¢¶¹µÁ¤Ë¤Ï¤³¤Î1¼ï¤ò¥·¥¸¥å¥¦¥«¥é¤È¸Æ¤Ö¡£
4755 _EOT
4756 ex0_test behave:iconv_mbyte_base64-5-estat
4757 ${awk} 'BEGIN{h=1}/^$/{++h;next}{if(h % 2 == 1)print}' \
4758 < "${MBOX}" > ./.tcksum
4759 check behave:iconv_mbyte_base64-5 - ./.tcksum '2870183985 473'
4760 check behave:iconv_mbyte_base64-6 - ./.terr '4294967295 0'
4762 printf 'eval f 1; eval write ./.twrite; eval type 1; eval type 2\n' |
4763 LC_ALL=${UTF8_LOCALE} ${MAILX} ${ARGS} \
4764 -S headline="%>%a%m %-18f %-16d %i%-s" \
4765 -Rf "${MBOX}" >./.tlog 2>&1
4766 check behave:iconv_mbyte_base64-7 0 ./.twrite '1259742080 686'
4767 #check behave:iconv_mbyte_base64-8 - ./.tlog '2506063395 2075'
4768 ${sed} -e '/^\[-- M/d' < ./.tlog > ./.txlog
4769 check behave:iconv_mbyte_base64-8 - ./.txlog '2528199891 1988'
4770 else
4771 echo 'behave:iconv_mbyte_base64: EUC-JP unsupported, skipping 5-8'
4774 t_epilog
4777 t_behave_iconv_mainbody() {
4778 t_prolog t_behave_iconv_mainbody
4779 TRAP_EXIT_ADDONS="./.t*"
4781 if [ -n "${UTF8_LOCALE}" ] && have_feat iconv; then
4783 else
4784 echo 'behave:iconv_mainbody: unsupported, skipped'
4785 return
4788 t_xmta 'HamamelisVirginiana Fri Oct 20 16:23:21 2017'
4790 printf '–' | ${MAILX} ${ARGS} ${ADDARG_UNI} -Smta=./.tmta.sh \
4791 -S charset-7bit=us-ascii -S charset-8bit=utf-8 \
4792 -s '–' over-the@rain.bow 2>./.terr
4793 check behave:iconv_mainbody-1 0 "${MBOX}" '3634015017 251'
4794 check behave:iconv_mainbody-2 - ./.terr '4294967295 0'
4796 printf '–' | ${MAILX} ${ARGS} ${ADDARG_UNI} -Smta=./.tmta.sh \
4797 -S charset-7bit=us-ascii -S charset-8bit=us-ascii \
4798 -s '–' over-the@rain.bow 2>./.terr
4799 exn0_test behave:iconv_mainbody-3
4800 check behave:iconv_mainbody-3 - "${MBOX}" '3634015017 251'
4801 if have_feat uistrings; then
4802 if have_feat docstrings; then # xxx should not be like that
4803 check behave:iconv_mainbody-4 - ./.terr '2579894983 148'
4804 else
4805 check behave:iconv_mainbody-4 - ./.terr '271380835 121'
4807 else
4808 echo 'behave:iconv_mainbody-4: unsupported, skipped'
4811 # The different iconv(3) implementations use different replacement sequence
4812 # types (character-wise, byte-wise, and the character(s) used differ)
4813 i="${MAILX_ICONV_MODE}"
4814 if [ -n "${i}" ]; then
4815 printf 'p\nx\n' | ${MAILX} ${ARGS} -Rf "${MBOX}" >./.tout 2>./.terr
4816 j=${?}
4817 ex0_test behave:iconv_mainbody-5-0 ${j}
4818 check behave:iconv_mainbody-5-1 - ./.terr '4294967295 0'
4819 if [ ${i} -eq 13 ]; then
4820 check behave:iconv_mainbody-5-2 - ./.tout '189327996 283'
4821 elif [ ${i} -eq 12 ]; then
4822 check behave:iconv_mainbody-5-3 - ./.tout '1959197095 283'
4823 elif [ ${i} -eq 3 ]; then
4824 check behave:iconv_mainbody-5-4 - ./.tout '3196380198 279'
4825 else
4826 check behave:iconv_mainbody-5-5 - ./.tout '3760313827 279'
4828 else
4829 echo 'behave:iconv_mainbody-5: unsupported, skipped'
4832 t_epilog
4835 t_behave_binary_mainbody() {
4836 t_prolog t_behave_binary_mainbody
4837 TRAP_EXIT_ADDONS="./.t*"
4839 printf 'abra\0\nka\r\ndabra' |
4840 ${MAILX} ${ARGS} ${ADDARG_UNI} -s 'binary with carriage-return!' \
4841 "${MBOX}" 2>./.terr
4842 check behave:binary_mainbody-1 0 "${MBOX}" '2430168141 243'
4843 check behave:binary_mainbody-2 - ./.terr '4294967295 0'
4845 printf 'p\necho\necho writing now\nwrite ./.twrite\n' |
4846 ${MAILX} ${ARGS} -Rf \
4847 -Spipe-application/octet-stream="@* ${cat} > ./.tcat" \
4848 "${MBOX}" >./.tall 2>&1
4849 check behave:binary_mainbody-3 0 ./.tall '1151843761 324'
4850 check behave:binary_mainbody-4 - ./.tcat '3817108933 15'
4851 check behave:binary_mainbody-5 - ./.twrite '3817108933 15'
4853 t_epilog
4856 t_behave_q_t_etc_opts() {
4857 t_prolog t_behave_q_t_etc_opts
4858 TRAP_EXIT_ADDONS="./.t*"
4860 # Three tests for MIME encoding and (a bit) content classification.
4861 # At the same time testing -q FILE, < FILE and -t FILE
4862 t__put_body > ./.tin
4864 < ./.tin ${MAILX} ${ARGS} ${ADDARG_UNI} \
4865 -a ./.tin -s "`t__put_subject`" "${MBOX}"
4866 check behave:q_t_etc_opts-1 0 "${MBOX}" '3570973309 6646'
4868 ${rm} "${MBOX}"
4869 < /dev/null ${MAILX} ${ARGS} ${ADDARG_UNI} \
4870 -a ./.tin -s "`t__put_subject`" -q ./.tin "${MBOX}"
4871 check behave:q_t_etc_opts-2 0 "${MBOX}" '3570973309 6646'
4873 ${rm} "${MBOX}"
4874 ( echo "To: ${MBOX}" && echo "Subject: `t__put_subject`" && echo &&
4875 ${cat} ./.tin
4876 ) | ${MAILX} ${ARGS} ${ADDARG_UNI} -Snodot -a ./.tin -t
4877 check behave:q_t_etc_opts-3 0 "${MBOX}" '3570973309 6646'
4879 t_epilog
4882 t_behave_s_mime() {
4883 have_feat smime || {
4884 echo 'behave:s/mime: unsupported, skipped'
4885 return
4888 t_prolog t_behave_s_mime
4889 TRAP_EXIT_ADDONS="./.t.conf ./.tkey.pem ./.tcert.pem ./.tpair.pem"
4890 TRAP_EXIT_ADDONS="${TRAP_EXIT_ADDONS} ./.VERIFY ./.DECRYPT ./.ENCRYPT"
4891 TRAP_EXIT_ADDONS="${TRAP_EXIT_ADDONS} ./.tmta.sh"
4893 printf 'behave:s/mime: .. generating test key and certificate ..\n'
4894 ${cat} <<-_EOT > ./.t.conf
4895 [ req ]
4896 default_bits = 1024
4897 default_keyfile = keyfile.pem
4898 distinguished_name = req_distinguished_name
4899 attributes = req_attributes
4900 prompt = no
4901 output_password =
4903 [ req_distinguished_name ]
4904 C = GB
4905 ST = Over the
4906 L = rainbow
4907 O = S-nail
4908 OU = S-nail.smime
4909 CN = S-nail.test
4910 emailAddress = test@localhost
4912 [ req_attributes ]
4913 challengePassword =
4914 _EOT
4915 openssl req -x509 -nodes -days 3650 -config ./.t.conf \
4916 -newkey rsa:1024 -keyout ./.tkey.pem -out ./.tcert.pem >>${ERR} 2>&1
4917 ${cat} ./.tkey.pem ./.tcert.pem > ./.tpair.pem
4919 # Sign/verify
4920 printf 'behave:s/mime:sign/verify: '
4921 echo bla | ${MAILX} ${ARGS} \
4922 -Ssmime-ca-file=./.tcert.pem -Ssmime-sign-cert=./.tpair.pem \
4923 -Ssmime-sign -Sfrom=test@localhost \
4924 -s 'S/MIME test' ./.VERIFY
4925 if [ $? -eq 0 ]; then
4926 printf 'ok\n'
4927 else
4928 printf 'failed\n'
4929 ESTAT=1
4930 t_epilog
4931 return
4934 ${awk} '
4935 BEGIN{ skip=0 }
4936 /^Content-Description: /{ skip = 2; print; next }
4937 /^$/{ if(skip) --skip }
4938 { if(!skip) print }
4940 < ./.VERIFY > "${MBOX}"
4941 check behave:s/mime:sign/verify:checksum - "${MBOX}" '2900817158 648'
4943 printf 'behave:s/mime:sign/verify:verify '
4944 printf 'verify\nx\n' |
4945 ${MAILX} ${ARGS} \
4946 -Ssmime-ca-file=./.tcert.pem -Ssmime-sign-cert=./.tpair.pem \
4947 -Ssmime-sign -Sfrom=test@localhost \
4948 -Serrexit -R \
4949 -f ./.VERIFY >>${ERR} 2>&1
4950 if [ $? -eq 0 ]; then
4951 printf 'ok\n'
4952 else
4953 printf 'failed\n'
4954 ESTAT=1
4955 t_epilog
4956 return
4959 printf 'behave:s/mime:sign/verify:disproof-1 '
4960 if openssl smime -verify -CAfile ./.tcert.pem \
4961 -in ./.VERIFY >>${ERR} 2>&1; then
4962 printf 'ok\n'
4963 else
4964 printf 'failed\n'
4965 ESTAT=1
4966 t_epilog
4967 return
4970 # (signing +) encryption / decryption
4971 t_xmta 'Euphrasia Thu Apr 27 17:56:23 2017' ./.ENCRYPT
4973 printf 'behave:s/mime:encrypt+sign: '
4974 echo bla |
4975 ${MAILX} ${ARGS} \
4976 -Ssmime-force-encryption \
4977 -Ssmime-encrypt-recei@ver.com=./.tpair.pem \
4978 -Smta=./.tmta.sh \
4979 -Ssmime-ca-file=./.tcert.pem -Ssmime-sign-cert=./.tpair.pem \
4980 -Ssmime-sign -Sfrom=test@localhost \
4981 -s 'S/MIME test' recei@ver.com
4982 if [ $? -eq 0 ]; then
4983 printf 'ok\n'
4984 else
4985 ESTAT=1
4986 printf 'error: encrypt+sign failed\n'
4989 ${sed} -e '/^$/,$d' < ./.ENCRYPT > "${MBOX}"
4990 check behave:s/mime:encrypt+sign:checksum - "${MBOX}" '1937410597 327'
4992 printf 'behave:s/mime:decrypt+verify: '
4993 printf 'decrypt ./.DECRYPT\nfi ./.DECRYPT\nverify\nx\n' |
4994 ${MAILX} ${ARGS} \
4995 -Ssmime-force-encryption \
4996 -Ssmime-encrypt-recei@ver.com=./.tpair.pem \
4997 -Smta=./.tmta.sh \
4998 -Ssmime-ca-file=./.tcert.pem -Ssmime-sign-cert=./.tpair.pem \
4999 -Ssmime-sign -Sfrom=test@localhost \
5000 -Serrexit -R \
5001 -f ./.ENCRYPT >>${ERR} 2>&1
5002 if [ $? -eq 0 ]; then
5003 printf 'ok\n'
5004 else
5005 ESTAT=1
5006 printf 'failed\n'
5009 ${awk} '
5010 BEGIN{ skip=0 }
5011 /^Content-Description: /{ skip = 2; print; next }
5012 /^$/{ if(skip) --skip }
5013 { if(!skip) print }
5015 < ./.DECRYPT > "${MBOX}"
5016 check behave:s/mime:decrypt+verify:checksum - "${MBOX}" '1720739247 931'
5018 printf 'behave:s/mime:decrypt+verify:disproof-1: '
5019 if (openssl smime -decrypt -inkey ./.tkey.pem -in ./.ENCRYPT |
5020 openssl smime -verify -CAfile ./.tcert.pem) >>${ERR} 2>&1; then
5021 printf 'ok\n'
5022 else
5023 printf 'failed\n'
5024 ESTAT=1
5027 printf "behave:s/mime:encrypt: "
5028 ${rm} ./.ENCRYPT
5029 echo bla | ${MAILX} ${ARGS} \
5030 -Ssmime-force-encryption \
5031 -Ssmime-encrypt-recei@ver.com=./.tpair.pem \
5032 -Smta=./.tmta.sh \
5033 -Ssmime-ca-file=./.tcert.pem -Ssmime-sign-cert=./.tpair.pem \
5034 -Sfrom=test@localhost \
5035 -s 'S/MIME test' recei@ver.com
5036 if [ $? -eq 0 ]; then
5037 printf 'ok\n'
5038 else
5039 ESTAT=1
5040 printf 'failed\n'
5043 # Same as behave:s/mime:encrypt+sign:checksum above
5044 ${sed} -e '/^$/,$d' < ./.ENCRYPT > "${MBOX}"
5045 check behave:s/mime:encrypt:checksum - "${MBOX}" '1937410597 327'
5047 ${rm} ./.DECRYPT
5048 printf 'decrypt ./.DECRYPT\nx\n' | ${MAILX} ${ARGS} \
5049 -Ssmime-force-encryption \
5050 -Ssmime-encrypt-recei@ver.com=./.tpair.pem \
5051 -Smta=./.tmta.sh \
5052 -Ssmime-ca-file=./.tcert.pem -Ssmime-sign-cert=./.tpair.pem \
5053 -Sfrom=test@localhost \
5054 -Serrexit -R \
5055 -f ./.ENCRYPT >>${ERR} 2>&1
5056 check behave:s/mime:decrypt 0 "./.DECRYPT" '2624716890 422'
5058 printf 'behave:s/mime:decrypt:disproof-1: '
5059 if openssl smime -decrypt -inkey ./.tkey.pem \
5060 -in ./.ENCRYPT >>${ERR} 2>&1; then
5061 printf 'ok\n'
5062 else
5063 printf 'failed\n'
5064 ESTAT=1
5067 t_epilog
5070 # t_content()
5071 # xxx Note: t_content() was the first test (series) written. Today many
5072 # xxx aspects are (better) covered by other tests above, some are not.
5073 # xxx At some future date and time, convert the last remains not covered
5074 # xxx elsewhere to a real t_behave_* test and drop t_content()
5075 t_content() {
5076 t_prolog t_content
5078 # Test for [260e19d] (Juergen Daubert)
5079 echo body | ${MAILX} ${ARGS} "${MBOX}"
5080 check content:004 0 "${MBOX}" '2917662811 98'
5082 # "Test for" [d6f316a] (Gavin Troy)
5083 ${rm} "${MBOX}"
5084 printf "m ${MBOX}\n~s subject1\nEmail body\n~.\nfi ${MBOX}\np\nx\n" |
5085 ${MAILX} ${ARGS} ${ADDARG_UNI} -Spipe-text/plain="@* ${cat}" > "${BODY}"
5086 check content:006 0 "${MBOX}" '2099098650 122'
5087 check content:006-1 - "${BODY}" '794542938 174'
5089 # "Test for" [c299c45] (Peter Hofmann) TODO shouldn't end up QP-encoded?
5090 ${rm} "${MBOX}"
5091 ${awk} 'BEGIN{
5092 for(i = 0; i < 10000; ++i)
5093 printf "\xC3\xBC"
5094 #printf "\xF0\x90\x87\x90"
5095 }' | ${MAILX} ${ARGS} ${ADDARG_UNI} -s TestSubject "${MBOX}"
5096 check content:007 0 "${MBOX}" '534262374 61816'
5098 t_epilog
5101 t__put_subject() {
5102 # MIME encoding (QP) stress message subject
5103 printf 'Äbrä Kä?dä=brö Fü?di=bus? '\
5104 'adadaddsssssssddddddddddddddddddddd'\
5105 'ddddddddddddddddddddddddddddddddddd'\
5106 'ddddddddddddddddddddddddddddddddddd'\
5107 'dddddddddddddddddddd Hallelulja? Od'\
5108 'er?? eeeeeeeeeeeeeeeeeeeeeeeeeeeeee'\
5109 'eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee'\
5110 'eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee f'\
5111 'fffffffffffffffffffffffffffffffffff'\
5112 'fffffffffffffffffffff ggggggggggggg'\
5113 'ggggggggggggggggggggggggggggggggggg'\
5114 'ggggggggggggggggggggggggggggggggggg'\
5115 'ggggggggggggggggggggggggggggggggggg'\
5116 'gggggggggggggggg'
5119 t__put_body() {
5120 # MIME encoding (QP) stress message body
5121 printf \
5122 'Ich bin eine DÖS-Datäi mit sehr langen Zeilen und auch '\
5123 'sonst bin ich ganz schön am Schleudern, da kannste denke '\
5124 "wasde willst, gelle, gelle, gelle, gelle, gelle.\r\n"\
5125 "Ich bin eine DÖS-Datäi mit langen Zeilen und auch sonst \r\n"\
5126 "Ich bin eine DÖS-Datäi mit langen Zeilen und auch sonst 1\r\n"\
5127 "Ich bin eine DÖS-Datäi mit langen Zeilen und auch sonst 12\r\n"\
5128 "Ich bin eine DÖS-Datäi mit langen Zeilen und auch sonst 123\r\n"\
5129 "Ich bin eine DÖS-Datäi mit langen Zeilen und auch sonst 1234\r\n"\
5130 "Ich bin eine DÖS-Datäi mit langen Zeilen und auch sonst 12345\r\n"\
5131 "Ich bin eine DÖS-Datäi mit langen Zeilen und auch sonst 123456\r\n"\
5132 "Ich bin eine DÖS-Datäi mit langen Zeilen und auch sonst 1234567\r\n"\
5133 "Ich bin eine DÖS-Datäi mit langen Zeilen und auch sonst 12345678\r\n"\
5134 "Ich bin eine DÖS-Datäi mit langen Zeilen und auch sonst 123456789\r\n"\
5135 "Unn ausserdem habe ich trailing SP/HT/SP/HT whitespace \r\n"\
5136 "Unn ausserdem habe ich trailing HT/SP/HT/SP whitespace \r\n"\
5137 "auf den zeilen vorher.\r\n"\
5138 "From am Zeilenbeginn und From der Mitte gibt es auch.\r\n"\
5139 ".\r\n"\
5140 "Die letzte Zeile war nur ein Punkt.\r\n"\
5141 "..\r\n"\
5142 "Das waren deren zwei.\r\n"\
5143 " \r\n"\
5144 "Die letzte Zeile war ein Leerschritt.\n"\
5145 "=VIER = EQUAL SIGNS=ON A LINE=\r\n"\
5146 "Prösterchen.\r\n"\
5147 ".\n"\
5148 "Die letzte Zeile war nur ein Punkt, mit Unix Zeilenende.\n"\
5149 "..\n"\
5150 "Das waren deren zwei. ditto.\n"\
5151 "Prösterchen.\n"\
5152 "Unn ausseerdem habe ich trailing SP/HT/SP/HT whitespace \n"\
5153 "Unn ausseerdem habe ich trailing HT/SP/HT/SP whitespace \n"\
5154 "auf den zeilen vorher.\n"\
5155 "ditto.\n"\
5156 "Ich bin eine ziemlich lange, steile, scharfe Zeile mit Unix Zeilenende.\n"\
5157 "Ich bin eine ziemlich lange, steile, scharfe Zeile mit Unix Zeilenende.1"\
5158 "\n"\
5159 "Ich bin eine ziemlich lange, steile, scharfe Zeile mit Unix Zeilenende.12"\
5160 "\n"\
5161 "Ich bin eine ziemlich lange, steile, scharfe Zeile mit Unix Zeilenende.12"\
5162 "3\n"\
5163 "Ich bin eine ziemlich lange, steile, scharfe Zeile mit Unix Zeilenende.12"\
5164 "34\n"\
5165 "Ich bin eine ziemlich lange, steile, scharfe Zeile mit Unix Zeilenende.12"\
5166 "345\n"\
5167 "Ich bin eine ziemlich lange, steile, scharfe Zeile mit Unix Zeilenende.12"\
5168 "3456\n"\
5169 "QP am Zeilenende über soft-nl hinweg\n"\
5170 "Ich bin eine ziemlich lange, steile, scharfe Zeile mit Unix Zeilenende."\
5171 "ö123\n"\
5172 "Ich bin eine ziemlich lange, steile, scharfe Zeile mit Unix Zeilenende."\
5173 "1ö23\n"\
5174 "Ich bin eine ziemlich lange, steile, scharfe Zeile mit Unix Zeilenende."\
5175 "12ö3\n"\
5176 "Ich bin eine ziemlich lange, steile, scharfe Zeile mit Unix Zeilenende."\
5177 "123ö\n"\
5178 "=VIER = EQUAL SIGNS=ON A LINE=\n"\
5179 " \n"\
5180 "Die letzte Zeile war ein Leerschritt.\n"\
5184 t_all() {
5185 # if have_feat devel; then
5186 # ARGS="${ARGS} -Smemdebug"
5187 # export ARGS
5188 # fi
5190 if [ -n "${UTF8_LOCALE}" ]; then
5191 printf 'Using Unicode locale %s\n' "${UTF8_LOCALE}"
5192 else
5193 printf 'No Unicode locale found, disabling Unicode tests\n'
5196 t_behave
5197 t_content
5200 # cc_all_configs()
5201 # Test all configs TODO doesn't cover all *combinations*, stupid!
5202 cc_all_configs() {
5203 < ${CONF} ${awk} '
5204 BEGIN{
5205 ALWAYS = "OPT_AUTOCC=1 OPT_AMALGAMATION=1"
5206 NOTME["OPT_ALWAYS_UNICODE_LOCALE"] = 1
5207 NOTME["OPT_CROSS_BUILD"] = 1
5208 NOTME["OPT_AUTOCC"] = 1
5209 NOTME["OPT_AMALGAMATION"] = 1
5210 NOTME["OPT_DEBUG"] = 1
5211 NOTME["OPT_DEVEL"] = 1
5212 NOTME["OPT_ASAN_ADDRESS"] = 1
5213 NOTME["OPT_ASAN_MEMORY"] = 1
5214 NOTME["OPT_FORCED_STACKPROT"] = 1
5215 NOTME["OPT_NOMEMDBG"] = 1
5216 NOTME["OPT_NYD2"] = 1
5218 #OPTVALS
5219 OPTNO = 0
5221 MULCHOICE["OPT_IDNA"] = "VAL_IDNA"
5222 MULVALS["VAL_IDNA"] = 1
5224 #VALKEYS[0] = "VAL_RANDOM"
5225 VALVALS["VAL_RANDOM"] = 1
5226 VALNO = 0
5228 /^[[:space:]]*OPT_/{
5229 sub(/^[[:space:]]*/, "")
5230 # This bails for UnixWare 7.1.4 awk(1), but preceeding = with \
5231 # does not seem to be a compliant escape for =
5232 #sub(/=.*$/, "")
5233 $1 = substr($1, 1, index($1, "=") - 1)
5234 if(!NOTME[$1])
5235 OPTVALS[OPTNO++] = $1
5236 next
5238 /^[[:space:]]*VAL_/{
5239 sub(/^[[:space:]]*/, "")
5240 val = substr($0, index($0, "=") + 1)
5241 if(val ~ /^\"/){
5242 val = substr(val, 2)
5243 val = substr(val, 1, length(val) - 1)
5245 $1 = substr($1, 1, index($1, "=") - 1)
5246 if(MULVALS[$1])
5247 MULVALS[$1] = val
5248 else if(VALVALS[$1]){
5249 VALKEYS[VALNO++] = $1
5250 VALVALS[$1] = val
5252 next
5254 function onepass(addons){
5255 a_onepass__worker(addons, "1", "0")
5256 a_onepass__worker(addons, "0", "1")
5258 function a_onepass__worker(addons, b0, b1){
5259 # Doing this completely sequentially and not doing make distclean in
5260 # between runs should effectively result in lesser compilations.
5261 # It is completely dumb nonetheless... TODO
5262 for(ono = 0; ono < OPTNO; ++ono){
5263 myconf = mula = ""
5264 for(i = 0; i < ono; ++i){
5265 myconf = myconf " " OPTVALS[i] "=" b0 " "
5266 if(b0 == "1"){
5267 j = MULCHOICE[OPTVALS[i]]
5268 if(j){
5269 if(i + 1 == ono)
5270 mula = j
5271 else
5272 myconf = myconf " " MULCHOICE[OPTVALS[i]] "=any "
5276 for(i = ono; i < OPTNO; ++i){
5277 myconf = myconf " " OPTVALS[i] "=" b1 " "
5278 if(b1 == "1"){
5279 j = MULCHOICE[OPTVALS[i]]
5280 if(j){
5281 if(i + 1 == OPTNO)
5282 mula = j;
5283 else
5284 myconf = myconf " " MULCHOICE[OPTVALS[i]] "=any "
5289 for(i in VALKEYS)
5290 myconf = VALKEYS[i] "=any " myconf
5292 myconf = myconf " " ALWAYS " " addons
5294 if(mula == "")
5295 print myconf
5296 else{
5297 i = split(MULVALS[mula], ia)
5298 j = "any"
5299 while(i >= 1){
5300 j = ia[i--] " " j
5301 print mula "=\"" j "\" " myconf
5306 END{
5307 # We cannot test NULL because of missing UI strings, which will end
5308 # up with different checksums
5309 print "CONFIG=NULLI OPT_AUTOCC=1"
5310 for(i in VALKEYS){
5311 j = split(VALVALS[VALKEYS[i]], ia)
5312 k = "any"
5313 while(j >= 1){
5314 k = ia[j--] " " k
5315 print VALKEYS[i] "=\"" k "\" CONFIG=NULLI OPT_AUTOCC=1"
5318 print "CONFIG=MINIMAL OPT_AUTOCC=1"
5319 print "CONFIG=NETSEND OPT_AUTOCC=1"
5320 print "CONFIG=MAXIMAL OPT_AUTOCC=1"
5321 for(i in VALKEYS){
5322 j = split(VALVALS[VALKEYS[i]], ia)
5323 k = "any"
5324 while(j >= 1){
5325 k = ia[j--] " " k
5326 print VALKEYS[i] "=\"" k "\" CONFIG=MAXIMAL OPT_AUTOCC=1"
5329 print "CONFIG=DEVEL OPT_AUTOCC=1"
5330 print "CONFIG=ODEVEL OPT_AUTOCC=1"
5332 onepass("OPT_DEBUG=1")
5333 onepass("")
5335 ' | while read c; do
5336 [ -f mk-config.h ] && ${cp} mk-config.h .ccac.h
5337 printf "\n\n##########\n$c\n"
5338 printf "\n\n##########\n$c\n" >&2
5339 ${SHELL} -c "cd .. && ${MAKE} ${c} config"
5340 if [ -f .ccac.h ] && ${cmp} mk-config.h .ccac.h; then
5341 printf 'Skipping after config, nothing changed\n'
5342 printf 'Skipping after config, nothing changed\n' >&2
5343 continue
5345 ${SHELL} -c "cd ../ && ${MAKE} build test"
5346 done
5347 ${rm} -f .ccac.h
5348 cd .. && ${MAKE} distclean
5351 [ -n "${ERR}" ] && echo > ${ERR}
5352 if [ -z "${CHECK_ONLY}${MAE_TEST}" ]; then
5353 cc_all_configs
5354 elif [ -z "${MAE_TEST}" ] || [ ${#} -eq 0 ]; then
5355 t_all
5356 else
5357 while [ ${#} -gt 0 ]; do
5358 ${1}
5359 shift
5360 done
5363 [ ${ESTAT} -eq 0 ] && echo Ok || echo >&2 'Errors occurred'
5365 exit ${ESTAT}
5366 # s-sh-mode