n_shexp_parse_token(): (finally) get rid of CC warning
[s-mailx.git] / cc-test.sh
blob84d0e1f013c6fcafde12c81fef75c77167e907cd
1 #!/bin/sh -
2 #@ Synopsis: ./cc-test.sh [--check-only s-mailx-binary]
3 #@ ./cc-test.sh --mae-test s-mailx-binary [:TESTNAME:]
4 #@ The latter generates output files.
5 #@ TODO All ex0_test should say TESTNUMBER-estat instead of having own numbers
6 #@ TODO _All_ the tests should happen in a temporary subdir.
7 # Public Domain
9 # Instead of figuring out the environment in here, require a configured build
10 # system and include that! Our makefile and configure ensure that this test
11 # does not run in the configured, but the user environment nonetheless!
12 if [ -f ./mk-config.ev ]; then
13 . ./mk-config.ev
14 if [ -z "${MAILX__CC_TEST_RUNNING}" ]; then
15 MAILX__CC_TEST_RUNNING=1
16 export MAILX__CC_TEST_RUNNING
17 exec "${SHELL}" "${0}" "${@}"
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 exit 41
27 # We need *stealthmua* regardless of $SOURCE_DATE_EPOCH, the program name as
28 # such is a compile-time variable
29 ARGS='-:/ -# -Sdotlock-ignore-error -Sexpandaddr=restrict'
30 ARGS="${ARGS}"' -Smime-encoding=quoted-printable -Snosave -Sstealthmua'
31 ADDARG_UNI=-Sttycharset=UTF-8
32 CONF=./make.rc
33 BODY=./.cc-body.txt
34 MBOX=./.cc-test.mbox
35 MAIL=/dev/null
36 #UTF8_LOCALE= autodetected unless set
38 # Note valgrind has problems with FDs in forked childs, which causes some tests
39 # to fail (the FD is rewound and thus will be dumped twice)
40 MEMTESTER=
41 #MEMTESTER='valgrind --leak-check=full --log-file=.vl-%p '
43 ## -- (>8 -- 8<) -- ##
45 ( set -o noglob ) >/dev/null 2>&1 && noglob_shell=1 || unset noglob_shell
47 msg() {
48 fmt=${1}
49 shift
50 printf >&2 -- "${fmt}\\n" "${@}"
53 ## -- >8 -- 8< -- ##
55 export ARGS ADDARG_UNI CONF BODY MBOX MAIL MAKE awk cat cksum rm sed grep
57 LC_ALL=C LANG=C
58 TZ=UTC
59 # Wed Oct 2 01:50:07 UTC 1996
60 SOURCE_DATE_EPOCH=844221007
62 export LC_ALL LANG TZ SOURCE_DATE_EPOCH
63 unset POSIXLY_CORRECT LOGNAME USER
65 usage() {
66 echo >&2 "Synopsis: ./cc-test.sh [--check-only s-mailx-binary]"
67 echo >&2 "Synopsis: ./cc-test.sh --mae-test s-mailx-binary [:TESTNAME:]"
68 exit 1
71 CHECK_ONLY= MAE_TEST= MAILX=
72 if [ "${1}" = --check-only ]; then
73 CHECK_ONLY=1
74 MAILX=${2}
75 [ -x "${MAILX}" ] || usage
76 shift 2
77 elif [ "${1}" = --mae-test ]; then
78 MAE_TEST=1
79 MAILX=${2}
80 [ -x "${MAILX}" ] || usage
81 shift 2
83 RAWMAILX=${MAILX}
84 MAILX="${MEMTESTER}${MAILX}"
85 export RAWMAILX MAILX
87 if [ -n "${CHECK_ONLY}${MAE_TEST}" ] && [ -z "${UTF8_LOCALE}" ]; then
88 # Try ourselfs for nl_langinfo(CODESET) output first (requires a new version)
89 i=`LC_ALL=C.utf8 "${RAWMAILX}" ${ARGS} -X '
90 \define cset_test {
91 \if [ "${ttycharset}" @i=% utf ]
92 \echo $LC_ALL
93 \xit 0
94 \end
95 \if [ "${#}" -gt 0 ]
96 \wysh set LC_ALL=${1}
97 \shift
98 \eval xcall cset_test "${@}"
99 \end
100 \xit 1
102 \call cset_test C.UTF-8 POSIX.utf8 POSIX.UTF-8 en_EN.utf8 en_EN.UTF-8 \
103 en_US.utf8 en_US.UTF-8
105 [ $? -eq 0 ] && UTF8_LOCALE=$i
107 if [ -z "${UTF8_LOCALE}" ] && (locale yesexpr) >/dev/null 2>&1; then
108 UTF8_LOCALE=`locale -a | { m=
109 while read n; do
110 if { echo ${n} | ${grep} -i 'utf-\{0,1\}8'; } >/dev/null 2>&1; then
111 m=${n}
112 if { echo ${n} | ${grep} -e POSIX -e en_EN -e en_US; }; then
113 exit 0
116 m=${n}
117 done
118 echo ${m}
123 ESTAT=0
125 TRAP_EXIT_ADDONS=
126 trap "${rm} -rf \"${BODY}\" \"${MBOX}\" \${TRAP_EXIT_ADDONS}" EXIT
127 trap "exit 1" HUP INT TERM
129 # cc_all_configs()
130 # Test all configs TODO doesn't cover all *combinations*, stupid!
131 cc_all_configs() {
132 < ${CONF} ${awk} '
133 BEGIN {
134 NOTME["OPT_AUTOCC"] = 1
135 NOTME["OPT_DEBUG"] = 1
136 NOTME["OPT_DEVEL"] = 1
137 NOTME["OPT_NOEXTMD5"] = 1
138 NOTME["OPT_ASAN_ADDRESS"] = 1
139 NOTME["OPT_ASAN_MEMORY"] = 1
140 NOTME["OPT_FORCED_STACKPROT"] = 1
141 NOTME["OPT_NOMEMDBG"] = 1
142 NOTME["OPT_NYD2"] = 1
143 i = 0
145 /^[[:space:]]*OPT_/ {
146 sub(/^[[:space:]]*/, "")
147 # This bails for UnixWare 7.1.4 awk(1), but preceeding = with \
148 # does not seem to be a compliant escape for =
149 #sub(/=.*$/, "")
150 $1 = substr($1, 1, index($1, "=") - 1)
151 if (NOTME[$1])
152 next
153 data[i++] = $1
155 END {
156 # Doing this completely sequentially and not doing make distclean in
157 # between runs should effectively result in lesser compilations.
158 # It is completely dumb nonetheless... TODO
159 for (j = 1; j < i; ++j) {
160 for (k = 1; k < j; ++k)
161 printf data[k] "=1 "
162 for (k = j; k < i; ++k)
163 printf data[k] "=0 "
164 printf "OPT_AUTOCC=1\n"
166 for (j = 1; j < i; ++j) {
167 for (k = 1; k < j; ++k)
168 printf data[k] "=0 "
169 for (k = j; k < i; ++k)
170 printf data[k] "=1 "
171 printf "OPT_AUTOCC=1\n"
173 # With debug
174 for (j = 1; j < i; ++j) {
175 for (k = 1; k < j; ++k)
176 printf data[k] "=1 "
177 for (k = j; k < i; ++k)
178 printf data[k] "=0 "
179 printf "OPT_AUTOCC=1\n"
180 printf "OPT_DEBUG=1\n"
182 for (j = 1; j < i; ++j) {
183 for (k = 1; k < j; ++k)
184 printf data[k] "=0 "
185 for (k = j; k < i; ++k)
186 printf data[k] "=1 "
187 printf "OPT_AUTOCC=1\n"
188 printf "OPT_DEBUG=1\n"
191 printf "CONFIG=NULL OPT_AUTOCC=0\n"
192 printf "CONFIG=NULL OPT_AUTOCC=1\n"
193 printf "CONFIG=NULLI OPT_AUTOCC=0\n"
194 printf "CONFIG=NULLI OPT_AUTOCC=1\n"
195 printf "CONFIG=MINIMAL OPT_AUTOCC=0\n"
196 printf "CONFIG=MINIMAL OPT_AUTOCC=1\n"
197 printf "CONFIG=NETSEND OPT_AUTOCC=0\n"
198 printf "CONFIG=NETSEND OPT_AUTOCC=1\n"
199 printf "CONFIG=MAXIMAL OPT_AUTOCC=0\n"
200 printf "CONFIG=MAXIMAL OPT_AUTOCC=1\n"
201 printf "CONFIG=DEVEL OPT_AUTOCC=0\n"
202 printf "CONFIG=DEVEL OPT_AUTOCC=1\n"
203 printf "CONFIG=ODEVEL OPT_AUTOCC=0\n"
204 printf "CONFIG=ODEVEL OPT_AUTOCC=1\n"
206 ' | while read c; do
207 printf "\n\n##########\n$c\n"
208 printf "\n\n##########\n$c\n" >&2
209 sh -c "${MAKE} ${c} all test"
210 done
211 ${MAKE} distclean
214 have_feat() {
215 ( "${RAWMAILX}" ${ARGS} -X'echo $features' -Xx |
216 ${grep} +${1} ) >/dev/null 2>&1
219 t_prolog() {
220 ${rm} -rf "${BODY}" "${MBOX}" ${TRAP_EXIT_ADDONS}
221 TRAP_EXIT_ADDONS=
222 [ ${#} -gt 0 ] && printf '[%s]\n' "${1}"
224 t_epilog() {
225 t_prolog
228 check() {
229 restat=${?} tid=${1} eestat=${2} f=${3} s=${4}
230 [ "${eestat}" != - ] && [ "${restat}" != "${eestat}" ] &&
231 err "${tid}" 'unexpected exit status: '"${restat} != ${eestat}"
232 csum="`${cksum} < ${f}`"
233 if [ "${csum}" = "${s}" ]; then
234 printf '%s: ok\n' "${tid}"
235 else
236 ESTAT=1
237 printf '%s: error: checksum mismatch (got %s)\n' "${tid}" "${csum}"
239 if [ -n "${MAE_TEST}" ]; then
240 x=`echo ${tid} | ${tr} "/:=" "__-"`
241 ${cp} -f "${f}" ./mae-test-"${x}"
245 err() {
246 ESTAT=1
247 printf '%s: error: %s\n' ${1} "${2}"
250 ex0_test() {
251 # $1=test name [$2=status]
252 __qm__=${?}
253 [ ${#} -gt 1 ] && __qm__=${2}
254 if [ ${__qm__} -ne 0 ]; then
255 err $1 'unexpected non-0 exit status'
256 else
257 printf '%s: ok\n' "${1}"
261 exn0_test() {
262 # $1=test name [$2=status]
263 __qm__=${?}
264 [ ${#} -gt 1 ] && __qm__=${2}
265 if [ ${__qm__} -eq 0 ]; then
266 err $1 'unexpected 0 exit status'
267 else
268 printf '%s: ok\n' "${1}"
272 if ( [ "$((1 + 1))" = 2 ] ) >/dev/null 2>&1; then
273 add() {
274 echo "$((${1} + ${2}))"
276 else
277 add() {
278 echo `${awk} 'BEGIN{print '${1}' + '${2}'}'`
282 if ( [ "$((2 % 3))" = 2 ] ) >/dev/null 2>&1; then
283 modulo() {
284 echo "$((${1} % ${2}))"
286 else
287 modulo() {
288 echo `${awk} 'BEGIN{print '${1}' % '${2}'}'`
292 # t_behave()
293 # Basic (easily testable) behaviour tests
294 t_behave() {
295 t_behave_X_opt_input_command_stack
296 t_behave_X_errexit
297 t_behave_S_freeze
298 t_behave_wysh
299 t_behave_input_inject_semicolon_seq
300 t_behave_commandalias
301 t_behave_ifelse
302 t_behave_localopts
303 t_behave_local
304 t_behave_macro_param_shift
305 t_behave_addrcodec
306 t_behave_vexpr
307 t_behave_call_ret
308 t_behave_xcall
309 t_behave_vpospar
310 t_behave_atxplode
311 t_behave_read
313 t_behave_mbox
314 t_behave_maildir
315 t_behave_record_a_resend
316 t_behave_e_H_L_opts
318 t_behave_alternates
319 t_behave_alias
320 # FIXME t_behave_mlist
321 t_behave_filetype
323 t_behave_message_injections
324 t_behave_compose_hooks
325 t_behave_C_opt_customhdr
327 t_behave_mass_recipients
328 t_behave_mime_types_load_control
329 t_behave_lreply_futh_rth_etc
331 t_behave_xxxheads_rfc2047
332 t_behave_rfc2231
333 t_behave_iconv_mbyte_base64
334 t_behave_iconv_mainbody
335 t_behave_q_t_etc_opts
337 t_behave_s_mime
340 t_behave_X_opt_input_command_stack() {
341 t_prolog t_behave_X_opt_input_command_stack
343 ${cat} <<- '__EOT' > "${BODY}"
344 echo 1
345 define mac0 {
346 echo mac0-1 via1 $0
348 call mac0
349 echo 2
350 source '\
351 echo "define mac1 {";\
352 echo " echo mac1-1 via1 \$0";\
353 echo " call mac0";\
354 echo " echo mac1-2";\
355 echo " call mac2";\
356 echo " echo mac1-3";\
357 echo "}";\
358 echo "echo 1-1";\
359 echo "define mac2 {";\
360 echo " echo mac2-1 via1 \$0";\
361 echo " call mac0";\
362 echo " echo mac2-2";\
363 echo "}";\
364 echo "echo 1-2";\
365 echo "call mac1";\
366 echo "echo 1-3";\
367 echo "source \"\
368 echo echo 1-1-1 via1 \$0;\
369 echo call mac0;\
370 echo echo 1-1-2;\
371 | \"";\
372 echo "echo 1-4";\
374 echo 3
375 call mac2
376 echo 4
377 undefine *
378 __EOT
380 # The -X option supports multiline arguments, and those can internally use
381 # reverse solidus newline escaping. And all -X options are joined...
382 APO=\'
383 < "${BODY}" ${MAILX} ${ARGS} \
384 -X 'e\' \
385 -X ' c\' \
386 -X ' h\' \
387 -X ' o \' \
388 -X 1 \
390 define mac0 {
391 echo mac0-1 via2 $0
393 call mac0
394 echo 2
397 source '${APO}'\
398 echo "define mac1 {";\
399 echo " echo mac1-1 via2 \$0";\
400 echo " call mac0";\
401 echo " echo mac1-2";\
402 echo " call mac2";\
403 echo " echo mac1-3";\
404 echo "}";\
405 echo "echo 1-1";\
406 echo "define mac2 {";\
407 echo " echo mac2-1 via2 \$0";\
408 echo " call mac0";\
409 echo " echo mac2-2";\
410 echo "}";\
411 echo "echo 1-2";\
412 echo "call mac1";\
413 echo "echo 1-3";\
414 echo "source \"\
415 echo echo 1-1-1 via2 \$0;\
416 echo call mac0;\
417 echo echo 1-1-2;\
418 | \"";\
419 echo "echo 1-4";\
420 | '${APO}'
421 echo 3
424 call mac2
425 echo 4
426 undefine *
427 ' > "${MBOX}"
429 check behave:x_opt_input_command_stack 0 "${MBOX}" '1786542668 416'
431 t_epilog
434 t_behave_X_errexit() {
435 t_prolog t_behave_X_errexit
437 ${cat} <<- '__EOT' > "${BODY}"
438 echo one
439 echos nono
440 echo two
441 __EOT
443 </dev/null ${MAILX} ${ARGS} -Snomemdebug \
444 -X'echo one' -X' echos nono ' -X'echo two' \
445 > "${MBOX}" 2>&1
446 check behave:x_errexit-1 0 "${MBOX}" '916157812 53'
448 </dev/null ${MAILX} ${ARGS} -X'source '"${BODY}" -Snomemdebug \
449 > "${MBOX}" 2>&1
450 check behave:x_errexit-2 0 "${MBOX}" '916157812 53'
452 </dev/null MAILRC="${BODY}" ${MAILX} ${ARGS} -:u -Snomemdebug \
453 > "${MBOX}" 2>&1
454 check behave:x_errexit-3 0 "${MBOX}" '916157812 53'
458 </dev/null ${MAILX} ${ARGS} -Serrexit -Snomemdebug \
459 -X'echo one' -X' echos nono ' -X'echo two' \
460 > "${MBOX}" 2>&1
461 check behave:x_errexit-4 1 "${MBOX}" '2118430867 49'
463 </dev/null ${MAILX} ${ARGS} -X'source '"${BODY}" -Serrexit -Snomemdebug \
464 > "${MBOX}" 2>&1
465 check behave:x_errexit-5 1 "${MBOX}" '2118430867 49'
467 </dev/null MAILRC="${BODY}" ${MAILX} ${ARGS} -:u -Serrexit -Snomemdebug \
468 > "${MBOX}" 2>&1
469 check behave:x_errexit-6 1 "${MBOX}" '12955965 172'
471 </dev/null MAILRC="${BODY}" ${MAILX} ${ARGS} -:u -Sposix -Snomemdebug \
472 > "${MBOX}" 2>&1
473 check behave:x_errexit-7 1 "${MBOX}" '12955965 172'
475 ## Repeat 4-7 with ignerr set
477 ${sed} -e 's/^echos /ignerr echos /' < "${BODY}" > "${MBOX}"
479 </dev/null ${MAILX} ${ARGS} -Serrexit -Snomemdebug \
480 -X'echo one' -X'ignerr echos nono ' -X'echo two' \
481 > "${BODY}" 2>&1
482 check behave:x_errexit-8 0 "${BODY}" '916157812 53'
484 </dev/null ${MAILX} ${ARGS} -X'source '"${MBOX}" -Serrexit -Snomemdebug \
485 > "${BODY}" 2>&1
486 check behave:x_errexit-9 0 "${BODY}" '916157812 53'
488 </dev/null MAILRC="${MBOX}" ${MAILX} ${ARGS} -:u -Serrexit -Snomemdebug \
489 > "${BODY}" 2>&1
490 check behave:x_errexit-10 0 "${BODY}" '916157812 53'
492 </dev/null MAILRC="${MBOX}" ${MAILX} ${ARGS} -:u -Sposix -Snomemdebug \
493 > "${BODY}" 2>&1
494 check behave:x_errexit-11 0 "${BODY}" '916157812 53'
496 t_epilog
499 t_behave_S_freeze() {
500 t_prolog t_behave_S_freeze
501 oterm=$TERM
502 unset TERM
504 # Test basic assumption
505 </dev/null MAILRC="${BODY}" ${MAILX} ${ARGS} \
506 -X'echo asksub<$asksub> dietcurd<$dietcurd>' \
507 -Xx > "${MBOX}" 2>&1
508 check behave:s_freeze-1 0 "${MBOX}" '270686329 21'
511 ${cat} <<- '__EOT' > "${BODY}"
512 echo asksub<$asksub>
513 set asksub
514 echo asksub<$asksub>
515 __EOT
516 </dev/null MAILRC="${BODY}" ${MAILX} ${ARGS} -:u \
517 -Snoasksub -Sasksub -Snoasksub \
518 -X'echo asksub<$asksub>' -X'set asksub' -X'echo asksub<$asksub>' \
519 -Xx > "${MBOX}" 2>&1
520 check behave:s_freeze-2 0 "${MBOX}" '3182942628 37'
522 ${cat} <<- '__EOT' > "${BODY}"
523 echo asksub<$asksub>
524 unset asksub
525 echo asksub<$asksub>
526 __EOT
527 </dev/null MAILRC="${BODY}" ${MAILX} ${ARGS} -:u \
528 -Snoasksub -Sasksub \
529 -X'echo asksub<$asksub>' -X'unset asksub' -X'echo asksub<$asksub>' \
530 -Xx > "${MBOX}" 2>&1
531 check behave:s_freeze-3 0 "${MBOX}" '2006554293 39'
534 ${cat} <<- '__EOT' > "${BODY}"
535 echo dietcurd<$dietcurd>
536 set dietcurd=cherry
537 echo dietcurd<$dietcurd>
538 __EOT
539 </dev/null MAILRC="${BODY}" ${MAILX} ${ARGS} -:u \
540 -Sdietcurd=strawberry -Snodietcurd -Sdietcurd=vanilla \
541 -X'echo dietcurd<$dietcurd>' -X'unset dietcurd' \
542 -X'echo dietcurd<$dietcurd>' \
543 -Xx > "${MBOX}" 2>&1
544 check behave:s_freeze-4 0 "${MBOX}" '1985768109 65'
546 ${cat} <<- '__EOT' > "${BODY}"
547 echo dietcurd<$dietcurd>
548 unset dietcurd
549 echo dietcurd<$dietcurd>
550 __EOT
551 </dev/null MAILRC="${BODY}" ${MAILX} ${ARGS} -:u \
552 -Sdietcurd=strawberry -Snodietcurd \
553 -X'echo dietcurd<$dietcurd>' -X'set dietcurd=vanilla' \
554 -X'echo dietcurd<$dietcurd>' \
555 -Xx > "${MBOX}" 2>&1
556 check behave:s_freeze-5 0 "${MBOX}" '151574279 51'
558 # TODO once we have a detached one with env=1..
559 if [ -n "`</dev/null ${MAILX} ${ARGS} -X'!echo \$TERM' -Xx`" ]; then
560 echo 'behave:s_freeze-{6,7}: shell sets $TERM, skipped'
561 else
562 ${cat} <<- '__EOT' > "${BODY}"
563 !echo "shell says TERM<$TERM>"
564 echo TERM<$TERM>
565 !echo "shell says TERM<$TERM>"
566 set TERM=cherry
567 !echo "shell says TERM<$TERM>"
568 echo TERM<$TERM>
569 !echo "shell says TERM<$TERM>"
570 __EOT
571 </dev/null MAILRC="${BODY}" ${MAILX} ${ARGS} -:u \
572 -STERM=strawberry -SnoTERM -STERM=vanilla \
573 -X'echo mail<$TERM>' -X'unset TERM' \
574 -X'!echo "shell says TERM<$TERM>"' -X'echo TERM<$TERM>' \
575 -Xx > "${MBOX}" 2>&1
576 check behave:s_freeze-6 0 "${MBOX}" '1211476036 167'
578 ${cat} <<- '__EOT' > "${BODY}"
579 !echo "shell says TERM<$TERM>"
580 echo TERM<$TERM>
581 !echo "shell says TERM<$TERM>"
582 set TERM=cherry
583 !echo "shell says TERM<$TERM>"
584 echo TERM<$TERM>
585 !echo "shell says TERM<$TERM>"
586 __EOT
587 </dev/null MAILRC="${BODY}" ${MAILX} ${ARGS} -:u \
588 -STERM=strawberry -SnoTERM \
589 -X'echo TERM<$TERM>' -X'set TERM=vanilla' \
590 -X'!echo "shell says TERM<$TERM>"' -X'echo TERM<$TERM>' \
591 -Xx > "${MBOX}" 2>&1
592 check behave:s_freeze-7 0 "${MBOX}" '3365080441 132'
595 TERM=$oterm
596 t_epilog
599 t_behave_wysh() {
600 t_prolog t_behave_wysh
602 ${cat} <<- '__EOT' > "${BODY}"
604 echo abcd
605 echo a'b'c'd'
606 echo a"b"c"d"
607 echo a$'b'c$'d'
608 echo 'abcd'
609 echo "abcd"
610 echo $'abcd'
611 echo a\ b\ c\ d
612 echo a 'b c' d
613 echo a "b c" d
614 echo a $'b c' d
616 echo 'a$`"\'
617 echo "a\$\`'\"\\"
618 echo $'a\$`\'\"\\'
619 echo $'a\$`\'"\\'
620 # DIET=CURD TIED=
621 echo 'a${DIET}b${TIED}c\${DIET}d\${TIED}e' # COMMENT
622 echo "a${DIET}b${TIED}c\${DIET}d\${TIED}e"
623 echo $'a${DIET}b${TIED}c\${DIET}d\${TIED}e'
625 echo a$'\101\0101\x41\u0041\u41\U00000041\U41'c
626 echo a$'\u0041\u41\u0C1\U00000041\U41'c
627 echo a$'\377'c
628 echo a$'\0377'c
629 echo a$'\400'c
630 echo a$'\0400'c
631 echo a$'\U1100001'c
633 echo a$'b\0c'd
634 echo a$'b\00c'de
635 echo a$'b\000c'df
636 echo a$'b\0000c'dg
637 echo a$'b\x0c'dh
638 echo a$'b\x00c'di
639 echo a$'b\u0'dj
640 echo a$'b\u00'dk
641 echo a$'b\u000'dl
642 echo a$'b\u0000'dm
643 echo a$'b\U0'dn
644 echo a$'b\U00'do
645 echo a$'b\U000'dp
646 echo a$'b\U0000'dq
647 echo a$'b\U00000'dr
648 echo a$'b\U000000'ds
649 echo a$'b\U0000000'dt
650 echo a$'b\U00000000'du
652 echo a$'\cI'b
653 echo a$'\011'b
654 echo a$'\x9'b
655 echo a$'\u9'b
656 echo a$'\U9'b
657 echo a$'\c@'b c d
658 __EOT
660 if [ -z "${UTF8_LOCALE}" ]; then
661 echo 'Skip behave:wysh_unicode, no UTF8_LOCALE'
662 else
663 < "${BODY}" DIET=CURD TIED= \
664 LC_ALL=${UTF8_LOCALE} ${MAILX} ${ARGS} 2>/dev/null > "${MBOX}"
665 check behave:wysh_unicode 0 "${MBOX}" '475805847 317'
668 < "${BODY}" DIET=CURD TIED= ${MAILX} ${ARGS} > "${MBOX}" 2>/dev/null
669 check behave:wysh_c 0 "${MBOX}" '1473887148 321'
671 ${cat} <<- '__EOT' | ${MAILX} ${ARGS} > "${MBOX}"
672 wysh set mager='\hey\'
673 varshow mager
674 wysh set mager="\hey\\"
675 varshow mager
676 wysh set mager=$'\hey\\'
677 varshow mager
678 __EOT
679 check behave:wysh-3 0 "${MBOX}" '1289698238 69'
681 t_epilog
684 t_behave_input_inject_semicolon_seq() {
685 t_prolog t_behave_input_inject_semicolon_seq
687 ${cat} <<- '__EOT' | ${MAILX} ${ARGS} > "${MBOX}"
688 define mydeepmac {
689 echon '(mydeepmac)';
691 define mymac {
692 echon this_is_mymac;call mydeepmac;echon ';';
694 echon one';';call mymac;echon two";";call mymac;echo three$';';
695 define mymac {
696 echon this_is_mymac;call mydeepmac;echon ,TOO'!;';
698 echon one';';call mymac;echon two";";call mymac;echo three$';';
699 __EOT
701 check behave:input_inject_semicolon_seq 0 "${MBOX}" '512117110 140'
703 t_epilog
706 t_behave_commandalias() {
707 t_prolog t_behave_commandalias
709 ${cat} <<- '__EOT' | ${MAILX} ${ARGS} > "${MBOX}"
710 commandalias echo echo hoho
711 echo stop.
712 commandalias X Xx
713 commandalias Xx XxX
714 commandalias XxX XxXx
715 commandalias XxXx XxXxX
716 commandalias XxXxX XxXxXx
717 commandalias XxXxXx echo huhu
718 commandalias XxXxXxX echo huhu
720 commandalias XxXxXx XxXxXxX
722 uncommandalias echo
723 commandalias XxXxXx echo huhu
725 __EOT
727 check behave:commandalias 0 "${MBOX}" '3694143612 31'
729 t_epilog
732 t_behave_ifelse() {
733 t_prolog t_behave_ifelse
735 # Nestable conditions test
736 ${cat} <<- '__EOT' | ${MAILX} ${ARGS} > "${MBOX}"
737 if 0
738 echo 1.err
739 else
740 echo 1.ok
741 endif
742 if 1
743 echo 2.ok
744 else
745 echo 2.err
746 endif
747 if $dietcurd
748 echo 3.err
749 else
750 echo 3.ok
751 endif
752 set dietcurd=yoho
753 if $dietcurd
754 echo 4.ok
755 else
756 echo 4.err
757 endif
758 if $dietcurd == 'yoho'
759 echo 5.ok
760 else
761 echo 5.err
762 endif
763 if $dietcurd @== 'Yoho'
764 echo 5-1.ok
765 else
766 echo 5-1.err
767 endif
768 if $dietcurd == 'Yoho'
769 echo 5-2.err
770 else
771 echo 5-2.ok
772 endif
773 if $dietcurd != 'yoho'
774 echo 6.err
775 else
776 echo 6.ok
777 endif
778 if $dietcurd @!= 'Yoho'
779 echo 6-1.err
780 else
781 echo 6-1.ok
782 endif
783 if $dietcurd != 'Yoho'
784 echo 6-2.ok
785 else
786 echo 6-2.err
787 endif
788 # Nesting
789 if faLse
790 echo 7.err1
791 if tRue
792 echo 7.err2
793 if yEs
794 echo 7.err3
795 else
796 echo 7.err4
797 endif
798 echo 7.err5
799 endif
800 echo 7.err6
801 else
802 echo 7.ok7
803 if YeS
804 echo 7.ok8
805 if No
806 echo 7.err9
807 else
808 echo 7.ok9
809 endif
810 echo 7.ok10
811 else
812 echo 7.err11
813 if yeS
814 echo 7.err12
815 else
816 echo 7.err13
817 endif
818 endif
819 echo 7.ok14
820 endif
821 if r
822 echo 8.ok1
823 if R
824 echo 8.ok2
825 else
826 echo 8.err2
827 endif
828 echo 8.ok3
829 else
830 echo 8.err1
831 endif
832 if s
833 echo 9.err1
834 else
835 echo 9.ok1
836 if S
837 echo 9.err2
838 else
839 echo 9.ok2
840 endif
841 echo 9.ok3
842 endif
843 # `elif'
844 if $dietcurd == 'yohu'
845 echo 10.err1
846 elif $dietcurd == 'yoha'
847 echo 10.err2
848 elif $dietcurd == 'yohe'
849 echo 10.err3
850 elif $dietcurd == 'yoho'
851 echo 10.ok1
852 if $dietcurd == 'yohu'
853 echo 10.err4
854 elif $dietcurd == 'yoha'
855 echo 10.err5
856 elif $dietcurd == 'yohe'
857 echo 10.err6
858 elif $dietcurd == 'yoho'
859 echo 10.ok2
860 if $dietcurd == 'yohu'
861 echo 10.err7
862 elif $dietcurd == 'yoha'
863 echo 10.err8
864 elif $dietcurd == 'yohe'
865 echo 10.err9
866 elif $dietcurd == 'yoho'
867 echo 10.ok3
868 else
869 echo 10.err10
870 endif
871 else
872 echo 10.err11
873 endif
874 else
875 echo 10.err12
876 endif
877 # integer
878 set dietcurd=10
879 if $dietcurd -lt 11
880 echo 11.ok1
881 if $dietcurd -gt 9
882 echo 11.ok2
883 else
884 echo 11.err2
885 endif
886 if $dietcurd -eq 10
887 echo 11.ok3
888 else
889 echo 11.err3
890 endif
891 if $dietcurd -ge 10
892 echo 11.ok4
893 else
894 echo 11.err4
895 endif
896 if $dietcurd -le 10
897 echo 11.ok5
898 else
899 echo 11.err5
900 endif
901 if $dietcurd -ge 11
902 echo 11.err6
903 else
904 echo 11.ok6
905 endif
906 if $dietcurd -le 9
907 echo 11.err7
908 else
909 echo 11.ok7
910 endif
911 else
912 echo 11.err1
913 endif
914 set dietcurd=Abc
915 if $dietcurd < aBd
916 echo 12.ok1
917 if $dietcurd @> abB
918 echo 12.ok2
919 else
920 echo 12.err2
921 endif
922 if $dietcurd @== aBC
923 echo 12.ok3
924 else
925 echo 12.err3
926 endif
927 if $dietcurd @>= AbC
928 echo 12.ok4
929 else
930 echo 12.err4
931 endif
932 if $dietcurd @<= ABc
933 echo 12.ok5
934 else
935 echo 12.err5
936 endif
937 if $dietcurd @>= abd
938 echo 12.err6
939 else
940 echo 12.ok6
941 endif
942 if $dietcurd @<= abb
943 echo 12.err7
944 else
945 echo 12.ok7
946 endif
947 else
948 echo 12.err1
949 endif
950 if $dietcurd < aBc
951 echo 12-1.ok
952 else
953 echo 12-1.err
954 endif
955 if $dietcurd @< aBc
956 echo 12-2.err
957 else
958 echo 12-2.ok
959 endif
960 if $dietcurd > ABc
961 echo 12-3.ok
962 else
963 echo 12-3.err
964 endif
965 if $dietcurd @> ABc
966 echo 12-3.err
967 else
968 echo 12-3.ok
969 endif
970 if $dietcurd @i=% aB
971 echo 13.ok
972 else
973 echo 13.err
974 endif
975 if $dietcurd =% aB
976 echo 13-1.err
977 else
978 echo 13-1.ok
979 endif
980 if $dietcurd @=% bC
981 echo 14.ok
982 else
983 echo 14.err
984 endif
985 if $dietcurd !% aB
986 echo 15-1.ok
987 else
988 echo 15-1.err
989 endif
990 if $dietcurd @!% aB
991 echo 15-2.err
992 else
993 echo 15-2.ok
994 endif
995 if $dietcurd !% bC
996 echo 15-3.ok
997 else
998 echo 15-3.err
999 endif
1000 if $dietcurd @!% bC
1001 echo 15-4.err
1002 else
1003 echo 15-4.ok
1004 endif
1005 if $dietcurd =% Cd
1006 echo 16.err
1007 else
1008 echo 16.ok
1009 endif
1010 if $dietcurd !% Cd
1011 echo 17.ok
1012 else
1013 echo 17.err
1014 endif
1015 set diet=abc curd=abc
1016 if $diet == $curd
1017 echo 18.ok
1018 else
1019 echo 18.err
1020 endif
1021 set diet=abc curd=abcd
1022 if $diet != $curd
1023 echo 19.ok
1024 else
1025 echo 19.err
1026 endif
1027 # 1. Shitty grouping capabilities as of today
1028 unset diet curd ndefined
1029 if [ [ false ] || [ false ] || [ true ] ] && [ [ false ] || [ true ] ] && \
1030 [ yes ]
1031 echo 20.ok
1032 else
1033 echo 20.err
1034 endif
1035 if [ [ [ [ 0 ] || [ 1 ] ] && [ [ 1 ] || [ 0 ] ] ] && [ 1 ] ] && [ yes ]
1036 echo 21.ok
1037 else
1038 echo 21.err
1039 endif
1040 if [ [ 1 ] || [ 0 ] || [ 0 ] || [ 0 ] ]
1041 echo 22.ok
1042 else
1043 echo 22.err
1044 endif
1045 if [ [ 1 ] || [ 0 ] || [ 0 ] || [ 0 ] || [ [ 1 ] ] ]
1046 echo 23.ok
1047 else
1048 echo 23.err
1049 endif
1050 if [ [ 1 ] || [ 0 ] || [ 0 ] || [ 0 ] || [ [ 1 ] ] || [ 1 ] ] && [ no ]
1051 echo 24.err
1052 else
1053 echo 24.ok
1054 endif
1055 if [ [ 1 ] || [ 0 ] || [ 0 ] || [ 0 ] || [ [ 1 ] ] || [ 1 ] ] \
1056 && [ no ] || [ yes ]
1057 echo 25.ok
1058 else
1059 echo 25.err
1060 endif
1061 if [ [ [ [ [ [ [ 1 ] ] && [ 1 ] ] && [ 1 ] ] && [ 1 ] ] ] && [ 1 ] ]
1062 echo 26.ok
1063 else
1064 echo 26.err
1065 endif
1066 if [ [ [ [ [ [ [ 1 ] ] && [ 1 ] ] && [ 1 ] ] && [ 1 ] ] ] && [ 0 ] ]
1067 echo 27.err
1068 else
1069 echo 27.ok
1070 endif
1071 if [ [ [ [ [ [ [ 1 ] ] && [ 1 ] ] && [ 0 ] ] && [ 1 ] ] ] && [ 1 ] ]
1072 echo 28.err
1073 else
1074 echo 28.ok
1075 endif
1076 if [ [ [ [ [ [ [ 0 ] ] && [ 1 ] ] && [ 1 ] ] && [ 1 ] ] ] && [ 1 ] ]
1077 echo 29.err
1078 else
1079 echo 29.ok
1080 endif
1081 if [ 1 ] || [ 0 ] || [ 0 ] || [ 0 ] && [ 0 ]
1082 echo 30.err
1083 else
1084 echo 30.ok
1085 endif
1086 if [ 1 ] || [ 0 ] || [ 0 ] || [ 0 ] && [ 1 ]
1087 echo 31.ok
1088 else
1089 echo 31.err
1090 endif
1091 if [ 0 ] || [ 0 ] || [ 0 ] || [ 1 ] && [ 0 ]
1092 echo 32.err
1093 else
1094 echo 32.ok
1095 endif
1096 if [ 0 ] || [ 0 ] || [ 0 ] || [ 1 ] && [ 1 ]
1097 echo 33.ok
1098 else
1099 echo 33.err
1100 endif
1101 if [ 0 ] || [ 0 ] || [ 0 ] || [ 1 ] && [ 0 ] || [ 1 ] && [ 0 ]
1102 echo 34.err
1103 else
1104 echo 34.ok
1105 endif
1106 if [ 0 ] || [ 0 ] || [ 0 ] || [ 1 ] && [ 0 ] || [ 1 ] && [ 1 ]
1107 echo 35.ok
1108 else
1109 echo 35.err
1110 endif
1111 set diet=yo curd=ho
1112 if [ [ $diet == 'yo' ] && [ $curd == 'ho' ] ] && [ $ndefined ]
1113 echo 36.err
1114 else
1115 echo 36.ok
1116 endif
1117 set ndefined
1118 if [ [ $diet == 'yo' ] && [ $curd == 'ho' ] ] && [ $ndefined ]
1119 echo 37.ok
1120 else
1121 echo 37.err
1122 endif
1123 # 2. Shitty grouping capabilities as of today
1124 unset diet curd ndefined
1125 if [ false || false || true ] && [ false || true ] && yes
1126 echo 40.ok
1127 else
1128 echo 40.err
1129 endif
1130 if [ [ [ 0 || 1 ] && [ 1 || 0 ] ] && 1 ] && [ yes ]
1131 echo 41.ok
1132 else
1133 echo 41.err
1134 endif
1135 if [ 1 || 0 || 0 || 0 ]
1136 echo 42.ok
1137 else
1138 echo 42.err
1139 endif
1140 if [ 1 || 0 || 0 || 0 || [ 1 ] ]
1141 echo 43.ok
1142 else
1143 echo 43.err
1144 endif
1145 if [ 1 || 0 || 0 || 0 || [ 1 ] || 1 ] && no
1146 echo 44.err
1147 else
1148 echo 44.ok
1149 endif
1150 if [ 1 || 0 || 0 || 0 || 1 || [ 1 ] ] && no || [ yes ]
1151 echo 45.ok
1152 else
1153 echo 45.err
1154 endif
1155 if [ [ [ [ [ [ 1 ] && 1 ] && 1 ] && 1 ] ] && [ 1 ] ]
1156 echo 46.ok
1157 else
1158 echo 46.err
1159 endif
1160 if [ [ [ [ [ [ 1 ] && 1 ] && 1 ] && [ 1 ] ] ] && 0 ]
1161 echo 47.err
1162 else
1163 echo 47.ok
1164 endif
1165 if [ [ [ [ [ [ [ 1 ] ] && 1 ] && 0 ] && [ 1 ] ] ] && 1 ]
1166 echo 48.err
1167 else
1168 echo 48.ok
1169 endif
1170 if [ [ [ [ [ [ 0 ] && 1 ] && 1 ] && 1 ] ] && 1 ]
1171 echo 49.err
1172 else
1173 echo 49.ok
1174 endif
1175 if 1 || 0 || 0 || 0 && 0
1176 echo 50.err
1177 else
1178 echo 50.ok
1179 endif
1180 if 1 || 0 || 0 || 0 && 1
1181 echo 51.ok
1182 else
1183 echo 51.err
1184 endif
1185 if 0 || 0 || 0 || 1 && 0
1186 echo 52.err
1187 else
1188 echo 52.ok
1189 endif
1190 if 0 || 0 || 0 || 1 && 1
1191 echo 53.ok
1192 else
1193 echo 53.err
1194 endif
1195 if 0 || 0 || 0 || 1 && 0 || 1 && 0
1196 echo 54.err
1197 else
1198 echo 54.ok
1199 endif
1200 if 0 || 0 || 0 || 1 && 0 || 1 && 1
1201 echo 55.ok
1202 else
1203 echo 55.err
1204 endif
1205 set diet=yo curd=ho
1206 if [ $diet == 'yo' && $curd == 'ho' ] && $ndefined
1207 echo 56.err
1208 else
1209 echo 56.ok
1210 endif
1211 if $diet == 'yo' && $curd == 'ho' && $ndefined
1212 echo 57.err
1213 else
1214 echo 57.ok
1215 endif
1216 set ndefined
1217 if [ $diet == 'yo' && $curd == 'ho' ] && $ndefined
1218 echo 57.ok
1219 else
1220 echo 57.err
1221 endif
1222 if $diet == 'yo' && $curd == 'ho' && $ndefined
1223 echo 58.ok
1224 else
1225 echo 58.err
1226 endif
1227 if [ [ [ [ [ [ $diet == 'yo' && $curd == 'ho' && $ndefined ] ] ] ] ] ]
1228 echo 59.ok
1229 else
1230 echo 59.err
1231 endif
1232 # Some more en-braced variables
1233 set diet=yo curd=ho
1234 if ${diet} == ${curd}
1235 echo 70.err
1236 else
1237 echo 70.ok
1238 endif
1239 if ${diet} != ${curd}
1240 echo 71.ok
1241 else
1242 echo 71.err
1243 endif
1244 if $diet == ${curd}
1245 echo 72.err
1246 else
1247 echo 72.ok
1248 endif
1249 if ${diet} == $curd
1250 echo 73.err
1251 else
1252 echo 73.ok
1253 endif
1254 # Unary !
1255 if ! 0 && ! ! 1 && ! ! ! ! 2 && 3
1256 echo 80.ok
1257 else
1258 echo 80.err
1259 endif
1260 if ! 0 && ! [ ! 1 ] && ! [ ! [ ! [ ! 2 ] ] ] && 3
1261 echo 81.ok
1262 else
1263 echo 81.err
1264 endif
1265 if [ ! 0 ] && [ ! [ ! 1 ] ] && [ ! [ ! [ ! [ ! [ 2 ] ] ] ] ] && 3
1266 echo 82.ok
1267 else
1268 echo 82.err
1269 endif
1270 if [ ! 0 ] && [ ! [ ! 1 ] ] && [ ! [ ! [ ! [ ! [ 2 ] ] ] ] ] && ! 3
1271 echo 83.err
1272 else
1273 echo 83.ok
1274 endif
1275 if [ ! 0 ] && [ ! [ ! 1 ] ] && ! [ [ ! [ ! [ ! [ 2 ] ] ] ] ] && ! 3
1276 echo 84.err
1277 else
1278 echo 84.ok
1279 endif
1280 if [ ! 0 ] && ! [ ! [ ! 1 ] ] && [ ! [ ! [ ! [ ! [ 2 ] ] ] ] ] && 3
1281 echo 85.err
1282 else
1283 echo 85.ok
1284 endif
1285 if ! [ ! 0 ] && [ ! [ ! 1 ] ] && [ ! [ ! [ ! [ ! [ 2 ] ] ] ] ] && 3
1286 echo 86.err
1287 else
1288 echo 86.ok
1289 endif
1290 if [ ! 0 ] && [ ! [ ! 1 ] ] && [ ! [ ! [ ! [ ! [ 2 ] ] ] ] ] || 3
1291 echo 87.ok
1292 else
1293 echo 87.err
1294 endif
1295 if [ ! 0 ] && [ ! ! [ ! ! 1 ] ] && [ ! ! [ ! ! [ ! ! [ ! ! [ 2 ] ] ] ] ]
1296 echo 88.ok
1297 else
1298 echo 88.err
1299 endif
1300 # Unary !, odd
1301 if ! 0 && ! ! 1 && ! ! ! 0 && 3
1302 echo 90.ok
1303 else
1304 echo 90.err
1305 endif
1306 if ! 0 && ! [ ! 1 ] && ! [ ! [ ! [ 0 ] ] ] && 3
1307 echo 91.ok
1308 else
1309 echo 91.err
1310 endif
1311 if [ ! 0 ] && [ ! [ ! 1 ] ] && [ ! [ ! [ ! [ [ 0 ] ] ] ] ] && 3
1312 echo 92.ok
1313 else
1314 echo 92.err
1315 endif
1316 if [ ! 0 ] && [ ! [ ! 1 ] ] && [ ! [ ! ! [ ! [ ! 0 ] ] ] ] && ! 3
1317 echo 93.err
1318 else
1319 echo 93.ok
1320 endif
1321 if [ ! 0 ] && [ ! [ ! 1 ] ] && ! [ ! [ ! [ ! [ ! 0 ] ] ] ] && 3
1322 echo 94.ok
1323 else
1324 echo 94.err
1325 endif
1326 if [ ! 0 ] && ! [ ! [ ! 1 ] ] && [ ! ! [ ! [ ! [ ! [ 0 ] ] ] ] ] && 3
1327 echo 95.err
1328 else
1329 echo 95.ok
1330 endif
1331 if ! [ ! 0 ] && [ ! [ ! 1 ] ] && [ ! [ ! [ ! [ ! ! 0 ] ] ] ] && 3
1332 echo 96.err
1333 else
1334 echo 96.ok
1335 endif
1336 if [ ! 0 ] && [ ! [ ! 1 ] ] && [ ! [ ! [ ! [ ! [ ! 0 ] ] ] ] ] || 3
1337 echo 97.ok
1338 else
1339 echo 97.err
1340 endif
1341 if [ ! 0 ] && [ ! ! [ ! ! 1 ] ] && [ ! ! [ ! ! [ ! ! [ ! [ 0 ] ] ] ] ]
1342 echo 98.ok
1343 else
1344 echo 98.err
1345 endif
1346 __EOT
1348 check behave:if-normal 0 "${MBOX}" '1688759742 719'
1350 if have_feat regex; then
1351 ${cat} <<- '__EOT' | ${MAILX} ${ARGS} > "${MBOX}"
1352 set dietcurd=yoho
1353 if $dietcurd =~ '^yo.*'
1354 echo 1.ok
1355 else
1356 echo 1.err
1357 endif
1358 if $dietcurd =~ '^Yo.*'
1359 echo 1-1.err
1360 else
1361 echo 1-1.ok
1362 endif
1363 if $dietcurd @=~ '^Yo.*'
1364 echo 1-2.ok
1365 else
1366 echo 1-2.err
1367 endif
1368 if $dietcurd =~ '^yOho.+'
1369 echo 2.err
1370 else
1371 echo 2.ok
1372 endif
1373 if $dietcurd @!~ '.*Ho$'
1374 echo 3.err
1375 else
1376 echo 3.ok
1377 endif
1378 if $dietcurd !~ '.+yohO$'
1379 echo 4.ok
1380 else
1381 echo 4.err
1382 endif
1383 if [ $dietcurd @i!~ '.+yoho$' ]
1384 echo 5.ok
1385 else
1386 echo 5.err
1387 endif
1388 if ! [ $dietcurd @i=~ '.+yoho$' ]
1389 echo 6.ok
1390 else
1391 echo 6.err
1392 endif
1393 if ! ! [ $dietcurd @i!~ '.+yoho$' ]
1394 echo 7.ok
1395 else
1396 echo 7.err
1397 endif
1398 if ! [ ! [ $dietcurd @i!~ '.+yoho$' ] ]
1399 echo 8.ok
1400 else
1401 echo 8.err
1402 endif
1403 if [ ! [ ! [ $dietcurd @i!~ '.+yoho$' ] ] ]
1404 echo 9.ok
1405 else
1406 echo 9.err
1407 endif
1408 if ! [ ! [ ! [ $dietcurd !~ '.+yoho$' ] ] ]
1409 echo 10.err
1410 else
1411 echo 10.ok
1412 endif
1413 if ! ! ! $dietcurd !~ '.+yoho$'
1414 echo 11.err
1415 else
1416 echo 11.ok
1417 endif
1418 if ! ! ! $dietcurd =~ '.+yoho$'
1419 echo 12.ok
1420 else
1421 echo 12.err
1422 endif
1423 if ! [ ! ! [ ! [ $dietcurd !~ '.+yoho$' ] ] ]
1424 echo 13.ok
1425 else
1426 echo 13.err
1427 endif
1428 set diet=abc curd='^abc$'
1429 if $diet =~ $curd
1430 echo 14.ok
1431 else
1432 echo 14.err
1433 endif
1434 set diet=abc curd='^abcd$'
1435 if $diet !~ $curd
1436 echo 15.ok
1437 else
1438 echo 15.err
1439 endif
1440 __EOT
1442 check behave:if-regex 0 "${MBOX}" '1115671789 95'
1443 else
1444 printf 'behave:if-regex: unsupported, skipped\n'
1447 t_epilog
1450 t_behave_localopts() {
1451 t_prolog t_behave_localopts
1453 # Nestable conditions test
1454 ${cat} <<- '__EOT' | ${MAILX} ${ARGS} > "${MBOX}" 2>&1
1455 define t2 {
1456 echo in: t2
1457 set t2=t2
1458 echo $t2
1460 define t1 {
1461 echo in: t1
1462 set gv1=gv1
1463 localopts on
1464 set lv1=lv1 lv2=lv2
1465 set lv3=lv3
1466 call t2
1467 localopts off
1468 set gv2=gv2
1469 echo $gv1 $lv1 ${lv2} ${lv3} ${gv2}, $t2
1471 define t0 {
1472 echo in: t0
1473 call t1
1474 echo $gv1 $lv1 ${lv2} ${lv3} ${gv2}, $t2
1475 echo "$gv1 $lv1 ${lv2} ${lv3} ${gv2}, $t2"
1477 account trouble {
1478 echo in: trouble
1479 call t0
1481 call t0
1482 unset gv1 gv2
1483 account trouble
1484 echo active trouble: $gv1 $lv1 ${lv2} ${lv3} ${gv2}, $t3
1485 account null
1486 echo active null: $gv1 $lv1 ${lv2} ${lv3} ${gv2}, $t3
1489 define ll2 {
1490 localopts $1
1491 set x=2
1492 echo ll2=$x
1494 define ll1 {
1495 wysh set y=$1; shift; eval localopts $y; localopts $1; shift
1496 set x=1
1497 echo ll1.1=$x
1498 call ll2 $1
1499 echo ll1.2=$x
1501 define ll0 {
1502 wysh set y=$1; shift; eval localopts $y; localopts $1; shift
1503 set x=0
1504 echo ll0.1=$x
1505 call ll1 $y "$@"
1506 echo ll0.2=$x
1508 define llx {
1509 echo ----- $1: $2 -> $3 -> $4
1510 echo ll-1.1=$x
1511 eval localopts $1
1512 call ll0 "$@"
1513 echo ll-1.2=$x
1514 unset x
1516 define lly {
1517 call llx 'call off' on on on
1518 call llx 'call off' off on on
1519 call llx 'call off' on off on
1520 call llx 'call off' on off off
1521 localopts call-fixate on
1522 call llx 'call-fixate on' on on on
1523 call llx 'call-fixate on' off on on
1524 call llx 'call-fixate on' on off on
1525 call llx 'call-fixate on' on off off
1526 unset x;localopts call on
1527 call llx 'call on' on on on
1528 call llx 'call on' off on on
1529 call llx 'call on' on off on
1530 call llx 'call on' on off off
1532 call lly
1533 __EOT
1535 check behave:localopts 0 "${MBOX}" '4016155249 1246'
1537 t_epilog
1540 t_behave_local() {
1541 t_prolog t_behave_local
1543 ${cat} <<- '__EOT' | ${MAILX} ${ARGS} > "${MBOX}" 2>&1
1544 define du2 {
1545 echo du2-1 du=$du
1546 local set du=$1
1547 echo du2-2 du=$du
1548 local unset du
1549 echo du2-3 du=$du
1551 define du {
1552 local set du=dudu
1553 echo du-1 du=$du
1554 call du2 du2du2
1555 echo du-2 du=$du
1556 local set nodu
1557 echo du-3 du=$du
1559 define ich {
1560 echo ich-1 du=$du
1561 call du
1562 echo ich-2 du=$du
1564 define wir {
1565 localopts $1
1566 set du=wirwir
1567 echo wir-1 du=$du
1568 call ich
1569 echo wir-2 du=$du
1571 echo ------- global-1 du=$du
1572 call ich
1573 echo ------- global-2 du=$du
1574 set du=global
1575 call ich
1576 echo ------- global-3 du=$du
1577 call wir on
1578 echo ------- global-4 du=$du
1579 call wir off
1580 echo ------- global-5 du=$du
1581 __EOT
1583 check behave:local-1 0 "${MBOX}" '2411598140 641'
1585 t_epilog
1588 t_behave_macro_param_shift() {
1589 t_prolog t_behave_macro_param_shift
1591 ${cat} <<- '__EOT' | ${MAILX} ${ARGS} > "${MBOX}" 2>/dev/null
1592 define t2 {
1593 echo in: t2
1594 echo t2.0 has $#/${#} parameters: "$1,${2},$3" (${*}) [$@]
1595 localopts on
1596 wysh set ignerr=$1
1597 shift
1598 localopts off
1599 echo t2.1 has $#/${#} parameters: "$1,${2},$3" (${*}) [$@]
1600 if [ $# > 1 ] || [ $ignerr == '' ]
1601 shift 2
1602 else
1603 ignerr shift 2
1604 endif
1605 echo t2.2:$? has $#/${#} parameters: "$1,${2},$3" (${*}) [$@]
1606 shift 0
1607 echo t2.3:$? has $#/${#} parameters: "$1,${2},$3" (${*}) [$@]
1608 if [ $# > 0 ]
1609 shift
1610 endif
1611 echo t2.4:$? has $#/${#} parameters: "$1,${2},$3" (${*}) [$@]
1613 define t1 {
1614 set errexit
1615 echo in: t1
1616 call t2 1 you get four args
1617 echo t1.1: $?';' ignerr ($ignerr) should not exist
1618 call t2 1 you get 'three args'
1619 echo t1.2: $?';' ignerr ($ignerr) should not exist
1620 call t2 1 you 'get two args'
1621 echo t1.3: $?';' ignerr ($ignerr) should not exist
1622 call t2 1 'you get one arg'
1623 echo t1.4: $?';' ignerr ($ignerr) should not exist
1624 ignerr call t2 '' 'you get one arg'
1625 echo t1.5: $?';' ignerr ($ignerr) should not exist
1627 call t1
1628 __EOT
1630 check behave:macro_param_shift 0 "${MBOX}" '1402489146 1682'
1632 t_epilog
1635 t_behave_addrcodec() {
1636 t_prolog t_behave_addrcodec
1638 ${cat} <<- '__EOT' | ${MAILX} ${ARGS} > "${MBOX}" 2>&1
1639 vput addrcodec res e 1 <doog@def>
1640 echo $?/$^ERRNAME $res
1641 eval vput addrcodec res d $res
1642 echo $?/$^ERRNAME $res
1643 vput addrcodec res e 2 . <doog@def>
1644 echo $?/$^ERRNAME $res
1645 eval vput addrcodec res d $res
1646 echo $?/$^ERRNAME $res
1647 vput addrcodec res e 3 Sauer Dr. <doog@def>
1648 echo $?/$^ERRNAME $res
1649 eval vput addrcodec res d $res
1650 echo $?/$^ERRNAME $res
1651 vput addrcodec res e 3.50 Sauer (Ma) Dr. <doog@def>
1652 echo $?/$^ERRNAME $res
1653 eval vput addrcodec res d $res
1654 echo $?/$^ERRNAME $res
1655 vput addrcodec res e 3.51 Sauer (Ma) "Dr." <doog@def>
1656 echo $?/$^ERRNAME $res
1657 eval vput addrcodec res d $res
1658 echo $?/$^ERRNAME $res
1660 vput addrcodec res +e 4 Sauer (Ma) Dr. <doog@def>
1661 echo $?/$^ERRNAME $res
1662 eval vput addrcodec res d $res
1663 echo $?/$^ERRNAME $res
1664 vput addrcodec res +e 5 Sauer (Ma) Braten Dr. <doog@def>
1665 echo $?/$^ERRNAME $res
1666 eval vput addrcodec res d $res
1667 echo $?/$^ERRNAME $res
1668 vput addrcodec res +e 6 Sauer (Ma) Braten Dr. (Heu) <doog@def>
1669 echo $?/$^ERRNAME $res
1670 eval vput addrcodec res d $res
1671 echo $?/$^ERRNAME $res
1672 vput addrcodec res +e 7 Sauer (Ma) Braten Dr. (Heu) <doog@def> (bu)
1673 echo $?/$^ERRNAME $res
1674 eval vput addrcodec res d $res
1675 echo $?/$^ERRNAME $res
1676 vput addrcodec res +e 8 \
1677 Dr. Sauer (Ma) Braten Dr. (Heu) <doog@def> (bu) Boom. Boom
1678 echo $?/$^ERRNAME $res
1679 eval vput addrcodec res d $res
1680 echo $?/$^ERRNAME $res
1681 vput addrcodec res +e 9 Dr.Sauer(Ma)Braten Dr. (Heu) <doog@def>
1682 echo $?/$^ERRNAME $res
1683 eval vput addrcodec res d $res
1684 echo $?/$^ERRNAME $res
1685 vput addrcodec res +e 10 (Ma)Braten Dr. (Heu) <doog@def>
1686 echo $?/$^ERRNAME $res
1687 eval vput addrcodec res d $res
1688 echo $?/$^ERRNAME $res
1689 vput addrcodec res +e 11 (Ma)Braten Dr"." (Heu) <doog@def>
1690 echo $?/$^ERRNAME $res
1691 eval vput addrcodec res d $res
1692 echo $?/$^ERRNAME $res
1693 vput addrcodec res +e 12 Dr. Sauer (Ma) Braten Dr. (u) <doog@def>
1694 echo $?/$^ERRNAME $res
1695 eval vput addrcodec res d $res
1696 echo $?/$^ERRNAME $res
1697 vput addrcodec res +e 13(Ma)Braten Dr. (Heu) <doog@def>
1698 echo $?/$^ERRNAME $res
1699 eval vput addrcodec res d $res
1700 echo $?/$^ERRNAME $res
1701 vput addrcodec res +e 14 Hey, Du <doog@def> Wie() findet Dr. das? ()
1702 echo $?/$^ERRNAME $res
1703 eval vput addrcodec res d $res
1704 echo $?/$^ERRNAME $res
1705 vput addrcodec res +e 15 \
1706 Hey, Du <doog@def> Wie() findet "" Dr. "" das? ()
1707 echo $?/$^ERRNAME $res
1708 eval vput addrcodec res d $res
1709 echo $?/$^ERRNAME $res
1710 vput addrcodec res +e 16 \
1711 "Hey," "Du" <doog@def> "Wie()" findet "" Dr. "" das? ()
1712 echo $?/$^ERRNAME $res
1713 eval vput addrcodec res d $res
1714 echo $?/$^ERRNAME $res
1715 vput addrcodec res +e 17 \
1716 "Hey" Du <doog@def> "Wie() findet " " Dr. """ das? ()
1717 echo $?/$^ERRNAME $res
1718 eval vput addrcodec res d $res
1719 echo $?/$^ERRNAME $res
1720 vput addrcodec res +e 18 \
1721 <doog@def> "Hey" Du "Wie() findet " " Dr. """ das? ()
1722 echo $?/$^ERRNAME $res
1723 eval vput addrcodec res d $res
1724 echo $?/$^ERRNAME $res
1725 vput addrcodec res +e 19 Hey\,\" <doog@def> "Wie()" findet \" Dr. \" das?
1726 echo $?/$^ERRNAME $res
1727 eval vput addrcodec res d $res
1728 echo $?/$^ERRNAME $res
1730 vput addrcodec res ++e 20 Hey\,\" <doog@def> "Wie()" findet \" Dr. \" das?
1731 echo $?/$^ERRNAME $res
1732 vput addrcodec res ++e 21 Hey\,\"" <doog@def> "Wie()" findet \" Dr. \" das?
1733 echo $?/$^ERRNAME $res
1734 eval vput addrcodec res d $res
1735 echo $?/$^ERRNAME $res
1737 vput addrcodec res +++e 22 Hey\\,\" <doog@def> "Wie()" findet \" Dr. \" das?
1738 echo $?/$^ERRNAME $res
1739 eval vput addrcodec res d $res
1740 echo $?/$^ERRNAME $res
1742 vput addrcodec res s \
1743 "23 Hey\\,\\\" \"Wie" () "\" findet \\\" Dr. \\\" das?" <doog@def>
1744 echo $?/$^ERRNAME $res
1746 # Fix for [f3852f88]
1747 vput addrcodec res ++e <from2@exam.ple> 100 (comment) "Quot(e)d"
1748 echo $?/$^ERRNAME $res
1749 eval vput addrcodec res d $res
1750 echo $?/$^ERRNAME $res
1751 vput addrcodec res e <from2@exam.ple> 100 (comment) "Quot(e)d"
1752 echo $?/$^ERRNAME $res
1753 eval vput addrcodec res d $res
1754 echo $?/$^ERRNAME $res
1755 __EOT
1757 check behave:addrcodec-1 0 "${MBOX}" '1047317989 2612'
1759 ${cat} <<- '__EOT' | ${MAILX} ${ARGS} > "${MBOX}" 2>&1
1760 mlist isa1@list
1761 mlsubscribe isa2@list
1763 vput addrcodec res skin Hey\\,\" <isa0@list> "Wie()" find \" Dr. \" das?
1764 echo $?/$^ERRNAME $res
1765 vput addrcodec res skinlist Hey\\,\" <isa0@list> "Wie()" find \" Dr. \" das?
1766 echo $?/$^ERRNAME $res
1767 vput addrcodec res skin Hey\\,\" <isa1@list> "Wie()" find \" Dr. \" das?
1768 echo $?/$^ERRNAME $res
1769 vput addrcodec res skinlist Hey\\,\" <isa1@list> "Wie()" find \" Dr. \" das?
1770 echo $?/$^ERRNAME $res
1771 vput addrcodec res skin Hey\\,\" <isa2@list> "Wie()" find \" Dr. \" das?
1772 echo $?/$^ERRNAME $res
1773 vput addrcodec res skinlist Hey\\,\" <isa2@list> "Wie()" find \" Dr. \" das?
1774 echo $?/$^ERRNAME $res
1775 __EOT
1777 check behave:addrcodec-2 0 "${MBOX}" '1391779299 104'
1779 if have_feat idna; then
1780 ${cat} <<- '__EOT' | ${MAILX} ${ARGS} ${ADDARG_UNI} > "${MBOX}" 2>&1
1781 vput addrcodec res e (heu) <du@blödiän> "stroh" du
1782 echo $?/$^ERRNAME $res
1783 eval vput addrcodec res d $res
1784 echo $?/$^ERRNAME $res
1785 vput addrcodec res e <du@blödiän> du
1786 echo $?/$^ERRNAME $res
1787 eval vput addrcodec res d $res
1788 echo $?/$^ERRNAME $res
1789 vput addrcodec res e du <du@blödiän>
1790 echo $?/$^ERRNAME $res
1791 eval vput addrcodec res d $res
1792 echo $?/$^ERRNAME $res
1793 vput addrcodec res e <du@blödiän>
1794 echo $?/$^ERRNAME $res
1795 eval vput addrcodec res d $res
1796 echo $?/$^ERRNAME $res
1797 vput addrcodec res e du@blödiän
1798 echo $?/$^ERRNAME $res
1799 eval vput addrcodec res d $res
1800 echo $?/$^ERRNAME $res
1801 __EOT
1803 check behave:addrcodec-idna 0 "${MBOX}" '498775983 326'
1804 else
1805 printf 'behave:addrcodec-idna: unsupported, skipped\n'
1808 t_epilog
1811 t_behave_vexpr() {
1812 t_prolog t_behave_vexpr
1814 ${cat} <<- '__EOT' | ${MAILX} ${ARGS} > "${MBOX}" 2>/dev/null
1815 echo ' #0.0'
1816 vput vexpr res = 9223372036854775807
1817 echo $?/$^ERRNAME $res
1818 vput vexpr res = 9223372036854775808
1819 echo $?/$^ERRNAME $res
1820 vput vexpr res = u9223372036854775808
1821 echo $?/$^ERRNAME $res
1822 vput vexpr res @= 9223372036854775808
1823 echo $?/$^ERRNAME $res
1824 vput vexpr res = -9223372036854775808
1825 echo $?/$^ERRNAME $res
1826 vput vexpr res = -9223372036854775809
1827 echo $?/$^ERRNAME $res
1828 vput vexpr res @= -9223372036854775809
1829 echo $?/$^ERRNAME $res
1830 vput vexpr res = U9223372036854775809
1831 echo $?/$^ERRNAME $res
1832 echo ' #0.1'
1833 vput vexpr res = \
1834 0b0111111111111111111111111111111111111111111111111111111111111111
1835 echo $?/$^ERRNAME $res
1836 vput vexpr res = \
1837 S0b1000000000000000000000000000000000000000000000000000000000000000
1838 echo $?/$^ERRNAME $res
1839 vput vexpr res @= \
1840 S0b1000000000000000000000000000000000000000000000000000000000000000
1841 echo $?/$^ERRNAME $res
1842 vput vexpr res = \
1843 U0b1000000000000000000000000000000000000000000000000000000000000000
1844 echo $?/$^ERRNAME $res
1845 vput vexpr res = \
1846 0b1000000000000000000000000000000000000000000000000000000000000000
1847 echo $?/$^ERRNAME $res
1848 vput vexpr res @= \
1849 0b1000000000000000000000000000000000000000000000000000000000000000
1850 echo $?/$^ERRNAME $res
1851 vput vexpr res = \
1852 -0b1000000000000000000000000000000000000000000000000000000000000000
1853 echo $?/$^ERRNAME $res
1854 vput vexpr res = \
1855 S0b1000000000000000000000000000000000000000000000000000000000000001
1856 echo $?/$^ERRNAME $res
1857 vput vexpr res @= \
1858 S0b1000000000000000000000000000000000000000000000000000000000000001
1859 echo $?/$^ERRNAME $res
1860 vput vexpr res @= \
1861 -0b1000000000000000000000000000000000000000000000000000000000000001
1862 echo $?/$^ERRNAME $res
1863 vput vexpr res = \
1864 U0b1000000000000000000000000000000000000000000000000000000000000001
1865 echo $?/$^ERRNAME $res
1866 echo ' #0.2'
1867 vput vexpr res = 0777777777777777777777
1868 echo $?/$^ERRNAME $res
1869 vput vexpr res = S01000000000000000000000
1870 echo $?/$^ERRNAME $res
1871 vput vexpr res @= S01000000000000000000000
1872 echo $?/$^ERRNAME $res
1873 vput vexpr res = U01000000000000000000000
1874 echo $?/$^ERRNAME $res
1875 vput vexpr res = 01000000000000000000000
1876 echo $?/$^ERRNAME $res
1877 vput vexpr res @= 01000000000000000000000
1878 echo $?/$^ERRNAME $res
1879 vput vexpr res = -01000000000000000000000
1880 echo $?/$^ERRNAME $res
1881 vput vexpr res = S01000000000000000000001
1882 echo $?/$^ERRNAME $res
1883 vput vexpr res @= S01000000000000000000001
1884 echo $?/$^ERRNAME $res
1885 vput vexpr res @= -01000000000000000000001
1886 echo $?/$^ERRNAME $res
1887 vput vexpr res = U01000000000000000000001
1888 echo $?/$^ERRNAME $res
1889 echo ' #0.3'
1890 vput vexpr res = 0x7FFFFFFFFFFFFFFF
1891 echo $?/$^ERRNAME $res
1892 vput vexpr res = S0x8000000000000000
1893 echo $?/$^ERRNAME $res
1894 vput vexpr res @= S0x8000000000000000
1895 echo $?/$^ERRNAME $res
1896 vput vexpr res = U0x8000000000000000
1897 echo $?/$^ERRNAME $res
1898 vput vexpr res = 0x8000000000000000
1899 echo $?/$^ERRNAME $res
1900 vput vexpr res @= 0x8000000000000000
1901 echo $?/$^ERRNAME $res
1902 vput vexpr res = -0x8000000000000000
1903 echo $?/$^ERRNAME $res
1904 vput vexpr res = S0x8000000000000001
1905 echo $?/$^ERRNAME $res
1906 vput vexpr res @= S0x8000000000000001
1907 echo $?/$^ERRNAME $res
1908 vput vexpr res @= -0x8000000000000001
1909 echo $?/$^ERRNAME $res
1910 vput vexpr res = u0x8000000000000001
1911 echo $?/$^ERRNAME $res
1912 echo ' #1'
1913 vput vexpr res ~ 0
1914 echo $?/$^ERRNAME $res
1915 vput vexpr res ~ 1
1916 echo $?/$^ERRNAME $res
1917 vput vexpr res ~ -1
1918 echo $?/$^ERRNAME $res
1919 echo ' #2'
1920 vput vexpr res + 0 0
1921 echo $?/$^ERRNAME $res
1922 vput vexpr res + 0 1
1923 echo $?/$^ERRNAME $res
1924 vput vexpr res + 1 1
1925 echo $?/$^ERRNAME $res
1926 echo ' #3'
1927 vput vexpr res + 9223372036854775807 0
1928 echo $?/$^ERRNAME $res
1929 vput vexpr res + 9223372036854775807 1
1930 echo $?/$^ERRNAME $res
1931 vput vexpr res @+ 9223372036854775807 1
1932 echo $?/$^ERRNAME $res
1933 vput vexpr res + 0 9223372036854775807
1934 echo $?/$^ERRNAME $res
1935 vput vexpr res + 1 9223372036854775807
1936 echo $?/$^ERRNAME $res
1937 vput vexpr res @+ 1 9223372036854775807
1938 echo $?/$^ERRNAME $res
1939 echo ' #4'
1940 vput vexpr res + -9223372036854775808 0
1941 echo $?/$^ERRNAME $res
1942 vput vexpr res + -9223372036854775808 -1
1943 echo $?/$^ERRNAME $res
1944 vput vexpr res @+ -9223372036854775808 -1
1945 echo $?/$^ERRNAME $res
1946 vput vexpr res + 0 -9223372036854775808
1947 echo $?/$^ERRNAME $res
1948 vput vexpr res + -1 -9223372036854775808
1949 echo $?/$^ERRNAME $res
1950 vput vexpr res @+ -1 -9223372036854775808
1951 echo $?/$^ERRNAME $res
1952 echo ' #5'
1953 vput vexpr res - 0 0
1954 echo $?/$^ERRNAME $res
1955 vput vexpr res - 0 1
1956 echo $?/$^ERRNAME $res
1957 vput vexpr res - 1 1
1958 echo $?/$^ERRNAME $res
1959 echo ' #6'
1960 vput vexpr res - 9223372036854775807 0
1961 echo $?/$^ERRNAME $res
1962 vput vexpr res - 9223372036854775807 -1
1963 echo $?/$^ERRNAME $res
1964 vput vexpr res @- 9223372036854775807 -1
1965 echo $?/$^ERRNAME $res
1966 vput vexpr res - 0 9223372036854775807
1967 echo $?/$^ERRNAME $res
1968 vput vexpr res - -1 9223372036854775807
1969 echo $?/$^ERRNAME $res
1970 vput vexpr res - -2 9223372036854775807
1971 echo $?/$^ERRNAME $res
1972 vput vexpr res @- -2 9223372036854775807
1973 echo $?/$^ERRNAME $res
1974 echo ' #7'
1975 vput vexpr res - -9223372036854775808 +0
1976 echo $?/$^ERRNAME $res
1977 vput vexpr res - -9223372036854775808 +1
1978 echo $?/$^ERRNAME $res
1979 vput vexpr res @- -9223372036854775808 +1
1980 echo $?/$^ERRNAME $res
1981 vput vexpr res - 0 -9223372036854775808
1982 echo $?/$^ERRNAME $res
1983 vput vexpr res - +1 -9223372036854775808
1984 echo $?/$^ERRNAME $res
1985 vput vexpr res @- +1 -9223372036854775808
1986 echo $?/$^ERRNAME $res
1987 echo ' #8'
1988 vput vexpr res + -13 -2
1989 echo $?/$^ERRNAME $res
1990 vput vexpr res - 0 0
1991 echo $?/$^ERRNAME $res
1992 vput vexpr res - 0 1
1993 echo $?/$^ERRNAME $res
1994 vput vexpr res - 1 1
1995 echo $?/$^ERRNAME $res
1996 vput vexpr res - -13 -2
1997 echo $?/$^ERRNAME $res
1998 echo ' #9'
1999 vput vexpr res * 0 0
2000 echo $?/$^ERRNAME $res
2001 vput vexpr res * 0 1
2002 echo $?/$^ERRNAME $res
2003 vput vexpr res * 1 1
2004 echo $?/$^ERRNAME $res
2005 vput vexpr res * -13 -2
2006 echo $?/$^ERRNAME $res
2007 echo ' #10'
2008 vput vexpr res / 0 0
2009 echo $?/$^ERRNAME $res
2010 vput vexpr res / 0 1
2011 echo $?/$^ERRNAME $res
2012 vput vexpr res / 1 1
2013 echo $?/$^ERRNAME $res
2014 vput vexpr res / -13 -2
2015 echo $?/$^ERRNAME $res
2016 echo ' #11'
2017 vput vexpr res % 0 0
2018 echo $?/$^ERRNAME $res
2019 vput vexpr res % 0 1
2020 echo $?/$^ERRNAME $res
2021 vput vexpr res % 1 1
2022 echo $?/$^ERRNAME $res
2023 vput vexpr res % -13 -2
2024 echo $?/$^ERRNAME $res
2025 __EOT
2027 check behave:vexpr-numeric 0 "${MBOX}" '960821755 1962'
2029 ${cat} <<- '__EOT' | ${MAILX} ${ARGS} > "${MBOX}" 2>&1
2030 vput vexpr res find 'bananarama' 'nana'
2031 echo $?/$^ERRNAME :$res:
2032 vput vexpr res find 'bananarama' 'bana'
2033 echo $?/$^ERRNAME :$res:
2034 vput vexpr res find 'bananarama' 'Bana'
2035 echo $?/$^ERRNAME :$res:
2036 vput vexpr res find 'bananarama' 'rama'
2037 echo $?/$^ERRNAME :$res:
2038 echo ' #1'
2039 vput vexpr res ifind 'bananarama' 'nana'
2040 echo $?/$^ERRNAME :$res:
2041 vput vexpr res ifind 'bananarama' 'bana'
2042 echo $?/$^ERRNAME :$res:
2043 vput vexpr res ifind 'bananarama' 'Bana'
2044 echo $?/$^ERRNAME :$res:
2045 vput vexpr res ifind 'bananarama' 'rama'
2046 echo $?/$^ERRNAME :$res:
2047 echo ' #2'
2048 vput vexpr res substring 'bananarama' 1
2049 echo $?/$^ERRNAME :$res:
2050 vput vexpr res substring 'bananarama' 3
2051 echo $?/$^ERRNAME :$res:
2052 vput vexpr res substring 'bananarama' 5
2053 echo $?/$^ERRNAME :$res:
2054 vput vexpr res substring 'bananarama' 7
2055 echo $?/$^ERRNAME :$res:
2056 vput vexpr res substring 'bananarama' 9
2057 echo $?/$^ERRNAME :$res:
2058 vput vexpr res substring 'bananarama' 10
2059 echo $?/$^ERRNAME :$res:
2060 vput vexpr res substring 'bananarama' 1 3
2061 echo $?/$^ERRNAME :$res:
2062 vput vexpr res substring 'bananarama' 3 3
2063 echo $?/$^ERRNAME :$res:
2064 vput vexpr res substring 'bananarama' 5 3
2065 echo $?/$^ERRNAME :$res:
2066 vput vexpr res substring 'bananarama' 7 3
2067 echo $?/$^ERRNAME :$res:
2068 vput vexpr res substring 'bananarama' 9 3
2069 echo $?/$^ERRNAME :$res:
2070 vput vexpr res substring 'bananarama' 10 3
2071 echo $?/$^ERRNAME :$res:
2072 echo ' #3'
2073 vput vexpr res substring 'bananarama' -1
2074 echo $?/$^ERRNAME :$res:
2075 vput vexpr res substring 'bananarama' -3
2076 echo $?/$^ERRNAME :$res:
2077 vput vexpr res substring 'bananarama' -5
2078 echo $?/$^ERRNAME :$res:
2079 vput vexpr res substring 'bananarama' -7
2080 echo $?/$^ERRNAME :$res:
2081 vput vexpr res substring 'bananarama' -9
2082 echo $?/$^ERRNAME :$res:
2083 vput vexpr res substring 'bananarama' -10
2084 echo $?/$^ERRNAME :$res:
2085 vput vexpr res substring 'bananarama' 1 -3
2086 echo $?/$^ERRNAME :$res:
2087 vput vexpr res substring 'bananarama' 3 -3
2088 echo $?/$^ERRNAME :$res:
2089 vput vexpr res substring 'bananarama' 5 -3
2090 echo $?/$^ERRNAME :$res:
2091 vput vexpr res substring 'bananarama' 7 -3
2092 echo $?/$^ERRNAME :$res:
2093 vput vexpr res substring 'bananarama' 9 -3
2094 echo $?/$^ERRNAME :$res:
2095 vput vexpr res substring 'bananarama' 10 -3
2096 echo $?/$^ERRNAME :$res:
2097 echo ' #4'
2098 vput vexpr res trim 'Cocoon Cocoon'
2099 echo $?/$^ERRNAME :$res:
2100 vput vexpr res trim ' Cocoon Cocoon '
2101 echo $?/$^ERRNAME :$res:
2102 vput vexpr res trim-front 'Cocoon Cocoon'
2103 echo $?/$^ERRNAME :$res:
2104 vput vexpr res trim-front ' Cocoon Cocoon '
2105 echo $?/$^ERRNAME :$res:
2106 vput vexpr res trim-end 'Cocoon Cocoon'
2107 echo $?/$^ERRNAME :$res:
2108 vput vexpr res trim-end ' Cocoon Cocoon '
2109 echo $?/$^ERRNAME :$res:
2110 __EOT
2112 check behave:vexpr-string 0 "${MBOX}" '3182004322 601'
2114 if have_feat regex; then
2115 ${cat} <<- '__EOT' | ${MAILX} ${ARGS} > "${MBOX}" 2>&1
2116 vput vexpr res regex 'bananarama' 'nana'
2117 echo $?/$^ERRNAME :$res:
2118 vput vexpr res regex 'bananarama' 'bana'
2119 echo $?/$^ERRNAME :$res:
2120 vput vexpr res regex 'bananarama' 'Bana'
2121 echo $?/$^ERRNAME :$res:
2122 vput vexpr res regex 'bananarama' 'rama'
2123 echo $?/$^ERRNAME :$res:
2124 echo ' #1'
2125 vput vexpr res iregex 'bananarama' 'nana'
2126 echo $?/$^ERRNAME :$res:
2127 vput vexpr res iregex 'bananarama' 'bana'
2128 echo $?/$^ERRNAME :$res:
2129 vput vexpr res iregex 'bananarama' 'Bana'
2130 echo $?/$^ERRNAME :$res:
2131 vput vexpr res iregex 'bananarama' 'rama'
2132 echo $?/$^ERRNAME :$res:
2133 echo ' #2'
2134 vput vexpr res regex 'bananarama' '(.*)nana(.*)' '\${1}a\${0}u{\$2}'
2135 echo $?/$^ERRNAME :$res:
2136 vput vexpr res regex 'bananarama' '(.*)bana(.*)' '\${1}a\${0}u\$2'
2137 echo $?/$^ERRNAME :$res:
2138 vput vexpr res regex 'bananarama' 'Bana(.+)' '\$1\$0'
2139 echo $?/$^ERRNAME :$res:
2140 vput vexpr res regex 'bananarama' '(.+)rama' '\$1\$0'
2141 echo $?/$^ERRNAME :$res:
2142 echo ' #3'
2143 vput vexpr res iregex 'bananarama' '(.*)nana(.*)' '\${1}a\${0}u{\$2}'
2144 echo $?/$^ERRNAME :$res:
2145 vput vexpr res iregex 'bananarama' '(.*)bana(.*)' '\${1}a\${0}u\$2'
2146 echo $?/$^ERRNAME :$res:
2147 vput vexpr res iregex 'bananarama' 'Bana(.+)' '\$1\$0'
2148 echo $?/$^ERRNAME :$res:
2149 vput vexpr res iregex 'bananarama' '(.+)rama' '\$1\$0'
2150 echo $?/$^ERRNAME :$res:
2151 echo ' #4'
2152 __EOT
2154 check behave:vexpr-regex 0 "${MBOX}" '3270360157 311'
2155 else
2156 printf 'behave:vexpr-regex: unsupported, skipped\n'
2159 t_epilog
2162 t_behave_call_ret() {
2163 t_prolog t_behave_call_ret
2165 ${cat} <<- '__EOT' | ${MAILX} ${ARGS} -Snomemdebug > "${MBOX}" 2>&1
2166 define w1 {
2167 echon ">$1 "
2168 vput vexpr i + $1 1
2169 if [ $i -le 42 ]
2170 vput vexpr j '&' $i 7
2171 if [ $j -eq 7 ]
2172 echo .
2174 call w1 $i
2175 wysh set i=$? k=$!
2176 vput vexpr j '&' $i 7
2177 echon "<$1/$i/$k "
2178 if [ $j -eq 7 ]
2179 echo .
2181 else
2182 echo ! The end for $1
2184 return $1
2186 # Transport $?/$! up the call chain
2187 define w2 {
2188 echon ">$1 "
2189 vput vexpr i + $1 1
2190 if [ $1 -lt 42 ]
2191 call w2 $i
2192 wysh set i=$? j=$! k=$^ERRNAME
2193 echon "<$1/$i/$k "
2194 return $i $j
2195 else
2196 echo ! The end for $1
2197 return $i $^ERR-BUSY
2199 echoerr au
2201 # Up and down it goes
2202 define w3 {
2203 echon ">$1/$2 "
2204 vput vexpr i + $1 1
2205 if [ $1 -lt 42 ]
2206 call w3 $i $2
2207 wysh set i=$? j=$!
2208 vput vexpr k - $1 $2
2209 if [ $k -eq 21 ]
2210 vput vexpr i + $1 1
2211 vput vexpr j + $2 1
2212 echo "# <$i/$j> .. "
2213 call w3 $i $j
2214 wysh set i=$? j=$!
2216 eval echon "<\$1=\$i/\$^ERRNAME-$j "
2217 return $i $j
2218 else
2219 echo ! The end for $1=$i/$2
2220 if [ "$2" != "" ]
2221 return $i $^ERR-DOM
2222 else
2223 return $i $^ERR-BUSY
2226 echoerr au
2229 call w1 0; echo ?=$? !=$!; echo -----;
2230 call w2 0; echo ?=$? !=$^ERRNAME; echo -----;
2231 call w3 0 1; echo ?=$? !=$^ERRNAME; echo -----;
2232 __EOT
2234 check behave:call_ret 0 "${MBOX}" '1572045517 5922'
2236 t_epilog
2239 t_behave_xcall() {
2240 t_prolog t_behave_xcall
2242 ${cat} <<- '__EOT' | ${MAILX} ${ARGS} -Snomemdebug > "${MBOX}" 2>&1
2243 define work {
2244 echon "$1 "
2245 vput vexpr i + $1 1
2246 if [ $i -le 1111 ]
2247 vput vexpr j '&' $i 7
2248 if [ $j -eq 7 ]
2249 echo .
2251 \xcall work $i $2
2253 echo ! The end for $1/$2
2254 if [ "$2" != "" ]
2255 return $i $^ERR-BUSY
2258 define xwork {
2259 \xcall work 0 $2
2261 call work 0
2262 echo ?=$? !=$!
2263 call xwork
2264 echo ?=$? !=$!
2265 xcall xwork
2266 echo ?=$? !=$^ERRNAME
2268 call work 0 yes
2269 echo ?=$? !=$^ERRNAME
2270 call xwork 0 yes
2271 echo ?=$? !=$^ERRNAME
2272 __EOT
2274 check behave:xcall-1 0 "${MBOX}" '2401702082 23801'
2278 ${cat} <<- '__EOT' > "${BODY}"
2279 define __w {
2280 echon "$1 "
2281 vput vexpr i + $1 1
2282 if [ $i -le 111 ]
2283 vput vexpr j '&' $i 7
2284 if [ $j -eq 7 ]
2285 echo .
2287 \xcall __w $i $2
2289 echo ! The end for $1
2290 if [ $2 -eq 0 ]
2291 nonexistingcommand
2292 echo would be err with errexit
2293 return
2295 echo calling exit
2296 exit
2298 define work {
2299 echo eins
2300 call __w 0 0
2301 echo zwei, ?=$? !=$!
2302 localopts yes; set errexit
2303 ignerr call __w 0 0
2304 echo drei, ?=$? !=$^ERRNAME
2305 call __w 0 $1
2306 echo vier, ?=$? !=$^ERRNAME, this is an error
2308 ignerr call work 0
2309 echo outer 1, ?=$? !=$^ERRNAME
2310 xxxign call work 0
2311 echo outer 2, ?=$? !=$^ERRNAME, could be error if xxxign non-empty
2312 call work 1
2313 echo outer 3, ?=$? !=$^ERRNAME
2314 echo this is definitely an error
2315 __EOT
2317 < "${BODY}" ${MAILX} ${ARGS} -X'commandalias xxxign ignerr' -Snomemdebug \
2318 > "${MBOX}" 2>&1
2319 check behave:xcall-2 0 "${MBOX}" '3900716531 4200'
2321 < "${BODY}" ${MAILX} ${ARGS} -X'commandalias xxxign " "' -Snomemdebug \
2322 > "${MBOX}" 2>&1
2323 check behave:xcall-3 1 "${MBOX}" '1006776201 2799'
2325 t_epilog
2328 t_behave_vpospar() {
2329 t_prolog t_behave_vpospar
2331 ${cat} <<- '__EOT' | ${MAILX} ${ARGS} > "${MBOX}" 2>&1
2332 vpospar set hey, "'you ", world!
2333 echo $?/$^ERRNAME/$#: $* / "$@" / <$1><$2><$3><$4>
2334 vput vpospar x quote; echo x<$x>
2335 vpospar clear;echo $?/$^ERRNAME/$#: $* / "$@" / <$1><$2><$3><$4>
2336 vput vpospar y quote;echo y<$y>
2337 eval vpospar set ${x};echo $?/$^ERRNAME/$#: $* / "$@" / <$1><$2><$3><$4>
2338 eval vpospar set ${y};echo $?/$^ERRNAME/$#: $* / "$@" / <$1><$2><$3><$4>
2339 eval vpospar set ${x};echo $?/$^ERRNAME/$#: $* / "$@" / <$1><$2><$3><$4>
2341 define infun2 {
2342 echo infun2:$?/$^ERRNAME/$#:$*/"$@"/<$1><$2><$3><$4>
2343 vput vpospar z quote;echo infun2:z<$z>
2346 define infun {
2347 echo infun:$?/$^ERRNAME/$#:$*/"$@"/<$1><$2><$3><$4>
2348 vput vpospar y quote;echo infun:y<$y>
2349 eval vpospar set ${x};echo infun:$?/$^ERRNAME/$#:$*/"$@"/<$1><$2><$3><$4>
2350 vpospar clear;echo infun:$?/$^ERRNAME/$#:$*/"$@"/<$1><$2><$3><$4>
2351 eval call infun2 $x
2352 echo infun:$?/$^ERRNAME/$#:$*/"$@"/<$1><$2><$3><$4>
2353 eval vpospar set ${y};echo infun:$?/$^ERRNAME/$#:$*/"$@"/<$1><$2><$3><$4>
2356 call infun This "in a" fun
2357 echo $?/$^ERRNAME/$#: $* / "$@" / <$1><$2><$3><$4>
2358 vpospar clear;echo $?/$^ERRNAME/$#: $* / "$@" / <$1><$2><$3><$4>
2359 __EOT
2360 check behave:vpospar-1 0 "${MBOX}" '155175639 866'
2363 ${cat} <<- '__EOT' | ${MAILX} ${ARGS} > "${MBOX}" 2>&1
2364 set ifs=\'
2365 echo ifs<$ifs> ifs-ws<$ifs-ws>
2366 vpospar set hey, "'you ", world!
2367 echo $?/$^ERRNAME/$#: $* / "$@" / <$1><$2><$3><$4>
2368 vput vpospar x quote; echo x<$x>
2369 vpospar clear;echo $?/$^ERRNAME/$#: $* / "$@" / <$1><$2><$3><$4>
2370 eval vpospar set ${x};echo $?/$^ERRNAME/$#: $* / "$@" / <$1><$2><$3><$4>
2372 set ifs=,
2373 echo ifs<$ifs> ifs-ws<$ifs-ws>
2374 vpospar set hey, "'you ", world!
2375 unset ifs;echo $?/$^ERRNAME/$#: $* / "$@" / <$1><$2><$3><$4>
2376 set ifs=,
2377 vput vpospar x quote; echo x<$x>
2378 vpospar clear;echo $?/$^ERRNAME/$#: $* / "$@" / <$1><$2><$3><$4>
2379 eval vpospar set ${x};\
2380 unset ifs;echo $?/$^ERRNAME/$#: $* / "$@" / <$1><$2><$3><$4>
2382 wysh set ifs=$',\t'
2383 echo ifs<$ifs> ifs-ws<$ifs-ws>
2384 vpospar set hey, "'you ", world!
2385 unset ifs; echo $?/$^ERRNAME/$#: $* / "$@" / <$1><$2><$3><$4>
2386 wysh set ifs=$',\t'
2387 vput vpospar x quote; echo x<$x>
2388 vpospar clear;echo $?/$^ERRNAME/$#: $* / "$@" / <$1><$2><$3><$4>
2389 eval vpospar set ${x};\
2390 unset ifs;echo $?/$^ERRNAME/$#: $* / "$@" / <$1><$2><$3><$4>
2391 __EOT
2392 check behave:vpospar-ifs 0 "${MBOX}" '2015927702 706'
2394 t_epilog
2397 t_behave_atxplode() {
2398 t_prolog t_behave_atxplode
2399 TRAP_EXIT_ADDONS="./.t*"
2401 ${cat} > ./.t.sh <<- '___'; ${cat} > ./.t.rc <<- '___'
2402 x() { echo $#; }
2403 xxx() {
2404 printf " (1/$#: <$1>)"
2405 shift
2406 if [ $# -gt 0 ]; then
2407 xxx "$@"
2408 else
2409 echo
2412 yyy() {
2413 eval "$@ ' ball"
2415 set --
2416 x "$@"
2417 x "$@"''
2418 x " $@"
2419 x "$@ "
2420 printf yyy;yyy 'xxx' "b\$'\t'u ' "
2421 printf xxx;xxx arg ,b u.
2422 printf xxx;xxx arg , .
2423 printf xxx;xxx arg ,ball.
2425 define x {
2426 echo $#
2428 define xxx {
2429 echon " (1/$#: <$1>)"
2430 shift
2431 if [ $# -gt 0 ]
2432 \xcall xxx "$@"
2433 endif
2434 echo
2436 define yyy {
2437 eval "$@ ' ball"
2439 vpospar set
2440 call x "$@"
2441 call x "$@"''
2442 call x " $@"
2443 call x "$@ "
2444 echon yyy;call yyy '\call xxx' "b\$'\t'u ' "
2445 echon xxx;call xxx arg ,b u.
2446 echon xxx;call xxx arg , .
2447 echon xxx;call xxx arg ,ball.
2450 ${MAILX} ${ARGS} -X'source ./.t.rc' -Xx > "${MBOX}" 2>&1
2451 check behave:atxplode-1 0 "${MBOX}" '41566293 164'
2453 #${SHELL} ./.t.sh > ./.tshout 2>&1
2454 #check behave:atxplode:disproof-1 0 ./.tshout '41566293 164'
2456 t_epilog
2459 t_behave_read() {
2460 t_prolog t_behave_read
2461 TRAP_EXIT_ADDONS="./.t*"
2463 ${cat} <<- '__EOT' > .tin
2464 hey1, "'you ", world!
2465 hey2, "'you ", bugs bunny!
2466 hey3, "'you ",
2467 hey4, "'you "
2468 __EOT
2470 ${cat} <<- '__EOT' |\
2471 ${MAILX} ${ARGS} -X'readctl create ./.tin' > "${MBOX}" 2>&1
2472 read a b c
2473 echo $?/$^ERRNAME / <$a><$b><$c>
2474 read a b c
2475 echo $?/$^ERRNAME / <$a><$b><$c>
2476 read a b c
2477 echo $?/$^ERRNAME / <$a><$b><$c>
2478 read a b c
2479 echo $?/$^ERRNAME / <$a><$b><$c>
2480 unset a b c;read a b c
2481 echo $?/$^ERRNAME / <$a><$b><$c>
2482 readctl remove ./.tin;echo readctl remove:$?/$^ERRNAME
2483 __EOT
2484 check behave:read-1 0 "${MBOX}" '1527910147 173'
2486 ${cat} <<- '__EOT' > .tin2
2487 hey2.0,:"'you ",:world!:mars.:
2488 hey2.1,:"'you ",:world!
2489 hey2.2,:"'you ",:bugs bunny!
2490 hey2.3,:"'you ",:
2491 hey2.4,:"'you ":
2493 __EOT
2495 ${cat} <<- '__EOT' |\
2496 6< .tin2 ${MAILX} ${ARGS} -X 'readctl create 6' > "${MBOX}" 2>&1
2497 set ifs=:
2498 read a b c
2499 echo $?/$^ERRNAME / <$a><$b><$c>
2500 read a b c
2501 echo $?/$^ERRNAME / <$a><$b><$c>
2502 read a b c
2503 echo $?/$^ERRNAME / <$a><$b><$c>
2504 read a b c
2505 echo $?/$^ERRNAME / <$a><$b><$c>
2506 read a b c
2507 echo $?/$^ERRNAME / <$a><$b><$c>
2508 read a b c
2509 echo $?/$^ERRNAME / <$a><$b><$c>
2510 unset a b c;read a b c
2511 echo $?/$^ERRNAME / <$a><$b><$c>
2512 read a b c
2513 echo $?/$^ERRNAME / <$a><$b><$c>
2514 readctl remove 6;echo readctl remove:$?/$^ERRNAME
2515 __EOT
2516 check behave:read-ifs 0 "${MBOX}" '890153490 298'
2518 ${cat} <<- '__EOT' | ${MAILX} ${ARGS} > "${MBOX}" 2>&1
2519 readctl create .tin
2520 readall d; echo $?/$^ERRNAME / <$d>
2521 wysh set d;readall d;echo $?/$^ERRNAME / <$d>
2522 readctl create .tin2
2523 readall d; echo $?/$^ERRNAME / <$d>
2524 wysh set d;readall d;echo $?/$^ERRNAME / <$d>
2525 readctl remove .tin;echo $?/$^ERRNAME;\
2526 readctl remove .tin2;echo $?/$^ERRNAME
2527 __EOT
2528 check behave:readall 0 "${MBOX}" '860434889 333'
2530 t_epilog
2533 t_behave_mbox() {
2534 t_prolog t_behave_mbox
2535 TRAP_EXIT_ADDONS="./.t*"
2539 while [ ${i} -lt 112 ]; do
2540 printf 'm file://%s\n~s Subject %s\nHello %s!\n~.\n' \
2541 "${MBOX}" "${i}" "${i}"
2542 i=`add ${i} 1`
2543 done
2544 ) | ${MAILX} ${ARGS}
2545 check behave:mbox-1 0 "${MBOX}" '1140119864 13780'
2547 printf 'File "%s"\ncopy * "%s"\nFile "%s"\nfrom*' "${MBOX}" .tmbox1 .tmbox1 |
2548 ${MAILX} ${ARGS} -Sshowlast > .tlst
2549 check behave:mbox-2 0 .tlst '2739893312 9103'
2551 printf 'File "%s"\ncopy * "file://%s"\nFile "file://%s"\nfrom*' \
2552 "${MBOX}" .tmbox2 .tmbox2 | ${MAILX} ${ARGS} -Sshowlast > .tlst
2553 check behave:mbox-3 0 .tlst '1702194178 9110'
2555 # only the odd (even)
2557 printf 'File "file://%s"\ncopy ' .tmbox2
2559 while [ ${i} -lt 112 ]; do
2560 j=`modulo ${i} 2`
2561 [ ${j} -eq 1 ] && printf '%s ' "${i}"
2562 i=`add ${i} 1`
2563 done
2564 printf 'file://%s\nFile "file://%s"\nfrom*' .tmbox3 .tmbox3
2565 ) | ${MAILX} ${ARGS} -Sshowlast > .tlst
2566 check behave:mbox-4 0 .tmbox3 '631132924 6890'
2567 check behave:mbox-5 - .tlst '2960975049 4573'
2568 # ...
2570 printf 'file "file://%s"\nmove ' .tmbox2
2572 while [ ${i} -lt 112 ]; do
2573 j=`modulo ${i} 2`
2574 [ ${j} -eq 0 ] && [ ${i} -ne 0 ] && printf '%s ' "${i}"
2575 i=`add ${i} 1`
2576 done
2577 printf 'file://%s\nFile "file://%s"\nfrom*\nFile "file://%s"\nfrom*' \
2578 .tmbox3 .tmbox3 .tmbox2
2579 ) | ${MAILX} ${ARGS} -Sshowlast > .tlst
2580 check behave:mbox-6 0 .tmbox3 '1387070539 13655'
2581 ${sed} 2d < .tlst > .tlstx
2582 check behave:mbox-7 - .tlstx '2729940494 13645'
2584 t_epilog
2587 t_behave_maildir() {
2588 t_prolog t_behave_maildir
2589 TRAP_EXIT_ADDONS="./.t*"
2593 while [ ${i} -lt 112 ]; do
2594 printf 'm file://%s\n~s Subject %s\nHello %s!\n~.\n' \
2595 "${MBOX}" "${i}" "${i}"
2596 i=`add ${i} 1`
2597 done
2598 ) | ${MAILX} ${ARGS}
2599 check behave:maildir-1 0 "${MBOX}" '1140119864 13780'
2601 printf 'File "%s"
2602 copy * "%s"
2603 File "%s"
2604 from*
2605 ' "${MBOX}" .tmdir1 .tmdir1 |
2606 ${MAILX} ${ARGS} -Snewfolders=maildir -Sshowlast > .tlst
2607 check behave:maildir-2 0 .tlst '1797938753 9103'
2609 printf 'File "%s"
2610 copy * "maildir://%s"
2611 File "maildir://%s"
2612 from*
2613 ' "${MBOX}" .tmdir2 .tmdir2 |
2614 ${MAILX} ${ARGS} -Sshowlast > .tlst
2615 check behave:maildir-3 0 .tlst '1155631089 9113'
2617 printf 'File "maildir://%s"
2618 copy * "file://%s"
2619 File "file://%s"
2620 from*
2621 ' .tmdir2 .tmbox1 .tmbox1 |
2622 ${MAILX} ${ARGS} -Sshowlast > .tlst
2623 check behave:maildir-4 0 .tmbox1 '2646131190 13220'
2624 check behave:maildir-5 - .tlst '3701297796 9110'
2626 # only the odd (even)
2628 printf 'File "maildir://%s"
2629 copy ' .tmdir2
2631 while [ ${i} -lt 112 ]; do
2632 j=`modulo ${i} 2`
2633 [ ${j} -eq 1 ] && printf '%s ' "${i}"
2634 i=`add ${i} 1`
2635 done
2636 printf ' file://%s
2637 File "file://%s"
2638 from*
2639 ' .tmbox2 .tmbox2
2640 ) | ${MAILX} ${ARGS} -Sshowlast > .tlst
2641 check behave:maildir-6 0 .tmbox2 '142890131 6610'
2642 check behave:maildir-7 - .tlst '960096773 4573'
2643 # ...
2645 printf 'file "maildir://%s"
2646 move ' .tmdir2
2648 while [ ${i} -lt 112 ]; do
2649 j=`modulo ${i} 2`
2650 [ ${j} -eq 0 ] && [ ${i} -ne 0 ] && printf '%s ' "${i}"
2651 i=`add ${i} 1`
2652 done
2653 printf ' file://%s
2654 File "file://%s"
2655 from*
2656 File "maildir://%s"
2657 from*
2658 ' .tmbox2 .tmbox2 .tmdir2
2659 ) | ${MAILX} ${ARGS} -Sshowlast > .tlst
2660 check behave:maildir-8 0 .tmbox2 '3806905791 13100'
2661 ${sed} 2d < .tlst > .tlstx
2662 check behave:maildir-9 - .tlstx '4216815295 13645'
2664 t_epilog
2667 t_behave_record_a_resend() {
2668 t_prolog t_behave_record_a_resend
2669 TRAP_EXIT_ADDONS="./.t.record ./.t.resent"
2671 printf '
2672 set record=%s
2673 m %s\n~s Subject 1.\nHello.\n~.
2674 set record-files add-file-recipients
2675 m %s\n~s Subject 2.\nHello.\n~.
2676 File %s
2677 resend 2 ./.t.resent
2678 Resend 1 ./.t.resent
2679 set record-resent
2680 resend 2 ./.t.resent
2681 Resend 1 ./.t.resent
2682 ' ./.t.record "${MBOX}" "${MBOX}" "${MBOX}" |
2683 ${MAILX} ${ARGS}
2685 check behave:record_a_resend-1 0 "${MBOX}" '3057873538 256'
2686 check behave:record_a_resend-2 - .t.record '391356429 460'
2687 check behave:record_a_resend-3 - .t.resent '2685231691 648'
2689 t_epilog
2692 t_behave_e_H_L_opts() {
2693 t_prolog t_behave_e_H_L_opts
2694 TRAP_EXIT_ADDONS="./.tsendmail.sh ./.t.mbox"
2696 touch ./.t.mbox
2697 ${MAILX} ${ARGS} -ef ./.t.mbox
2698 echo ${?} > "${MBOX}"
2700 ${cat} <<-_EOT > ./.tsendmail.sh
2701 #!${SHELL} -
2702 (echo 'From Alchemilla Wed Apr 07 17:03:33 2017' && ${cat} && echo
2703 ) >> "./.t.mbox"
2704 _EOT
2705 chmod 0755 ./.tsendmail.sh
2706 printf 'm me@exam.ple\nLine 1.\nHello.\n~.\n' |
2707 ${MAILX} ${ARGS} -Smta=./.tsendmail.sh
2708 printf 'm you@exam.ple\nLine 1.\nBye.\n~.\n' |
2709 ${MAILX} ${ARGS} -Smta=./.tsendmail.sh
2711 ${MAILX} ${ARGS} -ef ./.t.mbox
2712 echo ${?} >> "${MBOX}"
2713 ${MAILX} ${ARGS} -efL @t@me ./.t.mbox
2714 echo ${?} >> "${MBOX}"
2715 ${MAILX} ${ARGS} -efL @t@you ./.t.mbox
2716 echo ${?} >> "${MBOX}"
2717 ${MAILX} ${ARGS} -efL '@>@Line 1' ./.t.mbox
2718 echo ${?} >> "${MBOX}"
2719 ${MAILX} ${ARGS} -efL '@>@Hello.' ./.t.mbox
2720 echo ${?} >> "${MBOX}"
2721 ${MAILX} ${ARGS} -efL '@>@Bye.' ./.t.mbox
2722 echo ${?} >> "${MBOX}"
2723 ${MAILX} ${ARGS} -efL '@>@Good bye.' ./.t.mbox
2724 echo ${?} >> "${MBOX}"
2726 ${MAILX} ${ARGS} -fH ./.t.mbox >> "${MBOX}"
2727 echo ${?} >> "${MBOX}"
2728 ${MAILX} ${ARGS} -fL @t@me ./.t.mbox >> "${MBOX}"
2729 echo ${?} >> "${MBOX}"
2730 ${MAILX} ${ARGS} -fL @t@you ./.t.mbox >> "${MBOX}"
2731 echo ${?} >> "${MBOX}"
2732 ${MAILX} ${ARGS} -fL '@>@Line 1' ./.t.mbox >> "${MBOX}"
2733 echo ${?} >> "${MBOX}"
2734 ${MAILX} ${ARGS} -fL '@>@Hello.' ./.t.mbox >> "${MBOX}"
2735 echo ${?} >> "${MBOX}"
2736 ${MAILX} ${ARGS} -fL '@>@Bye.' ./.t.mbox >> "${MBOX}"
2737 echo ${?} >> "${MBOX}"
2738 ${MAILX} ${ARGS} -fL '@>@Good bye.' ./.t.mbox >> "${MBOX}" 2>/dev/null
2739 echo ${?} >> "${MBOX}"
2741 check behave:e_H_L_opts - "${MBOX}" '1708955574 678'
2743 t_epilog
2746 t_behave_alternates() {
2747 t_prolog t_behave_alternates
2748 TRAP_EXIT_ADDONS="./.t*"
2750 ${cat} <<-_EOT > ./.tsendmail.sh
2751 #!${SHELL} -
2752 (echo 'From Valeriana Sat Jul 08 15:54:03 2017' && ${cat} && echo
2753 ) >> "${MBOX}"
2754 _EOT
2755 chmod 0755 ./.tsendmail.sh
2757 ${cat} <<- '__EOT' | ${MAILX} ${ARGS} -Smta=./.tsendmail.sh > ./.tall 2>&1
2758 echo --0
2759 alternates
2760 echo $?/$^ERRNAME
2761 alternates a1@b1 a2@b2 a3@b3
2762 echo $?/$^ERRNAME
2763 alternates
2764 echo $?/$^ERRNAME
2765 vput alternates rv
2766 echo $?/$^ERRNAME <$rv>
2768 echo --1
2769 unalternates a2@b2
2770 vput alternates rv
2771 echo $?/$^ERRNAME <$rv>
2772 unalternates a3@b3
2773 vput alternates rv
2774 echo $?/$^ERRNAME <$rv>
2775 unalternates a1@b1
2776 vput alternates rv
2777 echo $?/$^ERRNAME <$rv>
2779 echo --2
2780 unalternates *
2781 alternates a1@b1 a2@b2 a3@b3
2782 unalternates a3@b3
2783 vput alternates rv
2784 echo $?/$^ERRNAME <$rv>
2785 unalternates a2@b2
2786 vput alternates rv
2787 echo $?/$^ERRNAME <$rv>
2788 unalternates a1@b1
2789 vput alternates rv
2790 echo $?/$^ERRNAME <$rv>
2792 echo --3
2793 alternates a1@b1 a2@b2 a3@b3
2794 unalternates a1@b1
2795 vput alternates rv
2796 echo $?/$^ERRNAME <$rv>
2797 unalternates a2@b2
2798 vput alternates rv
2799 echo $?/$^ERRNAME <$rv>
2800 unalternates a3@b3
2801 vput alternates rv
2802 echo $?/$^ERRNAME <$rv>
2804 echo --4
2805 unalternates *
2806 alternates a1@b1 a2@b2 a3@b3
2807 unalternates *
2808 vput alternates rv
2809 echo $?/$^ERRNAME <$rv>
2811 echo --5
2812 unalternates *
2813 alternates a1@b1 a1@c1 a1@d1 a2@b2 a3@b3 a3@c3 a3@d3
2814 m a1@b1 a1@c1 a1@d1
2815 ~s all alternates, only a1@b1 remains
2816 ~c a2@b2
2817 ~b a3@b3 a3@c3 a3@d3
2818 ~r - '_EOT'
2819 This body is!
2820 This also body is!!
2821 _EOT
2824 echo --6
2825 unalternates *
2826 alternates a1@b1 a1@c1 a2@b2 a3@b3
2827 m a1@b1 a1@c1 a1@d1
2828 ~s a1@b1 a1@d1, and a3@c3 a3@d3 remain
2829 ~c a2@b2
2830 ~b a3@b3 a3@c3 a3@d3
2831 ~r - '_EOT'
2832 This body2 is!
2833 _EOT
2836 echo --7
2837 alternates a1@b1 a2@b2 a3; set allnet
2838 m a1@b1 a1@c1 a1@d1
2839 ~s all alternates via allnet, only a1@b1 remains
2840 ~c a2@b2
2841 ~b a3@b3 a3@c3 a3@d3
2842 ~r - '_EOT'
2843 This body3 is!
2844 _EOT
2847 echo --10
2848 unalternates *
2849 alternates a1@b1
2850 echo $?/$^ERRNAME
2851 vput alternates rv
2852 echo $?/$^ERRNAME <$rv>
2853 alternates a2@b2
2854 echo $?/$^ERRNAME
2855 vput alternates rv
2856 echo $?/$^ERRNAME <$rv>
2857 alternates a3@b3
2858 echo $?/$^ERRNAME
2859 vput alternates rv
2860 echo $?/$^ERRNAME <$rv>
2861 alternates a4@b4
2862 echo $?/$^ERRNAME
2863 vput alternates rv
2864 echo $?/$^ERRNAME <$rv>
2866 unalternates *
2867 vput alternates rv
2868 echo $?/$^ERRNAME <$rv>
2870 echo --11
2871 set posix
2872 alternates a1@b1 a2@b2
2873 echo $?/$^ERRNAME
2874 vput alternates rv
2875 echo $?/$^ERRNAME <$rv>
2876 alternates a3@b3 a4@b4
2877 echo $?/$^ERRNAME
2878 vput alternates rv
2879 echo $?/$^ERRNAME <$rv>
2880 __EOT
2881 check behave:alternates-1 0 "${MBOX}" '142184864 515'
2882 check behave:alternates-2 - .tall '1878598364 505'
2884 t_epilog
2887 t_behave_alias() {
2888 t_prolog t_behave_alias
2889 TRAP_EXIT_ADDONS="./.t*"
2891 ${cat} <<-_EOT > ./.tsendmail.sh
2892 #!${SHELL} -
2893 (echo 'From Hippocastanum Mon Jun 19 15:07:07 2017' && ${cat} && echo
2894 ) >> "${MBOX}"
2895 _EOT
2896 chmod 0755 ./.tsendmail.sh
2898 ${cat} <<- '__EOT' | ${MAILX} ${ARGS} -Smta=./.tsendmail.sh > ./.tall 2>&1
2899 alias a1 ex1@a1.ple
2900 alias a1 ex2@a1.ple "EX3 <ex3@a1.ple>"
2901 alias a1 ex4@a1.ple
2902 alias a2 ex1@a2.ple ex2@a2.ple ex3@a2.ple ex4@a2.ple
2903 alias a3 a4
2904 alias a4 a5 ex1@a4.ple
2905 alias a5 a6
2906 alias a6 a7 ex1@a6.ple
2907 alias a7 a8
2908 alias a8 ex1@a8.ple
2909 alias a1
2910 alias a2
2911 alias a3
2912 m a1
2913 ~c a2
2914 ~b a3
2915 ~r - '_EOT'
2916 This body is!
2917 This also body is!!
2918 _EOT
2919 __EOT
2920 check behave:alias-1 0 "${MBOX}" '2496925843 272'
2921 check behave:alias-2 - .tall '3548953204 152'
2923 # TODO t_behave_alias: n_ALIAS_MAXEXP is compile-time constant,
2924 # TODO need to somehow provide its contents to the test, then test
2926 t_epilog
2929 t_behave_filetype() {
2930 t_prolog t_behave_filetype
2931 TRAP_EXIT_ADDONS="./.t*"
2933 ${cat} <<-_EOT > ./.tsendmail.sh
2934 #!${SHELL} -
2935 (echo 'From Alchemilla Wed Apr 25 15:12:13 2017' && ${cat} && echo
2936 ) >> "${MBOX}"
2937 _EOT
2938 chmod 0755 ./.tsendmail.sh
2940 printf 'm m1@e.t\nL1\nHy1\n~.\nm m2@e.t\nL2\nHy2\n~@ %s\n~.\n' \
2941 "${SRCDIR}snailmail.jpg" | ${MAILX} ${ARGS} -Smta=./.tsendmail.sh
2942 check behave:filetype-1 0 "${MBOX}" '1594682963 13520'
2944 if (echo | gzip -c) >/dev/null 2>&1; then
2945 ${rm} -f ./.t.mbox*
2947 printf 'File "%s"\ncopy 1 ./.t.mbox.gz\ncopy 2 ./.t.mbox.gz' \
2948 "${MBOX}" | ${MAILX} ${ARGS} \
2949 -X'filetype gz gzip\ -dc gzip\ -c'
2950 printf 'File ./.t.mbox.gz\ncopy * ./.t.mbox\n' |
2951 ${MAILX} ${ARGS} -X'filetype gz gzip\ -dc gzip\ -c'
2952 } > ./.t.out 2>&1
2953 check behave:filetype-2 - "./.t.mbox" '1594682963 13520'
2954 check behave:filetype-3 - "./.t.out" '2392348396 102'
2955 else
2956 echo 'behave:filetype-2: unsupported, skipped'
2957 echo 'behave:filetype-3: unsupported, skipped'
2961 ${rm} -f ./.t.mbox*
2962 printf 'File "%s"\ncopy 1 ./.t.mbox.gz
2963 copy 2 ./.t.mbox.gz
2964 copy 1 ./.t.mbox.gz
2965 copy 2 ./.t.mbox.gz
2966 ' "${MBOX}" |
2967 ${MAILX} ${ARGS} \
2968 -X'filetype gz gzip\ -dc gzip\ -c' \
2969 -X'filetype mbox.gz "${sed} 1,3d|${cat}" \
2970 "echo eins;echo zwei;echo und mit ${sed} bist Du dabei;${cat}"'
2971 printf 'File ./.t.mbox.gz\ncopy * ./.t.mbox\n' |
2972 ${MAILX} ${ARGS} \
2973 -X'filetype gz gzip\ -dc gzip\ -c' \
2974 -X'filetype mbox.gz "${sed} 1,3d|${cat}" kill\ 0'
2975 } > ./.t.out 2>&1
2976 check behave:filetype-4 - "./.t.mbox" '2886541147 27060'
2977 check behave:filetype-5 - "./.t.out" '852335377 172'
2979 t_epilog
2982 t_behave_message_injections() {
2983 t_prolog t_behave_message_injections
2984 TRAP_EXIT_ADDONS="./.t*"
2986 ${cat} <<-_EOT > ./.tsendmail.sh
2987 #!${SHELL} -
2988 (echo 'From Echinacea Tue Jun 20 15:54:02 2017' && ${cat} && echo
2989 ) > "${MBOX}"
2990 _EOT
2991 chmod 0755 ./.tsendmail.sh
2993 echo mysig > ./.tmysig
2995 echo some-body | ${MAILX} ${ARGS} -Smta=./.tsendmail.sh \
2996 -Smessage-inject-head=head-inject \
2997 -Smessage-inject-tail=tail-inject \
2998 -Ssignature=./.tmysig \
2999 ex@am.ple > ./.tall 2>&1
3000 check behave:message_injections-1 0 "${MBOX}" '2434746382 134'
3001 check behave:message_injections-2 - .tall '4294967295 0' # empty file
3003 ${cat} <<-_EOT > ./.template
3004 From: me
3005 To: ex1@am.ple
3006 Cc: ex2@am.ple
3007 Subject: This subject is
3009 Body, body, body me.
3010 _EOT
3011 < ./.template ${MAILX} ${ARGS} -t -Smta=./.tsendmail.sh \
3012 -Smessage-inject-head=head-inject \
3013 -Smessage-inject-tail=tail-inject \
3014 -Ssignature=./.tmysig \
3015 > ./.tall 2>&1
3016 check behave:message_injections-3 0 "${MBOX}" '3114203412 198'
3017 check behave:message_injections-4 - .tall '4294967295 0' # empty file
3019 t_epilog
3022 t_behave_compose_hooks() { # TODO monster
3023 t_prolog t_behave_compose_hooks
3024 TRAP_EXIT_ADDONS="./.t*"
3026 (echo line one&&echo line two&&echo line three) > ./.treadctl
3027 (echo echo four&&echo echo five&&echo echo six) > ./.tattach
3029 ${cat} <<-_EOT > ./.tsendmail.sh
3030 #!${SHELL} -
3031 (echo 'From PrimulaVeris Wed Apr 10 22:59:00 2017' && ${cat} && echo
3032 ) >> "${MBOX}"
3033 _EOT
3034 chmod 0755 ./.tsendmail.sh
3036 ${cat} <<'__EOT__' > ./.trc
3037 define bail {
3038 echoerr "Failed: $1. Bailing out"; echo "~x"; xit
3040 define xerr {
3041 vput vexpr es substr "$1" 0 1
3042 if [ "$es" != 2 ]
3043 xcall bail "$2"
3046 define read_mline_res {
3047 read hl; wysh set len=$? es=$! en=$^ERRNAME;\
3048 echo $len/$es/$^ERRNAME: $hl
3049 if [ $es -ne $^ERR-NONE ]
3050 xcall bail read_mline_res
3051 elif [ $len -ne 0 ]
3052 \xcall read_mline_res
3055 define ins_addr {
3056 wysh set xh=$1
3057 echo "~^header list"; read hl; echo $hl;\
3058 call xerr "$hl" "in_addr ($xh) 0-1"
3060 echo "~^header insert $xh diet <$xh@exam.ple> spliced";\
3061 read es; echo $es; call xerr "$es" "ins_addr $xh 1-1"
3062 echo "~^header insert $xh <${xh}2@exam.ple>";\
3063 read es; echo $es; call xerr "$es" "ins_addr $xh 1-2"
3064 echo "~^header insert $xh ${xh}3@exam.ple";\
3065 read es; echo $es; call xerr "$es" "ins_addr $xh 1-3"
3066 echo "~^header list $xh"; read hl; echo $hl;\
3067 call xerr "$hl" "ins_addr $xh 1-4"
3068 echo "~^header show $xh"; read es; call xerr $es "ins_addr $xh 1-5"
3069 call read_mline_res
3071 if [ "$t_remove" == "" ]
3072 return
3075 echo "~^header remove $xh"; read es; call xerr $es "ins_addr $xh 2-1"
3076 echo "~^header remove $xh"; read es; vput vexpr es substr $es 0 3
3077 if [ $es != 501 ]
3078 xcall bail "ins_addr $xh 2-2"
3080 echo "~^header list $xh"; read es; vput vexpr es substr $es 0 3
3081 if [ $es != 501 ]
3082 xcall bail "ins_addr $xh 2-3"
3084 echo "~^header show $xh"; read es; vput vexpr es substr $es 0 3
3085 if [ $es != 501 ]
3086 xcall bail "ins_addr $xh 2-4"
3090 echo "~^header insert $xh diet <$xh@exam.ple> spliced";\
3091 read es; echo $es; call xerr "$es" "ins_addr $xh 3-1"
3092 echo "~^header insert $xh <${xh}2@exam.ple>";\
3093 read es; echo $es; call xerr "$es" "ins_addr $xh 3-2"
3094 echo "~^header insert $xh ${xh}3@exam.ple";\
3095 read es; echo $es; call xerr "$es" "ins_addr $xh 3-3"
3096 echo "~^header list $xh"; read hl; echo $hl;\
3097 call xerr "$hl" "ins_addr $xh 3-4"
3098 echo "~^header show $xh"; read es; call xerr $es "ins_addr $xh 3-5"
3099 call read_mline_res
3101 echo "~^header remove-at $xh 1"; read es;\
3102 call xerr $es "ins_addr $xh 3-6"
3103 echo "~^header remove-at $xh 1"; read es;\
3104 call xerr $es "ins_addr $xh 3-7"
3105 echo "~^header remove-at $xh 1"; read es;\
3106 call xerr $es "ins_addr $xh 3-8"
3107 echo "~^header remove-at $xh 1"; read es;\
3108 vput vexpr es substr $es 0 3
3109 if [ $es != 501 ]
3110 xcall bail "ins_addr $xh 3-9"
3112 echo "~^header remove-at $xh T"; read es;\
3113 vput vexpr es substr $es 0 3
3114 if [ $es != 505 ]
3115 xcall bail "ins_addr $xh 3-10"
3117 echo "~^header list $xh"; read es;\
3118 vput vexpr es substr $es 0 3
3119 if [ $es != 501 ]
3120 xcall bail "ins_addr $xh 3-11"
3122 echo "~^header show $xh"; read es;\
3123 vput vexpr es substr $es 0 3
3124 if [ $es != 501 ]
3125 xcall bail "ins_addr $xh 3-12"
3129 echo "~^header insert $xh diet <$xh@exam.ple> spliced";\
3130 read es; echo $es; call xerr "$es" "ins_addr $xh 4-1"
3131 echo "~^header insert $xh <${xh}2@exam.ple> (comment) \"Quot(e)d\"";\
3132 read es; echo $es; call xerr "$es" "ins_addr $xh 4-2"
3133 echo "~^header insert $xh ${xh}3@exam.ple";\
3134 read es; echo $es; call xerr "$es" "ins_addr $xh 4-3"
3135 echo "~^header list $xh"; read hl; echo $hl;\
3136 call xerr "$hl" "header list $xh 3-4"
3137 echo "~^header show $xh"; read es; call xerr $es "ins_addr $xh 4-5"
3138 call read_mline_res
3140 echo "~^header remove-at $xh 3"; read es;\
3141 call xerr $es "ins_addr $xh 4-6"
3142 echo "~^header remove-at $xh 2"; read es;\
3143 call xerr $es "ins_addr $xh 4-7"
3144 echo "~^header remove-at $xh 1"; read es;\
3145 call xerr $es "ins_addr $xh 4-8"
3146 echo "~^header remove-at $xh 1"; read es;\
3147 vput vexpr es substr $es 0 3
3148 if [ $es != 501 ]
3149 xcall bail "ins_addr $xh 4-9"
3151 echo "~^header remove-at $xh T"; read es;\
3152 vput vexpr es substr $es 0 3
3153 if [ $es != 505 ]
3154 xcall bail "ins_addr $xh 4-10"
3156 echo "~^header list $xh"; read es;\
3157 vput vexpr es substr $es 0 3
3158 if [ $es != 501 ]
3159 xcall bail "ins_addr $xh 4-11"
3161 echo "~^header show $xh"; read es;\
3162 vput vexpr es substr $es 0 3
3163 if [ $es != 501 ]
3164 xcall bail "ins_addr $xh 4-12"
3167 define ins_ref {
3168 wysh set xh=$1 mult=$2
3169 echo "~^header list"; read hl; echo $hl;\
3170 call xerr "$hl" "ins_ref ($xh) 0-1"
3172 echo "~^header insert $xh <$xh@exam.ple>";\
3173 read es; echo $es; call xerr "$es" "ins_ref $xh 1-1"
3174 if [ $mult -ne 0 ]
3175 echo "~^header insert $xh <${xh}2@exam.ple>";\
3176 read es; echo $es; call xerr "$es" "ins_ref $xh 1-2"
3177 echo "~^header insert $xh ${xh}3@exam.ple";\
3178 read es; echo $es; call xerr "$es" "ins_ref $xh 1-3"
3179 else
3180 echo "~^header insert $xh <${xh}2@exam.ple>"; read es;\
3181 vput vexpr es substr $es 0 3
3182 if [ $es != 506 ]
3183 xcall bail "ins_ref $xh 1-4"
3187 echo "~^header list $xh"; read hl; echo $hl;\
3188 call xerr "$hl" "ins_ref $xh 1-5"
3189 echo "~^header show $xh"; read es; call xerr $es "ins_ref $xh 1-6"
3190 call read_mline_res
3192 if [ "$t_remove" == "" ]
3193 return
3196 echo "~^header remove $xh"; read es;\
3197 call xerr $es "ins_ref $xh 2-1"
3198 echo "~^header remove $xh"; read es;\
3199 vput vexpr es substr $es 0 3
3200 if [ $es != 501 ]
3201 xcall bail "ins_ref $xh 2-2"
3203 echo "~^header list $xh"; read es;\
3204 vput vexpr es substr $es 0 3
3205 if [ $es != 501 ]
3206 xcall bail "$es ins_ref $xh 2-3"
3208 echo "~^header show $xh"; read es;\
3209 vput vexpr es substr $es 0 3
3210 if [ $es != 501 ]
3211 xcall bail "ins_ref $xh 2-4"
3215 echo "~^header insert $xh <$xh@exam.ple>";\
3216 read es; echo $es; call xerr "$es" "ins_ref $xh 3-1"
3217 if [ $mult -ne 0 ]
3218 echo "~^header insert $xh <${xh}2@exam.ple>";\
3219 read es; echo $es; call xerr "$es" "ins_ref $xh 3-2"
3220 echo "~^header insert $xh ${xh}3@exam.ple";\
3221 read es; echo $es; call xerr "$es" "ins_ref $xh 3-3"
3223 echo "~^header list $xh";\
3224 read hl; echo $hl; call xerr "$hl" "ins_ref $xh 3-4"
3225 echo "~^header show $xh";\
3226 read es; call xerr $es "ins_ref $xh 3-5"
3227 call read_mline_res
3229 echo "~^header remove-at $xh 1"; read es;\
3230 call xerr $es "ins_ref $xh 3-6"
3231 if [ $mult -ne 0 ] && [ $xh != subject ]
3232 echo "~^header remove-at $xh 1"; read es;\
3233 call xerr $es "ins_ref $xh 3-7"
3234 echo "~^header remove-at $xh 1"; read es;\
3235 call xerr $es "ins_ref $xh 3-8"
3237 echo "~^header remove-at $xh 1"; read es;\
3238 vput vexpr es substr $es 0 3
3239 if [ $es != 501 ]
3240 xcall bail "ins_ref $xh 3-9"
3242 echo "~^header remove-at $xh T"; read es;\
3243 vput vexpr es substr $es 0 3
3244 if [ $es != 505 ]
3245 xcall bail "ins_ref $xh 3-10"
3247 echo "~^header show $xh"; read es;\
3248 vput vexpr es substr $es 0 3
3249 if [ $es != 501 ]
3250 xcall bail "ins_ref $xh 3-11"
3254 echo "~^header insert $xh <$xh@exam.ple> ";\
3255 read es; echo $es; call xerr "$es" "ins_ref $xh 4-1"
3256 if [ $mult -ne 0 ]
3257 echo "~^header insert $xh <${xh}2@exam.ple> ";\
3258 read es; echo $es; call xerr "$es" "ins_ref $xh 4-2"
3259 echo "~^header insert $xh ${xh}3@exam.ple";\
3260 read es; echo $es; call xerr "$es" "ins_ref $xh 4-3"
3262 echo "~^header list $xh"; read hl; echo $hl;\
3263 call xerr "$hl" "ins_ref $xh 4-4"
3264 echo "~^header show $xh"; read es; call xerr $es "ins_ref $xh 4-5"
3265 call read_mline_res
3267 if [ $mult -ne 0 ] && [ $xh != subject ]
3268 echo "~^header remove-at $xh 3"; read es;\
3269 call xerr $es "ins_ref $xh 4-6"
3270 echo "~^header remove-at $xh 2"; read es;\
3271 call xerr $es "ins_ref $xh 4-7"
3273 echo "~^header remove-at $xh 1"; read es;\
3274 call xerr $es "ins_ref $xh 4-8"
3275 echo "~^header remove-at $xh 1"; read es;\
3276 vput vexpr es substr $es 0 3
3277 if [ $es != 501 ]
3278 xcall bail "ins_ref $xh 4-9"
3280 echo "~^header remove-at $xh T"; read es;\
3281 vput vexpr es substr $es 0 3
3282 if [ $es != 505 ]
3283 xcall bail "ins_ref $xh 4-10"
3285 echo "~^header show $xh"; read es;\
3286 vput vexpr es substr $es 0 3
3287 if [ $es != 501 ]
3288 xcall bail "ins_ref $xh 4-11"
3291 define t_header {
3292 echo t_header ENTER
3293 # In collect.c order
3294 call ins_addr from
3295 call ins_ref sender 0 # Not a "ref", but works
3296 call ins_addr To
3297 call ins_addr cC
3298 call ins_addr bCc
3299 call ins_addr reply-To
3300 call ins_addr mail-Followup-to
3301 call ins_ref messAge-id 0
3302 call ins_ref rEfErEncEs 1
3303 call ins_ref in-Reply-to 1
3304 call ins_ref subject 1 # Not a "ref", but works (with tweaks)
3305 call ins_addr freeForm1
3306 call ins_addr freeform2
3308 echo "~^header show MAILX-Command"; read es; call xerr $es "t_header 1000"
3309 call read_mline_res
3310 echo "~^header show MAILX-raw-TO"; read es; call xerr $es "t_header 1001"
3311 call read_mline_res
3313 echo t_header LEAVE
3315 define t_attach {
3316 echo t_attach ENTER
3318 echo "~^attachment";\
3319 read hl; echo $hl; vput vexpr es substr "$hl" 0 3
3320 if [ "$es" != 501 ]
3321 xcall bail "attach 0-1"
3324 echo "~^attach attribute ./.treadctl";\
3325 read hl; echo $hl; vput vexpr es substr "$hl" 0 3
3326 if [ "$es" != 501 ]
3327 xcall bail "attach 0-2"
3329 echo "~^attachment attribute-at 1";\
3330 read hl; echo $hl; vput vexpr es substr "$hl" 0 3
3331 if [ "$es" != 501 ]
3332 xcall bail "attach 0-3"
3335 echo "~^attachment insert ./.treadctl=ascii";\
3336 read hl; echo $hl; call xerr "$hl" "attach 1-1"
3337 echo "~^attachment list";\
3338 read es; echo $es;call xerr "$es" "attach 1-2"
3339 call read_mline_res
3340 echo "~^attachment attribute ./.treadctl";\
3341 read es; echo $es;call xerr "$es" "attach 1-3"
3342 call read_mline_res
3343 echo "~^attachment attribute .treadctl";\
3344 read es; echo $es;call xerr "$es" "attach 1-4"
3345 call read_mline_res
3346 echo "~^attachment attribute-at 1";\
3347 read es; echo $es;call xerr "$es" "attach 1-5"
3348 call read_mline_res
3350 echo "~^attachment attribute-set ./.treadctl filename rctl";\
3351 read es; echo $es;call xerr "$es" "attach 1-6"
3352 echo "~^attachment attribute-set .treadctl content-description Au";\
3353 read es; echo $es;call xerr "$es" "attach 1-7"
3354 echo "~^attachment attribute-set-at 1 content-id <10.du@ich>";\
3355 read es; echo $es;call xerr "$es" "attach 1-8"
3357 echo "~^attachment attribute ./.treadctl";\
3358 read es; echo $es;call xerr "$es" "attach 1-9"
3359 call read_mline_res
3360 echo "~^attachment attribute .treadctl";\
3361 read es; echo $es;call xerr "$es" "attach 1-10"
3362 call read_mline_res
3363 echo "~^attachment attribute rctl";\
3364 read es; echo $es;call xerr "$es" "attach 1-11"
3365 call read_mline_res
3366 echo "~^attachment attribute-at 1";\
3367 read es; echo $es;call xerr "$es" "attach 1-12"
3368 call read_mline_res
3371 echo "~^attachment insert ./.tattach=latin1";\
3372 read hl; echo $hl; call xerr "$hl" "attach 2-1"
3373 echo "~^attachment list";\
3374 read es; echo $es;call xerr "$es" "attach 2-2"
3375 call read_mline_res
3376 echo "~^attachment attribute ./.tattach";\
3377 read es; echo $es;call xerr "$es" "attach 2-3"
3378 call read_mline_res
3379 echo "~^attachment attribute .tattach";\
3380 read es; echo $es;call xerr "$es" "attach 2-4"
3381 call read_mline_res
3382 echo "~^attachment attribute-at 2";\
3383 read es; echo $es;call xerr "$es" "attach 2-5"
3384 call read_mline_res
3386 echo "~^attachment attribute-set ./.tattach filename tat";\
3387 read es; echo $es;call xerr "$es" "attach 2-6"
3388 echo \
3389 "~^attachment attribute-set .tattach content-description Au2";\
3390 read es; echo $es;call xerr "$es" "attach 2-7"
3391 echo "~^attachment attribute-set-at 2 content-id <20.du@wir>";\
3392 read es; echo $es;call xerr "$es" "attach 2-8"
3393 echo \
3394 "~^attachment attribute-set-at 2 content-type application/x-sh";\
3395 read es; echo $es;call xerr "$es" "attach 2-9"
3397 echo "~^attachment attribute ./.tattach";\
3398 read es; echo $es;call xerr "$es" "attach 2-10"
3399 call read_mline_res
3400 echo "~^attachment attribute .tattach";\
3401 read es; echo $es;call xerr "$es" "attach 2-11"
3402 call read_mline_res
3403 echo "~^attachment attribute tat";\
3404 read es; echo $es;call xerr "$es" "attach 2-12"
3405 call read_mline_res
3406 echo "~^attachment attribute-at 2";\
3407 read es; echo $es;call xerr "$es" "attach 2-13"
3408 call read_mline_res
3411 if [ "$t_remove" == "" ]
3412 return
3415 echo "~^attachment remove ./.treadctl"; read es;\
3416 call xerr $es "attach 3-1"
3417 echo "~^attachment remove ./.tattach"; read es;\
3418 call xerr $es "attach 3-2"
3419 echo "~^ attachment remove ./.treadctl"; read es;\
3420 vput vexpr es substr $es 0 3
3421 if [ $es != 501 ]
3422 xcall bail "attach 3-3"
3424 echo "~^ attachment remove ./.tattach"; read es;\
3425 vput vexpr es substr $es 0 3
3426 if [ $es != 501 ]
3427 xcall bail "attach 3-4"
3429 echo "~^attachment list"; read es;\
3430 vput vexpr es substr $es 0 3
3431 if [ $es != 501 ]
3432 xcall bail "attach 3-5"
3436 echo "~^attachment insert ./.tattach=latin1";\
3437 read hl; echo $hl; call xerr "$hl" "attach 4-1"
3438 echo "~^attachment insert ./.tattach=latin1";\
3439 read hl; echo $hl; call xerr "$hl" "attach 4-2"
3440 echo "~^attachment list";\
3441 read es; echo $es;call xerr "$es" "attach 4-3"
3442 call read_mline_res
3443 echo "~^ attachment remove .tattach"; read es;\
3444 vput vexpr es substr $es 0 3
3445 if [ $es != 506 ]
3446 xcall bail "attach 4-4 $es"
3448 echo "~^attachment remove-at T"; read es;\
3449 vput vexpr es substr $es 0 3
3450 if [ $es != 505 ]
3451 xcall bail "attach 4-5"
3453 echo "~^attachment remove ./.tattach"; read es;\
3454 call xerr $es "attach 4-6"
3455 echo "~^attachment remove ./.tattach"; read es;\
3456 call xerr $es "attach 4-7"
3457 echo "~^ attachment remove ./.tattach"; read es;\
3458 vput vexpr es substr $es 0 3
3459 if [ $es != 501 ]
3460 xcall bail "attach 4-8 $es"
3462 echo "~^attachment list"; read es;\
3463 vput vexpr es substr $es 0 3
3464 if [ $es != 501 ]
3465 xcall bail "attach 4-9"
3469 echo "~^attachment insert ./.tattach=latin1";\
3470 read hl; echo $hl; call xerr "$hl" "attach 5-1"
3471 echo "~^attachment insert ./.tattach=latin1";\
3472 read hl; echo $hl; call xerr "$hl" "attach 5-2"
3473 echo "~^attachment insert ./.tattach=latin1";\
3474 read hl; echo $hl; call xerr "$hl" "attach 5-3"
3475 echo "~^attachment list";\
3476 read es; echo $es;call xerr "$es" "attach 5-4"
3477 call read_mline_res
3479 echo "~^attachment remove-at 3"; read es;\
3480 call xerr $es "attach 5-5"
3481 echo "~^attachment remove-at 3"; read es;\
3482 vput vexpr es substr $es 0 3
3483 if [ $es != 501 ]
3484 xcall bail "attach 5-6"
3486 echo "~^attachment remove-at 2"; read es;\
3487 call xerr $es "attach 5-7"
3488 echo "~^attachment remove-at 2"; read es;\
3489 vput vexpr es substr $es 0 3
3490 if [ $es != 501 ]
3491 xcall bail "attach 5-8"
3493 echo "~^attachment remove-at 1"; read es;\
3494 call xerr $es "attach 5-9"
3495 echo "~^attachment remove-at 1"; read es;\
3496 vput vexpr es substr $es 0 3
3497 if [ $es != 501 ]
3498 xcall bail "attach 5-10"
3501 echo "~^attachment list"; read es;\
3502 vput vexpr es substr $es 0 3
3503 if [ $es != 501 ]
3504 xcall bail "attach 5-11"
3508 echo "~^attachment insert ./.tattach=latin1";\
3509 read hl; echo $hl; call xerr "$hl" "attach 6-1"
3510 echo "~^attachment insert ./.tattach=latin1";\
3511 read hl; echo $hl; call xerr "$hl" "attach 6-2"
3512 echo "~^attachment insert ./.tattach=latin1";\
3513 read hl; echo $hl; call xerr "$hl" "attach 6-3"
3514 echo "~^attachment list";\
3515 read es; echo $es;call xerr "$es" "attach 6-4"
3516 call read_mline_res
3518 echo "~^attachment remove-at 1"; read es;\
3519 call xerr $es "attach 6-5"
3520 echo "~^attachment remove-at 1"; read es;\
3521 call xerr $es "attach 6-6"
3522 echo "~^attachment remove-at 1"; read es;\
3523 call xerr $es "attach 6-7"
3524 echo "~^attachment remove-at 1"; read es;\
3525 vput vexpr es substr $es 0 3
3526 if [ $es != 501 ]
3527 xcall bail "attach 6-8"
3530 echo "~^attachment list"; read es;\
3531 vput vexpr es substr $es 0 3
3532 if [ $es != 501 ]
3533 xcall bail "attach 6-9"
3536 echo t_attach LEAVE
3538 define t_ocs {
3539 read ver
3540 echo t_ocs
3541 call t_header
3542 call t_attach
3544 define t_oce {
3545 echo on-compose-enter, mailx-command<$mailx-command>
3546 alternates alter1@exam.ple alter2@exam.ple
3547 alternates
3548 set autocc='alter1@exam.ple alter2@exam.ple'
3549 echo mailx-from<$mailx-from> mailx-sender<$mailx-sender>
3550 echo mailx-subject<$mailx-subject>
3551 echo mailx-to<$mailx-to> mailx-cc<$mailx-cc> mailx-bcc<$mailx-bcc>
3552 echo mailx-raw-to<$mailx-raw-to> mailx-raw-cc<$mailx-raw-cc> \
3553 mailx-raw-bcc<$mailx-raw-bcc>
3554 echo mailx-orig-from<$mailx-orig-from> mailx-orig-to<$mailx-orig-to> \
3555 mailx-orig-cc<$mailx-orig-cc> mailx-orig-bcc<$mailx-orig-bcc>
3557 define t_ocl {
3558 echo on-compose-leave, mailx-command<$mailx-command>
3559 vput alternates al
3560 eval alternates $al alter3@exam.ple alter4@exam.ple
3561 alternates
3562 set autobcc='alter3@exam.ple alter4@exam.ple'
3563 echo mailx-from<$mailx-from> mailx-sender<$mailx-sender>
3564 echo mailx-subject<$mailx-subject>
3565 echo mailx-to<$mailx-to> mailx-cc<$mailx-cc> mailx-bcc<$mailx-bcc>
3566 echo mailx-raw-to<$mailx-raw-to> mailx-raw-cc<$mailx-raw-cc> \
3567 mailx-raw-bcc<$mailx-raw-bcc>
3568 echo mailx-orig-from<$mailx-orig-from> mailx-orig-to<$mailx-orig-to> \
3569 mailx-orig-cc<$mailx-orig-cc> mailx-orig-bcc<$mailx-orig-bcc>
3571 define t_occ {
3572 echo on-compose-cleanup, mailx-command<$mailx-command>
3573 unalternates *
3574 alternates
3575 echo mailx-from<$mailx-from> mailx-sender<$mailx-sender>
3576 echo mailx-subject<$mailx-subject>
3577 echo mailx-to<$mailx-to> mailx-cc<$mailx-cc> mailx-bcc<$mailx-bcc>
3578 echo mailx-raw-to<$mailx-raw-to> mailx-raw-cc<$mailx-raw-cc> \
3579 mailx-raw-bcc<$mailx-raw-bcc>
3580 echo mailx-orig-from<$mailx-orig-from> mailx-orig-to<$mailx-orig-to> \
3581 mailx-orig-cc<$mailx-orig-cc> mailx-orig-bcc<$mailx-orig-bcc>
3583 wysh set on-compose-splice=t_ocs \
3584 on-compose-enter=t_oce on-compose-leave=t_ocl \
3585 on-compose-cleanup=t_occ
3586 __EOT__
3588 ${rm} -f "${MBOX}"
3589 printf 'm this-goes@nowhere\nbody\n!.\n' |
3590 ${MAILX} ${ARGS} -Snomemdebug -Sescape=! -Sstealthmua=noagent \
3591 -X'source ./.trc' -Smta=./.tsendmail.sh \
3592 >./.tall 2>&1
3593 ${cat} ./.tall >> "${MBOX}"
3594 check behave:compose_hooks-1 0 "${MBOX}" '522535560 10101'
3596 ${rm} -f "${MBOX}"
3597 printf 'm this-goes@nowhere\nbody\n!.\n' |
3598 ${MAILX} ${ARGS} -Snomemdebug -Sescape=! -Sstealthmua=noagent \
3599 -St_remove=1 -X'source ./.trc' -Smta=./.tsendmail.sh \
3600 >./.tall 2>&1
3601 ${cat} ./.tall >> "${MBOX}"
3602 check behave:compose_hooks-2 0 "${MBOX}" '3654000499 12535'
3606 # Some state machine stress, shell compose hook, localopts for hook, etc.
3607 # readctl in child. ~r as HERE document
3608 ${rm} -f "${MBOX}"
3609 printf 'm ex@am.ple\nbody\n!.
3610 echon ${mailx-command}${mailx-subject}
3611 echon ${mailx-from}${mailx-sender}
3612 echon ${mailx-to}${mailx-cc}${mailx-bcc}
3613 echon ${mailx-raw-to}${mailx-raw-cc}${mailx-raw-bcc}
3614 echon ${mailx-orig-from}${mailx-orig-to}${mailx-orig-gcc}${mailx-orig-bcc}
3615 var t_oce t_ocs t_ocs_sh t_ocl t_occ autocc
3616 ' | ${MAILX} ${ARGS} -Snomemdebug -Sescape=! \
3617 -Smta=./.tsendmail.sh \
3619 define bail {
3620 echoerr "Failed: $1. Bailing out"; echo "~x"; xit
3622 define xerr {
3623 vput vexpr es substr "$1" 0 1
3624 if [ "$es" != 2 ]
3625 xcall bail "$2"
3628 define read_mline_res {
3629 read hl; wysh set len=$? es=$! en=$^ERRNAME;\
3630 echo $len/$es/$^ERRNAME: $hl
3631 if [ $es -ne $^ERR-NONE ]
3632 xcall bail read_mline_res
3633 elif [ $len -ne 0 ]
3634 \xcall read_mline_res
3637 define _work {
3638 vput vexpr i + 1 "$2"
3639 if [ $i -lt 111 ]
3640 vput vexpr j % $i 10
3641 if [ $j -ne 0 ]
3642 set j=xcall
3643 else
3644 echon "$i.. "
3645 set j=call
3647 eval \\$j _work $1 $i
3648 return $?
3650 vput vexpr i + $i "$1"
3651 return $i
3653 define _read {
3654 wysh set line; read line;wysh set es=$? en=$^ERRNAME ;\
3655 echo read:$es/$en: $line
3656 if [ "${es}" -ne -1 ]
3657 xcall _read
3659 readctl remove $cwd/.treadctl; echo readctl remove:$?/$^ERRNAME
3661 define t_ocs {
3662 read ver
3663 echo t_ocs
3664 echo "~^header list"; read hl; echo $hl;\
3665 vput vexpr es substr "$hl" 0 1
3666 if [ "$es" != 2 ]
3667 xcall bail "header list"
3668 endif
3670 call _work 1; echo $?
3671 echo "~^header insert cc splicy diet <splice@exam.ple> spliced";\
3672 read es; echo $es; vput vexpr es substr "$es" 0 1
3673 if [ "$es" != 2 ]
3674 xcall bail "be diet"
3675 endif
3676 echo "~^header insert cc <splice2@exam.ple>";\
3677 read es; echo $es; vput vexpr es substr "$es" 0 1
3678 if [ "$es" != 2 ]
3679 xcall bail "be diet2"
3680 endif
3682 call _work 2; echo $?
3683 echo "~^header insert bcc juicy juice <juice@exam.ple> spliced";\
3684 read es; echo $es;vput vexpr es substr "$es" 0 1
3685 if [ "$es" != 2 ]
3686 xcall bail "be juicy"
3687 endif
3688 echo "~^header insert bcc juice2@exam.ple";\
3689 read es; echo $es;vput vexpr es substr "$es" 0 1
3690 if [ "$es" != 2 ]
3691 xcall bail "be juicy2"
3692 endif
3693 echo "~^header insert bcc juice3 <juice3@exam.ple>";\
3694 read es; echo $es;vput vexpr es substr "$es" 0 1
3695 if [ "$es" != 2 ]
3696 xcall bail "be juicy3"
3697 endif
3698 echo "~^header insert bcc juice4@exam.ple";\
3699 read es; echo $es;vput vexpr es substr "$es" 0 1
3700 if [ "$es" != 2 ]
3701 xcall bail "be juicy4"
3702 endif
3704 echo "~^header remove-at bcc 3";\
3705 read es; echo $es;vput vexpr es substr "$es" 0 1
3706 if [ "$es" != 2 ]
3707 xcall bail "remove juicy5"
3708 endif
3709 echo "~^header remove-at bcc 2";\
3710 read es; echo $es;vput vexpr es substr "$es" 0 1
3711 if [ "$es" != 2 ]
3712 xcall bail "remove juicy6"
3713 endif
3714 echo "~^header remove-at bcc 3";\
3715 read es; echo $es;vput vexpr es substr "$es" 0 3
3716 if [ "$es" != 501 ]
3717 xcall bail "failed to remove-at"
3718 endif
3719 # Add duplicates which ought to be removed!
3720 echo "~^header insert bcc juice4@exam.ple";\
3721 read es; echo $es;vput vexpr es substr "$es" 0 1
3722 if [ "$es" != 2 ]
3723 xcall bail "be juicy4-1"
3724 endif
3725 echo "~^header insert bcc juice4@exam.ple";\
3726 read es; echo $es;vput vexpr es substr "$es" 0 1
3727 if [ "$es" != 2 ]
3728 xcall bail "be juicy4-2"
3729 endif
3730 echo "~^header insert bcc juice4@exam.ple";\
3731 read es; echo $es;vput vexpr es substr "$es" 0 1
3732 if [ "$es" != 2 ]
3733 xcall bail "be juicy4-3"
3734 endif
3735 echo "~:set t_ocs"
3738 call _work 3; echo $?
3739 echo "~r - '__EOT'"
3740 vput ! i echo just knock if you can hear me;\
3741 i=0;\
3742 while [ $i -lt 24 ]; do printf "%s " $i; i=`expr $i + 1`; done;\
3743 echo relax
3744 echon shell-cmd says $?/$^ERRNAME: $i
3745 echo "~x will not become interpreted, we are reading until __EOT"
3746 echo "__EOT"
3747 read r_status; echo "~~r status output: $r_status"
3748 echo "~:echo $? $! $^ERRNAME"
3749 read r_status
3750 echo "~~r status from parent: $r_status"
3753 call _work 4; echo $?
3754 vput cwd cwd;echo cwd:$?
3755 readctl create $cwd/.treadctl ;echo readctl:$?/$^ERRNAME;\
3756 call _read
3759 call _work 5; echo $?
3760 echo "~^header show MAILX-Command"; read es;\
3761 call xerr $es "t_header 1000"; call read_mline_res
3762 echo "~^header show MAILX-raw-TO"; read es;\
3763 call xerr $es "t_header 1001"; xcall read_mline_res
3765 echoerr IT IS WRONG IF YOU SEE THIS
3767 define t_oce {
3768 echo on-compose-enter, mailx-command<$mailx-command>
3769 set t_oce autobcc=oce@exam.ple
3770 alternates alter1@exam.ple alter2@exam.ple
3771 alternates
3772 echo mailx-from<$mailx-from> mailx-sender<$mailx-sender>
3773 echo mailx-subject<$mailx-subject>
3774 echo mailx-to<$mailx-to> mailx-cc<$mailx-cc> mailx-bcc<$mailx-bcc>
3775 echo mailx-raw-to<$mailx-raw-to> mailx-raw-cc<$mailx-raw-cc> \
3776 mailx-raw-bcc<$mailx-raw-bcc>
3777 echo mailx-orig-from<$mailx-orig-from> \
3778 mailx-orig-to<$mailx-orig-to> \
3779 mailx-orig-cc<$mailx-orig-cc> mailx-orig-bcc<$mailx-orig-bcc>
3781 define t_ocl {
3782 echo on-compose-leave, mailx-command<$mailx-command>
3783 set t_ocl autocc=ocl@exam.ple
3784 unalternates *
3785 alternates alter3@exam.ple alter4@exam.ple
3786 alternates
3787 echo mailx-from<$mailx-from> mailx-sender<$mailx-sender>
3788 echo mailx-subject<$mailx-subject>
3789 echo mailx-to<$mailx-to> mailx-cc<$mailx-cc> mailx-bcc<$mailx-bcc>
3790 echo mailx-raw-to<$mailx-raw-to> mailx-raw-cc<$mailx-raw-cc> \
3791 mailx-raw-bcc<$mailx-raw-bcc>
3792 echo mailx-orig-from<$mailx-orig-from> \
3793 mailx-orig-to<$mailx-orig-to> \
3794 mailx-orig-cc<$mailx-orig-cc> mailx-orig-bcc<$mailx-orig-bcc>
3796 define t_occ {
3797 echo on-compose-cleanup, mailx-command<$mailx-command>
3798 set t_occ autocc=occ@exam.ple
3799 unalternates *
3800 alternates
3801 echo mailx-from<$mailx-from> mailx-sender<$mailx-sender>
3802 echo mailx-subject<$mailx-subject>
3803 echo mailx-to<$mailx-to> mailx-cc<$mailx-cc> mailx-bcc<$mailx-bcc>
3804 echo mailx-raw-to<$mailx-raw-to> mailx-raw-cc<$mailx-raw-cc> \
3805 mailx-raw-bcc<$mailx-raw-bcc>
3806 echo mailx-orig-from<$mailx-orig-from> \
3807 mailx-orig-to<$mailx-orig-to> \
3808 mailx-orig-cc<$mailx-orig-cc> mailx-orig-bcc<$mailx-orig-bcc>
3810 wysh set on-compose-splice=t_ocs \
3811 on-compose-splice-shell="read ver;printf \"t_ocs-shell\\n\
3812 ~t shell@exam.ple\\n~:set t_ocs_sh\\n\"" \
3813 on-compose-enter=t_oce on-compose-leave=t_ocl \
3814 on-compose-cleanup=t_occ
3815 ' > ./.tnotes 2>&1
3816 ex0_test behave:compose_hooks-3-estat
3817 ${cat} ./.tnotes >> "${MBOX}"
3819 check behave:compose_hooks-3 - "${MBOX}" '679526364 2431'
3821 # Reply, forward, resend, Resend
3823 ${rm} -f "${MBOX}"
3824 printf 'set from=f1@z\nm t1@z\nb1\n!.\nset from=f2@z\nm t2@z\nb2\n!.\n' |
3825 ${MAILX} ${ARGS} -Snomemdebug -Sescape=! \
3826 -Smta=./.tsendmail.sh
3828 printf '
3829 echo start: $? $! $^ERRNAME
3830 File %s
3831 echo File: $? $! $^ERRNAME;echo;echo
3832 reply 1
3833 this is content of reply 1
3835 echo reply 1: $? $! $^ERRNAME;echo;echo
3836 Reply 1 2
3837 this is content of Reply 1 2
3839 echo Reply 1 2: $? $! $^ERRNAME;echo;echo
3840 forward 1 fwdex@am.ple
3841 this is content of forward 1
3843 echo forward 1: $? $! $^ERRNAME;echo;echo
3844 resend 1 2 resendex@am.ple
3845 echo resend 1 2: $? $! $^ERRNAME;echo;echo
3846 Resend 1 2 Resendex@am.ple
3847 echo Resend 1 2: $? $! $^ERRNAME;echo;echo
3848 ' "${MBOX}" |
3849 ${MAILX} ${ARGS} -Snomemdebug -Sescape=! \
3850 -Smta=./.tsendmail.sh \
3852 define bail {
3853 echoerr "Failed: $1. Bailing out"; echo "~x"; xit
3855 define xerr {
3856 vput vexpr es substr "$1" 0 1
3857 if [ "$es" != 2 ]
3858 xcall bail "$2"
3861 define read_mline_res {
3862 read hl; wysh set len=$? es=$! en=$^ERRNAME;\
3863 echo mline_res:$len/$es/$^ERRNAME: $hl
3864 if [ $es -ne $^ERR-NONE ]
3865 xcall bail read_mline_res
3866 elif [ $len -ne 0 ]
3867 \xcall read_mline_res
3870 define work_hl {
3871 echo "~^header show $1"; read es;\
3872 call xerr $es "work_hl $1"; echo $1; call read_mline_res
3873 if [ $# -gt 1 ]
3874 shift
3875 xcall work_hl "$@"
3878 define t_ocs {
3879 read ver
3880 echo t_ocs version $ver
3881 echo "~^header list"; read hl; echo $hl;\
3882 echoerr the header list is $hl;\
3883 call xerr "$hl" "header list"
3884 eval vpospar set $hl
3885 shift
3886 xcall work_hl "$@"
3887 echoerr IT IS WRONG IF YOU SEE THIS
3889 define t_oce {
3890 echo on-XY-enter, mailx-command<$mailx-command>
3891 set t_oce autobcc=oce@exam.ple
3892 echo mailx-from<$mailx-from> mailx-sender<$mailx-sender>
3893 echo mailx-subject<$mailx-subject>
3894 echo mailx-to<$mailx-to> mailx-cc<$mailx-cc> mailx-bcc<$mailx-bcc>
3895 echo mailx-raw-to<$mailx-raw-to> mailx-raw-cc<$mailx-raw-cc> \
3896 mailx-raw-bcc<$mailx-raw-bcc>
3897 echo mailx-orig-from<$mailx-orig-from> \
3898 mailx-orig-to<$mailx-orig-to> \
3899 mailx-orig-cc<$mailx-orig-cc> mailx-orig-bcc<$mailx-orig-bcc>
3901 define t_ocl {
3902 echo on-XY-leave, mailx-command<$mailx-command>
3903 set t_ocl autocc=ocl@exam.ple
3904 echo mailx-from<$mailx-from> mailx-sender<$mailx-sender>
3905 echo mailx-subject<$mailx-subject>
3906 echo mailx-to<$mailx-to> mailx-cc<$mailx-cc> mailx-bcc<$mailx-bcc>
3907 echo mailx-raw-to<$mailx-raw-to> mailx-raw-cc<$mailx-raw-cc> \
3908 mailx-raw-bcc<$mailx-raw-bcc>
3909 echo mailx-orig-from<$mailx-orig-from> \
3910 mailx-orig-to<$mailx-orig-to> \
3911 mailx-orig-cc<$mailx-orig-cc> mailx-orig-bcc<$mailx-orig-bcc>
3913 define t_occ {
3914 echo on-XY-cleanup, mailx-command<$mailx-command>
3915 set t_occ autocc=occ@exam.ple
3916 echo mailx-from<$mailx-from> mailx-sender<$mailx-sender>
3917 echo mailx-subject<$mailx-subject>
3918 echo mailx-to<$mailx-to> mailx-cc<$mailx-cc> mailx-bcc<$mailx-bcc>
3919 echo mailx-raw-to<$mailx-raw-to> mailx-raw-cc<$mailx-raw-cc> \
3920 mailx-raw-bcc<$mailx-raw-bcc>
3921 echo mailx-orig-from<$mailx-orig-from> \
3922 mailx-orig-to<$mailx-orig-to> \
3923 mailx-orig-cc<$mailx-orig-cc> mailx-orig-bcc<$mailx-orig-bcc>
3925 wysh set on-compose-splice=t_ocs \
3926 on-compose-enter=t_oce on-compose-leave=t_ocl \
3927 on-compose-cleanup=t_occ \
3928 on-resend-enter=t_oce on-resend-cleanup=t_occ
3929 ' > ./.tnotes 2>&1
3930 ex0_test behave:compose_hooks-4-estat
3931 ${cat} ./.tnotes >> "${MBOX}"
3933 check behave:compose_hooks-4 - "${MBOX}" '3038884027 7516'
3935 t_epilog
3938 t_behave_C_opt_customhdr() {
3939 t_prolog t_behave_C_opt_customhdr
3940 TRAP_EXIT_ADDONS="./.t*"
3942 ${cat} <<-_EOT > ./.tsendmail.sh
3943 #!${SHELL} -
3944 (echo 'From CimicifugaRacemosa Mon Dec 25 21:33:40 2017' &&
3945 ${cat} && echo
3946 ) >> "${MBOX}"
3947 _EOT
3948 chmod 0755 ./.tsendmail.sh
3950 echo bla |
3951 ${MAILX} ${ARGS} -Smta=./.tsendmail.sh \
3952 -C 'C-One : Custom One Body' \
3953 -C 'C-Two:CustomTwoBody' \
3954 -S customhdr='chdr1: chdr1 body, chdr2:chdr2 body' \
3955 this-goes@nowhere >./.tall 2>&1
3956 ex0_test behave:C_opt_customhdr-1-estat
3957 ${cat} ./.tall >> "${MBOX}"
3958 check behave:C_opt_customhdr-1 0 "${MBOX}" '2400078426 195'
3960 ${rm} -f "${MBOX}"
3961 printf 'm this-goes@nowhere\nbody\n!.
3962 unset customhdr
3963 m this-goes2@nowhere\nbody2\n!.
3964 set customhdr=%ccustom1 : custom1 body%c
3965 m this-goes2@nowhere\nbody2\n!.
3966 set customhdr=%ccustom1 : custom1\\, body , custom2: custom2 body%c
3967 m this-goes3@nowhere\nbody3\n!.
3968 ' "'" "'" "'" "'" |
3969 ${MAILX} ${ARGS} -Smta=./.tsendmail.sh -Sescape=! \
3970 -C 'C-One : Custom One Body' \
3971 -C 'C-Two:CustomTwoBody' \
3972 -S customhdr='chdr1: chdr1 body, chdr2:chdr2 body' \
3973 >./.tall 2>&1
3974 ex0_test behave:C_opt_customhdr-2-estat
3975 ${cat} ./.tall >> "${MBOX}"
3976 check behave:C_opt_customhdr-2 0 "${MBOX}" '3546878678 752'
3978 t_epilog
3981 t_behave_mass_recipients() {
3982 t_prolog t_behave_mass_recipients
3983 TRAP_EXIT_ADDONS="./.t*"
3985 ${cat} <<-_EOT > ./.tsendmail.sh
3986 #!${SHELL} -
3987 (echo 'From Eucalyptus Sat Jul 08 21:14:57 2017' && ${cat} && echo
3988 ) >> "${MBOX}"
3989 _EOT
3990 chmod 0755 ./.tsendmail.sh
3992 ${cat} <<'__EOT__' > ./.trc
3993 define bail {
3994 echoerr "Failed: $1. Bailing out"; echo "~x"; xit
3996 define ins_addr {
3997 wysh set nr=$1 hn=$2
3998 echo "~$hn $hn$nr@$hn"; echo '~:echo $?'; read es
3999 if [ "$es" -ne 0 ]
4000 xcall bail "ins_addr $hn 1-$nr"
4002 vput vexpr nr + $nr 1
4003 if [ "$nr" -le "$maximum" ]
4004 xcall ins_addr $nr $hn
4007 define bld_alter {
4008 wysh set nr=$1 hn=$2
4009 alternates $hn$nr@$hn
4010 vput vexpr nr + $nr 2
4011 if [ "$nr" -le "$maximum" ]
4012 xcall bld_alter $nr $hn
4015 define t_ocs {
4016 read ver
4017 call ins_addr 1 t
4018 call ins_addr 1 c
4019 call ins_addr 1 b
4021 define t_ocl {
4022 if [ "$t_remove" != '' ]
4023 call bld_alter 1 t
4024 call bld_alter 2 c
4027 set on-compose-splice=t_ocs on-compose-leave=t_ocl
4028 __EOT__
4030 printf 'm this-goes@nowhere\nbody\n!.\n' |
4031 ${MAILX} ${ARGS} -Snomemdebug -Sescape=! -Sstealthmua=noagent \
4032 -X'source ./.trc' -Smta=./.tsendmail.sh -Smaximum=2001 \
4033 >./.tall 2>&1
4034 ex0_test behave:mass_recipients-1-estat
4035 ${cat} ./.tall >> "${MBOX}"
4036 check behave:mass_recipients-1 - "${MBOX}" '2912243346 51526'
4038 ${rm} -f "${MBOX}"
4039 printf 'm this-goes@nowhere\nbody\n!.\n' |
4040 ${MAILX} ${ARGS} -Snomemdebug -Sescape=! -Sstealthmua=noagent \
4041 -St_remove=1 -X'source ./.trc' -Smta=./.tsendmail.sh -Smaximum=2001 \
4042 >./.tall 2>&1
4043 ex0_test behave:mass_recipients-2-estat
4044 ${cat} ./.tall >> "${MBOX}"
4045 check behave:mass_recipients-2 - "${MBOX}" '4097804632 34394'
4047 t_epilog
4050 t_behave_mime_types_load_control() {
4051 t_prolog t_behave_mime_types_load_control
4052 TRAP_EXIT_ADDONS="./.t*"
4054 ${cat} <<-_EOT > ./.tmts1
4055 @ application/mathml+xml mathml
4056 _EOT
4057 ${cat} <<-_EOT > ./.tmts2
4058 @ x-conference/x-cooltalk ice
4059 @ aga-aga aga
4060 @ application/aga-aga aga
4061 _EOT
4063 ${cat} <<-_EOT > ./.tmts1.mathml
4064 <head>nonsense ML</head>
4065 _EOT
4066 ${cat} <<-_EOT > ./.tmts2.ice
4067 Icy, icy road.
4068 _EOT
4069 printf 'of which the c\x01rack is coming soon' > ./.tmtsx.doom
4070 printf 'of which the c\x01rack is coming soon' > ./.tmtsx.aga
4072 printf '
4073 m %s
4074 Schub-di-du
4075 ~@ ./.tmts1.mathml
4076 ~@ ./.tmts2.ice
4077 ~@ ./.tmtsx.doom
4078 ~@ ./.tmtsx.aga
4080 File %s
4081 from*
4082 type
4084 ' "${MBOX}" "${MBOX}" |
4085 ${MAILX} ${ARGS} \
4086 -Smimetypes-load-control=f=./.tmts1,f=./.tmts2 \
4087 > ./.tout 2>&1
4088 ex0_test behave:mime_types_load_control-1-estat
4089 ${cat} "${MBOX}" >> ./.tout
4090 check behave:mime_types_load_control-1 - ./.tout '1441260727 2449'
4092 echo type | ${MAILX} ${ARGS} -R \
4093 -Smimetypes-load-control=f=./.tmts1,f=./.tmts3 \
4094 -f "${MBOX}" >> ./.tout 2>&1
4095 check behave:mime_types_load_control-2 0 ./.tout '1441391438 3646'
4097 t_epilog
4100 t_behave_lreply_futh_rth_etc() {
4101 t_prolog t_behave_lreply_futh_rth_etc
4102 TRAP_EXIT_ADDONS="./.t*"
4104 ${cat} <<-_EOT > ./.tsendmail.sh
4105 #!${SHELL} -
4106 (echo 'From HumulusLupulus Thu Jul 27 14:41:20 2017' && ${cat} && echo
4107 ) >> "${MBOX}"
4108 _EOT
4109 chmod 0755 ./.tsendmail.sh
4111 ${cat} <<-_EOT > ./.tmbox
4112 From neverneverland Sun Jul 23 13:46:25 2017
4113 Subject: Bugstop: five miles out 1
4114 Reply-To: mister originator2 <mr2@originator>, bugstop@five.miles.out
4115 From: mister originator <mr@originator>
4116 To: bugstop-commit@five.miles.out, laber@backe.eu
4117 Cc: is@a.list
4118 Mail-Followup-To: bugstop@five.miles.out, laber@backe.eu, is@a.list
4119 In-reply-to: <20170719111113.bkcMz%laber@backe.eu>
4120 Date: Wed, 19 Jul 2017 09:22:57 -0400
4121 Message-Id: <20170719132257.766AF781267@originator>
4122 Status: RO
4124 > |Sorry, I think I misunderstand something. I would think that
4126 That's appalling.
4128 From neverneverland Fri Jul 7 22:39:11 2017
4129 Subject: Bugstop: five miles out 2
4130 Reply-To: mister originator2<mr2@originator>,bugstop@five.miles.out,is@a.list
4131 Content-Transfer-Encoding: 7bit
4132 From: mister originator <mr@originator>
4133 To: bugstop-commit@five.miles.out
4134 Cc: is@a.list
4135 Message-ID: <149945963975.28888.6950788126957753723.reportbug@five.miles.out>
4136 Date: Fri, 07 Jul 2017 16:33:59 -0400
4137 Status: R
4139 capable of changing back.
4141 From neverneverland Fri Jul 7 22:42:00 2017
4142 Subject: Bugstop: five miles out 3
4143 Reply-To: mister originator2 <mr2@originator>, bugstop@five.miles.out
4144 Content-Transfer-Encoding: 7bit
4145 From: mister originator <mr@originator>
4146 To: bugstop-commit@five.miles.out
4147 Cc: is@a.list
4148 Message-ID: <149945963975.28888.6950788126957753746.reportbug@five.miles.out>
4149 Date: Fri, 07 Jul 2017 16:33:59 -0400
4150 List-Post: <mailto:bugstop@five.miles.out>
4151 Status: R
4153 are you ready, boots?
4155 From neverneverland Sat Aug 19 23:15:00 2017
4156 Subject: Bugstop: five miles out 4
4157 Reply-To: mister originator2 <mr2@originator>, bugstop@five.miles.out
4158 Content-Transfer-Encoding: 7bit
4159 From: mister originator <mr@originator>
4160 To: bugstop@five.miles.out
4161 Cc: is@a.list
4162 Message-ID: <149945963975.28888.6950788126qtewrqwer.reportbug@five.miles.out>
4163 Date: Fri, 07 Jul 2017 16:33:59 -0400
4164 List-Post: <mailto:bugstop@five.miles.out>
4165 Status: R
4167 are you ready, boots?
4168 _EOT
4172 ${cat} <<-'_EOT' | ${MAILX} ${ARGS} -Sescape=! -Smta=./.tsendmail.sh \
4173 -Rf ./.tmbox >> "${MBOX}" 2>&1
4174 define r {
4175 wysh set m="This is text of \"reply ${1}."
4176 reply 1 2 3
4177 !I m
4180 !I m
4183 !I m
4186 echo -----After reply $1.1 - $1.3: $?/$^ERRNAME
4188 define R {
4189 wysh set m="This is text of \"Reply ${1}."
4190 eval Reply $2
4191 !I m
4192 !I 2
4195 echo -----After Reply $1.$2: $?/$^ERRNAME
4197 define _Lh {
4198 read protover
4199 echo '~I m'
4200 echo '~I n'
4201 echo '".'
4203 define _Ls {
4204 wysh set m="This is text of \"Lreply ${1}." on-compose-splice=_Lh n=$2
4205 eval Lreply $2
4207 define L {
4208 # We need two indirections for this test: one for the case that Lreply
4209 # fails because of missing recipients: we need to read EOF next, thus
4210 # place this in _Ls last; and second for the succeeding cases EOF is
4211 # not what these should read, so go over the backside and splice it in!
4212 call _Ls "$@"
4213 echo -----After Lreply $1.$2: $?/$^ERRNAME
4215 define x {
4216 localopts call-fixate yes
4217 call r $1
4218 call R $1 1; call R $1 2; call R $1 3; call R $1 4
4219 call L $1 1; call L $1 2; call L $1 3
4221 define tweak {
4222 echo;echo '===== CHANGING === '"$*"' =====';echo
4223 eval "$@"
4226 set from=laber@backe.eu
4227 mlist is@a.list
4228 call x 1
4229 call tweak set reply-to-honour
4230 call x 2
4231 call tweak set followup-to
4232 call x 3
4233 call tweak set followup-to-honour
4234 call x 4
4235 call tweak mlist bugstop@five.miles.out
4236 call x 5
4237 call tweak mlsubscribe bugstop@five.miles.out
4238 call x 6
4239 call tweak set recipients-in-cc
4240 call x 7
4241 _EOT
4243 check behave:lreply_futh_rth_etc-1 0 "${MBOX}" '940818845 29373'
4247 ${cat} <<-_EOT > ./.tmbox
4248 From tom@i-i.example Thu Oct 26 03:15:55 2017
4249 Date: Wed, 25 Oct 2017 21:15:46 -0400
4250 From: tom <tom@i-i.example>
4251 To: Steffen Nurpmeso <steffen@sdaoden.eu>
4252 Cc: tom <tom@i-i.example>
4253 Subject: Re: xxxx yyyyyyyy configure does not really like a missing zzzzz
4254 Message-ID: <20171026011546.GA11643@i-i.example>
4255 Reply-To: tom@i-i.example
4256 References: <20171025214601.T2pNd%steffen@sdaoden.eu>
4257 In-Reply-To: <20171025214601.T2pNd%steffen@sdaoden.eu>
4258 Status: R
4260 The report's useful :-)
4261 _EOT
4263 printf 'reply 1\nthank you\n!.\n' |
4264 ${MAILX} ${ARGS} -Sescape=! -Smta=./.tsendmail.sh -Sreply-to-honour \
4265 -Rf ./.tmbox > "${MBOX}" 2>&1
4266 check behave:lreply_futh_rth_etc-2 0 "${MBOX}" '1045866991 331'
4268 t_epilog
4271 t_behave_xxxheads_rfc2047() {
4272 t_prolog t_behave_xxxheads_rfc2047
4273 TRAP_EXIT_ADDONS="./.t*"
4275 ${cat} <<-_EOT > ./.tsendmail.sh
4276 #!${SHELL} -
4277 (echo 'From GentianaLutea Mon Dec 04 17:15:29 2017' && ${cat} &&
4278 echo) >> "${MBOX}"
4279 _EOT
4280 chmod 0755 ./.tsendmail.sh
4283 ${rm} -f "${MBOX}"
4284 echo | ${MAILX} ${ARGS} ${ADDARG_UNI} \
4285 -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̲' \
4286 "${MBOX}"
4287 check behave:xxxheads_rfc2047-1 0 "${MBOX}" '3370931614 375'
4289 # Single word (overlong line split -- bad standard! Requires injection of
4290 # artificial data!! But can be prevented by using RFC 2047 encoding)
4291 ${rm} -f "${MBOX}"
4292 i=`${awk} 'BEGIN{for(i=0; i<92; ++i) printf "0123456789_"}'`
4293 echo | ${MAILX} ${ARGS} -s "${i}" "${MBOX}"
4294 check behave:xxxheads_rfc2047-2 0 "${MBOX}" '489922370 1718'
4296 # Combination of encoded words, space and tabs of varying sort
4297 ${rm} -f "${MBOX}"
4298 echo | ${MAILX} ${ARGS} ${ADDARG_UNI} \
4299 -s "1Abrä Kaspas1 2Abra Katä b_kaspas2 \
4300 3Abrä Kaspas3 4Abrä Kaspas4 5Abrä Kaspas5 \
4301 6Abra Kaspas6 7Abrä Kaspas7 8Abra Kaspas8 \
4302 9Abra Kaspastäb4-3 10Abra Kaspas1 _ 11Abra Katäb1 \
4303 12Abra Kadabrä1 After Tab after Täb this is NUTS" \
4304 "${MBOX}"
4305 check behave:xxxheads_rfc2047-3 0 "${MBOX}" '1676887734 591'
4307 # Overlong multibyte sequence that must be forcefully split
4308 # todo This works even before v15.0, but only by accident
4309 ${rm} -f "${MBOX}"
4310 echo | ${MAILX} ${ARGS} ${ADDARG_UNI} \
4311 -s "✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄\
4312 ✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄\
4313 ✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄" \
4314 "${MBOX}"
4315 check behave:xxxheads_rfc2047-4 0 "${MBOX}" '3029301775 659'
4317 # Trailing WS
4318 ${rm} -f "${MBOX}"
4319 echo | ${MAILX} ${ARGS} \
4320 -s "1-1 B2 B3 B4 B5 B6 B\
4321 1-2 B2 B3 B4 B5 B6 B\
4322 1-3 B2 B3 B4 B5 B6 B\
4323 1-4 B2 B3 B4 B5 B6 B\
4324 1-5 B2 B3 B4 B5 B6 B\
4325 1-6 B2 B3 B4 B5 B6 " \
4326 "${MBOX}"
4327 check behave:xxxheads_rfc2047-5 0 "${MBOX}" '4126167195 297'
4329 # Leading and trailing WS
4330 ${rm} -f "${MBOX}"
4331 echo | ${MAILX} ${ARGS} \
4332 -s " 2-1 B2 B3 B4 B5 B6 B\
4333 1-2 B2 B3 B4 B5 B6 B\
4334 1-3 B2 B3 B4 B5 B6 B\
4335 1-4 B2 B3 B4 B5 B6 " \
4336 "${MBOX}"
4337 check behave:xxxheads_rfc2047-6 0 "${MBOX}" '3600624479 236'
4339 # RFC 2047 in an address field! (Missing test caused v14.9.6!)
4340 ${rm} -f "${MBOX}"
4341 echo "Dat Früchtchen riecht häußlich" |
4342 ${MAILX} ${ARGS} ${ADDARG_UNI} -Sfullnames -Smta=./.tsendmail.sh \
4343 -s Hühöttchen \
4344 'Schnödes "Früchtchen" <do@du> (Hä!)'
4345 check behave:xxxheads_rfc2047-7 0 "${MBOX}" '800505986 368'
4347 t_epilog
4350 t_behave_rfc2231() {
4351 t_prolog t_behave_rfc2231
4352 TRAP_EXIT_ADDONS="./.t*"
4355 mkdir ./.ttt || exit 1
4356 cd ./.ttt || exit 2
4357 : > "ma'ger.txt"
4358 : > "mä'ger.txt"
4359 : > 'diet\ is \curd.txt'
4360 : > 'diet "is" curd.txt'
4361 : > höde-tröge.txt
4362 : > 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
4363 : > höde__tröge__müde__dätte__hätte__vuelle__guelle__aese__aesse__sauerliche__kräuter__österliche__grüße__mäh.txt
4364 : > hööööööööööööööööö_nöööööööööööööööööööööö_düüüüüüüüüüüüüüüüüüü_bäääääääääääääääääääääääh.txt
4365 : > ✆✆✆✆✆✆✆✆✆✆✆✆✆✆✆✆✆✆✆✆✆✆✆✆.txt
4367 echo bla | ${MAILX} ${ARGS} ${ADDARG_UNI} \
4368 -a "./.ttt/ma'ger.txt" -a "./.ttt/mä'ger.txt" \
4369 -a './.ttt/diet\ is \curd.txt' -a './.ttt/diet "is" curd.txt' \
4370 -a ./.ttt/höde-tröge.txt \
4371 -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 \
4372 -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 \
4373 -a ./.ttt/hööööööööööööööööö_nöööööööööööööööööööööö_düüüüüüüüüüüüüüüüüüü_bäääääääääääääääääääääääh.txt \
4374 -a ./.ttt/✆✆✆✆✆✆✆✆✆✆✆✆✆✆✆✆✆✆✆✆✆✆✆✆.txt \
4375 "${MBOX}"
4376 check behave:rfc2231-1 0 "${MBOX}" '684985954 3092'
4378 # `resend' test, reusing $MBOX
4379 printf "Resend ./.t2\nx\n" | ${MAILX} ${ARGS} -Rf "${MBOX}"
4380 check behave:rfc2231-2 0 ./.t2 '684985954 3092'
4382 printf "resend ./.t3\nx\n" | ${MAILX} ${ARGS} -Rf "${MBOX}"
4383 check behave:rfc2231-3 0 ./.t3 '3130352658 3148'
4385 t_epilog
4388 t_behave_iconv_mbyte_base64() {
4389 t_prolog t_behave_iconv_mbyte_base64
4390 TRAP_EXIT_ADDONS="./.t*"
4392 if [ -n "${UTF8_LOCALE}" ] && have_feat iconv &&
4393 (</dev/null iconv -f ascii -t iso-2022-jp) >/dev/null 2>&1 ||
4394 (</dev/null iconv -f ascii -t euc-jp) >/dev/null 2>&1; then
4396 else
4397 echo 'behave:iconv_mbyte_base64: unsupported, skipped'
4398 return
4401 ${cat} <<-_EOT > ./.tsendmail.sh
4402 #!${SHELL} -
4403 (echo 'From DroseriaRotundifolia Thu Aug 03 17:26:25 2017' && ${cat} &&
4404 echo) >> "${MBOX}"
4405 _EOT
4406 chmod 0755 ./.tsendmail.sh
4408 if (</dev/null iconv -f ascii -t iso-2022-jp) >/dev/null 2>&1; then
4409 cat <<-'_EOT' | LC_ALL=${UTF8_LOCALE} ${MAILX} ${ARGS} \
4410 -Smta=./.tsendmail.sh \
4411 -Sescape=! -Smime-encoding=base64 2>./.terr
4412 set ttycharset=utf-8 sendcharsets=iso-2022-jp
4413 m t1@exam.ple
4414 !s Japanese from UTF-8 to ISO-2022-JP
4415 シジュウカラ科(シジュウカラか、学名 Paridae)は、鳥類スズメ目の科である。シジュウカラ(四十雀)と総称されるが、狭義にはこの1種をシジュウカラと呼ぶ。
4417 カンムリガラ(学名Parus cristatus)は、スズメ目シジュウカラ科に分類される鳥類の一種。
4420 カンムリガラ(学名Parus cristatus)は、スズメ目シジュウカラ科に分類される鳥類の一種。
4422 シジュウカラ科(シジュウカラか、学名 Paridae)は、鳥類スズメ目の科である。シジュウカラ(四十雀)と総称されるが、狭義にはこの1種をシジュウカラと呼ぶ。
4425 set ttycharset=iso-2022-jp charset-7bit=iso-2022-jp sendcharsets=utf-8
4426 m t2@exam.ple
4427 !s Japanese from ISO-2022-JP to UTF-8, eh, no, also ISO-2022-JP
4428 \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
4430 \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
4433 \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
4435 \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
4437 _EOT
4438 check behave:iconv_mbyte_base64-1 0 "${MBOX}" '3428985079 1976'
4439 check behave:iconv_mbyte_base64-2 - ./.terr '4294967295 0'
4441 printf 'eval f 1; write ./.twrite\n' |
4442 ${MAILX} ${ARGS} ${ADDARG_UNI} -Rf "${MBOX}" >./.tlog 2>&1
4443 check behave:iconv_mbyte_base64-3 0 ./.twrite '1259742080 686'
4444 check behave:iconv_mbyte_base64-4 - ./.tlog '3956097665 119'
4445 else
4446 echo 'behave:iconv_mbyte_base64: ISO-2022-JP unsupported, skipping 1-4'
4449 if (</dev/null iconv -f ascii -t euc-jp) >/dev/null 2>&1; then
4450 rm -f "${MBOX}" ./.twrite
4451 cat <<-'_EOT' | LC_ALL=${UTF8_LOCALE} ${MAILX} ${ARGS} \
4452 -Smta=./.tsendmail.sh \
4453 -Sescape=! -Smime-encoding=base64 2>./.terr
4454 set ttycharset=utf-8 sendcharsets=euc-jp
4455 m t1@exam.ple
4456 !s Japanese from UTF-8 to EUC-JP
4457 シジュウカラ科(シジュウカラか、学名 Paridae)は、鳥類スズメ目の科である。シジュウカラ(四十雀)と総称されるが、狭義にはこの1種をシジュウカラと呼ぶ。
4459 カンムリガラ(学名Parus cristatus)は、スズメ目シジュウカラ科に分類される鳥類の一種。
4462 カンムリガラ(学名Parus cristatus)は、スズメ目シジュウカラ科に分類される鳥類の一種。
4464 シジュウカラ科(シジュウカラか、学名 Paridae)は、鳥類スズメ目の科である。シジュウカラ(四十雀)と総称されるが、狭義にはこの1種をシジュウカラと呼ぶ。
4467 set ttycharset=EUC-JP sendcharsets=utf-8
4468 m t2@exam.ple
4469 !s Japanese from EUC-JP to UTF-8
4470 ¥·¥¸¥å¥¦¥«¥é²Ê¡Ê¥·¥¸¥å¥¦¥«¥é¤«¡¢³Ø̾ Paridae¡Ë¤Ï¡¢Ä»Îॹ¥º¥áÌܤβʤǤ¢¤ë¡£¥·¥¸¥å¥¦¥«¥é¡Ê»Í½½¿ý¡Ë¤ÈÁí¾Î¤µ¤ì¤ë¤¬¡¢¶¹µÁ¤Ë¤Ï¤³¤Î1¼ï¤ò¥·¥¸¥å¥¦¥«¥é¤È¸Æ¤Ö¡£
4472 ¥«¥ó¥à¥ê¥¬¥é¡Ê³Ø̾Parus cristatus¡Ë¤Ï¡¢¥¹¥º¥áÌÜ¥·¥¸¥å¥¦¥«¥é²Ê¤ËʬÎव¤ì¤ëÄ»Îà¤Î°ì¼ï¡£
4475 ¥«¥ó¥à¥ê¥¬¥é¡Ê³Ø̾Parus cristatus¡Ë¤Ï¡¢¥¹¥º¥áÌÜ¥·¥¸¥å¥¦¥«¥é²Ê¤ËʬÎव¤ì¤ëÄ»Îà¤Î°ì¼ï¡£
4477 ¥·¥¸¥å¥¦¥«¥é²Ê¡Ê¥·¥¸¥å¥¦¥«¥é¤«¡¢³Ø̾ Paridae¡Ë¤Ï¡¢Ä»Îॹ¥º¥áÌܤβʤǤ¢¤ë¡£¥·¥¸¥å¥¦¥«¥é¡Ê»Í½½¿ý¡Ë¤ÈÁí¾Î¤µ¤ì¤ë¤¬¡¢¶¹µÁ¤Ë¤Ï¤³¤Î1¼ï¤ò¥·¥¸¥å¥¦¥«¥é¤È¸Æ¤Ö¡£
4479 _EOT
4480 check behave:iconv_mbyte_base64-5 0 "${MBOX}" '1686827547 2051'
4481 check behave:iconv_mbyte_base64-6 - ./.terr '4294967295 0'
4483 printf 'eval f 1; write ./.twrite\n' |
4484 ${MAILX} ${ARGS} ${ADDARG_UNI} -Rf "${MBOX}" >./.tlog 2>&1
4485 check behave:iconv_mbyte_base64-7 0 ./.twrite '1259742080 686'
4486 check behave:iconv_mbyte_base64-8 - ./.tlog '500059195 119'
4487 else
4488 echo 'behave:iconv_mbyte_base64: EUC-JP unsupported, skipping 5-8'
4491 t_epilog
4494 t_behave_iconv_mainbody() {
4495 t_prolog t_behave_iconv_mainbody
4496 TRAP_EXIT_ADDONS="./.t*"
4498 if [ -n "${UTF8_LOCALE}" ] && have_feat iconv; then
4500 else
4501 echo 'behave:iconv_mainbody: unsupported, skipped'
4502 return
4505 ${cat} <<-_EOT > ./.tsendmail.sh
4506 #!${SHELL} -
4507 (echo 'From HamamelisVirginiana Fri Oct 20 16:23:21 2017' && ${cat} &&
4508 echo) >> "${MBOX}"
4509 _EOT
4510 chmod 0755 ./.tsendmail.sh
4512 printf '–' | ${MAILX} ${ARGS} ${ADDARG_UNI} -Smta=./.tsendmail.sh \
4513 -S charset-7bit=us-ascii -S charset-8bit=utf-8 \
4514 -s '–' over-the@rain.bow 2>./.terr
4515 check behave:iconv_mainbody-1 0 "${MBOX}" '3634015017 251'
4516 check behave:iconv_mainbody-2 - ./.terr '4294967295 0'
4518 printf '–' | ${MAILX} ${ARGS} ${ADDARG_UNI} -Smta=./.tsendmail.sh \
4519 -S charset-7bit=us-ascii -S charset-8bit=us-ascii \
4520 -s '–' over-the@rain.bow 2>./.terr
4521 exn0_test behave:iconv_mainbody-3
4522 check behave:iconv_mainbody-3 - "${MBOX}" '3634015017 251'
4523 check behave:iconv_mainbody-4 - ./.terr '2579894983 148'
4525 # The different iconv(3) implementations use different replacement sequence
4526 # types (character-wise, byte-wise, and the character(s) used differ)
4527 i="${MAILX_ICONV_MODE}"
4528 if [ -n "${i}" ]; then
4529 printf 'p\nx\n' | ${MAILX} ${ARGS} -Rf "${MBOX}" >./.tout 2>./.terr
4530 j=${?}
4531 ex0_test behave:iconv_mainbody-5-0 ${j}
4532 check behave:iconv_mainbody-5-1 - ./.terr '4294967295 0'
4533 if [ ${i} -eq 13 ]; then
4534 check behave:iconv_mainbody-5-2 - ./.tout '189327996 283'
4535 elif [ ${i} -eq 12 ]; then
4536 check behave:iconv_mainbody-5-3 - ./.tout '1959197095 283'
4537 elif [ ${i} -eq 3 ]; then
4538 check behave:iconv_mainbody-5-4 - ./.tout '3196380198 279'
4539 else
4540 check behave:iconv_mainbody-5-5 - ./.tout '3760313827 279'
4542 else
4543 echo 'behave:iconv_mainbody-5: unsupported, skipped'
4546 t_epilog
4549 t_behave_q_t_etc_opts() {
4550 t_prolog t_behave_q_t_etc_opts
4551 TRAP_EXIT_ADDONS="./.t*"
4553 # Three tests for MIME encoding and (a bit) content classification.
4554 # At the same time testing -q FILE, < FILE and -t FILE
4555 t__put_body > ./.tin
4557 ${rm} -f "${MBOX}"
4558 < ./.tin ${MAILX} ${ARGS} ${ADDARG_UNI} \
4559 -a ./.tin -s "`t__put_subject`" "${MBOX}"
4560 check behave:q_t_etc_opts-1 0 "${MBOX}" '3570973309 6646'
4562 ${rm} -f "${MBOX}"
4563 < /dev/null ${MAILX} ${ARGS} ${ADDARG_UNI} \
4564 -a ./.tin -s "`t__put_subject`" -q ./.tin "${MBOX}"
4565 check behave:q_t_etc_opts-2 0 "${MBOX}" '3570973309 6646'
4567 ${rm} -f "${MBOX}"
4568 ( echo "To: ${MBOX}" && echo "Subject: `t__put_subject`" && echo &&
4569 ${cat} ./.tin
4570 ) | ${MAILX} ${ARGS} ${ADDARG_UNI} -Snodot -a ./.tin -t
4571 check behave:q_t_etc_opts-3 0 "${MBOX}" '3570973309 6646'
4573 t_epilog
4576 t_behave_s_mime() {
4577 have_feat smime || {
4578 echo 'behave:s/mime: unsupported, skipped'
4579 return
4582 t_prolog t_behave_s_mime
4583 TRAP_EXIT_ADDONS="./.t.conf ./.tkey.pem ./.tcert.pem ./.tpair.pem"
4584 TRAP_EXIT_ADDONS="${TRAP_EXIT_ADDONS} ./.VERIFY ./.DECRYPT ./.ENCRYPT"
4585 TRAP_EXIT_ADDONS="${TRAP_EXIT_ADDONS} ./.tsendmail.sh"
4587 printf 'behave:s/mime: .. generating test key and certificate ..\n'
4588 ${cat} <<-_EOT > ./.t.conf
4589 [ req ]
4590 default_bits = 1024
4591 default_keyfile = keyfile.pem
4592 distinguished_name = req_distinguished_name
4593 attributes = req_attributes
4594 prompt = no
4595 output_password =
4597 [ req_distinguished_name ]
4598 C = GB
4599 ST = Over the
4600 L = rainbow
4601 O = S-nail
4602 OU = S-nail.smime
4603 CN = S-nail.test
4604 emailAddress = test@localhost
4606 [ req_attributes ]
4607 challengePassword =
4608 _EOT
4609 openssl req -x509 -nodes -days 3650 -config ./.t.conf \
4610 -newkey rsa:1024 -keyout ./.tkey.pem -out ./.tcert.pem >/dev/null 2>&1
4611 ${cat} ./.tkey.pem ./.tcert.pem > ./.tpair.pem
4613 # Sign/verify
4614 printf 'behave:s/mime:sign/verify: '
4615 echo bla | ${MAILX} ${ARGS} \
4616 -Ssmime-ca-file=./.tcert.pem -Ssmime-sign-cert=./.tpair.pem \
4617 -Ssmime-sign -Sfrom=test@localhost \
4618 -s 'S/MIME test' ./.VERIFY
4619 if [ $? -eq 0 ]; then
4620 printf 'ok\n'
4621 else
4622 printf 'failed\n'
4623 ESTAT=1
4624 t_epilog
4625 return
4628 ${awk} '
4629 BEGIN{ skip=0 }
4630 /^Content-Description: /{ skip = 2; print; next }
4631 /^$/{ if(skip) --skip }
4632 { if(!skip) print }
4634 < ./.VERIFY > "${MBOX}"
4635 check behave:s/mime:sign/verify:checksum - "${MBOX}" '2900817158 648'
4637 printf 'behave:s/mime:sign/verify:verify '
4638 printf 'verify\nx\n' |
4639 ${MAILX} ${ARGS} \
4640 -Ssmime-ca-file=./.tcert.pem -Ssmime-sign-cert=./.tpair.pem \
4641 -Ssmime-sign -Sfrom=test@localhost \
4642 -Serrexit -R \
4643 -f ./.VERIFY >/dev/null 2>&1
4644 if [ $? -eq 0 ]; then
4645 printf 'ok\n'
4646 else
4647 printf 'failed\n'
4648 ESTAT=1
4649 t_epilog
4650 return
4653 printf 'behave:s/mime:sign/verify:disproof-1 '
4654 if openssl smime -verify -CAfile ./.tcert.pem \
4655 -in ./.VERIFY >/dev/null 2>&1; then
4656 printf 'ok\n'
4657 else
4658 printf 'failed\n'
4659 ESTAT=1
4660 t_epilog
4661 return
4664 # (signing +) encryption / decryption
4665 ${cat} <<-_EOT > ./.tsendmail.sh
4666 #!${SHELL} -
4667 (echo 'From Euphrasia Thu Apr 27 17:56:23 2017' && ${cat}) > ./.ENCRYPT
4668 _EOT
4669 chmod 0755 ./.tsendmail.sh
4671 printf 'behave:s/mime:encrypt+sign: '
4672 echo bla |
4673 ${MAILX} ${ARGS} \
4674 -Ssmime-force-encryption \
4675 -Ssmime-encrypt-recei@ver.com=./.tpair.pem \
4676 -Smta=./.tsendmail.sh \
4677 -Ssmime-ca-file=./.tcert.pem -Ssmime-sign-cert=./.tpair.pem \
4678 -Ssmime-sign -Sfrom=test@localhost \
4679 -s 'S/MIME test' recei@ver.com
4680 if [ $? -eq 0 ]; then
4681 printf 'ok\n'
4682 else
4683 ESTAT=1
4684 printf 'error: encrypt+sign failed\n'
4687 ${sed} -e '/^$/,$d' < ./.ENCRYPT > "${MBOX}"
4688 check behave:s/mime:encrypt+sign:checksum - "${MBOX}" '1937410597 327'
4690 printf 'behave:s/mime:decrypt+verify: '
4691 printf 'decrypt ./.DECRYPT\nfi ./.DECRYPT\nverify\nx\n' |
4692 ${MAILX} ${ARGS} \
4693 -Ssmime-force-encryption \
4694 -Ssmime-encrypt-recei@ver.com=./.tpair.pem \
4695 -Smta=./.tsendmail.sh \
4696 -Ssmime-ca-file=./.tcert.pem -Ssmime-sign-cert=./.tpair.pem \
4697 -Ssmime-sign -Sfrom=test@localhost \
4698 -Serrexit -R \
4699 -f ./.ENCRYPT >/dev/null 2>&1
4700 if [ $? -eq 0 ]; then
4701 printf 'ok\n'
4702 else
4703 ESTAT=1
4704 printf 'failed\n'
4707 ${awk} '
4708 BEGIN{ skip=0 }
4709 /^Content-Description: /{ skip = 2; print; next }
4710 /^$/{ if(skip) --skip }
4711 { if(!skip) print }
4713 < ./.DECRYPT > "${MBOX}"
4714 check behave:s/mime:decrypt+verify:checksum - "${MBOX}" '1720739247 931'
4716 printf 'behave:s/mime:decrypt+verify:disproof-1: '
4717 if (openssl smime -decrypt -inkey ./.tkey.pem -in ./.ENCRYPT |
4718 openssl smime -verify -CAfile ./.tcert.pem) >/dev/null 2>&1; then
4719 printf 'ok\n'
4720 else
4721 printf 'failed\n'
4722 ESTAT=1
4725 printf "behave:s/mime:encrypt: "
4726 echo bla | ${MAILX} ${ARGS} \
4727 -Ssmime-force-encryption \
4728 -Ssmime-encrypt-recei@ver.com=./.tpair.pem \
4729 -Smta=./.tsendmail.sh \
4730 -Ssmime-ca-file=./.tcert.pem -Ssmime-sign-cert=./.tpair.pem \
4731 -Sfrom=test@localhost \
4732 -s 'S/MIME test' recei@ver.com
4733 if [ $? -eq 0 ]; then
4734 printf 'ok\n'
4735 else
4736 ESTAT=1
4737 printf 'failed\n'
4740 # Same as behave:s/mime:encrypt+sign:checksum above
4741 ${sed} -e '/^$/,$d' < ./.ENCRYPT > "${MBOX}"
4742 check behave:s/mime:encrypt:checksum - "${MBOX}" '1937410597 327'
4744 ${rm} -f ./.DECRYPT
4745 printf 'decrypt ./.DECRYPT\nx\n' | ${MAILX} ${ARGS} \
4746 -Ssmime-force-encryption \
4747 -Ssmime-encrypt-recei@ver.com=./.tpair.pem \
4748 -Smta=./.tsendmail.sh \
4749 -Ssmime-ca-file=./.tcert.pem -Ssmime-sign-cert=./.tpair.pem \
4750 -Sfrom=test@localhost \
4751 -Serrexit -R \
4752 -f ./.ENCRYPT >/dev/null 2>&1
4753 check behave:s/mime:decrypt 0 "./.DECRYPT" '2624716890 422'
4755 printf 'behave:s/mime:decrypt:disproof-1: '
4756 if openssl smime -decrypt -inkey ./.tkey.pem \
4757 -in ./.ENCRYPT >/dev/null 2>&1; then
4758 printf 'ok\n'
4759 else
4760 printf 'failed\n'
4761 ESTAT=1
4764 t_epilog
4767 # t_content()
4768 # Some basic tests regarding correct sending of mails, via STDIN / -t / -q,
4769 # including basic MIME Content-Transfer-Encoding correctness (quoted-printable)
4770 # Note we unfortunately need to place some statements without proper
4771 # indentation because of continuation problems
4772 # xxx Note: t_content() was the first test (series) written. Today many
4773 # xxx aspects are (better) covered by other tests above, some are not.
4774 # xxx At some future date and time, convert the last remains not covered
4775 # xxx elsewhere to a real t_behave_* test and drop t_content()
4776 t_content() {
4777 t_prolog t_content
4779 # Test for [260e19d] (Juergen Daubert)
4780 ${rm} -f "${MBOX}"
4781 echo body | ${MAILX} ${ARGS} "${MBOX}"
4782 check content:004 0 "${MBOX}" '2917662811 98'
4784 # "Test for" [d6f316a] (Gavin Troy)
4785 ${rm} -f "${MBOX}"
4786 printf "m ${MBOX}\n~s subject1\nEmail body\n~.\nfi ${MBOX}\np\nx\n" |
4787 ${MAILX} ${ARGS} ${ADDARG_UNI} -Spipe-text/plain="@* ${cat}" > "${BODY}"
4788 check content:006 0 "${MBOX}" '2099098650 122'
4789 check content:006-1 - "${BODY}" '794542938 174'
4791 # "Test for" [c299c45] (Peter Hofmann) TODO shouldn't end up QP-encoded?
4792 ${rm} -f "${MBOX}"
4793 ${awk} 'BEGIN{
4794 for(i = 0; i < 10000; ++i)
4795 printf "\xC3\xBC"
4796 #printf "\xF0\x90\x87\x90"
4797 }' | ${MAILX} ${ARGS} ${ADDARG_UNI} -s TestSubject "${MBOX}"
4798 check content:007 0 "${MBOX}" '534262374 61816'
4800 t_epilog
4803 t__put_subject() {
4804 # MIME encoding (QP) stress message subject
4805 printf 'Äbrä Kä?dä=brö Fü?di=bus? '\
4806 'adadaddsssssssddddddddddddddddddddd'\
4807 'ddddddddddddddddddddddddddddddddddd'\
4808 'ddddddddddddddddddddddddddddddddddd'\
4809 'dddddddddddddddddddd Hallelulja? Od'\
4810 'er?? eeeeeeeeeeeeeeeeeeeeeeeeeeeeee'\
4811 'eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee'\
4812 'eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee f'\
4813 'fffffffffffffffffffffffffffffffffff'\
4814 'fffffffffffffffffffff ggggggggggggg'\
4815 'ggggggggggggggggggggggggggggggggggg'\
4816 'ggggggggggggggggggggggggggggggggggg'\
4817 'ggggggggggggggggggggggggggggggggggg'\
4818 'gggggggggggggggg'
4821 t__put_body() {
4822 # MIME encoding (QP) stress message body
4823 printf \
4824 'Ich bin eine DÖS-Datäi mit sehr langen Zeilen und auch '\
4825 'sonst bin ich ganz schön am Schleudern, da kannste denke '\
4826 "wasde willst, gelle, gelle, gelle, gelle, gelle.\r\n"\
4827 "Ich bin eine DÖS-Datäi mit langen Zeilen und auch sonst \r\n"\
4828 "Ich bin eine DÖS-Datäi mit langen Zeilen und auch sonst 1\r\n"\
4829 "Ich bin eine DÖS-Datäi mit langen Zeilen und auch sonst 12\r\n"\
4830 "Ich bin eine DÖS-Datäi mit langen Zeilen und auch sonst 123\r\n"\
4831 "Ich bin eine DÖS-Datäi mit langen Zeilen und auch sonst 1234\r\n"\
4832 "Ich bin eine DÖS-Datäi mit langen Zeilen und auch sonst 12345\r\n"\
4833 "Ich bin eine DÖS-Datäi mit langen Zeilen und auch sonst 123456\r\n"\
4834 "Ich bin eine DÖS-Datäi mit langen Zeilen und auch sonst 1234567\r\n"\
4835 "Ich bin eine DÖS-Datäi mit langen Zeilen und auch sonst 12345678\r\n"\
4836 "Ich bin eine DÖS-Datäi mit langen Zeilen und auch sonst 123456789\r\n"\
4837 "Unn ausserdem habe ich trailing SP/HT/SP/HT whitespace \r\n"\
4838 "Unn ausserdem habe ich trailing HT/SP/HT/SP whitespace \r\n"\
4839 "auf den zeilen vorher.\r\n"\
4840 "From am Zeilenbeginn und From der Mitte gibt es auch.\r\n"\
4841 ".\r\n"\
4842 "Die letzte Zeile war nur ein Punkt.\r\n"\
4843 "..\r\n"\
4844 "Das waren deren zwei.\r\n"\
4845 " \r\n"\
4846 "Die letzte Zeile war ein Leerschritt.\n"\
4847 "=VIER = EQUAL SIGNS=ON A LINE=\r\n"\
4848 "Prösterchen.\r\n"\
4849 ".\n"\
4850 "Die letzte Zeile war nur ein Punkt, mit Unix Zeilenende.\n"\
4851 "..\n"\
4852 "Das waren deren zwei. ditto.\n"\
4853 "Prösterchen.\n"\
4854 "Unn ausseerdem habe ich trailing SP/HT/SP/HT whitespace \n"\
4855 "Unn ausseerdem habe ich trailing HT/SP/HT/SP whitespace \n"\
4856 "auf den zeilen vorher.\n"\
4857 "ditto.\n"\
4858 "Ich bin eine ziemlich lange, steile, scharfe Zeile mit Unix Zeilenende.\n"\
4859 "Ich bin eine ziemlich lange, steile, scharfe Zeile mit Unix Zeilenende.1"\
4860 "\n"\
4861 "Ich bin eine ziemlich lange, steile, scharfe Zeile mit Unix Zeilenende.12"\
4862 "\n"\
4863 "Ich bin eine ziemlich lange, steile, scharfe Zeile mit Unix Zeilenende.12"\
4864 "3\n"\
4865 "Ich bin eine ziemlich lange, steile, scharfe Zeile mit Unix Zeilenende.12"\
4866 "34\n"\
4867 "Ich bin eine ziemlich lange, steile, scharfe Zeile mit Unix Zeilenende.12"\
4868 "345\n"\
4869 "Ich bin eine ziemlich lange, steile, scharfe Zeile mit Unix Zeilenende.12"\
4870 "3456\n"\
4871 "QP am Zeilenende über soft-nl hinweg\n"\
4872 "Ich bin eine ziemlich lange, steile, scharfe Zeile mit Unix Zeilenende."\
4873 "ö123\n"\
4874 "Ich bin eine ziemlich lange, steile, scharfe Zeile mit Unix Zeilenende."\
4875 "1ö23\n"\
4876 "Ich bin eine ziemlich lange, steile, scharfe Zeile mit Unix Zeilenende."\
4877 "12ö3\n"\
4878 "Ich bin eine ziemlich lange, steile, scharfe Zeile mit Unix Zeilenende."\
4879 "123ö\n"\
4880 "=VIER = EQUAL SIGNS=ON A LINE=\n"\
4881 " \n"\
4882 "Die letzte Zeile war ein Leerschritt.\n"\
4886 t_all() {
4887 # if have_feat devel; then
4888 # ARGS="${ARGS} -Smemdebug"
4889 # export ARGS
4890 # fi
4892 if [ -n "${UTF8_LOCALE}" ]; then
4893 printf 'Using Unicode locale %s\n' "${UTF8_LOCALE}"
4894 else
4895 printf 'No Unicode locale found, disabling Unicode tests\n'
4898 t_behave
4899 t_content
4902 if [ -z "${CHECK_ONLY}${MAE_TEST}" ]; then
4903 cc_all_configs
4904 elif [ -z "${MAE_TEST}" ] || [ ${#} -eq 0 ]; then
4905 t_all
4906 else
4907 while [ ${#} -gt 0 ]; do
4908 ${1}
4909 shift
4910 done
4913 [ ${ESTAT} -eq 0 ] && echo Ok || echo >&2 'Errors occurred'
4915 exit ${ESTAT}
4916 # s-sh-mode